upload tizen1.0 source
authorKim Kibum <kb0929.kim@samsung.com>
Sun, 29 Apr 2012 08:00:22 +0000 (17:00 +0900)
committerKim Kibum <kb0929.kim@samsung.com>
Sun, 29 Apr 2012 08:00:22 +0000 (17:00 +0900)
215 files changed:
CMakeLists.txt
Common/CMakeLists.txt [deleted file]
Common/include/Msg_Convert.h [deleted file]
MAPI/Emf_Mapi_Message.c [deleted file]
MAPI/Emf_Mapi_Types.c [deleted file]
MAPI/include/Emf_Mapi.h [deleted file]
MAPI/include/Emf_Mapi_Types.h [deleted file]
debian/changelog
debian/control
debian/email-service-0.install
debian/email-service-0.postinst
email-api/CMakeLists.txt [moved from MAPI/CMakeLists.txt with 52% similarity]
email-api/email-api-account.c [moved from MAPI/Emf_Mapi_Account.c with 55% similarity]
email-api/email-api-init.c [moved from MAPI/Emf_Mapi_Init.c with 68% similarity]
email-api/email-api-mail.c [new file with mode: 0755]
email-api/email-api-mailbox.c [moved from MAPI/Emf_Mapi_Mailbox.c with 66% similarity]
email-api/email-api-network.c [moved from MAPI/Emf_Mapi_Network.c with 63% similarity]
email-api/email-api-rule.c [moved from MAPI/Emf_Mapi_Rule.c with 72% similarity]
email-api/include/email-api-account.h [moved from MAPI/include/Emf_Mapi_Account.h with 71% similarity]
email-api/include/email-api-init.h [moved from MAPI/include/Emf_Mapi_Init.h with 79% similarity]
email-api/include/email-api-mail.h [moved from MAPI/include/Emf_Mapi_Message.h with 73% similarity]
email-api/include/email-api-mailbox.h [moved from MAPI/include/Emf_Mapi_Mailbox.h with 82% similarity]
email-api/include/email-api-network.h [moved from MAPI/include/Emf_Mapi_Network.h with 78% similarity]
email-api/include/email-api-rule.h [moved from MAPI/include/Emf_Mapi_Rule.h with 87% similarity]
email-api/include/email-api.h [new file with mode: 0755]
email-common-use/CMakeLists.txt [new file with mode: 0755]
email-common-use/email-convert.c [moved from Common/Msg_Convert.c with 76% similarity]
email-common-use/email-utilities.c [new file with mode: 0755]
email-common-use/include/email-convert.h [new file with mode: 0755]
email-common-use/include/email-debug-log.h [moved from include/emf-dbglog.h with 83% similarity]
email-common-use/include/email-errors.h [new file with mode: 0755]
email-common-use/include/email-internal-types.h [moved from email-core/include/em-core-types.h with 78% similarity]
email-common-use/include/email-types.h [moved from include/emf-types.h with 61% similarity]
email-common-use/include/email-utilities.h [new file with mode: 0755]
email-core/CMakeLists.txt
email-core/em-core-account.c [deleted file]
email-core/em-core-api.c [deleted file]
email-core/em-core-imap-idle.c [deleted file]
email-core/em-storage/em-storage-noti.c [deleted file]
email-core/em-storage/include/em-storage.h [deleted file]
email-core/email-core-account.c [new file with mode: 0755]
email-core/email-core-api.c [new file with mode: 0755]
email-core/email-core-event.c [moved from email-core/em-core-event.c with 61% similarity]
email-core/email-core-global.c [moved from email-core/em-core-global.c with 84% similarity]
email-core/email-core-imap-idle.c [new file with mode: 0755]
email-core/email-core-imap-mailbox.c [moved from email-core/em-core-imap-mailbox.c with 65% similarity]
email-core/email-core-mail.c [moved from email-core/em-core-mesg.c with 55% similarity]
email-core/email-core-mailbox-sync.c [moved from email-core/em-core-mailbox-sync.c with 72% similarity]
email-core/email-core-mailbox.c [moved from email-core/em-core-mailbox.c with 71% similarity]
email-core/email-core-mime.c [moved from email-core/em-core-mime.c with 74% similarity]
email-core/email-core-mm-callbacks.c [moved from email-core/em-core-mm-callbacks.c with 85% similarity]
email-core/email-core-smtp.c [moved from email-core/em-core-smtp.c with 51% similarity]
email-core/email-core-sound.c [moved from email-core/em-core-sound.c with 77% similarity]
email-core/email-core-timer.c [moved from email-core/em-core-timer.c with 71% similarity]
email-core/email-core-utils.c [moved from email-core/em-core-utils.c with 60% similarity]
email-core/email-device/email-device.c [moved from email-engine/emf-emn-noti.c with 62% similarity]
email-core/email-device/include/email-device.h [new file with mode: 0755]
email-core/email-network/email-network.c [moved from email-core/em-network/em-network.c with 84% similarity]
email-core/email-network/include/email-network.h [moved from email-core/em-network/include/em-network.h with 79% similarity]
email-core/email-storage/email-storage.c [moved from email-core/em-storage/em-storage.c with 56% similarity]
email-core/email-storage/include/email-storage.h [new file with mode: 0755]
email-core/include/em-core-account.h [deleted file]
email-core/include/em-core-api.h [deleted file]
email-core/include/em-core-event.h [deleted file]
email-core/include/em-core-global.h [deleted file]
email-core/include/em-core-imap-idle.h [deleted file]
email-core/include/em-core-mailbox.h [deleted file]
email-core/include/em-core-mesg.h [deleted file]
email-core/include/em-core-mime.h [deleted file]
email-core/include/em-core-sound-conflict.h [deleted file]
email-core/include/em-core-utils.h [deleted file]
email-core/include/email-core-account.h [new file with mode: 0755]
email-core/include/email-core-api.h [moved from include/emf-global.h with 79% similarity]
email-core/include/email-core-event.h [new file with mode: 0755]
email-core/include/email-core-global.h [new file with mode: 0755]
email-core/include/email-core-imap-idle.h [new file with mode: 0755]
email-core/include/email-core-imap-mailbox.h [moved from email-core/include/em-core-imap-mailbox.h with 63% similarity]
email-core/include/email-core-mail.h [new file with mode: 0755]
email-core/include/email-core-mailbox-sync.h [moved from email-core/include/em-core-mailbox-sync.h with 74% similarity]
email-core/include/email-core-mailbox.h [new file with mode: 0755]
email-core/include/email-core-mime.h [new file with mode: 0755]
email-core/include/email-core-smtp.h [moved from email-core/include/em-core-smtp.h with 51% similarity]
email-core/include/email-core-sound.h [moved from email-core/include/em-core-sound.h with 78% similarity]
email-core/include/email-core-timer.h [moved from email-core/include/em-core-timer.h with 84% similarity]
email-core/include/email-core-utils.h [new file with mode: 0755]
email-daemon/CMakeLists.txt [moved from email-engine/CMakeLists.txt with 56% similarity]
email-daemon/email-daemon-account.c [moved from email-engine/emf-account.c with 67% similarity]
email-daemon/email-daemon-auto-poll.c [moved from email-engine/emf-auto-poll.c with 73% similarity]
email-daemon/email-daemon-emn.c [moved from email-engine/emf-emn.c with 89% similarity]
email-daemon/email-daemon-etc.c [new file with mode: 0755]
email-daemon/email-daemon-init.c [new file with mode: 0755]
email-daemon/email-daemon-mail.c [new file with mode: 0755]
email-daemon/email-daemon-mailbox.c [moved from email-engine/emf-mailbox.c with 71% similarity]
email-daemon/include/email-daemon-account.h [moved from include/emf-account.h with 76% similarity]
email-daemon/include/email-daemon-auto-poll.h [moved from include/emf-auto-poll.h with 65% similarity]
email-daemon/include/email-daemon-emn.h [moved from include/emf-emn.h with 70% similarity]
email-daemon/include/email-daemon-init.h [moved from include/emf-init.h with 86% similarity]
email-daemon/include/email-daemon-mutex.h [new file with mode: 0755]
email-daemon/include/email-daemon.h [moved from include/emflib.h with 61% similarity]
email-daemon/main.c [new file with mode: 0755]
email-engine/emf-etc.c [deleted file]
email-engine/emf-global.c [deleted file]
email-engine/emf-init.c [deleted file]
email-engine/emf-mail.c [deleted file]
email-engine/main.c [deleted file]
email-ipc/CMakeLists.txt [new file with mode: 0755]
email-ipc/cscope.files [new file with mode: 0644]
email-ipc/cscope.out [new file with mode: 0644]
email-ipc/email-ipc-api.c [new file with mode: 0755]
email-ipc/email-ipc-api/email-ipc-api-info.c [new file with mode: 0755]
email-ipc/email-ipc-api/email-ipc-param-list.c [new file with mode: 0755]
email-ipc/email-ipc-api/email-ipc-param.c [moved from ipc/api/ipc-param.cpp with 60% similarity]
email-ipc/email-ipc-api/include/email-ipc-api-info.h [moved from ipc/api/include/ipc-api-info.h with 77% similarity]
email-ipc/email-ipc-api/include/email-ipc-param-list.h [moved from ipc/api/include/ipc-param-list.h with 53% similarity]
email-ipc/email-ipc-api/include/email-ipc-param.h [moved from ipc/api/include/ipc-param.h with 75% similarity]
email-ipc/email-ipc-build.c [moved from ipc/ipc-library-build.cpp with 96% similarity]
email-ipc/email-ipc-proxy.c [moved from ipc/ipc-library-proxy.cpp with 58% similarity]
email-ipc/email-ipc-stub.c [moved from ipc/ipc-library-stub.cpp with 62% similarity]
email-ipc/email-proxy/email-proxy-callback-info.c [new file with mode: 0755]
email-ipc/email-proxy/email-proxy-main.c [new file with mode: 0755]
email-ipc/email-proxy/email-proxy-socket.c [new file with mode: 0755]
email-ipc/email-proxy/include/email-proxy-callback-info.h [new file with mode: 0755]
email-ipc/email-proxy/include/email-proxy-main.h [moved from ipc/common/include/cm-list.h with 67% similarity]
email-ipc/email-proxy/include/email-proxy-socket.h [moved from ipc/proxy/include/ipc-proxy-socket.h with 71% similarity]
email-ipc/email-socket/email-ipc-socket.c [new file with mode: 0755]
email-ipc/email-socket/include/email-ipc-socket.h [moved from ipc/socket/include/ipc-socket.h with 55% similarity]
email-ipc/email-stub/email-stub-main.c [new file with mode: 0755]
email-ipc/email-stub/email-stub-queue.c [new file with mode: 0755]
email-ipc/email-stub/email-stub-response-info.c [moved from ipc/proxy/ipc-callback-info.cpp with 59% similarity]
email-ipc/email-stub/email-stub-socket.c [new file with mode: 0755]
email-ipc/email-stub/email-stub-task-manager.c [new file with mode: 0755]
email-ipc/email-stub/email-stub-task.c [new file with mode: 0755]
email-ipc/email-stub/include/email-stub-main.h [new file with mode: 0755]
email-ipc/email-stub/include/email-stub-queue.h [moved from ipc/stub/include/ipc-response-info.h with 68% similarity]
email-ipc/email-stub/include/email-stub-response-info.h [new file with mode: 0755]
email-ipc/email-stub/include/email-stub-socket.h [moved from ipc/stub/include/ipc-stub-socket.h with 60% similarity]
email-ipc/email-stub/include/email-stub-task-manager.h [moved from ipc/proxy/include/ipc-callback-info.h with 65% similarity]
email-ipc/email-stub/include/email-stub-task.h [moved from ipc/stub/include/ipc-task.h with 64% similarity]
email-ipc/include/email-ipc-build.h [moved from ipc/include/ipc-library-build.h with 100% similarity]
email-ipc/include/email-ipc.h [moved from ipc/include/ipc-library.h with 57% similarity]
email-service.pc.in
email-service_PG.h [moved from SLP_EmailService_PG.h with 81% similarity]
emf-emn-storage/emf-emn-storage.c [deleted file]
image/email_image001.png [deleted file]
image/email_image002.png [deleted file]
image/email_image003.png [deleted file]
image/email_image004.png [deleted file]
image/email_image005.png [deleted file]
image/email_image006.png [deleted file]
image/email_image007.png [deleted file]
image/email_image008.png [deleted file]
image/email_image009.png [deleted file]
image/email_image010.png [deleted file]
image/email_image011.png [deleted file]
image/email_image012.png [deleted file]
include/.gitignore [deleted file]
include/emf-emn-noti.h [deleted file]
include/emf-emn-storage.h [deleted file]
include/emf-mutex.h [deleted file]
ipc/CMakeLists.txt [deleted file]
ipc/api/ipc-api-info.cpp [deleted file]
ipc/api/ipc-param-list.cpp [deleted file]
ipc/common/cm-list.cpp [deleted file]
ipc/common/cm-sys-msg-queue.cpp [deleted file]
ipc/common/include/cm-sys-msg-queue.h [deleted file]
ipc/ipc-library-api.cpp [deleted file]
ipc/proxy/include/ipc-proxy-main.h [deleted file]
ipc/proxy/ipc-proxy-main.cpp [deleted file]
ipc/proxy/ipc-proxy-socket.cpp [deleted file]
ipc/socket/ipc-socket.cpp [deleted file]
ipc/stub/include/ipc-queue.h [deleted file]
ipc/stub/include/ipc-stub-main.h [deleted file]
ipc/stub/include/ipc-task-manager.h [deleted file]
ipc/stub/ipc-queue.cpp [deleted file]
ipc/stub/ipc-response-info.cpp [deleted file]
ipc/stub/ipc-stub-main.cpp [deleted file]
ipc/stub/ipc-stub-socket.cpp [deleted file]
ipc/stub/ipc-task-manager.cpp [deleted file]
ipc/stub/ipc-task.cpp [deleted file]
packaging/email-service.spec [changed mode: 0644->0755]
po/CMakeLists.txt [deleted file]
po/POTFILES.in [deleted file]
po/de_DE.po [deleted file]
po/el_GR.po [deleted file]
po/email.pot [deleted file]
po/en.po [deleted file]
po/es_ES.po [deleted file]
po/fr_FR.po [deleted file]
po/it_IT.po [deleted file]
po/ja_JP.po [deleted file]
po/ko_KR.po [deleted file]
po/nl_NL.po [deleted file]
po/pt_PT.po [deleted file]
po/ru_RU.po [deleted file]
po/tr_TR.po [deleted file]
po/update-po.sh [deleted file]
po/zh_CN.po [deleted file]
po/zh_HK.po [deleted file]
po/zh_TW.po [deleted file]
utilities/CMakeLists.txt
utilities/test-application/include/testapp-account.h [moved from utilities/email-service-test-application/email-service-test-application/include/emf-test-account.h with 100% similarity]
utilities/test-application/include/testapp-mail.h [moved from utilities/email-service-test-application/email-service-test-application/include/emf-test-message.h with 100% similarity]
utilities/test-application/include/testapp-mailbox.h [moved from utilities/email-service-test-application/email-service-test-application/include/emf-test-mailbox.h with 100% similarity]
utilities/test-application/include/testapp-others.h [moved from utilities/email-service-test-application/email-service-test-application/include/emf-test-others.h with 100% similarity]
utilities/test-application/include/testapp-rule.h [moved from utilities/email-service-test-application/email-service-test-application/include/emf-test-rule.h with 100% similarity]
utilities/test-application/include/testapp-thread.h [moved from utilities/email-service-test-application/email-service-test-application/include/emf-test-thread.h with 100% similarity]
utilities/test-application/include/testapp-utility.h [moved from utilities/email-service-test-application/email-service-test-application/include/emf-test-utility.h with 96% similarity]
utilities/test-application/main.c [moved from utilities/email-service-test-application/email-service-test-application/emf-test-main.c with 94% similarity]
utilities/test-application/testapp-account.c [moved from utilities/email-service-test-application/email-service-test-application/emf-test-account.c with 89% similarity]
utilities/test-application/testapp-mail.c [moved from utilities/email-service-test-application/email-service-test-application/emf-test-message.c with 55% similarity]
utilities/test-application/testapp-mailbox.c [moved from utilities/email-service-test-application/email-service-test-application/emf-test-mailbox.c with 68% similarity]
utilities/test-application/testapp-others.c [moved from utilities/email-service-test-application/email-service-test-application/emf-test-others.c with 90% similarity]
utilities/test-application/testapp-rule.c [moved from utilities/email-service-test-application/email-service-test-application/emf-test-rule.c with 98% similarity]
utilities/test-application/testapp-thread.c [moved from utilities/email-service-test-application/email-service-test-application/emf-test-thread.c with 95% similarity]
utilities/test-application/testapp-utility.c [moved from utilities/email-service-test-application/email-service-test-application/emf-test-utility.c with 78% similarity]

index 123b582..be31973 100755 (executable)
@@ -17,12 +17,12 @@ MESSAGE(">>> Build type: ${CMAKE_BUILD_TYPE}")
 ##########################################################
 # Define BASE LIB
 ##########################################################
-ADD_SUBDIRECTORY(Common)
+ADD_SUBDIRECTORY(email-common-use)
 
 #########################################################
 # Define IPC
 ##########################################################
-ADD_SUBDIRECTORY(ipc)
+ADD_SUBDIRECTORY(email-ipc)
 
 ##########################################################
 # Define STORAGE, NETWORK, CORE lib
@@ -34,13 +34,13 @@ ADD_SUBDIRECTORY(email-core)
 # Define Email API   
 ##########################################################
 
-ADD_SUBDIRECTORY(MAPI)
+ADD_SUBDIRECTORY(email-api)
 
 ##########################################################
 # Define Execute File
 ##########################################################
 
-ADD_SUBDIRECTORY(email-engine)
+ADD_SUBDIRECTORY(email-daemon)
 
 ##########################################################
 # Define Test App
@@ -49,12 +49,6 @@ ADD_SUBDIRECTORY(email-engine)
 ADD_SUBDIRECTORY(utilities)
 
 ##########################################################
-# Define locale
-##########################################################
-
-ADD_SUBDIRECTORY(po)
-
-##########################################################
 # Define Install Files
 ##########################################################
 
diff --git a/Common/CMakeLists.txt b/Common/CMakeLists.txt
deleted file mode 100755 (executable)
index 72ed455..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(email-base)
-
-SET(CMAKE_SKIP_BUILD_RPATH TRUE)
-
-IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
-       SET(CMAKE_BUILD_TYPE "Debug")
-ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
-
-MESSAGE("")
-MESSAGE(">>> current directory: ${CMAKE_CURRENT_SOURCE_DIR}")
-MESSAGE(">>> Build type: ${CMAKE_BUILD_TYPE}")
-
-SET(VISIBILITY "-DEXPORT_API=\"__attribute__((visibility(\\\"default\\\")))\"")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VISIBILITY} -fvisibility=hidden")
-
-SET(BASE-LIB "email-base")
-SET(BASE-SRCS 
-       ${CMAKE_SOURCE_DIR}/Common/Msg_Convert.c
-)
-
-INCLUDE_DIRECTORIES(
-       ${CMAKE_SOURCE_DIR}/include
-       ${CMAKE_SOURCE_DIR}/Common/include/ 
-       ${CMAKE_SOURCE_DIR}/email-core/include/
-       ${CMAKE_SOURCE_DIR}/email-core/em-storage/include/
-)
-
-INCLUDE(FindPkgConfig)
-pkg_check_modules(base_pkgs REQUIRED glib-2.0 dlog contacts-service) 
-
-FOREACH(flag ${base_pkgs_CFLAGS})
-       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
-#message(">>>[${BASE-LIB}] extra_cflags ${EXTRA_CFLAGS}")
-#message(">>>[${BASE-LIB}] base_pkgs_cflags ${base_pkgs_CFLAGS}")
-#message(">>>[${BASE-LIB}] result ${CMAKE_C_FLAGS}")
-
-SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
-
-ADD_LIBRARY(${BASE-LIB} SHARED ${BASE-SRCS})
-TARGET_LINK_LIBRARIES(${BASE-LIB} ${base_pkgs_LDFLAGS})
-SET_TARGET_PROPERTIES(${BASE-LIB} PROPERTIES SOVERSION ${VERSION_MAJOR})
-SET_TARGET_PROPERTIES(${BASE-LIB} PROPERTIES VERSION ${VERSION})
-
-#INSTALL(TARGETS ${BASE-LIB} LIBRARY DESTINATION lib)
-INSTALL(TARGETS ${BASE-LIB} DESTINATION lib COMPONENT RuntimeLibraries)
-
diff --git a/Common/include/Msg_Convert.h b/Common/include/Msg_Convert.h
deleted file mode 100755 (executable)
index 3edc269..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-#include "emflib.h"
-#include <time.h>
-#include "emf-dbglog.h"
-#include "em-storage.h"
-
-/* Account */
-EXPORT_API char* em_convert_account_to_byte_stream(emf_account_t* account, int* nStreamSize);
-EXPORT_API void  em_convert_byte_stream_to_account(char* pAccountStream,  emf_account_t* account);
-EXPORT_API int   em_convert_account_to_account_tbl(emf_account_t *account, emf_mail_account_tbl_t *account_tbl);
-EXPORT_API int   em_convert_account_tbl_to_account(emf_mail_account_tbl_t *account_tbl, emf_account_t *account);
-
-
-/* Mail */
-EXPORT_API char* em_convert_mail_to_byte_stream(emf_mail_t* mail, int* nStreamSize);
-EXPORT_API void  em_convert_byte_stream_to_mail(char* pStream,  emf_mail_t* mail);
-
-EXPORT_API char* em_convert_mail_head_to_byte_stream(emf_mail_head_t* mail_head, int* nStreamSize);
-EXPORT_API void  em_convert_byte_stream_to_mail_head(char* pStream,  emf_mail_head_t* mail_head);
-
-EXPORT_API char* em_convert_mail_body_to_byte_stream(emf_mail_body_t* mail_body, int* nStreamSize);
-EXPORT_API void  em_convert_byte_stream_to_mail_body(char* pStream,  emf_mail_body_t* mail_body);
-
-EXPORT_API char* em_convert_mail_info_to_byte_stream(emf_mail_info_t* mail_info, int* nStreamSize);
-EXPORT_API void  em_convert_byte_stream_to_mail_info(char* pStream,  emf_mail_info_t* mail_info);
-
-EXPORT_API char* em_convert_mail_data_to_byte_stream(emf_mail_data_t *input_mail_data, int intput_mail_data_count, int *output_stream_size);
-EXPORT_API void em_convert_byte_stream_to_mail_data(char *intput_stream, emf_mail_data_t **output_mail_data, int *output_mail_data_count);
-
-EXPORT_API int   em_convert_mail_tbl_to_mail(emf_mail_tbl_t *mail_table_data, emf_mail_t *mail_data);
-
-EXPORT_API int   em_convert_mail_tbl_to_mail_data(emf_mail_tbl_t *mail_table_data, int item_count, emf_mail_data_t **mail_data, int *error);
-EXPORT_API int   em_convert_mail_data_to_mail_tbl(emf_mail_data_t *mail_data, int item_count, emf_mail_tbl_t **mail_table_data, int *error);
-
-/* Attachment */
-EXPORT_API char* em_convert_attachment_data_to_byte_stream(emf_attachment_data_t *input_attachment_data, int intput_attachment_count, int* output_stream_size);
-EXPORT_API void em_convert_byte_stream_to_attachment_data(char *intput_stream, emf_attachment_data_t **output_attachment_data, int *output_attachment_count);
-
-EXPORT_API char* em_convert_attachment_info_to_byte_stream(emf_attachment_info_t* mail_atch, int* nStreamSize);
-EXPORT_API void  em_convert_byte_stream_to_attachment_info(char* pStream,  int attachment_num, emf_attachment_info_t** mail_atch);
-
-
-/* Mailbox */
-EXPORT_API char* em_convert_mailbox_to_byte_stream(emf_mailbox_t* pMailbox, int* nStreamSize);
-EXPORT_API void  em_convert_byte_stream_to_mailbox(char* pStream, emf_mailbox_t* pMailbox);
-
-
-/* Rule */
-EXPORT_API char* em_convert_rule_to_byte_stream(emf_rule_t* pRule, int* nStreamSize);
-EXPORT_API void  em_convert_byte_stream_to_rule(char* pStream, emf_rule_t* pMailbox);  
-
-/* Sending options */
-EXPORT_API char* em_convert_option_to_byte_stream(emf_option_t* pOption, int* nStreamSize);
-EXPORT_API void  em_convert_byte_stream_to_option(char* pStream, emf_option_t* pOption);
-
-EXPORT_API int   em_convert_string_to_datetime(char *datetime_str, emf_datetime_t *datetime, int *err_code);
-EXPORT_API int   em_convert_datetime_to_string(emf_datetime_t *input_datetime, char **output_datetime_str, int *err_code);
-
-
-EXPORT_API char* em_convert_extra_flags_to_byte_stream(emf_extra_flag_t new_flag, int* StreamSize);
-EXPORT_API void  em_convert_byte_stream_to_extra_flags(char* pStream, emf_extra_flag_t* new_flag);
-
-EXPORT_API char* em_convert_meeting_req_to_byte_stream(emf_meeting_request_t* meeting_req, int* nStreamSize);
-EXPORT_API void  em_convert_byte_stream_to_meeting_req(char* pStream,  emf_meeting_request_t* meeting_req);
-
-EXPORT_API int   em_convert_mail_flag_to_int(emf_mail_flag_t flag, int* i_flag, int* err_code);
-EXPORT_API int   em_convert_mail_int_to_flag(int i_flag, emf_mail_flag_t* flag, int* err_code);
-EXPORT_API int   em_convert_mail_status_to_mail_tbl(int mail_status, emf_mail_tbl_t *result_mail_tbl_data, int* err_code);
-EXPORT_API int   em_convert_mail_tbl_to_mail_status(emf_mail_tbl_t *mail_tbl_data, int *result_mail_status, int* err_code);
-EXPORT_API int   em_convert_mail_tbl_to_mail_flag(emf_mail_tbl_t *mail_tbl_data, emf_mail_flag_t *result_flag, int* err_code);
-EXPORT_API int   em_convert_mail_flag_to_mail_tbl(emf_mail_flag_t *flag, emf_mail_tbl_t *result_mail_tbl_data,  int* err_code);
-
diff --git a/MAPI/Emf_Mapi_Message.c b/MAPI/Emf_Mapi_Message.c
deleted file mode 100755 (executable)
index 931fc30..0000000
+++ /dev/null
@@ -1,3316 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-
-/**
- *
- * This file contains the data structures and interfaces needed for application,
- * to interact with Email Engine.
- * @file               Emf_Mapi_Message.c
- * @brief              This file contains the data structures and interfaces of Message related Functionality provided by 
- *                     Email Engine . 
- */
-
-#include <stdlib.h>
-#include <time.h>
-#include <string.h>
-#include "Emf_Mapi.h"
-#include "ipc-library.h"
-#include "Msg_Convert.h"
-#include "em-core-mesg.h"
-#include "em-core-smtp.h"
-#include "em-storage.h"
-#include "db-util.h"
-
-#define  DIR_SEPERATOR_CH '/'
-
-#define _DIRECT_TO_DB
-
-
-EXPORT_API int email_add_message(emf_mail_t* mail, emf_mailbox_t* mailbox, int from_composer)
-{
-       EM_DEBUG_FUNC_BEGIN("mail[%p], mailbox[%p], from_composer [%d]", mail, mailbox, from_composer);
-
-       EM_IF_NULL_RETURN_VALUE(mail,       EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(mail->head, EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(mail->info, EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(mail->body, EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(mailbox,    EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(mailbox->name,        EMF_ERROR_INVALID_PARAM);
-       EM_IF_ACCOUNT_ID_NULL(mail->info->account_id, EMF_ERROR_INVALID_PARAM);
-       EM_IF_ACCOUNT_ID_NULL(mailbox->account_id,    EMF_ERROR_INVALID_PARAM);
-
-       int err = EMF_ERROR_NONE, size = 0;
-       char* mail_head_stream = NULL, *mail_body_stream = NULL, *mail_info_stream = NULL, *mailbox_stream  = NULL;
-       void *return_from_ipc = NULL;
-       HIPC_API hAPI = NULL;
-       
-       if(from_composer) {
-               hAPI = ipcEmailAPI_Create(_EMAIL_API_ADD_MAIL_OLD);     
-
-               if(!hAPI) {
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_Create failed");
-                       err = EMF_ERROR_NULL_VALUE;             
-                       goto FINISH_OFF;
-               }
-
-               /* Head */
-               mail_head_stream = em_convert_mail_head_to_byte_stream(mail->head, &size);
-
-               if(!mail_head_stream) {
-                       EM_DEBUG_EXCEPTION("em_convert_mail_head_to_byte_stream failed");
-                       err = EMF_ERROR_NULL_VALUE;
-                       goto FINISH_OFF;
-               }
-               
-               if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, mail_head_stream, size)) {
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter for head failed");
-                       err = EMF_ERROR_OUT_OF_MEMORY;
-                       goto FINISH_OFF;
-               }
-               
-               /* Body */
-               mail_body_stream = em_convert_mail_body_to_byte_stream(mail->body, &size);
-
-               if(!mail_body_stream) {
-                       EM_DEBUG_EXCEPTION("em_convert_mail_body_to_byte_stream failed");
-                       err = EMF_ERROR_NULL_VALUE;
-                       goto FINISH_OFF;
-               }
-
-               if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, mail_body_stream, size)) {
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter for body failed");
-                       err = EMF_ERROR_OUT_OF_MEMORY;
-                       goto FINISH_OFF;
-               }
-
-               /* Info */
-               mail_info_stream = em_convert_mail_info_to_byte_stream(mail->info, &size);
-
-               if(!mail_info_stream) {
-                       EM_DEBUG_EXCEPTION("em_convert_mail_info_to_byte_stream failed");
-                       err = EMF_ERROR_NULL_VALUE;
-                       goto FINISH_OFF;
-               }
-
-               if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, mail_info_stream, size)) {
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter for info failed");
-                       err = EMF_ERROR_OUT_OF_MEMORY;
-                       goto FINISH_OFF;
-               }
-               
-               /* Mailbox */
-               mailbox_stream = em_convert_mailbox_to_byte_stream(mailbox, &size);
-
-               if(!mailbox_stream) {
-                       EM_DEBUG_EXCEPTION("em_convert_mailbox_to_byte_stream failed");
-                       err = EMF_ERROR_NULL_VALUE;
-                       goto FINISH_OFF;
-               }
-
-               if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, mailbox_stream, size)) {
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter mailbox Fail");
-                       err = EMF_ERROR_OUT_OF_MEMORY;
-                       goto FINISH_OFF;
-               }
-               
-
-               /* from_composer */
-               if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&from_composer, sizeof(int))) {
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter from_composer Failed");
-                       err = EMF_ERROR_OUT_OF_MEMORY;
-                       goto FINISH_OFF;
-               }
-
-               /* Execute API */
-               if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-                       EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPI failed");
-                       err = EMF_ERROR_IPC_SOCKET_FAILURE;
-                       goto FINISH_OFF;
-               }
-
-               return_from_ipc = ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
-               
-               if(return_from_ipc)
-                       err = *(int*)return_from_ipc;
-               else {
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter failed");
-                       err = EMF_ERROR_IPC_SOCKET_FAILURE;
-                       goto FINISH_OFF;
-               }
-
-               if(err == EMF_ERROR_NONE) {
-                       return_from_ipc = ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1);
-                       if(return_from_ipc)
-                               mail->info->uid = *(int*)return_from_ipc;
-                       else{
-                               EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter failed");
-                               err = EMF_ERROR_IPC_SOCKET_FAILURE;
-                               goto FINISH_OFF;
-                       }
-               }
-       } 
-       else {
-               if(!em_core_mail_save(mailbox->account_id, mailbox->name, mail, NULL, from_composer, &err)) {
-                       EM_DEBUG_EXCEPTION("em_core_mail_save failed [%d]", err);
-                       goto FINISH_OFF;
-               }
-       }
-
-FINISH_OFF:
-       if(hAPI) 
-               ipcEmailAPI_Destroy(hAPI);
-
-       EM_SAFE_FREE(mail_head_stream);
-       EM_SAFE_FREE(mail_body_stream);
-       EM_SAFE_FREE(mail_info_stream);
-       EM_SAFE_FREE(mailbox_stream);
-
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-
-}
-
-EXPORT_API int email_add_mail(emf_mail_data_t *input_mail_data, emf_attachment_data_t *input_attachment_data_list, int input_attachment_count, emf_meeting_request_t* input_meeting_request, int input_sync_server)
-{
-       EM_DEBUG_FUNC_BEGIN("input_mail_data[%p], input_attachment_data_list[%p], input_attachment_count [%d], input_meeting_request [%p], input_sync_server [%d]", input_mail_data, input_attachment_data_list, input_attachment_count, input_meeting_request, input_sync_server);
-
-       EM_IF_NULL_RETURN_VALUE(input_mail_data,               EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(input_mail_data->account_id,   EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(input_mail_data->mailbox_name, EMF_ERROR_INVALID_PARAM);
-
-       if(input_attachment_count > 0 && !input_attachment_data_list) {
-               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
-               return EMF_ERROR_INVALID_PARAM;
-       }
-
-       int       err = EMF_ERROR_NONE;
-       int       size = 0;
-       char     *mail_data_stream = NULL;
-       char     *attachment_data_list_stream  = NULL;
-       char     *meeting_request_stream = NULL;
-       void     *return_from_ipc = NULL;
-       HIPC_API  hAPI = NULL;
-       
-       if(input_sync_server) {
-               hAPI = ipcEmailAPI_Create(_EMAIL_API_ADD_MAIL); 
-
-               if(!hAPI) {
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_Create failed");
-                       err = EMF_ERROR_NULL_VALUE;             
-                       goto FINISH_OFF;
-               }
-
-               /* emf_mail_data_t */
-               mail_data_stream = em_convert_mail_data_to_byte_stream(input_mail_data, 1, &size);
-
-               if(!mail_data_stream) {
-                       EM_DEBUG_EXCEPTION("em_convert_mail_data_to_byte_stream failed");
-                       err = EMF_ERROR_NULL_VALUE;
-                       goto FINISH_OFF;
-               }
-               
-               if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, mail_data_stream, size)) {
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter for head failed");
-                       err = EMF_ERROR_OUT_OF_MEMORY;
-                       goto FINISH_OFF;
-               }
-               
-               /* emf_attachment_data_t */
-               attachment_data_list_stream = em_convert_attachment_data_to_byte_stream(input_attachment_data_list, input_attachment_count, &size);
-
-               if(!attachment_data_list_stream) {
-                       EM_DEBUG_EXCEPTION("em_convert_attachment_data_to_byte_stream failed");
-                       err = EMF_ERROR_NULL_VALUE;
-                       goto FINISH_OFF;
-               }
-
-               if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, attachment_data_list_stream, size)) {
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-                       err = EMF_ERROR_OUT_OF_MEMORY;
-                       goto FINISH_OFF;
-               }
-
-               /*  emf_meeting_request_t */
-               if ( input_mail_data->meeting_request_status != EMF_MAIL_TYPE_NORMAL ) {
-                       meeting_request_stream = em_convert_meeting_req_to_byte_stream(input_meeting_request, &size);
-
-                       if(!meeting_request_stream) {
-                               EM_DEBUG_EXCEPTION("em_convert_meeting_req_to_byte_stream failed");
-                               err = EMF_ERROR_NULL_VALUE;
-                               goto FINISH_OFF;
-                       }
-
-                       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, meeting_request_stream, size)) {
-                               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-                               err = EMF_ERROR_OUT_OF_MEMORY;
-                               goto FINISH_OFF;
-                       }
-               }
-
-               /* sync server */
-               if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&input_sync_server, sizeof(int))) {
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-                       err = EMF_ERROR_OUT_OF_MEMORY;
-                       goto FINISH_OFF;
-               }
-
-               /* Execute API */
-               if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-                       EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPI failed");
-                       err = EMF_ERROR_IPC_SOCKET_FAILURE;
-                       goto FINISH_OFF;
-               }
-
-               return_from_ipc = ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
-               
-               if(return_from_ipc)
-                       err = *(int*)return_from_ipc;
-               else {
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter failed");
-                       err = EMF_ERROR_IPC_SOCKET_FAILURE;
-                       goto FINISH_OFF;
-               }
-
-               if(err == EMF_ERROR_NONE) {
-                       return_from_ipc = ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1); /* result mail_id */
-                       if(return_from_ipc) {
-                               input_mail_data->mail_id = *(int*)return_from_ipc;
-                       }
-                       else{
-                               EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter failed");
-                               err = EMF_ERROR_IPC_SOCKET_FAILURE;
-                               goto FINISH_OFF;
-                       }
-                       return_from_ipc = ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 2); /* result thread_id */
-                       if(return_from_ipc) {
-                               input_mail_data->thread_id = *(int*)return_from_ipc;
-                       }
-                       else{
-                               EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter failed");
-                               err = EMF_ERROR_IPC_SOCKET_FAILURE;
-                               goto FINISH_OFF;
-                       }
-               }
-       } 
-       else {
-               if((err = em_core_add_mail(input_mail_data, input_attachment_data_list, input_attachment_count, input_meeting_request, input_sync_server)) != EMF_ERROR_NONE) {
-                       EM_DEBUG_EXCEPTION("em_core_add_mail failed [%d]", err);
-                       goto FINISH_OFF;
-               }
-       }
-
-FINISH_OFF:
-       if(hAPI) 
-               ipcEmailAPI_Destroy(hAPI);
-
-       EM_SAFE_FREE(mail_data_stream);
-       EM_SAFE_FREE(attachment_data_list_stream);
-
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-
-}
-
-int email_create_db_full()
-{
-       int mailbox_index, mail_index, mailbox_count, mail_slot_size;
-       emf_mail_tbl_t mail_table_data = {0};
-       emf_mailbox_t *mailbox_list = NULL;
-       int err = EMF_ERROR_NONE;
-
-       if ( (err = email_open_db()) != EMF_ERROR_NONE) {
-               EM_DEBUG_EXCEPTION("email_open_db failed [%d]", err);
-               return err;
-       }
-
-       mail_table_data.subject = (char*) em_core_malloc(50); 
-       mail_table_data.full_address_from = strdup("<dummy_from@nowhere.com>");
-       mail_table_data.full_address_to = strdup("<dummy_to@nowhere.com>");
-       mail_table_data.account_id =1;
-       mail_table_data.mailbox_name = (char*) em_core_malloc(250);
-
-       if( (err = email_get_mailbox_list_ex(1, -1, 0, &mailbox_list, &mailbox_count)) < EMF_ERROR_NONE) {
-               EM_DEBUG_EXCEPTION("email_get_mailbox_list_ex failed [%d]", err);
-               goto FINISH_OFF;
-       }
-
-       for(mailbox_index = 0; mailbox_index < mailbox_count; mailbox_index++) {
-               mail_slot_size= mailbox_list[mailbox_index].mail_slot_size;
-               for(mail_index = 0; mail_index < mail_slot_size; mail_index++) {
-                       sprintf(mail_table_data.subject, "Subject #%d",mail_index);
-                       strncpy(mail_table_data.mailbox_name, mailbox_list[mailbox_index].name, 250 - 1);
-                       mail_table_data.mailbox_type = mailbox_list[mailbox_index].mailbox_type;
-                       if( !em_storage_add_mail(&mail_table_data, 1, true, &err))  {
-                               EM_DEBUG_EXCEPTION("em_storage_add_mail failed [%d]",err);
-                               err = em_storage_get_emf_error_from_em_storage_error(err);
-                               goto FINISH_OFF;
-                       }
-               }
-       }
-
-FINISH_OFF:
-       if ( (err = email_close_db()) != EMF_ERROR_NONE) {
-               EM_DEBUG_EXCEPTION("email_close_db failed [%d]", err);
-       }       
-       
-       if(mailbox_list)
-               email_free_mailbox(&mailbox_list, mailbox_count);
-
-       EM_SAFE_FREE(mail_table_data.subject);
-       EM_SAFE_FREE(mail_table_data.mailbox_name);
-       EM_SAFE_FREE(mail_table_data.full_address_from);
-       EM_SAFE_FREE(mail_table_data.full_address_to);
-
-       return err;
-}
-
-EXPORT_API int email_update_message( int mail_id, emf_mail_t* mail)
-{
-       EM_DEBUG_FUNC_BEGIN("mail_id[%d], mali[%p]", mail_id, mail);
-       
-       int size = 0;
-       int ret = 0;
-       int err = EMF_ERROR_NONE;
-       void *retrun_from_ipc = NULL;
-       char* mail_head_stream =  NULL;
-       char* mail_body_stream =  NULL;
-       char* mail_info_stream =  NULL;
-       HIPC_API hAPI = NULL;
-       
-       EM_IF_NULL_RETURN_VALUE(mail, EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(mail->head, EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(mail->info, EMF_ERROR_INVALID_PARAM);   
-
-       if ( mail_id <= 0 ) {
-               EM_DEBUG_EXCEPTION("Invalid Param : mail_id[%d]", mail_id);
-               return EMF_ERROR_INVALID_PARAM;
-       }
-       EM_IF_ACCOUNT_ID_NULL(mail->info->account_id, EMF_ERROR_INVALID_PARAM); 
-       
-       hAPI = ipcEmailAPI_Create(_EMAIL_API_UPDATE_MAIL_OLD);  
-
-       if(!hAPI) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_Create failed");
-               err = EMF_ERROR_NULL_VALUE;             
-               goto FINISH_OFF;
-       }
-       
-       /* mail_id */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&mail_id, sizeof(int))) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;
-               goto FINISH_OFF;
-       }
-
-       /* Head */
-       mail_head_stream = em_convert_mail_head_to_byte_stream(mail->head, &size);
-       if(!mail_head_stream) {
-               EM_DEBUG_EXCEPTION("em_convert_mail_head_to_byte_stream failed");
-               err = EMF_ERROR_NULL_VALUE;
-               goto FINISH_OFF;
-       }
-
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, mail_head_stream, size)) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;
-               goto FINISH_OFF;
-       }
-
-       /* Body */
-       mail_body_stream = em_convert_mail_body_to_byte_stream(mail->body, &size);
-
-       if (!mail_body_stream ) {
-               int dummy_body = 0;
-               EM_DEBUG_LOG(" Mail body is NULL. Add dummy data(4 bytes)");
-               if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&dummy_body,  sizeof(int))) {
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-                       err = EMF_ERROR_OUT_OF_MEMORY;
-                       goto FINISH_OFF;
-               }
-       } 
-       else {
-               if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, mail_body_stream, size)) {
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-                       err = EMF_ERROR_OUT_OF_MEMORY;
-                       goto FINISH_OFF;
-               }
-       }
-
-       /* Info */
-       mail_info_stream = em_convert_mail_info_to_byte_stream(mail->info, &size);
-
-       if (!mail_info_stream ) {
-               EM_DEBUG_EXCEPTION("em_convert_mail_info_to_byte_stream failed");
-               err = EMF_ERROR_NULL_VALUE;
-               goto FINISH_OFF;
-       }
-
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, mail_info_stream, size)) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;
-               goto FINISH_OFF;
-       }
-
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPI failed");
-               err = EMF_ERROR_IPC_SOCKET_FAILURE;
-               goto FINISH_OFF;
-       }
-
-       retrun_from_ipc = ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
-
-       if(retrun_from_ipc) {
-               ret = *(int*)retrun_from_ipc;
-               if ( ret != 1 ) {
-                       retrun_from_ipc = ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1);
-                       if(retrun_from_ipc) {
-                               err = *(int*)retrun_from_ipc;
-                       }
-                       else {
-                               EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter failed");
-                               err = EMF_ERROR_IPC_SOCKET_FAILURE;
-                               goto FINISH_OFF;
-                       }
-               }
-       }
-       else {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter failed");
-               err = EMF_ERROR_IPC_SOCKET_FAILURE;
-               goto FINISH_OFF;
-       }
-       
-
-FINISH_OFF:
-       EM_SAFE_FREE(mail_head_stream);
-       EM_SAFE_FREE(mail_body_stream);
-       EM_SAFE_FREE(mail_info_stream);
-
-       if(hAPI)
-               ipcEmailAPI_Destroy(hAPI);
-
-       EM_DEBUG_FUNC_END("err [%d] , ERROR CODE : %d", ret, err);
-       return err;
-
-}
-EXPORT_API int email_update_mail(emf_mail_data_t *input_mail_data, emf_attachment_data_t *input_attachment_data_list, int input_attachment_count, emf_meeting_request_t* input_meeting_request, int input_sync_server)
-{
-       EM_DEBUG_FUNC_BEGIN("input_mail_data[%p], input_attachment_data_list[%p], input_attachment_count [%d], input_meeting_request [%p], input_sync_server [%d]", input_mail_data, input_attachment_data_list, input_attachment_count, input_meeting_request, input_sync_server);
-
-       EM_IF_NULL_RETURN_VALUE(input_mail_data,               EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(input_mail_data->account_id,   EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(input_mail_data->mailbox_name, EMF_ERROR_INVALID_PARAM);
-
-       if(input_attachment_count > 0 && !input_attachment_data_list) {
-               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
-               return EMF_ERROR_INVALID_PARAM;
-       }
-
-       int       err = EMF_ERROR_NONE;
-       int       size = 0;
-       char     *mail_data_stream = NULL;
-       char     *attachment_data_list_stream  = NULL;
-       char     *meeting_request_stream = NULL;
-       void     *return_from_ipc = NULL;
-       HIPC_API  hAPI = NULL;
-       
-       if(input_sync_server) {
-               hAPI = ipcEmailAPI_Create(_EMAIL_API_UPDATE_MAIL);      
-
-               if(!hAPI) {
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_Create failed");
-                       err = EMF_ERROR_NULL_VALUE;             
-                       goto FINISH_OFF;
-               }
-
-               /* emf_mail_data_t */
-               mail_data_stream = em_convert_mail_data_to_byte_stream(input_mail_data, 1, &size);
-
-               if(!mail_data_stream) {
-                       EM_DEBUG_EXCEPTION("em_convert_mail_data_to_byte_stream failed");
-                       err = EMF_ERROR_NULL_VALUE;
-                       goto FINISH_OFF;
-               }
-               
-               if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, mail_data_stream, size)) {
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter for head failed");
-                       err = EMF_ERROR_OUT_OF_MEMORY;
-                       goto FINISH_OFF;
-               }
-               
-               /* emf_attachment_data_t */
-               attachment_data_list_stream = em_convert_attachment_data_to_byte_stream(input_attachment_data_list, input_attachment_count, &size);
-
-               if(!attachment_data_list_stream) {
-                       EM_DEBUG_EXCEPTION("em_convert_attachment_data_to_byte_stream failed");
-                       err = EMF_ERROR_NULL_VALUE;
-                       goto FINISH_OFF;
-               }
-
-               if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, attachment_data_list_stream, size)) {
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-                       err = EMF_ERROR_OUT_OF_MEMORY;
-                       goto FINISH_OFF;
-               }
-
-               /*  emf_meeting_request_t */
-               if ( input_mail_data->meeting_request_status != EMF_MAIL_TYPE_NORMAL ) {
-                       meeting_request_stream = em_convert_meeting_req_to_byte_stream(input_meeting_request, &size);
-
-                       if(!meeting_request_stream) {
-                               EM_DEBUG_EXCEPTION("em_convert_meeting_req_to_byte_stream failed");
-                               err = EMF_ERROR_NULL_VALUE;
-                               goto FINISH_OFF;
-                       }
-
-                       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, meeting_request_stream, size)) {
-                               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-                               err = EMF_ERROR_OUT_OF_MEMORY;
-                               goto FINISH_OFF;
-                       }
-               }
-
-               /* sync_server */
-               if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&input_sync_server, sizeof(int))) {
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-                       err = EMF_ERROR_OUT_OF_MEMORY;
-                       goto FINISH_OFF;
-               }
-
-               /* Execute API */
-               if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-                       EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPI failed");
-                       err = EMF_ERROR_IPC_SOCKET_FAILURE;
-                       goto FINISH_OFF;
-               }
-
-               return_from_ipc = ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
-               
-               if(return_from_ipc)
-                       err = *(int*)return_from_ipc;
-               else {
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter failed");
-                       err = EMF_ERROR_IPC_SOCKET_FAILURE;
-                       goto FINISH_OFF;
-               }
-
-               if(err == EMF_ERROR_NONE) {
-                       return_from_ipc = ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1); /* result mail_id */
-                       if(return_from_ipc) {
-                               input_mail_data->mail_id = *(int*)return_from_ipc;
-                       }
-                       else{
-                               EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter failed");
-                               err = EMF_ERROR_IPC_SOCKET_FAILURE;
-                               goto FINISH_OFF;
-                       }
-                       return_from_ipc = ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 2); /* result thread_id */
-                       if(return_from_ipc) {
-                               input_mail_data->thread_id = *(int*)return_from_ipc;
-                       }
-                       else{
-                               EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter failed");
-                               err = EMF_ERROR_IPC_SOCKET_FAILURE;
-                               goto FINISH_OFF;
-                       }
-               }
-       } 
-       else {
-               if( (err = em_core_update_mail(input_mail_data, input_attachment_data_list, input_attachment_count, input_meeting_request, input_sync_server)) != EMF_ERROR_NONE) {
-                       EM_DEBUG_EXCEPTION("em_core_update_mail failed [%d]", err);
-                       goto FINISH_OFF;
-               }
-       }
-
-FINISH_OFF:
-       if(hAPI) 
-               ipcEmailAPI_Destroy(hAPI);
-
-       EM_SAFE_FREE(mail_data_stream);
-       EM_SAFE_FREE(attachment_data_list_stream);
-
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-
-}
-
-EXPORT_API int email_clear_mail_data()
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int err = EMF_ERROR_NONE;
-       
-       HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_CLEAR_DATA);      
-
-       EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
-       
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPI Fail");
-               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
-       }
-       err = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
-       
-       if(hAPI)
-               ipcEmailAPI_Destroy(hAPI);
-
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-}
-
-
-EXPORT_API int email_count_message(emf_mailbox_t* mailbox, int* total, int* unseen)
-{
-       EM_DEBUG_FUNC_BEGIN("mailbox[%p], total[%p], unseen[%p]", mailbox, total, unseen);
-       
-       int total_count = 0;
-       int unread = 0;
-       int err = EMF_ERROR_NONE;
-
-       EM_IF_NULL_RETURN_VALUE(mailbox, EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(total, EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(unseen, EMF_ERROR_INVALID_PARAM);
-
-       if (!em_storage_get_mail_count(mailbox->account_id,  mailbox->name, &total_count, &unread, true, &err)) {
-               EM_DEBUG_EXCEPTION("em_storage_get_mail_count Failed");
-               err = em_storage_get_emf_error_from_em_storage_error(err);
-       } else {
-               *total = total_count;
-               *unseen = unread;
-       }
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-}
-
-
-
-
-EXPORT_API int  email_count_message_all_mailboxes(emf_mailbox_t* mailbox, int* total, int* unseen)
-{
-       EM_DEBUG_FUNC_BEGIN("mailbox[%p], total[%p], unseen[%p]", mailbox, total, unseen);
-       
-       int total_count = 0;
-       int unread = 0;
-       int err = EMF_ERROR_NONE;
-               
-       EM_IF_NULL_RETURN_VALUE(mailbox, EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(total, EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(unseen, EMF_ERROR_INVALID_PARAM);
-       EM_IF_ACCOUNT_ID_NULL(mailbox->account_id, EMF_ERROR_INVALID_PARAM); 
-
-    if (!em_storage_get_mail_count(mailbox->account_id,  NULL, &total_count, &unread, true, &err)) {
-               EM_DEBUG_EXCEPTION("em_storage_get_mail_count Failed");
-               err = em_storage_get_emf_error_from_em_storage_error(err);
-       } else {
-               *total = total_count;
-               *unseen = unread;
-       }
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-}
-
-
-
-EXPORT_API int email_delete_message(emf_mailbox_t* mailbox, int *mail_ids, int num, int from_server)
-{
-       EM_DEBUG_FUNC_BEGIN("mailbox[%p], mail_id[%p], num[%d], from_server[%d]", mailbox, mail_ids, num, from_server);
-
-       char* mailbox_stream = NULL;
-       int size = 0;
-       void *return_from_ipc = NULL;
-       int err = EMF_ERROR_NONE;
-       HIPC_API hAPI = NULL;
-
-       EM_IF_NULL_RETURN_VALUE(mailbox, EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(mail_ids, EMF_ERROR_INVALID_PARAM);
-       EM_IF_ACCOUNT_ID_NULL(mailbox->account_id, EMF_ERROR_INVALID_PARAM); 
-       
-       if (num <= 0) {
-               EM_DEBUG_EXCEPTION("num = %d", num);
-               err = EMF_ERROR_INVALID_PARAM;          
-               return err;
-       }
-
-       hAPI = ipcEmailAPI_Create(_EMAIL_API_DELETE_MAIL);
-       
-       if(!hAPI) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_Create failed");
-               err = EMF_ERROR_NULL_VALUE;             
-               goto FINISH_OFF;
-       }
-
-       /* mailbox */
-       mailbox_stream = em_convert_mailbox_to_byte_stream(mailbox, &size);
-
-       if(!mailbox_stream) {
-               EM_DEBUG_EXCEPTION("em_convert_mailbox_to_byte_stream failed");
-               err = EMF_ERROR_NULL_VALUE;             
-               goto FINISH_OFF;
-       }
-       
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, mailbox_stream, size)) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-
-       /* Number of mail_ids */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&num, sizeof(int))) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-       
-       /* set of mail_ids */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)mail_ids, num * sizeof(int))) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-       
-       /* from-server */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&from_server, sizeof(int))) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-       
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPI failed");
-               err = EMF_ERROR_IPC_SOCKET_FAILURE;     
-               goto FINISH_OFF;
-       }
-
-       return_from_ipc = ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
-
-       if(return_from_ipc) {
-               err = *(int*)return_from_ipc;
-       }
-       else {
-        EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter failed");
-               err = EMF_ERROR_IPC_SOCKET_FAILURE;
-               goto FINISH_OFF;
-       }
-
-FINISH_OFF:
-       if(hAPI)
-               ipcEmailAPI_Destroy(hAPI);
-
-       EM_SAFE_FREE(mailbox_stream); 
-
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-}
-
-
-EXPORT_API int email_delete_all_message_in_mailbox(emf_mailbox_t* mailbox, int from_server)
-{
-       EM_DEBUG_FUNC_BEGIN("mailbox[%p], from_server[%d]", mailbox, from_server);
-
-       char* mailbox_stream = NULL;
-       int size = 0;
-       int err = EMF_ERROR_NONE;
-       void *return_from_ipc = NULL;
-       HIPC_API hAPI = NULL;
-       
-       EM_IF_NULL_RETURN_VALUE(mailbox, EMF_ERROR_INVALID_PARAM);
-       EM_IF_ACCOUNT_ID_NULL(mailbox->account_id, EMF_ERROR_INVALID_PARAM); 
-       
-       hAPI =ipcEmailAPI_Create(_EMAIL_API_DELETE_ALL_MAIL);   
-
-       if(!hAPI) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_Create failed");
-               err = EMF_ERROR_NULL_VALUE;             
-               goto FINISH_OFF;
-       }
-
-       mailbox_stream = em_convert_mailbox_to_byte_stream(mailbox, &size);
-
-       if(!mailbox_stream) {
-               EM_DEBUG_EXCEPTION("em_convert_mailbox_to_byte_stream failed");
-               err = EMF_ERROR_NULL_VALUE;             
-               goto FINISH_OFF;
-       }
-       
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, mailbox_stream, size)) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&from_server, sizeof(int))){
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-       
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPI failed");
-               err = EMF_ERROR_IPC_SOCKET_FAILURE;             
-               goto FINISH_OFF;
-       }
-       
-       return_from_ipc = ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
-       if(return_from_ipc) {
-               err = *(int*)return_from_ipc;
-       }
-       else {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter failed");
-               err = EMF_ERROR_IPC_SOCKET_FAILURE;             
-               goto FINISH_OFF;
-       }
-
-FINISH_OFF:
-
-       if(hAPI)        
-               ipcEmailAPI_Destroy(hAPI);
-
-       EM_SAFE_FREE(mailbox_stream);
-       
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-}
-
-
-
-EXPORT_API int email_add_attachment( emf_mailbox_t* mailbox, int mail_id, emf_attachment_info_t* attachment)
-{
-       EM_DEBUG_FUNC_BEGIN("mailbox[%p], mail_id[%d], attachment[%p]", mailbox, mail_id, attachment);
-       int err = EMF_ERROR_NONE;
-       char* mailbox_stream = NULL;
-       char* pAttchStream = NULL;
-       int size = 0;
-       void *return_from_ipc = NULL;
-       HIPC_API hAPI = NULL;
-       
-       EM_IF_NULL_RETURN_VALUE(mailbox, EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(mail_id, EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(attachment, EMF_ERROR_INVALID_PARAM);
-       EM_IF_ACCOUNT_ID_NULL(mailbox->account_id, EMF_ERROR_INVALID_PARAM);
-       
-       hAPI = ipcEmailAPI_Create(_EMAIL_API_ADD_ATTACHMENT);
-
-       if(!hAPI) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_Create failed");
-               err = EMF_ERROR_NULL_VALUE;             
-               goto FINISH_OFF;
-       }
-
-       /* Mailbox */
-       mailbox_stream = em_convert_mailbox_to_byte_stream(mailbox, &size);
-
-       if(!mailbox_stream) {
-               EM_DEBUG_EXCEPTION("em_convert_mailbox_to_byte_stream failed");
-               err = EMF_ERROR_NULL_VALUE;             
-               goto FINISH_OFF;
-       }
-
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, mailbox_stream, size)) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-
-       /* mail_id */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&mail_id, sizeof(int))) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-
-       /* Attachment */
-       pAttchStream = em_convert_attachment_info_to_byte_stream(attachment, &size);
-
-       if(!pAttchStream) {
-               EM_DEBUG_EXCEPTION("em_convert_attachment_info_to_byte_stream failed");
-               err = EMF_ERROR_NULL_VALUE;             
-               goto FINISH_OFF;
-       }
-
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, pAttchStream, size)){
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-
-       /* Execute API */
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPI failed");
-               err = EMF_ERROR_IPC_SOCKET_FAILURE;             
-               goto FINISH_OFF;
-       }
-
-       return_from_ipc = ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
-       if(return_from_ipc) {
-               err  = *(int*)return_from_ipc;
-       }
-       else {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter failed");
-               err = EMF_ERROR_IPC_SOCKET_FAILURE;             
-               goto FINISH_OFF;
-       }
-       
-       if(EMF_ERROR_NONE == err) {
-               return_from_ipc = ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1);
-               if(return_from_ipc) {
-                       attachment->attachment_id  = *(int*)return_from_ipc;
-               }
-               else {
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter failed");
-                       err = EMF_ERROR_IPC_SOCKET_FAILURE;             
-                       goto FINISH_OFF;
-               }
-       }
-
-FINISH_OFF:
-       EM_SAFE_FREE(mailbox_stream);
-       EM_SAFE_FREE(pAttchStream);
-       
-       if(hAPI)
-               ipcEmailAPI_Destroy(hAPI);
-       
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
- }
-
-
-EXPORT_API int email_delete_attachment(emf_mailbox_t * mailbox, int mail_id, const char *attachment_id)
-{
-       EM_DEBUG_FUNC_BEGIN("mailbox[%p], mail_id[%d], attachment_id[%s]", mailbox, mail_id, attachment_id);
-       int err = EMF_ERROR_NONE;
-       char* mailbox_stream = NULL;
-       int size = 0;
-       void *return_from_ipc = NULL;
-       HIPC_API hAPI = NULL;
-       
-       EM_IF_NULL_RETURN_VALUE(mailbox, EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(mail_id, EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(attachment_id, EMF_ERROR_INVALID_PARAM);
-       
-       hAPI = ipcEmailAPI_Create(_EMAIL_API_DELETE_ATTACHMENT);
-       
-       if(!hAPI) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_Create failed");
-               err = EMF_ERROR_NULL_VALUE;             
-               goto FINISH_OFF;
-       }
-
-       /* Mailbox */
-       mailbox_stream = em_convert_mailbox_to_byte_stream(mailbox, &size);
-
-       if(!mailbox_stream) {
-               EM_DEBUG_EXCEPTION("em_convert_mailbox_to_byte_stream failed");
-               err = EMF_ERROR_NULL_VALUE;             
-               goto FINISH_OFF;
-       }
-
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, mailbox_stream, size)) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-
-       /* mail_id */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&mail_id, sizeof(int))) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-
-       /* attachment_id */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)attachment_id, strlen(attachment_id))) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-
-       /* Execute API */
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPI failed");
-               err = EMF_ERROR_IPC_SOCKET_FAILURE;             
-               goto FINISH_OFF;
-       }
-
-       return_from_ipc = ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
-       if(return_from_ipc) {
-               err  = *(int*)return_from_ipc;
-       }
-       else {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter failed");
-               err = EMF_ERROR_IPC_SOCKET_FAILURE;             
-               goto FINISH_OFF;
-       }
-
-FINISH_OFF:
-       if(hAPI)
-               ipcEmailAPI_Destroy(hAPI);
-
-       EM_SAFE_FREE(mailbox_stream);
-
-       return err;
-}
-
-/* -----------------------------------------------------------
-                                             Mail Search API
-    -----------------------------------------------------------*/
-
-EXPORT_API int email_query_mails(char *conditional_clause_string, emf_mail_data_t** mail_list,  int *result_count)
-{
-       EM_DEBUG_FUNC_BEGIN("conditional_clause_string [%s], mail_list [%p], result_count [%p]", conditional_clause_string, mail_list, result_count);
-
-       int err = EMF_ERROR_NONE;
-       emf_mail_tbl_t *result_mail_tbl;
-       
-       EM_IF_NULL_RETURN_VALUE(result_count, EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(conditional_clause_string, EMF_ERROR_INVALID_PARAM);
-
-       if (!em_storage_query_mail_tbl(conditional_clause_string, true, &result_mail_tbl, result_count, &err)) {
-               EM_DEBUG_EXCEPTION("em_storage_query_mail_list failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
-               goto FINISH_OFF;
-       }
-
-       if(!em_convert_mail_tbl_to_mail_data(result_mail_tbl, *result_count, mail_list, &err)) {
-               EM_DEBUG_EXCEPTION("em_convert_mail_tbl_to_mail_data failed [%d]", err);
-               goto FINISH_OFF;
-       }
-
-FINISH_OFF:    
-       if(result_mail_tbl && !em_storage_free_mail(&result_mail_tbl, *result_count, &err))
-               EM_DEBUG_EXCEPTION("em_storage_free_mail failed [%d]", err);
-
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-}
-
-EXPORT_API int email_query_message_ex(char *conditional_clause_string, emf_mail_list_item_t** mail_list,  int *result_count)
-{
-       EM_DEBUG_FUNC_BEGIN("conditional_clause_string [%s], mail_list [%p], result_count [%p]", conditional_clause_string, mail_list, result_count);
-
-       int err = EMF_ERROR_NONE;
-       
-       EM_IF_NULL_RETURN_VALUE(result_count, EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(conditional_clause_string, EMF_ERROR_INVALID_PARAM);
-
-       if (!em_storage_query_mail_list(conditional_clause_string, true, mail_list, result_count, &err)) {
-               EM_DEBUG_EXCEPTION("em_storage_query_mail_list failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
-               goto FINISH_OFF;
-       }
-
-FINISH_OFF:    
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-}
-
-
-/* -----------------------------------------------------------
-                                             Mail Get Info API
-    -----------------------------------------------------------*/
-EXPORT_API int email_get_info(emf_mailbox_t* mailbox, int mail_id, emf_mail_info_t** info)
-{
-       EM_DEBUG_FUNC_BEGIN("mailbox[%p], mail_id[%d], info[%p]", mailbox, mail_id, info);
-
-       int err = EMF_ERROR_NONE;
-       
-       EM_IF_NULL_RETURN_VALUE(mailbox, EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(info, EMF_ERROR_INVALID_PARAM);
-
-       if (mail_id <=0) {
-               EM_DEBUG_EXCEPTION("Invalid Mail ID [%d]", mail_id);
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-
-       if (!em_core_mail_get_info(mail_id, info, &err))  {
-               EM_DEBUG_EXCEPTION("em_core_mail_get_info failed [%d", err);
-               goto FINISH_OFF;
-       }
-               
-FINISH_OFF:
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-}
-
-
-EXPORT_API int email_free_mail_info(emf_mail_info_t** info_list, int count)
-{
-       EM_DEBUG_FUNC_BEGIN("info_list[%p], count[%d]", info_list, count);      
-       
-       int err = EMF_ERROR_NONE;
-
-       if(count > 0)  {
-               if (!info_list || !*info_list)  {
-                       EM_DEBUG_EXCEPTION("info_list[%p]", info_list);
-                       return EMF_ERROR_INVALID_PARAM;
-               }
-               
-               emf_mail_info_t* p = *info_list;
-               int i = 0;
-
-               for (; i < count; i++)  {
-                       EM_SAFE_FREE(p[i].sid);
-               }
-               
-               EM_SAFE_FREE(p); 
-               *info_list = NULL;
-       }       
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-
-}
-
-
-
-
-EXPORT_API int email_get_header_info(emf_mailbox_t* mailbox, int mail_id, emf_mail_head_t** head)
-{
-       EM_DEBUG_FUNC_BEGIN("mailbox[%p], mail_id[%d], head[%p]", mailbox, mail_id, head);
-
-       int err = EMF_ERROR_NONE;
-               
-       EM_IF_NULL_RETURN_VALUE(mailbox, EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(mail_id, EMF_ERROR_INVALID_PARAM);
-
-       if (!em_core_mail_get_header(mail_id, head, &err) || !head)  {
-               EM_DEBUG_EXCEPTION("em_core_mail_get_mail failed [%d]", err);
-               return err;
-       }       
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
- }
-
-
-
-EXPORT_API int email_free_header_info(emf_mail_head_t** head_list, int count)
-{
-       EM_DEBUG_FUNC_BEGIN("head_list[%p], count[%d]", head_list, count);
-
-       int err = EMF_ERROR_NONE;
-       
-       if(count > 0)  {
-               if (!head_list || !*head_list)  {
-                       EM_DEBUG_EXCEPTION("head_list[%p], count[%d]", head_list, count);                       
-                       err = EMF_ERROR_INVALID_PARAM;
-                       return err;
-               }
-               
-               emf_mail_head_t* p = *head_list;
-               int i=0;
-               if (p) {
-                       for (; i < count; i++)  {
-                               EM_SAFE_FREE(p[i].mid);
-                               EM_SAFE_FREE(p[i].subject);
-                               EM_SAFE_FREE(p[i].to);
-                               EM_SAFE_FREE(p[i].from);
-                               EM_SAFE_FREE(p[i].cc);
-                               EM_SAFE_FREE(p[i].bcc);
-                               EM_SAFE_FREE(p[i].reply_to);
-                               EM_SAFE_FREE(p[i].return_path);
-                       }
-               
-                       EM_SAFE_FREE(p); 
-                       *head_list = NULL;
-               }
-       }       
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-}
-
-
-EXPORT_API int email_get_body_info(emf_mailbox_t* mailbox, int mail_id, emf_mail_body_t** body)
-{
-       EM_DEBUG_FUNC_BEGIN("mailbox[%p], mail_id[%d], body[%p]", mailbox, mail_id, body);
-       char* mailbox_stream = NULL;
-       char* pBodyStream = NULL;
-       emf_mail_body_t* pBody = NULL;
-       int nSize =0;
-       void *return_from_ipc = NULL;
-       int err = EMF_ERROR_NONE;
-       int size = 0;
-               
-       EM_IF_NULL_RETURN_VALUE(mailbox, EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(mail_id, EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(body, EMF_ERROR_INVALID_PARAM);
-       EM_IF_ACCOUNT_ID_NULL(mailbox->account_id, EMF_ERROR_INVALID_PARAM); 
-       
-       HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_GET_BODY_INFO);
-
-       EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
-
-       /* Mailbox */
-       mailbox_stream = em_convert_mailbox_to_byte_stream(mailbox, &size);
-
-       if(!mailbox_stream) {
-               EM_DEBUG_EXCEPTION("em_convert_mailbox_to_byte_stream failed");
-               err = EMF_ERROR_NULL_VALUE;             
-               goto FINISH_OFF;
-       }
-
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, mailbox_stream, size)) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-
-       /* mail_id */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&mail_id, sizeof(int))) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-
-       /* Execute API */
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPI failed");
-               err = EMF_ERROR_IPC_SOCKET_FAILURE;             
-               goto FINISH_OFF;
-       }
-
-       return_from_ipc = ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
-       if(return_from_ipc) {
-               err  = *(int*)return_from_ipc;
-       }
-       else {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter failed");
-               err = EMF_ERROR_IPC_SOCKET_FAILURE;             
-               goto FINISH_OFF;
-       }
-
-       if(EMF_ERROR_NONE == err) {
-               nSize = ipcEmailAPI_GetParameterLength(hAPI, ePARAMETER_OUT, 1);
-
-               if(nSize > 0) {
-                       pBodyStream = (char*)em_core_malloc(nSize + 1);
-                       if(!pBodyStream) {
-                               EM_DEBUG_EXCEPTION("em_core_malloc failed");
-                               err = EMF_ERROR_NULL_VALUE;             
-                               goto FINISH_OFF;
-                       }
-
-                       return_from_ipc = ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1);
-                       
-                       if(!return_from_ipc) {
-                               EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter failed");
-                               err = EMF_ERROR_NULL_VALUE;             
-                               goto FINISH_OFF;
-                       }
-
-                       memcpy(pBodyStream, return_from_ipc, nSize);
-
-                       /* Memory is not yet allocated for info */
-                       pBody = (emf_mail_body_t*)em_core_malloc(sizeof(emf_mail_body_t));
-                       if(!pBody) { 
-                               EM_DEBUG_EXCEPTION("em_core_malloc failed");
-                               err = EMF_ERROR_NULL_VALUE;             
-                               goto FINISH_OFF;
-                       }
-                       em_convert_byte_stream_to_mail_body(pBodyStream, pBody);
-               }
-
-               if(!pBody) {
-                       EM_DEBUG_EXCEPTION("EMF_ERROR_NULL_VALUE");
-                       err = EMF_ERROR_NULL_VALUE;             
-                       goto FINISH_OFF;
-               }
-
-               *body = pBody;
-       }
-
-FINISH_OFF:
-       EM_SAFE_FREE(pBodyStream);
-       EM_SAFE_FREE(mailbox_stream); 
-
-       if(hAPI)
-               ipcEmailAPI_Destroy(hAPI);
-
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-}
-
-
-
-EXPORT_API int email_free_body_info(emf_mail_body_t** body_list, int count)
-{
-       EM_DEBUG_FUNC_BEGIN("body_list[%p], count[%d]", body_list, count);      
-       int err = EMF_ERROR_NONE;
-
-       if( count <= 0 ) {
-               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
-               return EMF_ERROR_INVALID_PARAM;
-       }
-       
-       if (!body_list || !*body_list)  {
-               EM_DEBUG_EXCEPTION("body_list[%p]", body_list);
-               err = EMF_ERROR_INVALID_PARAM;
-               return err;
-       }
-       
-       emf_mail_body_t* p = *body_list;        
-       int i = 0;
-       
-       for (; i < count; i++)  {
-               EM_SAFE_FREE(p[i].plain);
-               EM_SAFE_FREE(p[i].html);
-               if (p[i].attachment) 
-                       email_free_attachment_info(&p[i].attachment);   
-       }
-       
-       EM_SAFE_FREE(p); *body_list = NULL;
-
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-
-}
-
-
-EXPORT_API int email_get_attachment_info(emf_mailbox_t* mailbox, int mail_id, const char* attachment_id, emf_attachment_info_t** attachment)
-{
-       EM_DEBUG_FUNC_BEGIN("mailbox[%p], mail_id[%d], attachment_id[%s], attachment[%p]", mailbox, mail_id, attachment_id, attachment);
-       
-       int err = EMF_ERROR_NONE;
-       int size = 0;
-       int nSize = 0;
-       char* mailbox_stream = NULL;
-       char* pAttchStream = NULL;
-       emf_attachment_info_t* pAttch = NULL;
-       void *return_from_ipc = NULL;
-       
-       EM_IF_NULL_RETURN_VALUE(mailbox, EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(mail_id, EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(attachment_id, EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(attachment, EMF_ERROR_INVALID_PARAM);
-       EM_IF_ACCOUNT_ID_NULL(mailbox->account_id, EMF_ERROR_INVALID_PARAM); 
-       
-       HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_GET_ATTACHMENT);
-
-       EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
-
-       /* Mailbox */
-       mailbox_stream = em_convert_mailbox_to_byte_stream(mailbox, &size);
-
-       if(!mailbox_stream) {
-               EM_DEBUG_EXCEPTION("em_convert_mailbox_to_byte_stream failed");
-               err = EMF_ERROR_NULL_VALUE;             
-               goto FINISH_OFF;
-       }
-
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, mailbox_stream, size)) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-
-       /* mail_id */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&mail_id, sizeof(int))) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-
-       
-       /* attachment_id */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)attachment_id, strlen(attachment_id))) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-
-       /* Execute API */
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPI failed");
-               err = EMF_ERROR_IPC_SOCKET_FAILURE;             
-               goto FINISH_OFF;
-       }
-
-       return_from_ipc = ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
-       if(return_from_ipc) {
-               err  = *(int*)return_from_ipc;
-       }
-       else {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter failed");
-               err = EMF_ERROR_IPC_SOCKET_FAILURE;             
-               goto FINISH_OFF;
-       }
-
-       if(EMF_ERROR_NONE == err) {
-               nSize = ipcEmailAPI_GetParameterLength(hAPI, ePARAMETER_OUT, 1);
-               if(nSize > 0) {
-                       pAttchStream = (char*)em_core_malloc(nSize+1);
-
-                       if(!pAttchStream) {
-                               EM_DEBUG_EXCEPTION("em_core_malloc failed");
-                               err = EMF_ERROR_OUT_OF_MEMORY;          
-                               goto FINISH_OFF;
-                       }       
-               
-                       return_from_ipc = ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1);
-
-                       if(!return_from_ipc) {
-                               EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter failed");
-                               err = EMF_ERROR_NULL_VALUE;             
-                               goto FINISH_OFF;
-                       }
-
-                       memcpy(pAttchStream, return_from_ipc, nSize);
-                       em_convert_byte_stream_to_attachment_info(pAttchStream, 1, &pAttch);
-               }
-               
-               if(!pAttch) {
-                       EM_DEBUG_EXCEPTION("EMF_ERROR_NULL_VALUE");
-                       err = EMF_ERROR_NULL_VALUE;             
-                       goto FINISH_OFF;
-               }
-
-               *attachment = pAttch;
-       }
-
-FINISH_OFF:
-       EM_SAFE_FREE(pAttchStream);
-
-       if(hAPI)
-               ipcEmailAPI_Destroy(hAPI);
-
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-
-}
-
-EXPORT_API int email_get_attachment_data_list(int input_mail_id, emf_attachment_data_t **output_attachment_data, int *output_attachment_count)
-{
-       EM_DEBUG_FUNC_BEGIN("input_mail_id[%d], output_attachment_data[%p], output_attachment_count[%p]", input_mail_id, output_attachment_data, output_attachment_count);
-       int err = EMF_ERROR_NONE;
-       
-       if((err = em_core_get_attachment_data_list(input_mail_id, output_attachment_data, output_attachment_count)) != EMF_ERROR_NONE) {
-               EM_DEBUG_EXCEPTION("em_core_get_attachment_data_list failed [%d]", err);
-       }
-
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-}
-
-EXPORT_API int email_free_attachment_info(emf_attachment_info_t** atch_info)
-{
-       EM_DEBUG_FUNC_BEGIN("atch_info[%p]", atch_info);        
-       
-       int err = EMF_ERROR_NONE;
-
-       if (!atch_info || !*atch_info)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       emf_attachment_info_t* p = *atch_info;
-       emf_attachment_info_t* t;
-       
-       while (p)  {
-               EM_SAFE_FREE(p->name);
-               EM_SAFE_FREE(p->savename);
-               t = p->next;
-               EM_SAFE_FREE(p);
-               p = t;
-       }
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-}
-
-EXPORT_API int email_free_attachment_data(emf_attachment_data_t **attachment_data_list, int attachment_data_count)
-{
-       EM_DEBUG_FUNC_BEGIN("attachment_data_list[%p], attachment_data_count[%d]", attachment_data_list, attachment_data_count);        
-       
-       int err = EMF_ERROR_NONE;
-
-       em_core_free_attachment_data(attachment_data_list, attachment_data_count, &err);
-       
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-}
-
-
-EXPORT_API int email_get_mails(int account_id , const char *mailbox_name, int thread_id, int start_index, int limit_count, emf_sort_type_t sorting, emf_mail_data_t** mail_list,  int* result_count)
-{
-       EM_DEBUG_FUNC_BEGIN();
-
-       int err = EMF_ERROR_NONE;
-       emf_mail_tbl_t *mail_tbl_list = NULL;
-       EM_IF_NULL_RETURN_VALUE(result_count, EMF_ERROR_INVALID_PARAM);
-
-       if( account_id < ALL_ACCOUNT) {
-               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
-               err = EMF_ERROR_INVALID_PARAM ;
-               goto FINISH_OFF;
-       }
-
-       if (!em_storage_get_mails(account_id, (char*)mailbox_name, NULL, thread_id, start_index, limit_count, sorting, true, &mail_tbl_list, result_count, &err))  {
-               EM_DEBUG_EXCEPTION("em_storage_get_mails failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
-               goto FINISH_OFF;
-       }
-
-       if(!em_convert_mail_tbl_to_mail_data(mail_tbl_list, *result_count, mail_list, &err)) {
-               EM_DEBUG_EXCEPTION("em_convert_mail_tbl_to_mail_data failed [%d]", err);
-               goto FINISH_OFF;
-       }
-
-FINISH_OFF:    
-       if(mail_tbl_list && !em_storage_free_mail(&mail_tbl_list, *result_count, &err))
-               EM_DEBUG_EXCEPTION("em_storage_free_mail failed [%d]", err);
-
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-}
-
-EXPORT_API int email_get_mail_list_ex(int account_id , const char *mailbox_name, int thread_id, int start_index, int limit_count, emf_sort_type_t sorting, emf_mail_list_item_t** mail_list,  int* result_count)
-{
-       EM_DEBUG_FUNC_BEGIN();
-
-       int err = EMF_ERROR_NONE;
-       
-       EM_IF_NULL_RETURN_VALUE(result_count, EMF_ERROR_INVALID_PARAM);
-
-       if( account_id < ALL_ACCOUNT) {
-               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
-               return EMF_ERROR_INVALID_PARAM;
-       }
-
-       if (!em_storage_get_mail_list(account_id, (char*) mailbox_name, NULL, thread_id, start_index, limit_count, 0, NULL, sorting, true, mail_list, result_count, &err))  {
-               EM_DEBUG_EXCEPTION("em_storage_get_mail_list failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
-               goto FINISH_OFF;
-       }
-
-FINISH_OFF:    
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-}
-
-EXPORT_API int email_find_mail (int account_id , const char *mailbox_name, int thread_id, 
-       int search_type, char *search_value, int start_index, int limit_count,
-       emf_sort_type_t sorting, emf_mail_list_item_t** mail_list,  int* result_count)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       
-       int err = EMF_ERROR_NONE;
-       int search_num = 0;
-       emf_mail_list_item_t* mail_list_item = NULL;
-
-       EM_IF_NULL_RETURN_VALUE(mail_list, EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(result_count, EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(search_value, EMF_ERROR_INVALID_PARAM);
-
-       switch ( search_type ) {
-               case EMF_SEARCH_FILTER_SUBJECT:
-               case EMF_SEARCH_FILTER_SENDER:
-               case EMF_SEARCH_FILTER_RECIPIENT:
-               case EMF_SEARCH_FILTER_ALL:
-                       break;
-               default:
-                       EM_DEBUG_EXCEPTION("Invalid search filter type[%d]", search_type);
-                       err = EMF_ERROR_INVALID_PARAM;
-                       return err;
-       }
-
-       if (!em_storage_get_searched_mail_list(account_id, (char*)mailbox_name, thread_id, search_type, search_value,  start_index, limit_count, sorting, true, &mail_list_item, &search_num, &err)) {
-               EM_DEBUG_EXCEPTION("em_storage_search_mails -- Failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
-               goto FINISH_OFF;
-       }
-
-       *mail_list = mail_list_item;
-       *result_count = search_num;
-       
-FINISH_OFF:    
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-}
-
-EXPORT_API int email_get_mail_by_address(int account_id , const char *mailbox_name, emf_email_address_list_t* addr_list, 
-                                                                       int start_index, int limit_count, int search_type, const char *search_value, emf_sort_type_t sorting, emf_mail_list_item_t** mail_list,  int* result_count)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int err = EMF_ERROR_NONE;
-
-       emf_mail_list_item_t* mail_list_item = NULL;
-       
-       EM_IF_NULL_RETURN_VALUE(mail_list, EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(result_count, EMF_ERROR_INVALID_PARAM);
-
-       if( account_id < ALL_ACCOUNT) {
-               EM_DEBUG_EXCEPTION("Invalid account id param");
-               err = EMF_ERROR_INVALID_PARAM ;
-               return err;
-       }
-
-       if (!em_storage_get_mail_list(account_id, (char*)mailbox_name, addr_list, EMF_LIST_TYPE_NORMAL, start_index, limit_count, search_type, search_value, sorting, true, &mail_list_item, result_count, &err)) {
-               EM_DEBUG_EXCEPTION("em_storage_get_mail_list failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
-               goto FINISH_OFF;
-       }
-
-       *mail_list = mail_list_item;
-
-FINISH_OFF:
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-}
-
-EXPORT_API int email_get_thread_information_by_thread_id(int thread_id, emf_mail_data_t** thread_info)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int err = EMF_ERROR_NONE;
-       emf_mail_tbl_t *mail_table_data = NULL;
-       
-       EM_IF_NULL_RETURN_VALUE(thread_info, EMF_ERROR_INVALID_PARAM);
-
-       if (!em_storage_get_thread_information(thread_id, &mail_table_data , true, &err)) {
-               EM_DEBUG_EXCEPTION("em_storage_get_thread_information  failed [%d]", err);
-               goto FINISH_OFF;
-       }
-
-       if(!em_convert_mail_tbl_to_mail_data(mail_table_data, 1, thread_info, &err)) {
-               EM_DEBUG_EXCEPTION("em_convert_mail_tbl_to_mail_data failed [%d]", err);
-               goto FINISH_OFF;
-       }
-
-FINISH_OFF:    
-
-       if(mail_table_data && !em_storage_free_mail(&mail_table_data, 1, &err)) 
-               EM_DEBUG_EXCEPTION("em_storage_free_mail failed [%d]", err);
-
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-}
-
-EXPORT_API int email_get_thread_information_ex(int thread_id, emf_mail_list_item_t** thread_info)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int err = EMF_ERROR_NONE;
-       emf_mail_tbl_t *mail_table_data = NULL;
-       emf_mail_list_item_t *temp_thread_info = NULL;
-       
-       EM_IF_NULL_RETURN_VALUE(thread_info, EMF_ERROR_INVALID_PARAM);
-
-       if (!em_storage_get_thread_information(thread_id, &mail_table_data , true, &err)) {
-               EM_DEBUG_EXCEPTION("em_storage_get_thread_information -- failed [%d]", err);
-               goto FINISH_OFF;
-       }
-
-       temp_thread_info = em_core_malloc(sizeof(emf_mail_list_item_t));
-
-       if(!temp_thread_info) {
-               EM_DEBUG_EXCEPTION("em_core_malloc failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;
-               goto FINISH_OFF;
-       }
-
-       EM_SAFE_STRNCPY(temp_thread_info->mailbox_name       , mail_table_data->mailbox_name, STRING_LENGTH_FOR_DISPLAY);
-       EM_SAFE_STRNCPY(temp_thread_info->from               , mail_table_data->full_address_from, STRING_LENGTH_FOR_DISPLAY);
-       EM_SAFE_STRNCPY(temp_thread_info->from_email_address , mail_table_data->email_address_sender, MAX_EMAIL_ADDRESS_LENGTH);
-       EM_SAFE_STRNCPY(temp_thread_info->recipients         , mail_table_data->email_address_recipient, STRING_LENGTH_FOR_DISPLAY);
-       EM_SAFE_STRNCPY(temp_thread_info->subject            , mail_table_data->subject, STRING_LENGTH_FOR_DISPLAY);
-       EM_SAFE_STRNCPY(temp_thread_info->datetime           , mail_table_data->datetime, MAX_DATETIME_STRING_LENGTH);
-       EM_SAFE_STRNCPY(temp_thread_info->previewBodyText    , mail_table_data->preview_text, MAX_PREVIEW_TEXT_LENGTH);
-       temp_thread_info->mail_id                            = mail_table_data->mail_id;
-       temp_thread_info->account_id                         = mail_table_data->account_id;
-       temp_thread_info->is_text_downloaded                 = mail_table_data->body_download_status;
-       temp_thread_info->flags_seen_field                   = mail_table_data->flags_seen_field;
-       temp_thread_info->priority                           = mail_table_data->priority;
-       temp_thread_info->save_status                        = mail_table_data->save_status;
-       temp_thread_info->is_locked                          = mail_table_data->lock_status;
-       temp_thread_info->is_report_mail                     = mail_table_data->report_status;
-       temp_thread_info->has_attachment                     = mail_table_data->attachment_count;
-       temp_thread_info->has_drm_attachment                 = mail_table_data->DRM_status;
-       temp_thread_info->thread_id                          = mail_table_data->thread_id;
-       temp_thread_info->thread_item_count                  = mail_table_data->thread_item_count;
-       temp_thread_info->is_meeting_request                 = mail_table_data->meeting_request_status;
-
-       *thread_info = temp_thread_info;
-
-FINISH_OFF:    
-
-       if(mail_table_data)
-               em_storage_free_mail(&mail_table_data, 1, NULL);
-
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-}
-
-EXPORT_API int email_get_mail(emf_mailbox_t* mailbox,  int mail_id, emf_mail_t** mail)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int err = EMF_ERROR_NONE;
-       
-       if (!em_core_mail_get_mail(mail_id, mail, &err) || !mail) 
-               EM_DEBUG_EXCEPTION("em_core_mail_get_mail failed [%d]", err);   
-       EM_DEBUG_FUNC_END("err [%d]", err);     
-       return err;
-}
-
-EXPORT_API int email_get_mail_data(int input_mail_id, emf_mail_data_t **output_mail_data)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int err = EMF_ERROR_NONE;
-       
-       if ( ((err = em_core_get_mail_data(input_mail_id, output_mail_data)) != EMF_ERROR_NONE) || !output_mail_data) 
-               EM_DEBUG_EXCEPTION("em_core_get_mail_data failed [%d]", err);   
-               
-       EM_DEBUG_FUNC_END("err [%d]", err);     
-       return err;
-}
-
-
-/* -----------------------------------------------------------
-                                             Mail Flag API
-    -----------------------------------------------------------*/
-EXPORT_API int email_modify_mail_flag(int mail_id, emf_mail_flag_t new_flag, int onserver)
-{
-       EM_DEBUG_FUNC_BEGIN("mail_id[%d], on_server [ %d] ", mail_id, onserver);
-       
-       int err = EMF_ERROR_NONE;
-       void *return_from_ipc = NULL;
-       int i_flag, sticky = 0;
-               
-       if ( mail_id <= 0 || (onserver != 0 && onserver != 1) ) {
-               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
-               return EMF_ERROR_INVALID_PARAM;                 
-       }
-       
-       HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_MODIFY_MAIL_FLAG);
-
-       if(!hAPI) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_Create failed");
-               err = EMF_ERROR_NULL_VALUE;             
-               goto FINISH_OFF;
-       }
-
-       /* Mail ID */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, &(mail_id), sizeof(int))) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-
-       /* new_flag */
-       if(!em_convert_mail_flag_to_int(new_flag, &i_flag, &err))  {
-               EM_DEBUG_EXCEPTION("em_convert_mail_flag_to_int failed ");
-               goto FINISH_OFF;
-       }
-
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, &(i_flag), sizeof(int))) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-
-       sticky = new_flag.sticky;
-
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, &(sticky), sizeof(int))) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-       
-       /* onserver  */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, &(onserver), sizeof(int))) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-       
-       
-       /* Execute API */
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPI failed");
-               err = EMF_ERROR_IPC_SOCKET_FAILURE;     
-               goto FINISH_OFF;
-       }
-       
-       return_from_ipc = ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
-
-       if(return_from_ipc) {
-               err = *(int*)return_from_ipc;
-       }
-       else {
-        EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter failed");
-               err = EMF_ERROR_IPC_SOCKET_FAILURE;
-               goto FINISH_OFF;
-       }
-
-FINISH_OFF:
-       if(hAPI)
-               ipcEmailAPI_Destroy(hAPI);
-
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-}
-
-
-
-
-EXPORT_API int email_modify_seen_flag(int *mail_ids, int num, int seen_flag, int onserver)
-{
-       EM_DEBUG_FUNC_BEGIN("mail_ids[%p], num[%d],seen_flag[%d], on_server [ %d]", mail_ids, num, seen_flag, onserver);
-       EM_DEBUG_FUNC_END("EMF_ERROR_NOT_IMPLEMENTED");
-       return EMF_ERROR_NOT_IMPLEMENTED;
-}
-
-EXPORT_API int email_set_flags_field(int account_id, int *mail_ids, int num, emf_flags_field_type field_type, int value, int onserver)
-{
-       EM_DEBUG_FUNC_BEGIN("account_id [%d], mail_ids[%p], num[%d], field_type [%d], seen_flag[%d], on_server [ %d]", account_id, mail_ids, num, field_type, value, onserver);
-       
-       int err = EMF_ERROR_NONE;
-       void *return_from_ipc = NULL;
-               
-       EM_IF_NULL_RETURN_VALUE(mail_ids, EMF_ERROR_INVALID_PARAM);
-       if (account_id == 0 || num <= 0 || (onserver != 0 && onserver != 1)) {
-               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
-               return EMF_ERROR_INVALID_PARAM;                 
-       }
-       
-       HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_SET_FLAGS_FIELD);
-       
-       if(!hAPI) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_Create failed");
-               err = EMF_ERROR_NULL_VALUE;             
-               goto FINISH_OFF;
-       }
-       
-       /* account_id*/
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&account_id, sizeof(int))) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-
-       /* Number of mail_ids */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&num, sizeof(int))) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-       
-       /* set of mail_ids */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)mail_ids, num * sizeof(int))) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-       
-       /* field_type */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&field_type, sizeof(int))) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-       
-       /* value */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&value, sizeof(int))) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-
-       /* onserver  */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, &(onserver), sizeof(int))) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-       
-       /* Execute API */
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPI failed");
-               err = EMF_ERROR_IPC_SOCKET_FAILURE;     
-               goto FINISH_OFF;
-       }
-       
-       return_from_ipc = ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
-
-       if(return_from_ipc) {
-               err = *(int*)return_from_ipc;
-       }
-       else {
-        EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter failed");
-               err = EMF_ERROR_IPC_SOCKET_FAILURE;
-               goto FINISH_OFF;
-       }
-
-FINISH_OFF:
-       if(hAPI)
-               ipcEmailAPI_Destroy(hAPI);
-
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-}
-
-EXPORT_API int email_modify_extra_mail_flag(int mail_id, emf_extra_flag_t new_flag)
-{
-       EM_DEBUG_FUNC_BEGIN("mail_id[%d]", mail_id);
-       
-       int size = 0;
-       int err = EMF_ERROR_NONE;
-       char* pMailExtraFlagsStream = NULL;
-       void *return_from_ipc = NULL;
-               
-       EM_IF_NULL_RETURN_VALUE(mail_id, EMF_ERROR_INVALID_PARAM);
-
-       pMailExtraFlagsStream = em_convert_extra_flags_to_byte_stream(new_flag, &size);
-       
-       HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_MODIFY_MAIL_EXTRA_FLAG);
-
-       if(!hAPI) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_Create failed");
-               err = EMF_ERROR_NULL_VALUE;             
-               goto FINISH_OFF;
-       }
-
-       /* Mail ID */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, &(mail_id), sizeof(int))) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed ");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-       /*  Flag */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, pMailExtraFlagsStream, size)) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed ");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-
-       /* Execute API */
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_IPC_SOCKET_FAILURE;
-               goto FINISH_OFF;
-       } 
-
-       return_from_ipc = ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
-
-       if(return_from_ipc) {
-               err = *(int*)return_from_ipc;
-       }
-       else {
-        EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter failed");
-               err = EMF_ERROR_IPC_SOCKET_FAILURE;
-               goto FINISH_OFF;
-       }
-
-FINISH_OFF:
-       ipcEmailAPI_Destroy(hAPI);
-       EM_SAFE_FREE(pMailExtraFlagsStream);
-
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-
-}
-
-
-
-/* -----------------------------------------------------------
-                                             Mail Move API
-    -----------------------------------------------------------*/
-EXPORT_API int email_move_mail_to_mailbox(int *mail_ids, int num, emf_mailbox_t* mailbox)
-{
-       EM_DEBUG_FUNC_BEGIN("mail_ids[%p], num [%d], mailbox[%p]",  mail_ids, num, mailbox);
-       
-       int size = 0;
-       char* mailbox_stream =  NULL;
-       int err = EMF_ERROR_NONE;
-       HIPC_API hAPI = NULL;
-       void *return_from_ipc = NULL;
-
-       EM_IF_NULL_RETURN_VALUE(mailbox, EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(mail_ids, EMF_ERROR_INVALID_PARAM);
-       EM_IF_ACCOUNT_ID_NULL(mailbox->account_id, EMF_ERROR_INVALID_PARAM); 
-       
-       if (num <= 0)  {
-               EM_DEBUG_LOG("num = %d", num);
-               err = EMF_ERROR_INVALID_PARAM;
-               return err;
-       }
-       
-       hAPI = ipcEmailAPI_Create(_EMAIL_API_MOVE_MAIL);
-
-       if(!hAPI) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_Create failed");
-               err = EMF_ERROR_NULL_VALUE;             
-               goto FINISH_OFF;
-       }
-       
-       /* Number of mail_ids */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&num, sizeof(int))) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-       
-       /* set of mail_ids */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)mail_ids, num * sizeof(int))) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-       
-       /* Mailbox */
-       mailbox_stream = em_convert_mailbox_to_byte_stream(mailbox, &size);
-
-       if(!mailbox_stream) {
-               EM_DEBUG_EXCEPTION("em_convert_mailbox_to_byte_stream failed");
-               err = EMF_ERROR_NULL_VALUE;             
-               goto FINISH_OFF;
-       }
-
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, mailbox_stream, size)) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-
-       /* Execute API */
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPI failed");
-               err = EMF_ERROR_IPC_SOCKET_FAILURE;             
-               goto FINISH_OFF;
-       }
-
-       return_from_ipc = ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
-       if(return_from_ipc) {
-               err  = *(int*)return_from_ipc;
-       }
-       else {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter failed");
-               err = EMF_ERROR_IPC_SOCKET_FAILURE;             
-               goto FINISH_OFF;
-       }
-
-FINISH_OFF:            
-       EM_SAFE_FREE(mailbox_stream); 
-
-       if(hAPI)
-               ipcEmailAPI_Destroy(hAPI);
-
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-}
-
-
-EXPORT_API int  email_move_all_mails_to_mailbox(emf_mailbox_t* src_mailbox, emf_mailbox_t* new_mailbox)
-{
-       EM_DEBUG_FUNC_BEGIN("src_mailbox[%p] , new_mailbox[%p]",  src_mailbox, new_mailbox);
-       
-       int size = 0;
-       int err = EMF_ERROR_NONE;
-       char *dest_mailbox_stream = NULL;
-       char *source_mailbox_stream = NULL;
-       HIPC_API hAPI = NULL;
-       void *return_from_ipc = NULL;
-       
-       EM_IF_NULL_RETURN_VALUE(src_mailbox, EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(new_mailbox, EMF_ERROR_INVALID_PARAM);
-       EM_IF_ACCOUNT_ID_NULL(new_mailbox->account_id, EMF_ERROR_INVALID_PARAM); 
-       EM_IF_ACCOUNT_ID_NULL(src_mailbox->account_id, EMF_ERROR_INVALID_PARAM); 
-       
-       hAPI = ipcEmailAPI_Create(_EMAIL_API_MOVE_ALL_MAIL);
-
-       if(!hAPI) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_Create failed");
-               err = EMF_ERROR_NULL_VALUE;             
-               goto FINISH_OFF;
-       }
-       
-       /* Src Mailbox Information */
-       source_mailbox_stream = em_convert_mailbox_to_byte_stream(src_mailbox, &size);
-
-       if(!source_mailbox_stream) {
-               EM_DEBUG_EXCEPTION("em_convert_mailbox_to_byte_stream failed");
-               err = EMF_ERROR_NULL_VALUE;             
-               goto FINISH_OFF;
-       }
-
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, source_mailbox_stream, size)) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-
-       size = 0;
-       
-       /* Dst Mailbox Information */
-       dest_mailbox_stream = em_convert_mailbox_to_byte_stream(new_mailbox, &size);
-
-       if(!dest_mailbox_stream) {
-               EM_DEBUG_EXCEPTION("em_convert_mailbox_to_byte_stream failed");
-               err = EMF_ERROR_NULL_VALUE;             
-               goto FINISH_OFF;
-       }
-
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, dest_mailbox_stream, size)) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-       
-       /* Execute API */
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPI failed");
-               err = EMF_ERROR_IPC_SOCKET_FAILURE;             
-               goto FINISH_OFF;
-       }
-
-       return_from_ipc = ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
-       if(return_from_ipc) {
-               err  = *(int*)return_from_ipc;
-       }
-       else {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter failed");
-               err = EMF_ERROR_IPC_SOCKET_FAILURE;             
-               goto FINISH_OFF;
-       }
-
-FINISH_OFF:
-       EM_SAFE_FREE(source_mailbox_stream);
-       EM_SAFE_FREE(dest_mailbox_stream); 
-
-       if(hAPI)
-               ipcEmailAPI_Destroy(hAPI);
-       
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-}
-
-
-EXPORT_API int email_count_message_with_draft_flag(emf_mailbox_t* mailbox, int* total)
-{
-       EM_DEBUG_FUNC_BEGIN("mailbox[%p], total[%p]", mailbox, total);
-       
-       int err = EMF_ERROR_NONE;
-       int total_count = 0;
-               
-       EM_IF_NULL_RETURN_VALUE(mailbox, EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(total, EMF_ERROR_INVALID_PARAM);
-
-    if (!em_storage_get_mail_count_with_draft_flag(mailbox->account_id,  mailbox->name, &total_count, false, &err)) {
-               EM_DEBUG_EXCEPTION("em_storage_get_mail_count Failed");
-               err = em_storage_get_emf_error_from_em_storage_error(err);
-       } else {
-               *total = total_count;
-       }
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-}
-
-
-EXPORT_API int email_count_message_on_sending(emf_mailbox_t* mailbox, int* total)
-{
-       EM_DEBUG_FUNC_BEGIN("mailbox[%p], total[%p]", mailbox, total);
-       int err = EMF_ERROR_NONE;
-       int total_count = 0;
-       
-               
-       EM_IF_NULL_RETURN_VALUE(mailbox, EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(total, EMF_ERROR_INVALID_PARAM);
-
-       if (!em_storage_get_mail_count_on_sending(mailbox->account_id,  mailbox->name, &total_count, false, &err)) {
-               EM_DEBUG_EXCEPTION("em_storage_get_mail_count Failed");
-               err = em_storage_get_emf_error_from_em_storage_error(err);
-       } else
-               *total = total_count;
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-}
-
-/**
- * @open
- * @fn email_get_mail_flag(int account_id, int mail_id, emf_mail_flag_t* mail_flag)
- * @brief      Get the Mail Flag information based on the account id and Mail Id.
- * 
- * @param[in] account_id       Specifies the Account ID
- * @param[in] mail_id          Specifies the Mail id for which  Flag details need to be fetched
- * @param[in/out] mail_flag    Specifies the Pointer to the structure emf_mail_flag_t.
- * @remarks N/A
- * @return True on Success, False on Failure.
- */
-EXPORT_API int email_get_mail_flag(int account_id, int mail_id, emf_mail_flag_t* mail_flag)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       
-       int err = EMF_ERROR_NONE;
-
-       if (account_id < FIRST_ACCOUNT_ID|| mail_id < 1 || mail_flag == NULL) {
-               EM_DEBUG_EXCEPTION("Invalid Param");
-               err = EMF_ERROR_INVALID_PARAM ;
-               goto FINISH_OFF;
-       }
-
-       /* Fetch the flag Information */
-       if (!em_core_fetch_flags(account_id, mail_id, mail_flag, &err)) {       
-               EM_DEBUG_EXCEPTION("em_core_fetch_flags Failed [%d]", err);
-               goto FINISH_OFF;
-       }
-FINISH_OFF:
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-
-}
-
-
-
-EXPORT_API int email_free_mailbox(emf_mailbox_t** mailbox_list, int count)
-{
-       EM_DEBUG_FUNC_BEGIN("mailbox_list[%p], count[%d]", mailbox_list, count);
-       int err = EMF_ERROR_NONE;
-
-       if (count <= 0 || !mailbox_list || !*mailbox_list) {
-               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-       
-       emf_mailbox_t *p = *mailbox_list;
-       int i;
-       
-       for (i = 0; i < count; i++)  {
-               EM_SAFE_FREE(p[i].name);
-               EM_SAFE_FREE(p[i].alias);
-               EM_SAFE_FREE(p[i].account_name);
-       }
-       
-       EM_SAFE_FREE(p); 
-       *mailbox_list = NULL;
-       
-FINISH_OFF:            
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-
-}
-
-
-EXPORT_API int email_free_mail(emf_mail_t** mail_list, int count)
-{
-       EM_DEBUG_FUNC_BEGIN("mail_list[%p], count[%d]", mail_list, count);
-       int err = EMF_ERROR_NONE;
-
-       if (count <= 0 || !mail_list || !*mail_list)  {
-               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");                  
-               err = EMF_ERROR_INVALID_PARAM;
-               return err;
-       }
-       
-       emf_mail_t* p = *mail_list;
-       int i = 0;
-       
-       for (; i < count; i++)  {
-               if (p[i].info) 
-                       em_core_mail_info_free(&p[i].info, 1, NULL);
-               
-               if (p[i].head)
-                       em_core_mail_head_free(&p[i].head, 1, NULL);
-               
-               if (p[i].body)
-                       em_core_mail_body_free(&p[i].body, 1, NULL);
-       }
-       
-       EM_SAFE_FREE(p); 
-       *mail_list = NULL;
-
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-}
-EXPORT_API int email_free_mail_data(emf_mail_data_t** mail_list, int count)
-{
-       EM_DEBUG_FUNC_BEGIN("mail_list[%p], count[%d]", mail_list, count);
-       int err = EMF_ERROR_NONE;
-       em_core_free_mail_data(mail_list, count, &err);
-       EM_DEBUG_FUNC_END("err [%d]", err);     
-       return err;
-}
-
-/* Convert Modified UTF-7 mailbox name to UTF-8 */
-/* returns modified UTF-8 Name if success else NULL */
-
-EXPORT_API int email_cancel_send_mail( int mail_id)
-{
-       EM_DEBUG_FUNC_BEGIN("Mail ID [ %d]", mail_id);
-       EM_IF_NULL_RETURN_VALUE(mail_id, EMF_ERROR_INVALID_PARAM);
-       
-       int err = EMF_ERROR_NONE;
-       int account_id = 0;
-       emf_mail_t* mail = NULL;
-       void *return_from_ipc = NULL;
-       HIPC_API hAPI = NULL;
-       
-       
-       if (!em_core_mail_get_mail(mail_id, &mail, &err))  {
-               EM_DEBUG_EXCEPTION("em_core_mail_get_mail failed [%d]", err);
-               goto FINISH_OFF;
-       }
-
-       if (!mail || !mail->info) {
-               EM_DEBUG_EXCEPTION("mail or mail->info is null");
-               err = EMF_ERROR_NULL_VALUE;             
-               goto FINISH_OFF;
-       }
-#ifdef __FEATURE_PROGRESS_IN_OUTBOX__
-               account_id = mail->info->account_id;
-#else
-       /*      h.gahlaut@samsung.com: Moved this code from email_cancel_send_mail API to email-service engine*/
-
-       if (mail->info->extra_flags.status == EMF_MAIL_STATUS_SEND_CANCELED) {
-               EM_DEBUG_LOG(" EMF_MAIL_STATUS_SEND_CANCELED Already set for Mail ID [%d] ", mail_id);
-               goto FINISH_OFF;
-       } else {                        
-               mail->info->extra_flags.status = EMF_MAIL_STATUS_SEND_CANCELED;
-               account_id = mail->info->account_id;
-       }
-
-       if(!em_core_mail_modify_extra_flag(mail_id, mail->info->extra_flags, &err)) {
-               EM_DEBUG_EXCEPTION("Failed to modify extra flag [%d]",err);
-               goto FINISH_OFF;
-       }
-#endif
-
-       hAPI = ipcEmailAPI_Create(_EMAIL_API_SEND_MAIL_CANCEL_JOB);
-
-       if(!hAPI) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_Create failed");
-               err = EMF_ERROR_NULL_VALUE;             
-               goto FINISH_OFF;
-       }
-
-       /* Account_id */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, &account_id, sizeof(int))) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-
-       /* Mail ID */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, &(mail_id), sizeof(int))) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-
-       /* Execute API */
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPI failed");
-               err = EMF_ERROR_IPC_SOCKET_FAILURE;     
-               goto FINISH_OFF;
-       }
-       
-       return_from_ipc = ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
-
-       if(return_from_ipc) {
-               err = *(int*)return_from_ipc;
-       }
-       else {
-        EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter failed");
-               err = EMF_ERROR_IPC_SOCKET_FAILURE;
-               goto FINISH_OFF;
-       }
-
-FINISH_OFF:
-       if(hAPI)
-               ipcEmailAPI_Destroy(hAPI);
-
-       if  (!em_core_mail_free(&mail, 1, &err))
-               EM_DEBUG_EXCEPTION("em_core_mail_free Failed [%d ] ", err);     
-
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-
-}
-/**
-  * EmfSendCancel - Callback function for cm popup. We set the status as EMF_MAIL_STATUS_NONE 
-  *
-  **/
-
-
-EXPORT_API int email_retry_send_mail( int mail_id, int timeout_in_sec)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       
-       int err = EMF_ERROR_NONE;
-       void *return_from_ipc = NULL;
-
-       EM_IF_NULL_RETURN_VALUE(mail_id, EMF_ERROR_INVALID_PARAM);
-       if( timeout_in_sec < 0 )  {
-               EM_DEBUG_EXCEPTION("Invalid timeout_in_sec");
-               err = EMF_ERROR_INVALID_PARAM;
-               return err;
-       }
-       
-       HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_SEND_RETRY);
-
-       if(!hAPI) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_Create failed");
-               err = EMF_ERROR_NULL_VALUE;             
-               goto FINISH_OFF;
-       }
-
-       /* Mail ID */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, &(mail_id), sizeof(int))) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-
-       /* timeout */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, &(timeout_in_sec), sizeof(int))) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-       
-       /* Execute API */
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPI failed");
-               err = EMF_ERROR_IPC_SOCKET_FAILURE;     
-               goto FINISH_OFF;
-       }
-       
-       return_from_ipc = ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
-
-       if(return_from_ipc) {
-               err = *(int*)return_from_ipc;
-       }
-       else {
-        EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter failed");
-               err = EMF_ERROR_IPC_SOCKET_FAILURE;
-               goto FINISH_OFF;
-       }
-
-FINISH_OFF:
-       if(hAPI)
-               ipcEmailAPI_Destroy(hAPI);
-
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-
- }
-
-EXPORT_API int email_get_mailbox_name_by_mail_id(int mail_id, char **pMailbox_name)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       
-       int err = EMF_ERROR_NONE;
-       char* mailbox_name = NULL;
-       emf_mail_tbl_t* mail_table_data = NULL;
-       
-       if(mail_id <= 0) {
-               EM_DEBUG_EXCEPTION("mail_id is not valid");
-               err= EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }       
-       EM_IF_NULL_RETURN_VALUE(pMailbox_name, EMF_ERROR_INVALID_PARAM);
-       
-       if(!em_storage_get_mail_by_id(mail_id, &mail_table_data, true, &err)) {
-               EM_DEBUG_EXCEPTION("Failed to get mail by mail_id [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
-               goto FINISH_OFF;
-       }
-
-       if(mail_table_data->mailbox_name)
-               mailbox_name = strdup(mail_table_data->mailbox_name);
-       
-       *pMailbox_name = mailbox_name;
-
-FINISH_OFF:
-       if(mail_table_data) {
-               em_storage_free_mail(&mail_table_data, 1, &err);        
-               err = em_storage_get_emf_error_from_em_storage_error(err);
-       }
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-}
-
-
-EXPORT_API int email_get_latest_unread_mail_id(int account_id, int *pMailID)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       
-       int err = EMF_ERROR_NONE;
-
-       if( (!pMailID) ||(account_id <= 0 &&  account_id != -1)) {              
-               err = EMF_ERROR_INVALID_PARAM;
-               return err;
-       }
-       if(!em_storage_get_latest_unread_mailid(account_id,pMailID, &err)) {
-               EM_DEBUG_LOG("em_storage_get_latest_unread_mailid - failed");
-               err = em_storage_get_emf_error_from_em_storage_error(err);
-       }
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-}
-
-EXPORT_API int email_get_max_mail_count(int *Count)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int err = EMF_ERROR_NONE;
-       EM_IF_NULL_RETURN_VALUE(Count, EMF_ERROR_INVALID_PARAM);
-       *Count = em_storage_get_max_mail_count();
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-}
-
-
-
-/* for setting application,disk usage of email in KB */
-EXPORT_API int email_get_disk_space_usage(unsigned long *total_size)
-{
-       EM_DEBUG_FUNC_BEGIN("total_size[%p]", total_size);
-       int err = EMF_ERROR_NONE;
-
-       EM_IF_NULL_RETURN_VALUE(total_size, EMF_ERROR_INVALID_PARAM);
-
-       if (!em_storage_mail_get_total_diskspace_usage(total_size,true,&err))  {
-               EM_DEBUG_EXCEPTION("em_storage_mail_get_total_diskspace_usage failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
-               goto FINISH_OFF;
-       }
-FINISH_OFF :   
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-}
-
-EXPORT_API int email_get_recipients_list(int account_id, const char *mailbox_name, emf_sender_list_t **recipients_list)
-{
-       EM_DEBUG_FUNC_BEGIN("recipients_list[%p]",  recipients_list);
-
-       int number_of_mails, index;
-       int number_of_recipients;
-       int ret=0, err = 0;
-
-       emf_sender_list_t *temp_recipients_list = NULL;
-       emf_sender_list_t *p_recipients_list = NULL;
-       GList *addr_list = NULL, *temp_addr_list = NULL;
-       emf_mail_tbl_t *mail_table_data = NULL;
-
-       if (!em_storage_get_mails(account_id, (char*)mailbox_name, NULL, EMF_LIST_TYPE_NORMAL, -1, -1, EMF_SORT_SENDER_HIGH, true, &mail_table_data, &number_of_mails, &err)) {
-               EM_DEBUG_EXCEPTION("em_storage_get_mails failed");
-               ret = em_storage_get_emf_error_from_em_storage_error(err);
-               goto FINISH_OFF;
-       }
-
-       for (index = 0; index < number_of_mails; index++) {
-               addr_list = em_core_get_recipients_list(addr_list, mail_table_data[index].full_address_to, &err);
-               addr_list = em_core_get_recipients_list(addr_list, mail_table_data[index].full_address_cc, &err);
-               addr_list = em_core_get_recipients_list(addr_list, mail_table_data[index].full_address_bcc, &err);
-       }
-
-       number_of_recipients = g_list_length(addr_list);
-
-       p_recipients_list = (emf_sender_list_t *)malloc(sizeof(emf_sender_list_t) * number_of_recipients);
-       if (p_recipients_list == NULL) {
-               EM_DEBUG_EXCEPTION("malloc for emf_sender_list_t failed...");
-               err = EM_STORAGE_ERROR_OUT_OF_MEMORY;
-               ret = err;
-               goto FINISH_OFF;
-       }       
-       memset(p_recipients_list, 0x00, sizeof(emf_sender_list_t) * number_of_recipients);
-       
-       temp_addr_list = g_list_first(addr_list);
-       index = 0;
-       while (temp_addr_list != NULL) {
-               temp_recipients_list = (emf_sender_list_t *)temp_addr_list->data;
-               p_recipients_list[index].address = temp_recipients_list->address;
-               p_recipients_list[index].display_name = temp_recipients_list->display_name;
-               p_recipients_list[index].total_count = temp_recipients_list->total_count + 1;
-               EM_DEBUG_LOG("address[%s], display_name[%s], total_count[%d]", p_recipients_list[index].address, p_recipients_list[index].display_name, p_recipients_list[index].total_count);
-               temp_addr_list = g_list_next(temp_addr_list);
-               index++;
-       }
-
-       ret = true;     
-FINISH_OFF:
-       if (ret == true && recipients_list)
-               *recipients_list = p_recipients_list; else if (p_recipients_list != NULL) {
-               email_free_sender_list(&p_recipients_list, number_of_recipients);
-       }
-
-       EM_DEBUG_FUNC_END();
-       return ret;
-}
-
-EXPORT_API int email_get_sender_list(int account_id, const char *mailbox_name, int search_type, const char *search_value, emf_sort_type_t sorting, emf_sender_list_t** sender_list, int *sender_count)
-{
-       EM_DEBUG_FUNC_BEGIN("sender_list[%p],sender_count[%p], sorting[%d]",  sender_list, sender_count, sorting);
-
-       int err = EMF_ERROR_NONE;
-
-       emf_sender_list_t *temp_sender_list = NULL;
-
-       EM_IF_NULL_RETURN_VALUE(sender_list, EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(sender_count, EMF_ERROR_INVALID_PARAM);
-       if( account_id < ALL_ACCOUNT) {
-               EM_DEBUG_EXCEPTION(" Invalid Account Id Param ");
-               err = EMF_ERROR_INVALID_PARAM ;
-               return err;
-       }
-       
-       if ( !em_storage_get_sender_list(account_id, mailbox_name, search_type, search_value, sorting, &temp_sender_list, sender_count, &err) ) { 
-               EM_DEBUG_EXCEPTION("em_storage_get_sender_list failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
-               goto FINISH_OFF;
-       }
-
-       if ( sender_list )
-               *sender_list = temp_sender_list;
-
-FINISH_OFF:
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-}
-
-EXPORT_API int email_get_sender_list_ex(int account_id, const char *mailbox_name, int start_index, int limit_count, emf_sort_type_t sorting, emf_sender_list_t** sender_list, int *sender_count)
-{
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_free_sender_list(emf_sender_list_t **sender_list, int count)
-{
-       EM_DEBUG_FUNC_BEGIN("sender_list[%p], count[%d]", sender_list, count);
-
-       int err = EMF_ERROR_NONE;
-       
-       if (count > 0)  {
-               if (!sender_list || !*sender_list)  {
-                       EM_DEBUG_EXCEPTION("sender_list[%p], count[%d]", sender_list, count);                   
-                       err = EMF_ERROR_INVALID_PARAM;
-                       return err;
-               }
-               
-               emf_sender_list_t* p = *sender_list;
-               int i = 0;
-               
-               for (; i < count; i++)  {
-                       EM_SAFE_FREE(p[i].address);
-                       EM_SAFE_FREE(p[i].display_name);
-               }
-               
-               EM_SAFE_FREE(p); 
-               *sender_list = NULL;
-       }       
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-}
-
-EXPORT_API int email_get_address_info_list(int mail_id, emf_address_info_list_t** address_info_list)
-{
-       EM_DEBUG_FUNC_BEGIN("mail_id[%d], address_info_list[%p]", mail_id, address_info_list);
-
-       int err = EMF_ERROR_NONE;
-
-       emf_address_info_list_t *temp_address_info_list = NULL;
-
-       EM_IF_NULL_RETURN_VALUE(address_info_list, EMF_ERROR_INVALID_PARAM);
-       if( mail_id <= 0) {
-               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
-               err = EMF_ERROR_INVALID_PARAM ;
-               return err;
-       }
-       
-       if ( !em_core_mail_get_address_info_list(mail_id, &temp_address_info_list, &err) ) {
-               EM_DEBUG_EXCEPTION("em_core_mail_get_address_info_list failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
-               goto FINISH_OFF;
-       }
-
-       if ( address_info_list ) {
-               *address_info_list = temp_address_info_list;
-               temp_address_info_list = NULL;
-       }
-
-FINISH_OFF:
-       if ( temp_address_info_list )
-               em_storage_free_address_info_list(&temp_address_info_list);
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-}
-
-EXPORT_API int email_free_address_info_list(emf_address_info_list_t **address_info_list)
-{
-       EM_DEBUG_FUNC_BEGIN("address_info_list[%p]", address_info_list);
-
-       int err = EMF_ERROR_NONE;
-
-       if ( (err = em_storage_free_address_info_list(address_info_list)) != EMF_ERROR_NONE ) {
-               EM_DEBUG_EXCEPTION("address_info_list[%p] free failed.", address_info_list);
-       }
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-}
-
-EXPORT_API int email_get_structure(const char*encoded_string, void **struct_var, emf_convert_struct_type_e type)
-{
-       EM_DEBUG_FUNC_BEGIN("encoded_string[%s], struct_var[%p], type[%d]", encoded_string, struct_var, type);
-
-       int err = EMF_ERROR_NONE;
-       void * temp_struct = NULL;
-
-       EM_IF_NULL_RETURN_VALUE(encoded_string, EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(struct_var, EMF_ERROR_INVALID_PARAM);
-
-       if ( (err = em_core_convert_string_to_structure((char*)encoded_string, &temp_struct, type)) != EMF_ERROR_NONE )  {
-               EM_DEBUG_EXCEPTION("em_core_convert_string_to_structure failed[%d]", err);
-               goto FINISH_OFF;
-       }
-
-       if ( struct_var )
-               *struct_var = temp_struct;
-
-FINISH_OFF:
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-}
-
-EXPORT_API int email_add_message_with_meeting_request(emf_mail_t* mail, emf_mailbox_t* mailbox, emf_meeting_request_t* meeting_req, int from_composer)
-{
-       EM_DEBUG_FUNC_BEGIN("mail[%p], mailbox[%p], from_composer [%d]", mail, mailbox, from_composer);
-       
-       EM_IF_NULL_RETURN_VALUE(mail,       EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(mail->head, EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(mail->info, EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(mail->body, EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(mailbox,    EMF_ERROR_INVALID_PARAM);
-       EM_IF_ACCOUNT_ID_NULL(mail->info->account_id, EMF_ERROR_INVALID_PARAM);
-       if ( mail->info->is_meeting_request == EMF_MAIL_TYPE_MEETING_REQUEST 
-               || mail->info->is_meeting_request == EMF_MAIL_TYPE_MEETING_RESPONSE 
-               || mail->info->is_meeting_request == EMF_MAIL_TYPE_MEETING_ORIGINATINGREQUEST) {
-               EM_IF_NULL_RETURN_VALUE(meeting_req, EMF_ERROR_INVALID_PARAM);
-       }
-       
-       int err = EMF_ERROR_NONE, size = 0;
-       char *mail_head_stream = NULL, *mail_body_stream = NULL, *mail_info_stream = NULL, *mailbox_stream  = NULL;
-       char *meeting_request_stream = NULL;
-       void *return_from_ipc = NULL;
-       HIPC_API hAPI = NULL;
-
-       if( from_composer ) {
-               hAPI = ipcEmailAPI_Create(_EMAIL_API_ADD_MAIL_OLD);     
-
-               if(!hAPI) {
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_Create failed");
-                       err = EMF_ERROR_NULL_VALUE;             
-                       goto FINISH_OFF;
-               }
-
-               /* Head */
-               mail_head_stream = em_convert_mail_head_to_byte_stream(mail->head, &size);
-
-               if(!mail_head_stream) {
-                       EM_DEBUG_EXCEPTION("em_convert_mail_head_to_byte_stream failed");
-                       err = EMF_ERROR_NULL_VALUE;
-                       goto FINISH_OFF;
-               }
-               
-               if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, mail_head_stream, size)) {
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter for head failed");
-                       err = EMF_ERROR_OUT_OF_MEMORY;
-                       goto FINISH_OFF;
-               }
-               
-               /* Body */
-               mail_body_stream = em_convert_mail_body_to_byte_stream(mail->body, &size);
-
-               if(!mail_body_stream) {
-                       EM_DEBUG_EXCEPTION("em_convert_mail_body_to_byte_stream failed");
-                       err = EMF_ERROR_NULL_VALUE;
-                       goto FINISH_OFF;
-               }
-
-               if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, mail_body_stream, size)) {
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter for body failed");
-                       err = EMF_ERROR_OUT_OF_MEMORY;
-                       goto FINISH_OFF;
-               }
-
-               /* Info */
-               mail_info_stream = em_convert_mail_info_to_byte_stream(mail->info, &size);
-
-               if(!mail_info_stream) {
-                       EM_DEBUG_EXCEPTION("em_convert_mail_info_to_byte_stream failed");
-                       err = EMF_ERROR_NULL_VALUE;
-                       goto FINISH_OFF;
-               }
-
-               if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, mail_info_stream, size)) {
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter for info failed");
-                       err = EMF_ERROR_OUT_OF_MEMORY;
-                       goto FINISH_OFF;
-               }
-               
-               /* Mailbox */
-               mailbox_stream = em_convert_mailbox_to_byte_stream(mailbox, &size);
-
-               if(!mailbox_stream) {
-                       EM_DEBUG_EXCEPTION("em_convert_mailbox_to_byte_stream failed");
-                       err = EMF_ERROR_NULL_VALUE;
-                       goto FINISH_OFF;
-               }
-
-               if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, mailbox_stream, size)) {
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter mailbox Fail");
-                       err = EMF_ERROR_OUT_OF_MEMORY;
-                       goto FINISH_OFF;
-               }
-               
-
-               /* from_composer */
-               if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&from_composer, sizeof(int))) {
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter from_composer Failed");
-                       err = EMF_ERROR_OUT_OF_MEMORY;
-                       goto FINISH_OFF;
-               }
-
-               /*  meeting_req */
-               if ( mail->info->is_meeting_request != EMF_MAIL_TYPE_NORMAL ) {
-                       meeting_request_stream = em_convert_meeting_req_to_byte_stream(meeting_req, &size);
-
-                       if(!meeting_request_stream) {
-                               EM_DEBUG_EXCEPTION("em_convert_meeting_req_to_byte_stream failed");
-                               err = EMF_ERROR_NULL_VALUE;
-                               goto FINISH_OFF;
-                       }
-
-                       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, meeting_request_stream, size)) {
-                               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-                               err = EMF_ERROR_OUT_OF_MEMORY;
-                               goto FINISH_OFF;
-                       }
-               }
-
-               /* Execute API */
-               if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-                       EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPI failed");
-                       err = EMF_ERROR_IPC_SOCKET_FAILURE;
-                       goto FINISH_OFF;
-               }
-
-               return_from_ipc = ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
-                       
-               if(return_from_ipc)
-                       err = *(int*)return_from_ipc;
-               else {
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter failed");
-                       err = EMF_ERROR_IPC_SOCKET_FAILURE;
-                       goto FINISH_OFF;
-               }
-
-               if(err == EMF_ERROR_NONE) {
-                       return_from_ipc = ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1);
-                       if(return_from_ipc)
-                               mail->info->uid = *(int*)return_from_ipc;
-                       else{
-                               EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter failed");
-                               err = EMF_ERROR_IPC_SOCKET_FAILURE;
-                               goto FINISH_OFF;
-                       }
-               }
-
-               if(err == EMF_ERROR_NONE)
-                       mail->info->uid = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1);
-       } 
-       else {  
-               if (!em_core_mail_save(mailbox->account_id, mailbox->name, mail, meeting_req, from_composer, &err))  {
-                       EM_DEBUG_EXCEPTION("em_core_mail_save failed [%d]", err);
-                       goto FINISH_OFF;
-               }       
-       }
-
-FINISH_OFF:
-       if(hAPI) 
-               ipcEmailAPI_Destroy(hAPI);
-
-       EM_SAFE_FREE(mail_head_stream);
-       EM_SAFE_FREE(mail_body_stream);
-       EM_SAFE_FREE(mail_info_stream);
-       EM_SAFE_FREE(mailbox_stream);
-       EM_SAFE_FREE(meeting_request_stream); 
-
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-
-}
-
-EXPORT_API int email_get_meeting_request(int mail_id, emf_meeting_request_t **meeting_req)
-{
-       EM_DEBUG_FUNC_BEGIN("mail_id[%d],meeting_req[%p]",  mail_id, meeting_req);
-
-       int err = EMF_ERROR_NONE;
-
-       emf_meeting_request_t *temp_meeting_req = NULL;
-
-       EM_IF_NULL_RETURN_VALUE(meeting_req, EMF_ERROR_INVALID_PARAM);
-       if( mail_id <= 0 ) {
-               EM_DEBUG_EXCEPTION(" Invalid Mail Id Param ");
-               err = EMF_ERROR_INVALID_PARAM ;
-               return err;
-       }
-       
-       if ( !em_storage_get_meeting_request(mail_id, &temp_meeting_req, 1, &err) ) {
-               EM_DEBUG_EXCEPTION("em_storage_get_meeting_request -- Failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
-               goto FINISH_OFF;
-       }
-
-       if ( meeting_req )
-               *meeting_req = temp_meeting_req;
-
-FINISH_OFF:
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-}
-
-
-EXPORT_API int email_update_message_with_meeting_request(int mail_id, emf_mail_t* mail, emf_meeting_request_t* meeting_req)
-{
-       EM_DEBUG_FUNC_BEGIN("mail_id[%d], mali[%p]", mail_id, mail);
-       
-       int size = 0;
-       int ret = 0;
-       int err = EMF_ERROR_NONE;
-       void *retrun_from_ipc = NULL;
-       char* mail_head_stream =  NULL;
-       char* mail_body_stream =  NULL;
-       char* mail_info_stream =  NULL;
-       char* pMeeting_request_stream = NULL;
-       HIPC_API hAPI = NULL;
-       
-       EM_IF_NULL_RETURN_VALUE(mail, EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(mail->head, EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(mail->info, EMF_ERROR_INVALID_PARAM);   
-       EM_IF_NULL_RETURN_VALUE(mail_id, EMF_ERROR_INVALID_PARAM);
-       EM_IF_ACCOUNT_ID_NULL(mail->info->account_id, EMF_ERROR_INVALID_PARAM);
-       if ( mail->info->is_meeting_request == EMF_MAIL_TYPE_MEETING_REQUEST 
-               || mail->info->is_meeting_request == EMF_MAIL_TYPE_MEETING_RESPONSE 
-               || mail->info->is_meeting_request == EMF_MAIL_TYPE_MEETING_ORIGINATINGREQUEST) {
-               EM_IF_NULL_RETURN_VALUE(meeting_req, EMF_ERROR_INVALID_PARAM);
-       }
-       
-       hAPI = ipcEmailAPI_Create(_EMAIL_API_UPDATE_MAIL_OLD);  
-
-       if(!hAPI) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_Create failed");
-               err = EMF_ERROR_NULL_VALUE;             
-               goto FINISH_OFF;
-       }
-       
-       /* mail_id */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&mail_id, sizeof(int))) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;
-               goto FINISH_OFF;
-       }
-
-       /* Head */
-       mail_head_stream = em_convert_mail_head_to_byte_stream(mail->head, &size);
-       if(!mail_head_stream) {
-               EM_DEBUG_EXCEPTION("em_convert_mail_head_to_byte_stream failed");
-               err = EMF_ERROR_NULL_VALUE;
-               goto FINISH_OFF;
-       }
-
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, mail_head_stream, size)) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;
-               goto FINISH_OFF;
-       }
-
-       /* Body */
-       mail_body_stream = em_convert_mail_body_to_byte_stream(mail->body, &size);
-
-       if (!mail_body_stream ) {
-               int dummy_body = 0;
-               EM_DEBUG_LOG(" Mail body is NULL. Add dummy data(4 bytes)");
-               if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&dummy_body,  sizeof(int))) {
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-                       err = EMF_ERROR_OUT_OF_MEMORY;
-                       goto FINISH_OFF;
-               }
-       } 
-       else {
-               if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, mail_body_stream, size)) {
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-                       err = EMF_ERROR_OUT_OF_MEMORY;
-                       goto FINISH_OFF;
-               }
-       }
-
-       /* Info */
-       mail_info_stream = em_convert_mail_info_to_byte_stream(mail->info, &size);
-
-       if (!mail_info_stream ) {
-               EM_DEBUG_EXCEPTION("em_convert_mail_info_to_byte_stream failed");
-               err = EMF_ERROR_NULL_VALUE;
-               goto FINISH_OFF;
-       }
-
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, mail_info_stream, size)) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;
-               goto FINISH_OFF;
-       }
-
-       /*  meeting_req */
-       if ( mail->info->is_meeting_request != EMF_MAIL_TYPE_NORMAL ) {
-               pMeeting_request_stream = em_convert_meeting_req_to_byte_stream(meeting_req, &size);
-
-               if(!pMeeting_request_stream) {
-                       EM_DEBUG_EXCEPTION("em_convert_meeting_req_to_byte_stream failed");
-                       err = EMF_ERROR_NULL_VALUE;
-                       goto FINISH_OFF;
-               }
-
-               if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, pMeeting_request_stream, size)) {
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-                       err = EMF_ERROR_OUT_OF_MEMORY;
-                       goto FINISH_OFF;
-               }
-       }
-
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPI failed");
-               err = EMF_ERROR_IPC_SOCKET_FAILURE;
-               goto FINISH_OFF;
-       }
-
-       retrun_from_ipc = ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
-
-       if(retrun_from_ipc) {
-               ret = *(int*)retrun_from_ipc;
-               if ( ret != 1 ) {
-                       retrun_from_ipc = ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1);
-                       if(retrun_from_ipc) {
-                               err = *(int*)retrun_from_ipc;
-                       }
-                       else {
-                               EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter failed");
-                               err = EMF_ERROR_IPC_SOCKET_FAILURE;
-                               goto FINISH_OFF;
-                       }
-               }
-       }
-       else {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter failed");
-               err = EMF_ERROR_IPC_SOCKET_FAILURE;
-               goto FINISH_OFF;
-       }
-FINISH_OFF:
-       EM_SAFE_FREE(mail_head_stream);
-       EM_SAFE_FREE(mail_body_stream);
-       EM_SAFE_FREE(mail_info_stream);
-       EM_SAFE_FREE(pMeeting_request_stream);
-
-       if(hAPI)
-               ipcEmailAPI_Destroy(hAPI);
-
-       EM_DEBUG_FUNC_END("ret [%d], err [%d]", ret, err);
-       return err;
-}
-
-EXPORT_API int email_free_meeting_request(emf_meeting_request_t** meeting_req, int count)
-{
-       EM_DEBUG_FUNC_BEGIN("meeting_req[%p], count[%d]", meeting_req, count);
-
-       int err = EMF_ERROR_NONE;
-
-       em_storage_free_meeting_request(meeting_req, count, &err);
-       err = em_storage_get_emf_error_from_em_storage_error(err);
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-}
-
-EXPORT_API int email_move_thread_to_mailbox(int thread_id, char *target_mailbox_name, int move_always_flag)
-{
-       EM_DEBUG_FUNC_BEGIN("thread_id[%d], target_mailbox_name[%p], move_always_flag[%d]", thread_id, target_mailbox_name, move_always_flag);
-       int err = EMF_ERROR_NONE;
-       void *return_from_ipc = NULL;
-       
-       EM_IF_NULL_RETURN_VALUE(target_mailbox_name, EMF_ERROR_INVALID_PARAM);
-       
-       HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_MOVE_THREAD_TO_MAILBOX);
-
-       if(!hAPI) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_Create failed");
-               err = EMF_ERROR_NULL_VALUE;             
-               goto FINISH_OFF;
-       }
-
-       /* thread_id */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&thread_id, sizeof(int))){
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-       
-       /* target mailbox information */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, target_mailbox_name, strlen(target_mailbox_name))){
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-
-       /* move_always_flag */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&move_always_flag, sizeof(int))){
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-       
-       /* Execute API */
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPI failed");
-               err = EMF_ERROR_IPC_SOCKET_FAILURE;     
-               goto FINISH_OFF;
-       }
-       
-       return_from_ipc = ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
-
-       if(return_from_ipc) {
-               err = *(int*)return_from_ipc;
-       }
-       else {
-        EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter failed");
-               err = EMF_ERROR_IPC_SOCKET_FAILURE;
-               goto FINISH_OFF;
-       }
-
-FINISH_OFF:
-       if(hAPI)
-               ipcEmailAPI_Destroy(hAPI);
-
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-}
-
-EXPORT_API int email_delete_thread(int thread_id, int delete_always_flag)
-{
-       EM_DEBUG_FUNC_BEGIN("thread_id[%d], delete_always_flag[%d]", thread_id, delete_always_flag);
-       int err = EMF_ERROR_NONE;
-       void *return_from_ipc = NULL;
-       HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_DELETE_THREAD);
-
-       if(!hAPI) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_Create failed");
-               err = EMF_ERROR_NULL_VALUE;             
-               goto FINISH_OFF;
-       }
-
-       /* thread_id */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&thread_id, sizeof(int))){
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-
-       /* delete_always_flag */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&delete_always_flag, sizeof(int))){
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-       
-       /* Execute API */
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPI failed");
-               err = EMF_ERROR_IPC_SOCKET_FAILURE;     
-               goto FINISH_OFF;
-       }
-       
-       return_from_ipc = ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
-
-       if(return_from_ipc) {
-               err = *(int*)return_from_ipc;
-       }
-       else {
-        EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter failed");
-               err = EMF_ERROR_IPC_SOCKET_FAILURE;
-               goto FINISH_OFF;
-       }
-
-FINISH_OFF:
-       if(hAPI)
-               ipcEmailAPI_Destroy(hAPI);
-
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-}
-
-EXPORT_API int email_modify_seen_flag_of_thread(int thread_id, int seen_flag, int on_server)
-{
-       EM_DEBUG_FUNC_BEGIN("thread_id[%d], seen_flag[%d], on_server[%d]", thread_id, seen_flag, on_server);
-       int err = EMF_ERROR_NONE;
-       void *return_from_ipc = NULL;
-       HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_MODIFY_SEEN_FLAG_OF_THREAD);
-
-       if(!hAPI) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_Create failed");
-               err = EMF_ERROR_NULL_VALUE;             
-               goto FINISH_OFF;
-       }
-
-       /* thread_id */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&thread_id, sizeof(int))) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-
-       /* seen_flag */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&seen_flag, sizeof(int))) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-
-       /* on_server */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&on_server, sizeof(int))) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;          
-               goto FINISH_OFF;
-       }
-       
-       /* Execute API */
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPI failed");
-               err = EMF_ERROR_IPC_SOCKET_FAILURE;     
-               goto FINISH_OFF;
-       }
-       
-       return_from_ipc = ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
-
-       if(return_from_ipc) {
-               err = *(int*)return_from_ipc;
-       }
-       else {
-        EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter failed");
-               err = EMF_ERROR_IPC_SOCKET_FAILURE;
-               goto FINISH_OFF;
-       }
-
-FINISH_OFF:
-       if(hAPI)
-               ipcEmailAPI_Destroy(hAPI);
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-}
-
diff --git a/MAPI/Emf_Mapi_Types.c b/MAPI/Emf_Mapi_Types.c
deleted file mode 100755 (executable)
index c0da215..0000000
+++ /dev/null
@@ -1,2088 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-
-/**
- *
- * This file contains the data structures and interfaces needed for application,
- * to interact with Email Engine.
- * @file               Emf_Mapi_Types.c
- * @author     Kyuho Jo ( kyuho.jo@samsung.com )
- * @version    0.1
- * @brief      This file contains interfaces for using data structures of email-service . 
- */
-
-#include <Emf_Mapi.h>
-#include <emf-types.h>
-
-
-EXPORT_API int email_get_info_from_mail(emf_mail_t *mail, emf_mail_info_t **info)
-{
-       if(!mail || !info)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       *info = mail->info;
-
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_set_info_to_mail(emf_mail_t *mail, emf_mail_info_t *info)
-{
-       if(!mail || !info)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       mail->info = info;
-
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_get_head_from_mail(emf_mail_t *mail, emf_mail_head_t **head)
-{
-       if(!mail || !head)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       *head = mail->head;
-
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_set_head_to_mail(emf_mail_t *mail, emf_mail_head_t *head)
-{
-       if(!mail || !head)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       mail->head = head;
-
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_get_body_from_mail(emf_mail_t *mail, emf_mail_body_t **body)
-{
-       if(!mail || !body)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       *body = mail->body;
-
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_set_body_to_mail(emf_mail_t *mail, emf_mail_body_t *body)
-{
-       if(!mail || !body)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       mail->body = body;
-
-       return EMF_ERROR_NONE;
-}
-
-
-/*  emf_mail_info_t ------------------------------------------------------------ */
-
-EXPORT_API int email_get_account_id_from_info(emf_mail_info_t *info, int *account_id)
-{
-       if(!info || !account_id)
-               return EMF_ERROR_INVALID_PARAM;
-               
-       *account_id = info->account_id;
-               
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_set_account_id_to_info(emf_mail_info_t *info, int account_id)
-{
-       if(!info)
-               return EMF_ERROR_INVALID_PARAM;
-               
-       info->account_id = account_id;
-               
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_get_uid_from_info(emf_mail_info_t *info, int *uid)
-{
-       if(!info || !uid)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *uid = info->uid;
-               
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_set_uid_to_info(emf_mail_info_t *info, int uid)
-{
-       if(!info)
-               return EMF_ERROR_INVALID_PARAM;
-
-       info->uid = uid;
-               
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_get_rfc822_size_from_info(emf_mail_info_t *info, int *rfc822_size)
-{
-       if(!info || !rfc822_size)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *rfc822_size = info->rfc822_size;
-               
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_set_rfc822_size_to_info(emf_mail_info_t *info, int rfc822_size)
-{
-       if(!info)
-               return EMF_ERROR_INVALID_PARAM;
-
-       info->rfc822_size = rfc822_size;
-               
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_get_body_downloaded_from_info(emf_mail_info_t *info, int *body_downloaded)
-{
-       if(!info || !body_downloaded)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *body_downloaded = info->body_downloaded;
-               
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_set_body_downloaded_to_info(emf_mail_info_t *info, int body_downloaded)
-{
-       if(!info)
-               return EMF_ERROR_INVALID_PARAM;
-
-       info->body_downloaded = body_downloaded;
-       
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_get_flags_from_info(emf_mail_info_t *info, emf_mail_flag_t *flags)
-{
-       if(!info || !flags)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *flags = info->flags;
-               
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_set_flags_to_info(emf_mail_info_t *info, emf_mail_flag_t flags)
-{
-       if(!info)
-               return EMF_ERROR_INVALID_PARAM;
-
-       info->flags = flags;
-               
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_get_extra_flags_from_info(emf_mail_info_t *info, emf_extra_flag_t *extra_flags)
-{
-       if(!info || !extra_flags)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *extra_flags = info->extra_flags;
-               
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_set_extra_flags_to_info(emf_mail_info_t *info, emf_extra_flag_t extra_flags)
-{
-       if(!info)
-               return EMF_ERROR_INVALID_PARAM;
-
-       info->extra_flags = extra_flags;
-               
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_get_sid_from_info(emf_mail_info_t *info, char **sid)
-{
-       if(!info || !sid)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *sid = info->sid;
-               
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_set_sid_to_info(emf_mail_info_t *info, char *sid)
-{
-       if(!info)
-               return EMF_ERROR_INVALID_PARAM;
-
-       info->sid = sid;                
-               
-       return EMF_ERROR_NONE;
-}
-
-/*  emf_mail_head_t ------------------------------------------------------------ */
-
-EXPORT_API int email_get_mid_from_head(emf_mail_head_t *head, char **mid)
-{
-       if(!head || !mid)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *mid = head->mid;
-               
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_set_mid_to_head(emf_mail_head_t *head, char *mid)
-{
-       if(!head)
-               return EMF_ERROR_INVALID_PARAM;
-
-       head->mid = mid;        
-               
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_get_subject_from_head(emf_mail_head_t *head, char **subject)
-{
-       if(!head || !subject)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *subject = head->subject;
-               
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_set_subject_to_head(emf_mail_head_t *head, char *subject)
-{
-       if(!head)
-               return EMF_ERROR_INVALID_PARAM;
-
-       head->subject = subject;
-               
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_get_to_from_head(emf_mail_head_t *head, char **to)
-{
-       if(!head || !to)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *to = head->to;
-               
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_set_to_to_head(emf_mail_head_t *head, char *to)
-{
-       if(!head)
-               return EMF_ERROR_INVALID_PARAM;
-
-       head->to = to;
-               
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_get_from_from_head(emf_mail_head_t *head, char **from)
-{
-       if(!head || !from)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *from = head->from;
-               
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_set_from_to_head(emf_mail_head_t *head, char *from)
-{
-       if(!head)
-               return EMF_ERROR_INVALID_PARAM;
-
-       head->from = from;
-               
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_get_cc_from_head(emf_mail_head_t *head, char **cc)
-{
-       if(!head || !cc)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *cc = head->cc;
-               
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_set_cc_to_head(emf_mail_head_t *head, char *cc)
-{
-       if(!head)
-               return EMF_ERROR_INVALID_PARAM;
-
-       head->cc = cc;
-               
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_get_bcc_from_head(emf_mail_head_t *head, char **bcc)
-{
-       if(!head || !bcc)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *bcc = head->bcc;
-               
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_set_bcc_to_head(emf_mail_head_t *head, char *bcc)
-{
-       if(!head)
-               return EMF_ERROR_INVALID_PARAM;
-
-       head->bcc = bcc;
-               
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_get_reply_from_head(emf_mail_head_t *head, char **reply)
-{
-       if(!head || !reply)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *reply = head->reply_to;
-               
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_set_reply_to_head(emf_mail_head_t *head, char *reply)
-{
-       if(!head)
-               return EMF_ERROR_INVALID_PARAM;
-
-       head->reply_to = reply;
-               
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_get_return_path_from_head(emf_mail_head_t *head, char **return_path)
-{
-       if(!head || !return_path)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *return_path = head->return_path;
-               
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_set_return_path_to_head(emf_mail_head_t *head, char *return_path)
-{
-       if(!head)
-               return EMF_ERROR_INVALID_PARAM;
-
-       head->return_path = return_path;
-               
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_get_datetime_from_head(emf_mail_head_t *head, emf_datetime_t *datetime)
-{
-       if(!head || !datetime)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *datetime = head->datetime;
-               
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_set_datetime_to_head(emf_mail_head_t *head, emf_datetime_t datetime)
-{
-       if(!head)
-               return EMF_ERROR_INVALID_PARAM;
-
-       head->datetime = datetime;
-               
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_get_from_contact_name_from_head(emf_mail_head_t *head, char **from_contact_name)
-{
-       if(!head || !from_contact_name)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *from_contact_name = head->from_contact_name;
-               
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_set_from_contact_name_to_head(emf_mail_head_t *head, char *from_contact_name)
-{
-       if(!head)
-               return EMF_ERROR_INVALID_PARAM;
-
-       head->from_contact_name = from_contact_name;
-               
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_get_to_contact_name_from_head(emf_mail_head_t *head, char **to_contact_name)
-{
-       if(!head || !to_contact_name)
-               return EMF_ERROR_INVALID_PARAM;
-               
-       *to_contact_name = head->to_contact_name;
-               
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_set_to_contact_name_to_head(emf_mail_head_t *head, char *to_contact_name)
-{
-       if(!head)
-               return EMF_ERROR_INVALID_PARAM;
-
-       head->to_contact_name = to_contact_name;
-               
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_get_cc_contact_name_from_head(emf_mail_head_t *head, char **cc_contact_name)
-{
-       if(!head || !cc_contact_name)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *cc_contact_name = head->cc_contact_name;
-               
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_set_cc_contact_name_to_head(emf_mail_head_t *head, char *cc_contact_name)
-{
-       if(!head)
-               return EMF_ERROR_INVALID_PARAM;
-
-       head->cc_contact_name = cc_contact_name;
-               
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_get_bcc_contact_name_from_head(emf_mail_head_t *head, char **bcc_contact_name)
-{
-       if(!head || !bcc_contact_name)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *bcc_contact_name = head->bcc_contact_name;
-               
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_set_bcc_contact_name_to_head(emf_mail_head_t *head, char *bcc_contact_name)
-{
-       if(!head)
-               return EMF_ERROR_INVALID_PARAM;
-
-       head->bcc_contact_name = bcc_contact_name;
-               
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_get_preview_body_text_from_head(emf_mail_head_t *head, char **preview_body_text)
-{
-       if(!head || !preview_body_text)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *preview_body_text = head->previewBodyText;
-               
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_set_preview_body_text_to_head(emf_mail_head_t *head, char *preview_body_text)
-{
-       if(!head)
-               return EMF_ERROR_INVALID_PARAM;
-
-       head->previewBodyText = preview_body_text;
-               
-       return EMF_ERROR_NONE;
-}
-
-/*  emf_mail_body_t ------------------------------------------------------------ */
-
-EXPORT_API int email_get_plain_from_body(emf_mail_body_t *body, char **plain)
-{
-       if(!body || !plain)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *plain = body->plain;
-               
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_set_plain_to_body(emf_mail_body_t *body, char *plain)
-{
-       if(!body)
-               return EMF_ERROR_INVALID_PARAM;
-
-       body->plain = plain;
-
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_get_plain_charset_from_body(emf_mail_body_t *body, char **plain_charset)
-{
-       if(!body || !plain_charset)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *plain_charset = body->plain_charset;
-
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_set_plain_charset_to_body(emf_mail_body_t *body, char *plain_charset)
-{
-       if(!body)
-               return EMF_ERROR_INVALID_PARAM;
-
-       body->plain_charset = plain_charset;    
-
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_get_html_from_body(emf_mail_body_t *body, char **html)
-{
-       if(!body || !html)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *html = body->html;
-
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_set_html_to_body(emf_mail_body_t *body, char *html)
-{
-       if(!body)
-               return EMF_ERROR_INVALID_PARAM;
-
-       body->html = html;      
-
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_get_attachment_num_from_body(emf_mail_body_t *body, int *attachment_num)
-{
-       if(!body || !attachment_num)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *attachment_num = body->attachment_num;
-
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_set_attachment_num_to_body(emf_mail_body_t *body, int attachment_num)
-{
-       if(!body)
-               return EMF_ERROR_INVALID_PARAM;
-
-       body->attachment_num = attachment_num;          
-
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_get_attachment_from_body(emf_mail_body_t *body, emf_attachment_info_t **attachment)
-{
-       if(!body || !attachment)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *attachment = body->attachment;
-
-       return EMF_ERROR_NONE;
-}
-
-EXPORT_API int email_set_attachment_to_body(emf_mail_body_t *body, emf_attachment_info_t *attachment)
-{
-       if(!body)
-               return EMF_ERROR_INVALID_PARAM;
-
-       body->attachment = attachment;  
-
-       return EMF_ERROR_NONE;
-}
-
-/*  emf_account_t -------------------------------------------------------------- */
-
-int email_get_account_bind_type_from_account(emf_account_t *account, emf_account_bind_t account_bind_type)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       account_bind_type = account->account_bind_type;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_account_bind_type_to_account(emf_account_t *account, emf_account_bind_t account_bind_type)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       account->account_bind_type = account_bind_type; 
-
-       return EMF_ERROR_NONE;
-}
-
-int email_get_account_name_from_account(emf_account_t *account, char **account_name)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       *account_name = account->account_name;
-
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_account_name_to_account(emf_account_t *account, char *account_name)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       account->account_name = account_name;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_get_receiving_server_type_from_account(emf_account_t *account, emf_account_server_t *receiving_server_type)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       *receiving_server_type = account->receiving_server_type;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_receiving_server_type_to_account(emf_account_t *account, emf_account_server_t receiving_server_type)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       account->receiving_server_type = receiving_server_type;
-
-
-       return EMF_ERROR_NONE;
-}
-
-int email_get_receiving_server_addr_from_account(emf_account_t *account, char **receiving_server_addr)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       *receiving_server_addr = account->receiving_server_addr;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_receiving_server_addr_to_account(emf_account_t *account, char *receiving_server_addr)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       account->receiving_server_addr = receiving_server_addr;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_get_email_addr_from_account(emf_account_t *account, char **email_addr)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       *email_addr = account->email_addr;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_email_addr_to_account(emf_account_t *account, char *email_addr)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       account->email_addr = email_addr;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_get_user_name_from_account(emf_account_t *account, char **user_name)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       *user_name = account->user_name;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_user_name_to_account(emf_account_t *account, char *user_name)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       account->user_name = user_name;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_get_password_from_account(emf_account_t *account, char **password)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       *password = account->password;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_password_to_account(emf_account_t *account, char *password)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       account->password = password;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_get_retrieval_mode_from_account(emf_account_t *account, emf_imap4_retrieval_mode_t *retrieval_mode)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       *retrieval_mode = account->retrieval_mode;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_retrieval_mode_to_account(emf_account_t *account, emf_imap4_retrieval_mode_t retrieval_mode)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       account->retrieval_mode = retrieval_mode;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_get_port_num_from_account(emf_account_t *account, int *port_num)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       *port_num = account->port_num;
-
-       return EMF_ERROR_NONE;
-}
-
-
-int email_set_port_num_to_account(emf_account_t *account, int port_num)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       account->port_num = port_num;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_get_use_security_from_account(emf_account_t *account, int *use_security)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       *use_security = account->use_security;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_use_security_to_account(emf_account_t *account, int use_security)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       account->use_security = use_security;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_get_sending_server_type_from_account(emf_account_t *account, emf_account_server_t*sending_server_type)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       *sending_server_type = account->sending_server_type;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_sending_server_type_to_account(emf_account_t *account, emf_account_server_t sending_server_type)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       account->sending_server_type = sending_server_type;
-
-
-       return EMF_ERROR_NONE;
-}
-
-int email_get_sending_server_addr_from_account(emf_account_t *account, char **sending_server_addr)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       *sending_server_addr = account->sending_server_addr;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_sending_server_addr_to_account(emf_account_t *account, char *sending_server_addr)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       account->sending_server_addr = sending_server_addr;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_get_sending_port_num_from_account(emf_account_t *account, int *sending_port_num)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       *sending_port_num = account->sending_port_num;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_sending_port_num_to_account(emf_account_t *account, int sending_port_num)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       account->sending_port_num = sending_port_num;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_get_sending_auth_from_account(emf_account_t *account, int *sending_auth)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       *sending_auth = account->sending_auth;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_sending_auth_to_account(emf_account_t *account, int sending_auth)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       account->sending_auth = sending_auth;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_get_sending_security_from_account(emf_account_t *account, int *sending_security)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       *sending_security = account->sending_security;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_sending_security_to_account(emf_account_t *account, int sending_security)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       account->sending_security = sending_security;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_get_sending_user_from_account(emf_account_t *account, char **sending_user)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       *sending_user = account->sending_user;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_sending_user_to_account(emf_account_t *account, char *sending_user)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       account->sending_user = sending_user;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_get_sending_password_from_account(emf_account_t *account, char **sending_password)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       *sending_password = account->sending_password;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_sending_password_to_account(emf_account_t *account, char *sending_password)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       account->sending_password = sending_password;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_get_display_name_from_account(emf_account_t *account, char **display_name)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       *display_name = account->display_name;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_display_name_to_account(emf_account_t *account, char *display_name)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       account->display_name = display_name;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_get_reply_to_addr_from_account(emf_account_t *account, char **reply_to_addr)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       *reply_to_addr = account->reply_to_addr;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_reply_to_addr_to_account(emf_account_t *account, char *reply_to_addr)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       account->reply_to_addr = reply_to_addr;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_get_return_addr_from_account(emf_account_t *account, char **return_addr)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       *return_addr = account->return_addr;
-
-       return EMF_ERROR_NONE;
-}
-
-
-int email_set_return_addr_to_account(emf_account_t *account, char *return_addr)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       account->return_addr = return_addr;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_get_account_id_from_account(emf_account_t *account, int *account_id)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       *account_id = account->account_id;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_account_id_to_account(emf_account_t *account, int account_id)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       account->account_id = account_id;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_get_keep_on_server_from_account(emf_account_t *account, int *keep_on_server)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       *keep_on_server = account->keep_on_server;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_keep_on_server_to_account(emf_account_t *account, int keep_on_server)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       account->keep_on_server = keep_on_server;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_get_flag1_from_account(emf_account_t *account, int *flag1)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       *flag1 = account->flag1;
-
-       return EMF_ERROR_NONE;
-}
-
-
-int email_set_flag1_to_account(emf_account_t *account, int flag1)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       account->flag1 = flag1;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_get_flag2_from_account(emf_account_t *account, int *flag2)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       *flag2 = account->flag2;
-
-       return EMF_ERROR_NONE;
-}
-
-
-int email_set_flag2_to_account(emf_account_t *account, int flag2)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       account->flag2 = flag2;
-
-
-       return EMF_ERROR_NONE;
-}
-
-int email_get_pop_before_smtp_from_account(emf_account_t *account, int *pop_before_smtp)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       *pop_before_smtp = account->pop_before_smtp;
-
-       return EMF_ERROR_NONE;
-}
-
-
-int email_set_pop_before_smtp_to_account(emf_account_t *account, int pop_before_smtp)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       account->pop_before_smtp = pop_before_smtp;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_get_apop_from_account(emf_account_t *account, int *apop)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       *apop = account->apop;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_apop_to_account(emf_account_t *account, int apop)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       account->apop = apop;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_get_logo_icon_path_from_account(emf_account_t *account, char **logo_icon_path)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       *logo_icon_path = account->logo_icon_path;
-       
-       return EMF_ERROR_NONE;
-}
-
-
-int email_set_logo_icon_path_to_account(emf_account_t *account, char *logo_icon_path)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       account->logo_icon_path = logo_icon_path;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_get_preset_account_from_account(emf_account_t *account, int *preset_account)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       *preset_account = account->preset_account;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_preset_account_to_account(emf_account_t *account, int preset_account)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       account->preset_account = preset_account;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_get_options_from_account(emf_account_t *account, emf_option_t **options)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       *options = &account->options;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_options_to_account(emf_account_t *account, emf_option_t *options)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       account->options = *options;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_get_target_storage_from_account(emf_account_t *account, int *target_storage)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       *target_storage = account->target_storage;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_target_storage_to_account(emf_account_t *account, int target_storage)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       account->target_storage = target_storage;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_get_check_interval_from_account(emf_account_t *account, int *check_interval)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       *check_interval = account->check_interval;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_check_interval_to_account(emf_account_t *account, int check_interval)
-{
-       if(!account)
-               return EMF_ERROR_INVALID_PARAM;
-       
-       account->check_interval = check_interval;
-
-       return EMF_ERROR_NONE;
-}
-
-/*  emf_mailbox_t--------------------------------------------------------------- */
-
-int email_get_name_from_mailbox(emf_mailbox_t *mailbox, char **name)
-{
-       if(!mailbox)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *name = mailbox->name;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_name_to_mailbox(emf_mailbox_t *mailbox, char *name)
-{
-       if(!mailbox)
-               return EMF_ERROR_INVALID_PARAM;
-
-       mailbox->name = name;
-
-       return EMF_ERROR_NONE;
-}
-       
-int email_get_mailbox_type_from_mailbox(emf_mailbox_t *mailbox, emf_mailbox_type_e mailbox_type)
-{
-       if(!mailbox)
-               return EMF_ERROR_INVALID_PARAM;
-
-       mailbox_type = mailbox->mailbox_type;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_mailbox_type_to_mailbox(emf_mailbox_t *mailbox, emf_mailbox_type_e mailbox_type)
-{
-       if(!mailbox)
-               return EMF_ERROR_INVALID_PARAM;
-
-       mailbox->mailbox_type = mailbox_type;
-
-       return EMF_ERROR_NONE;
-}
-       
-int email_get_alias_from_mailbox(emf_mailbox_t *mailbox, char **alias)
-{
-       if(!mailbox)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *alias = mailbox->alias;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_alias_to_mailbox(emf_mailbox_t *mailbox, char *alias)
-{
-       if(!mailbox)
-               return EMF_ERROR_INVALID_PARAM;
-
-       mailbox->alias = alias;
-
-       return EMF_ERROR_NONE;
-}
-       
-int email_get_unread_count_from_mailbox(emf_mailbox_t *mailbox, int *unread_count)
-{
-       if(!mailbox)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *unread_count = mailbox->unread_count;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_unread_count_to_mailbox(emf_mailbox_t *mailbox, int unread_count)
-{
-       if(!mailbox)
-               return EMF_ERROR_INVALID_PARAM;
-
-       mailbox->unread_count = unread_count;
-
-       return EMF_ERROR_NONE;
-}
-       
-int email_get_hold_connection_from_mailbox(emf_mailbox_t *mailbox, int *hold_connection)
-{
-       if(!mailbox)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *hold_connection = mailbox->hold_connection;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_hold_connection_to_mailbox(emf_mailbox_t *mailbox, int hold_connection)
-{
-       if(!mailbox)
-               return EMF_ERROR_INVALID_PARAM;
-
-       mailbox->hold_connection = hold_connection;
-
-       return EMF_ERROR_NONE;
-}
-       
-int email_get_local_from_mailbox(emf_mailbox_t *mailbox, int *local)
-{
-       if(!mailbox)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *local = mailbox->local;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_local_to_mailbox(emf_mailbox_t *mailbox, int local)
-{
-       if(!mailbox)
-               return EMF_ERROR_INVALID_PARAM;
-
-       mailbox->local = local;
-
-       return EMF_ERROR_NONE;
-}
-       
-int email_get_synchronous_from_mailbox(emf_mailbox_t *mailbox, int *synchronous)
-{
-       if(!mailbox)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *synchronous = mailbox->synchronous;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_synchronous_to_mailbox(emf_mailbox_t *mailbox, int synchronous)
-{
-       if(!mailbox)
-               return EMF_ERROR_INVALID_PARAM;
-
-       mailbox->synchronous = synchronous;
-
-       return EMF_ERROR_NONE;
-}
-       
-int email_get_account_id_from_mailbox(emf_mailbox_t *mailbox, int *account_id)
-{
-       if(!mailbox)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *account_id = mailbox->account_id;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_account_id_to_mailbox(emf_mailbox_t *mailbox, int account_id)
-{
-       if(!mailbox)
-               return EMF_ERROR_INVALID_PARAM;
-
-       mailbox->account_id = account_id;
-
-       return EMF_ERROR_NONE;
-}
-       
-int email_get_user_data_from_mailbox(emf_mailbox_t *mailbox, void **user_data)
-{
-       if(!mailbox)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *user_data = mailbox->user_data;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_user_data_to_mailbox(emf_mailbox_t *mailbox, void *user_data)
-{
-       if(!mailbox)
-               return EMF_ERROR_INVALID_PARAM;
-
-       mailbox->user_data = user_data;
-
-       return EMF_ERROR_NONE;
-}
-       
-int email_get_mail_stream_from_mailbox(emf_mailbox_t *mailbox, void **mail_stream)
-{
-       if(!mailbox)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *mail_stream = mailbox->mail_stream;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_mail_stream_to_mailbox(emf_mailbox_t *mailbox, void *mail_stream)
-{
-       if(!mailbox)
-               return EMF_ERROR_INVALID_PARAM;
-
-       mailbox->mail_stream = mail_stream;
-
-       return EMF_ERROR_NONE;
-}
-       
-int email_get_has_archived_mails_from_mailbox(emf_mailbox_t *mailbox, int *has_archived_mails)
-{
-       if(!mailbox)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *has_archived_mails = mailbox->has_archived_mails;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_has_archived_mails_to_mailbox(emf_mailbox_t *mailbox, int has_archived_mails)
-{
-       if(!mailbox)
-               return EMF_ERROR_INVALID_PARAM;
-
-       mailbox->has_archived_mails = has_archived_mails;
-
-       return EMF_ERROR_NONE;
-}
-       
-int email_get_account_name_from_mailbox(emf_mailbox_t *mailbox, char **account_name)
-{
-       if(!mailbox)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *account_name = mailbox->account_name;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_account_name_to_mailbox(emf_mailbox_t *mailbox, char *account_name)
-{
-       if(!mailbox)
-               return EMF_ERROR_INVALID_PARAM;
-
-       mailbox->account_name= account_name;
-
-       return EMF_ERROR_NONE;
-}
-       
-int email_get_next_from_mailbox(emf_mailbox_t *mailbox, emf_mailbox_t **next)
-{
-       if(!mailbox)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *next = mailbox->next;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_next_to_mailbox(emf_mailbox_t *mailbox, emf_mailbox_t *next)
-{
-       if(!mailbox)
-               return EMF_ERROR_INVALID_PARAM;
-
-       mailbox->next= next;
-
-       return EMF_ERROR_NONE;
-}
-
-
-/*  emf_attachment_info_t------------------------------------------------------- */
-       
-int email_get_inline_content_from_attachment_info(emf_attachment_info_t *attachment_info, int *inline_content)
-{
-       if(!attachment_info)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *inline_content = attachment_info->inline_content;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_inline_content_to_attachment_info(emf_attachment_info_t *attachment_info, int inline_content)
-{
-       if(!attachment_info)
-               return EMF_ERROR_INVALID_PARAM;
-
-       attachment_info->inline_content= inline_content;
-
-       return EMF_ERROR_NONE;
-}
-       
-int email_get_attachment_id_from_attachment_info(emf_attachment_info_t *attachment_info, int *attachment_id)
-{
-       if(!attachment_info)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *attachment_id = attachment_info->attachment_id;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_attachment_id_to_attachment_info(emf_attachment_info_t *attachment_info, int attachment_id)
-{
-       if(!attachment_info)
-               return EMF_ERROR_INVALID_PARAM;
-
-       attachment_info->attachment_id= attachment_id;
-
-       return EMF_ERROR_NONE;
-}
-       
-int email_get_name_from_attachment_info(emf_attachment_info_t *attachment_info, char **name)
-{
-       if(!attachment_info)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *name = attachment_info->name;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_name_to_attachment_info(emf_attachment_info_t *attachment_info, char *name)
-{
-       if(!attachment_info)
-               return EMF_ERROR_INVALID_PARAM;
-
-       attachment_info->name= name;
-
-       return EMF_ERROR_NONE;
-}
-       
-int email_get_size_from_attachment_info(emf_attachment_info_t *attachment_info, int *size)
-{
-       if(!attachment_info)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *size = attachment_info->size;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_size_to_attachment_info(emf_attachment_info_t *attachment_info, int size)
-{
-       if(!attachment_info)
-               return EMF_ERROR_INVALID_PARAM;
-
-       attachment_info->size= size;
-
-       return EMF_ERROR_NONE;
-}
-       
-int email_get_downloaded_from_attachment_info(emf_attachment_info_t *attachment_info, int *downloaded)
-{
-       if(!attachment_info)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *downloaded = attachment_info->downloaded;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_downloaded_to_attachment_info(emf_attachment_info_t *attachment_info, int downloaded)
-{
-       if(!attachment_info)
-               return EMF_ERROR_INVALID_PARAM;
-
-       attachment_info->downloaded= downloaded;
-
-       return EMF_ERROR_NONE;
-}
-       
-int email_get_savename_from_attachment_info(emf_attachment_info_t *attachment_info, char **savename)
-{
-       if(!attachment_info)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *savename = attachment_info->savename;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_savename_to_attachment_info(emf_attachment_info_t *attachment_info, char *savename)
-{
-       if(!attachment_info)
-               return EMF_ERROR_INVALID_PARAM;
-
-       attachment_info->savename= savename;
-
-       return EMF_ERROR_NONE;
-}
-       
-int email_get_drm_from_attachment_info(emf_attachment_info_t *attachment_info, int *drm)
-{
-       if(!attachment_info)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *drm = attachment_info->drm;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_drm_to_attachment_info(emf_attachment_info_t *attachment_info, int drm)
-{
-       if(!attachment_info)
-               return EMF_ERROR_INVALID_PARAM;
-
-       attachment_info->drm= drm;
-
-       return EMF_ERROR_NONE;
-}
-       
-int email_get_next_from_attachment_info(emf_attachment_info_t *attachment_info, emf_attachment_info_t **next) 
-{
-       if(!attachment_info)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *next = attachment_info->next;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_next_to_attachment_info(emf_attachment_info_t *attachment_info, emf_attachment_info_t *next) 
-{
-       if(!attachment_info)
-               return EMF_ERROR_INVALID_PARAM;
-
-       attachment_info->next= next;
-
-       return EMF_ERROR_NONE;
-}
-
-/*  emf_option_t---------------------------------------------------------------- */
-       
-int email_get_priority_from_option(emf_option_t *option, int *priority)
-{
-       if(!option)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *priority = option->priority;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_priority_to_option(emf_option_t *option, int priority)
-{
-       if(!option)
-               return EMF_ERROR_INVALID_PARAM;
-
-       option->priority= priority;
-
-       return EMF_ERROR_NONE;
-}
-       
-int email_get_keep_local_copy_from_option(emf_option_t *option, int *keep_local_copy)
-{
-       if(!option)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *keep_local_copy = option->keep_local_copy;
-
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_keep_local_copy_to_option(emf_option_t *option, int keep_local_copy)
-{
-       if(!option)
-               return EMF_ERROR_INVALID_PARAM;
-
-       option->keep_local_copy= keep_local_copy;
-
-       return EMF_ERROR_NONE;
-}
-       
-int email_get_req_delivery_receipt_from_option(emf_option_t *option, int *req_delivery_receipt)
-{
-       if(!option)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *req_delivery_receipt = option->req_delivery_receipt;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_req_delivery_receipt_to_option(emf_option_t *option, int req_delivery_receipt)
-{
-       if(!option)
-               return EMF_ERROR_INVALID_PARAM;
-
-       option->req_delivery_receipt= req_delivery_receipt;
-
-       return EMF_ERROR_NONE;
-}
-       
-int email_get_req_read_receipt_from_option(emf_option_t *option, int *req_read_receipt)
-{
-       if(!option)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *req_read_receipt = option->req_read_receipt;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_req_read_receipt_to_option(emf_option_t *option, int req_read_receipt)
-{
-       if(!option)
-               return EMF_ERROR_INVALID_PARAM;
-
-       option->req_read_receipt = req_read_receipt;
-
-       return EMF_ERROR_NONE;
-}
-       
-int email_get_download_limit_from_option(emf_option_t *option, int *download_limit)
-{
-       if(!option)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *download_limit = option->download_limit;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_download_limit_to_option(emf_option_t *option, int download_limit)
-{
-       if(!option)
-               return EMF_ERROR_INVALID_PARAM;
-
-       option->download_limit = download_limit;
-
-
-       return EMF_ERROR_NONE;
-}
-       
-int email_get_block_address_from_option(emf_option_t *option, int *block_address)
-{
-       if(!option)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *block_address = option->block_address;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_block_address_to_option(emf_option_t *option, int block_address)
-{
-       if(!option)
-               return EMF_ERROR_INVALID_PARAM;
-
-       option->block_address = block_address;
-
-       return EMF_ERROR_NONE;
-}
-       
-int email_get_block_subject_from_option(emf_option_t *option, int *block_subject)
-{
-       if(!option)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *block_subject = option->block_subject;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_block_subject_to_option(emf_option_t *option, int block_subject)
-{
-       if(!option)
-               return EMF_ERROR_INVALID_PARAM;
-
-       option->block_subject = block_subject;
-
-       return EMF_ERROR_NONE;
-}
-       
-int email_get_display_name_from_from_option(emf_option_t *option, char **display_name_from)
-{
-       if(!option)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *display_name_from = option->display_name_from;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_display_name_from_to_option(emf_option_t *option, char *display_name_from)
-{
-       if(!option)
-               return EMF_ERROR_INVALID_PARAM;
-
-       option->display_name_from = display_name_from;
-
-       return EMF_ERROR_NONE;
-}
-       
-int email_get_reply_with_body_from_option(emf_option_t *option, int *reply_with_body)
-{
-       if(!option)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *reply_with_body = option->reply_with_body;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_reply_with_body_to_option(emf_option_t *option, int reply_with_body)
-{
-       if(!option)
-               return EMF_ERROR_INVALID_PARAM;
-
-       option->reply_with_body = reply_with_body;
-
-       return EMF_ERROR_NONE;
-}
-       
-int email_get_forward_with_files_from_option(emf_option_t *option, int *forward_with_files)
-{
-       if(!option)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *forward_with_files = option->forward_with_files;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_forward_with_files_to_option(emf_option_t *option, int forward_with_files)
-{
-       if(!option)
-               return EMF_ERROR_INVALID_PARAM;
-
-       option->forward_with_files = forward_with_files;
-
-       return EMF_ERROR_NONE;
-}
-       
-int email_get_add_myname_card_from_option(emf_option_t *option, int *add_myname_card)
-{
-       if(!option)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *add_myname_card = option->add_myname_card;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_add_myname_card_to_option(emf_option_t *option, int add_myname_card)
-{
-       if(!option)
-               return EMF_ERROR_INVALID_PARAM;
-
-       option->add_myname_card = add_myname_card;
-
-       return EMF_ERROR_NONE;
-}
-       
-int email_get_add_signature_from_option(emf_option_t *option, int *add_signature)
-{
-       if(!option)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *add_signature = option->add_signature;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_add_signature_to_option(emf_option_t *option, int add_signature)
-{
-       if(!option)
-               return EMF_ERROR_INVALID_PARAM;
-
-       option->add_signature = add_signature;
-
-       return EMF_ERROR_NONE;
-}
-       
-int email_get_signature_from_option(emf_option_t *option, char **signature)
-{
-       if(!option)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *signature = option->signature;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_signature_to_option(emf_option_t *option, char *signature)
-{
-       if(!option)
-               return EMF_ERROR_INVALID_PARAM;
-
-       option->signature = signature;
-
-       return EMF_ERROR_NONE;
-}
-
-/*  emf_rule_t------------------------------------------------------------------- */
-int email_get_account_id_from_rule(emf_rule_t *rule, int *account_id)
-{
-       if(!rule)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *account_id = rule->account_id;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_account_id_to_rule(emf_rule_t *rule, int account_id)
-{
-       if(!rule)
-               return EMF_ERROR_INVALID_PARAM;
-
-       rule->account_id = account_id;
-
-       return EMF_ERROR_NONE;
-}
-       
-int email_get_filter_id_from_rule(emf_rule_t *rule, int *filter_id)
-{
-       if(!rule)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *filter_id = rule->filter_id;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_filter_id_to_rule(emf_rule_t *rule, int filter_id)
-{
-       if(!rule)
-               return EMF_ERROR_INVALID_PARAM;
-
-       rule->filter_id = filter_id;
-
-       return EMF_ERROR_NONE;
-}
-       
-int email_get_type_from_rule(emf_rule_t *rule, emf_rule_type_t type)
-{
-       if(!rule)
-               return EMF_ERROR_INVALID_PARAM;
-
-       type = rule->type;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_type_to_rule(emf_rule_t *rule, emf_rule_type_t type)
-{
-       if(!rule)
-               return EMF_ERROR_INVALID_PARAM;
-
-       rule->type = type;
-
-       return EMF_ERROR_NONE;
-}
-       
-int email_get_value_from_rule(emf_rule_t *rule, char **value)
-{
-       if(!rule)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *value = rule->value;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_value_to_rule(emf_rule_t *rule, char *value)
-{
-       if(!rule)
-               return EMF_ERROR_INVALID_PARAM;
-
-       rule->value = value;
-
-       return EMF_ERROR_NONE;
-}
-       
-int email_get_action_from_rule(emf_rule_t *rule, emf_rule_action_t action)
-{
-       if(!rule)
-               return EMF_ERROR_INVALID_PARAM;
-
-       action = rule->faction;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_action_to_rule(emf_rule_t *rule, emf_rule_action_t action)
-{
-       if(!rule)
-               return EMF_ERROR_INVALID_PARAM;
-
-       rule->faction = action;
-
-       return EMF_ERROR_NONE;
-}
-       
-int email_get_flag1_from_rule(emf_rule_t *rule, int *flag1)
-{
-       if(!rule)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *flag1 = rule->flag1;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_flag1_to_rule(emf_rule_t *rule, int flag1)
-{
-       if(!rule)
-               return EMF_ERROR_INVALID_PARAM;
-
-       rule->flag1 = flag1;
-
-       return EMF_ERROR_NONE;
-}
-       
-int email_get_flag2_from_rule(emf_rule_t *rule, int *flag2)
-{
-       if(!rule)
-               return EMF_ERROR_INVALID_PARAM;
-
-       *flag2 = rule->flag2;
-
-       return EMF_ERROR_NONE;
-}
-
-int email_set_flag2_to_rule(emf_rule_t *rule, int flag2)
-{
-       if(!rule)
-               return EMF_ERROR_INVALID_PARAM;
-
-       rule->flag2 = flag2;
-
-       return EMF_ERROR_NONE;
-}
-
-
-
diff --git a/MAPI/include/Emf_Mapi.h b/MAPI/include/Emf_Mapi.h
deleted file mode 100755 (executable)
index 414678b..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-#ifndef __EMF_MAPI_H__
-#define __EMF_MAPI_H__
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "Emf_Mapi_Account.h"
-#include "Emf_Mapi_Message.h"
-#include "Emf_Mapi_Rule.h"
-#include "Emf_Mapi_Mailbox.h"
-#include "Emf_Mapi_Network.h"
-#include "Emf_Mapi_Init.h"
-
-/**
-* @defgroup EMAIL_FRAMEWORK Email Service
-* @{
-*/
-
-/**
-* @{
-*/
-
-/**
- *
- * This file contains the data structures and interfaces needed for application,
- * to interact with Email Engine.
- * @file               Emf_Mapi.h
- * @author     Kyuho Jo <kyuho.jo@samsung.com>
- * @author     Sunghyun Kwon <sh0701.kwon@samsung.com>
- * @version    0.1
- * @brief              This file contains the data structures and interfaces provided by 
- *                     Email Engine. 
- */
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-
-enum {
-       //Account 
-       _EMAIL_API_ADD_ACCOUNT                             = 0x01000000,
-       _EMAIL_API_DELETE_ACCOUNT                          = 0x01000001,
-       _EMAIL_API_UPDATE_ACCOUNT                          = 0x01000002,
-       _EMAIL_API_GET_ACCOUNT                             = 0x01000003,
-       _EMAIL_API_GET_ACCOUNT_LIST                        = 0x01000005,
-       _EMAIL_API_GET_MAILBOX_COUNT                       = 0x01000007,
-       _EMAIL_API_VALIDATE_ACCOUNT                        = 0x01000008,
-       _EMAIL_API_ADD_ACCOUNT_WITH_VALIDATION             = 0x01000009,
-       _EMAIL_API_BACKUP_ACCOUNTS                         = 0x0100000A,
-       _EMAIL_API_RESTORE_ACCOUNTS                        = 0x0100000B,
-       _EMAIL_API_GET_PASSWORD_LENGTH_OF_ACCOUNT          = 0x0100000C,
-
-       //Message
-       _EMAIL_API_ADD_MAIL_OLD                            = 0x01100000, /* Deprecated */
-       _EMAIL_API_GET_MAIL                                = 0x01100001,
-       _EMAIL_API_DELETE_MAIL                             = 0x01100002,
-       _EMAIL_API_UPDATE_MAIL_OLD                         = 0x01100003, /* Deprecated */
-       _EMAIL_API_DELETE_ALL_MAIL                         = 0x01100004,
-       _EMAIL_API_GET_MAILBOX_LIST                        = 0x01100006,
-       _EMAIL_API_GET_SUBMAILBOX_LIST                     = 0x01100007, 
-       _EMAIL_API_CLEAR_DATA                              = 0x01100009,
-       _EMAIL_API_MOVE_MAIL                               = 0x0110000A,
-       _EMAIL_API_MOVE_ALL_MAIL                           = 0x0110000B,
-       _EMAIL_API_ADD_ATTACHMENT                          = 0x0110000C,
-       _EMAIL_API_GET_ATTACHMENT                          = 0x0110000D,
-       _EMAIL_API_DELETE_ATTACHMENT                       = 0x0110000E,
-       _EMAIL_API_MODIFY_MAIL_FLAG                        = 0x0110000F,
-       _EMAIL_API_MODIFY_SEEN_MAIL_FLAG                   = 0x01100010, /* Deprecated */
-       _EMAIL_API_MODIFY_MAIL_EXTRA_FLAG                  = 0x01100011,
-       _EMAIL_API_GET_INFO                                = 0x01100012,
-       _EMAIL_API_GET_HEADER_INFO                         = 0x01100013,
-       _EMAIL_API_GET_BODY_INFO                           = 0x01100014,
-       _EMAIL_API_SET_FLAGS_FIELD                         = 0x01100016,
-       _EMAIL_API_ADD_MAIL                                = 0x01100017, 
-       _EMAIL_API_UPDATE_MAIL                             = 0x01100018,
-
-       // Thread
-       _EMAIL_API_MOVE_THREAD_TO_MAILBOX                  = 0x01110000,
-       _EMAIL_API_DELETE_THREAD                           = 0x01110001,
-       _EMAIL_API_MODIFY_SEEN_FLAG_OF_THREAD              = 0x01110002,
-
-       //mailbox
-       _EMAIL_API_ADD_MAILBOX                             = 0x01200000,
-       _EMAIL_API_DELETE_MAILBOX                          = 0x01200001,
-       _EMAIL_API_UPDATE_MAILBOX                          = 0x01200002,
-       _EMAIL_API_SET_MAIL_SLOT_SIZE                      = 0x01200007,
-
-       //Network
-       _EMAIL_API_SEND_MAIL                               = 0x01300000,
-       _EMAIL_API_SYNC_HEADER                             = 0x01300001,
-       _EMAIL_API_DOWNLOAD_BODY                           = 0x01300002,
-       _EMAIL_API_DOWNLOAD_ATTACHMENT                     = 0x01300003,
-       _EMAIL_API_NETWORK_GET_STATUS                      = 0x01300004,
-       _EMAIL_API_MAIL_SEND_SAVED                         = 0x01300005,
-       _EMAIL_API_MAIL_SEND_REPORT                        = 0x01300006,
-       _EMAIL_API_DELETE_EMAIL                            = 0x01300007,
-       _EMAIL_API_DELETE_EMAIL_ALL                        = 0x01300008,
-       _EMAIL_API_GET_IMAP_MAILBOX_LIST                   = 0x01300015,
-       _EMAIL_API_SEND_MAIL_CANCEL_JOB                    = 0x01300017, 
-       _EMAIL_API_FIND_MAIL_ON_SERVER                     = 0x01300019,
-
-       //Rule
-       _EMAIL_API_ADD_RULE                                = 0x01400000,
-       _EMAIL_API_GET_RULE                                = 0x01400001,
-       _EMAIL_API_GET_RULE_LIST                           = 0x01400002,
-       _EMAIL_API_FIND_RULE                               = 0x01400003,
-       _EMAIL_API_DELETE_RULE                             = 0x01400004,
-       _EMAIL_API_UPDATE_RULE                             = 0x01400005,
-       _EMAIL_API_CANCEL_JOB                              = 0x01400006,
-       _EMAIL_API_GET_PENDING_JOB                         = 0x01400007,
-       _EMAIL_API_SEND_RETRY                              = 0x01400008,
-       _EMAIL_API_UPDATE_ACTIVITY                         = 0x01400009,
-       _EMAIL_API_SYNC_LOCAL_ACTIVITY                     = 0x0140000A,
-       _EMAIL_API_PRINT_RECEIVING_EVENT_QUEUE             = 0x0140000B,
-
-       //Etc
-       _EMAIL_API_PING_SERVICE                            = 0x01500000,
-       _EMAIL_API_UPDATE_NOTIFICATION_BAR_FOR_UNREAD_MAIL = 0x01500001, 
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-/**
-* @} @}
-*/
-
-#endif /* __EMAIL_MAPI_H__ */
-
-
diff --git a/MAPI/include/Emf_Mapi_Types.h b/MAPI/include/Emf_Mapi_Types.h
deleted file mode 100755 (executable)
index 52bb148..0000000
+++ /dev/null
@@ -1,873 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-#ifndef __EMF_MAPI_TYPES_H__
-#define __EMF_MAPI_TYPES_H__
-
-#include "emf-types.h"
-
-/**
-* @defgroup EMAIL_FRAMEWORK Email Service
-* @{
-*/
-
-/**
-* @ingroup EMAIL_FRAMEWORK
-* @defgroup EMAIL_MAPI_TYPES Email Types API
-* @{
-*/
-
-
-/**
- *
- * This file contains the data structures and interfaces needed for application,
- * to interact with Email Engine.
- * @file               Emf_Mapi_Types.h
- * @author     Kyuho Jo <kyuho.jo@samsung.com>
- * @author     Sunghyun Kwon <sh0701.kwon@samsung.com>
- * @version    0.1
- * @brief      This file contains interfaces for using data structures of email-service . 
- */
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-// emf_mail_t ------------------------------------------------------------------
-/**
- * @open
- * @fn  email_get_info_from_mail(emf_mail_t *mail, emf_mail_info_t **info)
- * @brief      Gets the object of emf_mail_info_t. If mail is NULL,  this returns EMF_ERROR_INVALID_PARAM. <br>
- *                     This function doesn't allocate new memory for info object, but just returns the pointer to the emf_mail_info_t object in mail object.
- *                     The info objet will be freed together with mail , when mail is freed by calling email_free_mail()
- *                     So don't free info object itself if it is the object in mail object.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] mail     Specifies the pointer to emf_mail_t. This contains emf_mail_info_t object.
- * @param[out] info    Specifies the pointer to emf_mail_info_t. The info will point the info object in emf_mail_t(mail)
- * @exception          none
- * @see                 emf_mail_t, emf_mail_info_t    
- */
-EXPORT_API int email_get_info_from_mail(emf_mail_t *mail, emf_mail_info_t **info) DEPRECATED;
-
-/**
- * @open
- * @fn  email_set_info_to_mail(emf_mail_t *mail, emf_mail_info_t *info)
- * @brief      Sets the object of emf_mail_info_t to emf_mail_obejct(mail). If mail is NULL,  this returns EMF_ERROR_INVALID_PARAM. 
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] mail     Specifies the pointer to emf_mail_t.
- * @param[in] info     Specifies the pointer to emf_mail_info_t.
- * @exception          none
- * @see                 emf_mail_t, emf_mail_info_t    
- */
-EXPORT_API int email_set_info_to_mail(emf_mail_t *mail, emf_mail_info_t *info) DEPRECATED;
-
-/**
- * @open
- * @fn  email_get_head_from_mail(emf_mail_t *mail, emf_mail_head_t **head)
- * @brief      Gets the object of emf_mail_head_t. If mail is NULL,  this returns EMF_ERROR_INVALID_PARAM. <br>
- *                     This function doesn't allocate new memory for head object, but just returns the pointer to the emf_mail_head_t object in mail object.
- *                     The head objet will be freed together with mail , when mail is freed by calling email_free_mail()
- *                     So don't free head object if it is the object in mail object.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] mail     Specifies the pointer to emf_mail_t. This contains emf_mail_head_t object.
- * @param[out] head    Specifies the pointer to emf_mail_head_t. This  will point the head object in emf_mail_t(mail).
- * @exception          none
- * @see                 emf_mail_t, emf_mail_head_t    
- */
-EXPORT_API int email_get_head_from_mail(emf_mail_t *mail, emf_mail_head_t **head) DEPRECATED;
-
-/**
- * @open
- * @fn  email_set_head_to_mail(emf_mail_t *mail, emf_mail_head_t *head)
- * @brief      Sets the object of emf_mail_head_t to emf_mail_obejct(mail). If mail is NULL,  this returns EMF_ERROR_INVALID_PARAM. 
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] mail     Specifies the pointer to emf_mail_t.
- * @param[in] head     Specifies the pointer to emf_mail_head_t.
- * @exception          none
- * @see                 emf_mail_t, emf_mail_head_t    
- */
-EXPORT_API int email_set_head_to_mail(emf_mail_t *mail, emf_mail_head_t *head) DEPRECATED;
-
-/**
- * @open
- * @fn  email_get_body_from_mail(emf_mail_t *mail, emf_mail_body_t **body)
- * @brief      Gets the object of emf_mail_body_t. If mail is NULL,  this returns EMF_ERROR_INVALID_PARAM. <br>
- *                     This function doesn't allocate new memory for emf_mail_body_t object, but just returns the pointer to the emf_mail_body_t object in mail object.
- *                     The body objet will be freed together with mail , when mail is freed by calling email_free_mail()
- *                     So don't free body object if it is the object in mail object.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] mail     Specifies the pointer to emf_mail_t. This contains emf_mail_body_t object.
- * @param[out] body    Specifies the pointer to emf_mail_body_t. This will point the object in emf_mail_t(mail)
- * @exception          none
- * @see                 emf_mail_t, emf_mail_body_t    
- */
-EXPORT_API int email_get_body_from_mail(emf_mail_t *mail, emf_mail_body_t **body) DEPRECATED;
-
-/**
- * @open
- * @fn  email_set_body_to_mail(emf_mail_t *mail, emf_mail_body_t *body)
- * @brief      Sets the object of emf_mail_body_t to emf_mail_obejct(mail). If mail is NULL,  this returns EMF_ERROR_INVALID_PARAM. 
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] mail     Specifies the pointer to emf_mail_t.
- * @param[in] body     Specifies the pointer to emf_mail_body_t.
- * @exception          none
- * @see                 emf_mail_t, emf_mail_head_t    
- */
-EXPORT_API int email_set_body_to_mail(emf_mail_t *mail, emf_mail_body_t *body) DEPRECATED;
-
-// emf_mail_info_t -------------------------------------------------------------
-/**
- * @open
- * @fn  email_get_account_id_from_info(emf_mail_info_t *info, int *account_id)
- * @brief      Gets account id from the info object . If info is NULL,  this returns EMF_ERROR_INVALID_PARAM. <br>
- *                     This function doesn't allocate new memory for account id. but just returns account id in info object.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] info     Specifies the pointer to emf_mail_info_t. 
- * @param[out] account_id      Specifies the pointer to the memory to save account id
- * @exception          none
- * @see                 emf_mail_info_t        
- */
-EXPORT_API int email_get_account_id_from_info(emf_mail_info_t *info, int *account_id) DEPRECATED;
-
-/**
- * @open
- * @fn  email_set_account_id_to_info(emf_mail_info_t *info, int account_id)
- * @brief      Sets account id to emf_mail_info_t(info). If info is NULL,  this returns EMF_ERROR_INVALID_PARAM. 
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] info     Specifies the pointer to emf_mail_info_t.
- * @param[in] account_id       Specifies the account id.
- * @exception          none
- * @see                 emf_mail_info_t        
- */
-EXPORT_API int email_set_account_id_to_info(emf_mail_info_t *info, int account_id) DEPRECATED;
-
-/**
- * @open
- * @fn  email_get_uid_from_info(emf_mail_info_t *info, int *uid)
- * @brief      Gets uid from the info object . If info is NULL,  this returns EMF_ERROR_INVALID_PARAM. <br>
- *                     This function doesn't allocate new memory for uid, but just returns uid in info object.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] info     Specifies the pointer to emf_mail_info_t. 
- * @param[out] uid     Specifies the pointer to the memory to save uid
- * @exception          none
- * @see                 emf_mail_info_t        
- */
-EXPORT_API int email_get_uid_from_info(emf_mail_info_t *info, int *uid) DEPRECATED;
-
-/**
- * @open
- * @fn  email_set_uid_to_info(emf_mail_info_t *info, int uid)
- * @brief      Sets uid to emf_mail_info_t(info). If info is NULL,  this returns EMF_ERROR_INVALID_PARAM. 
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] info     Specifies the pointer to emf_mail_info_t.
- * @param[in] uid      Specifies the uid.
- * @exception          none
- * @see                 emf_mail_info_t        
- */
-EXPORT_API int email_set_uid_to_info(emf_mail_info_t *info, int uid) DEPRECATED;
-
-/**
- * @open
- * @fn  email_get_rfc822_size_from_info(emf_mail_info_t *info, int *rfc822_size)
- * @brief      Gets rfc822 size from the info object . If info is NULL,  this returns EMF_ERROR_INVALID_PARAM. <br>
- *                     This function doesn't allocate new memory for rfc822 size, but just returns rfc822 size in info object.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] info     Specifies the pointer to emf_mail_info_t. 
- * @param[out] rfc822_size     Specifies the pointer to the memory to save rfc822 size
- * @exception          none
- * @see                 emf_mail_info_t        
- */
-EXPORT_API int email_get_rfc822_size_from_info(emf_mail_info_t *info, int *rfc822_size) DEPRECATED;
-
-/**
- * @open
- * @fn  email_set_rfc822_size_to_info(emf_mail_info_t *info, int rfc822_size)
- * @brief      Sets rfc822 size to emf_mail_info_t(info). If info is NULL,  this returns EMF_ERROR_INVALID_PARAM. 
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] info     Specifies the pointer to emf_mail_info_t.
- * @param[in] rfc822_size      Specifies a rfc822 size.
- * @exception          none
- * @see                 emf_mail_info_t        
- */
-EXPORT_API int email_set_rfc822_size_to_info(emf_mail_info_t *info, int rfc822_size) DEPRECATED;
-
-/**
- * @open
- * @fn  email_get_body_downloaded_from_info(emf_mail_info_t *info, int *body_downloaded)
- * @brief      Gets whether body is downloaded  from the info object . If info is NULL,  this returns EMF_ERROR_INVALID_PARAM. <br>
- *                     This function doesn't allocate new memory for body_downloaded, but just returns whether body is downloaded in info object.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] info     Specifies the pointer to emf_mail_info_t. 
- * @param[out] body_downloaded Specifies the pointer to the memory to save whether body is downlaoded.
- * @exception          none
- * @see                 emf_mail_info_t        
- */
-EXPORT_API int email_get_body_downloaded_from_info(emf_mail_info_t *info, int *body_downloaded) DEPRECATED;
-
-/**
- * @open
- * @fn  email_set_body_downloaded_to_info(emf_mail_info_t *info, int body_downloaded)
- * @brief      Sets the field which shows whether body is downloaded to emf_mail_info_t(info). If info is NULL,  this returns EMF_ERROR_INVALID_PARAM. 
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] info     Specifies the pointer to emf_mail_info_t.
- * @param[in] body_downloaded  Specifies whether body is downloaded (0:no, 1:yes)
- * @exception          none
- * @see                 emf_mail_info_t        
- */
-EXPORT_API int email_set_body_downloaded_to_info(emf_mail_info_t *info, int body_downloaded) DEPRECATED;
-
-/**
- * @open
- * @fn  email_get_flags_from_info(emf_mail_info_t *info, emf_mail_flag_t flags)
- * @brief      Gets flags from the info object . If info is NULL,  this returns EMF_ERROR_INVALID_PARAM. <br>
- *                     This function doesn't allocate new memory for flags, but just returns flags in info object.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] info     Specifies the pointer to emf_mail_info_t. 
- * @param[out] flags   Specifies the pointer to the memory to save flags
- * @exception          none
- * @see                 emf_mail_info_t, emf_mail_flag_t
- */
-EXPORT_API int email_get_flags_from_info(emf_mail_info_t *info, emf_mail_flag_t *flags) DEPRECATED;
-
-
-/**
- * @open
- * @fn  email_set_flags_to_info(emf_mail_info_t *info, emf_mail_flag_t flags)
- * @brief      Sets flags to emf_mail_info_t(info). If info is NULL,  this returns EMF_ERROR_INVALID_PARAM. 
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] info     Specifies the pointer to emf_mail_info_t.
- * @param[in] flags    Specifies the flags.
- * @exception          none
- * @see                 emf_mail_info_t, emf_mail_flag_t       
- */
-EXPORT_API int email_set_flags_to_info(emf_mail_info_t *info, emf_mail_flag_t flags) DEPRECATED;
-
-/**
- * @open
- * @fn  email_get_extra_flags_from_info(emf_mail_info_t *info, emf_extra_flag_t extra_flags)
- * @brief      Gets extra flags from the info object . If info is NULL,  this returns EMF_ERROR_INVALID_PARAM. <br>
- *                     This function doesn't allocate new memory for extra  flags, but just returns extra flags in info object.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] info     Specifies the pointer to emf_mail_info_t. 
- * @param[out] extra_flags     Specifies the pointer to the memory to save extra_flags
- * @exception          none
- * @see                 emf_mail_info_t, emf_extra_flag_t
- */
-EXPORT_API int email_get_extra_flags_from_info(emf_mail_info_t *info, emf_extra_flag_t extra_flags) DEPRECATED;
-
-/**
- * @open
- * @fn  email_set_extra_flags_to_info(emf_mail_info_t *info, emf_extra_flag_t extra_flags)
- * @brief      Sets extra flags to emf_mail_info_t(info). If info is NULL,  this returns EMF_ERROR_INVALID_PARAM. 
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] info     Specifies the pointer to emf_mail_info_t.
- * @param[in] extra_flags      Specifies the extra flags.
- * @exception          none
- * @see                 emf_mail_info_t, emf_extra_flag_t      
- */
-EXPORT_API int email_set_extra_flags_to_info(emf_mail_info_t *info, emf_extra_flag_t extra_flags) DEPRECATED;
-
-/**
- * @open
- * @fn  email_get_sid_from_info(emf_mail_info_t *info, char **sid)
- * @brief      Gets sid(the email's UID on server) from the info object . If info is NULL,  this returns EMF_ERROR_INVALID_PARAM. <br>
- *                     This function doesn't allocate new memory for sid, but just returns sid in info object.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] info     Specifies the pointer to emf_mail_info_t. 
- * @param[out] sid     Specifies the pointer to the memory to save sid
- * @exception          none
- * @see                 emf_mail_info_t
- */
-EXPORT_API int email_get_sid_from_info(emf_mail_info_t *info, char **sid) DEPRECATED;
-
-/**
- * @open
- * @fn  email_set_extra_flags_to_info(emf_mail_info_t *info, emf_extra_flag_t extra_flags)
- * @brief      Sets sid(the email's UID on server)  to emf_mail_info_t(info). If info is NULL,  this returns EMF_ERROR_INVALID_PARAM. 
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] info     Specifies the pointer to emf_mail_info_t.
- * @param[in] sid              Specifies the extra flags.
- * @exception          none
- * @see                 emf_mail_info_t
- */
-EXPORT_API int email_set_sid_to_info(emf_mail_info_t *info, char *sid) DEPRECATED;
-
-
-// emf_mail_head_t -------------------------------------------------------------
-/**
- * @open
- * @fn  email_get_mid_from_head(emf_mail_head_t *head, char **mid)
- * @brief      Gets mid(the message ID) from the head object . If head is NULL,  this returns EMF_ERROR_INVALID_PARAM. <br>
- *                     This function doesn't allocate new memory for mid but just returns mid in head object.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] head     Specifies the pointer to emf_mail_head_t. 
- * @param[out] mid     Specifies the pointer to the memory to save mid
- * @exception          none
- * @see                 emf_mail_head_t
- */
-EXPORT_API int email_get_mid_from_head(emf_mail_head_t *head, char **mid) DEPRECATED;
-
-/**
- * @open
- * @fn  email_set_mid_to_head(emf_mail_head_t *head, char *mid)
- * @brief      Sets  mid(the message ID)  to emf_mail_head_t(head). If head is NULL,  this returns EMF_ERROR_INVALID_PARAM. 
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] head     Specifies the pointer to emf_mail_head_t.
- * @param[in] mid              Specifies the mid(the message ID).
- * @exception          none
- * @see                 emf_mail_head_t
- */
-EXPORT_API int email_set_mid_to_head(emf_mail_head_t *head, char *mid) DEPRECATED;
-
-/**
- * @open
- * @fn  email_get_subject_from_head(emf_mail_head_t *head, char **subject)
- * @brief      Gets subject of a mail from the head object . If head is NULL,  this returns EMF_ERROR_INVALID_PARAM. <br>
- *                     This function doesn't allocate new memory for subject but just returns subject in head object.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] head     Specifies the pointer to emf_mail_head_t. 
- * @param[out] subject Specifies the pointer to the memory to save subject
- * @exception          none
- * @see                 emf_mail_head_t
- */
-EXPORT_API int email_get_subject_from_head(emf_mail_head_t *head, char **subject) DEPRECATED;
-
-/**
- * @open
- * @fn  email_set_subject_to_head(emf_mail_head_t *head, char *subject)
- * @brief      Sets  subject of a mail  to emf_mail_head_t(head). If head is NULL,  this returns EMF_ERROR_INVALID_PARAM. 
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] head     Specifies the pointer to emf_mail_head_t.
- * @param[in] subject          Specifies the subject.
- * @exception          none
- * @see                 emf_mail_head_t
- */
-EXPORT_API int email_set_subject_to_head(emf_mail_head_t *head, char *subject) DEPRECATED;
-
-/**
- * @open
- * @fn  email_get_to_from_head(emf_mail_head_t *head, char **to)
- * @brief      Gets to field of a mail from the head object . If head is NULL,  this returns EMF_ERROR_INVALID_PARAM. <br>
- *                     This function doesn't allocate new memory for to field but just returns to field in head object.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] head     Specifies the pointer to emf_mail_head_t. 
- * @param[out] to      Specifies the pointer to the memory to save to field
- * @exception          none
- * @see                 emf_mail_head_t
- */
-EXPORT_API int email_get_to_from_head(emf_mail_head_t *head, char **to) DEPRECATED;
-
-/**
- * @open
- * @fn  email_set_to_to_head(emf_mail_head_t *head, char *to)
- * @brief      Sets  to field of a mail  to emf_mail_head_t(head). If head is NULL,  this returns EMF_ERROR_INVALID_PARAM. 
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] head     Specifies the pointer to emf_mail_head_t.
- * @param[in] to               Specifies the to field of a mail.
- * @exception          none
- * @see                 emf_mail_head_t
- */
-EXPORT_API int email_set_to_to_head(emf_mail_head_t *head, char *to) DEPRECATED;
-
-/**
- * @open
- * @fn  email_get_from_from_head(emf_mail_head_t *head, char **from)
- * @brief      Gets from field of a mail from the head object . If head is NULL,  this returns EMF_ERROR_INVALID_PARAM. <br>
- *                     This function doesn't allocate new memory for from field but just returns from field in head object.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] head     Specifies the pointer to emf_mail_head_t. 
- * @param[out] from    Specifies the pointer to the memory to save from field
- * @exception          none
- * @see                 emf_mail_head_t
- */
-EXPORT_API int email_get_from_from_head(emf_mail_head_t *head, char **from) DEPRECATED;
-
-/**
- * @open
- * @fn  email_set_from_to_head(emf_mail_head_t *head, char *from)
- * @brief      Sets  from field of a mail  to emf_mail_head_t(head). If head is NULL,  this returns EMF_ERROR_INVALID_PARAM. 
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] head     Specifies the pointer to emf_mail_head_t.
- * @param[in] from             Specifies the from field of a mail.
- * @exception          none
- * @see                 emf_mail_head_t
- */
-EXPORT_API int email_set_from_to_head(emf_mail_head_t *head, char *from) DEPRECATED;
-
-/**
- * @open
- * @fn  email_get_cc_from_head(emf_mail_head_t *head, char **cc)
- * @brief      Gets cc field of a mail from the head object . If head is NULL,  this returns EMF_ERROR_INVALID_PARAM. <br>
- *                     This function doesn't allocate new memory for cc field but just returns cc field in head object.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] head     Specifies the pointer to emf_mail_head_t. 
- * @param[out] cc      Specifies the pointer to the memory to save cc field
- * @exception          none
- * @see                 emf_mail_head_t
- */
-EXPORT_API int email_get_cc_from_head(emf_mail_head_t *head, char **cc) DEPRECATED;
-
-/**
- * @open
- * @fn  email_set_cc_to_head(emf_mail_head_t *head, char *cc)
- * @brief      Sets  cc field of a mail  to emf_mail_head_t(head). If head is NULL,  this returns EMF_ERROR_INVALID_PARAM. 
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] head     Specifies the pointer to emf_mail_head_t.
- * @param[in] cc               Specifies the cc field of a mail.
- * @exception          none
- * @see                 emf_mail_head_t
- */
-EXPORT_API int email_set_cc_to_head(emf_mail_head_t *head, char *cc) DEPRECATED;
-
-/**
- * @open
- * @fn  email_get_bcc_from_head(emf_mail_head_t *head, char **bcc)
- * @brief      Gets bcc field of a mail from the head object . If head is NULL,  this returns EMF_ERROR_INVALID_PARAM. <br>
- *                     This function doesn't allocate new memory for bcc field but just returns bcc field in head object.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] head     Specifies the pointer to emf_mail_head_t. 
- * @param[out] bcc     Specifies the pointer to the memory to save bcc field
- * @exception          none
- * @see                 emf_mail_head_t
- */
-EXPORT_API int email_get_bcc_from_head(emf_mail_head_t *head, char **bcc) DEPRECATED;
-
-/**
- * @open
- * @fn  email_set_bcc_to_head(emf_mail_head_t *head, char *bcc)
- * @brief      Sets  bcc field of a mail  to emf_mail_head_t(head). If head is NULL,  this returns EMF_ERROR_INVALID_PARAM. 
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] head     Specifies the pointer to emf_mail_head_t.
- * @param[in] bcc              Specifies the bcc field of a mail.
- * @exception          none
- * @see                 emf_mail_head_t
- */
-EXPORT_API int email_set_bcc_to_head(emf_mail_head_t *head, char *bcc) DEPRECATED;
-
-/**
- * @open
- * @fn  email_get_reply_from_head(emf_mail_head_t *head, char **reply)
- * @brief      Gets a reply address of a mail from the head object . If head is NULL,  this returns EMF_ERROR_INVALID_PARAM. <br>
- *                     This function doesn't allocate new memory for a reply address but just returns a reply address in head object.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] head     Specifies the pointer to emf_mail_head_t. 
- * @param[out] reply   Specifies the pointer to the memory to save a reply address
- * @exception          none
- * @see                 emf_mail_head_t
- */
-EXPORT_API int email_get_reply_from_head(emf_mail_head_t *head, char **reply) DEPRECATED;
-
-/**
- * @open
- * @fn  email_set_reply_to_head(emf_mail_head_t *head, char *reply)
- * @brief      Sets  a reply address of a mail  to emf_mail_head_t(head). If head is NULL,  this returns EMF_ERROR_INVALID_PARAM. 
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] head     Specifies the pointer to emf_mail_head_t.
- * @param[in] reply            Specifies the reply address  of a mail.
- * @exception          none
- * @see                 emf_mail_head_t
- */
-EXPORT_API int email_set_reply_to_head(emf_mail_head_t *head, char *reply) DEPRECATED;
-
-/**
- * @open
- * @fn  email_get_return_path_from_head(emf_mail_head_t *head, char **return_path)
- * @brief      Gets a return path of a mail from the head object . If head is NULL,  this returns EMF_ERROR_INVALID_PARAM. <br>
- *                     This function doesn't allocate new memory for a return path but just returns a return path in head object.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] head     Specifies the pointer to emf_mail_head_t. 
- * @param[out] return_path     Specifies the pointer to the memory to save a return path
- * @exception          none
- * @see                 emf_mail_head_t
- */
-EXPORT_API int email_get_return_path_from_head(emf_mail_head_t *head, char **return_path) DEPRECATED;
-
-/**
- * @open
- * @fn  email_set_return_path_to_head(emf_mail_head_t *head, char *return_path)
- * @brief      Sets  a return path of a mail  to emf_mail_head_t(head). If head is NULL,  this returns EMF_ERROR_INVALID_PARAM. 
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] head     Specifies the pointer to emf_mail_head_t.
- * @param[in] return_path              Specifies the return path  of a mail.
- * @exception          none
- * @see                 emf_mail_head_t
- */
-EXPORT_API int email_set_return_path_to_head(emf_mail_head_t *head, char *return_path) DEPRECATED;
-
-/**
- * @open
- * @fn  email_get_datetime_from_head(emf_mail_head_t *head, emf_datetime_t *datetime)
- * @brief      Gets datetime of a mail from the head object . If head is NULL,  this returns EMF_ERROR_INVALID_PARAM. <br>
- *                     This function doesn't allocate new memory for datetime but just returns datetime in head object.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] head     Specifies the pointer to emf_mail_head_t. 
- * @param[out] datetime        Specifies the pointer to the memory to save datetime
- * @exception          none
- * @see                 emf_mail_head_t, emf_datetime_t
- */
-EXPORT_API int email_get_datetime_from_head(emf_mail_head_t *head, emf_datetime_t *datetime) DEPRECATED;
-
-/**
- * @open
- * @fn  email_set_datetime_to_head(emf_mail_head_t *head, emf_datetime_t datetime)
- * @brief      Sets  datetime to emf_mail_head_t(head). If head is NULL,  this returns EMF_ERROR_INVALID_PARAM. 
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] head     Specifies the pointer to emf_mail_head_t.
- * @param[in] datetime         Specifies the datetime  of a mail.
- * @exception          none
- * @see                 emf_mail_head_t, emf_datetime_t
- */
-EXPORT_API int email_set_datetime_to_head(emf_mail_head_t *head, emf_datetime_t datetime) DEPRECATED;
-
-/**
- * @open
- * @fn  email_get_from_contact_name_from_head(emf_mail_head_t *head, char **from_contact_name)
- * @brief      Gets contact names of from address of a mail from the head object . If head is NULL,  this returns EMF_ERROR_INVALID_PARAM. <br>
- *                     This function doesn't allocate new memory for contact names but just returns contact names in head object.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] head     Specifies the pointer to emf_mail_head_t. 
- * @param[out] from_contact_name       Specifies the pointer to the memory to save contact names 
- * @exception          none
- * @see                 emf_mail_head_t
- */
-EXPORT_API int email_get_from_contact_name_from_head(emf_mail_head_t *head, char **from_contact_name) DEPRECATED;
-
-/**
- * @open
- * @fn  email_set_from_contact_name_to_head(emf_mail_head_t *head, char *from_contact_name)
- * @brief      Sets  contact names of from address of a mail to emf_mail_head_t(head). If head is NULL,  this returns EMF_ERROR_INVALID_PARAM. 
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] head     Specifies the pointer to emf_mail_head_t.
- * @param[in] from_contact_name                Specifies the contact names
- * @exception          none
- * @see                 emf_mail_head_t
- */
-EXPORT_API int email_set_from_contact_name_to_head(emf_mail_head_t *head, char *from_contact_name) DEPRECATED;
-
-/**
- * @open
- * @fn  email_get_to_contact_name_from_head(emf_mail_head_t *head, char **to_contact_name)
- * @brief      Gets contact names of to addresses of a mail from the head object . If head is NULL,  this returns EMF_ERROR_INVALID_PARAM. <br>
- *                     This function doesn't allocate new memory for contact names but just returns contact names in head object.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] head     Specifies the pointer to emf_mail_head_t. 
- * @param[out] to_contact_name Specifies the pointer to the memory to save contact names 
- * @exception          none
- * @see                 emf_mail_head_t
- */
-EXPORT_API int email_get_to_contact_name_from_head(emf_mail_head_t *head, char **to_contact_name) DEPRECATED;
-
-/**
- * @open
- * @fn  email_set_to_contact_name_to_head(emf_mail_head_t *head, char *to_contact_name)
- * @brief      Sets  contact names of to address of a mail to emf_mail_head_t(head). If head is NULL,  this returns EMF_ERROR_INVALID_PARAM. 
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] head     Specifies the pointer to emf_mail_head_t.
- * @param[in] to_contact_name          Specifies the contact names
- * @exception          none
- * @see                 emf_mail_head_t
- */
-EXPORT_API int email_set_to_contact_name_to_head(emf_mail_head_t *head, char *to_contact_name) DEPRECATED;
-
-/**
- * @open
- * @fn  email_get_cc_contact_name_from_head(emf_mail_head_t *head, char **cc_contact_name)
- * @brief      Gets contact names of cc addresses of a mail from the head object . If head is NULL,  this returns EMF_ERROR_INVALID_PARAM. <br>
- *                     This function doesn't allocate new memory for contact names but just returns contact names in head object.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] head     Specifies the pointer to emf_mail_head_t. 
- * @param[out] cc_contact_name Specifies the pointer to the memory to save contact names 
- * @exception          none
- * @see                 emf_mail_head_t
- */
-EXPORT_API int email_get_cc_contact_name_from_head(emf_mail_head_t *head, char **cc_contact_name) DEPRECATED;
-
-/**
- * @open
- * @fn  email_set_cc_contact_name_to_head(emf_mail_head_t *head, char *cc_contact_name)
- * @brief      Sets  contact names of cc addresses of a mail to emf_mail_head_t(head). If head is NULL,  this returns EMF_ERROR_INVALID_PARAM. 
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] head     Specifies the pointer to emf_mail_head_t.
- * @param[in] cc_contact_name          Specifies the contact names
- * @exception          none
- * @see                 emf_mail_head_t
- */
-EXPORT_API int email_set_cc_contact_name_to_head(emf_mail_head_t *head, char *cc_contact_name) DEPRECATED;
-
-/**
- * @open
- * @fn  email_get_bcc_contact_name_from_head(emf_mail_head_t *head, char **bcc_contact_name)
- * @brief      Gets contact names of bcc address of a mail from the head object . If head is NULL,  this returns EMF_ERROR_INVALID_PARAM. <br>
- *                     This function doesn't allocate new memory for contact names but just returns contact names in head object.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] head     Specifies the pointer to emf_mail_head_t. 
- * @param[out] from_contact_name       Specifies the pointer to the memory to save contact names 
- * @exception          none
- * @see                 emf_mail_head_t
- */
-EXPORT_API int email_get_bcc_contact_name_from_head(emf_mail_head_t *head, char **bcc_contact_name) DEPRECATED;
-
-/**
- * @open
- * @fn  email_set_bcc_contact_name_to_head(emf_mail_head_t *head, char *bcc_contact_name)
- * @brief      Sets  contact names of bcc addresses of a mail to emf_mail_head_t(head). If head is NULL,  this returns EMF_ERROR_INVALID_PARAM. 
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] head     Specifies the pointer to emf_mail_head_t.
- * @param[in] bcc_contact_name         Specifies the contact names
- * @exception          none
- * @see                 emf_mail_head_t
- */
-EXPORT_API int email_set_bcc_contact_name_to_head(emf_mail_head_t *head, char *bcc_contact_name) DEPRECATED;
-
-/**
- * @open
- * @fn  email_get_preview_body_text_from_head(emf_mail_head_t *head, char **preview_body_text)
- * @brief      Gets preview body text of a mail from the head object . If head is NULL,  this returns EMF_ERROR_INVALID_PARAM. <br>
- *                     This function doesn't allocate new memory for preview text but just returns preview text in head object.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] head     Specifies the pointer to emf_mail_head_t. 
- * @param[out] preview_body_text       Specifies the pointer to the memory to save text
- * @exception          none
- * @see                 emf_mail_head_t
- */
-EXPORT_API int email_get_preview_body_text_from_head(emf_mail_head_t *head, char **preview_body_text) DEPRECATED;
-
-/**
- * @open
- * @fn  email_set_preview_body_text_to_head(emf_mail_head_t *head, char *preview_body_text)
- * @brief      Sets preview body text of a mail to emf_mail_head_t(head). If head is NULL,  this returns EMF_ERROR_INVALID_PARAM. 
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] head     Specifies the pointer to emf_mail_head_t.
- * @param[in] preview_body_text                Specifies the preview body text
- * @exception          none
- * @see                 emf_mail_head_t
- */
-EXPORT_API int email_set_preview_body_text_to_head(emf_mail_head_t *head, char *preview_body_text) DEPRECATED;
-
-
-// emf_mail_body_t -------------------------------------------------------------
-/**
- * @open
- * @fn  email_get_plain_from_body(emf_mail_body_t *body, char **plain)
- * @brief      Gets the absolute path of file to contain email body (Plain Text) from the body object . If body is NULL,  this returns EMF_ERROR_INVALID_PARAM. <br>
- *                     This function doesn't allocate new memory for the path but just returns the path in body object.<br>
- *                     If the body doesn't have a plain text file, *plain will point NULL.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] body     Specifies the pointer to emf_mail_body_t. 
- * @param[out] plain   Specifies the pointer to the memory to save the path of plain text file
- * @exception          none
- * @see                 emf_mail_body_t
- */
-EXPORT_API int email_get_plain_from_body(emf_mail_body_t *body, char **plain) DEPRECATED;
-
-/**
- * @open
- * @fn  email_set_plain_to_body(emf_mail_body_t *body, char *plain)
- * @brief      Sets  the absolute path of file to contain email body (Plain Text)  to emf_mail_body_t(body). If head is NULL,  this returns EMF_ERROR_INVALID_PARAM. 
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] body     Specifies the pointer to emf_mail_body_t.
- * @param[in] plain            Specifies the path of plain text file
- * @exception          none
- * @see                 emf_mail_body_t
- */
-EXPORT_API int email_set_plain_to_body(emf_mail_body_t *body, char *plain) DEPRECATED;
-
-
-/**
- * @open
- * @fn   email_get_plain_charset_from_body(emf_mail_body_t *body, char **plain_charset)
- * @brief      Gets a character set of plain text from the body object . If body is NULL,  this returns EMF_ERROR_INVALID_PARAM. <br>
- *                     This function doesn't allocate new memory for a character set of plain, but just returns the character set in body object.
- *                     If the body doesn't have a plain text file, *plain_charset will point NULL.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] body     Specifies the pointer to emf_mail_body_t. 
- * @param[out] plain_charset   Specifies the pointer to the memory to save a character set of plain text
- * @exception          none
- * @see                 emf_mail_body_t
- */
-EXPORT_API int email_get_plain_charset_from_body(emf_mail_body_t *body, char **plain_charset) DEPRECATED;
-
-/**
- * @open
- * @fn  email_set_plain_charset_to_body(emf_mail_body_t *body, char *plain_charset)
- * @brief      Sets  a character set of plain text to emf_mail_body_t(body). If head is NULL,  this returns EMF_ERROR_INVALID_PARAM. 
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] body     Specifies the pointer to emf_mail_body_t.
- * @param[in] plain_charset            Specifies the character set of plain text
- * @exception          none
- * @see                 emf_mail_body_t
- */
-EXPORT_API int email_set_plain_charset_to_body(emf_mail_body_t *body, char *plain_charset) DEPRECATED;
-
-
-/**
- * @open
- * @fn  email_get_html_from_body(emf_mail_body_t *body, char **html)
- * @brief      Gets the absolute path of file to contain email body (HTML) from the body object . If body is NULL,  this returns EMF_ERROR_INVALID_PARAM. <br>
- *                     This function doesn't allocate new memory for the path but just returns the path in body object.<br>
- *                     If the body doesn't have a html file, *html will point NULL.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] body     Specifies the pointer to emf_mail_body_t. 
- * @param[out] html    Specifies the pointer to the memory to save the path of html file
- * @exception          none
- * @see                 emf_mail_body_t
- */
-EXPORT_API int email_get_html_from_body(emf_mail_body_t *body, char **html) DEPRECATED;
-
-/**
- * @open
- * @fn  email_set_html_to_body(emf_mail_body_t *body, char *html)
- * @brief      Sets  the absolute path of file to contain email body (HTML) to emf_mail_body_t(body). If head is NULL,  this returns EMF_ERROR_INVALID_PARAM. 
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] body     Specifies the pointer to emf_mail_body_t.
- * @param[in] html             Specifies the path of html file
- * @exception          none
- * @see                 emf_mail_body_t
- */
-EXPORT_API int email_set_html_to_body(emf_mail_body_t *body, char *html) DEPRECATED;
-
-
-/**
- * @open
- * @fn  email_get_attachment_num_from_body(emf_mail_body_t *body, int *attachment_num)
- * @brief      Gets the number of attachments from the body object . If body is NULL,  this returns EMF_ERROR_INVALID_PARAM. <br>
- *                     This function doesn't allocate new memory for the  attachment_num, but just returns the number of attachments in body object.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] body     Specifies the pointer to emf_mail_body_t. 
- * @param[out] attachment_num  Specifies the pointer to the memory to save the number of attachments
- * @exception          none
- * @see                 emf_mail_body_t
- */
-EXPORT_API int email_get_attachment_num_from_body(emf_mail_body_t *body, int *attachment_num) DEPRECATED;
-
-/**
- * @open
- * @fn  email_set_attachment_num_to_body(emf_mail_body_t *body, int attachment_num)
- * @brief      Sets  the number of attachments to emf_mail_body_t(body). If head is NULL,  this returns EMF_ERROR_INVALID_PARAM. 
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] body     Specifies the pointer to emf_mail_body_t.
- * @param[in] attachment_num           Specifies the number of attachments
- * @exception          none
- * @see                 emf_mail_body_t
- */
-EXPORT_API int email_set_attachment_num_to_body(emf_mail_body_t *body, int attachment_num) DEPRECATED;
-
-
-/**
- * @open
- * @fn  email_get_attachment_from_body(emf_mail_body_t *body, emf_attachment_info_t **attachment)
- * @brief      Gets the structure of attachment information from the body object . If body is NULL,  this returns EMF_ERROR_INVALID_PARAM. <br>
- *                     This function doesn't allocate new memory for the attachment information, but just returns attachment information in body object.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] body     Specifies the pointer to emf_mail_body_t. 
- * @param[out] attachment_num  Specifies the pointer to the memory to save attachment structure
- * @exception          none
- * @see                 emf_mail_body_t, emf_attachment_info_t
- */
-EXPORT_API int email_get_attachment_from_body(emf_mail_body_t *body, emf_attachment_info_t **attachment) DEPRECATED;
-
-/**
- * @open
- * @fn  email_set_attachment_to_body(emf_mail_body_t *body, emf_attachment_info_t *attachment)
- * @brief      Sets   the structure of attachment information to emf_mail_body_t(body). If head is NULL,  this returns EMF_ERROR_INVALID_PARAM. 
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] body     Specifies the pointer to emf_mail_body_t.
- * @param[in] attachment               Specifies the attachment structure
- * @exception          none
- * @see                 emf_mail_body_t
- */
-EXPORT_API int email_set_attachment_to_body(emf_mail_body_t *body, emf_attachment_info_t *attachment) DEPRECATED;
-
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-/**
-* @} @}
-*/
-
-
-#endif /* __EMF_MAPI_RULE_H__ */
-
index 3b755d1..a84fccd 100755 (executable)
@@ -1,7 +1,21 @@
-email-service (0.3.6-4) unstable; urgency=low
+email-service (0.4.0-2) unstable; urgency=low
 
-  * New API function 'email_find_mail_on_server'
+  * 1. Change IPC code (c++ -> c)
+  * 2. Fixed the memory leak
+  * 3. Fixed the display the time
   * Git : slp/pkgs/e/email-service
-  * Tag : email-service_0.3.6-4
+  * Tag : email-service_0.4.0-2
 
- -- Kyuho Jo <kyuho.jo@samsung.com>  Wed, 08 Feb 2012 21:13:33 +0900
+ -- Sunghyun Kwon <sh0701.kwon@samsung.com>  Wed, 04 Apr 2012 17:01:25 +0900
+
+email-service (0.4.0-1) unstable; urgency=low
+
+  * 1. Removed all deprecated functions. 
+  * 2. attachment_mime_type is added to emf_attachment_data_t.
+  * 3. An attribute 'datetime' is removed from emf_mail_data_t and emf_mail_list_item_t.
+  * 4. An attribute 'date_time' is added to emf_mail_data_t and emf_mail_list_item_t.
+  * 5. emf_mail_t, emf_mail_info_t, emf_mail_body_t, emf_mail_head_t are removed from API.
+  * Git : slp/pkgs/e/email-service
+  * Tag : email-service_0.4.0-1
+
+ -- Kyuho Jo <kyuho.jo@samsung.com>  Thu, 08 Mar 2012 17:42:24 +0900
index 7b80c16..50b7190 100755 (executable)
@@ -3,7 +3,7 @@ Section: main/libs
 Priority: extra
 Maintainer: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com>, Sang-Hun Chung <sanghun.chung@samsung.com>
 Uploaders: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com>, Sang-Hun Chung <sanghun.chung@samsung.com>, Changseok Oh <seok.oh@samsung.com>
-Build-Depends: debhelper (>= 5), libglib2.0-dev, libdbus-1-dev, libdbus-glib-1-dev,    libslp-db-util-dev, libxml2-dev, libwbxml2-dev, libssl-dev, drm-service-dev, libslp-pm-dev, libuw-imap-toolkit-dev, openssl, dlog-dev, libslp-setting-dev, libcontacts-service-dev, libheynoti-dev, libss-client-dev, libalarm-dev, libaccounts-svc-dev, libdevman-dev, libmm-player-dev, libmm-session-dev, libnotification-dev, libeina-dev, libcurl-dev
+Build-Depends: debhelper (>= 5), libglib2.0-dev, libdbus-1-dev, libdbus-glib-1-dev, libslp-db-util-dev, libxml2-dev, libwbxml2-dev, libssl-dev, drm-service-dev, libslp-pm-dev, libuw-imap-toolkit-dev, openssl, dlog-dev, libslp-setting-dev, libcontacts-service-dev, libheynoti-dev, libss-client-dev, libalarm-dev, libaccounts-svc-dev, libdevman-dev, libmm-player-dev, libmm-session-dev, libnotification-dev, libeina-dev, libcurl-dev
 Standards-Version: 3.7.2
 Homepage: N/A
 
index 3f74411..8cd01dd 100755 (executable)
@@ -1,4 +1,3 @@
 /usr/lib/*.so
 /usr/lib/*.so.*
 /usr/bin/email-service
-/opt/apps/email-service/*
index 10eff1c..f3feade 100755 (executable)
@@ -189,7 +189,7 @@ vconftool set -t int    db/email/last_sync_time "0"
 vconftool set -t int    db/email/slot_size "100"
 
 # for badge
-vconftool set -t int   db/badge/org.tizen.email "0"
+vconftool set -t int   db/badge/com.samsung.email "0"
 
 fi
 
@@ -219,180 +219,182 @@ echo "[EMAIL-SERVICE] Creating Email Tables ..."
 sqlite3 /opt/dbspace/.email-service.db 'PRAGMA journal_mode = PERSIST;
 CREATE TABLE mail_account_tbl 
 ( 
-       account_bind_type           INTEGER,
-       account_name                VARCHAR(51),
-       receiving_server_type       INTEGER,
-       receiving_server_addr       VARCHAR(51),
-       email_addr                  VARCHAR(129),
-       user_name                   VARCHAR(51),
-       password                    VARCHAR(51),
-       retrieval_mode              INTEGER,
-       port_num                    INTEGER,
-       use_security                INTEGER,
-       sending_server_type         INTEGER,
-       sending_server_addr         VARCHAR(51),
-       sending_port_num            INTEGER,
-       sending_auth                INTEGER,
-       sending_security            INTEGER,
-       sending_user                VARCHAR(51),
-       sending_password            VARCHAR(51),
-       display_name                VARCHAR(31),
-       reply_to_addr               VARCHAR(129),
-       return_addr                 VARCHAR(129),
-       account_id                  INTEGER PRIMARY KEY,
-       keep_on_server              INTEGER,
-       flag1                       INTEGER,
-       flag2                       INTEGER,
-       pop_before_smtp             INTEGER,
-       apop                        INTEGER,
-       logo_icon_path              VARCHAR(256),
-       preset_account              INTEGER,
-       target_storage              INTEGER,
-       check_interval              INTEGER,
-       priority                    INTEGER,
-       keep_local_copy             INTEGER,
-       req_delivery_receipt        INTEGER,
-       req_read_receipt            INTEGER,
-       download_limit              INTEGER,
-       block_address               INTEGER,
-       block_subject               INTEGER,
-       display_name_from           VARCHAR(256),
-       reply_with_body             INTEGER,
-       forward_with_files          INTEGER,
-       add_myname_card             INTEGER,
-       add_signature               INTEGER,
-       signature                   VARCHAR(256),
-       add_my_address_to_bcc       INTEGER,
-       my_account_id               INTEGER,
-       index_color                 INTEGER,
-       sync_status                 INTEGER
+       account_bind_type                INTEGER,
+       account_name                     VARCHAR(51),
+       receiving_server_type            INTEGER,
+       receiving_server_addr            VARCHAR(51),
+       email_addr                       VARCHAR(129),
+       user_name                        VARCHAR(51),
+       password                         VARCHAR(51),
+       retrieval_mode                   INTEGER,
+       port_num                         INTEGER,
+       use_security                     INTEGER,
+       sending_server_type              INTEGER,
+       sending_server_addr              VARCHAR(51),
+       sending_port_num                 INTEGER,
+       sending_auth                     INTEGER,
+       sending_security                 INTEGER,
+       sending_user                     VARCHAR(51),
+       sending_password                 VARCHAR(51),
+       display_name                     VARCHAR(31),
+       reply_to_addr                    VARCHAR(129),
+       return_addr                      VARCHAR(129),
+       account_id                       INTEGER PRIMARY KEY,
+       keep_on_server                   INTEGER,
+       flag1                            INTEGER,
+       flag2                            INTEGER,
+       pop_before_smtp                  INTEGER,
+       apop                             INTEGER,
+       logo_icon_path                   VARCHAR(256),
+       preset_account                   INTEGER,
+       target_storage                   INTEGER,
+       check_interval                   INTEGER,
+       priority                         INTEGER,
+       keep_local_copy                  INTEGER,
+       req_delivery_receipt             INTEGER,
+       req_read_receipt                 INTEGER,
+       download_limit                   INTEGER,
+       block_address                    INTEGER,
+       block_subject                    INTEGER,
+       display_name_from                VARCHAR(256),
+       reply_with_body                  INTEGER,
+       forward_with_files               INTEGER,
+       add_myname_card                  INTEGER,
+       add_signature                    INTEGER,
+       signature                        VARCHAR(256),
+       add_my_address_to_bcc            INTEGER,
+       my_account_id                    INTEGER,
+       index_color                      INTEGER,
+       sync_status                      INTEGER
 );
 
 CREATE TABLE mail_attachment_tbl 
 ( 
-       attachment_id               INTEGER PRIMARY KEY,
-       attachment_name             VARCHAR(257),
-       attachment_path             VARCHAR(257),
-       attachment_size             INTEGER,
-       mail_id                     INTEGER,
-       account_id                  INTEGER,
-       mailbox_name                VARCHAR(129),
-       file_yn                     INTEGER,
-       flag1                       INTEGER,
-       flag2                       INTEGER,
-       flag3                       INTEGER
+       attachment_id                    INTEGER PRIMARY KEY,
+       attachment_name                  VARCHAR(257),
+       attachment_path                  VARCHAR(257),
+       attachment_size                  INTEGER,
+       mail_id                          INTEGER,
+       account_id                       INTEGER,
+       mailbox_name                     VARCHAR(129),
+       attachment_save_status           INTEGER,
+       attachment_drm_type              INTEGER,
+       attachment_drm_method            INTEGER,
+       attachment_inline_content_status INTEGER,
+       attachment_mime_type             VARCHAR(257)
 );
 
 CREATE TABLE mail_box_tbl 
 (    
-       mailbox_id                  INTEGER,
-       account_id                  INTEGER,
-       local_yn                    INTEGER,
-       mailbox_name                VARCHAR(256),    
-       mailbox_type                INTEGER,    
-       alias                       VARCHAR(256),    
-       sync_with_server_yn         INTEGER,    
-       modifiable_yn               INTEGER,    
-       total_mail_count_on_server  INTEGER,
-       has_archived_mails          INTEGER,    
-       mail_slot_size              INTEGER
+       mailbox_id                       INTEGER,
+       account_id                       INTEGER,
+       local_yn                         INTEGER,
+       mailbox_name                     VARCHAR(256),    
+       mailbox_type                     INTEGER,    
+       alias                            VARCHAR(256),    
+       sync_with_server_yn              INTEGER,    
+       modifiable_yn                    INTEGER,    
+       total_mail_count_on_server       INTEGER,
+       has_archived_mails               INTEGER,    
+       mail_slot_size                   INTEGER
 );
 CREATE TABLE mail_read_mail_uid_tbl          
 (    
-       account_id                  INTEGER ,
-       local_mbox                  VARCHAR(129)  ,
-       local_uid                   INTEGER ,
-       mailbox_name                VARCHAR(129)  ,
-       s_uid                       VARCHAR(129)  ,
-       data1                       INTEGER ,
-       data2                       VARCHAR(257)  ,
-       flag                        INTEGER ,
-       idx_num                     INTEGER  PRIMARY KEY
+       account_id                       INTEGER ,
+       local_mbox                       VARCHAR(129)  ,
+       local_uid                        INTEGER ,
+       mailbox_name                     VARCHAR(129)  ,
+       s_uid                            VARCHAR(129)  ,
+       data1                            INTEGER ,
+       data2                            VARCHAR(257)  ,
+       flag                             INTEGER ,
+       idx_num                          INTEGER  PRIMARY KEY
 );
 CREATE TABLE mail_rule_tbl          
 (    
-       account_id                  INTEGER ,
-       rule_id                     INTEGER  PRIMARY KEY,
-       type                        INTEGER ,
-       value                       VARCHAR(257)  ,
-       action_type                 INTEGER ,
-       dest_mailbox                VARCHAR(129),
-       flag1                       INTEGER  ,
-       flag2                       INTEGER    
+       account_id                       INTEGER ,
+       rule_id                          INTEGER  PRIMARY KEY,
+       type                             INTEGER ,
+       value                            VARCHAR(257)  ,
+       action_type                      INTEGER ,
+       dest_mailbox                     VARCHAR(129),
+       flag1                            INTEGER  ,
+       flag2                            INTEGER    
 );
 CREATE TABLE mail_tbl
 (
-       mail_id                     INTEGER PRIMARY_KEY,
-       account_id                  INTEGER,
-       mailbox_name                VARCHAR(129),
-       mailbox_type                INTEGER,
-       subject                     UCS2TEXT,
-       date_time                   VARCHAR(129),
-       server_mail_status          INTEGER,
-       server_mailbox_name         VARCHAR(129),
-       server_mail_id              VARCHAR(129),
-       message_id                  VARCHAR(257),
-       full_address_from           UCS2TEXT,
-       full_address_reply          UCS2TEXT,
-       full_address_to             UCS2TEXT,
-       full_address_cc             UCS2TEXT,
-       full_address_bcc            UCS2TEXT,
-       full_address_return         UCS2TEXT,
-       email_address_sender        UCS2TEXT collation user1,
-       email_address_recipient     UCS2TEXT collation user1,
-       alias_sender                UCS2TEXT,
-       alias_recipient             UCS2TEXT,
-       body_download_status        INTEGER,
-       file_path_plain             VARCHAR(257),
-       file_path_html              VARCHAR(257),
-       mail_size                   INTEGER,
-       flags_seen_field            BOOLEAN,
-       flags_deleted_field         BOOLEAN,
-       flags_flagged_field         BOOLEAN,
-       flags_answered_field        BOOLEAN,
-       flags_recent_field          BOOLEAN,
-       flags_draft_field           BOOLEAN,
-       flags_forwarded_field       BOOLEAN,
-       DRM_status                  INTEGER,
-       priority                    INTEGER,
-       save_status                 INTEGER,
-       lock_status                 INTEGER,
-       report_status               INTEGER,
-       attachment_count            INTEGER,
-       inline_content_count        INTEGER,
-       thread_id                   INTEGER,
-       thread_item_count           INTEGER,
-       preview_text                UCS2TEXT, 
-       meeting_request_status      INTEGER,
-       FOREIGN KEY(account_id)     REFERENCES mail_account_tbl(account_id)
+       mail_id                          INTEGER PRIMARY_KEY,
+       account_id                       INTEGER,
+       mailbox_id                       INTEGER,
+       mailbox_name                     VARCHAR(129),
+       mailbox_type                     INTEGER,
+       subject                          TEXT,
+       date_time                        DATETIME,
+       server_mail_status               INTEGER,
+       server_mailbox_name              VARCHAR(129),
+       server_mail_id                   VARCHAR(129),
+       message_id                       VARCHAR(257),
+       full_address_from                TEXT,
+       full_address_reply               TEXT,
+       full_address_to                  TEXT,
+       full_address_cc                  TEXT,
+       full_address_bcc                 TEXT,
+       full_address_return              TEXT,
+       email_address_sender             TEXT collation user1,
+       email_address_recipient          TEXT collation user1,
+       alias_sender                     TEXT,
+       alias_recipient                  TEXT,
+       body_download_status             INTEGER,
+       file_path_plain                  VARCHAR(257),
+       file_path_html                   VARCHAR(257),
+       mail_size                        INTEGER,
+       flags_seen_field                 BOOLEAN,
+       flags_deleted_field              BOOLEAN,
+       flags_flagged_field              BOOLEAN,
+       flags_answered_field             BOOLEAN,
+       flags_recent_field               BOOLEAN,
+       flags_draft_field                BOOLEAN,
+       flags_forwarded_field            BOOLEAN,
+       DRM_status                       INTEGER,
+       priority                         INTEGER,
+       save_status                      INTEGER,
+       lock_status                      INTEGER,
+       report_status                    INTEGER,
+       attachment_count                 INTEGER,
+       inline_content_count             INTEGER,
+       thread_id                        INTEGER,
+       thread_item_count                INTEGER,
+       preview_text                     TEXT, 
+       meeting_request_status           INTEGER,
+       FOREIGN KEY(account_id)          REFERENCES mail_account_tbl(account_id)
 );
 CREATE TABLE mail_meeting_tbl
 (
-       mail_id                     INTEGER PRIMARY KEY,
-       account_id                  INTEGER,
-       mailbox_name                UCS2TEXT ,
-       meeting_response            INTEGER,
-       start_time                  INTEGER,
-       end_time                    INTEGER,
-       location                    UCS2TEXT ,
-       global_object_id            UCS2TEXT ,
-       offset                      INTEGER,
-       standard_name               UCS2TEXT ,
-       standard_time_start_date    INTEGER,
-       standard_bias               INTEGER,
-       daylight_name               UCS2TEXT ,
-       daylight_time_start_date    INTEGER,
-       daylight_bias               INTEGER
+       mail_id                          INTEGER PRIMARY KEY,
+       account_id                       INTEGER,
+       mailbox_name                     TEXT ,
+       meeting_response                 INTEGER,
+       start_time                       INTEGER,
+       end_time                         INTEGER,
+       location                         TEXT ,
+       global_object_id                 TEXT ,
+       offset                           INTEGER,
+       standard_name                    TEXT ,
+       standard_time_start_date         INTEGER,
+       standard_bias                    INTEGER,
+       daylight_name                    TEXT ,
+       daylight_time_start_date         INTEGER,
+       daylight_bias                    INTEGER
 );
 CREATE TABLE mail_local_activity_tbl  
 (  
-       activity_id                 INTEGER,
-       account_id                  INTEGER,
-       mail_id                     INTEGER,
-       activity_type               INTEGER, 
-       server_mailid               VARCHAR(129),
-       src_mbox                    VARCHAR(129),
-       dest_mbox                   VARCHAR(129) 
+       activity_id                      INTEGER,
+       account_id                       INTEGER,
+       mail_id                          INTEGER,
+       activity_type                    INTEGER, 
+       server_mailid                    VARCHAR(129),
+       src_mbox                         VARCHAR(129),
+       dest_mbox                        VARCHAR(129) 
 );
 
 
similarity index 52%
rename from MAPI/CMakeLists.txt
rename to email-api/CMakeLists.txt
index f27ab32..15ce59c 100755 (executable)
@@ -21,23 +21,22 @@ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VISIBILITY} -fvisibility=hidden")
 
 SET(API-LIB "email-api")
 SET(API-SRCS 
-       ${CMAKE_SOURCE_DIR}/MAPI/Emf_Mapi_Account.c
-       ${CMAKE_SOURCE_DIR}/MAPI/Emf_Mapi_Message.c
-       ${CMAKE_SOURCE_DIR}/MAPI/Emf_Mapi_Network.c
-       ${CMAKE_SOURCE_DIR}/MAPI/Emf_Mapi_Rule.c
-       ${CMAKE_SOURCE_DIR}/MAPI/Emf_Mapi_Mailbox.c
-       ${CMAKE_SOURCE_DIR}/MAPI/Emf_Mapi_Types.c
-       ${CMAKE_SOURCE_DIR}/MAPI/Emf_Mapi_Init.c
+       ${CMAKE_SOURCE_DIR}/email-api/email-api-account.c
+       ${CMAKE_SOURCE_DIR}/email-api/email-api-mail.c
+       ${CMAKE_SOURCE_DIR}/email-api/email-api-network.c
+       ${CMAKE_SOURCE_DIR}/email-api/email-api-rule.c
+       ${CMAKE_SOURCE_DIR}/email-api/email-api-mailbox.c
+       ${CMAKE_SOURCE_DIR}/email-api/email-api-init.c
 )
 
 INCLUDE_DIRECTORIES(
-       ${CMAKE_SOURCE_DIR}/include
-       ${CMAKE_SOURCE_DIR}/ipc/include
-       ${CMAKE_SOURCE_DIR}/MAPI/include
-       ${CMAKE_SOURCE_DIR}/email-core/em-storage/include
-       ${CMAKE_SOURCE_DIR}/ipc/socket/include
-       ${CMAKE_SOURCE_DIR}/Common/include
+       ${CMAKE_SOURCE_DIR}/email-daemon/include
+       ${CMAKE_SOURCE_DIR}/email-api/include
+       ${CMAKE_SOURCE_DIR}/email-api/socket/include
+       ${CMAKE_SOURCE_DIR}/email-ipc/include
        ${CMAKE_SOURCE_DIR}/email-core/include
+       ${CMAKE_SOURCE_DIR}/email-core/email-storage/include
+       ${CMAKE_SOURCE_DIR}/email-common-use/include
 )
 
 INCLUDE(FindPkgConfig)
@@ -53,8 +52,8 @@ SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
 
 ADD_LIBRARY(${API-LIB} SHARED ${API-SRCS})
 
-TARGET_LINK_LIBRARIES(${API-LIB} ${api_pkgs_LDFLAGS} email-ipc email-storage email-core email-base email-network)
-#${NETWORK-LIB} ${CORE-LIB} ${STORAGE-LIB} ${IPC-LIB} ${BASE-LIB})
+TARGET_LINK_LIBRARIES(${API-LIB} ${api_pkgs_LDFLAGS} email-ipc email-storage email-core email-common-use email-network)
+#${NETWORK-LIB} ${CORE-LIB} ${STORAGE-LIB} ${IPC-LIB} ${COMMON-LIB})
 
 SET_TARGET_PROPERTIES(${API-LIB} PROPERTIES SOVERSION ${VERSION_MAJOR})
 SET_TARGET_PROPERTIES(${API-LIB} PROPERTIES VERSION ${VERSION})
@@ -62,17 +61,17 @@ SET_TARGET_PROPERTIES(${API-LIB} PROPERTIES VERSION ${VERSION})
 #INSTALL(TARGETS ${API-LIB} LIBRARY DESTINATION lib)
 INSTALL(TARGETS ${API-LIB} DESTINATION lib COMPONENT RuntimeLibraries)
 
-SET(MAPI-HEADERS
-       ${CMAKE_SOURCE_DIR}/MAPI/include/Emf_Mapi.h
-       ${CMAKE_SOURCE_DIR}/MAPI/include/Emf_Mapi_Account.h
-       ${CMAKE_SOURCE_DIR}/MAPI/include/Emf_Mapi_Message.h
-       ${CMAKE_SOURCE_DIR}/MAPI/include/Emf_Mapi_Mailbox.h
-       ${CMAKE_SOURCE_DIR}/MAPI/include/Emf_Mapi_Rule.h
-       ${CMAKE_SOURCE_DIR}/MAPI/include/Emf_Mapi_Init.h
-       ${CMAKE_SOURCE_DIR}/MAPI/include/Emf_Mapi_Types.h
-       ${CMAKE_SOURCE_DIR}/MAPI/include/Emf_Mapi_Network.h
-       ${CMAKE_SOURCE_DIR}/include/emf-types.h 
+SET(EMAIL-API-HEADERS
+       ${CMAKE_SOURCE_DIR}/email-api/include/email-api.h
+       ${CMAKE_SOURCE_DIR}/email-api/include/email-api-account.h
+       ${CMAKE_SOURCE_DIR}/email-api/include/email-api-init.h
+       ${CMAKE_SOURCE_DIR}/email-api/include/email-api-mail.h
+       ${CMAKE_SOURCE_DIR}/email-api/include/email-api-mailbox.h
+       ${CMAKE_SOURCE_DIR}/email-api/include/email-api-network.h
+       ${CMAKE_SOURCE_DIR}/email-api/include/email-api-rule.h
+       ${CMAKE_SOURCE_DIR}/email-common-use/include/email-types.h
+       ${CMAKE_SOURCE_DIR}/email-common-use/include/email-errors.h
 )
 
-INSTALL(FILES ${MAPI-HEADERS} DESTINATION include/email-service)
+INSTALL(FILES ${EMAIL-API-HEADERS} DESTINATION include/email-service)
 
similarity index 55%
rename from MAPI/Emf_Mapi_Account.c
rename to email-api/email-api-account.c
index 4db5232..3962e70 100755 (executable)
 /**
  *
  * This file contains the data structures and interfaces needed for application,
- * to interact with Email Engine.
- * @file               Emf_Mapi_Account.c
+ * to interact with email-service.
+ * @file               email-api-account.c
  * @brief              This file contains the data structures and interfaces of Account related Functionality provided by 
- *                     Email Engine . 
+ *                     email-service . 
  */
  
-#include <Emf_Mapi.h>
+#include "email-api.h"
 #include "string.h"
-#include "Msg_Convert.h"
-#include "Emf_Mapi_Account.h"
-#include "em-storage.h"
-#include "em-core-mesg.h"
-#include "em-core-account.h"
-#include "em-core-utils.h"
-#include "ipc-library.h"
+#include "email-convert.h"
+#include "email-api-account.h"
+#include "email-storage.h"
+#include "email-core-mail.h"
+#include "email-core-account.h"
+#include "email-core-utils.h"
+#include "email-utilities.h"
+#include "email-ipc.h"
 
 /* API - Adds the Email Account */
 EXPORT_API int email_add_account(emf_account_t* account)
@@ -46,7 +47,6 @@ EXPORT_API int email_add_account(emf_account_t* account)
        char* local_account_stream = NULL;
        int ret = -1;
        int size = 0;
-       int account_id;
        int err = EMF_ERROR_NONE;
 
        if ( !account )  {
@@ -54,7 +54,7 @@ EXPORT_API int email_add_account(emf_account_t* account)
                return EMF_ERROR_INVALID_PARAM;
        }
 
-       HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_ADD_ACCOUNT);
+       HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_ADD_ACCOUNT);
 
        EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
 
@@ -62,27 +62,28 @@ EXPORT_API int email_add_account(emf_account_t* account)
 
        EM_PROXY_IF_NULL_RETURN_VALUE(local_account_stream, hAPI, EMF_ERROR_NULL_VALUE);
 
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, local_account_stream, size))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, local_account_stream, size)) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               EM_SAFE_FREE(local_account_stream);
+               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+       }
 
-       EM_DEBUG_LOG("APPID[%d], APIID [%d]", ipcEmailAPI_GetAPPID(hAPI), ipcEmailAPI_GetAPIID(hAPI));
+       EM_DEBUG_LOG("APPID[%d], APIID [%d]", emipc_get_app_id(hAPI), emipc_get_api_id(hAPI));
 
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPI failed");
+       if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed");
                EM_SAFE_FREE(local_account_stream);     
                EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
        }
        
-        ret = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
-        if(ret == 1) {
-               account_id = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1);
-               EM_DEBUG_LOG("APPID[%d], APIID [%d]", ipcEmailAPI_GetAPPID(hAPI), ipcEmailAPI_GetAPIID(hAPI));
-               account->account_id = account_id;
+        emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &ret);
+        if(ret == EMF_ERROR_NONE) {
+               emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), &account->account_id);
        } else {        /*  get error code */
-               err = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1);
+               emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), &err);
        }
        
-       ipcEmailAPI_Destroy(hAPI);
+       emipc_destroy_email_api(hAPI);
        hAPI = NULL;
 
        EM_SAFE_FREE(local_account_stream);
@@ -145,24 +146,26 @@ EXPORT_API int email_delete_account(int account_id)
                return err;
        }
 
-       HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_DELETE_ACCOUNT);
+       HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_DELETE_ACCOUNT);
 
        EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
 
        /* account_id */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&account_id, sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter account_id  failed ");
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&account_id, sizeof(int))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter account_id  failed ");
+               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+       }
        
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPI failed ");
+       if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed ");
                EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
        }
 
-       ret = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
-       if(0==ret) {    /*  get error code */
-               err = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1); 
+       emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &ret);
+       if(ret != EMF_ERROR_NONE) {     /*  get error code */
+               emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), &err);        
        }
-       ipcEmailAPI_Destroy(hAPI);
+       emipc_destroy_email_api(hAPI);
 
        hAPI = NULL;
        EM_DEBUG_FUNC_END("RETURN VALUE [%d], ERROR CODE [%d]", ret, err);
@@ -177,66 +180,56 @@ EXPORT_API int email_update_account(int account_id, emf_account_t* new_account)
        int ret = 0;
        int size = 0;
        int err = EMF_ERROR_NONE;
-       int with_validation = false, *result_from_ipc = NULL;
+       int with_validation = false;
        char* new_account_stream = NULL;
 
        if ((account_id <= 0) || !new_account || (with_validation != false && with_validation != true))  {
                EM_DEBUG_EXCEPTION("account_id[%d], new_account[%p], with_validation[%d]", account_id, new_account, with_validation);
-               err = EMF_ERROR_INVALID_PARAM;
-               return err;
+               return  EMF_ERROR_INVALID_PARAM;
        }
 
-       HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_UPDATE_ACCOUNT);
+       HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_UPDATE_ACCOUNT);
 
        EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
 
        /* account_id */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&account_id, sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter account_id failed ");
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&account_id, sizeof(int))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter account_id failed ");
+               goto FINISH_OFF;
+       }
 
        /* new_account */
        new_account_stream = em_convert_account_to_byte_stream(new_account, &size);
 
        EM_PROXY_IF_NULL_RETURN_VALUE(new_account_stream, hAPI, EMF_ERROR_NULL_VALUE);
 
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, new_account_stream, size))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter new_account failed ");
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, new_account_stream, size)) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter new_account failed ");
+               goto FINISH_OFF;
+       }
 
        /* with_validation */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&with_validation, sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter with_validation failed ");
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&with_validation, sizeof(int))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter with_validation failed ");
+               goto FINISH_OFF;
+       }
 
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPI failed");
-               /* Prevent defect 18624 */
+       if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed");
                EM_SAFE_FREE(new_account_stream);
                EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
        }
 
-       result_from_ipc = (int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
-
-       if(!result_from_ipc) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter fail ");
-               err = EMF_ERROR_IPC_CRASH;
-               goto FINISH_OFF;
-       }
-
-       ret = *result_from_ipc;
-
-       if(ret == 0) {  /*  get error code */
-               result_from_ipc = (int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1);
-               if(!result_from_ipc) {
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter fail ");
-                       err = EMF_ERROR_IPC_CRASH;
-                       goto FINISH_OFF;
-               }
+       emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &ret);
 
-               err = *result_from_ipc; 
+       if(ret != EMF_ERROR_NONE) {
+               /*  get error code */
+               emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), &err);
        }
 
 FINISH_OFF:
 
-       ipcEmailAPI_Destroy(hAPI);
+       emipc_destroy_email_api(hAPI);
        hAPI = NULL;
 
        EM_SAFE_FREE(new_account_stream);
@@ -261,40 +254,46 @@ EXPORT_API int email_update_account_with_validation(int account_id, emf_account_
                return err;
        }
 
-       HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_UPDATE_ACCOUNT);
+       HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_UPDATE_ACCOUNT);
 
        EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
 
        /* account_id */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&account_id, sizeof(int)))
-               EM_DEBUG_EXCEPTION("email_update_account--ipcEmailAPI_AddParameter account_id  failed ");
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&account_id, sizeof(int))) {
+               EM_DEBUG_EXCEPTION("email_update_account--emipc_add_parameter account_id  failed ");
+               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+       }
 
        /* new_account */
        new_account_stream = em_convert_account_to_byte_stream(new_account, &size);
 
        EM_PROXY_IF_NULL_RETURN_VALUE(new_account_stream, hAPI, EMF_ERROR_NULL_VALUE);
 
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, new_account_stream, size))
-               EM_DEBUG_EXCEPTION("email_update_account--ipcEmailAPI_AddParameter new_account  failed ");
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, new_account_stream, size)) {
+               EM_DEBUG_EXCEPTION("email_update_account--emipc_add_parameter new_account  failed ");
+               EM_SAFE_FREE(new_account_stream);
+               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+       }
 
        /* with_validation */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&with_validation, sizeof(int)))
-               EM_DEBUG_EXCEPTION("email_update_account--ipcEmailAPI_AddParameter with_validation  failed ");
-
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&with_validation, sizeof(int))) {
+               EM_DEBUG_EXCEPTION("email_update_account--emipc_add_parameter with_validation  failed ");
+               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+       }
 
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION("email_update_account--ipcEmailProxy_ExecuteAPI failed ");
+       if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("email_update_account--emipc_execute_proxy_api failed ");
                /* Prevent defect 18624 */
                EM_SAFE_FREE(new_account_stream);
                EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
        }
 
-       ret = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
-       if(ret == 0) {  /*  get error code */
-               err = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1); 
+       emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &ret);
+       if(ret != EMF_ERROR_NONE) {     /*  get error code */
+               emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), &err);        
        }
 
-       ipcEmailAPI_Destroy(hAPI);
+       emipc_destroy_email_api(hAPI);
        hAPI = NULL;
 
        EM_SAFE_FREE(new_account_stream);
@@ -311,7 +310,7 @@ EXPORT_API int email_get_account(int account_id, int pulloption, emf_account_t**
        EM_DEBUG_FUNC_BEGIN();
        int ret = 0;
        int err = EMF_ERROR_NONE;
-       emf_mail_account_tbl_t *account_tbl = NULL;
+       emstorage_account_tbl_t *account_tbl = NULL;
 
        EM_IF_NULL_RETURN_VALUE(account_id, EMF_ERROR_INVALID_PARAM);
        EM_IF_NULL_RETURN_VALUE(account, EMF_ERROR_INVALID_PARAM);
@@ -324,13 +323,12 @@ EXPORT_API int email_get_account(int account_id, int pulloption, emf_account_t**
                EM_DEBUG_LOG("change pulloption : disable password");
        }
 
-       if (!em_storage_get_account_by_id(account_id, pulloption, &account_tbl, true, &err)) {
-               EM_DEBUG_EXCEPTION("em_storage_get_account_by_id failed - %d", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+       if (!emstorage_get_account_by_id(account_id, pulloption, &account_tbl, true, &err)) {
+               EM_DEBUG_EXCEPTION("emstorage_get_account_by_id failed - %d", err);
                goto FINISH_OFF;
        }
 
-       *account = em_core_malloc(sizeof(emf_account_t));
+       *account = em_malloc(sizeof(emf_account_t));
        if (!*account) {
                EM_DEBUG_EXCEPTION("allocation failed [%d]", err);
                goto FINISH_OFF;
@@ -338,12 +336,12 @@ EXPORT_API int email_get_account(int account_id, int pulloption, emf_account_t**
        memset((void*)*account, 0, sizeof(emf_account_t));
        em_convert_account_tbl_to_account(account_tbl, *account);
 
-       err = em_storage_get_emf_error_from_em_storage_error(err);
+
        ret = true;
 
 FINISH_OFF:
        if (account_tbl)
-               em_storage_free_account(&account_tbl, 1, NULL);
+               emstorage_free_account(&account_tbl, 1, NULL);
 
        EM_DEBUG_FUNC_END();
        return err;
@@ -354,19 +352,19 @@ EXPORT_API int email_get_account_list(emf_account_t** account_list, int* count)
        EM_DEBUG_FUNC_BEGIN();
 
        int err = EMF_ERROR_NONE, i = 0;
-       emf_mail_account_tbl_t *temp_account_tbl = NULL;
+       emstorage_account_tbl_t *temp_account_tbl = NULL;
 
        EM_IF_NULL_RETURN_VALUE(account_list, EMF_ERROR_INVALID_PARAM);
        EM_IF_NULL_RETURN_VALUE(count, EMF_ERROR_INVALID_PARAM);
 
-       if (!em_storage_get_account_list(count, &temp_account_tbl , true, false, &err)) {
-               EM_DEBUG_EXCEPTION("em_storage_get_account_list failed [%d]", err);
+       if (!emstorage_get_account_list(count, &temp_account_tbl , true, false, &err)) {
+               EM_DEBUG_EXCEPTION("emstorage_get_account_list failed [%d]", err);
 
                goto FINISH_OFF;
        }
 
        if(temp_account_tbl && (*count) > 0) {
-               *account_list = em_core_malloc(sizeof(emf_account_t) * (*count));
+               *account_list = em_malloc(sizeof(emf_account_t) * (*count));
                if(!*account_list) {
                        EM_DEBUG_EXCEPTION("allocation failed [%d]", err);
                        goto FINISH_OFF;
@@ -377,10 +375,10 @@ EXPORT_API int email_get_account_list(emf_account_t** account_list, int* count)
        }
 
 FINISH_OFF:
-       err = em_storage_get_emf_error_from_em_storage_error(err);
+
 
        if(temp_account_tbl)
-               em_storage_free_account(&temp_account_tbl, (*count), NULL);
+               emstorage_free_account(&temp_account_tbl, (*count), NULL);
        EM_DEBUG_FUNC_END("err[%d]", err);
        return err;
 
@@ -398,26 +396,28 @@ EXPORT_API int email_validate_account(int account_id, unsigned* handle)
                return err;
        }
 
-       HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_VALIDATE_ACCOUNT);
+       HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_VALIDATE_ACCOUNT);
 
        EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
 
        /* account_id */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&account_id, sizeof(int)))
-               EM_DEBUG_EXCEPTION(" ipcEmailAPI_AddParameter account_id  failed ");
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&account_id, sizeof(int))) {
+               EM_DEBUG_EXCEPTION(" emipc_add_parameter account_id  failed ");
+               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+       }
        
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION(" ipcEmailProxy_ExecuteAPI failed ");
+       if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION(" emipc_execute_proxy_api failed ");
                EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
        }
 
-       ret = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0); /*  return  */
-       err = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1); /*  error code */
+       emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &ret); /*  return  */
+       emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), &err); /*  error code */
 
        if(handle)
-               *handle = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 2);
+               emipc_get_parameter(hAPI, ePARAMETER_OUT, 2, sizeof(int), handle);
 
-       ipcEmailAPI_Destroy(hAPI);
+       emipc_destroy_email_api(hAPI);
 
        hAPI = NULL;
        EM_DEBUG_FUNC_END("err[%d]", err);
@@ -432,18 +432,17 @@ EXPORT_API int email_add_account_with_validation(emf_account_t* account, unsigne
        char* local_account_stream = NULL;
        int ret = -1;
        int size = 0;
-       int handle_inst = 0;
        int err = EMF_ERROR_NONE;
 
        EM_IF_NULL_RETURN_VALUE(account, false);
 
-       if(em_storage_check_duplicated_account(account, true, &err) == false) {
-               EM_DEBUG_EXCEPTION("em_storage_check_duplicated_account failed (%d) ", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+       if(emstorage_check_duplicated_account(account, true, &err) == false) {
+               EM_DEBUG_EXCEPTION("emstorage_check_duplicated_account failed (%d) ", err);
+
                return err;
        }
 
-       HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_ADD_ACCOUNT_WITH_VALIDATION);
+       HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_ADD_ACCOUNT_WITH_VALIDATION);
 
        EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
 
@@ -452,25 +451,27 @@ EXPORT_API int email_add_account_with_validation(emf_account_t* account, unsigne
 
        EM_PROXY_IF_NULL_RETURN_VALUE(local_account_stream, hAPI, EMF_ERROR_NULL_VALUE);
 
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, local_account_stream, size))
-               EM_DEBUG_EXCEPTION(" ipcEmailAPI_AddParameter  failed ");
-
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION(" ipcEmailProxy_ExecuteAPI failed ");
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, local_account_stream, size)) {
+               EM_DEBUG_EXCEPTION(" emipc_add_parameter  failed ");
                EM_SAFE_FREE(local_account_stream);     
+               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+       }
+
+       if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION(" emipc_execute_proxy_api failed ");
                EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
        }
        
-       ret = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
-       if(ret == 1) {
-               handle_inst = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1);
+       emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &ret);
+       if(ret == EMF_ERROR_NONE) {
                if(handle)
-                       *handle = handle_inst;
-       } else {        /*  get error code */
-               err = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1);
+                       emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), handle);
+       } else {
+               /*  get error code */
+               emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), &err);
        }
        
-       ipcEmailAPI_Destroy(hAPI);
+       emipc_destroy_email_api(hAPI);
        hAPI = NULL;
 
        EM_SAFE_FREE(local_account_stream);
@@ -491,26 +492,28 @@ EXPORT_API int email_backup_accounts_into_secure_storage(const char *file_name)
                return err;
        }
 
-       HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_BACKUP_ACCOUNTS);
+       HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_BACKUP_ACCOUNTS);
 
        EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
 
        /* file_name */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)file_name, strlen(file_name)))
-               EM_DEBUG_EXCEPTION(" ipcEmailAPI_AddParameter account_id  failed ");
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)file_name, strlen(file_name))) {
+               EM_DEBUG_EXCEPTION(" emipc_add_parameter account_id  failed ");
+               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+       }
        
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION(" ipcEmailProxy_ExecuteAPI failed ");
+       if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION(" emipc_execute_proxy_api failed ");
                EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
        }
 
-       ret = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
+       emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &ret);
 
        if(0 == ret) {  /*  get error code */
-               err = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1); 
+               emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), &err);        
        }
 
-       ipcEmailAPI_Destroy(hAPI);
+       emipc_destroy_email_api(hAPI);
 
        hAPI = NULL;
        EM_DEBUG_FUNC_END("err[%d]", err);
@@ -529,26 +532,28 @@ EXPORT_API int email_restore_accounts_from_secure_storage(const char * file_name
                return err;
        }
 
-       HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_RESTORE_ACCOUNTS);
+       HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_RESTORE_ACCOUNTS);
 
        EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
 
        /* file_name */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)file_name, strlen(file_name)))
-               EM_DEBUG_EXCEPTION(" ipcEmailAPI_AddParameter account_id  failed ");
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)file_name, strlen(file_name))) {
+               EM_DEBUG_EXCEPTION(" emipc_add_parameter account_id  failed ");
+               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+       }
        
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION(" ipcEmailProxy_ExecuteAPI failed ");
+       if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION(" emipc_execute_proxy_api failed ");
                EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
        }
 
-       ret = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
+       emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &ret);
 
        if(0==ret) {    /*  get error code */
-               err = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1); 
+               emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), &err);        
        }
 
-       ipcEmailAPI_Destroy(hAPI);
+       emipc_destroy_email_api(hAPI);
 
        hAPI = NULL;
        EM_DEBUG_FUNC_END("err[%d]", err);
@@ -567,35 +572,71 @@ EXPORT_API int email_get_password_length_of_account(const int account_id, int *p
                return err;
        }
 
-       HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_GET_PASSWORD_LENGTH_OF_ACCOUNT);
+       HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_GET_PASSWORD_LENGTH_OF_ACCOUNT);
 
        EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
 
        /* account_id */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&account_id, sizeof(int)))
-               EM_DEBUG_EXCEPTION(" ipcEmailAPI_AddParameter account_id  failed ");
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&account_id, sizeof(int))) {
+               EM_DEBUG_EXCEPTION(" emipc_add_parameter account_id  failed ");
+               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+       }
        
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION(" ipcEmailProxy_ExecuteAPI failed ");
+       if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION(" emipc_execute_proxy_api failed ");
                EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
        }
 
-       ret = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0); /*  return  */
-       err = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1); /*  error code */
-
-       *password_length = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 2);
+       emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &ret);
+       emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), &err);
+       emipc_get_parameter(hAPI, ePARAMETER_OUT, 2, sizeof(int), password_length);
 
-       ipcEmailAPI_Destroy(hAPI);
+       emipc_destroy_email_api(hAPI);
 
        hAPI = NULL;
        EM_DEBUG_FUNC_END("*password_length[%d]", *password_length);
        return err;
 }
 
+EXPORT_API int email_query_server_info(const char* domain_name, emf_server_info_t **result_server_info)
+{
+       EM_DEBUG_FUNC_BEGIN("domain_name [%s], result_server_info [%p]", domain_name, result_server_info);
+       int err = EMF_ERROR_NONE;
+
+       if (!domain_name || !result_server_info)  {     
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
+               err = EMF_ERROR_INVALID_PARAM;  
+               return err;
+       }
+
+       err = emcore_query_server_info(domain_name, result_server_info);
+
+       EM_DEBUG_FUNC_END("err[%d]", err);
+       return err;
+}
+
+
+EXPORT_API int email_free_server_info(emf_server_info_t **result_server_info)
+{
+       EM_DEBUG_FUNC_BEGIN("result_server_info [%p]", result_server_info);
+       int err = EMF_ERROR_NONE;
+
+       if (!result_server_info)  {     
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
+               err = EMF_ERROR_INVALID_PARAM;  
+               return err;
+       }
+
+       err = emcore_free_server_info(result_server_info);
+
+       EM_DEBUG_FUNC_END("ret[%d]", err);
+       return err;
+}
+
 EXPORT_API int email_update_notification_bar(int account_id)
 {
        EM_DEBUG_FUNC_BEGIN("account_id [%d]", account_id);
-       int err = EMF_ERROR_NONE, *return_value = NULL;
+       int err = EMF_ERROR_NONE;
 
        if (account_id == 0)  { 
                EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
@@ -603,24 +644,23 @@ EXPORT_API int email_update_notification_bar(int account_id)
                return err;
        }
 
-       HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_UPDATE_NOTIFICATION_BAR_FOR_UNREAD_MAIL);
+       HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_UPDATE_NOTIFICATION_BAR_FOR_UNREAD_MAIL);
 
        EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
 
        /* account_id */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&account_id, sizeof(int)))
-               EM_DEBUG_EXCEPTION(" ipcEmailAPI_AddParameter account_id  failed");
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&account_id, sizeof(int))) {
+               EM_DEBUG_EXCEPTION(" emipc_add_parameter account_id  failed");
+               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+       }
        
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION(" ipcEmailProxy_ExecuteAPI failed ");
+       if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION(" emipc_execute_proxy_api failed ");
                EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
        }
 
-       return_value = (int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0); /*  error code */;
-       if(return_value)
-               err = *return_value;
-
-       ipcEmailAPI_Destroy(hAPI);
+       emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);
+       emipc_destroy_email_api(hAPI);
 
        hAPI = NULL;
        EM_DEBUG_FUNC_END("ret[%d]", err);
@@ -634,7 +674,7 @@ EXPORT_API int email_clear_all_notification_bar()
        int ret = 0;
        int err = EMF_ERROR_NONE;
 
-       ret = em_core_clear_all_notifications();
+       ret = emcore_clear_all_notifications();
 
        EM_DEBUG_FUNC_END("ret[%d]", ret);
        return err;
@@ -646,7 +686,7 @@ EXPORT_API int email_save_default_account_id(int input_account_id)
        int ret = 0;
        int err = EMF_ERROR_NONE;
 
-       ret = em_core_save_default_account_id(input_account_id);
+       ret = emcore_save_default_account_id(input_account_id);
 
        EM_DEBUG_FUNC_END("ret[%d]", ret);
        return err;
@@ -658,8 +698,8 @@ EXPORT_API int email_load_default_account_id(int *output_account_id)
        int ret = 0;
        int err = EMF_ERROR_NONE;
 
-       ret = em_core_load_default_account_id(output_account_id);
+       ret = emcore_load_default_account_id(output_account_id);
 
        EM_DEBUG_FUNC_END("ret[%d]", ret);
        return err;
-}
\ No newline at end of file
+}
similarity index 68%
rename from MAPI/Emf_Mapi_Init.c
rename to email-api/email-api-init.c
index 2f1805e..000ddc0 100755 (executable)
 /**
  *
  * This file contains the data structures and interfaces needed for application,
- * to interact with Email Engine.
- * @file               Emf_Mapi_Init.c
+ * to interact with email-service.
+ * @file               email-api-init.c
  * @brief              This file contains the data structures and interfaces of Email FW intialization related Functionality provided by 
- *                     Email Engine . 
+ *                     email-service . 
  */
  
-#include <Emf_Mapi.h>
+#include "email-api.h"
 #include "string.h"
-#include "Msg_Convert.h"
-#include "em-storage.h"
-#include "ipc-library.h"
+#include "email-convert.h"
+#include "email-storage.h"
+#include "email-ipc.h"
 #include <sqlite3.h>
 
 
@@ -43,9 +43,9 @@ EXPORT_API int email_open_db(void)
        EM_DEBUG_FUNC_BEGIN();
        int error  = EMF_ERROR_NONE;
        
-       if (em_storage_db_open(&error) == NULL)
-               EM_DEBUG_EXCEPTION("em_storage_db_open failed [%d]", error);
-       error = em_storage_get_emf_error_from_em_storage_error(error);
+       if (emstorage_db_open(&error) == NULL)
+               EM_DEBUG_EXCEPTION("emstorage_db_open failed [%d]", error);
+
        
        EM_DEBUG_FUNC_END("error [%d]", error);
 
@@ -57,9 +57,9 @@ EXPORT_API int email_close_db(void)
        EM_DEBUG_FUNC_BEGIN();
        int error  = EMF_ERROR_NONE;
 
-       if ( !em_storage_db_close(&error)) 
-               EM_DEBUG_EXCEPTION("em_storage_db_close failed [%d]", error);
-       error = em_storage_get_emf_error_from_em_storage_error(error);
+       if ( !emstorage_db_close(&error)) 
+               EM_DEBUG_EXCEPTION("emstorage_db_close failed [%d]", error);
+
        EM_DEBUG_FUNC_END("error [%d]", error);
        return error;   
 }
@@ -72,7 +72,7 @@ EXPORT_API int email_service_begin(void)
 
        signal(SIGPIPE, SIG_IGN); /*  to ignore signal 13(SIGPIPE) */
        
-       ret = ipcEmailProxy_Initialize();
+       ret = emipc_initialize_proxy();
        if (ret != EMF_ERROR_NONE)
                EM_DEBUG_FUNC_END("err[%d]", ret);
        
@@ -85,7 +85,7 @@ EXPORT_API int email_service_end(void)
        EM_DEBUG_FUNC_BEGIN();
        int ret = -1;
        
-       ret = ipcEmailProxy_Finalize();
+       ret = emipc_finalize_proxy();
        if (ret != EMF_ERROR_NONE)
                EM_DEBUG_FUNC_END("err[%d]", ret);
        
@@ -100,10 +100,10 @@ EXPORT_API int email_init_storage(void)
        EM_DEBUG_FUNC_BEGIN();
        int error  = EMF_ERROR_NONE;
        
-       if (!em_storage_create_table(EMF_CREATE_DB_CHECK, &error))  {
-               EM_DEBUG_EXCEPTION("\t em_storage_create_table failed - %d\n", error);
+       if (!emstorage_create_table(EMF_CREATE_DB_CHECK, &error))  {
+               EM_DEBUG_EXCEPTION("emstorage_create_table failed [%d]", error);
        }
-       error = em_storage_get_emf_error_from_em_storage_error(error);
+
        EM_DEBUG_FUNC_END("error[%d]", error);
        return error;
 }
@@ -112,18 +112,18 @@ EXPORT_API int email_ping_service(void)
 {
        EM_DEBUG_FUNC_BEGIN();
        int error  = EMF_ERROR_NONE;
-       HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_PING_SERVICE);
+       HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_PING_SERVICE);
 
        EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
                
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION(" email_ping_service -- ipcEmailProxy_ExecuteAPIFail \n ");
+       if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed");
                EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
        }
 
-       error = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0); 
+       emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &error);
        
-       ipcEmailAPI_Destroy(hAPI);
+       emipc_destroy_email_api(hAPI);
 
        hAPI = NULL;
 
diff --git a/email-api/email-api-mail.c b/email-api/email-api-mail.c
new file mode 100755 (executable)
index 0000000..fd82130
--- /dev/null
@@ -0,0 +1,2225 @@
+/*
+*  email-service
+*
+* Copyright (c) 2000 - 2011 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.
+*
+*/
+
+
+
+/**
+ *
+ * This file contains the data structures and interfaces needed for application,
+ * to interact with email-service.
+ * @file               email-api-mail.c
+ * @brief              This file contains the data structures and interfaces of Message related Functionality provided by 
+ *                     email-service . 
+ */
+
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include "email-api.h"
+#include "email-ipc.h"
+#include "email-convert.h"
+#include "email-core-utils.h"
+#include "email-core-mail.h"
+#include "email-core-smtp.h"
+#include "email-storage.h"
+#include "email-utilities.h"
+#include "db-util.h"
+
+#define  DIR_SEPERATOR_CH '/'
+
+#define _DIRECT_TO_DB
+
+EXPORT_API int email_add_mail(emf_mail_data_t *input_mail_data, emf_attachment_data_t *input_attachment_data_list, int input_attachment_count, emf_meeting_request_t* input_meeting_request, int input_from_eas)
+{
+       EM_DEBUG_FUNC_BEGIN("input_mail_data[%p], input_attachment_data_list[%p], input_attachment_count [%d], input_meeting_request [%p], input_from_eas [%d]", input_mail_data, input_attachment_data_list, input_attachment_count, input_meeting_request, input_from_eas);
+
+       EM_IF_NULL_RETURN_VALUE(input_mail_data,               EMF_ERROR_INVALID_PARAM);
+       EM_IF_NULL_RETURN_VALUE(input_mail_data->account_id,   EMF_ERROR_INVALID_PARAM);
+       EM_IF_NULL_RETURN_VALUE(input_mail_data->mailbox_name, EMF_ERROR_INVALID_PARAM);
+
+       if(input_attachment_count > 0 && !input_attachment_data_list) {
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
+               return EMF_ERROR_INVALID_PARAM;
+       }
+
+       int       err = EMF_ERROR_NONE;
+       int       size = 0;
+       char     *mail_data_stream = NULL;
+       char     *attachment_data_list_stream  = NULL;
+       char     *meeting_request_stream = NULL;
+       HIPC_API  hAPI = NULL;
+       
+       if(input_from_eas == 0) {
+               hAPI = emipc_create_email_api(_EMAIL_API_ADD_MAIL);
+
+               if(!hAPI) {
+                       EM_DEBUG_EXCEPTION("emipc_create_email_api failed");
+                       err = EMF_ERROR_NULL_VALUE;             
+                       goto FINISH_OFF;
+               }
+
+               /* emf_mail_data_t */
+               mail_data_stream = em_convert_mail_data_to_byte_stream(input_mail_data, 1, &size);
+
+               if(!mail_data_stream) {
+                       EM_DEBUG_EXCEPTION("em_convert_mail_data_to_byte_stream failed");
+                       err = EMF_ERROR_NULL_VALUE;
+                       goto FINISH_OFF;
+               }
+
+               if(!emipc_add_parameter(hAPI, ePARAMETER_IN, mail_data_stream, size)) {
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter for head failed");
+                       err = EMF_ERROR_OUT_OF_MEMORY;
+                       goto FINISH_OFF;
+               }
+               
+               /* emf_attachment_data_t */
+               attachment_data_list_stream = em_convert_attachment_data_to_byte_stream(input_attachment_data_list, input_attachment_count, &size);
+
+               if(!attachment_data_list_stream) {
+                       EM_DEBUG_EXCEPTION("em_convert_attachment_data_to_byte_stream failed");
+                       err = EMF_ERROR_NULL_VALUE;
+                       goto FINISH_OFF;
+               }
+
+               if(!emipc_add_parameter(hAPI, ePARAMETER_IN, attachment_data_list_stream, size)) {
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+                       err = EMF_ERROR_OUT_OF_MEMORY;
+                       goto FINISH_OFF;
+               }
+
+               /*  emf_meeting_request_t */
+               if ( input_mail_data->meeting_request_status != EMF_MAIL_TYPE_NORMAL ) {
+                       meeting_request_stream = em_convert_meeting_req_to_byte_stream(input_meeting_request, &size);
+
+                       if(!meeting_request_stream) {
+                               EM_DEBUG_EXCEPTION("em_convert_meeting_req_to_byte_stream failed");
+                               err = EMF_ERROR_NULL_VALUE;
+                               goto FINISH_OFF;
+                       }
+
+                       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, meeting_request_stream, size)) {
+                               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+                               err = EMF_ERROR_OUT_OF_MEMORY;
+                               goto FINISH_OFF;
+                       }
+               }
+
+               /* input_from_eas */
+               if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&input_from_eas, sizeof(int))) {
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+                       err = EMF_ERROR_OUT_OF_MEMORY;
+                       goto FINISH_OFF;
+               }
+
+               /* Execute API */
+               if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+                       EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed");
+                       err = EMF_ERROR_IPC_SOCKET_FAILURE;
+                       goto FINISH_OFF;
+               }
+
+               emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);
+
+               if(err == EMF_ERROR_NONE) {
+                       emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), &input_mail_data->mail_id); /* result mail_id */
+                       emipc_get_parameter(hAPI, ePARAMETER_OUT, 2, sizeof(int), &input_mail_data->thread_id); /* result thread_id */
+               }
+       } 
+       else {
+               if((err = emcore_add_mail(input_mail_data, input_attachment_data_list, input_attachment_count, input_meeting_request, input_from_eas)) != EMF_ERROR_NONE) {
+                       EM_DEBUG_EXCEPTION("emcore_add_mail failed [%d]", err);
+                       goto FINISH_OFF;
+               }
+       }
+
+FINISH_OFF:
+       if(hAPI) 
+               emipc_destroy_email_api(hAPI);
+
+       EM_SAFE_FREE(mail_data_stream);
+       EM_SAFE_FREE(attachment_data_list_stream);
+
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+
+}
+
+EXPORT_API int email_add_read_receipt(int input_read_mail_id, int *output_receipt_mail_id)
+{
+       EM_DEBUG_FUNC_BEGIN("input_read_mail_id [%d], output_receipt_mail_id [%p]", input_read_mail_id, output_receipt_mail_id);
+
+       EM_IF_NULL_RETURN_VALUE(output_receipt_mail_id, EMF_ERROR_INVALID_PARAM);
+
+       int      err = EMF_ERROR_NONE;
+       HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_ADD_READ_RECEIPT);
+
+       EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
+
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, &input_read_mail_id, sizeof(int))) {
+               EM_DEBUG_EXCEPTION("Add Param mail body Fail");
+               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+       }
+
+       /* Execute API */
+       if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed");
+               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
+       }
+
+       emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);
+
+       EM_DEBUG_LOG("err [%d]", err);
+
+       if(err == EMF_ERROR_NONE) {
+               /* Get receipt mail id */
+               emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), output_receipt_mail_id);
+               EM_DEBUG_LOG("output_receipt_mail_id [%d]", *output_receipt_mail_id);
+       }
+
+       emipc_destroy_email_api(hAPI);
+
+       hAPI = NULL;
+
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+}
+
+
+int email_create_db_full()
+{
+       int mailbox_index, mail_index, mailbox_count, mail_slot_size;
+       emstorage_mail_tbl_t mail_table_data = {0};
+       emf_mailbox_t *mailbox_list = NULL;
+       int err = EMF_ERROR_NONE;
+
+       if ( (err = email_open_db()) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("email_open_db failed [%d]", err);
+               return err;
+       }
+
+       mail_table_data.subject = (char*) em_malloc(50); 
+       mail_table_data.full_address_from = strdup("<dummy_from@nowhere.com>");
+       mail_table_data.full_address_to = strdup("<dummy_to@nowhere.com>");
+       mail_table_data.account_id =1;
+       mail_table_data.mailbox_name = (char*) em_malloc(250);
+
+       if( (err = email_get_mailbox_list_ex(1, -1, 0, &mailbox_list, &mailbox_count)) < EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("email_get_mailbox_list_ex failed [%d]", err);
+               goto FINISH_OFF;
+       }
+
+       for(mailbox_index = 0; mailbox_index < mailbox_count; mailbox_index++) {
+               mail_slot_size= mailbox_list[mailbox_index].mail_slot_size;
+               for(mail_index = 0; mail_index < mail_slot_size; mail_index++) {
+                       sprintf(mail_table_data.subject, "Subject #%d",mail_index);
+                       strncpy(mail_table_data.mailbox_name, mailbox_list[mailbox_index].name, 250 - 1);
+                       mail_table_data.mailbox_type = mailbox_list[mailbox_index].mailbox_type;
+                       if( !emstorage_add_mail(&mail_table_data, 1, true, &err))  {
+                               EM_DEBUG_EXCEPTION("emstorage_add_mail failed [%d]",err);
+               
+                               goto FINISH_OFF;
+                       }
+               }
+       }
+
+FINISH_OFF:
+       if ( (err = email_close_db()) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("email_close_db failed [%d]", err);
+       }       
+       
+       if(mailbox_list)
+               email_free_mailbox(&mailbox_list, mailbox_count);
+
+       EM_SAFE_FREE(mail_table_data.subject);
+       EM_SAFE_FREE(mail_table_data.mailbox_name);
+       EM_SAFE_FREE(mail_table_data.full_address_from);
+       EM_SAFE_FREE(mail_table_data.full_address_to);
+
+       return err;
+}
+
+EXPORT_API int email_update_mail(emf_mail_data_t *input_mail_data, emf_attachment_data_t *input_attachment_data_list, int input_attachment_count, emf_meeting_request_t* input_meeting_request, int input_from_eas)
+{
+       EM_DEBUG_FUNC_BEGIN("input_mail_data[%p], input_attachment_data_list[%p], input_attachment_count [%d], input_meeting_request [%p], input_from_eas [%d]", input_mail_data, input_attachment_data_list, input_attachment_count, input_meeting_request, input_from_eas);
+
+       EM_IF_NULL_RETURN_VALUE(input_mail_data,               EMF_ERROR_INVALID_PARAM);
+       EM_IF_NULL_RETURN_VALUE(input_mail_data->account_id,   EMF_ERROR_INVALID_PARAM);
+       EM_IF_NULL_RETURN_VALUE(input_mail_data->mailbox_name, EMF_ERROR_INVALID_PARAM);
+
+       if(input_attachment_count > 0 && !input_attachment_data_list) {
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
+               return EMF_ERROR_INVALID_PARAM;
+       }
+
+       int       err = EMF_ERROR_NONE;
+       int       size = 0;
+       char     *mail_data_stream = NULL;
+       char     *attachment_data_list_stream  = NULL;
+       char     *meeting_request_stream = NULL;
+
+       HIPC_API  hAPI = NULL;
+       
+       if(input_from_eas == 0) {
+               hAPI = emipc_create_email_api(_EMAIL_API_UPDATE_MAIL);  
+
+               if(!hAPI) {
+                       EM_DEBUG_EXCEPTION("emipc_create_email_api failed");
+                       err = EMF_ERROR_NULL_VALUE;             
+                       goto FINISH_OFF;
+               }
+
+               /* emf_mail_data_t */
+               mail_data_stream = em_convert_mail_data_to_byte_stream(input_mail_data, 1, &size);
+
+               if(!mail_data_stream) {
+                       EM_DEBUG_EXCEPTION("em_convert_mail_data_to_byte_stream failed");
+                       err = EMF_ERROR_NULL_VALUE;
+                       goto FINISH_OFF;
+               }
+               
+               if(!emipc_add_parameter(hAPI, ePARAMETER_IN, mail_data_stream, size)) {
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter for head failed");
+                       err = EMF_ERROR_OUT_OF_MEMORY;
+                       goto FINISH_OFF;
+               }
+               
+               /* emf_attachment_data_t */
+               attachment_data_list_stream = em_convert_attachment_data_to_byte_stream(input_attachment_data_list, input_attachment_count, &size);
+
+               if(!attachment_data_list_stream) {
+                       EM_DEBUG_EXCEPTION("em_convert_attachment_data_to_byte_stream failed");
+                       err = EMF_ERROR_NULL_VALUE;
+                       goto FINISH_OFF;
+               }
+
+               if(!emipc_add_parameter(hAPI, ePARAMETER_IN, attachment_data_list_stream, size)) {
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+                       err = EMF_ERROR_OUT_OF_MEMORY;
+                       goto FINISH_OFF;
+               }
+
+               /*  emf_meeting_request_t */
+               if ( input_mail_data->meeting_request_status != EMF_MAIL_TYPE_NORMAL ) {
+                       meeting_request_stream = em_convert_meeting_req_to_byte_stream(input_meeting_request, &size);
+
+                       if(!meeting_request_stream) {
+                               EM_DEBUG_EXCEPTION("em_convert_meeting_req_to_byte_stream failed");
+                               err = EMF_ERROR_NULL_VALUE;
+                               goto FINISH_OFF;
+                       }
+
+                       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, meeting_request_stream, size)) {
+                               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+                               err = EMF_ERROR_OUT_OF_MEMORY;
+                               goto FINISH_OFF;
+                       }
+               }
+
+               /* input_from_eas */
+               if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&input_from_eas, sizeof(int))) {
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+                       err = EMF_ERROR_OUT_OF_MEMORY;
+                       goto FINISH_OFF;
+               }
+
+               /* Execute API */
+               if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+                       EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed");
+                       err = EMF_ERROR_IPC_SOCKET_FAILURE;
+                       goto FINISH_OFF;
+               }
+
+               emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);
+               
+               if(err == EMF_ERROR_NONE) {
+                       emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), &input_mail_data->mail_id);
+                       emipc_get_parameter(hAPI, ePARAMETER_OUT, 2, sizeof(int), &input_mail_data->thread_id);
+               }
+       } 
+       else {
+               if( (err = emcore_update_mail(input_mail_data, input_attachment_data_list, input_attachment_count, input_meeting_request, input_from_eas)) != EMF_ERROR_NONE) {
+                       EM_DEBUG_EXCEPTION("emcore_update_mail failed [%d]", err);
+                       goto FINISH_OFF;
+               }
+       }
+
+FINISH_OFF:
+       if(hAPI) 
+               emipc_destroy_email_api(hAPI);
+
+       EM_SAFE_FREE(mail_data_stream);
+       EM_SAFE_FREE(attachment_data_list_stream);
+
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+
+}
+
+EXPORT_API int email_clear_mail_data()
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int err = EMF_ERROR_NONE;
+       
+       HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_CLEAR_DATA);  
+
+       EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
+       
+       if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("emipc_execute_proxy_api Fail");
+               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
+       }
+       emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);
+       
+       if(hAPI)
+               emipc_destroy_email_api(hAPI);
+
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+}
+
+
+EXPORT_API int email_count_message(emf_mailbox_t* mailbox, int* total, int* unseen)
+{
+       EM_DEBUG_FUNC_BEGIN("mailbox[%p], total[%p], unseen[%p]", mailbox, total, unseen);
+       
+       int total_count = 0;
+       int unread = 0;
+       int err = EMF_ERROR_NONE;
+
+       EM_IF_NULL_RETURN_VALUE(mailbox, EMF_ERROR_INVALID_PARAM);
+       EM_IF_NULL_RETURN_VALUE(total, EMF_ERROR_INVALID_PARAM);
+       EM_IF_NULL_RETURN_VALUE(unseen, EMF_ERROR_INVALID_PARAM);
+
+       if (!emstorage_get_mail_count(mailbox->account_id,  mailbox->name, &total_count, &unread, true, &err)) {
+               EM_DEBUG_EXCEPTION("emstorage_get_mail_count Failed");
+
+       } else {
+               *total = total_count;
+               *unseen = unread;
+       }
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+}
+
+
+
+
+EXPORT_API int  email_count_message_all_mailboxes(emf_mailbox_t* mailbox, int* total, int* unseen)
+{
+       EM_DEBUG_FUNC_BEGIN("mailbox[%p], total[%p], unseen[%p]", mailbox, total, unseen);
+       
+       int total_count = 0;
+       int unread = 0;
+       int err = EMF_ERROR_NONE;
+               
+       EM_IF_NULL_RETURN_VALUE(mailbox, EMF_ERROR_INVALID_PARAM);
+       EM_IF_NULL_RETURN_VALUE(total, EMF_ERROR_INVALID_PARAM);
+       EM_IF_NULL_RETURN_VALUE(unseen, EMF_ERROR_INVALID_PARAM);
+       EM_IF_ACCOUNT_ID_NULL(mailbox->account_id, EMF_ERROR_INVALID_PARAM); 
+
+    if (!emstorage_get_mail_count(mailbox->account_id,  NULL, &total_count, &unread, true, &err)) {
+               EM_DEBUG_EXCEPTION("emstorage_get_mail_count Failed");
+
+       } else {
+               *total = total_count;
+               *unseen = unread;
+       }
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+}
+
+
+
+EXPORT_API int email_delete_message(emf_mailbox_t* mailbox, int *mail_ids, int num, int from_server)
+{
+       EM_DEBUG_FUNC_BEGIN("mailbox[%p], mail_id[%p], num[%d], from_server[%d]", mailbox, mail_ids, num, from_server);
+
+       char* mailbox_stream = NULL;
+       int size = 0;
+       int err = EMF_ERROR_NONE;
+       HIPC_API hAPI = NULL;
+
+       EM_IF_NULL_RETURN_VALUE(mailbox, EMF_ERROR_INVALID_PARAM);
+       EM_IF_NULL_RETURN_VALUE(mail_ids, EMF_ERROR_INVALID_PARAM);
+       EM_IF_ACCOUNT_ID_NULL(mailbox->account_id, EMF_ERROR_INVALID_PARAM); 
+       
+       if (num <= 0) {
+               EM_DEBUG_EXCEPTION("num = %d", num);
+               err = EMF_ERROR_INVALID_PARAM;          
+               return err;
+       }
+
+       hAPI = emipc_create_email_api(_EMAIL_API_DELETE_MAIL);
+       
+       if(!hAPI) {
+               EM_DEBUG_EXCEPTION("emipc_create_email_api failed");
+               err = EMF_ERROR_NULL_VALUE;             
+               goto FINISH_OFF;
+       }
+
+       /* mailbox */
+       mailbox_stream = em_convert_mailbox_to_byte_stream(mailbox, &size);
+
+       if(!mailbox_stream) {
+               EM_DEBUG_EXCEPTION("em_convert_mailbox_to_byte_stream failed");
+               err = EMF_ERROR_NULL_VALUE;             
+               goto FINISH_OFF;
+       }
+       
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, mailbox_stream, size)) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               err = EMF_ERROR_OUT_OF_MEMORY;          
+               goto FINISH_OFF;
+       }
+
+       /* Number of mail_ids */
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&num, sizeof(int))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               err = EMF_ERROR_OUT_OF_MEMORY;          
+               goto FINISH_OFF;
+       }
+       
+       /* set of mail_ids */
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)mail_ids, num * sizeof(int))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               err = EMF_ERROR_OUT_OF_MEMORY;          
+               goto FINISH_OFF;
+       }
+       
+       /* from-server */
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&from_server, sizeof(int))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               err = EMF_ERROR_OUT_OF_MEMORY;          
+               goto FINISH_OFF;
+       }
+       
+       if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed");
+               err = EMF_ERROR_IPC_SOCKET_FAILURE;     
+               goto FINISH_OFF;
+       }
+
+       emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);
+
+FINISH_OFF:
+       if(hAPI)
+               emipc_destroy_email_api(hAPI);
+
+       EM_SAFE_FREE(mailbox_stream); 
+
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+}
+
+
+EXPORT_API int email_delete_all_message_in_mailbox(emf_mailbox_t* mailbox, int from_server)
+{
+       EM_DEBUG_FUNC_BEGIN("mailbox[%p], from_server[%d]", mailbox, from_server);
+
+       char* mailbox_stream = NULL;
+       int size = 0;
+       int err = EMF_ERROR_NONE;
+       HIPC_API hAPI = NULL;
+       
+       EM_IF_NULL_RETURN_VALUE(mailbox, EMF_ERROR_INVALID_PARAM);
+       EM_IF_ACCOUNT_ID_NULL(mailbox->account_id, EMF_ERROR_INVALID_PARAM); 
+       
+       hAPI =emipc_create_email_api(_EMAIL_API_DELETE_ALL_MAIL);       
+
+       if(!hAPI) {
+               EM_DEBUG_EXCEPTION("emipc_create_email_api failed");
+               err = EMF_ERROR_NULL_VALUE;             
+               goto FINISH_OFF;
+       }
+
+       mailbox_stream = em_convert_mailbox_to_byte_stream(mailbox, &size);
+
+       if(!mailbox_stream) {
+               EM_DEBUG_EXCEPTION("em_convert_mailbox_to_byte_stream failed");
+               err = EMF_ERROR_NULL_VALUE;             
+               goto FINISH_OFF;
+       }
+       
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, mailbox_stream, size)) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               err = EMF_ERROR_OUT_OF_MEMORY;          
+               goto FINISH_OFF;
+       }
+
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&from_server, sizeof(int))){
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               err = EMF_ERROR_OUT_OF_MEMORY;          
+               goto FINISH_OFF;
+       }
+       
+       if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed");
+               err = EMF_ERROR_IPC_SOCKET_FAILURE;             
+               goto FINISH_OFF;
+       }
+       
+       emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int),&err );
+
+FINISH_OFF:
+
+       if(hAPI)        
+               emipc_destroy_email_api(hAPI);
+
+       EM_SAFE_FREE(mailbox_stream);
+       
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+}
+
+
+
+EXPORT_API int email_add_attachment( emf_mailbox_t* mailbox, int mail_id, emf_attachment_info_t* attachment)
+{
+       EM_DEBUG_FUNC_BEGIN("mailbox[%p], mail_id[%d], attachment[%p]", mailbox, mail_id, attachment);
+       int err = EMF_ERROR_NONE;
+       char* mailbox_stream = NULL;
+       char* pAttchStream = NULL;
+       int size = 0;
+       HIPC_API hAPI = NULL;
+       
+       EM_IF_NULL_RETURN_VALUE(mailbox, EMF_ERROR_INVALID_PARAM);
+       EM_IF_NULL_RETURN_VALUE(mail_id, EMF_ERROR_INVALID_PARAM);
+       EM_IF_NULL_RETURN_VALUE(attachment, EMF_ERROR_INVALID_PARAM);
+       EM_IF_ACCOUNT_ID_NULL(mailbox->account_id, EMF_ERROR_INVALID_PARAM);
+       
+       hAPI = emipc_create_email_api(_EMAIL_API_ADD_ATTACHMENT);
+
+       if(!hAPI) {
+               EM_DEBUG_EXCEPTION("emipc_create_email_api failed");
+               err = EMF_ERROR_NULL_VALUE;             
+               goto FINISH_OFF;
+       }
+
+       /* Mailbox */
+       mailbox_stream = em_convert_mailbox_to_byte_stream(mailbox, &size);
+
+       if(!mailbox_stream) {
+               EM_DEBUG_EXCEPTION("em_convert_mailbox_to_byte_stream failed");
+               err = EMF_ERROR_NULL_VALUE;             
+               goto FINISH_OFF;
+       }
+
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, mailbox_stream, size)) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               err = EMF_ERROR_OUT_OF_MEMORY;          
+               goto FINISH_OFF;
+       }
+
+       /* mail_id */
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&mail_id, sizeof(int))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               err = EMF_ERROR_OUT_OF_MEMORY;          
+               goto FINISH_OFF;
+       }
+
+       /* Attachment */
+       pAttchStream = em_convert_attachment_info_to_byte_stream(attachment, &size);
+
+       if(!pAttchStream) {
+               EM_DEBUG_EXCEPTION("em_convert_attachment_info_to_byte_stream failed");
+               err = EMF_ERROR_NULL_VALUE;             
+               goto FINISH_OFF;
+       }
+
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, pAttchStream, size)){
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               err = EMF_ERROR_OUT_OF_MEMORY;          
+               goto FINISH_OFF;
+       }
+
+       /* Execute API */
+       if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed");
+               err = EMF_ERROR_IPC_SOCKET_FAILURE;             
+               goto FINISH_OFF;
+       }
+
+       emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);
+       
+       if(EMF_ERROR_NONE == err) {
+               emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), &attachment->attachment_id);
+       }
+
+FINISH_OFF:
+       EM_SAFE_FREE(mailbox_stream);
+       EM_SAFE_FREE(pAttchStream);
+       
+       if(hAPI)
+               emipc_destroy_email_api(hAPI);
+       
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+ }
+
+
+EXPORT_API int email_delete_attachment(emf_mailbox_t * mailbox, int mail_id, const char *attachment_id)
+{
+       EM_DEBUG_FUNC_BEGIN("mailbox[%p], mail_id[%d], attachment_id[%s]", mailbox, mail_id, attachment_id);
+       int err = EMF_ERROR_NONE;
+       char* mailbox_stream = NULL;
+       int size = 0;
+
+       HIPC_API hAPI = NULL;
+       
+       EM_IF_NULL_RETURN_VALUE(mailbox, EMF_ERROR_INVALID_PARAM);
+       EM_IF_NULL_RETURN_VALUE(mail_id, EMF_ERROR_INVALID_PARAM);
+       EM_IF_NULL_RETURN_VALUE(attachment_id, EMF_ERROR_INVALID_PARAM);
+       
+       hAPI = emipc_create_email_api(_EMAIL_API_DELETE_ATTACHMENT);
+       
+       if(!hAPI) {
+               EM_DEBUG_EXCEPTION("emipc_create_email_api failed");
+               err = EMF_ERROR_NULL_VALUE;             
+               goto FINISH_OFF;
+       }
+
+       /* Mailbox */
+       mailbox_stream = em_convert_mailbox_to_byte_stream(mailbox, &size);
+
+       if(!mailbox_stream) {
+               EM_DEBUG_EXCEPTION("em_convert_mailbox_to_byte_stream failed");
+               err = EMF_ERROR_NULL_VALUE;             
+               goto FINISH_OFF;
+       }
+
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, mailbox_stream, size)) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               err = EMF_ERROR_OUT_OF_MEMORY;          
+               goto FINISH_OFF;
+       }
+
+       /* mail_id */
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&mail_id, sizeof(int))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               err = EMF_ERROR_OUT_OF_MEMORY;          
+               goto FINISH_OFF;
+       }
+
+       /* attachment_id */
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)attachment_id, strlen(attachment_id))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               err = EMF_ERROR_OUT_OF_MEMORY;          
+               goto FINISH_OFF;
+       }
+
+       /* Execute API */
+       if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed");
+               err = EMF_ERROR_IPC_SOCKET_FAILURE;             
+               goto FINISH_OFF;
+       }
+
+       emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);
+
+FINISH_OFF:
+       if(hAPI)
+               emipc_destroy_email_api(hAPI);
+
+       EM_SAFE_FREE(mailbox_stream);
+
+       return err;
+}
+
+/* -----------------------------------------------------------
+                                             Mail Search API
+    -----------------------------------------------------------*/
+
+EXPORT_API int email_query_mails(char *conditional_clause_string, emf_mail_data_t** mail_list,  int *result_count)
+{
+       EM_DEBUG_FUNC_BEGIN("conditional_clause_string [%s], mail_list [%p], result_count [%p]", conditional_clause_string, mail_list, result_count);
+
+       int err = EMF_ERROR_NONE;
+       emstorage_mail_tbl_t *result_mail_tbl;
+       
+       EM_IF_NULL_RETURN_VALUE(result_count, EMF_ERROR_INVALID_PARAM);
+       EM_IF_NULL_RETURN_VALUE(conditional_clause_string, EMF_ERROR_INVALID_PARAM);
+
+       if (!emstorage_query_mail_tbl(conditional_clause_string, true, &result_mail_tbl, result_count, &err)) {
+               EM_DEBUG_EXCEPTION("emstorage_query_mail_list failed [%d]", err);
+
+               goto FINISH_OFF;
+       }
+
+       if(!em_convert_mail_tbl_to_mail_data(result_mail_tbl, *result_count, mail_list, &err)) {
+               EM_DEBUG_EXCEPTION("em_convert_mail_tbl_to_mail_data failed [%d]", err);
+               goto FINISH_OFF;
+       }
+
+FINISH_OFF:    
+       if(result_mail_tbl && !emstorage_free_mail(&result_mail_tbl, *result_count, &err))
+               EM_DEBUG_EXCEPTION("emstorage_free_mail failed [%d]", err);
+
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+}
+
+EXPORT_API int email_query_message_ex(char *conditional_clause_string, emf_mail_list_item_t** mail_list,  int *result_count)
+{
+       EM_DEBUG_FUNC_BEGIN("conditional_clause_string [%s], mail_list [%p], result_count [%p]", conditional_clause_string, mail_list, result_count);
+
+       int err = EMF_ERROR_NONE;
+       
+       EM_IF_NULL_RETURN_VALUE(result_count, EMF_ERROR_INVALID_PARAM);
+       EM_IF_NULL_RETURN_VALUE(conditional_clause_string, EMF_ERROR_INVALID_PARAM);
+
+       if (!emstorage_query_mail_list(conditional_clause_string, true, mail_list, result_count, &err)) {
+               EM_DEBUG_EXCEPTION("emstorage_query_mail_list failed [%d]", err);
+
+               goto FINISH_OFF;
+       }
+
+FINISH_OFF:    
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+}
+
+
+/* -----------------------------------------------------------
+                                             Mail Get Info API
+    -----------------------------------------------------------*/
+EXPORT_API int email_get_attachment_info(emf_mailbox_t* mailbox, int mail_id, const char* attachment_id, emf_attachment_info_t** attachment)
+{
+       EM_DEBUG_FUNC_BEGIN("mailbox[%p], mail_id[%d], attachment_id[%s], attachment[%p]", mailbox, mail_id, attachment_id, attachment);
+       
+       int err = EMF_ERROR_NONE;
+       int size = 0;
+       int nSize = 0;
+       char* mailbox_stream = NULL;
+       char* pAttchStream = NULL;
+       emf_attachment_info_t* pAttch = NULL;
+       
+
+       EM_IF_NULL_RETURN_VALUE(mailbox, EMF_ERROR_INVALID_PARAM);
+       EM_IF_NULL_RETURN_VALUE(mail_id, EMF_ERROR_INVALID_PARAM);
+       EM_IF_NULL_RETURN_VALUE(attachment_id, EMF_ERROR_INVALID_PARAM);
+       EM_IF_NULL_RETURN_VALUE(attachment, EMF_ERROR_INVALID_PARAM);
+       EM_IF_ACCOUNT_ID_NULL(mailbox->account_id, EMF_ERROR_INVALID_PARAM); 
+       
+       HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_GET_ATTACHMENT);
+
+       EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
+
+       /* Mailbox */
+       mailbox_stream = em_convert_mailbox_to_byte_stream(mailbox, &size);
+
+       if(!mailbox_stream) {
+               EM_DEBUG_EXCEPTION("em_convert_mailbox_to_byte_stream failed");
+               err = EMF_ERROR_NULL_VALUE;             
+               goto FINISH_OFF;
+       }
+
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, mailbox_stream, size)) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               err = EMF_ERROR_OUT_OF_MEMORY;          
+               goto FINISH_OFF;
+       }
+
+       /* mail_id */
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&mail_id, sizeof(int))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               err = EMF_ERROR_OUT_OF_MEMORY;          
+               goto FINISH_OFF;
+       }
+
+       
+       /* attachment_id */
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)attachment_id, strlen(attachment_id))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               err = EMF_ERROR_OUT_OF_MEMORY;          
+               goto FINISH_OFF;
+       }
+
+       /* Execute API */
+       if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed");
+               err = EMF_ERROR_IPC_SOCKET_FAILURE;             
+               goto FINISH_OFF;
+       }
+
+       emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);
+
+       if(EMF_ERROR_NONE == err) {
+               nSize = emipc_get_parameter_length(hAPI, ePARAMETER_OUT, 1);
+               if(nSize > 0) {
+                       pAttchStream = (char*)em_malloc(nSize+1);
+
+                       if(!pAttchStream) {
+                               EM_DEBUG_EXCEPTION("em_malloc failed");
+                               err = EMF_ERROR_OUT_OF_MEMORY;          
+                               goto FINISH_OFF;
+                       }       
+               
+                       emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, nSize, pAttchStream);
+                       em_convert_byte_stream_to_attachment_info(pAttchStream, 1, &pAttch);
+               }
+               
+               if(!pAttch) {
+                       EM_DEBUG_EXCEPTION("EMF_ERROR_NULL_VALUE");
+                       err = EMF_ERROR_NULL_VALUE;             
+                       goto FINISH_OFF;
+               }
+
+               *attachment = pAttch;
+       }
+
+FINISH_OFF:
+       EM_SAFE_FREE(pAttchStream);
+
+       if(hAPI)
+               emipc_destroy_email_api(hAPI);
+
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+
+}
+
+EXPORT_API int email_get_attachment_data_list(int input_mail_id, emf_attachment_data_t **output_attachment_data, int *output_attachment_count)
+{
+       EM_DEBUG_FUNC_BEGIN("input_mail_id[%d], output_attachment_data[%p], output_attachment_count[%p]", input_mail_id, output_attachment_data, output_attachment_count);
+       int err = EMF_ERROR_NONE;
+       
+       if((err = emcore_get_attachment_data_list(input_mail_id, output_attachment_data, output_attachment_count)) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("emcore_get_attachment_data_list failed [%d]", err);
+       }
+
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+}
+
+EXPORT_API int email_free_attachment_info(emf_attachment_info_t** atch_info)
+{
+       EM_DEBUG_FUNC_BEGIN("atch_info[%p]", atch_info);        
+       
+       int err = EMF_ERROR_NONE;
+
+       if (!atch_info || !*atch_info)
+               return EMF_ERROR_INVALID_PARAM;
+       
+       emf_attachment_info_t* p = *atch_info;
+       emf_attachment_info_t* t;
+       
+       while (p)  {
+               EM_SAFE_FREE(p->name);
+               EM_SAFE_FREE(p->savename);
+               t = p->next;
+               EM_SAFE_FREE(p);
+               p = t;
+       }
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+}
+
+EXPORT_API int email_free_attachment_data(emf_attachment_data_t **attachment_data_list, int attachment_data_count)
+{
+       EM_DEBUG_FUNC_BEGIN("attachment_data_list[%p], attachment_data_count[%d]", attachment_data_list, attachment_data_count);        
+       
+       int err = EMF_ERROR_NONE;
+
+       emcore_free_attachment_data(attachment_data_list, attachment_data_count, &err);
+       
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+}
+
+
+EXPORT_API int email_get_mails(int account_id , const char *mailbox_name, int thread_id, int start_index, int limit_count, emf_sort_type_t sorting, emf_mail_data_t** mail_list,  int* result_count)
+{
+       EM_DEBUG_FUNC_BEGIN();
+
+       int err = EMF_ERROR_NONE;
+       emstorage_mail_tbl_t *mail_tbl_list = NULL;
+       EM_IF_NULL_RETURN_VALUE(result_count, EMF_ERROR_INVALID_PARAM);
+
+       if( account_id < ALL_ACCOUNT) {
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
+               err = EMF_ERROR_INVALID_PARAM ;
+               goto FINISH_OFF;
+       }
+
+       if (!emstorage_get_mails(account_id, (char*)mailbox_name, NULL, thread_id, start_index, limit_count, sorting, true, &mail_tbl_list, result_count, &err))  {
+               EM_DEBUG_EXCEPTION("emstorage_get_mails failed [%d]", err);
+
+               goto FINISH_OFF;
+       }
+
+       if(!em_convert_mail_tbl_to_mail_data(mail_tbl_list, *result_count, mail_list, &err)) {
+               EM_DEBUG_EXCEPTION("em_convert_mail_tbl_to_mail_data failed [%d]", err);
+               goto FINISH_OFF;
+       }
+
+FINISH_OFF:    
+       if(mail_tbl_list && !emstorage_free_mail(&mail_tbl_list, *result_count, &err))
+               EM_DEBUG_EXCEPTION("emstorage_free_mail failed [%d]", err);
+
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+}
+
+EXPORT_API int email_get_mail_list_ex(int account_id , const char *mailbox_name, int thread_id, int start_index, int limit_count, emf_sort_type_t sorting, emf_mail_list_item_t** mail_list,  int* result_count)
+{
+       EM_DEBUG_FUNC_BEGIN();
+
+       int err = EMF_ERROR_NONE;
+       
+       EM_IF_NULL_RETURN_VALUE(result_count, EMF_ERROR_INVALID_PARAM);
+
+       if( account_id < ALL_ACCOUNT) {
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
+               return EMF_ERROR_INVALID_PARAM;
+       }
+
+       if (!emstorage_get_mail_list(account_id, (char*) mailbox_name, NULL, thread_id, start_index, limit_count, 0, NULL, sorting, true, mail_list, result_count, &err))  {
+               EM_DEBUG_EXCEPTION("emstorage_get_mail_list failed [%d]", err);
+
+               goto FINISH_OFF;
+       }
+
+FINISH_OFF:    
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+}
+
+EXPORT_API int email_find_mail (int account_id , const char *mailbox_name, int thread_id, 
+       int search_type, char *search_value, int start_index, int limit_count,
+       emf_sort_type_t sorting, emf_mail_list_item_t** mail_list,  int* result_count)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       
+       int err = EMF_ERROR_NONE;
+       int search_num = 0;
+       emf_mail_list_item_t* mail_list_item = NULL;
+
+       EM_IF_NULL_RETURN_VALUE(mail_list, EMF_ERROR_INVALID_PARAM);
+       EM_IF_NULL_RETURN_VALUE(result_count, EMF_ERROR_INVALID_PARAM);
+       EM_IF_NULL_RETURN_VALUE(search_value, EMF_ERROR_INVALID_PARAM);
+
+       switch ( search_type ) {
+               case EMF_SEARCH_FILTER_SUBJECT:
+               case EMF_SEARCH_FILTER_SENDER:
+               case EMF_SEARCH_FILTER_RECIPIENT:
+               case EMF_SEARCH_FILTER_ALL:
+                       break;
+               default:
+                       EM_DEBUG_EXCEPTION("Invalid search filter type[%d]", search_type);
+                       err = EMF_ERROR_INVALID_PARAM;
+                       return err;
+       }
+
+       if (!emstorage_get_searched_mail_list(account_id, (char*)mailbox_name, thread_id, search_type, search_value,  start_index, limit_count, sorting, true, &mail_list_item, &search_num, &err)) {
+               EM_DEBUG_EXCEPTION("emstorage_search_mails -- Failed [%d]", err);
+
+               goto FINISH_OFF;
+       }
+
+       *mail_list = mail_list_item;
+       *result_count = search_num;
+       
+FINISH_OFF:    
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+}
+
+EXPORT_API int email_get_mail_by_address(int account_id , const char *mailbox_name, emf_email_address_list_t* addr_list, 
+                                                                       int start_index, int limit_count, int search_type, const char *search_value, emf_sort_type_t sorting, emf_mail_list_item_t** mail_list,  int* result_count)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int err = EMF_ERROR_NONE;
+
+       emf_mail_list_item_t* mail_list_item = NULL;
+       
+       EM_IF_NULL_RETURN_VALUE(mail_list, EMF_ERROR_INVALID_PARAM);
+       EM_IF_NULL_RETURN_VALUE(result_count, EMF_ERROR_INVALID_PARAM);
+
+       if( account_id < ALL_ACCOUNT) {
+               EM_DEBUG_EXCEPTION("Invalid account id param");
+               err = EMF_ERROR_INVALID_PARAM ;
+               return err;
+       }
+
+       if (!emstorage_get_mail_list(account_id, (char*)mailbox_name, addr_list, EMF_LIST_TYPE_NORMAL, start_index, limit_count, search_type, search_value, sorting, true, &mail_list_item, result_count, &err)) {
+               EM_DEBUG_EXCEPTION("emstorage_get_mail_list failed [%d]", err);
+
+               goto FINISH_OFF;
+       }
+
+       *mail_list = mail_list_item;
+
+FINISH_OFF:
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+}
+
+EXPORT_API int email_get_thread_information_by_thread_id(int thread_id, emf_mail_data_t** thread_info)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int err = EMF_ERROR_NONE;
+       emstorage_mail_tbl_t *mail_table_data = NULL;
+       
+       EM_IF_NULL_RETURN_VALUE(thread_info, EMF_ERROR_INVALID_PARAM);
+
+       if (!emstorage_get_thread_information(thread_id, &mail_table_data , true, &err)) {
+               EM_DEBUG_EXCEPTION("emstorage_get_thread_information  failed [%d]", err);
+               goto FINISH_OFF;
+       }
+
+       if(!em_convert_mail_tbl_to_mail_data(mail_table_data, 1, thread_info, &err)) {
+               EM_DEBUG_EXCEPTION("em_convert_mail_tbl_to_mail_data failed [%d]", err);
+               goto FINISH_OFF;
+       }
+
+FINISH_OFF:    
+
+       if(mail_table_data && !emstorage_free_mail(&mail_table_data, 1, &err)) 
+               EM_DEBUG_EXCEPTION("emstorage_free_mail failed [%d]", err);
+
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+}
+
+EXPORT_API int email_get_thread_information_ex(int thread_id, emf_mail_list_item_t** thread_info)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int err = EMF_ERROR_NONE;
+       emstorage_mail_tbl_t *mail_table_data = NULL;
+       emf_mail_list_item_t *temp_thread_info = NULL;
+       
+       EM_IF_NULL_RETURN_VALUE(thread_info, EMF_ERROR_INVALID_PARAM);
+
+       if (!emstorage_get_thread_information(thread_id, &mail_table_data , true, &err)) {
+               EM_DEBUG_EXCEPTION("emstorage_get_thread_information -- failed [%d]", err);
+               goto FINISH_OFF;
+       }
+
+       temp_thread_info = em_malloc(sizeof(emf_mail_list_item_t));
+
+       if(!temp_thread_info) {
+               EM_DEBUG_EXCEPTION("em_malloc failed");
+               err = EMF_ERROR_OUT_OF_MEMORY;
+               goto FINISH_OFF;
+       }
+
+       EM_SAFE_STRNCPY(temp_thread_info->mailbox_name       , mail_table_data->mailbox_name, STRING_LENGTH_FOR_DISPLAY);
+       EM_SAFE_STRNCPY(temp_thread_info->from               , mail_table_data->full_address_from, STRING_LENGTH_FOR_DISPLAY);
+       EM_SAFE_STRNCPY(temp_thread_info->from_email_address , mail_table_data->email_address_sender, MAX_EMAIL_ADDRESS_LENGTH);
+       EM_SAFE_STRNCPY(temp_thread_info->recipients         , mail_table_data->email_address_recipient, STRING_LENGTH_FOR_DISPLAY);
+       EM_SAFE_STRNCPY(temp_thread_info->subject            , mail_table_data->subject, STRING_LENGTH_FOR_DISPLAY);
+       EM_SAFE_STRNCPY(temp_thread_info->previewBodyText    , mail_table_data->preview_text, MAX_PREVIEW_TEXT_LENGTH);
+       temp_thread_info->mail_id                            = mail_table_data->mail_id;
+       temp_thread_info->account_id                         = mail_table_data->account_id;
+       temp_thread_info->date_time                          = mail_table_data->date_time;
+       temp_thread_info->is_text_downloaded                 = mail_table_data->body_download_status;
+       temp_thread_info->flags_seen_field                   = mail_table_data->flags_seen_field;
+       temp_thread_info->priority                           = mail_table_data->priority;
+       temp_thread_info->save_status                        = mail_table_data->save_status;
+       temp_thread_info->is_locked                          = mail_table_data->lock_status;
+       temp_thread_info->is_report_mail                     = mail_table_data->report_status;
+       temp_thread_info->has_attachment                     = mail_table_data->attachment_count;
+       temp_thread_info->has_drm_attachment                 = mail_table_data->DRM_status;
+       temp_thread_info->thread_id                          = mail_table_data->thread_id;
+       temp_thread_info->thread_item_count                  = mail_table_data->thread_item_count;
+       temp_thread_info->is_meeting_request                 = mail_table_data->meeting_request_status;
+
+       *thread_info = temp_thread_info;
+
+FINISH_OFF:    
+
+       if(mail_table_data)
+               emstorage_free_mail(&mail_table_data, 1, NULL);
+
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+}
+
+EXPORT_API int email_get_mail_data(int input_mail_id, emf_mail_data_t **output_mail_data)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int err = EMF_ERROR_NONE;
+       
+       if ( ((err = emcore_get_mail_data(input_mail_id, output_mail_data)) != EMF_ERROR_NONE) || !output_mail_data) 
+               EM_DEBUG_EXCEPTION("emcore_get_mail_data failed [%d]", err);    
+               
+       EM_DEBUG_FUNC_END("err [%d]", err);     
+       return err;
+}
+
+
+/* -----------------------------------------------------------
+                                             Mail Flag API
+    -----------------------------------------------------------*/
+EXPORT_API int email_modify_mail_flag(int mail_id, emf_mail_flag_t new_flag, int onserver)
+{
+       EM_DEBUG_FUNC_BEGIN("mail_id[%d], on_server [ %d] ", mail_id, onserver);
+       
+       int err = EMF_ERROR_NONE;
+
+       int i_flag, sticky = 0;
+               
+       if ( mail_id <= 0 || (onserver != 0 && onserver != 1) ) {
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
+               return EMF_ERROR_INVALID_PARAM;                 
+       }
+       
+       HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_MODIFY_MAIL_FLAG);
+
+       if(!hAPI) {
+               EM_DEBUG_EXCEPTION("emipc_create_email_api failed");
+               err = EMF_ERROR_NULL_VALUE;             
+               goto FINISH_OFF;
+       }
+
+       /* Mail ID */
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, &(mail_id), sizeof(int))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               err = EMF_ERROR_OUT_OF_MEMORY;          
+               goto FINISH_OFF;
+       }
+
+       /* new_flag */
+       if(!em_convert_mail_flag_to_int(new_flag, &i_flag, &err))  {
+               EM_DEBUG_EXCEPTION("em_convert_mail_flag_to_int failed ");
+               goto FINISH_OFF;
+       }
+
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, &(i_flag), sizeof(int))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               err = EMF_ERROR_OUT_OF_MEMORY;          
+               goto FINISH_OFF;
+       }
+
+       sticky = new_flag.sticky;
+
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, &(sticky), sizeof(int))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               err = EMF_ERROR_OUT_OF_MEMORY;          
+               goto FINISH_OFF;
+       }
+       
+       /* onserver  */
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, &(onserver), sizeof(int))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               err = EMF_ERROR_OUT_OF_MEMORY;          
+               goto FINISH_OFF;
+       }
+       
+       
+       /* Execute API */
+       if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed");
+               err = EMF_ERROR_IPC_SOCKET_FAILURE;     
+               goto FINISH_OFF;
+       }
+       
+       emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);
+
+FINISH_OFF:
+       if(hAPI)
+               emipc_destroy_email_api(hAPI);
+
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+}
+
+
+
+
+EXPORT_API int email_modify_seen_flag(int *mail_ids, int num, int seen_flag, int onserver)
+{
+       EM_DEBUG_FUNC_BEGIN("mail_ids[%p], num[%d],seen_flag[%d], on_server [ %d]", mail_ids, num, seen_flag, onserver);
+       EM_DEBUG_FUNC_END("EMF_ERROR_NOT_IMPLEMENTED");
+       return EMF_ERROR_NOT_IMPLEMENTED;
+}
+
+EXPORT_API int email_set_flags_field(int account_id, int *mail_ids, int num, emf_flags_field_type field_type, int value, int onserver)
+{
+       EM_DEBUG_FUNC_BEGIN("account_id [%d], mail_ids[%p], num[%d], field_type [%d], seen_flag[%d], on_server [ %d]", account_id, mail_ids, num, field_type, value, onserver);
+       
+       int err = EMF_ERROR_NONE;
+
+               
+       EM_IF_NULL_RETURN_VALUE(mail_ids, EMF_ERROR_INVALID_PARAM);
+       if (account_id == 0 || num <= 0 || (onserver != 0 && onserver != 1)) {
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
+               return EMF_ERROR_INVALID_PARAM;                 
+       }
+       
+       HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_SET_FLAGS_FIELD);
+       
+       if(!hAPI) {
+               EM_DEBUG_EXCEPTION("emipc_create_email_api failed");
+               err = EMF_ERROR_NULL_VALUE;             
+               goto FINISH_OFF;
+       }
+       
+       /* account_id*/
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&account_id, sizeof(int))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               err = EMF_ERROR_OUT_OF_MEMORY;          
+               goto FINISH_OFF;
+       }
+
+       /* Number of mail_ids */
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&num, sizeof(int))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               err = EMF_ERROR_OUT_OF_MEMORY;          
+               goto FINISH_OFF;
+       }
+       
+       /* set of mail_ids */
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)mail_ids, num * sizeof(int))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               err = EMF_ERROR_OUT_OF_MEMORY;          
+               goto FINISH_OFF;
+       }
+       
+       /* field_type */
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&field_type, sizeof(int))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               err = EMF_ERROR_OUT_OF_MEMORY;          
+               goto FINISH_OFF;
+       }
+       
+       /* value */
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&value, sizeof(int))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               err = EMF_ERROR_OUT_OF_MEMORY;          
+               goto FINISH_OFF;
+       }
+
+       /* onserver  */
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, &(onserver), sizeof(int))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               err = EMF_ERROR_OUT_OF_MEMORY;          
+               goto FINISH_OFF;
+       }
+       
+       /* Execute API */
+       if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed");
+               err = EMF_ERROR_IPC_SOCKET_FAILURE;     
+               goto FINISH_OFF;
+       }
+       
+       emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);
+
+FINISH_OFF:
+       if(hAPI)
+               emipc_destroy_email_api(hAPI);
+
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+}
+
+EXPORT_API int email_modify_extra_mail_flag(int mail_id, emf_extra_flag_t new_flag)
+{
+       EM_DEBUG_FUNC_BEGIN("mail_id[%d]", mail_id);
+       
+       int size = 0;
+       int err = EMF_ERROR_NONE;
+       char* pMailExtraFlagsStream = NULL;
+
+               
+       EM_IF_NULL_RETURN_VALUE(mail_id, EMF_ERROR_INVALID_PARAM);
+
+       pMailExtraFlagsStream = em_convert_extra_flags_to_byte_stream(new_flag, &size);
+       
+       HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_MODIFY_MAIL_EXTRA_FLAG);
+
+       if(!hAPI) {
+               EM_DEBUG_EXCEPTION("emipc_create_email_api failed");
+               err = EMF_ERROR_NULL_VALUE;             
+               goto FINISH_OFF;
+       }
+
+       /* Mail ID */
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, &(mail_id), sizeof(int))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed ");
+               err = EMF_ERROR_OUT_OF_MEMORY;          
+               goto FINISH_OFF;
+       }
+       /*  Flag */
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, pMailExtraFlagsStream, size)) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed ");
+               err = EMF_ERROR_OUT_OF_MEMORY;          
+               goto FINISH_OFF;
+       }
+
+       /* Execute API */
+       if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed");
+               err = EMF_ERROR_IPC_SOCKET_FAILURE;
+               goto FINISH_OFF;
+       } 
+
+       emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);
+
+FINISH_OFF:
+       emipc_destroy_email_api(hAPI);
+       EM_SAFE_FREE(pMailExtraFlagsStream);
+
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+
+}
+
+
+
+/* -----------------------------------------------------------
+                                             Mail Move API
+    -----------------------------------------------------------*/
+EXPORT_API int email_move_mail_to_mailbox(int *mail_ids, int num, emf_mailbox_t* mailbox)
+{
+       EM_DEBUG_FUNC_BEGIN("mail_ids[%p], num [%d], mailbox[%p]",  mail_ids, num, mailbox);
+       
+       int size = 0;
+       char* mailbox_stream =  NULL;
+       int err = EMF_ERROR_NONE;
+       HIPC_API hAPI = NULL;
+
+
+       EM_IF_NULL_RETURN_VALUE(mailbox, EMF_ERROR_INVALID_PARAM);
+       EM_IF_NULL_RETURN_VALUE(mail_ids, EMF_ERROR_INVALID_PARAM);
+       EM_IF_ACCOUNT_ID_NULL(mailbox->account_id, EMF_ERROR_INVALID_PARAM); 
+       
+       if (num <= 0)  {
+               EM_DEBUG_LOG("num = %d", num);
+               err = EMF_ERROR_INVALID_PARAM;
+               return err;
+       }
+       
+       hAPI = emipc_create_email_api(_EMAIL_API_MOVE_MAIL);
+
+       if(!hAPI) {
+               EM_DEBUG_EXCEPTION("emipc_create_email_api failed");
+               err = EMF_ERROR_NULL_VALUE;             
+               goto FINISH_OFF;
+       }
+       
+       /* Number of mail_ids */
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&num, sizeof(int))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               err = EMF_ERROR_OUT_OF_MEMORY;          
+               goto FINISH_OFF;
+       }
+       
+       /* set of mail_ids */
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)mail_ids, num * sizeof(int))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               err = EMF_ERROR_OUT_OF_MEMORY;          
+               goto FINISH_OFF;
+       }
+       
+       /* Mailbox */
+       mailbox_stream = em_convert_mailbox_to_byte_stream(mailbox, &size);
+
+       if(!mailbox_stream) {
+               EM_DEBUG_EXCEPTION("em_convert_mailbox_to_byte_stream failed");
+               err = EMF_ERROR_NULL_VALUE;             
+               goto FINISH_OFF;
+       }
+
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, mailbox_stream, size)) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               err = EMF_ERROR_OUT_OF_MEMORY;          
+               goto FINISH_OFF;
+       }
+
+       /* Execute API */
+       if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed");
+               err = EMF_ERROR_IPC_SOCKET_FAILURE;             
+               goto FINISH_OFF;
+       }
+
+       emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);
+
+FINISH_OFF:            
+       EM_SAFE_FREE(mailbox_stream); 
+
+       if(hAPI)
+               emipc_destroy_email_api(hAPI);
+
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+}
+
+
+EXPORT_API int  email_move_all_mails_to_mailbox(emf_mailbox_t* src_mailbox, emf_mailbox_t* new_mailbox)
+{
+       EM_DEBUG_FUNC_BEGIN("src_mailbox[%p] , new_mailbox[%p]",  src_mailbox, new_mailbox);
+       
+       int size = 0;
+       int err = EMF_ERROR_NONE;
+       char *dest_mailbox_stream = NULL;
+       char *source_mailbox_stream = NULL;
+       HIPC_API hAPI = NULL;
+       
+
+       EM_IF_NULL_RETURN_VALUE(src_mailbox, EMF_ERROR_INVALID_PARAM);
+       EM_IF_NULL_RETURN_VALUE(new_mailbox, EMF_ERROR_INVALID_PARAM);
+       EM_IF_ACCOUNT_ID_NULL(new_mailbox->account_id, EMF_ERROR_INVALID_PARAM); 
+       EM_IF_ACCOUNT_ID_NULL(src_mailbox->account_id, EMF_ERROR_INVALID_PARAM); 
+       
+       hAPI = emipc_create_email_api(_EMAIL_API_MOVE_ALL_MAIL);
+
+       if(!hAPI) {
+               EM_DEBUG_EXCEPTION("emipc_create_email_api failed");
+               err = EMF_ERROR_NULL_VALUE;             
+               goto FINISH_OFF;
+       }
+       
+       /* Src Mailbox Information */
+       source_mailbox_stream = em_convert_mailbox_to_byte_stream(src_mailbox, &size);
+
+       if(!source_mailbox_stream) {
+               EM_DEBUG_EXCEPTION("em_convert_mailbox_to_byte_stream failed");
+               err = EMF_ERROR_NULL_VALUE;             
+               goto FINISH_OFF;
+       }
+
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, source_mailbox_stream, size)) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               err = EMF_ERROR_OUT_OF_MEMORY;          
+               goto FINISH_OFF;
+       }
+
+       size = 0;
+       
+       /* Dst Mailbox Information */
+       dest_mailbox_stream = em_convert_mailbox_to_byte_stream(new_mailbox, &size);
+
+       if(!dest_mailbox_stream) {
+               EM_DEBUG_EXCEPTION("em_convert_mailbox_to_byte_stream failed");
+               err = EMF_ERROR_NULL_VALUE;             
+               goto FINISH_OFF;
+       }
+
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, dest_mailbox_stream, size)) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               err = EMF_ERROR_OUT_OF_MEMORY;          
+               goto FINISH_OFF;
+       }
+       
+       /* Execute API */
+       if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed");
+               err = EMF_ERROR_IPC_SOCKET_FAILURE;             
+               goto FINISH_OFF;
+       }
+
+       emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);
+
+FINISH_OFF:
+       EM_SAFE_FREE(source_mailbox_stream);
+       EM_SAFE_FREE(dest_mailbox_stream); 
+
+       if(hAPI)
+               emipc_destroy_email_api(hAPI);
+       
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+}
+
+
+EXPORT_API int email_count_message_with_draft_flag(emf_mailbox_t* mailbox, int* total)
+{
+       EM_DEBUG_FUNC_BEGIN("mailbox[%p], total[%p]", mailbox, total);
+       
+       int err = EMF_ERROR_NONE;
+       int total_count = 0;
+               
+       EM_IF_NULL_RETURN_VALUE(mailbox, EMF_ERROR_INVALID_PARAM);
+       EM_IF_NULL_RETURN_VALUE(total, EMF_ERROR_INVALID_PARAM);
+
+    if (!emstorage_get_mail_count_with_draft_flag(mailbox->account_id,  mailbox->name, &total_count, false, &err)) {
+               EM_DEBUG_EXCEPTION("emstorage_get_mail_count Failed");
+
+       } else {
+               *total = total_count;
+       }
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+}
+
+
+EXPORT_API int email_count_message_on_sending(emf_mailbox_t* mailbox, int* total)
+{
+       EM_DEBUG_FUNC_BEGIN("mailbox[%p], total[%p]", mailbox, total);
+       int err = EMF_ERROR_NONE;
+       int total_count = 0;
+       
+               
+       EM_IF_NULL_RETURN_VALUE(mailbox, EMF_ERROR_INVALID_PARAM);
+       EM_IF_NULL_RETURN_VALUE(total, EMF_ERROR_INVALID_PARAM);
+
+       if (!emstorage_get_mail_count_on_sending(mailbox->account_id,  mailbox->name, &total_count, false, &err)) {
+               EM_DEBUG_EXCEPTION("emstorage_get_mail_count Failed");
+
+       } else
+               *total = total_count;
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+}
+
+/**
+ * @open
+ * @fn email_get_mail_flag(int account_id, int mail_id, emf_mail_flag_t* mail_flag)
+ * @brief      Get the Mail Flag information based on the account id and Mail Id.
+ * 
+ * @param[in] account_id       Specifies the Account ID
+ * @param[in] mail_id          Specifies the Mail id for which  Flag details need to be fetched
+ * @param[in/out] mail_flag    Specifies the Pointer to the structure emf_mail_flag_t.
+ * @remarks N/A
+ * @return True on Success, False on Failure.
+ */
+EXPORT_API int email_get_mail_flag(int account_id, int mail_id, emf_mail_flag_t* mail_flag)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       
+       int err = EMF_ERROR_NONE;
+
+       if (account_id < FIRST_ACCOUNT_ID|| mail_id < 1 || mail_flag == NULL) {
+               EM_DEBUG_EXCEPTION("Invalid Param");
+               err = EMF_ERROR_INVALID_PARAM ;
+               goto FINISH_OFF;
+       }
+
+       /* Fetch the flag Information */
+       if (!emcore_fetch_flags(account_id, mail_id, mail_flag, &err)) {        
+               EM_DEBUG_EXCEPTION("emcore_fetch_flags Failed [%d]", err);
+               goto FINISH_OFF;
+       }
+FINISH_OFF:
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+
+}
+
+EXPORT_API int email_free_mail_data(emf_mail_data_t** mail_list, int count)
+{
+       EM_DEBUG_FUNC_BEGIN("mail_list[%p], count[%d]", mail_list, count);
+       int err = EMF_ERROR_NONE;
+       emcore_free_mail_data(mail_list, count, &err);
+       EM_DEBUG_FUNC_END("err [%d]", err);     
+       return err;
+}
+
+/* Convert Modified UTF-7 mailbox name to UTF-8 */
+/* returns modified UTF-8 Name if success else NULL */
+
+EXPORT_API int email_cancel_send_mail( int mail_id)
+{
+       EM_DEBUG_FUNC_BEGIN("Mail ID [ %d]", mail_id);
+       EM_IF_NULL_RETURN_VALUE(mail_id, EMF_ERROR_INVALID_PARAM);
+       
+       int err = EMF_ERROR_NONE;
+       int account_id = 0;
+       emf_mail_data_t* mail_data = NULL;
+
+       HIPC_API hAPI = NULL;
+       
+       
+       if ((err = emcore_get_mail_data(mail_id, &mail_data)) != EMF_ERROR_NONE)  {
+               EM_DEBUG_EXCEPTION("emcore_get_mail_data failed [%d]", err);
+               goto FINISH_OFF;
+       }
+
+       if (!mail_data) {
+               EM_DEBUG_EXCEPTION("mail_data is null");
+               err = EMF_ERROR_NULL_VALUE;             
+               goto FINISH_OFF;
+       }
+
+       account_id = mail_data->account_id;
+
+       hAPI = emipc_create_email_api(_EMAIL_API_SEND_MAIL_CANCEL_JOB);
+
+       if(!hAPI) {
+               EM_DEBUG_EXCEPTION("emipc_create_email_api failed");
+               err = EMF_ERROR_NULL_VALUE;             
+               goto FINISH_OFF;
+       }
+
+       /* Account_id */
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, &account_id, sizeof(int))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               err = EMF_ERROR_OUT_OF_MEMORY;          
+               goto FINISH_OFF;
+       }
+
+       /* Mail ID */
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, &(mail_id), sizeof(int))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               err = EMF_ERROR_OUT_OF_MEMORY;          
+               goto FINISH_OFF;
+       }
+
+       /* Execute API */
+       if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed");
+               err = EMF_ERROR_IPC_SOCKET_FAILURE;     
+               goto FINISH_OFF;
+       }
+       
+       emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);
+
+FINISH_OFF:
+       if(hAPI)
+               emipc_destroy_email_api(hAPI);
+
+       if  ( !emcore_free_mail_data(&mail_data, 1, &err))
+               EM_DEBUG_EXCEPTION("emcore_free_mail_data Failed [%d ] ", err);
+
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+
+}
+/**
+  * EmfSendCancel - Callback function for cm popup. We set the status as EMF_MAIL_STATUS_NONE 
+  *
+  **/
+
+
+EXPORT_API int email_retry_send_mail( int mail_id, int timeout_in_sec)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       
+       int err = EMF_ERROR_NONE;
+
+
+       EM_IF_NULL_RETURN_VALUE(mail_id, EMF_ERROR_INVALID_PARAM);
+       if( timeout_in_sec < 0 )  {
+               EM_DEBUG_EXCEPTION("Invalid timeout_in_sec");
+               err = EMF_ERROR_INVALID_PARAM;
+               return err;
+       }
+       
+       HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_SEND_RETRY);
+
+       if(!hAPI) {
+               EM_DEBUG_EXCEPTION("emipc_create_email_api failed");
+               err = EMF_ERROR_NULL_VALUE;             
+               goto FINISH_OFF;
+       }
+
+       /* Mail ID */
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, &(mail_id), sizeof(int))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               err = EMF_ERROR_OUT_OF_MEMORY;          
+               goto FINISH_OFF;
+       }
+
+       /* timeout */
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, &(timeout_in_sec), sizeof(int))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               err = EMF_ERROR_OUT_OF_MEMORY;          
+               goto FINISH_OFF;
+       }
+       
+       /* Execute API */
+       if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed");
+               err = EMF_ERROR_IPC_SOCKET_FAILURE;     
+               goto FINISH_OFF;
+       }
+       
+       emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);
+
+FINISH_OFF:
+       if(hAPI)
+               emipc_destroy_email_api(hAPI);
+
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+
+ }
+
+EXPORT_API int email_get_mailbox_name_by_mail_id(int mail_id, char **pMailbox_name)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       
+       int err = EMF_ERROR_NONE;
+       char* mailbox_name = NULL;
+       emstorage_mail_tbl_t* mail_table_data = NULL;
+       
+       if(mail_id <= 0) {
+               EM_DEBUG_EXCEPTION("mail_id is not valid");
+               err= EMF_ERROR_INVALID_PARAM;
+               goto FINISH_OFF;
+       }       
+       EM_IF_NULL_RETURN_VALUE(pMailbox_name, EMF_ERROR_INVALID_PARAM);
+       
+       if(!emstorage_get_mail_by_id(mail_id, &mail_table_data, true, &err)) {
+               EM_DEBUG_EXCEPTION("Failed to get mail by mail_id [%d]", err);
+
+               goto FINISH_OFF;
+       }
+
+       if(mail_table_data->mailbox_name)
+               mailbox_name = strdup(mail_table_data->mailbox_name);
+       
+       *pMailbox_name = mailbox_name;
+
+FINISH_OFF:
+       if(mail_table_data) {
+               emstorage_free_mail(&mail_table_data, 1, &err); 
+
+       }
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+}
+
+
+EXPORT_API int email_get_latest_unread_mail_id(int account_id, int *pMailID)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       
+       int err = EMF_ERROR_NONE;
+
+       if( (!pMailID) ||(account_id <= 0 &&  account_id != -1)) {              
+               err = EMF_ERROR_INVALID_PARAM;
+               return err;
+       }
+       if(!emstorage_get_latest_unread_mailid(account_id,pMailID, &err)) {
+               EM_DEBUG_LOG("emstorage_get_latest_unread_mailid - failed");
+
+       }
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+}
+
+EXPORT_API int email_get_max_mail_count(int *Count)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int err = EMF_ERROR_NONE;
+       EM_IF_NULL_RETURN_VALUE(Count, EMF_ERROR_INVALID_PARAM);
+       *Count = emstorage_get_max_mail_count();
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+}
+
+
+
+/* for setting application,disk usage of email in KB */
+EXPORT_API int email_get_disk_space_usage(unsigned long *total_size)
+{
+       EM_DEBUG_FUNC_BEGIN("total_size[%p]", total_size);
+       int err = EMF_ERROR_NONE;
+
+       EM_IF_NULL_RETURN_VALUE(total_size, EMF_ERROR_INVALID_PARAM);
+
+       if (!emstorage_mail_get_total_diskspace_usage(total_size,true,&err))  {
+               EM_DEBUG_EXCEPTION("emstorage_mail_get_total_diskspace_usage failed [%d]", err);
+
+               goto FINISH_OFF;
+       }
+FINISH_OFF :   
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+}
+
+EXPORT_API int email_get_recipients_list(int account_id, const char *mailbox_name, emf_sender_list_t **recipients_list)
+{
+       EM_DEBUG_FUNC_BEGIN("recipients_list[%p]",  recipients_list);
+
+       int number_of_mails, index;
+       int number_of_recipients;
+       int ret=0, err = 0;
+
+       emf_sender_list_t *temp_recipients_list = NULL;
+       emf_sender_list_t *p_recipients_list = NULL;
+       GList *addr_list = NULL, *temp_addr_list = NULL;
+       emstorage_mail_tbl_t *mail_table_data = NULL;
+
+       if (!emstorage_get_mails(account_id, (char*)mailbox_name, NULL, EMF_LIST_TYPE_NORMAL, -1, -1, EMF_SORT_SENDER_HIGH, true, &mail_table_data, &number_of_mails, &err)) {
+               EM_DEBUG_EXCEPTION("emstorage_get_mails failed");
+
+               goto FINISH_OFF;
+       }
+
+       for (index = 0; index < number_of_mails; index++) {
+               addr_list = emcore_get_recipients_list(addr_list, mail_table_data[index].full_address_to, &err);
+               addr_list = emcore_get_recipients_list(addr_list, mail_table_data[index].full_address_cc, &err);
+               addr_list = emcore_get_recipients_list(addr_list, mail_table_data[index].full_address_bcc, &err);
+       }
+
+       number_of_recipients = g_list_length(addr_list);
+
+       p_recipients_list = (emf_sender_list_t *)malloc(sizeof(emf_sender_list_t) * number_of_recipients);
+       if (p_recipients_list == NULL) {
+               EM_DEBUG_EXCEPTION("malloc for emf_sender_list_t failed...");
+               err = EMF_ERROR_OUT_OF_MEMORY;
+               ret = err;
+               goto FINISH_OFF;
+       }       
+       memset(p_recipients_list, 0x00, sizeof(emf_sender_list_t) * number_of_recipients);
+       
+       temp_addr_list = g_list_first(addr_list);
+       index = 0;
+       while (temp_addr_list != NULL) {
+               temp_recipients_list = (emf_sender_list_t *)temp_addr_list->data;
+               p_recipients_list[index].address = temp_recipients_list->address;
+               p_recipients_list[index].display_name = temp_recipients_list->display_name;
+               p_recipients_list[index].total_count = temp_recipients_list->total_count + 1;
+               EM_DEBUG_LOG("address[%s], display_name[%s], total_count[%d]", p_recipients_list[index].address, p_recipients_list[index].display_name, p_recipients_list[index].total_count);
+               temp_addr_list = g_list_next(temp_addr_list);
+               index++;
+       }
+
+       ret = true;     
+FINISH_OFF:
+       if (ret == true && recipients_list)
+               *recipients_list = p_recipients_list; else if (p_recipients_list != NULL) {
+               email_free_sender_list(&p_recipients_list, number_of_recipients);
+       }
+
+       EM_DEBUG_FUNC_END();
+       return ret;
+}
+
+EXPORT_API int email_get_sender_list(int account_id, const char *mailbox_name, int search_type, const char *search_value, emf_sort_type_t sorting, emf_sender_list_t** sender_list, int *sender_count)
+{
+       EM_DEBUG_FUNC_BEGIN("sender_list[%p],sender_count[%p], sorting[%d]",  sender_list, sender_count, sorting);
+
+       int err = EMF_ERROR_NONE;
+
+       emf_sender_list_t *temp_sender_list = NULL;
+
+       EM_IF_NULL_RETURN_VALUE(sender_list, EMF_ERROR_INVALID_PARAM);
+       EM_IF_NULL_RETURN_VALUE(sender_count, EMF_ERROR_INVALID_PARAM);
+       if( account_id < ALL_ACCOUNT) {
+               EM_DEBUG_EXCEPTION(" Invalid Account Id Param ");
+               err = EMF_ERROR_INVALID_PARAM ;
+               return err;
+       }
+       
+       if ( !emstorage_get_sender_list(account_id, mailbox_name, search_type, search_value, sorting, &temp_sender_list, sender_count, &err) ) { 
+               EM_DEBUG_EXCEPTION("emstorage_get_sender_list failed [%d]", err);
+
+               goto FINISH_OFF;
+       }
+
+       if ( sender_list )
+               *sender_list = temp_sender_list;
+
+FINISH_OFF:
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+}
+
+EXPORT_API int email_get_sender_list_ex(int account_id, const char *mailbox_name, int start_index, int limit_count, emf_sort_type_t sorting, emf_sender_list_t** sender_list, int *sender_count)
+{
+       return EMF_ERROR_NONE;
+}
+
+EXPORT_API int email_free_sender_list(emf_sender_list_t **sender_list, int count)
+{
+       EM_DEBUG_FUNC_BEGIN("sender_list[%p], count[%d]", sender_list, count);
+
+       int err = EMF_ERROR_NONE;
+       
+       if (count > 0)  {
+               if (!sender_list || !*sender_list)  {
+                       EM_DEBUG_EXCEPTION("sender_list[%p], count[%d]", sender_list, count);                   
+                       err = EMF_ERROR_INVALID_PARAM;
+                       return err;
+               }
+               
+               emf_sender_list_t* p = *sender_list;
+               int i = 0;
+               
+               for (; i < count; i++)  {
+                       EM_SAFE_FREE(p[i].address);
+                       EM_SAFE_FREE(p[i].display_name);
+               }
+               
+               EM_SAFE_FREE(p); 
+               *sender_list = NULL;
+       }       
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+}
+
+EXPORT_API int email_get_address_info_list(int mail_id, emf_address_info_list_t** address_info_list)
+{
+       EM_DEBUG_FUNC_BEGIN("mail_id[%d], address_info_list[%p]", mail_id, address_info_list);
+
+       int err = EMF_ERROR_NONE;
+
+       emf_address_info_list_t *temp_address_info_list = NULL;
+
+       EM_IF_NULL_RETURN_VALUE(address_info_list, EMF_ERROR_INVALID_PARAM);
+       if( mail_id <= 0) {
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
+               err = EMF_ERROR_INVALID_PARAM ;
+               return err;
+       }
+       
+       if ( !emcore_get_mail_address_info_list(mail_id, &temp_address_info_list, &err) ) {
+               EM_DEBUG_EXCEPTION("emcore_get_mail_address_info_list failed [%d]", err);
+
+               goto FINISH_OFF;
+       }
+
+       if ( address_info_list ) {
+               *address_info_list = temp_address_info_list;
+               temp_address_info_list = NULL;
+       }
+
+FINISH_OFF:
+       if ( temp_address_info_list )
+               emstorage_free_address_info_list(&temp_address_info_list);
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+}
+
+EXPORT_API int email_free_address_info_list(emf_address_info_list_t **address_info_list)
+{
+       EM_DEBUG_FUNC_BEGIN("address_info_list[%p]", address_info_list);
+
+       int err = EMF_ERROR_NONE;
+
+       if ( (err = emstorage_free_address_info_list(address_info_list)) != EMF_ERROR_NONE ) {
+               EM_DEBUG_EXCEPTION("address_info_list[%p] free failed.", address_info_list);
+       }
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+}
+
+EXPORT_API int email_get_structure(const char*encoded_string, void **struct_var, emf_convert_struct_type_e type)
+{
+       EM_DEBUG_FUNC_BEGIN("encoded_string[%s], struct_var[%p], type[%d]", encoded_string, struct_var, type);
+
+       int err = EMF_ERROR_NONE;
+       void * temp_struct = NULL;
+
+       EM_IF_NULL_RETURN_VALUE(encoded_string, EMF_ERROR_INVALID_PARAM);
+       EM_IF_NULL_RETURN_VALUE(struct_var, EMF_ERROR_INVALID_PARAM);
+
+       if ( (err = emcore_convert_string_to_structure((char*)encoded_string, &temp_struct, type)) != EMF_ERROR_NONE )  {
+               EM_DEBUG_EXCEPTION("emcore_convert_string_to_structure failed[%d]", err);
+               goto FINISH_OFF;
+       }
+
+       if ( struct_var )
+               *struct_var = temp_struct;
+
+FINISH_OFF:
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+}
+
+EXPORT_API int email_get_meeting_request(int mail_id, emf_meeting_request_t **meeting_req)
+{
+       EM_DEBUG_FUNC_BEGIN("mail_id[%d],meeting_req[%p]",  mail_id, meeting_req);
+
+       int err = EMF_ERROR_NONE;
+
+       emf_meeting_request_t *temp_meeting_req = NULL;
+
+       EM_IF_NULL_RETURN_VALUE(meeting_req, EMF_ERROR_INVALID_PARAM);
+       if( mail_id <= 0 ) {
+               EM_DEBUG_EXCEPTION(" Invalid Mail Id Param ");
+               err = EMF_ERROR_INVALID_PARAM ;
+               return err;
+       }
+       
+       if ( !emstorage_get_meeting_request(mail_id, &temp_meeting_req, 1, &err) ) {
+               EM_DEBUG_EXCEPTION("emstorage_get_meeting_request -- Failed [%d]", err);
+
+               goto FINISH_OFF;
+       }
+
+       if ( meeting_req )
+               *meeting_req = temp_meeting_req;
+
+FINISH_OFF:
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+}
+
+EXPORT_API int email_free_meeting_request(emf_meeting_request_t** meeting_req, int count)
+{
+       EM_DEBUG_FUNC_BEGIN("meeting_req[%p], count[%d]", meeting_req, count);
+
+       int err = EMF_ERROR_NONE;
+
+       emstorage_free_meeting_request(meeting_req, count, &err);
+
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+}
+
+EXPORT_API int email_move_thread_to_mailbox(int thread_id, char *target_mailbox_name, int move_always_flag)
+{
+       EM_DEBUG_FUNC_BEGIN("thread_id[%d], target_mailbox_name[%p], move_always_flag[%d]", thread_id, target_mailbox_name, move_always_flag);
+       int err = EMF_ERROR_NONE;
+       
+
+       EM_IF_NULL_RETURN_VALUE(target_mailbox_name, EMF_ERROR_INVALID_PARAM);
+       
+       HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_MOVE_THREAD_TO_MAILBOX);
+
+       if(!hAPI) {
+               EM_DEBUG_EXCEPTION("emipc_create_email_api failed");
+               err = EMF_ERROR_NULL_VALUE;             
+               goto FINISH_OFF;
+       }
+
+       /* thread_id */
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&thread_id, sizeof(int))){
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               err = EMF_ERROR_OUT_OF_MEMORY;          
+               goto FINISH_OFF;
+       }
+       
+       /* target mailbox information */
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, target_mailbox_name, strlen(target_mailbox_name))){
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               err = EMF_ERROR_OUT_OF_MEMORY;          
+               goto FINISH_OFF;
+       }
+
+       /* move_always_flag */
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&move_always_flag, sizeof(int))){
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               err = EMF_ERROR_OUT_OF_MEMORY;          
+               goto FINISH_OFF;
+       }
+       
+       /* Execute API */
+       if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed");
+               err = EMF_ERROR_IPC_SOCKET_FAILURE;     
+               goto FINISH_OFF;
+       }
+       
+       emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);
+
+FINISH_OFF:
+       if(hAPI)
+               emipc_destroy_email_api(hAPI);
+
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+}
+
+EXPORT_API int email_delete_thread(int thread_id, int delete_always_flag)
+{
+       EM_DEBUG_FUNC_BEGIN("thread_id[%d], delete_always_flag[%d]", thread_id, delete_always_flag);
+       int err = EMF_ERROR_NONE;
+
+       HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_DELETE_THREAD);
+
+       if(!hAPI) {
+               EM_DEBUG_EXCEPTION("emipc_create_email_api failed");
+               err = EMF_ERROR_NULL_VALUE;             
+               goto FINISH_OFF;
+       }
+
+       /* thread_id */
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&thread_id, sizeof(int))){
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               err = EMF_ERROR_OUT_OF_MEMORY;          
+               goto FINISH_OFF;
+       }
+
+       /* delete_always_flag */
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&delete_always_flag, sizeof(int))){
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               err = EMF_ERROR_OUT_OF_MEMORY;          
+               goto FINISH_OFF;
+       }
+       
+       /* Execute API */
+       if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed");
+               err = EMF_ERROR_IPC_SOCKET_FAILURE;     
+               goto FINISH_OFF;
+       }
+       
+       emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);
+
+FINISH_OFF:
+       if(hAPI)
+               emipc_destroy_email_api(hAPI);
+
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+}
+
+EXPORT_API int email_modify_seen_flag_of_thread(int thread_id, int seen_flag, int on_server)
+{
+       EM_DEBUG_FUNC_BEGIN("thread_id[%d], seen_flag[%d], on_server[%d]", thread_id, seen_flag, on_server);
+       int err = EMF_ERROR_NONE;
+       HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_MODIFY_SEEN_FLAG_OF_THREAD);
+
+       if(!hAPI) {
+               EM_DEBUG_EXCEPTION("emipc_create_email_api failed");
+               err = EMF_ERROR_NULL_VALUE;             
+               goto FINISH_OFF;
+       }
+
+       /* thread_id */
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&thread_id, sizeof(int))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               err = EMF_ERROR_OUT_OF_MEMORY;          
+               goto FINISH_OFF;
+       }
+
+       /* seen_flag */
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&seen_flag, sizeof(int))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               err = EMF_ERROR_OUT_OF_MEMORY;          
+               goto FINISH_OFF;
+       }
+
+       /* on_server */
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&on_server, sizeof(int))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               err = EMF_ERROR_OUT_OF_MEMORY;          
+               goto FINISH_OFF;
+       }
+       
+       /* Execute API */
+       if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed");
+               err = EMF_ERROR_IPC_SOCKET_FAILURE;     
+               goto FINISH_OFF;
+       }
+       
+       emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);
+
+FINISH_OFF:
+       if(hAPI)
+               emipc_destroy_email_api(hAPI);
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+}
+
similarity index 66%
rename from MAPI/Emf_Mapi_Mailbox.c
rename to email-api/email-api-mailbox.c
index 7d28d51..3527b43 100755 (executable)
 /**
  *
  * This file contains the data structures and interfaces needed for application,
- * to interact with Email Engine.
- * @file               Emf_Mapi_Folder.c
+ * to interact with email-service.
+ * @file               email_api_mailbox.c
  * @brief              This file contains the data structures and interfaces of mailbox related Functionality provided by 
- *                     Email Engine . 
+ *                     email-service . 
  */
  
-#include <Emf_Mapi.h>
+#include "email-api.h"
 #include "string.h"
-#include "Msg_Convert.h"
-#include "em-storage.h"
-#include "ipc-library.h"
+#include "email-convert.h"
+#include "email-storage.h"
+#include "email-core-utils.h"
+#include "email-utilities.h"
+#include "email-ipc.h"
 #include "db-util.h"
 
 /* API - Create a mailbox */
@@ -48,7 +50,7 @@ EXPORT_API int email_add_mailbox(emf_mailbox_t* new_mailbox, int on_server, unsi
        int err = EMF_ERROR_NONE;
        EM_IF_NULL_RETURN_VALUE(new_mailbox, EMF_ERROR_INVALID_PARAM);
 
-       HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_ADD_MAILBOX);
+       HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_ADD_MAILBOX);
 
        EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
        
@@ -56,28 +58,32 @@ EXPORT_API int email_add_mailbox(emf_mailbox_t* new_mailbox, int on_server, unsi
 
        EM_PROXY_IF_NULL_RETURN_VALUE(local_mailbox_stream, hAPI, EMF_ERROR_NULL_VALUE);
 
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, local_mailbox_stream, size))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-       EM_SAFE_FREE(local_mailbox_stream); 
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, local_mailbox_stream, size)) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               EM_SAFE_FREE(local_mailbox_stream); 
+               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+       }
 
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, &on_server, sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-       
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPI failed");
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, &on_server, sizeof(int))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+       }
+
+       if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed");
                EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
        }
 
-       err = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
+       emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);
        EM_DEBUG_LOG(" >>>>> error VALUE [%d]", err);
 
        if(handle) {
-               *handle = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1);
+               emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), handle);
                EM_DEBUG_LOG(" >>>>> Handle [%d]", *handle);
        }       
        
 
-       ipcEmailAPI_Destroy(hAPI);
+       emipc_destroy_email_api(hAPI);
        hAPI = NULL;
        EM_DEBUG_FUNC_END("err [%d]", err);
        return err;
@@ -97,7 +103,7 @@ EXPORT_API int email_delete_mailbox(emf_mailbox_t* mailbox, int on_server,  unsi
        EM_IF_NULL_RETURN_VALUE(mailbox, EMF_ERROR_INVALID_PARAM);
        EM_IF_NULL_RETURN_VALUE(mailbox->account_id, EMF_ERROR_INVALID_PARAM)   ;
 
-       HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_DELETE_MAILBOX);
+       HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_DELETE_MAILBOX);
 
        EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
 
@@ -105,28 +111,31 @@ EXPORT_API int email_delete_mailbox(emf_mailbox_t* mailbox, int on_server,  unsi
        
        EM_PROXY_IF_NULL_RETURN_VALUE(local_mailbox_stream, hAPI, EMF_ERROR_NULL_VALUE);
 
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, local_mailbox_stream, size))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-       EM_SAFE_FREE(local_mailbox_stream);
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, local_mailbox_stream, size)) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               EM_SAFE_FREE(local_mailbox_stream);
+               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+       }
        
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, &on_server, sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, &on_server, sizeof(int))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+       }
 
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPI failed");
+       if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed");
                EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
        }
 
-       err = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
+       emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);
        EM_DEBUG_LOG("error VALUE [%d]", err);
 
        if(handle) {
-               *handle = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1);
+               emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), handle);
                EM_DEBUG_LOG("Handle [%d]", handle);
        }       
 
-       ipcEmailAPI_Destroy(hAPI);
+       emipc_destroy_email_api(hAPI);
        hAPI = NULL;
        EM_DEBUG_FUNC_END("err [%d]", err);
        return err;
@@ -150,7 +159,7 @@ EXPORT_API int email_update_mailbox(emf_mailbox_t* old_mailbox, emf_mailbox_t* n
        EM_IF_NULL_RETURN_VALUE(new_mailbox, EMF_ERROR_INVALID_PARAM);
        EM_IF_ACCOUNT_ID_NULL(new_mailbox->account_id, EMF_ERROR_INVALID_PARAM);
        
-       HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_UPDATE_MAILBOX);  
+       HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_UPDATE_MAILBOX);      
 
        EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
 
@@ -159,31 +168,38 @@ EXPORT_API int email_update_mailbox(emf_mailbox_t* old_mailbox, emf_mailbox_t* n
 
        EM_PROXY_IF_NULL_RETURN_VALUE(local_mailbox_stream, hAPI, EMF_ERROR_NULL_VALUE);
                
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, local_mailbox_stream, size))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-       EM_SAFE_FREE(local_mailbox_stream); 
-
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, local_mailbox_stream, size)) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               EM_SAFE_FREE(local_mailbox_stream); 
+               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+       }
+       
        local_mailbox_stream = em_convert_mailbox_to_byte_stream(new_mailbox, &size);
 
        EM_PROXY_IF_NULL_RETURN_VALUE(local_mailbox_stream, hAPI, EMF_ERROR_NULL_VALUE);
 
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, local_mailbox_stream, size))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-       EM_SAFE_FREE(local_mailbox_stream); 
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, local_mailbox_stream, size)) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               EM_SAFE_FREE(local_mailbox_stream); 
+               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+       }
 
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, &on_server, sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-       
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPI failed");
-               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
-       } else {
-               err = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
-                       
-               EM_DEBUG_LOG("error VALUE [%d]", err);
-               ipcEmailAPI_Destroy(hAPI);
-               hAPI = NULL;
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, &on_server, sizeof(int))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
        }
+
+       if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed");
+               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
+       } 
+
+       emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);
+       
+       EM_DEBUG_LOG("error VALUE [%d]", err);
+       emipc_destroy_email_api(hAPI);
+       hAPI = NULL;
+       
        EM_DEBUG_FUNC_END("err [%d]", err);
        return err;
 }
@@ -193,23 +209,23 @@ EXPORT_API int email_get_sync_mailbox_list(int account_id, emf_mailbox_t** mailb
 {
        EM_DEBUG_FUNC_BEGIN();
        int counter = 0;
-       emf_mailbox_tbl_t* mailbox = NULL; 
+       emstorage_mailbox_tbl_t* mailbox = NULL; 
        int err = EMF_ERROR_NONE ;
        
        EM_IF_NULL_RETURN_VALUE(mailbox_list, EMF_ERROR_INVALID_PARAM);
        EM_IF_ACCOUNT_ID_NULL(account_id, EMF_ERROR_INVALID_PARAM);
        EM_IF_NULL_RETURN_VALUE(count, EMF_ERROR_INVALID_PARAM);
 
-       if (!em_storage_get_mailbox(account_id, 0, EMAIL_MAILBOX_SORT_BY_NAME_ASC, &counter, &mailbox, true, &err)) {           /* TODO: confirm me */
-               EM_DEBUG_EXCEPTION("em_storage_get_mailbox failed [%d]", err);
+       if (!emstorage_get_mailbox(account_id, 0, EMAIL_MAILBOX_SORT_BY_NAME_ASC, &counter, &mailbox, true, &err)) {
+               EM_DEBUG_EXCEPTION("emstorage_get_mailbox failed [%d]", err);
+
 
-               err = em_storage_get_emf_error_from_em_storage_error(err);
                goto FINISH_OFF;
        } else
                err = EMF_ERROR_NONE;
        
        if (counter > 0)  {
-               if (!(*mailbox_list = em_core_malloc(sizeof(emf_mailbox_t) * counter)))  {
+               if (!(*mailbox_list = em_malloc(sizeof(emf_mailbox_t) * counter)))  {
                        EM_DEBUG_EXCEPTION("malloc failed...");
                        err= EMF_ERROR_OUT_OF_MEMORY;
                        goto FINISH_OFF;
@@ -221,7 +237,7 @@ EXPORT_API int email_get_sync_mailbox_list(int account_id, emf_mailbox_t** mailb
        
        FINISH_OFF:
        if (mailbox != NULL)
-               em_storage_free_mailbox(&mailbox, counter, NULL);
+               emstorage_free_mailbox(&mailbox, counter, NULL);
        EM_DEBUG_FUNC_END("err [%d]", err);
        return err;
 }
@@ -232,7 +248,7 @@ EXPORT_API int email_get_mailbox_list(int account_id, int mailbox_sync_type, emf
        EM_DEBUG_FUNC_BEGIN();  
 
        int mailbox_count = 0;
-       emf_mailbox_tbl_t* mailbox_tbl_list = NULL; 
+       emstorage_mailbox_tbl_t* mailbox_tbl_list = NULL; 
        int err =EMF_ERROR_NONE;
        int i;
        
@@ -240,15 +256,15 @@ EXPORT_API int email_get_mailbox_list(int account_id, int mailbox_sync_type, emf
        EM_IF_ACCOUNT_ID_NULL(account_id, EMF_ERROR_INVALID_PARAM);
        EM_IF_NULL_RETURN_VALUE(count, EMF_ERROR_INVALID_PARAM);
 
-       if (!em_storage_get_mailbox(account_id, mailbox_sync_type, EMAIL_MAILBOX_SORT_BY_NAME_ASC, &mailbox_count, &mailbox_tbl_list, true, &err))  {   
-               EM_DEBUG_EXCEPTION("em_storage_get_mailbox failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+       if (!emstorage_get_mailbox(account_id, mailbox_sync_type, EMAIL_MAILBOX_SORT_BY_NAME_ASC, &mailbox_count, &mailbox_tbl_list, true, &err))  {    
+               EM_DEBUG_EXCEPTION("emstorage_get_mailbox failed [%d]", err);
+
                goto FINISH_OFF;
        } else
                err = EMF_ERROR_NONE;
        
        if (mailbox_count > 0)  {
-               if (!(*mailbox_list = em_core_malloc(sizeof(emf_mailbox_t) * mailbox_count)))  {
+               if (!(*mailbox_list = em_malloc(sizeof(emf_mailbox_t) * mailbox_count)))  {
                        EM_DEBUG_EXCEPTION("malloc failed for mailbox_list");
                        err= EMF_ERROR_OUT_OF_MEMORY;
                        goto FINISH_OFF;
@@ -277,7 +293,7 @@ EXPORT_API int email_get_mailbox_list(int account_id, int mailbox_sync_type, emf
 
 FINISH_OFF:
        if (mailbox_tbl_list != NULL)
-               em_storage_free_mailbox(&mailbox_tbl_list, mailbox_count, NULL);
+               emstorage_free_mailbox(&mailbox_tbl_list, mailbox_count, NULL);
 
        EM_DEBUG_FUNC_END("err [%d]", err);
        return err;
@@ -290,7 +306,7 @@ EXPORT_API int email_get_mailbox_list_ex(int account_id, int mailbox_sync_type,
        EM_DEBUG_FUNC_BEGIN();  
 
        int mailbox_count = 0;
-       emf_mailbox_tbl_t* mailbox_tbl_list = NULL; 
+       emstorage_mailbox_tbl_t* mailbox_tbl_list = NULL; 
        int err =EMF_ERROR_NONE;
        int i;
        
@@ -298,15 +314,15 @@ EXPORT_API int email_get_mailbox_list_ex(int account_id, int mailbox_sync_type,
        EM_IF_ACCOUNT_ID_NULL(account_id, EMF_ERROR_INVALID_PARAM);
        EM_IF_NULL_RETURN_VALUE(count, EMF_ERROR_INVALID_PARAM);
 
-       if (!em_storage_get_mailbox_ex(account_id, mailbox_sync_type, with_count, &mailbox_count, &mailbox_tbl_list, true, &err))  {    
-               EM_DEBUG_EXCEPTION("em_storage_get_mailbox_ex failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+       if (!emstorage_get_mailbox_ex(account_id, mailbox_sync_type, with_count, &mailbox_count, &mailbox_tbl_list, true, &err))  {     
+               EM_DEBUG_EXCEPTION("emstorage_get_mailbox_ex failed [%d]", err);
+
                goto FINISH_OFF;
        } else
                err = EMF_ERROR_NONE;
        
        if (mailbox_count > 0)  {
-               if (!(*mailbox_list = em_core_malloc(sizeof(emf_mailbox_t) * mailbox_count)))  {
+               if (!(*mailbox_list = em_malloc(sizeof(emf_mailbox_t) * mailbox_count)))  {
                        EM_DEBUG_EXCEPTION("malloc failed for mailbox_list");
                        err= EMF_ERROR_OUT_OF_MEMORY;
                        goto FINISH_OFF;
@@ -336,7 +352,7 @@ EXPORT_API int email_get_mailbox_list_ex(int account_id, int mailbox_sync_type,
 
 FINISH_OFF:
        if (mailbox_tbl_list != NULL)
-               em_storage_free_mailbox(&mailbox_tbl_list, mailbox_count, NULL);
+               emstorage_free_mailbox(&mailbox_tbl_list, mailbox_count, NULL);
 
        EM_DEBUG_FUNC_END("err [%d]", err);
        return err;
@@ -349,23 +365,17 @@ EXPORT_API int email_get_mailbox_by_name(int account_id, const char *pMailboxNam
        
        int err = EMF_ERROR_NONE;
        emf_mailbox_t* curr_mailbox = NULL;
-       emf_mailbox_tbl_t* local_mailbox = NULL;
+       emstorage_mailbox_tbl_t* local_mailbox = NULL;
 
        EM_IF_NULL_RETURN_VALUE(pMailbox, EMF_ERROR_INVALID_PARAM);
        if(!pMailboxName)
                return EMF_ERROR_INVALID_PARAM; 
        
-       if (!em_storage_get_mailbox_by_name(account_id, -1, (char*)pMailboxName, &local_mailbox, true, &err))  /* Warning removal changes  */ {
-               if (err == EM_STORAGE_ERROR_MAILBOX_NOT_FOUND)
-                       err = EMF_ERROR_MAILBOX_NOT_FOUND; else if (err == EM_STORAGE_ERROR_INVALID_PARAM)
-                       err = EMF_ERROR_INVALID_PARAM; else if (err == EM_STORAGE_ERROR_OUT_OF_MEMORY)
-                       err = EMF_ERROR_OUT_OF_MEMORY; else if (err == EM_STORAGE_ERROR_DB_FAILURE)
-                       err = EMF_ERROR_DB_FAILURE; else
-                       err = EMF_ERROR_UNKNOWN;
-               
+       if (!emstorage_get_mailbox_by_name(account_id, -1, (char*)pMailboxName, &local_mailbox, true, &err)) {
+               EM_DEBUG_EXCEPTION("emstorage_get_mailbox_by_name failed [%d]", err);
                return err;
        } else {
-               curr_mailbox = em_core_malloc(sizeof(emf_mailbox_t));
+               curr_mailbox = em_malloc(sizeof(emf_mailbox_t));
                memset(curr_mailbox, 0x00, sizeof(emf_mailbox_t));
 
                curr_mailbox->account_id = local_mailbox->account_id;
@@ -385,7 +395,7 @@ EXPORT_API int email_get_mailbox_by_name(int account_id, const char *pMailboxNam
 
        *pMailbox = curr_mailbox;
 
-       em_storage_free_mailbox(&local_mailbox, 1, &err);
+       emstorage_free_mailbox(&local_mailbox, 1, &err);
        EM_DEBUG_FUNC_END("err [%d]", err);
        return err;
 }
@@ -397,7 +407,7 @@ EXPORT_API int email_get_child_mailbox_list(int account_id, const char *parent_m
        
        int err = EMF_ERROR_NONE;
        int counter = 0;
-       emf_mailbox_tbl_t* mailbox_tbl = NULL; 
+       emstorage_mailbox_tbl_t* mailbox_tbl = NULL; 
        int i =0;
        
        EM_IF_NULL_RETURN_VALUE(account_id, EMF_ERROR_INVALID_PARAM);
@@ -407,16 +417,16 @@ EXPORT_API int email_get_child_mailbox_list(int account_id, const char *parent_m
        *mailbox_list = NULL;
        *count = 0;
        
-       if (!em_storage_get_child_mailbox_list(account_id,(char*)parent_mailbox, &counter, &mailbox_tbl, true, &err))   {
-               EM_DEBUG_EXCEPTION("em_storage_get_child_mailbox_list failed[%d]", err);
+       if (!emstorage_get_child_mailbox_list(account_id,(char*)parent_mailbox, &counter, &mailbox_tbl, true, &err))   {
+               EM_DEBUG_EXCEPTION("emstorage_get_child_mailbox_list failed[%d]", err);
                
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+
                goto FINISH_OFF;
        } else
                err = EMF_ERROR_NONE;
        
        if (counter > 0)  {
-               if (!(*mailbox_list = em_core_malloc(sizeof(emf_mailbox_t) * counter)))  {
+               if (!(*mailbox_list = em_malloc(sizeof(emf_mailbox_t) * counter)))  {
                        EM_DEBUG_EXCEPTION("malloc failed for mailbox_list");
                        
                        err= EMF_ERROR_OUT_OF_MEMORY;
@@ -446,7 +456,7 @@ EXPORT_API int email_get_child_mailbox_list(int account_id, const char *parent_m
 
 FINISH_OFF:
        if (mailbox_tbl != NULL)
-               em_storage_free_mailbox(&mailbox_tbl, counter, NULL);
+               emstorage_free_mailbox(&mailbox_tbl, counter, NULL);
        EM_DEBUG_FUNC_END("err [%d]", err);
        return err;
 }
@@ -459,7 +469,7 @@ EXPORT_API int email_get_mailbox_by_mailbox_type(int account_id, emf_mailbox_typ
        
        int err = EMF_ERROR_NONE;
        emf_mailbox_t* curr_mailbox = NULL;
-       emf_mailbox_tbl_t* local_mailbox = NULL;
+       emstorage_mailbox_tbl_t* local_mailbox = NULL;
 
        EM_IF_NULL_RETURN_VALUE(mailbox, EMF_ERROR_INVALID_PARAM);      
        EM_IF_NULL_RETURN_VALUE(account_id, EMF_ERROR_INVALID_PARAM)    ;
@@ -467,13 +477,13 @@ EXPORT_API int email_get_mailbox_by_mailbox_type(int account_id, emf_mailbox_typ
 
        if(mailbox_type < EMF_MAILBOX_TYPE_INBOX || mailbox_type > EMF_MAILBOX_TYPE_ALL_EMAILS)
                return EMF_ERROR_INVALID_PARAM;
-       if (!em_storage_get_mailbox_by_mailbox_type(account_id, mailbox_type, &local_mailbox, true, &err))  {
-               EM_DEBUG_EXCEPTION("em_storage_get_mailbox_by_mailbox_type failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+       if (!emstorage_get_mailbox_by_mailbox_type(account_id, mailbox_type, &local_mailbox, true, &err))  {
+               EM_DEBUG_EXCEPTION("emstorage_get_mailbox_by_mailbox_type failed [%d]", err);
+
                goto FINISH_OFF;
        } else {
                err = EMF_ERROR_NONE;
-               curr_mailbox = em_core_malloc(sizeof(emf_mailbox_t));
+               curr_mailbox = em_malloc(sizeof(emf_mailbox_t));
                memset(curr_mailbox, 0x00, sizeof(emf_mailbox_t));
 
                curr_mailbox->account_id = local_mailbox->account_id;
@@ -495,7 +505,7 @@ EXPORT_API int email_get_mailbox_by_mailbox_type(int account_id, emf_mailbox_typ
 FINISH_OFF:
 
        if(local_mailbox)
-               em_storage_free_mailbox(&local_mailbox, 1, NULL);
+               emstorage_free_mailbox(&local_mailbox, 1, NULL);
        EM_DEBUG_FUNC_END("err [%d]", err);
        return err;
 }
@@ -511,36 +521,73 @@ EXPORT_API int email_set_mail_slot_size(int account_id, char* mailbox_name, int
                return EMF_ERROR_INVALID_PARAM;
        }
        
-       HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_SET_MAIL_SLOT_SIZE);      
+       HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_SET_MAIL_SLOT_SIZE);  
 
        EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
 
        if (hAPI) {
-               if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, &account_id, sizeof(int)))
-                       EM_DEBUG_EXCEPTION(" ipcEmailAPI_AddParameter for account_id failed");
-       
-               if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, &new_slot_size, sizeof(int)))
-                       EM_DEBUG_EXCEPTION(" ipcEmailAPI_AddParameter for new_slot_size failed");
-               
+               if(!emipc_add_parameter(hAPI, ePARAMETER_IN, &account_id, sizeof(int))) {
+                       EM_DEBUG_EXCEPTION(" emipc_add_parameter for account_id failed");
+                       EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+               }
+
+               if(!emipc_add_parameter(hAPI, ePARAMETER_IN, &new_slot_size, sizeof(int))) {
+                       EM_DEBUG_EXCEPTION(" emipc_add_parameter for new_slot_size failed");
+                       EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+               }
+
                if(mailbox_name) {
-                       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, mailbox_name, strlen(mailbox_name) ))
-                               EM_DEBUG_EXCEPTION(" ipcEmailAPI_AddParameter for mailbox_name failed");
+                       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, mailbox_name, strlen(mailbox_name) )) {
+                               EM_DEBUG_EXCEPTION(" emipc_add_parameter for mailbox_name failed");
+                               EM_SAFE_FREE(mailbox_name);
+                               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+                       }
                }
                
-               if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-                       EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPI failed");
+               if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+                       EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed");
                        EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
-               } else {
-                       err = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
-                       EM_DEBUG_LOG("email_set_mail_slot_size error VALUE [%d]", err);
-                       if(handle) {
-                               *handle = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1);
-                               EM_DEBUG_LOG("email_set_mail_slot_size handle VALUE [%d]", handle);
-                       }
-                       ipcEmailAPI_Destroy(hAPI);
-                       hAPI = NULL;
+               } 
+       
+               emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);
+               EM_DEBUG_LOG("email_set_mail_slot_size error VALUE [%d]", err);
+               if(handle) {
+                       emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), handle);
+                       EM_DEBUG_LOG("email_set_mail_slot_size handle VALUE [%d]", handle);
                }
+               emipc_destroy_email_api(hAPI);
+               hAPI = NULL;
+               
+       }
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+}
+
+EXPORT_API int email_free_mailbox(emf_mailbox_t** mailbox_list, int count)
+{
+       EM_DEBUG_FUNC_BEGIN("mailbox_list[%p], count[%d]", mailbox_list, count);
+       int err = EMF_ERROR_NONE;
+
+       if (count <= 0 || !mailbox_list || !*mailbox_list) {
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
+               err = EMF_ERROR_INVALID_PARAM;
+               goto FINISH_OFF;
+       }
+
+       emf_mailbox_t *p = *mailbox_list;
+       int i;
+
+       for (i = 0; i < count; i++)  {
+               EM_SAFE_FREE(p[i].name);
+               EM_SAFE_FREE(p[i].alias);
+               EM_SAFE_FREE(p[i].account_name);
        }
+
+       EM_SAFE_FREE(p);
+       *mailbox_list = NULL;
+
+FINISH_OFF:
        EM_DEBUG_FUNC_END("err [%d]", err);
        return err;
+
 }
similarity index 63%
rename from MAPI/Emf_Mapi_Network.c
rename to email-api/email-api-network.c
index 658ab0e..d1e9451 100755 (executable)
 /**
  *
  * This file contains the data structures and interfaces needed for application,
- * to interact with Email Engine.
- * @file               Emf_Mapi_Network.c
+ * to interact with email-service.
+ * @file               email-api-network.c
  * @brief              This file contains the data structures and interfaces of Network related Functionality provided by 
- *                     Email Engine . 
+ *                     email-service . 
  */
  
-#include <Emf_Mapi.h>
+#include "email-api.h"
 #include "string.h"
-#include "Msg_Convert.h"
-#include "Emf_Mapi_Mailbox.h"
-#include "emf-types.h"
-#include "ipc-library.h"
-#include "em-storage.h"
+#include "email-convert.h"
+#include "email-api-mailbox.h"
+#include "email-types.h"
+#include "email-utilities.h"
+#include "email-ipc.h"
+#include "email-storage.h"
 
 #ifdef __FEATURE_SUPPORT_ACTIVE_SYNC__
 #include <vconf.h>
@@ -95,23 +96,22 @@ static int email_get_handle_for_activesync(int *handle, int *error)
 
        static int next_handle = 0;
        int ret = false;
-       int err= EMF_ERROR_NONE;
+       int err = EMF_ERROR_NONE;
                        
        if ( handle == NULL ) {
                EM_DEBUG_EXCEPTION("email_get_handle_for_activesync failed : handle is NULL");
-               ret = false;
+               err = EMF_ERROR_INVALID_PARAM;
                goto FINISH_OFF;
        }
        
        if ( vconf_get_int(VCONFKEY_EMAIL_SERVICE_ACTIVE_SYNC_HANDLE, &next_handle)  != 0 ) {
                EM_DEBUG_EXCEPTION("vconf_get_int failed");
-
                if ( next_handle != 0 ) {
-                       ret = false;
                        err = EMF_ERROR_GCONF_FAILURE;
                        goto FINISH_OFF;
                }
        }
+
        EM_DEBUG_LOG(">>>>>> VCONFKEY_EMAIL_SERVICE_ACTIVE_SYNC_HANDLE : get lastest handle[%d]", next_handle);
 
        /*  set the value of the handle for active sync */
@@ -121,8 +121,6 @@ static int email_get_handle_for_activesync(int *handle, int *error)
        }
        if ( vconf_set_int(VCONFKEY_EMAIL_SERVICE_ACTIVE_SYNC_HANDLE, next_handle) != 0) {
                EM_DEBUG_EXCEPTION("vconf_set_int failed");
-               
-               ret = false;
                err = EMF_ERROR_GCONF_FAILURE;
                goto FINISH_OFF;
        }
@@ -140,14 +138,14 @@ FINISH_OFF:
 
 static int email_send_notification_to_active_sync_engine(int subType, ASNotiData *data)
 {
-       EM_DEBUG_FUNC_BEGIN();
+       EM_DEBUG_FUNC_BEGIN("subType [%d], data [%p]", subType, data);
 
-       DBusConnection *connection;
-       DBusMessage    *signal = NULL;
-       DBusError      error; 
-       const char     *nullString = "";
-
-       EM_DEBUG_LOG("Active Sync noti subType : [%d]", subType);
+       DBusConnection     *connection;
+       DBusMessage        *signal = NULL;
+       DBusError           error;
+       const char         *nullString = "";
+       int                 i = 0;
+       dbus_int32_t        array_for_time_type[9] = { 0 , };
 
        dbus_error_init (&error);
        connection = dbus_bus_get(DBUS_BUS_SYSTEM, &error);
@@ -168,7 +166,7 @@ static int email_send_notification_to_active_sync_engine(int subType, ASNotiData
                        EM_DEBUG_LOG("options.keep_local_copy:[%d]", data->send_mail.options.keep_local_copy);
                        EM_DEBUG_LOG("options.req_delivery_receipt:[%d]", data->send_mail.options.req_delivery_receipt);
                        EM_DEBUG_LOG("options.req_read_receipt:[%d]", data->send_mail.options.req_read_receipt);
-                       /*      download_limit, block_address, block_subject might not be needed */
+                       /* download_limit, block_address, block_subject might not be needed */
                        EM_DEBUG_LOG("options.download_limit:[%d]", data->send_mail.options.download_limit);
                        EM_DEBUG_LOG("options.block_address:[%d]", data->send_mail.options.block_address);
                        EM_DEBUG_LOG("options.block_subject:[%d]", data->send_mail.options.block_subject);
@@ -182,7 +180,8 @@ static int email_send_notification_to_active_sync_engine(int subType, ASNotiData
                        dbus_message_append_args(signal, DBUS_TYPE_INT32, &(data->send_mail.handle), DBUS_TYPE_INVALID);
                        dbus_message_append_args(signal, DBUS_TYPE_INT32, &(data->send_mail.account_id), DBUS_TYPE_INVALID);
                        if ( data->send_mail.mailbox_name == NULL )
-                               dbus_message_append_args(signal, DBUS_TYPE_STRING, &(nullString), DBUS_TYPE_INVALID); else
+                               dbus_message_append_args(signal, DBUS_TYPE_STRING, &(nullString), DBUS_TYPE_INVALID);
+                       else
                                dbus_message_append_args(signal, DBUS_TYPE_STRING, &(data->send_mail.mailbox_name), DBUS_TYPE_INVALID);
                        dbus_message_append_args(signal, DBUS_TYPE_INT32, &(data->send_mail.mail_id), DBUS_TYPE_INVALID);
                        dbus_message_append_args(signal, DBUS_TYPE_INT32, &(data->send_mail.options.priority), DBUS_TYPE_INVALID);
@@ -190,7 +189,8 @@ static int email_send_notification_to_active_sync_engine(int subType, ASNotiData
                        dbus_message_append_args(signal, DBUS_TYPE_INT32, &(data->send_mail.options.req_delivery_receipt), DBUS_TYPE_INVALID);
                        dbus_message_append_args(signal, DBUS_TYPE_INT32, &(data->send_mail.options.req_read_receipt), DBUS_TYPE_INVALID);
                        if ( data->send_mail.options.display_name_from == NULL )
-                               dbus_message_append_args(signal, DBUS_TYPE_STRING, &(nullString), DBUS_TYPE_INVALID); else
+                               dbus_message_append_args(signal, DBUS_TYPE_STRING, &(nullString), DBUS_TYPE_INVALID);
+                       else
                                dbus_message_append_args(signal, DBUS_TYPE_STRING, &(data->send_mail.options.display_name_from), DBUS_TYPE_INVALID);
 
                        dbus_message_append_args(signal, DBUS_TYPE_INT32, &(data->send_mail.options.reply_with_body), DBUS_TYPE_INVALID);
@@ -198,7 +198,8 @@ static int email_send_notification_to_active_sync_engine(int subType, ASNotiData
                        dbus_message_append_args(signal, DBUS_TYPE_INT32, &(data->send_mail.options.add_myname_card), DBUS_TYPE_INVALID);
                        dbus_message_append_args(signal, DBUS_TYPE_INT32, &(data->send_mail.options.add_signature), DBUS_TYPE_INVALID);
                        if ( data->send_mail.options.signature == NULL )
-                               dbus_message_append_args(signal, DBUS_TYPE_STRING, &(nullString), DBUS_TYPE_INVALID); else
+                               dbus_message_append_args(signal, DBUS_TYPE_STRING, &(nullString), DBUS_TYPE_INVALID);
+                       else
                                dbus_message_append_args(signal, DBUS_TYPE_STRING, &(data->send_mail.options.signature), DBUS_TYPE_INVALID);
 
                        break;
@@ -216,9 +217,9 @@ static int email_send_notification_to_active_sync_engine(int subType, ASNotiData
                        dbus_message_append_args(signal, DBUS_TYPE_INT32, &(data->sync_header.handle ), DBUS_TYPE_INVALID);
                        dbus_message_append_args(signal, DBUS_TYPE_INT32, &(data->sync_header.account_id ), DBUS_TYPE_INVALID);
                        if ( data->sync_header.mailbox_name == NULL )
-                               dbus_message_append_args(signal, DBUS_TYPE_STRING, &(nullString), DBUS_TYPE_INVALID); else
+                               dbus_message_append_args(signal, DBUS_TYPE_STRING, &(nullString), DBUS_TYPE_INVALID);
+                       else
                                dbus_message_append_args(signal, DBUS_TYPE_STRING, &(data->sync_header.mailbox_name), DBUS_TYPE_INVALID);
-
                        break;
                case ACTIVE_SYNC_NOTI_DOWNLOAD_BODY:                    /*  publish a download body notification to ASE */
                        EM_DEBUG_LOG("handle:[%d]", data->download_body.handle);
@@ -241,20 +242,76 @@ static int email_send_notification_to_active_sync_engine(int subType, ASNotiData
                        dbus_message_append_args(signal, DBUS_TYPE_INT32, &(data->download_attachment.account_id  ), DBUS_TYPE_INVALID);
                        dbus_message_append_args(signal, DBUS_TYPE_INT32, &(data->download_attachment.mail_id ), DBUS_TYPE_INVALID);
                        if ( data->download_attachment.attachment_order == NULL )
-                               dbus_message_append_args(signal, DBUS_TYPE_STRING, &(nullString), DBUS_TYPE_INVALID); else
+                               dbus_message_append_args(signal, DBUS_TYPE_STRING, &(nullString), DBUS_TYPE_INVALID);
+                       else
                                dbus_message_append_args(signal, DBUS_TYPE_STRING, &(data->download_attachment.attachment_order), DBUS_TYPE_INVALID);
                        break;
                case ACTIVE_SYNC_NOTI_VALIDATE_ACCOUNT:
                        EM_DEBUG_EXCEPTION("Not support yet : subType[ACTIVE_SYNC_NOTI_VALIDATE_ACCOUNT]", subType);
                        break;
                case ACTIVE_SYNC_NOTI_CANCEL_JOB:
-                       EM_DEBUG_LOG("account_id:[%d]", data->cancel_job.account_id );
+                       EM_DEBUG_LOG("account_id:[%d]",       data->cancel_job.account_id );
                        EM_DEBUG_LOG("handle to cancel:[%d]", data->cancel_job.handle);
 
                        dbus_message_append_args(signal, DBUS_TYPE_INT32, &(data->cancel_job.account_id  ), DBUS_TYPE_INVALID);
                        dbus_message_append_args(signal, DBUS_TYPE_INT32, &(data->cancel_job.handle  ), DBUS_TYPE_INVALID);
                        break;
                case ACTIVE_SYNC_NOTI_SEARCH_ON_SERVER:
+                       EM_DEBUG_LOG("account_id:[%d]",          data->search_mail_on_server.account_id );
+                       EM_DEBUG_LOG("mailbox_name:[%s]",        data->search_mail_on_server.mailbox_name );
+                       EM_DEBUG_LOG("search_filter_count:[%d]", data->search_mail_on_server.search_filter_count );
+                       EM_DEBUG_LOG("handle to cancel:[%d]",    data->search_mail_on_server.handle);
+
+                       dbus_message_append_args(signal, DBUS_TYPE_INT32,  &(data->search_mail_on_server.account_id), DBUS_TYPE_INVALID);
+                       dbus_message_append_args(signal, DBUS_TYPE_STRING, &(data->search_mail_on_server.mailbox_name), DBUS_TYPE_INVALID);
+                       dbus_message_append_args(signal, DBUS_TYPE_INT32,  &(data->search_mail_on_server.search_filter_count), DBUS_TYPE_INVALID);
+                       for(i = 0; i < data->search_mail_on_server.search_filter_count; i++) {
+                               dbus_message_append_args(signal, DBUS_TYPE_INT32,  &(data->search_mail_on_server.search_filter_list[i].search_filter_type), DBUS_TYPE_INVALID);
+                               switch(data->search_mail_on_server.search_filter_list[i].search_filter_type) {
+                                       case EMAIL_SEARCH_FILTER_TYPE_MESSAGE_NO       :
+                                       case EMAIL_SEARCH_FILTER_TYPE_UID              :
+                                       case EMAIL_SEARCH_FILTER_TYPE_SIZE_LARSER      :
+                                       case EMAIL_SEARCH_FILTER_TYPE_SIZE_SMALLER     :
+                                       case EMAIL_SEARCH_FILTER_TYPE_FLAGS_ANSWERED   :
+                                       case EMAIL_SEARCH_FILTER_TYPE_FLAGS_DELETED    :
+                                       case EMAIL_SEARCH_FILTER_TYPE_FLAGS_DRAFT      :
+                                       case EMAIL_SEARCH_FILTER_TYPE_FLAGS_FLAGED     :
+                                       case EMAIL_SEARCH_FILTER_TYPE_FLAGS_RECENT     :
+                                       case EMAIL_SEARCH_FILTER_TYPE_FLAGS_SEEN       :
+                                               dbus_message_append_args(signal, DBUS_TYPE_INT32, &(data->search_mail_on_server.search_filter_list[i].search_filter_key_value.integer_type_key_value), DBUS_TYPE_INVALID);
+                                               break;
+
+                                       case EMAIL_SEARCH_FILTER_TYPE_BCC              :
+                                       case EMAIL_SEARCH_FILTER_TYPE_CC               :
+                                       case EMAIL_SEARCH_FILTER_TYPE_FROM             :
+                                       case EMAIL_SEARCH_FILTER_TYPE_KEYWORD          :
+                                       case EMAIL_SEARCH_FILTER_TYPE_SUBJECT          :
+                                       case EMAIL_SEARCH_FILTER_TYPE_TO               :
+                                       case EMAIL_SEARCH_FILTER_TYPE_MESSAGE_ID       :
+                                               dbus_message_append_args(signal, DBUS_TYPE_STRING, &(data->search_mail_on_server.search_filter_list[i].search_filter_key_value.string_type_key_value), DBUS_TYPE_INVALID);
+                                               break;
+
+                                       case EMAIL_SEARCH_FILTER_TYPE_SENT_DATE_BEFORE :
+                                       case EMAIL_SEARCH_FILTER_TYPE_SENT_DATE_ON     :
+                                       case EMAIL_SEARCH_FILTER_TYPE_SENT_DATE_SINCE  : {
+                                                       array_for_time_type[0] = data->search_mail_on_server.search_filter_list[i].search_filter_key_value.time_type_key_value.tm_sec;
+                                                       array_for_time_type[1] = data->search_mail_on_server.search_filter_list[i].search_filter_key_value.time_type_key_value.tm_min;
+                                                       array_for_time_type[2] = data->search_mail_on_server.search_filter_list[i].search_filter_key_value.time_type_key_value.tm_hour;
+                                                       array_for_time_type[3] = data->search_mail_on_server.search_filter_list[i].search_filter_key_value.time_type_key_value.tm_mday;
+                                                       array_for_time_type[4] = data->search_mail_on_server.search_filter_list[i].search_filter_key_value.time_type_key_value.tm_mon;
+                                                       array_for_time_type[5] = data->search_mail_on_server.search_filter_list[i].search_filter_key_value.time_type_key_value.tm_year;
+                                                       array_for_time_type[6] = data->search_mail_on_server.search_filter_list[i].search_filter_key_value.time_type_key_value.tm_wday;
+                                                       array_for_time_type[7] = data->search_mail_on_server.search_filter_list[i].search_filter_key_value.time_type_key_value.tm_yday;
+                                                       array_for_time_type[8] = data->search_mail_on_server.search_filter_list[i].search_filter_key_value.time_type_key_value.tm_isdst;
+                                                       dbus_message_append_args(signal, DBUS_TYPE_ARRAY, DBUS_TYPE_INT32, array_for_time_type, 9, DBUS_TYPE_INVALID);
+                                               }
+                                               break;
+                                       default :
+                                               EM_DEBUG_EXCEPTION("Invalid filter type [%d]", data->search_mail_on_server.search_filter_list[i].search_filter_type);
+                                               break;
+                               }
+                       }
+                       dbus_message_append_args(signal, DBUS_TYPE_INT32,  &(data->search_mail_on_server.handle), DBUS_TYPE_INVALID);
                        break;
                default:
                        EM_DEBUG_EXCEPTION("Invalid Notification type of Active Sync : subType[%d]", subType);
@@ -333,7 +390,7 @@ EXPORT_API int email_send_mail( emf_mailbox_t* mailbox, int mail_id, emf_option_
                if(handle)
                        *handle = as_handle;
        } else {                
-               hAPI = ipcEmailAPI_Create(_EMAIL_API_SEND_MAIL);        
+               hAPI = emipc_create_email_api(_EMAIL_API_SEND_MAIL);    
 
                EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
 
@@ -342,15 +399,15 @@ EXPORT_API int email_send_mail( emf_mailbox_t* mailbox, int mail_id, emf_option_
 
                EM_PROXY_IF_NULL_RETURN_VALUE(mailbox_stream, hAPI, EMF_ERROR_NULL_VALUE);
 
-               if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, mailbox_stream, size)){
-                       EM_DEBUG_EXCEPTION("email_send_mail--Add Param mailbox Fail");
+               if(!emipc_add_parameter(hAPI, ePARAMETER_IN, mailbox_stream, size)){
+                       EM_DEBUG_EXCEPTION("email_send_mail--Add Param mailbox failed");
                        EM_SAFE_FREE(mailbox_stream);
                        EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
                }
                
                /* mail_id */
-               if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&mail_id, sizeof(int))){
-                       EM_DEBUG_EXCEPTION("email_send_mail--Add Param mail_id Fail");
+               if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&mail_id, sizeof(int))){
+                       EM_DEBUG_EXCEPTION("email_send_mail--Add Param mail_id failed");
                        EM_SAFE_FREE(mailbox_stream);
                        EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
                }
@@ -363,36 +420,35 @@ EXPORT_API int email_send_mail( emf_mailbox_t* mailbox, int mail_id, emf_option_
                        EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
                }
 
-               if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, pSendingOption, size)){
-                       EM_DEBUG_EXCEPTION("email_send_mail--Add Param Sending_Option Fail  ");
+               if(!emipc_add_parameter(hAPI, ePARAMETER_IN, pSendingOption, size)){
+                       EM_DEBUG_EXCEPTION("email_send_mail--Add Param Sending_Option failed  ");
                        EM_SAFE_FREE(mailbox_stream);
                        EM_SAFE_FREE(pSendingOption);
                        EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
                }
 
-               if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-                       EM_DEBUG_EXCEPTION("email_send_mail--ipcEmailProxy_ExecuteAPI Fail  ");
+               if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+                       EM_DEBUG_EXCEPTION("email_send_mail--emipc_execute_proxy_api failed  ");
                        EM_SAFE_FREE(pSendingOption); 
                        EM_SAFE_FREE(mailbox_stream);
                        EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_CRASH);
                }
 
-               err = *((int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0));
-               if (err == EMF_ERROR_NONE)
-               {
+               emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);
+               if (err == EMF_ERROR_NONE) {
                        if(handle)
-                               *handle = *(unsigned int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1); 
+                               emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), handle);
                }
        }
 
 FINISH_OFF:
-       ipcEmailAPI_Destroy(hAPI);
+       emipc_destroy_email_api(hAPI);
        hAPI = (HIPC_API)NULL;
        EM_SAFE_FREE(pSendingOption); 
        EM_SAFE_FREE(mailbox_stream);
        EM_SAFE_FREE(as_noti_data.send_mail.mailbox_name);
 #else  /*  __FEATURE_SUPPORT_ACTIVE_SYNC__ */
-       HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_SEND_MAIL);       
+       HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_SEND_MAIL);   
 
        EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
 
@@ -401,15 +457,15 @@ FINISH_OFF:
 
        EM_PROXY_IF_NULL_RETURN_VALUE(mailbox_stream, hAPI, EMF_ERROR_NULL_VALUE);
 
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, mailbox_stream, size)){
-               EM_DEBUG_EXCEPTION("Add Param mailbox Fail  ");
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, mailbox_stream, size)){
+               EM_DEBUG_EXCEPTION("Add Param mailbox failed  ");
                EM_SAFE_FREE(mailbox_stream);
                EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
        }
        
        /* mail_id */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&mail_id, sizeof(int))){
-               EM_DEBUG_EXCEPTION("Add Param mail_id Fail  ");
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&mail_id, sizeof(int))){
+               EM_DEBUG_EXCEPTION("Add Param mail_id failed  ");
                EM_SAFE_FREE(mailbox_stream);
                EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
        }
@@ -422,30 +478,30 @@ FINISH_OFF:
                EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
        }
 
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, pSendingOption, size)){
-               EM_DEBUG_EXCEPTION("Add Param Sending_Option Fail  ");
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, pSendingOption, size)){
+               EM_DEBUG_EXCEPTION("Add Param Sending_Option failed  ");
                EM_SAFE_FREE(mailbox_stream);
                EM_SAFE_FREE(pSendingOption);
                EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
        }
 
-       if(!ipcEmailProxy_ExecuteAPI(hAPI, NULL)) {
-               EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPI Fail  ");
+       if(!emipc_execute_proxy_api(hAPI, NULL)) {
+               EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed  ");
                EM_SAFE_FREE(pSendingOption);
                EM_SAFE_FREE(mailbox_stream);
                EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
        }
 
-       err  = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
+       err  emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), );
        if (err == EMF_ERROR_NONE)
        {
                if(handle)
-                       handle = *(unsigned int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1);  /* Warning removal changes  */
+                       handle = *(unsigned int*)emipc_get_parameter(hAPI, ePARAMETER_OUT, 1);  /* Warning removal changes  */
        }
                
        EM_DEBUG_LOG(" >>>>>> ERROR CODE : %d ", err);
 
-       ipcEmailAPI_Destroy(hAPI);
+       emipc_destroy_email_api(hAPI);
        hAPI = NULL;
        EM_SAFE_FREE(pSendingOption);
        EM_SAFE_FREE(mailbox_stream);
@@ -466,124 +522,38 @@ EXPORT_API int email_send_saved(int account_id, emf_option_t* sending_option, un
        EM_IF_NULL_RETURN_VALUE(sending_option, EMF_ERROR_INVALID_PARAM);
        EM_IF_ACCOUNT_ID_NULL(account_id, EMF_ERROR_INVALID_PARAM);
        
-       HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_MAIL_SEND_SAVED);
+       HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_SEND_SAVED);
 
        EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
        
        /* Account ID */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, &(account_id), sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter account_id Fail");
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, &(account_id), sizeof(int))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter account_id failed");
+               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+       }
 
        /* Sending Option */
        pOptionStream = em_convert_option_to_byte_stream(sending_option, &size);
 
        EM_PROXY_IF_NULL_RETURN_VALUE(pOptionStream, hAPI, EMF_ERROR_NULL_VALUE);
 
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, pOptionStream, size))
-               EM_DEBUG_EXCEPTION("Add Param sending option Fail");
-       
-       /* Execute API */
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPIFail");
-               EM_SAFE_FREE(pOptionStream);
-               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
-       }
-
-       err = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0); 
-       ipcEmailAPI_Destroy(hAPI);
-       
-       hAPI = NULL;
-       EM_SAFE_FREE(pOptionStream);
-
-       EM_DEBUG_FUNC_END("err [%d]", err);  
-       return err;
-}
-
-EXPORT_API int email_send_report(emf_mail_t* mail,  unsigned* handle)
-{
-       EM_DEBUG_FUNC_BEGIN("mail[%p], handle[%p]", mail, handle);
-       
-       char* pMailHeadStream =  NULL;
-       char* pMailBodyStream =  NULL;
-       char* pMailInfoStream =  NULL;
-       int size = 0;
-       int err = EMF_ERROR_NONE;
-
-       if (!mail || !mail->info || mail->info->account_id <= 0 || !mail->head || 
-               !mail->head->from || !mail->head->mid)  {
-               if (mail != NULL)  {
-                       if (mail->info != NULL)  {
-                               if (mail->head != NULL)
-                                       EM_DEBUG_LOG("mail->info->account_id[%d], mail->head->from[%p], mail->head->mid[%p]", mail->info->account_id, mail->head->from, mail->head->mid); else
-                                       EM_DEBUG_LOG("mail->info->account_id[%d], mail->head[%p]", mail->info->account_id, mail->head);         
-                       } else  {
-                               if (mail->head != NULL)
-                                       EM_DEBUG_LOG("mail->info[%p],  mail->head->from[%p], mail->head->mid[%p]", mail->info, mail->head->from, mail->head->mid); else
-                                       EM_DEBUG_LOG("mail->info[%p],  mail->head[%p]", mail->info, mail->head);
-                       }
-               } else
-                       EM_DEBUG_LOG("mail[%p]", mail);
-               
-               err = EMF_ERROR_INVALID_MAIL;           
-               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_MAIL");
-               EM_DEBUG_FUNC_END("err [%d]", err); 
-               return err;
-       }
-       
-       HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_MAIL_SEND_REPORT);        
-
-       EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
-
-       /* Head */
-       pMailHeadStream = em_convert_mail_head_to_byte_stream(mail->head, &size);
-
-       EM_PROXY_IF_NULL_RETURN_VALUE(pMailHeadStream, hAPI, EMF_ERROR_NULL_VALUE);
-
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, pMailHeadStream, size))
-               EM_DEBUG_EXCEPTION("Add Param mail head Fail  ");
-
-       /* Body */
-       pMailBodyStream = em_convert_mail_body_to_byte_stream(mail->body, &size);
-
-       if(NULL == pMailBodyStream) {
-               EM_SAFE_FREE(pMailHeadStream);
-               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
-       }
-
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, pMailBodyStream, size))
-               EM_DEBUG_EXCEPTION("Add Param mail body Fail  ");
-
-       /* Info */
-       pMailInfoStream = em_convert_mail_info_to_byte_stream(mail->info, &size);
-
-       /* EM_PROXY_IF_NULL_RETURN_VALUE(pMailInfoStream, hAPI, EMF_ERROR_NULL_VALUE); */
-       if(NULL == pMailInfoStream) {
-               EM_SAFE_FREE(pMailHeadStream);
-               EM_SAFE_FREE(pMailBodyStream);
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, pOptionStream, size)) {
+               EM_DEBUG_EXCEPTION("Add Param sending option failed");
                EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
        }
 
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, pMailInfoStream, size))
-               EM_DEBUG_EXCEPTION("Add Param mail body Fail");
-
        /* Execute API */
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPIFail");
-               EM_SAFE_FREE(pMailInfoStream);
-               EM_SAFE_FREE(pMailBodyStream);
-               EM_SAFE_FREE(pMailHeadStream);
+       if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed");
+               EM_SAFE_FREE(pOptionStream);
                EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
        }
 
-       err = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0); 
-
-       EM_SAFE_FREE(pMailHeadStream);
-       EM_SAFE_FREE(pMailBodyStream);
-       EM_SAFE_FREE(pMailInfoStream);
-               
-       ipcEmailAPI_Destroy(hAPI);
-
+       emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);        
+       emipc_destroy_email_api(hAPI);
+       
        hAPI = NULL;
+       EM_SAFE_FREE(pOptionStream);
 
        EM_DEBUG_FUNC_END("err [%d]", err);  
        return err;
@@ -601,22 +571,24 @@ EXPORT_API int email_sync_local_activity(int account_id)
                return EMF_ERROR_INVALID_PARAM;         
        }
        
-       HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_SYNC_LOCAL_ACTIVITY);
+       HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_SYNC_LOCAL_ACTIVITY);
 
        EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
 
        /* account_id */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&account_id, sizeof(int)))
-               EM_DEBUG_EXCEPTION("Add Param account_id Fail");
-               
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPIFail");
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&account_id, sizeof(int))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+       }
+       
+       if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed");
                EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
        }
 
-       err = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
+       emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);
 
-       ipcEmailAPI_Destroy(hAPI);
+       emipc_destroy_email_api(hAPI);
 
        hAPI = NULL;
        EM_DEBUG_FUNC_END("err [%d]", err);  
@@ -683,7 +655,7 @@ EXPORT_API int email_sync_header(emf_mailbox_t* mailbox, unsigned* handle)
 
        }
        else {
-               hAPI = ipcEmailAPI_Create(_EMAIL_API_SYNC_HEADER);      
+               hAPI = emipc_create_email_api(_EMAIL_API_SYNC_HEADER);  
 
                EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
 
@@ -691,31 +663,33 @@ EXPORT_API int email_sync_header(emf_mailbox_t* mailbox, unsigned* handle)
 
                EM_PROXY_IF_NULL_RETURN_VALUE(mailbox_stream, hAPI, EMF_ERROR_NULL_VALUE);
 
-               if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, mailbox_stream, size))
-                       EM_DEBUG_EXCEPTION("Add Param mail head Fail  ");
+               if(!emipc_add_parameter(hAPI, ePARAMETER_IN, mailbox_stream, size)) {
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed  ");
+                       EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+               }
 
-               if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-                       EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPIFail  ");
+               if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+                       EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed");
                        EM_SAFE_FREE(mailbox_stream);
                        EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
                }
                        
-               err = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0); 
+               emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);        
 
                if (err != EMF_ERROR_NONE)
                        goto FINISH_OFF;
 
                if(handle)
-                       *handle = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1);     
+                       emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), handle);      
        }
 
 FINISH_OFF:
-       ipcEmailAPI_Destroy(hAPI);
+       emipc_destroy_email_api(hAPI);
        hAPI = NULL;
        EM_SAFE_FREE(mailbox_stream);
        EM_SAFE_FREE(as_noti_data.sync_header.mailbox_name);
 #else  /*  __FEATURE_SUPPORT_ACTIVE_SYNC__              */
-       HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_SYNC_HEADER);     
+       HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_SYNC_HEADER); 
 
        EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
 
@@ -723,26 +697,28 @@ FINISH_OFF:
 
        EM_PROXY_IF_NULL_RETURN_VALUE(mailbox_stream, hAPI, EMF_ERROR_NULL_VALUE);
 
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, mailbox_stream, size))
-               EM_DEBUG_EXCEPTION("Add Param mail head Fail  ");
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, mailbox_stream, size)) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed  ");
+               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+       }
 
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPIFail  ");
+       if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed");
                EM_SAFE_FREE(mailbox_stream);
                EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
        }
                
-        err = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);        
+        emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);       
 
-        EM_DEBUG_LOG(" >>>>>> RETURN VALUE : %d ", err);
+        EM_DEBUG_LOG("RETURN VALUE : %d ", err);
         
          if (err != EMF_ERROR_NONE)
                 goto FINISH_OFF;
         
         if(handle)
-               *handle = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1);     
+               emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), handle);      
 FINISH_OFF:
-       ipcEmailAPI_Destroy(hAPI);
+       emipc_destroy_email_api(hAPI);
        hAPI = NULL;
        EM_SAFE_FREE(mailbox_stream);
 #endif /*  __FEATURE_SUPPORT_ACTIVE_SYNC__ */
@@ -764,11 +740,11 @@ EXPORT_API int email_sync_header_for_all_account(unsigned* handle)
 #ifdef __FEATURE_SUPPORT_ACTIVE_SYNC__
        ASNotiData as_noti_data;
        int i, account_count = 0;
-       emf_mail_account_tbl_t *account_tbl_array = NULL;
+       emstorage_account_tbl_t *account_tbl_array = NULL;
        int as_err;
 #endif
 
-       hAPI = ipcEmailAPI_Create(_EMAIL_API_SYNC_HEADER);      
+       hAPI = emipc_create_email_api(_EMAIL_API_SYNC_HEADER);  
 
        EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
 
@@ -781,29 +757,31 @@ EXPORT_API int email_sync_header_for_all_account(unsigned* handle)
 
        EM_PROXY_IF_NULL_RETURN_VALUE(mailbox_stream, hAPI, EMF_ERROR_NULL_VALUE);
 
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, mailbox_stream, size))
-               EM_DEBUG_EXCEPTION("Add Param mail head Fail  ");
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, mailbox_stream, size)) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed  ");
+               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+       }
 
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPIFail  ");
+       if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed");
                EM_SAFE_FREE(mailbox_stream);
                EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
        }
                
-        err = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);        
+        emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);       
 
         if (err != EMF_ERROR_NONE)
                 goto FINISH_OFF;
 
-         return_handle = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1);
+          emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), &return_handle);
 
 #ifdef __FEATURE_SUPPORT_ACTIVE_SYNC__
        memset(&as_noti_data, 0x00, sizeof(ASNotiData));
 
        /*  Get all accounts for sending notification to active sync engine. */
-       if (!em_storage_get_account_list(&account_count, &account_tbl_array , true, false, &as_err)) {
-               EM_DEBUG_EXCEPTION("email_get_account_list-- Failed [ %d ]  ", as_err);
-               err = em_storage_get_emf_error_from_em_storage_error(as_err);
+       if (!emstorage_get_account_list(&account_count, &account_tbl_array , true, false, &as_err)) {
+               EM_DEBUG_EXCEPTION("emstorage_get_account_list failed [ %d ]  ", as_err);
+
                goto FINISH_OFF;
        }
 
@@ -839,11 +817,11 @@ EXPORT_API int email_sync_header_for_all_account(unsigned* handle)
 
 FINISH_OFF:
 
-       ipcEmailAPI_Destroy(hAPI);
+       emipc_destroy_email_api(hAPI);
        hAPI = NULL;
        EM_SAFE_FREE(mailbox_stream);
        if ( account_tbl_array )
-               em_storage_free_account(&account_tbl_array, account_count, NULL);
+               emstorage_free_account(&account_tbl_array, account_count, NULL);
        
        EM_DEBUG_FUNC_END("err [%d]", err);  
        return err;
@@ -894,7 +872,7 @@ EXPORT_API int email_download_body(emf_mailbox_t* mailbox, int mail_id, int with
                if(handle)
                        *handle = as_handle;
        } else {
-               hAPI = ipcEmailAPI_Create(_EMAIL_API_DOWNLOAD_BODY);
+               hAPI = emipc_create_email_api(_EMAIL_API_DOWNLOAD_BODY);
 
                EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
 
@@ -903,41 +881,47 @@ EXPORT_API int email_download_body(emf_mailbox_t* mailbox, int mail_id, int with
                EM_PROXY_IF_NULL_RETURN_VALUE(mailbox_stream, hAPI, EMF_ERROR_NULL_VALUE);
 
                /* MailBox Information */
-               if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, mailbox_stream, size))
-                       EM_DEBUG_EXCEPTION("Add Param mail head Fail  ");
+               if(!emipc_add_parameter(hAPI, ePARAMETER_IN, mailbox_stream, size)) {
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed  ");
+                       EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+               }
 
                /* Mail Id */
-               if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&mail_id, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("Add Param mail head Fail  ");
+               if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&mail_id, sizeof(int))) {
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed  ");
+                       EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+               }
 
                /* with_attachment */
-               if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&with_attachment, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("Add Param mail head Fail  ");
+               if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&with_attachment, sizeof(int))) {
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed  ");
+                       EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+               }
                
-               if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-                       EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPIFail  ");
+               if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+                       EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed");
                        EM_SAFE_FREE(mailbox_stream);
                        EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
                }
                        
-                err = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);        
+                emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);       
                 if (err != EMF_ERROR_NONE)             
                         goto FINISH_OFF;
                 
                 if(handle)     
                 {
-                       *handle = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1);
-                       EM_DEBUG_LOG(" >>>>>>>>>>>>>>>>>>> RETURN VALUE : %d  handle %d", err, *handle);
+                       emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), handle);
+                       EM_DEBUG_LOG("RETURN VALUE : %d  handle %d", err, *handle);
 
                 }
        }
 
 FINISH_OFF:
-       ipcEmailAPI_Destroy(hAPI);
+       emipc_destroy_email_api(hAPI);
        hAPI = NULL;
        EM_SAFE_FREE(mailbox_stream);
 #else  /*  __FEATURE_SUPPORT_ACTIVE_SYNC__              */
-       HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_DOWNLOAD_BODY);
+       HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_DOWNLOAD_BODY);
 
        EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
 
@@ -946,36 +930,42 @@ FINISH_OFF:
        EM_PROXY_IF_NULL_RETURN_VALUE(mailbox_stream, hAPI, EMF_ERROR_NULL_VALUE);
 
        /* MailBox Information */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, mailbox_stream, size))
-               EM_DEBUG_EXCEPTION("Add Param mail head Fail  ");
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, mailbox_stream, size)) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed  ");
+               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+       }
 
        /* Mail Id */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&mail_id, size))
-               EM_DEBUG_EXCEPTION("Add Param mail head Fail  ");
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&mail_id, size)) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed  ");
+               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+       }
 
        /* with_attachment */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&with_attachment, size))
-               EM_DEBUG_EXCEPTION("Add Param mail head Fail  ");
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&with_attachment, size)) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed  ");
+               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+       }
        
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPIFail  ");
+       if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed");
                EM_SAFE_FREE(mailbox_stream);
                EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
        }
                
-        err = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);        
+        emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);       
         if (err != EMF_ERROR_NONE)      
                 goto FINISH_OFF;
         
-        /* Download handle - 17-Apr-07 */
+        /* Download handle */
         if(handle) {
-               *handle = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1);
-               EM_DEBUG_LOG(" >>>>>>>>>>>>>>>>>>> RETURN VALUE : %d  handle %d", err, *handle);
+               emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), handle);
+               EM_DEBUG_LOG("RETURN VALUE : %d handle %d", err, *handle);
 
         }
 FINISH_OFF:
                        
-       ipcEmailAPI_Destroy(hAPI);
+       emipc_destroy_email_api(hAPI);
        hAPI = NULL;
        EM_SAFE_FREE(mailbox_stream);
 
@@ -1036,7 +1026,7 @@ EXPORT_API int email_download_attachment(emf_mailbox_t* mailbox,int mail_id, con
                if(handle)
                        *handle = as_handle;
        } else {
-               hAPI = ipcEmailAPI_Create(_EMAIL_API_DOWNLOAD_ATTACHMENT);
+               hAPI = emipc_create_email_api(_EMAIL_API_DOWNLOAD_ATTACHMENT);
 
                EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
 
@@ -1045,40 +1035,46 @@ EXPORT_API int email_download_attachment(emf_mailbox_t* mailbox,int mail_id, con
 
                EM_PROXY_IF_NULL_RETURN_VALUE(mailbox_stream, hAPI, EMF_ERROR_NULL_VALUE);
                
-               if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, mailbox_stream, size))
-                       EM_DEBUG_EXCEPTION("Add Param mailbox Fail  ");
+               if(!emipc_add_parameter(hAPI, ePARAMETER_IN, mailbox_stream, size)) {
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+                       EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+               }
 
                /* Mail ID */
-               if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, &(mail_id), sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter mail_id Fail ");
+               if(!emipc_add_parameter(hAPI, ePARAMETER_IN, &(mail_id), sizeof(int))) {
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter mail_id failed");
+                       EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+               }
 
                /* nth */
-               if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*) nth, sizeof(nth)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter mail_id Fail ");
-               
+               if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*) nth, sizeof(nth))) {
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter mail_id failed");
+                       EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+               }
+
                /* Execute API */
-               if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-                       EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPIFail  ");
+               if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+                       EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed");
                        EM_SAFE_FREE(mailbox_stream);
                        EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
                }
 
-               err = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
+               emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);
                if (err != EMF_ERROR_NONE)              
                        goto FINISH_OFF;
                 
                if(handle)
-                       *handle = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1);
+                       emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), handle);
                
        }
        
 FINISH_OFF:
-       ipcEmailAPI_Destroy(hAPI);
+       emipc_destroy_email_api(hAPI);
        hAPI = NULL;
        EM_SAFE_FREE(mailbox_stream);
        EM_SAFE_FREE(as_noti_data.download_attachment.attachment_order);
 #else  /*  __FEATURE_SUPPORT_ACTIVE_SYNC__              */
-       HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_DOWNLOAD_ATTACHMENT);
+       HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_DOWNLOAD_ATTACHMENT);
 
        EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
 
@@ -1087,25 +1083,31 @@ FINISH_OFF:
 
        EM_PROXY_IF_NULL_RETURN_VALUE(mailbox_stream, hAPI, EMF_ERROR_NULL_VALUE);
        
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, mailbox_stream, size))
-               EM_DEBUG_EXCEPTION("EmfDownloadAttachment--Add Param mailbox Fail  ");
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, mailbox_stream, size)) {
+               EM_DEBUG_EXCEPTION("Add Param mailbox failed");
+               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+       }
 
        /* Mail ID */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, &(mail_id), sizeof(int)))
-                       EM_DEBUG_EXCEPTION(" EmfDownloadAttachment ipcEmailAPI_AddParameter mail_idFail ");
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, &(mail_id), sizeof(int))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter mail_id failed");
+               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+       }
 
        /* nth */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, nth, sizeof(nth)))
-                       EM_DEBUG_EXCEPTION(" EmfDownloadAttachment ipcEmailAPI_AddParameter mail_idFail ");
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, nth, sizeof(nth))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter mail_id failed");
+               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+       }
 
        /* Execute API */
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION("EmfDownloadAttachment--ipcEmailProxy_ExecuteAPIFail  ");
+       if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("EmfDownloadAttachment--emipc_execute_proxy_api failed");
                EM_SAFE_FREE(mailbox_stream);
                EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
        }
 
-       err = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0); 
+       emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);        
 
        EM_DEBUG_LOG(" >>>>> EmfDownloadAttachment RETURN VALUE : %d ", err);
 
@@ -1113,12 +1115,12 @@ FINISH_OFF:
                 goto FINISH_OFF;
         
         if(handle)
-               *handle = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1);
+               emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), handle);
        
        /*  Prevent defect 36700 */
        /* EM_DEBUG_LOG(" >>>>> Handle_proxy : %d ", *handle); */
 FINISH_OFF:
-       ipcEmailAPI_Destroy(hAPI);
+       emipc_destroy_email_api(hAPI);
        hAPI = NULL;
        EM_SAFE_FREE(mailbox_stream);
 #endif /*  __FEATURE_SUPPORT_ACTIVE_SYNC__              */
@@ -1140,15 +1142,14 @@ EXPORT_API int email_cancel_job(int account_id, int handle)
        emf_account_server_t account_server_type;
        HIPC_API hAPI = NULL;
        ASNotiData as_noti_data;
-       emf_mail_account_tbl_t *account_list = NULL;
+       emstorage_account_tbl_t *account_list = NULL;
        int i, account_count = 0;
-       void *return_from_ipc = NULL;
 
        if ( account_id == ALL_ACCOUNT ) {      /*  this means that job is executed with all account */
                /*  Get all accounts for sending notification to active sync engine. */
-               if (!em_storage_get_account_list(&account_count, &account_list , true, false, &err)) {
+               if (!emstorage_get_account_list(&account_count, &account_list , true, false, &err)) {
                        EM_DEBUG_EXCEPTION("email_get_account_list-- Failed [ %d ]  ", err);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+       
                        goto FINISH_OFF;
                }
 
@@ -1172,28 +1173,28 @@ EXPORT_API int email_cancel_job(int account_id, int handle)
                }
 
                /*  request canceling to stub */
-               hAPI = ipcEmailAPI_Create(_EMAIL_API_CANCEL_JOB);
+               hAPI = emipc_create_email_api(_EMAIL_API_CANCEL_JOB);
 
                EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
 
-               if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, &account_id, sizeof(int)))            /*  account_id == 0 */
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter account_id Fail ");
+               if(!emipc_add_parameter(hAPI, ePARAMETER_IN, &account_id, sizeof(int))) {               /*  account_id == 0 */
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+                       EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+               }
 
-               if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, &handle, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter handle Fail ");
+               if(!emipc_add_parameter(hAPI, ePARAMETER_IN, &handle, sizeof(int))) {
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+                       EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+               }
 
                /* Execute API */
-               if(ipcEmailProxy_ExecuteAPI(hAPI) < 0) {
-                       EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPIFail  ");
+               if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+                       EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed");
                        EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
                }
 
-               return_from_ipc = ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
-               if (return_from_ipc) {
-                       err = *(int *)return_from_ipc;
-               }
-               
-               ipcEmailAPI_Destroy(hAPI);
+               emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);
+               emipc_destroy_email_api(hAPI);
                hAPI = NULL;
        }
        else {
@@ -1213,61 +1214,63 @@ EXPORT_API int email_cancel_job(int account_id, int handle)
                                goto FINISH_OFF;
                        }
                } else {
-                       hAPI = ipcEmailAPI_Create(_EMAIL_API_CANCEL_JOB);
+                       hAPI = emipc_create_email_api(_EMAIL_API_CANCEL_JOB);
 
                        EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
 
-                       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, &account_id, sizeof(int)))
-                               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter account_id Fail ");
+                       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, &account_id, sizeof(int))) {
+                               EM_DEBUG_EXCEPTION("emipc_add_parameter failed ");
+                               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+                       }
 
-                       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, &handle, sizeof(int)))
-                               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter handle Fail ");
+                       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, &handle, sizeof(int))) {
+                               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+                               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+                       }
 
                        /* Execute API */
-                       if(ipcEmailProxy_ExecuteAPI(hAPI) < 0) {
-                               EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPIFail  ");
+                       if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+                               EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed");
                                EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
                        }
-
-                       return_from_ipc = ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
-                       if (return_from_ipc) {
-                               err = *(int *)return_from_ipc;
-                       }       
-                       
-                       ipcEmailAPI_Destroy(hAPI);
+                       emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);
+                       emipc_destroy_email_api(hAPI);
                        hAPI = NULL;
-
                }
        }
 
 FINISH_OFF:
-       ipcEmailAPI_Destroy(hAPI);
+       emipc_destroy_email_api(hAPI);
        hAPI = NULL;
        if ( account_list )
-               em_storage_free_account(&account_list, account_count, NULL);
+               emstorage_free_account(&account_list, account_count, NULL);
                
 #else  /*  __FEATURE_SUPPORT_ACTIVE_SYNC__              */
-       HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_CANCEL_JOB);
+       HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_CANCEL_JOB);
 
        EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
 
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, &account_id, sizeof(int)))
-               EM_DEBUG_EXCEPTION(" EmfCancelJob ipcEmailAPI_AddParameter account_id Fail ");
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, &account_id, sizeof(int))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed ");
+               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+       }
 
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, &handle, sizeof(int)))
-               EM_DEBUG_EXCEPTION(" EmfCancelJob ipcEmailAPI_AddParameter handle Fail ");
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, &handle, sizeof(int))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+       }
 
        /* Execute API */
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPI Fail");
+       if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed");
                EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
        }
 
-       err = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0); 
+       emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);        
 
        EM_DEBUG_LOG(" >>>>> EmfCancelJob RETURN VALUE : %d ", err);
 
-       ipcEmailAPI_Destroy(hAPI);
+       emipc_destroy_email_api(hAPI);
        hAPI = NULL;
 #endif /*  __FEATURE_SUPPORT_ACTIVE_SYNC__              */
 
@@ -1285,33 +1288,39 @@ EXPORT_API int email_get_pending_job(emf_action_t action, int account_id, int ma
 
        EM_IF_ACCOUNT_ID_NULL(account_id, EMF_ERROR_NULL_VALUE);
        
-       HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_GET_PENDING_JOB);
+       HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_GET_PENDING_JOB);
 
        EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
 
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, &action, sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter action Fail ");
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, &action, sizeof(int))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter action failed ");
+               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+       }
 
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, &account_id, sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter account_id Fail ");
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, &account_id, sizeof(int))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter account_id failed ");
+               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+       }
 
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, &mail_id, sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter account_id Fail ");
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, &mail_id, sizeof(int))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter account_id failed ");
+               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+       }
 
        /* Execute API */
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPI Fail  ");
+       if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed  ");
                EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
        }
 
-       err = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
+       emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);
 
        if(status) {
-               *status = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1);
+               emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), status);
                EM_DEBUG_LOG("status : %d ", *status);
        }
        
-       ipcEmailAPI_Destroy(hAPI);
+       emipc_destroy_email_api(hAPI);
        hAPI = NULL;
 
        EM_DEBUG_FUNC_END("err [%d]", err);  
@@ -1326,25 +1335,25 @@ EXPORT_API int email_get_network_status(int* on_sending, int* on_receiving)
        EM_DEBUG_FUNC_BEGIN("on_sending[%p], on_receiving[%p]", on_sending, on_receiving);
        int err = EMF_ERROR_NONE;
        
-       HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_NETWORK_GET_STATUS);
+       HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_NETWORK_GET_STATUS);
 
        EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
 
        /* Execute API */
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPI Fail");
-               ipcEmailAPI_Destroy(hAPI);
+       if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed");
+               emipc_destroy_email_api(hAPI);
                hAPI = NULL;
                err = EMF_ERROR_IPC_SOCKET_FAILURE ;
                EM_DEBUG_FUNC_END("err [%d]", err); return err;
        }
 
        if(on_sending)
-               *on_sending = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
+               emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), on_sending );
        if(on_receiving)        
-               *on_receiving = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1);
+               emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), on_receiving);
 
-       ipcEmailAPI_Destroy(hAPI);
+       emipc_destroy_email_api(hAPI);
        hAPI = NULL;
        EM_DEBUG_FUNC_END("err [%d]", err);  
        return err;
@@ -1361,52 +1370,43 @@ EXPORT_API int email_get_imap_mailbox_list(int account_id, const char* mailbox,
                return EMF_ERROR_INVALID_PARAM;
        }
 
-       HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_GET_IMAP_MAILBOX_LIST);   
+       HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_GET_IMAP_MAILBOX_LIST);       
 
        /* account_id */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&account_id, sizeof(int))) {
-               EM_DEBUG_LOG("Add Param account_id Fail  ");
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&account_id, sizeof(int))) {
+               EM_DEBUG_LOG("emipc_add_parameter failed  ");
                EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
        }
 
-       if(!ipcEmailProxy_ExecuteAPI(hAPI))  {
-               EM_DEBUG_LOG("ipcProxy_ExecuteAsyncAPI Fail");
+       if(!emipc_execute_proxy_api(hAPI))  {
+               EM_DEBUG_LOG("ipcProxy_ExecuteAsyncAPI failed");
                EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
        }
 
-       err = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
+       emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);
        if(handle)
-       *handle = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1);
+       emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), handle);
 
-       ipcEmailAPI_Destroy(hAPI);
+       emipc_destroy_email_api(hAPI);
        hAPI = NULL;
 
        EM_DEBUG_FUNC_END("err [%d]", err);  
        return err;
 }
 
-EXPORT_API int email_find_mail_on_server(int input_account_id, const char *input_mailbox_name, int input_search_type, char *input_search_value, unsigned *output_handle)
+EXPORT_API int email_search_mail_on_server(int input_account_id, const char *input_mailbox_name, email_search_filter_t *input_search_filter_list, int input_search_filter_count, unsigned *output_handle)
 {
-       EM_DEBUG_FUNC_BEGIN("input_account_id [%d], input_mailbox_name [%p], input_search_type [%d], input_search_value [%p], output_handle [%p]", input_account_id, input_mailbox_name, input_search_type, input_search_value, output_handle);
+       EM_DEBUG_FUNC_BEGIN("input_account_id [%d], input_mailbox_name [%p], input_search_filter_list [%p], input_search_filter_count [%d], output_handle [%p]", input_account_id, input_mailbox_name, input_search_filter_list, input_search_filter_count, output_handle);
 
        int       err = EMF_ERROR_NONE;
+       int       return_value = 0;
+       int       stream_size_for_search_filter_list = 0;
+       char     *stream_for_search_filter_list = NULL;
        HIPC_API  hAPI = NULL;
 
-       EM_IF_NULL_RETURN_VALUE(input_account_id,   EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(input_mailbox_name, EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(input_search_value, EMF_ERROR_INVALID_PARAM);
-
-       switch ( input_search_type ) {
-               case EMF_SEARCH_FILTER_SUBJECT:
-               case EMF_SEARCH_FILTER_SENDER:
-               case EMF_SEARCH_FILTER_RECIPIENT:
-               case EMF_SEARCH_FILTER_ALL:
-                       break;
-               default:
-                       EM_DEBUG_EXCEPTION("Invalid search filter type[%d]", input_search_type);
-                       err = EMF_ERROR_INVALID_PARAM;
-                       return err;
-       }
+       EM_IF_NULL_RETURN_VALUE(input_account_id,         EMF_ERROR_INVALID_PARAM);
+       EM_IF_NULL_RETURN_VALUE(input_mailbox_name,       EMF_ERROR_INVALID_PARAM);
+       EM_IF_NULL_RETURN_VALUE(input_search_filter_list, EMF_ERROR_INVALID_PARAM);
 
 #ifdef __FEATURE_SUPPORT_ACTIVE_SYNC__
        emf_account_server_t account_server_type = EMF_SERVER_TYPE_NONE;
@@ -1420,20 +1420,25 @@ EXPORT_API int email_find_mail_on_server(int input_account_id, const char *input
        }
 
        if ( account_server_type == EMF_SERVER_TYPE_ACTIVE_SYNC ) {
-               int as_handle;
+               int as_handle = 0;
+
                if ( email_get_handle_for_activesync(&as_handle, &err) == false ) {
                        EM_DEBUG_EXCEPTION("email_get_handle_for_activesync failed[%d].", err);
                        goto FINISH_OFF;
                }
 
                /*  noti to active sync */
-               as_noti_data.find_mail_on_server.handle       = as_handle;
-               as_noti_data.find_mail_on_server.account_id   = input_account_id;
-               as_noti_data.find_mail_on_server.mailbox_name = EM_SAFE_STRDUP(input_mailbox_name);
-               as_noti_data.find_mail_on_server.search_type  = input_search_type;
-               as_noti_data.find_mail_on_server.search_value = EM_SAFE_STRDUP(input_search_value);
+               as_noti_data.search_mail_on_server.handle              = as_handle;
+               as_noti_data.search_mail_on_server.account_id          = input_account_id;
+               as_noti_data.search_mail_on_server.mailbox_name        = EM_SAFE_STRDUP(input_mailbox_name);
+               as_noti_data.search_mail_on_server.search_filter_list  = input_search_filter_list;
+               as_noti_data.search_mail_on_server.search_filter_count = input_search_filter_count;
+
+               return_value = email_send_notification_to_active_sync_engine(ACTIVE_SYNC_NOTI_SEARCH_ON_SERVER, &as_noti_data);
 
-               if ( email_send_notification_to_active_sync_engine(ACTIVE_SYNC_NOTI_SEARCH_ON_SERVER, &as_noti_data) == false) {
+               EM_SAFE_FREE(as_noti_data.search_mail_on_server.mailbox_name);
+
+               if ( return_value == false ) {
                        EM_DEBUG_EXCEPTION("email_send_notification_to_active_sync_engine failed.");
                        err = EMF_ERROR_ACTIVE_SYNC_NOTI_FAILURE;
                        goto FINISH_OFF;
@@ -1445,39 +1450,51 @@ EXPORT_API int email_find_mail_on_server(int input_account_id, const char *input
        else
 #endif  /*  __FEATURE_SUPPORT_ACTIVE_SYNC__    */
        {
-               hAPI = ipcEmailAPI_Create(_EMAIL_API_FIND_MAIL_ON_SERVER);
+               hAPI = emipc_create_email_api(_EMAIL_API_SEARCH_MAIL_ON_SERVER);
 
                EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
 
-               if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (void*)&input_account_id, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("Add Param mail head Fail  ");
+               if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (void*)&input_account_id, sizeof(int))) {
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed  ");
+                       err = EMF_ERROR_IPC_PROTOCOL_FAILURE;
+                       goto FINISH_OFF;
+               }
+
+               if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (void*)input_mailbox_name, strlen(input_mailbox_name))){
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed  ");
+                       err = EMF_ERROR_IPC_PROTOCOL_FAILURE;
+                       goto FINISH_OFF;
+               }
 
-               if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (void*)input_mailbox_name, strlen(input_mailbox_name)))
-                       EM_DEBUG_EXCEPTION("Add Param mail head Fail  ");
+               stream_for_search_filter_list = em_convert_search_filter_to_byte_stream(input_search_filter_list, input_search_filter_count, &stream_size_for_search_filter_list);
 
-               if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (void*)&input_search_type, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("Add Param mail head Fail  ");
+               EM_PROXY_IF_NULL_RETURN_VALUE(stream_for_search_filter_list, hAPI, EMF_ERROR_NULL_VALUE);
 
-               if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (void*)input_search_value, strlen(input_search_value)))
-                       EM_DEBUG_EXCEPTION("Add Param mail head Fail  ");
+               if(!emipc_add_parameter(hAPI, ePARAMETER_IN, stream_for_search_filter_list, stream_size_for_search_filter_list)) {
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed  ");
+                       err = EMF_ERROR_IPC_PROTOCOL_FAILURE;
+                       goto FINISH_OFF;
+               }
 
-               if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-                       EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPI failed");
+               if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+                       EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed");
                        EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
                }
 
-               err = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
+               emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);
 
-               if (err != EMF_ERROR_NONE)
+               if (err != EMF_ERROR_NONE) {
+                       EM_DEBUG_EXCEPTION("_EMAIL_API_SEARCH_MAIL_ON_SERVER failed [%d]", err);
                        goto FINISH_OFF;
+               }
 
                if(output_handle)
-                       *output_handle = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1);
+                       emipc_get_parameter(hAPI, ePARAMETER_OUT, 1, sizeof(int), output_handle);
        }
 
 FINISH_OFF:
        if(hAPI) {
-               ipcEmailAPI_Destroy(hAPI);
+               emipc_destroy_email_api(hAPI);
                hAPI = NULL;
        }
 
similarity index 72%
rename from MAPI/Emf_Mapi_Rule.c
rename to email-api/email-api-rule.c
index 9299b6d..73c6389 100755 (executable)
 /**
  *
  * This file contains the data structures and interfaces needed for application,
- * to interact with Email Engine.
- * @file               Emf_Mapi_Rule.c
+ * to interact with email-service.
+ * @file               email-api-rule.c
  * @brief              This file contains the data structures and interfaces of Rule related Functionality provided by 
- *                     Email Engine . 
+ *                     email-service . 
  */
 
-#include <Emf_Mapi.h>
+#include "email-api.h"
 #include "string.h"
-#include "Msg_Convert.h"
-#include "em-storage.h"
-#include "ipc-library.h"
+#include "email-convert.h"
+#include "email-storage.h"
+#include "email-utilities.h"
+#include "email-ipc.h"
 
 EXPORT_API int email_get_rule(int filter_id, emf_rule_t** filtering_set)
 {
@@ -45,9 +46,9 @@ EXPORT_API int email_get_rule(int filter_id, emf_rule_t** filtering_set)
        EM_IF_NULL_RETURN_VALUE(filtering_set, EMF_ERROR_INVALID_PARAM);
        EM_IF_NULL_RETURN_VALUE(filter_id, EMF_ERROR_INVALID_PARAM);
 
-       if (!em_storage_get_rule_by_id(0, filter_id, (emf_mail_rule_tbl_t**)filtering_set, true, &err))  {
-               EM_DEBUG_EXCEPTION("em_storage_get_rule_by_id failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+       if (!emstorage_get_rule_by_id(0, filter_id, (emstorage_rule_tbl_t**)filtering_set, true, &err))  {
+               EM_DEBUG_EXCEPTION("emstorage_get_rule_by_id failed [%d]", err);
+
                goto FINISH_OFF;
        } else
                err = EMF_ERROR_NONE;
@@ -70,10 +71,10 @@ EXPORT_API int email_get_rule_list(emf_rule_t** filtering_set, int* count)
 
        *count = 1000;
        
-       if (!em_storage_get_rule(0, 0, 0, count, &is_completed, (emf_mail_rule_tbl_t**)filtering_set, true, &err))  {
-               EM_DEBUG_EXCEPTION("em_storage_get_rule failed [%d]", err);
+       if (!emstorage_get_rule(0, 0, 0, count, &is_completed, (emstorage_rule_tbl_t**)filtering_set, true, &err))  {
+               EM_DEBUG_EXCEPTION("emstorage_get_rule failed [%d]", err);
+
 
-               err = em_storage_get_emf_error_from_em_storage_error(err);
                goto FINISH_OFF;
        } else
                err = EMF_ERROR_NONE;
@@ -95,7 +96,7 @@ EXPORT_API int email_add_rule(emf_rule_t* filtering_set)
        
        EM_IF_NULL_RETURN_VALUE(filtering_set, EMF_ERROR_INVALID_PARAM);
 
-       HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_ADD_RULE);        
+       HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_ADD_RULE);    
 
        EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
 
@@ -103,21 +104,21 @@ EXPORT_API int email_add_rule(emf_rule_t* filtering_set)
 
        EM_PROXY_IF_NULL_RETURN_VALUE(pRuleStream, hAPI, EMF_ERROR_NULL_VALUE);
        
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, pRuleStream, size)) {
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, pRuleStream, size)) {
                EM_DEBUG_EXCEPTION("Add Param Failed");
                EM_SAFE_FREE(pRuleStream);
                EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
        }
 
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPI Failed");
+       if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("emipc_execute_proxy_api Failed");
                EM_SAFE_FREE(pRuleStream);
                EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
        }
                
-       err = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0); 
+       emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);        
        EM_SAFE_FREE(pRuleStream);
-       ipcEmailAPI_Destroy(hAPI);
+       emipc_destroy_email_api(hAPI);
        hAPI = NULL;
        EM_DEBUG_FUNC_END("error value [%d]", err);
        return err;
@@ -136,12 +137,12 @@ EXPORT_API int email_update_rule(int filter_id, emf_rule_t* new_set)
        EM_IF_NULL_RETURN_VALUE(filter_id, EMF_ERROR_INVALID_PARAM);
        EM_IF_NULL_RETURN_VALUE(new_set, EMF_ERROR_INVALID_PARAM);
        
-       HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_UPDATE_RULE);
+       HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_UPDATE_RULE);
 
        EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
 
        /* filter_id */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&filter_id, sizeof(int))) {
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&filter_id, sizeof(int))) {
                EM_DEBUG_EXCEPTION("Add Param filter_id Failed");
                EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
        }
@@ -153,22 +154,22 @@ EXPORT_API int email_update_rule(int filter_id, emf_rule_t* new_set)
                EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
        }
 
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, pFilterStream, size)){
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, pFilterStream, size)){
                EM_DEBUG_EXCEPTION("Add Param new_set Failed");
                EM_SAFE_FREE(pFilterStream);
                EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
        }
        
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPI Failed");
+       if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("emipc_execute_proxy_api Failed");
                EM_SAFE_FREE(pFilterStream);
                EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
        }
 
-       err = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
+       emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);
                
        EM_SAFE_FREE(pFilterStream);
-       ipcEmailAPI_Destroy(hAPI);
+       emipc_destroy_email_api(hAPI);
 
        hAPI = NULL;
        EM_DEBUG_FUNC_END("error value [%d]", err);
@@ -186,22 +187,23 @@ EXPORT_API int email_delete_rule(int filter_id)
                
        EM_IF_NULL_RETURN_VALUE(filter_id, EMF_ERROR_INVALID_PARAM);
                        
-       HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_DELETE_RULE);
+       HIPC_API hAPI = emipc_create_email_api(_EMAIL_API_DELETE_RULE);
        
        EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
        
        /* filter_id */
-       if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&filter_id, sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-       
+       if(!emipc_add_parameter(hAPI, ePARAMETER_IN, (char*)&filter_id, sizeof(int))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_NULL_VALUE);
+       }
                
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPI failed");
+       if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("emipc_execute_proxy_api failed");
                EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
        }
        
-       err = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
-       ipcEmailAPI_Destroy(hAPI);
+       emipc_get_parameter(hAPI, ePARAMETER_OUT, 0, sizeof(int), &err);
+       emipc_destroy_email_api(hAPI);
 
        hAPI = NULL;
        EM_DEBUG_FUNC_END("error value [%d]", err);
similarity index 71%
rename from MAPI/include/Emf_Mapi_Account.h
rename to email-api/include/email-api-account.h
index f9d64b3..49c68e6 100755 (executable)
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-#ifndef __EMF_MAPI_ACCOUNT_H__
-#define __EMF_MAPI_ACCOUNT_H__
-
-#include "emf-types.h"
-
-/**
-* @defgroup EMAIL_FRAMEWORK Email Service
-* @{
-*/
-
-
-/**
-* @ingroup EMAIL_FRAMEWORK
-* @defgroup EMAIL_MAPI_ACCOUNT Email Account API
-* @{
-*/
-
-/**
- *
- * This file contains the data structures and interfaces needed for application,
- * to interact with Email Engine.
- * @file               Emf_Mapi_Account.h
- * @author     Kyuho Jo <kyuho.jo@samsung.com>
- * @author     Sunghyun Kwon <sh0701.kwon@samsung.com>
- * @version    0.1
- * @brief              This file contains the data structures and interfaces of Accounts provided by 
- *                     Email Engine . 
- *
-* @{
-       
-* @code
-*      #include "emf_mapi_account.h"
-*       bool
-*              other_app_invoke_uniform_api_sample(int* error_code)
-*      {
-*      emf_account_t *account = NULL;
-*      emf_account_t *new_account = NULL;
-*
-*      account = malloc(sizeof(emf_account_t));
-*      memset(account, 0x00, sizeof(emf_account_t));
-*
-*      account->account_bind_type      = 1;                           
-*      account->retrieval_mode         = 1;                                                   
-*      account->use_security           = 1;                                                   
-*      account->sending_server_type    = EMF_SERVER_TYPE_SMTP;                                                   
-*      account->sending_port_num       = EMF_SMTP_PORT;                                                        
-*      account->sending_auth           = 1;   
-*      account->flag1 = 2;
-*      account->account_bind_type      = 1;                           
-*      account->account_name           = strdup("gmail"); 
-*      account->display_name           = strdup("Tom"); 
-*      account->email_addr             = strdup("tom@gmail.com"); 
-*      account->reply_to_addr          = strdup("tom@gmail.com"); 
-*      account->return_addr            = strdup("tom@gmail.com"); 
-*      account->receiving_server_type  = EMF_SERVER_TYPE_POP3; 
-*      account->receiving_server_addr  = strdup("pop3.gmail.com"); 
-*      account->port_num               = 995;        
-*      account->use_security           = 1;                                                   
-*      account->retrieval_mode         = EMF_IMAP4_RETRIEVAL_MODE_ALL;
-*      account->user_name              = strdup("tom"); 
-*      account->password               = strdup("password"); 
-*      account->sending_server_type    = EMF_SERVER_TYPE_SMTP;                                                   
-*      account->sending_server_addr    = strdup("smtp.gmail.com"); 
-*      account->sending_port_num       = 587;                                                        
-*      account->sending_security       = 0x02;  
-*      account->sending_auth           = 1;   
-*      account->sending_user           = strdup("tom@gmail.com"); 
-*      account->sending_password       = strdup("password");
-*      account->pop_before_smtp        = 0;
-*      account->apop                   = 0;
-*      account->flag1                  = 2;                    
-*      account->flag2                  = 1; 
-*      account->preset_account         = 1;       
-*      account->logo_icon_path         = strdup("Logo Icon Path"); 
-*      account->target_storage         = 0;                            
-*      account->options.priority = 3;   
-*      account->options.keep_local_copy = 0;   
-*      account->options.req_delivery_receipt = 0;   
-*      account->options.req_read_receipt = 0;   
-*      account->options.download_limit = 0;   
-*      account->options.block_address = 0;   
-*      account->options.block_subject = 0;   
-*      account->options.display_name_from = strdup("Display name from"); 
-*      account->options.reply_with_body = 0;   
-*      account->options.forward_with_files = 0;   
-*      account->options.add_myname_card = 0;
-*      account->options.add_signature = 0;   
-*      account->options.signature= strdup("Signature");    
-*      account->check_interval = 0;  
-*      // Add account          
-*      if(EMF_ERROR_NONE != email_add_account(account))
-*              //failure
-*      //else
-*      {
-*              //success    
-*              if(account_id)
-*                      *account_id = account->account_id;
-*      }
-*      if(EMF_ERROR_NONE != email_validate_account(account_id,&account_handle))
-*              //failure
-*      else
-*            //success
-*      if(EMF_ERROR_NONE != email_delete_account(account_id))
-*              //failure
-*      else
-*              //success
-*      new_account = malloc(sizeof(emf_account_t));
-*      memset(new_account, 0x00, sizeof(emf_account_t));
-*      new_account->flag1 = 1;
-*      new_account->account_name           = strdup("samsung001"); 
-*      new_account->display_name           = strdup("Tom001");                 
-*      new_account->options.keep_local_copy = 1;   
-*      new_account->check_interval = 55;  
-*      // Update account                       
-*      if(EMF_ERROR_NONE != email_update_account(acount_id,new_account))
-*              //failure
-*      else
-*              //success
-*      // Get account 
-*      if(EMF_ERROR_NONE != email_get_account(account_id,GET_FULL_DATA,&account))
-*              //failure
-*      else
-*              //success
-*      // Get list of accounts 
-*      if(EMF_ERROR_NONE != email_get_account_list(&account_list,&count))
-*              //failure
-*      else
-*              //success
-*      // free account 
-*      email_free_account(&account, 1);
-*      }
- *
- * @endcode
- * @}
- */
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/**
- * @open
- * @fn email_add_account(emf_account_t* account)
- * @brief      Create a new email account.This function is invoked when user wants to add new email account
- *
- * @param[in] account  Specifies the structure pointer of account. 
- * @exception  none       
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @see         emf_account_t
- * @remarks N/A
- */
-EXPORT_API int email_add_account(emf_account_t* account);
-
-/**
- * @open
- * @fn email_delete_account(int account_id)
- * @brief       Delete a email account.This function is invoked when user wants to delete an existing email account
- *
- * @param[in] account_id       Specifies the account ID.
- * @exception  #EMF_ERROR_INVALID_PARAM                -Invalid argument
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @see
- * @remarks N/A
- */
-EXPORT_API int email_delete_account(int account_id);
-
-/**
- * @open
- * @fn email_update_account(int account_id, emf_account_t* new_account)
- * @brief      Change the information of a email account.This function is getting invoked when user wants to change some information of existing email account.
- *
- * @param[in] account_id       Specifies the orignal account ID.
- * @param[in] new_account      Specifies the information of new account.
- * @param[in] with_validation  If this is 1, email-service will validate the account before updating. If this is 0, email-service will update the account without validation.
- * @exception #EMF_ERROR_INVALID_PARAM         -Invalid argument
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @see emf_account_t
- * @remarks N/A
- */
-EXPORT_API int email_update_account(int account_id, emf_account_t* new_account);
-
-/**
- * @open
- * @fn email_update_account_with_validation(int account_id, emf_account_t* new_account)
- * @brief      Change the information of a email account.This function is getting invoked when user wants to change some information of existing email account.
- *
- * @param[in] account_id       Specifies the orignal account ID.
- * @param[in] new_account      Specifies the information of new account.
- * @param[in] with_validation  If this is 1, email-service will validate the account before updating. If this is 0, email-service will update the account without validation.
- * @exception #EMF_ERROR_INVALID_PARAM         -Invalid argument
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @see emf_account_t
- * @remarks N/A
- */
-EXPORT_API int email_update_account_with_validation(int account_id, emf_account_t* new_account);
-
-/**
- * @open
- * @fn  email_get_account(int account_id, int pulloption, emf_account_t** account)
- * @brief      Get an email account by ID. This function is getting invoked when user wants to get the account informantion based on account id and option (GET_FULL_DATA/WITHOUT_OPTION/ONLY_OPTION).<br>
- *                     Memory for account information will be allocated to 3rd param(account). The allocated memory should be freed by email_free_account(). 
- *
- * @param[in] account_id       Specifies the account ID.This function is invoked when user
- * @param[in] pulloption       Option to specify to get full details or partial, see definition of EMF_ACC_GET_OPT_XXX 
- * @param[out] account         The returned account is saved here.
- * @exception #EMF_ERR_INVALID_PARAM           -Invalid argument
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @see emf_account_t
- * @remarks N/A
- */
-
-EXPORT_API int email_get_account(int account_id, int pulloption, emf_account_t** account);
-
-/**
- * @open
- * @fn email_get_account_list(emf_account_t** account_list, int* count);
- * @brief      Get Account List.This function is getting invoked when user wants to get all account information based on the count of accounts provided by user.<br>
- *                     Memory for account information will be allocated to 3rd param(account). The allocated memory should be freed by email_free_account(). 
- *
- * @param[in] account_list     Specifies the structure pointer of account.
- * @param[out] count                   Specifies the count of accounts.
- * @exception #EMF_ERR_INVALID_PARAM           -Invalid argument
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @see emf_account_t
- * @remarks N/A
- */
-EXPORT_API int email_get_account_list(emf_account_t** account_list, int* count);
-
- /**
- * @open
- * @fn   email_free_account(emf_account_t** account_list, int count);
- * @brief      Free allocated memory.This function is getting invoked when user wants to delete all account information.
- *
- * @param[in] account_list     Specifies the structure pointer of account.
- * @param[out] count                   Specifies the count of accounts.
- * @exception #EMF_ERR_INVALID_PARAM           -Invalid argument
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @see emf_account_t
- * @remarks N/A
- */
-EXPORT_API int email_free_account(emf_account_t** account_list, int count);
-
-
-/**
- * @open
- * @fn email_validate_account(int account_id, unsigned* handle)
- * @brief      Validate account.This function is getting invoked  after adding one account to validate it.If account is not validated then user should retry once again to add the account .
- *
- * @param[in] account_id              Specifies the account Id to validate.
- * @param[out] handle          Specifies the sending handle.
- * @remarks N/A
- * @exception #EMF_ERR_INVALID_PARAM           -Invalid argument
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @see                none 
- * @remarks N/A
- */
-EXPORT_API int email_validate_account(int account_id, unsigned* handle);
-
-/**
- * @open
- * @fn email_add_account_with_validation(emf_account_t* account, unsigned* handle)
- * @brief      Add an account when the account is validated. This function is getting invoked when user want to validate an account. If account is not validated then user should retry once again to add the account.<br>
- *              Validation is executed without saving an account to DB
- *
- * @param[in] account      Specifies the structure pointer of account. 
- * @param[out] handle          Specifies the sending handle.
- * @remarks N/A
- * @return This function returns true on success or false on failure.
- */
-EXPORT_API int email_add_account_with_validation(emf_account_t* account, unsigned* handle);
-
-
-/**
- * @open
- * @fn email_backup_accounts_into_secure_storage(const char *file_name)
- * @brief      Back up information of all accounts into secure storage. 
- *          This function is getting invoked when user want to backup account information safely. 
- *
- * @param[in] file_name            Specifies the file name in secure storage
- * @remarks N/A
- * @return This function returns true on success or false on failure.
- */
-EXPORT_API int email_backup_accounts_into_secure_storage(const char *file_name);
-
-/**
- * @open
- * @fn email_restore_accounts_from_secure_storage(const char *file_name)
- * @brief      Restore accounts from stored file in secure storage. 
- *          This function is getting invoked when user want to restore accounts. 
- *
- * @param[in] file_name            Specifies the file name in secure storage
- * @remarks N/A
- * @return This function returns true on success or false on failure.
- */
-EXPORT_API int email_restore_accounts_from_secure_storage(const char * file_name);
-
-/**
- * @open
- * @fn email_get_password_length_of_account(const int account_id, int *password_length)
- * @brief      Get password length of an account. 
- *          This function is getting invoked when user want to know the length of an account. 
- *
- * @param[in] account_id    Specifies the account id
- * @param[out] handle          Specifies the password length.
- * @remarks N/A
- * @return This function returns true on success or false on failure.
- */
-EXPORT_API int email_get_password_length_of_account(const int account_id, int *password_length);
-
-/**
- * @open
- * @fn email_update_notification_bar(int account_id)
- * @brief      Update notifications on notification bar. 
- *          This function is getting invoked when user want to update notification bar. 
- *
- * @param[in] account_id               Specifies the id of account.
- * @remarks N/A
- * @return This function returns true on success or false on failure.
- */
-EXPORT_API int email_update_notification_bar(int account_id);
-
-/**
- * @open
- * @fn email_clear_all_notification_bar()
- * @brief      Clear all notification on notification bar. 
- *          This function is getting invoked when user want to clear notification bar. 
- *
- * @remarks N/A
- * @return This function returns true on success or false on failure.
- */
-EXPORT_API int email_clear_all_notification_bar();
-
-
-/**
- * @open
- * @fn email_save_default_account_id()
- * @brief      Save default account id to vconf storage. 
- *          This function is getting invoked when user want to save default account id. 
- *
- * @remarks N/A
- * @return This function returns true on success or false on failure.
- */
-EXPORT_API int email_save_default_account_id(int input_account_id);
-
-/**
- * @open
- * @fn email_load_default_account_id()
- * @brief      Load default account id to vconf storage. 
- *          This function is getting invoked when user want to load default account id. 
- *
- * @remarks N/A
- * @return This function returns true on success or false on failure.
- */
-EXPORT_API int email_load_default_account_id(int *output_account_id);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-/**
-* @} @}
-*/
-
-#endif /* __EMF_MAPI_ACCOUNT_H__ */
-
-
+/*\r
+*  email-service\r
+*\r
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+*\r
+* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com>\r
+*\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+* http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License.\r
+*\r
+*/\r
+\r
+\r
+#ifndef __EMAIL_API_ACCOUNT_H__\r
+#define __EMAIL_API_ACCOUNT_H__\r
+\r
+#include "email-types.h"\r
+\r
+/**\r
+* @defgroup EMAIL_SERVICE Email Service\r
+* @{\r
+*/\r
+\r
+\r
+/**\r
+* @ingroup EMAIL_SERVICE\r
+* @defgroup EMAIL_API_ACCOUNT Email Account API\r
+* @{\r
+*/\r
+\r
+/**\r
+ *\r
+ * This file contains the data structures and interfaces needed for application,\r
+ * to interact with email-service.\r
+ * @file               email-api-account.h\r
+ * @author     Kyuho Jo <kyuho.jo@samsung.com>\r
+ * @author     Sunghyun Kwon <sh0701.kwon@samsung.com>\r
+ * @version    0.1\r
+ * @brief              This file contains the data structures and interfaces of Accounts provided by\r
+ *                     email-service .\r
+ *\r
+* @{\r
+\r
+* @code\r
+*      #include "emf_mapi_account.h"\r
+*       bool\r
+*              other_app_invoke_uniform_api_sample(int* error_code)\r
+*      {\r
+*      emf_account_t *account = NULL;\r
+*      emf_account_t *new_account = NULL;\r
+*\r
+*      account = malloc(sizeof(emf_account_t));\r
+*      memset(account, 0x00, sizeof(emf_account_t));\r
+*\r
+*      account->account_bind_type      = 1;\r
+*      account->retrieval_mode         = 1;\r
+*      account->use_security           = 1;\r
+*      account->sending_server_type    = EMF_SERVER_TYPE_SMTP;\r
+*      account->sending_port_num       = EMF_SMTP_PORT;\r
+*      account->sending_auth           = 1;\r
+*      account->flag1 = 2;\r
+*      account->account_bind_type      = 1;\r
+*      account->account_name           = strdup("gmail");\r
+*      account->display_name           = strdup("Tom");\r
+*      account->email_addr             = strdup("tom@gmail.com");\r
+*      account->reply_to_addr          = strdup("tom@gmail.com");\r
+*      account->return_addr            = strdup("tom@gmail.com");\r
+*      account->receiving_server_type  = EMF_SERVER_TYPE_POP3;\r
+*      account->receiving_server_addr  = strdup("pop3.gmail.com");\r
+*      account->port_num               = 995;\r
+*      account->use_security           = 1;\r
+*      account->retrieval_mode         = EMF_IMAP4_RETRIEVAL_MODE_ALL;\r
+*      account->user_name              = strdup("tom");\r
+*      account->password               = strdup("password");\r
+*      account->sending_server_type    = EMF_SERVER_TYPE_SMTP;\r
+*      account->sending_server_addr    = strdup("smtp.gmail.com");\r
+*      account->sending_port_num       = 587;\r
+*      account->sending_security       = 0x02;\r
+*      account->sending_auth           = 1;\r
+*      account->sending_user           = strdup("tom@gmail.com");\r
+*      account->sending_password       = strdup("password");\r
+*      account->pop_before_smtp        = 0;\r
+*      account->apop                   = 0;\r
+*      account->flag1                  = 2;\r
+*      account->flag2                  = 1;\r
+*      account->preset_account         = 1;\r
+*      account->logo_icon_path         = strdup("Logo Icon Path");\r
+*      account->target_storage         = 0;\r
+*      account->options.priority = 3;\r
+*      account->options.keep_local_copy = 0;\r
+*      account->options.req_delivery_receipt = 0;\r
+*      account->options.req_read_receipt = 0;\r
+*      account->options.download_limit = 0;\r
+*      account->options.block_address = 0;\r
+*      account->options.block_subject = 0;\r
+*      account->options.display_name_from = strdup("Display name from");\r
+*      account->options.reply_with_body = 0;\r
+*      account->options.forward_with_files = 0;\r
+*      account->options.add_myname_card = 0;\r
+*      account->options.add_signature = 0;\r
+*      account->options.signature= strdup("Signature");\r
+*      account->check_interval = 0;\r
+*      // Add account\r
+*      if(EMF_ERROR_NONE != email_add_account(account))\r
+*              //failure\r
+*      //else\r
+*      {\r
+*              //success\r
+*              if(account_id)\r
+*                      *account_id = account->account_id;\r
+*      }\r
+*      if(EMF_ERROR_NONE != email_validate_account(account_id,&account_handle))\r
+*              //failure\r
+*      else\r
+*            //success\r
+*      if(EMF_ERROR_NONE != email_delete_account(account_id))\r
+*              //failure\r
+*      else\r
+*              //success\r
+*      new_account = malloc(sizeof(emf_account_t));\r
+*      memset(new_account, 0x00, sizeof(emf_account_t));\r
+*      new_account->flag1 = 1;\r
+*      new_account->account_name           = strdup("samsung001");\r
+*      new_account->display_name           = strdup("Tom001");\r
+*      new_account->options.keep_local_copy = 1;\r
+*      new_account->check_interval = 55;\r
+*      // Update account\r
+*      if(EMF_ERROR_NONE != email_update_account(acount_id,new_account))\r
+*              //failure\r
+*      else\r
+*              //success\r
+*      // Get account\r
+*      if(EMF_ERROR_NONE != email_get_account(account_id,GET_FULL_DATA,&account))\r
+*              //failure\r
+*      else\r
+*              //success\r
+*      // Get list of accounts\r
+*      if(EMF_ERROR_NONE != email_get_account_list(&account_list,&count))\r
+*              //failure\r
+*      else\r
+*              //success\r
+*      // free account\r
+*      email_free_account(&account, 1);\r
+*      }\r
+ *\r
+ * @endcode\r
+ * @}\r
+ */\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif /* __cplusplus */\r
+\r
+/**\r
+ * @open\r
+ * @fn email_add_account(emf_account_t* account)\r
+ * @brief      Create a new email account.This function is invoked when user wants to add new email account\r
+ *\r
+ * @param[in] account  Specifies the structure pointer of account.\r
+ * @exception  none\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @see         emf_account_t\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_add_account(emf_account_t* account);\r
+\r
+/**\r
+ * @open\r
+ * @fn email_delete_account(int account_id)\r
+ * @brief       Delete a email account.This function is invoked when user wants to delete an existing email account\r
+ *\r
+ * @param[in] account_id       Specifies the account ID.\r
+ * @exception  #EMF_ERROR_INVALID_PARAM                -Invalid argument\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @see\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_delete_account(int account_id);\r
+\r
+/**\r
+ * @open\r
+ * @fn email_update_account(int account_id, emf_account_t* new_account)\r
+ * @brief      Change the information of a email account.This function is getting invoked when user wants to change some information of existing email account.\r
+ *\r
+ * @param[in] account_id       Specifies the orignal account ID.\r
+ * @param[in] new_account      Specifies the information of new account.\r
+ * @param[in] with_validation  If this is 1, email-service will validate the account before updating. If this is 0, email-service will update the account without validation.\r
+ * @exception #EMF_ERROR_INVALID_PARAM         -Invalid argument\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @see emf_account_t\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_update_account(int account_id, emf_account_t* new_account);\r
+\r
+/**\r
+ * @open\r
+ * @fn email_update_account_with_validation(int account_id, emf_account_t* new_account)\r
+ * @brief      Change the information of a email account.This function is getting invoked when user wants to change some information of existing email account.\r
+ *\r
+ * @param[in] account_id       Specifies the orignal account ID.\r
+ * @param[in] new_account      Specifies the information of new account.\r
+ * @param[in] with_validation  If this is 1, email-service will validate the account before updating. If this is 0, email-service will update the account without validation.\r
+ * @exception #EMF_ERROR_INVALID_PARAM         -Invalid argument\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @see emf_account_t\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_update_account_with_validation(int account_id, emf_account_t* new_account);\r
+\r
+/**\r
+ * @open\r
+ * @fn  email_get_account(int account_id, int pulloption, emf_account_t** account)\r
+ * @brief      Get an email account by ID. This function is getting invoked when user wants to get the account informantion based on account id and option (GET_FULL_DATA/WITHOUT_OPTION/ONLY_OPTION).<br>\r
+ *                     Memory for account information will be allocated to 3rd param(account). The allocated memory should be freed by email_free_account().\r
+ *\r
+ * @param[in] account_id       Specifies the account ID.This function is invoked when user\r
+ * @param[in] pulloption       Option to specify to get full details or partial, see definition of EMF_ACC_GET_OPT_XXX\r
+ * @param[out] account         The returned account is saved here.\r
+ * @exception #EMF_ERR_INVALID_PARAM           -Invalid argument\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @see emf_account_t\r
+ * @remarks N/A\r
+ */\r
+\r
+EXPORT_API int email_get_account(int account_id, int pulloption, emf_account_t** account);\r
+\r
+/**\r
+ * @open\r
+ * @fn email_get_account_list(emf_account_t** account_list, int* count);\r
+ * @brief      Get Account List.This function is getting invoked when user wants to get all account information based on the count of accounts provided by user.<br>\r
+ *                     Memory for account information will be allocated to 3rd param(account). The allocated memory should be freed by email_free_account().\r
+ *\r
+ * @param[in] account_list     Specifies the structure pointer of account.\r
+ * @param[out] count                   Specifies the count of accounts.\r
+ * @exception #EMF_ERR_INVALID_PARAM           -Invalid argument\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @see emf_account_t\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_get_account_list(emf_account_t** account_list, int* count);\r
+\r
+ /**\r
+ * @open\r
+ * @fn   email_free_account(emf_account_t** account_list, int count);\r
+ * @brief      Free allocated memory.This function is getting invoked when user wants to delete all account information.\r
+ *\r
+ * @param[in] account_list     Specifies the structure pointer of account.\r
+ * @param[out] count                   Specifies the count of accounts.\r
+ * @exception #EMF_ERR_INVALID_PARAM           -Invalid argument\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @see emf_account_t\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_free_account(emf_account_t** account_list, int count);\r
+\r
+\r
+/**\r
+ * @open\r
+ * @fn email_validate_account(int account_id, unsigned* handle)\r
+ * @brief      Validate account.This function is getting invoked  after adding one account to validate it.If account is not validated then user should retry once again to add the account .\r
+ *\r
+ * @param[in] account_id              Specifies the account Id to validate.\r
+ * @param[out] handle          Specifies the sending handle.\r
+ * @remarks N/A\r
+ * @exception #EMF_ERR_INVALID_PARAM           -Invalid argument\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @see                none\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_validate_account(int account_id, unsigned* handle);\r
+\r
+/**\r
+ * @open\r
+ * @fn email_add_account_with_validation(emf_account_t* account, unsigned* handle)\r
+ * @brief      Add an account when the account is validated. This function is getting invoked when user want to validate an account. If account is not validated then user should retry once again to add the account.<br>\r
+ *              Validation is executed without saving an account to DB\r
+ *\r
+ * @param[in] account      Specifies the structure pointer of account.\r
+ * @param[out] handle          Specifies the sending handle.\r
+ * @remarks N/A\r
+ * @return This function returns true on success or false on failure.\r
+ */\r
+EXPORT_API int email_add_account_with_validation(emf_account_t* account, unsigned* handle);\r
+\r
+\r
+/**\r
+ * @open\r
+ * @fn email_backup_accounts_into_secure_storage(const char *file_name)\r
+ * @brief      Back up information of all accounts into secure storage.\r
+ *          This function is getting invoked when user want to backup account information safely.\r
+ *\r
+ * @param[in] file_name            Specifies the file name in secure storage\r
+ * @remarks N/A\r
+ * @return This function returns true on success or false on failure.\r
+ */\r
+EXPORT_API int email_backup_accounts_into_secure_storage(const char *file_name);\r
+\r
+/**\r
+ * @open\r
+ * @fn email_restore_accounts_from_secure_storage(const char *file_name)\r
+ * @brief      Restore accounts from stored file in secure storage.\r
+ *          This function is getting invoked when user want to restore accounts.\r
+ *\r
+ * @param[in] file_name            Specifies the file name in secure storage\r
+ * @remarks N/A\r
+ * @return This function returns true on success or false on failure.\r
+ */\r
+EXPORT_API int email_restore_accounts_from_secure_storage(const char * file_name);\r
+\r
+/**\r
+ * @open\r
+ * @fn email_get_password_length_of_account(const int account_id, int *password_length)\r
+ * @brief      Get password length of an account.\r
+ *          This function is getting invoked when user want to know the length of an account.\r
+ *\r
+ * @param[in] account_id    Specifies the account id\r
+ * @param[out] handle          Specifies the password length.\r
+ * @remarks N/A\r
+ * @return This function returns true on success or false on failure.\r
+ */\r
+EXPORT_API int email_get_password_length_of_account(const int account_id, int *password_length);\r
+\r
+\r
+/**\r
+ * @open\r
+ * @fn email_query_server_info(const char* domain_name, emf_server_info_t **result_server_info)\r
+ * @brief      Query email server information.\r
+ *          This function is getting invoked when user want to get email server information.\r
+ *\r
+ * @param[in] domain_name              Specifies the domain name of server\r
+ * @param[out] result_server_info      Specifies the information of email server.\r
+ * @remarks N/A\r
+ * @return This function returns true on success or false on failure.\r
+ */\r
+EXPORT_API int email_query_server_info(const char* domain_name, emf_server_info_t **result_server_info);\r
+\r
+/**\r
+ * @open\r
+ * @fn email_free_server_info(emf_server_info_t **result_server_info)\r
+ * @brief      Free emf_server_info_t.\r
+ *          This function is getting invoked when user want to free emf_server_info_t.\r
+ *\r
+ * @param[in] result_server_info       Specifies the pointer of  in secure storage\r
+ * @remarks N/A\r
+ * @return This function returns true on success or false on failure.\r
+ */\r
+EXPORT_API int email_free_server_info(emf_server_info_t **result_server_info);\r
+\r
+/**\r
+ * @open\r
+ * @fn email_update_notification_bar(int account_id)\r
+ * @brief      Update notifications on notification bar.\r
+ *          This function is getting invoked when user want to update notification bar.\r
+ *\r
+ * @param[in] account_id               Specifies the id of account.\r
+ * @remarks N/A\r
+ * @return This function returns true on success or false on failure.\r
+ */\r
+EXPORT_API int email_update_notification_bar(int account_id);\r
+\r
+/**\r
+ * @open\r
+ * @fn email_clear_all_notification_bar()\r
+ * @brief      Clear all notification on notification bar.\r
+ *          This function is getting invoked when user want to clear notification bar.\r
+ *\r
+ * @remarks N/A\r
+ * @return This function returns true on success or false on failure.\r
+ */\r
+EXPORT_API int email_clear_all_notification_bar();\r
+\r
+\r
+/**\r
+ * @open\r
+ * @fn email_save_default_account_id()\r
+ * @brief      Save default account id to vconf storage.\r
+ *          This function is getting invoked when user want to save default account id.\r
+ *\r
+ * @remarks N/A\r
+ * @return This function returns true on success or false on failure.\r
+ */\r
+EXPORT_API int email_save_default_account_id(int input_account_id);\r
+\r
+/**\r
+ * @open\r
+ * @fn email_load_default_account_id()\r
+ * @brief      Load default account id to vconf storage.\r
+ *          This function is getting invoked when user want to load default account id.\r
+ *\r
+ * @remarks N/A\r
+ * @return This function returns true on success or false on failure.\r
+ */\r
+EXPORT_API int email_load_default_account_id(int *output_account_id);\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif /* __cplusplus */\r
+\r
+/**\r
+* @} @}\r
+*/\r
+\r
+#endif /* __EMAIL_API_ACCOUNT_H__ */\r
+\r
+\r
similarity index 79%
rename from MAPI/include/Emf_Mapi_Init.h
rename to email-api/include/email-api-init.h
index 719af1e..cd4e00c 100755 (executable)
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-#ifndef __EMF_MAPI_INTI_H__
-#define  __EMF_MAPI_INTI_H__
-
-#include "emf-types.h"
-
-/**
-* @defgroup EMAIL_FRAMEWORK Email Service
-* @{
-*/
-
-
-/**
-* @ingroup EMAIL_FRAMEWORK
-* @defgroup EMAIL_MAPI_INIT Email Initialization API
-* @{
-*/
-
-/**
- *
- * This file contains the data structures and interfaces needed for application,
- * to interact with Email Engine.
- * @file               Emf_Mapi_Init.h
- * @author     Kyuho Jo <kyuho.jo@samsung.com>
- * @author     Sunghyun Kwon <sh0701.kwon@samsung.com>
- * @version    0.1
- * @brief              This file contains the data structures and interfaces of Email FW Initialization provided by 
- *                     Email Engine . 
- *@{
- *@code
- *
- *     #include "emf_mapi_init.h"
- *
- *     bool
- *     other_app_invoke_uniform_api_sample(int* error_code)
- *     {
- *              int err = EMF_ERROR_NONE;
- *
- *             // Open connections to Email Engine and DB
- *             // The connections will be maintain throughout application's execution
- *             if(EMF_ERROR_NONE == email_service_begin())
- *             {
- *                     If(EMF_ERROR_NONE != email_open_db())
- *                     {
- *                             return false;
- *                     }
- *
- *                     // Execute email_init_storage() if and only if there is no db file. 
- *                     // This fuction will create db file and tables for email service
- *                     If(EMF_ERROR_NONE !=email_init_storage())       
- *                     {
- *                             return false;
- *                     }
- *             }
- *
- *             ......
- *
- *             // Work with calling MAPI functions
- *
- *             ......
- *
- *             // Close the connections to Email Engine and DB after all email job is finished. (ex. close an email application)
- *             // DO NOT have to call these funtions until the connections is not needed any more.
- *             err =email_close_db();
- *             err =email_service_end();                                       
- *      }      
- *
- * @endcode
- * @}
- */
-
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/**
- * @open
- * @fn email_init_storage(void)
- * @brief      Create all table for email. Exposed to External Application- core team.Creates all Email DB tables [ EXTERNAL] 
- * 
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure
- * @exception none
- * @see none
- * @remarks N/A
- */
-EXPORT_API int email_init_storage(void);
-
-/**
- * @open
- * @fn email_open_db(void)
- * @brief This function Open the email DB and register busy handler
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @exception none
- * @see        none
- * @remarks N/A
- */
-EXPORT_API int email_open_db(void);
-
-
-/**
- * @open
- * @fn email_close_db(void)
- * @brief      This function closes the connection of  the email DB
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @exception none
- * @see none
- * @remarks N/A
- */
-EXPORT_API int email_close_db(void);
-
-/**
- * @open
- * @fn email_service_begin(void)
- * @brief      Does the IPC Proxy Initialization by the Application which used the Email FW API's
- * 
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @exception none
- * @see        none
- * @remarks N/A
- */
-EXPORT_API int email_service_begin(void);
-
-/**
- * @open
- * @fn email_service_end(void)
- * @brief      This function does the IPC Proxy Finaization by the Application which used the Email FW API's
- * 
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @exception  none
- * @see        none 
- * @remarks N/A
- */
-EXPORT_API int email_service_end(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-/**
-* @} @}
-*/
-
-
-#endif  /* __EMF_MAPI_INTI_H__ */
+/*\r
+*  email-service\r
+*\r
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+*\r
+* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com>\r
+*\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+* http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License.\r
+*\r
+*/\r
+\r
+\r
+#ifndef __EMAIL_API_INTI_H__\r
+#define __EMAIL_API_INTI_H__\r
+\r
+#include "email-types.h"\r
+\r
+/**\r
+* @defgroup EMAIL_SERVICE Email Service\r
+* @{\r
+*/\r
+\r
+\r
+/**\r
+* @ingroup EMAIL_SERVICE\r
+* @defgroup EMAIL_API_INIT Email Initialization API\r
+* @{\r
+*/\r
+\r
+/**\r
+ *\r
+ * This file contains the data structures and interfaces needed for application,\r
+ * to interact with email-service.\r
+ * @file               email-api-init.h\r
+ * @author     Kyuho Jo <kyuho.jo@samsung.com>\r
+ * @author     Sunghyun Kwon <sh0701.kwon@samsung.com>\r
+ * @version    0.1\r
+ * @brief              This file contains the data structures and interfaces of Email FW Initialization provided by\r
+ *                     email-service .\r
+ *@{\r
+ *@code\r
+ *\r
+ *     #include "emf_mapi_init.h"\r
+ *\r
+ *     bool\r
+ *     other_app_invoke_uniform_api_sample(int* error_code)\r
+ *     {\r
+ *              int err = EMF_ERROR_NONE;\r
+ *\r
+ *             // Open connections to email-service and DB\r
+ *             // The connections will be maintain throughout application's execution\r
+ *             if(EMF_ERROR_NONE == email_service_begin())\r
+ *             {\r
+ *                     If(EMF_ERROR_NONE != email_open_db())\r
+ *                     {\r
+ *                             return false;\r
+ *                     }\r
+ *\r
+ *                     // Execute email_init_storage() if and only if there is no db file.\r
+ *                     // This fuction will create db file and tables for email service\r
+ *                     If(EMF_ERROR_NONE !=email_init_storage())\r
+ *                     {\r
+ *                             return false;\r
+ *                     }\r
+ *             }\r
+ *\r
+ *             ......\r
+ *\r
+ *             // Work with calling MAPI functions\r
+ *\r
+ *             ......\r
+ *\r
+ *             // Close the connections to email-service and DB after all email job is finished. (ex. close an email application)\r
+ *             // DO NOT have to call these funtions until the connections is not needed any more.\r
+ *             err =email_close_db();\r
+ *             err =email_service_end();\r
+ *      }\r
+ *\r
+ * @endcode\r
+ * @}\r
+ */\r
+\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif /* __cplusplus */\r
+\r
+/**\r
+\r
+ * @open\r
+ * @fn email_init_storage(void)\r
+ * @brief      Create all table for email. Exposed to External Application- core team.Creates all Email DB tables [ EXTERNAL]\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure\r
+ * @exception none\r
+ * @see none\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_init_storage(void);\r
+\r
+/**\r
+\r
+ * @open\r
+ * @fn email_open_db(void)\r
+ * @brief This function Open the email DB and register busy handler\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @exception none\r
+ * @see        none\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_open_db(void);\r
+\r
+\r
+/**\r
+\r
+ * @open\r
+ * @fn email_close_db(void)\r
+ * @brief      This function closes the connection of  the email DB\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @exception none\r
+ * @see none\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_close_db(void);\r
+\r
+/**\r
+\r
+ * @open\r
+ * @fn email_service_begin(void)\r
+ * @brief      Does the IPC Proxy Initialization by the Application which used the Email FW API's\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @exception none\r
+ * @see        none\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_service_begin(void);\r
+\r
+/**\r
+\r
+ * @open\r
+ * @fn email_service_end(void)\r
+ * @brief      This function does the IPC Proxy Finaization by the Application which used the Email FW API's\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @exception  none\r
+ * @see        none\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_service_end(void);\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif /* __cplusplus */\r
+\r
+/**\r
+* @} @}\r
+*/\r
+\r
+\r
+#endif  /* __EMAIL_API_INTI_H__ */\r
similarity index 73%
rename from MAPI/include/Emf_Mapi_Message.h
rename to email-api/include/email-api-mail.h
index f8d1f50..e6d4048 100755 (executable)
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-#ifndef __EMF_MAPI_MESSAGE_H__
-#define __EMF_MAPI_MESSAGE_H__
-
-#include "emf-types.h"
-
-#include <time.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-/**
-* @defgroup EMAIL_FRAMEWORK Email Service
-* @{
-*/
-
-
-/**
-* @ingroup EMAIL_FRAMEWORK
-* @defgroup EMAIL_MAPI_MESSAGE Email Message API
-* @{
-*/
-
-/**
- *
- * This file contains the data structures and interfaces needed for application,
- * to interact with Email Engine.
- * @file               Emf_Mapi_Message.h
- * @author     Kyuho Jo <kyuho.jo@samsung.com>
- * @author     Sunghyun Kwon <sh0701.kwon@samsung.com>
- * @version    0.1
- * @brief              This file contains the data structures and interfaces of Messages provided by 
- *                     Email Engine . 
- */
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-/* email_add_message will be deprecated  */
-EXPORT_API int email_add_message(emf_mail_t* mail, emf_mailbox_t* mailbox, int from_composer);
-
-/**
- * @open
- * @fn email_add_mail(emf_mail_data_t *input_mail_data, emf_attachment_data_t *input_attachment_data_list, int input_attachment_count, emf_meeting_request_t* input_meeting_request, int input_sync_server)
- * @brief      Save a mail. This function is invoked when user wants to add a mail.
- *             If the option sync_server is 1 then this will save the message on server as well as on locally.
- *             If the receiving_server_type is EMF_SERVER_TYPE_POP3 then sync_server value will be 0
- *             If the receiving_server_type is EMF_SERVER_TYPE_IMAP4 then sync_server value will be 1/0
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] input_mail_data  Specifies the saving mail.
- * @param[in] input_attachment_data_list       Specifies the mailbox structure for saving email.
- * @param[in] input_attachment_count   Specifies if the mail comes from composer.
- * @param[in] input_meeting_request    Specifies if the mail comes from composer.
- * @param[in] input_sync_server        Specifies if the mail will be saved on server.
- * @exception  none
- * @see emf_mail_t and emf_mailbox_t
- * @remarks N/A
- * @code
- * #include "Emf_Mapi_Message.h"
- * int _test_add_mail ()
- * {
- *     int                    i = 0;
- *     int                    account_id = 0;
- *     int                    sync_server = 0;
- *     int                    attachment_count = 0;
- *     int                    err = EMF_ERROR_NONE;
- *     char                   arg[50] = { 0 , };
- *     char                  *body_file_path = "/opt/data/email/.emfdata/tmp/mail.txt";
- *     emf_mailbox_t         *mailbox_data = NULL;
- *     emf_mail_data_t       *test_mail_data = NULL;
- *     emf_attachment_data_t *attachment_data = NULL;
- *     emf_meeting_request_t *meeting_req = NULL;
- *     FILE                  *body_file;
- *  
- *     printf("\n > Enter account id : ");
- *     scanf("%d", &account_id);
- * 
- *     
- *     memset(arg, 0x00, 50);
- *     printf("\n > Enter mailbox name : ");
- *     scanf("%s", arg);       
- * 
- *     email_get_mailbox_by_name(account_id, arg, &mailbox_data);
- * 
- *     test_mail_data = malloc(sizeof(emf_mail_data_t));
- *     memset(test_mail_data, 0x00, sizeof(emf_mail_data_t));
- *     
- *     printf("\n Sync server? [0/1]> ");
- *     scanf("%d", &sync_server);
- * 
- *     test_mail_data->account_id        = account_id;
- *     test_mail_data->save_status       = 1;
- *     test_mail_data->flags_seen_field  = 1;
- *     test_mail_data->file_path_plain   = strdup(body_file_path);
- *     test_mail_data->mailbox_name      = strdup(mailbox_data->name);
- *     test_mail_data->mailbox_type      = mailbox_data->mailbox_type;
- *     test_mail_data->full_address_from = strdup("<test1@test.com>");
- *     test_mail_data->full_address_to   = strdup("<test2@test.com>"); 
- *     test_mail_data->full_address_cc   = strdup("<test3@test.com>");
- *     test_mail_data->full_address_bcc  = strdup("<test4@test.com>");
- *     test_mail_data->subject           = strdup("Meeting request mail");
- * 
- *     body_file = fopen(body_file_path, "w");
- *             
- *     for(i = 0; i < 500; i++)
- *             fprintf(body_file, "X2 X2 X2 X2 X2 X2 X2");
- *     fflush(body_file);
- *   fclose(body_file);
- *     
- *     printf(" > Attach file? [0/1] : ");
- *     scanf("%d",&attachment_count);
- *     
- *     if ( attachment_count )  {
- *             memset(arg, 0x00, 50);
- *             printf("\n > Enter attachment name : ");
- *             scanf("%s", arg);
- * 
- *             attachment_data = malloc(sizeof(emf_attachment_data_t));
- *             
- *             attachment_data->attachment_name  = strdup(arg);
- *             
- *             memset(arg, 0x00, 50);
- *             printf("\n > Enter attachment absolute path : ");
- *             scanf("%s",arg);                
- *             
- *             attachment_data->attachment_path  = strdup(arg);
- *             attachment_data->save_status      = 1;
- *             test_mail_data->attachment_count  = attachment_count;
- *     }
- *     
- *     printf("\n > Meeting Request? [0: no, 1: yes (request from server), 2: yes (response from local)]");
- *     scanf("%d", &(test_mail_data->meeting_request_status));
- *     
- *     if ( test_mail_data->meeting_request_status == 1 
- *             || test_mail_data->meeting_request_status == 2 ) {
- *             time_t current_time;
- *             meeting_req = malloc(sizeof(emf_meeting_request_t));
- *             memset(meeting_req, 0x00, sizeof(emf_meeting_request_t));
- *             
- *             meeting_req->meeting_response     = 1;
- *             current_time = time(NULL);
- *             gmtime_r(&current_time, &(meeting_req->start_time));
- *             gmtime_r(&current_time, &(meeting_req->end_time));
- *             meeting_req->location = malloc(strlen("Seoul") + 1);
- *             memset(meeting_req->location, 0x00, strlen("Seoul") + 1);
- *             strcpy(meeting_req->location, "Seoul");
- *             strcpy(meeting_req->global_object_id, "abcdef12345");
- * 
- *             meeting_req->time_zone.offset_from_GMT = 9;
- *             strcpy(meeting_req->time_zone.standard_name, "STANDARD_NAME");
- *             gmtime_r(&current_time, &(meeting_req->time_zone.standard_time_start_date));
- *             meeting_req->time_zone.standard_bias = 3;
- *             
- *             strcpy(meeting_req->time_zone.daylight_name, "DAYLIGHT_NAME");
- *             gmtime_r(&current_time, &(meeting_req->time_zone.daylight_time_start_date));
- *             meeting_req->time_zone.daylight_bias = 7;
- * 
- *     }
- *     
- *     if((err = email_add_mail(test_mail_data, attachment_data, attachment_count, meeting_req, sync_server)) != EMF_ERROR_NONE)
- *             printf("email_add_mail failed. [%d]\n", err);
- *     else
- *             printf("email_add_mail success.\n");
- * 
- *     if(attachment_data)
- *             email_free_attachment_data(&attachment_data, attachment_count);
- *             
- *     if(meeting_req)
- *             email_free_meeting_request(&meeting_req, 1);
- *             
- *     email_free_mail_data(&test_mail_data, 1);
- *     email_free_mailbox(&mailbox_data, 1);
- *     
- *     printf("saved mail id = [%d]\n", test_mail_data->mail_id);
- * 
- *     return 0;
- * }
- * @endcode    
- */
-EXPORT_API int email_add_mail(emf_mail_data_t *input_mail_data, emf_attachment_data_t *input_attachment_data_list, int input_attachment_count, emf_meeting_request_t* input_meeting_request, int input_sync_server);
-
-
-/* email_update_message will be deprecated  */
-EXPORT_API int email_update_message( int mail_id, emf_mail_t* mail);
-
-/**
- * @open
- * @fn email_update_mail(emf_mail_data_t *input_mail_data, emf_attachment_data_t *input_attachment_data_list, int input_attachment_count, emf_meeting_request_t* input_meeting_request, int input_from_composer)
- * @brief      Update a existing email information. This function is invoked when user wants to change some existing email information with new email information.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] input_mail_data          Specifies the mail ID.
- * @param[in] input_attachment_data_list       Specifies the pointer of attachment data.
- * @param[in] input_attachment_count   Specifies the number of attachment data.
- * @param[in] input_meeting_request    Specifies the meeting request data.
- * @param[in] input_sync_server Specifies whether sync server.
-
- * @exception  none
- * @see        emf_mail_t                              
- * @code
- * #include "Emf_Mapi_Message.h"
- * int email_test_update_mail()
- * {
- *     int                    mail_id = 0;
- *     int                    err = EMF_ERROR_NONE;
- *     int                    test_attachment_data_count = 0;
- *     char                   arg[50];
- *     emf_mail_data_t       *test_mail_data = NULL;
- *     emf_attachment_data_t *test_attachment_data_list = NULL;
- *     emf_meeting_request_t *meeting_req = NULL;
- *     
- *     printf("\n > Enter mail id : ");
- *     scanf("%d", &mail_id);
- * 
- *     email_get_mail_data(mail_id, &test_mail_data);
- * 
- *     printf("\n > Enter Subject: ");
- *     scanf("%s", arg);       
- * 
- *     test_mail_data->subject= strdup(arg);
- * 
- *     
- * 
- *     if (test_mail_data->attachment_count > 0) {
- *             if ( (err = email_get_attachment_data_list(mail_id, &test_attachment_data_list, &test_attachment_data_count)) != EMF_ERROR_NONE ) {
- *                     printf("email_get_meeting_request() failed [%d]\n", err);
- *                     return -1;
- *             }
- *     }       
- * 
- *     if ( test_mail_data->meeting_request_status == EMF_MAIL_TYPE_MEETING_REQUEST 
- *             || test_mail_data->meeting_request_status == EMF_MAIL_TYPE_MEETING_RESPONSE 
- *             || test_mail_data->meeting_request_status == EMF_MAIL_TYPE_MEETING_ORIGINATINGREQUEST) {
- *             
- *             if ( (err = email_get_meeting_request(mail_id, &meeting_req)) != EMF_ERROR_NONE ) {
- *                     printf("email_get_meeting_request() failed [%d]\n", err);
- *                     return -1;
- *             }
- *     
- *             printf("\n > Enter meeting response: ");
- *             scanf("%d", (int*)&(meeting_req->meeting_response));
- *     }
- *     
- *     if ( (err = email_update_mail(test_mail_data, test_attachment_data_list, test_attachment_data_count, meeting_req, 0)) != EMF_ERROR_NONE) 
- *                     printf("email_update_mail failed.[%d]\n", err);
- *             else
- *                     printf("email_update_mail success\n");
- *             
- *     if(test_mail_data)
- *             email_free_mail_data(&test_mail_data, 1);
- *             
- *     if(test_attachment_data_list) 
- *             email_free_attachment_data(&test_attachment_data_list, test_attachment_data_count);
- *             
- *     if(meeting_req)
- *             email_free_meeting_request(&meeting_req, 1);
- * 
- *     return 0;
- * }
-
- * @endcode    
- * @remarks N/A
- */
-EXPORT_API int email_update_mail(emf_mail_data_t *input_mail_data, emf_attachment_data_t *input_attachment_data_list, int input_attachment_count, emf_meeting_request_t* input_meeting_request, int input_sync_server);
-
-/**
- * @open
- * @fn email_count_message(emf_mailbox_t* mailbox, int* total, int* unseen)
- * @brief      Get mail count from mailbox.This function is invoked when user wants to know how many toatl mails and out of that
- *             how many unseen mails are there in a given mailbox.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] mailbox  Specifies the pointer of mailbox structure.
- * @param[out] total   Total email count is saved here.
- * @param[out] unseen  Unread email count is saved here.
- * @exception  none
- * @see        emf_mailbox_t
-
- * @code
- *     #include "Emf_Mapi_Message.h"
- *     bool
- *     _api_sample_count_message()
- *     {
- *             emf_mailbox_t mailbox;
- *             int account_id = 0;
- *             int total = 0;
- *             int unseen = 0;
- *             
- *             memset(&mailbox, 0x00, sizeof(emf_mailbox_t));
- *             printf("\n > Enter account_id (0 means all accounts) : ");
- *             scanf("%d", &account_id);
- *             if(account_id == 0)
- *             {
- *                     mailbox.name = NULL;
- *             }
- *             else
- *             {
- *                     printf("\n > Enter maibox name: ");
- *                     mailbox.name = strdup("SENTBOX");
- *             }
- *             mailbox.account_id = account_id;
- *             if(EMF_ERROR_NONE == email_count_message(&mailbox, &total, &unseen))
- *                     printf("\n Total: %d, Unseen: %d \n", total, unseen);
- *     }
- * @endcode
- * @remarks N/A
- */
-EXPORT_API int  email_count_message(emf_mailbox_t* mailbox, int* total, int* unseen);
-
-
-/**
- * @open
- * @fn         email_delete_message(emf_mailbox_t* mailbox, int *mail_ids, int num, int from_server)
- * @brief      Delete a mail or multiple mails.Based on from_server value this function will delte a mail or multiple mails from server or loaclly.
- * @param[in] mailbox                  Reserved.
- *             If the receiving_server_type is EMF_SERVER_TYPE_POP3 then from_server value will be 0
- *             If the receiving_server_type is EMF_SERVER_TYPE_IMAP4 then from_server value will be 1/0
- *             
- * @param[in] mail_ids[]                               Specifies the arrary of mail id.
- * @param[in] num                                      Specifies the number of mail id.
- * @param[in] from_server      Specifies whether mails are deleted from server.
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @exception          none
- * @see                emf_mailbox_t
- * @code
- *     #include "Emf_Mapi_Message.h"
- *     bool
- *     _api_sample_delete_all_messages_in_mailbox()
- *     {
- *             int count, i, mail_id=0, account_id =0;
- *             emf_mailbox_t mbox = {0};
- *             emf_mail_body_t  *body = NULL;
- *             
- *             printf("\n > Enter Account_id: ");
- *             scanf("%d",&account_id);
- *             printf("\n > Enter Mail_id: ");
- *             scanf("%d",&mail_id);
- *             printf("\n > Enter Mailbox name: ");
- *             mbox.account_id = account_id;
- *             mbox.name = strdup("INBOX");            
- *             if(EMF_ERROR_NONE == email_delete_message(&mbox, &mail_id, 1, 1))
- *                     printf("\n email_delete_message success");
- *             else
- *                     printf("\n email_delete_message failed");
- *     }
- * @endcode
- * @remarks N/A
- */
-EXPORT_API int email_delete_message(emf_mailbox_t* mailbox, int *mail_ids, int num, int from_server);
-
-
-/**
- * @open
- * @fn email_delete_all_message_in_mailbox(emf_mailbox_t* mailbox, int from_server)
- * @brief      Delete all mail from a mailbox.
- *             If the receiving_server_type is EMF_SERVER_TYPE_POP3 then from_server value will be 0
- *             If the receiving_server_type is EMF_SERVER_TYPE_IMAP4 then from_server value will be 1/0
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] mailbox                  Specifies the structure of mailbox.
- * @param[in] from_server              Specifies whether mails are also deleted from server.
- * @exception          none
- * @see                emf_mailbox_t
-
- * @code
- *     #include "Emf_Mapi_Message.h"
- *     bool
- *     _api_sample_delete_all_messages_in_mailbox()
- *     {
- *             int count,  account_id =0;
- *             emf_mailbox_t mbox = {0};
- *             
- *             printf("\n > Enter Account_id: ");
- *             scanf("%d",&account_id);
- *             printf("\n > Enter Mailbox name: ");
- *             mbox.account_id = account_id;
- *             mbox.name = strdup("INBOX");            
- *
- *             if (EMF_ERROR_NONE != email_delete_all_message_in_mailbox(&mbox, 0))
- *                     printf("email_delete_all_message_in_mailbox failed");                           
- *             else
- *             printf("email_delete_all_message_in_mailbox Success");  
- *     }
- * @endcode
- * @remarks N/A
- */
-EXPORT_API int email_delete_all_message_in_mailbox(emf_mailbox_t* mailbox, 
-                                               int from_server);
-
-
-
-/**
- * @open
- *  @fn email_clear_mail_data()
- * @brief      delete email data from storage. This API will be used by the Settings Application
- * 
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @exception          none
- * @see                none    
-
- * @code
- *     #include "Emf_Mapi_Message.h"
- *     bool
- *     _api_sample_clear_mail_data()
- *     {
- *             if(EMF_ERROR_NONE == email_clear_mail_data())
- *                     //success
- *             else
- *                     //failure       
- *     
- *     }
- * @endcode
- * @remarks N/A
- */
-EXPORT_API int  email_clear_mail_data();
-
-
-/**
- * @open
- * @fn email_add_attachment( emf_mailbox_t* mailbox, int mail_id, emf_attachment_info_t* attachment)
- * @brief      Append a attachment to email.This function is invoked when user wants to add attachment to existing mail.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] mail_id          Specifies the mail ID.
- * @param[in] attachment       Specifies the structure of attachment.
- * @exception          none
- * @see                emf_mailbox_t and emf_attachment_info_t 
-
- * @code
- *     #include "Emf_Mapi_Message.h"
- *     bool
- *     _api_sample_mail_add_attachment()
- *     {
- *             int account_id = 0;
- *             int mail_id = 0;
- *             emf_mailbox_t mbox;
- *             emf_attachment_info_t attachment;
- *                                                             
- *             printf("\n > Enter Mail Id: ");
- *             scanf("%d", &mail_id);  
- *             printf("\n > Enter Account_id: ");
- *             scanf("%d",&account_id);
- *             memset(&mbox, 0x00, sizeof(emf_attachment_info_t));
- *             mbox.account_id = account_id;
- *             mbox.name = strdup("INBOX");
- *             memset(&attachment, 0x00, sizeof(emf_attachment_info_t));
- *             printf("\n > Enter attachment name: ");
- *             attachment.name = strdup("Test");
- *             printf("\n > Enter attachment absolute path: ");
- *             attachment.savename = strdup("/tmp/test.txt");
- *             attachment.next = NULL;
- *             if(EMF_ERROR_NONE != email_add_attachment( &mbox, mail_id, &attachment))
- *                     printf("email_add_attachment failed\n");        
- *             else
- *                     printf(email_add_attachment success\n");
- *     }
- * @endcode
- * @remarks N/A
- */
-EXPORT_API int email_add_attachment( emf_mailbox_t* mailbox, int mail_id, emf_attachment_info_t* attachment);
-
-
-/**
- * @open
- * @fn email_delete_attachment(emf_mailbox_t * mailbox, int mail_id, const char * attachment_id)
- * @brief      delete a attachment from email.This function is invoked when user wants to delete a attachment from existing mailbased on mail Id and attachment Id
- * 
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] mailbox                  Specifies the structure of mailbox.
- * @param[in] mail_id                  Specifies the mail ID.
- * @param[in] attachment_id            Specifies the attachment id.
- * @exception          none
- * @see                emf_mailbox_t 
- * @code
- *     #include "Emf_Mapi_Message.h"
- *     bool
- *     _api_sample_mail_delete_attachment()
- *     {
- *             int account_id = 0;
- *             int mail_id = 0;
- *             char *attchment_id;
- *             emf_mailbox_t mbox;
- *                                                                             
- *             mail_id = 1;                                                            // mail id in the DB
- *             mbox.account_id = 1;                                            // account id in the DB
- *             mbox.name = strdup("INBOX");                    // mailbox name
- *             attachment_id = strdup("1");                            // the first attachment item in a attachment list
- *
- *             if(EMF_ERROR_NONE != email_delete_attachment(&mbox,mail_id,attachment_id))
- *                     //failure
- *             else
- *                     //success       
- *     }
- * @endcode
- * @remarks N/A
- */
-EXPORT_API int email_delete_attachment(emf_mailbox_t * mailbox, int mail_id, const char * attachment_id);
-
-
-/* -----------------------------------------------------------
-                                             Mail Search API
-    -----------------------------------------------------------*/
-
-/**
- * @open
- * @fn email_query_mails(char *conditional_clause_string, emf_mail_data_t** mail_list,  int *result_count)
- * @brief                          Query the mail list information from DB based on the mailbox name.
- * 
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] conditional_clause_string  Specifies the where clause string.
- * @param[in/out] mail_list        Specifies the pointer to the structure emf_mail_data_t.
- * @param[in/out] result_count     Specifies the number of mails returned.
- * @exception                      None
- * @see                            emf_mail_list_item_t                        
-
- * @code
- *     #include "Emf_Mapi_Message.h"
- *     bool
- *     _api_sample_query_mail()
- *     {
- *             emf_mail_data_t *mail_list = NULL;
- *             char conditional_clause_string[500];
- *             int result_count = 0;
- *
- *             memset(mailbox_name, 0x00, 10);
- *             printf("\n > Enter where clause: ");
- *             scanf("%s", conditional_clause_string);
- *
- *
- *             if (EMF_ERROR_NONE != email_query_mails(conditional_clause_string, &mail_list, &result_count)) 
- *                     printf("email_query_message_ex failed \n");
- *             else {
- *                     printf("Success\n");
- *                     //do something
- *                     free(mail_list);
- *             }
- *     
- *     }
- * @endcode    
- * @remarks N/A
- */
-EXPORT_API int email_query_mails(char *conditional_clause_string, emf_mail_data_t** mail_list,  int *result_count);
-
-/**
- * @open
- * @fn email_query_message_ex(char *conditional_clause_string, emf_mail_list_item_t** mail_list,  int *result_count)
- * @brief                          Query the mail list information from DB based on the mailbox name.
- * 
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] conditional_clause_string  Specifies the where clause string.
- * @param[in/out] mail_list        Specifies the pointer to the structure emf_mail_list_item_t.
- * @param[in/out] result_count     Specifies the number of mails returned.
- * @exception                      None
- * @see                            emf_mail_list_item_t                        
-
- * @code
- *     #include "Emf_Mapi_Message.h"
- *     bool
- *     _api_sample_query_mail()
- *     {
- *             emf_mail_list_item_t *mail_list = NULL;
- *             char conditional_clause_string[500];
- *             int result_count = 0;
- *
- *             memset(mailbox_name, 0x00, 10);
- *             printf("\n > Enter where clause: ");
- *             scanf("%s", conditional_clause_string);
- *
- *
- *             if (EMF_ERROR_NONE != email_query_message_ex(conditional_clause_string, &mail_list, &result_count)) 
- *                     printf("email_query_message_ex failed \n");
- *             else {
- *                     printf("Success\n");
- *                     //do something
- *                     free(mail_list);
- *             }
- *     
- *     }
- * @endcode    
- * @remarks N/A
- */
-EXPORT_API int email_query_message_ex(char *conditional_clause_string, emf_mail_list_item_t** mail_list,  int *result_count);
-
-
-/* -----------------------------------------------------------
-                                             Mail Get Info API
-    -----------------------------------------------------------*/
-/**
- * @open
- * @fn email_get_info(emf_mailbox_t* mailbox, int mail_id, emf_mail_info_t** info)
- * @brief      Get a mail info.This function is invoked when user wants to know the basic inforamtion of a mail
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] mailbox                  Reserved.
- * @param[in] mail_id                          Specifies the mail ID.
- * @param[out] info                            The returned body of mail is saved here.
- * @exception          none
- * @see                emf_mailbox_t   
-
- * @code
- *     #include "Emf_Mapi_Message.h"
- *     bool
- *     _api_sample_mail_get_info()
- *     {
- *             emf_mailbox_t mailbox;
- *             emf_mail_info_t *mail_info = NULL;
- *             int mail_id = 0,account_id = 0;
- *             int err = EMF_ERROR_NONE;
- *                                             
- *             memset(&mailbox, 0x00, sizeof(emf_mailbox_t));
- *
- *             printf("\n > Enter Mail Id: ");
- *             scanf("%d", &mail_id);
- *             printf("\n > Enter account Id: ");
- *             scanf("%d", &account_id);
- *             mailbox.account_id = account_id;
- *             if (EMF_ERROR_NONE != email_get_info(&mailbox, mail_id, &mail_info))
- *                     printf("email_get_info failed\n");
- *             else    
- *             {
- *                     printf("email_get_info SUCCESS\n");
- *                     //do something
- *                     email_free_mail_info(&mail_info,1);
- *             }       
- *     
- *     }
- * @endcode
- * 
- * @remarks N/A
- */
-EXPORT_API int email_get_info(emf_mailbox_t* mailbox, int mail_id, emf_mail_info_t** info);
-
-
-/**
- * @open
- * @fn email_free_mail_info(emf_mail_info_t** info_list, int count)
- * @brief      Free allocated memroy for email infoes.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] info_list                Specifies the pointer of mail info structures.
- * @param[in] count                    Specifies the number of mail infoes.
- * @exception          none
- * @see                emf_mail_info_t         
-
- * @code
- *     #include "Emf_Mapi_Message.h"
- *     bool
- *     _api_sample_free_mail_info()
- *     {
- *             emf_mailbox_t mailbox;
- *             emf_mail_info_t *mail_info = NULL;
- *             int mail_id = 0,account_id = 0;
- *             int err = EMF_ERROR_NONE;
- *                                             
- *             memset(&mailbox, 0x00, sizeof(emf_mailbox_t));
- *
- *             printf("\n > Enter Mail Id: ");
- *             scanf("%d", &mail_id);
- *             printf("\n > Enter account Id: ");
- *             scanf("%d", &account_id);
- *             mailbox.account_id = account_id;
- *             if (EMF_ERROR_NONE != email_get_info(&mailbox, mail_id, &mail_info))
- *                     printf("email_get_info failed\n");
- *             else    
- *             {
- *                     printf("email_get_info SUCCESS\n");
- *                     //do something
- *                     email_free_mail_info(&mail_info,1);
- *             }
- *     }
- *  @endcode   
- * @remarks N/A
- */
-EXPORT_API int email_free_mail_info(emf_mail_info_t** info_list, int count);
-
-
-/**
- * @open
- * @fn email_get_header_info(emf_mailbox_t* mailbox, int mail_id, emf_mail_head_t** head)
- * @brief      Get a mail head.This function is invoked when user wants to get the header information of mail.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] mailbox          Reserved.
- * @param[in] mail_id                  Specifies the mail ID.
- * @param[out] head                    The returned info of mail is saved here.
- * @exception          none
- * @see                emf_mailbox_t and emf_mail_head_t       
-
- * @code
- *     #include "Emf_Mapi_Message.h"
- *     bool
- *     _api_sample_mail_get_header_info()
- *     {
- *             emf_mailbox_t mailbox;
- *             emf_mail_head_t *mail_head = NULL;
- *             int mail_id = 0,account_id = 0;
- *             int err = EMF_ERROR_NONE;
- *                                             
- *             memset(&mailbox, 0x00, sizeof(emf_mailbox_t));
- *
- *             printf("\n > Enter Mail Id: ");
- *             scanf("%d", &mail_id);
- *             printf("\n > Enter account Id: ");
- *             scanf("%d", &account_id);
- *             mailbox.account_id = account_id;
- *             if (EMF_ERROR_NONE != email_get_header_info(&mailbox, mail_id, &mail_head))
- *                     printf("email_get_header_info failed\n");
- *             else    
- *             {
- *                     printf("email_get_header_info SUCCESS\n");
- *                     //do something
- *                     email_free_header_info(&mail_header,1);
- *             }
- *     }
- * @endcode    
- * @remarks N/A
- */
-EXPORT_API int  email_get_header_info(emf_mailbox_t* mailbox, int mail_id, emf_mail_head_t** head);
-
-
-/**
- * @open
- * @fn email_free_header_info(emf_mail_head_t** head_list, int count)
- * @brief      Free allocated memroy for email headers.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] head_list                Specifies the pointer of mail head structure list.
- * @param[in] count                    Specifies the number of mail heads.
- * @exception          none
- * @see                emf_mail_head_t         
-
- * @code
- *     #include "Emf_Mapi_Message.h"
- *     bool
- *     _api_sample_mail_free_header_info()
- *     {
- *             emf_mailbox_t mailbox;
- *             emf_mail_head_t *mail_head = NULL;
- *             int mail_id = 0,account_id = 0;
- *             int err = EMF_ERROR_NONE;
- *                                             
- *             memset(&mailbox, 0x00, sizeof(emf_mailbox_t));
- *
- *             printf("\n > Enter Mail Id: ");
- *             scanf("%d", &mail_id);
- *             printf("\n > Enter account Id: ");
- *             scanf("%d", &account_id);
- *             mailbox.account_id = account_id;
- *             if (EMF_ERROR_NONE != email_get_header_info(&mailbox, mail_id, &mail_head))
- *                     printf("email_get_header_info failed\n");
- *             else    
- *             {
- *                     printf("email_get_header_info SUCCESS\n");
- *                     //do something
- *                     email_free_header_info(&mail_header,1);
- *             }
- *     }
- * @endcode    
- * @remarks N/A
- */
-EXPORT_API int email_free_header_info(emf_mail_head_t** head_list, int count);
-
-
-
-/**
- * @open
- * @fn email_get_body_info(emf_mailbox_t* mailbox, int mail_id, emf_mail_body_t** body)
- * @brief      Get a mail body.This function is invoked when user wants to get email body information.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] mailbox          Reserved.
- * @param[in] mail_id                  Specifies the mail ID.
- * @param[out] body                    The returned body of mail is saved here.
- * @exception          none
- * @see                emf_mailbox_t and emf_mail_body_t       
-
- * @code
- *     #include "Emf_Mapi_Message.h"
- *     bool
- *     _api_sample_mail_get_body_info()
- *     {
- *             emf_mailbox_t mailbox;
- *             emf_mail_body_t *mail_body = NULL;
- *             int mail_id = 0,account_id = 0;
- *             int err = EMF_ERROR_NONE;
- *                                             
- *             memset(&mailbox, 0x00, sizeof(emf_mailbox_t));
- *
- *             printf("\n > Enter Mail Id: ");
- *             scanf("%d", &mail_id);
- *             printf("\n > Enter account Id: ");
- *             scanf("%d", &account_id);
- *             mailbox.account_id = account_id;
- *             if (EMF_ERROR_NONE != email_get_body_info(&mailbox, mail_id, &mail_body))
- *                     printf("email_get_body_info failed\n");
- *             else    
- *             {
- *                     printf("email_get_body_info SUCCESS\n");
- *                     //do something
- *                     email_free_body_info(&mail_body,1);
- *             }
- *     }
- * @endcode    
- * @remarks N/A
- */
-EXPORT_API int email_get_body_info(emf_mailbox_t* mailbox, int mail_id, emf_mail_body_t** body);
-
-
-
-/**
- * @open
- * @fn email_free_body_info(emf_mail_body_t** body_list, int count)
- * @brief      Free allocated memroy for email bodies.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] body_list                Specifies the pointer of mail body structures.
- * @param[in] count                    Specifies the number of mail bodies.
- * @exception          none
- * @see                emf_mail_body_t         
-
- * @code
- *     #include "Emf_Mapi_Message.h"
- *     bool
- *     _api_sample_mail_free_body_info()
- *     {
- *             emf_mailbox_t mailbox;
- *             emf_mail_body_t *mail_body = NULL;
- *             int mail_id = 0,account_id = 0;
- *             int err = EMF_ERROR_NONE;
- *                                             
- *             memset(&mailbox, 0x00, sizeof(emf_mailbox_t));
- *
- *             printf("\n > Enter Mail Id: ");
- *             scanf("%d", &mail_id);
- *             printf("\n > Enter account Id: ");
- *             scanf("%d", &account_id);
- *             mailbox.account_id = account_id;
- *             if (EMF_ERROR_NONE != email_get_body_info(&mailbox, mail_id, &mail_body))
- *                     printf("email_get_body_info failed\n");
- *             else    
- *             {
- *                     printf("email_get_body_info SUCCESS\n");
- *                     //do something
- *                     email_free_body_info(&mail_body,1);
- *             }
- *     }
- * @endcode    
- * @remarks N/A
- */
-EXPORT_API int email_free_body_info(emf_mail_body_t** body_list, int count);
-
-
-
-/**
- * @open
- * @fn email_get_attachment_info(emf_mailbox_t* mailbox, int mail_id, const char* attachment_id, emf_attachment_info_t** attachment)
- * @brief      Get a mail attachment.This function is invoked when user wants to get the attachment information based on attachment id for the specified mail Id.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] mailbox          Reserved.
- * @param[in] mail_id          Specifies the mail ID.
- * @param[in] attachment_id    Specifies the buffer that a attachment ID been saved.
- * @param[out] attachment      The returned attachment is save here.
- * @exception          none
- * @see                emf_mailbox_t and emf_mail_attachment_info_t    
-
- * @code
- *     #include "Emf_Mapi_Message.h"
- *     bool
- *     _api_sample_mail_get_attachment_info()
- *     {
- *             emf_mailbox_t mailbox;
- *             emf_mail_attachment_info_t *mail_attach_info = NULL;
- *             int mail_id = 0,account_id = 0;
- *             char arg[10];
- *             int err = EMF_ERROR_NONE;
- *                                             
- *             memset(&mailbox, 0x00, sizeof(emf_mailbox_t));
- *
- *             printf("\n > Enter Mail Id: ");
- *             scanf("%d", &mail_id);
- *             printf("\n > Enter account Id: ");
- *             scanf("%d", &account_id);
- *             printf("> attachment Id\n");
- *             scanf("%s",arg);
- *             mailbox.account_id = account_id;
- *             if (EMF_ERROR_NONE != email_get_attachment_info(&mailbox, mail_id, &mail_attach_info))
- *                     printf("email_get_attachment_info failed\n");
- *             else    
- *             {
- *                     printf("email_get_attachment_info SUCCESS\n");
- *                     //do something
- *                     email_free_attachment_info(&mail_attach_info,1);
- *             }
- *     }
- * @endcode    
- * @remarks N/A
- */
-EXPORT_API int email_get_attachment_info(emf_mailbox_t* mailbox, int mail_id, const char* attachment_id, emf_attachment_info_t** attachment);
-
-EXPORT_API int email_get_attachment_data_list(int input_mail_id, emf_attachment_data_t **output_attachment_data, int *output_attachment_count);
-
-/**
- * @open
- * @fn email_free_attachment_info(emf_attachment_info_t** atch_info)
- * @brief      Free allocated memroy for email attachment.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] atch_info        Specifies the pointer of mail attachment structure pointer.
- * @exception          none
- * @see                emf_mail_attachment_info_t      
-
- * @code
- *     #include "Emf_Mapi_Message.h"
- *     bool
- *     _api_sample_mail_free_attachment_info()
- *     {
- *             emf_mailbox_t mailbox;
- *             emf_mail_attachment_info_t *mail_attach_info = NULL;
- *             int mail_id = 0,account_id = 0;
- *             char arg[10];
- *             int err = EMF_ERROR_NONE;
- *                                             
- *             memset(&mailbox, 0x00, sizeof(emf_mailbox_t));
- *
- *             printf("\n > Enter Mail Id: ");
- *             scanf("%d", &mail_id);
- *             printf("\n > Enter account Id: ");
- *             scanf("%d", &account_id);
- *             printf("> attachment Id\n");
- *             scanf("%s",arg);
- *             mailbox.account_id = account_id;
- *             if (EMF_ERROR_NONE != email_get_attachment_info(&mailbox, mail_id, &mail_attach_info))
- *                     printf("email_get_attachment_info failed\n");
- *             else    
- *             {
- *                     printf("email_get_attachment_info SUCCESS\n");
- *                     //do something
- *                     email_free_attachment_info(&mail_attach_info,1);
- *             }
- *     }
- * @endcode    
- * @remarks N/A
- */
-EXPORT_API int email_free_attachment_info(emf_attachment_info_t** atch_info);
-
-EXPORT_API int email_free_attachment_data(emf_attachment_data_t **attachment_data_list, int attachment_data_count);
-
-
-/**
- * @open
- * @fn email_get_mail(emf_mailbox_t* mailbox,  int mail_id, emf_mail_t** mail)
- * @brief      Get a mail from mailbox.This function is invoked when user wants to get a mail based on mail Id existing in DB.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] mailbox  Reserved.
- * @param[in] mail_id  Specifies the mail ID.
- * @param[out] mail            The returned mail is save here.
- * @exception          none
- * @see                emf_mailbox_t and emf_mail_t    
-
- * @code
- *     #include "Emf_Mapi_Message.h"
- *     bool
- *     _api_sample_get_mail_()
- *     {
- *             emf_mailbox_t mailbox;
- *             emf_mail_t *mail = NULL;
- *             int mail_id = 0 ;
- *             int err = EMF_ERROR_NONE;
- *                                             
- *             memset(&mailbox, 0x00, sizeof(emf_mailbox_t));
- *
- *             printf("\n > Enter Mail Id: ");
- *             scanf("%d", &mail_id);
- *             
- *             if (EMF_ERROR_NONE != email_get_mail(&mailbox, mail_id, &mail))
- *                     printf("email_get_mail failed\n");
- *             else    
- *             {
- *                     printf("email_get_mail SUCCESS\n");
- *                     //do something
- *                     email_free_mail(&mail,1);
- *             }
- *     }
- * @endcode
- * @remarks N/A
- */
-EXPORT_API int email_get_mail(emf_mailbox_t* mailbox,  int mail_id, emf_mail_t** mail);
-
-
-/**
- * @open
- * @fn email_get_mail_data(int input_mail_id, emf_mail_data_t **output_mail_data)
- * @brief      Get a mail by its mail id. This function is invoked when user wants to get a mail based on mail id existing in DB.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] input_mail_id    specifies the mail id.
- * @param[out] output_mail_data                The returned mail is save here.
- * @exception          none
- * @see        emf_mail_data_t         
-
- * @code
- *    #include "Emf_Mapi_Message.h"
- *     bool
- *     _api_sample_get_mail_data()
- *     {
- *             emf_mail_data_t *mail = NULL;
- *             int mail_id = 0 ;
- *             int err = EMF_ERROR_NONE;
- *
- *             printf("\n > Enter mail id: ");
- *             scanf("%d", &mail_id);
- *             
- *             if (EMF_ERROR_NONE != email_get_mail_data(mail_id, &mail))
- *                     printf("email_get_mail_data failed\n");
- *             else    
- *             {
- *                     printf("email_get_mail_data SUCCESS\n");
- *                     //do something
- *                     email_free_mail_data(&mail,1);
- *             }
- *     }
- * @endcode
- * @remarks N/A
- */
-
-EXPORT_API int email_get_mail_data(int input_mail_id, emf_mail_data_t **output_mail_data);
-
-
-/* -----------------------------------------------------------
-                                             Mail Flag API
-    -----------------------------------------------------------*/
-
-/**
- * @open
- * @fn email_modify_mail_flag(int mail_id, emf_mail_flag_t new_flag, int onserver)
- * @brief      Change email flag.[ Seen,Deleted,flagged,answered,recent,draft,has_attachment,reserved_1]
- *             If the receiving_server_type is EMF_SERVER_TYPE_POP3 then from_server value will be 0
- *                     If the receiving_server_type is EMF_SERVER_TYPE_IMAP4 then from_server value will be 1/0
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] mail_id  Specifies the mail ID.
- * @param[in] new_flag Specifies the new email flag.
- * @param[in] onserver Specifies whether mail Flag updation in server
- * @exception          none
- * @see                emf_mail_flag_t         
-
- * @code
- *     #include "Emf_Mapi_Message.h"
- *     bool
- *     _api_sample_modify_mail_flag()
- *     {
- *             emf_mail_flag_t newflag;
- *             int mail_id = 0;
- *             int err = EMF_ERROR_NONE;
- *                                             
- *             memset(&newflag, 0x00, sizeof(emf_mail_flag_t));
- *             newflag.seen = 1;
- *             newflag.answered = 0;
- *             newflag.sticky = 1;
- *             
- *             printf("\n > Enter Mail Id: ");
- *             scanf("%d", &mail_id);
- *             if (EMF_ERROR_NONE != email_modify_mail_flag(mail_id, newflag, 1))
- *                     printf("email_modify_mail_flag failed\n");
- *             else    
- *             {
- *                     printf("email_modify_mail_flag SUCCESS\n");
- *                     //do something
- *                     
- *             }
- *     }
- * @endcode
- * @remarks N/A
- */
-EXPORT_API int email_modify_mail_flag(int mail_id, emf_mail_flag_t new_flag, int onserver);
-
-
-/* email_modify_seen_flag would be replaced with email_set_flags_field */
-EXPORT_API int email_modify_seen_flag(int *mail_ids, int num, int seen_flag, int onserver) DEPRECATED;
-
-/**
- * @open
- * @fn email_set_flags_field(int *mail_ids, int num, emf_flags_field_type field_type, int value, int onserver)
- * @brief      Change email flags field.
- *             If the receiving_server_type is EMF_SERVER_TYPE_POP3 then from_server value will be 0
- *                     If the receiving_server_type is EMF_SERVER_TYPE_IMAP4 then from_server value will be 1/0
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] account_id  Specifies account ID.
- * @param[in] mail_ids         Specifies the array of mail ID.
- * @param[in] num              Specifies the number of mail ID.
- * @param[in] field_type  Specifies the field type what you want to set. Refer emf_flags_field_type.
- * @param[in] value          Specifies the value what you want to set. 
- * @param[in] onserver         Specifies whether mail Flag updation in server
- * @exception          none
- * @see                none    
- * @code
- *     #include "Emf_Mapi_Message.h"
- *     bool
- *     _api_sample_set_flags_field()
- *     {
- *             int mail_id = 0;
- *             int err = EMF_ERROR_NONE;
- *                                             
- *             printf("\n > Enter Mail Id: ");
- *             scanf("%d", &mail_id);
- *             if (EMF_ERROR_NONE != email_set_flags_field(&mail_id, EMFF_LAGS_SEEN_FIELD, 1, 0))
- *                     printf("email_set_flags_field failed\n");
- *             else    
- *             {
- *                     printf("email_set_flags_field SUCCESS\n");
- *                     //do something                  
- *             }
- *     }
- * @endcode
- * @remarks N/A
- */
-
-EXPORT_API int email_set_flags_field(int account_id, int *mail_ids, int num, emf_flags_field_type field_type, int value, int onserver);
-
-/**
- * @open
- * @fn email_modify_extra_mail_flag(int mail_id, emf_extra_flag_t new_flag)
- * @brief      Change email extra flag.[priority,Delivery report status, Drm, Protection etc]
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] mail_id  Specifies the mail ID.
- * @param[in] new_flag Specifies the new email extra flag.
- * @exception          none
- * @see                emf_extra_flag_t        
-
- * @code
- *     #include "Emf_Mapi_Message.h"
- *     bool
- *     _api_sample_modify_extra_mail_flag()
- *     {
- *             emf_extra_flag_t newflag;
- *             int mail_id = 0;
- *             int err = EMF_ERROR_NONE;
- *
- *             memset(&newflag, 0x00, sizeof(emf_extra_flag_t));
- *
- *             printf("\n > Enter Mail Id: ");
- *             scanf("%d", &mail_id);  
- *
- *             if(EMF_ERROR_NONE !=  email_modify_extra_mail_flag(mail_id, newflag))
- *                     printf("email_modify_extra_mail_flag failed");
- *             else
- *                     printf("email_modify_extra_mail_flag success");
- *
- *     }
- * @endcode    
- * @remarks N/A
- */
-EXPORT_API int email_modify_extra_mail_flag(int mail_id, emf_extra_flag_t new_flag);
-
-
-
-/* -----------------------------------------------------------
-                                             Mail Move API
-    -----------------------------------------------------------*/
-
-/**
- * @open
- * @fn email_move_mail_to_mailbox(int *mail_ids, int num, emf_mailbox_t* new_mailbox)
- * @brief      Move a email to another mailbox.
- * 
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] mail_id          Specifies the array of mail ID.
- * @param[in] num                      Specifies the count of mail IDs.
- * @param[in] new_mailbox      Specifies the mailbox structure for moving email.
- * @exception          none
- * @see                emf_mailbox_t   
-
- * @code
- *     #include "Emf_Mapi_Message.h"
- *     bool
- *     _api_sample_move_mail_to_mailbox()
- *     {
- *             int mail_id = 1;
- *             int account_id =0;
- *             emf_mailbox_t mbox;
- *             char arg[10];
- *             int err = EMF_ERROR_NONE;
- *             int i = 0;
- *                                                             
- *             printf("\n > Enter Account_id: ");
- *             scanf("%d",&account_id);
- *                                                                                     
- *             memset(&mbox, 0x00, sizeof(emf_mailbox_t));
- *                                                                                                                                                                                     
- *             mbox.account_id = account_id;
- *             mbox.name = strdup("Test");             
- *             if(EMF_ERROR_NONE == email_move_mail_to_mailbox(mail_id,        1, &mbox))
- *                     printf("Success\n");                    
- *     
- *     }
- * @endcode    
- * @remarks N/A
- */
-EXPORT_API int email_move_mail_to_mailbox(int *mail_ids, int num, emf_mailbox_t* new_mailbox);
-
-
-/**
- * @open
- * @fn email_move_all_mails_to_mailbox(emf_mailbox_t* src_mailbox, emf_mailbox_t* new_mailbox)
- * @brief      Move all email to another mailbox.
- * 
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] src_mailbox      Specifies the source mailbox structure for moving email.
- * @param[in] new_mailbox      Specifies the destination mailbox structure for moving email.
- * @exception          none
- * @see                emf_mailbox_t   
-
- * @code
- *     #include "Emf_Mapi_Message.h"
- *     bool
- *     _api_sample_move_all_mails_to_mailbox()
- *     {
- *             emf_mailbox_t src_mailbox;
- *             emf_mailbox_t dest_mailbox;
- *             int total_count;
- *             int err = EMF_ERROR_NONE;
- *             char temp[128];
- *
- *             memset(&src_mailbox, 0x00, sizeof(emf_mailbox_t));
- *             memset(&dest_mailbox, 0x00, sizeof(emf_mailbox_t));
- *
- *             // input mailbox information : need  account_id and name (src & dest)
- *             printf("src mail account id(0: All account)> ");
- *             scanf("%d", &src_mailbox.account_id);
- *             printf("src mailbox_name(0 : NULL)> ");
- *             src_mailbox = strdup("INBOX");
- *             // Destination mailbox
- *             printf("dest mail account id> "); 
- *             scanf("%d", &dest_mailbox.account_id);
- *             printf("dest_mailbox_name(0 : NULL)> ");
- *             dest_mailbox = strdup("INBOX");
- *
- *             ( EMF_ERROR_NONE == email_move_all_mails_to_mailbox(&src_mailbox, &dest_mailbox))
- *             {
- *                     printf("  fail email_move_all_mails_to_mailbox: \n");
- *             }
- *             else
- *                     //success
- *     if ( src_mailbox)
- *     {
- *             free(src_mailbox);
- *     }
- *     if ( dest_mailbox )
- *     {
- *             free(dest_mailbox);
- *     }                                                       
- * }
- * @endcode    
- * @remarks N/A
- */
-EXPORT_API int email_move_all_mails_to_mailbox(emf_mailbox_t* src_mailbox, emf_mailbox_t* new_mailbox);
-
-
-/**
- * @open
- * @fn email_count_message_with_draft_flag(emf_mailbox_t* mailbox, int* total)
- * @brief      Get mail count from mailbox having draft flag.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] mailbox          Specifies the pointer of mailbox structure.
- * @param[out] total           Total email count is saved with draft flag enabled.
- * @exception          none
- * @see                emf_mailbox_t   
-
- * @code
- *     #include "Emf_Mapi_Message.h"
- *     bool
- *     _api_sample_count_message_with_draft_flag()
- *     {
- *             emf_mailbox_t mailbox;
- *             int total_count;
- *             int err = EMF_ERROR_NONE;
- *
- *             memset(&mailbox, 0x00, sizeof(emf_mailbox_t));
- *             // input mailbox information : need account_id and name
- *             printf("mail account id(0: All account)> ");
- *             scanf("%d", &mailbox.account_id);
- *             mailbox.name = strdup("Inbox");
- *             if ( EMF_ERROR_NONE != email_count_message_with_draft_flag(&mailbox, &total_count))
- *             {
- *                     printf("  fail email_count_message_with_draft_flag:\n);
- *             }
- *             else
- *             {
- *                     printf("  success email_count_message_with_draft_flag:\n);
- *             }
- *             if ( mailbox.name )
- *             {
- *                     free(mailbox.name);
- *             }
- *     }
- * @endcode    
- * @remarks N/A
- */
-EXPORT_API int email_count_message_with_draft_flag(emf_mailbox_t* mailbox, int* total);
-
-
-/**
- * @open
- * @fn email_count_message_on_sending(emf_mailbox_t* mailbox, int* total)
- * @brief      Get the number of mails which are being sent in specific mailbox.This function gives the list of mails having on sending status for a given mailbox.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] mailbox          Specifies the pointer of mailbox structure.
- * @param[out] total           Total email count is saved with draft flag enabled.
- * @exception          none
- * @see                emf_mailbox_t   
-
- * @code
- *     #include "Emf_Mapi_Message.h"
- *     bool
- *     _api_sample_count_message_on_sending()
- *     {
- *             emf_mailbox_t mailbox;
- *             int total_count;
- *             int err = EMF_ERROR_NONE;
- *
- *             memset(&mailbox, 0x00, sizeof(emf_mailbox_t));
- *             // input mailbox information : need account_id and name
- *             printf("mail account id(0: All account)> ");
- *             scanf("%d", &mailbox.account_id);
- *             mailbox.name = strdup("Draft");
- *             if (EMF_ERROR_NONE != email_count_message_on_sending(&mailbox, &total_count))
- *             {
- *                     printf("  fail email_count_message_on_sending: \n");
- *             }
- *             else
- *             {
- *                     printf("  success email_count_message_on_sending:\n");
- *             }
- *             if ( mailbox.name )
- *             {
- *                     free(mailbox.name);
- *             }
- *     }
- * @endcode    
- * @remarks N/A
- */
-EXPORT_API int email_count_message_on_sending(emf_mailbox_t* mailbox, int* total);
-
-/**
- * @open
- * @fn email_free_mailbox(emf_mailbox_t** mailbox_list, int count)
- * @brief      Free allocated memory for mailbox information.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] mailbox_list     Specifies the pointer for searching mailbox structure pointer.
- * @param[in] count                    Specifies the count of mailboxes.
- * @exception          none
- * @see                 emf_mailbox_t                  
-
- * @code
- *     #include "Emf_Mapi_Message.h"
- *     bool
- *     _api_sample_free_mailbox_info()
- *     {
- *             emf_mailbox_t *mailbox;
- *
- *             //fill the mailbox structure
- *             //count - number of mailbox structure user want to free
- *              if(EMF_ERROR_NONE == email_free_mailbox(&mailbox,count))
- *                     //success
- *              else
- *                     //failure               
- *     
- *     }
- * @endcode    
- * @remarks N/A
- */
-EXPORT_API int email_free_mailbox(emf_mailbox_t** mailbox_list, int count);
-
-
-/**
- * @open
- * @fn email_free_mail(emf_mail_t** mail_list, int count)
- * @brief      Free allocated memroy for emails.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] mail_list        Specifies the pointer of mail structure pointer.
- * @param[in] count            Specifies the count of mails.
- * @exception          none
- * @see                 emf_mail_t                     
-
- * @code
- *     #include "Emf_Mapi_Message.h"
- *     bool
- *     _api_sample_free_mail()
- *     {
- *             emf_mail_t *mail;
- *
- *             //fill the mail structure
- *             //count - number of mail structure user want to free
- *              if(EMF_ERROR_NONE == email_free_mail(&mail,count))
- *                     //success
- *              else
- *                     //failure               
- *     
- *     }
- * @endcode    
- * @remarks N/A
- */
-EXPORT_API int email_free_mail(emf_mail_t** mail_list, int count);
-
-/**
- * @open
- * @fn email_free_mail_data(emf_mail_data_t** mail_list, int count)
- * @brief      Free allocated memroy for emails.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] mail_list        Specifies the pointer of mail structure pointer.
- * @param[in] count            Specifies the count of mails.
- * @exception          none
- * @see                 emf_mail_data_t                        
-
- * @code
- *     #include "Emf_Mapi_Message.h"
- *     bool
- *     _api_sample_free_mail()
- *     {
- *             emf_mail_data_t *mail;
- *
- *             //fill the mail structure
- *             //count - number of mail structure user want to free
- *              if(EMF_ERROR_NONE == email_free_mail_data(&mail,count))
- *                     //success
- *              else
- *                     //failure               
- *     
- *     }
- * @endcode    
- * @remarks N/A
- */
-EXPORT_API int email_free_mail_data(emf_mail_data_t** mail_list, int count);
-
-/**
- * @open
- * @fn email_get_mails(int account_id , const char *mailbox_name, int thread_id, int start_index, int limit_count, emf_sort_type_t sorting, emf_mail_data_t** mail_list,  int* result_count)
- * @brief      Get the Mail List information from DB based on the mailbox name.
- * 
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] account_id               Specifies the account ID
- * @param[in] mailbox_name             Specifies the mailbox name
- * @param[in] thread_id                Specifies the thread id. It can be EMF_LIST_TYPE_THREAD, EMF_LIST_TYPE_NORMAL or thread id.
- * @param[in] start_index      Specifies start index for LIMIT clause of SQL query.
- * @param[in] limit_count      Specifies limit count for LIMIT clause of SQL query.
- * @param[in] sorting          Specifies the sorting type.
- * @param[in/out] mail_list            Specifies the pointer to the structure emf_mail_data_t.
- * @param[in/out] result_count Specifies the number of mails returned.
- * @exception          none
- * @see                 emf_mail_data_t                        
-
- * @code
- *    #include "Emf_Mapi_Message.h"
- *     bool
- *     _api_sample_get_mail()
- *     {
- *             emf_mail_data_t *mail_list = NULL;
- *             char mailbox_name[50];
- *             int result_count = 0;
- *             int account_id = 0;
- *             int err_code = EMF_ERROR_NONE;
- *
- *             memset(mailbox_name, 0x00, 10);
- *             printf("\n > Enter Mailbox name: ");
- *             scanf("%s", mailbox_name);
- *
- *             printf("\n > Enter Account_id: ");
- *             scanf("%d",&account_id);                
- *
- *             if (EMF_ERROR_NONE != email_get_mails(account_id, mailbox_name, EMF_LIST_TYPE_NORMAL, 0, 100, EMF_SORT_DATETIME_HIGH,  &mail_list, &result_count)) {
- *                     printf("email_get_mails failed \n");
- *             }
- *             else {
- *                     printf("Success\n");
- *                     //do something
- *                     free(mail_list);
- *             }
- *     
- *     }
- * @endcode    
- * @remarks N/A
- */
-
-EXPORT_API int email_get_mails(int account_id , const char *mailbox_name, int thread_id, int start_index, int limit_count, emf_sort_type_t sorting, emf_mail_data_t** mail_list,  int* result_count);
-
-/**
- * @open
- * @fn email_get_mail_list_ex(int account_id , const char *mailbox_name, int thread_id, int start_index, int limit_count, emf_sort_type_t sorting, emf_mail_list_item_t** mail_list,  int* result_count)
- * @brief      Get the Mail List information from DB based on the mailbox name.
- * 
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] account_id               Specifies the account ID
- * @param[in] mailbox_name             Specifies the mailbox name
- * @param[in] thread_id                Specifies the thread id. It can be EMF_LIST_TYPE_THREAD, EMF_LIST_TYPE_NORMAL or thread id.
- * @param[in] start_index      Specifies start index for LIMIT clause of SQL query.
- * @param[in] limit_count      Specifies limit count for LIMIT clause of SQL query.
- * @param[in] sorting          Specifies the sorting type.
- * @param[in/out] mail_list            Specifies the pointer to the structure emf_mail_list_item_t.
- * @param[in/out] result_count Specifies the number of mails returned.
- * @exception          none
- * @see                 emf_mail_list_item_t                   
-
- * @code
- *     #include "Emf_Mapi_Message.h"
- *     bool
- *     _api_sample_get_mail()
- *     {
- *             emf_mail_list_item_t *mail_list = NULL;
- *             char mailbox_name[50];
- *             int result_count = 0;
- *             int account_id = 0;
- *             int err_code = EMF_ERROR_NONE;
- *
- *             memset(mailbox_name, 0x00, 10);
- *             printf("\n > Enter Mailbox name: ");
- *             scanf("%s", mailbox_name);
- *
- *             printf("\n > Enter Account_id: ");
- *             scanf("%d",&account_id);                
- *
- *             if (EMF_ERROR_NONE != email_get_mail_list_ex(account_id, mailbox_name, EMF_LIST_TYPE_NORMAL, 0, 100, EMF_SORT_DATETIME_HIGH,  &mail_list, &result_count)) 
- *             {
- *                     printf("email_get_mail_list failed \n");
- *             }
- *             else
- *             {
- *                     printf("Success\n");
- *                     //do something
- *                     free(mail_list);
- *             }
- *     
- *     }
- * @endcode    
- * @remarks N/A
- */
-EXPORT_API int email_get_mail_list_ex(int account_id , const char *mailbox_name, int thread_id, int start_index, int limit_count, emf_sort_type_t sorting, emf_mail_list_item_t** mail_list,  int* result_count);
-
-/**
- * @open
- * @fn email_find_mail(int account_id , const char *mailbox_name, int thread_id, 
-       int search_type, char *search_value, int start_index, int limit_count, emf_sort_type_t sorting, emf_mail_list_item_t** mail_list,  int* result_count)
- * @brief      Get the Searched Mail List information from the DB based on the mailbox name account_id, type and value of searching.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] account_id       Specifies the Account ID
- * @param[in] mailbox_name     Specifies the Mailbox Name
- * @param[in] thread_id        Specifies the thread_id. If thread_id = EMF_LIST_TYPE_NORMAL, search a mail without regarding thread. The case of thread_id > 0 is for  getting mail list of specific thread.
- * @param[in] search_type      Specifies the searching type(EMF_SEARCH_FILTER_SUBJECT,  EMF_SEARCH_FILTER_SENDER, EMF_SEARCH_FILTER_RECIPIENT, EMF_SEARCH_FILTER_ALL)
- * @param[in] search_value     Specifies the value to use for searching. (ex : Subject, email address, display name)
- * @param[in] start_index              Specifies the first mail index of searched mail. This function will return mails whose index in the result list are from start_index to start_index + limit_count. The first start index is 0.
- * @param[in] limit_count              Specifies the max number of returned mails.
- * @param[in] sorting                   Specifies the sorting order. see emf_sort_type_t
- * @param[in/out] mail_list    Specifies the Pointer to the structure emf_mail_list_item_t.
- * @param[in/out] result_count         Specifies the Number of searched Mails 
- * @exception          none
- * @see                 emf_sort_type_t, emf_mail_list_item_t
- * @code
- * @endcode    
- * @remarks N/A
- */
-EXPORT_API int email_find_mail(int account_id , const char *mailbox_name, int thread_id, 
-       int search_type, char *search_value, 
-       int start_index, int limit_count, emf_sort_type_t sorting, emf_mail_list_item_t** mail_list,  int* result_count);
-
-/**
-  * @open
- * @fn         email_get_mail_by_address(int account_id , const char *mailbox_name, emf_email_address_list_t* addr_list, 
-                                                                       int start_index, int limit_count, emf_sort_type_t sorting, emf_mail_list_item_t** mail_list,  int* result_count)
- * @brief      Get the Mail List information from the DB based on the mailbox name account_id and sender address.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] account_id       Specifies the Account ID
- * @param[in] mailbox_name     Specifies the Mailbox Name
- * @param[in] addr_list                Specifies the addresses of senders. see emf_email_address_list_t
- * @param[in] start_index              Specifies the first mail index of searched mail. This function will return mails whose index in the result list are from start_index to start_index + limit_count
- * @param[in] limit_count              Specifies the max number of returned mails.
- * @param[in] search_type   Specifies the search type.
- * @param[in] search_value  Specifies the search value.
- * @param[in] sorting                   Specifies the sorting order. see emf_sort_type_t
- * @param[in/out] mail_list    Specifies the Pointer to the structure emf_mail_list_item_t.
- * @param[in/out] result_count         Specifies the Number of searched Mails 
- * @exception          none
- * @see                 emf_email_address_list_t, emf_sort_type_t, emf_mail_list_item_t
- * @code
- * @endcode    
- * @remarks N/A
- */
-EXPORT_API int email_get_mail_by_address(int account_id , const char *mailbox_name, emf_email_address_list_t* addr_list, 
-                                                                       int start_index, int limit_count, int search_type, const char *search_value, emf_sort_type_t sorting, emf_mail_list_item_t** mail_list,  int* result_count);
-
-/**
- * @open
- * @fn email_get_thread_information_by_thread_id(int thread_id, emf_mail_data_t** thread_info)
- * @brief      Get the thread information for specific thread from DB based on the mailbox name.
- * 
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] thread_id            Specifies the thread_id
- * @param[in/out] thread_info  Specifies the Pointer to the structure emf_mail_data_t.
- * @exception          none
- * @see             emf_mail_data_t                    
-
- * @code
- *     #include "Emf_Mapi_Message.h"
- *     bool
- *     _api_sample_get_thread_information()
- *     {
- *             emf_mail_data_t *thread_info = NULL;
- *             int thread_id = 0;
- *             int err_code = EMF_ERROR_NONE;
- *
- *             printf("\n > Enter thread_id: ");
- *             scanf("%d",&thread_id); 
- *             
- *             if ( EMF_ERROR_NONE != email_get_thread_information_by_thread_id(thread_id, &thread_info)) 
- *             {
- *                     printf("email_get_thread_information_by_thread_id failed :\n"); *                       
- *             }
- *             else
- *             {
- *                     printf("Success\n");
- *                     //do something
- *             }
- *     
- *     }
- * @endcode    
- * @remarks N/A
- */
-
-
-EXPORT_API int email_get_thread_information_by_thread_id(int thread_id, emf_mail_data_t** thread_info);
-
-/**
- * @open
- * @fn email_get_thread_information_ex(int thread_id, emf_mail_list_item_t** thread_info)
- * @brief      Get the Mail List information for specific thread from DB based on the mailbox name.
- * 
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] thread_id            Specifies the thread_id
- * @param[in/out] thread_info  Specifies the Pointer to the structure emf_mail_list_item_t.
- * @exception          none
- * @see             emf_mail_list_item_t                       
-
- * @code
- *     #include "Emf_Mapi_Message.h"
- *     bool
- *     _api_sample_get_thread_information_ex()
- *     {
- *             emf_mail_list_item_t *thread_info = NULL;
- *             int thread_id = 0;
- *             int err_code = EMF_ERROR_NONE;
- *
- *             printf("\n > Enter thread_id: ");
- *             scanf("%d",&thread_id); 
- *             
- *             if ( EMF_ERROR_NONE != email_get_thread_information_ex(thread_id, &thread_info)) 
- *             {
- *                     printf("email_get_mail_list_of_thread failed :\n"); *                   
- *             }
- *             else
- *             {
- *                     printf("Success\n");
- *                     //do something
- *             }
- *     
- *     }
- * @endcode    
- * @remarks N/A
- */
-EXPORT_API int email_get_thread_information_ex(int thread_id, emf_mail_list_item_t** thread_info);
-/**
- * @open
- * @fn email_get_mail_flag(int account_id, int mail_id, emf_mail_flag_t* mail_flag)
- * @brief      Get the Mail Flag information based on the account id and Mail Id.
- * 
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] account_id       Specifies the Account ID
- * @param[in] mail_id          Specifies the Mail id for which  Flag details need to be fetched
- * @param[in/out] mail_flag    Specifies the Pointer to the structure emf_mail_flag_t.
- * @exception          none
- * @see                 emf_mail_flag_t                        
-
- * @code
- *     #include "Emf_Mapi_Message.h"
- *     bool
- *     _api_sample_get_mail_flag()
- *     {
- *             emf_mail_flag_t *mail_flag = NULL;
- *             int account_id = 0;
- *             int mail_id = 0;
- *             int err_code = EMF_ERROR_NONE;
- *
- *             printf("\n > Enter account_id: ");
- *             scanf("%d",&account_id);        
- *             printf("\n > Enter mail_id: ");
- *             scanf("%d",&mail_id);   
- *             
- *             if ( EMF_ERROR_NONE != email_get_mail_flag(account_id,mail_id, &mail_flag)) 
- *             {
- *                     printf("email_get_mail_flag failed :\n");                       
- *             }
- *             else
- *             {
- *                     printf("Success\n");
- *                     //do something
- *             }
- *     
- *     }
- * @endcode    
- * @remarks N/A
- */
-EXPORT_API int email_get_mail_flag(int account_id, int mail_id, emf_mail_flag_t* mail_flag);
-
-/**
- * @open
- * @fn email_retry_send_mail( int mail_id, int timeout_in_sec)
- * @brief      Retry mail send
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] mail_id                  Specifies the mail id for the mail to resend
- * @param[in] timeout_in_sec   Specifies the timeout value in seconds
- * @exception          none
- * @see                 none                   
-
- * @code
- *     #include "Emf_Mapi_Message.h"
- *     bool
- *     _api_sample_retry_send_mail()
- *     {
- *             int mail_id = 1;
- *             int timeout_in_sec = 2;
- *
- *              if(EMF_ERROR_NONE == email_retry_send_mail(mail_id,timeout_in_sec))
- *                     //success
- *              else
- *                     //failure               
- *     
- *     }
- * @endcode  
- * @remarks N/A
- */
-EXPORT_API int email_retry_send_mail( int mail_id, int timeout_in_sec);
-
-
-/**
- * @open
- * @fn email_create_db_full()
- * @brief      Create DB full
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @exception          none
- * @see                 none                   
-
- * @code
- *     #include "Emf_Mapi_Message.h"
- *     bool
- *     _api_sample_create_db_full()
- *     {
- *
- *              if(EMF_ERROR_NONE == email_create_db_full())
- *                     //success
- *              else
- *                     //failure               
- *     
- *     }
- * @endcode    
- * @remarks N/A
- */
-
-EXPORT_API int email_create_db_full();
-/**
- * @open
- * @fn email_get_mailbox_name_by_mail_id(int mail_id, char **pMailbox_name)
- * @brief      get mailBox naem by mailID
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] mail_id          Specifies the mailID
- * @param[out] pMailbox_name   Specifies the mailbox name
- * @exception          none
- * @see                 none                   
-
- * @code
- *     #include "Emf_Mapi_Message.h"
- *     bool
- *     _api_sample_get_mailbox_name_by_mail_id()
- *     {
- *             char *mailbox_name =NULL;
- *             int mail_id = 10;
- *
- *
- *              if(EMF_ERROR_NONE == email_get_mailbox_name_by_mail_id(mail_id,&mailbox_name))
- *                     //success
- *              else
- *                     //failure               
- *     
- *     }
- * @endcode    
- * @remarks N/A
- */
-
-EXPORT_API int email_get_mailbox_name_by_mail_id(int mail_id, char **pMailbox_name);
-
-/**
- * @open
- * @fn email_cancel_send_mail( int mail_id) 
- * @brief      Callback function for cm popup. We set the status as EMF_MAIL_STATUS_SEND_CANCELED  
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] mail_id          Specifies the mailID
- * @exception          none
- * @see                 none                   
-
- * @code
- *     #include "Emf_Mapi_Message.h"
- *     bool
- *     _api_sample_cancel_send_mail()
- *     {
- *             int mail_id = 10;
- *
- *
- *              if(EMF_ERROR_NONE == email_cancel_send_mail(mail_id,))
- *                     //success
- *              else
- *                     //failure               
- *     
- *     }
- * @endcode    
- * @remarks N/A
- */
-EXPORT_API int email_cancel_send_mail( int mail_id) ;
-
-
-/**
- * @open
- * @fn email_count_message_all_mailboxes(emf_mailbox_t* mailbox, int* total, int* unseen)
- * @brief      Get the Total count and Unread count of all mailboxes 
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] mailbox          Specifies the mailbox structure
- * @param[out] total           Specifies the total count
- * @param[out] seen            Specifies the unseen mail count 
- * @exception          none
- * @see                 emf_mailbox_t                  
-
- * @code
- *     #include "Emf_Mapi_Message.h"
- *     bool
- *     _api_sample_count_message_all_mailboxes()
- *     {
- *             emf_mailbox_t mailbox;
- *             int total =0;
- *             int unseen = 0;
- *             
- *             memset(&mailbox,0x00,sizeof(emf_mailbox_t));
- *             mailbox.account_id = 0;
- *             mailbox.name = strdup("INBOX");
- *             
- *              if(EMF_ERROR_NONE == email_count_message_all_mailboxes(&mailbox,&total,&unseen))
- *                     //success
- *              else
- *                     //failure               
- *     
- *     }
- * @endcode    
- * @remarks N/A
- */
-EXPORT_API int email_count_message_all_mailboxes(emf_mailbox_t* mailbox, int* total, int* unseen);
-
-
-/* sowmya.kr@samsung.com, 01282010 - Changes to get latest unread mail id for given account */
-/**
- * @open
- * @fn email_get_latest_unread_mail_id(int account_id, int *pMailID)
- * @brief      Gets the latest unread MailId for given account. If account_id passed is -1, returns latest unread mail Id.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] account_id       Specifies the account id for which latest unread mail has to be fetched
- * @param[out] pMailID         Specifies the latest unread mail 
- * @exception          none
- * @see                 none                   
-
- * @code
- *     #include "Emf_Mapi_Message.h"
- *     bool
- *     _api_sample_get_latest_unread_mail_id()
- *     {
- *             int mail_id = 0,account_id = 0;
- *             int err = EMF_ERROR_NONE;
- *                             
- *
- *             printf("Enter account Id to get latest unread mail Id,<-1 to get latest irrespective of account id> ");
- *             scanf("%d", &account_id);
- *
- *                                             
- *             if ( EMF_ERROR_NONE != email_get_latest_unread_mail_id(account_id, &mail_id) )
- *             {
- *                     printf("  fail email_get_latest_unread_mail_id: err[%d]\n", err);
- *             }
- *             else
- *             {
- *                     printf("  success email_get_latest_unread_mail_id: Latest unread mail id : %d\n", mail_id);
- *             }       
- *     }
- * @endcode    
- * @remarks N/A
- */
-EXPORT_API int  email_get_latest_unread_mail_id(int account_id, int *pMailID);
-
-
-/*------------------------------------------------------------------*/
-/* sowmya.kr@samsung.com 01152010, Changes for Backup Email feature */
-/* Backup Email feature is disabled */
-/* 
-int EmfBackupToMailFile(int mail_id,  int* err_code);
-
-int EmfGetBackupMailHeaderInfo(char *backup_mail_filePath, emf_mail_head_t** head,int* err_code);
-
-int EmfGetBackupMail(char *backup_mail_filePath,emf_mail_t** mail, int* err_code);
-
-int EmfDeleteBackupMail(char *backup_mail_filePath, int* err_code);
-*/
-/* Changes for Backup Email feature */
-/*------------------------------------------------------------------*/
-
-/**
-  * @open
- * @fn email_get_max_mail_count(int *Count)
- * @brief      Gets the max count of mails which can be supported by email-service
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[out] Count   max count of mails which can be supported by email-service
- * @exception          none
-
- * @code
- *     #include "Emf_Mapi_Message.h"
- *             bool
- *             _api_sample_get_max_mail_count()
- *             {
- *                     int max_count = -1;
- *             
- *                     if(EMF_ERROR_NONE == email_get_max_mail_count(&max_count))
- *                             printf("\n\t>>>>> email_get_max_mail_count() return [%d]\n\n", max_count);
- *     }
- * @endcode    
- * @remarks N/A
- */
-EXPORT_API int  email_get_max_mail_count(int *Count);
-
-
- /**
- * @open
- * @fn email_get_disk_space_usage(unsigned long *total_size)
- * @brief      Gets the total disk usage of emails in KB.
- * 
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[out] total_size      total disk usage of emails
- * @exception          none
-
- * @code
- *     #include "Emf_Mapi_Message.h"
- *             bool
- *             _api_sample_get_disk_space_usage()
- *             {
- *                     unsigned long total_size = 0;
- *                             
- *                     if ( EMF_ERROR_NONE  != email_get_disk_space_usage(&total_size))
- *                             printf("email_get_disk_space_usage failed err : %d\n",err_code);
- *                     else    
- *                             printf("email_get_disk_space_usage SUCCESS, total disk usage in KB : %ld \n", total_size);              
- *             }
- * @endcode    
- * @remarks N/A
- */
-EXPORT_API int email_get_disk_space_usage(unsigned long *total_size);
-
-
-EXPORT_API int email_get_recipients_list(int account_id, const char *mailbox_name, emf_sender_list_t **sender_list);
-/**
- * @open
- * @fn email_get_sender_list(int account_id, const char *mailbox_name, int search_type, char *search_value, emf_sort_type_t sorting, emf_sender_list_t** sender_list, int *sender_count)
- * @brief      Get the sender list with the total number of sender's mails and the number of sender's unread mails.
- *                     This is used to show email address and display name of each sender with the number of mails (unread and total).
- * 
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] account_id       Specifies the account id to get the list. If this is 0, a sender list of "All Account" will be returned.
- * @param[in] mailbox_name     Specifies the mailbox name  to get the list. If this is NULL, a sender list of "All Mailbox" will be returned.
- * @param[in] search_type   Specifies the search type
- * @param[in] search_value  Specifies the search value
- * @param[in] sorting               Specifies the sorting order.
- * @param[out] sender_list     Specifies the Pointer to the structure emf_sender_list_t. Memory for a new sender list will be allocated to this. Call email_free_sender_list() to free the memory allocated to this.
- * @param[out] sender_count    Specifies the number of senders in a sender list.
- * @exception          none
- * @see                 emf_sort_type_t, emf_sender_list_t, email_free_sender_list()
- * @code
- *     #include "Emf_Mapi_Message.h"
- *     bool
- *     _api_sample_get_sender_list()
- *     {
- *             emf_sender_list_t *sender_list = NULL;
- *             int sender_count = 0;
- *             int account_id = 0;
- *             int sorting = 0;
- *             int err_code = EMF_ERROR_NONE;
- *
- *             account_id = 0;                                                 // For All accounts
- *             mailbox_name = NULL;                                    // For All mail boxes
- *             sorting = EMF_SORT_DATETIME_HIGH;
- *             
- *             
- *             if ( EMF_ERROR_NONE != (err_code = email_get_sender_list(account_id, mailbox_name, EMF_SEARCH_FILTER_NONE, NULL, sorting, &sender_list, &sender_count)) )
- *             {
- *                     printf("email_get_sender_list failed :\n"); *                   
- *                     return false;
- *             }
- *             else
- *             {
- *                     printf("Success\n");
- *                     //do something
- *             }
- *
- *             // Free sender list
- *             if ( sender_list )
- *             {
- *                     email_free_sender_list(&sender_list, sender_count);
- *             }
- *     }
- * @endcode    
- * @remarks N/A
- */
-EXPORT_API int email_get_sender_list(int account_id, const char *mailbox_name, int search_type, const char *search_value, emf_sort_type_t sorting, emf_sender_list_t** sender_list, int *sender_count);
-
-/**
- * @open
- * @fn email_get_sender_list_ex(int account_id, const char *mailbox_name, int start_index, int limit_count, emf_sort_type_t sorting, emf_sender_list_t** sender_list, int *sender_count)
- * @brief      Get the sender list with the total number of sender's mails and the number of sender's unread mails.
- *                     This is used to show email address and display name of each sender with the number of mails (unread and total).
- * 
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] account_id       Specifies the account id to get the list. If this is 0, a sender list of "All Account" will be returned.
- * @param[in] mailbox_name     Specifies the mailbox name  to get the list. If this is NULL, a sender list of "All Mailbox" will be returned.
- * @param[in] start_index              Specifies the start index in the sender list. This function will return  a partial sender list from start_index to (start_index + limit_count - 1) in the sender list. negative value means "from the first sender". start_index is zero-based value.
- * @param[in] limit_count              Specifies the max number of sender list. negative value means "All senders from the start_index in sender list"
- * @param[in] sorting               Specifies the sorting order.
- * @param[out] sender_list     Specifies the Pointer to the structure emf_sender_list_t. Memory for a new sender list will be allocated to this. Call email_free_sender_list() to free the memory allocated to this.
- * @param[out] sender_count    Specifies the number of senders in a sender list.
- * @exception          none
- * @see                 emf_sort_type_t, emf_sender_list_t, email_free_sender_list()
- * @code
- *     #include "Emf_Mapi_Message.h"
- *     bool
- *     _api_sample_get_sender_list()
- *     {
- *             emf_sender_list_t *sender_list = NULL;
- *             int sender_count = 0;
- *             int account_id = 0;
- *             int start_index = 10;           // from the 11th sender in sender list
- *             int limit_count = 5;            // to the (11 + 5)th sender in sender list
- *             int sorting = 0;
- *             int err_code = EMF_ERROR_NONE;
- *
- *             account_id = 0;                                                 // For All accounts
- *             mailbox_name = NULL;                                    // For All mail boxes
- *             sorting = EMF_SORT_DATETIME_HIGH;
- *             
- *             
- *             if ( EMF_ERROR_NONE != (err_code = email_get_sender_list_ex(account_id, mailbox_name, start_index, limit_count, sorting, &sender_list, &sender_count)) )
- *             {
- *                     printf("email_get_sender_list_ex failed :\n"); *                        
- *                     return false;
- *             }
- *             else
- *             {
- *                     printf("Success\n");
- *                     //do something
- *             }
- *
- *             // Free sender list
- *             if ( sender_list )
- *             {
- *                     email_free_sender_list(&sender_list, sender_count);
- *             }
- *     }
- * @endcode    
- * @remarks N/A
- */
-EXPORT_API int email_get_sender_list_ex(int account_id, const char *mailbox_name, int start_index, int limit_count, emf_sort_type_t sorting, emf_sender_list_t** sender_list, int *sender_count);
-
-
-/**
- * @open
- * @fn email_free_sender_list(emf_sender_list_t **sender_list, int count)
- * @brief      Free the sender list allocated by email_get_sender_list(). This function will free the memory which is allocated to sender_list itself.
- * 
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] sender_list      Specifies the Pointer to the structure emf_sender_list_t to be freed.
- * @param[in] count            Specifies the number of senders in a sender list.
- * @exception          none
- * @see                 emf_sender_list_t, email_get_sender_list()
- */
-EXPORT_API int email_free_sender_list(emf_sender_list_t **sender_list, int count);
-
-
-/**
- * @open
- * @fn         email_get_address_info_list(int mail_id, emf_address_info_list_t** address_info_list)
- * @brief      Get the address info list. The address info list contains from, to, cc, bcc addresses and their display name, contact id and etc. (see emf_address_info_list_t)
- *                     Each GList (from, to, cc, bcc) is the list of emf_address_info_t data. 
- *                     "data" variable of GList structure contains emf_address_info_t data. <br>
- *                     To get emf_address_info_t data from GList, Use type casting from GList node.
- * 
- * @return     This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] mail_id          Specifies the mail id to get the list. 
- * @param[out] address_info_list       Specifies the Pointer to the structure emf_address_info_list_t. Memory for a new address info list will be allocated to this. Call email_free_address_info_list() to free the memory allocated to this.
- * @exception          none
- * @see                 emf_address_info_list_t, emf_address_info_t, email_free_address_info_list()
- * @code
- *     #include "Emf_Mapi_Message.h"
- *     bool
- *     _api_sample_get_address_info_list()
- *     {
- *             emf_address_info_list_t *p_address_info_list= NULL;
- *             emf_address_info_t *p_address_info = NULL;
- *             int mai_id;
- *             int err_code = EMF_ERROR_NONE;
- *
- *             mail_id = 1;                            
- *             
- *             if ( EMF_ERROR_NONE != (err_code = email_get_address_info_list(mail_id, &p_address_info_list)) )
- *             {
- *                     printf("email_get_address_info_list failed :\n"); *                     
- *                     return false;
- *             }
- *             else
- *             {
- *                     printf("Success\n");
- *                     //do something with p_address_info_list
- *                     GList *list = p_address_info_list->from;
- *                     GList *node = g_list_first(list);
- *                     while ( node != NULL )
- *                     {
- *                             p_address_info = (emf_address_info_t*)node->data;
- *                             printf("%d,  %s, %s, %d\n", p_address_info->address_type, p_address_info->address, p_address_info->display_name, p_address_info->contact_id);
- *
- *                             node = g_list_next(node);
- *                     }
- *             }
- *
- *             // Free sender list
- *             if ( p_address_info_list )
- *             {
- *                     email_free_address_info_list(&p_address_info_list);
- *             }
- *     }
- * @endcode    
- * @remarks N/A
- */
-EXPORT_API int email_get_address_info_list(int mail_id, emf_address_info_list_t** address_info_list);
-
-/**
- * @open
- * @fn email_free_address_info_list(emf_address_info_list_t **address_info_list)
- * @brief      Free the address info list allocated by email_get_address_info_list(). This function will free the memory which is allocated to address_info_list itself.
- * 
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] address_info_list        Specifies the Pointer to the structure emf_address_info_list_t to be freed.
- * @exception          none
- * @see                 emf_address_info_list_t, email_get_address_info_list()
- */
-EXPORT_API int email_free_address_info_list(emf_address_info_list_t **address_info_list);
-
-/**
- * @open
- * @fn email_get_structure(const char*encoded_string, void **struct_var, emf_convert_struct_type_e type)
- * @brief      This function returns the structure of the type which is indicated by 'type' variable. This function will allocate new memory to 'struct_var' for structure.<br>
- *                     Some notifications such as NOTI_DOWNLOAD_NEW_MAIL are published with string parameter. The string contains various values that might be divided by delimiter.<br>
- * 
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] encoded_string           Specifies the Pointer to the string from notification.
- * @param[out] struct_var                      Specifies the Pointer to the structure to be returned. If success, new memory for structure will be allocated.
- * @param[in] type                             Specifies the converting type. see emf_convert_struct_type_e
- * @exception          none
- * @see                 emf_convert_struct_type_e
- */
-EXPORT_API int email_get_structure(const char*encoded_string, void **struct_var, emf_convert_struct_type_e type);
-
-
-/**
- * @open
- * @fn email_add_message_with_meeting_request(emf_mail_t* mail, emf_mailbox_t* mailbox, emf_meeting_request_t* meeting_req, int from_composer)
- * @brief      Save a mail with meeting request information  to specific mail box. 
- *                     This function is invoked when user wants to add a composed mail to a specified mailbox. <br>
- *                     If the mail is composed by an user, the option (from_composer) is 1. Otherwise 0. <br>
- *                     When info->is_meeting_request in the first parameter("mail") is 0 (EMF_MAIL_TYPE_NORMAL), meeting_req will be ignored. and this function will work the same as email_add_message().
- *                     When info->is_meeting_request in the first parameter("mail") is (EMF_MAIL_TYPE_MEETING_REQUEST or EMF_MAIL_TYPE_MEETING_RESPONSE), 
- *                     The third parameter("meeting_req") shouldn't be NULL.
- *                     
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] mail             Specifies the saving mail.
- * @param[in] mailbox  Specifies the mailbox structure for saving email.
- * @param[in] meeting_req      Specifies the structure for meeting request information.
- * @param[in] from_composer            Specifies if the mail comes from composer.
- * @exception  none
- * @see                 emf_mail_t, emf_mailbox_t, emf_meeting_request_t, email_add_message(), email_get_meeting_request(), email_update_message_with_meeting_request(), email_free_meeting_request()
- * @remarks N/A
- */
-
-EXPORT_API int email_add_message_with_meeting_request(emf_mail_t* mail, emf_mailbox_t* mailbox, emf_meeting_request_t* meeting_req, int from_composer);
-
-/**
- * @open
- * @fn email_get_meeting_request(int mail_id, emf_meeting_request_t **meeting_req)
- * @brief      Get the information of meeting request.  The information of meeting request is based on Mail Id. <br>
- *                     The information of meeting request is corresponding to only one mail. 
- *                     For this reason, the information of meeting request can be added by using email_add_message_with_meeting_request() with a matched mail information.
- * 
- * @return This function returns EMF_ERROR_NONE on success. This function returns EMF_ERROR_DATA_NOT_FOUND if there isn't a matched mail. Otherwise it returns error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] mail_id          Specifies the Mail id for which  meeting request details need to be fetched
- * @param[in/out] meeting_req  Specifies the Pointer to the structure emf_meeting_request_t.
- * @exception          none
- * @see                 emf_meeting_request_t                  
- */
-EXPORT_API int email_get_meeting_request(int mail_id, emf_meeting_request_t **meeting_req);
-
-/**
- * @open
- * @fn email_update_message_with_meeting_request(int mail_id, emf_mail_t* mail, emf_meeting_request_t* meeting_req)
- * @brief      Update a existing email information. This function is invoked when user wants to change some existing email information with new email information. <br>
- *                     When info->is_meeting_request in the second parameter("mail") is 0 (EMF_MAIL_TYPE_NORMAL), meeting_req will be ignored. and this function will work the same as email_update_message().
- *                     When info->is_meeting_request in the second parameter("mail") is (EMF_MAIL_TYPE_MEETING_REQUEST or EMF_MAIL_TYPE_MEETING_RESPONSE), 
- *                     The third parameter("meeting_req") shouldn't be NULL.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] mail_id          Specifies the mail ID.
- * @param[in] mail                     Specifies the pointer of mail structure.
- * @param[in] meeting_req                      Specifies the pointer of meeting request structure(emf_meeting_request_t).
- *                                             
- * @exception  none
- * @see        emf_mail_t, emf_meeting_request_t, email_add_message_with_meeting_request()
- */
-EXPORT_API int email_update_message_with_meeting_request(int mail_id, emf_mail_t* mail, emf_meeting_request_t* meeting_req);
-
-/**
- * @open
- * @fn email_free_meeting_request(emf_meeting_request_t** meeting_req, int count)
- * @brief      Free the meeting request allocated by email_get_meeting_request() or alloacted to add. This function will free the memory which is allocated to meeting_req (= *meeting_req) itself.
- * 
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] emf_meeting_request_t    Specifies the Pointer to the structure emf_meeting_request_t to be freed.
- * @param[in] count    Specifies the number of elements in meeting_req array. this is usually 1.
- * @exception          none
- * @see                 emf_meeting_request_t, email_get_meeting_request()
- */
-EXPORT_API int email_free_meeting_request(emf_meeting_request_t** meeting_req, int count);
-
-EXPORT_API int email_move_thread_to_mailbox(int thread_id, char *target_mailbox_name, int move_always_flag);
-
-EXPORT_API int email_delete_thread(int thread_id, int delete_always_flag);
-
-EXPORT_API int email_modify_seen_flag_of_thread(int thread_id, int seen_flag, int on_server);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-/**
-* @} @}
-*/
-
-
-#endif /* __EMF_MAPI_MESSAGE_H__ */
+/*\r
+*  email-service\r
+*\r
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+*\r
+* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com>\r
+*\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+* http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License.\r
+*\r
+*/\r
+\r
+\r
+#ifndef __EMAIL_API_MESSAGE_H__\r
+#define __EMAIL_API_MESSAGE_H__\r
+\r
+#include "email-types.h"\r
+\r
+#include <time.h>\r
+\r
+#include <sys/types.h>\r
+#include <sys/stat.h>\r
+#include <unistd.h>\r
+\r
+/**\r
+* @defgroup EMAIL_SERVICE Email Service\r
+* @{\r
+*/\r
+\r
+\r
+/**\r
+* @ingroup EMAIL_SERVICE\r
+* @defgroup EMAIL_API_MAIL Email Mail API\r
+* @{\r
+*/\r
+\r
+/**\r
+ *\r
+ * This file contains the data structures and interfaces needed for application,\r
+ * to interact with email-service.\r
+ * @file               email-api-mail.h\r
+ * @author     Kyuho Jo <kyuho.jo@samsung.com>\r
+ * @author     Sunghyun Kwon <sh0701.kwon@samsung.com>\r
+ * @version    0.1\r
+ * @brief              This file contains the data structures and interfaces of Messages provided by\r
+ *                     email-service .\r
+ */\r
+\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif /* __cplusplus */\r
+\r
+/**\r
+ * @open\r
+ * @fn email_add_mail(emf_mail_data_t *input_mail_data, emf_attachment_data_t *input_attachment_data_list, int input_attachment_count, emf_meeting_request_t* input_meeting_request, int input_from_eas)\r
+ * @brief      Save a mail. This function is invoked when user wants to add a mail.\r
+ *             If the option from_eas is 1 then this will save the message on server as well as on locally.\r
+ *             If the receiving_server_type is EMF_SERVER_TYPE_POP3 then from_eas value will be 0\r
+ *             If the receiving_server_type is EMF_SERVER_TYPE_IMAP4 then from_eas value will be 1/0\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] input_mail_data  Specifies the saving mail.\r
+ * @param[in] input_attachment_data_list       Specifies the mailbox structure for saving email.\r
+ * @param[in] input_attachment_count   Specifies if the mail comes from composer.\r
+ * @param[in] input_meeting_request    Specifies if the mail comes from composer.\r
+ * @param[in] input_from_eas   Specifies if the mail will be saved on server.\r
+\r
+ * @exception  none\r
+ * @see emf_mail_data_t and emf_mailbox_t\r
+ * @remarks N/A\r
+ * @code\r
+ * #include "email-api-mail.h"\r
+ * int _test_add_mail ()\r
+ * {\r
+ *     int                    i = 0;\r
+ *     int                    account_id = 0;\r
+ *     int                    from_eas = 0;\r
+ *     int                    attachment_count = 0;\r
+ *     int                    err = EMF_ERROR_NONE;\r
+ *     char                   arg[50] = { 0 , };\r
+ *     char                  *body_file_path = "/opt/data/email/.emfdata/tmp/mail.txt";\r
+ *     emf_mailbox_t         *mailbox_data = NULL;\r
+ *     emf_mail_data_t       *test_mail_data = NULL;\r
+ *     emf_attachment_data_t *attachment_data = NULL;\r
+ *     emf_meeting_request_t *meeting_req = NULL;\r
+ *     FILE                  *body_file;\r
+ *\r
+ *     printf("\n > Enter account id : ");\r
+ *     scanf("%d", &account_id);\r
+ *\r
+ *\r
+ *     memset(arg, 0x00, 50);\r
+ *     printf("\n > Enter mailbox name : ");\r
+ *     scanf("%s", arg);\r
+ *\r
+ *     email_get_mailbox_by_name(account_id, arg, &mailbox_data);\r
+ *\r
+ *     test_mail_data = malloc(sizeof(emf_mail_data_t));\r
+ *     memset(test_mail_data, 0x00, sizeof(emf_mail_data_t));\r
+ *\r
+ *     printf("\n From EAS? [0/1]> ");\r
+ *     scanf("%d", &from_eas);\r
+ *\r
+ *     test_mail_data->account_id        = account_id;\r
+ *     test_mail_data->save_status       = 1;\r
+ *     test_mail_data->flags_seen_field  = 1;\r
+ *     test_mail_data->file_path_plain   = strdup(body_file_path);\r
+ *     test_mail_data->mailbox_name      = strdup(mailbox_data->name);\r
+ *     test_mail_data->mailbox_type      = mailbox_data->mailbox_type;\r
+ *     test_mail_data->full_address_from = strdup("<test1@test.com>");\r
+ *     test_mail_data->full_address_to   = strdup("<test2@test.com>");\r
+ *     test_mail_data->full_address_cc   = strdup("<test3@test.com>");\r
+ *     test_mail_data->full_address_bcc  = strdup("<test4@test.com>");\r
+ *     test_mail_data->subject           = strdup("Meeting request mail");\r
+ *\r
+ *     body_file = fopen(body_file_path, "w");\r
+ *\r
+ *     for(i = 0; i < 500; i++)\r
+ *             fprintf(body_file, "X2 X2 X2 X2 X2 X2 X2");\r
+ *     fflush(body_file);\r
+ *   fclose(body_file);\r
+ *\r
+ *     printf(" > Attach file? [0/1] : ");\r
+ *     scanf("%d",&attachment_count);\r
+ *\r
+ *     if ( attachment_count )  {\r
+ *             memset(arg, 0x00, 50);\r
+ *             printf("\n > Enter attachment name : ");\r
+ *             scanf("%s", arg);\r
+ *\r
+ *             attachment_data = malloc(sizeof(emf_attachment_data_t));\r
+ *\r
+ *             attachment_data->attachment_name  = strdup(arg);\r
+ *\r
+ *             memset(arg, 0x00, 50);\r
+ *             printf("\n > Enter attachment absolute path : ");\r
+ *             scanf("%s",arg);\r
+ *\r
+ *             attachment_data->attachment_path  = strdup(arg);\r
+ *             attachment_data->save_status      = 1;\r
+ *             test_mail_data->attachment_count  = attachment_count;\r
+ *     }\r
+ *\r
+ *     printf("\n > Meeting Request? [0: no, 1: yes (request from server), 2: yes (response from local)]");\r
+ *     scanf("%d", &(test_mail_data->meeting_request_status));\r
+ *\r
+ *     if ( test_mail_data->meeting_request_status == 1\r
+ *             || test_mail_data->meeting_request_status == 2 ) {\r
+ *             time_t current_time;\r
+ *             meeting_req = malloc(sizeof(emf_meeting_request_t));\r
+ *             memset(meeting_req, 0x00, sizeof(emf_meeting_request_t));\r
+ *\r
+ *             meeting_req->meeting_response     = 1;\r
+ *             current_time = time(NULL);\r
+ *             gmtime_r(&current_time, &(meeting_req->start_time));\r
+ *             gmtime_r(&current_time, &(meeting_req->end_time));\r
+ *             meeting_req->location = malloc(strlen("Seoul") + 1);\r
+ *             memset(meeting_req->location, 0x00, strlen("Seoul") + 1);\r
+ *             strcpy(meeting_req->location, "Seoul");\r
+ *             strcpy(meeting_req->global_object_id, "abcdef12345");\r
+ *\r
+ *             meeting_req->time_zone.offset_from_GMT = 9;\r
+ *             strcpy(meeting_req->time_zone.standard_name, "STANDARD_NAME");\r
+ *             gmtime_r(&current_time, &(meeting_req->time_zone.standard_time_start_date));\r
+ *             meeting_req->time_zone.standard_bias = 3;\r
+ *\r
+ *             strcpy(meeting_req->time_zone.daylight_name, "DAYLIGHT_NAME");\r
+ *             gmtime_r(&current_time, &(meeting_req->time_zone.daylight_time_start_date));\r
+ *             meeting_req->time_zone.daylight_bias = 7;\r
+ *\r
+ *     }\r
+ *\r
+ *     if((err = email_add_mail(test_mail_data, attachment_data, attachment_count, meeting_req, from_eas)) != EMF_ERROR_NONE)\r
+ *             printf("email_add_mail failed. [%d]\n", err);\r
+ *     else\r
+ *             printf("email_add_mail success.\n");\r
+ *\r
+ *     if(attachment_data)\r
+ *             email_free_attachment_data(&attachment_data, attachment_count);\r
+ *\r
+ *     if(meeting_req)\r
+ *             email_free_meeting_request(&meeting_req, 1);\r
+ *\r
+ *     email_free_mail_data(&test_mail_data, 1);\r
+ *     email_free_mailbox(&mailbox_data, 1);\r
+ *\r
+ *     printf("saved mail id = [%d]\n", test_mail_data->mail_id);\r
+ *\r
+ *     return 0;\r
+ * }\r
+ * @endcode\r
+ */\r
+EXPORT_API int email_add_mail(emf_mail_data_t *input_mail_data, emf_attachment_data_t *input_attachment_data_list, int input_attachment_count, emf_meeting_request_t* input_meeting_request, int input_from_eas);\r
+\r
+ /**\r
+  * @open\r
+  * @fn email_add_read_receipt(int input_read_mail_id,  unsigned *output_handle)\r
+  * @brief     Add a read receipt mail. This function is invoked when user receives a mail with read report enable and wants to send a read report for the same.\r
+  *\r
+  * @return    This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+  * @param[in]  input_read_mail_id     Specifies the id of mail which has been read.\r
+  * @param[out] output_receipt_mail_id Specifies the receipt mail id .\r
+  * @exception none\r
+  * @see\r
+  * @remarks N/A\r
+  */\r
+EXPORT_API int email_add_read_receipt(int input_read_mail_id, int *output_receipt_mail_id);\r
+\r
+/**\r
+ * @open\r
+ * @fn email_update_mail(emf_mail_data_t *input_mail_data, emf_attachment_data_t *input_attachment_data_list, int input_attachment_count, emf_meeting_request_t* input_meeting_request, int input_from_composer)\r
+ * @brief      Update a existing email information. This function is invoked when user wants to change some existing email information with new email information.\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] input_mail_data          Specifies the mail ID.\r
+ * @param[in] input_attachment_data_list       Specifies the pointer of attachment data.\r
+ * @param[in] input_attachment_count   Specifies the number of attachment data.\r
+ * @param[in] input_meeting_request    Specifies the meeting request data.\r
+ * @param[in] input_from_eas Specifies whether sync server.\r
+\r
+ * @exception  none\r
+ * @see        emf_mail_data_t\r
+ * @code\r
+ * #include "email-api-account.h"\r
+ * int email_test_update_mail()\r
+ * {\r
+ *     int                    mail_id = 0;\r
+ *     int                    err = EMF_ERROR_NONE;\r
+ *     int                    test_attachment_data_count = 0;\r
+ *     char                   arg[50];\r
+ *     emf_mail_data_t       *test_mail_data = NULL;\r
+ *     emf_attachment_data_t *test_attachment_data_list = NULL;\r
+ *     emf_meeting_request_t *meeting_req = NULL;\r
+ *\r
+ *     printf("\n > Enter mail id : ");\r
+ *     scanf("%d", &mail_id);\r
+ *\r
+ *     email_get_mail_data(mail_id, &test_mail_data);\r
+ *\r
+ *     printf("\n > Enter Subject: ");\r
+ *     scanf("%s", arg);\r
+ *\r
+ *     test_mail_data->subject= strdup(arg);\r
+ *\r
+ *\r
+ *\r
+ *     if (test_mail_data->attachment_count > 0) {\r
+ *             if ( (err = email_get_attachment_data_list(mail_id, &test_attachment_data_list, &test_attachment_data_count)) != EMF_ERROR_NONE ) {\r
+ *                     printf("email_get_meeting_request() failed [%d]\n", err);\r
+ *                     return -1;\r
+ *             }\r
+ *     }\r
+ *\r
+ *     if ( test_mail_data->meeting_request_status == EMF_MAIL_TYPE_MEETING_REQUEST\r
+ *             || test_mail_data->meeting_request_status == EMF_MAIL_TYPE_MEETING_RESPONSE\r
+ *             || test_mail_data->meeting_request_status == EMF_MAIL_TYPE_MEETING_ORIGINATINGREQUEST) {\r
+ *\r
+ *             if ( (err = email_get_meeting_request(mail_id, &meeting_req)) != EMF_ERROR_NONE ) {\r
+ *                     printf("email_get_meeting_request() failed [%d]\n", err);\r
+ *                     return -1;\r
+ *             }\r
+ *\r
+ *             printf("\n > Enter meeting response: ");\r
+ *             scanf("%d", (int*)&(meeting_req->meeting_response));\r
+ *     }\r
+ *\r
+ *     if ( (err = email_update_mail(test_mail_data, test_attachment_data_list, test_attachment_data_count, meeting_req, 0)) != EMF_ERROR_NONE)\r
+ *                     printf("email_update_mail failed.[%d]\n", err);\r
+ *             else\r
+ *                     printf("email_update_mail success\n");\r
+ *\r
+ *     if(test_mail_data)\r
+ *             email_free_mail_data(&test_mail_data, 1);\r
+ *\r
+ *     if(test_attachment_data_list)\r
+ *             email_free_attachment_data(&test_attachment_data_list, test_attachment_data_count);\r
+ *\r
+ *     if(meeting_req)\r
+ *             email_free_meeting_request(&meeting_req, 1);\r
+ *\r
+ *     return 0;\r
+ * }\r
+\r
+ * @endcode\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_update_mail(emf_mail_data_t *input_mail_data, emf_attachment_data_t *input_attachment_data_list, int input_attachment_count, emf_meeting_request_t* input_meeting_request, int input_from_eas);\r
+\r
+/**\r
+ * @open\r
+ * @fn email_count_message(emf_mailbox_t* mailbox, int* total, int* unseen)\r
+ * @brief      Get mail count from mailbox.This function is invoked when user wants to know how many toatl mails and out of that\r
+ *             how many unseen mails are there in a given mailbox.\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] mailbox  Specifies the pointer of mailbox structure.\r
+ * @param[out] total   Total email count is saved here.\r
+ * @param[out] unseen  Unread email count is saved here.\r
+ * @exception  none\r
+ * @see        emf_mailbox_t\r
+\r
+ * @code\r
+ *     #include "email-api-account.h"\r
+ *     bool\r
+ *     _api_sample_count_message()\r
+ *     {\r
+ *             emf_mailbox_t mailbox;\r
+ *             int account_id = 0;\r
+ *             int total = 0;\r
+ *             int unseen = 0;\r
+ *\r
+ *             memset(&mailbox, 0x00, sizeof(emf_mailbox_t));\r
+ *             printf("\n > Enter account_id (0 means all accounts) : ");\r
+ *             scanf("%d", &account_id);\r
+ *             if(account_id == 0)\r
+ *             {\r
+ *                     mailbox.name = NULL;\r
+ *             }\r
+ *             else\r
+ *             {\r
+ *                     printf("\n > Enter maibox name: ");\r
+ *                     mailbox.name = strdup("SENTBOX");\r
+ *             }\r
+ *             mailbox.account_id = account_id;\r
+ *             if(EMF_ERROR_NONE == email_count_message(&mailbox, &total, &unseen))\r
+ *                     printf("\n Total: %d, Unseen: %d \n", total, unseen);\r
+ *     }\r
+ * @endcode\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int  email_count_message(emf_mailbox_t* mailbox, int* total, int* unseen);\r
+\r
+\r
+/**\r
+ * @open\r
+ * @fn         email_delete_message(emf_mailbox_t* mailbox, int *mail_ids, int num, int from_server)\r
+ * @brief      Delete a mail or multiple mails.Based on from_server value this function will delte a mail or multiple mails from server or loaclly.\r
+ * @param[in] mailbox                  Reserved.\r
+ *             If the receiving_server_type is EMF_SERVER_TYPE_POP3 then from_server value will be 0\r
+ *             If the receiving_server_type is EMF_SERVER_TYPE_IMAP4 then from_server value will be 1/0\r
+ *\r
+ * @param[in] mail_ids[]                               Specifies the arrary of mail id.\r
+ * @param[in] num                                      Specifies the number of mail id.\r
+ * @param[in] from_server      Specifies whether mails are deleted from server.\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @exception          none\r
+ * @see                emf_mailbox_t\r
+ * @code\r
+ *     #include "email-api-account.h"\r
+ *     bool\r
+ *     _api_sample_delete_all_messages_in_mailbox()\r
+ *     {\r
+ *             int count, i, mail_id=0, account_id =0;\r
+ *             emf_mailbox_t mbox = {0};\r
+ *\r
+ *             printf("\n > Enter Account_id: ");\r
+ *             scanf("%d",&account_id);\r
+ *             printf("\n > Enter Mail_id: ");\r
+ *             scanf("%d",&mail_id);\r
+ *             printf("\n > Enter Mailbox name: ");\r
+ *             mbox.account_id = account_id;\r
+ *             mbox.name = strdup("INBOX");\r
+ *             if(EMF_ERROR_NONE == email_delete_message(&mbox, &mail_id, 1, 1))\r
+ *                     printf("\n email_delete_message success");\r
+ *             else\r
+ *                     printf("\n email_delete_message failed");\r
+ *     }\r
+ * @endcode\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_delete_message(emf_mailbox_t* mailbox, int *mail_ids, int num, int from_server);\r
+\r
+\r
+/**\r
+ * @open\r
+ * @fn email_delete_all_message_in_mailbox(emf_mailbox_t* mailbox, int from_server)\r
+ * @brief      Delete all mail from a mailbox.\r
+ *             If the receiving_server_type is EMF_SERVER_TYPE_POP3 then from_server value will be 0\r
+ *             If the receiving_server_type is EMF_SERVER_TYPE_IMAP4 then from_server value will be 1/0\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] mailbox                  Specifies the structure of mailbox.\r
+ * @param[in] from_server              Specifies whether mails are also deleted from server.\r
+ * @exception          none\r
+ * @see                emf_mailbox_t\r
+\r
+ * @code\r
+ *     #include "email-api-account.h"\r
+ *     bool\r
+ *     _api_sample_delete_all_messages_in_mailbox()\r
+ *     {\r
+ *             int count,  account_id =0;\r
+ *             emf_mailbox_t mbox = {0};\r
+ *\r
+ *             printf("\n > Enter Account_id: ");\r
+ *             scanf("%d",&account_id);\r
+ *             printf("\n > Enter Mailbox name: ");\r
+ *             mbox.account_id = account_id;\r
+ *             mbox.name = strdup("INBOX");\r
+ *\r
+ *             if (EMF_ERROR_NONE != email_delete_all_message_in_mailbox(&mbox, 0))\r
+ *                     printf("email_delete_all_message_in_mailbox failed");\r
+ *             else\r
+ *             printf("email_delete_all_message_in_mailbox Success");\r
+ *     }\r
+ * @endcode\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_delete_all_message_in_mailbox(emf_mailbox_t* mailbox, int from_server);\r
+\r
+\r
+\r
+/**\r
+ * @open\r
+ *  @fn email_clear_mail_data()\r
+ * @brief      delete email data from storage. This API will be used by the Settings Application\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @exception          none\r
+ * @see                none\r
+\r
+ * @code\r
+ *     #include "email-api-account.h"\r
+ *     bool\r
+ *     _api_sample_clear_mail_data()\r
+ *     {\r
+ *             if(EMF_ERROR_NONE == email_clear_mail_data())\r
+ *                     //success\r
+ *             else\r
+ *                     //failure\r
+ *\r
+ *     }\r
+ * @endcode\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int  email_clear_mail_data();\r
+\r
+\r
+/**\r
+ * @open\r
+ * @fn email_add_attachment( emf_mailbox_t* mailbox, int mail_id, emf_attachment_info_t* attachment)\r
+ * @brief      Append a attachment to email.This function is invoked when user wants to add attachment to existing mail.\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] mail_id          Specifies the mail ID.\r
+ * @param[in] attachment       Specifies the structure of attachment.\r
+ * @exception          none\r
+ * @see                emf_mailbox_t and emf_attachment_info_t\r
+\r
+ * @code\r
+ *     #include "email-api-account.h"\r
+ *     bool\r
+ *     _api_sample_mail_add_attachment()\r
+ *     {\r
+ *             int account_id = 0;\r
+ *             int mail_id = 0;\r
+ *             emf_mailbox_t mbox;\r
+ *             emf_attachment_info_t attachment;\r
+ *\r
+ *             printf("\n > Enter Mail Id: ");\r
+ *             scanf("%d", &mail_id);\r
+ *             printf("\n > Enter Account_id: ");\r
+ *             scanf("%d",&account_id);\r
+ *             memset(&mbox, 0x00, sizeof(emf_attachment_info_t));\r
+ *             mbox.account_id = account_id;\r
+ *             mbox.name = strdup("INBOX");\r
+ *             memset(&attachment, 0x00, sizeof(emf_attachment_info_t));\r
+ *             printf("\n > Enter attachment name: ");\r
+ *             attachment.name = strdup("Test");\r
+ *             printf("\n > Enter attachment absolute path: ");\r
+ *             attachment.savename = strdup("/tmp/test.txt");\r
+ *             attachment.next = NULL;\r
+ *             if(EMF_ERROR_NONE != email_add_attachment( &mbox, mail_id, &attachment))\r
+ *                     printf("email_add_attachment failed\n");\r
+ *             else\r
+ *                     printf(email_add_attachment success\n");\r
+ *     }\r
+ * @endcode\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_add_attachment( emf_mailbox_t* mailbox, int mail_id, emf_attachment_info_t* attachment);\r
+\r
+\r
+/**\r
+ * @open\r
+ * @fn email_delete_attachment(emf_mailbox_t * mailbox, int mail_id, const char * attachment_id)\r
+ * @brief      delete a attachment from email.This function is invoked when user wants to delete a attachment from existing mailbased on mail Id and attachment Id\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] mailbox                  Specifies the structure of mailbox.\r
+ * @param[in] mail_id                  Specifies the mail ID.\r
+ * @param[in] attachment_id            Specifies the attachment id.\r
+ * @exception          none\r
+ * @see                emf_mailbox_t\r
+ * @code\r
+ *     #include "email-api-account.h"\r
+ *     bool\r
+ *     _api_sample_mail_delete_attachment()\r
+ *     {\r
+ *             int account_id = 0;\r
+ *             int mail_id = 0;\r
+ *             char *attchment_id;\r
+ *             emf_mailbox_t mbox;\r
+ *\r
+ *             mail_id = 1;                                                            // mail id in the DB\r
+ *             mbox.account_id = 1;                                            // account id in the DB\r
+ *             mbox.name = strdup("INBOX");                    // mailbox name\r
+ *             attachment_id = strdup("1");                            // the first attachment item in a attachment list\r
+ *\r
+ *             if(EMF_ERROR_NONE != email_delete_attachment(&mbox,mail_id,attachment_id))\r
+ *                     //failure\r
+ *             else\r
+ *                     //success\r
+ *     }\r
+ * @endcode\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_delete_attachment(emf_mailbox_t * mailbox, int mail_id, const char *attachment_id);\r
+\r
+\r
+/* -----------------------------------------------------------\r
+                       Mail Search API\r
+   -----------------------------------------------------------*/\r
+\r
+/**\r
+ * @open\r
+ * @fn email_query_mails(char *conditional_clause_string, emf_mail_data_t** mail_list,  int *result_count)\r
+ * @brief                          Query the mail list information from DB based on the mailbox name.\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] conditional_clause_string  Specifies the where clause string.\r
+ * @param[in/out] mail_list        Specifies the pointer to the structure emf_mail_data_t.\r
+ * @param[in/out] result_count     Specifies the number of mails returned.\r
+ * @exception                      None\r
+ * @see                            emf_mail_list_item_t\r
+\r
+ * @code\r
+ *     #include "email-api-account.h"\r
+ *     bool\r
+ *     _api_sample_query_mail()\r
+ *     {\r
+ *             emf_mail_data_t *mail_list = NULL;\r
+ *             char conditional_clause_string[500];\r
+ *             int result_count = 0;\r
+ *\r
+ *             memset(mailbox_name, 0x00, 10);\r
+ *             printf("\n > Enter where clause: ");\r
+ *             scanf("%s", conditional_clause_string);\r
+ *\r
+ *\r
+ *             if (EMF_ERROR_NONE != email_query_mails(conditional_clause_string, &mail_list, &result_count))\r
+ *                     printf("email_query_message_ex failed \n");\r
+ *             else {\r
+ *                     printf("Success\n");\r
+ *                     //do something\r
+ *                     free(mail_list);\r
+ *             }\r
+ *\r
+ *     }\r
+ * @endcode\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_query_mails(char *conditional_clause_string, emf_mail_data_t** mail_list,  int *result_count);\r
+\r
+/**\r
+ * @open\r
+ * @fn email_query_message_ex(char *conditional_clause_string, emf_mail_list_item_t** mail_list,  int *result_count)\r
+ * @brief                          Query the mail list information from DB based on the mailbox name.\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] conditional_clause_string  Specifies the where clause string.\r
+ * @param[in/out] mail_list        Specifies the pointer to the structure emf_mail_list_item_t.\r
+ * @param[in/out] result_count     Specifies the number of mails returned.\r
+ * @exception                      None\r
+ * @see                            emf_mail_list_item_t\r
+\r
+ * @code\r
+ *     #include "email-api-account.h"\r
+ *     bool\r
+ *     _api_sample_query_mail()\r
+ *     {\r
+ *             emf_mail_list_item_t *mail_list = NULL;\r
+ *             char conditional_clause_string[500];\r
+ *             int result_count = 0;\r
+ *\r
+ *             memset(mailbox_name, 0x00, 10);\r
+ *             printf("\n > Enter where clause: ");\r
+ *             scanf("%s", conditional_clause_string);\r
+ *\r
+ *\r
+ *             if (EMF_ERROR_NONE != email_query_message_ex(conditional_clause_string, &mail_list, &result_count))\r
+ *                     printf("email_query_message_ex failed \n");\r
+ *             else {\r
+ *                     printf("Success\n");\r
+ *                     //do something\r
+ *                     free(mail_list);\r
+ *             }\r
+ *\r
+ *     }\r
+ * @endcode\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_query_message_ex(char *conditional_clause_string, emf_mail_list_item_t** mail_list,  int *result_count);\r
+\r
+\r
+/**\r
+ * @open\r
+ * @fn email_get_attachment_info(emf_mailbox_t* mailbox, int mail_id, const char* attachment_id, emf_attachment_info_t** attachment)\r
+ * @brief      Get a mail attachment.This function is invoked when user wants to get the attachment information based on attachment id for the specified mail Id.\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] mailbox          Reserved.\r
+ * @param[in] mail_id          Specifies the mail ID.\r
+ * @param[in] attachment_id    Specifies the buffer that a attachment ID been saved.\r
+ * @param[out] attachment      The returned attachment is save here.\r
+ * @exception          none\r
+ * @see                emf_mailbox_t and emf_mail_attachment_info_t\r
+\r
+ * @code\r
+ *     #include "email-api-account.h"\r
+ *     bool\r
+ *     _api_sample_mail_get_attachment_info()\r
+ *     {\r
+ *             emf_mailbox_t mailbox;\r
+ *             emf_mail_attachment_info_t *mail_attach_info = NULL;\r
+ *             int mail_id = 0,account_id = 0;\r
+ *             char arg[10];\r
+ *             int err = EMF_ERROR_NONE;\r
+ *\r
+ *             memset(&mailbox, 0x00, sizeof(emf_mailbox_t));\r
+ *\r
+ *             printf("\n > Enter Mail Id: ");\r
+ *             scanf("%d", &mail_id);\r
+ *             printf("\n > Enter account Id: ");\r
+ *             scanf("%d", &account_id);\r
+ *             printf("> attachment Id\n");\r
+ *             scanf("%s",arg);\r
+ *             mailbox.account_id = account_id;\r
+ *             if (EMF_ERROR_NONE != email_get_attachment_info(&mailbox, mail_id, &mail_attach_info))\r
+ *                     printf("email_get_attachment_info failed\n");\r
+ *             else\r
+ *             {\r
+ *                     printf("email_get_attachment_info SUCCESS\n");\r
+ *                     //do something\r
+ *                     email_free_attachment_info(&mail_attach_info,1);\r
+ *             }\r
+ *     }\r
+ * @endcode\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_get_attachment_info(emf_mailbox_t* mailbox, int mail_id, const char* attachment_id, emf_attachment_info_t** attachment);\r
+\r
+EXPORT_API int email_get_attachment_data_list(int input_mail_id, emf_attachment_data_t **output_attachment_data, int *output_attachment_count);\r
+\r
+/**\r
+ * @open\r
+ * @fn email_free_attachment_info(emf_attachment_info_t** atch_info)\r
+ * @brief      Free allocated memroy for email attachment.\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] atch_info        Specifies the pointer of mail attachment structure pointer.\r
+ * @exception          none\r
+ * @see                emf_mail_attachment_info_t\r
+\r
+ * @code\r
+ *     #include "email-api-account.h"\r
+ *     bool\r
+ *     _api_sample_mail_free_attachment_info()\r
+ *     {\r
+ *             emf_mailbox_t mailbox;\r
+ *             emf_mail_attachment_info_t *mail_attach_info = NULL;\r
+ *             int mail_id = 0,account_id = 0;\r
+ *             char arg[10];\r
+ *             int err = EMF_ERROR_NONE;\r
+ *\r
+ *             memset(&mailbox, 0x00, sizeof(emf_mailbox_t));\r
+ *\r
+ *             printf("\n > Enter Mail Id: ");\r
+ *             scanf("%d", &mail_id);\r
+ *             printf("\n > Enter account Id: ");\r
+ *             scanf("%d", &account_id);\r
+ *             printf("> attachment Id\n");\r
+ *             scanf("%s",arg);\r
+ *             mailbox.account_id = account_id;\r
+ *             if (EMF_ERROR_NONE != email_get_attachment_info(&mailbox, mail_id, &mail_attach_info))\r
+ *                     printf("email_get_attachment_info failed\n");\r
+ *             else\r
+ *             {\r
+ *                     printf("email_get_attachment_info SUCCESS\n");\r
+ *                     //do something\r
+ *                     email_free_attachment_info(&mail_attach_info,1);\r
+ *             }\r
+ *     }\r
+ * @endcode\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_free_attachment_info(emf_attachment_info_t** atch_info);\r
+\r
+EXPORT_API int email_free_attachment_data(emf_attachment_data_t **attachment_data_list, int attachment_data_count);\r
+\r
+/**\r
+ * @open\r
+ * @fn email_get_mail_data(int input_mail_id, emf_mail_data_t **output_mail_data)\r
+ * @brief      Get a mail by its mail id. This function is invoked when user wants to get a mail based on mail id existing in DB.\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] input_mail_id    specifies the mail id.\r
+ * @param[out] output_mail_data                The returned mail is save here.\r
+ * @exception          none\r
+ * @see        emf_mail_data_t\r
+\r
+ * @code\r
+ *    #include "email-api-account.h"\r
+ *     bool\r
+ *     _api_sample_get_mail_data()\r
+ *     {\r
+ *             emf_mail_data_t *mail = NULL;\r
+ *             int mail_id = 0 ;\r
+ *             int err = EMF_ERROR_NONE;\r
+ *\r
+ *             printf("\n > Enter mail id: ");\r
+ *             scanf("%d", &mail_id);\r
+ *\r
+ *             if (EMF_ERROR_NONE != email_get_mail_data(mail_id, &mail))\r
+ *                     printf("email_get_mail_data failed\n");\r
+ *             else\r
+ *             {\r
+ *                     printf("email_get_mail_data SUCCESS\n");\r
+ *                     //do something\r
+ *                     email_free_mail_data(&mail,1);\r
+ *             }\r
+ *     }\r
+ * @endcode\r
+ * @remarks N/A\r
+ */\r
+\r
+EXPORT_API int email_get_mail_data(int input_mail_id, emf_mail_data_t **output_mail_data);\r
+\r
+\r
+/* -----------------------------------------------------------\r
+                                             Mail Flag API\r
+    -----------------------------------------------------------*/\r
+\r
+/**\r
+ * @open\r
+ * @fn email_modify_mail_flag(int mail_id, emf_mail_flag_t new_flag, int onserver)\r
+ * @brief      Change email flag.[ Seen,Deleted,flagged,answered,recent,draft,has_attachment,reserved_1]\r
+ *             If the receiving_server_type is EMF_SERVER_TYPE_POP3 then from_server value will be 0\r
+ *                     If the receiving_server_type is EMF_SERVER_TYPE_IMAP4 then from_server value will be 1/0\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] mail_id  Specifies the mail ID.\r
+ * @param[in] new_flag Specifies the new email flag.\r
+ * @param[in] onserver Specifies whether mail Flag updation in server\r
+ * @exception          none\r
+ * @see                emf_mail_flag_t\r
+\r
+ * @code\r
+ *     #include "email-api-account.h"\r
+ *     bool\r
+ *     _api_sample_modify_mail_flag()\r
+ *     {\r
+ *             emf_mail_flag_t newflag;\r
+ *             int mail_id = 0;\r
+ *             int err = EMF_ERROR_NONE;\r
+ *\r
+ *             memset(&newflag, 0x00, sizeof(emf_mail_flag_t));\r
+ *             newflag.seen = 1;\r
+ *             newflag.answered = 0;\r
+ *             newflag.sticky = 1;\r
+ *\r
+ *             printf("\n > Enter Mail Id: ");\r
+ *             scanf("%d", &mail_id);\r
+ *             if (EMF_ERROR_NONE != email_modify_mail_flag(mail_id, newflag, 1))\r
+ *                     printf("email_modify_mail_flag failed\n");\r
+ *             else\r
+ *             {\r
+ *                     printf("email_modify_mail_flag SUCCESS\n");\r
+ *                     //do something\r
+ *\r
+ *             }\r
+ *     }\r
+ * @endcode\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_modify_mail_flag(int mail_id, emf_mail_flag_t new_flag, int onserver);\r
+\r
+/**\r
+ * @open\r
+ * @fn email_set_flags_field(int *mail_ids, int num, emf_flags_field_type field_type, int value, int onserver)\r
+ * @brief      Change email flags field.\r
+ *             If the receiving_server_type is EMF_SERVER_TYPE_POP3 then from_server value will be 0\r
+ *                     If the receiving_server_type is EMF_SERVER_TYPE_IMAP4 then from_server value will be 1/0\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] account_id  Specifies account ID.\r
+ * @param[in] mail_ids         Specifies the array of mail ID.\r
+ * @param[in] num              Specifies the number of mail ID.\r
+ * @param[in] field_type  Specifies the field type what you want to set. Refer emf_flags_field_type.\r
+ * @param[in] value          Specifies the value what you want to set.\r
+ * @param[in] onserver         Specifies whether mail Flag updation in server\r
+ * @exception          none\r
+ * @see                none\r
+ * @code\r
+ *     #include "email-api-account.h"\r
+ *     bool\r
+ *     _api_sample_set_flags_field()\r
+ *     {\r
+ *             int mail_id = 0;\r
+ *             int err = EMF_ERROR_NONE;\r
+ *\r
+ *             printf("\n > Enter Mail Id: ");\r
+ *             scanf("%d", &mail_id);\r
+ *             if (EMF_ERROR_NONE != email_set_flags_field(&mail_id, EMFF_LAGS_SEEN_FIELD, 1, 0))\r
+ *                     printf("email_set_flags_field failed\n");\r
+ *             else\r
+ *             {\r
+ *                     printf("email_set_flags_field SUCCESS\n");\r
+ *                     //do something\r
+ *             }\r
+ *     }\r
+ * @endcode\r
+ * @remarks N/A\r
+ */\r
+\r
+EXPORT_API int email_set_flags_field(int account_id, int *mail_ids, int num, emf_flags_field_type field_type, int value, int onserver);\r
+\r
+/**\r
+ * @open\r
+ * @fn email_modify_extra_mail_flag(int mail_id, emf_extra_flag_t new_flag)\r
+ * @brief      Change email extra flag.[priority,Delivery report status, Drm, Protection etc]\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] mail_id  Specifies the mail ID.\r
+ * @param[in] new_flag Specifies the new email extra flag.\r
+ * @exception          none\r
+ * @see                emf_extra_flag_t\r
+\r
+ * @code\r
+ *     #include "email-api-account.h"\r
+ *     bool\r
+ *     _api_sample_modify_extra_mail_flag()\r
+ *     {\r
+ *             emf_extra_flag_t newflag;\r
+ *             int mail_id = 0;\r
+ *             int err = EMF_ERROR_NONE;\r
+ *\r
+ *             memset(&newflag, 0x00, sizeof(emf_extra_flag_t));\r
+ *\r
+ *             printf("\n > Enter Mail Id: ");\r
+ *             scanf("%d", &mail_id);\r
+ *\r
+ *             if(EMF_ERROR_NONE !=  email_modify_extra_mail_flag(mail_id, newflag))\r
+ *                     printf("email_modify_extra_mail_flag failed");\r
+ *             else\r
+ *                     printf("email_modify_extra_mail_flag success");\r
+ *\r
+ *     }\r
+ * @endcode\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_modify_extra_mail_flag(int mail_id, emf_extra_flag_t new_flag);\r
+\r
+\r
+\r
+/* -----------------------------------------------------------\r
+                                             Mail Move API\r
+    -----------------------------------------------------------*/\r
+\r
+/**\r
+ * @open\r
+ * @fn email_move_mail_to_mailbox(int *mail_ids, int num, emf_mailbox_t* new_mailbox)\r
+ * @brief      Move a email to another mailbox.\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] mail_id          Specifies the array of mail ID.\r
+ * @param[in] num                      Specifies the count of mail IDs.\r
+ * @param[in] new_mailbox      Specifies the mailbox structure for moving email.\r
+ * @exception          none\r
+ * @see                emf_mailbox_t\r
+\r
+ * @code\r
+ *     #include "email-api-account.h"\r
+ *     bool\r
+ *     _api_sample_move_mail_to_mailbox()\r
+ *     {\r
+ *             int mail_id = 1;\r
+ *             int account_id =0;\r
+ *             emf_mailbox_t mbox;\r
+ *             char arg[10];\r
+ *             int err = EMF_ERROR_NONE;\r
+ *             int i = 0;\r
+ *\r
+ *             printf("\n > Enter Account_id: ");\r
+ *             scanf("%d",&account_id);\r
+ *\r
+ *             memset(&mbox, 0x00, sizeof(emf_mailbox_t));\r
+ *\r
+ *             mbox.account_id = account_id;\r
+ *             mbox.name = strdup("Test");\r
+ *             if(EMF_ERROR_NONE == email_move_mail_to_mailbox(mail_id,        1, &mbox))\r
+ *                     printf("Success\n");\r
+ *\r
+ *     }\r
+ * @endcode\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_move_mail_to_mailbox(int *mail_ids, int num, emf_mailbox_t* new_mailbox);\r
+\r
+\r
+/**\r
+ * @open\r
+ * @fn email_move_all_mails_to_mailbox(emf_mailbox_t* src_mailbox, emf_mailbox_t* new_mailbox)\r
+ * @brief      Move all email to another mailbox.\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] src_mailbox      Specifies the source mailbox structure for moving email.\r
+ * @param[in] new_mailbox      Specifies the destination mailbox structure for moving email.\r
+ * @exception          none\r
+ * @see                emf_mailbox_t\r
+\r
+ * @code\r
+ *     #include "email-api-account.h"\r
+ *     bool\r
+ *     _api_sample_move_all_mails_to_mailbox()\r
+ *     {\r
+ *             emf_mailbox_t src_mailbox;\r
+ *             emf_mailbox_t dest_mailbox;\r
+ *             int total_count;\r
+ *             int err = EMF_ERROR_NONE;\r
+ *             char temp[128];\r
+ *\r
+ *             memset(&src_mailbox, 0x00, sizeof(emf_mailbox_t));\r
+ *             memset(&dest_mailbox, 0x00, sizeof(emf_mailbox_t));\r
+ *\r
+ *             // input mailbox information : need  account_id and name (src & dest)\r
+ *             printf("src mail account id(0: All account)> ");\r
+ *             scanf("%d", &src_mailbox.account_id);\r
+ *             printf("src mailbox_name(0 : NULL)> ");\r
+ *             src_mailbox = strdup("INBOX");\r
+ *             // Destination mailbox\r
+ *             printf("dest mail account id> ");\r
+ *             scanf("%d", &dest_mailbox.account_id);\r
+ *             printf("dest_mailbox_name(0 : NULL)> ");\r
+ *             dest_mailbox = strdup("INBOX");\r
+ *\r
+ *             ( EMF_ERROR_NONE == email_move_all_mails_to_mailbox(&src_mailbox, &dest_mailbox))\r
+ *             {\r
+ *                     printf("  fail email_move_all_mails_to_mailbox: \n");\r
+ *             }\r
+ *             else\r
+ *                     //success\r
+ *     if ( src_mailbox)\r
+ *     {\r
+ *             free(src_mailbox);\r
+ *     }\r
+ *     if ( dest_mailbox )\r
+ *     {\r
+ *             free(dest_mailbox);\r
+ *     }\r
+ * }\r
+ * @endcode\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_move_all_mails_to_mailbox(emf_mailbox_t* src_mailbox, emf_mailbox_t* new_mailbox);\r
+\r
+\r
+/**\r
+ * @open\r
+ * @fn email_count_message_with_draft_flag(emf_mailbox_t* mailbox, int* total)\r
+ * @brief      Get mail count from mailbox having draft flag.\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] mailbox          Specifies the pointer of mailbox structure.\r
+ * @param[out] total           Total email count is saved with draft flag enabled.\r
+ * @exception          none\r
+ * @see                emf_mailbox_t\r
+\r
+ * @code\r
+ *     #include "email-api-account.h"\r
+ *     bool\r
+ *     _api_sample_count_message_with_draft_flag()\r
+ *     {\r
+ *             emf_mailbox_t mailbox;\r
+ *             int total_count;\r
+ *             int err = EMF_ERROR_NONE;\r
+ *\r
+ *             memset(&mailbox, 0x00, sizeof(emf_mailbox_t));\r
+ *             // input mailbox information : need account_id and name\r
+ *             printf("mail account id(0: All account)> ");\r
+ *             scanf("%d", &mailbox.account_id);\r
+ *             mailbox.name = strdup("Inbox");\r
+ *             if ( EMF_ERROR_NONE != email_count_message_with_draft_flag(&mailbox, &total_count))\r
+ *             {\r
+ *                     printf("  fail email_count_message_with_draft_flag:\n);\r
+ *             }\r
+ *             else\r
+ *             {\r
+ *                     printf("  success email_count_message_with_draft_flag:\n);\r
+ *             }\r
+ *             if ( mailbox.name )\r
+ *             {\r
+ *                     free(mailbox.name);\r
+ *             }\r
+ *     }\r
+ * @endcode\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_count_message_with_draft_flag(emf_mailbox_t* mailbox, int* total);\r
+\r
+\r
+/**\r
+ * @open\r
+ * @fn email_count_message_on_sending(emf_mailbox_t* mailbox, int* total)\r
+ * @brief      Get the number of mails which are being sent in specific mailbox.This function gives the list of mails having on sending status for a given mailbox.\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] mailbox          Specifies the pointer of mailbox structure.\r
+ * @param[out] total           Total email count is saved with draft flag enabled.\r
+ * @exception          none\r
+ * @see                emf_mailbox_t\r
+\r
+ * @code\r
+ *     #include "email-api-account.h"\r
+ *     bool\r
+ *     _api_sample_count_message_on_sending()\r
+ *     {\r
+ *             emf_mailbox_t mailbox;\r
+ *             int total_count;\r
+ *             int err = EMF_ERROR_NONE;\r
+ *\r
+ *             memset(&mailbox, 0x00, sizeof(emf_mailbox_t));\r
+ *             // input mailbox information : need account_id and name\r
+ *             printf("mail account id(0: All account)> ");\r
+ *             scanf("%d", &mailbox.account_id);\r
+ *             mailbox.name = strdup("Draft");\r
+ *             if (EMF_ERROR_NONE != email_count_message_on_sending(&mailbox, &total_count))\r
+ *             {\r
+ *                     printf("  fail email_count_message_on_sending: \n");\r
+ *             }\r
+ *             else\r
+ *             {\r
+ *                     printf("  success email_count_message_on_sending:\n");\r
+ *             }\r
+ *             if ( mailbox.name )\r
+ *             {\r
+ *                     free(mailbox.name);\r
+ *             }\r
+ *     }\r
+ * @endcode\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_count_message_on_sending(emf_mailbox_t* mailbox, int* total);\r
+\r
+/**\r
+ * @open\r
+ * @fn email_free_mail_data(emf_mail_data_t** mail_list, int count)\r
+ * @brief      Free allocated memroy for emails.\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] mail_list        Specifies the pointer of mail structure pointer.\r
+ * @param[in] count            Specifies the count of mails.\r
+ * @exception          none\r
+ * @see                 emf_mail_data_t\r
+\r
+ * @code\r
+ *     #include "email-api-account.h"\r
+ *     bool\r
+ *     _api_sample_free_mail()\r
+ *     {\r
+ *             emf_mail_data_t *mail;\r
+ *\r
+ *             //fill the mail structure\r
+ *             //count - number of mail structure user want to free\r
+ *              if(EMF_ERROR_NONE == email_free_mail_data(&mail,count))\r
+ *                     //success\r
+ *              else\r
+ *                     //failure\r
+ *\r
+ *     }\r
+ * @endcode\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_free_mail_data(emf_mail_data_t** mail_list, int count);\r
+\r
+/**\r
+ * @open\r
+ * @fn email_get_mails(int account_id , const char *mailbox_name, int thread_id, int start_index, int limit_count, emf_sort_type_t sorting, emf_mail_data_t** mail_list,  int* result_count)\r
+ * @brief      Get the Mail List information from DB based on the mailbox name.\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] account_id               Specifies the account ID\r
+ * @param[in] mailbox_name             Specifies the mailbox name\r
+ * @param[in] thread_id                Specifies the thread id. It can be EMF_LIST_TYPE_THREAD, EMF_LIST_TYPE_NORMAL or thread id.\r
+ * @param[in] start_index      Specifies start index for LIMIT clause of SQL query.\r
+ * @param[in] limit_count      Specifies limit count for LIMIT clause of SQL query.\r
+ * @param[in] sorting          Specifies the sorting type.\r
+ * @param[in/out] mail_list            Specifies the pointer to the structure emf_mail_data_t.\r
+ * @param[in/out] result_count Specifies the number of mails returned.\r
+ * @exception          none\r
+ * @see                 emf_mail_data_t\r
+\r
+ * @code\r
+ *    #include "email-api-account.h"\r
+ *     bool\r
+ *     _api_sample_get_mail()\r
+ *     {\r
+ *             emf_mail_data_t *mail_list = NULL;\r
+ *             char mailbox_name[50];\r
+ *             int result_count = 0;\r
+ *             int account_id = 0;\r
+ *             int err_code = EMF_ERROR_NONE;\r
+ *\r
+ *             memset(mailbox_name, 0x00, 10);\r
+ *             printf("\n > Enter Mailbox name: ");\r
+ *             scanf("%s", mailbox_name);\r
+ *\r
+ *             printf("\n > Enter Account_id: ");\r
+ *             scanf("%d",&account_id);\r
+ *\r
+ *             if (EMF_ERROR_NONE != email_get_mails(account_id, mailbox_name, EMF_LIST_TYPE_NORMAL, 0, 100, EMF_SORT_DATETIME_HIGH,  &mail_list, &result_count)) {\r
+ *                     printf("email_get_mails failed \n");\r
+ *             }\r
+ *             else {\r
+ *                     printf("Success\n");\r
+ *                     //do something\r
+ *                     free(mail_list);\r
+ *             }\r
+ *\r
+ *     }\r
+ * @endcode\r
+ * @remarks N/A\r
+ */\r
+\r
+EXPORT_API int email_get_mails(int account_id , const char *mailbox_name, int thread_id, int start_index, int limit_count, emf_sort_type_t sorting, emf_mail_data_t** mail_list,  int* result_count);\r
+\r
+/**\r
+ * @open\r
+ * @fn email_get_mail_list_ex(int account_id , const char *mailbox_name, int thread_id, int start_index, int limit_count, emf_sort_type_t sorting, emf_mail_list_item_t** mail_list,  int* result_count)\r
+ * @brief      Get the Mail List information from DB based on the mailbox name.\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] account_id               Specifies the account ID\r
+ * @param[in] mailbox_name             Specifies the mailbox name\r
+ * @param[in] thread_id                Specifies the thread id. It can be EMF_LIST_TYPE_THREAD, EMF_LIST_TYPE_NORMAL or thread id.\r
+ * @param[in] start_index      Specifies start index for LIMIT clause of SQL query.\r
+ * @param[in] limit_count      Specifies limit count for LIMIT clause of SQL query.\r
+ * @param[in] sorting          Specifies the sorting type.\r
+ * @param[in/out] mail_list            Specifies the pointer to the structure emf_mail_list_item_t.\r
+ * @param[in/out] result_count Specifies the number of mails returned.\r
+ * @exception          none\r
+ * @see                 emf_mail_list_item_t\r
+\r
+ * @code\r
+ *     #include "email-api-account.h"\r
+ *     bool\r
+ *     _api_sample_get_mail()\r
+ *     {\r
+ *             emf_mail_list_item_t *mail_list = NULL;\r
+ *             char mailbox_name[50];\r
+ *             int result_count = 0;\r
+ *             int account_id = 0;\r
+ *             int err_code = EMF_ERROR_NONE;\r
+ *\r
+ *             memset(mailbox_name, 0x00, 10);\r
+ *             printf("\n > Enter Mailbox name: ");\r
+ *             scanf("%s", mailbox_name);\r
+ *\r
+ *             printf("\n > Enter Account_id: ");\r
+ *             scanf("%d",&account_id);\r
+ *\r
+ *             if (EMF_ERROR_NONE != email_get_mail_list_ex(account_id, mailbox_name, EMF_LIST_TYPE_NORMAL, 0, 100, EMF_SORT_DATETIME_HIGH,  &mail_list, &result_count))\r
+ *             {\r
+ *                     printf("email_get_mail_list failed \n");\r
+ *             }\r
+ *             else\r
+ *             {\r
+ *                     printf("Success\n");\r
+ *                     //do something\r
+ *                     free(mail_list);\r
+ *             }\r
+ *\r
+ *     }\r
+ * @endcode\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_get_mail_list_ex(int account_id , const char *mailbox_name, int thread_id, int start_index, int limit_count, emf_sort_type_t sorting, emf_mail_list_item_t** mail_list,  int* result_count);\r
+\r
+/**\r
+ * @open\r
+ * @fn email_find_mail(int account_id , const char *mailbox_name, int thread_id,\r
+       int search_type, char *search_value, int start_index, int limit_count, emf_sort_type_t sorting, emf_mail_list_item_t** mail_list,  int* result_count)\r
+ * @brief      Get the Searched Mail List information from the DB based on the mailbox name account_id, type and value of searching.\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] account_id       Specifies the Account ID\r
+ * @param[in] mailbox_name     Specifies the Mailbox Name\r
+ * @param[in] thread_id        Specifies the thread_id. If thread_id = EMF_LIST_TYPE_NORMAL, search a mail without regarding thread. The case of thread_id > 0 is for  getting mail list of specific thread.\r
+ * @param[in] search_type      Specifies the searching type(EMF_SEARCH_FILTER_SUBJECT,  EMF_SEARCH_FILTER_SENDER, EMF_SEARCH_FILTER_RECIPIENT, EMF_SEARCH_FILTER_ALL)\r
+ * @param[in] search_value     Specifies the value to use for searching. (ex : Subject, email address, display name)\r
+ * @param[in] start_index              Specifies the first mail index of searched mail. This function will return mails whose index in the result list are from start_index to start_index + limit_count. The first start index is 0.\r
+ * @param[in] limit_count              Specifies the max number of returned mails.\r
+ * @param[in] sorting                   Specifies the sorting order. see emf_sort_type_t\r
+ * @param[in/out] mail_list    Specifies the Pointer to the structure emf_mail_list_item_t.\r
+ * @param[in/out] result_count         Specifies the Number of searched Mails\r
+ * @exception          none\r
+ * @see                 emf_sort_type_t, emf_mail_list_item_t\r
+ * @code\r
+ * @endcode\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_find_mail(int account_id , const char *mailbox_name, int thread_id,\r
+       int search_type, char *search_value,\r
+       int start_index, int limit_count, emf_sort_type_t sorting, emf_mail_list_item_t** mail_list,  int* result_count);\r
+\r
+/**\r
+ * @open\r
+ * @fn         email_get_mail_by_address(int account_id , const char *mailbox_name, emf_email_address_list_t* addr_list,\r
+                                                                       int start_index, int limit_count, emf_sort_type_t sorting, emf_mail_list_item_t** mail_list,  int* result_count)\r
+ * @brief      Get the Mail List information from the DB based on the mailbox name account_id and sender address.\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] account_id       Specifies the Account ID\r
+ * @param[in] mailbox_name     Specifies the Mailbox Name\r
+ * @param[in] addr_list                Specifies the addresses of senders. see emf_email_address_list_t\r
+ * @param[in] start_index              Specifies the first mail index of searched mail. This function will return mails whose index in the result list are from start_index to start_index + limit_count\r
+ * @param[in] limit_count              Specifies the max number of returned mails.\r
+ * @param[in] search_type   Specifies the search type.\r
+ * @param[in] search_value  Specifies the search value.\r
+ * @param[in] sorting                   Specifies the sorting order. see emf_sort_type_t\r
+ * @param[in/out] mail_list    Specifies the Pointer to the structure emf_mail_list_item_t.\r
+ * @param[in/out] result_count         Specifies the Number of searched Mails\r
+ * @exception          none\r
+ * @see                 emf_email_address_list_t, emf_sort_type_t, emf_mail_list_item_t\r
+ * @code\r
+ * @endcode\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_get_mail_by_address(int account_id , const char *mailbox_name, emf_email_address_list_t* addr_list,\r
+                                                                       int start_index, int limit_count, int search_type, const char *search_value, emf_sort_type_t sorting, emf_mail_list_item_t** mail_list,  int* result_count);\r
+\r
+/**\r
+ * @open\r
+ * @fn email_get_thread_information_by_thread_id(int thread_id, emf_mail_data_t** thread_info)\r
+ * @brief      Get the thread information for specific thread from DB based on the mailbox name.\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] thread_id            Specifies the thread_id\r
+ * @param[in/out] thread_info  Specifies the Pointer to the structure emf_mail_data_t.\r
+ * @exception          none\r
+ * @see             emf_mail_data_t\r
+ * @code\r
+ *     #include "email-api-account.h"\r
+ *     bool\r
+ *     _api_sample_get_thread_information()\r
+ *     {\r
+ *             emf_mail_data_t *thread_info = NULL;\r
+ *             int thread_id = 0;\r
+ *             int err_code = EMF_ERROR_NONE;\r
+ *\r
+ *             printf("\n > Enter thread_id: ");\r
+ *             scanf("%d",&thread_id);\r
+ *\r
+ *             if ( EMF_ERROR_NONE != email_get_thread_information_by_thread_id(thread_id, &thread_info))\r
+ *             {\r
+ *                     printf("email_get_thread_information_by_thread_id failed :\n"); *\r
+ *             }\r
+ *             else\r
+ *             {\r
+ *                     printf("Success\n");\r
+ *                     //do something\r
+ *             }\r
+ *\r
+ *     }\r
+ * @endcode\r
+ * @remarks N/A\r
+ */\r
+\r
+\r
+EXPORT_API int email_get_thread_information_by_thread_id(int thread_id, emf_mail_data_t** thread_info);\r
+\r
+/**\r
+ * @open\r
+ * @fn email_get_thread_information_ex(int thread_id, emf_mail_list_item_t** thread_info)\r
+ * @brief      Get the Mail List information for specific thread from DB based on the mailbox name.\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] thread_id            Specifies the thread_id\r
+ * @param[in/out] thread_info  Specifies the Pointer to the structure emf_mail_list_item_t.\r
+ * @exception          none\r
+ * @see             emf_mail_list_item_t\r
+ * @code\r
+ *     #include "email-api-account.h"\r
+ *     bool\r
+ *     _api_sample_get_thread_information_ex()\r
+ *     {\r
+ *             emf_mail_list_item_t *thread_info = NULL;\r
+ *             int thread_id = 0;\r
+ *             int err_code = EMF_ERROR_NONE;\r
+ *\r
+ *             printf("\n > Enter thread_id: ");\r
+ *             scanf("%d",&thread_id);\r
+ *\r
+ *             if ( EMF_ERROR_NONE != email_get_thread_information_ex(thread_id, &thread_info))\r
+ *             {\r
+ *                     printf("email_get_mail_list_of_thread failed :\n"); *\r
+ *             }\r
+ *             else\r
+ *             {\r
+ *                     printf("Success\n");\r
+ *                     //do something\r
+ *             }\r
+ *\r
+ *     }\r
+ * @endcode\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_get_thread_information_ex(int thread_id, emf_mail_list_item_t** thread_info);\r
+\r
+/**\r
+ * @open\r
+ * @fn email_get_mail_flag(int account_id, int mail_id, emf_mail_flag_t* mail_flag)\r
+ * @brief      Get the Mail Flag information based on the account id and Mail Id.\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] account_id       Specifies the Account ID\r
+ * @param[in] mail_id          Specifies the Mail id for which  Flag details need to be fetched\r
+ * @param[in/out] mail_flag    Specifies the Pointer to the structure emf_mail_flag_t.\r
+ * @exception          none\r
+ * @see                 emf_mail_flag_t\r
+ * @code\r
+ *     #include "email-api-account.h"\r
+ *     bool\r
+ *     _api_sample_get_mail_flag()\r
+ *     {\r
+ *             emf_mail_flag_t *mail_flag = NULL;\r
+ *             int account_id = 0;\r
+ *             int mail_id = 0;\r
+ *             int err_code = EMF_ERROR_NONE;\r
+ *\r
+ *             printf("\n > Enter account_id: ");\r
+ *             scanf("%d",&account_id);\r
+ *             printf("\n > Enter mail_id: ");\r
+ *             scanf("%d",&mail_id);\r
+ *\r
+ *             if ( EMF_ERROR_NONE != email_get_mail_flag(account_id,mail_id, &mail_flag))\r
+ *             {\r
+ *                     printf("email_get_mail_flag failed :\n");\r
+ *             }\r
+ *             else\r
+ *             {\r
+ *                     printf("Success\n");\r
+ *                     //do something\r
+ *             }\r
+ *\r
+ *     }\r
+ * @endcode\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_get_mail_flag(int account_id, int mail_id, emf_mail_flag_t* mail_flag);\r
+\r
+/**\r
+ * @open\r
+ * @fn email_retry_send_mail( int mail_id, int timeout_in_sec)\r
+ * @brief      Retry mail send\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] mail_id                  Specifies the mail id for the mail to resend\r
+ * @param[in] timeout_in_sec   Specifies the timeout value in seconds\r
+ * @exception          none\r
+ * @see                 none\r
+\r
+ * @code\r
+ *     #include "email-api-account.h"\r
+ *     bool\r
+ *     _api_sample_retry_send_mail()\r
+ *     {\r
+ *             int mail_id = 1;\r
+ *             int timeout_in_sec = 2;\r
+ *\r
+ *              if(EMF_ERROR_NONE == email_retry_send_mail(mail_id,timeout_in_sec))\r
+ *                     //success\r
+ *              else\r
+ *                     //failure\r
+ *\r
+ *     }\r
+ * @endcode\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_retry_send_mail( int mail_id, int timeout_in_sec);\r
+\r
+\r
+/**\r
+ * @open\r
+ * @fn email_create_db_full()\r
+ * @brief      Create DB full\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @exception          none\r
+ * @see                 none\r
+\r
+ * @code\r
+ *     #include "email-api-account.h"\r
+ *     bool\r
+ *     _api_sample_create_db_full()\r
+ *     {\r
+ *\r
+ *              if(EMF_ERROR_NONE == email_create_db_full())\r
+ *                     //success\r
+ *              else\r
+ *                     //failure\r
+ *\r
+ *     }\r
+ * @endcode\r
+ * @remarks N/A\r
+ */\r
+\r
+EXPORT_API int email_create_db_full();\r
+\r
+/**\r
+ * @open\r
+ * @fn email_get_mailbox_name_by_mail_id(int mail_id, char **pMailbox_name)\r
+ * @brief      get mailBox naem by mailID\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] mail_id          Specifies the mailID\r
+ * @param[out] pMailbox_name   Specifies the mailbox name\r
+ * @exception          none\r
+ * @see                 none\r
+\r
+ * @code\r
+ *     #include "email-api-account.h"\r
+ *     bool\r
+ *     _api_sample_get_mailbox_name_by_mail_id()\r
+ *     {\r
+ *             char *mailbox_name =NULL;\r
+ *             int mail_id = 10;\r
+ *\r
+ *\r
+ *              if(EMF_ERROR_NONE == email_get_mailbox_name_by_mail_id(mail_id,&mailbox_name))\r
+ *                     //success\r
+ *              else\r
+ *                     //failure\r
+ *\r
+ *     }\r
+ * @endcode\r
+ * @remarks N/A\r
+ */\r
+\r
+EXPORT_API int email_get_mailbox_name_by_mail_id(int mail_id, char **pMailbox_name);\r
+\r
+/**\r
+ * @open\r
+ * @fn email_cancel_send_mail( int mail_id)\r
+ * @brief      Callback function for cm popup. We set the status as EMF_MAIL_STATUS_SEND_CANCELED\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] mail_id          Specifies the mailID\r
+ * @exception          none\r
+ * @see                 none\r
+ * @code\r
+ *     #include "email-api-account.h"\r
+ *     bool\r
+ *     _api_sample_cancel_send_mail()\r
+ *     {\r
+ *             int mail_id = 10;\r
+ *\r
+ *\r
+ *              if(EMF_ERROR_NONE == email_cancel_send_mail(mail_id,))\r
+ *                     //success\r
+ *              else\r
+ *                     //failure\r
+ *\r
+ *     }\r
+ * @endcode\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_cancel_send_mail( int mail_id) ;\r
+\r
+\r
+/**\r
+ * @open\r
+ * @fn email_count_message_all_mailboxes(emf_mailbox_t* mailbox, int* total, int* unseen)\r
+ * @brief      Get the Total count and Unread count of all mailboxes\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] mailbox          Specifies the mailbox structure\r
+ * @param[out] total           Specifies the total count\r
+ * @param[out] seen            Specifies the unseen mail count\r
+ * @exception          none\r
+ * @see                 emf_mailbox_t\r
+ * @code\r
+ *     #include "email-api-account.h"\r
+ *     bool\r
+ *     _api_sample_count_message_all_mailboxes()\r
+ *     {\r
+ *             emf_mailbox_t mailbox;\r
+ *             int total =0;\r
+ *             int unseen = 0;\r
+ *\r
+ *             memset(&mailbox,0x00,sizeof(emf_mailbox_t));\r
+ *             mailbox.account_id = 0;\r
+ *             mailbox.name = strdup("INBOX");\r
+ *\r
+ *              if(EMF_ERROR_NONE == email_count_message_all_mailboxes(&mailbox,&total,&unseen))\r
+ *                     //success\r
+ *              else\r
+ *                     //failure\r
+ *\r
+ *     }\r
+ * @endcode\r
+ * @remarks N/A\r
+ */\r
+\r
+EXPORT_API int email_count_message_all_mailboxes(emf_mailbox_t* mailbox, int* total, int* unseen);\r
+\r
+\r
+/* sowmya.kr@samsung.com, 01282010 - Changes to get latest unread mail id for given account */\r
+/**\r
+ * @open\r
+ * @fn email_get_latest_unread_mail_id(int account_id, int *pMailID)\r
+ * @brief      Gets the latest unread MailId for given account. If account_id passed is -1, returns latest unread mail Id.\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] account_id       Specifies the account id for which latest unread mail has to be fetched\r
+ * @param[out] pMailID         Specifies the latest unread mail\r
+ * @exception          none\r
+ * @see                 none\r
+ * @code\r
+ *     #include "email-api-account.h"\r
+ *     bool\r
+ *     _api_sample_get_latest_unread_mail_id()\r
+ *     {\r
+ *             int mail_id = 0,account_id = 0;\r
+ *             int err = EMF_ERROR_NONE;\r
+ *\r
+ *\r
+ *             printf("Enter account Id to get latest unread mail Id,<-1 to get latest irrespective of account id> ");\r
+ *             scanf("%d", &account_id);\r
+ *\r
+ *\r
+ *             if ( EMF_ERROR_NONE != email_get_latest_unread_mail_id(account_id, &mail_id) )\r
+ *             {\r
+ *                     printf("  fail email_get_latest_unread_mail_id: err[%d]\n", err);\r
+ *             }\r
+ *             else\r
+ *             {\r
+ *                     printf("  success email_get_latest_unread_mail_id: Latest unread mail id : %d\n", mail_id);\r
+ *             }\r
+ *     }\r
+ * @endcode\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int  email_get_latest_unread_mail_id(int account_id, int *pMailID);\r
+\r
+/**\r
+ * @open\r
+ * @fn email_get_max_mail_count(int *Count)\r
+ * @brief      Gets the max count of mails which can be supported by email-service\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[out] Count   max count of mails which can be supported by email-service\r
+ * @exception          none\r
+ * @code\r
+ *     #include "email-api-account.h"\r
+ *             bool\r
+ *             _api_sample_get_max_mail_count()\r
+ *             {\r
+ *                     int max_count = -1;\r
+ *\r
+ *                     if(EMF_ERROR_NONE == email_get_max_mail_count(&max_count))\r
+ *                             printf("\n\t>>>>> email_get_max_mail_count() return [%d]\n\n", max_count);\r
+ *     }\r
+ * @endcode\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int  email_get_max_mail_count(int *Count);\r
+\r
+\r
+ /**\r
+ * @open\r
+ * @fn email_get_disk_space_usage(unsigned long *total_size)\r
+ * @brief      Gets the total disk usage of emails in KB.\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[out] total_size      total disk usage of emails\r
+ * @exception          none\r
+ * @code\r
+ *     #include "email-api-account.h"\r
+ *             bool\r
+ *             _api_sample_get_disk_space_usage()\r
+ *             {\r
+ *                     unsigned long total_size = 0;\r
+ *\r
+ *                     if ( EMF_ERROR_NONE  != email_get_disk_space_usage(&total_size))\r
+ *                             printf("email_get_disk_space_usage failed err : %d\n",err_code);\r
+ *                     else\r
+ *                             printf("email_get_disk_space_usage SUCCESS, total disk usage in KB : %ld \n", total_size);\r
+ *             }\r
+ * @endcode\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_get_disk_space_usage(unsigned long *total_size);\r
+\r
+\r
+EXPORT_API int email_get_recipients_list(int account_id, const char *mailbox_name, emf_sender_list_t **sender_list);\r
+/**\r
+ * @open\r
+ * @fn email_get_sender_list(int account_id, const char *mailbox_name, int search_type, char *search_value, emf_sort_type_t sorting, emf_sender_list_t** sender_list, int *sender_count)\r
+ * @brief      Get the sender list with the total number of sender's mails and the number of sender's unread mails.\r
+ *                     This is used to show email address and display name of each sender with the number of mails (unread and total).\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] account_id       Specifies the account id to get the list. If this is 0, a sender list of "All Account" will be returned.\r
+ * @param[in] mailbox_name     Specifies the mailbox name  to get the list. If this is NULL, a sender list of "All Mailbox" will be returned.\r
+ * @param[in] search_type   Specifies the search type\r
+ * @param[in] search_value  Specifies the search value\r
+ * @param[in] sorting               Specifies the sorting order.\r
+ * @param[out] sender_list     Specifies the Pointer to the structure emf_sender_list_t. Memory for a new sender list will be allocated to this. Call email_free_sender_list() to free the memory allocated to this.\r
+ * @param[out] sender_count    Specifies the number of senders in a sender list.\r
+ * @exception          none\r
+ * @see                 emf_sort_type_t, emf_sender_list_t, email_free_sender_list()\r
+ * @code\r
+ *     #include "email-api-account.h"\r
+ *     bool\r
+ *     _api_sample_get_sender_list()\r
+ *     {\r
+ *             emf_sender_list_t *sender_list = NULL;\r
+ *             int sender_count = 0;\r
+ *             int account_id = 0;\r
+ *             int sorting = 0;\r
+ *             int err_code = EMF_ERROR_NONE;\r
+ *\r
+ *             account_id = 0;                                                 // For All accounts\r
+ *             mailbox_name = NULL;                                    // For All mail boxes\r
+ *             sorting = EMF_SORT_DATETIME_HIGH;\r
+ *\r
+ *\r
+ *             if ( EMF_ERROR_NONE != (err_code = email_get_sender_list(account_id, mailbox_name, EMF_SEARCH_FILTER_NONE, NULL, sorting, &sender_list, &sender_count)) )\r
+ *             {\r
+ *                     printf("email_get_sender_list failed :\n"); *\r
+ *                     return false;\r
+ *             }\r
+ *             else\r
+ *             {\r
+ *                     printf("Success\n");\r
+ *                     //do something\r
+ *             }\r
+ *\r
+ *             // Free sender list\r
+ *             if ( sender_list )\r
+ *             {\r
+ *                     email_free_sender_list(&sender_list, sender_count);\r
+ *             }\r
+ *     }\r
+ * @endcode\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_get_sender_list(int account_id, const char *mailbox_name, int search_type, const char *search_value, emf_sort_type_t sorting, emf_sender_list_t** sender_list, int *sender_count);\r
+\r
+/**\r
+ * @open\r
+ * @fn email_get_sender_list_ex(int account_id, const char *mailbox_name, int start_index, int limit_count, emf_sort_type_t sorting, emf_sender_list_t** sender_list, int *sender_count)\r
+ * @brief      Get the sender list with the total number of sender's mails and the number of sender's unread mails.\r
+ *                     This is used to show email address and display name of each sender with the number of mails (unread and total).\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] account_id       Specifies the account id to get the list. If this is 0, a sender list of "All Account" will be returned.\r
+ * @param[in] mailbox_name     Specifies the mailbox name  to get the list. If this is NULL, a sender list of "All Mailbox" will be returned.\r
+ * @param[in] start_index              Specifies the start index in the sender list. This function will return  a partial sender list from start_index to (start_index + limit_count - 1) in the sender list. negative value means "from the first sender". start_index is zero-based value.\r
+ * @param[in] limit_count              Specifies the max number of sender list. negative value means "All senders from the start_index in sender list"\r
+ * @param[in] sorting               Specifies the sorting order.\r
+ * @param[out] sender_list     Specifies the Pointer to the structure emf_sender_list_t. Memory for a new sender list will be allocated to this. Call email_free_sender_list() to free the memory allocated to this.\r
+ * @param[out] sender_count    Specifies the number of senders in a sender list.\r
+ * @exception          none\r
+ * @see                 emf_sort_type_t, emf_sender_list_t, email_free_sender_list()\r
+ * @code\r
+ *     #include "email-api-account.h"\r
+ *     bool\r
+ *     _api_sample_get_sender_list()\r
+ *     {\r
+ *             emf_sender_list_t *sender_list = NULL;\r
+ *             int sender_count = 0;\r
+ *             int account_id = 0;\r
+ *             int start_index = 10;           // from the 11th sender in sender list\r
+ *             int limit_count = 5;            // to the (11 + 5)th sender in sender list\r
+ *             int sorting = 0;\r
+ *             int err_code = EMF_ERROR_NONE;\r
+ *\r
+ *             account_id = 0;                                                 // For All accounts\r
+ *             mailbox_name = NULL;                                    // For All mail boxes\r
+ *             sorting = EMF_SORT_DATETIME_HIGH;\r
+ *\r
+ *\r
+ *             if ( EMF_ERROR_NONE != (err_code = email_get_sender_list_ex(account_id, mailbox_name, start_index, limit_count, sorting, &sender_list, &sender_count)) )\r
+ *             {\r
+ *                     printf("email_get_sender_list_ex failed :\n"); *\r
+ *                     return false;\r
+ *             }\r
+ *             else\r
+ *             {\r
+ *                     printf("Success\n");\r
+ *                     //do something\r
+ *             }\r
+ *\r
+ *             // Free sender list\r
+ *             if ( sender_list )\r
+ *             {\r
+ *                     email_free_sender_list(&sender_list, sender_count);\r
+ *             }\r
+ *     }\r
+ * @endcode\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_get_sender_list_ex(int account_id, const char *mailbox_name, int start_index, int limit_count, emf_sort_type_t sorting, emf_sender_list_t** sender_list, int *sender_count);\r
+\r
+\r
+/**\r
+ * @open\r
+ * @fn email_free_sender_list(emf_sender_list_t **sender_list, int count)\r
+ * @brief      Free the sender list allocated by email_get_sender_list(). This function will free the memory which is allocated to sender_list itself.\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] sender_list      Specifies the Pointer to the structure emf_sender_list_t to be freed.\r
+ * @param[in] count            Specifies the number of senders in a sender list.\r
+ * @exception          none\r
+ * @see                 emf_sender_list_t, email_get_sender_list()\r
+ */\r
+EXPORT_API int email_free_sender_list(emf_sender_list_t **sender_list, int count);\r
+\r
+\r
+/**\r
+ * @open\r
+ * @fn         email_get_address_info_list(int mail_id, emf_address_info_list_t** address_info_list)\r
+ * @brief      Get the address info list. The address info list contains from, to, cc, bcc addresses and their display name, contact id and etc. (see emf_address_info_list_t)\r
+ *                     Each GList (from, to, cc, bcc) is the list of emf_address_info_t data.\r
+ *                     "data" variable of GList structure contains emf_address_info_t data. <br>\r
+ *                     To get emf_address_info_t data from GList, Use type casting from GList node.\r
+ *\r
+ * @return     This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] mail_id          Specifies the mail id to get the list.\r
+ * @param[out] address_info_list       Specifies the Pointer to the structure emf_address_info_list_t. Memory for a new address info list will be allocated to this. Call email_free_address_info_list() to free the memory allocated to this.\r
+ * @exception          none\r
+ * @see                 emf_address_info_list_t, emf_address_info_t, email_free_address_info_list()\r
+ * @code\r
+ *     #include "email-api-account.h"\r
+ *     bool\r
+ *     _api_sample_get_address_info_list()\r
+ *     {\r
+ *             emf_address_info_list_t *p_address_info_list= NULL;\r
+ *             emf_address_info_t *p_address_info = NULL;\r
+ *             int mai_id;\r
+ *             int err_code = EMF_ERROR_NONE;\r
+ *\r
+ *             mail_id = 1;\r
+ *\r
+ *             if ( EMF_ERROR_NONE != (err_code = email_get_address_info_list(mail_id, &p_address_info_list)) )\r
+ *             {\r
+ *                     printf("email_get_address_info_list failed :\n"); *\r
+ *                     return false;\r
+ *             }\r
+ *             else\r
+ *             {\r
+ *                     printf("Success\n");\r
+ *                     //do something with p_address_info_list\r
+ *                     GList *list = p_address_info_list->from;\r
+ *                     GList *node = g_list_first(list);\r
+ *                     while ( node != NULL )\r
+ *                     {\r
+ *                             p_address_info = (emf_address_info_t*)node->data;\r
+ *                             printf("%d,  %s, %s, %d\n", p_address_info->address_type, p_address_info->address, p_address_info->display_name, p_address_info->contact_id);\r
+ *\r
+ *                             node = g_list_next(node);\r
+ *                     }\r
+ *             }\r
+ *\r
+ *             // Free sender list\r
+ *             if ( p_address_info_list )\r
+ *             {\r
+ *                     email_free_address_info_list(&p_address_info_list);\r
+ *             }\r
+ *     }\r
+ * @endcode\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_get_address_info_list(int mail_id, emf_address_info_list_t** address_info_list);\r
+\r
+/**\r
+ * @open\r
+ * @fn email_free_address_info_list(emf_address_info_list_t **address_info_list)\r
+ * @brief      Free the address info list allocated by email_get_address_info_list(). This function will free the memory which is allocated to address_info_list itself.\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] address_info_list        Specifies the Pointer to the structure emf_address_info_list_t to be freed.\r
+ * @exception          none\r
+ * @see                 emf_address_info_list_t, email_get_address_info_list()\r
+ */\r
+EXPORT_API int email_free_address_info_list(emf_address_info_list_t **address_info_list);\r
+\r
+/**\r
+ * @open\r
+ * @fn email_get_structure(const char*encoded_string, void **struct_var, emf_convert_struct_type_e type)\r
+ * @brief      This function returns the structure of the type which is indicated by 'type' variable. This function will allocate new memory to 'struct_var' for structure.<br>\r
+ *                     Some notifications such as NOTI_DOWNLOAD_NEW_MAIL are published with string parameter. The string contains various values that might be divided by delimiter.<br>\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] encoded_string           Specifies the Pointer to the string from notification.\r
+ * @param[out] struct_var                      Specifies the Pointer to the structure to be returned. If success, new memory for structure will be allocated.\r
+ * @param[in] type                             Specifies the converting type. see emf_convert_struct_type_e\r
+ * @exception          none\r
+ * @see                 emf_convert_struct_type_e\r
+ */\r
+EXPORT_API int email_get_structure(const char*encoded_string, void **struct_var, emf_convert_struct_type_e type);\r
+\r
+/**\r
+ * @open\r
+ * @fn email_get_meeting_request(int mail_id, emf_meeting_request_t **meeting_req)\r
+ * @brief      Get the information of meeting request.  The information of meeting request is based on Mail Id. <br>\r
+ *                     The information of meeting request is corresponding to only one mail.\r
+ *                     For this reason, the information of meeting request can be added by using email_add_message_with_meeting_request() with a matched mail information.\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success. This function returns EMF_ERROR_DATA_NOT_FOUND if there isn't a matched mail. Otherwise it returns error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] mail_id          Specifies the Mail id for which  meeting request details need to be fetched\r
+ * @param[in/out] meeting_req  Specifies the Pointer to the structure emf_meeting_request_t.\r
+ * @exception          none\r
+ * @see                 emf_meeting_request_t\r
+ */\r
+EXPORT_API int email_get_meeting_request(int mail_id, emf_meeting_request_t **meeting_req);\r
+\r
+\r
+/**\r
+ * @open\r
+ * @fn email_free_meeting_request(emf_meeting_request_t** meeting_req, int count)\r
+ * @brief      Free the meeting request allocated by email_get_meeting_request() or alloacted to add. This function will free the memory which is allocated to meeting_req (= *meeting_req) itself.\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] emf_meeting_request_t    Specifies the Pointer to the structure emf_meeting_request_t to be freed.\r
+ * @param[in] count    Specifies the number of elements in meeting_req array. this is usually 1.\r
+ * @exception          none\r
+ * @see                 emf_meeting_request_t, email_get_meeting_request()\r
+ */\r
+EXPORT_API int email_free_meeting_request(emf_meeting_request_t** meeting_req, int count);\r
+\r
+EXPORT_API int email_move_thread_to_mailbox(int thread_id, char *target_mailbox_name, int move_always_flag);\r
+\r
+EXPORT_API int email_delete_thread(int thread_id, int delete_always_flag);\r
+\r
+EXPORT_API int email_modify_seen_flag_of_thread(int thread_id, int seen_flag, int on_server);\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif /* __cplusplus */\r
+\r
+/**\r
+* @} @}\r
+*/\r
+\r
+\r
+#endif /* __EMAIL_API_MESSAGE_H__ */\r
similarity index 82%
rename from MAPI/include/Emf_Mapi_Mailbox.h
rename to email-api/include/email-api-mailbox.h
index ba08dc4..a1a23b6 100755 (executable)
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-#ifndef __EMF_MAPI_FOLDER_H__   /* mailbox */
-#define __EMF_MAPI_FOLDER_H__
-
-#include "emf-types.h"
-
-/**
-* @defgroup EMAIL_FRAMEWORK Email Service
-* @{
-*/
-
-
-/**
-* @ingroup EMAIL_FRAMEWORK
-* @defgroup EMAIL_MAPI_FOLDER Email mailbox(Mailbox) API
-* @{
-*/
-
-/**
- *
- * This file contains the data structures and interfaces needed for application,
- * to interact with Email Engine.
- * @file               Emf_Mapi_Folder.h
- * @author     Kyuho Jo <kyuho.jo@samsung.com>
- * @author     Sunghyun Kwon <sh0701.kwon@samsung.com>
- * @version    0.1
- * @brief              This file contains the data structures and interfaces of mailbox [mailbox] provided by 
- *                     Email Engine . 
- * @{
- * @code
- *
- *     #include "emf_mapi_folder.h"
- *
- *     bool 
- *     other_app_invoke_uniform_api_sample(int *error_code)    
- *     {
- *             emf_mailbox_t mbox;
- *             emf_mailbox_t *new_mailbox =NULL;
- *             emf_mailbox_t *mailbox_list = NULL;
- *             int count = 0;
- *             int mailbox_type;
- *             unsigned handle = 0;
- *             char *pMaiboxName;
- *             char *pParentMailbox;
- *             
- *             memset(&mbox,0x00,sizeof(emf_mailbox_t));
- *             mbox.name = strdup("test");
- *             mbox.alias = strdup("Personal");
- *             mbox.account_id = 1;
- *             printf("Enter local_yn(1/0)");
- *             scanf("%d",&local_yn);
- *             mbox.local=local_yn;
- *             mbox.mailbox_type = 7;
- *             
- *             //create new mailbox
- *             
- *             if(EMF_ERR_NONE != email_add_mailbox(&mbox,local_yn,&handle))
- *                     printf("email_add_mailbox failed\n");
- *             else
- *                     printf("email_add_mailbox success");
- *                     
- *             //update mailbox        
- *            new_mailbox = malloc(sizeof(emf_mailbox_t));
- *            memset(new_mailbox,0x00,sizeof(emf_mailbox_t));
- *
- *            new_mailbox->name = strdup("PersonalUse");
- *
- *            if(EMF_ERROR_NONE != email_update_mailbox(&mbox,new_mailbox))
- *                     printf("email_update_mailbox failed\n");
- *            else
- *                             printf("email_update_mailbox success\n");
- *             //delete mailbox
- *
- *             if(EMF_ERROR_NONE != email_delete_mailbox(mbox,local_yn,&handle))
- *                     printf("email_delete_mailbox failed\n");
- *             else
- *                     printf("email_delete_mailbox success\n");
- *                     
- *             //free mailbox
- *             email_free_mailbox("new_mailbox,1");
- *             
- *             //Get mailbox list
- *             if(EMF_ERROR_NONE != email_get_mailbox_list(account_id,local_yn,&mailbox_list,&count))
- *                     //failure
- *             else
- *                     //success
- *             
- *             //Get mailbox by name
- *             pMailboxName = strdup("test");
- *             if(EMF_ERROR_NONE != email_get_mailbox_by_name(account_id,pMailboxName,&mailbox_list))
- *                     //failure
- *             else
- *                     //success
- *
- *             //Get child mailbox list
- *             pParentMailbox = strdup("test");
- *             if(EMF_ERROR_NONE != email_get_child_mailbox_list(account_id, paerent_mailbox,&mailbox_list,&count))
- *                     //failure
- *             else
- *                     //success
- *
- *             //Get mailbox by mailbox_type
- *             printf("Enter mailbox_type\n");
- *             scanf("%d",&mailbox_type);
- *             if(EMF_ERROR_NONE != email_get_mailbox_by_mailbox_type(account_id,mailbox_type,&mailbox_list))
- *                     //failure
- *             else
- *                     //success
- *                     
- *     }               
- *
- * @endcode
- * @}
- */
-
-
-#ifdef __cplusplus
-extern "C" 
-{
-#endif /* __cplusplus */
-
-
-/**
- * @open
- * @fn EXPORT_API int email_add_mailbox(emf_mailbox_t* new_mailbox, int on_server, unsigned* handle)
- * @brief      Create a new mailbox or mailbox.This function is invoked when user wants to create a new mailbox for the specified account.
- *             If On_server is true then it will create the mailbox on server as well as in local also.   
- *
- * @return This function returns EMF_ERROR_NONE on success or error code(refer to EMF_ERROR_XXX) on failure.
- * @param[in] new_mailbox      Specifies the pointer of creating mailbox information.
-*  @param[in] on_server                Specifies the creating mailbox information on server.
- * @param[out] handle          Specifies the sending handle.
- * @exception  none
- * @see        emf_mailbox_t
-  * @remarks N/A
- */
-EXPORT_API int email_add_mailbox(emf_mailbox_t* new_mailbox, int on_server, unsigned* handle);
-
-
-/**
- * @open
- * @fn EXPORT_API int email_delete_mailbox(emf_mailbox_t* mailbox, int on_server,  unsigned* handle)
- * @brief      Delete a mailbox or mailbox.This function deletes the existing mailbox for specified account based on the option on_server.
- *             If the on_server is true then it deletes mailbox from server as well as locally.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code(refer to EMF_ERROR_XXX) on failure.
- * @param[in] mailbox  Specifies the pointer of deleting mailbox information.
- * @param[in] on_server                Specifies the creating mailbox information on server.
- * @param[out] handle          Specifies the sending handle.
- * @exception  #EMF_ERROR_INVALID_PARAM        -Invaid argument
- * @see        emf_mailbox_t
- * @remarks N/A
- */
-EXPORT_API int email_delete_mailbox(emf_mailbox_t* mailbox, int on_server,  unsigned* handle);
-
-
-/**
- * @fn EXPORT_API int email_update_mailbox(emf_mailbox_t* old_mailbox, emf_mailbox_t* new_mailbox)
- * @brief      Change mailbox or mailbox information.This function is invoked when user wants to change the existing mail box information. 
- *                     This supports ONLY updating mailbox_type in local db. This can be used to match a specific mail box and a specific mailbox_type.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code(refer to EMF_ERROR_XXX) on failure.
- * @param[in] old_mailbox      Specifies the information of previous mailbox. <br>mandatory field : account_id, name
- * @param[in] new_mailbox      Specifies the information of new mailbox. <br
- * @exception #EMF_ERROR_INVALID_PARAM                 -Invaid argument
- * @see        emf_mailbox_t, emf_mailbox_type_e
-  * @remarks N/A
- */
-EXPORT_API int email_update_mailbox(emf_mailbox_t* old_mailbox, emf_mailbox_t* new_mailbox);
-
-EXPORT_API int email_get_sync_mailbox_list(int account_id, emf_mailbox_t** mailbox_list, int* count) DEPRECATED;
-
-
-/**
- * @open
- * @fn email_get_mailbox_list(int account_id, int mailbox_sync_type, emf_mailbox_t** mailbox_list, int* count)
- * @brief      Get all mailboxes from account.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code(refer to EMF_ERROR_XXX) on failure.
- * @param[in] account_id               Specifies the account ID.
- * @param[in] mailbox_sync_type                Specifies the sync type.
- * @param[out] mailbox_list    Specifies the pointer of mailbox structure pointer.(possibly NULL)
- * @param[out] count                   The mailbox count is saved here.(possibly 0)
- * @exception          none
- * @see        emf_mailbox_t
-
- * @code
- *     #include "Emf_Mapi_Message.h"
- *     bool
- *     _api_sample_get_mailbox_list()
- *     {
- *             int account_id =0,count = 0;
- *             int mailbox_sync_type;
- *             int error_code = EMF_ERROR_NONE;
- *             emf_mailbox_t *mailbox_list=NULL;
- *             
- *             printf("\n > Enter account id: ");
- *             scanf("%d", &account_id);
- *             printf("\n > Enter mailbox_sync_type: ");
- *             scanf("%d", &mailbox_sync_type);
- *
- *             if((EMF_ERROR_NONE != email_get_mailbox_list(account_id, mailbox_sync_type, &mailbox_list, &count)))
- *             {
- *                     printf(" Error\n");
- *             }
- *             else
- *             {
- *                     printf("Success\n");
- *                     email_free_mailbox(&mailbox_list,count);
- *             }
- *     }
- * @endcode    
- * @remarks N/A
- */
-EXPORT_API int  email_get_mailbox_list(int account_id, int mailbox_sync_type, emf_mailbox_t** mailbox_list, int* count);
-
-EXPORT_API int email_get_mailbox_list_ex(int account_id, int mailbox_sync_type, int with_count, emf_mailbox_t** mailbox_list, int* count);
-
-/**
- * @open
- * @fn EXPORT_API int email_get_mailbox_by_name(int account_id, const char *pMailboxName, emf_mailbox_t **pMailbox);
- * @brief      Get the mailbox information by name.This function gets the mailbox by given mailbox name for a specified account.       
- *
- * @return This function returns EMF_ERROR_NONE on success or error code(refer to EMF_ERROR_XXX) on failure.
- * @param[in] account_id               Specifies the information of account Id.
- * @param[in] pMailboxName             Specifies the mailbox name.
- * @param[out] pMailbox                        Specifies the information of mailbox 
- * @exception none
- * @see        emf_mailbox_t
- * @remarks N/A
- */
-
-EXPORT_API int email_get_mailbox_by_name(int account_id, const char *pMailboxName, emf_mailbox_t **pMailbox);
-
-// Belows are for A Project
-
-/**
- * @open
- * @fn email_get_child_mailbox_list(int account_id, char *parent_mailbox,  emf_mailbox_t** mailbox_list, int* count)
- * @brief      Get all sub mailboxes for given parent mailbox.This function gives all the child mailbox list for a given parent mailbox for specified account.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code(refer to EMF_ERROR_XXX) on failure.
- * @param[in] account_id               Specifies the account ID.
- * @param[in] parent_mailbox           Specifies the parent mailbox
- * @param[out] mailbox_list           Specifies the pointer of mailbox structure pointer.(possibly NULL)
- * @param[out] count                   The mailbox count
- * @exception  #EMF_ERROR_INVALID_PARAM        -Invalid argument
- * @see        emf_mailbox_t
- * @remarks N/A
- * @return This function returns true on success or false on failure.
- */
-EXPORT_API int email_get_child_mailbox_list(int account_id, const char *parent_mailbox,  emf_mailbox_t** mailbox_list, int* count);
-
-
-/**
- * @open
- * @fn email_get_mailbox_by_mailbox_type(int account_id, emf_mailbox_type_e mailbox_type,  emf_mailbox_t** mailbox)
- * @brief      Get mailbox by mailbox_type.This function is invoked when user wants to know the mailbox information by mailbox_type for the given account.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code(refer to EMF_ERROR_XXX) on failure.
- * @param[in] account_id               Specifies the account ID.
- * @param[in] mailbox_type             Specifies the mailbox type.
- * @param[out] mailbox         Specifies the pointer of mailbox structure pointer.(possibly NULL)
- * @exception none
- * @see        emf_mailbox_t
- * @remarks N/A
- */
-EXPORT_API int email_get_mailbox_by_mailbox_type(int account_id, emf_mailbox_type_e mailbox_type,  emf_mailbox_t** mailbox);
-
-/**
- * @open
- * @fn email_set_mail_slot_size(int account_id, char* mailbox_name, int new_slot_size, unsigned* handle)
- * @brief      Set mail slot size.This function is invoked when user wants to set the size of mail slot.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code(refer to EMF_ERROR_XXX) on failure.
- * @param[in] account_id               Specifies the account ID.
- * @param[in] mailbox_name             Specifies the mailbox name.
- * @param[in] new_slot_size            Specifies the mail slot size.
- * @exception none
- * @see        emf_mailbox_t
- * @remarks N/A
- */
-EXPORT_API int email_set_mail_slot_size(int account_id, char* mailbox_name, int new_slot_size/*, unsigned* handle*/);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-/**
-* @} @}
-*/
-
-
-
-#endif /* __EMF_MAPI_FOLDER_H__ */
-
-
+/*\r
+*  email-service\r
+*\r
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+*\r
+* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com>\r
+*\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+* http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License.\r
+*\r
+*/\r
+\r
+\r
+#ifndef __EMAIL_API_MAILBOX_H__\r
+#define __EMAIL_API_MAILBOX_H__\r
+\r
+#include "email-types.h"\r
+\r
+/**\r
+* @defgroup EMAIL_SERVICE Email Service\r
+* @{\r
+*/\r
+\r
+\r
+/**\r
+* @ingroup EMAIL_SERVICE\r
+* @defgroup EMAIL_API_MAILBOX Email Mailbox API\r
+* @{\r
+*/\r
+\r
+/**\r
+ *\r
+ * This file contains the data structures and interfaces needed for application,\r
+ * to interact with email-service.\r
+ * @file               email-api-mailbox.h\r
+ * @author     Kyuho Jo <kyuho.jo@samsung.com>\r
+ * @author     Sunghyun Kwon <sh0701.kwon@samsung.com>\r
+ * @version    0.1\r
+ * @brief              This file contains the data structures and interfaces of mailbox provided by\r
+ *                     email-service .\r
+ * @{\r
+ * @code\r
+ *\r
+ *  #include "email_api_mailbox.h"\r
+ *\r
+ *  bool other_app_invoke_uniform_api_sample(int *error_code)\r
+ *     {\r
+ *             emf_mailbox_t mbox;\r
+ *             emf_mailbox_t *new_mailbox =NULL;\r
+ *             emf_mailbox_t *mailbox_list = NULL;\r
+ *             int count = 0;\r
+ *             int mailbox_type;\r
+ *             unsigned handle = 0;\r
+ *             char *pMaiboxName;\r
+ *             char *pParentMailbox;\r
+ *\r
+ *             memset(&mbox,0x00,sizeof(emf_mailbox_t));\r
+ *             mbox.name = strdup("test");\r
+ *             mbox.alias = strdup("Personal");\r
+ *             mbox.account_id = 1;\r
+ *             printf("Enter local_yn(1/0)");\r
+ *             scanf("%d",&local_yn);\r
+ *             mbox.local=local_yn;\r
+ *             mbox.mailbox_type = 7;\r
+ *\r
+ *             //create new mailbox\r
+ *\r
+ *             if(EMF_ERR_NONE != email_add_mailbox(&mbox,local_yn,&handle))\r
+ *                     printf("email_add_mailbox failed\n");\r
+ *             else\r
+ *                     printf("email_add_mailbox success");\r
+ *\r
+ *             //update mailbox\r
+ *            new_mailbox = malloc(sizeof(emf_mailbox_t));\r
+ *            memset(new_mailbox,0x00,sizeof(emf_mailbox_t));\r
+ *\r
+ *            new_mailbox->name = strdup("PersonalUse");\r
+ *\r
+ *            if(EMF_ERROR_NONE != email_update_mailbox(&mbox,new_mailbox))\r
+ *                     printf("email_update_mailbox failed\n");\r
+ *            else\r
+ *                             printf("email_update_mailbox success\n");\r
+ *             //delete mailbox\r
+ *\r
+ *             if(EMF_ERROR_NONE != email_delete_mailbox(mbox,local_yn,&handle))\r
+ *                     printf("email_delete_mailbox failed\n");\r
+ *             else\r
+ *                     printf("email_delete_mailbox success\n");\r
+ *\r
+ *             //free mailbox\r
+ *             email_free_mailbox("new_mailbox,1");\r
+ *\r
+ *             //Get mailbox list\r
+ *             if(EMF_ERROR_NONE != email_get_mailbox_list(account_id,local_yn,&mailbox_list,&count))\r
+ *                     //failure\r
+ *             else\r
+ *                     //success\r
+ *\r
+ *             //Get mailbox by name\r
+ *             pMailboxName = strdup("test");\r
+ *             if(EMF_ERROR_NONE != email_get_mailbox_by_name(account_id,pMailboxName,&mailbox_list))\r
+ *                     //failure\r
+ *             else\r
+ *                     //success\r
+ *\r
+ *             //Get child mailbox list\r
+ *             pParentMailbox = strdup("test");\r
+ *             if(EMF_ERROR_NONE != email_get_child_mailbox_list(account_id, paerent_mailbox,&mailbox_list,&count))\r
+ *                     //failure\r
+ *             else\r
+ *                     //success\r
+ *\r
+ *             //Get mailbox by mailbox_type\r
+ *             printf("Enter mailbox_type\n");\r
+ *             scanf("%d",&mailbox_type);\r
+ *             if(EMF_ERROR_NONE != email_get_mailbox_by_mailbox_type(account_id,mailbox_type,&mailbox_list))\r
+ *                     //failure\r
+ *             else\r
+ *                     //success\r
+ *\r
+ *     }\r
+ *\r
+ * @endcode\r
+ * @}\r
+ */\r
+\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif /* __cplusplus */\r
+\r
+\r
+/**\r
+\r
+ * @open\r
+ * @fn EXPORT_API int email_add_mailbox(emf_mailbox_t* new_mailbox, int on_server, unsigned* handle)\r
+ * @brief      Create a new mailbox or mailbox.This function is invoked when user wants to create a new mailbox for the specified account.\r
+ *             If On_server is true then it will create the mailbox on server as well as in local also.\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code(refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] new_mailbox      Specifies the pointer of creating mailbox information.\r
+*  @param[in] on_server                Specifies the creating mailbox information on server.\r
+ * @param[out] handle          Specifies the sending handle.\r
+ * @exception  none\r
+ * @see        emf_mailbox_t\r
+  * @remarks N/A\r
+ */\r
+EXPORT_API int email_add_mailbox(emf_mailbox_t* new_mailbox, int on_server, unsigned* handle);\r
+\r
+\r
+/**\r
+\r
+ * @open\r
+ * @fn EXPORT_API int email_delete_mailbox(emf_mailbox_t* mailbox, int on_server,  unsigned* handle)\r
+ * @brief      Delete a mailbox or mailbox.This function deletes the existing mailbox for specified account based on the option on_server.\r
+ *             If the on_server is true then it deletes mailbox from server as well as locally.\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code(refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] mailbox  Specifies the pointer of deleting mailbox information.\r
+ * @param[in] on_server                Specifies the creating mailbox information on server.\r
+ * @param[out] handle          Specifies the sending handle.\r
+ * @exception  #EMF_ERROR_INVALID_PARAM        -Invaid argument\r
+ * @see        emf_mailbox_t\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_delete_mailbox(emf_mailbox_t* mailbox, int on_server,  unsigned* handle);\r
+\r
+\r
+/**\r
+\r
+ * @fn EXPORT_API int email_update_mailbox(emf_mailbox_t* old_mailbox, emf_mailbox_t* new_mailbox)\r
+ * @brief      Change mailbox or mailbox information.This function is invoked when user wants to change the existing mail box information.\r
+ *                     This supports ONLY updating mailbox_type in local db. This can be used to match a specific mail box and a specific mailbox_type.\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code(refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] old_mailbox      Specifies the information of previous mailbox. <br>mandatory field : account_id, name\r
+ * @param[in] new_mailbox      Specifies the information of new mailbox. <br\r
+ * @exception #EMF_ERROR_INVALID_PARAM                 -Invaid argument\r
+ * @see        emf_mailbox_t, emf_mailbox_type_e\r
+  * @remarks N/A\r
+ */\r
+EXPORT_API int email_update_mailbox(emf_mailbox_t* old_mailbox, emf_mailbox_t* new_mailbox);\r
+\r
+/**\r
+\r
+ * @open\r
+ * @fn email_get_mailbox_list(int account_id, int mailbox_sync_type, emf_mailbox_t** mailbox_list, int* count)\r
+ * @brief      Get all mailboxes from account.\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code(refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] account_id               Specifies the account ID.\r
+ * @param[in] mailbox_sync_type                Specifies the sync type.\r
+ * @param[out] mailbox_list    Specifies the pointer of mailbox structure pointer.(possibly NULL)\r
+ * @param[out] count                   The mailbox count is saved here.(possibly 0)\r
+ * @exception          none\r
+ * @see        emf_mailbox_t\r
+\r
+ * @code\r
+ *     #include "email-api-mailbox.h"\r
+ *     bool\r
+ *     _api_sample_get_mailbox_list()\r
+ *     {\r
+ *             int account_id =0,count = 0;\r
+ *             int mailbox_sync_type;\r
+ *             int error_code = EMF_ERROR_NONE;\r
+ *             emf_mailbox_t *mailbox_list=NULL;\r
+ *\r
+ *             printf("\n > Enter account id: ");\r
+ *             scanf("%d", &account_id);\r
+ *             printf("\n > Enter mailbox_sync_type: ");\r
+ *             scanf("%d", &mailbox_sync_type);\r
+ *\r
+ *             if((EMF_ERROR_NONE != email_get_mailbox_list(account_id, mailbox_sync_type, &mailbox_list, &count)))\r
+ *             {\r
+ *                     printf(" Error\n");\r
+ *             }\r
+ *             else\r
+ *             {\r
+ *                     printf("Success\n");\r
+ *                     email_free_mailbox(&mailbox_list,count);\r
+ *             }\r
+ *     }\r
+ * @endcode\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_get_mailbox_list(int account_id, int mailbox_sync_type, emf_mailbox_t** mailbox_list, int* count);\r
+\r
+EXPORT_API int email_get_mailbox_list_ex(int account_id, int mailbox_sync_type, int with_count, emf_mailbox_t** mailbox_list, int* count);\r
+\r
+/**\r
+\r
+ * @open\r
+ * @fn EXPORT_API int email_get_mailbox_by_name(int account_id, const char *pMailboxName, emf_mailbox_t **pMailbox);\r
+ * @brief      Get the mailbox information by name.This function gets the mailbox by given mailbox name for a specified account.\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code(refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] account_id               Specifies the information of account Id.\r
+ * @param[in] pMailboxName             Specifies the mailbox name.\r
+ * @param[out] pMailbox                        Specifies the information of mailbox\r
+ * @exception none\r
+ * @see        emf_mailbox_t\r
+ * @remarks N/A\r
+ */\r
+\r
+EXPORT_API int email_get_mailbox_by_name(int account_id, const char *pMailboxName, emf_mailbox_t **pMailbox);\r
+\r
+// Belows are for A Project\r
+\r
+/**\r
+\r
+ * @open\r
+ * @fn email_get_child_mailbox_list(int account_id, char *parent_mailbox,  emf_mailbox_t** mailbox_list, int* count)\r
+ * @brief      Get all sub mailboxes for given parent mailbox.This function gives all the child mailbox list for a given parent mailbox for specified account.\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code(refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] account_id               Specifies the account ID.\r
+ * @param[in] parent_mailbox           Specifies the parent mailbox\r
+ * @param[out] mailbox_list           Specifies the pointer of mailbox structure pointer.(possibly NULL)\r
+ * @param[out] count                   The mailbox count\r
+ * @exception  #EMF_ERROR_INVALID_PARAM        -Invalid argument\r
+ * @see        emf_mailbox_t\r
+ * @remarks N/A\r
+ * @return This function returns true on success or false on failure.\r
+ */\r
+EXPORT_API int email_get_child_mailbox_list(int account_id, const char *parent_mailbox,  emf_mailbox_t** mailbox_list, int* count);\r
+\r
+\r
+/**\r
+ * @open\r
+ * @fn email_get_mailbox_by_mailbox_type(int account_id, emf_mailbox_type_e mailbox_type,  emf_mailbox_t** mailbox)\r
+ * @brief      Get mailbox by mailbox_type.This function is invoked when user wants to know the mailbox information by mailbox_type for the given account.\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code(refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] account_id               Specifies the account ID.\r
+ * @param[in] mailbox_type             Specifies the mailbox type.\r
+ * @param[out] mailbox         Specifies the pointer of mailbox structure pointer.(possibly NULL)\r
+ * @exception none\r
+ * @see        emf_mailbox_t\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_get_mailbox_by_mailbox_type(int account_id, emf_mailbox_type_e mailbox_type,  emf_mailbox_t** mailbox);\r
+\r
+/**\r
+ * @open\r
+ * @fn email_set_mail_slot_size(int account_id, char* mailbox_name, int new_slot_size, unsigned* handle)\r
+ * @brief      Set mail slot size.This function is invoked when user wants to set the size of mail slot.\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code(refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] account_id               Specifies the account ID.\r
+ * @param[in] mailbox_name             Specifies the mailbox name.\r
+ * @param[in] new_slot_size            Specifies the mail slot size.\r
+ * @exception none\r
+ * @see        emf_mailbox_t\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_set_mail_slot_size(int account_id, char* mailbox_name, int new_slot_size/*, unsigned* handle*/);\r
+\r
+/**\r
+ * @open\r
+ * @fn email_free_mailbox(emf_mailbox_t** mailbox_list, int count)\r
+ * @brief      Free allocated memory for mailbox information.\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] mailbox_list     Specifies the pointer for searching mailbox structure pointer.\r
+ * @param[in] count                    Specifies the count of mailboxes.\r
+ * @exception          none\r
+ * @see                 emf_mailbox_t\r
+\r
+ * @code\r
+ *     #include "email-api-mailbox.h"\r
+ *     bool\r
+ *     _api_sample_free_mailbox_info()\r
+ *     {\r
+ *             emf_mailbox_t *mailbox;\r
+ *\r
+ *             //fill the mailbox structure\r
+ *             //count - number of mailbox structure user want to free\r
+ *              if(EMF_ERROR_NONE == email_free_mailbox(&mailbox,count))\r
+ *                     //success\r
+ *              else\r
+ *                     //failure\r
+ *\r
+ *     }\r
+ * @endcode\r
+ * @remarks N/A\r
+ */\r
+\r
+EXPORT_API int email_free_mailbox(emf_mailbox_t** mailbox_list, int count);\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif /* __cplusplus */\r
+\r
+/**\r
+* @} @}\r
+*/\r
+\r
+\r
+\r
+#endif /* __EMAIL_API_MAILBOX_H__ */\r
+\r
+\r
similarity index 78%
rename from MAPI/include/Emf_Mapi_Network.h
rename to email-api/include/email-api-network.h
index db95892..462e66b 100755 (executable)
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-#ifndef __EMF_MAPI_NETWORK_H__
-#define __EMF_MAPI_NETWORK_H__
-
-#include "emf-types.h"
-
-/**
-* @defgroup EMAIL_FRAMEWORK Email Service
-* @{
-*/
-
-/**
-* @ingroup EMAIL_FRAMEWORK
-* @defgroup EMAIL_MAPI_NETWORK Email Network API
-* @{
-*/
-
-/**
- *
- * This file contains the data structures and interfaces needed for application,
- * to interact with Email Engine.
- * @file               Emf_Mapi_Network.h
- * @author     Kyuho Jo <kyuho.jo@samsung.com>
- * @author     Sunghyun Kwon <sh0701.kwon@samsung.com>
- * @version    0.1
- * @brief              This file contains the data structures and interfaces of Network related Functionality provided by 
- *                     Email Engine . 
- *
- * @{
-  
- * @code
- *     #include "Emf_Mapi_Network.h"
- *
- *     bool
- *     other_app_invoke_uniform_api_sample(int* error_code)
- *     {
- *
- *             // Send a mail 
- *             emf_mailbox_t mbox;
- *             emf_mail_t *mail = NULL;
- *             emf_mail_head_t *head =NULL;
- *             emf_mail_body_t *body =NULL;
- *             emf_attachment_info_t attachment;
- *             emf_option_t option;
- *             int account_id = 1;
- *             int err = EMF_ERROR_NONE;
- *             int mail_id = 1;
- *             char arg[50]; //Input attachment number need to be download
- *             emf_event_status_type_t  status;
- *             int action = -1;
- *             int on_sending = 0;
- *             int on_receiving = 0;
- * 
- *             mail =( emf_mail_t *)malloc(sizeof(emf_mail_t));
- *             head =( emf_mail_head_t *)malloc(sizeof(emf_mail_head_t));
- *             body =( emf_mail_body_t *)malloc(sizeof(emf_mail_body_t));
- *             mail->info =( emf_mail_info_t*) malloc(sizeof(emf_mail_info_t));
- *             memset(mail->info, 0x00, sizeof(emf_mail_info_t));
- *
- *             memset(&mbox, 0x00, sizeof(emf_mailbox_t));
- *             memset(&option, 0x00, sizeof(emf_option_t));
- *             memset(mail, 0x00, sizeof(emf_mail_t));
- *             memset(head, 0x00, sizeof(emf_mail_head_t));
- *             memset(body, 0x00, sizeof(emf_mail_body_t));
- *             memset(&attachment, 0x00, sizeof(emf_attachment_info_t));
- *
- *             option.keep_local_copy = 1;
- *             
- *             mbox.account_id = account_id;
- *             mbox.name = strdup("OUTBOX");
- *             head->to=strdup("test@test.com");
- *             head->subject =strdup("test");
- *             body->plain = strdup("/tmp/mail.txt");
- *             
- *             mail->info->account_id = account_id;
- *             mail->info->flags.draft = 1;
- *             mail->body = body;
- *             mail->head = head;
- *                             
- *             attachment.name = strdup("attach");
- *             attachment.savename = strdup("/tmp/mail.txt");
- *             attachment.next = NULL;
- *             mail->body->attachment = &attachment;
- *             mail->body->attachment_num = 1;
- *             if(EMF_ERROR_NONE  == email_add_message(mail,&mbox,1))
- *             {
- *                     if(EMF_ERROR_NONE == email_send_mail(&mbox, mail->info->uid,&option,&handle))
- *                             //success
- *                     else
- *                             //failure
- *             }
- *
- *             // Download header of new emails from mail server
- *             unsigned handle = 0;
- *
- *             memset(&mbox, 0x00, sizeof(emf_mailbox_t));
- *
- *             mbox.account_id = account_id;
- *             mbox.name = strdup("INBOX");
- *             if(EMF_ERROR_NONE == email_sync_header (&mbox,&handle))
- *                     //success
- *             else
- *                     //failure
- *
- *             //Sync mail header for all accounts
- *             if(EMF_ERROR_NONE == email_sync_header_for_all_account(&handle))
- *                     //success
- *             else
- *                     //failure
- *             
- *             //Download email body from server
- *
- *             memset(&mbox, 0x00, sizeof(emf_mailbox_t));
- *             mbox.account_id = account_id;
- *             mbox.name = strdup("INBOX");
- *             if(EMF_ERROR_NONE == email_download_body (&mbox,mail_id,0,&handle))
- *                     //success
- *             else
- *                     //failure
- *             
- *             //Download a email nth-attachment from server
- *             prinf("Enter attachment number\n");
- *             scanf("%s",arg);
- *             memset(&mbox, 0x00, sizeof(emf_mailbox_t));
- *             mbox.name = strdup("INBOX");
- *             mbox.account_id = account_id;
- *             if(EMF_ERROR_NONE == email_download_attachment(&mailbox,mail_id,arg,&handle))
- *                     //success
- *             else
- *                     //failure
- *
- *             //Cancel job
- *             if(EMF_ERROR_NONE == email_cancel_job(account_id,handle))//canceling download email nth attachment from server job.
- *                                                                     //so this handle contains the value return by the email_download_attachment()
- *                     //success
- *             else
- *                     //failure
- *             //Get pending job listfor an account
- *
- *             printf( " Enter Action \n SEND_MAIL = 0 \n SYNC_HEADER = 1 \n" \
- *                         " DOWNLOAD_BODY,= 2 \n DOWNLOAD_ATTACHMENT = 3 \n" \
- *                         " DELETE_MAIL = 4 \n SEARCH_MAIL = 5 \n SAVE_MAIL = 6 \n" \
- *                         " NUM = 7 \n");
- *             scanf("%d",&action);
- *             if(EMF_ERROR_NONE == email_get_pending_job(action,account_id,mail_id,&status))
- *                     //success
- *             else
- *                     //error
- *
- *             //Get Network status
- *             if(EMF_ERROR_NONE == email_get_network_status(&sending,&receiving))
- *                     //success
- *             else
- *                     //failure
- *
- *             //Send read report
- *             if(EMF_ERROR_NONE == email_send_report(mail ,&handle))
- *                     //success
- *             else
- *                     //failure
- *             //Save and send
- *
- *             mbox.account_id = account_id;
- *             mbox.name = strdup("DRAFTBOX");
- *             
- *             if(EMF_ERROR_NONE  == email_add_message(mail,&mbox,1))
- *             {
- *                     if(EMF_ERROR_NONE == email_send_saved(account_id,&option,&handle))
- *                             //success
- *                     else
- *                             //failure
- *             }
- *             //Get Imap mailbox list
- *             printf("\n > Enter server name:\n");
- *             scanf("%s",arg);
- *             if(EMF_ERROR_NONE == email_get_imap_mailbox_list(account_id , arg , &handle))
- *                     //success
- *             else
- *                     //failure
- *
- *             //sync local activity
- *             if(EMF_ERROR_NONE == email_sync_local_activity(account_id))
- *                     //success
- *             else
- *                     //failure
- * }
- *
- * @endcode
- * @}
-
- */
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/**
- * @open
- * @fn email_send_mail( emf_mailbox_t* mailbox, int mail_id, emf_option_t* sending_option, unsigned* handle)
- * @brief      Send a mail.This function is invoked when user wants to send a composed mail.
- *
- * @return     This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] mailbox                  Specifies the mailbox to consist a sending email.
- * @param[in] mail_id                  Specifies the mail ID.
- * @param[in] sending_option           Specifies the sending option.
- * @param[out] handle          Specifies the sending handle.
- * @exception  none
- * @see        emf_mailbox_t and emf_option_t
- * @remarks N/A
- */
-EXPORT_API int email_send_mail( emf_mailbox_t* mailbox, 
-                               int mail_id, 
-                               emf_option_t* sending_option, 
-                               unsigned* handle);
-
-
-/**
- * @open
- * @fn email_sync_header(emf_mailbox_t* mailbox, unsigned* handle)
- * @brief      Download header of new emails from mail server.This function is invoked when user wants to download only header of new mails. 
- *
- * @return     This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] mailbox          Specifies the structure of mailbox.
- * @param[out] handle          Specifies the handle for stopping downloading.
- * @exception  none
- * @see        emf_mailbox_t
- * @remarks N/A
- */
-EXPORT_API int email_sync_header(emf_mailbox_t* mailbox, unsigned* handle);
-
-
-/**
- * @open
- * @fn email_sync_header_for_all_account(unsigned* handle)
- * @brief      Download header of new emails from mail server for all emails.This function is invoked when user wants to download header of new mails for all accounts.
- *
- * @return     This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[out] handle          Specifies the handle for stopping downloading.
- * @exception none
- * @see        none
- * @remarks N/A
- */
-EXPORT_API int email_sync_header_for_all_account(unsigned* handle);
-
-
-/**
- * @open
- * @fn email_download_body(emf_mailbox_t* mailbox, int mail_id, int with_attachment, unsigned* handle)
- * @brief      Download email body from server.This function is invoked when user wants to download email body with/without attachment based on the option with_attachment
- *             from the server.
- *
- * @return     This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] mailbox                  Specifies the structure of mailbox.
- * @param[in] mail_id                  Specifies the mail ID.
- * @param[in] with_attachment  Specifies the whether attachment is there or not.
- * @param[out] handle          Specifies the handle for stopping downloading.
- * @exception none
- * @see emf_mailbox_t
- * @remarks N/A
- */
-EXPORT_API int email_download_body(emf_mailbox_t* mailbox, int mail_id, int with_attachment, unsigned* handle);
-
-
-
-
-
-
-/**
- * @open
- * @fn email_download_attachment(emf_mailbox_t* mailbox, int mail_id, char* nth, unsigned* handle);
- * @brief      Download a email nth-attachment from server.This function is invoked if user wants to download only specific attachment of a mail whose body is already downloaded.
- *
- * @return     This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] mailbox          Reserved.
- * @param[in] mail_id          Specifies the mail ID.
- * @param[in] nth                      Specifies the buffer that a attachment number been saved. the minimum number is "1".
- * @param[out] handle          Specifies the handle for stopping downloading.
- * @exception none
- * @see        emf_mailbox_t  
- * @remarks N/A
- */
-EXPORT_API int email_download_attachment(emf_mailbox_t* mailbox, 
-                                                       int mail_id,
-                                                       const char* nth,  
-                                                       unsigned* handle);
-
-
-/**
- * @open
- * @fn email_cancel_job(int account_id, int handle);
- * @brief      cancel the ongoing job.This function is invoked if user wants to cancel any ongoing job of a specified account.
- *
- * @return     This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] account_id       Specifies the account ID.
- * @param[in] handle           Specifies the handle for stopping the operation.
- * @exception   none
- * @see        none  
- * @remarks N/A
- */
-
-EXPORT_API int email_cancel_job(int account_id, int handle);
-
-
-/**
- * @open
- * @fn email_get_pending_job(emf_action_t action, int account_id, int mail_id, emf_event_status_type_t * status);
- * @brief      get pending job list.This function is invoked if user wants to get the pending job list with status information .
- *             Based on action item of a mail is for a specific account this will give all pending job list.
- *
- * @return     This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] account_id       Specifies the action of the job.
- * @param[in] account_id       Specifies the account ID.
- * @param[in] mail_id          Specifies the mail ID.
- * @param[out]status           Specifies the status of the job.
- * @exception   none
- * @see        emf_action_t and emf_event_status_type_t  
- * @remarks N/A
- */
-EXPORT_API int email_get_pending_job(emf_action_t action, int account_id, int mail_id, emf_event_status_type_t * status);
-
-
-/**
- * @open
- * @fn email_get_network_status(int* on_sending, int* on_receiving)
- * @brief      This function gives the  current network status.This gives the information to the user whether sending operation is in progress or receiving operation.
- *
- * @return     This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[out] on_sending              True if sending is in progress.
- * @param[out] on_receiving            True if receivng is in progress.
- * @exception  none
- * @see        none
- * @remarks N/A
- */
-EXPORT_API int email_get_network_status(int* on_sending, int* on_receiving);
-
-
-/**
- * @open
- * @fn email_send_report(emf_mail_t* mail, unsigned* handle)
- * @brief      Send a read receipt mail.This function is invoked when user receives a mail with read report enable and wants to send a read report for the same.
- *
- * @return     This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] mail                             Specifies the mail to been read.
- * @param[out] handle                  Specifies the handle for stopping sending.
- * @exception none
- * @see        emf_mail_t
- * @remarks N/A
- */
-EXPORT_API int email_send_report(emf_mail_t* mail,  unsigned* handle);
-
-
-/**
- * @open
- * @fn email_send_saved(int account_id, emf_option_t* sending_option, unsigned* handle)
- * @brief      Send all mails to been saved in Offline-mode.This function is invoked when user wants to send an email and after saving it.
- *             This will save the email in draft mailbox and then sends. 
- *
- * @return     This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] account_id                       Specifies the account ID.
- * @param[in] sending_option           Specifies the sending option.
- * @param[out] handle                          Specifies the handle for stopping sending.
- * @exception none
- * @see emf_option_t
- * @remarks N/A
- */
-EXPORT_API int email_send_saved(int account_id, emf_option_t* sending_option, unsigned* handle);
-
-
-EXPORT_API int email_download_mail_from_server(emf_mailbox_t * mailbox, const char * server_mail_id, unsigned* handle) DEPRECATED;
-
-
-/**
- * @open
- * @fn email_get_imap_mailbox_list(int account_id, char* mailbox, unsigned* handle)
- *  @brief     fetch all the mailbox names from server and store the non-existing mailboxes in DB.This function is invoked when user wants to download all server mailboxes from IMAP server
- *
- * @return     This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] account_id                       Specifies the account ID.
- * @param[in] mailbox                  Specifies the mailbox name.
- * @param[out] handle                  Specifies the handle for stopping Network operation.
- * @exception  none
- * @see        none
- * @remarks N/A
- */
-EXPORT_API int email_get_imap_mailbox_list(int account_id, const char* mailbox, unsigned* handle);
-
-
-
-/**
- * @open
- * @fn email_sync_local_activity(int account_id)
- *  @brief     sync local activity
- *
- * @return     This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] account_id                       Specifies the account ID.
- * @exception  none
- * @see        none
- * @remarks N/A
- */
-EXPORT_API int email_sync_local_activity(int account_id);
-
-
-/**
- * @open
- * @fn email_find_mail_on_server(int account_id, const char *mailbox_name, int search_type, char *search_value)
- * @brief      Search the mails on server.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] account_id       Specifies the Account ID
- * @param[in] mailbox_name     Specifies the Mailbox Name
- * @param[in] search_type      Specifies the searching type(EMF_SEARCH_FILTER_SUBJECT,  EMF_SEARCH_FILTER_SENDER, EMF_SEARCH_FILTER_RECIPIENT, EMF_SEARCH_FILTER_ALL)
- * @param[in] search_value     Specifies the value to use for searching. (ex : Subject, email address, display name)
- * @exception          none
- * @see
- * @code
- * @endcode
- * @remarks N/A
- */
-EXPORT_API int email_find_mail_on_server(int input_account_id, const char *input_mailbox_name, int input_search_type, char *input_search_value, unsigned *output_handle);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-/**
-* @}
-*/
-
-
-#endif /* __EMF_MAPI_NETWORK_H__ */
+/*\r
+*  email-service\r
+*\r
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+*\r
+* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com>\r
+*\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+* http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License.\r
+*\r
+*/\r
+\r
+\r
+#ifndef __EMAIL_API_NETWORK_H__\r
+#define __EMAIL_API_NETWORK_H__\r
+\r
+#include "email-types.h"\r
+\r
+/**\r
+* @defgroup EMAIL_SERVICE Email Service\r
+* @{\r
+*/\r
+\r
+/**\r
+* @ingroup EMAIL_SERVICE\r
+* @defgroup EMAIL_API_NETWORK Email Network API\r
+* @{\r
+*/\r
+\r
+/**\r
+ *\r
+ * This file contains the data structures and interfaces needed for application,\r
+ * to interact with email-service.\r
+ * @file               email-api-network.h\r
+ * @author     Kyuho Jo <kyuho.jo@samsung.com>\r
+ * @author     Sunghyun Kwon <sh0701.kwon@samsung.com>\r
+ * @version    0.1\r
+ * @brief              This file contains the data structures and interfaces of Network related Functionality provided by\r
+ *                     email-service .\r
+ *\r
+ * @{\r
+\r
+ * @code\r
+\r
+ *     #include "email-api.h"\r
+ *\r
+ *     bool\r
+ *     other_app_invoke_uniform_api_sample(int* error_code)\r
+ *     {\r
+ *\r
+ *             // Send a mail\r
+ *             emf_mailbox_t mbox;\r
+ *             emf_attachment_info_t attachment;\r
+ *             emf_option_t option;\r
+ *             int account_id = 1;\r
+ *             int err = EMF_ERROR_NONE;\r
+ *             int mail_id = 0;\r
+ *             char arg[50]; //Input attachment number need to be download\r
+ *             emf_event_status_type_t  status;\r
+ *             int action = -1;\r
+ *             int on_sending = 0;\r
+ *         int on_receiving = 0;\r
+ *\r
+*              printf("Enter mailbox name\n");\r
+ *             scanf("%s",&mbox.mailbox_name);\r
+ *             printf("Enter mail id\n");\r
+ *             scanf("%d",&mail_id);\r
+ *             option.keep_local_copy = 1;\r
+ *\r
+ *             if(EMF_ERROR_NONE == email_send_mail(&mbox, mail_id, &option, &handle))\r
+ *                     //success\r
+ *             else\r
+ *                     //failure\r
+ *\r
+ *             // Download header of new emails from mail server\r
+ *             unsigned handle = 0;\r
+ *\r
+ *             memset(&mbox, 0x00, sizeof(emf_mailbox_t));\r
+ *\r
+ *             mbox.account_id = account_id;\r
+ *             mbox.name = strdup("INBOX");\r
+ *             if(EMF_ERROR_NONE == email_sync_header (&mbox,&handle))\r
+ *                     //success\r
+ *             else\r
+ *                     //failure\r
+ *\r
+ *             //Sync mail header for all accounts\r
+ *             if(EMF_ERROR_NONE == email_sync_header_for_all_account(&handle))\r
+ *                     //success\r
+ *             else\r
+ *                     //failure\r
+ *\r
+ *             //Download email body from server\r
+ *\r
+ *             memset(&mbox, 0x00, sizeof(emf_mailbox_t));\r
+ *             mbox.account_id = account_id;\r
+ *             mbox.name = strdup("INBOX");\r
+ *             if(EMF_ERROR_NONE == email_download_body (&mbox,mail_id,0,&handle))\r
+ *                     //success\r
+ *             else\r
+ *                     //failure\r
+ *\r
+ *             //Download a email nth-attachment from server\r
+ *             prinf("Enter attachment number\n");\r
+ *             scanf("%s",arg);\r
+ *             memset(&mbox, 0x00, sizeof(emf_mailbox_t));\r
+ *             mbox.name = strdup("INBOX");\r
+ *             mbox.account_id = account_id;\r
+ *             if(EMF_ERROR_NONE == email_download_attachment(&mailbox,mail_id,arg,&handle))\r
+ *                     //success\r
+ *             else\r
+ *                     //failure\r
+ *\r
+ *             //Cancel job\r
+ *             if(EMF_ERROR_NONE == email_cancel_job(account_id,handle))//canceling download email nth attachment from server job.\r
+ *                                                                     //so this handle contains the value return by the email_download_attachment()\r
+ *                     //success\r
+ *             else\r
+ *                     //failure\r
+ *             //Get pending job listfor an account\r
+ *\r
+ *             printf( " Enter Action \n SEND_MAIL = 0 \n SYNC_HEADER = 1 \n" \\r
+ *                         " DOWNLOAD_BODY,= 2 \n DOWNLOAD_ATTACHMENT = 3 \n" \\r
+ *                         " DELETE_MAIL = 4 \n SEARCH_MAIL = 5 \n SAVE_MAIL = 6 \n" \\r
+ *                         " NUM = 7 \n");\r
+ *             scanf("%d",&action);\r
+ *             if(EMF_ERROR_NONE == email_get_pending_job(action,account_id,mail_id,&status))\r
+ *                     //success\r
+ *             else\r
+ *                     //error\r
+ *\r
+ *             //Get Network status\r
+ *             if(EMF_ERROR_NONE == email_get_network_status(&sending,&receiving))\r
+ *                     //success\r
+ *             else\r
+ *                     //failure\r
+ *\r
+ *             //Send read report\r
+ *             if(EMF_ERROR_NONE == email_send_report(mail ,&handle))\r
+ *                     //success\r
+ *             else\r
+ *                     //failure\r
+ *             //Save and send\r
+ *\r
+ *             mbox.account_id = account_id;\r
+ *             mbox.name = strdup("DRAFTBOX");\r
+ *\r
+ *             if(EMF_ERROR_NONE  == email_add_message(mail,&mbox,1))\r
+ *             {\r
+ *                     if(EMF_ERROR_NONE == email_send_saved(account_id,&option,&handle))\r
+ *                             //success\r
+ *                     else\r
+ *                             //failure\r
+ *             }\r
+ *             //Get Imap mailbox list\r
+ *             printf("\n > Enter server name:\n");\r
+ *             scanf("%s",arg);\r
+ *             if(EMF_ERROR_NONE == email_get_imap_mailbox_list(account_id , arg , &handle))\r
+ *                     //success\r
+ *             else\r
+ *                     //failure\r
+ *\r
+ *             //sync local activity\r
+ *             if(EMF_ERROR_NONE == email_sync_local_activity(account_id))\r
+ *                     //success\r
+ *             else\r
+ *                     //failure\r
+ * }\r
+ *\r
+ * @endcode\r
+ * @}\r
+\r
+ */\r
+\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif /* __cplusplus */\r
+\r
+/**\r
+ * @open\r
+ * @fn email_send_mail( emf_mailbox_t* mailbox, int mail_id, emf_option_t* sending_option, unsigned* handle)\r
+ * @brief      Send a mail.This function is invoked when user wants to send a composed mail.\r
+ *\r
+ * @return     This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] mailbox                  Specifies the mailbox to consist a sending email.\r
+ * @param[in] mail_id                  Specifies the mail ID.\r
+ * @param[in] sending_option           Specifies the sending option.\r
+ * @param[out] handle          Specifies the sending handle.\r
+ * @exception  none\r
+ * @see        emf_mailbox_t and emf_option_t\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_send_mail( emf_mailbox_t* mailbox,\r
+                               int mail_id,\r
+                               emf_option_t* sending_option,\r
+                               unsigned* handle);\r
+\r
+\r
+/**\r
+ * @open\r
+ * @fn email_sync_header(emf_mailbox_t* mailbox, unsigned* handle)\r
+ * @brief      Download header of new emails from mail server.This function is invoked when user wants to download only header of new mails.\r
+ *\r
+ * @return     This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] mailbox          Specifies the structure of mailbox.\r
+ * @param[out] handle          Specifies the handle for stopping downloading.\r
+ * @exception  none\r
+ * @see        emf_mailbox_t\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_sync_header(emf_mailbox_t* mailbox, unsigned* handle);\r
+\r
+\r
+/**\r
+ * @open\r
+ * @fn email_sync_header_for_all_account(unsigned* handle)\r
+ * @brief      Download header of new emails from mail server for all emails.This function is invoked when user wants to download header of new mails for all accounts.\r
+ *\r
+ * @return     This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[out] handle          Specifies the handle for stopping downloading.\r
+ * @exception none\r
+ * @see        none\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_sync_header_for_all_account(unsigned* handle);\r
+\r
+\r
+/**\r
+ * @open\r
+ * @fn email_download_body(emf_mailbox_t* mailbox, int mail_id, int with_attachment, unsigned* handle)\r
+ * @brief      Download email body from server.This function is invoked when user wants to download email body with/without attachment based on the option with_attachment\r
+ *             from the server.\r
+ *\r
+ * @return     This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] mailbox                  Specifies the structure of mailbox.\r
+ * @param[in] mail_id                  Specifies the mail ID.\r
+ * @param[in] with_attachment  Specifies the whether attachment is there or not.\r
+ * @param[out] handle          Specifies the handle for stopping downloading.\r
+ * @exception none\r
+ * @see emf_mailbox_t\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_download_body(emf_mailbox_t* mailbox, int mail_id, int with_attachment, unsigned* handle);\r
+\r
+\r
+\r
+\r
+\r
+\r
+/**\r
+ * @open\r
+ * @fn email_download_attachment(emf_mailbox_t* mailbox, int mail_id, char* nth, unsigned* handle);\r
+ * @brief      Download a email nth-attachment from server.This function is invoked if user wants to download only specific attachment of a mail whose body is already downloaded.\r
+ *\r
+ * @return     This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] mailbox          Reserved.\r
+ * @param[in] mail_id          Specifies the mail ID.\r
+ * @param[in] nth                      Specifies the buffer that a attachment number been saved. the minimum number is "1".\r
+ * @param[out] handle          Specifies the handle for stopping downloading.\r
+ * @exception none\r
+ * @see        emf_mailbox_t\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_download_attachment(emf_mailbox_t* mailbox,\r
+                                                       int mail_id,\r
+                                                       const char* nth,\r
+                                                       unsigned* handle);\r
+\r
+\r
+/**\r
+ * @open\r
+ * @fn email_cancel_job(int account_id, int handle);\r
+ * @brief      cancel the ongoing job.This function is invoked if user wants to cancel any ongoing job of a specified account.\r
+ *\r
+ * @return     This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] account_id       Specifies the account ID.\r
+ * @param[in] handle           Specifies the handle for stopping the operation.\r
+ * @exception   none\r
+ * @see        none\r
+ * @remarks N/A\r
+ */\r
+\r
+EXPORT_API int email_cancel_job(int account_id, int handle);\r
+\r
+\r
+/**\r
+ * @open\r
+ * @fn email_get_pending_job(emf_action_t action, int account_id, int mail_id, emf_event_status_type_t * status);\r
+ * @brief      get pending job list.This function is invoked if user wants to get the pending job list with status information .\r
+ *             Based on action item of a mail is for a specific account this will give all pending job list.\r
+ *\r
+ * @return     This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] account_id       Specifies the action of the job.\r
+ * @param[in] account_id       Specifies the account ID.\r
+ * @param[in] mail_id          Specifies the mail ID.\r
+ * @param[out]status           Specifies the status of the job.\r
+ * @exception   none\r
+ * @see        emf_action_t and emf_event_status_type_t\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_get_pending_job(emf_action_t action, int account_id, int mail_id, emf_event_status_type_t * status);\r
+\r
+\r
+/**\r
+ * @open\r
+ * @fn email_get_network_status(int* on_sending, int* on_receiving)\r
+ * @brief      This function gives the  current network status.This gives the information to the user whether sending operation is in progress or receiving operation.\r
+ *\r
+ * @return     This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[out] on_sending              True if sending is in progress.\r
+ * @param[out] on_receiving            True if receivng is in progress.\r
+ * @exception  none\r
+ * @see        none\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_get_network_status(int* on_sending, int* on_receiving);\r
+\r
+/**\r
+ * @open\r
+ * @fn email_send_saved(int account_id, emf_option_t* sending_option, unsigned* handle)\r
+ * @brief      Send all mails to been saved in Offline-mode.This function is invoked when user wants to send an email and after saving it.\r
+ *             This will save the email in draft mailbox and then sends.\r
+ *\r
+ * @return     This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] account_id                       Specifies the account ID.\r
+ * @param[in] sending_option           Specifies the sending option.\r
+ * @param[out] handle                          Specifies the handle for stopping sending.\r
+ * @exception none\r
+ * @see emf_option_t\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_send_saved(int account_id, emf_option_t* sending_option, unsigned* handle);\r
+\r
+/**\r
+ * @open\r
+ * @fn email_get_imap_mailbox_list(int account_id, char* mailbox, unsigned* handle)\r
+ *  @brief     fetch all the mailbox names from server and store the non-existing mailboxes in DB.This function is invoked when user wants to download all server mailboxes from IMAP server\r
+ *\r
+ * @return     This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] account_id                       Specifies the account ID.\r
+ * @param[in] mailbox                  Specifies the mailbox name.\r
+ * @param[out] handle                  Specifies the handle for stopping Network operation.\r
+ * @exception  none\r
+ * @see        none\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_get_imap_mailbox_list(int account_id, const char* mailbox, unsigned* handle);\r
+\r
+\r
+\r
+/**\r
+ * @open\r
+ * @fn email_sync_local_activity(int account_id)\r
+ *  @brief     sync local activity\r
+ *\r
+ * @return     This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] account_id                       Specifies the account ID.\r
+ * @exception  none\r
+ * @see        none\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_sync_local_activity(int account_id);\r
+\r
+\r
+/**\r
+ * @open\r
+ * @fn email_search_mail_on_server(int account_id, const char *mailbox_name, int search_type, char *search_value)\r
+ * @brief      Search the mails on server.\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] account_id       Specifies the Account ID\r
+ * @param[in] mailbox_name     Specifies the Mailbox Name\r
+ * @param[in] search_type      Specifies the searching type(EMF_SEARCH_FILTER_SUBJECT,  EMF_SEARCH_FILTER_SENDER, EMF_SEARCH_FILTER_RECIPIENT, EMF_SEARCH_FILTER_ALL)\r
+ * @param[in] search_value     Specifies the value to use for searching. (ex : Subject, email address, display name)\r
+ * @exception          none\r
+ * @see\r
+ * @code\r
+ * @endcode\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_search_mail_on_server(int input_account_id, const char *input_mailbox_name, email_search_filter_t *input_search_filter_list, int input_search_filter_count, unsigned *output_handle);\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif /* __cplusplus */\r
+\r
+/**\r
+* @}\r
+*/\r
+\r
+\r
+#endif /* __EMAIL_API_NETWORK_H__ */\r
similarity index 87%
rename from MAPI/include/Emf_Mapi_Rule.h
rename to email-api/include/email-api-rule.h
index 2accc6b..71a1ca2 100755 (executable)
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-#ifndef __EMF_MAPI_RULE_H__
-#define __EMF_MAPI_RULE_H__
-
-#include "emf-types.h"
-
-/**
-* @defgroup EMAIL_FRAMEWORK Email Service
-* @{
-*/
-
-/**
-* @ingroup EMAIL_FRAMEWORK
-* @defgroup EMAIL_MAPI_RULE Email Rule API
-* @{
-*/
-
- /**
- *
- * This file contains the data structures and interfaces needed for application,
- * to interact with Email Engine.
- * @file               Emf_Mapi_Rule.h
- * @author     Kyuho Jo <kyuho.jo@samsung.com>
- * @author     Sunghyun Kwon <sh0701.kwon@samsung.com>
- * @version    0.1
- * @brief              This file contains the data structures and interfaces of Rule related Functionality provided by 
- *                     Email Engine . 
- * @{
- * @code
- *     #include "Emf_Mapi_Rule.h"
- *     bool
- *     other_app_invoke_uniform_api_sample(int* error_code)
- *     {
- *             int err = EMF_ERROR_NONE;
- *             emf_rule_t*  rule = NULL;
- *             int filter_id = 1;
- *             int count = 0;
- *
- *             // Get a information of filtering
- *             printf("Enter filter Id:\n");
- *             scanf("%d",&filter_id);
- *             
- *             if(EMF_ERROR_NONE == email_get_rule (filter_id,&rule))
- *                     //success
- *             else
- *                     //failure
- *
- *             // Get all filterings 
- *             if(EMF_ERROR_NONE == email_get_rule_list(&rule,&count))
- *                     //success
- *             else
- *                     //failure
- *
- *
- *             // Add a filter information 
- *             if(EMF_ERROR_NONE == email_add_rule (rule))
- *                     //success
- *             else
- *                     //failure
- *             err = email_free_rule (&rule,1);
- *
- *             // Change a filter information 
- *             if(EMF_ERROR_NONE == email_update_rule (filter_id,rule))
- *                     //success
- *             else
- *                     //failure
- *             err = email_free_rule (&rule,1);
- *
- *             // Delete a filter information
- *             printf("Enter filter Id:\n");
- *             scanf("%d",&filter_id);
- *             
- *             if(EMF_ERROR_NONE == email_delete_rule (filter_id))
- *                     //success
- *             else
- *                     //failure
- *
- *             // Free allocated memory 
- *             if(EMF_ERROR_NONE == email_free_rule (&rule,1))
- *                     //success
- *             else
- *                     //failure
- *             
- *     }       
- *
- * @endcode
- * @}
- */
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/**
- * @open
- * @fn email_get_rule(int filter_id, emf_rule_t** filtering_set)
- * @brief      Get a information of filtering.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure
- * @param[in] filter_id                        Specifies the filter ID.
- * @param[out] filtering_set   The returned information of filter are saved here.
- * @exception  #EMF_ERROR-INVALID_PARAM        -Invalid argument
- * @see        emf_rule_t
- * @remarks N/A
- */
-EXPORT_API int email_get_rule(int filter_id, emf_rule_t** filtering_set);
-
-/**
- * @open
- * @fn email_get_rule_list(emf_rule_t** filtering_set, int* count)
- * @brief      Get all filterings.This function gives all the filter rules already set before by user.
- *             This will provide total number of filter rules available and information of all rules. 
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure
- * @param[out] filtering_set           The returned filterings are saved here.(possibly NULL)
- * @param[out] count                           The count of returned filters is saved here.(possibly 0)
- * @exception  #EMF_ERROR-INVALID_PARAM        -Invalid argument
- * @see        emf_rule_t
- * @remarks N/A
- */
-EXPORT_API int email_get_rule_list(emf_rule_t** filtering_set, int* count);
-
-/**
- * @open
- * @fn email_add_rule(emf_rule_t* filtering_set)
- * @brief      Add a filter information.This function is invoked if user wants to add a new filter rule.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] filtering_set            Specifies the pointer of adding filter structure.
- * @exception  #EMF_ERROR-INVALID_PARAM        -Invalid argument
- * @see        emf_rule_t
- * @remarks N/A
- */
-EXPORT_API int email_add_rule(emf_rule_t* filtering_set);
-
-/**
- * @open
- * @fn email_update_rule(int filter_id, emf_rule_t* new_set)
- * @brief      Change a filter information.This function will update the existing filter rule with new information.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.
- * @param[in] filter_id        Specifies the original filter ID.
- * @param[in] new_set  Specifies the information of new filter.
- * @exception  #EMF_ERROR-INVALID_PARAM        -Invalid argument
- * @see        emf_rule_t
- * @remarks N/A
- */
-EXPORT_API int email_update_rule(int filter_id, emf_rule_t* new_set);
-
-/**
- * @open
- * @fn email_delete_rule(int filter_id)
- * @brief      Delete a filter information.This function will delete the exsting filter information by specified filter Id.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure
- * @param[in] filter_id        Specifies the filter ID.
- * @exception  #EMF_ERROR-INVALID_PARAM        -Invalid argument
- * @see        none
- * @remarks N/A
- */
-EXPORT_API int email_delete_rule(int filter_id);
-
-
-
-/**
- * @open
- * @fn email_free_rule (emf_rule_t** filtering_set, int count)
- * @brief      Free allocated memory.
- *
- * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure
- * @param[in] filtering_set    Specifies the pointer of pointer of filter structure for memory free.
- * @param[in] count                    Specifies the count of filter.
- * @exception  #EMF_ERROR-INVALID_PARAM        -Invalid argument
- * @see        emf_rule_t
- * @remarks N/A
- */
-EXPORT_API int email_free_rule (emf_rule_t** filtering_set, int count);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-/**
-* @} @}
-*/
-
-
-#endif /* __EMF_MAPI_RULE_H__ */
+/*\r
+*  email-service\r
+*\r
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+*\r
+* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com>\r
+*\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+* http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License.\r
+*\r
+*/\r
+\r
+\r
+#ifndef __EMAIL_API_RULE_H__\r
+#define __EMAIL_API_RULE_H__\r
+\r
+#include "email-types.h"\r
+\r
+/**\r
+* @defgroup EMAIL_SERVICE Email Service\r
+* @{\r
+*/\r
+\r
+/**\r
+* @ingroup EMAIL_SERVICE\r
+* @defgroup EMAIL_API_RULE Email Rule API\r
+* @{\r
+*/\r
+\r
+ /**\r
+ *\r
+ * This file contains the data structures and interfaces needed for application,\r
+ * to interact with email-service.\r
+ * @file               email-api-rule.h\r
+ * @author     Kyuho Jo <kyuho.jo@samsung.com>\r
+ * @author     Sunghyun Kwon <sh0701.kwon@samsung.com>\r
+ * @version    0.1\r
+ * @brief              This file contains the data structures and interfaces of Rule related Functionality provided by\r
+ *                     email-service .\r
+ * @{\r
+\r
+ * @code\r
+ *     #include "email-api-rule.h"\r
+ *     bool\r
+ *     other_app_invoke_uniform_api_sample(int* error_code)\r
+ *     {\r
+ *             int err = EMF_ERROR_NONE;\r
+ *             emf_rule_t*  rule = NULL;\r
+ *             int filter_id = 1;\r
+ *             int count = 0;\r
+ *\r
+ *             // Get a information of filtering\r
+ *             printf("Enter filter Id:\n");\r
+ *             scanf("%d",&filter_id);\r
+ *\r
+ *             if(EMF_ERROR_NONE == email_get_rule (filter_id,&rule))\r
+ *                     //success\r
+ *             else\r
+ *                     //failure\r
+ *\r
+ *             // Get all filterings\r
+ *             if(EMF_ERROR_NONE == email_get_rule_list(&rule,&count))\r
+ *                     //success\r
+ *             else\r
+ *                     //failure\r
+ *\r
+ *\r
+ *             // Add a filter information\r
+ *             if(EMF_ERROR_NONE == email_add_rule (rule))\r
+ *                     //success\r
+ *             else\r
+ *                     //failure\r
+ *             err = email_free_rule (&rule,1);\r
+ *\r
+ *             // Change a filter information\r
+ *             if(EMF_ERROR_NONE == email_update_rule (filter_id,rule))\r
+ *                     //success\r
+ *             else\r
+ *                     //failure\r
+ *             err = email_free_rule (&rule,1);\r
+ *\r
+ *             // Delete a filter information\r
+ *             printf("Enter filter Id:\n");\r
+ *             scanf("%d",&filter_id);\r
+ *\r
+ *             if(EMF_ERROR_NONE == email_delete_rule (filter_id))\r
+ *                     //success\r
+ *             else\r
+ *                     //failure\r
+ *\r
+ *             // Free allocated memory\r
+ *             if(EMF_ERROR_NONE == email_free_rule (&rule,1))\r
+ *                     //success\r
+ *             else\r
+ *                     //failure\r
+ *\r
+ *     }\r
+ *\r
+ * @endcode\r
+ * @}\r
+ */\r
+\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif /* __cplusplus */\r
+\r
+/**\r
+\r
+ * @open\r
+ * @fn email_get_rule(int filter_id, emf_rule_t** filtering_set)\r
+ * @brief      Get a information of filtering.\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure\r
+ * @param[in] filter_id                        Specifies the filter ID.\r
+ * @param[out] filtering_set   The returned information of filter are saved here.\r
+ * @exception  #EMF_ERROR-INVALID_PARAM        -Invalid argument\r
+ * @see        emf_rule_t\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_get_rule(int filter_id, emf_rule_t** filtering_set);\r
+\r
+/**\r
+\r
+ * @open\r
+ * @fn email_get_rule_list(emf_rule_t** filtering_set, int* count)\r
+ * @brief      Get all filterings.This function gives all the filter rules already set before by user.\r
+ *             This will provide total number of filter rules available and information of all rules.\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure\r
+ * @param[out] filtering_set           The returned filterings are saved here.(possibly NULL)\r
+ * @param[out] count                           The count of returned filters is saved here.(possibly 0)\r
+ * @exception  #EMF_ERROR-INVALID_PARAM        -Invalid argument\r
+ * @see        emf_rule_t\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_get_rule_list(emf_rule_t** filtering_set, int* count);\r
+\r
+/**\r
+\r
+ * @open\r
+ * @fn email_add_rule(emf_rule_t* filtering_set)\r
+ * @brief      Add a filter information.This function is invoked if user wants to add a new filter rule.\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] filtering_set            Specifies the pointer of adding filter structure.\r
+ * @exception  #EMF_ERROR-INVALID_PARAM        -Invalid argument\r
+ * @see        emf_rule_t\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_add_rule(emf_rule_t* filtering_set);\r
+\r
+/**\r
+\r
+ * @open\r
+ * @fn email_update_rule(int filter_id, emf_rule_t* new_set)\r
+ * @brief      Change a filter information.This function will update the existing filter rule with new information.\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
+ * @param[in] filter_id        Specifies the original filter ID.\r
+ * @param[in] new_set  Specifies the information of new filter.\r
+ * @exception  #EMF_ERROR-INVALID_PARAM        -Invalid argument\r
+ * @see        emf_rule_t\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_update_rule(int filter_id, emf_rule_t* new_set);\r
+\r
+/**\r
+\r
+ * @open\r
+ * @fn email_delete_rule(int filter_id)\r
+ * @brief      Delete a filter information.This function will delete the exsting filter information by specified filter Id.\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure\r
+ * @param[in] filter_id        Specifies the filter ID.\r
+ * @exception  #EMF_ERROR-INVALID_PARAM        -Invalid argument\r
+ * @see        none\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_delete_rule(int filter_id);\r
+\r
+\r
+\r
+/**\r
+\r
+ * @open\r
+ * @fn email_free_rule (emf_rule_t** filtering_set, int count)\r
+ * @brief      Free allocated memory.\r
+ *\r
+ * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure\r
+ * @param[in] filtering_set    Specifies the pointer of pointer of filter structure for memory free.\r
+ * @param[in] count                    Specifies the count of filter.\r
+ * @exception  #EMF_ERROR-INVALID_PARAM        -Invalid argument\r
+ * @see        emf_rule_t\r
+ * @remarks N/A\r
+ */\r
+EXPORT_API int email_free_rule (emf_rule_t** filtering_set, int count);\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif /* __cplusplus */\r
+\r
+/**\r
+* @} @}\r
+*/\r
+\r
+\r
+#endif /* __EMAIL_API_RULE_H__ */\r
diff --git a/email-api/include/email-api.h b/email-api/include/email-api.h
new file mode 100755 (executable)
index 0000000..67e7f2d
--- /dev/null
@@ -0,0 +1,74 @@
+/*\r
+*  email-service\r
+*\r
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+*\r
+* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com>\r
+*\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+* http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License.\r
+*\r
+*/\r
+\r
+\r
+#ifndef __EMAIL_API_H__\r
+#define __EMAIL_API_H__\r
+\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+#include "email-types.h"\r
+#include "email-api-account.h"\r
+#include "email-api-init.h"\r
+#include "email-api-mail.h"\r
+#include "email-api-mailbox.h"\r
+#include "email-api-network.h"\r
+#include "email-api-rule.h"\r
+\r
+\r
+/**\r
+* @defgroup EMAIL_SERVICE Email Service\r
+* @{\r
+*/\r
+\r
+/**\r
+* @{\r
+*/\r
+\r
+/**\r
+ *\r
+ * This file contains the data structures and interfaces needed for application,\r
+ * to interact with email-service.\r
+ * @file               email-api.h\r
+ * @author     Kyuho Jo <kyuho.jo@samsung.com>\r
+ * @author     Sunghyun Kwon <sh0701.kwon@samsung.com>\r
+ * @version    0.1\r
+ * @brief              This file contains the data structures and interfaces provided by\r
+ *                     email-service.\r
+ */\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif /* __cplusplus */\r
+\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+/**\r
+* @} @}\r
+*/\r
+\r
+#endif /* __EMAIL_MAPI_H__ */\r
+\r
+\r
diff --git a/email-common-use/CMakeLists.txt b/email-common-use/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..df3e34e
--- /dev/null
@@ -0,0 +1,50 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(email-common-use)
+
+SET(CMAKE_SKIP_BUILD_RPATH TRUE)
+
+IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+       SET(CMAKE_BUILD_TYPE "Debug")
+ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+
+MESSAGE("")
+MESSAGE(">>> current directory: ${CMAKE_CURRENT_SOURCE_DIR}")
+MESSAGE(">>> Build type: ${CMAKE_BUILD_TYPE}")
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VISIBILITY} -fvisibility=hidden")
+
+SET(COMMON-USE-LIB "email-common-use")
+SET(COMMON-USE-SRCS 
+       ${CMAKE_SOURCE_DIR}/email-common-use/email-convert.c
+       ${CMAKE_SOURCE_DIR}/email-common-use/email-utilities.c
+)
+
+INCLUDE_DIRECTORIES(
+       ${CMAKE_SOURCE_DIR}/email-daemon/include
+       ${CMAKE_SOURCE_DIR}/email-common-use/include/ 
+       ${CMAKE_SOURCE_DIR}/email-core/include/
+       ${CMAKE_SOURCE_DIR}/email-core/email-storage/include/
+)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(common_pkgs REQUIRED glib-2.0 dlog vconf contacts-service uw-imap-toolkit) 
+
+FOREACH(flag ${common_pkgs_CFLAGS})
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+#message(">>>[${COMMON-USE-LIB}] extra_cflags ${EXTRA_CFLAGS}")
+#message(">>>[${COMMON-USE-LIB}] common_pkgs_cflags ${common_pkgs_CFLAGS}")
+#message(">>>[${COMMON-USE-LIB}] result ${CMAKE_C_FLAGS}")
+
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
+
+ADD_LIBRARY(${COMMON-USE-LIB} SHARED ${COMMON-USE-SRCS})
+TARGET_LINK_LIBRARIES(${COMMON-USE-LIB} ${common_pkgs_LDFLAGS})
+SET_TARGET_PROPERTIES(${COMMON-USE-LIB} PROPERTIES SOVERSION ${VERSION_MAJOR})
+SET_TARGET_PROPERTIES(${COMMON-USE-LIB} PROPERTIES VERSION ${VERSION})
+
+#INSTALL(TARGETS ${COMMON-USE-LIB} LIBRARY DESTINATION lib)
+INSTALL(TARGETS ${COMMON-USE-LIB} DESTINATION lib COMPONENT RuntimeLibraries)
+
similarity index 76%
rename from Common/Msg_Convert.c
rename to email-common-use/email-convert.c
index 9112417..7b11f77 100755 (executable)
 *
 */
 
-#include<stdlib.h>
-#include<stdio.h>
+#include <stdlib.h>
+#include <stdio.h>
 #include "string.h"
-#include "emflib.h"
-#include "Msg_Convert.h"
-#include "em-core-mesg.h"
-#include "emf-dbglog.h"
-#include "em-storage.h"
+#include "email-convert.h"
+#include "email-core-mail.h"
+#include "email-debug-log.h"
+#include "email-core-utils.h"
+#include "email-utilities.h"
+#include "email-storage.h"
 
 
 #define fSEEN 0x1
@@ -38,7 +39,7 @@
 #define fATTACHMENT 0x40
 #define fFORWARD    0x80
 
-EXPORT_API int em_convert_mail_flag_to_int(emf_mail_flag_t flag, int *i_flag, int *err_code)
+INTERNAL_FUNC int em_convert_mail_flag_to_int(emf_mail_flag_t flag, int *i_flag, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("i_flag[%p], err_code[%p]", i_flag, err_code);
        
@@ -63,7 +64,7 @@ EXPORT_API int em_convert_mail_flag_to_int(emf_mail_flag_t flag, int *i_flag, in
        return true;
 }
 
-EXPORT_API int em_convert_mail_int_to_flag(int i_flag, emf_mail_flag_t* flag, int* err_code)
+INTERNAL_FUNC int em_convert_mail_int_to_flag(int i_flag, emf_mail_flag_t* flag, int* err_code)
 {
        EM_DEBUG_FUNC_BEGIN("i_flag[0x%02x], flag[%p], err_code[%p]", i_flag, flag, err_code);
        
@@ -89,7 +90,7 @@ EXPORT_API int em_convert_mail_int_to_flag(int i_flag, emf_mail_flag_t* flag, in
     return true;
 }
 
-EXPORT_API int em_convert_mail_tbl_to_mail_status(emf_mail_tbl_t *mail_tbl_data, int *result_mail_status, int* err_code)
+INTERNAL_FUNC int em_convert_mail_tbl_to_mail_status(emstorage_mail_tbl_t *mail_tbl_data, int *result_mail_status, int* err_code)
 {
        EM_DEBUG_FUNC_BEGIN("mail_tbl_data[%p], result_mail_status [%p], err_code[%p]", mail_tbl_data, result_mail_status, err_code);
        int ret = false, error_code = EMF_ERROR_NONE;
@@ -109,7 +110,7 @@ EXPORT_API int em_convert_mail_tbl_to_mail_status(emf_mail_tbl_t *mail_tbl_data,
                              (mail_tbl_data->flags_answered_field  ? fANSWERED   : 0) |
                              (mail_tbl_data->flags_recent_field    ? fOLD        : 0) |
                              (mail_tbl_data->flags_draft_field     ? fDRAFT      : 0) |
-                             (has_attachment                  ? fATTACHMENT : 0) |
+                             (has_attachment                       ? fATTACHMENT : 0) |
                              (mail_tbl_data->flags_forwarded_field ? fFORWARD    : 0);
 
        ret = true;
@@ -121,7 +122,7 @@ FINISH_OFF:
        return ret;
        }
        
-EXPORT_API int em_convert_mail_status_to_mail_tbl(int mail_status, emf_mail_tbl_t *result_mail_tbl_data, int* err_code)
+INTERNAL_FUNC int em_convert_mail_status_to_mail_tbl(int mail_status, emstorage_mail_tbl_t *result_mail_tbl_data, int* err_code)
 {
        EM_DEBUG_FUNC_BEGIN("mail_status[%d], result_mail_tbl_data [%p], err_code[%p]", mail_status, result_mail_tbl_data, err_code);
        int ret = false, error_code = EMF_ERROR_NONE;
@@ -149,7 +150,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_convert_mail_tbl_to_mail_flag(emf_mail_tbl_t *mail_tbl_data, emf_mail_flag_t *result_flag, int* err_code)
+INTERNAL_FUNC int em_convert_mail_tbl_to_mail_flag(emstorage_mail_tbl_t *mail_tbl_data, emf_mail_flag_t *result_flag, int* err_code)
 {
        EM_DEBUG_FUNC_BEGIN("mail_tbl_data[%p], result_flag [%p], err_code[%p]", mail_tbl_data, result_flag, err_code);
        int ret = false, error_code = EMF_ERROR_NONE;
@@ -178,7 +179,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_convert_mail_flag_to_mail_tbl(emf_mail_flag_t *flag, emf_mail_tbl_t *result_mail_tbl_data,  int* err_code)
+INTERNAL_FUNC int em_convert_mail_flag_to_mail_tbl(emf_mail_flag_t *flag, emstorage_mail_tbl_t *result_mail_tbl_data,  int* err_code)
 {
        EM_DEBUG_FUNC_BEGIN("flag[%p], result_mail_tbl_data [%p], err_code[%p]", flag, result_mail_tbl_data, err_code);
        int ret = false, error_code = EMF_ERROR_NONE;
@@ -207,7 +208,7 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int em_convert_account_to_account_tbl(emf_account_t *account, emf_mail_account_tbl_t *account_tbl)
+INTERNAL_FUNC int em_convert_account_to_account_tbl(emf_account_t *account, emstorage_account_tbl_t *account_tbl)
 {
        EM_DEBUG_FUNC_BEGIN("account[%p], account_tbl[%p]", account, account_tbl);
        int ret = 1;
@@ -237,7 +238,7 @@ EXPORT_API int em_convert_account_to_account_tbl(emf_account_t *account, emf_mai
        account_tbl->flag1 = account->flag1;
        account_tbl->flag2 = account->flag2;
        account_tbl->pop_before_smtp = account->pop_before_smtp;
-       account_tbl->apop =  account_tbl->apop;
+       account_tbl->apop =  account->apop;
        account_tbl->logo_icon_path = EM_SAFE_STRDUP(account->logo_icon_path);
        account_tbl->preset_account = account->preset_account;
        account_tbl->options.priority = account->options.priority;
@@ -263,7 +264,7 @@ EXPORT_API int em_convert_account_to_account_tbl(emf_account_t *account, emf_mai
        return ret;
 }
 
-EXPORT_API int em_convert_account_tbl_to_account(emf_mail_account_tbl_t *account_tbl, emf_account_t *account)
+INTERNAL_FUNC int em_convert_account_tbl_to_account(emstorage_account_tbl_t *account_tbl, emf_account_t *account)
 {
        EM_DEBUG_FUNC_BEGIN("account_tbl[%p], account[%p]", account_tbl, account);
        int ret = 1;
@@ -319,46 +320,7 @@ EXPORT_API int em_convert_account_tbl_to_account(emf_mail_account_tbl_t *account
        return ret;
 }
 
-
-EXPORT_API int em_convert_mail_tbl_to_mail(emf_mail_tbl_t *mail_table_data, emf_mail_t *mail_data)
-{
-       EM_DEBUG_FUNC_BEGIN("mail_table_data[%p], mail_data[%p]", mail_table_data, mail_data);
-       int ret = 1, err_code = EMF_ERROR_NONE;
-
-       if (!mail_table_data || !mail_data) {
-               EM_DEBUG_EXCEPTION("Invalid parameter");
-               return 0;
-       }
-
-       if (mail_data->info) 
-               em_core_mail_info_free(&(mail_data->info), 1, NULL);
-       
-       if (mail_data->head)
-               em_core_mail_head_free(&(mail_data->head), 1, NULL);
-       
-       if (mail_data->body)
-               em_core_mail_body_free(&(mail_data->body), 1, NULL);
-
-       if (!em_core_mail_get_info_from_mail_tbl(&(mail_data->info), mail_table_data, &err_code)) {
-               EM_DEBUG_EXCEPTION("em_core_mail_get_info_from_mail_tbl failed [%d]", err_code);
-               return 0;
-       }
-
-       if (!em_core_mail_get_header_from_mail_tbl(&(mail_data->head), mail_table_data, &err_code)) {
-               EM_DEBUG_EXCEPTION("em_core_mail_get_header_from_mail_tbl failed [%d]", err_code);
-               return 0;
-       }
-
-       if (!em_core_mail_get_body_from_mail_tbl(&(mail_data->body), mail_table_data, &err_code)) {
-               EM_DEBUG_EXCEPTION("em_core_mail_get_header_from_mail_tbl failed [%d]", err_code);
-               return 0;
-       }
-
-       EM_DEBUG_FUNC_END();
-       return ret;
-}
-
-EXPORT_API int em_convert_mail_tbl_to_mail_data(emf_mail_tbl_t *mail_table_data, int item_count, emf_mail_data_t **mail_data, int *error)
+INTERNAL_FUNC int em_convert_mail_tbl_to_mail_data(emstorage_mail_tbl_t *mail_table_data, int item_count, emf_mail_data_t **mail_data, int *error)
 {
        EM_DEBUG_FUNC_BEGIN("mail_table_data[%p], item_count [%d], mail_data[%p]", mail_table_data, item_count, mail_data);
        int i, ret = false, err_code = EMF_ERROR_NONE;
@@ -370,10 +332,10 @@ EXPORT_API int em_convert_mail_tbl_to_mail_data(emf_mail_tbl_t *mail_table_data,
                goto FINISH_OFF;
        }
 
-       temp_mail_data = em_core_malloc(sizeof(emf_mail_data_t) * item_count);
+       temp_mail_data = em_malloc(sizeof(emf_mail_data_t) * item_count);
        
        if(!temp_mail_data) {
-               EM_DEBUG_EXCEPTION("em_core_malloc failed");
+               EM_DEBUG_EXCEPTION("em_malloc failed");
                err_code = EMF_ERROR_OUT_OF_MEMORY;
                goto FINISH_OFF;
        }
@@ -384,7 +346,7 @@ EXPORT_API int em_convert_mail_tbl_to_mail_data(emf_mail_tbl_t *mail_table_data,
                temp_mail_data[i].mailbox_name            = EM_SAFE_STRDUP(mail_table_data[i].mailbox_name);
                temp_mail_data[i].mailbox_type            = mail_table_data[i].mailbox_type;
                temp_mail_data[i].subject                 = EM_SAFE_STRDUP(mail_table_data[i].subject);
-               temp_mail_data[i].datetime                = EM_SAFE_STRDUP(mail_table_data[i].datetime);
+               temp_mail_data[i].date_time               = mail_table_data[i].date_time;
                temp_mail_data[i].server_mail_status      = mail_table_data[i].server_mail_status;
                temp_mail_data[i].server_mailbox_name     = EM_SAFE_STRDUP(mail_table_data[i].server_mailbox_name);
                temp_mail_data[i].server_mail_id          = EM_SAFE_STRDUP(mail_table_data[i].server_mail_id);
@@ -435,11 +397,11 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int   em_convert_mail_data_to_mail_tbl(emf_mail_data_t *mail_data, int item_count, emf_mail_tbl_t **mail_table_data, int *error)
+INTERNAL_FUNC int   em_convert_mail_data_to_mail_tbl(emf_mail_data_t *mail_data, int item_count, emstorage_mail_tbl_t **mail_table_data, int *error)
 {
        EM_DEBUG_FUNC_BEGIN("mail_data[%p], item_count [%d], mail_table_data[%p]", mail_data, item_count, mail_table_data);
        int i, ret = false, err_code = EMF_ERROR_NONE;
-       emf_mail_tbl_t *temp_mail_tbl = NULL;
+       emstorage_mail_tbl_t *temp_mail_tbl = NULL;
 
        if (!mail_data || !mail_table_data || !item_count) {
                EM_DEBUG_EXCEPTION("Invalid parameter");
@@ -447,10 +409,10 @@ EXPORT_API int   em_convert_mail_data_to_mail_tbl(emf_mail_data_t *mail_data, in
                goto FINISH_OFF;
        }
 
-       temp_mail_tbl = em_core_malloc(sizeof(emf_mail_tbl_t) * item_count);
+       temp_mail_tbl = em_malloc(sizeof(emstorage_mail_tbl_t) * item_count);
        
        if(!temp_mail_tbl) {
-               EM_DEBUG_EXCEPTION("em_core_malloc failed");
+               EM_DEBUG_EXCEPTION("em_malloc failed");
                err_code = EMF_ERROR_OUT_OF_MEMORY;
                goto FINISH_OFF;
        }
@@ -460,8 +422,8 @@ EXPORT_API int   em_convert_mail_data_to_mail_tbl(emf_mail_data_t *mail_data, in
                temp_mail_tbl[i].account_id              = mail_data[i].account_id;
                temp_mail_tbl[i].mailbox_name            = EM_SAFE_STRDUP(mail_data[i].mailbox_name);
                temp_mail_tbl[i].mailbox_type            = mail_data[i].mailbox_type;
+               temp_mail_tbl[i].date_time               = mail_data[i].date_time;
                temp_mail_tbl[i].subject                 = EM_SAFE_STRDUP(mail_data[i].subject);
-               temp_mail_tbl[i].datetime                = EM_SAFE_STRDUP(mail_data[i].datetime);
                temp_mail_tbl[i].server_mail_status      = mail_data[i].server_mail_status;
                temp_mail_tbl[i].server_mailbox_name     = EM_SAFE_STRDUP(mail_data[i].server_mailbox_name);
                temp_mail_tbl[i].server_mail_id          = EM_SAFE_STRDUP(mail_data[i].server_mail_id);
@@ -514,71 +476,75 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int em_convert_string_to_datetime(char *datetime_str/* YYYYMMDDHHMMSS */, emf_datetime_t* datetime, int *err_code)
+
+INTERNAL_FUNC int em_convert_string_to_time_t(char *input_datetime_string, time_t *output_time)
 {
-       EM_DEBUG_FUNC_BEGIN("datetime_str[%s], datetime[%p], err_code[%p]", datetime_str, datetime, err_code);
-       
-       char buf[16];
-       
-       if (!datetime_str || !datetime) {
-               EM_DEBUG_EXCEPTION("datetime_str[%p], datetime[%p]", datetime_str, datetime);
-               if (err_code != NULL)
-                       *err_code = EMF_ERROR_INVALID_PARAM;
-               return false;
+       EM_DEBUG_FUNC_BEGIN("input_datetime_string[%s], output_time[%p]", input_datetime_string, output_time);
+
+       char buf[16] = { 0, };
+       struct tm temp_time_info = { 0 };
+
+       if (!input_datetime_string || !output_time) {
+               EM_DEBUG_EXCEPTION("input_datetime_string[%p], output_time[%p]", input_datetime_string, output_time);
+               return EMF_ERROR_INVALID_PARAM;
        }
-       
+
        memset(buf, 0x00, sizeof(buf));
-       SNPRINTF(buf, sizeof(buf), "%.4s", datetime_str);
-       datetime->year = atoi(buf);
-       EM_DEBUG_LOG("datetime->year[%d]", datetime->year);
+       SNPRINTF(buf, sizeof(buf), "%.4s", input_datetime_string);
+       temp_time_info.tm_year = atoi(buf) - 1970;
+
        memset(buf, 0x00, sizeof(buf));
-       SNPRINTF(buf, sizeof(buf), "%.2s", datetime_str + 4);
-       datetime->month = atoi(buf);
-       
+       SNPRINTF(buf, sizeof(buf), "%.2s", input_datetime_string + 4);
+       temp_time_info.tm_mon = atoi(buf) - 1;
+
        memset(buf, 0x00, sizeof(buf));
-       SNPRINTF(buf, sizeof(buf), "%.2s", datetime_str + 6);
-       datetime->day = atoi(buf);
-       
+       SNPRINTF(buf, sizeof(buf), "%.2s", input_datetime_string + 6);
+       temp_time_info.tm_mday = atoi(buf);
+
        memset(buf, 0x00, sizeof(buf));
-       SNPRINTF(buf, sizeof(buf), "%.2s", datetime_str + 8);
-       datetime->hour = atoi(buf);
-       
+       SNPRINTF(buf, sizeof(buf), "%.2s", input_datetime_string + 8);
+       temp_time_info.tm_hour = atoi(buf);
+
        memset(buf, 0x00, sizeof(buf));
-       SNPRINTF(buf, sizeof(buf), "%.2s", datetime_str + 10);
-       datetime->minute = atoi(buf);
-       
+       SNPRINTF(buf, sizeof(buf), "%.2s", input_datetime_string + 10);
+       temp_time_info.tm_min = atoi(buf);
+
        memset(buf, 0x00, sizeof(buf));
-       SNPRINTF(buf, sizeof(buf), "%.2s", datetime_str + 12);
-       datetime->second = atoi(buf);
-       
-       if (err_code != NULL)
-               *err_code = EMF_ERROR_NONE;
-       EM_DEBUG_FUNC_END();
-       return true;
+       SNPRINTF(buf, sizeof(buf), "%.2s", input_datetime_string + 12);
+       temp_time_info.tm_sec = atoi(buf);
+
+       *output_time = timegm(&temp_time_info);
+
+       EM_DEBUG_LOG("*output_time [%d", *output_time);
+
+       EM_DEBUG_FUNC_END("err %d", EMF_ERROR_NONE);
+       return EMF_ERROR_NONE;
 }
 
-EXPORT_API int   em_convert_datetime_to_string(emf_datetime_t *input_datetime, char **output_datetime_str, int *err_code)
+INTERNAL_FUNC int em_convert_time_t_to_string(time_t *input_time, char **output_datetime_string)
 {
-       EM_DEBUG_FUNC_BEGIN("input_datetime[%s], output_datetime_str[%p], err_code[%p]", input_datetime, output_datetime_str, err_code);
+       EM_DEBUG_FUNC_BEGIN("input_time[%p], output_datetime_string[%p]", input_time, output_datetime_string);
        char temp_buffer[20] = { 0, };
-       
-       if (!input_datetime || !output_datetime_str) {
+       struct tm *temp_time_info;
+
+       if (!input_time || !output_datetime_string) {
                EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
-               if (err_code != NULL)
-                       *err_code = EMF_ERROR_INVALID_PARAM;
-               return false;
+               return EMF_ERROR_INVALID_PARAM;
        }
 
-       SNPRINTF(temp_buffer, sizeof(temp_buffer), "%04d%02d%02d%02d%02d%02d", 
-               input_datetime->year, input_datetime->month, input_datetime->day, input_datetime->hour, input_datetime->minute, input_datetime->second);
+       temp_time_info = localtime(input_time);
 
-       *output_datetime_str = EM_SAFE_STRDUP(temp_buffer);
+       if(!temp_time_info) {
+               EM_DEBUG_EXCEPTION("localtime failed.");
+               return EMF_ERROR_SYSTEM_FAILURE;
+       }
+       SNPRINTF(temp_buffer, sizeof(temp_buffer), "%04d%02d%02d%02d%02d%02d",
+               temp_time_info->tm_year + 1970, temp_time_info->tm_mon, temp_time_info->tm_mday, temp_time_info->tm_hour, temp_time_info->tm_min, temp_time_info->tm_sec);
 
-       if (err_code != NULL)
-               *err_code = EMF_ERROR_NONE;
+       *output_datetime_string = EM_SAFE_STRDUP(temp_buffer);
 
-       EM_DEBUG_FUNC_END();
-       return true;
+       EM_DEBUG_FUNC_END("err %d", EMF_ERROR_NONE);
+       return EMF_ERROR_NONE;
 }
 
 static char* append_sized_data_to_stream(char *input_stream, int *input_output_stream_length, char *input_sized_data, int input_data_size)
@@ -595,7 +561,7 @@ static char* append_sized_data_to_stream(char *input_stream, int *input_output_s
 
        source_stream_length = *input_output_stream_length;
 
-       new_stream = (char*)em_core_malloc((source_stream_length) * sizeof(char) + input_data_size);    
+       new_stream = (char*)em_malloc((source_stream_length) * sizeof(char) + input_data_size); 
 
        if(!new_stream) {
                EM_DEBUG_EXCEPTION("EMF_ERROR_OUT_OF_MEMORY");
@@ -631,7 +597,7 @@ static char* append_string_to_stream(char *input_stream, int *input_output_strea
        if(input_source_string != NULL)
                data_length = EM_SAFE_STRLEN(input_source_string);
 
-       new_stream = (char*)em_core_malloc((source_stream_length + data_length) * sizeof(char) + sizeof(int));  
+       new_stream = (char*)em_malloc((source_stream_length + data_length) * sizeof(char) + sizeof(int));       
 
        if(!new_stream) {
                EM_DEBUG_EXCEPTION("EMF_ERROR_OUT_OF_MEMORY");
@@ -699,7 +665,7 @@ static int fetch_string_from_stream(char *input_stream, int *input_output_stream
        */
 
        if(string_length != 0) {
-               result_string = (char*)em_core_malloc(string_length + 1);
+               result_string = (char*)em_malloc(string_length + 1);
                if(result_string) {
                        memcpy(result_string, input_stream + stream_offset, string_length);
                        stream_offset += string_length;
@@ -717,7 +683,7 @@ static int fetch_string_from_stream(char *input_stream, int *input_output_stream
        return EMF_ERROR_NONE;
 }
 
-EXPORT_API char* em_convert_account_to_byte_stream(emf_account_t* input_account, int *output_stream_size)
+INTERNAL_FUNC char* em_convert_account_to_byte_stream(emf_account_t* input_account, int *output_stream_size)
 {
        EM_DEBUG_FUNC_BEGIN("input_account [%p], output_stream_size [%p]", input_account, output_stream_size);
        char *result_stream = NULL;
@@ -779,7 +745,7 @@ EXPORT_API char* em_convert_account_to_byte_stream(emf_account_t* input_account,
 }
 
 
-EXPORT_API void em_convert_byte_stream_to_account(char *input_stream,  emf_account_t *output_account)
+INTERNAL_FUNC void em_convert_byte_stream_to_account(char *input_stream,  emf_account_t *output_account)
 {
        EM_DEBUG_FUNC_BEGIN();
        int stream_offset = 0;
@@ -837,163 +803,7 @@ EXPORT_API void em_convert_byte_stream_to_account(char *input_stream,  emf_accou
        EM_DEBUG_FUNC_END();
 }
 
-
-EXPORT_API char* em_convert_mail_head_to_byte_stream(emf_mail_head_t *input_mail_head, int *output_stream_size)
-{      
-       EM_DEBUG_FUNC_BEGIN();
-       
-       char *result_stream = NULL;
-       int   stream_size = 0;
-       
-       EM_IF_NULL_RETURN_VALUE(input_mail_head, NULL);
-       EM_IF_NULL_RETURN_VALUE(output_stream_size, NULL);
-
-       result_stream = append_string_to_stream(result_stream, &stream_size, input_mail_head->mid);
-       result_stream = append_string_to_stream(result_stream, &stream_size, input_mail_head->subject);
-       result_stream = append_string_to_stream(result_stream, &stream_size, input_mail_head->to);
-       result_stream = append_string_to_stream(result_stream, &stream_size, input_mail_head->from);
-       result_stream = append_string_to_stream(result_stream, &stream_size, input_mail_head->cc);
-       result_stream = append_string_to_stream(result_stream, &stream_size, input_mail_head->bcc);
-       result_stream = append_string_to_stream(result_stream, &stream_size, input_mail_head->reply_to);
-       result_stream = append_string_to_stream(result_stream, &stream_size, input_mail_head->return_path);
-       result_stream = append_sized_data_to_stream(result_stream, &stream_size, (char*)&input_mail_head->datetime.year, sizeof(unsigned short));
-       result_stream = append_sized_data_to_stream(result_stream, &stream_size, (char*)&input_mail_head->datetime.month, sizeof(unsigned short));
-       result_stream = append_sized_data_to_stream(result_stream, &stream_size, (char*)&input_mail_head->datetime.day, sizeof(unsigned short));
-       result_stream = append_sized_data_to_stream(result_stream, &stream_size, (char*)&input_mail_head->datetime.hour, sizeof(unsigned short));
-       result_stream = append_sized_data_to_stream(result_stream, &stream_size, (char*)&input_mail_head->datetime.minute, sizeof(unsigned short));
-       result_stream = append_sized_data_to_stream(result_stream, &stream_size, (char*)&input_mail_head->datetime.second, sizeof(unsigned short));
-       result_stream = append_string_to_stream(result_stream, &stream_size, input_mail_head->from_contact_name);
-       result_stream = append_string_to_stream(result_stream, &stream_size, input_mail_head->to_contact_name);
-       result_stream = append_string_to_stream(result_stream, &stream_size, input_mail_head->cc_contact_name);
-       result_stream = append_string_to_stream(result_stream, &stream_size, input_mail_head->bcc_contact_name);
-       result_stream = append_string_to_stream(result_stream, &stream_size, input_mail_head->previewBodyText);
-
-       *output_stream_size = stream_size;
-
-       EM_DEBUG_FUNC_END();
-       return result_stream;
-}
-
-EXPORT_API void em_convert_byte_stream_to_mail_head(char *input_stream, emf_mail_head_t *output_mail_head)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int stream_offset = 0;
-
-       EM_NULL_CHECK_FOR_VOID(input_stream);
-       EM_NULL_CHECK_FOR_VOID(output_mail_head);
-
-       fetch_string_from_stream(input_stream, &stream_offset, &output_mail_head->mid);
-       fetch_string_from_stream(input_stream, &stream_offset, &output_mail_head->subject);
-       fetch_string_from_stream(input_stream, &stream_offset, &output_mail_head->to);
-       fetch_string_from_stream(input_stream, &stream_offset, &output_mail_head->from);
-       fetch_string_from_stream(input_stream, &stream_offset, &output_mail_head->cc);
-       fetch_string_from_stream(input_stream, &stream_offset, &output_mail_head->bcc);
-       fetch_string_from_stream(input_stream, &stream_offset, &output_mail_head->reply_to);
-       fetch_string_from_stream(input_stream, &stream_offset, &output_mail_head->return_path);
-       fetch_sized_data_from_stream(input_stream, &stream_offset, sizeof(unsigned short), (char*)&output_mail_head->datetime.year);
-       fetch_sized_data_from_stream(input_stream, &stream_offset, sizeof(unsigned short), (char*)&output_mail_head->datetime.month);
-       fetch_sized_data_from_stream(input_stream, &stream_offset, sizeof(unsigned short), (char*)&output_mail_head->datetime.day);
-       fetch_sized_data_from_stream(input_stream, &stream_offset, sizeof(unsigned short), (char*)&output_mail_head->datetime.hour);
-       fetch_sized_data_from_stream(input_stream, &stream_offset, sizeof(unsigned short), (char*)&output_mail_head->datetime.minute);
-       fetch_sized_data_from_stream(input_stream, &stream_offset, sizeof(unsigned short), (char*)&output_mail_head->datetime.second);
-       fetch_string_from_stream(input_stream, &stream_offset, &output_mail_head->from_contact_name);
-       fetch_string_from_stream(input_stream, &stream_offset, &output_mail_head->to_contact_name);
-       fetch_string_from_stream(input_stream, &stream_offset, &output_mail_head->cc_contact_name);
-       fetch_string_from_stream(input_stream, &stream_offset, &output_mail_head->bcc_contact_name);
-       fetch_string_from_stream(input_stream, &stream_offset, &output_mail_head->previewBodyText);
-
-       EM_DEBUG_FUNC_END();
-}
-
-
-EXPORT_API char* em_convert_mail_body_to_byte_stream(emf_mail_body_t* input_mail_body, int* output_stream_size)
-{
-       EM_DEBUG_FUNC_BEGIN();
-
-       char *result_stream = NULL;
-       int stream_size = 0;
-       emf_attachment_info_t *temp_attachment_info = NULL;
-
-       EM_IF_NULL_RETURN_VALUE(input_mail_body, NULL);
-       EM_IF_NULL_RETURN_VALUE(output_stream_size, NULL);
-
-       result_stream = append_string_to_stream(result_stream, &stream_size, input_mail_body->plain);
-       result_stream = append_string_to_stream(result_stream, &stream_size, input_mail_body->plain_charset);
-       result_stream = append_string_to_stream(result_stream, &stream_size, input_mail_body->html); 
-       result_stream = append_sized_data_to_stream(result_stream, &stream_size, (char*)&input_mail_body->attachment_num, sizeof(int));
-       
-       temp_attachment_info = input_mail_body->attachment;
-
-       while(temp_attachment_info) {
-               result_stream = append_sized_data_to_stream(result_stream, &stream_size, (char*)&temp_attachment_info->inline_content, sizeof(int));
-               result_stream = append_sized_data_to_stream(result_stream, &stream_size, (char*)&temp_attachment_info->attachment_id, sizeof(int));
-               result_stream = append_string_to_stream(result_stream, &stream_size, temp_attachment_info->name);
-               result_stream = append_sized_data_to_stream(result_stream, &stream_size, (char*)&temp_attachment_info->size, sizeof(int));
-               result_stream = append_sized_data_to_stream(result_stream, &stream_size, (char*)&temp_attachment_info->downloaded, sizeof(int));
-               result_stream = append_string_to_stream(result_stream, &stream_size, temp_attachment_info->savename);
-               result_stream = append_sized_data_to_stream(result_stream, &stream_size, (char*)&temp_attachment_info->drm, sizeof(int)); 
-               temp_attachment_info = temp_attachment_info->next;
-       }
-
-       *output_stream_size = stream_size;
-
-       EM_DEBUG_FUNC_END();
-       return result_stream;
-}
-
-
-EXPORT_API void em_convert_byte_stream_to_mail_body(char* input_stream,  emf_mail_body_t* output_mail_body)
-{
-       EM_DEBUG_FUNC_BEGIN();
-
-       int stream_offset = 0;
-       int i = 0;
-       emf_attachment_info_t *temp_attachment_info = NULL;
-       emf_attachment_info_t *temp_attachment_info_cursor = NULL;
-
-       EM_NULL_CHECK_FOR_VOID(input_stream);
-       EM_NULL_CHECK_FOR_VOID(output_mail_body);
-       
-       fetch_string_from_stream(input_stream, &stream_offset, &output_mail_body->plain);
-       fetch_string_from_stream(input_stream, &stream_offset, &output_mail_body->plain_charset);
-       fetch_string_from_stream(input_stream, &stream_offset, &output_mail_body->html); 
-       fetch_sized_data_from_stream(input_stream, &stream_offset, sizeof(int), (char*)&output_mail_body->attachment_num);
-
-       if(output_mail_body->attachment_num <= 0)
-               output_mail_body->attachment = NULL;
-       
-       for(i = 0; i < output_mail_body->attachment_num; i++) { 
-
-               temp_attachment_info = (emf_attachment_info_t*)malloc(sizeof(emf_attachment_info_t));
-
-               if(!temp_attachment_info) {
-                       EM_DEBUG_EXCEPTION("EMF_ERROR_OUT_OF_MEMORY");
-                       return;
-               }
-
-               if(i == 0)
-                       output_mail_body->attachment = temp_attachment_info_cursor = temp_attachment_info;
-               else {
-                       temp_attachment_info_cursor->next = temp_attachment_info;
-                       temp_attachment_info_cursor = temp_attachment_info;
-               }
-               
-               fetch_sized_data_from_stream(input_stream, &stream_offset, sizeof(int), (char*)&temp_attachment_info->inline_content);
-               fetch_sized_data_from_stream(input_stream, &stream_offset, sizeof(int), (char*)&temp_attachment_info->attachment_id);
-               fetch_string_from_stream(input_stream, &stream_offset, &temp_attachment_info->name);
-               fetch_sized_data_from_stream(input_stream, &stream_offset, sizeof(int), (char*)&temp_attachment_info->size);
-               fetch_sized_data_from_stream(input_stream, &stream_offset, sizeof(int), (char*)&temp_attachment_info->downloaded);
-               fetch_string_from_stream(input_stream, &stream_offset, &temp_attachment_info->savename);
-               fetch_sized_data_from_stream(input_stream, &stream_offset, sizeof(int), (char*)&temp_attachment_info->drm); 
-
-               temp_attachment_info->next = NULL;
-       }
-       
-       EM_DEBUG_FUNC_END();
-}
-
-
-EXPORT_API char* em_convert_attachment_info_to_byte_stream(emf_attachment_info_t *input_attachment_info, int *output_stream_size)
+INTERNAL_FUNC char* em_convert_attachment_info_to_byte_stream(emf_attachment_info_t *input_attachment_info, int *output_stream_size)
 {
        EM_DEBUG_FUNC_BEGIN();
 
@@ -1021,7 +831,7 @@ EXPORT_API char* em_convert_attachment_info_to_byte_stream(emf_attachment_info_t
        return result_stream;
 }
 
-EXPORT_API void em_convert_byte_stream_to_attachment_info(char *input_stream, int attachment_count, emf_attachment_info_t **output_attachment_info)
+INTERNAL_FUNC void em_convert_byte_stream_to_attachment_info(char *input_stream, int attachment_count, emf_attachment_info_t **output_attachment_info)
 {
        EM_DEBUG_FUNC_BEGIN();
 
@@ -1056,7 +866,7 @@ EXPORT_API void em_convert_byte_stream_to_attachment_info(char *input_stream, in
        EM_DEBUG_FUNC_END();
 }
 
-EXPORT_API char* em_convert_mail_data_to_byte_stream(emf_mail_data_t *input_mail_data, int input_mail_data_count, int *output_stream_size)
+INTERNAL_FUNC char* em_convert_mail_data_to_byte_stream(emf_mail_data_t *input_mail_data, int input_mail_data_count, int *output_stream_size)
 {
        EM_DEBUG_FUNC_BEGIN("input_mail_data [%p], input_mail_data_count[%d], output_stream_size[%p]", input_mail_data, input_mail_data_count, output_stream_size);
        
@@ -1075,7 +885,7 @@ EXPORT_API char* em_convert_mail_data_to_byte_stream(emf_mail_data_t *input_mail
                result_stream = append_string_to_stream(result_stream, &stream_size, input_mail_data[i].mailbox_name);
                result_stream = append_sized_data_to_stream(result_stream, &stream_size, (char*)&(input_mail_data[i].mailbox_type), sizeof(int));
                result_stream = append_string_to_stream(result_stream, &stream_size, input_mail_data[i].subject);
-               result_stream = append_string_to_stream(result_stream, &stream_size, input_mail_data[i].datetime);
+               result_stream = append_sized_data_to_stream(result_stream, &stream_size, (char*)&(input_mail_data[i].date_time), sizeof(int));
                result_stream = append_sized_data_to_stream(result_stream, &stream_size, (char*)&(input_mail_data[i].server_mail_status), sizeof(int));
                result_stream = append_string_to_stream(result_stream, &stream_size, input_mail_data[i].server_mailbox_name);
                result_stream = append_string_to_stream(result_stream, &stream_size, input_mail_data[i].server_mail_id);
@@ -1120,7 +930,7 @@ EXPORT_API char* em_convert_mail_data_to_byte_stream(emf_mail_data_t *input_mail
        return result_stream;
 }
 
-EXPORT_API void em_convert_byte_stream_to_mail_data(char *input_stream, emf_mail_data_t **output_mail_data, int *output_mail_data_count)
+INTERNAL_FUNC void em_convert_byte_stream_to_mail_data(char *input_stream, emf_mail_data_t **output_mail_data, int *output_mail_data_count)
 {
        EM_DEBUG_FUNC_BEGIN("input_stream [%p], output_mail_data[%p], output_mail_data_count[%p]", input_stream, output_mail_data, output_mail_data_count);
 
@@ -1140,10 +950,10 @@ EXPORT_API void em_convert_byte_stream_to_mail_data(char *input_stream, emf_mail
                return;
        }
 
-       *output_mail_data = (emf_mail_data_t*)em_core_malloc(sizeof(emf_mail_data_t) * (*output_mail_data_count));
+       *output_mail_data = (emf_mail_data_t*)em_malloc(sizeof(emf_mail_data_t) * (*output_mail_data_count));
 
        if(!*output_mail_data) {
-               EM_DEBUG_EXCEPTION("em_core_malloc failed");
+               EM_DEBUG_EXCEPTION("em_malloc failed");
                return;
        }
 
@@ -1153,7 +963,7 @@ EXPORT_API void em_convert_byte_stream_to_mail_data(char *input_stream, emf_mail
                fetch_string_from_stream(input_stream, &stream_offset, &(*output_mail_data)[i].mailbox_name);
                fetch_sized_data_from_stream(input_stream, &stream_offset, sizeof(int), (char*)&(*output_mail_data)[i].mailbox_type);
                fetch_string_from_stream(input_stream, &stream_offset, &(*output_mail_data)[i].subject);
-               fetch_string_from_stream(input_stream, &stream_offset, &(*output_mail_data)[i].datetime);
+               fetch_sized_data_from_stream(input_stream, &stream_offset, sizeof(int), (char*)&(*output_mail_data)[i].date_time);
                fetch_sized_data_from_stream(input_stream, &stream_offset, sizeof(int), (char*)&(*output_mail_data)[i].server_mail_status);
                fetch_string_from_stream(input_stream, &stream_offset, &(*output_mail_data)[i].server_mailbox_name);
                fetch_string_from_stream(input_stream, &stream_offset, &(*output_mail_data)[i].server_mail_id);
@@ -1195,7 +1005,7 @@ EXPORT_API void em_convert_byte_stream_to_mail_data(char *input_stream, emf_mail
        EM_DEBUG_FUNC_END();
 }
 
-EXPORT_API char* em_convert_attachment_data_to_byte_stream(emf_attachment_data_t *input_attachment_data, int input_attachment_count, int* output_stream_size)
+INTERNAL_FUNC char* em_convert_attachment_data_to_byte_stream(emf_attachment_data_t *input_attachment_data, int input_attachment_count, int* output_stream_size)
 {
        EM_DEBUG_FUNC_BEGIN("input_attachment_data [%p], input_attachment_count [%d], output_stream_size [%p]", input_attachment_data, input_attachment_count, output_stream_size);
        
@@ -1228,7 +1038,7 @@ EXPORT_API char* em_convert_attachment_data_to_byte_stream(emf_attachment_data_t
        return result_stream;
 }
 
-EXPORT_API void em_convert_byte_stream_to_attachment_data(char *input_stream, emf_attachment_data_t **output_attachment_data, int *output_attachment_count)
+INTERNAL_FUNC void em_convert_byte_stream_to_attachment_data(char *input_stream, emf_attachment_data_t **output_attachment_data, int *output_attachment_count)
 {
        EM_DEBUG_FUNC_BEGIN("input_stream [%p], output_attachment_data[%p]", input_stream, output_attachment_data);
 
@@ -1248,10 +1058,10 @@ EXPORT_API void em_convert_byte_stream_to_attachment_data(char *input_stream, em
                return;
        }
 
-       *output_attachment_data = (emf_attachment_data_t*)em_core_malloc(sizeof(emf_attachment_data_t) * (*output_attachment_count));
+       *output_attachment_data = (emf_attachment_data_t*)em_malloc(sizeof(emf_attachment_data_t) * (*output_attachment_count));
 
        if(!*output_attachment_data) {
-               EM_DEBUG_EXCEPTION("em_core_malloc failed");
+               EM_DEBUG_EXCEPTION("em_malloc failed");
                return;
        }
 
@@ -1273,7 +1083,7 @@ EXPORT_API void em_convert_byte_stream_to_attachment_data(char *input_stream, em
 
 
 
-EXPORT_API char* em_convert_mailbox_to_byte_stream(emf_mailbox_t *input_mailbox_data, int *output_stream_size)
+INTERNAL_FUNC char* em_convert_mailbox_to_byte_stream(emf_mailbox_t *input_mailbox_data, int *output_stream_size)
 {
        EM_DEBUG_FUNC_BEGIN("input_mailbox_data [%p], output_stream_size [%p]", input_mailbox_data, output_stream_size);
        
@@ -1308,7 +1118,7 @@ EXPORT_API char* em_convert_mailbox_to_byte_stream(emf_mailbox_t *input_mailbox_
 }
 
 
-EXPORT_API void em_convert_byte_stream_to_mailbox(char *input_stream, emf_mailbox_t *output_mailbox_data)
+INTERNAL_FUNC void em_convert_byte_stream_to_mailbox(char *input_stream, emf_mailbox_t *output_mailbox_data)
 {
        EM_DEBUG_FUNC_BEGIN("input_stream [%p], output_mailbox_data [%p]", input_stream, output_mailbox_data);
        int             stream_offset   = 0;
@@ -1336,94 +1146,7 @@ EXPORT_API void em_convert_byte_stream_to_mailbox(char *input_stream, emf_mailbo
 }
 
 
-EXPORT_API char* em_convert_mail_info_to_byte_stream(emf_mail_info_t *input_mail_info, int *output_stream_size)
-{
-       EM_DEBUG_FUNC_BEGIN();
-
-       char *result_stream    = NULL;
-       int   stream_size      = 0;
-       int   mail_flag        = 0; 
-       int   extra_flag_field = 0;
-
-       EM_IF_NULL_RETURN_VALUE(input_mail_info, NULL);
-       EM_IF_NULL_RETURN_VALUE(output_stream_size, NULL);
-
-       em_convert_mail_flag_to_int(input_mail_info->flags, &mail_flag, NULL);
-
-       result_stream = append_sized_data_to_stream(result_stream, &stream_size, (char*)&(input_mail_info->account_id), sizeof(int));
-       result_stream = append_sized_data_to_stream(result_stream, &stream_size, (char*)&(input_mail_info->uid), sizeof(int));
-       result_stream = append_sized_data_to_stream(result_stream, &stream_size, (char*)&(input_mail_info->rfc822_size), sizeof(int));
-       result_stream = append_sized_data_to_stream(result_stream, &stream_size, (char*)&(input_mail_info->body_downloaded), sizeof(int));
-       result_stream = append_sized_data_to_stream(result_stream, &stream_size, (char*)&(mail_flag), sizeof(int));
-       extra_flag_field = input_mail_info->extra_flags.priority;
-       result_stream = append_sized_data_to_stream(result_stream, &stream_size, (char*)&extra_flag_field, sizeof(int));
-       extra_flag_field = input_mail_info->extra_flags.status;
-       result_stream = append_sized_data_to_stream(result_stream, &stream_size, (char*)&extra_flag_field, sizeof(int));
-       extra_flag_field = input_mail_info->extra_flags.noti;
-       result_stream = append_sized_data_to_stream(result_stream, &stream_size, (char*)&extra_flag_field, sizeof(int));
-       extra_flag_field = input_mail_info->extra_flags.lock;
-       result_stream = append_sized_data_to_stream(result_stream, &stream_size, (char*)&extra_flag_field, sizeof(int));
-       extra_flag_field = input_mail_info->extra_flags.report;
-       result_stream = append_sized_data_to_stream(result_stream, &stream_size, (char*)&extra_flag_field, sizeof(int));
-       extra_flag_field = input_mail_info->extra_flags.drm;
-       result_stream = append_sized_data_to_stream(result_stream, &stream_size, (char*)&extra_flag_field, sizeof(int));
-       extra_flag_field = input_mail_info->extra_flags.text_download_yn;
-       result_stream = append_sized_data_to_stream(result_stream, &stream_size, (char*)&extra_flag_field, sizeof(int));
-       result_stream = append_string_to_stream(result_stream, &stream_size, input_mail_info->sid);
-       result_stream = append_sized_data_to_stream(result_stream, &stream_size, (char*)&(input_mail_info->is_meeting_request), sizeof(int));
-       result_stream = append_sized_data_to_stream(result_stream, &stream_size, (char*)&(input_mail_info->thread_id), sizeof(int));
-       result_stream = append_sized_data_to_stream(result_stream, &stream_size, (char*)&(input_mail_info->thread_item_count), sizeof(int));
-
-       *output_stream_size = stream_size;
-
-       EM_DEBUG_FUNC_END();
-       return result_stream;
-}
-
-
-EXPORT_API void em_convert_byte_stream_to_mail_info(char *input_stream, emf_mail_info_t *output_mail_info)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       
-       int stream_offset    = 0;
-       int mail_flag        = 0;
-       int extra_flag_field = 0;
-
-       EM_NULL_CHECK_FOR_VOID(input_stream);
-       EM_NULL_CHECK_FOR_VOID(output_mail_info);
-
-       fetch_sized_data_from_stream(input_stream, &stream_offset, sizeof(int), (char*)&(output_mail_info->account_id));
-       fetch_sized_data_from_stream(input_stream, &stream_offset, sizeof(int), (char*)&(output_mail_info->uid));
-       fetch_sized_data_from_stream(input_stream, &stream_offset, sizeof(int), (char*)&(output_mail_info->rfc822_size));
-       fetch_sized_data_from_stream(input_stream, &stream_offset, sizeof(int), (char*)&(output_mail_info->body_downloaded));
-       fetch_sized_data_from_stream(input_stream, &stream_offset, sizeof(int), (char*)&(mail_flag));
-       fetch_sized_data_from_stream(input_stream, &stream_offset, sizeof(int), (char*)&extra_flag_field);
-       output_mail_info->extra_flags.priority = extra_flag_field;
-       fetch_sized_data_from_stream(input_stream, &stream_offset, sizeof(int), (char*)&extra_flag_field);
-       output_mail_info->extra_flags.status = extra_flag_field;
-       fetch_sized_data_from_stream(input_stream, &stream_offset, sizeof(int), (char*)&extra_flag_field);
-       output_mail_info->extra_flags.noti = extra_flag_field;
-       fetch_sized_data_from_stream(input_stream, &stream_offset, sizeof(int), (char*)&extra_flag_field);
-       output_mail_info->extra_flags.lock = extra_flag_field;
-       fetch_sized_data_from_stream(input_stream, &stream_offset, sizeof(int), (char*)&extra_flag_field);
-       output_mail_info->extra_flags.report = extra_flag_field;
-       fetch_sized_data_from_stream(input_stream, &stream_offset, sizeof(int), (char*)&extra_flag_field);
-       output_mail_info->extra_flags.drm = extra_flag_field;
-       fetch_sized_data_from_stream(input_stream, &stream_offset, sizeof(int), (char*)&extra_flag_field);
-       output_mail_info->extra_flags.text_download_yn = extra_flag_field;
-       fetch_string_from_stream(input_stream, &stream_offset, &output_mail_info->sid);
-       fetch_sized_data_from_stream(input_stream, &stream_offset, sizeof(int), (char*)&(output_mail_info->is_meeting_request));
-       fetch_sized_data_from_stream(input_stream, &stream_offset, sizeof(int), (char*)&(output_mail_info->thread_id));
-       fetch_sized_data_from_stream(input_stream, &stream_offset, sizeof(int), (char*)&(output_mail_info->thread_item_count));
-
-
-       if (!em_convert_mail_int_to_flag(mail_flag, &(output_mail_info->flags), NULL))
-               EM_DEBUG_LOG(" INVALID FLAG PARAM ");
-
-       EM_DEBUG_FUNC_END();
-}
-
-EXPORT_API char* em_convert_option_to_byte_stream(emf_option_t* input_option, int* output_stream_size)
+INTERNAL_FUNC char* em_convert_option_to_byte_stream(emf_option_t* input_option, int* output_stream_size)
 {
        EM_DEBUG_FUNC_BEGIN();
        char *result_stream = NULL;
@@ -1452,7 +1175,7 @@ EXPORT_API char* em_convert_option_to_byte_stream(emf_option_t* input_option, in
 
 }
 
-EXPORT_API void em_convert_byte_stream_to_option(char *input_stream, emf_option_t *output_option)
+INTERNAL_FUNC void em_convert_byte_stream_to_option(char *input_stream, emf_option_t *output_option)
 {
        EM_DEBUG_FUNC_BEGIN();
        int stream_offset = 0;
@@ -1477,7 +1200,7 @@ EXPORT_API void em_convert_byte_stream_to_option(char *input_stream, emf_option_
        EM_DEBUG_FUNC_END();
 }
 
-EXPORT_API char* em_convert_rule_to_byte_stream(emf_rule_t *input_rule, int *output_stream_size)
+INTERNAL_FUNC char* em_convert_rule_to_byte_stream(emf_rule_t *input_rule, int *output_stream_size)
 {
        EM_DEBUG_FUNC_BEGIN();
        char *result_stream = NULL;
@@ -1501,7 +1224,7 @@ EXPORT_API char* em_convert_rule_to_byte_stream(emf_rule_t *input_rule, int *out
        return result_stream;
 }
 
-EXPORT_API void em_convert_byte_stream_to_rule(char *input_stream, emf_rule_t *output_rule)
+INTERNAL_FUNC void em_convert_byte_stream_to_rule(char *input_stream, emf_rule_t *output_rule)
 {
        EM_DEBUG_FUNC_BEGIN();
        int stream_offset = 0;
@@ -1521,7 +1244,7 @@ EXPORT_API void em_convert_byte_stream_to_rule(char *input_stream, emf_rule_t *o
        EM_DEBUG_FUNC_END();
 }
 
-EXPORT_API char* em_convert_extra_flags_to_byte_stream(emf_extra_flag_t input_extra_flag, int *output_stream_size)
+INTERNAL_FUNC char* em_convert_extra_flags_to_byte_stream(emf_extra_flag_t input_extra_flag, int *output_stream_size)
 {
        EM_DEBUG_FUNC_BEGIN();
        char *result_stream = NULL;
@@ -1552,7 +1275,7 @@ EXPORT_API char* em_convert_extra_flags_to_byte_stream(emf_extra_flag_t input_ex
        return result_stream;
 }
 
-EXPORT_API void em_convert_byte_stream_to_extra_flags(char *input_stream, emf_extra_flag_t *output_extra_flag)
+INTERNAL_FUNC void em_convert_byte_stream_to_extra_flags(char *input_stream, emf_extra_flag_t *output_extra_flag)
 {
        EM_DEBUG_FUNC_BEGIN();
 
@@ -1580,7 +1303,7 @@ EXPORT_API void em_convert_byte_stream_to_extra_flags(char *input_stream, emf_ex
        EM_DEBUG_FUNC_END();
 }
 
-EXPORT_API char* em_convert_meeting_req_to_byte_stream(emf_meeting_request_t *input_meeting_req, int *output_stream_size)
+INTERNAL_FUNC char* em_convert_meeting_req_to_byte_stream(emf_meeting_request_t *input_meeting_req, int *output_stream_size)
 {
        EM_DEBUG_FUNC_BEGIN();
 
@@ -1593,8 +1316,8 @@ EXPORT_API char* em_convert_meeting_req_to_byte_stream(emf_meeting_request_t *in
        result_stream = append_sized_data_to_stream(result_stream, &stream_size, (char*)&(input_meeting_req->meeting_response), sizeof(int));
        result_stream = append_sized_data_to_stream(result_stream, &stream_size, (char*)&(input_meeting_req->start_time), sizeof(struct tm));
        result_stream = append_sized_data_to_stream(result_stream, &stream_size, (char*)&(input_meeting_req->end_time), sizeof(struct tm));
-       result_stream = append_string_to_stream(result_stream, &stream_size, input_meeting_req->location);
-       result_stream = append_sized_data_to_stream(result_stream, &stream_size, (char*)&input_meeting_req->global_object_id, MEETING_REQ_OBJECT_ID_LENGTH);
+       result_stream = append_string_to_stream    (result_stream, &stream_size, input_meeting_req->location);
+       result_stream = append_string_to_stream    (result_stream, &stream_size, input_meeting_req->global_object_id);
        result_stream = append_sized_data_to_stream(result_stream, &stream_size, (char*)&(input_meeting_req->time_zone.offset_from_GMT), sizeof(int));
        result_stream = append_sized_data_to_stream(result_stream, &stream_size, (char*)&input_meeting_req->time_zone.standard_name, 32);
        result_stream = append_sized_data_to_stream(result_stream, &stream_size, (char*)&(input_meeting_req->time_zone.standard_time_start_date), sizeof(struct tm));
@@ -1610,7 +1333,7 @@ EXPORT_API char* em_convert_meeting_req_to_byte_stream(emf_meeting_request_t *in
 }
 
 
-EXPORT_API void em_convert_byte_stream_to_meeting_req(char *input_stream,  emf_meeting_request_t *output_meeting_req)
+INTERNAL_FUNC void em_convert_byte_stream_to_meeting_req(char *input_stream,  emf_meeting_request_t *output_meeting_req)
 {
        EM_DEBUG_FUNC_BEGIN();
        int stream_offset = 0;
@@ -1622,8 +1345,8 @@ EXPORT_API void em_convert_byte_stream_to_meeting_req(char *input_stream,  emf_m
        fetch_sized_data_from_stream(input_stream, &stream_offset, sizeof(int), (char*)&(output_meeting_req->meeting_response));
        fetch_sized_data_from_stream(input_stream, &stream_offset, sizeof(struct tm), (char*)&(output_meeting_req->start_time));
        fetch_sized_data_from_stream(input_stream, &stream_offset, sizeof(struct tm), (char*)&(output_meeting_req->end_time));
-       fetch_string_from_stream(input_stream, &stream_offset, &output_meeting_req->location);
-       fetch_sized_data_from_stream(input_stream, &stream_offset, MEETING_REQ_OBJECT_ID_LENGTH, output_meeting_req->global_object_id);
+       fetch_string_from_stream    (input_stream, &stream_offset, &output_meeting_req->location);
+       fetch_string_from_stream    (input_stream, &stream_offset, &output_meeting_req->global_object_id);
        fetch_sized_data_from_stream(input_stream, &stream_offset, sizeof(int), (char*)&(output_meeting_req->time_zone.offset_from_GMT));
        fetch_sized_data_from_stream(input_stream, &stream_offset, 32, output_meeting_req->time_zone.standard_name);
        fetch_sized_data_from_stream(input_stream, &stream_offset, sizeof(struct tm), (char*)&(output_meeting_req->time_zone.standard_time_start_date));
@@ -1635,3 +1358,130 @@ EXPORT_API void em_convert_byte_stream_to_meeting_req(char *input_stream,  emf_m
        EM_DEBUG_FUNC_END();
 }
 
+INTERNAL_FUNC char* em_convert_search_filter_to_byte_stream(email_search_filter_t *input_search_filter_list, int input_search_filter_count, int *output_stream_size)
+{
+       EM_DEBUG_FUNC_BEGIN("input_search_filter_list [%p] input_search_filter_count [%d]", input_search_filter_list, input_search_filter_count);
+
+       char *result_stream = NULL;
+       int   stream_size   = 0;
+       int   i = 0;
+
+       EM_IF_NULL_RETURN_VALUE(input_search_filter_list, NULL);
+
+       result_stream = append_sized_data_to_stream(result_stream, &stream_size, (char*)&(input_search_filter_count), sizeof(int));
+
+       for( i = 0; i < input_search_filter_count; i++) {
+               result_stream = append_sized_data_to_stream(result_stream, &stream_size, (char*)&(input_search_filter_list->search_filter_type), sizeof(int));
+               switch(input_search_filter_list->search_filter_type) {
+                       case EMAIL_SEARCH_FILTER_TYPE_MESSAGE_NO       :
+                       case EMAIL_SEARCH_FILTER_TYPE_UID              :
+                       case EMAIL_SEARCH_FILTER_TYPE_SIZE_LARSER      :
+                       case EMAIL_SEARCH_FILTER_TYPE_SIZE_SMALLER     :
+                       case EMAIL_SEARCH_FILTER_TYPE_FLAGS_ANSWERED   :
+                       case EMAIL_SEARCH_FILTER_TYPE_FLAGS_DELETED    :
+                       case EMAIL_SEARCH_FILTER_TYPE_FLAGS_DRAFT      :
+                       case EMAIL_SEARCH_FILTER_TYPE_FLAGS_FLAGED     :
+                       case EMAIL_SEARCH_FILTER_TYPE_FLAGS_RECENT     :
+                       case EMAIL_SEARCH_FILTER_TYPE_FLAGS_SEEN       :
+                               result_stream = append_sized_data_to_stream(result_stream, &stream_size, (char*)&(input_search_filter_list->search_filter_key_value.integer_type_key_value), sizeof(int));
+                               break;
+
+                       case EMAIL_SEARCH_FILTER_TYPE_BCC              :
+                       case EMAIL_SEARCH_FILTER_TYPE_CC               :
+                       case EMAIL_SEARCH_FILTER_TYPE_FROM             :
+                       case EMAIL_SEARCH_FILTER_TYPE_KEYWORD          :
+                       case EMAIL_SEARCH_FILTER_TYPE_SUBJECT          :
+                       case EMAIL_SEARCH_FILTER_TYPE_TO               :
+                       case EMAIL_SEARCH_FILTER_TYPE_MESSAGE_ID       :
+                               result_stream = append_string_to_stream(result_stream, &stream_size, input_search_filter_list->search_filter_key_value.string_type_key_value);
+                               break;
+
+                       case EMAIL_SEARCH_FILTER_TYPE_SENT_DATE_BEFORE :
+                       case EMAIL_SEARCH_FILTER_TYPE_SENT_DATE_ON     :
+                       case EMAIL_SEARCH_FILTER_TYPE_SENT_DATE_SINCE  :
+                               result_stream = append_sized_data_to_stream(result_stream, &stream_size, (char*)&(input_search_filter_list->search_filter_key_value.time_type_key_value), sizeof(struct tm));
+                               break;
+                       default :
+                               EM_DEBUG_EXCEPTION("Invalid filter type [%d]", input_search_filter_list->search_filter_type);
+                               break;
+               }
+       }
+
+       *output_stream_size = stream_size;
+
+       EM_DEBUG_FUNC_END();
+       return result_stream;
+}
+
+INTERNAL_FUNC void em_convert_byte_stream_to_search_filter(char *input_stream, email_search_filter_t **output_search_filter_list, int *output_search_filter_count)
+{
+       EM_DEBUG_FUNC_BEGIN("input_stream [%p] output_search_filter_list [%p] output_search_filter_count [%p]", input_stream, output_search_filter_list, output_search_filter_count);
+
+       int stream_offset = 0;
+       int i = 0;
+       int local_search_filter_count = 0;
+       email_search_filter_t *local_search_filter = NULL;
+
+       EM_NULL_CHECK_FOR_VOID(input_stream);
+       EM_NULL_CHECK_FOR_VOID(output_search_filter_list);
+       EM_NULL_CHECK_FOR_VOID(output_search_filter_count);
+
+       fetch_sized_data_from_stream(input_stream, &stream_offset, sizeof(int), (char*)&(local_search_filter_count));
+
+       if(local_search_filter_count == 0) {
+               EM_DEBUG_EXCEPTION("local_search_filter_count is 0.");
+               goto FINISH_OFF;
+       }
+
+       local_search_filter = em_malloc(sizeof(email_search_filter_t) * local_search_filter_count);
+
+       if(local_search_filter == NULL) {
+               EM_DEBUG_EXCEPTION("em_malloc for local_search_filter failed");
+               goto FINISH_OFF;
+       }
+
+       *output_search_filter_count = local_search_filter_count;
+
+       for( i = 0; i < local_search_filter_count; i++) {
+               fetch_sized_data_from_stream(input_stream, &stream_offset, sizeof(int), (char*)&(local_search_filter[i].search_filter_type));
+               switch(local_search_filter[i].search_filter_type) {
+                       case EMAIL_SEARCH_FILTER_TYPE_MESSAGE_NO       :
+                       case EMAIL_SEARCH_FILTER_TYPE_UID              :
+                       case EMAIL_SEARCH_FILTER_TYPE_SIZE_LARSER      :
+                       case EMAIL_SEARCH_FILTER_TYPE_SIZE_SMALLER     :
+                       case EMAIL_SEARCH_FILTER_TYPE_FLAGS_ANSWERED   :
+                       case EMAIL_SEARCH_FILTER_TYPE_FLAGS_DELETED    :
+                       case EMAIL_SEARCH_FILTER_TYPE_FLAGS_DRAFT      :
+                       case EMAIL_SEARCH_FILTER_TYPE_FLAGS_FLAGED     :
+                       case EMAIL_SEARCH_FILTER_TYPE_FLAGS_RECENT     :
+                       case EMAIL_SEARCH_FILTER_TYPE_FLAGS_SEEN       :
+                               fetch_sized_data_from_stream(input_stream, &stream_offset, sizeof(int), (char*)&(local_search_filter[i].search_filter_key_value.integer_type_key_value));
+                               break;
+
+                       case EMAIL_SEARCH_FILTER_TYPE_BCC              :
+                       case EMAIL_SEARCH_FILTER_TYPE_CC               :
+                       case EMAIL_SEARCH_FILTER_TYPE_FROM             :
+                       case EMAIL_SEARCH_FILTER_TYPE_KEYWORD          :
+                       case EMAIL_SEARCH_FILTER_TYPE_SUBJECT          :
+                       case EMAIL_SEARCH_FILTER_TYPE_TO               :
+                       case EMAIL_SEARCH_FILTER_TYPE_MESSAGE_ID       :
+                               fetch_string_from_stream(input_stream, &stream_offset, &(local_search_filter[i].search_filter_key_value.string_type_key_value));
+                               break;
+
+                       case EMAIL_SEARCH_FILTER_TYPE_SENT_DATE_BEFORE :
+                       case EMAIL_SEARCH_FILTER_TYPE_SENT_DATE_ON     :
+                       case EMAIL_SEARCH_FILTER_TYPE_SENT_DATE_SINCE  :
+                               fetch_sized_data_from_stream(input_stream, &stream_offset, 32, (char*)&(local_search_filter[i].search_filter_key_value.time_type_key_value));
+                               break;
+                       default :
+                               EM_DEBUG_EXCEPTION("Invalid filter type [%d]", local_search_filter[i].search_filter_type);
+                               break;
+               }
+       }
+
+       *output_search_filter_list = local_search_filter;
+
+FINISH_OFF:
+
+       EM_DEBUG_FUNC_END();
+}
diff --git a/email-common-use/email-utilities.c b/email-common-use/email-utilities.c
new file mode 100755 (executable)
index 0000000..5cebaf9
--- /dev/null
@@ -0,0 +1,643 @@
+/*\r
+*  email-service\r
+*\r
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+*\r
+* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com>\r
+*\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+* http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License.\r
+*\r
+*/\r
+\r
+/*\r
+ * email-utilities.c\r
+ *\r
+ *  Created on: 2012. 3. 6.\r
+ *      Author: kyuho.jo@samsung.com\r
+ */\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+#include <string.h>\r
+#include <ctype.h>\r
+#include <errno.h>\r
+#include <sys/time.h>\r
+#include <sys/vfs.h>\r
+#include <unistd.h>\r
+#include <malloc.h>\r
+#include <pthread.h>\r
+#include <regex.h>\r
+\r
+#include "c-client.h"\r
+\r
+#include "email-types.h"\r
+#include "email-internal-types.h"\r
+#include "email-utilities.h"\r
+\r
+INTERNAL_FUNC void* em_malloc(unsigned len)\r
+{\r
+       /* EM_DEBUG_LOG("Memory allocation size[%d] bytes", len); */\r
+       void *p = NULL;\r
+\r
+       if (len <= 0) {\r
+               EM_DEBUG_EXCEPTION("len should be positive.[%d]", len);\r
+               return NULL;\r
+       }\r
+\r
+       p = malloc(len);\r
+\r
+       if (p)\r
+               memset(p, 0x00, len);\r
+       else\r
+               EM_DEBUG_EXCEPTION("malloc failed");\r
+       return p;\r
+}\r
+\r
+/*  remove left space, tab, CR, L */\r
+INTERNAL_FUNC char *em_trim_left(char *str)\r
+{\r
+       char *p, *temp_buffer = NULL;\r
+\r
+       /* EM_DEBUG_FUNC_BEGIN() */\r
+       if (!str) return NULL;\r
+\r
+       p = str;\r
+       while (*p && (*p == ' ' || *p == '\t' || *p == LF || *p == CR)) p++;\r
+\r
+       if (!*p) return NULL;\r
+\r
+       temp_buffer = EM_SAFE_STRDUP(p);\r
+\r
+       strncpy(str, temp_buffer, strlen(str));\r
+       str[strlen(temp_buffer)] = NULL_CHAR;\r
+\r
+       EM_SAFE_FREE(temp_buffer);\r
+\r
+       return str;\r
+}\r
+\r
+/*  remove right space, tab, CR, L */\r
+INTERNAL_FUNC char *em_trim_right(char *str)\r
+{\r
+       char *p;\r
+\r
+       /* EM_DEBUG_FUNC_BEGIN() */\r
+       if (!str) return NULL;\r
+\r
+       p = str+strlen(str)-1;\r
+       while (((int)p >= (int)str) && (*p == ' ' || *p == '\t' || *p == LF || *p == CR))\r
+               *p --= '\0';\r
+\r
+       if ((int) p < (int)str)\r
+               return NULL;\r
+\r
+       return str;\r
+}\r
+\r
+INTERNAL_FUNC char* em_upper_string(char *str)\r
+{\r
+       char *p = str;\r
+       while (*p)  {\r
+               *p = toupper(*p);\r
+               p++;\r
+       }\r
+       return str;\r
+}\r
+\r
+INTERNAL_FUNC char*  em_lower_string(char *str)\r
+{\r
+       char *p = str;\r
+       while (*p)  {\r
+               *p = tolower(*p);\r
+               p++;\r
+       }\r
+       return str;\r
+}\r
+\r
+INTERNAL_FUNC int em_upper_path(char *path)\r
+{\r
+       int i = 0, is_utf7 = 0, len = path ? (int)strlen(path) : -1;\r
+       for (; i < len; i++) {\r
+               if (path[i] == '&' || path[i] == 5) {\r
+                       is_utf7 = 1;\r
+               }\r
+               else {\r
+                       if (is_utf7) {\r
+                               if (path[i] == '-') is_utf7 = 0;\r
+                       }\r
+                       else {\r
+                               path[i] = toupper(path[i]);\r
+                       }\r
+               }\r
+       }\r
+\r
+       return 1;\r
+}\r
+\r
+INTERNAL_FUNC void em_skip_whitespace(char *addr_str, char **pAddr)\r
+{\r
+       EM_DEBUG_FUNC_BEGIN("addr_str[%p]", addr_str);\r
+\r
+       if (!addr_str)\r
+               return ;\r
+       char *str = addr_str;\r
+       char ptr[strlen(str)+1]  ;\r
+       int i, j = 0;\r
+\r
+       str = addr_str ;\r
+       for (i = 0; str[i] != NULL_CHAR ; i++) {\r
+               if (str[i] != SPACE && str[i] != TAB && str[i] != CR && str[i] != LF)\r
+                       ptr[j++] = str[i];\r
+       }\r
+       ptr[j] = NULL_CHAR;\r
+\r
+       *pAddr = EM_SAFE_STRDUP(ptr);\r
+       EM_DEBUG_FUNC_END("ptr[%s]", ptr);\r
+}\r
+\r
+INTERNAL_FUNC char* em_skip_whitespace_without_strdup(char *source_string)\r
+{\r
+       EM_DEBUG_FUNC_BEGIN("source_string[%p]", source_string);\r
+\r
+       if (!source_string)\r
+               return NULL;\r
+       int i;\r
+\r
+       for (i = 0; source_string[i] != NULL_CHAR ; i++) {\r
+               if (source_string[i] != SPACE) /*  || source_string[i] != TAB || source_string[i] != CR || source_string[i] || LF) */\r
+                       break;\r
+       }\r
+\r
+       EM_DEBUG_FUNC_END("i[%d]", i);\r
+       return source_string + i;\r
+}\r
+\r
+INTERNAL_FUNC char* em_replace_string(char *source_string, char *old_string, char *new_string)\r
+{\r
+       EM_DEBUG_FUNC_BEGIN();\r
+       char *result_buffer = NULL;\r
+       char *p = NULL;\r
+       int   buffer_length = 0;\r
+\r
+       EM_IF_NULL_RETURN_VALUE(source_string, NULL);\r
+       EM_IF_NULL_RETURN_VALUE(old_string, NULL);\r
+       EM_IF_NULL_RETURN_VALUE(new_string, NULL);\r
+\r
+       p = strstr(source_string, old_string);\r
+\r
+       if (p == NULL) {\r
+               EM_DEBUG_EXCEPTION("old_string not found in source_string");\r
+               EM_DEBUG_FUNC_END("return NULL");\r
+               return NULL;\r
+       }\r
+\r
+       buffer_length   = strlen(source_string) + 1024;\r
+       result_buffer  = (char *)em_malloc(buffer_length);\r
+\r
+       if (!result_buffer) {\r
+               EM_DEBUG_EXCEPTION("em_malloc failed");\r
+               return NULL;\r
+       }\r
+\r
+       strncpy(result_buffer, source_string, p - source_string);\r
+       snprintf(result_buffer + strlen(result_buffer), buffer_length - strlen(result_buffer), "%s%s", new_string, p + strlen(old_string));\r
+\r
+       EM_DEBUG_FUNC_END("result_buffer[%s]", result_buffer);\r
+       return result_buffer;\r
+}\r
+\r
+/* Memory clean up */\r
+#include <sys/mman.h>\r
+\r
+/* #define GETSP()                             ({ unsigned int sp; asm volatile ("mov %0, sp " : "=r"(sp)); sp;}) */\r
+#define BUF_SIZE                               256\r
+#define PAGE_SIZE                          (1 << 12)\r
+#define _ALIGN_UP(addr, size)   (((addr)+((size)-1))&(~((size)-1)))\r
+#define _ALIGN_DOWN(addr, size) ((addr)&(~((size)-1)))\r
+#define PAGE_ALIGN(addr)        _ALIGN_DOWN(addr, PAGE_SIZE)\r
+\r
+int stack_trim(void)\r
+{\r
+       /*\r
+       char buf[BUF_SIZE];\r
+       FILE *file;\r
+       unsigned int stacktop;\r
+       int found = 0;\r
+       unsigned int sp;\r
+\r
+       asm volatile ("mov %0, sp " : "=r"(sp));\r
+\r
+       sprintf(buf, "/proc/%d/maps", getpid());\r
+       file = fopen(buf, "r");\r
+       while (fgets(buf, BUF_SIZE, file) != NULL) {\r
+               if (strstr(buf, "[stack]")) {\r
+                       found = 1;\r
+                       break;\r
+               }\r
+       }\r
+\r
+       fclose(file);\r
+\r
+       if (found) {\r
+               sscanf(buf, "%x-", &stacktop);\r
+               if (madvise((void *)PAGE_ALIGN(stacktop), PAGE_ALIGN(sp)-stacktop, MADV_DONTNEED) < 0)\r
+                       perror("stack madvise fail");\r
+       }\r
+       */\r
+       return 1;\r
+}\r
+\r
+INTERNAL_FUNC void em_flush_memory()\r
+{\r
+       EM_DEBUG_FUNC_BEGIN();\r
+       /*  flush memory in heap */\r
+       malloc_trim(0);\r
+\r
+       /*  flush memory in stack */\r
+       stack_trim();\r
+\r
+       /*  flush memory for sqlite */\r
+       emstorage_flush_db_cache();\r
+       EM_DEBUG_FUNC_END();\r
+}\r
+\r
+#define DATE_TIME_STRING_LEGNTH 14\r
+\r
+INTERNAL_FUNC char *em_get_extension_from_file_path(char *source_file_path, int *err_code)\r
+{\r
+       EM_DEBUG_FUNC_BEGIN("source_file_path[%s]", source_file_path);\r
+       int err = EMF_ERROR_NONE, pos_on_string = 0;\r
+       char *extension = NULL;\r
+\r
+       if (!source_file_path) {\r
+               EM_DEBUG_EXCEPTION("Invalid Parameter");\r
+               err  = EMF_ERROR_INVALID_PARAM;\r
+               goto FINISH_OFF;\r
+       }\r
+\r
+       pos_on_string = strlen(source_file_path) - 1;\r
+\r
+       while(pos_on_string > 0 && source_file_path[pos_on_string--] != '.') ;\r
+\r
+       if(pos_on_string > 0)\r
+               extension = source_file_path + pos_on_string + 2;\r
+\r
+       EM_DEBUG_LOG("*extension [%s] pos_on_string [%d]", extension, pos_on_string);\r
+\r
+FINISH_OFF:\r
+       if (err_code)\r
+               *err_code = err;\r
+       EM_DEBUG_FUNC_END();\r
+       return extension;\r
+}\r
+\r
+INTERNAL_FUNC int em_get_encoding_type_from_file_path(const char *input_file_path, char **output_encoding_type)\r
+{\r
+       EM_DEBUG_FUNC_BEGIN("input_file_path[%d], output_encoding_type[%p]", input_file_path, output_encoding_type);\r
+       int   err = EMF_ERROR_NONE;\r
+       int   pos_of_filename = 0;\r
+       int   pos_of_dot = 0;\r
+       int   enf_of_string = 0;\r
+       int   result_string_length = 0;\r
+       char *filename = NULL;\r
+       char *result_encoding_type = NULL;\r
+\r
+       if (!input_file_path || !output_encoding_type) {\r
+               EM_DEBUG_EXCEPTION("Invalid Parameter");\r
+               err  = EMF_ERROR_INVALID_PARAM;\r
+               goto FINISH_OFF;\r
+       }\r
+\r
+       enf_of_string = pos_of_filename = strlen(input_file_path) - 1;\r
+\r
+       while(pos_of_filename >= 0 && input_file_path[pos_of_filename--] != '/') {\r
+               if(input_file_path[pos_of_filename] == '.')\r
+                       pos_of_dot = pos_of_filename;\r
+       }\r
+\r
+       if(pos_of_filename != 0)\r
+               pos_of_filename += 2;\r
+\r
+       filename = (char*)input_file_path + pos_of_filename;\r
+\r
+       if(pos_of_dot != 0 && pos_of_dot > pos_of_filename)\r
+               result_string_length = pos_of_dot - pos_of_filename;\r
+       else\r
+               result_string_length = enf_of_string - pos_of_filename;\r
+\r
+       EM_DEBUG_LOG("pos_of_dot [%d], pos_of_filename [%d], enf_of_string[%d],result_string_length [%d]", pos_of_dot, pos_of_filename, enf_of_string, result_string_length);\r
+\r
+       if( !(result_encoding_type =    em_malloc(sizeof(char) * (result_string_length + 1))) ) {\r
+               EM_DEBUG_EXCEPTION("EMF_ERROR_OUT_OF_MEMORY");\r
+               err  = EMF_ERROR_OUT_OF_MEMORY;\r
+               goto FINISH_OFF;\r
+       }\r
+\r
+       memcpy(result_encoding_type, input_file_path + pos_of_filename, result_string_length);\r
+\r
+       EM_DEBUG_LOG("*result_encoding_type [%s]", result_encoding_type);\r
+\r
+       *output_encoding_type = result_encoding_type;\r
+\r
+FINISH_OFF:\r
+       EM_DEBUG_FUNC_END("err [%d]", err);\r
+       return err;\r
+}\r
+\r
+INTERNAL_FUNC int em_get_content_type_from_extension_string(const char *extension_string, int *err_code)\r
+{\r
+       EM_DEBUG_FUNC_BEGIN("extension_string[%s]", extension_string);\r
+       int i = 0, err = EMF_ERROR_NONE, result_content_type = TYPEAPPLICATION;\r
+       char *image_extension[] = { "jpeg", "jpg", "png", "gif", "bmp", "pic", "agif", "tif", "wbmp" , NULL};\r
+\r
+       if (!extension_string) {\r
+               EM_DEBUG_EXCEPTION("Invalid Parameter");\r
+               err  = EMF_ERROR_INVALID_PARAM;\r
+               goto FINISH_OFF;\r
+       }\r
+\r
+       while(image_extension[i]) {\r
+               EM_DEBUG_LOG("image_extension[%d] [%s]", i, image_extension[i]);\r
+               if(strcasecmp(image_extension[i], extension_string) == 0) {\r
+                       result_content_type = TYPEIMAGE;\r
+                       break;\r
+               }\r
+               i++;\r
+       }\r
+\r
+FINISH_OFF:\r
+       if (err_code)\r
+               *err_code = err;\r
+       EM_DEBUG_FUNC_END();\r
+       return result_content_type;\r
+}\r
+\r
+#define EMAIL_ACCOUNT_RGEX                     "([a-z0-9!#$%&'*+/=?^_`{|}~-]+.)*[a-z0-9!#$%&'*+/=?^_`{|}~-]+"\r
+#define EMAIL_DOMAIN_RGEX                      "([a-z0-9!#$%&'*+/=?^_`{|}~-]+.)+[a-z0-9!#$%&'*+/=?^_`{|}~-]+"\r
+\r
+#define EMAIL_ADDR_RGEX                        "[[:space:]]*<"EMAIL_ACCOUNT_RGEX"@"EMAIL_DOMAIN_RGEX">[[:space:]]*"\r
+#define EMAIL_ALIAS_RGEX                       "([[:space:]]*\"[^\"]*\")?"EMAIL_ADDR_RGEX\r
+#define EMAIL_ALIAS_LIST_RGEX                  "^("EMAIL_ALIAS_RGEX"[;,])*"EMAIL_ALIAS_RGEX"[;,]?[[:space:]]*$"\r
+\r
+#define EMAIL_ADDR_WITHOUT_BRACKET_RGEX        "[[:space:]]*"EMAIL_ACCOUNT_RGEX"@"EMAIL_DOMAIN_RGEX"[[:space:]]*"\r
+#define EMAIL_ALIAS_WITHOUT_BRACKET_RGEX       "([[:space:]]*\"[^\"]*\")?"EMAIL_ADDR_WITHOUT_BRACKET_RGEX\r
+#define EMAIL_ALIAS_LIST_WITHOUT_BRACKET_RGEX  "("EMAIL_ALIAS_WITHOUT_BRACKET_RGEX"[;,])*"EMAIL_ADDR_WITHOUT_BRACKET_RGEX"[;,]?[[:space:]]*$"\r
+\r
+INTERNAL_FUNC int em_verify_email_address(char *address, int without_bracket, int *err_code)\r
+{\r
+       EM_DEBUG_FUNC_BEGIN("address[%s] without_bracket[%d]", address, without_bracket);\r
+\r
+       /*  this following code verfies the email alias string using reg. exp. */\r
+       regex_t alias_list_regex = {0};\r
+       int ret = false, error = EMF_ERROR_NONE;\r
+       char *reg_rule = NULL;\r
+\r
+       if(!address || strlen(address) == 0) {\r
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");\r
+               if (err_code)\r
+                       *err_code = EMF_ERROR_INVALID_PARAM;\r
+               return false;\r
+       }\r
+\r
+       if(without_bracket)\r
+               reg_rule = EMAIL_ALIAS_LIST_WITHOUT_BRACKET_RGEX;\r
+       else\r
+               reg_rule = EMAIL_ALIAS_LIST_RGEX;\r
+\r
+       if (regcomp(&alias_list_regex, reg_rule, REG_ICASE | REG_EXTENDED)) {\r
+               EM_DEBUG_EXCEPTION("email alias regex unrecognized");\r
+               if (err_code)\r
+                       *err_code = EMF_ERROR_UNKNOWN;\r
+               return false;\r
+       }\r
+\r
+       int alias_len = strlen(address) + 1;\r
+       regmatch_t pmatch[alias_len];\r
+\r
+       bzero(pmatch, alias_len);\r
+\r
+       if (regexec(&alias_list_regex, address, alias_len, pmatch, 0) == REG_NOMATCH)\r
+               EM_DEBUG_LOG("failed :[%s]", address);\r
+       else {\r
+               EM_DEBUG_LOG("success :[%s]", address);\r
+               ret = true;\r
+       }\r
+\r
+       regfree(&alias_list_regex);\r
+\r
+       if (err_code)\r
+               *err_code = error;\r
+\r
+       EM_DEBUG_FUNC_END("ret [%d]", ret);\r
+       return ret;\r
+}\r
+\r
+INTERNAL_FUNC int em_verify_email_address_of_mail_data(emf_mail_data_t *mail_data, int without_bracket, int *err_code)\r
+{\r
+       EM_DEBUG_FUNC_BEGIN("mail_data[%p] without_bracket[%d]", mail_data, without_bracket);\r
+       char *address_array[4] = { mail_data->full_address_from, mail_data->full_address_to, mail_data->full_address_cc, mail_data->full_address_bcc};\r
+       int  ret = false, err = EMF_ERROR_NONE, i;\r
+\r
+       /* check for email_address validation */\r
+       for (i = 0; i < 4; i++) {\r
+               if (address_array[i] && address_array[i][0] != 0) {\r
+                       if (!em_verify_email_address(address_array[i] , without_bracket, &err)) {\r
+                               err = EMF_ERROR_INVALID_ADDRESS;\r
+                               EM_DEBUG_EXCEPTION("Invalid Email Address [%d][%s]", i, address_array[i]);\r
+                               goto FINISH_OFF;\r
+                       }\r
+               }\r
+       }\r
+       ret = true;\r
+FINISH_OFF:\r
+       EM_DEBUG_FUNC_END("ret [%d]", ret);\r
+       return ret;\r
+}\r
+\r
+INTERNAL_FUNC int em_verify_email_address_of_mail_tbl(emstorage_mail_tbl_t *input_mail_tbl, int input_without_bracket)\r
+{\r
+       EM_DEBUG_FUNC_BEGIN("input_mail_tbl[%p] input_without_bracket[%d]", input_mail_tbl, input_without_bracket);\r
+       char *address_array[4] = { input_mail_tbl->full_address_to, input_mail_tbl->full_address_cc, input_mail_tbl->full_address_bcc, input_mail_tbl->full_address_from};\r
+       int  err = EMF_ERROR_NONE, i;\r
+\r
+       /* check for email_address validation */\r
+       for (i = 0; i < 4; i++) {\r
+               if (address_array[i] && address_array[i][0] != 0) {\r
+                       if (!em_verify_email_address(address_array[i] , input_without_bracket, &err)) {\r
+                               err = EMF_ERROR_INVALID_ADDRESS;\r
+                               EM_DEBUG_EXCEPTION("Invalid Email Address [%d][%s]", i, address_array[i]);\r
+                               goto FINISH_OFF;\r
+                       }\r
+               }\r
+       }\r
+\r
+FINISH_OFF:\r
+       EM_DEBUG_FUNC_END("err [%d]", err);\r
+       return err;\r
+}\r
+\r
+INTERNAL_FUNC int em_find_tag_for_thread_view(char *subject, int *result)\r
+{\r
+       EM_DEBUG_FUNC_BEGIN();\r
+       int error_code = EMF_ERROR_NONE;\r
+       char *copy_of_subject = NULL;\r
+\r
+       EM_IF_NULL_RETURN_VALUE(subject, EMF_ERROR_INVALID_PARAM);\r
+       EM_IF_NULL_RETURN_VALUE(result, EMF_ERROR_INVALID_PARAM);\r
+\r
+       *result = FALSE;\r
+\r
+       copy_of_subject = EM_SAFE_STRDUP(subject);\r
+\r
+       if (copy_of_subject == NULL) {\r
+               EM_DEBUG_EXCEPTION("strdup is failed.");\r
+               goto FINISH_OFF;\r
+       }\r
+\r
+       em_upper_string(copy_of_subject);\r
+       EM_DEBUG_LOG("em_upper_string result : %s\n", copy_of_subject);\r
+\r
+       if (strstr(copy_of_subject, "RE:") == NULL) {\r
+               if (strstr(copy_of_subject, "FWD:") == NULL) {\r
+                       if (strstr(copy_of_subject, "FW:") != NULL)\r
+                               *result = TRUE;\r
+               }\r
+               else\r
+                       *result = TRUE;\r
+       }\r
+       else\r
+               *result = TRUE;\r
+\r
+FINISH_OFF:\r
+       EM_SAFE_FREE(copy_of_subject);\r
+\r
+       EM_DEBUG_FUNC_END("result : %d", *result);\r
+\r
+       return error_code;\r
+}\r
+\r
+INTERNAL_FUNC int em_find_pos_stripped_subject_for_thread_view(char *subject, char *stripped_subject)\r
+{\r
+       EM_DEBUG_FUNC_BEGIN();\r
+       int error_code = EMF_ERROR_NONE;\r
+       int gap;\r
+       char *copy_of_subject = NULL, *curpos = NULL, *result;\r
+\r
+       EM_IF_NULL_RETURN_VALUE(subject, EMF_ERROR_INVALID_PARAM);\r
+       EM_IF_NULL_RETURN_VALUE(stripped_subject, EMF_ERROR_INVALID_PARAM);\r
+\r
+       copy_of_subject = EM_SAFE_STRDUP(subject);\r
+\r
+       if (copy_of_subject == NULL) {\r
+               EM_DEBUG_EXCEPTION("strdup is failed");\r
+               goto FINISH_OFF;\r
+       }\r
+\r
+       em_upper_string(copy_of_subject);\r
+       curpos = copy_of_subject;\r
+\r
+       EM_DEBUG_LOG("em_upper_string result : %s", copy_of_subject);\r
+\r
+       while ((result = strstr(curpos, "RE:")) != NULL) {\r
+               curpos = result + 3;\r
+               EM_DEBUG_LOG("RE result : %s", curpos);\r
+       }\r
+\r
+       while ((result = strstr(curpos, "FWD:")) != NULL) {\r
+               curpos = result + 4;\r
+               EM_DEBUG_LOG("FWD result : %s", curpos);\r
+       }\r
+\r
+       while ((result = strstr(curpos, "FW:")) != NULL) {\r
+               curpos = result + 3;\r
+               EM_DEBUG_LOG("FW result : %s", curpos);\r
+       }\r
+\r
+       while (curpos != NULL && *curpos == ' ') {\r
+               curpos++;\r
+       }\r
+\r
+       gap = curpos - copy_of_subject;\r
+\r
+       strcpy(stripped_subject, subject + gap);\r
+\r
+FINISH_OFF:\r
+       EM_SAFE_FREE(copy_of_subject);\r
+\r
+       if (error_code == EMF_ERROR_NONE && stripped_subject)\r
+               EM_DEBUG_LOG("result[%s]", stripped_subject);\r
+\r
+       EM_DEBUG_FUNC_END("error_code[%d]", error_code);\r
+       return error_code;\r
+}\r
+\r
+\r
+/*\r
+ * encoding base64\r
+ */\r
+INTERNAL_FUNC int em_encode_base64(char *src, unsigned long src_len, char **enc, unsigned long* enc_len, int *err_code)\r
+{\r
+       EM_DEBUG_FUNC_BEGIN();\r
+\r
+    unsigned char *content;\r
+    int ret = true, err = EMF_ERROR_NONE;\r
+\r
+       if (err_code != NULL) {\r
+               *err_code = EMF_ERROR_NONE;\r
+       }\r
+\r
+    content = rfc822_binary(src, src_len, enc_len);\r
+\r
+    if (content)\r
+        *enc = (char *)content;\r
+    else {\r
+        err = EMF_ERROR_UNKNOWN;\r
+        ret = false;\r
+    }\r
+\r
+    if (err_code)\r
+        *err_code = err;\r
+\r
+       EM_DEBUG_FUNC_END();\r
+    return ret;\r
+}\r
+\r
+/*\r
+ * decoding base64\r
+ */\r
+INTERNAL_FUNC int em_decode_base64(unsigned char *enc_text, unsigned long enc_len, char **dec_text, unsigned long* dec_len, int *err_code)\r
+{\r
+    unsigned char *text = enc_text;\r
+    unsigned long size = enc_len;\r
+    unsigned char *content;\r
+    int ret = true, err = EMF_ERROR_NONE;\r
+\r
+       if (err_code != NULL) {\r
+               *err_code = EMF_ERROR_NONE;\r
+       }\r
+\r
+    EM_DEBUG_FUNC_BEGIN();\r
+\r
+    content = rfc822_base64(text, size, dec_len);\r
+    if (content)\r
+        *dec_text = (char *)content;\r
+    else\r
+    {\r
+        err = EMF_ERROR_UNKNOWN;\r
+        ret = false;\r
+    }\r
+\r
+    if (err_code)\r
+        *err_code = err;\r
+\r
+    return ret;\r
+}\r
diff --git a/email-common-use/include/email-convert.h b/email-common-use/include/email-convert.h
new file mode 100755 (executable)
index 0000000..72bbd04
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+*  email-service
+*
+* Copyright (c) 2000 - 2011 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.
+*
+*/
+
+#ifndef __EMAIL_CONVERT_H__
+#define __EMAIL_CONVERT_H__
+
+#include <time.h>
+#include "email-internal-types.h"
+#include "email-debug-log.h"
+#include "email-storage.h"
+
+/* Account */
+INTERNAL_FUNC char* em_convert_account_to_byte_stream(emf_account_t* account, int* nStreamSize);
+INTERNAL_FUNC void  em_convert_byte_stream_to_account(char* pAccountStream,  emf_account_t* account);
+INTERNAL_FUNC int   em_convert_account_to_account_tbl(emf_account_t *account, emstorage_account_tbl_t *account_tbl);
+INTERNAL_FUNC int   em_convert_account_tbl_to_account(emstorage_account_tbl_t *account_tbl, emf_account_t *account);
+
+
+/* Mail */
+INTERNAL_FUNC char* em_convert_mail_data_to_byte_stream(emf_mail_data_t *input_mail_data, int intput_mail_data_count, int *output_stream_size);
+INTERNAL_FUNC void  em_convert_byte_stream_to_mail_data(char *intput_stream, emf_mail_data_t **output_mail_data, int *output_mail_data_count);
+
+INTERNAL_FUNC int   em_convert_mail_tbl_to_mail_data(emstorage_mail_tbl_t *mail_table_data, int item_count, emf_mail_data_t **mail_data, int *error);
+INTERNAL_FUNC int   em_convert_mail_data_to_mail_tbl(emf_mail_data_t *mail_data, int item_count, emstorage_mail_tbl_t **mail_table_data, int *error);
+
+/* Attachment */
+INTERNAL_FUNC char* em_convert_attachment_data_to_byte_stream(emf_attachment_data_t *input_attachment_data, int intput_attachment_count, int* output_stream_size);
+INTERNAL_FUNC void  em_convert_byte_stream_to_attachment_data(char *intput_stream, emf_attachment_data_t **output_attachment_data, int *output_attachment_count);
+
+INTERNAL_FUNC char* em_convert_attachment_info_to_byte_stream(emf_attachment_info_t* mail_atch, int* nStreamSize);
+INTERNAL_FUNC void  em_convert_byte_stream_to_attachment_info(char* pStream,  int attachment_num, emf_attachment_info_t** mail_atch);
+
+/* Mailbox */
+INTERNAL_FUNC char* em_convert_mailbox_to_byte_stream(emf_mailbox_t* pMailbox, int* nStreamSize);
+INTERNAL_FUNC void  em_convert_byte_stream_to_mailbox(char* pStream, emf_mailbox_t* pMailbox);
+
+/* Rule */
+INTERNAL_FUNC char* em_convert_rule_to_byte_stream(emf_rule_t* pRule, int* nStreamSize);
+INTERNAL_FUNC void  em_convert_byte_stream_to_rule(char* pStream, emf_rule_t* pMailbox);       
+
+/* Sending options */
+INTERNAL_FUNC char* em_convert_option_to_byte_stream(emf_option_t* pOption, int* nStreamSize);
+INTERNAL_FUNC void  em_convert_byte_stream_to_option(char* pStream, emf_option_t* pOption);
+
+/* time_t */
+INTERNAL_FUNC int   em_convert_string_to_time_t(char *input_datetime_string, time_t *output_time);
+INTERNAL_FUNC int   em_convert_time_t_to_string(time_t *input_time, char **output_datetime_string);
+
+/* emf_extra_flag_t */
+INTERNAL_FUNC char* em_convert_extra_flags_to_byte_stream(emf_extra_flag_t new_flag, int* StreamSize);
+INTERNAL_FUNC void  em_convert_byte_stream_to_extra_flags(char* pStream, emf_extra_flag_t* new_flag);
+
+/* emf_meeting_request_t */
+INTERNAL_FUNC char* em_convert_meeting_req_to_byte_stream(emf_meeting_request_t* meeting_req, int* nStreamSize);
+INTERNAL_FUNC void  em_convert_byte_stream_to_meeting_req(char* pStream,  emf_meeting_request_t* meeting_req);
+
+INTERNAL_FUNC int   em_convert_mail_flag_to_int(emf_mail_flag_t flag, int* i_flag, int* err_code);
+INTERNAL_FUNC int   em_convert_mail_int_to_flag(int i_flag, emf_mail_flag_t* flag, int* err_code);
+INTERNAL_FUNC int   em_convert_mail_status_to_mail_tbl(int mail_status, emstorage_mail_tbl_t *result_mail_tbl_data, int* err_code);
+INTERNAL_FUNC int   em_convert_mail_tbl_to_mail_status(emstorage_mail_tbl_t *mail_tbl_data, int *result_mail_status, int* err_code);
+INTERNAL_FUNC int   em_convert_mail_tbl_to_mail_flag(emstorage_mail_tbl_t *mail_tbl_data, emf_mail_flag_t *result_flag, int* err_code);
+INTERNAL_FUNC int   em_convert_mail_flag_to_mail_tbl(emf_mail_flag_t *flag, emstorage_mail_tbl_t *result_mail_tbl_data,  int* err_code);
+
+/* Search filter options */
+INTERNAL_FUNC char* em_convert_search_filter_to_byte_stream(email_search_filter_t *input_search_filter_list, int input_search_filter_count, int *output_stream_size);
+INTERNAL_FUNC void  em_convert_byte_stream_to_search_filter(char *input_stream, email_search_filter_t **output_search_filter_list, int *output_search_filter_count);
+#endif /* __EMAIL_CONVERT_H__ */
similarity index 83%
rename from include/emf-dbglog.h
rename to email-common-use/include/email-debug-log.h
index 6375d59..3344215 100755 (executable)
 
 
 /******************************************************************************
- * File: emf-dbglog.h
- * Desc: Mail Framework Debug Header
+ * File: email-debug-log.h
+ * Desc: email-common-use debug header
  *
  * Auth:
  *
  * History:
  *    2006.08.01 : created
  *****************************************************************************/
-#ifndef __DEBUG_LOG_H__
-#define __DEBUG_LOG_H__
+#ifndef __EMAIL_DEBUG_LOG_H__
+#define __EMAIL_DEBUG_LOG_H__
 
 #ifdef  __cplusplus
 extern "C"
@@ -40,16 +40,11 @@ extern "C"
 
 #include <stdio.h>
 #include <string.h>
-#include <glib.h>
-#include <glib-object.h>
 #include <dlog.h>
 
 #define __FEATURE_DEBUG_LOG__
 
 #ifdef  __FEATURE_DEBUG_LOG__
-
-#define        DEBUG_PREFIX    "Email-Engine"
-#define        LOG_FILE_PATH   "/var/log/email.log"
        
 /* definition of LOG_TAG */
 #ifdef LOG_TAG
@@ -58,19 +53,19 @@ extern "C"
 
 #define LOG_TAG "email-service"
 
-#define        EM_DEBUG_LOG(format, arg...)                  SLOGD("[%s:%s():%d] " format "\n", (rindex(__FILE__, '/')? rindex(__FILE__,'/')+1 : __FILE__ ), __FUNCTION__, __LINE__, ##arg)
-#define        EM_DEBUG_EXCEPTION(format, arg...)      SLOGE("[%s:%s():%d][EXCEPTION!!] " format "\n", (rindex(__FILE__, '/')? rindex(__FILE__,'/')+1 : __FILE__ ), __FUNCTION__,  __LINE__, ##arg)
+#define        EM_DEBUG_LOG(format, arg...)        SLOGD("[%s:%s():%d] " format "\n", (rindex(__FILE__, '/')? rindex(__FILE__,'/')+1 : __FILE__ ), __FUNCTION__, __LINE__, ##arg)
+#define        EM_DEBUG_EXCEPTION(format, arg...)  SLOGE("[%s:%s():%d][EXCEPTION!!] " format "\n", (rindex(__FILE__, '/')? rindex(__FILE__,'/')+1 : __FILE__ ), __FUNCTION__,  __LINE__, ##arg)
 
 #ifdef  _DEBUG_MIME_PARSE_
-#define EM_DEBUG_LOG_MIME(format, arg...)                  EM_DEBUG_LOG(format, ##arg)
+#define EM_DEBUG_LOG_MIME(format, arg...)   EM_DEBUG_LOG(format, ##arg)
 #else   /*  _DEBUG_MIME_PARSE */
 #define EM_DEBUG_LOG_MIME(format, arg...)      
 #endif /*  _DEBUG_MIME_PARSE */
 
-#define        EM_DEBUG_FUNC_BEGIN(format, arg...)     EM_DEBUG_LOG("BEGIN - "format, ##arg)
-#define        EM_DEBUG_FUNC_END(format, arg...)       EM_DEBUG_LOG("END - "format, ##arg)
-#define        EM_DEBUG_LINE                                           EM_DEBUG_LOG("FUNC[%s : %d]", __FUNCTION__, __LINE__)
-#define EM_DEBUG_DB_EXEC(eval, expr, X)               if (eval) { EM_DEBUG_LOG X; expr;} else {;}
+#define        EM_DEBUG_FUNC_BEGIN(format, arg...) EM_DEBUG_LOG("BEGIN - "format, ##arg)
+#define        EM_DEBUG_FUNC_END(format, arg...)   EM_DEBUG_LOG("END - "format, ##arg)
+#define        EM_DEBUG_LINE                       EM_DEBUG_LOG("FUNC[%s : %d]", __FUNCTION__, __LINE__)
+#define EM_DEBUG_DB_EXEC(eval, expr, X)     if (eval) { EM_DEBUG_LOG X; expr;} else {;}
 
 #define EM_DEBUG_ERROR_FILE_PATH            "/opt/data/email/.emfdata/.critical_error.log"
 #define EM_DEBUG_CRITICAL_EXCEPTION(format, arg...)   {   FILE *fp_error = NULL; fp_error = fopen(EM_DEBUG_ERROR_FILE_PATH, "a");\
@@ -225,4 +220,4 @@ extern "C"
 }
 #endif /* __cplusplu */
 
-#endif /* __DEBUG_LOG_H_ */
+#endif /* __EMAIL_DEBUG_LOG_H__ */
diff --git a/email-common-use/include/email-errors.h b/email-common-use/include/email-errors.h
new file mode 100755 (executable)
index 0000000..2a8a718
--- /dev/null
@@ -0,0 +1,129 @@
+/*\r
+*  email-service\r
+*\r
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+*\r
+* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com>\r
+*\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+* http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License.\r
+*\r
+*/\r
+\r
+\r
+#ifndef __EMAIL_ERRORS_H__\r
+#define __EMAIL_ERRORS_H__\r
+\r
+/*****************************************************************************/\r
+/*  Errors                                                                   */\r
+/*****************************************************************************/\r
+\r
+\r
+#define EMF_ERROR_NONE                                 1       /*  There is no error */\r
+#define EMF_ERROR_INVALID_PARAM                       -1001    /*  invalid parameter was given. - Invalid input parameter */\r
+#define EMF_ERROR_INVALID_ACCOUNT                     -1002    /*  invalid account information was given. - Unsupported account */\r
+#define EMF_ERROR_INVALID_USER                        -1003    /*  invalid user ID was given. - Invalid user or password */\r
+#define EMF_ERROR_INVALID_PASSWORD                    -1004    /*  invalid password was given. - Invalid user or password */\r
+#define EMF_ERROR_INVALID_SERVER                      -1005    /*  invalid server information was given. - Server unavailable */\r
+#define EMF_ERROR_INVALID_MAIL                        -1006    /*  invalid mail information was given */\r
+#define EMF_ERROR_INVALID_ADDRESS                     -1007    /*  invalid address information was given. - Incorrect address */\r
+#define EMF_ERROR_INVALID_ATTACHMENT                  -1008    /*  invalid attachment information was given */\r
+#define EMF_ERROR_INVALID_MAILBOX                     -1009    /*  invalid mailbox information was given */\r
+#define EMF_ERROR_INVALID_FILTER                      -1010    /*  invalid filter information was given */\r
+#define EMF_ERROR_INVALID_PATH                        -1011    /*  invalid flle path was given */\r
+#define EMF_ERROR_INVALID_DATA                        -1012    /*  invalid data */\r
+#define EMF_ERROR_INVALID_RESPONSE                    -1013    /*  unexpected network response was given. - Invalid server response */\r
+#define EMF_ERROR_ACCOUNT_NOT_FOUND                   -1014    /*  no matched account was found */\r
+#define EMF_ERROR_MAIL_NOT_FOUND                      -1015    /*  no matched mail was found */\r
+#define EMF_ERROR_MAILBOX_NOT_FOUND                   -1016    /*  no matched mailbox was found */\r
+#define EMF_ERROR_ATTACHMENT_NOT_FOUND                -1017    /*  no matched attachment was found */\r
+#define EMF_ERROR_FILTER_NOT_FOUND                    -1018    /*  no matched filter was found */\r
+#define EMF_ERROR_CONTACT_NOT_FOUND                   -1019    /*  no matched contact was found */\r
+#define EMF_ERROR_FILE_NOT_FOUND                      -1020    /*  no matched file was found */\r
+#define EMF_ERROR_DATA_NOT_FOUND                      -1021    /*  no matched data was found */\r
+#define EMF_ERROR_NO_MORE_DATA                        -1022    /*  No more data available */\r
+#define EMF_ERROR_ALREADY_EXISTS                      -1023    /*  data duplicated */\r
+#define EMF_ERROR_MAX_EXCEEDED                        -1024    /*  Can't handle more data */\r
+#define EMF_ERROR_DATA_TOO_LONG                       -1025    /*  Data is too long */\r
+#define EMF_ERROR_DATA_TOO_SMALL                      -1026    /*  Data is too small */\r
+#define EMF_ERROR_NETWORK_TOO_BUSY                    -1027    /*  Network is busy */\r
+#define EMF_ERROR_OUT_OF_MEMORY                       -1028    /*  There is not enough memory */\r
+#define EMF_ERROR_DB_FAILURE                          -1029    /*  database operation failed */\r
+#define EMF_ERROR_PROFILE_FAILURE                     -1030    /*  no proper profile was found */\r
+#define EMF_ERROR_SOCKET_FAILURE                      -1031    /*  socket operation failed */\r
+#define EMF_ERROR_CONNECTION_FAILURE                  -1032    /*  network connection failed */\r
+#define EMF_ERROR_CONNECTION_BROKEN                   -1033    /*  network connection was broken */\r
+#define EMF_ERROR_DISCONNECTED                        -1034    /*  connection was disconnected */\r
+#define EMF_ERROR_LOGIN_FAILURE                       -1035    /*  login failed */\r
+#define EMF_ERROR_NO_RESPONSE                         -1036    /*  There is no server response */\r
+#define EMF_ERROR_MAILBOX_FAILURE                     -1037    /*  The agent failed to scan mailboxes in server */\r
+#define EMF_ERROR_AUTH_NOT_SUPPORTED                  -1038    /*  The server doesn't support authentication */\r
+#define EMF_ERROR_AUTHENTICATE                        -1039    /*  The server failed to authenticate user */\r
+#define EMF_ERROR_TLS_NOT_SUPPORTED                   -1040    /*  The server doesn't support TLS */\r
+#define EMF_ERROR_TLS_SSL_FAILURE                     -1041    /*  The agent failed TLS/SSL */\r
+#define EMF_ERROR_APPEND_FAILURE                      -1042    /*  The agent failed to append mail to server */\r
+#define EMF_ERROR_COMMAND_NOT_SUPPORTED               -1043    /*  The server doesn't support this command */\r
+#define EMF_ERROR_ANNONYM_NOT_SUPPORTED               -1044    /*  The server doesn't support anonymous user */\r
+#define EMF_ERROR_CERTIFICATE_FAILURE                 -1045    /*  certificate failure - Invalid server certificate */\r
+#define EMF_ERROR_CANCELLED                           -1046    /*  The job was canceled by user */\r
+#define EMF_ERROR_NOT_IMPLEMENTED                     -1047    /*  The function was not implemented */\r
+#define EMF_ERROR_NOT_SUPPORTED                       -1048    /*  The function is not supported */\r
+#define EMF_ERROR_MAIL_LOCKED                         -1049    /*  The mail was locked */\r
+#define EMF_ERROR_SYSTEM_FAILURE                      -1050    /*  There is a system error */\r
+#define EMF_ERROR_MAIL_MAX_COUNT                      -1052    /*  The mailbox is full */\r
+#define EMF_ERROR_ACCOUNT_MAX_COUNT                   -1053    /*  There is too many account */\r
+#define EMF_ERROR_MAIL_MEMORY_FULL                    -1054    /*  There is no more storage */\r
+#define EMF_ERROR_MAIL_NOT_FOUND_ON_SERVER            -1055    /*  The expected mail is not found in server */\r
+#define EMF_ERROR_LOAD_ENGINE_FAILURE                 -1056    /*  loading engine failed */\r
+#define EMF_ERROR_CLOSE_FAILURE                       -1057    /*  engine is still used */\r
+#define EMF_ERROR_GCONF_FAILURE                       -1058    /*  The error occurred on accessing Gconf */\r
+#define EMF_ERROR_NO_SUCH_HOST                        -1059    /*  no such host was found */\r
+#define EMF_ERROR_EVENT_QUEUE_FULL                    -1060    /*  event queue is full */\r
+#define EMF_ERROR_EVENT_QUEUE_EMPTY                   -1061    /*  event queue is empty */\r
+#define EMF_ERROR_NO_RECIPIENT                        -1062    /*  no recipients information was found */\r
+#define EMF_ERROR_SMTP_SEND_FAILURE                   -1063    /*  SMTP send failed */\r
+#define EMF_ERROR_MAILBOX_OPEN_FAILURE                -1064    /*  accessing mailbox failed */\r
+#define EMF_ERROR_RETRIEVE_HEADER_DATA_FAILURE        -1065    /*  retrieving header failed */\r
+#define EMF_ERROR_XML_PARSER_FAILURE                  -1066    /*  XML parsing failed */\r
+#define EMF_ERROR_SESSION_NOT_FOUND                   -1067    /*  no matched session was found */\r
+#define EMF_ERROR_INVALID_STREAM                      -1068\r
+#define EMF_ERROR_AUTH_REQUIRED                       -1069    /*  SMTP Authentication needed */\r
+#define EMF_ERROR_POP3_DELE_FAILURE                   -1100\r
+#define EMF_ERROR_POP3_UIDL_FAILURE                   -1101\r
+#define EMF_ERROR_POP3_LIST_FAILURE                   -1102\r
+#define EMF_ERROR_IMAP4_STORE_FAILURE                 -1200\r
+#define EMF_ERROR_IMAP4_EXPUNGE_FAILURE               -1201\r
+#define EMF_ERROR_IMAP4_FETCH_UID_FAILURE             -1202\r
+#define EMF_ERROR_IMAP4_FETCH_SIZE_FAILURE            -1203\r
+#define EMF_ERROR_IMAP4_IDLE_FAILURE                  -1204    /*  IDLE faile */\r
+#define EMF_ERROR_NO_SIM_INSERTED                     -1205\r
+#define EMF_ERROR_FLIGHT_MODE                         -1206\r
+#define EMF_ERROR_VALIDATE_ACCOUNT                    -1208\r
+#define EMF_ERROR_NO_MMC_INSERTED                     -1209\r
+#define EMF_ERROR_ACTIVE_SYNC_NOTI_FAILURE            -1300\r
+#define EMF_ERROR_HANDLE_NOT_FOUND                    -1301\r
+#define EMF_ERROR_NULL_VALUE                          -1302\r
+#define EMF_ERROR_FAILED_BY_SECURITY_POLICY           -1303\r
+#define EMF_ERROR_CANNOT_NEGOTIATE_TLS                -1400    /*  "Cannot negotiate TLS" */\r
+#define EMF_ERROR_STARTLS                             -1401    /*  "STARTLS" */\r
+#define EMF_ERROR_IPC_CRASH                           -1500\r
+#define EMF_ERROR_IPC_CONNECTION_FAILURE              -1501\r
+#define EMF_ERROR_IPC_SOCKET_FAILURE                  -1502\r
+#define EMF_ERROR_IPC_PROTOCOL_FAILURE                -1503\r
+#define EMF_ERROR_LOGIN_ALLOWED_EVERY_15_MINS         -1600    /*  "login allowed only every 15 minutes" */\r
+#define EMF_ERROR_TOO_MANY_LOGIN_FAILURE              -1601    /*  "Too many login failure" */\r
+#define EMF_ERROR_ON_PARSING                          -1700\r
+#define EMF_ERROR_NETWORK_NOT_AVAILABLE               -1800    /*  WIFI not availble*/\r
+#define EMF_ERROR_CANNOT_STOP_THREAD                  -2000\r
+#define EMF_ERROR_UNKNOWN                             -8000    /*  unknown error */\r
+\r
+#endif /* __EMAIL_ERRORS_H__ */\r
similarity index 78%
rename from email-core/include/em-core-types.h
rename to email-common-use/include/email-internal-types.h
index a115cc5..eb214fd 100755 (executable)
@@ -21,7 +21,7 @@
 
 
 /******************************************************************************
- * File :  em-core-types.h
+ * File :  email-internal-types.h
  * Desc :  defines data structures and macros
  *
  * Auth : 
  * History : 
  *    2011.04.05  :  created
  *****************************************************************************/
-#ifndef __EM_CORE_TYPES_H__
-#define __EM_CORE_TYPES_H__
+#ifndef __EMAIL_INTERNAL_TYPES_H__
+#define __EMAIL_INTERNAL_TYPES_H__
 
-#include <pthread.h>
-#include "emf-types.h"
+#include "email-types.h"
 
 #ifdef __cplusplus
 extern "C"
 {
-#endif /*  __cplusplu */
+#endif /*  __cplusplus */
 
-#if !defined(EXPORT_API)
-#define EXPORT_API __attribute__((visibility("default")))
+#ifndef INTERNAL_FUNC
+#define INTERNAL_FUNC __attribute__((visibility("default")))
 #endif
 
 /* ----------------------------------------------------------------------------- */
@@ -58,14 +57,12 @@ extern "C"
 #define __FEATURE_DOWNLOAD_BODY_ATTACHMENT_OPTIMIZATION__
 #define __FEATURE_BULK_DELETE_MOVE_UPDATE_REQUEST_OPTI__
 #define __FEATURE_SYNC_CLIENT_TO_SERVER__
-#define __FEATURE_PROGRESS_IN_OUTBOX__
 #define __FEATURE_AUTO_POLLING__
 #define __FEATURE_DEBUG_LOG__
-#define __FEATURE_USE_PTHREAD__
 #define __FEATURE_USE_SHARED_MUTEX_FOR_GENERATING_MAIL_ID__
 /*  #define __FEATURE_USE_SHARED_MUTEX_FOR_PROTECTED_FUNC_CALL__ */
+/*  #define __FEATURE_IMAP_IDLE__ */
 #define __FEATURE_SUPPORT_ACTIVE_SYNC__
-
 #define __HEADER_OPTIMIZATION__                   /* Will be removed */
 #define __DOWNLOAD_BODY_ATTACHMENT_OPTIMIZATION__ /* Will be removed */
 
@@ -93,6 +90,10 @@ extern "C"
 #define MAX_PATH                            4096      /* /usr/src/linux-2.4.20-8/include/linux/limits.h */
 #define DATETIME_LENGTH                     16
 #define MAIL_ID_STRING_LENGTH               10
+#define        EMAIL_LIMITATION_FREE_SPACE         (5) /*  This value is 5MB */
+#define EMAIL_MAIL_MAX_COUNT                5000
+#define HTML_EXTENSION_STRING       ".htm"
+#define MAX_PATH_HTML               256
 
 #define DIR_SEPERATOR                       "/"
 
@@ -100,6 +101,10 @@ extern "C"
 #define DB_PATH                             "/opt/dbspace"
 #define EMAIL_SERVICE_DB_FILE_PATH          "/opt/dbspace/.email-service.db"
 
+#define EMAILPATH                                              DATA_PATH"/email"
+#define MAILHOME                                               DATA_PATH"/email/.emfdata"
+#define DIRECTORY_PERMISSION                0755
+
 #define VCONF_KEY_LAST_SYNC_TIME            "db/email/last_sync_time"
 #define VCONF_KEY_DEFAULT_SLOT_SIZE         "db/email/slot_size"
 #define VCONF_KEY_LATEST_MAIL_ID            "db/email/latest_mail_id"
@@ -112,6 +117,8 @@ extern "C"
 
 #define SHM_FILE_FOR_DB_LOCK                "/.email_shm_db_lock"
 
+#define NATIVE_EMAIL_APPLICATION_PKG        "com.samsung.email"
+
 #ifdef __FEATURE_USE_SHARED_MUTEX_FOR_GENERATING_MAIL_ID__
 #define SHM_FILE_FOR_MAIL_ID_LOCK           "/.email_shm_mail_id_lock"
 #endif /* __FEATURE_USE_SHARED_MUTEX_FOR_GENERATING_MAIL_ID__ */
@@ -137,8 +144,8 @@ extern "C"
 #define SAVE_TYPE_BUFFER                    2        /*  save content to buffer */
 #define SAVE_TYPE_FILE                      3        /*  save content to temporary file */
 
-#define FINISH_OFF_IF_CANCELED              if (!em_core_check_thread_status()) { err = EMF_ERROR_CANCELLED; goto FINISH_OFF; }
-#define CHECK_JOB_CANCELED()                {if (!em_core_check_thread_status()) goto JOB_CANCEL; }
+#define FINISH_OFF_IF_CANCELED              if (!emcore_check_thread_status()) { err = EMF_ERROR_CANCELLED; goto FINISH_OFF; }
+#define CHECK_JOB_CANCELED()                {if (!emcore_check_thread_status()) goto JOB_CANCEL; }
 
 #define SNPRINTF(buff, size, format, args...)  snprintf(buff, size, format, ##args)
 #define SNPRINTF_OFFSET(base_buf, offset, base_size, format, args...) \
@@ -147,7 +154,6 @@ extern "C"
                                snprintf(base_buf + _offset, base_size - _offset - 1, format, ##args);\
                        })
 
-#ifdef __FEATURE_USE_PTHREAD__
 #define THREAD_CREATE(tv, func, param, err)       { EM_DEBUG_LOG("THREAD_CREATE "#tv); err = pthread_create(&tv, NULL, func, param); }
 #define THREAD_CREATE_JOINABLE(tv, func, err)     { pthread_attr_t attr; EM_DEBUG_LOG("THREAD_CREATE_JOINABLE "#tv); \
                                                    pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);\
@@ -175,32 +181,9 @@ extern "C"
 #define LEAVE_RECURSIVE_CRITICAL_SECTION(cs)      {EM_DEBUG_LOG("LEAVE_RECURSIVE_CRITICAL_SECTION "#cs); if(cs) pthread_mutex_unlock(cs);}
 #define DELETE_RECURSIVE_CRITICAL_SECTION(cs)     {EM_DEBUG_LOG("DELETE_RECURSIVE_CRITICAL_SECTION "#cs); if(cs) pthread_mutex_destroy(cs);}
 typedef pthread_t thread_t;
-#else /*  __FEATURE_USE_PTHREAD__ */
-#define THREAD_CREATE(tv, func, param, err)       {EM_DEBUG_LOG("THREAD_CREATE "#tv); tv = g_thread_create(func, param, FALSE, NULL); if (tv == NULL) err = -1; else err = 0; }
-#define THREAD_CREATE_JOINABLE(tv, func, err)     {EM_DEBUG_LOG("THREAD_CREATE_JOINABLE "#tv); tv = g_thread_create(func, NULL, TRUE, NULL); if (tv == NULL) err = -1; else err = 0; }
-#define THREAD_JOIN(tv)                           {EM_DEBUG_LOG("THREAD_JOIN "#tv); g_thread_join(tv); }
-#define THREAD_SELF()                             g_thread_self()
-#define INITIALIZE_CRITICAL_SECTION(cs)           {EM_DEBUG_LOG("INITIALIZE_CRITICAL_SECTION "#cs); if (cs == NULL) cs = g_mutex_new(); }
-#define ENTER_CRITICAL_SECTION(cs)                {EM_DEBUG_LOG("ENTER_CRITICAL_SECTION "#cs); if (cs) g_mutex_lock(cs); }
-#define TRY_ENTER_CRITICAL_SECTION(cs)            {EM_DEBUG_LOG("TRY_ENTER_CRITICAL_SECTION "#cs); if (cs) g_mutex_trylock(cs); }
-#define LEAVE_CRITICAL_SECTION(cs)                {EM_DEBUG_LOG("LEAVE_CRITICAL_SECTION "#cs); if (cs) g_mutex_unlock(cs); }
-#define DELETE_CRITICAL_SECTION(cs)               {EM_DEBUG_LOG("DELETE_CRITICAL_SECTION "#cs); if (cs) g_mutex_free(cs); cs = NULL; }
-
-#define INITIALIZE_CONDITION_VARIABLE(cv)         {EM_DEBUG_LOG("INITIALIZE_CONDITION_VARIABLE "#cv); if (cv == NULL) cv = g_cond_new(); }
-#define SLEEP_CONDITION_VARIABLE(cv, cs)          {EM_DEBUG_LOG("SLEEP_CONDITION_VARIABLE "#cv); if (cv) g_cond_wait(cv, cs); }
-#define WAKE_CONDITION_VARIABLE(cv)               {EM_DEBUG_LOG("WAKE_CONDITION_VARIABLE "#cv); if (cv) g_cond_signal(cv); }
-#define DELETE_CONDITION_VARIABLE(cv)             {EM_DEBUG_LOG("DELETE_CONDITION_VARIABLE "#cv); if (cv) g_cond_free(cv); cv = NULL; }
-
-#define INITIALIZE_RECURSIVE_CRITICAL_SECTION(cs) {EM_DEBUG_LOG("INITIALIZE_RECURSIVE_CRITICAL_SECTION "#cs); g_static_rec_mutex_init(&cs); }
-#define ENTER_RECURSIVE_CRITICAL_SECTION(cs)      {EM_DEBUG_LOG("ENTER_RECURSIVE_CRITICAL_SECTION "#cs); g_static_rec_mutex_lock(&cs); }
-#define TRY_ENTER_RECURSIVE_CRITICAL_SECTION(cs)  {EM_DEBUG_LOG("TRY_ENTER_RECURSIVE_CRITICAL_SECTION "#cs); g_static_rec_mutex_trylock(&cs); }
-#define LEAVE_RECURSIVE_CRITICAL_SECTION(cs)      {EM_DEBUG_LOG("LEAVE_RECURSIVE_CRITICAL_SECTION "#cs); g_static_rec_mutex_unlock(&cs); }
-#define DELETE_RECURSIVE_CRITICAL_SECTION(cs)     {EM_DEBUG_LOG("DELETE_RECURSIVE_CRITICAL_SECTION "#cs); g_static_rec_mutex_free(&cs); }
-typedef GThread* thread_t;
-#endif /*  __FEATURE_USE_PTHREAD__ */
-
-#define SMTP_RESPONSE_OK               250     
-#define SMTP_RESPONSE_READY            354     
+
+#define SMTP_RESPONSE_OK                   250
+#define SMTP_RESPONSE_READY                354
 #define SMTP_RESPONSE_WANT_AUTH                505
 #define SMTP_RESPONSE_WANT_AUTH2       530
 #define SMTP_RESPONSE_UNAVAIL          550     
@@ -219,12 +202,13 @@ typedef enum
 
 typedef enum
 {
-       EMF_PROTOCOL_POP3 = 1, 
-       EMF_PROTOCOL_IMAP, 
-       EMF_PROTOCOL_SMTP, 
-       EMF_PROTOCOL_NONE = 0, 
+       EMF_PROTOCOL_NONE                        = 0,
+       EMF_PROTOCOL_POP3                        = 1,
+       EMF_PROTOCOL_IMAP                        = 2,
+       EMF_PROTOCOL_SMTP                        = 3,
 } emf_protocol_type_t;
 
+
 #ifdef __FEATURE_KEEP_CONNECTION__
 enum
 {
@@ -239,7 +223,7 @@ typedef struct
        int                      account_id;         /*  in general, account id */
        emf_event_type_t         type;
        emf_event_status_type_t  status;
-       char                    *event_param_data_1; /*  in general, mailbox name (exception in em_core_mail_send, em_core_mail_send_saved it is emf_option_t **/
+       char                    *event_param_data_1; /*  in general, mailbox name (exception in emcore_send_mail, emcore_send_saved_mail it is emf_option_t **/
        char                    *event_param_data_2;
        char                    *event_param_data_3;
        int                      event_param_data_4;
@@ -276,7 +260,6 @@ typedef struct
 } emf_session_t;
 
 #ifdef __FEATURE_KEEP_CONNECTION__
-
 typedef struct emf_connection_info
 {
        int                    account_id;
@@ -317,4 +300,4 @@ typedef struct
 }
 #endif /*  __cplusplus */
 
-#endif /*  __EM_CORE_TYPES_H_ */
+#endif /*  __EMAIL_INTERNAL_TYPES_H__ */
similarity index 61%
rename from include/emf-types.h
rename to email-common-use/include/email-types.h
index 8b878ed..bb02ab6 100755 (executable)
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-#ifndef __EMF_TYPES_H__
-#define __EMF_TYPES_H__
-
-/**
-* @defgroup EMAIL_FRAMEWORK Email Service
-* @{
-*/
-
-/**
-* @ingroup EMAIL_FRAMEWORK
-* @defgroup EMAIL_TYPES Email Types
-* @{
-*/
-/**
- * This file defines structures and enums of Email Framework.
- * @file       emf-types.h
- * @author     Kyu-ho Jo(kyuho.jo@samsung.com)
- * @author     Choongho Lee(ch715.lee@samsung.com)
- * @version    0.1
- * @brief      This file is the header file of Email Framework library.
- */
-
-
-#ifdef __cplusplus
-extern "C" 
-{
-#endif /* __cplusplus */
-
-#include <glib.h>
-#include <stdbool.h>
-
-
-/*****************************************************************************/
-/*  Macros                                                                   */
-/*****************************************************************************/
-
-#define MAILBOX_NAME_LENGTH             256
-#define MAX_EMAIL_ADDRESS_LENGTH        320                                    /*  64(user name) + 1(@) + 255(host name */
-#define MAX_DATETIME_STRING_LENGTH      20
-#define MAX_PREVIEW_TEXT_LENGTH         50                                     /* should be 512 */
-#define STRING_LENGTH_FOR_DISPLAY       100
-#define MEETING_REQ_OBJECT_ID_LENGTH    128                                    /* should be 256 */
-
-#define ALL_ACCOUNT                     0
-#define NEW_ACCOUNT_ID                  0xFFFFFFFE
-#define ALL_MAIL                        -1
-
-#define EMF_SEARCH_FILTER_NONE          0x00
-#define EMF_SEARCH_FILTER_SUBJECT       0x01
-#define EMF_SEARCH_FILTER_SENDER        0x02
-#define EMF_SEARCH_FILTER_RECIPIENT     0x04
-#define EMF_SEARCH_FILTER_ALL           0x07                                   /*  EMF_SEARCH_FILTER_SUBJECT + EMF_SEARCH_FILTER_SENDER + EMF_SEARCH_FILTER_RECIPIEN */
-
-#define EMF_SUCCESS                     0                                      /*  we need to modify the success return valu */
-
-#define EMF_ACC_GET_OPT_DEFAULT         0x01                                   /**< Default values without account name */
-#define EMF_ACC_GET_OPT_ACCOUNT_NAME    0x02                                   /**< Account name */
-#define EMF_ACC_GET_OPT_PASSWORD        0x04                                   /**< With password */
-#define EMF_ACC_GET_OPT_OPTIONS         0x08                                   /**< Account options : emf_option_t */
-#define EMF_ACC_GET_OPT_FULL_DATA       0xFF                                   /**< With all data of account */
-
-#define GET_FULL_DATA                   0x00
-#define GET_FULL_DATA_WITHOUT_PASSWORD  (EMF_ACC_GET_OPT_DEFAULT | EMF_ACC_GET_OPT_ACCOUNT_NAME | EMF_ACC_GET_OPT_OPTIONS )
-#define WITHOUT_OPTION                  (EMF_ACC_GET_OPT_DEFAULT | EMF_ACC_GET_OPT_ACCOUNT_NAME )
-#define ONLY_OPTION                     (EMF_ACC_GET_OPT_OPTIONS)
-
-#define THREAD_TYPE_RECEIVING           0                                      /**< for function 'email_activate_pdp' */
-#define THREAD_TYPE_SENDING             1                                      /**< for function 'email_activate_pdp' */
-
-#define EMF_IMAP_PORT                   143                                    /**< Specifies the default IMAP port.*/
-#define EMF_POP3_PORT                   110                                    /**< Specifies the default POP3 port.*/
-#define EMF_SMTP_PORT                   25                                     /**< Specifies the default SMTP port.*/
-#define EMF_IMAPS_PORT                  993                                    /**< Specifies the default IMAP SSL port.*/
-#define EMF_POP3S_PORT                  995                                    /**< Specifies the default POP3 SSL port.*/
-#define EMF_SMTPS_PORT                  465                                    /**< Specifies the default SMTP SSL port.*/
-#define EMF_ACCOUNT_MAX                 10                                     /**< Specifies the MAX account.*/
-
-#define EMF_INBOX_NAME                  "INBOX"                                /**< Specifies the name of inbox.*/
-#define EMF_DRAFTBOX_NAME               "DRAFTBOX"                             /**< Specifies the name of draftbox.*/
-#define EMF_OUTBOX_NAME                 "OUTBOX"                               /**< Specifies the name of outbox.*/
-#define EMF_SENTBOX_NAME                "SENTBOX"                              /**< Specifies the name of sentbox.*/
-#define EMF_TRASH_NAME                  "TRASH"                                /**< Specifies the name of trash.*/
-#define EMF_SPAMBOX_NAME                "SPAMBOX"                              /**< Specifies the name of spambox.*/
-
-#define EMF_INBOX_DISPLAY_NAME          "Inbox"                                /**< Specifies the display name of inbox.*/
-#define EMF_DRAFTBOX_DISPLAY_NAME       "Draftbox"                             /**< Specifies the display name of draftbox.*/
-#define EMF_OUTBOX_DISPLAY_NAME         "Outbox"                               /**< Specifies the display name of outbox.*/
-#define EMF_SENTBOX_DISPLAY_NAME        "Sentbox"                              /**< Specifies the display name of sentbox.*/
-#define EMF_TRASH_DISPLAY_NAME          "Trash"                                /**< Specifies the display name of sentbox.*/
-#define EMF_SPAMBOX_DISPLAY_NAME        "Spambox"                              /**< Specifies the display name of spambox.*/
-
-#define EMF_SEARCH_RESULT_MAILBOX_NAME  "_`S1!E2@A3#R4$C5^H6&R7*E8(S9)U0-L=T_" /**< Specifies the name of search mailbox.*/
-
-#define FAILURE                         -1
-#define SUCCESS                         0
-
-#define NATIVE_EMAIL_APPLICATION_PKG    "org.tizen.email"
-#define DAEMON_EXECUTABLE_PATH          "/usr/bin/email-service"
-
-#ifndef DEPRECATED 
-#define DEPRECATED                      __attribute__((deprecated))
-#endif
-
-#ifndef EXPORT_API
-#define EXPORT_API                      __attribute__((visibility("default")))
-#endif
-
-/* __LOCAL_ACTIVITY__ supported
-#define BULK_OPERATION_COUNT            50
-#define ALL_ACTIVITIES                  0
-*/
-
-/*****************************************************************************/
-/*  Enumerations                                                             */
-/*****************************************************************************/
-enum
-{
-       EMF_DELETE_LOCALLY = 0,                      /**< Specifies Mail Delete local only */
-       EMF_DELETE_LOCAL_AND_SERVER,                 /**< Specifies Mail Delete local & server */
-       EMF_DELETE_FOR_SEND_THREAD,                  /**< Created to check which activity to delete in send thread */
-};
-
-typedef enum
-{
-       NOTI_MAIL_ADD                       = 10000,
-       NOTI_MAIL_DELETE                    = 10001,
-       NOTI_MAIL_DELETE_ALL                = 10002,
-       NOTI_MAIL_DELETE_WITH_ACCOUNT       = 10003,
-       NOTI_MAIL_DELETE_FAIL               = 10007,
-       NOTI_MAIL_DELETE_FINISH             = 10008,
-
-       NOTI_MAIL_UPDATE                    = 10004,
-       NOTI_MAIL_FIELD_UPDATE              = 10020,    
-
-       NOTI_MAIL_MOVE                      = 10005,
-       NOTI_MAIL_MOVE_FAIL                 = 10010,
-       NOTI_MAIL_MOVE_FINISH               = 10006,
-
-       NOTI_THREAD_MOVE                    = 11000,
-       NOTI_THREAD_DELETE                  = 11001,
-       NOTI_THREAD_MODIFY_SEEN_FLAG        = 11002,
-
-       NOTI_ACCOUNT_ADD                    = 20000,
-       NOTI_ACCOUNT_DELETE                 = 20001,
-       NOTI_ACCOUNT_DELETE_FAIL            = 20003, 
-       NOTI_ACCOUNT_UPDATE                 = 20002,
-       NOTI_ACCOUNT_UPDATE_SYNC_STATUS     = 20010,
-       
-
-       NOTI_MAILBOX_ADD                    = 40000,
-       NOTI_MAILBOX_DELETE,
-       NOTI_MAILBOX_UPDATE,
-       /* To be added more */
-}emf_noti_on_storage_event;
-
-typedef enum
-{
-       NOTI_SEND_START                          = 1002,
-       NOTI_SEND_FINISH                         = 1004,
-       NOTI_SEND_FAIL                           = 1005, 
-       NOTI_SEND_CANCEL                         = 1003,
-
-       NOTI_DOWNLOAD_START                      = 2000,
-       NOTI_DOWNLOAD_FINISH,
-       NOTI_DOWNLOAD_FAIL,
-       NOTI_DOWNLOAD_CANCEL                     = 2004,
-       NOTI_DOWNLOAD_NEW_MAIL                   = 2003, 
-
-       NOTI_DOWNLOAD_BODY_START                 = 3000,
-       NOTI_DOWNLOAD_BODY_FINISH                = 3002,
-       NOTI_DOWNLOAD_BODY_FAIL                  = 3004,
-       NOTI_DOWNLOAD_BODY_CANCEL                = 3003,
-       NOTI_DOWNLOAD_MULTIPART_BODY             = 3001,
-
-       NOTI_DOWNLOAD_ATTACH_START               = 4000,
-       NOTI_DOWNLOAD_ATTACH_FINISH,
-       NOTI_DOWNLOAD_ATTACH_FAIL,
-       NOTI_DOWNLOAD_ATTACH_CANCEL,
-
-       NOTI_MAIL_DELETE_ON_SERVER_FAIL          = 5000,         
-       NOTI_MAIL_MOVE_ON_SERVER_FAIL,
-
-       NOTI_VALIDATE_ACCOUNT_FINISH             = 7000, 
-       NOTI_VALIDATE_ACCOUNT_FAIL,
-       NOTI_VALIDATE_ACCOUNT_CANCEL,
-
-       NOTI_VALIDATE_AND_CREATE_ACCOUNT_FINISH  = 8000,
-       NOTI_VALIDATE_AND_CREATE_ACCOUNT_FAIL,
-       NOTI_VALIDATE_AND_CREATE_ACCOUNT_CANCEL,
-
-       NOTI_VALIDATE_AND_UPDATE_ACCOUNT_FINISH  = 9000,
-       NOTI_VALIDATE_AND_UPDATE_ACCOUNT_FAIL,
-       NOTI_VALIDATE_AND_UPDATE_ACCOUNT_CANCEL,
-
-       /* To be added more */
-}emf_noti_on_network_event;
-
-
-
-/** 
- * This enumeration specifies the core engine type.
- */
-typedef enum      
-{
-       EMF_ENGINE_TYPE_EM_CORE        = 1,          /**< Specifies the Callia mail core engine.*/
-} emf_engine_type_t;
-
-/** 
- * This enumeration specifies the mail type of account.
- */
-typedef enum
-{
-       EMF_BIND_TYPE_DISABLE          = 0,          /**< Specifies the bind type for Disabled account.*/
-       EMF_BIND_TYPE_EM_CORE          = 1,          /**< Specifies the bind type for Callia.*/
-} emf_account_bind_t;
-
-/** 
- * This enumeration specifies the server type of account.
- */
-typedef enum
-{
-       EMF_SERVER_TYPE_POP3           = 1,          /**< Specifies the POP3 Server.*/
-       EMF_SERVER_TYPE_IMAP4,                       /**< Specifies the IMAP4 Server.*/
-       EMF_SERVER_TYPE_SMTP,                        /**< Specifies the SMTP Server.*/
-       EMF_SERVER_TYPE_NONE,                        /**< Specifies the Local.*/
-       EMF_SERVER_TYPE_ACTIVE_SYNC,                 /** < Specifies the Active Sync.  */
-} emf_account_server_t;
-
-/** 
- * This enumeration specifies the mode of retrieval.
- */
-typedef enum
-{
-       EMF_IMAP4_RETRIEVAL_MODE_NEW   = 0,          /**< Specifies the retrieval mode for new email.*/
-       EMF_IMAP4_RETRIEVAL_MODE_ALL,                /**< Specifies the retrieval mode for all email.*/
-} emf_imap4_retrieval_mode_t;
-
-/** 
- * This enumeration specifies the filtering type.
- */
-typedef enum
-{
-       EMF_FILTER_FROM                = 1,          /**< Specifies the filtering of sender.*/
-       EMF_FILTER_SUBJECT,                          /**< Specifies the filtering of email subject.*/
-       EMF_FILTER_BODY,                             /** < Specifies the filterinf of email body.*/
-} emf_rule_type_t;
-
-
-/** 
- * This enumeration specifies the rules for filtering type.
- */
-typedef enum
-{
-       RULE_TYPE_INCLUDES             = 1,          /**< Specifies the filtering rule for includes.*/
-       RULE_TYPE_EXACTLY,                           /**< Specifies the filtering rule for Exactly same as.*/
-} emf_filtering_type_t;
-
-
-/** 
- * This enumeration specifies the action for filtering type.
- */
-typedef enum
-{
-       EMF_FILTER_MOVE                = 1,          /**< Specifies the move of email.*/
-       EMF_FILTER_BLOCK               = 2,          /**< Specifies the block of email.*/
-       EMF_FILTER_DELETE              = 3,          /**< Specifies delete  email.*/
-} emf_rule_action_t;
-
-/** 
- * This enumeration specifies the email status. 
- */
-typedef enum
-{
-       EMF_MAIL_STATUS_NONE           = 0,          /**< The Mail is in No Operation state */
-       EMF_MAIL_STATUS_RECEIVED,                    /**< The mail is a received mail.*/
-       EMF_MAIL_STATUS_SENT,                        /**< The mail is a sent mail.*/
-       EMF_MAIL_STATUS_SAVED,                       /**< The mail is a saved mail.*/
-       EMF_MAIL_STATUS_SAVED_OFFLINE,               /**< The mail is a saved mail in offline-mode.*/
-       EMF_MAIL_STATUS_SENDING,                     /**< The mail is being sent.*/
-       EMF_MAIL_STATUS_SEND_FAILURE,                /**< The mail is a mail to been failed to send.*/
-       EMF_MAIL_STATUS_SEND_CANCELED,               /**< The mail is a cancelled mail.*/ 
-       EMF_MAIL_STATUS_SEND_WAIT,                   /**< The mail is a mail to be send .*/
-} emf_mail_status_t;
-
-/** 
- * This enumeration specifies the email priority. 
- */
-typedef enum
-{
-       EMF_MAIL_PRIORITY_HIGH         = 1,          /**< The priority is high.*/
-       EMF_MAIL_PRIORITY_NORMAL       = 3,          /**< The priority is normal.*/
-       EMF_MAIL_PRIORITY_LOW          = 5,          /**< The priority is low.*/
-} emf_mail_priority_t;
-
-/** 
- * This enumeration specifies the email status. 
- */
-typedef enum
-{
-       EMF_MAIL_REPORT_NONE           = 0,          /**< The mail isn't report mail.*/
-       EMF_MAIL_REPORT_DSN,                         /**< The mail is a delivery-status report mail.*/
-       EMF_MAIL_REPORT_MDN,                         /**< The mail is a read-status report mail.*/
-       EMF_MAIL_REPORT_REQUEST,                     /**< The mail require a read-status report mail.*/
-} emf_mail_report_t;
-
-/** 
- * This enumeration specifies the DRM type
- */
-typedef enum 
-{
-       EMF_ATTACHMENT_DRM_NONE        = 0,          /**< The mail isn't DRM file.*/
-       EMF_ATTACHMENT_DRM_OBJECT,                   /**< The mail is a DRM object.*/
-       EMF_ATTACHMENT_DRM_RIGHTS,                   /**< The mail is a DRM rights as xml format.*/
-       EMF_ATTACHMENT_DRM_DCF,                      /**< The mail is a DRM dcf.*/
-} emf_attachment_drm_t;
-
-typedef enum 
-{
-       EMF_MAIL_TYPE_NORMAL           = 0,          /*  NOT a meeting request mail. A Normal mail */
-       EMF_MAIL_TYPE_MEETING_REQUEST  = 1,          /*  a meeting request mail from a serve */
-       EMF_MAIL_TYPE_MEETING_RESPONSE = 2,          /*  a response mail about meeting reques */
-       EMF_MAIL_TYPE_MEETING_ORIGINATINGREQUEST = 3 /*  a originating mail about meeting reques */
-} emf_mail_type_t;
-
-typedef enum 
-{
-       EMF_MEETING_RESPONSE_NONE      = 0,
-       EMF_MEETING_RESPONSE_ACCEPT,
-       EMF_MEETING_RESPONSE_TENTATIVE,
-       EMF_MEETING_RESPONSE_DECLINE,
-       EMF_MEETING_RESPONSE_REQUEST,                /*  create a meeting reques */
-       EMF_MEETING_RESPONSE_CANCEL,                 /*  create a meeting cancelatio */
-} emf_meeting_response_t;
-
-
-typedef enum 
-{
-       EMF_ACTION_SEND_MAIL           = 0,
-       EMF_ACTION_SYNC_HEADER,
-       EMF_ACTION_DOWNLOAD_BODY,
-       EMF_ACTION_DOWNLOAD_ATTACHMENT,
-       EMF_ACTION_DELETE_MAIL,
-       EMF_ACTION_SEARCH_MAIL, 
-       EMF_ACTION_SAVE_MAIL,
-       EMF_ACTION_SYNC_MAIL_FLAG_TO_SERVER,
-       EMF_ACTION_SYNC_FLAGS_FIELD_TO_SERVER,
-       EMF_ACTION_MOVE_MAIL,
-       EMF_ACTION_CREATE_MAILBOX,                   /*  = 1 */
-       EMF_ACTION_DELETE_MAILBOX,
-       EMF_ACTION_SYNC_HEADER_OMA,
-       EMF_ACTION_VALIDATE_ACCOUNT,
-       EMF_ACTION_VALIDATE_AND_CREATE_ACCOUNT,
-       EMF_ACTION_VALIDATE_AND_UPDATE_ACCOUNT,
-       EMF_ACTION_ACTIVATE_PDP        = 20,
-       EMF_ACTION_DEACTIVATE_PDP,
-       EMF_ACTION_UPDATE_MAIL,
-       EMF_ACTION_SET_MAIL_SLOT_SIZE,
-       EMF_ACTION_NUM,
-} emf_action_t;
-
-/** 
- * This enumeration specifies the status of getting envelope list.
- */
-typedef enum
-{
-       EMF_LIST_NONE                  = 0,
-       EMF_LIST_WAITING,
-       EMF_LIST_PREPARE,                            /**< Specifies the preparation.*/
-       EMF_LIST_CONNECTION_START,                   /**< Specifies the connection start.*/
-       EMF_LIST_CONNECTION_SUCCEED,                 /**< Specifies the success of connection.*/
-       EMF_LIST_CONNECTION_FINISH,                  /**< Specifies the connection finish.*/
-       EMF_LIST_CONNECTION_FAIL,                    /**< Specifies the connection failure.*/
-       EMF_LIST_START,                              /**< Specifies the getting start.*/
-       EMF_LIST_PROGRESS,                           /**< Specifies the status of getting.*/
-       EMF_LIST_FINISH,                             /**< Specifies the getting complete.*/
-       EMF_LIST_FAIL,                               /**< Specifies the download failure.*/
-} emf_envelope_list_status_t;
-
-/** 
- * This enumeration specifies the downloaded status of email. 
- */
-typedef enum
-{
-       EMF_DOWNLOAD_NONE              = 0,
-       EMF_DOWNLOAD_WAITING,
-       EMF_DOWNLOAD_PREPARE,                        /**< Specifies the preparation.*/
-       EMF_DOWNLOAD_CONNECTION_START,               /**< Specifies the connection start.*/
-       EMF_DOWNLOAD_CONNECTION_SUCCEED,             /**< Specifies the success of connection.*/
-       EMF_DOWNLOAD_CONNECTION_FINISH,              /**< Specifies the connection finish.*/
-       EMF_DOWNLOAD_CONNECTION_FAIL,                /**< Specifies the connection failure.*/
-       EMF_DOWNLOAD_START,                          /**< Specifies the download start.*/
-       EMF_DOWNLOAD_PROGRESS,                       /**< Specifies the status of download.*/
-       EMF_DOWNLOAD_FINISH,                         /**< Specifies the download complete.*/
-       EMF_DOWNLOAD_FAIL,                           /**< Specifies the download failure.*/
-} emf_download_status_t;
-
-/** 
- * This enumeration specifies the status of sending email.
- */
-typedef enum
-{
-       EMF_SEND_NONE                  = 0,
-       EMF_SEND_WAITING,
-       EMF_SEND_PREPARE,                            /**< Specifies the preparation.*/
-       EMF_SEND_CONNECTION_START,                   /**< Specifies the connection start.*/
-       EMF_SEND_CONNECTION_SUCCEED,                 /**< Specifies the success of connection.*/
-       EMF_SEND_CONNECTION_FINISH,                  /**< Specifies the connection finish.*/
-       EMF_SEND_CONNECTION_FAIL,                    /**< Specifies the connection failure.*/
-       EMF_SEND_START,                              /**< Specifies the sending start.*/
-       EMF_SEND_PROGRESS,                           /**< Specifies the status of sending.*/
-       EMF_SEND_FINISH,                             /**< Specifies the sending complete.*/
-       EMF_SEND_FAIL,                               /**< Specifies the sending failure.*/
-       EMF_SAVE_WAITING,                            /**< Specfies the Waiting of Sync */
-} emf_send_status_t;
-
-typedef enum
-{
-       EMF_SYNC_NONE                  = 0,
-       EMF_SYNC_WAITING,
-       EMF_SYNC_PREPARE,
-       EMF_SYNC_CONNECTION_START,
-       EMF_SYNC_CONNECTION_SUCCEED,
-       EMF_SYNC_CONNECTION_FINISH,
-       EMF_SYNC_CONNECTION_FAIL,
-       EMF_SYNC_START,
-       EMF_SYNC_PROGRESS,
-       EMF_SYNC_FINISH,
-       EMF_SYNC_FAIL,
-} emf_sync_status_t;
-
-/** 
-* This enumeration specifies the deleting status of email. 
-*/
-typedef enum
-{
-       EMF_DELETE_NONE                = 0,
-       EMF_DELETE_WAITING,
-       EMF_DELETE_PREPARE,                          /**< Specifies the preparation.*/
-       EMF_DELETE_CONNECTION_START,                 /**< Specifies the connection start.*/
-       EMF_DELETE_CONNECTION_SUCCEED,               /**< Specifies the success of connection.*/
-       EMF_DELETE_CONNECTION_FINISH,                /**< Specifies the connection finish.*/
-       EMF_DELETE_CONNECTION_FAIL,                  /**< Specifies the connection failure.*/
-       EMF_DELETE_START,                            /**< Specifies the deletion start.*/
-       EMF_DELETE_PROGRESS,                         /**< Specifies the status of deleting.*/
-       EMF_DELETE_SERVER_PROGRESS,                  /**< Specifies the status of server deleting.*/ 
-       EMF_DELETE_LOCAL_PROGRESS,                   /**< Specifies the status of local deleting.*/
-       EMF_DELETE_FINISH,                           /**< Specifies the deletion complete.*/
-       EMF_DELETE_FAIL,                             /**< Specifies the deletion failure.*/
-} emf_delete_status_t;
-
-/** 
-* This enumeration specifies the status of validating account
-*/
-typedef enum
-{
-       EMF_VALIDATE_ACCOUNT_NONE = 0,
-       EMF_VALIDATE_ACCOUNT_WAITING,
-       EMF_VALIDATE_ACCOUNT_PREPARE,                /**< Specifies the preparation.*/
-       EMF_VALIDATE_ACCOUNT_CONNECTION_START,       /**< Specifies the connection start.*/
-       EMF_VALIDATE_ACCOUNT_CONNECTION_SUCCEED,     /**< Specifies the success of connection.*/
-       EMF_VALIDATE_ACCOUNT_CONNECTION_FINISH,      /**< Specifies the connection finish.*/
-       EMF_VALIDATE_ACCOUNT_CONNECTION_FAIL,        /**< Specifies the connection failure.*/
-       EMF_VALIDATE_ACCOUNT_START,                  /**< Specifies the getting start.*/
-       EMF_VALIDATE_ACCOUNT_PROGRESS,               /**< Specifies the status of getting.*/
-       EMF_VALIDATE_ACCOUNT_FINISH,                 /**< Specifies the getting complete.*/
-       EMF_VALIDATE_ACCOUNT_FAIL,                   /**< Specifies the validation failure.*/
-} emf_validate_account_status_t;
-
-typedef enum 
-{
-       EMF_SET_SLOT_SIZE_NONE         = 0,
-       EMF_SET_SLOT_SIZE_WAITING,
-       EMF_SET_SLOT_SIZE_START,  
-       EMF_SET_SLOT_SIZE_FINISH,  
-       EMF_SET_SLOT_SIZE_FAIL,   
-}emf_set_slot_size_status_e;
-
-/**
-* This enumeration specifies the type of mailbox
-*/
-typedef enum 
-{
-       EMF_MAILBOX_TYPE_NONE          = 0,         /**< Unspecified mailbox type*/
-       EMF_MAILBOX_TYPE_INBOX         = 1,         /**< Specified inbox type*/
-       EMF_MAILBOX_TYPE_SENTBOX       = 2,         /**< Specified sent box type*/
-       EMF_MAILBOX_TYPE_TRASH         = 3,         /**< Specified trash type*/
-       EMF_MAILBOX_TYPE_DRAFT         = 4,         /**< Specified draft box type*/
-       EMF_MAILBOX_TYPE_SPAMBOX       = 5,         /**< Specified spam box type*/
-       EMF_MAILBOX_TYPE_OUTBOX        = 6,         /**< Specified outbox type*/
-       EMF_MAILBOX_TYPE_ALL_EMAILS    = 7,         /**< Specified all emails type of gmail*/
-       EMF_MAILBOX_TYPE_SEARCH_RESULT = 8,         /**< Specified mailbox type for result of search on server */
-       EMF_MAILBOX_TYPE_USER_DEFINED  = 0xFF,      /**< Specified mailbox type for all other mailboxes */
-}emf_mailbox_type_e;
-
-typedef enum
-{
-       EMF_SYNC_LATEST_MAILS_FIRST    = 0,
-       EMF_SYNC_OLDEST_MAILS_FIRST,
-       EMF_SYNC_ALL_MAILBOX_50_MAILS,
-} EMF_RETRIEVE_MODE;
-
-/*  event typ */
-typedef enum 
-{
-       EMF_EVENT_NONE                 = 0,
-       EMF_EVENT_SYNC_HEADER          = 1,          /*  synchronize mail headers with server (network used) */
-       EMF_EVENT_DOWNLOAD_BODY,                     /*  download mail body from server (network used)*/
-       EMF_EVENT_DOWNLOAD_ATTACHMENT,               /*  download mail attachment from server (network used) */
-       EMF_EVENT_SEND_MAIL,                         /*  send a mail (network used) */
-       EMF_EVENT_SEND_MAIL_SAVED,                   /*  send all mails in 'outbox' box (network used) */
-       EMF_EVENT_SYNC_IMAP_MAILBOX,                 /*  download imap mailboxes from server (network used) */
-       EMF_EVENT_DELETE_MAIL,                       /*  delete mails (network unused) */
-       EMF_EVENT_DELETE_MAIL_ALL,                   /*  delete all mails (network unused) */
-       EMF_EVENT_SYNC_MAIL_FLAG_TO_SERVER,          /*  sync mail flag to server */
-       EMF_EVENT_SYNC_FLAGS_FIELD_TO_SERVER,        /*  sync a field of flags to server */
-       EMF_EVENT_SAVE_MAIL,
-       EMF_EVENT_MOVE_MAIL,                         /*  move mails to specific mailbox on server */
-       EMF_EVENT_CREATE_MAILBOX,  
-       EMF_EVENT_UPDATE_MAILBOX,
-       EMF_EVENT_DELETE_MAILBOX,  
-       EMF_EVENT_ISSUE_IDLE,
-       EMF_EVENT_SYNC_HEADER_OMA,
-       EMF_EVENT_VALIDATE_ACCOUNT,
-       EMF_EVENT_VALIDATE_AND_CREATE_ACCOUNT, 
-       EMF_EVENT_VALIDATE_AND_UPDATE_ACCOUNT,  
-
-       EMF_EVENT_ADD_MAIL             = 10001,
-       EMF_EVENT_UPDATE_MAIL_OLD      = 10002,
-       EMF_EVENT_UPDATE_MAIL          = 10003,
-       EMF_EVENT_SET_MAIL_SLOT_SIZE   = 20000,
-  
-/*     EMF_EVENT_LOCAL_ACTIVITY,                    // __LOCAL_ACTIVITY_ */
-
-       EMF_EVENT_BULK_PARTIAL_BODY_DOWNLOAD,        /*  __FEATURE_PARTIAL_BODY_DOWNLOAD__ supported */
-       EMF_EVENT_LOCAL_ACTIVITY_SYNC_BULK_PBD,      /*  __FEATURE_PARTIAL_BODY_DOWNLOAD__ supported */
-       EMF_EVENT_GET_PASSWORD_LENGTH                /*  get password length of an account */
-} emf_event_type_t;
-
-/*  event statu */
-typedef enum 
-{
-       EMF_EVENT_STATUS_UNUSED        = 0,
-       EMF_EVENT_STATUS_WAIT,
-       EMF_EVENT_STATUS_STARTED,
-       EMF_EVENT_STATUS_CANCELED,
-} emf_event_status_type_t;
-
-
-/* sorting_orde */
-typedef enum 
-{
-       EMF_SORT_DATETIME_HIGH         = 0,
-       EMF_SORT_DATETIME_LOW,    
-       EMF_SORT_SENDER_HIGH,
-       EMF_SORT_SENDER_LOW,   
-       EMF_SORT_RCPT_HIGH,
-       EMF_SORT_RCPT_LOW,    
-       EMF_SORT_SUBJECT_HIGH,
-       EMF_SORT_SUBJECT_LOW,   
-       EMF_SORT_PRIORITY_HIGH,
-       EMF_SORT_PRIORITY_LOW,   
-       EMF_SORT_ATTACHMENT_HIGH,
-       EMF_SORT_ATTACHMENT_LOW,   
-       EMF_SORT_FAVORITE_HIGH,
-       EMF_SORT_FAVORITE_LOW,
-       EMF_SORT_MAILBOX_NAME_HIGH,
-       EMF_SORT_MAILBOX_NAME_LOW,
-       EMF_SORT_FLAGGED_FLAG_HIGH,
-       EMF_SORT_FLAGGED_FLAG_LOW,
-       EMF_SORT_SEEN_FLAG_HIGH,
-       EMF_SORT_SEEN_FLAG_LOW,
-       EMF_SORT_END,
-}emf_sort_type_t;
-
-typedef enum
-{
-       EMAIL_MAILBOX_SORT_BY_NAME_ASC  = 0, 
-       EMAIL_MAILBOX_SORT_BY_NAME_DSC,
-       EMAIL_MAILBOX_SORT_BY_TYPE_ASC, 
-       EMAIL_MAILBOX_SORT_BY_TYPE_DSC,
-} email_mailbox_sort_type_t;
-
-
-/** 
-* This enumeration specifies the priority.
-*/
-enum
-{
-       EMF_OPTION_PRIORITY_HIGH       = 1,          /**< Specifies the high priority.*/
-       EMF_OPTION_PRIORITY_NORMAL     = 3,          /**< Specifies the normal priority*/
-       EMF_OPTION_PRIORITY_LOW        = 5,          /**< Specifies the low priority.*/
-};
-
-/** 
-* This enumeration specifies the saving save a copy after sending.
-*/
-enum
-{
-       EMF_OPTION_KEEP_LOCAL_COPY_OFF = 0,          /**< Specifies off the keeping local copy.*/
-       EMF_OPTION_KEEP_LOCAL_COPY_ON  = 1,          /**< Specifies on the keeping local copy.*/
-};
-
-/** 
-* This enumeration specifies the request of delivery report.
-*/
-enum
-{
-       EMF_OPTION_REQ_DELIVERY_RECEIPT_OFF = 0,     /**< Specifies off the requesting delivery receipt.*/
-       EMF_OPTION_REQ_DELIVERY_RECEIPT_ON  = 1,     /**< Specifies on the requesting delivery receipt.*/
-};
-
-/** 
-* This enumeration specifies the request of read receipt.
-*/
-enum
-{
-       EMF_OPTION_REQ_READ_RECEIPT_OFF = 0,         /**< Specifies off the requesting read receipt.*/
-       EMF_OPTION_REQ_READ_RECEIPT_ON  = 1,         /**< Specifies on the requesting read receipt.*/
-};
-
-/** 
-* This enumeration specifies the blocking of address.
-*/
-enum
-{
-       EMF_OPTION_BLOCK_ADDRESS_OFF   = 0,          /**< Specifies off the blocking by address.*/
-       EMF_OPTION_BLOCK_ADDRESS_ON    = 1,          /**< Specifies on the blocking by address.*/
-};
-
-/** 
-* This enumeration specifies the blocking of subject.
-*/
-enum
-{
-       EMF_OPTION_BLOCK_SUBJECT_OFF   = 0,          /**< Specifies off the blocking by subject.*/
-       EMF_OPTION_BLOCK_SUBJECT_ON    = 1,          /**< Specifies on the blocking by subject.*/
-};
-
-enum
-{
-       EMF_LIST_TYPE_UNREAD           = -3,
-       EMF_LIST_TYPE_LOCAL            = -2,
-       EMF_LIST_TYPE_THREAD           = -1,
-       EMF_LIST_TYPE_NORMAL           = 0
-};
-
-/** 
-* This enumeration specifies the mailbox sync type.
-*/
-enum
-{
-       EMF_MAILBOX_ALL                = -1,         /**< All mailboxes.*/
-       EMF_MAILBOX_FROM_SERVER        = 0,          /**< Mailboxes from server. */
-       EMF_MAILBOX_FROM_LOCAL         = 1,          /**< Mailboxes from local. */
-};
-
-typedef enum 
-{
-       APPEND_BODY                    = 1,
-       UPDATE_MAILBOX,
-       UPDATE_ATTACHMENT_INFO,
-       UPDATE_FLAG,
-       UPDATE_SAVENAME,
-       UPDATE_EXTRA_FLAG,
-       UPDATE_MAIL,
-       UPDATE_DATETIME,
-       UPDATE_FROM_CONTACT_INFO,
-       UPDATE_TO_CONTACT_INFO,
-       UPDATE_ALL_CONTACT_NAME,
-       UPDATE_ALL_CONTACT_INFO,
-       UPDATE_STICKY_EXTRA_FLAG, 
-       UPDATE_PARTIAL_BODY_DOWNLOAD,
-       UPDATE_MEETING,
-       UPDATE_SEEN_FLAG_OF_THREAD,
-} emf_mail_change_type_t;
-
-
-/** 
-* This enumeration specifies the address type.
-*/
-typedef enum 
-{
-       EMF_ADDRESS_TYPE_FROM          = 1,          /**< Specifies the from address.*/
-       EMF_ADDRESS_TYPE_TO,                         /**< Specifies the to receipient address.*/
-       EMF_ADDRESS_TYPE_CC,                         /**< Specifies the cc receipient address.*/
-       EMF_ADDRESS_TYPE_BCC,                        /**< Specifies the bcc receipient address.*/
-       EMF_ADDRESS_TYPE_REPLY,                      /**< Specifies the reply receipient address.*/
-       EMF_ADDRESS_TYPE_RETURN,                     /**< Specifies the return receipient address.*/
-} emf_address_type_t;
-
-/** 
- * This enumeration specifies the search type for searching mailbox.
- */
-typedef enum 
-{
-       EMF_MAILBOX_SEARCH_KEY_TYPE_SUBJECT,         /**< The search key is for searching subject.*/
-       EMF_MAILBOX_SEARCH_KEY_TYPE_FROM,            /**< The search key is for searching sender address.*/
-       EMF_MAILBOX_SEARCH_KEY_TYPE_BODY,            /**< The search key is for searching body.*/
-       EMF_MAILBOX_SEARCH_KEY_TYPE_TO,              /**< The search key is for searching recipient address.*/
-} emf_mailbox_search_key_t;
-
-/** 
- * This enumeration specifies the download status of mail body.
- */
-
-typedef enum
-{
-       EMF_BODY_DOWNLOAD_STATUS_NONE = 0,
-       EMF_BODY_DOWNLOAD_STATUS_FULLY_DOWNLOADED = 1,
-       EMF_BODY_DOWNLOAD_STATUS_PARTIALLY_DOWNLOADED = 2,
-} emf_body_download_status_t;
-
-/** 
- * This enumeration specifies the moving type.
- */
-typedef enum
-{
-       EMF_MOVED_BY_COMMAND = 0,
-       EMF_MOVED_BY_MOVING_THREAD,
-       EMF_MOVED_AFTER_SENDING
-} emf_move_type;
-
-/** 
- * This enumeration specifies the deletion type.
- */
-typedef enum
-{
-       EMF_DELETED_BY_COMMAND = 0,
-       EMF_DELETED_BY_OVERFLOW,
-       EMF_DELETED_BY_DELETING_THREAD,
-       EMF_DELETED_BY_MOVING_TO_OTHER_ACCOUNT,
-       EMF_DELETED_AFTER_SENDING,
-       EMF_DELETED_FROM_SERVER,
-} emf_delete_type;
-
-/** 
- * This enumeration specifies the status field type.
- */
-typedef enum
-{
-       EMF_FLAGS_SEEN_FIELD = 0,
-       EMF_FLAGS_DELETED_FIELD,
-       EMF_FLAGS_FLAGGED_FIELD,
-       EMF_FLAGS_ANSWERED_FIELD,
-       EMF_FLAGS_RECENT_FIELD,
-       EMF_FLAGS_DRAFT_FIELD,
-       EMF_FLAGS_FORWARDED_FIELD,
-       EMF_FLAGS_FIELD_COUNT,
-} emf_flags_field_type;
-
-typedef enum
-{
-       EMF_FLAG_NONE                  = 0,
-       EMF_FLAG_FLAGED                = 1,
-       EMF_FLAG_TASK_STATUS_CLEAR     = 2,
-       EMF_FLAG_TASK_STATUS_ACTIVE    = 3,
-       EMF_FLAG_TASK_STATUS_COMPLETE  = 4,
-} emf_flagged_type;
-
-
-/*****************************************************************************/
-/*  Data Structures                                                          */
-/*****************************************************************************/
-
-/** 
- * This structure is used to save mail time.
- */
-typedef struct
-{
-       unsigned short year;                         /**< Specifies the Year.*/
-       unsigned short month;                        /**< Specifies the Month.*/
-       unsigned short day;                          /**< Specifies the Day.*/
-       unsigned short hour;                         /**< Specifies the Hour.*/
-       unsigned short minute;                       /**< Specifies the Minute.*/
-       unsigned short second;                       /**< Specifies the Second.*/
-} emf_datetime_t;
-
-/** 
- * This structure is used to save the options.
- */
-typedef struct
-{
-       int   priority;                              /**< Specifies the prority. 1=high 3=normal 5=low.*/
-       int   keep_local_copy;                       /**< Specifies the saving save a copy after sending.*/
-       int   req_delivery_receipt;                  /**< Specifies the request of delivery report. 0=off 1=on*/
-       int   req_read_receipt;                      /**< Specifies the request of read receipt. 0=off 1=on*/
-       int   download_limit;                        /**< Specifies the limit of size for downloading.*/
-       int   block_address;                         /**< Specifies the blocking of address. 0=off 1=on*/
-       int   block_subject;                         /**< Specifies the blocking of subject. 0=off 1=on*/
-       char *display_name_from;                     /**< Specifies the display name of from.*/
-       int   reply_with_body;                       /**< Specifies the replying with body 0=off 1=on*/
-       int   forward_with_files;                    /**< Specifies the fowarding with files 0=off 1=on*/
-       int   add_myname_card;                       /**< Specifies the adding name card 0=off 1=on*/
-       int   add_signature;                         /**< Specifies the adding signature 0=off 1=on*/
-       char *signature;                             /**< Specifies the signature*/
-       int   add_my_address_to_bcc;                 /**< Specifies whether bcc field should be always filled with my address. 0=off 1=on*/
-} emf_option_t;
-
-/** 
- * This structure is used to save the information of email account.
- */
-typedef struct 
-{
-       emf_account_bind_t          account_bind_type;      /**< Specifies the Bind Type.*/
-       char                       *account_name;           /**< Specifies the account name.*/
-       emf_account_server_t        receiving_server_type;  /**< Specifies the receiving server type.*/
-       char                       *receiving_server_addr;  /**< Specifies the address of receiving server.*/
-       char                       *email_addr;             /**< Specifies the email adderee.*/
-       char                       *user_name;              /**< Specifies the user name.*/
-       char                       *password;               /**< Specifies the password.*/
-       emf_imap4_retrieval_mode_t  retrieval_mode;         /**< Specifies the retrieval mode in IMAP case.*/
-       int                         port_num;               /**< Specifies the port number of receiving server.*/
-       int                         use_security;           /**< Specifies the security such as SSL.*/
-       emf_account_server_t        sending_server_type;    /**< Specifies the type of sending server.*/
-       char                       *sending_server_addr;    /**< Specifies the address of sending server.*/
-       int                         sending_port_num;       /**< Specifies the port number of sending server.*/
-       int                         sending_auth;           /**< Specifies the authentication of sending server.*/
-       int                         sending_security;       /**< Specifies the security such as SSL.*/
-       char                       *sending_user;           /**< Specifies the user name of SMTP server.*/
-       char                       *sending_password;       /**< Specifies the user password of SMTP server.*/
-       char                       *display_name;           /**< Specifies the display name.*/
-       char                       *reply_to_addr;          /**< Specifies the reply email address.*/
-       char                       *return_addr;            /**< Specifies the email address for return.*/
-       int                         account_id;             /**< Specifies the ID of account. Especially, 1 is assigned to Local Account.*/
-       int                         keep_on_server;         /**< Specifies the keeping mail on server.*/
-       int                         flag1;                  /**< Specifies the downloading option. 0 is subject only, 1 is text body, 2 is normal.*/
-       int                         flag2;                  /**< Specifies the 'Same as POP3' option. 0 is none, 1 is 'Same as POP3'.*/
-       int                         pop_before_smtp;        /**< POP before SMTP authentication */  
-       int                         apop;                   /**< APOP Authentication */
-       char                       *logo_icon_path;         /**< Account logo icon */
-       int                         preset_account;         /**< Preset account or not */
-       emf_option_t                options;                /**< Specifies the Sending options */
-       int                         target_storage;         /**< Specifies the targetStorage. 0 is phone, 1 is MMC */
-       int                         check_interval;         /**< Specifies the Check interval. Unit is minutes */
-       int                         my_account_id;          /**< Specifies accout id of my account */
-       int                         index_color;            /**< Specifies index color for displaying classifying accounts */
-}emf_account_t;
-
-/**
- * This structure is used to save the information of email server.
- */
-
-typedef struct
-{
-       int                         configuration_id;      /**< Specifies the id of configuration.*/
-       emf_account_server_t        protocol_type;         /**< Specifies the type of configuration.*/
-       char                       *server_addr;           /**< Specifies the address of configuration.*/
-       int                         port_number;           /**< Specifies the port number of configuration.*/
-       int                         security_type;         /**< Specifies the security such as SSL.*/
-       int                         auth_type;             /**< Specifies the authentication type of configuration.*/
-} emf_protocol_config_t;
-
-typedef struct
-{
-       char                       *service_name;           /**< Specifies the name of service.*/
-       int                         authname_format;        /**< Specifies the type of user name for authentication.*/
-       int                         protocol_conf_count;    /**< Specifies count of protocol configurations.*/
-       emf_protocol_config_t      *protocol_config_array;  /**< Specifies array of protocol configurations.*/
-} emf_server_info_t;
-
-typedef struct 
-{
-       int   mailbox_type;
-       char  mailbox_name[MAILBOX_NAME_LENGTH];
-} emf_mailbox_type_item_t;
-
-/** 
- * This structure is contains the Mail information.
- */
-
-typedef struct 
-{
-       int    mail_id;                 /**< Specifies the Mail ID.*/
-       int    account_id;              /**< Specifies the Account ID.*/
-       char  *mailbox_name;            /**< Specifies the Mailbox Name.*/
-       int    mailbox_type;            /**< Specifies the mailbox type of the mail. */
-       char  *subject;                 /**< Specifies the subject.*/
-       char  *datetime;                /**< Specifies the Date time.*/
-       int    server_mail_status;      /**< Specifies the Whether sever mail or not.*/
-       char  *server_mailbox_name;     /**< Specifies the server mailbox.*/
-       char  *server_mail_id;          /**< Specifies the Server Mail ID.*/
-       char  *message_id;              /**< Specifies the message id */ 
-       char  *full_address_from;       /**< Specifies the From Addr.*/
-       char  *full_address_reply;      /**< Specifies the Reply to addr */
-       char  *full_address_to;         /**< Specifies the To addr.*/
-       char  *full_address_cc;         /**< Specifies the CC addr.*/
-       char  *full_address_bcc;        /**< Specifies the BCC addr*/
-       char  *full_address_return;     /**< Specifies the return Path*/
-       char  *email_address_sender;    /**< Specifies the email address of sender.*/
-       char  *email_address_recipient; /**< Specifies the email address of recipients.*/
-       char  *alias_sender;            /**< Specifies the alias of sender. */
-       char  *alias_recipient;         /**< Specifies the alias of recipients. */
-       int    body_download_status;    /**< Specifies the Text donwloaded or not.*/
-       char  *file_path_plain;         /**< Specifies the path of text mail body.*/    
-       char  *file_path_html;          /**< Specifies the path of HTML mail body.*/       
-       int    mail_size;               /**< Specifies the Mail Size.*/   
-       char   flags_seen_field;        /**< Specifies the seen flags*/
-       char   flags_deleted_field;     /**< Specifies the deleted flags*/
-       char   flags_flagged_field;     /**< Specifies the flagged flags*/
-       char   flags_answered_field;    /**< Specifies the answered flags*/
-       char   flags_recent_field;      /**< Specifies the recent flags*/
-       char   flags_draft_field;       /**< Specifies the draft flags*/
-       char   flags_forwarded_field;   /**< Specifies the forwarded flags*/
-       int    DRM_status;              /**< Specifies the DRM state. */
-       int    priority;                /**< Specifies the priority of Mails.*/
-       int    save_status;             /**< Specifies the save status*/
-       int    lock_status;             /**< Specifies the Locked*/  
-       int    report_status;           /**< Specifies the Mail Report.*/
-       int    attachment_count;        /**< Specifies the attachment count. */
-       int    inline_content_count;    /**< Specifies the inline content count. */
-       int    thread_id;               /**< Specifies the thread id for thread view. */        
-       int    thread_item_count;       /**< Specifies the item count of specific thread. */
-       char  *preview_text;            /**< Specifies the preview body. */            
-       int    meeting_request_status;  /**< Specifies the status of meeting request. */
-}emf_mail_data_t;
-
-/** 
- * This structure is contains information for displaying mail list.
- */
-typedef struct 
-{
-       int  mail_id;                                          /**< Specifies the Mail ID.*/
-       int  account_id;                                       /**< Specifies the Account ID.*/
-       char mailbox_name[STRING_LENGTH_FOR_DISPLAY];          /**< Specifies the Mailbox Name.*/
-       char from[STRING_LENGTH_FOR_DISPLAY];                  /**< Specifies the from display name.*/
-       char from_email_address[MAX_EMAIL_ADDRESS_LENGTH];     /**< Specifies the from email address.*/
-       char recipients[STRING_LENGTH_FOR_DISPLAY];            /**< Specifies the recipients display name.*/
-       char subject[STRING_LENGTH_FOR_DISPLAY];               /**< Specifies the subject.*/
-       int  is_text_downloaded;                               /**< Specifies the Text donwloaded or not.*/
-       char datetime[MAX_DATETIME_STRING_LENGTH];             /**< Specifies the Date time.*/
-       char flags_seen_field;                                 /**< Specifies the seen flags*/
-       char flags_deleted_field;                              /**< Specifies the deleted flags*/
-       char flags_flagged_field;                              /**< Specifies the flagged flags*/
-       char flags_answered_field;                             /**< Specifies the answered flags*/
-       char flags_recent_field;                               /**< Specifies the recent flags*/
-       char flags_draft_field;                                /**< Specifies the draft flags*/
-       char flags_forwarded_field;                            /**< Specifies the forwarded flags*/
-       int  priority;                                         /**< Specifies the priority of Mails.*/
-       int  save_status;                                      /**< Specifies the save status*/
-       int  is_locked;                                        /**< Specifies the Locked*/
-       int  is_report_mail;                                   /**< Specifies the Mail Report.*/
-       int  recipients_count;                                 /**< Specifies the number of to Recipients*/
-       int  has_attachment;                                   /**< the mail has attachments or not[ 0: none, 1: over one] */
-       int  has_drm_attachment;                               /**< the mail has drm attachment or not*/
-       char previewBodyText[MAX_PREVIEW_TEXT_LENGTH];         /**< text for preview body*/
-       int  thread_id;                                        /**< thread id for thread view*/
-       int  thread_item_count;                                /**< item count of specific thread */
-       int  is_meeting_request;                               /**< Whether the mail is a meeting request or not */
-}emf_mail_list_item_t;
-
-/** 
- * This structure is used to save the filtering structure.
- */
-typedef struct 
-{
-       int                account_id;   /**< Specifies the account ID.*/
-       int                filter_id;    /**< Specifies the filtering ID.*/
-       emf_rule_type_t    type;         /**< Specifies the filtering type.*/
-       char              *value;        /**< Specifies the filtering value.*/
-       emf_rule_action_t  faction;      /**< Specifies the action type for filtering.*/
-       char              *mailbox;      /**< Specifies the mail box if action type means move.*/
-       int                flag1;        /**< Specifies the activation.*/
-       int                flag2;        /**< Reserved.*/
-} emf_rule_t;
-
-/** 
- * This structure is used to save the information of mail flag.
- */
-typedef struct
-{
-       unsigned int  seen           : 1; /**< Specifies the read email.*/
-       unsigned int  deleted        : 1; /**< Reserved.*/
-       unsigned int  flagged        : 1; /**< Specifies the flagged email.*/
-       unsigned int  answered       : 1; /**< Reserved.*/
-       unsigned int  recent         : 1; /**< Reserved.*/
-       unsigned int  draft          : 1; /**< Specifies the draft email.*/
-       unsigned int  has_attachment : 1; /**< Reserved.*/
-       unsigned int  forwarded      : 1; /**< Reserved.*/
-       unsigned int  sticky         : 1; /**< Sticky flagged mails cannot be deleted */
-} emf_mail_flag_t;
-
-
-/** 
- * This structure is used to save the information of mail extra flag.
- */
-typedef struct
-{
-       unsigned int  priority         : 3; /**< Specifies the mail priority. 
-                                           The value is greater than or equal to EMF_MAIL_PRIORITY_HIGH.
-                                           The value is less than or eqult to EMF_MAIL_PRIORITY_LOW.*/
-       unsigned int  status           : 4; /**< Specifies the mail status. 
-                                              The value is a value of enumeration emf_mail_status_t.*/
-       unsigned int  noti             : 1; /**< Specifies the notified mail.*/ 
-       unsigned int  lock             : 1; /**< Specifies the locked mail.*/   
-       unsigned int  report           : 2; /**< Specifies the MDN/DSN mail. The value is a value of enumeration emf_mail_report_t.*/
-       unsigned int  drm              : 1; /**< Specifies the drm mail.*/
-       unsigned int  text_download_yn : 2; /**< body download y/n*/            /* To be removed */
-} emf_extra_flag_t;
-
-/** 
- * This structure is used to save the email basic information.
- */
-typedef struct 
-{
-       int               account_id;           /**< Specifies the email's account ID.*/
-       int               uid;                  /**< Specifies the email's UID on local.*/
-       int               rfc822_size;          /**< Specifies the email's size.*/
-       int               body_downloaded;      /**< Specifies the download of email body.*/
-       emf_mail_flag_t   flags;                /**< Specifies the email's flag information.*/
-       emf_extra_flag_t  extra_flags;          /**< Specifies the email's extra flag information.*/
-       char             *sid;                  /**< Specifies the email's UID on server.*/
-       int               is_meeting_request;   /**< Specifies whether this mail is a meeting request mail or not. 0: normal mail, 1: meeting request mail from server, 2: response mail about meeting request mail */
-       int               thread_id;            /**< Specifies the email's thread id.*/
-       int               thread_item_count;    /**< Specifies the item count of thread*/
-} emf_mail_info_t;
-
-/** 
- * This structure is used to save the information of email header.
- */
-typedef struct 
-{
-       char             *mid;                  /**< Specifies the message ID.*/
-       char             *subject;              /**< Specifies the email subject.*/
-       char             *to;                   /**< Specifies the recipient.*/
-       char             *from;                 /**< Specifies the sender.*/
-       char             *cc;                   /**< Specifies the carbon copy.*/
-       char             *bcc;                  /**< Specifies the blind carbon copy.*/
-       char             *reply_to;             /**< Specifies the replier.*/
-       char             *return_path;          /**< Specifies the address of return.*/
-       emf_datetime_t    datetime;             /**< Specifies the sending or receiving time.*/
-       char             *from_contact_name;
-       char             *to_contact_name;
-       char             *cc_contact_name;
-       char             *bcc_contact_name;
-       char             *previewBodyText;      /**< Specifies the text contains for preview body.*/
-} emf_mail_head_t;
-
-/** 
- * This structure is used to save the information of attachment.
- */
-typedef struct st_emf_attachment_info 
-{
-       int                            inline_content;
-       int                            attachment_id;   /**< Specifies the attachment ID*/
-       char                          *name;            /**< Specifies the attachment name.*/
-       int                            size;            /**< Specifies the attachment size.*/
-       int                            downloaded;      /**< Specifies the download of attachment.*/
-       char                          *savename;        /**< Specifies the absolute path of attachment.*/
-       int                            drm;             /**< Specifies the drm type.*/
-       struct st_emf_attachment_info *next;            /**< Specifies the pointer of next attachment.*/
-} emf_attachment_info_t;
-
-typedef struct 
-{
-       int   attachment_id;
-       char *attachment_name;
-       char *attachment_path;
-       int   attachment_size;
-       int   mail_id;
-       int   account_id;
-       char *mailbox_name;
-       int   save_status;
-       int   drm_status;
-       int   inline_content_status;
-} emf_attachment_data_t;
-
-/** 
- * This structure is used to save the information of email body
- */
-typedef struct 
-{
-       char                  *plain;          /**< Specifies the absolute path of file to contain email body (Plain Text).*/
-       char                  *plain_charset;  /**< Specifies the character set of plain text boy. */
-       char                  *html;           /**< Specifies the absolute path of file to contain email body (HTML).*/
-       int                    attachment_num; /**< Specifies the count of attachment.*/
-       emf_attachment_info_t *attachment;     /**< Specifies the structure of attachment.*/
-} emf_mail_body_t;
-
-/** 
- * This structure is used to save the information of email
- */
-typedef struct 
-{
-       emf_mail_info_t  *info;  /**< Specifies the structure pointer of mail basic information.*/
-       emf_mail_head_t  *head;  /**< Specifies the structure pointer of email header.*/
-       emf_mail_body_t  *body;  /**< Specifies the structure pointer of email body.*/
-} emf_mail_t;
-
-
-typedef struct 
-{
-       int        offset_from_GMT;
-       char       standard_name[32];
-       struct tm  standard_time_start_date;
-       int        standard_bias;
-       char       daylight_name[32];
-       struct tm  daylight_time_start_date;
-       int        daylight_bias;
-} emf_time_zone_t;
-
-typedef struct 
-{
-       int                     mail_id;                                        /**< Specifies the mail id of meeting request on DB. This is the primary key. */
-       emf_meeting_response_t  meeting_response;                               /**< Specifies the meeting response. */
-       struct tm               start_time;
-       struct tm               end_time;
-       char                   *location;                                       /**< Specifies the location of meeting. Maximum length of this string is 32768 */
-       char                    global_object_id[MEETING_REQ_OBJECT_ID_LENGTH]; /**< Specifies the object id. */
-       emf_time_zone_t         time_zone;
-} emf_meeting_request_t;
-
-/**
- * This structure is used to save the informatioin of sender list with unread/total mail counts
- */
-typedef struct 
-{
-       char *address;         /**< Specifies the address of a sender.*/
-       char *display_name;    /**< Specifies a display name. This may be one of contact name, alias in original mail and email address of sender. (Priority order : contact name, alias, email address) */
-       int   unread_count;    /**< Specifies the number of unread mails received from sender address*/
-       int   total_count;     /**< Specifies the total number of  mails which are received from sender address*/
-} emf_sender_list_t;
-
-
-/* Creates a type name for structure emf_mailbox_st */
-typedef struct emf_mailbox_st emf_mailbox_t; /**< This is an information of mail box. */
-
-/** 
- * This structure is used to save the information of mailbox.
- */
-struct emf_mailbox_st
-{
-       int                 mailbox_id;                 /**< Unique id on mailbox table.*/
-       char               *name;                       /**< Specifies the path of mailbox.*/
-       emf_mailbox_type_e  mailbox_type;
-       char               *alias;                      /**< Specifies the display name of mailbox.*/
-       int                 unread_count;               /**< Specifies the Unread Mail count in the mailbox.*/
-       int                 total_mail_count_on_local;  /**< Specifies the total number of mails in the mailbox in the local DB.*/
-       int                 total_mail_count_on_server; /**< Specifies the total number of mails in the mailbox in the mail server.*/
-       int                 hold_connection;            /**< Will have a valid socket descriptor when connection to server is active.. else 0>*/
-       int                 local;                      /**< Specifies the local mailbox.*/
-       int                 synchronous;                /**< Specifies the mailbox with synchronized the server.*/
-       int                 account_id;                 /**< Specifies the account ID for mailbox.*/
-       void               *user_data;                  /**< Specifies the internal data.*/
-       void               *mail_stream;                /**< Specifies the internal data.*/
-       int                 has_archived_mails;         /**< Specifies the archived mails.*/
-       int                 mail_slot_size;             /**< Specifies how many mails can be stored.*/           
-       char               *account_name;               /**< Specifies the name of account.*/           
-       emf_mailbox_t      *next;                       /**< Reserved.*/
-};
-
-
-typedef struct 
-{
-       char *contact_name;
-       char *email_address;
-       char *alias;
-       int   storage_type;
-       int   contact_id;
-} emf_mail_contact_info_t;
-
-typedef struct 
-{
-       emf_address_type_t  address_type;
-       char               *address;
-       char               *display_name;
-       int                 storage_type;
-       int                 contact_id;
-} emf_address_info_t;
-
-typedef struct
-{
-       GList *from;
-       GList *to;
-       GList *cc;
-       GList *bcc;
-} emf_address_info_list_t;
-
-typedef struct 
-{
-       int     contact_id;     /*  Inpu */
-       int     storage_type;   /*  Input, but not used in email-servic */
-       int     address_count;  /*  Inpu */
-       char  **address_list;   /*  Input, array of email account */
-       int     unread_count;   /*  Outpu */
-} emf_contact_item_for_count_t;
-
-typedef struct 
-{
-       int     contact_id;     /*  Inpu */
-       int     storage_type;   /*  Input, but not used in email-servic */
-       int     address_count;  /*  Inpu */
-       char  **address_list;   /*   Input array of email account */
-       int     mail_id_count;  /*  Outpu */
-       int    *mail_id_list;   /*   Outpu */
-} emf_contact_item_for_mail_id_t;
-
-typedef struct 
-{
-       int     address_type;           /* type of mail (sender : 0, recipient : 1)*/
-       int     address_count;  /*  The number of email addresse */
-       char  **address_list;   /*  strings of email addresse */
-}emf_email_address_list_t;
-
-/*  global account lis */
-typedef struct emf_account_list_t emf_account_list_t;
-struct emf_account_list_t
-{
-    emf_account_t *account;
-    emf_account_list_t *next;
-};
-
-
-/*****************************************************************************/
-/*  Errors                                                                   */
-/*****************************************************************************/
-
-#define EMF_ERROR_NONE                                 1       /*  There is no error */
-#define EMF_ERROR_INVALID_PARAM                       -1001    /*  invalid parameter was given. - Invalid input paramete */
-#define EMF_ERROR_INVALID_ACCOUNT                     -1002    /*  invalid account information was given. - Unsupported accoun */
-#define EMF_ERROR_INVALID_USER                        -1003    /*  NOT USED : unknown user ID was given. - Invalid user or passwor */
-#define EMF_ERROR_INVALID_PASSWORD                    -1004    /*  NOT USED : invalid password was given. - Invalid user or passwor */
-#define EMF_ERROR_INVALID_SERVER                      -1005    /*  invalid server information was given. - Server unavailabl */
-#define EMF_ERROR_INVALID_MAIL                        -1006    /*  invalid mail information was given */
-#define EMF_ERROR_INVALID_ADDRESS                     -1007    /*  invalid address information was given. - Incorrect addres */
-#define EMF_ERROR_INVALID_ATTACHMENT                  -1008    /*  invalid attachment information was given */
-#define EMF_ERROR_INVALID_MAILBOX                     -1009    /*  invalid mailbox information was given */
-#define EMF_ERROR_INVALID_FILTER                      -1010    /*  invalid filter information was given */
-#define EMF_ERROR_INVALID_PATH                        -1011    /*  invalid flle path was given */
-#define EMF_ERROR_INVALID_DATA                        -1012    /*  NOT USE */
-#define EMF_ERROR_INVALID_RESPONSE                    -1013    /*  unexpected network response was given. - Invalid server respons */
-#define EMF_ERROR_ACCOUNT_NOT_FOUND                   -1014    /*  no matched account was found */
-#define EMF_ERROR_MAIL_NOT_FOUND                      -1015    /*  no matched mail was found */
-#define EMF_ERROR_MAILBOX_NOT_FOUND                   -1016    /*  no matched mailbox was found */
-#define EMF_ERROR_ATTACHMENT_NOT_FOUND                -1017    /*  no matched attachment was found */
-#define EMF_ERROR_FILTER_NOT_FOUND                    -1018    /*  no matched filter was found */
-#define EMF_ERROR_CONTACT_NOT_FOUND                   -1019    /*  no matched contact was found */
-#define EMF_ERROR_FILE_NOT_FOUND                      -1020    /*  no matched file was found */
-#define EMF_ERROR_DATA_NOT_FOUND                      -1021    /*  NOT USE */
-#define EMF_ERROR_NO_MORE_DATA                        -1022    /*  NOT USE */
-#define EMF_ERROR_ALREADY_EXISTS                      -1023    /*  data duplicate */
-#define EMF_ERROR_MAX_EXCEEDED                        -1024    /*  NOT USE */
-#define EMF_ERROR_DATA_TOO_LONG                       -1025    /*  NOT USE */
-#define EMF_ERROR_DATA_TOO_SMALL                      -1026    /*  NOT USE */
-#define EMF_ERROR_NETWORK_TOO_BUSY                    -1027    /*  NOT USE */
-#define EMF_ERROR_OUT_OF_MEMORY                       -1028    /*  There is not enough memory */
-#define EMF_ERROR_DB_FAILURE                          -1029    /*  database operation failed */
-#define EMF_ERROR_PROFILE_FAILURE                     -1030    /*  no proper profile was found */
-#define EMF_ERROR_SOCKET_FAILURE                      -1031    /*  socket operation failed */
-#define EMF_ERROR_CONNECTION_FAILURE                  -1032    /*  network connection failed */
-#define EMF_ERROR_CONNECTION_BROKEN                   -1033    /*  network connection was broken */
-#define EMF_ERROR_DISCONNECTED                        -1034    /*  NOT USED : connection was disconnected */
-#define EMF_ERROR_LOGIN_FAILURE                       -1035    /*  login failed */
-#define EMF_ERROR_NO_RESPONSE                         -1036    /*  There is no server response */
-#define EMF_ERROR_MAILBOX_FAILURE                     -1037    /*  The agent failed to scan mailboxes in server */
-#define EMF_ERROR_AUTH_NOT_SUPPORTED                  -1038    /*  The server doesn't support authentication */
-#define EMF_ERROR_AUTHENTICATE                        -1039    /*  The server failed to authenticate user */
-#define EMF_ERROR_TLS_NOT_SUPPORTED                   -1040    /*  The server doesn't support TLS */
-#define EMF_ERROR_TLS_SSL_FAILURE                     -1041    /*  The agent failed TLS/SSL */
-#define EMF_ERROR_APPEND_FAILURE                      -1042    /*  The agent failed to append mail to server */
-#define EMF_ERROR_COMMAND_NOT_SUPPORTED               -1043    /*  The server doesn't support this command */
-#define EMF_ERROR_ANNONYM_NOT_SUPPORTED               -1044    /*  The server doesn't support anonymous user */
-#define EMF_ERROR_CERTIFICATE_FAILURE                 -1045    /*  certificate failure - Invalid server certificat */
-#define EMF_ERROR_CANCELLED                           -1046    /*  The job was canceled by user */
-#define EMF_ERROR_NOT_IMPLEMENTED                     -1047    /*  The function was not implemented */
-#define EMF_ERROR_NOT_SUPPORTED                       -1048    /*  The function is not supported */
-#define EMF_ERROR_MAIL_LOCKED                         -1049    /*  The mail was locked */
-#define EMF_ERROR_SYSTEM_FAILURE                      -1050    /*  There is a system error */
-#define EMF_ERROR_MAIL_MAX_COUNT                      -1052    /*  The mailbox is full */
-#define EMF_ERROR_ACCOUNT_MAX_COUNT                   -1053    /*  There is too many account */
-#define EMF_ERROR_MAIL_MEMORY_FULL                    -1054    /*  There is no more storage */
-#define EMF_ERROR_MAIL_NOT_FOUND_ON_SERVER            -1055    /*  The expected mail is not found in server */
-#define EMF_ERROR_LOAD_ENGINE_FAILURE                 -1056    /*  loading engine failed */
-#define EMF_ERROR_CLOSE_FAILURE                       -1057    /*  engine is still used */
-#define EMF_ERROR_GCONF_FAILURE                       -1058    /*  The error occurred on accessing Gconf */
-#define EMF_ERROR_NO_SUCH_HOST                        -1059    /*  no such host was found */
-#define EMF_ERROR_EVENT_QUEUE_FULL                    -1060    /*  event queue is full */
-#define EMF_ERROR_EVENT_QUEUE_EMPTY                   -1061    /*  event queue is empty */
-#define EMF_ERROR_NO_RECIPIENT                        -1062    /*  no recipients information was found */
-#define EMF_ERROR_SMTP_SEND_FAILURE                   -1063    /*  SMTP send failed */
-#define EMF_ERROR_MAILBOX_OPEN_FAILURE                -1064    /*  accessing mailbox failed */
-#define EMF_ERROR_RETRIEVE_HEADER_DATA_FAILURE        -1065    /*  retrieving header failed */
-#define EMF_ERROR_XML_PARSER_FAILURE                  -1066    /*  XML parsing failed */
-#define EMF_ERROR_SESSION_NOT_FOUND                   -1067    /*  no matched session was found */
-#define EMF_ERROR_INVALID_STREAM                      -1068
-#define EMF_ERROR_AUTH_REQUIRED                       -1069    /*  SMTP Authentication needed */
-#define EMF_ERROR_POP3_DELE_FAILURE                   -1100
-#define EMF_ERROR_POP3_UIDL_FAILURE                   -1101
-#define EMF_ERROR_POP3_LIST_FAILURE                   -1102
-#define EMF_ERROR_IMAP4_STORE_FAILURE                 -1200
-#define EMF_ERROR_IMAP4_EXPUNGE_FAILURE               -1201
-#define EMF_ERROR_IMAP4_FETCH_UID_FAILURE             -1202
-#define EMF_ERROR_IMAP4_FETCH_SIZE_FAILURE            -1203
-#define EMF_ERROR_IMAP4_IDLE_FAILURE                  -1204    /* IDLE faile */
-#define EMF_ERROR_NO_SIM_INSERTED                     -1205
-#define EMF_ERROR_FLIGHT_MODE                         -1206
-#define EMF_SUCCESS_VALIDATE_ACCOUNT                  -1207
-#define EMF_ERROR_VALIDATE_ACCOUNT                    -1208
-#define EMF_ERROR_NO_MMC_INSERTED                     -1209
-#define EMF_ERROR_ACTIVE_SYNC_NOTI_FAILURE            -1300
-#define EMF_ERROR_HANDLE_NOT_FOUND                    -1301
-#define EMF_ERROR_NULL_VALUE                          -1302
-#define EMF_ERROR_FAILED_BY_SECURITY_POLICY           -1303
-#define EMF_ERROR_CANNOT_NEGOTIATE_TLS                -1400    /*  "Cannot negotiate TLS" */
-#define EMF_ERROR_STARTLS                             -1401    /*  "STARTLS" */
-#define EMF_ERROR_IPC_CRASH                           -1500
-#define EMF_ERROR_IPC_CONNECTION_FAILURE              -1501
-#define EMF_ERROR_IPC_SOCKET_FAILURE                  -1502
-#define EMF_ERROR_LOGIN_ALLOWED_EVERY_15_MINS         -1600    /*  "login allowed only every 15 minutes" */
-#define EMF_ERROR_TOO_MANY_LOGIN_FAILURE              -1601    /*  "Too many login failure" */
-#define EMF_ERROR_ON_PARSING                          -1700
-#define EMF_ERROR_NETWORK_NOT_AVAILABLE               -1800    /* WIFI not availble*/
-#define EMF_ERROR_CANNOT_STOP_THREAD                  -2000
-#define EMF_ERROR_UNKNOWN                             -8000    /*  unknown erro */
-
-
-
-/*****************************************************************************/
-/*  For Active Sync                                                          */
-/*****************************************************************************/
-
-#define VCONFKEY_EMAIL_SERVICE_ACTIVE_SYNC_HANDLE "db/email_handle/active_sync_handle"
-#define EMF_ACTIVE_SYNC_NOTI                      "User.Email.ActiveSync"
-
-typedef enum
-{
-       ACTIVE_SYNC_NOTI_SEND_MAIL,                 /*  a sending notification to ASE (active sync engine */
-       ACTIVE_SYNC_NOTI_SEND_SAVED,                /*  a sending notification to ASE (active sync engine), All saved mails should be sent */
-       ACTIVE_SYNC_NOTI_SEND_REPORT,               /*  a sending notification to ASE (active sync engine), report should be sen */
-       ACTIVE_SYNC_NOTI_SYNC_HEADER,               /*  a sync header - download mails from server. */
-                                                /*  It is depended on account/s flag1 field whether it excutes downloading header only or downloading header + body */
-                                                /*  downloading option : 0 is subject only, 1 is text body, 2 is normal */
-       ACTIVE_SYNC_NOTI_DOWNLOAD_BODY,             /*  a downloading body notification to AS */
-       ACTIVE_SYNC_NOTI_DOWNLOAD_ATTACHMENT,       /*  a downloading attachment notification to AS */
-       ACTIVE_SYNC_NOTI_VALIDATE_ACCOUNT,          /*  a account validating notification to AS */
-       ACTIVE_SYNC_NOTI_CANCEL_JOB,                /*  a cancling job notification to AS */
-       ACTIVE_SYNC_NOTI_SEARCH_ON_SERVER,          /*  a searching on server notification to AS */
-}      eactivesync_noti_t;
-
-typedef union
-{
-       struct _send_mail 
-       {
-               int           handle;
-               int           account_id;
-               char         *mailbox_name;
-               int           mail_id;
-               emf_option_t  options;
-       } send_mail;
-
-       struct _send_mail_saved 
-       {/*  not defined ye */
-               int           handle;
-               int           account_id;
-       } send_mail_saved;
-
-       struct _send_report 
-       {/*  not defined ye */
-               int           handle;
-               int           account_id;
-       } send_report;
-
-       struct _sync_header 
-       {
-               int           handle;
-               int           account_id;
-               char         *mailbox_name;
-       } sync_header;
-
-       struct _download_body
-       {
-               int           handle;
-               int           account_id;
-               int           mail_id;
-               int           with_attachment;      /*  0: without attachments, 1: with attachment */
-       } download_body;
-
-       struct _download_attachment 
-       {
-               int           handle;
-               int           account_id;
-               int           mail_id;
-               char         *attachment_order;
-       } download_attachment;
-
-       struct _cancel_job
-       {
-               int           account_id;
-               int           handle;               /*  job handle to be canceled. this value is issued by email-service (actually in Emf_Mapi_xxx() */
-       } cancel_job;
-
-       struct _validate_account
-       {/*  not defined yet */
-               int           handle;
-               int           account_id;
-       } validate_account;
-       
-       struct _find_mail_on_server
-       {
-               int           handle;
-               int           account_id;
-               char         *mailbox_name;
-               int           search_type;
-               char         *search_value;
-       } find_mail_on_server;
-
-} ASNotiData;
-
-
-/*  types for noti string */
-typedef enum 
-{
-       EMF_CONVERT_STRUCT_TYPE_MAIL_LIST_ITEM,      /** specifies emf_mail_list_t */
-} emf_convert_struct_type_e;
-
-#ifdef __cplusplus
-}
-#endif
-
-/**
-* @} @}
-*/
-
-#endif /* __EMF_LIB_H__ */
+/*\r
+*  email-service\r
+*\r
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+*\r
+* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com>\r
+*\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+* http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License.\r
+*\r
+*/\r
+\r
+\r
+#ifndef __EMAIL_TYPES_H__\r
+#define __EMAIL_TYPES_H__\r
+\r
+/**\r
+* @defgroup EMAIL_SERVICE Email Service\r
+* @{\r
+*/\r
+\r
+/**\r
+* @ingroup EMAIL_SERVICE\r
+* @defgroup EMAIL_TYPES Email Types\r
+* @{\r
+*/\r
+/**\r
+ * This file defines structures and enums of Email Framework.\r
+ * @file       email-types.h\r
+ * @author     Kyu-ho Jo(kyuho.jo@samsung.com)\r
+ * @author     Choongho Lee(ch715.lee@samsung.com)\r
+ * @version    0.1\r
+ * @brief      This file is the header file of Email Framework library.\r
+ */\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif /* __cplusplus */\r
+\r
+#include <glib.h>\r
+#include <stdbool.h>\r
+#include "email-errors.h"\r
+\r
+\r
+/*****************************************************************************/\r
+/*  Macros                                                                   */\r
+/*****************************************************************************/\r
+\r
+#define MAILBOX_NAME_LENGTH             256\r
+#define MAX_EMAIL_ADDRESS_LENGTH        320                                    /*  64(user name) + 1(@) + 255(host name */\r
+#define MAX_DATETIME_STRING_LENGTH      20\r
+#define MAX_PREVIEW_TEXT_LENGTH         512\r
+#define STRING_LENGTH_FOR_DISPLAY       100\r
+#define MEETING_REQ_OBJECT_ID_LENGTH    256\r
+\r
+#define ALL_ACCOUNT                     0\r
+#define NEW_ACCOUNT_ID                  0xFFFFFFFE\r
+#define ALL_MAIL                        -1\r
+\r
+#define EMF_SEARCH_FILTER_NONE          0x00\r
+#define EMF_SEARCH_FILTER_SUBJECT       0x01\r
+#define EMF_SEARCH_FILTER_SENDER        0x02\r
+#define EMF_SEARCH_FILTER_RECIPIENT     0x04\r
+#define EMF_SEARCH_FILTER_ALL           0x07                                   /*  EMF_SEARCH_FILTER_SUBJECT + EMF_SEARCH_FILTER_SENDER + EMF_SEARCH_FILTER_RECIPIEN */\r
+\r
+#define EMF_SUCCESS                     0                                      /*  we need to modify the success return valu */\r
+\r
+#define EMF_ACC_GET_OPT_DEFAULT         0x01                                   /**< Default values without account name */\r
+#define EMF_ACC_GET_OPT_ACCOUNT_NAME    0x02                                   /**< Account name */\r
+#define EMF_ACC_GET_OPT_PASSWORD        0x04                                   /**< With password */\r
+#define EMF_ACC_GET_OPT_OPTIONS         0x08                                   /**< Account options : emf_option_t */\r
+#define EMF_ACC_GET_OPT_FULL_DATA       0xFF                                   /**< With all data of account */\r
+\r
+#define GET_FULL_DATA                   0x00\r
+#define GET_FULL_DATA_WITHOUT_PASSWORD  (EMF_ACC_GET_OPT_DEFAULT | EMF_ACC_GET_OPT_ACCOUNT_NAME | EMF_ACC_GET_OPT_OPTIONS )\r
+#define WITHOUT_OPTION                  (EMF_ACC_GET_OPT_DEFAULT | EMF_ACC_GET_OPT_ACCOUNT_NAME )\r
+#define ONLY_OPTION                     (EMF_ACC_GET_OPT_OPTIONS)\r
+\r
+#define THREAD_TYPE_RECEIVING           0                                      /**< for function 'email_activate_pdp' */\r
+#define THREAD_TYPE_SENDING             1                                      /**< for function 'email_activate_pdp' */\r
+\r
+#define EMF_IMAP_PORT                   143                                    /**< Specifies the default IMAP port.*/\r
+#define EMF_POP3_PORT                   110                                    /**< Specifies the default POP3 port.*/\r
+#define EMF_SMTP_PORT                   25                                     /**< Specifies the default SMTP port.*/\r
+#define EMF_IMAPS_PORT                  993                                    /**< Specifies the default IMAP SSL port.*/\r
+#define EMF_POP3S_PORT                  995                                    /**< Specifies the default POP3 SSL port.*/\r
+#define EMF_SMTPS_PORT                  465                                    /**< Specifies the default SMTP SSL port.*/\r
+#define EMF_ACCOUNT_MAX                 10                                     /**< Specifies the MAX account.*/\r
+\r
+#define EMF_INBOX_NAME                  "INBOX"                                /**< Specifies the name of inbox.*/\r
+#define EMF_DRAFTBOX_NAME               "DRAFTBOX"                             /**< Specifies the name of draftbox.*/\r
+#define EMF_OUTBOX_NAME                 "OUTBOX"                               /**< Specifies the name of outbox.*/\r
+#define EMF_SENTBOX_NAME                "SENTBOX"                              /**< Specifies the name of sentbox.*/\r
+#define EMF_TRASH_NAME                  "TRASH"                                /**< Specifies the name of trash.*/\r
+#define EMF_SPAMBOX_NAME                "SPAMBOX"                              /**< Specifies the name of spambox.*/\r
+\r
+#define EMF_INBOX_DISPLAY_NAME          "Inbox"                                /**< Specifies the display name of inbox.*/\r
+#define EMF_DRAFTBOX_DISPLAY_NAME       "Draftbox"                             /**< Specifies the display name of draftbox.*/\r
+#define EMF_OUTBOX_DISPLAY_NAME         "Outbox"                               /**< Specifies the display name of outbox.*/\r
+#define EMF_SENTBOX_DISPLAY_NAME        "Sentbox"                              /**< Specifies the display name of sentbox.*/\r
+#define EMF_TRASH_DISPLAY_NAME          "Trash"                                /**< Specifies the display name of sentbox.*/\r
+#define EMF_SPAMBOX_DISPLAY_NAME        "Spambox"                              /**< Specifies the display name of spambox.*/\r
+\r
+#define EMF_SEARCH_RESULT_MAILBOX_NAME  "_`S1!E2@A3#R4$C5^H6&R7*E8(S9)U0-L=T_" /**< Specifies the name of search mailbox.*/\r
+\r
+#define FAILURE                         -1\r
+#define SUCCESS                         0\r
+\r
+#define DAEMON_EXECUTABLE_PATH          "/usr/bin/email-service"\r
+\r
+#ifndef EXPORT_API\r
+#define EXPORT_API                      __attribute__((visibility("default")))\r
+#endif\r
+\r
+#ifndef DEPRECATED\r
+#define DEPRECATED                      __attribute__((deprecated))\r
+#endif\r
+\r
+\r
+/* __FEATURE_LOCAL_ACTIVITY__ supported\r
+#define BULK_OPERATION_COUNT            50\r
+#define ALL_ACTIVITIES                  0\r
+*/\r
+\r
+/*****************************************************************************/\r
+/*  Enumerations                                                             */\r
+/*****************************************************************************/\r
+enum {\r
+       // Account\r
+       _EMAIL_API_ADD_ACCOUNT                             = 0x01000000,\r
+       _EMAIL_API_DELETE_ACCOUNT                          = 0x01000001,\r
+       _EMAIL_API_UPDATE_ACCOUNT                          = 0x01000002,\r
+       _EMAIL_API_GET_ACCOUNT                             = 0x01000003,\r
+       _EMAIL_API_GET_ACCOUNT_LIST                        = 0x01000005,\r
+       _EMAIL_API_GET_MAILBOX_COUNT                       = 0x01000007,\r
+       _EMAIL_API_VALIDATE_ACCOUNT                        = 0x01000008,\r
+       _EMAIL_API_ADD_ACCOUNT_WITH_VALIDATION             = 0x01000009,\r
+       _EMAIL_API_BACKUP_ACCOUNTS                         = 0x0100000A,\r
+       _EMAIL_API_RESTORE_ACCOUNTS                        = 0x0100000B,\r
+       _EMAIL_API_GET_PASSWORD_LENGTH_OF_ACCOUNT          = 0x0100000C,\r
+\r
+       // Message\r
+       _EMAIL_API_DELETE_MAIL                             = 0x01100002,\r
+       _EMAIL_API_DELETE_ALL_MAIL                         = 0x01100004,\r
+       _EMAIL_API_GET_MAILBOX_LIST                        = 0x01100006,\r
+       _EMAIL_API_GET_SUBMAILBOX_LIST                     = 0x01100007,\r
+       _EMAIL_API_CLEAR_DATA                              = 0x01100009,\r
+       _EMAIL_API_MOVE_MAIL                               = 0x0110000A,\r
+       _EMAIL_API_MOVE_ALL_MAIL                           = 0x0110000B,\r
+       _EMAIL_API_ADD_ATTACHMENT                          = 0x0110000C,\r
+       _EMAIL_API_GET_ATTACHMENT                          = 0x0110000D,\r
+       _EMAIL_API_DELETE_ATTACHMENT                       = 0x0110000E,\r
+       _EMAIL_API_MODIFY_MAIL_FLAG                        = 0x0110000F,\r
+       _EMAIL_API_MODIFY_MAIL_EXTRA_FLAG                  = 0x01100011,\r
+       _EMAIL_API_SET_FLAGS_FIELD                         = 0x01100016,\r
+       _EMAIL_API_ADD_MAIL                                = 0x01100017,\r
+       _EMAIL_API_UPDATE_MAIL                             = 0x01100018,\r
+       _EMAIL_API_ADD_READ_RECEIPT                        = 0x01100019,\r
+\r
+       // Thread\r
+       _EMAIL_API_MOVE_THREAD_TO_MAILBOX                  = 0x01110000,\r
+       _EMAIL_API_DELETE_THREAD                           = 0x01110001,\r
+       _EMAIL_API_MODIFY_SEEN_FLAG_OF_THREAD              = 0x01110002,\r
+\r
+       // Mailbox\r
+       _EMAIL_API_ADD_MAILBOX                             = 0x01200000,\r
+       _EMAIL_API_DELETE_MAILBOX                          = 0x01200001,\r
+       _EMAIL_API_UPDATE_MAILBOX                          = 0x01200002,\r
+       _EMAIL_API_SET_MAIL_SLOT_SIZE                      = 0x01200007,\r
+\r
+       // Network\r
+       _EMAIL_API_SEND_MAIL                               = 0x01300000,\r
+       _EMAIL_API_SYNC_HEADER                             = 0x01300001,\r
+       _EMAIL_API_DOWNLOAD_BODY                           = 0x01300002,\r
+       _EMAIL_API_DOWNLOAD_ATTACHMENT                     = 0x01300003,\r
+       _EMAIL_API_NETWORK_GET_STATUS                      = 0x01300004,\r
+       _EMAIL_API_SEND_SAVED                              = 0x01300005,\r
+       _EMAIL_API_DELETE_EMAIL                            = 0x01300007,\r
+       _EMAIL_API_DELETE_EMAIL_ALL                        = 0x01300008,\r
+       _EMAIL_API_GET_IMAP_MAILBOX_LIST                   = 0x01300015,\r
+       _EMAIL_API_SEND_MAIL_CANCEL_JOB                    = 0x01300017,\r
+       _EMAIL_API_SEARCH_MAIL_ON_SERVER                   = 0x01300019,\r
+\r
+       // Rule\r
+       _EMAIL_API_ADD_RULE                                = 0x01400000,\r
+       _EMAIL_API_GET_RULE                                = 0x01400001,\r
+       _EMAIL_API_GET_RULE_LIST                           = 0x01400002,\r
+       _EMAIL_API_FIND_RULE                               = 0x01400003,\r
+       _EMAIL_API_DELETE_RULE                             = 0x01400004,\r
+       _EMAIL_API_UPDATE_RULE                             = 0x01400005,\r
+       _EMAIL_API_CANCEL_JOB                              = 0x01400006,\r
+       _EMAIL_API_GET_PENDING_JOB                         = 0x01400007,\r
+       _EMAIL_API_SEND_RETRY                              = 0x01400008,\r
+       _EMAIL_API_UPDATE_ACTIVITY                         = 0x01400009,\r
+       _EMAIL_API_SYNC_LOCAL_ACTIVITY                     = 0x0140000A,\r
+       _EMAIL_API_PRINT_RECEIVING_EVENT_QUEUE             = 0x0140000B,\r
+\r
+       // Etc\r
+       _EMAIL_API_PING_SERVICE                            = 0x01500000,\r
+       _EMAIL_API_UPDATE_NOTIFICATION_BAR_FOR_UNREAD_MAIL = 0x01500001,\r
+};\r
+\r
+enum\r
+{\r
+       EMF_DELETE_LOCALLY = 0,                      /**< Specifies Mail Delete local only */\r
+       EMF_DELETE_LOCAL_AND_SERVER,                 /**< Specifies Mail Delete local & server */\r
+       EMF_DELETE_FOR_SEND_THREAD,                  /**< Created to check which activity to delete in send thread */\r
+};\r
+\r
+typedef enum\r
+{\r
+       NOTI_MAIL_ADD                            = 10000,\r
+       NOTI_MAIL_DELETE                         = 10001,\r
+       NOTI_MAIL_DELETE_ALL                     = 10002,\r
+       NOTI_MAIL_DELETE_WITH_ACCOUNT            = 10003,\r
+       NOTI_MAIL_DELETE_FAIL                    = 10007,\r
+       NOTI_MAIL_DELETE_FINISH                  = 10008,\r
+\r
+       NOTI_MAIL_UPDATE                         = 10004,\r
+       NOTI_MAIL_FIELD_UPDATE                   = 10020,\r
+\r
+       NOTI_MAIL_MOVE                           = 10005,\r
+       NOTI_MAIL_MOVE_FAIL                      = 10010,\r
+       NOTI_MAIL_MOVE_FINISH                    = 10006,\r
+\r
+       NOTI_THREAD_MOVE                         = 11000,\r
+       NOTI_THREAD_DELETE                       = 11001,\r
+       NOTI_THREAD_MODIFY_SEEN_FLAG             = 11002,\r
+\r
+       NOTI_ACCOUNT_ADD                         = 20000,\r
+       NOTI_ACCOUNT_DELETE                      = 20001,\r
+       NOTI_ACCOUNT_DELETE_FAIL                 = 20003,\r
+       NOTI_ACCOUNT_UPDATE                      = 20002,\r
+       NOTI_ACCOUNT_UPDATE_SYNC_STATUS          = 20010,\r
+\r
+\r
+       NOTI_MAILBOX_ADD                         = 40000,\r
+       NOTI_MAILBOX_DELETE                      = 40001,\r
+       NOTI_MAILBOX_UPDATE                      = 40002,\r
+       /* To be added more */\r
+}emf_noti_on_storage_event;\r
+\r
+typedef enum\r
+{\r
+       NOTI_SEND_START                          = 1002,\r
+       NOTI_SEND_FINISH                         = 1004,\r
+       NOTI_SEND_FAIL                           = 1005,\r
+       NOTI_SEND_CANCEL                         = 1003,\r
+\r
+       NOTI_DOWNLOAD_START                      = 2000,\r
+       NOTI_DOWNLOAD_FINISH,\r
+       NOTI_DOWNLOAD_FAIL,\r
+       NOTI_DOWNLOAD_CANCEL                     = 2004,\r
+       NOTI_DOWNLOAD_NEW_MAIL                   = 2003,\r
+\r
+       NOTI_DOWNLOAD_BODY_START                 = 3000,\r
+       NOTI_DOWNLOAD_BODY_FINISH                = 3002,\r
+       NOTI_DOWNLOAD_BODY_FAIL                  = 3004,\r
+       NOTI_DOWNLOAD_BODY_CANCEL                = 3003,\r
+       NOTI_DOWNLOAD_MULTIPART_BODY             = 3001,\r
+\r
+       NOTI_DOWNLOAD_ATTACH_START               = 4000,\r
+       NOTI_DOWNLOAD_ATTACH_FINISH,\r
+       NOTI_DOWNLOAD_ATTACH_FAIL,\r
+       NOTI_DOWNLOAD_ATTACH_CANCEL,\r
+\r
+       NOTI_MAIL_DELETE_ON_SERVER_FAIL          = 5000,\r
+       NOTI_MAIL_MOVE_ON_SERVER_FAIL,\r
+\r
+       NOTI_VALIDATE_ACCOUNT_FINISH             = 7000,\r
+       NOTI_VALIDATE_ACCOUNT_FAIL,\r
+       NOTI_VALIDATE_ACCOUNT_CANCEL,\r
+\r
+       NOTI_VALIDATE_AND_CREATE_ACCOUNT_FINISH  = 8000,\r
+       NOTI_VALIDATE_AND_CREATE_ACCOUNT_FAIL,\r
+       NOTI_VALIDATE_AND_CREATE_ACCOUNT_CANCEL,\r
+\r
+       NOTI_VALIDATE_AND_UPDATE_ACCOUNT_FINISH  = 9000,\r
+       NOTI_VALIDATE_AND_UPDATE_ACCOUNT_FAIL,\r
+       NOTI_VALIDATE_AND_UPDATE_ACCOUNT_CANCEL,\r
+\r
+       /* To be added more */\r
+}emf_noti_on_network_event;\r
+\r
+\r
+/**\r
+ * This enumeration specifies the mail type of account.\r
+ */\r
+typedef enum\r
+{\r
+       EMF_BIND_TYPE_DISABLE          = 0,          /**< Specifies the bind type for Disabled account.*/\r
+       EMF_BIND_TYPE_EM_CORE          = 1,          /**< Specifies the bind type for Callia.*/\r
+} emf_account_bind_t;\r
+\r
+/**\r
+ * This enumeration specifies the server type of account.\r
+ */\r
+typedef enum\r
+{\r
+       EMF_SERVER_TYPE_POP3           = 1,          /**< Specifies the POP3 Server.*/\r
+       EMF_SERVER_TYPE_IMAP4,                       /**< Specifies the IMAP4 Server.*/\r
+       EMF_SERVER_TYPE_SMTP,                        /**< Specifies the SMTP Server.*/\r
+       EMF_SERVER_TYPE_NONE,                        /**< Specifies the Local.*/\r
+       EMF_SERVER_TYPE_ACTIVE_SYNC,                 /** < Specifies the Active Sync.  */\r
+} emf_account_server_t;\r
+\r
+/**\r
+ * This enumeration specifies the mode of retrieval.\r
+ */\r
+typedef enum\r
+{\r
+       EMF_IMAP4_RETRIEVAL_MODE_NEW   = 0,          /**< Specifies the retrieval mode for new email.*/\r
+       EMF_IMAP4_RETRIEVAL_MODE_ALL,                /**< Specifies the retrieval mode for all email.*/\r
+} emf_imap4_retrieval_mode_t;\r
+\r
+/**\r
+ * This enumeration specifies the filtering type.\r
+ */\r
+typedef enum\r
+{\r
+       EMF_FILTER_FROM                = 1,          /**< Specifies the filtering of sender.*/\r
+       EMF_FILTER_SUBJECT,                          /**< Specifies the filtering of email subject.*/\r
+       EMF_FILTER_BODY,                             /** < Specifies the filterinf of email body.*/\r
+} emf_rule_type_t;\r
+\r
+\r
+/**\r
+ * This enumeration specifies the rules for filtering type.\r
+ */\r
+typedef enum\r
+{\r
+       RULE_TYPE_INCLUDES             = 1,          /**< Specifies the filtering rule for includes.*/\r
+       RULE_TYPE_EXACTLY,                           /**< Specifies the filtering rule for Exactly same as.*/\r
+} emf_filtering_type_t;\r
+\r
+\r
+/**\r
+ * This enumeration specifies the action for filtering type.\r
+ */\r
+typedef enum\r
+{\r
+       EMF_FILTER_MOVE                = 1,          /**< Specifies the move of email.*/\r
+       EMF_FILTER_BLOCK               = 2,          /**< Specifies the block of email.*/\r
+       EMF_FILTER_DELETE              = 3,          /**< Specifies delete  email.*/\r
+} emf_rule_action_t;\r
+\r
+/**\r
+ * This enumeration specifies the email status.\r
+ */\r
+typedef enum\r
+{\r
+       EMF_MAIL_STATUS_NONE           = 0,          /**< The Mail is in No Operation state */\r
+       EMF_MAIL_STATUS_RECEIVED,                    /**< The mail is a received mail.*/\r
+       EMF_MAIL_STATUS_SENT,                        /**< The mail is a sent mail.*/\r
+       EMF_MAIL_STATUS_SAVED,                       /**< The mail is a saved mail.*/\r
+       EMF_MAIL_STATUS_SAVED_OFFLINE,               /**< The mail is a saved mail in offline-mode.*/\r
+       EMF_MAIL_STATUS_SENDING,                     /**< The mail is being sent.*/\r
+       EMF_MAIL_STATUS_SEND_FAILURE,                /**< The mail is a mail to been failed to send.*/\r
+       EMF_MAIL_STATUS_SEND_CANCELED,               /**< The mail is a cancelled mail.*/\r
+       EMF_MAIL_STATUS_SEND_WAIT,                   /**< The mail is a mail to be send .*/\r
+} emf_mail_status_t;\r
+\r
+/**\r
+ * This enumeration specifies the email priority.\r
+ */\r
+typedef enum\r
+{\r
+       EMF_MAIL_PRIORITY_HIGH         = 1,          /**< The priority is high.*/\r
+       EMF_MAIL_PRIORITY_NORMAL       = 3,          /**< The priority is normal.*/\r
+       EMF_MAIL_PRIORITY_LOW          = 5,          /**< The priority is low.*/\r
+} emf_mail_priority_t;\r
+\r
+/**\r
+ * This enumeration specifies the email status.\r
+ */\r
+typedef enum\r
+{\r
+       EMF_MAIL_REPORT_NONE           = 0,          /**< The mail isn't report mail.*/\r
+       EMF_MAIL_REPORT_DSN,                         /**< The mail is a delivery-status report mail.*/\r
+       EMF_MAIL_REPORT_MDN,                         /**< The mail is a read-status report mail.*/\r
+       EMF_MAIL_REPORT_REQUEST,                     /**< The mail require a read-status report mail.*/\r
+} emf_mail_report_t;\r
+\r
+/**\r
+ * This enumeration specifies the DRM type\r
+ */\r
+typedef enum\r
+{\r
+       EMF_ATTACHMENT_DRM_NONE        = 0,          /**< The mail isn't DRM file.*/\r
+       EMF_ATTACHMENT_DRM_OBJECT,                   /**< The mail is a DRM object.*/\r
+       EMF_ATTACHMENT_DRM_RIGHTS,                   /**< The mail is a DRM rights as xml format.*/\r
+       EMF_ATTACHMENT_DRM_DCF,                      /**< The mail is a DRM dcf.*/\r
+} emf_attachment_drm_t;\r
+\r
+/**\r
+ * This enumeration specifies the meeting request type\r
+ */\r
+typedef enum\r
+{\r
+       EMF_MAIL_TYPE_NORMAL                     = 0, /**< NOT a meeting request mail. A Normal mail */\r
+       EMF_MAIL_TYPE_MEETING_REQUEST            = 1, /**< a meeting request mail from a serve */\r
+       EMF_MAIL_TYPE_MEETING_RESPONSE           = 2, /**< a response mail about meeting reques */\r
+       EMF_MAIL_TYPE_MEETING_ORIGINATINGREQUEST = 3  /**< a originating mail about meeting reques */\r
+} emf_mail_type_t;\r
+\r
+/**\r
+ * This enumeration specifies the meeting response type\r
+ */\r
+typedef enum\r
+{\r
+       EMF_MEETING_RESPONSE_NONE                = 0, /**< NOT response */\r
+       EMF_MEETING_RESPONSE_ACCEPT              = 1, /**< The response is acceptance */\r
+       EMF_MEETING_RESPONSE_TENTATIVE           = 2, /**< The response is tentative */\r
+       EMF_MEETING_RESPONSE_DECLINE             = 3, /**< The response is decline */\r
+       EMF_MEETING_RESPONSE_REQUEST             = 4, /**< The response is request */\r
+       EMF_MEETING_RESPONSE_CANCEL              = 5, /**< The response is cancelation */\r
+} emf_meeting_response_t;\r
+\r
+typedef enum\r
+{\r
+       EMF_ACTION_SEND_MAIL                     =  0,\r
+       EMF_ACTION_SYNC_HEADER                   =  1,\r
+       EMF_ACTION_DOWNLOAD_BODY                 =  2,\r
+       EMF_ACTION_DOWNLOAD_ATTACHMENT           =  3,\r
+       EMF_ACTION_DELETE_MAIL                   =  4,\r
+       EMF_ACTION_SEARCH_MAIL                   =  5,\r
+       EMF_ACTION_SAVE_MAIL                     =  6,\r
+       EMF_ACTION_SYNC_MAIL_FLAG_TO_SERVER      =  7,\r
+       EMF_ACTION_SYNC_FLAGS_FIELD_TO_SERVER    =  8,\r
+       EMF_ACTION_MOVE_MAIL                     =  9,\r
+       EMF_ACTION_CREATE_MAILBOX                = 10,\r
+       EMF_ACTION_DELETE_MAILBOX                = 11,\r
+       EMF_ACTION_SYNC_HEADER_OMA               = 12,\r
+       EMF_ACTION_VALIDATE_ACCOUNT              = 13,\r
+       EMF_ACTION_VALIDATE_AND_CREATE_ACCOUNT   = 14,\r
+       EMF_ACTION_VALIDATE_AND_UPDATE_ACCOUNT   = 15,\r
+       EMF_ACTION_ACTIVATE_PDP                  = 20,\r
+       EMF_ACTION_DEACTIVATE_PDP                = 21,\r
+       EMF_ACTION_UPDATE_MAIL                   = 30,\r
+       EMF_ACTION_SET_MAIL_SLOT_SIZE            = 31,\r
+       EMF_ACTION_NUM,\r
+} emf_action_t;\r
+\r
+/**\r
+ * This enumeration specifies the status of getting envelope list.\r
+ */\r
+typedef enum\r
+{\r
+       EMF_LIST_NONE                  = 0,\r
+       EMF_LIST_WAITING,\r
+       EMF_LIST_PREPARE,                            /**< Specifies the preparation.*/\r
+       EMF_LIST_CONNECTION_START,                   /**< Specifies the connection start.*/\r
+       EMF_LIST_CONNECTION_SUCCEED,                 /**< Specifies the success of connection.*/\r
+       EMF_LIST_CONNECTION_FINISH,                  /**< Specifies the connection finish.*/\r
+       EMF_LIST_CONNECTION_FAIL,                    /**< Specifies the connection failure.*/\r
+       EMF_LIST_START,                              /**< Specifies the getting start.*/\r
+       EMF_LIST_PROGRESS,                           /**< Specifies the status of getting.*/\r
+       EMF_LIST_FINISH,                             /**< Specifies the getting complete.*/\r
+       EMF_LIST_FAIL,                               /**< Specifies the download failure.*/\r
+} emf_envelope_list_status_t;\r
+\r
+/**\r
+ * This enumeration specifies the downloaded status of email.\r
+ */\r
+typedef enum\r
+{\r
+       EMF_DOWNLOAD_NONE              = 0,\r
+       EMF_DOWNLOAD_WAITING,\r
+       EMF_DOWNLOAD_PREPARE,                        /**< Specifies the preparation.*/\r
+       EMF_DOWNLOAD_CONNECTION_START,               /**< Specifies the connection start.*/\r
+       EMF_DOWNLOAD_CONNECTION_SUCCEED,             /**< Specifies the success of connection.*/\r
+       EMF_DOWNLOAD_CONNECTION_FINISH,              /**< Specifies the connection finish.*/\r
+       EMF_DOWNLOAD_CONNECTION_FAIL,                /**< Specifies the connection failure.*/\r
+       EMF_DOWNLOAD_START,                          /**< Specifies the download start.*/\r
+       EMF_DOWNLOAD_PROGRESS,                       /**< Specifies the status of download.*/\r
+       EMF_DOWNLOAD_FINISH,                         /**< Specifies the download complete.*/\r
+       EMF_DOWNLOAD_FAIL,                           /**< Specifies the download failure.*/\r
+} emf_download_status_t;\r
+\r
+/**\r
+ * This enumeration specifies the status of sending email.\r
+ */\r
+typedef enum\r
+{\r
+       EMF_SEND_NONE                  = 0,\r
+       EMF_SEND_WAITING,\r
+       EMF_SEND_PREPARE,                            /**< Specifies the preparation.*/\r
+       EMF_SEND_CONNECTION_START,                   /**< Specifies the connection start.*/\r
+       EMF_SEND_CONNECTION_SUCCEED,                 /**< Specifies the success of connection.*/\r
+       EMF_SEND_CONNECTION_FINISH,                  /**< Specifies the connection finish.*/\r
+       EMF_SEND_CONNECTION_FAIL,                    /**< Specifies the connection failure.*/\r
+       EMF_SEND_START,                              /**< Specifies the sending start.*/\r
+       EMF_SEND_PROGRESS,                           /**< Specifies the status of sending.*/\r
+       EMF_SEND_FINISH,                             /**< Specifies the sending complete.*/\r
+       EMF_SEND_FAIL,                               /**< Specifies the sending failure.*/\r
+       EMF_SAVE_WAITING,                            /**< Specfies the Waiting of Sync */\r
+} emf_send_status_t;\r
+\r
+typedef enum\r
+{\r
+       EMF_SYNC_NONE                  = 0,\r
+       EMF_SYNC_WAITING,\r
+       EMF_SYNC_PREPARE,\r
+       EMF_SYNC_CONNECTION_START,\r
+       EMF_SYNC_CONNECTION_SUCCEED,\r
+       EMF_SYNC_CONNECTION_FINISH,\r
+       EMF_SYNC_CONNECTION_FAIL,\r
+       EMF_SYNC_START,\r
+       EMF_SYNC_PROGRESS,\r
+       EMF_SYNC_FINISH,\r
+       EMF_SYNC_FAIL,\r
+} emf_sync_status_t;\r
+\r
+/**\r
+* This enumeration specifies the deleting status of email.\r
+*/\r
+typedef enum\r
+{\r
+       EMF_DELETE_NONE                = 0,\r
+       EMF_DELETE_WAITING,\r
+       EMF_DELETE_PREPARE,                          /**< Specifies the preparation.*/\r
+       EMF_DELETE_CONNECTION_START,                 /**< Specifies the connection start.*/\r
+       EMF_DELETE_CONNECTION_SUCCEED,               /**< Specifies the success of connection.*/\r
+       EMF_DELETE_CONNECTION_FINISH,                /**< Specifies the connection finish.*/\r
+       EMF_DELETE_CONNECTION_FAIL,                  /**< Specifies the connection failure.*/\r
+       EMF_DELETE_START,                            /**< Specifies the deletion start.*/\r
+       EMF_DELETE_PROGRESS,                         /**< Specifies the status of deleting.*/\r
+       EMF_DELETE_SERVER_PROGRESS,                  /**< Specifies the status of server deleting.*/\r
+       EMF_DELETE_LOCAL_PROGRESS,                   /**< Specifies the status of local deleting.*/\r
+       EMF_DELETE_FINISH,                           /**< Specifies the deletion complete.*/\r
+       EMF_DELETE_FAIL,                             /**< Specifies the deletion failure.*/\r
+} emf_delete_status_t;\r
+\r
+/**\r
+* This enumeration specifies the status of validating account\r
+*/\r
+typedef enum\r
+{\r
+       EMF_VALIDATE_ACCOUNT_NONE = 0,\r
+       EMF_VALIDATE_ACCOUNT_WAITING,\r
+       EMF_VALIDATE_ACCOUNT_PREPARE,                /**< Specifies the preparation.*/\r
+       EMF_VALIDATE_ACCOUNT_CONNECTION_START,       /**< Specifies the connection start.*/\r
+       EMF_VALIDATE_ACCOUNT_CONNECTION_SUCCEED,     /**< Specifies the success of connection.*/\r
+       EMF_VALIDATE_ACCOUNT_CONNECTION_FINISH,      /**< Specifies the connection finish.*/\r
+       EMF_VALIDATE_ACCOUNT_CONNECTION_FAIL,        /**< Specifies the connection failure.*/\r
+       EMF_VALIDATE_ACCOUNT_START,                  /**< Specifies the getting start.*/\r
+       EMF_VALIDATE_ACCOUNT_PROGRESS,               /**< Specifies the status of getting.*/\r
+       EMF_VALIDATE_ACCOUNT_FINISH,                 /**< Specifies the getting complete.*/\r
+       EMF_VALIDATE_ACCOUNT_FAIL,                   /**< Specifies the validation failure.*/\r
+} emf_validate_account_status_t;\r
+\r
+typedef enum\r
+{\r
+       EMF_SET_SLOT_SIZE_NONE         = 0,\r
+       EMF_SET_SLOT_SIZE_WAITING,\r
+       EMF_SET_SLOT_SIZE_START,\r
+       EMF_SET_SLOT_SIZE_FINISH,\r
+       EMF_SET_SLOT_SIZE_FAIL,\r
+}emf_set_slot_size_status_e;\r
+\r
+/**\r
+* This enumeration specifies the type of mailbox\r
+*/\r
+typedef enum\r
+{\r
+       EMF_MAILBOX_TYPE_NONE          = 0,         /**< Unspecified mailbox type*/\r
+       EMF_MAILBOX_TYPE_INBOX         = 1,         /**< Specified inbox type*/\r
+       EMF_MAILBOX_TYPE_SENTBOX       = 2,         /**< Specified sent box type*/\r
+       EMF_MAILBOX_TYPE_TRASH         = 3,         /**< Specified trash type*/\r
+       EMF_MAILBOX_TYPE_DRAFT         = 4,         /**< Specified draft box type*/\r
+       EMF_MAILBOX_TYPE_SPAMBOX       = 5,         /**< Specified spam box type*/\r
+       EMF_MAILBOX_TYPE_OUTBOX        = 6,         /**< Specified outbox type*/\r
+       EMF_MAILBOX_TYPE_ALL_EMAILS    = 7,         /**< Specified all emails type of gmail*/\r
+       EMF_MAILBOX_TYPE_SEARCH_RESULT = 8,         /**< Specified mailbox type for result of search on server */\r
+       EMF_MAILBOX_TYPE_USER_DEFINED  = 0xFF,      /**< Specified mailbox type for all other mailboxes */\r
+}emf_mailbox_type_e;\r
+\r
+typedef enum\r
+{\r
+       EMF_SYNC_LATEST_MAILS_FIRST    = 0,\r
+       EMF_SYNC_OLDEST_MAILS_FIRST,\r
+       EMF_SYNC_ALL_MAILBOX_50_MAILS,\r
+} EMF_RETRIEVE_MODE;\r
+\r
+/*  event typ */\r
+typedef enum\r
+{\r
+       EMF_EVENT_NONE                        =  0,\r
+       EMF_EVENT_SYNC_HEADER                 =  1,          /*  synchronize mail headers with server (network used) */\r
+       EMF_EVENT_DOWNLOAD_BODY               =  2,          /*  download mail body from server (network used)*/\r
+       EMF_EVENT_DOWNLOAD_ATTACHMENT         =  3,          /*  download mail attachment from server (network used) */\r
+       EMF_EVENT_SEND_MAIL                   =  4,          /*  send a mail (network used) */\r
+       EMF_EVENT_SEND_MAIL_SAVED             =  5,          /*  send all mails in 'outbox' box (network used) */\r
+       EMF_EVENT_SYNC_IMAP_MAILBOX           =  6,          /*  download imap mailboxes from server (network used) */\r
+       EMF_EVENT_DELETE_MAIL                 =  7,          /*  delete mails (network unused) */\r
+       EMF_EVENT_DELETE_MAIL_ALL             =  8,          /*  delete all mails (network unused) */\r
+       EMF_EVENT_SYNC_MAIL_FLAG_TO_SERVER    =  9,          /*  sync mail flag to server */\r
+       EMF_EVENT_SYNC_FLAGS_FIELD_TO_SERVER  = 10,          /*  sync a field of flags to server */\r
+       EMF_EVENT_SAVE_MAIL                   = 11,\r
+       EMF_EVENT_MOVE_MAIL                   = 12,          /*  move mails to specific mailbox on server */\r
+       EMF_EVENT_CREATE_MAILBOX              = 13,\r
+       EMF_EVENT_UPDATE_MAILBOX              = 14,\r
+       EMF_EVENT_DELETE_MAILBOX              = 15,\r
+       EMF_EVENT_ISSUE_IDLE                  = 16,\r
+       EMF_EVENT_SYNC_HEADER_OMA             = 17,\r
+       EMF_EVENT_VALIDATE_ACCOUNT            = 18,\r
+       EMF_EVENT_VALIDATE_AND_CREATE_ACCOUNT = 19,\r
+       EMF_EVENT_VALIDATE_AND_UPDATE_ACCOUNT = 20,\r
+\r
+       EMF_EVENT_ADD_MAIL                    = 10001,\r
+       EMF_EVENT_UPDATE_MAIL_OLD             = 10002,\r
+       EMF_EVENT_UPDATE_MAIL                 = 10003,\r
+       EMF_EVENT_SET_MAIL_SLOT_SIZE          = 20000,\r
+\r
+/*     EMF_EVENT_LOCAL_ACTIVITY,                    // __LOCAL_ACTIVITY_ */\r
+\r
+       EMF_EVENT_BULK_PARTIAL_BODY_DOWNLOAD,        /*  __FEATURE_PARTIAL_BODY_DOWNLOAD__ supported */\r
+       EMF_EVENT_LOCAL_ACTIVITY_SYNC_BULK_PBD,      /*  __FEATURE_PARTIAL_BODY_DOWNLOAD__ supported */\r
+       EMF_EVENT_GET_PASSWORD_LENGTH                /*  get password length of an account */\r
+} emf_event_type_t;\r
+\r
+/*  event statu */\r
+typedef enum\r
+{\r
+       EMF_EVENT_STATUS_UNUSED        = 0,\r
+       EMF_EVENT_STATUS_WAIT,\r
+       EMF_EVENT_STATUS_STARTED,\r
+       EMF_EVENT_STATUS_CANCELED,\r
+} emf_event_status_type_t;\r
+\r
+\r
+/* sorting_orde */\r
+typedef enum\r
+{\r
+       EMF_SORT_DATETIME_HIGH         = 0,\r
+       EMF_SORT_DATETIME_LOW,\r
+       EMF_SORT_SENDER_HIGH,\r
+       EMF_SORT_SENDER_LOW,\r
+       EMF_SORT_RCPT_HIGH,\r
+       EMF_SORT_RCPT_LOW,\r
+       EMF_SORT_SUBJECT_HIGH,\r
+       EMF_SORT_SUBJECT_LOW,\r
+       EMF_SORT_PRIORITY_HIGH,\r
+       EMF_SORT_PRIORITY_LOW,\r
+       EMF_SORT_ATTACHMENT_HIGH,\r
+       EMF_SORT_ATTACHMENT_LOW,\r
+       EMF_SORT_FAVORITE_HIGH,\r
+       EMF_SORT_FAVORITE_LOW,\r
+       EMF_SORT_MAILBOX_NAME_HIGH,\r
+       EMF_SORT_MAILBOX_NAME_LOW,\r
+       EMF_SORT_FLAGGED_FLAG_HIGH,\r
+       EMF_SORT_FLAGGED_FLAG_LOW,\r
+       EMF_SORT_SEEN_FLAG_HIGH,\r
+       EMF_SORT_SEEN_FLAG_LOW,\r
+       EMF_SORT_END,\r
+}emf_sort_type_t;\r
+\r
+typedef enum\r
+{\r
+       EMAIL_MAILBOX_SORT_BY_NAME_ASC  = 0,\r
+       EMAIL_MAILBOX_SORT_BY_NAME_DSC,\r
+       EMAIL_MAILBOX_SORT_BY_TYPE_ASC,\r
+       EMAIL_MAILBOX_SORT_BY_TYPE_DSC,\r
+} email_mailbox_sort_type_t;\r
+\r
+\r
+/**\r
+* This enumeration specifies the priority.\r
+*/\r
+enum\r
+{\r
+       EMF_OPTION_PRIORITY_HIGH       = 1,          /**< Specifies the high priority.*/\r
+       EMF_OPTION_PRIORITY_NORMAL     = 3,          /**< Specifies the normal priority*/\r
+       EMF_OPTION_PRIORITY_LOW        = 5,          /**< Specifies the low priority.*/\r
+};\r
+\r
+/**\r
+* This enumeration specifies the saving save a copy after sending.\r
+*/\r
+enum\r
+{\r
+       EMF_OPTION_KEEP_LOCAL_COPY_OFF = 0,          /**< Specifies off the keeping local copy.*/\r
+       EMF_OPTION_KEEP_LOCAL_COPY_ON  = 1,          /**< Specifies on the keeping local copy.*/\r
+};\r
+\r
+/**\r
+* This enumeration specifies the request of delivery report.\r
+*/\r
+enum\r
+{\r
+       EMF_OPTION_REQ_DELIVERY_RECEIPT_OFF = 0,     /**< Specifies off the requesting delivery receipt.*/\r
+       EMF_OPTION_REQ_DELIVERY_RECEIPT_ON  = 1,     /**< Specifies on the requesting delivery receipt.*/\r
+};\r
+\r
+/**\r
+* This enumeration specifies the request of read receipt.\r
+*/\r
+enum\r
+{\r
+       EMF_OPTION_REQ_READ_RECEIPT_OFF = 0,         /**< Specifies off the requesting read receipt.*/\r
+       EMF_OPTION_REQ_READ_RECEIPT_ON  = 1,         /**< Specifies on the requesting read receipt.*/\r
+};\r
+\r
+/**\r
+* This enumeration specifies the blocking of address.\r
+*/\r
+enum\r
+{\r
+       EMF_OPTION_BLOCK_ADDRESS_OFF   = 0,          /**< Specifies off the blocking by address.*/\r
+       EMF_OPTION_BLOCK_ADDRESS_ON    = 1,          /**< Specifies on the blocking by address.*/\r
+};\r
+\r
+/**\r
+* This enumeration specifies the blocking of subject.\r
+*/\r
+enum\r
+{\r
+       EMF_OPTION_BLOCK_SUBJECT_OFF   = 0,          /**< Specifies off the blocking by subject.*/\r
+       EMF_OPTION_BLOCK_SUBJECT_ON    = 1,          /**< Specifies on the blocking by subject.*/\r
+};\r
+\r
+enum\r
+{\r
+       EMF_LIST_TYPE_UNREAD           = -3,\r
+       EMF_LIST_TYPE_LOCAL            = -2,\r
+       EMF_LIST_TYPE_THREAD           = -1,\r
+       EMF_LIST_TYPE_NORMAL           = 0\r
+};\r
+\r
+/**\r
+* This enumeration specifies the mailbox sync type.\r
+*/\r
+enum\r
+{\r
+       EMF_MAILBOX_ALL                = -1,         /**< All mailboxes.*/\r
+       EMF_MAILBOX_FROM_SERVER        = 0,          /**< Mailboxes from server. */\r
+       EMF_MAILBOX_FROM_LOCAL         = 1,          /**< Mailboxes from local. */\r
+};\r
+\r
+typedef enum\r
+{\r
+       APPEND_BODY                    = 1,\r
+       UPDATE_MAILBOX,\r
+       UPDATE_ATTACHMENT_INFO,\r
+       UPDATE_FLAG,\r
+       UPDATE_SAVENAME,\r
+       UPDATE_EXTRA_FLAG,\r
+       UPDATE_MAIL,\r
+       UPDATE_DATETIME,\r
+       UPDATE_FROM_CONTACT_INFO,\r
+       UPDATE_TO_CONTACT_INFO,\r
+       UPDATE_ALL_CONTACT_NAME,\r
+       UPDATE_ALL_CONTACT_INFO,\r
+       UPDATE_STICKY_EXTRA_FLAG,\r
+       UPDATE_PARTIAL_BODY_DOWNLOAD,\r
+       UPDATE_MEETING,\r
+       UPDATE_SEEN_FLAG_OF_THREAD,\r
+} emf_mail_change_type_t;\r
+\r
+\r
+/**\r
+* This enumeration specifies the address type.\r
+*/\r
+typedef enum\r
+{\r
+       EMF_ADDRESS_TYPE_FROM          = 1,          /**< Specifies the from address.*/\r
+       EMF_ADDRESS_TYPE_TO,                         /**< Specifies the to receipient address.*/\r
+       EMF_ADDRESS_TYPE_CC,                         /**< Specifies the cc receipient address.*/\r
+       EMF_ADDRESS_TYPE_BCC,                        /**< Specifies the bcc receipient address.*/\r
+       EMF_ADDRESS_TYPE_REPLY,                      /**< Specifies the reply receipient address.*/\r
+       EMF_ADDRESS_TYPE_RETURN,                     /**< Specifies the return receipient address.*/\r
+} emf_address_type_t;\r
+\r
+/**\r
+ * This enumeration specifies the search type for searching mailbox.\r
+ */\r
+typedef enum\r
+{\r
+       EMF_MAILBOX_SEARCH_KEY_TYPE_SUBJECT,         /**< The search key is for searching subject.*/\r
+       EMF_MAILBOX_SEARCH_KEY_TYPE_FROM,            /**< The search key is for searching sender address.*/\r
+       EMF_MAILBOX_SEARCH_KEY_TYPE_BODY,            /**< The search key is for searching body.*/\r
+       EMF_MAILBOX_SEARCH_KEY_TYPE_TO,              /**< The search key is for searching recipient address.*/\r
+} emf_mailbox_search_key_t;\r
+\r
+/**\r
+ * This enumeration specifies the download status of mail body.\r
+ */\r
+\r
+typedef enum\r
+{\r
+       EMF_BODY_DOWNLOAD_STATUS_NONE = 0,\r
+       EMF_BODY_DOWNLOAD_STATUS_FULLY_DOWNLOADED = 1,\r
+       EMF_BODY_DOWNLOAD_STATUS_PARTIALLY_DOWNLOADED = 2,\r
+} emf_body_download_status_t;\r
+\r
+/**\r
+ * This enumeration specifies the moving type.\r
+ */\r
+typedef enum\r
+{\r
+       EMF_MOVED_BY_COMMAND = 0,\r
+       EMF_MOVED_BY_MOVING_THREAD,\r
+       EMF_MOVED_AFTER_SENDING\r
+} emf_move_type;\r
+\r
+/**\r
+ * This enumeration specifies the deletion type.\r
+ */\r
+typedef enum\r
+{\r
+       EMF_DELETED_BY_COMMAND = 0,\r
+       EMF_DELETED_BY_OVERFLOW,\r
+       EMF_DELETED_BY_DELETING_THREAD,\r
+       EMF_DELETED_BY_MOVING_TO_OTHER_ACCOUNT,\r
+       EMF_DELETED_AFTER_SENDING,\r
+       EMF_DELETED_FROM_SERVER,\r
+} emf_delete_type;\r
+\r
+/**\r
+ * This enumeration specifies the status field type.\r
+ */\r
+typedef enum\r
+{\r
+       EMF_FLAGS_SEEN_FIELD = 0,\r
+       EMF_FLAGS_DELETED_FIELD,\r
+       EMF_FLAGS_FLAGGED_FIELD,\r
+       EMF_FLAGS_ANSWERED_FIELD,\r
+       EMF_FLAGS_RECENT_FIELD,\r
+       EMF_FLAGS_DRAFT_FIELD,\r
+       EMF_FLAGS_FORWARDED_FIELD,\r
+       EMF_FLAGS_FIELD_COUNT,\r
+} emf_flags_field_type;\r
+\r
+typedef enum {\r
+       EMF_FLAG_NONE                  = 0,\r
+       EMF_FLAG_FLAGED                = 1,\r
+       EMF_FLAG_TASK_STATUS_CLEAR     = 2,\r
+       EMF_FLAG_TASK_STATUS_ACTIVE    = 3,\r
+       EMF_FLAG_TASK_STATUS_COMPLETE  = 4,\r
+} emf_flagged_type;\r
+\r
+typedef enum {\r
+       EMAIL_SEARCH_FILTER_TYPE_MESSAGE_NO       =  1,  /* integer type */\r
+       EMAIL_SEARCH_FILTER_TYPE_UID              =  2,  /* integer type */\r
+       EMAIL_SEARCH_FILTER_TYPE_BCC              =  7,  /* string type */\r
+       EMAIL_SEARCH_FILTER_TYPE_CC               =  9,  /* string type */\r
+       EMAIL_SEARCH_FILTER_TYPE_FROM             = 10,  /* string type */\r
+       EMAIL_SEARCH_FILTER_TYPE_KEYWORD          = 11,  /* string type */\r
+       EMAIL_SEARCH_FILTER_TYPE_SUBJECT          = 13,  /* string type */\r
+       EMAIL_SEARCH_FILTER_TYPE_TO               = 15,  /* string type */\r
+       EMAIL_SEARCH_FILTER_TYPE_SIZE_LARSER      = 16,  /* integer type */\r
+       EMAIL_SEARCH_FILTER_TYPE_SIZE_SMALLER     = 17,  /* integer type */\r
+       EMAIL_SEARCH_FILTER_TYPE_SENT_DATE_BEFORE = 20,  /* time type */\r
+       EMAIL_SEARCH_FILTER_TYPE_SENT_DATE_ON     = 21,  /* time type */\r
+       EMAIL_SEARCH_FILTER_TYPE_SENT_DATE_SINCE  = 22,  /* time type */\r
+       EMAIL_SEARCH_FILTER_TYPE_FLAGS_ANSWERED   = 26,  /* integer type */\r
+       EMAIL_SEARCH_FILTER_TYPE_FLAGS_DELETED    = 28,  /* integer type */\r
+       EMAIL_SEARCH_FILTER_TYPE_FLAGS_DRAFT      = 30,  /* integer type */\r
+       EMAIL_SEARCH_FILTER_TYPE_FLAGS_FLAGED     = 32,  /* integer type */\r
+       EMAIL_SEARCH_FILTER_TYPE_FLAGS_RECENT     = 34,  /* integer type */\r
+       EMAIL_SEARCH_FILTER_TYPE_FLAGS_SEEN       = 36,  /* integer type */\r
+       EMAIL_SEARCH_FILTER_TYPE_MESSAGE_ID       = 43,  /* string type */\r
+} email_search_filter_type;\r
+\r
+typedef enum {\r
+       EMAIL_DRM_TYPE_NONE                       = 0,\r
+       EMAIL_DRM_TYPE_OBJECT                     = 1,\r
+       EMAIL_DRM_TYPE_RIGHT                      = 2,\r
+       EMAIL_DRM_TYPE_DCF                        = 3\r
+} email_drm_type;\r
+\r
+typedef enum {\r
+       EMAIL_DRM_METHOD_NONE                     = 0,\r
+       EMAIL_DRM_METHOD_FL                       = 1,\r
+       EMAIL_DRM_METHOD_CD                       = 2,\r
+       EMAIL_DRM_METHOD_SSD                      = 3,\r
+       EMAIL_DRM_METHOD_SD                       = 4\r
+} email_drm_method;\r
+\r
+/*****************************************************************************/\r
+/*  Data Structures                                                          */\r
+/*****************************************************************************/\r
+\r
+/**\r
+ * This structure is used to save mail time.\r
+ */\r
+typedef struct\r
+{\r
+       unsigned short year;                         /**< Specifies the Year.*/\r
+       unsigned short month;                        /**< Specifies the Month.*/\r
+       unsigned short day;                          /**< Specifies the Day.*/\r
+       unsigned short hour;                         /**< Specifies the Hour.*/\r
+       unsigned short minute;                       /**< Specifies the Minute.*/\r
+       unsigned short second;                       /**< Specifies the Second.*/\r
+} emf_datetime_t;\r
+\r
+/**\r
+ * This structure is used to save the options.\r
+ */\r
+typedef struct\r
+{\r
+       int   priority;                              /**< Specifies the prority. 1=high 3=normal 5=low.*/\r
+       int   keep_local_copy;                       /**< Specifies the saving save a copy after sending.*/\r
+       int   req_delivery_receipt;                  /**< Specifies the request of delivery report. 0=off 1=on*/\r
+       int   req_read_receipt;                      /**< Specifies the request of read receipt. 0=off 1=on*/\r
+       int   download_limit;                        /**< Specifies the limit of size for downloading.*/\r
+       int   block_address;                         /**< Specifies the blocking of address. 0=off 1=on*/\r
+       int   block_subject;                         /**< Specifies the blocking of subject. 0=off 1=on*/\r
+       char *display_name_from;                     /**< Specifies the display name of from.*/\r
+       int   reply_with_body;                       /**< Specifies the replying with body 0=off 1=on*/\r
+       int   forward_with_files;                    /**< Specifies the fowarding with files 0=off 1=on*/\r
+       int   add_myname_card;                       /**< Specifies the adding name card 0=off 1=on*/\r
+       int   add_signature;                         /**< Specifies the adding signature 0=off 1=on*/\r
+       char *signature;                             /**< Specifies the signature*/\r
+       int   add_my_address_to_bcc;                 /**< Specifies whether bcc field should be always filled with my address. 0=off 1=on*/\r
+} emf_option_t;\r
+\r
+/**\r
+ * This structure is used to save the information of email account.\r
+ */\r
+typedef struct\r
+{\r
+       emf_account_bind_t          account_bind_type;      /**< Specifies the Bind Type.*/\r
+       char                       *account_name;           /**< Specifies the account name.*/\r
+       emf_account_server_t        receiving_server_type;  /**< Specifies the receiving server type.*/\r
+       char                       *receiving_server_addr;  /**< Specifies the address of receiving server.*/\r
+       char                       *email_addr;             /**< Specifies the email adderee.*/\r
+       char                       *user_name;              /**< Specifies the user name.*/\r
+       char                       *password;               /**< Specifies the password.*/\r
+       emf_imap4_retrieval_mode_t  retrieval_mode;         /**< Specifies the retrieval mode in IMAP case.*/\r
+       int                         port_num;               /**< Specifies the port number of receiving server.*/\r
+       int                         use_security;           /**< Specifies the security such as SSL.*/\r
+       emf_account_server_t        sending_server_type;    /**< Specifies the type of sending server.*/\r
+       char                       *sending_server_addr;    /**< Specifies the address of sending server.*/\r
+       int                         sending_port_num;       /**< Specifies the port number of sending server.*/\r
+       int                         sending_auth;           /**< Specifies the authentication of sending server.*/\r
+       int                         sending_security;       /**< Specifies the security such as SSL.*/\r
+       char                       *sending_user;           /**< Specifies the user name of SMTP server.*/\r
+       char                       *sending_password;       /**< Specifies the user password of SMTP server.*/\r
+       char                       *display_name;           /**< Specifies the display name.*/\r
+       char                       *reply_to_addr;          /**< Specifies the reply email address.*/\r
+       char                       *return_addr;            /**< Specifies the email address for return.*/\r
+       int                         account_id;             /**< Specifies the ID of account. Especially, 1 is assigned to Local Account.*/\r
+       int                         keep_on_server;         /**< Specifies the keeping mail on server.*/\r
+       int                         flag1;                  /**< Specifies the downloading option. 0 is subject only, 1 is text body, 2 is normal.*/\r
+       int                         flag2;                  /**< Specifies the 'Same as POP3' option. 0 is none, 1 is 'Same as POP3'.*/\r
+       int                         pop_before_smtp;        /**< POP before SMTP authentication */\r
+       int                         apop;                   /**< APOP Authentication */\r
+       char                       *logo_icon_path;         /**< Account logo icon */\r
+       int                         preset_account;         /**< Preset account or not */\r
+       emf_option_t                options;                /**< Specifies the Sending options */\r
+       int                         target_storage;         /**< Specifies the targetStorage. 0 is phone, 1 is MMC */\r
+       int                         check_interval;         /**< Specifies the Check interval. Unit is minutes */\r
+       int                         my_account_id;          /**< Specifies accout id of my account */\r
+       int                         index_color;            /**< Specifies index color for displaying classifying accounts */\r
+}emf_account_t;\r
+\r
+/**\r
+ * This structure is used to save the information of email server.\r
+ */\r
+\r
+typedef struct\r
+{\r
+       int                         configuration_id;      /**< Specifies the id of configuration.*/\r
+       emf_account_server_t        protocol_type;         /**< Specifies the type of configuration.*/\r
+       char                       *server_addr;           /**< Specifies the address of configuration.*/\r
+       int                         port_number;           /**< Specifies the port number of configuration.*/\r
+       int                         security_type;         /**< Specifies the security such as SSL.*/\r
+       int                         auth_type;             /**< Specifies the authentication type of configuration.*/\r
+} emf_protocol_config_t;\r
+\r
+typedef struct\r
+{\r
+       char                       *service_name;           /**< Specifies the name of service.*/\r
+       int                         authname_format;        /**< Specifies the type of user name for authentication.*/\r
+       int                         protocol_conf_count;    /**< Specifies count of protocol configurations.*/\r
+       emf_protocol_config_t      *protocol_config_array;  /**< Specifies array of protocol configurations.*/\r
+} emf_server_info_t;\r
+\r
+typedef struct\r
+{\r
+       int   mailbox_type;\r
+       char  mailbox_name[MAILBOX_NAME_LENGTH];\r
+} emf_mailbox_type_item_t;\r
+\r
+/**\r
+ * This structure is contains the Mail information.\r
+ */\r
+\r
+typedef struct\r
+{\r
+       int     mail_id;                 /**< Specifies the Mail ID.*/\r
+       int     account_id;              /**< Specifies the Account ID.*/\r
+       char   *mailbox_name;            /**< Specifies the Mailbox Name.*/\r
+       int     mailbox_type;            /**< Specifies the mailbox type of the mail. */\r
+       char   *subject;                 /**< Specifies the subject.*/\r
+       time_t  date_time;               /**< Specifies the Date time.*/\r
+       int     server_mail_status;      /**< Specifies the Whether sever mail or not.*/\r
+       char   *server_mailbox_name;     /**< Specifies the server mailbox.*/\r
+       char   *server_mail_id;          /**< Specifies the Server Mail ID.*/\r
+       char   *message_id;              /**< Specifies the message id */\r
+       char   *full_address_from;       /**< Specifies the From Addr.*/\r
+       char   *full_address_reply;      /**< Specifies the Reply to addr */\r
+       char   *full_address_to;         /**< Specifies the To addr.*/\r
+       char   *full_address_cc;         /**< Specifies the CC addr.*/\r
+       char   *full_address_bcc;        /**< Specifies the BCC addr*/\r
+       char   *full_address_return;     /**< Specifies the return Path*/\r
+       char   *email_address_sender;    /**< Specifies the email address of sender.*/\r
+       char   *email_address_recipient; /**< Specifies the email address of recipients.*/\r
+       char   *alias_sender;            /**< Specifies the alias of sender. */\r
+       char   *alias_recipient;         /**< Specifies the alias of recipients. */\r
+       int     body_download_status;    /**< Specifies the Text donwloaded or not.*/\r
+       char   *file_path_plain;         /**< Specifies the path of text mail body.*/\r
+       char   *file_path_html;          /**< Specifies the path of HTML mail body.*/\r
+       int     mail_size;               /**< Specifies the Mail Size.*/\r
+       char    flags_seen_field;        /**< Specifies the seen flags*/\r
+       char    flags_deleted_field;     /**< Specifies the deleted flags*/\r
+       char    flags_flagged_field;     /**< Specifies the flagged flags*/\r
+       char    flags_answered_field;    /**< Specifies the answered flags*/\r
+       char    flags_recent_field;      /**< Specifies the recent flags*/\r
+       char    flags_draft_field;       /**< Specifies the draft flags*/\r
+       char    flags_forwarded_field;   /**< Specifies the forwarded flags*/\r
+       int     DRM_status;              /**< Has the mail DRM content? (1 : true, 0 : false) */\r
+       int     priority;                /**< Specifies the priority of the mail.*/\r
+       int     save_status;             /**< Specifies the save status*/\r
+       int     lock_status;             /**< Specifies the Locked*/\r
+       int     report_status;           /**< Specifies the Mail Report.*/\r
+       int     attachment_count;        /**< Specifies the attachment count. */\r
+       int     inline_content_count;    /**< Specifies the inline content count. */\r
+       int     thread_id;               /**< Specifies the thread id for thread view. */\r
+       int     thread_item_count;       /**< Specifies the item count of specific thread. */\r
+       char   *preview_text;            /**< Specifies the preview body. */\r
+       int     meeting_request_status;  /**< Specifies the status of meeting request. */\r
+}emf_mail_data_t;\r
+\r
+/**\r
+ * This structure is contains information for displaying mail list.\r
+ */\r
+typedef struct\r
+{\r
+       int    mail_id;                                          /**< Specifies the Mail ID.*/\r
+       int    account_id;                                       /**< Specifies the Account ID.*/\r
+       char   mailbox_name[STRING_LENGTH_FOR_DISPLAY];          /**< Specifies the Mailbox Name.*/\r
+       char   from[STRING_LENGTH_FOR_DISPLAY];                  /**< Specifies the from display name.*/\r
+       char   from_email_address[MAX_EMAIL_ADDRESS_LENGTH];     /**< Specifies the from email address.*/\r
+       char   recipients[STRING_LENGTH_FOR_DISPLAY];            /**< Specifies the recipients display name.*/\r
+       char   subject[STRING_LENGTH_FOR_DISPLAY];               /**< Specifies the subject.*/\r
+       int    is_text_downloaded;                               /**< Specifies the Text donwloaded or not.*/\r
+       time_t date_time;                                        /**< Specifies the Date time.*/\r
+       char   flags_seen_field;                                 /**< Specifies the seen flags*/\r
+       char   flags_deleted_field;                              /**< Specifies the deleted flags*/\r
+       char   flags_flagged_field;                              /**< Specifies the flagged flags*/\r
+       char   flags_answered_field;                             /**< Specifies the answered flags*/\r
+       char   flags_recent_field;                               /**< Specifies the recent flags*/\r
+       char   flags_draft_field;                                /**< Specifies the draft flags*/\r
+       char   flags_forwarded_field;                            /**< Specifies the forwarded flags*/\r
+       int    priority;                                         /**< Specifies the priority of Mails.*/\r
+       int    save_status;                                      /**< Specifies the save status*/\r
+       int    is_locked;                                        /**< Specifies the Locked*/\r
+       int    is_report_mail;                                   /**< Specifies the Mail Report.*/\r
+       int    recipients_count;                                 /**< Specifies the number of to Recipients*/\r
+       int    has_attachment;                                   /**< the mail has attachments or not[ 0: none, 1: over one] */\r
+       int    has_drm_attachment;                               /**< the mail has drm attachment or not*/\r
+       char   previewBodyText[MAX_PREVIEW_TEXT_LENGTH];         /**< text for preview body*/\r
+       int    thread_id;                                        /**< thread id for thread view*/\r
+       int    thread_item_count;                                /**< item count of specific thread */\r
+       int    is_meeting_request;                               /**< Whether the mail is a meeting request or not */\r
+}emf_mail_list_item_t;\r
+\r
+/**\r
+ * This structure is used to save the filtering structure.\r
+ */\r
+typedef struct\r
+{\r
+       int                account_id;   /**< Specifies the account ID.*/\r
+       int                filter_id;    /**< Specifies the filtering ID.*/\r
+       emf_rule_type_t    type;         /**< Specifies the filtering type.*/\r
+       char              *value;        /**< Specifies the filtering value.*/\r
+       emf_rule_action_t  faction;      /**< Specifies the action type for filtering.*/\r
+       char              *mailbox;      /**< Specifies the mail box if action type means move.*/\r
+       int                flag1;        /**< Specifies the activation.*/\r
+       int                flag2;        /**< Reserved.*/\r
+} emf_rule_t;\r
+\r
+/**\r
+ * This structure is used to save the information of mail flag.\r
+ */\r
+typedef struct\r
+{\r
+       unsigned int  seen           : 1; /**< Specifies the read email.*/\r
+       unsigned int  deleted        : 1; /**< Reserved.*/\r
+       unsigned int  flagged        : 1; /**< Specifies the flagged email.*/\r
+       unsigned int  answered       : 1; /**< Reserved.*/\r
+       unsigned int  recent         : 1; /**< Reserved.*/\r
+       unsigned int  draft          : 1; /**< Specifies the draft email.*/\r
+       unsigned int  has_attachment : 1; /**< Reserved.*/\r
+       unsigned int  forwarded      : 1; /**< Reserved.*/\r
+       unsigned int  sticky         : 1; /**< Sticky flagged mails cannot be deleted */\r
+} emf_mail_flag_t;\r
+\r
+\r
+/**\r
+ * This structure is used to save the information of mail extra flag.\r
+ */\r
+typedef struct\r
+{\r
+       unsigned int  priority         : 3; /**< Specifies the mail priority.\r
+                                           The value is greater than or equal to EMF_MAIL_PRIORITY_HIGH.\r
+                                           The value is less than or eqult to EMF_MAIL_PRIORITY_LOW.*/\r
+       unsigned int  status           : 4; /**< Specifies the mail status.\r
+                                              The value is a value of enumeration emf_mail_status_t.*/\r
+       unsigned int  noti             : 1; /**< Specifies the notified mail.*/\r
+       unsigned int  lock             : 1; /**< Specifies the locked mail.*/\r
+       unsigned int  report           : 2; /**< Specifies the MDN/DSN mail. The value is a value of enumeration emf_mail_report_t.*/\r
+       unsigned int  drm              : 1; /**< Specifies the drm mail.*/\r
+       unsigned int  text_download_yn : 2; /**< body download y/n*/            /* To be removed */\r
+} emf_extra_flag_t;\r
+\r
+/**\r
+ * This structure is used to save the information of attachment.\r
+ */\r
+typedef struct st_emf_attachment_info\r
+{\r
+       int                            inline_content;\r
+       int                            attachment_id;        /**< Specifies the attachment ID*/\r
+       char                          *name;                 /**< Specifies the attachment name.*/\r
+       int                            size;                 /**< Specifies the attachment size.*/\r
+       int                            downloaded;           /**< Specifies the download of attachment.*/\r
+       char                          *savename;             /**< Specifies the absolute path of attachment.*/\r
+       int                            drm;                  /**< Specifies the drm type.*/\r
+       char                          *attachment_mime_type; /**< Specifies the context mime type.*/\r
+       struct st_emf_attachment_info *next;                 /**< Specifies the pointer of next attachment.*/\r
+} emf_attachment_info_t;\r
+\r
+typedef struct\r
+{\r
+       int   attachment_id;\r
+       char *attachment_name;\r
+       char *attachment_path;\r
+       int   attachment_size;\r
+       int   mail_id;\r
+       int   account_id;\r
+       char *mailbox_name;\r
+       int   save_status;\r
+       int   drm_status;\r
+       int   inline_content_status;\r
+       char *attachment_mime_type; /**< Specifies the context mime type.*/\r
+} emf_attachment_data_t;\r
+\r
+typedef struct\r
+{\r
+       int        offset_from_GMT;\r
+       char       standard_name[32];\r
+       struct tm  standard_time_start_date;\r
+       int        standard_bias;\r
+       char       daylight_name[32];\r
+       struct tm  daylight_time_start_date;\r
+       int        daylight_bias;\r
+} emf_time_zone_t;\r
+\r
+typedef struct\r
+{\r
+       int                     mail_id;                                        /**< Specifies the mail id of meeting request on DB. This is the primary key. */\r
+       emf_meeting_response_t  meeting_response;                               /**< Specifies the meeting response. */\r
+       struct tm               start_time;\r
+       struct tm               end_time;\r
+       char                   *location;                                       /**< Specifies the location of meeting. Maximum length of this string is 32768 */\r
+       char                   *global_object_id;                               /**< Specifies the object id. */\r
+       emf_time_zone_t         time_zone;\r
+} emf_meeting_request_t;\r
+\r
+/**\r
+ * This structure is used to save the informatioin of sender list with unread/total mail counts\r
+ */\r
+typedef struct\r
+{\r
+       char *address;         /**< Specifies the address of a sender.*/\r
+       char *display_name;    /**< Specifies a display name. This may be one of contact name, alias in original mail and email address of sender. (Priority order : contact name, alias, email address) */\r
+       int   unread_count;    /**< Specifies the number of unread mails received from sender address*/\r
+       int   total_count;     /**< Specifies the total number of  mails which are received from sender address*/\r
+} emf_sender_list_t;\r
+\r
+\r
+/* Creates a type name for structure emf_mailbox_st */\r
+typedef struct emf_mailbox_st emf_mailbox_t; /**< This is an information of mail box. */\r
+\r
+/**\r
+ * This structure is used to save the information of mailbox.\r
+ */\r
+struct emf_mailbox_st\r
+{\r
+       int                 mailbox_id;                 /**< Unique id on mailbox table.*/\r
+       char               *name;                       /**< Specifies the path of mailbox.*/\r
+       emf_mailbox_type_e  mailbox_type;\r
+       char               *alias;                      /**< Specifies the display name of mailbox.*/\r
+       int                 unread_count;               /**< Specifies the Unread Mail count in the mailbox.*/\r
+       int                 total_mail_count_on_local;  /**< Specifies the total number of mails in the mailbox in the local DB.*/\r
+       int                 total_mail_count_on_server; /**< Specifies the total number of mails in the mailbox in the mail server.*/\r
+       int                 hold_connection;            /**< Will have a valid socket descriptor when connection to server is active.. else 0>*/\r
+       int                 local;                      /**< Specifies the local mailbox.*/\r
+       int                 synchronous;                /**< Specifies the mailbox with synchronized the server.*/\r
+       int                 account_id;                 /**< Specifies the account ID for mailbox.*/\r
+       void               *user_data;                  /**< Specifies the internal data.*/\r
+       void               *mail_stream;                /**< Specifies the internal data.*/\r
+       int                 has_archived_mails;         /**< Specifies the archived mails.*/\r
+       int                 mail_slot_size;             /**< Specifies how many mails can be stored.*/\r
+       char               *account_name;               /**< Specifies the name of account.*/\r
+       emf_mailbox_t      *next;                       /**< Reserved.*/\r
+};\r
+\r
+\r
+typedef struct\r
+{\r
+       char *contact_name;\r
+       char *email_address;\r
+       char *alias;\r
+       int   storage_type;\r
+       int   contact_id;\r
+} emf_mail_contact_info_t;\r
+\r
+typedef struct\r
+{\r
+       emf_address_type_t  address_type;\r
+       char               *address;\r
+       char               *display_name;\r
+       int                 storage_type;\r
+       int                 contact_id;\r
+} emf_address_info_t;\r
+\r
+typedef struct\r
+{\r
+       GList *from;\r
+       GList *to;\r
+       GList *cc;\r
+       GList *bcc;\r
+} emf_address_info_list_t;\r
+\r
+typedef struct\r
+{\r
+       int     address_type;           /* type of mail (sender : 0, recipient : 1)*/\r
+       int     address_count;  /*  The number of email addresse */\r
+       char  **address_list;   /*  strings of email addresse */\r
+}emf_email_address_list_t;\r
+\r
+/*  global account lis */\r
+typedef struct emf_account_list_t emf_account_list_t;\r
+struct emf_account_list_t\r
+{\r
+    emf_account_t *account;\r
+    emf_account_list_t *next;\r
+};\r
+\r
+\r
+typedef struct _email_search_filter_t {\r
+       email_search_filter_type search_filter_type; /* type of search filter */\r
+       union {\r
+               int            integer_type_key_value;\r
+               struct tm      time_type_key_value;\r
+               char          *string_type_key_value;\r
+       } search_filter_key_value;\r
+} email_search_filter_t;\r
+\r
+\r
+/*****************************************************************************/\r
+/*  For Active Sync                                                          */\r
+/*****************************************************************************/\r
+\r
+#define VCONFKEY_EMAIL_SERVICE_ACTIVE_SYNC_HANDLE "db/email_handle/active_sync_handle"\r
+#define EMF_ACTIVE_SYNC_NOTI                      "User.Email.ActiveSync"\r
+\r
+typedef enum\r
+{\r
+       ACTIVE_SYNC_NOTI_SEND_MAIL,                 /*  a sending notification to ASE (active sync engine */\r
+       ACTIVE_SYNC_NOTI_SEND_SAVED,                /*  a sending notification to ASE (active sync engine), All saved mails should be sent */\r
+       ACTIVE_SYNC_NOTI_SEND_REPORT,               /*  a sending notification to ASE (active sync engine), report should be sen */\r
+       ACTIVE_SYNC_NOTI_SYNC_HEADER,               /*  a sync header - download mails from server. */\r
+                                                /*  It is depended on account/s flag1 field whether it excutes downloading header only or downloading header + body */\r
+                                                /*  downloading option : 0 is subject only, 1 is text body, 2 is normal */\r
+       ACTIVE_SYNC_NOTI_DOWNLOAD_BODY,             /*  a downloading body notification to AS */\r
+       ACTIVE_SYNC_NOTI_DOWNLOAD_ATTACHMENT,       /*  a downloading attachment notification to AS */\r
+       ACTIVE_SYNC_NOTI_VALIDATE_ACCOUNT,          /*  a account validating notification to AS */\r
+       ACTIVE_SYNC_NOTI_CANCEL_JOB,                /*  a cancling job notification to AS */\r
+       ACTIVE_SYNC_NOTI_SEARCH_ON_SERVER,          /*  a searching on server notification to AS */\r
+}      eactivesync_noti_t;\r
+\r
+typedef union\r
+{\r
+       struct _send_mail\r
+       {\r
+               int           handle;\r
+               int           account_id;\r
+               char         *mailbox_name;\r
+               int           mail_id;\r
+               emf_option_t  options;\r
+       } send_mail;\r
+\r
+       struct _send_mail_saved\r
+       {/*  not defined ye */\r
+               int           handle;\r
+               int           account_id;\r
+       } send_mail_saved;\r
+\r
+       struct _send_report\r
+       {/*  not defined ye */\r
+               int           handle;\r
+               int           account_id;\r
+       } send_report;\r
+\r
+       struct _sync_header\r
+       {\r
+               int           handle;\r
+               int           account_id;\r
+               char         *mailbox_name;\r
+       } sync_header;\r
+\r
+       struct _download_body\r
+       {\r
+               int           handle;\r
+               int           account_id;\r
+               int           mail_id;\r
+               int           with_attachment;      /*  0: without attachments, 1: with attachment */\r
+       } download_body;\r
+\r
+       struct _download_attachment\r
+       {\r
+               int           handle;\r
+               int           account_id;\r
+               int           mail_id;\r
+               char         *attachment_order;\r
+       } download_attachment;\r
+\r
+       struct _cancel_job\r
+       {\r
+               int           account_id;\r
+               int           handle;               /*  job handle to be canceled. this value is issued by email-service (actually in Emf_Mapi_xxx() */\r
+       } cancel_job;\r
+\r
+       struct _validate_account\r
+       {/*  not defined yet */\r
+               int           handle;\r
+               int           account_id;\r
+       } validate_account;\r
+\r
+       struct _search_mail_on_server\r
+       {\r
+               int                    handle;\r
+               int                    account_id;\r
+               char                  *mailbox_name;\r
+               email_search_filter_t *search_filter_list;\r
+               int                    search_filter_count;\r
+       } search_mail_on_server;\r
+\r
+} ASNotiData;\r
+\r
+\r
+/*  types for noti string */\r
+typedef enum\r
+{\r
+       EMF_CONVERT_STRUCT_TYPE_MAIL_LIST_ITEM,      /** specifies emf_mail_list_t */\r
+} emf_convert_struct_type_e;\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+/**\r
+* @} @}\r
+*/\r
+\r
+#endif /* __EMF_LIB_H__ */\r
+\r
diff --git a/email-common-use/include/email-utilities.h b/email-common-use/include/email-utilities.h
new file mode 100755 (executable)
index 0000000..8f63cc3
--- /dev/null
@@ -0,0 +1,64 @@
+/*\r
+*  email-service\r
+*\r
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+*\r
+* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com>\r
+*\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+* http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License.\r
+*\r
+*/\r
+\r
+/*\r
+ * email-utilities.h\r
+ *\r
+ *  Created on: 2012. 3. 6.\r
+ *      Author: kyuho.jo@samsung.com\r
+ */\r
+\r
+#ifndef __EMAIL_UTILITIES_H__\r
+#define __EMAIL_UTILITIES_H__\r
+\r
+#include "email-types.h"\r
+#include "email-internal-types.h"\r
+#include "email-debug-log.h"\r
+#include "email-storage.h"\r
+\r
+INTERNAL_FUNC void* em_malloc(unsigned len);\r
+INTERNAL_FUNC char* em_trim_left(char *str);\r
+INTERNAL_FUNC char* em_trim_right(char *str);\r
+INTERNAL_FUNC char* em_upper_string(char *str);\r
+INTERNAL_FUNC char* em_lower_string(char *str);\r
+INTERNAL_FUNC int   em_upper_path(char *path);\r
+\r
+INTERNAL_FUNC void  em_skip_whitespace(char *addr_str , char **pAddr);\r
+INTERNAL_FUNC char* em_skip_whitespace_without_strdup(char *source_string);\r
+INTERNAL_FUNC char* em_replace_string(char *source_string, char *old_string, char *new_string);\r
+INTERNAL_FUNC void  em_flush_memory();\r
+INTERNAL_FUNC char* em_get_extension_from_file_path(char *source_file_path, int *err_code);\r
+INTERNAL_FUNC int   em_get_encoding_type_from_file_path(const char *input_file_path, char **output_encoding_type);\r
+INTERNAL_FUNC int   em_get_content_type_from_extension_string(const char *extension_string, int *err_code);\r
+\r
+INTERNAL_FUNC int   em_verify_email_address(char *address, int without_bracket, int *err_code);\r
+INTERNAL_FUNC int   em_verify_email_address_of_mail_data(emf_mail_data_t *mail_data, int without_bracket, int *err_code);\r
+INTERNAL_FUNC int   em_verify_email_address_of_mail_tbl(emstorage_mail_tbl_t *input_mail_tbl, int input_without_bracket);\r
+\r
+INTERNAL_FUNC int   em_find_pos_stripped_subject_for_thread_view(char *subject, char *stripped_subject);\r
+INTERNAL_FUNC int   em_find_tag_for_thread_view(char *subject, int *result);\r
+\r
+INTERNAL_FUNC int   em_encode_base64(char *src, unsigned long src_len, char **enc, unsigned long* enc_len, int *err_code);\r
+INTERNAL_FUNC int   em_decode_base64(unsigned char *enc_text, unsigned long enc_len, char **dec_text, unsigned long* dec_len, int *err_code);\r
+\r
+extern        char* strcasestr(__const char *__haystack, __const char *__needle) __THROW __attribute_pure__ __nonnull ((1, 2));\r
+\r
+#endif /* __EMAIL_UTILITIES_H__ */\r
index fb8dfe6..864695f 100755 (executable)
@@ -1,5 +1,5 @@
 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(email-storage)
+PROJECT(email-core)
 
 SET(CMAKE_SKIP_BUILD_RPATH TRUE)
 
@@ -12,25 +12,62 @@ MESSAGE(">>> current directory: ${CMAKE_CURRENT_SOURCE_DIR}")
 MESSAGE(">>> Build type: ${CMAKE_BUILD_TYPE}")
 
 
-SET(VISIBILITY "-DEXPORT_API=\"__attribute__((visibility(\\\"default\\\")))\"")
 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VISIBILITY} -fvisibility=hidden")
 
+
+##########################################################
+# Define device lib
+##########################################################
+
+SET(DEVICE-LIB "email-device")
+SET(DEVICE-SRCS 
+       ./email-device/email-device.c
+)
+
+INCLUDE_DIRECTORIES(
+       ${CMAKE_SOURCE_DIR}/email-common-use/include
+       ${CMAKE_SOURCE_DIR}/email-core/email-device/include
+)
+
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(storage_pkgs REQUIRED glib-2.0 dlog vconf dbus-1)
+
+set(EXTRA_CFLAGS "")
+FOREACH(flag ${device_pkgs_CFLAGS})
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+
+#message(">>> extra_cflags ${EXTRA_CFLAGS}")
+#message(">>> result ${CMAKE_C_FLAGS}")
+
+
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
+
+ADD_LIBRARY(${DEVICE-LIB} SHARED ${DEVICE-SRCS})
+TARGET_LINK_LIBRARIES(${DEVICE-LIB} ${device_LDFLAGS} ${BASE-LIB})
+SET_TARGET_PROPERTIES(${DEVICE-LIB} PROPERTIES SOVERSION ${VERSION_MAJOR})
+SET_TARGET_PROPERTIES(${DEVICE-LIB} PROPERTIES VERSION ${VERSION})
+
+#INSTALL(TARGETS ${DEVICE-LIB} LIBRARY DESTINATION lib)
+INSTALL(TARGETS ${DEVICE-LIB} DESTINATION lib COMPONENT RuntimeLibraries)
+
+
 ##########################################################
-# Define STORAGE lib
+# Define storage lib
 ##########################################################
 
 SET(STORAGE-LIB "email-storage")
 SET(STORAGE-SRCS 
-       ./em-storage/em-storage-noti.c
-       ./em-storage/em-storage.c
-       ${CMAKE_SOURCE_DIR}/emf-emn-storage/emf-emn-storage.c
+       ./email-storage/email-storage.c
 )
 
 INCLUDE_DIRECTORIES(
-       ${CMAKE_ROOT_DIR}/include/common/include
-       ${CMAKE_ROOT_DIR}/include
-       ${CMAKE_SOURCE_DIR}/include
-       ${CMAKE_SOURCE_DIR}/em-storage/include
+       ${CMAKE_SOURCE_DIR}/email-common-use/include
+       ${CMAKE_SOURCE_DIR}/email-daemon/include
+       ${CMAKE_SOURCE_DIR}/email-core/email-storage/include
 )
 
 
@@ -55,7 +92,6 @@ TARGET_LINK_LIBRARIES(${STORAGE-LIB} ${storage_LDFLAGS} ${BASE-LIB} ss-client)
 SET_TARGET_PROPERTIES(${STORAGE-LIB} PROPERTIES SOVERSION ${VERSION_MAJOR})
 SET_TARGET_PROPERTIES(${STORAGE-LIB} PROPERTIES VERSION ${VERSION})
 
-#INSTALL(TARGETS ${STORAGE-LIB} LIBRARY DESTINATION lib)
 INSTALL(TARGETS ${STORAGE-LIB} DESTINATION lib COMPONENT RuntimeLibraries)
 
 
@@ -65,14 +101,14 @@ INSTALL(TARGETS ${STORAGE-LIB} DESTINATION lib COMPONENT RuntimeLibraries)
 
 SET(NETWORK-LIB "email-network")
 SET(NETWORK-SRCS 
-       ./em-network/em-network.c
+       ./email-network/email-network.c
 )
 
 INCLUDE_DIRECTORIES(
-       ${CMAKE_SOURCE_DIR}/include/common/include
-       ${CMAKE_SOURCE_DIR}/include
+       ${CMAKE_SOURCE_DIR}/email-common-use/include
+       ${CMAKE_SOURCE_DIR}/email-daemon/include
        ${CMAKE_SOURCE_DIR}/email-core/include
-       ${CMAKE_SOURCE_DIR}/email-core/em-storage/include
+       ${CMAKE_SOURCE_DIR}/email-core/email-storage/include
 )
 
 INCLUDE(FindPkgConfig)
@@ -101,30 +137,30 @@ INSTALL(TARGETS ${NETWORK-LIB} DESTINATION lib COMPONENT RuntimeLibraries)
 
 SET(CORE-LIB "email-core")
 SET(CORE-SRCS 
-       ${CMAKE_SOURCE_DIR}/email-core/em-core-event.c
-       ${CMAKE_SOURCE_DIR}/email-core/em-core-imap-mailbox.c
-       ${CMAKE_SOURCE_DIR}/email-core/em-core-mailbox.c
-       ${CMAKE_SOURCE_DIR}/email-core/em-core-mailbox-sync.c
-       ${CMAKE_SOURCE_DIR}/email-core/em-core-mesg.c
-       ${CMAKE_SOURCE_DIR}/email-core/em-core-mm-callbacks.c
-       ${CMAKE_SOURCE_DIR}/email-core/em-core-utils.c
-       ${CMAKE_SOURCE_DIR}/email-core/em-core-api.c
-       ${CMAKE_SOURCE_DIR}/email-core/em-core-smtp.c
-       ${CMAKE_SOURCE_DIR}/email-core/em-core-timer.c
-       ${CMAKE_SOURCE_DIR}/email-core/em-core-imap-idle.c
-       ${CMAKE_SOURCE_DIR}/email-core/em-core-global.c
-       ${CMAKE_SOURCE_DIR}/email-core/em-core-account.c
-       ${CMAKE_SOURCE_DIR}/email-core/em-core-mime.c
-       ${CMAKE_SOURCE_DIR}/email-core/em-core-sound.c
+       ${CMAKE_SOURCE_DIR}/email-core/email-core-event.c
+       ${CMAKE_SOURCE_DIR}/email-core/email-core-imap-mailbox.c
+       ${CMAKE_SOURCE_DIR}/email-core/email-core-mailbox.c
+       ${CMAKE_SOURCE_DIR}/email-core/email-core-mailbox-sync.c
+       ${CMAKE_SOURCE_DIR}/email-core/email-core-mail.c
+       ${CMAKE_SOURCE_DIR}/email-core/email-core-mm-callbacks.c
+       ${CMAKE_SOURCE_DIR}/email-core/email-core-utils.c
+       ${CMAKE_SOURCE_DIR}/email-core/email-core-api.c
+       ${CMAKE_SOURCE_DIR}/email-core/email-core-smtp.c
+       ${CMAKE_SOURCE_DIR}/email-core/email-core-timer.c
+       ${CMAKE_SOURCE_DIR}/email-core/email-core-imap-idle.c
+       ${CMAKE_SOURCE_DIR}/email-core/email-core-global.c
+       ${CMAKE_SOURCE_DIR}/email-core/email-core-account.c
+       ${CMAKE_SOURCE_DIR}/email-core/email-core-mime.c
+       ${CMAKE_SOURCE_DIR}/email-core/email-core-sound.c
 )
 
 INCLUDE_DIRECTORIES(
-       ${CMAKE_SOURCE_DIR}/include/common/include
-       ${CMAKE_SOURCE_DIR}/include/
-       ${CMAKE_SOURCE_DIR}/email-core/em-storage/include
+       ${CMAKE_SOURCE_DIR}/email-common-use/include
+       ${CMAKE_SOURCE_DIR}/email-daemon/include/
        ${CMAKE_SOURCE_DIR}/email-core/include
-       ${CMAKE_SOURCE_DIR}/Common/include
-       ${CMAKE_SOURCE_DIR}/email-core/em-network/include
+       ${CMAKE_SOURCE_DIR}/email-core/email-storage/include
+       ${CMAKE_SOURCE_DIR}/email-core/email-network/include
+       ${CMAKE_SOURCE_DIR}/email-core/email-device/include
 )
 
 
@@ -161,7 +197,7 @@ SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
 
 ADD_LIBRARY(${CORE-LIB} SHARED ${CORE-SRCS})
 
-TARGET_LINK_LIBRARIES(${CORE-LIB} ${core_pkgs_LDFLAGS} ${STORAGE-LIB} ${NETWORK-LIB})
+TARGET_LINK_LIBRARIES(${CORE-LIB} ${core_pkgs_LDFLAGS} ${STORAGE-LIB} ${NETWORK-LIB} ${DEVICE-LIB})
 
 SET_TARGET_PROPERTIES(${CORE-LIB} PROPERTIES SOVERSION ${VERSION_MAJOR})
 SET_TARGET_PROPERTIES(${CORE-LIB} PROPERTIES VERSION ${VERSION})
diff --git a/email-core/em-core-account.c b/email-core/em-core-account.c
deleted file mode 100755 (executable)
index cfb7ee3..0000000
+++ /dev/null
@@ -1,1107 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-/******************************************************************************
- * File :  em-core-account.c
- * Desc :  Account Management
- *
- * Auth :  Kyuho Jo 
- *
- * History : 
- *    2010.08.25  :  created
- *****************************************************************************/
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <sys/types.h>
-#include <vconf.h>
-
-#include "Msg_Convert.h"
-#include "emf-types.h"
-#include "emflib.h"
-#include "emf-dbglog.h"
-#include "em-storage.h"
-#include "em-network.h"
-#include "em-core-utils.h"
-#include "em-core-event.h"
-#include "em-core-global.h"
-#include "em-core-account.h" 
-#include "em-core-mailbox.h"
-#include "em-core-imap-mailbox.h"
-
-#ifdef __FEATURE_USING_MY_ACCOUNT__
-#include "account.h"
-#endif /*  FEATURE_USING_MY_ACCOUN */
-
-char *g_default_mbox_alias[MAILBOX_COUNT] = 
-{
-       EMF_INBOX_DISPLAY_NAME, 
-       EMF_DRAFTBOX_DISPLAY_NAME, 
-       EMF_OUTBOX_DISPLAY_NAME, 
-       EMF_SENTBOX_DISPLAY_NAME, 
-       EMF_TRASH_DISPLAY_NAME, 
-       EMF_SPAMBOX_DISPLAY_NAME, 
-};
-
-char *g_default_mbox_name[MAILBOX_COUNT]  = 
-{
-       EMF_INBOX_NAME, 
-       EMF_DRAFTBOX_NAME, 
-       EMF_OUTBOX_NAME, 
-       EMF_SENTBOX_NAME, 
-       EMF_TRASH_DISPLAY_NAME, 
-       EMF_SPAMBOX_NAME, 
-};
-
-emf_mailbox_type_e g_default_mbox_type[MAILBOX_COUNT] = 
-{
-       EMF_MAILBOX_TYPE_INBOX, 
-       EMF_MAILBOX_TYPE_DRAFT, 
-       EMF_MAILBOX_TYPE_OUTBOX, 
-       EMF_MAILBOX_TYPE_SENTBOX, 
-       EMF_MAILBOX_TYPE_TRASH, 
-       EMF_MAILBOX_TYPE_SPAMBOX,               
-};
-
-EXPORT_API emf_account_t* em_core_get_account_reference(int account_id)
-{
-       EM_DEBUG_FUNC_BEGIN("account_id[%d]", account_id);
-       EM_PROFILE_BEGIN(profile_em_core_get_account_reference);
-       emf_account_list_t **p;
-
-       if (account_id == NEW_ACCOUNT_ID)
-               return em_core_account_get_new_account_ref();
-
-       if (account_id > 0)  {          
-               p = &g_account_list;
-               while (*p)  {
-                       if ((*p)->account->account_id == account_id)
-                               return ((*p)->account);
-                       p = &(*p)->next;
-               }
-
-               /*  refresh and check once agai */
-               if (em_core_refresh_account_reference() == true) {
-                       p = &g_account_list;
-                       while (*p)  {
-                               if ((*p)->account->account_id == account_id)
-                                       return ((*p)->account);
-                               
-                               p = &(*p)->next;
-                       }
-               }
-       }
-       EM_PROFILE_END(profile_em_core_get_account_reference);
-       EM_DEBUG_FUNC_END();
-       return NULL;
-}
-
-
-EXPORT_API int em_core_account_validate_with_account_info(emf_account_t *account, int *err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("account[%p], err_code[%p], receiving_server_addr [%s]", account, err_code, account->receiving_server_addr);
-
-       int ret = false;
-       int err = EMF_ERROR_NONE;
-       emf_session_t *session = NULL;
-       SENDSTREAM *stream = NULL;
-       MAILSTREAM *tmp_stream = NULL;
-
-       if (!em_core_check_thread_status())  {          
-               err = EMF_ERROR_CANCELLED;
-               goto FINISH_OFF;
-       }
-
-       if (!em_core_check_network_status(&err))  {
-               EM_DEBUG_EXCEPTION("em_core_check_network_status failed [%d]", err);
-               goto FINISH_OFF;
-       }
-       EM_DEBUG_LOG("Network available");
-
-       if (!em_core_check_thread_status())  {          
-               err = EMF_ERROR_CANCELLED;
-               goto FINISH_OFF;
-       }
-
-       if (!em_core_get_empty_session(&session))  {            
-               EM_DEBUG_EXCEPTION("em_core_get_empty_session failed...");
-               err = EMF_ERROR_SESSION_NOT_FOUND;
-               goto FINISH_OFF;
-       }
-
-#ifdef _SMTP_ACCOUNT_VALIDATION_       
-       /* validate connection for smt */
-       EM_DEBUG_LOG("     >>>>>>>>>> Validate connection for SMTP");
-
-       if (!em_core_check_thread_status()) {
-               err = EMF_ERROR_CANCELLED;
-               goto FINISH_OFF;
-       }
-       if (!em_core_mailbox_open_with_account_info(account, (char *)ENCODED_PATH_SMTP, (void **)&stream, &err) || !stream)  {
-               EM_DEBUG_EXCEPTION("\t em_core_mailbox_open failed 1 - %d", err);
-               if (EMF_ERROR_AUTHENTICATE == err || EMF_ERROR_LOGIN_FAILURE == err) {  /*  wrong password or etc */
-                       EM_DEBUG_EXCEPTION("\t em_core_mailbox_open failed  :  Login or Authentication fail 1- %d", err);
-                       goto FINISH_OFF;
-               }
-
-               if (account->sending_security == 0x01)  /*  0x01 == ss */ {
-                       /*  retry with tl */
-                       EM_DEBUG_LOG("     >>>>>>>>>> Retry with TLS");
-                       account->sending_security = 0x02;       /*  0x02 == tl */
-                       if (!em_core_check_thread_status())  {
-                               err = EMF_ERROR_CANCELLED;
-                               goto FINISH_OFF;
-                       }
-                       
-                   if (!em_core_mailbox_open_with_account_info(account, (char *)ENCODED_PATH_SMTP, (void **)&stream, &err) || !stream)  {
-                               EM_DEBUG_EXCEPTION("\t em_core_mailbox_open failed 2 - %d", err);
-                               if (EMF_ERROR_AUTHENTICATE == err || EMF_ERROR_LOGIN_FAILURE == err) {  /*  wrong password or etc */
-                                       EM_DEBUG_EXCEPTION("\t em_core_mailbox_open failed  :  Login or Authentication fail 2 - %d", err);
-                               }                               
-                               else if (EMF_ERROR_CONNECTION_FAILURE != err) {
-                                       err = EMF_ERROR_VALIDATE_ACCOUNT;
-                               }
-                               account->sending_security = 0x01;       /*  restore to the previous value */
-                               goto FINISH_OFF;
-                   }
-
-                       if (!em_core_check_thread_status())  {
-                               err = EMF_ERROR_CANCELLED;
-                               goto FINISH_OFF;
-                       }
-
-                       /*  save sending_security = 0x02 (tls) to the d */
-                       if (!em_storage_update_account(account_id, (emf_mail_account_tbl_t  *)account, true, &err)) {
-                               EM_DEBUG_EXCEPTION("\t em_storage_update_account failed - %d", err);
-                               account->sending_security = 0x01;       /*  restore to the previous value */
-                               err = EMF_ERROR_VALIDATE_ACCOUNT;
-                               goto FINISH_OFF;
-                       }
-               }
-               else {
-                       if (EMF_ERROR_CONNECTION_FAILURE != err)
-                               err = EMF_ERROR_VALIDATE_ACCOUNT;
-                       goto FINISH_OFF;
-               }
-       }
-#endif
-
-       /* validate connection for pop3/ima */
-       EM_DEBUG_LOG("Validate connection for POP3/IMAP4");
-       if (EMF_ERROR_NONE == err) {
-               if (!em_core_check_thread_status())  {
-                       err = EMF_ERROR_CANCELLED;
-                       goto FINISH_OFF;                
-               }
-               
-                if (!em_core_mailbox_open_with_account_info(account, NULL, (void **)&tmp_stream, &err) || !tmp_stream) 
-                {
-                       EM_DEBUG_EXCEPTION("em_core_mailbox_open failed - %d", err);
-                       if (EMF_ERROR_AUTHENTICATE == err || EMF_ERROR_LOGIN_FAILURE == err) {  /*  wrong password or etc */
-                               EM_DEBUG_EXCEPTION("em_core_mailbox_open failed  :  Login or Authentication fail - %d", err);
-                       }
-                       else if (EMF_ERROR_CONNECTION_FAILURE != err) {
-                               /* err = EMF_ERROR_VALIDATE_ACCOUNT */
-                       }
-                       goto FINISH_OFF;
-               }                       
-       }
-       
-       if (!em_core_check_thread_status())  {
-               if (!em_core_account_delete(account->account_id, NULL))
-                       EM_DEBUG_EXCEPTION("emf_account_delete failed [%d]", account->account_id);
-               err = EMF_ERROR_CANCELLED;
-               goto FINISH_OFF;
-       }
-       
-       ret = true;
-       err = EMF_SUCCESS_VALIDATE_ACCOUNT;
-       
-FINISH_OFF: 
-       if (stream)
-                smtp_close(stream);
-                 
-       if (tmp_stream)
-               em_core_mailbox_close(0 , tmp_stream);
-
-       if (err_code != NULL)
-               *err_code = err;
-       em_core_clear_session(session);
-
-       EM_DEBUG_FUNC_END();
-       
-       return ret;
-}
-
-
-EXPORT_API int em_core_account_validate(int account_id, int *err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("account_id[%d], err_code[%p]", account_id, err_code);
-
-       int err = EMF_ERROR_NONE, ret = false;
-       emf_account_t *ref_account = NULL;
-
-
-       if (account_id <= 0) 
-    {
-               EM_DEBUG_EXCEPTION("account_id[%p]", account_id);
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-
-       ref_account = em_core_get_account_reference(account_id);
-
-       if (ref_account && em_core_account_validate_with_account_info(ref_account, &err) == false) {
-               EM_DEBUG_EXCEPTION("em_core_account_validate_with_account_info failed (%d)", err);
-               goto FINISH_OFF;
-       }
-
-       ret = true;
-
-FINISH_OFF: 
-
-       if (err_code)
-               *err_code = err;
-
-       EM_DEBUG_FUNC_END();
-
-       return ret;
-}
-
-EXPORT_API int em_core_account_delete(int account_id, int *err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("account_id[%d], err_code[%p]", account_id, err_code);
-       
-       /*  default variabl */
-       int ret = false;
-       int err = EMF_ERROR_NONE;
-
-       if (account_id < FIRST_ACCOUNT_ID)  {   
-               EM_DEBUG_EXCEPTION("account_id[%d]", account_id);
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-#ifdef __LOCAL_ACTIVITY__ 
-       /* Delete all local activities of previous account */
-       emf_activity_tbl_t activity;
-       memset(&activity, 0x00, sizeof(emf_activity_tbl_t));
-       activity.account_id = account_id;
-       
-       if (!em_core_activity_delete(&activity, &err)) {
-               EM_DEBUG_LOG("\t em_core_activity_delete failed - %d", err);
-               
-               goto FINISH_OFF;
-       }
-#endif 
-
-#ifdef __FEATURE_PARTIAL_BODY_DOWNLOAD__
-       if (false == em_core_clear_partial_body_thd_event_que(&err))
-               EM_DEBUG_EXCEPTION(" em_core_clear_partial_body_thd_event_que [%d]", err);
-
-       if (false == em_storage_delete_full_pbd_activity_data(account_id, true, &err))
-               EM_DEBUG_EXCEPTION("em_storage_delete_full_pbd_activity_data failed [%d]", err);
-       
-#endif
-
-#ifdef __FEATURE_USING_MY_ACCOUNT__ 
-       {
-               int error_code;
-               emf_account_t *account_to_be_deleted;
-
-               account_to_be_deleted = em_core_get_account_reference(account_id);
-               if (account_to_be_deleted && account_to_be_deleted->receiving_server_type != EMF_SERVER_TYPE_ACTIVE_SYNC) {
-                       EM_DEBUG_LOG("Calling account_svc_delete with my_account_id[%d]", account_to_be_deleted->my_account_id);
-                       error_code = account_connect();
-                       EM_DEBUG_LOG("account_connect returns [%d]", error_code);
-                       account_delete_from_db_by_id(account_to_be_deleted->my_account_id);             
-                       error_code = account_disconnect();
-                       EM_DEBUG_LOG("account_disconnect returns [%d]", error_code);
-               }
-       }
-#endif
-       if (em_core_cancel_all_threads_of_an_account(account_id) < EMF_ERROR_NONE) {
-               EM_DEBUG_EXCEPTION("There are some remaining jobs. I couldn't stop them.");
-               err = EMF_ERROR_CANNOT_STOP_THREAD;
-               goto FINISH_OFF;
-       }
-       
-       emf_mailbox_t mbox;
-
-       /*  BEGIN TRANSACTION;           */
-       em_storage_begin_transaction(NULL, NULL, NULL);
-       
-       if (!em_storage_delete_account(account_id, false, &err))  {
-               EM_DEBUG_EXCEPTION("em_storage_delete_account failed - %d", err);
-               goto FINISH_OFF;
-       }
-       
-#ifdef __FEATURE_KEEP_CONNECTION__
-       /* em_core_reset_streams(); */
-       em_core_remove_connection_info(account_id);
-#endif
-       
-       mbox.account_id = account_id;
-       mbox.name = NULL;
-       
-       if (!em_core_mail_delete_all(&mbox, 0, &err))  {
-               EM_DEBUG_EXCEPTION("em_core_mail_delete_all failed - %d", err);
-               goto FINISH_OFF;
-       }
-       
-       /*  delete all mailboxe */
-       if (!em_storage_delete_mailbox(account_id, -1, NULL, false, &err))  {           
-               EM_DEBUG_EXCEPTION("em_storage_delete_mailbox failed - %d", err);
-               goto FINISH_OFF;
-       }
-       
-       /*  delete local imap sync mailbox from imap mailbox tabl */
-       if (!em_storage_remove_downloaded_mail(account_id, NULL, NULL, false, &err))  {
-               EM_DEBUG_EXCEPTION("em_storage_remove_downloaded_mail failed - %d", err);
-               goto FINISH_OFF;
-       }
-
-       em_core_check_unread_mail();
-       em_core_delete_notification_by_account(account_id);
-       em_core_refresh_account_reference();
-       
-       ret = true;
-       
-FINISH_OFF: 
-       if (ret == true) {      /*  COMMIT TRANSACTION; */
-               if (em_storage_commit_transaction(NULL, NULL, NULL) == false) {
-                       err = em_storage_get_emf_error_from_em_storage_error(EM_STORAGE_ERROR_DB_FAILURE);
-                       ret = false;
-               }
-               if (!em_storage_notify_storage_event(NOTI_ACCOUNT_DELETE, account_id, 0, NULL, 0))
-                       EM_DEBUG_EXCEPTION(" em_storage_notify_storage_event[ NOTI_ACCOUNT_DELETE] : Notification Failed >>> ");
-
-       }
-       else {  /*  ROLLBACK TRANSACTION; */
-               if (em_storage_rollback_transaction(NULL, NULL, NULL) == false)
-                       err = em_storage_get_emf_error_from_em_storage_error(EM_STORAGE_ERROR_DB_FAILURE);
-               if (!em_storage_notify_storage_event(NOTI_ACCOUNT_DELETE_FAIL, account_id, err, NULL, 0))
-                       EM_DEBUG_EXCEPTION(" em_storage_notify_storage_event[ NOTI_ACCOUNT_DELETE] : Notification Failed >>> ");
-       }       
-
-       if (err_code)
-               *err_code = err;
-
-       EM_DEBUG_FUNC_END();
-
-       return ret;
-}
-
-EXPORT_API int em_core_account_create(emf_account_t *account, int *err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("account[%p], err_code[%p]", account, err_code);
-       
-       int ret = false;
-       int err = EMF_ERROR_NONE;
-       int i, count = 0, is_preset_IMAP_account = false;
-       emf_mailbox_t local_mailbox = {0};
-       emf_mail_account_tbl_t *temp_account_tbl = NULL;
-       
-       if (!account)  {
-               EM_DEBUG_EXCEPTION("account[%p]", account);
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-       
-       if (!em_storage_get_account_count(&count, true, &err))  {
-               EM_DEBUG_EXCEPTION("em_storage_get_account_count failed - %d", err);
-               goto FINISH_OFF;
-       }
-
-
-       if (count >= EMF_ACCOUNT_MAX)  {
-               EM_DEBUG_EXCEPTION("too many accounts...");
-               err = EMF_ERROR_ACCOUNT_MAX_COUNT;
-               goto FINISH_OFF;
-       }
-
-       account->account_id = 0;
-
-       /* check for email address validation */
-       EM_DEBUG_LOG("account->email_addr[%s]", account->email_addr);
-       if (account->email_addr) {
-               if (!em_core_verify_email_address(account->email_addr, true, &err)) {
-                       err = EMF_ERROR_INVALID_ADDRESS;
-                       EM_DEBUG_EXCEPTION("Invalid Email Address");
-                       goto FINISH_OFF;
-               }
-       }
-
-#ifdef __FEATURE_USING_MY_ACCOUNT__
-       if (account->receiving_server_type != EMF_SERVER_TYPE_ACTIVE_SYNC) {
-               int account_svc_id = 0;
-               int error_code;
-               account_h account_handle = NULL;
-
-               error_code = account_connect();
-               error_code = account_create(&account_handle);
-               
-               if(error_code != ACCOUNT_ERROR_NONE) {
-                       EM_DEBUG_EXCEPTION("account_create failed [%d]", error_code);
-                       err = error_code;
-                       goto FINISH_OFF;
-               }
-
-               account_set_user_name(account_handle, account->user_name);
-               account_set_domain_name(account_handle, account->account_name); 
-               account_set_email_address(account_handle,  account->email_addr);
-               account_set_source(account_handle, "EMAIL");
-               account_set_package_name(account_handle, "email-setting-efl");
-               account_set_capability(account_handle , ACCOUNT_CAPABILITY_EMAIL, ACCOUNT_CAPABILITY_ENABLED);
-               if (account->logo_icon_path)
-                       account_set_icon_path(account_handle, account->logo_icon_path);
-               error_code = account_insert_to_db(account_handle, &account_svc_id); 
-
-               if (error_code != ACCOUNT_ERROR_NONE) {
-                       EM_DEBUG_EXCEPTION("account_insert_to_db failed [%d]", error_code);
-                       err = error_code;
-                       goto FINISH_OFF;
-               }
-
-                       account->my_account_id = account_svc_id;    
-                       
-               EM_DEBUG_LOG("account_insert_to_db succeed");
-               
-               account_disconnect();
-       }
-#endif  /*  __FEATURE_USING_MY_ACCOUNT__ */
-
-       temp_account_tbl = em_core_malloc(sizeof(emf_mail_account_tbl_t));
-       if (!temp_account_tbl) {
-               EM_DEBUG_EXCEPTION("allocation failed [%d]", err);
-               goto FINISH_OFF;
-       }
-       em_convert_account_to_account_tbl(account, temp_account_tbl);
-
-       if (!em_storage_add_account(temp_account_tbl, true, &err))  {
-               EM_DEBUG_EXCEPTION("em_storage_add_account failed - %d", err);
-               goto FINISH_OFF;
-       }
-       account->account_id = temp_account_tbl->account_id;
-       is_preset_IMAP_account = ((account->receiving_server_type == EMF_SERVER_TYPE_IMAP4)) ? true : false;/*  && (account->preset_account)) ? true  :  false */
-
-       EM_DEBUG_LOG("is_preset_IMAP_account  :  %d", is_preset_IMAP_account);
-
-       if ((account->receiving_server_type != EMF_SERVER_TYPE_ACTIVE_SYNC)     && (!is_preset_IMAP_account)) {
-               /* 1. create default local mailbox
-               *    (Inbox, Draft, Outbox, Sentbox) */
-               for (i = 0; i < MAILBOX_COUNT; i++) {
-               EM_DEBUG_LOG("g_default_mbox_name [%d/%d] is [%s]", i, MAILBOX_COUNT, g_default_mbox_name[i]);
-                       local_mailbox.account_id = temp_account_tbl->account_id;
-                       local_mailbox.name  = g_default_mbox_name[i];
-                       local_mailbox.mailbox_type      = g_default_mbox_type[i];
-                       if (local_mailbox.mailbox_type == EMF_MAILBOX_TYPE_INBOX) {
-                               local_mailbox.local = EMF_MAILBOX_FROM_SERVER;
-                               local_mailbox.synchronous = 1;
-                       }
-                       else {
-                               local_mailbox.local = EMF_MAILBOX_FROM_LOCAL;
-                               local_mailbox.synchronous = 0;
-                       }
-                       local_mailbox.alias = g_default_mbox_alias[i];
-                       em_core_mailbox_get_default_mail_slot_count(&local_mailbox.mail_slot_size, NULL);
-
-                       if (!em_core_mailbox_create(&local_mailbox, 0, &err))  {
-                               EM_DEBUG_EXCEPTION("em_core_mailbox_create failed - %d", err);
-                               goto FINISH_OFF;
-                       }
-                       
-               }
-       }
-       
-       
-       
-       ret = true;
-       
-FINISH_OFF: 
-       if (temp_account_tbl)
-               em_storage_free_account(&temp_account_tbl, 1, NULL);
-       
-       if (ret == false && account != NULL)  {
-               if (!em_core_account_delete(account->account_id, NULL))
-                       EM_DEBUG_EXCEPTION("emf_account_delete Failed [%d]", account->account_id);
-       }
-       
-       if (err_code)
-               *err_code = err;
-
-       EM_DEBUG_FUNC_END("Return value [%d]", ret);
-       return ret;
-}
-
-
-EXPORT_API int em_core_init_account_reference()
-{
-       EM_DEBUG_FUNC_BEGIN();
-       
-       int ret = false;
-       int err = EMF_ERROR_NONE;
-       
-       emf_account_list_t *account_list = NULL;
-       emf_account_list_t **p = NULL;
-       emf_account_t *account = NULL;
-       emf_mail_account_tbl_t *account_tbl_array = NULL;
-       int count = 0;          
-       int i = 0;
-       
-       if (!g_account_retrieved)  {
-               count = 1000;
-               if (!em_storage_get_account_list(&count, &account_tbl_array, true, true, &err))  {
-                       EM_DEBUG_EXCEPTION("em_storage_get_account_list failed - %d", err);
-                       goto FINISH_OFF;
-               }
-               
-               for (p = &account_list, i = 0; i < count; i++)  {
-                       account = malloc(sizeof(emf_account_t));
-                       if (!account)  {        
-                               EM_DEBUG_EXCEPTION("malloc failed...");
-                               err = EMF_ERROR_OUT_OF_MEMORY;
-                               goto FINISH_OFF;
-                       }
-                       
-                       em_convert_account_tbl_to_account(account_tbl_array + i, account);
-
-                       /* memcpy(account, accounts + i, sizeof(emf_account_t)) */
-                       /* memset(accounts + i, 0x00, sizeof(emf_account_t)) */
-                       
-                       (*p) = malloc(sizeof(emf_account_list_t));
-                       if (!(*p))  {   
-                               EM_DEBUG_EXCEPTION("malloc failed...");
-                               err = EMF_ERROR_OUT_OF_MEMORY;
-                               goto FINISH_OFF;
-                       }
-                       
-                       memset((*p), 0x00, sizeof(emf_account_list_t));
-                       
-                       (*p)->account = account;
-                       
-                       p = &(*p)->next;
-               }
-               if (g_account_num)
-                       em_core_free_account_reference();
-               g_account_retrieved = 1;
-               g_account_num = count;
-               g_account_list = account_list;
-       }
-       
-       ret = true;
-       
-FINISH_OFF: 
-       if (account_tbl_array != NULL)
-               em_storage_free_account(&account_tbl_array, count, NULL);
-       
-       if (!ret)  {
-               g_account_list = account_list;
-               em_core_free_account_reference();
-       }
-
-       EM_DEBUG_FUNC_END("ret [%d]", ret);
-       return ret;
-}
-
-EXPORT_API int em_core_refresh_account_reference()
-{
-       EM_DEBUG_FUNC_BEGIN();
-       
-       if (g_account_retrieved && g_account_num)
-               em_core_free_account_reference();
-       
-       g_account_retrieved = 0;
-       g_account_num = 0;
-       g_account_list = NULL;
-       
-       if (!em_core_init_account_reference())  {
-               EM_DEBUG_EXCEPTION("em_core_init_account_reference failed...");
-               return false;
-       }
-       EM_DEBUG_FUNC_END();
-       return true;
-}
-
-EXPORT_API int em_core_free_account_reference()
-{
-       EM_DEBUG_FUNC_BEGIN();
-       
-       emf_account_list_t *p = g_account_list, *p_next;
-       while (p)  {
-               em_core_account_free(&p->account, 1, NULL);
-               
-               p_next = p->next;
-               free(p);
-               p = p_next;
-       }
-
-       g_account_retrieved = 0;
-       g_account_num = 0;
-       g_account_list = NULL;
-       EM_DEBUG_FUNC_END();
-       return true;
-}
-
-EXPORT_API int em_core_account_free(emf_account_t **account_list, int count, int *err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("account_list[%p], count[%d], err_code[%p]", account_list, count, err_code);
-       
-       /*  default variabl */
-       int ret = false;
-       int err = EMF_ERROR_NONE;
-       
-       if (count > 0)  {
-               if (!account_list || !*account_list)  {
-                       err = EMF_ERROR_INVALID_PARAM;
-                       goto FINISH_OFF;
-               }
-               
-               emf_account_t *p = *account_list;
-               int i;
-               
-               for (i = 0; i < count; i++)  {
-                       EM_SAFE_FREE(p[i].account_name);
-                       EM_SAFE_FREE(p[i].receiving_server_addr);
-                       EM_SAFE_FREE(p[i].email_addr);
-                       EM_SAFE_FREE(p[i].user_name);
-                       EM_SAFE_FREE(p[i].password);
-                       EM_SAFE_FREE(p[i].sending_server_addr);
-                       EM_SAFE_FREE(p[i].sending_user);
-                       EM_SAFE_FREE(p[i].sending_password);
-                       EM_SAFE_FREE(p[i].display_name);
-                       EM_SAFE_FREE(p[i].reply_to_addr);
-                       EM_SAFE_FREE(p[i].return_addr);                 
-                       EM_SAFE_FREE(p[i].logo_icon_path);
-                       EM_SAFE_FREE(p[i].options.display_name_from);
-                       EM_SAFE_FREE(p[i].options.signature);
-               }
-               
-               EM_SAFE_FREE(p); *account_list = NULL;
-       }
-       
-       ret = true;
-       
-FINISH_OFF: 
-       if (err_code)
-               *err_code = err;
-       EM_DEBUG_FUNC_END();
-       return ret;
-}
-
-
-EXPORT_API int em_core_account_get_list_refer(emf_account_t **account_list, int *count, int *err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("account_list[%p], count[%p], err_code[%p]", account_list, count, err_code);
-       int i, countOfAccounts = 0;
-       int ret = false;
-       int err = EMF_ERROR_NONE;
-       emf_account_t *accountRef;
-       emf_account_list_t *p;
-
-       if (!account_list || !count)  {
-               EM_DEBUG_EXCEPTION("account_list[%p], count[%p]", account_list, count);
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-
-       p = g_account_list;
-
-       while (p) {
-               countOfAccounts++;
-               p = p->next;
-       }
-       
-       EM_DEBUG_LOG("Result count[%d]", countOfAccounts);
-       *count = countOfAccounts;
-
-       if (countOfAccounts > 0) {
-               *account_list = malloc(sizeof(emf_account_t) * countOfAccounts);
-               if (!*account_list)  {          
-                       EM_DEBUG_LOG("malloc failed...");
-                       err = EMF_ERROR_OUT_OF_MEMORY;
-                       goto FINISH_OFF;
-               }
-       }
-
-       p = g_account_list;
-       for (i = 0; i < countOfAccounts; i++)  {
-               accountRef = (*account_list) + i;
-               memcpy(accountRef, p->account , sizeof(emf_account_t));
-               p = p->next;
-       }
-
-       for (i = 0; i < countOfAccounts; i++)  {
-               accountRef = (*account_list) + i;
-               EM_DEBUG_LOG("Result account id[%d], name[%s]", accountRef->account_id, accountRef->account_name);
-       }
-
-       ret = true;
-
-FINISH_OFF: 
-       if (ret == false) {
-               if (account_list) /*  Warn! this is not *account_list. Just account_list */
-                       EM_SAFE_FREE(*account_list);
-       }
-
-       if (err_code != NULL)
-               *err_code = err;
-       EM_DEBUG_FUNC_END();
-       return ret;
-}
-       
-
-#ifdef __FEATURE_BACKUP_ACCOUNT__
-#include <ss_manager.h>
-
-static int append_data_into_buffer(char **target_buffer, int *target_buffer_lenth, char *input_data, int input_data_length, int *error_code)
-{
-       EM_DEBUG_FUNC_BEGIN("target_buffer [%p], target_buffer_lenth [%p], input_data [%p], input_data_length[%d]", target_buffer, target_buffer_lenth, input_data, input_data_length);
-       int local_error_code = EMF_ERROR_NONE, ret_code = false;
-
-       if (!target_buffer || !target_buffer_lenth || !input_data) {
-               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
-               local_error_code = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-
-       if (*target_buffer_lenth > 0 && input_data_length) {
-               EM_DEBUG_LOG("*target_buffer_lenth [%d]", *target_buffer_lenth);
-               *target_buffer = realloc(*target_buffer, (*target_buffer_lenth) + input_data_length);
-               if (!*target_buffer) {
-                       EM_DEBUG_EXCEPTION("realloc failed");
-                       local_error_code = EMF_ERROR_OUT_OF_MEMORY;
-                       goto FINISH_OFF;
-               }
-               memcpy(*target_buffer + (*target_buffer_lenth), input_data, input_data_length);
-               *target_buffer_lenth += input_data_length;
-               EM_DEBUG_LOG("*target_buffer_lenth [%d] input_data_length [%d]", *target_buffer_lenth, input_data_length);
-       }
-       else {
-               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
-               local_error_code = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-
-       ret_code = true;
-
-FINISH_OFF: 
-
-       if (error_code)
-               *error_code = local_error_code;
-       EM_DEBUG_FUNC_END("ret_code [%d]", ret_code);
-
-       return ret_code;
-}
-
-
-static int em_core_write_account_into_buffer(char **target_buffer, int *target_buffer_lenth, emf_mail_account_tbl_t *account_tbl_ptr, int *error_code)
-{
-       EM_DEBUG_FUNC_BEGIN("target_buffer [%p], target_buffer_lenth [%p], account_tbl_ptr [%p], error_code [%p]", target_buffer, target_buffer_lenth, account_tbl_ptr, error_code);
-       int local_error_code = EMF_ERROR_NONE, ret_code = false, stream_length = 0;
-       emf_account_t *temp_account = NULL;
-       char *byte_stream = NULL;
-
-       temp_account = em_core_malloc(sizeof(emf_account_t));
-       memset(temp_account, 0, sizeof(emf_account_t));
-
-       if (em_convert_account_tbl_to_account(account_tbl_ptr, temp_account)) {
-               byte_stream = em_convert_account_to_byte_stream(temp_account, &stream_length);
-               EM_DEBUG_LOG("stream_length [%d]", stream_length);
-               /*  EM_DEBUG_LOG("password [%s]", temp_account->password) */
-
-               if (byte_stream) {
-                       if (!append_data_into_buffer(target_buffer, target_buffer_lenth, (char *)&stream_length, sizeof(int), &local_error_code)) {
-                               EM_DEBUG_EXCEPTION("append_data_into_buffer failed");
-                               goto FINISH_OFF;
-                       }
-                       EM_DEBUG_LOG("append_data_into_buffer succeed for stream_length");
-
-                       if (!append_data_into_buffer(target_buffer, target_buffer_lenth, byte_stream, stream_length, &local_error_code)) {
-                               EM_DEBUG_EXCEPTION("append_data_into_buffer failed");
-                               goto FINISH_OFF;
-                       }
-                       EM_DEBUG_LOG("append_data_into_buffer succeed for byte_stream");
-               }
-       }
-       else {
-               EM_DEBUG_EXCEPTION("em_convert_account_tbl_to_account failed");
-               local_error_code = EM_STORAGE_ERROR_SYSTEM_FAILURE;
-               goto FINISH_OFF;
-       }
-
-       ret_code = true;
-FINISH_OFF: 
-       if (temp_account)
-               em_core_account_free(&temp_account, 1, NULL);
-       if (error_code)
-               *error_code = local_error_code;
-
-       EM_SAFE_FREE(byte_stream);
-
-       EM_DEBUG_FUNC_END("ret_code [%d]", ret_code);
-       return ret_code;
-}
-
-EXPORT_API int em_core_backup_accounts(const char *file_path, int *error_code)
-{
-       EM_DEBUG_FUNC_BEGIN("file_path [%s], error_code [%p]", file_path, error_code);
-       int local_error_code = EMF_ERROR_NONE, local_error_code_2 = EMF_ERROR_NONE, ret_code = false;
-       int select_num, i, target_buff_length = 0;
-       char *target_buffer = NULL;
-       emf_mail_account_tbl_t *account_list = NULL;
-
-       if (!file_path) {
-               local_error_code = EMF_ERROR_INVALID_PARAM;
-               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
-               goto FINISH_OFF;        
-       }
-
-       select_num = 1000;
-       
-       if (!em_storage_get_account_list(&select_num, &account_list, true, true, &local_error_code)) {
-               EM_DEBUG_EXCEPTION("em_storage_get_account_list failed [%d]", local_error_code);
-               goto FINISH_OFF;        
-       }
-       
-       EM_DEBUG_LOG("select_num [%d]", select_num);
-       
-       if (account_list) {
-               target_buffer = malloc(sizeof(int));
-               if (!target_buffer)  {
-                       EM_DEBUG_EXCEPTION("malloc failed");
-                       local_error_code = EMF_ERROR_OUT_OF_MEMORY;
-                       goto FINISH_OFF;
-               }
-
-               memcpy(target_buffer, (char *)&select_num, sizeof(int));
-               target_buff_length = sizeof(int);
-
-               for (i = 0; i < select_num; i++) {
-                       if (!em_core_write_account_into_buffer(&target_buffer, &target_buff_length, account_list + i, &local_error_code)) {
-                               EM_DEBUG_EXCEPTION("em_core_write_account_into_buffer failed [%d]", local_error_code);
-                               goto FINISH_OFF;        
-                       }
-               }
-
-               EM_DEBUG_LOG("target_buff_length [%d]", target_buff_length);
-
-               ssm_delete_file(file_path, SSM_FLAG_SECRET_OPERATION, NULL);
-               
-               if (ssm_write_buffer(target_buffer, target_buff_length, file_path, SSM_FLAG_SECRET_OPERATION, NULL) < 0) {
-                       EM_DEBUG_EXCEPTION("ssm_write_buffer failed [%d]", local_error_code);
-                       local_error_code = EM_STORAGE_ERROR_SYSTEM_FAILURE;
-                       goto FINISH_OFF;        
-               }
-               
-       }
-
-       ret_code = true;        
-FINISH_OFF: 
-
-       EM_SAFE_FREE(target_buffer);
-       if (account_list)
-               em_storage_free_account(&account_list, select_num, &local_error_code_2);
-
-       if (error_code)
-               *error_code = local_error_code;
-
-       EM_DEBUG_FUNC_END("ret_code [%d]", ret_code);
-       return ret_code;
-}
-
-EXPORT_API int em_core_restore_accounts(const char *file_path, int *error_code)
-{
-       EM_DEBUG_FUNC_BEGIN("file_path [%s], error_code [%p]", file_path, error_code);
-       int local_error_code = EMF_ERROR_NONE, ret_code = false, buffer_length = 0, read_length = 0;
-       int account_count = 0, i = 0, account_stream_length = 0;
-       char *temp_buffer = NULL, *account_stream = NULL, *buffer_ptr = NULL;
-       emf_account_t *temp_account = NULL, *account_list = NULL;
-
-       ssm_file_info_t sfi;
-
-       if (!file_path) {
-               local_error_code = EMF_ERROR_INVALID_PARAM;
-               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
-               goto FINISH_OFF;        
-       }
-
-       if (em_core_account_get_list_refer(&account_list, &account_count, &ret_code)) {
-               for (i = 0; i < account_count; i++) {
-                       if (!em_core_account_delete(account_list[i].account_id, &ret_code)) {
-                               local_error_code = EMF_ERROR_INVALID_ACCOUNT;
-                               EM_DEBUG_EXCEPTION("em_core_account_delete failed");
-                               goto FINISH_OFF;        
-                       }
-               }
-       }
-
-       if (ssm_getinfo(file_path, &sfi, SSM_FLAG_SECRET_OPERATION, NULL) < 0) {
-               EM_DEBUG_EXCEPTION("ssm_getinfo() failed.");
-               ret_code = EM_STORAGE_ERROR_SYSTEM_FAILURE;
-               goto FINISH_OFF;
-       }
-
-       buffer_length = sfi.originSize;
-       EM_DEBUG_LOG("account buffer_length[%d]", buffer_length);
-       if ((temp_buffer = (char *)em_core_malloc(buffer_length + 1)) == NULL) {
-               EM_DEBUG_EXCEPTION("em_core_malloc failed...");
-               ret_code = EM_STORAGE_ERROR_OUT_OF_MEMORY;
-               goto FINISH_OFF;
-       }
-
-       if (ssm_read(file_path, temp_buffer, buffer_length, (size_t *)&read_length, SSM_FLAG_SECRET_OPERATION, NULL) < 0) {
-               EM_DEBUG_EXCEPTION("ssm_read() failed.");
-               ret_code = EM_STORAGE_ERROR_SYSTEM_FAILURE;
-               goto FINISH_OFF;
-       }
-
-       EM_DEBUG_LOG("read_length[%d]", read_length);
-
-       if (buffer_length == read_length) {
-               memcpy((void *)&account_count, temp_buffer, sizeof(int));
-               buffer_ptr = temp_buffer + sizeof(int);
-
-               EM_DEBUG_LOG("account_count[%d]", account_count);               
-
-               for (i = 0; i < account_count; i++) {
-                       memcpy((void *)&account_stream_length, buffer_ptr, sizeof(int));
-                       buffer_ptr += sizeof(int);
-                       EM_DEBUG_LOG("account_stream_length [%d]", account_stream_length);
-                       if (account_stream_length) {
-                               account_stream = em_core_malloc(account_stream_length);
-                               if (!account_stream) {
-                                       EM_DEBUG_EXCEPTION("em_core_malloc() failed.");
-                                       ret_code = EMF_ERROR_OUT_OF_MEMORY ;
-                                       goto FINISH_OFF;
-                               }
-                               memcpy(account_stream, buffer_ptr, account_stream_length);
-
-                               temp_account = em_core_malloc(sizeof(emf_account_t));
-
-                               if (!temp_account) {
-                                       EM_DEBUG_EXCEPTION("em_core_malloc() failed.");
-                                       ret_code = EMF_ERROR_OUT_OF_MEMORY;
-                                       goto FINISH_OFF;
-                               }
-
-                               em_convert_byte_stream_to_account(account_stream, temp_account);
-                               EM_SAFE_FREE(account_stream);
-                       
-                               if (!em_core_account_create(temp_account, &ret_code)) {
-                                       EM_DEBUG_EXCEPTION("em_core_account_create() failed.");
-                                       goto FINISH_OFF;
-                               }
-
-                               em_core_account_free(&temp_account, 1,  &ret_code);
-                               temp_account = NULL;
-                       }
-                       buffer_ptr += account_stream_length;
-                       account_stream_length = 0;
-               }
-       } else {
-               EM_DEBUG_EXCEPTION("ssm_read() failed.");
-               ret_code = EMF_ERROR_SYSTEM_FAILURE;
-               goto FINISH_OFF;
-       }
-       ret_code = true;        
-FINISH_OFF: 
-       if (temp_account)
-               em_core_account_free(&temp_account, 1, NULL);
-       EM_SAFE_FREE(account_stream);
-       EM_SAFE_FREE(temp_buffer);
-
-       EM_DEBUG_FUNC_END("ret_code [%d]", ret_code);
-       return ret_code;
-}
-
-#endif /*  __FEATURE_BACKUP_ACCOUNT_ */
-
-EXPORT_API int em_core_query_server_info(const char* domain_name, emf_server_info_t **result_server_info)
-{
-       EM_DEBUG_FUNC_BEGIN("domain_name [%s], result_server_info [%p]", domain_name, result_server_info);
-       int ret_code = EMF_ERROR_NONE;
-
-
-       EM_DEBUG_FUNC_END("ret_code [%d]", ret_code);
-       return ret_code;
-}
-
-
-EXPORT_API int em_core_free_server_info(emf_server_info_t **target_server_info)
-{
-       EM_DEBUG_FUNC_BEGIN("result_server_info [%p]", target_server_info);
-       int i, ret_code = EMF_ERROR_NONE;
-       emf_server_info_t *server_info = NULL;
-
-       if(target_server_info && *target_server_info) {
-               server_info = *target_server_info;
-               EM_SAFE_FREE(server_info->service_name);
-               for(i = 0; i < server_info->protocol_conf_count; i++) {
-                       EM_SAFE_FREE(server_info->protocol_config_array[i].server_addr);
-               }
-               EM_SAFE_FREE(server_info->protocol_config_array);
-               EM_SAFE_FREE(server_info);
-       }
-       EM_DEBUG_FUNC_END("ret_code [%d]", ret_code);
-       return ret_code;        
-}
-
-EXPORT_API int em_core_save_default_account_id(int input_account_id)
-{
-       EM_DEBUG_FUNC_BEGIN("account_id [%d]", input_account_id);
-       int ret_code = EMF_ERROR_NONE, result_value = 0;
-
-       result_value = vconf_set_int(VCONF_KEY_DEFAULT_ACCOUNT_ID, input_account_id);
-       if (result_value < 0) {
-               EM_DEBUG_EXCEPTION("vconf_set_int failed [%d]", result_value);
-               ret_code = EMF_ERROR_SYSTEM_FAILURE;
-       }
-
-       EM_DEBUG_FUNC_END("ret_code [%d]", ret_code);
-       return ret_code;        
-}
-
-EXPORT_API int em_core_load_default_account_id(int *output_account_id)
-{
-       EM_DEBUG_FUNC_BEGIN("account_id [%p]", output_account_id);
-       int ret_code = EMF_ERROR_NONE, result_value = 0;
-       
-       if (output_account_id == NULL) {
-               ret_code = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-
-       result_value = vconf_get_int(VCONF_KEY_DEFAULT_ACCOUNT_ID, output_account_id);
-
-       if (result_value < 0) {
-               EM_DEBUG_EXCEPTION("vconf_get_int() failed [%d]", result_value);
-               ret_code = EMF_ERROR_SYSTEM_FAILURE;
-               *output_account_id = 0;
-       }
-
-FINISH_OFF: 
-       
-       EM_DEBUG_FUNC_END("ret_code [%d]", ret_code);
-       return ret_code;        
-}
diff --git a/email-core/em-core-api.c b/email-core/em-core-api.c
deleted file mode 100755 (executable)
index 4dfef10..0000000
+++ /dev/null
@@ -1,239 +0,0 @@
-/*\r
-*  email-service\r
-*\r
-* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
-*\r
-* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com>\r
-* \r
-* Licensed under the Apache License, Version 2.0 (the "License");\r
-* you may not use this file except in compliance with the License.\r
-* You may obtain a copy of the License at\r
-*\r
-* http://www.apache.org/licenses/LICENSE-2.0\r
-*\r
-* Unless required by applicable law or agreed to in writing, software\r
-* distributed under the License is distributed on an "AS IS" BASIS,\r
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-* See the License for the specific language governing permissions and\r
-* limitations under the License.\r
-*\r
-*/\r
-\r
-\r
-/******************************************************************************\r
- * File :  em-core-api.h\r
- * Desc :  Mail Engine API\r
- *\r
- * Auth : \r
- *\r
- * History : \r
- *    2006.08.16  :  created\r
- *****************************************************************************/\r
-#include <stdio.h>\r
-#include <string.h>\r
-#include <stdlib.h>\r
-\r
-#include "c-client.h"\r
-#include "em-core-global.h"\r
-#include "em-network.h"\r
-#include "em-core-event.h"\r
-#include "em-core-mailbox.h"\r
-#include "em-core-utils.h"\r
-#include "emf-dbglog.h"\r
-\r
-extern void *\r
-pop3_parameters(long function, void *value);\r
-extern void *\r
-imap_parameters(long function, void *value);\r
-\r
-/*\r
- * encoding base64\r
- */\r
-int em_core_encode_base64(char *src, unsigned long src_len, char **enc, unsigned long* enc_len, int *err_code)\r
-{\r
-       EM_DEBUG_FUNC_BEGIN();\r
-\r
-    unsigned char *content;\r
-    int ret = true, err = EMF_ERROR_NONE;\r
-\r
-       if (err_code != NULL) {\r
-               *err_code = EMF_ERROR_NONE;\r
-       }\r
-\r
-    content = rfc822_binary(src, src_len, enc_len);\r
-\r
-    if (content)\r
-        *enc = (char *)content;\r
-    else {\r
-        err = EMF_ERROR_UNKNOWN;\r
-        ret = false;\r
-    }\r
-\r
-    if (err_code)\r
-        *err_code = err;\r
-\r
-       EM_DEBUG_FUNC_END();\r
-    return ret;\r
-}\r
-\r
-/*\r
- * decoding quoted-printable\r
- */\r
-int em_core_decode_quotedprintable(unsigned char *enc_text, unsigned long enc_len, char **dec_text, unsigned long* dec_len, int *err_code)\r
-{\r
-    unsigned char *text = enc_text;\r
-    unsigned long size = enc_len;\r
-    unsigned char *content;\r
-    int ret = true, err = EMF_ERROR_NONE;\r
-\r
-       if (err_code != NULL) {\r
-               *err_code = EMF_ERROR_NONE;\r
-       }\r
-\r
-    EM_DEBUG_FUNC_BEGIN();\r
-\r
-    content = rfc822_qprint(text, size, dec_len);\r
-\r
-    if (content)\r
-        *dec_text = (char *)content;\r
-    else\r
-    {\r
-        err = EMF_ERROR_UNKNOWN;\r
-        ret = false;\r
-    }\r
-\r
-    if (err_code)\r
-        *err_code = err;\r
-\r
-    return ret;\r
-}\r
-\r
-/*\r
- * decoding base64\r
- */\r
-int em_core_decode_base64(unsigned char *enc_text, unsigned long enc_len, char **dec_text, unsigned long* dec_len, int *err_code)\r
-{\r
-    unsigned char *text = enc_text;\r
-    unsigned long size = enc_len;\r
-    unsigned char *content;\r
-    int ret = true, err = EMF_ERROR_NONE;\r
-\r
-       if (err_code != NULL) {\r
-               *err_code = EMF_ERROR_NONE;\r
-       }\r
-\r
-    EM_DEBUG_FUNC_BEGIN();\r
-\r
-    content = rfc822_base64(text, size, dec_len);\r
-    if (content)\r
-        *dec_text = (char *)content;\r
-    else\r
-    {\r
-        err = EMF_ERROR_UNKNOWN;\r
-        ret = false;\r
-    }\r
-\r
-    if (err_code)\r
-        *err_code = err;\r
-\r
-    return ret;\r
-}\r
-\r
-/**\r
-  * em_core_get_logout_status - Get the logout status\r
-  **/\r
-EXPORT_API void\r
-em_core_get_logout_status(int  *status)\r
-{\r
-       EM_DEBUG_FUNC_BEGIN();\r
-       int logout_status = 0;\r
-       *status = logout_status;\r
-       EM_DEBUG_LOG("em_core_get_logout_status is not implemented");\r
-       EM_DEBUG_FUNC_END("status [%d]", logout_status);\r
-}\r
-\r
-\r
-/**\r
-  * em_core_set_logout_status - Set the logout status\r
-  **/\r
-EXPORT_API void\r
-em_core_set_logout_status(int status)\r
-{\r
-       EM_DEBUG_FUNC_BEGIN();\r
-       EM_DEBUG_LOG("em_core_set_logout_status is not implemented");\r
-       EM_DEBUG_FUNC_END("status [%d] ", status);\r
-}\r
-\r
-#define EM_BATTERY_RECOVER_TEMP    6\r
-#define EM_BATTERY_ONLINE          1\r
-int _check_charger_status(int *charging_status, int *err_code)\r
-{\r
-       EM_DEBUG_FUNC_BEGIN("err_code[%p] ",  err_code);\r
-\r
-       int ret = false;\r
-       int err = EMF_ERROR_NONE;\r
-       int ps_value = 0;\r
-       \r
-       *charging_status = ps_value;\r
-\r
-       ret = true;\r
-\r
-       if (err_code != NULL)\r
-               *err_code = err;\r
-       EM_DEBUG_FUNC_END();\r
-       return ret;\r
-}\r
-\r
-EXPORT_API\r
-int em_low_battery_noti_init()\r
-{\r
-       EM_DEBUG_FUNC_BEGIN();\r
-       EM_DEBUG_LOG("Not implemented");\r
-       EM_DEBUG_FUNC_END();\r
-       return 0;\r
-}\r
-\r
-/* initialize mail core */\r
-EXPORT_API int em_core_init(int *err_code)\r
-{\r
-       EM_DEBUG_FUNC_BEGIN();\r
-\r
-       if (err_code != NULL) {\r
-               *err_code = EMF_ERROR_NONE;\r
-       }\r
-\r
-       mail_link(&imapdriver);  /*  link in the imap driver  */\r
-       mail_link(&pop3driver);  /*  link in the pop3 driver  */\r
-\r
-       mail_link(&unixdriver);  /*  link in the unix driver  */\r
-       mail_link(&dummydriver); /*  link in the dummy driver  */\r
-\r
-       ssl_onceonlyinit();\r
-\r
-       auth_link(&auth_md5);    /*  link in the md5 authenticator  */\r
-       auth_link(&auth_pla);    /*  link in the pla authenticator  */\r
-       auth_link(&auth_log);    /*  link in the log authenticator  */\r
-\r
-       /* Disabled to authenticate with plain text */\r
-       mail_parameters(NIL, SET_DISABLEPLAINTEXT, (void *) 2);\r
-\r
-       /* Set max trials for login */\r
-       imap_parameters(SET_MAXLOGINTRIALS, (void *)1);\r
-       pop3_parameters(SET_MAXLOGINTRIALS, (void *)1);\r
-       smtp_parameters(SET_MAXLOGINTRIALS, (void *)1);\r
-\r
-       mail_parameters(NIL, SET_SSLCERTIFICATEQUERY, (void *)em_core_ssl_cert_query_cb);\r
-       mail_parameters(NIL, SET_SSLCAPATH, (void *)SSL_CERT_DIRECTORY);\r
-\r
-       /* Set time out in second */\r
-       mail_parameters(NIL, SET_OPENTIMEOUT  , (void *)50);\r
-       mail_parameters(NIL, SET_READTIMEOUT  , (void *)180);\r
-       mail_parameters(NIL, SET_WRITETIMEOUT , (void *)180);\r
-       mail_parameters(NIL, SET_CLOSETIMEOUT , (void *)30);\r
-\r
-       if (err_code)\r
-               *err_code = EMF_ERROR_NONE;\r
-\r
-    return true;\r
-}\r
-\r
diff --git a/email-core/em-core-imap-idle.c b/email-core/em-core-imap-idle.c
deleted file mode 100755 (executable)
index 2d06c9a..0000000
+++ /dev/null
@@ -1,648 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-/**
- *
- * This file contains functinality related to IMAP IDLE.
- * to interact with Email Engine.
- * @file               em_core-imap-idle.c
- * @author     
- * @version    0.1
- * @brief              This file contains functionality to provide IMAP IDLE support in email-service. 
- */
-
-#include <em-core-types.h>
-
-#ifdef _FEATURE_IMAP_IDLE
-#include <pthread.h>
-#include <glib.h>
-#include <openssl/ssl.h>
-#include "c-client.h"
-#include "lnx_inc.h"
-#include "em-core-imap-idle.h"
-#include "emf-dbglog.h"
-#include "em-storage.h" 
-#include "em-network.h"
-#include "em-core-utils.h"
-#include "em-core-mailbox.h"
-#include "em-core-event.h"
-#include "em-core-account.h"
-
-static int idle_pipe[2] = {0, 0};
-
-static int wait_on_pipe(int *pipe_fd)
-{
-       fd_set rfds;
-       fd_set wfds;
-       struct timeval timeout_value;
-       int    ret_value;
-       
-       FD_ZERO(&rfds);
-       FD_ZERO(&wfds);
-       FD_SET(pipe_fd[0], &rfds);
-       
-       EM_DEBUG_LOG("wait...till dnet fills some data in pipe - %d", pipe_fd[0]);
-
-       /* timeout_value.tv_sec = 10; */ /*  10 seconds. */
-       timeout_value.tv_sec = 180; /*  160 + a seconds. */
-       timeout_value.tv_usec = 0; 
-       EM_DEBUG_LOG("wait_on_pipe()  :  timeout_value (%d) sec, (%d) usec", timeout_value.tv_sec, timeout_value.tv_usec);
-       
-       ret_value = select(pipe_fd[0]+1, &rfds, &wfds, NULL, &timeout_value);
-
-       switch (ret_value){
-               case 0:
-                       EM_DEBUG_LOG("wait_on_pipe()  :  select timer expired!!! ");
-                       break;
-               case -1:
-                       EM_DEBUG_LOG("wait_on_pipe()  :  There is an error on calling select. ");
-                       break;
-               default:
-                       EM_DEBUG_LOG("wait_on_pipe()  :  got response from DNET. ");
-                       break;
-       }
-       
-       return ret_value;
-}
-
-static int read_from_pipe(int *pipe_fd)
-{
-       int activation = 0;
-       
-       read(pipe_fd[0], &activation, sizeof(int));
-       
-       return activation;
-}
-
-static void write_to_pipe(int *pipe_fd, int result)
-{
-       write(pipe_fd[1], (char *)&result, sizeof(int)); 
-}
-
-
-static void _idle_thread_cm_evt_cb(const NetEventInfo_t *event)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       
-       /* This callback will be called when any event is recd from datacom */
-       
-       switch (event->Event) {
-               /* Response from Datacom for PDP Activation Request */
-               case NET_EVENT_OPEN_RSP: 
-                       if (event->Error == NET_ERR_NONE) {             /* Successful PDP Activation */
-                               EM_DEBUG_LOG("\t IMAP IDLE Successful PDP Activation");
-                               
-                               NetDevInfo_t devInfo;
-                               memset(&devInfo, 0x00, sizeof(devInfo));
-                               
-                               if (net_get_device_info(&devInfo) != NET_ERR_NONE) 
-                                       EM_DEBUG_EXCEPTION("\t net_get_device_info failed - %d", event->Error);
-                               write_to_pipe(idle_pipe, 1);
-                       }
-                       else {          /* PDP Activation failure */
-                               EM_DEBUG_EXCEPTION("\t PDP Activation Failure %d", event->Error);
-                               write_to_pipe(idle_pipe, 0);
-                       }
-                       break;
-               
-               /* Response from Datacom for PDP Dectivation Request */
-               case NET_EVENT_CLOSE_RSP: 
-                       if (event->Error == NET_ERR_NONE) {             /* Successful PDP Dectivation */
-                               EM_DEBUG_LOG("\t Successful PDP DeActivation");
-                               
-                               write_to_pipe(idle_pipe, 1);
-                       }
-                       else {          /* PDP Dectivation failure */
-                               EM_DEBUG_EXCEPTION("\t PDP DeActivation Failure %d", event->Error);
-                               
-                               if (event->Error == NET_ERR_TRANSPORT) 
-                                {
-                                       /*  TODO  :  add a process to deal an error */
-                                       /* NetCMGetTransportError(&err_code); */
-                               }
-                               
-                               write_to_pipe(idle_pipe, 0);
-                       }
-                       break;
-               
-               case NET_EVENT_CLOSE_IND: 
-                       EM_DEBUG_LOG("NET_EVENT_CLOSE_IND recieved");
-                       break;
-               
-               case NET_EVENT_KILL_RSP: 
-                       break;
-               
-               case NET_EVENT_SUSPEND_IND: 
-                       /*  TODO */
-                       /*  think over what can we do... */
-                       break;
-               
-               case NET_EVENT_RESUME_IND: 
-                       /*  TODO */
-                       /*  think over what can we do... */
-                       break;
-               
-               default: 
-                       break;
-       }
-}
-
-
-/*Definitions copied temperorily from ssl_unix.c */
-#define SSLBUFLEN 8192
-
-typedef struct ssl_stream {
-  TCPSTREAM *tcpstream;                /* TCP stream */
-  SSL_CTX *context;            /* SSL context */
-  SSL *con;                    /* SSL connection */
-  int ictr;                    /* input counter */
-  char *iptr;                  /* input pointer */
-  char ibuf[SSLBUFLEN];                /* input buffer */
-} SSLSTREAM;
-/*Definitions copied temperorily from ssl_unix.c - end*/
-
-thread_t imap_idle_thread = NULL;
-int g_imap_idle_thread_alive = 0;
-
-
-int em_core_imap_idle_thread_create(int accountID, int *err_code)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int ret = false;
-       int thread_error = -1;
-
-#ifdef ENABLE_IMAP_IDLE_THREAD         
-
-       g_imap_idle_thread_alive = 1;   
-       THREAD_CREATE(imap_idle_thread, em_core_imap_idle_run, NULL, thread_error);
-       if (thread_error != 0)
-       {
-               EM_DEBUG_EXCEPTION("cannot make IMAP IDLE thread...");
-               if (err_code != NULL) 
-                       *err_code = EMF_ERROR_UNKNOWN;
-               g_imap_idle_thread_alive = 0;   
-               goto FINISH_OFF;
-       }
-       
-       ret = true;
-FINISH_OFF: 
-
-#else /*  ENABLE_IMAP_IDLE_THREAD */
-       EM_DEBUG_LOG(">>>>>>>> DISABLED IMAP IDLE THREAD");
-#endif /*  ENABLE_IMAP_IDLE_THREAD */
-
-       return ret;
-}
-
-/*
-Need to identify various scenarios where thread needs to be killed
-1. After the timer set to 10 min expires.
-2. When No sim, thread is created and em_core_check_network_status() fails. 
-*/
-int em_core_imap_idle_thread_kill(int *err_code)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int ret = true;
-       int err = EMF_ERROR_NONE;
-       
-       EM_DEBUG_LOG(">>>>>>>>>>>>killing thread>>>>>>>>>");
-       
-       /* kill the thread */
-       EM_DEBUG_LOG(">>>>>>>>>Before g_thread_exit");
-       g_imap_idle_thread_alive = 0;
-       EM_DEBUG_LOG(">>>>>>>>>After g_thread_exit");
-
-       EM_DEBUG_LOG(">>>>>>>>>>>>>>>>>> Making imap idle NULL>>>>>>>>>>>>>>>>>");
-       imap_idle_thread = NULL;
-       EM_DEBUG_LOG(">>>>>>>>>>>>>>>>>> killed IMAP IDLE >>>>>>>>>>>>>>>>>");
-       if (err_code)
-               *err_code = err;
-       return ret;
-}
-
-
-
-int em_core_imap_idle_run(int accountID)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       char *mailbox_list[3]; /* Temperory - To be modified to char ***/
-       int mailbox_num = 0;
-       emf_mailbox_t *mail_box_list = NULL;
-       emf_mailbox_t *curr_mailbox = NULL;
-       emf_mailbox_t *prev_mailbox = NULL;
-       int counter = 0;
-       emf_mailbox_tbl_t *local_mailbox = NULL;
-       int err = EMF_ERROR_NONE;
-       int flag = true; 
-       int num = 0;
-       emf_session_t *session = NULL;
-       int ret = false;
-
-       if ( !em_core_check_network_status(&err)) {
-               EM_DEBUG_EXCEPTION("em_core_check_network_status failed [%d]", err);
-               return ret;
-       }
-       /* Connect to DB */
-       if (!em_storage_open(&err)) {
-               EM_DEBUG_EXCEPTION("\t em_storage_open falied - %d", err);
-               goto FINISH_OFF;
-       }
-
-       if (!em_core_get_empty_session(&session))  
-                       EM_DEBUG_EXCEPTION("\t em_core_get_empty_session failed...");
-       
-       /* get the list of mailbox name on which IDLE notifications are required. */
-       /* currently all INBOXES of all accounts need to be notified */
-       /* Dependent on GetMyIdentities for account names */
-
-       /* For testing - mailbox_num and mailbox_list are hardcoded here */
-       mailbox_num = 1;
-       mailbox_list[0] = EM_SAFE_STRDUP("INBOX");
-
-       /* make a list of mailboxes IDLING */
-       for (counter = 0; counter < mailbox_num; counter++){
-               EM_DEBUG_EXCEPTION(">>>> em_core_imap_idle_run 4 ");
-               if (!em_storage_get_mailbox_by_name(accountID, 0,  mailbox_list[counter], &local_mailbox, true, &err)) {
-                       EM_DEBUG_EXCEPTION("em_storage_get_mailbox_by_name failed - %d", err);
-               }
-
-               else {
-                       curr_mailbox = em_core_malloc(sizeof(emf_mailbox_t));
-
-                       curr_mailbox->account_id = local_mailbox->account_id;
-                       curr_mailbox->name = EM_SAFE_STRDUP(local_mailbox->mailbox_name);
-                       curr_mailbox->local = local_mailbox->local_yn;
-                       if (!em_core_imap_idle_connect_and_idle_on_mailbox(curr_mailbox, &err)) {
-                               EM_DEBUG_EXCEPTION("em_core_imap_idle_connect_and_idle_on_mailbox failed - %d", err);
-                               em_core_mailbox_free(&curr_mailbox, 1, NULL);
-                       }
-                       else {
-                               if (flag) {
-                                       mail_box_list = curr_mailbox;
-                                       prev_mailbox = curr_mailbox;
-                                       flag = false;
-                                       num++;
-                               }
-
-                               else {
-                                       prev_mailbox->next = curr_mailbox;
-                                       prev_mailbox = curr_mailbox;
-                                       num++;
-                               }
-                               
-                       }
-                       
-               }
-               if (local_mailbox != NULL)
-                       em_storage_free_mailbox(&local_mailbox, 1, NULL);
-
-       }
-
-       em_core_clear_session(session);
-
-       em_core_imap_idle_loop_start(mail_box_list, num, NULL);
-
-       EM_DEBUG_EXCEPTION("IMAP IDLE ");
-
-       ret = true;
-FINISH_OFF: 
-       if (!em_storage_close(&err)) {
-               EM_DEBUG_EXCEPTION("\t em_storage_close falied - %d", err);
-       }
-
-       return ret;
-       
-}
-
-int em_core_imap_idle_loop_start(emf_mailbox_t *mailbox_list,  int num, int *err_code)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       fd_set readfds;
-       int maxfd = 0;
-       int err = EMF_ERROR_NONE;
-       int counter = 0;
-       int select_result = 0;
-       int ret = false;
-       emf_mailbox_t *temp = NULL;
-       struct timeval timeout;
-
-       EM_DEBUG_EXCEPTION(">>>>>>> em_core_imap_idle_loop_start start ");
-       if (!mailbox_list || !num) {
-               EM_DEBUG_EXCEPTION("\t mailbox_list[%p], num[%d]", mailbox_list, num);
-               
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-
-       /* set timeout value to 10min */
-       timeout.tv_sec = 10 * 60;
-       timeout.tv_usec = 0;
-
-       /* IMAP IDLE LOOP */
-       while (1){
-               EM_DEBUG_EXCEPTION(">>>>>>>>>>>IDLING>>>>>>>>>>>>");
-               FD_ZERO(&readfds);
-               temp = mailbox_list;
-               for (counter = 0; counter < num; counter++) {
-                       FD_SET(temp->hold_connection, &readfds);
-                       if (temp->hold_connection > maxfd)
-                               maxfd = temp->hold_connection; 
-                       temp = temp->next;
-               }
-               maxfd++;
-               temp = mailbox_list;
-               
-               select_result = select(maxfd, &readfds, NULL, NULL, &timeout);
-
-               if (select_result > 0) /* Data coming on some socket */ {
-                       EM_DEBUG_EXCEPTION(">>>> Data Coming from Socket ");
-                       for (counter = 0; counter < num; counter++) {
-                               if (temp && FD_ISSET(temp->hold_connection, &readfds)) {
-                                       if (!em_core_imap_idle_parse_response_stream(temp, &err)) {
-                                               EM_DEBUG_EXCEPTION(">>>> em_core_imap_idle_loop_start 6 ");
-                                               em_core_mailbox_close(temp->account_id, temp->mail_stream);
-                                               EM_DEBUG_EXCEPTION(">>>> em_core_imap_idle_loop_start 7 ");
-                                               goto FINISH_OFF;
-                                       }
-                                       break; /* break for now - check if it is possible to get data on two sockets - shasikala.p */
-                               }
-                               temp = temp->next;
-                       }
-               }
-
-               else if (select_result == 0) /* Timeout occured */ {
-                       EM_DEBUG_EXCEPTION(">>>> em_core_imap_idle_loop_start 8 ");
-                       IMAPLOCAL *imap_local = NULL;
-                       char cmd[128], tag[32];
-                       char *p = NULL;
-                       /* send DONE Command */
-                       /* free all data here */
-                       for (counter = 0; counter < num; counter++) {
-                               EM_DEBUG_LOG(">>>> em_core_imap_idle_loop_start 9 ");
-                               if (temp && temp->mail_stream) {
-                                       imap_local = ((MAILSTREAM *)temp->mail_stream)->local;
-
-                                       sprintf(tag, "%08lx", 0xffffffff & (((MAILSTREAM *)temp->mail_stream)->gensym++));
-                                       sprintf(cmd, "%s DONE\015\012", tag);
-
-                                       if (!imap_local->netstream || !net_sout(imap_local->netstream, cmd, (int)strlen(cmd)))
-                                       {
-                                               EM_DEBUG_EXCEPTION("network error - failed to DONE on Mailbox - %s ", temp->name);
-                                       }
-                                       else {
-                                               while (imap_local->netstream) {
-                                               p = net_getline(imap_local->netstream);
-                                               EM_DEBUG_EXCEPTION("p =[%s]", p);
-                                                       em_core_mailbox_close(temp->account_id, temp->mail_stream);
-                                                       break;
-                                               }
-                                       }
-                               }
-               
-                               temp = temp->next;
-                       }
-                       
-                       
-                       /* kill idle thread */
-                       em_core_imap_idle_thread_kill(&err);
-                       break;
-               }
-
-               else {
-                       /*
-                       might happen that a socket desciptor passed to select got closed
-                       chack which got closed and make hold_connection 0
-                       */
-                       EM_DEBUG_EXCEPTION(">>>>>> socket desciptor error :  No Data ");
-                       break;
-               }
-
-               select_result = 0;
-       }
-
-       ret = true;
-
-       EM_DEBUG_LOG(">>>> em_core_imap_idle_loop_start 17  ");
-FINISH_OFF: 
-       if (err_code)
-               *err_code = err;
-       EM_DEBUG_EXCEPTION(">>>>>>> em_core_imap_idle_loop_start End ");
-       return ret;
-}
-
-
-int em_core_imap_idle_insert_sync_event(emf_mailbox_t *mailbox, int *err_code)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       
-       int ret = false;
-       int err = EMF_ERROR_NONE;
-       int handle;
-       
-       if (!mailbox || mailbox->account_id <= 0) {
-               EM_DEBUG_LOG("\t mailbox[%p]", mailbox);
-               
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-       emf_event_t event_data;
-       memset(&event_data, 0x00, sizeof(emf_event_t));
-
-       event_data.type = EMF_EVENT_SYNC_HEADER;
-       event_data.event_param_data_1 = mailbox ? EM_SAFE_STRDUP(mailbox->name)  :  NULL;
-       event_data.event_param_data_3 = NULL;
-       event_data.account_id = mailbox->account_id;
-                       
-       if (!em_core_insert_event(&event_data, &handle, &err)) {
-               EM_DEBUG_LOG("\t em_core_insert_event falied - %d", err);
-                               
-               /* err = EMF_ERROR_DB_FAILURE; */
-               goto FINISH_OFF;
-       }
-
-       ret = true;
-FINISH_OFF: 
-       if (err_code)
-               *err_code = err;
-       
-       return ret;
-}
-
-/* connects to given mailbox. send idle and returns socket id */
-int em_core_imap_idle_connect_and_idle_on_mailbox(emf_mailbox_t *mailbox, int *err_code)
-{
-       EM_DEBUG_FUNC_BEGIN();  
-       void *mail_stream = NULL;
-       char cmd[128], tag[32], *p;
-       int socket_id = 0;
-       int ret = 0;
-       int err = EMF_ERROR_NONE;
-       emf_account_t *ref_account = NULL;
-
-       /* NULL param check */
-       if (!mailbox) {
-               EM_DEBUG_EXCEPTION("\t mailbox[%p]", mailbox);
-               if (err_code)
-                       *err_code = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-
-       ref_account = em_core_get_account_reference(mailbox->account_id);
-       if (!ref_account) {
-               EM_DEBUG_EXCEPTION("\t em_core_get_account_reference failed - %d", mailbox->account_id);
-               
-               err = EMF_ERROR_INVALID_ACCOUNT;
-               goto FINISH_OFF;
-       }
-
-       /* Open connection to mailbox */
-       if (!em_core_mailbox_open(mailbox->account_id, mailbox->name, (void **)&mail_stream, &err) || !mail_stream) {
-               EM_DEBUG_EXCEPTION("\t em_core_mailbox_open failed - %d", err);
-               if (err_code)
-                       *err_code = err;
-               goto FINISH_OFF;
-       }
-
-       IMAPLOCAL *imap_local = ((MAILSTREAM *)mail_stream)->local;
-       NETSTREAM *net_stream = imap_local->netstream;
-       
-       /* check if ssl option is enabled on this account - shasikala.p */
-       TCPSTREAM *tcp_stream = NULL;
-       if (ref_account->use_security){
-       SSLSTREAM *ssl_stream = net_stream->stream;
-               tcp_stream = ssl_stream->tcpstream;
-       }
-       else{
-               tcp_stream = net_stream->stream;
-       }
-
-       /* Get Socket ID */
-       socket_id = ((TCPSTREAM *)tcp_stream)->tcpsi;
-
-       sprintf(tag, "%08lx", 0xffffffff & (((MAILSTREAM *)mail_stream)->gensym++));
-       sprintf(cmd, "%s IDLE\015\012", tag);
-
-       /* Send IDLE command */
-       if (!imap_local->netstream || !net_sout(imap_local->netstream, cmd, (int)strlen(cmd)))
-       {
-               EM_DEBUG_EXCEPTION("network error - failed to IDLE on Mailbox - %s ", mailbox->name);
-               if (err_code)
-                       *err_code = EMF_ERROR_IMAP4_IDLE_FAILURE;
-               goto FINISH_OFF;
-       }
-
-       /* Get the response for IDLE command */
-       while (imap_local->netstream){
-               p = net_getline(imap_local->netstream);
-               EM_DEBUG_LOG("p =[%s]", p);
-               if (!strncmp(p, "+", 1)) {
-                       ret = 1;
-                       break;
-               }
-               else if (!strncmp(p, "*", 1)) {
-                           EM_SAFE_FREE(p);
-                           continue;
-               }
-               else {
-                       ret = 0;
-                       break;
-               }
-    }
-       EM_SAFE_FREE(p); /* Prevent Defect - 18815 */
-
-FINISH_OFF: 
-       
-       if (ret)                /* IMAP IDLE - SUCCESS */{
-               mailbox->mail_stream = mail_stream;
-               mailbox->hold_connection = socket_id; /* holds connection continuosly on the given socket_id */
-       }
-       else
-               if (mail_stream) em_core_mailbox_close(mailbox->account_id, mail_stream);
-       return ret;
-}
-
-
-int em_core_imap_idle_parse_response_stream(emf_mailbox_t *mailbox, int *err_code)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int err = EMF_ERROR_NONE;
-       char *p = NULL;
-       int ret = false;
-       
-       /* NULL PARAM CHECK */
-       if (!mailbox) {
-               EM_DEBUG_EXCEPTION("\t mailbox[%p]", mailbox);
-               if (err_code)
-                       *err_code = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-       
-       IMAPLOCAL *imap_local = NULL;
-
-       if (!mailbox->mail_stream){
-               EM_DEBUG_EXCEPTION("mail_stream is NULL");
-               goto FINISH_OFF;
-       }               
-
-       imap_local = ((MAILSTREAM *)mailbox->mail_stream)->local;
-
-       if (!imap_local){
-               EM_DEBUG_EXCEPTION("imap_local is NULL");
-               goto FINISH_OFF;
-       }
-
-
-       while (imap_local->netstream){
-               p = net_getline(imap_local->netstream);
-               if (p && !strncmp(p, "*", 1)) {
-                       EM_DEBUG_LOG("p is [%s]", p);
-                       if (p+1 && p+2 && p+3 && p+4 && !strncmp(p+2, "BYE", 3)) {
-                               EM_DEBUG_LOG("BYE connection from server");
-
-                               EM_SAFE_FREE(p);
-                               goto FINISH_OFF;
-                       }
-                       else  { 
-                       if (!em_core_imap_idle_insert_sync_event(mailbox, &err))
-                               EM_DEBUG_EXCEPTION("Syncing mailbox %s failed with err_code - %d", mailbox->name, err);
-                               EM_SAFE_FREE(p);        
-                       break;
-               }
-                       
-                       
-               }
-               else if (p && (!strncmp(p, "+", 1))) {
-                       /* Bad response from server */
-                       EM_DEBUG_LOG("p is [%s]", p);
-                       EM_SAFE_FREE(p);
-                       break;
-               }
-               else {
-                       EM_DEBUG_LOG("In else part");
-                       break;
-               }
-       }
-
-       ret = true;
-FINISH_OFF: 
-       return ret;
-}
-#endif /*  _FEATURE_IMAP_IDLE */
diff --git a/email-core/em-storage/em-storage-noti.c b/email-core/em-storage/em-storage-noti.c
deleted file mode 100755 (executable)
index 52eceaa..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <time.h>
-#include <sys/types.h>
-
-#ifdef USE_POWERMGMT
-#include <App-manager.h>
-#endif
-
-#include "em-storage.h"
-#include "emf-dbglog.h"
-
-#define EMAIL_SERVICE_GCONF_DIR  "/Services/email-service"
-#define EMAIL_SERVICE_GCONF_MAIL_FULL "mail-full"
-
-
-#ifdef BACKUP_LCD_DIMMING_STATUS
-static GConfValue *g_gconf_backup_value = NULL;
-#endif
-
-
-
-#ifdef USE_POWERMGMT
-EXPORT_API int em_storage_power_management(int *error_code)
-{
-       EM_DEBUG_FUNC_BEGIN("err_code[%p]", error_code);
-       int err         = EM_STORAGE_ERROR_NONE;
-       int inst_id     = 0;
-
-       app_get_current_inst_id(&inst_id, &err);
-
-       if (AppMgrAppCommand(inst_id, APP_COMMAND_POWER_MGR, APPMGR_SET_PWRMGR_SYS_RUN_STATUS) < 0) {
-               EM_DEBUG_EXCEPTION("APPMGR_SET_PWRMGR_SYS_RUN_STATUS Failed");
-               return false;
-       }
-       EM_DEBUG_FUNC_END("APPMGR_SET_PWRMGR_SYS_RUN_STATUS Success");
-       
-
-       return true;
-}
-#endif
-
-EXPORT_API int em_storage_sleep_on_off(int on, int *error_code)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       return true;
-}
-
-EXPORT_API int em_storage_dimming_on_off(int on, int *error_code)
-{
-       EM_DEBUG_FUNC_BEGIN("on[%d], err_code[%p]", on, error_code);
-
-       em_storage_sleep_on_off(on, error_code);
-       
-       return true;
-}
diff --git a/email-core/em-storage/include/em-storage.h b/email-core/em-storage/include/em-storage.h
deleted file mode 100755 (executable)
index dd470c6..0000000
+++ /dev/null
@@ -1,1539 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-/******************************************************************************
- * File :  em-storage.h
- * Desc :  Mail Framework Storage Library Header
- *
- * Auth : 
- *
- * History : 
- *    2006.07.28  :  created
- *****************************************************************************/
-#ifndef __EM_STORAGE_H__
-#define __EM_STORAGE_H__
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
-
-#define __USE_UNIX98
-#define __USE_GNU
-
-#include "emf-types.h"
-#include "em-core-types.h"
-#include <sqlite3.h>
-
-
-#if !defined(EXPORT_API)
-#define EXPORT_API __attribute__((visibility("default")))
-#endif
-
-
-#define DB_PATH                    "/opt/dbspace"
-#define EMAIL_SERVICE_DB_FILE_PATH "/opt/dbspace/.email-service.db"
-
-#define EMAILPATH                                      DATA_PATH"/email"
-#define MAILHOME                                       DATA_PATH"/email/.emfdata"
-#define DIRECTORY_PERMISSION  0755
-
-
-#define MAILTEMP            "tmp"
-#define FIRST_ACCOUNT_ID    1
-
-
-#ifdef __FEATURE_BULK_DELETE_MOVE_UPDATE_REQUEST_OPTI__
-#define QUERY_SIZE          8192
-#define MAX_INTEGER_LENGTH  5  /*  32767 -> 5 bytes */
-
-typedef struct 
-{
-       int mail_id;
-       unsigned long server_mail_id;
-} emf_id_set_t;
-
-#endif /* __FEATURE_BULK_DELETE_MOVE_UPDATE_REQUEST_OPTI__ */
-
-
-typedef struct 
-{
-       int            account_bind_type;
-       char          *account_name;
-       int            receiving_server_type;
-       char          *receiving_server_addr;
-       char          *email_addr;
-       char          *user_name;
-       char          *password;
-       int            retrieval_mode;
-       int            port_num;
-       int            use_security;
-       int            sending_server_type;
-       char          *sending_server_addr;
-       int            sending_port_num;
-       int            sending_auth;
-       int            sending_security;
-       char          *sending_user;
-       char          *sending_password;
-       char          *display_name;
-       char          *reply_to_addr;
-       char          *return_addr;
-       int            account_id;
-       int            keep_on_server;
-       int            flag1;                     /*  Specifies the downloading option 0 is subject only, 1 is text body, 2 is normal. */
-       int            flag2;
-       int            pop_before_smtp;           /*  POP before SMTP Authentication   */
-       int            apop;                      /*  APOP authentication  */
-       char                        *logo_icon_path;            /*  Account logo icon  */
-       int            preset_account;            /*  Preset account or not  */
-       emf_option_t   options;                   /*  Specifies the Sending options  */
-       int            target_storage;            /*  Specifies the targetStorage. 0 is phone, 1 is MMC  */
-       int            check_interval;            /*  Specifies the check interval  */
-       int            my_account_id;             /*  Specifies accout id of my account */
-       int            index_color;               /*  index color in RGB */
-       int            sync_status;               /*  Sync Status */
-}
-emf_mail_account_tbl_t;
-
-typedef struct 
-{
-       int   account_id;      /*  MUST BE '0'  :  currently, only global rule supported. */
-       int   rule_id;
-       int   type;            /*  from/subject/body  */
-       char *value;
-       int   action_type;     /*  move/block/delete  */
-       char *dest_mailbox;    /*  destination mailbox  */
-       int   flag1;           /*  for rule ON/OFF */
-       int   flag2;           /*  For rule type INCLUDE/Exactly SAME AS */
-}
-emf_mail_rule_tbl_t;
-
-/* mail_box_tbl table entity */
-typedef struct 
-{
-       int                  mailbox_id;
-       int                  account_id;
-       int                  local_yn;
-       char                *mailbox_name;
-       emf_mailbox_type_e   mailbox_type;
-       char                *alias;
-       int                  sync_with_server_yn;      /*  whether mailbox is a sync IMAP mailbox */
-       int                  modifiable_yn;              /*  whether mailbox is able to be deleted/modified */
-       int                  unread_count;              /*  Removed. 16-Dec-2010, count unread mails at the moment it is required. not store in the DB */
-       int                  total_mail_count_on_local;  /*  Specifies the total number of mails in the mailbox in the local DB. count unread mails at the moment it is required. not store in the DB */
-       int                  total_mail_count_on_server;  /*  Specifies the total number of mails in the mailbox in the mail server */
-       int                  has_archived_mails;
-       int                  mail_slot_size;
-} emf_mailbox_tbl_t;
-
-/* mail_read_uid_tbl table entity */
-typedef struct 
-{
-       int     account_id;
-       char   *local_mbox;
-       int     local_uid;
-       char   *mailbox_name;   /*  server mailbox */
-       char   *s_uid;          /*  uid on server */
-       int     data1;          /*  rfc822 size */
-       char   *data2;
-       int     flag;           /*  rule id */
-       int     reserved;
-} emf_mail_read_mail_uid_tbl_t;
-
-typedef struct 
-{
-       int    mail_id;
-       int    account_id;
-       char  *mailbox_name;
-       int    mailbox_type;
-       char  *subject;
-       char  *datetime;                     /*  YYYYMMDDHHMMSS */
-       int    server_mail_status;
-       char  *server_mailbox_name;
-       char  *server_mail_id;
-       char  *message_id;             
-       char  *full_address_from;
-       char  *full_address_reply;
-       char  *full_address_to;
-       char  *full_address_cc;
-       char  *full_address_bcc;
-       char  *full_address_return;
-       char  *email_address_sender;
-       char  *email_address_recipient;
-       char  *alias_sender;
-       char  *alias_recipient;
-       int    body_download_status;
-       char  *file_path_plain;       
-       char  *file_path_html;        
-       int    mail_size;
-       char   flags_seen_field;
-       char   flags_deleted_field;
-       char   flags_flagged_field;
-       char   flags_answered_field;
-       char   flags_recent_field;
-       char   flags_draft_field;
-       char   flags_forwarded_field;
-       int    DRM_status;
-       int    priority;    
-       int    save_status;    
-       int    lock_status;    
-       int    report_status;      
-       int    attachment_count;   
-       int    inline_content_count;   
-       int    thread_id;
-       int    thread_item_count;
-       char  *preview_text;           
-       int    meeting_request_status;
-} emf_mail_tbl_t;
-
-/* mail_attachment_tbl entity */
-typedef struct 
-{
-       int   attachment_id;
-       char *attachment_name;
-       char *attachment_path;
-       int   attachment_size;
-       int   mail_id;
-       int   account_id;
-       char *mailbox_name;
-       int   file_yn;
-       int   flag1;            /*  drm 1 */
-       int   flag2;            /*  drm 2 */
-       int   flag3;            /*  inline content status */
-#ifdef __ATTACHMENT_OPTI__     
-       int encoding;
-       char *section;  
-#endif 
-} emf_mail_attachment_tbl_t;
-
-/* mail_contact_sync_tbl table entity */
-typedef struct 
-{
-       char *contact_name;
-       char *email_address[15];
-       int storage_type;
-       int contact_id;
-} emf_mail_contact_sync_tbl_t;
-
-typedef enum {
-       RETRIEVE_ALL = 1,           /*  mail */
-       RETRIEVE_ENVELOPE,          /*  mail envelope */
-       RETRIEVE_SUMMARY,           /*  mail summary */
-       RETRIEVE_FIELDS_FOR_DELETE, /*  account_id, mail_id, server_mail_yn, server_mailbox, server_mail_id */
-       RETRIEVE_ACCOUNT,           /*  account_id */
-       RETRIEVE_FLAG,              /*  mailbox, flag1, thread_id */
-       RETRIEVE_ID,                /*  mail_id */
-       RETRIEVE_ADDRESS,           /*  mail_id, contact_info */
-} emf_mail_field_type_t;
-
-typedef enum {
-       EMF_CONTACT_TYPE_FROM = 1, 
-       EMF_CONTACT_TYPE_TO, 
-       EMF_CONTACT_TYPE_CC, 
-       EMF_CONTACT_TYPE_BCC, 
-       EMF_CONTACT_TYPE_REPLY, 
-       EMF_CONTACT_TYPE_RETURN, 
-} emf_mail_contact_type_t;
-
-typedef struct _emf_mail_search_t {
-       char *key_type;
-       char *key_value;
-       struct _emf_mail_search_t *next;
-}
-emf_mail_search_t;
-
-typedef enum {
-       EMF_CREATE_DB_NORMAL = 0, 
-       EMF_CREATE_DB_CHECK, 
-}
-emf_create_db_t;
-
-typedef enum {
-       SET_TYPE_SET        = 1,
-       SET_TYPE_UNION      = 2,
-       SET_TYPE_MINUS      = 3, 
-       SET_TYPE_INTERSECT  = 4 /* Not supported */
-} emf_set_type_t;
-
-
-/*****************************************************************************/
-/*  Errors                                                                   */
-/*****************************************************************************/
-#define EM_STORAGE_ERROR_NONE                     1           /*  There is no error. */
-#define EM_STORAGE_ERROR_INVALID_PARAM            2001        /*  The parameter is invalid. */
-#define EM_STORAGE_ERROR_ACCOUNT_NOT_FOUND        2002        /*  The expected account is not found. */
-#define EM_STORAGE_ERROR_MAIL_NOT_FOUND           2003        /*  The expected mail is not found. */
-#define EM_STORAGE_ERROR_MAILBOX_NOT_FOUND        2004        /*  The expected mailbox is not found. */
-#define EM_STORAGE_ERROR_ATTACHMENT_NOT_FOUND     2005        /*  The expected attachment is not found. */
-#define EM_STORAGE_ERROR_RULE_NOT_FOUND           2006        /*  The expected rule is not found. */
-#define EM_STORAGE_ERROR_CONTACT_NOT_FOUND        2007        /*  The expected contact is not found. */
-#define EM_STORAGE_ERROR_FILE_NOT_FOUND           2008        /*  The expected file is not found. */
-#define EM_STORAGE_ERROR_DATA_NOT_FOUND           2009        /*  The expected data is not found. */
-#define EM_STORAGE_ERROR_NO_MORE_DATA             2010        /*  There is no more data. */
-#define EM_STORAGE_ERROR_DATA_TOO_LONG            2011        /*  The data is too long. */
-#define EM_STORAGE_ERROR_DATA_TOO_SMALL           2012        /*  The data is too short. */
-#define EM_STORAGE_ERROR_OUT_OF_MEMORY            2013        /*  The system is out of memory. */
-#define EM_STORAGE_ERROR_CONNECTION_FAILURE       2014        /*  The agent fails to connect to server. */
-#define EM_STORAGE_ERROR_SYSTEM_FAILURE           2015        /*  There is a system error. */
-#define EM_STORAGE_ERROR_DB_IS_FULL               2017        /*  The db memory is full. */
-#define EM_STORAGE_ERROR_MAIL_MAX_COUNT           2016        /*  there is a max count error. */
-#define EM_STORAGE_ERROR_DB_FAILURE               2018        /*  EDB operation failure */
-#define EM_STORAGE_ERROR_ALREADY_EXISTS           2019
-#define EM_STORAGE_ERROR_MMC_NOT_FOUND            2020
-#define EM_STORAGE_ERROR_UNKNOWN                  8000        /*  There is a unknown error. */
-
-/*****************************************************************************
-                                                               etc
-*****************************************************************************/
-#define EM_STORAGE_MAIL_MAX                       5000
-#define        EM_STORAGE_LIMITATION_FREE_SPACE          (5) /*  This value is 5MB */
-#define MAX_PW_FILE_NAME_LENGTH                   128 /*  password file name for secure storage */
-
-#ifdef __LOCAL_ACTIVITY__
-
-typedef enum
-{
- ACTIVITY_FETCHIMAPFOLDER = 1,  /* Fetch Mail server Activity */
- ACTIVITY_DELETEMAIL,                  /* Delete Mail Activity */              
- ACTIVITY_MODIFYFLAG,                  /* Modify Mail flag Activity */         
- ACTIVITY_MODIFYSEENFLAG,              /* Modify Mail seen flag Activity */
- ACTIVITY_MOVEMAIL,                            /* Move Mail Activity */
- ACTIVITY_DELETEALLMAIL,               /* Delete All Mails activity */
- ACTIVITY_COPYMAIL,                            /* Copy Mail Activity */
- ACTIVITY_SAVEMAIL,                            /* Save Mail activity */
- ACTIVITY_DELETEMAIL_SEND,             /* New Delete Mail Activity added to be processed by send thread */
-}eActivity_type;
-
-
-/**
- * emf_activity_tbl_t - Email Local activity Structure
- *
- */
-typedef struct
-{
-       int activity_id;                                /* Activity ID */
-       int account_id;                          /* Account ID */
-       int mail_id;                             /* Mail ID    */
-       int activity_type;    /* Local Activity Type */
-       char *server_mailid;                 /* Server Mail ID or Mailbox name */
-       char *src_mbox;                          /* Source Mailbox in case of mail_move */      
-       char *dest_mbox;                 /* Destination Mailbox name in case of Mail move operation */
-
-} emf_activity_tbl_t;
-
-#endif
-
-EXPORT_API int em_storage_shm_file_init(const char *shm_file_name);
-
-
-/************** Database Management ***************/
-/*
- * em_db_open
- * description  :  open db and register busy handler
- */
-EXPORT_API int em_db_open(sqlite3 **sqlite_handle, int *err_code);
-
-/*
- * em_storage_db_open
- *
- * description :  open db and set global variable sqlite_emmb 
- * arguments : 
- * return  : 
- */
-EXPORT_API sqlite3* em_storage_db_open(int *err_code);
-
-/*
- * em_storage_db_close
- *
- * description :  close db with global variable sqlite_emmb
- * arguments : 
- * return  : 
- */
-EXPORT_API int em_storage_db_close(int *err_code);
-
-/*
- * em_storage_open
- *
- * description :  initialize storage manager
- * arguments : 
- * return  : 
- */
-EXPORT_API int em_storage_open(int *err_code);
-
-/*
- * em_storage_close
- *
- * description :  cleanup storage manager
- * arguments : 
- * return  : 
- */
-EXPORT_API int em_storage_close(int *err_code);
-
-/*
- * em_storage_create_table
- *
- * description :  create account/address table in database.
- * arguments : 
- * return  : 
- */
-EXPORT_API int em_storage_create_table(emf_create_db_t type, int *err_code);
-
-
-/**
- * Check whether there is the same account information in the db
- *
- * @param[in] account  account that 
- * @param[in] transaction      If the argument is true, engine commits transaction or executes rollback.
- * @param[out] err_code        Error code.
- * @remarks N/A
- * @return This function returns true if there is no duplicated account. returns false and set error code if there are duplicated accounts or error 
- */
-EXPORT_API int em_storage_check_duplicated_account(emf_account_t *account, int transaction, int *err_code);
-
-
-/**
- * Get number of accounts from account table.
- *
- * @param[out] count           The number of accounts is saved here.
- * @param[in] transaction      If the argument is true, engine commits transaction or executes rollback.
- * @remarks N/A
- * @return This function returns 0 on success or error code on failure.
- */
-EXPORT_API int em_storage_get_account_count(int *count, int transaction, int *err_code);
-
-/**
- * Get account from account table.
- *
- * @param[in, out] select_num  Upon entry, the argument contains the number of accounts to select.
-                                   Upon exit, it is set to the number of accounts to been selected.
- * @param[out] account_list            The selected accounts is saved here. this pointer must be freed after being used.
- * @param[in] transaction              If the argument is true, engine commits transaction or executes rollback.
- * @remarks N/A
- * @return This function returns 0 on success or error code on failure.
- */
-EXPORT_API int em_storage_get_account_list(int *select_num, emf_mail_account_tbl_t **account_list, int transaction, int with_password, int *err_code);
-
-/*
- * em_storage_get_account_by_name
- *
- * description :  get account from account table by account name
- * arguments : 
- *    db  :  database pointer
- *    account_id  :  account id
- *    pulloption  :  option to specify fetching full or partial data
- *    account  :  buffer to hold selected account
- *              this buffer must be free after it has been used.
- * return  : 
- */
-/* sowmya.kr, 281209 Adding signature to options in emf_account_t changes */
-
-EXPORT_API int em_storage_get_account_by_id(int account_id, int pulloption, emf_mail_account_tbl_t **account, int transaction, int *err_code);
-
-
-/*
- * em_storage_get_password_length_of_account
- *
- * description: get password length of account.
- * arguments:
- *    account_id : account id
- *    password_length : password length
- * return :
- */
-
-EXPORT_API int em_storage_get_password_length_of_account(int account_id, int *password_length, int* err_code);
-
-/*
- * em_storage_update_account
- *
- * description :  change a account from account table
- * arguments : 
- *    account_id  :  account id
- *    account  :  buffer to hold selected account
- * return  : 
- */
-EXPORT_API int em_storage_update_account(int account_id, emf_mail_account_tbl_t *account, int transaction, int *err_code);
-
-/*
- * em_storage_get_sync_status_of_account
- *
- * description :  get a sync status field from account table
- * arguments : 
- *    account_id  :  account id
- *    result_sync_status : sync status value
- * return  : 
- */
-
-EXPORT_API int em_storage_get_sync_status_of_account(int account_id, int *result_sync_status,int *err_code);
-
-/*
- * em_storage_update_sync_status_of_account
- *
- * description :  update a sync status field from account table
- * arguments : 
- *    account_id  :  account id
- *    set_operator  :  set operater. refer emf_set_type_t
- *    sync_status : sync status value
- * return  : 
- */
-
-EXPORT_API int em_storage_update_sync_status_of_account(int account_id, emf_set_type_t set_operator, int sync_status, int transaction, int *err_code);
-
-/*
- * em_storage_add_account
- *
- * description :  add a account to account table
- * arguments : 
- * return  : 
- */
-EXPORT_API int em_storage_add_account(emf_mail_account_tbl_t *account, int transaction, int *err_code);
-
-/*
- * em_storage_delete_account
- *
- * description :  delete a account from account table
- * arguments : 
- *    db  :  database pointer
- *    account_id  :  account id to be deteted
- * return  : 
- */
-EXPORT_API int em_storage_delete_account(int account_id, int transaction, int *err_code);
-
-/*
- * em_storage_free_account
- *
- * description :  free local accout memory
- * arguments : 
- *    account_list  :  double pointer
- *    count  :  count of local account
- * return  : 
- */
-EXPORT_API int em_storage_free_account(emf_mail_account_tbl_t **account_list, int count, int *err_code);
-
-
-/************** Mailbox(Local box And Imap mailbox) Management ******************/
-
-/*
- * em_storage_get_mailbox_count
- *
- * description :  get number of mailbox from local mailbox table
- * arguments : 
- *    db  :  database pointer
- *    count  :  number of accounts
- * return  : 
- */
-EXPORT_API int em_storage_get_mailbox_count(int account_id, int local_yn, int *count, int transaction, int *err_code);
-
-/*
- * em_storage_get_mailbox
- *
- * description :  get local mailbox from local mailbox table
- * arguments : 
- *    db  :  database pointer
- *    sort_type         :      in - sorting type.
- *    select_num        :      in - number of selected account
- *                             out - number to been selected
- *    mailbox_list      :      buffer to hold selected account
- *                     this buffer must be free after it has been used.
- * return  : 
- */
-EXPORT_API int em_storage_get_mailbox(int account_id, int local_yn, email_mailbox_sort_type_t sort_type, int *select_num, emf_mailbox_tbl_t **mailbox_list,  int transaction, int *err_code);
-
-/*
- * em_storage_get_child_mailbox_list
- *
- * description :  get child mailbox list  from given  mailbox 
- * arguments : 
- *    account_id  :  in - account id
- *    parent_mailbox_name  :  in - parent_mailbox_name to fetch child list
- *    local_yn - in - local mailbox or not
- *    select_num - out   :  count of mailboxes
- *    mailbox_list - out  :    list of mailboxes        
- *    err_code - out  :  error code, if any
- */
-
-
-EXPORT_API int em_storage_get_child_mailbox_list(int account_id, char *parent_mailbox_name, int *select_num, emf_mailbox_tbl_t **mailbox_list, int transaction, int *err_code);
-
-/*
- * em_storage_get_mailbox_by_name
- *
- * description :  get local mailbox from local mailbox table by mailbox name
- * arguments : 
- *    db  :  database pointer
- *    mailbox_name  :  mailbox name
- *    mailbox  :  buffer to hold selected local mailbox
- *              this buffer must be free after it has been used.
- * return  : 
- */
-EXPORT_API int em_storage_get_mailbox_by_name(int account_id, int local_yn, char *mailbox_name, emf_mailbox_tbl_t **mailbox, int transaction, int *err_code);
-EXPORT_API int em_storage_get_mailbox_ex(int account_id, int local_yn, int with_count, int *select_num, emf_mailbox_tbl_t **mailbox_list, int transaction, int *err_code);
-EXPORT_API int em_storage_get_mailbox_by_mailbox_type(int account_id, emf_mailbox_type_e mailbox_type, emf_mailbox_tbl_t **mailbox, int transaction, int *err_code);
-EXPORT_API int em_storage_get_mailboxname_by_mailbox_type(int account_id, emf_mailbox_type_e mailbox_type, char **mailbox, int transaction, int *err_code);
-
-EXPORT_API int em_storage_update_mailbox_modifiable_yn(int account_id, int local_yn, char *mailbox_name, int modifiable_yn, int transaction, int *err_code);
-EXPORT_API int em_storage_update_mailbox_total_count(int account_id, char *mailbox_name, int total_count_on_server, int transaction, int *err_code);
-
-
-/*
- * em_storage_update_mailbox
- *
- * description :  change a account from account table
- * arguments : 
- *    db  :  database pointer
- *    mailbox_name  :  mailbox name
- *    mailbox  :  buffer to hold selected local mailbox
- * return  : 
- */
-EXPORT_API int em_storage_update_mailbox(int account_id, int local_yn, char *mailbox_name, emf_mailbox_tbl_t *mailbox, int transaction, int *err_code);
-
-/*
- * em_storage_update_mailbox_type
- *
- * description :  change a mailbox from mailbox tbl
- * arguments : 
- * return  : 
- */
-EXPORT_API int em_storage_update_mailbox_type(int account_id, int local_yn, char *mailbox_name, emf_mailbox_tbl_t *mailbox, int transaction, int *err_code);
-
-/*
- * em_storage_add_mailbox
- *
- * description :  add a local mailbox to local mailbox table
- * arguments : 
- * return  : 
- */
-EXPORT_API int em_storage_add_mailbox(emf_mailbox_tbl_t *mailbox, int transaction, int *err_code);
-
-/*
- * em_storage_delete_mailbox
- *
- * description :  delete a local mailbox from local mailbox table
- * arguments : 
- *    db  :  database pointer
- *    mailbox_name  :  mailbox name of record to be deteted
- * return  : 
- */
-EXPORT_API int em_storage_delete_mailbox(int account_id, int local_yn, char *mailbox_name, int transaction, int *err_code);
-
-EXPORT_API int em_storage_rename_mailbox(int account_id, char *old_mailbox_name, char *new_mailbox_name, int transaction, int *err_code);
-EXPORT_API int em_storage_get_overflowed_mail_id_list(int account_id, char *mailbox_name, int mail_slot_size, int **mail_id_list, int *mail_id_count, int transaction, int *err_code);
-EXPORT_API int em_storage_set_mail_slot_size(int account_id, char *mailbox_name, int new_slot_size, int transaction, int *err_code);
-
-EXPORT_API int em_storage_set_all_mailbox_modifiable_yn(int account_id, int modifiable_yn, int transaction, int *err_code);
-EXPORT_API int em_storage_get_mailbox_by_modifiable_yn(int account_id, int modifiable_yn, int *select_num, emf_mailbox_tbl_t **mailbox_list, int transaction, int *err_code);
-
-/*
- * em_storage_free_mailbox
- *
- * description :  free local mailbox memory
- * arguments : 
- *    mailbox_list  :  double pointer
- *    count  :  count of local mailbox
- * return  : 
- */
-EXPORT_API int em_storage_free_mailbox(emf_mailbox_tbl_t **mailbox_list, int count, int *err_code);
-
-
-/************** Read Mail UID Management ******************/
-
-
-
-EXPORT_API int em_storage_get_count_read_mail_uid(int account_id, char *mailbox_name, int *count, int transaction, int *err_code);
-
-
-/*
- * em_storage_check_read_mail_uid
- *
- * description :  check that this uid exists in uid table
- * arguments : 
- *    db  :  database pointer
- *    mailbox_name  :  mailbox name
- *    s_uid  :  uid string to be checked
- *    exist  :  variable to hold checking result. (0 : not exist, 1 : exist)
- * return  : 
- */
-EXPORT_API int em_storage_check_read_mail_uid(int account_id, char *mailbox_name, char *uid, int *exist, int transaction, int *err_code);
-
-/*
- * em_storage_get_read_mail_size
- *
- * description :  get mail size from read mail uid
- * arguments : 
- *    db  :  database pointer
- *    local_mbox  :  local mailbox name
- *    local_uid  :  mail uid of local mailbox
- *    mailbox_name  :  server mailbox name
- *    uid  :  mail uid string of server mail
- *    read_mail_uid  :  variable to hold read mail uid information
- * return  : 
- */
-EXPORT_API int em_storage_get_downloaded_list(int account_id, char *local_mbox, emf_mail_read_mail_uid_tbl_t **read_mail_uid, int *count, int transaction, int *err_code);
-
-EXPORT_API int em_storage_get_downloaded_mail(int mail_id, emf_mail_tbl_t **mail, int transaction, int *err_code);
-
-/*
- * em_storage_get_read_mail_size
- *
- * description :  get mail size from read mail uid
- * arguments : 
- *    db  :  database pointer
- *    mailbox_name  :  mailbox name
- *    s_uid  :  mail uid string
- *    size  :  variable to hold mail size
- * return  : 
- */
-EXPORT_API int em_storage_get_downloaded_mail_size(int account_id, char *local_mbox, int local_uid, char *mailbox_name, char *uid, int *mail_size, int transaction, int *err_code);
-
-/*
- * em_storage_add_downloaded_mail
- *
- * description :  add read mail uid
- * arguments : 
- * return  : 
- */
-EXPORT_API int em_storage_add_downloaded_mail(emf_mail_read_mail_uid_tbl_t *read_mail_uid, int transaction, int *err_code);
-
-/*
- * em_storage_change_read_mail_uid
- *
- * description :  modify read mail uid
- * arguments : 
- * return  : 
- */
-EXPORT_API int em_storage_change_read_mail_uid(int account_id, char *local_mbox, int local_uid, char *mailbox_name, char *uid, 
-                                    emf_mail_read_mail_uid_tbl_t *read_mail_uid, int transaction, int *err_code);
-
-/*
- * em_storage_remove_downloaded_mail
- *
- * description :  
- * arguments : 
- * return  : 
- */
-EXPORT_API int em_storage_remove_downloaded_mail(int account_id, char *mailbox_name, char *uid, int transaction, int *err_code);
-
-
-EXPORT_API int em_storage_update_read_mail_uid(int mail_id, char *new_server_uid, char *mbox_name, int *err_code);
-
-/*
- *  free memroy
- */
-EXPORT_API int em_storage_free_read_mail_uid(emf_mail_read_mail_uid_tbl_t **read_mail_uid, int count, int *err_code);
-
-
-
-/************** Rules(Filtering) Management ******************/
-
-/*
- * em_storage_get_rule_count
- *
- * description :  get number of rules from rule table
- * arguments : 
- *    db  :  database pointer
- *    count  :  number of accounts
- * return  : 
- */
-EXPORT_API int em_storage_get_rule_count(int account_id, int *count, int transaction, int *err_code);
-
-/*
- * em_storage_get_rule
- *
- * description :  get rules from rule table
- * arguments : 
- *    db  :  database pointer
- *    start_idx  :  the first index to be selected (min : 0)
- *    select_num  :  in - number of selected account
- *                 out - number to been selected
- *    is_completed  :  is completed ? 
- * return  : 
- */
-EXPORT_API int em_storage_get_rule(int account_id, int type, int start_idx, int *select_num, int *is_completed, emf_mail_rule_tbl_t **rule_list, int transaction, int *err_code);
-
-/*
- * em_storage_get_rule
- *
- * description :  get rules from rule table
- * arguments : 
- * return  : 
- */
-EXPORT_API int em_storage_get_rule_by_id(int account_id, int rule_id, emf_mail_rule_tbl_t **rule, int transaction, int *err_code);
-
-/*
- * em_storage_change_rule
- *
- * description :  change a account from account table
- * arguments : 
- *    db  :  database pointer
- *    mailbox_name  :  mailbox name
- *    rule  :  buffer to hold selected rule
- * return  : 
- */
-EXPORT_API int em_storage_change_rule(int account_id, int rule_id, emf_mail_rule_tbl_t *rule, int transaction, int *err_code);
-
-/*
- * em_storage_find_rule
- *
- * description :  find a rule already exists
- * arguments : 
- * return  : 
- */
-EXPORT_API int em_storage_find_rule(emf_mail_rule_tbl_t *rule, int transaction, int *err_code);
-
-/*
- * em_storage_add_rule
- *
- * description :  add a rule to rule table
- * arguments : 
- * return  : 
- */
-EXPORT_API int em_storage_add_rule(emf_mail_rule_tbl_t *rule, int transaction, int *err_code);
-
-/*
- * em_storage_delete_rule
- *
- * description :  delete a rule from rule table
- * arguments : 
- *    db  :  database pointer
- *    rule  :  rule to be deteted
- * return  : 
- */
-EXPORT_API int em_storage_delete_rule(int account_id, int rule_id, int transaction, int *err_code);
-
-/*
- * em_storage_free_rule
- *
- * description :  free rule memory
- * arguments : 
- *    count  :  count of rule
- * return  : 
- */
-EXPORT_API int em_storage_free_rule(emf_mail_rule_tbl_t **rule_list, int count, int *err_code);
-
-
-EXPORT_API int em_storage_filter_mails_by_rule(int account_id, char *dest_mailbox_name, emf_mail_rule_tbl_t *rule, int **filtered_mail_id_list, int *count_of_mails, int *err_code);
-
-/************** Mail Management ******************/
-
-/*
- * em_storage_get_mail_count
- *
- * description :  get mail total and unseen count from mail table
- * arguments : 
- *    total  :  total count
- *    unseen  :  unseen mail count
- * return  : 
- */
-EXPORT_API int em_storage_get_mail_count(int account_id, const char *mailbox, int *total, int *unseen, int transaction, int *err_code);
-
-/*
- * em_storage_get_mail_by_id
- *
- * description :  get mail from mail table by mail id
- * arguments : 
- *    mail_id  :  mail id
- *    mail  :  double pointer to hold mail
- * return  : 
- */
-EXPORT_API int em_storage_get_mail_by_id(int mail_id, emf_mail_tbl_t **mail, int transaction, int *err_code);
-
-/*
- * em_storage_get_mail
- *
- * description :  get mail from mail table by mail sequence
- * arguments : 
- *    account_id  :  account id
- *    mailbox  :  mailbox name
- *    mail_no  :  mail sequence number (not mail id)
- *    mail  :  double pointer to hold mail
- * return  : 
- */
-EXPORT_API int em_storage_get_mail_field_by_id(int mail_id, int type, emf_mail_tbl_t **mail, int transaction, int *err_code);
-
-/*
- * em_storage_get_mail_field_by_multiple_mail_id
- *
- * description :  
- * arguments : 
- *    mail_ids  : 
- *    number_of_mails  :  
- *    type  :  
- *    mail  :  
- *    transaction :
- *    err_code :
- * return  : 
- */
-EXPORT_API int em_storage_get_mail_field_by_multiple_mail_id(int mail_ids[], int number_of_mails, int type, emf_mail_tbl_t** mail, int transaction, int *err_code);
-
-/*
- * em_storage_query_mail_list
- *
- * description :  query mail list information
- */
-EXPORT_API int em_storage_query_mail_list(const char *conditional_clause, int transaction, emf_mail_list_item_t** result_mail_list,  int *result_count,  int *err_code);
-
-/*
- * em_storage_query_mail_tbl
- *
- * description :  query mail table information
- */
-EXPORT_API int em_storage_query_mail_tbl(const char *conditional_clause, int transaction, emf_mail_tbl_t** result_mail_tbl, int *result_count, int *err_code);
-
-/*
- * em_storage_get_mail_list
- *
- * description :  search mail list information
- */
-EXPORT_API int em_storage_get_mail_list(int account_id, const char *mailbox_name, emf_email_address_list_t* addr_list, int thread_id, int start_index, int limit_count, int search_type, const char *search_value, emf_sort_type_t sorting, int transaction, emf_mail_list_item_t** mail_list,  int *result_count,  int *err_code);
-/*
- * em_storage_get_mails
- *
- * description :  search mail list information
- */
-EXPORT_API int em_storage_get_mails(int account_id, const char *mailbox_name, emf_email_address_list_t* addr_list, int thread_id, int start_index, int limit_count, emf_sort_type_t sorting,  int transaction, emf_mail_tbl_t** mail_list, int *result_count, int *err_code);
-EXPORT_API int em_storage_get_searched_mail_list(int account_id, const char *mailbox_name, int thread_id, int search_type, const char *search_value, int start_index, int limit_count, emf_sort_type_t sorting, int transaction, emf_mail_list_item_t **mail_list,  int *result_count,  int *err_code);
-EXPORT_API int em_storage_get_maildata_by_servermailid(int account_id, char *server_mail_id, emf_mail_tbl_t **mail, int transaction, int *err_code);
-EXPORT_API int em_storage_get_latest_unread_mailid(int account_id, int *mail_id, int *err_code);
-
-
-/**
- * Prepare mail search.
- *
- * @param[in] search                   Specifies the searching condition.
- * @param[in] account_id               Specifies the account id. if 0, all accounts.
- * @param[in] mailbox                  Specifies the mailbox name. if NULL, all mailboxes.
- * @param[in] sorting                  Specifies the sorting condition.
- * @param[out] search_handle   the searching handle is saved here.
- * @param[out] searched                        the result count is saved here.
- * @remarks N/A
- * @return This function returns 0 on success or error code on failure.
- */
-EXPORT_API int em_storage_mail_search_start(emf_mail_search_t *search, int account_id, char *mailbox, int sorting, int *search_handle, int *searched, int transaction, int *err_code);
-
-/*
- * em_storage_mail_search_result
- *
- * description :  retrieve mail as searching result
- * arguments : 
- *    search_handle  :  handle to been gotten from em_storage_mail_search_start
- *    mail  :  double pointer to hold mail
- * return  : 
- */
-EXPORT_API int em_storage_mail_search_result(int search_handle, emf_mail_field_type_t type, void **data, int transaction, int *err_code);
-
-/*
- * em_storage_mail_search_end
- *
- * description :  finish searching
- * arguments : 
- *    search_handle  :  handle to be finished
- * return  : 
- */
-EXPORT_API int em_storage_mail_search_end(int search_handle, int transaction, int *err_code);
-
-
-
-/*
- * em_storage_set_field_of_mails_with_integer_value
- *
- * description       :  update a filed of mail
- * arguments : 
- *    account_id                :  Specifies the account id. 
- *    mail_ids       :  mail id list to be changed
- *    mail_ids_count :  count of mail list
- *    field_name     :  specified field name
- *    value          :  specified value
- * return       : 
- */
-EXPORT_API int em_storage_set_field_of_mails_with_integer_value(int account_id, int mail_ids[], int mail_ids_count, char *field_name, int value, int transaction, int *err_code);
-
-/*
- * em_storage_change_mail_field
- *
- * description :  update partial mail data
- * arguments : 
- *    mail_id  :  mail id
- *    type  :  changing type
- *    mail  :  mail pointer
- * return  : 
- */
-EXPORT_API int em_storage_change_mail_field(int mail_id, emf_mail_change_type_t type, emf_mail_tbl_t *mail, int transaction, int *err_code);
-
-/*
- * em_storage_increase_mail_id
- *
- * description :  increase unique mail id
- * arguments : 
- *    mail_id  :  pointer to store the unique id
- * return  : 
- */
-
-/*
- * em_storage_change_mail
- *
- * description :  update mail
- * arguments : 
- *    mail_id  :  mail id to be changed
- *    mail  :  mail pointer
- * return  : 
- */
-EXPORT_API int em_storage_change_mail(int mail_id, emf_mail_tbl_t *mail, int transaction, int *err_code);
-EXPORT_API int em_storage_clean_save_status(int save_status, int  *err_code);
-EXPORT_API int em_storage_update_server_uid(char *old_server_uid, char *new_server_uid, int *err_code);
-EXPORT_API int em_storage_modify_mailbox_of_mails(char *old_mailbox_name, char *new_mailbox_name, int transaction, int *err_code);
-
-EXPORT_API int em_storage_increase_mail_id(int *mail_id, int transaction, int *err_code);
-
-/*
- * em_storage_add_mail
- *
- * description :  add a mail to mail table
- * arguments : 
- *    mail  :  mail pointer to be inserted
- *   get_id :  must get uinque id in function
- * return  : 
- */
-EXPORT_API int em_storage_add_mail(emf_mail_tbl_t *mail, int get_id, int transaction, int *err_code);
-
-/*
- * em_storage_move_multiple_mails
- *
- * description :
- * arguments : 
- *    account_id  :  
- *   target_mailbox_name :
- *   mail_ids :
- *   number_of_mails :
- *   transaction :
- *   err_code :
- * return  : 
- */
-EXPORT_API int em_storage_move_multiple_mails(int account_id, char *target_mailbox_name, int mail_ids[], int number_of_mails, int transaction, int *err_code);
-
-/*
- * em_storage_delete_mail
- *
- * description :  delete mail from mail table
- * arguments : 
- *    mail_id  :  mail id to be deleted. if 0, all mail will be deleted.
- *    from_server  :  delete mail on server.
- * return  : 
- */
-EXPORT_API int em_storage_delete_mail(int mail_id, int from_server, int transaction, int *err_code);
-
-/*
- * em_storage_delete_mail_by_account
- *
- * description :  delete mail from mail table by account id
- * arguments : 
- *    account_id  :  account id.
- * return  : 
- */
-EXPORT_API int em_storage_delete_mail_by_account(int account_id, int transaction, int *err_code);
-
-/*
- * em_storage_delete_mail
- *
- * description :  delete mail from mail table
- * arguments : 
- *    account_id  :  account id.
- *    mbox  :  mail box
- * return  : 
- */
-EXPORT_API int em_storage_delete_mail_by_mailbox(int account_id, char *mbox, int transaction, int *err_code);
-
-/*
- * em_storage_delete_multiple_mails
- *
- * description :  
- * arguments : 
- *    mail_ids  :
- *    number_of_mails  :
- *    transaction  :
- *    err_code  :
- * return  : 
- */
-EXPORT_API int em_storage_delete_multiple_mails(int mail_ids[], int number_of_mails, int transaction, int *err_code);
-
-/*
- * em_storage_free_mail
- *
- * description :  free memory
- * arguments : 
- *    mail_list  :  mail array
- *    count  :  the number of array element
- * return  : 
- */
-EXPORT_API int em_storage_free_mail(emf_mail_tbl_t **mail_list, int count, int *err_code);
-
-/*
- * em_storage_get_attachment
- *
- * description :  get attachment from attachment table
- * arguments : 
- *    mail_id  :  mail id
- *    no  :  attachment sequence
- *    attachment  :  double pointer to hold attachment data
- * return  : 
- */
-EXPORT_API int em_storage_get_attachment_count(int mail_id, int *count, int transaction, int *err_code);
-
-/*
- * em_storage_get_attachment_list
- *
- * description :  get attachment list from attachment table
- * arguments : 
- *    input_mail_id           : mail id
- *    input_transaction       : transaction option
- *    attachment_list         : result attachment list
- *    output_attachment_count : result attachment count
- * return  : This function returns EM_STORAGE_ERROR_NONE on success or error code (refer to EM_STORAGE_ERROR__XXX) on failure.
- *    
- */
-EXPORT_API int em_storage_get_attachment_list(int input_mail_id, int input_transaction, emf_mail_attachment_tbl_t** output_attachment_list, int *output_attachment_count);
-
-
-/*
- * em_storage_get_attachment
- *
- * description :  get attachment from attachment table
- * arguments : 
- *    mail_id  :  mail id
- *    no  :  attachment id
- *    attachment  :  double pointer to hold attachment data
- * return  : 
- */
-EXPORT_API int em_storage_get_attachment(int mail_id, int no, emf_mail_attachment_tbl_t **attachment, int transaction, int *err_code);
-
-/*
- * em_storage_get_attachment
- *
- * description :  get nth-attachment from attachment table
- * arguments : 
- *    mail_id  :  mail id
- *    nth  :  index of the desired attachment (min : 1)
- *    attachment  :  double pointer to hold attachment data
- * return  : 
- */
-EXPORT_API int em_storage_get_attachment_nth(int mail_id, int nth, emf_mail_attachment_tbl_t **attachment, int transaction, int *err_code);
-
-/*
- * em_storage_change_attachment_field
- *
- * description :  update partial mail attachment data
- * arguments : 
- *    mail_id  :  mail id
- *    type  :  changing type
- *    mail  :  mail pointer
- * return  : 
- */
-EXPORT_API int em_storage_change_attachment_field(int mail_id, emf_mail_change_type_t type, emf_mail_attachment_tbl_t *attachment, int transaction, int *err_code);
-
-/*
- * em_storage_change_attachment_mbox
- *
- * description :  update mailbox from attahcment table
- * arguments : 
- *    account_id  :  account id
- *    old_mailbox_name  :  old mail box
- *    new_mailbox_name  :  new mail box
- * return  : 
- */
-EXPORT_API int em_storage_change_attachment_mbox(int account_id, char *old_mailbox_name, char *new_mailbox_name, int transaction, int *err_code);
-
-/* Get new attachment id */
-/*
- * em_storage_get_new_attachment_no
- *
- * description :  Get new attachment id
- * arguments : 
- *    attachment_no  :  attachment id pointer
- * return  : 
- */
-
-EXPORT_API int em_storage_get_new_attachment_no(int *attachment_no, int *err_code);
-
-/* insert attachment to mail attachment table */
-/*
- * em_storage_add_attachment
- *
- * description :  insert a attachment to attachment table
- * arguments : 
- *    attachment  :  attachment pointer
- * return  : 
- */
-EXPORT_API int em_storage_add_attachment(emf_mail_attachment_tbl_t *attachment, int iscopy, int transaction, int *err_code);
-
-
-EXPORT_API int em_storage_update_attachment(emf_mail_attachment_tbl_t *attachment, int transaction, int *err_code);
-
-/* delete a mail from mail table */
-/*
- * em_storage_delete_attachment_on_db
- *
- * description :  delete attachment from attachment table
- * arguments : 
- *    mail_id  :  mail id to contain attachment
- *    no  :  attachment sequence number
- * return  : 
- */
-EXPORT_API int em_storage_delete_attachment_on_db(int mail_id, int no, int transaction, int *err_code);
-
-/*
- * em_storage_delete_attachment_all_on_db
- *
- * description :  delete attachment from mail table
- * arguments : 
- *    account_id  :  account id.
- *    mbox  :  mail box
- * return  : 
- */
-EXPORT_API int em_storage_delete_attachment_all_on_db(int account_id, char *mbox, int transaction, int *err_code);
-
-/*
- * em_storage_free_attachment
- *
- * description :  free memory
- * arguments : 
- *    mail_list  :  mail array
- *    count  :  the number of array element
- * return  : 
- */
-EXPORT_API int em_storage_free_attachment(emf_mail_attachment_tbl_t **attachment_list, int count, int *err_code);
-
-/*  em_storage_get_mail_count_with_draft_flag - Send number of mails in a mailbox with draft flag enabled */
-EXPORT_API int em_storage_get_mail_count_with_draft_flag(int account_id, const char *mailbox, int *total, int transaction, int *err_code);
-
-/*  em_storage_get_mail_count_on_sending - Send number of mails being sent in a mailbox (status == EMF_MAIL_STATUS_SENDING) */
-EXPORT_API int em_storage_get_mail_count_on_sending(int account_id, const char *mailbox, int *total, int transaction, int * err_code);
-
-EXPORT_API int em_storage_is_mailbox_full(int account_id, emf_mailbox_t *mailbox, int *result, int *err_code);
-
-EXPORT_API int em_storage_get_max_mail_count();
-
-EXPORT_API int em_storage_mail_get_total_diskspace_usage(unsigned long *total_usage,  int transaction, int *err_code);
-
-
-/**
- * begin a transaction.
- *
- * @param[in] d1       Reserved.
- * @param[in] d2       Reserved.
- * @remarks em_storage_commit_transaction or em_storage_commit_transaction must be called after this function.
- * @return This function returns 0 on success or error code on failure.
- */
-
-EXPORT_API int em_storage_begin_transaction(void *d1, void *d2, int *err_code);
-
-/**
- * commit a transaction.
- *
- * @param[in] d1       Reserved.
- * @param[in] d2       Reserved.
- * @remarks N/A
- * @return This function returns 0 on success or error code on failure.
- */
-EXPORT_API int em_storage_commit_transaction(void *d1, void *d2, int *err_code);
-
-/**
- * rollback db.
- *
- * @param[in] d1       Reserved.
- * @param[in] d2       Reserved.
- * @remarks N/A
- * @return This function returns 0 on success or error code on failure.
- */
-EXPORT_API int em_storage_rollback_transaction(void *d1, void *d2, int *err_code);
-
-/**
- * clear mail data from db.
- *
- * @param[in]  transaction     
- * @param[out] err_code        
- * @remarks N/A
- * @return This function returns 0 on success or error code on failure.
- */
-
-EXPORT_API int em_storage_clear_mail_data(int transaction, int *err_code);
-
-/*
- * em_storage_get_save_name
- *
- * description :  get file name for saving data
- * arguments : 
- *    account_id  :  account id
- *    mail_id  :  mail id
- *    atch_id  :  attachment id
- *    fname  :  file name
- *    name_buf  :  buffer to hold file name. (MAX : 512Bytes)
- * return  : 
- */
-EXPORT_API int em_storage_get_save_name(int account_id, int mail_id, int atch_id, char *fname, char *name_buf, int *err_code);
-
-/*
- * em_storage_get_dele_name
- *
- * description :  get a name for deleting contents from file system.
- * arguments : 
- *    account_id  :  account id
- *    mail_id  :  mail id
- *    atch_id  :  attachment id
- *    fname  :  reserved
- *    name_buf  :  buffer to hold file name. (MAX : 512Bytes)
- * return  : 
- */
-EXPORT_API int em_storage_get_dele_name(int account_id, int mail_id, int atch_id, char *fname, char *name_buf, int *err_code);
-
-/*
- * em_storage_create_dir
- *
- * description :  create directory
- * arguments : 
- *    name_buf  :  buffer to hold file name. (MAX : 512Bytes)
- *    no  :  attachment no.
- * return  : 
- */
-EXPORT_API int em_storage_create_dir(int account_id, int mail_id, int atch_id, int *err_code);
-
-/*
- * em_storage_copy_file
- *
- * description :  copy a attachment file
- * arguments : 
- *    src_file  :  source file
- *    dst_file  :  destination file
- * return  : 
- */
-EXPORT_API int em_storage_copy_file(char *src_file, char *dst_file, int sync_file, int *err_code);
-
-/*
- * em_storage_move_file
- *
- * description :  move a file
- * arguments : 
- *    src_file  :  source file
- *    dst_file  :  destination file
- * return  : 
- */
-EXPORT_API int em_storage_move_file(char *src_file, char *dst_file, int sync_status, int *err_code);
-
-/*
- * em_storage_move_file
- *
- * description :  delete a file
- * arguments : 
- *    src_file  :  file to be deleted
- * return  : 
- */
-EXPORT_API int em_storage_delete_file(char *src_file, int *err_code);
-
-/*
- * em_storage_delete_dir
- *
- * description :  delete a directory
- * arguments : 
- *    src_dir  :  directory to be deleted
- * return  : 
- */
-EXPORT_API int em_storage_delete_dir(char *src_dir, int *err_code);
-
-
-
-EXPORT_API void em_storage_flush_db_cache();
-EXPORT_API int em_storage_test(int mail_id, int account_id, char *full_address_to, char *full_address_cc, char *full_address_bcc, int *err_code);
-
-EXPORT_API int em_storage_sleep_on_off(int on, int *error_code);
-EXPORT_API int em_storage_dimming_on_off(int on, int *error_code);
-#ifdef USE_POWERMGMT
-EXPORT_API int em_storage_power_management(int *error_code);
-#endif
-
-
-
-/**
- * em_storage_notify_storage_event - Notification for storage related operations
- * 
- */
-EXPORT_API int em_storage_notify_storage_event(emf_noti_on_storage_event event_type, int data1, int data2 , char *data3, int data4);
-
-/**
- * em_storage_notify_network_event - Notification for network related operations
- * 
- */
-EXPORT_API int em_storage_notify_network_event(emf_noti_on_network_event event_type, int data1, char *data2, int data3, int data4);
-EXPORT_API int em_storage_get_sender_list(int account_id, const char *mailbox_name, int search_type, const char *search_value, emf_sort_type_t sorting, emf_sender_list_t** sender_list, int *sender_count,  int *err_code);
-EXPORT_API int em_storage_free_sender_list(emf_sender_list_t **sender_list, int count);
-
-/* Handling Thread mail */
-EXPORT_API int em_storage_get_thread_information(int thread_id, emf_mail_tbl_t **mail_table_data, int transaction, int *err_code);
-EXPORT_API int em_storage_get_thread_id_of_thread_mails(emf_mail_tbl_t *mail_table_data, int *thread_id, int *result_latest_mail_id_in_thread, int *thread_item_count);
-EXPORT_API int em_storage_get_thread_id_by_mail_id(int mail_id, int *thread_id, int *err_code);
-EXPORT_API int em_storage_update_latest_thread_mail(int account_id, int thread_id, int latest_mail_id, int thread_item_count, int transaction, int *err_code);
-
-
-#ifdef _CONTACT_SUBSCRIBE_CHANGE_
-EXPORT_API int em_storage_contact_sync_insert(int contact_id, char *display_name, GSList *email_list, int *err_code);
-EXPORT_API int em_storage_contact_sync_update(int contact_id, char *display_name, GSList *email_list, int *err_code);
-EXPORT_API int em_storage_contact_sync_delete(int contact_id, int *err_code);
-#endif
-
-#ifdef __FEATURE_PARTIAL_BODY_DOWNLOAD__
-
-#define BULK_PARTIAL_BODY_DOWNLOAD_COUNT 10
-enum
-{
-       ACCOUNT_IDX_MAIL_PARTIAL_BODY_ACTIVITY_TBL = 0, 
-       MAIL_IDX_IN_MAIL_PARTIAL_BODY_ACTIVITY_TBL, 
-       SERVER_MAIL_IDX_IN_MAIL_PARTIAL_BODY_ACTIVITY_TBL, 
-       ACTIVITY_IDX_IN_MAIL_PARTIAL_BODY_ACTIVITY_TBL, 
-       ACTIVITY_TYPE_IDX_IN_MAIL_PARTIAL_BODY_ACTIVITY_TBL, 
-       MAILBOX_NAME_IDX_IN_MAIL_PARTIAL_BODY_ACTIVITY_TBL, 
-};
-
-
-EXPORT_API int em_storage_get_pbd_activity_data(int account_id, char *mailbox_name, emf_event_partial_body_thd** event_start, int *count, int transaction, int *err_code);
-EXPORT_API int em_storage_add_pbd_activity(emf_event_partial_body_thd *local_activity, int *activity_id, int transaction, int *err_code);
-EXPORT_API int em_storage_get_pbd_mailbox_list(int account_id, char ***mailbox_list, int *count, int transaction, int *err_code);
-EXPORT_API int em_storage_get_pbd_account_list(int **account_list, int *count, int transaction, int *err_code);
-EXPORT_API int em_storage_get_pbd_activity_count(int *activity_id_count, int transaction, int *err_code);
-EXPORT_API int em_storage_delete_full_pbd_activity_data(int account_id, int transaction, int *err_code);
-EXPORT_API int em_storage_delete_pbd_activity(int account_id, int mail_id, int activity_id, int transaction, int *err_code);
-EXPORT_API int em_storage_get_mailbox_pbd_activity_count(int account_id, char *mailbox_name, int *activity_count, int transaction, int *err_code);
-EXPORT_API int em_storage_update_pbd_activity(char *old_server_uid, char *new_server_uid, char *mbox_name, int *err_code);
-EXPORT_API int em_storage_create_file(char *buf, size_t file_size, char *dst_file, int *err_code);
-
-#endif  
-
-EXPORT_API int em_storage_free_address_info_list(emf_address_info_list_t **address_info_list);
-
-
-EXPORT_API void em_storage_create_dir_if_delete();
-EXPORT_API int em_storage_get_emf_error_from_em_storage_error(int error);
-
-EXPORT_API void *em_core_malloc(unsigned len);
-
-
-#ifdef __FEATURE_BULK_DELETE_MOVE_UPDATE_REQUEST_OPTI__
-EXPORT_API int em_storage_update_read_mail_uid_by_server_uid(char *old_server_uid, char *new_server_uid, char *mbox_name, int *err_code);
-
-/**
- * @fn em_storage_get_id_set_from_mail_ids(int mail_ids[], int mail_id_count, emf_id_set_t **server_uids, int *id_set_count, int *err_code);
- * Prepare an array of mail_id and corresponding server mail id.
- *
- *@author                                      h.gahlaut@samsung.com
- * @param[in] mail_ids                 Specifies the comma separated string of mail_ids. Maximaum size of string should be less than or equal to (QUERY_SIZE - 88)
- *                                                     where 88 is the length of fixed keywords including ending null character in the QUERY to be formed
- * @param[out] idset                   Returns the array of mail_id and corresponding server_mail_id sorted by server_mail_ids in ascending order
- * @param[out] id_set_count            Returns the no. of cells in idset array i.e. no. of sets of mail_ids and server_mail_ids
- * @param[out] err_code                Returns the error code.
- * @remarks                                    An Example of Query to be exexuted in this API : 
- *                                                     SELECT local_uid, s_uid from mail_read_mail_uid_tbl where local_uid in (12, 13, 56, 78);
- * @return This function returns true on success or false on failure.
- */
-
-EXPORT_API int em_storage_get_id_set_from_mail_ids(char *mail_ids, emf_id_set_t **idset, int *id_set_count, int *err_code);
-
-#endif
-
-/**
- * @fn em_storage_filter_mails_by_rule(int account_id, char dest_mailbox_name, emf_rule_t *rule, int **filtered_mail_id_list, int *count_of_mails, int err_code)
- * Move mails by specified rule for spam filtering. 
- *
- * @author                                                             kyuho.jo@samsung.com
- * @param[in] account_id                               Account id of the mails and the mailboxes.
- * @param[in] dest_mailbox_name                        Mailbox name of spam mailbox.
- * @param[in] rule                                             Filtering rule.
- * @param[out] filtered_mail_id_list   Mail id list which are filtered by the rule.
- * @param[out] count_of_mails                  Count of mails which are filtered by the rule.
- * @param[out] err_code                                        Returns the error code.
-
- * @remarks                                                                    
- * @return This function returns true on success or false on failure.
- */
-
-EXPORT_API int em_storage_add_meeting_request(int account_id, char *mailbox_name, emf_meeting_request_t *meeting_req, int transaction, int *err_code);
-EXPORT_API int em_storage_get_meeting_request(int mail_id, emf_meeting_request_t **meeting_req, int transaction, int *err_code);
-EXPORT_API int em_storage_update_meeting_request(emf_meeting_request_t *meeting_req, int transaction, int *err_code);
-EXPORT_API int em_storage_change_meeting_request_field(int account_id, char *mailbox_name, emf_mail_change_type_t type, emf_meeting_request_t *meeting_req, int transaction, int *err_code);
-EXPORT_API int em_storage_change_meeting_request_mailbox(int account_id, char *old_mailbox_name, char *new_mailbox_name, int transaction, int *err_code);
-EXPORT_API int em_storage_delete_meeting_request(int account_id, int mail_id, char *mailbox_name, int transaction, int *err_code);
-EXPORT_API int em_storage_free_meeting_request(emf_meeting_request_t **meeting_req, int count, int *err_code);
-
-#ifdef __LOCAL_ACTIVITY__
-/*
-*em_storage_get_next_activity_id
-*
-*description :  get an activity id for a new activity
-*/
-EXPORT_API int em_storage_get_next_activity_id(int *activity_id, int *err_code);
-
- /*
- *em_storage_get_activity_id_list
- *description  :  get the list of activity ids
- *arguments  : 
- *return  : 
- *
- */
- EXPORT_API int em_storage_get_activity_id_list(int account_id, int **activity_id_list, int *activity_count, int lowest_activity_type, int highest_activity_type, int transaction, int*err_code);
- /*
- * em_storage_add_activity
- *
- * description :  add an activity to activity table
- * arguments : 
- * return  : 
- */
-EXPORT_API int em_storage_add_activity(emf_activity_tbl_t *local_activity, int transaction, int *err_code);
-
-/**
-  *    em_storage_get_activity - Get the Local activity from the Mail activity table
-  *
-  */
-EXPORT_API int em_storage_get_activity(int account_id, int activity_id, emf_activity_tbl_t **activity_list, int *select_num, int transaction, int *err_code);
-
-/**
- * em_storage_delete_local_activity - Deletes the Local acitivity Generated based on activity_type
- * or based on server mail id
- *
- */
-EXPORT_API int em_storage_delete_local_activity(emf_activity_tbl_t *local_activity, int transaction, int *err_code);
-
-/**
- * em_storage_free_local_activity - Free the allocated Activity data
- * 
- *
- */
-EXPORT_API int em_storage_free_local_activity(emf_activity_tbl_t **local_activity_list, int count, int *err_code);
-
-/**
- * em_storage_free_activity_id_list - Free the allocated Activity List data
- * 
- *
- */
-EXPORT_API int em_storage_free_activity_id_list(int *activity_id_list, int *error_code);
-
-#endif
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __EM_STORAGE_H__ */
-/* EOF */
diff --git a/email-core/email-core-account.c b/email-core/email-core-account.c
new file mode 100755 (executable)
index 0000000..76add79
--- /dev/null
@@ -0,0 +1,1527 @@
+/*
+*  email-service
+*
+* Copyright (c) 2000 - 2011 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.
+*
+*/
+
+
+/******************************************************************************
+ * File :  email-core-account.c
+ * Desc :  Account Management
+ *
+ * Auth :  Kyuho Jo 
+ *
+ * History : 
+ *    2010.08.25  :  created
+ *****************************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <sys/types.h>
+#include <vconf.h>
+
+#include "email-convert.h"
+#include "email-types.h"
+#include "email-daemon.h"
+#include "email-debug-log.h"
+#include "email-storage.h"
+#include "email-network.h"
+#include "email-utilities.h"
+#include "email-core-utils.h"
+#include "email-core-event.h"
+#include "email-core-global.h"
+#include "email-core-account.h" 
+#include "email-core-mailbox.h"
+#include "email-core-imap-mailbox.h"
+
+#ifdef __FEATURE_USING_MY_ACCOUNT__
+#include "account.h"
+#endif /*  __FEATURE_USING_MY_ACCOUNT__ */
+
+char *g_default_mbox_alias[MAILBOX_COUNT] = 
+{
+       EMF_INBOX_DISPLAY_NAME, 
+       EMF_DRAFTBOX_DISPLAY_NAME, 
+       EMF_OUTBOX_DISPLAY_NAME, 
+       EMF_SENTBOX_DISPLAY_NAME, 
+       EMF_TRASH_DISPLAY_NAME, 
+       EMF_SPAMBOX_DISPLAY_NAME, 
+};
+
+char *g_default_mbox_name[MAILBOX_COUNT]  = 
+{
+       EMF_INBOX_NAME, 
+       EMF_DRAFTBOX_NAME, 
+       EMF_OUTBOX_NAME, 
+       EMF_SENTBOX_NAME, 
+       EMF_TRASH_DISPLAY_NAME, 
+       EMF_SPAMBOX_NAME, 
+};
+
+emf_mailbox_type_e g_default_mbox_type[MAILBOX_COUNT] = 
+{
+       EMF_MAILBOX_TYPE_INBOX, 
+       EMF_MAILBOX_TYPE_DRAFT, 
+       EMF_MAILBOX_TYPE_OUTBOX, 
+       EMF_MAILBOX_TYPE_SENTBOX, 
+       EMF_MAILBOX_TYPE_TRASH, 
+       EMF_MAILBOX_TYPE_SPAMBOX,               
+};
+
+INTERNAL_FUNC emf_account_t* emcore_get_account_reference(int account_id)
+{
+       EM_DEBUG_FUNC_BEGIN("account_id[%d]", account_id);
+       EM_PROFILE_BEGIN(profile_emcore_get_account_reference);
+       emf_account_list_t **p;
+
+       if (account_id == NEW_ACCOUNT_ID)
+               return emcore_get_new_account_reference();
+
+       if (account_id > 0)  {          
+               p = &g_account_list;
+               while (*p)  {
+                       if ((*p)->account->account_id == account_id)
+                               return ((*p)->account);
+                       p = &(*p)->next;
+               }
+
+               /*  refresh and check once agai */
+               if (emcore_refresh_account_reference() == true) {
+                       p = &g_account_list;
+                       while (*p)  {
+                               if ((*p)->account->account_id == account_id)
+                                       return ((*p)->account);
+                               
+                               p = &(*p)->next;
+                       }
+               }
+       }
+       EM_PROFILE_END(profile_emcore_get_account_reference);
+       EM_DEBUG_FUNC_END();
+       return NULL;
+}
+
+
+INTERNAL_FUNC int emcore_validate_account_with_account_info(emf_account_t *account, int *err_code)
+{
+       EM_DEBUG_FUNC_BEGIN("account[%p], err_code[%p], receiving_server_addr [%s]", account, err_code, account->receiving_server_addr);
+
+       int ret = false;
+       int err = EMF_ERROR_NONE;
+       emf_session_t *session = NULL;
+       SENDSTREAM *stream = NULL;
+       MAILSTREAM *tmp_stream = NULL;
+
+       if (!emcore_check_thread_status())  {           
+               err = EMF_ERROR_CANCELLED;
+               goto FINISH_OFF;
+       }
+
+       if (!emnetwork_check_network_status(&err))  {
+               EM_DEBUG_EXCEPTION("emnetwork_check_network_status failed [%d]", err);
+               goto FINISH_OFF;
+       }
+       EM_DEBUG_LOG("Network available");
+
+       if (!emcore_check_thread_status())  {           
+               err = EMF_ERROR_CANCELLED;
+               goto FINISH_OFF;
+       }
+
+       if (!emcore_get_empty_session(&session))  {             
+               EM_DEBUG_EXCEPTION("emcore_get_empty_session failed...");
+               err = EMF_ERROR_SESSION_NOT_FOUND;
+               goto FINISH_OFF;
+       }
+
+#ifdef _SMTP_ACCOUNT_VALIDATION_       
+       /* validate connection for smt */
+       EM_DEBUG_LOG("Validate connection for SMTP");
+
+       if (!emcore_check_thread_status()) {
+               err = EMF_ERROR_CANCELLED;
+               goto FINISH_OFF;
+       }
+       if (!emcore_connect_to_remote_mailbox_with_account_info(account, (char *)ENCODED_PATH_SMTP, (void **)&stream, &err) || !stream)  {
+               EM_DEBUG_EXCEPTION("emcore_connect_to_remote_mailbox failed 1 - %d", err);
+               if (EMF_ERROR_AUTHENTICATE == err || EMF_ERROR_LOGIN_FAILURE == err) {  /*  wrong password or etc */
+                       EM_DEBUG_EXCEPTION("emcore_connect_to_remote_mailbox failed  :  Login or Authentication fail 1- %d", err);
+                       goto FINISH_OFF;
+               }
+
+               if (account->sending_security == 0x01)  /*  0x01 == ss */ {
+                       /*  retry with tl */
+                       EM_DEBUG_LOG("Retry with TLS");
+                       account->sending_security = 0x02;       /*  0x02 == tl */
+                       if (!emcore_check_thread_status())  {
+                               err = EMF_ERROR_CANCELLED;
+                               goto FINISH_OFF;
+                       }
+                       
+                   if (!emcore_connect_to_remote_mailbox_with_account_info(account, (char *)ENCODED_PATH_SMTP, (void **)&stream, &err) || !stream)  {
+                               EM_DEBUG_EXCEPTION("emcore_connect_to_remote_mailbox failed 2 - %d", err);
+                               if (EMF_ERROR_AUTHENTICATE == err || EMF_ERROR_LOGIN_FAILURE == err) {  /*  wrong password or etc */
+                                       EM_DEBUG_EXCEPTION("emcore_connect_to_remote_mailbox failed  :  Login or Authentication fail 2 - %d", err);
+                               }                               
+                               else if (EMF_ERROR_CONNECTION_FAILURE != err) {
+                                       err = EMF_ERROR_VALIDATE_ACCOUNT;
+                               }
+                               account->sending_security = 0x01;       /*  restore to the previous value */
+                               goto FINISH_OFF;
+                   }
+
+                       if (!emcore_check_thread_status())  {
+                               err = EMF_ERROR_CANCELLED;
+                               goto FINISH_OFF;
+                       }
+
+                       /*  save sending_security = 0x02 (tls) to the d */
+                       if (!emstorage_update_account(account_id, (emstorage_account_tbl_t  *)account, true, &err)) {
+                               EM_DEBUG_EXCEPTION("emstorage_update_account failed - %d", err);
+                               account->sending_security = 0x01;       /*  restore to the previous value */
+                               err = EMF_ERROR_VALIDATE_ACCOUNT;
+                               goto FINISH_OFF;
+                       }
+               }
+               else {
+                       if (EMF_ERROR_CONNECTION_FAILURE != err)
+                               err = EMF_ERROR_VALIDATE_ACCOUNT;
+                       goto FINISH_OFF;
+               }
+       }
+#endif
+
+       /* validate connection for pop3/ima */
+       EM_DEBUG_LOG("Validate connection for POP3/IMAP4");
+       if (EMF_ERROR_NONE == err) {
+               if (!emcore_check_thread_status())  {
+                       err = EMF_ERROR_CANCELLED;
+                       goto FINISH_OFF;                
+               }
+               
+                if (!emcore_connect_to_remote_mailbox_with_account_info(account, NULL, (void **)&tmp_stream, &err) || !tmp_stream) 
+                {
+                       EM_DEBUG_EXCEPTION("emcore_connect_to_remote_mailbox failed - %d", err);
+                       if (EMF_ERROR_AUTHENTICATE == err || EMF_ERROR_LOGIN_FAILURE == err) {  /*  wrong password or etc */
+                               EM_DEBUG_EXCEPTION("emcore_connect_to_remote_mailbox failed : Login or Authentication failed - %d", err);
+                       }
+                       else if (EMF_ERROR_CONNECTION_FAILURE != err) {
+                               /* err = EMF_ERROR_VALIDATE_ACCOUNT */
+                       }
+                       goto FINISH_OFF;
+               }                       
+       }
+       
+       if (!emcore_check_thread_status())  {
+               if (!emcore_delete_account_(account->account_id, NULL))
+                       EM_DEBUG_EXCEPTION("emdaemon_delete_account failed [%d]", account->account_id);
+               err = EMF_ERROR_CANCELLED;
+               goto FINISH_OFF;
+       }
+       
+       ret = true;
+
+FINISH_OFF: 
+       if (stream)
+               smtp_close(stream);
+                 
+       if (tmp_stream)
+               emcore_close_mailbox(0 , tmp_stream);
+
+       if (err_code != NULL)
+               *err_code = err;
+
+       emcore_clear_session(session);
+
+       EM_DEBUG_FUNC_END();
+       return ret;
+}
+
+
+INTERNAL_FUNC int emcore_validate_account(int account_id, int *err_code)
+{
+       EM_DEBUG_FUNC_BEGIN("account_id[%d], err_code[%p]", account_id, err_code);
+
+       int err = EMF_ERROR_NONE, ret = false;
+       emf_account_t *ref_account = NULL;
+
+
+       if (account_id <= 0) 
+    {
+               EM_DEBUG_EXCEPTION("account_id[%p]", account_id);
+               err = EMF_ERROR_INVALID_PARAM;
+               goto FINISH_OFF;
+       }
+
+       ref_account = emcore_get_account_reference(account_id);
+
+       if (ref_account && emcore_validate_account_with_account_info(ref_account, &err) == false) {
+               EM_DEBUG_EXCEPTION("emcore_validate_account_with_account_info failed (%d)", err);
+               goto FINISH_OFF;
+       }
+
+       ret = true;
+
+FINISH_OFF: 
+
+       if (err_code)
+               *err_code = err;
+
+       EM_DEBUG_FUNC_END();
+
+       return ret;
+}
+
+INTERNAL_FUNC int emcore_delete_account_(int account_id, int *err_code)
+{
+       EM_DEBUG_FUNC_BEGIN("account_id[%d], err_code[%p]", account_id, err_code);
+       
+       /*  default variabl */
+       int ret = false;
+       int err = EMF_ERROR_NONE;
+
+       if (account_id < FIRST_ACCOUNT_ID)  {   
+               EM_DEBUG_EXCEPTION("account_id[%d]", account_id);
+               err = EMF_ERROR_INVALID_PARAM;
+               goto FINISH_OFF;
+       }
+#ifdef __FEATURE_LOCAL_ACTIVITY__ 
+       /* Delete all local activities of previous account */
+       emstorage_activity_tbl_t activity;
+       memset(&activity, 0x00, sizeof(emstorage_activity_tbl_t));
+       activity.account_id = account_id;
+       
+       if (!emcore_delete_activity(&activity, &err)) {
+               EM_DEBUG_LOG("\t emcore_delete_activity failed - %d", err);
+               
+               goto FINISH_OFF;
+       }
+#endif 
+
+#ifdef __FEATURE_PARTIAL_BODY_DOWNLOAD__
+       if (false == emcore_clear_partial_body_thd_event_que(&err))
+               EM_DEBUG_EXCEPTION(" emcore_clear_partial_body_thd_event_que [%d]", err);
+
+       if (false == emstorage_delete_full_pbd_activity_data(account_id, true, &err))
+               EM_DEBUG_EXCEPTION("emstorage_delete_full_pbd_activity_data failed [%d]", err);
+       
+#endif
+
+#ifdef __FEATURE_USING_MY_ACCOUNT__ 
+       {
+               int error_code;
+               emf_account_t *account_to_be_deleted;
+
+               account_to_be_deleted = emcore_get_account_reference(account_id);
+               if (account_to_be_deleted && account_to_be_deleted->receiving_server_type != EMF_SERVER_TYPE_ACTIVE_SYNC) {
+                       EM_DEBUG_LOG("Calling account_svc_delete with my_account_id[%d]", account_to_be_deleted->my_account_id);
+                       error_code = account_connect();
+                       EM_DEBUG_LOG("account_connect returns [%d]", error_code);
+                       account_delete_from_db_by_id(account_to_be_deleted->my_account_id);             
+                       error_code = account_disconnect();
+                       EM_DEBUG_LOG("account_disconnect returns [%d]", error_code);
+               }
+       }
+#endif
+       if (emcore_cancel_all_threads_of_an_account(account_id) < EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("There are some remaining jobs. I couldn't stop them.");
+               err = EMF_ERROR_CANNOT_STOP_THREAD;
+               goto FINISH_OFF;
+       }
+       
+       emf_mailbox_t mbox;
+
+       /*  BEGIN TRANSACTION;           */
+       emstorage_begin_transaction(NULL, NULL, NULL);
+       
+       if (!emstorage_delete_account(account_id, false, &err))  {
+               EM_DEBUG_EXCEPTION("emstorage_delete_account failed - %d", err);
+               goto FINISH_OFF;
+       }
+       
+#ifdef __FEATURE_KEEP_CONNECTION__
+       /* emcore_reset_streams(); */
+       emcore_remove_connection_info(account_id);
+#endif
+       
+       mbox.account_id = account_id;
+       mbox.name = NULL;
+       
+       if (!emcore_delete_mail_all(&mbox, 0, &err))  {
+               EM_DEBUG_EXCEPTION("emcore_delete_mail_all failed - %d", err);
+               goto FINISH_OFF;
+       }
+       
+       /*  delete all mailboxe */
+       if (!emstorage_delete_mailbox(account_id, -1, NULL, false, &err))  {            
+               EM_DEBUG_EXCEPTION("emstorage_delete_mailbox failed - %d", err);
+               goto FINISH_OFF;
+       }
+       
+       /*  delete local imap sync mailbox from imap mailbox tabl */
+       if (!emstorage_remove_downloaded_mail(account_id, NULL, NULL, false, &err))  {
+               EM_DEBUG_EXCEPTION("emstorage_remove_downloaded_mail failed - %d", err);
+               goto FINISH_OFF;
+       }
+
+       emcore_check_unread_mail();
+       emcore_delete_notification_by_account(account_id);
+       emcore_refresh_account_reference();
+       
+       ret = true;
+       
+FINISH_OFF: 
+       if (ret == true) {      /*  COMMIT TRANSACTION; */
+               if (emstorage_commit_transaction(NULL, NULL, NULL) == false) {
+                       err = EMF_ERROR_DB_FAILURE;
+                       ret = false;
+               }
+               if (!emstorage_notify_storage_event(NOTI_ACCOUNT_DELETE, account_id, 0, NULL, 0))
+                       EM_DEBUG_EXCEPTION(" emstorage_notify_storage_event[ NOTI_ACCOUNT_DELETE] : Notification Failed >>> ");
+
+       }
+       else {  /*  ROLLBACK TRANSACTION; */
+               if (emstorage_rollback_transaction(NULL, NULL, NULL) == false)
+                       err = EMF_ERROR_DB_FAILURE;
+               if (!emstorage_notify_storage_event(NOTI_ACCOUNT_DELETE_FAIL, account_id, err, NULL, 0))
+                       EM_DEBUG_EXCEPTION(" emstorage_notify_storage_event[ NOTI_ACCOUNT_DELETE] : Notification Failed >>> ");
+       }       
+
+       if (err_code)
+               *err_code = err;
+
+       EM_DEBUG_FUNC_END();
+
+       return ret;
+}
+
+INTERNAL_FUNC int emcore_create_account(emf_account_t *account, int *err_code)
+{
+       EM_DEBUG_FUNC_BEGIN("account[%p], err_code[%p]", account, err_code);
+       
+       int ret = false;
+       int err = EMF_ERROR_NONE;
+       int i, count = 0, is_preset_IMAP_account = false;
+       emf_mailbox_t local_mailbox = {0};
+       emstorage_account_tbl_t *temp_account_tbl = NULL;
+       
+       if (!account)  {
+               EM_DEBUG_EXCEPTION("account[%p]", account);
+               err = EMF_ERROR_INVALID_PARAM;
+               goto FINISH_OFF;
+       }
+       
+       if (!emstorage_get_account_count(&count, true, &err))  {
+               EM_DEBUG_EXCEPTION("emstorage_get_account_count failed - %d", err);
+               goto FINISH_OFF;
+       }
+
+
+       if (count >= EMF_ACCOUNT_MAX)  {
+               EM_DEBUG_EXCEPTION("too many accounts...");
+               err = EMF_ERROR_ACCOUNT_MAX_COUNT;
+               goto FINISH_OFF;
+       }
+
+       account->account_id = 0;
+
+       /* check for email address validation */
+       EM_DEBUG_LOG("account->email_addr[%s]", account->email_addr);
+       if (account->email_addr) {
+               if (!em_verify_email_address(account->email_addr, true, &err)) {
+                       err = EMF_ERROR_INVALID_ADDRESS;
+                       EM_DEBUG_EXCEPTION("Invalid Email Address");
+                       goto FINISH_OFF;
+               }
+       }
+
+#ifdef __FEATURE_USING_MY_ACCOUNT__
+       if (account->receiving_server_type != EMF_SERVER_TYPE_ACTIVE_SYNC) {
+               int account_svc_id = 0;
+               int error_code;
+               account_h account_handle = NULL;
+
+               error_code = account_connect();
+               error_code = account_create(&account_handle);
+               
+               if(error_code != ACCOUNT_ERROR_NONE) {
+                       EM_DEBUG_EXCEPTION("account_create failed [%d]", error_code);
+                       err = error_code;
+                       goto FINISH_OFF;
+               }
+
+               account_set_user_name(account_handle, account->user_name);
+               account_set_domain_name(account_handle, account->account_name); 
+               account_set_email_address(account_handle,  account->email_addr);
+               account_set_source(account_handle, "SLP EMAIL");
+               account_set_package_name(account_handle, "email-setting-efl");
+               account_set_capability(account_handle , ACCOUNT_CAPABILITY_EMAIL, ACCOUNT_CAPABILITY_ENABLED);
+               if (account->logo_icon_path)
+                       account_set_icon_path(account_handle, account->logo_icon_path);
+               error_code = account_insert_to_db(account_handle, &account_svc_id); 
+
+               if (error_code != ACCOUNT_ERROR_NONE) {
+                       EM_DEBUG_EXCEPTION("account_insert_to_db failed [%d]", error_code);
+                       err = error_code;
+                       goto FINISH_OFF;
+               }
+
+                       account->my_account_id = account_svc_id;    
+                       
+               EM_DEBUG_LOG("account_insert_to_db succeed");
+               
+               account_disconnect();
+       }
+#endif  /*  __FEATURE_USING_MY_ACCOUNT__ */
+
+       temp_account_tbl = em_malloc(sizeof(emstorage_account_tbl_t));
+       if (!temp_account_tbl) {
+               EM_DEBUG_EXCEPTION("allocation failed [%d]", err);
+               goto FINISH_OFF;
+       }
+       em_convert_account_to_account_tbl(account, temp_account_tbl);
+
+       if (!emstorage_add_account(temp_account_tbl, true, &err))  {
+               EM_DEBUG_EXCEPTION("emstorage_add_account failed - %d", err);
+               goto FINISH_OFF;
+       }
+       account->account_id = temp_account_tbl->account_id;
+       is_preset_IMAP_account = ((account->receiving_server_type == EMF_SERVER_TYPE_IMAP4)) ? true : false;/*  && (account->preset_account)) ? true  :  false */
+
+       EM_DEBUG_LOG("is_preset_IMAP_account  :  %d", is_preset_IMAP_account);
+
+       if ((account->receiving_server_type != EMF_SERVER_TYPE_ACTIVE_SYNC)     && (!is_preset_IMAP_account)) {
+               /* 1. create default local mailbox
+               *    (Inbox, Draft, Outbox, Sentbox) */
+               for (i = 0; i < MAILBOX_COUNT; i++) {
+               EM_DEBUG_LOG("g_default_mbox_name [%d/%d] is [%s]", i, MAILBOX_COUNT, g_default_mbox_name[i]);
+                       local_mailbox.account_id = temp_account_tbl->account_id;
+                       local_mailbox.name  = g_default_mbox_name[i];
+                       local_mailbox.mailbox_type      = g_default_mbox_type[i];
+                       if (local_mailbox.mailbox_type == EMF_MAILBOX_TYPE_INBOX) {
+                               local_mailbox.local = EMF_MAILBOX_FROM_SERVER;
+                               local_mailbox.synchronous = 1;
+                       }
+                       else {
+                               local_mailbox.local = EMF_MAILBOX_FROM_LOCAL;
+                               local_mailbox.synchronous = 0;
+                       }
+                       local_mailbox.alias = g_default_mbox_alias[i];
+                       emcore_get_default_mail_slot_count(&local_mailbox.mail_slot_size, NULL);
+
+                       if (!emcore_create_mailbox(&local_mailbox, 0, &err))  {
+                               EM_DEBUG_EXCEPTION("emcore_create failed - %d", err);
+                               goto FINISH_OFF;
+                       }
+                       
+               }
+       }
+       
+       
+       
+       ret = true;
+       
+FINISH_OFF: 
+       if (temp_account_tbl)
+               emstorage_free_account(&temp_account_tbl, 1, NULL);
+       
+       if (ret == false && account != NULL)  {
+               if (!emcore_delete_account_(account->account_id, NULL))
+                       EM_DEBUG_EXCEPTION("emdaemon_delete_account Failed [%d]", account->account_id);
+       }
+       
+       if (err_code)
+               *err_code = err;
+
+       EM_DEBUG_FUNC_END("Return value [%d]", ret);
+       return ret;
+}
+
+
+INTERNAL_FUNC int emcore_init_account_reference()
+{
+       EM_DEBUG_FUNC_BEGIN();
+       
+       int ret = false;
+       int err = EMF_ERROR_NONE;
+       
+       emf_account_list_t *account_list = NULL;
+       emf_account_list_t **p = NULL;
+       emf_account_t *account = NULL;
+       emstorage_account_tbl_t *account_tbl_array = NULL;
+       int count = 0;          
+       int i = 0;
+       
+       if (!g_account_retrieved)  {
+               count = 1000;
+               if (!emstorage_get_account_list(&count, &account_tbl_array, true, true, &err))  {
+                       EM_DEBUG_EXCEPTION("emstorage_get_account_list failed - %d", err);
+                       goto FINISH_OFF;
+               }
+               
+               for (p = &account_list, i = 0; i < count; i++)  {
+                       account = malloc(sizeof(emf_account_t));
+                       if (!account)  {        
+                               EM_DEBUG_EXCEPTION("malloc failed...");
+                               err = EMF_ERROR_OUT_OF_MEMORY;
+                               goto FINISH_OFF;
+                       }
+                       
+                       em_convert_account_tbl_to_account(account_tbl_array + i, account);
+
+                       /* memcpy(account, accounts + i, sizeof(emf_account_t)) */
+                       /* memset(accounts + i, 0x00, sizeof(emf_account_t)) */
+                       
+                       (*p) = malloc(sizeof(emf_account_list_t));
+                       if (!(*p))  {   
+                               EM_DEBUG_EXCEPTION("malloc failed...");
+                               err = EMF_ERROR_OUT_OF_MEMORY;
+                               goto FINISH_OFF;
+                       }
+                       
+                       memset((*p), 0x00, sizeof(emf_account_list_t));
+                       
+                       (*p)->account = account;
+                       
+                       p = &(*p)->next;
+               }
+               if (g_account_num)
+                       emcore_free_account_reference();
+               g_account_retrieved = 1;
+               g_account_num = count;
+               g_account_list = account_list;
+       }
+       
+       ret = true;
+       
+FINISH_OFF: 
+       if (account_tbl_array != NULL)
+               emstorage_free_account(&account_tbl_array, count, NULL);
+       
+       if (!ret)  {
+               g_account_list = account_list;
+               emcore_free_account_reference();
+       }
+
+       EM_DEBUG_FUNC_END("ret [%d]", ret);
+       return ret;
+}
+
+INTERNAL_FUNC int emcore_refresh_account_reference()
+{
+       EM_DEBUG_FUNC_BEGIN();
+       
+       if (g_account_retrieved && g_account_num)
+               emcore_free_account_reference();
+       
+       g_account_retrieved = 0;
+       g_account_num = 0;
+       g_account_list = NULL;
+       
+       if (!emcore_init_account_reference())  {
+               EM_DEBUG_EXCEPTION("emcore_init_account_reference failed...");
+               return false;
+       }
+       EM_DEBUG_FUNC_END();
+       return true;
+}
+
+INTERNAL_FUNC int emcore_free_account_reference()
+{
+       EM_DEBUG_FUNC_BEGIN();
+       
+       emf_account_list_t *p = g_account_list, *p_next;
+       while (p)  {
+               emcore_free_account(&p->account, 1, NULL);
+               
+               p_next = p->next;
+               free(p);
+               p = p_next;
+       }
+
+       g_account_retrieved = 0;
+       g_account_num = 0;
+       g_account_list = NULL;
+       EM_DEBUG_FUNC_END();
+       return true;
+}
+
+INTERNAL_FUNC int emcore_free_account(emf_account_t **account_list, int count, int *err_code)
+{
+       EM_DEBUG_FUNC_BEGIN("account_list[%p], count[%d], err_code[%p]", account_list, count, err_code);
+       
+       /*  default variabl */
+       int ret = false;
+       int err = EMF_ERROR_NONE;
+       
+       if (count > 0)  {
+               if (!account_list || !*account_list)  {
+                       err = EMF_ERROR_INVALID_PARAM;
+                       goto FINISH_OFF;
+               }
+               
+               emf_account_t *p = *account_list;
+               int i;
+               
+               for (i = 0; i < count; i++)  {
+                       EM_SAFE_FREE(p[i].account_name);
+                       EM_SAFE_FREE(p[i].receiving_server_addr);
+                       EM_SAFE_FREE(p[i].email_addr);
+                       EM_SAFE_FREE(p[i].user_name);
+                       EM_SAFE_FREE(p[i].password);
+                       EM_SAFE_FREE(p[i].sending_server_addr);
+                       EM_SAFE_FREE(p[i].sending_user);
+                       EM_SAFE_FREE(p[i].sending_password);
+                       EM_SAFE_FREE(p[i].display_name);
+                       EM_SAFE_FREE(p[i].reply_to_addr);
+                       EM_SAFE_FREE(p[i].return_addr);                 
+                       EM_SAFE_FREE(p[i].logo_icon_path);
+                       EM_SAFE_FREE(p[i].options.display_name_from);
+                       EM_SAFE_FREE(p[i].options.signature);
+               }
+               
+               EM_SAFE_FREE(p); *account_list = NULL;
+       }
+       
+       ret = true;
+       
+FINISH_OFF: 
+       if (err_code)
+               *err_code = err;
+       EM_DEBUG_FUNC_END();
+       return ret;
+}
+
+
+INTERNAL_FUNC int emcore_get_account_reference_list(emf_account_t **account_list, int *count, int *err_code)
+{
+       EM_DEBUG_FUNC_BEGIN("account_list[%p], count[%p], err_code[%p]", account_list, count, err_code);
+       int i, countOfAccounts = 0;
+       int ret = false;
+       int err = EMF_ERROR_NONE;
+       emf_account_t *accountRef;
+       emf_account_list_t *p;
+
+       if (!account_list || !count)  {
+               EM_DEBUG_EXCEPTION("account_list[%p], count[%p]", account_list, count);
+               err = EMF_ERROR_INVALID_PARAM;
+               goto FINISH_OFF;
+       }
+
+       p = g_account_list;
+
+       while (p) {
+               countOfAccounts++;
+               p = p->next;
+       }
+       
+       EM_DEBUG_LOG("Result count[%d]", countOfAccounts);
+       *count = countOfAccounts;
+
+       if (countOfAccounts > 0) {
+               *account_list = malloc(sizeof(emf_account_t) * countOfAccounts);
+               if (!*account_list)  {          
+                       EM_DEBUG_LOG("malloc failed...");
+                       err = EMF_ERROR_OUT_OF_MEMORY;
+                       goto FINISH_OFF;
+               }
+       }
+
+       p = g_account_list;
+       for (i = 0; i < countOfAccounts; i++)  {
+               accountRef = (*account_list) + i;
+               memcpy(accountRef, p->account , sizeof(emf_account_t));
+               p = p->next;
+       }
+
+       for (i = 0; i < countOfAccounts; i++)  {
+               accountRef = (*account_list) + i;
+               EM_DEBUG_LOG("Result account id[%d], name[%s]", accountRef->account_id, accountRef->account_name);
+       }
+
+       ret = true;
+
+FINISH_OFF: 
+       if (ret == false) {
+               if (account_list) /*  Warn! this is not *account_list. Just account_list */
+                       EM_SAFE_FREE(*account_list);
+       }
+
+       if (err_code != NULL)
+               *err_code = err;
+       EM_DEBUG_FUNC_END();
+       return ret;
+}
+       
+
+#ifdef __FEATURE_BACKUP_ACCOUNT__
+#include <ss_manager.h>
+
+static int append_data_into_buffer(char **target_buffer, int *target_buffer_lenth, char *input_data, int input_data_length, int *error_code)
+{
+       EM_DEBUG_FUNC_BEGIN("target_buffer [%p], target_buffer_lenth [%p], input_data [%p], input_data_length[%d]", target_buffer, target_buffer_lenth, input_data, input_data_length);
+       int local_error_code = EMF_ERROR_NONE, ret_code = false;
+
+       if (!target_buffer || !target_buffer_lenth || !input_data) {
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
+               local_error_code = EMF_ERROR_INVALID_PARAM;
+               goto FINISH_OFF;
+       }
+
+       if (*target_buffer_lenth > 0 && input_data_length) {
+               EM_DEBUG_LOG("*target_buffer_lenth [%d]", *target_buffer_lenth);
+               *target_buffer = realloc(*target_buffer, (*target_buffer_lenth) + input_data_length);
+               if (!*target_buffer) {
+                       EM_DEBUG_EXCEPTION("realloc failed");
+                       local_error_code = EMF_ERROR_OUT_OF_MEMORY;
+                       goto FINISH_OFF;
+               }
+               memcpy(*target_buffer + (*target_buffer_lenth), input_data, input_data_length);
+               *target_buffer_lenth += input_data_length;
+               EM_DEBUG_LOG("*target_buffer_lenth [%d] input_data_length [%d]", *target_buffer_lenth, input_data_length);
+       }
+       else {
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
+               local_error_code = EMF_ERROR_INVALID_PARAM;
+               goto FINISH_OFF;
+       }
+
+       ret_code = true;
+
+FINISH_OFF: 
+
+       if (error_code)
+               *error_code = local_error_code;
+       EM_DEBUG_FUNC_END("ret_code [%d]", ret_code);
+
+       return ret_code;
+}
+
+
+static int emcore_write_account_into_buffer(char **target_buffer, int *target_buffer_lenth, emstorage_account_tbl_t *account_tbl_ptr, int *error_code)
+{
+       EM_DEBUG_FUNC_BEGIN("target_buffer [%p], target_buffer_lenth [%p], account_tbl_ptr [%p], error_code [%p]", target_buffer, target_buffer_lenth, account_tbl_ptr, error_code);
+       int local_error_code = EMF_ERROR_NONE, ret_code = false, stream_length = 0;
+       emf_account_t *temp_account = NULL;
+       char *byte_stream = NULL;
+
+       temp_account = em_malloc(sizeof(emf_account_t));
+       memset(temp_account, 0, sizeof(emf_account_t));
+
+       if (em_convert_account_tbl_to_account(account_tbl_ptr, temp_account)) {
+               byte_stream = em_convert_account_to_byte_stream(temp_account, &stream_length);
+               EM_DEBUG_LOG("stream_length [%d]", stream_length);
+               /*  EM_DEBUG_LOG("password [%s]", temp_account->password) */
+
+               if (byte_stream) {
+                       if (!append_data_into_buffer(target_buffer, target_buffer_lenth, (char *)&stream_length, sizeof(int), &local_error_code)) {
+                               EM_DEBUG_EXCEPTION("append_data_into_buffer failed");
+                               goto FINISH_OFF;
+                       }
+                       EM_DEBUG_LOG("append_data_into_buffer succeed for stream_length");
+
+                       if (!append_data_into_buffer(target_buffer, target_buffer_lenth, byte_stream, stream_length, &local_error_code)) {
+                               EM_DEBUG_EXCEPTION("append_data_into_buffer failed");
+                               goto FINISH_OFF;
+                       }
+                       EM_DEBUG_LOG("append_data_into_buffer succeed for byte_stream");
+               }
+       }
+       else {
+               EM_DEBUG_EXCEPTION("em_convert_account_tbl_to_account failed");
+               local_error_code = EMF_ERROR_SYSTEM_FAILURE;
+               goto FINISH_OFF;
+       }
+
+       ret_code = true;
+FINISH_OFF: 
+       if (temp_account)
+               emcore_free_account(&temp_account, 1, NULL);
+       if (error_code)
+               *error_code = local_error_code;
+
+       EM_SAFE_FREE(byte_stream);
+
+       EM_DEBUG_FUNC_END("ret_code [%d]", ret_code);
+       return ret_code;
+}
+
+INTERNAL_FUNC int emcore_backup_accounts(const char *file_path, int *error_code)
+{
+       EM_DEBUG_FUNC_BEGIN("file_path [%s], error_code [%p]", file_path, error_code);
+       int local_error_code = EMF_ERROR_NONE, local_error_code_2 = EMF_ERROR_NONE, ret_code = false;
+       int select_num, i, target_buff_length = 0;
+       char *target_buffer = NULL;
+       emstorage_account_tbl_t *account_list = NULL;
+
+       if (!file_path) {
+               local_error_code = EMF_ERROR_INVALID_PARAM;
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
+               goto FINISH_OFF;        
+       }
+
+       select_num = 1000;
+       
+       if (!emstorage_get_account_list(&select_num, &account_list, true, true, &local_error_code)) {
+               EM_DEBUG_EXCEPTION("emstorage_get_account_list failed [%d]", local_error_code);
+               goto FINISH_OFF;        
+       }
+       
+       EM_DEBUG_LOG("select_num [%d]", select_num);
+       
+       if (account_list) {
+               target_buffer = malloc(sizeof(int));
+               if (!target_buffer)  {
+                       EM_DEBUG_EXCEPTION("malloc failed");
+                       local_error_code = EMF_ERROR_OUT_OF_MEMORY;
+                       goto FINISH_OFF;
+               }
+
+               memcpy(target_buffer, (char *)&select_num, sizeof(int));
+               target_buff_length = sizeof(int);
+
+               for (i = 0; i < select_num; i++) {
+                       if (!emcore_write_account_into_buffer(&target_buffer, &target_buff_length, account_list + i, &local_error_code)) {
+                               EM_DEBUG_EXCEPTION("emcore_write_account_into_buffer failed [%d]", local_error_code);
+                               goto FINISH_OFF;        
+                       }
+               }
+
+               EM_DEBUG_LOG("target_buff_length [%d]", target_buff_length);
+
+               ssm_delete_file(file_path, SSM_FLAG_SECRET_OPERATION, NULL);
+               
+               if (ssm_write_buffer(target_buffer, target_buff_length, file_path, SSM_FLAG_SECRET_OPERATION, NULL) < 0) {
+                       EM_DEBUG_EXCEPTION("ssm_write_buffer failed [%d]", local_error_code);
+                       local_error_code = EMF_ERROR_SYSTEM_FAILURE;
+                       goto FINISH_OFF;        
+               }
+               
+       }
+
+       ret_code = true;        
+FINISH_OFF: 
+
+       EM_SAFE_FREE(target_buffer);
+       if (account_list)
+               emstorage_free_account(&account_list, select_num, &local_error_code_2);
+
+       if (error_code)
+               *error_code = local_error_code;
+
+       EM_DEBUG_FUNC_END("ret_code [%d]", ret_code);
+       return ret_code;
+}
+
+INTERNAL_FUNC int emcore_restore_accounts(const char *file_path, int *error_code)
+{
+       EM_DEBUG_FUNC_BEGIN("file_path [%s], error_code [%p]", file_path, error_code);
+       int local_error_code = EMF_ERROR_NONE, ret_code = false, buffer_length = 0, read_length = 0;
+       int account_count = 0, i = 0, account_stream_length = 0;
+       char *temp_buffer = NULL, *account_stream = NULL, *buffer_ptr = NULL;
+       emf_account_t *temp_account = NULL, *account_list = NULL;
+
+       ssm_file_info_t sfi;
+
+       if (!file_path) {
+               local_error_code = EMF_ERROR_INVALID_PARAM;
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
+               goto FINISH_OFF;        
+       }
+
+       if (emcore_get_account_reference_list(&account_list, &account_count, &ret_code)) {
+               for (i = 0; i < account_count; i++) {
+                       if (account_list[i].receiving_server_type != EMF_SERVER_TYPE_ACTIVE_SYNC) {
+                               if (!emcore_delete_account_(account_list[i].account_id, &ret_code)) {
+                                       local_error_code = EMF_ERROR_INVALID_ACCOUNT;
+                                       EM_DEBUG_EXCEPTION("emcore_delete_account_ failed");
+                                       goto FINISH_OFF;
+                               }
+                       }
+               }
+       }
+
+       if (ssm_getinfo(file_path, &sfi, SSM_FLAG_SECRET_OPERATION, NULL) < 0) {
+               EM_DEBUG_EXCEPTION("ssm_getinfo() failed.");
+               ret_code = EMF_ERROR_SYSTEM_FAILURE;
+               goto FINISH_OFF;
+       }
+
+       buffer_length = sfi.originSize;
+       EM_DEBUG_LOG("account buffer_length[%d]", buffer_length);
+       if ((temp_buffer = (char *)em_malloc(buffer_length + 1)) == NULL) {
+               EM_DEBUG_EXCEPTION("em_malloc failed...");
+               ret_code = EMF_ERROR_OUT_OF_MEMORY;
+               goto FINISH_OFF;
+       }
+
+       if (ssm_read(file_path, temp_buffer, buffer_length, (size_t *)&read_length, SSM_FLAG_SECRET_OPERATION, NULL) < 0) {
+               EM_DEBUG_EXCEPTION("ssm_read() failed.");
+               ret_code = EMF_ERROR_SYSTEM_FAILURE;
+               goto FINISH_OFF;
+       }
+
+       EM_DEBUG_LOG("read_length[%d]", read_length);
+
+       if (buffer_length == read_length) {
+               memcpy((void *)&account_count, temp_buffer, sizeof(int));
+               buffer_ptr = temp_buffer + sizeof(int);
+
+               EM_DEBUG_LOG("account_count[%d]", account_count);               
+
+               for (i = 0; i < account_count; i++) {
+                       memcpy((void *)&account_stream_length, buffer_ptr, sizeof(int));
+                       buffer_ptr += sizeof(int);
+                       EM_DEBUG_LOG("account_stream_length [%d]", account_stream_length);
+                       if (account_stream_length) {
+                               account_stream = em_malloc(account_stream_length);
+                               if (!account_stream) {
+                                       EM_DEBUG_EXCEPTION("em_malloc() failed.");
+                                       ret_code = EMF_ERROR_OUT_OF_MEMORY ;
+                                       goto FINISH_OFF;
+                               }
+                               memcpy(account_stream, buffer_ptr, account_stream_length);
+
+                               temp_account = em_malloc(sizeof(emf_account_t));
+
+                               if (!temp_account) {
+                                       EM_DEBUG_EXCEPTION("em_malloc() failed.");
+                                       ret_code = EMF_ERROR_OUT_OF_MEMORY;
+                                       goto FINISH_OFF;
+                               }
+
+                               em_convert_byte_stream_to_account(account_stream, temp_account);
+                               EM_SAFE_FREE(account_stream);
+                       
+                               if (!emcore_create_account(temp_account, &ret_code)) {
+                                       EM_DEBUG_EXCEPTION("emcore_create_account() failed.");
+                                       goto FINISH_OFF;
+                               }
+
+                               emcore_free_account(&temp_account, 1,  &ret_code);
+                               temp_account = NULL;
+                       }
+                       buffer_ptr += account_stream_length;
+                       account_stream_length = 0;
+               }
+       } else {
+               EM_DEBUG_EXCEPTION("ssm_read() failed.");
+               ret_code = EMF_ERROR_SYSTEM_FAILURE;
+               goto FINISH_OFF;
+       }
+       ret_code = true;        
+FINISH_OFF: 
+       if (temp_account)
+               emcore_free_account(&temp_account, 1, NULL);
+       EM_SAFE_FREE(account_stream);
+       EM_SAFE_FREE(temp_buffer);
+
+       EM_DEBUG_FUNC_END("ret_code [%d]", ret_code);
+       return ret_code;
+}
+
+#endif /*  __FEATURE_BACKUP_ACCOUNT_ */
+
+#ifdef __FEATURE_WDS_SUPPORT__
+#include <curl/curl.h>
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+#include <libxml/xpath.h>
+#include <libxml/xpathInternals.h>
+
+static int emcore_fetch_server_info_from_wds(const char *domain_name, char **output_file_path)
+{
+       EM_DEBUG_FUNC_BEGIN("domain_name [%s]", domain_name);
+       CURL *curl = NULL;
+       int ret_code = EMF_ERROR_NONE, curl_error = CURLE_OK, file_path_len = 0;
+       char *wds_url = "https://servicemine-api.wdsglobal.com/servicemine-api/email?domainName=";
+       char *query_url = NULL;
+       char *user_password = "samsung:xi7Claso";
+       char curl_error_buffer[CURL_ERROR_SIZE] = { 0, };
+       FILE *file_from_curl = NULL;
+
+       if(!domain_name) {
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
+               ret_code = EMF_ERROR_INVALID_PARAM;
+               goto FINISH_OFF;
+       }
+
+       query_url = em_malloc(strlen(wds_url) + strlen(domain_name) + 1);
+
+       if(!query_url) {
+               EM_DEBUG_EXCEPTION("EMF_ERROR_OUT_OF_MEMORY");
+               ret_code = EMF_ERROR_OUT_OF_MEMORY;
+               goto FINISH_OFF;
+       }
+
+       sprintf(query_url, "%s%s", wds_url, domain_name);
+       curl = curl_easy_init();
+
+       if(!curl) {
+               EM_DEBUG_EXCEPTION("curl_easy_init failed");
+               ret_code = EMF_ERROR_UNKNOWN;
+               goto FINISH_OFF;
+       }
+
+       if( (curl_error = curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, curl_error_buffer) ) != CURLE_OK) {
+               EM_DEBUG_EXCEPTION("curl_easy_setopt for CURLOPT_ERRORBUFFER failed");
+               ret_code = EMF_ERROR_UNKNOWN;
+               goto FINISH_OFF;
+       }
+
+       if( (curl_error = curl_easy_setopt(curl, CURLOPT_URL, query_url) ) != CURLE_OK) {
+               EM_DEBUG_EXCEPTION("curl_easy_setopt for CURLOPT_URL failed");
+               ret_code = EMF_ERROR_UNKNOWN;
+               goto FINISH_OFF;
+       }
+
+       if( (curl_error = curl_easy_setopt(curl, CURLOPT_HTTPAUTH,  CURLAUTH_ANY) ) != CURLE_OK) {
+               EM_DEBUG_EXCEPTION("curl_easy_setopt for CURLOPT_HTTPAUTH failed");
+               ret_code = EMF_ERROR_UNKNOWN;
+               goto FINISH_OFF;
+       }
+
+       if( (curl_error = curl_easy_setopt(curl, CURLOPT_USERPWD, user_password) ) != CURLE_OK) {
+               EM_DEBUG_EXCEPTION("curl_easy_setopt for CURLOPT_USERPWD failed");
+               ret_code = EMF_ERROR_UNKNOWN;
+               goto FINISH_OFF;
+       }
+
+       if( (curl_error = curl_easy_setopt(curl, CURLOPT_HTTPGET, 1) ) != CURLE_OK)     {
+               EM_DEBUG_EXCEPTION("curl_easy_setopt for CURLOPT_HTTPGET failed");
+               ret_code = EMF_ERROR_UNKNOWN;
+               goto FINISH_OFF;
+       }
+
+       if( (curl_error = curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L) ) != CURLE_OK) {
+               EM_DEBUG_EXCEPTION("curl_easy_setopt for CURLOPT_SSL_VERIFYPEER failed");
+               ret_code = EMF_ERROR_UNKNOWN;
+               goto FINISH_OFF;
+       }
+
+       file_path_len = strlen(MAILHOME "/tmp/") + strlen(domain_name) + strlen(".xml") + 1;
+       *output_file_path = em_malloc(file_path_len + 1);
+       
+       if(!output_file_path) {
+               EM_DEBUG_EXCEPTION("EMF_ERROR_OUT_OF_MEMORY");
+               ret_code = EMF_ERROR_OUT_OF_MEMORY;
+               goto FINISH_OFF;
+       }
+
+       snprintf(*output_file_path, file_path_len, "%s%s%s", "/tmp/", domain_name, ".xml");
+
+       file_from_curl = fopen(*output_file_path, "w");
+
+       if(!file_from_curl) {
+               EM_DEBUG_EXCEPTION("fopen failed [%s]", *output_file_path);
+               ret_code = EMF_ERROR_SYSTEM_FAILURE;
+               goto FINISH_OFF;
+       }               
+
+       if( (curl_easy_setopt(curl, CURLOPT_WRITEDATA, file_from_curl) ) != CURLE_OK) {
+               EM_DEBUG_EXCEPTION("curl_easy_setopt for CURLOPT_WRITEDATA failed");
+               ret_code = EMF_ERROR_UNKNOWN;
+               goto FINISH_OFF;
+       } 
+
+       if(curl_easy_perform(curl) != CURLE_OK) {
+               EM_DEBUG_EXCEPTION("curl_easy_perform failed [%s]", curl_error_buffer);
+               ret_code = EMF_ERROR_UNKNOWN;
+               goto FINISH_OFF;
+       }
+
+       EM_DEBUG_LOG("curl_easy_perform passed");
+
+FINISH_OFF: 
+       if(file_from_curl)
+               fclose(file_from_curl);
+
+       EM_SAFE_FREE(query_url);
+
+       if(curl)
+               curl_easy_cleanup(curl);
+
+       EM_DEBUG_FUNC_END("ret_code [%d]", ret_code);
+       return ret_code;
+}
+
+static int emcore_parse_server_info_from_wds(char *xml_file_path, emf_server_info_t **result_server_info)
+{
+       EM_DEBUG_FUNC_BEGIN("xml_file_path [%s], result_server_info [%p]", xml_file_path, result_server_info);
+
+       int ret_code = EMF_ERROR_NONE;
+       xmlDocPtr doc = NULL;
+       xmlXPathContextPtr xpath_context = NULL; 
+       xmlXPathObjectPtr xpath_obj_service = NULL, xpath_obj_configuration = NULL, xpath_obj_result_of_query = NULL; 
+       xmlChar *xpath_service = (xmlChar*)"/servicemine/discovery/*/service-provider/service";
+       xmlChar *xpath_configuration = (xmlChar*)"/servicemine/discovery/*/service-provider/service/configuration";
+       xmlChar *xpath_configuration_query = NULL;
+       xmlChar *service_name = NULL, *id_string = NULL, *result_content = NULL;
+       emf_server_info_t *server_info = NULL;
+       int i, j, id_len;
+
+       if(!xml_file_path || !result_server_info) {
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
+               ret_code = EMF_ERROR_INVALID_PARAM;
+               goto FINISH_OFF;
+       }
+       
+       xmlInitParser();
+       LIBXML_TEST_VERSION;
+
+       doc = xmlReadFile(xml_file_path, NULL, 0);
+       if (doc == NULL) {
+           EM_DEBUG_EXCEPTION("Failed to parse [%s]", xml_file_path);
+               ret_code = EMF_ERROR_UNKNOWN;
+               goto FINISH_OFF;
+       }
+
+       /* Create xpath evaluation context */
+       xpath_context = xmlXPathNewContext(doc);
+       if(xpath_context == NULL) {
+           EM_DEBUG_EXCEPTION("unable to create new XPath context");
+               ret_code = EMF_ERROR_UNKNOWN;
+               goto FINISH_OFF;
+       }
+                   
+       xpath_obj_service = xmlXPathEvalExpression(xpath_service, xpath_context);
+       if(xpath_obj_service == NULL) {
+           EM_DEBUG_EXCEPTION("unable to evaluate xpath expression [%s]", xpath_service);
+               ret_code = EMF_ERROR_UNKNOWN;
+               goto FINISH_OFF;
+       }
+
+       if(xpath_obj_service->nodesetval->nodeNr > 0 && xpath_obj_service->nodesetval->nodeTab) {
+           service_name = xmlGetProp(xpath_obj_service->nodesetval->nodeTab[0] , (xmlChar*)"name");
+               if(service_name) {
+                       EM_DEBUG_LOG("service_name [%s]", service_name);
+               }
+               else {
+                       EM_DEBUG_EXCEPTION("xmlGetProp failed");
+                       ret_code = EMF_ERROR_UNKNOWN;
+                       goto FINISH_OFF;
+               }
+       }
+       else {
+               EM_DEBUG_EXCEPTION("nodesetval empty");
+               ret_code = EMF_ERROR_UNKNOWN;
+               goto FINISH_OFF;
+       }
+                       
+       xpath_obj_configuration = xmlXPathEvalExpression(xpath_configuration, xpath_context);
+       if(xpath_obj_configuration == NULL) {
+         EM_DEBUG_EXCEPTION("unable to evaluate xpath expression [%s]", xpath_configuration);
+               ret_code = EMF_ERROR_UNKNOWN;
+               goto FINISH_OFF;
+       }
+
+       server_info = em_malloc(sizeof(emf_server_info_t));
+
+       if(!server_info){
+               EM_DEBUG_EXCEPTION("em_malloc failed");
+               ret_code = EMF_ERROR_OUT_OF_MEMORY;
+               goto FINISH_OFF;
+       }
+
+       server_info->service_name = (char*)service_name;
+       
+       if(xpath_obj_configuration->nodesetval->nodeNr) {
+               EM_DEBUG_LOG("node count [%d]", xpath_obj_configuration->nodesetval->nodeNr);
+               server_info->protocol_config_array = em_malloc(sizeof(emf_protocol_config_t) * xpath_obj_configuration->nodesetval->nodeNr);
+               server_info->protocol_conf_count = xpath_obj_configuration->nodesetval->nodeNr;
+       }
+       else {
+               EM_DEBUG_EXCEPTION("xmlXPathEvalExpression failed");
+               ret_code = EMF_ERROR_UNKNOWN;
+               goto FINISH_OFF;
+       }
+       
+       for(i = 0; i < xpath_obj_configuration->nodesetval->nodeNr; i++) {
+               id_string = xmlGetProp(xpath_obj_configuration->nodesetval->nodeTab[i] , (xmlChar*)"id");
+               if(id_string) {
+                       EM_DEBUG_LOG("id_string [%s]", id_string);
+                       server_info->protocol_config_array[i].configuration_id = atoi((char*)id_string);
+                       id_len = strlen((char*)id_string);
+               }
+               else {
+                       EM_DEBUG_EXCEPTION("xmlGetProp failed");
+                       continue;
+               }
+               
+               xpath_configuration_query = em_malloc(strlen((char*)xpath_configuration) + id_len + 300);
+               if(!xpath_configuration_query) {
+                       EM_DEBUG_EXCEPTION("em_malloc failed");
+                       ret_code = EMF_ERROR_UNKNOWN;
+                       goto FINISH_OFF;
+               }
+               
+               /* searching in discovery element */
+               
+               sprintf((char*)xpath_configuration_query, "/servicemine/discovery//service-provider/service/configuration[@id=\"%s\"]/email/*", (char*)id_string);
+               EM_DEBUG_LOG("[%s]", xpath_configuration_query);
+               
+               xpath_obj_result_of_query = xmlXPathEvalExpression(xpath_configuration_query, xpath_context);
+               if(xpath_obj_result_of_query == NULL) {
+                       EM_DEBUG_EXCEPTION("unable to evaluate xpath expression [%s]", xpath_configuration_query);
+                       ret_code = EMF_ERROR_UNKNOWN;
+                       goto FINISH_OFF;
+               }
+                       
+               if(xpath_obj_result_of_query->nodesetval && xpath_obj_result_of_query->nodesetval->nodeNr) {
+                       EM_DEBUG_LOG("node count [%d]", xpath_obj_result_of_query->nodesetval->nodeNr);
+               }
+               else {
+                       EM_DEBUG_EXCEPTION("xmlXPathEvalExpression failed [%p]", xpath_obj_result_of_query->nodesetval);
+                       ret_code = EMF_ERROR_UNKNOWN;
+                       goto FINISH_OFF;
+               }
+               
+               for(j = 0; j < xpath_obj_result_of_query->nodesetval->nodeNr; j++) {
+                       if(xpath_obj_result_of_query->nodesetval->nodeTab[j]->name) {
+                               EM_DEBUG_LOG("element name [%s]", xpath_obj_result_of_query->nodesetval->nodeTab[j]->name);
+                               EM_DEBUG_LOG("element type [%d]", xpath_obj_result_of_query->nodesetval->nodeTab[j]->type);
+                               result_content = xmlNodeGetContent(xpath_obj_result_of_query->nodesetval->nodeTab[j]);
+                               EM_DEBUG_LOG("content name [%s]", (char*)result_content);
+                               if(strncmp((char*)xpath_obj_result_of_query->nodesetval->nodeTab[j]->name, "protocol", strlen("protocol")) == 0) {
+                                       server_info->protocol_config_array[i].protocol_type = EMF_SERVER_TYPE_NONE;
+                                       if(result_content) {
+                                               if(strncmp((char*)result_content, "smtp", strlen("smtp")) == 0) {
+                                                       server_info->protocol_config_array[i].protocol_type = EMF_SERVER_TYPE_SMTP;
+                                               }
+                                               else if(strncmp((char*)result_content, "pop3", strlen("pop3")) == 0) {
+                                                       server_info->protocol_config_array[i].protocol_type = EMF_SERVER_TYPE_POP3;
+                                               }
+                                               else if(strncmp((char*)result_content, "imap4", strlen("imap4")) == 0) {
+                                                       server_info->protocol_config_array[i].protocol_type = EMF_SERVER_TYPE_IMAP4;
+                                               }
+                                       }
+                                       EM_DEBUG_LOG("protocol_type [%d]", server_info->protocol_config_array[i].protocol_type);
+                               } 
+                               else if(strncmp((char*)xpath_obj_result_of_query->nodesetval->nodeTab[j]->name, "encryption-type", strlen("encryption-type")) == 0) {
+                                       server_info->protocol_config_array[i].security_type = 0;
+                                       if(result_content) {
+                                               if(strncmp((char*)result_content, "ssl/tls", strlen("ssl/tls")) == 0) {
+                                                       server_info->protocol_config_array[i].security_type = 1;
+                                               }
+                                               else if(strncmp((char*)result_content, "none", strlen("none")) == 0) {
+                                                       server_info->protocol_config_array[i].security_type = 0;
+                                               }
+                                               
+                                       }
+                                       EM_DEBUG_LOG("security_type [%d]", server_info->protocol_config_array[i].security_type);
+                               }
+                               else if(strncmp((char*)xpath_obj_result_of_query->nodesetval->nodeTab[j]->name, "requires-auth", strlen("requires-auth")) == 0) {
+                                       if(result_content) {
+                                               if(strncmp((char*)result_content, "true", strlen("true")) == 0) {
+                                                       server_info->protocol_config_array[i].auth_type = 1;
+                                               }
+                                               else {
+                                                       server_info->protocol_config_array[i].auth_type = 0;
+                                               }
+                                       }
+                                       EM_DEBUG_LOG("auth_type [%d]", server_info->protocol_config_array[i].auth_type);
+                               }
+                               EM_SAFE_FREE(result_content);
+                       }
+               }
+               
+               if(xpath_obj_result_of_query) {
+                       xmlXPathFreeObject(xpath_obj_result_of_query);
+                       xpath_obj_result_of_query = NULL;
+               }
+               
+               /* searching server address in configuration-parameters element */
+                       
+               sprintf((char*)xpath_configuration_query, "/servicemine/configuration-parameters/configuration[@id=\"%s\"]/wap-provisioningdoc/characteristic/characteristic[@type=\"APPADDR\"]/parm", (char*)id_string);
+               EM_DEBUG_LOG("[%s]", xpath_configuration_query);
+               
+               xpath_obj_result_of_query = xmlXPathEvalExpression(xpath_configuration_query, xpath_context);
+               if(xpath_obj_result_of_query == NULL) {
+                       EM_DEBUG_EXCEPTION(" unable to evaluate xpath expression [%s]", xpath_configuration_query);
+                       goto FINISH_OFF;
+               }
+                       
+               if(xpath_obj_result_of_query->nodesetval->nodeNr > 0 && xpath_obj_result_of_query->nodesetval->nodeTab) {
+                       result_content = xmlGetProp(xpath_obj_result_of_query->nodesetval->nodeTab[0] , (const xmlChar *)"value");
+                       if(result_content) {
+                               EM_DEBUG_LOG("result_content [%s]", (char*)result_content);
+                               server_info->protocol_config_array[i].server_addr = strdup((char*)result_content);
+                               EM_SAFE_FREE(result_content);
+                       }
+                       else {
+                               EM_DEBUG_EXCEPTION("xmlGetProp failed");
+                               server_info->protocol_config_array[i].server_addr = NULL;
+                       }
+               }
+               
+               if(xpath_obj_result_of_query) {
+                       xmlXPathFreeObject(xpath_obj_result_of_query);
+                       xpath_obj_result_of_query = NULL;
+               }
+               
+               /* searching server address in configuration-parameters element */
+                       
+               sprintf((char*)xpath_configuration_query, "/servicemine/configuration-parameters/configuration[@id=\"%s\"]/wap-provisioningdoc/characteristic/characteristic[@type=\"APPADDR\"]/characteristic[@type=\"PORT\"]/parm", (char*)id_string);
+               EM_DEBUG_LOG("[%s]", xpath_configuration_query);
+               
+               xpath_obj_result_of_query = xmlXPathEvalExpression(xpath_configuration_query, xpath_context);
+               if(xpath_obj_result_of_query == NULL) {
+                       EM_DEBUG_EXCEPTION(" unable to evaluate xpath expression [%s]", (char*)xpath_configuration_query);
+                       ret_code = EMF_ERROR_UNKNOWN;
+                       goto FINISH_OFF;
+               }
+                       
+               if(xpath_obj_result_of_query->nodesetval->nodeNr > 0 && xpath_obj_result_of_query->nodesetval->nodeTab) {
+                       result_content = xmlGetProp(xpath_obj_result_of_query->nodesetval->nodeTab[0] , (const xmlChar *)"value");
+                       if(result_content) {
+                               EM_DEBUG_LOG("result_content [%s]", (char*)result_content);
+                               server_info->protocol_config_array[i].port_number = atoi((char*)result_content);
+                               EM_SAFE_FREE(result_content);
+                       }
+                       else {
+                               EM_DEBUG_EXCEPTION("xmlGetProp failed");
+                               server_info->protocol_config_array[i].port_number = 0;
+                       }
+               }
+               
+               if(xpath_obj_result_of_query) {
+                       xmlXPathFreeObject(xpath_obj_result_of_query);
+                       xpath_obj_result_of_query = NULL;
+               }
+               
+               EM_SAFE_FREE(xpath_configuration_query);
+               EM_SAFE_FREE(id_string);
+       }       
+
+       *result_server_info = server_info;
+
+FINISH_OFF: 
+
+       if(doc)
+               xmlFreeDoc(doc);
+               
+       if(xpath_context)
+               xmlXPathFreeContext(xpath_context); 
+               
+       if(xpath_obj_service)
+           xmlXPathFreeObject(xpath_obj_service);
+               
+       if(xpath_obj_configuration)
+               xmlXPathFreeObject(xpath_obj_configuration);
+               
+       if(xpath_obj_result_of_query) {
+               xmlXPathFreeObject(xpath_obj_result_of_query);
+               xpath_obj_result_of_query = NULL;
+       }
+
+       xmlCleanupParser(); /* Cleanup function for the XML library. */
+
+       EM_DEBUG_FUNC_END("ret_code [%d]", ret_code);
+       return ret_code;
+}
+
+#endif /*  __FEATURE_WDS_SUPPORT__ */
+
+
+INTERNAL_FUNC int emcore_query_server_info(const char* domain_name, emf_server_info_t **result_server_info)
+{
+       EM_DEBUG_FUNC_BEGIN("domain_name [%s], result_server_info [%p]", domain_name, result_server_info);
+       int ret_code = EMF_ERROR_NONE;
+#ifdef __FEATURE_WDS_SUPPORT__ 
+       char *result_file_path = NULL;
+
+       if( (ret_code = emcore_fetch_server_info_from_wds(domain_name, &result_file_path)) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("emcore_fetch_server_info_from_wds failed");
+               goto FINISH_OFF;
+       }
+
+       if(result_file_path) {
+               if( (ret_code = emcore_parse_server_info_from_wds(result_file_path, result_server_info)) != EMF_ERROR_NONE) {
+                       EM_DEBUG_EXCEPTION("emcore_parse_server_info_from_wds failed");
+                       goto FINISH_OFF;
+               }
+       }
+
+FINISH_OFF: 
+       EM_SAFE_FREE(result_file_path);
+#endif /*  __FEATURE_WDS_SUPPORT__ */
+       EM_DEBUG_FUNC_END("ret_code [%d]", ret_code);
+       return ret_code;
+}
+
+
+INTERNAL_FUNC int emcore_free_server_info(emf_server_info_t **target_server_info)
+{
+       EM_DEBUG_FUNC_BEGIN("result_server_info [%p]", target_server_info);
+       int i, ret_code = EMF_ERROR_NONE;
+       emf_server_info_t *server_info = NULL;
+
+       if(target_server_info && *target_server_info) {
+               server_info = *target_server_info;
+               EM_SAFE_FREE(server_info->service_name);
+               for(i = 0; i < server_info->protocol_conf_count; i++) {
+                       EM_SAFE_FREE(server_info->protocol_config_array[i].server_addr);
+               }
+               EM_SAFE_FREE(server_info->protocol_config_array);
+               EM_SAFE_FREE(server_info);
+       }
+       EM_DEBUG_FUNC_END("ret_code [%d]", ret_code);
+       return ret_code;        
+}
+
+INTERNAL_FUNC int emcore_save_default_account_id(int input_account_id)
+{
+       EM_DEBUG_FUNC_BEGIN("account_id [%d]", input_account_id);
+       int ret_code = EMF_ERROR_NONE, result_value = 0;
+
+       result_value = vconf_set_int(VCONF_KEY_DEFAULT_ACCOUNT_ID, input_account_id);
+       if (result_value < 0) {
+               EM_DEBUG_EXCEPTION("vconf_set_int failed [%d]", result_value);
+               ret_code = EMF_ERROR_SYSTEM_FAILURE;
+       }
+
+       EM_DEBUG_FUNC_END("ret_code [%d]", ret_code);
+       return ret_code;        
+}
+
+INTERNAL_FUNC int emcore_load_default_account_id(int *output_account_id)
+{
+       EM_DEBUG_FUNC_BEGIN("account_id [%p]", output_account_id);
+       int ret_code = EMF_ERROR_NONE, result_value = 0;
+       
+       if (output_account_id == NULL) {
+               ret_code = EMF_ERROR_INVALID_PARAM;
+               goto FINISH_OFF;
+       }
+
+       result_value = vconf_get_int(VCONF_KEY_DEFAULT_ACCOUNT_ID, output_account_id);
+
+       if (result_value < 0) {
+               EM_DEBUG_EXCEPTION("vconf_get_int() failed [%d]", result_value);
+               ret_code = EMF_ERROR_SYSTEM_FAILURE;
+               *output_account_id = 0;
+       }
+
+FINISH_OFF: 
+       
+       EM_DEBUG_FUNC_END("ret_code [%d]", ret_code);
+       return ret_code;        
+}
diff --git a/email-core/email-core-api.c b/email-core/email-core-api.c
new file mode 100755 (executable)
index 0000000..14a1cac
--- /dev/null
@@ -0,0 +1,94 @@
+/*\r
+*  email-service\r
+*\r
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+*\r
+* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com>\r
+* \r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+* http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License.\r
+*\r
+*/\r
+\r
+\r
+/******************************************************************************\r
+ * File :  email-core-api.h\r
+ * Desc :  Mail Engine API\r
+ *\r
+ * Auth : \r
+ *\r
+ * History : \r
+ *    2006.08.16  :  created\r
+ *****************************************************************************/\r
+#include <stdio.h>\r
+#include <string.h>\r
+#include <stdlib.h>\r
+\r
+#include "c-client.h"\r
+#include "email-core-global.h"\r
+#include "email-network.h"\r
+#include "email-core-event.h"\r
+#include "email-core-mailbox.h"\r
+#include "email-core-utils.h"\r
+#include "email-debug-log.h"\r
+\r
+extern void *\r
+pop3_parameters(long function, void *value);\r
+extern void *\r
+imap_parameters(long function, void *value);\r
+\r
+\r
+\r
+/* initialize mail core */\r
+INTERNAL_FUNC int emcore_init(int *err_code)\r
+{\r
+       EM_DEBUG_FUNC_BEGIN();\r
+\r
+       if (err_code != NULL) {\r
+               *err_code = EMF_ERROR_NONE;\r
+       }\r
+\r
+       mail_link(&imapdriver);  /*  link in the imap driver  */\r
+       mail_link(&pop3driver);  /*  link in the pop3 driver  */\r
+\r
+       mail_link(&unixdriver);  /*  link in the unix driver  */\r
+       mail_link(&dummydriver); /*  link in the dummy driver  */\r
+\r
+       ssl_onceonlyinit();\r
+\r
+       auth_link(&auth_md5);    /*  link in the md5 authenticator  */\r
+       auth_link(&auth_pla);    /*  link in the pla authenticator  */\r
+       auth_link(&auth_log);    /*  link in the log authenticator  */\r
+\r
+       /* Disabled to authenticate with plain text */\r
+       mail_parameters(NIL, SET_DISABLEPLAINTEXT, (void *) 2);\r
+\r
+       /* Set max trials for login */\r
+       imap_parameters(SET_MAXLOGINTRIALS, (void *)1);\r
+       pop3_parameters(SET_MAXLOGINTRIALS, (void *)1);\r
+       smtp_parameters(SET_MAXLOGINTRIALS, (void *)1);\r
+\r
+       mail_parameters(NIL, SET_SSLCERTIFICATEQUERY, (void *)emnetwork_callback_ssl_cert_query);\r
+       mail_parameters(NIL, SET_SSLCAPATH, (void *)SSL_CERT_DIRECTORY);\r
+\r
+       /* Set time out in second */\r
+       mail_parameters(NIL, SET_OPENTIMEOUT  , (void *)50);\r
+       mail_parameters(NIL, SET_READTIMEOUT  , (void *)180);\r
+       mail_parameters(NIL, SET_WRITETIMEOUT , (void *)180);\r
+       mail_parameters(NIL, SET_CLOSETIMEOUT , (void *)30);\r
+\r
+       if (err_code)\r
+               *err_code = EMF_ERROR_NONE;\r
+\r
+    return true;\r
+}\r
+\r
similarity index 61%
rename from email-core/em-core-event.c
rename to email-core/email-core-event.c
index 57f720d..90edd95 100755 (executable)
@@ -22,7 +22,7 @@
 
 
 /******************************************************************************
- * File :  em-core-event_data.h
+ * File :  email-core-event_data.h
  * Desc :  Mail Engine Event
  *
  * Auth : 
 #include <stdio.h>
 #include <glib.h>
 #include <malloc.h>
+#include <pthread.h>
 #include <vconf.h>
-
 #include <signal.h>
 #include <contacts-svc.h>
-#include "Msg_Convert.h"
 #include "c-client.h"
-#include "em-storage.h"
-#include "em-network.h"
-#include "emf-auto-poll.h"
-#include "em-core-global.h"
-#include "em-core-account.h"
-#include "em-core-event.h"
-#include "em-core-utils.h"
-#include "em-core-mailbox.h"
-#include "em-core-imap-mailbox.h"
-#include "em-core-mesg.h"
-#include "em-core-mailbox-sync.h"
-#include "em-core-smtp.h"
-#include "em-core-utils.h"
-#include "em-core-sound.h"
-#include "emf-dbglog.h"
+#include "email-convert.h"
+#include "email-storage.h"
+#include "email-network.h"
+#include "email-device.h"
+#include "email-utilities.h"
+#include "email-daemon-auto-poll.h"
+#include "email-core-global.h"
+#include "email-core-account.h"
+#include "email-core-event.h"
+#include "email-core-utils.h"
+#include "email-core-mailbox.h"
+#include "email-core-imap-mailbox.h"
+#include "email-core-mail.h"
+#include "email-core-mailbox-sync.h"
+#include "email-core-smtp.h"
+#include "email-core-utils.h"
+#include "email-core-sound.h"
+#include "email-debug-log.h"
 
 
 #ifdef __FEATURE_PARTIAL_BODY_DOWNLOAD__
@@ -71,35 +73,24 @@ static int g_partial_body_thd_queue_full = false;                   /* Variable to determine if
 static int g_pb_thd_local_activity_continue = true;                    /* Variable to control local activity sync */
 int g_pbd_thd_state = false;                                                           /* false :  thread is sleeping , true :  thread is working */
 
-#ifdef __FEATURE_USE_PTHREAD__
 static pthread_mutex_t _partial_body_thd_event_queue_lock = PTHREAD_MUTEX_INITIALIZER; /* Mutex to protect event queue */
 static pthread_cond_t  _partial_body_thd_cond = PTHREAD_COND_INITIALIZER;                              /* Condition variable on which partial body thread is waiting  */
 thread_t g_partial_body_thd ;                                                          /* Determines if thread is created or not. Non Null means thread is created */
-#else /*  __FEATURE_USE_PTHREAD__ */
-static GMutex *_partial_body_thd_event_queue_lock = NULL;      /* Mutex to protect event queue */
-static GCond *_partial_body_thd_cond = NULL;                           /* Condition variable on which partial body thread is waiting  */
-thread_t g_partial_body_thd = NULL;                                                    /* Determines if thread is created or not. Non Null means thread is created */
-#endif /*  __FEATURE_USE_PTHREAD__ */
 
 emf_event_partial_body_thd g_partial_body_bulk_dwd_que[BULK_PARTIAL_BODY_DOWNLOAD_COUNT];
 static int g_partial_body_bulk_dwd_next_event_idx = 0;         /* Index of Next Event to be processed in the queue*/
 static int g_partial_body_bulk_dwd_queue_empty = true;
 
-#ifdef __FEATURE_USE_PTHREAD__
 static pthread_mutex_t _state_variables_lock;
-#else /*  __FEATURE_USE_PTHREAD__ */
-static GMutex *_state_variables_lock = NULL;   /*Mutex for maintaining credibility of state variable  */
-#endif /*  __FEATURE_USE_PTHREAD__ */
-
 
 /*[h.gahlaut] - All static function declaration for partial body download thread are done here */
 
-static int em_core_retrieve_partial_body_thread_event(emf_event_partial_body_thd *partial_body_thd_event, int *error_code);
-static int em_core_copy_partial_body_thd_event(emf_event_partial_body_thd *src, emf_event_partial_body_thd *dest, int *error_code);
-static void em_core_pb_thd_set_local_activity_continue(int flag);
-static int em_core_set_pbd_thd_state(int flag);
-static int em_core_clear_bulk_pbd_que(int *err_code);
-int em_core_mail_partial_body_download(emf_event_partial_body_thd *pbd_event, int *error_code);
+static int emcore_retrieve_partial_body_thread_event(emf_event_partial_body_thd *partial_body_thd_event, int *error_code);
+static int emcore_copy_partial_body_thd_event(emf_event_partial_body_thd *src, emf_event_partial_body_thd *dest, int *error_code);
+static void emcore_pb_thd_set_local_activity_continue(int flag);
+static int emcore_set_pbd_thd_state(int flag);
+static int emcore_clear_bulk_pbd_que(int *err_code);
+int emcore_mail_partial_body_download(emf_event_partial_body_thd *pbd_event, int *error_code);
 
 #endif
 
@@ -107,12 +98,12 @@ int em_core_mail_partial_body_download(emf_event_partial_body_thd *pbd_event, in
 extern int g_imap_idle_thread_alive;
 extern int imap_idle_thread;
 #endif /* ENABLE_IMAP_IDLE_THREAD */
-EXPORT_API int g_client_count = 0;
-EXPORT_API int g_client_run = 0 ;
+INTERNAL_FUNC int g_client_count = 0;
+INTERNAL_FUNC int g_client_run = 0 ;
 
-#ifdef __LOCAL_ACTIVITY__
-EXPORT_API int g_local_activity_run = 0;
-EXPORT_API int g_save_local_activity_run = 0;
+#ifdef __FEATURE_LOCAL_ACTIVITY__
+INTERNAL_FUNC int g_local_activity_run = 0;
+INTERNAL_FUNC int g_save_local_activity_run = 0;
 #endif
 
 
@@ -125,41 +116,24 @@ typedef struct EVENT_CALLBACK_ELEM
        struct EVENT_CALLBACK_ELEM *next;
 } EVENT_CALLBACK_LIST;
 
-#ifdef __FEATURE_USE_PTHREAD__
 static pthread_mutex_t _event_available_lock = PTHREAD_MUTEX_INITIALIZER;
 static pthread_cond_t  _event_available_signal = PTHREAD_COND_INITIALIZER;
 static pthread_mutex_t *_event_queue_lock = NULL;              
 static pthread_mutex_t *_event_callback_table_lock = NULL;
-#else /*  __FEATURE_USE_PTHREAD__ */
-static GMutex *_event_available_lock = NULL;
-static GCond *_event_available_signal = NULL;
-static GStaticRecMutex _event_queue_lock;              
-static GStaticRecMutex _event_callback_table_lock;
-#endif /*  __FEATURE_USE_PTHREAD__ */
 static EVENT_CALLBACK_LIST *_event_callback_table[EMF_ACTION_NUM];             /*  array of singly-linked list for event callbacks */
 
 void *thread_func_branch_command(void *arg);
 
-
 static emf_event_t g_event_que[EVENT_QUEUE_MAX];
 
 int send_thread_run = 0;
 int recv_thread_run = 0;
 
-#ifdef __FEATURE_USE_PTHREAD__
 static pthread_mutex_t _send_event_available_lock = PTHREAD_MUTEX_INITIALIZER;
 static pthread_mutex_t *_send_event_queue_lock = NULL;  /*  MUST BE "recursive" */
 static pthread_cond_t  _send_event_available_signal = PTHREAD_COND_INITIALIZER;
 static thread_t g_send_srv_thread;
 static thread_t g_srv_thread;
-#else /*  __FEATURE_USE_PTHREAD__ */
-static GMutex *_send_event_available_lock = NULL;
-static GStaticRecMutex _send_event_queue_lock;  /*  MUST BE "recursive" */
-static GCond *_send_event_available_signal = NULL;
-static thread_t g_send_srv_thread = NULL;
-static thread_t g_srv_thread = NULL;
-#endif /*  __FEATURE_USE_PTHREAD__ */
-
 
 static emf_event_t g_send_event_que[EVENT_QUEUE_MAX];
 static int g_send_event_que_idx = 1;
@@ -172,7 +146,7 @@ static int g_sending_busy_cnt = 0;
 static int g_receiving_busy_cnt = 0;
 
 
-EXPORT_API int em_core_get_current_thread_type()
+INTERNAL_FUNC int emcore_get_current_thread_type()
 {
        EM_DEBUG_FUNC_BEGIN();
        thread_t thread_id = THREAD_SELF();
@@ -198,7 +172,7 @@ static int is_gdk_lock_needed()
        return false;
 }
 
-EXPORT_API int em_core_get_pending_event(emf_action_t action, int account_id, int mail_id, emf_event_status_type_t *status)
+INTERNAL_FUNC int emcore_get_pending_event(emf_action_t action, int account_id, int mail_id, emf_event_status_type_t *status)
 {
        EM_DEBUG_FUNC_BEGIN("action[%d], account_id[%d], mail_id[%d]", action, account_id, mail_id);
        
@@ -216,12 +190,6 @@ EXPORT_API int em_core_get_pending_event(emf_action_t action, int account_id, in
                                        goto EXIT;
                                }
                                break;
-                       case EMF_EVENT_SAVE_MAIL: 
-                               if (action == EMF_ACTION_SAVE_MAIL && account_id == g_event_que[i].account_id && mail_id == g_event_que[i].event_param_data_4) {
-                                       found = true;
-                                       goto EXIT;
-                               }
-                               break;
                        
                        case EMF_EVENT_SYNC_HEADER: 
                                if (action == EMF_ACTION_SYNC_HEADER && account_id == g_event_que[i].account_id) {
@@ -311,7 +279,6 @@ EXPORT_API int em_core_get_pending_event(emf_action_t action, int account_id, in
                                }
                                break;
                        
-                       case EMF_EVENT_UPDATE_MAIL_OLD: 
                        case EMF_EVENT_UPDATE_MAIL:
                                if (action == EMF_ACTION_UPDATE_MAIL)  {
                                        found = true;
@@ -344,7 +311,7 @@ EXIT:
        return FAILURE;
 }
 
-EXPORT_API void em_core_get_event_queue_status(int *on_sending, int *on_receiving)
+INTERNAL_FUNC void emcore_get_event_queue_status(int *on_sending, int *on_receiving)
 {
        if (on_sending != NULL)
                *on_sending = g_sending_busy_cnt;
@@ -382,62 +349,61 @@ static void waiting_status_notify(emf_event_t *event_data, int queue_idx)
                        
        switch (event_data->type)  {
                case EMF_EVENT_SEND_MAIL: 
-                       em_core_execute_event_callback(EMF_ACTION_SEND_MAIL, 0, 0, EMF_SEND_WAITING, account_id, mail_id, queue_idx, EMF_ERROR_NONE);
+                       emcore_execute_event_callback(EMF_ACTION_SEND_MAIL, 0, 0, EMF_SEND_WAITING, account_id, mail_id, queue_idx, EMF_ERROR_NONE);
                        break;
                
                case EMF_EVENT_SYNC_HEADER: 
-                       em_core_execute_event_callback(EMF_ACTION_SYNC_HEADER, 0, 0, EMF_LIST_WAITING, account_id, 0, queue_idx, EMF_ERROR_NONE);
+                       emcore_execute_event_callback(EMF_ACTION_SYNC_HEADER, 0, 0, EMF_LIST_WAITING, account_id, 0, queue_idx, EMF_ERROR_NONE);
                        break;
 
                case EMF_EVENT_SYNC_HEADER_OMA:
-                       em_core_execute_event_callback(EMF_ACTION_SYNC_HEADER_OMA, 0, 0, EMF_LIST_WAITING, account_id, 0, queue_idx, EMF_ERROR_NONE);
+                       emcore_execute_event_callback(EMF_ACTION_SYNC_HEADER_OMA, 0, 0, EMF_LIST_WAITING, account_id, 0, queue_idx, EMF_ERROR_NONE);
                break;
                
                case EMF_EVENT_DOWNLOAD_BODY: 
-                       em_core_execute_event_callback(EMF_ACTION_DOWNLOAD_BODY, 0, 0, EMF_DOWNLOAD_WAITING, account_id, mail_id, queue_idx, EMF_ERROR_NONE);
+                       emcore_execute_event_callback(EMF_ACTION_DOWNLOAD_BODY, 0, 0, EMF_DOWNLOAD_WAITING, account_id, mail_id, queue_idx, EMF_ERROR_NONE);
                        break;
 
 #ifdef __FEATURE_SYNC_CLIENT_TO_SERVER__
                case EMF_EVENT_SYNC_MAIL_FLAG_TO_SERVER:
-                       em_core_execute_event_callback(EMF_ACTION_SYNC_MAIL_FLAG_TO_SERVER, 0, 0, EMF_SYNC_WAITING, account_id, mail_id, queue_idx, EMF_ERROR_NONE);
+                       emcore_execute_event_callback(EMF_ACTION_SYNC_MAIL_FLAG_TO_SERVER, 0, 0, EMF_SYNC_WAITING, account_id, mail_id, queue_idx, EMF_ERROR_NONE);
                        break;         
 #endif
                        
                case EMF_EVENT_DOWNLOAD_ATTACHMENT: 
-                       em_core_execute_event_callback(EMF_ACTION_DOWNLOAD_ATTACHMENT, 0, 0, EMF_DOWNLOAD_WAITING, account_id, mail_id, queue_idx, EMF_ERROR_NONE);
+                       emcore_execute_event_callback(EMF_ACTION_DOWNLOAD_ATTACHMENT, 0, 0, EMF_DOWNLOAD_WAITING, account_id, mail_id, queue_idx, EMF_ERROR_NONE);
                        break;
 
                case EMF_EVENT_DELETE_MAIL: 
                case EMF_EVENT_DELETE_MAIL_ALL:
-                       em_core_execute_event_callback(EMF_ACTION_DELETE_MAIL, 0, 0, EMF_DELETE_WAITING, account_id, 0, queue_idx, EMF_ERROR_NONE);
+                       emcore_execute_event_callback(EMF_ACTION_DELETE_MAIL, 0, 0, EMF_DELETE_WAITING, account_id, 0, queue_idx, EMF_ERROR_NONE);
                        break;
 
                case EMF_EVENT_VALIDATE_ACCOUNT: 
-                       em_core_execute_event_callback(EMF_ACTION_VALIDATE_ACCOUNT, 0, 0, EMF_VALIDATE_ACCOUNT_WAITING, account_id, 0, queue_idx, EMF_ERROR_NONE);
+                       emcore_execute_event_callback(EMF_ACTION_VALIDATE_ACCOUNT, 0, 0, EMF_VALIDATE_ACCOUNT_WAITING, account_id, 0, queue_idx, EMF_ERROR_NONE);
                        break;
 
                case EMF_EVENT_VALIDATE_AND_CREATE_ACCOUNT: 
-                       em_core_execute_event_callback(EMF_ACTION_VALIDATE_AND_CREATE_ACCOUNT, 0, 0, EMF_VALIDATE_ACCOUNT_WAITING, account_id, 0, queue_idx, EMF_ERROR_NONE);
+                       emcore_execute_event_callback(EMF_ACTION_VALIDATE_AND_CREATE_ACCOUNT, 0, 0, EMF_VALIDATE_ACCOUNT_WAITING, account_id, 0, queue_idx, EMF_ERROR_NONE);
                        break;
 
                case EMF_EVENT_MOVE_MAIL: 
-                       em_core_execute_event_callback(EMF_ACTION_MOVE_MAIL, 0, 0, EMF_LIST_WAITING, account_id, 0, queue_idx, EMF_ERROR_NONE);
+                       emcore_execute_event_callback(EMF_ACTION_MOVE_MAIL, 0, 0, EMF_LIST_WAITING, account_id, 0, queue_idx, EMF_ERROR_NONE);
                        break;
 
                case EMF_EVENT_CREATE_MAILBOX: 
-                       em_core_execute_event_callback(EMF_ACTION_CREATE_MAILBOX, 0, 0, EMF_LIST_WAITING, account_id, 0, queue_idx, EMF_ERROR_NONE);
+                       emcore_execute_event_callback(EMF_ACTION_CREATE_MAILBOX, 0, 0, EMF_LIST_WAITING, account_id, 0, queue_idx, EMF_ERROR_NONE);
                        break;
 
                case EMF_EVENT_VALIDATE_AND_UPDATE_ACCOUNT: 
-                       em_core_execute_event_callback(EMF_ACTION_VALIDATE_AND_UPDATE_ACCOUNT, 0, 0, EMF_VALIDATE_ACCOUNT_WAITING, account_id, 0, queue_idx, EMF_ERROR_NONE);
+                       emcore_execute_event_callback(EMF_ACTION_VALIDATE_AND_UPDATE_ACCOUNT, 0, 0, EMF_VALIDATE_ACCOUNT_WAITING, account_id, 0, queue_idx, EMF_ERROR_NONE);
                        break;
 
-               case EMF_EVENT_UPDATE_MAIL_OLD: 
                case EMF_EVENT_UPDATE_MAIL:
                        break;
 
                case EMF_EVENT_SET_MAIL_SLOT_SIZE: 
-                       em_core_execute_event_callback(EMF_ACTION_SET_MAIL_SLOT_SIZE, 0, 0, EMF_SET_SLOT_SIZE_WAITING, account_id, 0, queue_idx, EMF_ERROR_NONE);
+                       emcore_execute_event_callback(EMF_ACTION_SET_MAIL_SLOT_SIZE, 0, 0, EMF_SET_SLOT_SIZE_WAITING, account_id, 0, queue_idx, EMF_ERROR_NONE);
                        break;
                default: 
                        break;
@@ -462,60 +428,59 @@ static void fail_status_notify(emf_event_t *event_data, int error)
        switch (event_data->type)  {
                case EMF_EVENT_SEND_MAIL: 
                        /* case EMF_EVENT_SEND_MAIL_SAVED:  */
-                       /* em_core_execute_event_callback(EMF_ACTION_SEND_MAIL, 0, 0, EMF_SEND_FAIL, account_id, mail_id, -1, error); */
-                       em_core_show_popup(mail_id, EMF_ACTION_SEND_MAIL, error);
+                       /* emcore_execute_event_callback(EMF_ACTION_SEND_MAIL, 0, 0, EMF_SEND_FAIL, account_id, mail_id, -1, error); */
+                       emcore_show_popup(mail_id, EMF_ACTION_SEND_MAIL, error);
                        break;
                
                case EMF_EVENT_SYNC_HEADER: 
-                       em_core_execute_event_callback(EMF_ACTION_SYNC_HEADER, 0, 0, EMF_LIST_FAIL, account_id, 0, -1, error);
-                       em_core_show_popup(account_id, EMF_ACTION_SYNC_HEADER, error);
+                       emcore_execute_event_callback(EMF_ACTION_SYNC_HEADER, 0, 0, EMF_LIST_FAIL, account_id, 0, -1, error);
+                       emcore_show_popup(account_id, EMF_ACTION_SYNC_HEADER, error);
                        break;
                
                case EMF_EVENT_DOWNLOAD_BODY: 
-                       em_core_execute_event_callback(EMF_ACTION_DOWNLOAD_BODY, 0, 0, EMF_DOWNLOAD_FAIL, account_id, mail_id, -1, error);
-                       em_core_show_popup(account_id, EMF_ACTION_DOWNLOAD_BODY, error);
+                       emcore_execute_event_callback(EMF_ACTION_DOWNLOAD_BODY, 0, 0, EMF_DOWNLOAD_FAIL, account_id, mail_id, -1, error);
+                       emcore_show_popup(account_id, EMF_ACTION_DOWNLOAD_BODY, error);
                        break;
                
                case EMF_EVENT_DOWNLOAD_ATTACHMENT: 
-                       em_core_execute_event_callback(EMF_ACTION_DOWNLOAD_ATTACHMENT, 0, 0, EMF_DOWNLOAD_FAIL, account_id, mail_id, -1, error);
-                       em_core_show_popup(account_id, EMF_ACTION_DOWNLOAD_ATTACHMENT, error);
+                       emcore_execute_event_callback(EMF_ACTION_DOWNLOAD_ATTACHMENT, 0, 0, EMF_DOWNLOAD_FAIL, account_id, mail_id, -1, error);
+                       emcore_show_popup(account_id, EMF_ACTION_DOWNLOAD_ATTACHMENT, error);
                        break;
                
                case EMF_EVENT_DELETE_MAIL: 
                case EMF_EVENT_DELETE_MAIL_ALL:
-                       em_core_execute_event_callback(EMF_ACTION_DELETE_MAIL, 0, 0, EMF_DELETE_FAIL, account_id, 0, -1, error);
-                       em_core_show_popup(account_id, EMF_ACTION_DELETE_MAIL, error);
+                       emcore_execute_event_callback(EMF_ACTION_DELETE_MAIL, 0, 0, EMF_DELETE_FAIL, account_id, 0, -1, error);
+                       emcore_show_popup(account_id, EMF_ACTION_DELETE_MAIL, error);
                        break;
 
                case EMF_EVENT_VALIDATE_ACCOUNT: 
-                       em_core_execute_event_callback(EMF_ACTION_VALIDATE_ACCOUNT, 0, 0, EMF_VALIDATE_ACCOUNT_FAIL, account_id, 0, -1, error);
-                       em_core_show_popup(account_id, EMF_ACTION_VALIDATE_ACCOUNT, error);
+                       emcore_execute_event_callback(EMF_ACTION_VALIDATE_ACCOUNT, 0, 0, EMF_VALIDATE_ACCOUNT_FAIL, account_id, 0, -1, error);
+                       emcore_show_popup(account_id, EMF_ACTION_VALIDATE_ACCOUNT, error);
                        break;
 
                case EMF_EVENT_VALIDATE_AND_CREATE_ACCOUNT: 
-                       em_core_execute_event_callback(EMF_ACTION_VALIDATE_AND_CREATE_ACCOUNT, 0, 0, EMF_VALIDATE_ACCOUNT_FAIL, account_id, 0, -1, error);
-                       em_core_show_popup(account_id, EMF_ACTION_VALIDATE_AND_CREATE_ACCOUNT, error);
+                       emcore_execute_event_callback(EMF_ACTION_VALIDATE_AND_CREATE_ACCOUNT, 0, 0, EMF_VALIDATE_ACCOUNT_FAIL, account_id, 0, -1, error);
+                       emcore_show_popup(account_id, EMF_ACTION_VALIDATE_AND_CREATE_ACCOUNT, error);
                        break;
 
                case EMF_EVENT_CREATE_MAILBOX: 
-                       em_core_execute_event_callback(EMF_ACTION_CREATE_MAILBOX, 0, 0, EMF_LIST_FAIL, account_id, 0, -1, error);
-                       em_core_show_popup(account_id, EMF_ACTION_CREATE_MAILBOX, error);
+                       emcore_execute_event_callback(EMF_ACTION_CREATE_MAILBOX, 0, 0, EMF_LIST_FAIL, account_id, 0, -1, error);
+                       emcore_show_popup(account_id, EMF_ACTION_CREATE_MAILBOX, error);
                        break;
                case EMF_EVENT_DELETE_MAILBOX: 
-                       em_core_execute_event_callback(EMF_ACTION_DELETE_MAILBOX, 0, 0, EMF_LIST_FAIL, account_id, 0, -1, error);
-                       em_core_show_popup(account_id, EMF_ACTION_DELETE_MAILBOX, error);
+                       emcore_execute_event_callback(EMF_ACTION_DELETE_MAILBOX, 0, 0, EMF_LIST_FAIL, account_id, 0, -1, error);
+                       emcore_show_popup(account_id, EMF_ACTION_DELETE_MAILBOX, error);
                        break;
 
                case EMF_EVENT_VALIDATE_AND_UPDATE_ACCOUNT: 
-                       em_core_execute_event_callback(EMF_ACTION_VALIDATE_AND_UPDATE_ACCOUNT, 0, 0, EMF_VALIDATE_ACCOUNT_FAIL, account_id, 0, -1, error);
-                       em_core_show_popup(account_id, EMF_ACTION_VALIDATE_AND_UPDATE_ACCOUNT, error);
+                       emcore_execute_event_callback(EMF_ACTION_VALIDATE_AND_UPDATE_ACCOUNT, 0, 0, EMF_VALIDATE_ACCOUNT_FAIL, account_id, 0, -1, error);
+                       emcore_show_popup(account_id, EMF_ACTION_VALIDATE_AND_UPDATE_ACCOUNT, error);
                        break;
 
                case EMF_EVENT_SET_MAIL_SLOT_SIZE: 
-                       em_core_execute_event_callback(EMF_ACTION_SET_MAIL_SLOT_SIZE, 0, 0, EMF_SET_SLOT_SIZE_FAIL, account_id, 0, -1, EMF_ERROR_NONE);
+                       emcore_execute_event_callback(EMF_ACTION_SET_MAIL_SLOT_SIZE, 0, 0, EMF_SET_SLOT_SIZE_FAIL, account_id, 0, -1, EMF_ERROR_NONE);
                        break;
                        
-               case EMF_EVENT_UPDATE_MAIL_OLD: 
                case EMF_EVENT_UPDATE_MAIL:
                        break;
                        
@@ -526,7 +491,7 @@ static void fail_status_notify(emf_event_t *event_data, int error)
 }
 
 
-static void em_core_initialize_event_callback_table()
+static void emcore_initialize_event_callback_table()
 {
        ENTER_RECURSIVE_CRITICAL_SECTION(_event_callback_table_lock);
        
@@ -538,7 +503,7 @@ static void em_core_initialize_event_callback_table()
        LEAVE_RECURSIVE_CRITICAL_SECTION(_event_callback_table_lock);
 }
 
-int em_core_register_event_callback(emf_action_t action, emf_event_callback callback, void *event_data)
+int emcore_register_event_callback(emf_action_t action, emf_event_callback callback, void *event_data)
 {
        EM_DEBUG_FUNC_BEGIN("action[%d], callback[%p], event_data[%p]", action, callback, event_data);
        
@@ -579,7 +544,7 @@ EXIT :
        return ret;
 }
 
-int em_core_unregister_event_callback(emf_action_t action, emf_event_callback callback)
+int emcore_unregister_event_callback(emf_action_t action, emf_event_callback callback)
 {
        EM_DEBUG_FUNC_BEGIN("action[%d], callback[%p]", action, callback);
 
@@ -615,7 +580,7 @@ int em_core_unregister_event_callback(emf_action_t action, emf_event_callback ca
        return ret;
 }
 
-void em_core_execute_event_callback(emf_action_t action, int total, int done, int status, int account_id, int mail_id, int handle, int error)
+void emcore_execute_event_callback(emf_action_t action, int total, int done, int status, int account_id, int mail_id, int handle, int error)
 {
        EM_DEBUG_FUNC_BEGIN("action[%d], total[%d], done[%d], status[%d], account_id[%d], mail_id[%d], handle[%d], error[%d]", action, total, done, status, account_id, mail_id, handle, error);
        
@@ -632,7 +597,7 @@ void em_core_execute_event_callback(emf_action_t action, int total, int done, in
        
        while (node != NULL)  {
                if (node->callback != NULL)
-                       node->callback(total, done, status, account_id, mail_id, (handle == -1 ? em_core_get_active_queue_idx()  :  handle), node->event_data, error);
+                       node->callback(total, done, status, account_id, mail_id, (handle == -1 ? emcore_get_active_queue_idx()  :  handle), node->event_data, error);
                node = node->next;
        }
 
@@ -644,7 +609,7 @@ void em_core_execute_event_callback(emf_action_t action, int total, int done, in
 }
 
 /* insert a event to event queue */
-EXPORT_API int em_core_insert_event(emf_event_t *event_data, int *handle, int *err_code)
+INTERNAL_FUNC int emcore_insert_event(emf_event_t *event_data, int *handle, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("event_data[%p], handle[%p], err_code[%p]", event_data, handle, err_code);
        
@@ -715,7 +680,6 @@ EXPORT_API int em_core_insert_event(emf_event_t *event_data, int *handle, int *e
                                break;
                        
                        case EMF_EVENT_SYNC_HEADER: 
-                       case EMF_EVENT_SAVE_MAIL: 
                        case EMF_EVENT_DOWNLOAD_BODY: 
                        case EMF_EVENT_DOWNLOAD_ATTACHMENT: 
                        case EMF_EVENT_SYNC_MAIL_FLAG_TO_SERVER:
@@ -732,7 +696,6 @@ EXPORT_API int em_core_insert_event(emf_event_t *event_data, int *handle, int *e
                        case EMF_EVENT_DELETE_MAILBOX:  
                        case EMF_EVENT_VALIDATE_AND_UPDATE_ACCOUNT: 
                        case EMF_EVENT_SET_MAIL_SLOT_SIZE: 
-                       case EMF_EVENT_UPDATE_MAIL_OLD: 
                        case EMF_EVENT_UPDATE_MAIL:
                                _receiving_busy_ref();
                                break;
@@ -749,11 +712,11 @@ EXPORT_API int em_core_insert_event(emf_event_t *event_data, int *handle, int *e
        {
                int is_local_activity_event_inserted = false;
 
-               if (false == em_core_partial_body_thd_local_activity_sync(&is_local_activity_event_inserted, &error))
-                       EM_DEBUG_EXCEPTION("em_core_partial_body_thd_local_activity_sync failed [%d]", error);
+               if (false == emcore_partial_body_thd_local_activity_sync(&is_local_activity_event_inserted, &error))
+                       EM_DEBUG_EXCEPTION("emcore_partial_body_thd_local_activity_sync failed [%d]", error);
                else {
                        if (true == is_local_activity_event_inserted)
-                               em_core_pb_thd_set_local_activity_continue(false);
+                               emcore_pb_thd_set_local_activity_continue(false);
                }
        }
 #endif
@@ -766,7 +729,7 @@ EXPORT_API int em_core_insert_event(emf_event_t *event_data, int *handle, int *e
 }
 
 /* get a event from event_data queue */
-static int em_core_retrieve_event(emf_event_t *event_data, int *err_code)
+static int emcore_retrieve_event(emf_event_t *event_data, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("event_data[%p], err_code[%p]", event_data, err_code);
        
@@ -810,14 +773,14 @@ static int em_core_retrieve_event(emf_event_t *event_data, int *err_code)
 }
 
 /* check that event_data loop is continuous */
-static int em_core_event_loop_continue()
+static int emcore_event_loop_continue()
 {
     return g_event_loop;
 }
 
 
 
-EXPORT_API int em_core_insert_send_event(emf_event_t *event_data, int *handle, int *err_code)
+INTERNAL_FUNC int emcore_insert_send_event(emf_event_t *event_data, int *handle, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("event_data[%p], handle[%p], err_code[%p]", event_data, handle, err_code);
        
@@ -879,7 +842,7 @@ EXPORT_API int em_core_insert_send_event(emf_event_t *event_data, int *handle, i
        }
 
        if (handle)
-       EM_DEBUG_LOG("em_core_insert_send_event-handle[%d]", *handle);
+       EM_DEBUG_LOG("emcore_insert_send_event-handle[%d]", *handle);
 
        if (err_code != NULL)
                *err_code = error;
@@ -889,7 +852,7 @@ EXPORT_API int em_core_insert_send_event(emf_event_t *event_data, int *handle, i
 }
 
 
-static int em_core_retrieve_send_event(emf_event_t *event_data, int *err_code)
+static int emcore_retrieve_send_event(emf_event_t *event_data, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
        
@@ -933,43 +896,42 @@ static int em_core_retrieve_send_event(emf_event_t *event_data, int *err_code)
 }
 
 
-void*
-send_event_handler(void *arg)
+void* send_event_handler(void *arg)
 {
        EM_DEBUG_FUNC_BEGIN();
        int err = EMF_ERROR_NONE;
        emf_event_t event_data;
        emf_session_t *session = NULL;
 
-       if (!em_storage_open(&err))  {
-               EM_DEBUG_EXCEPTION("\t em_storage_open falied - %d", err);
+       if (!emstorage_open(&err))  {
+               EM_DEBUG_EXCEPTION("\t emstorage_open falied - %d", err);
                return NULL;
        }
 
        while (g_send_event_loop) {
-               if (!em_core_get_empty_session(&session)) 
-                       EM_DEBUG_EXCEPTION("\t SEND THREAD em_core_get_empty_session failed...");
+               if (!emcore_get_empty_session(&session)) 
+                       EM_DEBUG_EXCEPTION("\t SEND THREAD emcore_get_empty_session failed...");
 
-               if (!em_core_retrieve_send_event(&event_data, NULL))  {
+               if (!emcore_retrieve_send_event(&event_data, NULL))  {
                        EM_DEBUG_LOG(">>>> waiting for send event_data>>>>>>>>>");
-#ifdef __LOCAL_ACTIVITY__                      
+#ifdef __FEATURE_LOCAL_ACTIVITY__                      
                        if (send_thread_run && g_save_local_activity_run) {                     
-                               emf_mail_account_tbl_t *account_list = NULL;
+                               emstorage_account_tbl_t *account_list = NULL;
                                int count = 0, i;
-                               if (!em_storage_get_account_list(&count, &account_list, true, true, &err)) {
-                                       EM_DEBUG_LOG("\t em_storage_get_account_list failed - %d", err);
+                               if (!emstorage_get_account_list(&count, &account_list, true, true, &err)) {
+                                       EM_DEBUG_LOG("\t emstorage_get_account_list failed - %d", err);
                                }
                                else {
                                        for (i = 0; i < count; i++) {
-                                               if (em_core_save_local_activity_sync(account_list[i].account_id, &err)) {
+                                               if (emcore_save_local_activity_sync(account_list[i].account_id, &err)) {
                                                        EM_DEBUG_LOG("Found local activity...!");
                                                        EM_DEBUG_LOG("Resetting g_save_local_activity_run ");
                                                        g_save_local_activity_run = 0;
-                                                       em_core_clear_session(session);
+                                                       emcore_clear_session(session);
                                                }
                                        }
 
-                                       em_storage_free_account(&account_list, count, &err);
+                                       emstorage_free_account(&account_list, count, &err);
                                        
                                        if (!g_save_local_activity_run) {
                                                continue;
@@ -989,90 +951,79 @@ send_event_handler(void *arg)
                        g_client_run = 1;
                        emf_option_t *option = NULL;
 
-                       if (!em_core_check_network_status( &err))  {
-                               EM_DEBUG_EXCEPTION("em_core_check_network_status failed [%d]", err);
+                       if (!emnetwork_check_network_status( &err))  {
+                               EM_DEBUG_EXCEPTION("emnetwork_check_network_status failed [%d]", err);
                                
-                               if (event_data.type != EMF_EVENT_SAVE_MAIL) {
-                                       em_core_show_popup(event_data.event_param_data_4, EMF_ACTION_SEND_MAIL, err);
-                                       if (!em_storage_notify_network_event(NOTI_SEND_FAIL, event_data.account_id, NULL , event_data.event_param_data_4, err))
-                                               EM_DEBUG_EXCEPTION(" em_storage_notify_network_event [ NOTI_SEND_FAIL] Failed >>>> ");  
-                               }
+                               emcore_show_popup(event_data.event_param_data_4, EMF_ACTION_SEND_MAIL, err);
+                               if (!emstorage_notify_network_event(NOTI_SEND_FAIL, event_data.account_id, NULL , event_data.event_param_data_4, err))
+                                       EM_DEBUG_EXCEPTION(" emstorage_notify_network_event [ NOTI_SEND_FAIL] Failed >>>> ");
                                goto FINISH_OFF;                                
                        }
 
                        switch (event_data.type)  {
                                
-                               case EMF_EVENT_SAVE_MAIL: 
-                                       em_storage_dimming_on_off(false, NULL);
-#ifdef __FEATURE_SYNC_CLIENT_TO_SERVER__
-                                       if (!em_core_mail_sync_from_client_to_server(event_data.account_id, event_data.event_param_data_4, &err))
-                                               EM_DEBUG_EXCEPTION("em_core_mail_sync_from_client_to_server failed - %d", err);
-#endif
-                                       em_storage_dimming_on_off(true, NULL);
-                                       break;
-
                                case EMF_EVENT_SEND_MAIL: 
-                                       em_storage_dimming_on_off(false, NULL);
+                                       emdevice_set_dimming_on_off(false, NULL);
                                        option = (emf_option_t *)event_data.event_param_data_1;
                                        
-                                       if (!em_core_mail_send(event_data.account_id, event_data.event_param_data_3, event_data.event_param_data_4, option, &err))
-                                               EM_DEBUG_EXCEPTION("em_core_mail_send failed [%d]", err);
+                                       if (!emcore_send_mail(event_data.account_id, event_data.event_param_data_3, event_data.event_param_data_4, option, &err))
+                                               EM_DEBUG_EXCEPTION("emcore_send_mail failed [%d]", err);
                                        
                                        if (option)
                                                EM_SAFE_FREE(option->display_name_from);
-                                       em_storage_dimming_on_off(true, NULL);
+                                       emdevice_set_dimming_on_off(true, NULL);
                                        break;
                                        
                                case EMF_EVENT_SEND_MAIL_SAVED:  /* send mails to been saved in offline-mode */
-                                       em_storage_dimming_on_off(false, NULL);
+                                       emdevice_set_dimming_on_off(false, NULL);
                                        
                                        emf_option_t *option = (emf_option_t *)event_data.event_param_data_1;
                                                
-                                       if (!em_core_mail_send_saved(event_data.account_id, event_data.event_param_data_3, option, &err))
-                                               EM_DEBUG_EXCEPTION("em_core_mail_send_saved failed - %d", err);
+                                       if (!emcore_send_saved_mail(event_data.account_id, event_data.event_param_data_3, option, &err))
+                                               EM_DEBUG_EXCEPTION("emcore_send_saved_mail failed - %d", err);
                                        
                                        if (option)
                                                EM_SAFE_FREE(option->display_name_from);
                                                                                
-                                       em_storage_dimming_on_off(true, NULL);
+                                       emdevice_set_dimming_on_off(true, NULL);
                                        break;
-#ifdef __LOCAL_ACTIVITY__
+#ifdef __FEATURE_LOCAL_ACTIVITY__
                                        
                                        case EMF_EVENT_LOCAL_ACTIVITY: {
-                                               em_storage_dimming_on_off(false, NULL); 
-                                               emf_activity_tbl_t *local_activity = NULL;
+                                               emdevice_set_dimming_on_off(false, NULL);
+                                               emstorage_activity_tbl_t *local_activity = NULL;
                                                int activity_id_count = 0;
                                                int activity_chunk_count = 0;
                                                int *activity_id_list = NULL;
                                                int i = 0;
 
-                                               if (false == em_storage_get_activity_id_list(event_data.account_id, &activity_id_list, &activity_id_count, ACTIVITY_SAVEMAIL, ACTIVITY_DELETEMAIL_SEND, true, &err)) {
-                                                       EM_DEBUG_EXCEPTION("em_storage_get_activity_id_list failed [%d]", err);
+                                               if (false == emstorage_get_activity_id_list(event_data.account_id, &activity_id_list, &activity_id_count, ACTIVITY_SAVEMAIL, ACTIVITY_DELETEMAIL_SEND, true, &err)) {
+                                                       EM_DEBUG_EXCEPTION("emstorage_get_activity_id_list failed [%d]", err);
                                                }
                                                else {  
                                                        for (i = 0; i < activity_id_count; ++i) {
-                                                               if ((false == em_storage_get_activity(event_data.account_id, activity_id_list[i], &local_activity, &activity_chunk_count, true,  &err)) || (NULL == local_activity) || (0 == activity_chunk_count)) {
-                                                                       EM_DEBUG_EXCEPTION(" em_storage_get_activity Failed [ %d] or local_activity is NULL [%p] or activity_chunk_count is 0[%d]", err, local_activity, activity_chunk_count);
+                                                               if ((false == emstorage_get_activity(event_data.account_id, activity_id_list[i], &local_activity, &activity_chunk_count, true,  &err)) || (NULL == local_activity) || (0 == activity_chunk_count)) {
+                                                                       EM_DEBUG_EXCEPTION(" emstorage_get_activity Failed [ %d] or local_activity is NULL [%p] or activity_chunk_count is 0[%d]", err, local_activity, activity_chunk_count);
                                                                }
                                                                else {                                                  
                                                                        EM_DEBUG_LOG("Found local activity type - %d", local_activity[0].activity_type);
                                                                        switch (local_activity[0].activity_type) {                                                                      
                                                                                case ACTIVITY_SAVEMAIL:  {
-                                                                                       if (!em_core_mail_sync_from_client_to_server(event_data.account_id, local_activity[0].mail_id, &err)) {
-                                                                                               EM_DEBUG_EXCEPTION("em_core_mail_sync_from_client_to_server failed - %d ", err);
+                                                                                       if (!emcore_sync_mail_from_client_to_server(event_data.account_id, local_activity[0].mail_id, &err)) {
+                                                                                               EM_DEBUG_EXCEPTION("emcore_sync_mail_from_client_to_server failed - %d ", err);
                                                                                        }
                                                                                }
                                                                                break;
                                                                                
                                                                                case ACTIVITY_DELETEMAIL_SEND:                          /* New Activity Type Added for Race Condition and Crash Fix */ {
-                                                                                       if (!em_core_mail_delete(local_activity[0].account_id, 
+                                                                                       if (!emcore_delete_mail(local_activity[0].account_id, 
                                                                                                                                        &local_activity[0].mail_id, 
                                                                                                                                        EMF_DELETE_FOR_SEND_THREAD, 
                                                                                                                                        true, 
                                                                                                                                        EMF_DELETED_BY_COMMAND,
                                                                                                                                        false,
                                                                                                                                        &err))  {
-                                                                                               EM_DEBUG_LOG("\t em_core_mail_delete failed - %d", err);
+                                                                                               EM_DEBUG_LOG("\t emcore_delete_mail failed - %d", err);
                                                                                        }
                                                                                }
                                                                                break;
@@ -1083,7 +1034,7 @@ send_event_handler(void *arg)
                                                                                break;
                                                                        }
                                                                        
-                                                                       em_storage_free_local_activity(&local_activity, activity_chunk_count, NULL);
+                                                                       emstorage_free_local_activity(&local_activity, activity_chunk_count, NULL);
                                                                        
                                                                        if (g_save_local_activity_run == 1) {
                                                                                EM_DEBUG_LOG(" Network event_data found.. Local sync Stopped..! ");
@@ -1092,15 +1043,15 @@ send_event_handler(void *arg)
                                                                }
                                                                
                                                        }
-                                                       if (false == em_storage_free_activity_id_list(activity_id_list, &err)) {
-                                                               EM_DEBUG_LOG("em_storage_free_activity_id_list failed");
+                                                       if (false == emstorage_free_activity_id_list(activity_id_list, &err)) {
+                                                               EM_DEBUG_LOG("emstorage_free_activity_id_list failed");
                                                        }
                                                }
 
-                                               em_storage_dimming_on_off(true, NULL);
+                                               emdevice_set_dimming_on_off(true, NULL);
                                        }
                                        break;
-#endif /* __LOCAL_ACTIVITY__ */                                        
+#endif /* __FEATURE_LOCAL_ACTIVITY__ */                                        
                                default:  
                                        EM_DEBUG_LOG("Others not supported by Send Thread..! ");
                                        break;
@@ -1116,11 +1067,11 @@ send_event_handler(void *arg)
 FINISH_OFF: 
                        ;
                }
-               em_core_clear_session(session);
+               emcore_clear_session(session);
        }       
 
-       if (!em_storage_close(&err)) 
-               EM_DEBUG_EXCEPTION("em_storage_close falied [%d]", err);
+       if (!emstorage_close(&err)) 
+               EM_DEBUG_EXCEPTION("emstorage_close falied [%d]", err);
 
        EM_DEBUG_FUNC_END();
        return NULL;
@@ -1135,9 +1086,9 @@ int event_handler_EMF_EVENT_SYNC_HEADER(int input_account_id, char *input_mailbo
        int mailbox_count = 0, account_count = 0;
        int counter, account_index;
        int unread = 0, total_unread = 0;
-       em_core_uid_list *uid_list = NULL;
-       emf_mail_account_tbl_t *account_tbl_array = NULL;
-       emf_mailbox_tbl_t *mailbox_tbl_target = NULL, *mailbox_tbl_spam = NULL, *mailbox_tbl_list = NULL;
+       emcore_uid_list *uid_list = NULL;
+       emstorage_account_tbl_t *account_tbl_array = NULL;
+       emstorage_mailbox_tbl_t *mailbox_tbl_target = NULL, *mailbox_tbl_spam = NULL, *mailbox_tbl_list = NULL;
 #ifndef __FEATURE_KEEP_CONNECTION__
        MAILSTREAM *stream = NULL;
 #endif
@@ -1145,78 +1096,76 @@ int event_handler_EMF_EVENT_SYNC_HEADER(int input_account_id, char *input_mailbo
        if (input_mailbox_name == NULL)
                sync_type = EMF_SYNC_ALL_MAILBOX;
        else {
-               if (!em_storage_get_mailbox_by_name(input_account_id, -1, input_mailbox_name, &mailbox_tbl_target, true, &err) || !mailbox_tbl_target) {
-                       EM_DEBUG_EXCEPTION("em_storage_get_mailbox_by_name failed [%d]", err);  
+               if (!emstorage_get_mailbox_by_name(input_account_id, -1, input_mailbox_name, &mailbox_tbl_target, true, &err) || !mailbox_tbl_target) {
+                       EM_DEBUG_EXCEPTION("emstorage_get_mailbox_by_name failed [%d]", err);   
                        goto FINISH_OFF;
                }
        }
 
-       if (!em_storage_notify_network_event(NOTI_DOWNLOAD_START, input_account_id, input_mailbox_name,  handle_to_be_published, 0))
-               EM_DEBUG_EXCEPTION(" em_storage_notify_network_event [ NOTI_DOWNLOAD_START] Failed >>>> ");     
+       if (!emstorage_notify_network_event(NOTI_DOWNLOAD_START, input_account_id, input_mailbox_name,  handle_to_be_published, 0))
+               EM_DEBUG_EXCEPTION(" emstorage_notify_network_event [ NOTI_DOWNLOAD_START] Failed >>>> ");      
        
-       if (!em_core_check_network_status(&err)) {
-               EM_DEBUG_EXCEPTION("em_core_check_network_status failed [%d]", err);
+       if (!emnetwork_check_network_status(&err)) {
+               EM_DEBUG_EXCEPTION("emnetwork_check_network_status failed [%d]", err);
                
-               if (!em_storage_notify_network_event(NOTI_DOWNLOAD_FAIL, input_account_id, input_mailbox_name,  handle_to_be_published, err))
-                       EM_DEBUG_EXCEPTION(" em_storage_notify_network_event [ NOTI_DOWNLOAD_FAIL] Failed >>>> ");      
+               if (!emstorage_notify_network_event(NOTI_DOWNLOAD_FAIL, input_account_id, input_mailbox_name,  handle_to_be_published, err))
+                       EM_DEBUG_EXCEPTION(" emstorage_notify_network_event [ NOTI_DOWNLOAD_FAIL] Failed >>>> ");       
        }
        else  {
                if (sync_type != EMF_SYNC_ALL_MAILBOX) {        /* Sync only particular mailbox */
 
-                       if (!em_storage_update_sync_status_of_account(input_account_id, SET_TYPE_SET, SYNC_STATUS_SYNCING, true, &err)) 
-                               EM_DEBUG_EXCEPTION("em_storage_update_sync_status_of_account failed [%d]", err);
+                       if (!emstorage_update_sync_status_of_account(input_account_id, SET_TYPE_SET, SYNC_STATUS_SYNCING, true, &err)) 
+                               EM_DEBUG_EXCEPTION("emstorage_update_sync_status_of_account failed [%d]", err);
                        
-                       if (!em_storage_get_mailbox_by_mailbox_type(input_account_id, EMF_MAILBOX_TYPE_SPAMBOX, &mailbox_tbl_spam, false, &err)) {
-                               err = em_storage_get_emf_error_from_em_storage_error(err);
-                               EM_DEBUG_LOG("em_storage_get_mailbox_by_mailbox_type failed [%d]", err);
+                       if (!emstorage_get_mailbox_by_mailbox_type(input_account_id, EMF_MAILBOX_TYPE_SPAMBOX, &mailbox_tbl_spam, false, &err)) {
+               
+                               EM_DEBUG_LOG("emstorage_get_mailbox_by_mailbox_type failed [%d]", err);
                        }
 
-                       if (!em_core_mailbox_sync_header(mailbox_tbl_target, mailbox_tbl_spam, NULL, &uid_list, &unread, &err)) {
-                               EM_DEBUG_EXCEPTION("em_core_mailbox_sync_header failed [%d]", err);
-                               if (!em_storage_notify_network_event(NOTI_DOWNLOAD_FAIL, mailbox_tbl_target->account_id, mailbox_tbl_target->mailbox_name, handle_to_be_published, err))
-                                       EM_DEBUG_EXCEPTION(" em_storage_notify_network_event [NOTI_DOWNLOAD_FAIL] Failed >>>> ");       
+                       if (!emcore_sync_header(mailbox_tbl_target, mailbox_tbl_spam, NULL, &uid_list, &unread, &err)) {
+                               EM_DEBUG_EXCEPTION("emcore_sync_header failed [%d]", err);
+                               if (!emstorage_notify_network_event(NOTI_DOWNLOAD_FAIL, mailbox_tbl_target->account_id, mailbox_tbl_target->mailbox_name, handle_to_be_published, err))
+                                       EM_DEBUG_EXCEPTION(" emstorage_notify_network_event [NOTI_DOWNLOAD_FAIL] Failed >>>> ");        
                        }
                        else {
-                               EM_DEBUG_LOG("em_core_mailbox_sync_header succeeded [%d]", err);
-                               if (!em_storage_notify_network_event(NOTI_DOWNLOAD_FINISH, mailbox_tbl_target->account_id, mailbox_tbl_target->mailbox_name, handle_to_be_published, 0))
-                                       EM_DEBUG_EXCEPTION("em_storage_notify_network_event [NOTI_DOWNLOAD_FINISH] Failed >>>> ");      
+                               EM_DEBUG_LOG("emcore_sync_header succeeded [%d]", err);
+                               if (!emstorage_notify_network_event(NOTI_DOWNLOAD_FINISH, mailbox_tbl_target->account_id, mailbox_tbl_target->mailbox_name, handle_to_be_published, 0))
+                                       EM_DEBUG_EXCEPTION("emstorage_notify_network_event [NOTI_DOWNLOAD_FINISH] Failed >>>> ");       
                        }
 
                        total_unread = total_unread + unread;
 
-                       if (total_unread > 0 && !em_storage_update_sync_status_of_account(input_account_id, SET_TYPE_UNION, SYNC_STATUS_HAVE_NEW_MAILS, true, &err)) 
-                               EM_DEBUG_EXCEPTION("em_storage_update_sync_status_of_account failed [%d]", err);
+                       if (total_unread > 0 && !emstorage_update_sync_status_of_account(input_account_id, SET_TYPE_UNION, SYNC_STATUS_HAVE_NEW_MAILS, true, &err)) 
+                               EM_DEBUG_EXCEPTION("emstorage_update_sync_status_of_account failed [%d]", err);
 
-                       if (!em_core_finalize_sync(input_account_id, &err))
-                               EM_DEBUG_EXCEPTION("em_core_finalize_sync failed [%d]", err);
+                       if (!emcore_finalize_sync(input_account_id, &err))
+                               EM_DEBUG_EXCEPTION("emcore_finalize_sync failed [%d]", err);
                }
                else /*  All Foder */ {
                        EM_DEBUG_LOG(">>>> SYNC ALL MAILBOX ");
                        /*  Sync of all mailbox */
 
                        if (input_account_id == ALL_ACCOUNT) {
-                               if (!em_storage_update_sync_status_of_account(ALL_ACCOUNT, SET_TYPE_SET, SYNC_STATUS_SYNCING, true, &err)) 
-                                       EM_DEBUG_EXCEPTION("em_storage_update_sync_status_of_account failed [%d]", err);
-
-                               if (!em_storage_get_account_list(&account_count, &account_tbl_array , true, false, &err)) {
-                                       EM_DEBUG_EXCEPTION("em_storage_get_account_list failed [ %d ] ", err);
-                                       em_storage_get_emf_error_from_em_storage_error(err);
-                                       if (!em_storage_notify_network_event(NOTI_DOWNLOAD_FAIL, input_account_id, NULL,  handle_to_be_published, err))
-                                               EM_DEBUG_EXCEPTION(" em_storage_notify_network_event [ NOTI_DOWNLOAD_FAIL] Failed >>>> ");      
+                               if (!emstorage_update_sync_status_of_account(ALL_ACCOUNT, SET_TYPE_SET, SYNC_STATUS_SYNCING, true, &err)) 
+                                       EM_DEBUG_EXCEPTION("emstorage_update_sync_status_of_account failed [%d]", err);
+
+                               if (!emstorage_get_account_list(&account_count, &account_tbl_array , true, false, &err)) {
+                                       EM_DEBUG_EXCEPTION("emstorage_get_account_list failed [ %d ] ", err);
+                                       if (!emstorage_notify_network_event(NOTI_DOWNLOAD_FAIL, input_account_id, NULL,  handle_to_be_published, err))
+                                               EM_DEBUG_EXCEPTION(" emstorage_notify_network_event [ NOTI_DOWNLOAD_FAIL] Failed >>>> ");       
                                        goto FINISH_OFF;
                                }
                        }
                        else {
                                EM_DEBUG_LOG("Sync all mailbox of an account[%d].", input_account_id); 
 
-                               if (!em_storage_update_sync_status_of_account(input_account_id, SET_TYPE_SET, SYNC_STATUS_SYNCING, true, &err)) 
-                                       EM_DEBUG_EXCEPTION("em_storage_update_sync_status_of_account failed [%d]", err);
+                               if (!emstorage_update_sync_status_of_account(input_account_id, SET_TYPE_SET, SYNC_STATUS_SYNCING, true, &err)) 
+                                       EM_DEBUG_EXCEPTION("emstorage_update_sync_status_of_account failed [%d]", err);
                                
-                               if (!em_storage_get_account_by_id(input_account_id, EMF_ACC_GET_OPT_DEFAULT, &account_tbl_array, true, &err)) {
-                                       EM_DEBUG_EXCEPTION("em_storage_get_account_by_id failed [ %d ] ", err);
-                                       em_storage_get_emf_error_from_em_storage_error(err);
-                                       if (!em_storage_notify_network_event(NOTI_DOWNLOAD_FAIL, input_account_id, input_mailbox_name, handle_to_be_published, err))
-                                               EM_DEBUG_EXCEPTION(" em_storage_notify_network_event [ NOTI_DOWNLOAD_FAIL] Failed >>>> ");      
+                               if (!emstorage_get_account_by_id(input_account_id, EMF_ACC_GET_OPT_DEFAULT, &account_tbl_array, true, &err)) {
+                                       EM_DEBUG_EXCEPTION("emstorage_get_account_by_id failed [ %d ] ", err);
+                                       if (!emstorage_notify_network_event(NOTI_DOWNLOAD_FAIL, input_account_id, input_mailbox_name, handle_to_be_published, err))
+                                               EM_DEBUG_EXCEPTION(" emstorage_notify_network_event [ NOTI_DOWNLOAD_FAIL] Failed >>>> ");       
                                        goto FINISH_OFF;
                                }
                                account_count = 1;
@@ -1229,42 +1178,42 @@ int event_handler_EMF_EVENT_SYNC_HEADER(int input_account_id, char *input_mailbo
                                }
                                
                
-                               if (!em_storage_get_mailbox(account_tbl_array[account_index].account_id, 0, EMAIL_MAILBOX_SORT_BY_TYPE_ASC, &mailbox_count, &mailbox_tbl_list, true, &err) || mailbox_count <= 0) {     
-                                       EM_DEBUG_EXCEPTION("em_storage_get_mailbox failed [%d]", err);
-                                       err = em_storage_get_emf_error_from_em_storage_error(err);
-                                       if (!em_storage_notify_network_event(NOTI_DOWNLOAD_FAIL, account_tbl_array[account_index].account_id, input_mailbox_name,  handle_to_be_published, err))
-                                               EM_DEBUG_EXCEPTION(" em_storage_notify_network_event [ NOTI_DOWNLOAD_FAIL] Failed >>>> ");      
+                               if (!emstorage_get_mailbox(account_tbl_array[account_index].account_id, 0, EMAIL_MAILBOX_SORT_BY_TYPE_ASC, &mailbox_count, &mailbox_tbl_list, true, &err) || mailbox_count <= 0) {      
+                                       EM_DEBUG_EXCEPTION("emstorage_get_mailbox failed [%d]", err);
+                       
+                                       if (!emstorage_notify_network_event(NOTI_DOWNLOAD_FAIL, account_tbl_array[account_index].account_id, input_mailbox_name,  handle_to_be_published, err))
+                                               EM_DEBUG_EXCEPTION(" emstorage_notify_network_event [ NOTI_DOWNLOAD_FAIL] Failed >>>> ");       
                                        goto FINISH_OFF;
                                }
 
-                               EM_DEBUG_LOG("em_core_mailbox_get_list_to_be_sync returns [%d] mailboxes", mailbox_count);
+                               EM_DEBUG_LOG("emcore_get_list_to_be_sync returns [%d] mailboxes", mailbox_count);
 
                                if(mailbox_tbl_spam) {
-                                       if (!em_storage_free_mailbox(&mailbox_tbl_spam, 1, &err)) {
-                                               err = em_storage_get_emf_error_from_em_storage_error(err);
-                                               EM_DEBUG_EXCEPTION("em_storage_free_mailbox failed [%d]", err);
+                                       if (!emstorage_free_mailbox(&mailbox_tbl_spam, 1, &err)) {
+                               
+                                               EM_DEBUG_EXCEPTION("emstorage_free_mailbox failed [%d]", err);
                                        }
                                        mailbox_tbl_spam = NULL;
                                }
 
-                               if (!em_storage_get_mailbox_by_mailbox_type(account_tbl_array[account_index].account_id, EMF_MAILBOX_TYPE_SPAMBOX, &mailbox_tbl_spam, false, &err)) {
-                                       err = em_storage_get_emf_error_from_em_storage_error(err);
-                                       EM_DEBUG_LOG("em_storage_get_mailbox_by_mailbox_type failed [%d]", err);
+                               if (!emstorage_get_mailbox_by_mailbox_type(account_tbl_array[account_index].account_id, EMF_MAILBOX_TYPE_SPAMBOX, &mailbox_tbl_spam, false, &err)) {
+                       
+                                       EM_DEBUG_LOG("emstorage_get_mailbox_by_mailbox_type failed [%d]", err);
                                }
 
                                if (mailbox_count > 0) {
 #ifndef __FEATURE_KEEP_CONNECTION__
                                        if (account_tbl_array[account_index].receiving_server_type == EMF_SERVER_TYPE_IMAP4) {
-                                               if (!em_core_mailbox_open(account_tbl_array[account_index].account_id, mailbox_tbl_list[0].mailbox_name, (void **)&stream, &err))  {
-                                                       EM_DEBUG_EXCEPTION("em_core_mailbox_open failed [%d]", err);
+                                               if (!emcore_connect_to_remote_mailbox(account_tbl_array[account_index].account_id, mailbox_tbl_list[0].mailbox_name, (void **)&stream, &err))  {
+                                                       EM_DEBUG_EXCEPTION("emcore_connect_to_remote_mailbox failed [%d]", err);
                                                        if (err == EMF_ERROR_LOGIN_FAILURE)
                                                                EM_DEBUG_EXCEPTION("EMF_ERROR_LOGIN_FAILURE ");
                                                        /* continue; */
-                                                       if (!em_storage_notify_network_event(NOTI_DOWNLOAD_FAIL, account_tbl_array[account_index].account_id, mailbox_tbl_list[0].mailbox_name,  handle_to_be_published, err))
-                                                               EM_DEBUG_EXCEPTION(" em_storage_notify_network_event [NOTI_DOWNLOAD_FAIL] Failed >>>> ");       
+                                                       if (!emstorage_notify_network_event(NOTI_DOWNLOAD_FAIL, account_tbl_array[account_index].account_id, mailbox_tbl_list[0].mailbox_name,  handle_to_be_published, err))
+                                                               EM_DEBUG_EXCEPTION(" emstorage_notify_network_event [NOTI_DOWNLOAD_FAIL] Failed >>>> ");        
                                                        goto FINISH_OFF;
                                                }
-                                               EM_DEBUG_LOG("em_core_mailbox_open returns [%d] : ", err);
+                                               EM_DEBUG_LOG("emcore_connect_to_remote_mailbox returns [%d] : ", err);
                                        }
                                        else 
                                                stream = NULL;
@@ -1279,42 +1228,42 @@ int event_handler_EMF_EVENT_SYNC_HEADER(int input_account_id, char *input_mailbo
                                        else if ((mailbox_tbl_list[counter].sync_with_server_yn)) {
                                                EM_DEBUG_LOG("..........syncing %s mailbox......", mailbox_tbl_list[counter].mailbox_name);
 #ifdef __FEATURE_KEEP_CONNECTION__
-                                               if (!em_core_mailbox_sync_header((mailbox_tbl_list + counter) , mailbox_tbl_spam, NULL, &uid_list, &unread, &err)) {
+                                               if (!emcore_sync_header((mailbox_tbl_list + counter) , mailbox_tbl_spam, NULL, &uid_list, &unread, &err)) {
 #else /*  __FEATURE_KEEP_CONNECTION__ */
-                                               if (!em_core_mailbox_sync_header((mailbox_tbl_list + counter) , mailbox_tbl_spam, (void *)stream, &uid_list, &unread, &err)) {
+                                               if (!emcore_sync_header((mailbox_tbl_list + counter) , mailbox_tbl_spam, (void *)stream, &uid_list, &unread, &err)) {
 #endif /*  __FEATURE_KEEP_CONNECTION__ */ 
-                                                       EM_DEBUG_EXCEPTION("em_core_mailbox_sync_header for %s failed [%d]", mailbox_tbl_list[counter].mailbox_name, err);
+                                                       EM_DEBUG_EXCEPTION("emcore_sync_header for %s failed [%d]", mailbox_tbl_list[counter].mailbox_name, err);
 
 #ifndef __FEATURE_KEEP_CONNECTION__
                                                        if (err == EMF_ERROR_CONNECTION_BROKEN || err == EMF_ERROR_NO_SUCH_HOST || err == EMF_ERROR_SOCKET_FAILURE) 
                                                                stream = NULL;    /*  Don't retry to connect for broken connection. It might cause crash.  */
 #endif /*  __FEATURE_KEEP_CONNECTION__ */ 
-                                                       if (!em_storage_notify_network_event(NOTI_DOWNLOAD_FAIL, account_tbl_array[account_index].account_id, mailbox_tbl_list[counter].mailbox_name,  handle_to_be_published, err))
-                                                               EM_DEBUG_EXCEPTION(" em_storage_notify_network_event [ NOTI_DOWNLOAD_FAIL] Failed >>>> ");
+                                                       if (!emstorage_notify_network_event(NOTI_DOWNLOAD_FAIL, account_tbl_array[account_index].account_id, mailbox_tbl_list[counter].mailbox_name,  handle_to_be_published, err))
+                                                               EM_DEBUG_EXCEPTION(" emstorage_notify_network_event [ NOTI_DOWNLOAD_FAIL] Failed >>>> ");
 
-                                                       goto FINISH_OFF;
+                                                       break;
                                                }
                                        }
                                        total_unread  += unread;
                                }
                                
                                EM_DEBUG_LOG("Sync for account_id(%d) is completed....!", account_tbl_array[account_index].account_id);
-                               if (!em_storage_notify_network_event(NOTI_DOWNLOAD_FINISH, account_tbl_array[account_index].account_id, NULL, handle_to_be_published, 0))
-                                       EM_DEBUG_EXCEPTION(" em_storage_notify_network_event [ NOTI_DOWNLOAD_FINISH] Failed >>>> ");    
+                               if ((err == EMF_ERROR_NONE) && !emstorage_notify_network_event(NOTI_DOWNLOAD_FINISH, account_tbl_array[account_index].account_id, NULL, handle_to_be_published, 0))
+                                       EM_DEBUG_EXCEPTION(" emstorage_notify_network_event [ NOTI_DOWNLOAD_FINISH] Failed >>>> ");     
 
-                               if (total_unread > 0 && !em_storage_update_sync_status_of_account(account_tbl_array[account_index].account_id, SET_TYPE_UNION, SYNC_STATUS_HAVE_NEW_MAILS, true, &err)) 
-                                       EM_DEBUG_EXCEPTION("em_storage_update_sync_status_of_account failed [%d]", err);
+                               if ((total_unread || unread) && !emstorage_update_sync_status_of_account(account_tbl_array[account_index].account_id, SET_TYPE_UNION, SYNC_STATUS_HAVE_NEW_MAILS, true, &err)) 
+                                       EM_DEBUG_EXCEPTION("emstorage_update_sync_status_of_account failed [%d]", err);
 
-                               if (!em_core_finalize_sync(account_tbl_array[account_index].account_id, &err))
-                                       EM_DEBUG_EXCEPTION("em_core_finalize_sync failed [%d]", err);
+                               if (!emcore_finalize_sync(account_tbl_array[account_index].account_id, &err))
+                                       EM_DEBUG_EXCEPTION("emcore_finalize_sync failed [%d]", err);
 #ifndef __FEATURE_KEEP_CONNECTION__
                                if (stream)  {
-                                       em_core_mailbox_close(0, stream);
+                                       emcore_close_mailbox(0, stream);
                                        stream = NULL;
                                }
 #endif
                                if (mailbox_tbl_list) {
-                                       em_storage_free_mailbox(&mailbox_tbl_list, mailbox_count, NULL);
+                                       emstorage_free_mailbox(&mailbox_tbl_list, mailbox_count, NULL);
                                        mailbox_tbl_list = NULL;
                                        mailbox_count = 0;
                                }
@@ -1325,21 +1274,18 @@ int event_handler_EMF_EVENT_SYNC_HEADER(int input_account_id, char *input_mailbo
 
 FINISH_OFF: 
 
-               if(ret == false) {
-               }
-
 #ifndef __FEATURE_KEEP_CONNECTION__
                if (stream) 
-                       em_core_mailbox_close(0, stream);
+                       emcore_close_mailbox(0, stream);
 #endif
                if(mailbox_tbl_target)
-                       em_storage_free_mailbox(&mailbox_tbl_target, 1, NULL);
+                       emstorage_free_mailbox(&mailbox_tbl_target, 1, NULL);
 
                if (mailbox_tbl_list)
-                       em_storage_free_mailbox(&mailbox_tbl_list, mailbox_count, NULL);
+                       emstorage_free_mailbox(&mailbox_tbl_list, mailbox_count, NULL);
 
                if (account_tbl_array)
-                       em_storage_free_account(&account_tbl_array, account_count, NULL); 
+                       emstorage_free_account(&account_tbl_array, account_count, NULL); 
        }
 
        EM_DEBUG_FUNC_END();
@@ -1359,48 +1305,48 @@ int event_handler_EMF_EVENT_VALIDATE_AND_CREATE_ACCOUNT(emf_account_t *account,
 
        EM_DEBUG_LOG("receiving_server_addr  :  %s", account->receiving_server_addr);
                                                        
-       if (!em_core_check_network_status(&err))  {
-               EM_DEBUG_EXCEPTION("em_core_check_network_status failed [%d]", err);
+       if (!emnetwork_check_network_status(&err))  {
+               EM_DEBUG_EXCEPTION("emnetwork_check_network_status failed [%d]", err);
 
-               if (!em_storage_notify_network_event(NOTI_VALIDATE_AND_CREATE_ACCOUNT_FAIL, account->account_id, NULL,  handle_to_be_published, err))
-                       EM_DEBUG_EXCEPTION(" em_storage_notify_network_event [ NOTI_VALIDATE_ACCOUNT_FAIL] Failed >>>> ");      
+               if (!emstorage_notify_network_event(NOTI_VALIDATE_AND_CREATE_ACCOUNT_FAIL, account->account_id, NULL,  handle_to_be_published, err))
+                       EM_DEBUG_EXCEPTION(" emstorage_notify_network_event [ NOTI_VALIDATE_ACCOUNT_FAIL] Failed >>>> ");       
                goto FINISH_OFF;
        }
        else  {
                EM_DEBUG_LOG("receiving_server_addr  :  %s", account->receiving_server_addr);
 
-               if (!em_core_account_validate_with_account_info(account, &err)) {
-                       EM_DEBUG_EXCEPTION("em_core_account_validate_with_account_info failed err :  %d", err);
+               if (!emcore_validate_account_with_account_info(account, &err)) {
+                       EM_DEBUG_EXCEPTION("emcore_validate_account_with_account_info failed err :  %d", err);
                        if (err == EMF_ERROR_CANCELLED) {
                                EM_DEBUG_EXCEPTION(" notify  :  NOTI_VALIDATE_AND_CREATE_ACCOUNT_CANCEL ");
-                               if (!em_storage_notify_network_event(NOTI_VALIDATE_AND_CREATE_ACCOUNT_CANCEL, account->account_id, NULL,  handle_to_be_published, err))
-                                       EM_DEBUG_EXCEPTION(" em_storage_notify_network_event [ NOTI_VALIDATE_AND_CREATE_ACCOUNT_CANCEL] Failed");
+                               if (!emstorage_notify_network_event(NOTI_VALIDATE_AND_CREATE_ACCOUNT_CANCEL, account->account_id, NULL,  handle_to_be_published, err))
+                                       EM_DEBUG_EXCEPTION(" emstorage_notify_network_event [ NOTI_VALIDATE_AND_CREATE_ACCOUNT_CANCEL] Failed");
                                goto FINISH_OFF;
                        }
                        else
                                goto FINISH_OFF;
                }
                else {
-                       if (em_core_account_create(account, &err) == false)      {
-                               EM_DEBUG_EXCEPTION(" emf_account_create failed - %d", err);     
+                       if (emcore_create_account(account, &err) == false)       {
+                               EM_DEBUG_EXCEPTION(" emdaemon_create_account failed - %d", err);        
                                goto FINISH_OFF;
                        }       
 
-                       em_core_refresh_account_reference();
+                       emcore_refresh_account_reference();
                        
                        if ((EMF_SERVER_TYPE_IMAP4 == account->receiving_server_type)) {        
-                               if (!em_core_mailbox_sync_mailbox_list(account->account_id, "", &err))  {
-                                       EM_DEBUG_EXCEPTION("em_core_mailbox_get_list_to_be_sync falied [%d]", err);
+                               if (!emcore_sync_mailbox_list(account->account_id, "", &err))  {
+                                       EM_DEBUG_EXCEPTION("emcore_get_list_to_be_sync falied [%d]", err);
                                        /*  delete account whose mailbox couldn't be obtained from server */
-                                       em_core_account_delete(account->account_id, NULL);
+                                       emcore_delete_account_(account->account_id, NULL);
                                        goto FINISH_OFF;
                                }               
 
                        }
 
-                       EM_DEBUG_EXCEPTION("validating and creating an account are succeeded for account id  [%d]  err [%d]", account->account_id, err);
-                       if (!em_storage_notify_network_event(NOTI_VALIDATE_AND_CREATE_ACCOUNT_FINISH, account->account_id, NULL,  handle_to_be_published, err))
-                               EM_DEBUG_EXCEPTION("em_storage_notify_network_event [ NOTI_VALIDATE_ACCOUNT_FINISH] Success");  
+                       EM_DEBUG_LOG("validating and creating an account are succeeded for account id  [%d]  err [%d]", account->account_id, err);
+                       if (!emstorage_notify_network_event(NOTI_VALIDATE_AND_CREATE_ACCOUNT_FINISH, account->account_id, NULL,  handle_to_be_published, err))
+                               EM_DEBUG_EXCEPTION("emstorage_notify_network_event [ NOTI_VALIDATE_ACCOUNT_FINISH] Success");   
                }
        }
 
@@ -1409,8 +1355,8 @@ int event_handler_EMF_EVENT_VALIDATE_AND_CREATE_ACCOUNT(emf_account_t *account,
 FINISH_OFF:  
        
        if (ret == false && err != EMF_ERROR_CANCELLED) {
-               if (!em_storage_notify_network_event(NOTI_VALIDATE_AND_CREATE_ACCOUNT_FAIL, account->account_id, NULL,  handle_to_be_published, err))
-                       EM_DEBUG_EXCEPTION(" em_storage_notify_network_event [ NOTI_VALIDATE_AND_CREATE_ACCOUNT_FAIL] Failed"); 
+               if (!emstorage_notify_network_event(NOTI_VALIDATE_AND_CREATE_ACCOUNT_FAIL, account->account_id, NULL,  handle_to_be_published, err))
+                       EM_DEBUG_EXCEPTION(" emstorage_notify_network_event [ NOTI_VALIDATE_AND_CREATE_ACCOUNT_FAIL] Failed");  
        }
        if (error)
                *error = err;
@@ -1423,7 +1369,7 @@ int event_handler_EMF_EVENT_VALIDATE_AND_UPDATE_ACCOUNT(int account_id, emf_acco
 {
        EM_DEBUG_FUNC_BEGIN("account_id [%d], new_account_info [%p]", account_id, new_account_info);
        int err, ret = false;
-       emf_mail_account_tbl_t *old_account_tbl = NULL, *new_account_tbl = NULL; 
+       emstorage_account_tbl_t *old_account_tbl = NULL, *new_account_tbl = NULL; 
 
        if (!new_account_info) {
                EM_DEBUG_EXCEPTION("Invalid Parameter");
@@ -1431,22 +1377,22 @@ int event_handler_EMF_EVENT_VALIDATE_AND_UPDATE_ACCOUNT(int account_id, emf_acco
                goto FINISH_OFF;
        }
 
-       if (!em_core_check_network_status(&err))  {
-               EM_DEBUG_EXCEPTION("em_core_check_network_status failed [%d]", err);
+       if (!emnetwork_check_network_status(&err))  {
+               EM_DEBUG_EXCEPTION("emnetwork_check_network_status failed [%d]", err);
 
-               if (!em_storage_notify_network_event(NOTI_VALIDATE_AND_UPDATE_ACCOUNT_FAIL, new_account_info->account_id, NULL,  handle_to_be_published, err))
-                       EM_DEBUG_EXCEPTION("em_storage_notify_network_event [ NOTI_VALIDATE_AND_UPDATE_ACCOUNT_FAIL] Failed >>>> ");    
+               if (!emstorage_notify_network_event(NOTI_VALIDATE_AND_UPDATE_ACCOUNT_FAIL, new_account_info->account_id, NULL,  handle_to_be_published, err))
+                       EM_DEBUG_EXCEPTION("emstorage_notify_network_event [ NOTI_VALIDATE_AND_UPDATE_ACCOUNT_FAIL] Failed >>>> ");     
                goto FINISH_OFF;
        }
        else  {
                EM_DEBUG_LOG("receiving_server_addr  :  %s", new_account_info->receiving_server_addr);
 
-               if (!em_core_account_validate_with_account_info(new_account_info, &err)) {
-                       EM_DEBUG_EXCEPTION("\t em_core_account_validate_with_account_info failed err :  %d", err);
+               if (!emcore_validate_account_with_account_info(new_account_info, &err)) {
+                       EM_DEBUG_EXCEPTION("\t emcore_validate_account_with_account_info failed err :  %d", err);
                        if (err == EMF_ERROR_CANCELLED) {
                                EM_DEBUG_EXCEPTION(" notify  :  NOTI_VALIDATE_AND_CREATE_ACCOUNT_CANCEL ");
-                               if (!em_storage_notify_network_event(NOTI_VALIDATE_AND_UPDATE_ACCOUNT_CANCEL, new_account_info->account_id, NULL,  handle_to_be_published, err))
-                                       EM_DEBUG_EXCEPTION(" em_storage_notify_network_event [ NOTI_VALIDATE_AND_UPDATE_ACCOUNT_CANCEL] Failed");
+                               if (!emstorage_notify_network_event(NOTI_VALIDATE_AND_UPDATE_ACCOUNT_CANCEL, new_account_info->account_id, NULL,  handle_to_be_published, err))
+                                       EM_DEBUG_EXCEPTION(" emstorage_notify_network_event [ NOTI_VALIDATE_AND_UPDATE_ACCOUNT_CANCEL] Failed");
                                goto FINISH_OFF;
                        }
                        else {
@@ -1454,12 +1400,12 @@ int event_handler_EMF_EVENT_VALIDATE_AND_UPDATE_ACCOUNT(int account_id, emf_acco
                        }
                }
                else {
-                       if (!em_storage_get_account_by_id(account_id, WITHOUT_OPTION, &old_account_tbl, true, &err)) {
-                               EM_DEBUG_EXCEPTION("em_storage_get_account_by_id failed [%d]", err);
+                       if (!emstorage_get_account_by_id(account_id, WITHOUT_OPTION, &old_account_tbl, true, &err)) {
+                               EM_DEBUG_EXCEPTION("emstorage_get_account_by_id failed [%d]", err);
                                /* goto FINISH_OFF; */
                        }
 
-                       new_account_tbl = em_core_malloc(sizeof(emf_mail_account_tbl_t));
+                       new_account_tbl = em_malloc(sizeof(emstorage_account_tbl_t));
                        if (!new_account_tbl) {
                                EM_DEBUG_EXCEPTION("allocation failed [%d]", err);
                                goto FINISH_OFF;
@@ -1467,13 +1413,13 @@ int event_handler_EMF_EVENT_VALIDATE_AND_UPDATE_ACCOUNT(int account_id, emf_acco
 
                        em_convert_account_to_account_tbl(new_account_info, new_account_tbl);
 
-                       if (em_storage_update_account(account_id, new_account_tbl, true, &err)) {
-                               em_core_refresh_account_reference();
+                       if (emstorage_update_account(account_id, new_account_tbl, true, &err)) {
+                               emcore_refresh_account_reference();
                        }
                        
                        EM_DEBUG_EXCEPTION("validating and updating an account are succeeded for account id [%d], err [%d]", new_account_info->account_id, err);
-                       if (!em_storage_notify_network_event(NOTI_VALIDATE_AND_UPDATE_ACCOUNT_FINISH, new_account_info->account_id, NULL,  handle_to_be_published, err))
-                               EM_DEBUG_EXCEPTION(" em_storage_notify_network_event [NOTI_VALIDATE_AND_UPDATE_ACCOUNT_FINISH] Success");       
+                       if (!emstorage_notify_network_event(NOTI_VALIDATE_AND_UPDATE_ACCOUNT_FINISH, new_account_info->account_id, NULL,  handle_to_be_published, err))
+                               EM_DEBUG_EXCEPTION(" emstorage_notify_network_event [NOTI_VALIDATE_AND_UPDATE_ACCOUNT_FINISH] Success");        
                }
        }
 
@@ -1481,13 +1427,13 @@ int event_handler_EMF_EVENT_VALIDATE_AND_UPDATE_ACCOUNT(int account_id, emf_acco
 
 FINISH_OFF:  
        if (old_account_tbl)
-               em_storage_free_account(&old_account_tbl, 1, NULL);
+               emstorage_free_account(&old_account_tbl, 1, NULL);
        if (new_account_tbl)
-               em_storage_free_account(&new_account_tbl, 1, NULL);
+               emstorage_free_account(&new_account_tbl, 1, NULL);
        
        if (ret == false && err != EMF_ERROR_CANCELLED) {
-               if (!em_storage_notify_network_event(NOTI_VALIDATE_AND_UPDATE_ACCOUNT_FAIL, new_account_info->account_id, NULL,  handle_to_be_published, err))
-                       EM_DEBUG_EXCEPTION(" em_storage_notify_network_event [ NOTI_VALIDATE_AND_CREATE_ACCOUNT_FAIL] Failed"); 
+               if (!emstorage_notify_network_event(NOTI_VALIDATE_AND_UPDATE_ACCOUNT_FAIL, new_account_info->account_id, NULL,  handle_to_be_published, err))
+                       EM_DEBUG_EXCEPTION(" emstorage_notify_network_event [ NOTI_VALIDATE_AND_CREATE_ACCOUNT_FAIL] Failed");  
        }
 
        if (error)
@@ -1501,42 +1447,42 @@ int event_handler_EMF_EVENT_SET_MAIL_SLOT_SIZE(int account_id, char *mailbox_nam
 {
        EM_DEBUG_FUNC_BEGIN();
 
-       em_core_mailbox_set_mail_slot_size(account_id, mailbox_name, new_slot_size, error);
+       emcore_set_mail_slot_size(account_id, mailbox_name, new_slot_size, error);
 
        EM_DEBUG_FUNC_END();
        return true;
 }
 
 
-#ifdef __LOCAL_ACTIVITY__                                      
+#ifdef __FEATURE_LOCAL_ACTIVITY__                                      
 int event_handler_EMF_EVENT_LOCAL_ACTIVITY(int account_id, int *error)
 {
        EM_DEBUG_FUNC_BEGIN();
 
        int err = EMF_ERROR_NONE;
        emf_mailbox_t mailbox;
-       emf_activity_tbl_t *local_activity = NULL;
+       emstorage_activity_tbl_t *local_activity = NULL;
        int activity_id_count = 0;
        int activity_chunk_count = 0;
        int *activity_id_list = NULL;
        int i = 0;
 
-       if (!em_core_check_network_status(&err)) 
-               EM_DEBUG_EXCEPTION("em_core_check_network_status failed [%d]", err);
+       if (!emnetwork_check_network_status(&err)) 
+               EM_DEBUG_EXCEPTION("emnetwork_check_network_status failed [%d]", err);
        else {
-               if (false == em_storage_get_activity_id_list(account_id, &activity_id_list, &activity_id_count, ACTIVITY_DELETEMAIL, ACTIVITY_COPYMAIL, true, &err)) {
-                       EM_DEBUG_EXCEPTION("em_storage_get_activity_id_list failed [%d]", err);
+               if (false == emstorage_get_activity_id_list(account_id, &activity_id_list, &activity_id_count, ACTIVITY_DELETEMAIL, ACTIVITY_COPYMAIL, true, &err)) {
+                       EM_DEBUG_EXCEPTION("emstorage_get_activity_id_list failed [%d]", err);
                }
                else {  
                        for (i = 0; i < activity_id_count; ++i) {
-                               if ((false == em_storage_get_activity(account_id , activity_id_list[i], &local_activity, &activity_chunk_count, true,  &err)) || (NULL == local_activity) || (0 == activity_chunk_count))
-                                       EM_DEBUG_EXCEPTION(" em_storage_get_activity Failed [ %d] or local_activity is NULL [%p] or activity_chunk_count is 0[%d]", err, local_activity, activity_chunk_count);
+                               if ((false == emstorage_get_activity(account_id , activity_id_list[i], &local_activity, &activity_chunk_count, true,  &err)) || (NULL == local_activity) || (0 == activity_chunk_count))
+                                       EM_DEBUG_EXCEPTION(" emstorage_get_activity Failed [ %d] or local_activity is NULL [%p] or activity_chunk_count is 0[%d]", err, local_activity, activity_chunk_count);
                                else {                                                  
                                        EM_DEBUG_LOG("Found local activity type - %d", local_activity[0].activity_type);                                                        
                                        switch (local_activity[0].activity_type) {                                                                      
                                                case ACTIVITY_MODIFYFLAG:  {
-                                                       if (em_core_mail_sync_flag_with_server(local_activity[0].mail_id , &err))  {
-                                                               if (!em_core_activity_delete(&local_activity[0], &err))
+                                                       if (emcore_sync_flag_with_server(local_activity[0].mail_id , &err))  {
+                                                               if (!emcore_delete_activity(&local_activity[0], &err))
                                                                        EM_DEBUG_EXCEPTION(">>>>>>Local Activity [ACTIVITY_MODIFYFLAG] [%d] ", err);
                                                        }                                                                               
                                                }
@@ -1552,7 +1498,7 @@ int event_handler_EMF_EVENT_LOCAL_ACTIVITY(int account_id, int *error)
                                                                                                                                
                                                        int *mail_id_list = NULL;
 
-                                                       mail_id_list = (int *)em_core_malloc(sizeof(int) * total_mail_ids);
+                                                       mail_id_list = (int *)em_malloc(sizeof(int) * total_mail_ids);
                                                        
                                                        if (NULL == mail_id_list) {
                                                                EM_DEBUG_EXCEPTION("malloc failed... ");
@@ -1566,31 +1512,31 @@ int event_handler_EMF_EVENT_LOCAL_ACTIVITY(int account_id, int *error)
 
                                                                switch (local_activity[k-1].activity_type) {
                                                                        case ACTIVITY_DELETEMAIL:  {
-                                                                               if (!em_core_mail_delete(local_activity[k-1].account_id, 
+                                                                               if (!emcore_delete_mail(local_activity[k-1].account_id, 
                                                                                                                                mail_id_list, 
                                                                                                                                j, 
                                                                                                                                EMF_DELETE_LOCAL_AND_SERVER, 
                                                                                                                                EMF_DELETED_BY_COMMAND,
                                                                                                                                false,
                                                                                                                                &err)) 
-                                                                                       EM_DEBUG_LOG("\t em_core_mail_delete failed - %d", err);
+                                                                                       EM_DEBUG_LOG("\t emcore_delete_mail failed - %d", err);
                                                                        }
                                                                        break;
                                                                        
                                                                        case ACTIVITY_MOVEMAIL:  {
-                                                                               if (!em_core_mail_move_from_server_ex(local_activity[k-1].account_id , 
+                                                                               if (!emcore_move_mail_on_server_ex(local_activity[k-1].account_id , 
                                                                                                                                                   local_activity[k-1].src_mbox, 
                                                                                                                                                   mail_id_list, 
                                                                                                                                                   j, 
                                                                                                                                                   local_activity[k-1].dest_mbox, 
                                                                                                                                                   &err))
-                                                                                       EM_DEBUG_LOG("\t em_core_mail_move_from_server_ex failed - %d", err);
+                                                                                       EM_DEBUG_LOG("\t emcore_move_mail_on_server_ex failed - %d", err);
                                                                        }       
                                                                        break;
                                                                        case ACTIVITY_MODIFYSEENFLAG:  {                                                                        
                                                                                int seen_flag = atoi(local_activity[0].src_mbox);
-                                                                               if (!em_core_mail_sync_seen_flag_with_server_ex(mail_id_list, j , seen_flag , &err)) /* local_activity[0].src_mbox points to the seen flag */
-                                                                                       EM_DEBUG_EXCEPTION("\t em_core_mail_sync_seen_flag_with_server_ex failed - %d", err);
+                                                                               if (!emcore_sync_seen_flag_with_server_ex(mail_id_list, j , seen_flag , &err)) /* local_activity[0].src_mbox points to the seen flag */
+                                                                                       EM_DEBUG_EXCEPTION("\t emcore_sync_seen_flag_with_server_ex failed - %d", err);
                                                                        }
                                                                        break;
                                                                }
@@ -1607,7 +1553,7 @@ int event_handler_EMF_EVENT_LOCAL_ACTIVITY(int account_id, int *error)
                                                break;
                                        }
                                        
-                                       em_storage_free_local_activity(&local_activity, activity_chunk_count, NULL);
+                                       emstorage_free_local_activity(&local_activity, activity_chunk_count, NULL);
                                        
                                        if (g_local_activity_run == 1) {
                                                EM_DEBUG_LOG(" Network event_data found.. Local sync Stopped..! ");
@@ -1618,8 +1564,8 @@ int event_handler_EMF_EVENT_LOCAL_ACTIVITY(int account_id, int *error)
                }
        }
        if (activity_id_list) {
-               if (false == em_storage_free_activity_id_list(activity_id_list, &err))
-                       EM_DEBUG_EXCEPTION("em_storage_free_activity_id_list failed");
+               if (false == emstorage_free_activity_id_list(activity_id_list, &err))
+                       EM_DEBUG_EXCEPTION("emstorage_free_activity_id_list failed");
        }
        
        if (error)
@@ -1629,7 +1575,7 @@ int event_handler_EMF_EVENT_LOCAL_ACTIVITY(int account_id, int *error)
 
        return true;
 }
-#endif /* __LOCAL_ACTIVITY__ */
+#endif /* __FEATURE_LOCAL_ACTIVITY__ */
 
 int event_handler_EMF_EVENT_DOWNLOAD_BODY(int account_id, char *mailbox_name, int mail_id, int option, int handle_to_be_published, int *error)
 {
@@ -1642,13 +1588,13 @@ int event_handler_EMF_EVENT_DOWNLOAD_BODY(int account_id, char *mailbox_name, in
        mailbox.account_id = account_id;
        mailbox.name = mailbox_name;
        
-       if (!em_core_check_network_status(&err))  {
-               EM_DEBUG_EXCEPTION("em_core_check_network_status failed [%d]", err);
+       if (!emnetwork_check_network_status(&err))  {
+               EM_DEBUG_EXCEPTION("emnetwork_check_network_status failed [%d]", err);
 
-               em_storage_notify_network_event(NOTI_DOWNLOAD_BODY_FAIL, mail_id, NULL, handle_to_be_published, err);
+               emstorage_notify_network_event(NOTI_DOWNLOAD_BODY_FAIL, mail_id, NULL, handle_to_be_published, err);
        }
        else  {
-               if (!em_core_mail_download_body_multi_sections_bulk(NULL, 
+               if (!emcore_download_body_multi_sections_bulk(NULL, 
                        mailbox.account_id, 
                        mail_id, 
                        option >> 1,            /*  0 :  silent, 1 :  verbose */
@@ -1656,7 +1602,7 @@ int event_handler_EMF_EVENT_DOWNLOAD_BODY(int account_id, char *mailbox_name, in
                        NO_LIMITATION, 
                        handle_to_be_published, 
                        &err))
-                       EM_DEBUG_EXCEPTION("em_core_mail_download_body_multi_sections_bulk failed - %d", err);
+                       EM_DEBUG_EXCEPTION("emcore_download_body_multi_sections_bulk failed - %d", err);
        }       
        
        if (error)
@@ -1675,9 +1621,9 @@ int event_handler_EMF_EVENT_DOWNLOAD_ATTACHMENT(int account_id, char *mailbox_na
 
        EM_DEBUG_LOG("attachment_no is %d", atoi(attachment_no));
        
-       if (!em_core_check_network_status(&err))  {
-               EM_DEBUG_EXCEPTION("em_core_check_network_status failed [%d]", err);
-               em_storage_notify_network_event(NOTI_DOWNLOAD_ATTACH_FAIL, mail_id, NULL, atoi(attachment_no), err);
+       if (!emnetwork_check_network_status(&err))  {
+               EM_DEBUG_EXCEPTION("emnetwork_check_network_status failed [%d]", err);
+               emstorage_notify_network_event(NOTI_DOWNLOAD_ATTACH_FAIL, mail_id, NULL, atoi(attachment_no), err);
        }
        else  {
                memset(&mailbox, 0x00, sizeof(mailbox));
@@ -1685,11 +1631,11 @@ int event_handler_EMF_EVENT_DOWNLOAD_ATTACHMENT(int account_id, char *mailbox_na
                mailbox.name = mailbox_name;
                
 #ifdef __ATTACHMENT_OPTI__
-               if (!em_core_mail_download_attachment_bulk(mailbox.account_id, mail_id, (char *)attachment_no, &err))
-                       EM_DEBUG_EXCEPTION("\t em_core_mail_download_attachment failed - %d", err);
+               if (!emcore_download_attachment_bulk(mailbox.account_id, mail_id, (char *)attachment_no, &err))
+                       EM_DEBUG_EXCEPTION("\t emcore_download_attachment failed - %d", err);
 #else
-               if (!em_core_mail_download_attachment(mailbox.account_id, mail_id, (char *)attachment_no, &err))
-                       EM_DEBUG_EXCEPTION("\t em_core_mail_download_attachment failed - %d", err);
+               if (!emcore_download_attachment(mailbox.account_id, mail_id, (char *)attachment_no, &err))
+                       EM_DEBUG_EXCEPTION("\t emcore_download_attachment failed - %d", err);
 #endif
        }       
        
@@ -1706,10 +1652,10 @@ int event_handler_EMF_EVENT_SYNC_FLAGS_FIELD_TO_SERVER(int mail_ids[], int num,
 
        int err = EMF_ERROR_NONE;
                
-       if (!em_core_check_network_status(&err)) 
+       if (!emnetwork_check_network_status(&err)) 
                EM_DEBUG_EXCEPTION("dnet_init failed [%d]", err);
-       else if (!em_core_mail_sync_flags_field_with_server(mail_ids, num, field_type, value, &err)) 
-               EM_DEBUG_EXCEPTION("em_core_mail_sync_flags_field_with_server failed [%d]", err);
+       else if (!emcore_sync_flags_field_with_server(mail_ids, num, field_type, value, &err)) 
+               EM_DEBUG_EXCEPTION("emcore_sync_flags_field_with_server failed [%d]", err);
 
        if (error)
                *error = err;
@@ -1724,45 +1670,45 @@ int event_handler_EMF_EVENT_VALIDATE_ACCOUNT(int account_id, int handle_to_be_pu
 
        int err = EMF_ERROR_NONE;
 
-       if (!em_core_check_network_status(&err))  {
-               EM_DEBUG_EXCEPTION("em_core_check_network_status failed [%d]", err);
+       if (!emnetwork_check_network_status(&err))  {
+               EM_DEBUG_EXCEPTION("emnetwork_check_network_status failed [%d]", err);
                
-               if (!em_storage_notify_network_event(NOTI_VALIDATE_ACCOUNT_FAIL, account_id, NULL,  handle_to_be_published, err))
-                       EM_DEBUG_EXCEPTION("em_storage_notify_network_event [ NOTI_VALIDATE_ACCOUNT_FAIL] Failed >>>>");        
+               if (!emstorage_notify_network_event(NOTI_VALIDATE_ACCOUNT_FAIL, account_id, NULL,  handle_to_be_published, err))
+                       EM_DEBUG_EXCEPTION("emstorage_notify_network_event [ NOTI_VALIDATE_ACCOUNT_FAIL] Failed >>>>"); 
        }
        else  {
                        
-               if (!em_core_account_validate(account_id, &err)) {
-                       EM_DEBUG_EXCEPTION("em_core_account_validate failed account id  :  %d  err :  %d", account_id, err);
+               if (!emcore_validate_account(account_id, &err)) {
+                       EM_DEBUG_EXCEPTION("emcore_validate_account failed account id  :  %d  err :  %d", account_id, err);
 
                        if (err == EMF_ERROR_CANCELLED) {
                                EM_DEBUG_EXCEPTION("notify  :  NOTI_VALIDATE_ACCOUNT_CANCEL ");
-                               if (!em_storage_notify_network_event(NOTI_VALIDATE_ACCOUNT_CANCEL, account_id, NULL,  handle_to_be_published, err))
-                                       EM_DEBUG_EXCEPTION(" em_storage_notify_network_event [ NOTI_VALIDATE_ACCOUNT_CANCEL] Failed >>>> ");
+                               if (!emstorage_notify_network_event(NOTI_VALIDATE_ACCOUNT_CANCEL, account_id, NULL,  handle_to_be_published, err))
+                                       EM_DEBUG_EXCEPTION(" emstorage_notify_network_event [ NOTI_VALIDATE_ACCOUNT_CANCEL] Failed >>>> ");
                        }
                        else {
-                               if (!em_storage_notify_network_event(NOTI_VALIDATE_ACCOUNT_FAIL, account_id, NULL,  handle_to_be_published, err))
-                                       EM_DEBUG_EXCEPTION("em_storage_notify_network_event [ NOTI_VALIDATE_ACCOUNT_FAIL] Failed >>>> ");       
+                               if (!emstorage_notify_network_event(NOTI_VALIDATE_ACCOUNT_FAIL, account_id, NULL,  handle_to_be_published, err))
+                                       EM_DEBUG_EXCEPTION("emstorage_notify_network_event [ NOTI_VALIDATE_ACCOUNT_FAIL] Failed >>>> ");        
                        }
                }
                else {
                        emf_account_t *account_ref;
-                       account_ref = em_core_get_account_reference(account_id);
+                       account_ref = emcore_get_account_reference(account_id);
 
                        if (account_ref) {
                                EM_DEBUG_LOG("account_ref->receiving_server_type[%d]", account_ref->receiving_server_type);
                                EM_DEBUG_LOG("account_ref->preset_account[%d]", account_ref->preset_account);
                                if ((EMF_SERVER_TYPE_IMAP4 == account_ref->receiving_server_type) && (account_ref->preset_account)) {
-                                       if (!em_core_check_thread_status()) 
+                                       if (!emcore_check_thread_status()) 
                                                err = EMF_ERROR_CANCELLED;
-                                       else if (!em_core_mailbox_sync_mailbox_list(account_id, "", &err)) 
-                                               EM_DEBUG_EXCEPTION("\t em_core_mailbox_get_list_to_be_sync falied - %d", err);
+                                       else if (!emcore_sync_mailbox_list(account_id, "", &err)) 
+                                               EM_DEBUG_EXCEPTION("\t emcore_get_list_to_be_sync falied - %d", err);
                                }
                                
                                if (err > 0) {
-                                       EM_DEBUG_EXCEPTION("em_core_account_validate succeeded account id  :  %d  err :  %d", account_id, err);
-                                       if (!em_storage_notify_network_event(NOTI_VALIDATE_ACCOUNT_FINISH, account_id, NULL,  handle_to_be_published, err))
-                                               EM_DEBUG_EXCEPTION("em_storage_notify_network_event [ NOTI_VALIDATE_ACCOUNT_FINISH] Success >>>>");     
+                                       EM_DEBUG_EXCEPTION("emcore_validate_account succeeded account id  :  %d  err :  %d", account_id, err);
+                                       if (!emstorage_notify_network_event(NOTI_VALIDATE_ACCOUNT_FINISH, account_id, NULL,  handle_to_be_published, err))
+                                               EM_DEBUG_EXCEPTION("emstorage_notify_network_event [ NOTI_VALIDATE_ACCOUNT_FINISH] Success >>>>");      
                                }
                        }
                }
@@ -1775,39 +1721,22 @@ int event_handler_EMF_EVENT_VALIDATE_ACCOUNT(int account_id, int handle_to_be_pu
        return true;
 }
 
-int event_handler_EMF_EVENT_UPDATE_MAIL_OLD(int mail_id, emf_mail_t *mail, emf_meeting_request_t *meeting_req, int handle_to_be_published, int *error)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int err = EMF_ERROR_NONE;
-
-       if (!em_core_mail_update_old(mail_id, mail, meeting_req, &err)) 
-               EM_DEBUG_EXCEPTION("em_core_mail_update_old failed [%d]", err);
-       em_core_mail_free(&mail, 1, NULL);
-       EM_SAFE_FREE(meeting_req);
-
-       if (error)
-               *error = err;
-
-       EM_DEBUG_FUNC_END();
-       return true;
-}
-
-int event_handler_EMF_EVENT_UPDATE_MAIL(emf_mail_data_t *input_mail_data, emf_attachment_data_t *input_attachment_data_list, int input_attachment_count, emf_meeting_request_t* input_meeting_request, int input_sync_server, int handle_to_be_published)
+int event_handler_EMF_EVENT_UPDATE_MAIL(emf_mail_data_t *input_mail_data, emf_attachment_data_t *input_attachment_data_list, int input_attachment_count, emf_meeting_request_t* input_meeting_request, int input_from_eas, int handle_to_be_published)
 {
-       EM_DEBUG_FUNC_BEGIN("input_mail_data[%p], input_attachment_data_list[%p], input_attachment_count[%d], input_meeting_request[%p], input_sync_server[%d]", input_mail_data, input_attachment_data_list, input_attachment_count, input_meeting_request, input_sync_server);
+       EM_DEBUG_FUNC_BEGIN("input_mail_data[%p], input_attachment_data_list[%p], input_attachment_count[%d], input_meeting_request[%p], input_from_eas[%d]", input_mail_data, input_attachment_data_list, input_attachment_count, input_meeting_request, input_from_eas);
        int err = EMF_ERROR_NONE;
 
-       if ( (err = em_core_update_mail(input_mail_data, input_attachment_data_list, input_attachment_count, input_meeting_request, input_sync_server)) != EMF_ERROR_NONE) 
-               EM_DEBUG_EXCEPTION("em_core_update_mail failed [%d]", err);
+       if ( (err = emcore_update_mail(input_mail_data, input_attachment_data_list, input_attachment_count, input_meeting_request, input_from_eas)) != EMF_ERROR_NONE) 
+               EM_DEBUG_EXCEPTION("emcore_update_mail failed [%d]", err);
 
        if(input_mail_data)
-               em_core_free_mail_data(&input_mail_data, 1, NULL);
+               emcore_free_mail_data(&input_mail_data, 1, NULL);
 
        if(input_attachment_data_list)
-               em_core_free_attachment_data(&input_attachment_data_list, input_attachment_count, NULL);
+               emcore_free_attachment_data(&input_attachment_data_list, input_attachment_count, NULL);
 
        if(input_meeting_request)
-               em_storage_free_meeting_request(&input_meeting_request, 1, NULL);
+               emstorage_free_meeting_request(&input_meeting_request, 1, NULL);
 
        EM_DEBUG_FUNC_END("err [%d", err);
        return err;
@@ -1820,8 +1749,8 @@ int event_handler_EMF_EVENT_MOVE_MAIL(int account_id, char *srt_mailbox_name, in
        emf_mailbox_t dest_mailbox;
        emf_account_t *account_ref = NULL;
 
-       if (!(account_ref = em_core_get_account_reference(account_id))) {
-               EM_DEBUG_EXCEPTION("em_core_get_account_reference failed [%d]", account_id);
+       if (!(account_ref = emcore_get_account_reference(account_id))) {
+               EM_DEBUG_EXCEPTION("emcore_get_account_reference failed [%d]", account_id);
                err = EMF_ERROR_INVALID_ACCOUNT;
                goto FINISH_OFF;
        }
@@ -1831,23 +1760,23 @@ int event_handler_EMF_EVENT_MOVE_MAIL(int account_id, char *srt_mailbox_name, in
 
        /* Remove mail local */
        /*
-       if (!em_core_mail_move(mail_ids, mail_id_count, dest_mailbox.name, EMF_MOVED_BY_COMMAND, 0, &err)) {
-               EM_DEBUG_EXCEPTION("em_core_mail_move failed [%d]", err);
+       if (!emcore_mail_move(mail_ids, mail_id_count, dest_mailbox.name, EMF_MOVED_BY_COMMAND, 0, &err)) {
+               EM_DEBUG_EXCEPTION("emcore_mail_move failed [%d]", err);
                goto FINISH_OFF;
        }
        */
 
        if (account_ref->receiving_server_type == EMF_SERVER_TYPE_IMAP4) {
                /* Remove mail on server */
-               if (!em_core_check_network_status(&err)) 
-                       EM_DEBUG_EXCEPTION("em_core_check_network_status failed [%d]", err);
+               if (!emnetwork_check_network_status(&err)) 
+                       EM_DEBUG_EXCEPTION("emnetwork_check_network_status failed [%d]", err);
                else {
 #ifdef __FEATURE_BULK_DELETE_MOVE_UPDATE_REQUEST_OPTI__
-                       if (!em_core_mail_move_from_server_ex(account_id , srt_mailbox_name, mail_ids, mail_id_count, dest_mailbox_name, &err))
-                               EM_DEBUG_EXCEPTION("em_core_mail_move_from_server_ex failed - %d", err);
+                       if (!emcore_move_mail_on_server_ex(account_id , srt_mailbox_name, mail_ids, mail_id_count, dest_mailbox_name, &err))
+                               EM_DEBUG_EXCEPTION("emcore_move_mail_on_server_ex failed - %d", err);
 #else
-                       if (!em_core_mail_move_from_server(account_id , srt_mailbox_name, mail_ids, mail_id_count, dest_mailbox_name, &err))
-                               EM_DEBUG_EXCEPTION("\t em_core_mail_move_from_server failed - %d", err);
+                       if (!emcore_move_mail_on_server(account_id , srt_mailbox_name, mail_ids, mail_id_count, dest_mailbox_name, &err))
+                               EM_DEBUG_EXCEPTION("\t emcore_move_mail_on_server failed - %d", err);
 #endif
                }
        }
@@ -1872,11 +1801,11 @@ int event_handler_EMF_EVENT_DELETE_MAILBOX(int account_id, char *mailbox_name, i
        mailbox.account_id = account_id;
        mailbox.name = mailbox_name;
        
-       if (!em_core_check_network_status(&err)) 
-               EM_DEBUG_EXCEPTION("em_core_check_network_status failed [%d]", err);
+       if (!emnetwork_check_network_status(&err)) 
+               EM_DEBUG_EXCEPTION("emnetwork_check_network_status failed [%d]", err);
        else  {
-               if (!em_core_mailbox_delete(&mailbox, on_server, &err)) 
-                       EM_DEBUG_LOG("em_core_mailbox_delete failed - %d", err);
+               if (!emcore_delete_mailbox(&mailbox, on_server, &err)) 
+                       EM_DEBUG_LOG("emcore_delete failed - %d", err);
        }
 
        if (error)
@@ -1899,12 +1828,12 @@ int event_handler_EMF_EVENT_CREATE_MAILBOX(int account_id, char *mailbox_name, c
        mailbox.alias = mailbox_alias;
        mailbox.mailbox_type = mailbox_type;
        
-       if (!em_core_check_network_status(&err))  {
-               EM_DEBUG_EXCEPTION("em_core_check_network_status failed [%d]", err);
+       if (!emnetwork_check_network_status(&err))  {
+               EM_DEBUG_EXCEPTION("emnetwork_check_network_status failed [%d]", err);
        }
        else  {
-               if (!em_core_mailbox_create(&mailbox, on_server, &err)) 
-                       EM_DEBUG_EXCEPTION("em_core_mailbox_create failed - %d", err);
+               if (!emcore_create_mailbox(&mailbox, on_server, &err)) 
+                       EM_DEBUG_EXCEPTION("emcore_create failed - %d", err);
        }
 
 
@@ -1921,15 +1850,15 @@ int event_handler_EMF_EVENT_SYNC_MAIL_FLAG_TO_SERVER(int mail_id, int *error)
 
        int err = EMF_ERROR_NONE;
 
-       if (!em_core_check_network_status(&err)) 
-               EM_DEBUG_EXCEPTION("em_core_check_network_status failed [%d]", err);
+       if (!emnetwork_check_network_status(&err)) 
+               EM_DEBUG_EXCEPTION("emnetwork_check_network_status failed [%d]", err);
        else {
-               if (!em_core_mail_sync_flag_with_server(mail_id, &err))
-                       EM_DEBUG_EXCEPTION("em_core_mail_sync_flag_with_server failed [%d]", err);
-#ifdef __LOCAL_ACTIVITY__
+               if (!emcore_sync_flag_with_server(mail_id, &err))
+                       EM_DEBUG_EXCEPTION("emcore_sync_flag_with_server failed [%d]", err);
+#ifdef __FEATURE_LOCAL_ACTIVITY__
                else {
-                       emf_activity_tbl_t new_activity;
-                       memset(&new_activity, 0x00, sizeof(emf_activity_tbl_t));
+                       emstorage_activity_tbl_t new_activity;
+                       memset(&new_activity, 0x00, sizeof(emstorage_activity_tbl_t));
                        new_activity.activity_type = ACTIVITY_MODIFYFLAG;
                        new_activity.account_id    = event_data.account_id;
                        new_activity.mail_id       = event_data.event_param_data_4;
@@ -1937,10 +1866,10 @@ int event_handler_EMF_EVENT_SYNC_MAIL_FLAG_TO_SERVER(int mail_id, int *error)
                        new_activity.server_mailid = NULL;
                        new_activity.src_mbox      = NULL;
                        
-                       if (!em_core_activity_delete(&new_activity, &err))
+                       if (!emcore_delete_activity(&new_activity, &err))
                                EM_DEBUG_EXCEPTION(">>>>>>Local Activity [ACTIVITY_MODIFYFLAG] [%d] ", err);
                }                                               
-#endif /*  __LOCAL_ACTIVITY__ */
+#endif /*  __FEATURE_LOCAL_ACTIVITY__ */
        }
 
        if (error)
@@ -1959,8 +1888,8 @@ int event_handler_EMF_EVENT_DELETE_MAIL_ALL(int account_id, char *mailbox_name,
        temp_mailbox.account_id = account_id;
        temp_mailbox.name       = mailbox_name;
 
-       if (!em_core_mail_delete_all(&temp_mailbox, with_server, &err))
-               EM_DEBUG_EXCEPTION("em_core_mail_delete_all failed [%d]", err);
+       if (!emcore_delete_mail_all(&temp_mailbox, with_server, &err))
+               EM_DEBUG_EXCEPTION("emcore_delete_mail_all failed [%d]", err);
 
        if (error)
                *error = err;
@@ -1975,25 +1904,25 @@ int event_handler_EMF_EVENT_DELETE_MAIL(int account_id, int *mail_id_list, int m
        int mail_id = 0, err = EMF_ERROR_NONE, ret = false;
        emf_account_t *account_ref = NULL;
 
-       if (!(account_ref = em_core_get_account_reference(account_id))) {
-               EM_DEBUG_EXCEPTION("em_core_get_account_reference failed [%d]", account_id);
+       if (!(account_ref = emcore_get_account_reference(account_id))) {
+               EM_DEBUG_EXCEPTION("emcore_get_account_reference failed [%d]", account_id);
                err = EMF_ERROR_INVALID_ACCOUNT;
                goto FINISH_OFF;
        }
 
        if (account_ref->receiving_server_type == EMF_SERVER_TYPE_IMAP4) {
-               if (!em_core_check_network_status(&err)) {
-                       EM_DEBUG_EXCEPTION("em_core_check_network_status failed [%d]", err);
+               if (!emnetwork_check_network_status(&err)) {
+                       EM_DEBUG_EXCEPTION("emnetwork_check_network_status failed [%d]", err);
                                                                        
-                       if (!em_storage_notify_network_event(NOTI_MAIL_DELETE_ON_SERVER_FAIL, account_id, mailbox_name, mail_id, err))
-                               EM_DEBUG_EXCEPTION(" em_storage_notify_network_event [NOTI_MAIL_DELETE_ON_SERVER_FAIL] Failed");
+                       if (!emstorage_notify_network_event(NOTI_MAIL_DELETE_ON_SERVER_FAIL, account_id, mailbox_name, mail_id, err))
+                               EM_DEBUG_EXCEPTION(" emstorage_notify_network_event [NOTI_MAIL_DELETE_ON_SERVER_FAIL] Failed");
 
                }
-               else if (!em_core_mail_delete(account_id, mail_id_list, mail_id_count, EMF_DELETE_LOCAL_AND_SERVER, EMF_DELETED_BY_COMMAND, false, &err)) {
-                       EM_DEBUG_EXCEPTION("em_core_mail_delete failed [%d]", err);
+               else if (!emcore_delete_mail(account_id, mail_id_list, mail_id_count, EMF_DELETE_LOCAL_AND_SERVER, EMF_DELETED_BY_COMMAND, false, &err)) {
+                       EM_DEBUG_EXCEPTION("emcore_delete_mail failed [%d]", err);
                        
-                       if (!em_storage_notify_network_event(NOTI_MAIL_DELETE_ON_SERVER_FAIL, account_id, mailbox_name, mail_id, err))
-                               EM_DEBUG_EXCEPTION("em_storage_notify_network_event [NOTI_MAIL_DELETE_ON_SERVER_FAIL] Failed");
+                       if (!emstorage_notify_network_event(NOTI_MAIL_DELETE_ON_SERVER_FAIL, account_id, mailbox_name, mail_id, err))
+                               EM_DEBUG_EXCEPTION("emstorage_notify_network_event [NOTI_MAIL_DELETE_ON_SERVER_FAIL] Failed");
                }
        }
 
@@ -2012,15 +1941,15 @@ int event_hanlder_EMF_EVENT_SYNC_HEADER_OMA(int account_id, char *maibox_name, i
        EM_DEBUG_FUNC_BEGIN();
        int err = EMF_ERROR_NONE;
        
-       if (!em_core_check_network_status(&err))  {
-               EM_DEBUG_EXCEPTION("em_core_check_network_status failed [%d]", err);
-               if (!em_storage_notify_network_event(NOTI_DOWNLOAD_FAIL, account_id, maibox_name,  0, err))
-                       EM_DEBUG_EXCEPTION("em_storage_notify_network_event [NOTI_DOWNLOAD_FAIL] Failed");      
+       if (!emnetwork_check_network_status(&err))  {
+               EM_DEBUG_EXCEPTION("emnetwork_check_network_status failed [%d]", err);
+               if (!emstorage_notify_network_event(NOTI_DOWNLOAD_FAIL, account_id, maibox_name,  0, err))
+                       EM_DEBUG_EXCEPTION("emstorage_notify_network_event [NOTI_DOWNLOAD_FAIL] Failed");       
        }
        else  {
                EM_DEBUG_LOG("Sync of all mailbox");
-               if (!em_core_mailbox_sync_mailbox_list(account_id, "", &err))
-                       EM_DEBUG_EXCEPTION("em_core_mailbox_sync_mailbox_list failed [%d]", err);
+               if (!emcore_sync_mailbox_list(account_id, "", &err))
+                       EM_DEBUG_EXCEPTION("emcore_sync_mailbox_list failed [%d]", err);
        }
 
        if (error)
@@ -2034,57 +1963,57 @@ void* thread_func_branch_command(void *arg)
 {
        EM_DEBUG_FUNC_BEGIN();
        
-       int err = EMF_ERROR_NONE, is_storage_full = false, noti_id;
+       int err = EMF_ERROR_NONE, is_storage_full = false, noti_id = 0;
        emf_event_t event_data;
        emf_session_t *session = NULL;
        int handle_to_be_published = 0;
 
-       if (!em_storage_open(&err))  {
-               EM_DEBUG_EXCEPTION("em_storage_open falied [%d]", err);
+       if (!emstorage_open(&err))  {
+               EM_DEBUG_EXCEPTION("emstorage_open falied [%d]", err);
                return false;
        }
 
        /* check that event_data loop is continuous */
-       while (em_core_event_loop_continue())  {
-               if (!em_core_get_empty_session(&session)) 
-                       EM_DEBUG_EXCEPTION("em_core_get_empty_session failed...");
+       while (emcore_event_loop_continue())  {
+               if (!emcore_get_empty_session(&session)) 
+                       EM_DEBUG_EXCEPTION("emcore_get_empty_session failed...");
                
                /* get a event_data from event_data queue */
-               if (!em_core_retrieve_event(&event_data, NULL))  {      /*  no event_data pending */
+               if (!emcore_retrieve_event(&event_data, NULL))  {       /*  no event_data pending */
                        EM_DEBUG_LOG("For handle g_event_que[g_event_que_idx].type [%d], g_event_que_idx [%d]", g_event_que[g_event_que_idx].type, g_event_que_idx);
 #ifdef ENABLE_IMAP_IDLE_THREAD 
-                       if ( !em_core_check_network_status(&err))  {
+                       if ( !emnetwork_check_network_status(&err))  {
                                EM_DEBUG_LOG(">>>> Data Networking ON ");
                                if (g_client_run) {
                                        if (g_imap_idle_thread_alive) {
-                                               /* em_core_imap_idle_thread_kill(NULL); */
-                                               /* em_core_imap_idle_thread_create(NULL); */
+                                               /* emcore_kill_imap_idle_thread(NULL); */
+                                               /* emcore_create_imap_idle_thread(NULL); */
                                        }
                                        else {
                                                if (!send_thread_run)
-                                                       em_core_imap_idle_thread_create(event_data.account_id, NULL);
+                                                       emcore_create_imap_idle_thread(event_data.account_id, NULL);
                                        }
                                }
                        }
 #endif /*  ENABLE_IMAP_IDLE_THREAD */
-#ifdef __LOCAL_ACTIVITY__ 
+#ifdef __FEATURE_LOCAL_ACTIVITY__ 
                        /*  Local activity sync */
                        if (g_client_run && g_local_activity_run) {     
-                               emf_mail_account_tbl_t *account_list = NULL;
+                               emstorage_account_tbl_t *account_list = NULL;
                                int count = 0, i;
-                               if (!em_storage_get_account_list(&count, &account_list, true, true, &err)) 
-                                       EM_DEBUG_EXCEPTION("em_storage_get_account_list failed [%d]", err);
+                               if (!emstorage_get_account_list(&count, &account_list, true, true, &err)) 
+                                       EM_DEBUG_EXCEPTION("emstorage_get_account_list failed [%d]", err);
                                else {
                                        for (i = 0; i < count; i++) {
-                                               if (em_core_local_activity_sync(account_list[i].account_id, &err)) {
+                                               if (emcore_local_activity_sync(account_list[i].account_id, &err)) {
                                                        EM_DEBUG_LOG("Found local activity...!");
                                                        EM_DEBUG_LOG("Resetting g_local_activity_run ");
                                                        g_local_activity_run = 0;
-                                                       em_core_clear_session(session);
+                                                       emcore_clear_session(session);
                                                }
                                        }
                                        
-                                       em_storage_free_account(&account_list, count, &err);
+                                       emstorage_free_account(&account_list, count, &err);
                                        
                                        if (!g_local_activity_run)
                                                continue;
@@ -2116,7 +2045,7 @@ void* thread_func_branch_command(void *arg)
                        is_storage_full = false;
                        if (event_data.type == EMF_EVENT_SYNC_HEADER || event_data.type == EMF_EVENT_SYNC_HEADER_OMA || 
                                event_data.type == EMF_EVENT_DOWNLOAD_BODY || event_data.type == EMF_EVENT_DOWNLOAD_ATTACHMENT) {
-                               if (em_core_is_storage_full(&err) == true) {
+                               if (emcore_is_storage_full(&err) == true) {
                                        EM_DEBUG_EXCEPTION("Storage is full");
                                        switch (event_data.type) {
                                                case EMF_EVENT_SYNC_HEADER: 
@@ -2133,21 +2062,21 @@ void* thread_func_branch_command(void *arg)
                                                        break;
                                        }
                                        
-                                       if (!em_storage_notify_network_event(noti_id, event_data.account_id, NULL,  handle_to_be_published, err))
-                                               EM_DEBUG_EXCEPTION(" em_storage_notify_network_event [NOTI_DOWNLOAD_FAIL] Failed >>>> ");       
+                                       if (!emstorage_notify_network_event(noti_id, event_data.account_id, NULL,  handle_to_be_published, err))
+                                               EM_DEBUG_EXCEPTION(" emstorage_notify_network_event [NOTI_DOWNLOAD_FAIL] Failed >>>> ");        
                                        is_storage_full = true;
                                }
                        }
 
-                       em_storage_dimming_on_off(false, NULL);
+                       emdevice_set_dimming_on_off(false, NULL);
 
                        switch (event_data.type)  {
                                case EMF_EVENT_SYNC_IMAP_MAILBOX:  /*  get imap mailbox list  */
-                                       if (!em_core_check_network_status(&err))
-                                               EM_DEBUG_EXCEPTION("em_core_check_network_status failed [%d]", err);
+                                       if (!emnetwork_check_network_status(&err))
+                                               EM_DEBUG_EXCEPTION("emnetwork_check_network_status failed [%d]", err);
                                        else  {
-                                               if (!em_core_mailbox_sync_mailbox_list(event_data.account_id, event_data.event_param_data_3, &err))
-                                                       EM_DEBUG_EXCEPTION("em_core_mailbox_sync_mailbox_list failed [%d]", err);
+                                               if (!emcore_sync_mailbox_list(event_data.account_id, event_data.event_param_data_3, &err))
+                                                       EM_DEBUG_EXCEPTION("emcore_sync_mailbox_list failed [%d]", err);
                                        }
                                        EM_SAFE_FREE(event_data.event_param_data_3);
                                        break;
@@ -2222,22 +2151,16 @@ void* thread_func_branch_command(void *arg)
                                        break;
 
                                case EMF_EVENT_VALIDATE_AND_CREATE_ACCOUNT: 
-                                       event_handler_EMF_EVENT_VALIDATE_AND_CREATE_ACCOUNT(em_core_account_get_new_account_ref(), handle_to_be_published, &err);
+                                       event_handler_EMF_EVENT_VALIDATE_AND_CREATE_ACCOUNT(emcore_get_new_account_reference(), handle_to_be_published, &err);
                                        break;
 
                                case EMF_EVENT_VALIDATE_AND_UPDATE_ACCOUNT:  {
                                                emf_account_t *pAccount = (emf_account_t *)event_data.event_param_data_1;
                                                event_handler_EMF_EVENT_VALIDATE_AND_UPDATE_ACCOUNT(event_data.account_id, pAccount, handle_to_be_published, &err);
-                                               em_core_account_free(&pAccount, 1, NULL);
+                                               emcore_free_account(&pAccount, 1, NULL);
                                        }
                                        break;
 
-                               case EMF_EVENT_UPDATE_MAIL_OLD: 
-                                       event_handler_EMF_EVENT_UPDATE_MAIL_OLD((int)event_data.event_param_data_4, (emf_mail_t *)event_data.event_param_data_1, (emf_meeting_request_t  *)event_data.event_param_data_2, handle_to_be_published, &err);
-                                       event_data.event_param_data_1 = NULL;
-                                       event_data.event_param_data_2 = NULL;
-                                       break;
-                                       
                                case EMF_EVENT_UPDATE_MAIL:
                                        event_handler_EMF_EVENT_UPDATE_MAIL((emf_mail_data_t*)event_data.event_param_data_1, (emf_attachment_data_t*)event_data.event_param_data_2, event_data.event_param_data_4, (emf_meeting_request_t*)event_data.event_param_data_3, event_data.event_param_data_5, handle_to_be_published);
                                        
@@ -2251,18 +2174,18 @@ void* thread_func_branch_command(void *arg)
                                        EM_SAFE_FREE(event_data.event_param_data_3);
                                        break;
                        
-#ifdef __LOCAL_ACTIVITY__                                      
+#ifdef __FEATURE_LOCAL_ACTIVITY__                                      
                                case EMF_EVENT_LOCAL_ACTIVITY: 
                                        event_handler_EMF_EVENT_LOCAL_ACTIVITY(event_data.account_id, &err);
                                        break;
-#endif /* __LOCAL_ACTIVITY__*/                 
+#endif /* __FEATURE_LOCAL_ACTIVITY__*/                 
                                        
                                default: 
                                        break;
                        }
 
-                       em_storage_dimming_on_off(true, NULL);
-                       em_core_flush_memory();
+                       emdevice_set_dimming_on_off(true, NULL);
+                       em_flush_memory();
                        
                        switch (event_data.type)  {
                                case EMF_EVENT_SEND_MAIL: 
@@ -2298,17 +2221,17 @@ void* thread_func_branch_command(void *arg)
                        LEAVE_RECURSIVE_CRITICAL_SECTION(_event_queue_lock);
                }
                
-               em_core_clear_session(session);
+               emcore_clear_session(session);
        }
 
-       if (!em_storage_close(&err)) 
-               EM_DEBUG_EXCEPTION("em_storage_close falied [%d]", err);
+       if (!emstorage_close(&err)) 
+               EM_DEBUG_EXCEPTION("emstorage_close falied [%d]", err);
        
        EM_DEBUG_FUNC_END();
        return SUCCESS;
 }
 /*Send event_data loop*/
-EXPORT_API int em_core_send_event_loop_start(int *err_code)
+INTERNAL_FUNC int emcore_send_event_loop_start(int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
        int thread_error = -1;
@@ -2351,7 +2274,7 @@ EXPORT_API int em_core_send_event_loop_start(int *err_code)
 }
 
 /* finish api event_data loop */
-EXPORT_API int em_core_send_event_loop_stop(int *err_code)
+INTERNAL_FUNC int emcore_send_event_loop_stop(int *err_code)
 {
     EM_DEBUG_FUNC_BEGIN();
 
@@ -2367,7 +2290,7 @@ EXPORT_API int em_core_send_event_loop_stop(int *err_code)
     /* stop event_data loop */
     g_send_event_loop = 0;
 
-       em_core_cancel_send_mail_thread(g_send_active_que, NULL, err_code);
+       emcore_cancel_send_mail_thread(g_send_active_que, NULL, err_code);
        ENTER_CRITICAL_SECTION(_send_event_available_lock);
        WAKE_CONDITION_VARIABLE(_send_event_available_signal);          /*  MUST BE HERE */
        LEAVE_CRITICAL_SECTION(_send_event_available_lock);
@@ -2391,7 +2314,7 @@ EXPORT_API int em_core_send_event_loop_stop(int *err_code)
 }
 
 /* start api event_data loop */
-EXPORT_API int em_core_event_loop_start(int *err_code)
+INTERNAL_FUNC int emcore_start_event_loop(int *err_code)
 {
     EM_DEBUG_FUNC_BEGIN();
        int thread_error;
@@ -2416,7 +2339,7 @@ EXPORT_API int em_core_event_loop_start(int *err_code)
        INITIALIZE_RECURSIVE_CRITICAL_SECTION(_event_queue_lock);
        INITIALIZE_RECURSIVE_CRITICAL_SECTION(_event_callback_table_lock);
 
-       em_core_initialize_event_callback_table();
+       emcore_initialize_event_callback_table();
        
     /* create thread */
        THREAD_CREATE(g_srv_thread, thread_func_branch_command, NULL, thread_error);
@@ -2435,7 +2358,7 @@ EXPORT_API int em_core_event_loop_start(int *err_code)
 }
 
 /* finish api event_data loop */
-EXPORT_API int em_core_event_loop_stop(int *err_code)
+INTERNAL_FUNC int emcore_stop_event_loop(int *err_code)
 {
     EM_DEBUG_FUNC_BEGIN();
 
@@ -2452,7 +2375,7 @@ EXPORT_API int em_core_event_loop_stop(int *err_code)
     g_event_loop = 0;
 
        /*      pthread_kill(g_srv_thread, SIGINT); */
-       em_core_cancel_thread(g_active_que, NULL, err_code);
+       emcore_cancel_thread(g_active_que, NULL, err_code);
        
        ENTER_CRITICAL_SECTION(_event_available_lock);
        WAKE_CONDITION_VARIABLE(_event_available_signal);
@@ -2478,7 +2401,7 @@ EXPORT_API int em_core_event_loop_stop(int *err_code)
 }
 
 
-int em_core_get_active_queue_idx()
+int emcore_get_active_queue_idx()
 {
        return g_send_active_que;
 }
@@ -2486,7 +2409,7 @@ int em_core_get_active_queue_idx()
 /* check thread status
 * 0 : stop job 1 : continue job
 */
-EXPORT_API int em_core_check_thread_status()
+INTERNAL_FUNC int emcore_check_thread_status()
 {
        if (g_active_que <= 0)
                return true;
@@ -2495,7 +2418,7 @@ EXPORT_API int em_core_check_thread_status()
 }
 
 /* cancel a job  */
-EXPORT_API int em_core_cancel_thread(int handle, void *arg, int *err_code)
+INTERNAL_FUNC int emcore_cancel_thread(int handle, void *arg, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("handle[%d], arg[%p], err_code[%p]", handle, arg, err_code);
        
@@ -2520,14 +2443,14 @@ EXPORT_API int em_core_cancel_thread(int handle, void *arg, int *err_code)
                        case EMF_EVENT_SEND_MAIL_SAVED: 
                                EM_DEBUG_LOG("EMF_EVENT_SEND_MAIL or EMF_EVENT_SEND_MAIL_SAVED");
                                _sending_busy_unref();
-                               if (!em_storage_notify_network_event(NOTI_SEND_CANCEL, g_event_que[handle].account_id, NULL , g_event_que[handle].event_param_data_4, err))
-                                       EM_DEBUG_EXCEPTION(" em_storage_notify_network_event [ NOTI_SEND_CANCEL] Failed >>>> ");
+                               if (!emstorage_notify_network_event(NOTI_SEND_CANCEL, g_event_que[handle].account_id, NULL , g_event_que[handle].event_param_data_4, err))
+                                       EM_DEBUG_EXCEPTION(" emstorage_notify_network_event [ NOTI_SEND_CANCEL] Failed >>>> ");
                                break;
                        case EMF_EVENT_DOWNLOAD_BODY: 
                                EM_DEBUG_LOG("EMF_EVENT_DOWNLOAD_BODY");
                                _receiving_busy_unref();
-                               if (!em_storage_notify_network_event(NOTI_DOWNLOAD_BODY_CANCEL, g_event_que[handle].account_id, NULL , g_event_que[handle].event_param_data_4, err))
-                                       EM_DEBUG_EXCEPTION(" em_storage_notify_network_event [ NOTI_SEND_CANCEL] Failed >>>> ");
+                               if (!emstorage_notify_network_event(NOTI_DOWNLOAD_BODY_CANCEL, g_event_que[handle].account_id, NULL , g_event_que[handle].event_param_data_4, err))
+                                       EM_DEBUG_EXCEPTION(" emstorage_notify_network_event [ NOTI_SEND_CANCEL] Failed >>>> ");
                                break;
 
                        case EMF_EVENT_SYNC_HEADER: 
@@ -2542,8 +2465,8 @@ EXPORT_API int em_core_cancel_thread(int handle, void *arg, int *err_code)
                        case EMF_EVENT_VALIDATE_ACCOUNT: 
                                EM_DEBUG_LOG(" validate account waiting  :  cancel acc id  :  %d", g_event_que[handle].account_id);
                                _receiving_busy_unref();
-                               if (!em_storage_notify_network_event(NOTI_VALIDATE_ACCOUNT_CANCEL, g_event_que[handle].account_id, NULL , g_event_que[handle].event_param_data_4, err))
-                                       EM_DEBUG_EXCEPTION(" em_storage_notify_network_event [ NOTI_VALIDATE_ACCOUNT_CANCEL] Failed >>>> ");
+                               if (!emstorage_notify_network_event(NOTI_VALIDATE_ACCOUNT_CANCEL, g_event_que[handle].account_id, NULL , g_event_que[handle].event_param_data_4, err))
+                                       EM_DEBUG_EXCEPTION(" emstorage_notify_network_event [ NOTI_VALIDATE_ACCOUNT_CANCEL] Failed >>>> ");
                                break;
 
                        case EMF_EVENT_DELETE_MAIL: 
@@ -2575,7 +2498,21 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_core_cancel_all_threads_of_an_account(int account_id)
+/* check thread status
+* 0 : stop job 1 : continue job
+*/
+int emcore_check_send_mail_thread_status()
+{
+       EM_DEBUG_FUNC_BEGIN();
+
+       if (g_send_active_que <= 0)
+               return true;
+       EM_DEBUG_LOG("g_send_event_que[g_send_active_que[%d]].status[%d]", g_send_active_que, g_send_event_que[g_send_active_que].status);
+       EM_DEBUG_FUNC_END();
+       return (g_send_event_que[g_send_active_que].status == EMF_EVENT_STATUS_STARTED);
+}
+
+INTERNAL_FUNC int emcore_cancel_all_threads_of_an_account(int account_id)
 {
        EM_DEBUG_FUNC_BEGIN();
        int error_code = EMF_ERROR_NONE;
@@ -2586,7 +2523,7 @@ EXPORT_API int em_core_cancel_all_threads_of_an_account(int account_id)
                        EM_DEBUG_LOG("There is a live thread. %d", i);
                        if (g_event_que[i].account_id == account_id || g_event_que[i].account_id == ALL_ACCOUNT) {
                                EM_DEBUG_LOG("And it is for account %d", g_event_que[i].account_id);
-                               em_core_cancel_thread(i, NULL, &error_code);
+                               emcore_cancel_thread(i, NULL, &error_code);
                        }
                }
        }
@@ -2618,23 +2555,9 @@ EXPORT_API int em_core_cancel_all_threads_of_an_account(int account_id)
        return error_code;
 }
 
-/* check thread status
-* 0 : stop job 1 : continue job
-*/
-EXPORT_API int em_core_check_send_mail_thread_status()
-{
-       EM_DEBUG_FUNC_BEGIN();
-       
-       if (g_send_active_que <= 0)
-               return true;
-       EM_DEBUG_LOG("g_send_event_que[g_send_active_que[%d]].status[%d]", g_send_active_que, g_send_event_que[g_send_active_que].status);
-       EM_DEBUG_FUNC_END();
-       return (g_send_event_que[g_send_active_que].status == EMF_EVENT_STATUS_STARTED);
-}
-
 
 /* cancel send mail job  */
-EXPORT_API int em_core_cancel_send_mail_thread(int handle, void *arg, int *err_code)
+INTERNAL_FUNC int emcore_cancel_send_mail_thread(int handle, void *arg, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("handle[%d], arg[%p], err_code[%p]", handle, arg, err_code);
        
@@ -2659,8 +2582,8 @@ EXPORT_API int em_core_cancel_send_mail_thread(int handle, void *arg, int *err_c
                        case EMF_EVENT_SEND_MAIL_SAVED: 
                                _sending_busy_unref();
                                g_send_event_que[handle].status = EMF_EVENT_STATUS_CANCELED;
-                               if (!em_storage_notify_network_event(NOTI_SEND_CANCEL, g_send_event_que[handle].account_id, NULL , g_send_event_que[handle].event_param_data_4, err))
-                                       EM_DEBUG_EXCEPTION(" em_storage_notify_network_event [ NOTI_SEND_CANCEL] Failed >>>> ");
+                               if (!emstorage_notify_network_event(NOTI_SEND_CANCEL, g_send_event_que[handle].account_id, NULL , g_send_event_que[handle].event_param_data_4, err))
+                                       EM_DEBUG_EXCEPTION(" emstorage_notify_network_event [ NOTI_SEND_CANCEL] Failed >>>> ");
                                break;                  
                        default: 
                                break;
@@ -2686,7 +2609,7 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int em_core_get_receiving_event_queue(emf_event_t **event_queue, int *event_active_queue, int *err)
+INTERNAL_FUNC int emcore_get_receiving_event_queue(emf_event_t **event_queue, int *event_active_queue, int *err)
 {
        if (event_queue == NULL || event_active_queue == NULL) {
                EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM event_queue[%p] event_active_queue[%p]", event_queue, event_active_queue);
@@ -2703,7 +2626,7 @@ EXPORT_API int em_core_get_receiving_event_queue(emf_event_t **event_queue, int
        return true;
 }
 
-EXPORT_API int em_core_free_event(emf_event_t *event_data)
+INTERNAL_FUNC int emcore_free_event(emf_event_t *event_data)
 {
        EM_DEBUG_FUNC_BEGIN("event_data [%p]", event_data);
 
@@ -2717,212 +2640,16 @@ EXPORT_API int em_core_free_event(emf_event_t *event_data)
        return true;
 }
 
-#ifdef _CONTACT_SUBSCRIBE_CHANGE_
-static int g_last_sync_time = 0;
-
-EXPORT_API int em_core_init_last_sync_time(void)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       return em_core_get_last_sync_time();
-}
-
-EXPORT_API int em_core_set_last_sync_time(int sync_time)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int ret;
-       
-       if (sync_time == 0)
-               g_last_sync_time = time(NULL);
-       else
-               g_last_sync_time = sync_time;
-
-       ret = vconf_set_int(VCONF_KEY_LAST_SYNC_TIME, g_last_sync_time);
-       if (ret != 0) {
-               EM_DEBUG_EXCEPTION("vconf_set_int() Failed(%d)", ret);
-       }
-   
-       return g_last_sync_time;
-}
-
-EXPORT_API int em_core_get_last_sync_time(void)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int ret;
-       if (g_last_sync_time == 0) {
-               ret = vconf_get_int(VCONF_KEY_LAST_SYNC_TIME, &g_last_sync_time);
-               if (ret < 0) {
-                       EM_DEBUG_EXCEPTION("vconf_get_int() Failed(%d)", ret);
-                       g_last_sync_time = 0;
-               }
-       }
-       
-       return g_last_sync_time;
-}
-
-EXPORT_API int em_core_contact_sync_handler()
-{
-       EM_DEBUG_FUNC_BEGIN();
-
-       int ret = false;
-       int contact_ret;
-       int err = EMF_ERROR_NONE;
-       CTSiter iter;
-       int type;
-       int change_time;
-       int created_time;
-
-       int contact_index;
-       char *display_name = NULL;
-       CTSstruct *contact = NULL;
-       CTSvalue *base = NULL;
-       CTSvalue *row_info = NULL;
-       CTSvalue *contact_name_value = NULL;    
-       GSList *email_list = NULL;
-
-       int last_sync_time = em_core_get_last_sync_time();
-
-       EM_DEBUG_LOG("last_sync_time[%d]", last_sync_time);
-       
-       if (em_storage_begin_transaction(NULL, NULL, &err) == false) {
-               EM_DEBUG_EXCEPTION("em_storage_begin_transaction() error[%d]", err);
-               goto FINISH_OFF;
-       }
-       
-       if ((err = contacts_svc_get_updated_contacts(0, last_sync_time, &iter)) != CTS_SUCCESS) {
-               EM_DEBUG_EXCEPTION("contacts_svc_get_updated_contacts() error[%d]", err);
-               goto FINISH_OFF;
-       }
-       contact_ret = contacts_svc_iter_next(iter);
-       while (CTS_SUCCESS  == contact_ret) {
-               contact = NULL;
-               base = NULL;
-               row_info = NULL;
-               contact_name_value = NULL;
-               email_list = NULL;
-
-               if ((row_info = contacts_svc_iter_get_info(iter)) == NULL) {
-                       EM_DEBUG_EXCEPTION("contacts_svc_iter_get_info() failed.");
-               }
-               else {  /*  sync */
-                       contact_index = contacts_svc_value_get_int(row_info, CTS_LIST_CHANGE_ID_INT);
-                       type = contacts_svc_value_get_int(row_info, CTS_LIST_CHANGE_TYPE_INT);
-                       change_time = contacts_svc_value_get_int(row_info, CTS_LIST_CHANGE_TIME_INT);
-                       EM_DEBUG_LOG("Change ID[%d] Type[%d], change_time[%d]", contact_index, type, change_time);
-
-                       switch (type) {
-                               case CTS_OPERATION_INSERTED: 
-                               case CTS_OPERATION_UPDATED: 
-                                       EM_DEBUG_LOG("CTS_OPERATION_INSERTED or CTS_OPERATION_TYPE_UPDATED: [%d]", type);
-                                       if ((err = contacts_svc_get_contact(contact_index, &contact)) < 0) {
-                                               EM_DEBUG_LOG("contacts_svc_get_contact() failed. err[%d]", err);
-                                               contacts_svc_iter_remove(iter);
-                                               goto FINISH_OFF;
-                                       }
-                                       if ((err = contacts_svc_struct_get_value(contact, CTS_CF_BASE_INFO_VALUE, &base)) < 0) {
-                                               EM_DEBUG_LOG("contacts_svc_struct_get_value() failed. CTS_CF_BASE_INFO_VALUE  :  err[%d]", err);
-                                               contacts_svc_iter_remove(iter);
-                                               goto FINISH_OFF;
-                                       }
-                                       created_time = contacts_svc_value_get_int(base, CTS_BASE_VAL_CREATED_TIME_INT);
-
-                                       if ((err = contacts_svc_struct_get_value(contact, CTS_CF_NAME_VALUE, &contact_name_value)) < 0) {
-                                               EM_DEBUG_LOG("contacts_svc_struct_get_value() failed. CTS_CF_NAME_VALUE err[%d]", err);
-                                               contacts_svc_iter_remove(iter);
-                                               goto FINISH_OFF;
-                                       }
-                                       em_core_mail_get_display_name(contact_name_value, &display_name);
-
-                                       err = contacts_svc_struct_get_list(contact, CTS_CF_EMAIL_LIST, &email_list);
-                                       if (err == CTS_ERR_NO_DATA) {
-                                               EM_DEBUG_LOG("contacts_svc_struct_get_list()  :  NO EMAIL LIST");
-                                               break;
-                                       }
-                                       else if (err < 0) {
-                                               EM_DEBUG_LOG("contacts_svc_struct_get_list() failed. err[%d]", err);
-                                               contacts_svc_iter_remove(iter);
-                                               goto FINISH_OFF;
-                                       }
-
-                                       /*  contact id, display name, email list */
-                                       /* if (created_time >= last_sync_time) */
-                                       if (type == CTS_OPERATION_INSERTED) {
-                                               EM_DEBUG_LOG("Contact Added Time :  %d", change_time);
-                                               if (em_storage_contact_sync_insert(contact_index, display_name, email_list, &err) == false) {
-                                                       EM_DEBUG_LOG("em_storage_contact_sync_insert() failed. err[%d]", err);
-                                                       contacts_svc_iter_remove(iter);
-                                                       goto FINISH_OFF;
-                                               }
-                                       }
-                                       else if (type == CTS_OPERATION_UPDATED)  {
-                                               EM_DEBUG_LOG("Contact Updated Time :  %d", change_time);
-                                               if (em_storage_contact_sync_update(contact_index, display_name, email_list, &err) == false) {
-                                                       EM_DEBUG_LOG("em_storage_contact_sync_update() failed. err[%d]", err);
-                                                       contacts_svc_iter_remove(iter);
-                                                       goto FINISH_OFF;
-                                               }
-                                       }
-                                       contacts_svc_struct_free(contact);
-                                       contact = NULL;
-                                       EM_SAFE_FREE(display_name);
-                                       break;
-                               case CTS_OPERATION_DELETED: 
-                                       EM_DEBUG_LOG("CTS_OPERATION_TYPE_DELETED");
-                                       if (em_storage_contact_sync_delete(contact_index, &err) == false) {
-                                               EM_DEBUG_LOG("em_storage_contact_sync_delete() failed. err[%d]", err);
-                                               contacts_svc_iter_remove(iter);
-                                               goto FINISH_OFF;
-                                       }                                       
-                                       break;
-                               default: 
-                                       EM_DEBUG_EXCEPTION("Unknown CTS OPERATION [%d]", type);
-                                       break;
-                       }
-               }
-
-               /*  Next changing */
-               contacts_svc_value_free(row_info);
-               row_info = NULL;
-               contact_ret = contacts_svc_iter_next(iter);
-       }       
-
-       ret = true;
-FINISH_OFF: 
-       if (ret == true) {
-               if (em_storage_commit_transaction(NULL, NULL, NULL) == false)
-                       ret = false;
-               else
-                       em_core_set_last_sync_time(change_time);                /*  save changed time */
-       }
-       else {
-               em_storage_rollback_transaction(NULL, NULL, NULL);
-       }
-       
-       if (row_info != NULL)
-               contacts_svc_value_free(row_info);              
-       if (contact != NULL)
-               contacts_svc_struct_free(contact);
-       
-       return ret;
-}
-
-#endif /*  _CONTACT_SUBSCRIBE_CHANGE_ */
-
-
-
 #ifdef __FEATURE_KEEP_CONNECTION__
-
-EXPORT_API unsigned int em_core_get_receiving_thd_id()
+INTERNAL_FUNC unsigned int emcore_get_receiving_thd_id()
 {
        return (unsigned int)g_srv_thread;
 }
-
 #endif /*  __FEATURE_KEEP_CONNECTION__ */
 
-
-
 #ifdef __FEATURE_PARTIAL_BODY_DOWNLOAD__
 
-EXPORT_API int em_core_get_pbd_thd_state()
+INTERNAL_FUNC int emcore_get_pbd_thd_state()
 {
        int pbd_thd_state = false;
        ENTER_CRITICAL_SECTION(_state_variables_lock);
@@ -2931,7 +2658,7 @@ EXPORT_API int em_core_get_pbd_thd_state()
        return pbd_thd_state;
 }
 
-static int em_core_set_pbd_thd_state(int flag)
+static int emcore_set_pbd_thd_state(int flag)
 {
        ENTER_CRITICAL_SECTION(_state_variables_lock);
        g_pbd_thd_state = flag;
@@ -2940,14 +2667,14 @@ static int em_core_set_pbd_thd_state(int flag)
        return g_pbd_thd_state;
 }
 
-EXPORT_API unsigned int em_core_get_partial_body_thd_id()
+INTERNAL_FUNC unsigned int emcore_get_partial_body_thd_id()
 {
        EM_DEBUG_FUNC_BEGIN();
        EM_DEBUG_FUNC_END();
        return (unsigned int)g_partial_body_thd;
 }
 
-static int em_core_clear_bulk_pbd_que(int *err_code)
+static int emcore_clear_bulk_pbd_que(int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
 
@@ -2957,8 +2684,8 @@ static int em_core_clear_bulk_pbd_que(int *err_code)
        
        for (i = 0; i < BULK_PARTIAL_BODY_DOWNLOAD_COUNT; ++i) {
                if (g_partial_body_bulk_dwd_que[i].event_type) {
-                       if (false == em_core_free_partial_body_thd_event(g_partial_body_bulk_dwd_que + i, &error))                                       {
-                               EM_DEBUG_EXCEPTION("em_core_free_partial_body_thd_event_cell failed [%d]", error);
+                       if (false == emcore_free_partial_body_thd_event(g_partial_body_bulk_dwd_que + i, &error))                                        {
+                               EM_DEBUG_EXCEPTION("emcore_free_partial_body_thd_event_cell failed [%d]", error);
                                ret = false;
                                break;
                        }
@@ -2971,7 +2698,7 @@ static int em_core_clear_bulk_pbd_que(int *err_code)
        return ret;
 }
 
-static void em_core_pb_thd_set_local_activity_continue(int flag)
+static void emcore_pb_thd_set_local_activity_continue(int flag)
 {
        EM_DEBUG_FUNC_BEGIN("flag [%d]", flag);
        
@@ -2988,7 +2715,7 @@ static void em_core_pb_thd_set_local_activity_continue(int flag)
 }
 
 static 
-int em_core_pb_thd_can_local_activity_continue()
+int emcore_pb_thd_can_local_activity_continue()
 {
        EM_DEBUG_FUNC_BEGIN();
 
@@ -3004,7 +2731,7 @@ int em_core_pb_thd_can_local_activity_continue()
        
 }
 
-EXPORT_API int em_core_clear_partial_body_thd_event_que(int *err_code)
+INTERNAL_FUNC int emcore_clear_partial_body_thd_event_que(int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
 
@@ -3020,8 +2747,8 @@ EXPORT_API int em_core_clear_partial_body_thd_event_que(int *err_code)
        else {
                for (i = 0; i < TOTAL_PARTIAL_BODY_EVENTS; ++i) {
                        if (g_partial_body_thd_event_que[i].event_type) {
-                               if (false == em_core_free_partial_body_thd_event(g_partial_body_thd_event_que + i, &error))                                      {
-                                       EM_DEBUG_EXCEPTION("em_core_free_partial_body_thd_event_cell failed [%d]", error);
+                               if (false == emcore_free_partial_body_thd_event(g_partial_body_thd_event_que + i, &error))                                       {
+                                       EM_DEBUG_EXCEPTION("emcore_free_partial_body_thd_event_cell failed [%d]", error);
                                        ret = false;
                                        break;
                                }
@@ -3039,7 +2766,7 @@ EXPORT_API int em_core_clear_partial_body_thd_event_que(int *err_code)
        return ret;
 }
 
-EXPORT_API int em_core_is_partial_body_thd_que_empty()
+INTERNAL_FUNC int emcore_is_partial_body_thd_que_empty()
 {
        EM_DEBUG_FUNC_BEGIN();
 
@@ -3053,7 +2780,7 @@ EXPORT_API int em_core_is_partial_body_thd_que_empty()
        EM_DEBUG_FUNC_END("ret [%d]", ret);
        return ret;
 }
-EXPORT_API int em_core_is_partial_body_thd_que_full()
+INTERNAL_FUNC int emcore_is_partial_body_thd_que_full()
 {
        EM_DEBUG_FUNC_BEGIN();
 
@@ -3070,7 +2797,7 @@ EXPORT_API int em_core_is_partial_body_thd_que_full()
 
 /*
 Himanshu[h.gahalut] :  If either src pointer or dest pointer points to a cell of global partial body thread event_data queue, 
-then em_core_copy_partial_body_thd_event API should only be called from a portion of code which is protected 
+then emcore_copy_partial_body_thd_event API should only be called from a portion of code which is protected 
 through _partial_body_thd_event_queue_lock mutex.
 
 No mutex is used inside this API so that we can also use it to copy partial body events which are not a part of global event_data queue 
@@ -3082,7 +2809,7 @@ Also never call any function from this API which uses _partial_body_thd_event_qu
 
 */
 
-static int em_core_copy_partial_body_thd_event(emf_event_partial_body_thd *src, emf_event_partial_body_thd *dest, int *error_code)
+static int emcore_copy_partial_body_thd_event(emf_event_partial_body_thd *src, emf_event_partial_body_thd *dest, int *error_code)
 {
        EM_DEBUG_FUNC_BEGIN();
        int error = EMF_ERROR_NONE;
@@ -3116,7 +2843,7 @@ static int em_core_copy_partial_body_thd_event(emf_event_partial_body_thd *src,
 }
 
 /*
-Himanshu[h.gahalut] :  If em_core_free_partial_body_thd_event_cell API is used to free a cell of partial body thread event_data queue, 
+Himanshu[h.gahalut] :  If emcore_free_partial_body_thd_event_cell API is used to free a cell of partial body thread event_data queue, 
 it should only be called from a portion of code which is protected through _partial_body_thd_event_queue_lock mutex.
 
 No mutex is used inside this API so that we can also use it to free partial body events which are not a part of global event_data queue 
@@ -3128,7 +2855,7 @@ Also never call any function from this API which uses _partial_body_thd_event_qu
 
 */
 
-EXPORT_API int em_core_free_partial_body_thd_event(emf_event_partial_body_thd *partial_body_thd_event, int *error_code)
+INTERNAL_FUNC int emcore_free_partial_body_thd_event(emf_event_partial_body_thd *partial_body_thd_event, int *error_code)
 {
        EM_DEBUG_FUNC_BEGIN();
        
@@ -3146,7 +2873,7 @@ EXPORT_API int em_core_free_partial_body_thd_event(emf_event_partial_body_thd *p
        return true;
 }
 
-EXPORT_API int em_core_insert_partial_body_thread_event(emf_event_partial_body_thd *partial_body_thd_event, int *error_code)
+INTERNAL_FUNC int emcore_insert_partial_body_thread_event(emf_event_partial_body_thd *partial_body_thd_event, int *error_code)
 {
        EM_DEBUG_FUNC_BEGIN();
        
@@ -3187,8 +2914,8 @@ EXPORT_API int em_core_insert_partial_body_thread_event(emf_event_partial_body_t
        }
 
        if (-1 != empty_cell_index) {
-               if (false == em_core_copy_partial_body_thd_event(partial_body_thd_event, g_partial_body_thd_event_que+empty_cell_index , &error)) {
-                       EM_DEBUG_LOG("em_core_copy_partial_body_thd_event failed [%d]", error);
+               if (false == emcore_copy_partial_body_thd_event(partial_body_thd_event, g_partial_body_thd_event_que+empty_cell_index , &error)) {
+                       EM_DEBUG_LOG("emcore_copy_partial_body_thd_event failed [%d]", error);
                }
                else {
                        g_partial_body_thd_queue_empty = false;
@@ -3225,7 +2952,7 @@ EXPORT_API int em_core_insert_partial_body_thread_event(emf_event_partial_body_t
 
 /* h.gahlaut :  Return true only if event_data is retrieved successfully */
 
-static int em_core_retrieve_partial_body_thread_event(emf_event_partial_body_thd *partial_body_thd_event, int *error_code)
+static int emcore_retrieve_partial_body_thread_event(emf_event_partial_body_thd *partial_body_thd_event, int *error_code)
 {
        EM_DEBUG_FUNC_BEGIN();
 
@@ -3246,11 +2973,11 @@ static int em_core_retrieve_partial_body_thread_event(emf_event_partial_body_thd
        }
        else {
                /*Copy the event_data from queue to return it and free the event_data in queue */
-               if (false == em_core_copy_partial_body_thd_event(g_partial_body_thd_event_que + index, partial_body_thd_event, &error))
-                       EM_DEBUG_EXCEPTION("em_core_copy_partial_body_thd_event failed [%d]", error);
+               if (false == emcore_copy_partial_body_thd_event(g_partial_body_thd_event_que + index, partial_body_thd_event, &error))
+                       EM_DEBUG_EXCEPTION("emcore_copy_partial_body_thd_event failed [%d]", error);
                else {
-                       if (false == em_core_free_partial_body_thd_event(g_partial_body_thd_event_que + index, &error))
-                               EM_DEBUG_EXCEPTION("em_core_free_partial_body_thd_event_cell failed [%d]", error);
+                       if (false == emcore_free_partial_body_thd_event(g_partial_body_thd_event_que + index, &error))
+                               EM_DEBUG_EXCEPTION("emcore_free_partial_body_thd_event_cell failed [%d]", error);
                        else {
                        
                                g_partial_body_thd_queue_full = false;
@@ -3295,8 +3022,8 @@ gpointer partial_body_download_thread(gpointer data)
        
        /* Open connection with DB */
        
-       if (false == em_storage_open(&err))  {
-               EM_DEBUG_EXCEPTION("em_storage_open failed [%d]", err);
+       if (false == emstorage_open(&err))  {
+               EM_DEBUG_EXCEPTION("emstorage_open failed [%d]", err);
                return false;
        }
 
@@ -3306,14 +3033,14 @@ gpointer partial_body_download_thread(gpointer data)
                /*  Get an empty session  */
                /*  TODO :  Mutex should be used in session APIs */
                
-               if (false == em_core_get_empty_session(&session)) 
-                       EM_DEBUG_EXCEPTION("em_core_get_empty_session failed...");
+               if (false == emcore_get_empty_session(&session)) 
+                       EM_DEBUG_EXCEPTION("emcore_get_empty_session failed...");
                else {  /* Get and Event from the Partial Body thread Event Queue */
                        memset(&partial_body_thd_event, 0x00, sizeof(emf_event_partial_body_thd));              
 
-                       if (false == em_core_retrieve_partial_body_thread_event(&partial_body_thd_event, &err)) {
+                       if (false == emcore_retrieve_partial_body_thread_event(&partial_body_thd_event, &err)) {
                                if (EMF_ERROR_EVENT_QUEUE_EMPTY != err)
-                                       EM_DEBUG_EXCEPTION("em_core_retrieve_partial_body_thread_event failed [%d]", err);
+                                       EM_DEBUG_EXCEPTION("emcore_retrieve_partial_body_thread_event failed [%d]", err);
                                else {
                                        EM_DEBUG_LOG(" partial body thread event_data queue is empty.");
 
@@ -3323,24 +3050,24 @@ gpointer partial_body_download_thread(gpointer data)
                                                partial_body_thd_event.account_id = g_partial_body_bulk_dwd_que[0].account_id;
                                                partial_body_thd_event.mailbox_name = EM_SAFE_STRDUP(g_partial_body_bulk_dwd_que[0].mailbox_name);
                                                
-                                               if (false == em_core_mail_partial_body_download(&partial_body_thd_event, &err))
-                                                       EM_DEBUG_EXCEPTION("em_core_mail_partial_body_download from event_data queue failed [%d]", err);
+                                               if (false == emcore_mail_partial_body_download(&partial_body_thd_event, &err))
+                                                       EM_DEBUG_EXCEPTION("emcore_mail_partial_body_download from event_data queue failed [%d]", err);
 
-                                               em_core_pb_thd_set_local_activity_continue(true);
+                                               emcore_pb_thd_set_local_activity_continue(true);
                                        }
                                                        
-                                       if (true == em_core_pb_thd_can_local_activity_continue()) {
+                                       if (true == emcore_pb_thd_can_local_activity_continue()) {
                                                /*Check for local Activities */
                                                int is_local_activity_event_inserted = false;
 
-                                               if (false == em_core_partial_body_thd_local_activity_sync(&is_local_activity_event_inserted, &err)) {
-                                                       EM_DEBUG_EXCEPTION("em_core_partial_body_thd_local_activity_sync failed [%d]", err);
+                                               if (false == emcore_partial_body_thd_local_activity_sync(&is_local_activity_event_inserted, &err)) {
+                                                       EM_DEBUG_EXCEPTION("emcore_partial_body_thd_local_activity_sync failed [%d]", err);
                                                }
                                                else {
                                                        if (true == is_local_activity_event_inserted) {
-                                                               em_core_pb_thd_set_local_activity_continue(false);
+                                                               emcore_pb_thd_set_local_activity_continue(false);
                                                                
-                                                               em_core_clear_session(session);
+                                                               emcore_clear_session(session);
                                                                continue;
                                                        }                                               
                                                }       
@@ -3348,7 +3075,7 @@ gpointer partial_body_download_thread(gpointer data)
                                        
                                        EM_DEBUG_LOG(" Partial Body Thread is going to sleep");
 
-                                       em_core_set_pbd_thd_state(false);
+                                       emcore_set_pbd_thd_state(false);
 
                                        ENTER_CRITICAL_SECTION(_partial_body_thd_event_queue_lock);
                                        SLEEP_CONDITION_VARIABLE(_partial_body_thd_cond, _partial_body_thd_event_queue_lock);
@@ -3356,7 +3083,7 @@ gpointer partial_body_download_thread(gpointer data)
 
                                        EM_DEBUG_LOG(" Partial Body Thread wakes up ");
 
-                                       em_core_set_pbd_thd_state(true);
+                                       emcore_set_pbd_thd_state(true);
                                }
                                
                        }
@@ -3366,10 +3093,10 @@ gpointer partial_body_download_thread(gpointer data)
                                /* Since all events are network operations dnet init and sleep control is
                                done before entering switch block*/
 
-                               em_storage_dimming_on_off(false, NULL);
+                               emdevice_set_dimming_on_off(false, NULL);
                                
-                               if (!em_core_check_network_status( &err))  {
-                                       EM_DEBUG_EXCEPTION("em_core_check_network_status failed [%d]", err);;   
+                               if (!emnetwork_check_network_status( &err))  {
+                                       EM_DEBUG_EXCEPTION("emnetwork_check_network_status failed [%d]", err);; 
                                }
                                else {  
                                        /*  Process events  */
@@ -3377,8 +3104,8 @@ gpointer partial_body_download_thread(gpointer data)
                                                
                                        switch (partial_body_thd_event.event_type) {
                                                case EMF_EVENT_BULK_PARTIAL_BODY_DOWNLOAD:  {
-                                                       if (false == em_core_mail_partial_body_download(&partial_body_thd_event, &err)) {
-                                                               EM_DEBUG_EXCEPTION("em_core_mail_partial_body_download from event_data queue failed [%d]", err);
+                                                       if (false == emcore_mail_partial_body_download(&partial_body_thd_event, &err)) {
+                                                               EM_DEBUG_EXCEPTION("emcore_mail_partial_body_download from event_data queue failed [%d]", err);
                                                        }
                                                        break;
                                                }
@@ -3387,13 +3114,13 @@ gpointer partial_body_download_thread(gpointer data)
 
                                                        /* Both the checks below make sure that before starting local activity there is no new/pending event_data in
                                                        *   g_partial_body_thd_event_que and g_partial_body_bulk_dwd_que */
-                                                       if (false == em_core_is_partial_body_thd_que_empty())
+                                                       if (false == emcore_is_partial_body_thd_que_empty())
                                                                break;  
                                                        if (!g_partial_body_bulk_dwd_queue_empty)
                                                                break;
                                                        
-                                                       if (false == em_core_mail_partial_body_download(&partial_body_thd_event, &err))
-                                                               EM_DEBUG_EXCEPTION("em_core_mail_partial_body_download from activity table failed [%d]", err);
+                                                       if (false == emcore_mail_partial_body_download(&partial_body_thd_event, &err))
+                                                               EM_DEBUG_EXCEPTION("emcore_mail_partial_body_download from activity table failed [%d]", err);
                                                        break;
                                                }
                                                default: 
@@ -3402,23 +3129,23 @@ gpointer partial_body_download_thread(gpointer data)
                                        }
                                }
 
-                               if (false == em_core_free_partial_body_thd_event(&partial_body_thd_event, &err))
-                                       EM_DEBUG_EXCEPTION("em_core_free_partial_body_thd_event_cell failed [%d]", err);
+                               if (false == emcore_free_partial_body_thd_event(&partial_body_thd_event, &err))
+                                       EM_DEBUG_EXCEPTION("emcore_free_partial_body_thd_event_cell failed [%d]", err);
                                
-                               em_storage_dimming_on_off(true, NULL);
+                               emdevice_set_dimming_on_off(true, NULL);
                       }        
 
-                      em_core_clear_session(session);
+                      emcore_clear_session(session);
               }        
        }
 
        /* If something is added to end thread in future for any case then if thread is holding any resources
-       define a function em_core_partial_body_thd_loop_stop to release resources and call it
+       define a function emcore_partial_body_thd_loop_stop to release resources and call it
        here to end thread */
        return SUCCESS;
 }
 
-EXPORT_API int em_core_partial_body_thread_loop_start(int *err_code)
+INTERNAL_FUNC int emcore_partial_body_thread_loop_start(int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
 
@@ -3464,7 +3191,7 @@ EXPORT_API int em_core_partial_body_thread_loop_start(int *err_code)
 }
 
 /*Function to flush the bulk partial body download queue [santosh.br@samsung.com]*/
-static int em_core_partial_body_bulk_flush(int *error_code)
+static int emcore_partial_body_bulk_flush(int *error_code)
 {
        EM_DEBUG_FUNC_BEGIN();
        int error = EMF_ERROR_NONE;
@@ -3472,29 +3199,29 @@ static int em_core_partial_body_bulk_flush(int *error_code)
        MAILSTREAM *stream = NULL;
        void *tmp_stream = NULL;
 
-       if (!em_core_mailbox_open(g_partial_body_bulk_dwd_que[0].account_id, g_partial_body_bulk_dwd_que[0].mailbox_name, (void **)&tmp_stream, &error) || (NULL == tmp_stream)) {
-               EM_DEBUG_EXCEPTION("em_core_mailbox_open failed [%d]", error);
+       if (!emcore_connect_to_remote_mailbox(g_partial_body_bulk_dwd_que[0].account_id, g_partial_body_bulk_dwd_que[0].mailbox_name, (void **)&tmp_stream, &error) || (NULL == tmp_stream)) {
+               EM_DEBUG_EXCEPTION("emcore_connect_to_remote_mailbox failed [%d]", error);
                goto FINISH_OFF;
        }
        stream = (MAILSTREAM *)tmp_stream;
 
        /*  Call bulk download here */
-       if (false == em_core_bulk_partial_mailbody_download(stream, g_partial_body_bulk_dwd_que, g_partial_body_bulk_dwd_next_event_idx, &error)) {
-               EM_DEBUG_EXCEPTION(" em_core_bulk_partial_mailbody_download failed.. [%d]", error);
+       if (false == emcore_download_bulk_partial_mail_body(stream, g_partial_body_bulk_dwd_que, g_partial_body_bulk_dwd_next_event_idx, &error)) {
+               EM_DEBUG_EXCEPTION(" emcore_download_bulk_partial_mail_body failed.. [%d]", error);
                goto FINISH_OFF;
        }
 
        ret = true;
 FINISH_OFF:    
 
-       em_core_mailbox_close(0, stream);                               
+       emcore_close_mailbox(0, stream);                                
        stream = NULL;
 
        g_partial_body_bulk_dwd_next_event_idx = 0;
        g_partial_body_bulk_dwd_queue_empty = true;
                
-       if (false == em_core_clear_bulk_pbd_que(&error))
-               EM_DEBUG_EXCEPTION("em_core_clear_bulk_pbd_que failed [%d]", error);
+       if (false == emcore_clear_bulk_pbd_que(&error))
+               EM_DEBUG_EXCEPTION("emcore_clear_bulk_pbd_que failed [%d]", error);
 
        if (NULL != error_code)
                *error_code = error;
@@ -3505,7 +3232,7 @@ FINISH_OFF:
 
 
 /* Function to pass UID list and Data for bulk partial body download [santosh.br@samsung.com]/[h.gahlaut@samsung.com] */
-EXPORT_API int em_core_mail_partial_body_download(emf_event_partial_body_thd *pbd_event, int *error_code)
+INTERNAL_FUNC int emcore_mail_partial_body_download(emf_event_partial_body_thd *pbd_event, int *error_code)
 {
        EM_DEBUG_FUNC_BEGIN();
        int error = EMF_ERROR_NONE;
@@ -3536,8 +3263,8 @@ EXPORT_API int em_core_mail_partial_body_download(emf_event_partial_body_thd *pb
                        EM_DEBUG_LOG("Event is for the same mailbox and same account as the already present events in download que");
                        EM_DEBUG_LOG("Check if the download que reached its limit. If yes then first flush the que.");
                        if (g_partial_body_bulk_dwd_next_event_idx == BULK_PARTIAL_BODY_DOWNLOAD_COUNT) {
-                               if (false == em_core_partial_body_bulk_flush(&error)) {
-                                       EM_DEBUG_EXCEPTION("Partial Body thread em_core_partial_body_bulk_flush failed - %d", error);   
+                               if (false == emcore_partial_body_bulk_flush(&error)) {
+                                       EM_DEBUG_EXCEPTION("Partial Body thread emcore_partial_body_bulk_flush failed - %d", error);    
                                        goto FINISH_OFF;
                                }
                        }
@@ -3547,15 +3274,15 @@ EXPORT_API int em_core_mail_partial_body_download(emf_event_partial_body_thd *pb
                        EM_DEBUG_LOG("Flush the current que if not empty");
                        EM_DEBUG_LOG("g_partial_body_bulk_dwd_queue_empty [%d]", g_partial_body_bulk_dwd_queue_empty);
                        if (!g_partial_body_bulk_dwd_queue_empty) {
-                               if (false == em_core_partial_body_bulk_flush(&error)) {
-                                       EM_DEBUG_EXCEPTION("Partial Body thread em_core_partial_body_bulk_flush failed - %d", error);   
+                               if (false == emcore_partial_body_bulk_flush(&error)) {
+                                       EM_DEBUG_EXCEPTION("Partial Body thread emcore_partial_body_bulk_flush failed - %d", error);    
                                        goto FINISH_OFF;
                                }
                        }
                }
                /*Add the event_data to the download que array */
-               if (false == em_core_copy_partial_body_thd_event(pbd_event, g_partial_body_bulk_dwd_que+(g_partial_body_bulk_dwd_next_event_idx), &error))
-                       EM_DEBUG_EXCEPTION("\t Partial Body thread em_core_copy_partial_body_thd_event failed - %d", error);            
+               if (false == emcore_copy_partial_body_thd_event(pbd_event, g_partial_body_bulk_dwd_que+(g_partial_body_bulk_dwd_next_event_idx), &error))
+                       EM_DEBUG_EXCEPTION("\t Partial Body thread emcore_copy_partial_body_thd_event failed - %d", error);             
                else {
                        g_partial_body_bulk_dwd_queue_empty = false;
                        g_partial_body_bulk_dwd_next_event_idx++;
@@ -3568,16 +3295,16 @@ EXPORT_API int em_core_mail_partial_body_download(emf_event_partial_body_thd *pb
 
                EM_DEBUG_LOG("Event is coming from local activity.");
                /* Get all the accounts for which local activities are pending */
-               if (false == em_storage_get_pbd_account_list(&account_list, &account_count, false, &error)) {
-                               EM_DEBUG_EXCEPTION(" em_storage_get_mailbox_list failed.. [%d]", error);
+               if (false == emstorage_get_pbd_account_list(&account_list, &account_count, false, &error)) {
+                               EM_DEBUG_EXCEPTION(" emstorage_get_mailbox_list failed.. [%d]", error);
                                error = EMF_ERROR_MAILBOX_NOT_FOUND;
                                goto FINISH_OFF;
                }
 
                for (m = 0; m < account_count; ++m) {
                        /* Get the mailbox list for the account to start bulk partial body fetch for mails in each mailbox of accounts one by one*/
-                       if (false == em_storage_get_pbd_mailbox_list(account_list[m], &mailbox_list, &count, false, &error)) {
-                                       EM_DEBUG_EXCEPTION(" em_storage_get_mailbox_list failed.. [%d]", error);
+                       if (false == emstorage_get_pbd_mailbox_list(account_list[m], &mailbox_list, &count, false, &error)) {
+                                       EM_DEBUG_EXCEPTION(" emstorage_get_mailbox_list failed.. [%d]", error);
                                        error = EMF_ERROR_MAILBOX_NOT_FOUND;
                                        goto FINISH_OFF;
                        }
@@ -3586,16 +3313,16 @@ EXPORT_API int em_core_mail_partial_body_download(emf_event_partial_body_thd *pb
                                int k = 0;
                                int activity_count = 0;
 
-                               if (!em_core_mailbox_open(account_list[m],  mailbox_list[i], (void **)&tmp_stream, &error))  {
-                                       EM_DEBUG_EXCEPTION("em_core_mailbox_open failed [%d]", error);
+                               if (!emcore_connect_to_remote_mailbox(account_list[m],  mailbox_list[i], (void **)&tmp_stream, &error))  {
+                                       EM_DEBUG_EXCEPTION("emcore_connect_to_remote_mailbox failed [%d]", error);
                                        stream = NULL;
                                        goto FINISH_OFF;
                                }
 
                                stream = (MAILSTREAM *)tmp_stream;
                        
-                               if (false == em_storage_get_mailbox_pbd_activity_count(account_list[m], mailbox_list[i], &activity_count, false, &error)) {
-                                       EM_DEBUG_EXCEPTION(" em_storage_get_mailbox_pbd_activity_count failed.. [%d]", error);
+                               if (false == emstorage_get_mailbox_pbd_activity_count(account_list[m], mailbox_list[i], &activity_count, false, &error)) {
+                                       EM_DEBUG_EXCEPTION(" emstorage_get_mailbox_pbd_activity_count failed.. [%d]", error);
                                        continue;
                                }
                                
@@ -3607,8 +3334,8 @@ EXPORT_API int em_core_mail_partial_body_download(emf_event_partial_body_thd *pb
                                        int num = BULK_PARTIAL_BODY_DOWNLOAD_COUNT;
                                        int index = 0;
 
-                                       if (false == em_storage_get_pbd_activity_data(account_list[j], mailbox_list[i], &activity_data_list, &num_activity,  false, &error))
-                                               EM_DEBUG_EXCEPTION(" em_storage_get_pbd_activity_data failed.. [%d]", error);
+                                       if (false == emstorage_get_pbd_activity_data(account_list[j], mailbox_list[i], &activity_data_list, &num_activity,  false, &error))
+                                               EM_DEBUG_EXCEPTION(" emstorage_get_pbd_activity_data failed.. [%d]", error);
 
                                        if (NULL == activity_data_list) {
                                                EM_DEBUG_EXCEPTION(" activity_data_list is null..");
@@ -3623,20 +3350,20 @@ EXPORT_API int em_core_mail_partial_body_download(emf_event_partial_body_thd *pb
                                                        num = remainder;
 
                                                /*Call bulk download here */
-                                               if (false == em_core_bulk_partial_mailbody_download(stream, activity_data_list+index, num, &error)) {
-                                                       EM_DEBUG_EXCEPTION(" em_core_bulk_partial_mailbody_download failed.. [%d]", error);
+                                               if (false == emcore_download_bulk_partial_mail_body(stream, activity_data_list+index, num, &error)) {
+                                                       EM_DEBUG_EXCEPTION(" emcore_download_bulk_partial_mail_body failed.. [%d]", error);
                                                        temp_error = EMF_ERROR_NO_RESPONSE;
                                                }
                                                
                                                for (k = 0; k < num; k++) {
                                                        if (activity_data_list[index + k].activity_type)
-                                                               em_core_free_partial_body_thd_event(activity_data_list + index + k, &error);
+                                                               emcore_free_partial_body_thd_event(activity_data_list + index + k, &error);
                                                        else
                                                                break;
                                                }
                                                index += num;
                                                
-                                               if (false == em_core_is_partial_body_thd_que_empty()) {
+                                               if (false == emcore_is_partial_body_thd_que_empty()) {
                                                        ret = true;
                                                        goto FINISH_OFF;                /* Stop Local Activity Sync */
                                                }
@@ -3647,7 +3374,7 @@ EXPORT_API int em_core_mail_partial_body_download(emf_event_partial_body_thd *pb
                                        }
                                }
                        }       
-                       em_core_mailbox_close(0, stream);                               
+                       emcore_close_mailbox(0, stream);                                
                        stream = NULL;
                        tmp_stream = NULL;
                }       
@@ -3655,17 +3382,17 @@ EXPORT_API int em_core_mail_partial_body_download(emf_event_partial_body_thd *pb
                /* After completing one cycle of local activity sync , 
                local activity continue variable should be set to false. */
                                                                
-               em_core_pb_thd_set_local_activity_continue(false);
+               emcore_pb_thd_set_local_activity_continue(false);
        }
        else /* Event-type is 0 which means Event is to flush the que when no more events are present in g_partial_body_thd_event_que */ {
                /*Check if events have arrived in g_partial_body_thd_event_que */
-               if (false == em_core_is_partial_body_thd_que_empty()) {
-                       EM_DEBUG_LOG("em_core_is_partial_body_thd_que_empty retured true");
+               if (false == emcore_is_partial_body_thd_que_empty()) {
+                       EM_DEBUG_LOG("emcore_is_partial_body_thd_que_empty retured true");
                        ret = true;
                        goto FINISH_OFF;                /* Stop Local Activity Sync */
                }
-               if (false == em_core_partial_body_bulk_flush(&error)) {
-                       EM_DEBUG_EXCEPTION("\t Partial Body thread em_core_partial_body_bulk_flush failed - %d", error);        
+               if (false == emcore_partial_body_bulk_flush(&error)) {
+                       EM_DEBUG_EXCEPTION("\t Partial Body thread emcore_partial_body_bulk_flush failed - %d", error); 
                        goto FINISH_OFF;
                }
        }
@@ -3683,13 +3410,13 @@ FINISH_OFF:
        if (activity_data_list) {
                for (i = 0; i < num_activity; i++) {
                        if (activity_data_list[i].activity_type)
-                               em_core_free_partial_body_thd_event(activity_data_list + i, &error);
+                               emcore_free_partial_body_thd_event(activity_data_list + i, &error);
                        else
                                break;
                }
        }
 
-       em_core_mailbox_close(0, stream);                               
+       emcore_close_mailbox(0, stream);                                
        stream = NULL;
        
        if (NULL != error_code)
similarity index 84%
rename from email-core/em-core-global.c
rename to email-core/email-core-global.c
index b4d522f..67a0b40 100755 (executable)
@@ -22,7 +22,7 @@
 
 
 /******************************************************************************
- * File :  em-core-global.c
+ * File :  email-core-global.c
  * Desc :  Mail Engine Global
  *
  * Auth :  Kyuho Jo 
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include "emf-types.h"
-
-
+#include "email-core-global.h"
 
 emf_account_t g_new_account;
 emf_account_list_t *g_account_list = NULL;
 int g_account_num = 0;
 int g_account_retrieved = 0;
 
-EXPORT_API emf_account_t *em_core_account_get_new_account_ref()
+extern int pthread_mutexattr_settype (pthread_mutexattr_t *__attr, int __kind) __THROW __nonnull ((1));
+
+INTERNAL_FUNC emf_account_t *emcore_get_new_account_reference()
 {
        return &g_new_account;
 }
diff --git a/email-core/email-core-imap-idle.c b/email-core/email-core-imap-idle.c
new file mode 100755 (executable)
index 0000000..b995071
--- /dev/null
@@ -0,0 +1,516 @@
+/*
+*  email-service
+*
+* Copyright (c) 2000 - 2011 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.
+*
+*/
+
+/**
+ *
+ * This file contains functionality related to IMAP IDLE.
+ * to interact with email-service.
+ * @file               em_core-imap-idle.c
+ * @author     
+ * @version    0.1
+ * @brief              This file contains functionality to provide IMAP IDLE support in email-service. 
+ */
+
+#include <email-internal-types.h>
+
+#ifdef __FEATURE_IMAP_IDLE__
+#include <glib.h>
+#include <openssl/ssl.h>
+#include "c-client.h"
+#include "lnx_inc.h"
+#include "email-core-imap-idle.h"
+#include "email-debug-log.h"
+#include "email-storage.h" 
+#include "email-network.h"
+#include "email-core-utils.h"
+#include "email-core-mailbox.h"
+#include "email-core-event.h"
+#include "email-core-account.h"
+
+
+/*Definitions copied temporarily from ssl_unix.c */
+#define SSLBUFLEN 8192
+
+typedef struct ssl_stream {
+  TCPSTREAM *tcpstream; /* TCP stream */
+  SSL_CTX *context;     /* SSL context */
+  SSL *con;             /* SSL connection */
+  int ictr;             /* input counter */
+  char *iptr;           /* input pointer */
+  char ibuf[SSLBUFLEN]; /* input buffer */
+} SSLSTREAM;
+/*Definitions copied temporarily from ssl_unix.c - end*/
+
+thread_t imap_idle_thread;
+int g_imap_idle_thread_alive = 0;
+
+void* emcore_imap_idle_run(void* thread_user_data);
+static int emcore_imap_idle_parse_response_stream(emf_mailbox_t *mailbox, int *err_code);
+static int emcore_imap_idle_connect_and_idle_on_mailbox(emf_mailbox_t *mailbox, int *err_code);
+
+int emcore_create_imap_idle_thread(int account_id, int *err_code)
+{
+       EM_DEBUG_FUNC_BEGIN("account_id [%d], err_code [%p]", account_id, err_code);
+       int ret = false;
+       int err = EMF_ERROR_NONE;
+       int thread_error;
+
+       g_imap_idle_thread_alive = 1;
+       THREAD_CREATE(imap_idle_thread, emcore_imap_idle_run, NULL, thread_error);
+
+       if (thread_error != 0) {
+               EM_DEBUG_EXCEPTION("cannot make IMAP IDLE thread...");
+               err = EMF_ERROR_UNKNOWN;
+               g_imap_idle_thread_alive = 0;
+               goto FINISH_OFF;
+       }
+
+       ret = true;
+
+FINISH_OFF:
+       if (err_code != NULL)
+               *err_code = err;
+
+       EM_DEBUG_FUNC_END("ret [%d]", ret);
+       return ret;
+}
+
+/*
+Need to identify various scenarios where thread needs to be killed
+1. After the timer set to 10 min expires.
+2. When No SIM, thread is created and emnetwork_check_network_status() fails.
+*/
+int emcore_kill_imap_idle_thread(int *err_code)
+{
+       EM_DEBUG_FUNC_BEGIN("err_code [%p]", err_code);
+       int ret = true;
+       int err = EMF_ERROR_NONE;
+
+       EM_DEBUG_LOG("killing thread");
+
+       /* kill the thread */
+       EM_DEBUG_LOG("Before g_thread_exit");
+       g_imap_idle_thread_alive = 0;
+       EM_DEBUG_LOG("After g_thread_exit");
+
+       EM_DEBUG_LOG("Making imap idle NULL");
+       imap_idle_thread = 0;
+       EM_DEBUG_LOG("killed IMAP IDLE");
+
+       if (err_code)
+               *err_code = err;
+
+       EM_DEBUG_FUNC_END("ret [%d]", ret);
+       return ret;
+}
+
+int emcore_imap_idle_loop_start(emf_mailbox_t *mailbox_list,  int num, int *err_code)
+{
+       EM_DEBUG_FUNC_BEGIN("mailbox_list[%p], num[%d]", mailbox_list, num);
+       fd_set readfds;
+       int maxfd = 0;
+       int err = EMF_ERROR_NONE;
+       int counter = 0;
+       int select_result = 0;
+       int ret = false;
+       emf_mailbox_t *temp = NULL;
+       struct timeval timeout;
+
+       EM_DEBUG_EXCEPTION(">>>>>>> emcore_imap_idle_loop_start start ");
+       if (!mailbox_list || !num) {
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
+               err = EMF_ERROR_INVALID_PARAM;
+               goto FINISH_OFF;
+       }
+
+       /* set timeout value to 10min */
+       timeout.tv_sec = 10 * 60;
+       timeout.tv_usec = 0;
+
+       /* IMAP IDLE LOOP */
+       while (1){
+               EM_DEBUG_EXCEPTION(">>>>>>>>>>>IDLING>>>>>>>>>>>>");
+               FD_ZERO(&readfds);
+               temp = mailbox_list;
+               for (counter = 0; counter < num; counter++) {
+                       FD_SET(temp->hold_connection, &readfds);
+                       if (temp->hold_connection > maxfd)
+                               maxfd = temp->hold_connection; 
+                       temp = temp->next;
+               }
+               maxfd++;
+               temp = mailbox_list;
+               
+               select_result = select(maxfd, &readfds, NULL, NULL, &timeout);
+
+               if (select_result > 0) /* Data coming on some socket */ {
+                       EM_DEBUG_EXCEPTION(">>>> Data Coming from Socket ");
+                       for (counter = 0; counter < num; counter++) {
+                               if (temp && FD_ISSET(temp->hold_connection, &readfds)) {
+                                       if (!emcore_imap_idle_parse_response_stream(temp, &err)) {
+                                               EM_DEBUG_EXCEPTION(">>>> emcore_imap_idle_loop_start 6 ");
+                                               emcore_close_mailbox(temp->account_id, temp->mail_stream);
+                                               EM_DEBUG_EXCEPTION(">>>> emcore_imap_idle_loop_start 7 ");
+                                               goto FINISH_OFF;
+                                       }
+                                       break; /* break for now - check if it is possible to get data on two sockets - shasikala.p */
+                               }
+                               temp = temp->next;
+                       }
+               }
+
+               else if (select_result == 0) /* Timeout occurred */ {
+                       EM_DEBUG_EXCEPTION(">>>> emcore_imap_idle_loop_start 8 ");
+                       IMAPLOCAL *imap_local = NULL;
+                       char cmd[128], tag[32];
+                       char *p = NULL;
+                       /* send DONE Command */
+                       /* free all data here */
+                       for (counter = 0; counter < num; counter++) {
+                               EM_DEBUG_LOG(">>>> emcore_imap_idle_loop_start 9 ");
+                               if (temp && temp->mail_stream) {
+                                       imap_local = ((MAILSTREAM *)temp->mail_stream)->local;
+
+                                       sprintf(tag, "%08lx", 0xffffffff & (((MAILSTREAM *)temp->mail_stream)->gensym++));
+                                       sprintf(cmd, "%s DONE\015\012", tag);
+
+                                       if (!imap_local->netstream || !net_sout(imap_local->netstream, cmd, (int)strlen(cmd))) {
+                                               EM_DEBUG_EXCEPTION("network error - failed to DONE on Mailbox - %s ", temp->name);
+                                       }
+                                       else {
+                                               while (imap_local->netstream) {
+                                               p = net_getline(imap_local->netstream);
+                                               EM_DEBUG_EXCEPTION("p =[%s]", p);
+                                                       emcore_close_mailbox(temp->account_id, temp->mail_stream);
+                                                       break;
+                                           }
+                                       }
+                               }
+                               temp = temp->next;
+                       }
+                       
+                       
+                       /* kill idle thread */
+                       emcore_kill_imap_idle_thread(&err);
+                       break;
+               }
+
+               else {
+                       /*
+                       might happen that a socket descriptor passed to select got closed
+                       check which got closed and make hold_connection 0
+                       */
+                       EM_DEBUG_EXCEPTION(">>>>>> socket descriptor error :  No Data ");
+                       break;
+               }
+
+               select_result = 0;
+       }
+
+       ret = true;
+
+       EM_DEBUG_LOG(">>>> emcore_imap_idle_loop_start 17  ");
+
+FINISH_OFF: 
+
+       if (err_code)
+               *err_code = err;
+
+       EM_DEBUG_FUNC_END("ret [%d]", ret);
+       return ret;
+}
+
+void* emcore_imap_idle_run(void* thread_user_data)
+{
+       EM_DEBUG_FUNC_BEGIN("thread_user_data [%p]", thread_user_data);
+       char              *mailbox_list[3];
+       int                mailbox_num = 0;
+       int                err = EMF_ERROR_NONE;
+       int                flag = true;
+       int                num = 0;
+       int                counter = 0;
+       int                accountID = (int)thread_user_data;
+       emf_mailbox_t     *mail_box_list = NULL;
+       emf_mailbox_t     *curr_mailbox = NULL;
+       emf_mailbox_t     *prev_mailbox = NULL;
+       emstorage_mailbox_tbl_t *local_mailbox = NULL;
+       emf_session_t     *session = NULL;
+
+       if ( !emnetwork_check_network_status(&err)) {
+               EM_DEBUG_EXCEPTION("emnetwork_check_network_status failed [%d]", err);
+               goto FINISH_OFF;
+       }
+       /* Connect to DB */
+       if (!emstorage_open(&err)) {
+               EM_DEBUG_EXCEPTION("emstorage_open falied [%d]", err);
+               goto FINISH_OFF;
+       }
+
+       if (!emcore_get_empty_session(&session))
+               EM_DEBUG_EXCEPTION("emcore_get_empty_session failed...");
+
+       /* get the list of mailbox name on which IDLE notifications are required. */
+       /* currently all INBOXES of all accounts need to be notified */
+       /* Dependent on GetMyIdentities for account names */
+
+       /* For testing - mailbox_num and mailbox_list are hardcoded here */
+       mailbox_num     = 1;
+       mailbox_list[0] = EM_SAFE_STRDUP("INBOX");
+
+       /* make a list of mailboxes IDLING */
+       for (counter = 0; counter < mailbox_num; counter++){
+               EM_DEBUG_EXCEPTION(">>>> emcore_imap_idle_run 4 ");
+               if (!emstorage_get_mailbox_by_name(accountID, 0,  mailbox_list[counter], &local_mailbox, true, &err)) {
+                       EM_DEBUG_EXCEPTION("emstorage_get_mailbox_by_name failed [%d]", err);
+               }
+               else {
+                       curr_mailbox             = em_malloc(sizeof(emf_mailbox_t));
+                       curr_mailbox->account_id = local_mailbox->account_id;
+                       curr_mailbox->name       = EM_SAFE_STRDUP(local_mailbox->mailbox_name);
+                       curr_mailbox->local      = local_mailbox->local_yn;
+                       if (!emcore_imap_idle_connect_and_idle_on_mailbox(curr_mailbox, &err)) {
+                               EM_DEBUG_EXCEPTION("emcore_imap_idle_connect_and_idle_on_mailbox failed [%d]", err);
+                               emcore_free_mailbox(&curr_mailbox, 1, NULL);
+                       }
+                       else {
+                               if (flag) {
+                                       mail_box_list = curr_mailbox;
+                                       prev_mailbox = curr_mailbox;
+                                       flag = false;
+                                       num++;
+                               }
+                               else {
+                                       prev_mailbox->next = curr_mailbox;
+                                       prev_mailbox = curr_mailbox;
+                                       num++;
+                               }
+                       }
+               }
+               if (local_mailbox != NULL)
+                       emstorage_free_mailbox(&local_mailbox, 1, NULL);
+       }
+
+       emcore_clear_session(session);
+       emcore_imap_idle_loop_start(mail_box_list, num, NULL);
+
+FINISH_OFF:
+
+       if (!emstorage_close(&err)) {
+               EM_DEBUG_EXCEPTION("emstorage_close falied [%d]", err);
+       }
+
+       EM_DEBUG_FUNC_END();
+       return NULL;
+}
+
+int emcore_imap_idle_insert_sync_event(emf_mailbox_t *mailbox, int *err_code)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       
+       int ret = false;
+       int err = EMF_ERROR_NONE;
+       int handle;
+       
+       if (!mailbox || mailbox->account_id <= 0) {
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
+               err = EMF_ERROR_INVALID_PARAM;
+               goto FINISH_OFF;
+       }
+       emf_event_t event_data = { 0 };
+
+       event_data.type               = EMF_EVENT_SYNC_HEADER;
+       event_data.event_param_data_1 = mailbox ? EM_SAFE_STRDUP(mailbox->name)  :  NULL;
+       event_data.event_param_data_3 = NULL;
+       event_data.account_id         = mailbox->account_id;
+                       
+       if (!emcore_insert_event(&event_data, &handle, &err)) {
+               EM_DEBUG_EXCEPTION("emcore_insert_event failed [%d]", err);
+               goto FINISH_OFF;
+       }
+
+       ret = true;
+
+FINISH_OFF:
+
+       if (err_code)
+               *err_code = err;
+       EM_DEBUG_FUNC_END("ret [%d]", ret);
+       return ret;
+}
+
+/* connects to given mailbox. send idle and returns socket id */
+static int emcore_imap_idle_connect_and_idle_on_mailbox(emf_mailbox_t *mailbox, int *err_code)
+{
+       EM_DEBUG_FUNC_BEGIN("mailbox [%p], err_code [%p]", mailbox, err_code);
+       void          *mail_stream = NULL;
+       char           cmd[128] = { 0, };
+       char           tag[32] = { 0, };
+       char          *p = NULL;
+       int            socket_id = 0;
+       int            ret = 0;
+       int            err = EMF_ERROR_NONE;
+       emf_account_t *ref_account = NULL;
+       IMAPLOCAL     *imap_local = NULL;
+       NETSTREAM     *net_stream = NULL;
+       TCPSTREAM     *tcp_stream = NULL;
+
+       /* NULL param check */
+       if (!mailbox) {
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
+               err = EMF_ERROR_INVALID_PARAM;
+               goto FINISH_OFF;
+       }
+
+       ref_account = emcore_get_account_reference(mailbox->account_id);
+       if (!ref_account) {
+               EM_DEBUG_EXCEPTION("emcore_get_account_reference failed. account_id[%d]", mailbox->account_id);
+               err = EMF_ERROR_INVALID_ACCOUNT;
+               goto FINISH_OFF;
+       }
+
+       /* Open connection to mailbox */
+       if (!emcore_connect_to_remote_mailbox(mailbox->account_id, mailbox->name, (void **)&mail_stream, &err) || !mail_stream) {
+               EM_DEBUG_EXCEPTION("emcore_connect_to_remote_mailbox failed [%d]", err);
+               goto FINISH_OFF;
+       }
+
+       imap_local = ((MAILSTREAM *)mail_stream)->local;
+       net_stream = imap_local->netstream;
+       
+       /* check if ssl option is enabled on this account - shasikala.p */
+
+       if (ref_account->use_security){
+               SSLSTREAM *ssl_stream = net_stream->stream;
+               tcp_stream = ssl_stream->tcpstream;
+       }
+       else
+               tcp_stream = net_stream->stream;
+
+       /* Get Socket ID */
+       socket_id = ((TCPSTREAM *)tcp_stream)->tcpsi;
+
+       sprintf(tag, "%08lx", 0xffffffff & (((MAILSTREAM *)mail_stream)->gensym++));
+       sprintf(cmd, "%s IDLE\015\012", tag);
+
+       /* Send IDLE command */
+       if (!imap_local->netstream || !net_sout(imap_local->netstream, cmd, (int)strlen(cmd))) {
+               EM_DEBUG_EXCEPTION("network error - failed to IDLE on Mailbox - %s ", mailbox->name);
+               err = EMF_ERROR_IMAP4_IDLE_FAILURE;
+               goto FINISH_OFF;
+       }
+
+       /* Get the response for IDLE command */
+       while (imap_local->netstream){
+               p = net_getline(imap_local->netstream);
+               EM_DEBUG_LOG("p =[%s]", p);
+               if (!strncmp(p, "+", 1)) {
+                       ret = 1;
+                       break;
+               }
+               else if (!strncmp(p, "*", 1)) {
+                       EM_SAFE_FREE(p);
+                       continue;
+               }
+               else {
+                       ret = 0;
+                       break;
+               }
+    }
+       EM_SAFE_FREE(p);
+
+FINISH_OFF: 
+       
+       if (ret) {
+               /* IMAP IDLE - SUCCESS */
+               mailbox->mail_stream     = mail_stream;
+               mailbox->hold_connection = socket_id; /* holds connection continuously on the given socket_id */
+       }
+       else if (mail_stream)
+               emcore_close_mailbox(mailbox->account_id, mail_stream);
+
+       if (err_code)
+               *err_code = err;
+
+       EM_DEBUG_FUNC_END("ret [%d]", ret);
+       return ret;
+}
+
+static int emcore_imap_idle_parse_response_stream(emf_mailbox_t *mailbox, int *err_code)
+{
+       EM_DEBUG_FUNC_BEGIN("mailbox [%p], err_code [%p]", mailbox, err_code);
+       int err = EMF_ERROR_NONE;
+       char *p = NULL;
+       int ret = false;
+       IMAPLOCAL *imap_local = NULL;
+       
+       if (!mailbox || !mailbox->mail_stream) {
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
+               err = EMF_ERROR_INVALID_PARAM;
+               goto FINISH_OFF;
+       }
+
+       imap_local = ((MAILSTREAM *)mailbox->mail_stream)->local;
+
+       if (!imap_local){
+               EM_DEBUG_EXCEPTION("imap_local is NULL");
+               err = EMF_ERROR_INVALID_PARAM;
+               goto FINISH_OFF;
+       }
+
+       while (imap_local->netstream){
+               p = net_getline(imap_local->netstream);
+               if (p && !strncmp(p, "*", 1)) {
+                       EM_DEBUG_LOG("p is [%s]", p);
+                       if (p+1 && p+2 && p+3 && p+4 && !strncmp(p+2, "BYE", 3)) {
+                               EM_DEBUG_LOG("BYE connection from server");
+                               EM_SAFE_FREE(p);
+                               goto FINISH_OFF;
+                       }
+                       else  { 
+                               if (!emcore_imap_idle_insert_sync_event(mailbox, &err))
+                                       EM_DEBUG_EXCEPTION("Syncing mailbox %s failed with err_code [%d]", mailbox->name, err);
+                               EM_SAFE_FREE(p);        
+                               break;
+                       }
+               }
+               else if (p && (!strncmp(p, "+", 1))) {
+                       /* Bad response from server */
+                       EM_DEBUG_LOG("p is [%s]", p);
+                       EM_SAFE_FREE(p);
+                       break;
+               }
+               else {
+                       EM_DEBUG_LOG("In else part");
+                       break;
+               }
+       }
+
+       ret = true;
+
+FINISH_OFF:
+
+       if (err_code)
+               *err_code = err;
+
+       EM_DEBUG_FUNC_END("ret [%d]", ret);
+       return ret;
+}
+#endif /*  __FEATURE_IMAP_IDLE__ */
similarity index 65%
rename from email-core/em-core-imap-mailbox.c
rename to email-core/email-core-imap-mailbox.c
index 2cef70e..4e529ea 100755 (executable)
@@ -22,7 +22,7 @@
 
 
 /******************************************************************************
- * File :  em-core-imap_folder.c
+ * File :  email-core-imap_folder.c
  * Desc :  Mail IMAP mailbox
  *
  * Auth : 
 #include <stdlib.h>
 #include <string.h>
 #include <vconf.h>
-#include "em-core-global.h"
-#include "em-core-utils.h"
+#include "email-core-global.h"
+#include "email-core-utils.h"
 #include "c-client.h"
-#include "em-storage.h"
-#include "em-core-event.h"
-#include "em-core-mailbox.h"
-#include "em-core-imap-mailbox.h"
-#include "em-core-mailbox-sync.h"
-#include "em-core-account.h" 
+#include "email-storage.h"
+#include "email-utilities.h"
+#include "email-core-event.h"
+#include "email-core-mailbox.h"
+#include "email-core-imap-mailbox.h"
+#include "email-core-mailbox-sync.h"
+#include "email-core-account.h" 
 #include "lnx_inc.h"
 
-#include "emf-dbglog.h"
+#include "email-debug-log.h"
 
-EXPORT_API int em_core_mailbox_get_default_mail_slot_count(int *output_count, int *err_code)
+INTERNAL_FUNC int emcore_get_default_mail_slot_count(int *output_count, int *err_code)
 {      
        EM_DEBUG_FUNC_BEGIN();
        EM_DEBUG_LOG("output_count[%p], err_code[%p]", output_count, err_code);
@@ -83,7 +84,7 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int em_core_mailbox_remove_overflowed_mails(emf_mailbox_tbl_t *intput_mailbox_tbl, int *err_code)
+INTERNAL_FUNC int emcore_remove_overflowed_mails(emstorage_mailbox_tbl_t *intput_mailbox_tbl, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("intput_mailbox_tbl[%p], err_code[%p]", intput_mailbox_tbl, err_code);
 
@@ -99,7 +100,7 @@ EXPORT_API int em_core_mailbox_remove_overflowed_mails(emf_mailbox_tbl_t *intput
                goto FINISH_OFF;
        }
 
-       account_ref = em_core_get_account_reference(intput_mailbox_tbl->account_id);
+       account_ref = emcore_get_account_reference(intput_mailbox_tbl->account_id);
        if (account_ref) {
                if (account_ref->receiving_server_type == EMF_SERVER_TYPE_ACTIVE_SYNC) {
                        EM_DEBUG_LOG("ActiveSync Account didn't support mail slot");
@@ -108,20 +109,20 @@ EXPORT_API int em_core_mailbox_remove_overflowed_mails(emf_mailbox_tbl_t *intput
                }
        }
        
-       if (!em_storage_get_overflowed_mail_id_list(intput_mailbox_tbl->account_id, intput_mailbox_tbl->mailbox_name, intput_mailbox_tbl->mail_slot_size, &mail_id_list, &mail_id_list_count, true, &err)) {
-               if (err == EM_STORAGE_ERROR_MAIL_NOT_FOUND) {
+       if (!emstorage_get_overflowed_mail_id_list(intput_mailbox_tbl->account_id, intput_mailbox_tbl->mailbox_name, intput_mailbox_tbl->mail_slot_size, &mail_id_list, &mail_id_list_count, true, &err)) {
+               if (err == EMF_ERROR_MAIL_NOT_FOUND) {
                        EM_DEBUG_LOG("There are enough slot in intput_mailbox_tbl [%s]", intput_mailbox_tbl->mailbox_name);
                        err = EMF_ERROR_NONE;
                        ret = true;
                }
                else
-                       EM_DEBUG_EXCEPTION("em_storage_get_overflowed_mail_id_list failed [%d]", err);
+                       EM_DEBUG_EXCEPTION("emstorage_get_overflowed_mail_id_list failed [%d]", err);
                goto FINISH_OFF;
        }
 
        if (mail_id_list) {
-               if (!em_core_mail_delete(intput_mailbox_tbl->account_id, mail_id_list, mail_id_list_count, false, EMF_DELETED_BY_OVERFLOW, false, &err)) {
-                       EM_DEBUG_EXCEPTION("em_core_mail_delete failed [%d]", err);
+               if (!emcore_delete_mail(intput_mailbox_tbl->account_id, mail_id_list, mail_id_list_count, false, EMF_DELETED_BY_OVERFLOW, false, &err)) {
+                       EM_DEBUG_EXCEPTION("emcore_delete_mail failed [%d]", err);
                        goto FINISH_OFF;
                }
        }
@@ -138,7 +139,7 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int em_core_mailbox_set_mail_slot_size(int account_id, char *mailbox_name, int new_slot_size, int *err_code)
+INTERNAL_FUNC int emcore_set_mail_slot_size(int account_id, char *mailbox_name, int new_slot_size, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
        EM_DEBUG_LOG("account_id [%d], mailbox_name[%p], err_code[%p]", account_id, mailbox_name, err_code);
@@ -146,32 +147,32 @@ EXPORT_API int em_core_mailbox_set_mail_slot_size(int account_id, char *mailbox_
        int ret = false, err = EMF_ERROR_NONE; 
        int i, mailbox_count = 0;
        emf_account_t *account_ref = NULL;
-       emf_mailbox_tbl_t *mailbox_tbl_list = NULL;
+       emstorage_mailbox_tbl_t *mailbox_tbl_list = NULL;
 
        if (account_id > ALL_ACCOUNT) {
-               account_ref = em_core_get_account_reference(account_id);
+               account_ref = emcore_get_account_reference(account_id);
                if (account_ref && account_ref->receiving_server_type == EMF_SERVER_TYPE_ACTIVE_SYNC) {
                        EM_DEBUG_LOG("ActiveSync account didn't support mail slot");
                        ret = true;
                        goto FINISH_OFF;
                }
                else if (!account_ref) {
-                       EM_DEBUG_EXCEPTION("em_core_get_account_reference failed");
+                       EM_DEBUG_EXCEPTION("emcore_get_account_reference failed");
                        goto FINISH_OFF;
                }
        }
 
-       if (!em_storage_set_mail_slot_size(account_id, mailbox_name, new_slot_size, true, &err)) {
-               EM_DEBUG_EXCEPTION("em_storage_set_mail_slot_size failed [%d]", err);
+       if (!emstorage_set_mail_slot_size(account_id, mailbox_name, new_slot_size, true, &err)) {
+               EM_DEBUG_EXCEPTION("emstorage_set_mail_slot_size failed [%d]", err);
                goto FINISH_OFF;
        }
 
        if (mailbox_name) {
                mailbox_count = 1;
                if (new_slot_size > 0) {
-                       mailbox_tbl_list = em_core_malloc(sizeof(emf_mailbox_tbl_t) * mailbox_count);
+                       mailbox_tbl_list = em_malloc(sizeof(emstorage_mailbox_tbl_t) * mailbox_count);
                        if(!mailbox_tbl_list) {
-                               EM_DEBUG_EXCEPTION("em_core_malloc failed");
+                               EM_DEBUG_EXCEPTION("em_malloc failed");
                                goto FINISH_OFF;
                        }
                        mailbox_tbl_list->account_id = account_id;
@@ -179,26 +180,26 @@ EXPORT_API int em_core_mailbox_set_mail_slot_size(int account_id, char *mailbox_
                        mailbox_tbl_list->mail_slot_size = new_slot_size;     
                }
                else   {        /*  read information from DB */
-                       if (!em_storage_get_mailbox_by_name(account_id, EMF_MAILBOX_ALL, mailbox_name, &mailbox_tbl_list, true, &err)) {
-                               EM_DEBUG_EXCEPTION("em_storage_get_mailbox failed [%d]", err);
+                       if (!emstorage_get_mailbox_by_name(account_id, EMF_MAILBOX_ALL, mailbox_name, &mailbox_tbl_list, true, &err)) {
+                               EM_DEBUG_EXCEPTION("emstorage_get_mailbox failed [%d]", err);
                                goto FINISH_OFF;
                        }
                        
                }
        }
        else {
-               if (!em_storage_get_mailbox(account_id, EMF_MAILBOX_ALL, EMAIL_MAILBOX_SORT_BY_NAME_ASC, &mailbox_count, &mailbox_tbl_list, true, &err)) {
-                       EM_DEBUG_EXCEPTION("em_storage_get_mailbox failed [%d]", err);
+               if (!emstorage_get_mailbox(account_id, EMF_MAILBOX_ALL, EMAIL_MAILBOX_SORT_BY_NAME_ASC, &mailbox_count, &mailbox_tbl_list, true, &err)) {
+                       EM_DEBUG_EXCEPTION("emstorage_get_mailbox failed [%d]", err);
                        goto FINISH_OFF;
                }
        }
 
        for (i = 0; i < mailbox_count; i++) {
-               if (!em_core_mailbox_remove_overflowed_mails(mailbox_tbl_list + i, &err)) {
-                       if (err == EM_STORAGE_ERROR_MAIL_NOT_FOUND || err == EMF_ERROR_NOT_SUPPORTED)
+               if (!emcore_remove_overflowed_mails(mailbox_tbl_list + i, &err)) {
+                       if (err == EMF_ERROR_MAIL_NOT_FOUND || err == EMF_ERROR_NOT_SUPPORTED)
                                err = EMF_ERROR_NONE;
                        else
-                               EM_DEBUG_EXCEPTION("em_core_mailbox_remove_overflowed_mails failed [%d]", err);
+                               EM_DEBUG_EXCEPTION("emcore_remove_overflowed_mails failed [%d]", err);
                }
        }
 
@@ -208,7 +209,7 @@ EXPORT_API int em_core_mailbox_set_mail_slot_size(int account_id, char *mailbox_
 FINISH_OFF: 
 
        if (mailbox_tbl_list)
-               em_storage_free_mailbox(&mailbox_tbl_list, mailbox_count, NULL);
+               emstorage_free_mailbox(&mailbox_tbl_list, mailbox_count, NULL);
 
 
        if (err_code)
@@ -217,22 +218,22 @@ FINISH_OFF:
 }
 
 
-static int em_core_get_mailbox_connection_path(int account_id, char *mailbox_name, char **path, int *err_code)
+static int emcore_get_mailbox_connection_path(int account_id, char *mailbox_name, char **path, int *err_code)
 {
     emf_account_t *ref_account = NULL;
        size_t path_len = 0;
 
 
-       ref_account = em_core_get_account_reference(account_id);
+       ref_account = emcore_get_account_reference(account_id);
        if (!ref_account)        {
-               EM_DEBUG_EXCEPTION("em_core_get_account_reference failed");
+               EM_DEBUG_EXCEPTION("emcore_get_account_reference failed");
                return 0;
        }
 
        path_len = strlen(ref_account->receiving_server_addr) +
                           (mailbox_name ? strlen(mailbox_name) : 0) + 50;
 
-    *path = em_core_malloc(path_len);/* strlen(ref_account->receiving_server_addr) + */
+    *path = em_malloc(path_len);/* strlen(ref_account->receiving_server_addr) + */
                           /* (mailbox_name ? strlen(mailbox_name) : 0) + 20); */
     if (!*path)
        return 0;
@@ -265,7 +266,7 @@ static int em_core_get_mailbox_connection_path(int account_id, char *mailbox_nam
     return 1;
 }
 
-EXPORT_API int em_core_mailbox_sync_mailbox_list(int account_id, char *mailbox_name, int *err_code)
+INTERNAL_FUNC int emcore_sync_mailbox_list(int account_id, char *mailbox_name, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], mailbox_name[%p], err_code[%p]", account_id, mailbox_name, err_code);
        
@@ -285,14 +286,14 @@ EXPORT_API int em_core_mailbox_sync_mailbox_list(int account_id, char *mailbox_n
        if (err_code) 
                *err_code = EMF_ERROR_NONE;
        
-       if (!em_core_check_thread_status())  {
+       if (!emcore_check_thread_status())  {
                err = EMF_ERROR_CANCELLED;
                goto FINISH_OFF;
        }
        
-       ref_account = em_core_get_account_reference(account_id);
+       ref_account = emcore_get_account_reference(account_id);
        if (!ref_account)  {
-               EM_DEBUG_EXCEPTION("em_core_get_account_reference failed - %d", account_id);
+               EM_DEBUG_EXCEPTION("emcore_get_account_reference failed - %d", account_id);
                err = EMF_ERROR_INVALID_ACCOUNT;
                goto FINISH_OFF;
        }
@@ -306,20 +307,20 @@ EXPORT_API int em_core_mailbox_sync_mailbox_list(int account_id, char *mailbox_n
        
        /*  get mail server path */
        /*  mbox_path is not used. the below func might be unnecessary */
-       if (!em_core_get_mailbox_connection_path(account_id, NULL, &mbox_path, &err) || !mbox_path)  {
-               EM_DEBUG_EXCEPTION("em_core_get_mailbox_connection_path - %d", err);
+       if (!emcore_get_mailbox_connection_path(account_id, NULL, &mbox_path, &err) || !mbox_path)  {
+               EM_DEBUG_EXCEPTION("emcore_get_mailbox_connection_path - %d", err);
                goto FINISH_OFF;
        }
        
        
-       if (!em_core_check_thread_status())  {
+       if (!emcore_check_thread_status())  {
                err = EMF_ERROR_CANCELLED;
                goto FINISH_OFF;
        }
 
        stream = NULL;
-       if (!em_core_mailbox_open(account_id, NULL, (void **)&tmp_stream, &err) || !tmp_stream)  {
-               EM_DEBUG_EXCEPTION("em_core_mailbox_open failed - %d", err);
+       if (!emcore_connect_to_remote_mailbox(account_id, NULL, (void **)&tmp_stream, &err) || !tmp_stream)  {
+               EM_DEBUG_EXCEPTION("emcore_connect_to_remote_mailbox failed - %d", err);
                
                if (err == EMF_ERROR_CONNECTION_BROKEN)
                        err = EMF_ERROR_CANCELLED;
@@ -334,32 +335,32 @@ EXPORT_API int em_core_mailbox_sync_mailbox_list(int account_id, char *mailbox_n
        
        stream = (MAILSTREAM *)tmp_stream;
        
-       if (!em_core_check_thread_status())  {
+       if (!emcore_check_thread_status())  {
                err = EMF_ERROR_CANCELLED;
                goto FINISH_OFF;
        }
        
        /*  download mailbox list */
-       if (!em_core_mailbox_download_mailbox_list(stream, mailbox_name, &mailbox_list, &count, &err))  {
-               EM_DEBUG_EXCEPTION("em_core_mailbox_download_mailbox_list failed - %d", err);
+       if (!emcore_download_mailbox_list(stream, mailbox_name, &mailbox_list, &count, &err))  {
+               EM_DEBUG_EXCEPTION("emcore_download_mailbox_list failed - %d", err);
                goto FINISH_OFF;
        }
 
-       if (!em_core_check_thread_status())  {
+       if (!emcore_check_thread_status())  {
                err = EMF_ERROR_CANCELLED;
                goto FINISH_OFF;
        }
        
        for (i = 0; i < count; i++) {
-               if (!em_core_check_thread_status())  {
-                       EM_DEBUG_LOG("em_core_check_thread_status - cancelled");
+               if (!emcore_check_thread_status())  {
+                       EM_DEBUG_LOG("emcore_check_thread_status - cancelled");
                        err = EMF_ERROR_CANCELLED;
                        goto FINISH_OFF;
                }
                if (mailbox_list[i].name) {
                        EM_DEBUG_LOG("mailbox name - %s", mailbox_list[i].name);
-                       em_core_mailbox_get_default_mail_slot_count(&(mailbox_list[i].mail_slot_size), NULL);
-                       em_core_bind_mailbox_type(mailbox_list + i);
+                       emcore_get_default_mail_slot_count(&(mailbox_list[i].mail_slot_size), NULL);
+                       emcore_bind_mailbox_type(mailbox_list + i);
 
                        if (mailbox_list[i].mailbox_type <= EMF_MAILBOX_TYPE_ALL_EMAILS) {      /*  if result mailbox type is duplicated,  */
                                if (mailbox_type_list[mailbox_list[i].mailbox_type] != -1) {
@@ -371,8 +372,8 @@ EXPORT_API int em_core_mailbox_sync_mailbox_list(int account_id, char *mailbox_n
                        }
 
                        EM_DEBUG_LOG("mailbox type [%d]", mailbox_list[i].mailbox_type);
-                       if(!em_core_mailbox_set_sync_imap_mailbox(mailbox_list + i, 1, &err)) {
-                               EM_DEBUG_EXCEPTION("em_core_mailbox_set_sync_imap_mailbox failed [%d]", err);
+                       if(!emcore_set_sync_imap_mailbox(mailbox_list + i, 1, &err)) {
+                               EM_DEBUG_EXCEPTION("emcore_set_sync_imap_mailbox failed [%d]", err);
                                goto FINISH_OFF;
                        }
 
@@ -381,12 +382,12 @@ EXPORT_API int em_core_mailbox_sync_mailbox_list(int account_id, char *mailbox_n
 
 
        for (counter = EMF_MAILBOX_TYPE_INBOX; counter <= EMF_MAILBOX_TYPE_OUTBOX; counter++) {
-               /* if (!em_storage_get_mailboxname_by_mailbox_type(account_id, counter, &mailbox_name_for_mailbox_type, false, &err))  */
+               /* if (!emstorage_get_mailboxname_by_mailbox_type(account_id, counter, &mailbox_name_for_mailbox_type, false, &err))  */
                if (mailbox_type_list[counter] == -1) {
-                       /* EM_DEBUG_EXCEPTION("em_storage_get_mailboxname_by_mailbox_type failed - %d", err); */
-                       /* if (EM_STORAGE_ERROR_MAILBOX_NOT_FOUND == err)        */
+                       /* EM_DEBUG_EXCEPTION("emstorage_get_mailboxname_by_mailbox_type failed - %d", err); */
+                       /* if (EMF_ERROR_MAILBOX_NOT_FOUND == err)       */
                        /* { */
-                               emf_mailbox_tbl_t mailbox_tbl;
+                               emstorage_mailbox_tbl_t mailbox_tbl;
                                
                                memset(&mailbox_tbl, 0x00, sizeof(mailbox_tbl));
                                
@@ -397,7 +398,7 @@ EXPORT_API int em_core_mailbox_sync_mailbox_list(int account_id, char *mailbox_n
                                mailbox_tbl.sync_with_server_yn =  1;
                                mailbox_tbl.modifiable_yn = 1; 
                                mailbox_tbl.total_mail_count_on_server = 0;
-                               em_core_mailbox_get_default_mail_slot_count(&mailbox_tbl.mail_slot_size, NULL);
+                               emcore_get_default_mail_slot_count(&mailbox_tbl.mail_slot_size, NULL);
                                
                                switch (counter) {
                                        case EMF_MAILBOX_TYPE_SENTBOX:
@@ -431,26 +432,15 @@ EXPORT_API int em_core_mailbox_sync_mailbox_list(int account_id, char *mailbox_n
                                                break;
                                }
 
-                               if (!em_storage_add_mailbox(&mailbox_tbl, true, &err)) {
-                                       EM_DEBUG_EXCEPTION("em_storage_add_mailbox failed - %d", err);
-                                       
-                                       if (err == EM_STORAGE_ERROR_DB_IS_FULL)
-                                               err = EMF_ERROR_MAIL_MEMORY_FULL;
-                                       else if (err == EM_STORAGE_ERROR_INVALID_PARAM)
-                                               err = EMF_ERROR_INVALID_PARAM;
-                                       else if (err == EM_STORAGE_ERROR_OUT_OF_MEMORY)
-                                               err = EMF_ERROR_OUT_OF_MEMORY;
-                                       else if (err == EM_STORAGE_ERROR_DB_FAILURE)
-                                               err = EMF_ERROR_DB_FAILURE;
-                                       else
-                                               err = EMF_ERROR_UNKNOWN;
+                               if (!emstorage_add_mailbox(&mailbox_tbl, true, &err)) {
+                                       EM_DEBUG_EXCEPTION("emstorage_add_mailbox failed - %d", err);
                                        goto FINISH_OFF;
                                }
                                
                        /* }     */
                        /* else */
                        /* { */
-                       /*      err = em_storage_get_emf_error_from_em_storage_error(err); */
+                       /*  */
                        /*      goto FINISH_OFF; */
                        /* } */
                        
@@ -458,35 +448,35 @@ EXPORT_API int em_core_mailbox_sync_mailbox_list(int account_id, char *mailbox_n
                EM_SAFE_FREE(mailbox_name_for_mailbox_type);
        }
 
-       emf_mailbox_tbl_t *local_mailbox_list = NULL;
+       emstorage_mailbox_tbl_t *local_mailbox_list = NULL;
        int select_num = 0;
        i = 0;
        emf_mailbox_t mailbox;
 
-       if (em_storage_get_mailbox_by_modifiable_yn(account_id, 0 /* modifiable_yn */, &select_num, &local_mailbox_list, true, &err)) {
+       if (emstorage_get_mailbox_by_modifiable_yn(account_id, 0 /* modifiable_yn */, &select_num, &local_mailbox_list, true, &err)) {
                if (select_num > 0) {
                        for (i = 0; i < select_num; i++) {
                                EM_DEBUG_LOG(">>> MailBox needs to be Deleted[ %s ] ", local_mailbox_list[i].mailbox_name);
                                mailbox.account_id = local_mailbox_list[i].account_id;
                                mailbox.name       = local_mailbox_list[i].mailbox_name;
-                               if (!em_core_mailbox_delete_all(&mailbox, &err)) {
-                                       EM_DEBUG_EXCEPTION(" em_core_mailbox_delete_all of Mailbox [%s] Failed ", mailbox.name);
-                                       em_storage_free_mailbox(&local_mailbox_list, select_num, NULL); 
+                               if (!emcore_delete_mailbox_all(&mailbox, &err)) {
+                                       EM_DEBUG_EXCEPTION(" emcore_delete_all of Mailbox [%s] Failed ", mailbox.name);
+                                       emstorage_free_mailbox(&local_mailbox_list, select_num, NULL); 
                                        local_mailbox_list = NULL;
                                        goto FINISH_OFF;
                                }
                        }
-                       em_storage_free_mailbox(&local_mailbox_list, select_num, NULL); 
+                       emstorage_free_mailbox(&local_mailbox_list, select_num, NULL); 
                        local_mailbox_list = NULL;
                }
        }
 
-       if (!em_storage_set_all_mailbox_modifiable_yn(account_id, 0, true, &err)) {
-                       EM_DEBUG_EXCEPTION(" >>>> em_storage_set_all_mailbox_modifiable_yn Failed [ %d ]", err);
+       if (!emstorage_set_all_mailbox_modifiable_yn(account_id, 0, true, &err)) {
+                       EM_DEBUG_EXCEPTION(" >>>> emstorage_set_all_mailbox_modifiable_yn Failed [ %d ]", err);
                        goto FINISH_OFF;
        }
        
-       if (!em_core_check_thread_status())  {
+       if (!emcore_check_thread_status())  {
                err = EMF_ERROR_CANCELLED;
                goto FINISH_OFF;
        }
@@ -502,10 +492,10 @@ FINISH_OFF:
        EM_SAFE_FREE(mbox_path);
 
        if (stream) 
-               em_core_mailbox_close(account_id, stream);
+               emcore_close_mailbox(account_id, stream);
        
        if (mailbox_list) 
-               em_core_mailbox_free(&mailbox_list, count, NULL);
+               emcore_free_mailbox(&mailbox_list, count, NULL);
 
        if (err_code != NULL)
                *err_code = err;
@@ -513,7 +503,7 @@ FINISH_OFF:
        return ret;
 }
 
-int em_core_mailbox_download_mailbox_list(void *mail_stream, 
+int emcore_download_mailbox_list(void *mail_stream, 
                                                                                char *mailbox, 
                                                                                emf_mailbox_t **mailbox_list, 
                                                                                int *count, 
@@ -542,7 +532,7 @@ int em_core_mailbox_download_mailbox_list(void *mail_stream,
     /*  reference (ex : "{mail.test.com}", "{mail.test.com}inbox") */
        if (mailbox)  {
                char *s = NULL;
-               reference = em_core_malloc(strlen(stream->original_mailbox) + strlen(mailbox) + 1);
+               reference = em_malloc(strlen(stream->original_mailbox) + strlen(mailbox) + 1);
                if (reference) {
                        strncpy(reference, stream->original_mailbox, (size_t)strlen(stream->original_mailbox));
                        if ((s = strchr(reference, '}')))
@@ -583,7 +573,7 @@ FINISH_OFF:
  *    succeed  :  1
  *    fail  :  0
  */
-int em_core_mailbox_check_sync_imap_mailbox(emf_mailbox_t *mailbox, int *synchronous, int *err_code)
+int emcore_check_sync_imap_mailbox(emf_mailbox_t *mailbox, int *synchronous, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
        
@@ -603,21 +593,10 @@ int em_core_mailbox_check_sync_imap_mailbox(emf_mailbox_t *mailbox, int *synchro
        
        int ret = false;
        int err = EMF_ERROR_NONE;
-       emf_mailbox_tbl_t *imap_mailbox_tbl = NULL;
+       emstorage_mailbox_tbl_t *imap_mailbox_tbl = NULL;
 
-       if (!em_storage_get_mailbox_by_name(mailbox->account_id, 0, mailbox->name, &imap_mailbox_tbl, true, &err))  {
-               EM_DEBUG_EXCEPTION("em_storage_get_mailbox_by_name failed - %d", err);
-               
-               if (err == EM_STORAGE_ERROR_MAILBOX_NOT_FOUND)
-                       err = EMF_ERROR_MAILBOX_NOT_FOUND;
-               else if (err == EM_STORAGE_ERROR_INVALID_PARAM)
-                       err = EMF_ERROR_INVALID_PARAM;
-               else if (err == EM_STORAGE_ERROR_OUT_OF_MEMORY)
-                       err = EMF_ERROR_OUT_OF_MEMORY;
-               else if (err == EM_STORAGE_ERROR_DB_FAILURE)
-                       err = EMF_ERROR_DB_FAILURE;
-               else
-                       err = EMF_ERROR_UNKNOWN;
+       if (!emstorage_get_mailbox_by_name(mailbox->account_id, 0, mailbox->name, &imap_mailbox_tbl, true, &err))  {
+               EM_DEBUG_EXCEPTION("emstorage_get_mailbox_by_name failed - %d", err);
                goto FINISH_OFF;
        }
        
@@ -627,7 +606,7 @@ int em_core_mailbox_check_sync_imap_mailbox(emf_mailbox_t *mailbox, int *synchro
        
 FINISH_OFF: 
        if (imap_mailbox_tbl != NULL)
-               em_storage_free_mailbox(&imap_mailbox_tbl, 1, NULL);
+               emstorage_free_mailbox(&imap_mailbox_tbl, 1, NULL);
        
        if (err_code != NULL)
                *err_code = err;
@@ -646,7 +625,7 @@ FINISH_OFF:
  *    fail  :  0
  */
 
-int em_core_mailbox_set_sync_imap_mailbox(emf_mailbox_t *mailbox, int synchronous, int *err_code)
+INTERNAL_FUNC int emcore_set_sync_imap_mailbox(emf_mailbox_t *mailbox, int synchronous, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("mailbox[%p], synchronous[%d], err_code[%p]", mailbox, synchronous, err_code);
        
@@ -659,48 +638,32 @@ int em_core_mailbox_set_sync_imap_mailbox(emf_mailbox_t *mailbox, int synchronou
        
        int ret = false;
        int err = EMF_ERROR_NONE;
-       emf_mailbox_tbl_t *imap_mailbox_tbl_item = NULL;
-       em_core_uid_list *uid_list = NULL;
-       emf_mail_read_mail_uid_tbl_t *downloaded_uids = NULL;
+       emstorage_mailbox_tbl_t *imap_mailbox_tbl_item = NULL;
+       emcore_uid_list *uid_list = NULL;
+       emstorage_read_mail_uid_tbl_t *downloaded_uids = NULL;
        MAILSTREAM *stream = mailbox->mail_stream;
        int mailbox_renamed = 0;
        int j = 0;
        int i = 0;
        int temp = 0;
        IMAPLOCAL *imap_local = NULL;
-       char cmd[128], tag[32], *p;     
+       char cmd[128] = { 0 , }, tag[32] = { 0 , }, *p = NULL;
                
        if (synchronous) {              
                /* if synchcronous, insert imap mailbox to db */
-               if (em_storage_get_mailbox_by_name(mailbox->account_id, 0, mailbox->name, &imap_mailbox_tbl_item, true, &err))  {       
+               if (emstorage_get_mailbox_by_name(mailbox->account_id, 0, mailbox->name, &imap_mailbox_tbl_item, true, &err))  {        
                        /* mailbox already exists */
                        /* mailbox Found, Do set the modifiable_yn = 1 */
                        EM_DEBUG_LOG("mailbox already exists and setting modifiable_yn to 1");
-                       if (!em_storage_update_mailbox_modifiable_yn(mailbox->account_id, 0, mailbox->name, 1, true, &err)) {
-                               EM_DEBUG_EXCEPTION(" em_storage_update_mailbox_modifiable_yn Failed [ %d ] ", err);
-                               if (err == EM_STORAGE_ERROR_INVALID_PARAM)
-                                       err = EMF_ERROR_INVALID_PARAM;
-                               else if (err == EM_STORAGE_ERROR_OUT_OF_MEMORY)
-                                       err = EMF_ERROR_OUT_OF_MEMORY;
-                               else if (err == EM_STORAGE_ERROR_DB_FAILURE)
-                                       err = EMF_ERROR_DB_FAILURE;
-                               else
-                                       err = EMF_ERROR_UNKNOWN;
+                       if (!emstorage_update_mailbox_modifiable_yn(mailbox->account_id, 0, mailbox->name, 1, true, &err)) {
+                               EM_DEBUG_EXCEPTION(" emstorage_update_mailbox_modifiable_yn Failed [ %d ] ", err);
                                goto JOB_ERROR;
                        }
                }
                else {
-                       if (err != EM_STORAGE_ERROR_MAILBOX_NOT_FOUND) {
+                       if (err != EMF_ERROR_MAILBOX_NOT_FOUND) {
                                EM_DEBUG_EXCEPTION(">>>>.>>>>>Getting mailbox failed>>>>>>>>>>>>>>");
                                /* This is error scenario so finish the job */
-                               if (err == EM_STORAGE_ERROR_INVALID_PARAM)
-                                       err = EMF_ERROR_INVALID_PARAM;
-                               else if (err == EM_STORAGE_ERROR_OUT_OF_MEMORY)
-                                       err = EMF_ERROR_OUT_OF_MEMORY;
-                               else if (err == EM_STORAGE_ERROR_DB_FAILURE)
-                                       err = EMF_ERROR_DB_FAILURE;
-                               else
-                                       err = EMF_ERROR_UNKNOWN;
                                goto JOB_ERROR;
                        }
                        else {
@@ -757,14 +720,14 @@ int em_core_mailbox_set_sync_imap_mailbox(emf_mailbox_t *mailbox, int synchronou
                                                        EM_SAFE_FREE(uid_list);
                                                }
                                                else {
-                                                       if (!em_storage_get_downloaded_list(mailbox->account_id, NULL, &downloaded_uids, &j, true, &err)) {
-                                                               EM_DEBUG_EXCEPTION("em_storage_get_downloaded_list failed [%d]", err);
-                                                               err = em_storage_get_emf_error_from_em_storage_error(err);
+                                                       if (!emstorage_get_downloaded_list(mailbox->account_id, NULL, &downloaded_uids, &j, true, &err)) {
+                                                               EM_DEBUG_EXCEPTION("emstorage_get_downloaded_list failed [%d]", err);
+                                               
                                                                downloaded_uids = NULL;
                                                        }
                                                        else /* Prevent Defect - 28497 */ {
-                                                               em_core_uid_list *uid_elem = uid_list;
-                                                               em_core_uid_list *next_uid_elem = NULL;
+                                                               emcore_uid_list *uid_elem = uid_list;
+                                                               emcore_uid_list *next_uid_elem = NULL;
                                                                if (uid_elem) {
                                                                        for (i = j; (i > 0 && !mailbox_renamed); i--)  {
                                                                                if (uid_elem) {
@@ -787,19 +750,19 @@ int em_core_mailbox_set_sync_imap_mailbox(emf_mailbox_t *mailbox, int synchronou
                                if (mailbox_renamed) /* renamed mailbox */ {
                                        EM_DEBUG_LOG("downloaded_uids[temp].mailbox_name [%s]", downloaded_uids[temp].mailbox_name);
                                        /* Do a mailbox rename in the DB */
-                                       if (!em_storage_modify_mailbox_of_mails(downloaded_uids[temp].mailbox_name, mailbox->name, true, &err))
-                                               EM_DEBUG_EXCEPTION(" em_storage_modify_mailbox_of_mails Failed [%d]", err);
+                                       if (!emstorage_modify_mailbox_of_mails(downloaded_uids[temp].mailbox_name, mailbox->name, true, &err))
+                                               EM_DEBUG_EXCEPTION(" emstorage_modify_mailbox_of_mails Failed [%d]", err);
 
                                        mailbox_renamed = 0;
 
-                                       emf_mailbox_tbl_t mailbox_tbl;
+                                       emstorage_mailbox_tbl_t mailbox_tbl;
                                        mailbox_tbl.account_id = mailbox->account_id;
                                        mailbox_tbl.local_yn = 0;
                                        mailbox_tbl.mailbox_name = mailbox->name;
                                        mailbox_tbl.mailbox_type = mailbox->mailbox_type;
 
                                        /* Get the Alias Name after parsing the Full mailbox Path */
-                                       mailbox->alias = em_core_get_alias_of_mailbox((const char *)mailbox->name);
+                                       mailbox->alias = emcore_get_alias_of_mailbox((const char *)mailbox->name);
                                        
                                        if (mailbox->alias)
                                                EM_DEBUG_LOG("mailbox->alias [%s] ", mailbox->alias);
@@ -810,22 +773,14 @@ int em_core_mailbox_set_sync_imap_mailbox(emf_mailbox_t *mailbox, int synchronou
                                        mailbox_tbl.total_mail_count_on_server = 0;
                                        
                                        /* if non synchronous, delete imap mailbox from db */
-                                       if (!em_storage_update_mailbox(mailbox->account_id, 0, downloaded_uids[temp].mailbox_name, &mailbox_tbl, true, &err)) {
-                                               EM_DEBUG_EXCEPTION(" em_storage_update_mailbox Failed [ %d ] ", err);
-                                               if (err == EM_STORAGE_ERROR_INVALID_PARAM)
-                                                       err = EMF_ERROR_INVALID_PARAM;
-                                               else if (err == EM_STORAGE_ERROR_OUT_OF_MEMORY)
-                                                       err = EMF_ERROR_OUT_OF_MEMORY;
-                                               else if (err == EM_STORAGE_ERROR_DB_FAILURE)
-                                                       err = EMF_ERROR_DB_FAILURE;
-                                               else
-                                                       err = EMF_ERROR_UNKNOWN;
+                                       if (!emstorage_update_mailbox(mailbox->account_id, 0, downloaded_uids[temp].mailbox_name, &mailbox_tbl, true, &err)) {
+                                               EM_DEBUG_EXCEPTION(" emstorage_update_mailbox Failed [ %d ] ", err);
                                                goto JOB_ERROR;
                                        }
                                        
                                }
                                else /* Its a Fresh Mailbox */ {
-                                       emf_mailbox_tbl_t mailbox_tbl;
+                                       emstorage_mailbox_tbl_t mailbox_tbl;
                                        mailbox_tbl.mailbox_id = mailbox->mailbox_id;
                                        mailbox_tbl.account_id = mailbox->account_id;
                                        mailbox_tbl.local_yn = 0; 
@@ -834,7 +789,7 @@ int em_core_mailbox_set_sync_imap_mailbox(emf_mailbox_t *mailbox, int synchronou
                                        mailbox_tbl.mail_slot_size = mailbox->mail_slot_size;
 
                                        /* Get the Alias Name after Parsing the Full mailbox Path */
-                                       mailbox->alias = em_core_get_alias_of_mailbox((const char *)mailbox->name);
+                                       mailbox->alias = emcore_get_alias_of_mailbox((const char *)mailbox->name);
 
                                        if (mailbox->alias) {
                                                EM_DEBUG_LOG("mailbox->alias [%s] ", mailbox->alias);
@@ -846,19 +801,8 @@ int em_core_mailbox_set_sync_imap_mailbox(emf_mailbox_t *mailbox, int synchronou
                                                        
                                                EM_DEBUG_LOG("mailbox_tbl.mailbox_type - %d", mailbox_tbl.mailbox_type);
 
-                                               if (!em_storage_add_mailbox(&mailbox_tbl, true, &err)) {
-                                                       EM_DEBUG_EXCEPTION("em_storage_add_mailbox failed - %d", err);
-                                                       
-                                                       if (err == EM_STORAGE_ERROR_DB_IS_FULL)
-                                                               err = EMF_ERROR_MAIL_MEMORY_FULL;
-                                                       else if (err == EM_STORAGE_ERROR_INVALID_PARAM)
-                                                               err = EMF_ERROR_INVALID_PARAM;
-                                                       else if (err == EM_STORAGE_ERROR_OUT_OF_MEMORY)
-                                                               err = EMF_ERROR_OUT_OF_MEMORY;
-                                                       else if (err == EM_STORAGE_ERROR_DB_FAILURE)
-                                                               err = EMF_ERROR_DB_FAILURE;
-                                                       else
-                                                               err = EMF_ERROR_UNKNOWN;
+                                               if (!emstorage_add_mailbox(&mailbox_tbl, true, &err)) {
+                                                       EM_DEBUG_EXCEPTION("emstorage_add_mailbox failed - %d", err);
                                                        goto JOB_ERROR;
                                                }
                                        }
@@ -875,10 +819,10 @@ int em_core_mailbox_set_sync_imap_mailbox(emf_mailbox_t *mailbox, int synchronou
 JOB_ERROR:
 
        if (downloaded_uids) 
-               em_storage_free_read_mail_uid(&downloaded_uids, j, NULL);
+               emstorage_free_read_mail_uid(&downloaded_uids, j, NULL);
 
        if (imap_mailbox_tbl_item)
-               em_storage_free_mailbox(&imap_mailbox_tbl_item, 1, NULL);
+               emstorage_free_mailbox(&imap_mailbox_tbl_item, 1, NULL);
 
        if (err_code)
                *err_code = err;
@@ -894,7 +838,7 @@ JOB_ERROR:
  *    succeed  :  1
  *    fail  :  0
  */
-EXPORT_API int em_core_mailbox_create_imap_mailbox(emf_mailbox_t *mailbox, int *err_code)
+INTERNAL_FUNC int emcore_create_imap_mailbox(emf_mailbox_t *mailbox, int *err_code)
 {
     MAILSTREAM *stream = NULL;
     char *long_enc_path = NULL;
@@ -916,7 +860,7 @@ EXPORT_API int em_core_mailbox_create_imap_mailbox(emf_mailbox_t *mailbox, int *
 
     /* connect mail server */
     stream = NULL;
-    if (!em_core_mailbox_open(mailbox->account_id, NULL, (void **)&tmp_stream, NULL))
+    if (!emcore_connect_to_remote_mailbox(mailbox->account_id, NULL, (void **)&tmp_stream, NULL))
     {
         err = EMF_ERROR_CONNECTION_FAILURE;
         goto JOB_ERROR;
@@ -925,7 +869,7 @@ EXPORT_API int em_core_mailbox_create_imap_mailbox(emf_mailbox_t *mailbox, int *
     stream = (MAILSTREAM *)tmp_stream;
 
     /* encode mailbox name by UTF7, and rename to full path (ex : {mail.test.com}child_mailbox) */
-    if (!em_core_get_long_encoded_path(mailbox->account_id, mailbox->name, '/', &long_enc_path, err_code))
+    if (!emcore_get_long_encoded_path(mailbox->account_id, mailbox->name, '/', &long_enc_path, err_code))
     {
         err = EMF_ERROR_UNKNOWN;
         goto JOB_ERROR;
@@ -938,7 +882,7 @@ EXPORT_API int em_core_mailbox_create_imap_mailbox(emf_mailbox_t *mailbox, int *
         goto JOB_ERROR;
     }
 
-       em_core_mailbox_close(0, stream);                               
+       emcore_close_mailbox(0, stream);                                
        stream = NULL;
 
     EM_SAFE_FREE(long_enc_path);
@@ -948,7 +892,7 @@ EXPORT_API int em_core_mailbox_create_imap_mailbox(emf_mailbox_t *mailbox, int *
 JOB_ERROR:
     if (stream)
     {
-               em_core_mailbox_close(0, stream);                               
+               emcore_close_mailbox(0, stream);                                
                stream = NULL;
     }
 
@@ -969,7 +913,7 @@ JOB_ERROR:
  *    succeed  :  1
  *    fail  :  0
  */
-EXPORT_API int em_core_mailbox_delete_imap_mailbox(emf_mailbox_t *mailbox, int *err_code)
+INTERNAL_FUNC int emcore_delete_imap_mailbox(emf_mailbox_t *mailbox, int *err_code)
 {
     MAILSTREAM *stream = NULL;
     char *long_enc_path = NULL;
@@ -990,7 +934,7 @@ EXPORT_API int em_core_mailbox_delete_imap_mailbox(emf_mailbox_t *mailbox, int *
         goto JOB_ERROR;
     }
 
-    ref_account = em_core_get_account_reference(mailbox->account_id);
+    ref_account = emcore_get_account_reference(mailbox->account_id);
     if (!ref_account)
     {
         err = EMF_ERROR_INVALID_PARAM;
@@ -1007,7 +951,7 @@ EXPORT_API int em_core_mailbox_delete_imap_mailbox(emf_mailbox_t *mailbox, int *
 
     /* connect mail server */
     stream = NULL;
-    if (!em_core_mailbox_open(ref_account->account_id, NULL, (void **)&tmp_stream, NULL))
+    if (!emcore_connect_to_remote_mailbox(ref_account->account_id, NULL, (void **)&tmp_stream, NULL))
     {
         err = EMF_ERROR_CONNECTION_FAILURE;
         goto JOB_ERROR;
@@ -1016,7 +960,7 @@ EXPORT_API int em_core_mailbox_delete_imap_mailbox(emf_mailbox_t *mailbox, int *
     stream = (MAILSTREAM *)tmp_stream;
 
     /* encode mailbox name by UTF7, and rename to full path (ex : {mail.test.com}child_mailbox) */
-    if (!em_core_get_long_encoded_path(mailbox->account_id, mailbox->name, '/', &long_enc_path, err_code))
+    if (!emcore_get_long_encoded_path(mailbox->account_id, mailbox->name, '/', &long_enc_path, err_code))
     {
         err = EMF_ERROR_UNKNOWN;
         goto JOB_ERROR;
@@ -1029,25 +973,14 @@ EXPORT_API int em_core_mailbox_delete_imap_mailbox(emf_mailbox_t *mailbox, int *
         goto JOB_ERROR;
     }
 
-       em_core_mailbox_close(0, stream);                               
+       emcore_close_mailbox(0, stream);                                
        stream = NULL;
 
     EM_SAFE_FREE(long_enc_path);
 
     /* if deleted imap mailbox is synchronous mailbox, delete db imap mailbox from db */
-    if (!em_storage_delete_mailbox(ref_account->account_id, 0, mailbox->name, true, &err)) {
-               EM_DEBUG_EXCEPTION("\t em_storage_delete_mailbox failed - %d", err);
-               
-               if (err == EM_STORAGE_ERROR_MAILBOX_NOT_FOUND)
-                       err = EMF_ERROR_MAILBOX_NOT_FOUND;
-               else if (err == EM_STORAGE_ERROR_INVALID_PARAM)
-                       err = EMF_ERROR_INVALID_PARAM;
-               else if (err == EM_STORAGE_ERROR_OUT_OF_MEMORY)
-                       err = EMF_ERROR_OUT_OF_MEMORY;
-               else if (err == EM_STORAGE_ERROR_DB_FAILURE)
-                       err = EMF_ERROR_DB_FAILURE;
-               else
-                       err = EMF_ERROR_UNKNOWN;
+    if (!emstorage_delete_mailbox(ref_account->account_id, 0, mailbox->name, true, &err)) {
+               EM_DEBUG_EXCEPTION("\t emstorage_delete_mailbox failed - %d", err);
         goto JOB_ERROR;
     }
 
@@ -1056,7 +989,7 @@ EXPORT_API int em_core_mailbox_delete_imap_mailbox(emf_mailbox_t *mailbox, int *
 JOB_ERROR:
     if (stream)
     {
-               em_core_mailbox_close(0, stream);                               
+               emcore_close_mailbox(0, stream);                                
                stream = NULL;
     }
 
@@ -1078,12 +1011,12 @@ JOB_ERROR:
  *    succeed  :  1
  *    fail  :  0
  */
-EXPORT_API int em_core_mailbox_modify_imap_mailbox(emf_mailbox_t *old_mailbox,  emf_mailbox_t *new_mailbox, int *err_code)
+INTERNAL_FUNC int emcore_modify_imap_mailbox(emf_mailbox_t *old_mailbox,  emf_mailbox_t *new_mailbox, int *err_code)
 {
     MAILSTREAM *stream = NULL;
     char *long_enc_path = NULL;
     char *long_enc_path_new = NULL;
-    emf_mailbox_tbl_t imap_mailbox_tbl_item;
+    emstorage_mailbox_tbl_t imap_mailbox_tbl_item;
     emf_account_t *ref_account = NULL;
     void *tmp_stream = NULL;
     int ret = false;
@@ -1101,14 +1034,14 @@ EXPORT_API int em_core_mailbox_modify_imap_mailbox(emf_mailbox_t *old_mailbox,
         goto JOB_ERROR;
     }
 
-    ref_account = em_core_get_account_reference(old_mailbox->account_id);
+    ref_account = emcore_get_account_reference(old_mailbox->account_id);
     if (!ref_account)
     {
         err = EMF_ERROR_INVALID_PARAM;
         goto JOB_ERROR;
     }
 
-    if (!em_core_get_account_reference(new_mailbox->account_id))
+    if (!emcore_get_account_reference(new_mailbox->account_id))
     {
         err = EMF_ERROR_INVALID_PARAM;
         goto JOB_ERROR;
@@ -1124,7 +1057,7 @@ EXPORT_API int em_core_mailbox_modify_imap_mailbox(emf_mailbox_t *old_mailbox,
 
     /* connect mail server */
     stream = NULL;
-    if (!em_core_mailbox_open(ref_account->account_id, NULL, (void **)&tmp_stream, NULL))
+    if (!emcore_connect_to_remote_mailbox(ref_account->account_id, NULL, (void **)&tmp_stream, NULL))
     {
         err = EMF_ERROR_CONNECTION_FAILURE;
         goto JOB_ERROR;
@@ -1133,14 +1066,14 @@ EXPORT_API int em_core_mailbox_modify_imap_mailbox(emf_mailbox_t *old_mailbox,
     stream = (MAILSTREAM *)tmp_stream;
 
     /* encode mailbox name by UTF7, and rename to full path (ex : {mail.test.com}child_mailbox) */
-    if (!em_core_get_long_encoded_path(old_mailbox->account_id, old_mailbox->name, '/', &long_enc_path, err_code))
+    if (!emcore_get_long_encoded_path(old_mailbox->account_id, old_mailbox->name, '/', &long_enc_path, err_code))
     {
         err = EMF_ERROR_UNKNOWN;
         goto JOB_ERROR;
     }
 
     /* encode mailbox name by UTF7, and rename to full path (ex : {mail.test.com}child_mailbox) */
-    if (!em_core_get_long_encoded_path(new_mailbox->account_id, new_mailbox->name, '/', &long_enc_path_new, err_code))
+    if (!emcore_get_long_encoded_path(new_mailbox->account_id, new_mailbox->name, '/', &long_enc_path_new, err_code))
     {
         err = EMF_ERROR_UNKNOWN;
         goto JOB_ERROR;
@@ -1156,7 +1089,7 @@ EXPORT_API int em_core_mailbox_modify_imap_mailbox(emf_mailbox_t *old_mailbox,
     EM_SAFE_FREE(long_enc_path);
     EM_SAFE_FREE(long_enc_path_new);
 
-       em_core_mailbox_close(0, stream);                               
+       emcore_close_mailbox(0, stream);                                
        stream = NULL;
 
     imap_mailbox_tbl_item.alias = NULL;
@@ -1164,13 +1097,9 @@ EXPORT_API int em_core_mailbox_modify_imap_mailbox(emf_mailbox_t *old_mailbox,
     imap_mailbox_tbl_item.modifiable_yn = 1;
 
     /* if modified imap mailbox is synchronous mailbox, update mailbox name from imap mailbox table */
-    if (!em_storage_update_mailbox(ref_account->account_id, 0, old_mailbox->name, &imap_mailbox_tbl_item, true, &err))
+    if (!emstorage_update_mailbox(ref_account->account_id, 0, old_mailbox->name, &imap_mailbox_tbl_item, true, &err))
     {
-        EM_DEBUG_EXCEPTION("em_storage_update_mailbox failed - %d", err);
-        if (err == EM_STORAGE_ERROR_DB_IS_FULL)
-                       err = EMF_ERROR_MAIL_MEMORY_FULL;
-               else
-               err = EMF_ERROR_DB_FAILURE;
+        EM_DEBUG_EXCEPTION("emstorage_update_mailbox failed - %d", err);
         goto JOB_ERROR;
     }
 
@@ -1182,7 +1111,7 @@ JOB_ERROR:
 
     if (stream)
     {
-               em_core_mailbox_close(0, stream);                               
+               emcore_close_mailbox(0, stream);                                
                stream = NULL;
     }
 
similarity index 55%
rename from email-core/em-core-mesg.c
rename to email-core/email-core-mail.c
index 968b16d..2bbac96 100755 (executable)
@@ -22,7 +22,7 @@
 
 
 /******************************************************************************
- * File :  em-core-mesg.c
+ * File :  email-core-mail.c
  * Desc :  Mail Operation
  *
  * Auth : 
 #include <vconf.h> 
 #include <contacts-svc.h>
 
-#include "em-core-types.h"
+#include "email-internal-types.h"
 #include "c-client.h"
 #include "lnx_inc.h"
-#include "em-core-global.h"
-#include "em-core-utils.h"
-#include "em-core-mesg.h"
-#include "em-core-mime.h"
-#include "em-core-mailbox.h"
-#include "em-storage.h"
-#include "em-core-mailbox-sync.h"
-#include "em-core-event.h"
-#include "em-core-account.h" 
-
-#include "Msg_Convert.h"
-#include "emf-dbglog.h"
+#include "email-utilities.h"
+#include "email-core-global.h"
+#include "email-core-utils.h"
+#include "email-core-mail.h"
+#include "email-core-mime.h"
+#include "email-core-mailbox.h"
+#include "email-storage.h"
+#include "email-core-mailbox-sync.h"
+#include "email-core-event.h"
+#include "email-core-account.h" 
+
+#include "email-convert.h"
+#include "email-debug-log.h"
 
 #ifdef __FEATURE_DRM__
 #include <drm-service.h>
@@ -88,9 +89,8 @@ int _imap4_download_noti_interval_value = 0;
 BODY **g_inline_list = NULL ;
 int g_inline_count = 0;
 
-static int  em_core_mail_delete_from_server(emf_account_t *account, emf_mailbox_t *mailbox, int msgno, int *err_code);
-static int  em_core_mail_cmd_read_mail_pop3(void *stream, int msgno, int limited_size, int *downloded_size, int *total_body_size, int *err_code);
-static void em_core_mail_fill_attachment(emf_attachment_info_t *atch , emf_mail_attachment_tbl_t *attachment_tbl);
+static int  emcore_delete_mail_from_server(emf_account_t *account, emf_mailbox_t *mailbox, int msgno, int *err_code);
+static int  emcore_mail_cmd_read_mail_pop3(void *stream, int msgno, int limited_size, int *downloded_size, int *total_body_size, int *err_code);
 
 extern long pop3_send (MAILSTREAM *stream, char *command, char *args);
 
@@ -275,7 +275,7 @@ FINISH_OFF:
 
 #ifdef __FEATURE_BULK_DELETE_MOVE_UPDATE_REQUEST_OPTI__
 
-static void em_core_mail_copyuid_ex(MAILSTREAM *stream, char *mailbox, unsigned long uidvalidity, SEARCHSET *sourceset, SEARCHSET *destset)
+static void emcore_mail_copyuid_ex(MAILSTREAM *stream, char *mailbox, unsigned long uidvalidity, SEARCHSET *sourceset, SEARCHSET *destset)
 {
        
        EM_DEBUG_FUNC_BEGIN();
@@ -301,7 +301,7 @@ static void em_core_mail_copyuid_ex(MAILSTREAM *stream, char *mailbox, unsigned
                if sourceset is NULL then corresponding dest set will be NULL
                */
                
-               EM_DEBUG_LOG("em_core_mail_copyuid_ex failed :  Invalid Parameters--> sourceset[%p] , destset[%p]", sourceset, destset);
+               EM_DEBUG_LOG("emcore_mail_copyuid_ex failed :  Invalid Parameters--> sourceset[%p] , destset[%p]", sourceset, destset);
                return;
        }
 
@@ -330,8 +330,8 @@ static void em_core_mail_copyuid_ex(MAILSTREAM *stream, char *mailbox, unsigned
        
 
        EM_DEBUG_LOG("Count of mails copied [%d]", count);
-       old_server_uid = em_core_malloc(count * sizeof(unsigned long));
-       new_server_uid = em_core_malloc(count * sizeof(unsigned long));
+       old_server_uid = em_malloc(count * sizeof(unsigned long));
+       new_server_uid = em_malloc(count * sizeof(unsigned long));
 
        /* While loop below will collect all old server uid from sourceset into old_server_uid array */
        
@@ -398,18 +398,18 @@ static void em_core_mail_copyuid_ex(MAILSTREAM *stream, char *mailbox, unsigned
 
                EM_DEBUG_LOG("New Server Uid Char[%s]", new_server_uid_char);
        
-               if (!em_storage_update_server_uid(old_server_uid_char, new_server_uid_char, &err)) {
-                       EM_DEBUG_EXCEPTION("em_storage_update_server_uid failed...[%d]", err);
+               if (!emstorage_update_server_uid(old_server_uid_char, new_server_uid_char, &err)) {
+                       EM_DEBUG_EXCEPTION("emstorage_update_server_uid failed...[%d]", err);
                }
                
-               if (!em_storage_update_read_mail_uid_by_server_uid(old_server_uid_char, new_server_uid_char, mailbox, &err)) {
-                       EM_DEBUG_EXCEPTION("em_storage_update_read_mail_uid_by_server_uid failed... [%d]", err);
+               if (!emstorage_update_read_mail_uid_by_server_uid(old_server_uid_char, new_server_uid_char, mailbox, &err)) {
+                       EM_DEBUG_EXCEPTION("emstorage_update_read_mail_uid_by_server_uid failed... [%d]", err);
                }
                
 #ifdef __FEATURE_PARTIAL_BODY_DOWNLOAD__
 
-               if (false == em_storage_update_pbd_activity(old_server_uid_char, new_server_uid_char, mailbox, &err)) {
-                       EM_DEBUG_EXCEPTION("em_storage_update_pbd_activity failed... [%d]", err);
+               if (false == emstorage_update_pbd_activity(old_server_uid_char, new_server_uid_char, mailbox, &err)) {
+                       EM_DEBUG_EXCEPTION("emstorage_update_pbd_activity failed... [%d]", err);
                }
                
 #endif
@@ -420,8 +420,7 @@ static void em_core_mail_copyuid_ex(MAILSTREAM *stream, char *mailbox, unsigned
        
 }
 
-
-EXPORT_API int em_core_mail_move_from_server_ex(int account_id, char *src_mailbox,  int mail_ids[], int num, char *dest_mailbox, int *error_code)
+INTERNAL_FUNC int emcore_move_mail_on_server_ex(int account_id, char *src_mailbox,  int mail_ids[], int num, char *dest_mailbox, int *error_code)
 {
        EM_DEBUG_FUNC_BEGIN();
        MAILSTREAM *stream = NULL;
@@ -448,10 +447,10 @@ EXPORT_API int em_core_mail_move_from_server_ex(int account_id, char *src_mailbo
                return false;
        }
 
-       ref_account = em_core_get_account_reference(account_id);
+       ref_account = emcore_get_account_reference(account_id);
        
        if (NULL == ref_account) {
-               EM_DEBUG_EXCEPTION(" em_core_get_account_reference failed[%d]", account_id);
+               EM_DEBUG_EXCEPTION(" emcore_get_account_reference failed[%d]", account_id);
                
                *error_code = EMF_ERROR_INVALID_ACCOUNT;
                goto FINISH_OFF;
@@ -464,22 +463,22 @@ EXPORT_API int em_core_mail_move_from_server_ex(int account_id, char *src_mailbo
        }
 
 
-       if (!em_core_mailbox_open(account_id, src_mailbox, (void **)&stream, &err_code))                 {
-               EM_DEBUG_EXCEPTION("em_core_mailbox_open failed[%d]", err_code);
+       if (!emcore_connect_to_remote_mailbox(account_id, src_mailbox, (void **)&stream, &err_code))             {
+               EM_DEBUG_EXCEPTION("emcore_connect_to_remote_mailbox failed[%d]", err_code);
                
                goto FINISH_OFF;
        }
 
        if (NULL != stream) {
-               mail_parameters(stream, SET_COPYUID, em_core_mail_copyuid_ex);
+               mail_parameters(stream, SET_COPYUID, emcore_mail_copyuid_ex);
                EM_DEBUG_LOG("calling mail_copy_full FODLER MAIL COPY ");
                /*  [h.gahlaut] Break the set of mail_ids into comma separated strings of given length  */
-               /*  Length is decided on the basis of remaining keywords in the Query to be formed later on in em_storage_get_id_set_from_mail_ids  */
+               /*  Length is decided on the basis of remaining keywords in the Query to be formed later on in emstorage_get_id_set_from_mail_ids  */
                /*  Here about 90 bytes are required for fixed keywords in the query-> SELECT local_uid, s_uid from mail_read_mail_uid_tbl where local_uid in (....) ORDER by s_uid  */
                /*  So length of comma separated strings which will be filled in (.....) in above query can be maximum QUERY_SIZE - 90  */
                
-               if (false == em_core_form_comma_separated_strings(mail_ids, num, QUERY_SIZE - 90, &string_list, &string_count, &err_code))   {
-                       EM_DEBUG_EXCEPTION("em_core_form_comma_separated_strings failed [%d]", err_code);
+               if (false == emcore_form_comma_separated_strings(mail_ids, num, QUERY_SIZE - 90, &string_list, &string_count, &err_code))   {
+                       EM_DEBUG_EXCEPTION("emcore_form_comma_separated_strings failed [%d]", err_code);
                        goto FINISH_OFF;
                }
                
@@ -488,8 +487,8 @@ EXPORT_API int em_core_mail_move_from_server_ex(int account_id, char *src_mailbo
                for (i = 0; i < string_count; ++i) {
                        /*  Get the set of mail_ds and corresponding server_mail_ids sorted by server mail ids in ascending order */
                
-                       if (false == em_storage_get_id_set_from_mail_ids(string_list[i], &id_set, &id_set_count, &err_code)) {
-                               EM_DEBUG_EXCEPTION("em_storage_get_id_set_from_mail_ids failed [%d]", err_code);
+                       if (false == emstorage_get_id_set_from_mail_ids(string_list[i], &id_set, &id_set_count, &err_code)) {
+                               EM_DEBUG_EXCEPTION("emstorage_get_id_set_from_mail_ids failed [%d]", err_code);
                                goto FINISH_OFF;
                        }
                        
@@ -497,8 +496,8 @@ EXPORT_API int em_core_mail_move_from_server_ex(int account_id, char *src_mailbo
                        
                        len_of_each_range = MAX_IMAP_COMMAND_LENGTH - 40; /*  1000 is the maximum length allowed RFC 2683. 40 is left for keywords and tag. */
                        
-                       if (false == em_core_convert_to_uid_range_set(id_set, id_set_count, &uid_range_set, len_of_each_range, &err_code)) {
-                               EM_DEBUG_EXCEPTION("em_core_convert_to_uid_range_set failed [%d]", err_code);
+                       if (false == emcore_convert_to_uid_range_set(id_set, id_set_count, &uid_range_set, len_of_each_range, &err_code)) {
+                               EM_DEBUG_EXCEPTION("emcore_convert_to_uid_range_set failed [%d]", err_code);
                                goto FINISH_OFF;
                        }
                
@@ -509,12 +508,12 @@ EXPORT_API int em_core_mail_move_from_server_ex(int account_id, char *src_mailbo
                                uid_range_node->uid_range[strlen(uid_range_node->uid_range) - 1] = '\0';
                                EM_DEBUG_LOG("uid_range_node->uid_range - %s", uid_range_node->uid_range);
                                if (!mail_copy_full(stream, uid_range_node->uid_range, dest_mailbox, CP_UID | CP_MOVE)) {
-                                       EM_DEBUG_EXCEPTION("em_core_mail_move_from_server_ex :   Mail cannot be moved failed");
+                                       EM_DEBUG_EXCEPTION("emcore_move_mail_on_server_ex :   Mail cannot be moved failed");
                                        EM_DEBUG_EXCEPTION("Mail MOVE failed ");
                                        goto FINISH_OFF;
                                }
                                else if (!mail_expunge_full(stream, uid_range_node->uid_range, EX_UID)) {
-                                       EM_DEBUG_EXCEPTION("em_core_mail_move_from_server_ex :   Mail cannot be expunged after move. failed!");
+                                       EM_DEBUG_EXCEPTION("emcore_move_mail_on_server_ex :   Mail cannot be expunged after move. failed!");
                                                EM_DEBUG_EXCEPTION("Mail Expunge after move failed ");
                                                  goto FINISH_OFF;
                                }
@@ -525,7 +524,7 @@ EXPORT_API int em_core_mail_move_from_server_ex(int account_id, char *src_mailbo
                                uid_range_node = uid_range_node->next;
                        }       
 
-                       em_core_free_uid_range_set(&uid_range_set);
+                       emcore_free_uid_range_set(&uid_range_set);
 
                        EM_SAFE_FREE(id_set);
                        
@@ -542,21 +541,21 @@ EXPORT_API int em_core_mail_move_from_server_ex(int account_id, char *src_mailbo
        ret = true;
 
 FINISH_OFF: 
-       em_core_mailbox_close(0, stream);
+       emcore_close_mailbox(0, stream);
        stream = NULL;
 
-#ifdef __LOCAL_ACTIVITY__
+#ifdef __FEATURE_LOCAL_ACTIVITY__
        if (ret || ref_account->receiving_server_type != EMF_SERVER_TYPE_IMAP4) /* Delete local activity for POP3 mails and successful move operation in IMAP */ {
-               emf_activity_tbl_t new_activity;
+               emstorage_activity_tbl_t new_activity;
                for (i = 0; i<num ; i++) {              
-                       memset(&new_activity, 0x00, sizeof(emf_activity_tbl_t));
+                       memset(&new_activity, 0x00, sizeof(emstorage_activity_tbl_t));
                        new_activity.activity_type = ACTIVITY_MOVEMAIL;
                        new_activity.account_id    = account_id;
                        new_activity.mail_id       = mail_ids[i];
                        new_activity.src_mbox      = src_mailbox;
                        new_activity.dest_mbox     = dest_mailbox;
                
-                       if (!em_core_activity_delete(&new_activity, &err_code)) {
+                       if (!emcore_delete_activity(&new_activity, &err_code)) {
                                EM_DEBUG_EXCEPTION(">>>>>>Local Activity ACTIVITY_MOVEMAIL [%d] ", err_code);
                        }
                }
@@ -571,7 +570,7 @@ FINISH_OFF:
        return ret;
 }
 
-#ifdef __LOCAL_ACTIVITY__
+#ifdef __FEATURE_LOCAL_ACTIVITY__
 int imap4_mail_delete_ex(emf_mailbox_t *mailbox,  int mail_ids[], int num, int from_server, int *err_code)
 #else
 int imap4_mail_delete_ex(emf_mailbox_t *mailbox,  int mail_ids[], int num, int *err_code)
@@ -612,12 +611,12 @@ int imap4_mail_delete_ex(emf_mailbox_t *mailbox,  int mail_ids[], int num, int *
        }
 
        /*  [h.gahlaut] Break the set of mail_ids into comma separated strings of given length  */
-       /*  Length is decided on the basis of remaining keywords in the Query to be formed later on in em_storage_get_id_set_from_mail_ids  */
+       /*  Length is decided on the basis of remaining keywords in the Query to be formed later on in emstorage_get_id_set_from_mail_ids  */
        /*  Here about 90 bytes are required for fixed keywords in the query-> SELECT local_uid, s_uid from mail_read_mail_uid_tbl where local_uid in (....) ORDER by s_uid  */
        /*  So length of comma separated strings which will be filled in (.....) in above query can be maximum QUERY_SIZE - 90  */
 
-       if (false == em_core_form_comma_separated_strings(mail_ids, num, QUERY_SIZE - 90, &string_list, &string_count, &err))   {
-               EM_DEBUG_EXCEPTION("em_core_form_comma_separated_strings failed [%d]", err);
+       if (false == emcore_form_comma_separated_strings(mail_ids, num, QUERY_SIZE - 90, &string_list, &string_count, &err))   {
+               EM_DEBUG_EXCEPTION("emcore_form_comma_separated_strings failed [%d]", err);
                goto FINISH_OFF;
        }
 
@@ -626,8 +625,8 @@ int imap4_mail_delete_ex(emf_mailbox_t *mailbox,  int mail_ids[], int num, int *
        for (i = 0; i < string_count; ++i) {
                /*  Get the set of mail_ds and corresponding server_mail_ids sorted by server mail ids in ascending order  */
 
-               if (false == em_storage_get_id_set_from_mail_ids(string_list[i], &id_set, &id_set_count, &err)) {
-                       EM_DEBUG_EXCEPTION("em_storage_get_id_set_from_mail_ids failed [%d]", err);
+               if (false == emstorage_get_id_set_from_mail_ids(string_list[i], &id_set, &id_set_count, &err)) {
+                       EM_DEBUG_EXCEPTION("emstorage_get_id_set_from_mail_ids failed [%d]", err);
                        goto FINISH_OFF;
                }
                
@@ -635,8 +634,8 @@ int imap4_mail_delete_ex(emf_mailbox_t *mailbox,  int mail_ids[], int num, int *
                
                len_of_each_range = MAX_IMAP_COMMAND_LENGTH - 40;               /*   1000 is the maximum length allowed RFC 2683. 40 is left for keywords and tag.  */
                
-               if (false == em_core_convert_to_uid_range_set(id_set, id_set_count, &uid_range_set, len_of_each_range, &err)) {
-                       EM_DEBUG_EXCEPTION("em_core_convert_to_uid_range_set failed [%d]", err);
+               if (false == emcore_convert_to_uid_range_set(id_set, id_set_count, &uid_range_set, len_of_each_range, &err)) {
+                       EM_DEBUG_EXCEPTION("emcore_convert_to_uid_range_set failed [%d]", err);
                        goto FINISH_OFF;
                }
 
@@ -745,23 +744,23 @@ int imap4_mail_delete_ex(emf_mailbox_t *mailbox,  int mail_ids[], int num, int *
                                        
                                        if (!strncmp(p, tag, strlen(tag)))  {
                                                if (!strncmp(p + strlen(tag) + 1, "OK", 2))  {
-#ifdef __LOCAL_ACTIVITY__
+#ifdef __FEATURE_LOCAL_ACTIVITY__
                                                        int index = 0;
-                                                       emf_mail_tbl_t **mail = NULL;
+                                                       emstorage_mail_tbl_t **mail = NULL;
                                                        
-                                                       mail = (emf_mail_tbl_t **) em_core_malloc(num * sizeof(emf_mail_tbl_t *));
+                                                       mail = (emstorage_mail_tbl_t **) em_malloc(num * sizeof(emstorage_mail_tbl_t *));
                                                        if (!mail) {
-                                                               EM_DEBUG_EXCEPTION("em_core_malloc failed");
+                                                               EM_DEBUG_EXCEPTION("em_malloc failed");
                                                                err = EMF_ERROR_UNKNOWN;
                                                                goto FINISH_OFF;
                                                        }
 
                                                        if (delete_success) {
                                                                for (index = 0 ; index < num; index++) {
-                                                                       if (!em_storage_get_downloaded_mail(mail_ids[index], &mail[index], false, &err))  {
-                                                                               EM_DEBUG_LOG("em_storage_get_uid_by_mail_id failed [%d]", err);
+                                                                       if (!emstorage_get_downloaded_mail(mail_ids[index], &mail[index], false, &err))  {
+                                                                               EM_DEBUG_LOG("emstorage_get_uid_by_mail_id failed [%d]", err);
                                                                                
-                                                                               if (err == EM_STORAGE_ERROR_MAIL_NOT_FOUND)  {          
+                                                                               if (err == EMF_ERROR_MAIL_NOT_FOUND)  {         
                                                                                        EM_DEBUG_LOG("EMF_ERROR_MAIL_NOT_FOUND_ON_SERVER  : ");
                                                                                        continue;
                                                                                }
@@ -770,14 +769,14 @@ int imap4_mail_delete_ex(emf_mailbox_t *mailbox,  int mail_ids[], int num, int *
                                                                        if (mail[index]) {                              
                                                                                /* Clear entry from mail_read_mail_uid_tbl */
                                                                                if (mail[index]->server_mail_id != NULL) {
-                                                                                       if (!em_storage_remove_downloaded_mail(mailbox->account_id, mailbox->name, mail[index]->server_mail_id, true, &err))  {
-                                                                                               EM_DEBUG_LOG("em_storage_remove_downloaded_mail falied [%d]", err);
+                                                                                       if (!emstorage_remove_downloaded_mail(mailbox->account_id, mailbox->name, mail[index]->server_mail_id, true, &err))  {
+                                                                                               EM_DEBUG_LOG("emstorage_remove_downloaded_mail falied [%d]", err);
                                                                                        }
                                                                                }
                                                                                
                                                                                /* Delete local activity */
-                                                                               emf_activity_tbl_t new_activity;
-                                                                               memset(&new_activity, 0x00, sizeof(emf_activity_tbl_t));
+                                                                               emstorage_activity_tbl_t new_activity;
+                                                                               memset(&new_activity, 0x00, sizeof(emstorage_activity_tbl_t));
                                                                                if (from_server == EMF_DELETE_FOR_SEND_THREAD) {
                                                                                        new_activity.activity_type = ACTIVITY_DELETEMAIL_SEND;
                                                                                        EM_DEBUG_LOG("from_server == EMF_DELETE_FOR_SEND_THREAD ");
@@ -791,8 +790,8 @@ int imap4_mail_delete_ex(emf_mailbox_t *mailbox,  int mail_ids[], int num, int *
                                                                                new_activity.src_mbox           = NULL;
                                                                                new_activity.dest_mbox          = NULL;
                                                                                                                
-                                                                               if (!em_core_activity_delete(&new_activity, &err)) {
-                                                                                       EM_DEBUG_EXCEPTION(" em_core_activity_delete  failed  - %d ", err);
+                                                                               if (!emcore_delete_activity(&new_activity, &err)) {
+                                                                                       EM_DEBUG_EXCEPTION(" emcore_delete_activity  failed  - %d ", err);
                                                                                }
                                                                        }
                                                                        else {
@@ -800,23 +799,23 @@ int imap4_mail_delete_ex(emf_mailbox_t *mailbox,  int mail_ids[], int num, int *
                                                                                  * So there is no need of deleting entry in mail_read_mail_uid_tbl. However local activity has to be deleted. 
                                                                                */
                                                                                /* Delete local activity */
-                                                                               emf_activity_tbl_t new_activity;
-                                                                               memset(&new_activity, 0x00, sizeof(emf_activity_tbl_t));
+                                                                               emstorage_activity_tbl_t new_activity;
+                                                                               memset(&new_activity, 0x00, sizeof(emstorage_activity_tbl_t));
                                                                                new_activity.activity_type      = ACTIVITY_DELETEMAIL;
                                                                                new_activity.mail_id            = mail_ids[index]; /* valid mail id passed for outbox mails*/
                                                                                new_activity.server_mailid      = NULL;
                                                                                new_activity.src_mbox           = NULL;
                                                                                new_activity.dest_mbox          = NULL;
                                                                                                                
-                                                                               if (!em_core_activity_delete(&new_activity, &err)) {
-                                                                                       EM_DEBUG_EXCEPTION(" em_core_activity_delete  failed  - %d ", err);
+                                                                               if (!emcore_delete_activity(&new_activity, &err)) {
+                                                                                       EM_DEBUG_EXCEPTION(" emcore_delete_activity  failed  - %d ", err);
                                                                                }
                                                                        }
                                                                }
 
                                                                for (index = 0; index < num; index++) {
-                                                                       if (!em_storage_free_mail(&mail[index], 1, &err)) {
-                                                                               EM_DEBUG_EXCEPTION(" em_storage_free_mail [%d]", err);
+                                                                       if (!emstorage_free_mail(&mail[index], 1, &err)) {
+                                                                               EM_DEBUG_EXCEPTION(" emstorage_free_mail [%d]", err);
                                                                        }
                                                                }
 
@@ -838,7 +837,7 @@ int imap4_mail_delete_ex(emf_mailbox_t *mailbox,  int mail_ids[], int num, int *
                                uid_range_node = uid_range_node->next;
                }       
 
-               em_core_free_uid_range_set(&uid_range_set);
+               emcore_free_uid_range_set(&uid_range_set);
 
                EM_SAFE_FREE(id_set);
                
@@ -850,10 +849,10 @@ int imap4_mail_delete_ex(emf_mailbox_t *mailbox,  int mail_ids[], int num, int *
 FINISH_OFF: 
        EM_SAFE_FREE(p);
        
-       em_core_free_comma_separated_strings(&string_list, &string_count);
+       emcore_free_comma_separated_strings(&string_list, &string_count);
 
        if (false == ret) {
-               em_core_free_uid_range_set(&uid_range_set);
+               emcore_free_uid_range_set(&uid_range_set);
        }
        
        if (err_code) {
@@ -1061,135 +1060,16 @@ FINISH_OFF:
 
        return ret;
 }
-       
-
-
-/* description 
- *    get mail header from local mailbox
- * arguments  
- *    mailbox  :  message no
- *    header  :  buffer to hold header information
- * return  
- *    succeed  :  1
- *    fail  :  0
- */
-int em_core_mail_get_header(/*emf_mailbox_t *mailbox, */ int mail_id, emf_mail_head_t **header, int *err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("mail_id[%d], header[%p], err_code[%p]", mail_id, header, err_code);
-       
-       if (!mail_id || !header)  {
-               EM_DEBUG_EXCEPTION("mail_id[%d], header[%p]", mail_id, header);
-               if (err_code != NULL)
-                       *err_code = EMF_ERROR_INVALID_PARAM;
-               return false;
-       }
-       
-       int ret = false;
-       int err = EMF_ERROR_NONE;
-       
-       emf_mail_head_t *p = NULL;
-       emf_mail_tbl_t *mail = NULL;
-       
-       *header = NULL;
-       
-       /* get mail from mail table */
-       if (!em_storage_get_mail_by_id(mail_id, &mail, true, &err) || !mail)  {
-               EM_DEBUG_EXCEPTION("em_storage_get_mail_by_id failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
-               goto FINISH_OFF;
-       }
-       
-       if (!em_core_mail_get_header_from_mail_tbl(&p, mail, &err))  {
-               EM_DEBUG_EXCEPTION("em_core_mail_get_header_from_mail_tbl failed [%d]", err);           
-               goto FINISH_OFF;
-       }
-       
-       *header = p;
-       
-       ret = true;
-       
-FINISH_OFF: 
-       if (ret == false && p != NULL)
-               em_core_mail_head_free(&p, 1, NULL);
-       
-       if (mail != NULL)
-               em_storage_free_mail(&mail, 1, NULL);
-       
-       if (err_code != NULL)
-               *err_code = err;
-       
-       return ret;
-}
-EXPORT_API int em_core_mail_get_header_from_mail_tbl(emf_mail_head_t **header, emf_mail_tbl_t *mail , int *err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("mail[%p], header[%p], err_code[%p]", mail, header, err_code);
-       
-       if (!mail || !header)  {
-               EM_DEBUG_EXCEPTION("mail[%p], header[%p]", mail, header);
-               if (err_code != NULL)           
-                       *err_code = EMF_ERROR_INVALID_PARAM;
-               return false;
-       }
-       
-       int ret = false;
-       int err = EMF_ERROR_NONE;
-       
-       emf_mail_head_t *p = NULL;
-
-       if (!(p = em_core_malloc(sizeof(emf_mail_head_t))))  {
-               EM_DEBUG_EXCEPTION("malloc failed...");
-               err = EMF_ERROR_OUT_OF_MEMORY;
-               goto FINISH_OFF;
-       }
-       
-       memset(p, 0x00, sizeof(emf_mail_head_t));
-       
-       p->subject = mail->subject; mail->subject = NULL;
-       p->mid = mail->message_id; mail->message_id = NULL;
-       p->to_contact_name =  NULL;
-       p->from_contact_name = NULL;
-       p->cc_contact_name = NULL;
-       p->bcc_contact_name = NULL;
-       
-       EM_DEBUG_LOG("to_contact_name [%s]", p->to_contact_name);
-       EM_DEBUG_LOG("from_contact_name [%s]", p->from_contact_name);
-
-       p->from = mail->full_address_from; mail->full_address_from = NULL;
-       p->to = mail->full_address_to; mail->full_address_to = NULL;
-       p->cc = mail->full_address_cc; mail->full_address_cc = NULL;
-       p->bcc = mail->full_address_bcc; mail->full_address_bcc = NULL;
-       p->reply_to = mail->full_address_reply; mail->full_address_reply = NULL;
-       p->return_path = mail->full_address_return; mail->full_address_return = NULL;
-       p->previewBodyText = mail->preview_text; mail->preview_text = NULL;
-
-       /* mail received time */
-       if (!em_convert_string_to_datetime(mail->datetime, &p->datetime, &err))  {
-               EM_DEBUG_EXCEPTION("em_convert_string_to_datetime failed [%d]", err);
-               /* goto FINISH_OFF; */
-       }
-       ret = true;
-       
-FINISH_OFF: 
-       if (ret == true)
-               *header = p;
-       else if (p != NULL) 
-               em_core_mail_head_free(&p, 1, NULL);
-       
-       if (err_code != NULL)
-               *err_code = err;
-       
-       return ret;
-}
 
-int em_core_mail_get_contact_info(emf_mail_contact_info_t *contact_info, char *full_address, int *err_code)
+int emcore_get_mail_contact_info(emf_mail_contact_info_t *contact_info, char *full_address, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("contact_info[%p], full_address[%s], err_code[%p]", contact_info, full_address, err_code);
        
        int ret = false;
        int err = EMF_ERROR_NONE;
        
-       if (!em_core_mail_get_contact_info_with_update(contact_info, full_address, 0, &err)) 
-               EM_DEBUG_EXCEPTION("em_core_mail_get_contact_info_with_update failed [%d]", err);
+       if (!emcore_get_mail_contact_info_with_update(contact_info, full_address, 0, &err))
+               EM_DEBUG_EXCEPTION("emcore_get_mail_contact_info_with_update failed [%d]", err);
        else
                ret = true;
        
@@ -1199,7 +1079,7 @@ int em_core_mail_get_contact_info(emf_mail_contact_info_t *contact_info, char *f
        return ret;
 }
 
-EXPORT_API int em_core_mail_get_display_name(CTSvalue *contact_name_value, char **contact_display_name)
+INTERNAL_FUNC int emcore_get_mail_display_name(CTSvalue *contact_name_value, char **contact_display_name)
 {
        EM_DEBUG_FUNC_BEGIN("contact_name_value[%p], contact_display_name[%p]", contact_name_value, contact_display_name);
        char *display = NULL;
@@ -1230,22 +1110,33 @@ EXPORT_API int em_core_mail_get_display_name(CTSvalue *contact_name_value, char
        return true;
 }
 
-int em_core_mail_get_contact_info_with_update(emf_mail_contact_info_t *contact_info, char *full_address, int mail_id, int *err_code)
+int emcore_get_mail_contact_info_with_update(emf_mail_contact_info_t *contact_info, char *full_address, int mail_id, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("contact_info[%p], full_address[%s], mail_id[%d], err_code[%p]", contact_info, full_address, mail_id, err_code);
        
        int ret = false;
        int err = EMF_ERROR_NONE;
-       
        ADDRESS *addr = NULL;
        char *address = NULL;
        char *temp_emailaddr = NULL;
        int start_text_ascii = 2;
        int end_text_ascii = 3; 
-
        char *alias = NULL;
        int is_searched = false;
        int address_length = 0;
+       char *email_address = NULL;
+       int contact_name_len = 0;
+       char temp_string[1024] = { 0 , };
+       int is_saved = 0;
+       CTSstruct *contact =  NULL;
+       CTSvalue *contact_name_value = NULL;
+       int contact_index = -1;
+       char *contact_display_name = NULL;
+       char *contact_display_name_from_contact_info = NULL;
+       int contact_display_name_len = 0;
+       int i = 0;
+       int contact_name_buffer_size = 0;
+       char *contact_name = NULL;
 
        if (!contact_info)  {
                EM_DEBUG_EXCEPTION("contact_info[%p]", contact_info);
@@ -1263,14 +1154,13 @@ int em_core_mail_get_contact_info_with_update(emf_mail_contact_info_t *contact_i
                temp_emailaddr = (char  *)calloc(1, address_length); 
        }
 
-    em_core_skip_whitespace(full_address , &address);
+    em_skip_whitespace(full_address , &address);
        EM_DEBUG_LOG("address[address][%s]", address);  
 
 
        /*  ',' -> "%2C" */
        gchar **tokens = g_strsplit(address, ", ", -1);
        char *p = g_strjoinv("%2C", tokens);
-       int i = 0;
        
        g_strfreev(tokens);
        
@@ -1290,35 +1180,19 @@ int em_core_mail_get_contact_info_with_update(emf_mail_contact_info_t *contact_i
 
        if (!addr) {
                EM_DEBUG_EXCEPTION("rfc822_parse_adrlist failed...");
-               
                err = EMF_ERROR_INVALID_ADDRESS;
                goto FINISH_OFF;
        }
-       
-       CTSstruct *contact =  NULL;
-       CTSvalue *contact_name_value = NULL;
-       int contact_index = -1;
-       char *contact_display_name = NULL;
-       char *contact_display_name_from_contact_info = NULL;
-       int contact_display_name_len = 0;
-       
-       /* char **/
-       char *email_address = NULL;
-       int contact_name_buffer_size = address_length;
-       int contact_name_len = 0;
-       char *contact_name = (char  *)calloc(1, contact_name_buffer_size); 
-       char temp_string[1024];
-       
-       int is_saved = 0;
-       
+
+       contact_name_buffer_size = address_length;
+       contact_name = (char*)em_malloc(contact_name_buffer_size);
+
        if (!contact_name) {
                EM_DEBUG_EXCEPTION("Memory allocation error!");
                err = EMF_ERROR_OUT_OF_MEMORY;
                goto FINISH_OFF;
        }
        
-       memset(contact_name, 0x00, contact_name_buffer_size);   
-       
        while (addr != NULL)  {
                if (addr->mailbox && addr->host) {      
                        if (!strncmp(addr->mailbox , "UNEXPECTED_DATA_AFTER_ADDRESS", strlen("UNEXPECTED_DATA_AFTER_ADDRESS")) || !strncmp(addr->mailbox , "INVALID_ADDRESS", strlen("INVALID_ADDRESS")) || !strncmp(addr->host , ".SYNTAX-ERROR.", strlen(".SYNTAX-ERROR.")))
@@ -1341,7 +1215,7 @@ int em_core_mail_get_contact_info_with_update(emf_mail_contact_info_t *contact_i
                EM_DEBUG_LOG(" email_address[%s]", email_address);
        
                is_searched = false;
-               EM_DEBUG_LOG(" >>>>> em_core_mail_get_contact_info - 10");
+               EM_DEBUG_LOG(" >>>>> emcore_get_mail_contact_info - 10");
                        
                err = contacts_svc_find_contact_by(CTS_FIND_BY_EMAIL, email_address);
                if (err > CTS_SUCCESS) {
@@ -1350,7 +1224,7 @@ int em_core_mail_get_contact_info_with_update(emf_mail_contact_info_t *contact_i
                                /*  get  contact name */
                                if (contacts_svc_struct_get_value(contact, CTS_CF_NAME_VALUE, &contact_name_value) == CTS_SUCCESS) {    /*  set contact display name name */
                                        contact_info->contact_id = contact_index;               /*  NOTE :  This is valid only if there is only one address. */
-                                       em_core_mail_get_display_name(contact_name_value, &contact_display_name_from_contact_info);
+                                       emcore_get_mail_display_name(contact_name_value, &contact_display_name_from_contact_info);
 
                                        contact_display_name = contact_display_name_from_contact_info;
 
@@ -1540,7 +1414,7 @@ FINISH_OFF:
        return ret;
 }
 
-int em_core_mail_free_contact_info(emf_mail_contact_info_t *contact_info, int *err_code)
+int emcore_free_contact_info(emf_mail_contact_info_t *contact_info, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("contact_info[%p], err_code[%p]", contact_info, err_code);
        
@@ -1569,7 +1443,7 @@ FINISH_OFF:
        return ret;
 }
 
-int em_core_mail_contact_sync(int mail_id, int *err_code)
+int emcore_sync_contact_info(int mail_id, int *err_code)
 {
        EM_PROFILE_BEGIN(emCoreMailContactSync);
        EM_DEBUG_FUNC_BEGIN();
@@ -1577,7 +1451,7 @@ int em_core_mail_contact_sync(int mail_id, int *err_code)
        int ret = false;
        int err = EMF_ERROR_NONE;
 
-       emf_mail_tbl_t *mail = NULL;
+       emstorage_mail_tbl_t *mail = NULL;
 
        emf_mail_contact_info_t contact_info_from;
        emf_mail_contact_info_t contact_info_to;
@@ -1591,33 +1465,33 @@ int em_core_mail_contact_sync(int mail_id, int *err_code)
        memset(&contact_info_cc, 0x00, sizeof(emf_mail_contact_info_t));
        memset(&contact_info_bcc, 0x00, sizeof(emf_mail_contact_info_t));       
 
-       if (!em_storage_get_mail_by_id(mail_id, &mail, true, &err) || !mail)  {
-               EM_DEBUG_EXCEPTION("em_storage_get_mail_by_id failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+       if (!emstorage_get_mail_by_id(mail_id, &mail, true, &err) || !mail)  {
+               EM_DEBUG_EXCEPTION("emstorage_get_mail_by_id failed [%d]", err);
+
                goto FINISH_OFF;
        }
 
        if (mail->full_address_from != NULL) {
-               if (!em_core_mail_get_contact_info_with_update(&contact_info_from, mail->full_address_from, mail_id, &err))  {
-                       EM_DEBUG_EXCEPTION("em_core_mail_get_contact_info failed [%d]", err);
+               if (!emcore_get_mail_contact_info_with_update(&contact_info_from, mail->full_address_from, mail_id, &err))  {
+                       EM_DEBUG_EXCEPTION("emcore_get_mail_contact_info failed [%d]", err);
                }
        }
 
        if (mail->full_address_to != NULL)  {
-               if (!em_core_mail_get_contact_info_with_update(&contact_info_to, mail->full_address_to, mail_id, &err))  {
-                       EM_DEBUG_EXCEPTION("em_core_mail_get_contact_info failed [%d]", err);
+               if (!emcore_get_mail_contact_info_with_update(&contact_info_to, mail->full_address_to, mail_id, &err))  {
+                       EM_DEBUG_EXCEPTION("emcore_get_mail_contact_info failed [%d]", err);
                }
        }
 
        if (mail->full_address_cc != NULL)  {
-               if (!em_core_mail_get_contact_info_with_update(&contact_info_cc, mail->full_address_cc, mail_id, &err))  {
-                       EM_DEBUG_EXCEPTION("em_core_mail_get_contact_info failed [%d]", err);
+               if (!emcore_get_mail_contact_info_with_update(&contact_info_cc, mail->full_address_cc, mail_id, &err))  {
+                       EM_DEBUG_EXCEPTION("emcore_get_mail_contact_info failed [%d]", err);
                }
        }
 
        if (mail->full_address_bcc != NULL)  {
-               if (!em_core_mail_get_contact_info_with_update(&contact_info_bcc, mail->full_address_bcc, mail_id, &err))  {
-                       EM_DEBUG_EXCEPTION("em_core_mail_get_contact_info failed [%d]", err);
+               if (!emcore_get_mail_contact_info_with_update(&contact_info_bcc, mail->full_address_bcc, mail_id, &err))  {
+                       EM_DEBUG_EXCEPTION("emcore_get_mail_contact_info failed [%d]", err);
                }
        }       
 
@@ -1643,9 +1517,9 @@ int em_core_mail_contact_sync(int mail_id, int *err_code)
        }
        
        /*  Update DB */
-       if (!em_storage_change_mail_field(mail_id, UPDATE_ALL_CONTACT_INFO, mail, false, &err))  {                                      
-               EM_DEBUG_EXCEPTION("em_storage_change_mail_field failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+       if (!emstorage_change_mail_field(mail_id, UPDATE_ALL_CONTACT_INFO, mail, false, &err))  {                                       
+               EM_DEBUG_EXCEPTION("emstorage_change_mail_field failed [%d]", err);
+
                goto FINISH_OFF;
        }       
 
@@ -1653,12 +1527,12 @@ int em_core_mail_contact_sync(int mail_id, int *err_code)
 
 FINISH_OFF: 
        if (mail != NULL)
-               em_storage_free_mail(&mail, 1, NULL);
+               emstorage_free_mail(&mail, 1, NULL);
 
-       em_core_mail_free_contact_info(&contact_info_from, NULL);
-       em_core_mail_free_contact_info(&contact_info_to, NULL);
-       em_core_mail_free_contact_info(&contact_info_cc, NULL);
-       em_core_mail_free_contact_info(&contact_info_bcc, NULL);        
+       emcore_free_contact_info(&contact_info_from, NULL);
+       emcore_free_contact_info(&contact_info_to, NULL);
+       emcore_free_contact_info(&contact_info_cc, NULL);
+       emcore_free_contact_info(&contact_info_bcc, NULL);      
 
        if (err_code != NULL)
                *err_code = err;
@@ -1670,7 +1544,7 @@ FINISH_OFF:
 /*  1. parsing  :  alias and address */
 /*  2. sync with contact */
 /*  3. make glist of address info */
-static int em_core_sync_address_info(emf_address_type_t address_type, char *full_address, GList **address_info_list, int *err_code)
+static int emcore_sync_address_info(emf_address_type_t address_type, char *full_address, GList **address_info_list, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("address type[%d], address_info_list[%p], full_address[%p]", address_type, address_info_list, full_address);
 
@@ -1716,7 +1590,7 @@ static int em_core_sync_address_info(emf_address_type_t address_type, char *full
 
        if (!addr)  {
                EM_DEBUG_EXCEPTION("rfc822_parse_adrlist failed...");
-               error = EM_STORAGE_ERROR_INVALID_PARAM;         
+               error = EMF_ERROR_INVALID_PARAM;                
                goto FINISH_OFF;
        }
 
@@ -1743,7 +1617,7 @@ static int em_core_sync_address_info(emf_address_type_t address_type, char *full
 
                if (!(p_address_info = (emf_address_info_t *)malloc(sizeof(emf_address_info_t)))) {
                        EM_DEBUG_EXCEPTION("malloc failed...");
-                       error = EM_STORAGE_ERROR_OUT_OF_MEMORY;
+                       error = EMF_ERROR_OUT_OF_MEMORY;
                        goto FINISH_OFF;
                }       
                memset(p_address_info, 0x00, sizeof(emf_address_info_t)); 
@@ -1760,7 +1634,7 @@ static int em_core_sync_address_info(emf_address_type_t address_type, char *full
                        if ((error = contacts_svc_get_contact(contact_index, &contact)) == CTS_SUCCESS) {
                                /*  get  contact name */
                                if (contacts_svc_struct_get_value(contact, CTS_CF_NAME_VALUE, &contact_name_value) == CTS_SUCCESS) {    /*  set contact display name name */
-                                       em_core_mail_get_display_name(contact_name_value, &contact_display_name_from_contact_info);
+                                       emcore_get_mail_display_name(contact_name_value, &contact_display_name_from_contact_info);
                                        EM_DEBUG_LOG(">>> contact index[%d]", contact_index);
                                        EM_DEBUG_LOG(">>> contact display name[%s]", contact_display_name_from_contact_info);
 
@@ -1854,14 +1728,13 @@ static gint address_compare(gconstpointer a, gconstpointer b)
        return strcmp(recipients_list1->address, recipients_list2->address);
 }
 
-EXPORT_API GList *em_core_get_recipients_list(GList *old_recipients_list, char *full_address, int *err_code)
+INTERNAL_FUNC GList *emcore_get_recipients_list(GList *old_recipients_list, char *full_address, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
 
-       int i = 0, err;
+       int i = 0, err = EMF_ERROR_NONE;
        int contact_index = -1;
        int is_search = false;
-       
        char *address = NULL;
        char email_address[MAX_EMAIL_ADDRESS_LENGTH];
        char *display_name = NULL;
@@ -1900,7 +1773,7 @@ EXPORT_API GList *em_core_get_recipients_list(GList *old_recipients_list, char *
 
        if (!addr) {
                EM_DEBUG_EXCEPTION("rfc822_parse_adrlist failed...");
-               err = EM_STORAGE_ERROR_INVALID_PARAM;
+               err = EMF_ERROR_INVALID_PARAM;
                goto FINISH_OFF;
        }
 
@@ -1928,7 +1801,7 @@ EXPORT_API GList *em_core_get_recipients_list(GList *old_recipients_list, char *
                        contact_index = err;
                        if ((err = contacts_svc_get_contact(contact_index, &contact)) == CTS_SUCCESS) {
                                if (contacts_svc_struct_get_value(contact, CTS_CF_NAME_VALUE, &contact_name_value) == CTS_SUCCESS) {
-                                       em_core_mail_get_display_name(contact_name_value, &display_name);
+                                       emcore_get_mail_display_name(contact_name_value, &display_name);
                                        EM_DEBUG_LOG(">>> contact index[%d]", contact_index);
                                        EM_DEBUG_LOG(">>> contact display name[%s]", display_name);
 
@@ -2014,7 +1887,7 @@ FINISH_OFF:
        return new_recipients_list;                     
 }
 
-EXPORT_API int em_core_mail_get_address_info_list(int mail_id, emf_address_info_list_t **address_info_list, int *err_code)
+INTERNAL_FUNC int emcore_get_mail_address_info_list(int mail_id, emf_address_info_list_t **address_info_list, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("mail_id[%d], address_info_list[%p]", mail_id, address_info_list);
 
@@ -2022,7 +1895,7 @@ EXPORT_API int em_core_mail_get_address_info_list(int mail_id, emf_address_info_
        int failed = true;
        int contact_error;
 
-       emf_mail_tbl_t *mail = NULL;
+       emstorage_mail_tbl_t *mail = NULL;
        emf_address_info_list_t *p_address_info_list = NULL;
 
        if (mail_id <= 0 || !address_info_list) {
@@ -2032,10 +1905,10 @@ EXPORT_API int em_core_mail_get_address_info_list(int mail_id, emf_address_info_
        }
        
        /* get mail from mail table */
-       if (!em_storage_get_mail_by_id(mail_id, &mail, true, &err) || !mail) {
-               EM_DEBUG_EXCEPTION("em_storage_get_mail_by_id failed [%d]", err);
+       if (!emstorage_get_mail_by_id(mail_id, &mail, true, &err) || !mail) {
+               EM_DEBUG_EXCEPTION("emstorage_get_mail_by_id failed [%d]", err);
                
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+
                goto FINISH_OFF;
        }
 
@@ -2055,13 +1928,13 @@ EXPORT_API int em_core_mail_get_address_info_list(int mail_id, emf_address_info_
                goto FINISH_OFF;
        }
 
-       if (em_core_sync_address_info(EMF_ADDRESS_TYPE_FROM, mail->full_address_from, &p_address_info_list->from, &err))
+       if (emcore_sync_address_info(EMF_ADDRESS_TYPE_FROM, mail->full_address_from, &p_address_info_list->from, &err))
                failed = false;
-       if (em_core_sync_address_info(EMF_ADDRESS_TYPE_TO, mail->full_address_to, &p_address_info_list->to, &err))
+       if (emcore_sync_address_info(EMF_ADDRESS_TYPE_TO, mail->full_address_to, &p_address_info_list->to, &err))
                failed = false;
-       if (em_core_sync_address_info(EMF_ADDRESS_TYPE_CC, mail->full_address_cc, &p_address_info_list->cc, &err))
+       if (emcore_sync_address_info(EMF_ADDRESS_TYPE_CC, mail->full_address_cc, &p_address_info_list->cc, &err))
                failed = false;
-       if (em_core_sync_address_info(EMF_ADDRESS_TYPE_BCC, mail->full_address_bcc, &p_address_info_list->bcc, &err))
+       if (emcore_sync_address_info(EMF_ADDRESS_TYPE_BCC, mail->full_address_bcc, &p_address_info_list->bcc, &err))
                failed = false;
 
        if ((contact_error = contacts_svc_disconnect()) == CTS_SUCCESS)
@@ -2076,10 +1949,10 @@ FINISH_OFF:
        if (ret == true) 
                *address_info_list = p_address_info_list;
        else if (p_address_info_list != NULL)
-               em_storage_free_address_info_list(&p_address_info_list);
+               emstorage_free_address_info_list(&p_address_info_list);
 
        if (!mail)
-               em_storage_free_mail(&mail, 1, NULL);
+               emstorage_free_mail(&mail, 1, NULL);
 
        if (err_code != NULL)
                *err_code = err;
@@ -2088,555 +1961,163 @@ FINISH_OFF:
        return ret;
 }
 
-       
-
-/* description 
- *    get mail header from local mailbox
+/* description
+ *    get a mail data
  * arguments  
- *    mailbox  :  message no
- *    header  :  buffer to hold header information
+ *    input_mail_id     : [in]  mail id
+ *    output_mail_data  : [out] double pointer to hold mail data.
  * return  
- *    succeed  :  1
- *    fail  :  0
+ *    succeed  :  EMF_ERROR_NONE
+ *    fail     :  error code
  */
-int em_core_mail_get_info(int mail_id, emf_mail_info_t **info, int *err_code)
+INTERNAL_FUNC int emcore_get_mail_data(int input_mail_id, emf_mail_data_t **output_mail_data)
 {
-       EM_DEBUG_FUNC_BEGIN("mail_id[%d], info[%p], err_code[%p]", mail_id, info, err_code);
-       
-       int ret = false;
-       int error = EMF_ERROR_NONE;
+       EM_DEBUG_FUNC_BEGIN("input_mail_id[%d], output_mail_data[%p]", input_mail_id, output_mail_data);
        
-       emf_mail_info_t *temp_mail_info = NULL;
-       emf_mail_tbl_t *mail = NULL;
+       int             error = EMF_ERROR_NONE;
+       int             result_mail_count = 0;
+       char            conditional_clause_string[QUERY_SIZE] = { 0, };
+       emstorage_mail_tbl_t *result_mail_tbl = NULL;
        
-       if (!mail_id || !info)  {
-               EM_DEBUG_EXCEPTION("mail_id[%d], info[%p]", mail_id, info);
+       if (input_mail_id == 0 || !output_mail_data)  {
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
                error = EMF_ERROR_INVALID_PARAM;
                goto FINISH_OFF;
        }
+
+       SNPRINTF(conditional_clause_string, QUERY_SIZE, "WHERE mail_id = %d", input_mail_id);
        
-       /* get mail from mail table */
-       if (!em_storage_get_mail_by_id(mail_id, &mail, true, &error) || !mail)  {
-               EM_DEBUG_EXCEPTION("em_storage_get_mail_by_id failed [%d]", error);
-               error = em_storage_get_emf_error_from_em_storage_error(error);
+       if(!emstorage_query_mail_tbl(conditional_clause_string, true, &result_mail_tbl, &result_mail_count, &error)) {
+               EM_DEBUG_EXCEPTION("emstorage_query_mail_tbl falied [%d]", error);
                goto FINISH_OFF;
        }
-       
-       if (!em_core_mail_get_info_from_mail_tbl(&temp_mail_info, mail, &error))  {
-               EM_DEBUG_EXCEPTION("em_core_mail_get_info_from_mail_tbl failed [%d]", error);           
-               goto FINISH_OFF;
-       }       
 
-       ret = true;
+       if(!em_convert_mail_tbl_to_mail_data(result_mail_tbl, 1, output_mail_data, &error)) {
+               EM_DEBUG_EXCEPTION("em_convert_mail_tbl_to_mail_data falied [%d]", error);
+               goto FINISH_OFF;
+       }
        
 FINISH_OFF: 
-       if (ret == true)
-               *info = temp_mail_info;
-       else if (temp_mail_info != NULL) 
-               em_core_mail_info_free(&temp_mail_info, 1, NULL);
-       
-       if (mail != NULL)
-               em_storage_free_mail(&mail, 1, NULL);
-       
-       if (err_code != NULL)
-               *err_code = error;
+       if (result_mail_tbl)
+               emstorage_free_mail(&result_mail_tbl, result_mail_count, NULL);
+
+       EM_DEBUG_FUNC_END("error [%d]", error);
+       return error;
+}
+
+
+/* internal function */
+void emcore_free_body_sharep(void **p)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       EM_SAFE_FREE(*p);
        EM_DEBUG_FUNC_END();
-       return ret;
 }
 
-EXPORT_API int em_core_mail_get_info_from_mail_tbl(emf_mail_info_t **pp_mail_info, emf_mail_tbl_t *mail_tbl_data , int *err_code)
+int emcore_check_drm(emstorage_attachment_tbl_t *input_attachment_tb_data)
 {
-       EM_DEBUG_FUNC_BEGIN("pp_mail_info[%p], mail_tbl_data[%p], err_code[%p]", pp_mail_info, mail_tbl_data, err_code);
-       
-       int ret = false;
-       int error = EMF_ERROR_NONE;
-       emf_mail_info_t *p = NULL;
+       EM_DEBUG_FUNC_BEGIN();
+       int ret = 0;
+#ifdef __FEATURE_DRM__
+       drm_dcf_info_t  fileInfo;
 
-       if (!pp_mail_info || !mail_tbl_data)  {
-               EM_DEBUG_EXCEPTION("pp_mail_info[%p], mail_tbl_data[%p]", pp_mail_info, mail_tbl_data);
-               error = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
+       if (input_attachment_tb_data == NULL)
+               return ret;
 
-       /* memory allocate */
-       if (!(p = em_core_malloc(sizeof(emf_mail_info_t))))  {
-               EM_DEBUG_EXCEPTION("em_core_malloc failed...");
-               error = EMF_ERROR_OUT_OF_MEMORY;
-               goto FINISH_OFF;
+       if (drm_svc_is_drm_file (input_attachment_tb_data->attachment_path)) {
+               if (drm_svc_get_dcf_file_info (input_attachment_tb_data->attachment_path, &fileInfo) == DRM_RESULT_SUCCESS) {
+                       input_attachment_tb_data->attachment_drm_type = 0;
+                       EM_DEBUG_LOG ("fileInfo is [%d]", fileInfo.method);
+                       if (fileInfo.method != DRM_METHOD_UNDEFINED) {
+                               input_attachment_tb_data->attachment_drm_type = fileInfo.method;
+                               ret = 1;
+                       }
+               }
        }
-       
-       p->account_id = mail_tbl_data->account_id;
-       p->uid        = mail_tbl_data->mail_id;
-       p->sid        = EM_SAFE_STRDUP(mail_tbl_data->server_mail_id);
-       
-       /* mail_tbl_data download status */
-       if (mail_tbl_data->server_mail_status == 0 || mail_tbl_data->body_download_status == EMF_BODY_DOWNLOAD_STATUS_FULLY_DOWNLOADED)  {      
-               p->body_downloaded = EMF_BODY_DOWNLOAD_STATUS_FULLY_DOWNLOADED;
-               p->extra_flags.text_download_yn = EMF_BODY_DOWNLOAD_STATUS_FULLY_DOWNLOADED;
-       } 
-#ifdef __FEATURE_PARTIAL_BODY_DOWNLOAD__
-       else if (mail_tbl_data->body_download_status == EMF_BODY_DOWNLOAD_STATUS_PARTIALLY_DOWNLOADED) {
-               p->body_downloaded = EMF_BODY_DOWNLOAD_STATUS_PARTIALLY_DOWNLOADED;
-               p->extra_flags.text_download_yn = EMF_BODY_DOWNLOAD_STATUS_PARTIALLY_DOWNLOADED;
+       else {
+               EM_DEBUG_LOG("not DRM file %s", input_attachment_tb_data->attachment_path);
+               input_attachment_tb_data->attachment_drm_type = 0;
+               ret = 0;
        }
 #endif
-       else  {
-               p->body_downloaded = EMF_BODY_DOWNLOAD_STATUS_NONE; 
-               p->extra_flags.text_download_yn = EMF_BODY_DOWNLOAD_STATUS_NONE;
-       }
-       
-       /*  mail_tbl_data rfc822.size */
-       p->rfc822_size = mail_tbl_data->mail_size;
-       
-       /*  mail_tbl_data flags  */
-       if (!em_convert_mail_tbl_to_mail_flag(mail_tbl_data, &p->flags, &error))  {
-               EM_DEBUG_EXCEPTION("em_convert_mail_tbl_to_mail_flag failed [%d]", error);
-               goto FINISH_OFF;
-       }
-
-       /*  mail_tbl_data extra flag */
-       p->extra_flags.lock     = mail_tbl_data->lock_status;
-       p->extra_flags.priority = mail_tbl_data->priority;
-       p->extra_flags.report   = mail_tbl_data->report_status;
-       p->extra_flags.status   = mail_tbl_data->save_status;
-       p->flags.sticky         = mail_tbl_data->lock_status;
-       p->extra_flags.drm      = mail_tbl_data->DRM_status;
-       p->is_meeting_request   = mail_tbl_data->meeting_request_status;
-       ret = true;
-       
-FINISH_OFF: 
-       if (ret == true)
-               *pp_mail_info = p;
-       else if (p != NULL) 
-               em_core_mail_info_free(&p, 1, NULL);
-       
-       if (err_code != NULL)
-               *err_code = error;
        EM_DEBUG_FUNC_END();
        return ret;
 }
 
+
 /* description
- *    get a mail body from local mailbox
- *    mail body contain body text and attachment list.
+ *    get mail attachment from local mailbox
  * arguments  
- *    mailbox  :  mail box
- *    msgno  :  mail no
- *    mail  :  [out] double pointer to hold mail data. (mail info, mail header, mail body text and attachment list)
+ *    mailbox  :  server mailbox
+ *    mail_id  :  mai id to own attachment
+ *    attachment  :  the number string to be downloaded
+ *    callback  :  function callback. if NULL, ignored.
  * return  
- *    succeed  :  1
- *    fail  :  0
+ *     succeed  :  1
+ *     fail  :  0
  */
-EXPORT_API int em_core_mail_get_mail(int mail_id, emf_mail_t **mail, int *err_code)
+INTERNAL_FUNC int emcore_get_attachment_info(int mail_id, char *attachment_id_string, emf_attachment_info_t **attachment, int *err_code)
 {
-       EM_DEBUG_FUNC_BEGIN("mail_id[%d], mail[%p], err_code[%p]", mail_id, mail, err_code);
-       
-       int ret = false;
-       int error = EMF_ERROR_NONE;
-       
-       emf_mail_t *p = NULL;
-       
-       if (!mail_id || !mail)  {
-               EM_DEBUG_EXCEPTION("mail_id[%d], mail[%p]", mail_id, mail);
-               error = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
+       EM_DEBUG_FUNC_BEGIN("mail_id[%d], attachment_id_string[%p], attachment[%p], err_code[%p]", mail_id, attachment_id_string, attachment, err_code);
+
+       if (attachment == NULL || attachment_id_string == NULL)  {
+               EM_DEBUG_EXCEPTION("mail_id[%d], attachment_id_string[%p], attachment[%p]", mail_id, attachment_id_string, attachment);
+               if (err_code != NULL)
+                       *err_code = EMF_ERROR_INVALID_PARAM;
+               return false;
        }
        
-       /* memory allocate */
-       if (!(p = em_core_malloc(sizeof(emf_mail_t))))  {
-               EM_DEBUG_EXCEPTION("malloc falied...");
-               error = EMF_ERROR_OUT_OF_MEMORY;
-               goto FINISH_OFF;
-       }
-       memset(p, 0x00, sizeof(emf_mail_t));
+       int ret = false;
+       int err = EMF_ERROR_NONE;
+       emstorage_attachment_tbl_t *attachment_tbl = NULL;
+       int attachment_id = atoi(attachment_id_string);
        
-       /* get mail info */
-       if (!em_core_mail_get_info(mail_id, &p->info, &error))  {
-               EM_DEBUG_EXCEPTION("em_core_mail_get_info failed [%d]", error);
+       /* get attachment from attachment tbl */
+       if (!emstorage_get_attachment(mail_id, attachment_id, &attachment_tbl, true, &err) || !attachment_tbl)  {
+               EM_DEBUG_EXCEPTION("emstorage_get_attachment failed [%d]", err);
+
                goto FINISH_OFF;
        }
        
-       /* get mail header */
-       if (!em_core_mail_get_header(mail_id, &p->head, &error))  {
-               EM_DEBUG_EXCEPTION("em_core_mail_get_header failed [%d]", error);
+       *attachment = em_malloc(sizeof(emf_attachment_info_t));
+       if (!*attachment)  {
+               EM_DEBUG_EXCEPTION("malloc failed...");
+               err = EMF_ERROR_OUT_OF_MEMORY;
                goto FINISH_OFF;
        }
        
-       /* if body downloaded, get mail body */
-       EM_DEBUG_LOG("p->info->body_downloaded [%d]", p->info->body_downloaded);
-       
-       /* if (p->info->body_downloaded)  { */
-               if (!em_core_mail_get_body(mail_id, &p->body, &error))  {
-                       EM_DEBUG_EXCEPTION("em_core_mail_get_body failed [%d]", error);
-                       goto FINISH_OFF;
-               }
-       /* } */
-       
+       (*attachment)->attachment_id = attachment_id;
+       (*attachment)->name = attachment_tbl->attachment_name; attachment_tbl->attachment_name = NULL;
+       (*attachment)->size = attachment_tbl->attachment_size;
+       (*attachment)->downloaded = attachment_tbl->attachment_save_status;
+       (*attachment)->savename = attachment_tbl->attachment_path; attachment_tbl->attachment_path = NULL;
+       (*attachment)->drm = attachment_tbl->attachment_drm_type;
+       (*attachment)->inline_content = attachment_tbl->attachment_inline_content_status;
+       (*attachment)->next = NULL;
+
        ret = true;
-       
+
 FINISH_OFF: 
-       if (ret == true)
-               *mail = p;
-       else if (p != NULL)
-               em_core_mail_free(&p, 1, NULL);
+       if (attachment_tbl)
+               emstorage_free_attachment(&attachment_tbl, 1, NULL);
+
+       if (err_code)
+               *err_code = err;
        
-       if (err_code != NULL)
-               *err_code = error;
-       EM_DEBUG_FUNC_END();
        return ret;
 }
 
 /* description
- *    get a mail data
+ *    get mail attachment
  * arguments  
- *    input_mail_id     : [in]  mail id
- *    output_mail_data  : [out] double pointer to hold mail data.
+ *    input_mail_id           :  mail id to own attachment
+ *    output_attachment_data  :  result attahchment data
+ *    output_attachment_count :  result attahchment count
  * return  
- *    succeed  :  EMF_ERROR_NONE
- *    fail     :  error code
+ *     succeed : EMF_ERROR_NONE
+ *     fail    : error code
  */
-EXPORT_API int em_core_get_mail_data(int input_mail_id, emf_mail_data_t **output_mail_data)
-{
-       EM_DEBUG_FUNC_BEGIN("input_mail_id[%d], output_mail_data[%p]", input_mail_id, output_mail_data);
-       
-       int             error = EMF_ERROR_NONE;
-       int             result_mail_count = 0;
-       char            conditional_clause_string[QUERY_SIZE] = { 0, };
-       emf_mail_tbl_t *result_mail_tbl = NULL;
-       
-       if (input_mail_id == 0 || !output_mail_data)  {
-               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
-               error = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-
-       SNPRINTF(conditional_clause_string, QUERY_SIZE, "WHERE mail_id = %d", input_mail_id);
-       
-       if(!em_storage_query_mail_tbl(conditional_clause_string, true, &result_mail_tbl, &result_mail_count, &error)) {
-               EM_DEBUG_EXCEPTION("em_storage_query_mail_tbl falied [%d]", error);
-               goto FINISH_OFF;
-       }
-
-       if(!em_convert_mail_tbl_to_mail_data(result_mail_tbl, 1, output_mail_data, &error)) {
-               EM_DEBUG_EXCEPTION("em_convert_mail_tbl_to_mail_data falied [%d]", error);
-               goto FINISH_OFF;
-       }
-       
-FINISH_OFF: 
-       if (result_mail_tbl)
-               em_storage_free_mail(&result_mail_tbl, result_mail_count, NULL);
-       
-       EM_DEBUG_FUNC_END("error [%d]", error);
-       return error;
-}
-
-
-/* internal function */
-void 
-em_core_free_body_sharep(void **p)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       EM_SAFE_FREE(*p);
-       EM_DEBUG_FUNC_END();
-}
-
-/* description 
- *    get mail rfc822 size
- * arguments  
- *    mailbox  :  mailbox name
- *    msgno  :  mail sequence
- *    size  :  out body size
- * return  
- *    succeed  :  1
- *    fail  :  0
- */
-EXPORT_API int em_core_mail_get_size(/*emf_mailbox_t *mailbox, */ int mail_id, int *mail_size, int *err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("mail_id[%d], mail_size[%p], err_code[%p]", mail_id, mail_size, err_code);
-
-       int ret = false;
-       int err = EMF_ERROR_NONE;
-       emf_mail_tbl_t *mail = NULL;
-       
-       if (mail_size == NULL)  {
-               EM_DEBUG_EXCEPTION("mail_id[%d], mail_size[%p]", mail_id, mail_size);
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-
-       /* get mail from mail table */
-       if (!em_storage_get_mail_by_id(mail_id, &mail, true, &err) || !mail)  {
-               EM_DEBUG_EXCEPTION("em_storage_get_mail failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
-               goto FINISH_OFF;
-       }
-       
-       *mail_size = mail->mail_size;
-       
-       ret = true;
-       
-FINISH_OFF: 
-       if (mail != NULL)
-               em_storage_free_mail(&mail, 1, NULL);
-       
-       if (err_code != NULL)
-               *err_code = err;
-       EM_DEBUG_FUNC_END();
-       return ret;
-}
-
-/**
- * description 
- *    get mail body from local mailbox.
- *    if no body in local mailbox, return error.
- * arguments  
- *    mailbox  :  server mailbox
- *    mail_id  :  mai id to be downloaded
- *    callback  :  function callback. if NULL, ignored.
- * return  
- *     succeed  :  1
- *     fail  :  0
- */
-EXPORT_API int em_core_mail_get_body(int mail_id, emf_mail_body_t **body, int *err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("mail_id[%d], body[%p], err_code[%p]", mail_id, body, err_code);
-       
-       int ret = false;
-       int err = EMF_ERROR_NONE;
-       int count = EMF_ATTACHMENT_MAX_COUNT;
-       emf_mail_body_t *p_body = NULL;
-       emf_mail_tbl_t *mail = NULL;
-       emf_mail_attachment_tbl_t *attachment_tbl_list = NULL;
-       
-       /*  get mail from mail table */
-       if (!em_storage_get_mail_by_id(mail_id, &mail, true, &err) || !mail)  {
-               EM_DEBUG_EXCEPTION("em_storage_get_mail_by_id failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
-               goto FINISH_OFF;
-       }
-       
-       EM_DEBUG_LOG("file_path_plain [%s]", mail->file_path_plain);
-
-       /*
-       if (!mail->body_download_status)  {
-               EM_DEBUG_EXCEPTION("This mail body is not received.");
-               *body = NULL;
-               em_storage_free_mail(&mail, 1, NULL);
-               return true;
-       }
-       */
-
-       em_core_mail_get_body_from_mail_tbl(&p_body, mail, NULL);       
-       
-       /*  retrieve attachment info */
-       if ( (err = em_storage_get_attachment_list(mail_id, true, &attachment_tbl_list, &count)) != EM_STORAGE_ERROR_NONE ){
-               EM_DEBUG_EXCEPTION("em_storage_get_attachment_list failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
-               goto FINISH_OFF;
-       } 
-       else if (count)  {
-               emf_attachment_info_t **atch = &p_body->attachment;
-               int i;
-
-               EM_DEBUG_LOG("attchment count %d", count);
-               for (i = 0; i < count; i++)  {
-                       *atch = em_core_malloc(sizeof(emf_attachment_info_t));
-                       if (!(*atch))    {      
-                               EM_DEBUG_EXCEPTION("malloc failed...");
-                               err = EMF_ERROR_OUT_OF_MEMORY;
-                               goto FINISH_OFF;
-                       }
-                       em_core_mail_fill_attachment(*atch, &attachment_tbl_list[i]);                   
-                       atch = &(*atch)->next;
-               }
-       }
-       
-       p_body->attachment_num = count;
-       
-       ret = true;
-       
-FINISH_OFF: 
-       if (ret == true)
-               *body = p_body;
-       else if (p_body != NULL)
-               em_core_mail_body_free(&p_body, 1, NULL);
-       
-       if (attachment_tbl_list != NULL)
-               em_storage_free_attachment(&attachment_tbl_list, count, NULL);
-       
-       if (mail != NULL)
-               em_storage_free_mail(&mail, 1, NULL);                   
-       
-       if (err_code != NULL)
-               *err_code = err;
-       EM_DEBUG_FUNC_END();
-       return ret;
-}
-
-EXPORT_API int em_core_mail_get_body_from_mail_tbl(emf_mail_body_t **p_body, emf_mail_tbl_t *mail, int *err_code)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int ret = 0, err = EMF_ERROR_NONE;
-       emf_mail_body_t *temp_body = NULL;
-
-       if (!p_body || !mail) {
-               EM_DEBUG_EXCEPTION("Invalid parameter");
-               err = EMF_ERROR_OUT_OF_MEMORY;
-               goto FINISH_OFF;
-       }
-
-       temp_body = em_core_malloc(sizeof(emf_mail_body_t));
-
-       if (!temp_body)  {
-               EM_DEBUG_EXCEPTION("em_core_malloc failed...");
-               err = EMF_ERROR_OUT_OF_MEMORY;
-               goto FINISH_OFF;
-       }
-
-       temp_body->plain = EM_SAFE_STRDUP(mail->file_path_plain);
-       temp_body->html  = EM_SAFE_STRDUP(mail->file_path_html);
-
-       if (mail->file_path_plain && mail->file_path_plain[0] != NULL_CHAR)
-               temp_body->plain_charset = g_path_get_basename(mail->file_path_plain);
-       else
-               temp_body->plain_charset = NULL;
-
-       EM_DEBUG_LOG("temp_body->plain_charset [%s]", temp_body->plain_charset);
-
-       *p_body = temp_body;
-
-       ret = 1;
-FINISH_OFF: 
-
-       if (err_code)
-               *err_code = err;
-
-       EM_DEBUG_FUNC_END();
-       return ret;
-}
-       
-static void  
-em_core_mail_fill_attachment(emf_attachment_info_t *atch , emf_mail_attachment_tbl_t *attachment_tbl)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       if (!atch || !attachment_tbl)
-               return;
-       
-       atch->attachment_id = attachment_tbl->attachment_id;
-       atch->size = attachment_tbl->attachment_size;
-       atch->name = EM_SAFE_STRDUP(attachment_tbl->attachment_name); 
-       atch->downloaded = attachment_tbl->file_yn ? 1  :  0;  
-       atch->savename = EM_SAFE_STRDUP(attachment_tbl->attachment_path); 
-       atch->drm = attachment_tbl->flag2;
-       atch->inline_content = attachment_tbl->flag3;
-
-       EM_DEBUG_FUNC_END();
-}
-
-int em_core_check_drm(emf_mail_attachment_tbl_t *attachment)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int ret = 0;
-#ifdef __FEATURE_DRM__
-       drm_dcf_info_t  fileInfo;
-
-       if (attachment == NULL)
-               return ret;
-
-       if (drm_svc_is_drm_file (attachment->attachment_path)) {
-               if (drm_svc_get_dcf_file_info (attachment->attachment_path, &fileInfo) == DRM_RESULT_SUCCESS) {
-                       attachment->flag2 = 0;
-                       EM_DEBUG_LOG ("fileInfo is [%d]", fileInfo.method);
-                       if (fileInfo.method != DRM_METHOD_UNDEFINED) {
-                               attachment->flag2 = fileInfo.method;
-                               ret = 1;
-                       }
-               }
-       }
-       else {
-               EM_DEBUG_LOG("not DRM file %s", attachment->attachment_path);
-               attachment->flag2 = 0;
-               ret = 0;
-       }
-#endif
-       EM_DEBUG_FUNC_END();
-       return ret;
-}
-
-
-/* description 
- *    get mail attachment from local mailbox
- * arguments  
- *    mailbox  :  server mailbox
- *    mail_id  :  mai id to own attachment
- *    attachment  :  the number string to be downloaded
- *    callback  :  function callback. if NULL, ignored.
- * return  
- *     succeed  :  1
- *     fail  :  0
- */
-EXPORT_API int em_core_mail_get_attachment(int mail_id, char *attachment_id_string, emf_attachment_info_t **attachment, int *err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("mail_id[%d], attachment_id_string[%p], attachment[%p], err_code[%p]", mail_id, attachment_id_string, attachment, err_code);
-       
-       if (attachment == NULL || attachment_id_string == NULL)  {
-               EM_DEBUG_EXCEPTION("mail_id[%d], attachment_id_string[%p], attachment[%p]", mail_id, attachment_id_string, attachment);
-               if (err_code != NULL)
-                       *err_code = EMF_ERROR_INVALID_PARAM;
-               return false;
-       }
-       
-       int ret = false;
-       int err = EMF_ERROR_NONE;
-       emf_mail_attachment_tbl_t *attachment_tbl = NULL;
-       int attachment_id = atoi(attachment_id_string);
-       
-       /* get attachment from attachment tbl */
-       if (!em_storage_get_attachment(mail_id, attachment_id, &attachment_tbl, true, &err) || !attachment_tbl)  {
-               EM_DEBUG_EXCEPTION("em_storage_get_attachment failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
-               goto FINISH_OFF;
-       }
-       
-       *attachment = em_core_malloc(sizeof(emf_attachment_info_t));
-       if (!*attachment)  {    
-               EM_DEBUG_EXCEPTION("malloc failed...");
-               err = EMF_ERROR_OUT_OF_MEMORY;
-               goto FINISH_OFF;
-       }
-       
-       (*attachment)->attachment_id = attachment_id;
-       (*attachment)->name = attachment_tbl->attachment_name; attachment_tbl->attachment_name = NULL;
-       (*attachment)->size = attachment_tbl->attachment_size;
-       (*attachment)->downloaded = attachment_tbl->file_yn;
-       (*attachment)->savename = attachment_tbl->attachment_path; attachment_tbl->attachment_path = NULL;
-       (*attachment)->drm = attachment_tbl->flag2;
-       (*attachment)->inline_content = attachment_tbl->flag3;
-       (*attachment)->next = NULL;
-       
-       ret = true;
-       
-FINISH_OFF: 
-       if (attachment_tbl)
-               em_storage_free_attachment(&attachment_tbl, 1, NULL);
-       
-       if (err_code)
-               *err_code = err;
-       
-       return ret;
-}
-
-/* description 
- *    get mail attachment
- * arguments  
- *    input_mail_id           :  mail id to own attachment
- *    output_attachment_data  :  result attahchment data
- *    output_attachment_count :  result attahchment count
- * return  
- *     succeed : EMF_ERROR_NONE
- *     fail    : error code
- */
-EXPORT_API int em_core_get_attachment_data_list(int input_mail_id, emf_attachment_data_t **output_attachment_data, int *output_attachment_count)
+INTERNAL_FUNC int emcore_get_attachment_data_list(int input_mail_id, emf_attachment_data_t **output_attachment_data, int *output_attachment_count)
 {
        EM_DEBUG_FUNC_BEGIN("input_mail_id[%d], output_attachment_data[%p], output_attachment_count[%p]", input_mail_id, output_attachment_data, output_attachment_count);
        
@@ -2648,40 +2129,40 @@ EXPORT_API int em_core_get_attachment_data_list(int input_mail_id, emf_attachmen
        int                        i = 0;
        int                        err = EMF_ERROR_NONE;
        int                        attachment_tbl_count = 0;
-       emf_mail_attachment_tbl_t *attachment_tbl_list = NULL;
+       emstorage_attachment_tbl_t *attachment_tbl_list = NULL;
        emf_attachment_data_t     *temp_attachment_data = NULL;
        
        /* get attachment from attachment tbl */
-       if ( (err = em_storage_get_attachment_list(input_mail_id, true, &attachment_tbl_list, &attachment_tbl_count)) != EM_STORAGE_ERROR_NONE ){
-               EM_DEBUG_EXCEPTION("em_storage_get_attachment_list failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+       if ( (err = emstorage_get_attachment_list(input_mail_id, true, &attachment_tbl_list, &attachment_tbl_count)) != EMF_ERROR_NONE ){
+               EM_DEBUG_EXCEPTION("emstorage_get_attachment_list failed [%d]", err);
+
                goto FINISH_OFF;
        } 
 
        if (attachment_tbl_count)  {
                EM_DEBUG_LOG("attchment count %d", attachment_tbl_count);
-               
-               *output_attachment_data = em_core_malloc(sizeof(emf_attachment_data_t) * attachment_tbl_count);
+
+               *output_attachment_data = em_malloc(sizeof(emf_attachment_data_t) * attachment_tbl_count);
 
                if(*output_attachment_data == NULL) {
-                       EM_DEBUG_EXCEPTION("em_core_malloc failed");
+                       EM_DEBUG_EXCEPTION("em_malloc failed");
                        err = EMF_ERROR_OUT_OF_MEMORY;
                        goto FINISH_OFF;
                }
-               
+
                for (i = 0; i < attachment_tbl_count; i++)  {
                        temp_attachment_data = (*output_attachment_data) + i;
-               
+
                        temp_attachment_data->attachment_id         = attachment_tbl_list[i].attachment_id;
                        temp_attachment_data->attachment_name       = attachment_tbl_list[i].attachment_name; attachment_tbl_list[i].attachment_name = NULL;
                        temp_attachment_data->attachment_path       = attachment_tbl_list[i].attachment_path; attachment_tbl_list[i].attachment_path = NULL;
-                       temp_attachment_data->attachment_size       = attachment_tbl_list[i].attachment_size; 
+                       temp_attachment_data->attachment_size       = attachment_tbl_list[i].attachment_size;
                        temp_attachment_data->mail_id               = attachment_tbl_list[i].mail_id;
                        temp_attachment_data->account_id            = attachment_tbl_list[i].account_id;
                        temp_attachment_data->mailbox_name          = attachment_tbl_list[i].mailbox_name; attachment_tbl_list[i].mailbox_name = NULL;
-                       temp_attachment_data->save_status           = attachment_tbl_list[i].file_yn;
-                       temp_attachment_data->drm_status            = attachment_tbl_list[i].flag2;
-                       temp_attachment_data->inline_content_status = attachment_tbl_list[i].flag3;
+                       temp_attachment_data->save_status           = attachment_tbl_list[i].attachment_save_status;
+                       temp_attachment_data->drm_status            = attachment_tbl_list[i].attachment_drm_type;
+                       temp_attachment_data->inline_content_status = attachment_tbl_list[i].attachment_inline_content_status;
                }
        }
        
@@ -2690,30 +2171,30 @@ FINISH_OFF:
        *output_attachment_count = attachment_tbl_count;
 
        if (attachment_tbl_list)
-               em_storage_free_attachment(&attachment_tbl_list, attachment_tbl_count, NULL);
+               emstorage_free_attachment(&attachment_tbl_list, attachment_tbl_count, NULL);
        
        return err;
 }
 
 
-EXPORT_API int em_core_mail_download_attachment(int account_id, int mail_id, char *nth, int *err_code)
+INTERNAL_FUNC int emcore_download_attachment(int account_id, int mail_id, char *nth, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], mail_id[%d], nth[%p], err_code[%p]", account_id, mail_id, nth, err_code);
 
        int attachment_no = 0;
-       int err = EMF_ERROR_NONE; 
-       
+       int err = EMF_ERROR_NONE;
+
        if (mail_id < 1 || !nth)  {
                EM_DEBUG_EXCEPTION("mail_id[%d], nth[%p]",  mail_id, nth);
                err = EMF_ERROR_INVALID_PARAM;
-               
+
                if (err_code != NULL)
                        *err_code = err;
 
                if (nth)
                        attachment_no = atoi(nth);
 
-               em_storage_notify_network_event(NOTI_DOWNLOAD_ATTACH_FAIL, mail_id, 0, attachment_no, err);     
+               emstorage_notify_network_event(NOTI_DOWNLOAD_ATTACH_FAIL, mail_id, 0, attachment_no, err);
                return false;
        }
 
@@ -2721,19 +2202,19 @@ EXPORT_API int em_core_mail_download_attachment(int account_id, int mail_id, cha
        int status = EMF_DOWNLOAD_FAIL;
        MAILSTREAM *stream = NULL;
        BODY *mbody = NULL;
-       emf_mail_tbl_t *mail = NULL;
-       emf_mail_attachment_tbl_t *attachment = NULL;
+       emstorage_mail_tbl_t *mail = NULL;
+       emstorage_attachment_tbl_t *attachment = NULL;
        struct attachment_info *ai = NULL;
        struct _m_content_info *cnt_info = NULL;
        void *tmp_stream = NULL;
        char *s_uid = NULL, *server_mbox = NULL, buf[1024];
        int msg_no = 0;
-       emf_mail_attachment_tbl_t *attachment_list = NULL;
-       int current_attachment_no = 0;  
+       emstorage_attachment_tbl_t *attachment_list = NULL;
+       int current_attachment_no = 0;
        int attachment_count_to_be_downloaded = 0;              /*  how many attachments should be downloaded */
        int i = 0;
-       
-       if (!em_core_check_thread_status())  {
+
+       if (!emcore_check_thread_status())  {
                err = EMF_ERROR_CANCELLED;
                goto FINISH_OFF;
        }
@@ -2741,49 +2222,49 @@ EXPORT_API int em_core_mail_download_attachment(int account_id, int mail_id, cha
        only_body_download = false;
        
        /*  get mail from mail table. */
-       if (!em_storage_get_mail_by_id(mail_id, &mail, true, &err) || !mail)  {
-               EM_DEBUG_EXCEPTION("em_storage_get_mail_by_id failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+       if (!emstorage_get_mail_by_id(mail_id, &mail, true, &err) || !mail)  {
+               EM_DEBUG_EXCEPTION("emstorage_get_mail_by_id failed [%d]", err);
+
                goto FINISH_OFF;
        }
-       
+
        if (!mail->server_mail_status)  {
                EM_DEBUG_EXCEPTION("not synchronous mail...");
-               err = EMF_ERROR_INVALID_MAIL;   
+               err = EMF_ERROR_INVALID_MAIL;
                goto FINISH_OFF;
        }
        
-       attachment_no = atoi(nth);      
+       attachment_no = atoi(nth);
        if (attachment_no == 0) {       /*  download all attachments, nth starts from 1, not zero */
                /*  get attachment list from db */
                attachment_count_to_be_downloaded = EMF_ATTACHMENT_MAX_COUNT;
-               if ( (err = em_storage_get_attachment_list(mail_id, true, &attachment_list, &attachment_count_to_be_downloaded)) != EM_STORAGE_ERROR_NONE ){
-                       EM_DEBUG_EXCEPTION("em_storage_get_attachment_list failed [%d]", err);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+               if ( (err = emstorage_get_attachment_list(mail_id, true, &attachment_list, &attachment_count_to_be_downloaded)) != EMF_ERROR_NONE ){
+                       EM_DEBUG_EXCEPTION("emstorage_get_attachment_list failed [%d]", err);
+
                        goto FINISH_OFF;
                }
        }
        else {  /*  download only nth attachment */
                attachment_count_to_be_downloaded = 1;
-               if (!em_storage_get_attachment_nth(mail_id, attachment_no, &attachment_list, true, &err) || !attachment_list)  {
-                       EM_DEBUG_EXCEPTION("em_storage_get_attachment_nth failed [%d]", err);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+               if (!emstorage_get_attachment_nth(mail_id, attachment_no, &attachment_list, true, &err) || !attachment_list)  {
+                       EM_DEBUG_EXCEPTION("emstorage_get_attachment_nth failed [%d]", err);
+
                        goto FINISH_OFF;
                }
        }
        
-       if (!em_core_check_thread_status())  {
+       if (!emcore_check_thread_status())  {
                err = EMF_ERROR_CANCELLED;
                goto FINISH_OFF;
        }
        
        account_id              = mail->account_id;
-       s_uid                   = EM_SAFE_STRDUP(mail->server_mail_id); 
-       server_mbox     = EM_SAFE_STRDUP(mail->mailbox_name); 
-       
+       s_uid                   = EM_SAFE_STRDUP(mail->server_mail_id);
+       server_mbox     = EM_SAFE_STRDUP(mail->mailbox_name);
+
        /*  open mail server. */
-       if (!em_core_mailbox_open(account_id, server_mbox, (void **)&tmp_stream, &err) || !tmp_stream)  {
-               EM_DEBUG_EXCEPTION("em_core_mailbox_open failed [%d]", err);
+       if (!emcore_connect_to_remote_mailbox(account_id, server_mbox, (void **)&tmp_stream, &err) || !tmp_stream)  {
+               EM_DEBUG_EXCEPTION("emcore_connect_to_remote_mailbox failed [%d]", err);
                status = EMF_DOWNLOAD_CONNECTION_FAIL;
                goto FINISH_OFF;
        }
@@ -2798,51 +2279,52 @@ EXPORT_API int em_core_mail_download_attachment(int account_id, int mail_id, cha
                        current_attachment_no = i + 1;                  /*  attachment no */
                else                                                                            /*  download only nth attachment */
                        current_attachment_no = attachment_no;  /*  attachment no */
-                               
-               if (!em_core_check_thread_status())  {
+
+               if (!emcore_check_thread_status())  {
                        err = EMF_ERROR_CANCELLED;
                        goto FINISH_OFF;
                }
                
-               if (!(cnt_info = em_core_malloc(sizeof(struct _m_content_info))))  {
+               if (!(cnt_info = em_malloc(sizeof(struct _m_content_info))))  {
                        EM_DEBUG_EXCEPTION("malloc failed...");
                        err = EMF_ERROR_OUT_OF_MEMORY;
                        goto FINISH_OFF;
                }
                
-               cnt_info->grab_type = GRAB_TYPE_ATTACHMENT;             /*  attachment */
-               cnt_info->file_no = current_attachment_no;              /*  attachment no */
-               
+               cnt_info->grab_type = GRAB_TYPE_ATTACHMENT;     /*  attachment */
+               cnt_info->file_no   = current_attachment_no;    /*  attachment no */
+
 #ifdef CHANGE_HTML_BODY_TO_ATTACHMENT
                /*  text/html be changed to attachment, this isn't real attachment in RFC822. */
-               if (html_changed) cnt_info->file_no--;       
+               if (html_changed)
+                       cnt_info->file_no--;
 #endif
-       
+
                /*  set sparep(member of BODY) memory free function. */
-               mail_parameters(stream, SET_FREEBODYSPAREP, em_core_free_body_sharep);
+               mail_parameters(stream, SET_FREEBODYSPAREP, emcore_free_body_sharep);
                
-               if (!em_core_check_thread_status()) {
+               if (!emcore_check_thread_status()) {
                        err = EMF_ERROR_CANCELLED;
                        goto FINISH_OFF;
                }
-               
+
                msg_no = atoi(s_uid);
 
                /*  get body structure. */
                /*  don't free mbody because mbody is freed in closing mail_stream. */
-               if ((!stream) || em_core_get_body_structure(stream, msg_no, &mbody, &err) < 0)  {       
-                       EM_DEBUG_EXCEPTION("em_core_get_body_structure failed [%d]", err);
+               if ((!stream) || emcore_get_body_structure(stream, msg_no, &mbody, &err) < 0)  {
+                       EM_DEBUG_EXCEPTION("emcore_get_body_structure failed [%d]", err);
                        goto FINISH_OFF;
                }
-               
-               if (!em_core_check_thread_status())  {
+
+               if (!emcore_check_thread_status())  {
                        err = EMF_ERROR_CANCELLED;
                        goto FINISH_OFF;
                }
-               
+
                /*  set body fetch section. */
-               if (em_core_set_fetch_body_section(mbody, false, NULL,  &err) < 0) {
-                       EM_DEBUG_EXCEPTION("em_core_set_fetch_body_section failed [%d]", err);
+               if (emcore_set_fetch_body_section(mbody, false, NULL,  &err) < 0) {
+                       EM_DEBUG_EXCEPTION("emcore_set_fetch_body_section failed [%d]", err);
                        goto FINISH_OFF;
                }
        
@@ -2853,12 +2335,12 @@ EXPORT_API int em_core_mail_download_attachment(int account_id, int mail_id, cha
                _imap4_download_noti_interval_value = 0;        /*  This will be assigned in imap_mail_write_body_to_file() */
 
                EM_DEBUG_LOG("cnt_info->file_no[%d], current_attachment_no[%d]", cnt_info->file_no, current_attachment_no);
-               if (em_core_get_body(stream, account_id, mail_id, msg_no, mbody, cnt_info, &err) < 0)  {
-                       EM_DEBUG_EXCEPTION("em_core_get_body failed [%d]", err);
+               if (emcore_get_body(stream, account_id, mail_id, msg_no, mbody, cnt_info, &err) < 0)  {
+                       EM_DEBUG_EXCEPTION("emcore_get_body failed [%d]", err);
                        goto FINISH_OFF;
                }
-               
-               if (!em_core_check_thread_status())  {
+
+               if (!emcore_check_thread_status())  {
                        err = EMF_ERROR_CANCELLED;
                        goto FINISH_OFF;
                }
@@ -2867,8 +2349,8 @@ EXPORT_API int em_core_mail_download_attachment(int account_id, int mail_id, cha
                for (ai = cnt_info->file ; ai; ai = ai->next) {
                        if (ai->name)
                                EM_DEBUG_LOG("[in loop] %s, %d",  ai->name, cnt_info->file_no);
-       
-                       if (--cnt_info->file_no == 0) 
+
+                       if (--cnt_info->file_no == 0)
                                break;
                }
 
@@ -2876,84 +2358,84 @@ EXPORT_API int em_core_mail_download_attachment(int account_id, int mail_id, cha
                
                if (cnt_info->file_no == 0 && ai) {
                        /*  rename temporary file to real file. */
-                       if (!em_storage_create_dir(account_id, mail_id, current_attachment_no, &err))  {
-                               EM_DEBUG_EXCEPTION("em_storage_create_dir failed [%d]", err);
+                       if (!emstorage_create_dir(account_id, mail_id, current_attachment_no, &err))  {
+                               EM_DEBUG_EXCEPTION("emstorage_create_dir failed [%d]", err);
                                goto FINISH_OFF;
                        }
-                       
-                       if (!em_storage_get_save_name(account_id, mail_id, current_attachment_no, ai->name, buf, &err))  {
-                               EM_DEBUG_EXCEPTION("em_storage_get_save_name failed [%d]", err);
+
+                       if (!emstorage_get_save_name(account_id, mail_id, current_attachment_no, ai->name, buf, &err))  {
+                               EM_DEBUG_EXCEPTION("emstorage_get_save_name failed [%d]", err);
                                goto FINISH_OFF;
                        }
-                       
-                       if (!em_storage_move_file(ai->save, buf, false, &err))  {
-                               EM_DEBUG_EXCEPTION("em_storage_move_file failed [%d]", err);
-                               err = em_storage_get_emf_error_from_em_storage_error(err);
+
+                       if (!emstorage_move_file(ai->save, buf, false, &err))  {
+                               EM_DEBUG_EXCEPTION("emstorage_move_file failed [%d]", err);
+
                                goto FINISH_OFF;
                        }
-                       
+
                        EM_SAFE_FREE(ai->save);
-                       
+
                        EM_DEBUG_LOG("ai->size [%d]", ai->size);
                        attachment->attachment_size = ai->size;
                        attachment->attachment_path = EM_SAFE_STRDUP(buf);
-       
+
                        /*  update attachment information. */
-                       if (!em_storage_change_attachment_field(mail_id, UPDATE_SAVENAME, attachment, true, &err))  {
-                               EM_DEBUG_EXCEPTION("em_storage_change_attachment_field failed [%d]", err);
+                       if (!emstorage_change_attachment_field(mail_id, UPDATE_SAVENAME, attachment, true, &err))  {
+                               EM_DEBUG_EXCEPTION("emstorage_change_attachment_field failed [%d]", err);
                                /*  delete created file. */
                                remove(buf);
-                               err = em_storage_get_emf_error_from_em_storage_error(err);
+
                                goto FINISH_OFF;
                        }
-               
-#ifdef __FEATURE_DRM__         
-                       if (em_core_check_drm(attachment))  {   /*  has drm attachment ? */
-                               if (drm_svc_register_file(attachment->attachment_path) == DRM_RESULT_SUCCESS) 
-                                       EM_DEBUG_LOG("drm_svc_register_file success");  
-                               else 
+
+#ifdef __FEATURE_DRM__
+                       if (emcore_check_drm(attachment))  {    /*  has drm attachment ? */
+                               if (drm_svc_register_file(attachment->attachment_path) == DRM_RESULT_SUCCESS)
+                                       EM_DEBUG_LOG("drm_svc_register_file success");
+                               else
                                        EM_DEBUG_EXCEPTION("drm_svc_register_file fail");
-                               mail->DRM_status = attachment->flag2;
+                               mail->DRM_status = attachment->attachment_drm_type;
                        }
 #endif /* __FEATURE_DRM__ */
                }
                else  {
                        EM_DEBUG_EXCEPTION("invalid attachment sequence...");
-                       err = EMF_ERROR_INVALID_ATTACHMENT;             
+                       err = EMF_ERROR_INVALID_ATTACHMENT;
                        goto FINISH_OFF;
                }
        
                if (cnt_info)  {
-                       em_core_mime_free_content_info(cnt_info);               
+                       emcore_free_content_info(cnt_info);
                        cnt_info = NULL;
                }
                EM_DEBUG_LOG(" >>>>>> Attachment Downloading [%d / %d] completed", i+1, attachment_count_to_be_downloaded);
        }
 
        if (stream)  {
-               em_core_mailbox_close(0, stream);                               
-               stream = NULL;  
+               emcore_close_mailbox(0, stream);
+               stream = NULL;
        }
        
        ret = true;
        
-FINISH_OFF: 
-       if (stream) 
-               em_core_mailbox_close(account_id, stream);
-       if (attachment_list) 
-               em_storage_free_attachment(&attachment_list, attachment_count_to_be_downloaded, NULL);
-       if (cnt_info) 
-               em_core_mime_free_content_info(cnt_info);
-       if (mail) 
-               em_storage_free_mail(&mail, 1, NULL);
+FINISH_OFF:
+       if (stream)
+               emcore_close_mailbox(account_id, stream);
+       if (attachment_list)
+               emstorage_free_attachment(&attachment_list, attachment_count_to_be_downloaded, NULL);
+       if (cnt_info)
+               emcore_free_content_info(cnt_info);
+       if (mail)
+               emstorage_free_mail(&mail, 1, NULL);
 
        EM_SAFE_FREE(s_uid);
        EM_SAFE_FREE(server_mbox);
 
        if (ret == true)
-               em_storage_notify_network_event(NOTI_DOWNLOAD_ATTACH_FINISH, mail_id, NULL, attachment_no, 0);
+               emstorage_notify_network_event(NOTI_DOWNLOAD_ATTACH_FINISH, mail_id, NULL, attachment_no, 0);
        else
-               em_storage_notify_network_event(NOTI_DOWNLOAD_ATTACH_FAIL, mail_id, NULL, attachment_no, err);
+               emstorage_notify_network_event(NOTI_DOWNLOAD_ATTACH_FAIL, mail_id, NULL, attachment_no, err);
 
        if (err_code != NULL)
                *err_code = err;
@@ -2963,7 +2445,7 @@ FINISH_OFF:
 }
 
 #ifdef __ATTACHMENT_OPTI__
-EXPORT_API int em_core_mail_download_attachment_bulk(int account_id, int mail_id, char *nth, int *err_code)
+INTERNAL_FUNC int emcore_download_attachment_bulk(int account_id, int mail_id, char *nth, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], mail_id[%d], nth[%p], err_code[%p]", account_id, mail_id, nth, err_code);
 
@@ -2972,12 +2454,12 @@ EXPORT_API int em_core_mail_download_attachment_bulk(int account_id, int mail_id
        int ret = false;
        int status = EMF_DOWNLOAD_FAIL;
        MAILSTREAM *stream = NULL;
-       emf_mail_tbl_t *mail = NULL;
-       emf_mail_attachment_tbl_t *attachment = NULL;
+       emstorage_mail_tbl_t *mail = NULL;
+       emstorage_attachment_tbl_t *attachment = NULL;
        void *tmp_stream = NULL;
        char *s_uid = NULL, *server_mbox = NULL, buf[512];
-       emf_mail_attachment_tbl_t *attachment_list = NULL;
-       int current_attachment_no = 0;  
+       emstorage_attachment_tbl_t *attachment_list = NULL;
+       int current_attachment_no = 0;
        int attachment_count_to_be_downloaded = 0;              /*  how many attachments should be downloaded */
        int i = 0;
        char *savefile = NULL;
@@ -3002,19 +2484,19 @@ EXPORT_API int em_core_mail_download_attachment_bulk(int account_id, int mail_id
                EM_DEBUG_EXCEPTION("account_id[%d], mail_id[%d], nth[%p]", account_id, mail_id, nth);
 
                err = EMF_ERROR_INVALID_PARAM;
-               
+
                if (err_code != NULL)
                        *err_code = err;
 
                if (nth)
                        attachment_no = atoi(nth);
 
-               em_storage_notify_network_event(NOTI_DOWNLOAD_ATTACH_FAIL, mail_id, 0, attachment_no, err);     /*  090525, kwangryul.baek */
-               
+               emstorage_notify_network_event(NOTI_DOWNLOAD_ATTACH_FAIL, mail_id, 0, attachment_no, err);      /*  090525, kwangryul.baek */
+
                return false;
        }
        
-       if (!em_core_check_thread_status()) {
+       if (!emcore_check_thread_status()) {
                err = EMF_ERROR_CANCELLED;
                goto FINISH_OFF;
        }
@@ -3022,85 +2504,85 @@ EXPORT_API int em_core_mail_download_attachment_bulk(int account_id, int mail_id
        
        attachment_no = atoi(nth);
 
-       if (attachment_no == 0) {       
+       if (attachment_no == 0) {
                /*  download all attachments, nth starts from 1, not zero */
                /*  get attachment list from db */
                attachment_count_to_be_downloaded = EMF_ATTACHMENT_MAX_COUNT;
-               if ( (err = em_storage_get_attachment_list(mail_id, true, &attachment_list, &attachment_count_to_be_downloaded)) != EM_STORAGE_ERROR_NONE || !attachment_list){
-                       EM_DEBUG_EXCEPTION("em_storage_get_attachment_list failed [%d]", err);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+               if ( (err = emstorage_get_attachment_list(mail_id, true, &attachment_list, &attachment_count_to_be_downloaded)) != EMF_ERROR_NONE || !attachment_list){
+                       EM_DEBUG_EXCEPTION("emstorage_get_attachment_list failed [%d]", err);
+       
                        goto FINISH_OFF;
                }
        }
        else {  /*  download only nth attachment */
                attachment_count_to_be_downloaded = 1;
-               if (!em_storage_get_attachment_nth(mail_id, attachment_no, &attachment_list, true, &err) || !attachment_list) {
-                       EM_DEBUG_EXCEPTION("em_storage_get_attachment_nth failed [%d]", err);
-                       
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+               if (!emstorage_get_attachment_nth(mail_id, attachment_no, &attachment_list, true, &err) || !attachment_list) {
+                       EM_DEBUG_EXCEPTION("emstorage_get_attachment_nth failed [%d]", err);
+
+
                        goto FINISH_OFF;
                }
        }
-       
-       
-       if (!em_core_check_thread_status()) {
+
+
+       if (!emcore_check_thread_status()) {
                err = EMF_ERROR_CANCELLED;
                goto FINISH_OFF;
        }
 
        
        /*  get mail from mail table. */
-       if (!em_storage_get_mail_by_id(mail_id, &mail, true, &err) || !mail) {
-               EM_DEBUG_EXCEPTION("em_storage_get_mail_by_id failed [%d]", err);
+       if (!emstorage_get_mail_by_id(mail_id, &mail, true, &err) || !mail) {
+               EM_DEBUG_EXCEPTION("emstorage_get_mail_by_id failed [%d]", err);
                
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+
                goto FINISH_OFF;
        }
-       
+
        /* if (!mail->server_mail_yn || !mail->text_download_yn) {*/ /*  faizan.h@samsung.com */
-       
-       if (!em_core_check_thread_status()) {
+
+       if (!emcore_check_thread_status()) {
                err = EMF_ERROR_CANCELLED;
                goto FINISH_OFF;
        }
-       
+
        account_id = mail->account_id;
        s_uid = EM_SAFE_STRDUP(mail->server_mail_id); mail->server_mail_id = NULL;
        server_mbox = EM_SAFE_STRDUP(mail->mailbox); mail->server_mailbox_name = NULL;
 
-       
-       
+
+
        /*  open mail server. */
-       if (!em_core_mailbox_open(account_id, server_mbox, (void **)&tmp_stream, &err) || !tmp_stream) {
-               EM_DEBUG_EXCEPTION("em_core_mailbox_open failed [%d]", err);
-               
+       if (!emcore_connect_to_remote_mailbox(account_id, server_mbox, (void **)&tmp_stream, &err) || !tmp_stream) {
+               EM_DEBUG_EXCEPTION("emcore_connect_to_remote_mailbox failed [%d]", err);
+
                status = EMF_DOWNLOAD_CONNECTION_FAIL;
                goto FINISH_OFF;
        }
-       
+
        stream = (MAILSTREAM *)tmp_stream;
-       
-       
-       if (!em_core_check_thread_status()) {
+
+
+       if (!emcore_check_thread_status()) {
                err = EMF_ERROR_CANCELLED;
                goto FINISH_OFF;
        }
 
-       
+
        for (i = 0; i < attachment_count_to_be_downloaded; i++) {
                EM_DEBUG_LOG(" >>>>>> Attachment Downloading [%d / %d] start", i+1, attachment_count_to_be_downloaded);
 
                attachment = attachment_list + i;
-               if (attachment_no == 0) {       
+               if (attachment_no == 0) {
                        /*  download all attachments, nth starts from 1, not zero */
                        current_attachment_no = i + 1;          /*  attachment no */
                }
-               else {  
+               else {
                        /*  download only nth attachment */
                        current_attachment_no = attachment_no;          /*  attachment no */
                }
-                               
-               if (!em_core_check_thread_status()) {
+
+               if (!emcore_check_thread_status()) {
                        err = EMF_ERROR_CANCELLED;
                        goto FINISH_OFF;
                }
@@ -3112,79 +2594,79 @@ EXPORT_API int em_core_mail_download_attachment_bulk(int account_id, int mail_id
 
                
                EM_SAFE_FREE(savefile);
-               if (!em_core_get_temp_file_name(&savefile, &err)) {
-                       EM_DEBUG_EXCEPTION("em_core_get_temp_file_name failed [%d]", err);              
-                       
-                       if (err_code != NULL) 
+               if (!emcore_get_temp_file_name(&savefile, &err)) {
+                       EM_DEBUG_EXCEPTION("emcore_get_temp_file_name failed [%d]", err);
+
+                       if (err_code != NULL)
                                *err_code = err;
                        goto FINISH_OFF;
                }
-                       
-               if (s_uid) 
+
+               if (s_uid)
                        uid = atoi(s_uid);
 
                EM_DEBUG_LOG("uid [%d]", uid);
-               
+
                if (!imap_mail_write_body_to_file(stream, account_id, mail_id, attachment_no, savefile, uid , attachment->section, attachment->encoding, &dec_len, NULL, &err)) {
                        EM_DEBUG_EXCEPTION("imap_mail_write_body_to_file failed [%d]", err);
-                       if (err_code != NULL) 
+                       if (err_code != NULL)
                                *err_code = err;
                        goto FINISH_OFF;
                }
 
-#ifdef SUPPORT_EXTERNAL_MEMORY 
-               iActualSize = em_core_get_actual_mail_size (cnt_info->text.plain , cnt_info->text.html, cnt_info->file , &err);
-               if (!em_storage_mail_check_free_space(iActualSize, &bIs_full, &err)) {
-                       EM_DEBUG_EXCEPTION("em_storage_mail_check_free_space failed [%d]", err);
+#ifdef SUPPORT_EXTERNAL_MEMORY
+               iActualSize = emcore_get_actual_mail_size (cnt_info->text.plain , cnt_info->text.html, cnt_info->file , &err);
+               if (!emstorage_mail_check_free_space(iActualSize, &bIs_full, &err)) {
+                       EM_DEBUG_EXCEPTION("emstorage_mail_check_free_space failed [%d]", err);
                        goto FINISH_OFF;
                }
                
                if (bIs_full) {
                        /* If external memory not present, return error */
-                       if (PS_MMC_REMOVED == em_storage_get_mmc_status()) {
+                       if (PS_MMC_REMOVED == emstorage_get_mmc_status()) {
                                err = EMF_ERROR_MAIL_MEMORY_FULL;
                                goto FINISH_OFF;
-                       }               
+                       }
                        bIsAdd_to_mmc = true;
                }
 #endif /*  SUPPORT_EXTERNAL_MEMORY */
 
-               if (!em_storage_create_dir(account_id, mail_id, attachment_no, &err)) {
-                       EM_DEBUG_EXCEPTION("em_storage_create_dir failed [%d]", err);
+               if (!emstorage_create_dir(account_id, mail_id, attachment_no, &err)) {
+                       EM_DEBUG_EXCEPTION("emstorage_create_dir failed [%d]", err);
                        goto FINISH_OFF;
                }
 
-               if (!em_storage_get_save_name(account_id, mail_id, attachment_no, attachment->name, buf, &err)) {
-                       EM_DEBUG_EXCEPTION("em_storage_get_save_name failed [%d]", err);
+               if (!emstorage_get_save_name(account_id, mail_id, attachment_no, attachment->name, buf, &err)) {
+                       EM_DEBUG_EXCEPTION("emstorage_get_save_name failed [%d]", err);
                        goto FINISH_OFF;
                }
 
-               if (!em_storage_move_file(savefile, buf, false, &err)) {
-                       EM_DEBUG_EXCEPTION("em_storage_move_file failed [%d]", err);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+               if (!emstorage_move_file(savefile, buf, false, &err)) {
+                       EM_DEBUG_EXCEPTION("emstorage_move_file failed [%d]", err);
+
                        goto FINISH_OFF;
                }
 
                attachment->attachment = EM_SAFE_STRDUP(buf);
                /*  update attachment information. */
-               if (!em_storage_change_attachment_field(mail_id, UPDATE_SAVENAME, attachment, true, &err)) {
-                       EM_DEBUG_EXCEPTION("em_storage_change_attachment_field failed [%d]", err);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+               if (!emstorage_change_attachment_field(mail_id, UPDATE_SAVENAME, attachment, true, &err)) {
+                       EM_DEBUG_EXCEPTION("emstorage_change_attachment_field failed [%d]", err);
+
                        goto FINISH_OFF;
                }
-                       
-#ifdef __FEATURE_DRM__         
-               if (em_core_check_drm(attachment)) {            
+
+#ifdef __FEATURE_DRM__
+               if (emcore_check_drm(attachment)) {
                        /*  is drm */
                        if (drm_svc_register_file(attachment->attachment) == DRM_RESULT_SUCCESS)
-                               EM_DEBUG_LOG("drm_svc_register_file success");  
-                       else 
+                               EM_DEBUG_LOG("drm_svc_register_file success");
+                       else
                                EM_DEBUG_EXCEPTION("drm_svc_register_file fail");
                        mail->flag3 = attachment->flag2;
                }
 #endif /* __FEATURE_DRM__ */
 
-               if (!em_core_check_thread_status()) {
+               if (!emcore_check_thread_status()) {
                        err = EMF_ERROR_CANCELLED;
                        goto FINISH_OFF;
                }
@@ -3194,29 +2676,29 @@ EXPORT_API int em_core_mail_download_attachment_bulk(int account_id, int mail_id
 
        ret = true;
 
-       FINISH_OFF: 
+       FINISH_OFF:
 
        EM_SAFE_FREE(savefile);
 
-       em_core_mailbox_close(0, stream);                               
-       stream = NULL;  
+       emcore_close_mailbox(0, stream);
+       stream = NULL;
 
        if (attachment_list) 
-               em_storage_free_attachment(&attachment_list, attachment_count_to_be_downloaded, NULL);
+               emstorage_free_attachment(&attachment_list, attachment_count_to_be_downloaded, NULL);
 
        if (mail) 
-               em_storage_free_mail(&mail, 1, NULL);
+               emstorage_free_mail(&mail, 1, NULL);
 
-       if (s_uid) 
+       if (s_uid)
                free(s_uid);
 
-       if (server_mbox) 
+       if (server_mbox)
                free(server_mbox);server_mbox = NULL;
 
        if (ret == true)
-               em_storage_notify_network_event(NOTI_DOWNLOAD_ATTACH_FINISH, mail_id, NULL, attachment_no, 0);
+               emstorage_notify_network_event(NOTI_DOWNLOAD_ATTACH_FINISH, mail_id, NULL, attachment_no, 0);
        else if (err != EMF_ERROR_CANCELLED)
-               em_storage_notify_network_event(NOTI_DOWNLOAD_ATTACH_FAIL, mail_id, NULL, attachment_no, err);
+               emstorage_notify_network_event(NOTI_DOWNLOAD_ATTACH_FAIL, mail_id, NULL, attachment_no, err);
 
        if (err_code != NULL)
                *err_code = err;
@@ -3226,10 +2708,10 @@ EXPORT_API int em_core_mail_download_attachment_bulk(int account_id, int mail_id
 #endif
 
 
-EXPORT_API int em_core_mail_download_body_multi_sections_bulk(void *mail_stream, int account_id, int mail_id, int verbose, int with_attach, int limited_size, int event_handle , int *err_code)
+INTERNAL_FUNC int emcore_download_body_multi_sections_bulk(void *mail_stream, int account_id, int mail_id, int verbose, int with_attach, int limited_size, int event_handle , int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("mail_stream[%p], account_id[%d], mail_id[%d], verbose[%d], with_attach[%d], event_handle [ %d ] ", mail_stream, account_id, mail_id, verbose, with_attach, event_handle);
-       
+
        int ret = false;
        int err = EMF_ERROR_NONE;
        int status = EMF_DOWNLOAD_FAIL;
@@ -3239,8 +2721,8 @@ EXPORT_API int em_core_mail_download_body_multi_sections_bulk(void *mail_stream,
        BODY *mbody = NULL;
        PARTLIST *section_list = NULL;
        emf_mailbox_t mbox = { 0 };
-       emf_mail_tbl_t *mail = NULL;
-       emf_mail_attachment_tbl_t attachment = {0, 0, NULL, };
+       emstorage_mail_tbl_t *mail = NULL;
+       emstorage_attachment_tbl_t attachment = {0, 0, NULL, };
        emf_account_t *ref_account = NULL;
        struct attachment_info *ai = NULL;
        struct _m_content_info *cnt_info = NULL;
@@ -3249,12 +2731,12 @@ EXPORT_API int em_core_mail_download_body_multi_sections_bulk(void *mail_stream,
        int msgno = 0, attachment_num = 1, local_attachment_count = 0, local_inline_content_count = 0;
        int iActualSize = 0;
        char html_body[MAX_PATH] = {0, };
-       em_core_uid_list *uid_list = NULL;
+       emcore_uid_list *uid_list = NULL;
        char *mailbox_name = NULL;
 #ifdef CHANGE_HTML_BODY_TO_ATTACHMENT
        int html_changed = 0;
 #endif
+
        if (mail_id < 1)  {
                EM_DEBUG_EXCEPTION("mail_stream[%p], account_id[%d], mail_id[%d], verbose[%d], with_attach[%d]", mail_stream, account_id, mail_id, verbose, with_attach);
                err = EMF_ERROR_INVALID_PARAM;
@@ -3262,17 +2744,17 @@ EXPORT_API int em_core_mail_download_body_multi_sections_bulk(void *mail_stream,
                if (err_code != NULL)
                        *err_code = err;
 
-               em_storage_notify_network_event(NOTI_DOWNLOAD_BODY_FAIL, mail_id, NULL, event_handle, err);
+               emstorage_notify_network_event(NOTI_DOWNLOAD_BODY_FAIL, mail_id, NULL, event_handle, err);
                return false;
        }
        
        FINISH_OFF_IF_CANCELED;
 
        only_body_download = true;
-       
-       if (!em_storage_get_mail_by_id(mail_id, &mail, true, &err) || !mail)  {
-               EM_DEBUG_EXCEPTION("em_storage_get_mail_by_id failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+
+       if (!emstorage_get_mail_by_id(mail_id, &mail, true, &err) || !mail)  {
+               EM_DEBUG_EXCEPTION("emstorage_get_mail_by_id failed [%d]", err);
+
                goto FINISH_OFF;
        }
        
@@ -3286,21 +2768,21 @@ EXPORT_API int em_core_mail_download_body_multi_sections_bulk(void *mail_stream,
        }
        
        account_id = mail->account_id;
-       s_uid                     = mail->server_mail_id; 
-       server_mbox               = mail->server_mailbox_name; 
+       s_uid                     = mail->server_mail_id;
+       server_mbox               = mail->server_mailbox_name;
        mail->server_mail_id      = NULL;
     mail->server_mailbox_name = NULL;
-       
+
        attachment.account_id = mail->account_id;
        attachment.mail_id = mail->mail_id;
-       attachment.mailbox_name = mail->mailbox_name; mail->mailbox_name = NULL;                
-       attachment.file_yn = 0;
+       attachment.mailbox_name = mail->mailbox_name; mail->mailbox_name = NULL;
+       attachment.attachment_save_status = 0;
        
-       em_storage_free_mail(&mail, 1, NULL); 
-       mail = NULL;    
+       emstorage_free_mail(&mail, 1, NULL);
+       mail = NULL;
        
-       if (!(ref_account = em_core_get_account_reference(account_id)))   {
-               EM_DEBUG_EXCEPTION("em_core_get_account_reference failed [%d]", account_id);
+       if (!(ref_account = emcore_get_account_reference(account_id)))   {
+               EM_DEBUG_EXCEPTION("emcore_get_account_reference failed [%d]", account_id);
                err = EMF_ERROR_INVALID_ACCOUNT;
                goto FINISH_OFF;
        }
@@ -3309,8 +2791,8 @@ EXPORT_API int em_core_mail_download_body_multi_sections_bulk(void *mail_stream,
 
        /*  open mail server. */
        if (!mail_stream)  {
-               if (!em_core_mailbox_open(account_id, mailbox_name, (void **)&tmp_stream, &err) || !tmp_stream)  {
-                       EM_DEBUG_EXCEPTION("em_core_mailbox_open failed [%d]", err);
+               if (!emcore_connect_to_remote_mailbox(account_id, mailbox_name, (void **)&tmp_stream, &err) || !tmp_stream)  {
+                       EM_DEBUG_EXCEPTION("emcore_connect_to_remote_mailbox failed [%d]", err);
                        status = EMF_DOWNLOAD_CONNECTION_FAIL;
                        goto FINISH_OFF;
                }
@@ -3324,8 +2806,8 @@ EXPORT_API int em_core_mail_download_body_multi_sections_bulk(void *mail_stream,
        
        FINISH_OFF_IF_CANCELED;
        
-       if (!(cnt_info = em_core_malloc(sizeof(struct _m_content_info))))  {
-               EM_DEBUG_EXCEPTION("em_core_malloc failed...");
+       if (!(cnt_info = em_malloc(sizeof(struct _m_content_info))))  {
+               EM_DEBUG_EXCEPTION("em_malloc failed...");
                err = EMF_ERROR_OUT_OF_MEMORY;
                goto FINISH_OFF;
        }
@@ -3333,27 +2815,27 @@ EXPORT_API int em_core_mail_download_body_multi_sections_bulk(void *mail_stream,
        if (ref_account->receiving_server_type == EMF_SERVER_TYPE_POP3)  {      /*  POP3 */
                /*  in POP3 case, both text and attachment are downloaded in this call. */
                cnt_info->grab_type = GRAB_TYPE_TEXT | GRAB_TYPE_ATTACHMENT;
-               attachment.file_yn = 1;         /*  all attachments should be downloaded in the case of POP3 */
-               
+               attachment.attachment_save_status = 1;          /*  all attachments should be downloaded in the case of POP3 */
+
                mbox.account_id = account_id;
                mbox.mail_stream = stream;
-               
+
                /*  download all uids from server. */
-               if (!em_core_mailbox_download_uid_all(&mbox, &uid_list, NULL, NULL, 0, EM_CORE_GET_UIDS_FOR_NO_DELETE, &err))  {
-                       EM_DEBUG_EXCEPTION("em_core_mailbox_download_uid_all failed [%d]", err);
+               if (!emcore_download_uid_all(&mbox, &uid_list, NULL, NULL, 0, EM_CORE_GET_UIDS_FOR_NO_DELETE, &err))  {
+                       EM_DEBUG_EXCEPTION("emcore_download_uid_all failed [%d]", err);
                        goto FINISH_OFF;
                }
-               
+
                /*  get mesg number to be related to last download mail from uid list file */
-               if (!em_core_mailbox_get_msgno(uid_list, s_uid, &msgno, &err))  {
-                       EM_DEBUG_EXCEPTION("em_core_mailbox_get_msgno failed [%d]", err);
+               if (!emcore_get_msgno(uid_list, s_uid, &msgno, &err))  {
+                       EM_DEBUG_EXCEPTION("emcore_get_msgno failed [%d]", err);
                        err = EMF_ERROR_MAIL_NOT_FOUND_ON_SERVER;
                        goto FINISH_OFF;
                }
-               
+
                free(s_uid); s_uid = NULL;
-               
-               if (!em_core_check_thread_status())  {
+
+               if (!emcore_check_thread_status())  {
                        err = EMF_ERROR_CANCELLED;
                        goto FINISH_OFF;
                }
@@ -3364,50 +2846,50 @@ EXPORT_API int em_core_mail_download_body_multi_sections_bulk(void *mail_stream,
                _pop3_receiving_mail_id = mail_id;
                
                /*  send read mail commnad. */
-               if (!em_core_mail_cmd_read_mail_pop3(stream, msgno, limited_size, &pop3_downloaded_size, &pop3_body_size, &err)) 
-               /* if (!em_core_mail_cmd_read_mail_pop3(stream, msgno, PARTIAL_BODY_SIZE_IN_BYTES, &pop3_downloaded_size, &pop3_body_size, &err))  */ {
-                       EM_DEBUG_EXCEPTION("em_core_mail_cmd_read_mail_pop3 failed [%d]", err);
+               if (!emcore_mail_cmd_read_mail_pop3(stream, msgno, limited_size, &pop3_downloaded_size, &pop3_body_size, &err))
+               /* if (!emcore_mail_cmd_read_mail_pop3(stream, msgno, PARTIAL_BODY_SIZE_IN_BYTES, &pop3_downloaded_size, &pop3_body_size, &err))  */ {
+                       EM_DEBUG_EXCEPTION("emcore_mail_cmd_read_mail_pop3 failed [%d]", err);
                        goto FINISH_OFF;
                }
 
                _pop3_total_body_size = pop3_body_size;
 
-               if (!em_storage_notify_network_event(NOTI_DOWNLOAD_BODY_START, mail_id, "dummy-file", _pop3_total_body_size, 0))
-                       EM_DEBUG_EXCEPTION(" em_storage_notify_network_event [ NOTI_DOWNLOAD_BODY_START] failed >>>> ");
+               if (!emstorage_notify_network_event(NOTI_DOWNLOAD_BODY_START, mail_id, "dummy-file", _pop3_total_body_size, 0))
+                       EM_DEBUG_EXCEPTION(" emstorage_notify_network_event [ NOTI_DOWNLOAD_BODY_START] failed >>>> ");
                else
                        EM_DEBUG_LOG("NOTI_DOWNLOAD_BODY_START notified (%d / %d)", 0, _pop3_total_body_size);
-               
+
                FINISH_OFF_IF_CANCELED;
                
                /*  save message into tempfile */
                /*  parsing mime from stream. */
 
-               if (!em_core_mime_parse_mime(stream, 0, cnt_info,  &err))  {
-                       EM_DEBUG_EXCEPTION("em_core_mime_parse_mime failed [%d]", err);
+               if (!emcore_parse_mime(stream, 0, cnt_info,  &err))  {
+                       EM_DEBUG_EXCEPTION("emcore_parse_mime failed [%d]", err);
                        goto FINISH_OFF;
                }
                
                FINISH_OFF_IF_CANCELED;
        }
        else  { /*  in IMAP case, both text and attachment list are downloaded in this call. */
-               /* if (ref_account->flag1 == 2) *//*  This flag is just for downloading mailbox.(sync header), don't be used when retrieve body. */
+               /*  This flag is just for downloading mailbox.(sync header), don't be used when retrieve body. */
                if (with_attach > 0)
                        cnt_info->grab_type = GRAB_TYPE_TEXT | GRAB_TYPE_ATTACHMENT;
                else
                        cnt_info->grab_type = GRAB_TYPE_TEXT;
-               
+
                int uid = atoi(s_uid);
-               
+
                free(s_uid); s_uid = NULL;
-               
+
                /*  set sparep(member of BODY) memory free function  */
-               mail_parameters(stream, SET_FREEBODYSPAREP, em_core_free_body_sharep);
-               
+               mail_parameters(stream, SET_FREEBODYSPAREP, emcore_free_body_sharep);
+
                /*  get body strucutre. */
                /*  don't free mbody because mbody is freed in closing mail_stream. */
-               if (em_core_get_body_structure(stream, uid, &mbody, &err) < 0 || (mbody == NULL))  {  
-                       EM_DEBUG_EXCEPTION("em_core_get_body_structure failed [%d]", err);
-                       err = EMF_ERROR_MAIL_NOT_FOUND_ON_SERVER;               
+               if (emcore_get_body_structure(stream, uid, &mbody, &err) < 0 || (mbody == NULL))  {
+                       EM_DEBUG_EXCEPTION("emcore_get_body_structure failed [%d]", err);
+                       err = EMF_ERROR_MAIL_NOT_FOUND_ON_SERVER;
                        goto FINISH_OFF;
                }
 
@@ -3422,7 +2904,7 @@ EXPORT_API int em_core_mail_download_body_multi_sections_bulk(void *mail_stream,
                        int is_attachment = 0;
                        while (part_child)  {
                                BODY *body = &(part_child->body);
-                               if (only_body_download == true) {       
+                               if (only_body_download == true) {
                                        if (((body->id) && strlen(body->id) > 1) || (body->location))
                                                is_attachment = 0;
                                        else if (body->disposition.type)  {     /*  "attachment" or "inline" or etc... */
@@ -3430,7 +2912,7 @@ EXPORT_API int em_core_mail_download_body_multi_sections_bulk(void *mail_stream,
 
                                        while (param)  {
                                                        EM_DEBUG_LOG("param->attribute [%s], param->value [%s]", param->attribute, param->value);
-                                                       
+
                                                if (!strcasecmp(param->attribute, "filename"))  {       /* attribute is "filename" */
                                                        strncpy(filename, param->value, MAX_PATH);
                                                        EM_DEBUG_LOG(">>>>> FILENAME [%s] ", filename);
@@ -3440,9 +2922,9 @@ EXPORT_API int em_core_mail_download_body_multi_sections_bulk(void *mail_stream,
                                        }
 
                                                is_attachment = 1;
-                                               
+
                                                if (!*filename)  {              /*  it may be report msg */
-                                                       if (body->disposition.type[0] == 'i' || body->disposition.type[0] == 'I')       
+                                                       if (body->disposition.type[0] == 'i' || body->disposition.type[0] == 'I')
                                                                is_attachment = 0;
                                                }
                                        }
@@ -3450,7 +2932,7 @@ EXPORT_API int em_core_mail_download_body_multi_sections_bulk(void *mail_stream,
                                        if (is_attachment == 0) {
                                                EM_DEBUG_LOG("%d :  body->size.bytes[%ld]", counter+1, body->size.bytes);
                                                multi_part_body_size = multi_part_body_size + body->size.bytes;
-                                       }       
+                                       }
                                }
                                else {  /*  download all */
                                EM_DEBUG_LOG("%d :  body->size.bytes[%ld]", counter+1, body->size.bytes);
@@ -3460,10 +2942,10 @@ EXPORT_API int em_core_mail_download_body_multi_sections_bulk(void *mail_stream,
                                counter++;
                        }
                }
-                               
+
                /*  set body fetch section. */
-               if (em_core_set_fetch_body_section(mbody, true, &iActualSize, &err) < 0) {
-                       EM_DEBUG_EXCEPTION("em_core_set_fetch_body_section failed [%d]", err);
+               if (emcore_set_fetch_body_section(mbody, true, &iActualSize, &err) < 0) {
+                       EM_DEBUG_EXCEPTION("emcore_set_fetch_body_section failed [%d]", err);
                        goto FINISH_OFF;
                }
 
@@ -3480,48 +2962,48 @@ EXPORT_API int em_core_mail_download_body_multi_sections_bulk(void *mail_stream,
                        _imap4_total_body_size = 0;                                     /*  This will be assigned in imap_mail_write_body_to_file() */
                        _imap4_download_noti_interval_value = 0;        /*  This will be assigned in imap_mail_write_body_to_file() */
                }
-       
+
                /*  save message into tempfile */
                /*  download body text and get attachment list. */
-               if (em_core_get_body_part_list_full(stream, uid, account_id, mail_id, mbody, cnt_info, &err, section_list, event_handle) < 0)  {
-                       EM_DEBUG_EXCEPTION("em_core_get_body falied [%d]", err);
+               if (emcore_get_body_part_list_full(stream, uid, account_id, mail_id, mbody, cnt_info, &err, section_list, event_handle) < 0)  {
+                       EM_DEBUG_EXCEPTION("emcore_get_body falied [%d]", err);
                        goto FINISH_OFF;
                }
                FINISH_OFF_IF_CANCELED;
        }
 
-       
-       if (false == em_storage_get_mail_by_id(mail_id, &mail, true, &err)) {
-               EM_DEBUG_EXCEPTION(" em_storage_get_mail_by_id failed [%d]", err);
+
+       if (false == emstorage_get_mail_by_id(mail_id, &mail, true, &err)) {
+               EM_DEBUG_EXCEPTION(" emstorage_get_mail_by_id failed [%d]", err);
                goto FINISH_OFF;
        }
 
        if (cnt_info->text.plain)  {
-               EM_DEBUG_LOG("cnt_info->text.plain [%s]", cnt_info->text.plain); 
+               EM_DEBUG_LOG("cnt_info->text.plain [%s]", cnt_info->text.plain);
 
-               if (!em_storage_create_dir(account_id, mail_id, 0, &err))  {
-                       EM_DEBUG_EXCEPTION("em_storage_create_dir failed [%d]", err);
+               if (!emstorage_create_dir(account_id, mail_id, 0, &err))  {
+                       EM_DEBUG_EXCEPTION("emstorage_create_dir failed [%d]", err);
                        goto FINISH_OFF;
                }
-               
-               
-               if (!em_storage_get_save_name(account_id, mail_id, 0, cnt_info->text.plain_charset ? cnt_info->text.plain_charset  :  "UTF-8", buf, &err))  {
-                       EM_DEBUG_EXCEPTION("em_storage_get_save_name failed [%d]", err);
+
+
+               if (!emstorage_get_save_name(account_id, mail_id, 0, cnt_info->text.plain_charset ? cnt_info->text.plain_charset  :  "UTF-8", buf, &err))  {
+                       EM_DEBUG_EXCEPTION("emstorage_get_save_name failed [%d]", err);
                        goto FINISH_OFF;
-               }               
+               }
 
-               if (!em_storage_move_file(cnt_info->text.plain, buf, false, &err))  {
-                       EM_DEBUG_EXCEPTION("em_storage_move_file failed [%d]", err);
+               if (!emstorage_move_file(cnt_info->text.plain, buf, false, &err))  {
+                       EM_DEBUG_EXCEPTION("emstorage_move_file failed [%d]", err);
                        goto FINISH_OFF;
                }
-               
+
                mail->file_path_plain = EM_SAFE_STRDUP(buf);
-               EM_DEBUG_LOG("mail->file_path_plain [%s]", mail->file_path_plain);
+               EM_DEBUG_LOG("mail->file_path_plain [%s]", mail->file_path_plain);
        }
        
        if (cnt_info->text.html)  {
-               if (!em_storage_create_dir(account_id, mail_id, 0, &err))  {
-                       EM_DEBUG_EXCEPTION("em_storage_create_dir failed [%d]", err);
+               if (!emstorage_create_dir(account_id, mail_id, 0, &err))  {
+                       EM_DEBUG_EXCEPTION("emstorage_create_dir failed [%d]", err);
                        goto FINISH_OFF;
                }
                
@@ -3532,13 +3014,13 @@ EXPORT_API int em_core_mail_download_body_multi_sections_bulk(void *mail_stream,
                else {
                        memcpy(html_body, "UTF-8.htm", strlen("UTF-8.htm"));
                }
-               if (!em_storage_get_save_name(account_id, mail_id, 0, html_body, buf, &err))  {
-                       EM_DEBUG_EXCEPTION("em_storage_get_save_name failed [%d]", err);
+               if (!emstorage_get_save_name(account_id, mail_id, 0, html_body, buf, &err))  {
+                       EM_DEBUG_EXCEPTION("emstorage_get_save_name failed [%d]", err);
                        goto FINISH_OFF;
                }
 
-               if (!em_storage_move_file(cnt_info->text.html, buf, false, &err))  {
-                       EM_DEBUG_EXCEPTION("em_storage_move_file failed [%d]", err);
+               if (!emstorage_move_file(cnt_info->text.html, buf, false, &err))  {
+                       EM_DEBUG_EXCEPTION("emstorage_move_file failed [%d]", err);
                        goto FINISH_OFF;
                }
                mail->file_path_html = EM_SAFE_STRDUP(buf);
@@ -3556,114 +3038,113 @@ EXPORT_API int em_core_mail_download_body_multi_sections_bulk(void *mail_stream,
        FINISH_OFF_IF_CANCELED;
        
        for (ai = cnt_info->file; ai; ai = ai->next, attachment_num++)  {
-               attachment.attachment_id = attachment_num;
-               attachment.attachment_size = ai->size;
-               attachment.attachment_path = ai->save;
-               attachment.attachment_name = ai->name;
-               attachment.flag1 = ai->drm;
-               attachment.flag3 = ai->type == 1;
-               attachment.file_yn = 0;
-
+               attachment.attachment_id                    = attachment_num;
+               attachment.attachment_size                  = ai->size;
+               attachment.attachment_path                  = ai->save;
+               attachment.attachment_name                  = ai->name;
+               attachment.attachment_drm_type              = ai->drm;
+               attachment.attachment_inline_content_status = ai->type == 1;
+               attachment.attachment_save_status           = 0;
+               attachment.attachment_mime_type             = ai->attachment_mime_type;
+#ifdef __ATTACHMENT_OPTI__
+               attachment.encoding                         = ai->encoding;
+               attachment.section                          = ai->section;
+#endif
                EM_DEBUG_LOG("attachment.attachment_id[%d]", attachment.attachment_id);
                EM_DEBUG_LOG("attachment.attachment_size[%d]", attachment.attachment_size);
                EM_DEBUG_LOG("attachment.attachment_path[%s]", attachment.attachment_path);
                EM_DEBUG_LOG("attachment.attachment_name[%s]", attachment.attachment_name);
-               EM_DEBUG_LOG("attachment.flag1[%d]", attachment.flag1);
-               EM_DEBUG_LOG("attachment.flag3[%d]", attachment.flag3);
-               EM_DEBUG_LOG("ai->save [%d]", ai->save);
-#ifdef __ATTACHMENT_OPTI__
-               attachment.encoding = ai->encoding;
-               attachment.section = ai->section;
-#endif
+               EM_DEBUG_LOG("attachment.attachment_drm_type[%d]", attachment.attachment_drm_type);
+               EM_DEBUG_LOG("attachment.attachment_inline_content_status[%d]", attachment.attachment_inline_content_status);
 
-               if (ai->type == 1) 
+               if (ai->type == 1)
                        local_inline_content_count++;
                local_attachment_count++;
 
                if (ai->save)  {
                        /*  in POP3 case, rename temporary file to real file. */
-                       attachment.file_yn = 1;
+                       attachment.attachment_save_status = 1;
                        if (ai->type == 1)  {           /*  it is inline content */
-                               if (!em_storage_create_dir(account_id, mail_id, 0, &err))  {
-                                       EM_DEBUG_EXCEPTION("em_storage_create_dir failed [%d]", err);
+                               if (!emstorage_create_dir(account_id, mail_id, 0, &err))  {
+                                       EM_DEBUG_EXCEPTION("emstorage_create_dir failed [%d]", err);
                                        goto FINISH_OFF;
                                }
-                               if (!em_storage_get_save_name(account_id, mail_id, 0, attachment.attachment_name, buf, &err))  {
-                                       EM_DEBUG_EXCEPTION("em_storage_get_save_name failed [%d]", err);
+                               if (!emstorage_get_save_name(account_id, mail_id, 0, attachment.attachment_name, buf, &err))  {
+                                       EM_DEBUG_EXCEPTION("emstorage_get_save_name failed [%d]", err);
                                        goto FINISH_OFF;
                                }
                        }
                        else  {
-                               if (!em_storage_create_dir(account_id, mail_id, attachment_num, &err)) {
-                                       EM_DEBUG_EXCEPTION("em_storage_create_dir failed [%d]", err);
+                               if (!emstorage_create_dir(account_id, mail_id, attachment_num, &err)) {
+                                       EM_DEBUG_EXCEPTION("emstorage_create_dir failed [%d]", err);
                                        goto FINISH_OFF;
                                }
 
-                               if (!em_storage_get_save_name(account_id, mail_id, attachment_num, attachment.attachment_name, buf, &err))  {
-                                       EM_DEBUG_EXCEPTION("em_storage_get_save_name failed [%d]", err);
+                               if (!emstorage_get_save_name(account_id, mail_id, attachment_num, attachment.attachment_name, buf, &err))  {
+                                       EM_DEBUG_EXCEPTION("emstorage_get_save_name failed [%d]", err);
                                        goto FINISH_OFF;
                                }
                        }
-                       
-                       if (!em_storage_move_file(ai->save, buf, false, &err))  {
-                               EM_DEBUG_EXCEPTION("em_storage_move_file failed [%d]", err);
-                               
+
+                       if (!emstorage_move_file(ai->save, buf, false, &err))  {
+                               EM_DEBUG_EXCEPTION("emstorage_move_file failed [%d]", err);
+
                                /*  delete all created files. */
-                               if (!em_storage_get_save_name(account_id, mail_id, 0, NULL, buf, NULL)) {
-                                       EM_DEBUG_EXCEPTION("em_storage_get_save_name failed...");
+                               if (!emstorage_get_save_name(account_id, mail_id, 0, NULL, buf, NULL)) {
+                                       EM_DEBUG_EXCEPTION("emstorage_get_save_name failed...");
                                        /* goto FINISH_OFF; */
                                }
-                               
-                               if (!em_storage_delete_dir(buf, NULL)) {
-                                       EM_DEBUG_EXCEPTION("em_storage_delete_dir failed...");
+
+                               if (!emstorage_delete_dir(buf, NULL)) {
+                                       EM_DEBUG_EXCEPTION("emstorage_delete_dir failed...");
                                        /* goto FINISH_OFF; */
                                }
-                               
-                               err = em_storage_get_emf_error_from_em_storage_error(err);
+
+
                                goto FINISH_OFF;
                        }
-                       
+
                        free(ai->save); ai->save = EM_SAFE_STRDUP(buf);
-                       
+
                        attachment.attachment_path = ai->save;
-                       
-#ifdef __FEATURE_DRM__                 
-                       if (em_core_check_drm(&attachment))  {          /*  is drm */
-                               if (!drm_svc_register_file(attachment.attachment_path)) 
+
+#ifdef __FEATURE_DRM__
+                       if (emcore_check_drm(&attachment)) /*  is drm content ?*/ {
+                               if (!drm_svc_register_file(attachment.attachment_path))
                                        EM_DEBUG_EXCEPTION("drm_svc_register_file fail");
-                               mail->DRM_status = attachment.flag2;
+                               mail->DRM_status = attachment.attachment_drm_type;
                        }
 #endif/*  __FEATURE_DRM__ */
                }
 
 #ifdef __FEATURE_PARTIAL_BODY_DOWNLOAD__
                /*  Information :  Attachment info already saved if partial body is dowloaded. */
-               if (ai->type)  {   /*  Get attachment details  */
-                       emf_mail_attachment_tbl_t *attch_info = NULL;
-               
-                       if (!em_storage_get_attachment_nth(mail_id, attachment.attachment_id, &attch_info, true, &err) || !attch_info)  {
-                               EM_DEBUG_EXCEPTION("em_storage_get_attachment_nth failed [%d]", err);
-                               if (err == EM_STORAGE_ERROR_ATTACHMENT_NOT_FOUND) {   /*  save only attachment file. */
-                                       if (!em_storage_add_attachment(&attachment, 0, false, &err)) {
-                                               EM_DEBUG_EXCEPTION("em_storage_add_attachment failed [%d]", err);
+               if (ai->type)  {
+                       emstorage_attachment_tbl_t *attch_info = NULL;
+                       /*  Get attachment details  */
+                       if (!emstorage_get_attachment_nth(mail_id, attachment.attachment_id, &attch_info, true, &err) || !attch_info)  {
+                               EM_DEBUG_EXCEPTION("emstorage_get_attachment_nth failed [%d]", err);
+                               if (err == EMF_ERROR_ATTACHMENT_NOT_FOUND) {   /*  save only attachment file. */
+                                       if (!emstorage_add_attachment(&attachment, 0, false, &err)) {
+                                               EM_DEBUG_EXCEPTION("emstorage_add_attachment failed [%d]", err);
                                                if (attch_info)
-                                                       em_storage_free_attachment(&attch_info, 1, NULL);               
+                                                       emstorage_free_attachment(&attch_info, 1, NULL);
                                                /*  delete all created files. */
-                                               if (!em_storage_get_save_name(account_id, mail_id, 0, NULL, buf, &err))  {
-                                                       EM_DEBUG_EXCEPTION("em_storage_get_save_name failed [%d]", err);
+                                               if (!emstorage_get_save_name(account_id, mail_id, 0, NULL, buf, &err))  {
+                                                       EM_DEBUG_EXCEPTION("emstorage_get_save_name failed [%d]", err);
                                                        goto FINISH_OFF;
                                                }
-                                               
-                                               if (!em_storage_delete_dir(buf, &err))  {
-                                                       EM_DEBUG_EXCEPTION("em_storage_delete_dir failed [%d]", err);
+
+                                               if (!emstorage_delete_dir(buf, &err))  {
+                                                       EM_DEBUG_EXCEPTION("emstorage_delete_dir failed [%d]", err);
                                                        goto FINISH_OFF;
                                                }
-                                               
+
                                                /*  ROLLBACK TRANSACTION; */
-                                               em_storage_rollback_transaction(NULL, NULL, NULL);
-                                               
-                                               err = em_storage_get_emf_error_from_em_storage_error(err);
-                                               goto FINISH_OFF;                                                
+                                               emstorage_rollback_transaction(NULL, NULL, NULL);
+
+
+                                               goto FINISH_OFF;
                                        }
                                }
                        }
@@ -3672,15 +3153,15 @@ EXPORT_API int em_core_mail_download_body_multi_sections_bulk(void *mail_stream,
                                /* Update attachment size */
                                EM_DEBUG_LOG("attachment_size [%d], ai->size [%d]", attch_info->attachment_size, ai->size);
                                attch_info->attachment_size = ai->size;
-                               if (!em_storage_update_attachment(attch_info, true, &err)) {
-                                       EM_DEBUG_EXCEPTION("em_storage_update_attachment failed [%d]", err);
-                                       err = em_storage_get_emf_error_from_em_storage_error(err);
-                                               goto FINISH_OFF;                
+                               if (!emstorage_update_attachment(attch_info, true, &err)) {
+                                       EM_DEBUG_EXCEPTION("emstorage_update_attachment failed [%d]", err);
+
+                                               goto FINISH_OFF;
                                }
                        }
 
                        if (attch_info)
-                               em_storage_free_attachment(&attch_info, 1, NULL);               
+                               emstorage_free_attachment(&attch_info, 1, NULL);
                }
 
 #else
@@ -3688,28 +3169,28 @@ EXPORT_API int em_core_mail_download_body_multi_sections_bulk(void *mail_stream,
                if (ai->type)  {
                        mail->attachment_yn = 1;
                        /*  save only attachment file. */
-                       if (!em_storage_add_attachment(&attachment, 0, false, &err))  {
-                               EM_DEBUG_EXCEPTION("em_storage_add_attachment failed [%d]", err);
+                       if (!emstorage_add_attachment(&attachment, 0, false, &err))  {
+                               EM_DEBUG_EXCEPTION("emstorage_add_attachment failed [%d]", err);
                                if (bIsAdd_to_mmc)  {
-                                       if (attachment.attachment) {                            
+                                       if (attachment.attachment) {
                                        }
                                }
-                               else  {                         
+                               else  {
                                        /*  delete all created files. */
-                                       if (!em_storage_get_save_name(account_id, mail_id, 0, NULL, buf, &err))  {
-                                               EM_DEBUG_EXCEPTION("em_storage_get_save_name failed [%d]", err);
+                                       if (!emstorage_get_save_name(account_id, mail_id, 0, NULL, buf, &err))  {
+                                               EM_DEBUG_EXCEPTION("emstorage_get_save_name failed [%d]", err);
                                                goto FINISH_OFF;
                                        }
-                               
-                                       if (!em_storage_delete_dir(buf, &err))  {
-                                               EM_DEBUG_EXCEPTION("em_storage_delete_dir failed [%d]", err);
+
+                                       if (!emstorage_delete_dir(buf, &err))  {
+                                               EM_DEBUG_EXCEPTION("emstorage_delete_dir failed [%d]", err);
                                                goto FINISH_OFF;
                                        }
-                               
+
                                        /*  ROLLBACK TRANSACTION; */
-                                       em_storage_rollback_transaction(NULL, NULL, NULL);
-                                       
-                                       err = em_storage_get_emf_error_from_em_storage_error(err);
+                                       emstorage_rollback_transaction(NULL, NULL, NULL);
+
+
                                        goto FINISH_OFF;
                                }
                        }
@@ -3731,10 +3212,10 @@ EXPORT_API int em_core_mail_download_body_multi_sections_bulk(void *mail_stream,
        EM_DEBUG_LOG("Check #3");
 
        /*  change mail's information. */
-       if (!em_storage_change_mail_field(mail_id, APPEND_BODY, mail, false, &err))  {
-               EM_DEBUG_EXCEPTION("em_storage_change_mail_field failed [%d]", err);
-               em_storage_rollback_transaction(NULL, NULL, NULL); /*  ROLLBACK TRANSACTION; */
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+       if (!emstorage_change_mail_field(mail_id, APPEND_BODY, mail, false, &err))  {
+               EM_DEBUG_EXCEPTION("emstorage_change_mail_field failed [%d]", err);
+               emstorage_rollback_transaction(NULL, NULL, NULL); /*  ROLLBACK TRANSACTION; */
+
                goto FINISH_OFF;
        }
 
@@ -3744,19 +3225,19 @@ EXPORT_API int em_core_mail_download_body_multi_sections_bulk(void *mail_stream,
        if (ref_account->receiving_server_type == EMF_SERVER_TYPE_POP3)  {
 #ifdef DELETE_AFTER_DOWNLOADING
                char delmsg[24];
-               
+
                SNPRINTF(delmsg, sizeof(delmsg), "%d", msg_no);
-               
+
                if (!ref_account->keep_on_server)  {
-                       if (!em_core_mail_delete_from_server(&mbox, delmsg, &err)) 
-                               EM_DEBUG_EXCEPTION("em_core_mail_delete_from_server failed [%d]", err);
+                       if (!emcore_delete_mail_from_server(&mbox, delmsg, &err))
+                               EM_DEBUG_EXCEPTION("emcore_delete_mail_from_server failed [%d]", err);
                }
 #endif
                
                if (!mail_stream)  {
                        if (stream != NULL)  {
-                               em_core_mailbox_close(0, stream);                               
-                               stream = NULL;  
+                               emcore_close_mailbox(0, stream);
+                               stream = NULL;
                        }
                }
        }
@@ -3764,8 +3245,8 @@ EXPORT_API int em_core_mail_download_body_multi_sections_bulk(void *mail_stream,
        FINISH_OFF_IF_CANCELED;
        
        ret = true;
-       
-FINISH_OFF: 
+
+FINISH_OFF:
 
        if (g_inline_count) {
                g_inline_count = 0;
@@ -3783,27 +3264,27 @@ FINISH_OFF:
        _imap4_total_body_size = 0;
        _imap4_download_noti_interval_value = 0;
        
-       if (cnt_info) 
-               em_core_mime_free_content_info(cnt_info);
-       if (mail) 
-               em_storage_free_mail(&mail, 1, NULL);
-       if (attachment.mailbox_name) 
+       if (cnt_info)
+               emcore_free_content_info(cnt_info);
+       if (mail)
+               emstorage_free_mail(&mail, 1, NULL);
+       if (attachment.mailbox_name)
                free(attachment.mailbox_name);
-       if (server_mbox) 
+       if (server_mbox)
                free(server_mbox);
-       if (s_uid) 
+       if (s_uid)
                free(s_uid);
 
        multi_part_body_size = 0;
        
        if (ret == true)
-               em_storage_notify_network_event(NOTI_DOWNLOAD_BODY_FINISH, mail_id, NULL, event_handle, 0);
+               emstorage_notify_network_event(NOTI_DOWNLOAD_BODY_FINISH, mail_id, NULL, event_handle, 0);
        else
-               em_storage_notify_network_event(NOTI_DOWNLOAD_BODY_FAIL, mail_id, NULL, event_handle, err);
+               emstorage_notify_network_event(NOTI_DOWNLOAD_BODY_FAIL, mail_id, NULL, event_handle, err);
 
        if (mailbox_name)
                free (mailbox_name);
-       
+
        if (err_code != NULL)
                *err_code = err;
        
@@ -3812,13 +3293,13 @@ FINISH_OFF:
 
 
 
-void em_core_mail_copyuid(MAILSTREAM *stream, char *mailbox, 
-                          unsigned long uidvalidity, SEARCHSET *sourceset, 
+void emcore_mail_copyuid(MAILSTREAM *stream, char *mailbox,
+                          unsigned long uidvalidity, SEARCHSET *sourceset,
                           SEARCHSET *destset)
 {
        EM_DEBUG_FUNC_BEGIN();
        char  old_server_uid[129];
-       
+
        EM_DEBUG_LOG("mailbox name - %s", mailbox);
        EM_DEBUG_LOG("first sequence number source- %ld", sourceset->first);
        EM_DEBUG_LOG("last sequence number last- %ld", sourceset->last);
@@ -3830,27 +3311,27 @@ void em_core_mail_copyuid(MAILSTREAM *stream, char *mailbox,
        memset(old_server_uid, 0x00, 129);
        sprintf(old_server_uid, "%ld", sourceset->first);
        EM_DEBUG_LOG(">>>>> old_server_uid = %s", old_server_uid);
-       
+
        memset(g_new_server_uid, 0x00, 129);
        sprintf(g_new_server_uid, "%ld", destset->first);
        EM_DEBUG_LOG(">>>>> new_server_uid =%s", g_new_server_uid);
-       
-       if (!em_storage_update_server_uid(old_server_uid, g_new_server_uid, NULL)) {
-               EM_DEBUG_EXCEPTION("em_storage_update_server_uid falied...");
+
+       if (!emstorage_update_server_uid(old_server_uid, g_new_server_uid, NULL)) {
+               EM_DEBUG_EXCEPTION("emstorage_update_server_uid falied...");
        }
 }
 
-int em_core_mail_delete(int account_id, int mail_ids[], int num, int from_server, int noti_param_1, int noti_param_2, int *err_code)
+int emcore_delete_mail(int account_id, int mail_ids[], int num, int from_server, int noti_param_1, int noti_param_2, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], mail_ids[%p], num[%d], from_server[%d], noti_param_1 [%d], noti_param_2 [%d], err_code[%p]", account_id, mail_ids, num, from_server, noti_param_1, noti_param_2, err_code);
-       
+
        int ret = false;
        int err = EMF_ERROR_NONE;
        int status = EMF_DELETE_FAIL;
-       
+
        emf_account_t *account = NULL;
        emf_mailbox_t mailbox;
-       emf_mail_tbl_t *mail = NULL;
+       emstorage_mail_tbl_t *mail = NULL;
        void *stream = NULL;
        int mail_id = 0;
        int i = 0;
@@ -3859,28 +3340,28 @@ int em_core_mail_delete(int account_id, int mail_ids[], int num, int from_server
        #ifdef  __FEATURE_BULK_DELETE_MOVE_UPDATE_REQUEST_OPTI__
        int bulk_flag = false;
        #endif
-       
+
        memset(&mailbox, 0x00, sizeof(emf_mailbox_t));
-       
+
        if (!account_id || !mail_ids || !num)  {
                EM_DEBUG_EXCEPTION("account_id[%d], mail_ids[%p], num[%d], from_server[%d]", account_id, mail_ids, num, from_server);
                err = EMF_ERROR_INVALID_PARAM;
                goto FINISH_OFF;
        }
-       
+
        mail_id = mail_ids[0];
-       
-       if (!(account = em_core_get_account_reference(account_id)))  {
-               EM_DEBUG_EXCEPTION("em_core_get_account_reference failed [%d]", account_id);
+
+       if (!(account = emcore_get_account_reference(account_id)))  {
+               EM_DEBUG_EXCEPTION("emcore_get_account_reference failed [%d]", account_id);
                err = EMF_ERROR_INVALID_ACCOUNT;
                goto FINISH_OFF;
        }
 
        if (account->receiving_server_type == EMF_SERVER_TYPE_ACTIVE_SYNC)
                from_server = EMF_DELETE_LOCALLY;
-       
+
        FINISH_OFF_IF_CANCELED;
-       
+
        parameter_string_length = sizeof(char) * (num * 8 + 128 /* MAILBOX_LEN_IN_MAIL_TBL */ * 2);
        parameter_string = malloc(parameter_string_length);
 
@@ -3891,47 +3372,47 @@ int em_core_mail_delete(int account_id, int mail_ids[], int num, int from_server
        }
 
        memset(parameter_string, 0, parameter_string_length);
-       
+
        if (from_server == EMF_DELETE_LOCAL_AND_SERVER || from_server == EMF_DELETE_FOR_SEND_THREAD)  {   /* server delete */
                for (i = 0; i < num; i++)  {
                        mail_id = mail_ids[i];
-                       
-                       if (!em_storage_get_downloaded_mail(mail_id, &mail, false, &err) || !mail)  {
-                               EM_DEBUG_EXCEPTION("em_storage_get_uid_by_mail_id failed [%d]", err);
-                               
-                               if (err == EM_STORAGE_ERROR_MAIL_NOT_FOUND)  {  /*  not server mail */
+
+                       if (!emstorage_get_downloaded_mail(mail_id, &mail, false, &err) || !mail)  {
+                               EM_DEBUG_EXCEPTION("emstorage_get_uid_by_mail_id failed [%d]", err);
+
+                               if (err == EMF_ERROR_MAIL_NOT_FOUND)  { /*  not server mail */
                                        /* err = EMF_ERROR_MAIL_NOT_FOUND_ON_SERVER; */
                                        continue;
                                }
                                else
-                                       err = em_storage_get_emf_error_from_em_storage_error(err);
+
                                
                                goto FINISH_OFF;
                        }
-                                       
-                       EM_SAFE_FREE(mailbox.user_data); 
+
+                       EM_SAFE_FREE(mailbox.user_data);
                        
-                       if (stream == NULL)  {                                  
-                               if (!em_core_mailbox_open(account_id, mail->server_mailbox_name , (void **)&stream, &err))  {
-                                       EM_DEBUG_EXCEPTION("em_core_mailbox_open failed [%d]", err);
+                       if (stream == NULL)  {
+                               if (!emcore_connect_to_remote_mailbox(account_id, mail->server_mailbox_name , (void **)&stream, &err))  {
+                                       EM_DEBUG_EXCEPTION("emcore_connect_to_remote_mailbox failed [%d]", err);
                                        status = EMF_DELETE_CONNECTION_FAIL;
                                        goto FINISH_OFF;
                                }
-                                       
+
                                mailbox.account_id = account_id;
-                               mailbox.name = mail->server_mailbox_name;               
+                               mailbox.name = mail->server_mailbox_name;
                                mailbox.mail_stream = stream;
-                                       
+
                                FINISH_OFF_IF_CANCELED;
                        }
                                
 #ifdef         __FEATURE_BULK_DELETE_MOVE_UPDATE_REQUEST_OPTI__
                        if (account->receiving_server_type == EMF_SERVER_TYPE_IMAP4) {
-#ifdef __LOCAL_ACTIVITY__
+#ifdef __FEATURE_LOCAL_ACTIVITY__
                                if (!bulk_flag && !imap4_mail_delete_ex(&mailbox, mail_ids, num, from_server, &err)) {
-#else /* __LOCAL_ACTIVITY__ */
+#else /* __FEATURE_LOCAL_ACTIVITY__ */
                                if (!bulk_flag && !imap4_mail_delete_ex(&mailbox, mail_ids, num, &err)) {
-#endif /* __LOCAL_ACTIVITY__ */
+#endif /* __FEATURE_LOCAL_ACTIVITY__ */
                                        EM_DEBUG_EXCEPTION("imap4_mail_delete_ex failed [%d]", err);
                                        if (err == EMF_ERROR_IMAP4_STORE_FAILURE)
                                                err = EMF_ERROR_MAIL_NOT_FOUND_ON_SERVER;
@@ -3942,25 +3423,25 @@ int em_core_mail_delete(int account_id, int mail_ids[], int num, int from_server
 
                        }
                        else if (account->receiving_server_type == EMF_SERVER_TYPE_POP3) {
-                               if (!em_core_mail_get_msgno_by_uid(account, &mailbox, mail->server_mail_id, &msgno, &err))  {
-                                       EM_DEBUG_EXCEPTION("em_core_mail_get_msgno_by_uid faild [%d]", err);
+                               if (!emcore_get_mail_msgno_by_uid(account, &mailbox, mail->server_mail_id, &msgno, &err))  {
+                                       EM_DEBUG_EXCEPTION("emcore_get_mail_msgno_by_uid faild [%d]", err);
                                        if (err == EMF_ERROR_MAIL_NOT_FOUND_ON_SERVER)
                                                goto NOT_FOUND_ON_SERVER;
                                        else
                                                goto FINISH_OFF;
                                }
-                               
+
                                FINISH_OFF_IF_CANCELED;
-                               
-                               if (!em_core_mail_delete_from_server(account, &mailbox, msgno, &err))  {
-                                       EM_DEBUG_EXCEPTION("em_core_mail_delete_from_server falied [%d]", err);
+
+                               if (!emcore_delete_mail_from_server(account, &mailbox, msgno, &err))  {
+                                       EM_DEBUG_EXCEPTION("emcore_delete_mail_from_server falied [%d]", err);
                                        goto FINISH_OFF;
                                }
-#ifdef __LOCAL_ACTIVITY__                              
+#ifdef __FEATURE_LOCAL_ACTIVITY__
                                else {
                                        /* Remove local activity */
-                                       emf_activity_tbl_t new_activity;
-                                       memset(&new_activity, 0x00, sizeof(emf_activity_tbl_t));
+                                       emstorage_activity_tbl_t new_activity;
+                                       memset(&new_activity, 0x00, sizeof(emstorage_activity_tbl_t));
                                        if (from_server == EMF_DELETE_FOR_SEND_THREAD) {
                                                new_activity.activity_type = ACTIVITY_DELETEMAIL_SEND;
                                                EM_DEBUG_LOG("from_server == EMF_DELETE_FOR_SEND_THREAD ");
@@ -3973,62 +3454,62 @@ int em_core_mail_delete(int account_id, int mail_ids[], int num, int from_server
                                        new_activity.server_mailid      = mail->server_mail_id;
                                        new_activity.src_mbox           = NULL;
                                        new_activity.dest_mbox          = NULL;
-                                                               
-                                       if (!em_core_activity_delete(&new_activity, &err)) {
-                                               EM_DEBUG_EXCEPTION(" em_core_activity_delete  failed  - %d ", err);
+
+                                       if (!emcore_delete_activity(&new_activity, &err)) {
+                                               EM_DEBUG_EXCEPTION(" emcore_delete_activity  failed  - %d ", err);
                                        }
                                
                                        /* Fix for issue - Sometimes mail move and immediately followed by mail delete is not reflected on server */
-                                       if (!em_storage_remove_downloaded_mail(account_id, mail->server_mailbox_name, mail->server_mail_id, true, &err))  {
-                                               EM_DEBUG_LOG("em_storage_remove_downloaded_mail falied [%d]", err);
-                                       }       
+                                       if (!emstorage_remove_downloaded_mail(account_id, mail->server_mailbox_name, mail->server_mail_id, true, &err))  {
+                                               EM_DEBUG_LOG("emstorage_remove_downloaded_mail falied [%d]", err);
+                                       }
                                }
-                               
-#endif /*  __LOCAL_ACTIVITY__ */
+
+#endif /*  __FEATURE_LOCAL_ACTIVITY__ */
                        }
 #else  /*  __FEATURE_BULK_DELETE_MOVE_UPDATE_REQUEST_OPTI__ */
-                       if (!em_core_mail_get_msgno_by_uid(account, &mailbox, mail->server_mail_id, &msgno, &err)) {
-                               EM_DEBUG_LOG("em_core_mail_get_msgno_by_uid faild [%d]", err);
-                                       
+                       if (!emcore_get_mail_msgno_by_uid(account, &mailbox, mail->server_mail_id, &msgno, &err)) {
+                               EM_DEBUG_LOG("emcore_get_mail_msgno_by_uid faild [%d]", err);
+
                                if (err == EMF_ERROR_MAIL_NOT_FOUND_ON_SERVER) /* Prevent Defect - 9561 */
                                        goto NOT_FOUND_ON_SERVER;
                                else
                                        goto FINISH_OFF;
                        }
-                               
+
                        FINISH_OFF_IF_CANCELED;
-                               
-                       if (!em_core_mail_delete_from_server(account, &mailbox, msgno, &err)) {
-                               EM_DEBUG_LOG("em_core_mail_delete_from_server falied [%d]", err);
-                                       
+
+                       if (!emcore_delete_mail_from_server(account, &mailbox, msgno, &err)) {
+                               EM_DEBUG_LOG("emcore_delete_mail_from_server falied [%d]", err);
+
                                goto FINISH_OFF;
                        }
 #endif /*  __FEATURE_BULK_DELETE_MOVE_UPDATE_REQUEST_OPTI__ */
-                               
-                       if (!em_storage_remove_downloaded_mail(account_id, mail->server_mailbox_name, mail->server_mail_id, true, &err)) 
-                               EM_DEBUG_LOG("em_storage_remove_downloaded_mail falied [%d]", err);
 
-                       /* em_core_delete_notification_for_read_mail(mail_id); */
-                               
-NOT_FOUND_ON_SERVER:                           
+                       if (!emstorage_remove_downloaded_mail(account_id, mail->server_mailbox_name, mail->server_mail_id, true, &err))
+                               EM_DEBUG_LOG("emstorage_remove_downloaded_mail falied [%d]", err);
+
+                       /* emcore_delete_notification_for_read_mail(mail_id); */
+
+NOT_FOUND_ON_SERVER:
                        memset(mail_id_string, 0, 10);
                        SNPRINTF(mail_id_string, 10, "%d,", mail_id);
                        strcat(parameter_string, mail_id_string);
-                               
+
                        FINISH_OFF_IF_CANCELED;
                
-                       em_storage_free_mail(&mail, 1, NULL);
+                       emstorage_free_mail(&mail, 1, NULL);
                }
        }
        else if (from_server == EMF_DELETE_LOCALLY) /* Local Delete */ {
-               em_core_mail_delete_from_local(account_id, mail_ids, num, noti_param_1, noti_param_2, err_code);
+               emcore_delete_mail_from_local_storage(account_id, mail_ids, num, noti_param_1, noti_param_2, err_code);
                for (i = 0; i < num; i++) {
-                       /* em_core_delete_notification_for_read_mail(mail_id); */
+                       /* emcore_delete_notification_for_read_mail(mail_id); */
                        SNPRINTF(mail_id_string, 10, "%d,", mail_id);
                        strcat(parameter_string, mail_id_string);
                }
 
-               em_core_check_unread_mail();
+               emcore_check_unread_mail();
        }
        
        ret = true;
@@ -4036,32 +3517,32 @@ NOT_FOUND_ON_SERVER:
 FINISH_OFF: 
 
        if (stream)              {
-               em_core_mailbox_close(0, stream);                               
-               stream = NULL;  
+               emcore_close_mailbox(0, stream);
+               stream = NULL;
        }
-       
+
        if (mailbox.user_data != NULL) {
-               em_core_mailbox_free_uids(mailbox.user_data, NULL);             
+               emcore_free_uids(mailbox.user_data, NULL);
                mailbox.user_data = NULL;
        }
-       
+
        EM_SAFE_FREE(parameter_string);
-               
+
        if (mail != NULL)
-               em_storage_free_mail(&mail, 1, NULL);
+               emstorage_free_mail(&mail, 1, NULL);
 
 
-       if (from_server)                
-               em_core_show_popup(account_id, EMF_ACTION_DELETE_MAIL, ret == true ? 0  :  err);
+       if (from_server)
+               emcore_show_popup(account_id, EMF_ACTION_DELETE_MAIL, ret == true ? 0  :  err);
 
        if (err_code != NULL)
                *err_code = err;
-       
+
        return ret;
 }
 
 
-int em_core_mail_delete_all(emf_mailbox_t *mailbox, int with_server, int *err_code)
+int emcore_delete_mail_all(emf_mailbox_t *mailbox, int with_server, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("mailbox [%p], with_server [%d], err_code [%p]", mailbox, with_server, err_code);
 
@@ -4080,78 +3561,78 @@ int em_core_mail_delete_all(emf_mailbox_t *mailbox, int with_server, int *err_co
 
        if (mailbox->name != NULL) {
                /* Delete all mails in specific mailbox */
-               if (!em_storage_mail_search_start(NULL, mailbox->account_id, mailbox->name, 0, &search_handle, &total, true, &err)) {
-                       EM_DEBUG_EXCEPTION("em_storage_mail_search_start failed [%d]", err);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+               if (!emstorage_mail_search_start(NULL, mailbox->account_id, mailbox->name, 0, &search_handle, &total, true, &err)) {
+                       EM_DEBUG_EXCEPTION("emstorage_mail_search_start failed [%d]", err);
+       
                        goto FINISH_OFF;
                }
 
-               EM_DEBUG_LOG("em_storage_mail_search_start returns [%d]", total);
+               EM_DEBUG_LOG("emstorage_mail_search_start returns [%d]", total);
 
                if (total > 0) {
-                       mail_ids = em_core_malloc(sizeof(int) * total);
+                       mail_ids = em_malloc(sizeof(int) * total);
                        if (mail_ids == NULL)  {
-                               EM_DEBUG_EXCEPTION("em_core_malloc failed...");
+                               EM_DEBUG_EXCEPTION("em_malloc failed...");
                                err = EMF_ERROR_OUT_OF_MEMORY;
                                goto FINISH_OFF;
                        }
 
                        for (i = 0; i < total; i++)  {
-                               if (!em_storage_mail_search_result(search_handle, RETRIEVE_ID, (void**)&mail_ids[i], true, &err)) {
-                                       EM_DEBUG_EXCEPTION("em_storage_mail_search_result failed [%d]", err);
-                                       err = em_storage_get_emf_error_from_em_storage_error(err);
+                               if (!emstorage_mail_search_result(search_handle, RETRIEVE_ID, (void**)&mail_ids[i], true, &err)) {
+                                       EM_DEBUG_EXCEPTION("emstorage_mail_search_result failed [%d]", err);
+
                                        goto FINISH_OFF;
                                }
                        }
 
-                       if (!em_core_mail_delete(mailbox->account_id, mail_ids, total, with_server, EMF_DELETED_BY_COMMAND, false, &err)) {
-                               EM_DEBUG_EXCEPTION("em_core_mail_delete failed [%d]", err);
+                       if (!emcore_delete_mail(mailbox->account_id, mail_ids, total, with_server, EMF_DELETED_BY_COMMAND, false, &err)) {
+                               EM_DEBUG_EXCEPTION("emcore_delete_mail failed [%d]", err);
                                goto FINISH_OFF;
                        }
                }
        }
        else if (with_server == EMF_DELETE_LOCALLY){
-               /* em_storage_delete_mail_by_account is available only locally */
-               if (!em_storage_delete_mail_by_account(mailbox->account_id, false, &err))  {
-                       EM_DEBUG_EXCEPTION("em_storage_delete_mail_by_account failed [%d]", err);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+               /* emstorage_delete_mail_by_account is available only locally */
+               if (!emstorage_delete_mail_by_account(mailbox->account_id, false, &err))  {
+                       EM_DEBUG_EXCEPTION("emstorage_delete_mail_by_account failed [%d]", err);
+
                        goto FINISH_OFF;
                }
-                       
-               if (!em_storage_delete_attachment_all_on_db(mailbox->account_id, NULL, false, &err))  {
-                       EM_DEBUG_EXCEPTION("em_storage_delete_attachment_all_on_db failed [%d]", err);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+
+               if (!emstorage_delete_attachment_all_on_db(mailbox->account_id, NULL, false, &err))  {
+                       EM_DEBUG_EXCEPTION("emstorage_delete_attachment_all_on_db failed [%d]", err);
+
                        goto FINISH_OFF;
                }
-               
+
                /*  delete mail contents from filesystem */
-               if (!em_storage_get_save_name(mailbox->account_id, 0, 0, NULL, buf, &err))  {
-                       EM_DEBUG_EXCEPTION("em_storage_get_save_name failed [%d]", err);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+               if (!emstorage_get_save_name(mailbox->account_id, 0, 0, NULL, buf, &err))  {
+                       EM_DEBUG_EXCEPTION("emstorage_get_save_name failed [%d]", err);
+
                        goto FINISH_OFF;
                }
-               
-               if (!em_storage_delete_dir(buf, &err))  {
-                       EM_DEBUG_EXCEPTION("em_storage_delete_dir failed [%d]", err);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+
+               if (!emstorage_delete_dir(buf, &err))  {
+                       EM_DEBUG_EXCEPTION("emstorage_delete_dir failed [%d]", err);
+
                }
-                       
+
                /*  delete meeting request */
-               if (!em_storage_delete_meeting_request(mailbox->account_id, 0, NULL, false, &err))  {
-                       EM_DEBUG_EXCEPTION("em_storage_delete_attachment_all_on_db failed [%d]", err);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+               if (!emstorage_delete_meeting_request(mailbox->account_id, 0, NULL, false, &err))  {
+                       EM_DEBUG_EXCEPTION("emstorage_delete_attachment_all_on_db failed [%d]", err);
+       
                        goto FINISH_OFF;
-               }               
+               }
 
-               em_core_check_unread_mail();
+               emcore_check_unread_mail();
        }
        
        ret = true;
 
-FINISH_OFF: 
+FINISH_OFF:
        if (search_handle >= 0)  {
-               if (!em_storage_mail_search_end(search_handle, true, &err))
-                       EM_DEBUG_EXCEPTION("em_storage_mail_search_end failed [%d]", err);
+               if (!emstorage_mail_search_end(search_handle, true, &err))
+                       EM_DEBUG_EXCEPTION("emstorage_mail_search_end failed [%d]", err);
        }
        
        EM_SAFE_FREE(mail_ids);
@@ -4161,31 +3642,31 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_core_mail_delete_from_local(int account_id, int *mail_ids, int num, int noti_param_1, int noti_param_2, int *err_code)
+INTERNAL_FUNC int emcore_delete_mail_from_local_storage(int account_id, int *mail_ids, int num, int noti_param_1, int noti_param_2, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], mail_ids[%p], num [%d], noti_param_1 [%d], noti_param_2 [%d], err_code[%p]", account_id, mail_ids, num, noti_param_1, noti_param_2, num, err_code);
        int ret = false, err = EMF_ERROR_NONE, i;
-       emf_mail_tbl_t *result_mail_list;
+       emstorage_mail_tbl_t *result_mail_list;
        char mail_id_string[10], *noti_param_string = NULL, buf[512] = {0, };
 
        /* Getting mail list by using select mail_id [in] */
 
-       if(!em_storage_get_mail_field_by_multiple_mail_id(mail_ids, num, RETRIEVE_SUMMARY, &result_mail_list, true, &err) || !result_mail_list) {
-               EM_DEBUG_EXCEPTION("em_storage_get_mail_field_by_multiple_mail_id failed [%d]", err);
+       if(!emstorage_get_mail_field_by_multiple_mail_id(mail_ids, num, RETRIEVE_SUMMARY, &result_mail_list, true, &err) || !result_mail_list) {
+               EM_DEBUG_EXCEPTION("emstorage_get_mail_field_by_multiple_mail_id failed [%d]", err);
                goto FINISH_OFF;
        }
 
        /* Deleting mails by using select mail_id [in] */
-       if(!em_storage_delete_multiple_mails(mail_ids, num, true, &err)) {
-               EM_DEBUG_EXCEPTION("em_storage_delete_multiple_mails failed [%d]", err);
+       if(!emstorage_delete_multiple_mails(mail_ids, num, true, &err)) {
+               EM_DEBUG_EXCEPTION("emstorage_delete_multiple_mails failed [%d]", err);
                goto FINISH_OFF;
        }
 
        /* Sending Notification */
-       noti_param_string = em_core_malloc(sizeof(char) * 10 * num);
+       noti_param_string = em_malloc(sizeof(char) * 10 * num);
 
        if(!noti_param_string) {
-               EM_DEBUG_EXCEPTION("em_core_malloc failed");
+               EM_DEBUG_EXCEPTION("em_malloc failed");
                err = EMF_ERROR_OUT_OF_MEMORY;
                goto FINISH_OFF;
        }
@@ -4197,52 +3678,48 @@ EXPORT_API int em_core_mail_delete_from_local(int account_id, int *mail_ids, int
                /* can be optimized by appending sub string with directly pointing on string array kyuho.jo 2011-10-07 */
        }
 
-       if (!em_storage_notify_storage_event(NOTI_MAIL_DELETE, account_id, noti_param_1, noti_param_string, noti_param_2)) 
-               EM_DEBUG_EXCEPTION(" em_storage_notify_storage_event failed [ NOTI_MAIL_DELETE_FINISH ] >>>> ");
+       if (!emstorage_notify_storage_event(NOTI_MAIL_DELETE, account_id, noti_param_1, noti_param_string, noti_param_2))
+               EM_DEBUG_EXCEPTION(" emstorage_notify_storage_event failed [ NOTI_MAIL_DELETE_FINISH ] >>>> ");
 
        /* Updating Thread informations */
        /* Thread information should be updated as soon as possible. */
        for(i = 0; i < num; i++) {
                if (result_mail_list[i].thread_item_count > 1)  {
-                       if (!em_storage_update_latest_thread_mail(account_id, result_mail_list[i].thread_id, 0, 0, false,  &err)) {
-                               EM_DEBUG_EXCEPTION("em_storage_update_latest_thread_mail failed [%d]", err);
-                               err = em_storage_get_emf_error_from_em_storage_error(err);
+                       if (!emstorage_update_latest_thread_mail(account_id, result_mail_list[i].thread_id, 0, 0, false,  &err)) {
+                               EM_DEBUG_EXCEPTION("emstorage_update_latest_thread_mail failed [%d]", err);
+               
                                goto FINISH_OFF;
                        }
                }
        }
-       if (!em_storage_notify_storage_event(NOTI_MAIL_DELETE_FINISH, account_id, noti_param_1, noti_param_string, noti_param_2)) 
-               EM_DEBUG_EXCEPTION(" em_storage_notify_storage_event failed [ NOTI_MAIL_DELETE_FINISH ] >>>> ");
+       if (!emstorage_notify_storage_event(NOTI_MAIL_DELETE_FINISH, account_id, noti_param_1, noti_param_string, noti_param_2))
+               EM_DEBUG_EXCEPTION(" emstorage_notify_storage_event failed [ NOTI_MAIL_DELETE_FINISH ] >>>> ");
 
        for(i = 0; i < num; i++) {
                /* Deleting attachments */
-               if (!em_storage_delete_attachment_on_db(result_mail_list[i].mail_id, 0, false, &err)) {         
-                       EM_DEBUG_EXCEPTION("em_storage_delete_attachment_on_db failed [%d]", err);
-                       
-                       if (err == EM_STORAGE_ERROR_ATTACHMENT_NOT_FOUND)
+               if (!emstorage_delete_attachment_on_db(result_mail_list[i].mail_id, 0, false, &err)) {
+                       EM_DEBUG_EXCEPTION("emstorage_delete_attachment_on_db failed [%d]", err);
+                       if (err == EMF_ERROR_ATTACHMENT_NOT_FOUND)
                                err = EMF_ERROR_NONE;
-                       else 
-                               err = em_storage_get_emf_error_from_em_storage_error(err);
                }
 
-               /* Deleting Directories */      
+               /* Deleting Directories */
                /*  delete mail contents from filesystem */
-               if (!em_storage_get_save_name(account_id, result_mail_list[i].mail_id, 0, NULL, buf, &err)) {
-                       EM_DEBUG_EXCEPTION("em_storage_get_save_name failed [%d]", err);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+               if (!emstorage_get_save_name(account_id, result_mail_list[i].mail_id, 0, NULL, buf, &err)) {
+                       EM_DEBUG_EXCEPTION("emstorage_get_save_name failed [%d]", err);
+
                        goto FINISH_OFF;
                }
-       
-               if (!em_storage_delete_dir(buf, &err)) {
-                       EM_DEBUG_EXCEPTION("em_storage_delete_dir failed [%d]", err);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+
+               if (!emstorage_delete_dir(buf, &err)) {
+                       EM_DEBUG_EXCEPTION("emstorage_delete_dir failed [%d]", err);
+
                }
                
                /* Deleting Meeting Request */
-               if (!em_storage_delete_meeting_request(account_id, result_mail_list[i].mail_id, NULL, false, &err)) {
-                       EM_DEBUG_EXCEPTION("em_storage_delete_meeting_request failed [%d]", err);                       
-                       if (err != EM_STORAGE_ERROR_CONTACT_NOT_FOUND) {
-                               err = em_storage_get_emf_error_from_em_storage_error(err);
+               if (!emstorage_delete_meeting_request(account_id, result_mail_list[i].mail_id, NULL, false, &err)) {
+                       EM_DEBUG_EXCEPTION("emstorage_delete_meeting_request failed [%d]", err);
+                       if (err != EMF_ERROR_CONTACT_NOT_FOUND) {
                                goto FINISH_OFF;
                        }
                }
@@ -4250,7 +3727,7 @@ EXPORT_API int em_core_mail_delete_from_local(int account_id, int *mail_ids, int
 
        ret = true;
 
-FINISH_OFF:    
+FINISH_OFF:
        EM_SAFE_FREE(noti_param_string);
 
        if (err_code != NULL)
@@ -4260,7 +3737,7 @@ FINISH_OFF:
        return ret;
 }
 
-int em_core_mail_delete_from_server(emf_account_t *account, emf_mailbox_t *mailbox, int msgno, int *err_code)
+int emcore_delete_mail_from_server(emf_account_t *account, emf_mailbox_t *mailbox, int msgno, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account[%p], mailbox[%p], msgno[%d], err_code[%p]", account, mailbox, msgno, err_code);
 
@@ -4269,7 +3746,7 @@ int em_core_mail_delete_from_server(emf_account_t *account, emf_mailbox_t *mailb
        
        if (!account || !mailbox) {
                EM_DEBUG_EXCEPTION("account[%p], mailbox[%p], msgno[%d]", account, mailbox, msgno);
-               
+
                err = EMF_ERROR_INVALID_PARAM;
                goto FINISH_OFF;
        }
@@ -4277,7 +3754,7 @@ int em_core_mail_delete_from_server(emf_account_t *account, emf_mailbox_t *mailb
        if (account->receiving_server_type == EMF_SERVER_TYPE_POP3) {
                if (!pop3_mail_delete(mailbox->mail_stream, msgno, &err)) {
                        EM_DEBUG_EXCEPTION("pop3_mail_delete failed [%d]", err);
-                       
+
                        if (err == EMF_ERROR_POP3_DELE_FAILURE)
                                err = EMF_ERROR_MAIL_NOT_FOUND_ON_SERVER;
                        goto FINISH_OFF;
@@ -4286,7 +3763,7 @@ int em_core_mail_delete_from_server(emf_account_t *account, emf_mailbox_t *mailb
        else {          /*  EMF_SERVER_TYPE_IMAP4 */
                if (!imap4_mail_delete(mailbox->mail_stream, msgno, &err)) {
                        EM_DEBUG_EXCEPTION("imap4_mail_delete failed [%d]", err);
-                       
+
                        if (err == EMF_ERROR_IMAP4_STORE_FAILURE)
                                err = EMF_ERROR_MAIL_NOT_FOUND_ON_SERVER;
                        goto FINISH_OFF;
@@ -4302,15 +3779,15 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_core_mail_get_msgno_by_uid(emf_account_t *account, emf_mailbox_t *mailbox, char *uid, int *msgno, int *err_code)
+INTERNAL_FUNC int emcore_get_mail_msgno_by_uid(emf_account_t *account, emf_mailbox_t *mailbox, char *uid, int *msgno, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account[%p], mailbox[%p], uid[%s], msgno[%p], err_code[%p]", account, mailbox, uid, msgno, err_code);
 
        int ret = false;
        int err = EMF_ERROR_NONE;
        
-       em_core_uid_list *uid_list = NULL;
-       em_core_uid_list *pTemp_uid_list = NULL;
+       emcore_uid_list *uid_list = NULL;
+       emcore_uid_list *pTemp_uid_list = NULL;
        
        if (!account || !mailbox || !uid || !msgno)  {
                EM_DEBUG_EXCEPTION("account[%p], mailbox[%p], uid[%s], msgno[%p]", account, mailbox, uid, msgno);
@@ -4354,11 +3831,11 @@ FINISH_OFF:
                *err_code = err;
        uid_list = pTemp_uid_list ;
        if (uid_list != NULL)
-               em_core_mailbox_free_uids(uid_list, NULL);              
+               emcore_free_uids(uid_list, NULL);
        /*  mailbox->user_data and uid_list both point to same memory address, So when uid_list  is freed then just set  */
        /*  mailbox->user_data to NULL and dont use EM_SAFE_FREE, it will crash  : ) */
        if (mailbox)
-       mailbox->user_data = NULL; 
+       mailbox->user_data = NULL;
        EM_DEBUG_FUNC_END();
        return ret;
 }
@@ -4373,7 +3850,7 @@ FINISH_OFF:
  *    succeed  :  1
  *    fail  :  0
  */
-EXPORT_API int em_core_mail_add_attachment(int mail_id, emf_attachment_info_t *attachment, int *err_code)
+INTERNAL_FUNC int emcore_mail_add_attachment(int mail_id, emf_attachment_info_t *attachment, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("mail_id[%d], attachment[%p], err_code[%p]", mail_id, attachment, err_code);
        
@@ -4385,88 +3862,88 @@ EXPORT_API int em_core_mail_add_attachment(int mail_id, emf_attachment_info_t *a
        }
        
        int ret = false, err = EMF_ERROR_NONE;
-       emf_mail_tbl_t *mail_table_data = NULL;
+       emstorage_mail_tbl_t *mail_table_data = NULL;
        int attachment_id = 0;
        
 
        
-       if (!em_storage_get_mail_field_by_id(mail_id, RETRIEVE_SUMMARY, &mail_table_data, true, &err) || !mail_table_data)  {
-               EM_DEBUG_EXCEPTION("em_storage_get_mail_field_by_id failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+       if (!emstorage_get_mail_field_by_id(mail_id, RETRIEVE_SUMMARY, &mail_table_data, true, &err) || !mail_table_data)  {
+               EM_DEBUG_EXCEPTION("emstorage_get_mail_field_by_id failed [%d]", err);
+
                goto FINISH_OFF2;
        }
        
        int account_id = mail_table_data->account_id;
-       emf_mail_attachment_tbl_t attachment_tbl;
+       emstorage_attachment_tbl_t attachment_tbl;
        
-       memset(&attachment_tbl, 0x00, sizeof(emf_mail_attachment_tbl_t));
+       memset(&attachment_tbl, 0x00, sizeof(emstorage_attachment_tbl_t));
+
+       mail_table_data->attachment_count               = mail_table_data->attachment_count + 1;
+       attachment_tbl.account_id                       = mail_table_data->account_id;
+       attachment_tbl.mailbox_name                     = mail_table_data->mailbox_name;
+       attachment_tbl.mail_id                          = mail_id;
+       attachment_tbl.attachment_name                  = attachment->name;
+       attachment_tbl.attachment_size                  = attachment->size;
+       attachment_tbl.attachment_save_status           = attachment->downloaded;
+       attachment_tbl.attachment_drm_type          = attachment->drm;
+       attachment_tbl.attachment_inline_content_status = attachment->inline_content;
 
-       mail_table_data->attachment_count = mail_table_data->attachment_count + 1;
-       attachment_tbl.account_id         = mail_table_data->account_id;
-       attachment_tbl.mailbox_name       = mail_table_data->mailbox_name;
-       attachment_tbl.mail_id            = mail_id;
-       attachment_tbl.attachment_name    = attachment->name;
-       attachment_tbl.attachment_size    = attachment->size;
-       attachment_tbl.file_yn            = attachment->downloaded;
-       attachment_tbl.flag1              = attachment->drm;
-       attachment_tbl.flag3              = attachment->inline_content;
-       
        /*  BEGIN TRANSACTION; */
-       em_storage_begin_transaction(NULL, NULL, NULL);
-       
-       if (!em_storage_add_attachment(&attachment_tbl, 0, false, &err))  {
-               EM_DEBUG_EXCEPTION("em_storage_add_attachment failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+       emstorage_begin_transaction(NULL, NULL, NULL);
+
+       if (!emstorage_add_attachment(&attachment_tbl, 0, false, &err))  {
+               EM_DEBUG_EXCEPTION("emstorage_add_attachment failed [%d]", err);
+
                goto FINISH_OFF;
        }
        
        attachment->attachment_id = attachment_tbl.attachment_id;
-       
+
        if (attachment->savename)  {
                char buf[512];
-               
+
                if (!attachment->inline_content) {
-                       if (!em_storage_create_dir(account_id, mail_id, attachment_tbl.attachment_id, &err))  {
-                               EM_DEBUG_EXCEPTION("em_storage_create_dir failed [%d]", err);
+                       if (!emstorage_create_dir(account_id, mail_id, attachment_tbl.attachment_id, &err))  {
+                               EM_DEBUG_EXCEPTION("emstorage_create_dir failed [%d]", err);
                                goto FINISH_OFF;
                        }
                        attachment_id = attachment_tbl.attachment_id;
                }
-               
-               if (!em_storage_get_save_name(account_id, mail_id, attachment_id, attachment->name, buf, &err))  {
-                       EM_DEBUG_EXCEPTION("em_storage_get_save_name failed [%d]", err);
+
+               if (!emstorage_get_save_name(account_id, mail_id, attachment_id, attachment->name, buf, &err))  {
+                       EM_DEBUG_EXCEPTION("emstorage_get_save_name failed [%d]", err);
                        goto FINISH_OFF;
                }
         attachment_tbl.attachment_path = buf;
-               
-               if (!em_storage_change_attachment_field(mail_id, UPDATE_SAVENAME, &attachment_tbl, false, &err))  {
-                       EM_DEBUG_EXCEPTION("em_storage_change_attachment_field failed [%d]", err);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+
+               if (!emstorage_change_attachment_field(mail_id, UPDATE_SAVENAME, &attachment_tbl, false, &err))  {
+                       EM_DEBUG_EXCEPTION("emstorage_change_attachment_field failed [%d]", err);
+
                        goto FINISH_OFF;
                }
 
-               if (!em_storage_change_mail_field(mail_id, APPEND_BODY, mail_table_data, false, &err)) {
-                       EM_DEBUG_EXCEPTION("em_storage_change_mail_field failed [%d]", err);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+               if (!emstorage_change_mail_field(mail_id, APPEND_BODY, mail_table_data, false, &err)) {
+                       EM_DEBUG_EXCEPTION("emstorage_change_mail_field failed [%d]", err);
+       
                        goto FINISH_OFF;
-               }                       
+               }
 
                if (attachment->downloaded) {
-                       if (!em_storage_move_file(attachment->savename, buf, false, &err))  {
-                               EM_DEBUG_EXCEPTION("em_storage_move_file failed [%d]", err);
-                               err = em_storage_get_emf_error_from_em_storage_error(err);
+                       if (!emstorage_move_file(attachment->savename, buf, false, &err))  {
+                               EM_DEBUG_EXCEPTION("emstorage_move_file failed [%d]", err);
+
                                goto FINISH_OFF;
                        }
                }
-               
+
                /* Here only filename is being updated. Since first add is being done there will not be any old files.
                    So no need to check for old files in this update case */
-               if (!em_storage_change_attachment_field(mail_id, UPDATE_SAVENAME, &attachment_tbl, false, &err))  {
-                       EM_DEBUG_EXCEPTION("em_storage_change_attachment_field failed [%d]", err);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+               if (!emstorage_change_attachment_field(mail_id, UPDATE_SAVENAME, &attachment_tbl, false, &err))  {
+                       EM_DEBUG_EXCEPTION("emstorage_change_attachment_field failed [%d]", err);
+       
                        goto FINISH_OFF;
                }
-               
+
                EM_SAFE_FREE(attachment->savename);
                attachment->savename = EM_SAFE_STRDUP(buf);
        }
@@ -4475,20 +3952,20 @@ EXPORT_API int em_core_mail_add_attachment(int mail_id, emf_attachment_info_t *a
        
 FINISH_OFF: 
        if (ret == true) {      /*  COMMIT TRANSACTION; */
-               if (em_storage_commit_transaction(NULL, NULL, NULL) == false) {
-                       err = em_storage_get_emf_error_from_em_storage_error(EM_STORAGE_ERROR_DB_FAILURE);
+               if (emstorage_commit_transaction(NULL, NULL, NULL) == false) {
+                       err = EMF_ERROR_DB_FAILURE;
                        ret = false;
                }
        }
        else {  /*  ROLLBACK TRANSACTION; */
-               if (em_storage_rollback_transaction(NULL, NULL, NULL) == false)
-                       err = em_storage_get_emf_error_from_em_storage_error(EM_STORAGE_ERROR_DB_FAILURE);
+               if (emstorage_rollback_transaction(NULL, NULL, NULL) == false)
+                       err = EMF_ERROR_DB_FAILURE;
        }       
-       
+
 FINISH_OFF2: 
        if (mail_table_data != NULL)
-               em_storage_free_mail(&mail_table_data, 1, NULL);
-       
+               emstorage_free_mail(&mail_table_data, 1, NULL);
+
        if (err_code)
                *err_code = err;
        EM_DEBUG_FUNC_END("err [%d]", err);
@@ -4496,89 +3973,89 @@ FINISH_OFF2:
 }
 
 
-EXPORT_API int em_core_mail_add_attachment_data(int input_mail_id, emf_attachment_data_t *input_attachment_data)
+INTERNAL_FUNC int emcore_mail_add_attachment_data(int input_mail_id, emf_attachment_data_t *input_attachment_data)
 {
        EM_DEBUG_FUNC_BEGIN("input_mail_id[%d], input_attachment_data[%p]", input_mail_id, input_attachment_data);
 
        int                        err             = EMF_ERROR_NONE;
        int                        attachment_id   = 0;
        char                       buf[512] = { 0, };
-       emf_mail_tbl_t            *mail_table_data = NULL;
-       emf_mail_attachment_tbl_t  attachment_tbl  = { 0 };
+       emstorage_mail_tbl_t            *mail_table_data = NULL;
+       emstorage_attachment_tbl_t  attachment_tbl  = { 0 };
        
        if (input_attachment_data == NULL)  {
                EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
                return EMF_ERROR_INVALID_PARAM;
        }
 
-       if (!em_storage_get_mail_field_by_id(input_mail_id, RETRIEVE_SUMMARY, &mail_table_data, true, &err) || !mail_table_data)  {
-               EM_DEBUG_EXCEPTION("em_storage_get_mail_field_by_id failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+       if (!emstorage_get_mail_field_by_id(input_mail_id, RETRIEVE_SUMMARY, &mail_table_data, true, &err) || !mail_table_data)  {
+               EM_DEBUG_EXCEPTION("emstorage_get_mail_field_by_id failed [%d]", err);
+
                goto FINISH_OFF2;
        }
 
-       mail_table_data->attachment_count = mail_table_data->attachment_count + 1;
-       
-       attachment_tbl.account_id         = mail_table_data->account_id;
-       attachment_tbl.mailbox_name       = mail_table_data->mailbox_name;
-       attachment_tbl.mail_id            = input_mail_id;
-       attachment_tbl.attachment_name    = input_attachment_data->attachment_name;
-       attachment_tbl.attachment_size    = input_attachment_data->attachment_size;
-       attachment_tbl.file_yn            = input_attachment_data->save_status;
-       attachment_tbl.flag1              = input_attachment_data->drm_status;
-       attachment_tbl.flag3              = input_attachment_data->inline_content_status;
+       mail_table_data->attachment_count               = mail_table_data->attachment_count + 1;
+
+       attachment_tbl.account_id                       = mail_table_data->account_id;
+       attachment_tbl.mailbox_name                     = mail_table_data->mailbox_name;
+       attachment_tbl.mail_id                          = input_mail_id;
+       attachment_tbl.attachment_name                  = input_attachment_data->attachment_name;
+       attachment_tbl.attachment_size                  = input_attachment_data->attachment_size;
+       attachment_tbl.attachment_save_status           = input_attachment_data->save_status;
+       attachment_tbl.attachment_drm_type          = input_attachment_data->drm_status;
+       attachment_tbl.attachment_inline_content_status = input_attachment_data->inline_content_status;
        
        /*  BEGIN TRANSACTION; */
-       em_storage_begin_transaction(NULL, NULL, NULL);
-       
-       if (!em_storage_add_attachment(&attachment_tbl, 0, false, &err))  {
-               EM_DEBUG_EXCEPTION("em_storage_add_attachment failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+       emstorage_begin_transaction(NULL, NULL, NULL);
+
+       if (!emstorage_add_attachment(&attachment_tbl, 0, false, &err))  {
+               EM_DEBUG_EXCEPTION("emstorage_add_attachment failed [%d]", err);
+
                goto FINISH_OFF;
        }
        
        input_attachment_data->attachment_id = attachment_tbl.attachment_id;
-       
+
        if (input_attachment_data->attachment_path)  {
                if (!input_attachment_data->inline_content_status) {
-                       if (!em_storage_create_dir(mail_table_data->account_id, input_mail_id, attachment_tbl.attachment_id, &err))  {
-                               EM_DEBUG_EXCEPTION("em_storage_create_dir failed [%d]", err);
+                       if (!emstorage_create_dir(mail_table_data->account_id, input_mail_id, attachment_tbl.attachment_id, &err))  {
+                               EM_DEBUG_EXCEPTION("emstorage_create_dir failed [%d]", err);
                                goto FINISH_OFF;
                        }
                        attachment_id = attachment_tbl.attachment_id;
                }
-               
-               if (!em_storage_get_save_name(mail_table_data->account_id, input_mail_id, attachment_id, input_attachment_data->attachment_name, buf, &err))  {
-                       EM_DEBUG_EXCEPTION("em_storage_get_save_name failed [%d]", err);
+
+               if (!emstorage_get_save_name(mail_table_data->account_id, input_mail_id, attachment_id, input_attachment_data->attachment_name, buf, &err))  {
+                       EM_DEBUG_EXCEPTION("emstorage_get_save_name failed [%d]", err);
                        goto FINISH_OFF;
                }
         attachment_tbl.attachment_path = buf;
-               
-               if (!em_storage_change_attachment_field(input_mail_id, UPDATE_SAVENAME, &attachment_tbl, false, &err))  {
-                       EM_DEBUG_EXCEPTION("em_storage_change_attachment_field failed [%d]", err);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+
+               if (!emstorage_change_attachment_field(input_mail_id, UPDATE_SAVENAME, &attachment_tbl, false, &err))  {
+                       EM_DEBUG_EXCEPTION("emstorage_change_attachment_field failed [%d]", err);
+
                        goto FINISH_OFF;
                }
 
-               if (!em_storage_change_mail_field(input_mail_id, APPEND_BODY, mail_table_data, false, &err)) {
-                       EM_DEBUG_EXCEPTION("em_storage_change_mail_field failed [%d]", err);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+               if (!emstorage_change_mail_field(input_mail_id, APPEND_BODY, mail_table_data, false, &err)) {
+                       EM_DEBUG_EXCEPTION("emstorage_change_mail_field failed [%d]", err);
+       
                        goto FINISH_OFF;
-               }                       
+               }
 
                if (input_attachment_data->save_status) {
-                       if (!em_storage_move_file(input_attachment_data->attachment_path, buf, false, &err))  {
-                               EM_DEBUG_EXCEPTION("em_storage_move_file failed [%d]", err);
-                               err = em_storage_get_emf_error_from_em_storage_error(err);
+                       if (!emstorage_move_file(input_attachment_data->attachment_path, buf, false, &err))  {
+                               EM_DEBUG_EXCEPTION("emstorage_move_file failed [%d]", err);
+
                                goto FINISH_OFF;
                        }
                }
                
                /* Here only filename is being updated. Since first add is being done there will not be any old files.
                    So no need to check for old files in this update case */
-               if (!em_storage_change_attachment_field(input_mail_id, UPDATE_SAVENAME, &attachment_tbl, false, &err))  {
-                       EM_DEBUG_EXCEPTION("em_storage_change_attachment_field failed [%d]", err);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+               if (!emstorage_change_attachment_field(input_mail_id, UPDATE_SAVENAME, &attachment_tbl, false, &err))  {
+                       EM_DEBUG_EXCEPTION("emstorage_change_attachment_field failed [%d]", err);
+       
                        goto FINISH_OFF;
                }
                
@@ -4586,38 +4063,38 @@ EXPORT_API int em_core_mail_add_attachment_data(int input_mail_id, emf_attachmen
                input_attachment_data->attachment_path = EM_SAFE_STRDUP(buf);
        }
        
-FINISH_OFF: 
+FINISH_OFF:
        if (err == EMF_ERROR_NONE) {    /*  COMMIT TRANSACTION; */
-               if (em_storage_commit_transaction(NULL, NULL, NULL) == false) {
-                       err = em_storage_get_emf_error_from_em_storage_error(EM_STORAGE_ERROR_DB_FAILURE);
+               if (emstorage_commit_transaction(NULL, NULL, NULL) == false) {
+                       err = EMF_ERROR_DB_FAILURE;
                }
        }
        else {  /*  ROLLBACK TRANSACTION; */
-               if (em_storage_rollback_transaction(NULL, NULL, NULL) == false)
-                       err = em_storage_get_emf_error_from_em_storage_error(EM_STORAGE_ERROR_DB_FAILURE);
+               if (emstorage_rollback_transaction(NULL, NULL, NULL) == false)
+                       err = EMF_ERROR_DB_FAILURE;
        }       
        
-FINISH_OFF2: 
+FINISH_OFF2:
        if (mail_table_data != NULL)
-               em_storage_free_mail(&mail_table_data, 1, NULL);
+               emstorage_free_mail(&mail_table_data, 1, NULL);
        
        EM_DEBUG_FUNC_END("err [%d]", err);
        return err;
 }
 
 
-/* description 
+/* description
  *    delete a attachment from mail.
- * arguments  
+ * arguments
  *    mailbox  :  mail box
  *    mail_id  :  mail id
  *    attachment_id  :  number string of attachment-id to be deleted
  *                 (ex :  if attachment id is 2, number stirng will be "2")
- * return  
+ * return
  *    succeed  :  1
  *    fail  :  0
  */
-int em_core_mail_delete_attachment(int mail_id,    char *attachment_id_string, int *err_code)
+int emcore_delete_mail_attachment(int mail_id,    char *attachment_id_string, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("mail_id[%d], attachment_id_string[%s], err_code[%p]", mail_id, attachment_id_string, err_code);
        
@@ -4627,156 +4104,48 @@ int em_core_mail_delete_attachment(int mail_id,    char *attachment_id_string, i
                        *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
-       
+
        int ret = false;
        int error = EMF_ERROR_NONE;
        int attachment_id = atoi(attachment_id_string);
        
        /*  BEGIN TRANSACTION; */
-       em_storage_begin_transaction(NULL, NULL, NULL);
+       emstorage_begin_transaction(NULL, NULL, NULL);
        
-       if (!em_storage_delete_attachment_on_db(mail_id, attachment_id, false, &error))  {
-               EM_DEBUG_EXCEPTION("em_storage_delete_attachment_on_db failed [%d]", error);
+       if (!emstorage_delete_attachment_on_db(mail_id, attachment_id, false, &error))  {
+               EM_DEBUG_EXCEPTION("emstorage_delete_attachment_on_db failed [%d]", error);
                goto FINISH_OFF;
        }
        
        ret = true;
        
-FINISH_OFF: 
+FINISH_OFF:
        if (ret == true) {      /*  COMMIT TRANSACTION; */
-               if (em_storage_commit_transaction(NULL, NULL, NULL) == false) {
-                       error = em_storage_get_emf_error_from_em_storage_error(EM_STORAGE_ERROR_DB_FAILURE);
+               if (emstorage_commit_transaction(NULL, NULL, NULL) == false) {
+                       error = EMF_ERROR_DB_FAILURE;
                        ret = false;
                }
        }
        else {  /*  ROLLBACK TRANSACTION; */
-               if (em_storage_rollback_transaction(NULL, NULL, NULL) == false)
-                       error = em_storage_get_emf_error_from_em_storage_error(EM_STORAGE_ERROR_DB_FAILURE);
-       }       
-       
+               if (emstorage_rollback_transaction(NULL, NULL, NULL) == false)
+                       error = EMF_ERROR_DB_FAILURE;
+       }
+
        if (err_code != NULL)
                *err_code = error;
        EM_DEBUG_FUNC_END("ret [%d]", ret);
        return ret;
 }
 
-/* description 
- *    update a attachment to mail.
- * arguments  
- *    mailbox  :  mail box
- *    mail_id  :  mail id
- *    attachment  :  attachment to be added
- * return  
- *    succeed  :  1
- *    fail  :  0
- */
-static int em_core_mail_update_attachment(int mail_id, emf_attachment_info_t *updated_attachment, int *err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("mail_id[%d], attachment[%p], err_code[%p]", mail_id, updated_attachment, err_code);
-
-       int ret = false, err = EMF_ERROR_NONE;
-       emf_mail_attachment_tbl_t *existing_attachment_info = NULL;
-       emf_mail_attachment_tbl_t attachment_tbl;
-
-       if (updated_attachment == NULL)  {
-               EM_DEBUG_EXCEPTION("Invalid Parameter");
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF2;
-       }
-
-       if (!em_storage_get_attachment(mail_id, updated_attachment->attachment_id, &existing_attachment_info, 1, &err)) {
-               EM_DEBUG_EXCEPTION("em_storage_get_attachment failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
-               goto FINISH_OFF2;
-       }
-       
-       memset(&attachment_tbl, 0x00, sizeof(emf_mail_attachment_tbl_t));
-       
-       attachment_tbl.mail_id         = mail_id;
-       attachment_tbl.account_id      = existing_attachment_info->account_id;
-       attachment_tbl.mailbox_name    = existing_attachment_info->mailbox_name;
-       attachment_tbl.attachment_name = updated_attachment->name;
-       attachment_tbl.attachment_size = updated_attachment->size;
-       attachment_tbl.attachment_path = updated_attachment->savename;
-       attachment_tbl.file_yn         = updated_attachment->downloaded;
-       attachment_tbl.flag1           = updated_attachment->drm;
-       attachment_tbl.flag3           = updated_attachment->inline_content;
-       attachment_tbl.attachment_id   = updated_attachment->attachment_id;
-
-       char buf[512];
-       int attachment_id = 0;
-
-       /* EM_DEBUG_LOG("file is downloaded and different from old one. it should be moved"); */
-
-       if (!updated_attachment->inline_content) {
-               if (!em_storage_create_dir(attachment_tbl.account_id, mail_id, attachment_tbl.attachment_id, &err))  {
-                       EM_DEBUG_EXCEPTION("em_storage_create_dir failed [%d]", err);
-                       goto FINISH_OFF;
-               }
-               attachment_id = attachment_tbl.attachment_id;
-       }
-       
-       if (!em_storage_get_save_name(attachment_tbl.account_id, mail_id, attachment_id, updated_attachment->name, buf, &err))  {
-               EM_DEBUG_EXCEPTION("em_storage_get_save_name failed [%d]", err);
-               goto FINISH_OFF2;
-       }
-    attachment_tbl.attachment_path = buf;
-
-       EM_DEBUG_LOG("downloaded [%d], savename [%s], attachment_path [%s]", updated_attachment->downloaded, updated_attachment->savename, existing_attachment_info->attachment_path);
-       if (updated_attachment->downloaded && EM_SAFE_STRCMP(updated_attachment->savename, existing_attachment_info->attachment_path) != 0) {
-               if (!em_storage_move_file(updated_attachment->savename, buf, false ,&err))  {
-                       EM_DEBUG_EXCEPTION("em_storage_move_file failed [%d]", err);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
-                       goto FINISH_OFF2;
-               }
-       }
-       else
-               EM_DEBUG_LOG("no need to move");
-
-       EM_SAFE_FREE(updated_attachment->savename);
-       updated_attachment->savename = EM_SAFE_STRDUP(buf);
-
-       em_storage_begin_transaction(NULL, NULL, NULL);
-       
-       if (!em_storage_update_attachment(&attachment_tbl, false, &err))  {
-               EM_DEBUG_EXCEPTION("em_storage_update_attachment failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
-               goto FINISH_OFF;
-       }
-       
-       ret = true;
-       
-FINISH_OFF: 
-       if (ret == true) {      /*  COMMIT TRANSACTION; */
-               if (em_storage_commit_transaction(NULL, NULL, NULL) == false) {
-                       err = em_storage_get_emf_error_from_em_storage_error(EM_STORAGE_ERROR_DB_FAILURE);
-                       ret = false;
-               }
-       }
-       else {  /*  ROLLBACK TRANSACTION; */
-               if (em_storage_rollback_transaction(NULL, NULL, NULL) == false)
-                       err = em_storage_get_emf_error_from_em_storage_error(EM_STORAGE_ERROR_DB_FAILURE);
-       }       
-
-FINISH_OFF2: 
-       if (existing_attachment_info)
-               em_storage_free_attachment(&existing_attachment_info, 1, NULL);
-
-       if (err_code)
-               *err_code = err;
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return ret;
-}
-
-static int em_core_mail_update_attachment_data(int input_mail_id, emf_attachment_data_t *input_attachment_data)
+static int emcore_mail_update_attachment_data(int input_mail_id, emf_attachment_data_t *input_attachment_data)
 {
        EM_DEBUG_FUNC_BEGIN("input_mail_id[%d], input_attachment_data[%p]", input_mail_id, input_attachment_data);
 
-       int                        err = EMF_ERROR_NONE;
-       int                        attachment_id = 0;
-       char                       buf[512] = { 0 , };
-       emf_mail_attachment_tbl_t *existing_attachment_info = NULL;
-       emf_mail_attachment_tbl_t  attachment_tbl = { 0 };
+       int                         err = EMF_ERROR_NONE;
+       int                         attachment_id = 0;
+       char                        buf[512] = { 0 , };
+       emstorage_attachment_tbl_t *existing_attachment_info = NULL;
+       emstorage_attachment_tbl_t  attachment_tbl = { 0 };
 
        if (input_attachment_data == NULL)  {
                EM_DEBUG_EXCEPTION("Invalid Parameter");
@@ -4784,42 +4153,42 @@ static int em_core_mail_update_attachment_data(int input_mail_id, emf_attachment
                goto FINISH_OFF2;
        }
 
-       if (!em_storage_get_attachment(input_mail_id, input_attachment_data->attachment_id, &existing_attachment_info, 1, &err)) {
-               EM_DEBUG_EXCEPTION("em_storage_get_attachment failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+       if (!emstorage_get_attachment(input_mail_id, input_attachment_data->attachment_id, &existing_attachment_info, 1, &err)) {
+               EM_DEBUG_EXCEPTION("emstorage_get_attachment failed [%d]", err);
+
                goto FINISH_OFF2;
        }
        
-       attachment_tbl.mail_id         = input_mail_id;
-       attachment_tbl.account_id      = existing_attachment_info->account_id;
-       attachment_tbl.mailbox_name    = existing_attachment_info->mailbox_name;
-       attachment_tbl.attachment_name = input_attachment_data->attachment_name;
-       attachment_tbl.attachment_size = input_attachment_data->attachment_size;
-       attachment_tbl.attachment_path = input_attachment_data->attachment_path;
-       attachment_tbl.file_yn         = input_attachment_data->save_status;
-       attachment_tbl.flag1           = input_attachment_data->drm_status;
-       attachment_tbl.flag3           = input_attachment_data->inline_content_status;
-       attachment_tbl.attachment_id   = input_attachment_data->attachment_id;
+       attachment_tbl.mail_id                          = input_mail_id;
+       attachment_tbl.account_id                       = existing_attachment_info->account_id;
+       attachment_tbl.mailbox_name                     = existing_attachment_info->mailbox_name;
+       attachment_tbl.attachment_name                  = input_attachment_data->attachment_name;
+       attachment_tbl.attachment_size                  = input_attachment_data->attachment_size;
+       attachment_tbl.attachment_path                  = input_attachment_data->attachment_path;
+       attachment_tbl.attachment_save_status           = input_attachment_data->save_status;
+       attachment_tbl.attachment_drm_type          = input_attachment_data->drm_status;
+       attachment_tbl.attachment_inline_content_status = input_attachment_data->inline_content_status;
+       attachment_tbl.attachment_id                    = input_attachment_data->attachment_id;
 
        if (!input_attachment_data->inline_content_status) {
-               if (!em_storage_create_dir(attachment_tbl.account_id, input_mail_id, attachment_tbl.attachment_id, &err))  {
-                       EM_DEBUG_EXCEPTION("em_storage_create_dir failed [%d]", err);
+               if (!emstorage_create_dir(attachment_tbl.account_id, input_mail_id, attachment_tbl.attachment_id, &err))  {
+                       EM_DEBUG_EXCEPTION("emstorage_create_dir failed [%d]", err);
                        goto FINISH_OFF;
                }
                attachment_id = attachment_tbl.attachment_id;
        }
        
-       if (!em_storage_get_save_name(attachment_tbl.account_id, input_mail_id, attachment_id, input_attachment_data->attachment_name, buf, &err))  {
-               EM_DEBUG_EXCEPTION("em_storage_get_save_name failed [%d]", err);
+       if (!emstorage_get_save_name(attachment_tbl.account_id, input_mail_id, attachment_id, input_attachment_data->attachment_name, buf, &err))  {
+               EM_DEBUG_EXCEPTION("emstorage_get_save_name failed [%d]", err);
                goto FINISH_OFF2;
        }
     attachment_tbl.attachment_path = buf;
 
        EM_DEBUG_LOG("downloaded [%d], savename [%s], attachment_path [%s]", input_attachment_data->save_status, input_attachment_data->attachment_path, existing_attachment_info->attachment_path);
        if (input_attachment_data->save_status && EM_SAFE_STRCMP(input_attachment_data->attachment_path, existing_attachment_info->attachment_path) != 0) {
-               if (!em_storage_move_file(input_attachment_data->attachment_path, buf, false ,&err))  {
-                       EM_DEBUG_EXCEPTION("em_storage_move_file failed [%d]", err);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+               if (!emstorage_move_file(input_attachment_data->attachment_path, buf, false ,&err))  {
+                       EM_DEBUG_EXCEPTION("emstorage_move_file failed [%d]", err);
+
                        goto FINISH_OFF2;
                }
        }
@@ -4829,66 +4198,35 @@ static int em_core_mail_update_attachment_data(int input_mail_id, emf_attachment
        EM_SAFE_FREE(input_attachment_data->attachment_path);
        input_attachment_data->attachment_path = EM_SAFE_STRDUP(buf);
 
-       em_storage_begin_transaction(NULL, NULL, NULL);
-       
-       if (!em_storage_update_attachment(&attachment_tbl, false, &err))  {
-               EM_DEBUG_EXCEPTION("em_storage_update_attachment failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+       emstorage_begin_transaction(NULL, NULL, NULL);
+
+       if (!emstorage_update_attachment(&attachment_tbl, false, &err))  {
+               EM_DEBUG_EXCEPTION("emstorage_update_attachment failed [%d]", err);
+
                goto FINISH_OFF;
        }
        
-FINISH_OFF: 
+FINISH_OFF:
        if (err == EMF_ERROR_NONE) {    /*  COMMIT TRANSACTION; */
-               if (em_storage_commit_transaction(NULL, NULL, NULL) == false) {
-                       err = em_storage_get_emf_error_from_em_storage_error(EM_STORAGE_ERROR_DB_FAILURE);
+               if (emstorage_commit_transaction(NULL, NULL, NULL) == false) {
+                       err = EMF_ERROR_DB_FAILURE;
                }
        }
        else {  /*  ROLLBACK TRANSACTION; */
-               if (em_storage_rollback_transaction(NULL, NULL, NULL) == false)
-                       err = em_storage_get_emf_error_from_em_storage_error(EM_STORAGE_ERROR_DB_FAILURE);
-       }       
+               if (emstorage_rollback_transaction(NULL, NULL, NULL) == false)
+                       err = EMF_ERROR_DB_FAILURE;
+       }
 
-FINISH_OFF2: 
+FINISH_OFF2:
        if (existing_attachment_info)
-               em_storage_free_attachment(&existing_attachment_info, 1, NULL);
+               emstorage_free_attachment(&existing_attachment_info, 1, NULL);
 
        EM_DEBUG_FUNC_END("err [%d]", err);
        return err;
 }
 
 
-static int em_core_mail_compare_filename_of_attachment(int mail_id, int attachment_a_id, emf_attachment_info_t *attachment_b_info, int *result, int *err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("mail_id[%d], attachment_a_id[%d], attachment_b_info[%p], result[%p], err_code[%p]", mail_id, attachment_a_id, attachment_b_info, result, err_code);
-
-       EM_IF_NULL_RETURN_VALUE(attachment_b_info, false);
-       EM_IF_NULL_RETURN_VALUE(result, false);
-
-       int err, err_2, ret = false;
-       emf_mail_attachment_tbl_t *attachment_a_tbl = NULL;
-
-       if (!em_storage_get_attachment(mail_id, attachment_a_id, &attachment_a_tbl, 1, &err)) {
-               EM_DEBUG_EXCEPTION("em_storage_get_attachment failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
-               goto FINISH_OFF;
-       }
-       
-       if (attachment_a_tbl->attachment_name && attachment_b_info->savename) {
-               EM_DEBUG_LOG("attachment_a_tbl->attachment_name [%s], ttachment_b_info->name [%s]", attachment_a_tbl->attachment_name, attachment_b_info->name);
-               *result = strcmp(attachment_a_tbl->attachment_name, attachment_b_info->name);
-       }
-
-       ret = true;
-
-FINISH_OFF: 
-
-       if (attachment_a_tbl)
-               em_storage_free_attachment(&attachment_a_tbl, 1, &err_2);
-       EM_DEBUG_FUNC_END("*result [%d]", *result);
-       return ret;
-}
-
-static int em_core_mail_compare_filename_of_attachment_data(int input_mail_id, int input_attachment_a_id, emf_attachment_data_t *input_attachment_b_data, int *result)
+static int emcore_mail_compare_filename_of_attachment_data(int input_mail_id, int input_attachment_a_id, emf_attachment_data_t *input_attachment_b_data, int *result)
 {
        EM_DEBUG_FUNC_BEGIN("input_mail_id[%d], input_attachment_a_id[%d], input_attachment_b_data[%p], result[%p]", input_mail_id, input_attachment_a_id, input_attachment_b_data, result);
 
@@ -4896,14 +4234,14 @@ static int em_core_mail_compare_filename_of_attachment_data(int input_mail_id, i
        EM_IF_NULL_RETURN_VALUE(result, false);
 
        int err, err_2, ret = EMF_ERROR_NONE;
-       emf_mail_attachment_tbl_t *attachment_a_tbl = NULL;
+       emstorage_attachment_tbl_t *attachment_a_tbl = NULL;
+
+       if (!emstorage_get_attachment(input_mail_id, input_attachment_a_id, &attachment_a_tbl, 1, &err)) {
+               EM_DEBUG_EXCEPTION("emstorage_get_attachment failed [%d]", err);
 
-       if (!em_storage_get_attachment(input_mail_id, input_attachment_a_id, &attachment_a_tbl, 1, &err)) {
-               EM_DEBUG_EXCEPTION("em_storage_get_attachment failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
                goto FINISH_OFF;
        }
-       
+
        if (attachment_a_tbl->attachment_name && input_attachment_b_data->attachment_name) {
                EM_DEBUG_LOG("attachment_a_tbl->attachment_name [%s], input_attachment_b_data->name [%s]", attachment_a_tbl->attachment_name, input_attachment_b_data->attachment_name);
                *result = strcmp(attachment_a_tbl->attachment_name, input_attachment_b_data->attachment_name);
@@ -4914,7 +4252,7 @@ static int em_core_mail_compare_filename_of_attachment_data(int input_mail_id, i
 FINISH_OFF: 
 
        if (attachment_a_tbl)
-               em_storage_free_attachment(&attachment_a_tbl, 1, &err_2);
+               emstorage_free_attachment(&attachment_a_tbl, 1, &err_2);
        EM_DEBUG_FUNC_END("*result [%d]", *result);
        return ret;
 }
@@ -4930,253 +4268,253 @@ FINISH_OFF:
  *    succeed  :  1
  *    fail  :  0
  */
-EXPORT_API int em_core_mail_copy(int mail_id, emf_mailbox_t *dst_mailbox, int *err_code)
+INTERNAL_FUNC int emcore_mail_copy(int mail_id, emf_mailbox_t *dst_mailbox, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("mail_id[%d], dst_mailbox[%p], err_code[%p]", mail_id, dst_mailbox, err_code);
        
        int ret = false;
        int err = EMF_ERROR_NONE;
        int i;
-       emf_mail_tbl_t *mail = NULL;
-       emf_mail_attachment_tbl_t *atch_list = NULL;
+       emstorage_mail_tbl_t *mail = NULL;
+       emstorage_attachment_tbl_t *atch_list = NULL;
        char buf[512];
        int count = EMF_ATTACHMENT_MAX_COUNT;
        char *mailbox_name = NULL;
 
-       if (!em_storage_get_mail_by_id(mail_id, &mail, true, &err) || !mail)  {
-               EM_DEBUG_EXCEPTION("em_storage_get_mail_by_id failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+       if (!emstorage_get_mail_by_id(mail_id, &mail, true, &err) || !mail)  {
+               EM_DEBUG_EXCEPTION("emstorage_get_mail_by_id failed [%d]", err);
+
                goto FINISH_OFF;
        }
-       
-       if ( (err = em_storage_get_attachment_list(mail_id, true, &atch_list, &count)) != EM_STORAGE_ERROR_NONE ){
-               EM_DEBUG_EXCEPTION("em_storage_get_attachment_list failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+
+       if ( (err = emstorage_get_attachment_list(mail_id, true, &atch_list, &count)) != EMF_ERROR_NONE ){
+               EM_DEBUG_EXCEPTION("emstorage_get_attachment_list failed [%d]", err);
+
                goto FINISH_OFF;
        }
-       
+
        /*  get increased uid. */
-       if (!em_storage_increase_mail_id(&mail->mail_id, true, &err))  {
-               EM_DEBUG_EXCEPTION("em_storage_increase_mail_id failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+       if (!emstorage_increase_mail_id(&mail->mail_id, true, &err))  {
+               EM_DEBUG_EXCEPTION("emstorage_increase_mail_id failed [%d]", err);
+
                goto FINISH_OFF;
        }
-       
+
        /*  copy mail body(text) file */
        if (mail->file_path_plain)  {
-               if (!em_storage_create_dir(dst_mailbox->account_id, mail->mail_id, 0, &err))  {
-                       EM_DEBUG_EXCEPTION("em_storage_create_dir failed [%d]", err);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+               if (!emstorage_create_dir(dst_mailbox->account_id, mail->mail_id, 0, &err))  {
+                       EM_DEBUG_EXCEPTION("emstorage_create_dir failed [%d]", err);
+
                        goto FINISH_OFF;
                }
-               
+
                gchar *filename = g_path_get_basename(mail->file_path_plain);
-               
-               if (!em_storage_get_save_name(dst_mailbox->account_id, mail->mail_id, 0, filename, buf, &err))  {
-                       EM_DEBUG_EXCEPTION("em_storage_get_save_name failed [%d]", err);
+
+               if (!emstorage_get_save_name(dst_mailbox->account_id, mail->mail_id, 0, filename, buf, &err))  {
+                       EM_DEBUG_EXCEPTION("emstorage_get_save_name failed [%d]", err);
                        g_free(filename);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+
                        goto FINISH_OFF;
                }
-               
+
                g_free(filename);
-               
-               if (!em_storage_copy_file(mail->file_path_plain, buf, false, &err))  {
-                       EM_DEBUG_EXCEPTION("em_storage_copy_file failed [%d]", err);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+
+               if (!emstorage_copy_file(mail->file_path_plain, buf, false, &err))  {
+                       EM_DEBUG_EXCEPTION("emstorage_copy_file failed [%d]", err);
+
                        goto FINISH_OFF;
                }
-               
+
                mail->file_path_plain = EM_SAFE_STRDUP(buf);
-       }       
-       
+       }
+
        /*  copy mail body(html) file */
        if (mail->file_path_html)  {
-               if (!em_storage_create_dir(dst_mailbox->account_id, mail->mail_id, 0, &err))  {
-                       EM_DEBUG_EXCEPTION("em_storage_create_dir failed [%d]", err);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+               if (!emstorage_create_dir(dst_mailbox->account_id, mail->mail_id, 0, &err))  {
+                       EM_DEBUG_EXCEPTION("emstorage_create_dir failed [%d]", err);
+
                        goto FINISH_OFF;
                }
-               
+
                gchar *filename = g_path_get_basename(mail->file_path_html);
-               
-               if (!em_storage_get_save_name(dst_mailbox->account_id, mail->mail_id, 0, filename, buf, &err))  {
-                       EM_DEBUG_EXCEPTION("em_storage_get_save_name failed [%d]", err);
+
+               if (!emstorage_get_save_name(dst_mailbox->account_id, mail->mail_id, 0, filename, buf, &err))  {
+                       EM_DEBUG_EXCEPTION("emstorage_get_save_name failed [%d]", err);
                        g_free(filename);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+
                        goto FINISH_OFF;
                }
-               
+
                g_free(filename);
-               
-               if (!em_storage_copy_file(mail->file_path_html, buf, false, &err))  {
-                       EM_DEBUG_EXCEPTION("em_storage_copy_file failed [%d]", err);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+
+               if (!emstorage_copy_file(mail->file_path_html, buf, false, &err))  {
+                       EM_DEBUG_EXCEPTION("emstorage_copy_file failed [%d]", err);
+       
                        goto FINISH_OFF;
                }
-               
+
                mail->file_path_html = EM_SAFE_STRDUP(buf);
-       }       
+       }
 
        /*  BEGIN TRANSACTION; */
-       em_storage_begin_transaction(NULL, NULL, NULL);
-       
+       emstorage_begin_transaction(NULL, NULL, NULL);
+
        /*  insert mail data */
        EM_SAFE_FREE(mail->mailbox_name);
        
-       mail->account_id   = dst_mailbox->account_id;           /*  MUST BE */
+       mail->account_id   = dst_mailbox->account_id;
+       mail->mailbox_id   = dst_mailbox->mailbox_id;
        mail->mailbox_name = EM_SAFE_STRDUP(dst_mailbox->name);
        mail->mailbox_type = dst_mailbox->mailbox_type;
        
-       if (!em_storage_add_mail(mail, 0, false, &err))  {
-               EM_DEBUG_EXCEPTION("em_storage_add_mail failed [%d]", err);
-               
+       if (!emstorage_add_mail(mail, 0, false, &err))  {
+               EM_DEBUG_EXCEPTION("emstorage_add_mail failed [%d]", err);
+
                if (mail->file_path_plain)  {
-                       if (!em_storage_delete_file(mail->file_path_plain, &err))  {
-                               EM_DEBUG_EXCEPTION("em_storage_delete_file failed [%d]", err);
-                               em_storage_rollback_transaction(NULL, NULL, NULL);
+                       if (!emstorage_delete_file(mail->file_path_plain, &err))  {
+                               EM_DEBUG_EXCEPTION("emstorage_delete_file failed [%d]", err);
+                               emstorage_rollback_transaction(NULL, NULL, NULL);
                                goto FINISH_OFF;
                        }
                }
                if (mail->file_path_html) {
-                       if (!em_storage_delete_file(mail->file_path_html, &err))  {
-                               EM_DEBUG_EXCEPTION("em_storage_delete_file failed [%d]", err);
-                               em_storage_rollback_transaction(NULL, NULL, NULL);
+                       if (!emstorage_delete_file(mail->file_path_html, &err))  {
+                               EM_DEBUG_EXCEPTION("emstorage_delete_file failed [%d]", err);
+                               emstorage_rollback_transaction(NULL, NULL, NULL);
                                goto FINISH_OFF;
                        }
                }
-               
+
                /*  ROLLBACK TRANSACTION; */
-               em_storage_rollback_transaction(NULL, NULL, NULL);
-               
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+               emstorage_rollback_transaction(NULL, NULL, NULL);
+
+
                goto FINISH_OFF;
        }
-       
+
        /*  copy attachment file */
        for (i = 0; i<count; i++)  {
                if (atch_list[i].attachment_path)  {
-                       if (!em_storage_create_dir(dst_mailbox->account_id, mail->mail_id, i+1, &err))  {
-                               EM_DEBUG_EXCEPTION("em_storage_create_dir failed [%d]", err);
+                       if (!emstorage_create_dir(dst_mailbox->account_id, mail->mail_id, i+1, &err))  {
+                               EM_DEBUG_EXCEPTION("emstorage_create_dir failed [%d]", err);
                                break;
                        }
                        
-                       if (!em_storage_get_save_name(dst_mailbox->account_id, mail->mail_id, i+1, atch_list[i].attachment_name, buf, &err))  {
-                               EM_DEBUG_EXCEPTION("em_storage_get_save_name failed [%d]", err);
+                       if (!emstorage_get_save_name(dst_mailbox->account_id, mail->mail_id, i+1, atch_list[i].attachment_name, buf, &err))  {
+                               EM_DEBUG_EXCEPTION("emstorage_get_save_name failed [%d]", err);
                                break;
                        }
-                       
-                       if (!em_storage_copy_file(atch_list[i].attachment_path, buf, false, &err))  {
-                               EM_DEBUG_EXCEPTION("em_storage_copy_file failed [%d]", err);
+
+                       if (!emstorage_copy_file(atch_list[i].attachment_path, buf, false, &err))  {
+                               EM_DEBUG_EXCEPTION("emstorage_copy_file failed [%d]", err);
                                break;
                        }
-                       
+
                        EM_SAFE_FREE(atch_list[i].attachment_path);
-                       
+
                        atch_list[i].attachment_path = EM_SAFE_STRDUP(buf);
                }
-               
+
                atch_list[i].account_id = dst_mailbox->account_id;
                atch_list[i].mail_id = mail->mail_id;
-               
+
                EM_SAFE_FREE(atch_list[i].mailbox_name);
-               
+
                atch_list[i].mailbox_name = EM_SAFE_STRDUP(mail->mailbox_name);
-               
-               if (!em_storage_add_attachment(&atch_list[i], 0, false, &err))  {
-                       EM_DEBUG_EXCEPTION("em_storage_add_attachment failed [%d]", err);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+
+               if (!emstorage_add_attachment(&atch_list[i], 0, false, &err))  {
+                       EM_DEBUG_EXCEPTION("emstorage_add_attachment failed [%d]", err);
+
                        break;
                }
        }
-       
+
        /*  in case error happened, delete copied file. */
        if (i && i != count)  {
                for (;i >= 0; i--)  {
                        if (atch_list[i].attachment_path)  {
                        
-                               if (!em_storage_delete_file(atch_list[i].attachment_path, &err))  {
-                                       EM_DEBUG_EXCEPTION("em_storage_delete_file failed [%d]", err);
-                                       em_storage_rollback_transaction(NULL, NULL, NULL);
+                               if (!emstorage_delete_file(atch_list[i].attachment_path, &err))  {
+                                       EM_DEBUG_EXCEPTION("emstorage_delete_file failed [%d]", err);
+                                       emstorage_rollback_transaction(NULL, NULL, NULL);
                                        goto FINISH_OFF;
                                }
                        }
                }
-               
+
                if (mail->file_path_plain)  {
-                       if (!em_storage_delete_file(mail->file_path_plain, &err))  {
-                               EM_DEBUG_EXCEPTION("em_storage_delete_file failed [%d]", err);
-                               em_storage_rollback_transaction(NULL, NULL, NULL);
+                       if (!emstorage_delete_file(mail->file_path_plain, &err))  {
+                               EM_DEBUG_EXCEPTION("emstorage_delete_file failed [%d]", err);
+                               emstorage_rollback_transaction(NULL, NULL, NULL);
                                goto FINISH_OFF;
                        }
                }
                if (mail->file_path_html)  {
-                       if (!em_storage_delete_file(mail->file_path_html, &err))  {
-                               EM_DEBUG_EXCEPTION("em_storage_delete_file failed [%d]", err);
-                               em_storage_rollback_transaction(NULL, NULL, NULL);
+                       if (!emstorage_delete_file(mail->file_path_html, &err))  {
+                               EM_DEBUG_EXCEPTION("emstorage_delete_file failed [%d]", err);
+                               emstorage_rollback_transaction(NULL, NULL, NULL);
                                goto FINISH_OFF;
                        }
                }
-               
+
                /*  ROLLBACK TRANSACTION; */
-               em_storage_rollback_transaction(NULL, NULL, NULL);
+               emstorage_rollback_transaction(NULL, NULL, NULL);
                goto FINISH_OFF;
        }
-       
-       if (em_storage_commit_transaction(NULL, NULL, NULL) == false) {
-               err = em_storage_get_emf_error_from_em_storage_error(EM_STORAGE_ERROR_DB_FAILURE);
-               if (em_storage_rollback_transaction(NULL, NULL, NULL) == false)
-                       err = em_storage_get_emf_error_from_em_storage_error(EM_STORAGE_ERROR_DB_FAILURE);
+
+       if (emstorage_commit_transaction(NULL, NULL, NULL) == false) {
+               err = EMF_ERROR_DB_FAILURE;
+               if (emstorage_rollback_transaction(NULL, NULL, NULL) == false)
+                       err = EMF_ERROR_DB_FAILURE;
                goto FINISH_OFF;
        }
 
-       if (!em_storage_get_mailboxname_by_mailbox_type(dst_mailbox->account_id, EMF_MAILBOX_TYPE_INBOX, &mailbox_name, false, &err))  {
-               EM_DEBUG_EXCEPTION("em_storage_get_mailboxname_by_mailbox_type failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+       if (!emstorage_get_mailboxname_by_mailbox_type(dst_mailbox->account_id, EMF_MAILBOX_TYPE_INBOX, &mailbox_name, false, &err))  {
+               EM_DEBUG_EXCEPTION("emstorage_get_mailboxname_by_mailbox_type failed [%d]", err);
                goto FINISH_OFF;
        }
 
        if (!strcmp(dst_mailbox->name, mailbox_name) && !(mail->flags_seen_field))
-               em_core_check_unread_mail();
-       
+               emcore_check_unread_mail();
+
        ret = true;
-       
+
 FINISH_OFF: 
        if (atch_list != NULL)
-               em_storage_free_attachment(&atch_list, count, NULL);
-       
+               emstorage_free_attachment(&atch_list, count, NULL);
+
        if (mail != NULL)
-               em_storage_free_mail(&mail, 1, NULL);
-       
+               emstorage_free_mail(&mail, 1, NULL);
+
        EM_SAFE_FREE(mailbox_name);
-       
+
        if (err_code != NULL)
                *err_code = err;
        EM_DEBUG_FUNC_END("err [%d]", err);
        return ret;
 }
 
-/* description 
+/* description
  *    move a mail to mail box
- * arguments  
+ * arguments
  *    old_mailbox  :  previous mail box
  *    msgno  :  msgno
  *    new_mailbox  :  target mail box
- * return  
+ * return
  *    succeed  :  1
  *    fail  :  0
  */
-EXPORT_API int em_core_mail_move(int mail_ids[], int mail_ids_count, char *dst_mailbox_name, int noti_param_1, int noti_param_2 ,int *err_code)
+INTERNAL_FUNC int emcore_mail_move(int mail_ids[], int mail_ids_count, char *dst_mailbox_name, int noti_param_1, int noti_param_2 ,int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("mail_ids[%p], mail_ids_count[%d], dst_mailbox_name[%s], noti_param [%d], err_code[%p]", mail_ids, mail_ids_count, dst_mailbox_name, noti_param_1, err_code);
-       
+
        int ret = false;
        int err = EMF_ERROR_NONE;
-       emf_mail_tbl_t *mail_list = NULL;
+       emstorage_mail_tbl_t *mail_list = NULL;
        int account_id = 0;
        int i = 0, parameter_string_length = 0;
        char *parameter_string = NULL, mail_id_string[10];
-       emf_mail_attachment_tbl_t attachment;
+       emstorage_attachment_tbl_t attachment;
 
        if (!dst_mailbox_name && mail_ids_count < 1) {
                EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
@@ -5184,22 +4522,22 @@ EXPORT_API int em_core_mail_move(int mail_ids[], int mail_ids_count, char *dst_m
                goto FINISH_OFF;
        }
 
-       if (!em_storage_get_mail_field_by_multiple_mail_id(mail_ids, mail_ids_count, RETRIEVE_FLAG, &mail_list, true, &err) || !mail_list) {
-               EM_DEBUG_EXCEPTION("em_storage_get_mail_field_by_multiple_mail_id failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+       if (!emstorage_get_mail_field_by_multiple_mail_id(mail_ids, mail_ids_count, RETRIEVE_FLAG, &mail_list, true, &err) || !mail_list) {
+               EM_DEBUG_EXCEPTION("emstorage_get_mail_field_by_multiple_mail_id failed [%d]", err);
+
                goto FINISH_OFF;
        }
+
        account_id = mail_list[0].account_id;
 
-       if(!em_storage_move_multiple_mails(account_id, dst_mailbox_name, mail_ids, mail_ids_count, true, &err)) {
-               EM_DEBUG_EXCEPTION("em_storage_move_multiple_mails failed [%d]", err);
+       if(!emstorage_move_multiple_mails(account_id, dst_mailbox_name, mail_ids, mail_ids_count, true, &err)) {
+               EM_DEBUG_EXCEPTION("emstorage_move_multiple_mails failed [%d]", err);
                goto FINISH_OFF;
        }
        
        /* Sending a notification */
        parameter_string_length = sizeof(char) * (mail_ids_count * 10 + 128/*MAILBOX_LEN_IN_MAIL_TBL*/ * 2);
-       parameter_string = em_core_malloc(parameter_string_length);
+       parameter_string = em_malloc(parameter_string_length);
 
        if (mail_list[0].mailbox_name)
                SNPRINTF(parameter_string, parameter_string_length, "%s%c%s%c", mail_list[0].mailbox_name, 0x01, dst_mailbox_name , 0x01);
@@ -5218,57 +4556,57 @@ EXPORT_API int em_core_mail_move(int mail_ids[], int mail_ids_count, char *dst_m
        
        EM_DEBUG_LOG("num : [%d], param string : [%s]", mail_ids_count , parameter_string);
 
-       if (!em_storage_notify_storage_event(NOTI_MAIL_MOVE, account_id, noti_param_1, parameter_string, noti_param_2)) 
-               EM_DEBUG_EXCEPTION(" em_storage_notify_storage_event failed [NOTI_MAIL_MOVE] >>>> ");
+       if (!emstorage_notify_storage_event(NOTI_MAIL_MOVE, account_id, noti_param_1, parameter_string, noti_param_2))
+               EM_DEBUG_EXCEPTION(" emstorage_notify_storage_event failed [NOTI_MAIL_MOVE] >>>> ");
 
-       /* Upating thread mail info should be done as soon as possible */ 
+       /* Upating thread mail info should be done as soon as possible */
        attachment.mailbox_name = dst_mailbox_name;
 
        for (i = 0; i < mail_ids_count; i++) {
-               if (!em_storage_update_latest_thread_mail(account_id, mail_list[i].thread_id, 0, 0, true, &err))
-                       EM_DEBUG_EXCEPTION("em_storage_update_latest_thread_mail failed [%d]", err);
+               if (!emstorage_update_latest_thread_mail(account_id, mail_list[i].thread_id, 0, 0, true, &err))
+                       EM_DEBUG_EXCEPTION("emstorage_update_latest_thread_mail failed [%d]", err);
        }
 
-       if (!em_storage_notify_storage_event(NOTI_MAIL_MOVE_FINISH, account_id, noti_param_1, parameter_string, noti_param_2)) 
-               EM_DEBUG_EXCEPTION(" em_storage_notify_storage_event failed [NOTI_MAIL_MOVE_FINISH] >>>> ");
+       if (!emstorage_notify_storage_event(NOTI_MAIL_MOVE_FINISH, account_id, noti_param_1, parameter_string, noti_param_2))
+               EM_DEBUG_EXCEPTION(" emstorage_notify_storage_event failed [NOTI_MAIL_MOVE_FINISH] >>>> ");
 
-       em_core_check_unread_mail();
+       emcore_check_unread_mail();
 
        ret = true;
-       
-FINISH_OFF: 
-       em_storage_free_mail(&mail_list, mail_ids_count, NULL);
+
+FINISH_OFF:
+       emstorage_free_mail(&mail_list, mail_ids_count, NULL);
        EM_SAFE_FREE(parameter_string);
        if (err_code != NULL)
                *err_code = err;
-       EM_DEBUG_FUNC_END("err [%d]", err);                     
+       EM_DEBUG_FUNC_END("err [%d]", err);
        return ret;
 }
 
 
-EXPORT_API int em_core_mail_move_from_server(int account_id, char *src_mailbox,  int mail_ids[], int num, char *dest_mailbox, int *error_code)
+INTERNAL_FUNC int emcore_move_mail_on_server(int account_id, char *src_mailbox,  int mail_ids[], int num, char *dest_mailbox, int *error_code)
 {
        EM_DEBUG_FUNC_BEGIN();
        MAILSTREAM *stream = NULL;
        int err_code = 0;
        emf_account_t *ref_account = NULL;
-       emf_mail_tbl_t *mail = NULL;
+       emstorage_mail_tbl_t *mail = NULL;
        int ret = 1;
        int mail_id = 0;
        int i = 0;
        
        mail_id = mail_ids[0];
        
-       ref_account = em_core_get_account_reference(account_id);
+       ref_account = emcore_get_account_reference(account_id);
        if (!ref_account)  {
-               EM_DEBUG_EXCEPTION("em_core_mail_move_from_server failed  :  get account reference[%d]", account_id);
+               EM_DEBUG_EXCEPTION("emcore_move_mail_on_server failed  :  get account reference[%d]", account_id);
                *error_code = EMF_ERROR_INVALID_ACCOUNT;
                ret = 0;
                goto FINISH_OFF;
        }
 
                    /* if not imap4 mail, return */
-       if (ref_account->account_bind_type != EMF_BIND_TYPE_EM_CORE || 
+       if (ref_account->account_bind_type != EMF_BIND_TYPE_EM_CORE ||
                ref_account->receiving_server_type != EMF_SERVER_TYPE_IMAP4) {
                *error_code = EMF_ERROR_INVALID_PARAM;
                ret = 0;
@@ -5277,395 +4615,144 @@ EXPORT_API int em_core_mail_move_from_server(int account_id, char *src_mailbox,
 
        for (i = 0; i < num; i++)  {
                mail_id = mail_ids[i];
-                       
-               if (!em_storage_get_mail_by_id(mail_id, &mail, false, &err_code) || !mail)  {
-                       EM_DEBUG_EXCEPTION("em_storage_get_uid_by_mail_id  :  em_storage_get_downloaded_mail failed [%d]", err_code);
-                       mail = NULL;            
-                       if (err_code == EM_STORAGE_ERROR_MAIL_NOT_FOUND)  {     /*  not server mail */
+
+               if (!emstorage_get_mail_by_id(mail_id, &mail, false, &err_code) || !mail)  {
+                       EM_DEBUG_EXCEPTION("emstorage_get_uid_by_mail_id  :  emstorage_get_downloaded_mail failed [%d]", err_code);
+                       mail = NULL;
+                       if (err_code == EMF_ERROR_MAIL_NOT_FOUND)  {    /*  not server mail */
                                /* err = EMF_ERROR_MAIL_NOT_FOUND_ON_SERVER; */
                                /* continue; */
                        }
                        else {
-                               *error_code = em_storage_get_emf_error_from_em_storage_error(err_code);
+                               *error_code = err_code;
                        }
 
                        ret = 0;
                        goto FINISH_OFF;
                }
 
-               if (!em_core_mailbox_open(account_id, src_mailbox, (void **)&stream, &err_code))                /* faizan.h@samsung.com mail_move_fix_07042009 */ {
-                       EM_DEBUG_EXCEPTION("em_core_mail_move_from_server failed :  Mailbox open[%d]", err_code);
-                       
+               if (!emcore_connect_to_remote_mailbox(account_id, src_mailbox, (void **)&stream, &err_code))            /* faizan.h@samsung.com mail_move_fix_07042009 */ {
+                       EM_DEBUG_EXCEPTION("emcore_move_mail_on_server failed :  Mailbox open[%d]", err_code);
+
                        ret = 0;
                        goto FINISH_OFF;
                }
 
                if (stream) {
                        /* set callback for COPY_UID */
-                       mail_parameters(stream, SET_COPYUID, em_core_mail_copyuid);
-                       
+                       mail_parameters(stream, SET_COPYUID, emcore_mail_copyuid);
+
                        EM_DEBUG_LOG("calling mail_copy_full FODLER MAIL COPY ");
                        
                        if (mail->server_mail_id) {
                                if (!mail_copy_full(stream, mail->server_mail_id, dest_mailbox, CP_UID | CP_MOVE)) {
-                                       EM_DEBUG_EXCEPTION("em_core_mail_move_from_server :   Mail cannot be moved failed");
+                                       EM_DEBUG_EXCEPTION("emcore_move_mail_on_server :   Mail cannot be moved failed");
                                        ret = 0;
                                }
                                else {
                                        /*  send EXPUNGE command */
                                        if (!imap4_send_command(stream, IMAP4_CMD_EXPUNGE, &err_code)) {
                                                EM_DEBUG_EXCEPTION("imap4_send_command failed [%d]", err_code);
-                                               
+
                                                if (err_code == EMF_ERROR_IMAP4_STORE_FAILURE)
                                                        err_code = EMF_ERROR_MAIL_NOT_FOUND_ON_SERVER;
                                                goto FINISH_OFF;
-                                       }                                       
-                                       
+                                       }
+
                                        /* faizan.h@samsung.com   duplicate copy while sync mailbox issue fixed */
                                        EM_DEBUG_LOG(">>>mailbox_name[%s]>>>>>>", mail->mailbox_name);
                                        EM_DEBUG_LOG(">>>g_new_server_uid[%s]>>>>>>", g_new_server_uid);
                                        EM_DEBUG_LOG(">>>mail_id[%d]>>>>>>", mail_id);
 
-                                       if (!em_storage_update_read_mail_uid(mail_id, g_new_server_uid, mail->mailbox_name, &err_code)) {
-                                               EM_DEBUG_EXCEPTION("em_storage_update_read_mail_uid failed [%d]", err_code);
+                                       if (!emstorage_update_read_mail_uid(mail_id, g_new_server_uid, mail->mailbox_name, &err_code)) {
+                                               EM_DEBUG_EXCEPTION("emstorage_update_read_mail_uid failed [%d]", err_code);
                                                goto FINISH_OFF;
                                        }
-                                       
+
                                        EM_DEBUG_LOG("Mail MOVE SUCCESS ");
                                }
                        }
                        else
                                EM_DEBUG_EXCEPTION(">>>> Server MAIL ID IS NULL >>>> ");
                }
-               else {
-                       EM_DEBUG_EXCEPTION(">>>> STREAM DATA IS NULL >>> ");
-                       ret = 0;
-                       goto FINISH_OFF;
-               }
-       }
-
-       /* ret = true; */
-
-FINISH_OFF: 
-       if (stream) em_core_mailbox_close(account_id, stream);
-
-       if (mail != NULL)
-               em_storage_free_mail(&mail, 1, NULL);
-       EM_DEBUG_FUNC_END("ret [%d]", ret);             
-       return ret;
-}
-
-static int em_core_mail_save_file(int account_id, int mail_id, int attachment_id, char *src_file_path, char *file_name, char *full_path, int *err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("account_id[%d], mail_id[%d], attachment_id[%d] , file_name[%p] , full_path[%p] , err_code[%p]", account_id, mail_id, attachment_id, file_name, full_path, err_code);
-
-       int ret = false, err = EMF_ERROR_NONE;
-
-       if (!file_name || !full_path || !src_file_path) {
-               EM_DEBUG_EXCEPTION("Invalid paramter");
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-       
-       if (!em_storage_create_dir(account_id, mail_id, attachment_id, &err))  {
-               EM_DEBUG_EXCEPTION("em_storage_create_dir failed [%d]", err);
-               goto FINISH_OFF;
-       }
-       
-       if (!em_storage_get_save_name(account_id, mail_id, attachment_id, file_name, full_path, &err))  {
-               EM_DEBUG_EXCEPTION("em_storage_get_save_name failed [%d]", err);
-               goto FINISH_OFF;
-       }
-
-       if (strcmp(src_file_path, full_path) != 0)  {
-               if (!em_storage_copy_file(src_file_path, full_path, false, &err))  {
-                       EM_DEBUG_EXCEPTION("em_storage_copy_file failed [%d]", err);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
-                       goto FINISH_OFF;
-               }
-       }
-
-       ret = true;
-
-FINISH_OFF: 
-       if (err_code)
-               *err_code = err;
-       return 1;
-}
-
-/* description 
- *    update mail information
- * arguments  
- *    mailbox  :  mail box
- *    mail_id  :  mail id to be updated
- *    mail  :  updating mail header, body, flags, extra_flags
- * return  
- *    succeed  :  1
- *    fail  :  0
- */
-EXPORT_API int em_core_mail_update_old(int mail_id,  emf_mail_t *src_mail, emf_meeting_request_t *src_meeting_req,  int *err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("mail_id[%d], mail[%p], err_code[%p]", mail_id, src_mail, err_code);
-
-       int ret = false, err = EMF_ERROR_NONE;
-       int local_attachment_count = 0, local_inline_content_count = 0;
-       emf_mail_tbl_t mail_table_data = {0};
-       emf_attachment_info_t *attachment_info = NULL;
-       char filename_buf[1024] = {0, }, buf_date[512] = {0, }; 
-       char html_body[MAX_PATH] = {0, };
-       
-       if (!mail_id || !src_mail || !src_mail->info || !src_mail->head)  {     
-               EM_DEBUG_EXCEPTION("Invalid parameter");
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF2;
-       }
-       
-       mail_table_data.full_address_from    = src_mail->head->from;
-       mail_table_data.full_address_reply   = src_mail->head->reply_to;
-       mail_table_data.full_address_to      = src_mail->head->to;
-       mail_table_data.full_address_cc      = src_mail->head->cc;
-       mail_table_data.full_address_bcc     = src_mail->head->bcc;
-       mail_table_data.full_address_return  = src_mail->head->return_path;
-       mail_table_data.subject              = src_mail->head->subject;
-       mail_table_data.preview_text         = src_mail->head->previewBodyText ;
-       mail_table_data.body_download_status = src_mail->info->body_downloaded;
-       mail_table_data.mailbox_name         = NULL;    /*  UPDATE_MAIL type couldn't change mailbox.  */
-       mail_table_data.priority             = src_mail->info->extra_flags.priority;
-       mail_table_data.report_status        = src_mail->info->extra_flags.report;
-       mail_table_data.save_status          = src_mail->info->extra_flags.status;
-       mail_table_data.lock_status          = src_mail->info->extra_flags.lock;
-       mail_table_data.DRM_status           = src_mail->info->extra_flags.drm;
-       mail_table_data.mail_size                        = src_mail->info->rfc822_size;
-
-       if(mail_table_data.mail_size == 0)
-               mail_table_data.mail_size = em_core_get_mail_size(src_mail, &err);
-
-       if (!mail_table_data.full_address_from)  {
-               emf_account_t *ref_account = NULL;
-               if (!(ref_account = em_core_get_account_reference(src_mail->info->account_id)))  {
-                       EM_DEBUG_EXCEPTION("em_core_get_account_reference failed [%d]", src_mail->info->account_id);
-                       err = EMF_ERROR_INVALID_ACCOUNT;
-                       goto FINISH_OFF2;
-               }
-               mail_table_data.full_address_from = ref_account->email_addr;
-       }
-
-       if(!em_convert_mail_flag_to_mail_tbl(&(src_mail->info->flags), &mail_table_data, &err)) {
-               EM_DEBUG_EXCEPTION("em_convert_mail_flag_to_mail_tbl failed [%d]", err);
-               goto FINISH_OFF2;
-       }
-       
-       if (src_mail->body && src_mail->body->plain)  {   /*  Save plain text body. */
-               if (!em_core_mail_save_file(src_mail->info->account_id, mail_id, 0, src_mail->body->plain, src_mail->body->plain_charset ? src_mail->body->plain_charset  :  "UTF-8", filename_buf, &err)) {
-                       EM_DEBUG_EXCEPTION("em_core_mail_save_file failed [%d]", err);
-                       goto FINISH_OFF2;
-               }
-               mail_table_data.file_path_plain = EM_SAFE_STRDUP(filename_buf);
-       } 
-       else 
-               mail_table_data.file_path_plain = NULL;
-       
-       if (src_mail->body && src_mail->body->html)  {   /*  Save HTML text body. */
-               if (src_mail->body->plain_charset != NULL && src_mail->body->plain_charset[0] != '\0') {
-                       memcpy(html_body, src_mail->body->plain_charset, strlen(src_mail->body->plain_charset));
-                       strcat(html_body, ".htm");
-               }
-               else
-                       memcpy(html_body, "UTF-8.htm", strlen("UTF-8.htm"));
-               if (!em_core_mail_save_file(src_mail->info->account_id, mail_id, 0, src_mail->body->html, html_body, filename_buf, &err)) {
-                       EM_DEBUG_EXCEPTION("em_core_mail_save_file failed [%d]", err);
-                       goto FINISH_OFF2;
-               }
-               mail_table_data.file_path_html = EM_SAFE_STRDUP(filename_buf);
-       } 
-       else 
-               mail_table_data.file_path_html = NULL;
-       
-       if (src_mail->body && src_mail->body->attachment)  {
-               int compare_result = 1;
-               char attachment_id[20];
-
-               attachment_info = src_mail->body->attachment;
-               do  {
-                       if (!em_core_mail_compare_filename_of_attachment(mail_id, attachment_info->attachment_id, attachment_info, &compare_result, &err)) {
-                               EM_DEBUG_EXCEPTION("em_core_mail_compare_filename_of_attachment failed [%d]", err);
-                               compare_result = 1;
-                       }
-       
-                       if (compare_result == 0) {
-                               EM_DEBUG_LOG("file name and attachment id are same, update exising attachment");
-                               if (!em_core_mail_update_attachment(mail_id, attachment_info, &err))  {
-                                       EM_DEBUG_EXCEPTION("em_core_mail_update_attachment failed [%d]", err);
-                                       goto FINISH_OFF2;
-                               }
-                       }
-                       else {
-                               EM_DEBUG_LOG("save names are different");
-                               SNPRINTF(attachment_id, sizeof(attachment_id), "%d", attachment_info->attachment_id);
-                       
-                               if(attachment_info->attachment_id > 0) {
-                                       if (!em_core_mail_delete_attachment(mail_id, attachment_id, &err)) {
-                                               EM_DEBUG_EXCEPTION("em_core_mail_delete_attachment failed [%d]", err);
-                                               goto FINISH_OFF2;
-                                       }
-                               }
-
-                               if (!em_core_mail_add_attachment(mail_id, attachment_info, &err))  {
-                                       EM_DEBUG_EXCEPTION("em_core_mail_add_attachment failed [%d]", err);
-                                       goto FINISH_OFF2;
-                               }
-                       }
-
-                       if (attachment_info->inline_content)
-                               local_inline_content_count++;
-                       local_attachment_count++;
-                       attachment_info = attachment_info->next;
-               }
-               while (attachment_info != NULL);
-       }
-       
-       mail_table_data.attachment_count     = local_attachment_count;
-       mail_table_data.inline_content_count = local_inline_content_count;
-       
-       if (!src_mail->head->datetime.year && !src_mail->head->datetime.month && !src_mail->head->datetime.day)  {
-               time_t t = time(NULL);  
-               struct tm *p_tm = localtime(&t);
-               
-               if (!p_tm)  {
-                       EM_DEBUG_EXCEPTION("localtime failed...");
-                       err = EM_STORAGE_ERROR_SYSTEM_FAILURE;
-                       goto FINISH_OFF2;
-               }
-               
-               SNPRINTF(buf_date, sizeof(buf_date), "%04d%02d%02d%02d%02d%02d", 
-                       p_tm->tm_year + 1900, 
-                       p_tm->tm_mon + 1, 
-                       p_tm->tm_mday, 
-                       p_tm->tm_hour, 
-                       p_tm->tm_min, 
-                       p_tm->tm_sec);
-       }
-       else  {
-               SNPRINTF(buf_date, sizeof(buf_date), "%04d%02d%02d%02d%02d%02d", 
-                       src_mail->head->datetime.year, 
-                       src_mail->head->datetime.month, 
-                       src_mail->head->datetime.day, 
-                       src_mail->head->datetime.hour, 
-                       src_mail->head->datetime.minute, 
-                       src_mail->head->datetime.second);
-       }
-       
-       mail_table_data.datetime = buf_date;
-       
-       EM_DEBUG_LOG("preview_text[%p]", mail_table_data.preview_text);
-       if (mail_table_data.preview_text == NULL) {
-               if ( (err = em_core_get_preview_text_from_file(mail_table_data.file_path_plain, mail_table_data.file_path_html, MAX_PREVIEW_TEXT_LENGTH, &(mail_table_data.preview_text))) != EMF_ERROR_NONE) {
-                       EM_DEBUG_EXCEPTION("em_core_get_preview_text_from_file failed[%d]", err);
-                       goto FINISH_OFF2;
+               else {
+                       EM_DEBUG_EXCEPTION(">>>> STREAM DATA IS NULL >>> ");
+                       ret = 0;
+                       goto FINISH_OFF;
                }
        }
 
-       mail_table_data.meeting_request_status = src_mail->info->is_meeting_request;
+       /* ret = true; */
 
-       /*  BEGIN TRANSACTION; */
-       em_storage_begin_transaction(NULL, NULL, NULL);
-       
-       if (!em_storage_change_mail_field(mail_id, UPDATE_MAIL, &mail_table_data, false, &err))  {
-               EM_DEBUG_EXCEPTION("em_storage_change_mail_field failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+FINISH_OFF:
+       if (stream) emcore_close_mailbox(account_id, stream);
+
+       if (mail != NULL)
+               emstorage_free_mail(&mail, 1, NULL);
+       EM_DEBUG_FUNC_END("ret [%d]", ret);
+       return ret;
+}
+
+static int emcore_save_mail_file(int account_id, int mail_id, int attachment_id, char *src_file_path, char *file_name, char *full_path, int *err_code)
+{
+       EM_DEBUG_FUNC_BEGIN("account_id[%d], mail_id[%d], attachment_id[%d] , file_name[%p] , full_path[%p] , err_code[%p]", account_id, mail_id, attachment_id, file_name, full_path, err_code);
+
+       int ret = false, err = EMF_ERROR_NONE;
+
+       if (!file_name || !full_path || !src_file_path) {
+               EM_DEBUG_EXCEPTION("Invalid paramter");
+               err = EMF_ERROR_INVALID_PARAM;
                goto FINISH_OFF;
        }
-       
-       if (src_mail->info->is_meeting_request == EMF_MAIL_TYPE_MEETING_REQUEST
-               || src_mail->info->is_meeting_request == EMF_MAIL_TYPE_MEETING_RESPONSE
-               || src_mail->info->is_meeting_request == EMF_MAIL_TYPE_MEETING_ORIGINATINGREQUEST) {
-               emf_meeting_request_t *meeting_req = NULL;
-               /*  check where there is a meeting request in DB */
-               if (!em_storage_get_meeting_request(mail_id, &meeting_req, false, &err) && err != EM_STORAGE_ERROR_DATA_NOT_FOUND) {
-                       EM_DEBUG_EXCEPTION("em_storage_get_meeting_request failed [%d]", err);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
-                       goto FINISH_OFF;
-               }
-               EM_SAFE_FREE(meeting_req);
-               if (err == EM_STORAGE_ERROR_DATA_NOT_FOUND) {   /*  insert */
-                       emf_mail_tbl_t *original_mail = NULL;
-                       
-                       if (!em_storage_get_mail_by_id(mail_id, &original_mail, false, &err)) {
-                               EM_DEBUG_EXCEPTION("em_storage_get_mail_by_id failed [%d]", err);
-                               err = em_storage_get_emf_error_from_em_storage_error(err);
-                               goto FINISH_OFF;
-                       }
-                               
-                       if (original_mail)       {
-                       if (!em_storage_add_meeting_request(src_mail->info->account_id, original_mail->mailbox_name, src_meeting_req, false, &err))  {
-                               EM_DEBUG_EXCEPTION("em_storage_add_meeting_request failed [%d]", err);
-                               err = em_storage_get_emf_error_from_em_storage_error(err);
-                               goto FINISH_OFF;
-                       }       
-                               em_storage_free_mail(&original_mail, 1, NULL);
-               }
-               }
-               else {  /*  update */
-                       if (!em_storage_update_meeting_request(src_meeting_req, false, &err))  {
-                               EM_DEBUG_EXCEPTION("em_storage_update_meeting_request failed [%d]", err);
-                               err = em_storage_get_emf_error_from_em_storage_error(err);
-                               goto FINISH_OFF;
-                       }
-               }
+
+       if (!emstorage_create_dir(account_id, mail_id, attachment_id, &err))  {
+               EM_DEBUG_EXCEPTION("emstorage_create_dir failed [%d]", err);
+               goto FINISH_OFF;
        }
        
-       ret = true;
-       
-FINISH_OFF: 
-       if (ret == true) {      /*  COMMIT TRANSACTION; */
-               if (em_storage_commit_transaction(NULL, NULL, NULL) == false) {
-                       err = em_storage_get_emf_error_from_em_storage_error(EM_STORAGE_ERROR_DB_FAILURE);
-                       ret = false;
+       if (!emstorage_get_save_name(account_id, mail_id, attachment_id, file_name, full_path, &err))  {
+               EM_DEBUG_EXCEPTION("emstorage_get_save_name failed [%d]", err);
+               goto FINISH_OFF;
+       }
+
+       if (strcmp(src_file_path, full_path) != 0)  {
+               if (!emstorage_copy_file(src_file_path, full_path, false, &err))  {
+                       EM_DEBUG_EXCEPTION("emstorage_copy_file failed [%d]", err);
+
+                       goto FINISH_OFF;
                }
-               /*  publish a notification  :  to Active Sync Engine */
-               if (!em_storage_notify_storage_event(NOTI_MAIL_UPDATE, src_mail->info->account_id, mail_id, NULL, UPDATE_MEETING))
-                       EM_DEBUG_EXCEPTION(" em_storage_notify_storage_event failed [ NOTI_MAIL_UPDATE  :  UPDATE_MEETING_RESPONSE ] >>>> ");
        }
-       else {  /*  ROLLBACK TRANSACTION; */
-               if (em_storage_rollback_transaction(NULL, NULL, NULL) == false)
-                       err = em_storage_get_emf_error_from_em_storage_error(EM_STORAGE_ERROR_DB_FAILURE);
-       }       
-       
-FINISH_OFF2: 
 
-       EM_SAFE_FREE(mail_table_data.file_path_plain);
-       EM_SAFE_FREE(mail_table_data.file_path_html);
+       ret = true;
 
-       if (err_code != NULL)
+FINISH_OFF:
+       if (err_code)
                *err_code = err;
-       EM_DEBUG_FUNC_END("ret [%d]", ret);             
-       return ret;
+       return 1;
 }
 
-
-/* description 
+/* description
  *    update mail information
- *    'em_core_mail_update_old' will be replaced with this function.
  */
-EXPORT_API int em_core_update_mail(emf_mail_data_t *input_mail_data, emf_attachment_data_t *input_attachment_data_list, int input_attachment_count, emf_meeting_request_t* input_meeting_request, int input_sync_server)
+INTERNAL_FUNC int emcore_update_mail(emf_mail_data_t *input_mail_data, emf_attachment_data_t *input_attachment_data_list, int input_attachment_count, emf_meeting_request_t* input_meeting_request, int input_from_eas)
 {
-       EM_DEBUG_FUNC_BEGIN("input_mail_data[%p], input_attachment_data_list[%p], input_attachment_count[%d], input_meeting_request[%p], input_sync_server[%d]", input_mail_data, input_attachment_data_list, input_attachment_count, input_meeting_request, input_sync_server);
+       EM_DEBUG_FUNC_BEGIN("input_mail_data[%p], input_attachment_data_list[%p], input_attachment_count[%d], input_meeting_request[%p], input_from_eas[%d]", input_mail_data, input_attachment_data_list, input_attachment_count, input_meeting_request, input_from_eas);
 
-       char            filename_buf[1024]         = {0, };
-       int             i                          = 0;
-       int             err                        = EMF_ERROR_NONE;
-       int             local_inline_content_count = 0;
-       emf_mail_tbl_t *converted_mail_tbl_data    = NULL;
-       struct stat     st_buf;
-       
-       
-       if (!input_mail_data || (input_attachment_count && !input_attachment_data_list) || (!input_attachment_count &&input_attachment_data_list))  {   
+       char                   filename_buf[1024]         = {0, };
+       int                    i                          = 0;
+       int                    err                        = EMF_ERROR_NONE;
+       int                    local_inline_content_count = 0;
+       emstorage_mail_tbl_t  *converted_mail_tbl_data    = NULL;
+       emf_meeting_request_t *meeting_req = NULL;
+       struct stat            st_buf;
+
+       if (!input_mail_data || (input_attachment_count && !input_attachment_data_list) || (!input_attachment_count &&input_attachment_data_list))  {
                EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
                err = EMF_ERROR_INVALID_PARAM;
                goto FINISH_OFF2;
        }
 
-       if(input_sync_server) {
+       if(input_from_eas == 0) {
                if (input_mail_data->file_path_plain)  {
                        if (stat(input_mail_data->file_path_plain, &st_buf) < 0)  {
                                EM_DEBUG_EXCEPTION("input_mail_data->file_path_plain, stat(\"%s\") failed...", input_mail_data->file_path_plain);
@@ -5687,7 +4774,7 @@ EXPORT_API int em_core_update_mail(emf_mail_data_t *input_mail_data, emf_attachm
                                if (input_attachment_data_list[i].save_status) {
                                        if (!input_attachment_data_list[i].attachment_path || stat(input_attachment_data_list[i].attachment_path, &st_buf) < 0)  {
                                                EM_DEBUG_EXCEPTION("stat(\"%s\") failed...", input_attachment_data_list[i].attachment_path);
-                                               err = EMF_ERROR_INVALID_ATTACHMENT;             
+                                               err = EMF_ERROR_INVALID_ATTACHMENT;
                                                goto FINISH_OFF;
                                        }
                                }
@@ -5696,13 +4783,13 @@ EXPORT_API int em_core_update_mail(emf_mail_data_t *input_mail_data, emf_attachm
        }
        
        if(input_mail_data->mail_size == 0) {
-                em_core_calc_mail_size(input_mail_data, input_attachment_data_list, input_attachment_count, &(input_mail_data->mail_size));
+                emcore_calc_mail_size(input_mail_data, input_attachment_data_list, input_attachment_count, &(input_mail_data->mail_size));
        }
 
        if (!input_mail_data->full_address_from)  {
                emf_account_t *ref_account = NULL;
-               if (!(ref_account = em_core_get_account_reference(input_mail_data->account_id)))  {
-                       EM_DEBUG_EXCEPTION("em_core_get_account_reference failed [%d]", input_mail_data->account_id);
+               if (!(ref_account = emcore_get_account_reference(input_mail_data->account_id)))  {
+                       EM_DEBUG_EXCEPTION("emcore_get_account_reference failed [%d]", input_mail_data->account_id);
                        err = EMF_ERROR_INVALID_ACCOUNT;
                        goto FINISH_OFF2;
                }
@@ -5710,22 +4797,22 @@ EXPORT_API int em_core_update_mail(emf_mail_data_t *input_mail_data, emf_attachm
        }
        
        if (input_mail_data->file_path_plain)  {   /*  Save plain text body. */
-               if (!em_core_mail_save_file(input_mail_data->account_id, input_mail_data->mail_id, 0, input_mail_data->file_path_plain, "UTF-8", filename_buf, &err)) {
-                       EM_DEBUG_EXCEPTION("em_core_mail_save_file failed [%d]", err);
+               if (!emcore_save_mail_file(input_mail_data->account_id, input_mail_data->mail_id, 0, input_mail_data->file_path_plain, "UTF-8", filename_buf, &err)) {
+                       EM_DEBUG_EXCEPTION("emcore_save_mail_file failed [%d]", err);
                        goto FINISH_OFF2;
                }
                EM_SAFE_FREE(input_mail_data->file_path_plain);
                input_mail_data->file_path_plain = EM_SAFE_STRDUP(filename_buf);
-       } 
+       }
        
        if (input_mail_data->file_path_html)  {   /*  Save HTML text body. */
-               if (!em_core_mail_save_file(input_mail_data->account_id, input_mail_data->mail_id, 0, input_mail_data->file_path_html, "UTF-8.htm", filename_buf, &err)) {
-                       EM_DEBUG_EXCEPTION("em_core_mail_save_file failed [%d]", err);
+               if (!emcore_save_mail_file(input_mail_data->account_id, input_mail_data->mail_id, 0, input_mail_data->file_path_html, "UTF-8.htm", filename_buf, &err)) {
+                       EM_DEBUG_EXCEPTION("emcore_save_mail_file failed [%d]", err);
                        goto FINISH_OFF2;
                }
                EM_SAFE_FREE(input_mail_data->file_path_html);
                input_mail_data->file_path_html = EM_SAFE_STRDUP(filename_buf);
-       } 
+       }
        
        if (input_attachment_data_list && input_attachment_count)  {
                int i = 0;
@@ -5735,31 +4822,31 @@ EXPORT_API int em_core_update_mail(emf_mail_data_t *input_mail_data, emf_attachm
 
                for(i = 0; i < input_attachment_count; i++) {
                        temp_attachment_data = input_attachment_data_list + i;
-                       if ( (err = em_core_mail_compare_filename_of_attachment_data(input_mail_data->mail_id, temp_attachment_data->attachment_id, temp_attachment_data, &compare_result)) != EMF_ERROR_NONE) {
-                               EM_DEBUG_EXCEPTION("em_core_mail_compare_filename_of_attachment failed [%d]", err);
+                       if ( (err = emcore_mail_compare_filename_of_attachment_data(input_mail_data->mail_id, temp_attachment_data->attachment_id, temp_attachment_data, &compare_result)) != EMF_ERROR_NONE) {
+                               EM_DEBUG_EXCEPTION("emcore_mail_compare_filename_of_attachment_data failed [%d]", err);
                                compare_result = 1;
                        }
        
                        if (compare_result == 0) {
                                EM_DEBUG_LOG("file name and attachment id are same, update exising attachment");
-                               if (!em_core_mail_update_attachment_data(input_mail_data->mail_id, temp_attachment_data))  {
-                                       EM_DEBUG_EXCEPTION("em_core_mail_update_attachment failed [%d]", err);
+                               if (!emcore_mail_update_attachment_data(input_mail_data->mail_id, temp_attachment_data))  {
+                                       EM_DEBUG_EXCEPTION("emcore_mail_update_attachment_data failed [%d]", err);
                                        goto FINISH_OFF2;
                                }
                        }
                        else {
                                EM_DEBUG_LOG("save names are different");
                                SNPRINTF(attachment_id, sizeof(attachment_id), "%d", temp_attachment_data->attachment_id);
-                       
+
                                if(temp_attachment_data->attachment_id > 0) {
-                                       if (!em_core_mail_delete_attachment(input_mail_data->mail_id, attachment_id, &err)) {
-                                               EM_DEBUG_EXCEPTION("em_core_mail_delete_attachment failed [%d]", err);
+                                       if (!emcore_delete_mail_attachment(input_mail_data->mail_id, attachment_id, &err)) {
+                                               EM_DEBUG_EXCEPTION("emcore_delete_mail_attachment failed [%d]", err);
                                                goto FINISH_OFF2;
                                        }
                                }
 
-                               if ( (err = em_core_mail_add_attachment_data(input_mail_data->mail_id, temp_attachment_data)) != EMF_ERROR_NONE)  {
-                                       EM_DEBUG_EXCEPTION("em_core_mail_add_attachment failed [%d]", err);
+                               if ( (err = emcore_mail_add_attachment_data(input_mail_data->mail_id, temp_attachment_data)) != EMF_ERROR_NONE)  {
+                                       EM_DEBUG_EXCEPTION("emcore_mail_add_attachment failed [%d]", err);
                                        goto FINISH_OFF2;
                                }
                        }
@@ -5772,19 +4859,15 @@ EXPORT_API int em_core_update_mail(emf_mail_data_t *input_mail_data, emf_attachm
        input_mail_data->attachment_count     = input_attachment_count;
        input_mail_data->inline_content_count = local_inline_content_count;
 
-       if (!input_mail_data->datetime)  {
+       if (!input_mail_data->date_time) {
                /* time isn't set */
-               input_mail_data->datetime = em_core_get_current_time_string(&err);
-               if(!input_mail_data->datetime) {
-                       EM_DEBUG_EXCEPTION("em_core_get_current_time_string failed [%d]", err);
-                       goto FINISH_OFF;
-               }
+               input_mail_data->date_time = time(NULL);
        }
 
        EM_DEBUG_LOG("preview_text[%p]", input_mail_data->preview_text);
        if (input_mail_data->preview_text == NULL) {
-               if ( (err =em_core_get_preview_text_from_file(input_mail_data->file_path_plain, input_mail_data->file_path_html, MAX_PREVIEW_TEXT_LENGTH, &(input_mail_data->preview_text))) != EMF_ERROR_NONE) {
-                       EM_DEBUG_EXCEPTION("em_core_get_preview_text_from_file failed[%d]", err);
+               if ( (err =emcore_get_preview_text_from_file(input_mail_data->file_path_plain, input_mail_data->file_path_html, MAX_PREVIEW_TEXT_LENGTH, &(input_mail_data->preview_text))) != EMF_ERROR_NONE) {
+                       EM_DEBUG_EXCEPTION("emcore_get_preview_text_from_file failed[%d]", err);
                        goto FINISH_OFF2;
                }
        }
@@ -5795,47 +4878,44 @@ EXPORT_API int em_core_update_mail(emf_mail_data_t *input_mail_data, emf_attachm
        }
        
        /*  BEGIN TRANSACTION; */
-       em_storage_begin_transaction(NULL, NULL, NULL);
+       emstorage_begin_transaction(NULL, NULL, NULL);
        
-       if (!em_storage_change_mail_field(input_mail_data->mail_id, UPDATE_MAIL, converted_mail_tbl_data, false, &err))  {
-               EM_DEBUG_EXCEPTION("em_storage_change_mail_field failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+       if (!emstorage_change_mail_field(input_mail_data->mail_id, UPDATE_MAIL, converted_mail_tbl_data, false, &err))  {
+               EM_DEBUG_EXCEPTION("emstorage_change_mail_field failed [%d]", err);
+
                goto FINISH_OFF;
        }
        
        if (input_mail_data->meeting_request_status == EMF_MAIL_TYPE_MEETING_REQUEST
                || input_mail_data->meeting_request_status == EMF_MAIL_TYPE_MEETING_RESPONSE
                || input_mail_data->meeting_request_status == EMF_MAIL_TYPE_MEETING_ORIGINATINGREQUEST) {
-               emf_meeting_request_t *meeting_req = NULL;
                /*  check where there is a meeting request in DB */
-               if (!em_storage_get_meeting_request(input_mail_data->mail_id, &meeting_req, false, &err) && err != EM_STORAGE_ERROR_DATA_NOT_FOUND) {
-                       EM_DEBUG_EXCEPTION("em_storage_get_meeting_request failed [%d]", err);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+               if (!emstorage_get_meeting_request(input_mail_data->mail_id, &meeting_req, false, &err) && err != EMF_ERROR_DATA_NOT_FOUND) {
+                       EM_DEBUG_EXCEPTION("emstorage_get_meeting_request failed [%d]", err);
                        goto FINISH_OFF;
                }
                EM_SAFE_FREE(meeting_req);
-               if (err == EM_STORAGE_ERROR_DATA_NOT_FOUND) {   /*  insert */
-                       emf_mail_tbl_t *original_mail = NULL;
-                       
-                       if (!em_storage_get_mail_by_id(input_mail_data->mail_id, &original_mail, false, &err)) {
-                               EM_DEBUG_EXCEPTION("em_storage_get_mail_by_id failed [%d]", err);
-                               err = em_storage_get_emf_error_from_em_storage_error(err);
+               if (err == EMF_ERROR_DATA_NOT_FOUND) {  /*  insert */
+                       emstorage_mail_tbl_t *original_mail = NULL;
+
+                       if (!emstorage_get_mail_by_id(input_mail_data->mail_id, &original_mail, false, &err)) {
+                               EM_DEBUG_EXCEPTION("emstorage_get_mail_by_id failed [%d]", err);
                                goto FINISH_OFF;
                        }
-                               
+
                        if (original_mail)       {
-                       if (!em_storage_add_meeting_request(input_mail_data->account_id, original_mail->mailbox_name, input_meeting_request, false, &err))  {
-                               EM_DEBUG_EXCEPTION("em_storage_add_meeting_request failed [%d]", err);
-                               err = em_storage_get_emf_error_from_em_storage_error(err);
+                       if (!emstorage_add_meeting_request(input_mail_data->account_id, original_mail->mailbox_name, input_meeting_request, false, &err))  {
+                               EM_DEBUG_EXCEPTION("emstorage_add_meeting_request failed [%d]", err);
+
                                goto FINISH_OFF;
-                       }       
-                               em_storage_free_mail(&original_mail, 1, NULL);
+                       }
+                               emstorage_free_mail(&original_mail, 1, NULL);
                }
                }
                else {  /*  update */
-                       if (!em_storage_update_meeting_request(input_meeting_request, false, &err))  {
-                               EM_DEBUG_EXCEPTION("em_storage_update_meeting_request failed [%d]", err);
-                               err = em_storage_get_emf_error_from_em_storage_error(err);
+                       if (!emstorage_update_meeting_request(input_meeting_request, false, &err))  {
+                               EM_DEBUG_EXCEPTION("emstorage_update_meeting_request failed [%d]", err);
+
                                goto FINISH_OFF;
                        }
                }
@@ -5844,44 +4924,48 @@ EXPORT_API int em_core_update_mail(emf_mail_data_t *input_mail_data, emf_attachm
 FINISH_OFF: 
        if (err == EMF_ERROR_NONE) {
                /*  COMMIT TRANSACTION; */
-               if (em_storage_commit_transaction(NULL, NULL, NULL) == false) {
-                       err = em_storage_get_emf_error_from_em_storage_error(EM_STORAGE_ERROR_DB_FAILURE);
+               if (emstorage_commit_transaction(NULL, NULL, NULL) == false) {
+                       err = EMF_ERROR_DB_FAILURE;
                }
 
-               if (input_meeting_request && !em_storage_notify_storage_event(NOTI_MAIL_UPDATE, input_mail_data->account_id, input_mail_data->mail_id, NULL, UPDATE_MEETING))
-                       EM_DEBUG_EXCEPTION(" em_storage_notify_storage_event failed [ NOTI_MAIL_UPDATE : UPDATE_MEETING_RESPONSE ] >>>> ");
+               if (input_mail_data->meeting_request_status && !emstorage_notify_storage_event(NOTI_MAIL_UPDATE, input_mail_data->account_id, input_mail_data->mail_id, NULL, UPDATE_MEETING))
+                       EM_DEBUG_EXCEPTION(" emstorage_notify_storage_event failed [ NOTI_MAIL_UPDATE : UPDATE_MEETING_RESPONSE ] >>>> ");
        }
-       else {  
+       else {
                /*  ROLLBACK TRANSACTION; */
-               if (em_storage_rollback_transaction(NULL, NULL, NULL) == false)
-                       err = em_storage_get_emf_error_from_em_storage_error(EM_STORAGE_ERROR_DB_FAILURE);
-       }       
+               if (emstorage_rollback_transaction(NULL, NULL, NULL) == false)
+                       err = EMF_ERROR_DB_FAILURE;
+       }
        
-FINISH_OFF2: 
+FINISH_OFF2:
+
+       if(meeting_req)
+               emstorage_free_meeting_request(&meeting_req, 1, NULL);
+
        if(converted_mail_tbl_data)
-               em_storage_free_mail(&converted_mail_tbl_data, 1, NULL);
+               emstorage_free_mail(&converted_mail_tbl_data, 1, NULL);
 
-       EM_DEBUG_FUNC_END("err [%d]", err);             
+       EM_DEBUG_FUNC_END("err [%d]", err);
        return err;
 }
 
-EXPORT_API int em_core_fetch_flags(int account_id, int mail_id, emf_mail_flag_t *mail_flag, int *err_code)
+INTERNAL_FUNC int emcore_fetch_flags(int account_id, int mail_id, emf_mail_flag_t *mail_flag, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
 
        int ret = false;
        int err = 0;
-       emf_mail_tbl_t *mail = NULL;
+       emstorage_mail_tbl_t *mail = NULL;
        
        EM_IF_NULL_RETURN_VALUE(mail_flag, false);
        if (account_id < FIRST_ACCOUNT_ID || mail_id < 1) {
-               EM_DEBUG_EXCEPTION("em_core_fetch_flags :  Invalid Param ");
+               EM_DEBUG_EXCEPTION("emcore_fetch_flags :  Invalid Param ");
                goto FINISH_OFF;
        }
 
-       if (!em_storage_get_mail_field_by_id(mail_id, RETRIEVE_FLAG, &mail, true, &err) || !mail)  {
-               EM_DEBUG_EXCEPTION("em_storage_get_mail_field_by_id failed - %d ", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+       if (!emstorage_get_mail_field_by_id(mail_id, RETRIEVE_FLAG, &mail, true, &err) || !mail)  {
+               EM_DEBUG_EXCEPTION("emstorage_get_mail_field_by_id failed - %d ", err);
+
                goto FINISH_OFF;
        }
 
@@ -5892,36 +4976,36 @@ EXPORT_API int em_core_fetch_flags(int account_id, int mail_id, emf_mail_flag_t
 
        ret = true;
 
-FINISH_OFF: 
+FINISH_OFF:
        if(mail)
-               em_storage_free_mail(&mail, 1, &err); 
+               emstorage_free_mail(&mail, 1, &err);
 
        if (err_code != NULL)
                *err_code = err;
 
-       EM_DEBUG_FUNC_END("err [%d]", err);             
+       EM_DEBUG_FUNC_END("err [%d]", err);
        return ret;
 }
 /* description :  modify flag of msgno.
    return 1(success), 0(failure)
    */
-EXPORT_API int em_core_mail_modify_flag(int mail_id, emf_mail_flag_t new_flag, int sticky_flag, int *err_code)
+INTERNAL_FUNC int emcore_modify_flag(int mail_id, emf_mail_flag_t new_flag, int sticky_flag, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("mail_id[%d], err_code[%p]", mail_id, err_code);
-       
+
        int ret = false;
        int err = EMF_ERROR_NONE;
        int old_seen, new_seen;
-       
-       emf_mail_tbl_t *mail = NULL;
+
+       emstorage_mail_tbl_t *mail = NULL;
        emf_mail_flag_t old_flag;
 
-       if (!em_storage_get_mail_field_by_id(mail_id, RETRIEVE_FLAG, &mail, true, &err) || !mail)  {
-               EM_DEBUG_EXCEPTION("em_storage_get_mail_field_by_id failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+       if (!emstorage_get_mail_field_by_id(mail_id, RETRIEVE_FLAG, &mail, true, &err) || !mail)  {
+               EM_DEBUG_EXCEPTION("emstorage_get_mail_field_by_id failed [%d]", err);
+
                goto FINISH_OFF;
        }
-       
+
        if (!em_convert_mail_tbl_to_mail_flag(mail, &old_flag, &err))  {
                EM_DEBUG_EXCEPTION("em_convert_mail_tbl_to_mail_flag failed [%d]", err);
                goto  FINISH_OFF;
@@ -5937,53 +5021,53 @@ EXPORT_API int em_core_mail_modify_flag(int mail_id, emf_mail_flag_t new_flag, i
 
                mail->lock_status = sticky_flag;
                
-       if (!em_storage_change_mail_field(mail_id, UPDATE_FLAG, mail, true, &err)) {
-                       EM_DEBUG_EXCEPTION("em_storage_change_mail_field failed [%d]", err);
+       if (!emstorage_change_mail_field(mail_id, UPDATE_FLAG, mail, true, &err)) {
+                       EM_DEBUG_EXCEPTION("emstorage_change_mail_field failed [%d]", err);
                
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+
                        goto FINISH_OFF;
                }
-       
+
        if (old_seen != new_seen && new_seen == 0)
-               em_core_delete_notification_for_read_mail(mail_id);
+               emcore_delete_notification_for_read_mail(mail_id);
 
-       em_core_check_unread_mail();
+       emcore_check_unread_mail();
 
        ret = true;
-       
-FINISH_OFF: 
+
+FINISH_OFF:
        if (mail)
-               em_storage_free_mail(&mail, 1, NULL);
-       
+               emstorage_free_mail(&mail, 1, NULL);
+
        if (err_code)
                *err_code = err;
-       EM_DEBUG_FUNC_END("err [%d]", err);     
+       EM_DEBUG_FUNC_END("err [%d]", err);
        return ret;
 }
 
-EXPORT_API int em_core_mail_set_flags_field(int account_id, int mail_ids[], int num, emf_flags_field_type field_type, int value, int *err_code)
+INTERNAL_FUNC int emcore_set_flags_field(int account_id, int mail_ids[], int num, emf_flags_field_type field_type, int value, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id [%d], mail_ids[%p], num [%d], field_type [%d], value[%d], err_code[%p]", account_id, mail_ids, num, field_type, value, err_code);
-       
+
        int ret = false;
        int err = EMF_ERROR_NONE;
        char *field_type_name[EMF_FLAGS_FIELD_COUNT] = { "flags_seen_field"
                , "flags_deleted_field", "flags_flagged_field", "flags_answered_field"
-               , "flags_recent_field", "flags_draft_field", "flags_forwarded_field" }; 
-       
+               , "flags_recent_field", "flags_draft_field", "flags_forwarded_field" };
+
        if(field_type < 0 || field_type >= EMF_FLAGS_FIELD_COUNT || mail_ids == NULL || num <= 0 || account_id == 0) {
                EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
                err = EMF_ERROR_INVALID_PARAM;
                        goto  FINISH_OFF;
                }
-       
-       if (!em_storage_set_field_of_mails_with_integer_value(account_id, mail_ids, num, field_type_name[field_type], value, true, &err)) {
-               EM_DEBUG_EXCEPTION("em_storage_set_field_of_mails_with_integer_value failed [%d]", err);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+
+       if (!emstorage_set_field_of_mails_with_integer_value(account_id, mail_ids, num, field_type_name[field_type], value, true, &err)) {
+               EM_DEBUG_EXCEPTION("emstorage_set_field_of_mails_with_integer_value failed [%d]", err);
+
                        goto FINISH_OFF;
                }
                
-               em_core_check_unread_mail();
+               emcore_check_unread_mail();
 
        ret = true;
        
@@ -5999,40 +5083,40 @@ FINISH_OFF:
 /* description :  modify extra flag of msgno.
    return 0(success), -1(failure)
    */
-EXPORT_API int em_core_mail_modify_extra_flag(int mail_id, emf_extra_flag_t new_flag, int *err_code)
+INTERNAL_FUNC int emcore_modify_extra_flag(int mail_id, emf_extra_flag_t new_flag, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("mail_id[%d], err_code[%p]", mail_id, err_code);
        
        int ret = false;
        int err = EMF_ERROR_NONE;
-       emf_mail_tbl_t mail;
+       emstorage_mail_tbl_t mail;
        
-       memset(&mail, 0x00, sizeof(emf_mail_tbl_t));
+       memset(&mail, 0x00, sizeof(emstorage_mail_tbl_t));
 
        mail.mail_id    = mail_id;
        mail.save_status = new_flag.status;
        mail.lock_status = new_flag.report;
-       mail.lock_status        = new_flag.lock;                
+       mail.lock_status        = new_flag.lock;
        mail.priority   = new_flag.priority;
        mail.DRM_status  = new_flag.drm;
 
-       if (!em_storage_change_mail_field(mail_id, UPDATE_EXTRA_FLAG, &mail, false, &err))  {
-               EM_DEBUG_EXCEPTION("em_storage_change_mail_field failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+       if (!emstorage_change_mail_field(mail_id, UPDATE_EXTRA_FLAG, &mail, false, &err))  {
+               EM_DEBUG_EXCEPTION("emstorage_change_mail_field failed [%d]", err);
+
                goto FINISH_OFF;
        }
        
        ret = true;
-       
-FINISH_OFF: 
+
+FINISH_OFF:
        if (err_code != NULL)
                *err_code = err;
-       EM_DEBUG_FUNC_END("err [%d]", err);     
+       EM_DEBUG_FUNC_END("err [%d]", err);
        return ret;
 }
 
 
-int em_core_mail_cmd_read_mail_pop3(void *stream, int msgno, int limited_size, int *downloded_size, int *result_total_body_size, int *err_code)
+int emcore_mail_cmd_read_mail_pop3(void *stream, int msgno, int limited_size, int *downloded_size, int *result_total_body_size, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("stream[%p], msgno[%d], limited_size[%d], err_code[%p]", stream, msgno, limited_size, err_code);
        
@@ -6058,7 +5142,7 @@ int em_core_mail_cmd_read_mail_pop3(void *stream, int msgno, int limited_size, i
        memset(command, 0x00, sizeof(command));
 
        SNPRINTF(command, sizeof(command), "LIST %d\015\012", msgno);
-       
+
 #ifdef FEATURE_CORE_DEBUG
        EM_DEBUG_LOG("[POP3] >>> [%s]", command);
 #endif
@@ -6067,16 +5151,16 @@ int em_core_mail_cmd_read_mail_pop3(void *stream, int msgno, int limited_size, i
        /*  send command  :  LIST [msgno] - to get the size of the mail */
        if (!net_sout(pop3local->netstream, command, (int)strlen(command)))  {
                EM_DEBUG_EXCEPTION("net_sout failed...");
-               
+
                err = EMF_ERROR_INVALID_RESPONSE;
                goto FINISH_OFF;
        }
 
        EM_DEBUG_LOG("Sending command success");
-       
+
        while (pop3local->netstream) {
                /*  receive response */
-               if (!(response = net_getline(pop3local->netstream))) 
+               if (!(response = net_getline(pop3local->netstream)))
                        break;
 
                if (response)
@@ -6094,7 +5178,7 @@ int em_core_mail_cmd_read_mail_pop3(void *stream, int msgno, int limited_size, i
                                err = EMF_ERROR_INVALID_RESPONSE;
                                goto FINISH_OFF;
                        }
-                       
+
                        total_body_size = atoi(p + 1);
                        EM_DEBUG_LOG("Body size [%d]", total_body_size);
 
@@ -6112,7 +5196,7 @@ int em_core_mail_cmd_read_mail_pop3(void *stream, int msgno, int limited_size, i
                        goto FINISH_OFF;
                }
 
-               EM_SAFE_FREE(response); 
+               EM_SAFE_FREE(response);
        }
 
        memset(command, 0x00, sizeof(command));
@@ -6125,25 +5209,25 @@ int em_core_mail_cmd_read_mail_pop3(void *stream, int msgno, int limited_size, i
                SNPRINTF(command, sizeof(command), "RETR %d", msgno);
 
        EM_DEBUG_LOG("[POP3] >>> %s", command);
-       
-       em_core_set_network_error(EMF_ERROR_NONE);              /*  set current network error as EMF_ERROR_NONE before network operation */
+
+       emcore_set_network_error(EMF_ERROR_NONE);               /*  set current network error as EMF_ERROR_NONE before network operation */
        /*  get mail from mail server */
        if (!pop3_send((MAILSTREAM *)stream, command, NULL))  {
                EM_DEBUG_EXCEPTION("pop3_send failed...");
-               
+
                emf_session_t *session = NULL;
                
-               if (!em_core_get_current_session(&session))  {
-                       EM_DEBUG_EXCEPTION("em_core_get_current_session failed...");
+               if (!emcore_get_current_session(&session))  {
+                       EM_DEBUG_EXCEPTION("emcore_get_current_session failed...");
                        err = EMF_ERROR_SESSION_NOT_FOUND;
                        goto FINISH_OFF;
                }
-               
+
                if (session->network == EMF_ERROR_NONE)
                        err = EMF_ERROR_UNKNOWN;
                else
                        err = session->network;
-               
+
                goto FINISH_OFF;
        }
 
@@ -6159,7 +5243,7 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int em_core_mail_sync_flag_with_server(int mail_id, int *err_code)
+INTERNAL_FUNC int emcore_sync_flag_with_server(int mail_id, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("mail_id[%p], err_code[%p]", mail_id, err_code);
                
@@ -6174,7 +5258,7 @@ EXPORT_API int em_core_mail_sync_flag_with_server(int mail_id, int *err_code)
        int status = EMF_DOWNLOAD_FAIL;
        MAILSTREAM *stream = NULL;
        emf_mailbox_t mbox = {0};
-       emf_mail_tbl_t *mail = NULL;
+       emstorage_mail_tbl_t *mail = NULL;
        emf_account_t *ref_account = NULL;
        int account_id = 0;
        int msgno = 0;
@@ -6183,40 +5267,40 @@ EXPORT_API int em_core_mail_sync_flag_with_server(int mail_id, int *err_code)
        char clear_flags[100] = { 0, };
        char tmp[100] = { 0, };
        
-       if (!em_core_check_thread_status())  {
+       if (!emcore_check_thread_status())  {
                err = EMF_ERROR_CANCELLED;
                goto FINISH_OFF;
        }
        
-       if (!em_storage_get_mail_by_id(mail_id, &mail, true, &err) || !mail)  {
-               EM_DEBUG_EXCEPTION("em_storage_get_mail_by_id failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+       if (!emstorage_get_mail_by_id(mail_id, &mail, true, &err) || !mail)  {
+               EM_DEBUG_EXCEPTION("emstorage_get_mail_by_id failed [%d]", err);
+
                goto FINISH_OFF;
        }
-       
+
        account_id = mail->account_id;
        em_convert_mail_tbl_to_mail_flag(mail, &new_flag, NULL);
-       
-       if (!(ref_account = em_core_get_account_reference(account_id)))   {
-               EM_DEBUG_EXCEPTION("em_core_get_account_reference failed [%d]", account_id);
+
+       if (!(ref_account = emcore_get_account_reference(account_id)))   {
+               EM_DEBUG_EXCEPTION("emcore_get_account_reference failed [%d]", account_id);
                err = EMF_ERROR_INVALID_ACCOUNT;
                goto FINISH_OFF;
        }
        
-       if (!em_core_check_thread_status())  {
+       if (!emcore_check_thread_status())  {
                err = EMF_ERROR_CANCELLED;
                goto FINISH_OFF;
        }
-       
+
        /*  open mail server. */
-       if (!em_core_mailbox_open(account_id, mail->mailbox_name, (void **)&stream, &err) || !stream)  {
-               EM_DEBUG_EXCEPTION("em_core_mailbox_open failed [%d]", err);
+       if (!emcore_connect_to_remote_mailbox(account_id, mail->mailbox_name, (void **)&stream, &err) || !stream)  {
+               EM_DEBUG_EXCEPTION("emcore_connect_to_remote_mailbox failed [%d]", err);
                status = EMF_LIST_CONNECTION_FAIL;
                goto FINISH_OFF;
        }
-                       
-       
-       if (!em_core_check_thread_status())  {
+
+
+       if (!emcore_check_thread_status())  {
                err = EMF_ERROR_CANCELLED;
                goto FINISH_OFF;
        }
@@ -6226,8 +5310,8 @@ EXPORT_API int em_core_mail_sync_flag_with_server(int mail_id, int *err_code)
        mbox.mail_stream = stream;
 
        /*  download all uids from server. */
-       if (!em_core_mail_get_msgno_by_uid(ref_account, &mbox, mail->server_mail_id, &msgno, &err))  {
-               EM_DEBUG_EXCEPTION("em_core_mail_get_msgno_by_uid failed message_no  :  %d ", err);
+       if (!emcore_get_mail_msgno_by_uid(ref_account, &mbox, mail->server_mail_id, &msgno, &err))  {
+               EM_DEBUG_EXCEPTION("emcore_get_mail_msgno_by_uid failed message_no  :  %d ", err);
                goto FINISH_OFF;
        }
                
@@ -6275,19 +5359,19 @@ EXPORT_API int em_core_mail_sync_flag_with_server(int mail_id, int *err_code)
                }
        }
 
-       EM_DEBUG_LOG(">>>> Returning from em_core_mail_sync_flag_with_server ");
+       EM_DEBUG_LOG(">>>> Returning from emcore_sync_flag_with_server ");
 
-       if (!em_core_check_thread_status())  {
+       if (!emcore_check_thread_status())  {
                err = EMF_ERROR_CANCELLED;
                goto FINISH_OFF;
        }
-       
+
        ret = true;
 
 FINISH_OFF: 
        
-       if (stream) em_core_mailbox_close(account_id, stream);
-       if (mail) em_storage_free_mail(&mail, 1, NULL);
+       if (stream) emcore_close_mailbox(account_id, stream);
+       if (mail) emstorage_free_mail(&mail, 1, NULL);
 
        if (err_code != NULL)
                *err_code = err;
@@ -6295,22 +5379,22 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_core_mail_sync_seen_flag_with_server(int mail_ids[], int num, int *err_code)
+INTERNAL_FUNC int emcore_sync_seen_flag_with_server(int mail_ids[], int num, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("mail_ids[%p], err_code[%p]", mail_ids[0], err_code);
-               
+
        if (mail_ids[0] < 1)  {
                if (err_code != NULL)
                        *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
-       
+
        int ret = false;
        int err = EMF_ERROR_NONE;
        int status = EMF_DOWNLOAD_FAIL;
        MAILSTREAM *stream = NULL;
        emf_mailbox_t mbox;
-       emf_mail_tbl_t *mail = NULL;
+       emstorage_mail_tbl_t *mail = NULL;
        emf_account_t *ref_account = NULL;
        int account_id = 0;
        int msgno = 0;
@@ -6320,61 +5404,61 @@ EXPORT_API int em_core_mail_sync_seen_flag_with_server(int mail_ids[], int num,
        char tmp[100];
        int mail_id = 0;
        int i = 0;
-       
+
        memset(&mbox, 0x00, sizeof(emf_mailbox_t));
 
        mail_id = mail_ids[0];
-       
-       if (!em_storage_get_mail_by_id(mail_id, &mail, true, &err) || !mail)  {
-               EM_DEBUG_EXCEPTION("em_storage_get_mail_by_id failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+
+       if (!emstorage_get_mail_by_id(mail_id, &mail, true, &err) || !mail)  {
+               EM_DEBUG_EXCEPTION("emstorage_get_mail_by_id failed [%d]", err);
+
                goto FINISH_OFF;
        }
 
        account_id = mail->account_id;
 
-       if (!(ref_account = em_core_get_account_reference(account_id)))   {
-               EM_DEBUG_EXCEPTION("em_core_get_account_reference failed [%d]", account_id);
+       if (!(ref_account = emcore_get_account_reference(account_id)))   {
+               EM_DEBUG_EXCEPTION("emcore_get_account_reference failed [%d]", account_id);
                err = EMF_ERROR_INVALID_ACCOUNT;
                goto FINISH_OFF;
        }
        
        /*  open mail server. */
-       if (!em_core_mailbox_open(account_id, mail->mailbox_name, (void **)&stream, &err) || !stream)  {
-               EM_DEBUG_EXCEPTION("em_core_mailbox_open failed [%d]", err);
+       if (!emcore_connect_to_remote_mailbox(account_id, mail->mailbox_name, (void **)&stream, &err) || !stream)  {
+               EM_DEBUG_EXCEPTION("emcore_connect_to_remote_mailbox failed [%d]", err);
                status = EMF_LIST_CONNECTION_FAIL;
                goto FINISH_OFF;
        }
 
-       mbox.name = mail->mailbox_name; 
+       mbox.name = mail->mailbox_name;
        mbox.account_id = account_id;
        mbox.mail_stream = stream;
        
        for (i = 0; i < num; i++)  {
                mail_id = mail_ids[i];
        
-               if (!em_core_check_thread_status())  {
+               if (!emcore_check_thread_status())  {
                        err = EMF_ERROR_CANCELLED;
                        goto FINISH_OFF;
                }
-               
-               if (!em_storage_get_mail_by_id(mail_id, &mail, true, &err) || !mail)  {
-                       EM_DEBUG_EXCEPTION("em_storage_get_mail_by_id failed [%d]", err);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+
+               if (!emstorage_get_mail_by_id(mail_id, &mail, true, &err) || !mail)  {
+                       EM_DEBUG_EXCEPTION("emstorage_get_mail_by_id failed [%d]", err);
+       
                        goto FINISH_OFF;
                }
                
                /* account_id = mail->account_id; */
                em_convert_mail_tbl_to_mail_flag(mail, &new_flag, NULL);
                
-               if (!em_core_check_thread_status())  {
+               if (!emcore_check_thread_status())  {
                        err = EMF_ERROR_CANCELLED;
                        goto FINISH_OFF;
                }
 
                /*  download message number from server. */
-               if (!em_core_mail_get_msgno_by_uid(ref_account, &mbox, mail->server_mail_id, &msgno, &err))  {
-                       EM_DEBUG_LOG("em_core_mail_get_msgno_by_uid failed message_no  :  %d ", err);
+               if (!emcore_get_mail_msgno_by_uid(ref_account, &mbox, mail->server_mail_id, &msgno, &err))  {
+                       EM_DEBUG_LOG("emcore_get_mail_msgno_by_uid failed message_no  :  %d ", err);
                        goto FINISH_OFF;
                }
                
@@ -6400,164 +5484,28 @@ EXPORT_API int em_core_mail_sync_seen_flag_with_server(int mail_ids[], int num,
                        mail_clearflag(stream, tmp, clear_flags);
                        EM_DEBUG_LOG(">>>> End mail_clearflag ");
                }
-                       
-               EM_DEBUG_LOG(">>>> Returning from em_core_mail_sync_flag_with_server ");
 
-               if (!em_core_check_thread_status())  {
+               EM_DEBUG_LOG(">>>> Returning from emcore_sync_flag_with_server ");
+
+               if (!emcore_check_thread_status())  {
                        err = EMF_ERROR_CANCELLED;
                        goto FINISH_OFF;
                }
        }
        ret = true;
 
-FINISH_OFF: 
+FINISH_OFF:
        
-       if (stream) em_core_mailbox_close(account_id, stream);
-       if (mail) em_storage_free_mail(&mail, 1, NULL);
+       if (stream) emcore_close_mailbox(account_id, stream);
+       if (mail) emstorage_free_mail(&mail, 1, NULL);
 
        if (err_code != NULL)
                *err_code = err;
-       EM_DEBUG_FUNC_END("err [%d]", err);     
+       EM_DEBUG_FUNC_END("err [%d]", err);
        return ret;
 }
 
-
-
-EXPORT_API int em_core_mail_info_free(emf_mail_info_t **mail_info_list, int count, int *err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("mail_info_list[%p], count[%d], err_code[%p]", mail_info_list, count, err_code);    
-       
-       if (count > 0)  {
-               if (!mail_info_list || !*mail_info_list)  {
-                       EM_DEBUG_EXCEPTION("mail_info_list[%p]", mail_info_list);
-                       if (err_code != NULL)
-                               *err_code = EMF_ERROR_INVALID_PARAM;
-                       return false;
-               }
-               
-               emf_mail_info_t *p = *mail_info_list;
-               int i = 0;
-               
-               for (; i < count; i++) 
-                       EM_SAFE_FREE(p[i].sid);
-               
-               free(p); 
-               *mail_info_list = NULL;
-       }
-       
-       if (err_code != NULL)
-               *err_code = EMF_ERROR_NONE;
-       EM_DEBUG_FUNC_END();
-       return true;
-}
-
-EXPORT_API int em_core_mail_head_free(emf_mail_head_t **mail_head_list, int count, int *err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("mail_head_list[%p], count[%d], err_code[%p]", mail_head_list, count, err_code);
-       EM_PROFILE_BEGIN(emCoreMailHeadeFree);
-       
-       if (count > 0)  {
-               if (!mail_head_list || !*mail_head_list)  {
-                       EM_DEBUG_EXCEPTION("mail_head_list[%p], count[%d]", mail_head_list, count);
-                       
-                       if (err_code != NULL)
-                               *err_code = EMF_ERROR_INVALID_PARAM;
-                       return false;
-               }
-               
-               int i;
-               emf_mail_head_t *p = *mail_head_list;
-               
-               for (i = 0; i < count; i++)  {
-                       EM_SAFE_FREE(p[i].mid);
-                       EM_SAFE_FREE(p[i].subject);
-                       EM_SAFE_FREE(p[i].to);
-                       EM_SAFE_FREE(p[i].from);
-                       EM_SAFE_FREE(p[i].cc);
-                       EM_SAFE_FREE(p[i].bcc);
-                       EM_SAFE_FREE(p[i].reply_to);
-                       EM_SAFE_FREE(p[i].return_path);
-                       EM_SAFE_FREE(p[i].previewBodyText);
-               }
-               
-               free(p); *mail_head_list = NULL;
-       }
-       
-       if (err_code != NULL)
-               *err_code = EMF_ERROR_NONE;
-       
-       EM_PROFILE_END(emCoreMailHeadeFree);
-       EM_DEBUG_FUNC_END();
-       return true;
-}
-
-EXPORT_API int em_core_mail_body_free(emf_mail_body_t **mail_body_list, int count, int *err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("mail_body_list[%p], count[%d], err_code[%p]", mail_body_list, count, err_code);    
-       
-       if (count > 0)  {
-               if (!mail_body_list || !*mail_body_list)  {
-                       EM_DEBUG_EXCEPTION("mail_body_list[%p]", mail_body_list);
-                       if (err_code != NULL)
-                               *err_code = EMF_ERROR_INVALID_PARAM;
-                       return false;
-               }
-               
-               emf_mail_body_t *p = *mail_body_list;
-               int i = 0;
-               
-               for (; i < count; i++)  {
-                       EM_SAFE_FREE(p[i].plain);
-                       EM_SAFE_FREE(p[i].plain_charset);
-                       EM_SAFE_FREE(p[i].html);
-                       if (p[i].attachment) em_core_mail_attachment_info_free(&p[i].attachment, NULL);
-               }
-               
-               free(p); *mail_body_list = NULL;
-       }
-       
-       if (err_code != NULL)
-               *err_code = EMF_ERROR_NONE;
-       EM_DEBUG_FUNC_END();
-       return true;
-}
-
-EXPORT_API int em_core_mail_free(emf_mail_t **mail_list, int count, int *err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("mail_list[%p], count[%d], err_code[%p]", mail_list, count, err_code);
-       
-       if (count > 0)  {
-               if (!mail_list || !*mail_list)  {
-                       EM_DEBUG_EXCEPTION("mail_list[%p], count[%d]", mail_list, count);
-                       if (err_code != NULL)
-                               *err_code = EMF_ERROR_INVALID_PARAM;
-                       return false;
-               }
-               
-               emf_mail_t *p = *mail_list;
-               int i = 0;
-               
-               for (; i < count; i++)  {
-                       if (p[i].info) 
-                               em_core_mail_info_free(&p[i].info, 1, NULL);
-                       
-                       if (p[i].head)
-                               em_core_mail_head_free(&p[i].head, 1, NULL);
-                       
-                       if (p[i].body)
-                               em_core_mail_body_free(&p[i].body, 1, NULL);
-               }
-               
-               free(p); *mail_list = NULL;
-       }
-
-       if (err_code != NULL)
-               *err_code = EMF_ERROR_NONE;
-       EM_DEBUG_FUNC_END();
-       return true;
-}
-
-EXPORT_API int em_core_free_mail_data(emf_mail_data_t **mail_list, int count, int *err_code)
+INTERNAL_FUNC int emcore_free_mail_data(emf_mail_data_t **mail_list, int count, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("mail_list[%p], count[%d]", mail_list, count);
        
@@ -6574,7 +5522,6 @@ EXPORT_API int em_core_free_mail_data(emf_mail_data_t **mail_list, int count, in
        for (i = 0; i < count; i++) {
                EM_SAFE_FREE(p[i].mailbox_name);
                EM_SAFE_FREE(p[i].subject);
-               EM_SAFE_FREE(p[i].datetime);
                EM_SAFE_FREE(p[i].server_mailbox_name);
                EM_SAFE_FREE(p[i].server_mail_id);
                EM_SAFE_FREE(p[i].message_id);
@@ -6603,7 +5550,7 @@ EXPORT_API int em_core_free_mail_data(emf_mail_data_t **mail_list, int count, in
 }
 
 
-EXPORT_API int em_core_mail_attachment_info_free(emf_attachment_info_t **atch_info, int *err_code)
+INTERNAL_FUNC int emcore_free_attachment_info(emf_attachment_info_t **atch_info, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("atch_info[%p], err_code[%p]", atch_info, err_code);        
        
@@ -6631,7 +5578,7 @@ EXPORT_API int em_core_mail_attachment_info_free(emf_attachment_info_t **atch_in
 }
 
 
-EXPORT_API int em_core_free_attachment_data(emf_attachment_data_t **attachment_data_list, int attachment_data_count, int *err_code)
+INTERNAL_FUNC int emcore_free_attachment_data(emf_attachment_data_t **attachment_data_list, int attachment_data_count, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("attachment_data_list[%p], attachment_data_count [%d], err_code[%p]", attachment_data_list, attachment_data_count, err_code);       
        
@@ -6663,26 +5610,26 @@ EXPORT_API int em_core_free_attachment_data(emf_attachment_data_t **attachment_d
 
 #ifdef __FEATURE_PARTIAL_BODY_DOWNLOAD__
 
-EXPORT_API int em_core_delete_pbd_activity(int account_id, int mail_id, int activity_id, int *err_code) 
+INTERNAL_FUNC int emcore_delete_pbd_activity(int account_id, int mail_id, int activity_id, int *err_code) 
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], mail_id[%d], err_code[%p]", account_id, mail_id, err_code);
 
        if (account_id < FIRST_ACCOUNT_ID || mail_id < 0) {
                EM_DEBUG_EXCEPTION("account_id[%d], mail_id[%d], err_code[%p]", account_id, mail_id, err_code);
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
 
        int ret = false;
        int err = EMF_ERROR_NONE;
        
-       em_storage_begin_transaction(NULL, NULL, NULL);
+       emstorage_begin_transaction(NULL, NULL, NULL);
        
-       if (!em_storage_delete_pbd_activity(account_id, mail_id, activity_id, false, &err))  {
-               EM_DEBUG_EXCEPTION("em_storage_delete_pbd_activity failed [%d]", err);
+       if (!emstorage_delete_pbd_activity(account_id, mail_id, activity_id, false, &err))  {
+               EM_DEBUG_EXCEPTION("emstorage_delete_pbd_activity failed [%d]", err);
                
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+
                goto FINISH_OFF;
        }
 
@@ -6690,14 +5637,14 @@ EXPORT_API int em_core_delete_pbd_activity(int account_id, int mail_id, int acti
 
 FINISH_OFF: 
        if (ret == true) {      /*  COMMIT TRANSACTION; */
-               if (em_storage_commit_transaction(NULL, NULL, NULL) == false) {
-                       err = em_storage_get_emf_error_from_em_storage_error(EM_STORAGE_ERROR_DB_FAILURE);
+               if (emstorage_commit_transaction(NULL, NULL, NULL) == false) {
+                       err = EMF_ERROR_DB_FAILURE;
                        ret = false;
                }
        }
        else {  /*  ROLLBACK TRANSACTION; */
-               if (em_storage_rollback_transaction(NULL, NULL, NULL) == false)
-                       err = em_storage_get_emf_error_from_em_storage_error(EM_STORAGE_ERROR_DB_FAILURE);
+               if (emstorage_rollback_transaction(NULL, NULL, NULL) == false)
+                       err = EMF_ERROR_DB_FAILURE;
        }       
        
        if (err_code != NULL)
@@ -6706,26 +5653,26 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_core_insert_pbd_activity(emf_event_partial_body_thd *local_activity, int *activity_id, int *err_code) 
+INTERNAL_FUNC int emcore_insert_pbd_activity(emf_event_partial_body_thd *local_activity, int *activity_id, int *err_code) 
 {
        EM_DEBUG_FUNC_BEGIN("local_activity[%p], activity_id[%p], err_code[%p]", local_activity, activity_id, err_code);
 
        if (!local_activity || !activity_id) {
                EM_DEBUG_EXCEPTION("local_activity[%p], activity_id[%p] err_code[%p]", local_activity, activity_id, err_code);
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
        int ret = false;
        int err = EMF_ERROR_NONE;
        
-       em_storage_begin_transaction(NULL, NULL, NULL);
+       emstorage_begin_transaction(NULL, NULL, NULL);
        
-       if (!em_storage_add_pbd_activity(local_activity, activity_id, false, &err))  {
-               EM_DEBUG_EXCEPTION("em_storage_add_pbd_activity failed [%d]", err);
+       if (!emstorage_add_pbd_activity(local_activity, activity_id, false, &err))  {
+               EM_DEBUG_EXCEPTION("emstorage_add_pbd_activity failed [%d]", err);
                
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+
                goto FINISH_OFF;
        }
 
@@ -6733,14 +5680,14 @@ EXPORT_API int em_core_insert_pbd_activity(emf_event_partial_body_thd *local_act
 
 FINISH_OFF: 
        if (ret == true) {      /*  COMMIT TRANSACTION; */
-               if (em_storage_commit_transaction(NULL, NULL, NULL) == false) {
-                       err = em_storage_get_emf_error_from_em_storage_error(EM_STORAGE_ERROR_DB_FAILURE);
+               if (emstorage_commit_transaction(NULL, NULL, NULL) == false) {
+                       err = EMF_ERROR_DB_FAILURE;
                        ret = false;
                }
        }
        else {  /*  ROLLBACK TRANSACTION; */
-               if (em_storage_rollback_transaction(NULL, NULL, NULL) == false)
-                       err = em_storage_get_emf_error_from_em_storage_error(EM_STORAGE_ERROR_DB_FAILURE);
+               if (emstorage_rollback_transaction(NULL, NULL, NULL) == false)
+                       err = EMF_ERROR_DB_FAILURE;
        }       
        
        if (err_code != NULL)
@@ -6755,7 +5702,7 @@ FINISH_OFF:
 
 /* API to set or unset a field of flags on server in single IMAP request to server */
 
-EXPORT_API int em_core_mail_sync_flags_field_with_server(int mail_ids[], int num, emf_flags_field_type field_type, int value, int *err_code)
+INTERNAL_FUNC int emcore_sync_flags_field_with_server(int mail_ids[], int num, emf_flags_field_type field_type, int value, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("mail_ids [%p], num [%d], field_type [%d], value [%d], err_code [%p]", mail_ids, num, field_type, value, err_code);
                
@@ -6784,7 +5731,7 @@ EXPORT_API int em_core_mail_sync_flags_field_with_server(int mail_ids[], int num
        int string_count = 0;
        emf_account_t *temp_account;
        emf_id_set_t *id_set = NULL;
-       emf_mail_tbl_t *mail = NULL;
+       emstorage_mail_tbl_t *mail = NULL;
        emf_uid_range_set *uid_range_set = NULL;
        emf_uid_range_set *uid_range_node = NULL;
        char *field_type_name[EMF_FLAGS_FIELD_COUNT] = { "\\Seen"
@@ -6793,18 +5740,18 @@ EXPORT_API int em_core_mail_sync_flags_field_with_server(int mail_ids[], int num
        
        mail_id = mail_ids[0];
        
-       if (!em_storage_get_mail_field_by_id(mail_id, RETRIEVE_FLAG, &mail, true, &err) || !mail)               /*To DO :  This is a existing bug. on mail deletion before this call it will fail always */ {
-               EM_DEBUG_LOG("em_storage_get_mail_by_id failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+       if (!emstorage_get_mail_field_by_id(mail_id, RETRIEVE_FLAG, &mail, true, &err) || !mail)                /*To DO :  This is a existing bug. on mail deletion before this call it will fail always */ {
+               EM_DEBUG_LOG("emstorage_get_mail_by_id failed [%d]", err);
+
                goto FINISH_OFF;
        }
 
        account_id = mail[0].account_id;
 
-       temp_account = em_core_get_account_reference(account_id);
+       temp_account = emcore_get_account_reference(account_id);
 
        if (!temp_account)   {
-               EM_DEBUG_EXCEPTION("em_core_get_account_reference failed [%d]", account_id);
+               EM_DEBUG_EXCEPTION("emcore_get_account_reference failed [%d]", account_id);
                err = EMF_ERROR_INVALID_ACCOUNT;
                goto FINISH_OFF;
        }
@@ -6815,23 +5762,23 @@ EXPORT_API int em_core_mail_sync_flags_field_with_server(int mail_ids[], int num
                goto FINISH_OFF;
        }
        
-       if (!em_core_mailbox_open(account_id, mail->mailbox_name, (void **)&stream, &err) || !stream)  {
-               EM_DEBUG_EXCEPTION("em_core_mailbox_open failed [%d]", err);
+       if (!emcore_connect_to_remote_mailbox(account_id, mail->mailbox_name, (void **)&stream, &err) || !stream)  {
+               EM_DEBUG_EXCEPTION("emcore_connect_to_remote_mailbox failed [%d]", err);
                goto FINISH_OFF;
        }
 
-       if (false == em_storage_free_mail(&mail, 1, &err)) {
-               EM_DEBUG_EXCEPTION("em_storage_free_mail failed - %d ", err);
+       if (false == emstorage_free_mail(&mail, 1, &err)) {
+               EM_DEBUG_EXCEPTION("emstorage_free_mail failed - %d ", err);
                goto FINISH_OFF;
        }
 
        /* [h.gahlaut] Break the set of mail_ids into comma separated strings of given length */
-       /* Length is decided on the basis of remaining keywords in the Query to be formed later on in em_storage_get_id_set_from_mail_ids */
+       /* Length is decided on the basis of remaining keywords in the Query to be formed later on in emstorage_get_id_set_from_mail_ids */
        /* Here about 90 bytes are required for fixed keywords in the query-> SELECT local_uid, s_uid from mail_read_mail_uid_tbl where local_uid in (....) ORDER by s_uid */
        /* So length of comma separated strings which will be filled in (.....) in above query can be maximum QUERY_SIZE - 90 */
 
-       if (false == em_core_form_comma_separated_strings(mail_ids, num, QUERY_SIZE - 90, &string_list, &string_count, &err))   {
-               EM_DEBUG_EXCEPTION("em_core_form_comma_separated_strings failed [%d]", err);
+       if (false == emcore_form_comma_separated_strings(mail_ids, num, QUERY_SIZE - 90, &string_list, &string_count, &err))   {
+               EM_DEBUG_EXCEPTION("emcore_form_comma_separated_strings failed [%d]", err);
                goto FINISH_OFF;
        }
 
@@ -6840,8 +5787,8 @@ EXPORT_API int em_core_mail_sync_flags_field_with_server(int mail_ids[], int num
        for (i = 0; i < string_count; ++i) {
                /* Get the set of mail_ds and corresponding server_mail_ids sorted by server mail ids in ascending order */
 
-               if (false == em_storage_get_id_set_from_mail_ids(string_list[i], &id_set, &id_set_count, &err)) {
-                       EM_DEBUG_EXCEPTION("em_storage_get_id_set_from_mail_ids failed [%d]", err);
+               if (false == emstorage_get_id_set_from_mail_ids(string_list[i], &id_set, &id_set_count, &err)) {
+                       EM_DEBUG_EXCEPTION("emstorage_get_id_set_from_mail_ids failed [%d]", err);
                        goto FINISH_OFF;
                }
                
@@ -6849,8 +5796,8 @@ EXPORT_API int em_core_mail_sync_flags_field_with_server(int mail_ids[], int num
                
                len_of_each_range = MAX_IMAP_COMMAND_LENGTH - 40;               /*  1000 is the maximum length allowed RFC 2683. 40 is left for keywords and tag. */
                
-               if (false == em_core_convert_to_uid_range_set(id_set, id_set_count, &uid_range_set, len_of_each_range, &err)) {
-                       EM_DEBUG_EXCEPTION("em_core_convert_to_uid_range_set failed [%d]", err);
+               if (false == emcore_convert_to_uid_range_set(id_set, id_set_count, &uid_range_set, len_of_each_range, &err)) {
+                       EM_DEBUG_EXCEPTION("emcore_convert_to_uid_range_set failed [%d]", err);
                        goto FINISH_OFF;
                }
 
@@ -6924,7 +5871,7 @@ EXPORT_API int em_core_mail_sync_flags_field_with_server(int mail_ids[], int num
                        uid_range_node = uid_range_node->next;
                }       
 
-               em_core_free_uid_range_set(&uid_range_set);
+               emcore_free_uid_range_set(&uid_range_set);
 
                EM_SAFE_FREE(id_set);
                
@@ -6935,16 +5882,16 @@ EXPORT_API int em_core_mail_sync_flags_field_with_server(int mail_ids[], int num
 
 FINISH_OFF: 
 
-#ifdef __LOCAL_ACTIVITY__
+#ifdef __FEATURE_LOCAL_ACTIVITY__
        if (ret) {
-               emf_activity_tbl_t new_activity;
+               emstorage_activity_tbl_t new_activity;
                for (i = 0; i<num ; i++) {              
-                       memset(&new_activity, 0x00, sizeof(emf_activity_tbl_t));
+                       memset(&new_activity, 0x00, sizeof(emstorage_activity_tbl_t));
                        new_activity.activity_type = ACTIVITY_MODIFYSEENFLAG;
                        new_activity.account_id    = account_id;
                        new_activity.mail_id       = mail_ids[i];
                
-                       if (!em_core_activity_delete(&new_activity, &err))
+                       if (!emcore_delete_activity(&new_activity, &err))
                                EM_DEBUG_EXCEPTION("Local Activity ACTIVITY_MOVEMAIL [%d] ", err);
                }
 
@@ -6952,16 +5899,16 @@ FINISH_OFF:
 #endif
 
        if (NULL != mail) {
-               if (false == em_storage_free_mail(&mail, 1, &err))                      
-                       EM_DEBUG_EXCEPTION("em_storage_free_mail failed - %d ", err);
+               if (false == emstorage_free_mail(&mail, 1, &err))                       
+                       EM_DEBUG_EXCEPTION("emstorage_free_mail failed - %d ", err);
        }
        
-       em_core_free_comma_separated_strings(&string_list, &string_count);
+       emcore_free_comma_separated_strings(&string_list, &string_count);
 
        if (false == ret)
-               em_core_free_uid_range_set(&uid_range_set);
+               emcore_free_uid_range_set(&uid_range_set);
 
-       em_core_mailbox_close(0, stream);
+       emcore_close_mailbox(0, stream);
        stream = NULL;
 
        if (err_code != NULL)
@@ -6972,7 +5919,7 @@ FINISH_OFF:
 }
 #endif
 
-EXPORT_API int em_core_mail_filter_by_rule(emf_rule_t *filter_info, int *err_code)
+INTERNAL_FUNC int emcore_mail_filter_by_rule(emf_rule_t *filter_info, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("filter_info[%p], err_code[%p]", filter_info, err_code);
 
@@ -6981,7 +5928,7 @@ EXPORT_API int em_core_mail_filter_by_rule(emf_rule_t *filter_info, int *err_cod
        emf_account_t *account_ref = NULL, *account_list_ref = NULL;
        int filtered_mail_id_count = 0, *filtered_mail_id_list = NULL, parameter_string_length = 0;
        char *parameter_string = NULL, mail_id_string[10] = { 0x00, };
-       emf_mailbox_tbl_t *spam_mailbox = NULL;
+       emstorage_mailbox_tbl_t *spam_mailbox = NULL;
 
        if (!filter_info)  {
                EM_DEBUG_EXCEPTION("filter_info[%p]", filter_info);
@@ -6989,27 +5936,27 @@ EXPORT_API int em_core_mail_filter_by_rule(emf_rule_t *filter_info, int *err_cod
                goto FINISH_OFF;
        }
 
-       if (!em_core_account_get_list_refer(&account_list_ref, &account_count, &err)) {
-               EM_DEBUG_EXCEPTION("em_core_account_get_list_refer failed [%d]", err);
+       if (!emcore_get_account_reference_list(&account_list_ref, &account_count, &err)) {
+               EM_DEBUG_EXCEPTION("emcore_get_account_reference_list failed [%d]", err);
                goto FINISH_OFF;
        }
 
        for (account_index = 0; account_index < account_count; account_index++) {
                account_ref = account_list_ref + account_index;
 
-               if (!em_storage_get_mailbox_by_mailbox_type(account_ref->account_id, EMF_MAILBOX_TYPE_SPAMBOX, &spam_mailbox, false, &err))
-                       EM_DEBUG_EXCEPTION("em_storage_get_mailbox_by_mailbox_type for account_id[%d] failed [%d]", account_ref->account_id, err);
+               if (!emstorage_get_mailbox_by_mailbox_type(account_ref->account_id, EMF_MAILBOX_TYPE_SPAMBOX, &spam_mailbox, false, &err))
+                       EM_DEBUG_EXCEPTION("emstorage_get_mailbox_by_mailbox_type for account_id[%d] failed [%d]", account_ref->account_id, err);
                else if (spam_mailbox && spam_mailbox->mailbox_name) {
-                       if (!em_storage_filter_mails_by_rule(account_ref->account_id, spam_mailbox->mailbox_name, (emf_mail_rule_tbl_t *)filter_info, &filtered_mail_id_list, &filtered_mail_id_count, &err))
-                               EM_DEBUG_EXCEPTION("em_storage_filter_mails_by_rule failed [%d]", err);
+                       if (!emstorage_filter_mails_by_rule(account_ref->account_id, spam_mailbox->mailbox_name, (emstorage_rule_tbl_t *)filter_info, &filtered_mail_id_list, &filtered_mail_id_count, &err))
+                               EM_DEBUG_EXCEPTION("emstorage_filter_mails_by_rule failed [%d]", err);
                        else {
                                if (filtered_mail_id_count) {
                                        parameter_string_length = strlen(spam_mailbox->mailbox_name) + 7 + (10 * filtered_mail_id_count);
-                                       parameter_string = em_core_malloc(sizeof(char) * parameter_string_length);
+                                       parameter_string = em_malloc(sizeof(char) * parameter_string_length);
 
                                        if (parameter_string == NULL) {
                                                err = EMF_ERROR_OUT_OF_MEMORY;
-                                               EM_DEBUG_EXCEPTION("em_core_malloc failed for parameter_string");
+                                               EM_DEBUG_EXCEPTION("em_malloc failed for parameter_string");
                                                goto FINISH_OFF;
                                        }
 
@@ -7025,19 +5972,19 @@ EXPORT_API int em_core_mail_filter_by_rule(emf_rule_t *filter_info, int *err_cod
                                        EM_DEBUG_LOG("filtered_mail_id_count [%d]", filtered_mail_id_count);
                                        EM_DEBUG_LOG("param string [%s]", parameter_string);
 
-                                       if (!em_storage_notify_storage_event(NOTI_MAIL_MOVE, account_ref->account_id, 0, parameter_string, 0)) 
-                                               EM_DEBUG_EXCEPTION("em_storage_notify_storage_event failed [ NOTI_MAIL_MOVE ] >>>> ");
+                                       if (!emstorage_notify_storage_event(NOTI_MAIL_MOVE, account_ref->account_id, 0, parameter_string, 0)) 
+                                               EM_DEBUG_EXCEPTION("emstorage_notify_storage_event failed [ NOTI_MAIL_MOVE ] >>>> ");
 
                                        EM_SAFE_FREE(filtered_mail_id_list);
                                        EM_SAFE_FREE(parameter_string);
                                }
                        }
-                       em_storage_free_mailbox(&spam_mailbox, 1, &err);
+                       emstorage_free_mailbox(&spam_mailbox, 1, &err);
                        spam_mailbox = NULL;
                }
        }
 
-       em_core_check_unread_mail();
+       emcore_check_unread_mail();
 
        ret = true;
 
@@ -7048,7 +5995,7 @@ FINISH_OFF:
 
 
        if (spam_mailbox)
-               em_storage_free_mailbox(&spam_mailbox, 1, &err);
+               emstorage_free_mailbox(&spam_mailbox, 1, &err);
 
        if (err_code)
                *err_code = err;
similarity index 72%
rename from email-core/em-core-mailbox-sync.c
rename to email-core/email-core-mailbox-sync.c
index 8918044..7d0a0c7 100755 (executable)
@@ -21,7 +21,7 @@
 
 
 /******************************************************************************
- * File :  em-core-mailbox_sync.c
+ * File :  email-core-mailbox-sync.c
  * Desc :  Mail Header Sync
  *
  * Auth : 
 #include <string.h>
 #include <ctype.h>
 
-#include "em-core-types.h"
+#include "email-internal-types.h"
 
 #include "c-client.h"
 #include "lnx_inc.h"
 
-#include "Msg_Convert.h" 
-#include "em-core-mailbox-sync.h"
-#include "em-core-global.h"
-#include "em-core-imap-mailbox.h"
-#include "em-core-event.h"
-#include "em-core-mailbox.h"
-#include "em-core-mesg.h"
-#include "em-core-mime.h"
-#include "em-core-utils.h"
-#include "em-core-smtp.h"
-#include "em-core-account.h" 
-#include "em-storage.h"
+#include "email-utilities.h"
+#include "email-convert.h" 
+#include "email-core-mailbox-sync.h"
+#include "email-core-global.h"
+#include "email-core-imap-mailbox.h"
+#include "email-core-event.h"
+#include "email-core-mailbox.h"
+#include "email-core-mail.h"
+#include "email-core-mime.h"
+#include "email-core-utils.h"
+#include "email-core-smtp.h"
+#include "email-core-account.h" 
+#include "email-storage.h"
 #include "flstring.h"
-#include "emf-dbglog.h"
+#include "email-debug-log.h"
 
 #define MAX_CHARSET_VALUE 256
 
@@ -58,8 +59,8 @@ static char g_append_uid_rsp[129]; /* added for getting server response  */
 extern void imap_parse_body_structure (MAILSTREAM *stream, BODY *body, unsigned char **txtptr, IMAPPARSEDREPLY *reply);
 
 #ifdef __FEATURE_PARTIAL_BODY_DOWNLOAD__
-static emf_partial_buffer *em_core_get_response_from_server (NETSTREAM *nstream, char *tag, IMAPPARSEDREPLY **reply);
-static int em_core_initiate_pbd(MAILSTREAM *stream, int account_id, int mail_id, char *uid, char *mailbox, int *err_code);
+static emf_partial_buffer *emcore_get_response_from_server (NETSTREAM *nstream, char *tag, IMAPPARSEDREPLY **reply);
+static int emcore_initiate_pbd(MAILSTREAM *stream, int account_id, int mail_id, char *uid, char *mailbox, int *err_code);
 #endif
 
 #ifdef __FEATURE_SYNC_CLIENT_TO_SERVER__
@@ -237,7 +238,7 @@ FINISH_OFF:
        return ret;
 }
 
-int pop3_mailbox_get_uids(MAILSTREAM *stream, em_core_uid_list** uid_list, int *err_code)
+int pop3_mailbox_get_uids(MAILSTREAM *stream, emcore_uid_list** uid_list, int *err_code)
 {
        EM_PROFILE_BEGIN(pop3MailboxGetuid);
        EM_DEBUG_FUNC_BEGIN("stream[%p], uid_list[%p], err_code[%p]", stream, uid_list, err_code);
@@ -248,7 +249,7 @@ int pop3_mailbox_get_uids(MAILSTREAM *stream, em_core_uid_list** uid_list, int *
        POP3LOCAL *pop3local = NULL;
        char command[64];
        char *response = NULL;
-       em_core_uid_list *uid_elem = NULL;
+       emcore_uid_list *uid_elem = NULL;
        
        if (!stream || !uid_list) {
                EM_DEBUG_EXCEPTION("stream[%p], uid_list[%p]n", stream, uid_list);
@@ -311,7 +312,7 @@ int pop3_mailbox_get_uids(MAILSTREAM *stream, em_core_uid_list** uid_list, int *
                if ((p = strchr(response, ' '))) { 
                        *p = '\0';
                        
-                       if (!(uid_elem = em_core_malloc(sizeof(em_core_uid_list)))) {
+                       if (!(uid_elem = em_malloc(sizeof(emcore_uid_list)))) {
                                EM_DEBUG_EXCEPTION("malloc failed...");
                                err = EMF_ERROR_OUT_OF_MEMORY;
                                goto FINISH_OFF;
@@ -347,7 +348,7 @@ FINISH_OFF:
        return ret;
 }
 
-int imap4_mailbox_get_uids(MAILSTREAM *stream, em_core_uid_list** uid_list, int *err_code)
+int imap4_mailbox_get_uids(MAILSTREAM *stream, emcore_uid_list** uid_list, int *err_code)
 {
        EM_PROFILE_BEGIN(ImapMailboxGetUids);
        EM_DEBUG_FUNC_BEGIN("stream[%p], uid_list[%p], err_code[%p]", stream, uid_list, err_code);
@@ -358,7 +359,7 @@ int imap4_mailbox_get_uids(MAILSTREAM *stream, em_core_uid_list** uid_list, int
        IMAPLOCAL *imaplocal = NULL;
        char tag[16], command[64];
        char *response = NULL;
-       em_core_uid_list *uid_elem = NULL;
+       emcore_uid_list *uid_elem = NULL;
        
        if (!stream || !uid_list) {
                EM_DEBUG_EXCEPTION("stream[%p], uid_list[%p]", stream, uid_list);
@@ -380,7 +381,7 @@ int imap4_mailbox_get_uids(MAILSTREAM *stream, em_core_uid_list** uid_list, int
        memset(command, 0x00, sizeof(command));
        
        SNPRINTF(tag, sizeof(tag), "%08lx", 0xffffffff & (stream->gensym++));
-       SNPRINTF(command, sizeof(command), "%s FETCH 1:* (FLAGS UID)\015\012", tag);            /* TODO :  confirm me */
+       SNPRINTF(command, sizeof(command), "%s FETCH 1:* (FLAGS UID)\015\012", tag);
        EM_DEBUG_LOG("COMMAND [%s] \n", command);
 #ifdef FEATURE_CORE_DEBUG
        EM_DEBUG_LOG(" [IMAP4] >>> [%s]", command);
@@ -439,8 +440,8 @@ int imap4_mailbox_get_uids(MAILSTREAM *stream, em_core_uid_list** uid_list, int
                                        
                                        *s = '\0';
                                        
-                                       if (!(uid_elem = em_core_malloc(sizeof(em_core_uid_list)))) {
-                                               EM_DEBUG_EXCEPTION("em_core_malloc failed...");
+                                       if (!(uid_elem = em_malloc(sizeof(emcore_uid_list)))) {
+                                               EM_DEBUG_EXCEPTION("em_malloc failed...");
                                                err = EMF_ERROR_OUT_OF_MEMORY;
                                                goto FINISH_OFF;
                                        }
@@ -529,7 +530,7 @@ static char *__em_get_month_in_string(int month)
        return mon;
 }
        
-int imap4_mailbox_get_uids_by_timestamp(MAILSTREAM *stream, em_core_uid_list** uid_list,  int *err_code)
+int imap4_mailbox_get_uids_by_timestamp(MAILSTREAM *stream, emcore_uid_list** uid_list,  int *err_code)
 {
        EM_PROFILE_BEGIN(emCoreMailboxuidsbystamp);
        EM_DEBUG_FUNC_BEGIN("stream[%p], uid_list[%p],  err_code[%p]", stream, uid_list, err_code);
@@ -540,7 +541,7 @@ int imap4_mailbox_get_uids_by_timestamp(MAILSTREAM *stream, em_core_uid_list** u
        IMAPLOCAL *imaplocal = NULL;
        char tag[16], command[64];
        char *response = NULL;
-       em_core_uid_list *uid_elem = NULL;
+       emcore_uid_list *uid_elem = NULL;
        char delims[] = " ";
        char *result = NULL;
 
@@ -593,13 +594,8 @@ int imap4_mailbox_get_uids_by_timestamp(MAILSTREAM *stream, em_core_uid_list** u
        memset(command, 0x00, sizeof(command));
        
        SNPRINTF(tag, sizeof(tag), "%08lx", 0xffffffff & (stream->gensym++));
-
-       /* SNPRINTF(command, sizeof(command), "%s UID SEARCH 1:* SINCE 17-Aug-2009\015\012", tag, date_string); */              /* TODO :  confirm me */
-
-       SNPRINTF(command, sizeof(command), "%s UID SEARCH 1:* SINCE %s\015\012", tag, date_string);             /* TODO :  confirm me */
-       
+       SNPRINTF(command, sizeof(command), "%s UID SEARCH 1:* SINCE %s\015\012", tag, date_string);
        EM_DEBUG_LOG("COMMAND [%s] ", command);
-
        
 #ifdef FEATURE_CORE_DEBUG
        EM_DEBUG_LOG(" [IMAP4] >>> [%s]", command);
@@ -646,7 +642,7 @@ int imap4_mailbox_get_uids_by_timestamp(MAILSTREAM *stream, em_core_uid_list** u
                    {
                                EM_DEBUG_LOG("UID VALUE DEEP is [%s]", result);
 
-                               if (!(uid_elem = em_core_malloc(sizeof(em_core_uid_list)))) {
+                               if (!(uid_elem = em_malloc(sizeof(emcore_uid_list)))) {
                                        EM_DEBUG_EXCEPTION(" malloc failed...");
                                        err = EMF_ERROR_OUT_OF_MEMORY;
                                        goto FINISH_OFF;
@@ -685,7 +681,7 @@ FINISH_OFF:
 }
 
 #define PARSE_BUFFER_LENGTH 4096
-static int em_core_mailbox_parse_header(char *rfc822_header, int *req_read_receipt, int *priority, int *err_code)
+static int emcore_parse_header(char *rfc822_header, int *req_read_receipt, int *priority, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("rfc822_header[%p], req_read_receipt[%p], priority[%p], err_code[%p]", rfc822_header, req_read_receipt, priority,  err_code);
 
@@ -697,20 +693,11 @@ static int em_core_mailbox_parse_header(char *rfc822_header, int *req_read_recei
 
        EM_PROFILE_BEGIN(emCoreMailboxParseHeader);
        
-       /*  char *buf = NULL; */
        char buf[PARSE_BUFFER_LENGTH];
        int len, i, j;
-       /* int buf_length = strlen(rfc822_header)+1; */
        
        EM_DEBUG_LOG("Buffer length [%d]", PARSE_BUFFER_LENGTH);
-       /*
-       buf = (char *) malloc(sizeof(char) * (buf_length));
-       
-       if (!buf) {
-               EM_DEBUG_EXCEPTION("buf is NULL");
-               return false;
-       }
-       */
+
        *priority = 3;
                
        memset(buf, 0x00, PARSE_BUFFER_LENGTH);
@@ -726,15 +713,7 @@ static int em_core_mailbox_parse_header(char *rfc822_header, int *req_read_recei
                        j = 0;
                        
                        /*  parsing data */
-                       em_core_upper_string(buf);
-                       
-                       /*  message-id */
-/*                     if (buf[0] == 'M' && buf[3] == 'S' && buf[6] == 'E' && buf[7] == '-' && buf[8] == 'I') { */
-/*                             buf[strlen(buf)-2] = '\0'; */
-/*                             if (buf[12])    *message_id = EM_SAFE_STRDUP(buf+12); */
-/*                             memset(buf, 0x00, sizeof(buf)); */
-/*                             continue; */
-/*                     } */
+                       em_upper_string(buf);
                        
                        /*  disposition_notification_to */
                        if (buf[0] == 'D' && buf[11] == '-' && buf[12] == 'N' && buf[24] == '-' && buf[25] == 'T') {
@@ -777,9 +756,6 @@ static int em_core_mailbox_parse_header(char *rfc822_header, int *req_read_recei
                        EM_DEBUG_EXCEPTION("buf is too small.");
        }
        
-       /*
-    EM_SAFE_FREE(buf);         
-       */
        EM_PROFILE_END(emCoreMailboxParseHeader);
 
        if (err_code)
@@ -789,7 +765,7 @@ static int em_core_mailbox_parse_header(char *rfc822_header, int *req_read_recei
 }
 
 
-static int em_core_mail_get_extra_info(MAILSTREAM *stream, int msgno, int *req_read_receipt, int *priority, int *err_code)
+static int emcore_get_mail_extra_info(MAILSTREAM *stream, int msgno, int *req_read_receipt, int *priority, int *err_code)
 {
        EM_PROFILE_BEGIN(emCoreMailGetExtraInfo);
        EM_DEBUG_FUNC_BEGIN("stream[%p], msgno[%d], req_read_receipt[%p], priority[%p], err_code[%p]", stream, msgno, req_read_receipt, priority, err_code);
@@ -823,8 +799,8 @@ static int em_core_mail_get_extra_info(MAILSTREAM *stream, int msgno, int *req_r
                goto FINISH_OFF;
        }
        
-       if (!em_core_mailbox_parse_header(rfc822_header, req_read_receipt, priority, &err)) {
-               EM_DEBUG_EXCEPTION("em_core_mailbox_parse_header falied - %d", err);
+       if (!emcore_parse_header(rfc822_header, req_read_receipt, priority, &err)) {
+               EM_DEBUG_EXCEPTION("emcore_parse_header falied - %d", err);
                goto FINISH_OFF;
        }
        ret = true;
@@ -839,7 +815,7 @@ FINISH_OFF:
        return ret;
 }
 
-static int em_core_mailbox_get_uids_to_download(MAILSTREAM *stream, emf_account_t *account, emf_mailbox_tbl_t *input_mailbox_tbl, int limit_count, em_core_uid_list** uid_list, int *uids, int retrieve_mode ,  int *err_code)
+static int emcore_get_uids_to_download(MAILSTREAM *stream, emf_account_t *account, emstorage_mailbox_tbl_t *input_mailbox_tbl, int limit_count, emcore_uid_list** uid_list, int *uids, int retrieve_mode ,  int *err_code)
 {
        EM_PROFILE_BEGIN(emCoreGetUidsDownload);
        EM_DEBUG_FUNC_BEGIN("account[%p], input_mailbox_tbl[%p], limit_count[%d], uid_list[%p], err_code[%p]", account, input_mailbox_tbl, limit_count, uid_list, err_code);
@@ -847,14 +823,13 @@ static int em_core_mailbox_get_uids_to_download(MAILSTREAM *stream, emf_account_
        int ret = false;
        int err = EMF_ERROR_NONE;
        
-       emf_mail_read_mail_uid_tbl_t *downloaded_uids = NULL;
-       emf_mail_info_t *mail_info = NULL;
+       emstorage_read_mail_uid_tbl_t *downloaded_uids = NULL;
        int i = 0, j = 0, uid_count = 0, uid_to_be_downloaded_count = 0;                
-       em_core_uid_list *uid_elem = NULL;
-       em_core_uid_list *head_uid_elem = NULL, *end =  NULL;
-       em_core_uid_list *next_uid_elem = NULL;
-       emf_mail_tbl_t *mail = NULL;
-       
+       emcore_uid_list *uid_elem = NULL;
+       emcore_uid_list *head_uid_elem = NULL, *end =  NULL;
+       emcore_uid_list *next_uid_elem = NULL;
+       emstorage_mail_tbl_t *mail = NULL;
+
        if (!account || !input_mailbox_tbl || !uid_list) {
                EM_DEBUG_EXCEPTION("account[%p], input_mailbox_tbl[%p], uid_list[%p]", account, input_mailbox_tbl, uid_list);
                err = EMF_ERROR_INVALID_PARAM;
@@ -880,9 +855,9 @@ static int em_core_mailbox_get_uids_to_download(MAILSTREAM *stream, emf_account_
            }
        }
        
-       if (!em_storage_get_downloaded_list(input_mailbox_tbl->account_id, input_mailbox_tbl->mailbox_name, &downloaded_uids, &j, true, &err)) {
-               EM_DEBUG_EXCEPTION("em_storage_get_downloaded_list failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+       if (!emstorage_get_downloaded_list(input_mailbox_tbl->account_id, input_mailbox_tbl->mailbox_name, &downloaded_uids, &j, true, &err)) {
+               EM_DEBUG_EXCEPTION("emstorage_get_downloaded_list failed [%d]", err);
+
                goto FINISH_OFF;
        }
        EM_DEBUG_LOG("Number of Mails in Downloaded Table [%d]", j);
@@ -964,46 +939,46 @@ static int em_core_mailbox_get_uids_to_download(MAILSTREAM *stream, emf_account_
        for (i = 0; i < j; i++) {
                /*  EM_DEBUG_LOG("input_mailbox_tbl[%s] reserved[%d]", input_mailbox_tbl->name, downloaded_uids[i].reserved); */
                if (downloaded_uids[i].reserved == 0) {         /*  deleted on server */
-                       if (!em_storage_get_maildata_by_servermailid(input_mailbox_tbl->account_id, downloaded_uids[i].s_uid, &mail, true, &err)){
-                               EM_DEBUG_EXCEPTION("em_storage_get_maildata_by_servermailid for uid[%s] Failed [%d] \n ", downloaded_uids[i].s_uid, err);
-                               if (err == EM_STORAGE_ERROR_MAIL_NOT_FOUND){
+                       if (!emstorage_get_maildata_by_servermailid(input_mailbox_tbl->account_id, downloaded_uids[i].s_uid, &mail, true, &err)){
+                               EM_DEBUG_EXCEPTION("emstorage_get_maildata_by_servermailid for uid[%s] Failed [%d] \n ", downloaded_uids[i].s_uid, err);
+                               if (err == EMF_ERROR_MAIL_NOT_FOUND){
                                        continue;
                                }
                        }
                                                
-      if (account->receiving_server_type == EMF_SERVER_TYPE_IMAP4) {
-                               if (!em_core_mail_delete_from_local(input_mailbox_tbl->account_id, &(mail->mail_id), 1, EMF_DELETED_FROM_SERVER, false, &err)) {
-                                       EM_DEBUG_EXCEPTION("em_core_mail_delete_from_local falied - %d", err);
+                       if (account->receiving_server_type == EMF_SERVER_TYPE_IMAP4) {
+                               if (!emcore_delete_mail_from_local_storage(input_mailbox_tbl->account_id, &(mail->mail_id), 1, EMF_DELETED_FROM_SERVER, false, &err)) {
+                                       EM_DEBUG_EXCEPTION("emcore_delete_mail_from_local_storage falied - %d", err);
                                        goto FINISH_OFF;
                                }
-                               /* em_core_delete_notification_for_read_mail(mail->mail_id); */
-                               em_core_check_unread_mail(); 
+                               /* emcore_delete_notification_for_read_mail(mail->mail_id); */
+                               emcore_check_unread_mail(); 
                        }
                        
-                       if (!em_storage_remove_downloaded_mail(input_mailbox_tbl->account_id, input_mailbox_tbl->mailbox_name, downloaded_uids[i].s_uid, true, &err)) {   /*  remove uid from uid list */
-                               EM_DEBUG_EXCEPTION("em_storage_remove_downloaded_mail failed - %d", err);
-                               err = em_storage_get_emf_error_from_em_storage_error(err);
+                       if (!emstorage_remove_downloaded_mail(input_mailbox_tbl->account_id, input_mailbox_tbl->mailbox_name, downloaded_uids[i].s_uid, true, &err)) {   /*  remove uid from uid list */
+                               EM_DEBUG_EXCEPTION("emstorage_remove_downloaded_mail failed - %d", err);
+               
                                /* goto FINISH_OFF; */
                        }
                        
                }
                else if (account->receiving_server_type == EMF_SERVER_TYPE_IMAP4 && downloaded_uids[i].reserved == 1) { 
                        /*  unseen on server */
-                       if  (!em_core_mail_get_info(downloaded_uids[i].local_uid, &mail_info, &err)){
-                               EM_DEBUG_EXCEPTION("em_core_mail_get_info failed for [%d] - [%d]", downloaded_uids[i].local_uid,  err);
+                       if  (!emstorage_get_mail_by_id(downloaded_uids[i].local_uid, &mail, true, &err)){
+                               EM_DEBUG_EXCEPTION("emstorage_get_mail_by_id failed for [%d] - [%d]", downloaded_uids[i].local_uid, err);
                                continue;
                        }
                        
-                       if (mail_info) {                
-                               if (mail_info->body_downloaded && mail_info->flags.seen){
+                       if (mail) {
+                               if (mail->body_download_status && mail->flags_seen_field){
                                        EM_DEBUG_LOG("Set flag as seen on server");
                                        mail_setflag_full(stream, downloaded_uids[i].s_uid, "\\Seen", ST_UID);
                                }
-                               em_core_mail_info_free(&mail_info, 1, NULL);
-                               mail_info = NULL;
                        }
-
                }
+               if (mail != NULL)
+                       emstorage_free_mail(&mail, 1, NULL);
+               mail = NULL;
        }
        EM_PROFILE_END(emCoreGetUidsDownloadForLoop);   
        
@@ -1015,17 +990,14 @@ static int em_core_mailbox_get_uids_to_download(MAILSTREAM *stream, emf_account_
 FINISH_OFF: 
        if (ret == false){
                if (head_uid_elem)
-                       em_core_mailbox_free_uids(head_uid_elem, NULL);
+                       emcore_free_uids(head_uid_elem, NULL);
        }
-
-       if (mail_info  != NULL)
-               em_core_mail_info_free(&mail_info, 1, NULL);
        
-       if (downloaded_uids  != NULL)
-               em_storage_free_read_mail_uid(&downloaded_uids, j, NULL);
+       if (downloaded_uids != NULL)
+               emstorage_free_read_mail_uid(&downloaded_uids, j, NULL);
 
-       if (mail  != NULL)
-               em_storage_free_mail(&mail, 1, NULL);
+       if (mail != NULL)
+               emstorage_free_mail(&mail, 1, NULL);
        
        if (err_code  != NULL)
                *err_code = err;
@@ -1036,7 +1008,7 @@ FINISH_OFF:
 }
 
 /* insert received mail UID to read mail uid table */
-static int em_core_mailbox_add_read_mail_uid(emf_mailbox_tbl_t *input_maibox_data, char *server_mailbox_name, int mail_id, char *uid, int rfc822_size, int rule_id, int *err_code)
+static int emcore_add_read_mail_uid(emstorage_mailbox_tbl_t *input_maibox_data, char *server_mailbox_name, int mail_id, char *uid, int rfc822_size, int rule_id, int *err_code)
 {
        EM_PROFILE_BEGIN(emCoreMailboxAddReadMailUid);
        EM_DEBUG_FUNC_BEGIN("input_maibox_data[%p], server_mailbox_name[%s], uid[%s], rfc822_size[%d], rule_id[%d], err_code[%p]", input_maibox_data, server_mailbox_name, uid, rfc822_size, rule_id, err_code);
@@ -1044,7 +1016,7 @@ static int em_core_mailbox_add_read_mail_uid(emf_mailbox_tbl_t *input_maibox_dat
        int ret = false;
        int err = EMF_ERROR_NONE;
        
-       emf_mail_read_mail_uid_tbl_t read_mail_uid = { 0 };
+       emstorage_read_mail_uid_tbl_t read_mail_uid = { 0 };
        char *mailbox_name = NULL;
        
        if (!input_maibox_data || !uid) {
@@ -1056,9 +1028,9 @@ static int em_core_mailbox_add_read_mail_uid(emf_mailbox_tbl_t *input_maibox_dat
        read_mail_uid.account_id = input_maibox_data->account_id;
        
        if (!(input_maibox_data->mailbox_name) || !(server_mailbox_name)){
-               if (!em_storage_get_mailboxname_by_mailbox_type(input_maibox_data->account_id, EMF_MAILBOX_TYPE_INBOX, &mailbox_name, false, &err)) {
-                       EM_DEBUG_EXCEPTION("em_storage_get_mailboxname_by_mailbox_type failed [%d]", err);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+               if (!emstorage_get_mailboxname_by_mailbox_type(input_maibox_data->account_id, EMF_MAILBOX_TYPE_INBOX, &mailbox_name, false, &err)) {
+                       EM_DEBUG_EXCEPTION("emstorage_get_mailboxname_by_mailbox_type failed [%d]", err);
+       
                        goto FINISH_OFF;
                }
        }
@@ -1080,9 +1052,9 @@ static int em_core_mailbox_add_read_mail_uid(emf_mailbox_tbl_t *input_maibox_dat
        read_mail_uid.data1 = rfc822_size;
        read_mail_uid.flag = rule_id;
        
-       if (!em_storage_add_downloaded_mail(&read_mail_uid, false, &err)) {
-               EM_DEBUG_EXCEPTION("em_storage_add_downloaded_mail failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+       if (!emstorage_add_downloaded_mail(&read_mail_uid, false, &err)) {
+               EM_DEBUG_EXCEPTION("emstorage_add_downloaded_mail failed [%d]", err);
+
                goto FINISH_OFF;
        }
        
@@ -1099,145 +1071,85 @@ FINISH_OFF:
        return ret;
 }
 
-static int em_core_mail_add_header(MAILSTREAM *mail_stream, emf_mailbox_tbl_t *input_maibox_data, emf_mail_head_t *head, int to_num, em_core_uid_list *uid_elem, int *mail_id, int *result_thread_id, int *err_code)
+static int emcore_add_mail_to_mailbox(emstorage_mailbox_tbl_t *input_maibox_data, emstorage_mail_tbl_t *input_new_mail_tbl_data, int *output_mail_id, int *output_thread_id)
 {
-       EM_DEBUG_FUNC_BEGIN("mail_stream [%p], input_maibox_data[%p], head[%p], to_num[%d], uid_elem[%p], mail_id[%p], err_code[%p]", mail_stream, input_maibox_data, head, to_num, uid_elem, mail_id, err_code);
+       EM_DEBUG_FUNC_BEGIN("input_maibox_data[%p], input_new_mail_tbl_data[%p], uid_elem[%p], output_mail_id[%p], output_thread_id[%p]", mail_stream, input_maibox_data, input_new_mail_tbl_data, output_mail_id, output_thread_id);
        
-       int ret = false, err = EMF_ERROR_NONE;
-       int req_read_receipt = 0;
-       int priority = 0;
-       int thread_id = -1, thread_item_count = 0, latest_mail_id_in_thread = -1;
-       char datetime[16] = { 0, };
-       MESSAGECACHE *elt = NULL;
-       emf_mail_tbl_t mail_table_data = {0};
+       int                   err = EMF_ERROR_NONE;
+       int                   thread_id = -1;
+       int                   thread_item_count = 0;
+       int                   latest_mail_id_in_thread = -1;
 
-       if (!input_maibox_data || !mail_stream || !head || !uid_elem) {
+       if (!input_maibox_data || !input_new_mail_tbl_data) {
                EM_DEBUG_EXCEPTION("Invalid Parameter");
                err = EMF_ERROR_INVALID_PARAM;
                goto FINISH_OFF;
        }       
-       
-       if (!(elt = mail_elt(mail_stream, uid_elem->msgno))) {
-               EM_DEBUG_EXCEPTION("mail_elt failed...");
-               err = EMF_ERROR_UNKNOWN;
-               goto FINISH_OFF;
-       }
-       
-       if (!em_core_mail_get_extra_info(mail_stream, uid_elem->msgno, &req_read_receipt, &priority, &err)) {
-               EM_DEBUG_EXCEPTION("em_core_mail_get_extra_info failed - %d", err);
-               goto FINISH_OFF;
-       }
-
-       SNPRINTF(datetime, sizeof(datetime), "%04d%02d%02d%02d%02d%02d", BASEYEAR + elt->year, elt->month, elt->day, elt->hours, elt->minutes, elt->seconds);
-
-       head->datetime.year = elt->year;
-       head->datetime.month = elt->month;
-       head->datetime.day = elt->day;
-       head->datetime.hour = elt->hours;
-       head->datetime.minute = elt->minutes;
-       head->datetime.second = elt->seconds;
 
-       mail_table_data.account_id            = input_maibox_data->account_id;
-       mail_table_data.mailbox_name          = input_maibox_data->mailbox_name;
-       mail_table_data.mailbox_type          = input_maibox_data->mailbox_type;
-       mail_table_data.subject               = head->subject;
-       mail_table_data.datetime              = EM_SAFE_STRDUP(datetime);
-       mail_table_data.server_mail_status    = 1;
-       mail_table_data.server_mail_id        = uid_elem->uid;
-       mail_table_data.message_id            = head->mid;
-       mail_table_data.full_address_from     = head->from;
-       mail_table_data.full_address_to       = head->to;
-       mail_table_data.full_address_cc       = head->cc;
-       mail_table_data.full_address_bcc      = head->bcc;
-       mail_table_data.full_address_reply    = head->reply_to;
-       mail_table_data.full_address_return   = head->return_path;
-       mail_table_data.mail_size             = elt->rfc822_size;
-       mail_table_data.flags_seen_field      = uid_elem->flag.seen;
-       mail_table_data.flags_deleted_field   = elt->deleted;
-       mail_table_data.flags_flagged_field   = elt->flagged;
-       mail_table_data.flags_answered_field  = elt->answered;
-       mail_table_data.flags_recent_field    = elt->recent;
-       mail_table_data.flags_draft_field     = elt->draft;
-       mail_table_data.flags_forwarded_field = uid_elem->flag.forwarded;
-       mail_table_data.priority              = priority;
-       mail_table_data.report_status         = (req_read_receipt ? 3  :  0);
-       mail_table_data.attachment_count      = 0;
+       input_new_mail_tbl_data->account_id            = input_maibox_data->account_id;
+       input_new_mail_tbl_data->mailbox_id            = input_maibox_data->mailbox_id;
+       input_new_mail_tbl_data->mailbox_name          = EM_SAFE_STRDUP(input_maibox_data->mailbox_name);
+       input_new_mail_tbl_data->mailbox_type          = input_maibox_data->mailbox_type;
 
-       em_core_fill_address_information_of_mail_tbl(&mail_table_data);
-
-       em_storage_begin_transaction(NULL, NULL, NULL);
+       emstorage_begin_transaction(NULL, NULL, NULL);
 
        /* Get the Mail_id */
-       if (!em_storage_increase_mail_id(&(mail_table_data.mail_id), false, &err)) {
-               EM_DEBUG_EXCEPTION("em_storage_increase_mail_id failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+       if (!emstorage_increase_mail_id(&(input_new_mail_tbl_data->mail_id), false, &err)) {
+               EM_DEBUG_EXCEPTION("emstorage_increase_mail_id failed [%d]", err);
                goto FINISH_OFF;
        }
 
-       if (em_storage_get_thread_id_of_thread_mails(&mail_table_data, &thread_id, &latest_mail_id_in_thread, &thread_item_count)  != EMF_ERROR_NONE)
-               EM_DEBUG_LOG(" em_storage_get_thread_id_of_thread_mails is failed.");
+       if (emstorage_get_thread_id_of_thread_mails(input_new_mail_tbl_data, &thread_id, &latest_mail_id_in_thread, &thread_item_count)  != EMF_ERROR_NONE)
+               EM_DEBUG_LOG(" emstorage_get_thread_id_of_thread_mails is failed.");
 
        if (thread_id == -1){
-               mail_table_data.thread_id = mail_table_data.mail_id;
-               mail_table_data.thread_item_count = thread_item_count = 1;
+               input_new_mail_tbl_data->thread_id = input_new_mail_tbl_data->mail_id;
+               input_new_mail_tbl_data->thread_item_count = thread_item_count = 1;
        }
        else {
-               mail_table_data.thread_id = thread_id;
+               input_new_mail_tbl_data->thread_id = thread_id;
                thread_item_count++;
        }
-
-       if (result_thread_id)
-               *result_thread_id = mail_table_data.thread_id;
-
-       EM_DEBUG_LOG("mail_table_data.mail_id [%d]", mail_table_data.mail_id);
-       EM_DEBUG_LOG("mail_table_data.thread_id [%d]", mail_table_data.thread_id);
        
-       if (!em_storage_add_mail(&mail_table_data, 0, false, &err)) {
-               EM_DEBUG_EXCEPTION("em_storage_add_mail failed [%d]", err);
-               em_storage_rollback_transaction(NULL, NULL, NULL);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+       if (!emstorage_add_mail(input_new_mail_tbl_data, 0, false, &err)) {
+               EM_DEBUG_EXCEPTION("emstorage_add_mail failed [%d]", err);
+               emstorage_rollback_transaction(NULL, NULL, NULL);
                goto FINISH_OFF;
        }
                
        if (thread_item_count > 1){
-               if (!em_storage_update_latest_thread_mail(mail_table_data.account_id, mail_table_data.thread_id, 0, 0, false, &err)) {
-                       EM_DEBUG_EXCEPTION("em_storage_update_latest_thread_mail failed [%d]", err);
-                       em_storage_rollback_transaction(NULL, NULL, NULL);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+               if (!emstorage_update_latest_thread_mail(input_new_mail_tbl_data->account_id, input_new_mail_tbl_data->thread_id, 0, 0, false, &err)) {
+                       EM_DEBUG_EXCEPTION("emstorage_update_latest_thread_mail failed [%d]", err);
+                       emstorage_rollback_transaction(NULL, NULL, NULL);
                        goto FINISH_OFF;
                }
        }
+       if (output_thread_id)
+               *output_thread_id = input_new_mail_tbl_data->thread_id;
        
-       if (mail_id  != NULL)
-               *mail_id = mail_table_data.mail_id;
+       if (output_mail_id != NULL)
+               *output_mail_id = input_new_mail_tbl_data->mail_id;
        
-       if (!em_core_mailbox_add_read_mail_uid(input_maibox_data, input_maibox_data->mailbox_name, mail_table_data.mail_id, uid_elem->uid, mail_table_data.mail_size, 0, &err)) {
-               EM_DEBUG_EXCEPTION("em_core_mailbox_add_read_mail_uid failed [%d]", err);
-               em_storage_rollback_transaction(NULL, NULL, NULL);
+       EM_DEBUG_LOG("mail_table_data.mail_id [%d]", input_new_mail_tbl_data->mail_id);
+       EM_DEBUG_LOG("mail_table_data.thread_id [%d]", input_new_mail_tbl_data->thread_id);
+
+       if (!emcore_add_read_mail_uid(input_maibox_data, input_maibox_data->mailbox_name, input_new_mail_tbl_data->mail_id, input_new_mail_tbl_data->server_mail_id, input_new_mail_tbl_data->mail_size, 0, &err)) {
+               EM_DEBUG_EXCEPTION("emcore_add_read_mail_uid failed [%d]", err);
+               emstorage_rollback_transaction(NULL, NULL, NULL);
                goto FINISH_OFF;
        }
        
-       em_storage_commit_transaction(NULL, NULL, NULL);
-       ret = true;
+       emstorage_commit_transaction(NULL, NULL, NULL);
        
 FINISH_OFF: 
 
-       EM_SAFE_FREE(mail_table_data.datetime);
-       EM_SAFE_FREE(mail_table_data.email_address_sender);
-       EM_SAFE_FREE(mail_table_data.alias_sender);
-       EM_SAFE_FREE(mail_table_data.email_address_recipient);
-       EM_SAFE_FREE(mail_table_data.alias_recipient);
-
-       if (err_code  != NULL)
-               *err_code = err;
-       
-       EM_DEBUG_FUNC_END("ret [%d]", ret);     
-       return ret;
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
 }
 
-int em_core_mail_check_rule(emf_mail_head_t *head, emf_mail_rule_tbl_t *rule, int rule_len, int *matched, int *err_code)
+int emcore_check_rule(const char *input_full_address_from, const char *input_subject, emstorage_rule_tbl_t *rule, int rule_len, int *matched, int *err_code)
 {
-       EM_DEBUG_FUNC_BEGIN("head [%p], rule [%p], rule_len [%d], matched [%p], err_code [%p]", head, rule, rule_len, matched, err_code);
+       EM_DEBUG_FUNC_BEGIN("input_full_address_from [%p], input_subject [%p], rule [%p], rule_len [%d], matched [%p], err_code [%p]", input_full_address_from, input_subject, rule, rule_len, matched, err_code);
        
        int ret = false, err = EMF_ERROR_NONE, i;
        size_t len = 0;
@@ -1245,7 +1157,7 @@ int em_core_mail_check_rule(emf_mail_head_t *head, emf_mail_rule_tbl_t *rule, in
        char *from_address = NULL;
        ADDRESS *addr = NULL;
        
-       if (!matched || !head || !head->from || !head->subject) {
+       if (!matched || !input_full_address_from || !input_subject) {
                EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
                err = EMF_ERROR_INVALID_PARAM;
                goto FINISH_OFF;
@@ -1253,6 +1165,31 @@ int em_core_mail_check_rule(emf_mail_head_t *head, emf_mail_rule_tbl_t *rule, in
        
        *matched = -1;
        
+       rfc822_parse_adrlist(&addr, (char*)input_full_address_from, NULL);
+
+       if(addr) {
+               EM_DEBUG_LOG("rule : full_address_from[%s], addr->mailbox[%s], addr->host[%s]", input_full_address_from, addr->mailbox, addr->host);
+
+               if (addr->mailbox)
+                       len = strlen(addr->mailbox);
+               if (addr->host)
+                       len  += strlen(addr->host);
+                       len  += 2;
+
+               if (!(from_address = em_malloc(len))) {
+                       EM_DEBUG_EXCEPTION("em_malloc failed...");
+                       err = EMF_ERROR_OUT_OF_MEMORY;
+                       goto FINISH_OFF;
+               }
+
+               SNPRINTF(from_address, len, "%s@%s", addr->mailbox, addr->host);
+       }
+       else  {
+               EM_DEBUG_EXCEPTION("rfc822_parse_adrlist failed.");
+               err = EMF_ERROR_INVALID_ADDRESS;
+               goto FINISH_OFF;
+       }
+
        for (i = 0; i < rule_len; i++) {
                if (!(rule + i)) {
                        EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
@@ -1267,38 +1204,10 @@ int em_core_mail_check_rule(emf_mail_head_t *head, emf_mail_rule_tbl_t *rule, in
                        EM_DEBUG_LOG("rule[%d].flag2(rule id[%d]) is %d", i, rule[i].rule_id, rule[i].flag2);
                        switch (rule[i].type) {
                                case EMF_FILTER_FROM:
-                                       if (from_address == NULL) {
-                                           from_address = EM_SAFE_STRDUP(head->from);
-                                           rfc822_parse_adrlist(&addr, from_address, NULL);
-                                               if(addr) {
-                                                   EM_DEBUG_LOG("rule  :  head->from[%s], addr->mailbox[%s], addr->host[%s]", head->from, addr->mailbox, addr->host);
-                                                   EM_SAFE_FREE(from_address);
-                                       
-                                                   if (addr->mailbox)
-                                                               len = strlen(addr->mailbox);
-                                                   if (addr->host)
-                                                               len  += strlen(addr->host);
-                                                           len  += 2;
-
-                                                   if (!(from_address = em_core_malloc(len))) {
-                                                           EM_DEBUG_EXCEPTION("em_core_malloc failed...");
-                                                           err = EMF_ERROR_OUT_OF_MEMORY;
-                                                           goto FINISH_OFF;
-                                                   }
-                                               
-                                                   SNPRINTF(from_address, len, "%s@%s", addr->mailbox, addr->host); 
-                                               }
-                                               else  {
-                                                       EM_DEBUG_EXCEPTION("rfc822_parse_adrlist failed.");
-                                                       err = EMF_ERROR_INVALID_ADDRESS;
-                                                       goto FINISH_OFF;
-                                               }
-                                       }
-
                                        src = from_address;
                                        break;
                                case EMF_FILTER_SUBJECT:
-                                       src = head->subject;
+                                       src = (char*)input_subject;
                                        break;
                                case EMF_FILTER_BODY: 
                                        err = EMF_ERROR_NOT_SUPPORTED;
@@ -1342,7 +1251,7 @@ FINISH_OFF:
        return ret;
 }
 
-static int em_core_get_utf8_address(char **dest, ADDRESS *address, int *err_code)
+static int emcore_get_utf8_address(char **dest, ADDRESS *address, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("dest[%p], address[%p], err_code[%p]", dest, address, err_code);
        
@@ -1369,8 +1278,8 @@ static int em_core_get_utf8_address(char **dest, ADDRESS *address, int *err_code
                }
                EM_DEBUG_LOG("address->mailbox[%p]", address->personal);
                if (address->personal)  {
-                       if (!(nickname = em_core_decode_rfc2047_text(address->personal, &err)))  {
-                               EM_DEBUG_EXCEPTION("em_core_decode_rfc2047_text failed - %d", err);
+                       if (!(nickname = emcore_decode_rfc2047_text(address->personal, &err)))  {
+                               EM_DEBUG_EXCEPTION("emcore_decode_rfc2047_text failed - %d", err);
                                goto FINISH_OFF;
                        }
                        EM_DEBUG_LOG("nickname[%s]", nickname);
@@ -1411,110 +1320,147 @@ FINISH_OFF:
 }
 
 
-static int em_core_mail_parse_envelope(ENVELOPE *envelope, emf_mail_head_t **head, int *to_num, int *err_code)
+static int emcore_make_mail_tbl_data_from_envelope(MAILSTREAM *mail_stream, ENVELOPE *input_envelope, emcore_uid_list *input_uid_elem, emstorage_mail_tbl_t **output_mail_tbl_data,  int *err_code)
 {
        EM_PROFILE_BEGIN(emCoreParseEnvelope);
-       EM_DEBUG_FUNC_BEGIN("envelope[%p], head[%p], to_num[%p], err_code[%p]", envelope, head, to_num, err_code);
+       EM_DEBUG_FUNC_BEGIN("input_envelope[%p], input_uid_elem [%p], output_mail_tbl_data[%p],  err_code[%p]", input_envelope, input_uid_elem, output_mail_tbl_data, err_code);
 
        int ret = false;
        int err = EMF_ERROR_NONE;
-       
-       emf_mail_head_t *p = NULL;
-       int i = 0;
-       
-       if (!head) {
-               EM_DEBUG_EXCEPTION("envelope[%p], head[%p], to_num[%p]", envelope, head, to_num);
+       int priority = 3;
+       int req_read_receipt = 0;
+       struct tm             temp_time_info;
+       MESSAGECACHE         *mail_cache_element = NULL;
+       emstorage_mail_tbl_t *temp_mail_tbl_data = NULL;
+
+       if (!output_mail_tbl_data) {
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
                err = EMF_ERROR_INVALID_PARAM;
                goto FINISH_OFF;
        }
        
-       if (!(p = em_core_malloc(sizeof(emf_mail_head_t)))) {
-               EM_DEBUG_EXCEPTION("em_core_malloc failed...");
+       if (!(temp_mail_tbl_data = em_malloc(sizeof(emstorage_mail_tbl_t)))) {
+               EM_DEBUG_EXCEPTION("em_malloc failed...");
                err = EMF_ERROR_OUT_OF_MEMORY;
                goto FINISH_OFF;
        }
        
-       if (envelope->subject) {
-               p->subject = em_core_decode_rfc2047_text(envelope->subject, &err);
-               EM_DEBUG_LOG("subject[%s]", p->subject);
+       if (!(mail_cache_element = mail_elt(mail_stream, input_uid_elem->msgno))) {
+               EM_DEBUG_EXCEPTION("mail_elt failed...");
+               err = EMF_ERROR_UNKNOWN;
+               goto FINISH_OFF;
+       }
+
+       if (!emcore_get_mail_extra_info(mail_stream, input_uid_elem->msgno, &req_read_receipt, &priority, &err)) {
+               EM_DEBUG_EXCEPTION("emcore_get_mail_extra_info failed [%d]", err);
+               goto FINISH_OFF;
+       }
+
+       if (input_envelope->subject) {
+               temp_mail_tbl_data->subject = emcore_decode_rfc2047_text(input_envelope->subject, &err);
+               EM_DEBUG_LOG("subject[%s]", temp_mail_tbl_data->subject);
        }
        
-       if (envelope->from) {
-               if (!em_core_get_utf8_address(&p->from, envelope->from, &err)) {
-                       EM_DEBUG_EXCEPTION("em_core_get_utf8_address failed [%d]", err);
+       if (input_envelope->from) {
+               if (!emcore_get_utf8_address(&temp_mail_tbl_data->full_address_from, input_envelope->from, &err)) {
+                       EM_DEBUG_EXCEPTION("emcore_get_utf8_address failed [%d]", err);
                        goto FINISH_OFF;
                }
                
-               EM_DEBUG_LOG(" head->from[%s]", p->from);
+               EM_DEBUG_LOG("full_address_from[%s]", temp_mail_tbl_data->full_address_from);
        }
        
-       if (envelope->to) {
-               /*
-               ADDRESS *addr = NULL;           
-               
-               for (addr = envelope->to, i = 0; addr  != NULL; addr = addr->next, i++)
-                       EM_DEBUG_LOG("envelope->personal[%s], mailbox[%s], host[%s]", addr->personal, addr->mailbox, addr->host);
-               */
-
-               EM_DEBUG_LOG("envelope->to");
-               if (!em_core_get_utf8_address(&p->to, envelope->to, &err)) {
-                       EM_DEBUG_EXCEPTION("em_core_get_utf8_address failed [%d]", err);
+       if (input_envelope->to) {
+               EM_DEBUG_LOG("input_envelope->to");
+               if (!emcore_get_utf8_address(&temp_mail_tbl_data->full_address_to, input_envelope->to, &err)) {
+                       EM_DEBUG_EXCEPTION("emcore_get_utf8_address failed [%d]", err);
                        goto FINISH_OFF;
                }
                
-               EM_DEBUG_LOG("head->to[%s]", p->to);
+               EM_DEBUG_LOG("full_address_to[%s]", temp_mail_tbl_data->full_address_to);
        }
        
-       if (envelope->cc) {
-               EM_DEBUG_LOG("envelope->cc");
-               if (!em_core_get_utf8_address(&p->cc, envelope->cc, &err)) {
-                       EM_DEBUG_EXCEPTION("em_core_get_utf8_address failed [%d]", err);
+       if (input_envelope->cc) {
+               EM_DEBUG_LOG("input_envelope->cc");
+               if (!emcore_get_utf8_address(&temp_mail_tbl_data->full_address_cc, input_envelope->cc, &err)) {
+                       EM_DEBUG_EXCEPTION("emcore_get_utf8_address failed [%d]", err);
                        goto FINISH_OFF;
                }
                
-               EM_DEBUG_LOG("head->cc[%s]", p->cc);
+               EM_DEBUG_LOG("full_address_cc [%s]", temp_mail_tbl_data->full_address_cc);
        }
        
-       if (envelope->bcc) {
-               if (!em_core_get_utf8_address(&p->bcc, envelope->bcc, &err)) {
-                       EM_DEBUG_EXCEPTION("em_core_get_utf8_address failed [%d]", err);
+       if (input_envelope->bcc) {
+               if (!emcore_get_utf8_address(&temp_mail_tbl_data->full_address_bcc, input_envelope->bcc, &err)) {
+                       EM_DEBUG_EXCEPTION("emcore_get_utf8_address failed [%d]", err);
                        goto FINISH_OFF;
                }
                
-               EM_DEBUG_LOG("head->bcc[%s]", p->bcc);
+               EM_DEBUG_LOG("full_address_bcc [%s]", temp_mail_tbl_data->full_address_bcc);
        }
        
-       if (envelope->reply_to) {
-               if (!em_core_get_utf8_address(&p->reply_to, envelope->reply_to, &err)) {
-                       EM_DEBUG_EXCEPTION("em_core_get_utf8_address failed [%d]", err);
+       if (input_envelope->reply_to) {
+               if (!emcore_get_utf8_address(&temp_mail_tbl_data->full_address_reply, input_envelope->reply_to, &err)) {
+                       EM_DEBUG_EXCEPTION("emcore_get_utf8_address failed [%d]", err);
                        goto FINISH_OFF;
                }
                
-               EM_DEBUG_LOG("  head->reply_to[%s]\n", p->reply_to);
+               EM_DEBUG_LOG("full_address_reply [%s]\n", temp_mail_tbl_data->full_address_reply);
        }
        
-       if (envelope->return_path) {
-               if (!em_core_get_utf8_address(&p->return_path, envelope->return_path, &err)) {
-                       EM_DEBUG_EXCEPTION("em_core_get_utf8_address failed [%d]", err);
+       if (input_envelope->return_path) {
+               if (!emcore_get_utf8_address(&temp_mail_tbl_data->full_address_return , input_envelope->return_path, &err)) {
+                       EM_DEBUG_EXCEPTION("emcore_get_utf8_address failed [%d]", err);
                        goto FINISH_OFF;
                }
-               EM_DEBUG_LOG("head->return_path[%s]", p->return_path);
+               EM_DEBUG_LOG("full_address_return[%s]", temp_mail_tbl_data->full_address_return);
        }
        
-       p->mid = EM_SAFE_STRDUP(envelope->message_id);
-       
-       *head = p; 
-       p = NULL;
+       temp_mail_tbl_data->message_id            = EM_SAFE_STRDUP(input_envelope->message_id);
        
-       if (to_num  != NULL)
-               *to_num = i;
+       memset((void*)&temp_time_info, 0,  sizeof(struct tm));
+
+       temp_time_info.tm_sec  = mail_cache_element->seconds;
+       temp_time_info.tm_min  = mail_cache_element->minutes - mail_cache_element->zminutes;
+       temp_time_info.tm_hour = mail_cache_element->hours - mail_cache_element->zhours;
+
+       if(mail_cache_element->hours - mail_cache_element->zhours < 0) {
+               temp_time_info.tm_mday = mail_cache_element->day - 1;
+               temp_time_info.tm_hour += 24;
+       }
+       else
+               temp_time_info.tm_mday = mail_cache_element->day;
+
+       temp_time_info.tm_mon  = mail_cache_element->month - 1;
+       temp_time_info.tm_year = mail_cache_element->year + 70;
+
+       temp_mail_tbl_data->date_time             = timegm(&temp_time_info);
+
+       temp_mail_tbl_data->server_mail_status    = 1;
+       temp_mail_tbl_data->server_mail_id        = EM_SAFE_STRDUP(input_uid_elem->uid);
+       temp_mail_tbl_data->mail_size             = mail_cache_element->rfc822_size;
+       temp_mail_tbl_data->flags_seen_field      = input_uid_elem->flag.seen;
+       temp_mail_tbl_data->flags_deleted_field   = mail_cache_element->deleted;
+       temp_mail_tbl_data->flags_flagged_field   = mail_cache_element->flagged;
+       temp_mail_tbl_data->flags_answered_field  = mail_cache_element->answered;
+       temp_mail_tbl_data->flags_recent_field    = mail_cache_element->recent;
+       temp_mail_tbl_data->flags_draft_field     = mail_cache_element->draft;
+       temp_mail_tbl_data->flags_forwarded_field = input_uid_elem->flag.forwarded;
+       temp_mail_tbl_data->priority              = priority;
+       temp_mail_tbl_data->report_status         = (req_read_receipt ? 3  :  0);
+       temp_mail_tbl_data->attachment_count      = 0;
+
+       emcore_fill_address_information_of_mail_tbl(temp_mail_tbl_data);
+
+       *output_mail_tbl_data = temp_mail_tbl_data;
+       temp_mail_tbl_data = NULL;
        
        ret = true;
        
 FINISH_OFF: 
 
        if (ret != true)
-               EM_SAFE_FREE(p);
+               EM_SAFE_FREE(temp_mail_tbl_data);
        
        if (err_code  != NULL)
                *err_code = err;
@@ -1524,7 +1470,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_core_mailbox_sync_header(emf_mailbox_tbl_t *input_mailbox_tbl, emf_mailbox_tbl_t *input_mailbox_tbl_spam, void *stream_recycle, em_core_uid_list **input_uid_list, int *unread_mail, int *err_code)
+INTERNAL_FUNC int emcore_sync_header(emstorage_mailbox_tbl_t *input_mailbox_tbl, emstorage_mailbox_tbl_t *input_mailbox_tbl_spam, void *stream_recycle, emcore_uid_list **input_uid_list, int *unread_mail, int *err_code)
 {
        EM_PROFILE_BEGIN(emCoreSyncHeader);
        EM_DEBUG_FUNC_BEGIN("input_mailbox_tbl[%p], input_mailbox_tbl_spam[%p], input_uid_list [%p], err_code[%p]", input_mailbox_tbl, input_mailbox_tbl_spam, input_uid_list, err_code);
@@ -1533,11 +1479,11 @@ EXPORT_API int em_core_mailbox_sync_header(emf_mailbox_tbl_t *input_mailbox_tbl,
        int err = EMF_ERROR_NONE, err_2 = EMF_ERROR_NONE;
        int status = EMF_LIST_FAIL;
        int download_limit_count;
-       emf_account_t *account_ref = NULL;
-       emf_mail_rule_tbl_t *rule = NULL;
-       em_core_uid_list *uid_list = NULL;
-       em_core_uid_list *uid_elem = NULL;
-       emf_mail_head_t *head = NULL;
+       emf_account_t        *account_ref = NULL;
+       emstorage_rule_tbl_t *rule = NULL;
+       emcore_uid_list      *uid_list = NULL;
+       emcore_uid_list      *uid_elem = NULL;
+       emstorage_mail_tbl_t *new_mail_tbl_data = NULL;
        ENVELOPE *env = NULL;
        int account_id = 0, mail_id = 0, rule_len = 1000, total = 0, unread = 0, i = 0, percentage  = 0, thread_id = -1;
        void *stream = NULL;
@@ -1548,24 +1494,31 @@ EXPORT_API int em_core_mailbox_sync_header(emf_mailbox_tbl_t *input_mailbox_tbl,
                err = EMF_ERROR_INVALID_PARAM;
                goto FINISH_OFF;
        }
+
        account_id = input_mailbox_tbl->account_id;
-       account_ref = em_core_get_account_reference(account_id);
+       account_ref = emcore_get_account_reference(account_id);
        if (!account_ref) {             
-               EM_DEBUG_EXCEPTION("em_core_get_account_reference failed - %d", account_id);
+               EM_DEBUG_EXCEPTION("emcore_get_account_reference failed - %d", account_id);
                err = EMF_ERROR_INVALID_ACCOUNT;
                goto FINISH_OFF;
        }
        
+       if(account_ref->receiving_server_type == EMF_SERVER_TYPE_IMAP4 && input_mailbox_tbl->sync_with_server_yn == 0) {
+               EM_DEBUG_EXCEPTION("sync_with_server_yn flag is false for this mailbox");
+               err = EMF_ERROR_INVALID_MAILBOX;
+               goto FINISH_OFF;
+       }
+
        FINISH_OFF_IF_CANCELED;
        
 #ifndef        __FEATURE_KEEP_CONNECTION__
-       /*  h.gahlaut :  Recycling of stream is taken care internally in em_core_mailbox_open so no need of this code here */
+       /*  h.gahlaut :  Recycling of stream is taken care internally in emcore_connect_to_remote_mailbox so no need of this code here */
        if (stream_recycle)
                stream = stream_recycle; /*  set stream for recycling connection. */
 #endif
        
-       if (!em_core_mailbox_open(account_id, input_mailbox_tbl->mailbox_name, (void **)&stream, &err) || !stream){
-               EM_DEBUG_EXCEPTION("em_core_mailbox_open failed - %d", err);
+       if (!emcore_connect_to_remote_mailbox(account_id, input_mailbox_tbl->mailbox_name, (void **)&stream, &err) || !stream){
+               EM_DEBUG_EXCEPTION("emcore_connect_to_remote_mailbox failed - %d", err);
                status = EMF_LIST_CONNECTION_FAIL;
                goto FINISH_OFF;
        }
@@ -1573,9 +1526,9 @@ EXPORT_API int em_core_mailbox_sync_header(emf_mailbox_tbl_t *input_mailbox_tbl,
        FINISH_OFF_IF_CANCELED;
        
        /*  save total mail count on server to DB */
-       if (!em_storage_update_mailbox_total_count(account_id, input_mailbox_tbl->mailbox_name, ((MAILSTREAM *)stream)->nmsgs, 1, &err)){
-               EM_DEBUG_EXCEPTION("em_storage_update_mailbox_total_count failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+       if (!emstorage_update_mailbox_total_count(account_id, input_mailbox_tbl->mailbox_name, ((MAILSTREAM *)stream)->nmsgs, 1, &err)){
+               EM_DEBUG_EXCEPTION("emstorage_update_mailbox_total_count failed [%d]", err);
+
                goto FINISH_OFF;
        }
        
@@ -1593,12 +1546,12 @@ EXPORT_API int em_core_mailbox_sync_header(emf_mailbox_tbl_t *input_mailbox_tbl,
                        else if (!opt_ref->block_subject)
                                type = EMF_FILTER_FROM;
                        
-                       if (!em_storage_get_rule(ALL_ACCOUNT, type, 0, &rule_len, &is_completed, &rule, true, &err) || !rule) 
-                               EM_DEBUG_EXCEPTION("em_storage_get_rule failed - %d", err);
+                       if (!emstorage_get_rule(ALL_ACCOUNT, type, 0, &rule_len, &is_completed, &rule, true, &err) || !rule) 
+                               EM_DEBUG_EXCEPTION("emstorage_get_rule failed - %d", err);
                }
                download_limit_count = input_mailbox_tbl->mail_slot_size;
-               if (!em_core_mailbox_get_uids_to_download(stream, account_ref, input_mailbox_tbl, download_limit_count,  &uid_list, &total, EMF_SYNC_LATEST_MAILS_FIRST, &err)){
-                       EM_DEBUG_EXCEPTION("em_core_mailbox_get_uids_to_download failed [%d]", err);
+               if (!emcore_get_uids_to_download(stream, account_ref, input_mailbox_tbl, download_limit_count,  &uid_list, &total, EMF_SYNC_LATEST_MAILS_FIRST, &err)){
+                       EM_DEBUG_EXCEPTION("emcore_get_uids_to_download failed [%d]", err);
                        uid_list = NULL; 
                        goto FINISH_OFF;
                }
@@ -1606,7 +1559,7 @@ EXPORT_API int em_core_mailbox_sync_header(emf_mailbox_tbl_t *input_mailbox_tbl,
                FINISH_OFF_IF_CANCELED;
                
                if (input_uid_list && *input_uid_list){
-                       em_core_mailbox_free_uids(*input_uid_list, NULL);               
+                       emcore_free_uids(*input_uid_list, NULL);                
                        *input_uid_list = uid_list;
                }
                uid_elem = uid_list;
@@ -1619,8 +1572,8 @@ EXPORT_API int em_core_mailbox_sync_header(emf_mailbox_tbl_t *input_mailbox_tbl,
                EM_DEBUG_LOG("((MAILSTREAM *)stream)->nmsgs [%d]", ((MAILSTREAM *)stream)->nmsgs);
                EM_DEBUG_LOG("uid_list [%p]", uid_list);
                if (account_ref->receiving_server_type == EMF_SERVER_TYPE_IMAP4 && uid_list  != NULL){
-                       em_core_uid_list *uid_list_prev = NULL;
-                       em_core_uid_list *uid_list_fast = uid_list;  
+                       emcore_uid_list *uid_list_prev = NULL;
+                       emcore_uid_list *uid_list_fast = uid_list;  
                        int index = 0;
                        int msg_count = total;
                        int uid_range_size = msg_count * 8 + 1000;
@@ -1708,8 +1661,8 @@ EXPORT_API int em_core_mailbox_sync_header(emf_mailbox_tbl_t *input_mailbox_tbl,
                if (account_ref->receiving_server_type == EMF_SERVER_TYPE_IMAP4){
 #endif /*  __PARTIAL_BODY_FOR_POP3__ */
                        /*  Partial body download feature is only for IMAP accounts  */
-                       if (false == em_core_clear_partial_body_thd_event_que(&err))
-                               EM_DEBUG_LOG("em_core_clear_partial_body_thd_event_que failed [%d]", err);
+                       if (false == emcore_clear_partial_body_thd_event_que(&err))
+                               EM_DEBUG_LOG("emcore_clear_partial_body_thd_event_que failed [%d]", err);
 #ifndef __PARTIAL_BODY_FOR_POP3__
                }
 #endif /*  __PARTIAL_BODY_FOR_POP3__ */
@@ -1734,39 +1687,38 @@ EXPORT_API int em_core_mailbox_sync_header(emf_mailbox_tbl_t *input_mailbox_tbl,
                        }
                        FINISH_OFF_IF_CANCELED;
                        
-                       if (env  != NULL){
-                               int to_num = 0;
+                       if (env != NULL){
                                int matched = -1;
                                
-                               if (!em_core_mail_parse_envelope(env, &head, &to_num, &err) || !head) {
-                                       EM_DEBUG_EXCEPTION("em_core_mail_parse_envelope failed [%d]", err);
+                               if (!emcore_make_mail_tbl_data_from_envelope(stream, env, uid_elem, &new_mail_tbl_data, &err) || !new_mail_tbl_data) {
+                                       EM_DEBUG_EXCEPTION("emcore_make_mail_tbl_data_from_envelope failed [%d]", err);
                                        goto FINISH_OFF;
                                }
 
-                               if (rule && input_mailbox_tbl_spam && !em_core_mail_check_rule(head, rule, rule_len, &matched, &err)) {
-                                       EM_DEBUG_EXCEPTION("em_core_mail_check_rule failed [%d]", err);
+                               if (rule && input_mailbox_tbl_spam && !emcore_check_rule(new_mail_tbl_data->full_address_from, new_mail_tbl_data->subject, rule, rule_len, &matched, &err)) {
+                                       EM_DEBUG_EXCEPTION("emcore_check_rule failed [%d]", err);
                                        goto FINISH_OFF;
                                }
                                
                                if (matched >= 0 && input_mailbox_tbl_spam){    /*  add filtered mails to SPAMBOX */
                                        EM_DEBUG_LOG("mail[%d] added to spambox", mail_id);
                                        
-                                       if (!em_core_mail_add_header(stream, input_mailbox_tbl_spam, head, to_num, uid_elem, &mail_id, &thread_id, &err)) {
-                                               EM_DEBUG_EXCEPTION("em_core_mail_add_header falied [%d]", err);
+                                       if ( (err = emcore_add_mail_to_mailbox(input_mailbox_tbl_spam, new_mail_tbl_data, &mail_id, &thread_id)) != EMF_ERROR_NONE) {
+                                               EM_DEBUG_EXCEPTION("emcore_add_mail_to_mailbox falied [%d]", err);
                                                goto FINISH_OFF;
                                        }
                                        
                                        if (account_ref->receiving_server_type == EMF_SERVER_TYPE_IMAP4){
-                                               if (!em_core_mail_move_from_server(account_id, input_mailbox_tbl->mailbox_name,  &mail_id, 1, input_mailbox_tbl_spam->mailbox_name, &err)){
-                                                       EM_DEBUG_EXCEPTION("em_core_mail_move_from_server falied [%d]", err);
+                                               if (!emcore_move_mail_on_server(account_id, input_mailbox_tbl->mailbox_name,  &mail_id, 1, input_mailbox_tbl_spam->mailbox_name, &err)){
+                                                       EM_DEBUG_EXCEPTION("emcore_move_mail_on_server falied [%d]", err);
                                                        goto FINISH_OFF;
                                                }
                                        }
                                } else {        
                                        /*  add mails to specified mail box */
                                        EM_DEBUG_LOG("mail[%d] moved to input_mailbox_tbl [%s]", mail_id, input_mailbox_tbl->mailbox_name);
-                                       if (!em_core_mail_add_header(stream, input_mailbox_tbl, head, to_num, uid_elem, &mail_id, &thread_id,  &err)) {
-                                               EM_DEBUG_EXCEPTION("em_core_mail_add_header falied [%d]", err);
+                                       if ( (err = emcore_add_mail_to_mailbox(input_mailbox_tbl, new_mail_tbl_data, &mail_id, &thread_id)) != EMF_ERROR_NONE) {
+                                               EM_DEBUG_EXCEPTION("emcore_add_mail_to_mailbox falied [%d]", err);
                                                goto FINISH_OFF;
                                        }
                                        
@@ -1774,14 +1726,14 @@ EXPORT_API int em_core_mailbox_sync_header(emf_mailbox_tbl_t *input_mailbox_tbl,
 #ifndef __PARTIAL_BODY_FOR_POP3__
                                        if (account_ref->receiving_server_type == EMF_SERVER_TYPE_IMAP4) {
 #endif /*  __PARTIAL_BODY_FOR_POP3__ */
-                                               if (false == em_core_initiate_pbd(stream, account_id, mail_id, uid_elem->uid, input_mailbox_tbl->mailbox_name, &err))
+                                               if (false == emcore_initiate_pbd(stream, account_id, mail_id, uid_elem->uid, input_mailbox_tbl->mailbox_name, &err))
                                                        EM_DEBUG_LOG("Partial body download initiation failed [%d]", err);
 #ifndef __PARTIAL_BODY_FOR_POP3__
                                        }
 #endif /*  __PARTIAL_BODY_FOR_POP3__ */
 
                                        if (!uid_elem->flag.seen && input_mailbox_tbl->mailbox_type != EMF_MAILBOX_TYPE_SPAMBOX)
-                                               em_core_add_notification_for_unread_mail_by_mail_header(account_id, mail_id, head);
+                                               emcore_add_notification_for_unread_mail(new_mail_tbl_data);
                                        
                                        FINISH_OFF_IF_CANCELED;
                                        
@@ -1791,15 +1743,15 @@ EXPORT_API int em_core_mailbox_sync_header(emf_mailbox_tbl_t *input_mailbox_tbl,
                                        percentage = ((i+1) * 100) / total ;
                                        EM_DEBUG_LOG("Header Percentage Completed [%d] : [%d/%d]  mail_id [%d]", percentage, i+1, total, mail_id);
 
-                                       if (!em_storage_notify_storage_event(NOTI_MAIL_ADD, account_id, mail_id, input_mailbox_tbl->mailbox_name, thread_id))
-                                               EM_DEBUG_EXCEPTION("em_storage_notify_storage_event [NOTI_MAIL_ADD] failed");
+                                       if (!emstorage_notify_storage_event(NOTI_MAIL_ADD, account_id, mail_id, input_mailbox_tbl->mailbox_name, thread_id))
+                                               EM_DEBUG_EXCEPTION("emstorage_notify_storage_event [NOTI_MAIL_ADD] failed");
                                }
                                
                                /*  Release for envelope is not required and it may cause crash. Don't free the memory for envelope here. */
                                /*  Envelope data will be freed by garbage collector in mail_close_full */
-                               if (head){
-                                       em_core_mail_head_free(&head, 1, NULL); 
-                                       head = NULL;
+                               if (new_mail_tbl_data){
+                                       emstorage_free_mail(&new_mail_tbl_data, 1, NULL);
+                                       new_mail_tbl_data = NULL;
                                }
 
                                FINISH_OFF_IF_CANCELED;
@@ -1812,18 +1764,19 @@ EXPORT_API int em_core_mailbox_sync_header(emf_mailbox_tbl_t *input_mailbox_tbl,
                EM_PROFILE_END(emCoreSyncHeaderwhileloop);
        }
        
-       *unread_mail = unread;
        ret = true;
 FINISH_OFF: 
 
-       if (!em_core_mailbox_remove_overflowed_mails(input_mailbox_tbl, &err_2))
-               EM_DEBUG_EXCEPTION("em_core_mailbox_remove_overflowed_mails failed - %d", err_2);
+       *unread_mail = unread;
+
+       if (!emcore_remove_overflowed_mails(input_mailbox_tbl, &err_2))
+               EM_DEBUG_EXCEPTION("emcore_remove_overflowed_mails failed - %d", err_2);
 
-       if (head  != NULL)
-               em_core_mail_head_free(&head, 1, NULL);
+       if (new_mail_tbl_data)
+               emstorage_free_mail(&new_mail_tbl_data, 1, NULL);
        
        if (uid_list != NULL){
-               em_core_mailbox_free_uids(uid_list, NULL);
+               emcore_free_uids(uid_list, NULL);
                /*  uid_list point to the same memory with input_mailbox_tbl->user_data.  */
                /*  input_mailbox_tbl->user_data should be set NULL if uid_list is freed */
                *input_uid_list = NULL;
@@ -1832,14 +1785,14 @@ FINISH_OFF:
        EM_SAFE_FREE(uid_range);
 
        if (rule  != NULL)
-               em_storage_free_rule(&rule, rule_len, NULL); 
+               emstorage_free_rule(&rule, rule_len, NULL); 
 
 #ifdef __FEATURE_KEEP_CONNECTION__     
        if (stream  != NULL) {
 #else /*  __FEATURE_KEEP_CONNECTION__   */
        if (stream  != NULL && stream_recycle == NULL)  {
 #endif /*  __FEATURE_KEEP_CONNECTION__  */
-               em_core_mailbox_close(0, stream);                               
+               emcore_close_mailbox(0, stream);                                
                stream = NULL;
        }
 
@@ -1852,9 +1805,9 @@ FINISH_OFF:
 }
 
 
-em_core_uid_list *__ReverseList(em_core_uid_list *uid_list)
+emcore_uid_list *__ReverseList(emcore_uid_list *uid_list)
 {
-       em_core_uid_list *temp, *current, *result;
+       emcore_uid_list *temp, *current, *result;
 
        temp = NULL;
        result = NULL;
@@ -1872,7 +1825,7 @@ em_core_uid_list *__ReverseList(em_core_uid_list *uid_list)
 
                        
 
-int em_core_mailbox_download_uid_all(emf_mailbox_t *mailbox, em_core_uid_list** uid_list, int *total, emf_mail_read_mail_uid_tbl_t *downloaded_uids, int count, em_core_get_uids_for_delete_t for_delete, int *err_code)
+int emcore_download_uid_all(emf_mailbox_t *mailbox, emcore_uid_list** uid_list, int *total, emstorage_read_mail_uid_tbl_t *downloaded_uids, int count, emcore_get_uids_for_delete_t for_delete, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("mailbox[%p], uid_list[%p], total[%p], downloaded_uids[%p], count[%d], for_delete[%d], err_code[%p]", mailbox, uid_list, total, downloaded_uids, count, for_delete, err_code);
 
@@ -1881,8 +1834,8 @@ int em_core_mailbox_download_uid_all(emf_mailbox_t *mailbox, em_core_uid_list**
        
        MAILSTREAM *stream = NULL;
        emf_account_t *ref_account = NULL;
-       em_core_uid_list *uid_elem = NULL;
-       em_core_uid_list *fetch_data_p = NULL;
+       emcore_uid_list *uid_elem = NULL;
+       emcore_uid_list *fetch_data_p = NULL;
        void *tmp_stream = NULL;
        char cmd[64] = {0x00, };
        char *p = NULL;
@@ -1894,16 +1847,16 @@ int em_core_mailbox_download_uid_all(emf_mailbox_t *mailbox, em_core_uid_list**
                goto FINISH_OFF;
        }
 
-       if (!(ref_account = em_core_get_account_reference(mailbox->account_id))) {
-               EM_DEBUG_EXCEPTION("em_core_get_account_reference failed - %d", mailbox->account_id);
+       if (!(ref_account = emcore_get_account_reference(mailbox->account_id))) {
+               EM_DEBUG_EXCEPTION("emcore_get_account_reference failed - %d", mailbox->account_id);
                
                err = EMF_ERROR_INVALID_ACCOUNT;
                goto FINISH_OFF;
        }
 
        if (!mailbox->mail_stream) {
-               if (!em_core_mailbox_open(mailbox->account_id, mailbox->name, (void **)&tmp_stream, &err)){
-                       EM_DEBUG_EXCEPTION("em_core_mailbox_open failed...");
+               if (!emcore_connect_to_remote_mailbox(mailbox->account_id, mailbox->name, (void **)&tmp_stream, &err)){
+                       EM_DEBUG_EXCEPTION("emcore_connect_to_remote_mailbox failed...");
                        
                        goto FINISH_OFF;
                }
@@ -1966,7 +1919,7 @@ int em_core_mailbox_download_uid_all(emf_mailbox_t *mailbox, em_core_uid_list**
                        
                        /* EM_DEBUG_LOG("UID list [%s]", p); */
                        
-                       uid_elem = (em_core_uid_list *)malloc(sizeof(em_core_uid_list));
+                       uid_elem = (emcore_uid_list *)malloc(sizeof(emcore_uid_list));
                        if (!uid_elem) {
                                EM_DEBUG_EXCEPTION("malloc falied...");
                                
@@ -1974,7 +1927,7 @@ int em_core_mailbox_download_uid_all(emf_mailbox_t *mailbox, em_core_uid_list**
                                goto FINISH_OFF;
                        }
                        
-                       memset(uid_elem, 0x00, sizeof(em_core_uid_list));
+                       memset(uid_elem, 0x00, sizeof(emcore_uid_list));
                        
                        /*  format  :  "1 AAA6FHEAAAQrB6c1ymXxty04yks7hcQ7" */
                        
@@ -1997,7 +1950,7 @@ int em_core_mailbox_download_uid_all(emf_mailbox_t *mailbox, em_core_uid_list**
                                }
                        }
                        
-                       if (*uid_list) {                /* TODO :  modify me */
+                       if (*uid_list) {
                                fetch_data_p = *uid_list;
                                
                                while (fetch_data_p->next)
@@ -2066,7 +2019,7 @@ int em_core_mailbox_download_uid_all(emf_mailbox_t *mailbox, em_core_uid_list**
                                }
                        }
                        
-                       uid_elem = (em_core_uid_list *)malloc(sizeof(em_core_uid_list));
+                       uid_elem = (emcore_uid_list *)malloc(sizeof(emcore_uid_list));
                        if (!uid_elem) {
                                EM_DEBUG_EXCEPTION("malloc failed...");
                                
@@ -2074,7 +2027,7 @@ int em_core_mailbox_download_uid_all(emf_mailbox_t *mailbox, em_core_uid_list**
                                goto FINISH_OFF;
                        }
                        
-                       memset(uid_elem, 0x00, sizeof(em_core_uid_list));
+                       memset(uid_elem, 0x00, sizeof(emcore_uid_list));
                        /*  parse uid, sequence, flags from replied data */
                        
                        /*  parse uid from replied data */
@@ -2119,7 +2072,7 @@ int em_core_mailbox_download_uid_all(emf_mailbox_t *mailbox, em_core_uid_list**
                        if (downloaded_uids) {
                                int i;
                                for (i = 0; i < count; ++i) {
-                                       if (uid_elem->uid && !strcmp(uid_elem->uid, downloaded_uids[i].s_uid)) {                /*  20080308 - prevent 25231  :  Reverse Null. Pointer "(uid_elem)->uid" dereferenced before NULL check */
+                                       if (uid_elem->uid && !strcmp(uid_elem->uid, downloaded_uids[i].s_uid)) {
                                                downloaded_uids[i].flag = 1;
                                                free(uid_elem->uid);
                                                free(uid_elem); uid_elem = NULL;
@@ -2159,7 +2112,7 @@ FINISH_OFF:
                free(p);
        
        if (mailbox && !mailbox->mail_stream) {
-               em_core_mailbox_close(0, stream);
+               emcore_close_mailbox(0, stream);
                stream = NULL;
        }
        
@@ -2170,7 +2123,7 @@ FINISH_OFF:
        return ret;
 }
 
-int em_core_mailbox_download_imap_msgno(emf_mailbox_t *mailbox, char *uid, int *msgno, int *err_code)
+int emcore_download_imap_msgno(emf_mailbox_t *mailbox, char *uid, int *msgno, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("mailbox[%p], uid[%p], msgno[%p], err_code[%p]", mailbox, uid, msgno, err_code);
 
@@ -2190,8 +2143,8 @@ int em_core_mailbox_download_imap_msgno(emf_mailbox_t *mailbox, char *uid, int *
                goto FINISH_OFF;
        }
 
-       if (!(ref_account = em_core_get_account_reference(mailbox->account_id))) {
-               EM_DEBUG_EXCEPTION("em_core_get_account_reference failed [%d]", mailbox->account_id);
+       if (!(ref_account = emcore_get_account_reference(mailbox->account_id))) {
+               EM_DEBUG_EXCEPTION("emcore_get_account_reference failed [%d]", mailbox->account_id);
                
                err = EMF_ERROR_INVALID_ACCOUNT;
                goto FINISH_OFF;
@@ -2203,8 +2156,8 @@ int em_core_mailbox_download_imap_msgno(emf_mailbox_t *mailbox, char *uid, int *
        }
 
        if (!mailbox->mail_stream) {
-               if (!em_core_mailbox_open(mailbox->account_id, mailbox->name, (void **)&tmp_stream, &err)) {
-                       EM_DEBUG_EXCEPTION("em_core_mailbox_open failed - %d", err);
+               if (!emcore_connect_to_remote_mailbox(mailbox->account_id, mailbox->name, (void **)&tmp_stream, &err)) {
+                       EM_DEBUG_EXCEPTION("emcore_connect_to_remote_mailbox failed - %d", err);
                        
                        goto FINISH_OFF;
                }
@@ -2265,7 +2218,7 @@ FINISH_OFF:
                free(p);
        
        if (mailbox && !mailbox->mail_stream){
-               em_core_mailbox_close(0, stream);                               
+               emcore_close_mailbox(0, stream);                                
                stream = NULL;
        }
        
@@ -2276,7 +2229,7 @@ FINISH_OFF:
        return ret;
 }
 
-int em_core_mailbox_get_msgno(em_core_uid_list *uid_list, char *uid, int *msgno, int *err_code)
+int emcore_get_msgno(emcore_uid_list *uid_list, char *uid, int *msgno, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("uid_list[%p], uid[%s], msgno[%p], err_code[%p]", uid_list, uid, msgno, err_code);
        
@@ -2315,7 +2268,7 @@ FINISH_OFF:
        return ret;
 }
 
-int em_core_mailbox_get_uid(em_core_uid_list *uid_list, int msgno, char **uid, int *err_code)
+int emcore_get_uid(emcore_uid_list *uid_list, int msgno, char **uid, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
        
@@ -2354,13 +2307,13 @@ FINISH_OFF:
        return ret;
 }
 
-int em_core_mailbox_free_uids(em_core_uid_list *uid_list, int *err_code)
+int emcore_free_uids(emcore_uid_list *uid_list, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("uid_list[%p], err_code[%p]", uid_list, err_code);
        
        int ret = false;
        int err = EMF_ERROR_NONE;
-       em_core_uid_list *p = NULL;
+       emcore_uid_list *p = NULL;
        
        if (!uid_list) {
                EM_DEBUG_EXCEPTION(" uid_list[%p]\n", uid_list);
@@ -2370,10 +2323,9 @@ int em_core_mailbox_free_uids(em_core_uid_list *uid_list, int *err_code)
        }
 
        while (uid_list) {
-               p = uid_list; uid_list = uid_list->next;
-               
+               p = uid_list;
+               uid_list = uid_list->next;
                EM_SAFE_FREE(p->uid);
-               
                free(p);
                p = NULL;
        }
@@ -2402,25 +2354,26 @@ void mail_appenduid(char *mailbox, unsigned long uidvalidity, SEARCHSET *set)
     EM_DEBUG_LOG("append uid - %s", g_append_uid_rsp);
 }
 
-EXPORT_API int em_core_mail_sync_from_client_to_server(int account_id, int mail_id, int *err_code)
+INTERNAL_FUNC int emcore_sync_mail_from_client_to_server(int account_id, int mail_id, int *err_code)
 {
-       EM_DEBUG_FUNC_BEGIN("account_id [%d], mail_id [%d], mail_id [%p]", account_id, mail_id, *err_code);
-
-       int                             err             = EMF_ERROR_NONE;
-       int                             ret             = false;
-       int                             len             = 0;
-       int                             read_size       = 0;
-       char                           *fname           = NULL;
-       char                           *long_enc_path   = NULL;
-       char                           *data            = NULL;
-       char                            set_flags[100]  = { 0, };
-       ENVELOPE                       *envelope        = NULL;
-       FILE                           *fp              = NULL;
+       EM_DEBUG_FUNC_BEGIN("account_id [%d], mail_id [%d], err_code [%p]", account_id, mail_id, *err_code);
+
+       int                             err                  = EMF_ERROR_NONE;
+       int                             ret                  = false;
+       int                             len                  = 0;
+       int                             read_size            = 0;
+       int                             attachment_tbl_count = 0;
+       char                           *fname                = NULL;
+       char                           *long_enc_path        = NULL;
+       char                           *data                 = NULL;
+       char                            set_flags[100]       = { 0, };
+       ENVELOPE                       *envelope             = NULL;
+       FILE                           *fp                   = NULL;
        STRING                          str;
-       MAILSTREAM                     *stream          = NULL;
-       emf_mail_t                     *mail            = NULL;
-       emf_mail_tbl_t                 *mail_table_data = NULL;
-       emf_mailbox_tbl_t              *mailbox_tbl     = NULL;
+       MAILSTREAM                     *stream               = NULL;
+       emstorage_mail_tbl_t           *mail_table_data      = NULL;
+       emstorage_attachment_tbl_t     *attachment_tbl_data  = NULL;
+       emstorage_mailbox_tbl_t        *mailbox_tbl          = NULL;
 
        if (mail_id < 1){
         EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
@@ -2429,14 +2382,19 @@ EXPORT_API int em_core_mail_sync_from_client_to_server(int account_id, int mail_
        }
 
        /*  get a mail from mail table */
-       if (!em_storage_get_mail_by_id(mail_id, &mail_table_data, true, &err)) {
-               EM_DEBUG_EXCEPTION("em_storage_get_mail_by_id failed [%d]", err);
+       if (!emstorage_get_mail_by_id(mail_id, &mail_table_data, true, &err)) {
+               EM_DEBUG_EXCEPTION("emstorage_get_mail_by_id failed [%d]", err);
+               goto FINISH_OFF;
+       }
+
+       if ( (err = emstorage_get_attachment_list(mail_id, false, &attachment_tbl_data, &attachment_tbl_count)) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("emstorage_get_attachment_list failed [%d]", err);
                goto FINISH_OFF;
        }
 
        EM_DEBUG_LOG("mailbox_name [%s]", mail_table_data->mailbox_name);
-       if (!em_storage_get_mailbox_by_name(mail_table_data->account_id, 0, mail_table_data->mailbox_name, &mailbox_tbl, false, &err) || !mailbox_tbl){
-               EM_DEBUG_EXCEPTION("em_storage_get_mailbox_by_name failed [%d]", err);
+       if (!emstorage_get_mailbox_by_name(mail_table_data->account_id, 0, mail_table_data->mailbox_name, &mailbox_tbl, false, &err) || !mailbox_tbl){
+               EM_DEBUG_EXCEPTION("emstorage_get_mailbox_by_name failed [%d]", err);
                goto FINISH_OFF;
        }
 
@@ -2446,14 +2404,8 @@ EXPORT_API int em_core_mail_sync_from_client_to_server(int account_id, int mail_
                goto FINISH_OFF;
        }
 
-       /*  get a mail to send */
-       if (!em_core_mail_get_mail(mail_id, &mail, &err)){
-               EM_DEBUG_EXCEPTION(" em_core_mail_get_mail failed [%d]", err);
-               goto FINISH_OFF;
-       }
-
-       if (!em_core_get_long_encoded_path(mail_table_data->account_id, mail_table_data->mailbox_name, '/', &long_enc_path, &err)) {
-               EM_DEBUG_EXCEPTION(">>em_core_get_long_encoded_path  :  Failed [%d] ", err);
+       if (!emcore_get_long_encoded_path(mail_table_data->account_id, mail_table_data->mailbox_name, '/', &long_enc_path, &err)) {
+               EM_DEBUG_EXCEPTION(">>emcore_get_long_encoded_path  :  Failed [%d] ", err);
                goto FINISH_OFF;
        }
 
@@ -2462,14 +2414,13 @@ EXPORT_API int em_core_mail_sync_from_client_to_server(int account_id, int mail_
            goto FINISH_OFF;
        }
 
-       if (!em_core_mail_get_rfc822(mail, &envelope, &fname, NULL, &err)){
-           EM_DEBUG_EXCEPTION(" em_core_mail_get_rfc822 failed [%d]", err);
+       if (!emcore_make_rfc822_file_from_mail(mail_table_data, attachment_tbl_data, attachment_tbl_count, &envelope, &fname, NULL, &err)){
+           EM_DEBUG_EXCEPTION(" emcore_make_rfc822_file_from_mail failed [%d]", err);
            goto FINISH_OFF;                        
        }
 
        if (fname){
-           if (!(fp = fopen(fname, "a+"))) 
-           {
+           if (!(fp = fopen(fname, "a+"))) {
                EM_DEBUG_EXCEPTION("fopen failed - %s", fname);
                        err = EMF_ERROR_SYSTEM_FAILURE;
                goto FINISH_OFF;
@@ -2493,8 +2444,8 @@ EXPORT_API int em_core_mail_sync_from_client_to_server(int account_id, int mail_
 
        ret = 0;
        stream = NULL;
-       if (!em_core_mailbox_open(mail_table_data->account_id, NULL, (void **)&stream, &err)){
-           EM_DEBUG_EXCEPTION("em_core_mail_move_from_server failed :  Mailbox open[%d]", err);
+       if (!emcore_connect_to_remote_mailbox(mail_table_data->account_id, NULL, (void **)&stream, &err)){
+           EM_DEBUG_EXCEPTION("emcore_move_mail_on_server failed :  Mailbox open[%d]", err);
            goto FINISH_OFF;
        }
 
@@ -2513,7 +2464,7 @@ EXPORT_API int em_core_mail_sync_from_client_to_server(int account_id, int mail_
 
        sprintf(set_flags, "\\Seen");
 
-       if ((mail->info->flags).seen){
+       if (mail_table_data->flags_seen_field){
                if (!mail_append_full(stream, long_enc_path, set_flags, NULL, &str)) {
                    EM_DEBUG_EXCEPTION("mail_append  failed -");
                    goto FINISH_OFF;
@@ -2527,9 +2478,9 @@ EXPORT_API int em_core_mail_sync_from_client_to_server(int account_id, int mail_
        }
 
        /* Update read_mail_uid tbl */
-       if (!em_core_mailbox_add_read_mail_uid(mailbox_tbl, mail_table_data->mailbox_name, mail_table_data->mail_id, g_append_uid_rsp, mail_table_data->mail_size, 0, &err)) {
-               EM_DEBUG_EXCEPTION(" em_core_mailbox_add_read_mail_uid failed [%d]", err);
-               em_storage_rollback_transaction(NULL, NULL, NULL);
+       if (!emcore_add_read_mail_uid(mailbox_tbl, mail_table_data->mailbox_name, mail_table_data->mail_id, g_append_uid_rsp, mail_table_data->mail_size, 0, &err)) {
+               EM_DEBUG_EXCEPTION(" emcore_add_read_mail_uid failed [%d]", err);
+               emstorage_rollback_transaction(NULL, NULL, NULL);
                goto FINISH_OFF;
        }
 
@@ -2537,10 +2488,10 @@ EXPORT_API int em_core_mail_sync_from_client_to_server(int account_id, int mail_
 
 FINISH_OFF: 
 
-#ifdef __LOCAL_ACTIVITY__
+#ifdef __FEATURE_LOCAL_ACTIVITY__
        if (ret){
-               emf_activity_tbl_t new_activity;
-               memset(&new_activity, 0x00, sizeof(emf_activity_tbl_t));
+               emstorage_activity_tbl_t new_activity;
+               memset(&new_activity, 0x00, sizeof(emstorage_activity_tbl_t));
                new_activity.activity_type = ACTIVITY_SAVEMAIL;
                new_activity.account_id    = account_id;
                new_activity.mail_id       = mail_id;
@@ -2548,11 +2499,11 @@ FINISH_OFF:
                new_activity.server_mailid = NULL;
                new_activity.src_mbox      = NULL;
 
-               if (!em_core_activity_delete(&new_activity, &err)){
+               if (!emcore_delete_activity(&new_activity, &err)){
                        EM_DEBUG_EXCEPTION(">>>>>>Local Activity [ACTIVITY_SAVEMAIL] [%d] ", err);
                }
        }
-#endif /* __LOCAL_ACTIVITY__ */        
+#endif /* __FEATURE_LOCAL_ACTIVITY__ */        
 
        EM_SAFE_FREE(data);
        EM_SAFE_FREE(long_enc_path);
@@ -2563,14 +2514,14 @@ FINISH_OFF:
        if (envelope)
                mail_free_envelope(&envelope);
 
-       if (mail) 
-               em_core_mail_free(&mail, 1, NULL);
-
        if (mail_table_data)
-               em_storage_free_mail(&mail_table_data, 1, NULL);
+               emstorage_free_mail(&mail_table_data, 1, NULL);
+
+       if (attachment_tbl_data)
+               emstorage_free_attachment(&attachment_tbl_data, attachment_tbl_count, NULL);
 
        if (mailbox_tbl)
-               em_storage_free_mailbox(&mailbox_tbl, 1, NULL);
+               emstorage_free_mailbox(&mailbox_tbl, 1, NULL);
 
        if (fname) {
                remove(fname);
@@ -2578,7 +2529,7 @@ FINISH_OFF:
        }
 
        if (stream){
-               em_core_mailbox_close(0, stream);                               
+               emcore_close_mailbox(0, stream);                                
                stream = NULL;  
        }
 
@@ -2592,7 +2543,7 @@ FINISH_OFF:
 
 #ifdef __FEATURE_PARTIAL_BODY_DOWNLOAD__
 
-static int em_core_initiate_pbd(MAILSTREAM *stream, int account_id, int mail_id, char *uid, char *input_mailbox_name, int *err_code)
+static int emcore_initiate_pbd(MAILSTREAM *stream, int account_id, int mail_id, char *uid, char *input_mailbox_name, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id [%d], mail_id[%d], uid[%p], input_mailbox_name[%p]", account_id, mail_id, uid, input_mailbox_name);
 
@@ -2606,7 +2557,7 @@ static int em_core_initiate_pbd(MAILSTREAM *stream, int account_id, int mail_id,
                goto FINISH_OFF;
        }
 
-       account_ref = em_core_get_account_reference(account_id);
+       account_ref = emcore_get_account_reference(account_id);
 
        emf_event_partial_body_thd pbd_event;
 
@@ -2626,12 +2577,12 @@ static int em_core_initiate_pbd(MAILSTREAM *stream, int account_id, int mail_id,
        EM_DEBUG_LOG("uid [%s]", uid);
        EM_DEBUG_LOG("pbd_event.account_id[%d], pbd_event.mail_id[%d], pbd_event.server_mail_id [%d]", pbd_event.account_id, pbd_event.mail_id , pbd_event.server_mail_id);
        
-       if (!em_core_insert_pbd_activity(&pbd_event, &pbd_event.activity_id, &err)){
+       if (!emcore_insert_pbd_activity(&pbd_event, &pbd_event.activity_id, &err)){
                EM_DEBUG_EXCEPTION("Inserting Partial Body Download activity failed with error[%d]", err);
                goto FINISH_OFF;
        }
        else{
-               if (false == em_core_is_partial_body_thd_que_full()){
+               if (false == emcore_is_partial_body_thd_que_full()){
                        /* h.gahaut :  Before inserting the event into event queue activity_type should be made 0
                        Because partial body thread differentiates events coming from DB and event queue 
                        on the basis of activity_type and event_type fields */
@@ -2639,13 +2590,13 @@ static int em_core_initiate_pbd(MAILSTREAM *stream, int account_id, int mail_id,
                        pbd_event.activity_type = 0;
                        pbd_event.event_type = EMF_EVENT_BULK_PARTIAL_BODY_DOWNLOAD;
                        
-                       if (!em_core_insert_partial_body_thread_event(&pbd_event, &err)){
+                       if (!emcore_insert_partial_body_thread_event(&pbd_event, &err)){
                                EM_DEBUG_EXCEPTION("Inserting Partial body thread event failed with error[%d]", err);
                                goto FINISH_OFF;
                        }
 
                        /*h.gahlaut :  Partial body thread has created a copy of event for itself so this local event should be freed here*/
-                       if (!em_core_free_partial_body_thd_event(&pbd_event, &err))
+                       if (!emcore_free_partial_body_thd_event(&pbd_event, &err))
                                EM_DEBUG_EXCEPTION("Freeing Partial body thread event failed with error[%d]", err);
                }
                else{
@@ -2667,7 +2618,7 @@ static int em_core_initiate_pbd(MAILSTREAM *stream, int account_id, int mail_id,
 #define UID_RANGE_STRING_LENGTH 3000
 #define TEMP_STRING_LENGTH             50
 
-static int em_core_parse_html_part_for_partial_body(char *start_header, char *boundary_string, char *bufsendforparse, char *text_html, int body_size)
+static int emcore_parse_html_part_for_partial_body(char *start_header, char *boundary_string, char *bufsendforparse, char *text_html, int body_size)
 {
        EM_DEBUG_FUNC_BEGIN("start_header [%s], boundary_string [%s], bufsendforparse [%s], text_html [%s], body_size [%d]", start_header, boundary_string, bufsendforparse, text_html, body_size);
 
@@ -2772,15 +2723,15 @@ static int em_core_parse_html_part_for_partial_body(char *start_header, char *bo
 
                        memcpy(text_html, start, end - txt_html);
                        
-                       if (em_core_decode_body_text(text_html, end - txt_html, enc_type , &dec_len, &err) < 0) 
-                               EM_DEBUG_EXCEPTION("em_core_decode_body_text failed [%d]", err);
+                       if (emcore_decode_body_text(text_html, end - txt_html, enc_type , &dec_len, &err) < 0) 
+                               EM_DEBUG_EXCEPTION("emcore_decode_body_text failed [%d]", err);
                }
                else if (start_header && ((temp_enc1 = (char *)strcasestr(start_header, "Content-transfer-encoding:"))  != NULL) && !(temp_enc1 && temp_enc1 >= end)){
                        if (temp_enc1)
                                start_header = temp_enc1;
 
                        start_header += strlen("Content-Transfer-Encoding:");
-                       start_header = em_core_skip_whitespace_without_strdup(start_header);
+                       start_header = em_skip_whitespace_without_strdup(start_header);
 
                        if (!start_header)
                                EM_DEBUG_EXCEPTION(" Invalid parsing ");
@@ -2795,8 +2746,8 @@ static int em_core_parse_html_part_for_partial_body(char *start_header, char *bo
                                
                                memcpy(text_html, start, end - txt_html);
                                
-                               if (em_core_decode_body_text(text_html, end - txt_html, enc_type , &dec_len, &err) < 0) 
-                                       EM_DEBUG_EXCEPTION("em_core_decode_body_text failed [%d]", err);
+                               if (emcore_decode_body_text(text_html, end - txt_html, enc_type , &dec_len, &err) < 0) 
+                                       EM_DEBUG_EXCEPTION("emcore_decode_body_text failed [%d]", err);
                                html_length = dec_len;
                        }
                        
@@ -2820,6 +2771,7 @@ static int em_core_parse_html_part_for_partial_body(char *start_header, char *bo
 
 
 /*For the following scenario
+*------= SAMSUNG_mySingle_MIME_MULTIPART_BOUNDARY
 *Content-Transfer-Encoding :  base64
 *Content-Type :  text/plain; charset = "windows-1252"
 *MIME-Version :  1.0
@@ -2828,7 +2780,7 @@ static int em_core_parse_html_part_for_partial_body(char *start_header, char *bo
 
 #define CONTENT_TRANSFER_ENCODING "Content-Transfer-Encoding"
 
-static int em_core_parse_plain_part_for_partial_body(char *header_start_string, char *start_header, char *boundary_string, char *bufsendforparse, char *text_plain, int body_size)
+static int emcore_parse_plain_part_for_partial_body(char *header_start_string, char *start_header, char *boundary_string, char *bufsendforparse, char *text_plain, int body_size)
 {
        EM_DEBUG_FUNC_BEGIN("header_start_string[%s], start_header[%s], boundary_string [%s], bufsendforparse [%s], text_plain [%s]", header_start_string, start_header, boundary_string, bufsendforparse, text_plain);
        int   err = EMF_ERROR_NONE, iEncodingHeader = 0, enc_type = ENCOTHER;
@@ -2896,15 +2848,15 @@ static int em_core_parse_plain_part_for_partial_body(char *header_start_string,
 
                                memcpy(text_plain, start, end - txt_plain);
                                
-                               if (em_core_decode_body_text(text_plain, end - txt_plain, enc_type , &dec_len, &err) < 0) 
-                                       EM_DEBUG_EXCEPTION("em_core_decode_body_text failed [%d]", err);
+                               if (emcore_decode_body_text(text_plain, end - txt_plain, enc_type , &dec_len, &err) < 0) 
+                                       EM_DEBUG_EXCEPTION("emcore_decode_body_text failed [%d]", err);
                        }
                        else if (start_header && ((temp_enc1 = (char *)strcasestr(start_header, "Content-transfer-encoding:"))  != NULL) && !(temp_enc1 && temp_enc1 >= end)){
                                if (temp_enc1)
                                        start_header = temp_enc1;
 
                                start_header += strlen("Content-Transfer-Encoding:");
-                               start_header = em_core_skip_whitespace_without_strdup(start_header);
+                               start_header = em_skip_whitespace_without_strdup(start_header);
 
                                if (!start_header)
                                        EM_DEBUG_EXCEPTION(" Invalid parsing ");
@@ -2917,8 +2869,8 @@ static int em_core_parse_plain_part_for_partial_body(char *header_start_string,
                        
                                        EM_DEBUG_LOG("enc_type [%d]", enc_type);
                                        memcpy(text_plain, start, end - txt_plain);
-                                       if (em_core_decode_body_text(text_plain, end - txt_plain, enc_type , &dec_len, &err) < 0) 
-                                               EM_DEBUG_EXCEPTION("em_core_decode_body_text failed [%d]", err);
+                                       if (emcore_decode_body_text(text_plain, end - txt_plain, enc_type , &dec_len, &err) < 0) 
+                                               EM_DEBUG_EXCEPTION("emcore_decode_body_text failed [%d]", err);
                                }
                                
                                EM_DEBUG_LOG("Decoded length = %d", dec_len);
@@ -2939,22 +2891,22 @@ static int em_core_parse_plain_part_for_partial_body(char *header_start_string,
 
 
 
-/*  Content-Type :  IMAGE/octet-stream; name = Default.png */
-/*  Content-Transfer-Encoding :  BASE64 */
-/*  Content-ID:  <4b0d6810b17291f9438783a8eb9d5228@email-service> */
-/*  Content-Disposition :  inline; filename = Default.png */
+/*  Content-Type:  IMAGE/octet-stream; name = Default.png */
+/*  Content-Transfer-Encoding:  BASE64 */
+/*  Content-ID:  <4b0d6810b17291f9438783a8eb9d5228@com.samsung.slp.email> */
+/*  Content-Disposition:  inline; filename = Default.png */
 
-static int em_core_parse_image_part_for_partial_body(char *header_start_string, char *start_header, char *boundary_string, char *bufsendforparse, emf_image_data *image_data, int body_size)
+static int emcore_parse_image_part_for_partial_body(char *header_start_string, char *start_header, char *boundary_string, char *bufsendforparse, emf_image_data *image_data, int body_size)
 {
        EM_DEBUG_FUNC_BEGIN();
 
        int   err = EMF_ERROR_NONE;
        char *multiple_image = NULL;
-       int donot_parse_next_image = 0;
+       int   donot_parse_next_image = 0;
        char *image_boundary = NULL;
        char *image_boundary_end = NULL;
-       char temp_image_boundary[256] = {0};
-       int i = 0, ch_image = 0, cidno = 0;
+       char  temp_image_boundary[256] = {0};
+       int   i = 0, ch_image = 0, cidno = 0;
        int   enc_type = ENCOTHER, dec_len = 0, image_length = 0;
        char *p = header_start_string;
        char *start = NULL, *end = NULL, *txt_image = NULL;
@@ -2981,16 +2933,19 @@ static int em_core_parse_image_part_for_partial_body(char *header_start_string,
        if ((char *)strcasestr((const char *)temp_image_boundary, "Content-type:") == NULL)
                boundary_string = temp_image_boundary;
        do {
-               if (multiple_image  != NULL){
+               if (multiple_image != NULL){
                        p = multiple_image;
                        start_header = multiple_image;
                }
+
+               emcore_get_content_type_from_mime_string(start_header, &(image_data[i].mime_type));
+
                if ((strcasestr(p, "Content-Disposition: attachment")) || (!strcasestr(p, "Content-ID: <"))){
                        EM_DEBUG_EXCEPTION(" Body has attachment no need to parse ");
                        end = NULL;
                        multiple_image = NULL;
                }
-               else  /*  HTML Content found */
+               else {  /*  HTML Content found */
                        ch_image = 0;
                        cidno = 0;
                        int   boundarylen = -1;
@@ -3029,13 +2984,13 @@ static int em_core_parse_image_part_for_partial_body(char *header_start_string,
                                cid += 13;
                                cid_end = strstr(temp_image, "\076");           /*  076 == '>' */
                        
-                               image_data[i].content_id = (char *)em_core_malloc(cid_end-cid+5);
+                               image_data[i].content_id = (char *)em_malloc(cid_end-cid+5);
                                if (image_data[i].content_id  != NULL){
                                        strcpy(image_data[i].content_id, "cid:");
                                        memcpy(image_data[i].content_id+4, cid, cid_end-cid);
                                }
                                else
-                                       EM_DEBUG_EXCEPTION("em_core_malloc() failed");
+                                       EM_DEBUG_EXCEPTION("em_malloc() failed");
                                
                                if (image_data[i].image_file_name[0] == '\0')
                                        memcpy(image_data[i].image_file_name, cid, cid_end - cid);
@@ -3043,8 +2998,8 @@ static int em_core_parse_image_part_for_partial_body(char *header_start_string,
 
                        txt_image = strstr(txt_image, CRLF_STRING CRLF_STRING);
 
-                       if (txt_image  != NULL){
-                               txt_image  += 4; /*  txt_image points at image content */
+                       if (txt_image != NULL){
+                               txt_image += 4; /*  txt_image points at image content */
                                start = txt_image;
                                end = strstr(txt_image, boundary_string);
 
@@ -3064,7 +3019,7 @@ static int em_core_parse_image_part_for_partial_body(char *header_start_string,
                                                start_header = temp_enc1;
 
                                        start_header  += strlen("Content-Transfer-Encoding:");
-                                       start_header = em_core_skip_whitespace_without_strdup(start_header);
+                                       start_header = em_skip_whitespace_without_strdup(start_header);
                                        
                                        if (!start_header)
                                                EM_DEBUG_EXCEPTION(" Invalid parsing ");
@@ -3077,26 +3032,26 @@ static int em_core_parse_image_part_for_partial_body(char *header_start_string,
 
                                                EM_DEBUG_LOG("enc_type [%d]", enc_type);
                                                
-                                               image_data[i].text_image = (char *)em_core_malloc((end-txt_image)+1);
+                                               image_data[i].text_image = (char *)em_malloc((end-txt_image)+1);
                                                if (image_data[i].text_image){
                                                        memcpy(image_data[i].text_image, start, end-txt_image);
-                                                       if (em_core_decode_body_text(image_data[i].text_image, end-txt_image, enc_type , &(image_data[i].dec_len), &err) < 0) 
-                                                               EM_DEBUG_EXCEPTION("em_core_decode_body_text failed [%d]", err);
+                                                       if (emcore_decode_body_text(image_data[i].text_image, end-txt_image, enc_type , &(image_data[i].dec_len), &err) < 0) 
+                                                               EM_DEBUG_EXCEPTION("emcore_decode_body_text failed [%d]", err);
                                                        else
                                                                image_length = image_data[i].dec_len;
                                                }
                                                else
-                                                       EM_DEBUG_EXCEPTION("em_core_malloc() failed");
+                                                       EM_DEBUG_EXCEPTION("em_malloc() failed");
                                        }
                                        
                                        EM_DEBUG_LOG("Decoded length [%d]", dec_len);
                                }
                                else{
-                                       image_data[i].text_image = (char *)em_core_malloc(end-txt_image);
+                                       image_data[i].text_image = (char *)em_malloc(end-txt_image);
                                        if (image_data[i].text_image)
                                                memcpy(image_data[i].text_image, start, end - txt_image);
                                        else
-                                               EM_DEBUG_EXCEPTION("em_core_malloc() failed");
+                                               EM_DEBUG_EXCEPTION("em_malloc() failed");
                                }                                                       
                        }
                        else{
@@ -3115,7 +3070,7 @@ static int em_core_parse_image_part_for_partial_body(char *header_start_string,
        return 1;
 }
 
-static int em_core_find_boundary_string_of_the_part(const char *whole_string, const char *first_line_of_part, char **result_boundary_string, int *error)
+static int emcore_find_boundary_string_of_the_part(const char *whole_string, const char *first_line_of_part, char **result_boundary_string, int *error)
 {
        EM_DEBUG_FUNC_BEGIN("whole_string[%p], first_line_of_part[%p], result_boundary_string[%p]", whole_string, first_line_of_part, result_boundary_string);
        int ret = false, err = EMF_ERROR_NONE;
@@ -3139,9 +3094,9 @@ static int em_core_find_boundary_string_of_the_part(const char *whole_string, co
 
                if(boundary_end > boundary_cur && boundary_cur > whole_string) {
                        EM_DEBUG_LOG("boundary_end - boundary_cur + 15 [%d]", boundary_end - boundary_cur + 15);
-                       boundary_string = em_core_malloc(boundary_end - boundary_cur + 15);
+                       boundary_string = em_malloc(boundary_end - boundary_cur + 15);
                        if(!boundary_string) {
-                               EM_DEBUG_EXCEPTION("em_core_malloc failed");
+                               EM_DEBUG_EXCEPTION("em_malloc failed");
                                err = EMF_ERROR_OUT_OF_MEMORY;
                                goto FINISH_OFF;
                        }
@@ -3172,7 +3127,7 @@ FINISH_OFF:
 
 #define TAG_LENGTH 16
 #define COMMAND_LENGTH 2000
-EXPORT_API int em_core_bulk_partial_mailbody_download_for_imap(MAILSTREAM *stream, emf_event_partial_body_thd *pbd_event, int item_count, int *error)
+INTERNAL_FUNC int emcore_download_bulk_partial_mail_body_for_imap(MAILSTREAM *stream, emf_event_partial_body_thd *pbd_event, int item_count, int *error)
 {
        EM_DEBUG_FUNC_BEGIN("stream [%p], pbd_event [%p], item_count [%d], error [%p]", stream, pbd_event, item_count, error);
        
@@ -3198,17 +3153,17 @@ EXPORT_API int em_core_bulk_partial_mailbody_download_for_imap(MAILSTREAM *strea
        char *start_header = NULL;
        char *boundary_string = NULL;
        char *temp_content_type1 = NULL;
-       char *bodystructure_start = NULL, *bodystructure_end = NULL, *body_structure_string = NULL, *moified_body_structure_string = NULL;
+       char *bodystructure_start = NULL, *bodystructure_end = NULL, *body_structure_string = NULL, *modified_body_structure_string = NULL;
        char *plain_text_file_name_from_content_info = NULL, *html_text_file_name_from_content_info = NULL, *plain_charset_from_content_info = NULL;
        char temp_string[TEMP_STRING_LENGTH] = {0, };
        IMAPLOCAL *imaplocal = NULL;
        IMAPPARSEDREPLY *reply_from_server = NULL;
-       emf_mail_tbl_t *mail = NULL;
+       emstorage_mail_tbl_t *mail = NULL;
        emf_partial_buffer *imap_response = NULL;
        BODY *body = NULL;
        struct _m_content_info *cnt_info = NULL;
        struct attachment_info *attach_info = NULL;
-       emf_mail_attachment_tbl_t attachment_tbl;
+       emstorage_attachment_tbl_t attachment_tbl;
        emf_event_partial_body_thd *stSectionNo = NULL;
        emf_image_data  image_data[IMAGE_DISPLAY_PARTIAL_BODY_COUNT];
 
@@ -3221,7 +3176,7 @@ EXPORT_API int em_core_bulk_partial_mailbody_download_for_imap(MAILSTREAM *strea
 
        memset(image_data, 0x00 , sizeof(emf_image_data) * IMAGE_DISPLAY_PARTIAL_BODY_COUNT);
        
-       EM_DEBUG_LOG("Start of em_core_get_section_for_partial_download, item_count = %d ", item_count);
+       EM_DEBUG_LOG("Start of emcore_get_section_for_partial_download, item_count = %d ", item_count);
                
        /* For constructing UID list which is having 10 UID or less at a time */
        for (j = 0, stSectionNo = pbd_event; (stSectionNo  != NULL && j < item_count); j++)
@@ -3243,7 +3198,7 @@ EXPORT_API int em_core_bulk_partial_mailbody_download_for_imap(MAILSTREAM *strea
        SNPRINTF(imap_tag, TAG_LENGTH, "%08lx", 0xffffffff & (stream->gensym++));
        SNPRINTF(command, COMMAND_LENGTH, "%s UID FETCH %s (BODYSTRUCTURE BODY.PEEK[TEXT]<0.15360>)\015\012", imap_tag, uid_range_string_to_be_downloaded);
 
-       mm_dlog(command);
+       EM_DEBUG_LOG("command : %s", command);
 
        /*  Sending out the IMAP request */
        if (!net_sout(imaplocal->netstream, command, (int)strlen(command))) {
@@ -3253,10 +3208,10 @@ EXPORT_API int em_core_bulk_partial_mailbody_download_for_imap(MAILSTREAM *strea
        }
 
        /*  responce from the server */
-       imap_response = em_core_get_response_from_server(imaplocal->netstream, imap_tag, &reply_from_server);
+       imap_response = emcore_get_response_from_server(imaplocal->netstream, imap_tag, &reply_from_server);
 
        if (!imap_response || !reply_from_server ){
-               EM_DEBUG_EXCEPTION(" Invalid response from em_core_get_response_from_server");
+               EM_DEBUG_EXCEPTION(" Invalid response from emcore_get_response_from_server");
                goto FINISH_OFF;
        }
        
@@ -3274,7 +3229,7 @@ EXPORT_API int em_core_bulk_partial_mailbody_download_for_imap(MAILSTREAM *strea
                bodystructure_start = bodystructure_start + strlen("BODYSTRUCTURE");
                bodystructure_end = strstr(bodystructure_start, "BODY[");
                
-               if (bodystructure_end != NULL){
+               if (bodystructure_end != NULL) {
                        int bodystructure_length = bodystructure_end - bodystructure_start;
                        
                        EM_DEBUG_LOG("bodystructure_length [%d]", bodystructure_length);
@@ -3285,10 +3240,10 @@ EXPORT_API int em_core_bulk_partial_mailbody_download_for_imap(MAILSTREAM *strea
                                goto FINISH_OFF;
                        }
                        
-                       body_structure_string = (char *)em_core_malloc(sizeof(char) * bodystructure_length + 1);
+                       body_structure_string = (char *)em_malloc(sizeof(char) * bodystructure_length + 1);
 
                        if (NULL == body_structure_string){
-                               EM_DEBUG_EXCEPTION("em_core_malloc failed...!");
+                               EM_DEBUG_EXCEPTION("em_malloc failed...!");
                                err = EMF_ERROR_OUT_OF_MEMORY;
                                goto FINISH_OFF;
                        }
@@ -3306,32 +3261,30 @@ EXPORT_API int em_core_bulk_partial_mailbody_download_for_imap(MAILSTREAM *strea
                        /*  Parse body_structure_string to BODY  */
                        EM_DEBUG_LOG("body_structure_string [%s]", body_structure_string);
                        /* body_structure_string modified */
-                       moified_body_structure_string = em_core_replace_string(body_structure_string, "}\r\n", "} ");
-                       if (moified_body_structure_string != NULL) {
-                               EM_SAFE_STRNCPY(body_structure_string, moified_body_structure_string, strlen(moified_body_structure_string));
-                               EM_DEBUG_LOG("moified_body_structure_string [%s]", moified_body_structure_string);
+                       modified_body_structure_string = em_replace_string(body_structure_string, "}\r\n", "} ");
+                       if (modified_body_structure_string != NULL) {
+                               EM_SAFE_STRNCPY(body_structure_string, modified_body_structure_string, strlen(modified_body_structure_string));
+                               EM_DEBUG_LOG("modified_body_structure_string [%s]", modified_body_structure_string);
                        }
                        imap_parse_body_structure (stream, body, (unsigned char **)&body_structure_string, reply_from_server);
                        
                        total_mail_size = 0;
 
-                       if (em_core_set_fetch_body_section(body, true, &total_mail_size, &err) < 0) {
-                               EM_DEBUG_EXCEPTION("em_core_set_fetch_body_section failed - %d", err);
+                       if (emcore_set_fetch_body_section(body, true, &total_mail_size, &err) < 0) {
+                               EM_DEBUG_EXCEPTION("emcore_set_fetch_body_section failed - %d", err);
                                goto FINISH_OFF;
                        }
                        
-                       if (!(cnt_info = em_core_malloc(sizeof(struct _m_content_info)))) {
-                               EM_DEBUG_EXCEPTION("em_core_malloc failed...");
+                       if (!(cnt_info = em_malloc(sizeof(struct _m_content_info)))) {
+                               EM_DEBUG_EXCEPTION("em_malloc failed...");
                                err = EMF_ERROR_OUT_OF_MEMORY;
                                goto FINISH_OFF;
                        }
-       
-                       memset(cnt_info, 0, sizeof(struct _m_content_info));
 
                        /*  getting content info from body  */
                                                
-                       if (em_core_get_body(stream, 0, 0, 0, body, cnt_info, &err) < 0 || !cnt_info) {
-                               EM_DEBUG_EXCEPTION("em_core_get_body falied [%d]", err);
+                       if (emcore_get_body(stream, 0, 0, 0, body, cnt_info, &err) < 0 || !cnt_info) {
+                               EM_DEBUG_EXCEPTION("emcore_get_body falied [%d]", err);
                                err = EMF_ERROR_IMAP4_FETCH_UID_FAILURE;
                                goto FINISH_OFF;
                        }
@@ -3357,6 +3310,8 @@ EXPORT_API int em_core_bulk_partial_mailbody_download_for_imap(MAILSTREAM *strea
                                }
                                
                                body_size = atoi(temp_string);
+                               if (body_size > PARTIAL_BODY_SIZE_IN_BYTES)
+                                       body_size = PARTIAL_BODY_SIZE_IN_BYTES;                 
                                EM_DEBUG_LOG("body_size [%d]", body_size);
                        }
                        else{
@@ -3371,7 +3326,7 @@ EXPORT_API int em_core_bulk_partial_mailbody_download_for_imap(MAILSTREAM *strea
                        while (tempmailparselen < response_buffer_length && response_buffer[tempmailparselen] != LF)
                                tempmailparselen++;
                        tempmailparselen++;
-                       
+
                        if (imap_response->buflen < (total_parsed_len + body_size)){
                                err = EMF_ERROR_CONNECTION_BROKEN;
                                EM_DEBUG_EXCEPTION("EMF_ERROR_CONNECTION_BROKEN  :  imap_response->buflen [%d], total_parsed_len [%d], body_size [%d]", imap_response->buflen, total_parsed_len, body_size);
@@ -3421,9 +3376,9 @@ EXPORT_API int em_core_bulk_partial_mailbody_download_for_imap(MAILSTREAM *strea
 
                                        encoding = body->encoding;
                                        
-                                       if (!em_storage_get_maildata_by_servermailid(pbd_event[temp_count].account_id, temp_string, &mail , true, &err) || !mail){
-                                               EM_DEBUG_EXCEPTION("em_storage_get_maildata_by_servermailid failed [%d]", err);
-                                               if (err == EM_STORAGE_ERROR_MAIL_NOT_FOUND || !mail)
+                                       if (!emstorage_get_maildata_by_servermailid(pbd_event[temp_count].account_id, temp_string, &mail , true, &err) || !mail){
+                                               EM_DEBUG_EXCEPTION("emstorage_get_maildata_by_servermailid failed [%d]", err);
+                                               if (err == EMF_ERROR_MAIL_NOT_FOUND || !mail)
                                                        goto FINISH_OFF;
                                        }
                                        
@@ -3435,18 +3390,19 @@ EXPORT_API int em_core_bulk_partial_mailbody_download_for_imap(MAILSTREAM *strea
                                        if (cnt_info->file && cnt_info->file->name){
                                                memset(&attachment_tbl, 0x00, sizeof(emf_attachment_info_t));
 
-                                               attachment_tbl.account_id   = pbd_event[temp_count].account_id;
-                                               attachment_tbl.mail_id      = mail->mail_id;
-                                               attachment_tbl.mailbox_name = pbd_event[temp_count].mailbox_name;       
-                                               attachment_tbl.file_yn      = 0; 
+                                               attachment_tbl.account_id             = pbd_event[temp_count].account_id;
+                                               attachment_tbl.mail_id                = mail->mail_id;
+                                               attachment_tbl.mailbox_name           = pbd_event[temp_count].mailbox_name;
+                                               attachment_tbl.attachment_save_status = 0;
 
                                                for (attachment_num = 1, attach_info = cnt_info->file; attach_info; attach_info = attach_info->next, attachment_num++) {
-                                                       total_mail_size_except_attach -= attach_info->size;
-                                                       attachment_tbl.attachment_size = attach_info->size;
-                                                       attachment_tbl.attachment_path = attach_info->save;
-                                                       attachment_tbl.attachment_name = attach_info->name;
-                                                       attachment_tbl.flag2 = attach_info->drm;
-                                                       attachment_tbl.flag3 = (attach_info->type == 1) ? 1 : 0;
+                                                       total_mail_size_except_attach                  -= attach_info->size;
+                                                       attachment_tbl.attachment_size                  = attach_info->size;
+                                                       attachment_tbl.attachment_path                  = attach_info->save;
+                                                       attachment_tbl.attachment_name                  = attach_info->name;
+                                                       attachment_tbl.attachment_drm_type              = attach_info->drm;
+                                                       attachment_tbl.attachment_inline_content_status = (attach_info->type == 1) ? 1 : 0;
+                                                       attachment_tbl.attachment_mime_type             = attach_info->attachment_mime_type;
 #ifdef __ATTACHMENT_OPTI__
                                                        attachment_tbl.encoding = attach_info->encoding;
                                                        attachment_tbl.section = attach_info->section;
@@ -3460,16 +3416,16 @@ EXPORT_API int em_core_bulk_partial_mailbody_download_for_imap(MAILSTREAM *strea
                                                        EM_DEBUG_LOG("attach_info->type  != 1 [%d]", attachment_num);
 
                                                        mail->attachment_count++;
-                                                       if (!em_storage_add_attachment(&attachment_tbl, 0, false, &err)) {
-                                                               EM_DEBUG_EXCEPTION("em_storage_add_attachment failed [%d]", err);                                       
-                                                               err = em_storage_get_emf_error_from_em_storage_error(err);
+                                                       if (!emstorage_add_attachment(&attachment_tbl, 0, false, &err)) {
+                                                               EM_DEBUG_EXCEPTION("emstorage_add_attachment failed [%d]", err);                                        
+                                               
                                                                goto FINISH_OFF;
                                                        }
                                                        
                                                }                                                               
                                        }
                                                                                        
-                                       em_core_mime_free_content_info(cnt_info);
+                                       emcore_free_content_info(cnt_info);
                                        cnt_info = NULL;
                                        
                                        mail_free_body(&body);  
@@ -3489,8 +3445,8 @@ EXPORT_API int em_core_bulk_partial_mailbody_download_for_imap(MAILSTREAM *strea
                                response_buffer        = response_buffer + mailparselen;
                                response_buffer_length = response_buffer_length - mailparselen;
 
-                               bufsendforparse = em_core_malloc(body_size + 1); /*  old */
-                               /*  bufsendforparse = em_core_malloc(response_buffer_length + 1); */ /* new */
+                               bufsendforparse = em_malloc(body_size + 1); /*  old */
+                               /*  bufsendforparse = em_malloc(response_buffer_length + 1); */ /* new */
 
                                EM_DEBUG_LOG("body_size [%d], response_buffer_length [%d]", body_size, response_buffer_length);
 
@@ -3510,7 +3466,7 @@ EXPORT_API int em_core_bulk_partial_mailbody_download_for_imap(MAILSTREAM *strea
 
                                EM_DEBUG_LOG("string bufendforparse :[%s]", bufsendforparse);
                                p = bufsendforparse;
-                               EM_DEBUG_LOG("string p :[%s]", p);
+                               
                                if (mail && mail->body_download_status == EMF_BODY_DOWNLOAD_STATUS_FULLY_DOWNLOADED) /*  No need to save */
                                        goto NEXTUIDPARSING;
                                
@@ -3522,8 +3478,8 @@ EXPORT_API int em_core_bulk_partial_mailbody_download_for_imap(MAILSTREAM *strea
                                        EM_DEBUG_LOG("plain_text_file_name_from_content_info [%p] html_text_file_name_from_content_info[%p] ", plain_text_file_name_from_content_info, html_text_file_name_from_content_info);
                                        EM_DEBUG_LOG("mbody->encoding [%d] ", encoding);
 
-                                       if (em_core_decode_body_text(p, strlen(p), encoding , &dec_len, &err) < 0) {
-                                               EM_DEBUG_EXCEPTION("em_core_decode_body_text failed [%d]", err);
+                                       if (emcore_decode_body_text(p, strlen(p), encoding , &dec_len, &err) < 0) {
+                                               EM_DEBUG_EXCEPTION("emcore_decode_body_text failed [%d]", err);
                                                goto FINISH_OFF;
                                        }
 
@@ -3607,40 +3563,41 @@ EXPORT_API int em_core_bulk_partial_mailbody_download_for_imap(MAILSTREAM *strea
                        
                                                if (((start_header = (char *)strcasestr(p, "Content-Type: text/html"))  != NULL) && (no_html  != 1) &&(((char *)strcasestr(p, "Content-Type: message/rfc822")) == NULL) &&
                                                        (((char *)strcasestr(p, "Content-Type: text/rfc822-headers")) == NULL))
-                                                       em_core_parse_html_part_for_partial_body(start_header, boundary_string, bufsendforparse, text_html, body_size);
+                                                       emcore_parse_html_part_for_partial_body(start_header, boundary_string, bufsendforparse, text_html, body_size);
 
                                                if (((start_header = (char *)strcasestr(p, "Content-Type: text/plain"))  != NULL)) {
                                                        char *internal_boundary_string = NULL;
-                                                       if(!em_core_find_boundary_string_of_the_part(bufsendforparse, start_header, &internal_boundary_string, &err)) {
+                                                       if(!emcore_find_boundary_string_of_the_part(bufsendforparse, start_header, &internal_boundary_string, &err)) {
                                                                EM_DEBUG_EXCEPTION("internal_boundary_string failed [%d]", err);
                                                        }
 
                                                        if(!internal_boundary_string)
                                                                internal_boundary_string = EM_SAFE_STRDUP(boundary_string);
                                                                
-                                                       em_core_parse_plain_part_for_partial_body(p, start_header, internal_boundary_string, bufsendforparse, text_plain, body_size);
+                                                       emcore_parse_plain_part_for_partial_body(p, start_header, internal_boundary_string, bufsendforparse, text_plain, body_size);
                                                        EM_SAFE_FREE(internal_boundary_string);
                                                }
 
-                                               if (((start_header = (char *)strcasestr((const char *)p, "Content-type: image/jpeg"))  != (char *)NULL) || 
+                                               if (((start_header = (char *)strcasestr((const char *)p, "Content-type: image/jpeg")) != (char *)NULL) ||
                                                        ((start_header = (char *)strcasestr((const char *)p, "Content-Type: image/gif"))  != (char *)NULL) || 
-                                                       ((start_header = (char *)strcasestr((const char *)p, "Content-Type: image/bmp"))  != (char *)NULL))
-                                                       em_core_parse_image_part_for_partial_body(p, start_header, boundary_string, bufsendforparse, image_data, body_size);
+                                                       ((start_header = (char *)strcasestr((const char *)p, "Content-Type: image/bmp"))  != (char *)NULL) ||
+                                                       ((start_header = (char *)strcasestr((const char *)p, "Content-Type: image/png"))  != (char *)NULL))
+                                                       emcore_parse_image_part_for_partial_body(p, start_header, boundary_string, bufsendforparse, image_data, body_size);
                                        }
                                }
                                
                                /*  Updating mail information  */
                                memset(buf, 0x00, sizeof(buf));
                        
-                               if (!em_storage_create_dir(pbd_event[temp_count].account_id, mail->mail_id, 0, &err))
-                                       EM_DEBUG_EXCEPTION("em_storage_create_dir failed [%d]", err);
+                               if (!emstorage_create_dir(pbd_event[temp_count].account_id, mail->mail_id, 0, &err))
+                                       EM_DEBUG_EXCEPTION("emstorage_create_dir failed [%d]", err);
        
-                               if (!em_storage_get_save_name(pbd_event[temp_count].account_id, mail->mail_id, 0, 
+                               if (!emstorage_get_save_name(pbd_event[temp_count].account_id, mail->mail_id, 0, 
                                                                        plain_charset_from_content_info ? plain_charset_from_content_info  :  "UTF-8", buf, &err)) 
-                                       EM_DEBUG_EXCEPTION("em_storage_get_save_name failed [%d]", err);
+                                       EM_DEBUG_EXCEPTION("emstorage_get_save_name failed [%d]", err);
        
-                               if (!em_storage_create_file(text_plain, strlen(text_plain), buf, &err))
-                                       EM_DEBUG_EXCEPTION("em_storage_create_file failed [%d]", err);
+                               if (!emstorage_create_file(text_plain, strlen(text_plain), buf, &err))
+                                       EM_DEBUG_EXCEPTION("emstorage_create_file failed [%d]", err);
 
                                mail->file_path_plain = EM_SAFE_STRDUP(buf); 
                                EM_DEBUG_LOG("mail->file_path_plain [%s]", mail->file_path_plain);
@@ -3657,29 +3614,30 @@ EXPORT_API int em_core_bulk_partial_mailbody_download_for_imap(MAILSTREAM *strea
                                                /* EM_SAFE_STRNCPY(temp_data_html, text_html, text_html); */
 
                                        do {
-                                               if (!em_storage_create_dir(pbd_event[temp_count].account_id, mail->mail_id, 0, &err))
-                                                       EM_DEBUG_EXCEPTION("em_storage_create_dir failed [%d]", err);
+                                               if (!emstorage_create_dir(pbd_event[temp_count].account_id, mail->mail_id, 0, &err))
+                                                       EM_DEBUG_EXCEPTION("emstorage_create_dir failed [%d]", err);
 
-                                               if (!em_storage_get_save_name(pbd_event[temp_count].account_id, mail->mail_id, 0, image_data[store_file].image_file_name, buf, &err)) 
-                                                       EM_DEBUG_EXCEPTION("em_storage_get_save_name failed [%d]", err);
+                                               if (!emstorage_get_save_name(pbd_event[temp_count].account_id, mail->mail_id, 0, image_data[store_file].image_file_name, buf, &err)) 
+                                                       EM_DEBUG_EXCEPTION("emstorage_get_save_name failed [%d]", err);
 
-                                               if (!em_storage_create_file(image_data[store_file].text_image, image_data[store_file].dec_len, buf, &err))
-                                                       EM_DEBUG_EXCEPTION("em_storage_create_file failed [%d]", err);
+                                               if (!emstorage_create_file(image_data[store_file].text_image, image_data[store_file].dec_len, buf, &err))
+                                                       EM_DEBUG_EXCEPTION("emstorage_create_file failed [%d]", err);
                                                
                                                if (mail->body_download_status  != EMF_BODY_DOWNLOAD_STATUS_PARTIALLY_DOWNLOADED){
-                                                       memset(&attachment_tbl, 0x00, sizeof(emf_mail_attachment_tbl_t));
-                                                       attachment_tbl.mail_id = mail->mail_id;
-                                                       attachment_tbl.account_id = pbd_event[temp_count].account_id;
-                                                       attachment_tbl.mailbox_name = stream->mailbox;
-                                                       attachment_tbl.attachment_name = image_data[store_file].image_file_name;
-                                                       attachment_tbl.attachment_size = image_data[store_file].dec_len;
-                                                       attachment_tbl.attachment_path = buf;
-                                                       attachment_tbl.file_yn = 1;
-                                                       attachment_tbl.flag3 = 1; /*  set to 1 for inline image */
+                                                       memset(&attachment_tbl, 0x00, sizeof(emstorage_attachment_tbl_t));
+                                                       attachment_tbl.mail_id                          = mail->mail_id;
+                                                       attachment_tbl.account_id                       = pbd_event[temp_count].account_id;
+                                                       attachment_tbl.mailbox_name                     = stream->mailbox;
+                                                       attachment_tbl.attachment_name                  = image_data[store_file].image_file_name;
+                                                       attachment_tbl.attachment_size                  = image_data[store_file].dec_len;
+                                                       attachment_tbl.attachment_path                  = buf;
+                                                       attachment_tbl.attachment_save_status           = 1;
+                                                       attachment_tbl.attachment_inline_content_status = 1; /*  set to 1 for inline image */
+                                                       attachment_tbl.attachment_mime_type             = image_data[store_file].mime_type;
                                                        mail->attachment_count++;
                                                        mail->inline_content_count++;
-                                                       if (!em_storage_add_attachment (&attachment_tbl, false, false, &err))
-                                                               EM_DEBUG_EXCEPTION("em_storage_add_attachment failed - %d", err);                                                                       
+                                                       if (!emstorage_add_attachment (&attachment_tbl, false, false, &err))
+                                                               EM_DEBUG_EXCEPTION("emstorage_add_attachment failed - %d", err);                                                                        
                                                }
                                                
                                                store_file++;
@@ -3687,7 +3645,7 @@ EXPORT_API int em_core_bulk_partial_mailbody_download_for_imap(MAILSTREAM *strea
                                        
                                        while (image_data[content_index].text_image  != NULL && image_data[content_index].text_image[0]  != NULL_CHAR &&
                                                  image_data[content_index].content_id && image_data[content_index].content_id[0]  != NULL_CHAR && (content_index < IMAGE_DISPLAY_PARTIAL_BODY_COUNT)){   /*  Finding CID in HTML and replacing with image name. */
-                                               result_string_of_replcaing = em_core_replace_string((char *)temp_data_html, (char *)image_data[content_index].content_id, (char *)image_data[content_index].image_file_name);
+                                               result_string_of_replcaing = em_replace_string((char *)temp_data_html, (char *)image_data[content_index].content_id, (char *)image_data[content_index].image_file_name);
                                                
                                                EM_SAFE_STRNCPY(temp_data_html, result_string_of_replcaing, PARTIAL_BODY_SIZE_IN_BYTES);
                                                EM_SAFE_FREE(result_string_of_replcaing);
@@ -3697,6 +3655,7 @@ EXPORT_API int em_core_bulk_partial_mailbody_download_for_imap(MAILSTREAM *strea
                                                
                                                EM_SAFE_FREE(image_data[content_index].content_id);
                                                EM_SAFE_FREE(image_data[content_index].text_image);
+                                               EM_SAFE_FREE(image_data[content_index].mime_type);
                                                memset(image_data[content_index].image_file_name, 0x00, 100);
                                                image_data[content_index].dec_len = 0;
                                                content_index++;
@@ -3724,14 +3683,14 @@ EXPORT_API int em_core_bulk_partial_mailbody_download_for_imap(MAILSTREAM *strea
                                        else
                                                memcpy(html_body, "UTF-8.htm", strlen("UTF-8.htm"));
 
-                                       if (!em_storage_create_dir(pbd_event[temp_count].account_id, mail->mail_id, 0, &err))
-                                               EM_DEBUG_EXCEPTION("em_storage_create_dir failed [%d]", err);
+                                       if (!emstorage_create_dir(pbd_event[temp_count].account_id, mail->mail_id, 0, &err))
+                                               EM_DEBUG_EXCEPTION("emstorage_create_dir failed [%d]", err);
 
-                                       if (!em_storage_get_save_name(pbd_event[temp_count].account_id, mail->mail_id, 0, html_body, buf, &err)) 
-                                               EM_DEBUG_EXCEPTION("em_storage_get_save_name failed [%d]", err);
+                                       if (!emstorage_get_save_name(pbd_event[temp_count].account_id, mail->mail_id, 0, html_body, buf, &err)) 
+                                               EM_DEBUG_EXCEPTION("emstorage_get_save_name failed [%d]", err);
 
-                                       if (!em_storage_create_file(text_html, strlen(text_html), buf, &err))
-                                               EM_DEBUG_EXCEPTION("em_storage_create_file failed [%d]", err);
+                                       if (!emstorage_create_file(text_html, strlen(text_html), buf, &err))
+                                               EM_DEBUG_EXCEPTION("emstorage_create_file failed [%d]", err);
 
                                        mail->file_path_html = EM_SAFE_STRDUP(buf); 
                                                        
@@ -3741,12 +3700,12 @@ EXPORT_API int em_core_bulk_partial_mailbody_download_for_imap(MAILSTREAM *strea
                                EM_DEBUG_LOG("total_mail_size_except_attach [%d], mail->body_download_status [%d]", total_mail_size_except_attach, mail->body_download_status); 
 
                                /* Get preview text */ 
-                               if ( (err = em_core_get_preview_text_from_file(mail->file_path_plain, mail->file_path_html, MAX_PREVIEW_TEXT_LENGTH, &(mail->preview_text))) != EMF_ERROR_NONE)
-                                       EM_DEBUG_EXCEPTION("em_core_get_preview_text_from_file() failed[%d]", err);
+                               if ( (err = emcore_get_preview_text_from_file(mail->file_path_plain, mail->file_path_html, MAX_PREVIEW_TEXT_LENGTH, &(mail->preview_text))) != EMF_ERROR_NONE)
+                                       EM_DEBUG_EXCEPTION("emcore_get_preview_text_from_file() failed[%d]", err);
                                
                                /* Update body contents */
-                               if (!em_storage_change_mail_field(mail->mail_id, UPDATE_PARTIAL_BODY_DOWNLOAD, mail, true, &err))
-                                       EM_DEBUG_EXCEPTION("em_storage_change_mail_field failed - %d", err);
+                               if (!emstorage_change_mail_field(mail->mail_id, UPDATE_PARTIAL_BODY_DOWNLOAD, mail, true, &err))
+                                       EM_DEBUG_EXCEPTION("emstorage_change_mail_field failed - %d", err);
                                
 NEXTUIDPARSING: 
 
@@ -3772,11 +3731,11 @@ NEXTUIDPARSING:
                                memset(temp_text_buf, 0, PARTIAL_BODY_SIZE_IN_BYTES+1);
 
                                if (mail)
-                                       em_storage_free_mail(&mail, 1, NULL);
+                                       emstorage_free_mail(&mail, 1, NULL);
                                
                                /*  Free the activity for mail id in partial body activity table */
-                               if (false == em_core_delete_pbd_activity(pbd_event[temp_count].account_id, pbd_event[temp_count].mail_id, pbd_event[temp_count].activity_id, &err)){
-                                       EM_DEBUG_EXCEPTION("em_core_delete_pbd_activity failed [%d]", err);
+                               if (false == emcore_delete_pbd_activity(pbd_event[temp_count].account_id, pbd_event[temp_count].mail_id, pbd_event[temp_count].activity_id, &err)){
+                                       EM_DEBUG_EXCEPTION("emcore_delete_pbd_activity failed [%d]", err);
                                        goto FINISH_OFF;
                                }
                        }
@@ -3810,7 +3769,7 @@ FINISH_OFF:
        EM_SAFE_FREE(plain_charset_from_content_info);
 
        if (cnt_info)
-               em_core_mime_free_content_info(cnt_info);
+               emcore_free_content_info(cnt_info);
 
        if (body)
                mail_free_body(&body);
@@ -3820,13 +3779,13 @@ FINISH_OFF:
        EM_SAFE_FREE(imap_response);    
 
        if (mail)
-               em_storage_free_mail(&mail, 1, NULL);
+               emstorage_free_mail(&mail, 1, NULL);
        
        EM_DEBUG_FUNC_END("ret [%d]", ret);     
        return ret;
 }
 
-EXPORT_API int em_core_bulk_partial_mailbody_download_for_pop3(MAILSTREAM *stream, emf_event_partial_body_thd *pbd_event, int item_count, int *error)
+INTERNAL_FUNC int emcore_download_bulk_partial_mail_body_for_pop3(MAILSTREAM *stream, emf_event_partial_body_thd *pbd_event, int item_count, int *error)
 {
        EM_DEBUG_FUNC_BEGIN("stream [%p], pbd_event [%p], item_count [%d], error [%p]", stream, pbd_event, item_count, error);
        int ret = false, err = EMF_ERROR_NONE;
@@ -3842,13 +3801,13 @@ EXPORT_API int em_core_bulk_partial_mailbody_download_for_pop3(MAILSTREAM *strea
                EM_DEBUG_LOG("pbd_event[%d].account_id [%d], mail_id [%d], server_mail_id [%d], activity_id [%d]", \
                        i, pbd_event[i].account_id, pbd_event[i].mail_id, pbd_event[i].server_mail_id, pbd_event[i].activity_id);               
 
-               if (!em_core_mail_download_body_multi_sections_bulk(stream, pbd_event[i].account_id, pbd_event[i].mail_id, false, false, PARTIAL_BODY_SIZE_IN_BYTES, 0 , &err)){
-                       EM_DEBUG_EXCEPTION("em_core_mail_download_body_multi_sections_bulk failed");
+               if (!emcore_download_body_multi_sections_bulk(stream, pbd_event[i].account_id, pbd_event[i].mail_id, false, false, PARTIAL_BODY_SIZE_IN_BYTES, 0 , &err)){
+                       EM_DEBUG_EXCEPTION("emcore_download_body_multi_sections_bulk failed");
                        goto FINISH_OFF;
                }
                
-               if (false == em_core_delete_pbd_activity(pbd_event[i].account_id, pbd_event[i].mail_id, pbd_event[i].activity_id, &err)){
-                       EM_DEBUG_EXCEPTION("em_core_delete_pbd_activity failed [%d]", err);
+               if (false == emcore_delete_pbd_activity(pbd_event[i].account_id, pbd_event[i].mail_id, pbd_event[i].activity_id, &err)){
+                       EM_DEBUG_EXCEPTION("emcore_delete_pbd_activity failed [%d]", err);
                        goto FINISH_OFF;
                }
        }       
@@ -3865,7 +3824,7 @@ FINISH_OFF:
 
 
 
-EXPORT_API int em_core_bulk_partial_mailbody_download(MAILSTREAM *stream, emf_event_partial_body_thd *pbd_event, int item_count, int *error)
+INTERNAL_FUNC int emcore_download_bulk_partial_mail_body(MAILSTREAM *stream, emf_event_partial_body_thd *pbd_event, int item_count, int *error)
 {
        EM_DEBUG_FUNC_BEGIN("stream [%p], pbd_event [%p], item_count [%d], error [%p]", stream, pbd_event, item_count, error);
        int ret = false, err = EMF_ERROR_NONE;
@@ -3877,7 +3836,7 @@ EXPORT_API int em_core_bulk_partial_mailbody_download(MAILSTREAM *stream, emf_ev
                goto FINISH_OFF;
        }
 
-       pbd_account = em_core_get_account_reference(pbd_event[0].account_id);
+       pbd_account = emcore_get_account_reference(pbd_event[0].account_id);
 
        if (pbd_account == NULL){
                EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_ACCOUNT");
@@ -3887,10 +3846,10 @@ EXPORT_API int em_core_bulk_partial_mailbody_download(MAILSTREAM *stream, emf_ev
 
        switch (pbd_account->receiving_server_type){
                case EMF_SERVER_TYPE_IMAP4:
-                       ret = em_core_bulk_partial_mailbody_download_for_imap(stream, pbd_event, item_count, &err);
+                       ret = emcore_download_bulk_partial_mail_body_for_imap(stream, pbd_event, item_count, &err);
                        break;
                case EMF_SERVER_TYPE_POP3: 
-                       ret = em_core_bulk_partial_mailbody_download_for_pop3(stream, pbd_event, item_count, &err);
+                       ret = emcore_download_bulk_partial_mail_body_for_pop3(stream, pbd_event, item_count, &err);
                        break;
                default: 
                        err = EMF_ERROR_NOT_SUPPORTED;
@@ -3908,7 +3867,7 @@ FINISH_OFF:
 }
 
 
-static emf_partial_buffer *em_core_get_response_from_server (NETSTREAM *nstream, char *tag, IMAPPARSEDREPLY **reply)
+static emf_partial_buffer *emcore_get_response_from_server (NETSTREAM *nstream, char *tag, IMAPPARSEDREPLY **reply)
 {
        EM_DEBUG_FUNC_BEGIN();
 
@@ -3922,19 +3881,21 @@ static emf_partial_buffer *em_core_get_response_from_server (NETSTREAM *nstream,
        char *pline = NULL;
        int linelen = 0;
        int bytes_copied = 0;
-       int allocated_buffer_size = (BULK_PARTIAL_BODY_DOWNLOAD_COUNT + 1) * PARTIAL_BODY_SIZE_IN_BYTES ;
+       int temp_body_buffer_size = 0;
+       int flags = 0;
+       int allocated_buffer_size = (BULK_PARTIAL_BODY_DOWNLOAD_COUNT + 2) * PARTIAL_BODY_SIZE_IN_BYTES ;
 
-       retPartialBuffer = (emf_partial_buffer *)em_core_malloc(sizeof(emf_partial_buffer));
+       retPartialBuffer = (emf_partial_buffer *)em_malloc(sizeof(emf_partial_buffer));
 
        if (NULL == retPartialBuffer){
-               EM_DEBUG_EXCEPTION("em_core_malloc failed");
+               EM_DEBUG_EXCEPTION("em_malloc failed");
                return NIL;
        }
 
-       retPartialBuffer->buffer = (char *)em_core_malloc(allocated_buffer_size);
+       retPartialBuffer->buffer = (char *)em_malloc(allocated_buffer_size);
 
        if (NULL == retPartialBuffer->buffer){
-               EM_DEBUG_EXCEPTION("em_core_malloc failed");
+               EM_DEBUG_EXCEPTION("em_malloc failed");
                EM_SAFE_FREE(retPartialBuffer);
                return NIL;
        }
@@ -3947,19 +3908,35 @@ static emf_partial_buffer *em_core_get_response_from_server (NETSTREAM *nstream,
 
                        return NIL;
                }
-
+       
                linelen = strlen(pline);
-               memcpy(retPartialBuffer->buffer + bytes_copied, pline, linelen);
-               bytes_copied  += linelen;
-               memcpy(retPartialBuffer->buffer + bytes_copied, CRLF_STRING, 2);
-               bytes_copied += 2;                              
+               
+               if (strcasestr(pline, "BODYSTRUCTURE") != NULL) {
+                       temp_body_buffer_size = 0;
+                       flags = 0;
+               } else {
+                       temp_body_buffer_size = temp_body_buffer_size + linelen + 2;
+               }
 
+               if (temp_body_buffer_size > PARTIAL_BODY_SIZE_IN_BYTES && !flags) {
+                       linelen = linelen - (temp_body_buffer_size - PARTIAL_BODY_SIZE_IN_BYTES);
+                       temp_body_buffer_size = PARTIAL_BODY_SIZE_IN_BYTES;
+                       flags = 1;
+               }       
+
+               if (temp_body_buffer_size <= PARTIAL_BODY_SIZE_IN_BYTES) {
+                       memcpy(retPartialBuffer->buffer + bytes_copied, pline, linelen);
+                       bytes_copied  += linelen;
+                       memcpy(retPartialBuffer->buffer + bytes_copied, CRLF_STRING, 2);
+                       bytes_copied += 2;                              
+               } 
+                               
                if (0 == strncmp(pline, tag, strlen(tag))) {
 
-                       ret_reply = em_core_malloc(sizeof(IMAPPARSEDREPLY));
+                       ret_reply = em_malloc(sizeof(IMAPPARSEDREPLY));
 
                        if (!ret_reply){
-                               EM_DEBUG_EXCEPTION("em_core_malloc failed");
+                               EM_DEBUG_EXCEPTION("em_malloc failed");
                                return NIL;
                        }
 
similarity index 71%
rename from email-core/em-core-mailbox.c
rename to email-core/email-core-mailbox.c
index 712b3be..4df8c4c 100755 (executable)
@@ -21,7 +21,7 @@
 
 
 /******************************************************************************
- * File :  em-core-mailbox.c
+ * File :  email-core-mailbox.c
  * Desc :  Local Mailbox Management
  *
  * Auth : 
 #include <string.h>
 #include <time.h>
 #include <sys/types.h>
-#include "emf-types.h"
-#include "emf-dbglog.h"
-#include "em-core-global.h"
-#include "em-core-utils.h"
-#include "em-core-mailbox.h"
-#include "em-core-event.h"
-#include "em-core-mesg.h"
-#include "em-core-imap-mailbox.h"   
-#include "em-storage.h"
-#include "em-core-account.h" 
+#include "email-types.h"
+#include "email-utilities.h"
+#include "email-debug-log.h"
+#include "email-core-global.h"
+#include "email-core-utils.h"
+#include "email-core-mailbox.h"
+#include "email-core-event.h"
+#include "email-core-mail.h"
+#include "email-core-imap-mailbox.h"   
+#include "email-storage.h"
+#include "email-core-account.h" 
 
 #ifdef __FEATURE_KEEP_CONNECTION__
 static void *g_receiving_thd_stream = NULL;                    /* Stores the recv thd stream for next time reuse */
@@ -53,12 +54,7 @@ static int prev_acc_id_pb_thd = 0;                                   /* Stores the account id for which pb thd
 
 __thread emf_connection_info_t *g_connection_info_list = NULL;
 
-#ifdef __FEATURE_USE_PTHREAD__
 static pthread_mutex_t _close_stream_lock = PTHREAD_MUTEX_INITIALIZER; /* Mutex to protect closing stream */
-#else /*  __FEATURE_USE_PTHREAD__ */
-static GMutex *_close_stream_lock = NULL;                               /* Mutex to protect closing stream */
-#endif /*  __FEATURE_USE_PTHREAD__ */
-
 #endif /*  __FEATURE_KEEP_CONNECTION__ */
 
 
@@ -98,7 +94,7 @@ static emf_mailbox_type_item_t  g_mailbox_type[MAX_MAILBOX_TYPE] = {
 };
 
 #ifdef __FEATURE_KEEP_CONNECTION__
-emf_connection_info_t* em_core_get_connection_info_by_account_id(int account_id)
+emf_connection_info_t* emcore_get_connection_info_by_account_id(int account_id)
 {
        EM_DEBUG_FUNC_BEGIN("account_id [%d]", account_id);
        emf_connection_info_t *connection_info = g_connection_info_list;
@@ -113,7 +109,7 @@ emf_connection_info_t* em_core_get_connection_info_by_account_id(int account_id)
        return connection_info;
 }
 
-int em_core_append_connection_info(emf_connection_info_t *new_connection_info)
+int emcore_append_connection_info(emf_connection_info_t *new_connection_info)
 {
        EM_DEBUG_FUNC_BEGIN("new_connection_info [%p]", new_connection_info);
        emf_connection_info_t *connection_info = g_connection_info_list;
@@ -123,7 +119,7 @@ int em_core_append_connection_info(emf_connection_info_t *new_connection_info)
                return EMF_ERROR_INVALID_PARAM;
        }
 
-       if(em_core_get_connection_info_by_account_id(new_connection_info->account_id)) {
+       if(emcore_get_connection_info_by_account_id(new_connection_info->account_id)) {
                EM_DEBUG_EXCEPTION("EMF_ERROR_ALREADY_EXISTS");
                return EMF_ERROR_ALREADY_EXISTS;
        }
@@ -146,7 +142,7 @@ int em_core_append_connection_info(emf_connection_info_t *new_connection_info)
        return EMF_ERROR_NONE;
 }
 
-EXPORT_API int em_core_remove_connection_info(int account_id)
+INTERNAL_FUNC int emcore_remove_connection_info(int account_id)
 {
        EM_DEBUG_FUNC_BEGIN("account_id [%d]", account_id);
        emf_connection_info_t *connection_info = g_connection_info_list, *prev_connection_info = NULL;
@@ -176,7 +172,7 @@ EXPORT_API int em_core_remove_connection_info(int account_id)
 /* description
  *    get local mailbox list
  */
-EXPORT_API int em_core_mailbox_get_list(int account_id, emf_mailbox_t **mailbox_list,  int *p_count, int *err_code)
+INTERNAL_FUNC int emcore_get_list(int account_id, emf_mailbox_t **mailbox_list,        int *p_count, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], mailbox_list[%p], p_count[%p], err_code[%p]", account_id, mailbox_list, p_count, err_code);
        
@@ -189,26 +185,26 @@ EXPORT_API int em_core_mailbox_get_list(int account_id, emf_mailbox_t **mailbox_
        
        int ret = false;
        int error = EMF_ERROR_NONE;
-       emf_mailbox_tbl_t *local_mailbox_list = NULL;
+       emstorage_mailbox_tbl_t *local_mailbox_list = NULL;
        emf_account_t *ref_account = NULL;
        int i, count = 512;
        
        /* get mailbox list from mailbox table */
        
-       if (!(ref_account = em_core_get_account_reference(account_id)))  {
-               EM_DEBUG_EXCEPTION(" em_core_get_account_reference failed - %d", account_id);
+       if (!(ref_account = emcore_get_account_reference(account_id)))  {
+               EM_DEBUG_EXCEPTION(" emcore_get_account_reference failed - %d", account_id);
                error = EMF_ERROR_INVALID_ACCOUNT;
                goto FINISH_OFF;
        }
        
-       if (!em_storage_get_mailbox(ref_account->account_id, EMF_MAILBOX_ALL, EMAIL_MAILBOX_SORT_BY_NAME_ASC, &count, &local_mailbox_list, true, &error))  {    
-               EM_DEBUG_EXCEPTION(" em_storage_get_mailbox failed - %d", error);
-               error = em_storage_get_emf_error_from_em_storage_error(error);
+       if (!emstorage_get_mailbox(ref_account->account_id, EMF_MAILBOX_ALL, EMAIL_MAILBOX_SORT_BY_NAME_ASC, &count, &local_mailbox_list, true, &error))  {     
+               EM_DEBUG_EXCEPTION(" emstorage_get_mailbox failed - %d", error);
+       
                goto FINISH_OFF;
        }
        
        if (count > 0)  {
-               if (!(*mailbox_list = em_core_malloc(sizeof(emf_mailbox_t) * count)))  {
+               if (!(*mailbox_list = em_malloc(sizeof(emf_mailbox_t) * count)))  {
                        EM_DEBUG_EXCEPTION(" mailloc failed...");
                        error = EMF_ERROR_OUT_OF_MEMORY;
                        goto FINISH_OFF;
@@ -240,7 +236,7 @@ EXPORT_API int em_core_mailbox_get_list(int account_id, emf_mailbox_t **mailbox_
 
 FINISH_OFF: 
        if (local_mailbox_list != NULL)
-               em_storage_free_mailbox(&local_mailbox_list, count, NULL);
+               emstorage_free_mailbox(&local_mailbox_list, count, NULL);
        
        if (err_code != NULL)
                *err_code = error;
@@ -252,7 +248,7 @@ FINISH_OFF:
 /* description
  *    get imap sync mailbox list
  */
-int em_core_mailbox_get_list_to_be_sync(int account_id, emf_mailbox_t **mailbox_list, int *p_count, int *err_code)
+int emcore_get_list_to_be_sync(int account_id, emf_mailbox_t **mailbox_list, int *p_count, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], mailbox_list[%p], p_count[%p], err_code[%p]", account_id, mailbox_list, p_count, err_code);
        
@@ -266,25 +262,25 @@ int em_core_mailbox_get_list_to_be_sync(int account_id, emf_mailbox_t **mailbox_
        int ret = false;
        int error = EMF_ERROR_NONE;
        emf_mailbox_t *tmp_mailbox_list = NULL;
-       emf_mailbox_tbl_t *mailbox_tbl_list = NULL;
+       emstorage_mailbox_tbl_t *mailbox_tbl_list = NULL;
        emf_account_t *ref_account = NULL;
        int i, count = 512;
        
        /* get mailbox list from mailbox table */
-       if (!(ref_account = em_core_get_account_reference(account_id)))  {
-               EM_DEBUG_EXCEPTION("em_core_get_account_reference failed - %d", account_id);
+       if (!(ref_account = emcore_get_account_reference(account_id)))  {
+               EM_DEBUG_EXCEPTION("emcore_get_account_reference failed - %d", account_id);
                error = EMF_ERROR_INVALID_ACCOUNT;
                goto FINISH_OFF;
        }
        
-       if (!em_storage_get_mailbox(ref_account->account_id, 0, EMAIL_MAILBOX_SORT_BY_TYPE_ASC, &count, &mailbox_tbl_list, true, &error))  {    
-               EM_DEBUG_EXCEPTION("em_storage_get_mailbox failed - %d", error);
-               error = em_storage_get_emf_error_from_em_storage_error(error);
+       if (!emstorage_get_mailbox(ref_account->account_id, 0, EMAIL_MAILBOX_SORT_BY_TYPE_ASC, &count, &mailbox_tbl_list, true, &error))  {     
+               EM_DEBUG_EXCEPTION("emstorage_get_mailbox failed - %d", error);
+       
                goto FINISH_OFF;
        }
        
        if (count > 0)  {
-               if (!(tmp_mailbox_list = em_core_malloc(sizeof(emf_mailbox_t) * count)))  {
+               if (!(tmp_mailbox_list = em_malloc(sizeof(emf_mailbox_t) * count)))  {
                        EM_DEBUG_EXCEPTION("malloc failed...");
                        error = EMF_ERROR_OUT_OF_MEMORY;
                        goto FINISH_OFF;
@@ -317,7 +313,7 @@ FINISH_OFF:
        
        
        if (mailbox_tbl_list != NULL)
-               em_storage_free_mailbox(&mailbox_tbl_list, count, NULL);
+               emstorage_free_mailbox(&mailbox_tbl_list, count, NULL);
        
        if (err_code != NULL)
                *err_code = error;
@@ -325,7 +321,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_core_mailbox_get_mail_count(emf_mailbox_t *mailbox, int *total, int *unseen, int *err_code)
+INTERNAL_FUNC int emcore_get_mail_count(emf_mailbox_t *mailbox, int *total, int *unseen, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("mailbox[%p], total[%p], unseen[%p], err_code[%p]", mailbox, total, unseen, err_code);
        
@@ -338,9 +334,9 @@ EXPORT_API int em_core_mailbox_get_mail_count(emf_mailbox_t *mailbox, int *total
                goto FINISH_OFF;
        }
        
-       if (!em_storage_get_mail_count(mailbox->account_id, mailbox->name, total, unseen, true, &err))  {
-               EM_DEBUG_EXCEPTION(" em_storage_get_mail_count failed - %d", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+       if (!emstorage_get_mail_count(mailbox->account_id, mailbox->name, total, unseen, true, &err))  {
+               EM_DEBUG_EXCEPTION(" emstorage_get_mail_count failed - %d", err);
+
                goto FINISH_OFF;
        }
 
@@ -354,12 +350,12 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_core_mailbox_create(emf_mailbox_t *new_mailbox, int on_server, int *err_code)
+INTERNAL_FUNC int emcore_create_mailbox(emf_mailbox_t *new_mailbox, int on_server, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("new_mailbox[%p], err_code[%p]", new_mailbox, err_code);
        int ret = false;
        int err = EMF_ERROR_NONE;
-       emf_mailbox_tbl_t local_mailbox;
+       emstorage_mailbox_tbl_t local_mailbox;
        
        if (new_mailbox == NULL || new_mailbox->name == NULL)  {
                err = EMF_ERROR_INVALID_PARAM;
@@ -368,16 +364,16 @@ EXPORT_API int em_core_mailbox_create(emf_mailbox_t *new_mailbox, int on_server,
 
        if  (on_server) {
                /* Create a mailbox from Sever */
-               if (!em_core_mailbox_create_imap_mailbox(new_mailbox, &err)) {
+               if (!emcore_create_imap_mailbox(new_mailbox, &err)) {
                        EM_DEBUG_EXCEPTION(">>>>> mailbox Creation in Server FAILED >>> ");
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+       
                        goto FINISH_OFF;
                }
                else
                        EM_DEBUG_LOG(">>>>> mailbox Creation in Server SUCCESS >>> ");  
        }
 
-       memset(&local_mailbox, 0x00, sizeof(emf_mailbox_tbl_t));
+       memset(&local_mailbox, 0x00, sizeof(emstorage_mailbox_tbl_t));
        EM_DEBUG_LOG("box name[%s] local yn[%d] mailbox_type[%d]", new_mailbox->name, local_mailbox.local_yn, new_mailbox->mailbox_type);
 
        /* add local mailbox into local mailbox table */
@@ -391,7 +387,7 @@ EXPORT_API int em_core_mailbox_create(emf_mailbox_t *new_mailbox, int on_server,
        local_mailbox.unread_count = 0;
        local_mailbox.total_mail_count_on_local = 0;
        local_mailbox.total_mail_count_on_server = 0;
-       em_core_mailbox_get_default_mail_slot_count(&local_mailbox.mail_slot_size, NULL);
+       emcore_get_default_mail_slot_count(&local_mailbox.mail_slot_size, NULL);
 
        if (strncmp(new_mailbox->name, EMF_INBOX_NAME, strlen(EMF_INBOX_NAME))    == 0 || 
             strncmp(new_mailbox->name, EMF_DRAFTBOX_NAME, strlen(EMF_DRAFTBOX_NAME)) == 0 || 
@@ -402,9 +398,9 @@ EXPORT_API int em_core_mailbox_create(emf_mailbox_t *new_mailbox, int on_server,
                local_mailbox.modifiable_yn = 1;
 
 
-       if (!em_storage_add_mailbox(&local_mailbox, true, &err))  {
-               EM_DEBUG_EXCEPTION(" em_storage_add_mailbox failed - %d", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+       if (!emstorage_add_mailbox(&local_mailbox, true, &err))  {
+               EM_DEBUG_EXCEPTION(" emstorage_add_mailbox failed - %d", err);
+
                goto FINISH_OFF;
        }
        ret = true;
@@ -416,7 +412,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_core_mailbox_delete(emf_mailbox_t *mailbox, int on_server, int *err_code)
+INTERNAL_FUNC int emcore_delete_mailbox(emf_mailbox_t *mailbox, int on_server, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("mailbox[%p], err_code[%p]", mailbox, err_code);
        
@@ -429,22 +425,22 @@ EXPORT_API int em_core_mailbox_delete(emf_mailbox_t *mailbox, int on_server, int
                goto FINISH_OFF;
        }
        
-       if (!em_core_mail_delete_all(mailbox, on_server, &err))  {
-               EM_DEBUG_EXCEPTION(" em_core_mail_delete_all failed - %d", err);
+       if (!emcore_delete_mail_all(mailbox, on_server, &err))  {
+               EM_DEBUG_EXCEPTION(" emcore_delete_mail_all failed - %d", err);
                goto FINISH_OFF;
        }
 
        if (on_server) {
                EM_DEBUG_LOG(">>  Delete the mailbox in Sever >>> ");
-               if  (!em_core_mailbox_delete_imap_mailbox(mailbox, &err))
+               if  (!emcore_delete_imap_mailbox(mailbox, &err))
                        EM_DEBUG_EXCEPTION(">>> Delete the mailbox in Server  :  FAILED >>> ");
                else
                        EM_DEBUG_LOG(">>> Delete the mailbox in Server  :  SUCCESS >>> ");
        }
 
-       if (!em_storage_delete_mailbox(mailbox->account_id, -1, mailbox->name, true, &err))  {
-               EM_DEBUG_EXCEPTION(" em_storage_delete_mailbox failed - %d", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+       if (!emstorage_delete_mailbox(mailbox->account_id, -1, mailbox->name, true, &err))  {
+               EM_DEBUG_EXCEPTION(" emstorage_delete_mailbox failed - %d", err);
+
                goto FINISH_OFF;
        }
        
@@ -457,7 +453,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_core_mailbox_delete_all(emf_mailbox_t *mailbox, int *err_code)
+INTERNAL_FUNC int emcore_delete_mailbox_all(emf_mailbox_t *mailbox, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
        
@@ -473,16 +469,16 @@ EXPORT_API int em_core_mailbox_delete_all(emf_mailbox_t *mailbox, int *err_code)
                goto FINISH_OFF;
        }
        
-       if (!em_core_mail_delete_all(mailbox, 0, /*NULL, */ &err)) {
-               EM_DEBUG_EXCEPTION(" em_core_mail_delete_all failed - %d", err);
+       if (!emcore_delete_mail_all(mailbox, 0, /*NULL, */ &err)) {
+               EM_DEBUG_EXCEPTION(" emcore_delete_mail_all failed - %d", err);
                
                goto FINISH_OFF;
        }
        
-       if (!em_storage_delete_mailbox(mailbox->account_id, -1, mailbox->name, true, &err)) {
-               EM_DEBUG_EXCEPTION(" em_storage_delete_mailbox failed - %d", err);
+       if (!emstorage_delete_mailbox(mailbox->account_id, -1, mailbox->name, true, &err)) {
+               EM_DEBUG_EXCEPTION(" emstorage_delete_mailbox failed - %d", err);
                
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+
                goto FINISH_OFF;
        }
        
@@ -495,7 +491,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_core_mailbox_update(emf_mailbox_t *old_mailbox, emf_mailbox_t *new_mailbox, int *err_code)
+INTERNAL_FUNC int emcore_update_mailbox(emf_mailbox_t *old_mailbox, emf_mailbox_t *new_mailbox, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("old_mailbox[%p], new_mailbox[%p], err_code[%p]", old_mailbox, new_mailbox, err_code);
        
@@ -509,16 +505,16 @@ EXPORT_API int em_core_mailbox_update(emf_mailbox_t *old_mailbox, emf_mailbox_t
                goto FINISH_OFF;
        }
        
-       emf_mailbox_tbl_t new_mailbox_tbl;
-       memset(&new_mailbox_tbl, 0x00, sizeof(emf_mailbox_tbl_t));
+       emstorage_mailbox_tbl_t new_mailbox_tbl;
+       memset(&new_mailbox_tbl, 0x00, sizeof(emstorage_mailbox_tbl_t));
        
        /*  Support only updating mailbox_type */
        new_mailbox_tbl.mailbox_type = new_mailbox->mailbox_type;
 
        if (old_mailbox->mailbox_type != new_mailbox_tbl.mailbox_type) {
-               if (!em_storage_update_mailbox_type(old_mailbox->account_id, -1, old_mailbox->name, &new_mailbox_tbl, true, &err))  {
-                       EM_DEBUG_EXCEPTION("em_storage_update_mailbox failed - %d", err);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+               if (!emstorage_update_mailbox_type(old_mailbox->account_id, -1, old_mailbox->name, &new_mailbox_tbl, true, &err))  {
+                       EM_DEBUG_EXCEPTION("emstorage_update_mailbox failed - %d", err);
+       
                        goto FINISH_OFF;
                }
        }
@@ -532,16 +528,16 @@ EXPORT_API int em_core_mailbox_update(emf_mailbox_t *old_mailbox, emf_mailbox_t
        new_mailbox_tbl.mail_slot_size          = new_mailbox->mail_slot_size;
        new_mailbox_tbl.total_mail_count_on_server = new_mailbox->total_mail_count_on_server;
        
-       if (!em_storage_update_mailbox(old_mailbox->account_id, -1, old_mailbox->name, &new_mailbox_tbl, true, &err))  {
-               EM_DEBUG_EXCEPTION("em_storage_update_mailbox failed - %d", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+       if (!emstorage_update_mailbox(old_mailbox->account_id, -1, old_mailbox->name, &new_mailbox_tbl, true, &err))  {
+               EM_DEBUG_EXCEPTION("emstorage_update_mailbox failed - %d", err);
+
                goto FINISH_OFF;
        }
        
        if (EM_SAFE_STRCMP(old_mailbox->name, new_mailbox_tbl.mailbox_name) != 0) {
-               if (!em_storage_rename_mailbox(old_mailbox->account_id, old_mailbox->name, new_mailbox_tbl.mailbox_name, true, &err)) {
-                       EM_DEBUG_EXCEPTION("em_storage_rename_mailbox failed - %d", err);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+               if (!emstorage_rename_mailbox(old_mailbox->account_id, old_mailbox->name, new_mailbox_tbl.mailbox_name, true, &err)) {
+                       EM_DEBUG_EXCEPTION("emstorage_rename_mailbox failed - %d", err);
+       
                        goto FINISH_OFF;
                }
        }
@@ -558,11 +554,11 @@ FINISH_OFF:
 extern int try_auth;
 extern int try_auth_smtp;
 
+#ifdef __FEATURE_KEEP_CONNECTION__
 extern long smtp_send(SENDSTREAM *stream, char *command, char *args);
-extern long smtp_rcpt(SENDSTREAM *stream, ADDRESS *adr, long* error);
-
+#endif /* __FEATURE_KEEP_CONNECTION__ */
 
-EXPORT_API int em_core_mailbox_open_with_account_info(emf_account_t *account, char *mailbox, void **result_stream, int *err_code)
+INTERNAL_FUNC int emcore_connect_to_remote_mailbox_with_account_info(emf_account_t *account, char *mailbox, void **result_stream, int *err_code)
 {
        EM_PROFILE_BEGIN(emCoreMailboxOpen);
        EM_DEBUG_FUNC_BEGIN("account[%p], mailbox[%p], mail_stream[%p], err_code[%p]", account, mailbox, result_stream, err_code);
@@ -580,8 +576,8 @@ EXPORT_API int em_core_mailbox_open_with_account_info(emf_account_t *account, ch
                goto FINISH_OFF;
        }
        
-       if (!em_core_get_current_session(&session)) {
-               EM_DEBUG_EXCEPTION("em_core_get_current_session failed...");
+       if (!emcore_get_current_session(&session)) {
+               EM_DEBUG_EXCEPTION("emcore_get_current_session failed...");
                error = EMF_ERROR_SESSION_NOT_FOUND;
                goto FINISH_OFF;
        }
@@ -592,7 +588,7 @@ EXPORT_API int em_core_mailbox_open_with_account_info(emf_account_t *account, ch
                is_connection_for = _SERVICE_THREAD_TYPE_SENDING;
 
 #ifdef __FEATURE_KEEP_CONNECTION__
-       emf_connection_info_t *connection_info = em_core_get_connection_info_by_account_id(account->account_id);
+       emf_connection_info_t *connection_info = emcore_get_connection_info_by_account_id(account->account_id);
 
        if(connection_info) {
                if (is_connection_for == _SERVICE_THREAD_TYPE_RECEIVING) {
@@ -612,14 +608,14 @@ EXPORT_API int em_core_mailbox_open_with_account_info(emf_account_t *account, ch
 #endif
 
        session->error = EMF_ERROR_NONE;
-       em_core_set_network_error(EMF_ERROR_NONE);              /*  set current network error as EMF_ERROR_NONE before network operation */
+       emcore_set_network_error(EMF_ERROR_NONE);               /*  set current network error as EMF_ERROR_NONE before network operation */
        
        if (is_connection_for == _SERVICE_THREAD_TYPE_RECEIVING) {      
                /*  open pop3/imap server */
                MAILSTREAM *mail_stream = NULL;
                
-               if (!em_core_get_long_encoded_path_with_account_info(account, mailbox, '/', &mbox_path, &error)) {
-                       EM_DEBUG_EXCEPTION("em_core_get_long_encoded_path failed - %d", error);
+               if (!emcore_get_long_encoded_path_with_account_info(account, mailbox, '/', &mbox_path, &error)) {
+                       EM_DEBUG_EXCEPTION("emcore_get_long_encoded_path failed - %d", error);
                        session->error = error;
                        goto FINISH_OFF;
                }
@@ -667,8 +663,8 @@ EXPORT_API int em_core_mailbox_open_with_account_info(emf_account_t *account, ch
                }
 #endif
                if(!send_stream) {
-                       if (!em_core_get_long_encoded_path_with_account_info(account, mailbox, 0, &mbox_path, &error)) {
-                               EM_DEBUG_EXCEPTION(" em_core_get_long_encoded_path failed - %d", error);
+                       if (!emcore_get_long_encoded_path_with_account_info(account, mailbox, 0, &mbox_path, &error)) {
+                               EM_DEBUG_EXCEPTION(" emcore_get_long_encoded_path failed - %d", error);
                                session->error = error;
                                goto FINISH_OFF;
                        }
@@ -701,12 +697,12 @@ FINISH_OFF:
 #ifdef __FEATURE_KEEP_CONNECTION__
        if (ret == true) {
                if(!connection_info) {
-                       connection_info = em_core_malloc(sizeof(emf_connection_info_t));
+                       connection_info = em_malloc(sizeof(emf_connection_info_t));
                        connection_info->account_id = account->account_id;
                        if(!connection_info) 
-                               EM_DEBUG_EXCEPTION("em_core_malloc for connection_info failed.");
+                               EM_DEBUG_EXCEPTION("em_malloc for connection_info failed.");
                        else
-                               em_core_append_connection_info(connection_info);
+                               emcore_append_connection_info(connection_info);
                }
 
                if(connection_info) {
@@ -734,27 +730,27 @@ FINISH_OFF:
 #ifdef __FEATURE_KEEP_CONNECTION__
 
 /*h.gahlaut@samsung.com :  20-oct-2010*/
-/*Precaution :  When Reuse Stream feature is enabled then stream should only be closed using em_core_mailbox_close from email-service code.
+/*Precaution :  When Reuse Stream feature is enabled then stream should only be closed using emcore_close_mailbox from email-service code.
 mail_close should not be used directly from anywhere in code.
-em_core_mailbox_close uses mail_close inside it.
+emcore_close_mailbox uses mail_close inside it.
 
-mail_close is only used in em_core_mailbox_open and em_core_reset_streams as an exception to above rule*/
+mail_close is only used in emcore_connect_to_remote_mailbox and emcore_reset_streams as an exception to above rule*/
 
-EXPORT_API int em_core_mailbox_open(int account_id, char *mailbox, void **mail_stream, int *err_code)
+INTERNAL_FUNC int emcore_connect_to_remote_mailbox(int account_id, char *mailbox, void **mail_stream, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], mailbox[%p], mail_stream[%p], err_code[%p]", account_id, mailbox, mail_stream, err_code);
        
        int ret = false;
        int error = EMF_ERROR_NONE;
-       emf_account_t *ref_account = em_core_get_account_reference(account_id);
+       emf_account_t *ref_account = emcore_get_account_reference(account_id);
 
        if (!ref_account) {             
-               EM_DEBUG_EXCEPTION("em_core_get_account_reference failed - account id[%d]", account_id);
+               EM_DEBUG_EXCEPTION("emcore_get_account_reference failed - account id[%d]", account_id);
                error = EMF_ERROR_INVALID_ACCOUNT;              
                goto FINISH_OFF;
        }
        
-       ret = em_core_mailbox_open_with_account_info(ref_account, mailbox, mail_stream, &error);
+       ret = emcore_connect_to_remote_mailbox_with_account_info(ref_account, mailbox, mail_stream, &error);
 
 FINISH_OFF: 
        if (err_code)
@@ -763,8 +759,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API
-void em_core_close_receiving_stream()
+INTERNAL_FUNC void emcore_close_mailbox_receiving_stream()
 {
        EM_DEBUG_FUNC_BEGIN("recv_thread_run [%d]", recv_thread_run);
        if (!recv_thread_run) {
@@ -777,12 +772,11 @@ void em_core_close_receiving_stream()
        EM_DEBUG_FUNC_END();
 }
 
-EXPORT_API
-void em_core_close_partial_body_stream()
+INTERNAL_FUNC void emcore_close_mailbox_partial_body_stream()
 {
        EM_DEBUG_FUNC_BEGIN();
-       if (false == em_core_get_pbd_thd_state()) {
-               EM_DEBUG_LOG("em_core_get_pbd_thd_state returned false");
+       if (false == emcore_get_pbd_thd_state()) {
+               EM_DEBUG_LOG("emcore_get_pbd_thd_state returned false");
                mail_close(g_partial_body_thd_stream);
                g_partial_body_thd_stream = NULL;
                prev_acc_id_pb_thd = 0;
@@ -791,16 +785,15 @@ void em_core_close_partial_body_stream()
 }
 
 /* h.gahlaut@samsung.com :  21-10-2010 - 
-em_core_reset_stream() function is used to reset globally stored partial body thread and receiving thread streams 
+emcore_reset_stream() function is used to reset globally stored partial body thread and receiving thread streams 
 on account deletion and pdp deactivation */
 
-EXPORT_API
-void em_core_reset_streams()
+INTERNAL_FUNC void emcore_reset_streams()
 {
        EM_DEBUG_FUNC_BEGIN();
 
-       em_core_close_receiving_stream();
-       em_core_close_partial_body_stream();
+       emcore_close_mailbox_receiving_stream();
+       emcore_close_mailbox_partial_body_stream();
        
        EM_DEBUG_FUNC_END();
        return;
@@ -808,21 +801,21 @@ void em_core_reset_streams()
 
 #else /*  __FEATURE_KEEP_CONNECTION__ */
 
-EXPORT_API int em_core_mailbox_open(int account_id, char *mailbox, void **mail_stream, int *err_code)
+INTERNAL_FUNC int emcore_connect_to_remote_mailbox(int account_id, char *mailbox, void **mail_stream, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], mailbox[%p], mail_stream[%p], err_code[%p]", account_id, mailbox, mail_stream, err_code);
        
        int ret = false;
        int error = EMF_ERROR_NONE;
-       emf_account_t *ref_account = em_core_get_account_reference(account_id);
+       emf_account_t *ref_account = emcore_get_account_reference(account_id);
 
        if (!ref_account)  {            
-               EM_DEBUG_EXCEPTION("em_core_get_account_reference failed - account id[%d]", account_id);
+               EM_DEBUG_EXCEPTION("emcore_get_account_reference failed - account id[%d]", account_id);
                error = EMF_ERROR_INVALID_ACCOUNT;              
                goto FINISH_OFF;
        }
 
-       ret = em_core_mailbox_open_with_account_info(ref_account, mailbox, mail_stream, &error);
+       ret = emcore_connect_to_remote_mailbox_with_account_info(ref_account, mailbox, mail_stream, &error);
 
 FINISH_OFF: 
        if (err_code)
@@ -832,22 +825,22 @@ FINISH_OFF:
 }
 #endif  /*  __FEATURE_KEEP_CONNECTION__ */
 
-EXPORT_API int em_core_mailbox_close(int account_id, void *mail_stream)
+INTERNAL_FUNC int emcore_close_mailbox(int account_id, void *mail_stream)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], mail_stream[%p]", account_id, mail_stream);
        
        if (!mail_stream)  {
                EM_DEBUG_EXCEPTION("Invalid parameter");
-               return false;           /* TODO :  confirm me */
+               return false;
        }
        
 #ifdef __FEATURE_KEEP_CONNECTION__
        thread_t thread_id = THREAD_SELF();
 
-       if (thread_id == (thread_t)em_core_get_receiving_thd_id()) {
+       if (thread_id == (thread_t)emcore_get_receiving_thd_id()) {
                /*  Receiving thread - Dont' Free Reuse feature enabled  */
        }
-       else if (thread_id == (thread_t)em_core_get_partial_body_thd_id()) {
+       else if (thread_id == (thread_t)emcore_get_partial_body_thd_id()) {
                /*  Partial Body Download thread - Dont' Free Reuse feature enabled  */
        }
        else {
@@ -862,7 +855,7 @@ EXPORT_API int em_core_mailbox_close(int account_id, void *mail_stream)
        return true;
 }
 
-EXPORT_API int em_core_mailbox_free(emf_mailbox_t **mailbox_list, int count, int *err_code)
+INTERNAL_FUNC int emcore_free_mailbox(emf_mailbox_t **mailbox_list, int count, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("mailbox_list[%p], count[%d], err_code[%p]", mailbox_list, count, err_code);
        
@@ -902,8 +895,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API void
-em_core_bind_mailbox_type(emf_mailbox_t *mailbox_list)
+INTERNAL_FUNC void emcore_bind_mailbox_type(emf_mailbox_t *mailbox_list)
 {
        EM_DEBUG_FUNC_BEGIN("mailbox_list[%p]", mailbox_list);
 
@@ -930,7 +922,7 @@ em_core_bind_mailbox_type(emf_mailbox_t *mailbox_list)
        EM_DEBUG_FUNC_END();
 }
 
-EXPORT_API int  em_core_send_mail_event(emf_mailbox_t *mailbox, int mail_id , int *err_code)
+INTERNAL_FUNC int  emcore_send_mail_event(emf_mailbox_t *mailbox, int mail_id , int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
        
@@ -953,11 +945,11 @@ EXPORT_API int  em_core_send_mail_event(emf_mailbox_t *mailbox, int mail_id , in
        event_data.event_param_data_4 = mail_id;
        event_data.event_param_data_1 = NULL;
                        
-       if (!em_core_insert_send_event(&event_data, &handle, &err))  {
-               EM_DEBUG_LOG(" em_core_insert_event failed - %d", err);
+       if (!emcore_insert_send_event(&event_data, &handle, &err))  {
+               EM_DEBUG_LOG(" emcore_insert_event failed - %d", err);
                goto FINISH_OFF;
        }
-       em_core_add_transaction_info(mail_id , handle , &err);
+       emcore_add_transaction_info(mail_id , handle , &err);
 
        ret = true;
 FINISH_OFF: 
@@ -967,16 +959,15 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API
-int em_core_partial_body_thd_local_activity_sync(int *is_event_inserted, int *err_code)
+INTERNAL_FUNC int emcore_partial_body_thd_local_activity_sync(int *is_event_inserted, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
        int activity_count = 0;
        int ret = false;
        int error = EMF_ERROR_NONE;
 
-       if (false == em_storage_get_pbd_activity_count(&activity_count, false, &error)) {
-               EM_DEBUG_LOG("em_storage_get_pbd_activity_count failed [%d]", error);
+       if (false == emstorage_get_pbd_activity_count(&activity_count, false, &error)) {
+               EM_DEBUG_LOG("emstorage_get_pbd_activity_count failed [%d]", error);
                goto FINISH_OFF;
        }
 
@@ -990,8 +981,8 @@ int em_core_partial_body_thd_local_activity_sync(int *is_event_inserted, int *er
                pbd_event.event_type = EMF_EVENT_LOCAL_ACTIVITY_SYNC_BULK_PBD;
                pbd_event.activity_type = EMF_EVENT_LOCAL_ACTIVITY_SYNC_BULK_PBD;
 
-               if (false == em_core_insert_partial_body_thread_event(&pbd_event, &error)) {
-                       EM_DEBUG_LOG(" em_core_insert_partial_body_thread_event failed [%d]", error);
+               if (false == emcore_insert_partial_body_thread_event(&pbd_event, &error)) {
+                       EM_DEBUG_LOG(" emcore_insert_partial_body_thread_event failed [%d]", error);
                        goto FINISH_OFF;
                }
                else {
@@ -1015,12 +1006,11 @@ int em_core_partial_body_thd_local_activity_sync(int *is_event_inserted, int *er
        return ret;
 }
 
-EXPORT_API
-int em_core_get_mailbox_by_type(int account_id, emf_mailbox_type_e mailbox_type, emf_mailbox_t *result_mailbox, int *err_code)
+INTERNAL_FUNC int emcore_get_mailbox_by_type(int account_id, emf_mailbox_type_e mailbox_type, emf_mailbox_t *result_mailbox, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id [%d], result_mailbox [%p], err_code [%p]", account_id, result_mailbox, err_code);
        int ret = false, err = EMF_ERROR_NONE;
-       emf_mailbox_tbl_t *mail_box_tbl_spam = NULL;
+       emstorage_mailbox_tbl_t *mail_box_tbl_spam = NULL;
 
        if (result_mailbox == NULL)     {       
                EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
@@ -1028,9 +1018,9 @@ int em_core_get_mailbox_by_type(int account_id, emf_mailbox_type_e mailbox_type,
                goto FINISH_OFF;
        }
 
-       if (!em_storage_get_mailbox_by_mailbox_type(account_id, mailbox_type, &mail_box_tbl_spam, false, &err)) {
-               err = em_storage_get_emf_error_from_em_storage_error(err);
-               EM_DEBUG_LOG("em_storage_get_mailbox_by_mailbox_type failed - %d", err);
+       if (!emstorage_get_mailbox_by_mailbox_type(account_id, mailbox_type, &mail_box_tbl_spam, false, &err)) {
+
+               EM_DEBUG_LOG("emstorage_get_mailbox_by_mailbox_type failed - %d", err);
        }
        else {  
                if (mail_box_tbl_spam) {
@@ -1038,8 +1028,8 @@ int em_core_get_mailbox_by_type(int account_id, emf_mailbox_type_e mailbox_type,
                        result_mailbox->name = EM_SAFE_STRDUP(mail_box_tbl_spam->mailbox_name);
                        result_mailbox->account_id = mail_box_tbl_spam->account_id;
                        result_mailbox->mail_slot_size = mail_box_tbl_spam->mail_slot_size;
-                       if (!em_storage_free_mailbox(&mail_box_tbl_spam, 1, &err))
-                               EM_DEBUG_EXCEPTION(" em_storage_free_mailbox Failed [%d]", err);
+                       if (!emstorage_free_mailbox(&mail_box_tbl_spam, 1, &err))
+                               EM_DEBUG_EXCEPTION(" emstorage_free_mailbox Failed [%d]", err);
                        ret = true;     
                }
        }
@@ -1051,8 +1041,8 @@ FINISH_OFF:
        return ret;
 }
 
-#ifdef __LOCAL_ACTIVITY__
-EXPORT_API int em_core_local_activity_sync(int account_id, int *err_code)
+#ifdef __FEATURE_LOCAL_ACTIVITY__
+INTERNAL_FUNC int emcore_local_activity_sync(int account_id, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
 
@@ -1075,20 +1065,20 @@ EXPORT_API int em_core_local_activity_sync(int account_id, int *err_code)
                EM_DEBUG_EXCEPTION(" Invalid Account ID [%d] ", account_id);
                return false;
        }
-               EM_DEBUG_LOG(">>> emf_local_activity_sync 3 ");
+               EM_DEBUG_LOG(">>> emdaemon_sync_local_activity 3 ");
 
-       if (!em_storage_get_activity_id_list(account_id, &activity_id_list, &activity_count, ACTIVITY_DELETEMAIL, ACTIVITY_COPYMAIL, true,  &err)) {
-                       EM_DEBUG_LOG(">>> emf_local_activity_sync 4 ");
-               EM_DEBUG_EXCEPTION(" em_storage_get_activity_id_list failed [ %d] ", err);
+       if (!emstorage_get_activity_id_list(account_id, &activity_id_list, &activity_count, ACTIVITY_DELETEMAIL, ACTIVITY_COPYMAIL, true,  &err)) {
+                       EM_DEBUG_LOG(">>> emdaemon_sync_local_activity 4 ");
+               EM_DEBUG_EXCEPTION(" emstorage_get_activity_id_list failed [ %d] ", err);
                goto FINISH_OFF;
        }
-       EM_DEBUG_LOG(">>> emf_local_activity_sync 5 ");
+       EM_DEBUG_LOG(">>> emdaemon_sync_local_activity 5 ");
 
        if (activity_count > 0) {
                event_data.type = EMF_EVENT_LOCAL_ACTIVITY;
                event_data.account_id  = account_id;
-               if (!em_core_insert_event(&event_data, &handle, &err))  {
-                       EM_DEBUG_LOG(" em_core_insert_event failed - %d", err);
+               if (!emcore_insert_event(&event_data, &handle, &err))  {
+                       EM_DEBUG_LOG(" emcore_insert_event failed - %d", err);
                        goto FINISH_OFF;
                }
                
@@ -1098,7 +1088,7 @@ EXPORT_API int em_core_local_activity_sync(int account_id, int *err_code)
        FINISH_OFF: 
                
        if (activity_id_list)
-               em_storage_free_activity_id_list(activity_id_list, &err); 
+               emstorage_free_activity_id_list(activity_id_list, &err); 
        
        if (err_code != NULL)
                *err_code = err;
@@ -1107,13 +1097,13 @@ EXPORT_API int em_core_local_activity_sync(int account_id, int *err_code)
 
 }
 
-EXPORT_API int em_core_save_local_activity_sync(int account_id, int *err_code)
+INTERNAL_FUNC int emcore_save_local_activity_sync(int account_id, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
 
        EM_DEBUG_LOG(">> account_id [%d], err_code [%p] ", account_id, err_code);
        
-       emf_activity_tbl_t *local_activity = NULL;
+       emstorage_activity_tbl_t *local_activity = NULL;
        int *activity_id_list = NULL;
        int activity_count = 0;
        int err         = 0;
@@ -1129,10 +1119,10 @@ EXPORT_API int em_core_save_local_activity_sync(int account_id, int *err_code)
                EM_DEBUG_EXCEPTION(" Invalid Account ID [%d] ", account_id);
                return false;
        }
-               EM_DEBUG_LOG(">>> emf_local_activity_sync 3 ");
+               EM_DEBUG_LOG(">>> emdaemon_sync_local_activity 3 ");
 
-       if (!em_storage_get_activity_id_list(account_id, &activity_id_list, &activity_count, ACTIVITY_SAVEMAIL, ACTIVITY_DELETEMAIL_SEND, true,  &err)) {
-               EM_DEBUG_EXCEPTION(" em_storage_get_activity_id_list [ %d] ", err);
+       if (!emstorage_get_activity_id_list(account_id, &activity_id_list, &activity_count, ACTIVITY_SAVEMAIL, ACTIVITY_DELETEMAIL_SEND, true,  &err)) {
+               EM_DEBUG_EXCEPTION(" emstorage_get_activity_id_list [ %d] ", err);
                goto FINISH_OFF;
        }
 
@@ -1140,8 +1130,8 @@ EXPORT_API int em_core_save_local_activity_sync(int account_id, int *err_code)
        if (activity_count > 0) {
                event_data.type = EMF_EVENT_LOCAL_ACTIVITY;
                event_data.account_id  = account_id;
-               if (!em_core_insert_send_event(&event_data, &handle, &err))  {
-                       EM_DEBUG_LOG(" em_core_insert_event failed - %d", err);
+               if (!emcore_insert_send_event(&event_data, &handle, &err))  {
+                       EM_DEBUG_LOG(" emcore_insert_event failed - %d", err);
                        goto FINISH_OFF;
                }       
                
@@ -1152,10 +1142,10 @@ EXPORT_API int em_core_save_local_activity_sync(int account_id, int *err_code)
        FINISH_OFF: 
 
        if (local_activity)
-               em_storage_free_local_activity(&local_activity, activity_count, NULL); 
+               emstorage_free_local_activity(&local_activity, activity_count, NULL); 
 
        if (activity_id_list)
-               em_storage_free_activity_id_list(activity_id_list, &err);       
+               emstorage_free_activity_id_list(activity_id_list, &err);        
 
        if (err_code != NULL)
                *err_code = err;
similarity index 74%
rename from email-core/em-core-mime.c
rename to email-core/email-core-mime.c
index 8e17098..04c5a27 100755 (executable)
@@ -22,7 +22,7 @@
 
 
 /* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ***
- *File :  em-core-mime.c
+ *File :  email-core-mime.c
  *Desc :  MIME Operation
  *
  *Auth :
 #include <ctype.h>
 #include <sys/stat.h>
 #include <sys/time.h>
-#include "em-core-types.h"
+#include "email-internal-types.h"
 #include "lnx_inc.h"
-#include "em-core-global.h"
-#include "em-core-utils.h"
-#include "em-core-mesg.h"
-#include "em-core-mime.h"
-#include "em-storage.h"
-#include "em-core-event.h"
-#include "em-core-account.h" 
-#include "emf-dbglog.h"
+#include "email-utilities.h"
+#include "email-core-global.h"
+#include "email-core-utils.h"
+#include "email-core-mail.h"
+#include "email-core-mime.h"
+#include "email-storage.h"
+#include "email-core-event.h"
+#include "email-core-account.h" 
+#include "email-debug-log.h"
 
 
 #define MIME_MESG_IS_SOCKET
@@ -170,9 +171,10 @@ struct _rfc822header {
        char                            *dsp_noti_to;
        char                            *others;
 };
+
 /*  MIME Part Header */
 struct _m_part_header {
-       char                            *type;                  /*  text, image, audio, video, application, multipart, messag */
+       char                            *type;                  /*  text, image, audio, video, application, multipart, message */
        char                            *subtype;               /*  plain, html, jpeg, .. */
        char                            *encoding;              /*  encoding typ */
        struct _parameter       *parameter;             /*  content-type parameter  :  "boundary" "charset" .. */
@@ -240,49 +242,44 @@ extern int g_inline_count;
 /*  Function Declaration */
 
 /*  parsing the first header (RFC822 Header and Message Header and Etc... */
-static int em_core_mime_parse_header(void *stream, int is_file, struct _rfc822header **rfcheader, struct _m_mesg_header **header, int *err_code);
+static int emcore_mime_parse_header(void *stream, int is_file, struct _rfc822header **rfcheader, struct _m_mesg_header **header, int *err_code);
 
 /*  parsing the first bod */
-static int em_core_mime_parse_body(void *stream, int is_file, struct _m_mesg *mmsg, struct _m_content_info *cnt_info, void *callback, int *err_code);
+static int emcore_mime_parse_body(void *stream, int is_file, struct _m_mesg *mmsg, struct _m_content_info *cnt_info, void *callback, int *err_code);
 
 /*  parsing the message part header (CONTENT-... header */
-static int em_core_mime_parse_part_header(void *stream, int is_file, struct _m_part_header **header, int *err_code);
+static int emcore_mime_parse_part_header(void *stream, int is_file, struct _m_part_header **header, int *err_code);
 
 /*  parsing the message part by boundar */
-static int em_core_mime_parse_part(void *stream, int is_file, struct _m_part_header *parent_header, struct _m_part *nested, struct _m_content_info *cnt_info, int *end_of_parsing, int *err_code);
+static int emcore_mime_parse_part(void *stream, int is_file, struct _m_part_header *parent_header, struct _m_part *nested, struct _m_content_info *cnt_info, int *end_of_parsing, int *err_code);
 
 /*  set RFC822 Header valu */
-static int em_core_mime_set_rfc822_header_value(struct _rfc822header **rfc822header, char *name, char *value, int *err_code);
+static int emcore_mime_set_rfc822_header_value(struct _rfc822header **rfc822header, char *name, char *value, int *err_code);
 
 /*  set Message Part Header (Content-... Header */
-static int em_core_mime_set_part_header_value(struct _m_part_header **header, char *name, char *value, int *err_code);
-
-char *em_core_mime_get_content_param(struct _m_body *mbody, char *name, int *err_code);
+static int emcore_mime_set_part_header_value(struct _m_part_header **header, char *name, char *value, int *err_code);
 
-static int em_core_mime_get_param_from_str(char *str, struct _parameter **param, int *err_code);
+static int emcore_mime_get_param_from_str(char *str, struct _parameter **param, int *err_code);
 
-static int em_core_mime_add_param_to_list(struct _parameter **param_list, struct _parameter *param, int *err_code);
+static int emcore_mime_add_param_to_list(struct _parameter **param_list, struct _parameter *param, int *err_code);
 
-char *em_core_mime_get_header_value(struct _m_part_header *header, int type, int *err_code);
+char *emcore_mime_get_header_value(struct _m_part_header *header, int type, int *err_code);
 
-void em_core_mime_free_param(struct _parameter *param);
-void em_core_mime_free_part_header(struct _m_part_header *header);
-void em_core_mime_free_message_header(struct _m_mesg_header *header);
-void em_core_mime_free_rfc822_header(struct _rfc822header *rfc822header);
-void em_core_mime_free_part(struct _m_part *part);
-void em_core_mime_free_part_body(struct _m_body *body);
-void em_core_mime_free_mime(struct _m_mesg *mmsg);
-char *em_core_mime_get_line_from_sock(void *stream, char *buf, int size, int *err_code); 
-char *em_core_mime_trim_left(char *str);
-char *em_core_mime_trim_right(char *str);
-char *em_core_mime_upper_str(char *str);
-char *em_core_mime_get_save_file_name(int *err_code);
+void emcore_mime_free_param(struct _parameter *param);
+void emcore_mime_free_part_header(struct _m_part_header *header);
+void emcore_mime_free_message_header(struct _m_mesg_header *header);
+void emcore_mime_free_rfc822_header(struct _rfc822header *rfc822header);
+void emcore_mime_free_part(struct _m_part *part);
+void emcore_mime_free_part_body(struct _m_body *body);
+void emcore_mime_free_mime(struct _m_mesg *mmsg);
+char *emcore_mime_get_line_from_sock(void *stream, char *buf, int size, int *err_code); 
+char *emcore_mime_get_save_file_name(int *err_code);
 
 /*  get content data and save buffer or fil */
 /*  mode - 1 :  get the only siz */
 /*         2 :  save content to buffer (holder is buffer */
 /*         3 :  save content to file (holder is file name */
-static int em_core_mime_get_content_data(void *stream, 
+static int emcore_mime_get_content_data(void *stream, 
                                        int  is_file, 
                        int   is_text, 
                                        char *boundary_str, 
@@ -294,7 +291,7 @@ static int em_core_mime_get_content_data(void *stream,
                                        void *callback, 
                                        int *err_code);
 /*  skip content data to boundary_str or end of fil */
-int em_core_mime_skip_content_data(void *stream, 
+int emcore_mime_skip_content_data(void *stream, 
                                                        int is_file, 
                                                        char *boundary_str, 
                                                        int *end_of_parsing, 
@@ -302,12 +299,12 @@ int em_core_mime_skip_content_data(void *stream,
                                                        void *callback, 
                                                        int *err_code);
 
-static int em_core_get_file_pointer(BODY *body, char *buf, struct _m_content_info *cnt_info , int *err);
-static PARTLIST *em_core_get_body_full(MAILSTREAM *stream, int msg_uid, BODY *body, struct _m_content_info *cnt_info, int *err_code, PARTLIST *section_list);
-static int em_core_get_body_part_imap_full(MAILSTREAM *stream, int msg_uid, int account_id, int mail_id, PARTLIST *section_list, struct _m_content_info *cnt_info, int *err_code, int event_handle);
-static PARTLIST *em_core_add_node(PARTLIST *section_list, BODY *body);
-static void em_core_free_section_list(PARTLIST *section_list);
-static int em_core_get_section_body_size(char *response, char *section, int *body_size);
+static int emcore_get_file_pointer(BODY *body, char *buf, struct _m_content_info *cnt_info , int *err);
+static PARTLIST *emcore_get_body_full(MAILSTREAM *stream, int msg_uid, BODY *body, struct _m_content_info *cnt_info, int *err_code, PARTLIST *section_list);
+static int emcore_get_body_part_imap_full(MAILSTREAM *stream, int msg_uid, int account_id, int mail_id, PARTLIST *section_list, struct _m_content_info *cnt_info, int *err_code, int event_handle);
+static PARTLIST *emcore_add_node(PARTLIST *section_list, BODY *body);
+static void emcore_free_section_list(PARTLIST *section_list);
+static int emcore_get_section_body_size(char *response, char *section, int *body_size);
 static void parse_file_path_to_filename(char *src_string, char **out_string);
 extern long pop3_reply (MAILSTREAM *stream);
 /* ------------------------------------------------------------------------------------------------- */
@@ -330,7 +327,7 @@ char *em_split_file_path(char *str)
        char *temp_cid = NULL;
        temp_str = EM_SAFE_STRDUP(str);
        buf_length = strlen(str) + 1024;
-       buf = em_core_malloc(buf_length);
+       buf = em_malloc(buf_length);
        content_id = temp_str;
        temp_cid = strstr(temp_str, "\"");
 
@@ -340,7 +337,7 @@ char *em_split_file_path(char *str)
                EM_SAFE_FREE(buf); 
                return temp_str;
        }
-       temp_cid_data = em_core_malloc((temp_cid-temp_str)+1);
+       temp_cid_data = em_malloc((temp_cid-temp_str)+1);
        memcpy(temp_cid_data, temp_str, (temp_cid-temp_str));
 
        if (!strstr(temp_cid_data, delims)) {
@@ -408,7 +405,7 @@ static char *em_replace_string_with_split_file_path(char *source_string, char *o
        }
 
        buf_len = strlen(source_string) + 1024;
-       buffer = (char *)em_core_malloc(buf_len);
+       buffer = (char *)em_malloc(buf_len);
 
        if(p - source_string < strlen(source_string) + 1024 + 1) {
                strncpy(buffer, source_string, p - source_string);
@@ -448,8 +445,7 @@ FINISH_OFF:
 }
 
 
-int
-em_core_mime_flush_receiving_buffer(void *stream, int is_file, char *boundary_string, char *boundary_end_string,  int *end_of_parsing, int *err_code)
+int emcore_mime_flush_receiving_buffer(void *stream, int is_file, char *boundary_string, char *boundary_end_string,  int *end_of_parsing, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("stream[%p], is_file[%d], boundary_string[%s], boundary_end_string[%s], end_of_parsing[%p],  err_code[%p]", stream, is_file, boundary_string, boundary_end_string, end_of_parsing, err_code);
        char buf[MIME_LINE_LEN] = {0, };
@@ -463,16 +459,16 @@ em_core_mime_flush_receiving_buffer(void *stream, int is_file, char *boundary_st
        }
 
        while (TRUE)  {
-               if (!em_core_check_thread_status())  {
+               if (!emcore_check_thread_status())  {
                        if (err_code != NULL)
                                *err_code = EMF_ERROR_CANCELLED;
                        EM_DEBUG_FUNC_END("EMF_ERROR_CANCELLED");
                        return false;
                }
 
-               if ((is_file == 0 && !em_core_mime_get_line_from_sock(stream, buf, MIME_LINE_LEN, err_code)) || 
-                       (is_file == 1 && !em_core_mime_get_line_from_file(stream, buf, MIME_LINE_LEN, err_code))) {
-                       EM_DEBUG_EXCEPTION("em_core_mime_get_line_from_sock failed");
+               if ((is_file == 0 && !emcore_mime_get_line_from_sock(stream, buf, MIME_LINE_LEN, err_code)) || 
+                       (is_file == 1 && !emcore_get_line_from_file(stream, buf, MIME_LINE_LEN, err_code))) {
+                       EM_DEBUG_EXCEPTION("emcore_mime_get_line_from_sock failed");
                        local_end_of_parsing = 0;
                        break;
                }
@@ -498,11 +494,11 @@ em_core_mime_flush_receiving_buffer(void *stream, int is_file, char *boundary_st
        return true;
 }
 
-int em_core_mime_parse_mime(void *stream, int is_file, struct _m_content_info *cnt_info, int *err_code)
+int emcore_parse_mime(void *stream, int is_file, struct _m_content_info *cnt_info, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("stream[%p], is_file[%d], cnt_info[%p], err_code[%p]", stream, is_file, cnt_info, err_code);
        
-       struct _m_mesg *mmsg = em_core_malloc(sizeof(struct _m_mesg));
+       struct _m_mesg *mmsg = em_malloc(sizeof(struct _m_mesg));
 
        if (!mmsg) return false;
 
@@ -510,12 +506,12 @@ int em_core_mime_parse_mime(void *stream, int is_file, struct _m_content_info *c
 
        /*  1. parse the first found heade */
        EM_DEBUG_LOG(">>>>>> 1. parse the first found header");
-       if (!em_core_mime_parse_header(stream, is_file, &mmsg->rfc822header, &mmsg->header, err_code)) {
+       if (!emcore_mime_parse_header(stream, is_file, &mmsg->rfc822header, &mmsg->header, err_code)) {
                EM_SAFE_FREE(mmsg);
                return false; 
        }
 
-       if (!em_core_check_thread_status())  {
+       if (!emcore_check_thread_status())  {
                if (err_code != NULL)
                        *err_code = EMF_ERROR_CANCELLED;
                return false;
@@ -529,7 +525,7 @@ int em_core_mime_parse_mime(void *stream, int is_file, struct _m_content_info *c
                EM_DEBUG_LOG("next  :  %p", mmsg->header->part_header->parameter->next);
        }
        
-       if (em_core_mime_parse_body(stream, is_file, mmsg, cnt_info, NULL, err_code)<0) {
+       if (emcore_mime_parse_body(stream, is_file, mmsg, cnt_info, NULL, err_code)<0) {
                EM_SAFE_FREE(mmsg);
                return false; 
        }
@@ -541,12 +537,12 @@ int em_core_mime_parse_mime(void *stream, int is_file, struct _m_content_info *c
                EM_DEBUG_LOG("value[%s]", mmsg->header->part_header->parameter->value);
                EM_DEBUG_LOG("next  :  %p", mmsg->header->part_header->parameter->next);
        }
-       em_core_mime_free_mime(mmsg);
+       emcore_mime_free_mime(mmsg);
        EM_DEBUG_FUNC_END();
        return true;
 }
 
-int em_core_mime_parse_header(void *stream, int is_file, struct _rfc822header **rfc822header, struct _m_mesg_header **header, int *err_code)
+int emcore_mime_parse_header(void *stream, int is_file, struct _rfc822header **rfc822header, struct _m_mesg_header **header, int *err_code)
 { 
        EM_DEBUG_FUNC_BEGIN("stream[%p], is_file[%d], rfc822header[%p], header[%p], err_code[%p]", stream, is_file, rfc822header, header, err_code);
        
@@ -558,26 +554,26 @@ int em_core_mime_parse_header(void *stream, int is_file, struct _rfc822header **
        char *pTemp = NULL;
        int  is_longheader; 
        
-       if (!em_core_check_thread_status())  {
+       if (!emcore_check_thread_status())  {
                if (err_code != NULL)
                        *err_code = EMF_ERROR_CANCELLED;
                        return false;
                }
 
 
-       if ((is_file == 0 && !em_core_mime_get_line_from_sock(stream, buf, MIME_LINE_LEN, err_code)) || 
-               (is_file == 1 && !em_core_mime_get_line_from_file(stream, buf, MIME_LINE_LEN, err_code)))  {
+       if ((is_file == 0 && !emcore_mime_get_line_from_sock(stream, buf, MIME_LINE_LEN, err_code)) || 
+               (is_file == 1 && !emcore_get_line_from_file(stream, buf, MIME_LINE_LEN, err_code)))  {
                return false;
        }
        
-       if (!(tmp_header = em_core_malloc(sizeof(struct _m_mesg_header))))  {
+       if (!(tmp_header = em_malloc(sizeof(struct _m_mesg_header))))  {
                EM_DEBUG_EXCEPTION("malloc failed...");
                if (err_code != NULL)
                        *err_code = EMF_ERROR_OUT_OF_MEMORY;
                return false;
        }
        
-       if (!em_core_check_thread_status())  {
+       if (!emcore_check_thread_status())  {
                if (err_code != NULL)
                        *err_code = EMF_ERROR_CANCELLED;
                        return false;
@@ -610,11 +606,11 @@ int em_core_mime_parse_header(void *stream, int is_file, struct _rfc822header **
                                if (!*++value)
                                        break;
                                
-                       em_core_mime_upper_str(name);
+                       em_upper_string(name);
                }
                else  { /*  Long header */
                        value = strtok(buf, CRLF_STRING);
-                       em_core_mime_trim_left(value);
+                       em_trim_left(value);
                }
                
                /* --> 2007-05-08 by cy */
@@ -627,7 +623,7 @@ int em_core_mime_parse_header(void *stream, int is_file, struct _rfc822header **
                /*  MIME Part Heade */
                if (memcmp(name, "CONTENT-", 8) == 0 && value)  {
                        EM_DEBUG_LINE;
-                       em_core_mime_set_part_header_value(&tmp_header->part_header, name, value, err_code);
+                       emcore_mime_set_part_header_value(&tmp_header->part_header, name, value, err_code);
                        
                        if (tmp_header->part_header && tmp_header->part_header->parameter)      {
                                EM_DEBUG_LOG("name[%s]", tmp_header->part_header->parameter->name);
@@ -647,23 +643,23 @@ int em_core_mime_parse_header(void *stream, int is_file, struct _rfc822header **
                else  {
                        /*  in socket stream case, ignored because we need only contents informatio */
                        if (is_file == 1)
-                               em_core_mime_set_rfc822_header_value(&tmp_rfc822header, name, value, err_code);
+                               emcore_mime_set_rfc822_header_value(&tmp_rfc822header, name, value, err_code);
                }
                
-               if (!em_core_check_thread_status())  {
+               if (!emcore_check_thread_status())  {
                        if (err_code != NULL)
                                *err_code = EMF_ERROR_CANCELLED;
                        return false;
                }
-               if ((is_file == 0 && !em_core_mime_get_line_from_sock(stream, buf, MIME_LINE_LEN, err_code)) || 
-                       (is_file == 1 && !em_core_mime_get_line_from_file(stream, buf, MIME_LINE_LEN, err_code)))  {
+               if ((is_file == 0 && !emcore_mime_get_line_from_sock(stream, buf, MIME_LINE_LEN, err_code)) || 
+                       (is_file == 1 && !emcore_get_line_from_file(stream, buf, MIME_LINE_LEN, err_code)))  {
                        
                        if (tmp_rfc822header)
-                               em_core_mime_free_rfc822_header(tmp_rfc822header);
+                               emcore_mime_free_rfc822_header(tmp_rfc822header);
                        
                        
                        if (tmp_header)  {
-                               em_core_mime_free_part_header(tmp_header->part_header);
+                               emcore_mime_free_part_header(tmp_header->part_header);
                                
                                EM_SAFE_FREE(tmp_header->version);
                                EM_SAFE_FREE(tmp_header);
@@ -680,7 +676,7 @@ int em_core_mime_parse_header(void *stream, int is_file, struct _rfc822header **
        return true;
 }
 
-int em_core_mime_parse_part_header(void *stream, int is_file, struct _m_part_header **header, int *err_code)
+int emcore_mime_parse_part_header(void *stream, int is_file, struct _m_part_header **header, int *err_code)
 { 
        EM_DEBUG_FUNC_BEGIN("stream[%p], is_file[%d], header[%p], err_code[%p]", stream, is_file, header, err_code);
        
@@ -691,20 +687,20 @@ int em_core_mime_parse_part_header(void *stream, int is_file, struct _m_part_hea
        char *p = NULL;         
        int is_longheader = false; 
        
-       if (!em_core_check_thread_status())  {
+       if (!emcore_check_thread_status())  {
                        if (err_code != NULL)
                                *err_code = EMF_ERROR_CANCELLED;
                        return false;
        }
 
-       if ((is_file == 0 && !em_core_mime_get_line_from_sock(stream, buf, MIME_LINE_LEN, err_code)) || 
-       (is_file == 1 && !em_core_mime_get_line_from_file(stream, buf, MIME_LINE_LEN, err_code)))
+       if ((is_file == 0 && !emcore_mime_get_line_from_sock(stream, buf, MIME_LINE_LEN, err_code)) || 
+       (is_file == 1 && !emcore_get_line_from_file(stream, buf, MIME_LINE_LEN, err_code)))
                return false; 
        
-       tmp_header = em_core_malloc(sizeof(struct _m_part_header));
+       tmp_header = em_malloc(sizeof(struct _m_part_header));
 
        if (!tmp_header)  {
-               EM_DEBUG_EXCEPTION("em_core_malloc failed");
+               EM_DEBUG_EXCEPTION("em_malloc failed");
                return false;
        }
        
@@ -722,7 +718,7 @@ int em_core_mime_parse_part_header(void *stream, int is_file, struct _m_part_hea
                        if (p)  {                                               
                                name = EM_SAFE_STRDUP(p);
                                value = strtok(NULL, CRLF_STRING);
-                               em_core_mime_upper_str(name);
+                               em_upper_string(name);
                        }
                } 
                else            /*  Long header */
@@ -731,16 +727,16 @@ int em_core_mime_parse_part_header(void *stream, int is_file, struct _m_part_hea
                if (!name)
                        break;
                
-               em_core_mime_set_part_header_value(&tmp_header, name, value, err_code);
+               emcore_mime_set_part_header_value(&tmp_header, name, value, err_code);
                
-               if (!em_core_check_thread_status())  {
+               if (!emcore_check_thread_status())  {
                        if (err_code != NULL)
                                *err_code = EMF_ERROR_CANCELLED;
                        return false;
                }
                
-               if ((is_file == 0 && !em_core_mime_get_line_from_sock(stream, buf, MIME_LINE_LEN, err_code)) || 
-               (is_file == 1 && !em_core_mime_get_line_from_file(stream, buf, MIME_LINE_LEN, err_code)))  {
+               if ((is_file == 0 && !emcore_mime_get_line_from_sock(stream, buf, MIME_LINE_LEN, err_code)) || 
+               (is_file == 1 && !emcore_get_line_from_file(stream, buf, MIME_LINE_LEN, err_code)))  {
                        EM_SAFE_FREE(name);
                        EM_SAFE_FREE(tmp_header);
                        
@@ -756,26 +752,26 @@ int em_core_mime_parse_part_header(void *stream, int is_file, struct _m_part_hea
 }
 
 
-int em_core_mime_parse_body(void *stream, int is_file, struct _m_mesg *mmsg, struct _m_content_info *cnt_info,  void *callback, int *err_code)
+int emcore_mime_parse_body(void *stream, int is_file, struct _m_mesg *mmsg, struct _m_content_info *cnt_info,  void *callback, int *err_code)
 { 
        EM_DEBUG_FUNC_BEGIN("stream[%p], is_file[%d], mmsg[%p], cnt_info[%p], callback[%p], err_code[%p]", stream, is_file, mmsg, cnt_info, callback, err_code);
        
        char *content_type = NULL, *content_encoding = NULL, *holder = NULL, *attachment_name, *t = NULL;
        int type = 0, end_of_parsing = 0, size, local_err_code = EMF_ERROR_NONE; 
 
-       if (!em_core_check_thread_status())  {
+       if (!emcore_check_thread_status())  {
                if (err_code != NULL)
                        *err_code = EMF_ERROR_CANCELLED;
                return false;
        }
        
        if (mmsg->header)
-               content_type = em_core_mime_get_header_value(mmsg->header->part_header, CONTENT_TYPE, err_code); 
+               content_type = emcore_mime_get_header_value(mmsg->header->part_header, CONTENT_TYPE, err_code); 
        if (!content_type) 
                content_type = "TEXT/PLAIN";
        
        if (mmsg->header)
-               content_encoding = em_core_mime_get_header_value(mmsg->header->part_header, CONTENT_ENCODING, err_code);
+               content_encoding = emcore_mime_get_header_value(mmsg->header->part_header, CONTENT_ENCODING, err_code);
        if (!content_encoding) 
                content_encoding = "7BIT"; 
        
@@ -790,19 +786,19 @@ int em_core_mime_parse_body(void *stream, int is_file, struct _m_mesg *mmsg, str
        
        switch (type)  {
                case TYPE_MULTIPART:
-                       if (mmsg->header && !em_core_mime_get_header_value(mmsg->header->part_header, CONTENT_BOUNDARY, err_code))  {
+                       if (mmsg->header && !emcore_mime_get_header_value(mmsg->header->part_header, CONTENT_BOUNDARY, err_code))  {
                                EM_DEBUG_FUNC_END("false");
                                return false;
                        }
                        
-                       if (mmsg->header && !em_core_mime_parse_part(stream, is_file, mmsg->header->part_header, &mmsg->nested, cnt_info, &end_of_parsing, &local_err_code)) {
+                       if (mmsg->header && !emcore_mime_parse_part(stream, is_file, mmsg->header->part_header, &mmsg->nested, cnt_info, &end_of_parsing, &local_err_code)) {
                                EM_DEBUG_FUNC_END("false");
                                return false;
                        }
 
                        /*  after finishing body parsing, make stream empty to get next mail. (get line from sock or file until '.' is read */
                        if (end_of_parsing == true && local_err_code != EMF_ERROR_NO_MORE_DATA) 
-                               em_core_mime_flush_receiving_buffer(stream, is_file, NULL, NULL, NULL, err_code);
+                               emcore_mime_flush_receiving_buffer(stream, is_file, NULL, NULL, NULL, err_code);
 
                        if (err_code)   
                                *err_code = local_err_code;
@@ -812,8 +808,8 @@ int em_core_mime_parse_body(void *stream, int is_file, struct _m_mesg *mmsg, str
                default:        
                        attachment_name = NULL;
                        
-                       if (mmsg->header && em_core_mime_get_header_value(mmsg->header->part_header, CONTENT_DISPOSITION, err_code)) {
-                               attachment_name = em_core_mime_get_header_value(mmsg->header->part_header, CONTENT_FILENAME, err_code);
+                       if (mmsg->header && emcore_mime_get_header_value(mmsg->header->part_header, CONTENT_DISPOSITION, err_code)) {
+                               attachment_name = emcore_mime_get_header_value(mmsg->header->part_header, CONTENT_FILENAME, err_code);
                                /* if (!attachment_name) attachment_name = "unknown" */
                                if (attachment_name) EM_DEBUG_LOG(" attachment = [%s]", attachment_name);
                        }
@@ -821,14 +817,14 @@ int em_core_mime_parse_body(void *stream, int is_file, struct _m_mesg *mmsg, str
                        if (cnt_info->grab_type & GRAB_TYPE_TEXT)  {
                                /* EM_DEBUG_LINE */
                                /*  get content data. content data is saved in file */
-                               em_core_mime_get_content_data(stream, is_file, true, NULL, content_encoding, &end_of_parsing, SAVE_TYPE_FILE, &holder, &size, NULL, err_code);
+                               emcore_mime_get_content_data(stream, is_file, true, NULL, content_encoding, &end_of_parsing, SAVE_TYPE_FILE, &holder, &size, NULL, err_code);
                                
-                               EM_DEBUG_LOG("After em_core_mime_get_content_data");
+                               EM_DEBUG_LOG("After emcore_mime_get_content_data");
                                
-                               if (mmsg->header && mmsg->header->part_header && strstr((t = em_core_mime_get_header_value(mmsg->header->part_header, CONTENT_TYPE, err_code)) ? t  :  "", "HTML"))
+                               if (mmsg->header && mmsg->header->part_header && strstr((t = emcore_mime_get_header_value(mmsg->header->part_header, CONTENT_TYPE, err_code)) ? t  :  "", "HTML"))
                                        cnt_info->text.html = holder;
                                else if (mmsg->header) {
-                                       char *charset = em_core_mime_get_header_value(mmsg->header->part_header, CONTENT_CHARSET, err_code);
+                                       char *charset = emcore_mime_get_header_value(mmsg->header->part_header, CONTENT_CHARSET, err_code);
                                        
                                        EM_DEBUG_LOG(">>>> charset [%s]", charset);
                                        
@@ -851,7 +847,7 @@ int em_core_mime_parse_body(void *stream, int is_file, struct _m_mesg *mmsg, str
        return true; 
 } 
 
-int em_core_mime_parse_part(void *stream, int is_file, struct _m_part_header *parent_header, struct _m_part *nested, struct _m_content_info *cnt_info, int *eop, int *err_code)
+int emcore_mime_parse_part(void *stream, int is_file, struct _m_part_header *parent_header, struct _m_part *nested, struct _m_content_info *cnt_info, int *eop, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("stream[%p], is_file[%d], parent_header[%p], nested[%p], cnt_info[%p], eop[%p], err_code[%p]", stream, is_file, parent_header, nested, cnt_info, eop, err_code);
        
@@ -860,19 +856,20 @@ int em_core_mime_parse_part(void *stream, int is_file, struct _m_part_header *pa
        char buf[MIME_LINE_LEN] = {0x00, };
        char boundary[BOUNDARY_LEN] = {0x00, };
        char boundary_end[BOUNDARY_LEN] = {0x00, }; 
+       char mime_type_buffer[128] = { 0, };
        char *boundary_str = NULL;
        char *content_type = NULL;
        char *content_encoding = NULL;
        char *holder = NULL;
        char *attachment_name = NULL;
-       char *t = NULL; 
+       char *t = NULL;
+       char *pTemp = NULL;
        int type = 0;
        int end_of_parsing = 0;
        int size = 0, local_err_code = EMF_ERROR_NONE;
        int is_skip = false; 
-       char *pTemp = NULL; 
 
-       boundary_str = em_core_mime_get_header_value(parent_header, CONTENT_BOUNDARY, err_code);
+       boundary_str = emcore_mime_get_header_value(parent_header, CONTENT_BOUNDARY, err_code);
 
        SNPRINTF(boundary, BOUNDARY_LEN, "--%s%s", boundary_str, CRLF_STRING); 
        SNPRINTF(boundary_end, BOUNDARY_LEN, "--%s%s", boundary_str, "--\r\n");
@@ -883,14 +880,14 @@ int em_core_mime_parse_part(void *stream, int is_file, struct _m_part_header *pa
        /*  goto the first found useful mime dat */
        EM_DEBUG_LOG("Before first loop");
        while (true)  { 
-               if (!em_core_check_thread_status())  {
+               if (!emcore_check_thread_status())  {
                        if (err_code != NULL)
                                *err_code = EMF_ERROR_CANCELLED;
                        return false;
                }
-               if ((is_file == 0 && !em_core_mime_get_line_from_sock(stream, buf, MIME_LINE_LEN, err_code)) || 
-               (is_file == 1 && !em_core_mime_get_line_from_file(stream, buf, MIME_LINE_LEN, err_code))) {
-                       EM_DEBUG_EXCEPTION("em_core_mime_get_line_from_sock failed.");
+               if ((is_file == 0 && !emcore_mime_get_line_from_sock(stream, buf, MIME_LINE_LEN, err_code)) || 
+               (is_file == 1 && !emcore_get_line_from_file(stream, buf, MIME_LINE_LEN, err_code))) {
+                       EM_DEBUG_EXCEPTION("emcore_mime_get_line_from_sock failed.");
                        if (eop)
                                *eop = true;
                        EM_DEBUG_FUNC_END("false");
@@ -903,12 +900,12 @@ int em_core_mime_parse_part(void *stream, int is_file, struct _m_part_header *pa
 
        EM_DEBUG_LOG("Before second loop");
        while (true)  {
-               if (!(tmp_body = em_core_malloc(sizeof(struct _m_body))))  {
-                       EM_DEBUG_EXCEPTION("em_core_malloc failed.");
+               if (!(tmp_body = em_malloc(sizeof(struct _m_body))))  {
+                       EM_DEBUG_EXCEPTION("em_malloc failed.");
                        if (nested->body) 
-                               em_core_mime_free_part_body(nested->body);
+                               emcore_mime_free_part_body(nested->body);
                        if (nested->next) 
-                               em_core_mime_free_part(nested->next);
+                               emcore_mime_free_part(nested->next);
                        EM_DEBUG_FUNC_END("false");
                        return false;
                }
@@ -916,22 +913,23 @@ int em_core_mime_parse_part(void *stream, int is_file, struct _m_part_header *pa
                memset(tmp_body, 0, sizeof(struct _m_body));
                
                /*  parsing MIME Header */
-               if (!em_core_mime_parse_part_header(stream, is_file, &tmp_body->part_header, err_code))  {
-                       EM_DEBUG_EXCEPTION("em_core_mime_parse_part_header failed.");
+               if (!emcore_mime_parse_part_header(stream, is_file, &tmp_body->part_header, err_code))  {
+                       EM_DEBUG_EXCEPTION("emcore_mime_parse_part_header failed.");
                        if (nested->body) 
-                               em_core_mime_free_part_body(nested->body);
+                               emcore_mime_free_part_body(nested->body);
                        if (nested->next) 
-                               em_core_mime_free_part(nested->next);
+                               emcore_mime_free_part(nested->next);
                        
-                       em_core_mime_free_part_body(tmp_body);
+                       emcore_mime_free_part_body(tmp_body);
                        return false;
                }
                
-               content_type = em_core_mime_get_header_value(tmp_body->part_header, CONTENT_TYPE, err_code);
+               content_type = emcore_mime_get_header_value(tmp_body->part_header, CONTENT_TYPE, err_code);
+
                if (!content_type) 
                        content_type = "TEXT/PLAIN"; 
 
-               content_encoding = em_core_mime_get_header_value(tmp_body->part_header, CONTENT_ENCODING, err_code);
+               content_encoding = emcore_mime_get_header_value(tmp_body->part_header, CONTENT_ENCODING, err_code);
                if (!content_encoding)
                        content_encoding = "7BIT"; 
                
@@ -947,14 +945,14 @@ int em_core_mime_parse_part(void *stream, int is_file, struct _m_part_header *pa
                switch (type)  {
                        case TYPE_MULTIPART: 
                                EM_DEBUG_LOG("TYPE_MULTIPART");
-                               if (!em_core_mime_get_header_value(tmp_body->part_header, CONTENT_BOUNDARY, err_code))  {
-                                       EM_DEBUG_EXCEPTION("em_core_mime_get_header_value failed.");
-                                       em_core_mime_free_part_body(tmp_body);
+                               if (!emcore_mime_get_header_value(tmp_body->part_header, CONTENT_BOUNDARY, err_code))  {
+                                       EM_DEBUG_EXCEPTION("emcore_mime_get_header_value failed.");
+                                       emcore_mime_free_part_body(tmp_body);
                                        EM_DEBUG_FUNC_END("false");
                                        return false;
                                }
                                
-                               em_core_mime_parse_part(stream, is_file, tmp_body->part_header, &tmp_body->nested, cnt_info, &end_of_parsing, &local_err_code);
+                               emcore_mime_parse_part(stream, is_file, tmp_body->part_header, &tmp_body->nested, cnt_info, &end_of_parsing, &local_err_code);
                                
                                if (!nested->body) 
                                        nested->body = tmp_body;
@@ -967,11 +965,11 @@ int em_core_mime_parse_part(void *stream, int is_file, struct _m_part_header *pa
                                        if (*p)
                                                p = &(*p)->next;
                                        
-                                       if (!(*p = em_core_malloc(sizeof(struct _m_part))))  {
-                                               EM_DEBUG_EXCEPTION("em_core_malloc failed");
-                                               if (nested->body) em_core_mime_free_part_body(nested->body);
-                                               if (nested->next) em_core_mime_free_part(nested->next);
-                                               em_core_mime_free_part_body(tmp_body);
+                                       if (!(*p = em_malloc(sizeof(struct _m_part))))  {
+                                               EM_DEBUG_EXCEPTION("em_malloc failed");
+                                               if (nested->body) emcore_mime_free_part_body(nested->body);
+                                               if (nested->next) emcore_mime_free_part(nested->next);
+                                               emcore_mime_free_part_body(tmp_body);
                                                EM_DEBUG_FUNC_END("false");
                                                return false;
                                        }
@@ -986,7 +984,7 @@ int em_core_mime_parse_part(void *stream, int is_file, struct _m_part_header *pa
                                if (end_of_parsing && local_err_code != EMF_ERROR_NO_MORE_DATA) /*  working with imap */
                                /* if (!end_of_parsing) */ /*  working with pop */ {
                                        EM_DEBUG_LOG("Enter flushing socket buffer.");
-                                       em_core_mime_flush_receiving_buffer(stream, is_file, boundary, boundary_end, &end_of_parsing, err_code);
+                                       emcore_mime_flush_receiving_buffer(stream, is_file, boundary, boundary_end, &end_of_parsing, err_code);
                                }
                                
                                break; 
@@ -999,52 +997,52 @@ int em_core_mime_parse_part(void *stream, int is_file, struct _m_part_header *pa
                                        is_skip = true;
                                
                                if (is_skip == true)  {
-                                       if (!em_core_mime_skip_content_data(stream, is_file, boundary_str, &end_of_parsing, &size, NULL, err_code)) 
-                                               EM_DEBUG_EXCEPTION("em_core_mime_skip_content_data failed...");
+                                       if (!emcore_mime_skip_content_data(stream, is_file, boundary_str, &end_of_parsing, &size, NULL, err_code)) 
+                                               EM_DEBUG_EXCEPTION("emcore_mime_skip_content_data failed...");
                                        
-                                       em_core_mime_free_part_body(tmp_body);
+                                       emcore_mime_free_part_body(tmp_body);
                                        EM_DEBUG_LOG_MIME("break");
                                        break;
                                }
                                
                                /*  first check inline content */
                                /*  if the content id or content location exis */
-                               attachment_name = em_core_mime_get_header_value(tmp_body->part_header, CONTENT_ID, err_code);
+                               attachment_name = emcore_mime_get_header_value(tmp_body->part_header, CONTENT_ID, err_code);
                                if (!attachment_name)
-                                       attachment_name = em_core_mime_get_header_value(tmp_body->part_header, CONTENT_LOCATION, err_code);
+                                       attachment_name = emcore_mime_get_header_value(tmp_body->part_header, CONTENT_LOCATION, err_code);
                                
                                if (!attachment_name)  {
                                        /*  check if the content is attachment */
                                        /*  if Content-Disposition Header exists, the content is attachment */
-                                       if (em_core_mime_get_header_value(tmp_body->part_header, CONTENT_DISPOSITION, err_code))  {
-                                               attachment_name = em_core_mime_get_header_value(tmp_body->part_header, CONTENT_FILENAME, err_code);
+                                       if (emcore_mime_get_header_value(tmp_body->part_header, CONTENT_DISPOSITION, err_code))  {
+                                               attachment_name = emcore_mime_get_header_value(tmp_body->part_header, CONTENT_FILENAME, err_code);
                                                EM_DEBUG_LOG_MIME(">> attachment = [%s]", attachment_name ? attachment_name  :  NIL);
                                        }
                                }
                                
-                               if (!em_core_check_thread_status())  {
+                               if (!emcore_check_thread_status())  {
                                        if (err_code != NULL)
                                                *err_code = EMF_ERROR_CANCELLED;
                                        EM_DEBUG_EXCEPTION("EMF_ERROR_CANCELLED");
                                        EM_DEBUG_FUNC_END("false");
                                        return false;
                                }
-                               /*  get content and content informatio */
+                               /*  get content and content information */
                                if (!attachment_name)  {        /*  text */
                                        /*  get content by buffe */
                                        EM_DEBUG_LOG_MIME("attachment_name is NULL. It's a text message"); 
-                                       em_core_mime_get_content_data(stream, is_file, true, boundary_str, content_encoding, &end_of_parsing, SAVE_TYPE_FILE, &holder, &size, NULL, err_code);
+                                       emcore_mime_get_content_data(stream, is_file, true, boundary_str, content_encoding, &end_of_parsing, SAVE_TYPE_FILE, &holder, &size, NULL, err_code);
 
-                                       EM_DEBUG_LOG("After em_core_mime_get_content_data");
+                                       EM_DEBUG_LOG("After emcore_mime_get_content_data");
                                        
                                        if (cnt_info->grab_type & GRAB_TYPE_TEXT)  {
-                                               if (tmp_body->part_header && strstr((t = em_core_mime_get_header_value(tmp_body->part_header, CONTENT_TYPE, err_code)) ? t  :  "", "HTML"))  {
+                                               if (tmp_body->part_header && strstr((t = emcore_mime_get_header_value(tmp_body->part_header, CONTENT_TYPE, err_code)) ? t  :  "", "HTML"))  {
                                                        cnt_info->text.html = holder;
                                                        
                                                        EM_DEBUG_LOG(" cnt_info->text.html [%s]", cnt_info->text.html);
                                                }
                                                else  {
-                                                       char *charset = em_core_mime_get_header_value(tmp_body->part_header, CONTENT_CHARSET, err_code);
+                                                       char *charset = emcore_mime_get_header_value(tmp_body->part_header, CONTENT_CHARSET, err_code);
                                                        EM_DEBUG_LOG(" charset [%s]", charset);
                                                        
                                                        if (!charset || !strncmp(charset, "X-UNKNOWN", strlen("X-UNKNOWN")))
@@ -1066,7 +1064,7 @@ int em_core_mime_parse_part(void *stream, int is_file, struct _m_part_header *pa
                                                }
                                        }
                                }
-                               else  {         /*  attachmen */
+                               else  {         /*  attachment */
                                        EM_DEBUG_LOG_MIME("attachment_name is not NULL. It's a attachment"); 
                                        struct attachment_info **file = &cnt_info->file;
                                        int i = 1;
@@ -1081,30 +1079,35 @@ int em_core_mime_parse_part(void *stream, int is_file, struct _m_part_header *pa
                                                i++;
                                        }
                                        
-                                       *file = em_core_malloc(sizeof(struct attachment_info));
+                                       *file = em_malloc(sizeof(struct attachment_info));
                                        if (*file)  {           
-                                               if ((em_core_mime_get_header_value(tmp_body->part_header, CONTENT_ID, err_code)) || 
-                                                       (em_core_mime_get_header_value(tmp_body->part_header, CONTENT_LOCATION, err_code)))  {  /*  this is inline conten */
+                                               if ((emcore_mime_get_header_value(tmp_body->part_header, CONTENT_ID, err_code)) || 
+                                                       (emcore_mime_get_header_value(tmp_body->part_header, CONTENT_LOCATION, err_code)))  {   /*  this is inline conten */
                                                        (*file)->type = 1;
                                                }
-                                               else  { /*  this is attachment conten */
+                                               else  { /*  this is attachment content */
                                                        (*file)->type = 2;
                                                }
-                                               EM_DEBUG_LOG_MIME("file->type  :  %d", (*file)->type); 
+
+                                               EM_DEBUG_LOG_MIME("file->type : %d", (*file)->type);
                                                
-                                               (*file)->name = cpystr(attachment_name);
+                                               (*file)->name                 = EM_SAFE_STRDUP(attachment_name);
+                                               if(tmp_body->part_header->type && tmp_body->part_header->subtype) {
+                                                       SNPRINTF(mime_type_buffer, 128, "%s/%s", tmp_body->part_header->type, tmp_body->part_header->subtype);
+                                                       (*file)->attachment_mime_type = EM_SAFE_STRDUP(mime_type_buffer);
+                                               }
                                                
                                                /*  check if the current file is target file */
-                                               if (cnt_info->grab_type & GRAB_TYPE_ATTACHMENT || (*file)->type == 1)  {
-                                                       /*  get content by fil */
+                                               if ( (cnt_info->grab_type & GRAB_TYPE_ATTACHMENT) || (*file)->type == 1)  {
+                                                       /*  get content by file */
                                                        EM_DEBUG_LOG_MIME("Trying to get content"); 
-                                                       em_core_mime_get_content_data(stream, is_file, false, boundary_str, content_encoding, &end_of_parsing, SAVE_TYPE_FILE, &holder, &size, NULL, err_code);
+                                                       emcore_mime_get_content_data(stream, is_file, false, boundary_str, content_encoding, &end_of_parsing, SAVE_TYPE_FILE, &holder, &size, NULL, err_code);
                                                        (*file)->save = holder;
                                                }
                                                else  {
-                                                       /*  only get content siz */
+                                                       /*  only get content size */
                                                        EM_DEBUG_LOG_MIME("Pass downloading"); 
-                                                       em_core_mime_get_content_data(stream, is_file, false, boundary_str, content_encoding, &end_of_parsing, SAVE_TYPE_SIZE, NULL, &size, NULL, err_code);
+                                                       emcore_mime_get_content_data(stream, is_file, false, boundary_str, content_encoding, &end_of_parsing, SAVE_TYPE_SIZE, NULL, &size, NULL, err_code);
                                                        (*file)->save = NULL;
                                                }
                                                
@@ -1125,14 +1128,14 @@ int em_core_mime_parse_part(void *stream, int is_file, struct _m_part_header *pa
                                                }
                                        }
                                        else  {
-                                               EM_DEBUG_EXCEPTION("em_core_malloc failed...");
-                                               em_core_mime_free_part_body(tmp_body);
+                                               EM_DEBUG_EXCEPTION("em_malloc failed...");
+                                               emcore_mime_free_part_body(tmp_body);
                                                EM_DEBUG_FUNC_END("false");
                                                return false;
                                        }
                                }
 
-                               if (!em_core_check_thread_status())  {
+                               if (!emcore_check_thread_status())  {
                        if (err_code != NULL)
                                *err_code = EMF_ERROR_CANCELLED;
                                        EM_DEBUG_EXCEPTION("EMF_ERROR_CANCELLED");
@@ -1151,12 +1154,12 @@ int em_core_mime_parse_part(void *stream, int is_file, struct _m_part_header *pa
                                        if (*p)
                                                p = &(*p)->next;
                                        
-                                       if (!(*p = em_core_malloc(sizeof(struct _m_part))))  {
-                                               EM_DEBUG_EXCEPTION("em_core_malloc failed");
-                                               if (nested->body) em_core_mime_free_part_body(nested->body);
-                                               if (nested->next) em_core_mime_free_part(nested->next);
+                                       if (!(*p = em_malloc(sizeof(struct _m_part))))  {
+                                               EM_DEBUG_EXCEPTION("em_malloc failed");
+                                               if (nested->body) emcore_mime_free_part_body(nested->body);
+                                               if (nested->next) emcore_mime_free_part(nested->next);
                                                
-                                               em_core_mime_free_part_body(tmp_body);
+                                               emcore_mime_free_part_body(tmp_body);
                                                EM_DEBUG_FUNC_END("false");
                                                return false;
                                        }
@@ -1181,7 +1184,7 @@ int em_core_mime_parse_part(void *stream, int is_file, struct _m_part_header *pa
 } 
 
 /*  set RFC822 Heade */
-int em_core_mime_set_rfc822_header_value(struct _rfc822header **header, char *name, char *value, int *err_code)
+int emcore_mime_set_rfc822_header_value(struct _rfc822header **header, char *name, char *value, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("header[%p], name[%s], value[%s], err_code[%p]", header, name, value, err_code);
        
@@ -1192,15 +1195,15 @@ int em_core_mime_set_rfc822_header_value(struct _rfc822header **header, char *na
        if (!value || !*value) return true;
 
        if (!*header)  {
-               *header = em_core_malloc(sizeof(struct _rfc822header));
+               *header = em_malloc(sizeof(struct _rfc822header));
                if (!*header)  {        
-                       EM_DEBUG_EXCEPTION("em_core_malloc failed");
+                       EM_DEBUG_EXCEPTION("em_malloc failed");
                        return false;
                }
        }
 
        if (name) {
-       em_core_mime_upper_str(name);
+       em_upper_string(name);
 
                if (strncmp(name, "RETURN-PATH", strlen("RETURN-PATH")) == 0)
                        p = &(*header)->return_path;/*  Return-Rat */
@@ -1249,7 +1252,7 @@ int em_core_mime_set_rfc822_header_value(struct _rfc822header **header, char *na
 }
 
 /*  set MIME Part Heade */
-int em_core_mime_set_part_header_value(struct _m_part_header **header, char *name, char *value, int *err_code)
+int emcore_mime_set_part_header_value(struct _m_part_header **header, char *name, char *value, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("header[%p], name[%s], value[%s], err_code[%p]", header, name, value, err_code);
        
@@ -1264,18 +1267,18 @@ int em_core_mime_set_part_header_value(struct _m_part_header **header, char *nam
        char *p_val = NULL;
        
        if (!*header)  {
-               *header = em_core_malloc(sizeof(struct _m_part_header));
+               *header = em_malloc(sizeof(struct _m_part_header));
                if (!(*header)) {       
-                       EM_DEBUG_EXCEPTION("em_core_malloc failed...");
+                       EM_DEBUG_EXCEPTION("em_malloc failed...");
                        return false;
                }
        }
        
-       em_core_mime_upper_str(name);
-       em_core_mime_trim_left(value);
-       em_core_mime_trim_right(value);
+       em_upper_string(name);
+       em_trim_left(value);
+       em_trim_right(value);
 
-       if (!em_core_check_thread_status())  {
+       if (!emcore_check_thread_status())  {
                if (err_code != NULL)
                        *err_code = EMF_ERROR_CANCELLED;
                return false;
@@ -1287,27 +1290,27 @@ int em_core_mime_set_part_header_value(struct _m_part_header **header, char *nam
                        
                        if (p_val)  {
                                if (!(*header)->type)  {   /*  Content-Type */
-                                       em_core_mime_upper_str(p_val);
+                                       em_upper_string(p_val);
                                        (*header)->type = EM_SAFE_STRDUP(p_val); 
                                } 
                                else  {   /*  Content-Type Parameter (format :  "name =value" */
-                                       if (em_core_mime_get_param_from_str(p_val, &p, err_code))       
-                                               em_core_mime_add_param_to_list(&((*header)->parameter), p, err_code);
+                                       if (emcore_mime_get_param_from_str(p_val, &p, err_code))        
+                                               emcore_mime_add_param_to_list(&((*header)->parameter), p, err_code);
                                }
                                
                                /*  repeatedly get paramete */
                                while ((p_val = strtok(NULL, ";")))  {
-                                       if (em_core_mime_get_param_from_str(p_val, &p, err_code))       
-                                               em_core_mime_add_param_to_list(&((*header)->parameter), p, err_code);
+                                       if (emcore_mime_get_param_from_str(p_val, &p, err_code))        
+                                               emcore_mime_add_param_to_list(&((*header)->parameter), p, err_code);
                                }
                        }
                }
                else if (strncmp(name, "CONTENT-TRANSFER-ENCODING", strlen("CONTENT-TRANSFER-ENCODING")) == 0)  {
-                       em_core_mime_upper_str(value);
+                       em_upper_string(value);
                        (*header)->encoding = EM_SAFE_STRDUP(value);
                } 
                else if (strncmp(name, "CONTENT-DESCRPTION", strlen("CONTENT-DESCRPTION")) == 0)  {
-                       em_core_mime_upper_str(value);
+                       em_upper_string(value);
                        (*header)->desc = EM_SAFE_STRDUP(value);
                } 
                else if (strncmp(name, "CONTENT-DISPOSITION", strlen("CONTENT-DISPOSITION")) == 0)  {
@@ -1315,25 +1318,25 @@ int em_core_mime_set_part_header_value(struct _m_part_header **header, char *nam
                        
                        if (p_val)  {
                                if (!(*header)->disp_type)  {   /*  Content-Dispositio */
-                                       em_core_mime_upper_str(p_val);
+                                       em_upper_string(p_val);
                                        (*header)->disp_type = EM_SAFE_STRDUP(p_val); 
                                } 
                                else  { /*  Content-Disposition parameter (format :  "name =value" */
-                                       if (em_core_mime_get_param_from_str(p_val, &p, err_code))       
-                                               em_core_mime_add_param_to_list(&((*header)->disp_parameter), p, err_code);
+                                       if (emcore_mime_get_param_from_str(p_val, &p, err_code))        
+                                               emcore_mime_add_param_to_list(&((*header)->disp_parameter), p, err_code);
                                }
                                
                                /*  repeatedly get paramete */
                                while ((p_val = strtok(NULL, ";")))  {
-                                       if (em_core_mime_get_param_from_str(p_val, &p, err_code))       
-                                               em_core_mime_add_param_to_list(&((*header)->disp_parameter), p, err_code);
+                                       if (emcore_mime_get_param_from_str(p_val, &p, err_code))        
+                                               emcore_mime_add_param_to_list(&((*header)->disp_parameter), p, err_code);
                                }
                        } 
                } 
                else if (strncmp(name, "CONTENT-ID", strlen("CONTENT-ID")) == 0)  {
                        size_t len = 0;
                        len = strlen(value);
-                       /* em_core_mime_upper_str(value) */
+                       /* em_upper_string(value) */
                        
                        if ((len) && (value[0] == '<'))  {
                                ++value;
@@ -1353,7 +1356,7 @@ int em_core_mime_set_part_header_value(struct _m_part_header **header, char *nam
 }
  
 /*  get header parameter from strin */
-int em_core_mime_get_param_from_str(char *str, struct _parameter **param, int *err_code)
+int emcore_mime_get_param_from_str(char *str, struct _parameter **param, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("str[%s], param[%p], err_code[%p]", str, param, err_code);
        
@@ -1369,24 +1372,24 @@ int em_core_mime_get_param_from_str(char *str, struct _parameter **param, int *e
        p_name = str;
        p_val = p+1;
 
-       em_core_mime_trim_left(p_name);
-       em_core_mime_trim_right(p_name);
+       em_trim_left(p_name);
+       em_trim_right(p_name);
        
        if (!*p_name) return false;
 
-       em_core_mime_trim_left(p_val);
-       em_core_mime_trim_right(p_val);
+       em_trim_left(p_val);
+       em_trim_right(p_val);
        
        if (!*p_val) return false;
 
-       if (!(*param = em_core_malloc(sizeof(struct _parameter)))) return false;
+       if (!(*param = em_malloc(sizeof(struct _parameter)))) return false;
        
        (*param)->next = NULL;
 
        /*  Name se */
        /*  check string lengt */
        if (strlen(p_name) > 0)  {
-               em_core_mime_upper_str(p_name);
+               em_upper_string(p_name);
                (*param)->name = EM_SAFE_STRDUP(p_name);
        }
 
@@ -1399,14 +1402,14 @@ int em_core_mime_get_param_from_str(char *str, struct _parameter **param, int *e
                        *p = '\0';
                
                if (strncmp(p_name, "BOUNDARY", strlen("BOUNDARY")) != 0 && !strstr(p_name, "NAME"))
-                       em_core_mime_upper_str(p_val);
+                       em_upper_string(p_val);
                
                /*  = ? ENCODING_TYPE ? B(Q) ? ENCODED_STRING ? */
                int err = EMF_ERROR_NONE;
                char *utf8_text = NULL;
                
-               if (!(utf8_text = em_core_decode_rfc2047_text(p_val, &err))) 
-                       EM_DEBUG_EXCEPTION("em_core_decode_rfc2047_text failed [%d]", err);
+               if (!(utf8_text = emcore_decode_rfc2047_text(p_val, &err))) 
+                       EM_DEBUG_EXCEPTION("emcore_decode_rfc2047_text failed [%d]", err);
                (*param)->value = utf8_text;
        }
        EM_DEBUG_FUNC_END();
@@ -1414,7 +1417,7 @@ int em_core_mime_get_param_from_str(char *str, struct _parameter **param, int *e
 }
 
 /*  add a parameter to parameter lis */
-int em_core_mime_add_param_to_list(struct _parameter **param_list, struct _parameter *param, int *err_code)
+int emcore_mime_add_param_to_list(struct _parameter **param_list, struct _parameter *param, int *err_code)
 {
        struct _parameter **t = param_list;
        
@@ -1430,7 +1433,7 @@ int em_core_mime_add_param_to_list(struct _parameter **param_list, struct _param
 }
 
 /*  get header value from MIME Part Heade */
-char *em_core_mime_get_header_value(struct _m_part_header *header, int type, int *err_code)
+char *emcore_mime_get_header_value(struct _m_part_header *header, int type, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("header[%p], type[%d], err_code[%p]", header, type, err_code);
        
@@ -1508,7 +1511,7 @@ char *em_core_mime_get_header_value(struct _m_part_header *header, int type, int
  * decode body text (quoted-printable, base64) 
  * enc_type : encoding type (base64/quotedprintable)
  */
-EXPORT_API int em_core_decode_body_text(char *enc_buf, int enc_len, int enc_type, int *dec_len, int *err_code)
+INTERNAL_FUNC int emcore_decode_body_text(char *enc_buf, int enc_len, int enc_type, int *dec_len, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("enc_buf[%p], enc_len[%d], enc_type[%d], dec_len[%p]", enc_buf, enc_len, enc_type, dec_len);
        unsigned char *content = NULL;
@@ -1555,7 +1558,7 @@ EXPORT_API int em_core_decode_body_text(char *enc_buf, int enc_len, int enc_type
 /*  mode - SAVE_TYPE_SIZE   :  no saving (only hold content size */
 /*         SAVE_TYPE_BUFFER :  content is saved to buffer (holder is buffer */
 /*         SAVE_TYPE_FILE   :  content is saved to temporary file (holder is file name */
-int em_core_mime_get_content_data(void *stream, int is_file, int is_text, char *boundary_str, char *content_encoding, int *end_of_parsing, int mode, char **holder, int *size, void *callback, int *err_code) 
+int emcore_mime_get_content_data(void *stream, int is_file, int is_text, char *boundary_str, char *content_encoding, int *end_of_parsing, int mode, char **holder, int *size, void *callback, int *err_code) 
 { 
        EM_DEBUG_FUNC_BEGIN("stream[%p], is_file[%d], boundary_str[%s], content_encoding[%s], end_of_parsing[%p], mode[%d], holder[%p], size[%p], callback[%p], err_code[%p]", stream, is_file, boundary_str, content_encoding, end_of_parsing, mode, holder, size, callback, err_code);
        
@@ -1594,6 +1597,8 @@ int em_core_mime_get_content_data(void *stream, int is_file, int is_text, char *
                                        encoding = ENCBINARY;
                                        break; /*  binar */
                                }
+                               encoding = ENC7BIT;
+                               break;
                        case '7': 
                                encoding = ENC7BIT;
                                break; /*  7bi */
@@ -1608,7 +1613,7 @@ int em_core_mime_get_content_data(void *stream, int is_file, int is_text, char *
 
        /*  saving type is file */
        if (mode == SAVE_TYPE_FILE)  {
-               *holder = em_core_mime_get_save_file_name(err_code);
+               *holder = emcore_mime_get_save_file_name(err_code);
                
                EM_DEBUG_LOG("holder[%s]", *holder);
                
@@ -1629,18 +1634,18 @@ int em_core_mime_get_content_data(void *stream, int is_file, int is_text, char *
        }
        
                while (TRUE)  {
-                       if (!em_core_check_thread_status())  {
+                       if (!emcore_check_thread_status())  {
                        EM_DEBUG_EXCEPTION("EMF_ERROR_CANCELLED");
                        error = EMF_ERROR_CANCELLED;
                        goto FINISH_OFF;
                        }
        
-               if ((is_file == 0 && !em_core_mime_get_line_from_sock(stream, buf, MIME_LINE_LEN, &error)) || 
-               (is_file == 1 && !em_core_mime_get_line_from_file(stream, buf, MIME_LINE_LEN, &error)))  {
+               if ((is_file == 0 && !emcore_mime_get_line_from_sock(stream, buf, MIME_LINE_LEN, &error)) || 
+               (is_file == 1 && !emcore_get_line_from_file(stream, buf, MIME_LINE_LEN, &error)))  {
                        if (error == EMF_ERROR_NO_MORE_DATA)
                                EM_DEBUG_EXCEPTION("End of data");
                        else
-                               EM_DEBUG_EXCEPTION("em_core_mime_get_line_from_sock failed");
+                               EM_DEBUG_EXCEPTION("emcore_mime_get_line_from_sock failed");
                                *end_of_parsing = 1;
                                
                        ret = true;
@@ -1678,10 +1683,10 @@ int em_core_mime_get_content_data(void *stream, int is_file, int is_text, char *
                        dec_len = strlen(buf);
                        
                if (mode > SAVE_TYPE_SIZE) {    /*  decode conten */
-                       em_core_decode_body_text(buf, dec_len, encoding, &dec_len, err_code);
+                       emcore_decode_body_text(buf, dec_len, encoding, &dec_len, err_code);
 
                        if (is_text) {
-                               result_buffer = em_core_replace_string(buf, "cid:", "");
+                               result_buffer = em_replace_string(buf, "cid:", "");
                                if (result_buffer)
                                        result_buffer_size = strlen(result_buffer);
                        }
@@ -1742,7 +1747,7 @@ FINISH_OFF:
        return ret; 
 } 
 
-int em_core_mime_skip_content_data(void *stream, 
+int emcore_mime_skip_content_data(void *stream, 
                                                        int is_file, 
                                                        char *boundary_str, 
                                                        int *end_of_parsing, 
@@ -1763,13 +1768,13 @@ int em_core_mime_skip_content_data(void *stream,
        if (!boundary_str)  {   /*  if no boundary, this content is from current line to end of all multipart */
                while (TRUE)  {
                        
-                       if (!em_core_check_thread_status())  {
+                       if (!emcore_check_thread_status())  {
                                if (err_code != NULL)
                                        *err_code = EMF_ERROR_CANCELLED;
                                return false;
                        }
-                       if ((is_file == 0 && !em_core_mime_get_line_from_sock(stream, buf, MIME_LINE_LEN, err_code)) || 
-                       (is_file == 1 && !em_core_mime_get_line_from_file(stream, buf, MIME_LINE_LEN, err_code)))  {
+                       if ((is_file == 0 && !emcore_mime_get_line_from_sock(stream, buf, MIME_LINE_LEN, err_code)) || 
+                       (is_file == 1 && !emcore_get_line_from_file(stream, buf, MIME_LINE_LEN, err_code)))  {
                                *end_of_parsing = 1; 
                                if (size) 
                                        *size = sz;
@@ -1787,13 +1792,13 @@ int em_core_mime_skip_content_data(void *stream,
                
                while (TRUE)  {
 
-                       if (!em_core_check_thread_status())  {
+                       if (!emcore_check_thread_status())  {
                                if (err_code != NULL)
                                        *err_code = EMF_ERROR_CANCELLED;
                                return false;
                        }
-                       if ((is_file == 0 && !em_core_mime_get_line_from_sock(stream, buf, MIME_LINE_LEN, err_code)) || 
-                       (is_file == 1 && !em_core_mime_get_line_from_file(stream, buf, MIME_LINE_LEN, err_code)))  {
+                       if ((is_file == 0 && !emcore_mime_get_line_from_sock(stream, buf, MIME_LINE_LEN, err_code)) || 
+                       (is_file == 1 && !emcore_get_line_from_file(stream, buf, MIME_LINE_LEN, err_code)))  {
                                /*  end of fil */
                                *end_of_parsing = 1; 
                                if (size) 
@@ -1825,7 +1830,7 @@ int em_core_mime_skip_content_data(void *stream,
 } 
 
 /*  get temporary file nam */
-char *em_core_mime_get_save_file_name(int *err_code) 
+char *emcore_mime_get_save_file_name(int *err_code) 
 { 
        EM_DEBUG_FUNC_BEGIN();
        char tempname[512];
@@ -1842,7 +1847,7 @@ char *em_core_mime_get_save_file_name(int *err_code)
 } 
 
 /*  get a line from file pointer */
-char *em_core_mime_get_line_from_file(void *stream, char *buf, int size, int *err_code)
+char *emcore_get_line_from_file(void *stream, char *buf, int size, int *err_code)
 {
        if (!fgets(buf, size, (FILE *)stream))  {
                if (feof((FILE *)stream))
@@ -1854,8 +1859,8 @@ char *em_core_mime_get_line_from_file(void *stream, char *buf, int size, int *er
 }
 
 /*  get a line from POP3 mail stream */
-/*  em_core_mail_cmd_read_mail_pop3 must be called before this function */
-char *em_core_mime_get_line_from_sock(void *stream, char *buf, int size, int *err_code)
+/*  emcore_mail_cmd_read_mail_pop3 must be called before this function */
+char *emcore_mime_get_line_from_sock(void *stream, char *buf, int size, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("stream[%p], buf[%p]", stream, buf);
        POP3LOCAL *p_pop3local = NULL;
@@ -1929,8 +1934,8 @@ FINISH_OFF:
                EM_DEBUG_LOG("received_percentage = %d, last_notified_percentage = %d", received_percentage, last_notified_percentage);
                
                if (received_percentage > last_notified_percentage + 5) {
-                       if (!em_storage_notify_network_event(NOTI_DOWNLOAD_BODY_START, _pop3_receiving_mail_id, "dummy-file", _pop3_total_body_size, _pop3_received_body_size))
-                               EM_DEBUG_EXCEPTION(" em_storage_notify_network_event [NOTI_DOWNLOAD_BODY_START] Failed >>>> ");
+                       if (!emstorage_notify_network_event(NOTI_DOWNLOAD_BODY_START, _pop3_receiving_mail_id, "dummy-file", _pop3_total_body_size, _pop3_received_body_size))
+                               EM_DEBUG_EXCEPTION(" emstorage_notify_network_event [NOTI_DOWNLOAD_BODY_START] Failed >>>> ");
                        else
                                EM_DEBUG_LOG("NOTI_DOWNLOAD_BODY_START notified (%d / %d)", _pop3_received_body_size, _pop3_total_body_size);
                        _pop3_last_notified_body_size = _pop3_received_body_size;
@@ -1940,7 +1945,7 @@ FINISH_OFF:
        return buf;
 }
 
-void em_core_mime_free_param(struct _parameter *param)
+void emcore_mime_free_param(struct _parameter *param)
 {
        struct _parameter *t, *p = param;
        EM_DEBUG_FUNC_BEGIN();
@@ -1954,32 +1959,32 @@ void em_core_mime_free_param(struct _parameter *param)
        EM_DEBUG_FUNC_END();
 }
 
-void em_core_mime_free_part_header(struct _m_part_header *header)
+void emcore_mime_free_part_header(struct _m_part_header *header)
 {
        EM_DEBUG_FUNC_BEGIN();
        if (!header) return ;
        EM_SAFE_FREE(header->type);
-       if (header->parameter) em_core_mime_free_param(header->parameter);
+       if (header->parameter) emcore_mime_free_param(header->parameter);
        EM_SAFE_FREE(header->subtype);
        EM_SAFE_FREE(header->encoding);
        EM_SAFE_FREE(header->desc);
        EM_SAFE_FREE(header->disp_type);
-       if (header->disp_parameter) em_core_mime_free_param(header->disp_parameter);
+       if (header->disp_parameter) emcore_mime_free_param(header->disp_parameter);
        free(header); header = NULL;
        EM_DEBUG_FUNC_END();
 }
 
-void em_core_mime_free_message_header(struct _m_mesg_header *header)
+void emcore_mime_free_message_header(struct _m_mesg_header *header)
 {
        EM_DEBUG_FUNC_BEGIN();
        if (!header) return ;
        EM_SAFE_FREE(header->version);
-       if (header->part_header) em_core_mime_free_part_header(header->part_header);
+       if (header->part_header) emcore_mime_free_part_header(header->part_header);
        free(header); header = NULL;
        EM_DEBUG_FUNC_END();
 }
 
-void em_core_mime_free_rfc822_header(struct _rfc822header *header)
+void emcore_mime_free_rfc822_header(struct _rfc822header *header)
 {
        EM_DEBUG_FUNC_BEGIN();
        if (!header) return ;
@@ -1997,43 +2002,43 @@ void em_core_mime_free_rfc822_header(struct _rfc822header *header)
        EM_DEBUG_FUNC_END();
 }
 
-void em_core_mime_free_part_body(struct _m_body *body)
+void emcore_mime_free_part_body(struct _m_body *body)
 {
        EM_DEBUG_FUNC_BEGIN();
        if (!body) return ;
-       if (body->part_header) em_core_mime_free_part_header(body->part_header);
+       if (body->part_header) emcore_mime_free_part_header(body->part_header);
        EM_SAFE_FREE(body->text);
-       if (body->nested.body) em_core_mime_free_part_body(body->nested.body);
-       if (body->nested.next) em_core_mime_free_part(body->nested.next);
+       if (body->nested.body) emcore_mime_free_part_body(body->nested.body);
+       if (body->nested.next) emcore_mime_free_part(body->nested.next);
        free(body); body = NULL;
        EM_DEBUG_FUNC_END();
 }
 
-void em_core_mime_free_part(struct _m_part *part)
+void emcore_mime_free_part(struct _m_part *part)
 {
        EM_DEBUG_FUNC_BEGIN();
        if (!part) return ;
-       if (part->body) em_core_mime_free_part_body(part->body);
-       if (part->next) em_core_mime_free_part(part->next);
+       if (part->body) emcore_mime_free_part_body(part->body);
+       if (part->next) emcore_mime_free_part(part->next);
        free(part);part = NULL;
        EM_DEBUG_FUNC_END();
 }
 
-void em_core_mime_free_mime(struct _m_mesg *mmsg)
+void emcore_mime_free_mime(struct _m_mesg *mmsg)
 {
        EM_DEBUG_FUNC_BEGIN();
        
        if (!mmsg) return ;
-       if (mmsg->header) em_core_mime_free_message_header(mmsg->header);
-       if (mmsg->rfc822header) em_core_mime_free_rfc822_header(mmsg->rfc822header);
-       if (mmsg->nested.body) em_core_mime_free_part_body(mmsg->nested.body);
-       if (mmsg->nested.next) em_core_mime_free_part(mmsg->nested.next);
+       if (mmsg->header) emcore_mime_free_message_header(mmsg->header);
+       if (mmsg->rfc822header) emcore_mime_free_rfc822_header(mmsg->rfc822header);
+       if (mmsg->nested.body) emcore_mime_free_part_body(mmsg->nested.body);
+       if (mmsg->nested.next) emcore_mime_free_part(mmsg->nested.next);
        EM_SAFE_FREE(mmsg->text);
        free(mmsg); mmsg = NULL;
        EM_DEBUG_FUNC_END();
 }
 
-void em_core_mime_free_content_info(struct _m_content_info *cnt_info)
+void emcore_free_content_info(struct _m_content_info *cnt_info)
 {
        EM_DEBUG_FUNC_BEGIN();
        struct attachment_info *p;
@@ -2046,6 +2051,7 @@ void em_core_mime_free_content_info(struct _m_content_info *cnt_info)
                p = cnt_info->file->next;
                EM_SAFE_FREE(cnt_info->file->name);
                EM_SAFE_FREE(cnt_info->file->save);
+               EM_SAFE_FREE(cnt_info->file->attachment_mime_type);
                free(cnt_info->file); cnt_info->file = NULL;
                cnt_info->file = p;
        }
@@ -2053,67 +2059,15 @@ void em_core_mime_free_content_info(struct _m_content_info *cnt_info)
        EM_DEBUG_FUNC_END();
 }
 
-/*  remove left space, tab, CR, L */
-char *em_core_mime_trim_left(char *str)
-{
-       char *p, *temp_buffer = NULL;
-
-       /* EM_DEBUG_FUNC_BEGIN() */
-       if (!str) return NULL;
-
-       p = str;
-       while (*p && (*p == ' ' || *p == '\t' || *p == LF || *p == CR)) p++;
-       
-       if (!*p) return NULL;
-
-       temp_buffer = EM_SAFE_STRDUP(p);
-       
-       strncpy(str, temp_buffer, strlen(str)); 
-       str[strlen(temp_buffer)] = NULL_CHAR;
-
-       EM_SAFE_FREE(temp_buffer);
-
-       return str;
-}
-
-/*  remove right space, tab, CR, L */
-char *em_core_mime_trim_right(char *str) 
-{
-       char *p;
-
-       /* EM_DEBUG_FUNC_BEGIN() */
-       if (!str) return NULL;
-
-       p = str+strlen(str)-1;
-       while (((int)p >= (int)str) && (*p == ' ' || *p == '\t' || *p == LF || *p == CR))
-               *p --= '\0';
-
-       if ((int) p < (int)str)
-               return NULL;
-       
-       return str;
-}
-
-char *em_core_mime_upper_str(char *str) 
-{
-       char *p = str;
-       while (*p)  {
-               *p = toupper(*p);
-               p++;
-       }
-       return str;
-}
-
-
 /* get body-part in nested part */
-static PARTLIST *em_core_get_allnested_part_full(MAILSTREAM *stream, int msg_uid, BODY *body, struct _m_content_info *cnt_info, int *err_code, PARTLIST *section_list)
+static PARTLIST *emcore_get_allnested_part_full(MAILSTREAM *stream, int msg_uid, BODY *body, struct _m_content_info *cnt_info, int *err_code, PARTLIST *section_list)
 {
        EM_DEBUG_FUNC_BEGIN("stream[%p], msg_uid[%d], body[%p], cnt_info[%p], err_code[%p]", stream, msg_uid, body, cnt_info, err_code);
        
        PART *part_child = body->nested.part;
        
        while (part_child) {
-               section_list = em_core_get_body_full(stream, msg_uid, &part_child->body, cnt_info, err_code, section_list);             
+               section_list = emcore_get_body_full(stream, msg_uid, &part_child->body, cnt_info, err_code, section_list);              
                part_child = part_child->next;
        }
 
@@ -2121,7 +2075,7 @@ static PARTLIST *em_core_get_allnested_part_full(MAILSTREAM *stream, int msg_uid
 }
 
 /* get body-part in alternative multiple part */
-static PARTLIST *em_core_get_alternative_multi_part_full(MAILSTREAM *stream, int msg_uid, BODY *body, struct _m_content_info *cnt_info, int *err_code, PARTLIST *section_list)
+static PARTLIST *emcore_get_alternative_multi_part_full(MAILSTREAM *stream, int msg_uid, BODY *body, struct _m_content_info *cnt_info, int *err_code, PARTLIST *section_list)
 {
        EM_DEBUG_FUNC_BEGIN("stream[%p], msg_uid[%d], body[%p], cnt_info[%p], err_code[%p]", stream, msg_uid, body, cnt_info, err_code);
        
@@ -2129,7 +2083,7 @@ static PARTLIST *em_core_get_alternative_multi_part_full(MAILSTREAM *stream, int
 
        /* find the best sub part we can show */
        while (part_child)  {
-               section_list = em_core_get_body_full(stream, msg_uid, &part_child->body, cnt_info, err_code, section_list);             
+               section_list = emcore_get_body_full(stream, msg_uid, &part_child->body, cnt_info, err_code, section_list);              
                part_child = part_child->next;
        }
        
@@ -2137,18 +2091,23 @@ static PARTLIST *em_core_get_alternative_multi_part_full(MAILSTREAM *stream, int
 }
 
 /* get body part in signed multiple part */
-static PARTLIST *em_core_get_signed_multi_part_full(MAILSTREAM *stream, int msg_uid, BODY *body, struct _m_content_info *cnt_info, int *err_code, PARTLIST *section_list)
+static PARTLIST *emcore_get_signed_multi_part_full(MAILSTREAM *stream, int msg_uid, BODY *body, struct _m_content_info *cnt_info, int *err_code, PARTLIST *section_list)
 {
-       EM_DEBUG_FUNC_BEGIN();
-       
-       EM_DEBUG_LOG("stream[%p], msg_uid[%d], body[%p], cnt_info[%p], err_code[%p]", stream, msg_uid, body, cnt_info, err_code);
+       EM_DEBUG_FUNC_BEGIN("stream[%p], msg_uid[%d], body[%p], cnt_info[%p], err_code[%p]", stream, msg_uid, body, cnt_info, err_code);
+
+       PART *part_child = body->nested.part;
+
+       /* find the best sub part we can show */
+       while (part_child)  {
+               section_list = emcore_get_body_full(stream, msg_uid, &part_child->body, cnt_info, err_code, section_list);              
+               part_child = part_child->next;
+       }
        
-       /*  "protocol"= "application/pgp-signature */
        return section_list;
 }
 
 /* get body part in encrypted multiple part */
-static PARTLIST *em_core_get_encrypted_multi_part_full(MAILSTREAM *stream, int msg_uid, BODY *body, struct _m_content_info *cnt_info, int *err_code, PARTLIST *section_list)
+static PARTLIST *emcore_get_encrypted_multi_part_full(MAILSTREAM *stream, int msg_uid, BODY *body, struct _m_content_info *cnt_info, int *err_code, PARTLIST *section_list)
 {
        EM_DEBUG_FUNC_BEGIN("stream[%p], msg_uid[%d], body[%p], cnt_info[%p], err_code[%p]", stream, msg_uid, body, cnt_info, err_code);
        
@@ -2157,30 +2116,30 @@ static PARTLIST *em_core_get_encrypted_multi_part_full(MAILSTREAM *stream, int m
 }
 
 /* get body part in multiple part */
-static PARTLIST *em_core_get_multi_part_full(MAILSTREAM *stream, int msg_uid, BODY *body, struct _m_content_info *cnt_info, int *err_code, PARTLIST *section_list)
+static PARTLIST *emcore_get_multi_part_full(MAILSTREAM *stream, int msg_uid, BODY *body, struct _m_content_info *cnt_info, int *err_code, PARTLIST *section_list)
 {
        EM_DEBUG_FUNC_BEGIN("stream[%p], msg_uid[%d], body[%p], cnt_info[%p], err_code[%p]", stream, msg_uid, body, cnt_info, err_code);
        
        switch (body->subtype[0])  {
                case 'A':               /*  ALTERNATIV */
-                       return section_list = em_core_get_alternative_multi_part_full(stream, msg_uid, body, cnt_info, err_code, section_list);
+                       return section_list = emcore_get_alternative_multi_part_full(stream, msg_uid, body, cnt_info, err_code, section_list);
                
                case 'S':               /*  SIGNE */
-                       return section_list = em_core_get_signed_multi_part_full(stream, msg_uid, body, cnt_info, err_code, section_list);
+                       return section_list = emcore_get_signed_multi_part_full(stream, msg_uid, body, cnt_info, err_code, section_list);
                
                case 'E':               /*  ENCRYPTE */
-                       return section_list = em_core_get_encrypted_multi_part_full(stream, msg_uid, body, cnt_info, err_code, section_list);
+                       return section_list = emcore_get_encrypted_multi_part_full(stream, msg_uid, body, cnt_info, err_code, section_list);
                
                default:                /*  process all unknown as MIXED (according to the RFC 2047 */
-                       return section_list = em_core_get_allnested_part_full(stream, msg_uid, body, cnt_info, err_code, section_list);
+                       return section_list = emcore_get_allnested_part_full(stream, msg_uid, body, cnt_info, err_code, section_list);
        }
 }
 
 
-PARTLIST *
-em_core_get_body_full(MAILSTREAM *stream, int msg_uid, BODY *body, struct _m_content_info *cnt_info, int *err_code, PARTLIST *section_list)
+PARTLIST* emcore_get_body_full(MAILSTREAM *stream, int msg_uid, BODY *body, struct _m_content_info *cnt_info, int *err_code, PARTLIST *section_list)
 {
        EM_DEBUG_FUNC_BEGIN("stream[%p], msg_uid[%d], body[%p], cnt_info[%p], err_code[%p]", stream, msg_uid, body, cnt_info, err_code);
+       char content_type_buffer[512] = { 0, };
        
        if (!stream || !body || !cnt_info)  {
                EM_DEBUG_EXCEPTION("stream[%p], msg_uid[%d], body[%p], cnt_info[%p]", stream, msg_uid, body, cnt_info);
@@ -2192,7 +2151,7 @@ em_core_get_body_full(MAILSTREAM *stream, int msg_uid, BODY *body, struct _m_con
        
        switch (body->type)  {
                case TYPEMULTIPART: 
-                       return section_list = em_core_get_multi_part_full(stream, msg_uid, body, cnt_info, err_code, section_list);
+                       return section_list = emcore_get_multi_part_full(stream, msg_uid, body, cnt_info, err_code, section_list);
                
                case TYPEMESSAGE:
                        break;
@@ -2214,8 +2173,8 @@ em_core_get_body_full(MAILSTREAM *stream, int msg_uid, BODY *body, struct _m_con
                                struct attachment_info *next_ai = NULL;
                                int i = 0;
                                
-                               if (em_core_get_file_pointer(body, filename, cnt_info , (int  *)NULL) < 0)
-                                       EM_DEBUG_EXCEPTION("em_core_get_file_pointer failed");
+                               if (emcore_get_file_pointer(body, filename, cnt_info , (int  *)NULL) < 0)
+                                       EM_DEBUG_EXCEPTION("emcore_get_file_pointer failed");
                                else {
                                        /* To form list of attachment info - Attachment list followed by inline attachment list */
                                        prev_ai = NULL;
@@ -2245,22 +2204,23 @@ em_core_get_body_full(MAILSTREAM *stream, int msg_uid, BODY *body, struct _m_con
                                                        }
                                                }
                                        }
-                                       if (!(*ai = em_core_malloc(sizeof(struct attachment_info))))  {
-                                               EM_DEBUG_EXCEPTION("em_core_malloc failed...");
+                                       if (!(*ai = em_malloc(sizeof(struct attachment_info))))  {
+                                               EM_DEBUG_EXCEPTION("em_malloc failed...");
                                        }
                                        else {
                                                if (ai == NULL) {
                                                        cnt_info->file = (*ai);
                                                }
-                                               
-                                               memset((*ai), 0x00, sizeof(struct attachment_info));
+
                                                if ((body->id) || (body->location) || ((body->disposition.type != NULL) && ((body->disposition.type[0] == 'i') || (body->disposition.type[0] == 'I'))))
                                                        (*ai)->type = 1;
                                                else
                                                        (*ai)->type = 2;
                                                
-                                               (*ai)->name = EM_SAFE_STRDUP(filename);
-                                               (*ai)->size = body->size.bytes;
+                                               (*ai)->name                 = EM_SAFE_STRDUP(filename);
+                                               (*ai)->size                 = body->size.bytes;
+                                               if ( emcore_get_content_type_from_mail_bodystruct(body, 512, content_type_buffer) == EMF_ERROR_NONE)
+                                                       (*ai)->attachment_mime_type = EM_SAFE_STRDUP(content_type_buffer);
                                                
 #ifdef __ATTACHMENT_OPTI__
                                                (*ai)->encoding = body->encoding;
@@ -2320,7 +2280,7 @@ em_core_get_body_full(MAILSTREAM *stream, int msg_uid, BODY *body, struct _m_con
                                                param = param->next;
                                        }
                                        if ((fn != NULL)&& (!strcmp(fn, cnt_info->file->name)) && (body->size.bytes == cnt_info->file->size)) /*  checks to zero in on particular attachmen */ {
-                                               section_list = em_core_add_node(section_list, body);
+                                               section_list = emcore_add_node(section_list, body);
                                                if (section_list == NULL) {
                                                        EM_DEBUG_EXCEPTION("adding  node to section list failed");
                                                        EM_SAFE_FREE(fn);       
@@ -2337,7 +2297,7 @@ em_core_get_body_full(MAILSTREAM *stream, int msg_uid, BODY *body, struct _m_con
                        else {
                                /* get a section list which has only plain, html and inline */
                                if (!((body->disposition.type != NULL) && ((body->disposition.type[0] == 'a') || (body->disposition.type[0] == 'A'))))/*  if the body not an attachmen */ {
-                                       section_list = em_core_add_node(section_list, body);
+                                       section_list = emcore_add_node(section_list, body);
                                        if (section_list == NULL) {
                                                EM_DEBUG_EXCEPTION("adding  node to section list failed");      
                                                return NULL;
@@ -2354,7 +2314,7 @@ em_core_get_body_full(MAILSTREAM *stream, int msg_uid, BODY *body, struct _m_con
        return section_list;
 }
 
-EXPORT_API int em_core_get_body_part_list_full(MAILSTREAM *stream, int msg_uid, int account_id, int mail_id, BODY *body, struct _m_content_info *cnt_info, int *err_code, PARTLIST *section_list, int event_handle)
+INTERNAL_FUNC int emcore_get_body_part_list_full(MAILSTREAM *stream, int msg_uid, int account_id, int mail_id, BODY *body, struct _m_content_info *cnt_info, int *err_code, PARTLIST *section_list, int event_handle)
 {
        EM_DEBUG_FUNC_BEGIN("stream[%p], msg_uid[%d], body[%p], cnt_info[%p], err_code[%p]", stream, msg_uid, body, cnt_info, err_code);
        
@@ -2365,21 +2325,24 @@ EXPORT_API int em_core_get_body_part_list_full(MAILSTREAM *stream, int msg_uid,
                        *err_code = EMF_ERROR_INVALID_PARAM;
                return FAILURE;
        }
-       section_list = em_core_get_body_full(stream, msg_uid, body, cnt_info, err_code, section_list); 
-       if (section_list == NULL) /*  assumed at least one body part exist */ {
-               EM_DEBUG_EXCEPTION("em_core_get_body_full failed");
+       section_list = emcore_get_body_full(stream, msg_uid, body, cnt_info, err_code, section_list); 
+
+       if (section_list == NULL) {
+               /*  assumed at least one body part exist */
+               EM_DEBUG_EXCEPTION("emcore_get_body_full failed");
                return FAILURE;
        }
-       if (em_core_get_body_part_imap_full(stream, msg_uid, account_id, mail_id, section_list, cnt_info, err_code, event_handle)<0) {
-               EM_DEBUG_EXCEPTION("em_core_get_body_part_imap_full failed");
-               em_core_free_section_list(section_list);
+
+       if (emcore_get_body_part_imap_full(stream, msg_uid, account_id, mail_id, section_list, cnt_info, err_code, event_handle) < 0) {
+               EM_DEBUG_EXCEPTION("emcore_get_body_part_imap_full failed");
+               emcore_free_section_list(section_list);
                return FAILURE;
        }
-       em_core_free_section_list(section_list);
+       emcore_free_section_list(section_list);
        return SUCCESS;
 }
 
-static int em_core_write_response_into_file(char *filename, char *write_mode, char *encoded, int encoding_type, char *subtype, int account_id, int mail_id, int *err)
+static int emcore_write_response_into_file(char *filename, char *write_mode, char *encoded, int encoding_type, char *subtype, int account_id, int mail_id, int *err)
 {
        EM_DEBUG_FUNC_BEGIN();
        int not_found = true;
@@ -2474,14 +2437,14 @@ static int em_core_write_response_into_file(char *filename, char *write_mode, ch
                                                                memset(html_cid_path, 0x00, MAX_PATH);
                        
                                                                /*  Finding 'filename' attribute from content inf */
-                                                               em_core_get_file_pointer(body_inline, save_file_name, NULL, &error);
+                                                               emcore_get_file_pointer(body_inline, save_file_name, NULL, &error);
 
                                                                if (strlen(save_file_name) > 0) { 
                                                                        /*  Content ID will be replaced with its file name in html */
                                                                        memcpy(html_cid_path, decoded_content_id , strlen("cid:") + strlen(body_inline_id));
 
                                                                        EM_DEBUG_LOG("Replacing %s with %s ", html_cid_path, save_file_name);
-                                                                       if ((decoded_temp = em_core_replace_string(decoded, html_cid_path, save_file_name))) {
+                                                                       if ((decoded_temp = em_replace_string(decoded, html_cid_path, save_file_name))) {
                                                                                EM_SAFE_FREE(decoded);
                                                                                decoded = decoded_temp;
                                                                                decoded_len = strlen(decoded);
@@ -2548,7 +2511,7 @@ FINISH_OFF:
 }
 
 
-static BODY *em_core_select_body_structure_from_section_list(PARTLIST *section_list,  char *section)
+static BODY *emcore_select_body_structure_from_section_list(PARTLIST *section_list,  char *section)
 {
        PARTLIST *temp = section_list;
        BODY *body = NULL;
@@ -2605,8 +2568,8 @@ static int imap_mail_write_body_to_file(MAILSTREAM *stream, int account_id, int
        EM_DEBUG_LOG(">>> WRITE BUFFER SIZE  :  %d KB", max_write_buffer_size);
        if (max_write_buffer_size > 0) {
                max_write_buffer_size *= 1024;          /*  KB -> byte */
-               if (!(write_buffer = em_core_malloc(sizeof(char) *max_write_buffer_size))) {
-                       EM_DEBUG_EXCEPTION("em_core_malloc failed...");                                         
+               if (!(write_buffer = em_malloc(sizeof(char) *max_write_buffer_size))) {
+                       EM_DEBUG_EXCEPTION("em_malloc failed...");                                              
                        err = EMF_ERROR_OUT_OF_MEMORY;                  
                        goto FINISH_OFF;
                }
@@ -2651,7 +2614,7 @@ static int imap_mail_write_body_to_file(MAILSTREAM *stream, int account_id, int
                char *p = NULL;
                char *s = NULL;
                
-               if (!em_core_check_thread_status())  {
+               if (!emcore_check_thread_status())  {
                        EM_DEBUG_LOG("Canceled...");
                        /*      Is it realy required ? It might cause crashes.
                        if (imaplocal->netstream) 
@@ -2743,23 +2706,23 @@ static int imap_mail_write_body_to_file(MAILSTREAM *stream, int account_id, int
                                
                                if (is_attachment) {
                                        EM_DEBUG_LOG("Attachment number [%d]", is_attachment);
-                                       if (!em_storage_notify_network_event(NOTI_DOWNLOAD_ATTACH_START, mail_id, filename, is_attachment, 0))
-                                               EM_DEBUG_EXCEPTION(" em_storage_notify_network_event [ NOTI_DOWNLOAD_ATTACH_START] Failed >>>> ");
+                                       if (!emstorage_notify_network_event(NOTI_DOWNLOAD_ATTACH_START, mail_id, filename, is_attachment, 0))
+                                               EM_DEBUG_EXCEPTION(" emstorage_notify_network_event [ NOTI_DOWNLOAD_ATTACH_START] Failed >>>> ");
                                        _imap4_download_noti_interval_value =  body_size *DOWNLOAD_NOTI_INTERVAL_PERCENT / 100;
                                        _imap4_total_body_size = body_size;
                                }
                                else {
                                        if (multi_part_body_size) {
                                                EM_DEBUG_LOG("Multipart body size is [%d]", multi_part_body_size);
-                                               if (!em_storage_notify_network_event(NOTI_DOWNLOAD_MULTIPART_BODY, mail_id, filename, multi_part_body_size, 0))
-                                                       EM_DEBUG_EXCEPTION(" em_storage_notify_network_event [ NOTI_DOWNLOAD_BODY_START] Failed >>>> ");
+                                               if (!emstorage_notify_network_event(NOTI_DOWNLOAD_MULTIPART_BODY, mail_id, filename, multi_part_body_size, 0))
+                                                       EM_DEBUG_EXCEPTION(" emstorage_notify_network_event [ NOTI_DOWNLOAD_BODY_START] Failed >>>> ");
                                                _imap4_download_noti_interval_value =  multi_part_body_size *DOWNLOAD_NOTI_INTERVAL_PERCENT / 100;
                                                /*  _imap4_total_body_size should be set before calling this functio */
                                                /* _imap4_total_body_size */
                                        }
                                        else {
-                                               if (!em_storage_notify_network_event(NOTI_DOWNLOAD_BODY_START, mail_id, filename, body_size, 0))
-                                                       EM_DEBUG_EXCEPTION(" em_storage_notify_network_event [ NOTI_DOWNLOAD_BODY_START] Failed >>>>");
+                                               if (!emstorage_notify_network_event(NOTI_DOWNLOAD_BODY_START, mail_id, filename, body_size, 0))
+                                                       EM_DEBUG_EXCEPTION(" emstorage_notify_network_event [ NOTI_DOWNLOAD_BODY_START] Failed >>>>");
                                                _imap4_download_noti_interval_value =  body_size *DOWNLOAD_NOTI_INTERVAL_PERCENT / 100;
                                                _imap4_total_body_size = body_size;
                                        }
@@ -2773,8 +2736,10 @@ static int imap_mail_write_body_to_file(MAILSTREAM *stream, int account_id, int
                                                err = EMF_ERROR_NO_RESPONSE;
                                                goto FINISH_OFF;
                                        }
-                               
-                                       if (!em_core_write_response_into_file(filepath, "wb+", (char *)encoded, encoding, section_subtype, account_id, mail_id, &err)) {
+
+                                       mail_close(stream); /* TODO : remove this line */
+
+                                       if (!emcore_write_response_into_file(filepath, "wb+", (char *)encoded, encoding, section_subtype, account_id, mail_id, &err)) {
                                                EM_DEBUG_EXCEPTION("write_response_into_file failed [%d]", err);
                                                goto FINISH_OFF;
                                        }
@@ -2796,17 +2761,17 @@ static int imap_mail_write_body_to_file(MAILSTREAM *stream, int account_id, int
                                                EM_DEBUG_LOG("DOWNLOADING STATUS NOTIFY  :  Total[%d] / [%d] = %d %% Completed.", _imap4_received_body_size, _imap4_total_body_size, 100*_imap4_received_body_size/_imap4_total_body_size);
                                        
                                                if (is_attachment) {
-                                                       if (!em_storage_notify_network_event(NOTI_DOWNLOAD_ATTACH_START, mail_id, filename, is_attachment, 100 *_imap4_received_body_size / _imap4_total_body_size))
-                                                               EM_DEBUG_EXCEPTION(" em_storage_notify_network_event [ NOTI_DOWNLOAD_ATTACH_START] Failed >>>> ");
+                                                       if (!emstorage_notify_network_event(NOTI_DOWNLOAD_ATTACH_START, mail_id, filename, is_attachment, 100 *_imap4_received_body_size / _imap4_total_body_size))
+                                                               EM_DEBUG_EXCEPTION(" emstorage_notify_network_event [ NOTI_DOWNLOAD_ATTACH_START] Failed >>>> ");
                                                }
                                                else {
                                                                if (multi_part_body_size) {
-                                                                       if (!em_storage_notify_network_event(NOTI_DOWNLOAD_MULTIPART_BODY, mail_id, filename, _imap4_total_body_size, _imap4_received_body_size))
-                                                                               EM_DEBUG_EXCEPTION(" em_storage_notify_network_event [ NOTI_DOWNLOAD_BODY_START] Failed >>>> ");
+                                                                       if (!emstorage_notify_network_event(NOTI_DOWNLOAD_MULTIPART_BODY, mail_id, filename, _imap4_total_body_size, _imap4_received_body_size))
+                                                                               EM_DEBUG_EXCEPTION(" emstorage_notify_network_event [ NOTI_DOWNLOAD_BODY_START] Failed >>>> ");
                                                                }
                                                                else {
-                                                                       if (!em_storage_notify_network_event(NOTI_DOWNLOAD_BODY_START, mail_id, filename, _imap4_total_body_size, _imap4_received_body_size))
-                                                                               EM_DEBUG_EXCEPTION(" em_storage_notify_network_event [ NOTI_DOWNLOAD_BODY_START] Failed >>>>");
+                                                                       if (!emstorage_notify_network_event(NOTI_DOWNLOAD_BODY_START, mail_id, filename, _imap4_total_body_size, _imap4_received_body_size))
+                                                                               EM_DEBUG_EXCEPTION(" emstorage_notify_network_event [ NOTI_DOWNLOAD_BODY_START] Failed >>>>");
                                                                }
                                                }       /*  if (is_attachment) .. else .. */
                                        }
@@ -2838,9 +2803,7 @@ static int imap_mail_write_body_to_file(MAILSTREAM *stream, int account_id, int
                                                        total = total + x;
                                                        _imap4_received_body_size += strlen((char *)encoded);
                                                
-                                                       if (temp_body_size/x)
-                                                               x = x;
-                                                       else if (temp_body_size%x)
+                                                       if ( !(temp_body_size/x) && temp_body_size%x)
                                                                x = temp_body_size%x;
                                                        
                                                        if (((_imap4_last_notified_body_size  + _imap4_download_noti_interval_value) <=  _imap4_received_body_size)
@@ -2856,18 +2819,18 @@ static int imap_mail_write_body_to_file(MAILSTREAM *stream, int account_id, int
                                                                EM_DEBUG_LOG("DOWNLOADING STATUS NOTIFY  :  Total[%d] / [%d] = %d %% Completed.", _imap4_received_body_size, _imap4_total_body_size, 100*_imap4_received_body_size/_imap4_total_body_size);
                                                        
                                                                if (is_attachment) {
-                                                                       if (!em_storage_notify_network_event(NOTI_DOWNLOAD_ATTACH_START, mail_id, filename, is_attachment, 100 *_imap4_received_body_size / _imap4_total_body_size))
-                                                                               EM_DEBUG_EXCEPTION(" em_storage_notify_network_event [ NOTI_DOWNLOAD_ATTACH_START] Failed >>>> ");
+                                                                       if (!emstorage_notify_network_event(NOTI_DOWNLOAD_ATTACH_START, mail_id, filename, is_attachment, 100 *_imap4_received_body_size / _imap4_total_body_size))
+                                                                               EM_DEBUG_EXCEPTION(" emstorage_notify_network_event [ NOTI_DOWNLOAD_ATTACH_START] Failed >>>> ");
                                                                }
                                                                else {
                                                                        if (multi_part_body_size) {
                                                                                /* EM_DEBUG_LOG("DOWNLOADING..........  :  Multipart body size is [%d]", multi_part_body_size) */
-                                                                       if (!em_storage_notify_network_event(NOTI_DOWNLOAD_MULTIPART_BODY, mail_id, filename, _imap4_total_body_size, _imap4_received_body_size))
-                                                                                       EM_DEBUG_EXCEPTION(" em_storage_notify_network_event [ NOTI_DOWNLOAD_BODY_START] Failed >>>> ");
+                                                                       if (!emstorage_notify_network_event(NOTI_DOWNLOAD_MULTIPART_BODY, mail_id, filename, _imap4_total_body_size, _imap4_received_body_size))
+                                                                                       EM_DEBUG_EXCEPTION(" emstorage_notify_network_event [ NOTI_DOWNLOAD_BODY_START] Failed >>>> ");
                                                                        }
                                                                        else {
-                                                                               if (!em_storage_notify_network_event(NOTI_DOWNLOAD_BODY_START, mail_id, filename, _imap4_total_body_size, _imap4_received_body_size))
-                                                                                       EM_DEBUG_EXCEPTION(" em_storage_notify_network_event [ NOTI_DOWNLOAD_BODY_START] Failed >>>>");
+                                                                               if (!emstorage_notify_network_event(NOTI_DOWNLOAD_BODY_START, mail_id, filename, _imap4_total_body_size, _imap4_received_body_size))
+                                                                                       EM_DEBUG_EXCEPTION(" emstorage_notify_network_event [ NOTI_DOWNLOAD_BODY_START] Failed >>>>");
                                                                        }
                                                                }       /*  if (is_attachment) .. else .. */
                                                        }
@@ -2876,14 +2839,14 @@ static int imap_mail_write_body_to_file(MAILSTREAM *stream, int account_id, int
                }
                        
                                                        if (flag_first_write == true) {
-                                                               if (!em_core_write_response_into_file(filepath, "wb+", (char *)test_buffer, encoding, section_subtype, account_id, mail_id, &err)) {
+                                                               if (!emcore_write_response_into_file(filepath, "wb+", (char *)test_buffer, encoding, section_subtype, account_id, mail_id, &err)) {
                                                                        EM_DEBUG_EXCEPTION("write_response_into_file %s failed [%d]", filepath, err);
                                                                        goto FINISH_OFF;
                                                                }
                                                                flag_first_write = false;
                                                        }
                                                        else {
-                                                               if (!em_core_write_response_into_file(filepath, "ab+", (char *)test_buffer, encoding, section_subtype, account_id, mail_id, &err)) /*  append */ {
+                                                               if (!emcore_write_response_into_file(filepath, "ab+", (char *)test_buffer, encoding, section_subtype, account_id, mail_id, &err)) /*  append */ {
                                                                        EM_DEBUG_EXCEPTION("write_response_into_file %s failed [%d]", filepath, err);
                                                                        goto FINISH_OFF;
                                                                }
@@ -2946,14 +2909,14 @@ FINISH_OFF:
        return ret;
 }
 
-static int em_core_get_body_part_imap_full(MAILSTREAM *stream, int msg_uid, int account_id, int mail_id, PARTLIST *section_list, struct _m_content_info *cnt_info, int *err_code, int event_handle)
+static int emcore_get_body_part_imap_full(MAILSTREAM *stream, int msg_uid, int account_id, int mail_id, PARTLIST *section_list, struct _m_content_info *cnt_info, int *err_code, int event_handle)
 {
        EM_DEBUG_FUNC_BEGIN("stream[%p], msg_uid[%d], body[%p], cnt_info[%p], err_code[%p]", stream, msg_uid, section_list, cnt_info, err_code);
        
        int err = EMF_ERROR_NONE;
-       char sections[IMAP_MAX_COMMAND_LENGTH] = {0};
+       char sections[IMAP_MAX_COMMAND_LENGTH] = { 0, };
        IMAPLOCAL *imaplocal = NULL;
-       char tag[16] = {0}, command[IMAP_MAX_COMMAND_LENGTH] = {0};
+       char tag[16] = { 0, }, command[IMAP_MAX_COMMAND_LENGTH] = { 0, };
        char section[16] = {0};
        char *response = NULL;
        BODY *body = NULL;
@@ -2977,35 +2940,35 @@ static int em_core_get_body_part_imap_full(MAILSTREAM *stream, int msg_uid, int
                return_value = -1;
                goto FINISH_OFF;
        }
-       memset(sections, 0x00, sizeof(sections));
        
        if (section_list != NULL) {
                PARTLIST *temp = section_list;
 
-                       if (cnt_info->grab_type == GRAB_TYPE_ATTACHMENT) /*  to download attachmen */ {
-                               body = temp->body;
-                               if (body->sparep != NULL)  {
-                                       snprintf(sections, sizeof(sections), "BODY.PEEK[%s]", (char *)body->sparep);                                                            
-                               }
-                               else {
-                                       EM_DEBUG_EXCEPTION("body->sparep can not be null. ");
-                                       return_value = -1;
-                                       goto FINISH_OFF;                                
-                                                       
-                               }
+               if (cnt_info->grab_type == GRAB_TYPE_ATTACHMENT) {
+                       /*  to download attachment */
+                       body = temp->body;
+                       if (body->sparep != NULL)  {
+                               snprintf(sections, sizeof(sections), "BODY.PEEK[%s]", (char *)body->sparep);
                        }
                        else {
-                               while (temp != NULL) {
-                                       char t[64] = {0};
-                                       body = temp->body;
-       
-                                       if ((body->type == TYPETEXT)  || (body->id != NULL) || ((body->disposition.type != NULL) && ((body->disposition.type[0] == 'i') || (body->disposition.type[0] == 'I')))) {
-                                               snprintf(t, sizeof(t), "BODY.PEEK[%s] ", (char *)body->sparep);         /*  body parts seperated by period */
-                                               strcat(sections, t);
-                                       }                       
-                                       temp = (PARTLIST *)temp->next;                                  
+                               EM_DEBUG_EXCEPTION("body->sparep can not be null. ");
+                               return_value = -1;
+                               goto FINISH_OFF;
+
+                       }
+               }
+               else {
+                       while (temp != NULL) {
+                               char t[64] = {0};
+                               body = temp->body;
+
+                               if ((body->type == TYPETEXT)  || (body->id != NULL) || ((body->disposition.type != NULL) && ((body->disposition.type[0] == 'i') || (body->disposition.type[0] == 'I')))) {
+                                       snprintf(t, sizeof(t), "BODY.PEEK[%s] ", (char *)body->sparep);         /*  body parts seperated by period */
+                                       strcat(sections, t);
                                }
+                               temp = (PARTLIST *)temp->next;
                        }
+               }
        }
 
        if ((strlen(sections) == (sizeof(sections)-1)) || (strlen(sections) == 0)) {
@@ -3020,20 +2983,17 @@ static int em_core_get_body_part_imap_full(MAILSTREAM *stream, int msg_uid, int
        
        EM_DEBUG_LOG("sections <%s>", sections);
        
-       memset(tag, 0x00, sizeof(tag));
-       memset(command, 0x00, sizeof(command)); 
-       
        SNPRINTF(tag, sizeof(tag), "%08lx", 0xffffffff & (stream->gensym++));
        SNPRINTF(command, sizeof(command), "%s UID FETCH %d (%s)\015\012", tag, msg_uid, sections);
        EM_DEBUG_LOG("command %s", command);
        
        if (strlen(command) == (sizeof(command)-1)) {
-                       EM_DEBUG_EXCEPTION(" Too many body parts. IMAP command will fail.");
-                       return_value = -1;
-                       goto FINISH_OFF;
-               }
+               EM_DEBUG_EXCEPTION("Too many body parts. IMAP command will fail.");
+               return_value = -1;
+               goto FINISH_OFF;
+       }
        
-       /*  send command  :  get msgno/uid for all messag */
+       /*  send command  :  get msgno/uid for all message */
        if (!net_sout(imaplocal->netstream, command, (int)strlen(command)))  {
                EM_DEBUG_EXCEPTION("net_sout failed...");
                err = EMF_ERROR_CONNECTION_BROKEN;      
@@ -3052,10 +3012,10 @@ static int em_core_get_body_part_imap_full(MAILSTREAM *stream, int msg_uid, int
                
                if (strstr(response, "BODY[")) {
                                
-                       if (!server_response_yn)                /*  start of respons */ {
+                       if (!server_response_yn)                /*  start of response */ {
                                if (response[0] != '*') {
                                        err = EMF_ERROR_INVALID_RESPONSE;
-                                       EM_DEBUG_EXCEPTION("Start of response doesn contain *");
+                                       EM_DEBUG_EXCEPTION("Start of response doesn't contain *");
                                        return_value = -1;
                                        goto FINISH_OFF;
                                }
@@ -3066,29 +3026,30 @@ static int em_core_get_body_part_imap_full(MAILSTREAM *stream, int msg_uid, int
                        total = 0;
                        memset(encoded, 0x00, sizeof(encoded));
                        
-                       if (em_core_get_section_body_size(response, section, &body_size)<0) {
-                               EM_DEBUG_EXCEPTION("em_core_get_section_body_size failed [%d]", err);
+                       if (emcore_get_section_body_size(response, section, &body_size)<0) {
+                               EM_DEBUG_EXCEPTION("emcore_get_section_body_size failed [%d]", err);
                                err = EMF_ERROR_INVALID_RESPONSE;
                                return_value = -1;
                                goto FINISH_OFF;
                        }
                        EM_DEBUG_LOG("body_size-%d", body_size);
 
-                       if ((body = em_core_select_body_structure_from_section_list(section_list, section)) == NULL)/*  get body from seciton_lis */ {
-                               EM_DEBUG_EXCEPTION("em_core_select_body_structure_from_section_list failed [%d]", err);
+                       /*  get body from seciton_list */
+                       if ((body = emcore_select_body_structure_from_section_list(section_list, section)) == NULL) {
+                               EM_DEBUG_EXCEPTION("emcore_select_body_structure_from_section_list failed [%d]", err);
                                err = EMF_ERROR_INVALID_RESPONSE;
                                return_value = -1;
                                goto FINISH_OFF;
                        }                               
                        encoding = body->encoding;      
                                
-                       /* if (em_core_get_file_pointer(account_id, mail_id, body, buf, cnt_info , err)<0) {
-                               EM_DEBUG_EXCEPTION("em_core_get_file_pointer failed [%d]", err);
+                       /* if (emcore_get_file_pointer(account_id, mail_id, body, buf, cnt_info , err)<0) {
+                               EM_DEBUG_EXCEPTION("emcore_get_file_pointer failed [%d]", err);
                                goto FINISH_OFF;
                        }*/
 
-                       if (!em_core_get_temp_file_name(&buf, &err))  {
-                               EM_DEBUG_EXCEPTION("em_core_get_temp_file_name failed [%d]", err);                      
+                       if (!emcore_get_temp_file_name(&buf, &err))  {
+                               EM_DEBUG_EXCEPTION("emcore_get_temp_file_name failed [%d]", err);                       
                                goto FINISH_OFF;
                        }
                        
@@ -3096,17 +3057,14 @@ static int em_core_get_body_part_imap_full(MAILSTREAM *stream, int msg_uid, int
 
                        /*  notifying UI start */
                        /*  parse_file_path_to_filename(buf, &file_id);                 */
-                       
                        /*  EM_DEBUG_LOG(">>>> filename - %p >>>>>>", file_id) */
 
-
                        if (body->type == TYPETEXT && body->subtype && (!body->disposition.type || (body->disposition.type && (body->disposition.type[0] == 'i' || body->disposition.type[0] == 'I')))) {
-                               if (body->subtype[0] == 'H')  {
+                               if (body->subtype[0] == 'H')
                                        cnt_info->text.html = buf;
-                               }
-                               else  {
+                               else
                                        cnt_info->text.plain = buf;
-                               }
+
                                PARAMETER *param = NULL;
                
                                param = body->parameter;
@@ -3116,15 +3074,13 @@ static int em_core_get_body_part_imap_full(MAILSTREAM *stream, int msg_uid, int
                                                cnt_info->text.plain_charset = EM_SAFE_STRDUP(param->value);
                                                break;
                                        }
-                                       
                                        param = param->next;
                                }
-                                       
                        }
                        else if (body->id || body->location || body->disposition.type) {
 
-                               if (em_core_get_file_pointer(body, filename, cnt_info , &err)<0) {
-                                       EM_DEBUG_EXCEPTION("em_core_get_file_pointer failed [%d]", err);
+                               if (emcore_get_file_pointer(body, filename, cnt_info , &err)<0) {
+                                       EM_DEBUG_EXCEPTION("emcore_get_file_pointer failed [%d]", err);
                                        goto FINISH_OFF;
                                }                               
                                
@@ -3147,8 +3103,8 @@ static int em_core_get_body_part_imap_full(MAILSTREAM *stream, int msg_uid, int
                        FINISH_OFF_IF_CANCELED;
                                
                        if (cnt_info->grab_type == GRAB_TYPE_ATTACHMENT) {
-                               if (!em_storage_notify_network_event(NOTI_DOWNLOAD_ATTACH_START, mail_id, buf, cnt_info->file_no, 0))
-                                       EM_DEBUG_EXCEPTION(" em_storage_notify_network_event [ NOTI_DOWNLOAD_ATTACH_START] Failed >>>> ");
+                               if (!emstorage_notify_network_event(NOTI_DOWNLOAD_ATTACH_START, mail_id, buf, cnt_info->file_no, 0))
+                                       EM_DEBUG_EXCEPTION(" emstorage_notify_network_event [ NOTI_DOWNLOAD_ATTACH_START] Failed >>>> ");
                                
                                _imap4_download_noti_interval_value =  body_size *DOWNLOAD_NOTI_INTERVAL_PERCENT / 100;
                                _imap4_total_body_size = body_size;
@@ -3156,14 +3112,14 @@ static int em_core_get_body_part_imap_full(MAILSTREAM *stream, int msg_uid, int
                        else {
                                if (multi_part_body_size) {
                                        EM_DEBUG_LOG("Multipart body size is [%d]", multi_part_body_size);
-                                       if (!em_storage_notify_network_event(NOTI_DOWNLOAD_MULTIPART_BODY, mail_id, buf, multi_part_body_size, 0))
-                                               EM_DEBUG_EXCEPTION(" em_storage_notify_network_event [ NOTI_DOWNLOAD_BODY_START] Failed >>>> ");
+                                       if (!emstorage_notify_network_event(NOTI_DOWNLOAD_MULTIPART_BODY, mail_id, buf, multi_part_body_size, 0))
+                                               EM_DEBUG_EXCEPTION(" emstorage_notify_network_event [ NOTI_DOWNLOAD_BODY_START] Failed >>>> ");
                                        
                                        _imap4_download_noti_interval_value =  multi_part_body_size *DOWNLOAD_NOTI_INTERVAL_PERCENT / 100;
                                }
                                else {
-                                       if (!em_storage_notify_network_event(NOTI_DOWNLOAD_BODY_START, mail_id, buf, body_size, 0))
-                                               EM_DEBUG_EXCEPTION(" em_storage_notify_network_event [ NOTI_DOWNLOAD_BODY_START] Failed >>>> ");
+                                       if (!emstorage_notify_network_event(NOTI_DOWNLOAD_BODY_START, mail_id, buf, body_size, 0))
+                                               EM_DEBUG_EXCEPTION(" emstorage_notify_network_event [ NOTI_DOWNLOAD_BODY_START] Failed >>>> ");
                                        
                                        _imap4_download_noti_interval_value =  body_size *DOWNLOAD_NOTI_INTERVAL_PERCENT / 100;
                                        _imap4_total_body_size = body_size;
@@ -3185,7 +3141,7 @@ static int em_core_get_body_part_imap_full(MAILSTREAM *stream, int msg_uid, int
                                        return_value = -1;
                                        goto FINISH_OFF;
                                }
-                               if (!em_core_write_response_into_file(buf, "wb+", (char *)encoded, encoding, body->subtype, account_id, mail_id, &err)) {
+                               if (!emcore_write_response_into_file(buf, "wb+", (char *)encoded, encoding, body->subtype, account_id, mail_id, &err)) {
                                        EM_DEBUG_EXCEPTION("write_response_into_file failed [%d]", err);
                                        return_value = -1;
                                        goto FINISH_OFF;
@@ -3196,10 +3152,10 @@ static int em_core_get_body_part_imap_full(MAILSTREAM *stream, int msg_uid, int
 
                                total = _imap4_received_body_size = strlen((char *)encoded);
                        
-                               EM_DEBUG_LOG(" _imap4_last_notified_body_size - %d ", _imap4_last_notified_body_size);
-                               EM_DEBUG_LOG(" _imap4_download_noti_interval_value - %d ", _imap4_download_noti_interval_value);
-                               EM_DEBUG_LOG(" _imap4_received_body_size - %d ", _imap4_received_body_size);
-                               EM_DEBUG_LOG(" _imap4_total_body_size - %d ", _imap4_total_body_size);
+                               EM_DEBUG_LOG("_imap4_last_notified_body_size [%d]", _imap4_last_notified_body_size);
+                               EM_DEBUG_LOG("_imap4_download_noti_interval_value [%d]", _imap4_download_noti_interval_value);
+                               EM_DEBUG_LOG("_imap4_received_body_size [%d]", _imap4_received_body_size);
+                               EM_DEBUG_LOG("_imap4_total_body_size [%d] ", _imap4_total_body_size);
                        
                                if (((_imap4_last_notified_body_size  + _imap4_download_noti_interval_value) <=  _imap4_received_body_size)
                                        || (_imap4_received_body_size >= _imap4_total_body_size))               /*  100  */ {
@@ -3226,18 +3182,18 @@ static int em_core_get_body_part_imap_full(MAILSTREAM *stream, int msg_uid, int
                                        EM_DEBUG_LOG("DOWNLOADING STATUS NOTIFY  :  Total[%d] / [%d] = %d %% Completed.", _imap4_received_body_size, _imap4_total_body_size, imap4_total_body_download_progress);
                                
                                        if (cnt_info->grab_type == GRAB_TYPE_ATTACHMENT) {
-                                               if (!em_storage_notify_network_event(NOTI_DOWNLOAD_ATTACH_START, mail_id, buf, cnt_info->file_no, imap4_total_body_download_progress))
-                                                       EM_DEBUG_EXCEPTION(" em_storage_notify_network_event [ NOTI_DOWNLOAD_ATTACH_START] Failed >>>> ");
+                                               if (!emstorage_notify_network_event(NOTI_DOWNLOAD_ATTACH_START, mail_id, buf, cnt_info->file_no, imap4_total_body_download_progress))
+                                                       EM_DEBUG_EXCEPTION(" emstorage_notify_network_event [ NOTI_DOWNLOAD_ATTACH_START] Failed >>>> ");
                                        }
                                        else {
                                                        if (multi_part_body_size) {
                                                                /* EM_DEBUG_LOG("DOWNLOADING..........  :  Multipart body size is [%d]", multi_part_body_size) */
-                                                       if (!em_storage_notify_network_event(NOTI_DOWNLOAD_MULTIPART_BODY, mail_id, buf, _imap4_total_body_size, _imap4_received_body_size))
-                                                                       EM_DEBUG_EXCEPTION(" em_storage_notify_network_event [ NOTI_DOWNLOAD_BODY_START] Failed >>>> ");
+                                                       if (!emstorage_notify_network_event(NOTI_DOWNLOAD_MULTIPART_BODY, mail_id, buf, _imap4_total_body_size, _imap4_received_body_size))
+                                                                       EM_DEBUG_EXCEPTION(" emstorage_notify_network_event [ NOTI_DOWNLOAD_BODY_START] Failed >>>> ");
                                                        }
                                                        else {
-                                                       if (!em_storage_notify_network_event(NOTI_DOWNLOAD_BODY_START, mail_id, buf, _imap4_total_body_size, _imap4_received_body_size))
-                                                                       EM_DEBUG_EXCEPTION(" em_storage_notify_network_event [ NOTI_DOWNLOAD_BODY_START] Failed >>>>");
+                                                       if (!emstorage_notify_network_event(NOTI_DOWNLOAD_BODY_START, mail_id, buf, _imap4_total_body_size, _imap4_received_body_size))
+                                                                       EM_DEBUG_EXCEPTION(" emstorage_notify_network_event [ NOTI_DOWNLOAD_BODY_START] Failed >>>>");
                                                        }
                                        }       /*  if (is_attachment) .. else .. */
                                }
@@ -3275,12 +3231,10 @@ static int em_core_get_body_part_imap_full(MAILSTREAM *stream, int msg_uid, int
                                                
                                                EM_DEBUG_LOG("total = %d", total);
                                                
-                                               if (temp_body_size/x)
-                                                       x = x;
-                                               else if (temp_body_size%x)
+                                               if ( !(temp_body_size/x) && temp_body_size%x)
                                                        x = temp_body_size%x;
 
-                                       EM_DEBUG_LOG(" _imap4_last_notified_body_size - %d ", _imap4_last_notified_body_size);
+                                               EM_DEBUG_LOG(" _imap4_last_notified_body_size - %d ", _imap4_last_notified_body_size);
                                                EM_DEBUG_LOG(" _imap4_download_noti_interval_value - %d ", _imap4_download_noti_interval_value);
                                                EM_DEBUG_LOG(" _imap4_received_body_size - %d ", _imap4_received_body_size);
                                                EM_DEBUG_LOG(" _imap4_received_body_size - %d ", _imap4_received_body_size);
@@ -3309,25 +3263,25 @@ static int em_core_get_body_part_imap_full(MAILSTREAM *stream, int msg_uid, int
                                                        EM_DEBUG_LOG("DOWNLOADING STATUS NOTIFY  :  Total[%d] / [%d] = %d %% Completed.", _imap4_received_body_size, _imap4_total_body_size, imap4_total_body_download_progress);
                                                
                                                        if (cnt_info->grab_type == GRAB_TYPE_ATTACHMENT) {
-                                                               if (!em_storage_notify_network_event(NOTI_DOWNLOAD_ATTACH_START, mail_id, buf, cnt_info->file_no, imap4_total_body_download_progress))
-                                                                       EM_DEBUG_EXCEPTION(" em_storage_notify_network_event [ NOTI_DOWNLOAD_ATTACH_START] Failed >>>> ");
+                                                               if (!emstorage_notify_network_event(NOTI_DOWNLOAD_ATTACH_START, mail_id, buf, cnt_info->file_no, imap4_total_body_download_progress))
+                                                                       EM_DEBUG_EXCEPTION(" emstorage_notify_network_event [ NOTI_DOWNLOAD_ATTACH_START] Failed >>>> ");
                                                        }
                                                        else {
                                                                if (multi_part_body_size) {
                                                                        /* EM_DEBUG_LOG("DOWNLOADING..........  :  Multipart body size is [%d]", multi_part_body_size) */
-                                                                       if (!em_storage_notify_network_event(NOTI_DOWNLOAD_MULTIPART_BODY, mail_id, buf, _imap4_total_body_size, _imap4_received_body_size))
-                                                                               EM_DEBUG_EXCEPTION(" em_storage_notify_network_event [ NOTI_DOWNLOAD_BODY_START] Failed >>>> ");
+                                                                       if (!emstorage_notify_network_event(NOTI_DOWNLOAD_MULTIPART_BODY, mail_id, buf, _imap4_total_body_size, _imap4_received_body_size))
+                                                                               EM_DEBUG_EXCEPTION(" emstorage_notify_network_event [ NOTI_DOWNLOAD_BODY_START] Failed >>>> ");
                                                                }
                                                                else {
-                                                                       if (!em_storage_notify_network_event(NOTI_DOWNLOAD_BODY_START, mail_id, buf, _imap4_total_body_size, _imap4_received_body_size))
-                                                                               EM_DEBUG_EXCEPTION(" em_storage_notify_network_event [ NOTI_DOWNLOAD_BODY_START] Failed >>>>");
+                                                                       if (!emstorage_notify_network_event(NOTI_DOWNLOAD_BODY_START, mail_id, buf, _imap4_total_body_size, _imap4_received_body_size))
+                                                                               EM_DEBUG_EXCEPTION(" emstorage_notify_network_event [ NOTI_DOWNLOAD_BODY_START] Failed >>>>");
                                                                }
                                                        }       /*  if (is_attachment) .. else .. */
                                                }
                                        }
 
                                        if (flag_first_write == 1) {
-                                               if (!em_core_write_response_into_file(buf, "wb+", (char *)test_buffer, encoding, body->subtype, account_id, mail_id, &err)) {
+                                               if (!emcore_write_response_into_file(buf, "wb+", (char *)test_buffer, encoding, body->subtype, account_id, mail_id, &err)) {
                                                        EM_DEBUG_EXCEPTION("write_response_into_file %s failed [%d]", buf, err);
                                                        return_value = -1;
                                                        goto FINISH_OFF;
@@ -3335,20 +3289,15 @@ static int em_core_get_body_part_imap_full(MAILSTREAM *stream, int msg_uid, int
                                                flag_first_write = 0;
                                        }
                                        else {
-                                               if (!em_core_write_response_into_file(buf, "ab+", (char *)test_buffer, encoding, body->subtype, account_id, mail_id, &err)) /*  append */ {
+                                               if (!emcore_write_response_into_file(buf, "ab+", (char *)test_buffer, encoding, body->subtype, account_id, mail_id, &err)) /*  append */ {
                                                        EM_DEBUG_EXCEPTION("write_response_into_file %s failed [%d]", buf, err);
                                                        return_value = -1;
                                                        goto FINISH_OFF;
                                                }
                                        }
-
                                        EM_DEBUG_LOG("%d has been written", strlen((char *)test_buffer));                                               
-                                       
-                                       
-                                       
                                }
                        }
-                       EM_DEBUG_LOG("5");
                }
                else if (!strncmp(response, tag, strlen(tag)))  /*  end of respons */ {         
                        if (!strncmp(response + strlen(tag) + 1, "OK", 2)) 
@@ -3381,7 +3330,7 @@ static int em_core_get_body_part_imap_full(MAILSTREAM *stream, int msg_uid, int
        return return_value;
 }
 
-static int em_core_get_file_pointer(BODY *body, char *buf, struct _m_content_info *cnt_info , int *err)
+static int emcore_get_file_pointer(BODY *body, char *buf, struct _m_content_info *cnt_info , int *err)
 {
        EM_DEBUG_FUNC_BEGIN();
 
@@ -3411,7 +3360,7 @@ static int em_core_get_file_pointer(BODY *body, char *buf, struct _m_content_inf
                        PARAMETER *param = body->parameter;
                        char charset_string[512];
 
-                       if (em_core_get_attribute_value_of_body_part(param, "CHARSET", charset_string, 512, false, &error)) {
+                       if (emcore_get_attribute_value_of_body_part(param, "CHARSET", charset_string, 512, false, &error)) {
                                cnt_info->text.plain_charset = EM_SAFE_STRDUP(charset_string);
                                memcpy(buf, cnt_info->text.plain_charset, strlen(cnt_info->text.plain_charset)); 
                        }
@@ -3426,19 +3375,19 @@ static int em_core_get_file_pointer(BODY *body, char *buf, struct _m_content_inf
                size_t len = 0;
                if (body->parameter) /* Get actual name of file */ {
                        PARAMETER *param_body = body->parameter;
-                       if (!em_core_get_attribute_value_of_body_part(param_body, "NAME", attachment_file_name_source, MAX_PATH, true, &error))
-                               em_core_get_attribute_value_of_body_part(param_body, "CHARSET", attachment_file_name_source, MAX_PATH, true, &error);
-                       if (!em_core_make_attachment_file_name_with_extension(attachment_file_name_source, body->subtype, attachment_file_name, MAX_PATH, &error)) {
-                               EM_DEBUG_EXCEPTION("em_core_make_attachment_file_name_with_extension failed [%d]", error);
+                       if (!emcore_get_attribute_value_of_body_part(param_body, "NAME", attachment_file_name_source, MAX_PATH, true, &error))
+                               emcore_get_attribute_value_of_body_part(param_body, "CHARSET", attachment_file_name_source, MAX_PATH, true, &error);
+                       if (!emcore_make_attachment_file_name_with_extension(attachment_file_name_source, body->subtype, attachment_file_name, MAX_PATH, &error)) {
+                               EM_DEBUG_EXCEPTION("emcore_make_attachment_file_name_with_extension failed [%d]", error);
                                goto FINISH_OFF;
                        }
                }
                else if (body->disposition.type)  {             
                        PARAMETER *param_disposition = body->disposition.parameter;
                        EM_DEBUG_LOG("body->disposition.type exist");
-                       em_core_get_attribute_value_of_body_part(param_disposition, "filename", attachment_file_name_source, MAX_PATH, true, &error);
-                       if (!em_core_make_attachment_file_name_with_extension(attachment_file_name_source, body->subtype, attachment_file_name, MAX_PATH, &error)) {
-                               EM_DEBUG_EXCEPTION("em_core_make_attachment_file_name_with_extension failed [%d]", error);
+                       emcore_get_attribute_value_of_body_part(param_disposition, "filename", attachment_file_name_source, MAX_PATH, true, &error);
+                       if (!emcore_make_attachment_file_name_with_extension(attachment_file_name_source, body->subtype, attachment_file_name, MAX_PATH, &error)) {
+                               EM_DEBUG_EXCEPTION("emcore_make_attachment_file_name_with_extension failed [%d]", error);
                                goto FINISH_OFF;
                        }
                }
@@ -3452,7 +3401,7 @@ static int em_core_get_file_pointer(BODY *body, char *buf, struct _m_content_inf
                        
                        if ((len > 1) && (attachment_file_name[len-1] == '>'))
                                attachment_file_name[len - 1] = '\0';
-                       decoded_filename = em_core_decode_rfc2047_text(attachment_file_name, &error);
+                       decoded_filename = emcore_decode_rfc2047_text(attachment_file_name, &error);
                }
                EM_DEBUG_LOG("attachment_file_name [%s]", attachment_file_name);
                if (decoded_filename != NULL)
@@ -3463,8 +3412,8 @@ static int em_core_get_file_pointer(BODY *body, char *buf, struct _m_content_inf
        }
        else if (body->disposition.type != NULL) {      /*  disposition type is existing and not inline and body_id is nul */
                PARAMETER *param = body->parameter;                                             
-               if (!em_core_get_attribute_value_of_body_part(param, "NAME", attachment_file_name, MAX_PATH, true, &error))
-                       em_core_get_attribute_value_of_body_part(param, "FILENAME", attachment_file_name, MAX_PATH, true, &error);
+               if (!emcore_get_attribute_value_of_body_part(param, "NAME", attachment_file_name, MAX_PATH, true, &error))
+                       emcore_get_attribute_value_of_body_part(param, "FILENAME", attachment_file_name, MAX_PATH, true, &error);
                memcpy(buf, attachment_file_name, strlen(attachment_file_name));
        }
 
@@ -3478,7 +3427,7 @@ FINISH_OFF:
 }
 
 
-static PARTLIST *em_core_add_node(PARTLIST *section_list, BODY *body)
+static PARTLIST *emcore_add_node(PARTLIST *section_list, BODY *body)
 {
        PARTLIST *temp = (PARTLIST  *)malloc(sizeof(PARTLIST));
 
@@ -3510,7 +3459,7 @@ PARTLIST{
 }
 
 
-static void em_core_free_section_list(PARTLIST *section_list)
+static void emcore_free_section_list(PARTLIST *section_list)
 {
        PARTLIST *temp = NULL;
 
@@ -3521,7 +3470,7 @@ static void em_core_free_section_list(PARTLIST *section_list)
        }
 }
 
-static int em_core_get_section_body_size(char *response, char *section, int *body_size)
+static int emcore_get_section_body_size(char *response, char *section, int *body_size)
 {
        char *p = NULL;
        char *s = NULL;
@@ -3603,10 +3552,129 @@ static char *em_parse_filename(char *filename)
 
        EM_DEBUG_FUNC_END("parsed_filename [%s] ", parsed_filename);
        return parsed_filename;
- }
+}
 
+#define CONTENT_TYPE_STRING_IN_MIME_HEAEDER "Content-Type:"
 
-EXPORT_API int em_core_get_attribute_value_of_body_part(PARAMETER *input_param, char *atribute_name, char *output_value, int output_buffer_length, int with_rfc2047_text, int *err_code)
+INTERNAL_FUNC int emcore_get_content_type_from_mime_string(char *input_mime_string, char **output_content_type)
+{
+       EM_DEBUG_FUNC_BEGIN("input_mime_string [%p], output_content_type [%p]", input_mime_string, output_content_type);
+
+       int   err = EMF_ERROR_NONE;
+       int   temp_mime_header_string_length = 0;
+       char  result_content_type[256] = { 0, };
+       char *temp_mime_header_string = NULL;
+       char *temp_content_type_start = NULL;
+       char *temp_content_type_end = NULL;
+
+       if(input_mime_string == NULL || output_content_type == NULL) {
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
+               err = EMF_ERROR_INVALID_PARAM;
+               goto FINISH_OFF;
+       }
+
+       temp_mime_header_string_length = EM_SAFE_STRLEN(input_mime_string);
+       temp_mime_header_string        = input_mime_string;
+
+       EM_DEBUG_LOG("temp_mime_header_string [%s]", temp_mime_header_string);
+
+       temp_content_type_start = strcasestr(temp_mime_header_string, CONTENT_TYPE_STRING_IN_MIME_HEAEDER);
+
+       if(temp_content_type_start == NULL) {
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_DATA");
+               err = EMF_ERROR_INVALID_DATA;
+               goto FINISH_OFF;
+       }
+       else {
+               temp_content_type_start += EM_SAFE_STRLEN(CONTENT_TYPE_STRING_IN_MIME_HEAEDER);
+               temp_content_type_end = temp_content_type_start;
+
+               while(temp_content_type_end && temp_content_type_end < (temp_mime_header_string + temp_mime_header_string_length) && *temp_content_type_end != ';')
+                       temp_content_type_end++;
+
+               if(temp_content_type_end && *temp_content_type_end == ';') {
+                       if(temp_content_type_end - temp_content_type_start < 256) {
+                               memcpy(result_content_type, temp_content_type_start, temp_content_type_end - temp_content_type_start);
+                               EM_DEBUG_LOG("result_content_type [%s]", result_content_type);
+                               *output_content_type = EM_SAFE_STRDUP(result_content_type);
+                               em_trim_left(*output_content_type);
+
+                       }
+                       else {
+                               EM_DEBUG_EXCEPTION("temp_content_type_end - temp_content_type_start [%d]", temp_content_type_end - temp_content_type_start);
+                               err = EMF_ERROR_DATA_TOO_LONG;
+                               goto FINISH_OFF;
+                       }
+               }
+       }
+
+FINISH_OFF:
+
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+}
+
+#define SUBTYPE_STRING_LENGTH 128
+
+INTERNAL_FUNC int emcore_get_content_type_from_mail_bodystruct(BODY *input_body, int input_buffer_length, char *output_content_type)
+{
+       EM_DEBUG_FUNC_BEGIN("input_body [%p], input_buffer_length [%d], output_content_type [%p]", input_body, input_buffer_length, output_content_type);
+       int   err = EMF_ERROR_NONE;
+       char  subtype_string[SUBTYPE_STRING_LENGTH] = { 0 , };
+
+       if(input_body == NULL || output_content_type == NULL || input_buffer_length == 0) {
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
+               err = EMF_ERROR_INVALID_PARAM;
+               goto FINISH_OFF;
+       }
+
+       EM_SAFE_STRNCPY(subtype_string, input_body->subtype, SUBTYPE_STRING_LENGTH);
+       em_lower_string(subtype_string);
+
+       switch(input_body->type) {
+               case TYPETEXT :
+                       SNPRINTF(output_content_type, input_buffer_length, "text/%s", subtype_string);
+                       break;
+               case TYPEMULTIPART :
+                       SNPRINTF(output_content_type, input_buffer_length, "multipart/%s", subtype_string);
+                       break;
+               case TYPEMESSAGE :
+                       SNPRINTF(output_content_type, input_buffer_length, "message/%s", subtype_string);
+                       break;
+               case TYPEAPPLICATION :
+                       SNPRINTF(output_content_type, input_buffer_length, "application/%s", subtype_string);
+                       break;
+               case TYPEAUDIO :
+                       SNPRINTF(output_content_type, input_buffer_length, "audio/%s", subtype_string);
+                       break;
+               case TYPEIMAGE :
+                       SNPRINTF(output_content_type, input_buffer_length, "image/%s", subtype_string);
+                       break;
+               case TYPEVIDEO :
+                       SNPRINTF(output_content_type, input_buffer_length, "video/%s", subtype_string);
+                       break;
+               case TYPEMODEL :
+                       SNPRINTF(output_content_type, input_buffer_length, "model/%s", subtype_string);
+                       break;
+               case TYPEOTHER :
+                       SNPRINTF(output_content_type, input_buffer_length, "other/%s", subtype_string);
+                       break;
+               default:
+                       EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
+                       err = EMF_ERROR_INVALID_PARAM;
+                       goto FINISH_OFF;
+                       break;
+       }
+
+       EM_DEBUG_LOG("output_content_type [%s]", output_content_type);
+
+FINISH_OFF:
+
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+}
+
+INTERNAL_FUNC int emcore_get_attribute_value_of_body_part(PARAMETER *input_param, char *atribute_name, char *output_value, int output_buffer_length, int with_rfc2047_text, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("input_param [%p], atribute_name [%s], output_buffer_length [%d], with_rfc2047_text [%d]", input_param, atribute_name, output_buffer_length, with_rfc2047_text);
        PARAMETER *temp_param = input_param;
@@ -3622,11 +3690,12 @@ EXPORT_API int em_core_get_attribute_value_of_body_part(PARAMETER *input_param,
        memset(output_value, 0, output_buffer_length);
        
        while (temp_param)  {
+               EM_DEBUG_LOG("temp_param->attribute [%s]", temp_param->attribute);
                if (!strcasecmp(temp_param->attribute, atribute_name))  {       
                        EM_DEBUG_LOG("temp_param->value [%s]", temp_param->value);
                        if (temp_param->value) {
                                if (with_rfc2047_text) {
-                                       decoded_value = em_core_decode_rfc2047_text(temp_param->value, &err);
+                                       decoded_value = emcore_decode_rfc2047_text(temp_param->value, &err);
                                        if (decoded_value) 
                                                result_value = decoded_value;
                                        else
@@ -3673,7 +3742,7 @@ FINISH_OFF:
 /*
  *download body part of imap mail (body-text and attachment)
  */
-static int em_core_get_body_part_imap(MAILSTREAM *stream, int account_id, int mail_id, int msg_uid, BODY *body, struct _m_content_info *cnt_info, int *err_code)
+static int emcore_get_body_part_imap(MAILSTREAM *stream, int account_id, int mail_id, int msg_uid, BODY *body, struct _m_content_info *cnt_info, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("stream[%p], msg_uid[%d], body[%p], cnt_info[%p], err_code[%p]", stream, msg_uid, body, cnt_info, err_code);
        
@@ -3689,6 +3758,7 @@ static int em_core_get_body_part_imap(MAILSTREAM *stream, int account_id, int ma
        int o_data_len = 0;
        char *filename_temp = NULL;
        char charset_value_buffer[512] = { 0, };
+       char content_type_buffer[512] = { 0, };
 /*  { is_pb */
        PART *part = NULL;
        int dec_len;
@@ -3717,8 +3787,8 @@ static int em_core_get_body_part_imap(MAILSTREAM *stream, int account_id, int ma
        }
 
        if (is_pbd) {
-               if (!em_core_get_temp_file_name(&o_data, &err) || !o_data)  {
-                       EM_DEBUG_EXCEPTION("em_core_get_temp_file_name failed [%d]", err);      
+               if (!emcore_get_temp_file_name(&o_data, &err) || !o_data)  {
+                       EM_DEBUG_EXCEPTION("emcore_get_temp_file_name failed [%d]", err);       
                        if (err_code != NULL) 
                                *err_code = err;
                        return FAILURE;
@@ -3739,7 +3809,7 @@ static int em_core_get_body_part_imap(MAILSTREAM *stream, int account_id, int ma
 
                        memset(charset_value_buffer, 0, 512);
 
-                       if (em_core_get_attribute_value_of_body_part(body->parameter, "CHARSET", charset_value_buffer, 512, true, &err)) {
+                       if (emcore_get_attribute_value_of_body_part(body->parameter, "CHARSET", charset_value_buffer, 512, true, &err)) {
                                cnt_info->text.plain_charset = EM_SAFE_STRDUP(charset_value_buffer);
                                EM_DEBUG_LOG(">>>>> CHARSET [%s] ", filename);
                        }
@@ -3758,7 +3828,7 @@ static int em_core_get_body_part_imap(MAILSTREAM *stream, int account_id, int ma
                                        char *extcheck = NULL;
                                
                                        if (param1->value) {
-                                               decoded_filename = em_core_decode_rfc2047_text(param1->value, &err);
+                                               decoded_filename = emcore_decode_rfc2047_text(param1->value, &err);
                                                strncpy(filename, decoded_filename, MAX_PATH);
                                                EM_SAFE_FREE(decoded_filename);
                                        }
@@ -3793,7 +3863,7 @@ static int em_core_get_body_part_imap(MAILSTREAM *stream, int account_id, int ma
 
                                /*  attribute is "filename" */
                                if (!strcasecmp(param->attribute, "filename"))  {
-                                       decoded_filename = em_core_decode_rfc2047_text(param->value, &err);
+                                       decoded_filename = emcore_decode_rfc2047_text(param->value, &err);
                                        strncpy(filename, decoded_filename, MAX_PATH);
                                        EM_SAFE_FREE(decoded_filename);
                                        EM_DEBUG_LOG(">>>>> FILENAME [%s] ", filename);
@@ -3820,18 +3890,18 @@ static int em_core_get_body_part_imap(MAILSTREAM *stream, int account_id, int ma
        else if (body->location) {
                EM_DEBUG_LOG("body->location exist");
                is_attachment = 1;
-               decoded_filename = em_core_decode_rfc2047_text(body->location, &err);
+               decoded_filename = emcore_decode_rfc2047_text(body->location, &err);
                strncpy(filename, decoded_filename, MAX_PATH);
                EM_SAFE_FREE(decoded_filename);
                EM_DEBUG_LOG("body->location [%s]", body->location);
        } 
-       else if (is_pbd && (strncmp(body->subtype, "RFC822", strlen("RFC822")) == 0) && (cnt_info->grab_type == 0 || cnt_info->grab_type & GRAB_TYPE_ATTACHMENT)) {
+       else if (is_pbd && (strncmp(body->subtype, "RFC822", strlen("RFC822")) == 0) && (cnt_info->grab_type == 0 || (cnt_info->grab_type & GRAB_TYPE_ATTACHMENT))) {
                EM_DEBUG_LOG("Beause subtype is RFC822. This is ttachment");
                is_attachment = 1;
 
                if (cnt_info->grab_type == 0) {
                        if ((body->nested.msg != NULL) && (body->nested.msg->env != NULL) && (body->nested.msg->env->subject != NULL)) {
-                               decoded_filename = em_core_decode_rfc2047_text(body->nested.msg->env->subject, &err);
+                               decoded_filename = emcore_decode_rfc2047_text(body->nested.msg->env->subject, &err);
                                strncpy(filename, decoded_filename, MAX_PATH);
                                EM_SAFE_FREE(decoded_filename);
                        }
@@ -3896,7 +3966,7 @@ static int em_core_get_body_part_imap(MAILSTREAM *stream, int account_id, int ma
                EM_DEBUG_LOG("body->disposition.type exist");
                is_attachment = 1;
                
-               if (em_core_get_attribute_value_of_body_part(body->disposition.parameter, "filename", filename, MAX_PATH, true, &err))
+               if (emcore_get_attribute_value_of_body_part(body->disposition.parameter, "filename", filename, MAX_PATH, true, &err))
                        EM_DEBUG_LOG(">>>>> FILENAME [%s] ", filename);
                
                if (!*filename)  {      /*  If the part has no filename, it may be report ms */
@@ -3905,7 +3975,7 @@ static int em_core_get_body_part_imap(MAILSTREAM *stream, int account_id, int ma
                        else if (body->parameter) /* Fix for the MMS attachment File name as unknown */ {
                                char *extcheck = NULL;
                                
-                               if (em_core_get_attribute_value_of_body_part(body->parameter, "NAME", filename, MAX_PATH, true, &err))
+                               if (emcore_get_attribute_value_of_body_part(body->parameter, "NAME", filename, MAX_PATH, true, &err))
                                        EM_DEBUG_LOG("NAME [%s] ", filename);
 
                                extcheck = strchr(filename, '.');
@@ -3937,7 +4007,7 @@ static int em_core_get_body_part_imap(MAILSTREAM *stream, int account_id, int ma
        /* if (!is_pbd) */ {    
                EM_DEBUG_LOG("filename [%s]", filename);
                if (*filename)  {
-                       decoded_filename = em_core_decode_rfc2047_text(filename, &err);
+                       decoded_filename = emcore_decode_rfc2047_text(filename, &err);
                        strncpy(filename, decoded_filename, MAX_PATH);
                        EM_SAFE_FREE(decoded_filename);
                        filename_temp = em_parse_filename(filename);
@@ -3955,8 +4025,8 @@ static int em_core_get_body_part_imap(MAILSTREAM *stream, int account_id, int ma
                        if (is_pbd)
                                return SUCCESS;
                        else {  /*  fetch body */
-                               if (!em_core_get_temp_file_name(&o_data, &err))  {
-                                       EM_DEBUG_EXCEPTION("em_core_get_temp_file_name failed [%d]", err);                      
+                               if (!emcore_get_temp_file_name(&o_data, &err))  {
+                                       EM_DEBUG_EXCEPTION("emcore_get_temp_file_name failed [%d]", err);                       
                                        goto FINISH_OFF;
                                }
                        
@@ -3966,7 +4036,7 @@ static int em_core_get_body_part_imap(MAILSTREAM *stream, int account_id, int ma
                                }
                        }
                }
-               
+
                switch (body->type)  {
                        case TYPETEXT:
                                EM_DEBUG_LOG("TYPETEXT");
@@ -3975,12 +4045,14 @@ static int em_core_get_body_part_imap(MAILSTREAM *stream, int account_id, int ma
                                else  {
                                        cnt_info->text.plain = o_data;
                                        memset(charset_value_buffer, 0, 512);
-                                       if (em_core_get_attribute_value_of_body_part(body->parameter, "CHARSET", charset_value_buffer, 512, true, &err))
+                                       if (emcore_get_attribute_value_of_body_part(body->parameter, "CHARSET", charset_value_buffer, 512, true, &err))
                                                cnt_info->text.plain_charset = EM_SAFE_STRDUP(charset_value_buffer);
                                }
                                break;
                        case TYPEIMAGE:
                        case TYPEAPPLICATION: 
+                       case TYPEAUDIO:
+                       case TYPEVIDEO:
                        /*  Inline Content - suspect of crash on partial body download */
                                if (!is_pbd) {
                                        EM_DEBUG_LOG("TYPEIMAGE or TYPEAPPLICATION  :  inline content");
@@ -3994,41 +4066,33 @@ static int em_core_get_body_part_imap(MAILSTREAM *stream, int account_id, int ma
                                        }
 
                                        /*  add attachment info to content info */
-                                       if (!(*ai = em_core_malloc(sizeof(struct attachment_info))))  {         
-                                               EM_DEBUG_EXCEPTION("em_core_malloc failed...");                                         
+                                       if (!(*ai = em_malloc(sizeof(struct attachment_info))))  {              
+                                               EM_DEBUG_EXCEPTION("em_malloc failed...");                                              
                                                if (err_code != NULL) 
                                                        *err_code = EMF_ERROR_OUT_OF_MEMORY;                    
                                                return FAILURE;         
                                        }       
                                
-                                       memset(*ai, 0, sizeof(struct attachment_info));
-
                                        if (((body->id) || (body->location)) && body->type == TYPEIMAGE)
                                                (*ai)->type = 1;                        /*  inline */
                                        else                    
                                                (*ai)->type = 2;                        /*  attachment */
                                        
-                                       (*ai)->name = EM_SAFE_STRDUP(filename);         
-                                       (*ai)->size = body->size.bytes;         
-                                       (*ai)->save = o_data;
-                                       EM_DEBUG_LOG("file->name[%s], file->size[%d], file->save[%s], file->content_id[%s]", cnt_info->file->name, cnt_info->file->size, cnt_info->file->save);
+                                       (*ai)->name                 = EM_SAFE_STRDUP(filename);
+                                       (*ai)->size                 = body->size.bytes;
+                                       (*ai)->save                 = o_data;
+
+                                       memset(content_type_buffer, 0, 512);
+                                       if ( (err = emcore_get_content_type_from_mail_bodystruct(body, 512, content_type_buffer) ) == EMF_ERROR_NONE)
+                                               (*ai)->attachment_mime_type = EM_SAFE_STRDUP(content_type_buffer);
+
+                                       EM_DEBUG_LOG("name[%s], size[%d], save[%s], content_id[%s], content_type_buffer [%s]", cnt_info->file->name, cnt_info->file->size, cnt_info->file->save, content_type_buffer);
 #ifdef __ATTACHMENT_OPTI__
                                        (*ai)->encoding = body->encoding;
                                        if (body->sparep)
                                                (*ai)->section = EM_SAFE_STRDUP(body->sparep);
-
                                        EM_DEBUG_LOG(" Encoding - %d  Section No - %s ", (*ai)->encoding, (*ai)->section);
 #endif                 
-                                        /*
-                                       if (prev_ai == NULL) {
-                                               (*ai)->next = NULL;
-                                               cnt_info->file = (*ai);
-                                       }
-                                       else {
-                                               prev_ai->next = (*ai);
-                                               (*ai)->next = NULL;
-                                       }
-                                        */
                                }       
                                break;
 
@@ -4097,8 +4161,8 @@ static int em_core_get_body_part_imap(MAILSTREAM *stream, int account_id, int ma
                        EM_DEBUG_LOG(">>>>> ONLY BODY DOWNLOAD [ %d ] ", only_body_download);
 
                        if (only_body_download == false) {
-                               if (!em_core_get_temp_file_name(&savefile, &err))  {
-                                       EM_DEBUG_EXCEPTION("em_core_get_temp_file_name failed [%d]", err);                      
+                               if (!emcore_get_temp_file_name(&savefile, &err))  {
+                                       EM_DEBUG_EXCEPTION("emcore_get_temp_file_name failed [%d]", err);                       
                                        goto FINISH_OFF;
                                }
 
@@ -4114,13 +4178,12 @@ static int em_core_get_body_part_imap(MAILSTREAM *stream, int account_id, int ma
                EM_DEBUG_LOG("attachment (dec)  :  %s %d bytes", filename, dec_len);            
 
                /*  add attachment info to content inf */
-               if (!(*ai = em_core_malloc(sizeof(struct attachment_info))))  {
-                       EM_DEBUG_EXCEPTION("em_core_malloc failed...");
+               if (!(*ai = em_malloc(sizeof(struct attachment_info))))  {
+                       EM_DEBUG_EXCEPTION("em_malloc failed...");
                        err = EMF_ERROR_OUT_OF_MEMORY;
                        goto FINISH_OFF;
                }
 
-               memset((*ai), 0x00, sizeof(struct attachment_info));
                if ((body->id) || (body->location))
                        (*ai)->type = 1;
                else
@@ -4136,17 +4199,20 @@ static int em_core_get_body_part_imap(MAILSTREAM *stream, int account_id, int ma
                                section_html = 0;
                        }
                } /*  is_pbd */
-               (*ai)->name = EM_SAFE_STRDUP(filename);
-               (*ai)->size = dec_len;
-               (*ai)->save = savefile;
+               (*ai)->name                 = EM_SAFE_STRDUP(filename);
+               (*ai)->size                 = dec_len;
+               (*ai)->save                 = savefile;
                
-               #ifdef __ATTACHMENT_OPTI__
+               memset(content_type_buffer, 0, 512);
+               if ( (err = emcore_get_content_type_from_mail_bodystruct(body, 512, content_type_buffer) ) == EMF_ERROR_NONE)
+                       (*ai)->attachment_mime_type = EM_SAFE_STRDUP(content_type_buffer);
+#ifdef __ATTACHMENT_OPTI__
                (*ai)->encoding = body->encoding;
                if (body->sparep)
                        (*ai)->section = EM_SAFE_STRDUP(body->sparep);
 
                EM_DEBUG_LOG(" Encoding - %d  Section No - %s ", (*ai)->encoding, (*ai)->section);
-               #endif          
+#endif
                if (body->type == TYPEAPPLICATION)  {
                        if (!strcasecmp(body->subtype, MIME_SUBTYPE_DRM_OBJECT))
                                (*ai)->drm = EMF_ATTACHMENT_DRM_OBJECT;
@@ -4180,13 +4246,13 @@ FINISH_OFF:
 }
 /*  get body-part in nested part */
 
-static int em_core_get_allnested_part(MAILSTREAM *stream, int account_id, int mail_id, int msg_uid, BODY *body, struct _m_content_info *cnt_info, int *err_code)
+static int emcore_get_allnested_part(MAILSTREAM *stream, int account_id, int mail_id, int msg_uid, BODY *body, struct _m_content_info *cnt_info, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("stream[%p], msg_uid[%d], body[%p], cnt_info[%p], err_code[%p]", stream, msg_uid, body, cnt_info, err_code);
        PART *part_child = body->nested.part;
        
        while (part_child)  {
-               if (em_core_get_body(stream, account_id, mail_id, msg_uid, &part_child->body, cnt_info, err_code) < 0)
+               if (emcore_get_body(stream, account_id, mail_id, msg_uid, &part_child->body, cnt_info, err_code) < 0)
                        return FAILURE;
                
                part_child = part_child->next;
@@ -4197,7 +4263,7 @@ static int em_core_get_allnested_part(MAILSTREAM *stream, int account_id, int ma
 }
 
 /* get body-part in alternative multiple part */
-static int em_core_get_alternative_multi_part(MAILSTREAM *stream, int account_id, int mail_id, int msg_uid, BODY *body, struct _m_content_info *cnt_info, int *err_code)
+static int emcore_get_alternative_multi_part(MAILSTREAM *stream, int account_id, int mail_id, int msg_uid, BODY *body, struct _m_content_info *cnt_info, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("stream[%p], msg_uid[%d], body[%p], cnt_info[%p], err_code[%p]", stream, msg_uid, body, cnt_info, err_code);
        
@@ -4205,7 +4271,7 @@ static int em_core_get_alternative_multi_part(MAILSTREAM *stream, int account_id
 
        /* find the best sub part we can show */
        while (part_child)  {
-               if (em_core_get_body(stream, account_id, mail_id, msg_uid, &part_child->body, cnt_info, err_code) < 0)
+               if (emcore_get_body(stream, account_id, mail_id, msg_uid, &part_child->body, cnt_info, err_code) < 0)
                        return FAILURE;
                
                part_child = part_child->next;
@@ -4215,15 +4281,26 @@ static int em_core_get_alternative_multi_part(MAILSTREAM *stream, int account_id
 }
 
 /* get body part in signed multiple part */
-static int em_core_get_signed_multi_part(MAILSTREAM *stream, int account_id, int mail_id, int msg_uid, BODY *body, struct _m_content_info *cnt_info, int *err_code)
+static int emcore_get_signed_multi_part(MAILSTREAM *stream, int account_id, int mail_id, int msg_uid, BODY *body, struct _m_content_info *cnt_info, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("stream[%p], msg_uid[%d], body[%p], cnt_info[%p], err_code[%p]", stream, msg_uid, body, cnt_info, err_code);
-       EM_DEBUG_FUNC_END();
+
+        PART *part_child = body->nested.part;
+
+        /* find the best sub part we can show */
+        while (part_child)  {
+                if (emcore_get_body(stream, account_id, mail_id, msg_uid, &part_child->body, cnt_info, err_code) < 0)
+                       return FAILURE;
+
+                part_child = part_child->next;
+        }
+
+       EM_DEBUG_FUNC_END();    
        return SUCCESS;
 }
 
 /* get body part in encrypted multiple part */
-static int em_core_get_encrypted_multi_part(MAILSTREAM *stream, int account_id, int mail_id, int msg_uid, BODY *body, struct _m_content_info *cnt_info, int *err_code)
+static int emcore_get_encrypted_multi_part(MAILSTREAM *stream, int account_id, int mail_id, int msg_uid, BODY *body, struct _m_content_info *cnt_info, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("stream[%p], msg_uid[%d], body[%p], cnt_info[%p], err_code[%p]", stream, msg_uid, body, cnt_info, err_code);
        EM_DEBUG_FUNC_END();
@@ -4231,7 +4308,7 @@ static int em_core_get_encrypted_multi_part(MAILSTREAM *stream, int account_id,
 }
 
 /* get body part in multiple part */
-static int em_core_get_multi_part(MAILSTREAM *stream, int account_id, int mail_id, int msg_uid, BODY *body, struct _m_content_info *cnt_info, int *err_code)
+static int emcore_get_multi_part(MAILSTREAM *stream, int account_id, int mail_id, int msg_uid, BODY *body, struct _m_content_info *cnt_info, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("stream[%p], msg_uid[%d], body[%p], cnt_info[%p], err_code[%p]", stream, msg_uid, body, cnt_info, err_code);
 
@@ -4245,32 +4322,32 @@ static int em_core_get_multi_part(MAILSTREAM *stream, int account_id, int mail_i
        switch (body->subtype[0])  {
                case 'A':               /*  ALTERNATIVE */
                        EM_DEBUG_LOG("body->subtype[0] = ALTERNATIVE");
-                       return em_core_get_alternative_multi_part(stream, account_id, mail_id, msg_uid, body, cnt_info, err_code);
+                       return emcore_get_alternative_multi_part(stream, account_id, mail_id, msg_uid, body, cnt_info, err_code);
                
                case 'S':               /*  SIGNED */
                        EM_DEBUG_LOG("body->subtype[0] = SIGNED");
-                       return em_core_get_signed_multi_part(stream, account_id, mail_id, msg_uid, body, cnt_info, err_code);
+                       return emcore_get_signed_multi_part(stream, account_id, mail_id, msg_uid, body, cnt_info, err_code);
                
                case 'E':               /*  ENCRYPTED */
                        EM_DEBUG_LOG("body->subtype[0] = ENCRYPTED");
-                       return em_core_get_encrypted_multi_part(stream, account_id, mail_id, msg_uid, body, cnt_info, err_code);
+                       return emcore_get_encrypted_multi_part(stream, account_id, mail_id, msg_uid, body, cnt_info, err_code);
                
                default:                /*  process all unknown as MIXED (according to the RFC 2047) */
                        EM_DEBUG_LOG("body->subtype[0] = [%c].", body->subtype[0]);
-                       return em_core_get_allnested_part(stream, account_id, mail_id, msg_uid, body, cnt_info, err_code);
+                       return emcore_get_allnested_part(stream, account_id, mail_id, msg_uid, body, cnt_info, err_code);
        }
 
        if  (body->id)
-               EM_DEBUG_LOG("em_core_get_multi_part BODY ID [%s].", body->id);
+               EM_DEBUG_LOG("emcore_get_multi_part BODY ID [%s].", body->id);
        else
-               EM_DEBUG_LOG("em_core_get_multi_part BODY ID NULL.");
+               EM_DEBUG_LOG("emcore_get_multi_part BODY ID NULL.");
        EM_DEBUG_FUNC_END();
        return SUCCESS;
 }
 
 /*  get body data by body structure */
 /*  if POP3, ignored */
-EXPORT_API int em_core_get_body(MAILSTREAM *stream, int account_id, int mail_id, int msg_uid, BODY *body, struct _m_content_info *cnt_info, int *err_code)
+INTERNAL_FUNC int emcore_get_body(MAILSTREAM *stream, int account_id, int mail_id, int msg_uid, BODY *body, struct _m_content_info *cnt_info, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("stream[%p], msg_uid[%d], body[%p], cnt_info[%p], err_code[%p]", stream, msg_uid, body, cnt_info, err_code);
        
@@ -4286,11 +4363,11 @@ EXPORT_API int em_core_get_body(MAILSTREAM *stream, int account_id, int mail_id,
        
        switch (body->type)  {
                case TYPEMULTIPART: 
-                       return em_core_get_multi_part(stream, account_id, mail_id, msg_uid, body, cnt_info, err_code);
+                       return emcore_get_multi_part(stream, account_id, mail_id, msg_uid, body, cnt_info, err_code);
                
                case TYPEMESSAGE:  /*  not support */
                        if (strcasecmp(body->subtype, "RFC822") == 0)
-                               return em_core_get_body_part_imap(stream, account_id, mail_id, msg_uid, body, cnt_info, err_code);
+                               return emcore_get_body_part_imap(stream, account_id, mail_id, msg_uid, body, cnt_info, err_code);
                        break;
                        
                case TYPETEXT:
@@ -4301,7 +4378,7 @@ EXPORT_API int em_core_get_body(MAILSTREAM *stream, int account_id, int mail_id,
                case TYPEMODEL:
                case TYPEOTHER:
                        /*  exactly, get a pure body part (text and attachment */
-                       return em_core_get_body_part_imap(stream, account_id, mail_id, msg_uid, body, cnt_info, err_code);
+                       return emcore_get_body_part_imap(stream, account_id, mail_id, msg_uid, body, cnt_info, err_code);
                
                default: 
                        break;
@@ -4311,7 +4388,7 @@ EXPORT_API int em_core_get_body(MAILSTREAM *stream, int account_id, int mail_id,
 }
 
 /* get body structure */
-EXPORT_API int em_core_get_body_structure(MAILSTREAM *stream, int msg_uid, BODY **body, int *err_code)
+INTERNAL_FUNC int emcore_get_body_structure(MAILSTREAM *stream, int msg_uid, BODY **body, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("stream[%p], msg_uid[%d], body[%p], err_code[%p]", stream, msg_uid, body, err_code);
        
@@ -4331,16 +4408,16 @@ EXPORT_API int em_core_get_body_structure(MAILSTREAM *stream, int msg_uid, BODY
        }
        
 #ifdef FEATURE_CORE_DEBUG
-       _print_body(*body, true); /* shasikala.p@partner.samsung.co */
+       _print_body(*body, true); /* shasikala.p@partner.samsung.com */
 #endif
        EM_DEBUG_FUNC_END();
        return SUCCESS;
 }
 
-int em_core_set_fetch_part_section(BODY *body, char *section_pfx, int section_subno, int enable_inline_list, int *total_mail_size, int *err_code);
+int emcore_set_fetch_part_section(BODY *body, char *section_pfx, int section_subno, int enable_inline_list, int *total_mail_size, int *err_code);
 
 /* set body section to be fetched */
-EXPORT_API int em_core_set_fetch_body_section(BODY *body, int enable_inline_list, int *total_mail_size, int *err_code)
+INTERNAL_FUNC int emcore_set_fetch_body_section(BODY *body, int enable_inline_list, int *total_mail_size, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("body[%p], err_code[%p]", body, err_code);
 
@@ -4351,11 +4428,11 @@ EXPORT_API int em_core_set_fetch_body_section(BODY *body, int enable_inline_list
                return FAILURE;
        }
        
-       body->id = cpystr("1"); /*  top level bod */
+       body->id = cpystr("1"); /*  top level body */
        
        g_inline_count = 0;
        EM_SAFE_FREE(g_inline_list);
-       em_core_set_fetch_part_section(body, (char *)NULL, 0, enable_inline_list, total_mail_size, err_code);
+       emcore_set_fetch_part_section(body, (char *)NULL, 0, enable_inline_list, total_mail_size, err_code);
        
        if (body->id && body)
                EM_DEBUG_LOG(">>>>> FILE NAME [ %s ] ", body->id);
@@ -4367,7 +4444,7 @@ EXPORT_API int em_core_set_fetch_body_section(BODY *body, int enable_inline_list
 }
 
 /* set part section of body to be fetched */
-int em_core_set_fetch_part_section(BODY *body, char *section_pfx, int section_subno, int enable_inline_list, int *total_mail_size, int *err_code)
+int emcore_set_fetch_part_section(BODY *body, char *section_pfx, int section_subno, int enable_inline_list, int *total_mail_size, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("body[%p], section_pfx[%s], section_subno[%d], err_code[%p]", body, section_pfx, section_subno, err_code);
        
@@ -4385,7 +4462,7 @@ int em_core_set_fetch_part_section(BODY *body, char *section_pfx, int section_su
                }
 
                for (section_subno = 0, part = body->nested.part; part; part = part->next)
-                       em_core_set_fetch_part_section(&part->body, section, section_subno++, enable_inline_list, total_mail_size, err_code);
+                       emcore_set_fetch_part_section(&part->body, section, section_subno++, enable_inline_list, total_mail_size, err_code);
        }
        else  {
                if (!section_pfx) /* dummy prefix if top level */
@@ -4421,11 +4498,11 @@ int em_core_set_fetch_part_section(BODY *body, char *section_pfx, int section_su
                if ((body->type == TYPEMESSAGE) && !strcasecmp(body->subtype, "RFC822") && (body = ((MESSAGE *)body->nested.msg)->body))  {
                        if (body->type == TYPEMULTIPART) {
                                section[0] = '\0';
-                               em_core_set_fetch_part_section(body, section, section_subno-1, enable_inline_list, total_mail_size, err_code);
+                               emcore_set_fetch_part_section(body, section, section_subno-1, enable_inline_list, total_mail_size, err_code);
                        }
                        else  {         /*  build encapsulation prefi */
                                SNPRINTF(section, sizeof(section), "%s%d.", section_pfx, section_subno);
-                               em_core_set_fetch_part_section(body, section, 0, enable_inline_list, total_mail_size, err_code);
+                               emcore_set_fetch_part_section(body, section, 0, enable_inline_list, total_mail_size, err_code);
                        }
                }
                else  {
@@ -4459,7 +4536,7 @@ static void parse_file_path_to_filename(char *src_string, char **out_string)
        EM_SAFE_FREE(filepath);
 }
 
-static char *em_core_decode_rfc2047_word(char *encoded_word, int *err_code)
+static char *emcore_decode_rfc2047_word(char *encoded_word, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("encoded_word[%s], err_code[%p]", encoded_word, err_code);
 
@@ -4470,7 +4547,7 @@ static char *em_core_decode_rfc2047_word(char *encoded_word, int *err_code)
        gchar *charset = NULL, *encoded_text = NULL;
        char *decoded_text = NULL, *decoded_word = NULL;
        char *current = NULL, *start = NULL, *end = NULL;
-       char *buffer = (char*) em_core_malloc(strlen(encoded_word) * 2 + 1);
+       char *buffer = (char*) em_malloc(strlen(encoded_word) * 2 + 1);
 
        if (buffer == NULL) {
                EM_DEBUG_EXCEPTION("Memory allocation fail");
@@ -4532,7 +4609,7 @@ static char *em_core_decode_rfc2047_word(char *encoded_word, int *err_code)
                                                        encoded_text = g_strndup(p + 3, end - (p + 3));
                                                }
                                                else {  /*  end flag is not found */
-                                                       EM_DEBUG_EXCEPTION("em_core_decode_rfc2047_word decoding error : '?=' is not found...");
+                                                       EM_DEBUG_EXCEPTION("emcore_decode_rfc2047_word decoding error : '?=' is not found...");
                                                        
                                                        err = EMF_ERROR_UNKNOWN;
                                                        goto FINISH_OFF;
@@ -4639,7 +4716,7 @@ FINISH_OFF:
        return decoded_word;
 }
 
-EXPORT_API char *em_core_decode_rfc2047_text(char *rfc2047_text, int *err_code)
+INTERNAL_FUNC char *emcore_decode_rfc2047_text(char *rfc2047_text, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("rfc2047_text[%s], err_code[%p]", rfc2047_text, err_code);
        
@@ -4664,8 +4741,8 @@ EXPORT_API char *em_core_decode_rfc2047_text(char *rfc2047_text, int *err_code)
                int i = 0;
                
                while (encoded_words[i] != NULL)  {
-                       if (!(decoded_words[i] = em_core_decode_rfc2047_word(encoded_words[i], &err)))  {
-                               EM_DEBUG_EXCEPTION("em_core_decode_rfc2047_word falied [%d]", err);
+                       if (!(decoded_words[i] = emcore_decode_rfc2047_word(encoded_words[i], &err)))  {
+                               EM_DEBUG_EXCEPTION("emcore_decode_rfc2047_word falied [%d]", err);
                                goto FINISH_OFF;
                        }
                        
@@ -4675,32 +4752,6 @@ EXPORT_API char *em_core_decode_rfc2047_text(char *rfc2047_text, int *err_code)
        }
        else
                text = EM_SAFE_STRDUP(rfc2047_text);
-
-       /* Exceptional ... EUC-KR handling */   {
-               gsize bytes_read, bytes_written;
-               GError *glib_error = NULL;
-               int i = 0, has_special_character = 0;
-               char *utf8_encoded_string = NULL;
-
-               while(text[i]) {
-                       if(text[i++] & 0x80) {
-                               has_special_character = 1;
-                               break;
-                       }
-               }
-               EM_DEBUG_LOG("has_special_character [%d]", has_special_character);
-
-               if(has_special_character) /* It might be euc-kr. It should be encoded as UTF-8 */ {
-                       utf8_encoded_string = (char*)g_convert (text, -1, "UTF-8", "EUC-KR", &bytes_read, &bytes_written, &glib_error);
-                       if(utf8_encoded_string) {
-                               EM_DEBUG_LOG("utf8_encoded_string [%s]", utf8_encoded_string);
-                               EM_SAFE_FREE(text);
-                               text = EM_SAFE_STRDUP(utf8_encoded_string);
-                       }
-                       else 
-                               EM_DEBUG_EXCEPTION("g_convert failed");
-               }
-       }
        
 #ifdef FEATURE_CORE_DEBUG
        EM_DEBUG_LOG(">>>>>>>>>>>>>>>>> TEXT[%s]", text);
similarity index 85%
rename from email-core/em-core-mm-callbacks.c
rename to email-core/email-core-mm-callbacks.c
index ec3a7e4..746e282 100755 (executable)
@@ -21,7 +21,7 @@
 
 
 /******************************************************************************
- * File :  em-core-mm_callbacks.c
+ * File :  email-core-mm_callbacks.c
  * Desc :  mm_callbacks for IMAP-2004g
  *
  * Auth :  
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include "em-core-types.h"
+#include "email-internal-types.h"
 #include "c-client.h"
-#include "em-core-global.h"
-#include "em-core-utils.h"
-#include "emf-dbglog.h"
-#include "em-core-mailbox.h"
-#include "em-core-account.h"
+#include "email-core-global.h"
+#include "email-core-utils.h"
+#include "email-debug-log.h"
+#include "email-core-mailbox.h"
+#include "email-core-account.h"
 
 static void mm_get_error(char *string, int *err_code);
 
@@ -46,7 +46,7 @@ static void mm_get_error(char *string, int *err_code);
  * callback mm_lsub
  *             get subscribed mailbox list
  */
-EXPORT_API void mm_lsub(MAILSTREAM *stream, int delimiter, char *mailbox, long attributes)
+INTERNAL_FUNC void mm_lsub(MAILSTREAM *stream, int delimiter, char *mailbox, long attributes)
 {
        EM_DEBUG_FUNC_BEGIN();
        emf_callback_holder_t *p_holder = (emf_callback_holder_t *)stream->sparep;
@@ -63,7 +63,7 @@ EXPORT_API void mm_lsub(MAILSTREAM *stream, int delimiter, char *mailbox, long a
        if (enc_path)   
                enc_path += 1;
        else {
-               em_core_mailbox_free(&p, count+1, NULL);                                
+               emcore_free_mailbox(&p, count+1, NULL);                         
                return ;
        }
 
@@ -99,7 +99,7 @@ EXPORT_API void mm_lsub(MAILSTREAM *stream, int delimiter, char *mailbox, long a
  * callback mm_lsub
  * get mailbox list
  */
-EXPORT_API void mm_list(MAILSTREAM *stream, int delimiter, char *mailbox, long attributes)
+INTERNAL_FUNC void mm_list(MAILSTREAM *stream, int delimiter, char *mailbox, long attributes)
 {
        EM_DEBUG_FUNC_BEGIN();
        emf_callback_holder_t *p_holder = (emf_callback_holder_t *)stream->sparep;
@@ -116,7 +116,7 @@ EXPORT_API void mm_list(MAILSTREAM *stream, int delimiter, char *mailbox, long a
        if (enc_path)   
                enc_path += 1;
        else {
-               em_core_mailbox_free(&p, count+1, NULL);
+               emcore_free_mailbox(&p, count+1, NULL);
                return ;
        }
 
@@ -155,7 +155,7 @@ EXPORT_API void mm_list(MAILSTREAM *stream, int delimiter, char *mailbox, long a
  * callback mm_status
  * get mailbox status
  */
-EXPORT_API void mm_status(MAILSTREAM *stream, char *mailbox, MAILSTATUS* status)
+INTERNAL_FUNC void mm_status(MAILSTREAM *stream, char *mailbox, MAILSTATUS* status)
 {
        EM_DEBUG_FUNC_BEGIN();
        emf_callback_holder_t *p = stream->sparep;
@@ -172,7 +172,7 @@ EXPORT_API void mm_status(MAILSTREAM *stream, char *mailbox, MAILSTATUS* status)
  * get user_name and password
  */
 
-EXPORT_API void mm_login(NETMBX *mb, char *user, char *pwd, long trial)
+INTERNAL_FUNC void mm_login(NETMBX *mb, char *user, char *pwd, long trial)
 {
        EM_DEBUG_FUNC_BEGIN();
        int account_id;
@@ -187,10 +187,10 @@ EXPORT_API void mm_login(NETMBX *mb, char *user, char *pwd, long trial)
        
        account_id = atoi(mb->user);
 
-       ref_account = em_core_get_account_reference(account_id);
+       ref_account = emcore_get_account_reference(account_id);
 
        if (!ref_account)  {
-               EM_DEBUG_EXCEPTION("em_core_get_account_reference failed");
+               EM_DEBUG_EXCEPTION("emcore_get_account_reference failed");
                return;
        }
 
@@ -222,7 +222,7 @@ EXPORT_API void mm_login(NETMBX *mb, char *user, char *pwd, long trial)
 }
 
 
-EXPORT_API void mm_dlog(char *string)
+INTERNAL_FUNC void mm_dlog(char *string)
 {
 #ifdef FEATURE_CORE_DEBUG
        EM_DEBUG_LOG("IMAP_TOOLKIT_DLOG [%s]", string);
@@ -237,7 +237,7 @@ EXPORT_API void mm_dlog(char *string)
 #endif
 }
 
-EXPORT_API void mm_log(char *string, long errflg)
+INTERNAL_FUNC void mm_log(char *string, long errflg)
 {
        /* EM_DEBUG_FUNC_BEGIN(); */
        
@@ -267,7 +267,7 @@ EXPORT_API void mm_log(char *string, long errflg)
                        
                        EM_DEBUG_EXCEPTION("IMAP_TOOLKIT_LOG ERROR [%s]", string);
 
-                       em_core_get_current_session(&session);
+                       emcore_get_current_session(&session);
                        
                        if (session) {
                                mm_get_error(string, &session->error);
@@ -293,50 +293,50 @@ EXPORT_API void mm_log(char *string, long errflg)
        }
 }
 
-EXPORT_API void mm_searched(MAILSTREAM *stream, unsigned long number)
+INTERNAL_FUNC void mm_searched(MAILSTREAM *stream, unsigned long number)
 {
        EM_DEBUG_FUNC_BEGIN("stream [%p], number [%d]", stream, number);
        EM_DEBUG_FUNC_END();
 }
 
-EXPORT_API void mm_exists(MAILSTREAM *stream, unsigned long number)
+INTERNAL_FUNC void mm_exists(MAILSTREAM *stream, unsigned long number)
 {
        EM_DEBUG_FUNC_BEGIN("stream [%p], number [%d]", stream, number);
        EM_DEBUG_FUNC_END();
 }
 
-EXPORT_API void mm_expunged(MAILSTREAM *stream, unsigned long number)
+INTERNAL_FUNC void mm_expunged(MAILSTREAM *stream, unsigned long number)
 {
        EM_DEBUG_FUNC_BEGIN("stream [%p], number [%d]", stream, number);
        EM_DEBUG_FUNC_END();
 }
 
-EXPORT_API void mm_flags(MAILSTREAM *stream, unsigned long number)
+INTERNAL_FUNC void mm_flags(MAILSTREAM *stream, unsigned long number)
 {
        EM_DEBUG_FUNC_BEGIN("stream [%p], number [%d]", stream, number);
        EM_DEBUG_FUNC_END();
 }
 
-EXPORT_API void mm_notify(MAILSTREAM *stream, char *string, long errflg)
+INTERNAL_FUNC void mm_notify(MAILSTREAM *stream, char *string, long errflg)
 {
        EM_DEBUG_FUNC_BEGIN();
        mm_log(string, errflg);
        EM_DEBUG_FUNC_END();
 }
 
-EXPORT_API void mm_critical(MAILSTREAM *stream)
+INTERNAL_FUNC void mm_critical(MAILSTREAM *stream)
 {
        EM_DEBUG_FUNC_BEGIN("stream [%p]", stream);
        EM_DEBUG_FUNC_END();
 }
 
-EXPORT_API void mm_nocritical(MAILSTREAM *stream)
+INTERNAL_FUNC void mm_nocritical(MAILSTREAM *stream)
 {
        EM_DEBUG_FUNC_BEGIN("stream [%p]", stream);
        EM_DEBUG_FUNC_END();
 }
 
-EXPORT_API long mm_diskerror(MAILSTREAM *stream, long errcode, long serious)
+INTERNAL_FUNC long mm_diskerror(MAILSTREAM *stream, long errcode, long serious)
 {
        EM_DEBUG_FUNC_BEGIN("stream [%p] errcode[%d] serious[%d]", stream, errcode, serious);
 #if UNIXLIKE
@@ -348,12 +348,12 @@ EXPORT_API long mm_diskerror(MAILSTREAM *stream, long errcode, long serious)
        return NIL;
 }
 
-EXPORT_API void mm_fatal(char *string)
+INTERNAL_FUNC void mm_fatal(char *string)
 {
        EM_DEBUG_EXCEPTION("%s", string);
 }
 
-EXPORT_API void mm_get_error(char *string, int *err_code)
+INTERNAL_FUNC void mm_get_error(char *string, int *err_code)
 {
        if (!string || !err_code)
                return ;
similarity index 51%
rename from email-core/em-core-smtp.c
rename to email-core/email-core-smtp.c
index de370ef..4d098f1 100755 (executable)
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <time.h>
-#include "em-core-types.h"
+#include "email-internal-types.h"
 #include "c-client.h"
-#include "em-core-global.h"
-#include "em-core-utils.h"
-#include "em-storage.h"
-#include "em-core-api.h"
-#include "em-core-smtp.h"
-#include "em-core-event.h"
-#include "em-core-mailbox.h"
-#include "em-core-mesg.h"
-#include "em-core-mime.h"
-#include "em-core-account.h" 
-#include "em-core-imap-mailbox.h"
-#include "em-core-mailbox-sync.h"
-#include "Msg_Convert.h"
+#include "email-core-global.h"
+#include "email-core-utils.h"
+#include "email-storage.h"
+#include "email-core-api.h"
+#include "email-core-smtp.h"
+#include "email-core-event.h"
+#include "email-core-mailbox.h"
+#include "email-core-mail.h"
+#include "email-core-mime.h"
+#include "email-core-account.h" 
+#include "email-core-imap-mailbox.h"
+#include "email-core-mailbox-sync.h"
+#include "email-utilities.h"
+#include "email-convert.h"
 
 
 #include <unistd.h>
-#include "emf-dbglog.h"
+#include "email-debug-log.h"
 
 
+static int emcore_get_report_mail_body(ENVELOPE *envelope, BODY **multipart_body, int *err_code);
+static int emcore_send_mail_smtp(SENDSTREAM *stream, ENVELOPE *env, char *data_file, int account_id, int mail_id,  int *err_code);
+
 /* Functions from uw-imap-toolkit */
 /* extern void *fs_get(size_t size); */
 extern void rfc822_date(char *date);
-extern long smtp_soutr(void *stream, char *s);
 extern long smtp_send(SENDSTREAM *stream, char *command, char *args);
 extern long smtp_rcpt(SENDSTREAM *stream, ADDRESS *adr, long* error);
 
+#ifndef __FEATURE_SEND_OPTMIZATION__
+extern long smtp_soutr(void *stream, char *s);
+#endif
+
 #ifdef __FEATURE_SEND_OPTMIZATION__
 extern long smtp_soutr_test(void *stream, char *s);
 #endif
 
 
-static int em_core_mail_get_report_body(ENVELOPE *envelope, BODY **multipart_body, int *err_code);
-static int em_core_mail_send_smtp(SENDSTREAM *stream, ENVELOPE *env, char *data_file, int account_id, int mail_id,  int *err_code);
+
 
 void mail_send_notify(emf_send_status_t status, int total, int sent, int account_id, int mail_id,  int err_code)
 {
@@ -76,7 +82,7 @@ void mail_send_notify(emf_send_status_t status, int total, int sent, int account
                default:
                        break;
        }
-       em_core_execute_event_callback(EMF_ACTION_SEND_MAIL, total, sent, status, account_id, mail_id, -1, err_code);
+       emcore_execute_event_callback(EMF_ACTION_SEND_MAIL, total, sent, status, account_id, mail_id, -1, err_code);
        EM_DEBUG_FUNC_END();
 }
 
@@ -92,7 +98,7 @@ long buf_flush(void *stream, char *string)
 #define RFC822_READ_BLOCK_SIZE   1024
 #define RFC822_STRING_BUFFER_SIZE 1536
 
-static char *em_core_find_img_tag(char *source_string)
+static char *emcore_find_img_tag(char *source_string)
 {
        EM_DEBUG_FUNC_BEGIN("source_string[%p]", source_string);
        
@@ -119,7 +125,7 @@ static char *em_core_find_img_tag(char *source_string)
 }
 
 #define CONTENT_ID_BUFFER_SIZE 512
-static char *em_core_replace_inline_image_path_with_content_id(char *source_string, BODY *html_body, int *err_code)
+static char *emcore_replace_inline_image_path_with_content_id(char *source_string, BODY *html_body, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("source_string[%p], html_body[%p], err_code[%p]", source_string, html_body, err_code);
 
@@ -148,11 +154,11 @@ static char *em_core_replace_inline_image_path_with_content_id(char *source_stri
                                if (cur_body->id) {
                                        EM_SAFE_STRNCPY(content_id_buffer, cur_body->id + 1, CONTENT_ID_BUFFER_SIZE - 1); /*  Removing <, > */
                                        content_id_buffer[strlen(content_id_buffer) - 1] = NULL_CHAR;
-                                       /* if (em_core_get_attribute_value_of_body_part(cur_body->parameter, "name", file_name_buffer, CONTENT_ID_BUFFER_SIZE, false, &err)) { */
-                                       if (em_core_get_attribute_value_of_body_part(cur_body->parameter, "name", file_name_buffer, CONTENT_ID_BUFFER_SIZE, true, &err)) {
+                                       /* if (emcore_get_attribute_value_of_body_part(cur_body->parameter, "name", file_name_buffer, CONTENT_ID_BUFFER_SIZE, false, &err)) { */
+                                       if (emcore_get_attribute_value_of_body_part(cur_body->parameter, "name", file_name_buffer, CONTENT_ID_BUFFER_SIZE, true, &err)) {
                                                EM_DEBUG_LOG("Content-ID[%s], filename[%s]", content_id_buffer, file_name_buffer);
                                                SNPRINTF(new_string, CONTENT_ID_BUFFER_SIZE, "cid:%s", content_id_buffer);
-                                               result_string = em_core_replace_string(input_string, file_name_buffer, new_string);
+                                               result_string = em_replace_string(input_string, file_name_buffer, new_string);
                                                if (input_string)
                                                        EM_SAFE_FREE(input_string);
                                        }
@@ -176,7 +182,7 @@ FINISH_OFF:
        return result_string;
 }
 
-static int em_core_write_rfc822_body(BODY *body, BODY *html_body, FILE *fp, int *err_code)
+static int emcore_write_rfc822_body(BODY *body, BODY *html_body, FILE *fp, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("body[%p], html_body[%p], fp[%p], err_code[%p]", body, html_body, fp, err_code);
        
@@ -205,7 +211,7 @@ static int em_core_write_rfc822_body(BODY *body, BODY *html_body, FILE *fp, int
                                fprintf(fp, "--%s"CRLF_STRING, bndry);
                                fprintf(fp, "%s"CRLF_STRING, buf);
                                
-                               em_core_write_rfc822_body(&part->body, html_body, fp, err_code);
+                               emcore_write_rfc822_body(&part->body, html_body, fp, err_code);
                        } while ((part = part->next));
                        
                        fprintf(fp, "--%s--"CRLF_STRING, bndry);
@@ -269,18 +275,18 @@ static int em_core_write_rfc822_body(BODY *body, BODY *html_body, FILE *fp, int
                                /*  EM_DEBUG_LOG("body->type[%d], body->subtype[%c]", body->type, body->subtype[0]); */
                                if (body->type == TYPETEXT && (body->subtype && (body->subtype[0] == 'H' || body->subtype[0] == 'h'))) {   
                                        EM_DEBUG_LOG("HTML Part");
-                                       img_tag_pos = em_core_find_img_tag(buf);
+                                       img_tag_pos = emcore_find_img_tag(buf);
 
                                        if (img_tag_pos) {
-                                               replaced_string = em_core_replace_inline_image_path_with_content_id(buf, html_body, &error);
+                                               replaced_string = emcore_replace_inline_image_path_with_content_id(buf, html_body, &error);
                                                if (replaced_string) {
-                                                       EM_DEBUG_LOG("em_core_replace_inline_image_path_with_content_id succeeded");
+                                                       EM_DEBUG_LOG("emcore_replace_inline_image_path_with_content_id succeeded");
                                                        strcpy(buf, replaced_string);
                                                        nread = len = strlen(buf);
                                                        EM_DEBUG_LOG("buf[%s], nread[%d], len[%d]", buf, nread, len);
                                                }
                                                else
-                                                       EM_DEBUG_LOG("em_core_replace_inline_image_path_with_content_id failed[%d]", error);
+                                                       EM_DEBUG_LOG("emcore_replace_inline_image_path_with_content_id failed[%d]", error);
                                        }
                                }
 
@@ -326,7 +332,7 @@ static int em_core_write_rfc822_body(BODY *body, BODY *html_body, FILE *fp, int
        return true;
 }
 
-static int em_core_write_rfc822(ENVELOPE *env, BODY *body, BODY *html_body, emf_extra_flag_t flag, char **data, int *err_code)
+static int emcore_write_rfc822(ENVELOPE *env, BODY *body, BODY *html_body, emf_extra_flag_t flag, char **data, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("env[%p], body[%p], data[%p], err_code[%p]", env, body, data, err_code);
        
@@ -351,7 +357,7 @@ static int em_core_write_rfc822(ENVELOPE *env, BODY *body, BODY *html_body, emf_
        /*  FIXME : create memory map for this file */
        p_len = (env->subject ? strlen(env->subject) : 0) + 8192;
        
-       if (!(p = em_core_malloc(p_len)))  {            /* (env->subject ? strlen(env->subject) : 0) + 8192))) */
+       if (!(p = em_malloc(p_len)))  {         /* (env->subject ? strlen(env->subject) : 0) + 8192))) */
                EM_DEBUG_EXCEPTION(" malloc failed...");
                error = EMF_ERROR_OUT_OF_MEMORY;
                goto FINISH_OFF;
@@ -453,8 +459,8 @@ static int em_core_write_rfc822(ENVELOPE *env, BODY *body, BODY *html_body, emf_
        
        SNPRINTF(p + strlen(p), p_len-(strlen(p)), CRLF_STRING);
        
-       if (!em_core_get_temp_file_name(&fname, &error))  {
-               EM_DEBUG_EXCEPTION(" em_core_get_temp_file_name failed[%d]", error);
+       if (!emcore_get_temp_file_name(&fname, &error))  {
+               EM_DEBUG_EXCEPTION(" emcore_get_temp_file_name failed[%d]", error);
                goto FINISH_OFF;
        }
        
@@ -467,8 +473,8 @@ static int em_core_write_rfc822(ENVELOPE *env, BODY *body, BODY *html_body, emf_
        fprintf(fp, "%s", p);
        
        if (body)  {
-               if (!em_core_write_rfc822_body(body, html_body, fp, &error))  {
-                       EM_DEBUG_EXCEPTION("em_core_write_rfc822_body failed[%d]", error);
+               if (!emcore_write_rfc822_body(body, html_body, fp, &error))  {
+                       EM_DEBUG_EXCEPTION("emcore_write_rfc822_body failed[%d]", error);
                        goto FINISH_OFF;
                }
        }
@@ -481,7 +487,7 @@ FINISH_OFF:
                fclose(fp);
 
 #ifdef USE_SYNC_LOG_FILE
-       em_storage_copy_file(fname, "/tmp/phone2pc.eml", false, NULL);  
+       emstorage_copy_file(fname, "/tmp/phone2pc.eml", false, NULL);   
 #endif
        
        if (ret == true)
@@ -499,478 +505,20 @@ FINISH_OFF:
        return ret;
 }
 
-static int em_core_set_current_time_to_mail_header(emf_mail_head_t *head, int *err)
+INTERNAL_FUNC int emcore_add_mail(emf_mail_data_t *input_mail_data, emf_attachment_data_t *input_attachment_data_list, int input_attachment_count, emf_meeting_request_t *input_meeting_request, int input_from_eas)
 {
-       EM_DEBUG_FUNC_BEGIN("head[%p], err [%p]", head, err);
-       
-       int err_code = EMF_ERROR_NONE, ret = false;
-       time_t t = time(NULL);
-       struct tm *p_tm = NULL;         
-       
-       if(!head) {
-               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
-               err_code = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-
-       p_tm = gmtime(&t);
-
-       if (!p_tm)  {
-               EM_DEBUG_EXCEPTION("localtime failed...");
-               err_code = EMF_ERROR_SYSTEM_FAILURE;
-               goto FINISH_OFF;
-       }
-       
-       head->datetime.year   = p_tm->tm_year + 1900;
-       head->datetime.month  = p_tm->tm_mon + 1;
-       head->datetime.day    = p_tm->tm_mday;
-       head->datetime.hour   = p_tm->tm_hour;
-       head->datetime.minute = p_tm->tm_min;
-       head->datetime.second = p_tm->tm_sec;
-
-       ret = true;
-
-FINISH_OFF:
-
-       if(err)
-               *err = err_code;
-
-       EM_DEBUG_FUNC_END();
-       return ret;
-}
-
-
-
-EXPORT_API int em_core_mail_save(int account_id, char *mailbox_name, emf_mail_t *mail_src, emf_meeting_request_t *meeting_req, int from_composer, int *err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("account_id[%d], mailbox_name[%p], mail_src[%p], from_composer[%d], err_code[%p]", account_id, mailbox_name, mail_src, from_composer, err_code);
-       
-       int ret = false, err = EMF_ERROR_NONE;
-       int attachment_id = 0, mail_id = 0, thread_id = -1, thread_item_count = 0, latest_mail_id_in_thread = -1;
-       int rule_len, rule_matched = -1, local_attachment_count = 0, local_inline_content_count = 0;
-       char *ext = NULL, *mailbox_name_spam = NULL, *mailbox_name_target = NULL;
-       char name_buf[MAX_PATH] = {0x00, }, html_body[MAX_PATH] = {0x00, };
-       char datetime[DATETIME_LENGTH] = { 0, };
-       emf_mail_tbl_t *mail_table_data = NULL;
-       emf_mailbox_tbl_t *mailbox_tbl_data = NULL;
-       emf_attachment_info_t *atch = NULL;
-       emf_mail_account_tbl_t *account_tbl_item = NULL;
-       emf_mail_rule_tbl_t *rule = NULL;
-       emf_mail_attachment_tbl_t attachment_tbl = { 0 };
-       struct stat st_buf = { 0 };
-
-       /* Validating parameters */
-       
-       if (!account_id || !mailbox_name || !mail_src || !mail_src->info || !mail_src->head)  { 
-               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-
-       if (!em_storage_get_account_by_id(account_id, EMF_ACC_GET_OPT_DEFAULT | EMF_ACC_GET_OPT_OPTIONS, &account_tbl_item, true, &err)) {
-               EM_DEBUG_EXCEPTION("em_storage_get_account_by_id failed. account_id[%d] err[%d]", account_id, err);
-               err = EMF_ERROR_INVALID_ACCOUNT;
-               goto FINISH_OFF;
-       }
-
-       if (from_composer) {
-               if (!mail_src->head->from) 
-                       mail_src->head->from = EM_SAFE_STRDUP(account_tbl_item->email_addr);
-
-               /* check for email_address validation */
-               if (!em_core_verify_email_address_of_mail_header(mail_src->head, false, &err)) {
-                       EM_DEBUG_EXCEPTION("em_core_verify_email_address_of_mail_header failed [%d]", err);
-                       goto FINISH_OFF;
-               }
-               
-               if (mail_src->info->extra_flags.report == EMF_MAIL_REPORT_MDN)  {       
-                       /* check read-report mail */
-                       if(!mail_src->head->to) { /* A report mail should have 'to' address */
-                               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
-                               err = EMF_ERROR_INVALID_PARAM;
-                               goto FINISH_OFF;
-                       }
-                       /* Create report mail body */
-                       if (!em_core_mail_get_rfc822(mail_src, NULL, NULL, NULL, &err))  {
-                               EM_DEBUG_EXCEPTION("em_core_mail_get_rfc822 failed [%d]", err);
-                               goto FINISH_OFF;
-                       }
-               }
-
-               mailbox_name_target = EM_SAFE_STRDUP(mailbox_name);
-       }
-       else {  /*  For Spam handling */
-               emf_option_t *opt = &account_tbl_item->options;
-               EM_DEBUG_LOG("block_address [%d], block_subject [%d]", opt->block_address, opt->block_subject);
-               
-               if (opt->block_address || opt->block_subject)  {
-                       int is_completed = false;
-                       int type = 0;
-                       
-                       if (!opt->block_address)
-                               type = EMF_FILTER_SUBJECT;
-                       else if (!opt->block_subject)
-                               type = EMF_FILTER_FROM;
-                       
-                       if (!em_storage_get_rule(ALL_ACCOUNT, type, 0, &rule_len, &is_completed, &rule, true, &err) || !rule) 
-                               EM_DEBUG_LOG("No proper rules. em_storage_get_rule returnes [%d]", err);
-               }
-
-               if (rule) {
-                       if (!em_storage_get_mailboxname_by_mailbox_type(account_id, EMF_MAILBOX_TYPE_SPAMBOX, &mailbox_name_spam, false, &err))  {
-                               EM_DEBUG_EXCEPTION("em_storage_get_mailboxname_by_mailbox_type failed [%d]", err);
-                               err = em_storage_get_emf_error_from_em_storage_error(err);
-                               mailbox_name_spam = NULL;
-                       }
-
-                       if (mailbox_name_spam && !em_core_mail_check_rule(mail_src->head, rule, rule_len, &rule_matched, &err))  {
-                               EM_DEBUG_EXCEPTION("em_core_mail_check_rule failed [%d]", err);
-                               goto FINISH_OFF;
-                       }
-               }
-
-               if (rule_matched >= 0 && mailbox_name_spam) 
-                       mailbox_name_target = EM_SAFE_STRDUP(mailbox_name_spam);
-               else
-                       mailbox_name_target = EM_SAFE_STRDUP(mailbox_name);
-       }
-       
-       if (!em_storage_get_mailbox_by_name(account_id, -1, mailbox_name_target, (emf_mailbox_tbl_t **)&mailbox_tbl_data, false, &err)) {
-               EM_DEBUG_EXCEPTION("em_storage_get_mailboxname_by_mailbox_type failed [%d]", err);              
-               err = em_storage_get_emf_error_from_em_storage_error(err);
-               goto FINISH_OFF;
-       }
-
-       if (!em_storage_increase_mail_id(&mail_id, true, &err)) {
-               EM_DEBUG_EXCEPTION("em_storage_increase_mail_id failed [%d]", err);
-               goto FINISH_OFF;
-       }
-
-       mail_table_data = (emf_mail_tbl_t  *)em_core_malloc(sizeof(emf_mail_tbl_t));
-
-       if(!mail_table_data) {
-               EM_DEBUG_EXCEPTION("em_core_malloc failed");
-               err = EMF_ERROR_OUT_OF_MEMORY;
-               goto FINISH_OFF;
-       }
-
-       mail_table_data->account_id           = account_id;
-       mail_table_data->mail_id              = mail_id;
-       mail_table_data->mailbox_name         = EM_SAFE_STRDUP(mailbox_name_target);
-       mail_table_data->mail_size            = mail_src->info->rfc822_size;
-       mail_table_data->server_mail_status   = !from_composer;
-       mail_table_data->server_mail_id       = EM_SAFE_STRDUP(mail_src->info->sid);
-       mail_table_data->full_address_from    = EM_SAFE_STRDUP(mail_src->head->from);
-       mail_table_data->full_address_to      = EM_SAFE_STRDUP(mail_src->head->to);
-       mail_table_data->full_address_cc      = EM_SAFE_STRDUP(mail_src->head->cc);
-       mail_table_data->full_address_bcc     = EM_SAFE_STRDUP(mail_src->head->bcc);
-       mail_table_data->full_address_reply   = EM_SAFE_STRDUP(mail_src->head->reply_to);
-       mail_table_data->full_address_return  = EM_SAFE_STRDUP(mail_src->head->return_path);
-       mail_table_data->subject              = EM_SAFE_STRDUP(mail_src->head->subject);
-       mail_table_data->body_download_status = mail_src->info->extra_flags.text_download_yn;   
-       mail_table_data->mailbox_type         = mailbox_tbl_data->mailbox_type;
-
-       em_core_fill_address_information_of_mail_tbl(mail_table_data);
-
-       EM_DEBUG_LOG("mail_table_data->mail_size [%d]", mail_table_data->mail_size);
-       if(mail_table_data->mail_size == 0)
-               mail_table_data->mail_size = em_core_get_mail_size(mail_src, &err); /*  Getting file size before file moved.  */
-       if (mail_src->body)  {  
-               if (from_composer || mail_table_data->body_download_status) {
-                       if (!em_storage_create_dir(account_id, mail_id, 0, &err))  {
-                               EM_DEBUG_EXCEPTION("em_storage_create_dir failed [%d]", err);
-                               goto FINISH_OFF;
-                       }
-
-                       if (mail_src->body->plain) {
-                               EM_DEBUG_LOG("mail_src->body->plain [%s]", mail_src->body->plain);
-                               if (!em_storage_get_save_name(account_id, mail_id, 0, mail_src->body->plain_charset ? mail_src->body->plain_charset  :  "UTF-8", name_buf, &err))  {
-                                       EM_DEBUG_EXCEPTION("em_storage_get_save_name failed [%d]", err);
-                                       goto FINISH_OFF;
-                               }
-                       
-                               if (!em_storage_move_file(mail_src->body->plain, name_buf, from_composer, &err)) {
-                                       EM_DEBUG_EXCEPTION("em_storage_move_file failed [%d]", err);
-                                       goto FINISH_OFF;
-                               }
-                               if (mail_table_data->body_download_status == 0)
-                                       mail_table_data->body_download_status = 1;
-                               mail_table_data->file_path_plain = EM_SAFE_STRDUP(name_buf);            
-                               EM_SAFE_FREE(mail_src->body->plain);
-                               mail_src->body->plain = EM_SAFE_STRDUP(name_buf);
-                       }
-
-                       if (mail_src->body->html) {
-                               EM_DEBUG_LOG("mail_src->body->html [%s]", mail_src->body->html);
-                               if (mail_src->body->plain_charset != NULL && mail_src->body->plain_charset[0] != NULL_CHAR) {
-                                       memcpy(html_body, mail_src->body->plain_charset, strlen(mail_src->body->plain_charset));
-                                       strcat(html_body, ".htm");
-                               }
-                               else {
-                                       memcpy(html_body, "UTF-8.htm", strlen("UTF-8.htm"));
-                               }
-                                       
-                               if (!em_storage_get_save_name(account_id, mail_id, 0, html_body, name_buf, &err))  {
-                                       EM_DEBUG_EXCEPTION("em_storage_get_save_name failed [%d]", err);
-                                       goto FINISH_OFF;
-                               }
-
-                               if (!em_storage_move_file(mail_src->body->html, name_buf, from_composer, &err))  {
-                                       EM_DEBUG_EXCEPTION("em_storage_move_file failed [%d]", err);
-                                       goto FINISH_OFF;
-                               }
-
-                               if (mail_table_data->body_download_status == EMF_BODY_DOWNLOAD_STATUS_NONE)
-                                       mail_table_data->body_download_status = EMF_BODY_DOWNLOAD_STATUS_FULLY_DOWNLOADED;
-
-                               mail_table_data->file_path_html = EM_SAFE_STRDUP(name_buf);
-                               EM_SAFE_FREE(mail_src->body->html);
-                               mail_src->body->html = EM_SAFE_STRDUP(name_buf);
-                       }
-               }
-       }
-
-       
-       if (!mail_src->head->datetime.year && !mail_src->head->datetime.month && !mail_src->head->datetime.day)  {
-               /* time isn't set */
-               if(!em_core_set_current_time_to_mail_header(mail_src->head, &err)) {
-                       EM_DEBUG_EXCEPTION("em_core_set_current_time_to_mail_header failed [%d]", err);
-                       goto FINISH_OFF;
-               }
-       }
-       
-       SNPRINTF(datetime, sizeof(datetime), "%04d%02d%02d%02d%02d%02d", 
-       mail_src->head->datetime.year, mail_src->head->datetime.month, mail_src->head->datetime.day, mail_src->head->datetime.hour, mail_src->head->datetime.minute, mail_src->head->datetime.second);
-       
-       mail_table_data->datetime = EM_SAFE_STRDUP(datetime);
-       mail_table_data->message_id = EM_SAFE_STRDUP(mail_src->head->mid);
-
-       if (mail_src->info)  {
-               mail_src->info->flags.draft = 1;
-               if(!em_convert_mail_flag_to_mail_tbl(&(mail_src->info->flags), mail_table_data, &err)) {
-                       EM_DEBUG_EXCEPTION("em_convert_mail_flag_to_mail_tbl failed [%d]", err);
-                       goto FINISH_OFF;
-               }
-               mail_table_data->priority = mail_src->info->extra_flags.priority;
-               mail_table_data->lock_status = mail_src->info->extra_flags.lock;
-               mail_table_data->report_status = mail_src->info->extra_flags.report;
-       }
-       mail_table_data->save_status = EMF_MAIL_STATUS_SAVED;
-       
-       mail_id = mail_table_data->mail_id;
-       mail_src->info->uid = mail_id;
-
-       mail_table_data->meeting_request_status = mail_src->info->is_meeting_request;
-       
-       if(mail_src->info->thread_id == 0) {
-               if (em_storage_get_thread_id_of_thread_mails(mail_table_data, &thread_id, &latest_mail_id_in_thread, &thread_item_count) != EMF_ERROR_NONE)
-                       EM_DEBUG_LOG(" em_storage_get_thread_id_of_thread_mails is failed");
-               
-               if (thread_id == -1) {
-                       mail_table_data->thread_id = mail_id;
-                       mail_table_data->thread_item_count = thread_item_count = 1;
-               }
-               else  {
-                       mail_table_data->thread_id = thread_id;
-                       thread_item_count++;
-               }
-       }
-       else {
-               mail_table_data->thread_id = mail_src->info->thread_id;
-               thread_item_count = 2;
-       }
-
-       /*  Getting attachment count */
-       if (mail_src->body)     
-               atch = mail_src->body->attachment;
-       while (atch)  {
-               if (atch->inline_content)
-                       local_inline_content_count++;
-               local_attachment_count++;
-               atch = atch->next;
-       }
-
-       mail_table_data->inline_content_count = local_inline_content_count;
-       mail_table_data->attachment_count     = local_attachment_count;
-
-       EM_DEBUG_LOG("inline_content_count [%d]", local_inline_content_count);
-       EM_DEBUG_LOG("attachment_count [%d]", local_attachment_count);
-       
-       EM_DEBUG_LOG("preview_text[%p]", mail_table_data->preview_text);
-       if (mail_table_data->preview_text == NULL) {
-               if ( (err = em_core_get_preview_text_from_file(mail_table_data->file_path_plain, mail_table_data->file_path_html, MAX_PREVIEW_TEXT_LENGTH, &(mail_table_data->preview_text))) != EMF_ERROR_NONE) {
-                       EM_DEBUG_EXCEPTION("em_core_get_preview_text_from_file failed[%d]", err);
-                       goto FINISH_OFF;
-               }
-       }
-
-       em_storage_begin_transaction(NULL, NULL, NULL);
-
-       /*  insert mail to mail table */
-       if (!em_storage_add_mail(mail_table_data, 0, false, &err))  {
-               EM_DEBUG_EXCEPTION("em_storage_add_mail failed [%d]", err);
-               /*  ROLLBACK TRANSACTION; */
-               em_storage_rollback_transaction(NULL, NULL, NULL);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
-               goto FINISH_OFF;
-       }
-
-       EM_DEBUG_LOG("thread_item_count [%d]", thread_item_count);
-       if (thread_item_count > 1) {
-               if (!em_storage_update_latest_thread_mail(mail_table_data->account_id, mail_table_data->thread_id, 0, 0, false, &err)) {
-                       EM_DEBUG_EXCEPTION("em_storage_update_latest_thread_mail failed [%d]", err);
-                       em_storage_rollback_transaction(NULL, NULL, NULL);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
-                       goto FINISH_OFF;
-               }
-       }
-
-       /*  Insert attachment information to DB */
-       if (mail_src->body)     
-               atch = mail_src->body->attachment;
-       EM_DEBUG_LOG("atch [%p]", atch);
-       while (atch)  {
-               if (from_composer && stat(atch->savename, &st_buf) < 0)  {
-                       atch = atch->next;
-                       continue;
-               }
-               
-               if (!atch->inline_content) {
-                       if (!em_storage_get_new_attachment_no(&attachment_id, &err)) {
-                               EM_DEBUG_EXCEPTION("em_storage_get_new_attachment_no failed [%d]", err);
-                               em_storage_rollback_transaction(NULL, NULL, NULL);
-                               goto FINISH_OFF;
-                       }
-               }
-
-               if (!em_storage_create_dir(account_id, mail_id, atch->inline_content ? 0  :  attachment_id, &err))  {
-                       EM_DEBUG_EXCEPTION("em_storage_create_dir failed [%d]", err);
-                       em_storage_rollback_transaction(NULL, NULL, NULL);
-                       goto FINISH_OFF;
-               }
-               
-               if (!em_storage_get_save_name(account_id, mail_id, atch->inline_content ? 0  :  attachment_id, atch->name, name_buf, &err))  {
-                       EM_DEBUG_EXCEPTION("em_storage_get_save_name failed [%d]", err);
-                       em_storage_rollback_transaction(NULL, NULL, NULL);
-                       goto FINISH_OFF;
-               }
-               
-               if (from_composer || atch->downloaded) {        
-                       if (!em_storage_copy_file(atch->savename, name_buf, from_composer, &err))  {
-                               EM_DEBUG_EXCEPTION("em_storage_copy_file failed [%d]", err);
-                               em_storage_rollback_transaction(NULL, NULL, NULL);
-                               goto FINISH_OFF;
-                       }
-                       
-                       if ((ext = strrchr(atch->name, '.'))) { 
-                               if (!strncmp(ext, ".vcs", strlen(".vcs")))
-                                       remove(atch->savename);
-                               else if (!strncmp(ext, ".vcf", strlen(".vcf")))
-                                       remove(atch->savename);
-                               else if (!strncmp(ext, ".vnt", strlen(".vnt")))
-                                       remove(atch->savename);
-                       }
-               }
-               
-               memset(&attachment_tbl, 0x00, sizeof(emf_mail_attachment_tbl_t));
-               
-               attachment_tbl.mail_id         = mail_id;
-               attachment_tbl.account_id      = account_id;
-               attachment_tbl.mailbox_name    = mailbox_name_target;
-               attachment_tbl.file_yn         = atch->downloaded;
-               attachment_tbl.flag2           = mail_src->body->attachment->drm;  
-               attachment_tbl.attachment_name = atch->name;
-               attachment_tbl.attachment_path = name_buf;
-               attachment_tbl.flag3           = atch->inline_content;
-               if (from_composer)
-                       attachment_tbl.attachment_size = st_buf.st_size;
-               else
-                       attachment_tbl.attachment_size = atch->size;
-
-               if (!em_storage_add_attachment(&attachment_tbl, 0, false, &err))  {
-                       EM_DEBUG_EXCEPTION("em_storage_add_attachment failed [%d]", err);
-                       em_storage_rollback_transaction(NULL, NULL, NULL);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
-                       goto FINISH_OFF;
-               }
-               atch->attachment_id = attachment_tbl.attachment_id;             
-               atch = atch->next;
-       }
-
-       /*  Insert Meeting request to DB */
-       if (mail_src->info->is_meeting_request == EMF_MAIL_TYPE_MEETING_REQUEST
-               || mail_src->info->is_meeting_request == EMF_MAIL_TYPE_MEETING_RESPONSE
-               || mail_src->info->is_meeting_request == EMF_MAIL_TYPE_MEETING_ORIGINATINGREQUEST) {
-               EM_DEBUG_LOG("This mail has the meeting request");
-               meeting_req->mail_id = mail_id;
-               if (!em_storage_add_meeting_request(account_id, mailbox_name_target, meeting_req, false, &err))  {
-                       EM_DEBUG_EXCEPTION("em_storage_add_meeting_request failed [%d]", err);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
-                       goto FINISH_OFF;
-               }                       
-       }
-
-       em_storage_commit_transaction(NULL, NULL, NULL);
-
-       if (!em_storage_notify_storage_event(NOTI_MAIL_ADD, account_id, mail_id, mailbox_name_target, mail_table_data->thread_id))
-                       EM_DEBUG_LOG("em_storage_notify_storage_event [NOTI_MAIL_ADD] failed.");
-
-       if (account_tbl_item->receiving_server_type != EMF_SERVER_TYPE_ACTIVE_SYNC) {
-               if (!em_core_mailbox_remove_overflowed_mails(mailbox_tbl_data, &err)) {
-                       if (err == EM_STORAGE_ERROR_MAIL_NOT_FOUND || err == EMF_ERROR_NOT_SUPPORTED)
-                               err = EMF_ERROR_NONE;
-                       else
-                               EM_DEBUG_LOG("em_core_mailbox_remove_overflowed_mails failed [%d]", err);
-               }       
-       }
-
-       if ( !from_composer && (mail_src->info->flags.seen == 0) 
-                               && mail_table_data->mailbox_type != EMF_MAILBOX_TYPE_TRASH 
-                               && mail_table_data->mailbox_type != EMF_MAILBOX_TYPE_SPAMBOX) { /* 0x01 fSeen */
-               if (!em_storage_update_sync_status_of_account(account_id, SET_TYPE_SET, SYNC_STATUS_SYNCING | SYNC_STATUS_HAVE_NEW_MAILS, true, &err)) 
-                               EM_DEBUG_LOG("em_storage_update_sync_status_of_account failed [%d]", err);
-               em_core_add_notification_for_unread_mail_by_mail_header(account_id, mail_id, mail_src->head);
-               em_core_check_unread_mail();
-       }
-
-       ret = true;
-       
-FINISH_OFF: 
-       if (mail_table_data)
-               em_storage_free_mail(&mail_table_data, 1, NULL);
-
-       if (account_tbl_item)
-               em_storage_free_account(&account_tbl_item, 1, NULL);
-
-       if (mailbox_tbl_data)
-               em_storage_free_mailbox(&mailbox_tbl_data, 1, NULL);
-       
-       EM_SAFE_FREE(mailbox_name_spam);
-       EM_SAFE_FREE(mailbox_name_target);
-       
-       if (err_code)
-               *err_code = err;
-
-       EM_DEBUG_FUNC_END();
-       return ret;
-}
-
-
-EXPORT_API int em_core_add_mail(emf_mail_data_t *input_mail_data, emf_attachment_data_t *input_attachment_data_list, int input_attachment_count, emf_meeting_request_t *input_meeting_request, int input_sync_server)
-{
-       EM_DEBUG_FUNC_BEGIN("input_mail_data[%p], input_attachment_data_list [%p], input_attachment_count [%d], input_meeting_request [%p], input_sync_server[%d]", input_mail_data, input_attachment_data_list, input_attachment_count, input_meeting_request, input_sync_server);
+       EM_DEBUG_FUNC_BEGIN("input_mail_data[%p], input_attachment_data_list [%p], input_attachment_count [%d], input_meeting_request [%p], input_from_eas[%d]", input_mail_data, input_attachment_data_list, input_attachment_count, input_meeting_request, input_from_eas);
        
        int err = EMF_ERROR_NONE;
        int attachment_id = 0, thread_id = -1, thread_item_count = 0, latest_mail_id_in_thread = -1;
        int i = 0, rule_len, rule_matched = -1, local_attachment_count = 0, local_inline_content_count = 0;
        char *ext = NULL, *mailbox_name_spam = NULL, *mailbox_name_target = NULL;
        char name_buf[MAX_PATH] = {0x00, }, html_body[MAX_PATH] = {0x00, };
-       emf_mail_tbl_t    *converted_mail_tbl = NULL;
-       emf_mailbox_tbl_t *mailbox_tbl = NULL;
-       emf_mail_attachment_tbl_t attachment_tbl = { 0 };
-       emf_mail_account_tbl_t *account_tbl_item = NULL;
-       emf_mail_rule_tbl_t *rule = NULL;
+       emstorage_mail_tbl_t    *converted_mail_tbl = NULL;
+       emstorage_mailbox_tbl_t *mailbox_tbl = NULL;
+       emstorage_attachment_tbl_t attachment_tbl = { 0 };
+       emstorage_account_tbl_t *account_tbl_item = NULL;
+       emstorage_rule_tbl_t *rule = NULL;
        struct stat st_buf = { 0 };
 
        /* Validating parameters */
@@ -981,13 +529,13 @@ EXPORT_API int em_core_add_mail(emf_mail_data_t *input_mail_data, emf_attachment
                goto FINISH_OFF;
        }
 
-       if (!em_storage_get_account_by_id(input_mail_data->account_id, EMF_ACC_GET_OPT_DEFAULT | EMF_ACC_GET_OPT_OPTIONS, &account_tbl_item, true, &err)) {
-               EM_DEBUG_EXCEPTION("em_storage_get_account_by_id failed. account_id[%d] err[%d]", input_mail_data->account_id, err);
+       if (!emstorage_get_account_by_id(input_mail_data->account_id, EMF_ACC_GET_OPT_DEFAULT | EMF_ACC_GET_OPT_OPTIONS, &account_tbl_item, true, &err)) {
+               EM_DEBUG_EXCEPTION("emstorage_get_account_by_id failed. account_id[%d] err[%d]", input_mail_data->account_id, err);
                err = EMF_ERROR_INVALID_ACCOUNT;
                goto FINISH_OFF;
        }
 
-       if(input_sync_server) {
+       if(input_from_eas == 0) {
                if (input_mail_data->file_path_plain)  {
                        if (stat(input_mail_data->file_path_plain, &st_buf) < 0)  {
                                EM_DEBUG_EXCEPTION("input_mail_data->file_path_plain, stat(\"%s\") failed...", input_mail_data->file_path_plain);
@@ -1017,13 +565,13 @@ EXPORT_API int em_core_add_mail(emf_mail_data_t *input_mail_data, emf_attachment
                }
        }
 
-       if (input_sync_server) {
+       if (input_from_eas == 0) {
                if (!input_mail_data->full_address_from) 
                        input_mail_data->full_address_from = EM_SAFE_STRDUP(account_tbl_item->email_addr);
 
                /* check for email_address validation */
-               if (!em_core_verify_email_address_of_mail_data(input_mail_data, false, &err)) {
-                       EM_DEBUG_EXCEPTION("em_core_verify_email_address_of_mail_data failed [%d]", err);
+               if (!em_verify_email_address_of_mail_data(input_mail_data, false, &err)) {
+                       EM_DEBUG_EXCEPTION("em_verify_email_address_of_mail_data failed [%d]", err);
                        goto FINISH_OFF;
                }
                
@@ -1036,8 +584,8 @@ EXPORT_API int em_core_add_mail(emf_mail_data_t *input_mail_data, emf_attachment
                        }
                        /* Create report mail body */
                        /*
-                       if (!em_core_mail_get_rfc822(mail_src, NULL, NULL, NULL, &err))  {
-                               EM_DEBUG_EXCEPTION("em_core_mail_get_rfc822 failed [%d]", err);
+                       if (!emcore_make_rfc822_file_from_mail(mail_src, NULL, NULL, NULL, &err))  {
+                               EM_DEBUG_EXCEPTION("emcore_make_rfc822_file_from_mail failed [%d]", err);
                                goto FINISH_OFF;
                        }
                        */
@@ -1058,23 +606,21 @@ EXPORT_API int em_core_add_mail(emf_mail_data_t *input_mail_data, emf_attachment
                        else if (!opt->block_subject)
                                type = EMF_FILTER_FROM;
                        
-                       if (!em_storage_get_rule(ALL_ACCOUNT, type, 0, &rule_len, &is_completed, &rule, true, &err) || !rule) 
-                               EM_DEBUG_LOG("No proper rules. em_storage_get_rule returns [%d]", err);
+                       if (!emstorage_get_rule(ALL_ACCOUNT, type, 0, &rule_len, &is_completed, &rule, true, &err) || !rule) 
+                               EM_DEBUG_LOG("No proper rules. emstorage_get_rule returns [%d]", err);
                }
 
                if (rule) {
-                       if (!em_storage_get_mailboxname_by_mailbox_type(input_mail_data->account_id, EMF_MAILBOX_TYPE_SPAMBOX, &mailbox_name_spam, false, &err))  {
-                               EM_DEBUG_EXCEPTION("em_storage_get_mailboxname_by_mailbox_type failed [%d]", err);
-                               err = em_storage_get_emf_error_from_em_storage_error(err);
+                       if (!emstorage_get_mailboxname_by_mailbox_type(input_mail_data->account_id, EMF_MAILBOX_TYPE_SPAMBOX, &mailbox_name_spam, false, &err))  {
+                               EM_DEBUG_EXCEPTION("emstorage_get_mailboxname_by_mailbox_type failed [%d]", err);
+               
                                mailbox_name_spam = NULL;
                        }
 
-                       /*
-                       if (mailbox_name_spam && !em_core_mail_check_rule(mail_src->head, rule, rule_len, &rule_matched, &err))  {
-                               EM_DEBUG_EXCEPTION("em_core_mail_check_rule failed [%d]", err);
+                       if (mailbox_name_spam && !emcore_check_rule(input_mail_data->full_address_from, input_mail_data->subject, rule, rule_len, &rule_matched, &err))  {
+                               EM_DEBUG_EXCEPTION("emcore_check_rule failed [%d]", err);
                                goto FINISH_OFF;
                        }
-                       */
                }
 
                if (rule_matched >= 0 && mailbox_name_spam) 
@@ -1083,38 +629,38 @@ EXPORT_API int em_core_add_mail(emf_mail_data_t *input_mail_data, emf_attachment
                        mailbox_name_target = EM_SAFE_STRDUP(input_mail_data->mailbox_name);
        }
        
-       if (!em_storage_get_mailbox_by_name(input_mail_data->account_id, -1, mailbox_name_target, (emf_mailbox_tbl_t **)&mailbox_tbl, false, &err)) {
-               EM_DEBUG_EXCEPTION("em_storage_get_mailboxname_by_mailbox_type failed [%d]", err);              
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+       if (!emstorage_get_mailbox_by_name(input_mail_data->account_id, -1, mailbox_name_target, (emstorage_mailbox_tbl_t **)&mailbox_tbl, false, &err)) {
+               EM_DEBUG_EXCEPTION("emstorage_get_mailboxname_by_mailbox_type failed [%d]", err);               
+
                goto FINISH_OFF;
        }
 
-       if (!em_storage_increase_mail_id(&input_mail_data->mail_id, true, &err)) {
-               EM_DEBUG_EXCEPTION("em_storage_increase_mail_id failed [%d]", err);
+       if (!emstorage_increase_mail_id(&input_mail_data->mail_id, true, &err)) {
+               EM_DEBUG_EXCEPTION("emstorage_increase_mail_id failed [%d]", err);
                goto FINISH_OFF;
        }
 
        EM_DEBUG_LOG("input_mail_data->mail_size [%d]", input_mail_data->mail_size);
 
        if(input_mail_data->mail_size == 0)
-               em_core_calc_mail_size(input_mail_data, input_attachment_data_list, input_attachment_count, &(input_mail_data->mail_size)); /*  Getting file size before file moved.  */
+               emcore_calc_mail_size(input_mail_data, input_attachment_data_list, input_attachment_count, &(input_mail_data->mail_size)); /*  Getting file size before file moved.  */
 
-       if (input_sync_server || input_mail_data->body_download_status) {
-               if (!em_storage_create_dir(input_mail_data->account_id, input_mail_data->mail_id, 0, &err))  {
-                       EM_DEBUG_EXCEPTION("em_storage_create_dir failed [%d]", err);
+       if (input_from_eas == 0|| input_mail_data->body_download_status) {
+               if (!emstorage_create_dir(input_mail_data->account_id, input_mail_data->mail_id, 0, &err))  {
+                       EM_DEBUG_EXCEPTION("emstorage_create_dir failed [%d]", err);
                        goto FINISH_OFF;
                }
 
                if (input_mail_data->file_path_plain) {
                        EM_DEBUG_LOG("input_mail_data->file_path_plain [%s]", input_mail_data->file_path_plain);
-                       /* if (!em_storage_get_save_name(account_id, mail_id, 0, input_mail_data->body->plain_charset ? input_mail_data->body->plain_charset  :  "UTF-8", name_buf, &err))  {*/
-                       if (!em_storage_get_save_name(input_mail_data->account_id, input_mail_data->mail_id, 0, "UTF-8", name_buf, &err))  {
-                               EM_DEBUG_EXCEPTION("em_storage_get_save_name failed [%d]", err);
+                       /* if (!emstorage_get_save_name(account_id, mail_id, 0, input_mail_data->body->plain_charset ? input_mail_data->body->plain_charset  :  "UTF-8", name_buf, &err))  {*/
+                       if (!emstorage_get_save_name(input_mail_data->account_id, input_mail_data->mail_id, 0, "UTF-8", name_buf, &err))  {
+                               EM_DEBUG_EXCEPTION("emstorage_get_save_name failed [%d]", err);
                                goto FINISH_OFF;
                        }
                
-                       if (!em_storage_move_file(input_mail_data->file_path_plain, name_buf, input_sync_server, &err)) {
-                               EM_DEBUG_EXCEPTION("em_storage_move_file failed [%d]", err);
+                       if (!emstorage_move_file(input_mail_data->file_path_plain, name_buf, input_from_eas, &err)) {
+                               EM_DEBUG_EXCEPTION("emstorage_move_file failed [%d]", err);
                                goto FINISH_OFF;
                        }
                        if (input_mail_data->body_download_status == EMF_BODY_DOWNLOAD_STATUS_NONE)
@@ -1128,13 +674,13 @@ EXPORT_API int em_core_add_mail(emf_mail_data_t *input_mail_data, emf_attachment
                        EM_DEBUG_LOG("input_mail_data->file_path_html [%s]", input_mail_data->file_path_html);
                        memcpy(html_body, "UTF-8.htm", strlen("UTF-8.htm"));
                                
-                       if (!em_storage_get_save_name(input_mail_data->account_id, input_mail_data->mail_id, 0, html_body, name_buf, &err))  {
-                               EM_DEBUG_EXCEPTION("em_storage_get_save_name failed [%d]", err);
+                       if (!emstorage_get_save_name(input_mail_data->account_id, input_mail_data->mail_id, 0, html_body, name_buf, &err))  {
+                               EM_DEBUG_EXCEPTION("emstorage_get_save_name failed [%d]", err);
                                goto FINISH_OFF;
                        }
 
-                       if (!em_storage_move_file(input_mail_data->file_path_html, name_buf, input_sync_server, &err))  {
-                               EM_DEBUG_EXCEPTION("em_storage_move_file failed [%d]", err);
+                       if (!emstorage_move_file(input_mail_data->file_path_html, name_buf, input_from_eas, &err))  {
+                               EM_DEBUG_EXCEPTION("emstorage_move_file failed [%d]", err);
                                goto FINISH_OFF;
                        }
 
@@ -1147,20 +693,16 @@ EXPORT_API int em_core_add_mail(emf_mail_data_t *input_mail_data, emf_attachment
        }
 
        
-       if (!input_mail_data->datetime)  {
+       if (!input_mail_data->date_time)  {
                /* time isn't set */
-               input_mail_data->datetime = em_core_get_current_time_string(&err);
-               if(!input_mail_data->datetime) {
-                       EM_DEBUG_EXCEPTION("em_core_get_current_time_string failed [%d]", err);
-                       goto FINISH_OFF;
-               }
+               input_mail_data->date_time = time(NULL);
        }
 
        EM_SAFE_FREE(input_mail_data->mailbox_name);
 
        input_mail_data->mailbox_name         = EM_SAFE_STRDUP(mailbox_name_target);
        input_mail_data->mailbox_type         = mailbox_tbl->mailbox_type;
-       input_mail_data->server_mail_status   = !input_sync_server;
+       input_mail_data->server_mail_status   = !input_from_eas;
        input_mail_data->save_status          = EMF_MAIL_STATUS_SAVED;
 
        /*  Getting attachment count */
@@ -1178,8 +720,8 @@ EXPORT_API int em_core_add_mail(emf_mail_data_t *input_mail_data, emf_attachment
 
        EM_DEBUG_LOG("preview_text[%p]", input_mail_data->preview_text);
        if (input_mail_data->preview_text == NULL) {
-               if ( (err = em_core_get_preview_text_from_file(input_mail_data->file_path_plain, input_mail_data->file_path_html, MAX_PREVIEW_TEXT_LENGTH, &(input_mail_data->preview_text))) != EMF_ERROR_NONE) {
-                       EM_DEBUG_EXCEPTION("em_core_get_preview_text_from_file failed[%d]", err);
+               if ( (err = emcore_get_preview_text_from_file(input_mail_data->file_path_plain, input_mail_data->file_path_html, MAX_PREVIEW_TEXT_LENGTH, &(input_mail_data->preview_text))) != EMF_ERROR_NONE) {
+                       EM_DEBUG_EXCEPTION("emcore_get_preview_text_from_file failed[%d]", err);
                        goto FINISH_OFF;
                }
        }
@@ -1189,13 +731,15 @@ EXPORT_API int em_core_add_mail(emf_mail_data_t *input_mail_data, emf_attachment
                goto FINISH_OFF;
        }
        
+       converted_mail_tbl->mailbox_id        = mailbox_tbl->mailbox_id;
+
        /* Fill address information */
-       em_core_fill_address_information_of_mail_tbl(converted_mail_tbl);
+       emcore_fill_address_information_of_mail_tbl(converted_mail_tbl);
 
        /* Fill thread id */
        if(input_mail_data->thread_id == 0) {
-               if (em_storage_get_thread_id_of_thread_mails(converted_mail_tbl, &thread_id, &latest_mail_id_in_thread, &thread_item_count) != EMF_ERROR_NONE)
-                       EM_DEBUG_LOG(" em_storage_get_thread_id_of_thread_mails is failed");
+               if (emstorage_get_thread_id_of_thread_mails(converted_mail_tbl, &thread_id, &latest_mail_id_in_thread, &thread_item_count) != EMF_ERROR_NONE)
+                       EM_DEBUG_LOG(" emstorage_get_thread_id_of_thread_mails is failed");
                
                if (thread_id == -1) {
                        converted_mail_tbl->thread_id         = input_mail_data->mail_id;
@@ -1207,17 +751,19 @@ EXPORT_API int em_core_add_mail(emf_mail_data_t *input_mail_data, emf_attachment
                }
        }
        else {
-               thread_item_count                    = 2;
+               thread_item_count                         = 2;
        }
 
-       em_storage_begin_transaction(NULL, NULL, NULL);
+       input_mail_data->thread_id = converted_mail_tbl->thread_id;
+
+       emstorage_begin_transaction(NULL, NULL, NULL);
 
        /*  insert mail to mail table */
-       if (!em_storage_add_mail(converted_mail_tbl, 0, false, &err))  {
-               EM_DEBUG_EXCEPTION("em_storage_add_mail failed [%d]", err);
+       if (!emstorage_add_mail(converted_mail_tbl, 0, false, &err))  {
+               EM_DEBUG_EXCEPTION("emstorage_add_mail failed [%d]", err);
                /*  ROLLBACK TRANSACTION; */
-               em_storage_rollback_transaction(NULL, NULL, NULL);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+               emstorage_rollback_transaction(NULL, NULL, NULL);
+
                goto FINISH_OFF;
        }
 
@@ -1225,10 +771,10 @@ EXPORT_API int em_core_add_mail(emf_mail_data_t *input_mail_data, emf_attachment
        EM_DEBUG_LOG("thread_item_count [%d]", thread_item_count);
 
        if (thread_item_count > 1) {
-               if (!em_storage_update_latest_thread_mail(input_mail_data->account_id, converted_mail_tbl->thread_id, 0, 0, false, &err)) {
-                       EM_DEBUG_EXCEPTION("em_storage_update_latest_thread_mail failed [%d]", err);
-                       em_storage_rollback_transaction(NULL, NULL, NULL);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+               if (!emstorage_update_latest_thread_mail(input_mail_data->account_id, converted_mail_tbl->thread_id, 0, 0, false, &err)) {
+                       EM_DEBUG_EXCEPTION("emstorage_update_latest_thread_mail failed [%d]", err);
+                       emstorage_rollback_transaction(NULL, NULL, NULL);
+       
                        goto FINISH_OFF;
                }
        }
@@ -1243,29 +789,29 @@ EXPORT_API int em_core_add_mail(emf_mail_data_t *input_mail_data, emf_attachment
                }
                
                if (!input_attachment_data_list[i].inline_content_status) {
-                       if (!em_storage_get_new_attachment_no(&attachment_id, &err)) {
-                               EM_DEBUG_EXCEPTION("em_storage_get_new_attachment_no failed [%d]", err);
-                               em_storage_rollback_transaction(NULL, NULL, NULL);
+                       if (!emstorage_get_new_attachment_no(&attachment_id, &err)) {
+                               EM_DEBUG_EXCEPTION("emstorage_get_new_attachment_no failed [%d]", err);
+                               emstorage_rollback_transaction(NULL, NULL, NULL);
                                goto FINISH_OFF;
                        }
                }
 
-               if (!em_storage_create_dir(input_mail_data->account_id, input_mail_data->mail_id, input_attachment_data_list[i].inline_content_status ? 0  :  attachment_id, &err))  {
-                       EM_DEBUG_EXCEPTION("em_storage_create_dir failed [%d]", err);
-                       em_storage_rollback_transaction(NULL, NULL, NULL);
+               if (!emstorage_create_dir(input_mail_data->account_id, input_mail_data->mail_id, input_attachment_data_list[i].inline_content_status ? 0  :  attachment_id, &err))  {
+                       EM_DEBUG_EXCEPTION("emstorage_create_dir failed [%d]", err);
+                       emstorage_rollback_transaction(NULL, NULL, NULL);
                        goto FINISH_OFF;
                }
                
-               if (!em_storage_get_save_name(input_mail_data->account_id, input_mail_data->mail_id, input_attachment_data_list[i].inline_content_status ? 0  :  attachment_id, input_attachment_data_list[i].attachment_name, name_buf, &err))  {
-                       EM_DEBUG_EXCEPTION("em_storage_get_save_name failed [%d]", err);
-                       em_storage_rollback_transaction(NULL, NULL, NULL);
+               if (!emstorage_get_save_name(input_mail_data->account_id, input_mail_data->mail_id, input_attachment_data_list[i].inline_content_status ? 0  :  attachment_id, input_attachment_data_list[i].attachment_name, name_buf, &err))  {
+                       EM_DEBUG_EXCEPTION("emstorage_get_save_name failed [%d]", err);
+                       emstorage_rollback_transaction(NULL, NULL, NULL);
                        goto FINISH_OFF;
                }
                
-               if (input_sync_server || input_attachment_data_list[i].save_status) {   
-                       if (!em_storage_copy_file(input_attachment_data_list[i].attachment_path, name_buf, input_sync_server, &err))  {
-                               EM_DEBUG_EXCEPTION("em_storage_copy_file failed [%d]", err);
-                               em_storage_rollback_transaction(NULL, NULL, NULL);
+               if (input_from_eas == 0|| input_attachment_data_list[i].save_status) {
+                       if (!emstorage_copy_file(input_attachment_data_list[i].attachment_path, name_buf, input_from_eas, &err))  {
+                               EM_DEBUG_EXCEPTION("emstorage_copy_file failed [%d]", err);
+                               emstorage_rollback_transaction(NULL, NULL, NULL);
                                goto FINISH_OFF;
                        }
                        
@@ -1279,21 +825,21 @@ EXPORT_API int em_core_add_mail(emf_mail_data_t *input_mail_data, emf_attachment
                        }
                }
 
-               memset(&attachment_tbl, 0, sizeof(emf_mail_attachment_tbl_t));
-               attachment_tbl.attachment_name = input_attachment_data_list[i].attachment_name;
-               attachment_tbl.attachment_path = name_buf;
-               attachment_tbl.attachment_size = input_attachment_data_list[i].attachment_size;
-               attachment_tbl.mail_id         = input_mail_data->mail_id;
-               attachment_tbl.account_id      = input_mail_data->account_id;
-               attachment_tbl.mailbox_name    = input_mail_data->mailbox_name;
-               attachment_tbl.file_yn         = input_attachment_data_list[i].save_status;
-               attachment_tbl.flag2           = input_attachment_data_list[i].drm_status;
-               attachment_tbl.flag3           = input_attachment_data_list[i].inline_content_status;
-
-               if (!em_storage_add_attachment(&attachment_tbl, 0, false, &err))  {
-                       EM_DEBUG_EXCEPTION("em_storage_add_attachment failed [%d]", err);
-                       em_storage_rollback_transaction(NULL, NULL, NULL);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+               memset(&attachment_tbl, 0, sizeof(emstorage_attachment_tbl_t));
+               attachment_tbl.attachment_name                  = input_attachment_data_list[i].attachment_name;
+               attachment_tbl.attachment_path                  = name_buf;
+               attachment_tbl.attachment_size                  = input_attachment_data_list[i].attachment_size;
+               attachment_tbl.mail_id                          = input_mail_data->mail_id;
+               attachment_tbl.account_id                       = input_mail_data->account_id;
+               attachment_tbl.mailbox_name                     = input_mail_data->mailbox_name;
+               attachment_tbl.attachment_save_status           = input_attachment_data_list[i].save_status;
+               attachment_tbl.attachment_drm_type              = input_attachment_data_list[i].drm_status;
+               attachment_tbl.attachment_inline_content_status = input_attachment_data_list[i].inline_content_status;
+
+               if (!emstorage_add_attachment(&attachment_tbl, 0, false, &err))  {
+                       EM_DEBUG_EXCEPTION("emstorage_add_attachment failed [%d]", err);
+                       emstorage_rollback_transaction(NULL, NULL, NULL);
+       
                        goto FINISH_OFF;
                }
                input_attachment_data_list[i].attachment_id = attachment_tbl.attachment_id;
@@ -1305,45 +851,45 @@ EXPORT_API int em_core_add_mail(emf_mail_data_t *input_mail_data, emf_attachment
                || input_mail_data->meeting_request_status == EMF_MAIL_TYPE_MEETING_ORIGINATINGREQUEST) {
                EM_DEBUG_LOG("This mail has the meeting request");
                input_meeting_request->mail_id = input_mail_data->mail_id;
-               if (!em_storage_add_meeting_request(input_mail_data->account_id, mailbox_name_target, input_meeting_request, false, &err))  {
-                       EM_DEBUG_EXCEPTION("em_storage_add_meeting_request failed [%d]", err);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+               if (!emstorage_add_meeting_request(input_mail_data->account_id, mailbox_name_target, input_meeting_request, false, &err))  {
+                       EM_DEBUG_EXCEPTION("emstorage_add_meeting_request failed [%d]", err);
+       
                        goto FINISH_OFF;
                }                       
        }
 
-       em_storage_commit_transaction(NULL, NULL, NULL);
+       emstorage_commit_transaction(NULL, NULL, NULL);
 
-       if (!em_storage_notify_storage_event(NOTI_MAIL_ADD, converted_mail_tbl->account_id, converted_mail_tbl->mail_id, mailbox_name_target, converted_mail_tbl->thread_id))
-                       EM_DEBUG_LOG("em_storage_notify_storage_event [NOTI_MAIL_ADD] failed.");
+       if (!emstorage_notify_storage_event(NOTI_MAIL_ADD, converted_mail_tbl->account_id, converted_mail_tbl->mail_id, mailbox_name_target, converted_mail_tbl->thread_id))
+               EM_DEBUG_LOG("emstorage_notify_storage_event [NOTI_MAIL_ADD] failed.");
 
        if (account_tbl_item->receiving_server_type != EMF_SERVER_TYPE_ACTIVE_SYNC) {
-               if (!em_core_mailbox_remove_overflowed_mails(mailbox_tbl, &err)) {
-                       if (err == EM_STORAGE_ERROR_MAIL_NOT_FOUND || err == EMF_ERROR_NOT_SUPPORTED)
+               if (!emcore_remove_overflowed_mails(mailbox_tbl, &err)) {
+                       if (err == EMF_ERROR_MAIL_NOT_FOUND || err == EMF_ERROR_NOT_SUPPORTED)
                                err = EMF_ERROR_NONE;
                        else
-                               EM_DEBUG_LOG("em_core_mailbox_remove_overflowed_mails failed [%d]", err);
+                               EM_DEBUG_LOG("emcore_remove_overflowed_mails failed [%d]", err);
                }       
        }
 
-       if ( !input_sync_server && (input_mail_data->flags_seen_field == 0) 
+       if ( input_from_eas && (input_mail_data->flags_seen_field == 0)
                                && input_mail_data->mailbox_type != EMF_MAILBOX_TYPE_TRASH 
                                && input_mail_data->mailbox_type != EMF_MAILBOX_TYPE_SPAMBOX) { 
-               if (!em_storage_update_sync_status_of_account(input_mail_data->account_id, SET_TYPE_SET, SYNC_STATUS_SYNCING | SYNC_STATUS_HAVE_NEW_MAILS, true, &err)) 
-                               EM_DEBUG_LOG("em_storage_update_sync_status_of_account failed [%d]", err);
-               em_core_add_notification_for_unread_mail(input_mail_data);
-               em_core_check_unread_mail();
+               if (!emstorage_update_sync_status_of_account(input_mail_data->account_id, SET_TYPE_SET, SYNC_STATUS_SYNCING | SYNC_STATUS_HAVE_NEW_MAILS, true, &err)) 
+                               EM_DEBUG_LOG("emstorage_update_sync_status_of_account failed [%d]", err);
+               emcore_add_notification_for_unread_mail(converted_mail_tbl);
+               emcore_check_unread_mail();
        }
        
 FINISH_OFF: 
        if (account_tbl_item)
-               em_storage_free_account(&account_tbl_item, 1, NULL);
+               emstorage_free_account(&account_tbl_item, 1, NULL);
 
        if (mailbox_tbl)
-               em_storage_free_mailbox(&mailbox_tbl, 1, NULL);
+               emstorage_free_mailbox(&mailbox_tbl, 1, NULL);
 
        if (converted_mail_tbl)
-               em_storage_free_mail(&converted_mail_tbl, 1, NULL);
+               emstorage_free_mail(&converted_mail_tbl, 1, NULL);
        
        EM_SAFE_FREE(mailbox_name_spam);
        EM_SAFE_FREE(mailbox_name_target);
@@ -1352,8 +898,77 @@ FINISH_OFF:
        return err;
 }
 
-EXPORT_API int  
-em_core_mail_add_meeting_request(int account_id, char *mailbox_name, emf_meeting_request_t *meeting_req, int *err_code)
+INTERNAL_FUNC int emcore_add_read_receipt(int input_read_mail_id, int *output_receipt_mail_id)
+{
+       EM_DEBUG_FUNC_BEGIN("input_read_mail_id [%d], output_receipt_mail_id [%p]", input_read_mail_id, output_receipt_mail_id);
+       int              err = EMF_ERROR_NONE;
+       emf_mail_data_t *read_mail_data = NULL;
+       emf_mail_data_t *receipt_mail_data = NULL;
+       char            *mailbox_name = NULL;
+
+       if( (err = emcore_get_mail_data(input_read_mail_id, &read_mail_data)) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("emcore_get_mail_data failed [%d]", err);
+               goto FINISH_OFF;
+       }
+
+       receipt_mail_data = em_malloc(sizeof(emf_mail_data_t));
+
+       if (!receipt_mail_data)  {
+               EM_DEBUG_EXCEPTION("em_malloc failed...");
+               err = EMF_ERROR_OUT_OF_MEMORY;
+               goto FINISH_OFF;
+       }
+
+       memcpy(receipt_mail_data, read_mail_data, sizeof(emf_mail_data_t));
+
+       receipt_mail_data->full_address_to = EM_SAFE_STRDUP(read_mail_data->full_address_to);
+       receipt_mail_data->message_id      = EM_SAFE_STRDUP(read_mail_data->message_id);
+
+       if (read_mail_data->subject)  {
+               receipt_mail_data->subject = em_malloc(strlen(read_mail_data->subject) + 7);
+               if (!(receipt_mail_data->subject))  {
+                       EM_DEBUG_EXCEPTION("em_malloc failed...");
+                       err = EMF_ERROR_OUT_OF_MEMORY;
+                       goto FINISH_OFF;
+               }
+
+               SNPRINTF(receipt_mail_data->subject, strlen(read_mail_data->subject) + 7 - 1,  "Read: %s", read_mail_data->subject);
+       }
+
+       if (!emstorage_get_mailboxname_by_mailbox_type(receipt_mail_data->account_id,EMF_MAILBOX_TYPE_OUTBOX, &mailbox_name, false, &err))  {
+               EM_DEBUG_EXCEPTION("emstorage_get_mailboxname_by_mailbox_type failed [%d]", err);
+
+               goto FINISH_OFF;
+       }
+
+       receipt_mail_data->mailbox_name      = EM_SAFE_STRDUP(mailbox_name);
+       receipt_mail_data->mailbox_type      = EMF_MAILBOX_TYPE_OUTBOX;
+       receipt_mail_data->flags_draft_field = 1;
+       receipt_mail_data->save_status       = (unsigned char)EMF_MAIL_STATUS_SENDING;
+       receipt_mail_data->report_status     = (unsigned char)EMF_MAIL_REPORT_MDN;
+
+       if ( (err = emcore_add_mail(receipt_mail_data, NULL, 0, NULL, 1)) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("emcore_add_mail failed [%d]", err);
+               goto FINISH_OFF;
+       }
+
+FINISH_OFF:
+       if(receipt_mail_data) {
+               EM_SAFE_FREE(receipt_mail_data->full_address_to);
+               EM_SAFE_FREE(receipt_mail_data->message_id);
+               EM_SAFE_FREE(receipt_mail_data->mailbox_name);
+               EM_SAFE_FREE(receipt_mail_data->subject);
+               EM_SAFE_FREE(receipt_mail_data);
+       }
+
+       if(read_mail_data)
+               emcore_free_mail_data(&read_mail_data, 1, NULL);
+
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+}
+
+INTERNAL_FUNC int emcore_add_meeting_request(int account_id, char *mailbox_name, emf_meeting_request_t *meeting_req, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], mailbox_name[%s], meeting_req[%p], err_code[%p]", account_id, mailbox_name, meeting_req, err_code);
        int ret = false;
@@ -1367,9 +982,9 @@ em_core_mail_add_meeting_request(int account_id, char *mailbox_name, emf_meeting
                goto FINISH_OFF;
        }
 
-       if (!em_storage_add_meeting_request(account_id, mailbox_name, meeting_req, 1, &err))  {
-               EM_DEBUG_EXCEPTION(" em_storage_add_meeting_request failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+       if (!emstorage_add_meeting_request(account_id, mailbox_name, meeting_req, 1, &err))  {
+               EM_DEBUG_EXCEPTION(" emstorage_add_meeting_request failed [%d]", err);
+
                goto FINISH_OFF;
        }       
 
@@ -1384,19 +999,20 @@ FINISH_OFF:
        return ret;     
 }
 
-/*  send a message (not saved) */
-EXPORT_API int em_core_mail_send(int account_id, char *input_mailbox_name, int mail_id, emf_option_t *sending_option, int *err_code)
+/*  send a mail */
+INTERNAL_FUNC int emcore_send_mail(int account_id, char *input_mailbox_name, int mail_id, emf_option_t *sending_option, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], input_mailbox_name[%s], mail_id[%d], sending_option[%p], err_code[%p]", account_id, input_mailbox_name, mail_id, sending_option, err_code);
-       EM_PROFILE_BEGIN(profile_em_core_mail_send);
+       EM_PROFILE_BEGIN(profile_emcore_send_mail);
        int ret = false;
        int err = EMF_ERROR_NONE, err2 = EMF_ERROR_NONE;
        int status = EMF_SEND_FAIL;
-       
+       int attachment_tbl_count = 0;
        SENDSTREAM *stream = NULL;
        ENVELOPE *envelope = NULL;
        sslstart_t stls = NULL;
-       emf_mail_t *mail = NULL;
+       emstorage_mail_tbl_t       *mail_tbl_data = NULL;
+       emstorage_attachment_tbl_t *attachment_tbl_data = NULL;
        emf_account_t *ref_account = NULL;
        emf_option_t *opt = NULL;
        emf_mailbox_t dest_mbox = {0};
@@ -1411,42 +1027,44 @@ EXPORT_API int em_core_mail_send(int account_id, char *input_mailbox_name, int m
                goto FINISH_OFF;
        }
        
-       if (!(ref_account = em_core_get_account_reference(account_id)))  {
-               EM_DEBUG_EXCEPTION("em_core_get_account_reference failed [%d]", account_id);
+       if (!(ref_account = emcore_get_account_reference(account_id)))  {
+               EM_DEBUG_EXCEPTION("emcore_get_account_reference failed [%d]", account_id);
                err = EMF_ERROR_INVALID_ACCOUNT;
                goto FINISH_OFF;
        }
 
        /*  get mail to send */
-       if (!em_core_mail_get_mail(mail_id, &mail, &err))  {
-               EM_DEBUG_EXCEPTION("em_core_mail_get_mail failed [%d]", err);
+       if ( !emstorage_get_mail_by_id(mail_id, &mail_tbl_data, false, &err) || err != EMF_ERROR_NONE)  {
+               EM_DEBUG_EXCEPTION("emstorage_get_mail_by_id failed [%d]", err);
+               goto FINISH_OFF;
+       }
+
+       if ( (err = emstorage_get_attachment_list(mail_id, false, &attachment_tbl_data, &attachment_tbl_count)) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("emstorage_get_attachment_list failed [%d]", err);
                goto FINISH_OFF;
        }
 
-       if (!em_core_check_send_mail_thread_status()) {
-               EM_DEBUG_EXCEPTION("em_core_check_send_mail_thread_status failed...");
+       if (!emcore_check_send_mail_thread_status()) {
+               EM_DEBUG_EXCEPTION("emcore_check_send_mail_thread_status failed...");
                err = EMF_ERROR_CANCELLED;
                goto FINISH_OFF;
        }
 
-       if ((!mail->head->to) && (!mail->head->cc) && (!mail->head->bcc)) {
+       if ((!mail_tbl_data->full_address_to) && (!mail_tbl_data->full_address_cc) && (!mail_tbl_data->full_address_bcc)) {
                err = EMF_ERROR_NO_RECIPIENT;
                EM_DEBUG_EXCEPTION("No Recipient information [%d]", err);
                goto FINISH_OFF;
        }
        else {
-               if (!em_core_verify_email_address_of_mail_header(mail->head, false, &err)) {
+               if ( (err = em_verify_email_address_of_mail_tbl(mail_tbl_data, false)) != EMF_ERROR_NONE ) {
                        err = EMF_ERROR_INVALID_ADDRESS;
-                       EM_DEBUG_EXCEPTION("em_core_verify_email_address_of_mail_header failed [%d]", err);
+                       EM_DEBUG_EXCEPTION("em_verify_email_address_of_mail_tbl failed [%d]", err);
                        goto FINISH_OFF;
                }
        }
-       
-       if (mail->info)
-               mail->info->account_id = account_id;            
-       
-       if (!em_core_check_send_mail_thread_status()) {
-               EM_DEBUG_EXCEPTION("em_core_check_send_mail_thread_status failed...");
+
+       if (!emcore_check_send_mail_thread_status()) {
+               EM_DEBUG_EXCEPTION("emcore_check_send_mail_thread_status failed...");
                err = EMF_ERROR_CANCELLED;
                goto FINISH_OFF;
        }
@@ -1454,14 +1072,14 @@ EXPORT_API int em_core_mail_send(int account_id, char *input_mailbox_name, int m
        if (sending_option != NULL)
                opt = sending_option;
        else
-               opt = em_core_get_option(&err);
+               opt = emcore_get_option(&err);
        
        
        /*Update status flag to DB*/
        
        /*  get rfc822 data */
-       if (!em_core_mail_get_rfc822(mail, &envelope, &fpath, opt, &err))  {
-               EM_DEBUG_EXCEPTION("em_core_mail_get_rfc822 failed [%d]", err);
+       if (!emcore_make_rfc822_file_from_mail(mail_tbl_data, attachment_tbl_data, attachment_tbl_count, &envelope, &fpath, opt, &err))  {
+               EM_DEBUG_EXCEPTION("emcore_make_rfc822_file_from_mail failed [%d]", err);
                goto FINISH_OFF;
        }
        
@@ -1478,14 +1096,14 @@ EXPORT_API int em_core_mail_send(int account_id, char *input_mailbox_name, int m
                mail_parameters(NULL, SET_SSLSTART, NULL);
        }
 
-       if (!em_core_check_send_mail_thread_status()) {
-               EM_DEBUG_EXCEPTION("em_core_check_send_mail_thread_status failed...");
+       if (!emcore_check_send_mail_thread_status()) {
+               EM_DEBUG_EXCEPTION("emcore_check_send_mail_thread_status failed...");
                err = EMF_ERROR_CANCELLED;
                goto FINISH_OFF;
        }
        
        if (ref_account->pop_before_smtp != FALSE)  {
-               if (!em_core_mailbox_open(account_id, NULL, (void **)&tmp_stream, &err))  {
+               if (!emcore_connect_to_remote_mailbox(account_id, NULL, (void **)&tmp_stream, &err))  {
                        EM_DEBUG_EXCEPTION(" POP before SMTP Authentication failed [%d]", err);
                        status = EMF_LIST_CONNECTION_FAIL;
                        if (err == EMF_ERROR_CONNECTION_BROKEN)
@@ -1495,14 +1113,13 @@ EXPORT_API int em_core_mail_send(int account_id, char *input_mailbox_name, int m
        }
 
 
-       if (!em_storage_get_mailboxname_by_mailbox_type(account_id, EMF_MAILBOX_TYPE_DRAFT, &mailbox_name, false, &err))  {
-               EM_DEBUG_EXCEPTION(" em_storage_get_mailboxname_by_mailbox_type failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+       if (!emstorage_get_mailboxname_by_mailbox_type(account_id, EMF_MAILBOX_TYPE_DRAFT, &mailbox_name, false, &err))  {
+               EM_DEBUG_EXCEPTION(" emstorage_get_mailboxname_by_mailbox_type failed [%d]", err);
                goto FINISH_OFF;
        }
 
-       if (!em_core_mailbox_open(account_id, (char *)ENCODED_PATH_SMTP, (void **)&tmp_stream, &err))  {
-               EM_DEBUG_EXCEPTION(" em_core_mailbox_open failed [%d]", err);
+       if (!emcore_connect_to_remote_mailbox(account_id, (char *)ENCODED_PATH_SMTP, (void **)&tmp_stream, &err))  {
+               EM_DEBUG_EXCEPTION(" emcore_connect_to_remote_mailbox failed [%d]", err);
                
                if (err == EMF_ERROR_CONNECTION_BROKEN)
                        err = EMF_ERROR_CANCELLED;
@@ -1513,8 +1130,8 @@ EXPORT_API int em_core_mail_send(int account_id, char *input_mailbox_name, int m
        
        stream = (SENDSTREAM *)tmp_stream;
 
-       if (!em_core_check_send_mail_thread_status()) {
-               EM_DEBUG_EXCEPTION(" em_core_check_send_mail_thread_status failed...");
+       if (!emcore_check_send_mail_thread_status()) {
+               EM_DEBUG_EXCEPTION(" emcore_check_send_mail_thread_status failed...");
                err = EMF_ERROR_CANCELLED;
                goto FINISH_OFF;
        }
@@ -1528,62 +1145,59 @@ EXPORT_API int em_core_mail_send(int account_id, char *input_mailbox_name, int m
                EM_DEBUG_LOG("opt->req_delivery_receipt == EMF_OPTION_REQ_DELIVERY_RECEIPT_ON");
        }
        
-       mail->info->extra_flags.status = EMF_MAIL_STATUS_SENDING;
+       mail_tbl_data->save_status = EMF_MAIL_STATUS_SENDING;
 
-       /*Update status flag to DB*/
-       if (!em_core_mail_modify_extra_flag(mail_id, mail->info->extra_flags, &err))
-               EM_DEBUG_EXCEPTION("Failed to modify extra flag [%d]", err);
+       /*Update status save_status to DB*/
+       if (!emstorage_set_field_of_mails_with_integer_value(account_id, &mail_id, 1, "save_status", mail_tbl_data->save_status, false, &err))
+               EM_DEBUG_EXCEPTION("emstorage_set_field_of_mails_with_integer_value failed [%d]", err);
 
        /*  send mail to server. */
-       if (!em_core_mail_send_smtp(stream, envelope, fpath, account_id, mail_id, &err)) {
-               EM_DEBUG_EXCEPTION(" em_core_mail_send_smtp failed [%d]", err);
-
+       if (!emcore_send_mail_smtp(stream, envelope, fpath, account_id, mail_id, &err)) {
+               EM_DEBUG_EXCEPTION(" emcore_send_mail_smtp failed [%d]", err);
                
 #ifndef __FEATURE_MOVE_TO_OUTBOX_FIRST__
-       EM_SAFE_FREE(mailbox_name);
-       if (!em_storage_get_mailboxname_by_mailbox_type(account_id, EMF_MAILBOX_TYPE_OUTBOX, &mailbox_name, false, &err))  {
-               EM_DEBUG_EXCEPTION(" em_storage_get_mailboxname_by_mailbox_type failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
-               goto FINISH_OFF;
-       }
-       dest_mbox.name = mailbox_name;
-       dest_mbox.account_id = account_id;
-               
-       /*  unsent mail is moved to 'OUTBOX'. */
-       if (!em_core_mail_move(&mail_id, 1, dest_mbox.name, EMF_MOVED_BY_COMMAND, 0, NULL)) 
-               EM_DEBUG_EXCEPTION(" em_core_mail_move falied...");
-#endif
-       
+               EM_SAFE_FREE(mailbox_name);
+               if (!emstorage_get_mailboxname_by_mailbox_type(account_id, EMF_MAILBOX_TYPE_OUTBOX, &mailbox_name, false, &err))  {
+                       EM_DEBUG_EXCEPTION(" emstorage_get_mailboxname_by_mailbox_type failed [%d]", err);
 
-               goto FINISH_OFF;
+                       goto FINISH_OFF;
+               }
+               dest_mbox.name = mailbox_name;
+               dest_mbox.account_id = account_id;
+
+               /*  unsent mail is moved to 'OUTBOX'. */
+               if (!emcore_mail_move(&mail_id, 1, dest_mbox.name, EMF_MOVED_BY_COMMAND, 0, NULL))
+                       EM_DEBUG_EXCEPTION(" emcore_mail_move falied...");
+                       goto FINISH_OFF;
+#endif
        }
        
        /*  sent mail is moved to 'SENT' box or deleted. */
        if (opt->keep_local_copy)  {
                EM_SAFE_FREE(mailbox_name);
                
-               if (!em_storage_get_mailboxname_by_mailbox_type(account_id, EMF_MAILBOX_TYPE_SENTBOX, &mailbox_name, false, &err))  {
-                       EM_DEBUG_EXCEPTION(" em_storage_get_mailboxname_by_mailbox_type failed [%d]", err);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+               if (!emstorage_get_mailboxname_by_mailbox_type(account_id, EMF_MAILBOX_TYPE_SENTBOX, &mailbox_name, false, &err))  {
+                       EM_DEBUG_EXCEPTION(" emstorage_get_mailboxname_by_mailbox_type failed [%d]", err);
+       
                        goto FINISH_OFF;
                }
                dest_mbox.name = mailbox_name;
                dest_mbox.account_id = account_id;
                
-               if (!em_core_mail_move(&mail_id, 1, dest_mbox.name, EMF_MOVED_AFTER_SENDING, 0, &err)) 
-                       EM_DEBUG_EXCEPTION(" em_core_mail_move falied [%d]", err);
+               if (!emcore_mail_move(&mail_id, 1, dest_mbox.name, EMF_MOVED_AFTER_SENDING, 0, &err)) 
+                       EM_DEBUG_EXCEPTION(" emcore_mail_move falied [%d]", err);
 #ifdef __FEATURE_SYNC_CLIENT_TO_SERVER__               
-#ifdef __LOCAL_ACTIVITY__              
+#ifdef __FEATURE_LOCAL_ACTIVITY__              
                else if (ref_account->receiving_server_type == EMF_SERVER_TYPE_IMAP4) /* To be synced to Sent box only IMAP not for POP */ {
 
-                       emf_activity_tbl_t new_activity;
+                       emstorage_activity_tbl_t new_activity;
                        int activityid = 0;
                        
-                       if (false == em_core_get_next_activity_id(&activityid, &err)) {
-                               EM_DEBUG_EXCEPTION(" em_core_get_next_activity_id Failed [%d] ", err);
+                       if (false == emcore_get_next_activity_id(&activityid, &err)) {
+                               EM_DEBUG_EXCEPTION(" emcore_get_next_activity_id Failed [%d] ", err);
                        }
 
-                       memset(&new_activity, 0x00, sizeof(emf_activity_tbl_t));
+                       memset(&new_activity, 0x00, sizeof(emstorage_activity_tbl_t));
                        new_activity.activity_id  =  activityid;
                        new_activity.server_mailid = NULL;
                        new_activity.account_id = account_id;
@@ -1592,12 +1206,12 @@ EXPORT_API int em_core_mail_send(int account_id, char *input_mailbox_name, int m
                        new_activity.dest_mbox  = NULL;
                        new_activity.src_mbox   = NULL;
                
-                       if (!em_core_activity_add(&new_activity, &err)) {
-                               EM_DEBUG_EXCEPTION(" em_core_activity_add Failed [%d] ", err);
+                       if (!emcore_add_activity(&new_activity, &err)) {
+                               EM_DEBUG_EXCEPTION(" emcore_add_activity Failed [%d] ", err);
                        }
                        
-                       if (!em_core_mail_move_from_server(dest_mbox.account_id, mailbox_name, &mail_id, 1, dest_mbox.name, &err)) {
-                               EM_DEBUG_EXCEPTION(" em_core_mail_move_from_server falied [%d]", err);
+                       if (!emcore_move_mail_on_server(dest_mbox.account_id, mailbox_name, &mail_id, 1, dest_mbox.name, &err)) {
+                               EM_DEBUG_EXCEPTION(" emcore_move_mail_on_server falied [%d]", err);
                        }
                        else {
                                /* Remove ACTIVITY_SAVEMAIL activity */
@@ -1609,7 +1223,7 @@ EXPORT_API int em_core_mail_send(int account_id, char *input_mailbox_name, int m
                                new_activity.server_mailid = NULL;
                                new_activity.src_mbox   = NULL;
                                
-                               if (!em_core_activity_delete(&new_activity, &err)) {
+                               if (!emcore_delete_activity(&new_activity, &err)) {
                                        EM_DEBUG_EXCEPTION(">>>>>>Local Activity [ACTIVITY_SAVEMAIL] [%d] ", err);
                                }
                        }
@@ -1619,46 +1233,42 @@ EXPORT_API int em_core_mail_send(int account_id, char *input_mailbox_name, int m
 #endif         
 
                /* On Successful Mail sent remove the Draft flag */
-               emf_mail_flag_t update_flag;
-               if (mail->info)
-                       memcpy(&update_flag, &(mail->info->flags), sizeof(emf_mail_flag_t));
-               else
-                       memset(&update_flag, 0x00, sizeof(emf_mail_flag_t));
-               update_flag.draft = 0;
-               int sticky_flag = 1;
-               if (!em_core_mail_modify_flag(mail_id, update_flag, sticky_flag, &err))
-                       EM_DEBUG_EXCEPTION(" Flag Modification Failed [ %d] ", err);
+               mail_tbl_data->flags_draft_field = 0;
+
+               if (!emstorage_set_field_of_mails_with_integer_value(account_id, &mail_id, 1, "flags_draft_field", mail_tbl_data->flags_draft_field, false, &err))
+                       EM_DEBUG_EXCEPTION("Failed to modify extra flag [%d]", err);
+
                sent_box = 1; 
        }
        else  {
-               if (!em_core_mail_delete(account_id, &mail_id, 1, 0, EMF_DELETED_AFTER_SENDING, false, &err)) 
-                       EM_DEBUG_EXCEPTION(" em_core_mail_delete failed [%d]", err);
+               if (!emcore_delete_mail(account_id, &mail_id, 1, 0, EMF_DELETED_AFTER_SENDING, false, &err)) 
+                       EM_DEBUG_EXCEPTION(" emcore_delete_mail failed [%d]", err);
        }
-       
-       /*Update status flag to DB*/
-               mail->info->extra_flags.status = EMF_MAIL_STATUS_SENT;
-       if (!em_core_mail_modify_extra_flag(mail_id, mail->info->extra_flags, &err))
-               EM_DEBUG_EXCEPTION("Failed to modify extra flag [%d]", err);
-       /*Update status flag to DB*/
-               if (!em_core_delete_transaction_info_by_mailId(mail_id))
-                       EM_DEBUG_EXCEPTION(" em_core_delete_transaction_info_by_mailId failed for mail_id[%d]", mail_id);
+
+       /*Update status save_status to DB*/
+       mail_tbl_data->save_status = EMF_MAIL_STATUS_SENT;
+       if (!emstorage_set_field_of_mails_with_integer_value(account_id, &mail_id, 1, "save_status", mail_tbl_data->save_status, false, &err))
+               EM_DEBUG_EXCEPTION("emstorage_set_field_of_mails_with_integer_value failed [%d]", err);
+
+       if (!emcore_delete_transaction_info_by_mailId(mail_id))
+               EM_DEBUG_EXCEPTION(" emcore_delete_transaction_info_by_mailId failed for mail_id[%d]", mail_id);
 
        ret = true;
        
 FINISH_OFF: 
-       if (ret == false && err != EMF_ERROR_INVALID_PARAM && mail)  {
+       if (ret == false && err != EMF_ERROR_INVALID_PARAM && mail_tbl_data)  {
                if (err != EMF_ERROR_CANCELLED) {
-                       mail->info->extra_flags.status = EMF_MAIL_STATUS_SEND_FAILURE;
-                       if (!em_core_mail_modify_extra_flag(mail_id, mail->info->extra_flags, &err2))
-                               EM_DEBUG_EXCEPTION("Failed to modify extra flag [%d]", err2);
+                       mail_tbl_data->save_status = EMF_MAIL_STATUS_SEND_FAILURE;
+                       if (!emstorage_set_field_of_mails_with_integer_value(account_id, &mail_id, 1, "save_status", mail_tbl_data->save_status, false, &err2))
+                               EM_DEBUG_EXCEPTION("emstorage_set_field_of_mails_with_integer_value failed [%d]", err2);
                }
                else {
-                       if (EMF_MAIL_STATUS_SEND_CANCELED == mail->info->extra_flags.status)
+                       if (EMF_MAIL_STATUS_SEND_CANCELED == mail_tbl_data->save_status)
                                EM_DEBUG_LOG("EMF_MAIL_STATUS_SEND_CANCELED Already set for ");
                        else {  
-                               mail->info->extra_flags.status = EMF_MAIL_STATUS_SEND_CANCELED;
-                               if (!em_core_mail_modify_extra_flag(mail_id, mail->info->extra_flags, &err2))
-                                       EM_DEBUG_EXCEPTION("Failed to modify extra flag [%d]", err2);
+                               mail_tbl_data->save_status = EMF_MAIL_STATUS_SEND_CANCELED;
+                               if (!emstorage_set_field_of_mails_with_integer_value(account_id, &mail_id, 1, "save_status", mail_tbl_data->save_status, false, &err2))
+                                       EM_DEBUG_EXCEPTION("emstorage_set_field_of_mails_with_integer_value failed [%d]", err2);
                        }
                }
        }
@@ -1669,8 +1279,13 @@ FINISH_OFF:
 #endif /* __FEATURE_KEEP_CONNECTION__ */
        if (stls) 
                mail_parameters(NULL, SET_SSLSTART, (void  *)stls);
-       if (mail) 
-               em_core_mail_free(&mail, 1, NULL);
+
+       if (mail_tbl_data)
+               emstorage_free_mail(&mail_tbl_data, 1, NULL);
+
+       if (attachment_tbl_data)
+               emstorage_free_attachment(&attachment_tbl_data, attachment_tbl_count, NULL);
+
        if (envelope) 
                mail_free_envelope(&envelope);
        
@@ -1681,50 +1296,50 @@ FINISH_OFF:
        }
        
        if (ret == true) {
-               if (!em_storage_notify_network_event(NOTI_SEND_FINISH, account_id, NULL, mail_id, 0))
-                       EM_DEBUG_EXCEPTION("em_storage_notify_network_event [NOTI_SEND_FINISH] Failed");
+               if (!emstorage_notify_network_event(NOTI_SEND_FINISH, account_id, NULL, mail_id, 0))
+                       EM_DEBUG_EXCEPTION("emstorage_notify_network_event [NOTI_SEND_FINISH] Failed");
        }
        else {
-               if (!em_storage_notify_network_event(NOTI_SEND_FAIL, account_id, NULL, mail_id, err))
-                       EM_DEBUG_EXCEPTION("em_storage_notify_network_event [NOTI_SEND_FAIL] Failed");
-               em_core_show_popup(mail_id, EMF_ACTION_SEND_MAIL, err);
+               if (!emstorage_notify_network_event(NOTI_SEND_FAIL, account_id, NULL, mail_id, err))
+                       EM_DEBUG_EXCEPTION("emstorage_notify_network_event [NOTI_SEND_FAIL] Failed");
+               emcore_show_popup(mail_id, EMF_ACTION_SEND_MAIL, err);
        }
        
        EM_SAFE_FREE(mailbox_name);
        
        if (err_code != NULL)
                *err_code = err;
-       EM_PROFILE_END(profile_em_core_mail_send);
+       EM_PROFILE_END(profile_emcore_send_mail);
        EM_DEBUG_FUNC_END("ret [%d], err [%d]", ret, err);
        return ret;
 }
 
-/*  send a saved message */
-EXPORT_API int em_core_mail_send_saved(int account_id, char *input_mailbox_name, emf_option_t *sending_option,  int *err_code)
+/*  send a saved all mails */
+INTERNAL_FUNC int emcore_send_saved_mail(int account_id, char *input_mailbox_name, emf_option_t *sending_option,  int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], input_mailbox_name[%p], sending_option[%p], err_code[%p]", account_id, input_mailbox_name, sending_option, err_code);
        
        int ret = false;
        int err = EMF_ERROR_NONE;
        int status = EMF_SEND_FAIL;
-       
+       int mail_id = 0;
+       int handle = 0;
+       int i = 0;
+       int total = 0;
+       int attachment_tbl_count = 0;
+       char *mailbox_name = NULL;
+       char *fpath = NULL;
        SENDSTREAM *stream = NULL;
        ENVELOPE *envelope = NULL;
-       emf_mailbox_t   dest_mbox = {0};
-       emf_mail_t *mail = NULL;
+       emf_mailbox_t  dest_mbox = {0};
        emf_account_t *ref_account = NULL;
-       emf_mail_tbl_t  mail_table_data = {0};
+       emstorage_mail_tbl_t       *searched_mail_tbl_data = NULL;
+       emstorage_attachment_tbl_t *attachment_tbl_data    = NULL;
        emf_option_t *opt = NULL;
        sslstart_t      stls = NULL;
        void *tmp_stream = NULL;
        void *p = NULL;
-       char *fpath = NULL;
-       int mail_id = 0; 
-       int handle = 0;
-       int i = 0;
-       int total = 0;
-       char *mailbox_name = NULL;      
-       
+
        if (!account_id || !input_mailbox_name)  {
                EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
                err = EMF_ERROR_INVALID_PARAM;
@@ -1733,8 +1348,8 @@ EXPORT_API int em_core_mail_send_saved(int account_id, char *input_mailbox_name,
        
        mail_send_notify(EMF_SEND_PREPARE, 0, 0, account_id, mail_id, err);
        
-       if (!(ref_account = em_core_get_account_reference(account_id)))  {
-               EM_DEBUG_EXCEPTION("em_core_get_account_reference failed [%d]", account_id);
+       if (!(ref_account = emcore_get_account_reference(account_id)))  {
+               EM_DEBUG_EXCEPTION("emcore_get_account_reference failed [%d]", account_id);
                err = EMF_ERROR_INVALID_ACCOUNT;
                goto FINISH_OFF;
        }
@@ -1744,12 +1359,11 @@ EXPORT_API int em_core_mail_send_saved(int account_id, char *input_mailbox_name,
        if (sending_option)
                opt = sending_option;
        else
-               opt = em_core_get_option(&err);
+               opt = emcore_get_option(&err);
        
        /*  search mail. */
-       if (!em_storage_mail_search_start(NULL, account_id, input_mailbox_name, 0, &handle, &total, true, &err))  {
-               EM_DEBUG_EXCEPTION("em_storage_mail_search_start failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+       if (!emstorage_mail_search_start(NULL, account_id, input_mailbox_name, 0, &handle, &total, true, &err))  {
+               EM_DEBUG_EXCEPTION("emstorage_mail_search_start failed [%d]", err);
                goto FINISH_OFF;
        }
        
@@ -1757,46 +1371,42 @@ EXPORT_API int em_core_mail_send_saved(int account_id, char *input_mailbox_name,
                FINISH_OFF_IF_CANCELED;
                
                p = NULL;
-               if (!em_storage_mail_search_result(handle, RETRIEVE_ID, (void **)&p, true, &err))  {
-                       EM_DEBUG_EXCEPTION("em_storage_mail_search_result failed [%d]", err);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+               if (!emstorage_mail_search_result(handle, RETRIEVE_ID, (void **)&p, true, &err))  {
+                       EM_DEBUG_EXCEPTION("emstorage_mail_search_result failed [%d]", err);
                        goto FINISH_OFF;
                }
                
                mail_id = (int)p;
                
-               if (!em_core_mail_get_mail(mail_id, &mail, &err))  {
-                       EM_DEBUG_EXCEPTION("em_core_mail_get_mail failed [%d]", err);
+               if (!emstorage_get_mail_by_id(mail_id, &searched_mail_tbl_data, false, &err)) {
+                       EM_DEBUG_EXCEPTION("emstorage_get_mail_by_id failed [%d]", err);
+                       goto FINISH_OFF;
+               }
+
+               if ( (err = emstorage_get_attachment_list(mail_id, false, &attachment_tbl_data, &attachment_tbl_count)) != EMF_ERROR_NONE) {
+                       EM_DEBUG_EXCEPTION("emstorage_get_attachment_list failed [%d]", err);
                        goto FINISH_OFF;
                }
 
                /* check for email_address validation */
-               if (!em_core_verify_email_address_of_mail_header(mail->head, false, &err)) {
-                       EM_DEBUG_EXCEPTION("em_core_verify_email_address_of_mail_header failed [%d]", err);
+               if ( (err = em_verify_email_address_of_mail_tbl(searched_mail_tbl_data, false)) != EMF_ERROR_NONE ) {
+                       err = EMF_ERROR_INVALID_ADDRESS;
+                       EM_DEBUG_EXCEPTION("em_verify_email_address_of_mail_tbl failed [%d]", err);
                        goto FINISH_OFF;
                }
 
                /*  check that this mail was saved in offline-mode. */
-               if (mail->info->extra_flags.status != EMF_MAIL_STATUS_SAVED_OFFLINE)  {
+               if (searched_mail_tbl_data->save_status != EMF_MAIL_STATUS_SAVED_OFFLINE)  {
                        EM_DEBUG_EXCEPTION(" mail was not saved in offline mode...");
-                       em_core_mail_free(&mail, 1, &err); mail = NULL;
+                       emstorage_free_mail(&searched_mail_tbl_data, 1, &err);
+                       searched_mail_tbl_data = NULL;
                        continue;
                }
                
-               if(!em_convert_mail_flag_to_mail_tbl(&(mail->info->flags), &mail_table_data, &err)) {
-                       EM_DEBUG_EXCEPTION("em_convert_mail_flag_to_mail_tbl failed [%d]", err);
-                       goto FINISH_OFF;
-               }
-               
-               mail_table_data.save_status = mail->info->extra_flags.status;
-               mail_table_data.lock_status = mail->info->extra_flags.lock;
-               mail_table_data.priority = mail->info->extra_flags.priority;
-               mail_table_data.report_status = mail->info->extra_flags.report;
-               
-               mail->info->extra_flags.status = EMF_MAIL_STATUS_SENDING;
+               searched_mail_tbl_data->save_status = EMF_MAIL_STATUS_SENDING;
                
-               if (!em_core_mail_get_rfc822(mail, &envelope, &fpath, opt, &err))  {
-                       EM_DEBUG_EXCEPTION("em_core_mail_get_rfc822 falied [%d]", err);
+               if (!emcore_make_rfc822_file_from_mail(searched_mail_tbl_data, attachment_tbl_data, attachment_tbl_count, &envelope, &fpath, opt, &err))  {
+                       EM_DEBUG_EXCEPTION("emcore_make_rfc822_file_from_mail falied [%d]", err);
                        goto FINISH_OFF;
                }
                
@@ -1811,8 +1421,8 @@ EXPORT_API int em_core_mail_send_saved(int account_id, char *input_mailbox_name,
                        }
                        
                        stream = NULL;
-                       if (!em_core_mailbox_open(account_id, (char *)ENCODED_PATH_SMTP, &tmp_stream, &err) || !tmp_stream)  {
-                               EM_DEBUG_EXCEPTION("em_core_mailbox_open failed [%d]", err);
+                       if (!emcore_connect_to_remote_mailbox(account_id, (char *)ENCODED_PATH_SMTP, &tmp_stream, &err) || !tmp_stream)  {
+                               EM_DEBUG_EXCEPTION("emcore_connect_to_remote_mailbox failed [%d]", err);
 
                                if (err == EMF_ERROR_CONNECTION_BROKEN)
                                        err = EMF_ERROR_CANCELLED;
@@ -1838,66 +1448,72 @@ EXPORT_API int em_core_mail_send_saved(int account_id, char *input_mailbox_name,
                        mail_send_notify(EMF_SEND_START, 0, 0, account_id, mail_id, err);
                }
                
-               mail_table_data.save_status = EMF_MAIL_STATUS_SENDING;
+               searched_mail_tbl_data->save_status = EMF_MAIL_STATUS_SENDING;
                
                /*  update mail status to sending. */
-               if (!em_storage_change_mail_field(mail_id, UPDATE_EXTRA_FLAG, &mail_table_data, true, &err))  {
-                       EM_DEBUG_EXCEPTION("em_storage_change_mail_field failed [%d]", err);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+               if (!emstorage_change_mail_field(mail_id, UPDATE_EXTRA_FLAG, searched_mail_tbl_data, true, &err))  {
+                       EM_DEBUG_EXCEPTION("emstorage_change_mail_field failed [%d]", err);
+       
                        goto FINISH_OFF;
                }
                
-               if (!em_core_mail_send_smtp(stream, envelope, fpath, account_id, mail_id, &err))  {
-                       EM_DEBUG_EXCEPTION("em_core_mail_send_smtp failed [%d]", err);
+               if (!emcore_send_mail_smtp(stream, envelope, fpath, account_id, mail_id, &err))  {
+                       EM_DEBUG_EXCEPTION("emcore_send_mail_smtp failed [%d]", err);
                        
-                       mail_table_data.save_status = EMF_MAIL_STATUS_SEND_FAILURE;
+                       searched_mail_tbl_data->save_status = EMF_MAIL_STATUS_SEND_FAILURE;
                        
                        /*  update mail status to failure. */
-                       if (!em_storage_change_mail_field(mail_id, UPDATE_EXTRA_FLAG, &mail_table_data, true, &err)) 
-                               EM_DEBUG_EXCEPTION("em_storage_change_mail_field failed [%d]", err);
+                       if (!emstorage_change_mail_field(mail_id, UPDATE_EXTRA_FLAG, searched_mail_tbl_data, true, &err))
+                               EM_DEBUG_EXCEPTION("emstorage_change_mail_field failed [%d]", err);
                                                
-                       if (!em_storage_get_mailboxname_by_mailbox_type(account_id, EMF_MAILBOX_TYPE_OUTBOX, &mailbox_name, false, &err))  {
-                               EM_DEBUG_EXCEPTION("em_storage_get_mailboxname_by_mailbox_type failed [%d]", err);
-                               err = em_storage_get_emf_error_from_em_storage_error(err);
+                       if (!emstorage_get_mailboxname_by_mailbox_type(account_id, EMF_MAILBOX_TYPE_OUTBOX, &mailbox_name, false, &err))  {
+                               EM_DEBUG_EXCEPTION("emstorage_get_mailboxname_by_mailbox_type failed [%d]", err);
+               
                                goto FINISH_OFF;
                        }       
                        dest_mbox.name = mailbox_name;
                        dest_mbox.account_id = account_id;
                        
-                       em_core_mail_move(&mail_id, 1, dest_mbox.name, EMF_MOVED_AFTER_SENDING, 0, NULL);
+                       emcore_mail_move(&mail_id, 1, dest_mbox.name, EMF_MOVED_AFTER_SENDING, 0, NULL);
                        
                        goto FINISH_OFF;
                }
                
-               mail_table_data.save_status = EMF_MAIL_STATUS_SENT;
+               searched_mail_tbl_data->save_status = EMF_MAIL_STATUS_SENT;
                
                /*  update mail status to sent mail. */
-               if (!em_storage_change_mail_field(mail_id, UPDATE_EXTRA_FLAG, &mail_table_data, true, &err))  {
-                       EM_DEBUG_EXCEPTION("em_storage_change_mail_field failed [%d]", err);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+               if (!emstorage_change_mail_field(mail_id, UPDATE_EXTRA_FLAG, searched_mail_tbl_data, true, &err))  {
+                       EM_DEBUG_EXCEPTION("emstorage_change_mail_field failed [%d]", err);
                        goto FINISH_OFF;
                }
                
                /*  sent mail is moved to 'SENT' box or deleted. */
                if (opt->keep_local_copy)  {
                        EM_SAFE_FREE(mailbox_name);
-                       if (!em_storage_get_mailboxname_by_mailbox_type(account_id, EMF_MAILBOX_TYPE_SENTBOX, &mailbox_name, false, &err))  {
-                               EM_DEBUG_EXCEPTION("em_storage_get_mailboxname_by_mailbox_type failed [%d]", err);
-                               err = em_storage_get_emf_error_from_em_storage_error(err);
+                       if (!emstorage_get_mailboxname_by_mailbox_type(account_id, EMF_MAILBOX_TYPE_SENTBOX, &mailbox_name, false, &err))  {
+                               EM_DEBUG_EXCEPTION("emstorage_get_mailboxname_by_mailbox_type failed [%d]", err);
+               
                                goto FINISH_OFF;
                        }       
                        dest_mbox.name = mailbox_name;
                        dest_mbox.account_id = account_id;
                        
-                       if (!em_core_mail_move(&mail_id, 1, dest_mbox.name, EMF_MOVED_AFTER_SENDING, 0, &err)) 
-                               EM_DEBUG_EXCEPTION("em_core_mail_move falied [%d]", err);
+                       if (!emcore_mail_move(&mail_id, 1, dest_mbox.name, EMF_MOVED_AFTER_SENDING, 0, &err)) 
+                               EM_DEBUG_EXCEPTION("emcore_mail_move falied [%d]", err);
                }
                else  {
-                       if (!em_core_mail_delete(account_id, &mail_id, 1, 0, EMF_DELETED_AFTER_SENDING, false, &err)) 
-                               EM_DEBUG_EXCEPTION("em_core_mail_delete falied [%d]", err);
+                       if (!emcore_delete_mail(account_id, &mail_id, 1, 0, EMF_DELETED_AFTER_SENDING, false, &err)) 
+                               EM_DEBUG_EXCEPTION("emcore_delete_mail falied [%d]", err);
                }
                
-               em_core_mail_free(&mail, 1, NULL); mail = NULL;
+               if(searched_mail_tbl_data) {
+                       emstorage_free_mail(&searched_mail_tbl_data, 1, NULL);
+                       searched_mail_tbl_data = NULL;
+               }
+
+               if(attachment_tbl_data)
+                       emstorage_free_attachment(&attachment_tbl_data, attachment_tbl_count, NULL);
+
                mail_free_envelope(&envelope); envelope = NULL;
                
                if (fpath)  {
@@ -1920,12 +1536,15 @@ FINISH_OFF:
                mail_free_envelope(&envelope);
 
        if (handle)  {
-               if (!em_storage_mail_search_end(handle, true, &err))
-                       EM_DEBUG_EXCEPTION("em_storage_mail_search_end failed [%d]", err);
+               if (!emstorage_mail_search_end(handle, true, &err))
+                       EM_DEBUG_EXCEPTION("emstorage_mail_search_end failed [%d]", err);
        }
 
-       if (mail) 
-               em_core_mail_free(&mail, 1, NULL);
+       if (searched_mail_tbl_data)
+               emstorage_free_mail(&searched_mail_tbl_data, 1, NULL);
+
+       if(attachment_tbl_data)
+               emstorage_free_attachment(&attachment_tbl_data, attachment_tbl_count, NULL);
 
        if (fpath)  {
                remove(fpath);
@@ -1938,7 +1557,7 @@ FINISH_OFF:
                mail_send_notify(EMF_SEND_FINISH, 0, 0, account_id, mail_id, err);
        else {
                mail_send_notify(status, 0, 0, account_id, mail_id, err);
-               em_core_show_popup(account_id, EMF_ACTION_SEND_MAIL, err);
+               emcore_show_popup(account_id, EMF_ACTION_SEND_MAIL, err);
        }
        
        if (err_code != NULL)
@@ -1947,10 +1566,10 @@ FINISH_OFF:
        return ret;
 }      
 
-static int em_core_mail_send_smtp(SENDSTREAM *stream, ENVELOPE *env, char *data_file, int account_id, int mail_id, int *err_code)
+static int emcore_send_mail_smtp(SENDSTREAM *stream, ENVELOPE *env, char *data_file, int account_id, int mail_id, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("stream[%p], env[%p], data_file[%s], account_id[%d], mail_id[%d], err_code[%p]", stream, env, data_file, account_id, mail_id, err_code);
-       EM_PROFILE_BEGIN(profile_em_core_mail_send_smtp);
+       EM_PROFILE_BEGIN(profile_emcore_send_mail_smtp);
        
        int ret = false;
        int err = EMF_ERROR_NONE;
@@ -1973,8 +1592,8 @@ static int em_core_mail_send_smtp(SENDSTREAM *stream, ENVELOPE *env, char *data_
                goto FINISH_OFF;
        }
        
-       if (!(ref_account = em_core_get_account_reference(account_id))) {
-               EM_DEBUG_EXCEPTION("em_core_get_account_reference failed [%d]", account_id);
+       if (!(ref_account = emcore_get_account_reference(account_id))) {
+               EM_DEBUG_EXCEPTION("emcore_get_account_reference failed [%d]", account_id);
                err = EMF_ERROR_INVALID_ACCOUNT;
                goto FINISH_OFF;
        }
@@ -2129,7 +1748,7 @@ static int em_core_mail_send_smtp(SENDSTREAM *stream, ENVELOPE *env, char *data_
 
                EM_PROFILE_BEGIN(profile_allocation);
                /* Allocate a buffer of max 2MB to read from file */
-               data = (char *)em_core_malloc(allocSize);               
+               data = (char *)em_malloc(allocSize);            
                allocSize--;
                EM_PROFILE_END(profile_allocation);
 
@@ -2166,8 +1785,8 @@ static int em_core_mail_send_smtp(SENDSTREAM *stream, ENVELOPE *env, char *data_
                        else {
                                sent_percent = (int) ((double)sent / (double)total * 100.0);
                                if (last_sent_percent + 5 <= sent_percent) {
-                                       if (!em_storage_notify_network_event(NOTI_SEND_START, account_id, NULL, mail_id, sent_percent))
-                                               EM_DEBUG_EXCEPTION("em_storage_notify_network_event [NOTI_SEND_START] Failed >>>>");
+                                       if (!emstorage_notify_network_event(NOTI_SEND_START, account_id, NULL, mail_id, sent_percent))
+                                               EM_DEBUG_EXCEPTION("emstorage_notify_network_event [NOTI_SEND_START] Failed >>>>");
                                        last_sent_percent = sent_percent;
                                }
                                EM_DEBUG_LOG("Sent data Successfully. sent[%d] total[%d]", sent, total);
@@ -2194,8 +1813,8 @@ static int em_core_mail_send_smtp(SENDSTREAM *stream, ENVELOPE *env, char *data_
                        sent_percent = (int) ((double)sent / (double)total * 100.0);
                        if (last_sent_percent + 5 <= sent_percent) {
                                /* Disabled Temporary
-                               if (!em_storage_notify_network_event(NOTI_SEND_START, account_id, NULL, mail_id, sent_percent))
-                                       EM_DEBUG_EXCEPTION(" em_storage_notify_network_event [NOTI_SEND_START] Failed >>>>");
+                               if (!emstorage_notify_network_event(NOTI_SEND_START, account_id, NULL, mail_id, sent_percent))
+                                       EM_DEBUG_EXCEPTION(" emstorage_notify_network_event [NOTI_SEND_START] Failed >>>>");
                                */
                                last_sent_percent = sent_percent;
                        }
@@ -2228,7 +1847,7 @@ FINISH_OFF:
        
        if (fp)
                fclose(fp); 
-       EM_PROFILE_END(profile_em_core_mail_send_smtp);
+       EM_PROFILE_END(profile_emcore_send_mail_smtp);
        EM_DEBUG_FUNC_END("ret [%d]", ret);
        return ret;
 }
@@ -2236,7 +1855,7 @@ FINISH_OFF:
 /* ------ rfc822 handle --------------------------------------------------- */
 #define RANDOM_NUMBER_LENGTH 35
 
-char *em_core_generate_content_id_string(const char *hostname, int *err)
+char *emcore_generate_content_id_string(const char *hostname, int *err)
 {
        EM_DEBUG_FUNC_BEGIN("hostname[%p]", hostname);
 
@@ -2373,29 +1992,29 @@ static int attach_part(BODY *body, const unsigned char *data, int data_len, char
                if(encoded_file_name == NULL)
                        encoded_file_name = strdup(filename);
 
-               if(!em_core_encode_base64(encoded_file_name, strlen(encoded_file_name), &base64_file_name, (unsigned long*)&base64_file_name_length, &error)) {
-                       EM_DEBUG_EXCEPTION("em_core_encode_base64 failed. error [%d]", error);
+               if(!em_encode_base64(encoded_file_name, strlen(encoded_file_name), &base64_file_name, (unsigned long*)&base64_file_name_length, &error)) {
+                       EM_DEBUG_EXCEPTION("em_encode_base64 failed. error [%d]", error);
                        goto FINISH_OFF;
                }
                
-               result_file_name = em_core_replace_string(base64_file_name, "\015\012", "");
+               result_file_name = em_replace_string(base64_file_name, "\015\012", "");
                
                EM_DEBUG_LOG("base64_file_name_length [%d]", base64_file_name_length);
                
                if(result_file_name) {
                        EM_SAFE_FREE(encoded_file_name);
-                       encoded_file_name = em_core_malloc(strlen(result_file_name) + 15);
+                       encoded_file_name = em_malloc(strlen(result_file_name) + 15);
                        if(!encoded_file_name) {
-                               EM_DEBUG_EXCEPTION("em_core_malloc failed.");
+                               EM_DEBUG_EXCEPTION("em_malloc failed.");
                                goto FINISH_OFF;
                        }
                        snprintf(encoded_file_name, strlen(result_file_name) + 15, "=?UTF-8?B?%s?=", result_file_name);
                        EM_DEBUG_LOG("encoded_file_name [%s]", encoded_file_name);
                }
 
-               extension = em_core_get_extension_from_file_path(filename, NULL);
+               extension = em_get_extension_from_file_path(filename, NULL);
 
-               part->body.type = em_core_get_content_type(extension, NULL);
+               part->body.type = em_get_content_type_from_extension_string(extension, NULL);
                if(part->body.type == TYPEIMAGE)
                        part->body.subtype = strdup(extension);
                else
@@ -2430,7 +2049,7 @@ static int attach_part(BODY *body, const unsigned char *data, int data_len, char
 
                if (is_inline) {        
                        /*  CONTENT-ID */
-                       part->body.id = em_core_generate_content_id_string("com.samsung.slp.email", &error);
+                       part->body.id = emcore_generate_content_id_string("com.samsung.slp.email", &error);
                        part->body.type = TYPEIMAGE;
                        /*  EM_SAFE_FREE(part->body.subtype); */
                        /*  part->body.subtype = EM_SAFE_STRDUP(content_sub_type); */
@@ -2622,17 +2241,18 @@ FINISH_OFF:
        return new_part;
 }
 
-static int attach_attachment_to_body(BODY **multipart_body, BODY *text_body, emf_attachment_info_t *atch, int *err_code)
+static int attach_attachment_to_body(BODY **multipart_body, BODY *text_body, emstorage_attachment_tbl_t *input_attachment_tbl, int input_attachment_tbl_count, int *err_code)
 {
-       EM_DEBUG_FUNC_BEGIN("multipart_body[%p], text_body[%p], atch[%p], err_code[%p]", multipart_body, text_body, atch, err_code);
+       EM_DEBUG_FUNC_BEGIN("multipart_body[%p], text_body[%p], input_attachment_tbl[%p], input_attachment_tbl_count [%d], err_code[%p]", multipart_body, text_body, input_attachment_tbl, input_attachment_tbl_count, err_code);
        
        int ret = false;
+       int i = 0;
        int error = EMF_ERROR_NONE;
        BODY *frame_body = NULL;
        /*  make multipart body(multipart frame_body..) .. that has not content..  */
        
-       if (!multipart_body || !text_body || !atch) {
-               EM_DEBUG_EXCEPTION(" multipart_body[%p], text_body[%p], atch[%p]", multipart_body, text_body, atch);
+       if (!multipart_body || !text_body || !input_attachment_tbl) {
+               EM_DEBUG_EXCEPTION(" multipart_body[%p], text_body[%p], input_attachment_tbl[%p]", multipart_body, text_body, input_attachment_tbl);
                error = EMF_ERROR_INVALID_PARAM;
                goto FINISH_OFF;
        }
@@ -2656,29 +2276,30 @@ static int attach_attachment_to_body(BODY **multipart_body, BODY *text_body, emf
        }
        
        /*  insert files..  */
-       emf_attachment_info_t *p = atch;
+       emstorage_attachment_tbl_t *temp_attachment_tbl = NULL;
        char *name = NULL;
        struct stat st_buf;
        
-       while (p)  {
-               EM_DEBUG_LOG("insert files - attachment id[%d]", p->attachment_id);
-               if (stat(p->savename, &st_buf) == 0)  {
-                       if (!p->name)  {
-                               if (!em_core_get_file_name(p->savename, &name, &error))  {
-                                       EM_DEBUG_EXCEPTION("em_core_get_file_name failed [%d]", error);
+       for(i = 0; i < input_attachment_tbl_count; i++) {
+               temp_attachment_tbl = input_attachment_tbl + i;
+
+               EM_DEBUG_LOG("insert files - attachment id[%d]", temp_attachment_tbl->attachment_id);
+
+               if (stat(temp_attachment_tbl->attachment_path, &st_buf) == 0)  {
+                       if (!temp_attachment_tbl->attachment_name)  {
+                               if (!emcore_get_file_name(temp_attachment_tbl->attachment_path, &name, &error))  {
+                                       EM_DEBUG_EXCEPTION("emcore_get_file_name failed [%d]", error);
                                        goto FINISH_OFF;
                                }
                        }
                        else 
-                               name = p->name;
+                               name = temp_attachment_tbl->attachment_name;
                        
-                       if (!attach_part(frame_body, (unsigned char *)p->savename, 0, name, NULL, false, &error))  {
+                       if (!attach_part(frame_body, (unsigned char *)temp_attachment_tbl->attachment_path, 0, name, NULL, false, &error))  {
                                EM_DEBUG_EXCEPTION("attach_part failed [%d]", error);
                                goto FINISH_OFF;
                        }
                }
-               
-               p = p->next;
        }
        
        ret = true;
@@ -2695,7 +2316,7 @@ FINISH_OFF:
        return ret;
 }
 
-static char *em_core_encode_rfc2047_text(char *utf8_text, int *err_code)
+static char *emcore_encode_rfc2047_text(char *utf8_text, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("utf8_text[%s], err_code[%p]", utf8_text, err_code);
        
@@ -2715,13 +2336,13 @@ static char *em_core_encode_rfc2047_text(char *utf8_text, int *err_code)
                return EM_SAFE_STRDUP("");
 }
 
-static void em_core_encode_rfc2047_address(ADDRESS *address, int *err_code)
+static void emcore_encode_rfc2047_address(ADDRESS *address, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("address[%p], err_code[%p]", address, err_code);
        
        while (address)  {
                if (address->personal)  {
-                       char *rfc2047_personal = em_core_encode_rfc2047_text(address->personal, err_code);
+                       char *rfc2047_personal = emcore_encode_rfc2047_text(address->personal, err_code);
                        EM_SAFE_FREE(address->personal);
                        address->personal = rfc2047_personal;
                }
@@ -2731,46 +2352,46 @@ static void em_core_encode_rfc2047_address(ADDRESS *address, int *err_code)
 }
 
 #define DATE_STR_LENGTH 100
-/*  Description :  send mail to network(and save to sent-mailbox) or draft-mailbox, */
+/*  Description : Make RFC822 text file from mail_tbl data */
 /*  Parameters :  */
-/*                     mail :   */
+/*                     input_mail_tbl_data :   */
 /*                     is_draft  :  this mail is draft mail. */
 /*                     file_path :  path of file that rfc822 data will be written to. */
-EXPORT_API int em_core_mail_get_rfc822(emf_mail_t *mail, ENVELOPE **env, char **file_path, emf_option_t *sending_option, int *err_code)
+INTERNAL_FUNC int emcore_make_rfc822_file_from_mail(emstorage_mail_tbl_t *input_mail_tbl_data, emstorage_attachment_tbl_t *input_attachment_tbl, int input_attachment_count, ENVELOPE **env, char **file_path, emf_option_t *sending_option, int *err_code)
 {
-       EM_DEBUG_FUNC_BEGIN("mail[%p], env[%p], file_path[%p], sending_option[%p], err_code[%p]", mail, env, file_path, sending_option, err_code);
-       
-       int ret = false;
-       int error = EMF_ERROR_NONE;
-       
-       ENVELOPE *envelope = NULL;
-       BODY *text_body = NULL, *html_body = NULL;
-       BODY *root_body = NULL;
-       PART *part_for_html = NULL, *part_for_text = NULL;
+       EM_DEBUG_FUNC_BEGIN("input_mail_tbl_data[%p], env[%p], file_path[%p], sending_option[%p], err_code[%p]", input_mail_tbl_data, env, file_path, sending_option, err_code);
+       
+       int       ret = false;
+       int       error = EMF_ERROR_NONE;
+       int       is_incomplete = 0;
+       int       i = 0;
+       ENVELOPE *envelope      = NULL;
+       BODY     *text_body     = NULL;
+       BODY     *html_body     = NULL;
+       BODY     *root_body     = NULL;
+       PART     *part_for_html = NULL;
+       PART     *part_for_text = NULL;
+       char     *pAdd = NULL;
+       char     *fname = NULL;
        emf_extra_flag_t extra_flag;
-       char *fname = NULL;
-       int is_incomplete = 0;
        emf_account_t *ref_account = NULL;
-       char *pAdd = NULL;
-       
-       if (!mail || !mail->info || !mail->head)  {
-               if (mail != NULL)
-                       EM_DEBUG_EXCEPTION("mail->info[%p], mail->head[%p]", mail->info, mail->head);
-               
+
+       if (!input_mail_tbl_data)  {
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
                error = EMF_ERROR_INVALID_PARAM;
                goto FINISH_OFF;
        }
        
-       if (mail->info->extra_flags.report != EMF_MAIL_REPORT_MDN && !mail->body) {
-               EM_DEBUG_EXCEPTION("mail->body[%p]", mail->body);
+       if (input_mail_tbl_data->report_status != EMF_MAIL_REPORT_MDN && !input_mail_tbl_data->body_download_status) {
+               EM_DEBUG_EXCEPTION("input_mail_tbl_data->body_download_status[%p]", input_mail_tbl_data->body_download_status);
                error = EMF_ERROR_INVALID_PARAM;
                goto FINISH_OFF;
        }
-
        
-       ref_account = em_core_get_account_reference(mail->info->account_id);
+       ref_account = emcore_get_account_reference(input_mail_tbl_data->account_id);
+
        if (!ref_account)  {    
-               EM_DEBUG_EXCEPTION("em_core_get_account_reference failed [%d]", mail->info->account_id);
+               EM_DEBUG_EXCEPTION("emcore_get_account_reference failed [%d]", input_mail_tbl_data->account_id);
                error = EMF_ERROR_INVALID_ACCOUNT;
                goto FINISH_OFF;
        }
@@ -2781,7 +2402,7 @@ EXPORT_API int em_core_mail_get_rfc822(emf_mail_t *mail, ENVELOPE **env, char **
                goto FINISH_OFF;
        }
        
-       is_incomplete = mail->info->flags.draft || (mail->info->extra_flags.status == EMF_MAIL_STATUS_SENDING);/* 4 */
+       is_incomplete = input_mail_tbl_data->flags_draft_field || (input_mail_tbl_data->save_status == EMF_MAIL_STATUS_SENDING);
        
        if (is_incomplete)  {
                if (ref_account->email_addr && ref_account->email_addr[0] != '\0')  {
@@ -2794,23 +2415,21 @@ EXPORT_API int em_core_mail_get_rfc822(emf_mail_t *mail, ENVELOPE **env, char **
                        }
                        
                        EM_DEBUG_LOG("Assign envelop->from");
-                       if (mail->head && mail->head->from) {
-                               char *pAdd = NULL ;
-                               em_core_skip_whitespace(mail->head->from , &pAdd);
-                               EM_DEBUG_LOG("address[pAdd][%s]", pAdd);
-
-                               rfc822_parse_adrlist(&envelope->from, pAdd, ref_account->sending_server_addr);
-                               EM_SAFE_FREE(pAdd);
-                               pAdd = NULL ;
+
+                       if (input_mail_tbl_data->full_address_from) {
+                               char *temp_address_string = NULL ;
+                               em_skip_whitespace(input_mail_tbl_data->full_address_from , &temp_address_string);
+                               EM_DEBUG_LOG("address[temp_address_string][%s]", temp_address_string);
+                               rfc822_parse_adrlist(&envelope->from, temp_address_string, ref_account->sending_server_addr);
+                               EM_SAFE_FREE(temp_address_string);
+                               temp_address_string = NULL ;
                        }
                        else
                                envelope->from = rfc822_parse_mailbox(&p, NULL);
 
-
                        EM_SAFE_FREE(p);                
                        if (!envelope->from)  {
                                EM_DEBUG_EXCEPTION("rfc822_parse_mailbox failed...");
-                               
                                error = EMF_ERROR_INVALID_ADDRESS;
                                goto FINISH_OFF;                
                        }
@@ -2839,124 +2458,105 @@ EXPORT_API int em_core_mail_get_rfc822(emf_mail_t *mail, ENVELOPE **env, char **
        }
        }
        else  {
-               if (!mail->head->from || !mail->head->to)  {
-                       EM_DEBUG_EXCEPTION("mail->head->from[%p], mail->head->to[%p]", mail->head->from, mail->head->to);
+               if (!input_mail_tbl_data->full_address_from || !input_mail_tbl_data->full_address_to)  {
+                       EM_DEBUG_EXCEPTION("input_mail_tbl_data->full_address_from[%p], input_mail_tbl_data->full_address_to[%p]", input_mail_tbl_data->full_address_from, input_mail_tbl_data->full_address_to);
                        error = EMF_ERROR_INVALID_MAIL;
                        goto FINISH_OFF;
                }
                
                int i, j;
                
-               if (mail->head->from)  {
-                       for (i = 0, j = strlen(mail->head->from); i < j; i++)  {
-                               if (mail->head->from[i] == ';')
-                                       mail->head->from[i] = ',';
+               if (input_mail_tbl_data->full_address_from)  {
+                       for (i = 0, j = strlen(input_mail_tbl_data->full_address_from); i < j; i++)  {
+                               if (input_mail_tbl_data->full_address_from[i] == ';')
+                                       input_mail_tbl_data->full_address_from[i] = ',';
                        }
                }
                
-               if (mail->head->return_path)  {
-                       for (i = 0, j = strlen(mail->head->return_path); i < j; i++)  {
-                               if (mail->head->return_path[i] == ';')
-                                       mail->head->return_path[i] = ',';
+               if (input_mail_tbl_data->full_address_return)  {
+                       for (i = 0, j = strlen(input_mail_tbl_data->full_address_return); i < j; i++)  {
+                               if (input_mail_tbl_data->full_address_return[i] == ';')
+                                       input_mail_tbl_data->full_address_return[i] = ',';
                        }
                }
-                       em_core_skip_whitespace(mail->head->from , &pAdd);
+                       em_skip_whitespace(input_mail_tbl_data->full_address_from , &pAdd);
                EM_DEBUG_LOG("address[pAdd][%s]", pAdd);
        
                rfc822_parse_adrlist(&envelope->from, pAdd, ref_account->sending_server_addr);
                EM_SAFE_FREE(pAdd);
                        pAdd = NULL ;
 
-               em_core_skip_whitespace(mail->head->return_path , &pAdd);
+               em_skip_whitespace(input_mail_tbl_data->full_address_return , &pAdd);
                EM_DEBUG_LOG("address[pAdd][%s]", pAdd);
        
                rfc822_parse_adrlist(&envelope->return_path, pAdd, ref_account->sending_server_addr);
                EM_SAFE_FREE(pAdd);
-                       pAdd = NULL ;
+               pAdd = NULL ;
        }
 
        {
                int i, j;
                
-               if (mail->head->to)  {
-                       for (i = 0, j = strlen(mail->head->to); i < j; i++)  {
-                               if (mail->head->to[i] == ';')
-                                       mail->head->to[i] = ',';
+               if (input_mail_tbl_data->full_address_to)  {
+                       for (i = 0, j = strlen(input_mail_tbl_data->full_address_to); i < j; i++)  {
+                               if (input_mail_tbl_data->full_address_to[i] == ';')
+                                       input_mail_tbl_data->full_address_to[i] = ',';
                        }
                }
                
-               if (mail->head->cc)  {
-                       for (i = 0, j = strlen(mail->head->cc); i < j; i++)  {
-                               if (mail->head->cc[i] == ';')
-                                       mail->head->cc[i] = ',';
+               if (input_mail_tbl_data->full_address_cc)  {
+                       for (i = 0, j = strlen(input_mail_tbl_data->full_address_cc); i < j; i++)  {
+                               if (input_mail_tbl_data->full_address_cc[i] == ';')
+                                       input_mail_tbl_data->full_address_cc[i] = ',';
                        }
                }
                
-               if (mail->head->bcc)  {
-                       for (i = 0, j = strlen(mail->head->bcc); i < j; i++)  {
-                               if (mail->head->bcc[i] == ';')
-                                       mail->head->bcc[i] = ',';
+               if (input_mail_tbl_data->full_address_bcc)  {
+                       for (i = 0, j = strlen(input_mail_tbl_data->full_address_bcc); i < j; i++)  {
+                               if (input_mail_tbl_data->full_address_bcc[i] == ';')
+                                       input_mail_tbl_data->full_address_bcc[i] = ',';
                        }
                }
        }
 
-       em_core_skip_whitespace(mail->head->to , &pAdd);
+       em_skip_whitespace(input_mail_tbl_data->full_address_to , &pAdd);
        EM_DEBUG_LOG("address[pAdd][%s]", pAdd);
        
        rfc822_parse_adrlist(&envelope->to, pAdd, ref_account->sending_server_addr);
        EM_SAFE_FREE(pAdd);
        pAdd = NULL ;
        
-       EM_DEBUG_LOG("address[mail->head->cc][%s]", mail->head->cc);
-       em_core_skip_whitespace(mail->head->cc , &pAdd);
+       EM_DEBUG_LOG("address[input_mail_tbl_data->full_address_cc][%s]", input_mail_tbl_data->full_address_cc);
+       em_skip_whitespace(input_mail_tbl_data->full_address_cc , &pAdd);
        EM_DEBUG_LOG("address[pAdd][%s]", pAdd);
        
        rfc822_parse_adrlist(&envelope->cc, pAdd, ref_account->sending_server_addr);
        EM_SAFE_FREE(pAdd);
                pAdd = NULL ;
 
-       em_core_skip_whitespace(mail->head->bcc , &pAdd);
+       em_skip_whitespace(input_mail_tbl_data->full_address_bcc , &pAdd);
        rfc822_parse_adrlist(&envelope->bcc, pAdd, ref_account->sending_server_addr);
        EM_SAFE_FREE(pAdd);
                pAdd = NULL ;
 
-       em_core_encode_rfc2047_address(envelope->return_path, &error);
-       em_core_encode_rfc2047_address(envelope->from, &error);
-       em_core_encode_rfc2047_address(envelope->sender, &error);
-       em_core_encode_rfc2047_address(envelope->reply_to, &error);
-       em_core_encode_rfc2047_address(envelope->to, &error);
-       em_core_encode_rfc2047_address(envelope->cc, &error);
-       em_core_encode_rfc2047_address(envelope->bcc, &error);
+       emcore_encode_rfc2047_address(envelope->return_path, &error);
+       emcore_encode_rfc2047_address(envelope->from, &error);
+       emcore_encode_rfc2047_address(envelope->sender, &error);
+       emcore_encode_rfc2047_address(envelope->reply_to, &error);
+       emcore_encode_rfc2047_address(envelope->to, &error);
+       emcore_encode_rfc2047_address(envelope->cc, &error);
+       emcore_encode_rfc2047_address(envelope->bcc, &error);
 
-       if (mail->head->subject)
-               envelope->subject = em_core_encode_rfc2047_text(mail->head->subject, &error);
+       if (input_mail_tbl_data->subject)
+               envelope->subject = emcore_encode_rfc2047_text(input_mail_tbl_data->subject, &error);
 
        char date_str[DATE_STR_LENGTH + 1] = { 0, };
+       char buf[256] = {0, };
        
        rfc822_date(date_str);
 
        if (!is_incomplete)  {
-               struct tm tm1;
-               
-               /*  modified by stonyroot - prevent issue */
-               memset(&tm1,  0x00, sizeof(tm1));
-               
-               tm1.tm_year = mail->head->datetime.year - 1900;
-               tm1.tm_mon  = mail->head->datetime.month - 1;
-               tm1.tm_mday = mail->head->datetime.day;
-               tm1.tm_hour = mail->head->datetime.hour;
-               tm1.tm_min  = mail->head->datetime.minute;
-               tm1.tm_sec  = mail->head->datetime.second;
-               
-               /* tzset(); */
-               time_t t = mktime(&tm1);
-               
-               char buf[256] = {0, };
-               
-               if (localtime(&t))
-                       strftime(buf, 128, "%a, %e %b %Y %H : %M : %S ", localtime(&t));
-               else
-                       strftime(buf, 128, "%a, %e %b %Y %H : %M : %S ", (const struct tm *)&tm1);      
+               strftime(buf, 128, "%a, %e %b %Y %H : %M : %S ", localtime(&input_mail_tbl_data->date_time));
                /*  append last 5byes("+0900") */
                strncat(buf, date_str + (strlen(date_str) -  5), DATE_STR_LENGTH);
                strncpy(date_str, buf, DATE_STR_LENGTH);
@@ -2964,18 +2564,18 @@ EXPORT_API int em_core_mail_get_rfc822(emf_mail_t *mail, ENVELOPE **env, char **
        
        envelope->date = (unsigned char *)cpystr((const char *)date_str);
        
-       memcpy(&extra_flag, &mail->info->extra_flags, sizeof(emf_extra_flag_t));
+       /* memcpy(&extra_flag, &input_mail_tbl_data->info->extra_flags, sizeof(emf_extra_flag_t)); */
        
-       /*  check report mail */
-       if (mail->info->extra_flags.report != EMF_MAIL_REPORT_MDN)  {           
-               /* Non-report mail */
-               EM_DEBUG_LOG("mail->body->plain[%s]", mail->body->plain);
-               EM_DEBUG_LOG("mail->body->html[%s]", mail->body->html);
-               EM_DEBUG_LOG("mail->body->attachment_num[%d]", mail->body->attachment_num);
+       /*  check report input_mail_tbl_data */
+       if (input_mail_tbl_data->report_status != EMF_MAIL_REPORT_MDN)  {
+               /* Non-report input_mail_tbl_data */
+               EM_DEBUG_LOG("input_mail_tbl_data->file_path_plain[%s]", input_mail_tbl_data->file_path_plain);
+               EM_DEBUG_LOG("input_mail_tbl_data->file_path_html[%s]", input_mail_tbl_data->file_path_html);
+               EM_DEBUG_LOG("input_mail_tbl_data->body->attachment_num[%d]", input_mail_tbl_data->attachment_count);
                
                
-               if ((mail->body->attachment_num > 0) || (mail->body->plain && mail->body->html))  {
-                       EM_DEBUG_LOG("attachment_num  :  %d", mail->body->attachment_num);
+               if ((input_mail_tbl_data->attachment_count > 0) || (input_mail_tbl_data->file_path_plain && input_mail_tbl_data->file_path_html))  {
+                       EM_DEBUG_LOG("attachment_num  :  %d", input_mail_tbl_data->attachment_count);
                        root_body = mail_newbody();
 
                        if (root_body == NULL)  {
@@ -2984,11 +2584,11 @@ EXPORT_API int em_core_mail_get_rfc822(emf_mail_t *mail, ENVELOPE **env, char **
                                goto FINISH_OFF;
                        }
                        
-                       root_body->type = TYPEMULTIPART;
-                       root_body->subtype = EM_SAFE_STRDUP("MIXED");
+                       root_body->type               = TYPEMULTIPART;
+                       root_body->subtype            = EM_SAFE_STRDUP("MIXED");
                        root_body->contents.text.data = NULL;
                        root_body->contents.text.size = 0;
-                       root_body->size.bytes = 0;
+                       root_body->size.bytes         = 0;
 
                        part_for_text = attach_mutipart_with_sub_type(root_body, "ALTERNATIVE", &error);
 
@@ -2999,16 +2599,16 @@ EXPORT_API int em_core_mail_get_rfc822(emf_mail_t *mail, ENVELOPE **env, char **
 
                        text_body = &part_for_text->body;
                        
-                       if (mail->body->plain && strlen(mail->body->plain) > 0)  {
-                               EM_DEBUG_LOG("body->plain[%s]", mail->body->plain);
-                               if (!attach_part(text_body, (unsigned char *)mail->body->plain, 0, NULL, NULL, false, &error))  {
+                       if (input_mail_tbl_data->file_path_plain && strlen(input_mail_tbl_data->file_path_plain) > 0)  {
+                               EM_DEBUG_LOG("file_path_plain[%s]", input_mail_tbl_data->file_path_plain);
+                               if (!attach_part(text_body, (unsigned char *)input_mail_tbl_data->file_path_plain, 0, NULL, NULL, false, &error))  {
                                        EM_DEBUG_EXCEPTION("attach_part failed [%d]", error);
                                        goto FINISH_OFF;
                                }
                        }
                        
-                       if (mail->body->html && strlen(mail->body->html) > 0)  {
-                               EM_DEBUG_LOG("body->html[%s]", mail->body->html);
+                       if (input_mail_tbl_data->file_path_html && strlen(input_mail_tbl_data->file_path_html) > 0)  {
+                               EM_DEBUG_LOG("file_path_html[%s]", input_mail_tbl_data->file_path_html);
 
                                part_for_html = attach_mutipart_with_sub_type(text_body, "RELATED", &error);
                                if (!part_for_html) {
@@ -3016,53 +2616,43 @@ EXPORT_API int em_core_mail_get_rfc822(emf_mail_t *mail, ENVELOPE **env, char **
                                        goto FINISH_OFF;
                                }
 
-                               if (!attach_part(&(part_for_html->body) , (unsigned char *)mail->body->html, 0, NULL, "html", false, &error))  {
+                               if (!attach_part(&(part_for_html->body) , (unsigned char *)input_mail_tbl_data->file_path_html, 0, NULL, "html", false, &error))  {
                                        EM_DEBUG_EXCEPTION("attach_part failed [%d]", error);
                                        goto FINISH_OFF;
                                }
-                               /*
-                               if (mail->body->plain)  {
-                                       EM_SAFE_FREE(part_for_text->subtype);
-                                       part_for_text->subtype = EM_SAFE_STRDUP("ALTERNATIVE");
-                               }
-                               */
                        }
                        
-                       if (mail->body->attachment)  {
-                               emf_attachment_info_t *atch = mail->body->attachment;
+                       if (input_attachment_tbl && input_attachment_count)  {
+                               emstorage_attachment_tbl_t *temp_attachment_tbl = NULL;
                                char *name = NULL;
                                BODY *body_to_attach = NULL; 
                                struct stat st_buf;
                                
-                               do  {
-                                       EM_DEBUG_LOG("atch->savename[%s], atch->name[%s]", atch->savename, atch->name);
-                                       if (stat(atch->savename, &st_buf) == 0)  {
-                                               EM_DEBUG_LOG("atch->name[%s]", atch->name);
-                                               if (!atch->name)  {
-                                                       if (!em_core_get_file_name(atch->savename, &name, &error))  {
-                                                               EM_DEBUG_EXCEPTION("em_core_get_file_name failed [%d]", error);
-                                                               goto TRY_NEXT;
+                               for(i = 0; i < input_attachment_count; i++) {
+                                       temp_attachment_tbl = input_attachment_tbl + i;
+                                       EM_DEBUG_LOG("attachment_name[%s], attachment_path[%s]", temp_attachment_tbl->attachment_name, temp_attachment_tbl->attachment_path);
+                                       if (stat(temp_attachment_tbl->attachment_path, &st_buf) == 0)  {
+                                               if (!temp_attachment_tbl->attachment_name)  {
+                                                       if (!emcore_get_file_name(temp_attachment_tbl->attachment_path, &name, &error))  {
+                                                               EM_DEBUG_EXCEPTION("emcore_get_file_name failed [%d]", error);
+                                                               continue;
                                                        }
                                                }
                                                else 
-                                                       name = atch->name;
+                                                       name = temp_attachment_tbl->attachment_name;
                                                EM_DEBUG_LOG("name[%s]", name);
 
-                                               if (atch->inline_content && part_for_html)
+                                               if (temp_attachment_tbl->attachment_inline_content_status && part_for_html)
                                                        body_to_attach = &(part_for_html->body);
                                                else
                                                        body_to_attach = root_body;
                                                
-                                               if (!attach_part(body_to_attach, (unsigned char *)atch->savename, 0, name, NULL, atch->inline_content, &error))  {
+                                               if (!attach_part(body_to_attach, (unsigned char *)temp_attachment_tbl->attachment_path, 0, name, NULL, temp_attachment_tbl->attachment_inline_content_status, &error))  {
                                                        EM_DEBUG_EXCEPTION("attach_part failed [%d]", error);
-                                                       goto TRY_NEXT;
+                                                       continue;
                                                }
                                        }
-                                       
-TRY_NEXT:
-                                       atch = atch->next;
                                }
-                               while (atch);
                        }
                        text_body = NULL; 
                }
@@ -3078,12 +2668,12 @@ TRY_NEXT:
                        
                        text_body->type = TYPETEXT;
                        text_body->encoding = ENC8BIT;
-                       if (mail->body->plain || mail->body->html)
-                               text_body->sparep = EM_SAFE_STRDUP(mail->body->plain ? mail->body->plain  :  mail->body->html);
+                       if (input_mail_tbl_data->file_path_plain || input_mail_tbl_data->file_path_html)
+                               text_body->sparep = EM_SAFE_STRDUP(input_mail_tbl_data->file_path_plain ? input_mail_tbl_data->file_path_plain  :  input_mail_tbl_data->file_path_html);
                        else
                                text_body->sparep = NULL;
                        
-                       if (mail->body->html != NULL && mail->body->html[0] != '\0')
+                       if (input_mail_tbl_data->file_path_html != NULL && input_mail_tbl_data->file_path_html[0] != '\0')
                                text_body->subtype = EM_SAFE_STRDUP("html");
                        if (text_body->sparep)
                                text_body->size.bytes = strlen(text_body->sparep);
@@ -3093,42 +2683,40 @@ TRY_NEXT:
        }
        else  { /*  Report mail */
                EM_DEBUG_LOG("REPORT MAIL");
-               envelope->references = cpystr(mail->head->mid);
-               
-               if (em_core_mail_get_report_body(envelope, &root_body, &error))  {
-                       if (!mail->body)  {
-                               mail->body = em_core_malloc(sizeof(emf_mail_body_t));
-                               if (!mail->body)  {
-                                       EM_DEBUG_EXCEPTION("malloc failed...");
-                                       error = EMF_ERROR_OUT_OF_MEMORY;
-                                       goto FINISH_OFF;
-                               }
+               envelope->references = cpystr(input_mail_tbl_data->message_id);
+               /* Below codes should not be here. TODO : Move these to proper location. */
+               /*
+               if (emcore_get_report_mail_body(envelope, &root_body, &error))  {
+                       if (!input_mail_tbl_data)  {
+                               input_mail_tbl_data->file_path_plain  = EM_SAFE_STRDUP(root_body->nested.part->body.sparep);
+                               input_mail_tbl_data->attachment_count = 1;
+                               input_attachment_count                = 1;
                                
-                               mail->body->plain = EM_SAFE_STRDUP(root_body->nested.part->body.sparep);
-                               mail->body->attachment_num = 1;
-                               
-                               mail->body->attachment = em_core_malloc(sizeof(emf_attachment_info_t));
-                               if (!mail->body->attachment)  {
+                               if(input_attachment_tbl)
+                                       emstorage_free_attachment(&input_attachment_tbl, input_attachment_count, NULL);
+
+                               input_attachment_tbl = em_malloc(sizeof(emstorage_attachment_tbl_t));
+                               if (!input_attachment_tbl)  {
                                        EM_DEBUG_EXCEPTION("malloc failed...");
-                                       EM_SAFE_FREE(mail->body->plain);
+                                       EM_SAFE_FREE(input_mail_tbl_data->file_path_plain);
                                        error = EMF_ERROR_OUT_OF_MEMORY;
                                        goto FINISH_OFF;
                                }
                                
-                               mail->body->attachment->downloaded = 1;
-                               mail->body->attachment->savename = EM_SAFE_STRDUP(root_body->nested.part->next->body.sparep);
+                               input_mail_tbl_data->body->attachment->downloaded = 1;
+                               input_mail_tbl_data->body->attachment->savename = EM_SAFE_STRDUP(root_body->nested.part->next->body.sparep);
                                
                                char *p = NULL;
                                
-                               if (!em_core_get_file_name(mail->body->attachment->savename, &p, &error))  {
-                                       EM_DEBUG_EXCEPTION("em_core_get_file_name failed [%d]", error);
+                               if (!emcore_get_file_name(input_mail_tbl_data->body->attachment->savename, &p, &error))  {
+                                       EM_DEBUG_EXCEPTION("emcore_get_file_name failed [%d]", error);
                                        goto FINISH_OFF;
                                }
                                
-                               mail->body->attachment->name = cpystr(p);
+                               input_mail_tbl_data->body->attachment->name = cpystr(p);
                        }
                }
-                       
+               */
        }
        
        if (file_path)  {
@@ -3137,8 +2725,8 @@ TRY_NEXT:
                if (part_for_html)
                        html_body = &(part_for_html->body);
 
-               if (!em_core_write_rfc822(envelope, root_body ? root_body  :  text_body, html_body, extra_flag, &fname, &error))  {
-                       EM_DEBUG_EXCEPTION("em_core_write_rfc822 failed [%d]", error);
+               if (!emcore_write_rfc822(envelope, root_body ? root_body  :  text_body, html_body, extra_flag, &fname, &error))  {
+                       EM_DEBUG_EXCEPTION("emcore_write_rfc822 failed [%d]", error);
                        goto FINISH_OFF;
                }
                
@@ -3165,7 +2753,7 @@ FINISH_OFF:
        return ret;
 }
 
-static int em_core_mail_get_report_body(ENVELOPE *envelope, BODY **multipart_body, int *err_code)
+static int emcore_get_report_mail_body(ENVELOPE *envelope, BODY **multipart_body, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("envelope[%p], mulitpart_body[%p], err_code[%p]", envelope, multipart_body, err_code);
        
@@ -3176,7 +2764,7 @@ static int em_core_mail_get_report_body(ENVELOPE *envelope, BODY **multipart_bod
        BODY *p_body = NULL;
        BODY *text_body = NULL;
        PARAMETER *param = NULL;
-       emf_attachment_info_t atch;
+       emstorage_attachment_tbl_t temp_attachment_tbl;
        FILE *fp = NULL;
        char *fname = NULL;
        char buf[512] = {0x00, };
@@ -3194,14 +2782,14 @@ static int em_core_mail_get_report_body(ENVELOPE *envelope, BODY **multipart_bod
                goto FINISH_OFF;
        }
        
-       if (!em_core_get_temp_file_name(&fname, &err))  {
-               EM_DEBUG_EXCEPTION(" em_core_get_temp_file_name failed [%d]", err);
+       if (!emcore_get_temp_file_name(&fname, &err))  {
+               EM_DEBUG_EXCEPTION(" emcore_get_temp_file_name failed [%d]", err);
                goto FINISH_OFF;
        }
        
        if (!(fp = fopen(fname, "wb+")))  {
                EM_DEBUG_EXCEPTION(" fopen failed - %s", fname);
-               err = EMF_ERROR_SYSTEM_FAILURE;         /* EMF_ERROR_UNKNOWN; */
+               err = EMF_ERROR_SYSTEM_FAILURE;
                goto FINISH_OFF;
        }
        
@@ -3225,8 +2813,8 @@ static int em_core_mail_get_report_body(ENVELOPE *envelope, BODY **multipart_bod
        
        fclose(fp); fp = NULL;
        
-       if (!em_core_get_file_size(fname, &sz, &err))  {
-               EM_DEBUG_EXCEPTION(" em_core_get_file_size failed [%d]", err);
+       if (!emcore_get_file_size(fname, &sz, &err))  {
+               EM_DEBUG_EXCEPTION(" emcore_get_file_size failed [%d]", err);
                goto FINISH_OFF;
        }
        
@@ -3235,8 +2823,8 @@ static int em_core_mail_get_report_body(ENVELOPE *envelope, BODY **multipart_bod
        text_body->sparep = fname;
        text_body->size.bytes = (unsigned long)sz;
        
-       if (!em_core_get_temp_file_name(&fname, &err))  {
-               EM_DEBUG_EXCEPTION(" em_core_get_temp_file_name failed [%d]", err);
+       if (!emcore_get_temp_file_name(&fname, &err))  {
+               EM_DEBUG_EXCEPTION(" emcore_get_temp_file_name failed [%d]", err);
                goto FINISH_OFF;
        }
        
@@ -3258,16 +2846,16 @@ static int em_core_mail_get_report_body(ENVELOPE *envelope, BODY **multipart_bod
        
        fclose(fp); fp = NULL;
        
-       memset(&atch, 0x00, sizeof(atch));
+       memset(&temp_attachment_tbl, 0x00, sizeof(emstorage_attachment_tbl_t));
        
-       atch.savename = fname;
+       temp_attachment_tbl.attachment_path = fname;
        
-       if (!em_core_get_file_size(fname, &atch.size, &err))  {
-               EM_DEBUG_EXCEPTION(" em_core_get_file_size failed [%d]", err);
+       if (!emcore_get_file_size(fname, &temp_attachment_tbl.attachment_size, &err))  {
+               EM_DEBUG_EXCEPTION(" emcore_get_file_size failed [%d]", err);
                goto FINISH_OFF;
        }
        
-       if (!attach_attachment_to_body(&m_body, text_body, &atch, &err))  {
+       if (!attach_attachment_to_body(&m_body, text_body, &temp_attachment_tbl, 1, &err))  {
                EM_DEBUG_EXCEPTION(" attach_attachment_to_body failed [%d]", err);
                goto FINISH_OFF;
        }
@@ -3280,7 +2868,7 @@ static int em_core_mail_get_report_body(ENVELOPE *envelope, BODY **multipart_bod
        m_body->subtype = EM_SAFE_STRDUP("report");
        
        /*  set report-type parameter in content-type */
-       param = em_core_malloc(sizeof(PARAMETER));
+       param = em_malloc(sizeof(PARAMETER));
        if (!param)  {          
                EM_DEBUG_EXCEPTION(" malloc failed...");
                err = EMF_ERROR_OUT_OF_MEMORY;
@@ -3335,7 +2923,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API   int em_core_get_body_buff(char *file_path, char **buff)
+INTERNAL_FUNC int emcore_get_body_buff(char *file_path, char **buff)
 {
        EM_DEBUG_FUNC_BEGIN();
 
@@ -3372,275 +2960,8 @@ EXPORT_API   int em_core_get_body_buff(char *file_path, char **buff)
        *buff = read_buff;
        
        FINISH_OFF: 
-       if (r_fp)       /* Prevent Defect - 17424 */
+       if (r_fp)
                fclose(r_fp);
 
        return ret;
 }
-
-EXPORT_API int em_core_mail_get_envelope_body_struct(emf_mail_t *mail, 
-                                                                                       ENVELOPE **env, 
-                                                                                       BODY **text_body, 
-                                                                                       BODY **multipart_body, 
-                                                                                       int *err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("mail[%p], env[%p], text_body[%p], multipart_body[%p], err_code[%p]", mail, env, text_body, multipart_body, err_code);
-       
-       int ret = false;
-       int error = EMF_ERROR_NONE;
-       ENVELOPE *envelope = NULL;
-       BODY *txt_body = NULL;
-       BODY *multi_part_body = NULL;
-       emf_extra_flag_t extra_flag;
-       int is_incomplete = 0;
-       emf_account_t *ref_account = NULL;
-       char *pAdd = NULL ;
-       
-       if (!mail || !mail->info || !mail->head || !mail->body) {
-               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
-               error = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-       
-       ref_account = em_core_get_account_reference(mail->info->account_id);
-       
-       if (!ref_account) {
-               EM_DEBUG_EXCEPTION(" em_core_get_account_reference failed [%d]", mail->info->account_id);
-               error = EMF_ERROR_INVALID_ACCOUNT;
-               goto FINISH_OFF;
-       }
-
-       if (!(envelope = mail_newenvelope())) {
-               EM_DEBUG_EXCEPTION(" mail_newenvelope failed...");
-               error = EMF_ERROR_OUT_OF_MEMORY;
-               goto FINISH_OFF;
-       }
-
-       EM_DEBUG_LOG(" mail_newenvelope created...");
-       is_incomplete = mail->info->flags.draft || mail->info->extra_flags.status == EMF_MAIL_STATUS_SENDING;/* 4; */
-       if (is_incomplete) {
-               if (ref_account->email_addr) {
-                       char *p = EM_SAFE_STRDUP(ref_account->email_addr);
-                       
-                       envelope->from = rfc822_parse_mailbox(&p, NULL);
-                       /* mailbox = user id; host = mail-server-addr; */
-                       if (!envelope->from)  {
-                               EM_DEBUG_EXCEPTION("rfc822_parse_mailbox failed...");
-                               error = EMF_ERROR_INVALID_ADDRESS;
-                               goto FINISH_OFF;
-                       }
-                       else  {
-                               envelope->from->personal = ref_account->display_name ? cpystr(ref_account->display_name)  :  NULL;
-                       }
-               }
-               
-               if (ref_account->return_addr)  {
-                       char *p = EM_SAFE_STRDUP(ref_account->return_addr); 
-                       envelope->return_path = rfc822_parse_mailbox(&p, NULL);
-               }
-       }
-       else  {
-               if (!mail->head->from || !mail->head->to)  {
-                       EM_DEBUG_EXCEPTION(" mail->head->from[%p], mail->head->to[%p]", mail->head->from, mail->head->to);
-                       error = EMF_ERROR_INVALID_MAIL;
-                       goto FINISH_OFF;
-               }
-
-               em_core_skip_whitespace(mail->head->from , &pAdd);
-               EM_DEBUG_LOG("address[pAdd][%s]", pAdd);
-               
-               rfc822_parse_adrlist(&envelope->from, pAdd, ref_account->sending_server_addr);
-               EM_SAFE_FREE(pAdd);
-                       pAdd = NULL ;
-
-               em_core_skip_whitespace(mail->head->return_path , &pAdd);
-               EM_DEBUG_LOG("address[pAdd][%s]", pAdd);
-               rfc822_parse_adrlist(&envelope->return_path, pAdd, ref_account->sending_server_addr);
-               EM_SAFE_FREE(pAdd);
-                       pAdd = NULL ;
-       }
-       
-       {
-               int i, j;
-               
-               if (mail->head->to) {
-                       for (i = 0, j = strlen(mail->head->to); i < j; i++) {
-                               if (mail->head->to[i] == ';')
-                                       mail->head->to[i] = ',';
-                       }
-               }
-               
-               if (mail->head->cc) {
-                       for (i = 0, j = strlen(mail->head->cc); i < j; i++) {
-                               if (mail->head->cc[i] == ';')
-                                       mail->head->cc[i] = ',';
-                       }
-               }
-               
-               if (mail->head->bcc) {
-                       for (i = 0, j = strlen(mail->head->bcc); i < j; i++) {
-                               if (mail->head->bcc[i] == ';')
-                                       mail->head->bcc[i] = ',';
-                       }
-               }
-       }
-
-       em_core_skip_whitespace(mail->head->to , &pAdd);
-       EM_DEBUG_LOG("address[pAdd][%s]", pAdd);
-               
-       rfc822_parse_adrlist(&envelope->to, pAdd, ref_account->sending_server_addr);
-       EM_SAFE_FREE(pAdd);
-       pAdd = NULL ;
-       
-       em_core_skip_whitespace(mail->head->cc , &pAdd);
-
-       rfc822_parse_adrlist(&envelope->cc, pAdd, ref_account->sending_server_addr);
-       EM_SAFE_FREE(pAdd);
-       pAdd = NULL ;
-       
-       em_core_skip_whitespace(mail->head->bcc , &pAdd);
-       EM_DEBUG_LOG("address[pAdd][%s]", pAdd);
-       rfc822_parse_adrlist(&envelope->bcc, pAdd, ref_account->sending_server_addr);
-       EM_SAFE_FREE(pAdd);
-               pAdd = NULL ;
-       em_core_encode_rfc2047_address(envelope->return_path, &error);
-       em_core_encode_rfc2047_address(envelope->from, &error);
-       em_core_encode_rfc2047_address(envelope->sender, &error);
-       em_core_encode_rfc2047_address(envelope->reply_to, &error);
-       em_core_encode_rfc2047_address(envelope->to, &error);
-       em_core_encode_rfc2047_address(envelope->cc, &error);
-       em_core_encode_rfc2047_address(envelope->bcc, &error);
-
-
-       if (mail->head->subject)
-               envelope->subject = em_core_encode_rfc2047_text(mail->head->subject, &error);
-
-       char date_str[DATE_STR_LENGTH] = { 0, };
-       
-       rfc822_date(date_str);
-
-       if (!is_incomplete) {
-               struct tm tm1;
-               
-               /*  modified by stonyroot - prevent issue */
-               memset(&tm1,  0x00, sizeof(tm1));
-               
-               tm1.tm_year = mail->head->datetime.year - 1900;
-               tm1.tm_mon = mail->head->datetime.month - 1;
-               tm1.tm_mday = mail->head->datetime.day;
-               tm1.tm_hour = mail->head->datetime.hour;
-               tm1.tm_min = mail->head->datetime.minute;
-               tm1.tm_sec = mail->head->datetime.second;
-               
-               /* tzset(); */
-               time_t t = mktime(&tm1);
-               
-               char buf[256] = {0x00, };
-               
-               if (localtime(&t))
-                       strftime(buf, 128, "%a, %e %b %Y %H : %M : %S ", localtime(&t));
-               else
-                       strftime(buf, 128, "%a, %e %b %Y %H : %M : %S ", (const struct tm *)&tm1);      
-
-               /*  append last 5byes("+0900") */
-               strncat(buf, date_str + (strlen(date_str) -  5), sizeof(buf) - 1);
-               strncpy(date_str, buf, DATE_STR_LENGTH - 1);
-       }
-       
-       envelope->date = (unsigned char *)cpystr((const char *)date_str);
-       
-       memcpy(&extra_flag, &mail->info->extra_flags, sizeof(emf_extra_flag_t));
-       
-       /*  check report mail */
-       if (mail->info->extra_flags.report != EMF_MAIL_REPORT_MDN)  {           
-               txt_body = mail_newbody();
-               if (txt_body == NULL) {
-                       EM_DEBUG_EXCEPTION(" mail_newbody failed...");
-                       
-                       error = EMF_ERROR_OUT_OF_MEMORY;
-                       goto FINISH_OFF;
-               }
-               
-               txt_body->type = TYPETEXT;
-               txt_body->encoding = ENC8BIT;
-               if (mail->body && mail->body->plain) {
-                       if (mail->body->plain)
-                       txt_body->sparep = EM_SAFE_STRDUP(mail->body->plain);
-                       else
-                       txt_body->sparep = NULL;                                
-                       
-                       txt_body->size.bytes = (int)strlen(mail->body->plain);
-               }
-               
-               if (mail->body) {
-                       if (mail->body->attachment) {
-                               if (!attach_attachment_to_body(&multi_part_body, txt_body, mail->body->attachment, &error)) {
-                                       EM_DEBUG_EXCEPTION("attach_attachment_to_body failed [%d]", error);
-                                       goto FINISH_OFF;
-                               }
-                       }
-               }
-       }
-       else  {         /*  Report mail */
-               if (mail->head || mail->head->mid)
-                       envelope->references = cpystr(mail->head->mid);
-               if (em_core_mail_get_report_body(envelope, &multi_part_body, &error)) {
-                       if (!mail->body) {
-                               mail->body = em_core_malloc(sizeof(emf_mail_body_t));
-                               if (!mail->body) {              
-                                       EM_DEBUG_EXCEPTION("malloc failed...");
-                                       
-                                       error = EMF_ERROR_OUT_OF_MEMORY;
-                                       goto FINISH_OFF;
-                               }
-                               
-                               mail->body->plain = EM_SAFE_STRDUP(multi_part_body->nested.part->body.sparep);
-                               mail->body->attachment_num = 1;
-                               
-                               mail->body->attachment = em_core_malloc(sizeof(emf_attachment_info_t));
-                               if (!mail->body->attachment)  { 
-                                       EM_DEBUG_EXCEPTION("malloc failed...");
-                                       
-                                       EM_SAFE_FREE(mail->body->plain);
-                                       error = EMF_ERROR_OUT_OF_MEMORY;
-                                       goto FINISH_OFF;
-                               }
-                               
-                               mail->body->attachment->downloaded = 1;
-                               mail->body->attachment->savename = EM_SAFE_STRDUP(multi_part_body->nested.part->next->body.sparep);
-                               
-                               char *p = NULL;
-                               if (!em_core_get_file_name(mail->body->attachment->savename, &p, &error))  {
-                                       EM_DEBUG_EXCEPTION("em_core_get_file_name failed [%d]", error);
-                                       
-                                       goto FINISH_OFF;
-                               }
-                               
-                               mail->body->attachment->name = cpystr(p);
-                       }
-               }
-       }
-       ret = true;
-       
-FINISH_OFF: 
-       if (ret == true) {
-               if (env != NULL)
-                       *env = envelope;
-               if (txt_body != NULL)
-                       *text_body = txt_body;
-               if (multi_part_body != NULL)
-                       *multipart_body = multi_part_body;
-       }
-       else  {
-               if (envelope != NULL)
-                       mail_free_envelope(&envelope);
-               if (txt_body != NULL)
-                       mail_free_body(&txt_body);
-               if (multi_part_body != NULL)
-                       mail_free_body(&multi_part_body);
-       }
-
-       if (err_code != NULL)
-               *err_code = error;
-       return ret;
-}
similarity index 77%
rename from email-core/em-core-sound.c
rename to email-core/email-core-sound.c
index 5bd2553..0f5be70 100755 (executable)
 
 
 #include <stdlib.h>
-#include "emf-dbglog.h"
-#include "em-storage.h"
-#include "em-core-mailbox.h"
-#include "em-core-sound.h"
+#include <pthread.h>
+#include "email-debug-log.h"
+#include "email-storage.h"
+#include "email-core-utils.h"
+#include "email-core-mailbox.h"
+#include "email-core-sound.h"
+#include "email-utilities.h"
+
+#define TIMER 7000
+#define HAPTIC_TEST_ITERATION 1
 
 static MMHandleType email_mmhandle = MM_PLAYER_STATE_NONE;
 static alarm_id_t email_alarm_id = 0;
@@ -33,19 +39,19 @@ static int email_vibe_handle = 0;
 static char *filename;
 alarm_entry_t *alarm_info = NULL;
 
-#ifdef __FEATURE_USE_PTHREAD__
 static pthread_mutex_t sound_mutex = PTHREAD_MUTEX_INITIALIZER;
 static pthread_cond_t sound_condition = PTHREAD_COND_INITIALIZER;
 static pthread_mutex_t mmhandle_mutex = PTHREAD_MUTEX_INITIALIZER;
 static thread_t g_alert_thread;
-#else /*  _USE_PTHREAD */
-static GMutex *_sound_event_available_lock = NULL;
-static GCond *_sound_event_available_signal = NULL;
-static pthread_mutex_t mmhandle_mutex = NULL;
-static thread_t g_alert_thread;
-#endif /*  _USE_PTHREAD */
 
-int em_core_alert_sound_init()
+void  emcore_set_repetition_alarm(int repetition);
+int   emcore_vibration_destory();
+int   emcore_vibration_stop();
+int   emcore_sound_mp_player_stop();
+bool  emcore_sound_mp_player_destory();
+void *start_alert_thread(void *arg);
+
+int emcore_alert_sound_init()
 {
        int ret = MM_ERROR_NONE;
        if ((ret = mm_session_init(MM_SESSION_TYPE_NOTIFY)) != MM_ERROR_NONE) 
@@ -54,7 +60,7 @@ int em_core_alert_sound_init()
        return ret;
 }
 
-int em_core_alert_alarm_init()
+int emcore_alert_alarm_init()
 {
        int ret = ALARMMGR_RESULT_SUCCESS;
        
@@ -65,19 +71,19 @@ int em_core_alert_alarm_init()
        return ret;
 }
 
-int em_core_alert_sound_filepath_init()
+int emcore_alert_sound_filepath_init()
 {
-       filename = (char  *)em_core_malloc(MAX_LENGTH);
+       filename = (char  *)em_malloc(MAX_PATH);
        if (filename == NULL) {
                EM_DEBUG_EXCEPTION("Memory malloc error");      
                return false;
        }
 
-       memset(filename, 0, MAX_LENGTH);
+       memset(filename, 0, MAX_PATH);
 
        return true;
 }
-int em_core_alert_vibe_init()
+int emcore_alert_vibe_init()
 {
        email_vibe_handle = device_haptic_open(DEV_IDX_0, 0);   
        if (!email_vibe_handle) {
@@ -88,7 +94,7 @@ int em_core_alert_vibe_init()
        return true;
 }
 
-void em_core_noti_key_changed_cb(keynode_t *key_node, void *data)
+void emcore_noti_key_changed_cb(keynode_t *key_node, void *data)
 {
        int ret = 0;
        
@@ -98,7 +104,7 @@ void em_core_noti_key_changed_cb(keynode_t *key_node, void *data)
                if (ret != ALARMMGR_RESULT_SUCCESS) {
                        EM_DEBUG_EXCEPTION("delete of alarm id failed");
                }
-               em_core_set_repetition_alarm(vconf_keynode_get_int(key_node));
+               emcore_set_repetition_alarm(vconf_keynode_get_int(key_node));
                break;
        case VCONF_TYPE_STRING:
                filename = vconf_keynode_get_str(key_node);
@@ -110,16 +116,16 @@ void em_core_noti_key_changed_cb(keynode_t *key_node, void *data)
        return;
 }
 
-bool em_core_noti_init(void *data)
+bool emcore_noti_init(void *data)
 {
        struct appdata *ap = data;
        
-       if (vconf_notify_key_changed(VCONFKEY_SETAPPL_NOTI_EMAIL_ALERT_REP_TYPE_INT, em_core_noti_key_changed_cb, ap) < 0) {
+       if (vconf_notify_key_changed(VCONFKEY_SETAPPL_NOTI_EMAIL_ALERT_REP_TYPE_INT, emcore_noti_key_changed_cb, ap) < 0) {
                EM_DEBUG_EXCEPTION("Register failed : alert type");
                return false;
        }
 
-       if (vconf_notify_key_changed(VCONFKEY_SETAPPL_NOTI_EMAIL_RINGTONE_PATH_STR, em_core_noti_key_changed_cb, ap) < 0) {
+       if (vconf_notify_key_changed(VCONFKEY_SETAPPL_NOTI_EMAIL_RINGTONE_PATH_STR, emcore_noti_key_changed_cb, ap) < 0) {
                EM_DEBUG_EXCEPTION("Register failed : Ringtone path");
                return false;
        }
@@ -127,34 +133,34 @@ bool em_core_noti_init(void *data)
        return true;
 }
 
-int em_core_alert_init()
+int emcore_alert_init()
 {
        EM_DEBUG_FUNC_BEGIN();
 
        int err = 0;
        
-       if (!em_core_alert_sound_filepath_init()) {
-               EM_DEBUG_EXCEPTION("em_core_alert_sound_filepath_init failed");
+       if (!emcore_alert_sound_filepath_init()) {
+               EM_DEBUG_EXCEPTION("emcore_alert_sound_filepath_init failed");
                return false;
        }
 
-       if ((err = em_core_alert_sound_init()) != MM_ERROR_NONE) {
-               EM_DEBUG_EXCEPTION("em_core_alert_sound_init failed : [%d]", err);
+       if ((err = emcore_alert_sound_init()) != MM_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("emcore_alert_sound_init failed : [%d]", err);
                return false;
        }
 
-       if ((err = em_core_alert_alarm_init()) != ALARMMGR_RESULT_SUCCESS) {
-               EM_DEBUG_EXCEPTION("em_core_alert_alarm_init failed : [%d]", err);
+       if ((err = emcore_alert_alarm_init()) != ALARMMGR_RESULT_SUCCESS) {
+               EM_DEBUG_EXCEPTION("emcore_alert_alarm_init failed : [%d]", err);
                return false;           
        }
 
-       if (!em_core_alert_vibe_init()) {
-               EM_DEBUG_EXCEPTION("em_core_alert_vibe_init failed");
+       if (!emcore_alert_vibe_init()) {
+               EM_DEBUG_EXCEPTION("emcore_alert_vibe_init failed");
                return false;           
        }
 
-       if (!em_core_noti_init(NULL)) {
-               EM_DEBUG_EXCEPTION("em_core_noti_init failed");
+       if (!emcore_noti_init(NULL)) {
+               EM_DEBUG_EXCEPTION("emcore_noti_init failed");
                return false;           
        }
 
@@ -162,7 +168,7 @@ int em_core_alert_init()
        return true;
 }
 
-bool em_core_set_mp_filepath(const char *key)
+bool emcore_set_mp_filepath(const char *key)
 {
        filename = vconf_get_str(key);
        if (filename == NULL)
@@ -171,14 +177,14 @@ bool em_core_set_mp_filepath(const char *key)
        return true;
 }
 
-int em_core_mp_player_state_cb(int message, void *param, void *user_param)
+int emcore_mp_player_state_cb(int message, void *param, void *user_param)
 {
        switch (message)
        {
                case MM_MESSAGE_ERROR:
                        EM_DEBUG_LOG("Error is happened.");
                        if (email_mmhandle) {
-                               em_core_sound_mp_player_destory();
+                               emcore_sound_mp_player_destory();
                        }
                        break;
                case MM_MESSAGE_BEGIN_OF_STREAM:
@@ -189,8 +195,8 @@ int em_core_mp_player_state_cb(int message, void *param, void *user_param)
                        ENTER_CRITICAL_SECTION(mmhandle_mutex);
                        if (email_mmhandle)
                        {                       
-                               em_core_sound_mp_player_stop();
-                               em_core_sound_mp_player_destory();
+                               emcore_sound_mp_player_stop();
+                               emcore_sound_mp_player_destory();
                        }
                        LEAVE_CRITICAL_SECTION(mmhandle_mutex);
                        break;
@@ -201,7 +207,7 @@ int em_core_mp_player_state_cb(int message, void *param, void *user_param)
        return 1;
 }
 
-bool em_core_sound_mp_player_create() 
+bool emcore_sound_mp_player_create() 
 {      
        EM_DEBUG_FUNC_BEGIN();
        int err = 0;
@@ -214,7 +220,7 @@ bool em_core_sound_mp_player_create()
        return true;
 }
 
-bool em_core_vibration_create() 
+bool emcore_vibration_create() 
 {      
        EM_DEBUG_FUNC_BEGIN();
 
@@ -228,7 +234,7 @@ bool em_core_vibration_create()
        return true;
 }
 
-bool em_core_alarm_create() 
+bool emcore_alarm_create() 
 {      
        EM_DEBUG_FUNC_BEGIN();
 
@@ -243,7 +249,7 @@ bool em_core_alarm_create()
        return true;
 }
 
-bool em_core_alarm_destory()
+bool emcore_alarm_destory()
 {
        EM_DEBUG_FUNC_BEGIN();
 
@@ -259,20 +265,20 @@ bool em_core_alarm_destory()
        return true;
 }
 
-bool em_core_alert_create()
+bool emcore_alert_create()
 {
        EM_DEBUG_FUNC_BEGIN();
 
        /* Create the alarm handle */
-       if (!em_core_alarm_create()) {
-               EM_DEBUG_EXCEPTION("em_core_alarm_create failed.");
+       if (!emcore_alarm_create()) {
+               EM_DEBUG_EXCEPTION("emcore_alarm_create failed.");
                return false;
        }
        
        /* Set the music file in alert */
-       if (!em_core_set_mp_filepath(VCONFKEY_SETAPPL_NOTI_EMAIL_RINGTONE_PATH_STR))
-               if (!em_core_set_mp_filepath(VCONFKEY_SETAPPL_DEFAULT_NOTI_EMAIL_RINGTONE_PATH_STR)) {
-                       EM_DEBUG_EXCEPTION("em_core_set_mp_filepath failed.");
+       if (!emcore_set_mp_filepath(VCONFKEY_SETAPPL_NOTI_EMAIL_RINGTONE_PATH_STR))
+               if (!emcore_set_mp_filepath(VCONFKEY_SETAPPL_DEFAULT_NOTI_EMAIL_RINGTONE_PATH_STR)) {
+                       EM_DEBUG_EXCEPTION("emcore_set_mp_filepath failed.");
                        return false;
                }
        
@@ -280,20 +286,20 @@ bool em_core_alert_create()
        return true;
 }
 
-bool em_core_alert_destory()
+bool emcore_alert_destory()
 {
        EM_DEBUG_FUNC_BEGIN();
        int ret = 0;
 
        /* Destroy the music player handle */
-       if (!em_core_sound_mp_player_destory()) {
-               EM_DEBUG_EXCEPTION("em_core_sound_mp_player_destory fail");
+       if (!emcore_sound_mp_player_destory()) {
+               EM_DEBUG_EXCEPTION("emcore_sound_mp_player_destory fail");
                return false;
        }                       
 
        /* Destroy the vibration handle */
-       if (!em_core_vibration_destory()) {
-               EM_DEBUG_EXCEPTION("em_core_vibration_destory fail");
+       if (!emcore_vibration_destory()) {
+               EM_DEBUG_EXCEPTION("emcore_vibration_destory fail");
                return false;
        }       
 
@@ -318,8 +324,8 @@ gboolean mp_player_timeout_cb(void *data)
        ENTER_CRITICAL_SECTION(mmhandle_mutex); 
        if (email_mmhandle == MM_PLAYER_STATE_PLAYING)
        {                       
-               em_core_sound_mp_player_stop();
-               em_core_sound_mp_player_destory();
+               emcore_sound_mp_player_stop();
+               emcore_sound_mp_player_destory();
        }
        LEAVE_CRITICAL_SECTION(mmhandle_mutex);
        
@@ -331,14 +337,14 @@ gboolean vibration_timeout_cb(void *data)
 {
        EM_DEBUG_FUNC_BEGIN();
 
-       em_core_vibration_stop();
-       em_core_vibration_destory();
+       emcore_vibration_stop();
+       emcore_vibration_destory();
        
        EM_DEBUG_FUNC_END();
        return false;
 }
 
-bool em_core_vibration_start(int haptic_level)
+bool emcore_vibration_start(int haptic_level)
 {
        EM_DEBUG_FUNC_BEGIN();
        int ret = 0;
@@ -366,7 +372,7 @@ bool em_core_vibration_start(int haptic_level)
        return true;
 }
 
-int em_core_vibration_stop()
+int emcore_vibration_stop()
 {
        int err = MM_ERROR_NONE;
        if ((err = device_haptic_stop_play(email_vibe_handle)) != 0)
@@ -375,7 +381,7 @@ int em_core_vibration_stop()
        return err;
 }
 
-int em_core_vibration_destory()
+int emcore_vibration_destory()
 {
        int err = MM_ERROR_NONE;
        if ((err = device_haptic_close(email_vibe_handle)) != 0)
@@ -383,7 +389,7 @@ int em_core_vibration_destory()
 
        return err;
 }
-int em_core_sound_mp_player_start(char *filepath)
+int emcore_sound_mp_player_start(char *filepath)
 {
        EM_DEBUG_FUNC_BEGIN();
 
@@ -399,7 +405,7 @@ int em_core_sound_mp_player_start(char *filepath)
                return err;
        }
 */
-       mm_player_set_message_callback(email_mmhandle, em_core_mp_player_state_cb, (void  *)email_mmhandle);
+       mm_player_set_message_callback(email_mmhandle, emcore_mp_player_state_cb, (void  *)email_mmhandle);
 
        EM_DEBUG_LOG("Before mm_player_set_attribute filepath = %s", filepath);
        if ((err = mm_player_set_attribute(email_mmhandle, NULL, "sound_volume_type", MM_SOUND_VOLUME_TYPE_NOTIFICATION, "profile_uri", filepath, strlen(filepath), NULL)) != MM_ERROR_NONE)
@@ -432,7 +438,7 @@ int em_core_sound_mp_player_start(char *filepath)
        return err;
 }
 
-int em_core_sound_mp_player_stop()
+int emcore_sound_mp_player_stop()
 {
        EM_DEBUG_FUNC_BEGIN();
 
@@ -454,7 +460,7 @@ int em_core_sound_mp_player_stop()
        return err;
 }
 
-bool em_core_sound_mp_player_destory()
+bool emcore_sound_mp_player_destory()
 {
        EM_DEBUG_FUNC_BEGIN();
 
@@ -514,7 +520,7 @@ int get_vconf_data(int key, int *return_value)
        return true;
 }
 
-int em_core_get_alert_type()
+int emcore_get_alert_type()
 {
        EM_DEBUG_FUNC_BEGIN();
        int sound_status = 0, vibe_status = 0;
@@ -546,7 +552,7 @@ int em_core_get_alert_type()
 }
 
 
-EXPORT_API int em_core_alert_loop_start(int *err_code)
+INTERNAL_FUNC int emcore_start_alert_thread(int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
 
@@ -580,7 +586,7 @@ EXPORT_API int em_core_alert_loop_start(int *err_code)
        return 0;
 }
 
-int em_core_alarm_timeout_cb(int timer_id, void *user_parm)
+int emcore_alarm_timeout_cb(int timer_id, void *user_parm)
 {
        EM_DEBUG_FUNC_BEGIN();
 
@@ -594,15 +600,15 @@ int em_core_alarm_timeout_cb(int timer_id, void *user_parm)
        mailbox.account_id = ALL_ACCOUNT;
        mailbox.name = NULL;
 
-       if (!em_core_mailbox_get_mail_count(&mailbox, &total_mail_count, &total_unread_count, &err)) {
-               EM_DEBUG_EXCEPTION("em_core_mailbox_get_mail_count failed - %d\n", err);
+       if (!emcore_get_mail_count(&mailbox, &total_mail_count, &total_unread_count, &err)) {
+               EM_DEBUG_EXCEPTION("emcore_get_mail_count failed - %d\n", err);
                return false;
        }
 
        EM_DEBUG_LOG(">>>> total_unread_count : [%d]\n", total_unread_count);
        
        if (total_unread_count) {
-               start_alert();
+               emcore_start_alert();
        }
 
        EM_DEBUG_FUNC_END();    
@@ -647,7 +653,7 @@ bool set_alarm(int repetition_time)
        alarmmgr_set_type(alarm_info, ALARM_TYPE_VOLATILE);
        alarmmgr_add_alarm_with_localtime(alarm_info, NULL, &email_alarm_id);
 
-       ret = alarmmgr_set_cb(em_core_alarm_timeout_cb, NULL);
+       ret = alarmmgr_set_cb(emcore_alarm_timeout_cb, NULL);
 
        if (ret != 0) {
                EM_DEBUG_EXCEPTION("Failed : alarmmgr_set_cb() -> error[%d]", ret);
@@ -659,7 +665,7 @@ bool set_alarm(int repetition_time)
        return true;
 }
 
-void em_core_set_repetition_alarm(int repetition)
+void emcore_set_repetition_alarm(int repetition)
 {
        EM_DEBUG_FUNC_BEGIN();
 
@@ -699,59 +705,59 @@ void *start_alert_thread(void *arg)
        int err = 0;
        int level = 0;
 
-       if (!em_core_alert_init())
+       if (!emcore_alert_init())
        {
-               EM_DEBUG_EXCEPTION("Error : em_core_alert_init failed");
+               EM_DEBUG_EXCEPTION("Error : emcore_alert_init failed");
                return 0;
        }
 
 
        while (1) {
-               if (!em_core_alert_create()) {
-                       EM_DEBUG_EXCEPTION("Error : em_core_alert_create failed");
+               if (!emcore_alert_create()) {
+                       EM_DEBUG_EXCEPTION("Error : emcore_alert_create failed");
                        return 0;
                }
 
                err = get_vconf_data(EMAIL_ALERT_REP_TYPE, &level);
-               em_core_set_repetition_alarm(level);
+               emcore_set_repetition_alarm(level);
 
                ENTER_CRITICAL_SECTION(sound_mutex);
                SLEEP_CONDITION_VARIABLE(sound_condition , sound_mutex);
 
                err = get_vconf_data(EMAIL_ALERT_VIBE_STENGTH, &level);
 
-               switch (em_core_get_alert_type())
+               switch (emcore_get_alert_type())
                {
                        case EMAIL_ALERT_TYPE_MELODY:
-                               em_core_sound_mp_player_create();
-                               em_core_sound_mp_player_start(filename);
+                               emcore_sound_mp_player_create();
+                               emcore_sound_mp_player_start(filename);
                                break;
                        case EMAIL_ALERT_TYPE_VIB:
-                               em_core_vibration_create();
-                               em_core_vibration_start(level);
+                               emcore_vibration_create();
+                               emcore_vibration_start(level);
                                break;
                        case EMAIL_ALERT_TYPE_MELODY_AND_VIB:
-                               em_core_vibration_create();
-                               em_core_vibration_start(level);
-                               em_core_sound_mp_player_create();
-                               em_core_sound_mp_player_start(filename);
+                               emcore_vibration_create();
+                               emcore_vibration_start(level);
+                               emcore_sound_mp_player_create();
+                               emcore_sound_mp_player_start(filename);
                                break;
                        case EMAIL_ALERT_TYPE_MUTE:
                                EM_DEBUG_LOG("Alert type is mute!!");
                                break;
                        default: 
                                EM_DEBUG_EXCEPTION("alert type is strange");
-                               em_core_alert_destory();
+                               emcore_alert_destory();
                                break;
                }
                LEAVE_CRITICAL_SECTION(sound_mutex);
 
-               em_core_alarm_destory();
+               emcore_alarm_destory();
        }
        return 0;
 }      
 
-EXPORT_API void start_alert()
+INTERNAL_FUNC void emcore_start_alert()
 {
        ENTER_CRITICAL_SECTION(sound_mutex);
        WAKE_CONDITION_VARIABLE(sound_condition);
similarity index 71%
rename from email-core/em-core-timer.c
rename to email-core/email-core-timer.c
index add3a4f..7b98a6d 100755 (executable)
 #include <time.h>
 #include <errno.h>
 #include <sys/signal.h>
-/* #include <pthread.h> */
 #include <sys/timeb.h>
-#include "em-core-timer.h"
-#include "emf-dbglog.h"
+#include "email-core-timer.h"
+#include "email-debug-log.h"
 #include <dbus/dbus-glib.h> 
 
 
@@ -44,10 +43,9 @@ typedef struct
 }em_timer_callback_data;
 
 
-EXPORT_API int
-em_core_timer_ex_callback(void *a_pData)
+INTERNAL_FUNC int emcore_timer_ex_callback(void *a_pData)
 {
-       EM_DEBUG_LOG("[em_core_timer_ex_callback] enter\n");
+       EM_DEBUG_LOG("[emcore_timer_ex_callback] enter\n");
        void *pUserData = NULL;
 
 
@@ -60,7 +58,7 @@ em_core_timer_ex_callback(void *a_pData)
                EMF_TIMER_CALLBACK pfn_UserCB = pTimerData->user_callback_function;
                        pUserData = pTimerData->callback_user_data;
                if (pUserData)
-                       EM_DEBUG_LOG("em_core_timer_ex_callback >>> data  :  %s", (char *)pTimerData->callback_user_data);
+                       EM_DEBUG_LOG("emcore_timer_ex_callback >>> data  :  %s", (char *)pTimerData->callback_user_data);
                        EM_SAFE_FREE(pTimerData);
                        pfn_UserCB(pUserData);
                }
@@ -69,7 +67,7 @@ em_core_timer_ex_callback(void *a_pData)
        g_thread_init(NULL);
        dbus_g_thread_init ();
 
-       EM_DEBUG_LOG("[em_core_timer_ex_callback] leave\n");
+       EM_DEBUG_LOG("[emcore_timer_ex_callback] leave\n");
 
        if (pUserData)
                return 0;
@@ -77,12 +75,9 @@ em_core_timer_ex_callback(void *a_pData)
                        return 1;
 }
 
-
-
-EXPORT_API int
-em_core_set_timer_ex(long a_nSetTimeValue, EMF_TIMER_CALLBACK a_pCallBack, void *a_pData)
+INTERNAL_FUNC int emcore_set_timer_ex(long a_nSetTimeValue, EMF_TIMER_CALLBACK a_pCallBack, void *a_pData)
 {
-       EM_DEBUG_LOG("em_core_set_timer_ex %d", a_nSetTimeValue);
+       EM_DEBUG_LOG("emcore_set_timer_ex %d", a_nSetTimeValue);
        em_timer_callback_data *pTimerData = NULL;
        pTimerData = malloc(sizeof(em_timer_callback_data));
        char *data = NULL;
@@ -90,21 +85,20 @@ em_core_set_timer_ex(long a_nSetTimeValue, EMF_TIMER_CALLBACK a_pCallBack, void
                return -1;
        memset(pTimerData, 0x00, sizeof(em_timer_callback_data));
        if (a_pData)
-               EM_DEBUG_LOG("em_core_set_timer_ex >>> data  :  %s", (char *)a_pData);
+               EM_DEBUG_LOG("emcore_set_timer_ex >>> data  :  %s", (char *)a_pData);
 
        pTimerData->user_callback_function = a_pCallBack;
        if (a_pData) {
                data = (char *) a_pData;
                pTimerData->callback_user_data = EM_SAFE_STRDUP(data);
        }
-       pTimerData->time_id = g_timeout_add(a_nSetTimeValue, em_core_timer_ex_callback, pTimerData);
+       pTimerData->time_id = g_timeout_add(a_nSetTimeValue, emcore_timer_ex_callback, pTimerData);
        return pTimerData->time_id;
 }
 
-EXPORT_API void
-em_core_kill_timer_ex(int a_nTimerID)
+INTERNAL_FUNC void emcore_kill_timer_ex(int a_nTimerID)
 {
-       EM_DEBUG_LOG("[em_core_kill_timer_ex] a_nTimerID %d", a_nTimerID);
+       EM_DEBUG_LOG("[emcore_kill_timer_ex] a_nTimerID %d", a_nTimerID);
        g_source_remove(a_nTimerID);
 }
 
similarity index 60%
rename from email-core/em-core-utils.c
rename to email-core/email-core-utils.c
index 823781e..e62c74a 100755 (executable)
@@ -21,7 +21,7 @@
 
 
 /******************************************************************************
- * File: em-core-utils.c
+ * File: email-core-utils.c
  * Desc: Mail Utils
  *
  * Auth:
  * History:
  *     2006.08.16 : created
  *****************************************************************************/
-#include <glib.h>
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
 #include <errno.h>
-#include <stdio.h>
 #include <dlfcn.h>
+#include <glib.h>
+#include <glib-object.h>
 #include <sys/time.h>
 #include <unistd.h>
-#include <sys/stat.h>
 #include <sys/vfs.h>
+#include <sys/stat.h>
 #include <vconf.h>
 #include <regex.h>
-#include <malloc.h>
+#include <pthread.h>
 
 #include <contacts-svc.h>
 #include <notification.h>
 
-#include "emf-types.h"
-#include "em-core-global.h"
-#include "em-core-utils.h"
-#include "emf-dbglog.h"
-#include "em-core-mesg.h"
-#include "em-core-event.h"
-#include "em-core-mailbox.h"
-#include "em-core-account.h" 
-#include "em-core-mailbox-sync.h" 
-#include "em-core-mime.h"
-#include "em-core-sound.h" 
-#include "Msg_Convert.h"
+#include "email-types.h"
+#include "email-core-global.h"
+#include "email-core-utils.h"
+#include "email-debug-log.h"
+#include "email-core-mail.h"
+#include "email-core-event.h"
+#include "email-core-mailbox.h"
+#include "email-core-account.h" 
+#include "email-core-mailbox-sync.h" 
+#include "email-core-mime.h"
+#include "email-core-sound.h" 
+#include "email-utilities.h"
+#include "email-convert.h"
 
 #define LED_TIMEOUT_SECS          12 
 #define G_DISPLAY_LENGTH          256
@@ -103,28 +105,27 @@ static emf_option_t g_mail_option =
 static emf_session_t g_session_list[SESSION_MAX] = { {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0},};
 
 
-typedef struct em_core_account_list_t em_core_account_list_t;
-struct em_core_account_list_t {
+typedef struct emcore_account_list_t emcore_account_list_t;
+struct emcore_account_list_t {
        emf_account_t *account;
-       em_core_account_list_t *next;
+       emcore_account_list_t *next;
 };
 
-static em_core_account_list_t **g_account_reference = NULL;
+static emcore_account_list_t **g_account_reference = NULL;
 
-EXPORT_API 
-char *em_core_convert_mutf7_to_utf8(char *mailbox_name)
+INTERNAL_FUNC char *emcore_convert_mutf7_to_utf8(char *mailbox_name)
 {
        EM_DEBUG_FUNC_BEGIN();
        return (char *)(utf8_from_mutf7((unsigned char *)mailbox_name));
 }
 
-EXPORT_API int em_core_set_account_reference(em_core_account_list_t **account_list, int account_num, int *err_code)
+INTERNAL_FUNC int emcore_set_account_reference(emcore_account_list_t **account_list, int account_num, int *err_code)
 {
-       g_account_reference = (em_core_account_list_t **)account_list;
+       g_account_reference = (emcore_account_list_t **)account_list;
        return 1;
 }
 
-emf_option_t *em_core_get_option(int *err_code)
+emf_option_t *emcore_get_option(int *err_code)
 {
        if (err_code != NULL)
                *err_code = EMF_ERROR_NONE;
@@ -132,7 +133,7 @@ emf_option_t *em_core_get_option(int *err_code)
        return &g_mail_option;
 }
 
-EXPORT_API int em_core_set_option(emf_option_t *opt, int *err_code)
+INTERNAL_FUNC int emcore_set_option(emf_option_t *opt, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("opt[%p], err_code[%p]", opt, err_code);
        
@@ -167,7 +168,7 @@ EXPORT_API int em_core_set_option(emf_option_t *opt, int *err_code)
 
 
 /*  in smtp case, path argument must be ENCODED_PATH_SMTP */
-int em_core_get_long_encoded_path_with_account_info(emf_account_t *account, char *path, int delimiter, char **long_enc_path, int *err_code)
+int emcore_get_long_encoded_path_with_account_info(emf_account_t *account, char *path, int delimiter, char **long_enc_path, int *err_code)
 {
        EM_PROFILE_BEGIN(emCorelongEncodedpath);
        EM_DEBUG_FUNC_BEGIN("account[%p], path[%s], delimiter[%d], long_enc_path[%p], err_code[%p]", account, path, delimiter, long_enc_path, err_code);
@@ -190,7 +191,7 @@ int em_core_get_long_encoded_path_with_account_info(emf_account_t *account, char
        
                long_enc_path_len = strlen(account->receiving_server_addr) + (path ? strlen(path) : 0) + 64;
                
-               *long_enc_path = em_core_malloc(long_enc_path_len);
+               *long_enc_path = em_malloc(long_enc_path_len);
                if (!*long_enc_path)  {
                        EM_DEBUG_EXCEPTION("malloc failed...");
                        error = EMF_ERROR_OUT_OF_MEMORY;
@@ -219,7 +220,7 @@ int em_core_get_long_encoded_path_with_account_info(emf_account_t *account, char
                */
 
                if (account->apop) {
-                       EM_DEBUG_LOG("em_core_get_long_encoded_path - apop - %d", account->apop);
+                       EM_DEBUG_LOG("emcore_get_long_encoded_path - apop - %d", account->apop);
                        strncat(p, "/apop", long_enc_path_len-(strlen(p)+1));
                        EM_DEBUG_LOG("long_enc_path - %s", p);
                }
@@ -227,7 +228,7 @@ int em_core_get_long_encoded_path_with_account_info(emf_account_t *account, char
        else  {         /*  smtp */
                long_enc_path_len = strlen(account->sending_server_addr) + 64;
                
-               *long_enc_path = em_core_malloc(strlen(account->sending_server_addr) + 64);
+               *long_enc_path = em_malloc(strlen(account->sending_server_addr) + 64);
                if (!*long_enc_path) {
                        EM_DEBUG_EXCEPTION("\t malloc failed...\n");
                        
@@ -264,8 +265,8 @@ int em_core_get_long_encoded_path_with_account_info(emf_account_t *account, char
                if (path != NULL) {
                        char *enc_name = NULL;
                        
-                       if (!em_core_get_encoded_mailbox_name(path, &enc_name, &error))  {
-                               EM_DEBUG_EXCEPTION("em_core_get_encoded_mailbox_name failed - %d", error);
+                       if (!emcore_get_encoded_mailbox_name(path, &enc_name, &error))  {
+                               EM_DEBUG_EXCEPTION("emcore_get_encoded_mailbox_name failed - %d", error);
                                *long_enc_path = NULL;
                                goto FINISH_OFF;
                        }
@@ -289,7 +290,7 @@ FINISH_OFF:
        return ret;
 }
 
-int em_core_get_long_encoded_path(int account_id, char *path, int delimiter, char **long_enc_path, int *err_code)
+int emcore_get_long_encoded_path(int account_id, char *path, int delimiter, char **long_enc_path, int *err_code)
 {
        EM_PROFILE_BEGIN(emCorelongEncodedpath);
        EM_DEBUG_FUNC_BEGIN("account_id[%d], delimiter[%d], long_enc_path[%p], err_code[%p]", account_id, delimiter, long_enc_path, err_code);
@@ -297,15 +298,15 @@ int em_core_get_long_encoded_path(int account_id, char *path, int delimiter, cha
        int ret = false;
        int error = EMF_ERROR_NONE;
        
-       emf_account_t *ref_account = em_core_get_account_reference(account_id);
+       emf_account_t *ref_account = emcore_get_account_reference(account_id);
        if (!ref_account)  {
-               EM_DEBUG_EXCEPTION("em_core_get_account_reference failed [%d]", account_id);
+               EM_DEBUG_EXCEPTION("emcore_get_account_reference failed [%d]", account_id);
                error = EMF_ERROR_INVALID_ACCOUNT;
                goto FINISH_OFF;
        }
 
-       if (em_core_get_long_encoded_path_with_account_info(ref_account, path, delimiter, long_enc_path, &error) == false) {
-               EM_DEBUG_EXCEPTION("em_core_get_long_encoded_path_with_account_info failed [%d]", error);
+       if (emcore_get_long_encoded_path_with_account_info(ref_account, path, delimiter, long_enc_path, &error) == false) {
+               EM_DEBUG_EXCEPTION("emcore_get_long_encoded_path_with_account_info failed [%d]", error);
                goto FINISH_OFF;
        }
 
@@ -318,27 +319,7 @@ FINISH_OFF:
        return ret;
 }
 
-int em_core_upper_path(char *path)
-{
-       int i = 0, is_utf7 = 0, len = path ? (int)strlen(path) : -1;
-       for (; i < len; i++) {
-               if (path[i] == '&' || path[i] == 5) {
-                       is_utf7 = 1;
-               }
-               else {
-                       if (is_utf7) {
-                               if (path[i] == '-') is_utf7 = 0;
-                       }
-                       else {
-                               path[i] = toupper(path[i]);
-                       }
-               }
-       }
-
-       return 1;
-}
-
-int em_core_get_encoded_mailbox_name(char *name, char **enc_name, int *err_code)
+int emcore_get_encoded_mailbox_name(char *name, char **enc_name, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("name[%s], enc_name[%p], err_code[%p]", name, enc_name, err_code);
        
@@ -351,7 +332,7 @@ int em_core_get_encoded_mailbox_name(char *name, char **enc_name, int *err_code)
        
        /* encoding mailbox name (Charset->UTF8->UTF7) */
 
-       *enc_name = em_core_malloc(strlen(name)+1);
+       *enc_name = em_malloc(strlen(name)+1);
        if (*enc_name == NULL) {
                EM_DEBUG_EXCEPTION("malloc failed...");
                if (err_code != NULL)
@@ -369,15 +350,7 @@ int em_core_get_encoded_mailbox_name(char *name, char **enc_name, int *err_code)
        return true;
 }
 
-int em_core_upper_string(char *str)
-{
-       int i = str ? (int)strlen(str) : -1;
-       for (; i >= 0; i--) 
-               str[i] = toupper(str[i]);
-       return 1;
-}
-
-int em_core_get_temp_file_name(char **filename, int *err_code)
+int emcore_get_temp_file_name(char **filename, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("filename[%p], err_code[%p]", filename, err_code);
        
@@ -398,7 +371,7 @@ int em_core_get_temp_file_name(char **filename, int *err_code)
        srand(tv.tv_usec);
 
        /* Create Directory If deleted by user*/
-       em_storage_create_dir_if_delete();
+       emstorage_create_dir_if_delete();
        
        SNPRINTF(tempname, sizeof(tempname), "%s%c%s%c%d", MAILHOME, DIR_SEPERATOR_CH, MAILTEMP, DIR_SEPERATOR_CH, rand());
        
@@ -420,7 +393,7 @@ FINISH_OFF:
        return ret;
 }
 
-int em_core_get_file_name(char *path, char **filename, int *err_code)
+int emcore_get_file_name(char *path, char **filename, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("path[%s], filename[%p], err_code[%p]", path, filename, err_code);
        
@@ -452,7 +425,7 @@ FINISH_OFF:
        return ret;
 }
 
-int em_core_get_file_size(char *path, int *size, int *err_code)
+int emcore_get_file_size(char *path, int *size, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("path[%s], size[%p], err_code[%p]", path, size, err_code);
        
@@ -486,107 +459,18 @@ FINISH_OFF:
        return ret;
 }
 
-void* em_core_malloc(unsigned len)
-{
-       /* EM_DEBUG_LOG("Memory allocation size[%d] bytes", len); */
-       void *p = NULL;
-
-       if (len <= 0) {
-               EM_DEBUG_EXCEPTION("len should be positive.[%d]", len);
-               return NULL;
-       }
-       
-       p = malloc(len);
-
-       if (p)
-               memset(p, 0x00, len);
-       else
-               EM_DEBUG_EXCEPTION("malloc failed");
-       return p;
-}
-
-EXPORT_API char* em_core_replace_string(char *source_string, char *old_string, char *new_string)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       char *result_buffer = NULL;
-       char *p = NULL;
-       int   buffer_length = 0;
-
-       EM_IF_NULL_RETURN_VALUE(source_string, NULL);
-       EM_IF_NULL_RETURN_VALUE(old_string, NULL);
-       EM_IF_NULL_RETURN_VALUE(new_string, NULL);
-
-       p = strstr(source_string, old_string);
-
-       if (p == NULL) {
-               EM_DEBUG_EXCEPTION("old_string not found in source_string");
-               EM_DEBUG_FUNC_END("return NULL");
-               return NULL;
-       }
-       
-       EM_DEBUG_LOG("p[%s] ", p); /*  temp */
-       buffer_length   = strlen(source_string) + 1024;
-       EM_DEBUG_LOG("buffer_length[%d] ", buffer_length); /*  temp */
-       result_buffer  = (char *)em_core_malloc(buffer_length);
-
-       if (!result_buffer) {
-               EM_DEBUG_EXCEPTION("em_core_malloc failed");
-               return NULL;
-       }
-       
-       strncpy(result_buffer, source_string, p - source_string);
-       snprintf(result_buffer + strlen(result_buffer), buffer_length - strlen(result_buffer), "%s%s", new_string, p + strlen(old_string));
 
-       EM_DEBUG_FUNC_END("result_buffer[%s]", result_buffer);
-       return result_buffer;
-}
 
-static int _em_core_check_host(char *host)
+static int _emcore_check_host(char *host)
 {
        if (!host)
                return 0;
        return strncmp(host, ".SYNTAX-ERROR.", strlen(".SYNTAX-ERROR."));
 }
 
-void em_core_skip_whitespace(char *addr_str, char **pAddr)
-{
-       EM_DEBUG_FUNC_BEGIN("addr_str[%p]", addr_str);
-       
-       if (!addr_str)
-               return ;
-       char *str = addr_str;
-       char ptr[strlen(str)+1]  ;
-       int i, j = 0;
-       
-       str = addr_str ;
-       for (i = 0; str[i] != NULL_CHAR ; i++) {
-               if (str[i] != SPACE && str[i] != TAB && str[i] != CR && str[i] != LF)
-                       ptr[j++] = str[i];
-       }
-       ptr[j] = NULL_CHAR;
-
-       *pAddr = EM_SAFE_STRDUP(ptr);
-       EM_DEBUG_FUNC_END("ptr[%s]", ptr);
-} 
-
-EXPORT_API char* em_core_skip_whitespace_without_strdup(char *source_string)
-{
-       EM_DEBUG_FUNC_BEGIN("source_string[%p]", source_string);
-       
-       if (!source_string)
-               return NULL;
-       int i;
-       
-       for (i = 0; source_string[i] != NULL_CHAR ; i++) {
-               if (source_string[i] != SPACE) /*  || source_string[i] != TAB || source_string[i] != CR || source_string[i] || LF) */
-                       break;  
-       }
 
-       EM_DEBUG_FUNC_END("i[%d]", i);
-       return source_string + i;
-} 
 
-int em_core_get_address_count(char *addr_str, int *count, int *err_code)
+int emcore_get_address_count(char *addr_str, int *count, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("addr_str[%s], count[%p], err_code[%p]", addr_str, count, err_code);
        
@@ -606,8 +490,8 @@ int em_core_get_address_count(char *addr_str, int *count, int *err_code)
        }
        
        if (addr_str != NULL)  {
-               em_core_skip_whitespace(addr_str, &p);
-               EM_DEBUG_LOG("em_core_skip_whitespace[p][%s]", p);
+               em_skip_whitespace(addr_str, &p);
+               EM_DEBUG_LOG("em_skip_whitespace[p][%s]", p);
 
 
                for (i = 0, j = strlen(p); i < j; i++) 
@@ -623,7 +507,7 @@ int em_core_get_address_count(char *addr_str, int *count, int *err_code)
                                        continue;
                                }
                        }                       
-                       if ((!p_addr->mailbox) || (_em_core_check_host(p_addr->host) == 0)) {
+                       if ((!p_addr->mailbox) || (_emcore_check_host(p_addr->host) == 0)) {
                                EM_DEBUG_EXCEPTION("\t invalid address : mailbox[%s], host[%s]\n", p_addr->mailbox, p_addr->host);
                                
                                error = EMF_ERROR_INVALID_ADDRESS;
@@ -646,13 +530,13 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_core_set_network_error(int err_code)
+INTERNAL_FUNC int emcore_set_network_error(int err_code)
 {
        emf_session_t *session = NULL;
 
        EM_DEBUG_FUNC_BEGIN();
 
-       em_core_get_current_session(&session);
+       emcore_get_current_session(&session);
 
        if (!session)
                return false;
@@ -662,7 +546,7 @@ EXPORT_API int em_core_set_network_error(int err_code)
        return true;
 }
 
-int em_core_get_empty_session(emf_session_t **session)
+int emcore_get_empty_session(emf_session_t **session)
 {
        EM_DEBUG_FUNC_BEGIN("session[%p]", session);
        
@@ -687,7 +571,7 @@ int em_core_get_empty_session(emf_session_t **session)
        return (i != SESSION_MAX) ? true : false;
 }
 
-int em_core_clear_session(emf_session_t *session)
+int emcore_clear_session(emf_session_t *session)
 {
        EM_DEBUG_FUNC_BEGIN();
        
@@ -697,7 +581,7 @@ int em_core_clear_session(emf_session_t *session)
        return true;
 }
 
-int em_core_get_current_session(emf_session_t **session)
+int emcore_get_current_session(emf_session_t **session)
 {
        EM_DEBUG_FUNC_BEGIN("session[%p]", session);
        
@@ -718,7 +602,7 @@ int em_core_get_current_session(emf_session_t **session)
        return (i != SESSION_MAX) ? true : false;
 }
 
-int em_core_check_unread_mail()
+int emcore_check_unread_mail()
 {
        EM_DEBUG_FUNC_BEGIN();
        
@@ -730,12 +614,12 @@ int em_core_check_unread_mail()
        
        memset(&mailbox, 0x00, sizeof(emf_mailbox_t));
 
-       /* ALL_ACCOUNT used, so not calling em_storage_get_mailboxname_by_mailbox_type to get mailbox name */
+       /* ALL_ACCOUNT used, so not calling emstorage_get_mailboxname_by_mailbox_type to get mailbox name */
        mailbox.account_id = ALL_ACCOUNT;
        mailbox.name = NULL;
        
-       if (!em_core_mailbox_get_mail_count(&mailbox, &total_mail_count, &total_unread_count, &err))  {
-               EM_DEBUG_EXCEPTION("em_core_mailbox_get_mail_count failed [%d]", err);
+       if (!emcore_get_mail_count(&mailbox, &total_mail_count, &total_unread_count, &err))  {
+               EM_DEBUG_EXCEPTION("emcore_get_mail_count failed [%d]", err);
                goto FINISH_OFF;
        }
        
@@ -756,16 +640,91 @@ FINISH_OFF:
        return ret;
 }
 
-int em_core_add_notification(int account_id, int mail_id, char *title, char *content, time_t log_time)
+static int emcore_add_notification(int account_id, int mail_id, char *title, char *content, time_t log_time)
 {
        EM_DEBUG_FUNC_BEGIN();
        int ret = true;
+#ifdef __FEATURE_NOTIFICATION_FOR_NEW_MAIL__
+       int err = EMF_ERROR_NONE;
+       notification_h noti = NULL;
+       notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
+       emstorage_account_tbl_t *account_tbl = NULL;
 
+       if (!emstorage_get_account_by_id(account_id, EMF_ACC_GET_OPT_ACCOUNT_NAME, &account_tbl, true, &err)) {
+               EM_DEBUG_EXCEPTION("emstorage_get_account_by_id failed - %d", err);
+               goto FINISH_OFF;
+       }
+
+       noti = notification_new(NOTIFICATION_TYPE_NOTI, account_id, mail_id);
+
+       if(noti == NULL) {
+               EM_DEBUG_EXCEPTION("notification_new failed");
+               goto FINISH_OFF;
+       }
+       
+       if( (noti_err = notification_set_time(noti, log_time)) != NOTIFICATION_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("notification_set_time failed [%d]", noti_err);
+               goto FINISH_OFF;
+       }
+
+       if( (noti_err = notification_set_text_domain(noti, NATIVE_EMAIL_APPLICATION_PKG, "/opt/apps/com.samsung.email/res/locale/")) != NOTIFICATION_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("notification_set_text_domain failed [%d]", noti_err);
+               goto FINISH_OFF;
+       }
+
+       if( (noti_err = notification_set_title(noti, title, NULL)) != NOTIFICATION_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("notification_set_title failed [%d]", noti_err);
+               goto FINISH_OFF;
+       }
+
+       if( (noti_err = notification_set_content(noti, content, NULL)) != NOTIFICATION_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("notification_set_content failed [%d]", noti_err);
+               goto FINISH_OFF;
+       }
+
+       if ((noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_GROUP_TITLE, account_tbl->account_name, NULL, NOTIFICATION_VARIABLE_TYPE_NONE)) != NOTIFICATION_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("notification_set_text failed [%d]", noti_err);
+               goto FINISH_OFF;
+       }
+
+       if ((noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_GROUP_CONTENT, "unread mails", NULL, NOTIFICATION_VARIABLE_TYPE_COUNT, NOTIFICATION_COUNT_DISPLAY_TYPE_LEFT, NOTIFICATION_VARIABLE_TYPE_NONE)) != NOTIFICATION_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("notification_set_text failed [%d]", noti_err);
+               goto FINISH_OFF;
+       }
+       
+       if ((noti_err = notification_set_pkgname(noti, NATIVE_EMAIL_APPLICATION_PKG)) != NOTIFICATION_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("notification_set_pkgname failed [%d]", noti_err);
+               goto FINISH_OFF;
+       }               
+
+       if( (noti_err = notification_set_application(noti, NATIVE_EMAIL_APPLICATION_PKG)) != NOTIFICATION_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("notification_set_application failed [%d]", noti_err);
+               goto FINISH_OFF;
+       }
+       /* Settig property to disable visibility of notification */
+       if( (noti_err = notification_set_property(noti, NOTIFICATION_PROP_DISABLE_UPDATE_ON_INSERT)) != NOTIFICATION_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("notification_set_property failed [%d]", noti_err);
+               goto FINISH_OFF;
+       }
+
+       if( (noti_err = notification_insert(noti, NULL)) != NOTIFICATION_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("notification_insert failed [%d]", noti_err);
+               goto FINISH_OFF;
+       }
+
+FINISH_OFF:
+       if( (noti_err = notification_free(noti)) != NOTIFICATION_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("notification_free failed [%d]", noti_err);
+       }
+
+       if (noti_err != NOTIFICATION_ERROR_NONE)
+               ret = false;
+#endif /* __FEATURE_NOTIFICATION_FOR_NEW_MAIL__ */
        EM_DEBUG_FUNC_END();
        return ret;     
 }
 
-int em_core_show_popup(int id, emf_action_t action, int error)
+int emcore_show_popup(int id, emf_action_t action, int error)
 {
        EM_DEBUG_FUNC_BEGIN("id[%d], action[%d], error[%d]", id, action, error);
 
@@ -778,13 +737,10 @@ int em_core_show_popup(int id, emf_action_t action, int error)
        log_time = mktime(log_time_tm);
 
        EM_DEBUG_LOG("sec[%d], min[%d], hour[%d], day[%d], month[%d], year[%d]" ,log_time_tm->tm_sec, log_time_tm->tm_min, log_time_tm->tm_hour, log_time_tm->tm_mday, log_time_tm->tm_mon, log_time_tm->tm_year);
-#ifdef __FEATURE_PROGRESS_IN_OUTBOX__
+
        if (action == EMF_ACTION_SEND_MAIL && error != EMF_ERROR_CANCELLED) {
        /*  In case email is cancelled using cancel button in Outbox there is no need to show Cancel/Retry Pop up */
-#else
-       if (action == EMF_ACTION_SEND_MAIL) {
-#endif          
-               emf_mail_tbl_t *mail_table_data = NULL;
+               emstorage_mail_tbl_t *mail_table_data = NULL;
 
                if (error == 0) /*  error 0 means 'this is not error' */
                        return true;
@@ -794,18 +750,18 @@ int em_core_show_popup(int id, emf_action_t action, int error)
                        return false;
                }
                
-               if (!em_storage_get_mail_by_id(id, &mail_table_data, true, NULL)) {
+               if (!emstorage_get_mail_by_id(id, &mail_table_data, true, NULL)) {
                        EM_DEBUG_LOG("Mail not found");
                        return false;
                }
 
-               if (!em_core_add_notification(mail_table_data->account_id + 1000, id, "Failed to send mail", mail_table_data->subject, log_time)) {
-                       EM_DEBUG_EXCEPTION("em_core_notification_set error");
+               if (!emcore_add_notification(mail_table_data->account_id + 1000, id, "Failed to send mail", mail_table_data->subject, log_time)) {
+                       EM_DEBUG_EXCEPTION("emcore_notification_set error");
                        return false;
                }
 
-               if (!em_storage_free_mail(&mail_table_data, 1, NULL))
-                       EM_DEBUG_EXCEPTION("em_storage_free_mail Failed");
+               if (!emstorage_free_mail(&mail_table_data, 1, NULL))
+                       EM_DEBUG_EXCEPTION("emstorage_free_mail Failed");
                
                ret = true;
        }
@@ -815,7 +771,7 @@ int em_core_show_popup(int id, emf_action_t action, int error)
        
 
 /* storage space handling - 210709 */
-int em_core_get_storage_status(void)
+int emcore_get_storage_status(void)
 {
        EM_DEBUG_FUNC_BEGIN();
        int storage_status = 0, nError = 0;
@@ -835,7 +791,7 @@ int em_core_get_storage_status(void)
        return storage_status; 
 }
 
-int em_core_is_storage_full(int *err_code)
+int emcore_is_storage_full(int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
        
@@ -845,14 +801,14 @@ int em_core_is_storage_full(int *err_code)
        
        if (statfs(DATA_PATH, &buf) == -1) {
                EM_DEBUG_EXCEPTION("statfs(\"%s\") failed - %d", DATA_PATH, errno);
-               err = EMF_ERROR_SYSTEM_FAILURE;         /* lEMF_ERROR_UNKNOWN; */
+               err = EMF_ERROR_SYSTEM_FAILURE;
                goto FINISH_OFF;
        }
        else  {
                long i_free = (buf.f_bfree * buf.f_bsize) / (1024 * 1024);
                EM_DEBUG_LOG("f_bfree[%d] f_bsize[%d]", buf.f_bfree, buf.f_bsize);
                EM_DEBUG_LOG("Free space of storage is[%ld] MB.", i_free);
-               if (i_free < EM_STORAGE_LIMITATION_FREE_SPACE)
+               if (i_free < EMAIL_LIMITATION_FREE_SPACE)
                        err = EMF_ERROR_MAIL_MEMORY_FULL;
        }
        
@@ -866,76 +822,7 @@ FINISH_OFF:
        return ret;
 }
 
-int em_core_get_mail_size(emf_mail_t *mail_src, int *error_code)
-{
-       EM_DEBUG_FUNC_BEGIN("mail_src[%p], err_code[%p]", mail_src, error_code);
-       EM_PROFILE_BEGIN(profile_em_core_get_mail_size);
-
-       emf_attachment_info_t *atch = NULL;
-       struct stat st_buf;
-       int mail_size = 0;      /*  size of the plain text body and attachments */
-       int err = EMF_ERROR_NONE;
-       
-       if (!mail_src || !mail_src->body) {
-               if (mail_src)  {
-                       if (mail_src->body)
-                               EM_DEBUG_LOG("mail_src[%p], mail_src->body[%p], mail_src->body->plain[%p]", mail_src, mail_src->body, mail_src->body->plain);
-                       else
-                               EM_DEBUG_LOG(" mail_src[%p], mail_src->body[%p]", mail_src, mail_src->body);
-               }
-               else
-                       EM_DEBUG_LOG("mail_src[%p]", mail_src);
-               
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-       
-       mail_size = 0;
-       if (mail_src->body->plain != NULL) {
-               if (stat(mail_src->body->plain, &st_buf) < 0)  {
-                       EM_DEBUG_EXCEPTION("mail_src->body->plain stat(\"%s\") failed...", mail_src->body->plain);
-                       err = EMF_ERROR_INVALID_MAIL;
-                       goto FINISH_OFF;
-               }
-               
-               mail_size += st_buf.st_size;
-
-       }
-
-       if (mail_src->body->html != NULL) {
-               if (stat(mail_src->body->html, &st_buf) < 0) {
-                       EM_DEBUG_EXCEPTION("mail_src->body->html stat(\"%s\") failed...", mail_src->body->html);
-                       err = EMF_ERROR_INVALID_MAIL;
-                       goto FINISH_OFF;
-               }
-               
-               mail_size += st_buf.st_size;
-       }
-
-       atch = mail_src->body->attachment;
-       
-       while (atch)  {
-               if (stat(atch->savename, &st_buf) < 0)  {
-                       EM_DEBUG_EXCEPTION("stat(\"%s\") failed...", atch->savename);
-                       err = EMF_ERROR_INVALID_MAIL;           /* EMF_ERROR_INVALID_PATH; */
-                       goto FINISH_OFF;
-               }
-               
-               mail_size += st_buf.st_size;
-               atch = atch->next;
-       }
-
-       
-FINISH_OFF:
-       if (error_code)
-               *error_code = err;
-       EM_PROFILE_END(profile_em_core_get_mail_size);
-       EM_DEBUG_FUNC_END();
-       return (err == EMF_ERROR_NONE ? mail_size : 0);
-}
-
-
-int em_core_calc_mail_size(emf_mail_data_t *input_mail_data, emf_attachment_data_t *input_attachment_data_list, int input_attachment_count, int *output_size)
+int emcore_calc_mail_size(emf_mail_data_t *input_mail_data, emf_attachment_data_t *input_attachment_data_list, int input_attachment_count, int *output_size)
 {
        EM_DEBUG_FUNC_BEGIN("input_mail_data[%p], input_attachment_data_list[%p], input_attachment_count[%d], output_size[%p]", input_mail_data, input_attachment_data_list, input_attachment_count, output_size);
 
@@ -989,83 +876,8 @@ FINISH_OFF:
 }
 
 
-int em_storage_get_emf_error_from_em_storage_error(int error)
-{
-       switch (error) {
-               case EM_STORAGE_ERROR_NONE:
-                       return EMF_ERROR_NONE;
-
-               case EM_STORAGE_ERROR_INVALID_PARAM:
-                       return EMF_ERROR_INVALID_PARAM;
-
-               case EM_STORAGE_ERROR_ACCOUNT_NOT_FOUND:
-                       return EMF_ERROR_ACCOUNT_NOT_FOUND;
-
-               case EM_STORAGE_ERROR_MAIL_NOT_FOUND:
-                       return EMF_ERROR_MAIL_NOT_FOUND;
-
-               case EM_STORAGE_ERROR_MAILBOX_NOT_FOUND:
-                       return EMF_ERROR_MAILBOX_NOT_FOUND;
-
-               case EM_STORAGE_ERROR_ATTACHMENT_NOT_FOUND:
-                       return EMF_ERROR_ATTACHMENT_NOT_FOUND;
-
-               case EM_STORAGE_ERROR_CONTACT_NOT_FOUND:
-                       return EMF_ERROR_CONTACT_NOT_FOUND;
-
-               case EM_STORAGE_ERROR_FILE_NOT_FOUND:
-                       return EMF_ERROR_FILE_NOT_FOUND;
-
-               case EM_STORAGE_ERROR_DATA_NOT_FOUND:
-                       return EMF_ERROR_DATA_NOT_FOUND;
-
-               case EM_STORAGE_ERROR_NO_MORE_DATA:
-                       return EMF_ERROR_NO_MORE_DATA;
-
-               case EM_STORAGE_ERROR_DATA_TOO_LONG:
-                       return EMF_ERROR_DATA_TOO_LONG;
-
-               case EM_STORAGE_ERROR_DATA_TOO_SMALL:
-                       return EMF_ERROR_DATA_TOO_SMALL;
-
-               case EM_STORAGE_ERROR_OUT_OF_MEMORY:
-                       return EMF_ERROR_OUT_OF_MEMORY;
-
-               case EM_STORAGE_ERROR_CONNECTION_FAILURE:
-                       return EMF_ERROR_CONNECTION_FAILURE;
-
-               case EM_STORAGE_ERROR_SYSTEM_FAILURE:
-                       return EMF_ERROR_SYSTEM_FAILURE;
-
-               case EM_STORAGE_ERROR_RULE_NOT_FOUND:
-                       return EMF_ERROR_FILTER_NOT_FOUND;
-
-               case EM_STORAGE_ERROR_DB_IS_FULL:
-                       return EMF_ERROR_MAIL_MEMORY_FULL;
-
-               case EM_STORAGE_ERROR_DB_FAILURE:
-                       return EMF_ERROR_DB_FAILURE;
-
-               case EM_STORAGE_ERROR_MAIL_MAX_COUNT:
-                       return EMF_ERROR_MAIL_MAX_COUNT;
-
-               case EM_STORAGE_ERROR_MMC_NOT_FOUND:
-                       return EMF_ERROR_NO_MMC_INSERTED;
-
-               case EM_STORAGE_ERROR_ALREADY_EXISTS:
-                       return EMF_ERROR_ALREADY_EXISTS;
-
-               case EM_STORAGE_ERROR_UNKNOWN:
-               default:
-                       return EMF_ERROR_UNKNOWN;
-       }
-               
-       return EMF_ERROR_UNKNOWN;
-}
-
-
 /* parse the Full mailbox Path and Get the Alias Name of the Mailbox */
-char *em_core_get_alias_of_mailbox(const char *mailbox_path)
+char *emcore_get_alias_of_mailbox(const char *mailbox_path)
 {
        EM_DEBUG_FUNC_BEGIN();
        EM_IF_NULL_RETURN_VALUE(mailbox_path, NULL);
@@ -1088,7 +900,7 @@ char *em_core_get_alias_of_mailbox(const char *mailbox_path)
        name = g_strdup(token_list[index - 1]);
        g_strfreev(token_list);
 
-       converted_name = em_core_convert_mutf7_to_utf8(name);
+       converted_name = emcore_convert_mutf7_to_utf8(name);
        
        if (name)
                g_free(name);
@@ -1097,211 +909,8 @@ char *em_core_get_alias_of_mailbox(const char *mailbox_path)
        return converted_name;
 }
 
-EXPORT_API int em_core_open_contact_db_library(void)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int  err;
-       int ret = false;
-
-       if ((err = contacts_svc_connect()) == CTS_SUCCESS)
-               EM_DEBUG_LOG("Open Contact Service Success");   
-       else    {               
-               EM_DEBUG_EXCEPTION("contact_db_service_connect failed - %d", err);              
-               return false;
-       }
-       ret = true;
-
-       EM_DEBUG_FUNC_END();
-       return ret;
-       
-}
-
-EXPORT_API void em_core_close_contact_db_library()
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int  err;
-
-       if ((err = contacts_svc_disconnect()) == CTS_SUCCESS)
-               EM_DEBUG_LOG("Close Contact Service Success");
-       else
-               EM_DEBUG_EXCEPTION("Close Contact Service Fail[%d]", err);
-       EM_DEBUG_FUNC_END();    
-       return;
-}
-
-#define EMAIL_ACCOUNT_RGEX                     "([a-z0-9!#$%&'*+/=?^_`{|}~-]+.)*[a-z0-9!#$%&'*+/=?^_`{|}~-]+"
-#define EMAIL_DOMAIN_RGEX                      "([a-z0-9!#$%&'*+/=?^_`{|}~-]+.)+[a-z0-9!#$%&'*+/=?^_`{|}~-]+"
-
-#define EMAIL_ADDR_RGEX                        "[[:space:]]*<"EMAIL_ACCOUNT_RGEX"@"EMAIL_DOMAIN_RGEX">[[:space:]]*"
-#define EMAIL_ALIAS_RGEX                       "([[:space:]]*\"[^\"]*\")?"EMAIL_ADDR_RGEX
-#define EMAIL_ALIAS_LIST_RGEX                  "^("EMAIL_ALIAS_RGEX"[;,])*"EMAIL_ALIAS_RGEX"[;,]?[[:space:]]*$"
-
-#define EMAIL_ADDR_WITHOUT_BRACKET_RGEX        "[[:space:]]*"EMAIL_ACCOUNT_RGEX"@"EMAIL_DOMAIN_RGEX"[[:space:]]*"
-#define EMAIL_ALIAS_WITHOUT_BRACKET_RGEX       "([[:space:]]*\"[^\"]*\")?"EMAIL_ADDR_WITHOUT_BRACKET_RGEX
-#define EMAIL_ALIAS_LIST_WITHOUT_BRACKET_RGEX  "("EMAIL_ALIAS_WITHOUT_BRACKET_RGEX"[;,])*"EMAIL_ADDR_WITHOUT_BRACKET_RGEX"[;,]?[[:space:]]*$"
-
-EXPORT_API int em_core_verify_email_address(char *address, int without_bracket, int *err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("address[%s] without_bracket[%d]", address, without_bracket);
-
-       /*  this following code verfies the email alias string using reg. exp. */
-       regex_t alias_list_regex = {0};
-       int ret = false, error = EMF_ERROR_NONE;
-       char *reg_rule = NULL;
-
-       if(!address || strlen(address) == 0) {
-               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
-               if (err_code)
-                       *err_code = EMF_ERROR_INVALID_PARAM;
-               return false;
-       }
-
-       if(without_bracket)
-               reg_rule = EMAIL_ALIAS_LIST_WITHOUT_BRACKET_RGEX;
-       else
-               reg_rule = EMAIL_ALIAS_LIST_RGEX;
-
-       if (regcomp(&alias_list_regex, reg_rule, REG_ICASE | REG_EXTENDED)) {
-               EM_DEBUG_EXCEPTION("email alias regex unrecognized");
-               if (err_code)
-                       *err_code = EMF_ERROR_UNKNOWN;
-               return false;
-       }
-
-       int alias_len = strlen(address) + 1;
-       regmatch_t pmatch[alias_len];
-       
-       bzero(pmatch, alias_len);
-
-       if (regexec(&alias_list_regex, address, alias_len, pmatch, 0) == REG_NOMATCH)
-               EM_DEBUG_LOG("failed :[%s]", address);
-       else {
-               EM_DEBUG_LOG("success :[%s]", address);
-               ret = true;
-       }
-
-       regfree(&alias_list_regex);
-
-       if (err_code)
-               *err_code = error;
-
-       EM_DEBUG_FUNC_END("ret [%d]", ret);
-       return ret;
-}
-
-EXPORT_API int em_core_verify_email_address_of_mail_header(emf_mail_head_t *mail_header, int without_bracket, int *err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("mail_header[%p] without_bracket[%d]", mail_header, without_bracket);
-       char *address_array[4] = { mail_header->to, mail_header->cc, mail_header->bcc, mail_header->from};
-       int  ret = false, err = EMF_ERROR_NONE, i;
-
-       /* check for email_address validation */
-       for (i = 0; i < 4; i++) {
-               if (address_array[i] && address_array[i][0] != 0) {
-                       if (!em_core_verify_email_address(address_array[i] , without_bracket, &err)) {
-                               err = EMF_ERROR_INVALID_ADDRESS;
-                               EM_DEBUG_EXCEPTION("Invalid Email Address [%d][%s]", i, address_array[i]);
-                               goto FINISH_OFF;
-                       }
-               }
-       }
-       ret = true;
-FINISH_OFF:    
-       EM_DEBUG_FUNC_END("ret [%d]", ret);
-       return ret;
-}
-
-EXPORT_API int em_core_verify_email_address_of_mail_data(emf_mail_data_t *mail_data, int without_bracket, int *err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("mail_data[%p] without_bracket[%d]", mail_data, without_bracket);
-       char *address_array[4] = { mail_data->full_address_from, mail_data->full_address_to, mail_data->full_address_cc, mail_data->full_address_bcc};
-       int  ret = false, err = EMF_ERROR_NONE, i;
-
-       /* check for email_address validation */
-       for (i = 0; i < 4; i++) {
-               if (address_array[i] && address_array[i][0] != 0) {
-                       if (!em_core_verify_email_address(address_array[i] , without_bracket, &err)) {
-                               err = EMF_ERROR_INVALID_ADDRESS;
-                               EM_DEBUG_EXCEPTION("Invalid Email Address [%d][%s]", i, address_array[i]);
-                               goto FINISH_OFF;
-                       }
-               }
-       }
-       ret = true;
-FINISH_OFF:    
-       EM_DEBUG_FUNC_END("ret [%d]", ret);
-       return ret;
-}
-
-EXPORT_API int em_core_get_server_time(void *mail_stream, int account_id, char *uid, int msgno, time_t *log_time, int *err_code)
-{
-       EM_DEBUG_FUNC_BEGIN();
-
-       int ret_code = false;
-       int err = EMF_ERROR_NONE;
-       emf_account_t *account =  NULL;
-       emf_mailbox_t  mailbox = { 0 };
-       MESSAGECACHE *elt = NULL;
-       char datetime[DATETIME_LENGTH] = { 0, };
-       emf_datetime_t date = { 0 };
-       struct tm tm1 = { 0 };
-       time_t t = time(NULL);
-       
-
-       if (!mail_stream || (!uid && msgno < 1)) {
-               EM_DEBUG_EXCEPTION("Param is NULL");
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-
-       mailbox.account_id = account_id;
-       mailbox.mail_stream = mail_stream;
-
-       if (!(account = em_core_get_account_reference(account_id))) {
-               EM_DEBUG_EXCEPTION("em_core_get_account_reference failed - %d", account_id);
-               err = EMF_ERROR_INVALID_ACCOUNT;        
-               goto FINISH_OFF;
-       }
-       if (msgno < 1) {        /*  get msgno  from server */
-               if (!em_core_mail_get_msgno_by_uid(account, &mailbox, uid, &msgno, &err)) {
-                       EM_DEBUG_EXCEPTION("em_core_mail_get_msgno_by_uid failed message_no : %d ", err);
-                       goto FINISH_OFF;
-               }
-       }
-       if (!(elt = mail_elt(mailbox.mail_stream, msgno))) {
-               EM_DEBUG_EXCEPTION("mail_elt failed...");
-               err = EMF_ERROR_UNKNOWN;
-               goto FINISH_OFF;
-       }
-       SNPRINTF(datetime, sizeof(datetime), "%04d%02d%02d%02d%02d%02d", 
-               BASEYEAR + elt->year, elt->month, elt->day, elt->hours, elt->minutes, elt->seconds);
-
-       EM_DEBUG_LOG("datetime[%s]", datetime);
-       
-       if (!em_convert_string_to_datetime(datetime, &date, &err)) 
-               EM_DEBUG_EXCEPTION("em_convert_string_to_datetime failed - %d", err);
-
-       tm1.tm_year = date.year - 1900;
-       tm1.tm_mon = date.month - 1;
-       tm1.tm_mday = date.day;
-       tm1.tm_hour = date.hour;
-       tm1.tm_min = date.minute;
-       tm1.tm_sec = date.second;
-       t = mktime(&tm1);
-
-       *log_time = t;
-       ret_code = true;
-       
-FINISH_OFF:
-
-       if (err_code)
-               *err_code = err;
-
-       EM_DEBUG_FUNC_END();
-       return ret_code;
-}
 
-static int em_core_get_first_address(const char *full_address, char **alias, char **address)
+static int emcore_get_first_address(const char *full_address, char **alias, char **address)
 {
        EM_DEBUG_FUNC_BEGIN();
 
@@ -1364,7 +973,7 @@ static int em_core_get_first_address(const char *full_address, char **alias, cha
        return true;
 }              
 
-EXPORT_API void em_core_fill_address_information_of_mail_tbl(emf_mail_tbl_t *mail_data)
+void emcore_fill_address_information_of_mail_tbl(emstorage_mail_tbl_t *mail_data)
 {
        EM_DEBUG_FUNC_BEGIN("mail_data [%p]", mail_data);
 
@@ -1373,7 +982,7 @@ EXPORT_API void em_core_fill_address_information_of_mail_tbl(emf_mail_tbl_t *mai
        char *recipient     = NULL;
 
        /*  sender alias & address */
-       if (em_core_get_first_address(mail_data->full_address_from, &first_alias, &first_address) == true) {
+       if (emcore_get_first_address(mail_data->full_address_from, &first_alias, &first_address) == true) {
                if (first_alias == NULL) {
                        mail_data->alias_sender = EM_SAFE_STRDUP(first_address);
                }
@@ -1393,7 +1002,7 @@ EXPORT_API void em_core_fill_address_information_of_mail_tbl(emf_mail_tbl_t *mai
        else if (mail_data->full_address_bcc != NULL)
                recipient = mail_data->full_address_bcc;
        
-       if (em_core_get_first_address(recipient, &first_alias, &first_address) == true) {
+       if (emcore_get_first_address(recipient, &first_alias, &first_address) == true) {
                if (first_alias == NULL)
                        mail_data->alias_recipient = EM_SAFE_STRDUP(first_address);
                else
@@ -1405,7 +1014,7 @@ EXPORT_API void em_core_fill_address_information_of_mail_tbl(emf_mail_tbl_t *mai
 }
 
 
-EXPORT_API int em_core_get_preview_text_from_file(const char *input_plain_path, const char *input_html_path, int input_preview_buffer_length, char **output_preview_buffer)
+int emcore_get_preview_text_from_file(const char *input_plain_path, const char *input_html_path, int input_preview_buffer_length, char **output_preview_buffer)
 {
        EM_DEBUG_FUNC_BEGIN("input_plain_path[%p], input_html_path[%p], input_preview_buffer_length [%d], output_preview_buffer[%p]", input_plain_path, input_html_path, input_preview_buffer_length, output_preview_buffer);
        
@@ -1431,8 +1040,8 @@ EXPORT_API int em_core_get_preview_text_from_file(const char *input_plain_path,
 
        if (input_html_path != NULL) {  
                        /*      get preview text from html file */
-                       if( (err = em_core_get_encoding_type_from_file_path(input_html_path, &encoding_type)) != EMF_ERROR_NONE) {
-                               EM_DEBUG_EXCEPTION("em_core_get_encoding_type_from_file_path failed [%s]", err);
+                       if( (err = em_get_encoding_type_from_file_path(input_html_path, &encoding_type)) != EMF_ERROR_NONE) {
+                               EM_DEBUG_EXCEPTION("em_get_encoding_type_from_file_path failed [%s]", err);
                                goto FINISH_OFF;
                        }
                        
@@ -1448,8 +1057,8 @@ EXPORT_API int em_core_get_preview_text_from_file(const char *input_plain_path,
                                goto FINISH_OFF;
                        }
        
-                       if (!(local_preview_text = (char*)em_core_malloc(sizeof(char) * (st_buf.st_size + 1)))) {
-                               EM_DEBUG_EXCEPTION("em_core_malloc failed");
+                       if (!(local_preview_text = (char*)em_malloc(sizeof(char) * (st_buf.st_size + 1)))) {
+                               EM_DEBUG_EXCEPTION("em_malloc failed");
                                err = EMF_ERROR_OUT_OF_MEMORY;
                                goto FINISH_OFF;
                        }
@@ -1462,8 +1071,8 @@ EXPORT_API int em_core_get_preview_text_from_file(const char *input_plain_path,
                                goto FINISH_OFF;
                        }
        
-                       if ( (err = em_core_strip_HTML(local_preview_text)) != EMF_ERROR_NONE) {
-                               EM_DEBUG_EXCEPTION("em_core_strip_HTML failed");
+                       if ( (err = emcore_strip_HTML(local_preview_text)) != EMF_ERROR_NONE) {
+                               EM_DEBUG_EXCEPTION("emcore_strip_HTML failed");
                                goto FINISH_OFF;
                        }
        
@@ -1472,8 +1081,8 @@ EXPORT_API int em_core_get_preview_text_from_file(const char *input_plain_path,
 
        if (local_preview_text == NULL && input_plain_path != NULL) {   
                /*  get preview text from plain text file */
-               if( (err = em_core_get_encoding_type_from_file_path(input_plain_path, &encoding_type)) != EMF_ERROR_NONE) {
-                       EM_DEBUG_EXCEPTION("em_core_get_encoding_type_from_file_path failed [%s]", err);
+               if( (err = em_get_encoding_type_from_file_path(input_plain_path, &encoding_type)) != EMF_ERROR_NONE) {
+                       EM_DEBUG_EXCEPTION("em_get_encoding_type_from_file_path failed [%s]", err);
                        goto FINISH_OFF;
                }
                
@@ -1483,8 +1092,8 @@ EXPORT_API int em_core_get_preview_text_from_file(const char *input_plain_path,
                        goto FINISH_OFF;
                }
 
-               if (!(local_preview_text = (char*)em_core_malloc(sizeof(char) * local_preview_buffer_length))) {
-                       EM_DEBUG_EXCEPTION("em_core_malloc failed");
+               if (!(local_preview_text = (char*)em_malloc(sizeof(char) * local_preview_buffer_length))) {
+                       EM_DEBUG_EXCEPTION("em_malloc failed");
                        goto FINISH_OFF;
                }
                
@@ -1512,8 +1121,8 @@ EXPORT_API int em_core_get_preview_text_from_file(const char *input_plain_path,
                                EM_DEBUG_EXCEPTION("g_convert failed");
                }
                
-               if (!(*output_preview_buffer = (char*)em_core_malloc(sizeof(char) * (result_strlen + 1)))) {
-                       EM_DEBUG_EXCEPTION("em_core_malloc failed");
+               if (!(*output_preview_buffer = (char*)em_malloc(sizeof(char) * (result_strlen + 1)))) {
+                       EM_DEBUG_EXCEPTION("em_malloc failed");
                        err = EMF_ERROR_OUT_OF_MEMORY;
                        goto FINISH_OFF;
                }
@@ -1534,7 +1143,7 @@ FINISH_OFF:
        return err;
 }
 
-EXPORT_API int em_core_add_transaction_info(int mail_id, int handle , int *err_code)
+INTERNAL_FUNC int emcore_add_transaction_info(int mail_id, int handle , int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("mail_id[%d], handle[%d]", mail_id, handle);
 
@@ -1546,7 +1155,7 @@ EXPORT_API int em_core_add_transaction_info(int mail_id, int handle , int *err_c
        EM_DEBUG_LOG("g_transaction_info_list[%p]", g_transaction_info_list);
        pTransinfo = g_transaction_info_list ;
        
-       if (!(pTemp = em_core_malloc(sizeof(em_transaction_info_type_t))))  {
+       if (!(pTemp = em_malloc(sizeof(em_transaction_info_type_t))))  {
                EM_DEBUG_EXCEPTION("malloc failed...");
                err = EMF_ERROR_OUT_OF_MEMORY;
                goto FINISH_OFF;
@@ -1573,7 +1182,7 @@ FINISH_OFF:
        return ret;     
 }
 
-EXPORT_API int em_core_get_handle_by_mailId_from_transaction_info(int mail_id, int *pHandle)
+INTERNAL_FUNC int emcore_get_handle_by_mailId_from_transaction_info(int mail_id, int *pHandle)
 {
        EM_DEBUG_FUNC_BEGIN("mail_id[%d], handle[%p]", mail_id, pHandle);
 
@@ -1601,7 +1210,7 @@ EXPORT_API int em_core_get_handle_by_mailId_from_transaction_info(int mail_id, i
        return ret;
 }
 
-EXPORT_API int em_core_delete_transaction_info_by_mailId(int mail_id )
+INTERNAL_FUNC int emcore_delete_transaction_info_by_mailId(int mail_id )
 {
        EM_DEBUG_FUNC_BEGIN("mail_id[%d]", mail_id);
 
@@ -1674,7 +1283,7 @@ int reg_replace (char *input_source_text, char *input_old_pattern_string, char *
                goto FINISH_OFF;                
        }
        
-       pmatch = (regmatch_t*)em_core_malloc(sizeof(regmatch_t) * nmatch);
+       pmatch = (regmatch_t*)em_malloc(sizeof(regmatch_t) * nmatch);
 
        if(pmatch == NULL) {
                EM_DEBUG_EXCEPTION("EMF_ERROR_OUT_OF_MEMORY");
@@ -1719,7 +1328,7 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int em_core_strip_HTML(char *source_string)
+int emcore_strip_HTML(char *source_string)
 {
        EM_DEBUG_FUNC_BEGIN("source_string [%p]", source_string);
 
@@ -1778,7 +1387,7 @@ EXPORT_API int em_core_strip_HTML(char *source_string)
 
 #define MAX_NOTI_STRING_LENGTH         8096
 
-EXPORT_API int em_core_convert_structure_to_string(void *struct_var, char **encoded_string, emf_convert_struct_type_e type)
+INTERNAL_FUNC int emcore_convert_structure_to_string(void *struct_var, char **encoded_string, emf_convert_struct_type_e type)
 {
        EM_DEBUG_FUNC_BEGIN("Struct type[%d]", type);
        
@@ -1795,47 +1404,47 @@ EXPORT_API int em_core_convert_structure_to_string(void *struct_var, char **enco
                case EMF_CONVERT_STRUCT_TYPE_MAIL_LIST_ITEM: {
                        emf_mail_list_item_t *item = (emf_mail_list_item_t *)struct_var;
                        SNPRINTF(buf, MAX_NOTI_STRING_LENGTH, 
-                               "%d%c"  /*      int  mail_id                                                            ; */
+                               "%d%c"  /*      int  mail_id                                    ; */
                                "%d%c"  /*      int  account_id                                                                 ; */
                                "%s%c"  /*      char mailbox_name[STRING_LENGTH_FOR_DISPLAY]    ; */
                                "%s%c"  /*      char from[STRING_LENGTH_FOR_DISPLAY]                    ; */
                                "%s%c"  /*      char from_email_address[MAX_EMAIL_ADDRESS_LENGTH]; */
-                               "%s%c"  /*      char recipients[STRING_LENGTH_FOR_DISPLAY]      ; */
+                               "%s%c"  /*      char recipients[STRING_LENGTH_FOR_DISPLAY]      ; */
                                "%s%c"  /*      char subject[STRING_LENGTH_FOR_DISPLAY]                 ; */
                                "%d%c"  /*      int  is_text_downloaded                                                 ; */
-                               "%s%c"  /*      char datetime[MAX_DATETIME_STRING_LENGTH]               ; */
-                               "%d%c"  /*      int  flags_seen_field                                                                   ; */
+                               "%d%c"  /*      time_t date_time                                ; */
+                               "%d%c"  /*      int  flags_seen_field                           ; */
                                "%d%c"  /*      int  priority                                                                   ; */
-                               "%d%c"  /*      int  save_status                                                                                ; */
+                               "%d%c"  /*      int  save_status                                ; */
                                "%d%c"  /*      int  is_locked                                                                  ; */
                                "%d%c"  /*      int  is_report_mail                                                             ; */
                                "%d%c"  /*      int  recipients_count                                                   ; */
-                               "%d%c"  /*      int  has_attachment                                                     ; */
+                               "%d%c"  /*      int  has_attachment                             ; */
                                "%d%c"  /*      int  has_drm_attachment                                                 ; */
                                "%s%c"  /*      char previewBodyText[MAX_PREVIEW_TEXT_LENGTH]   ; */
                                "%d%c"  /*      int  thread_id                                                                  ; */
                                "%d%c", /*      int  thread_item_count                                                  ; */
 
-                               item->mail_id,                  delimiter[0],
-                               item->account_id,                       delimiter[0],
-                               item->mailbox_name,             delimiter[0],
-                               item->from,                             delimiter[0],
-                               item->from_email_address,       delimiter[0],
-                               item->recipients,                       delimiter[0],
-                               item->subject,                  delimiter[0],
-                               item->is_text_downloaded,       delimiter[0],
-                               item->datetime,                         delimiter[0],
-                               item->flags_seen_field,                         delimiter[0],
+                               item->mail_id,              delimiter[0],
+                               item->account_id,           delimiter[0],
+                               item->mailbox_name,         delimiter[0],
+                               item->from,                 delimiter[0],
+                               item->from_email_address,   delimiter[0],
+                               item->recipients,           delimiter[0],
+                               item->subject,              delimiter[0],
+                               item->is_text_downloaded,   delimiter[0],
+                               (unsigned int)item->date_time,       delimiter[0],
+                               item->flags_seen_field,     delimiter[0],
                                item->priority,                         delimiter[0],
-                               item->save_status,                              delimiter[0],
-                               item->is_locked,                        delimiter[0],
-                               item->is_report_mail,           delimiter[0],
-                               item->recipients_count,         delimiter[0],
-                               item->has_attachment,   delimiter[0],
-                               item->has_drm_attachment,       delimiter[0],
-                               item->previewBodyText,  delimiter[0],
-                               item->thread_id,                        delimiter[0],
-                               item->thread_item_count,        delimiter[0]
+                               item->save_status,          delimiter[0],
+                               item->is_locked,            delimiter[0],
+                               item->is_report_mail,       delimiter[0],
+                               item->recipients_count,     delimiter[0],
+                               item->has_attachment,       delimiter[0],
+                               item->has_drm_attachment,   delimiter[0],
+                               item->previewBodyText,      delimiter[0],
+                               item->thread_id,            delimiter[0],
+                               item->thread_item_count,    delimiter[0]
                        );
                }               
                        break;
@@ -1848,7 +1457,7 @@ FINISH_OFF:
        return error_code;
 }
 
-EXPORT_API int em_core_convert_string_to_structure(const char *encoded_string, void **struct_var, emf_convert_struct_type_e type)
+INTERNAL_FUNC int emcore_convert_string_to_structure(const char *encoded_string, void **struct_var, emf_convert_struct_type_e type)
 {
        EM_DEBUG_FUNC_BEGIN();
        
@@ -1974,9 +1583,9 @@ EXPORT_API int em_core_convert_string_to_structure(const char *encoded_string, v
                                goto FINISH_OFF;                
                        }
                        *found_pos = NULL_CHAR;
-                       strncpy(item->datetime, current_pos, MAX_DATETIME_STRING_LENGTH-1);
-                       EM_DEBUG_LOG("datetime[%s]", item->datetime);
-                       current_pos = found_pos + 1;    
+                       item->date_time = atoi(current_pos);
+                       EM_DEBUG_LOG("date_time[%d]", item->date_time);
+                       current_pos = found_pos + 1;
 
                        /*  flags_seen_field */
                        found_pos = strstr(current_pos, delimiter);
@@ -2122,14 +1731,14 @@ FINISH_OFF:
 }
 
 
-/*  em_core_send_noti_for_new_mail is not used currently because DBUS could not send very long message.*/
+/*  emcore_send_noti_for_new_mail is not used currently because DBUS could not send very long message.*/
 /*  But I think it can be used to notify incomming new mail for replacing NOTI_MAIL_ADD with some modification(uid should be replaced with mail_id).  */
 /*  This notification is including addtional information comparing NOTI_MAIL_ADD. */
 /*  By this change, email application will be able to add email item without additional DB query.  */
 /*  It might improve performance of sync email.  */
 /*  kyuho.jo 2010-09-07 */
 
-EXPORT_API int em_core_send_noti_for_new_mail(int account_id, char *mailbox_name, char *subject, char *from, char *uid, char *datetime)
+INTERNAL_FUNC int emcore_send_noti_for_new_mail(int account_id, char *mailbox_name, char *subject, char *from, char *uid, char *datetime)
 {
        EM_DEBUG_FUNC_BEGIN("mailbox_name(%s) subject(%s), from(%s), uid(%s), datetime(%s)", mailbox_name, subject, from, uid, datetime);
        int error_code = EMF_ERROR_NONE;
@@ -2150,13 +1759,12 @@ EXPORT_API int em_core_send_noti_for_new_mail(int account_id, char *mailbox_name
        }
 
        memset(param_string, 0x00, sizeof(param_string));
-       /* TODO: account_name, thread_id */
-       /*  uid -> mail_id */
+
        SNPRINTF(param_string, sizeof(param_string), "%s%c%s%c%s%c%s%c%s", mailbox_name, 0x01, subject, 0x01, from, 0x01, uid, 0x01, datetime);
 
-       if (em_storage_notify_network_event(NOTI_DOWNLOAD_NEW_MAIL, account_id, param_string, 0, 0) == 0) {     /*  failed */
+       if (emstorage_notify_network_event(NOTI_DOWNLOAD_NEW_MAIL, account_id, param_string, 0, 0) == 0) {      /*  failed */
                error_code = EMF_ERROR_UNKNOWN;
-               EM_DEBUG_EXCEPTION("em_storage_notify_network_event is failed");
+               EM_DEBUG_EXCEPTION("emstorage_notify_network_event is failed");
                goto FINISH_OFF;
        }
 
@@ -2168,106 +1776,9 @@ FINISH_OFF:
 }
 
 
-EXPORT_API 
-int em_core_find_tag_for_thread_view(char *subject, int *result)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int error_code = EMF_ERROR_NONE;
-       char *copy_of_subject = NULL;
-
-       EM_IF_NULL_RETURN_VALUE(subject, EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(result, EMF_ERROR_INVALID_PARAM);
-       
-       *result = FALSE;
-
-       copy_of_subject = EM_SAFE_STRDUP(subject);
-       
-       if (copy_of_subject == NULL) {
-               EM_DEBUG_EXCEPTION("strdup is failed \n");
-               goto FINISH_OFF;
-       }
-       
-       em_core_upper_string(copy_of_subject);
-       EM_DEBUG_LOG("em_core_upper_string result : %s\n", copy_of_subject);
-
-       if (strstr(copy_of_subject, "RE:") == NULL) {
-               if (strstr(copy_of_subject, "FWD:") == NULL) {
-                       if (strstr(copy_of_subject, "FW:") != NULL)
-                               *result = TRUE;         
-               }
-               else
-                       *result = TRUE; 
-       }
-       else
-               *result = TRUE; 
-
-FINISH_OFF:
-       EM_SAFE_FREE(copy_of_subject);  
-
-       EM_DEBUG_FUNC_END("result : %d", *result);
-   
-       return error_code;
-}
-
-
-EXPORT_API 
-int em_core_find_pos_stripped_subject_for_thread_view(char *subject, char *stripped_subject)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int error_code = EMF_ERROR_NONE;
-       int gap;
-       char *copy_of_subject = NULL, *curpos = NULL, *result;
-
-       EM_IF_NULL_RETURN_VALUE(subject, EMF_ERROR_INVALID_PARAM);
-       EM_IF_NULL_RETURN_VALUE(stripped_subject, EMF_ERROR_INVALID_PARAM);
-       
-       copy_of_subject = EM_SAFE_STRDUP(subject);
-       
-       if (copy_of_subject == NULL) {
-               EM_DEBUG_EXCEPTION("strdup is failed");
-               goto FINISH_OFF;
-       }
-       
-       em_core_upper_string(copy_of_subject);
-       curpos = copy_of_subject;
-
-       EM_DEBUG_LOG("em_core_upper_string result : %s", copy_of_subject);
-
-       while ((result = strstr(curpos, "RE:")) != NULL) {
-               curpos = result + 3;
-               EM_DEBUG_LOG("RE result : %s", curpos);
-       }
-
-       while ((result = strstr(curpos, "FWD:")) != NULL) {
-               curpos = result + 4;    
-               EM_DEBUG_LOG("FWD result : %s", curpos);
-       }
-
-       while ((result = strstr(curpos, "FW:")) != NULL) {
-               curpos = result + 3;
-               EM_DEBUG_LOG("FW result : %s", curpos);
-       }
-
-       while (curpos != NULL && *curpos == ' ') {
-               curpos++;
-       }
-
-       gap = curpos - copy_of_subject;
-
-       strcpy(stripped_subject, subject + gap);
-
-FINISH_OFF:
-       EM_SAFE_FREE(copy_of_subject);  
-
-       if (error_code == EMF_ERROR_NONE && stripped_subject)
-               EM_DEBUG_LOG("result[%s]", stripped_subject);
-
-       EM_DEBUG_FUNC_END("error_code[%d]", error_code);
-       return error_code;
-}
 
 #define MAX_TITLE_LENGTH 1024
-EXPORT_API int em_core_update_notification_for_unread_mail(int account_id)
+int emcore_update_notification_for_unread_mail(int account_id)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d]", account_id); 
        int error_code = EMF_ERROR_NONE;
@@ -2284,135 +1795,71 @@ FINISH_OFF:
        return error_code;
 }
 
-EXPORT_API int em_core_finalize_sync(int account_id, int *error)
+INTERNAL_FUNC int emcore_finalize_sync(int account_id, int *error)
 {
        EM_DEBUG_FUNC_BEGIN("account_id [%d], error [%p]", account_id, error);
        int err = EMF_ERROR_NONE, ret = true, result_sync_status = SYNC_STATUS_FINISHED;
-       emf_mail_account_tbl_t *account_tbl = NULL;
+       emstorage_account_tbl_t *account_tbl = NULL;
 
-       if (!em_storage_update_sync_status_of_account(account_id, SET_TYPE_MINUS, SYNC_STATUS_SYNCING, true, &err)) 
-               EM_DEBUG_EXCEPTION("em_storage_update_sync_status_of_account failed [%d]", err);
+       if (!emstorage_update_sync_status_of_account(account_id, SET_TYPE_MINUS, SYNC_STATUS_SYNCING, true, &err)) 
+               EM_DEBUG_EXCEPTION("emstorage_update_sync_status_of_account failed [%d]", err);
 
-       if (!em_storage_get_sync_status_of_account(ALL_ACCOUNT, &result_sync_status, &err))
-               EM_DEBUG_EXCEPTION("em_storage_get_sync_status_of_account failed [%d]", err);
+       if (!emstorage_get_sync_status_of_account(ALL_ACCOUNT, &result_sync_status, &err))
+               EM_DEBUG_EXCEPTION("emstorage_get_sync_status_of_account failed [%d]", err);
 
        if ( result_sync_status == SYNC_STATUS_HAVE_NEW_MAILS) {
-               if (!em_core_update_notification_for_unread_mail(ALL_ACCOUNT))
-                               EM_DEBUG_EXCEPTION("em_core_update_notification_for_unread_mail failed");       
-                       em_core_check_unread_mail();
+               if (!emcore_update_notification_for_unread_mail(ALL_ACCOUNT))
+                       EM_DEBUG_EXCEPTION("emcore_update_notification_for_unread_mail failed");        
+                       emcore_check_unread_mail();
                        /* Temp.. exception for EAS */
                        if(account_id >= FIRST_ACCOUNT_ID)
-                               em_storage_get_account_by_id(account_id, EMF_ACC_GET_OPT_DEFAULT, &account_tbl, true, &err);
+                               emstorage_get_account_by_id(account_id, EMF_ACC_GET_OPT_DEFAULT, &account_tbl, true, &err);
                        if(account_tbl && account_tbl->receiving_server_type != EMF_SERVER_TYPE_ACTIVE_SYNC)
-                               start_alert();
+                               emcore_start_alert();
        }
 
        EM_DEBUG_FUNC_END();
        return ret;
 }
 
-EXPORT_API int em_core_clear_all_notifications()
+INTERNAL_FUNC int emcore_clear_all_notifications()
 {
        int account_count = 0, i;
-       emf_mail_account_tbl_t *account_list;
+       emstorage_account_tbl_t *account_list;
        int error_code = EMF_ERROR_NONE;
        
-       if(!em_storage_get_account_list(&account_count, &account_list, true, false, &error_code)) {
-               EM_DEBUG_EXCEPTION("em_storage_get_account_list failed");
+       if(!emstorage_get_account_list(&account_count, &account_list, true, false, &error_code)) {
+               EM_DEBUG_EXCEPTION("emstorage_get_account_list failed");
                goto FINISH_OFF;
        }
 
        for(i = 0; i < account_count; i++) {
-               em_core_delete_notification_by_account(account_list[i].account_id);
+               emcore_delete_notification_by_account(account_list[i].account_id);
        }
 
 FINISH_OFF:
        if(account_count) {
-               em_storage_free_account(&account_list, account_count, NULL);
-       }
-
-       EM_DEBUG_FUNC_END("return[%d]", error_code);
-       return error_code;
-}
-
-EXPORT_API int em_core_add_notification_for_unread_mail_by_mail_header(int account_id, int mail_id, emf_mail_head_t *mail_header)
-{
-       EM_DEBUG_FUNC_BEGIN("mail_id[%d], mail_header[%p]", mail_id, mail_header);
-       EM_PROFILE_BEGIN(profile_em_core_add_notification_for_unread_mail);
-
-       int error_code = EMF_ERROR_NONE;
-       struct tm log_time_tm;
-       time_t log_time = 0;
-
-       if (mail_header == NULL) {
-               EM_DEBUG_EXCEPTION("mail_header is NULL");
-               error_code = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-
-       memset(&log_time_tm, 0, sizeof(struct tm));
-
-       log_time_tm.tm_sec  = mail_header->datetime.second;
-       log_time_tm.tm_min  = mail_header->datetime.minute;
-       log_time_tm.tm_hour = mail_header->datetime.hour;
-       log_time_tm.tm_mday = mail_header->datetime.day;
-       log_time_tm.tm_mon  = mail_header->datetime.month;
-       log_time_tm.tm_year = mail_header->datetime.year + 70;
-
-       EM_DEBUG_LOG("sec[%d], min[%d], hour[%d], day[%d], month[%d], year[%d]"
-                               , log_time_tm.tm_sec, log_time_tm.tm_min, log_time_tm.tm_hour, log_time_tm.tm_mday, log_time_tm.tm_mon, log_time_tm.tm_year);
-
-       log_time = mktime(&log_time_tm);
-               
-       EM_DEBUG_LOG("log_time[%d]", log_time);
-
-       if (!em_core_add_notification(account_id, mail_id, mail_header->from, mail_header->subject, log_time)) {
-               EM_DEBUG_EXCEPTION("Failed the em_core_fill_notification_set");
-               goto FINISH_OFF;
+               emstorage_free_account(&account_list, account_count, NULL);
        }
-FINISH_OFF:
 
-       EM_PROFILE_END(profile_em_core_add_notification_for_unread_mail);
        EM_DEBUG_FUNC_END("return[%d]", error_code);
        return error_code;
 }
 
-EXPORT_API int em_core_add_notification_for_unread_mail(emf_mail_data_t *input_mail_data)
+INTERNAL_FUNC int emcore_add_notification_for_unread_mail(emstorage_mail_tbl_t *input_mail_tbl_data)
 {
-       EM_DEBUG_FUNC_BEGIN("input_mail_data[%p]", input_mail_data);
+       EM_DEBUG_FUNC_BEGIN("input_mail_tbl_data[%p]", input_mail_tbl_data);
 
        int error_code = EMF_ERROR_NONE;
-       struct tm log_time_tm = { 0 };
-       time_t log_time = 0;
-       emf_datetime_t datetime_data = { 0 };
 
-       if (input_mail_data == NULL) {
-               EM_DEBUG_EXCEPTION("input_mail_data is NULL");
+       if (input_mail_tbl_data == NULL) {
+               EM_DEBUG_EXCEPTION("input_mail_tbl_data is NULL");
                error_code = EMF_ERROR_INVALID_PARAM;
                goto FINISH_OFF;
        }
 
-       if(!em_convert_string_to_datetime(input_mail_data->datetime, &datetime_data, &error_code)) {
-               EM_DEBUG_EXCEPTION("em_convert_string_to_datetime failed");
-               goto FINISH_OFF;
-       }
-
-       log_time_tm.tm_sec  = datetime_data.second;
-       log_time_tm.tm_min  = datetime_data.minute;
-       log_time_tm.tm_hour = datetime_data.hour;
-       log_time_tm.tm_mday = datetime_data.day;
-       log_time_tm.tm_mon  = datetime_data.month;
-       log_time_tm.tm_year = datetime_data.year + 70;
-
-       EM_DEBUG_LOG("sec[%d], min[%d], hour[%d], day[%d], month[%d], year[%d]"
-                               , log_time_tm.tm_sec, log_time_tm.tm_min, log_time_tm.tm_hour, log_time_tm.tm_mday, log_time_tm.tm_mon, log_time_tm.tm_year);
-
-       log_time = mktime(&log_time_tm);
-               
-       EM_DEBUG_LOG("log_time[%d]", log_time);
-
-       if (!em_core_add_notification(input_mail_data->account_id, input_mail_data->mail_id, input_mail_data->full_address_from, input_mail_data->subject, log_time)) {
-               EM_DEBUG_EXCEPTION("em_core_add_notification failed");
+       if (!emcore_add_notification(input_mail_tbl_data->account_id, input_mail_tbl_data->mail_id, input_mail_tbl_data->full_address_from, input_mail_tbl_data->subject, input_mail_tbl_data->date_time)) {
+               EM_DEBUG_EXCEPTION("emcore_add_notification failed");
                goto FINISH_OFF;
        }
 FINISH_OFF:
@@ -2422,20 +1869,36 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int em_core_delete_notification_for_read_mail(int mail_id)
+INTERNAL_FUNC int emcore_delete_notification_for_read_mail(int mail_id)
 {
        EM_DEBUG_FUNC_BEGIN();
        int error_code = EMF_ERROR_NONE;
+#ifdef __FEATURE_NOTIFICATION_FOR_NEW_MAIL__
+       notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
+
+       if ((noti_err = notification_delete_by_priv_id(NULL, NOTIFICATION_TYPE_NOTI, mail_id))  != NOTIFICATION_ERROR_NONE)     {
+               error_code = noti_err;
+               EM_DEBUG_EXCEPTION("notification_delete_by_priv_id failed [%d]", noti_err);
+       }
+#endif /* __FEATURE_NOTIFICATION_FOR_NEW_MAIL__ */
        EM_DEBUG_FUNC_END();
        return error_code;
 }
 
 #define EAS_EXECUTABLE_PATH "/usr/bin/eas-engine"
 
-EXPORT_API int em_core_delete_notification_by_account(int account_id)
+INTERNAL_FUNC int emcore_delete_notification_by_account(int account_id)
 {
        EM_DEBUG_FUNC_BEGIN("account_id [%d]", account_id);
        int error_code = EMF_ERROR_NONE;
+#ifdef __FEATURE_NOTIFICATION_FOR_NEW_MAIL__
+       notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
+
+       if ((noti_err = notification_delete_group_by_group_id(NATIVE_EMAIL_APPLICATION_PKG, NOTIFICATION_TYPE_NOTI, account_id)) != NOTIFICATION_ERROR_NONE) { 
+               error_code = noti_err;
+               EM_DEBUG_EXCEPTION("notification_delete_by_priv_id failed [%d]", noti_err);
+       }
+#endif /* __FEATURE_NOTIFICATION_FOR_NEW_MAIL__ */     
        EM_DEBUG_FUNC_END();
        return error_code;
 }
@@ -2443,7 +1906,7 @@ EXPORT_API int em_core_delete_notification_by_account(int account_id)
 #ifdef __FEATURE_BULK_DELETE_MOVE_UPDATE_REQUEST_OPTI__
 
 /**
- * @fn em_core_convert_to_uid_range_set(emf_id_set_t* id_set, int id_set_count, emf_uid_range_set **uid_range_set, int range_len, int *err_code)
+ * @fn emcore_convert_to_uid_range_set(emf_id_set_t* id_set, int id_set_count, emf_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
@@ -2457,16 +1920,16 @@ EXPORT_API int em_core_delete_notification_by_account(int account_id)
  * @return This function returns true on success or false on failure.
  */
  
-EXPORT_API int em_core_convert_to_uid_range_set(emf_id_set_t *id_set, int id_set_count, emf_uid_range_set **uid_range_set, int range_len, int *err_code)
+INTERNAL_FUNC int emcore_convert_to_uid_range_set(emf_id_set_t *id_set, int id_set_count, emf_uid_range_set **uid_range_set, int range_len, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
 
        int ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
 
        if (NULL == id_set || id_set_count  <= 0 || NULL == uid_range_set) {
                EM_DEBUG_EXCEPTION(" Invalid Parameter id_set[%p] id_set_count[%d] uid_range_set[%p]", id_set, id_set_count, uid_range_set);
-               error = EM_STORAGE_ERROR_INVALID_PARAM;
+               error = EMF_ERROR_INVALID_PARAM;
                goto FINISH_OFF;
        }
 
@@ -2480,7 +1943,7 @@ EXPORT_API int em_core_convert_to_uid_range_set(emf_id_set_t *id_set, int id_set
 
        if (range_len < (max_subset_string_size + 1))           /* 1 for ending NULL character */ {
                EM_DEBUG_EXCEPTION(" Invalid Parameter range_len[%d]", range_len);
-               error = EM_STORAGE_ERROR_INVALID_PARAM;
+               error = EMF_ERROR_INVALID_PARAM;
                goto FINISH_OFF;
        }
        
@@ -2496,8 +1959,8 @@ EXPORT_API int em_core_convert_to_uid_range_set(emf_id_set_t *id_set, int id_set
                /* Check if only one server mail id was left in id_set */
                if (i >= id_set_count) {
                        /* No more server mail id left in id_set */
-                       if (false == em_core_append_subset_string_to_uid_range(subset_string, &current_node, uid_range_set, range_len, first_uid, last_uid)) {
-                               EM_DEBUG_EXCEPTION("em_core_append_subset_string_to_uid_range failed");
+                       if (false == emcore_append_subset_string_to_uid_range(subset_string, &current_node, uid_range_set, range_len, first_uid, last_uid)) {
+                               EM_DEBUG_EXCEPTION("emcore_append_subset_string_to_uid_range failed");
                                goto FINISH_OFF;
                        }
                        break;
@@ -2517,8 +1980,8 @@ EXPORT_API int em_core_convert_to_uid_range_set(emf_id_set_t *id_set, int id_set
                                        else    /* Form subset string by first_uid */
                                                SNPRINTF(subset_string, max_subset_string_size, "%lu", first_uid);
                                        
-                                       if (false == em_core_append_subset_string_to_uid_range(subset_string, &current_node, uid_range_set, range_len, first_uid, last_uid)) {
-                                               EM_DEBUG_EXCEPTION("em_core_append_subset_string_to_uid_range failed");
+                                       if (false == emcore_append_subset_string_to_uid_range(subset_string, &current_node, uid_range_set, range_len, first_uid, last_uid)) {
+                                               EM_DEBUG_EXCEPTION("emcore_append_subset_string_to_uid_range failed");
                                                goto FINISH_OFF;
                                        }
                                        /* To Start formation of new subset string break out of inner loop */
@@ -2537,8 +2000,8 @@ EXPORT_API int em_core_convert_to_uid_range_set(emf_id_set_t *id_set, int id_set
                                memset(subset_string, 0x00, max_subset_string_size);
                                SNPRINTF(subset_string, max_subset_string_size, "%lu:%lu", first_uid, last_uid);
                        
-                               if (false == em_core_append_subset_string_to_uid_range(subset_string, &current_node, uid_range_set, range_len, first_uid, last_uid)) {
-                                       EM_DEBUG_EXCEPTION("em_core_append_subset_string_to_uid_range failed");
+                               if (false == emcore_append_subset_string_to_uid_range(subset_string, &current_node, uid_range_set, range_len, first_uid, last_uid)) {
+                                       EM_DEBUG_EXCEPTION("emcore_append_subset_string_to_uid_range failed");
                                        goto FINISH_OFF;
                                }
                        }
@@ -2560,7 +2023,7 @@ FINISH_OFF:
 }  
 
 /**
- * @fn em_core_append_subset_string_to_uid_range(char *subset_string, emf_uid_range_set **uid_range_set, int range_len, unsigned long luid, unsigned long huid)
+ * @fn emcore_append_subset_string_to_uid_range(char *subset_string, emf_uid_range_set **uid_range_set, int range_len, unsigned long luid, unsigned long huid)
  * Appends the subset_string to uid range if the uid range has not exceeded maximum length(range_len), otherwise creates a new node in linked list of uid range set 
  * and stores the subset_string in its uid_range. Also sets the lowest and highest uids for the corresponsing uid_range
  * 
@@ -2575,23 +2038,23 @@ FINISH_OFF:
  * @return This function returns true on success or false on failure.
  */
  
-int em_core_append_subset_string_to_uid_range(char *subset_string, emf_uid_range_set **current_node_adr, emf_uid_range_set **uid_range_set, int range_len, unsigned long luid, unsigned long huid)
+int emcore_append_subset_string_to_uid_range(char *subset_string, emf_uid_range_set **current_node_adr, emf_uid_range_set **uid_range_set, int range_len, unsigned long luid, unsigned long huid)
 {
        EM_DEBUG_FUNC_BEGIN();
        emf_uid_range_set *current_node = NULL;
 
        if (NULL == (*uid_range_set)) {
                /*This happens only once when list  creation starts. Head Node is allocated */
-               current_node = (emf_uid_range_set *)em_core_malloc(sizeof(emf_uid_range_set));
+               current_node = (emf_uid_range_set *)em_malloc(sizeof(emf_uid_range_set));
                if (NULL == current_node) {
-                       EM_DEBUG_EXCEPTION("em_core_malloc failed");
+                       EM_DEBUG_EXCEPTION("em_malloc failed");
                        return false;
                }       
 
-               current_node->uid_range = (char *)em_core_malloc(range_len);
+               current_node->uid_range = (char *)em_malloc(range_len);
                        
                if (NULL == current_node->uid_range) {
-                       EM_DEBUG_EXCEPTION("em_core_malloc failed");
+                       EM_DEBUG_EXCEPTION("em_malloc failed");
                        EM_SAFE_FREE(current_node);
                        return false;
                }
@@ -2620,19 +2083,19 @@ int em_core_append_subset_string_to_uid_range(char *subset_string, emf_uid_range
                        /* Allocate new node in Uid Range set */
                        emf_uid_range_set *new_node = NULL;
 
-                       new_node = (emf_uid_range_set *)em_core_malloc(sizeof(emf_uid_range_set));
+                       new_node = (emf_uid_range_set *)em_malloc(sizeof(emf_uid_range_set));
 
                        if (NULL == new_node) {
-                               EM_DEBUG_EXCEPTION("em_core_malloc failed");
+                               EM_DEBUG_EXCEPTION("em_malloc failed");
                                return false;
                        }
 
                        /* Allocate uid_range of new node */
                
-                       new_node->uid_range =  (char *)em_core_malloc(range_len);
+                       new_node->uid_range =  (char *)em_malloc(range_len);
 
                        if (NULL == new_node->uid_range) {
-                               EM_DEBUG_EXCEPTION("em_core_malloc failed");
+                               EM_DEBUG_EXCEPTION("em_malloc failed");
                                EM_SAFE_FREE(new_node);
                                return false;
                        }
@@ -2652,7 +2115,7 @@ int em_core_append_subset_string_to_uid_range(char *subset_string, emf_uid_range
 }
 
 /**
- * void em_core_free_uid_range_set(emf_uid_range_set **uid_range_head)
+ * void emcore_free_uid_range_set(emf_uid_range_set **uid_range_head)
  * Frees the linked list of uid ranges 
  *
  * @author                                     h.gahlaut@samsung.com
@@ -2661,8 +2124,8 @@ int em_core_append_subset_string_to_uid_range(char *subset_string, emf_uid_range
  * @return This function does not return anything.
  */
  
-EXPORT_API
-void em_core_free_uid_range_set(emf_uid_range_set **uid_range_set)
+INTERNAL_FUNC
+void emcore_free_uid_range_set(emf_uid_range_set **uid_range_set)
 {
        EM_DEBUG_FUNC_BEGIN();
 
@@ -2686,7 +2149,7 @@ void em_core_free_uid_range_set(emf_uid_range_set **uid_range_set)
 
 
 /**
- * @fn em_core_form_comma_separated_strings(int numbers[], int num_count, int max_string_len, char *** strings, int *string_count, int *err_code)
+ * @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
@@ -2703,11 +2166,11 @@ void em_core_free_uid_range_set(emf_uid_range_set **uid_range_set)
  * @return This function returns true on success or false on failure.
  */
 
-EXPORT_API int em_core_form_comma_separated_strings(int numbers[], int num_count, int max_string_len, char *** strings, int *string_count, int *err_code)
+INTERNAL_FUNC int emcore_form_comma_separated_strings(int numbers[], int num_count, int max_string_len, char *** strings, int *string_count, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
 
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        int ret = false;
 
        char **string_list = NULL;
@@ -2723,23 +2186,23 @@ EXPORT_API int em_core_form_comma_separated_strings(int numbers[], int num_count
                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);
-               error = EM_STORAGE_ERROR_INVALID_PARAM;
+               error = EMF_ERROR_INVALID_PARAM;
                goto FINISH_OFF;
        }
 
        EM_DEBUG_LOG("num_count [%d] max_string_len [%d]", num_count, max_string_len);
 
-       string_list = em_core_malloc(sizeof(char *));
+       string_list = em_malloc(sizeof(char *));
 
        if (NULL == string_list) {
-               EM_DEBUG_EXCEPTION("em_core_malloc failed ");
+               EM_DEBUG_EXCEPTION("em_malloc failed ");
                goto FINISH_OFF;
        }
        
-       string_list[num_of_strings] = em_core_malloc(max_string_len);
+       string_list[num_of_strings] = em_malloc(max_string_len);
        
        if (NULL == string_list[num_of_strings]) {
-               EM_DEBUG_EXCEPTION("em_core_malloc failed ");
+               EM_DEBUG_EXCEPTION("em_malloc failed ");
                goto FINISH_OFF;
        }
        
@@ -2773,10 +2236,10 @@ EXPORT_API int em_core_form_comma_separated_strings(int numbers[], int num_count
 
                        string_list = temp;
                        temp = NULL;
-                       string_list[num_of_strings] = em_core_malloc(max_string_len);/*  Allocate new buffer to store the string */
+                       string_list[num_of_strings] = em_malloc(max_string_len);/*  Allocate new buffer to store the string */
 
                        if (NULL == string_list[num_of_strings]) {
-                               EM_DEBUG_EXCEPTION(" em_core_malloc failed ");
+                               EM_DEBUG_EXCEPTION(" em_malloc failed ");
                                goto FINISH_OFF;
                        }
                        ++num_of_strings;
@@ -2792,7 +2255,7 @@ EXPORT_API int em_core_form_comma_separated_strings(int numbers[], int num_count
 FINISH_OFF:
 
        if (false == ret)
-               em_core_free_comma_separated_strings(&string_list, &num_of_strings);
+               emcore_free_comma_separated_strings(&string_list, &num_of_strings);
 
        if (true == ret) {
                for (i = 0; i < num_of_strings;++i)
@@ -2809,7 +2272,7 @@ FINISH_OFF:
        return ret;
 }
 /**
- * @fn em_core_free_comma_separated_strings(char *** string_list, int *string_count)
+ * @fn emcore_free_comma_separated_strings(char *** string_list, int *string_count)
  * Frees the double dimensional array of strings. 
  *
  * @author                                     h.gahlaut@samsung.com
@@ -2818,7 +2281,7 @@ FINISH_OFF:
  * @remarks                                                                    
  * @return This function does not return anything.
  */
-EXPORT_API void em_core_free_comma_separated_strings(char *** string_list, int *string_count)
+INTERNAL_FUNC void emcore_free_comma_separated_strings(char *** string_list, int *string_count)
 {
        EM_DEBUG_FUNC_BEGIN();
        int i = 0;
@@ -2845,62 +2308,9 @@ EXPORT_API void em_core_free_comma_separated_strings(char *** string_list, int *
 #endif
 
 
-#include <sys/mman.h>
-
-/* #define GETSP()                             ({ unsigned int sp; asm volatile ("mov %0, sp " : "=r"(sp)); sp;}) */
-#define BUF_SIZE                               256
-#define PAGE_SIZE                      (1 << 12)
-#define _ALIGN_UP(addr, size)  (((addr)+((size)-1))&(~((size)-1)))
-#define _ALIGN_DOWN(addr, size)  ((addr)&(~((size)-1)))
-#define PAGE_ALIGN(addr)               _ALIGN_DOWN(addr, PAGE_SIZE)
-
-int stack_trim(void)
-{
-       /*
-       char buf[BUF_SIZE];
-       FILE *file;
-       unsigned int stacktop;
-       int found = 0;
-       unsigned int sp; 
-
-       asm volatile ("mov %0, sp " : "=r"(sp));
-
-       sprintf(buf, "/proc/%d/maps", getpid());
-       file = fopen(buf, "r");
-       while (fgets(buf, BUF_SIZE, file) != NULL) {
-               if (strstr(buf, "[stack]")) {
-                       found = 1;
-                       break;
-               }
-       }
-       
-       fclose(file);
-
-       if (found) {
-               sscanf(buf, "%x-", &stacktop);
-               if (madvise((void *)PAGE_ALIGN(stacktop), PAGE_ALIGN(sp)-stacktop, MADV_DONTNEED) < 0)
-                       perror("stack madvise fail");
-       }
-       */
-       return 1;
-}
-
-
-EXPORT_API void em_core_flush_memory()
-{
-       EM_DEBUG_FUNC_BEGIN();
-       /*  flush memory in heap */
-       malloc_trim(0);
 
-       /*  flush memory in stack */
-       stack_trim();
 
-       /*  flush memory for sqlite */
-       em_storage_flush_db_cache();
-       EM_DEBUG_FUNC_END();
-}
-
-EXPORT_API int em_core_make_attachment_file_name_with_extension(char *source_file_name, char *sub_type, char *result_file_name, int result_file_name_buffer_length, int *err_code)
+int emcore_make_attachment_file_name_with_extension(char *source_file_name, char *sub_type, char *result_file_name, int result_file_name_buffer_length, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("source_file_name[%s], sub_type[%s], result_file_name_buffer_length[%d] ", source_file_name, sub_type, result_file_name_buffer_length);
        int ret = false, err = EMF_ERROR_NONE;
@@ -2940,154 +2350,17 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API char *em_core_get_extension_from_file_path(char *source_file_path, int *err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("source_file_path[%s]", source_file_path);
-       int err = EMF_ERROR_NONE, pos_on_string = 0;
-       char *extension = NULL;
 
-       if (!source_file_path) {
-               EM_DEBUG_EXCEPTION("Invalid Parameter");
-               err  = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-       
-       pos_on_string = strlen(source_file_path) - 1;   
 
-       while(pos_on_string > 0 && source_file_path[pos_on_string--] != '.') ;
 
-       if(pos_on_string > 0)
-               extension = source_file_path + pos_on_string + 2;
-       
-       EM_DEBUG_LOG("*extension [%s] pos_on_string [%d]", extension, pos_on_string);
 
-FINISH_OFF:
-       if (err_code)
-               *err_code = err;
-       EM_DEBUG_FUNC_END();
-       return extension;
-}
 
-EXPORT_API int em_core_get_encoding_type_from_file_path(const char *input_file_path, char **output_encoding_type)
-{
-       EM_DEBUG_FUNC_BEGIN("input_file_path[%d], output_encoding_type[%p]", input_file_path, output_encoding_type);
-       int   err = EMF_ERROR_NONE;
-       int   pos_of_filename = 0;
-       int   pos_of_dot = 0;
-       int   enf_of_string = 0;
-       int   result_string_length = 0;
-       char *filename = NULL;
-       char *result_encoding_type = NULL;
-
-       if (!input_file_path || !output_encoding_type) {
-               EM_DEBUG_EXCEPTION("Invalid Parameter");
-               err  = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-       
-       enf_of_string = pos_of_filename = strlen(input_file_path) - 1;  
-
-       while(pos_of_filename >= 0 && input_file_path[pos_of_filename--] != '/') {
-               if(input_file_path[pos_of_filename] == '.')
-                       pos_of_dot = pos_of_filename;
-       }
-
-       if(pos_of_filename != 0) 
-               pos_of_filename += 2;
-
-       filename = (char*)input_file_path + pos_of_filename;
-
-       if(pos_of_dot != 0 && pos_of_dot > pos_of_filename) 
-               result_string_length = pos_of_dot - pos_of_filename;
-       else
-               result_string_length = enf_of_string - pos_of_filename;
-               
-       EM_DEBUG_LOG("pos_of_dot [%d], pos_of_filename [%d], enf_of_string[%d],result_string_length [%d]", pos_of_dot, pos_of_filename, enf_of_string, result_string_length);
-
-       if( !(result_encoding_type =    em_core_malloc(sizeof(char) * (result_string_length + 1))) ) {
-               EM_DEBUG_EXCEPTION("EMF_ERROR_OUT_OF_MEMORY");
-               err  = EMF_ERROR_OUT_OF_MEMORY;
-               goto FINISH_OFF;
-       }
 
-       memcpy(result_encoding_type, input_file_path + pos_of_filename, result_string_length);
-       
-       EM_DEBUG_LOG("*result_encoding_type [%s]", result_encoding_type);
 
-       *output_encoding_type = result_encoding_type;
-
-FINISH_OFF:
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-}
 
 
-EXPORT_API int em_core_get_content_type(const char *extension_string, int *err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("extension_string[%s]", extension_string);
-       int i = 0, err = EMF_ERROR_NONE, result_content_type = TYPEAPPLICATION;
-       char *image_extension[] = { "jpeg", "jpg", "png", "gif", "bmp", "pic", "agif", "tif", "wbmp" , NULL};
-
-       if (!extension_string) {
-               EM_DEBUG_EXCEPTION("Invalid Parameter");
-               err  = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-       
-       while(image_extension[i]) {
-               EM_DEBUG_LOG("image_extension[%d] [%s]", i, image_extension[i]);
-               if(strcasecmp(image_extension[i], extension_string) == 0) {
-                       result_content_type = TYPEIMAGE;
-                       break;
-               }
-               i++;
-       }
-
-FINISH_OFF:
-       if (err_code)
-               *err_code = err;
-       EM_DEBUG_FUNC_END();
-       return result_content_type;
-}
-
-#define DATE_TIME_STRING_LEGNTH 14
-
-EXPORT_API char* em_core_get_current_time_string(int *err)
-{
-       EM_DEBUG_FUNC_BEGIN("err [%p]", err);
-       
-       int err_code = EMF_ERROR_NONE;
-       time_t t = time(NULL);
-       struct tm *p_tm = NULL; 
-       char *result_date_time = NULL;  
-       
-       p_tm = gmtime(&t);
-
-       if (!p_tm)  {
-               EM_DEBUG_EXCEPTION("localtime failed...");
-               err_code = EMF_ERROR_SYSTEM_FAILURE;
-               goto FINISH_OFF;
-       }
-
-       result_date_time = em_core_malloc(DATE_TIME_STRING_LEGNTH + 1);
-
-       SNPRINTF(result_date_time, DATE_TIME_STRING_LEGNTH + 1, "%04d%02d%02d%02d%02d%02d",
-               p_tm->tm_year + 1900, p_tm->tm_mon + 1, p_tm->tm_mday, 
-               p_tm->tm_hour, p_tm->tm_min, p_tm->tm_sec);
-
-       EM_DEBUG_LOG("result_date_time [%s]", result_date_time);
-FINISH_OFF:
-
-       if(err)
-               *err = err_code;
-
-       EM_DEBUG_FUNC_END();
-       return result_date_time;
-}
-
-
-#ifdef __LOCAL_ACTIVITY__
-EXPORT_API int em_core_activity_add(emf_activity_tbl_t *new_activity, int *err_code)
+#ifdef __FEATURE_LOCAL_ACTIVITY__
+INTERNAL_FUNC int emcore_add_activity(emstorage_activity_tbl_t *new_activity, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
        
@@ -3102,8 +2375,8 @@ EXPORT_API int em_core_activity_add(emf_activity_tbl_t *new_activity, int *err_c
                err = EMF_ERROR_INVALID_PARAM;
                goto FINISH_OFF;
        }
-       if (!em_storage_add_activity(new_activity, false, &err)) {
-               EM_DEBUG_LOG("\t em_storage_add_activity falied - %d\n", err);
+       if (!emstorage_add_activity(new_activity, false, &err)) {
+               EM_DEBUG_LOG("\t emstorage_add_activity falied - %d\n", err);
                
                goto FINISH_OFF;
        }
@@ -3116,7 +2389,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_core_activity_delete(emf_activity_tbl_t *activity, int *err_code)
+INTERNAL_FUNC int emcore_delete_activity(emstorage_activity_tbl_t *activity, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
        
@@ -3131,8 +2404,8 @@ EXPORT_API int em_core_activity_delete(emf_activity_tbl_t *activity, int *err_co
                err = EMF_ERROR_INVALID_PARAM;
                goto FINISH_OFF;
        }
-       if (!em_storage_delete_local_activity(activity, true, &err)) {
-               EM_DEBUG_LOG("\t em_storage_delete_local_activity falied - %d\n", err);
+       if (!emstorage_delete_local_activity(activity, true, &err)) {
+               EM_DEBUG_LOG("\t emstorage_delete_local_activity falied - %d\n", err);
                
                goto FINISH_OFF;
        }
@@ -3145,7 +2418,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_core_get_next_activity_id(int *activity_id, int *err_code)
+INTERNAL_FUNC int emcore_get_next_activity_id(int *activity_id, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
        
@@ -3156,12 +2429,12 @@ EXPORT_API int em_core_get_next_activity_id(int *activity_id, int *err_code)
        {
                EM_DEBUG_EXCEPTION("\t activity_id[%p]", activity_id);
                
-               err = EM_STORAGE_ERROR_INVALID_PARAM;
+               err = EMF_ERROR_INVALID_PARAM;
                goto FINISH_OFF;
        }
        
-       if (false == em_storage_get_next_activity_id(activity_id, &err)) {
-               EM_DEBUG_LOG("\t em_storage_get_next_activity_id failed - %d\n", err);
+       if (false == emstorage_get_next_activity_id(activity_id, &err)) {
+               EM_DEBUG_LOG("\t emstorage_get_next_activity_id failed - %d\n", err);
                goto FINISH_OFF;
        }
        
@@ -3176,7 +2449,7 @@ EXPORT_API int em_core_get_next_activity_id(int *activity_id, int *err_code)
 
 }
 
-#endif /* __LOCAL_ACTIVITY__ */
+#endif /* __FEATURE_LOCAL_ACTIVITY__ */
 
 
 
similarity index 62%
rename from email-engine/emf-emn-noti.c
rename to email-core/email-device/email-device.c
index 4ef4d4e..6a6ebbd 100755 (executable)
 */
 
 
-
-#include <vconf.h>
+#include <stdio.h>
 #include <string.h>
-#include "emflib.h"
-#include "emf-emn-noti.h"
-#include "emf-emn.h"
-#include "emf-dbglog.h"
-#include <glib.h>
+#include <stdlib.h>
+#include <time.h>
+#include <sys/types.h>
 
-int emf_emn_noti_init(void)
-{
-       EM_DEBUG_FUNC_BEGIN();
+#include "email-device.h"
+#include "email-debug-log.h"
 
-       EM_DEBUG_LOG("SUBSCRIE for User.Push.Email SUCCESSS >>> \n");
 
-       return 0;
-}
 
-int emf_emn_noti_quit(gboolean bExtDest)
+INTERNAL_FUNC int emdevice_set_sleep_on_off(int on, int *error_code)
 {
-       EM_DEBUG_FUNC_BEGIN();
-       return 0;
+       EM_DEBUG_FUNC_BEGIN("on[%d], err_code[%p]", on, error_code);
+       EM_DEBUG_FUNC_END();
+       return true;
 }
 
-/* EOF */
+INTERNAL_FUNC int emdevice_set_dimming_on_off(int on, int *error_code)
+{
+       EM_DEBUG_FUNC_BEGIN("on[%d], err_code[%p]", on, error_code);
+       EM_DEBUG_FUNC_END();
+       return true;
+}
diff --git a/email-core/email-device/include/email-device.h b/email-core/email-device/include/email-device.h
new file mode 100755 (executable)
index 0000000..3e9a004
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+*  email-service
+*
+* Copyright (c) 2000 - 2011 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.
+*
+*/
+
+
+/******************************************************************************
+ * File :  email-device.h
+ * Desc :  email-core Device Library Header
+ *
+ * Auth : 
+ *
+ * History : 
+ *    2012.02.20  :  created
+ *****************************************************************************/
+#ifndef __EMAIL_DEVICE_H__
+#define __EMAIL_DEVICE_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+#include "email-internal-types.h"
+
+INTERNAL_FUNC int emdevice_set_sleep_on_off(int on, int *error_code);
+INTERNAL_FUNC int emdevice_set_dimming_on_off(int on, int *error_code);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __EMAIL_DEVICE_H__ */
similarity index 84%
rename from email-core/em-network/em-network.c
rename to email-core/email-network/email-network.c
index f967064..dc07731 100755 (executable)
@@ -22,7 +22,7 @@
 
 
 /******************************************************************************
- * File: em-network.c
+ * File: email-network.c
  * Desc: Data network interface
  *
  * Auth:
 #include <string.h>
 #include <unistd.h>
 #include <errno.h>
-#include <em-storage.h> 
+#include <email-storage.h> 
 #include <vconf.h>
 #include "glib.h"
 
 #include "lnx_inc.h"
 #include "utf8aux.h"
 #include "c-client.h"
-#include "emflib.h"
-#include "emf-dbglog.h"
-#include "emf-types.h"
-#include "em-core-utils.h" 
-#include "em-core-mailbox.h"
+#include "email-debug-log.h"
+#include "email-types.h"
+#include "email-core-utils.h" 
+#include "email-core-mailbox.h"
 
 #ifdef __FEATURE_PARTIAL_BODY_DOWNLOAD__
-#include "em-core-event.h"
+#include "email-core-event.h"
 #endif
 
-/* em_core_get_network_status - Get the data network status from vconf */
-static int em_core_get_network_status(int *network_status)
+/* _get_network_status - Get the data network status from vconf */
+static int _get_network_status(int *network_status)
 {
        EM_DEBUG_FUNC_BEGIN("network_status [%p]", network_status);
 
@@ -82,7 +81,7 @@ static int em_core_get_network_status(int *network_status)
 }
 
 /* Check code for SIM status */
-static int  em_core_get_sim_status(int *sim_status)
+static int  _get_sim_status(int *sim_status)
 {
        EM_DEBUG_FUNC_BEGIN();
        int value;
@@ -103,7 +102,7 @@ static int  em_core_get_sim_status(int *sim_status)
        return EMF_ERROR_NONE;
 }
 
-static int em_core_get_wifi_status(int *wifi_status)
+static int _get_wifi_status(int *wifi_status)
 {
        EM_DEBUG_FUNC_BEGIN();
 
@@ -126,7 +125,7 @@ static int em_core_get_wifi_status(int *wifi_status)
 }
 
 
-EXPORT_API int em_core_check_network_status(int *err_code)
+INTERNAL_FUNC int emnetwork_check_network_status(int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
        int network_status = 0;
@@ -135,21 +134,21 @@ EXPORT_API int em_core_check_network_status(int *err_code)
        int err            = EMF_ERROR_NONE;
        int ret            = false;
 
-       if ( (err = em_core_get_network_status(&network_status)) != EMF_ERROR_NONE) {
-               EM_DEBUG_EXCEPTION("em_core_get_network_status failed [%d]", err);
+       if ( (err = _get_network_status(&network_status)) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("_get_network_status failed [%d]", err);
                goto FINISH_OFF;
        }
 
        if(network_status == 0) {
-               if ( (err = em_core_get_sim_status(&sim_status)) != EMF_ERROR_NONE) {
-                       EM_DEBUG_EXCEPTION("em_core_get_sim_status failed [%d]", err);
+               if ( (err = _get_sim_status(&sim_status)) != EMF_ERROR_NONE) {
+                       EM_DEBUG_EXCEPTION("_get_sim_status failed [%d]", err);
                        goto FINISH_OFF;
                }
 
                if (sim_status != VCONFKEY_TELEPHONY_SIM_INSERTED) {
                        EM_DEBUG_LOG("EMF_ERROR_NO_SIM_INSERTED");
-                       if ( (err = em_core_get_wifi_status(&wifi_status)) != EMF_ERROR_NONE) {
-                               EM_DEBUG_EXCEPTION("em_core_get_wifi_status failed [%d]", err);
+                       if ( (err = _get_wifi_status(&wifi_status)) != EMF_ERROR_NONE) {
+                               EM_DEBUG_EXCEPTION("_get_wifi_status failed [%d]", err);
                                goto FINISH_OFF;
                        }
 
@@ -169,7 +168,7 @@ EXPORT_API int em_core_check_network_status(int *err_code)
 
 FINISH_OFF: 
 
-       em_core_set_network_error(err);
+       emcore_set_network_error(err);
 
        if (err_code)
                *err_code = err;
@@ -179,7 +178,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API long em_core_ssl_cert_query_cb(char *reason, char *host, char *cert)
+INTERNAL_FUNC long emnetwork_callback_ssl_cert_query(char *reason, char *host, char *cert)
 {
        EM_DEBUG_FUNC_BEGIN("reason[%s], host[%s], cert[%s]", reason, host, cert);
        int ret = 1;
@@ -199,7 +198,7 @@ int _g_canceled = 0;
 /*  sockid_in  = ((TCPSTREAM*)send_stream->netstream->stream)->tcpsi; */
 /*  sockid_out = ((TCPSTREAM*)send_stream->netstream->stream)->tcpso; */
 
-EXPORT_API long tcp_getbuffer_lnx(TCPSTREAM *stream, unsigned long size, char *s)
+INTERNAL_FUNC long tcp_getbuffer_lnx(TCPSTREAM *stream, unsigned long size, char *s)
 {
        struct timeval tmout;
        fd_set readfds;
@@ -238,7 +237,7 @@ EXPORT_API long tcp_getbuffer_lnx(TCPSTREAM *stream, unsigned long size, char *s
 
        while (nleave > 0) {
 #ifdef TEST_CANCEL_JOB
-               if (!em_core_check_thread_status()) {
+               if (!emcore_check_thread_status()) {
                        EM_DEBUG_EXCEPTION("thread canceled");
                        tcp_abort(stream);
                        goto JOB_CANCEL;
@@ -264,7 +263,7 @@ EXPORT_API long tcp_getbuffer_lnx(TCPSTREAM *stream, unsigned long size, char *s
                else if (!sret) {
                        if (max_timeout >= 5) {
                                EM_DEBUG_EXCEPTION("max select timeout %d", max_timeout);
-                               em_core_set_network_error(EMF_ERROR_NO_RESPONSE);
+                               emcore_set_network_error(EMF_ERROR_NO_RESPONSE);
                                return 0;
                        }
                        EM_DEBUG_EXCEPTION("%d select timeout", max_timeout);
@@ -321,7 +320,7 @@ long tcp_getdata_lnx(TCPSTREAM *stream)
        
        while (stream->ictr < 1)  {
 #ifdef TEST_CANCEL_JOB
-               if (!em_core_check_thread_status())  {
+               if (!emcore_check_thread_status())  {
                        EM_DEBUG_EXCEPTION("thread canceled...");
                        tcp_abort(stream);
                        goto JOB_CANCEL;
@@ -352,7 +351,7 @@ long tcp_getdata_lnx(TCPSTREAM *stream)
                        if (max_timeout >= 50) {
                                EM_DEBUG_EXCEPTION("max select timeout %d", max_timeout);
                                
-                               em_core_set_network_error(EMF_ERROR_NO_RESPONSE);
+                               emcore_set_network_error(EMF_ERROR_NO_RESPONSE);
                                return false;
                        }
                        
@@ -365,7 +364,7 @@ long tcp_getdata_lnx(TCPSTREAM *stream)
                if ((nread = read(sockid, stream->ibuf, BUFLEN)) < 0) {
                        EM_DEBUG_EXCEPTION("socket read failed...");
                        
-                       em_core_set_network_error(EMF_ERROR_SOCKET_FAILURE);
+                       emcore_set_network_error(EMF_ERROR_SOCKET_FAILURE);
                        
                        /* if (errno == EINTR) contine; */
                        tcp_abort(stream);
@@ -375,7 +374,7 @@ long tcp_getdata_lnx(TCPSTREAM *stream)
                if (!nread) {
                        EM_DEBUG_EXCEPTION("socket read no data...");
                        
-                       em_core_set_network_error(EMF_ERROR_INVALID_RESPONSE);
+                       emcore_set_network_error(EMF_ERROR_INVALID_RESPONSE);
                        
                        tcp_abort(stream);
                        return false;
@@ -401,7 +400,7 @@ JOB_CANCEL:
 #endif
 }
 
-EXPORT_API long tcp_sout_lnx(TCPSTREAM *stream, char *string, unsigned long size)
+INTERNAL_FUNC long tcp_sout_lnx(TCPSTREAM *stream, char *string, unsigned long size)
 {
        struct timeval tmout;
        fd_set writefds;
@@ -415,7 +414,7 @@ EXPORT_API long tcp_sout_lnx(TCPSTREAM *stream, char *string, unsigned long size
 
        while (size > 0) {
 #ifdef TEST_CANCEL_JOB
-               if (!em_core_check_thread_status()) {
+               if (!emcore_check_thread_status()) {
                        EM_DEBUG_EXCEPTION("thread canceled");
                        tcp_abort(stream);
                        goto JOB_CANCEL;
@@ -441,7 +440,7 @@ EXPORT_API long tcp_sout_lnx(TCPSTREAM *stream, char *string, unsigned long size
                else if (!sret) {
                        if (max_timeout >= 50) {
                                EM_DEBUG_EXCEPTION("max select timeout %d", max_timeout);
-                               em_core_set_network_error(EMF_ERROR_NO_RESPONSE);
+                               emcore_set_network_error(EMF_ERROR_NO_RESPONSE);
                                return 0;
                        }
                        EM_DEBUG_EXCEPTION("%d select timeout", max_timeout);
@@ -480,7 +479,7 @@ JOB_CANCEL:
 #endif
 }
 
-EXPORT_API long tcp_soutr_lnx(TCPSTREAM *stream, char *string)
+INTERNAL_FUNC long tcp_soutr_lnx(TCPSTREAM *stream, char *string)
 {
        return tcp_sout_lnx(stream, string, strlen(string));
 }
similarity index 79%
rename from email-core/em-network/include/em-network.h
rename to email-core/email-network/include/email-network.h
index abdbe03..976be52 100755 (executable)
@@ -20,7 +20,7 @@
 */
 
 /******************************************************************************
- * File :  em-network.h
+ * File :  email-network.h
  * Desc :  
  *
  * Auth : 
  * History : 
  *    2011.12.16  :  created
  *****************************************************************************/
-#ifndef __EM_NETWORK_H__
-#define __EM_NETWORK_H__
+#ifndef __EMAIL_NETWORK_H__
+#define __EMAIL_NETWORK_H__
 
 #ifdef __cplusplus
 extern "C"
 {
 #endif /* __cplusplus */
 
-#include "emf-types.h"
+#include "email-internal-types.h"
 
-EXPORT_API long em_core_ssl_cert_query_cb(char *reason, char *host, char *cert);
-EXPORT_API int em_core_check_network_status(int *err_code);
+INTERNAL_FUNC long emnetwork_callback_ssl_cert_query(char *reason, char *host, char *cert);
+INTERNAL_FUNC int  emnetwork_check_network_status(int *err_code);
 
 #ifdef __cplusplus
 }
similarity index 56%
rename from email-core/em-storage/em-storage.c
rename to email-core/email-storage/email-storage.c
index 39bb296..89b4072 100755 (executable)
@@ -21,8 +21,8 @@
 
 
 /******************************************************************************
- * File: em_storage.c
- * Desc: EMail Framework Storage Library on Sqlite3
+ * File: email-storage.c
+ * Desc: email-service Storage Library on Sqlite3
  *
  * Auth:
  *
@@ -33,6 +33,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
+#include <stdbool.h>
 #include <time.h>
 #include <sys/types.h>
 #include <sys/time.h> 
 #include <fcntl.h>
 #include <dbus/dbus.h> 
 #include <db-util.h>
-#include "em-core-utils.h"
+
+#define __USE_UNIX98
+#define __USE_GNU
 #include <pthread.h>
-#include "em-storage.h"
-#include "emf-dbglog.h"
-#include "emf-types.h"
+
+#include "email-internal-types.h"
+#include "email-convert.h"
+#include "email-core-utils.h"
+#include "email-utilities.h"
+#include "email-storage.h"
+#include "email-debug-log.h"
+#include "email-types.h"
+#include "email-convert.h"
 
 #define DB_STMT sqlite3_stmt *
 
 #define CONTENT_DATA                  "<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset="
 #define CONTENT_TYPE_DATA             "<meta http-equiv=\"Content-Type\" content=\"text/html; charset="
 
-#ifndef true
-#define true           1
-#define false          0
-#endif
-
 #define FLAG_SEEN       0x01
 #define FLAG_DELETED    0x02
 #define FLAG_FLAGGED    0x04
 #define ATTACHMENT_PATH_LEN_IN_MAIL_ATTACHMENT_TBL      256
 #define ATTACHMENT_NAME_LEN_IN_MAIL_ATTACHMENT_TBL      256
 #define CONTENT_ID_LEN_IN_MAIL_ATTACHMENT_TBL           256
+#define ATTACHMENT_MIME_TYPE_LEN_IN_MAIL_ATTACHMENT_TBL 128
 #define MAILBOX_LEN_IN_MAIL_TBL                         128
 #define SERVER_MAILBOX_LEN_IN_MAIL_TBL                  128
 #define SERVER_MAIL_ID_LEN_IN_MAIL_TBL                  128
 #define TO_EMAIL_ADDRESS_LEN_IN_MAIL_TBL                3999
 #define MAILBOX_LEN_IN_MAIL_MEETING_TBL                 128
 #define LOCATION_LEN_IN_MAIL_MEETING_TBL                1024
-#define GLOBAL_OBJECT_ID_LEN_IN_MAIL_MEETING_TBL        128
+#define GLOBAL_OBJECT_ID_LEN_IN_MAIL_MEETING_TBL        512
 #define STANDARD_NAME_LEN_IN_MAIL_MEETING_TBL           32
 #define DAYLIGHT_NAME_LEN_IN_MAIL_MEETING_TBL           32
 #define PREVIEWBODY_LEN_IN_MAIL_TBL                     512 
 
 /*  this define is used for query to change data (delete, insert, update) */
-#define EM_STORAGE_START_WRITE_TRANSACTION(transaction_flag, error_code) \
+#define EMSTORAGE_START_WRITE_TRANSACTION(transaction_flag, error_code) \
        if (transaction_flag)\
        {\
-               em_storage_shm_mutex_timedlock(&mapped_for_db_lock, 2);\
-               if (em_storage_begin_transaction(NULL, NULL, &error_code) == false) \
+               _timedlock_shm_mutex(&mapped_for_db_lock, 2);\
+               if (emstorage_begin_transaction(NULL, NULL, &error_code) == false) \
                {\
-                       EM_DEBUG_EXCEPTION("em_storage_begin_transaction() error[%d]", error_code);\
+                       EM_DEBUG_EXCEPTION("emstorage_begin_transaction() error[%d]", error_code);\
                        goto FINISH_OFF;\
                }\
        }
 
 /*  this define is used for query to change data (delete, insert, update) */
-#define EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction_flag, result_code, error_code) \
+#define EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction_flag, result_code, error_code) \
        if (transaction_flag)\
        {\
                if (result_code == true)\
                {\
-                       if (em_storage_commit_transaction(NULL, NULL, NULL) == false)\
+                       if (emstorage_commit_transaction(NULL, NULL, NULL) == false)\
                        {\
-                               error_code = EM_STORAGE_ERROR_DB_FAILURE;\
+                               error_code = EMF_ERROR_DB_FAILURE;\
                                result_code = false;\
                        }\
                }\
                else\
                {\
-                       if (em_storage_rollback_transaction(NULL, NULL, NULL) == false)\
-                               error_code = EM_STORAGE_ERROR_DB_FAILURE;\
+                       if (emstorage_rollback_transaction(NULL, NULL, NULL) == false)\
+                               error_code = EMF_ERROR_DB_FAILURE;\
                }\
-               em_storage_shm_mutex_unlock(&mapped_for_db_lock);\
+               _unlockshm_mutex(&mapped_for_db_lock);\
        }
 
 /*  this define is used for query to read (select) */
-#define EM_STORAGE_START_READ_TRANSACTION(transaction_flag) \
+#define EMSTORAGE_START_READ_TRANSACTION(transaction_flag) \
        if (transaction_flag)\
        {\
-               /*em_storage_shm_mutex_timedlock(&mapped_for_db_lock, 2);*/\
+               /*_timedlock_shm_mutex(&mapped_for_db_lock, 2);*/\
        }
 
 /*  this define is used for query to read (select) */
-#define EM_STORAGE_FINISH_READ_TRANSACTION(transaction_flag) \
+#define EMSTORAGE_FINISH_READ_TRANSACTION(transaction_flag) \
        if (transaction_flag)\
        {\
-               /*em_storage_shm_mutex_unlock(&mapped_for_db_lock);*/\
+               /*_unlockshm_mutex(&mapped_for_db_lock);*/\
        }
 
 /*  for safety DB operation */
 static char g_db_path[248] = {0x00, };
 
-
-#ifdef __FEATURE_USE_PTHREAD__
 static pthread_mutex_t _transactionBeginLock = PTHREAD_MUTEX_INITIALIZER;
 static pthread_mutex_t _transactionEndLock = PTHREAD_MUTEX_INITIALIZER;
 static pthread_mutex_t _dbus_noti_lock = PTHREAD_MUTEX_INITIALIZER;
 static pthread_mutex_t _db_handle_lock = PTHREAD_MUTEX_INITIALIZER;
-#else /*  __FEATURE_USE_PTHREAD__ */
-static GMutex *_transactionBeginLock = NULL;
-static GMutex *_transactionEndLock = NULL;
-static GMutex *_dbus_noti_lock = NULL;
-static GMutex *_db_handle_lock = NULL;
-#endif /*  __FEATURE_USE_PTHREAD__ */
 
 #define        _MULTIPLE_DB_HANDLE
 
@@ -201,11 +198,7 @@ static GMutex *_db_handle_lock = NULL;
 
 typedef struct
 {
-#ifdef __FEATURE_USE_PTHREAD__
        pthread_t       thread_id;
-#else
-       /*  TODO : must write codes for g_thread */
-#endif
        sqlite3 *db_handle;
 } db_handle_t;
 
@@ -214,7 +207,7 @@ typedef struct
 /* static int _db_handle_count = 0; */
 db_handle_t _db_handle_list[MAX_DB_CLIENT] = {{0, 0}, };
 
-sqlite3 *em_storage_get_db_handle()
+sqlite3 *emstorage_get_db_handle()
 {      
        EM_DEBUG_FUNC_BEGIN();
        int i;
@@ -222,10 +215,8 @@ sqlite3 *em_storage_get_db_handle()
        sqlite3 *result_db_handle = NULL;
 
        ENTER_CRITICAL_SECTION(_db_handle_lock);
-       for (i = 0; i < MAX_DB_CLIENT; i++)
-       {
-               if (pthread_equal(current_thread_id, _db_handle_list[i].thread_id))
-               {
+       for (i = 0; i < MAX_DB_CLIENT; i++) {
+               if (pthread_equal(current_thread_id, _db_handle_list[i].thread_id)) {
                        EM_DEBUG_LOG("found db handle at [%d]", i);
                        result_db_handle = _db_handle_list[i].db_handle;
                        break;
@@ -240,7 +231,7 @@ sqlite3 *em_storage_get_db_handle()
        return result_db_handle;
 }
 
-int em_storage_set_db_handle(sqlite3 *db_handle)
+int emstorage_set_db_handle(sqlite3 *db_handle)
 {      
        EM_DEBUG_FUNC_BEGIN();
        int i, error_code = EMF_ERROR_MAX_EXCEEDED;
@@ -265,7 +256,7 @@ int em_storage_set_db_handle(sqlite3 *db_handle)
        return error_code;
 }
 
-int em_storage_remove_db_handle()
+int emstorage_remove_db_handle()
 {      
        EM_DEBUG_FUNC_BEGIN();
        int i, error_code = EMF_ERROR_MAX_EXCEEDED;
@@ -291,7 +282,7 @@ int em_storage_remove_db_handle()
 }
 
 
-int em_storage_reset_db_handle_list()
+int emstorage_reset_db_handle_list()
 {      
        EM_DEBUG_FUNC_BEGIN();
        int i;
@@ -308,11 +299,11 @@ int em_storage_reset_db_handle_list()
        return EMF_ERROR_NONE;
 }
 
-sqlite3 *em_storage_get_db_connection()
+sqlite3 *emstorage_get_db_connection()
 {
-       sqlite3 *tmp_db_handle = em_storage_get_db_handle(); 
+       sqlite3 *tmp_db_handle = emstorage_get_db_handle(); 
        if (NULL == tmp_db_handle)
-               tmp_db_handle = em_storage_db_open(NULL); 
+               tmp_db_handle = emstorage_db_open(NULL); 
        return tmp_db_handle;
 }
 
@@ -322,10 +313,10 @@ sqlite3 *em_storage_get_db_connection()
 
 sqlite3 *_db_handle = NULL;
 
-sqlite3 *em_storage_get_db_connection()
+sqlite3 *emstorage_get_db_connection()
 {
        if (NULL == _db_handle)
-               em_storage_db_open(NULL); 
+               emstorage_db_open(NULL); 
        return _db_handle;
 }
 #endif /*  _MULTIPLE_DB_HANDLE */
@@ -347,20 +338,20 @@ int              shm_fd_for_generating_mail_id = 0;
 #endif /* __FEATURE_USE_SHARED_MUTEX_FOR_GENERATING_MAIL_ID__ */
 
 #ifdef __FEATURE_USE_SHARED_MUTEX_FOR_PROTECTED_FUNC_CALL__
-#define EM_STORAGE_PROTECTED_FUNC_CALL(function_call, return_value) \
-       {  em_storage_shm_mutex_timedlock(&mapped_for_db_lock, 2); return_value = function_call; em_storage_shm_mutex_unlock(&mapped_for_db_lock); }
+#define EMSTORAGE_PROTECTED_FUNC_CALL(function_call, return_value) \
+       {  _timedlock_shm_mutex(&mapped_for_db_lock, 2); return_value = function_call; _unlockshm_mutex(&mapped_for_db_lock); }
 #else /*  __FEATURE_USE_SHARED_MUTEX_FOR_PROTECTED_FUNC_CALL__ */
-#define EM_STORAGE_PROTECTED_FUNC_CALL(function_call, return_value) \
+#define EMSTORAGE_PROTECTED_FUNC_CALL(function_call, return_value) \
        {  return_value = function_call; }
 #endif /*  __FEATURE_USE_SHARED_MUTEX_FOR_PROTECTED_FUNC_CALL__ */
 
-EXPORT_API int em_storage_shm_file_init(const char *shm_file_name)
+INTERNAL_FUNC int emstorage_shm_file_init(const char *shm_file_name)
 {
        EM_DEBUG_FUNC_BEGIN("shm_file_name [%p]", shm_file_name);
 
        if(!shm_file_name) {
-               EM_DEBUG_EXCEPTION("EM_STORAGE_ERROR_INVALID_PARAM");
-               return EM_STORAGE_ERROR_INVALID_PARAM;
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
+               return EMF_ERROR_INVALID_PARAM;
        }
 
        int fd = shm_open(shm_file_name, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); /*  note: permission is not working */
@@ -370,13 +361,13 @@ EXPORT_API int em_storage_shm_file_init(const char *shm_file_name)
                EM_DEBUG_LOG("** Create SHM FILE **"); 
                if (ftruncate(fd, sizeof(mmapped_t)) != 0) {
                        EM_DEBUG_EXCEPTION("ftruncate failed: %s", strerror(errno));
-                       return EM_STORAGE_ERROR_SYSTEM_FAILURE;
+                       return EMF_ERROR_SYSTEM_FAILURE;
                }
                
                mmapped_t *m = (mmapped_t *)mmap(NULL, sizeof(mmapped_t), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
                if (m == MAP_FAILED) {
                        EM_DEBUG_EXCEPTION("mmap failed: %s", strerror(errno));
-                       return EM_STORAGE_ERROR_SYSTEM_FAILURE;
+                       return EMF_ERROR_SYSTEM_FAILURE;
                }
 
                m->data = 0;
@@ -390,34 +381,34 @@ EXPORT_API int em_storage_shm_file_init(const char *shm_file_name)
        }
        else {
                EM_DEBUG_EXCEPTION("shm_open failed: %s", strerror(errno));
-               return EM_STORAGE_ERROR_SYSTEM_FAILURE;
+               return EMF_ERROR_SYSTEM_FAILURE;
        }
        close(fd);
        EM_DEBUG_FUNC_END();
-       return EM_STORAGE_ERROR_NONE;
+       return EMF_ERROR_NONE;
 }
 
-int em_storage_shm_file_destroy(const char *shm_file_name)
+int emstorage_shm_file_destroy(const char *shm_file_name)
 {
        EM_DEBUG_FUNC_BEGIN("shm_file_name [%p]", shm_file_name);
        if(!shm_file_name) {
-               EM_DEBUG_EXCEPTION("EM_STORAGE_ERROR_INVALID_PARAM");
-               return EM_STORAGE_ERROR_INVALID_PARAM;
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
+               return EMF_ERROR_INVALID_PARAM;
        }
 
        if (shm_unlink(shm_file_name) != 0)
                EM_DEBUG_EXCEPTION("shm_unlink failed: %s", strerror(errno));
        EM_DEBUG_FUNC_END();
-       return EM_STORAGE_ERROR_NONE;
+       return EMF_ERROR_NONE;
 }
 
-static int em_storage_shm_mutex_init(const char *shm_file_name, int *param_shm_fd, mmapped_t **param_mapped)
+static int _initialize_shm_mutex(const char *shm_file_name, int *param_shm_fd, mmapped_t **param_mapped)
 {
        EM_DEBUG_FUNC_BEGIN("shm_file_name [%p] param_shm_fd [%p], param_mapped [%p]", shm_file_name, param_shm_fd, param_mapped);
        
        if(!shm_file_name || !param_shm_fd || !param_mapped) {
-               EM_DEBUG_EXCEPTION("EM_STORAGE_ERROR_INVALID_PARAM");
-               return EM_STORAGE_ERROR_INVALID_PARAM;
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
+               return EMF_ERROR_INVALID_PARAM;
        }
 
        if (!(*param_mapped)) {
@@ -427,29 +418,29 @@ static int em_storage_shm_mutex_init(const char *shm_file_name, int *param_shm_f
                        *param_shm_fd = shm_open(shm_file_name, O_RDWR, 0);
                        if ((*param_shm_fd) == -1) {
                                EM_DEBUG_EXCEPTION("FAIL: shm_open(): %s", strerror(errno));
-                               return EM_STORAGE_ERROR_SYSTEM_FAILURE;
+                               return EMF_ERROR_SYSTEM_FAILURE;
                        }
                }
                mmapped_t *tmp = (mmapped_t *)mmap(NULL, sizeof(mmapped_t), PROT_READ|PROT_WRITE, MAP_SHARED, (*param_shm_fd), 0);
                
                if (tmp == MAP_FAILED) {
                        EM_DEBUG_EXCEPTION("mmap failed: %s", strerror(errno));
-                       return EM_STORAGE_ERROR_SYSTEM_FAILURE;
+                       return EMF_ERROR_SYSTEM_FAILURE;
                }
                *param_mapped = tmp;
        }
 
        EM_DEBUG_FUNC_END();
-       return EM_STORAGE_ERROR_NONE;
+       return EMF_ERROR_NONE;
 }
 
-static int em_storage_shm_mutex_timedlock(mmapped_t **param_mapped, int sec)
+static int _timedlock_shm_mutex(mmapped_t **param_mapped, int sec)
 {
        EM_DEBUG_FUNC_BEGIN("param_mapped [%p], sec [%d]", param_mapped, sec);
        
        if(!param_mapped) {
-               EM_DEBUG_EXCEPTION("EM_STORAGE_ERROR_INVALID_PARAM");
-               return EM_STORAGE_ERROR_INVALID_PARAM;
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
+               return EMF_ERROR_INVALID_PARAM;
        }
 
        struct timespec abs_time;       
@@ -468,10 +459,10 @@ static int em_storage_shm_mutex_timedlock(mmapped_t **param_mapped, int sec)
        }
        
        EM_DEBUG_FUNC_END();
-       return EM_STORAGE_ERROR_NONE;
+       return EMF_ERROR_NONE;
 }
 
-void em_storage_shm_mutex_unlock(mmapped_t **param_mapped)
+void _unlockshm_mutex(mmapped_t **param_mapped)
 {
        EM_DEBUG_FUNC_BEGIN(); 
        pthread_mutex_unlock(&((*param_mapped)->mutex));
@@ -483,8 +474,8 @@ void em_storage_shm_mutex_unlock(mmapped_t **param_mapped)
 static int _open_counter = 0;
 static int g_transaction = false;
 
-static int em_storage_get_password_file_name(int account_id, char *recv_password_file_name, char *send_password_file_name);
-static int em_storage_read_password_ss(char *file_name, char **password);
+static int _get_password_file_name(int account_id, char *recv_password_file_name, char *send_password_file_name);
+static int _read_password_from_secure_storage(char *file_name, char **password);
 
 
 typedef struct {
@@ -520,7 +511,7 @@ enum
        CREATE_TABLE_MAIL_PARTIAL_BODY_ACTIVITY_TBL,
 #endif
        CREATE_TABLE_MAIL_MEETING_TBL,
-#ifdef __LOCAL_ACTIVITY__
+#ifdef __FEATURE_LOCAL_ACTIVITY__
        CREATE_TABLE_MAIL_LOCAL_ACTIVITY_TBL,
 #endif
        CREATE_TABLE_MAX,
@@ -634,6 +625,7 @@ enum
 {
        MAIL_ID_IDX_IN_MAIL_TBL = 0,
        ACCOUNT_ID_IDX_IN_MAIL_TBL,
+       MAILBOX_ID_IDX_IN_MAIL_TBL,
        MAILBOX_NAME_IDX_IN_MAIL_TBL,
        MAILBOX_TYPE_IDX_IN_MAIL_TBL,
        SUBJECT_IDX_IN_MAIL_TBL,
@@ -686,10 +678,11 @@ enum
        MAIL_ID_IDX_IN_MAIL_ATTACHMENT_TBL,
        ACCOUNT_ID_IDX_IN_MAIL_ATTACHMENT_TBL,
        MAILBOX_NAME_IDX_IN_MAIL_ATTACHMENT_TBL,
-       FILE_YN_IDX_IN_MAIL_ATTACHMENT_TBL,
-       FLAG1_IDX_IN_MAIL_ATTACHMENT_TBL,
-       FLAG2_IDX_IN_MAIL_ATTACHMENT_TBL,
-       FLAG3_IDX_IN_MAIL_ATTACHMENT_TBL,
+       ATTACHMENT_SAVE_STATUS_IDX_IN_MAIL_ATTACHMENT_TBL,
+       ATTACHMENT_DRM_TYPE_IDX_IN_MAIL_ATTACHMENT_TBL,
+       ATTACHMENT_DRM_METHOD_IDX_IN_MAIL_ATTACHMENT_TBL,
+       ATTACHMENT_INLINE_CONTENT_STATUS_IDX_IN_MAIL_ATTACHMENT_TBL,
+       ATTACHMENT_MIME_TYPE_IDX_IN_MAIL_ATTACHMENT_TBL,
 #ifdef __ATTACHMENT_OPTI__     
        ENCODING_IDX_IN_MAIL_ATTACHMENT_TBL,
        SECTION_IDX_IN_MAIL_ATTACHMENT_TBL,
@@ -812,9 +805,10 @@ static char *g_test_query[] = {
                "SELECT"
                "       mail_id, "
                "       account_id, "
+               "       mailbox_id, "
                "       mailbox_name, "
-               " mailbox_type, "
-               " subject, "
+               "   mailbox_type, "
+               "   subject, "
                "       date_time, "
                "       server_mail_status, "
                "       server_mailbox_name, "
@@ -862,10 +856,11 @@ static char *g_test_query[] = {
                "       mail_id,  "
                "       account_id, "
                "       mailbox_name, "
-               "       file_yn,  "
-               "       flag1,  "
-               "       flag2,  "
-               "       flag3  "
+               "       attachment_save_status,  "
+               "       attachment_drm_type,  "
+               "       attachment_drm_method,  "
+               "       attachment_inline_content_status,  "
+               "       attachment_mime_type  "
                " FROM mail_attachment_tbl ",
 
 #ifdef __FEATURE_PARTIAL_BODY_DOWNLOAD__
@@ -897,7 +892,7 @@ static char *g_test_query[] = {
                "   daylight_bias "
                " FROM mail_meeting_tbl ",
 
-#ifdef __LOCAL_ACTIVITY__
+#ifdef __FEATURE_LOCAL_ACTIVITY__
                "SELECT "
                "       activity_id, "
                "   account_id, "
@@ -920,10 +915,10 @@ typedef enum
 } enotitype_t;
 
 
-EXPORT_API int em_storage_send_noti(enotitype_t notiType, int subType, int data1, int data2, char *data3, int data4)
+INTERNAL_FUNC int emstorage_send_noti(enotitype_t notiType, int subType, int data1, int data2, char *data3, int data4)
 {
        EM_DEBUG_FUNC_BEGIN();
-       EM_PROFILE_BEGIN(profile_em_storage_send_noti);
+       EM_PROFILE_BEGIN(profile_emstorage_send_noti);
 
        int ret = 0;
        DBusConnection *connection;
@@ -1003,26 +998,26 @@ FINISH_OFF:
                dbus_message_unref(signal);
 
        LEAVE_CRITICAL_SECTION(_dbus_noti_lock);
-       EM_PROFILE_END(profile_em_storage_send_noti);
+       EM_PROFILE_END(profile_emstorage_send_noti);
        EM_DEBUG_FUNC_END("ret [%d]", ret);
        return ret;
 }
 
 
-EXPORT_API int em_storage_notify_storage_event(emf_noti_on_storage_event transaction_type, int data1, int data2 , char *data3, int data4)
+INTERNAL_FUNC int emstorage_notify_storage_event(emf_noti_on_storage_event transaction_type, int data1, int data2 , char *data3, int data4)
 {
        EM_DEBUG_FUNC_BEGIN("transaction_type[%d], data1[%d], data2[%d], data3[%p], data4[%d]", transaction_type, data1, data2, data3, data4);
-       return em_storage_send_noti(_NOTI_TYPE_STORAGE, (int)transaction_type, data1, data2, data3, data4);
+       return emstorage_send_noti(_NOTI_TYPE_STORAGE, (int)transaction_type, data1, data2, data3, data4);
 }
 
-EXPORT_API int em_storage_notify_network_event(emf_noti_on_network_event status_type, int data1, char *data2, int data3, int data4)
+INTERNAL_FUNC int emstorage_notify_network_event(emf_noti_on_network_event status_type, int data1, char *data2, int data3, int data4)
 {
        EM_DEBUG_FUNC_BEGIN("status_type[%d], data1[%d], data2[%p], data3[%d], data4[%d]", status_type, data1, data2, data3, data4);
-       return em_storage_send_noti(_NOTI_TYPE_NETWORK, (int)status_type, data1, data3, data2, data4);
+       return emstorage_send_noti(_NOTI_TYPE_NETWORK, (int)status_type, data1, data3, data2, data4);
 }
 
 /* ----------- Notification Changes End----------- */
-static int _getTableFieldDataChar(char  **table, char *buf, int index)
+static int _get_table_field_data_char(char  **table, char *buf, int index)
 {
        if ((table == NULL) || (buf == NULL) || (index < 0))  {
                EM_DEBUG_EXCEPTION("table[%p], buf[%p], index[%d]", table, buf, index);
@@ -1040,7 +1035,7 @@ static int _getTableFieldDataChar(char  **table, char *buf, int index)
        return false;
 }
 
-static int _getTableFieldDataInt(char  **table, int *buf, int index)
+static int _get_table_field_data_int(char  **table, int *buf, int index)
 {
        if ((table == NULL) || (buf == NULL) || (index < 0))  {
                EM_DEBUG_EXCEPTION("table[%p], buf[%p], index[%d]", table, buf, index);
@@ -1058,7 +1053,25 @@ static int _getTableFieldDataInt(char  **table, int *buf, int index)
        return false;
 }
 
-static int _getTableFieldDataString(char **table, char **buf, int ucs2, int index)
+static int _get_table_field_data_time_t(char  **table, time_t *buf, int index)
+{
+       if ((table == NULL) || (buf == NULL) || (index < 0))  {
+               EM_DEBUG_EXCEPTION("table[%p], buf[%p], index[%d]", table, buf, index);
+               return false;
+       }
+
+       if (table[index] != NULL) {
+               *buf = (time_t)atol(table[index]);
+               return true;
+       }
+
+       /*  EM_DEBUG_LOG("Empty field. Set as zero"); */
+
+       *buf = 0;
+       return false;
+}
+
+static int _get_table_field_data_string(char **table, char **buf, int ucs2, int index)
 {
        int ret = false;
 
@@ -1074,7 +1087,7 @@ static int _getTableFieldDataString(char **table, char **buf, int ucs2, int inde
        else {
                sLen = strlen(pTemp);
                if(sLen) {
-                       *buf = (char *) em_core_malloc(sLen + 1);
+                       *buf = (char *) em_malloc(sLen + 1);
                        if (*buf == NULL) {
                                EM_DEBUG_EXCEPTION("malloc is failed");
                                goto FINISH_OFF;
@@ -1086,9 +1099,9 @@ static int _getTableFieldDataString(char **table, char **buf, int ucs2, int inde
        }
 #ifdef _PRINT_STORAGE_LOG_
        if (*buf)
-               EM_DEBUG_LOG("_getTableFieldDataString - buf[%s], index[%d]", *buf, index);
+               EM_DEBUG_LOG("_get_table_field_data_string - buf[%s], index[%d]", *buf, index);
        else
-               EM_DEBUG_LOG("_getTableFieldDataString - No string got ");
+               EM_DEBUG_LOG("_get_table_field_data_string - No string got ");
 #endif 
        ret = true;
 FINISH_OFF:
@@ -1096,8 +1109,7 @@ FINISH_OFF:
        return ret;
 }
 
-static int
-_getTableFieldDataStringWithoutAllocation(char **table, char *buf, int buffer_size, int ucs2, int index)
+static int _get_table_field_data_string_without_allocation(char **table, char *buf, int buffer_size, int ucs2, int index)
 {
        if ((table == NULL) || (buf == NULL) || (index < 0))  {
                EM_DEBUG_EXCEPTION(" table[%p], buf[%p], index[%d]", table, buf, index);
@@ -1113,15 +1125,15 @@ _getTableFieldDataStringWithoutAllocation(char **table, char *buf, int buffer_si
        }
 #ifdef _PRINT_STORAGE_LOG_
        if (buf)
-               EM_DEBUG_LOG("_getTableFieldDataString - buf[%s], index[%d]", buf, index);
+               EM_DEBUG_LOG("_get_table_field_data_string - buf[%s], index[%d]", buf, index);
        else
-               EM_DEBUG_LOG("_getTableFieldDataString - No string got ");
+               EM_DEBUG_LOG("_get_table_field_data_string - No string got ");
 #endif 
 
        return true;
 }
 
-static int _getStmtFieldDataChar(DB_STMT hStmt, char *buf, int index)
+static int _get_stmt_field_data_char(DB_STMT hStmt, char *buf, int index)
 {
        if ((hStmt == NULL) || (buf == NULL) || (index < 0))  {
                EM_DEBUG_EXCEPTION("buf[%p], index[%d]", buf, index);
@@ -1131,7 +1143,7 @@ static int _getStmtFieldDataChar(DB_STMT hStmt, char *buf, int index)
        if (sqlite3_column_text(hStmt, index) != NULL) {
                *buf = (char)sqlite3_column_int(hStmt, index);
 #ifdef _PRINT_STORAGE_LOG_
-                       EM_DEBUG_LOG("_getStmtFieldDataInt [%d]", *buf);
+                       EM_DEBUG_LOG("_get_stmt_field_data_int [%d]", *buf);
 #endif
                return true;
        }
@@ -1141,7 +1153,7 @@ static int _getStmtFieldDataChar(DB_STMT hStmt, char *buf, int index)
        return false;
 }
 
-static int _getStmtFieldDataInt(DB_STMT hStmt, int *buf, int index)
+static int _get_stmt_field_data_int(DB_STMT hStmt, int *buf, int index)
 {
        if ((hStmt == NULL) || (buf == NULL) || (index < 0))  {
                EM_DEBUG_EXCEPTION("buf[%p], index[%d]", buf, index);
@@ -1151,7 +1163,7 @@ static int _getStmtFieldDataInt(DB_STMT hStmt, int *buf, int index)
        if (sqlite3_column_text(hStmt, index) != NULL) {
                *buf = sqlite3_column_int(hStmt, index);
 #ifdef _PRINT_STORAGE_LOG_
-                       EM_DEBUG_LOG("_getStmtFieldDataInt [%d]", *buf);
+                       EM_DEBUG_LOG("_get_stmt_field_data_int [%d]", *buf);
 #endif
                return true;
        }
@@ -1161,7 +1173,26 @@ static int _getStmtFieldDataInt(DB_STMT hStmt, int *buf, int index)
        return false;
 }
 
-static int _getStmtFieldDataString(DB_STMT hStmt, char **buf, int ucs2, int index)
+static int _get_stmt_field_data_time_t(DB_STMT hStmt, time_t *buf, int index)
+{
+       if ((hStmt == NULL) || (buf == NULL) || (index < 0))  {
+               EM_DEBUG_EXCEPTION("buf[%p], index[%d]", buf, index);
+               return false;
+       }
+
+       if (sqlite3_column_text(hStmt, index) != NULL) {
+               *buf = (time_t)sqlite3_column_int(hStmt, index);
+#ifdef _PRINT_STORAGE_LOG_
+               EM_DEBUG_LOG("_get_stmt_field_data_time_t [%d]", *buf);
+#endif
+               return true;
+       }
+
+       EM_DEBUG_LOG("_get_stmt_field_data_time_t fail. index [%d]", index);
+       return false;
+}
+
+static int _get_stmt_field_data_string(DB_STMT hStmt, char **buf, int ucs2, int index)
 {
        if ((hStmt < 0) || (buf == NULL) || (index < 0))  {
                EM_DEBUG_EXCEPTION("hStmt[%d], buf[%p], index[%d]", hStmt, buf, index);
@@ -1172,11 +1203,11 @@ static int _getStmtFieldDataString(DB_STMT hStmt, char **buf, int ucs2, int inde
        sLen = sqlite3_column_bytes(hStmt, index);
 
 #ifdef _PRINT_STORAGE_LOG_
-               EM_DEBUG_LOG("_getStmtFieldDataString sqlite3_column_bytes sLen[%d]", sLen);
+               EM_DEBUG_LOG("_get_stmt_field_data_string sqlite3_column_bytes sLen[%d]", sLen);
 #endif
 
        if (sLen > 0) {
-               *buf = (char *) em_core_malloc(sLen + 1);
+               *buf = (char *) em_malloc(sLen + 1);
                strncpy(*buf, (char *)sqlite3_column_text(hStmt, index), sLen);
        }
        else
@@ -1186,13 +1217,13 @@ static int _getStmtFieldDataString(DB_STMT hStmt, char **buf, int ucs2, int inde
        if (*buf)
                EM_DEBUG_LOG("buf[%s], index[%d]", *buf, index);
        else
-               EM_DEBUG_LOG("_getStmtFieldDataString - No string got");
+               EM_DEBUG_LOG("_get_stmt_field_data_string - No string got");
 #endif 
 
        return false;
 }
 
-static int _getStmtFieldDataStringWithoutAllocation(DB_STMT hStmt, char *buf, int buffer_size, int ucs2, int index)
+static int _get_stmt_field_data_string_without_allocation(DB_STMT hStmt, char *buf, int buffer_size, int ucs2, int index)
 {
        if ((hStmt < 0) || (buf == NULL) || (index < 0))  {
                EM_DEBUG_EXCEPTION("hStmt[%d], buf[%p], buffer_size[%d], index[%d]", hStmt, buf, buffer_size, index);
@@ -1203,7 +1234,7 @@ static int _getStmtFieldDataStringWithoutAllocation(DB_STMT hStmt, char *buf, in
        sLen = sqlite3_column_bytes(hStmt, index);
 
 #ifdef _PRINT_STORAGE_LOG_
-               EM_DEBUG_LOG("_getStmtFieldDataStringWithoutAllocation sqlite3_column_bytes sLen[%d]", sLen);
+               EM_DEBUG_LOG("_get_stmt_field_data_string_without_allocation sqlite3_column_bytes sLen[%d]", sLen);
 #endif
 
        if (sLen > 0) {
@@ -1220,7 +1251,7 @@ static int _getStmtFieldDataStringWithoutAllocation(DB_STMT hStmt, char *buf, in
        return false;
 }
 
-static int _bindStmtFieldDataChar(DB_STMT hStmt, int index, char value)
+static int _bind_stmt_field_data_char(DB_STMT hStmt, int index, char value)
 {
        if ((hStmt == NULL) || (index < 0)) {
                EM_DEBUG_EXCEPTION("index[%d]", index);
@@ -1237,7 +1268,7 @@ static int _bindStmtFieldDataChar(DB_STMT hStmt, int index, char value)
        return true;
 }
 
-static int _bindStmtFieldDataInt(DB_STMT hStmt, int index, int value)
+static int _bind_stmt_field_data_int(DB_STMT hStmt, int index, int value)
 {
        if ((hStmt == NULL) || (index < 0)) {
                EM_DEBUG_EXCEPTION("index[%d]", index);
@@ -1254,7 +1285,24 @@ static int _bindStmtFieldDataInt(DB_STMT hStmt, int index, int value)
        return true;
 }
 
-static int _bindStmtFieldDataString(DB_STMT hStmt, int index, char *value, int ucs2, int max_len)
+static int _bind_stmt_field_data_time_t(DB_STMT hStmt, int index, time_t value)
+{
+       if ((hStmt == NULL) || (index < 0)) {
+               EM_DEBUG_EXCEPTION("index[%d]", index);
+               return false;
+       }
+
+       int ret = sqlite3_bind_int(hStmt, index+1, (int)value);
+
+       if (ret != SQLITE_OK)  {
+               EM_DEBUG_EXCEPTION("sqlite3_bind_int fail - %d", ret);
+               return false;
+       }
+
+       return true;
+}
+
+static int _bind_stmt_field_data_string(DB_STMT hStmt, int index, char *value, int ucs2, int max_len)
 {
        if ((hStmt == NULL) || (index < 0)) {
                EM_DEBUG_EXCEPTION("index[%d], max_len[%d]", index, max_len);
@@ -1278,7 +1326,7 @@ static int _bindStmtFieldDataString(DB_STMT hStmt, int index, char *value, int u
        return true;
 }
 
-static int _emf_delete_temp_file(const char *path)
+static int _delete_temp_file(const char *path)
 {
        EM_DEBUG_FUNC_BEGIN("path[%p]", path);
        
@@ -1307,7 +1355,7 @@ char *cpy_str(char *src)
        char *p = NULL;
        
        if (src)  {
-               if (!(p = em_core_malloc((int)strlen(src) + 1)))  {
+               if (!(p = em_malloc((int)strlen(src) + 1)))  {
                        EM_DEBUG_EXCEPTION("mailoc failed...");
                        return NULL;
                }
@@ -1317,7 +1365,7 @@ char *cpy_str(char *src)
        return p;
 }
 
-static void _em_storage_close_once(void)
+static void _emstorage_close_once(void)
 {
        EM_DEBUG_FUNC_BEGIN();
        
@@ -1327,17 +1375,17 @@ static void _em_storage_close_once(void)
        EM_DEBUG_FUNC_END();
 }
 
-EXPORT_API int em_storage_close(int *err_code)
+INTERNAL_FUNC int emstorage_close(int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
        
        int ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
 
-       em_storage_db_close(&error);            
+       emstorage_db_close(&error);             
        
        if (--_open_counter == 0)
-               _em_storage_close_once();
+               _emstorage_close_once();
        
        ret = true;
 
@@ -1348,11 +1396,11 @@ EXPORT_API int em_storage_close(int *err_code)
        return ret;
 }
 
-static void *_em_storage_open_once(int *err_code)
+static void *_emstorage_open_once(int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
        
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        
        mkdir(EMAILPATH, DIRECTORY_PERMISSION);
        mkdir(DATA_PATH, DIRECTORY_PERMISSION);
@@ -1362,12 +1410,12 @@ static void *_em_storage_open_once(int *err_code)
        SNPRINTF(g_db_path, sizeof(g_db_path), "%s/%s", MAILHOME, MAILTEMP);
        mkdir(g_db_path, DIRECTORY_PERMISSION);
        
-       _emf_delete_temp_file(g_db_path);
+       _delete_temp_file(g_db_path);
        
        g_transaction = false;
        
-       if (!em_storage_create_table(EMF_CREATE_DB_NORMAL, &error)) {
-               EM_DEBUG_EXCEPTION(" em_storage_create_table failed - %d", error);
+       if (!emstorage_create_table(EMF_CREATE_DB_NORMAL, &error)) {
+               EM_DEBUG_EXCEPTION(" emstorage_create_table failed - %d", error);
                goto FINISH_OFF;
        }
        
@@ -1382,8 +1430,7 @@ FINISH_OFF:
  /*  pData : a parameter which is registered when busy handler is registerd */
  /*  count : retry count */
 #define EMF_STORAGE_MAX_RETRY_COUNT    20
-static int     
-em_busy_handler(void *pData, int count)
+static int _callback_sqlite_busy_handler(void *pData, int count)
 {
        EM_DEBUG_LOG("Busy Handler Called!!: [%d]", count);
        usleep(200000);   /*   sleep time when SQLITE_LOCK */
@@ -1392,23 +1439,22 @@ em_busy_handler(void *pData, int count)
        return EMF_STORAGE_MAX_RETRY_COUNT - count;   
 }
 
-static int
-em_storage_delete_all_files_and_directories(int *err_code)
+static int _delete_all_files_and_directories(int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
 
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        int ret = false;
 
-       if (!em_storage_delete_file(EMAIL_SERVICE_DB_FILE_PATH, &error)) {
-               if (error != EM_STORAGE_ERROR_FILE_NOT_FOUND) {
+       if (!emstorage_delete_file(EMAIL_SERVICE_DB_FILE_PATH, &error)) {
+               if (error != EMF_ERROR_FILE_NOT_FOUND) {
                        EM_DEBUG_EXCEPTION("remove failed - %s", EMAIL_SERVICE_DB_FILE_PATH);
                        goto FINISH_OFF;        
                }
        }
 
-       if (!em_storage_delete_dir(MAILHOME, &error)) {
-               EM_DEBUG_EXCEPTION("em_storage_delete_dir failed");
+       if (!emstorage_delete_dir(MAILHOME, &error)) {
+               EM_DEBUG_EXCEPTION("emstorage_delete_dir failed");
                goto FINISH_OFF;
        }
 
@@ -1421,24 +1467,23 @@ FINISH_OFF:
        return ret;
 }
 
-static int
-em_storage_recovery_from_malformed_db_file(int *err_code)
+static int _recovery_from_malformed_db_file(int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
 
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        int ret = false;
        
        /* Delete all files and directories */
-       if (!em_storage_delete_all_files_and_directories(&error)) {
-               EM_DEBUG_EXCEPTION("em_storage_delete_all_files_and_directories failed [%d]", error);
+       if (!_delete_all_files_and_directories(&error)) {
+               EM_DEBUG_EXCEPTION("_delete_all_files_and_directories failed [%d]", error);
                goto FINISH_OFF;
        }
 
        /* Delete all accounts on MyAccount */
 
        /* Delete all managed connection to DB */
-       em_storage_reset_db_handle_list();
+       emstorage_reset_db_handle_list();
 
        ret = true;
 
@@ -1450,11 +1495,11 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int em_db_open(sqlite3 **sqlite_handle, int *err_code)
+INTERNAL_FUNC int em_db_open(sqlite3 **sqlite_handle, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
        int rc = 0;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        int ret = false;
 
        EM_DEBUG_LOG("*sqlite_handle[%p]", *sqlite_handle);
@@ -1462,25 +1507,25 @@ EXPORT_API int em_db_open(sqlite3 **sqlite_handle, int *err_code)
        if (NULL == *sqlite_handle)  {
                /*  db open */
                EM_DEBUG_LOG("Open DB");
-               EM_STORAGE_PROTECTED_FUNC_CALL(db_util_open(EMAIL_SERVICE_DB_FILE_PATH, sqlite_handle, DB_UTIL_REGISTER_HOOK_METHOD), rc);
+               EMSTORAGE_PROTECTED_FUNC_CALL(db_util_open(EMAIL_SERVICE_DB_FILE_PATH, sqlite_handle, DB_UTIL_REGISTER_HOOK_METHOD), rc);
                if (SQLITE_OK != rc) {
                        EM_DEBUG_EXCEPTION("db_util_open fail:%d -%s", rc, sqlite3_errmsg(*sqlite_handle));
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                        db_util_close(*sqlite_handle); 
                        *sqlite_handle = NULL; 
 
                        if (SQLITE_CORRUPT == rc) /* SQLITE_CORRUPT : The database disk image is malformed */ {/* Recovery DB file */ 
                                EM_DEBUG_LOG("The database disk image is malformed. Trying to remove and create database disk image and directories");
-                               if (!em_storage_recovery_from_malformed_db_file(&error)) {
-                                       EM_DEBUG_EXCEPTION("em_storage_recovery_from_malformed_db_file failed [%d]", error);
+                               if (!_recovery_from_malformed_db_file(&error)) {
+                                       EM_DEBUG_EXCEPTION("_recovery_from_malformed_db_file failed [%d]", error);
                                        goto FINISH_OFF;
                                }
                                
                                EM_DEBUG_LOG("Open DB again");
-                               EM_STORAGE_PROTECTED_FUNC_CALL(db_util_open(EMAIL_SERVICE_DB_FILE_PATH, sqlite_handle, DB_UTIL_REGISTER_HOOK_METHOD), rc);
+                               EMSTORAGE_PROTECTED_FUNC_CALL(db_util_open(EMAIL_SERVICE_DB_FILE_PATH, sqlite_handle, DB_UTIL_REGISTER_HOOK_METHOD), rc);
                                if (SQLITE_OK != rc) {
                                        EM_DEBUG_EXCEPTION("db_util_open fail:%d -%s", rc, sqlite3_errmsg(*sqlite_handle));
-                                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                                       error = EMF_ERROR_DB_FAILURE;
                                        db_util_close(*sqlite_handle); 
                                        *sqlite_handle = NULL; 
                                }
@@ -1492,10 +1537,10 @@ EXPORT_API int em_db_open(sqlite3 **sqlite_handle, int *err_code)
 
                /* register busy handler */
                EM_DEBUG_LOG(">>>>> Register busy handler.....");
-               rc = sqlite3_busy_handler(*sqlite_handle, em_busy_handler, NULL);  /*  Busy Handler registration, NULL is a parameter which will be passed to handler */
+               rc = sqlite3_busy_handler(*sqlite_handle, _callback_sqlite_busy_handler, NULL);  /*  Busy Handler registration, NULL is a parameter which will be passed to handler */
                if (SQLITE_OK != rc) {
                        EM_DEBUG_EXCEPTION("sqlite3_busy_handler fail:%d -%s", rc, sqlite3_errmsg(*sqlite_handle));
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                        db_util_close(*sqlite_handle); 
                        *sqlite_handle = NULL; 
                        goto FINISH_OFF;                
@@ -1515,19 +1560,19 @@ FINISH_OFF:
        return ret;     
 }
 
-EXPORT_API sqlite3* em_storage_db_open(int *err_code)
+INTERNAL_FUNC sqlite3* emstorage_db_open(int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
 #ifdef _MULTIPLE_DB_HANDLE
        sqlite3 *_db_handle = NULL;
 #endif
        
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
 
-       em_storage_shm_mutex_init(SHM_FILE_FOR_DB_LOCK, &shm_fd_for_db_lock, &mapped_for_db_lock);
+       _initialize_shm_mutex(SHM_FILE_FOR_DB_LOCK, &shm_fd_for_db_lock, &mapped_for_db_lock);
 
 #ifdef __FEATURE_USE_SHARED_MUTEX_FOR_GENERATING_MAIL_ID__
-       em_storage_shm_mutex_init(SHM_FILE_FOR_MAIL_ID_LOCK, &shm_fd_for_generating_mail_id, &mapped_for_generating_mail_id);
+       _initialize_shm_mutex(SHM_FILE_FOR_MAIL_ID_LOCK, &shm_fd_for_generating_mail_id, &mapped_for_generating_mail_id);
 #endif /*__FEATURE_USE_SHARED_MUTEX_FOR_GENERATING_MAIL_ID__ */
 
        if (!em_db_open(&_db_handle, &error)) {
@@ -1536,7 +1581,7 @@ EXPORT_API sqlite3* em_storage_db_open(int *err_code)
        }
 
 #ifdef _MULTIPLE_DB_HANDLE
-       em_storage_set_db_handle(_db_handle);
+       emstorage_set_db_handle(_db_handle);
 #endif
        
 FINISH_OFF:
@@ -1547,14 +1592,14 @@ FINISH_OFF:
        return _db_handle;      
 }
 
-EXPORT_API int em_storage_db_close(int *err_code)
+INTERNAL_FUNC int emstorage_db_close(int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
 #ifdef _MULTIPLE_DB_HANDLE
-       sqlite3 *_db_handle = em_storage_get_db_handle();
+       sqlite3 *_db_handle = emstorage_get_db_handle();
 #endif
        
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        int ret = false;
 
        DELETE_CRITICAL_SECTION(_transactionBeginLock);
@@ -1566,12 +1611,12 @@ EXPORT_API int em_storage_db_close(int *err_code)
                
                if (ret != SQLITE_OK) {
                        EM_DEBUG_EXCEPTION(" db_util_close fail - %d", ret);
-                       error = EM_STORAGE_ERROR_DB_FAILURE;            
+                       error = EMF_ERROR_DB_FAILURE;
                        ret = false;
                        goto FINISH_OFF;
                }
 #ifdef _MULTIPLE_DB_HANDLE
-               em_storage_remove_db_handle();
+               emstorage_remove_db_handle();
 #endif
                _db_handle = NULL;
        }
@@ -1587,28 +1632,28 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int em_storage_open(int *err_code)
+INTERNAL_FUNC int emstorage_open(int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
        
        int ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
 
        int retValue;
 
        retValue = mkdir(DB_PATH, DIRECTORY_PERMISSION);
 
        EM_DEBUG_LOG("mkdir return- %d", retValue);
-       EM_DEBUG_LOG("em_storage_open - before db_util_open - pid = %d", getpid());
+       EM_DEBUG_LOG("emstorage_open - before db_util_open - pid = %d", getpid());
 
-       if (em_storage_db_open(&error) == NULL) {
-               EM_DEBUG_EXCEPTION("em_storage_db_open failed[%d]", error);
+       if (emstorage_db_open(&error) == NULL) {
+               EM_DEBUG_EXCEPTION("emstorage_db_open failed[%d]", error);
                goto FINISH_OFF;
        }
 
        
        if (_open_counter++ == 0)
-               _em_storage_open_once(&error);
+               _emstorage_open_once(&error);
 
        ret = true;
        
@@ -1621,11 +1666,11 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int em_storage_create_table(emf_create_db_t type, int *err_code)
+INTERNAL_FUNC int emstorage_create_table(emstorage_create_db_type_t type, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
        
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        int rc = -1, ret = false;
        char sql_query_string[QUERY_SIZE] = {0, };
        char *create_table_query[] =
@@ -1727,24 +1772,25 @@ EXPORT_API int em_storage_create_table(emf_create_db_t type, int *err_code)
        "(\n"
        "  mail_id                      INTEGER PRIMARY KEY \n"
        ", account_id                   INTEGER \n"
+       ", mailbox_id                   INTEGER \n"
        ", mailbox_name                 VARCHAR(129) \n"
        ", mailbox_type                 INTEGER \n"
-       ", subject                      UCS2TEXT\ n"
-       ", date_time                    VARCHAR(129) \n"                        /*  type change to int or datetime. */
+       ", subject                      TEXT \n"
+       ", date_time                    DATETIME \n"
        ", server_mail_status           INTEGER \n"
        ", server_mailbox_name          VARCHAR(129) \n"
        ", server_mail_id               VARCHAR(129) \n"
        ", message_id                   VARCHAR(257) \n"
-       ", full_address_from            UCS2TEXT \n"
-       ", full_address_reply           UCS2TEXT \n"
-       ", full_address_to              UCS2TEXT \n"
-       ", full_address_cc              UCS2TEXT \n"
-       ", full_address_bcc             UCS2TEXT \n"
-       ", full_address_return          UCS2TEXT \n"
-       ", email_address_sender         UCS2TEXT collation user1 \n"
-       ", email_address_recipient      UCS2TEXT collation user1 \n"
-       ", alias_sender                 UCS2TEXT \n"
-       ", alias_recipient              UCS2TEXT \n"
+       ", full_address_from            TEXT \n"
+       ", full_address_reply           TEXT \n"
+       ", full_address_to              TEXT \n"
+       ", full_address_cc              TEXT \n"
+       ", full_address_bcc             TEXT \n"
+       ", full_address_return          TEXT \n"
+       ", email_address_sender         TEXT collation user1 \n"
+       ", email_address_recipient      TEXT collation user1 \n"
+       ", alias_sender                 TEXT \n"
+       ", alias_recipient              TEXT \n"
        ", body_download_status         INTEGER \n"
        ", file_path_plain              VARCHAR(257) \n"
        ", file_path_html               VARCHAR(257) \n"
@@ -1765,7 +1811,7 @@ EXPORT_API int em_storage_create_table(emf_create_db_t type, int *err_code)
        ", inline_content_count         INTEGER \n"
        ", thread_id                    INTEGER \n"
        ", thread_item_count            INTEGER \n"
-       ", preview_text                 UCS2TEXT \n" 
+       ", preview_text                 TEXT \n"
        ", meeting_request_status       INTEGER \n"
        ", FOREIGN KEY(account_id)      REFERENCES mail_account_tbl(account_id) \n"
        "); \n ",
@@ -1773,17 +1819,18 @@ EXPORT_API int em_storage_create_table(emf_create_db_t type, int *err_code)
        /*  6. create mail_attachment_tbl */
        "CREATE TABLE mail_attachment_tbl \n"
        "(\n"
-       "  attachment_id                INTEGER PRIMARY KEY"
-       ", attachment_name              VARCHAR(257) \n"
-       ", attachment_path              VARCHAR(257) \n"
-       ", attachment_size              INTEGER \n"
-       ", mail_id                      INTEGER \n"
-       ", account_id                   INTEGER \n"
-       ", mailbox_name                 VARCHAR(129) \n"
-       ", file_yn                      INTEGER \n"
-       ", flag1                        INTEGER \n"
-       ", flag2                        INTEGER \n"
-       ", flag3                        INTEGER \n"
+       "  attachment_id                    INTEGER PRIMARY KEY"
+       ", attachment_name                  VARCHAR(257) \n"
+       ", attachment_path                  VARCHAR(257) \n"
+       ", attachment_size                  INTEGER \n"
+       ", mail_id                          INTEGER \n"
+       ", account_id                       INTEGER \n"
+       ", mailbox_name                     VARCHAR(129) \n"
+       ", attachment_save_status           INTEGER \n"
+       ", attachment_drm_type              INTEGER \n"
+       ", attachment_drm_method            INTEGER \n"
+       ", attachment_inline_content_status INTEGER \n"
+       ", attachment_mime_type             VARCHAR(257) \n"
 #ifdef __ATTACHMENT_OPTI__
        ", encoding                     INTEGER \n"
        ", section                      varchar(257) \n"
@@ -1807,22 +1854,22 @@ EXPORT_API int em_storage_create_table(emf_create_db_t type, int *err_code)
        "(\n"
        "  mail_id                     INTEGER PRIMARY KEY \n"
        ", account_id                  INTEGER \n"
-       ", mailbox_name                UCS2TEXT \n"
+       ", mailbox_name                TEXT \n"
        ", meeting_response            INTEGER \n"
        ", start_time                  INTEGER \n"
        ", end_time                    INTEGER \n"
-       ", location                    UCS2TEXT \n"
-       ", global_object_id            UCS2TEXT \n"
+       ", location                    TEXT \n"
+       ", global_object_id            TEXT \n"
        ", offset                      INTEGER \n"
-       ", standard_name               UCS2TEXT \n"
+       ", standard_name               TEXT \n"
        ", standard_time_start_date    INTEGER \n"
        ", standard_bias               INTEGER \n"
-       ", daylight_name               UCS2TEXT \n"
+       ", daylight_name               TEXT \n"
        ", daylight_time_start_date    INTEGER \n"
        ", daylight_bias               INTEGER \n"
        "); \n ",
 
-#ifdef __LOCAL_ACTIVITY__
+#ifdef __FEATURE_LOCAL_ACTIVITY__
        "CREATE TABLE mail_local_activity_tbl \n"
        "( \n"
        "  activity_id                 INTEGER \n"
@@ -1837,7 +1884,7 @@ EXPORT_API int em_storage_create_table(emf_create_db_t type, int *err_code)
        NULL,
 };
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
  
        EM_DEBUG_LOG("local_db_handle = %p.", local_db_handle);
 
@@ -1845,36 +1892,36 @@ EXPORT_API int em_storage_create_table(emf_create_db_t type, int *err_code)
        char **result;
        
        sql = "SELECT count(name) FROM sqlite_master WHERE name='mail_account_tbl';";
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL), rc);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL), rc);
        EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql, rc, sqlite3_errmsg(local_db_handle)));
 
-       EM_DEBUG_LOG("em_storage_create_table - result[1] = %s %c", result[1], result[1]);
+       EM_DEBUG_LOG("emstorage_create_table - result[1] = %s %c", result[1], result[1]);
 
        if (atoi(result[1]) < 1) {
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "BEGIN;", NULL, NULL, NULL), rc);
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "BEGIN;", NULL, NULL, NULL), rc);
                EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {goto FINISH_OFF; },
                        ("SQL(BEGIN EXCLUSIVE) exec fail:%d -%s", rc, sqlite3_errmsg(local_db_handle)));
                
                EM_DEBUG_LOG("CREATE TABLE mail_account_tbl");
                
-               SNPRINTF(sql_query_string, sizeof(sql_query_string), create_table_query[CREATE_TABLE_MAIL_ACCOUNT_TBL]);
-               
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; }, ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
+               EM_SAFE_STRNCPY(sql_query_string, create_table_query[CREATE_TABLE_MAIL_ACCOUNT_TBL], sizeof(sql_query_string));
+
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; }, ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
                /*  create mail_account_tbl unique index */
                SNPRINTF(sql_query_string, sizeof(sql_query_string), "CREATE UNIQUE INDEX mail_account_idx1 ON mail_account_tbl (account_bind_type, account_id)");
                
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; }, ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; }, ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
                
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "END;", NULL, NULL, NULL), rc);
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "END;", NULL, NULL, NULL), rc);
 
        } /*  mail_account_tbl */
        else if (type == EMF_CREATE_DB_CHECK)  {                
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, g_test_query[CREATE_TABLE_MAIL_ACCOUNT_TBL], NULL, NULL, NULL), rc);
-               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; }, ("SQL(%s) exec fail:%d -%s", g_test_query[CREATE_TABLE_MAIL_ACCOUNT_TBL], rc, sqlite3_errmsg(local_db_handle)));
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, g_test_query[CREATE_TABLE_MAIL_ACCOUNT_TBL], NULL, NULL, NULL), rc);
+               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; }, ("SQL(%s) exec fail:%d -%s", g_test_query[CREATE_TABLE_MAIL_ACCOUNT_TBL], rc, sqlite3_errmsg(local_db_handle)));
        }
 
        sqlite3_free_table(result); 
@@ -1882,74 +1929,73 @@ EXPORT_API int em_storage_create_table(emf_create_db_t type, int *err_code)
                        
        /*  2. create mail_box_tbl */
        sql = "SELECT count(name) FROM sqlite_master WHERE name='mail_box_tbl';";
-       /*  rc = sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL);   */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL), rc);
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL), rc);
        EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql, rc, sqlite3_errmsg(local_db_handle)));
 
        if (atoi(result[1]) < 1) {
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "BEGIN;", NULL, NULL, NULL), rc);
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "BEGIN;", NULL, NULL, NULL), rc);
                EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {goto FINISH_OFF; },
                        ("SQL(BEGIN EXCLUSIVE) exec fail:%d -%s", rc, sqlite3_errmsg(local_db_handle)));
 
                EM_DEBUG_LOG("CREATE TABLE mail_box_tbl");
                
-               SNPRINTF(sql_query_string, sizeof(sql_query_string), create_table_query[CREATE_TABLE_MAIL_BOX_TBL]);
+               EM_SAFE_STRNCPY(sql_query_string, create_table_query[CREATE_TABLE_MAIL_BOX_TBL], sizeof(sql_query_string));
                
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                        ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
                
                /*  create mail_local_mailbox_tbl unique index */
                SNPRINTF(sql_query_string, sizeof(sql_query_string), "CREATE UNIQUE INDEX mail_box_idx1 ON mail_box_tbl (account_id, local_yn, mailbox_name)");
                
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                        ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
                
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "END;", NULL, NULL, NULL), rc);
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "END;", NULL, NULL, NULL), rc);
                
        } /*  mail_box_tbl */
        else if (type == EMF_CREATE_DB_CHECK)  {                
                rc = sqlite3_exec(local_db_handle, g_test_query[CREATE_TABLE_MAIL_BOX_TBL], NULL, NULL, NULL);
-               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                        ("SQL(%s) exec fail:%d -%s", g_test_query[CREATE_TABLE_MAIL_BOX_TBL], rc, sqlite3_errmsg(local_db_handle)));
        }
        sqlite3_free_table(result); 
        
        /*  3. create mail_read_mail_uid_tbl */
        sql = "SELECT count(name) FROM sqlite_master WHERE name='mail_read_mail_uid_tbl';";
-       /*  rc = sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL);   */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL), rc);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL), rc);
        EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql, rc, sqlite3_errmsg(local_db_handle)));
        
 
        if (atoi(result[1]) < 1) {
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "BEGIN;", NULL, NULL, NULL), rc);
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "BEGIN;", NULL, NULL, NULL), rc);
                EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {goto FINISH_OFF; },
                        ("SQL(BEGIN EXCLUSIVE) exec fail:%d -%s", rc, sqlite3_errmsg(local_db_handle)));
                
                EM_DEBUG_LOG("CREATE TABLE mail_read_mail_uid_tbl");
                
-               SNPRINTF(sql_query_string, sizeof(sql_query_string), create_table_query[CREATE_TABLE_MAIL_READ_MAIL_UID_TBL]);
+               EM_SAFE_STRNCPY(sql_query_string, create_table_query[CREATE_TABLE_MAIL_READ_MAIL_UID_TBL], sizeof(sql_query_string));
                
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                        ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
                
                /*  create mail_read_mail_uid_tbl unique index */
                SNPRINTF(sql_query_string, sizeof(sql_query_string), "CREATE UNIQUE INDEX mail_read_mail_uid_idx1 ON mail_read_mail_uid_tbl (account_id, local_mbox, local_uid, mailbox_name, s_uid)");
                
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                        ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "END;", NULL, NULL, NULL), rc);
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "END;", NULL, NULL, NULL), rc);
                
        } /*  mail_read_mail_uid_tbl */
        else if (type == EMF_CREATE_DB_CHECK)  {                
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, g_test_query[CREATE_TABLE_MAIL_READ_MAIL_UID_TBL], NULL, NULL, NULL), rc);
-               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, g_test_query[CREATE_TABLE_MAIL_READ_MAIL_UID_TBL], NULL, NULL, NULL), rc);
+               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                        ("SQL(%s) exec fail:%d -%s", g_test_query[CREATE_TABLE_MAIL_READ_MAIL_UID_TBL], rc, sqlite3_errmsg(local_db_handle)));
        }
        sqlite3_free_table(result);
@@ -1957,29 +2003,29 @@ EXPORT_API int em_storage_create_table(emf_create_db_t type, int *err_code)
        
        /*  4. create mail_rule_tbl */
        sql = "SELECT count(name) FROM sqlite_master WHERE name='mail_rule_tbl';";
-       /*  rc = sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL);   */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL), rc);
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL), rc);
        EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql, rc, sqlite3_errmsg(local_db_handle)));
        
        if (atoi(result[1]) < 1) {
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "BEGIN;", NULL, NULL, NULL), rc);
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "BEGIN;", NULL, NULL, NULL), rc);
                EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {goto FINISH_OFF; },
                        ("SQL(BEGIN EXCLUSIVE) exec fail:%d -%s", rc, sqlite3_errmsg(local_db_handle)));
 
                EM_DEBUG_LOG("CREATE TABLE mail_rule_tbl");
                
-               SNPRINTF(sql_query_string, sizeof(sql_query_string), create_table_query[CREATE_TABLE_MAIL_RULE_TBL]);
+               EM_SAFE_STRNCPY(sql_query_string, create_table_query[CREATE_TABLE_MAIL_RULE_TBL], sizeof(sql_query_string));
                
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                        ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "END;", NULL, NULL, NULL), rc);
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "END;", NULL, NULL, NULL), rc);
                
        } /*  mail_rule_tbl */
        else if (type == EMF_CREATE_DB_CHECK)  {                
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, g_test_query[CREATE_TABLE_MAIL_RULE_TBL], NULL, NULL, NULL), rc);
-               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, g_test_query[CREATE_TABLE_MAIL_RULE_TBL], NULL, NULL, NULL), rc);
+               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                        ("SQL(%s) exec fail:%d -%s", g_test_query[CREATE_TABLE_MAIL_RULE_TBL], rc, sqlite3_errmsg(local_db_handle)));
        }
        sqlite3_free_table(result);
@@ -1987,49 +2033,48 @@ EXPORT_API int em_storage_create_table(emf_create_db_t type, int *err_code)
        
        /*  5. create mail_tbl */
        sql = "SELECT count(name) FROM sqlite_master WHERE name='mail_tbl';";
-       /*  rc = sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL);   */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL), rc);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL), rc);
        EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql, rc, sqlite3_errmsg(local_db_handle)));
        
        if (atoi(result[1]) < 1) {
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "BEGIN;", NULL, NULL, NULL), rc);
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "BEGIN;", NULL, NULL, NULL), rc);
                EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {goto FINISH_OFF; },
                        ("SQL(BEGIN EXCLUSIVE) exec fail:%d -%s", rc, sqlite3_errmsg(local_db_handle)));
                EM_DEBUG_LOG("CREATE TABLE mail_tbl");
                
-               SNPRINTF(sql_query_string, sizeof(sql_query_string), create_table_query[CREATE_TABLE_MAIL_TBL]);
+               EM_SAFE_STRNCPY(sql_query_string, create_table_query[CREATE_TABLE_MAIL_TBL], sizeof(sql_query_string));
                
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                        ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
                
                /*  create mail_tbl unique index */
                SNPRINTF(sql_query_string, sizeof(sql_query_string), "CREATE UNIQUE INDEX mail_idx1 ON mail_tbl (mail_id, account_id)");
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                        ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
                /*  create mail_tbl index for date_time */
                SNPRINTF(sql_query_string, sizeof(sql_query_string), "CREATE INDEX mail_idx_date_time ON mail_tbl (date_time)");
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                        ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
                /*  create mail_tbl index for thread_item_count */
                SNPRINTF(sql_query_string, sizeof(sql_query_string), "CREATE INDEX mail_idx_thread_mail_count ON mail_tbl (thread_item_count)");
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                        ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "END;", NULL, NULL, NULL), rc);
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "END;", NULL, NULL, NULL), rc);
                
                /*  just one time call */
 /*             EFTSInitFTSIndex(FTS_EMAIL_IDX); */
        } /*  mail_tbl */
        else if (type == EMF_CREATE_DB_CHECK)  {                
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, g_test_query[CREATE_TABLE_MAIL_TBL], NULL, NULL, NULL), rc);
-               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, g_test_query[CREATE_TABLE_MAIL_TBL], NULL, NULL, NULL), rc);
+               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                        ("SQL(%s) exec fail:%d -%s", g_test_query[CREATE_TABLE_MAIL_TBL], rc, sqlite3_errmsg(local_db_handle)));
        }
        sqlite3_free_table(result);
@@ -2037,35 +2082,34 @@ EXPORT_API int em_storage_create_table(emf_create_db_t type, int *err_code)
        
        /*  6. create mail_attachment_tbl */
        sql = "SELECT count(name) FROM sqlite_master WHERE name='mail_attachment_tbl';";
-       /*  rc = sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL);   */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL), rc);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL), rc);
        EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql, rc, sqlite3_errmsg(local_db_handle)));
 
        if (atoi(result[1]) < 1) {
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "BEGIN;", NULL, NULL, NULL), rc);
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "BEGIN;", NULL, NULL, NULL), rc);
                EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {goto FINISH_OFF; },
                        ("SQL(BEGIN EXCLUSIVE) exec fail:%d -%s", rc, sqlite3_errmsg(local_db_handle)));
                EM_DEBUG_LOG("CREATE TABLE mail_attachment_tbl");
                
-               SNPRINTF(sql_query_string, sizeof(sql_query_string), create_table_query[CREATE_TABLE_MAIL_ATTACHMENT_TBL]);
+               EM_SAFE_STRNCPY(sql_query_string, create_table_query[CREATE_TABLE_MAIL_ATTACHMENT_TBL], sizeof(sql_query_string));
                
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                        ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
                
                /*  create mail_attachment_tbl unique index */
                SNPRINTF(sql_query_string, sizeof(sql_query_string), "CREATE UNIQUE INDEX mail_attachment_idx1 ON mail_attachment_tbl (mail_id, attachment_id) ");
                
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                        ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "END;", NULL, NULL, NULL), rc);
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "END;", NULL, NULL, NULL), rc);
                
        } /*  mail_attachment_tbl */
        else if (type == EMF_CREATE_DB_CHECK)  {                
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, g_test_query[CREATE_TABLE_MAIL_ATTACHMENT_TBL], NULL, NULL, NULL), rc);
-               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, g_test_query[CREATE_TABLE_MAIL_ATTACHMENT_TBL], NULL, NULL, NULL), rc);
+               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                        ("SQL(%s) exec fail:%d -%s", g_test_query[CREATE_TABLE_MAIL_ATTACHMENT_TBL], rc, sqlite3_errmsg(local_db_handle)));
        }
        sqlite3_free_table(result);
@@ -2073,30 +2117,29 @@ EXPORT_API int em_storage_create_table(emf_create_db_t type, int *err_code)
 #ifdef __FEATURE_PARTIAL_BODY_DOWNLOAD__
 
        sql = "SELECT count(name) FROM sqlite_master WHERE name='mail_partial_body_activity_tbl';";
-       /*  rc = sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL);   */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL), rc);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL), rc);
        EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql, rc, sqlite3_errmsg(local_db_handle)));
        
        if (atoi(result[1]) < 1) {
                
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "BEGIN;", NULL, NULL, NULL), rc);
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "BEGIN;", NULL, NULL, NULL), rc);
                EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {goto FINISH_OFF; },
                        ("SQL(BEGIN EXCLUSIVE) exec fail:%d -%s", rc, sqlite3_errmsg(local_db_handle)));
 
                EM_DEBUG_LOG("CREATE TABLE mail_partial_body_activity_tbl");
                
-               SNPRINTF(sql_query_string, sizeof(sql_query_string), create_table_query[CREATE_TABLE_MAIL_PARTIAL_BODY_ACTIVITY_TBL]);
+               EM_SAFE_STRNCPY(sql_query_string, create_table_query[CREATE_TABLE_MAIL_PARTIAL_BODY_ACTIVITY_TBL], sizeof(sql_query_string));
                
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                        ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "END;", NULL, NULL, NULL), rc);
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "END;", NULL, NULL, NULL), rc);
                
        } /*  mail_rule_tbl */
        else if (type == EMF_CREATE_DB_CHECK)  {                
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, g_test_query[CREATE_TABLE_MAIL_PARTIAL_BODY_ACTIVITY_TBL], NULL, NULL, NULL), rc);
-               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, g_test_query[CREATE_TABLE_MAIL_PARTIAL_BODY_ACTIVITY_TBL], NULL, NULL, NULL), rc);
+               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                        ("SQL(%s) exec fail:%d -%s", g_test_query[CREATE_TABLE_MAIL_PARTIAL_BODY_ACTIVITY_TBL], rc, sqlite3_errmsg(local_db_handle)));
        }
        sqlite3_free_table(result);
@@ -2105,49 +2148,47 @@ EXPORT_API int em_storage_create_table(emf_create_db_t type, int *err_code)
 
        /*  create mail_meeting_tbl */
        sql = "SELECT count(name) FROM sqlite_master WHERE name='mail_meeting_tbl';";
-       /*  rc = sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL);   */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL), rc);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL), rc);
        EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql, rc, sqlite3_errmsg(local_db_handle)));
        
        if (atoi(result[1]) < 1) {
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "BEGIN;", NULL, NULL, NULL), rc);
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "BEGIN;", NULL, NULL, NULL), rc);
                EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {goto FINISH_OFF; },
                        ("SQL(BEGIN EXCLUSIVE) exec fail:%d -%s", rc, sqlite3_errmsg(local_db_handle)));
                
                EM_DEBUG_LOG("CREATE TABLE mail_meeting_tbl");
                
-               SNPRINTF(sql_query_string, sizeof(sql_query_string), create_table_query[CREATE_TABLE_MAIL_MEETING_TBL]);
+               EM_SAFE_STRNCPY(sql_query_string, create_table_query[CREATE_TABLE_MAIL_MEETING_TBL], sizeof(sql_query_string));
                
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                        ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
                SNPRINTF(sql_query_string, sizeof(sql_query_string), "CREATE UNIQUE INDEX mail_meeting_idx1 ON mail_meeting_tbl (mail_id)");
                
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                        ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "END;", NULL, NULL, NULL), rc);
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "END;", NULL, NULL, NULL), rc);
                
        } /*  mail_contact_sync_tbl */
        else if (type == EMF_CREATE_DB_CHECK)  {                
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, g_test_query[CREATE_TABLE_MAIL_MEETING_TBL], NULL, NULL, NULL), rc);
-               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, g_test_query[CREATE_TABLE_MAIL_MEETING_TBL], NULL, NULL, NULL), rc);
+               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                        ("SQL(%s) exec fail:%d -%s", g_test_query[CREATE_TABLE_MAIL_MEETING_TBL], rc, sqlite3_errmsg(local_db_handle)));
        }
        sqlite3_free_table(result);
 
-#ifdef __LOCAL_ACTIVITY__
+#ifdef __FEATURE_LOCAL_ACTIVITY__
        
                sql = "SELECT count(name) FROM sqlite_master WHERE name='mail_local_activity_tbl';";
-               /*  rc = sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL);   */
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL), rc);
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL), rc);
                EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {goto FINISH_OFF; },
                        ("SQL(%s) sqlite3_get_table fail:%d -%s", sql, rc, sqlite3_errmsg(local_db_handle)));
                
                if (atoi(result[1]) < 1) {
                        
-                       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "BEGIN;", NULL, NULL, NULL), rc);
+                       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "BEGIN;", NULL, NULL, NULL), rc);
                        EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {goto FINISH_OFF; },
                                ("SQL(BEGIN EXCLUSIVE) exec fail:%d -%s", rc, sqlite3_errmsg(local_db_handle)));
        
@@ -2155,31 +2196,30 @@ EXPORT_API int em_storage_create_table(emf_create_db_t type, int *err_code)
                        
                        SNPRINTF(sql_query_string, sizeof(sql_query_string), create_table_query[CREATE_TABLE_MAIL_LOCAL_ACTIVITY_TBL]);
                        
-                       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-                       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+                       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+                       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                                ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
-                       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "END;", NULL, NULL, NULL), rc);
+                       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "END;", NULL, NULL, NULL), rc);
                        
                } /*  mail_rule_tbl */
                else if (type == EMF_CREATE_DB_CHECK)  {        
                        rc = sqlite3_exec(local_db_handle, g_test_query[CREATE_TABLE_MAIL_LOCAL_ACTIVITY_TBL], NULL, NULL, NULL);
-                       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, g_test_query[CREATE_TABLE_MAIL_LOCAL_ACTIVITY_TBL], NULL, NULL, NULL), rc);
-                       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+                       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, g_test_query[CREATE_TABLE_MAIL_LOCAL_ACTIVITY_TBL], NULL, NULL, NULL), rc);
+                       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                                ("SQL(%s) exec fail:%d -%s", g_test_query[CREATE_TABLE_MAIL_LOCAL_ACTIVITY_TBL], rc, sqlite3_errmsg(local_db_handle)));
                }
                sqlite3_free_table(result);
                
-#endif /*  __LOCAL_ACTIVITY__ */
+#endif /*  __FEATURE_LOCAL_ACTIVITY__ */
 
        ret = true;
        
 FINISH_OFF:
        if (ret == true) {
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "END;", NULL, NULL, NULL), rc);
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "END;", NULL, NULL, NULL), rc);
        }
        else {
-               /*  sqlite3_exec(local_db_handle, "rollback", NULL, NULL, NULL); */
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "rollback", NULL, NULL, NULL), rc);
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "rollback", NULL, NULL, NULL), rc);
        }
  
        _DISCONNECT_DB;
@@ -2193,24 +2233,25 @@ FINISH_OFF:
 
 /* Query series --------------------------------------------------------------*/
 
-EXPORT_API int em_storage_query_mail_list(const char *conditional_clause, int transaction, emf_mail_list_item_t** result_mail_list,  int *result_count,  int *err_code)
+INTERNAL_FUNC int emstorage_query_mail_list(const char *conditional_clause, int transaction, emf_mail_list_item_t** result_mail_list,  int *result_count,  int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
-       EM_PROFILE_BEGIN(em_storage_query_mail_list_func);
+       EM_PROFILE_BEGIN(emstorage_query_mail_list_func);
                   
        int i = 0, count = 0, rc = -1, to_get_count = (result_mail_list)?0:1;
        int local_inline_content_count = 0, local_attachment_count = 0;
        int cur_query = 0, base_count = 0, col_index;
-       int ret = false, error = EM_STORAGE_ERROR_NONE;
-       emf_mail_list_item_t *mail_list_item_from_tbl = NULL;
+       int ret = false, error = EMF_ERROR_NONE;
+       char *date_time_string = NULL;
        char **result = NULL, sql_query_string[QUERY_SIZE] = {0, };
        char *field_list = "mail_id, account_id, mailbox_name, full_address_from, email_address_sender, full_address_to, subject, body_download_status, flags_seen_field, flags_deleted_field, flags_flagged_field, flags_answered_field, flags_recent_field, flags_draft_field, flags_forwarded_field, DRM_status, priority, save_status, lock_status, attachment_count, inline_content_count, date_time, preview_text, thread_id, thread_item_count, meeting_request_status ";
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       emf_mail_list_item_t *mail_list_item_from_tbl = NULL;
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
 
        EM_IF_NULL_RETURN_VALUE(conditional_clause, false);
        EM_IF_NULL_RETURN_VALUE(result_count, false);
 
-       EM_STORAGE_START_READ_TRANSACTION(transaction);
+       EMSTORAGE_START_READ_TRANSACTION(transaction);
        
        /*  select clause */
        if (to_get_count) /*  count only */
@@ -2218,16 +2259,16 @@ EXPORT_API int em_storage_query_mail_list(const char *conditional_clause, int tr
        else /*  mail list in plain form */
                cur_query += SNPRINTF_OFFSET(sql_query_string, cur_query, QUERY_SIZE, "SELECT %s FROM mail_tbl ", field_list);
 
-       cur_query += SNPRINTF_OFFSET(sql_query_string, cur_query, QUERY_SIZE, conditional_clause);
+       cur_query += SNPRINTF_OFFSET(sql_query_string, cur_query, QUERY_SIZE, conditional_clause, 0);
        
-       EM_DEBUG_LOG("em_storage_query_mail_list : query[%s].", sql_query_string);
+       EM_DEBUG_LOG("emstorage_query_mail_list : query[%s].", sql_query_string);
 
        /*  performing query            */      
-       EM_PROFILE_BEGIN(em_storage_query_mail_list_performing_query);
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, &count, 0, NULL), rc);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc && -1 != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
+       EM_PROFILE_BEGIN(emstorage_query_mail_list_performing_query);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, &count, 0, NULL), rc);
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc && -1 != rc), {error = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
-       EM_PROFILE_END(em_storage_query_mail_list_performing_query);
+       EM_PROFILE_END(emstorage_query_mail_list_performing_query);
        
        if (!base_count) 
                base_count = ({ int i=0; char *tmp = field_list; for (i=0; tmp && *(tmp + 1); tmp = index(tmp + 1, ','), i++); i; });
@@ -2246,50 +2287,51 @@ EXPORT_API int em_storage_query_mail_list(const char *conditional_clause, int tr
                if (!count) {
                        EM_DEBUG_EXCEPTION("No mail found...");                 
                        ret = false;
-                       error= EM_STORAGE_ERROR_MAIL_NOT_FOUND;
+                       error= EMF_ERROR_MAIL_NOT_FOUND;
                        goto FINISH_OFF;
                }
                
                EM_DEBUG_LOG("There are [%d] mails.", count);
-               if (!(mail_list_item_from_tbl = (emf_mail_list_item_t*)em_core_malloc(sizeof(emf_mail_list_item_t) * count))) {
+               if (!(mail_list_item_from_tbl = (emf_mail_list_item_t*)em_malloc(sizeof(emf_mail_list_item_t) * count))) {
                        EM_DEBUG_EXCEPTION("malloc for mail_list_item_from_tbl failed...");
-                       error = EM_STORAGE_ERROR_OUT_OF_MEMORY;
+                       error = EMF_ERROR_OUT_OF_MEMORY;
                        goto FINISH_OFF;
                }
 
-               EM_PROFILE_BEGIN(em_storage_query_mail_list_loop);
+               EM_PROFILE_BEGIN(emstorage_query_mail_list_loop);
                EM_DEBUG_LOG(">>>> DATA ASSIGN START >> ");     
                for (i = 0; i < count; i++) {
-                       _getTableFieldDataInt(result, &(mail_list_item_from_tbl[i].mail_id), col_index++);
-                       _getTableFieldDataInt(result, &(mail_list_item_from_tbl[i].account_id), col_index++);
-                       _getTableFieldDataStringWithoutAllocation(result, mail_list_item_from_tbl[i].mailbox_name, STRING_LENGTH_FOR_DISPLAY, 1, col_index++);
-                       _getTableFieldDataStringWithoutAllocation(result, mail_list_item_from_tbl[i].from, STRING_LENGTH_FOR_DISPLAY, 1, col_index++);
-                       _getTableFieldDataStringWithoutAllocation(result, mail_list_item_from_tbl[i].from_email_address, MAX_EMAIL_ADDRESS_LENGTH, 1, col_index++);
-                       _getTableFieldDataStringWithoutAllocation(result, mail_list_item_from_tbl[i].recipients, STRING_LENGTH_FOR_DISPLAY,  1, col_index++);                   
-                       _getTableFieldDataStringWithoutAllocation(result, mail_list_item_from_tbl[i].subject, STRING_LENGTH_FOR_DISPLAY, 1, col_index++);
-                       _getTableFieldDataInt(result, &(mail_list_item_from_tbl[i].is_text_downloaded), col_index++);
-                       _getTableFieldDataChar(result, &(mail_list_item_from_tbl[i].flags_seen_field), col_index++);
-                       _getTableFieldDataChar(result, &(mail_list_item_from_tbl[i].flags_deleted_field), col_index++);
-                       _getTableFieldDataChar(result, &(mail_list_item_from_tbl[i].flags_flagged_field), col_index++);
-                       _getTableFieldDataChar(result, &(mail_list_item_from_tbl[i].flags_answered_field), col_index++);
-                       _getTableFieldDataChar(result, &(mail_list_item_from_tbl[i].flags_recent_field), col_index++);
-                       _getTableFieldDataChar(result, &(mail_list_item_from_tbl[i].flags_draft_field), col_index++);
-                       _getTableFieldDataChar(result, &(mail_list_item_from_tbl[i].flags_forwarded_field), col_index++);
-                       _getTableFieldDataInt(result, &(mail_list_item_from_tbl[i].has_drm_attachment), col_index++);
-                       _getTableFieldDataInt(result, &(mail_list_item_from_tbl[i].priority), col_index++);
-                       _getTableFieldDataInt(result, &(mail_list_item_from_tbl[i].save_status), col_index++);
-                       _getTableFieldDataInt(result, &(mail_list_item_from_tbl[i].is_locked), col_index++);
-                       _getTableFieldDataInt(result, &local_attachment_count, col_index++);
-                       _getTableFieldDataInt(result, &local_inline_content_count, col_index++);
-                       _getTableFieldDataStringWithoutAllocation(result, mail_list_item_from_tbl[i].datetime, MAX_DATETIME_STRING_LENGTH, 0, col_index++);
-                       _getTableFieldDataStringWithoutAllocation(result, mail_list_item_from_tbl[i].previewBodyText, MAX_PREVIEW_TEXT_LENGTH, 1, col_index++);
-                       _getTableFieldDataInt(result, &(mail_list_item_from_tbl[i].thread_id), col_index++);
-                       _getTableFieldDataInt(result, &(mail_list_item_from_tbl[i].thread_item_count), col_index++);
-                       _getTableFieldDataInt(result, &(mail_list_item_from_tbl[i].is_meeting_request), col_index++);
+                       _get_table_field_data_int(result, &(mail_list_item_from_tbl[i].mail_id), col_index++);
+                       _get_table_field_data_int(result, &(mail_list_item_from_tbl[i].account_id), col_index++);
+                       _get_table_field_data_string_without_allocation(result, mail_list_item_from_tbl[i].mailbox_name, STRING_LENGTH_FOR_DISPLAY, 1, col_index++);
+                       _get_table_field_data_string_without_allocation(result, mail_list_item_from_tbl[i].from, STRING_LENGTH_FOR_DISPLAY, 1, col_index++);
+                       _get_table_field_data_string_without_allocation(result, mail_list_item_from_tbl[i].from_email_address, MAX_EMAIL_ADDRESS_LENGTH, 1, col_index++);
+                       _get_table_field_data_string_without_allocation(result, mail_list_item_from_tbl[i].recipients, STRING_LENGTH_FOR_DISPLAY,  1, col_index++);
+                       _get_table_field_data_string_without_allocation(result, mail_list_item_from_tbl[i].subject, STRING_LENGTH_FOR_DISPLAY, 1, col_index++);
+                       _get_table_field_data_int(result, &(mail_list_item_from_tbl[i].is_text_downloaded), col_index++);
+                       _get_table_field_data_char(result, &(mail_list_item_from_tbl[i].flags_seen_field), col_index++);
+                       _get_table_field_data_char(result, &(mail_list_item_from_tbl[i].flags_deleted_field), col_index++);
+                       _get_table_field_data_char(result, &(mail_list_item_from_tbl[i].flags_flagged_field), col_index++);
+                       _get_table_field_data_char(result, &(mail_list_item_from_tbl[i].flags_answered_field), col_index++);
+                       _get_table_field_data_char(result, &(mail_list_item_from_tbl[i].flags_recent_field), col_index++);
+                       _get_table_field_data_char(result, &(mail_list_item_from_tbl[i].flags_draft_field), col_index++);
+                       _get_table_field_data_char(result, &(mail_list_item_from_tbl[i].flags_forwarded_field), col_index++);
+                       _get_table_field_data_int(result, &(mail_list_item_from_tbl[i].has_drm_attachment), col_index++);
+                       _get_table_field_data_int(result, &(mail_list_item_from_tbl[i].priority), col_index++);
+                       _get_table_field_data_int(result, &(mail_list_item_from_tbl[i].save_status), col_index++);
+                       _get_table_field_data_int(result, &(mail_list_item_from_tbl[i].is_locked), col_index++);
+                       _get_table_field_data_int(result, &local_attachment_count, col_index++);
+                       _get_table_field_data_int(result, &local_inline_content_count, col_index++);
+                       _get_table_field_data_time_t(result, &(mail_list_item_from_tbl[i].date_time), col_index++);
+                       _get_table_field_data_string_without_allocation(result, mail_list_item_from_tbl[i].previewBodyText, MAX_PREVIEW_TEXT_LENGTH, 1, col_index++);
+                       _get_table_field_data_int(result, &(mail_list_item_from_tbl[i].thread_id), col_index++);
+                       _get_table_field_data_int(result, &(mail_list_item_from_tbl[i].thread_item_count), col_index++);
+                       _get_table_field_data_int(result, &(mail_list_item_from_tbl[i].is_meeting_request), col_index++);
+
                        mail_list_item_from_tbl[i].has_attachment = ((local_attachment_count - local_inline_content_count)>0)?1:0;
                }
                EM_DEBUG_LOG(">>>> DATA ASSIGN END [count : %d] >> ", count);
-               EM_PROFILE_END(em_storage_query_mail_list_loop);
+               EM_PROFILE_END(emstorage_query_mail_list_loop);
        }
 
        sqlite3_free_table(result);
@@ -2311,104 +2353,107 @@ FINISH_OFF:
                        EM_SAFE_FREE(mail_list_item_from_tbl);
        }
 
-       EM_STORAGE_FINISH_READ_TRANSACTION(transaction);
+       EMSTORAGE_FINISH_READ_TRANSACTION(transaction);
        _DISCONNECT_DB;
        
+       EM_SAFE_FREE(date_time_string);
+
        if (err_code != NULL)
                *err_code = error;
 
-       EM_PROFILE_END(em_storage_query_mail_list_func);
+       EM_PROFILE_END(emstorage_query_mail_list_func);
        EM_DEBUG_FUNC_END("ret [%d]", ret);
        return ret;
 }
 
 
-EXPORT_API int em_storage_query_mail_tbl(const char *conditional_clause, int transaction, emf_mail_tbl_t** result_mail_tbl, int *result_count, int *err_code)
+INTERNAL_FUNC int emstorage_query_mail_tbl(const char *conditional_clause, int transaction, emstorage_mail_tbl_t** result_mail_tbl, int *result_count, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("conditional_clause[%s], result_mail_tbl[%p], result_count [%p], transaction[%d], err_code[%p]", conditional_clause, result_mail_tbl, result_count, transaction, err_code);
 
        if (!conditional_clause) {
-               EM_DEBUG_EXCEPTION("EM_STORAGE_ERROR_INVALID_PARAM");
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
                
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
        int i, col_index = FIELD_COUNT_OF_EMF_MAIL_TBL, rc, ret = false, count;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        char **result = NULL, sql_query_string[QUERY_SIZE] = {0, };
-       emf_mail_tbl_t* p_data_tbl = NULL;
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       emstorage_mail_tbl_t* p_data_tbl = NULL;
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
 
-       EM_STORAGE_START_READ_TRANSACTION(transaction);
+       EMSTORAGE_START_READ_TRANSACTION(transaction);
 
        SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT * FROM mail_tbl %s", conditional_clause);
 
        EM_DEBUG_LOG("Query [%s]", sql_query_string);
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, &count, 0, NULL), rc);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc && -1 != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, &count, 0, NULL), rc);
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc && -1 != rc), {error = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        if (!count) {
                EM_DEBUG_EXCEPTION("No mail found...");                 
                ret = false;
-               error= EM_STORAGE_ERROR_MAIL_NOT_FOUND;
+               error= EMF_ERROR_MAIL_NOT_FOUND;
                goto FINISH_OFF;
        }
        
        EM_DEBUG_LOG("There are [%d] mails.", count);
-       if (!(p_data_tbl = (emf_mail_tbl_t*)em_core_malloc(sizeof(emf_mail_tbl_t) * count))) {
-               EM_DEBUG_EXCEPTION("malloc for emf_mail_tbl_t failed...");
-               error = EM_STORAGE_ERROR_OUT_OF_MEMORY;
+       if (!(p_data_tbl = (emstorage_mail_tbl_t*)em_malloc(sizeof(emstorage_mail_tbl_t) * count))) {
+               EM_DEBUG_EXCEPTION("malloc for emstorage_mail_tbl_t failed...");
+               error = EMF_ERROR_OUT_OF_MEMORY;
                goto FINISH_OFF;
        }
 
        EM_DEBUG_LOG(">>>> DATA ASSIGN START >> ");     
        for (i = 0; i < count; i++) {
-               _getTableFieldDataInt(result, &(p_data_tbl[i].mail_id), col_index++);
-               _getTableFieldDataInt(result, &(p_data_tbl[i].account_id), col_index++);
-               _getTableFieldDataString(result, &(p_data_tbl[i].mailbox_name), 0, col_index++);
-               _getTableFieldDataInt(result, &(p_data_tbl[i].mailbox_type), col_index++);
-               _getTableFieldDataString(result, &(p_data_tbl[i].subject), 1, col_index++);
-               _getTableFieldDataString(result, &(p_data_tbl[i].datetime), 0, col_index++);
-               _getTableFieldDataInt(result, &(p_data_tbl[i].server_mail_status), col_index++);
-               _getTableFieldDataString(result, &(p_data_tbl[i].server_mailbox_name), 0, col_index++);
-               _getTableFieldDataString(result, &(p_data_tbl[i].server_mail_id), 0, col_index++);
-               _getTableFieldDataString(result, &(p_data_tbl[i].message_id), 0, col_index++);
-               _getTableFieldDataString(result, &(p_data_tbl[i].full_address_from), 1, col_index++);
-               _getTableFieldDataString(result, &(p_data_tbl[i].full_address_reply), 1, col_index++);
-               _getTableFieldDataString(result, &(p_data_tbl[i].full_address_to), 1, col_index++);
-               _getTableFieldDataString(result, &(p_data_tbl[i].full_address_cc), 1, col_index++);
-               _getTableFieldDataString(result, &(p_data_tbl[i].full_address_bcc), 1, col_index++);
-               _getTableFieldDataString(result, &(p_data_tbl[i].full_address_return), 1, col_index++);
-               _getTableFieldDataString(result, &(p_data_tbl[i].email_address_sender), 1, col_index++);
-               _getTableFieldDataString(result, &(p_data_tbl[i].email_address_recipient), 1, col_index++);
-               _getTableFieldDataString(result, &(p_data_tbl[i].alias_sender), 1, col_index++);
-               _getTableFieldDataString(result, &(p_data_tbl[i].alias_recipient), 1, col_index++);
-               _getTableFieldDataInt(result, &(p_data_tbl[i].body_download_status), col_index++);
-               _getTableFieldDataString(result, &(p_data_tbl[i].file_path_plain), 0, col_index++);
-               _getTableFieldDataString(result, &(p_data_tbl[i].file_path_html), 0, col_index++);
-               _getTableFieldDataInt(result, &(p_data_tbl[i].mail_size), col_index++);
-               _getTableFieldDataChar(result, &(p_data_tbl[i].flags_seen_field), col_index++);
-               _getTableFieldDataChar(result, &(p_data_tbl[i].flags_deleted_field), col_index++);
-               _getTableFieldDataChar(result, &(p_data_tbl[i].flags_flagged_field), col_index++);
-               _getTableFieldDataChar(result, &(p_data_tbl[i].flags_answered_field), col_index++);
-               _getTableFieldDataChar(result, &(p_data_tbl[i].flags_recent_field), col_index++);
-               _getTableFieldDataChar(result, &(p_data_tbl[i].flags_draft_field), col_index++);
-               _getTableFieldDataChar(result, &(p_data_tbl[i].flags_forwarded_field), col_index++);
-               _getTableFieldDataInt(result, &(p_data_tbl[i].DRM_status), col_index++);
-               _getTableFieldDataInt(result, &(p_data_tbl[i].priority), col_index++);
-               _getTableFieldDataInt(result, &(p_data_tbl[i].save_status), col_index++);
-               _getTableFieldDataInt(result, &(p_data_tbl[i].lock_status), col_index++);
-               _getTableFieldDataInt(result, &(p_data_tbl[i].report_status), col_index++);
-               _getTableFieldDataInt(result, &(p_data_tbl[i].attachment_count), col_index++);
-               _getTableFieldDataInt(result, &(p_data_tbl[i].inline_content_count), col_index++);
-               _getTableFieldDataInt(result, &(p_data_tbl[i].thread_id), col_index++);
-               _getTableFieldDataInt(result, &(p_data_tbl[i].thread_item_count), col_index++);
-               _getTableFieldDataString(result, &(p_data_tbl[i].preview_text), 1, col_index++);
-               _getTableFieldDataInt(result, &(p_data_tbl[i].meeting_request_status), col_index++);
+               _get_table_field_data_int   (result, &(p_data_tbl[i].mail_id), col_index++);
+               _get_table_field_data_int   (result, &(p_data_tbl[i].account_id), col_index++);
+               _get_table_field_data_int   (result, &(p_data_tbl[i].mailbox_id), col_index++);
+               _get_table_field_data_string(result, &(p_data_tbl[i].mailbox_name), 0, col_index++);
+               _get_table_field_data_int   (result, &(p_data_tbl[i].mailbox_type), col_index++);
+               _get_table_field_data_string(result, &(p_data_tbl[i].subject), 1, col_index++);
+               _get_table_field_data_time_t (result, &(p_data_tbl[i].date_time), col_index++);
+               _get_table_field_data_int   (result, &(p_data_tbl[i].server_mail_status), col_index++);
+               _get_table_field_data_string(result, &(p_data_tbl[i].server_mailbox_name), 0, col_index++);
+               _get_table_field_data_string(result, &(p_data_tbl[i].server_mail_id), 0, col_index++);
+               _get_table_field_data_string(result, &(p_data_tbl[i].message_id), 0, col_index++);
+               _get_table_field_data_string(result, &(p_data_tbl[i].full_address_from), 1, col_index++);
+               _get_table_field_data_string(result, &(p_data_tbl[i].full_address_reply), 1, col_index++);
+               _get_table_field_data_string(result, &(p_data_tbl[i].full_address_to), 1, col_index++);
+               _get_table_field_data_string(result, &(p_data_tbl[i].full_address_cc), 1, col_index++);
+               _get_table_field_data_string(result, &(p_data_tbl[i].full_address_bcc), 1, col_index++);
+               _get_table_field_data_string(result, &(p_data_tbl[i].full_address_return), 1, col_index++);
+               _get_table_field_data_string(result, &(p_data_tbl[i].email_address_sender), 1, col_index++);
+               _get_table_field_data_string(result, &(p_data_tbl[i].email_address_recipient), 1, col_index++);
+               _get_table_field_data_string(result, &(p_data_tbl[i].alias_sender), 1, col_index++);
+               _get_table_field_data_string(result, &(p_data_tbl[i].alias_recipient), 1, col_index++);
+               _get_table_field_data_int   (result, &(p_data_tbl[i].body_download_status), col_index++);
+               _get_table_field_data_string(result, &(p_data_tbl[i].file_path_plain), 0, col_index++);
+               _get_table_field_data_string(result, &(p_data_tbl[i].file_path_html), 0, col_index++);
+               _get_table_field_data_int   (result, &(p_data_tbl[i].mail_size), col_index++);
+               _get_table_field_data_char  (result, &(p_data_tbl[i].flags_seen_field), col_index++);
+               _get_table_field_data_char  (result, &(p_data_tbl[i].flags_deleted_field), col_index++);
+               _get_table_field_data_char  (result, &(p_data_tbl[i].flags_flagged_field), col_index++);
+               _get_table_field_data_char  (result, &(p_data_tbl[i].flags_answered_field), col_index++);
+               _get_table_field_data_char  (result, &(p_data_tbl[i].flags_recent_field), col_index++);
+               _get_table_field_data_char  (result, &(p_data_tbl[i].flags_draft_field), col_index++);
+               _get_table_field_data_char  (result, &(p_data_tbl[i].flags_forwarded_field), col_index++);
+               _get_table_field_data_int   (result, &(p_data_tbl[i].DRM_status), col_index++);
+               _get_table_field_data_int   (result, &(p_data_tbl[i].priority), col_index++);
+               _get_table_field_data_int   (result, &(p_data_tbl[i].save_status), col_index++);
+               _get_table_field_data_int   (result, &(p_data_tbl[i].lock_status), col_index++);
+               _get_table_field_data_int   (result, &(p_data_tbl[i].report_status), col_index++);
+               _get_table_field_data_int   (result, &(p_data_tbl[i].attachment_count), col_index++);
+               _get_table_field_data_int   (result, &(p_data_tbl[i].inline_content_count), col_index++);
+               _get_table_field_data_int   (result, &(p_data_tbl[i].thread_id), col_index++);
+               _get_table_field_data_int   (result, &(p_data_tbl[i].thread_item_count), col_index++);
+               _get_table_field_data_string(result, &(p_data_tbl[i].preview_text), 1, col_index++);
+               _get_table_field_data_int   (result, &(p_data_tbl[i].meeting_request_status), col_index++);
                /*  check real body file... */
                if (p_data_tbl[i].body_download_status) {
                        struct stat buf;
@@ -2444,7 +2489,7 @@ FINISH_OFF:
        else 
                EM_SAFE_FREE(p_data_tbl);
        
-       EM_STORAGE_FINISH_READ_TRANSACTION(transaction);
+       EMSTORAGE_FINISH_READ_TRANSACTION(transaction);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -2457,24 +2502,24 @@ FINISH_OFF:
 
 /* Query series --------------------------------------------------------------*/
 
-EXPORT_API int em_storage_check_duplicated_account(emf_account_t* account, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_check_duplicated_account(emf_account_t* account, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
        
        if (!account)  {
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
        int rc = -1, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        char **result;
        int count;
        char sql_query_string[QUERY_SIZE] = {0, };
 
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_READ_TRANSACTION(transaction);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_READ_TRANSACTION(transaction);
 
        SNPRINTF(sql_query_string, sizeof(sql_query_string),
                "SELECT COUNT(*) FROM mail_account_tbl "
@@ -2491,9 +2536,8 @@ EXPORT_API int em_storage_check_duplicated_account(emf_account_t* account, int t
                account->sending_user, account->sending_server_type, account->sending_server_addr
        );
        EM_DEBUG_LOG("Query[%s]", sql_query_string);
-       /* rc = sqlite3_get_table(local_db_handle, sql_query_string, &result, NULL, NULL, NULL); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        count = atoi(result[1]);
@@ -2508,12 +2552,12 @@ EXPORT_API int em_storage_check_duplicated_account(emf_account_t* account, int t
        else {  /*  duplicated account */
                ret = false;
                EM_DEBUG_LOG("The same account already exists. Duplicated account: email_addr[%s]", account->email_addr);
-               error = EM_STORAGE_ERROR_ALREADY_EXISTS;
+               error = EMF_ERROR_ALREADY_EXISTS;
        }
        
 FINISH_OFF:
 
-       EM_STORAGE_FINISH_READ_TRANSACTION(transaction);
+       EMSTORAGE_FINISH_READ_TRANSACTION(transaction);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -2524,36 +2568,34 @@ FINISH_OFF:
 
 }
 
-EXPORT_API int em_storage_get_account_count(int *count, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_get_account_count(int *count, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
        
        if (!count)  {
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
        int rc = -1, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
  
        DB_STMT hStmt = NULL;
        char sql_query_string[QUERY_SIZE] = {0, };
        char err_msg[1024];
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_READ_TRANSACTION(transaction);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_READ_TRANSACTION(transaction);
        SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT COUNT(*) FROM mail_account_tbl");
        EM_DEBUG_LOG("SQL STMT [ %s ]", sql_query_string);
-       /*  rc = sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL);   */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
        EM_DEBUG_LOG("Before sqlite3_prepare hStmt = %p", hStmt);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
        
        *count = sqlite3_column_int(hStmt, 0);
@@ -2569,12 +2611,12 @@ FINISH_OFF:
                hStmt=NULL;
                if (rc != SQLITE_OK)  {
                        EM_DEBUG_EXCEPTION("sqlite3_finalize failed - %d: %s", rc, err_msg);
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
                EM_DEBUG_LOG("sqlite3_finalize- %d", rc);
        }
  
-       EM_STORAGE_FINISH_READ_TRANSACTION(transaction);
+       EMSTORAGE_FINISH_READ_TRANSACTION(transaction);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -2585,33 +2627,32 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int em_storage_get_account_list(int *select_num, emf_mail_account_tbl_t** account_list, int transaction, int with_password, int *err_code)
+INTERNAL_FUNC int emstorage_get_account_list(int *select_num, emstorage_account_tbl_t** account_list, int transaction, int with_password, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
        
        int i = 0, count = 0, rc = -1, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
-       emf_mail_account_tbl_t *p_data_tbl = NULL;
+       int error = EMF_ERROR_NONE;
+       emstorage_account_tbl_t *p_data_tbl = NULL;
  
        DB_STMT hStmt = NULL;
 
        if (!select_num || !account_list)  {
                EM_DEBUG_EXCEPTION("select_num[%p], account_list[%p]", select_num, account_list);
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_READ_TRANSACTION(transaction);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_READ_TRANSACTION(transaction);
 
        char sql_query_string[QUERY_SIZE] = {0, };
        char *sql = "SELECT count(*) FROM mail_account_tbl;";
        char **result;
        
-       /*  rc = sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql, rc, sqlite3_errmsg(local_db_handle)));
 
        count = atoi(result[1]);
@@ -2619,87 +2660,85 @@ EXPORT_API int em_storage_get_account_list(int *select_num, emf_mail_account_tbl
 
        if (!count) {
                EM_DEBUG_EXCEPTION("no account found...");
-               error = EM_STORAGE_ERROR_ACCOUNT_NOT_FOUND;             
+               error = EMF_ERROR_ACCOUNT_NOT_FOUND;
                ret = true;
                goto FINISH_OFF;
        }
        EM_DEBUG_LOG("count = %d", rc);
        SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT * FROM mail_account_tbl ORDER BY account_id");
 
-       /*  rc = sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL);   */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
 
        EM_DEBUG_LOG("After sqlite3_prepare_v2 hStmt = %p", hStmt);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
        if (rc == SQLITE_DONE)  {
                EM_DEBUG_EXCEPTION("no account found...");
                
-               error = EM_STORAGE_ERROR_ACCOUNT_NOT_FOUND;
+               error = EMF_ERROR_ACCOUNT_NOT_FOUND;
                count = 0;
                ret = true;
                goto FINISH_OFF;
        }
 
-       if (!(p_data_tbl = (emf_mail_account_tbl_t*)malloc(sizeof(emf_mail_account_tbl_t) * count)))  {
+       if (!(p_data_tbl = (emstorage_account_tbl_t*)malloc(sizeof(emstorage_account_tbl_t) * count)))  {
                EM_DEBUG_EXCEPTION("malloc failed...");
-               error = EM_STORAGE_ERROR_OUT_OF_MEMORY;
+               error = EMF_ERROR_OUT_OF_MEMORY;
                goto FINISH_OFF;
        }
-       memset(p_data_tbl, 0x00, sizeof(emf_mail_account_tbl_t) * count);
+       memset(p_data_tbl, 0x00, sizeof(emstorage_account_tbl_t) * count);
        for (i = 0; i < count; i++)  {
                /*  get recordset */
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].account_bind_type), ACCOUNT_BIND_TYPE_IDX_IN_MAIL_ACCOUNT_TBL);
-               _getStmtFieldDataString(hStmt, &(p_data_tbl[i].account_name), 0, ACCOUNT_NAME_IDX_IN_MAIL_ACCOUNT_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].receiving_server_type), RECEIVING_SERVER_TYPE_TYPE_IDX_IN_MAIL_ACCOUNT_TBL);
-               _getStmtFieldDataString(hStmt, &(p_data_tbl[i].receiving_server_addr), 0, RECEIVING_SERVER_ADDR_IDX_IN_MAIL_ACCOUNT_TBL);
-               _getStmtFieldDataString(hStmt, &(p_data_tbl[i].email_addr), 0, EMAIL_ADDR_IDX_IN_MAIL_ACCOUNT_TBL);
-               _getStmtFieldDataString(hStmt, &(p_data_tbl[i].user_name), 0, USER_NAME_IDX_IN_MAIL_ACCOUNT_TBL);
-               _getStmtFieldDataString(hStmt, &(p_data_tbl[i].password), 0, PASSWORD_IDX_IN_MAIL_ACCOUNT_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].retrieval_mode), RETRIEVAL_MODE_IDX_IN_MAIL_ACCOUNT_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].port_num), PORT_NUM_IDX_IN_MAIL_ACCOUNT_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].use_security), USE_SECURITY_IDX_IN_MAIL_ACCOUNT_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].sending_server_type), SENDING_SERVER_TYPE_IDX_IN_MAIL_ACCOUNT_TBL);
-               _getStmtFieldDataString(hStmt, &(p_data_tbl[i].sending_server_addr), 0, SENDING_SERVER_ADDR_IDX_IN_MAIL_ACCOUNT_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].sending_port_num), SENDING_PORT_NUM_IDX_IN_MAIL_ACCOUNT_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].sending_auth), SENDING_AUTH_IDX_IN_MAIL_ACCOUNT_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].sending_security), SENDING_SECURITY_IDX_IN_MAIL_ACCOUNT_TBL);
-               _getStmtFieldDataString(hStmt, &(p_data_tbl[i].sending_user), 0, SENDING_USER_IDX_IN_MAIL_ACCOUNT_TBL);
-               _getStmtFieldDataString(hStmt, &(p_data_tbl[i].sending_password), 0, SENDING_PASSWORD_IDX_IN_MAIL_ACCOUNT_TBL);
-               _getStmtFieldDataString(hStmt, &(p_data_tbl[i].display_name), 0, DISPLAY_NAME_IDX_IN_MAIL_ACCOUNT_TBL);
-               _getStmtFieldDataString(hStmt, &(p_data_tbl[i].reply_to_addr), 0, REPLY_TO_ADDR_IDX_IN_MAIL_ACCOUNT_TBL);
-               _getStmtFieldDataString(hStmt, &(p_data_tbl[i].return_addr), 0, RETURN_ADDR_IDX_IN_MAIL_ACCOUNT_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].account_id), ACCOUNT_ID_IDX_IN_MAIL_ACCOUNT_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].keep_on_server), KEEP_ON_SERVER_IDX_IN_MAIL_ACCOUNT_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].flag1), FLAG1_IDX_IN_MAIL_ACCOUNT_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].flag2), FLAG2_IDX_IN_MAIL_ACCOUNT_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].pop_before_smtp), POP_BEFORE_SMTP_IDX_IN_MAIL_ACCOUNT_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].apop), APOP_IDX_IN_MAIL_ACCOUNT_TBL);
-               _getStmtFieldDataString(hStmt, &(p_data_tbl[i].logo_icon_path), 0, LOGO_ICON_PATH_IDX_IN_MAIL_ACCOUNT_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].preset_account), PRESET_ACCOUNT_IDX_IN_MAIL_ACCOUNT_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].target_storage), TARGET_STORAGE_IDX_IN_MAIL_ACCOUNT_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].check_interval), CHECK_INTERVAL_IDX_IN_MAIL_ACCOUNT_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].options.priority), PRIORITY_IDX_IN_MAIL_ACCOUNT_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].options.keep_local_copy), KEEP_LOCAL_COPY_IDX_IN_MAIL_ACCOUNT_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].options.req_delivery_receipt), REQ_DELIVERY_RECEIPT_IDX_IN_MAIL_ACCOUNT_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].options.req_read_receipt), REQ_READ_RECEIPT_IDX_IN_MAIL_ACCOUNT_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].options.download_limit), DOWNLOAD_LIMIT_IDX_IN_MAIL_ACCOUNT_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].options.block_address), BLOCK_ADDRESS_IDX_IN_MAIL_ACCOUNT_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].options.block_subject), BLOCK_SUBJECT_IDX_IN_MAIL_ACCOUNT_TBL);
-               _getStmtFieldDataString(hStmt, &(p_data_tbl[i].options.display_name_from), 0, DISPLAY_NAME_FROM_IDX_IN_MAIL_ACCOUNT_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].options.reply_with_body), REPLY_WITH_BODY_IDX_IN_MAIL_ACCOUNT_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].options.forward_with_files), FORWARD_WITH_FILES_IDX_IN_MAIL_ACCOUNT_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].options.add_myname_card), ADD_MYNAME_CARD_IDX_IN_MAIL_ACCOUNT_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].options.add_signature), ADD_SIGNATURE_IDX_IN_MAIL_ACCOUNT_TBL);
-               _getStmtFieldDataString(hStmt, &(p_data_tbl[i].options.signature), 0, SIGNATURE_IDX_IN_MAIL_ACCOUNT_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].options.add_my_address_to_bcc), ADD_MY_ADDRESS_TO_BCC_IDX_IN_MAIL_ACCOUNT_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].my_account_id), MY_ACCOUNT_ID_IDX_IN_MAIL_ACCOUNT_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].index_color), INDEX_COLOR_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].account_bind_type), ACCOUNT_BIND_TYPE_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_string(hStmt, &(p_data_tbl[i].account_name), 0, ACCOUNT_NAME_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].receiving_server_type), RECEIVING_SERVER_TYPE_TYPE_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_string(hStmt, &(p_data_tbl[i].receiving_server_addr), 0, RECEIVING_SERVER_ADDR_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_string(hStmt, &(p_data_tbl[i].email_addr), 0, EMAIL_ADDR_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_string(hStmt, &(p_data_tbl[i].user_name), 0, USER_NAME_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_string(hStmt, &(p_data_tbl[i].password), 0, PASSWORD_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].retrieval_mode), RETRIEVAL_MODE_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].port_num), PORT_NUM_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].use_security), USE_SECURITY_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].sending_server_type), SENDING_SERVER_TYPE_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_string(hStmt, &(p_data_tbl[i].sending_server_addr), 0, SENDING_SERVER_ADDR_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].sending_port_num), SENDING_PORT_NUM_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].sending_auth), SENDING_AUTH_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].sending_security), SENDING_SECURITY_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_string(hStmt, &(p_data_tbl[i].sending_user), 0, SENDING_USER_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_string(hStmt, &(p_data_tbl[i].sending_password), 0, SENDING_PASSWORD_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_string(hStmt, &(p_data_tbl[i].display_name), 0, DISPLAY_NAME_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_string(hStmt, &(p_data_tbl[i].reply_to_addr), 0, REPLY_TO_ADDR_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_string(hStmt, &(p_data_tbl[i].return_addr), 0, RETURN_ADDR_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].account_id), ACCOUNT_ID_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].keep_on_server), KEEP_ON_SERVER_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].flag1), FLAG1_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].flag2), FLAG2_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].pop_before_smtp), POP_BEFORE_SMTP_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].apop), APOP_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_string(hStmt, &(p_data_tbl[i].logo_icon_path), 0, LOGO_ICON_PATH_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].preset_account), PRESET_ACCOUNT_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].target_storage), TARGET_STORAGE_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].check_interval), CHECK_INTERVAL_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].options.priority), PRIORITY_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].options.keep_local_copy), KEEP_LOCAL_COPY_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].options.req_delivery_receipt), REQ_DELIVERY_RECEIPT_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].options.req_read_receipt), REQ_READ_RECEIPT_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].options.download_limit), DOWNLOAD_LIMIT_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].options.block_address), BLOCK_ADDRESS_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].options.block_subject), BLOCK_SUBJECT_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_string(hStmt, &(p_data_tbl[i].options.display_name_from), 0, DISPLAY_NAME_FROM_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].options.reply_with_body), REPLY_WITH_BODY_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].options.forward_with_files), FORWARD_WITH_FILES_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].options.add_myname_card), ADD_MYNAME_CARD_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].options.add_signature), ADD_SIGNATURE_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_string(hStmt, &(p_data_tbl[i].options.signature), 0, SIGNATURE_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].options.add_my_address_to_bcc), ADD_MY_ADDRESS_TO_BCC_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].my_account_id), MY_ACCOUNT_ID_IDX_IN_MAIL_ACCOUNT_TBL);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].index_color), INDEX_COLOR_IDX_IN_MAIL_ACCOUNT_TBL);
                if (with_password == true) {
                        /*  get password from the secure storage */
                        char recv_password_file_name[MAX_PW_FILE_NAME_LENGTH];/*  = p_data_tbl[i].password; */
@@ -2709,29 +2748,28 @@ EXPORT_API int em_storage_get_account_list(int *select_num, emf_mail_account_tbl
                        EM_SAFE_FREE(p_data_tbl[i].sending_password);
 
                        /*  get password file name */
-                       if ((error = em_storage_get_password_file_name(p_data_tbl[i].account_id, recv_password_file_name, send_password_file_name)) != EM_STORAGE_ERROR_NONE) {
-                               EM_DEBUG_EXCEPTION("em_storage_get_password_file_name failed.");
+                       if ((error = _get_password_file_name(p_data_tbl[i].account_id, recv_password_file_name, send_password_file_name)) != EMF_ERROR_NONE) {
+                               EM_DEBUG_EXCEPTION("_get_password_file_name failed.");
                                goto FINISH_OFF;
                        }
                                
                        /*  read password from secure storage */
-                       if ((error = em_storage_read_password_ss(recv_password_file_name, &(p_data_tbl[i].password))) < 0 ) {
-                               EM_DEBUG_EXCEPTION("em_storage_read_password_ss()  failed...");
+                       if ((error = _read_password_from_secure_storage(recv_password_file_name, &(p_data_tbl[i].password))) < 0 ) {
+                               EM_DEBUG_EXCEPTION("_read_password_from_secure_storage()  failed...");
                                goto FINISH_OFF;
                        }
                        EM_DEBUG_LOG("recv_password_file_name[%s], password[%s]", recv_password_file_name,  p_data_tbl[i].password);
                        
-                       if ((error = em_storage_read_password_ss(send_password_file_name, &(p_data_tbl[i].sending_password))) < 0) {
-                               EM_DEBUG_EXCEPTION("em_storage_read_password_ss()  failed...");
+                       if ((error = _read_password_from_secure_storage(send_password_file_name, &(p_data_tbl[i].sending_password))) < 0) {
+                               EM_DEBUG_EXCEPTION("_read_password_from_secure_storage()  failed...");
                                goto FINISH_OFF;
                        }
                        EM_DEBUG_LOG("send_password_file_name[%s], password[%s]", send_password_file_name,  p_data_tbl[i].sending_password);
                }
 
-               /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
                EM_DEBUG_LOG("after sqlite3_step(), i = %d, rc = %d.", i,  rc);
-               EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+               EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                        ("sqlite3_step fail:%d", rc));
        } 
        
@@ -2744,7 +2782,7 @@ FINISH_OFF:
                EM_DEBUG_LOG("COUNT : %d", count);
        }
        else if (p_data_tbl != NULL)
-               em_storage_free_account(&p_data_tbl, count, NULL);
+               emstorage_free_account(&p_data_tbl, count, NULL);
        if (hStmt != NULL)  {
                EM_DEBUG_LOG("Before sqlite3_finalize hStmt = %p", hStmt);
        
@@ -2752,11 +2790,11 @@ FINISH_OFF:
                hStmt = NULL;
                if (rc != SQLITE_OK)  {
                        EM_DEBUG_EXCEPTION("sqlite3_finalize failed - %d", rc);
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
        }
        
-       EM_STORAGE_FINISH_READ_TRANSACTION(transaction);
+       EMSTORAGE_FINISH_READ_TRANSACTION(transaction);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -2767,17 +2805,17 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int em_storage_get_maildata_by_servermailid(int account_id, char *server_mail_id, emf_mail_tbl_t** mail, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_get_maildata_by_servermailid(int account_id, char *server_mail_id, emstorage_mail_tbl_t** mail, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id [%d], server_mail_id[%s], mail[%p], transaction[%d], err_code[%p]", account_id, server_mail_id, mail, transaction, err_code);
        
-       int ret = false, error = EM_STORAGE_ERROR_NONE, result_count;
+       int ret = false, error = EMF_ERROR_NONE, result_count;
        char conditional_clause[QUERY_SIZE] = {0, };
-       emf_mail_tbl_t* p_data_tbl = NULL;
+       emstorage_mail_tbl_t* p_data_tbl = NULL;
 
        if (!server_mail_id || !mail) {
-               EM_DEBUG_EXCEPTION("EM_STORAGE_ERROR_INVALID_PARAM");
-               error = EM_STORAGE_ERROR_INVALID_PARAM;
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
+               error = EMF_ERROR_INVALID_PARAM;
                goto FINISH_OFF;
        }
        
@@ -2788,8 +2826,8 @@ EXPORT_API int em_storage_get_maildata_by_servermailid(int account_id, char *ser
 
        EM_DEBUG_LOG("conditional_clause [%s]", conditional_clause);
 
-       if(!em_storage_query_mail_tbl(conditional_clause, transaction, &p_data_tbl, &result_count, &error)) {
-               EM_DEBUG_EXCEPTION("em_storage_query_mail_tbl failed [%d]", error);
+       if(!emstorage_query_mail_tbl(conditional_clause, transaction, &p_data_tbl, &result_count, &error)) {
+               EM_DEBUG_EXCEPTION("emstorage_query_mail_tbl failed [%d]", error);
                goto FINISH_OFF;
        }
        
@@ -2807,20 +2845,20 @@ FINISH_OFF:
 }
 
 
-static int em_storage_write_conditional_clause_for_getting_mail_list(int account_id, const char *mailbox_name, emf_email_address_list_t* addr_list, int thread_id, int start_index, int limit_count, int search_type, const char *search_value, emf_sort_type_t sorting, char *conditional_clause_string, int buffer_size, int *err_code)
+static int _write_conditional_clause_for_getting_mail_list(int account_id, const char *mailbox_name, emf_email_address_list_t* addr_list, int thread_id, int start_index, int limit_count, int search_type, const char *search_value, emf_sort_type_t sorting, char *conditional_clause_string, int buffer_size, int *err_code)
 {
        int cur_clause = 0, conditional_clause_count = 0, i = 0;
 
        if (account_id < ALL_ACCOUNT) {
                EM_DEBUG_EXCEPTION("Invalid account_id [%d]", account_id);
-               EM_RETURN_ERR_CODE(err_code, EM_STORAGE_ERROR_INVALID_PARAM, false);
+               EM_RETURN_ERR_CODE(err_code, EMF_ERROR_INVALID_PARAM, false);
        }
 
        /*  where clause */
        if (account_id == ALL_ACCOUNT) {
                cur_clause += (conditional_clause_count++ == 0)?
-                       SNPRINTF_OFFSET(conditional_clause_string, cur_clause, buffer_size - cur_clause, " WHERE mailbox_type not in (3, 5, 7)"):
-                       SNPRINTF_OFFSET(conditional_clause_string, cur_clause, buffer_size - cur_clause, " AND mailbox_type not in (3, 5, 7)");
+                       SNPRINTF_OFFSET(conditional_clause_string, cur_clause, buffer_size - cur_clause, " WHERE mailbox_type not in (3, 5, 7, 8)"):
+                       SNPRINTF_OFFSET(conditional_clause_string, cur_clause, buffer_size - cur_clause, " AND mailbox_type not in (3, 5, 7, 8)");
        }
        else {
                cur_clause += (conditional_clause_count++ == 0)?
@@ -2835,8 +2873,8 @@ static int em_storage_write_conditional_clause_for_getting_mail_list(int account
        }
        else if(account_id != ALL_ACCOUNT) {
                cur_clause += (conditional_clause_count++ == 0)?
-                       SNPRINTF_OFFSET(conditional_clause_string, cur_clause, buffer_size - cur_clause, " WHERE mailbox_type not in (3, 5, 7)"):
-                       SNPRINTF_OFFSET(conditional_clause_string, cur_clause, buffer_size - cur_clause, " AND mailbox_type not in (3, 5, 7)");
+                       SNPRINTF_OFFSET(conditional_clause_string, cur_clause, buffer_size - cur_clause, " WHERE mailbox_type not in (3, 5, 7, 8)"):
+                       SNPRINTF_OFFSET(conditional_clause_string, cur_clause, buffer_size - cur_clause, " AND mailbox_type not in (3, 5, 7, 8)");
        }
 
        if (thread_id > 0) {
@@ -2949,30 +2987,30 @@ static int em_storage_write_conditional_clause_for_getting_mail_list(int account
 
 
 /**
-  *    em_storage_get_mail_list - Get the mail list information.
+  *    emstorage_get_mail_list - Get the mail list information.
   *    
   *
   */
-EXPORT_API int em_storage_get_mail_list(int account_id, const char *mailbox_name, emf_email_address_list_t* addr_list, int thread_id, int start_index, int limit_count, int search_type, const char *search_value, emf_sort_type_t sorting, int transaction, emf_mail_list_item_t** mail_list,  int *result_count,  int *err_code)
+INTERNAL_FUNC int emstorage_get_mail_list(int account_id, const char *mailbox_name, emf_email_address_list_t* addr_list, int thread_id, int start_index, int limit_count, int search_type, const char *search_value, emf_sort_type_t sorting, int transaction, emf_mail_list_item_t** mail_list,  int *result_count,  int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
-       EM_PROFILE_BEGIN(em_storage_get_mail_list_func);
+       EM_PROFILE_BEGIN(emstorage_get_mail_list_func);
 
-       int ret = false, error = EM_STORAGE_ERROR_NONE;
+       int ret = false, error = EMF_ERROR_NONE;
        char conditional_clause_string[QUERY_SIZE] = { 0, };
 
        if (account_id < ALL_ACCOUNT) {
                EM_DEBUG_EXCEPTION("Invalid account_id [%d]", account_id);
-               EM_RETURN_ERR_CODE(err_code, EM_STORAGE_ERROR_INVALID_PARAM, false);
+               EM_RETURN_ERR_CODE(err_code, EMF_ERROR_INVALID_PARAM, false);
        }
        EM_IF_NULL_RETURN_VALUE(result_count, false);
 
-       em_storage_write_conditional_clause_for_getting_mail_list(account_id, mailbox_name, addr_list, thread_id, start_index, limit_count, search_type, search_value, sorting, conditional_clause_string, QUERY_SIZE, &error);
+       _write_conditional_clause_for_getting_mail_list(account_id, mailbox_name, addr_list, thread_id, start_index, limit_count, search_type, search_value, sorting, conditional_clause_string, QUERY_SIZE, &error);
        
        EM_DEBUG_LOG("conditional_clause_string[%s].", conditional_clause_string);
 
-       if(!em_storage_query_mail_list(conditional_clause_string, transaction, mail_list, result_count, &error)) {
-               EM_DEBUG_EXCEPTION("em_storage_query_mail_list [%d]", error);
+       if(!emstorage_query_mail_list(conditional_clause_string, transaction, mail_list, result_count, &error)) {
+               EM_DEBUG_EXCEPTION("emstorage_query_mail_list [%d]", error);
                goto FINISH_OFF;
        }
 
@@ -2982,42 +3020,42 @@ FINISH_OFF:
        if (err_code != NULL)
                *err_code = error;
 
-       EM_PROFILE_END(em_storage_get_mail_list_func);
+       EM_PROFILE_END(emstorage_get_mail_list_func);
        EM_DEBUG_FUNC_END("ret [%d]", ret);
        return ret;
 }
 
 
 /**
-  *    em_storage_get_mails - Get the Mail list information based on mailbox_name name
+  *    emstorage_get_mails - Get the Mail list information based on mailbox_name name
   *    
   *
   */
-EXPORT_API int em_storage_get_mails(int account_id, const char *mailbox_name, emf_email_address_list_t* addr_list, int thread_id, int start_index, int limit_count, emf_sort_type_t sorting,  int transaction, emf_mail_tbl_t** mail_list, int *result_count, int *err_code)
+INTERNAL_FUNC int emstorage_get_mails(int account_id, const char *mailbox_name, emf_email_address_list_t* addr_list, int thread_id, int start_index, int limit_count, emf_sort_type_t sorting,  int transaction, emstorage_mail_tbl_t** mail_list, int *result_count, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
        EM_PROFILE_BEGIN(emStorageGetMails);
        
-       int count = 0, ret = false, error = EM_STORAGE_ERROR_NONE;      
-       emf_mail_tbl_t *p_data_tbl = NULL;
+       int count = 0, ret = false, error = EMF_ERROR_NONE;
+       emstorage_mail_tbl_t *p_data_tbl = NULL;
        char conditional_clause_string[QUERY_SIZE] = {0, };
 
        EM_IF_NULL_RETURN_VALUE(mail_list, false);
        EM_IF_NULL_RETURN_VALUE(result_count, false);
 
        if (!result_count || !mail_list || account_id < ALL_ACCOUNT) {
-               EM_DEBUG_EXCEPTION("EM_STORAGE_ERROR_INVALID_PARAM");
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
 
-       em_storage_write_conditional_clause_for_getting_mail_list(account_id, mailbox_name, addr_list, thread_id, start_index, limit_count, 0, NULL, sorting, conditional_clause_string, QUERY_SIZE, &error);
+       _write_conditional_clause_for_getting_mail_list(account_id, mailbox_name, addr_list, thread_id, start_index, limit_count, 0, NULL, sorting, conditional_clause_string, QUERY_SIZE, &error);
 
        EM_DEBUG_LOG("conditional_clause_string [%s]", conditional_clause_string);
 
-       if(!em_storage_query_mail_tbl(conditional_clause_string, transaction, &p_data_tbl, &count,  &error)) {
-               EM_DEBUG_EXCEPTION("em_storage_query_mail_tbl failed [%d]", error);
+       if(!emstorage_query_mail_tbl(conditional_clause_string, transaction, &p_data_tbl, &count,  &error)) {
+               EM_DEBUG_EXCEPTION("emstorage_query_mail_tbl failed [%d]", error);
                goto FINISH_OFF;
        }
 
@@ -3030,7 +3068,7 @@ FINISH_OFF:
                EM_DEBUG_LOG("COUNT : %d", count);
        }
        else if (p_data_tbl != NULL)
-               em_storage_free_mail(&p_data_tbl, count, NULL);
+               emstorage_free_mail(&p_data_tbl, count, NULL);
        
        if (err_code != NULL)
                *err_code = error;
@@ -3043,15 +3081,15 @@ FINISH_OFF:
 
 
 /**
-  *    em_storage_get_searched_mail_list - Get the mail list information after filtering
+  *    emstorage_get_searched_mail_list - Get the mail list information after filtering
   *    
   *
   */
-EXPORT_API int em_storage_get_searched_mail_list(int account_id, const char *mailbox_name, int thread_id, int search_type, const char *search_value, int start_index, int limit_count, emf_sort_type_t sorting, int transaction, emf_mail_list_item_t** mail_list,  int *result_count,  int *err_code)
+INTERNAL_FUNC int emstorage_get_searched_mail_list(int account_id, const char *mailbox_name, int thread_id, int search_type, const char *search_value, int start_index, int limit_count, emf_sort_type_t sorting, int transaction, emf_mail_list_item_t** mail_list,  int *result_count,  int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
        
-       int ret = false, error = EM_STORAGE_ERROR_NONE;
+       int ret = false, error = EMF_ERROR_NONE;
        char conditional_clause[QUERY_SIZE] = {0, };
        
        EM_IF_NULL_RETURN_VALUE(mail_list, false);
@@ -3059,23 +3097,23 @@ EXPORT_API int em_storage_get_searched_mail_list(int account_id, const char *mai
 
        if (!result_count || !mail_list || account_id < ALL_ACCOUNT) {
                EM_DEBUG_EXCEPTION("select_num[%p], Mail_list[%p]", result_count, mail_list);
-               error = EM_STORAGE_ERROR_INVALID_PARAM;
+               error = EMF_ERROR_INVALID_PARAM;
                goto FINISH_OFF;
        }
 
-       em_storage_write_conditional_clause_for_getting_mail_list(account_id, mailbox_name, NULL, thread_id, start_index, limit_count, search_type, search_value, sorting, conditional_clause, QUERY_SIZE, &error);
+       _write_conditional_clause_for_getting_mail_list(account_id, mailbox_name, NULL, thread_id, start_index, limit_count, search_type, search_value, sorting, conditional_clause, QUERY_SIZE, &error);
        
        EM_DEBUG_LOG("conditional_clause[%s]", conditional_clause);
 
-       if(!em_storage_query_mail_list(conditional_clause, transaction, mail_list, result_count, &error)) {
-               EM_DEBUG_EXCEPTION("em_storage_query_mail_list [%d]", error);
+       if(!emstorage_query_mail_list(conditional_clause, transaction, mail_list, result_count, &error)) {
+               EM_DEBUG_EXCEPTION("emstorage_query_mail_list [%d]", error);
                goto FINISH_OFF;
        }
 
        ret = true;
        
 FINISH_OFF:
-       EM_DEBUG_LOG("em_storage_get_searched_mail_list finish off");   
+       EM_DEBUG_LOG("emstorage_get_searched_mail_list finish off");    
        
        if (err_code != NULL)
                *err_code = error;
@@ -3085,38 +3123,38 @@ FINISH_OFF:
 }
 
 
-static int em_storage_get_password_file_name(int account_id, char *recv_password_file_name, char *send_password_file_name)
+static int _get_password_file_name(int account_id, char *recv_password_file_name, char *send_password_file_name)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d]", account_id);
 
        if (account_id <= 0 || !recv_password_file_name || !send_password_file_name)  {
                EM_DEBUG_EXCEPTION("Invalid parameter");
-               return EM_STORAGE_ERROR_INVALID_PARAM;
+               return EMF_ERROR_INVALID_PARAM;
        }
 
        sprintf(recv_password_file_name, ".email_account_%d_recv", account_id);
        sprintf(send_password_file_name, ".email_account_%d_send", account_id);
        EM_DEBUG_FUNC_END();
-       return EM_STORAGE_ERROR_NONE;
+       return EMF_ERROR_NONE;
 }
 
-static int em_storage_read_password_ss(char *file_name, char **password)
+static int _read_password_from_secure_storage(char *file_name, char **password)
 {
        EM_DEBUG_FUNC_BEGIN("file_name[%s], password[%p]", file_name, password);
 
        if (!file_name || !password) {
                EM_DEBUG_EXCEPTION("Invalid Parameter");
-               return EM_STORAGE_ERROR_INVALID_PARAM;
+               return EMF_ERROR_INVALID_PARAM;
        }       
 
        size_t buf_len = 0, read_len = 0;
        ssm_file_info_t sfi;
        char *temp_password = NULL;
-       int ret = EM_STORAGE_ERROR_NONE;
+       int ret = EMF_ERROR_NONE;
 
        if (ssm_getinfo(file_name, &sfi, SSM_FLAG_SECRET_OPERATION, NULL) < 0) {
                EM_DEBUG_EXCEPTION("ssm_getinfo() failed.");
-               ret = EM_STORAGE_ERROR_SYSTEM_FAILURE;
+               ret = EMF_ERROR_SYSTEM_FAILURE;
                goto FINISH_OFF;
        }
 
@@ -3125,14 +3163,14 @@ static int em_storage_read_password_ss(char *file_name, char **password)
        if ((temp_password = (char *)malloc(buf_len + 1)) == NULL) {
                EM_DEBUG_EXCEPTION("malloc failed...");
                
-               ret = EM_STORAGE_ERROR_OUT_OF_MEMORY;
+               ret = EMF_ERROR_OUT_OF_MEMORY;
                goto FINISH_OFF;
        }
        memset(temp_password, 0x00, buf_len + 1);
 
        if (ssm_read(file_name, temp_password, buf_len, &read_len, SSM_FLAG_SECRET_OPERATION, NULL) < 0) {
                EM_DEBUG_EXCEPTION("ssm_read() failed.");
-               ret = EM_STORAGE_ERROR_SYSTEM_FAILURE;
+               ret = EMF_ERROR_SYSTEM_FAILURE;
                goto FINISH_OFF;
        }
 
@@ -3149,20 +3187,20 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int em_storage_get_account_by_id(int account_id, int pulloption, emf_mail_account_tbl_t **account, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_get_account_by_id(int account_id, int pulloption, emstorage_account_tbl_t **account, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], pulloption[%d], account[%p], transaction[%d], err_code[%p]", account_id, pulloption, account, transaction, err_code);
 
        if (!account)  {
                EM_DEBUG_EXCEPTION("account_id[%d], account[%p]", account_id, account);
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
 
        int ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
-       emf_mail_account_tbl_t* p_data_tbl = NULL;
+       int error = EMF_ERROR_NONE;
+       emstorage_account_tbl_t* p_data_tbl = NULL;
        DB_STMT hStmt = NULL;
        char sql_query_string[QUERY_SIZE] = {0, };
        int rc = -1;
@@ -3170,8 +3208,8 @@ EXPORT_API int em_storage_get_account_by_id(int account_id, int pulloption, emf_
        char recv_password_file_name[MAX_PW_FILE_NAME_LENGTH];
        char send_password_file_name[MAX_PW_FILE_NAME_LENGTH];
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_READ_TRANSACTION(transaction);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_READ_TRANSACTION(transaction);
 
        /*  Make query string */
        SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT ");
@@ -3202,102 +3240,102 @@ EXPORT_API int em_storage_get_account_by_id(int account_id, int pulloption, emf_
        EM_DEBUG_LOG("query = [%s]", sql_query_string);
 
        /*  execute a sql and count rows */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
 
        if (rc == SQLITE_DONE)  {
                EM_DEBUG_EXCEPTION("no matched account found...");
-               error = EM_STORAGE_ERROR_ACCOUNT_NOT_FOUND;
+               error = EMF_ERROR_ACCOUNT_NOT_FOUND;
                goto FINISH_OFF;
        }
 
        /*  Assign query result to structure */
-       if (!(p_data_tbl = (emf_mail_account_tbl_t *)malloc(sizeof(emf_mail_account_tbl_t) * 1)))  {
+       if (!(p_data_tbl = (emstorage_account_tbl_t *)malloc(sizeof(emstorage_account_tbl_t) * 1)))  {
                EM_DEBUG_EXCEPTION("malloc failed...");
-               error = EM_STORAGE_ERROR_OUT_OF_MEMORY;
+               error = EMF_ERROR_OUT_OF_MEMORY;
                goto FINISH_OFF;
        }
 
-       memset(p_data_tbl, 0x00, sizeof(emf_mail_account_tbl_t) * 1);
+       memset(p_data_tbl, 0x00, sizeof(emstorage_account_tbl_t) * 1);
        int col_index = 0;
 
        if (pulloption & EMF_ACC_GET_OPT_DEFAULT) {
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl->account_bind_type), col_index++);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl->receiving_server_type), col_index++);
-               _getStmtFieldDataString(hStmt, &(p_data_tbl->receiving_server_addr),  0, col_index++);
-               _getStmtFieldDataString(hStmt, &(p_data_tbl->email_addr), 0, col_index++);
-               _getStmtFieldDataString(hStmt, &(p_data_tbl->user_name), 0, col_index++);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl->retrieval_mode), col_index++);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl->port_num), col_index++);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl->use_security), col_index++);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl->sending_server_type), col_index++);
-               _getStmtFieldDataString(hStmt, &(p_data_tbl->sending_server_addr), 0, col_index++);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl->sending_port_num), col_index++);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl->sending_auth), col_index++);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl->sending_security), col_index++);
-               _getStmtFieldDataString(hStmt, &(p_data_tbl->sending_user), 0, col_index++);
-               _getStmtFieldDataString(hStmt, &(p_data_tbl->display_name), 0, col_index++);
-               _getStmtFieldDataString(hStmt, &(p_data_tbl->reply_to_addr), 0, col_index++);
-               _getStmtFieldDataString(hStmt, &(p_data_tbl->return_addr), 0, col_index++);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl->account_id), col_index++);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl->keep_on_server), col_index++);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl->flag1), col_index++);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl->flag2), col_index++);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl->pop_before_smtp), col_index++);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl->apop), col_index++);
-               _getStmtFieldDataString(hStmt, &(p_data_tbl->logo_icon_path), 0, col_index++);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl->preset_account), col_index++);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl->target_storage), col_index++);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl->check_interval), col_index++);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl->index_color), col_index++);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl->sync_status), col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl->account_bind_type), col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl->receiving_server_type), col_index++);
+               _get_stmt_field_data_string(hStmt, &(p_data_tbl->receiving_server_addr),  0, col_index++);
+               _get_stmt_field_data_string(hStmt, &(p_data_tbl->email_addr), 0, col_index++);
+               _get_stmt_field_data_string(hStmt, &(p_data_tbl->user_name), 0, col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl->retrieval_mode), col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl->port_num), col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl->use_security), col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl->sending_server_type), col_index++);
+               _get_stmt_field_data_string(hStmt, &(p_data_tbl->sending_server_addr), 0, col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl->sending_port_num), col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl->sending_auth), col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl->sending_security), col_index++);
+               _get_stmt_field_data_string(hStmt, &(p_data_tbl->sending_user), 0, col_index++);
+               _get_stmt_field_data_string(hStmt, &(p_data_tbl->display_name), 0, col_index++);
+               _get_stmt_field_data_string(hStmt, &(p_data_tbl->reply_to_addr), 0, col_index++);
+               _get_stmt_field_data_string(hStmt, &(p_data_tbl->return_addr), 0, col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl->account_id), col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl->keep_on_server), col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl->flag1), col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl->flag2), col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl->pop_before_smtp), col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl->apop), col_index++);
+               _get_stmt_field_data_string(hStmt, &(p_data_tbl->logo_icon_path), 0, col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl->preset_account), col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl->target_storage), col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl->check_interval), col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl->index_color), col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl->sync_status), col_index++);
        }
 
        if (pulloption & EMF_ACC_GET_OPT_ACCOUNT_NAME)
-               _getStmtFieldDataString(hStmt, &(p_data_tbl->account_name), 0, col_index++);
+               _get_stmt_field_data_string(hStmt, &(p_data_tbl->account_name), 0, col_index++);
 
        if (pulloption & EMF_ACC_GET_OPT_PASSWORD) {
                /*  get password file name */
-               if ((error = em_storage_get_password_file_name(p_data_tbl->account_id, recv_password_file_name, send_password_file_name)) != EM_STORAGE_ERROR_NONE) {
-                       EM_DEBUG_EXCEPTION("em_storage_get_password_file_name failed.");
+               if ((error = _get_password_file_name(p_data_tbl->account_id, recv_password_file_name, send_password_file_name)) != EMF_ERROR_NONE) {
+                       EM_DEBUG_EXCEPTION("_get_password_file_name failed.");
                        goto FINISH_OFF;
                }               
 
                /*  read password from secure storage */
-               if ((error = em_storage_read_password_ss(recv_password_file_name, &(p_data_tbl->password))) < 0) {
-                       EM_DEBUG_EXCEPTION(" em_storage_read_password_ss()  failed...");
+               if ((error = _read_password_from_secure_storage(recv_password_file_name, &(p_data_tbl->password))) < 0) {
+                       EM_DEBUG_EXCEPTION(" _read_password_from_secure_storage()  failed...");
                        goto FINISH_OFF;
                }
                EM_DEBUG_LOG("recv_password_file_name[%s], password[%s]", recv_password_file_name,  p_data_tbl->password);
                
-               if ((error = em_storage_read_password_ss(send_password_file_name, &(p_data_tbl->sending_password))) < 0) {
-                       EM_DEBUG_EXCEPTION(" em_storage_read_password_ss()  failed...");
+               if ((error = _read_password_from_secure_storage(send_password_file_name, &(p_data_tbl->sending_password))) < 0) {
+                       EM_DEBUG_EXCEPTION(" _read_password_from_secure_storage()  failed...");
                        goto FINISH_OFF;
                }
                EM_DEBUG_LOG("send_password_file_name[%s], password[%s]", send_password_file_name,  p_data_tbl->sending_password);
        }
 
        if (pulloption & EMF_ACC_GET_OPT_OPTIONS) {
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl->options.priority), col_index++);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl->options.keep_local_copy), col_index++);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl->options.req_delivery_receipt), col_index++);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl->options.req_read_receipt), col_index++);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl->options.download_limit), col_index++);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl->options.block_address), col_index++);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl->options.block_subject), col_index++);
-               _getStmtFieldDataString(hStmt, &(p_data_tbl->options.display_name_from), 0, col_index++);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl->options.reply_with_body), col_index++);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl->options.forward_with_files), col_index++);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl->options.add_myname_card), col_index++);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl->options.add_signature), col_index++);
-               _getStmtFieldDataString(hStmt, &(p_data_tbl->options.signature), 0, col_index++);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl->options.add_my_address_to_bcc), col_index++);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl->my_account_id), col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl->options.priority), col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl->options.keep_local_copy), col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl->options.req_delivery_receipt), col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl->options.req_read_receipt), col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl->options.download_limit), col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl->options.block_address), col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl->options.block_subject), col_index++);
+               _get_stmt_field_data_string(hStmt, &(p_data_tbl->options.display_name_from), 0, col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl->options.reply_with_body), col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl->options.forward_with_files), col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl->options.add_myname_card), col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl->options.add_signature), col_index++);
+               _get_stmt_field_data_string(hStmt, &(p_data_tbl->options.signature), 0, col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl->options.add_my_address_to_bcc), col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl->my_account_id), col_index++);
        }
 
        ret = true;
@@ -3307,17 +3345,17 @@ FINISH_OFF:
                *account = p_data_tbl;
        else {
                if (p_data_tbl)
-                       em_storage_free_account((emf_mail_account_tbl_t **)&p_data_tbl, 1, NULL);
+                       emstorage_free_account((emstorage_account_tbl_t **)&p_data_tbl, 1, NULL);
        }
        if (hStmt != NULL)  {
                rc = sqlite3_finalize(hStmt);
                if (rc != SQLITE_OK)  {
                        EM_DEBUG_EXCEPTION("sqlite3_finalize failed - %d", rc);
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
        }
        
-       EM_STORAGE_FINISH_READ_TRANSACTION(transaction);
+       EMSTORAGE_FINISH_READ_TRANSACTION(transaction);
        _DISCONNECT_DB;
 
        if (err_code != NULL)
@@ -3327,33 +3365,33 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_get_password_length_of_account(int account_id, int *password_length, int *err_code)
+INTERNAL_FUNC int emstorage_get_password_length_of_account(int account_id, int *password_length, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], password_length[%p], err_code[%p]", account_id, password_length, err_code);
 
        if (account_id <= 0 || password_length == NULL)  {
-               EM_DEBUG_EXCEPTION("EM_STORAGE_ERROR_INVALID_PARAM");
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
 
        int ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        char recv_password_file_name[MAX_PW_FILE_NAME_LENGTH];
        char send_password_file_name[MAX_PW_FILE_NAME_LENGTH];
        char *temp_password = NULL;
        
 
        /*  get password file name */
-       if ((error = em_storage_get_password_file_name(account_id, recv_password_file_name, send_password_file_name)) != EM_STORAGE_ERROR_NONE) {
-               EM_DEBUG_EXCEPTION("em_storage_get_password_file_name failed.");
+       if ((error = _get_password_file_name(account_id, recv_password_file_name, send_password_file_name)) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("_get_password_file_name failed.");
                goto FINISH_OFF;
        }               
 
        /*  read password from secure storage */
-       if ((error = em_storage_read_password_ss(recv_password_file_name, &temp_password)) < 0 || !temp_password) {
-               EM_DEBUG_EXCEPTION(" em_storage_read_password_ss()  failed...");
+       if ((error = _read_password_from_secure_storage(recv_password_file_name, &temp_password)) < 0 || !temp_password) {
+               EM_DEBUG_EXCEPTION(" _read_password_from_secure_storage()  failed...");
                goto FINISH_OFF;
        }
 
@@ -3373,18 +3411,18 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_update_account(int account_id, emf_mail_account_tbl_t* account, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_update_account(int account_id, emstorage_account_tbl_t* account, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], account[%p], transaction[%d], err_code[%p]", account_id, account, transaction, err_code);
        
        if (account_id < FIRST_ACCOUNT_ID || !account)  {
-               EM_DEBUG_EXCEPTION("EM_STORAGE_ERROR_INVALID_PARAM");
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        int rc, ret = false;
  
        DB_STMT hStmt = NULL;
@@ -3392,8 +3430,8 @@ EXPORT_API int em_storage_update_account(int account_id, emf_mail_account_tbl_t*
        char recv_password_file_name[MAX_PW_FILE_NAME_LENGTH];
        char send_password_file_name[MAX_PW_FILE_NAME_LENGTH];
 
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
                
        SNPRINTF(sql_query_string, sizeof(sql_query_string),
                "UPDATE mail_account_tbl SET"
@@ -3443,66 +3481,65 @@ EXPORT_API int em_storage_update_account(int account_id, emf_mail_account_tbl_t*
                ", sync_status = ?"                /*  Sync Status */
                " WHERE account_id = ?");        
  
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
        EM_DEBUG_LOG("After sqlite3_prepare hStmt = %p", hStmt);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
        
        int i = 0;
        
-       _bindStmtFieldDataInt(hStmt, i++, account->account_bind_type);
-       _bindStmtFieldDataString(hStmt, i++, (char *)account->account_name, 0, ACCOUNT_NAME_LEN_IN_MAIL_ACCOUNT_TBL);
-       _bindStmtFieldDataInt(hStmt, i++, account->receiving_server_type);
-       _bindStmtFieldDataString(hStmt, i++, (char *)account->receiving_server_addr, 0, RECEIVING_SERVER_ADDR_LEN_IN_MAIL_ACCOUNT_TBL);
-       _bindStmtFieldDataString(hStmt, i++, (char *)account->email_addr, 0, EMAIL_ADDR_LEN_IN_MAIL_ACCOUNT_TBL);
-       _bindStmtFieldDataString(hStmt, i++, (char *)account->user_name, 0, USER_NAME_LEN_IN_MAIL_ACCOUNT_TBL);
-       _bindStmtFieldDataInt(hStmt, i++, account->retrieval_mode);
-       _bindStmtFieldDataInt(hStmt, i++, account->port_num);
-       _bindStmtFieldDataInt(hStmt, i++, account->use_security);
-       _bindStmtFieldDataInt(hStmt, i++, account->sending_server_type);
-       _bindStmtFieldDataString(hStmt, i++, (char *)account->sending_server_addr, 0, SENDING_SERVER_ADDR_LEN_IN_MAIL_ACCOUNT_TBL);
-       _bindStmtFieldDataInt(hStmt, i++, account->sending_port_num);
-       _bindStmtFieldDataInt(hStmt, i++, account->sending_auth);
-       _bindStmtFieldDataInt(hStmt, i++, account->sending_security);
-       _bindStmtFieldDataString(hStmt, i++, (char *)account->sending_user, 0, SENDING_USER_LEN_IN_MAIL_ACCOUNT_TBL);
-       _bindStmtFieldDataString(hStmt, i++, (char *)account->display_name, 0, DISPLAY_NAME_LEN_IN_MAIL_ACCOUNT_TBL);
-       _bindStmtFieldDataString(hStmt, i++, (char *)account->reply_to_addr, 0, REPLY_TO_ADDR_LEN_IN_MAIL_ACCOUNT_TBL);
-       _bindStmtFieldDataString(hStmt, i++, (char *)account->return_addr, 0, RETURN_ADDR_LEN_IN_MAIL_ACCOUNT_TBL);
-       _bindStmtFieldDataInt(hStmt, i++, account->keep_on_server);
-       _bindStmtFieldDataInt(hStmt, i++, account->flag1);
-       _bindStmtFieldDataInt(hStmt, i++, account->flag2);
-       _bindStmtFieldDataInt(hStmt, i++, account->pop_before_smtp);
-       _bindStmtFieldDataInt(hStmt, i++, account->apop);
-       _bindStmtFieldDataString(hStmt, i++, account->logo_icon_path, 0, LOGO_ICON_PATH_LEN_IN_MAIL_ACCOUNT_TBL);
-       _bindStmtFieldDataInt(hStmt, i++, account->preset_account);
-       _bindStmtFieldDataInt(hStmt, i++, account->target_storage);
-       _bindStmtFieldDataInt(hStmt, i++, account->check_interval);
-       _bindStmtFieldDataInt(hStmt, i++, account->options.priority);
-       _bindStmtFieldDataInt(hStmt, i++, account->options.keep_local_copy);
-       _bindStmtFieldDataInt(hStmt, i++, account->options.req_delivery_receipt);
-       _bindStmtFieldDataInt(hStmt, i++, account->options.req_read_receipt);
-       _bindStmtFieldDataInt(hStmt, i++, account->options.download_limit);
-       _bindStmtFieldDataInt(hStmt, i++, account->options.block_address);
-       _bindStmtFieldDataInt(hStmt, i++, account->options.block_subject);
-       _bindStmtFieldDataString(hStmt, i++, account->options.display_name_from, 0, DISPLAY_NAME_FROM_LEN_IN_MAIL_ACCOUNT_TBL);
-       _bindStmtFieldDataInt(hStmt, i++, account->options.reply_with_body);
-       _bindStmtFieldDataInt(hStmt, i++, account->options.forward_with_files);
-       _bindStmtFieldDataInt(hStmt, i++, account->options.add_myname_card);
-       _bindStmtFieldDataInt(hStmt, i++, account->options.add_signature);
-       _bindStmtFieldDataString(hStmt, i++, account->options.signature, 0, SIGNATURE_LEN_IN_MAIL_ACCOUNT_TBL);
+       _bind_stmt_field_data_int(hStmt, i++, account->account_bind_type);
+       _bind_stmt_field_data_string(hStmt, i++, (char *)account->account_name, 0, ACCOUNT_NAME_LEN_IN_MAIL_ACCOUNT_TBL);
+       _bind_stmt_field_data_int(hStmt, i++, account->receiving_server_type);
+       _bind_stmt_field_data_string(hStmt, i++, (char *)account->receiving_server_addr, 0, RECEIVING_SERVER_ADDR_LEN_IN_MAIL_ACCOUNT_TBL);
+       _bind_stmt_field_data_string(hStmt, i++, (char *)account->email_addr, 0, EMAIL_ADDR_LEN_IN_MAIL_ACCOUNT_TBL);
+       _bind_stmt_field_data_string(hStmt, i++, (char *)account->user_name, 0, USER_NAME_LEN_IN_MAIL_ACCOUNT_TBL);
+       _bind_stmt_field_data_int(hStmt, i++, account->retrieval_mode);
+       _bind_stmt_field_data_int(hStmt, i++, account->port_num);
+       _bind_stmt_field_data_int(hStmt, i++, account->use_security);
+       _bind_stmt_field_data_int(hStmt, i++, account->sending_server_type);
+       _bind_stmt_field_data_string(hStmt, i++, (char *)account->sending_server_addr, 0, SENDING_SERVER_ADDR_LEN_IN_MAIL_ACCOUNT_TBL);
+       _bind_stmt_field_data_int(hStmt, i++, account->sending_port_num);
+       _bind_stmt_field_data_int(hStmt, i++, account->sending_auth);
+       _bind_stmt_field_data_int(hStmt, i++, account->sending_security);
+       _bind_stmt_field_data_string(hStmt, i++, (char *)account->sending_user, 0, SENDING_USER_LEN_IN_MAIL_ACCOUNT_TBL);
+       _bind_stmt_field_data_string(hStmt, i++, (char *)account->display_name, 0, DISPLAY_NAME_LEN_IN_MAIL_ACCOUNT_TBL);
+       _bind_stmt_field_data_string(hStmt, i++, (char *)account->reply_to_addr, 0, REPLY_TO_ADDR_LEN_IN_MAIL_ACCOUNT_TBL);
+       _bind_stmt_field_data_string(hStmt, i++, (char *)account->return_addr, 0, RETURN_ADDR_LEN_IN_MAIL_ACCOUNT_TBL);
+       _bind_stmt_field_data_int(hStmt, i++, account->keep_on_server);
+       _bind_stmt_field_data_int(hStmt, i++, account->flag1);
+       _bind_stmt_field_data_int(hStmt, i++, account->flag2);
+       _bind_stmt_field_data_int(hStmt, i++, account->pop_before_smtp);
+       _bind_stmt_field_data_int(hStmt, i++, account->apop);
+       _bind_stmt_field_data_string(hStmt, i++, account->logo_icon_path, 0, LOGO_ICON_PATH_LEN_IN_MAIL_ACCOUNT_TBL);
+       _bind_stmt_field_data_int(hStmt, i++, account->preset_account);
+       _bind_stmt_field_data_int(hStmt, i++, account->target_storage);
+       _bind_stmt_field_data_int(hStmt, i++, account->check_interval);
+       _bind_stmt_field_data_int(hStmt, i++, account->options.priority);
+       _bind_stmt_field_data_int(hStmt, i++, account->options.keep_local_copy);
+       _bind_stmt_field_data_int(hStmt, i++, account->options.req_delivery_receipt);
+       _bind_stmt_field_data_int(hStmt, i++, account->options.req_read_receipt);
+       _bind_stmt_field_data_int(hStmt, i++, account->options.download_limit);
+       _bind_stmt_field_data_int(hStmt, i++, account->options.block_address);
+       _bind_stmt_field_data_int(hStmt, i++, account->options.block_subject);
+       _bind_stmt_field_data_string(hStmt, i++, account->options.display_name_from, 0, DISPLAY_NAME_FROM_LEN_IN_MAIL_ACCOUNT_TBL);
+       _bind_stmt_field_data_int(hStmt, i++, account->options.reply_with_body);
+       _bind_stmt_field_data_int(hStmt, i++, account->options.forward_with_files);
+       _bind_stmt_field_data_int(hStmt, i++, account->options.add_myname_card);
+       _bind_stmt_field_data_int(hStmt, i++, account->options.add_signature);
+       _bind_stmt_field_data_string(hStmt, i++, account->options.signature, 0, SIGNATURE_LEN_IN_MAIL_ACCOUNT_TBL);
        if (account->options.add_my_address_to_bcc != 0)
                account->options.add_my_address_to_bcc = 1;
-       _bindStmtFieldDataInt(hStmt, i++, account->options.add_my_address_to_bcc);
-       _bindStmtFieldDataInt(hStmt, i++, account->my_account_id);
-       _bindStmtFieldDataInt(hStmt, i++, account->index_color);
-       _bindStmtFieldDataInt(hStmt, i++, account->sync_status);
-       _bindStmtFieldDataInt(hStmt, i++, account_id);
+       _bind_stmt_field_data_int(hStmt, i++, account->options.add_my_address_to_bcc);
+       _bind_stmt_field_data_int(hStmt, i++, account->my_account_id);
+       _bind_stmt_field_data_int(hStmt, i++, account->index_color);
+       _bind_stmt_field_data_int(hStmt, i++, account->sync_status);
+       _bind_stmt_field_data_int(hStmt, i++, account_id);
  
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((SQLITE_FULL == rc), {error = EM_STORAGE_ERROR_DB_IS_FULL;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+       EM_DEBUG_DB_EXEC((SQLITE_FULL == rc), {error = EMF_ERROR_MAIL_MEMORY_FULL;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
        
        /*  validate account existence */
@@ -3510,13 +3547,13 @@ EXPORT_API int em_storage_update_account(int account_id, emf_mail_account_tbl_t*
        if (rc == 0) {
                EM_DEBUG_EXCEPTION(" no matched account found...");
        
-               error = EM_STORAGE_ERROR_ACCOUNT_NOT_FOUND;
+               error = EMF_ERROR_ACCOUNT_NOT_FOUND;
                goto FINISH_OFF;
        }
        
        /*  get password file name */
-       if ((error = em_storage_get_password_file_name(account_id, recv_password_file_name, send_password_file_name)) != EM_STORAGE_ERROR_NONE) {
-               EM_DEBUG_EXCEPTION("em_storage_get_password_file_name failed.");
+       if ((error = _get_password_file_name(account_id, recv_password_file_name, send_password_file_name)) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("_get_password_file_name failed.");
                goto FINISH_OFF;
        }
 
@@ -3525,7 +3562,7 @@ EXPORT_API int em_storage_update_account(int account_id, emf_mail_account_tbl_t*
        if (account->password && (strlen(account->password) > 0)) {
                if (ssm_write_buffer(account->password, strlen(account->password), recv_password_file_name, SSM_FLAG_SECRET_OPERATION, NULL) < 0) {
                        EM_DEBUG_EXCEPTION(" ssm_write_buffer failed -recv password : file[%s]", recv_password_file_name);
-                       error = EM_STORAGE_ERROR_SYSTEM_FAILURE;
+                       error = EMF_ERROR_SYSTEM_FAILURE;
                        goto FINISH_OFF;                
                }
        }
@@ -3533,13 +3570,13 @@ EXPORT_API int em_storage_update_account(int account_id, emf_mail_account_tbl_t*
        if (account->sending_password && (strlen(account->sending_password) > 0)) {
                if (ssm_write_buffer(account->sending_password, strlen(account->sending_password), send_password_file_name, SSM_FLAG_SECRET_OPERATION, NULL) < 0) {
                        EM_DEBUG_EXCEPTION(" ssm_write_buffer failed -send password : file[%s]", send_password_file_name);
-                       error = EM_STORAGE_ERROR_SYSTEM_FAILURE;
+                       error = EMF_ERROR_SYSTEM_FAILURE;
                        goto FINISH_OFF;                
                }
        }
        
-       if (!em_storage_notify_storage_event(NOTI_ACCOUNT_UPDATE, account->account_id, 0, NULL, 0))
-               EM_DEBUG_EXCEPTION(" em_storage_notify_storage_event[ NOTI_ACCOUNT_UPDATE] : Notification Failed >>> ");
+       if (!emstorage_notify_storage_event(NOTI_ACCOUNT_UPDATE, account->account_id, 0, NULL, 0))
+               EM_DEBUG_EXCEPTION(" emstorage_notify_storage_event[ NOTI_ACCOUNT_UPDATE] : Notification Failed >>> ");
        ret = true;
        
 FINISH_OFF:
@@ -3550,11 +3587,11 @@ FINISH_OFF:
                rc = sqlite3_finalize(hStmt);
                if (rc != SQLITE_OK)  {
                        EM_DEBUG_LOG(" sqlite3_finalize failed - %d", rc);
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
        }
 
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        
        _DISCONNECT_DB;
        
@@ -3565,34 +3602,34 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_get_sync_status_of_account(int account_id, int *result_sync_status,int *err_code) 
+INTERNAL_FUNC int emstorage_get_sync_status_of_account(int account_id, int *result_sync_status,int *err_code) 
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], result_sync_status [%p], err_code[%p]", account_id, result_sync_status, err_code);
 
        if(!result_sync_status) {
-               EM_DEBUG_EXCEPTION("EM_STORAGE_ERROR_INVALID_PARAM");
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
-       int error = EM_STORAGE_ERROR_NONE, rc, ret = false, sync_status, count, i, col_index;
+       int error = EMF_ERROR_NONE, rc, ret = false, sync_status, count, i, col_index;
        char sql_query_string[QUERY_SIZE] = {0, };
        char **result = NULL;
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
 
        if(account_id)
                SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT sync_status FROM mail_account_tbl WHERE account_id = %d", account_id);      
        else
                SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT sync_status FROM mail_account_tbl");       
  
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, &count, 0, NULL), rc);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc && -1 != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, &count, 0, NULL), rc);
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc && -1 != rc), {error = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        if (!count) {
                EM_DEBUG_EXCEPTION("no matched account found...");
-               error = EM_STORAGE_ERROR_ACCOUNT_NOT_FOUND;
+               error = EMF_ERROR_ACCOUNT_NOT_FOUND;
                goto FINISH_OFF;
        }
 
@@ -3600,7 +3637,7 @@ EXPORT_API int em_storage_get_sync_status_of_account(int account_id, int *result
        *result_sync_status = 0;
 
        for(i = 0; i < count; i++) {
-               _getTableFieldDataInt(result, &sync_status, col_index++);
+               _get_table_field_data_int(result, &sync_status, col_index++);
                *result_sync_status |= sync_status;
        }
        
@@ -3621,17 +3658,17 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_update_sync_status_of_account(int account_id, emf_set_type_t set_operator, int sync_status, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_update_sync_status_of_account(int account_id, emstorage_set_type_t set_operator, int sync_status, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], set_operator[%d], sync_status [%d], transaction[%d], err_code[%p]", account_id, set_operator, sync_status, transaction, err_code);
        
-       int error = EM_STORAGE_ERROR_NONE, rc, ret = false, set_value = sync_status, result_sync_status;
+       int error = EMF_ERROR_NONE, rc, ret = false, set_value = sync_status, result_sync_status;
        char sql_query_string[QUERY_SIZE] = {0, };
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
 
        if(set_operator != SET_TYPE_SET && account_id) {
-               if(!em_storage_get_sync_status_of_account(account_id, &result_sync_status, &error)) {
-                       EM_DEBUG_EXCEPTION("em_storage_get_sync_status_of_account failed [%d]", error);
+               if(!emstorage_get_sync_status_of_account(account_id, &result_sync_status, &error)) {
+                       EM_DEBUG_EXCEPTION("emstorage_get_sync_status_of_account failed [%d]", error);
                        goto FINISH_OFF;
                }
                switch(set_operator) {
@@ -3649,7 +3686,7 @@ EXPORT_API int em_storage_update_sync_status_of_account(int account_id, emf_set_
                EM_DEBUG_LOG("set_value [%d]", set_value);
        }
 
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
 
        if(account_id)
                SNPRINTF(sql_query_string, sizeof(sql_query_string), "UPDATE mail_account_tbl SET sync_status = %d WHERE account_id = %d", set_value, account_id);       
@@ -3658,25 +3695,25 @@ EXPORT_API int em_storage_update_sync_status_of_account(int account_id, emf_set_
 
        EM_DEBUG_LOG("sql_query_string [%s]", sql_query_string);
  
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
        
        rc = sqlite3_changes(local_db_handle);
 
        if (rc == 0) {
                EM_DEBUG_EXCEPTION("no matched account found...");
-               error = EM_STORAGE_ERROR_ACCOUNT_NOT_FOUND;
+               error = EMF_ERROR_ACCOUNT_NOT_FOUND;
                goto FINISH_OFF;
        }
        
-       if (!em_storage_notify_storage_event(NOTI_ACCOUNT_UPDATE_SYNC_STATUS, account_id, 0, NULL, 0))
-               EM_DEBUG_EXCEPTION("em_storage_notify_storage_event[NOTI_ACCOUNT_UPDATE_SYNC_STATUS] : Notification failed");
+       if (!emstorage_notify_storage_event(NOTI_ACCOUNT_UPDATE_SYNC_STATUS, account_id, 0, NULL, 0))
+               EM_DEBUG_EXCEPTION("emstorage_notify_storage_event[NOTI_ACCOUNT_UPDATE_SYNC_STATUS] : Notification failed");
        ret = true;
        
 FINISH_OFF:
 
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        
        _DISCONNECT_DB;
        
@@ -3687,34 +3724,33 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_add_account(emf_mail_account_tbl_t* account, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_add_account(emstorage_account_tbl_t* account, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account[%p], transaction[%d], err_code[%p]", account, transaction, err_code);
        
        if (!account)  {
                EM_DEBUG_EXCEPTION("account[%p], transaction[%d], err_code[%p]", account, transaction, err_code);
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
        int rc = -1, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        DB_STMT hStmt = NULL;
        char sql_query_string[QUERY_SIZE] = {0, };
        char recv_password_file_name[MAX_PW_FILE_NAME_LENGTH];
        char send_password_file_name[MAX_PW_FILE_NAME_LENGTH];
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
 
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
 
        char *sql = "SELECT max(rowid) FROM mail_account_tbl;";
        char **result = NULL;
        
-       /*  rc = sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql, rc, sqlite3_errmsg(local_db_handle)));
 
        if (NULL==result[1]) rc = 1;
@@ -3724,8 +3760,8 @@ EXPORT_API int em_storage_add_account(emf_mail_account_tbl_t* account, int trans
 
        account->account_id = rc;
 
-       if ((error = em_storage_get_password_file_name(account->account_id, recv_password_file_name, send_password_file_name)) != EM_STORAGE_ERROR_NONE) {
-               EM_DEBUG_EXCEPTION("em_storage_get_password_file_name failed.");
+       if ((error = _get_password_file_name(account->account_id, recv_password_file_name, send_password_file_name)) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("_get_password_file_name failed.");
                goto FINISH_OFF;
        }
 
@@ -3784,67 +3820,66 @@ EXPORT_API int em_storage_add_account(emf_mail_account_tbl_t* account, int trans
        
  
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        EM_DEBUG_LOG(">>>> SQL STMT [ %s ] ", sql_query_string);
-       _bindStmtFieldDataInt(hStmt, ACCOUNT_BIND_TYPE_IDX_IN_MAIL_ACCOUNT_TBL, account->account_bind_type);
-       _bindStmtFieldDataString(hStmt, ACCOUNT_NAME_IDX_IN_MAIL_ACCOUNT_TBL, (char *)account->account_name, 0, ACCOUNT_NAME_LEN_IN_MAIL_ACCOUNT_TBL);
-       _bindStmtFieldDataInt(hStmt, RECEIVING_SERVER_TYPE_TYPE_IDX_IN_MAIL_ACCOUNT_TBL, account->receiving_server_type);
-       _bindStmtFieldDataString(hStmt, RECEIVING_SERVER_ADDR_IDX_IN_MAIL_ACCOUNT_TBL, (char *)account->receiving_server_addr, 0, RECEIVING_SERVER_ADDR_LEN_IN_MAIL_ACCOUNT_TBL);
-       _bindStmtFieldDataString(hStmt, EMAIL_ADDR_IDX_IN_MAIL_ACCOUNT_TBL, (char *)account->email_addr, 0, EMAIL_ADDR_LEN_IN_MAIL_ACCOUNT_TBL);
-       _bindStmtFieldDataString(hStmt, USER_NAME_IDX_IN_MAIL_ACCOUNT_TBL, (char *)account->user_name, 0, USER_NAME_LEN_IN_MAIL_ACCOUNT_TBL);
-       _bindStmtFieldDataString(hStmt, PASSWORD_IDX_IN_MAIL_ACCOUNT_TBL, (char *)"", 0, PASSWORD_LEN_IN_MAIL_ACCOUNT_TBL);
-       _bindStmtFieldDataInt(hStmt, RETRIEVAL_MODE_IDX_IN_MAIL_ACCOUNT_TBL, account->retrieval_mode);
-       _bindStmtFieldDataInt(hStmt, PORT_NUM_IDX_IN_MAIL_ACCOUNT_TBL, account->port_num);
-       _bindStmtFieldDataInt(hStmt, USE_SECURITY_IDX_IN_MAIL_ACCOUNT_TBL, account->use_security);
-       _bindStmtFieldDataInt(hStmt, SENDING_SERVER_TYPE_IDX_IN_MAIL_ACCOUNT_TBL, account->sending_server_type);
-       _bindStmtFieldDataString(hStmt, SENDING_SERVER_ADDR_IDX_IN_MAIL_ACCOUNT_TBL, (char *)account->sending_server_addr, 0, SENDING_SERVER_ADDR_LEN_IN_MAIL_ACCOUNT_TBL);
-       _bindStmtFieldDataInt(hStmt, SENDING_PORT_NUM_IDX_IN_MAIL_ACCOUNT_TBL, account->sending_port_num);
-       _bindStmtFieldDataInt(hStmt, SENDING_AUTH_IDX_IN_MAIL_ACCOUNT_TBL, account->sending_auth);
-       _bindStmtFieldDataInt(hStmt, SENDING_SECURITY_IDX_IN_MAIL_ACCOUNT_TBL, account->sending_security);
-       _bindStmtFieldDataString(hStmt, SENDING_USER_IDX_IN_MAIL_ACCOUNT_TBL, (char *)account->sending_user, 0, SENDING_USER_LEN_IN_MAIL_ACCOUNT_TBL);
-       _bindStmtFieldDataString(hStmt, SENDING_PASSWORD_IDX_IN_MAIL_ACCOUNT_TBL, (char *)"", 0, SENDING_PASSWORD_LEN_IN_MAIL_ACCOUNT_TBL);
-       _bindStmtFieldDataString(hStmt, DISPLAY_NAME_IDX_IN_MAIL_ACCOUNT_TBL, (char *)account->display_name, 0, DISPLAY_NAME_LEN_IN_MAIL_ACCOUNT_TBL);
-       _bindStmtFieldDataString(hStmt, REPLY_TO_ADDR_IDX_IN_MAIL_ACCOUNT_TBL, (char *)account->reply_to_addr, 0, REPLY_TO_ADDR_LEN_IN_MAIL_ACCOUNT_TBL);
-       _bindStmtFieldDataString(hStmt, RETURN_ADDR_IDX_IN_MAIL_ACCOUNT_TBL, (char *)account->return_addr, 0, RETURN_ADDR_LEN_IN_MAIL_ACCOUNT_TBL);
-       _bindStmtFieldDataInt(hStmt, ACCOUNT_ID_IDX_IN_MAIL_ACCOUNT_TBL, account->account_id);
-       _bindStmtFieldDataInt(hStmt, KEEP_ON_SERVER_IDX_IN_MAIL_ACCOUNT_TBL, account->keep_on_server);
-       _bindStmtFieldDataInt(hStmt, FLAG1_IDX_IN_MAIL_ACCOUNT_TBL, account->flag1);
-       _bindStmtFieldDataInt(hStmt, FLAG2_IDX_IN_MAIL_ACCOUNT_TBL, account->flag2);
-       _bindStmtFieldDataInt(hStmt, POP_BEFORE_SMTP_IDX_IN_MAIL_ACCOUNT_TBL, account->pop_before_smtp); /* POP before SMTP authentication [deepam.p@siso.com] */
-       _bindStmtFieldDataInt(hStmt, APOP_IDX_IN_MAIL_ACCOUNT_TBL, account->apop); /* APOP Support [deepam.p@siso.com] */
-       _bindStmtFieldDataString(hStmt, LOGO_ICON_PATH_IDX_IN_MAIL_ACCOUNT_TBL, account->logo_icon_path, 0, LOGO_ICON_PATH_LEN_IN_MAIL_ACCOUNT_TBL);
-       _bindStmtFieldDataInt(hStmt, PRESET_ACCOUNT_IDX_IN_MAIL_ACCOUNT_TBL, account->preset_account);
-       _bindStmtFieldDataInt(hStmt, TARGET_STORAGE_IDX_IN_MAIL_ACCOUNT_TBL, account->target_storage);
-       _bindStmtFieldDataInt(hStmt, CHECK_INTERVAL_IDX_IN_MAIL_ACCOUNT_TBL, account->check_interval);
-       _bindStmtFieldDataInt(hStmt, PRIORITY_IDX_IN_MAIL_ACCOUNT_TBL, account->options.priority);
-       _bindStmtFieldDataInt(hStmt, KEEP_LOCAL_COPY_IDX_IN_MAIL_ACCOUNT_TBL, account->options.keep_local_copy);
-       _bindStmtFieldDataInt(hStmt, REQ_DELIVERY_RECEIPT_IDX_IN_MAIL_ACCOUNT_TBL, account->options.req_delivery_receipt);
-       _bindStmtFieldDataInt(hStmt, REQ_READ_RECEIPT_IDX_IN_MAIL_ACCOUNT_TBL, account->options.req_read_receipt);
-       _bindStmtFieldDataInt(hStmt, DOWNLOAD_LIMIT_IDX_IN_MAIL_ACCOUNT_TBL, account->options.download_limit);
-       _bindStmtFieldDataInt(hStmt, BLOCK_ADDRESS_IDX_IN_MAIL_ACCOUNT_TBL, account->options.block_address);
-       _bindStmtFieldDataInt(hStmt, BLOCK_SUBJECT_IDX_IN_MAIL_ACCOUNT_TBL, account->options.block_subject);
-       _bindStmtFieldDataString(hStmt, DISPLAY_NAME_FROM_IDX_IN_MAIL_ACCOUNT_TBL, account->options.display_name_from, 0, DISPLAY_NAME_FROM_LEN_IN_MAIL_ACCOUNT_TBL);
-       _bindStmtFieldDataInt(hStmt, REPLY_WITH_BODY_IDX_IN_MAIL_ACCOUNT_TBL, account->options.reply_with_body);
-       _bindStmtFieldDataInt(hStmt, FORWARD_WITH_FILES_IDX_IN_MAIL_ACCOUNT_TBL, account->options.forward_with_files);
-       _bindStmtFieldDataInt(hStmt, ADD_MYNAME_CARD_IDX_IN_MAIL_ACCOUNT_TBL, account->options.add_myname_card);
-       _bindStmtFieldDataInt(hStmt, ADD_SIGNATURE_IDX_IN_MAIL_ACCOUNT_TBL, account->options.add_signature);
-       _bindStmtFieldDataString(hStmt, SIGNATURE_IDX_IN_MAIL_ACCOUNT_TBL, account->options.signature, 0, SIGNATURE_LEN_IN_MAIL_ACCOUNT_TBL);
+       _bind_stmt_field_data_int(hStmt, ACCOUNT_BIND_TYPE_IDX_IN_MAIL_ACCOUNT_TBL, account->account_bind_type);
+       _bind_stmt_field_data_string(hStmt, ACCOUNT_NAME_IDX_IN_MAIL_ACCOUNT_TBL, (char *)account->account_name, 0, ACCOUNT_NAME_LEN_IN_MAIL_ACCOUNT_TBL);
+       _bind_stmt_field_data_int(hStmt, RECEIVING_SERVER_TYPE_TYPE_IDX_IN_MAIL_ACCOUNT_TBL, account->receiving_server_type);
+       _bind_stmt_field_data_string(hStmt, RECEIVING_SERVER_ADDR_IDX_IN_MAIL_ACCOUNT_TBL, (char *)account->receiving_server_addr, 0, RECEIVING_SERVER_ADDR_LEN_IN_MAIL_ACCOUNT_TBL);
+       _bind_stmt_field_data_string(hStmt, EMAIL_ADDR_IDX_IN_MAIL_ACCOUNT_TBL, (char *)account->email_addr, 0, EMAIL_ADDR_LEN_IN_MAIL_ACCOUNT_TBL);
+       _bind_stmt_field_data_string(hStmt, USER_NAME_IDX_IN_MAIL_ACCOUNT_TBL, (char *)account->user_name, 0, USER_NAME_LEN_IN_MAIL_ACCOUNT_TBL);
+       _bind_stmt_field_data_string(hStmt, PASSWORD_IDX_IN_MAIL_ACCOUNT_TBL, (char *)"", 0, PASSWORD_LEN_IN_MAIL_ACCOUNT_TBL);
+       _bind_stmt_field_data_int(hStmt, RETRIEVAL_MODE_IDX_IN_MAIL_ACCOUNT_TBL, account->retrieval_mode);
+       _bind_stmt_field_data_int(hStmt, PORT_NUM_IDX_IN_MAIL_ACCOUNT_TBL, account->port_num);
+       _bind_stmt_field_data_int(hStmt, USE_SECURITY_IDX_IN_MAIL_ACCOUNT_TBL, account->use_security);
+       _bind_stmt_field_data_int(hStmt, SENDING_SERVER_TYPE_IDX_IN_MAIL_ACCOUNT_TBL, account->sending_server_type);
+       _bind_stmt_field_data_string(hStmt, SENDING_SERVER_ADDR_IDX_IN_MAIL_ACCOUNT_TBL, (char *)account->sending_server_addr, 0, SENDING_SERVER_ADDR_LEN_IN_MAIL_ACCOUNT_TBL);
+       _bind_stmt_field_data_int(hStmt, SENDING_PORT_NUM_IDX_IN_MAIL_ACCOUNT_TBL, account->sending_port_num);
+       _bind_stmt_field_data_int(hStmt, SENDING_AUTH_IDX_IN_MAIL_ACCOUNT_TBL, account->sending_auth);
+       _bind_stmt_field_data_int(hStmt, SENDING_SECURITY_IDX_IN_MAIL_ACCOUNT_TBL, account->sending_security);
+       _bind_stmt_field_data_string(hStmt, SENDING_USER_IDX_IN_MAIL_ACCOUNT_TBL, (char *)account->sending_user, 0, SENDING_USER_LEN_IN_MAIL_ACCOUNT_TBL);
+       _bind_stmt_field_data_string(hStmt, SENDING_PASSWORD_IDX_IN_MAIL_ACCOUNT_TBL, (char *)"", 0, SENDING_PASSWORD_LEN_IN_MAIL_ACCOUNT_TBL);
+       _bind_stmt_field_data_string(hStmt, DISPLAY_NAME_IDX_IN_MAIL_ACCOUNT_TBL, (char *)account->display_name, 0, DISPLAY_NAME_LEN_IN_MAIL_ACCOUNT_TBL);
+       _bind_stmt_field_data_string(hStmt, REPLY_TO_ADDR_IDX_IN_MAIL_ACCOUNT_TBL, (char *)account->reply_to_addr, 0, REPLY_TO_ADDR_LEN_IN_MAIL_ACCOUNT_TBL);
+       _bind_stmt_field_data_string(hStmt, RETURN_ADDR_IDX_IN_MAIL_ACCOUNT_TBL, (char *)account->return_addr, 0, RETURN_ADDR_LEN_IN_MAIL_ACCOUNT_TBL);
+       _bind_stmt_field_data_int(hStmt, ACCOUNT_ID_IDX_IN_MAIL_ACCOUNT_TBL, account->account_id);
+       _bind_stmt_field_data_int(hStmt, KEEP_ON_SERVER_IDX_IN_MAIL_ACCOUNT_TBL, account->keep_on_server);
+       _bind_stmt_field_data_int(hStmt, FLAG1_IDX_IN_MAIL_ACCOUNT_TBL, account->flag1);
+       _bind_stmt_field_data_int(hStmt, FLAG2_IDX_IN_MAIL_ACCOUNT_TBL, account->flag2);
+       _bind_stmt_field_data_int(hStmt, POP_BEFORE_SMTP_IDX_IN_MAIL_ACCOUNT_TBL, account->pop_before_smtp); /* POP before SMTP authentication [deepam.p@siso.com] */
+       _bind_stmt_field_data_int(hStmt, APOP_IDX_IN_MAIL_ACCOUNT_TBL, account->apop); /* APOP Support [deepam.p@siso.com] */
+       _bind_stmt_field_data_string(hStmt, LOGO_ICON_PATH_IDX_IN_MAIL_ACCOUNT_TBL, account->logo_icon_path, 0, LOGO_ICON_PATH_LEN_IN_MAIL_ACCOUNT_TBL);
+       _bind_stmt_field_data_int(hStmt, PRESET_ACCOUNT_IDX_IN_MAIL_ACCOUNT_TBL, account->preset_account);
+       _bind_stmt_field_data_int(hStmt, TARGET_STORAGE_IDX_IN_MAIL_ACCOUNT_TBL, account->target_storage);
+       _bind_stmt_field_data_int(hStmt, CHECK_INTERVAL_IDX_IN_MAIL_ACCOUNT_TBL, account->check_interval);
+       _bind_stmt_field_data_int(hStmt, PRIORITY_IDX_IN_MAIL_ACCOUNT_TBL, account->options.priority);
+       _bind_stmt_field_data_int(hStmt, KEEP_LOCAL_COPY_IDX_IN_MAIL_ACCOUNT_TBL, account->options.keep_local_copy);
+       _bind_stmt_field_data_int(hStmt, REQ_DELIVERY_RECEIPT_IDX_IN_MAIL_ACCOUNT_TBL, account->options.req_delivery_receipt);
+       _bind_stmt_field_data_int(hStmt, REQ_READ_RECEIPT_IDX_IN_MAIL_ACCOUNT_TBL, account->options.req_read_receipt);
+       _bind_stmt_field_data_int(hStmt, DOWNLOAD_LIMIT_IDX_IN_MAIL_ACCOUNT_TBL, account->options.download_limit);
+       _bind_stmt_field_data_int(hStmt, BLOCK_ADDRESS_IDX_IN_MAIL_ACCOUNT_TBL, account->options.block_address);
+       _bind_stmt_field_data_int(hStmt, BLOCK_SUBJECT_IDX_IN_MAIL_ACCOUNT_TBL, account->options.block_subject);
+       _bind_stmt_field_data_string(hStmt, DISPLAY_NAME_FROM_IDX_IN_MAIL_ACCOUNT_TBL, account->options.display_name_from, 0, DISPLAY_NAME_FROM_LEN_IN_MAIL_ACCOUNT_TBL);
+       _bind_stmt_field_data_int(hStmt, REPLY_WITH_BODY_IDX_IN_MAIL_ACCOUNT_TBL, account->options.reply_with_body);
+       _bind_stmt_field_data_int(hStmt, FORWARD_WITH_FILES_IDX_IN_MAIL_ACCOUNT_TBL, account->options.forward_with_files);
+       _bind_stmt_field_data_int(hStmt, ADD_MYNAME_CARD_IDX_IN_MAIL_ACCOUNT_TBL, account->options.add_myname_card);
+       _bind_stmt_field_data_int(hStmt, ADD_SIGNATURE_IDX_IN_MAIL_ACCOUNT_TBL, account->options.add_signature);
+       _bind_stmt_field_data_string(hStmt, SIGNATURE_IDX_IN_MAIL_ACCOUNT_TBL, account->options.signature, 0, SIGNATURE_LEN_IN_MAIL_ACCOUNT_TBL);
        if (account->options.add_my_address_to_bcc != 0)
                account->options.add_my_address_to_bcc = 1;
-       _bindStmtFieldDataInt(hStmt, ADD_MY_ADDRESS_TO_BCC_IDX_IN_MAIL_ACCOUNT_TBL, account->options.add_my_address_to_bcc);
-       _bindStmtFieldDataInt(hStmt, MY_ACCOUNT_ID_IDX_IN_MAIL_ACCOUNT_TBL, account->my_account_id);
-       _bindStmtFieldDataInt(hStmt, INDEX_COLOR_IDX_IN_MAIL_ACCOUNT_TBL, account->index_color);
-       _bindStmtFieldDataInt(hStmt, SYNC_STATUS_IDX_IN_MAIL_ACCOUNT_TBL, account->sync_status);
+       _bind_stmt_field_data_int(hStmt, ADD_MY_ADDRESS_TO_BCC_IDX_IN_MAIL_ACCOUNT_TBL, account->options.add_my_address_to_bcc);
+       _bind_stmt_field_data_int(hStmt, MY_ACCOUNT_ID_IDX_IN_MAIL_ACCOUNT_TBL, account->my_account_id);
+       _bind_stmt_field_data_int(hStmt, INDEX_COLOR_IDX_IN_MAIL_ACCOUNT_TBL, account->index_color);
+       _bind_stmt_field_data_int(hStmt, SYNC_STATUS_IDX_IN_MAIL_ACCOUNT_TBL, account->sync_status);
        
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
 
-       EM_DEBUG_DB_EXEC((rc == SQLITE_FULL), {error = EM_STORAGE_ERROR_DB_IS_FULL;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC((rc == SQLITE_FULL), {error = EMF_ERROR_MAIL_MEMORY_FULL;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("sqlite3_step fail:%d, errmsg = %s.", rc, sqlite3_errmsg(local_db_handle)));
        
 
@@ -3852,17 +3887,17 @@ EXPORT_API int em_storage_add_account(emf_mail_account_tbl_t* account, int trans
        EM_DEBUG_LOG("save to the secure storage : recv_file[%s], recv_pass[%s], send_file[%s], send_pass[%s]", recv_password_file_name, account->password, send_password_file_name, account->sending_password);
        if (ssm_write_buffer(account->password, strlen(account->password), recv_password_file_name, SSM_FLAG_SECRET_OPERATION, NULL) < 0) {
                EM_DEBUG_EXCEPTION("ssm_write_buffer failed - recv password : file[%s]", recv_password_file_name);
-               error = EM_STORAGE_ERROR_SYSTEM_FAILURE;
+               error = EMF_ERROR_SYSTEM_FAILURE;
                goto FINISH_OFF;                
        }
        if (ssm_write_buffer(account->sending_password, strlen(account->sending_password), send_password_file_name, SSM_FLAG_SECRET_OPERATION, NULL) < 0) {
                EM_DEBUG_EXCEPTION("ssm_write_buffer failed - send password : file[%s]", send_password_file_name);
-               error = EM_STORAGE_ERROR_SYSTEM_FAILURE;
+               error = EMF_ERROR_SYSTEM_FAILURE;
                goto FINISH_OFF;                
        }
 
-       if (!em_storage_notify_storage_event(NOTI_ACCOUNT_ADD, account->account_id, 0, NULL, 0))
-               EM_DEBUG_EXCEPTION("em_storage_notify_storage_event[NOTI_ACCOUNT_ADD] : Notification failed");
+       if (!emstorage_notify_storage_event(NOTI_ACCOUNT_ADD, account->account_id, 0, NULL, 0))
+               EM_DEBUG_EXCEPTION("emstorage_notify_storage_event[NOTI_ACCOUNT_ADD] : Notification failed");
        ret = true;
        
 FINISH_OFF:
@@ -3871,13 +3906,13 @@ FINISH_OFF:
                rc = sqlite3_finalize(hStmt);
                if (rc != SQLITE_OK)  {
                        EM_DEBUG_LOG("sqlite3_finalize failed - %d", rc);
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }               
        }
        else
                EM_DEBUG_LOG("hStmt is NULL!!!");
        
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -3888,7 +3923,7 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int em_storage_delete_account(int account_id, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_delete_account(int account_id, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], transaction[%d], err_code[%p]", account_id, transaction, err_code);
        
@@ -3896,14 +3931,14 @@ EXPORT_API int em_storage_delete_account(int account_id, int transaction, int *e
                EM_DEBUG_EXCEPTION(" account_id[%d]", account_id);
                
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
        int rc = -1, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       int error = EMF_ERROR_NONE;
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
 
        /*  TODO : delete password files - file names can be obtained from db or a rule that makes a name */
        DB_STMT hStmt = NULL;
@@ -3911,34 +3946,9 @@ EXPORT_API int em_storage_delete_account(int account_id, int transaction, int *e
        char recv_password_file_name[MAX_PW_FILE_NAME_LENGTH];
        char send_password_file_name[MAX_PW_FILE_NAME_LENGTH];
 
-/*
-       memset(sql_query_string, 0x00, sizeof(sql_query_string));
-       SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT password, sending_password FROM mail_account_tbl WHERE account_id = %d", account_id);
-       EM_DEBUG_LOG("query = [%s]", sql_query_string);
-
-       execute a sql and count rows 
-       rc = sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL);
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
-               ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
-       
-       rc = sqlite3_step(hStmt); 
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
-               ("sqlite3_step fail:%d", rc));
-
-       if (rc == SQLITE_DONE) {
-               EM_DEBUG_LOG(" no matched account found...");
-               
-               error = EM_STORAGE_ERROR_ACCOUNT_NOT_FOUND;
-               goto FINISH_OFF;
-       }
-       _getStmtFieldDataString(hStmt, &(recv_password_file_name), 0, 0);
-       _getStmtFieldDataString(hStmt, &(send_password_file_name), 0, 1);
-*/
        /*  get password file name */
-       if ((error = em_storage_get_password_file_name(account_id, recv_password_file_name, send_password_file_name)) != EM_STORAGE_ERROR_NONE) {
-               EM_DEBUG_EXCEPTION("em_storage_get_password_file_name failed.");
+       if ((error = _get_password_file_name(account_id, recv_password_file_name, send_password_file_name)) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("_get_password_file_name failed.");
                goto FINISH_OFF;
        }
 
@@ -3946,29 +3956,29 @@ EXPORT_API int em_storage_delete_account(int account_id, int transaction, int *e
        memset(sql_query_string, 0x00, sizeof(sql_query_string));
        SNPRINTF(sql_query_string, sizeof(sql_query_string), "DELETE FROM mail_account_tbl WHERE account_id = %d", account_id);
  
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC((rc == SQLITE_FULL), {error = EM_STORAGE_ERROR_DB_IS_FULL;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC((rc == SQLITE_FULL), {error = EMF_ERROR_MAIL_MEMORY_FULL;goto FINISH_OFF; },
                ("sqlite3_exec fail:%d", rc));
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        /*  validate account existence */
        rc = sqlite3_changes(local_db_handle);
        if (rc == 0)  {
                EM_DEBUG_EXCEPTION(" no matched account found...");
-               error = EM_STORAGE_ERROR_ACCOUNT_NOT_FOUND;
+               error = EMF_ERROR_ACCOUNT_NOT_FOUND;
                goto FINISH_OFF;
        }
 
                /*  delete from secure storage */
        if (ssm_delete_file(recv_password_file_name,  SSM_FLAG_SECRET_OPERATION, NULL) < 0) {
                EM_DEBUG_EXCEPTION(" ssm_delete_file failed -recv password : file[%s]", recv_password_file_name);
-               error = EM_STORAGE_ERROR_SYSTEM_FAILURE;
+               error = EMF_ERROR_SYSTEM_FAILURE;
                goto FINISH_OFF;                
        }
        if (ssm_delete_file(send_password_file_name,  SSM_FLAG_SECRET_OPERATION, NULL) < 0) {
                EM_DEBUG_EXCEPTION(" ssm_delete_file failed -send password : file[%s]", send_password_file_name);
-               error = EM_STORAGE_ERROR_SYSTEM_FAILURE;
+               error = EMF_ERROR_SYSTEM_FAILURE;
                goto FINISH_OFF;                
        }
        ret = true;
@@ -3979,11 +3989,11 @@ FINISH_OFF:
                rc = sqlite3_finalize(hStmt);
                if (rc != SQLITE_OK)  {
                        EM_DEBUG_LOG(" sqlite3_finalize failed - %d", rc);
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
        }
 
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        _DISCONNECT_DB;
 
        if (err_code != NULL)
@@ -3994,21 +4004,21 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int em_storage_free_account(emf_mail_account_tbl_t** account_list, int count, int *err_code)
+INTERNAL_FUNC int emstorage_free_account(emstorage_account_tbl_t** account_list, int count, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_list[%p], count[%d], err_code[%p]", account_list, count, err_code);
        
        int ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        
        if (count > 0)  {
                if (!account_list || !*account_list)  {
                        EM_DEBUG_EXCEPTION("account_list[%p], count[%d]", account_list, count);
-                       error = EM_STORAGE_ERROR_INVALID_PARAM;
+                       error = EMF_ERROR_INVALID_PARAM;
                        goto FINISH_OFF;
                }
                
-               emf_mail_account_tbl_t* p = *account_list;
+               emstorage_account_tbl_t* p = *account_list;
                int i = 0;
                
                for (; i < count; i++)  {
@@ -4042,7 +4052,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_get_mailbox_count(int account_id, int local_yn, int *count, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_get_mailbox_count(int account_id, int local_yn, int *count, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], local_yn[%d], count[%p], transaction[%d], err_code[%p]", account_id, local_yn, count, transaction, err_code);
        
@@ -4050,23 +4060,23 @@ EXPORT_API int em_storage_get_mailbox_count(int account_id, int local_yn, int *c
                EM_DEBUG_EXCEPTION(" account_list[%d], local_yn[%d], count[%p]", account_id, local_yn, count);
                
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
        int rc = -1, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        char sql_query_string[QUERY_SIZE] = {0, };
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_READ_TRANSACTION(transaction);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_READ_TRANSACTION(transaction);
        
        SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT COUNT(*) FROM mail_box_tbl WHERE account_id = %d AND local_yn = %d", account_id, local_yn);
        
        char **result;
-       /*  rc = sqlite3_get_table(local_db_handle, sql_query_string, &result, NULL, NULL, NULL); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        *count = atoi(result[1]);
@@ -4077,7 +4087,7 @@ EXPORT_API int em_storage_get_mailbox_count(int account_id, int local_yn, int *c
        
 FINISH_OFF:
  
-       EM_STORAGE_FINISH_READ_TRANSACTION(transaction);
+       EMSTORAGE_FINISH_READ_TRANSACTION(transaction);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -4087,7 +4097,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_get_mailbox(int account_id, int local_yn, email_mailbox_sort_type_t sort_type, int *select_num, emf_mailbox_tbl_t** mailbox_list, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_get_mailbox(int account_id, int local_yn, email_mailbox_sort_type_t sort_type, int *select_num, emstorage_mailbox_tbl_t** mailbox_list, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], local_yn[%d], select_num[%p], mailbox_list[%p], transaction[%d], err_code[%p]", account_id, local_yn, select_num, mailbox_list, transaction, err_code);
        
@@ -4095,21 +4105,21 @@ EXPORT_API int em_storage_get_mailbox(int account_id, int local_yn, email_mailbo
                EM_DEBUG_EXCEPTION("Invalid parameters");
                
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
 
                return false;
        }
 
        int i = 0, rc, count = 0, ret = false, col_index;
-       int error = EM_STORAGE_ERROR_NONE;
-       emf_mailbox_tbl_t* p_data_tbl = NULL;
+       int error = EMF_ERROR_NONE;
+       emstorage_mailbox_tbl_t* p_data_tbl = NULL;
        char **result;
        DB_STMT hStmt = NULL;
        char sql_query_string[QUERY_SIZE] = {0, };
        char *fields = "mailbox_id, account_id, local_yn, mailbox_name, mailbox_type, alias, sync_with_server_yn, modifiable_yn, total_mail_count_on_server, has_archived_mails, mail_slot_size ";
 
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_READ_TRANSACTION(transaction);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_READ_TRANSACTION(transaction);
                
        if (account_id == ALL_ACCOUNT) {
                SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT %s FROM mail_box_tbl ", fields);
@@ -4140,37 +4150,35 @@ EXPORT_API int em_storage_get_mailbox(int account_id, int local_yn, email_mailbo
                        break;
        }
 
-       EM_DEBUG_LOG("em_storage_get_mailbox : query[%s]", sql_query_string);
-
+       EM_DEBUG_LOG("emstorage_get_mailbox : query[%s]", sql_query_string);
 
-       /*  rc = sqlite3_get_table(local_db_handle, sql_query_string, &result, &count, NULL, NULL); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, &count, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, &count, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)))
  
-       if (!(p_data_tbl = (emf_mailbox_tbl_t*)malloc(sizeof(emf_mailbox_tbl_t) * count))) {
+       if (!(p_data_tbl = (emstorage_mailbox_tbl_t*)malloc(sizeof(emstorage_mailbox_tbl_t) * count))) {
                EM_DEBUG_EXCEPTION(" malloc failed...");
                
-               error = EM_STORAGE_ERROR_OUT_OF_MEMORY;
+               error = EMF_ERROR_OUT_OF_MEMORY;
                goto FINISH_OFF;
        }
        
-       memset(p_data_tbl, 0x00, sizeof(emf_mailbox_tbl_t)*count);
+       memset(p_data_tbl, 0x00, sizeof(emstorage_mailbox_tbl_t)*count);
        
        col_index = 11;
        
        for (i = 0; i < count; i++)  {
-               _getTableFieldDataInt(result, &(p_data_tbl[i].mailbox_id), col_index++);
-               _getTableFieldDataInt(result, &(p_data_tbl[i].account_id), col_index++);
-               _getTableFieldDataInt(result, &(p_data_tbl[i].local_yn), col_index++);
-               _getTableFieldDataString(result, &(p_data_tbl[i].mailbox_name), 0, col_index++);
-               _getTableFieldDataInt(result, (int *)&(p_data_tbl[i].mailbox_type), col_index++);
-               _getTableFieldDataString(result, &(p_data_tbl[i].alias), 0, col_index++);
-               _getTableFieldDataInt(result, &(p_data_tbl[i].sync_with_server_yn), col_index++);
-               _getTableFieldDataInt(result, &(p_data_tbl[i].modifiable_yn), col_index++);
-               _getTableFieldDataInt(result, &(p_data_tbl[i].total_mail_count_on_server), col_index++);
-               _getTableFieldDataInt(result, &(p_data_tbl[i].has_archived_mails), col_index++);
-               _getTableFieldDataInt(result, &(p_data_tbl[i].mail_slot_size), col_index++);
+               _get_table_field_data_int(result, &(p_data_tbl[i].mailbox_id), col_index++);
+               _get_table_field_data_int(result, &(p_data_tbl[i].account_id), col_index++);
+               _get_table_field_data_int(result, &(p_data_tbl[i].local_yn), col_index++);
+               _get_table_field_data_string(result, &(p_data_tbl[i].mailbox_name), 0, col_index++);
+               _get_table_field_data_int(result, (int *)&(p_data_tbl[i].mailbox_type), col_index++);
+               _get_table_field_data_string(result, &(p_data_tbl[i].alias), 0, col_index++);
+               _get_table_field_data_int(result, &(p_data_tbl[i].sync_with_server_yn), col_index++);
+               _get_table_field_data_int(result, &(p_data_tbl[i].modifiable_yn), col_index++);
+               _get_table_field_data_int(result, &(p_data_tbl[i].total_mail_count_on_server), col_index++);
+               _get_table_field_data_int(result, &(p_data_tbl[i].has_archived_mails), col_index++);
+               _get_table_field_data_int(result, &(p_data_tbl[i].mail_slot_size), col_index++);
        }
        
        ret = true;
@@ -4185,18 +4193,18 @@ FINISH_OFF:
                EM_DEBUG_LOG("Mailbox Count [ %d]", count);
        }
        else if (p_data_tbl != NULL)
-               em_storage_free_mailbox(&p_data_tbl, count, NULL);
+               emstorage_free_mailbox(&p_data_tbl, count, NULL);
        
        if (hStmt != NULL)  {
                rc = sqlite3_finalize(hStmt);
                if (rc != SQLITE_OK) {
                        EM_DEBUG_LOG(" sqlite3_finalize failed - %d", rc);
                        
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
        }
  
-       EM_STORAGE_FINISH_READ_TRANSACTION(transaction);
+       EMSTORAGE_FINISH_READ_TRANSACTION(transaction);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -4207,7 +4215,7 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int em_storage_get_mailbox_ex(int account_id, int local_yn, int with_count, int *select_num, emf_mailbox_tbl_t** mailbox_list, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_get_mailbox_ex(int account_id, int local_yn, int with_count, int *select_num, emstorage_mailbox_tbl_t** mailbox_list, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], local_yn[%d], select_num[%p], mailbox_list[%p], transaction[%d], err_code[%p]", account_id, local_yn, select_num, mailbox_list, transaction, err_code);
        
@@ -4215,7 +4223,7 @@ EXPORT_API int em_storage_get_mailbox_ex(int account_id, int local_yn, int with_
                EM_DEBUG_EXCEPTION("Invalid parameters");
                
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
 
                return false;
        }
@@ -4225,8 +4233,8 @@ EXPORT_API int em_storage_get_mailbox_ex(int account_id, int local_yn, int with_
        int count = 0;
        int ret = false;
        int col_index;
-       int error = EM_STORAGE_ERROR_NONE;
-       emf_mailbox_tbl_t* p_data_tbl = NULL;
+       int error = EMF_ERROR_NONE;
+       emstorage_mailbox_tbl_t* p_data_tbl = NULL;
        char **result;
        DB_STMT hStmt = NULL;
        char sql_query_string[QUERY_SIZE] = {0, };
@@ -4235,8 +4243,8 @@ EXPORT_API int em_storage_get_mailbox_ex(int account_id, int local_yn, int with_
        int read_count = 0;
        int total_count = 0;
 
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_READ_TRANSACTION(transaction);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_READ_TRANSACTION(transaction);
 
        add = 0;
        if (with_count == 0) {  /*  without count  */
@@ -4265,39 +4273,37 @@ EXPORT_API int em_storage_get_mailbox_ex(int account_id, int local_yn, int with_
        SNPRINTF(sql_query_string + strlen(sql_query_string), sizeof(sql_query_string)-(strlen(sql_query_string)+1), " ORDER BY MBT.mailbox_name ");
        EM_DEBUG_LOG("query[%s]", sql_query_string);
 
-
-       /*  rc = sqlite3_get_table(local_db_handle, sql_query_string, &result, &count, NULL, NULL); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, &count, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, &count, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)))
  
        EM_DEBUG_LOG("result count [%d]", count);
 
-       if (!(p_data_tbl = (emf_mailbox_tbl_t*)malloc(sizeof(emf_mailbox_tbl_t) * count)))  {
+       if (!(p_data_tbl = (emstorage_mailbox_tbl_t*)malloc(sizeof(emstorage_mailbox_tbl_t) * count)))  {
                EM_DEBUG_EXCEPTION("malloc failed...");
-               error = EM_STORAGE_ERROR_OUT_OF_MEMORY;
+               error = EMF_ERROR_OUT_OF_MEMORY;
                goto FINISH_OFF;
        }
        
-       memset(p_data_tbl, 0x00, sizeof(emf_mailbox_tbl_t)*count);
+       memset(p_data_tbl, 0x00, sizeof(emstorage_mailbox_tbl_t)*count);
        
        for (i = 0; i < count; i++)  {
-               _getTableFieldDataInt(result, &(p_data_tbl[i].mailbox_id), col_index++);
-               _getTableFieldDataInt(result, &(p_data_tbl[i].account_id), col_index++);
-               _getTableFieldDataInt(result, &(p_data_tbl[i].local_yn), col_index++);
-               _getTableFieldDataString(result, &(p_data_tbl[i].mailbox_name), 0, col_index++);
-               _getTableFieldDataInt(result, (int *)&(p_data_tbl[i].mailbox_type), col_index++);
-               _getTableFieldDataString(result, &(p_data_tbl[i].alias), 0, col_index++);
-               _getTableFieldDataInt(result, &(p_data_tbl[i].sync_with_server_yn), col_index++);
-               _getTableFieldDataInt(result, &(p_data_tbl[i].modifiable_yn), col_index++);
-               _getTableFieldDataInt(result, &(p_data_tbl[i].total_mail_count_on_server), col_index++);
-               _getTableFieldDataInt(result, &(p_data_tbl[i].has_archived_mails), col_index++);
-               _getTableFieldDataInt(result, &(p_data_tbl[i].mail_slot_size), col_index++);
+               _get_table_field_data_int(result, &(p_data_tbl[i].mailbox_id), col_index++);
+               _get_table_field_data_int(result, &(p_data_tbl[i].account_id), col_index++);
+               _get_table_field_data_int(result, &(p_data_tbl[i].local_yn), col_index++);
+               _get_table_field_data_string(result, &(p_data_tbl[i].mailbox_name), 0, col_index++);
+               _get_table_field_data_int(result, (int *)&(p_data_tbl[i].mailbox_type), col_index++);
+               _get_table_field_data_string(result, &(p_data_tbl[i].alias), 0, col_index++);
+               _get_table_field_data_int(result, &(p_data_tbl[i].sync_with_server_yn), col_index++);
+               _get_table_field_data_int(result, &(p_data_tbl[i].modifiable_yn), col_index++);
+               _get_table_field_data_int(result, &(p_data_tbl[i].total_mail_count_on_server), col_index++);
+               _get_table_field_data_int(result, &(p_data_tbl[i].has_archived_mails), col_index++);
+               _get_table_field_data_int(result, &(p_data_tbl[i].mail_slot_size), col_index++);
 
                if (with_count == 1) {
-                       _getTableFieldDataInt(result, &(total_count), col_index++);
+                       _get_table_field_data_int(result, &(total_count), col_index++);
                        p_data_tbl[i].total_mail_count_on_local = total_count;
-                       _getTableFieldDataInt(result, &(read_count), col_index++);
+                       _get_table_field_data_int(result, &(read_count), col_index++);
                        p_data_tbl[i].unread_count = total_count - read_count;                  /*  return unread count, NOT  */
                }
                /*
@@ -4330,18 +4336,18 @@ FINISH_OFF:
                EM_DEBUG_LOG("Mailbox Count [ %d]", count);
        }
        else if (p_data_tbl != NULL)
-               em_storage_free_mailbox(&p_data_tbl, count, NULL);
+               emstorage_free_mailbox(&p_data_tbl, count, NULL);
        
        if (hStmt != NULL)  {
                rc = sqlite3_finalize(hStmt);
                if (rc != SQLITE_OK) {
                        EM_DEBUG_LOG(" sqlite3_finalize failed - %d", rc);
                        
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
        }
  
-       EM_STORAGE_FINISH_READ_TRANSACTION(transaction);
+       EMSTORAGE_FINISH_READ_TRANSACTION(transaction);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -4351,26 +4357,26 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_get_child_mailbox_list(int account_id, char *parent_mailbox_name, int *select_num, emf_mailbox_tbl_t** mailbox_list, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_get_child_mailbox_list(int account_id, char *parent_mailbox_name, int *select_num, emstorage_mailbox_tbl_t** mailbox_list, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], parent_mailbox_name[%p], select_num[%p], mailbox_list[%p], transaction[%d], err_code[%p]", account_id, parent_mailbox_name, select_num, mailbox_list, transaction, err_code);
        if (account_id < FIRST_ACCOUNT_ID || !select_num || !mailbox_list)  {
                EM_DEBUG_EXCEPTION("account_id[%d], parent_mailbox_name[%p], select_num[%p], mailbox_list[%p]", account_id, parent_mailbox_name, select_num, mailbox_list);
                
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
 
        int i = 0, rc, count = 0, ret = false, col_index;
-       int error = EM_STORAGE_ERROR_NONE;
-       emf_mailbox_tbl_t* p_data_tbl = NULL;
+       int error = EMF_ERROR_NONE;
+       emstorage_mailbox_tbl_t* p_data_tbl = NULL;
        char **result;
        char sql_query_string[QUERY_SIZE] = {0, };
        char *fields = "mailbox_id, account_id, local_yn, mailbox_name, mailbox_type, alias, sync_with_server_yn, modifiable_yn, total_mail_count_on_server, has_archived_mails, mail_slot_size ";
 
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_READ_TRANSACTION(transaction);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_READ_TRANSACTION(transaction);
 
        if (parent_mailbox_name)
                SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT %s FROM mail_box_tbl WHERE account_id = %d  AND UPPER(mailbox_name) LIKE UPPER('%s/%%') ORDER BY mailbox_name", fields, account_id, parent_mailbox_name);
@@ -4379,33 +4385,32 @@ EXPORT_API int em_storage_get_child_mailbox_list(int account_id, char *parent_ma
 
        EM_DEBUG_LOG("query : %s", sql_query_string);
 
-       /*  rc = sqlite3_get_table(local_db_handle, sql_query_string, &result, &count, NULL, NULL); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, &count, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, &count, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
 
-       if (!(p_data_tbl = (emf_mailbox_tbl_t*)malloc(sizeof(emf_mailbox_tbl_t) * count)))  {
+       if (!(p_data_tbl = (emstorage_mailbox_tbl_t*)malloc(sizeof(emstorage_mailbox_tbl_t) * count)))  {
                EM_DEBUG_EXCEPTION(" malloc failed...");
-               error = EM_STORAGE_ERROR_OUT_OF_MEMORY;
+               error = EMF_ERROR_OUT_OF_MEMORY;
                goto FINISH_OFF;
        }
        
-       memset(p_data_tbl, 0x00, sizeof(emf_mailbox_tbl_t)*count);
+       memset(p_data_tbl, 0x00, sizeof(emstorage_mailbox_tbl_t)*count);
        col_index = 11;
        
        for (i = 0; i < count; i++)  {
-               _getTableFieldDataInt(result, &(p_data_tbl[i].mailbox_id), col_index++);
-               _getTableFieldDataInt(result, &(p_data_tbl[i].account_id), col_index++);
-               _getTableFieldDataInt(result, &(p_data_tbl[i].local_yn), col_index++);
-               _getTableFieldDataString(result, &(p_data_tbl[i].mailbox_name), 0, col_index++);
-               _getTableFieldDataInt(result, (int *)&(p_data_tbl[i].mailbox_type), col_index++);
-               _getTableFieldDataString(result, &(p_data_tbl[i].alias), 0, col_index++);
-               _getTableFieldDataInt(result, &(p_data_tbl[i].sync_with_server_yn), col_index++);
-               _getTableFieldDataInt(result, &(p_data_tbl[i].modifiable_yn), col_index++);
-               _getTableFieldDataInt(result, &(p_data_tbl[i].total_mail_count_on_server), col_index++);
-               _getTableFieldDataInt(result, &(p_data_tbl[i].has_archived_mails), col_index++);
-               _getTableFieldDataInt(result, &(p_data_tbl[i].mail_slot_size), col_index++);
+               _get_table_field_data_int(result, &(p_data_tbl[i].mailbox_id), col_index++);
+               _get_table_field_data_int(result, &(p_data_tbl[i].account_id), col_index++);
+               _get_table_field_data_int(result, &(p_data_tbl[i].local_yn), col_index++);
+               _get_table_field_data_string(result, &(p_data_tbl[i].mailbox_name), 0, col_index++);
+               _get_table_field_data_int(result, (int *)&(p_data_tbl[i].mailbox_type), col_index++);
+               _get_table_field_data_string(result, &(p_data_tbl[i].alias), 0, col_index++);
+               _get_table_field_data_int(result, &(p_data_tbl[i].sync_with_server_yn), col_index++);
+               _get_table_field_data_int(result, &(p_data_tbl[i].modifiable_yn), col_index++);
+               _get_table_field_data_int(result, &(p_data_tbl[i].total_mail_count_on_server), col_index++);
+               _get_table_field_data_int(result, &(p_data_tbl[i].has_archived_mails), col_index++);
+               _get_table_field_data_int(result, &(p_data_tbl[i].mail_slot_size), col_index++);
        }
 
        if (result)
@@ -4420,9 +4425,9 @@ FINISH_OFF:
                EM_DEBUG_LOG(" Mailbox Count [ %d] ", count);
        }
        else if (p_data_tbl != NULL)
-               em_storage_free_mailbox(&p_data_tbl, count, NULL);
+               emstorage_free_mailbox(&p_data_tbl, count, NULL);
        
-       EM_STORAGE_FINISH_READ_TRANSACTION(transaction);
+       EMSTORAGE_FINISH_READ_TRANSACTION(transaction);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -4432,44 +4437,43 @@ FINISH_OFF:
        return ret;
 }
  
-EXPORT_API int em_storage_get_mailbox_by_modifiable_yn(int account_id, int local_yn, int *select_num, emf_mailbox_tbl_t** mailbox_list, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_get_mailbox_by_modifiable_yn(int account_id, int local_yn, int *select_num, emstorage_mailbox_tbl_t** mailbox_list, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], local_yn[%d], select_num[%p], mailbox_list[%p], transaction[%d], err_code[%p]", account_id, local_yn, select_num, mailbox_list, transaction, err_code);
        if (account_id < FIRST_ACCOUNT_ID || !select_num || !mailbox_list)  {
                EM_DEBUG_EXCEPTION("\account_id[%d], local_yn[%d], select_num[%p], mailbox_list[%p]", account_id, local_yn, select_num, mailbox_list);
                
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
 
        int i = 0, rc, count = 0, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
-       emf_mailbox_tbl_t* p_data_tbl = NULL;
+       int error = EMF_ERROR_NONE;
+       emstorage_mailbox_tbl_t* p_data_tbl = NULL;
        DB_STMT hStmt = NULL;
        char sql_query_string[QUERY_SIZE] = {0, };
        char *fields = "mailbox_id, account_id, local_yn, mailbox_name, mailbox_type, alias, sync_with_server_yn, modifiable_yn, total_mail_count_on_server, has_archived_mails, mail_slot_size ";
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_READ_TRANSACTION(transaction);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_READ_TRANSACTION(transaction);
        
        SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT %s FROM mail_box_tbl WHERE account_id = %d AND modifiable_yn = 0 ORDER BY mailbox_name", fields, account_id);
        EM_DEBUG_LOG("sql[%s]", sql_query_string);
        
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
 
        char **result;
-       /*  rc = sqlite3_get_table(local_db_handle, sql_query_string, &result, &count, NULL, NULL); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, &count, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, &count, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        sqlite3_free_table(result);
@@ -4480,33 +4484,32 @@ EXPORT_API int em_storage_get_mailbox_by_modifiable_yn(int account_id, int local
                goto FINISH_OFF;
        }
        
-       if (!(p_data_tbl = (emf_mailbox_tbl_t*)malloc(sizeof(emf_mailbox_tbl_t) * count)))  {
+       if (!(p_data_tbl = (emstorage_mailbox_tbl_t*)malloc(sizeof(emstorage_mailbox_tbl_t) * count)))  {
                EM_DEBUG_EXCEPTION(" malloc failed...");
                
-               error = EM_STORAGE_ERROR_OUT_OF_MEMORY;
+               error = EMF_ERROR_OUT_OF_MEMORY;
                goto FINISH_OFF;
        }
        
-       memset(p_data_tbl, 0x00, sizeof(emf_mailbox_tbl_t)*count);
+       memset(p_data_tbl, 0x00, sizeof(emstorage_mailbox_tbl_t)*count);
        
        int col_index = 0;
        for (i = 0; i < count; i++)  {
                col_index = 0;
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].mailbox_id), col_index++);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].account_id), col_index++);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].local_yn), col_index++);
-               _getStmtFieldDataString(hStmt, &(p_data_tbl[i].mailbox_name), 0, col_index++);
-               _getStmtFieldDataInt(hStmt, (int *)&(p_data_tbl[i].mailbox_type), col_index++);
-               _getStmtFieldDataString(hStmt, &(p_data_tbl[i].alias), 0, col_index++);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].sync_with_server_yn), col_index++);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].modifiable_yn), col_index++);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].total_mail_count_on_server), col_index++);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].has_archived_mails), col_index++);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].mail_slot_size), col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].mailbox_id), col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].account_id), col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].local_yn), col_index++);
+               _get_stmt_field_data_string(hStmt, &(p_data_tbl[i].mailbox_name), 0, col_index++);
+               _get_stmt_field_data_int(hStmt, (int *)&(p_data_tbl[i].mailbox_type), col_index++);
+               _get_stmt_field_data_string(hStmt, &(p_data_tbl[i].alias), 0, col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].sync_with_server_yn), col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].modifiable_yn), col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].total_mail_count_on_server), col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].has_archived_mails), col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].mail_slot_size), col_index++);
  
-               /*  rc = sqlite3_step(hStmt); */
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-               EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+               EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                        ("sqlite3_step fail:%d", rc));
        }
        
@@ -4519,7 +4522,7 @@ FINISH_OFF:
                EM_DEBUG_LOG("Mailbox Count[%d]", count);
        }
        else if (p_data_tbl != NULL)
-               em_storage_free_mailbox(&p_data_tbl, count, NULL);
+               emstorage_free_mailbox(&p_data_tbl, count, NULL);
        
        if (hStmt != NULL)  {
                EM_DEBUG_LOG("Before sqlite3_finalize hStmt = %p", hStmt);
@@ -4527,10 +4530,10 @@ FINISH_OFF:
                rc = sqlite3_finalize(hStmt);
                if (rc != SQLITE_OK)  {
                        EM_DEBUG_EXCEPTION("sqlite3_finalize failed - %d", rc);
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
        }
-       EM_STORAGE_FINISH_READ_TRANSACTION(transaction);
+       EMSTORAGE_FINISH_READ_TRANSACTION(transaction);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -4542,71 +4545,91 @@ FINISH_OFF:
 
 
 
-EXPORT_API int em_storage_get_mailbox_by_name(int account_id, int local_yn, char *mailbox_name, emf_mailbox_tbl_t** result_mailbox, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_get_mailbox_by_name(int account_id, int local_yn, char *mailbox_name, emstorage_mailbox_tbl_t** result_mailbox, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], local_yn[%d], mailbox_name[%s], result_mailbox[%p], transaction[%d], err_code[%p]", account_id, local_yn, mailbox_name, result_mailbox, transaction, err_code);
-       EM_PROFILE_BEGIN(profile_em_storage_get_mailbox_by_name);
+       EM_PROFILE_BEGIN(profile_emstorage_get_mailbox_by_name);
        
        if (account_id < FIRST_ACCOUNT_ID || !mailbox_name || !result_mailbox)  {
                EM_DEBUG_EXCEPTION(" account_id[%d], local_yn[%d], mailbox_name[%s], result_mailbox[%p]", account_id, local_yn, mailbox_name, result_mailbox);
                
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
 
        int rc, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
-       emf_mailbox_tbl_t* p_data_tbl = NULL;
+       int error = EMF_ERROR_NONE;
+       int col_index = 0;
+       emstorage_mailbox_tbl_t* p_data_tbl = NULL;
        DB_STMT hStmt = NULL;
        char sql_query_string[QUERY_SIZE] = {0, };
        char *fields = "mailbox_id, account_id, local_yn, mailbox_name, mailbox_type, alias, sync_with_server_yn, modifiable_yn, total_mail_count_on_server, has_archived_mails, mail_slot_size ";
+       sqlite3 *local_db_handle = NULL;
+
+       if(strcmp(mailbox_name, EMF_SEARCH_RESULT_MAILBOX_NAME) == 0) {
+               if (!(p_data_tbl = (emstorage_mailbox_tbl_t*)em_malloc(sizeof(emstorage_mailbox_tbl_t))))  {
+                       EM_DEBUG_EXCEPTION("malloc failed...");
+                       error = EMF_ERROR_OUT_OF_MEMORY;
+                       goto FINISH_OFF;
+               }
+
+               p_data_tbl->mailbox_id                 = 0;
+               p_data_tbl->account_id                 = account_id;
+               p_data_tbl->local_yn                   = 1;
+               p_data_tbl->mailbox_name               = EM_SAFE_STRDUP(mailbox_name);
+               p_data_tbl->mailbox_type               = EMF_MAILBOX_TYPE_SEARCH_RESULT;
+               p_data_tbl->alias                      = EM_SAFE_STRDUP(mailbox_name);
+               p_data_tbl->sync_with_server_yn        = 0;
+               p_data_tbl->modifiable_yn              = 1;
+               p_data_tbl->total_mail_count_on_server = 1;
+               p_data_tbl->has_archived_mails         = 0;
+               p_data_tbl->mail_slot_size             = 0x0FFFFFFF;
+       }
+       else {
+               local_db_handle = emstorage_get_db_connection();
+
+               EMSTORAGE_START_READ_TRANSACTION(transaction);
+
+               if (local_yn == -1)
+                       SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT %s FROM mail_box_tbl WHERE account_id = %d AND mailbox_name = '%s'", fields, account_id, mailbox_name);
+               else
+                       SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT %s FROM mail_box_tbl WHERE account_id = %d AND local_yn = %d AND mailbox_name = '%s'", fields, account_id, local_yn, mailbox_name);
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_READ_TRANSACTION(transaction);
+               EM_DEBUG_LOG("query = [%s]", sql_query_string);
        
-       if (local_yn == -1)
-               SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT %s FROM mail_box_tbl WHERE account_id = %d AND mailbox_name = '%s'", fields, account_id, mailbox_name);
-       else
-               SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT %s FROM mail_box_tbl WHERE account_id = %d AND local_yn = %d AND mailbox_name = '%s'", fields, account_id, local_yn, mailbox_name);
-
-       EM_DEBUG_LOG("query = [%s]", sql_query_string);
 
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+               EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
+                       ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+               EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
+                       ("sqlite3_step fail:%d", rc));
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
-               ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
-               ("sqlite3_step fail:%d", rc));
+               if (rc == SQLITE_DONE) {
+                       EM_DEBUG_EXCEPTION("no matched mailbox_name found...");
+                       error = EMF_ERROR_MAILBOX_NOT_FOUND;
+                       goto FINISH_OFF;
+               }
 
-       if (rc == SQLITE_DONE) {
-               EM_DEBUG_EXCEPTION("no matched mailbox_name found...");
-               error = EM_STORAGE_ERROR_MAILBOX_NOT_FOUND;
-               goto FINISH_OFF;
-       }
+               if (!(p_data_tbl = (emstorage_mailbox_tbl_t*)em_malloc(sizeof(emstorage_mailbox_tbl_t))))  {
+                       EM_DEBUG_EXCEPTION("malloc failed...");
+                       error = EMF_ERROR_OUT_OF_MEMORY;
+                       goto FINISH_OFF;
+               }
        
-       if (!(p_data_tbl = (emf_mailbox_tbl_t*)malloc(sizeof(emf_mailbox_tbl_t))))  {
-               EM_DEBUG_EXCEPTION("malloc failed...");
-               error = EM_STORAGE_ERROR_OUT_OF_MEMORY;
-               goto FINISH_OFF;
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl->mailbox_id), col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl->account_id), col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl->local_yn), col_index++);
+               _get_stmt_field_data_string(hStmt, &(p_data_tbl->mailbox_name), 0, col_index++);
+               _get_stmt_field_data_int(hStmt, (int *)&(p_data_tbl->mailbox_type), col_index++);
+               _get_stmt_field_data_string(hStmt, &(p_data_tbl->alias), 0, col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl->sync_with_server_yn), col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl->modifiable_yn), col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl->total_mail_count_on_server), col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl->has_archived_mails), col_index++);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl->mail_slot_size), col_index++);
        }
-       
-       memset(p_data_tbl, 0x00, sizeof(emf_mailbox_tbl_t));
-       int col_index = 0;      
-       _getStmtFieldDataInt(hStmt, &(p_data_tbl->mailbox_id), col_index++);
-       _getStmtFieldDataInt(hStmt, &(p_data_tbl->account_id), col_index++);
-       _getStmtFieldDataInt(hStmt, &(p_data_tbl->local_yn), col_index++);
-       _getStmtFieldDataString(hStmt, &(p_data_tbl->mailbox_name), 0, col_index++);
-       _getStmtFieldDataInt(hStmt, (int *)&(p_data_tbl->mailbox_type), col_index++);
-       _getStmtFieldDataString(hStmt, &(p_data_tbl->alias), 0, col_index++);
-       _getStmtFieldDataInt(hStmt, &(p_data_tbl->sync_with_server_yn), col_index++);
-       _getStmtFieldDataInt(hStmt, &(p_data_tbl->modifiable_yn), col_index++);
-       _getStmtFieldDataInt(hStmt, &(p_data_tbl->total_mail_count_on_server), col_index++);
-       _getStmtFieldDataInt(hStmt, &(p_data_tbl->has_archived_mails), col_index++);
-       _getStmtFieldDataInt(hStmt, &(p_data_tbl->mail_slot_size), col_index++);
 
        ret = true;
        
@@ -4614,29 +4637,28 @@ FINISH_OFF:
        if (ret == true)
                *result_mailbox = p_data_tbl;
        else if (p_data_tbl != NULL)
-               em_storage_free_mailbox(&p_data_tbl, 1, NULL);
+               emstorage_free_mailbox(&p_data_tbl, 1, NULL);
        
        if (hStmt != NULL)  {
                rc = sqlite3_finalize(hStmt);
                if (rc != SQLITE_OK)  {
                        EM_DEBUG_EXCEPTION(" sqlite3_finalize failed - %d", rc);
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
        }
        
-       EM_STORAGE_FINISH_READ_TRANSACTION(transaction);
+       EMSTORAGE_FINISH_READ_TRANSACTION(transaction);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
                *err_code = error;
 
-       EM_PROFILE_END(profile_em_storage_get_mailbox_by_name);
+       EM_PROFILE_END(profile_emstorage_get_mailbox_by_name);
        EM_DEBUG_FUNC_END("ret [%d]", ret);
        return ret;
 }
 
-
-EXPORT_API int em_storage_get_mailbox_by_mailbox_type(int account_id, emf_mailbox_type_e mailbox_type, emf_mailbox_tbl_t** mailbox_name, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_get_mailbox_by_mailbox_type(int account_id, emf_mailbox_type_e mailbox_type, emstorage_mailbox_tbl_t** mailbox_name, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], mailbox_type[%d], mailbox_name[%p], transaction[%d], err_code[%p]", account_id, mailbox_type, mailbox_name, transaction, err_code);
 
@@ -4645,71 +4667,71 @@ EXPORT_API int em_storage_get_mailbox_by_mailbox_type(int account_id, emf_mailbo
                EM_DEBUG_EXCEPTION(" account_id[%d], mailbox_type[%d], mailbox_name[%p]", account_id, mailbox_type, mailbox_name);
                
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
 
        int rc, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
-       emf_mailbox_tbl_t *p_data_tbl = NULL;
-       emf_mail_account_tbl_t *account = NULL;
+       int error = EMF_ERROR_NONE;
+       emstorage_mailbox_tbl_t *p_data_tbl = NULL;
+       emstorage_account_tbl_t *account = NULL;
        DB_STMT hStmt = NULL;
        char sql_query_string[QUERY_SIZE] = {0,};
        char *fields = "mailbox_id, account_id, local_yn, mailbox_name, mailbox_type, alias, sync_with_server_yn, modifiable_yn, total_mail_count_on_server, has_archived_mails, mail_slot_size ";
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_READ_TRANSACTION(transaction);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_READ_TRANSACTION(transaction);
        
        /* validate account */
        /*  Check whether the account exists. */
-       if (!em_storage_get_account_by_id(account_id, EMF_ACC_GET_OPT_ACCOUNT_NAME,  &account, true, &error) || !account) {
-               EM_DEBUG_EXCEPTION(" em_storage_get_account_by_id failed - %d", error);
+       if (!emstorage_get_account_by_id(account_id, EMF_ACC_GET_OPT_ACCOUNT_NAME,  &account, true, &error) || !account) {
+               EM_DEBUG_EXCEPTION(" emstorage_get_account_by_id failed - %d", error);
                goto FINISH_OFF;
        }
 
        if (account)
-               em_storage_free_account(&account, 1, NULL);
+               emstorage_free_account(&account, 1, NULL);
        
        SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT %s FROM mail_box_tbl WHERE account_id = %d AND mailbox_type = %d ", fields, account_id, mailbox_type);
 
        EM_DEBUG_LOG("query = [%s]", sql_query_string);
                
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE; goto FINISH_OFF; }, ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE; goto FINISH_OFF; }, ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
+
 
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE; goto FINISH_OFF; }, ("sqlite3_step fail:%d", rc));
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE; goto FINISH_OFF; }, ("sqlite3_step fail:%d", rc));
        
        if (rc == SQLITE_DONE) {
                EM_DEBUG_EXCEPTION(" no matched mailbox_name found...");
-               error = EM_STORAGE_ERROR_MAILBOX_NOT_FOUND;
+               error = EMF_ERROR_MAILBOX_NOT_FOUND;
                goto FINISH_OFF;
        }
 
        
-       if (!(p_data_tbl = (emf_mailbox_tbl_t*)malloc(sizeof(emf_mailbox_tbl_t))))  {
+       if (!(p_data_tbl = (emstorage_mailbox_tbl_t*)malloc(sizeof(emstorage_mailbox_tbl_t))))  {
                EM_DEBUG_EXCEPTION(" malloc failed...");
-               error = EM_STORAGE_ERROR_OUT_OF_MEMORY;
+               error = EMF_ERROR_OUT_OF_MEMORY;
                goto FINISH_OFF;
        }
        
-       memset(p_data_tbl, 0x00, sizeof(emf_mailbox_tbl_t));
+       memset(p_data_tbl, 0x00, sizeof(emstorage_mailbox_tbl_t));
        
        int col_index = 0;
 
-       _getStmtFieldDataInt(hStmt, &(p_data_tbl->mailbox_id), col_index++);
-       _getStmtFieldDataInt(hStmt, &(p_data_tbl->account_id), col_index++);
-       _getStmtFieldDataInt(hStmt, &(p_data_tbl->local_yn), col_index++);
-       _getStmtFieldDataString(hStmt, &(p_data_tbl->mailbox_name), 0, col_index++);
-       _getStmtFieldDataInt(hStmt, (int *)&(p_data_tbl->mailbox_type), col_index++);
-       _getStmtFieldDataString(hStmt, &(p_data_tbl->alias), 0, col_index++);
-       _getStmtFieldDataInt(hStmt, &(p_data_tbl->sync_with_server_yn), col_index++);
-       _getStmtFieldDataInt(hStmt, &(p_data_tbl->modifiable_yn), col_index++);
-       _getStmtFieldDataInt(hStmt, &(p_data_tbl->total_mail_count_on_server), col_index++);
-       _getStmtFieldDataInt(hStmt, &(p_data_tbl->has_archived_mails), col_index++);
-       _getStmtFieldDataInt(hStmt, &(p_data_tbl->mail_slot_size), col_index++);
+       _get_stmt_field_data_int(hStmt, &(p_data_tbl->mailbox_id), col_index++);
+       _get_stmt_field_data_int(hStmt, &(p_data_tbl->account_id), col_index++);
+       _get_stmt_field_data_int(hStmt, &(p_data_tbl->local_yn), col_index++);
+       _get_stmt_field_data_string(hStmt, &(p_data_tbl->mailbox_name), 0, col_index++);
+       _get_stmt_field_data_int(hStmt, (int *)&(p_data_tbl->mailbox_type), col_index++);
+       _get_stmt_field_data_string(hStmt, &(p_data_tbl->alias), 0, col_index++);
+       _get_stmt_field_data_int(hStmt, &(p_data_tbl->sync_with_server_yn), col_index++);
+       _get_stmt_field_data_int(hStmt, &(p_data_tbl->modifiable_yn), col_index++);
+       _get_stmt_field_data_int(hStmt, &(p_data_tbl->total_mail_count_on_server), col_index++);
+       _get_stmt_field_data_int(hStmt, &(p_data_tbl->has_archived_mails), col_index++);
+       _get_stmt_field_data_int(hStmt, &(p_data_tbl->mail_slot_size), col_index++);
 
        ret = true;
        
@@ -4717,17 +4739,17 @@ FINISH_OFF:
        if (ret == true)
                *mailbox_name = p_data_tbl;
        else if (p_data_tbl != NULL)
-               em_storage_free_mailbox(&p_data_tbl, 1, NULL);
+               emstorage_free_mailbox(&p_data_tbl, 1, NULL);
        
        if (hStmt != NULL)  {
                rc = sqlite3_finalize(hStmt);
                if (rc != SQLITE_OK)  {
                        EM_DEBUG_EXCEPTION("sqlite3_finalize failed - %d", rc);
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
        }
        
-       EM_STORAGE_FINISH_READ_TRANSACTION(transaction);
+       EMSTORAGE_FINISH_READ_TRANSACTION(transaction);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -4737,57 +4759,57 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_get_mailboxname_by_mailbox_type(int account_id, emf_mailbox_type_e mailbox_type, char **mailbox_name, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_get_mailboxname_by_mailbox_type(int account_id, emf_mailbox_type_e mailbox_type, char **mailbox_name, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], mailbox_type[%d], mailbox_name[%p], transaction[%d], err_code[%p]", account_id, mailbox_type, mailbox_name, transaction, err_code);
        if (account_id < FIRST_ACCOUNT_ID || (mailbox_type < EMF_MAILBOX_TYPE_INBOX || mailbox_type > EMF_MAILBOX_TYPE_ALL_EMAILS) || !mailbox_name)  {
                EM_DEBUG_EXCEPTION("account_id[%d], mailbox_type[%d], mailbox_name[%p]", account_id, mailbox_type, mailbox_name);
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
 
        int rc, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        char *p_mailbox = NULL;
-       emf_mail_account_tbl_t* account = NULL;
+       emstorage_account_tbl_t* account = NULL;
        DB_STMT hStmt = NULL;
        char sql_query_string[QUERY_SIZE] = {0, };
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_READ_TRANSACTION(transaction);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_READ_TRANSACTION(transaction);
 
        /*  Check whether the account exists. */
-       if (!em_storage_get_account_by_id(account_id, EMF_ACC_GET_OPT_ACCOUNT_NAME,  &account, true, &error) || !account) {
-               EM_DEBUG_EXCEPTION("em_storage_get_account_by_id failed - %d", error);
+       if (!emstorage_get_account_by_id(account_id, EMF_ACC_GET_OPT_ACCOUNT_NAME,  &account, true, &error) || !account) {
+               EM_DEBUG_EXCEPTION("emstorage_get_account_by_id failed - %d", error);
                goto FINISH_OFF;
        }
 
        if (account )
-               em_storage_free_account(&account, 1, NULL);
+               emstorage_free_account(&account, 1, NULL);
        
        SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT mailbox_name  FROM mail_box_tbl WHERE account_id = %d AND mailbox_type = %d ", account_id, mailbox_type);
 
        EM_DEBUG_LOG("query = [%s]", sql_query_string);
 
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
 
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
        
        if (rc == SQLITE_DONE) {
                EM_DEBUG_EXCEPTION("no matched mailbox_name found...");
-               error = EM_STORAGE_ERROR_MAILBOX_NOT_FOUND;
+               error = EMF_ERROR_MAILBOX_NOT_FOUND;
                goto FINISH_OFF;
        }
  
-       _getStmtFieldDataString(hStmt, &(p_mailbox), 0, 0);
+       _get_stmt_field_data_string(hStmt, &(p_mailbox), 0, 0);
 
        ret = true;
        
@@ -4801,11 +4823,11 @@ FINISH_OFF:
                rc = sqlite3_finalize(hStmt);
                if (rc != SQLITE_OK)  {
                        EM_DEBUG_EXCEPTION(" sqlite3_finalize failed - %d", rc);
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
        }
        
-       EM_STORAGE_FINISH_READ_TRANSACTION(transaction);
+       EMSTORAGE_FINISH_READ_TRANSACTION(transaction);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -4815,16 +4837,16 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_update_mailbox_modifiable_yn(int account_id, int local_yn, char *mailbox_name, int modifiable_yn, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_update_mailbox_modifiable_yn(int account_id, int local_yn, char *mailbox_name, int modifiable_yn, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id [%d], local_yn [%d], mailbox_name [%p], modifiable_yn [%d], transaction [%d], err_code [%p]", account_id, local_yn, mailbox_name, modifiable_yn, transaction, err_code);
        int rc, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        char sql_query_string[QUERY_SIZE] = {0, };
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
 
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
        
        SNPRINTF(sql_query_string, sizeof(sql_query_string),
                "UPDATE mail_box_tbl SET"
@@ -4836,14 +4858,14 @@ EXPORT_API int em_storage_update_mailbox_modifiable_yn(int account_id, int local
                , account_id
                , local_yn
                , mailbox_name);
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
  
        ret = true;
 
 FINISH_OFF:
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -4855,23 +4877,23 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int em_storage_update_mailbox_total_count(int account_id, char *mailbox_name, int total_count_on_server, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_update_mailbox_total_count(int account_id, char *mailbox_name, int total_count_on_server, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], mailbox_name[%p], total_count_on_server[%d], transaction[%d], err_code[%p]", account_id, mailbox_name, total_count_on_server,  transaction, err_code);
        int rc, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        char sql_query_string[QUERY_SIZE] = {0, };
        
        if (account_id <= 0 || !mailbox_name)  {
                EM_DEBUG_EXCEPTION("account_id[%d], mailbox_name[%p]", account_id, mailbox_name);
                
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }       
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
 
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
 
        SNPRINTF(sql_query_string, sizeof(sql_query_string),
                "UPDATE mail_box_tbl SET"
@@ -4882,14 +4904,14 @@ EXPORT_API int em_storage_update_mailbox_total_count(int account_id, char *mailb
                , account_id
                , mailbox_name);
        EM_DEBUG_LOG("query[%s]", sql_query_string);
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
  
        ret = true;
 
 FINISH_OFF:
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -4901,7 +4923,7 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int em_storage_update_mailbox(int account_id, int local_yn, char *mailbox_name, emf_mailbox_tbl_t* result_mailbox, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_update_mailbox(int account_id, int local_yn, char *mailbox_name, emstorage_mailbox_tbl_t* result_mailbox, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], local_yn[%d], mailbox_name[%s], result_mailbox[%p], transaction[%d], err_code[%p]", account_id, local_yn, mailbox_name, result_mailbox, transaction, err_code);
        
@@ -4909,18 +4931,18 @@ EXPORT_API int em_storage_update_mailbox(int account_id, int local_yn, char *mai
                EM_DEBUG_EXCEPTION(" account_id[%d], local_yn[%d], mailbox_name[%s], result_mailbox[%p]", account_id, local_yn, mailbox_name, result_mailbox);
                
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
        int rc, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        char sql_query_string[QUERY_SIZE] = {0, };
        DB_STMT hStmt = NULL;
        int i = 0;
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
        
        if (local_yn != -1) {
                SNPRINTF(sql_query_string, sizeof(sql_query_string),
@@ -4959,37 +4981,37 @@ EXPORT_API int em_storage_update_mailbox(int account_id, int local_yn, char *mai
 
                
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
-       _bindStmtFieldDataInt(hStmt, i++, result_mailbox->mailbox_id);
-       _bindStmtFieldDataString(hStmt, i++, (char *)result_mailbox->mailbox_name ? result_mailbox->mailbox_name : "", 0, MAILBOX_NAME_LEN_IN_MAIL_READ_MAIL_UID_TBL);
-       _bindStmtFieldDataInt(hStmt, i++, result_mailbox->mailbox_type);
-       _bindStmtFieldDataString(hStmt, i++, (char *)result_mailbox->alias ? result_mailbox->alias : "", 0, ALIAS_LEN_IN_MAIL_BOX_TBL);
-       _bindStmtFieldDataInt(hStmt, i++, result_mailbox->sync_with_server_yn);
-       _bindStmtFieldDataInt(hStmt, i++, result_mailbox->modifiable_yn);
-       _bindStmtFieldDataInt(hStmt, i++, result_mailbox->mail_slot_size);
-       _bindStmtFieldDataInt(hStmt, i++, result_mailbox->total_mail_count_on_server);
-       
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc == SQLITE_FULL), {error = EM_STORAGE_ERROR_DB_IS_FULL;goto FINISH_OFF; },
+       _bind_stmt_field_data_int(hStmt, i++, result_mailbox->mailbox_id);
+       _bind_stmt_field_data_string(hStmt, i++, (char *)result_mailbox->mailbox_name ? result_mailbox->mailbox_name : "", 0, MAILBOX_NAME_LEN_IN_MAIL_READ_MAIL_UID_TBL);
+       _bind_stmt_field_data_int(hStmt, i++, result_mailbox->mailbox_type);
+       _bind_stmt_field_data_string(hStmt, i++, (char *)result_mailbox->alias ? result_mailbox->alias : "", 0, ALIAS_LEN_IN_MAIL_BOX_TBL);
+       _bind_stmt_field_data_int(hStmt, i++, result_mailbox->sync_with_server_yn);
+       _bind_stmt_field_data_int(hStmt, i++, result_mailbox->modifiable_yn);
+       _bind_stmt_field_data_int(hStmt, i++, result_mailbox->mail_slot_size);
+       _bind_stmt_field_data_int(hStmt, i++, result_mailbox->total_mail_count_on_server);
+       
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+       EM_DEBUG_DB_EXEC((rc == SQLITE_FULL), {error = EMF_ERROR_MAIL_MEMORY_FULL;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
 
        ret = true;
 
 FINISH_OFF:
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        _DISCONNECT_DB;
        
        if (hStmt != NULL)  {
                rc = sqlite3_finalize(hStmt);
                if (rc != SQLITE_OK)  {
                        EM_DEBUG_EXCEPTION(" sqlite3_finalize failed - %d", rc);
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
        }
        
@@ -5001,7 +5023,7 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int em_storage_update_mailbox_type(int account_id, int local_yn, char *mailbox_name, emf_mailbox_tbl_t* target_mailbox, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_update_mailbox_type(int account_id, int local_yn, char *mailbox_name, emstorage_mailbox_tbl_t* target_mailbox, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], local_yn[%d], mailbox_name[%s], target_mailbox[%p], transaction[%d], err_code[%p]", account_id, local_yn, mailbox_name, target_mailbox, transaction, err_code);
        
@@ -5009,18 +5031,18 @@ EXPORT_API int em_storage_update_mailbox_type(int account_id, int local_yn, char
                EM_DEBUG_EXCEPTION(" account_id[%d], local_yn[%d], mailbox_name[%s], target_mailbox[%p]", account_id, local_yn, mailbox_name, target_mailbox);
                
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
        int rc, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        char sql_query_string[QUERY_SIZE] = {0, };
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
        
-       EM_DEBUG_LOG("em_storage_update_mailbox_type");
+       EM_DEBUG_LOG("emstorage_update_mailbox_type");
        
        DB_STMT hStmt = NULL;
        int i = 0;
@@ -5049,24 +5071,24 @@ EXPORT_API int em_storage_update_mailbox_type(int account_id, int local_yn, char
 
        EM_DEBUG_LOG("SQL(%s)", sql_query_string);
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
-       _bindStmtFieldDataInt(hStmt, i++, target_mailbox->mailbox_type);
+       _bind_stmt_field_data_int(hStmt, i++, target_mailbox->mailbox_type);
        
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc == SQLITE_FULL), {error = EM_STORAGE_ERROR_DB_IS_FULL;goto FINISH_OFF; },
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+       EM_DEBUG_DB_EXEC((rc == SQLITE_FULL), {error = EMF_ERROR_MAIL_MEMORY_FULL;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
 
        if (hStmt != NULL)  {
                rc = sqlite3_finalize(hStmt);
                if (rc != SQLITE_OK)  {
                        EM_DEBUG_EXCEPTION(" sqlite3_finalize failed - %d", rc);
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
                hStmt = NULL;
        }
@@ -5075,6 +5097,7 @@ EXPORT_API int em_storage_update_mailbox_type(int account_id, int local_yn, char
        i = 0;
        SNPRINTF(sql_query_string, sizeof(sql_query_string),
                        "UPDATE mail_tbl SET"
+                       " mailbox_id = ?"
                        " mailbox_type = ?"
                        " WHERE account_id = %d"
                        " AND mailbox_name = '%s'"
@@ -5083,30 +5106,31 @@ EXPORT_API int em_storage_update_mailbox_type(int account_id, int local_yn, char
 
        EM_DEBUG_LOG("SQL[%s]", sql_query_string);
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
-       _bindStmtFieldDataInt(hStmt, i++, target_mailbox->mailbox_type);
+       _bind_stmt_field_data_int(hStmt, i++, target_mailbox->mailbox_id);
+       _bind_stmt_field_data_int(hStmt, i++, target_mailbox->mailbox_type);
        
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc == SQLITE_FULL), {error = EM_STORAGE_ERROR_DB_IS_FULL;goto FINISH_OFF; },
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+       EM_DEBUG_DB_EXEC((rc == SQLITE_FULL), {error = EMF_ERROR_MAIL_MEMORY_FULL;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
 
        ret = true;
 
 FINISH_OFF:
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        _DISCONNECT_DB;
        
        if (hStmt != NULL)  {
                rc = sqlite3_finalize(hStmt);
                if (rc != SQLITE_OK)  {
                        EM_DEBUG_EXCEPTION(" sqlite3_finalize failed - %d", rc);
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
        }
        
@@ -5118,24 +5142,40 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int em_storage_add_mailbox(emf_mailbox_tbl_t* mailbox_name, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_add_mailbox(emstorage_mailbox_tbl_t* mailbox_tbl, int transaction, int *err_code)
 {
-       EM_DEBUG_FUNC_BEGIN("mailbox_name[%p], transaction[%d], err_code[%p]", mailbox_name, transaction, err_code);
+       EM_DEBUG_FUNC_BEGIN("mailbox_tbl[%p], transaction[%d], err_code[%p]", mailbox_tbl, transaction, err_code);
        
-       if (!mailbox_name)  {
+       if (!mailbox_tbl)  {
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
 
        int rc, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        DB_STMT hStmt = NULL;
        char sql_query_string[QUERY_SIZE] = {0,};
+       char **result = NULL;
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
-       
+       EM_SAFE_STRCPY(sql_query_string, "SELECT max(rowid) FROM mail_box_tbl;");
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
+               ("SQL(%s) sqlite3_get_table fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
+
+       if (NULL == result[1])
+               rc = 1;
+       else
+               rc = atoi(result[1]) + 1;
+       sqlite3_free_table(result);
+
+       memset(sql_query_string, 0, sizeof(char) * QUERY_SIZE);
+
+       mailbox_tbl->mailbox_id = rc;
+
        SNPRINTF(sql_query_string, sizeof(sql_query_string),
                "INSERT INTO mail_box_tbl VALUES "
                "( ?"  /*  mailbox_id */
@@ -5151,32 +5191,32 @@ EXPORT_API int em_storage_add_mailbox(emf_mailbox_tbl_t* mailbox_name, int trans
                ", ? )");/*  mail_slot_size */
        
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
        EM_DEBUG_LOG("After sqlite3_prepare hStmt = %p", hStmt);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        int col_index = 0;
 
-       _bindStmtFieldDataInt(hStmt, col_index++, mailbox_name->mailbox_id);
-       _bindStmtFieldDataInt(hStmt, col_index++, mailbox_name->account_id);
-       _bindStmtFieldDataInt(hStmt, col_index++, mailbox_name->local_yn);
-       _bindStmtFieldDataString(hStmt, col_index++, (char *)mailbox_name->mailbox_name, 0, MAILBOX_NAME_LEN_IN_MAIL_BOX_TBL);
-       _bindStmtFieldDataInt(hStmt, col_index++, mailbox_name->mailbox_type);
-       _bindStmtFieldDataString(hStmt, col_index++, (char *)mailbox_name->alias, 0, ALIAS_LEN_IN_MAIL_BOX_TBL);
-       _bindStmtFieldDataInt(hStmt, col_index++, mailbox_name->sync_with_server_yn);
-       _bindStmtFieldDataInt(hStmt, col_index++, mailbox_name->modifiable_yn);
-       _bindStmtFieldDataInt(hStmt, col_index++, mailbox_name->total_mail_count_on_server);
-       _bindStmtFieldDataInt(hStmt, col_index++, 0);
-       _bindStmtFieldDataInt(hStmt, col_index++, mailbox_name->mail_slot_size);
-
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       _bind_stmt_field_data_int(hStmt, col_index++, mailbox_tbl->mailbox_id);
+       _bind_stmt_field_data_int(hStmt, col_index++, mailbox_tbl->account_id);
+       _bind_stmt_field_data_int(hStmt, col_index++, mailbox_tbl->local_yn);
+       _bind_stmt_field_data_string(hStmt, col_index++, (char *)mailbox_tbl->mailbox_name, 0, MAILBOX_NAME_LEN_IN_MAIL_BOX_TBL);
+       _bind_stmt_field_data_int(hStmt, col_index++, mailbox_tbl->mailbox_type);
+       _bind_stmt_field_data_string(hStmt, col_index++, (char *)mailbox_tbl->alias, 0, ALIAS_LEN_IN_MAIL_BOX_TBL);
+       _bind_stmt_field_data_int(hStmt, col_index++, mailbox_tbl->sync_with_server_yn);
+       _bind_stmt_field_data_int(hStmt, col_index++, mailbox_tbl->modifiable_yn);
+       _bind_stmt_field_data_int(hStmt, col_index++, mailbox_tbl->total_mail_count_on_server);
+       _bind_stmt_field_data_int(hStmt, col_index++, 0);
+       _bind_stmt_field_data_int(hStmt, col_index++, mailbox_tbl->mail_slot_size);
+
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("sqlite3_step fail:%dn", rc));
  
-       if (!em_storage_notify_storage_event(NOTI_MAILBOX_ADD, mailbox_name->account_id, 0, mailbox_name->mailbox_name, 0))
-               EM_DEBUG_EXCEPTION("em_storage_notify_storage_event[ NOTI_MAILBOX_ADD] : Notification Failed");
+       if (!emstorage_notify_storage_event(NOTI_MAILBOX_ADD, mailbox_tbl->account_id, 0, mailbox_tbl->mailbox_name, 0))
+               EM_DEBUG_EXCEPTION("emstorage_notify_storage_event[ NOTI_MAILBOX_ADD] : Notification Failed");
        ret = true;
        
 FINISH_OFF:
@@ -5186,11 +5226,11 @@ FINISH_OFF:
                rc = sqlite3_finalize(hStmt);
                if (rc != SQLITE_OK)  {
                        EM_DEBUG_EXCEPTION("sqlite3_finalize failed - %d", rc);
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
        }
 
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -5200,7 +5240,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_set_all_mailbox_modifiable_yn(int account_id, int modifiable_yn, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_set_all_mailbox_modifiable_yn(int account_id, int modifiable_yn, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], modifiable_yn[%d], err_code[%p]", account_id, modifiable_yn, err_code);
        
@@ -5209,21 +5249,21 @@ EXPORT_API int em_storage_set_all_mailbox_modifiable_yn(int account_id, int modi
                EM_DEBUG_EXCEPTION("account_id[%d]", account_id);
                
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        int rc, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        char sql_query_string[QUERY_SIZE] = {0,};
 
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
 
 
        SNPRINTF(sql_query_string, sizeof(sql_query_string), "UPDATE mail_box_tbl SET modifiable_yn = %d WHERE account_id = %d", modifiable_yn, account_id);
  
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        rc = sqlite3_changes(local_db_handle);
@@ -5234,7 +5274,7 @@ EXPORT_API int em_storage_set_all_mailbox_modifiable_yn(int account_id, int modi
        ret = true;
        
 FINISH_OFF:
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -5245,7 +5285,7 @@ FINISH_OFF:
 
 }
 
-EXPORT_API int em_storage_delete_mailbox(int account_id, int local_yn, char *mailbox_name, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_delete_mailbox(int account_id, int local_yn, char *mailbox_name, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], local_yn[%d], mailbox_name[%p], transaction[%d], err_code[%p]", account_id, local_yn, mailbox_name, transaction, err_code);
        
@@ -5253,16 +5293,16 @@ EXPORT_API int em_storage_delete_mailbox(int account_id, int local_yn, char *mai
                EM_DEBUG_EXCEPTION(" account_id[%d], local_yn[%d], mailbox_name[%p]", account_id, local_yn, mailbox_name);
                
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
        int rc, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        char sql_query_string[QUERY_SIZE] = {0, };
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
        
        if (local_yn == -1)
                SNPRINTF(sql_query_string, sizeof(sql_query_string), "DELETE FROM mail_box_tbl WHERE account_id = %d ", account_id);
@@ -5274,21 +5314,21 @@ EXPORT_API int em_storage_delete_mailbox(int account_id, int local_yn, char *mai
        }
        
        EM_DEBUG_LOG("mailbox sql_query_string [%s]", sql_query_string);
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
        
        rc = sqlite3_changes(local_db_handle);
        if (rc == 0)  {
                EM_DEBUG_EXCEPTION(" no (matched) mailbox_name found...");
-                       error = EM_STORAGE_ERROR_MAILBOX_NOT_FOUND;
+                       error = EMF_ERROR_MAILBOX_NOT_FOUND;
                ret = true;
        }
        ret = true;
        
 FINISH_OFF:
 
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -5298,22 +5338,22 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_free_mailbox(emf_mailbox_tbl_t** mailbox_list, int count, int *err_code)
+INTERNAL_FUNC int emstorage_free_mailbox(emstorage_mailbox_tbl_t** mailbox_list, int count, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("mailbox_list[%p], count[%d], err_code[%p]", mailbox_list, count, err_code);
        
        int ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
                
        if (count > 0)  {
                if (!mailbox_list || !*mailbox_list)  {
                        EM_DEBUG_EXCEPTION(" mailbox_list[%p], count[%d]", mailbox_list, count);
                        
-                       error = EM_STORAGE_ERROR_INVALID_PARAM;
+                       error = EMF_ERROR_INVALID_PARAM;
                        goto FINISH_OFF;
                }
                
-               emf_mailbox_tbl_t* p = *mailbox_list;
+               emstorage_mailbox_tbl_t* p = *mailbox_list;
                int i = 0;
                
                for (; i < count; i++) {
@@ -5334,31 +5374,31 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_get_count_read_mail_uid(int account_id, char *mailbox_name, int *count, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_get_count_read_mail_uid(int account_id, char *mailbox_name, int *count, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], mailbox_name[%p], count[%p], transaction[%d], err_code[%p]", account_id, mailbox_name , count,  transaction, err_code);
        
-       if (account_id < FIRST_ACCOUNT_ID || !mailbox_name || !count)  {                /* TODO: confirm me */
+       if (account_id < FIRST_ACCOUNT_ID || !mailbox_name || !count)  {
                EM_DEBUG_EXCEPTION(" account_id[%d], mailbox_name[%p], count[%p], exist[%p]", account_id, mailbox_name, count);
                
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
        int rc = -1, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        char sql_query_string[QUERY_SIZE] = {0, };
 
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_READ_TRANSACTION(transaction);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_READ_TRANSACTION(transaction);
        SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT COUNT(*) FROM mail_read_mail_uid_tbl WHERE account_id = %d AND mailbox_name = '%s'  ", account_id, mailbox_name);
        EM_DEBUG_LOG(">>> SQL [ %s ] ", sql_query_string);
 
        char **result;
-       /*  rc = sqlite3_get_table(local_db_handle, sql_query_string, &result, NULL, NULL, NULL); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        *count = atoi(result[1]);
@@ -5367,7 +5407,7 @@ EXPORT_API int em_storage_get_count_read_mail_uid(int account_id, char *mailbox_
        ret = true;
        
 FINISH_OFF:
-       EM_STORAGE_FINISH_READ_TRANSACTION(transaction);
+       EMSTORAGE_FINISH_READ_TRANSACTION(transaction);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -5379,7 +5419,7 @@ FINISH_OFF:
 
 
 
-EXPORT_API int em_storage_check_read_mail_uid(int account_id, char *mailbox_name, char *uid, int *exist, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_check_read_mail_uid(int account_id, char *mailbox_name, char *uid, int *exist, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], mailbox_name[%p], uid[%p], exist[%p], transaction[%d], err_code[%p]", account_id, mailbox_name , uid, exist, transaction, err_code);
        
@@ -5387,15 +5427,15 @@ EXPORT_API int em_storage_check_read_mail_uid(int account_id, char *mailbox_name
                EM_DEBUG_EXCEPTION(" account_id[%d], mailbox_name[%p], uid[%p], exist[%p]", account_id, mailbox_name , uid, exist);
                
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
        int rc = -1, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        char sql_query_string[QUERY_SIZE] = {0, };
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_READ_TRANSACTION(transaction);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_READ_TRANSACTION(transaction);
        
        if (mailbox_name)  {
                SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT COUNT(*) FROM mail_read_mail_uid_tbl WHERE account_id = %d AND mailbox_name = '%s' AND s_uid = '%s' ", account_id, mailbox_name, uid);
@@ -5405,9 +5445,9 @@ EXPORT_API int em_storage_check_read_mail_uid(int account_id, char *mailbox_name
        }
        
        char **result;
-       /*  rc = sqlite3_get_table(local_db_handle, sql_query_string, &result, NULL, NULL, NULL); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        *exist = atoi(result[1]);
@@ -5421,7 +5461,7 @@ EXPORT_API int em_storage_check_read_mail_uid(int account_id, char *mailbox_name
        ret = true;
        
 FINISH_OFF:
-       EM_STORAGE_FINISH_READ_TRANSACTION(transaction);
+       EMSTORAGE_FINISH_READ_TRANSACTION(transaction);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -5431,54 +5471,54 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_get_downloaded_mail(int mail_id, emf_mail_tbl_t** mail, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_get_downloaded_mail(int mail_id, emstorage_mail_tbl_t** mail, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("mail_id[%d], mail[%p], err_code[%p]", mail_id, mail, err_code);
        
        if (!mail)  {
                EM_DEBUG_EXCEPTION(" mail_id[%d], mail[%p]", mail_id, mail);
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
        int rc, ret = false, temp_rule;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        DB_STMT hStmt = NULL;
        char sql_query_string[QUERY_SIZE] = {0, };
 
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_READ_TRANSACTION(transaction);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_READ_TRANSACTION(transaction);
        
        SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT * FROM mail_read_mail_uid_tbl WHERE local_uid = %d", mail_id);
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
        EM_DEBUG_LOG("sqlite3_prepare hStmt = %p", hStmt);
 
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
 
-       *mail = (emf_mail_tbl_t*)malloc(sizeof(emf_mail_tbl_t));
+       *mail = (emstorage_mail_tbl_t*)malloc(sizeof(emstorage_mail_tbl_t));
        if (*mail == NULL) {
-               error = EM_STORAGE_ERROR_OUT_OF_MEMORY;
+               error = EMF_ERROR_OUT_OF_MEMORY;
                EM_DEBUG_EXCEPTION("Memory allocation for mail failed.");
                goto FINISH_OFF;
 
        }
-       memset(*mail, 0x00, sizeof(emf_mail_tbl_t));
+       memset(*mail, 0x00, sizeof(emstorage_mail_tbl_t));
        
-       _getStmtFieldDataInt(hStmt, &((*mail)->account_id), ACCOUNT_ID_IDX_IN_MAIL_READ_MAIL_UID_TBL);
-       _getStmtFieldDataString(hStmt, &((*mail)->mailbox_name), 0, LOCAL_MBOX_IDX_IN_MAIL_READ_MAIL_UID_TBL);
-       _getStmtFieldDataInt(hStmt, &((*mail)->mail_id), LOCAL_UID_IDX_IN_MAIL_READ_MAIL_UID_TBL);
-       _getStmtFieldDataString(hStmt, &((*mail)->server_mailbox_name), 0, MAILBOX_NAME_IDX_IN_MAIL_READ_MAIL_UID_TBL);
-       _getStmtFieldDataString(hStmt, &((*mail)->server_mail_id), 0, S_UID_IDX_IN_MAIL_READ_MAIL_UID_TBL);
-       _getStmtFieldDataInt(hStmt, &((*mail)->mail_size), DATA1_IDX_IN_MAIL_READ_MAIL_UID_TBL);
-       _getStmtFieldDataInt(hStmt, &temp_rule, FLAG_IDX_IN_MAIL_READ_MAIL_UID_TBL);
+       _get_stmt_field_data_int(hStmt, &((*mail)->account_id), ACCOUNT_ID_IDX_IN_MAIL_READ_MAIL_UID_TBL);
+       _get_stmt_field_data_string(hStmt, &((*mail)->mailbox_name), 0, LOCAL_MBOX_IDX_IN_MAIL_READ_MAIL_UID_TBL);
+       _get_stmt_field_data_int(hStmt, &((*mail)->mail_id), LOCAL_UID_IDX_IN_MAIL_READ_MAIL_UID_TBL);
+       _get_stmt_field_data_string(hStmt, &((*mail)->server_mailbox_name), 0, MAILBOX_NAME_IDX_IN_MAIL_READ_MAIL_UID_TBL);
+       _get_stmt_field_data_string(hStmt, &((*mail)->server_mail_id), 0, S_UID_IDX_IN_MAIL_READ_MAIL_UID_TBL);
+       _get_stmt_field_data_int(hStmt, &((*mail)->mail_size), DATA1_IDX_IN_MAIL_READ_MAIL_UID_TBL);
+       _get_stmt_field_data_int(hStmt, &temp_rule, FLAG_IDX_IN_MAIL_READ_MAIL_UID_TBL);
        
        (*mail)->server_mail_status = 1;
        
@@ -5490,11 +5530,11 @@ FINISH_OFF:
                rc = sqlite3_finalize(hStmt);
                if (rc != SQLITE_OK)  {
                        EM_DEBUG_EXCEPTION(" sqlite3_finalize failed - %d", rc);
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
        }
        
-       EM_STORAGE_FINISH_READ_TRANSACTION(transaction);
+       EMSTORAGE_FINISH_READ_TRANSACTION(transaction);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -5504,7 +5544,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_get_downloaded_list(int account_id, char *local_mbox, emf_mail_read_mail_uid_tbl_t** read_mail_uid, int *count, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_get_downloaded_list(int account_id, char *local_mbox, emstorage_read_mail_uid_tbl_t** read_mail_uid, int *count, int transaction, int *err_code)
 {
        EM_PROFILE_BEGIN(emStorageGetDownloadList);
        EM_DEBUG_FUNC_BEGIN("account_id[%d], local_mbox[%s], read_mail_uid[%p], count[%p], transaction[%d], err_code[%p]", account_id, local_mbox, read_mail_uid, count, transaction, err_code);
@@ -5512,21 +5552,21 @@ EXPORT_API int em_storage_get_downloaded_list(int account_id, char *local_mbox,
                EM_DEBUG_EXCEPTION(" account_id[%d], local_mbox[%s], read_mail_uid[%p], count[%p]", account_id, local_mbox, read_mail_uid, count);
                
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
 
        int rc, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
  
        DB_STMT hStmt = NULL;
        char sql_query_string[QUERY_SIZE] = {0, };
        
-       emf_mail_read_mail_uid_tbl_t* p_data_tbl = NULL;
+       emstorage_read_mail_uid_tbl_t* p_data_tbl = NULL;
        int i = 0;
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_READ_TRANSACTION(transaction);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_READ_TRANSACTION(transaction);
 
        if (local_mbox)
                SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT * FROM mail_read_mail_uid_tbl WHERE account_id = %d AND UPPER(local_mbox) = UPPER('%s')", account_id, local_mbox);
@@ -5537,20 +5577,20 @@ EXPORT_API int em_storage_get_downloaded_list(int account_id, char *local_mbox,
  
        
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
        EM_DEBUG_LOG("sqlite3_prepare hStmt = %p", hStmt);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
        
        char **result;
        /*  rc = sqlite3_get_table(local_db_handle, sql_query_string, &result, count, NULL, NULL); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, count, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, count, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        sqlite3_free_table(result);
@@ -5561,26 +5601,26 @@ EXPORT_API int em_storage_get_downloaded_list(int account_id, char *local_mbox,
        }
 
 
-       if (!(p_data_tbl = (emf_mail_read_mail_uid_tbl_t*)malloc(sizeof(emf_mail_read_mail_uid_tbl_t) * *count)))  {
+       if (!(p_data_tbl = (emstorage_read_mail_uid_tbl_t*)malloc(sizeof(emstorage_read_mail_uid_tbl_t) * *count)))  {
                EM_DEBUG_EXCEPTION(" malloc failed...");
-               error = EM_STORAGE_ERROR_OUT_OF_MEMORY;
+               error = EMF_ERROR_OUT_OF_MEMORY;
                goto FINISH_OFF;
        }
 
-       memset(p_data_tbl, 0x00, sizeof(emf_mail_read_mail_uid_tbl_t)* *count);
+       memset(p_data_tbl, 0x00, sizeof(emstorage_read_mail_uid_tbl_t)* *count);
 
        for (i = 0; i < *count; ++i)  {
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].account_id), ACCOUNT_ID_IDX_IN_MAIL_READ_MAIL_UID_TBL);
-               _getStmtFieldDataString(hStmt, &(p_data_tbl[i].local_mbox), 0, LOCAL_MBOX_IDX_IN_MAIL_READ_MAIL_UID_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].local_uid), LOCAL_UID_IDX_IN_MAIL_READ_MAIL_UID_TBL);
-               _getStmtFieldDataString(hStmt, &(p_data_tbl[i].mailbox_name), 0, MAILBOX_NAME_IDX_IN_MAIL_READ_MAIL_UID_TBL);
-               _getStmtFieldDataString(hStmt, &(p_data_tbl[i].s_uid), 0, S_UID_IDX_IN_MAIL_READ_MAIL_UID_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].data1), DATA1_IDX_IN_MAIL_READ_MAIL_UID_TBL);
-               _getStmtFieldDataString(hStmt, &(p_data_tbl[i].data2), 0, DATA2_IDX_IN_MAIL_READ_MAIL_UID_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].flag), FLAG_IDX_IN_MAIL_READ_MAIL_UID_TBL);
-               /*  rc = sqlite3_step(hStmt); */
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-               EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].account_id), ACCOUNT_ID_IDX_IN_MAIL_READ_MAIL_UID_TBL);
+               _get_stmt_field_data_string(hStmt, &(p_data_tbl[i].local_mbox), 0, LOCAL_MBOX_IDX_IN_MAIL_READ_MAIL_UID_TBL);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].local_uid), LOCAL_UID_IDX_IN_MAIL_READ_MAIL_UID_TBL);
+               _get_stmt_field_data_string(hStmt, &(p_data_tbl[i].mailbox_name), 0, MAILBOX_NAME_IDX_IN_MAIL_READ_MAIL_UID_TBL);
+               _get_stmt_field_data_string(hStmt, &(p_data_tbl[i].s_uid), 0, S_UID_IDX_IN_MAIL_READ_MAIL_UID_TBL);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].data1), DATA1_IDX_IN_MAIL_READ_MAIL_UID_TBL);
+               _get_stmt_field_data_string(hStmt, &(p_data_tbl[i].data2), 0, DATA2_IDX_IN_MAIL_READ_MAIL_UID_TBL);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].flag), FLAG_IDX_IN_MAIL_READ_MAIL_UID_TBL);
+
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+               EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                        ("sqlite3_step fail:%d", rc));
        }
        
@@ -5590,7 +5630,7 @@ FINISH_OFF:
        if (ret == true)
                *read_mail_uid = p_data_tbl;
        else if (p_data_tbl)
-               em_storage_free_read_mail_uid(&p_data_tbl, *count, NULL);
+               emstorage_free_read_mail_uid(&p_data_tbl, *count, NULL);
        
        if (hStmt != NULL)  {
                EM_DEBUG_LOG(" Before sqlite3_finalize hStmt = %p", hStmt);
@@ -5598,11 +5638,11 @@ FINISH_OFF:
                if (rc != SQLITE_OK)  {
                        EM_DEBUG_LOG(" sqlite3_finalize failed - %d", rc);
                        
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
        }
        
-       EM_STORAGE_FINISH_READ_TRANSACTION(transaction);
+       EMSTORAGE_FINISH_READ_TRANSACTION(transaction);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -5613,7 +5653,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_get_downloaded_mail_size(int account_id, char *local_mbox, int local_uid, char *mailbox_name, char *uid, int *mail_size, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_get_downloaded_mail_size(int account_id, char *local_mbox, int local_uid, char *mailbox_name, char *uid, int *mail_size, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], local_mbox[%p], locacal_uid[%d], mailbox_name[%p], uid[%p], mail_size[%p], transaction[%d], err_code[%p]", account_id, local_mbox, local_uid, mailbox_name, uid, mail_size, transaction, err_code);
        
@@ -5621,18 +5661,18 @@ EXPORT_API int em_storage_get_downloaded_mail_size(int account_id, char *local_m
                EM_DEBUG_EXCEPTION(" account_id[%d], local_mbox[%p], locacal_uid[%d], mailbox_name[%p], uid[%p], mail_size[%p]", account_id, local_mbox, local_uid, mailbox_name, uid, mail_size);
                
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
        int rc, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        DB_STMT hStmt = NULL;
        char sql_query_string[QUERY_SIZE] = {0, };
        
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_READ_TRANSACTION(transaction);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_READ_TRANSACTION(transaction);
        
        if (mailbox_name) {
                SNPRINTF(sql_query_string, sizeof(sql_query_string),
@@ -5655,22 +5695,22 @@ EXPORT_API int em_storage_get_downloaded_mail_size(int account_id, char *local_m
        }
        
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
 
        if (rc == SQLITE_DONE) {
                EM_DEBUG_EXCEPTION(" no matched mail found....");
-               error = EM_STORAGE_ERROR_MAIL_NOT_FOUND;
+               error = EMF_ERROR_MAIL_NOT_FOUND;
                goto FINISH_OFF;                
        }
  
-       _getStmtFieldDataInt(hStmt, mail_size, 0);
+       _get_stmt_field_data_int(hStmt, mail_size, 0);
        
        ret = true;
        
@@ -5680,11 +5720,11 @@ FINISH_OFF:
                if (rc != SQLITE_OK)  {
                        EM_DEBUG_LOG(" sqlite3_finalize failed - %d", rc);
                        
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
        }
        
-       EM_STORAGE_FINISH_READ_TRANSACTION(transaction);
+       EMSTORAGE_FINISH_READ_TRANSACTION(transaction);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -5694,31 +5734,31 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_add_downloaded_mail(emf_mail_read_mail_uid_tbl_t* read_mail_uid, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_add_downloaded_mail(emstorage_read_mail_uid_tbl_t* read_mail_uid, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("read_mail_uid[%p], transaction[%d], err_code[%p]", read_mail_uid, transaction, err_code);
        
        if (!read_mail_uid)  {
                EM_DEBUG_EXCEPTION("read_mail_uid[%p]", read_mail_uid);
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
        int rc, rc2,  ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        DB_STMT hStmt = NULL;
        char sql_query_string[QUERY_SIZE] = {0, };
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
        
        char *sql = "SELECT max(rowid) FROM mail_read_mail_uid_tbl;";
        char **result = NULL;
 
-       /*  rc = sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL);  */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql, rc, sqlite3_errmsg(local_db_handle)));
 
        if (NULL==result[1]) rc = 1;
@@ -5738,12 +5778,12 @@ EXPORT_API int em_storage_add_downloaded_mail(emf_mail_read_mail_uid_tbl_t* read
                ", ? )");
        
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc2);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc2);
        if (rc2 != SQLITE_OK)  {
                EM_DEBUG_LOG("sqlite3_prepare hStmt = %p", hStmt);
                EM_DEBUG_EXCEPTION("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle));
                
-               error = EM_STORAGE_ERROR_DB_FAILURE;
+               error = EMF_ERROR_DB_FAILURE;
                goto FINISH_OFF;
        }
 
@@ -5757,21 +5797,21 @@ EXPORT_API int em_storage_add_downloaded_mail(emf_mail_read_mail_uid_tbl_t* read
        EM_DEBUG_LOG("flag VALUE [%d] ", read_mail_uid->flag);
        EM_DEBUG_LOG("rc VALUE [%d] ", rc);
 
-       _bindStmtFieldDataInt(hStmt, ACCOUNT_ID_IDX_IN_MAIL_READ_MAIL_UID_TBL, read_mail_uid->account_id);
-       _bindStmtFieldDataString(hStmt, LOCAL_MBOX_IDX_IN_MAIL_READ_MAIL_UID_TBL, (char *)read_mail_uid->local_mbox, 0, LOCAL_MBOX_LEN_IN_MAIL_READ_MAIL_UID_TBL);
-       _bindStmtFieldDataInt(hStmt, LOCAL_UID_IDX_IN_MAIL_READ_MAIL_UID_TBL, read_mail_uid->local_uid);
-       _bindStmtFieldDataString(hStmt, MAILBOX_NAME_IDX_IN_MAIL_READ_MAIL_UID_TBL, (char *)read_mail_uid->mailbox_name, 0, MAILBOX_NAME_LEN_IN_MAIL_READ_MAIL_UID_TBL);
-       _bindStmtFieldDataString(hStmt, S_UID_IDX_IN_MAIL_READ_MAIL_UID_TBL, (char *)read_mail_uid->s_uid, 0, S_UID_LEN_IN_MAIL_READ_MAIL_UID_TBL);
-       _bindStmtFieldDataInt(hStmt, DATA1_IDX_IN_MAIL_READ_MAIL_UID_TBL, read_mail_uid->data1);
-       _bindStmtFieldDataString(hStmt, DATA2_IDX_IN_MAIL_READ_MAIL_UID_TBL, (char *)read_mail_uid->data2, 0, DATA2_LEN_IN_MAIL_READ_MAIL_UID_TBL);
-       _bindStmtFieldDataInt(hStmt, FLAG_IDX_IN_MAIL_READ_MAIL_UID_TBL, read_mail_uid->flag);
-       _bindStmtFieldDataInt(hStmt, IDX_NUM_IDX_IN_MAIL_READ_MAIL_UID_TBL, rc);
-
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc == SQLITE_FULL), {error = EM_STORAGE_ERROR_DB_IS_FULL;goto FINISH_OFF; },
+       _bind_stmt_field_data_int(hStmt, ACCOUNT_ID_IDX_IN_MAIL_READ_MAIL_UID_TBL, read_mail_uid->account_id);
+       _bind_stmt_field_data_string(hStmt, LOCAL_MBOX_IDX_IN_MAIL_READ_MAIL_UID_TBL, (char *)read_mail_uid->local_mbox, 0, LOCAL_MBOX_LEN_IN_MAIL_READ_MAIL_UID_TBL);
+       _bind_stmt_field_data_int(hStmt, LOCAL_UID_IDX_IN_MAIL_READ_MAIL_UID_TBL, read_mail_uid->local_uid);
+       _bind_stmt_field_data_string(hStmt, MAILBOX_NAME_IDX_IN_MAIL_READ_MAIL_UID_TBL, (char *)read_mail_uid->mailbox_name, 0, MAILBOX_NAME_LEN_IN_MAIL_READ_MAIL_UID_TBL);
+       _bind_stmt_field_data_string(hStmt, S_UID_IDX_IN_MAIL_READ_MAIL_UID_TBL, (char *)read_mail_uid->s_uid, 0, S_UID_LEN_IN_MAIL_READ_MAIL_UID_TBL);
+       _bind_stmt_field_data_int(hStmt, DATA1_IDX_IN_MAIL_READ_MAIL_UID_TBL, read_mail_uid->data1);
+       _bind_stmt_field_data_string(hStmt, DATA2_IDX_IN_MAIL_READ_MAIL_UID_TBL, (char *)read_mail_uid->data2, 0, DATA2_LEN_IN_MAIL_READ_MAIL_UID_TBL);
+       _bind_stmt_field_data_int(hStmt, FLAG_IDX_IN_MAIL_READ_MAIL_UID_TBL, read_mail_uid->flag);
+       _bind_stmt_field_data_int(hStmt, IDX_NUM_IDX_IN_MAIL_READ_MAIL_UID_TBL, rc);
+
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+       EM_DEBUG_DB_EXEC((rc == SQLITE_FULL), {error = EMF_ERROR_MAIL_MEMORY_FULL;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("sqlite3_step fail[%d] [%s]", rc, sqlite3_errmsg(local_db_handle)));
 
        
@@ -5784,11 +5824,11 @@ FINISH_OFF:
                rc = sqlite3_finalize(hStmt);
                if (rc != SQLITE_OK)  {
                        EM_DEBUG_LOG(" sqlite3_finalize failed - %d", rc);
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
        }
  
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -5798,7 +5838,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_change_read_mail_uid(int account_id, char *local_mbox, int local_uid, char *mailbox_name, char *uid, emf_mail_read_mail_uid_tbl_t* read_mail_uid, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_change_read_mail_uid(int account_id, char *local_mbox, int local_uid, char *mailbox_name, char *uid, emstorage_read_mail_uid_tbl_t* read_mail_uid, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], local_mbox[%p], local_uid[%d], mailbox_name[%p], uid[%p], read_mail_uid[%p], transaction[%d], err_code[%p]", account_id, local_mbox, local_uid, mailbox_name, uid, read_mail_uid, transaction, err_code);
        
@@ -5806,18 +5846,18 @@ EXPORT_API int em_storage_change_read_mail_uid(int account_id, char *local_mbox,
                EM_DEBUG_EXCEPTION(" account_id[%d], local_mbox[%p], local_uid[%d], mailbox_name[%p], uid[%p], read_mail_uid[%p]", account_id, local_mbox, local_uid, mailbox_name, uid, read_mail_uid);
                
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
        int rc, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        DB_STMT hStmt = NULL;
        char sql_query_string[QUERY_SIZE] = {0, };
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
 
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
        
        SNPRINTF(sql_query_string, sizeof(sql_query_string),
                "UPDATE mail_read_mail_uid_tbl SET"
@@ -5836,31 +5876,31 @@ EXPORT_API int em_storage_change_read_mail_uid(int account_id, char *local_mbox,
                " AND s_uid = ?");
 
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
        EM_DEBUG_LOG("sqlite3_prepare hStmt = %p", hStmt);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
  
        
        int i = 0;
        
-       _bindStmtFieldDataInt(hStmt, i++, read_mail_uid->account_id);
-       _bindStmtFieldDataString(hStmt, i++, (char *)read_mail_uid->local_mbox, 0, LOCAL_MBOX_LEN_IN_MAIL_READ_MAIL_UID_TBL);
-       _bindStmtFieldDataInt(hStmt, i++, read_mail_uid->local_uid);
-       _bindStmtFieldDataString(hStmt, i++, (char *)read_mail_uid->mailbox_name, 0, MAILBOX_NAME_LEN_IN_MAIL_READ_MAIL_UID_TBL);
-       _bindStmtFieldDataString(hStmt, i++, (char *)read_mail_uid->s_uid, 0, S_UID_LEN_IN_MAIL_READ_MAIL_UID_TBL);
-       _bindStmtFieldDataInt(hStmt, i++, read_mail_uid->data1);
-       _bindStmtFieldDataString(hStmt, i++, (char *)read_mail_uid->data2, 0, DATA2_LEN_IN_MAIL_READ_MAIL_UID_TBL);
-       _bindStmtFieldDataInt(hStmt, i++, read_mail_uid->flag);
-       _bindStmtFieldDataInt(hStmt, i++, account_id);
-       _bindStmtFieldDataString(hStmt, i++, (char *)local_mbox, 0, LOCAL_MBOX_LEN_IN_MAIL_READ_MAIL_UID_TBL);
-       _bindStmtFieldDataInt(hStmt, i++, local_uid);
-       _bindStmtFieldDataString(hStmt, i++, (char *)mailbox_name, 0, MAILBOX_NAME_LEN_IN_MAIL_READ_MAIL_UID_TBL);
-       _bindStmtFieldDataString(hStmt, i++, (char *)uid, 0, S_UID_LEN_IN_MAIL_READ_MAIL_UID_TBL);
+       _bind_stmt_field_data_int(hStmt, i++, read_mail_uid->account_id);
+       _bind_stmt_field_data_string(hStmt, i++, (char *)read_mail_uid->local_mbox, 0, LOCAL_MBOX_LEN_IN_MAIL_READ_MAIL_UID_TBL);
+       _bind_stmt_field_data_int(hStmt, i++, read_mail_uid->local_uid);
+       _bind_stmt_field_data_string(hStmt, i++, (char *)read_mail_uid->mailbox_name, 0, MAILBOX_NAME_LEN_IN_MAIL_READ_MAIL_UID_TBL);
+       _bind_stmt_field_data_string(hStmt, i++, (char *)read_mail_uid->s_uid, 0, S_UID_LEN_IN_MAIL_READ_MAIL_UID_TBL);
+       _bind_stmt_field_data_int(hStmt, i++, read_mail_uid->data1);
+       _bind_stmt_field_data_string(hStmt, i++, (char *)read_mail_uid->data2, 0, DATA2_LEN_IN_MAIL_READ_MAIL_UID_TBL);
+       _bind_stmt_field_data_int(hStmt, i++, read_mail_uid->flag);
+       _bind_stmt_field_data_int(hStmt, i++, account_id);
+       _bind_stmt_field_data_string(hStmt, i++, (char *)local_mbox, 0, LOCAL_MBOX_LEN_IN_MAIL_READ_MAIL_UID_TBL);
+       _bind_stmt_field_data_int(hStmt, i++, local_uid);
+       _bind_stmt_field_data_string(hStmt, i++, (char *)mailbox_name, 0, MAILBOX_NAME_LEN_IN_MAIL_READ_MAIL_UID_TBL);
+       _bind_stmt_field_data_string(hStmt, i++, (char *)uid, 0, S_UID_LEN_IN_MAIL_READ_MAIL_UID_TBL);
  
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
        
        ret = true;
@@ -5873,11 +5913,11 @@ FINISH_OFF:
                if (rc != SQLITE_OK)  {
                        EM_DEBUG_LOG(" sqlite3_finalize failed - %d", rc);
                        
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
        }
  
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -5887,7 +5927,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_remove_downloaded_mail(int account_id, char *mailbox_name, char *uid, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_remove_downloaded_mail(int account_id, char *mailbox_name, char *uid, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], mailbox_name[%s], uid[%s], transaction[%d], err_code[%p]", account_id, mailbox_name, uid, transaction, err_code);
 
@@ -5895,17 +5935,17 @@ EXPORT_API int em_storage_remove_downloaded_mail(int account_id, char *mailbox_n
                EM_DEBUG_EXCEPTION(" account_id[%d], mailbox_name[%s], uid[%s]", account_id, mailbox_name, uid);
                
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
        int rc, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        char sql_query_string[QUERY_SIZE] = {0, };
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
 
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
        
        SNPRINTF(sql_query_string, sizeof(sql_query_string), "DELETE FROM mail_read_mail_uid_tbl WHERE account_id = %d ", account_id);
        
@@ -5917,8 +5957,8 @@ EXPORT_API int em_storage_remove_downloaded_mail(int account_id, char *mailbox_n
                SNPRINTF(sql_query_string+strlen(sql_query_string), sizeof(sql_query_string) - (1 + strlen(sql_query_string)), "AND s_uid='%s' ", uid);
        }
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
  
        
@@ -5926,7 +5966,7 @@ EXPORT_API int em_storage_remove_downloaded_mail(int account_id, char *mailbox_n
        
 FINISH_OFF:
  
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -5936,22 +5976,22 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_free_read_mail_uid(emf_mail_read_mail_uid_tbl_t** read_mail_uid, int count, int *err_code)
+INTERNAL_FUNC int emstorage_free_read_mail_uid(emstorage_read_mail_uid_tbl_t** read_mail_uid, int count, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("read_mail_uid[%p], count[%d], err_code[%p]", read_mail_uid, count, err_code);
        
        int ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        
        if (count > 0)  {
                if (!read_mail_uid || !*read_mail_uid)  {       
                        EM_DEBUG_EXCEPTION(" read_mail_uid[%p], count[%d]", read_mail_uid, count);
                        
-                       error = EM_STORAGE_ERROR_INVALID_PARAM;
+                       error = EMF_ERROR_INVALID_PARAM;
                        goto FINISH_OFF;
                }
                
-               emf_mail_read_mail_uid_tbl_t* p = *read_mail_uid;
+               emstorage_read_mail_uid_tbl_t* p = *read_mail_uid;
                int i;
                
                for (i = 0; i < count; i++)  {
@@ -5974,7 +6014,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_get_rule_count(int account_id, int *count, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_get_rule_count(int account_id, int *count, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], count[%p], transaction[%d], err_code[%p]", account_id, count, transaction, err_code);
        
@@ -5982,23 +6022,23 @@ EXPORT_API int em_storage_get_rule_count(int account_id, int *count, int transac
                EM_DEBUG_EXCEPTION(" account_id[%d], count[%p]", account_id, count);
                
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
        int rc = -1, ret = false;
-       int error =  EM_STORAGE_ERROR_NONE;
+       int error =  EMF_ERROR_NONE;
        char sql_query_string[QUERY_SIZE] = {0, };
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_READ_TRANSACTION(transaction);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_READ_TRANSACTION(transaction);
        
        SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT COUNT(*) FROM mail_rule_tbl WHERE account_id = %d", account_id);
        
        char **result;
-       /*  rc = sqlite3_get_table(local_db_handle, sql_query_string, &result, NULL, NULL, NULL); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        *count = atoi(result[1]);
@@ -6007,7 +6047,7 @@ EXPORT_API int em_storage_get_rule_count(int account_id, int *count, int transac
        ret = true;
        
 FINISH_OFF:
-       EM_STORAGE_FINISH_READ_TRANSACTION(transaction);
+       EMSTORAGE_FINISH_READ_TRANSACTION(transaction);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -6017,7 +6057,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_get_rule(int account_id, int type, int start_idx, int *select_num, int *is_completed, emf_mail_rule_tbl_t** rule_list, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_get_rule(int account_id, int type, int start_idx, int *select_num, int *is_completed, emstorage_rule_tbl_t** rule_list, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], type[%d], start_idx[%d], select_num[%p], is_completed[%p], rule_list[%p], transaction[%d], err_code[%p]", account_id, type, start_idx, select_num, is_completed, rule_list, transaction, err_code);
        
@@ -6025,22 +6065,22 @@ EXPORT_API int em_storage_get_rule(int account_id, int type, int start_idx, int
                EM_DEBUG_EXCEPTION(" account_id[%d], type[%d], start_idx[%d], select_num[%p], is_completed[%p], rule_list[%p]", account_id, type, start_idx, select_num, is_completed, rule_list);
                
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
        int ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        
-       emf_mail_rule_tbl_t* p_data_tbl = NULL;
+       emstorage_rule_tbl_t* p_data_tbl = NULL;
        int i = 0, count = 0;
        DB_STMT hStmt = NULL;
        char sql_query_string[QUERY_SIZE] = {0, };
        
        int rc;
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_READ_TRANSACTION(transaction);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_READ_TRANSACTION(transaction);
        
        if (type)
                SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT * FROM mail_rule_tbl WHERE account_id = %d AND type = %d", account_id, type);
@@ -6048,20 +6088,20 @@ EXPORT_API int em_storage_get_rule(int account_id, int type, int start_idx, int
                SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT * FROM mail_rule_tbl WHERE account_id = %d ORDER BY type", account_id);
                
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
        EM_DEBUG_LOG("sqlite3_prepare hStmt = %p", hStmt);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
 
        char **result;
        /*  rc = sqlite3_get_table(local_db_handle, sql_query_string, &result, &count, NULL, NULL); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, &count, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, &count, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        sqlite3_free_table(result);
@@ -6073,27 +6113,27 @@ EXPORT_API int em_storage_get_rule(int account_id, int type, int start_idx, int
        }
 
        
-       if (!(p_data_tbl = (emf_mail_rule_tbl_t*)malloc(sizeof(emf_mail_rule_tbl_t) * count))) {
+       if (!(p_data_tbl = (emstorage_rule_tbl_t*)malloc(sizeof(emstorage_rule_tbl_t) * count))) {
                EM_DEBUG_EXCEPTION(" malloc failed...");
                
-               error = EM_STORAGE_ERROR_OUT_OF_MEMORY;
+               error = EMF_ERROR_OUT_OF_MEMORY;
                goto FINISH_OFF;
        }
        
-       memset(p_data_tbl, 0x00, sizeof(emf_mail_rule_tbl_t) * count);
+       memset(p_data_tbl, 0x00, sizeof(emstorage_rule_tbl_t) * count);
        
        for (i = 0; i < count; i++)  {
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].account_id), ACCOUNT_ID_IDX_IN_MAIL_RULE_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].rule_id), RULE_ID_IDX_IN_MAIL_RULE_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].type), TYPE_IDX_IN_MAIL_RULE_TBL);
-               _getStmtFieldDataString(hStmt, &(p_data_tbl[i].value), 0, VALUE_IDX_IN_MAIL_RULE_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].action_type), ACTION_TYPE_IDX_IN_MAIL_RULE_TBL);
-               _getStmtFieldDataString(hStmt, &(p_data_tbl[i].dest_mailbox), 0, DEST_MAILBOX_IDX_IN_MAIL_RULE_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].flag1), FLAG1_IDX_IN_MAIL_RULE_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].flag2), FLAG2_IDX_IN_MAIL_RULE_TBL);
-               /*  rc = sqlite3_step(hStmt); */
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-               EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].account_id), ACCOUNT_ID_IDX_IN_MAIL_RULE_TBL);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].rule_id), RULE_ID_IDX_IN_MAIL_RULE_TBL);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].type), TYPE_IDX_IN_MAIL_RULE_TBL);
+               _get_stmt_field_data_string(hStmt, &(p_data_tbl[i].value), 0, VALUE_IDX_IN_MAIL_RULE_TBL);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].action_type), ACTION_TYPE_IDX_IN_MAIL_RULE_TBL);
+               _get_stmt_field_data_string(hStmt, &(p_data_tbl[i].dest_mailbox), 0, DEST_MAILBOX_IDX_IN_MAIL_RULE_TBL);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].flag1), FLAG1_IDX_IN_MAIL_RULE_TBL);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl[i].flag2), FLAG2_IDX_IN_MAIL_RULE_TBL);
+
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+               EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                        ("sqlite3_step fail:%d", rc));
        }
        
@@ -6108,7 +6148,7 @@ FINISH_OFF:
                *select_num = count;
        }
        else if (p_data_tbl != NULL)
-               em_storage_free_rule(&p_data_tbl, count, NULL); /* CID FIX */
+               emstorage_free_rule(&p_data_tbl, count, NULL); /* CID FIX */
        
        if (hStmt != NULL)  {
                EM_DEBUG_LOG("  sqlite3_finalize hStmt = %p", hStmt);
@@ -6116,12 +6156,12 @@ FINISH_OFF:
                rc = sqlite3_finalize(hStmt);
                if (rc != SQLITE_OK)  {
                        EM_DEBUG_LOG(" sqlite3_finalize failed - %d", rc);
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
        }
 
        
-       EM_STORAGE_FINISH_READ_TRANSACTION(transaction);
+       EMSTORAGE_FINISH_READ_TRANSACTION(transaction);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -6131,7 +6171,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_get_rule_by_id(int account_id, int rule_id, emf_mail_rule_tbl_t** rule, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_get_rule_by_id(int account_id, int rule_id, emstorage_rule_tbl_t** rule, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], rule_id[%d], rule[%p], transaction[%d], err_code[%p]", account_id, rule_id, rule, transaction, err_code);
 
@@ -6139,52 +6179,52 @@ EXPORT_API int em_storage_get_rule_by_id(int account_id, int rule_id, emf_mail_r
                EM_DEBUG_EXCEPTION(" account_id[%d], rule_id[%d], rule[%p]", account_id, rule_id, rule);
                
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
-       emf_mail_rule_tbl_t* p_data_tbl = NULL;
+       emstorage_rule_tbl_t* p_data_tbl = NULL;
        int rc, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
  
        DB_STMT hStmt = NULL;
        char sql_query_string[QUERY_SIZE] = {0, };
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_READ_TRANSACTION(transaction);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_READ_TRANSACTION(transaction);
        
        SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT * FROM mail_rule_tbl WHERE account_id = %d AND rule_id = %d", account_id, rule_id);
        
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
 
        if (rc == SQLITE_DONE)  {
                EM_DEBUG_EXCEPTION(" no matched rule found...");
-               error = EM_STORAGE_ERROR_RULE_NOT_FOUND;
+               error = EMF_ERROR_FILTER_NOT_FOUND;
                goto FINISH_OFF;
        }
        
-       if (!(p_data_tbl = (emf_mail_rule_tbl_t*)malloc(sizeof(emf_mail_rule_tbl_t))))  {
+       if (!(p_data_tbl = (emstorage_rule_tbl_t*)malloc(sizeof(emstorage_rule_tbl_t))))  {
                EM_DEBUG_EXCEPTION(" malloc failed...");
-               error = EM_STORAGE_ERROR_OUT_OF_MEMORY;
+               error = EMF_ERROR_OUT_OF_MEMORY;
                goto FINISH_OFF;
        }
        
-       memset(p_data_tbl, 0x00, sizeof(emf_mail_rule_tbl_t));
-       _getStmtFieldDataInt(hStmt, &(p_data_tbl->account_id), ACCOUNT_ID_IDX_IN_MAIL_RULE_TBL);
-       _getStmtFieldDataInt(hStmt, &(p_data_tbl->rule_id), RULE_ID_IDX_IN_MAIL_RULE_TBL);
-       _getStmtFieldDataInt(hStmt, &(p_data_tbl->type), TYPE_IDX_IN_MAIL_RULE_TBL);
-       _getStmtFieldDataString(hStmt, &(p_data_tbl->value), 0, VALUE_IDX_IN_MAIL_RULE_TBL);
-       _getStmtFieldDataInt(hStmt, &(p_data_tbl->action_type), ACTION_TYPE_IDX_IN_MAIL_RULE_TBL);
-       _getStmtFieldDataString(hStmt, &(p_data_tbl->dest_mailbox), 0, DEST_MAILBOX_IDX_IN_MAIL_RULE_TBL);
-       _getStmtFieldDataInt(hStmt, &(p_data_tbl->flag1), FLAG1_IDX_IN_MAIL_RULE_TBL);
-       _getStmtFieldDataInt(hStmt, &(p_data_tbl->flag2), FLAG2_IDX_IN_MAIL_RULE_TBL);
+       memset(p_data_tbl, 0x00, sizeof(emstorage_rule_tbl_t));
+       _get_stmt_field_data_int(hStmt, &(p_data_tbl->account_id), ACCOUNT_ID_IDX_IN_MAIL_RULE_TBL);
+       _get_stmt_field_data_int(hStmt, &(p_data_tbl->rule_id), RULE_ID_IDX_IN_MAIL_RULE_TBL);
+       _get_stmt_field_data_int(hStmt, &(p_data_tbl->type), TYPE_IDX_IN_MAIL_RULE_TBL);
+       _get_stmt_field_data_string(hStmt, &(p_data_tbl->value), 0, VALUE_IDX_IN_MAIL_RULE_TBL);
+       _get_stmt_field_data_int(hStmt, &(p_data_tbl->action_type), ACTION_TYPE_IDX_IN_MAIL_RULE_TBL);
+       _get_stmt_field_data_string(hStmt, &(p_data_tbl->dest_mailbox), 0, DEST_MAILBOX_IDX_IN_MAIL_RULE_TBL);
+       _get_stmt_field_data_int(hStmt, &(p_data_tbl->flag1), FLAG1_IDX_IN_MAIL_RULE_TBL);
+       _get_stmt_field_data_int(hStmt, &(p_data_tbl->flag2), FLAG2_IDX_IN_MAIL_RULE_TBL);
        
        ret = true;
        
@@ -6192,7 +6232,7 @@ FINISH_OFF:
        if (ret == true)
                *rule = p_data_tbl;
        else if (p_data_tbl != NULL)
-               em_storage_free_rule(&p_data_tbl, 1, NULL);
+               emstorage_free_rule(&p_data_tbl, 1, NULL);
        
        if (hStmt != NULL)  {
                EM_DEBUG_LOG(" before sqlite3_finalize hStmt = %p", hStmt);
@@ -6201,13 +6241,13 @@ FINISH_OFF:
                if (rc != SQLITE_OK)  {
                        EM_DEBUG_LOG(" sqlite3_finalize failed - %d", rc);
                        
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
        }
  
        
        
-       EM_STORAGE_FINISH_READ_TRANSACTION(transaction);
+       EMSTORAGE_FINISH_READ_TRANSACTION(transaction);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -6217,7 +6257,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_change_rule(int account_id, int rule_id, emf_mail_rule_tbl_t* new_rule, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_change_rule(int account_id, int rule_id, emstorage_rule_tbl_t* new_rule, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], rule_id[%d], new_rule[%p], transaction[%d], err_code[%p]", account_id, rule_id, new_rule, transaction, err_code);
 
@@ -6225,17 +6265,17 @@ EXPORT_API int em_storage_change_rule(int account_id, int rule_id, emf_mail_rule
                EM_DEBUG_EXCEPTION(" account_id[%d], rule_id[%d], new_rule[%p]", account_id, rule_id, new_rule);
                
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
        int rc, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
  
        DB_STMT hStmt = NULL;
        char sql_query_string[QUERY_SIZE] = {0, };
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
        
        SNPRINTF(sql_query_string, sizeof(sql_query_string),
                "UPDATE mail_rule_tbl SET"
@@ -6249,25 +6289,25 @@ EXPORT_API int em_storage_change_rule(int account_id, int rule_id, emf_mail_rule
                " AND rule_id = ?");
  
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
        EM_DEBUG_LOG(" Before sqlite3_prepare hStmt = %p", hStmt);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
        
        int i = 0;
        
-       _bindStmtFieldDataInt(hStmt, i++, new_rule->type);
-       _bindStmtFieldDataString(hStmt, i++, (char *)new_rule->value, 0, VALUE_LEN_IN_MAIL_RULE_TBL);
-       _bindStmtFieldDataInt(hStmt, i++, new_rule->action_type);
-       _bindStmtFieldDataString(hStmt, i++, (char *)new_rule->dest_mailbox, 0, DEST_MAILBOX_LEN_IN_MAIL_RULE_TBL);
-       _bindStmtFieldDataInt(hStmt, i++, new_rule->flag1);
-       _bindStmtFieldDataInt(hStmt, i++, new_rule->flag2);
-       _bindStmtFieldDataInt(hStmt, i++, account_id);
-       _bindStmtFieldDataInt(hStmt, i++, rule_id);
+       _bind_stmt_field_data_int(hStmt, i++, new_rule->type);
+       _bind_stmt_field_data_string(hStmt, i++, (char *)new_rule->value, 0, VALUE_LEN_IN_MAIL_RULE_TBL);
+       _bind_stmt_field_data_int(hStmt, i++, new_rule->action_type);
+       _bind_stmt_field_data_string(hStmt, i++, (char *)new_rule->dest_mailbox, 0, DEST_MAILBOX_LEN_IN_MAIL_RULE_TBL);
+       _bind_stmt_field_data_int(hStmt, i++, new_rule->flag1);
+       _bind_stmt_field_data_int(hStmt, i++, new_rule->flag2);
+       _bind_stmt_field_data_int(hStmt, i++, account_id);
+       _bind_stmt_field_data_int(hStmt, i++, rule_id);
  
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
        
        ret = true;
@@ -6280,11 +6320,11 @@ FINISH_OFF:
                if (rc != SQLITE_OK)  {
                        EM_DEBUG_LOG(" sqlite3_finalize failed - %d", rc);
                        
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
        }
 
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -6294,7 +6334,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_find_rule(emf_mail_rule_tbl_t* rule, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_find_rule(emstorage_rule_tbl_t* rule, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("rule[%p], transaction[%d], err_code[%p]", rule, transaction, err_code);
 
@@ -6303,36 +6343,36 @@ EXPORT_API int em_storage_find_rule(emf_mail_rule_tbl_t* rule, int transaction,
                        EM_DEBUG_EXCEPTION(" rule->account_id[%d]", rule->account_id);
                
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
 
        DB_STMT hStmt = NULL;
        char sql_query_string[QUERY_SIZE] = {0, };
        
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        int rc, ret = false;
 
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_READ_TRANSACTION(transaction);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_READ_TRANSACTION(transaction);
 
        SNPRINTF(sql_query_string, sizeof(sql_query_string),
                "SELECT rule_id FROM mail_rule_tbl WHERE type = %d AND UPPER(value) = UPPER('%s')",
                rule->type, rule->value);
  
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
 
        if (rc == SQLITE_DONE)  {
                EM_DEBUG_EXCEPTION(" no matched rule found...");
-               error = EM_STORAGE_ERROR_RULE_NOT_FOUND;
+               error = EMF_ERROR_FILTER_NOT_FOUND;
                goto FINISH_OFF;
        }
 
@@ -6346,12 +6386,12 @@ FINISH_OFF:
                rc = sqlite3_finalize(hStmt);
                if (rc != SQLITE_OK)  {
                        EM_DEBUG_EXCEPTION(" sqlite3_finalize failed - %d", rc);
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
        }
  
        
-       EM_STORAGE_FINISH_READ_TRANSACTION(transaction);
+       EMSTORAGE_FINISH_READ_TRANSACTION(transaction);
        _DISCONNECT_DB;
 
        if (err_code)
@@ -6361,7 +6401,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_add_rule(emf_mail_rule_tbl_t* rule, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_add_rule(emstorage_rule_tbl_t* rule, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("rule[%p], transaction[%d], err_code[%p]", rule, transaction, err_code);
 
@@ -6370,26 +6410,26 @@ EXPORT_API int em_storage_add_rule(emf_mail_rule_tbl_t* rule, int transaction, i
                        EM_DEBUG_EXCEPTION(" rule->account_id[%d]", rule->account_id);
                
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
        int rc, rc_2, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        DB_STMT hStmt = NULL;
        char sql_query_string[QUERY_SIZE] = {0, };
 
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
 
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
        
        char *sql;
        char **result;
        sql = "SELECT max(rowid) FROM mail_rule_tbl;";
-       /*  rc = sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL);  */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql, rc, sqlite3_errmsg(local_db_handle)));
        
        if (NULL==result[1])
@@ -6409,24 +6449,24 @@ EXPORT_API int em_storage_add_rule(emf_mail_rule_tbl_t* rule, int transaction, i
                ", ?"           /*  flag1 */
                ", ?)");        /*  flag2 */
  
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc_2);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc_2);
        if (rc_2 != SQLITE_OK)  {
                EM_DEBUG_EXCEPTION("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc_2, sqlite3_errmsg(local_db_handle));
-               error = EM_STORAGE_ERROR_DB_FAILURE;
+               error = EMF_ERROR_DB_FAILURE;
                goto FINISH_OFF;
        }
  
-       _bindStmtFieldDataInt(hStmt, ACCOUNT_ID_IDX_IN_MAIL_RULE_TBL, rule->account_id);
-       _bindStmtFieldDataInt(hStmt, RULE_ID_IDX_IN_MAIL_RULE_TBL, rc);
-       _bindStmtFieldDataInt(hStmt, TYPE_IDX_IN_MAIL_RULE_TBL, rule->type);
-       _bindStmtFieldDataString(hStmt, VALUE_IDX_IN_MAIL_RULE_TBL, (char *)rule->value, 0, VALUE_LEN_IN_MAIL_RULE_TBL);
-       _bindStmtFieldDataInt(hStmt, ACTION_TYPE_IDX_IN_MAIL_RULE_TBL, rule->action_type);
-       _bindStmtFieldDataString(hStmt, DEST_MAILBOX_IDX_IN_MAIL_RULE_TBL, (char *)rule->dest_mailbox, 0, DEST_MAILBOX_LEN_IN_MAIL_RULE_TBL);
-       _bindStmtFieldDataInt(hStmt, FLAG1_IDX_IN_MAIL_RULE_TBL, rule->flag1);
-       _bindStmtFieldDataInt(hStmt, FLAG2_IDX_IN_MAIL_RULE_TBL, rule->flag2);
+       _bind_stmt_field_data_int(hStmt, ACCOUNT_ID_IDX_IN_MAIL_RULE_TBL, rule->account_id);
+       _bind_stmt_field_data_int(hStmt, RULE_ID_IDX_IN_MAIL_RULE_TBL, rc);
+       _bind_stmt_field_data_int(hStmt, TYPE_IDX_IN_MAIL_RULE_TBL, rule->type);
+       _bind_stmt_field_data_string(hStmt, VALUE_IDX_IN_MAIL_RULE_TBL, (char *)rule->value, 0, VALUE_LEN_IN_MAIL_RULE_TBL);
+       _bind_stmt_field_data_int(hStmt, ACTION_TYPE_IDX_IN_MAIL_RULE_TBL, rule->action_type);
+       _bind_stmt_field_data_string(hStmt, DEST_MAILBOX_IDX_IN_MAIL_RULE_TBL, (char *)rule->dest_mailbox, 0, DEST_MAILBOX_LEN_IN_MAIL_RULE_TBL);
+       _bind_stmt_field_data_int(hStmt, FLAG1_IDX_IN_MAIL_RULE_TBL, rule->flag1);
+       _bind_stmt_field_data_int(hStmt, FLAG2_IDX_IN_MAIL_RULE_TBL, rule->flag2);
  
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
 
        ret = true;
@@ -6439,11 +6479,11 @@ FINISH_OFF:
                if (rc != SQLITE_OK) {
                        EM_DEBUG_LOG(" sqlite3_finalize failed - %d", rc);
                        
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
        }
 
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -6453,7 +6493,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_delete_rule(int account_id, int rule_id, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_delete_rule(int account_id, int rule_id, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], rule_id[%d], transaction[%d], err_code[%p]", account_id, rule_id, transaction, err_code);
        
@@ -6461,33 +6501,33 @@ EXPORT_API int em_storage_delete_rule(int account_id, int rule_id, int transacti
                EM_DEBUG_EXCEPTION(" account_id[%d], rule_id[%d]", account_id, rule_id);
                
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
        int rc, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        char sql_query_string[QUERY_SIZE] = {0, };
 
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
        
        SNPRINTF(sql_query_string, sizeof(sql_query_string), "DELETE FROM mail_rule_tbl WHERE account_id = %d AND rule_id = %d", account_id, rule_id);
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
        rc = sqlite3_changes(local_db_handle);
        if (rc == 0) {
                EM_DEBUG_EXCEPTION(" no matched rule found...");
                
-               error = EM_STORAGE_ERROR_RULE_NOT_FOUND;
+               error = EMF_ERROR_FILTER_NOT_FOUND;
                goto FINISH_OFF;
        }
        
        ret = true;
        
 FINISH_OFF:
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -6497,22 +6537,22 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_free_rule(emf_mail_rule_tbl_t** rule_list, int count, int *err_code)
+INTERNAL_FUNC int emstorage_free_rule(emstorage_rule_tbl_t** rule_list, int count, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("rule_list[%p], conut[%d], err_code[%p]", rule_list, count, err_code);
 
        int ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        
        if (count > 0) {
                if (!rule_list || !*rule_list) {
                        EM_DEBUG_EXCEPTION(" rule_list[%p], conut[%d]", rule_list, count);
                        
-                       error = EM_STORAGE_ERROR_INVALID_PARAM;
+                       error = EMF_ERROR_INVALID_PARAM;
                        goto FINISH_OFF;
                }
                
-               emf_mail_rule_tbl_t* p = *rule_list;
+               emstorage_rule_tbl_t* p = *rule_list;
                int i = 0;
                
                for (; i < count; i++) {
@@ -6531,28 +6571,27 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_get_mail_count(int account_id, const char *mailbox_name, int *total, int *unseen, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_get_mail_count(int account_id, const char *mailbox_name, int *total, int *unseen, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], mailbox_name[%s], total[%p], unseen[%p], transaction[%d], err_code[%p]", account_id, mailbox_name, total, unseen, transaction, err_code);
        
-       if (!total && !unseen) {                /* TODO: confirm me */
+       if (!total && !unseen) {
                EM_DEBUG_EXCEPTION(" accoun_id[%d], mailbox_name[%s], total[%p], unseen[%p]", account_id, mailbox_name, total, unseen);
-               
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
        int rc = -1, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        DB_STMT hStmt = NULL;
        char sql_query_string[QUERY_SIZE] = {0, };
        char err_msg[1024];
 
        
        memset(&sql_query_string, 0x00, sizeof(sql_query_string));
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_READ_TRANSACTION(transaction);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_READ_TRANSACTION(transaction);
        
        if (total)  {
                SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT COUNT(*) FROM mail_tbl");
@@ -6567,23 +6606,23 @@ EXPORT_API int em_storage_get_mail_count(int account_id, const char *mailbox_nam
                
 #ifdef USE_GET_RECORD_COUNT_API
                char **result;
-               /*  rc = sqlite3_get_table(local_db_handle, sql_query_string, &result, NULL, NULL, NULL); */
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, NULL, NULL, NULL), rc);
-               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF2; },
+
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, NULL, NULL, NULL), rc);
+               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF2; },
                        ("SQL(%s) sqlite3_get_table fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
                *total = atoi(result[1]);
                sqlite3_free_table(result);
 #else
                
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
-               EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF2; },
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+               EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF2; },
                        ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
-               /*  rc = sqlite3_step(hStmt); */
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-               EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF2; },
+
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+               EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF2; },
                        ("sqlite3_step fail:%d", rc));
-               _getStmtFieldDataInt(hStmt, total, 0);
+               _get_stmt_field_data_int(hStmt, total, 0);
 #endif         /*  USE_GET_RECORD_COUNT_API */
        }
        
@@ -6599,8 +6638,8 @@ EXPORT_API int em_storage_get_mail_count(int account_id, const char *mailbox_nam
                        SNPRINTF(sql_query_string + strlen(sql_query_string), sizeof(sql_query_string)-(strlen(sql_query_string)+1), " AND mailbox_type NOT IN (3, 5)");
                
                char **result;
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, NULL, NULL, NULL), rc);
-               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, NULL, NULL, NULL), rc);
+               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
                        ("SQL(%s) sqlite3_get_table fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
                *unseen = atoi(result[1]);
@@ -6617,12 +6656,12 @@ FINISH_OFF2:
                rc = sqlite3_finalize(hStmt);
                if (rc != SQLITE_OK)  {
                        EM_DEBUG_LOG(" EDBStmtClearRow failed - %d: %s", rc, err_msg);
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
        }
 #endif
 
-       EM_STORAGE_FINISH_READ_TRANSACTION(transaction);
+       EMSTORAGE_FINISH_READ_TRANSACTION(transaction);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -6632,35 +6671,35 @@ FINISH_OFF2:
        return ret;
 }
 
-EXPORT_API int em_storage_get_mail_field_by_id(int mail_id, int type, emf_mail_tbl_t** mail, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_get_mail_field_by_id(int mail_id, int type, emstorage_mail_tbl_t** mail, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("mail_id[%d], type[%d], mail[%p], transaction[%d], err_code[%p]", mail_id, type, mail, transaction, err_code);
        
        if (mail_id <= 0 || !mail)  {   
                EM_DEBUG_EXCEPTION("mail_id[%d], mail[%p]", mail_id, mail);
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
-       emf_mail_tbl_t* p_data_tbl = (emf_mail_tbl_t*)malloc(sizeof(emf_mail_tbl_t));
+       emstorage_mail_tbl_t* p_data_tbl = (emstorage_mail_tbl_t*)malloc(sizeof(emstorage_mail_tbl_t));
 
        if (p_data_tbl == NULL)  {
                EM_DEBUG_EXCEPTION("malloc failed...");
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_OUT_OF_MEMORY;
+                       *err_code = EMF_ERROR_OUT_OF_MEMORY;
                return false;
        }
        
-       memset(p_data_tbl, 0x00, sizeof(emf_mail_tbl_t));
+       memset(p_data_tbl, 0x00, sizeof(emstorage_mail_tbl_t));
        DB_STMT hStmt = NULL;
        char sql_query_string[QUERY_SIZE] = {0, };
 
        int rc, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_READ_TRANSACTION(transaction);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_READ_TRANSACTION(transaction);
        
        switch (type)  {
                case RETRIEVE_SUMMARY:
@@ -6684,61 +6723,61 @@ EXPORT_API int em_storage_get_mail_field_by_id(int mail_id, int type, emf_mail_t
                        break;
                
                default :
-                       EM_DEBUG_EXCEPTION("EM_STORAGE_ERROR_INVALID_PARAM : type [%d]", type);
-                       error = EM_STORAGE_ERROR_INVALID_PARAM;
+                       EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM : type [%d]", type);
+                       error = EMF_ERROR_INVALID_PARAM;
                        goto FINISH_OFF;
        }
        
        EM_DEBUG_LOG("Query [%s]", sql_query_string);
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
 
        if (rc == SQLITE_DONE)  {
                EM_DEBUG_EXCEPTION("no matched mail found...");
-               error = EM_STORAGE_ERROR_MAIL_NOT_FOUND;
+               error = EMF_ERROR_MAIL_NOT_FOUND;
                goto FINISH_OFF;
        }
        switch (type)  {
                case RETRIEVE_SUMMARY:
-                       _getStmtFieldDataInt(hStmt, &(p_data_tbl->account_id), 0);
-                       _getStmtFieldDataInt(hStmt, &(p_data_tbl->mail_id), 1);
-                       _getStmtFieldDataString(hStmt, &(p_data_tbl->mailbox_name), 0, 2);
-                       _getStmtFieldDataInt(hStmt, &(p_data_tbl->server_mail_status), 3);
-                       _getStmtFieldDataString(hStmt, &(p_data_tbl->server_mailbox_name), 0, 4);
-                       _getStmtFieldDataString(hStmt, &(p_data_tbl->server_mail_id), 0, 5);
-                       _getStmtFieldDataString(hStmt, &(p_data_tbl->file_path_plain), 0, 6);
-                       _getStmtFieldDataString(hStmt, &(p_data_tbl->file_path_html), 0, 7);
-                       _getStmtFieldDataChar(hStmt, &(p_data_tbl->flags_seen_field), 8);
-                       _getStmtFieldDataInt(hStmt, &(p_data_tbl->save_status), 9);
-                       _getStmtFieldDataInt(hStmt, &(p_data_tbl->lock_status), 10);
-                       _getStmtFieldDataInt(hStmt, &(p_data_tbl->thread_id), 11);
-                       _getStmtFieldDataInt(hStmt, &(p_data_tbl->thread_item_count), 12);
+                       _get_stmt_field_data_int(hStmt, &(p_data_tbl->account_id), 0);
+                       _get_stmt_field_data_int(hStmt, &(p_data_tbl->mail_id), 1);
+                       _get_stmt_field_data_string(hStmt, &(p_data_tbl->mailbox_name), 0, 2);
+                       _get_stmt_field_data_int(hStmt, &(p_data_tbl->server_mail_status), 3);
+                       _get_stmt_field_data_string(hStmt, &(p_data_tbl->server_mailbox_name), 0, 4);
+                       _get_stmt_field_data_string(hStmt, &(p_data_tbl->server_mail_id), 0, 5);
+                       _get_stmt_field_data_string(hStmt, &(p_data_tbl->file_path_plain), 0, 6);
+                       _get_stmt_field_data_string(hStmt, &(p_data_tbl->file_path_html), 0, 7);
+                       _get_stmt_field_data_char(hStmt, &(p_data_tbl->flags_seen_field), 8);
+                       _get_stmt_field_data_int(hStmt, &(p_data_tbl->save_status), 9);
+                       _get_stmt_field_data_int(hStmt, &(p_data_tbl->lock_status), 10);
+                       _get_stmt_field_data_int(hStmt, &(p_data_tbl->thread_id), 11);
+                       _get_stmt_field_data_int(hStmt, &(p_data_tbl->thread_item_count), 12);
                        break;
                        
                case RETRIEVE_FIELDS_FOR_DELETE:
-                       _getStmtFieldDataInt(hStmt, &(p_data_tbl->account_id), 0);
-                       _getStmtFieldDataInt(hStmt, &(p_data_tbl->mail_id), 1);
-                       _getStmtFieldDataInt(hStmt, &(p_data_tbl->server_mail_status), 2);
-                       _getStmtFieldDataString(hStmt, &(p_data_tbl->server_mailbox_name), 0, 3);
-                       _getStmtFieldDataString(hStmt, &(p_data_tbl->server_mail_id), 0, 4);
+                       _get_stmt_field_data_int(hStmt, &(p_data_tbl->account_id), 0);
+                       _get_stmt_field_data_int(hStmt, &(p_data_tbl->mail_id), 1);
+                       _get_stmt_field_data_int(hStmt, &(p_data_tbl->server_mail_status), 2);
+                       _get_stmt_field_data_string(hStmt, &(p_data_tbl->server_mailbox_name), 0, 3);
+                       _get_stmt_field_data_string(hStmt, &(p_data_tbl->server_mail_id), 0, 4);
                        break;
                        
                case RETRIEVE_ACCOUNT:
-                       _getStmtFieldDataInt(hStmt, &(p_data_tbl->account_id), 0);
+                       _get_stmt_field_data_int(hStmt, &(p_data_tbl->account_id), 0);
                        break;
                        
                case RETRIEVE_FLAG:
-                       _getStmtFieldDataInt(hStmt, &(p_data_tbl->account_id), 0);
-                       _getStmtFieldDataString(hStmt, &(p_data_tbl->mailbox_name), 0, 1);
-                       _getStmtFieldDataChar(hStmt, &(p_data_tbl->flags_seen_field), 2);
-                       _getStmtFieldDataInt(hStmt, &(p_data_tbl->thread_id), 3);
+                       _get_stmt_field_data_int(hStmt, &(p_data_tbl->account_id), 0);
+                       _get_stmt_field_data_string(hStmt, &(p_data_tbl->mailbox_name), 0, 1);
+                       _get_stmt_field_data_char(hStmt, &(p_data_tbl->flags_seen_field), 2);
+                       _get_stmt_field_data_int(hStmt, &(p_data_tbl->thread_id), 3);
                        break;
        }
        
@@ -6748,7 +6787,7 @@ FINISH_OFF:
        if (ret == true)
                *mail = p_data_tbl;
        else if (p_data_tbl != NULL)
-               em_storage_free_mail(&p_data_tbl,  1, NULL);
+               emstorage_free_mail(&p_data_tbl,  1, NULL);
 
        if (hStmt != NULL)  {
                EM_DEBUG_LOG("Before sqlite3_finalize hStmt = %p", hStmt);
@@ -6756,12 +6795,12 @@ FINISH_OFF:
                rc = sqlite3_finalize(hStmt);
                if (rc != SQLITE_OK)  {
                        EM_DEBUG_EXCEPTION("sqlite3_finalize failed - %d", rc);
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
        }
        
 
-       EM_STORAGE_FINISH_READ_TRANSACTION(transaction);
+       EMSTORAGE_FINISH_READ_TRANSACTION(transaction);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -6771,35 +6810,35 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_get_mail_field_by_multiple_mail_id(int mail_ids[], int number_of_mails, int type, emf_mail_tbl_t** mail, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_get_mail_field_by_multiple_mail_id(int mail_ids[], int number_of_mails, int type, emstorage_mail_tbl_t** mail, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("mail_ids[%p], number_of_mails [%d], type[%d], mail[%p], transaction[%d], err_code[%p]", mail_ids, number_of_mails, type, mail, transaction, err_code);
        
        if (number_of_mails <= 0 || !mail_ids)  {       
-               EM_DEBUG_EXCEPTION("EM_STORAGE_ERROR_INVALID_PARAM");
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
-       emf_mail_tbl_t* p_data_tbl = (emf_mail_tbl_t*)em_core_malloc(sizeof(emf_mail_tbl_t) * number_of_mails);
+       emstorage_mail_tbl_t* p_data_tbl = (emstorage_mail_tbl_t*)em_malloc(sizeof(emstorage_mail_tbl_t) * number_of_mails);
 
        if (p_data_tbl == NULL)  {
                EM_DEBUG_EXCEPTION("malloc failed...");
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_OUT_OF_MEMORY;
+                       *err_code = EMF_ERROR_OUT_OF_MEMORY;
                return false;
        }
        
        DB_STMT hStmt = NULL;
        int ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        int i = 0, item_count = 0, rc = -1, field_count, col_index, cur_sql_query_string = 0;
        char **result = NULL;
        char sql_query_string[QUERY_SIZE] = {0, };
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_READ_TRANSACTION(transaction);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_READ_TRANSACTION(transaction);
 
        switch (type) {
                case RETRIEVE_SUMMARY:
@@ -6827,8 +6866,8 @@ EXPORT_API int em_storage_get_mail_field_by_multiple_mail_id(int mail_ids[], int
                        break;
                
                default :
-                       EM_DEBUG_EXCEPTION("EM_STORAGE_ERROR_INVALID_PARAM : type [%d]", type);
-                       error = EM_STORAGE_ERROR_INVALID_PARAM;
+                       EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM : type [%d]", type);
+                       error = EMF_ERROR_INVALID_PARAM;
                        goto FINISH_OFF;
        }
 
@@ -6838,13 +6877,13 @@ EXPORT_API int em_storage_get_mail_field_by_multiple_mail_id(int mail_ids[], int
        
        EM_DEBUG_LOG("Query [%s], Length [%d]", sql_query_string, strlen(sql_query_string));
 
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, &item_count, 0, NULL), rc);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc && -1 != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, &item_count, 0, NULL), rc);
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc && -1 != rc), {error = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        if (rc == SQLITE_DONE)  {
                EM_DEBUG_EXCEPTION("no matched mail found...");
-               error = EM_STORAGE_ERROR_MAIL_NOT_FOUND;
+               error = EMF_ERROR_MAIL_NOT_FOUND;
                goto FINISH_OFF;
        }
 
@@ -6852,7 +6891,7 @@ EXPORT_API int em_storage_get_mail_field_by_multiple_mail_id(int mail_ids[], int
 
        if(number_of_mails != item_count) {
                EM_DEBUG_EXCEPTION("Can't find all emails");
-               /* error = EM_STORAGE_ERROR_MAIL_NOT_FOUND;
+               /* error = EMF_ERROR_MAIL_NOT_FOUND;
                goto FINISH_OFF; */ /* removed temporarily */
        }
 
@@ -6861,38 +6900,38 @@ EXPORT_API int em_storage_get_mail_field_by_multiple_mail_id(int mail_ids[], int
        for(i = 0; i < item_count; i++) {
                switch (type) {
                        case RETRIEVE_SUMMARY:
-                               _getTableFieldDataInt(result, &(p_data_tbl[i].account_id), col_index++);
-                               _getTableFieldDataInt(result, &(p_data_tbl[i].mail_id), col_index++);
-                               _getTableFieldDataString(result, &(p_data_tbl[i].mailbox_name), 0, col_index++);
-                               _getTableFieldDataInt(result, &(p_data_tbl[i].server_mail_status), col_index++);
-                               _getTableFieldDataString(result, &(p_data_tbl[i].server_mailbox_name), 0, col_index++);
-                               _getTableFieldDataString(result, &(p_data_tbl[i].server_mail_id), 0, col_index++);
-                               _getTableFieldDataString(result, &(p_data_tbl[i].file_path_plain), 0, col_index++);
-                               _getTableFieldDataString(result, &(p_data_tbl[i].file_path_html), 0, col_index++);
-                               _getTableFieldDataChar(result, &(p_data_tbl[i].flags_seen_field), col_index++);
-                               _getTableFieldDataInt(result, &(p_data_tbl[i].save_status), col_index++);
-                               _getTableFieldDataInt(result, &(p_data_tbl[i].lock_status), col_index++);
-                               _getTableFieldDataInt(result, &(p_data_tbl[i].thread_id), col_index++);
-                               _getTableFieldDataInt(result, &(p_data_tbl[i].thread_item_count), col_index++);
+                               _get_table_field_data_int(result, &(p_data_tbl[i].account_id), col_index++);
+                               _get_table_field_data_int(result, &(p_data_tbl[i].mail_id), col_index++);
+                               _get_table_field_data_string(result, &(p_data_tbl[i].mailbox_name), 0, col_index++);
+                               _get_table_field_data_int(result, &(p_data_tbl[i].server_mail_status), col_index++);
+                               _get_table_field_data_string(result, &(p_data_tbl[i].server_mailbox_name), 0, col_index++);
+                               _get_table_field_data_string(result, &(p_data_tbl[i].server_mail_id), 0, col_index++);
+                               _get_table_field_data_string(result, &(p_data_tbl[i].file_path_plain), 0, col_index++);
+                               _get_table_field_data_string(result, &(p_data_tbl[i].file_path_html), 0, col_index++);
+                               _get_table_field_data_char(result, &(p_data_tbl[i].flags_seen_field), col_index++);
+                               _get_table_field_data_int(result, &(p_data_tbl[i].save_status), col_index++);
+                               _get_table_field_data_int(result, &(p_data_tbl[i].lock_status), col_index++);
+                               _get_table_field_data_int(result, &(p_data_tbl[i].thread_id), col_index++);
+                               _get_table_field_data_int(result, &(p_data_tbl[i].thread_item_count), col_index++);
                                break;
                                
                        case RETRIEVE_FIELDS_FOR_DELETE:
-                               _getTableFieldDataInt(result, &(p_data_tbl[i].account_id), col_index++);
-                               _getTableFieldDataInt(result, &(p_data_tbl[i].mail_id), col_index++);
-                               _getTableFieldDataInt(result, &(p_data_tbl[i].server_mail_status), col_index++);
-                               _getTableFieldDataString(result, &(p_data_tbl[i].server_mailbox_name), 0, col_index++);
-                               _getTableFieldDataString(result, &(p_data_tbl[i].server_mail_id), 0, col_index++);
+                               _get_table_field_data_int(result, &(p_data_tbl[i].account_id), col_index++);
+                               _get_table_field_data_int(result, &(p_data_tbl[i].mail_id), col_index++);
+                               _get_table_field_data_int(result, &(p_data_tbl[i].server_mail_status), col_index++);
+                               _get_table_field_data_string(result, &(p_data_tbl[i].server_mailbox_name), 0, col_index++);
+                               _get_table_field_data_string(result, &(p_data_tbl[i].server_mail_id), 0, col_index++);
                                break;
                                
                        case RETRIEVE_ACCOUNT:
-                               _getTableFieldDataInt(result, &(p_data_tbl[i].account_id), col_index++);
+                               _get_table_field_data_int(result, &(p_data_tbl[i].account_id), col_index++);
                                break;
                                
                        case RETRIEVE_FLAG:
-                               _getTableFieldDataInt(result, &(p_data_tbl[i].account_id), col_index++);
-                               _getTableFieldDataString(result, &(p_data_tbl[i].mailbox_name), 0, col_index++);
-                               _getTableFieldDataChar(result, &(p_data_tbl[i].flags_seen_field), col_index++);
-                               _getTableFieldDataInt(result, &(p_data_tbl[i].thread_id), col_index++);
+                               _get_table_field_data_int(result, &(p_data_tbl[i].account_id), col_index++);
+                               _get_table_field_data_string(result, &(p_data_tbl[i].mailbox_name), 0, col_index++);
+                               _get_table_field_data_char(result, &(p_data_tbl[i].flags_seen_field), col_index++);
+                               _get_table_field_data_int(result, &(p_data_tbl[i].thread_id), col_index++);
                                break;
                }
        }
@@ -6905,7 +6944,7 @@ FINISH_OFF:
        if (ret == true)
                *mail = p_data_tbl;
        else if (p_data_tbl != NULL)
-               em_storage_free_mail(&p_data_tbl,  1, NULL);
+               emstorage_free_mail(&p_data_tbl,  1, NULL);
 
        if (hStmt != NULL) {
                EM_DEBUG_LOG("Before sqlite3_finalize hStmt = %p", hStmt);
@@ -6913,11 +6952,11 @@ FINISH_OFF:
                rc = sqlite3_finalize(hStmt);
                if (rc != SQLITE_OK) {
                        EM_DEBUG_EXCEPTION("sqlite3_finalize failed - %d", rc);
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
        }
 
-       EM_STORAGE_FINISH_READ_TRANSACTION(transaction);
+       EMSTORAGE_FINISH_READ_TRANSACTION(transaction);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -6927,26 +6966,26 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_get_mail_by_id(int mail_id, emf_mail_tbl_t** mail, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_get_mail_by_id(int mail_id, emstorage_mail_tbl_t** mail, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("mail_id[%d], mail[%p], transaction[%d], err_code[%p]", mail_id, mail, transaction, err_code);
        
        if (mail_id <= 0 || !mail) {    
                EM_DEBUG_EXCEPTION("mail_id[%d], mail[%p]", mail_id, mail);
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
-       int ret = false, error = EM_STORAGE_ERROR_NONE, count;
+       int ret = false, error = EMF_ERROR_NONE, count;
        char conditional_clause[QUERY_SIZE] = {0, };
-       emf_mail_tbl_t* p_data_tbl = NULL;
+       emstorage_mail_tbl_t* p_data_tbl = NULL;
        
        SNPRINTF(conditional_clause, QUERY_SIZE, "WHERE mail_id = %d", mail_id);
        EM_DEBUG_LOG("query = [%s]", conditional_clause);
 
-       if(!em_storage_query_mail_tbl(conditional_clause, transaction, &p_data_tbl, &count, &error)) {
-               EM_DEBUG_EXCEPTION("em_storage_query_mail_tbl [%d]", error);
+       if(!emstorage_query_mail_tbl(conditional_clause, transaction, &p_data_tbl, &count, &error)) {
+               EM_DEBUG_EXCEPTION("emstorage_query_mail_tbl [%d]", error);
                goto FINISH_OFF;
        }
 
@@ -6956,7 +6995,7 @@ FINISH_OFF:
        if (ret == true)
                *mail = p_data_tbl;
        else if (p_data_tbl != NULL)
-               em_storage_free_mail(&p_data_tbl, 1, &error);
+               emstorage_free_mail(&p_data_tbl, 1, &error);
        
        if (err_code != NULL)
                *err_code = error;
@@ -6965,27 +7004,27 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_mail_search_start(emf_mail_search_t* search, int account_id, char *mailbox_name, int sorting, int *search_handle, int *searched, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_mail_search_start(emstorage_search_filter_t* search, int account_id, char *mailbox_name, int sorting, int *search_handle, int *searched, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("search[%p], account_id[%d], mailbox_name[%p], sorting[%d], search_handle[%p], searched[%p], transaction[%d], err_code[%p]", search, account_id, mailbox_name, sorting, search_handle, searched, transaction, err_code);
 
        if (!search_handle || !searched)  {     
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
-               EM_DEBUG_EXCEPTION("EM_STORAGE_ERROR_INVALID_PARAM");
+                       *err_code = EMF_ERROR_INVALID_PARAM;
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
                EM_DEBUG_FUNC_END("false");
                return false;
        }
        
-       emf_mail_search_t* p = search;
-       int error = EM_STORAGE_ERROR_NONE;
+       emstorage_search_filter_t* p = search;
+       int error = EMF_ERROR_NONE;
        DB_STMT hStmt = NULL;
        char sql_query_string[QUERY_SIZE] = {0, };
        int rc, ret = false;
        int and = false, mail_count = 0;
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_READ_TRANSACTION(transaction);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_READ_TRANSACTION(transaction);
        
        SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT * FROM mail_tbl");
        
@@ -7028,19 +7067,19 @@ EXPORT_API int em_storage_mail_search_start(emf_mail_search_t* search, int accou
        EM_DEBUG_LOG("sql_query_string [%s]", sql_query_string);
 
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
        
        char **result;
-       /*  rc = sqlite3_get_table(local_db_handle, sql_query_string, &result, NULL, NULL, NULL); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, &mail_count, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, &mail_count, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        sqlite3_free_table(result);
@@ -7058,11 +7097,11 @@ FINISH_OFF:
                        rc = sqlite3_finalize(hStmt);
                        if (rc != SQLITE_OK)  {
                                EM_DEBUG_EXCEPTION("sqlite3_finalize failed - %d", rc);
-                               error = EM_STORAGE_ERROR_DB_FAILURE;
+                               error = EMF_ERROR_DB_FAILURE;
                        }
                }
                
-               EM_STORAGE_FINISH_READ_TRANSACTION(transaction);
+               EMSTORAGE_FINISH_READ_TRANSACTION(transaction);
                _DISCONNECT_DB;
        }
        
@@ -7073,7 +7112,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_mail_search_result(int search_handle, emf_mail_field_type_t type, void** data, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_mail_search_result(int search_handle, emstorage_mail_field_type_t type, void** data, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("search_handle[%d], type[%d], data[%p], transaction[%d], err_code[%p]", search_handle, type, data, transaction, err_code);
 
@@ -7081,62 +7120,62 @@ EXPORT_API int em_storage_mail_search_result(int search_handle, emf_mail_field_t
                EM_DEBUG_EXCEPTION(" search_handle[%d], type[%d], data[%p]", search_handle, type, data);
                
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
-       emf_mail_tbl_t* p_data_tbl = NULL;
+       emstorage_mail_tbl_t* p_data_tbl = NULL;
        DB_STMT hStmt = (DB_STMT)search_handle;
        int rc, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
 
        switch (type)  {
                case RETRIEVE_ID:
-                       _getStmtFieldDataInt(hStmt, (int *)data, MAIL_ID_IDX_IN_MAIL_TBL);
+                       _get_stmt_field_data_int(hStmt, (int *)data, MAIL_ID_IDX_IN_MAIL_TBL);
                        break;
                        
                case RETRIEVE_ENVELOPE:
                case RETRIEVE_ALL:
-                       if (!(p_data_tbl = em_core_malloc(sizeof(emf_mail_tbl_t)))) {
-                               EM_DEBUG_EXCEPTION(" em_core_malloc failed...");
+                       if (!(p_data_tbl = em_malloc(sizeof(emstorage_mail_tbl_t)))) {
+                               EM_DEBUG_EXCEPTION(" em_malloc failed...");
                                
-                               error = EM_STORAGE_ERROR_OUT_OF_MEMORY;
+                               error = EMF_ERROR_OUT_OF_MEMORY;
                                goto FINISH_OFF;
                        }
                        
-                       _getStmtFieldDataInt(hStmt, &(p_data_tbl->mail_id), MAIL_ID_IDX_IN_MAIL_TBL);
-                       _getStmtFieldDataInt(hStmt, &(p_data_tbl->account_id), ACCOUNT_ID_IDX_IN_MAIL_TBL);
-                       _getStmtFieldDataString(hStmt, &(p_data_tbl->mailbox_name), 0, MAILBOX_NAME_IDX_IN_MAIL_TBL);
-                       _getStmtFieldDataInt(hStmt, &(p_data_tbl->mail_size), MAIL_SIZE_IDX_IN_MAIL_TBL);
-                       _getStmtFieldDataString(hStmt, &(p_data_tbl->server_mail_id), 0, SERVER_MAIL_ID_IDX_IN_MAIL_TBL);
-                       _getStmtFieldDataString(hStmt, &(p_data_tbl->full_address_from), 1, FULL_ADDRESS_FROM_IDX_IN_MAIL_TBL);
-                       _getStmtFieldDataString(hStmt, &(p_data_tbl->full_address_to), 1, FULL_ADDRESS_TO_IDX_IN_MAIL_TBL);
-                       _getStmtFieldDataString(hStmt, &(p_data_tbl->subject), 1, SUBJECT_IDX_IN_MAIL_TBL);
-                       _getStmtFieldDataInt(hStmt, &(p_data_tbl->body_download_status), BODY_DOWNLOAD_STATUS_IDX_IN_MAIL_TBL);
-                       _getStmtFieldDataString(hStmt, &(p_data_tbl->file_path_plain), 0, FILE_PATH_PLAIN_IDX_IN_MAIL_TBL);
-                       _getStmtFieldDataString(hStmt, &(p_data_tbl->file_path_html), 0, FILE_PATH_HTML_IDX_IN_MAIL_TBL);
-                       _getStmtFieldDataString(hStmt, &(p_data_tbl->datetime), 0, DATETIME_IDX_IN_MAIL_TBL);
-                       _getStmtFieldDataChar(hStmt, &(p_data_tbl->flags_seen_field), FLAGS_SEEN_FIELD_IDX_IN_MAIL_TBL);
-                       _getStmtFieldDataInt(hStmt, &(p_data_tbl->DRM_status), DRM_STATUS_IDX_IN_MAIL_TBL);
-                       _getStmtFieldDataInt(hStmt, &(p_data_tbl->priority), PRIORITY_IDX_IN_MAIL_TBL);
-                       _getStmtFieldDataInt(hStmt, &(p_data_tbl->save_status), SAVE_STATUS_IDX_IN_MAIL_TBL);
-                       _getStmtFieldDataInt(hStmt, &(p_data_tbl->lock_status), LOCK_STATUS_IDX_IN_MAIL_TBL);
-                       _getStmtFieldDataInt(hStmt, &(p_data_tbl->report_status), REPORT_STATUS_IDX_IN_MAIL_TBL);
-                       _getStmtFieldDataString(hStmt, &(p_data_tbl->preview_text), 1, PREVIEW_TEXT_IDX_IN_MAIL_TBL);
-                       _getStmtFieldDataInt(hStmt, &(p_data_tbl->meeting_request_status), MEETING_REQUEST_STATUS_IDX_IN_MAIL_TBL);
+                       _get_stmt_field_data_int   (hStmt, &(p_data_tbl->mail_id), MAIL_ID_IDX_IN_MAIL_TBL);
+                       _get_stmt_field_data_int   (hStmt, &(p_data_tbl->account_id), ACCOUNT_ID_IDX_IN_MAIL_TBL);
+                       _get_stmt_field_data_string(hStmt, &(p_data_tbl->mailbox_name), 0, MAILBOX_NAME_IDX_IN_MAIL_TBL);
+                       _get_stmt_field_data_int   (hStmt, &(p_data_tbl->mail_size), MAIL_SIZE_IDX_IN_MAIL_TBL);
+                       _get_stmt_field_data_string(hStmt, &(p_data_tbl->server_mail_id), 0, SERVER_MAIL_ID_IDX_IN_MAIL_TBL);
+                       _get_stmt_field_data_string(hStmt, &(p_data_tbl->full_address_from), 1, FULL_ADDRESS_FROM_IDX_IN_MAIL_TBL);
+                       _get_stmt_field_data_string(hStmt, &(p_data_tbl->full_address_to), 1, FULL_ADDRESS_TO_IDX_IN_MAIL_TBL);
+                       _get_stmt_field_data_string(hStmt, &(p_data_tbl->subject), 1, SUBJECT_IDX_IN_MAIL_TBL);
+                       _get_stmt_field_data_int   (hStmt, &(p_data_tbl->body_download_status), BODY_DOWNLOAD_STATUS_IDX_IN_MAIL_TBL);
+                       _get_stmt_field_data_string(hStmt, &(p_data_tbl->file_path_plain), 0, FILE_PATH_PLAIN_IDX_IN_MAIL_TBL);
+                       _get_stmt_field_data_string(hStmt, &(p_data_tbl->file_path_html), 0, FILE_PATH_HTML_IDX_IN_MAIL_TBL);
+                       _get_stmt_field_data_time_t(hStmt, &(p_data_tbl->date_time), DATETIME_IDX_IN_MAIL_TBL);
+                       _get_stmt_field_data_char  (hStmt, &(p_data_tbl->flags_seen_field), FLAGS_SEEN_FIELD_IDX_IN_MAIL_TBL);
+                       _get_stmt_field_data_int   (hStmt, &(p_data_tbl->DRM_status), DRM_STATUS_IDX_IN_MAIL_TBL);
+                       _get_stmt_field_data_int   (hStmt, &(p_data_tbl->priority), PRIORITY_IDX_IN_MAIL_TBL);
+                       _get_stmt_field_data_int   (hStmt, &(p_data_tbl->save_status), SAVE_STATUS_IDX_IN_MAIL_TBL);
+                       _get_stmt_field_data_int   (hStmt, &(p_data_tbl->lock_status), LOCK_STATUS_IDX_IN_MAIL_TBL);
+                       _get_stmt_field_data_int   (hStmt, &(p_data_tbl->report_status), REPORT_STATUS_IDX_IN_MAIL_TBL);
+                       _get_stmt_field_data_string(hStmt, &(p_data_tbl->preview_text), 1, PREVIEW_TEXT_IDX_IN_MAIL_TBL);
+                       _get_stmt_field_data_int   (hStmt, &(p_data_tbl->meeting_request_status), MEETING_REQUEST_STATUS_IDX_IN_MAIL_TBL);
                                
                        if (type == RETRIEVE_ALL)  {
-                               _getStmtFieldDataInt(hStmt, &(p_data_tbl->server_mail_status), SERVER_MAIL_STATUS_IDX_IN_MAIL_TBL);
-                               _getStmtFieldDataString(hStmt, &(p_data_tbl->server_mailbox_name), 0, SERVER_MAILBOX_NAME_IDX_IN_MAIL_TBL);
-                               _getStmtFieldDataString(hStmt, &(p_data_tbl->full_address_reply), 1, FULL_ADDRESS_REPLY_IDX_IN_MAIL_TBL);
-                               _getStmtFieldDataString(hStmt, &(p_data_tbl->full_address_cc), 1, FULL_ADDRESS_CC_IDX_IN_MAIL_TBL);
-                               _getStmtFieldDataString(hStmt, &(p_data_tbl->full_address_bcc), 1, FULL_ADDRESS_BCC_IDX_IN_MAIL_TBL);
-                               _getStmtFieldDataString(hStmt, &(p_data_tbl->full_address_return), 1, FULL_ADDRESS_RETURN_IDX_IN_MAIL_TBL);
-                               _getStmtFieldDataString(hStmt, &(p_data_tbl->message_id), 0, MESSAGE_ID_IDX_IN_MAIL_TBL);
-                               _getStmtFieldDataString(hStmt, &(p_data_tbl->email_address_sender), 1, EMAIL_ADDRESS_SENDER_IDX_IN_MAIL_TBL);
-                               _getStmtFieldDataString(hStmt, &(p_data_tbl->email_address_recipient), 1, EMAIL_ADDRESS_RECIPIENT_IDX_IN_MAIL_TBL);
-                               _getStmtFieldDataInt(hStmt, &(p_data_tbl->attachment_count), ATTACHMENT_COUNT_IDX_IN_MAIL_TBL);
-                          _getStmtFieldDataString(hStmt, &(p_data_tbl->preview_text), 1, PREVIEW_TEXT_IDX_IN_MAIL_TBL);
+                               _get_stmt_field_data_int   (hStmt, &(p_data_tbl->server_mail_status), SERVER_MAIL_STATUS_IDX_IN_MAIL_TBL);
+                               _get_stmt_field_data_string(hStmt, &(p_data_tbl->server_mailbox_name), 0, SERVER_MAILBOX_NAME_IDX_IN_MAIL_TBL);
+                               _get_stmt_field_data_string(hStmt, &(p_data_tbl->full_address_reply), 1, FULL_ADDRESS_REPLY_IDX_IN_MAIL_TBL);
+                               _get_stmt_field_data_string(hStmt, &(p_data_tbl->full_address_cc), 1, FULL_ADDRESS_CC_IDX_IN_MAIL_TBL);
+                               _get_stmt_field_data_string(hStmt, &(p_data_tbl->full_address_bcc), 1, FULL_ADDRESS_BCC_IDX_IN_MAIL_TBL);
+                               _get_stmt_field_data_string(hStmt, &(p_data_tbl->full_address_return), 1, FULL_ADDRESS_RETURN_IDX_IN_MAIL_TBL);
+                               _get_stmt_field_data_string(hStmt, &(p_data_tbl->message_id), 0, MESSAGE_ID_IDX_IN_MAIL_TBL);
+                               _get_stmt_field_data_string(hStmt, &(p_data_tbl->email_address_sender), 1, EMAIL_ADDRESS_SENDER_IDX_IN_MAIL_TBL);
+                               _get_stmt_field_data_string(hStmt, &(p_data_tbl->email_address_recipient), 1, EMAIL_ADDRESS_RECIPIENT_IDX_IN_MAIL_TBL);
+                               _get_stmt_field_data_int   (hStmt, &(p_data_tbl->attachment_count), ATTACHMENT_COUNT_IDX_IN_MAIL_TBL);
+                               _get_stmt_field_data_string(hStmt, &(p_data_tbl->preview_text), 1, PREVIEW_TEXT_IDX_IN_MAIL_TBL);
                                
                        }
                        
@@ -7155,50 +7194,50 @@ EXPORT_API int em_storage_mail_search_result(int search_handle, emf_mail_field_t
                                        p_data_tbl->body_download_status = 0;
                        }
                        
-                       *((emf_mail_tbl_t**)data) = p_data_tbl;
+                       *((emstorage_mail_tbl_t**)data) = p_data_tbl;
                        break;
                
                case RETRIEVE_SUMMARY:
-                       if (!(p_data_tbl = malloc(sizeof(emf_mail_tbl_t))))  {
+                       if (!(p_data_tbl = malloc(sizeof(emstorage_mail_tbl_t))))  {
                                EM_DEBUG_EXCEPTION(" malloc failed...");
                                
-                               error = EM_STORAGE_ERROR_OUT_OF_MEMORY;
+                               error = EMF_ERROR_OUT_OF_MEMORY;
                                goto FINISH_OFF;
                        }
                        
-                       memset(p_data_tbl, 0x00, sizeof(emf_mail_tbl_t));
+                       memset(p_data_tbl, 0x00, sizeof(emstorage_mail_tbl_t));
                        
-                       _getStmtFieldDataInt(hStmt, &(p_data_tbl->mail_id), MAIL_ID_IDX_IN_MAIL_TBL);
-                       _getStmtFieldDataInt(hStmt, &(p_data_tbl->account_id), ACCOUNT_ID_IDX_IN_MAIL_TBL);
-                       _getStmtFieldDataString(hStmt, &(p_data_tbl->mailbox_name), 0, MAILBOX_NAME_IDX_IN_MAIL_TBL);
-                       _getStmtFieldDataInt(hStmt, &(p_data_tbl->server_mail_status), SERVER_MAIL_STATUS_IDX_IN_MAIL_TBL);
-                       _getStmtFieldDataString(hStmt, &(p_data_tbl->server_mailbox_name), 0, SERVER_MAILBOX_NAME_IDX_IN_MAIL_TBL);
-                       _getStmtFieldDataString(hStmt, &(p_data_tbl->server_mail_id), 0, SERVER_MAIL_ID_IDX_IN_MAIL_TBL);
+                       _get_stmt_field_data_int   (hStmt, &(p_data_tbl->mail_id), MAIL_ID_IDX_IN_MAIL_TBL);
+                       _get_stmt_field_data_int   (hStmt, &(p_data_tbl->account_id), ACCOUNT_ID_IDX_IN_MAIL_TBL);
+                       _get_stmt_field_data_string(hStmt, &(p_data_tbl->mailbox_name), 0, MAILBOX_NAME_IDX_IN_MAIL_TBL);
+                       _get_stmt_field_data_int   (hStmt, &(p_data_tbl->server_mail_status), SERVER_MAIL_STATUS_IDX_IN_MAIL_TBL);
+                       _get_stmt_field_data_string(hStmt, &(p_data_tbl->server_mailbox_name), 0, SERVER_MAILBOX_NAME_IDX_IN_MAIL_TBL);
+                       _get_stmt_field_data_string(hStmt, &(p_data_tbl->server_mail_id), 0, SERVER_MAIL_ID_IDX_IN_MAIL_TBL);
                        
-                       *((emf_mail_tbl_t**)data) = p_data_tbl;
+                       *((emstorage_mail_tbl_t**)data) = p_data_tbl;
                        break;
                
                case RETRIEVE_ADDRESS:
-                       if (!(p_data_tbl = malloc(sizeof(emf_mail_tbl_t))))  {
+                       if (!(p_data_tbl = malloc(sizeof(emstorage_mail_tbl_t))))  {
                                EM_DEBUG_EXCEPTION(" malloc failed...");
-                               error = EM_STORAGE_ERROR_OUT_OF_MEMORY;
+                               error = EMF_ERROR_OUT_OF_MEMORY;
                                goto FINISH_OFF;
                        }
                        
-                       memset(p_data_tbl, 0x00, sizeof(emf_mail_tbl_t));
-                       _getStmtFieldDataInt(hStmt, &(p_data_tbl->mail_id), MAIL_ID_IDX_IN_MAIL_TBL);
-                       _getStmtFieldDataString(hStmt, &(p_data_tbl->email_address_sender), 1, EMAIL_ADDRESS_SENDER_IDX_IN_MAIL_TBL);
-                       _getStmtFieldDataString(hStmt, &(p_data_tbl->email_address_recipient), 1, EMAIL_ADDRESS_RECIPIENT_IDX_IN_MAIL_TBL);
-                       *((emf_mail_tbl_t**)data) = p_data_tbl;
+                       memset(p_data_tbl, 0x00, sizeof(emstorage_mail_tbl_t));
+                       _get_stmt_field_data_int(hStmt, &(p_data_tbl->mail_id), MAIL_ID_IDX_IN_MAIL_TBL);
+                       _get_stmt_field_data_string(hStmt, &(p_data_tbl->email_address_sender), 1, EMAIL_ADDRESS_SENDER_IDX_IN_MAIL_TBL);
+                       _get_stmt_field_data_string(hStmt, &(p_data_tbl->email_address_recipient), 1, EMAIL_ADDRESS_RECIPIENT_IDX_IN_MAIL_TBL);
+                       *((emstorage_mail_tbl_t**)data) = p_data_tbl;
                        break;
                
                default:
                        break;
        }
        
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
        
        ret = true;
@@ -7212,16 +7251,16 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_mail_search_end(int search_handle, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_mail_search_end(int search_handle, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("search_handle[%d], transaction[%d], err_code[%p]", search_handle, transaction, err_code);
        
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        int rc, ret = false;
        
        if (search_handle < 0)  {
                EM_DEBUG_EXCEPTION(" search_handle[%d]", search_handle);
-               error = EM_STORAGE_ERROR_INVALID_PARAM;
+               error = EMF_ERROR_INVALID_PARAM;
                goto FINISH_OFF;
        }
 
@@ -7232,13 +7271,13 @@ EXPORT_API int em_storage_mail_search_end(int search_handle, int transaction, in
        rc = sqlite3_finalize(hStmt);
        if (rc != SQLITE_OK)  {
                EM_DEBUG_EXCEPTION(" sqlite3_finalize failed - %d", rc);
-               error = EM_STORAGE_ERROR_DB_FAILURE;
+               error = EMF_ERROR_DB_FAILURE;
        }
  
        ret = true;
        
 FINISH_OFF:
-       EM_STORAGE_FINISH_READ_TRANSACTION(transaction);
+       EMSTORAGE_FINISH_READ_TRANSACTION(transaction);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -7248,7 +7287,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_change_mail(int mail_id, emf_mail_tbl_t* mail, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_change_mail(int mail_id, emstorage_mail_tbl_t* mail, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("mail_id[%d], mail[%p], transaction[%d], err_code[%p]", mail_id, mail, transaction, err_code);
 
@@ -7256,7 +7295,7 @@ EXPORT_API int em_storage_change_mail(int mail_id, emf_mail_tbl_t* mail, int tra
                EM_DEBUG_EXCEPTION(" mail_id[%d], mail[%p]", mail_id, mail);
                
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
 
@@ -7264,16 +7303,17 @@ EXPORT_API int em_storage_change_mail(int mail_id, emf_mail_tbl_t* mail, int tra
        char sql_query_string[QUERY_SIZE] = {0, };
        int rc = -1;                            
        int ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
-       
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       int error = EMF_ERROR_NONE;
+       int i = 0;
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
 
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
        
        SNPRINTF(sql_query_string, sizeof(sql_query_string),
                "UPDATE mail_tbl SET"
                "  mail_id = ?"
                ", account_id = ?"
+               ", mailbox_id = ?"
                ", mailbox_name = ?"
                ", mail_size = ?"
                ", server_mail_status = ?"
@@ -7308,59 +7348,57 @@ EXPORT_API int em_storage_change_mail(int mail_id, emf_mail_tbl_t* mail, int tra
                , mail_id);
 
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
-
        
-       int i = 0;
-       
-       _bindStmtFieldDataInt(hStmt, i++, mail->mail_id);
-       _bindStmtFieldDataInt(hStmt, i++, mail->account_id);
-       _bindStmtFieldDataString(hStmt, i++, (char *)mail->mailbox_name, 0, MAILBOX_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataInt(hStmt, i++, mail->mail_size);
-       _bindStmtFieldDataInt(hStmt, i++, mail->server_mail_status);
-       _bindStmtFieldDataString(hStmt, i++, (char *)mail->server_mailbox_name, 0, SERVER_MAILBOX_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataString(hStmt, i++, (char *)mail->server_mail_id, 0, SERVER_MAIL_ID_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataString(hStmt, i++, (char *)mail->full_address_from, 1, FROM_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataString(hStmt, i++, (char *)mail->full_address_reply, 1, REPLY_TO_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataString(hStmt, i++, (char *)mail->full_address_to, 1, TO_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataString(hStmt, i++, (char *)mail->full_address_cc, 1, CC_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataString(hStmt, i++, (char *)mail->full_address_bcc, 1, BCC_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataString(hStmt, i++, (char *)mail->full_address_return, 1, RETURN_PATH_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataString(hStmt, i++, (char *)mail->subject, 1, SUBJECT_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataInt(hStmt, i++, mail->body_download_status);
-       _bindStmtFieldDataString(hStmt, i++, (char *)mail->file_path_plain, 0, TEXT_1_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataString(hStmt, i++, (char *)mail->file_path_html, 0, TEXT_2_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataString(hStmt, i++, (char *)mail->datetime, 0, DATETIME_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataChar(hStmt, i++, mail->flags_seen_field);
-       _bindStmtFieldDataChar(hStmt, i++, mail->flags_deleted_field);
-       _bindStmtFieldDataChar(hStmt, i++, mail->flags_flagged_field);
-       _bindStmtFieldDataChar(hStmt, i++, mail->flags_answered_field);
-       _bindStmtFieldDataChar(hStmt, i++, mail->flags_recent_field);
-       _bindStmtFieldDataChar(hStmt, i++, mail->flags_draft_field);
-       _bindStmtFieldDataChar(hStmt, i++, mail->flags_forwarded_field);
-       _bindStmtFieldDataInt(hStmt, i++, mail->DRM_status);
-       _bindStmtFieldDataInt(hStmt, i++, mail->priority);
-       _bindStmtFieldDataInt(hStmt, i++, mail->save_status);
-       _bindStmtFieldDataInt(hStmt, i++, mail->lock_status);
-       _bindStmtFieldDataString(hStmt, i++, (char *)mail->message_id, 0, MESSAGE_ID_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataInt(hStmt, i++, mail->report_status);
-       _bindStmtFieldDataString(hStmt, i++, (char *)mail->preview_text, 1, PREVIEWBODY_LEN_IN_MAIL_TBL);
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       _bind_stmt_field_data_int   (hStmt, i++, mail->mail_id);
+       _bind_stmt_field_data_int   (hStmt, i++, mail->account_id);
+       _bind_stmt_field_data_int   (hStmt, i++, mail->mailbox_id);
+       _bind_stmt_field_data_string(hStmt, i++, (char *)mail->mailbox_name, 0, MAILBOX_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_int   (hStmt, i++, mail->mail_size);
+       _bind_stmt_field_data_int   (hStmt, i++, mail->server_mail_status);
+       _bind_stmt_field_data_string(hStmt, i++, (char *)mail->server_mailbox_name, 0, SERVER_MAILBOX_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_string(hStmt, i++, (char *)mail->server_mail_id, 0, SERVER_MAIL_ID_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_string(hStmt, i++, (char *)mail->full_address_from, 1, FROM_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_string(hStmt, i++, (char *)mail->full_address_reply, 1, REPLY_TO_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_string(hStmt, i++, (char *)mail->full_address_to, 1, TO_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_string(hStmt, i++, (char *)mail->full_address_cc, 1, CC_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_string(hStmt, i++, (char *)mail->full_address_bcc, 1, BCC_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_string(hStmt, i++, (char *)mail->full_address_return, 1, RETURN_PATH_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_string(hStmt, i++, (char *)mail->subject, 1, SUBJECT_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_int   (hStmt, i++, mail->body_download_status);
+       _bind_stmt_field_data_string(hStmt, i++, (char *)mail->file_path_plain, 0, TEXT_1_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_string(hStmt, i++, (char *)mail->file_path_html, 0, TEXT_2_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_int   (hStmt, i++, mail->date_time);
+       _bind_stmt_field_data_char  (hStmt, i++, mail->flags_seen_field);
+       _bind_stmt_field_data_char  (hStmt, i++, mail->flags_deleted_field);
+       _bind_stmt_field_data_char  (hStmt, i++, mail->flags_flagged_field);
+       _bind_stmt_field_data_char  (hStmt, i++, mail->flags_answered_field);
+       _bind_stmt_field_data_char  (hStmt, i++, mail->flags_recent_field);
+       _bind_stmt_field_data_char  (hStmt, i++, mail->flags_draft_field);
+       _bind_stmt_field_data_char  (hStmt, i++, mail->flags_forwarded_field);
+       _bind_stmt_field_data_int   (hStmt, i++, mail->DRM_status);
+       _bind_stmt_field_data_int   (hStmt, i++, mail->priority);
+       _bind_stmt_field_data_int   (hStmt, i++, mail->save_status);
+       _bind_stmt_field_data_int   (hStmt, i++, mail->lock_status);
+       _bind_stmt_field_data_string(hStmt, i++, (char *)mail->message_id, 0, MESSAGE_ID_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_int   (hStmt, i++, mail->report_status);
+       _bind_stmt_field_data_string(hStmt, i++, (char *)mail->preview_text, 1, PREVIEWBODY_LEN_IN_MAIL_TBL);
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
        
        rc = sqlite3_changes(local_db_handle);
        if (rc == 0)  {
                EM_DEBUG_EXCEPTION(" no matched mail found...");
-               error = EM_STORAGE_ERROR_MAIL_NOT_FOUND;
+               error = EMF_ERROR_MAIL_NOT_FOUND;
                goto FINISH_OFF;
        }
 
-       if (!em_storage_notify_storage_event(NOTI_MAIL_UPDATE, mail->account_id, mail->mail_id, mail->mailbox_name, 0))
-               EM_DEBUG_EXCEPTION(" em_storage_notify_storage_event Failed [ NOTI_MAIL_UPDATE ] >>>> ");
+       if (!emstorage_notify_storage_event(NOTI_MAIL_UPDATE, mail->account_id, mail->mail_id, mail->mailbox_name, 0))
+               EM_DEBUG_EXCEPTION(" emstorage_notify_storage_event Failed [ NOTI_MAIL_UPDATE ] >>>> ");
        
        ret = true;
        
@@ -7370,11 +7408,11 @@ FINISH_OFF:
                rc = sqlite3_finalize(hStmt);
                if (rc != SQLITE_OK)  {
                        EM_DEBUG_EXCEPTION("sqlite3_finalize failed - %d", rc);
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
        }
 
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -7384,7 +7422,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_modify_mailbox_of_mails(char *old_mailbox_name, char *new_mailbox_name, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_modify_mailbox_of_mails(char *old_mailbox_name, char *new_mailbox_name, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("old_mailbox_name[%p], new_mailbox_name[%p], transaction[%d], err_code[%p]", old_mailbox_name, new_mailbox_name, transaction, err_code);
 
@@ -7392,32 +7430,32 @@ EXPORT_API int em_storage_modify_mailbox_of_mails(char *old_mailbox_name, char *
                EM_DEBUG_EXCEPTION(" old_mailbox_name[%p], new_mailbox_name[%p]", old_mailbox_name, new_mailbox_name);
                
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
        int rc = -1;
        int ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        char sql_query_string[QUERY_SIZE] = {0, };
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
 
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
 
        EM_DEBUG_LOG("Old Mailbox Name  [ %s ] , New Mailbox name [ %s ] ", old_mailbox_name, new_mailbox_name);
        
        SNPRINTF(sql_query_string, sizeof(sql_query_string), "UPDATE mail_tbl SET mailbox_name = '%s' WHERE mailbox_name = '%s'", new_mailbox_name, old_mailbox_name);
  
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        rc = sqlite3_changes(local_db_handle);
        if (rc == 0) {
                EM_DEBUG_EXCEPTION(" no matched mail found...");
                
-               error = EM_STORAGE_ERROR_MAIL_NOT_FOUND;
+               error = EMF_ERROR_MAIL_NOT_FOUND;
                goto FINISH_OFF;
        }
  
@@ -7425,25 +7463,25 @@ EXPORT_API int em_storage_modify_mailbox_of_mails(char *old_mailbox_name, char *
        /* Modify the mailbox_name name in mail_read_mail_uid_tbl table */
        SNPRINTF(sql_query_string, sizeof(sql_query_string), "UPDATE mail_read_mail_uid_tbl SET mailbox_name = '%s' WHERE mailbox_name = '%s'", new_mailbox_name, old_mailbox_name);
 
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        rc = sqlite3_changes(local_db_handle);
        if (rc == 0)  {
                EM_DEBUG_EXCEPTION(" no matched mail found...");
-               error = EM_STORAGE_ERROR_MAIL_NOT_FOUND;
+               error = EMF_ERROR_MAIL_NOT_FOUND;
                goto FINISH_OFF;
        }
        
-       if (!em_storage_notify_storage_event(NOTI_MAILBOX_UPDATE, 1, 0, new_mailbox_name, 0))
-               EM_DEBUG_EXCEPTION(" em_storage_notify_storage_event[ NOTI_MAILBOX_UPDATE] : Notification Failed >>> ");
+       if (!emstorage_notify_storage_event(NOTI_MAILBOX_UPDATE, 1, 0, new_mailbox_name, 0))
+               EM_DEBUG_EXCEPTION(" emstorage_notify_storage_event[ NOTI_MAILBOX_UPDATE] : Notification Failed >>> ");
        
        ret = true;
        
 FINISH_OFF:
 
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -7454,34 +7492,34 @@ FINISH_OFF:
 }
 
 /**
-  *  em_storage_clean_save_status(int save_status, int  *err_code) - set the all mail status to the set value
+  *  emstorage_clean_save_status(int save_status, int  *err_code) - set the all mail status to the set value
   *
   *
   **/
-EXPORT_API int em_storage_clean_save_status(int save_status, int  *err_code)
+INTERNAL_FUNC int emstorage_clean_save_status(int save_status, int  *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("save_status[%d], err_code[%p]", save_status, err_code);
 
        EM_IF_NULL_RETURN_VALUE(err_code, false);
 
        int ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        int rc = 0;
        char sql_query_string[QUERY_SIZE] = {0, };
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
 
        memset(sql_query_string, 0x00, sizeof(sql_query_string));
        SNPRINTF(sql_query_string, sizeof(sql_query_string), "UPDATE mail_tbl SET save_status = %d WHERE save_status = %d", save_status, EMF_MAIL_STATUS_SENDING);
        EM_DEBUG_LOG("Query [%s]", sql_query_string);
 
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        rc = sqlite3_changes(local_db_handle);
        if (rc == 0) {
                EM_DEBUG_LOG(" No Matched Mail Exists ");
-               error = EM_STORAGE_ERROR_MAIL_NOT_FOUND;
+               error = EMF_ERROR_MAIL_NOT_FOUND;
        }
        
        ret = true;
@@ -7495,28 +7533,28 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_set_field_of_mails_with_integer_value(int account_id, int mail_ids[], int mail_ids_count, char *field_name, int value, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_set_field_of_mails_with_integer_value(int account_id, int mail_ids[], int mail_ids_count, char *field_name, int value, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id [%d], mail_ids[%p], mail_ids_count[%d], field_name[%s], value[%d], transaction[%d], err_code[%p]", account_id, mail_ids, mail_ids_count, field_name, value, transaction, err_code);
        int i, error, rc, ret = false, cur_mail_id_string = 0, mail_id_string_buffer_length = 0;
        char sql_query_string[QUERY_SIZE] = {0, }, *mail_id_string_buffer = NULL, *parameter_string = NULL;
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
        
        if (!mail_ids  || !field_name || account_id == 0) {
-               EM_DEBUG_EXCEPTION("EM_STORAGE_ERROR_INVALID_PARAM");
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
 
        /* Generating mail id list string */
        mail_id_string_buffer_length = MAIL_ID_STRING_LENGTH * mail_ids_count;
 
-       mail_id_string_buffer = em_core_malloc(mail_id_string_buffer_length);
+       mail_id_string_buffer = em_malloc(mail_id_string_buffer_length);
 
        if(!mail_id_string_buffer) {
-               EM_DEBUG_EXCEPTION("em_core_malloc failed");
-               error = EM_STORAGE_ERROR_OUT_OF_MEMORY;
+               EM_DEBUG_EXCEPTION("em_malloc failed");
+               error = EMF_ERROR_OUT_OF_MEMORY;
                goto FINISH_OFF;
        }
        
@@ -7527,11 +7565,11 @@ EXPORT_API int em_storage_set_field_of_mails_with_integer_value(int account_id,
                mail_id_string_buffer[strlen(mail_id_string_buffer) - 1] = NULL_CHAR;
 
        /* Generating notification parameter string */
-       parameter_string = em_core_malloc(mail_id_string_buffer_length + strlen(field_name) + 2);
+       parameter_string = em_malloc(mail_id_string_buffer_length + strlen(field_name) + 2);
 
        if(!parameter_string) {
-               EM_DEBUG_EXCEPTION("em_core_malloc failed");
-               error = EM_STORAGE_ERROR_OUT_OF_MEMORY;
+               EM_DEBUG_EXCEPTION("em_malloc failed");
+               error = EMF_ERROR_OUT_OF_MEMORY;
                goto FINISH_OFF;
        }
 
@@ -7541,9 +7579,9 @@ EXPORT_API int em_storage_set_field_of_mails_with_integer_value(int account_id,
        SNPRINTF(sql_query_string, QUERY_SIZE, "UPDATE mail_tbl SET %s = %d WHERE mail_id in (%s) AND account_id = %d", field_name, value, mail_id_string_buffer, account_id);
 
        /* Execute query */
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
        if (sqlite3_changes(local_db_handle) == 0) 
                EM_DEBUG_LOG("no mail matched...");
@@ -7551,11 +7589,11 @@ EXPORT_API int em_storage_set_field_of_mails_with_integer_value(int account_id,
        ret = true;
 
 FINISH_OFF:
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        _DISCONNECT_DB;
        
-       if (ret && parameter_string && !em_storage_notify_storage_event(NOTI_MAIL_FIELD_UPDATE, account_id, 0, parameter_string, value))
-                       EM_DEBUG_EXCEPTION("em_storage_notify_storage_event failed : NOTI_MAIL_FIELD_UPDATE [%s,%d]", field_name, value);
+       if (ret && parameter_string && !emstorage_notify_storage_event(NOTI_MAIL_FIELD_UPDATE, account_id, 0, parameter_string, value))
+                       EM_DEBUG_EXCEPTION("emstorage_notify_storage_event failed : NOTI_MAIL_FIELD_UPDATE [%s,%d]", field_name, value);
        
        EM_SAFE_FREE(mail_id_string_buffer);
        EM_SAFE_FREE(parameter_string);
@@ -7567,19 +7605,19 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_change_mail_field(int mail_id, emf_mail_change_type_t type, emf_mail_tbl_t* mail, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_change_mail_field(int mail_id, emf_mail_change_type_t type, emstorage_mail_tbl_t* mail, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("mail_id[%d], type[%d], mail[%p], transaction[%d], err_code[%p]", mail_id, type, mail, transaction, err_code);
        
        if (mail_id <= 0 || !mail)  {
                EM_DEBUG_EXCEPTION(" mail_id[%d], type[%d], mail[%p]", mail_id, type, mail);
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
        int ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        int move_flag = 0;
        DB_STMT hStmt = NULL;
        char sql_query_string[QUERY_SIZE] = {0, };
@@ -7589,8 +7627,8 @@ EXPORT_API int em_storage_change_mail_field(int mail_id, emf_mail_change_type_t
 
        char *mailbox_name = NULL;      
 
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
        
        switch (type) {
                case APPEND_BODY:
@@ -7614,53 +7652,54 @@ EXPORT_API int em_storage_change_mail_field(int mail_id, emf_mail_change_type_t
                                , mail_id);
 
                        
-                       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
-                       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+                       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+                       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
                         i = 0;
                        
-                       _bindStmtFieldDataInt(hStmt, i++, mail->body_download_status);
-                       _bindStmtFieldDataString(hStmt, i++, (char *)mail->file_path_plain, 0, TEXT_1_LEN_IN_MAIL_TBL);
-                       _bindStmtFieldDataString(hStmt, i++, (char *)mail->file_path_html, 0, TEXT_2_LEN_IN_MAIL_TBL);
-                       _bindStmtFieldDataInt(hStmt, i++, mail->flags_seen_field);
-                       _bindStmtFieldDataInt(hStmt, i++, mail->flags_deleted_field);
-                       _bindStmtFieldDataInt(hStmt, i++, mail->flags_deleted_field);
-                       _bindStmtFieldDataInt(hStmt, i++, mail->flags_flagged_field);
-                       _bindStmtFieldDataInt(hStmt, i++, mail->flags_answered_field);
-                       _bindStmtFieldDataInt(hStmt, i++, mail->flags_recent_field);
-                       _bindStmtFieldDataInt(hStmt, i++, mail->flags_draft_field);
-                       _bindStmtFieldDataInt(hStmt, i++, mail->flags_forwarded_field);
-                       _bindStmtFieldDataInt(hStmt, i++, mail->DRM_status);
-                       _bindStmtFieldDataInt(hStmt, i++, mail->attachment_count);
-                       _bindStmtFieldDataString(hStmt, i++, (char *)mail->preview_text, 0, PREVIEWBODY_LEN_IN_MAIL_TBL);
-                       _bindStmtFieldDataInt(hStmt, i++, mail->meeting_request_status);
+                       _bind_stmt_field_data_int(hStmt, i++, mail->body_download_status);
+                       _bind_stmt_field_data_string(hStmt, i++, (char *)mail->file_path_plain, 0, TEXT_1_LEN_IN_MAIL_TBL);
+                       _bind_stmt_field_data_string(hStmt, i++, (char *)mail->file_path_html, 0, TEXT_2_LEN_IN_MAIL_TBL);
+                       _bind_stmt_field_data_int(hStmt, i++, mail->flags_seen_field);
+                       _bind_stmt_field_data_int(hStmt, i++, mail->flags_deleted_field);
+                       _bind_stmt_field_data_int(hStmt, i++, mail->flags_flagged_field);
+                       _bind_stmt_field_data_int(hStmt, i++, mail->flags_answered_field);
+                       _bind_stmt_field_data_int(hStmt, i++, mail->flags_recent_field);
+                       _bind_stmt_field_data_int(hStmt, i++, mail->flags_draft_field);
+                       _bind_stmt_field_data_int(hStmt, i++, mail->flags_forwarded_field);
+                       _bind_stmt_field_data_int(hStmt, i++, mail->DRM_status);
+                       _bind_stmt_field_data_int(hStmt, i++, mail->attachment_count);
+                       _bind_stmt_field_data_string(hStmt, i++, (char *)mail->preview_text, 0, PREVIEWBODY_LEN_IN_MAIL_TBL);
+                       _bind_stmt_field_data_int(hStmt, i++, mail->meeting_request_status);
                        break;
                        
                case UPDATE_MAILBOX: {
                                int err;
-                               emf_mailbox_tbl_t *mailbox_name;
+                               emstorage_mailbox_tbl_t *mailbox_tbl;
+                       
+                               if (!emstorage_get_mailbox_by_name(mail->account_id, -1, mail->mailbox_name, &mailbox_tbl, false, &err)) {
+                                       EM_DEBUG_EXCEPTION(" emstorage_get_mailbox_by_name failed - %d", err);
                        
-                               if (!em_storage_get_mailbox_by_name(mail->account_id, -1, mail->mailbox_name, &mailbox_name, false, &err)) {
-                                       EM_DEBUG_EXCEPTION(" em_storage_get_mailbox_by_name failed - %d", err);
-                                       err = em_storage_get_emf_error_from_em_storage_error(err);
                                        goto FINISH_OFF;
                                }
 
                                SNPRINTF(sql_query_string, sizeof(sql_query_string),
                                        "UPDATE mail_tbl SET"
+                                       " mailbox_id = '%d'"
                                        " mailbox_name = '%s'"
                                        ",mailbox_type = '%d'"
                                        " WHERE mail_id = %d AND account_id != 0"
+                                       , mailbox_tbl->mailbox_id
                                        , mail->mailbox_name ? mail->mailbox_name : ""
-                                       , mailbox_name->mailbox_type
+                                       , mailbox_tbl->mailbox_type
                                        , mail_id);
                                        move_flag = 1;
 
 
                                EM_DEBUG_LOG("Query [%s]", sql_query_string);
                                
-                               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
-                               EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+                               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+                               EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                                        ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
                        }
                        break;
@@ -7687,8 +7726,8 @@ EXPORT_API int em_storage_change_mail_field(int mail_id, emf_mail_change_type_t
                        EM_DEBUG_LOG("Query [%s]", sql_query_string);
  
                        
-                       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
-                       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+                       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+                       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
                        break;
@@ -7711,8 +7750,8 @@ EXPORT_API int em_storage_change_mail_field(int mail_id, emf_mail_change_type_t
                        EM_DEBUG_LOG("Query [%s]", sql_query_string);
  
                        
-                       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
-                       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+                       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+                       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
                        break;
 
@@ -7726,15 +7765,15 @@ EXPORT_API int em_storage_change_mail_field(int mail_id, emf_mail_change_type_t
                        EM_DEBUG_LOG("Query [%s]", sql_query_string);
  
                        
-                       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
-                       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+                       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+                       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
                        break;
                        
                case UPDATE_MAIL:
                        SNPRINTF(sql_query_string, sizeof(sql_query_string),
                                "UPDATE mail_tbl SET"
-                               " full_address_from = ?"
+                               "  full_address_from = ?"
                                ", full_address_reply = ?"
                                ", full_address_to = ?"
                                ", full_address_cc = ?"
@@ -7766,77 +7805,59 @@ EXPORT_API int em_storage_change_mail_field(int mail_id, emf_mail_change_type_t
                                , mail_id);
  
                        
-                       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+                       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
                        EM_DEBUG_LOG(" before sqlite3_prepare hStmt = %p", hStmt);
-                       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+                       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
                        i = 0;  
-                       _bindStmtFieldDataString(hStmt, i++, (char *)mail->full_address_from, 1, FROM_LEN_IN_MAIL_TBL);
-                       _bindStmtFieldDataString(hStmt, i++, (char *)mail->full_address_reply, 1, REPLY_TO_LEN_IN_MAIL_TBL);
-                       _bindStmtFieldDataString(hStmt, i++, (char *)mail->full_address_to, 1, TO_LEN_IN_MAIL_TBL);
-                       _bindStmtFieldDataString(hStmt, i++, (char *)mail->full_address_cc, 1, CC_LEN_IN_MAIL_TBL);
-                       _bindStmtFieldDataString(hStmt, i++, (char *)mail->full_address_bcc, 1, BCC_LEN_IN_MAIL_TBL);
-                       _bindStmtFieldDataString(hStmt, i++, (char *)mail->full_address_return, 1, RETURN_PATH_LEN_IN_MAIL_TBL);
-                       _bindStmtFieldDataString(hStmt, i++, (char *)mail->subject, 1, SUBJECT_LEN_IN_MAIL_TBL);
-                       _bindStmtFieldDataString(hStmt, i++, (char *)mail->file_path_plain, 0, TEXT_1_LEN_IN_MAIL_TBL);
-                       _bindStmtFieldDataString(hStmt, i++, (char *)mail->datetime, 0, DATETIME_LEN_IN_MAIL_TBL);
-                       _bindStmtFieldDataChar(hStmt, i++, mail->flags_seen_field);
-                       _bindStmtFieldDataChar(hStmt, i++, mail->flags_deleted_field);
-                       _bindStmtFieldDataChar(hStmt, i++, mail->flags_flagged_field);
-                       _bindStmtFieldDataChar(hStmt, i++, mail->flags_answered_field);
-                       _bindStmtFieldDataChar(hStmt, i++, mail->flags_recent_field);
-                       _bindStmtFieldDataChar(hStmt, i++, mail->flags_draft_field);
-                       _bindStmtFieldDataChar(hStmt, i++, mail->flags_forwarded_field);
-                       _bindStmtFieldDataInt(hStmt, i++, mail->priority);
-                       _bindStmtFieldDataInt(hStmt, i++, mail->save_status);
-                       _bindStmtFieldDataInt(hStmt, i++, mail->lock_status);
-                       _bindStmtFieldDataInt(hStmt, i++, mail->report_status);
-                       _bindStmtFieldDataInt(hStmt, i++, mail->DRM_status);
-                       _bindStmtFieldDataString(hStmt, i++, (char *)mail->file_path_html, 0, TEXT_2_LEN_IN_MAIL_TBL);
-                       _bindStmtFieldDataInt(hStmt, i++, mail->mail_size);
-                       _bindStmtFieldDataString(hStmt, i++, (char *)mail->preview_text, 1, PREVIEWBODY_LEN_IN_MAIL_TBL);
-                       _bindStmtFieldDataInt(hStmt, i++, mail->body_download_status);
-                       _bindStmtFieldDataInt(hStmt, i++, mail->attachment_count);
-                       _bindStmtFieldDataInt(hStmt, i++, mail->inline_content_count);
-                       _bindStmtFieldDataInt(hStmt, i++, mail->meeting_request_status);
+                       _bind_stmt_field_data_string(hStmt, i++, (char*)mail->full_address_from, 1, FROM_LEN_IN_MAIL_TBL);
+                       _bind_stmt_field_data_string(hStmt, i++, (char*)mail->full_address_reply, 1, REPLY_TO_LEN_IN_MAIL_TBL);
+                       _bind_stmt_field_data_string(hStmt, i++, (char*)mail->full_address_to, 1, TO_LEN_IN_MAIL_TBL);
+                       _bind_stmt_field_data_string(hStmt, i++, (char*)mail->full_address_cc, 1, CC_LEN_IN_MAIL_TBL);
+                       _bind_stmt_field_data_string(hStmt, i++, (char*)mail->full_address_bcc, 1, BCC_LEN_IN_MAIL_TBL);
+                       _bind_stmt_field_data_string(hStmt, i++, (char*)mail->full_address_return, 1, RETURN_PATH_LEN_IN_MAIL_TBL);
+                       _bind_stmt_field_data_string(hStmt, i++, (char*)mail->subject, 1, SUBJECT_LEN_IN_MAIL_TBL);
+                       _bind_stmt_field_data_string(hStmt, i++, (char*)mail->file_path_plain, 0, TEXT_1_LEN_IN_MAIL_TBL);
+                       _bind_stmt_field_data_time_t(hStmt, i++, mail->date_time);
+                       _bind_stmt_field_data_char  (hStmt, i++, mail->flags_seen_field);
+                       _bind_stmt_field_data_char  (hStmt, i++, mail->flags_deleted_field);
+                       _bind_stmt_field_data_char  (hStmt, i++, mail->flags_flagged_field);
+                       _bind_stmt_field_data_char  (hStmt, i++, mail->flags_answered_field);
+                       _bind_stmt_field_data_char  (hStmt, i++, mail->flags_recent_field);
+                       _bind_stmt_field_data_char  (hStmt, i++, mail->flags_draft_field);
+                       _bind_stmt_field_data_char  (hStmt, i++, mail->flags_forwarded_field);
+                       _bind_stmt_field_data_int   (hStmt, i++, mail->priority);
+                       _bind_stmt_field_data_int   (hStmt, i++, mail->save_status);
+                       _bind_stmt_field_data_int   (hStmt, i++, mail->lock_status);
+                       _bind_stmt_field_data_int   (hStmt, i++, mail->report_status);
+                       _bind_stmt_field_data_int   (hStmt, i++, mail->DRM_status);
+                       _bind_stmt_field_data_string(hStmt, i++, (char*)mail->file_path_html, 0, TEXT_2_LEN_IN_MAIL_TBL);
+                       _bind_stmt_field_data_int   (hStmt, i++, mail->mail_size);
+                       _bind_stmt_field_data_string(hStmt, i++, (char*)mail->preview_text, 1, PREVIEWBODY_LEN_IN_MAIL_TBL);
+                       _bind_stmt_field_data_int   (hStmt, i++, mail->body_download_status);
+                       _bind_stmt_field_data_int   (hStmt, i++, mail->attachment_count);
+                       _bind_stmt_field_data_int   (hStmt, i++, mail->inline_content_count);
+                       _bind_stmt_field_data_int   (hStmt, i++, mail->meeting_request_status);
                        break;
                        
                case UPDATE_DATETIME:  {
-                       static char buf[16];
-                       time_t t = time(NULL);
-                       
-                       struct tm *p_tm = localtime(&t);
-                       if (!p_tm)  {
-                               EM_DEBUG_EXCEPTION(" localtime failed...");
-                               error = EM_STORAGE_ERROR_SYSTEM_FAILURE;
-                               goto FINISH_OFF;
-                       }
-                       
-                       SNPRINTF(buf, sizeof(buf),
-                               "%04d%02d%02d%02d%02d%02d",
-                               p_tm->tm_year + 1900,
-                               p_tm->tm_mon + 1,
-                               p_tm->tm_mday,
-                               p_tm->tm_hour,
-                               p_tm->tm_min,
-                               p_tm->tm_sec);
-                       
+                       time_t now = time(NULL);
+
                        SNPRINTF(sql_query_string, sizeof(sql_query_string),
                                "UPDATE mail_tbl SET"
-                               " date_time = '%s'"
+                               " date_time = '%d'"
                                " WHERE mail_id = %d AND account_id != 0"
-                               , buf
+                               , (int)now
                                , mail_id);
-                       
-                       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
-                       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+
+                       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+                       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
                        break;
                }
                        
                case UPDATE_FROM_CONTACT_INFO:
-                       EM_DEBUG_LOG("NVARCHAR : em_storage_change_mail_field - mail change type is UPDATE_FROM_CONTACT_INFO");
+                       EM_DEBUG_LOG("NVARCHAR : emstorage_change_mail_field - mail change type is UPDATE_FROM_CONTACT_INFO");
                        SNPRINTF(sql_query_string, sizeof(sql_query_string),
                                "UPDATE mail_tbl SET"
                                " email_address_sender = ?,"
@@ -7845,15 +7866,15 @@ EXPORT_API int em_storage_change_mail_field(int mail_id, emf_mail_change_type_t
  
                        hStmt = NULL;
                        
-                       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
-                       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+                       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+                       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
                        i = 0;
-                       _bindStmtFieldDataString(hStmt, i++, (char *)mail->email_address_sender, 1, FROM_EMAIL_ADDRESS_LEN_IN_MAIL_TBL);
+                       _bind_stmt_field_data_string(hStmt, i++, (char *)mail->email_address_sender, 1, FROM_EMAIL_ADDRESS_LEN_IN_MAIL_TBL);
                        break;
                        
                case UPDATE_TO_CONTACT_INFO:
-                       EM_DEBUG_LOG("NVARCHAR : em_storage_change_mail_field - mail change type is UPDATE_TO_CONTACT_INFO");
+                       EM_DEBUG_LOG("NVARCHAR : emstorage_change_mail_field - mail change type is UPDATE_TO_CONTACT_INFO");
                        SNPRINTF(sql_query_string, sizeof(sql_query_string),
                                "UPDATE mail_tbl SET"
                                " email_address_recipient = ?,"
@@ -7862,15 +7883,15 @@ EXPORT_API int em_storage_change_mail_field(int mail_id, emf_mail_change_type_t
  
                        hStmt = NULL;
                        
-                       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
-                       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+                       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+                       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
                        i = 0;
-                       _bindStmtFieldDataString(hStmt, i++, (char *)mail->email_address_recipient, 1, TO_EMAIL_ADDRESS_LEN_IN_MAIL_TBL);
+                       _bind_stmt_field_data_string(hStmt, i++, (char *)mail->email_address_recipient, 1, TO_EMAIL_ADDRESS_LEN_IN_MAIL_TBL);
                        break;
 
                        case UPDATE_ALL_CONTACT_INFO:
-                               EM_DEBUG_LOG("em_storage_change_mail_field - mail change type is UPDATE_ALL_CONTACT_INFO");
+                               EM_DEBUG_LOG("emstorage_change_mail_field - mail change type is UPDATE_ALL_CONTACT_INFO");
                                SNPRINTF(sql_query_string, sizeof(sql_query_string),
                                        "UPDATE mail_tbl SET"
                                        " email_address_sender = ?,"
@@ -7880,12 +7901,12 @@ EXPORT_API int em_storage_change_mail_field(int mail_id, emf_mail_change_type_t
 
                                hStmt = NULL;
                                
-                               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
-                               EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+                               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+                               EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                                        ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
                                i = 0;
-                               _bindStmtFieldDataString(hStmt, i++, (char *)mail->email_address_sender, 1, FROM_EMAIL_ADDRESS_LEN_IN_MAIL_TBL);
-                               _bindStmtFieldDataString(hStmt, i++, (char *)mail->email_address_recipient, 1, TO_EMAIL_ADDRESS_LEN_IN_MAIL_TBL);
+                               _bind_stmt_field_data_string(hStmt, i++, (char *)mail->email_address_sender, 1, FROM_EMAIL_ADDRESS_LEN_IN_MAIL_TBL);
+                               _bind_stmt_field_data_string(hStmt, i++, (char *)mail->email_address_recipient, 1, TO_EMAIL_ADDRESS_LEN_IN_MAIL_TBL);
                                break;
 
                
@@ -7904,17 +7925,17 @@ EXPORT_API int em_storage_change_mail_field(int mail_id, emf_mail_change_type_t
                        , mail_id);
 
                        
-                       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
-                       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+                       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+                       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
                         i = 0;
                        
-                       _bindStmtFieldDataInt(hStmt, i++, mail->body_download_status);
-                       _bindStmtFieldDataString(hStmt, i++, (char *)mail->file_path_plain, 0, TEXT_1_LEN_IN_MAIL_TBL);
-                       _bindStmtFieldDataString(hStmt, i++, (char *)mail->file_path_html,  0, TEXT_2_LEN_IN_MAIL_TBL);
-                       _bindStmtFieldDataInt(hStmt, i++, mail->attachment_count);
-                       _bindStmtFieldDataInt(hStmt, i++, mail->inline_content_count);
-                       _bindStmtFieldDataString(hStmt, i++, (char *)mail->preview_text,    0, PREVIEWBODY_LEN_IN_MAIL_TBL);
+                       _bind_stmt_field_data_int(hStmt, i++, mail->body_download_status);
+                       _bind_stmt_field_data_string(hStmt, i++, (char *)mail->file_path_plain, 0, TEXT_1_LEN_IN_MAIL_TBL);
+                       _bind_stmt_field_data_string(hStmt, i++, (char *)mail->file_path_html,  0, TEXT_2_LEN_IN_MAIL_TBL);
+                       _bind_stmt_field_data_int(hStmt, i++, mail->attachment_count);
+                       _bind_stmt_field_data_int(hStmt, i++, mail->inline_content_count);
+                       _bind_stmt_field_data_string(hStmt, i++, (char *)mail->preview_text,    0, PREVIEWBODY_LEN_IN_MAIL_TBL);
        
                        break;
 
@@ -7923,36 +7944,36 @@ EXPORT_API int em_storage_change_mail_field(int mail_id, emf_mail_change_type_t
                default:
                        EM_DEBUG_LOG(" type[%d]", type);
                        
-                       error = EM_STORAGE_ERROR_INVALID_PARAM;
+                       error = EMF_ERROR_INVALID_PARAM;
                        goto FINISH_OFF;
        }
  
        if (hStmt != NULL)  {
-               /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-               EM_DEBUG_DB_EXEC((rc == SQLITE_FULL), {error = EM_STORAGE_ERROR_DB_IS_FULL;goto FINISH_OFF; },
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+               EM_DEBUG_DB_EXEC((rc == SQLITE_FULL), {error = EMF_ERROR_MAIL_MEMORY_FULL;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
-               EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+               EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                        ("sqlite3_step fail:%d", rc));
                rc = sqlite3_changes(local_db_handle);
                if (rc == 0)  {
                        EM_DEBUG_EXCEPTION(" no matched mail found...");
        
-                       error = EM_STORAGE_ERROR_MAIL_NOT_FOUND;
+                       error = EMF_ERROR_MAIL_NOT_FOUND;
                        goto FINISH_OFF;
                }
        }       
 
        if (mail->account_id == 0) {
-               emf_mail_tbl_t* mail_for_account = NULL;
-               if (!em_storage_get_mail_field_by_id(mail_id, RETRIEVE_ACCOUNT, &mail_for_account, true, &error) || !mail_for_account) {
-                       EM_DEBUG_EXCEPTION(" em_storage_get_mail_field_by_id failed - %d", error);
-/*                     error = em_storage_get_emf_error_from_em_storage_error(error); */
+               emstorage_mail_tbl_t* mail_for_account = NULL;
+               if (!emstorage_get_mail_field_by_id(mail_id, RETRIEVE_ACCOUNT, &mail_for_account, true, &error) || !mail_for_account) {
+                       EM_DEBUG_EXCEPTION(" emstorage_get_mail_field_by_id failed - %d", error);
+/*              */
                        goto FINISH_OFF;
                }
                mail->account_id = mail_for_account->account_id;
                if (mail_for_account) 
-                       em_storage_free_mail(&mail_for_account, 1, NULL);
+                       emstorage_free_mail(&mail_for_account, 1, NULL);
        }
 
        ret = true;
@@ -7963,44 +7984,31 @@ FINISH_OFF:
                rc = sqlite3_finalize(hStmt);
                if (rc != SQLITE_OK)  {
                        EM_DEBUG_LOG(" sqlite3_finalize failed - %d", rc);
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
                hStmt = NULL;
        }
 
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        _DISCONNECT_DB;
 
        /*h.gahlaut@samsung.com: Moving publication of notification after commiting transaction to DB */
        
        if (ret == true &&  move_flag != 1) {
-               if (!em_storage_get_mailboxname_by_mailbox_type(mail->account_id, EMF_MAILBOX_TYPE_SENTBOX, &mailbox_name, false, &error))
-                       EM_DEBUG_EXCEPTION(" em_storage_get_mailboxname_by_mailbox_type failed - %d", error);
-
-#ifdef __FEATURE_PROGRESS_IN_OUTBOX__
+               if (!emstorage_get_mailboxname_by_mailbox_type(mail->account_id, EMF_MAILBOX_TYPE_SENTBOX, &mailbox_name, false, &error))
+                       EM_DEBUG_EXCEPTION(" emstorage_get_mailboxname_by_mailbox_type failed - %d", error);
 
                if (mail->mailbox_name && mailbox_name) {
                        if (strcmp(mail->mailbox_name, mailbox_name) != 0) {
-                               if (!em_storage_notify_storage_event(NOTI_MAIL_UPDATE, mail->account_id, mail_id, mail->mailbox_name, type))
-                                       EM_DEBUG_EXCEPTION(" em_storage_notify_storage_event Failed [ NOTI_MAIL_UPDATE ] >>>> ");
+                               if (!emstorage_notify_storage_event(NOTI_MAIL_UPDATE, mail->account_id, mail_id, mail->mailbox_name, type))
+                                       EM_DEBUG_EXCEPTION(" emstorage_notify_storage_event Failed [ NOTI_MAIL_UPDATE ] >>>> ");
                        }
                }
                else {
                        /* h.gahlaut@samsung.com: Jan 10, 2011 Publishing noti to refresh outbox when email sending status changes */
-                       if (!em_storage_notify_storage_event(NOTI_MAIL_UPDATE, mail->account_id, mail_id, NULL, type))
-                               EM_DEBUG_EXCEPTION(" em_storage_notify_storage_event Failed [ NOTI_MAIL_UPDATE ] ");
+                       if (!emstorage_notify_storage_event(NOTI_MAIL_UPDATE, mail->account_id, mail_id, NULL, type))
+                               EM_DEBUG_EXCEPTION(" emstorage_notify_storage_event Failed [ NOTI_MAIL_UPDATE ] ");
                }
-
-#else
-
-               if (mail->mailbox_name && strcmp(mail->mailbox_name, mailbox_name) != 0) {
-                       if (!em_storage_notify_storage_event(NOTI_MAIL_UPDATE, mail->account_id, mail_id, mail->mailbox_name, type))
-                               EM_DEBUG_EXCEPTION(" em_storage_notify_storage_event Failed [ NOTI_MAIL_UPDATE ] >>>> ");
-               }
-       
-               
-#endif
-
        }
 
        EM_SAFE_FREE(mailbox_name);
@@ -8013,25 +8021,25 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int em_storage_get_mail_count_with_draft_flag(int account_id, const char *mailbox_name, int *total, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_get_mail_count_with_draft_flag(int account_id, const char *mailbox_name, int *total, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], mailbox_name[%s], total[%p], transaction[%d], err_code[%p]", account_id, mailbox_name, total, transaction, err_code);
        
        if (!total)  {
                EM_DEBUG_EXCEPTION("accoun_id[%d], mailbox_name[%s], total[%p]", account_id, mailbox_name, total);
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
        int rc = -1, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        DB_STMT hStmt = NULL;
        char sql_query_string[QUERY_SIZE] = {0, };
 
        memset(&sql_query_string, 0x00, sizeof(sql_query_string));
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_READ_TRANSACTION(transaction);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_READ_TRANSACTION(transaction);
        
        if (total)  {
                SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT COUNT(*) FROM mail_tbl WHERE flags_draft_field = 1");
@@ -8045,25 +8053,25 @@ EXPORT_API int em_storage_get_mail_count_with_draft_flag(int account_id, const c
 #ifdef USE_GET_RECORD_COUNT_API
                EM_DEBUG_LOG("Query : [%s]", sql_query_string);
                char **result;
-               /*  rc = sqlite3_get_table(local_db_handle, sql_query_string, &result, NULL, NULL, NULL); */
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, NULL, NULL, NULL), rc);
-               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
+
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, NULL, NULL, NULL), rc);
+               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
                        ("SQL(%s) sqlite3_get_table fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
                *total = atoi(result[1]);
                sqlite3_free_table(result);
 #else
                
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
-               EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+               EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                        ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
-               /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-               EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+               EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                        ("sqlite3_step fail:%d", rc));
 
-               _getStmtFieldDataInt(hStmt, total, 0);
+               _get_stmt_field_data_int(hStmt, total, 0);
 #endif         /*  USE_GET_RECORD_COUNT_API */
        }
        ret = true;             
@@ -8074,12 +8082,12 @@ FINISH_OFF:
                rc = sqlite3_finalize(hStmt);
                if (rc != SQLITE_OK)  {
                        EM_DEBUG_LOG(" sqlite3_finalize failed - %d", rc);
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
        }
 #endif
 
-       EM_STORAGE_FINISH_READ_TRANSACTION(transaction);
+       EMSTORAGE_FINISH_READ_TRANSACTION(transaction);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -8089,25 +8097,25 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_get_mail_count_on_sending(int account_id, const char *mailbox_name, int *total, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_get_mail_count_on_sending(int account_id, const char *mailbox_name, int *total, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], mailbox_name[%s], total[%p], transaction[%d], err_code[%p]", account_id, mailbox_name, total, transaction, err_code);
        
        if (!total)  {          
                EM_DEBUG_EXCEPTION(" accoun_id[%d], mailbox_name[%s], total[%p]", account_id, mailbox_name, total);
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
        int rc = -1, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        DB_STMT hStmt = NULL;
        char sql_query_string[QUERY_SIZE] = {0, };
 
        memset(&sql_query_string, 0x00, sizeof(sql_query_string));
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_READ_TRANSACTION(transaction);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_READ_TRANSACTION(transaction);
        
        if (total)  {
                SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT COUNT(*) FROM mail_tbl WHERE save_status = %d ", EMF_MAIL_STATUS_SENDING);
@@ -8120,25 +8128,25 @@ EXPORT_API int em_storage_get_mail_count_on_sending(int account_id, const char *
                
 #ifdef USE_GET_RECORD_COUNT_API
                char **result;
-               /*  rc = sqlite3_get_table(local_db_handle, sql_query_string, &result, NULL, NULL, NULL); */
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, NULL, NULL, NULL), rc);
-               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
+
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, NULL, NULL, NULL), rc);
+               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
                        ("SQL(%s) sqlite3_get_table fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
                *total = atoi(result[1]);
                sqlite3_free_table(result);
 #else
                
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
-               EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+               EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                        ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
-               /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-               EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+               EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                        ("sqlite3_step fail:%d", rc));
 
-               _getStmtFieldDataInt(hStmt, total, 0);
+               _get_stmt_field_data_int(hStmt, total, 0);
 #endif         /*  USE_GET_RECORD_COUNT_API */
        }
        ret = true;             
@@ -8150,12 +8158,12 @@ FINISH_OFF:
                if (rc != SQLITE_OK) {
                        EM_DEBUG_LOG(" sqlite3_finalize failed - %d", rc);
                        
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
        }
 #endif
 
-       EM_STORAGE_FINISH_READ_TRANSACTION(transaction);
+       EMSTORAGE_FINISH_READ_TRANSACTION(transaction);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -8166,29 +8174,29 @@ FINISH_OFF:
 
 }
 
-EXPORT_API int em_storage_increase_mail_id(int *mail_id, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_increase_mail_id(int *mail_id, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("mail_id[%p], transaction[%d], err_code[%p]", mail_id, transaction, err_code);
        
        int rc, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        int latest_mail_id = 0;
        sqlite3 *local_db_handle = NULL;
        char *sql = "SELECT MAX(mail_id) FROM mail_tbl;";
        char **result = NULL;
 
 #ifdef __FEATURE_USE_SHARED_MUTEX_FOR_GENERATING_MAIL_ID__
-       em_storage_shm_mutex_timedlock(&mapped_for_generating_mail_id, 2);
+       _timedlock_shm_mutex(&mapped_for_generating_mail_id, 2);
 #endif /* __FEATURE_USE_SHARED_MUTEX_FOR_GENERATING_MAIL_ID__ */
 
        ret = vconf_get_int(VCONF_KEY_LATEST_MAIL_ID, &latest_mail_id);
        if (ret < 0 || latest_mail_id == 0) {
                EM_DEBUG_LOG("vconf_get_int() failed [%d] or latest_mail_id is zero", ret);
 
-               local_db_handle = em_storage_get_db_connection();
+               local_db_handle = emstorage_get_db_connection();
 
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL), rc);
-               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL), rc);
+               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
                        ("SQL(%s) sqlite3_get_table fail:%d -%s", sql, rc, sqlite3_errmsg(local_db_handle)));
                if (NULL == result[1])
                        rc = 1;
@@ -8207,7 +8215,7 @@ EXPORT_API int em_storage_increase_mail_id(int *mail_id, int transaction, int *e
                *mail_id = latest_mail_id;
 
 #ifdef __FEATURE_USE_SHARED_MUTEX_FOR_GENERATING_MAIL_ID__
-       em_storage_shm_mutex_unlock(&mapped_for_generating_mail_id);
+       _unlockshm_mutex(&mapped_for_generating_mail_id);
 #endif /* __FEATURE_USE_SHARED_MUTEX_FOR_GENERATING_MAIL_ID__ */
 
        ret = true;
@@ -8223,72 +8231,54 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int em_storage_add_mail(emf_mail_tbl_t* mail_tbl_data, int get_id, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_add_mail(emstorage_mail_tbl_t *mail_tbl_data, int get_id, int transaction, int *err_code)
 {
-       EM_PROFILE_BEGIN(emStorageMailAdd);
+       EM_PROFILE_BEGIN(profile_emstorage_add_mail);
        EM_DEBUG_FUNC_BEGIN("mail_tbl_data[%p], get_id[%d], transaction[%d], err_code[%p]", mail_tbl_data, get_id, transaction, err_code);
        
        if (!mail_tbl_data)  {
                EM_DEBUG_EXCEPTION("mail_tbl_data[%p], get_id[%d]", mail_tbl_data, get_id);
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
        int rc, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
-       static char bufDatetime[30] = {0, };
-       DB_STMT hStmt = NULL;
+       int error = EMF_ERROR_NONE;
        char sql_query_string[QUERY_SIZE] = {0, };
-       
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       DB_STMT hStmt = NULL;
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
        
        if (get_id)  {
                /*  increase unique id */
                char *sql = "SELECT max(rowid) FROM mail_tbl;";
                char **result;
-               
-               /*  rc = sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL);  */
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL), rc);
-               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
-                       ("SQL(%s) sqlite3_get_table fail:%d -%s", sql, rc, sqlite3_errmsg(local_db_handle)));
 
-               if (NULL==result[1])
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL), rc);
+               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
+                       ("SQL[%s] sqlite3_get_table fail[%d] [%s]", sql, rc, sqlite3_errmsg(local_db_handle)));
+
+               if (NULL == result[1])
                        rc = 1;
                else 
                        rc = atoi(result[1])+1;
+
                sqlite3_free_table(result);
-               mail_tbl_data->mail_id = rc;
-               mail_tbl_data->thread_id = mail_tbl_data->mail_id;
-       }
 
-       if (!mail_tbl_data->datetime)  {
-               time_t t = time(NULL);
-               struct tm *p_tm = localtime(&t);
-               
-               if (p_tm)  {
-                       SNPRINTF(bufDatetime, sizeof(bufDatetime), "%04d%02d%02d%02d%02d%02d",
-                               p_tm->tm_year + 1900,
-                               p_tm->tm_mon + 1,
-                               p_tm->tm_mday,
-                               p_tm->tm_hour,
-                               p_tm->tm_min,
-                               p_tm->tm_sec);
-               }
-       }
-       else if (strlen(mail_tbl_data->datetime) > 14)  {
-               EM_DEBUG_EXCEPTION("WARNING: the given datatime is too big.");
-               memcpy(bufDatetime, mail_tbl_data->datetime, 14);
-               bufDatetime[14] = NULL_CHAR;
+               mail_tbl_data->mail_id   = rc;
+               mail_tbl_data->thread_id = rc;
        }
-       else
-               strncpy(bufDatetime, mail_tbl_data->datetime, sizeof(bufDatetime)-1);
+
+       if (mail_tbl_data->date_time == 0)
+               mail_tbl_data->date_time = time(NULL);
 
        SNPRINTF(sql_query_string, sizeof(sql_query_string),
                "INSERT INTO mail_tbl VALUES "
                "( ?" /*  mail_id */
                ", ?" /*  account_id */
+               ", ?" /*  mailbox_id */
                ", ?" /*  mailbox_name */
                ", ?" /*  mailbox_type */
                ", ?" /*  subject */
@@ -8327,60 +8317,61 @@ EXPORT_API int em_storage_add_mail(emf_mail_tbl_t* mail_tbl_data, int get_id, in
                ", ?" /*  inline_content_count */
                ", ?" /*  thread_id */
                ", ?" /*  thread_item_count */
-               ", ?"   /*  preview_text */
-               ", ?"   /*  meeting_request_status */
+               ", ?" /*  preview_text */
+               ", ?" /*  meeting_request_status */
                ")");
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
-       _bindStmtFieldDataInt(hStmt, MAIL_ID_IDX_IN_MAIL_TBL, mail_tbl_data->mail_id);
-       _bindStmtFieldDataInt(hStmt, ACCOUNT_ID_IDX_IN_MAIL_TBL, mail_tbl_data->account_id);
-       _bindStmtFieldDataString(hStmt, MAILBOX_NAME_IDX_IN_MAIL_TBL, (char *)mail_tbl_data->mailbox_name, 0, MAILBOX_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataInt(hStmt, MAILBOX_TYPE_IDX_IN_MAIL_TBL, mail_tbl_data->mailbox_type);
-       _bindStmtFieldDataString(hStmt, SUBJECT_IDX_IN_MAIL_TBL, (char *)mail_tbl_data->subject, 1, SUBJECT_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataString(hStmt, DATETIME_IDX_IN_MAIL_TBL, (char *)bufDatetime, 0, DATETIME_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataInt(hStmt, SERVER_MAIL_STATUS_IDX_IN_MAIL_TBL, mail_tbl_data->server_mail_status);
-       _bindStmtFieldDataString(hStmt, SERVER_MAILBOX_NAME_IDX_IN_MAIL_TBL, (char *)mail_tbl_data->server_mailbox_name, 0, SERVER_MAILBOX_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataString(hStmt, SERVER_MAIL_ID_IDX_IN_MAIL_TBL, (char *)mail_tbl_data->server_mail_id, 0, SERVER_MAIL_ID_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataString(hStmt, MESSAGE_ID_IDX_IN_MAIL_TBL, (char *)mail_tbl_data->message_id, 0, MESSAGE_ID_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataString(hStmt, FULL_ADDRESS_FROM_IDX_IN_MAIL_TBL, (char *)mail_tbl_data->full_address_from, 1, FROM_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataString(hStmt, FULL_ADDRESS_REPLY_IDX_IN_MAIL_TBL, (char *)mail_tbl_data->full_address_reply, 1, REPLY_TO_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataString(hStmt, FULL_ADDRESS_TO_IDX_IN_MAIL_TBL, (char *)mail_tbl_data->full_address_to, 1, TO_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataString(hStmt, FULL_ADDRESS_CC_IDX_IN_MAIL_TBL, (char *)mail_tbl_data->full_address_cc, 1, CC_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataString(hStmt, FULL_ADDRESS_BCC_IDX_IN_MAIL_TBL, (char *)mail_tbl_data->full_address_bcc, 1, BCC_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataString(hStmt, FULL_ADDRESS_RETURN_IDX_IN_MAIL_TBL, (char *)mail_tbl_data->full_address_return, 1, RETURN_PATH_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataString(hStmt, EMAIL_ADDRESS_SENDER_IDX_IN_MAIL_TBL, (char *)mail_tbl_data->email_address_sender, 1, FROM_EMAIL_ADDRESS_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataString(hStmt, EMAIL_ADDRESS_RECIPIENT_IDX_IN_MAIL_TBL, (char *)mail_tbl_data->email_address_recipient, 1, TO_EMAIL_ADDRESS_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataString(hStmt, ALIAS_SENDER_IDX_IN_MAIL_TBL, (char *)mail_tbl_data->alias_sender, 1, FROM_CONTACT_NAME_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataString(hStmt, ALIAS_RECIPIENT_IDX_IN_MAIL_TBL, (char *)mail_tbl_data->alias_recipient, 1, FROM_CONTACT_NAME_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataInt(hStmt, BODY_DOWNLOAD_STATUS_IDX_IN_MAIL_TBL, mail_tbl_data->body_download_status);
-       _bindStmtFieldDataString(hStmt, FILE_PATH_PLAIN_IDX_IN_MAIL_TBL, (char *)mail_tbl_data->file_path_plain, 0, TEXT_1_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataString(hStmt, FILE_PATH_HTML_IDX_IN_MAIL_TBL, (char *)mail_tbl_data->file_path_html, 0, TEXT_2_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataInt(hStmt, MAIL_SIZE_IDX_IN_MAIL_TBL, mail_tbl_data->mail_size);
-       _bindStmtFieldDataInt(hStmt, FLAGS_SEEN_FIELD_IDX_IN_MAIL_TBL, mail_tbl_data->flags_seen_field);
-       _bindStmtFieldDataInt(hStmt, FLAGS_DELETED_FIELD_IDX_IN_MAIL_TBL, mail_tbl_data->flags_deleted_field);
-       _bindStmtFieldDataInt(hStmt, FLAGS_FLAGGED_FIELD_IDX_IN_MAIL_TBL, mail_tbl_data->flags_flagged_field);
-       _bindStmtFieldDataInt(hStmt, FLAGS_ANSWERED_FIELD_IDX_IN_MAIL_TBL, mail_tbl_data->flags_answered_field);
-       _bindStmtFieldDataInt(hStmt, FLAGS_RECENT_FIELD_IDX_IN_MAIL_TBL, mail_tbl_data->flags_recent_field);
-       _bindStmtFieldDataInt(hStmt, FLAGS_DRAFT_FIELD_IDX_IN_MAIL_TBL, mail_tbl_data->flags_draft_field);
-       _bindStmtFieldDataInt(hStmt, FLAGS_FORWARDED_FIELD_IDX_IN_MAIL_TBL, mail_tbl_data->flags_forwarded_field);
-       _bindStmtFieldDataInt(hStmt, DRM_STATUS_IDX_IN_MAIL_TBL, mail_tbl_data->DRM_status);
-       _bindStmtFieldDataInt(hStmt, PRIORITY_IDX_IN_MAIL_TBL, mail_tbl_data->priority);
-       _bindStmtFieldDataInt(hStmt, SAVE_STATUS_IDX_IN_MAIL_TBL, mail_tbl_data->save_status);
-       _bindStmtFieldDataInt(hStmt, LOCK_STATUS_IDX_IN_MAIL_TBL, mail_tbl_data->lock_status);
-       _bindStmtFieldDataInt(hStmt, REPORT_STATUS_IDX_IN_MAIL_TBL, mail_tbl_data->report_status);
-       _bindStmtFieldDataInt(hStmt, ATTACHMENT_COUNT_IDX_IN_MAIL_TBL, mail_tbl_data->attachment_count);
-       _bindStmtFieldDataInt(hStmt, INLINE_CONTENT_COUNT_IDX_IN_MAIL_TBL, mail_tbl_data->inline_content_count);
-       _bindStmtFieldDataInt(hStmt, THREAD_ID_IDX_IN_MAIL_TBL, mail_tbl_data->thread_id);
-       _bindStmtFieldDataInt(hStmt, THREAD_ITEM_COUNT_IDX_IN_MAIL_TBL, mail_tbl_data->thread_item_count);
-       _bindStmtFieldDataString(hStmt, PREVIEW_TEXT_IDX_IN_MAIL_TBL, (char *)mail_tbl_data->preview_text, 1, PREVIEWBODY_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataInt(hStmt, MEETING_REQUEST_STATUS_IDX_IN_MAIL_TBL, mail_tbl_data->meeting_request_status);
-
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc == SQLITE_FULL), {error = EM_STORAGE_ERROR_DB_IS_FULL;goto FINISH_OFF; }, ("sqlite3_step fail:%d", rc));
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; }, ("sqlite3_step fail:%d", rc));
+       _bind_stmt_field_data_int   (hStmt, MAIL_ID_IDX_IN_MAIL_TBL, mail_tbl_data->mail_id);
+       _bind_stmt_field_data_int   (hStmt, ACCOUNT_ID_IDX_IN_MAIL_TBL, mail_tbl_data->account_id);
+       _bind_stmt_field_data_int   (hStmt, MAILBOX_ID_IDX_IN_MAIL_TBL, mail_tbl_data->mailbox_id);
+       _bind_stmt_field_data_string(hStmt, MAILBOX_NAME_IDX_IN_MAIL_TBL, (char*)mail_tbl_data->mailbox_name, 0, MAILBOX_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_int   (hStmt, MAILBOX_TYPE_IDX_IN_MAIL_TBL, mail_tbl_data->mailbox_type);
+       _bind_stmt_field_data_string(hStmt, SUBJECT_IDX_IN_MAIL_TBL, (char*)mail_tbl_data->subject, 1, SUBJECT_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_int   (hStmt, DATETIME_IDX_IN_MAIL_TBL, mail_tbl_data->date_time);
+       _bind_stmt_field_data_int   (hStmt, SERVER_MAIL_STATUS_IDX_IN_MAIL_TBL, mail_tbl_data->server_mail_status);
+       _bind_stmt_field_data_string(hStmt, SERVER_MAILBOX_NAME_IDX_IN_MAIL_TBL, (char*)mail_tbl_data->server_mailbox_name, 0, SERVER_MAILBOX_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_string(hStmt, SERVER_MAIL_ID_IDX_IN_MAIL_TBL, (char*)mail_tbl_data->server_mail_id, 0, SERVER_MAIL_ID_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_string(hStmt, MESSAGE_ID_IDX_IN_MAIL_TBL, (char*)mail_tbl_data->message_id, 0, MESSAGE_ID_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_string(hStmt, FULL_ADDRESS_FROM_IDX_IN_MAIL_TBL, (char*)mail_tbl_data->full_address_from, 1, FROM_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_string(hStmt, FULL_ADDRESS_REPLY_IDX_IN_MAIL_TBL, (char*)mail_tbl_data->full_address_reply, 1, REPLY_TO_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_string(hStmt, FULL_ADDRESS_TO_IDX_IN_MAIL_TBL, (char*)mail_tbl_data->full_address_to, 1, TO_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_string(hStmt, FULL_ADDRESS_CC_IDX_IN_MAIL_TBL, (char*)mail_tbl_data->full_address_cc, 1, CC_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_string(hStmt, FULL_ADDRESS_BCC_IDX_IN_MAIL_TBL, (char*)mail_tbl_data->full_address_bcc, 1, BCC_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_string(hStmt, FULL_ADDRESS_RETURN_IDX_IN_MAIL_TBL, (char*)mail_tbl_data->full_address_return, 1, RETURN_PATH_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_string(hStmt, EMAIL_ADDRESS_SENDER_IDX_IN_MAIL_TBL, (char*)mail_tbl_data->email_address_sender, 1, FROM_EMAIL_ADDRESS_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_string(hStmt, EMAIL_ADDRESS_RECIPIENT_IDX_IN_MAIL_TBL, (char*)mail_tbl_data->email_address_recipient, 1, TO_EMAIL_ADDRESS_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_string(hStmt, ALIAS_SENDER_IDX_IN_MAIL_TBL, (char*)mail_tbl_data->alias_sender, 1, FROM_CONTACT_NAME_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_string(hStmt, ALIAS_RECIPIENT_IDX_IN_MAIL_TBL, (char*)mail_tbl_data->alias_recipient, 1, FROM_CONTACT_NAME_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_int   (hStmt, BODY_DOWNLOAD_STATUS_IDX_IN_MAIL_TBL, mail_tbl_data->body_download_status);
+       _bind_stmt_field_data_string(hStmt, FILE_PATH_PLAIN_IDX_IN_MAIL_TBL, (char*)mail_tbl_data->file_path_plain, 0, TEXT_1_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_string(hStmt, FILE_PATH_HTML_IDX_IN_MAIL_TBL, (char*)mail_tbl_data->file_path_html, 0, TEXT_2_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_int   (hStmt, MAIL_SIZE_IDX_IN_MAIL_TBL, mail_tbl_data->mail_size);
+       _bind_stmt_field_data_int   (hStmt, FLAGS_SEEN_FIELD_IDX_IN_MAIL_TBL, mail_tbl_data->flags_seen_field);
+       _bind_stmt_field_data_int   (hStmt, FLAGS_DELETED_FIELD_IDX_IN_MAIL_TBL, mail_tbl_data->flags_deleted_field);
+       _bind_stmt_field_data_int   (hStmt, FLAGS_FLAGGED_FIELD_IDX_IN_MAIL_TBL, mail_tbl_data->flags_flagged_field);
+       _bind_stmt_field_data_int   (hStmt, FLAGS_ANSWERED_FIELD_IDX_IN_MAIL_TBL, mail_tbl_data->flags_answered_field);
+       _bind_stmt_field_data_int   (hStmt, FLAGS_RECENT_FIELD_IDX_IN_MAIL_TBL, mail_tbl_data->flags_recent_field);
+       _bind_stmt_field_data_int   (hStmt, FLAGS_DRAFT_FIELD_IDX_IN_MAIL_TBL, mail_tbl_data->flags_draft_field);
+       _bind_stmt_field_data_int   (hStmt, FLAGS_FORWARDED_FIELD_IDX_IN_MAIL_TBL, mail_tbl_data->flags_forwarded_field);
+       _bind_stmt_field_data_int   (hStmt, DRM_STATUS_IDX_IN_MAIL_TBL, mail_tbl_data->DRM_status);
+       _bind_stmt_field_data_int   (hStmt, PRIORITY_IDX_IN_MAIL_TBL, mail_tbl_data->priority);
+       _bind_stmt_field_data_int   (hStmt, SAVE_STATUS_IDX_IN_MAIL_TBL, mail_tbl_data->save_status);
+       _bind_stmt_field_data_int   (hStmt, LOCK_STATUS_IDX_IN_MAIL_TBL, mail_tbl_data->lock_status);
+       _bind_stmt_field_data_int   (hStmt, REPORT_STATUS_IDX_IN_MAIL_TBL, mail_tbl_data->report_status);
+       _bind_stmt_field_data_int   (hStmt, ATTACHMENT_COUNT_IDX_IN_MAIL_TBL, mail_tbl_data->attachment_count);
+       _bind_stmt_field_data_int   (hStmt, INLINE_CONTENT_COUNT_IDX_IN_MAIL_TBL, mail_tbl_data->inline_content_count);
+       _bind_stmt_field_data_int   (hStmt, THREAD_ID_IDX_IN_MAIL_TBL, mail_tbl_data->thread_id);
+       _bind_stmt_field_data_int   (hStmt, THREAD_ITEM_COUNT_IDX_IN_MAIL_TBL, mail_tbl_data->thread_item_count);
+       _bind_stmt_field_data_string(hStmt, PREVIEW_TEXT_IDX_IN_MAIL_TBL, (char*)mail_tbl_data->preview_text, 1, PREVIEWBODY_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_int   (hStmt, MEETING_REQUEST_STATUS_IDX_IN_MAIL_TBL, mail_tbl_data->meeting_request_status);
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+       EM_DEBUG_DB_EXEC((rc == SQLITE_FULL), {error = EMF_ERROR_MAIL_MEMORY_FULL;goto FINISH_OFF; }, ("sqlite3_step fail:%d", rc));
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; }, ("sqlite3_step fail:%d", rc));
        ret = true;
        
 FINISH_OFF:
@@ -8388,50 +8379,52 @@ FINISH_OFF:
        if (hStmt != NULL)  {
                rc = sqlite3_finalize(hStmt);
                if (rc != SQLITE_OK)  {
-                       EM_DEBUG_LOG("sqlite3_finalize failed - %d", rc);
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       EM_DEBUG_LOG("sqlite3_finalize failed [%d]", rc);
+                       error = EMF_ERROR_DB_FAILURE;
                }
        }
 
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        _DISCONNECT_DB;
        
 
        if (err_code != NULL)
                *err_code = error;
 
-       EM_PROFILE_END(emStorageMailAdd);
+       EM_PROFILE_END(profile_emstorage_add_mail);
        EM_DEBUG_FUNC_END("ret [%d]", ret);
        return ret;
 }
 
-EXPORT_API int em_storage_move_multiple_mails(int account_id, char *target_mailbox_name, int mail_ids[], int number_of_mails, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_move_multiple_mails(int account_id, char *target_mailbox_name, int mail_ids[], int number_of_mails, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id [%d], target_mailbox_name [%s], mail_ids[%p], number_of_mails [%d], transaction[%d], err_code[%p]", account_id, target_mailbox_name, mail_ids, number_of_mails, transaction, err_code);
 
        int rc, ret = false, i, cur_conditional_clause = 0;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
+       int target_mailbox_id = 0;
        char sql_query_string[QUERY_SIZE] = {0, }, conditional_clause[QUERY_SIZE] = {0, };
-       emf_mailbox_tbl_t *result_mailbox = NULL;
+       emstorage_mailbox_tbl_t *result_mailbox = NULL;
        emf_mailbox_type_e target_mailbox_type = EMF_MAILBOX_TYPE_USER_DEFINED;
 
        if (!mail_ids || !target_mailbox_name) {
-               EM_DEBUG_EXCEPTION("EM_STORAGE_ERROR_INVALID_PARAM");
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }               
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
 
-       if(!em_storage_get_mailbox_by_name(account_id, -1, target_mailbox_name, &result_mailbox, true, &error)) {
-               EM_DEBUG_EXCEPTION("em_storage_get_mailbox_by_name failed [%d]", error);
+       if(!emstorage_get_mailbox_by_name(account_id, -1, target_mailbox_name, &result_mailbox, true, &error)) {
+               EM_DEBUG_EXCEPTION("emstorage_get_mailbox_by_name failed [%d]", error);
                goto FINISH_OFF;
        }
 
        if(result_mailbox) {
                target_mailbox_type = result_mailbox->mailbox_type;
-               em_storage_free_mailbox(&result_mailbox, 1, NULL);
+               target_mailbox_id   = result_mailbox->mailbox_id;
+               emstorage_free_mailbox(&result_mailbox, 1, NULL);
        }
        
        cur_conditional_clause = SNPRINTF(conditional_clause, QUERY_SIZE, "WHERE mail_id in (");
@@ -8441,15 +8434,15 @@ EXPORT_API int em_storage_move_multiple_mails(int account_id, char *target_mailb
 
        conditional_clause[strlen(conditional_clause) - 1] = ')';
 
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
 
        /* Updating a mail_tbl */
 
        memset(sql_query_string, 0x00, QUERY_SIZE);
-       SNPRINTF(sql_query_string, QUERY_SIZE, "UPDATE mail_tbl SET mailbox_name = '%s', mailbox_type = %d %s", target_mailbox_name, target_mailbox_type, conditional_clause);
+       SNPRINTF(sql_query_string, QUERY_SIZE, "UPDATE mail_tbl SET mailbox_name = '%s', mailbox_type = %d, mailbox_id = %d %s", target_mailbox_name, target_mailbox_type, target_mailbox_id, conditional_clause);
        EM_DEBUG_LOG("Query [%s]", sql_query_string);
 
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
        EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {goto FINISH_OFF; },
                ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
@@ -8459,7 +8452,7 @@ EXPORT_API int em_storage_move_multiple_mails(int account_id, char *target_mailb
        SNPRINTF(sql_query_string, QUERY_SIZE, "UPDATE mail_attachment_tbl SET mailbox_name = '%s' %s", target_mailbox_name, conditional_clause);
        EM_DEBUG_LOG("Query [%s]", sql_query_string);
 
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
        EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {goto FINISH_OFF; },
                ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
@@ -8468,7 +8461,7 @@ EXPORT_API int em_storage_move_multiple_mails(int account_id, char *target_mailb
        SNPRINTF(sql_query_string, QUERY_SIZE, "UPDATE mail_meeting_tbl SET mailbox_name = '%s' %s", target_mailbox_name, conditional_clause);
        EM_DEBUG_LOG("Query [%s]", sql_query_string);
 
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
        EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {goto FINISH_OFF; },
                ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
@@ -8485,14 +8478,14 @@ EXPORT_API int em_storage_move_multiple_mails(int account_id, char *target_mailb
        SNPRINTF(sql_query_string, QUERY_SIZE, "UPDATE mail_read_mail_uid_tbl SET mailbox_name = '%s', local_mbox = '%s' %s", target_mailbox_name, target_mailbox_name, conditional_clause);
        EM_DEBUG_LOG("Query [%s]", sql_query_string);
 
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
        EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {goto FINISH_OFF; },
                ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        ret = true;
        
 FINISH_OFF:
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -8502,23 +8495,23 @@ FINISH_OFF:
        return ret;
 }
                
-EXPORT_API int em_storage_delete_mail(int mail_id, int from_server, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_delete_mail(int mail_id, int from_server, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("mail_id[%d], transaction[%d], err_code[%p]", mail_id, transaction, err_code);
 
        if (!mail_id)  {
                EM_DEBUG_EXCEPTION("mail_id[%d]", mail_id);
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }               
        
        int rc, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        char sql_query_string[QUERY_SIZE] = {0, };
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
        
        memset(sql_query_string, 0x00, sizeof(sql_query_string));
        
@@ -8526,14 +8519,14 @@ EXPORT_API int em_storage_delete_mail(int mail_id, int from_server, int transact
        EM_DEBUG_LOG("Query [%s]", sql_query_string);
  
 
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
        EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {goto FINISH_OFF; },
                ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
        
        ret = true;
        
 FINISH_OFF:
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -8543,23 +8536,23 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_delete_multiple_mails(int mail_ids[], int number_of_mails, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_delete_multiple_mails(int mail_ids[], int number_of_mails, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("mail_ids[%p], number_of_mails [%d], transaction[%d], err_code[%p]", mail_ids, number_of_mails, transaction, err_code);
 
        int rc, ret = false, i, cur_sql_query_string = 0;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        char sql_query_string[QUERY_SIZE] = {0, };
 
        if (!mail_ids) {
-               EM_DEBUG_EXCEPTION("EM_STORAGE_ERROR_INVALID_PARAM");
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }               
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
        
        cur_sql_query_string = SNPRINTF(sql_query_string, sizeof(sql_query_string), "DELETE FROM mail_tbl WHERE mail_id in (");
        
@@ -8570,14 +8563,14 @@ EXPORT_API int em_storage_delete_multiple_mails(int mail_ids[], int number_of_ma
        
        EM_DEBUG_LOG("Query [%s]", sql_query_string);
 
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
        EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {goto FINISH_OFF; },
                ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
        
        ret = true;
        
 FINISH_OFF:
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -8587,7 +8580,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_delete_mail_by_account(int account_id, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_delete_mail_by_account(int account_id, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], transaction[%d], err_code[%p]", account_id, transaction, err_code);
        
@@ -8595,52 +8588,52 @@ EXPORT_API int em_storage_delete_mail_by_account(int account_id, int transaction
                EM_DEBUG_EXCEPTION("account_id[%d]", account_id);
                
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
 
        int rc, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        char sql_query_string[QUERY_SIZE] = {0, };
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
        
        SNPRINTF(sql_query_string, sizeof(sql_query_string), "DELETE FROM mail_tbl WHERE account_id = %d", account_id);
        EM_DEBUG_LOG("Query [%s]", sql_query_string);
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        rc = sqlite3_changes(local_db_handle);
        if (rc == 0)  {
                EM_DEBUG_EXCEPTION(" no mail found...");
-               error = EM_STORAGE_ERROR_MAIL_NOT_FOUND;
+               error = EMF_ERROR_MAIL_NOT_FOUND;
        }
  
        /* Delete all mails  mail_read_mail_uid_tbl table based on account id */
        SNPRINTF(sql_query_string, sizeof(sql_query_string), "DELETE FROM mail_read_mail_uid_tbl WHERE account_id = %d", account_id);
        EM_DEBUG_LOG("Query [%s]", sql_query_string);
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        rc = sqlite3_changes(local_db_handle);
        if (rc == 0)  {
                EM_DEBUG_EXCEPTION("no mail found...");
-               error = EM_STORAGE_ERROR_MAIL_NOT_FOUND;
+               error = EMF_ERROR_MAIL_NOT_FOUND;
        }
 
-       if (!em_storage_notify_storage_event(NOTI_MAIL_DELETE_WITH_ACCOUNT, account_id, 0 , NULL, 0))
-               EM_DEBUG_EXCEPTION(" em_storage_notify_storage_event Failed [ NOTI_MAIL_DELETE_ALL ]");
+       if (!emstorage_notify_storage_event(NOTI_MAIL_DELETE_WITH_ACCOUNT, account_id, 0 , NULL, 0))
+               EM_DEBUG_EXCEPTION(" emstorage_notify_storage_event Failed [ NOTI_MAIL_DELETE_ALL ]");
        
        ret = true;
        
 FINISH_OFF:
 
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -8650,30 +8643,30 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_delete_mail_by_mailbox(int account_id, char *mbox, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_delete_mail_by_mailbox(int account_id, char *mbox, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], mbox[%p], transaction[%d], err_code[%p]", account_id, mbox, transaction, err_code);
        
        if (account_id < FIRST_ACCOUNT_ID || !mbox)  {
                EM_DEBUG_EXCEPTION(" account_id[%d], mbox[%p]", account_id, mbox);
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
 
        int rc, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        char sql_query_string[QUERY_SIZE] = {0, };
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
 
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
        
        SNPRINTF(sql_query_string, sizeof(sql_query_string), "DELETE FROM mail_tbl WHERE account_id = %d AND mailbox_name = '%s'", account_id, mbox);
        EM_DEBUG_LOG("Query [%s]", sql_query_string);
 
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
                
 
@@ -8681,17 +8674,17 @@ EXPORT_API int em_storage_delete_mail_by_mailbox(int account_id, char *mbox, int
        SNPRINTF(sql_query_string, sizeof(sql_query_string), "DELETE FROM mail_read_mail_uid_tbl WHERE account_id = %d AND mailbox_name = '%s'", account_id, mbox);
        EM_DEBUG_LOG("Query [%s]", sql_query_string);
 
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
        
-       if (!em_storage_notify_storage_event(NOTI_MAIL_DELETE_ALL, account_id, 0 , mbox, 0))
-               EM_DEBUG_EXCEPTION(" em_storage_notify_storage_event Failed [ NOTI_MAIL_DELETE_ALL ] >>>> ");
+       if (!emstorage_notify_storage_event(NOTI_MAIL_DELETE_ALL, account_id, 0 , mbox, 0))
+               EM_DEBUG_EXCEPTION(" emstorage_notify_storage_event Failed [ NOTI_MAIL_DELETE_ALL ] >>>> ");
        
        ret = true;
        
 FINISH_OFF:
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -8701,7 +8694,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_free_mail(emf_mail_tbl_t** mail_list, int count, int *err_code)
+INTERNAL_FUNC int emstorage_free_mail(emstorage_mail_tbl_t** mail_list, int count, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("mail_list[%p], count[%d], err_code[%p]", mail_list, count, err_code);
        
@@ -8710,11 +8703,11 @@ EXPORT_API int em_storage_free_mail(emf_mail_tbl_t** mail_list, int count, int *
                        EM_DEBUG_EXCEPTION("mail_ilst[%p], count[%d]", mail_list, count);
                        
                        if (err_code)
-                               *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                               *err_code = EMF_ERROR_INVALID_PARAM;
                        return false;
                }
 
-               emf_mail_tbl_t* p = *mail_list;
+               emstorage_mail_tbl_t* p = *mail_list;
                int i = 0;
 
                for (; i < count; i++, p++) {
@@ -8730,7 +8723,6 @@ EXPORT_API int em_storage_free_mail(emf_mail_tbl_t** mail_list, int count, int *
                        EM_SAFE_FREE(p->subject);
                        EM_SAFE_FREE(p->file_path_plain);
                        EM_SAFE_FREE(p->file_path_html);
-                       EM_SAFE_FREE(p->datetime);
                        EM_SAFE_FREE(p->message_id);
                        EM_SAFE_FREE(p->email_address_sender);
                        EM_SAFE_FREE(p->email_address_recipient);
@@ -8742,36 +8734,36 @@ EXPORT_API int em_storage_free_mail(emf_mail_tbl_t** mail_list, int count, int *
        }
        
        if (err_code != NULL)
-               *err_code = EM_STORAGE_ERROR_NONE;
+               *err_code = EMF_ERROR_NONE;
 
        EM_DEBUG_FUNC_END();
        return true;
 }
 
-EXPORT_API int em_storage_get_attachment_count(int mail_id, int *count, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_get_attachment_count(int mail_id, int *count, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("mail_id[%d], count[%p], transaction[%d], err_code[%p]", mail_id, count, transaction, err_code);
        
        if (mail_id <= 0 || !count)  {
                EM_DEBUG_EXCEPTION("mail_id[%d], count[%p]", mail_id, count);
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
        int rc = -1, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        char sql_query_string[QUERY_SIZE] = {0, };
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_READ_TRANSACTION(transaction);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_READ_TRANSACTION(transaction);
        
        SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT COUNT(*) FROM mail_attachment_tbl WHERE mail_id = %d", mail_id);
 
        char **result;
-       /*  rc = sqlite3_get_table(local_db_handle, sql_query_string, &result, NULL, NULL, NULL); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        *count = atoi(result[1]);
@@ -8781,7 +8773,7 @@ EXPORT_API int em_storage_get_attachment_count(int mail_id, int *count, int tran
        
 FINISH_OFF:
  
-       EM_STORAGE_FINISH_READ_TRANSACTION(transaction);
+       EMSTORAGE_FINISH_READ_TRANSACTION(transaction);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -8791,93 +8783,94 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_get_attachment_list(int input_mail_id, int input_transaction, emf_mail_attachment_tbl_t** output_attachment_list, int *output_attachment_count)
+INTERNAL_FUNC int emstorage_get_attachment_list(int input_mail_id, int input_transaction, emstorage_attachment_tbl_t** output_attachment_list, int *output_attachment_count)
 {
        EM_DEBUG_FUNC_BEGIN("input_mail_id[%d], input_transaction[%d], output_attachment_list[%p], output_attachment_count[%p]", input_mail_id, output_attachment_list, input_transaction, output_attachment_count);
        
        if (input_mail_id <= 0 || !output_attachment_list || !output_attachment_count)  {
-               EM_DEBUG_EXCEPTION("EM_STORAGE_ERROR_INVALID_PARAM");
-               return EM_STORAGE_ERROR_INVALID_PARAM;
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
+               return EMF_ERROR_INVALID_PARAM;
        }
        
-       int error = EM_STORAGE_ERROR_NONE;
+       int                         error = EMF_ERROR_NONE;
        int                         i = 0;
        int                         rc = -1;
        char                      **result = NULL;
        char                        sql_query_string[QUERY_SIZE] = {0, };
-       emf_mail_attachment_tbl_t* p_data_tbl = NULL;
+       emstorage_attachment_tbl_t* p_data_tbl = NULL;
        DB_STMT hStmt = NULL;
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
        
-       EM_STORAGE_START_READ_TRANSACTION(input_transaction);
+       EMSTORAGE_START_READ_TRANSACTION(input_transaction);
        SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT COUNT(*) FROM mail_attachment_tbl WHERE mail_id = %d", input_mail_id);
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        *output_attachment_count = atoi(result[1]);
        sqlite3_free_table(result);
        
        if(*output_attachment_count == 0) {
-               error = EM_STORAGE_ERROR_NONE;
+               error = EMF_ERROR_NONE;
                goto FINISH_OFF;
        }
        
-       p_data_tbl = (emf_mail_attachment_tbl_t*)em_core_malloc(sizeof(emf_mail_attachment_tbl_t) * (*output_attachment_count));
+       p_data_tbl = (emstorage_attachment_tbl_t*)em_malloc(sizeof(emstorage_attachment_tbl_t) * (*output_attachment_count));
        
        if (!p_data_tbl)  {
-               EM_DEBUG_EXCEPTION("em_core_malloc failed...");
-               error = EM_STORAGE_ERROR_OUT_OF_MEMORY;
+               EM_DEBUG_EXCEPTION("em_malloc failed...");
+               error = EMF_ERROR_OUT_OF_MEMORY;
                goto FINISH_OFF;
        }
        
        SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT * FROM mail_attachment_tbl WHERE mail_id = %d ORDER BY attachment_id", input_mail_id);
        EM_DEBUG_LOG("sql_query_string [%s]", sql_query_string);
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; }, ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; }, ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },      ("sqlite3_step fail:%d", rc));
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },     ("sqlite3_step fail:%d", rc));
 
        if (rc == SQLITE_DONE)  {
                EM_DEBUG_EXCEPTION("no matched attachment found...");
-               error = EM_STORAGE_ERROR_ATTACHMENT_NOT_FOUND;
+               error = EMF_ERROR_ATTACHMENT_NOT_FOUND;
                goto FINISH_OFF;
        }
        for (i = 0; i < *output_attachment_count; i++)  {
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].attachment_id), ATTACHMENT_ID_IDX_IN_MAIL_ATTACHMENT_TBL);
-               _getStmtFieldDataString(hStmt, &(p_data_tbl[i].attachment_name), 0, ATTACHMENT_NAME_IDX_IN_MAIL_ATTACHMENT_TBL);
-               _getStmtFieldDataString(hStmt, &(p_data_tbl[i].attachment_path), 0, ATTACHMENT_PATH_IDX_IN_MAIL_ATTACHMENT_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].attachment_size), ATTACHMENT_SIZE_IDX_IN_MAIL_ATTACHMENT_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].mail_id), MAIL_ID_IDX_IN_MAIL_ATTACHMENT_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].account_id), ACCOUNT_ID_IDX_IN_MAIL_ATTACHMENT_TBL);
-               _getStmtFieldDataString(hStmt, &(p_data_tbl[i].mailbox_name), 0, MAILBOX_NAME_IDX_IN_MAIL_ATTACHMENT_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].file_yn), FILE_YN_IDX_IN_MAIL_ATTACHMENT_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].flag1), FLAG1_IDX_IN_MAIL_ATTACHMENT_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].flag2), FLAG2_IDX_IN_MAIL_ATTACHMENT_TBL);
-               _getStmtFieldDataInt(hStmt, &(p_data_tbl[i].flag3), FLAG3_IDX_IN_MAIL_ATTACHMENT_TBL);
+               _get_stmt_field_data_int   (hStmt, &(p_data_tbl[i].attachment_id), ATTACHMENT_ID_IDX_IN_MAIL_ATTACHMENT_TBL);
+               _get_stmt_field_data_string(hStmt, &(p_data_tbl[i].attachment_name), 0, ATTACHMENT_NAME_IDX_IN_MAIL_ATTACHMENT_TBL);
+               _get_stmt_field_data_string(hStmt, &(p_data_tbl[i].attachment_path), 0, ATTACHMENT_PATH_IDX_IN_MAIL_ATTACHMENT_TBL);
+               _get_stmt_field_data_int   (hStmt, &(p_data_tbl[i].attachment_size), ATTACHMENT_SIZE_IDX_IN_MAIL_ATTACHMENT_TBL);
+               _get_stmt_field_data_int   (hStmt, &(p_data_tbl[i].mail_id), MAIL_ID_IDX_IN_MAIL_ATTACHMENT_TBL);
+               _get_stmt_field_data_int   (hStmt, &(p_data_tbl[i].account_id), ACCOUNT_ID_IDX_IN_MAIL_ATTACHMENT_TBL);
+               _get_stmt_field_data_string(hStmt, &(p_data_tbl[i].mailbox_name), 0, MAILBOX_NAME_IDX_IN_MAIL_ATTACHMENT_TBL);
+               _get_stmt_field_data_int   (hStmt, &(p_data_tbl[i].attachment_save_status), ATTACHMENT_SAVE_STATUS_IDX_IN_MAIL_ATTACHMENT_TBL);
+               _get_stmt_field_data_int   (hStmt, &(p_data_tbl[i].attachment_drm_type), ATTACHMENT_DRM_TYPE_IDX_IN_MAIL_ATTACHMENT_TBL);
+               _get_stmt_field_data_int   (hStmt, &(p_data_tbl[i].attachment_drm_method), ATTACHMENT_DRM_METHOD_IDX_IN_MAIL_ATTACHMENT_TBL);
+               _get_stmt_field_data_int   (hStmt, &(p_data_tbl[i].attachment_inline_content_status), ATTACHMENT_INLINE_CONTENT_STATUS_IDX_IN_MAIL_ATTACHMENT_TBL);
+               _get_stmt_field_data_string(hStmt, &(p_data_tbl[i].attachment_mime_type), 0, ATTACHMENT_MIME_TYPE_IDX_IN_MAIL_ATTACHMENT_TBL);
                
                EM_DEBUG_LOG("attachment[%d].attachment_id : %d", i, p_data_tbl[i].attachment_id);
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-               EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; }, ("sqlite3_step fail:%d", rc));
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+               EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; }, ("sqlite3_step fail:%d", rc));
        }
        
 FINISH_OFF:
 
-       if (error == EM_STORAGE_ERROR_NONE)
+       if (error == EMF_ERROR_NONE)
                *output_attachment_list = p_data_tbl;
        else if (p_data_tbl != NULL)
-               em_storage_free_attachment(&p_data_tbl, *output_attachment_count, NULL);
+               emstorage_free_attachment(&p_data_tbl, *output_attachment_count, NULL);
 
        rc = sqlite3_finalize(hStmt);
        
        if (rc != SQLITE_OK)  {
                EM_DEBUG_EXCEPTION("sqlite3_finalize failed [%d]", rc);
-               error = EM_STORAGE_ERROR_DB_FAILURE;
+               error = EMF_ERROR_DB_FAILURE;
        }
        
-       EM_STORAGE_FINISH_READ_TRANSACTION(input_transaction);
+       EMSTORAGE_FINISH_READ_TRANSACTION(input_transaction);
        
        _DISCONNECT_DB;
 
@@ -8885,74 +8878,68 @@ FINISH_OFF:
        return error;
 }
 
-EXPORT_API int em_storage_get_attachment(int mail_id, int attachment_id, emf_mail_attachment_tbl_t** attachment, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_get_attachment(int mail_id, int attachment_id, emstorage_attachment_tbl_t** attachment, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("mail_id[%d], attachment_id[%d], attachment[%p], transaction[%d], err_code[%p]", mail_id, attachment_id, attachment, transaction, err_code);
        
        if (mail_id <= 0 || attachment_id <= 0 || !attachment)  {
                EM_DEBUG_EXCEPTION("mail_id[%d], attachment_id[%d], attachment[%p]", mail_id, attachment_id, attachment);
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
 
-       emf_mail_attachment_tbl_t* p_data_tbl = NULL;
-       char *p = NULL;
+       emstorage_attachment_tbl_t* p_data_tbl = NULL;
        int rc, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        char sql_query_string[QUERY_SIZE] = {0, };
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_READ_TRANSACTION(transaction);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_READ_TRANSACTION(transaction);
        
        SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT * FROM mail_attachment_tbl WHERE mail_id = %d AND attachment_id = %d", mail_id, attachment_id);
 
        sqlite3_stmt* hStmt = NULL;
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
        EM_DEBUG_LOG(" before sqlite3_prepare hStmt = %p", hStmt);
        
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
        
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
 
        if (rc == SQLITE_DONE)  {
                EM_DEBUG_EXCEPTION("no matched attachment found...");
-               error = EM_STORAGE_ERROR_ATTACHMENT_NOT_FOUND;
+               error = EMF_ERROR_ATTACHMENT_NOT_FOUND;
                goto FINISH_OFF;
        }
 
-       if (!(p_data_tbl = (emf_mail_attachment_tbl_t*)malloc(sizeof(emf_mail_attachment_tbl_t) * 1)))  {
+       if (!(p_data_tbl = (emstorage_attachment_tbl_t*)em_malloc(sizeof(emstorage_attachment_tbl_t) * 1)))  {
                EM_DEBUG_EXCEPTION("malloc failed...");
-               error = EM_STORAGE_ERROR_OUT_OF_MEMORY;
+               error = EMF_ERROR_OUT_OF_MEMORY;
                goto FINISH_OFF;
        }
-       
-       memset(p_data_tbl, 0x00, sizeof(emf_mail_attachment_tbl_t) * 1);
 
-       p_data_tbl->attachment_id = sqlite3_column_int(hStmt, ATTACHMENT_ID_IDX_IN_MAIL_ATTACHMENT_TBL);
-       if ((p = (char *)sqlite3_column_text(hStmt, ATTACHMENT_NAME_IDX_IN_MAIL_ATTACHMENT_TBL)) && (int)strlen(p))
-               p_data_tbl->attachment_name = cpy_str(p);
-       if ((p = (char *)sqlite3_column_text(hStmt, ATTACHMENT_PATH_IDX_IN_MAIL_ATTACHMENT_TBL)) && (int)strlen(p))
-               p_data_tbl->attachment_path = cpy_str(p);
-       p_data_tbl->attachment_size = sqlite3_column_int(hStmt, ATTACHMENT_SIZE_IDX_IN_MAIL_ATTACHMENT_TBL);
-       p_data_tbl->mail_id = sqlite3_column_int(hStmt, MAIL_ID_IDX_IN_MAIL_ATTACHMENT_TBL);
-       p_data_tbl->account_id = sqlite3_column_int(hStmt, ACCOUNT_ID_IDX_IN_MAIL_ATTACHMENT_TBL);
-       if ((p = (char *)sqlite3_column_text(hStmt, MAILBOX_NAME_IDX_IN_MAIL_ATTACHMENT_TBL)) && (int)strlen(p))
-               p_data_tbl->mailbox_name = cpy_str(p);
-       p_data_tbl->file_yn = sqlite3_column_int(hStmt, FILE_YN_IDX_IN_MAIL_ATTACHMENT_TBL);
-       p_data_tbl->flag1 = sqlite3_column_int(hStmt, FLAG1_IDX_IN_MAIL_ATTACHMENT_TBL);
-       p_data_tbl->flag2 = sqlite3_column_int(hStmt, FLAG2_IDX_IN_MAIL_ATTACHMENT_TBL);
-       p_data_tbl->flag3 = sqlite3_column_int(hStmt, FLAG3_IDX_IN_MAIL_ATTACHMENT_TBL);
+       _get_stmt_field_data_int(hStmt, &(p_data_tbl->attachment_id), ATTACHMENT_ID_IDX_IN_MAIL_ATTACHMENT_TBL);
+       _get_stmt_field_data_string(hStmt, &(p_data_tbl->attachment_name), 0, ATTACHMENT_NAME_IDX_IN_MAIL_ATTACHMENT_TBL);
+       _get_stmt_field_data_string(hStmt, &(p_data_tbl->attachment_path), 0, ATTACHMENT_PATH_IDX_IN_MAIL_ATTACHMENT_TBL);
+       _get_stmt_field_data_int(hStmt, &(p_data_tbl->attachment_size), ATTACHMENT_SIZE_IDX_IN_MAIL_ATTACHMENT_TBL);
+       _get_stmt_field_data_int(hStmt, &(p_data_tbl->mail_id), MAIL_ID_IDX_IN_MAIL_ATTACHMENT_TBL);
+       _get_stmt_field_data_int(hStmt, &(p_data_tbl->account_id), ACCOUNT_ID_IDX_IN_MAIL_ATTACHMENT_TBL);
+       _get_stmt_field_data_string(hStmt, &(p_data_tbl->mailbox_name), 0, MAILBOX_NAME_IDX_IN_MAIL_ATTACHMENT_TBL);
+       _get_stmt_field_data_int(hStmt, &(p_data_tbl->attachment_save_status), ATTACHMENT_SAVE_STATUS_IDX_IN_MAIL_ATTACHMENT_TBL);
+       _get_stmt_field_data_int(hStmt, &(p_data_tbl->attachment_drm_type), ATTACHMENT_DRM_TYPE_IDX_IN_MAIL_ATTACHMENT_TBL);
+       _get_stmt_field_data_int(hStmt, &(p_data_tbl->attachment_drm_method), ATTACHMENT_DRM_METHOD_IDX_IN_MAIL_ATTACHMENT_TBL);
+       _get_stmt_field_data_int(hStmt, &(p_data_tbl->attachment_inline_content_status), ATTACHMENT_INLINE_CONTENT_STATUS_IDX_IN_MAIL_ATTACHMENT_TBL);
+       _get_stmt_field_data_string(hStmt, &(p_data_tbl->attachment_mime_type), 0, ATTACHMENT_MIME_TYPE_IDX_IN_MAIL_ATTACHMENT_TBL);
 
 #ifdef __ATTACHMENT_OPTI__
-               p_data_tbl->encoding = sqlite3_column_int(hStmt, ENCODING_IDX_IN_MAIL_ATTACHMENT_TBL);
-               if ((p = (char *)sqlite3_column_text(hStmt, SECTION_IDX_IN_MAIL_ATTACHMENT_TBL)) && (int)strlen(p))
-                       p_data_tbl->section= cpy_str(p);
+               _get_stmt_field_data_int(hStmt, &(p_data_tbl->encoding), ENCODING_IDX_IN_MAIL_ATTACHMENT_TBL);
+               _get_stmt_field_data_string(hStmt, &(p_data_tbl->section), 0, SECTION_IDX_IN_MAIL_ATTACHMENT_TBL);
 #endif 
  
        ret = true;
@@ -8967,11 +8954,11 @@ FINISH_OFF:
                rc = sqlite3_finalize(hStmt);
                if (rc != SQLITE_OK)  {
                        EM_DEBUG_EXCEPTION("sqlite3_finalize failed - %d", rc);
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
        }
 
-       EM_STORAGE_FINISH_READ_TRANSACTION(transaction);
+       EMSTORAGE_FINISH_READ_TRANSACTION(transaction);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -8981,7 +8968,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_get_attachment_nth(int mail_id, int nth, emf_mail_attachment_tbl_t** attachment_tbl, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_get_attachment_nth(int mail_id, int nth, emstorage_attachment_tbl_t** attachment_tbl, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("mail_id[%d], nth[%d], attachment_tbl[%p], transaction[%d], err_code[%p]", mail_id, nth, attachment_tbl, transaction, err_code);
 
@@ -8989,46 +8976,44 @@ EXPORT_API int em_storage_get_attachment_nth(int mail_id, int nth, emf_mail_atta
                EM_DEBUG_EXCEPTION(" mail_id[%d], nth[%d], attachment[%p]", mail_id, nth, attachment_tbl);
                
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
-       emf_mail_attachment_tbl_t* p_data_tbl = NULL;
+       emstorage_attachment_tbl_t* p_data_tbl = NULL;
        char *p = NULL;
        int rc, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        char sql_query_string[QUERY_SIZE] = {0, };
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_READ_TRANSACTION(transaction);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_READ_TRANSACTION(transaction);
        
        SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT * FROM mail_attachment_tbl WHERE mail_id = %d ORDER BY attachment_id LIMIT %d, 1", mail_id, (nth - 1));
        EM_DEBUG_LOG("query = [%s]", sql_query_string);
        
        DB_STMT hStmt = NULL;
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
 
        if (rc == SQLITE_DONE)  {
                EM_DEBUG_EXCEPTION(" no matched attachment found...");
-               error = EM_STORAGE_ERROR_ATTACHMENT_NOT_FOUND;
+               error = EMF_ERROR_ATTACHMENT_NOT_FOUND;
                goto FINISH_OFF;
        }
        
-       if (!(p_data_tbl = (emf_mail_attachment_tbl_t*)malloc(sizeof(emf_mail_attachment_tbl_t) * 1)))  {
+       if (!(p_data_tbl = (emstorage_attachment_tbl_t*)em_malloc(sizeof(emstorage_attachment_tbl_t) * 1)))  {
                EM_DEBUG_EXCEPTION(" malloc failed...");
-               error = EM_STORAGE_ERROR_OUT_OF_MEMORY;
+               error = EMF_ERROR_OUT_OF_MEMORY;
                goto FINISH_OFF;
        }
-       
-       memset(p_data_tbl, 0x00, sizeof(emf_mail_attachment_tbl_t) * 1);
 
        p_data_tbl->attachment_id = sqlite3_column_int(hStmt, ATTACHMENT_ID_IDX_IN_MAIL_ATTACHMENT_TBL);
        if ((p = (char *)sqlite3_column_text(hStmt, ATTACHMENT_NAME_IDX_IN_MAIL_ATTACHMENT_TBL)) && (int)strlen(p))
@@ -9040,11 +9025,12 @@ EXPORT_API int em_storage_get_attachment_nth(int mail_id, int nth, emf_mail_atta
        p_data_tbl->account_id = sqlite3_column_int(hStmt, ACCOUNT_ID_IDX_IN_MAIL_ATTACHMENT_TBL);
        if ((p = (char *)sqlite3_column_text(hStmt, MAILBOX_NAME_IDX_IN_MAIL_ATTACHMENT_TBL)) && (int)strlen(p))
                p_data_tbl->mailbox_name = cpy_str(p);
-       p_data_tbl->file_yn = sqlite3_column_int(hStmt, FILE_YN_IDX_IN_MAIL_ATTACHMENT_TBL);
-       p_data_tbl->flag1 = sqlite3_column_int(hStmt, FLAG1_IDX_IN_MAIL_ATTACHMENT_TBL);
-       p_data_tbl->flag2 = sqlite3_column_int(hStmt, FLAG2_IDX_IN_MAIL_ATTACHMENT_TBL);
-       p_data_tbl->flag3 = sqlite3_column_int(hStmt, FLAG3_IDX_IN_MAIL_ATTACHMENT_TBL);
-       
+       p_data_tbl->attachment_save_status = sqlite3_column_int(hStmt, ATTACHMENT_SAVE_STATUS_IDX_IN_MAIL_ATTACHMENT_TBL);
+       p_data_tbl->attachment_drm_type = sqlite3_column_int(hStmt, ATTACHMENT_DRM_TYPE_IDX_IN_MAIL_ATTACHMENT_TBL);
+       p_data_tbl->attachment_drm_method = sqlite3_column_int(hStmt, ATTACHMENT_DRM_METHOD_IDX_IN_MAIL_ATTACHMENT_TBL);
+       p_data_tbl->attachment_inline_content_status = sqlite3_column_int(hStmt, ATTACHMENT_INLINE_CONTENT_STATUS_IDX_IN_MAIL_ATTACHMENT_TBL);
+       if ((p = (char *)sqlite3_column_text(hStmt, ATTACHMENT_MIME_TYPE_IDX_IN_MAIL_ATTACHMENT_TBL)) && (int)strlen(p))
+               p_data_tbl->attachment_mime_type = cpy_str(p);
 #ifdef __ATTACHMENT_OPTI__
                p_data_tbl->encoding = sqlite3_column_int(hStmt, ENCODING_IDX_IN_MAIL_ATTACHMENT_TBL);
                if ((p = (char *)sqlite3_column_text(hStmt, SECTION_IDX_IN_MAIL_ATTACHMENT_TBL)) && (int)strlen(p))
@@ -9056,7 +9042,7 @@ FINISH_OFF:
        if (ret == true)
                *attachment_tbl = p_data_tbl;
        else if (p_data_tbl != NULL)
-               em_storage_free_attachment(&p_data_tbl, 1, NULL);
+               emstorage_free_attachment(&p_data_tbl, 1, NULL);
 
        if (hStmt != NULL)  {
                EM_DEBUG_LOG("before sqlite3_finalize hStmt = %p", hStmt);
@@ -9064,11 +9050,11 @@ FINISH_OFF:
                rc = sqlite3_finalize(hStmt);
                if (rc != SQLITE_OK)  {
                        EM_DEBUG_EXCEPTION("sqlite3_finalize failed - %d", rc);
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
        }
        
-       EM_STORAGE_FINISH_READ_TRANSACTION(transaction);
+       EMSTORAGE_FINISH_READ_TRANSACTION(transaction);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -9078,78 +9064,60 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_change_attachment_field(int mail_id, emf_mail_change_type_t type, emf_mail_attachment_tbl_t* attachment, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_change_attachment_field(int mail_id, emf_mail_change_type_t type, emstorage_attachment_tbl_t* attachment, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("mail_id[%d], type[%d], attachment[%p], transaction[%d], err_code[%p]", mail_id, type, attachment, transaction, err_code);
        
        if (mail_id <= 0 || !attachment)  {
                EM_DEBUG_EXCEPTION(" mail_id[%d], type[%d], attachment[%p]", mail_id, type, attachment);
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;;
        }
        
        int rc, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;      
+       int error = EMF_ERROR_NONE;
        DB_STMT hStmt = NULL;
        char sql_query_string[QUERY_SIZE] = {0, };
        
        int i = 0;
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
 
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
        
        switch (type)  {
                case UPDATE_MAILBOX:
                                EM_DEBUG_LOG("UPDATE_MAILBOX");
                        if (!attachment->mailbox_name)  {
                                EM_DEBUG_EXCEPTION(" attachment->mailbox_name[%p]", attachment->mailbox_name);
-                               error = EM_STORAGE_ERROR_INVALID_PARAM;
+                               error = EMF_ERROR_INVALID_PARAM;
                                goto FINISH_OFF;
                        }
-#ifdef CONVERT_UTF8_TO_UCS2                    
-                       SNPRINTF(sql_query_string, sizeof(sql_query_string),
-                               "UPDATE mail_attachment_tbl SET mailbox_name = '%s' WHERE mail_id = %d", attachment->mailbox_name, mail_id);
-#else  /* CONVERT_UTF8_TO_UCS2 */
                        SNPRINTF(sql_query_string, sizeof(sql_query_string),
                                "UPDATE mail_attachment_tbl SET mailbox_name = ? WHERE mail_id = %d", mail_id);
  
                        
-                       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+                       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
                        EM_DEBUG_LOG(" Before sqlite3_prepare hStmt = %p", hStmt);
-                       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+                       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                        ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
-                       _bindStmtFieldDataString(hStmt, i++, (char *)attachment->mailbox_name, 0, MAILBOX_NAME_LEN_IN_MAIL_ATTACHMENT_TBL);
-#endif /* CONVERT_UTF8_TO_UCS2 */
+                       _bind_stmt_field_data_string(hStmt, i++, (char *)attachment->mailbox_name, 0, MAILBOX_NAME_LEN_IN_MAIL_ATTACHMENT_TBL);
                        break;
                        
                case UPDATE_SAVENAME:
                        EM_DEBUG_LOG("UPDATE_SAVENAME");
                        if (!attachment->attachment_path)  {
                                EM_DEBUG_EXCEPTION(" attachment->attachment_path[%p]", attachment->attachment_path);
-                               error = EM_STORAGE_ERROR_INVALID_PARAM;
+                               error = EMF_ERROR_INVALID_PARAM;
                                goto FINISH_OFF;
                        }
-                       
-#ifdef CONVERT_UTF8_TO_UCS2
-                       SNPRINTF(sql_query_string, sizeof(sql_query_string),
-                               "UPDATE mail_attachment_tbl SET"
-                               "  attachment_size = %d"
-                               ", attachment_path = '%s'"
-                               ", file_yn = 1"
-                               " WHERE mail_id = %d"
-                               " AND attachment_id = %d"
-                               , attachment->attachment_size
-                               , attachment->attachment_path
-                               , attachment->mail_id
-                               , attachment->attachment_id);
-#else  /* CONVERT_UTF8_TO_UCS2 */
+
                        SNPRINTF(sql_query_string, sizeof(sql_query_string),
                                "UPDATE mail_attachment_tbl SET"
                                "  attachment_size = ?"
-                               ", file_yn = 1"
+                               ", attachment_save_status = 1"
                                ", attachment_path = ?"
                                " WHERE mail_id = %d"
                                " AND attachment_id = %d"
@@ -9157,49 +9125,38 @@ EXPORT_API int em_storage_change_attachment_field(int mail_id, emf_mail_change_t
                                , attachment->attachment_id);
  
                        
-                       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+                       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
                        EM_DEBUG_LOG(" Before sqlite3_prepare hStmt = %p", hStmt);
-                       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+                       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                        ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
                
-                       _bindStmtFieldDataInt(hStmt, i++, attachment->attachment_size);
-                       _bindStmtFieldDataString(hStmt, i++, (char *)attachment->attachment_path, 0, ATTACHMENT_PATH_LEN_IN_MAIL_ATTACHMENT_TBL);
-#endif /* CONVERT_UTF8_TO_UCS2 */
+                       _bind_stmt_field_data_int(hStmt, i++, attachment->attachment_size);
+                       _bind_stmt_field_data_string(hStmt, i++, (char *)attachment->attachment_path, 0, ATTACHMENT_PATH_LEN_IN_MAIL_ATTACHMENT_TBL);
                        break;
                        
                default:
                        EM_DEBUG_LOG("type[%d]", type);
-                       error = EM_STORAGE_ERROR_INVALID_PARAM;
+                       error = EMF_ERROR_INVALID_PARAM;
                        goto FINISH_OFF;
        }
        EM_DEBUG_LOG("query = [%s]", sql_query_string);
 
-#ifdef CONVERT_UTF8_TO_UCS2    
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
-               ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
-#else
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
-#endif
        ret = true;
        
 FINISH_OFF:
-#ifdef CONVERT_UTF8_TO_UCS2
-#else  /*  CONVERT_UTF8_TO_UCS2 */
        if (hStmt != NULL)  {
                EM_DEBUG_LOG(" Before sqlite3_finalize hStmt = %p", hStmt);
                rc = sqlite3_finalize(hStmt);
                if (rc != SQLITE_OK)  {
                        EM_DEBUG_LOG(" sqlite3_finalize failed - %d", rc);
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
        }
-#endif /* CONVERT_UTF8_TO_UCS2 */
 
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -9209,24 +9166,24 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int em_storage_rename_mailbox(int account_id, char *old_mailbox_name, char *new_mailbox_name, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_rename_mailbox(int account_id, char *old_mailbox_name, char *new_mailbox_name, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], old_mailbox_name[%p], new_mailbox_name[%p], transaction[%d], err_code[%p]", account_id, old_mailbox_name, new_mailbox_name, transaction, err_code);
 
        if (account_id < FIRST_ACCOUNT_ID ||!old_mailbox_name || !new_mailbox_name)  {
                EM_DEBUG_EXCEPTION("Invalid Parameters");
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
        int rc, ret = true;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        char sql_query_string[QUERY_SIZE] = {0, };
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
 
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
 
        SNPRINTF(sql_query_string, sizeof(sql_query_string),
                "UPDATE mail_tbl SET"
@@ -9237,9 +9194,9 @@ EXPORT_API int em_storage_rename_mailbox(int account_id, char *old_mailbox_name,
                , account_id
                , old_mailbox_name);
 
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
 
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        if (sqlite3_changes(local_db_handle) == 0) 
@@ -9255,9 +9212,9 @@ EXPORT_API int em_storage_rename_mailbox(int account_id, char *old_mailbox_name,
                , account_id
                , old_mailbox_name);
 
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
 
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        if (sqlite3_changes(local_db_handle) == 0) 
@@ -9272,9 +9229,9 @@ EXPORT_API int em_storage_rename_mailbox(int account_id, char *old_mailbox_name,
                , account_id
                , old_mailbox_name);
 
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
 
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        if (sqlite3_changes(local_db_handle) == 0) 
@@ -9284,7 +9241,7 @@ EXPORT_API int em_storage_rename_mailbox(int account_id, char *old_mailbox_name,
        
 FINISH_OFF:
 
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -9295,7 +9252,7 @@ FINISH_OFF:
 }
        
 
-EXPORT_API int em_storage_change_attachment_mbox(int account_id, char *old_mailbox_name, char *new_mailbox_name, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_change_attachment_mbox(int account_id, char *old_mailbox_name, char *new_mailbox_name, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], old_mailbox_name[%p], new_mailbox_name[%p], transaction[%d], err_code[%p]", account_id, old_mailbox_name, new_mailbox_name, transaction, err_code);
 
@@ -9303,17 +9260,17 @@ EXPORT_API int em_storage_change_attachment_mbox(int account_id, char *old_mailb
                EM_DEBUG_EXCEPTION(" account_id[%d], old_mailbox_name[%p], new_mailbox_name[%p]", account_id, old_mailbox_name, new_mailbox_name);
                
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
        int rc, ret = true;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        char sql_query_string[QUERY_SIZE] = {0, };
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
 
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
  
        SNPRINTF(sql_query_string, sizeof(sql_query_string),
                "UPDATE mail_attachment_tbl SET"
@@ -9324,10 +9281,10 @@ EXPORT_API int em_storage_change_attachment_mbox(int account_id, char *old_mailb
                , account_id
                , old_mailbox_name);
 
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC((SQLITE_FULL == rc), {error = EM_STORAGE_ERROR_DB_IS_FULL;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC((SQLITE_FULL == rc), {error = EMF_ERROR_MAIL_MEMORY_FULL;goto FINISH_OFF; },
                ("sqlite3_exec fail:%d", rc));
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        rc = sqlite3_changes(local_db_handle);
@@ -9339,7 +9296,7 @@ EXPORT_API int em_storage_change_attachment_mbox(int account_id, char *old_mailb
        
 FINISH_OFF:
 
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -9350,27 +9307,27 @@ FINISH_OFF:
 }
 
        
-EXPORT_API int em_storage_get_new_attachment_no(int *attachment_no, int *err_code)
+INTERNAL_FUNC int emstorage_get_new_attachment_no(int *attachment_no, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("attachment_no [%p], err_code[%p]", attachment_no, err_code);
        int rc, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        char *sql = "SELECT max(rowid) FROM mail_attachment_tbl;";
        char **result;
        
        if (!attachment_no)  {
                EM_DEBUG_EXCEPTION("Invalid attachment");
-               error = EM_STORAGE_ERROR_INVALID_PARAM;
+               error = EMF_ERROR_INVALID_PARAM;
                goto FINISH_OFF;
        }
 
        *attachment_no = -1;
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
 
-       /*  rc = sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql, rc, sqlite3_errmsg(local_db_handle)));
 
        if (NULL == result[1])
@@ -9394,31 +9351,31 @@ FINISH_OFF:
        return ret;
 }
        
-EXPORT_API int em_storage_add_attachment(emf_mail_attachment_tbl_t* attachment_tbl, int iscopy, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_add_attachment(emstorage_attachment_tbl_t* attachment_tbl, int iscopy, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("attachment_tbl[%p], iscopy[%d], transaction[%d], err_code[%p]", attachment_tbl, iscopy, transaction, err_code);
 
        char *sql = NULL;
        char **result;
        int rc, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        DB_STMT hStmt = NULL;
        char sql_query_string[QUERY_SIZE] = {0, };
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
        
        if (!attachment_tbl)  {
                EM_DEBUG_EXCEPTION("attachment_tbl[%p], iscopy[%d]", attachment_tbl, iscopy);
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
  
        sql = "SELECT max(rowid) FROM mail_attachment_tbl;";
-       /*  rc = sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL);  */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql, rc, sqlite3_errmsg(local_db_handle)));
 
        if (NULL==result[1]) rc = 1;
@@ -9429,64 +9386,67 @@ EXPORT_API int em_storage_add_attachment(emf_mail_attachment_tbl_t* attachment_t
        
        SNPRINTF(sql_query_string, sizeof(sql_query_string),
                "INSERT INTO mail_attachment_tbl VALUES "
-               "( ?"   /*  attachment_id */
-               ", ?"   /*  attachment_name */
-               ", ?"   /*  attachment_path */
-               ", ?"   /*  attachment_size */
-               ", ?"   /*  mail_id */
-               ", ?"   /*  account_id */
-               ", ?"   /*  mailbox_name */
-               ", ?"   /*  file_yn */
-               ", ?"   /*  flag1 */
-               ", ?"   /*  flag2 */
+               "( ?"   /* attachment_id */
+               ", ?"   /* attachment_name */
+               ", ?"   /* attachment_path */
+               ", ?"   /* attachment_size */
+               ", ?"   /* mail_id */
+               ", ?"   /* account_id */
+               ", ?"   /* mailbox_name */
+               ", ?"   /* attachment_save_status */
+               ", ?"   /* attachment_drm_type */
+               ", ?"   /* attachment_drm_method */
+               ", ?"   /* attachment_inline_content_status */
+               ", ?"   /* attachment_mime_type */
 #ifdef __ATTACHMENT_OPTI__
                ", ?"
                ", ?"
 #endif         
-               ", ? )");/*  flag3 */
+               ")");
        
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
        
-       _bindStmtFieldDataInt(hStmt, ATTACHMENT_ID_IDX_IN_MAIL_ATTACHMENT_TBL, attachment_tbl->attachment_id);
-       _bindStmtFieldDataString(hStmt, ATTACHMENT_NAME_IDX_IN_MAIL_ATTACHMENT_TBL, (char *)attachment_tbl->attachment_name, 0, ATTACHMENT_NAME_LEN_IN_MAIL_ATTACHMENT_TBL);
-       _bindStmtFieldDataString(hStmt, ATTACHMENT_PATH_IDX_IN_MAIL_ATTACHMENT_TBL, (char *)attachment_tbl->attachment_path, 0, ATTACHMENT_PATH_LEN_IN_MAIL_ATTACHMENT_TBL);
-       _bindStmtFieldDataInt(hStmt, ATTACHMENT_SIZE_IDX_IN_MAIL_ATTACHMENT_TBL, attachment_tbl->attachment_size);
-       _bindStmtFieldDataInt(hStmt, MAIL_ID_IDX_IN_MAIL_ATTACHMENT_TBL, attachment_tbl->mail_id);
-       _bindStmtFieldDataInt(hStmt, ACCOUNT_ID_IDX_IN_MAIL_ATTACHMENT_TBL, attachment_tbl->account_id);
-       _bindStmtFieldDataString(hStmt, MAILBOX_NAME_IDX_IN_MAIL_ATTACHMENT_TBL, (char *)attachment_tbl->mailbox_name, 0, MAILBOX_NAME_LEN_IN_MAIL_ATTACHMENT_TBL);
-       _bindStmtFieldDataInt(hStmt, FILE_YN_IDX_IN_MAIL_ATTACHMENT_TBL, attachment_tbl->file_yn);
-       _bindStmtFieldDataInt(hStmt, FLAG1_IDX_IN_MAIL_ATTACHMENT_TBL, attachment_tbl->flag1);
-       _bindStmtFieldDataInt(hStmt, FLAG2_IDX_IN_MAIL_ATTACHMENT_TBL, attachment_tbl->flag2);
-       _bindStmtFieldDataInt(hStmt, FLAG3_IDX_IN_MAIL_ATTACHMENT_TBL, attachment_tbl->flag3);
+       _bind_stmt_field_data_int   (hStmt, ATTACHMENT_ID_IDX_IN_MAIL_ATTACHMENT_TBL, attachment_tbl->attachment_id);
+       _bind_stmt_field_data_string(hStmt, ATTACHMENT_NAME_IDX_IN_MAIL_ATTACHMENT_TBL, (char*)attachment_tbl->attachment_name, 0, ATTACHMENT_NAME_LEN_IN_MAIL_ATTACHMENT_TBL);
+       _bind_stmt_field_data_string(hStmt, ATTACHMENT_PATH_IDX_IN_MAIL_ATTACHMENT_TBL, (char*)attachment_tbl->attachment_path, 0, ATTACHMENT_PATH_LEN_IN_MAIL_ATTACHMENT_TBL);
+       _bind_stmt_field_data_int   (hStmt, ATTACHMENT_SIZE_IDX_IN_MAIL_ATTACHMENT_TBL, attachment_tbl->attachment_size);
+       _bind_stmt_field_data_int   (hStmt, MAIL_ID_IDX_IN_MAIL_ATTACHMENT_TBL, attachment_tbl->mail_id);
+       _bind_stmt_field_data_int   (hStmt, ACCOUNT_ID_IDX_IN_MAIL_ATTACHMENT_TBL, attachment_tbl->account_id);
+       _bind_stmt_field_data_string(hStmt, MAILBOX_NAME_IDX_IN_MAIL_ATTACHMENT_TBL, (char*)attachment_tbl->mailbox_name, 0, MAILBOX_NAME_LEN_IN_MAIL_ATTACHMENT_TBL);
+       _bind_stmt_field_data_int   (hStmt, ATTACHMENT_SAVE_STATUS_IDX_IN_MAIL_ATTACHMENT_TBL, attachment_tbl->attachment_save_status);
+       _bind_stmt_field_data_int   (hStmt, ATTACHMENT_DRM_TYPE_IDX_IN_MAIL_ATTACHMENT_TBL, attachment_tbl->attachment_drm_type);
+       _bind_stmt_field_data_int   (hStmt, ATTACHMENT_DRM_METHOD_IDX_IN_MAIL_ATTACHMENT_TBL, attachment_tbl->attachment_drm_method);
+       _bind_stmt_field_data_int   (hStmt, ATTACHMENT_INLINE_CONTENT_STATUS_IDX_IN_MAIL_ATTACHMENT_TBL, attachment_tbl->attachment_inline_content_status);
+       _bind_stmt_field_data_string(hStmt, ATTACHMENT_MIME_TYPE_IDX_IN_MAIL_ATTACHMENT_TBL, (char*)attachment_tbl->attachment_mime_type, 0, ATTACHMENT_MIME_TYPE_LEN_IN_MAIL_ATTACHMENT_TBL);
 #ifdef __ATTACHMENT_OPTI__
-       _bindStmtFieldDataInt(hStmt, ENCODING_IDX_IN_MAIL_ATTACHMENT_TBL, attachment_tbl->encoding);
-       _bindStmtFieldDataString(hStmt, SECTION_IDX_IN_MAIL_ATTACHMENT_TBL, (char *)attachment_tbl->section, 0, ATTACHMENT_LEN_IN_MAIL_ATTACHMENT_TBL);
+       _bind_stmt_field_data_int(hStmt, ENCODING_IDX_IN_MAIL_ATTACHMENT_TBL, attachment_tbl->encoding);
+       _bind_stmt_field_data_string(hStmt, SECTION_IDX_IN_MAIL_ATTACHMENT_TBL, (char*)attachment_tbl->section, 0, ATTACHMENT_LEN_IN_MAIL_ATTACHMENT_TBL);
 #endif
        
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((SQLITE_FULL == rc), {error = EM_STORAGE_ERROR_DB_IS_FULL;goto FINISH_OFF; },
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+       EM_DEBUG_DB_EXEC((SQLITE_FULL == rc), {error = EMF_ERROR_MAIL_MEMORY_FULL;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
 /*
        SNPRINTF(sql_query_string, sizeof(sql_query_string),
                "UPDATE mail_tbl SET attachment_count = 1 WHERE mail_id = %d", attachment_tbl->mail_id);
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
 
-       EM_DEBUG_DB_EXEC((SQLITE_FULL == rc), {error = EM_STORAGE_ERROR_DB_IS_FULL;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC((SQLITE_FULL == rc), {error = EMF_ERROR_MAIL_MEMORY_FULL;goto FINISH_OFF; },
                ("sqlite3_exec fail:%d", rc));
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 */
        rc = sqlite3_changes(local_db_handle);
        if (rc == 0)  {
                EM_DEBUG_EXCEPTION(" no matched mail found...");
-               error = EM_STORAGE_ERROR_MAIL_NOT_FOUND;
+               error = EMF_ERROR_MAIL_NOT_FOUND;
                goto FINISH_OFF;
        }
        
@@ -9497,11 +9457,11 @@ FINISH_OFF:
                rc = sqlite3_finalize(hStmt);
                if (rc != SQLITE_OK)  {
                        EM_DEBUG_EXCEPTION(" sqlite3_finalize failed - %d", rc);
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
        }
 
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -9511,24 +9471,24 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_update_attachment(emf_mail_attachment_tbl_t* attachment_tbl,                  int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_update_attachment(emstorage_attachment_tbl_t* attachment_tbl, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("attachment_tbl[%p], transaction[%d], err_code[%p]", attachment_tbl, transaction, err_code);
        
        int rc, ret = false, field_idx = 0;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        DB_STMT hStmt = NULL;
        char sql_query_string[QUERY_SIZE] = {0, };
 
        if (!attachment_tbl)  {
                EM_DEBUG_EXCEPTION(" attachment_tbl[%p] ", attachment_tbl);
-               error = EM_STORAGE_ERROR_INVALID_PARAM;
+               error = EMF_ERROR_INVALID_PARAM;
                goto FINISH_OFF;
        }
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
 
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
  
        SNPRINTF(sql_query_string, sizeof(sql_query_string),
                "UPDATE mail_attachment_tbl SET  "
@@ -9538,51 +9498,53 @@ EXPORT_API int em_storage_update_attachment(emf_mail_attachment_tbl_t* attachmen
                ", mail_id = ?"
                ", account_id = ?"
                ", mailbox_name = ?"
-               ", file_yn = ?"
-               ", flag1 = ?"
-               ", flag2 = ?"
-               ", flag3 = ? "
+               ", attachment_save_status = ?"
+               ", attachment_drm_type = ?"
+               ", attachment_drm_method = ?"
+               ", attachment_inline_content_status = ? "
+               ", attachment_mime_type = ? "
                " WHERE attachment_id = ?;");
        
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
 
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
-       _bindStmtFieldDataString(hStmt, field_idx++ , (char *)attachment_tbl->attachment_name, 0, ATTACHMENT_NAME_LEN_IN_MAIL_ATTACHMENT_TBL);
-       _bindStmtFieldDataString(hStmt, field_idx++ , (char *)attachment_tbl->attachment_path, 0, ATTACHMENT_PATH_LEN_IN_MAIL_ATTACHMENT_TBL);
-       _bindStmtFieldDataInt(hStmt, field_idx++ , attachment_tbl->attachment_size);
-       _bindStmtFieldDataInt(hStmt, field_idx++ , attachment_tbl->mail_id);
-       _bindStmtFieldDataInt(hStmt, field_idx++ , attachment_tbl->account_id);
-       _bindStmtFieldDataString(hStmt, field_idx++ , (char *)attachment_tbl->mailbox_name, 0, MAILBOX_NAME_LEN_IN_MAIL_ATTACHMENT_TBL);
-       _bindStmtFieldDataInt(hStmt, field_idx++ , attachment_tbl->file_yn);
-       _bindStmtFieldDataInt(hStmt, field_idx++ , attachment_tbl->flag1);
-       _bindStmtFieldDataInt(hStmt, field_idx++ , attachment_tbl->flag2);
-       _bindStmtFieldDataInt(hStmt, field_idx++ , attachment_tbl->flag3);
-       _bindStmtFieldDataInt(hStmt, field_idx++ , attachment_tbl->attachment_id);
-       
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((SQLITE_FULL == rc), {error = EM_STORAGE_ERROR_DB_IS_FULL;goto FINISH_OFF; },
+       _bind_stmt_field_data_string(hStmt, field_idx++ , (char*)attachment_tbl->attachment_name, 0, ATTACHMENT_NAME_LEN_IN_MAIL_ATTACHMENT_TBL);
+       _bind_stmt_field_data_string(hStmt, field_idx++ , (char*)attachment_tbl->attachment_path, 0, ATTACHMENT_PATH_LEN_IN_MAIL_ATTACHMENT_TBL);
+       _bind_stmt_field_data_int   (hStmt, field_idx++ , attachment_tbl->attachment_size);
+       _bind_stmt_field_data_int   (hStmt, field_idx++ , attachment_tbl->mail_id);
+       _bind_stmt_field_data_int   (hStmt, field_idx++ , attachment_tbl->account_id);
+       _bind_stmt_field_data_string(hStmt, field_idx++ , (char*)attachment_tbl->mailbox_name, 0, MAILBOX_NAME_LEN_IN_MAIL_ATTACHMENT_TBL);
+       _bind_stmt_field_data_int   (hStmt, field_idx++ , attachment_tbl->attachment_save_status);
+       _bind_stmt_field_data_int   (hStmt, field_idx++ , attachment_tbl->attachment_drm_type);
+       _bind_stmt_field_data_int   (hStmt, field_idx++ , attachment_tbl->attachment_drm_method);
+       _bind_stmt_field_data_int   (hStmt, field_idx++ , attachment_tbl->attachment_inline_content_status);
+       _bind_stmt_field_data_string(hStmt, field_idx++ , (char*)attachment_tbl->attachment_mime_type, 0, ATTACHMENT_MIME_TYPE_LEN_IN_MAIL_ATTACHMENT_TBL);
+       _bind_stmt_field_data_int   (hStmt, field_idx++ , attachment_tbl->attachment_id);
+       
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+       EM_DEBUG_DB_EXEC((SQLITE_FULL == rc), {error = EMF_ERROR_MAIL_MEMORY_FULL;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
 /* 
        SNPRINTF(sql_query_string, sizeof(sql_query_string),
                "UPDATE mail_tbl SET attachment_count = 1 WHERE mail_id = %d", attachment_tbl->mail_id);
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
 
-       EM_DEBUG_DB_EXEC((SQLITE_FULL == rc), {error = EM_STORAGE_ERROR_DB_IS_FULL;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC((SQLITE_FULL == rc), {error = EMF_ERROR_MAIL_MEMORY_FULL;goto FINISH_OFF; },
                ("sqlite3_exec fail:%d", rc));
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 */
        rc = sqlite3_changes(local_db_handle);
        if (rc == 0)  {
                EM_DEBUG_EXCEPTION(" no matched mail found...");
-               error = EM_STORAGE_ERROR_MAIL_NOT_FOUND;
+               error = EMF_ERROR_MAIL_NOT_FOUND;
                goto FINISH_OFF;
        }
        
@@ -9593,11 +9555,11 @@ FINISH_OFF:
                rc = sqlite3_finalize(hStmt);
                if (rc != SQLITE_OK)  {
                        EM_DEBUG_EXCEPTION(" sqlite3_finalize failed - %d", rc);
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
        }
 
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -9607,24 +9569,24 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_delete_attachment_on_db(int mail_id, int attachment_id, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_delete_attachment_on_db(int mail_id, int attachment_id, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("mail_id[%d], attachment_id[%d], transaction[%d], err_code[%p]", mail_id, attachment_id, transaction, err_code);
        
        if (mail_id < 0 || attachment_id < 0)  {
                EM_DEBUG_EXCEPTION("mail_id[%d], attachment_id[%d]", mail_id, attachment_id);
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
        int rc, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        char sql_query_string[QUERY_SIZE] = {0, };
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
 
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
        
        SNPRINTF(sql_query_string, sizeof(sql_query_string), "DELETE FROM mail_attachment_tbl");
        
@@ -9633,14 +9595,14 @@ EXPORT_API int em_storage_delete_attachment_on_db(int mail_id, int attachment_id
        if (attachment_id) /*  '0' means all attachment */
                SNPRINTF(sql_query_string + strlen(sql_query_string), sizeof(sql_query_string)-(strlen(sql_query_string)+1), " AND attachment_id = %d", attachment_id);
                
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        ret = true;
        
 FINISH_OFF:
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        _DISCONNECT_DB;
        
        if (err_code)
@@ -9650,17 +9612,17 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_delete_attachment_all_on_db(int account_id, char *mbox, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_delete_attachment_all_on_db(int account_id, char *mbox, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], mbox[%p], transaction[%d], err_code[%p]", account_id, mbox, transaction, err_code);
        
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        int rc, ret = false;
        char sql_query_string[QUERY_SIZE] = {0, };
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
 
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
        
        SNPRINTF(sql_query_string, sizeof(sql_query_string), "DELETE FROM mail_attachment_tbl");
        
@@ -9670,14 +9632,14 @@ EXPORT_API int em_storage_delete_attachment_all_on_db(int account_id, char *mbox
        if (mbox)       /*  NULL means all mailbox_name */
                SNPRINTF(sql_query_string + strlen(sql_query_string), sizeof(sql_query_string)-(strlen(sql_query_string)+1), " %s mailbox_name = '%s'", account_id != ALL_ACCOUNT ? "AND" : "WHERE", mbox);
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        ret = true;
        
 FINISH_OFF:
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -9687,7 +9649,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_free_attachment(emf_mail_attachment_tbl_t** attachment_tbl_list, int count, int *err_code)
+INTERNAL_FUNC int emstorage_free_attachment(emstorage_attachment_tbl_t** attachment_tbl_list, int count, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("attachment_tbl_list[%p], count[%d], err_code[%p]", attachment_tbl_list, count, err_code);
        
@@ -9695,11 +9657,11 @@ EXPORT_API int em_storage_free_attachment(emf_mail_attachment_tbl_t** attachment
                if ((attachment_tbl_list == NULL) || (*attachment_tbl_list == NULL))  {
                        EM_DEBUG_EXCEPTION(" attachment_tbl_list[%p], count[%d]", attachment_tbl_list, count);
                        if (err_code != NULL)
-                               *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                               *err_code = EMF_ERROR_INVALID_PARAM;
                        return false;
                }
                
-               emf_mail_attachment_tbl_t* p = *attachment_tbl_list;
+               emstorage_attachment_tbl_t* p = *attachment_tbl_list;
                int i;
                
                for (i = 0; i < count; i++)  {
@@ -9716,14 +9678,14 @@ EXPORT_API int em_storage_free_attachment(emf_mail_attachment_tbl_t** attachment
        }
        
        if (err_code != NULL)
-               *err_code = EM_STORAGE_ERROR_NONE;
+               *err_code = EMF_ERROR_NONE;
        EM_DEBUG_FUNC_END();
        return true;
 }
 
 
 
-EXPORT_API int em_storage_begin_transaction(void *d1, void *d2, int *err_code)
+INTERNAL_FUNC int emstorage_begin_transaction(void *d1, void *d2, int *err_code)
 {
        EM_PROFILE_BEGIN(emStorageBeginTransaction);
        int ret = true;
@@ -9741,49 +9703,49 @@ EXPORT_API int em_storage_begin_transaction(void *d1, void *d2, int *err_code)
 
        LEAVE_CRITICAL_SECTION(_transactionBeginLock);
  
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
        int rc;
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "BEGIN immediate;", NULL, NULL, NULL), rc);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "BEGIN immediate;", NULL, NULL, NULL), rc);
        EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {ret = false; },
                ("SQL(BEGIN) exec error:%d -%s", rc, sqlite3_errmsg(local_db_handle)));
        if (ret == false && err_code != NULL)
-               *err_code = EM_STORAGE_ERROR_DB_FAILURE;
+               *err_code = EMF_ERROR_DB_FAILURE;
 
        EM_PROFILE_END(emStorageBeginTransaction);
        EM_DEBUG_FUNC_END("ret [%d]", ret);
        return ret;
 }
 
-EXPORT_API int em_storage_commit_transaction(void *d1, void *d2, int *err_code)
+INTERNAL_FUNC int emstorage_commit_transaction(void *d1, void *d2, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
        int ret = true;
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
 
        ENTER_CRITICAL_SECTION(_transactionEndLock);
 
        int rc;
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "END;", NULL, NULL, NULL), rc);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "END;", NULL, NULL, NULL), rc);
        EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {ret = false; }, ("SQL(END) exec error:%d -%s", rc, sqlite3_errmsg(local_db_handle)));
        /*  release the transaction authority. */
        g_transaction = false;
 
        LEAVE_CRITICAL_SECTION(_transactionEndLock);
        if (ret == false && err_code != NULL)
-               *err_code = EM_STORAGE_ERROR_DB_FAILURE;
+               *err_code = EMF_ERROR_DB_FAILURE;
 
        EM_DEBUG_FUNC_END("ret [%d]", ret);
        return ret;
 }
 
-EXPORT_API int em_storage_rollback_transaction(void *d1, void *d2, int *err_code)
+INTERNAL_FUNC int emstorage_rollback_transaction(void *d1, void *d2, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
        int ret = true;
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
        int rc;
 
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "ROLLBACK;", NULL, NULL, NULL), rc);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, "ROLLBACK;", NULL, NULL, NULL), rc);
 
        ENTER_CRITICAL_SECTION(_transactionEndLock);
        EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {ret = false; },
@@ -9795,13 +9757,13 @@ EXPORT_API int em_storage_rollback_transaction(void *d1, void *d2, int *err_code
        LEAVE_CRITICAL_SECTION(_transactionEndLock);
 
        if (ret == false && err_code != NULL)
-               *err_code = EM_STORAGE_ERROR_DB_FAILURE;
+               *err_code = EMF_ERROR_DB_FAILURE;
 
        EM_DEBUG_FUNC_END("ret [%d]", ret);
        return ret;
 }
 
-EXPORT_API int em_storage_is_mailbox_full(int account_id, emf_mailbox_t* mailbox_name, int *result, int *err_code)
+INTERNAL_FUNC int emstorage_is_mailbox_full(int account_id, emf_mailbox_t* mailbox_name, int *result, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], mailbox_name[%p], result[%p], err_code[%p]", account_id, mailbox_name, result, err_code);
        
@@ -9810,17 +9772,17 @@ EXPORT_API int em_storage_is_mailbox_full(int account_id, emf_mailbox_t* mailbox
                        EM_DEBUG_EXCEPTION("Invalid Parameter. accoun_id[%d], mailbox_name[%p]", account_id, mailbox_name);
                
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
 
                return false;
        }
 
        int ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        int mail_count = 0;
 
-       if (!em_storage_get_mail_count(account_id, mailbox_name->name, &mail_count, NULL, true, &error)) {
-               EM_DEBUG_EXCEPTION("em_storage_get_mail_count failed [%d]", error);
+       if (!emstorage_get_mail_count(account_id, mailbox_name->name, &mail_count, NULL, true, &error)) {
+               EM_DEBUG_EXCEPTION("emstorage_get_mail_count failed [%d]", error);
                goto FINISH_OFF;
        }
        
@@ -9844,23 +9806,23 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_clear_mail_data(int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_clear_mail_data(int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("transaction[%d], err_code[%p]", transaction, err_code);
 
        int rc, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        char sql_query_string[QUERY_SIZE] = {0, };
        
        const emf_db_object_t* tables = _g_db_tables;
        const emf_db_object_t* indexes = _g_db_indexes;
        char data_path[256];
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
        
-       if (!em_storage_delete_dir(MAILHOME, &error)) {
-               EM_DEBUG_EXCEPTION(" em_storage_delete_dir failed - %d", error);
+       if (!emstorage_delete_dir(MAILHOME, &error)) {
+               EM_DEBUG_EXCEPTION(" emstorage_delete_dir failed - %d", error);
 
                goto FINISH_OFF;
        }
@@ -9874,8 +9836,8 @@ EXPORT_API int em_storage_clear_mail_data(int transaction, int *err_code)
        while (indexes->object_name)  {
                if (indexes->data_flag)  {
                        SNPRINTF(sql_query_string, sizeof(sql_query_string), "DROP index %s", indexes->object_name);
-                       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-                       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+                       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+                       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                                ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
                }
                indexes++;
@@ -9884,8 +9846,8 @@ EXPORT_API int em_storage_clear_mail_data(int transaction, int *err_code)
        while (tables->object_name)  {
                if (tables->data_flag)  {
                        SNPRINTF(sql_query_string, sizeof(sql_query_string), "DROP table %s", tables->object_name);
-                       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-                       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+                       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+                       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                                ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
                }
                
@@ -9894,7 +9856,7 @@ EXPORT_API int em_storage_clear_mail_data(int transaction, int *err_code)
        ret = true;
        
 FINISH_OFF:
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -9924,20 +9886,20 @@ char *__em_create_dir_by_file_name(char *file_name)
        return result;
 }
 
-EXPORT_API int em_storage_get_save_name(int account_id, int mail_id, int atch_id, char *fname, char *name_buf, int *err_code)
+INTERNAL_FUNC int emstorage_get_save_name(int account_id, int mail_id, int atch_id, char *fname, char *name_buf, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], mail_id[%d], atch_id[%d], fname[%s], name_buf[%p], err_code[%p]", account_id, mail_id, atch_id, fname, name_buf, err_code);
-       EM_PROFILE_BEGIN(profile_em_storage_get_save_name);
+       EM_PROFILE_BEGIN(profile_emstorage_get_save_name);
        
        int ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        char *dir_name = NULL;
        char create_dir[1024]={0};
        char *temp_file = NULL;
        
        if (!name_buf || account_id < FIRST_ACCOUNT_ID || mail_id < 0 || atch_id < 0)  {        
                EM_DEBUG_EXCEPTION(" account_id[%d], mail_id[%d], atch_id[%d], fname[%p], name_buf[%p]", account_id, mail_id, atch_id, fname, name_buf);
-               error = EM_STORAGE_ERROR_INVALID_PARAM;
+               error = EMF_ERROR_INVALID_PARAM;
                goto FINISH_OFF;
        }
 
@@ -9981,19 +9943,19 @@ FINISH_OFF:
        if (err_code != NULL)
                *err_code = error;
 
-       EM_PROFILE_END(profile_em_storage_get_save_name);
+       EM_PROFILE_END(profile_emstorage_get_save_name);
        EM_DEBUG_FUNC_END("ret [%d]", ret);
        return ret;
 }
 
-EXPORT_API int em_storage_get_dele_name(int account_id, int mail_id, int atch_id, char *fname, char *name_buf, int *err_code)
+INTERNAL_FUNC int emstorage_get_dele_name(int account_id, int mail_id, int atch_id, char *fname, char *name_buf, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], mail_id[%d], atch_id[%d], fname[%p], name_buf[%p], err_code[%p]", account_id, mail_id, atch_id, fname, name_buf, err_code);
        
        if (!name_buf || account_id < FIRST_ACCOUNT_ID)  {
                EM_DEBUG_EXCEPTION(" account_id[%d], mail_id[%d], atch_id[%d], fname[%p], name_buf[%p]", account_id, mail_id, atch_id, fname, name_buf);
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
 
@@ -10016,12 +9978,12 @@ FINISH_OFF:
        return true;
 }
 
-EXPORT_API int em_storage_create_dir(int account_id, int mail_id, int atch_id, int *err_code)
+INTERNAL_FUNC int emstorage_create_dir(int account_id, int mail_id, int atch_id, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], mail_id[%d], atch_id[%d], err_code[%p]", account_id, mail_id, atch_id, err_code);
-       EM_PROFILE_BEGIN(profile_em_core_save_create_dir);
+       EM_PROFILE_BEGIN(profile_emcore_save_create_dir);
        int ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        
        char buf[512];
        struct stat sbuf;
@@ -10031,7 +9993,7 @@ EXPORT_API int em_storage_create_dir(int account_id, int mail_id, int atch_id, i
                if (stat(buf, &sbuf) == 0) {
                        if ((sbuf.st_mode & S_IFMT) != S_IFDIR)  {
                                EM_DEBUG_EXCEPTION(" a object which isn't directory aleady exists");
-                               error = EM_STORAGE_ERROR_SYSTEM_FAILURE;
+                               error = EMF_ERROR_SYSTEM_FAILURE;
                                goto FINISH_OFF;
                        }
                }
@@ -10039,7 +10001,7 @@ EXPORT_API int em_storage_create_dir(int account_id, int mail_id, int atch_id, i
                        if (mkdir(buf, DIRECTORY_PERMISSION) != 0) {
                                EM_DEBUG_EXCEPTION(" mkdir failed [%s]", buf);
                                EM_DEBUG_EXCEPTION("mkdir failed l(Errno=%d)][ErrStr=%s]", errno, strerror(errno));
-                               error = EM_STORAGE_ERROR_SYSTEM_FAILURE;
+                               error = EMF_ERROR_SYSTEM_FAILURE;
                                goto FINISH_OFF;
                        }
                }
@@ -10048,7 +10010,7 @@ EXPORT_API int em_storage_create_dir(int account_id, int mail_id, int atch_id, i
        if (mail_id > 0)  {
                if (account_id < FIRST_ACCOUNT_ID)  {
                        EM_DEBUG_EXCEPTION("account_id[%d], mail_id[%d], atch_id[%d]", account_id, mail_id, atch_id);
-                       error = EM_STORAGE_ERROR_INVALID_PARAM;
+                       error = EMF_ERROR_INVALID_PARAM;
                        goto FINISH_OFF;
                }
 
@@ -10058,7 +10020,7 @@ EXPORT_API int em_storage_create_dir(int account_id, int mail_id, int atch_id, i
                        if ((sbuf.st_mode & S_IFMT) != S_IFDIR)  {
                                EM_DEBUG_EXCEPTION(" a object which isn't directory aleady exists");
                                
-                               error = EM_STORAGE_ERROR_SYSTEM_FAILURE;
+                               error = EMF_ERROR_SYSTEM_FAILURE;
                                goto FINISH_OFF;
                        }
                }
@@ -10066,7 +10028,7 @@ EXPORT_API int em_storage_create_dir(int account_id, int mail_id, int atch_id, i
                        if (mkdir(buf, DIRECTORY_PERMISSION) != 0) {
                                EM_DEBUG_EXCEPTION(" mkdir failed [%s]", buf);
                                EM_DEBUG_EXCEPTION("mkdir failed l (Errno=%d)][ErrStr=%s]", errno, strerror(errno));
-                               error = EM_STORAGE_ERROR_SYSTEM_FAILURE;
+                               error = EMF_ERROR_SYSTEM_FAILURE;
                                goto FINISH_OFF;
                        }
                }
@@ -10076,7 +10038,7 @@ EXPORT_API int em_storage_create_dir(int account_id, int mail_id, int atch_id, i
                if (account_id < FIRST_ACCOUNT_ID || mail_id <= 0)  {
                        EM_DEBUG_EXCEPTION(" account_id[%d], mail_id[%d], atch_id[%d]", account_id, mail_id, atch_id);
                        
-                       error = EM_STORAGE_ERROR_INVALID_PARAM;
+                       error = EMF_ERROR_INVALID_PARAM;
                        goto FINISH_OFF;
                }
 
@@ -10086,14 +10048,14 @@ EXPORT_API int em_storage_create_dir(int account_id, int mail_id, int atch_id, i
                        if ((sbuf.st_mode & S_IFMT) != S_IFDIR)  {
                                EM_DEBUG_EXCEPTION(" a object which isn't directory aleady exists");
                                
-                               error = EM_STORAGE_ERROR_SYSTEM_FAILURE;
+                               error = EMF_ERROR_SYSTEM_FAILURE;
                                goto FINISH_OFF;
                        }
                }
                else  {
                        if (mkdir(buf, DIRECTORY_PERMISSION) != 0) {
                                EM_DEBUG_EXCEPTION(" mkdir failed [%s]", buf);
-                               error = EM_STORAGE_ERROR_SYSTEM_FAILURE;
+                               error = EMF_ERROR_SYSTEM_FAILURE;
                                goto FINISH_OFF;
                        }
                }
@@ -10105,17 +10067,17 @@ FINISH_OFF:
        if (err_code != NULL)
                *err_code = error;
 
-       EM_PROFILE_END(profile_em_core_save_create_dir);
+       EM_PROFILE_END(profile_emcore_save_create_dir);
        EM_DEBUG_FUNC_END("ret [%d]", ret);
        return ret;
 }
 
-EXPORT_API int em_storage_copy_file(char *src_file, char *dst_file, int sync_status, int *err_code)
+INTERNAL_FUNC int emstorage_copy_file(char *src_file, char *dst_file, int sync_status, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("src_file[%s], dst_file[%s], err_code[%p]", src_file, dst_file, err_code);
        EM_DEBUG_LOG("Using the fsync function");
        int ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        struct stat st_buf;
 
        int fp_src = 0;
@@ -10128,14 +10090,14 @@ EXPORT_API int em_storage_copy_file(char *src_file, char *dst_file, int sync_sta
        if (!src_file || !dst_file)  {
                EM_DEBUG_EXCEPTION("src_file[%p], dst_file[%p]", src_file, dst_file);
                
-               error = EM_STORAGE_ERROR_INVALID_PARAM;
+               error = EMF_ERROR_INVALID_PARAM;
                goto FINISH_OFF;
        }
        
        if (stat(src_file, &st_buf) < 0) {
                EM_DEBUG_EXCEPTION("stat(\"%s\") failed...", src_file);
                
-               error = EM_STORAGE_ERROR_SYSTEM_FAILURE;                /* EMF_ERROR_INVALID_PATH; */
+               error = EMF_ERROR_SYSTEM_FAILURE;               /* EMF_ERROR_INVALID_PATH; */
                goto FINISH_OFF;
        }
        
@@ -10145,20 +10107,20 @@ EXPORT_API int em_storage_copy_file(char *src_file, char *dst_file, int sync_sta
 
        if (!buf) {
                EM_DEBUG_EXCEPTION(">>> Memory cannot be allocated");
-               error = EM_STORAGE_ERROR_OUT_OF_MEMORY;
+               error = EMF_ERROR_OUT_OF_MEMORY;
                goto FINISH_OFF;
        }
 
        if (buf) {
                if (!(fp_src = open(src_file, O_RDONLY))) {
                        EM_DEBUG_EXCEPTION(">>>> Source Fail open %s Failed [ %d ] - Error [ %s ]", src_file, errno, strerror(errno));
-                       error = EM_STORAGE_ERROR_SYSTEM_FAILURE;
+                       error = EMF_ERROR_SYSTEM_FAILURE;
                        goto FINISH_OFF;                                
                }
 
                if (!(fp_dst = open(dst_file, O_CREAT | O_WRONLY, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH))) {
                        EM_DEBUG_EXCEPTION(">>>> Destination Fail open %s Failed [ %d ] - Error [ %s ]", dst_file, errno, strerror(errno));
-                       error = EM_STORAGE_ERROR_SYSTEM_FAILURE;
+                       error = EMF_ERROR_SYSTEM_FAILURE;
                        goto FINISH_OFF;                                
                }
 
@@ -10167,7 +10129,7 @@ EXPORT_API int em_storage_copy_file(char *src_file, char *dst_file, int sync_sta
                                EM_DEBUG_LOG("Nread Value [%d]", nread);
                                if ((nwritten = write(fp_dst, buf, nread)) != nread) {
                                        EM_DEBUG_EXCEPTION("fwrite failed...");
-                                       error = EM_STORAGE_ERROR_UNKNOWN;
+                                       error = EMF_ERROR_UNKNOWN;
                                        goto FINISH_OFF;
                                }
                                EM_DEBUG_LOG("NWRITTEN [%d]", nwritten);
@@ -10189,7 +10151,7 @@ FINISH_OFF:
                close(fp_dst);                  
        }
        EM_SAFE_FREE(buf);
-       if (nread < 0 || error == EM_STORAGE_ERROR_UNKNOWN)
+       if (nread < 0 || error == EMF_ERROR_UNKNOWN)
                remove(dst_file);
        
        if (err_code != NULL)
@@ -10198,7 +10160,7 @@ FINISH_OFF:
        return ret;
 }
 /* create Directory if user has deleted [deepam.p@samsung.com] */
-EXPORT_API void em_storage_create_dir_if_delete()
+INTERNAL_FUNC void emstorage_create_dir_if_delete()
 {
        EM_DEBUG_FUNC_BEGIN();
 
@@ -10210,11 +10172,10 @@ EXPORT_API void em_storage_create_dir_if_delete()
        SNPRINTF(g_db_path, sizeof(g_db_path), "%s/%s", MAILHOME, MAILTEMP);
        mkdir(g_db_path, DIRECTORY_PERMISSION);
        
-       /* _emf_delete_temp_file(g_db_path); */
+       /* _delete_temp_file(g_db_path); */
        EM_DEBUG_FUNC_END();
 }
-static 
-int em_storage_get_temp_file_name(char **filename, int *err_code)
+static int _get_temp_file_name(char **filename, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("filename[%p], err_code[%p]", filename, err_code);
        
@@ -10254,7 +10215,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_add_content_type(char *file_path, char *char_set, int *err_code)
+INTERNAL_FUNC int emstorage_add_content_type(char *file_path, char *char_set, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("File path [ %p ]  Character Set [ %p ] err_code [ %p]", file_path, char_set, err_code);
 
@@ -10270,7 +10231,7 @@ EXPORT_API int em_storage_add_content_type(char *file_path, char *char_set, int
        char *match_str = NULL;
        int nwritten = 0;
        int ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        int data_count_to_written = 0;
        char *temp_file_name = NULL;
        int err = 0;
@@ -10283,7 +10244,7 @@ EXPORT_API int em_storage_add_content_type(char *file_path, char *char_set, int
        if (stat(file_path, &st_buf) < 0) {
                EM_DEBUG_EXCEPTION(" stat(\"%s\") failed...", file_path);
                
-               error = EM_STORAGE_ERROR_SYSTEM_FAILURE;                /* EMF_ERROR_INVALID_PATH; */
+               error = EMF_ERROR_SYSTEM_FAILURE;               /* EMF_ERROR_INVALID_PATH; */
                goto FINISH_OFF;
        }
 
@@ -10301,8 +10262,8 @@ EXPORT_API int em_storage_add_content_type(char *file_path, char *char_set, int
        if (!(fp_src = fopen(file_path, "rb"))) {
                EM_DEBUG_EXCEPTION(" file_path fopen failed - %s", file_path);
                        
-                       error = EM_STORAGE_ERROR_SYSTEM_FAILURE;
-                       goto FINISH_OFF;                                /*  20080509 prevent 28806 - forward null */
+                       error = EMF_ERROR_SYSTEM_FAILURE;
+                       goto FINISH_OFF;
                }
                                
                if ((nread = fread(buf, 1, buf_size, fp_src)) > 0) {
@@ -10324,23 +10285,23 @@ EXPORT_API int em_storage_add_content_type(char *file_path, char *char_set, int
                                        
                                EM_DEBUG_LOG(">>> CHARSET [ %s ] ", low_char_set);
 
-                               EM_DEBUG_LOG(">>>>em_storage_add_content_type 1 ");
+                               EM_DEBUG_LOG(">>>>emstorage_add_content_type 1 ");
                                
                                match_str = strstr(buf, CONTENT_TYPE_DATA);
-                               EM_DEBUG_LOG(">>>>em_storage_add_content_type 2 ");
+                               EM_DEBUG_LOG(">>>>emstorage_add_content_type 2 ");
                                
                                if (match_str == NULL) {
-                                       EM_DEBUG_LOG(">>>>em_storage_add_content_type 3 ");
+                                       EM_DEBUG_LOG(">>>>emstorage_add_content_type 3 ");
                                        if (fp_src !=NULL) {
                                                fclose(fp_src);fp_src = NULL;
                                        }
                                data_count_to_written = strlen(low_char_set)+strlen(CONTENT_DATA)+1;
-                                       EM_DEBUG_LOG(">>>>em_storage_add_content_type 4 ");
+                                       EM_DEBUG_LOG(">>>>emstorage_add_content_type 4 ");
                                buf1 = (char *)calloc(1, data_count_to_written);
-                                       EM_DEBUG_LOG(">>>>em_storage_add_content_type 5 ");
+                                       EM_DEBUG_LOG(">>>>emstorage_add_content_type 5 ");
 
                                        if (buf1) {
-                                               EM_DEBUG_LOG(">>>>em_storage_add_content_type 6 ");
+                                               EM_DEBUG_LOG(">>>>emstorage_add_content_type 6 ");
                                                strncat(buf1, CONTENT_DATA, strlen(CONTENT_DATA));
 
                                                EM_DEBUG_LOG(">>>>> BUF 1 [ %s ] ", buf1);
@@ -10351,8 +10312,8 @@ EXPORT_API int em_storage_add_content_type(char *file_path, char *char_set, int
 
 
                                        /* 1. Create a temporary file name */
-                                       if (!em_storage_get_temp_file_name(&temp_file_name, &err)) {
-                                                       EM_DEBUG_EXCEPTION(" em_core_get_temp_file_name failed - %d", err);
+                                       if (!_get_temp_file_name(&temp_file_name, &err)) {
+                                                       EM_DEBUG_EXCEPTION(" emcore_get_temp_file_name failed - %d", err);
                                                        if (err_code != NULL) *err_code = err;
                                                        EM_SAFE_FREE(temp_file_name);
                                                        goto FINISH_OFF;
@@ -10362,8 +10323,8 @@ EXPORT_API int em_storage_add_content_type(char *file_path, char *char_set, int
                                        /* Open the Temp file in Append mode */
                                        if (!(fp_dest = fopen(temp_file_name, "ab"))) {
                                                EM_DEBUG_EXCEPTION(" fopen failed - %s", temp_file_name);
-                                               error = EM_STORAGE_ERROR_SYSTEM_FAILURE;
-                                               goto FINISH_OFF;                                /*  20080509 prevent 28806 - forward null */
+                                               error = EMF_ERROR_SYSTEM_FAILURE;
+                                               goto FINISH_OFF;
                                        }
 
                                        /* 2. write the Latest data */
@@ -10377,14 +10338,14 @@ EXPORT_API int em_storage_add_content_type(char *file_path, char *char_set, int
 
                                                if (nwritten <= 0) {
                                                        EM_DEBUG_EXCEPTION(" Error Occured while writing Old data : [%d ] bytes written ", nwritten);
-                                                       error = EM_STORAGE_ERROR_SYSTEM_FAILURE;
+                                                       error = EMF_ERROR_SYSTEM_FAILURE;
                                                        goto FINISH_OFF;
                                                }
                                                else {
                                                        EM_DEBUG_LOG(">>>> OLD data appended [ %d ] ", nwritten);
 
-                                                       if (!em_storage_move_file(temp_file_name, file_path, false, &err)) {
-                                                               EM_DEBUG_EXCEPTION(" em_storage_move_file failed - %d", err);
+                                                       if (!emstorage_move_file(temp_file_name, file_path, false, &err)) {
+                                                               EM_DEBUG_EXCEPTION(" emstorage_move_file failed - %d", err);
                                                                goto FINISH_OFF;
                                                        }
                                                }
@@ -10392,14 +10353,14 @@ EXPORT_API int em_storage_add_content_type(char *file_path, char *char_set, int
                                        }
                                        else {
                                                EM_DEBUG_EXCEPTION(" Error Occured while writing New data : [%d ] bytes written ", nwritten);
-                                               error = EM_STORAGE_ERROR_SYSTEM_FAILURE;
+                                               error = EMF_ERROR_SYSTEM_FAILURE;
                                                goto FINISH_OFF;
                                        }
                                                        
                                        }
                
                                }
-                               EM_DEBUG_LOG(">>>>em_storage_add_content_type 15 ");
+                               EM_DEBUG_LOG(">>>>emstorage_add_content_type 15 ");
 
        
                        }
@@ -10426,16 +10387,16 @@ FINISH_OFF:
 
 }
 
-EXPORT_API int em_storage_move_file(char *src_file, char *dst_file, int sync_status, int *err_code)
+INTERNAL_FUNC int emstorage_move_file(char *src_file, char *dst_file, int sync_status, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("src_file[%p], dst_file[%p], err_code[%p]", src_file, dst_file, err_code);
        
        int ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        
        if (src_file == NULL || dst_file == NULL)  {
                EM_DEBUG_EXCEPTION("src_file[%p], dst_file[%p]", src_file, dst_file);
-               error = EM_STORAGE_ERROR_INVALID_PARAM;
+               error = EMF_ERROR_INVALID_PARAM;
                goto FINISH_OFF;
        }
        
@@ -10446,8 +10407,8 @@ EXPORT_API int em_storage_move_file(char *src_file, char *dst_file, int sync_sta
                        if (errno == EXDEV)  {  /* oldpath and newpath are not on the same mounted file system.  (Linux permits a file system to be mounted at multiple points,  but  rename() */
                                /*  does not work across different mount points, even if the same file system is mounted on both.)       */
                                EM_DEBUG_LOG("oldpath and newpath are not on the same mounted file system.");
-                               if (!em_storage_copy_file(src_file, dst_file, sync_status, &error)) {
-                                       EM_DEBUG_EXCEPTION("em_storage_copy_file failed - %d", error);
+                               if (!emstorage_copy_file(src_file, dst_file, sync_status, &error)) {
+                                       EM_DEBUG_EXCEPTION("emstorage_copy_file failed - %d", error);
                                        goto FINISH_OFF;
                                }
                                remove(src_file);
@@ -10463,13 +10424,13 @@ EXPORT_API int em_storage_move_file(char *src_file, char *dst_file, int sync_sta
                                                EM_DEBUG_EXCEPTION("no dst file found [%s]", src_file);
 
                                        EM_DEBUG_EXCEPTION("no file found [%d]", errno);
-                                       error = EM_STORAGE_ERROR_FILE_NOT_FOUND;
+                                       error = EMF_ERROR_FILE_NOT_FOUND;
                                        goto FINISH_OFF;
                                        
                                }
                                else  {
                                        EM_DEBUG_EXCEPTION("rename failed [%d]", errno);
-                                       error = EM_STORAGE_ERROR_SYSTEM_FAILURE;
+                                       error = EMF_ERROR_SYSTEM_FAILURE;
                                        goto FINISH_OFF;
                                }
                        }
@@ -10489,17 +10450,17 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_delete_file(char *src_file, int *err_code)
+INTERNAL_FUNC int emstorage_delete_file(char *src_file, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("src_file[%p], err_code[%p]", src_file, err_code);
        
        int ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        
        if (src_file == NULL) {
                EM_DEBUG_EXCEPTION(" src_file[%p]", src_file);
                
-               error = EM_STORAGE_ERROR_INVALID_PARAM;
+               error = EMF_ERROR_INVALID_PARAM;
                goto FINISH_OFF;
        }
        
@@ -10507,13 +10468,13 @@ EXPORT_API int em_storage_delete_file(char *src_file, int *err_code)
                if (errno != ENOENT) {
                        EM_DEBUG_EXCEPTION(" remove failed - %d", errno);
                        
-                       error = EM_STORAGE_ERROR_SYSTEM_FAILURE;
+                       error = EMF_ERROR_SYSTEM_FAILURE;
                        goto FINISH_OFF;
                }
                else {
                        EM_DEBUG_EXCEPTION(" no file found...");
                        
-                       error = EM_STORAGE_ERROR_FILE_NOT_FOUND;
+                       error = EMF_ERROR_FILE_NOT_FOUND;
                }
        }
        
@@ -10528,7 +10489,7 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int em_storage_delete_dir(char *src_dir, int *err_code)
+INTERNAL_FUNC int emstorage_delete_dir(char *src_dir, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("src_dir[%p], err_code[%p]", src_dir, err_code);
        
@@ -10536,11 +10497,11 @@ EXPORT_API int em_storage_delete_dir(char *src_dir, int *err_code)
                EM_DEBUG_EXCEPTION(" src_dir[%p]", src_dir);
                
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        
        DIR *dirp;
        struct dirent *dp;
@@ -10553,13 +10514,13 @@ EXPORT_API int em_storage_delete_dir(char *src_dir, int *err_code)
                if (errno == ENOENT)  {
                        EM_DEBUG_EXCEPTION("directory[%s] does not exist...", src_dir);
                        if (err_code != NULL)
-                               *err_code = EM_STORAGE_ERROR_SYSTEM_FAILURE;    
+                               *err_code = EMF_ERROR_SYSTEM_FAILURE;
                        return true;
                }
                else  {
                        EM_DEBUG_EXCEPTION("opendir failed - %d", errno);
                        if (err_code != NULL)
-                               *err_code = EM_STORAGE_ERROR_SYSTEM_FAILURE;
+                               *err_code = EMF_ERROR_SYSTEM_FAILURE;
                        return false;
                }
        }
@@ -10574,7 +10535,7 @@ EXPORT_API int em_storage_delete_dir(char *src_dir, int *err_code)
                        /*  check directory */
                        if ((sbuf.st_mode & S_IFMT) == S_IFDIR)  {      /*  directory */
                                /*  recursive call */
-                               if (!em_storage_delete_dir(buf, &error)) {
+                               if (!emstorage_delete_dir(buf, &error)) {
                                        closedir(dirp); 
                                        if (err_code != NULL)
                                                *err_code = error;
@@ -10586,7 +10547,7 @@ EXPORT_API int em_storage_delete_dir(char *src_dir, int *err_code)
                                        EM_DEBUG_EXCEPTION("remove failed - %s", buf);
                                        closedir(dirp);
                                        if (err_code != NULL)
-                                               *err_code = EM_STORAGE_ERROR_SYSTEM_FAILURE;
+                                               *err_code = EMF_ERROR_SYSTEM_FAILURE;
                                        return false;
                                }
                        }
@@ -10604,7 +10565,7 @@ EXPORT_API int em_storage_delete_dir(char *src_dir, int *err_code)
        if (remove(src_dir) < 0)  {
                EM_DEBUG_EXCEPTION("remove failed [%s]", src_dir);
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_SYSTEM_FAILURE;
+                       *err_code = EMF_ERROR_SYSTEM_FAILURE;
                return false;
        }
        
@@ -10615,37 +10576,37 @@ EXPORT_API int em_storage_delete_dir(char *src_dir, int *err_code)
 }
 
 /* faizan.h@samsung.com */
-EXPORT_API int em_storage_update_server_uid(char *old_server_uid, char *new_server_uid, int *err_code)
+INTERNAL_FUNC int emstorage_update_server_uid(char *old_server_uid, char *new_server_uid, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("new_server_uid[%s], old_server_uid[%s]", new_server_uid, old_server_uid);
        int rc, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        char sql_query_string[QUERY_SIZE] = {0, };
 
        int transaction = true;
        
        if (!old_server_uid || !new_server_uid) {       
                EM_DEBUG_EXCEPTION("Invalid parameters");
-               error = EM_STORAGE_ERROR_INVALID_PARAM;
+               error = EMF_ERROR_INVALID_PARAM;
                return false;
        }
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
 
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
        
        SNPRINTF(sql_query_string, sizeof(sql_query_string),
                 "UPDATE mail_tbl SET server_mail_id=\'%s\' WHERE server_mail_id=%s ", new_server_uid, old_server_uid);
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
 
-       EM_DEBUG_DB_EXEC((SQLITE_FULL == rc), {error = EM_STORAGE_ERROR_DB_IS_FULL;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC((SQLITE_FULL == rc), {error = EMF_ERROR_MAIL_MEMORY_FULL;goto FINISH_OFF; },
                ("sqlite3_exec fail:%d", rc));
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
        
        ret = true;
          
 FINISH_OFF:
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        _DISCONNECT_DB;
 
        if (err_code != NULL)
@@ -10656,35 +10617,35 @@ FINISH_OFF:
        
 }
 
-EXPORT_API int em_storage_update_read_mail_uid(int mail_id, char *new_server_uid, char *mbox_name, int *err_code)
+INTERNAL_FUNC int emstorage_update_read_mail_uid(int mail_id, char *new_server_uid, char *mbox_name, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("mail_id[%d], new_server_uid[%s], mbox_name[%s]", mail_id, new_server_uid, mbox_name);
 
        int rc, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        char sql_query_string[QUERY_SIZE] = {0, };
 
        int transaction = true;
        
        if (!mail_id || !new_server_uid || !mbox_name)  {               
                EM_DEBUG_EXCEPTION("Invalid parameters");
-               error = EM_STORAGE_ERROR_INVALID_PARAM;
+               error = EMF_ERROR_INVALID_PARAM;
                return false;
        }
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
 
        
        SNPRINTF(sql_query_string, sizeof(sql_query_string),
                 "UPDATE mail_read_mail_uid_tbl SET s_uid=\'%s\', local_mbox=\'%s\', mailbox_name=\'%s\' WHERE local_uid=%d ", new_server_uid, mbox_name, mbox_name, mail_id);
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
        ret     = true;
          
 FINISH_OFF:
 
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        _DISCONNECT_DB;
 
        if (err_code != NULL)
@@ -10696,28 +10657,28 @@ FINISH_OFF:
 }
 
 
-int em_storage_get_latest_unread_mailid(int account_id, int *mail_id, int *err_code)
+int emstorage_get_latest_unread_mailid(int account_id, int *mail_id, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
 
        if ((!mail_id) ||(account_id <= 0 &&  account_id != -1)) {
                EM_DEBUG_EXCEPTION(" mail_id[%p], account_id[%d] ", mail_id, account_id);
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }       
 
        int ret = false;
        int rc = -1;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        DB_STMT hStmt = NULL;
        int count = 0;
        int mailid = 0;
        int transaction = false;
        char sql_query_string[QUERY_SIZE] = {0, };
 
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_READ_TRANSACTION(transaction);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_READ_TRANSACTION(transaction);
 
        memset(sql_query_string, 0x00, sizeof(sql_query_string));
 
@@ -10726,30 +10687,30 @@ int em_storage_get_latest_unread_mailid(int account_id, int *mail_id, int *err_c
        else
                SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT mail_id FROM mail_tbl WHERE account_id = %d AND flags_seen_field = 0 ORDER BY mail_id DESC", account_id);
                
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
        EM_DEBUG_LOG("  sqlite3_prepare hStmt = %p", hStmt);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
 
        char **result;
 
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, &count, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, &count, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        sqlite3_free_table(result);
        if (count == 0)  {
                EM_DEBUG_EXCEPTION("no Mails found...");
                ret = false;
-               error= EM_STORAGE_ERROR_MAIL_NOT_FOUND;
+               error= EMF_ERROR_MAIL_NOT_FOUND;
                goto FINISH_OFF;
        }
        
-               _getStmtFieldDataInt(hStmt, &mailid, 0);
+               _get_stmt_field_data_int(hStmt, &mailid, 0);
 
        ret = true;
 
@@ -10761,10 +10722,10 @@ FINISH_OFF:
                if (rc != SQLITE_OK)  {
                        EM_DEBUG_EXCEPTION("sqlite3_finalize failed - %d", rc);
                        
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
        }
-       EM_STORAGE_FINISH_READ_TRANSACTION(transaction);
+       EMSTORAGE_FINISH_READ_TRANSACTION(transaction);
        _DISCONNECT_DB;
 
        if (err_code != NULL)
@@ -10813,7 +10774,7 @@ int setting_system_command(const char *command)
 }
 
 
-EXPORT_API int em_storage_mail_get_total_diskspace_usage(unsigned long *total_usage,  int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_mail_get_total_diskspace_usage(unsigned long *total_usage,  int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("total_usage[%p],  transaction[%d], err_code[%p]", total_usage, transaction, err_code);
 
@@ -10821,31 +10782,32 @@ EXPORT_API int em_storage_mail_get_total_diskspace_usage(unsigned long *total_us
                EM_DEBUG_EXCEPTION("total_usage[%p]", total_usage);
                
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
 
-       int  ret = false;       
-       int error = EM_STORAGE_ERROR_NONE;
-       char syscmd[256] = {0};
+       int   ret = false;
+       int   error = EMF_ERROR_NONE;
+       char  syscmd[256] = {0, };
+       char  line[256] = {0, };
+       char *line_from_file = NULL;
        FILE *fp = NULL;
        unsigned long total_diskusage = 0;
 
        SNPRINTF(syscmd, sizeof(syscmd), "touch %s", SETTING_MEMORY_TEMP_FILE_PATH);
        if (setting_system_command(syscmd) == -1) {
-               EM_DEBUG_EXCEPTION("em_storage_mail_get_total_diskspace_usage : [Setting > Memory] System Command [%s] is failed", syscmd);
+               EM_DEBUG_EXCEPTION("emstorage_mail_get_total_diskspace_usage : [Setting > Memory] System Command [%s] is failed", syscmd);
 
-               error = EM_STORAGE_ERROR_SYSTEM_FAILURE;
+               error = EMF_ERROR_SYSTEM_FAILURE;
                goto FINISH_OFF;                
        }
 
-       memset(syscmd, 0, sizeof(syscmd));
        SNPRINTF(syscmd, sizeof(syscmd), "du -hsk %s > %s", EMAILPATH, SETTING_MEMORY_TEMP_FILE_PATH);
        EM_DEBUG_LOG(" cmd : %s", syscmd);
        if (setting_system_command(syscmd) == -1) {
-               EM_DEBUG_EXCEPTION("em_storage_mail_get_total_diskspace_usage : Setting > Memory] System Command [%s] is failed", syscmd);
+               EM_DEBUG_EXCEPTION("emstorage_mail_get_total_diskspace_usage : Setting > Memory] System Command [%s] is failed", syscmd);
                
-               error = EM_STORAGE_ERROR_SYSTEM_FAILURE;
+               error = EMF_ERROR_SYSTEM_FAILURE;
                goto FINISH_OFF;        
        }
 
@@ -10853,23 +10815,26 @@ EXPORT_API int em_storage_mail_get_total_diskspace_usage(unsigned long *total_us
        if (fp == NULL) {
                perror(SETTING_MEMORY_TEMP_FILE_PATH);
                
-               error = EM_STORAGE_ERROR_SYSTEM_FAILURE;
+               error = EMF_ERROR_SYSTEM_FAILURE;
                goto FINISH_OFF;        
        }
  
-       char line[256] = {0};
-       fgets(line, sizeof(line), fp);
+       line_from_file = fgets(line, sizeof(line), fp);
+
+       if(line_from_file == NULL) {
+               EM_DEBUG_EXCEPTION("fgets failed");
+               error = EMF_ERROR_SYSTEM_FAILURE;
+               goto FINISH_OFF;
+       }
        total_diskusage = strtoul(line, NULL, 10);
  
        fclose(fp);
 
        memset(syscmd, 0, sizeof(syscmd));
        SNPRINTF(syscmd, sizeof(syscmd), "rm -f %s", SETTING_MEMORY_TEMP_FILE_PATH);
-       if (setting_system_command(syscmd) == -1)
-       {
-               EM_DEBUG_EXCEPTION("em_storage_mail_get_total_diskspace_usage :  [Setting > Memory] System Command [%s] is failed", syscmd);
-               
-               error = EM_STORAGE_ERROR_SYSTEM_FAILURE;
+       if (setting_system_command(syscmd) == -1) {
+               EM_DEBUG_EXCEPTION("emstorage_mail_get_total_diskspace_usage :  [Setting > Memory] System Command [%s] is failed", syscmd);
+               error = EMF_ERROR_SYSTEM_FAILURE;
                goto FINISH_OFF;        
        }
 
@@ -10891,11 +10856,11 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int em_storage_test(int mail_id, int account_id, char *full_address_to, char *full_address_cc, char *full_address_bcc, int *err_code)
+INTERNAL_FUNC int emstorage_test(int mail_id, int account_id, char *full_address_to, char *full_address_cc, char *full_address_bcc, int *err_code)
 {
        DB_STMT hStmt = NULL;
        int ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        int rc = 0;
        char sql_query_string[QUERY_SIZE] = {0, };
 
@@ -10946,77 +10911,76 @@ EXPORT_API int em_storage_test(int mail_id, int account_id, char *full_address_t
                ")");
 
        int transaction = true;
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
 
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
  
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
-       _bindStmtFieldDataInt(hStmt, MAIL_ID_IDX_IN_MAIL_TBL, mail_id);
-       _bindStmtFieldDataInt(hStmt, ACCOUNT_ID_IDX_IN_MAIL_TBL, account_id);
-       _bindStmtFieldDataString(hStmt, MAILBOX_NAME_IDX_IN_MAIL_TBL, "OUTBOX", 0, MAILBOX_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataInt(hStmt, MAILBOX_TYPE_IDX_IN_MAIL_TBL, EMF_MAILBOX_TYPE_OUTBOX);
-       _bindStmtFieldDataString(hStmt, SUBJECT_IDX_IN_MAIL_TBL, "save test - long", 1, SUBJECT_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataString(hStmt, DATETIME_IDX_IN_MAIL_TBL, "20100316052908", 0, DATETIME_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataInt(hStmt, SERVER_MAIL_STATUS_IDX_IN_MAIL_TBL, 0);
-       _bindStmtFieldDataString(hStmt, SERVER_MAILBOX_NAME_IDX_IN_MAIL_TBL, "", 0, SERVER_MAILBOX_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataString(hStmt, SERVER_MAIL_ID_IDX_IN_MAIL_TBL, "", 0, SERVER_MAIL_ID_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataString(hStmt, MESSAGE_ID_IDX_IN_MAIL_TBL, "", 0, MESSAGE_ID_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataString(hStmt, FULL_ADDRESS_FROM_IDX_IN_MAIL_TBL, "<test08@streaming.s3glab.net>", 1, FROM_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataString(hStmt, FULL_ADDRESS_REPLY_IDX_IN_MAIL_TBL, "", 1, REPLY_TO_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataString(hStmt, FULL_ADDRESS_TO_IDX_IN_MAIL_TBL, full_address_to, 1, TO_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataString(hStmt, FULL_ADDRESS_CC_IDX_IN_MAIL_TBL, full_address_cc, 1, CC_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataString(hStmt, FULL_ADDRESS_BCC_IDX_IN_MAIL_TBL, full_address_bcc, 1, BCC_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataString(hStmt, FULL_ADDRESS_RETURN_IDX_IN_MAIL_TBL, "", 1, RETURN_PATH_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataString(hStmt, EMAIL_ADDRESS_SENDER_IDX_IN_MAIL_TBL, "<sender_name@sender_host.com>", 1, FROM_EMAIL_ADDRESS_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataString(hStmt, EMAIL_ADDRESS_RECIPIENT_IDX_IN_MAIL_TBL, "<recipient_name@recipient_host.com>", 1, TO_EMAIL_ADDRESS_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataString(hStmt, ALIAS_SENDER_IDX_IN_MAIL_TBL, "send_alias", 1, FROM_EMAIL_ADDRESS_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataString(hStmt, ALIAS_RECIPIENT_IDX_IN_MAIL_TBL, "recipient_alias", 1, TO_EMAIL_ADDRESS_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataInt(hStmt, BODY_DOWNLOAD_STATUS_IDX_IN_MAIL_TBL, 1);
-       _bindStmtFieldDataString(hStmt, FILE_PATH_PLAIN_IDX_IN_MAIL_TBL, "/opt/system/rsr/email/.emfdata/7/348/UTF-8", 0, TEXT_1_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataString(hStmt, FILE_PATH_HTML_IDX_IN_MAIL_TBL, "", 0, TEXT_2_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataInt(hStmt, MAIL_SIZE_IDX_IN_MAIL_TBL, 4);
-       _bindStmtFieldDataChar(hStmt, FLAGS_SEEN_FIELD_IDX_IN_MAIL_TBL, 0);
-       _bindStmtFieldDataChar(hStmt, FLAGS_DELETED_FIELD_IDX_IN_MAIL_TBL, 0);
-       _bindStmtFieldDataChar(hStmt, FLAGS_FLAGGED_FIELD_IDX_IN_MAIL_TBL, 0);
-       _bindStmtFieldDataChar(hStmt, FLAGS_ANSWERED_FIELD_IDX_IN_MAIL_TBL, 0);
-       _bindStmtFieldDataChar(hStmt, FLAGS_RECENT_FIELD_IDX_IN_MAIL_TBL, 0);
-       _bindStmtFieldDataChar(hStmt, FLAGS_DRAFT_FIELD_IDX_IN_MAIL_TBL, 0);
-       _bindStmtFieldDataChar(hStmt, FLAGS_FORWARDED_FIELD_IDX_IN_MAIL_TBL, 0);
-       _bindStmtFieldDataInt(hStmt, DRM_STATUS_IDX_IN_MAIL_TBL, 0);
-       _bindStmtFieldDataInt(hStmt, PRIORITY_IDX_IN_MAIL_TBL, 0);
-       _bindStmtFieldDataInt(hStmt, SAVE_STATUS_IDX_IN_MAIL_TBL, 0);
-       _bindStmtFieldDataInt(hStmt, LOCK_STATUS_IDX_IN_MAIL_TBL, 0);
-       _bindStmtFieldDataInt(hStmt, REPORT_STATUS_IDX_IN_MAIL_TBL, 0);
-       _bindStmtFieldDataInt(hStmt, ATTACHMENT_COUNT_IDX_IN_MAIL_TBL, 0);
-       _bindStmtFieldDataInt(hStmt, INLINE_CONTENT_COUNT_IDX_IN_MAIL_TBL, 0);
-       _bindStmtFieldDataInt(hStmt, ATTACHMENT_COUNT_IDX_IN_MAIL_TBL, 0);
-       _bindStmtFieldDataInt(hStmt, THREAD_ID_IDX_IN_MAIL_TBL, 0);
-       _bindStmtFieldDataInt(hStmt, THREAD_ITEM_COUNT_IDX_IN_MAIL_TBL, 0);
-       _bindStmtFieldDataString(hStmt, PREVIEW_TEXT_IDX_IN_MAIL_TBL, "preview body", 1, PREVIEWBODY_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataInt(hStmt, MEETING_REQUEST_STATUS_IDX_IN_MAIL_TBL, 0);
-
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc == SQLITE_FULL), {error = EM_STORAGE_ERROR_DB_IS_FULL;goto FINISH_OFF; },
+       _bind_stmt_field_data_int(hStmt, MAIL_ID_IDX_IN_MAIL_TBL, mail_id);
+       _bind_stmt_field_data_int(hStmt, ACCOUNT_ID_IDX_IN_MAIL_TBL, account_id);
+       _bind_stmt_field_data_string(hStmt, MAILBOX_NAME_IDX_IN_MAIL_TBL, "OUTBOX", 0, MAILBOX_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_int(hStmt, MAILBOX_TYPE_IDX_IN_MAIL_TBL, EMF_MAILBOX_TYPE_OUTBOX);
+       _bind_stmt_field_data_string(hStmt, SUBJECT_IDX_IN_MAIL_TBL, "save test - long", 1, SUBJECT_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_string(hStmt, DATETIME_IDX_IN_MAIL_TBL, "20100316052908", 0, DATETIME_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_int(hStmt, SERVER_MAIL_STATUS_IDX_IN_MAIL_TBL, 0);
+       _bind_stmt_field_data_string(hStmt, SERVER_MAILBOX_NAME_IDX_IN_MAIL_TBL, "", 0, SERVER_MAILBOX_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_string(hStmt, SERVER_MAIL_ID_IDX_IN_MAIL_TBL, "", 0, SERVER_MAIL_ID_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_string(hStmt, MESSAGE_ID_IDX_IN_MAIL_TBL, "", 0, MESSAGE_ID_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_string(hStmt, FULL_ADDRESS_FROM_IDX_IN_MAIL_TBL, "<test08@streaming.s3glab.net>", 1, FROM_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_string(hStmt, FULL_ADDRESS_REPLY_IDX_IN_MAIL_TBL, "", 1, REPLY_TO_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_string(hStmt, FULL_ADDRESS_TO_IDX_IN_MAIL_TBL, full_address_to, 1, TO_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_string(hStmt, FULL_ADDRESS_CC_IDX_IN_MAIL_TBL, full_address_cc, 1, CC_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_string(hStmt, FULL_ADDRESS_BCC_IDX_IN_MAIL_TBL, full_address_bcc, 1, BCC_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_string(hStmt, FULL_ADDRESS_RETURN_IDX_IN_MAIL_TBL, "", 1, RETURN_PATH_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_string(hStmt, EMAIL_ADDRESS_SENDER_IDX_IN_MAIL_TBL, "<sender_name@sender_host.com>", 1, FROM_EMAIL_ADDRESS_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_string(hStmt, EMAIL_ADDRESS_RECIPIENT_IDX_IN_MAIL_TBL, "<recipient_name@recipient_host.com>", 1, TO_EMAIL_ADDRESS_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_string(hStmt, ALIAS_SENDER_IDX_IN_MAIL_TBL, "send_alias", 1, FROM_EMAIL_ADDRESS_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_string(hStmt, ALIAS_RECIPIENT_IDX_IN_MAIL_TBL, "recipient_alias", 1, TO_EMAIL_ADDRESS_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_int(hStmt, BODY_DOWNLOAD_STATUS_IDX_IN_MAIL_TBL, 1);
+       _bind_stmt_field_data_string(hStmt, FILE_PATH_PLAIN_IDX_IN_MAIL_TBL, "/opt/system/rsr/email/.emfdata/7/348/UTF-8", 0, TEXT_1_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_string(hStmt, FILE_PATH_HTML_IDX_IN_MAIL_TBL, "", 0, TEXT_2_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_int(hStmt, MAIL_SIZE_IDX_IN_MAIL_TBL, 4);
+       _bind_stmt_field_data_char(hStmt, FLAGS_SEEN_FIELD_IDX_IN_MAIL_TBL, 0);
+       _bind_stmt_field_data_char(hStmt, FLAGS_DELETED_FIELD_IDX_IN_MAIL_TBL, 0);
+       _bind_stmt_field_data_char(hStmt, FLAGS_FLAGGED_FIELD_IDX_IN_MAIL_TBL, 0);
+       _bind_stmt_field_data_char(hStmt, FLAGS_ANSWERED_FIELD_IDX_IN_MAIL_TBL, 0);
+       _bind_stmt_field_data_char(hStmt, FLAGS_RECENT_FIELD_IDX_IN_MAIL_TBL, 0);
+       _bind_stmt_field_data_char(hStmt, FLAGS_DRAFT_FIELD_IDX_IN_MAIL_TBL, 0);
+       _bind_stmt_field_data_char(hStmt, FLAGS_FORWARDED_FIELD_IDX_IN_MAIL_TBL, 0);
+       _bind_stmt_field_data_int(hStmt, DRM_STATUS_IDX_IN_MAIL_TBL, 0);
+       _bind_stmt_field_data_int(hStmt, PRIORITY_IDX_IN_MAIL_TBL, 0);
+       _bind_stmt_field_data_int(hStmt, SAVE_STATUS_IDX_IN_MAIL_TBL, 0);
+       _bind_stmt_field_data_int(hStmt, LOCK_STATUS_IDX_IN_MAIL_TBL, 0);
+       _bind_stmt_field_data_int(hStmt, REPORT_STATUS_IDX_IN_MAIL_TBL, 0);
+       _bind_stmt_field_data_int(hStmt, ATTACHMENT_COUNT_IDX_IN_MAIL_TBL, 0);
+       _bind_stmt_field_data_int(hStmt, INLINE_CONTENT_COUNT_IDX_IN_MAIL_TBL, 0);
+       _bind_stmt_field_data_int(hStmt, ATTACHMENT_COUNT_IDX_IN_MAIL_TBL, 0);
+       _bind_stmt_field_data_int(hStmt, THREAD_ID_IDX_IN_MAIL_TBL, 0);
+       _bind_stmt_field_data_int(hStmt, THREAD_ITEM_COUNT_IDX_IN_MAIL_TBL, 0);
+       _bind_stmt_field_data_string(hStmt, PREVIEW_TEXT_IDX_IN_MAIL_TBL, "preview body", 1, PREVIEWBODY_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_int(hStmt, MEETING_REQUEST_STATUS_IDX_IN_MAIL_TBL, 0);
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+       EM_DEBUG_DB_EXEC((rc == SQLITE_FULL), {error = EMF_ERROR_MAIL_MEMORY_FULL;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
        ret = true;
+
 FINISH_OFF:
        if (hStmt != NULL)  {
                rc = sqlite3_finalize(hStmt);
                if (rc != SQLITE_OK)  {
-                       EM_DEBUG_LOG("sqlite3_finalize failed - %d", rc);
-                       
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       EM_DEBUG_EXCEPTION("sqlite3_finalize failed - %d", rc);
+                       error = EMF_ERROR_DB_FAILURE;
                }
        }
  
-
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -11027,27 +10991,29 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int em_storage_get_max_mail_count()
+INTERNAL_FUNC int emstorage_get_max_mail_count()
 {
-       return EM_STORAGE_MAIL_MAX;
+       return EMAIL_MAIL_MAX_COUNT;
 }
 
-EXPORT_API int em_storage_get_thread_id_of_thread_mails(emf_mail_tbl_t *mail_tbl, int *thread_id, int *result_latest_mail_id_in_thread, int *thread_item_count)
+INTERNAL_FUNC int emstorage_get_thread_id_of_thread_mails(emstorage_mail_tbl_t *mail_tbl, int *thread_id, int *result_latest_mail_id_in_thread, int *thread_item_count)
 {
-       EM_DEBUG_FUNC_BEGIN();
-       EM_PROFILE_BEGIN(profile_em_storage_get_thread_id_of_thread_mails);
-       int rc = 0, query_size = 0, query_size_account = 0;
-       int account_id;
-       char *mailbox_name = NULL, *subject = NULL, *date_time = NULL;
-       int err_code = EM_STORAGE_ERROR_NONE;
-       char *sql_query_string = NULL, *sql_account = NULL;
-       char *sql_format = "SELECT thread_id, date_time, mail_id FROM mail_tbl WHERE subject like \'%%%q\' AND mailbox_type NOT IN (3, 5, 7)";
-       char *sql_format_account = " AND account_id = %d ";
-       char *sql_format_order_by = " ORDER BY date_time DESC ";
-       char **result = NULL, latest_date_time[18];
-       char stripped_subject[1025];
-       int count = 0, result_thread_id = -1, latest_mail_id_in_thread = -1;
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       EM_DEBUG_FUNC_BEGIN("mail_tbl [%p], thread_id [%p], result_latest_mail_id_in_thread [%p], thread_item_count [%p]", mail_tbl, thread_id, result_latest_mail_id_in_thread, thread_item_count);
+       EM_PROFILE_BEGIN(profile_emstorage_get_thread_id_of_thread_mails);
+       int      rc = 0, query_size = 0, query_size_account = 0;
+       int      account_id = 0;
+       int      err_code = EMF_ERROR_NONE;
+       int      count = 0, result_thread_id = -1, latest_mail_id_in_thread = -1;
+       time_t   latest_date_time = 0;
+       time_t   date_time = 0;
+       char    *mailbox_name = NULL, *subject = NULL;
+       char    *sql_query_string = NULL, *sql_account = NULL;
+       char    *sql_format = "SELECT thread_id, date_time, mail_id FROM mail_tbl WHERE subject like \'%%%q\' AND mailbox_type NOT IN (3, 5, 7, 8)";
+       char    *sql_format_account = " AND account_id = %d ";
+       char    *sql_format_order_by = " ORDER BY date_time DESC ";
+       char   **result = NULL;
+       char     stripped_subject[1025];
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
 
        EM_IF_NULL_RETURN_VALUE(mail_tbl, EMF_ERROR_INVALID_PARAM);
        EM_IF_NULL_RETURN_VALUE(thread_id, EMF_ERROR_INVALID_PARAM);
@@ -11055,24 +11021,22 @@ EXPORT_API int em_storage_get_thread_id_of_thread_mails(emf_mail_tbl_t *mail_tbl
        EM_IF_NULL_RETURN_VALUE(thread_item_count, EMF_ERROR_INVALID_PARAM);
 
        if (mail_tbl->mailbox_type == EMF_MAILBOX_TYPE_TRASH ||
-          mail_tbl->mailbox_type == EMF_MAILBOX_TYPE_SPAMBOX ||
-          mail_tbl->mailbox_type == EMF_MAILBOX_TYPE_ALL_EMAILS) {
+           mail_tbl->mailbox_type == EMF_MAILBOX_TYPE_SPAMBOX ||
+           mail_tbl->mailbox_type == EMF_MAILBOX_TYPE_ALL_EMAILS) {
                EM_DEBUG_LOG("the mail in trash, spambox, all email could not be thread mail.");
                goto FINISH_OFF;
        }
 
-       account_id = mail_tbl->account_id;
+       account_id   = mail_tbl->account_id;
        mailbox_name = mail_tbl->mailbox_name;
-       subject = mail_tbl->subject;
-       date_time = mail_tbl->datetime;
+       subject      = mail_tbl->subject;
+       date_time    = mail_tbl->date_time;
        
-       memset(latest_date_time, 0, 18);
-
        EM_DEBUG_LOG("subject : %s", subject);
 
-       if (em_core_find_pos_stripped_subject_for_thread_view(subject, stripped_subject) != EMF_ERROR_NONE)     {
-               EM_DEBUG_EXCEPTION("em_core_find_pos_stripped_subject_for_thread_view  is failed");
-               err_code =  EM_STORAGE_ERROR_UNKNOWN;
+       if (em_find_pos_stripped_subject_for_thread_view(subject, stripped_subject) != EMF_ERROR_NONE)  {
+               EM_DEBUG_EXCEPTION("em_find_pos_stripped_subject_for_thread_view  is failed");
+               err_code =  EMF_ERROR_UNKNOWN;
                result_thread_id = -1;
                goto FINISH_OFF;
        }
@@ -11082,14 +11046,14 @@ EXPORT_API int em_storage_get_thread_id_of_thread_mails(emf_mail_tbl_t *mail_tbl
                goto FINISH_OFF;
        }
        
-       EM_DEBUG_LOG("em_core_find_pos_stripped_subject_for_thread_view returns[len = %d] = %s", strlen(stripped_subject), stripped_subject);
+       EM_DEBUG_LOG("em_find_pos_stripped_subject_for_thread_view returns[len = %d] = %s", strlen(stripped_subject), stripped_subject);
        
        if (account_id > 0)     {
                query_size_account = 3 + strlen(sql_format_account);
                sql_account = malloc(query_size_account);
                if (sql_account == NULL) {
                        EM_DEBUG_EXCEPTION("malloc for sql_account  is failed %d", query_size_account);
-                       err_code =  EM_STORAGE_ERROR_OUT_OF_MEMORY;
+                       err_code =  EMF_ERROR_OUT_OF_MEMORY;
                        goto FINISH_OFF;
                }
                snprintf(sql_account, query_size_account, sql_format_account, account_id);
@@ -11101,12 +11065,12 @@ EXPORT_API int em_storage_get_thread_id_of_thread_mails(emf_mail_tbl_t *mail_tbl
        
        if (sql_query_string == NULL) {
                EM_DEBUG_EXCEPTION("malloc for sql  is failed %d", query_size);
-               err_code =  EM_STORAGE_ERROR_OUT_OF_MEMORY;
+               err_code =  EMF_ERROR_OUT_OF_MEMORY;
                goto FINISH_OFF;
        }
 
        sqlite3_snprintf(query_size, sql_query_string, sql_format, stripped_subject);
-       /* snprintf(sql_query_string, query_size, sql_format, stripped_subject); */
+
        if (account_id > 0)
                strcat(sql_query_string, sql_account);
 
@@ -11115,9 +11079,9 @@ EXPORT_API int em_storage_get_thread_id_of_thread_mails(emf_mail_tbl_t *mail_tbl
 
        EM_DEBUG_LOG("Query : %s", sql_query_string);
 
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, &count, NULL, NULL), rc);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, &count, NULL, NULL), rc);
 
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {err_code = EM_STORAGE_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {err_code = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        EM_DEBUG_LOG("Result rows count : %d", count);
@@ -11125,11 +11089,11 @@ EXPORT_API int em_storage_get_thread_id_of_thread_mails(emf_mail_tbl_t *mail_tbl
        if (count == 0)
                result_thread_id = -1;
        else {
-               _getTableFieldDataInt(result, &result_thread_id, 3);
-               _getTableFieldDataStringWithoutAllocation(result, (char *)latest_date_time, 18, 1, 4);
-               _getTableFieldDataInt(result, &latest_mail_id_in_thread, 5);
+               _get_table_field_data_int   (result, &result_thread_id, 3);
+               _get_table_field_data_time_t(result, &latest_date_time, 4);
+               _get_table_field_data_int   (result, &latest_mail_id_in_thread, 5);
 
-               if (mail_tbl->datetime && strcmp(latest_date_time, mail_tbl->datetime) > 0)
+               if (latest_date_time < mail_tbl->date_time)
                        *result_latest_mail_id_in_thread = latest_mail_id_in_thread;
                else 
                        *result_latest_mail_id_in_thread = mail_tbl->mail_id;
@@ -11149,19 +11113,19 @@ FINISH_OFF:
 
        sqlite3_free_table(result);
        
-       EM_PROFILE_END(profile_em_storage_get_thread_id_of_thread_mails);
+       EM_PROFILE_END(profile_emstorage_get_thread_id_of_thread_mails);
        
        return err_code;
 }
 
 
-EXPORT_API int em_storage_get_thread_information(int thread_id, emf_mail_tbl_t** mail_tbl, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_get_thread_information(int thread_id, emstorage_mail_tbl_t** mail_tbl, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
        
        int count = 0, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
-       emf_mail_tbl_t *p_data_tbl = NULL;
+       int error = EMF_ERROR_NONE;
+       emstorage_mail_tbl_t *p_data_tbl = NULL;
        char conditional_clause[QUERY_SIZE] = {0, };
 
        EM_IF_NULL_RETURN_VALUE(mail_tbl, false);
@@ -11169,8 +11133,8 @@ EXPORT_API int em_storage_get_thread_information(int thread_id, emf_mail_tbl_t**
        SNPRINTF(conditional_clause, QUERY_SIZE, "WHERE thread_id = %d AND thread_item_count > 0", thread_id);
        EM_DEBUG_LOG("conditional_clause [%s]", conditional_clause);
 
-       if(!em_storage_query_mail_tbl(conditional_clause, transaction, &p_data_tbl, &count, &error)) {
-               EM_DEBUG_EXCEPTION("em_storage_query_mail_tbl failed [%d]", error);
+       if(!emstorage_query_mail_tbl(conditional_clause, transaction, &p_data_tbl, &count, &error)) {
+               EM_DEBUG_EXCEPTION("emstorage_query_mail_tbl failed [%d]", error);
                goto FINISH_OFF;
        }
 
@@ -11183,7 +11147,7 @@ FINISH_OFF:
        if (ret == true) 
                *mail_tbl = p_data_tbl;
        else if (p_data_tbl != NULL)
-               em_storage_free_mail(&p_data_tbl, 1, NULL);
+               emstorage_free_mail(&p_data_tbl, 1, NULL);
        
        if (err_code != NULL)
                *err_code = error;
@@ -11193,27 +11157,27 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int em_storage_get_sender_list(int account_id, const char *mailbox_name, int search_type, const char *search_value, emf_sort_type_t sorting, emf_sender_list_t** sender_list, int *sender_count,  int *err_code)
+INTERNAL_FUNC int emstorage_get_sender_list(int account_id, const char *mailbox_name, int search_type, const char *search_value, emf_sort_type_t sorting, emf_sender_list_t** sender_list, int *sender_count,  int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id [%d], mailbox_name [%p], search_type [%d], search_value [%p], sorting [%d], sender_list[%p], sender_count[%p] err_code[%p]"
                , account_id , mailbox_name , search_type , search_value , sorting , sender_list, sender_count, err_code);
        
        if ((!sender_list) ||(!sender_count)) {
-               EM_DEBUG_EXCEPTION("EM_STORAGE_ERROR_INVALID_PARAM");
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
 
        int rc = -1, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        int count = 0;
        int i, col_index = 0;
        int read_count = 0;
        emf_sender_list_t *p_sender_list = NULL;
        char sql_query_string[QUERY_SIZE] = {0, };
        char **result = NULL;
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
 
        SNPRINTF(sql_query_string, sizeof(sql_query_string),
                "SELECT email_address_sender, alias_sender, COUNT(email_address_sender), SUM(flags_seen_field = 1) "
@@ -11223,7 +11187,7 @@ EXPORT_API int em_storage_get_sender_list(int account_id, const char *mailbox_na
        if (mailbox_name)
                SNPRINTF(sql_query_string + strlen(sql_query_string), QUERY_SIZE-(strlen(sql_query_string)+1), " WHERE UPPER(mailbox_name) = UPPER('%s') ", mailbox_name);
        else    /*  NULL  means all mailbox_name. but except for trash(3), spambox(5), all emails(for GMail, 7) */
-               SNPRINTF(sql_query_string + strlen(sql_query_string), QUERY_SIZE-(strlen(sql_query_string)+1), " WHERE mailbox_type not in (3, 5, 7) ");
+               SNPRINTF(sql_query_string + strlen(sql_query_string), QUERY_SIZE-(strlen(sql_query_string)+1), " WHERE mailbox_type not in (3, 5, 7, 8) ");
 
        /*  account id */
        /*  '0' (ALL_ACCOUNT) means all account */
@@ -11270,15 +11234,15 @@ EXPORT_API int em_storage_get_sender_list(int account_id, const char *mailbox_na
 
        EM_DEBUG_LOG("query[%s]", sql_query_string);
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, &count, 0, NULL), rc);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc && -1 != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, &count, 0, NULL), rc);
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc && -1 != rc), {error = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        EM_DEBUG_LOG("Count of Sender [%d]", count);
        
-       if (!(p_sender_list = (emf_sender_list_t*)em_core_malloc(sizeof(emf_sender_list_t) * count))) {
-               EM_DEBUG_EXCEPTION("em_core_malloc failed...");
-               error = EM_STORAGE_ERROR_OUT_OF_MEMORY;
+       if (!(p_sender_list = (emf_sender_list_t*)em_malloc(sizeof(emf_sender_list_t) * count))) {
+               EM_DEBUG_EXCEPTION("em_malloc failed...");
+               error = EMF_ERROR_OUT_OF_MEMORY;
                goto FINISH_OFF;
        }
 
@@ -11286,10 +11250,10 @@ EXPORT_API int em_storage_get_sender_list(int account_id, const char *mailbox_na
 
        EM_DEBUG_LOG(">>>> DATA ASSIGN START >>");      
        for (i = 0; i < count; i++)  {
-               _getTableFieldDataString(result, &(p_sender_list[i].address), 1, col_index++);
-               _getTableFieldDataString(result, &(p_sender_list[i].display_name), 1, col_index++);
-               _getTableFieldDataInt(result, &(p_sender_list[i].total_count), col_index++);
-               _getTableFieldDataInt(result, &(read_count), col_index++);
+               _get_table_field_data_string(result, &(p_sender_list[i].address), 1, col_index++);
+               _get_table_field_data_string(result, &(p_sender_list[i].display_name), 1, col_index++);
+               _get_table_field_data_int(result, &(p_sender_list[i].total_count), col_index++);
+               _get_table_field_data_int(result, &(read_count), col_index++);
                p_sender_list[i].unread_count = p_sender_list[i].total_count - read_count;              /*  unread count = total - read          */
        }
        EM_DEBUG_LOG(">>>> DATA ASSIGN END [count : %d] >>", count);
@@ -11306,7 +11270,7 @@ FINISH_OFF:
                EM_DEBUG_LOG(">>>> COUNT : %d >>", count);
        }
        else if (p_sender_list != NULL)
-               em_storage_free_sender_list(&p_sender_list, count);
+               emstorage_free_sender_list(&p_sender_list, count);
                
        _DISCONNECT_DB;
        
@@ -11317,7 +11281,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_free_sender_list(emf_sender_list_t **sender_list, int count)
+INTERNAL_FUNC int emstorage_free_sender_list(emf_sender_list_t **sender_list, int count)
 {
        EM_DEBUG_FUNC_BEGIN("sender_list[%p], count[%d]", sender_list, count);
 
@@ -11345,357 +11309,8 @@ EXPORT_API int em_storage_free_sender_list(emf_sender_list_t **sender_list, int
        return err;
 }
 
-#ifdef _CONTACT_SUBSCRIBE_CHANGE_
-
-#define MAX_BUFFER_LEN                                         8096
-#define DEBUG_EMAIL
-
-#ifdef DEBUG_EMAIL
-static void em_storage_contact_sync_print_email_list(int contact_id, char *display_name, GSList *email_list)
-{
-       EM_DEBUG_FUNC_BEGIN();
-
-       int i;
-       GSList *cursor = NULL;
-
-       EM_DEBUG_LOG("====================================================================================");
-       EM_DEBUG_LOG("Contact ID : [%d] Display Name : [%s]",  contact_id, display_name);
-       EM_DEBUG_LOG("====================================================================================");
-       EM_DEBUG_LOG(" order  email_type  email");
-       EM_DEBUG_LOG("====================================================================================");
-       i = 0;
-       for (cursor = email_list; cursor; cursor = g_slist_next(cursor)) {
-               EM_DEBUG_LOG("[%d] [%d] [%-35s]",
-                       i,
-                       contacts_svc_value_get_int(cursor->data, CTS_EMAIL_VAL_TYPE_INT),
-                       contacts_svc_value_get_str(cursor->data, CTS_EMAIL_VAL_ADDR_STR));
-               i++;
-       }       
-       EM_DEBUG_LOG("====================================================================================");
-}
-#endif
-
-EXPORT_API int em_storage_contact_sync_insert(int contact_id, char *display_name, GSList *email_list, int *err_code)
-{
-       EM_DEBUG_FUNC_BEGIN();
-
-       int ret = false;
-
-       int rc = 0;
-       char address_list[MAX_BUFFER_LEN];
-       int address_list_len = 0;
-       int error;
-               int index = 0;
-       int is_first = 1;
-       DB_STMT hStmt = NULL;
-       char sql_query_string[QUERY_SIZE] = {0, };
-       GSList *cursor;
-       const char *email_address = NULL;
-       char *display_name_in_mail_tbl = NULL;
-
-       EM_DEBUG_LOG(" Contact ID : [%d] Display Name : [%s] email_list[%p]", contact_id, display_name, email_list);
-       if (display_name == NULL || email_list == NULL) {
-               EM_DEBUG_LOG(" Input Parameter is NULL");
-               return false;
-       }
-
-#ifdef DEBUG_EMAIL
-       em_storage_contact_sync_print_email_list(contact_id, display_name, email_list);
-#endif
-
-       /*  Make address list */
-       cursor = email_list;
-       is_first = 1;
-       address_list_len = 0;
-       for (;cursor; cursor = g_slist_next(cursor)) {
-               email_address = contacts_svc_value_get_str(cursor->data, CTS_EMAIL_VAL_ADDR_STR);
-               if (strlen(email_address) <= 0)
-                       continue;
-               if (is_first) {
-                       is_first = 0;
-                       snprintf(address_list+address_list_len, sizeof(address_list) - (1 + address_list_len), "'%s' ", email_address);
-                       address_list_len = strlen(address_list);
-               }
-               else {
-                       snprintf(address_list+address_list_len, sizeof(address_list) - (1 + address_list_len), ", '%s' ", email_address);
-                       address_list_len = strlen(address_list);                
-               }
-       }
-       EM_DEBUG_LOG("address list[%s]", address_list);
-
-       int display_name_in_mail_tbl_len = strlen(display_name) + 4;
-       display_name_in_mail_tbl = (char *) malloc(sizeof(char)*display_name_in_mail_tbl_len);
-       if (display_name_in_mail_tbl == NULL) {
-               EM_DEBUG_EXCEPTION("Out of memory");
-               goto FINISH_OFF;
-       }
-       snprintf(display_name_in_mail_tbl, display_name_in_mail_tbl_len - 1, "\"%s\"", display_name);
-       EM_DEBUG_LOG("display_name_in_mail_tbl[%s]", display_name_in_mail_tbl);
-       
-       /*  Update mail_tbl : from_contact_name, to_contact_name */
-       memset(sql_query_string, 0x00, sizeof(sql_query_string));
-       snprintf(sql_query_string, sizeof(sql_query_string), "UPDATE mail_tbl SET from_contact_id = %d, from_contact_name = ? WHERE email_address_sender IN ( %s );", contact_id,  address_list);
-       EM_DEBUG_LOG(" Query[%s]", sql_query_string);
-
-       
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
-               ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
-
-       index = 0;
-       _bindStmtFieldDataString(hStmt, index++, (char *)display_name_in_mail_tbl, 0, 0);
-       
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
-               ("sqlite3_step fail:%d", rc));
-
-       if (hStmt != NULL)  {
-               rc = sqlite3_finalize(hStmt);
-               if (rc != SQLITE_OK)  {
-                       EM_DEBUG_LOG(" sqlite3_finalize failed - %d", rc);
-                       goto FINISH_OFF;
-               }
-       }       
-
-       memset(sql_query_string, 0x00, sizeof(sql_query_string));
-       snprintf(sql_query_string, sizeof(sql_query_string), "UPDATE mail_tbl SET to_contact_id = %d, to_contact_name = ? WHERE email_address_recipient IN ( %s );", contact_id, address_list);
-       EM_DEBUG_LOG(" Query[%s]", sql_query_string);
-
-       
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
-               ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
-
-       index = 0;
-       _bindStmtFieldDataString(hStmt, index++, (char *)display_name_in_mail_tbl, 0, 0);
-       
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
-               ("sqlite3_step fail:%d", rc));
-
-       if (hStmt != NULL)  {
-               rc = sqlite3_finalize(hStmt);
-               if (rc != SQLITE_OK)  {
-                       EM_DEBUG_LOG(" sqlite3_finalize failed - %d", rc);
-                       goto FINISH_OFF;
-               }
-       }
-
-       ret = true;
-FINISH_OFF:
-       EM_SAFE_FREE(display_name_in_mail_tbl);
-       
-       EM_DEBUG_FUNC_END("ret [%d]", ret);
-       return ret;
-}
-
-EXPORT_API int em_storage_contact_sync_update(int contact_id, char *display_name, GSList *email_list, int *err_code)
-{
-       EM_DEBUG_FUNC_BEGIN();
-
-       int ret = false;
-       int rc = 0;
-       char address_list[MAX_BUFFER_LEN];
-       int address_list_len = 0;
-       int error;
-       DB_STMT hStmt = NULL;
-       char sql_query_string[QUERY_SIZE] = {0, };
-       int index = 0;
-       int is_first = 1;
-       int row, col;
-       GSList *cursor;
-       const char *email_address = NULL;
-       char *display_name_in_mail_tbl = NULL;
-
-       EM_DEBUG_LOG(" Contact ID : [%d] Display Name : [%s] email_list[%p]", contact_id, display_name, email_list);
-       if (display_name == NULL || email_list == NULL) {
-               EM_DEBUG_LOG(" Input Parameter is NULL");
-               return false;
-       }
 
-#ifdef DEBUG_EMAIL
-       em_storage_contact_sync_print_email_list(contact_id, display_name, email_list);
-#endif
-
-       /*  Make address list */
-       cursor = email_list;
-       is_first = 1;
-       address_list_len = 0;
-       for (;cursor; cursor = g_slist_next(cursor)) {
-               email_address = contacts_svc_value_get_str(cursor->data, CTS_EMAIL_VAL_ADDR_STR);
-               if (strlen(email_address) <= 0)
-                       continue;
-               if (is_first) {
-                       is_first = 0;
-                       snprintf(address_list+address_list_len, sizeof(address_list) - (1 + address_list_len), "'%s' ", email_address);
-                       address_list_len = strlen(address_list);
-               }
-               else {
-                       snprintf(address_list+address_list_len, sizeof(address_list) - (1 + address_list_len), ", '%s' ", email_address);
-                       address_list_len = strlen(address_list);                
-               }
-       }
-       EM_DEBUG_LOG("address list[%s]", address_list);
-
-       int display_name_in_mail_tbl_len = strlen(display_name) + 4;
-       display_name_in_mail_tbl = (char *) malloc(sizeof(char)*display_name_in_mail_tbl_len);
-       if (display_name_in_mail_tbl == NULL) {
-               EM_DEBUG_EXCEPTION("Out of memory");
-               goto FINISH_OFF;
-       }
-       snprintf(display_name_in_mail_tbl, display_name_in_mail_tbl_len - 1, "\"%s\"", display_name);
-       EM_DEBUG_LOG("display_name_in_mail_tbl[%s]", display_name_in_mail_tbl);
-
-
-       /*  Update mail_tbl : deleted emails full_address_from contact */
-       char **result2 = NULL;
-       memset(sql_query_string, 0x00, sizeof(sql_query_string));
-       snprintf(sql_query_string, sizeof(sql_query_string), "UPDATE mail_tbl SET from_contact_id = -1, from_contact_name = alias_sender "
-               " WHERE from_contact_id = %d "
-               " AND email_address_sender NOT IN ( %s ); ",
-               contact_id, address_list);
-       EM_DEBUG_LOG(" Query[%s]", sql_query_string);
-       rc = sqlite3_get_table(local_db_handle, sql_query_string, &result2, &row, &col, NULL);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
-               ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
-
-       sqlite3_free_table(result2);
-
-       memset(sql_query_string, 0x00, sizeof(sql_query_string));
-       snprintf(sql_query_string, sizeof(sql_query_string), "UPDATE mail_tbl SET to_contact_id = -1, to_contact_name = alias_recipient "
-               " WHERE to_contact_id = %d "
-               " AND email_address_recipient NOT IN ( %s ); ",
-               contact_id, address_list);
-       EM_DEBUG_LOG(" Query[%s]", sql_query_string);
-       rc = sqlite3_get_table(local_db_handle, sql_query_string, &result2, &row, &col, NULL);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
-               ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
-
-       sqlite3_free_table(result2);
-
-       /*  Update mail_tbl : inserted emails from contact */
-       memset(sql_query_string, 0x00, sizeof(sql_query_string));
-       snprintf(sql_query_string, sizeof(sql_query_string), "UPDATE mail_tbl SET from_contact_name = ?, from_contact_id = %d WHERE email_address_sender IN ( %s ); ",
-               contact_id, address_list);
-       EM_DEBUG_LOG(" Query[%s]", sql_query_string);
-       /*  rc = sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL);   */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
-               ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
-
-       index = 0;
-       _bindStmtFieldDataString(hStmt, index++, (char *)display_name_in_mail_tbl, 0, 0);
-
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
-               ("sqlite3_step fail:%d", rc));
-
-       if (hStmt != NULL)  {
-               rc = sqlite3_finalize(hStmt);
-               if (rc != SQLITE_OK)  {
-                       EM_DEBUG_LOG(" sqlite3_finalize failed - %d", rc);
-                       goto FINISH_OFF;
-               }
-       }       
-       
-       memset(sql_query_string, 0x00, sizeof(sql_query_string));
-       snprintf(sql_query_string, sizeof(sql_query_string), "UPDATE mail_tbl SET to_contact_name = ?, to_contact_id = %d WHERE email_address_recipient IN ( %s ); ",
-               contact_id, address_list);
-       EM_DEBUG_LOG(" Query[%s]", sql_query_string);
-       /*  rc = sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL);   */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
-               ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
-
-       index = 0;
-       _bindStmtFieldDataString(hStmt, index++, (char *)display_name_in_mail_tbl, 0, 0);
-
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
-               ("sqlite3_step fail:%d", rc));
-
-       if (hStmt != NULL)  {
-               rc = sqlite3_finalize(hStmt);
-               if (rc != SQLITE_OK)  {
-                       EM_DEBUG_LOG(" sqlite3_finalize failed - %d", rc);
-                       goto FINISH_OFF;
-               }
-       }               
-
-       ret = true;
-FINISH_OFF:
-       EM_SAFE_FREE(display_name_in_mail_tbl);
-       
-       EM_DEBUG_FUNC_END("ret [%d]", ret);
-       return ret;
-}
-
-EXPORT_API int em_storage_contact_sync_delete(int contact_id, int *err_code)
-{
-       EM_DEBUG_FUNC_BEGIN();
-
-       int rc;
-       int ret = false;
-       sqlite3_stmt* hStmt = NULL;
-       int error;
-       char sql_query_string[QUERY_SIZE] = {0, };
-
-       /*  Update mail_tbl : set display name to alias */
-       memset(sql_query_string, 0x00, sizeof(sql_query_string));
-       snprintf(sql_query_string, sizeof(sql_query_string), "UPDATE mail_tbl SET from_contact_id = -1,  from_contact_name = alias_sender  WHERE from_contact_id = %d", contact_id);
-       EM_DEBUG_LOG(" Query[%s]", sql_query_string);
-       
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
-               ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
-
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
-               ("sqlite3_step fail:%d", rc));
-
-       if (hStmt != NULL)  {   /*  finalize and reuse hStmt later */
-               rc = sqlite3_finalize(hStmt);
-               if (rc != SQLITE_OK)  {
-                       EM_DEBUG_LOG(" sqlite3_finalize failed - %d", rc);
-               }
-       }
-
-       memset(sql_query_string, 0x00, sizeof(sql_query_string));
-       snprintf(sql_query_string, sizeof(sql_query_string), "UPDATE mail_tbl SET to_contact_id = -1, to_contact_name = alias_recipient  WHERE to_contact_id = %d", contact_id);
-       EM_DEBUG_LOG(" Query[%s]", sql_query_string);
-       
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
-               ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
-
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
-               ("sqlite3_step fail:%d", rc));
-
-       if (hStmt != NULL)  {   /*  finalize and reuse hStmt later */
-               rc = sqlite3_finalize(hStmt);
-               if (rc != SQLITE_OK)  {
-                       EM_DEBUG_LOG(" sqlite3_finalize failed - %d", rc);
-               }
-       }
-
-       ret = true;
-FINISH_OFF:
-       
-       EM_DEBUG_FUNC_END("ret [%d]", ret);
-       return ret;
-}
-
-#endif /*  _CONTACT_SUBSCRIBE_CHANGE_ */
-
-
-EXPORT_API int em_storage_free_address_info_list(emf_address_info_list_t **address_info_list)
+INTERNAL_FUNC int emstorage_free_address_info_list(emf_address_info_list_t **address_info_list)
 {
        EM_DEBUG_FUNC_BEGIN("address_info_list[%p]", address_info_list);
 
@@ -11748,26 +11363,26 @@ EXPORT_API int em_storage_free_address_info_list(emf_address_info_list_t **addre
 }
 #ifdef __FEATURE_PARTIAL_BODY_DOWNLOAD__
 
-EXPORT_API int em_storage_add_pbd_activity(emf_event_partial_body_thd* local_activity, int *activity_id, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_add_pbd_activity(emf_event_partial_body_thd* local_activity, int *activity_id, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("local_activity[%p], activity_id[%p], transaction[%d], err_code[%p]", local_activity, activity_id, transaction, err_code);
 
        if (!local_activity || !activity_id) {
                EM_DEBUG_EXCEPTION("local_activity[%p], transaction[%d], activity_id[%p], err_code[%p]", local_activity, activity_id, transaction, err_code);
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
 
        int rc = -1;
        int ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        int i = 0;
 
        char sql_query_string[QUERY_SIZE] = {0, };
        DB_STMT hStmt = NULL;
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
        memset(sql_query_string, 0x00, sizeof(sql_query_string));
        SNPRINTF(sql_query_string, sizeof(sql_query_string),
                "INSERT INTO mail_partial_body_activity_tbl VALUES "
@@ -11783,10 +11398,10 @@ EXPORT_API int em_storage_add_pbd_activity(emf_event_partial_body_thd* local_act
        char *sql = "SELECT max(rowid) FROM mail_partial_body_activity_tbl;";
        char **result = NULL;
 
-       /*  rc = sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL);  */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL), rc);
 
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL), rc);
+
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql, rc, sqlite3_errmsg(local_db_handle)));
 
        if (NULL==result[1]) rc = 1;
@@ -11803,25 +11418,25 @@ EXPORT_API int em_storage_add_pbd_activity(emf_event_partial_body_thd* local_act
                EM_DEBUG_LOG(" MAILBOX NAME [ %s ]", local_activity->mailbox_name);
        
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        EM_DEBUG_LOG(">>>> SQL STMT [ %s ]", sql_query_string);
        
-       _bindStmtFieldDataInt(hStmt, i++, local_activity->account_id);
-       _bindStmtFieldDataInt(hStmt, i++, local_activity->mail_id);
-       _bindStmtFieldDataInt(hStmt, i++, local_activity->server_mail_id);
-       _bindStmtFieldDataInt(hStmt, i++, local_activity->activity_id);
-       _bindStmtFieldDataInt(hStmt, i++, local_activity->activity_type);
-       _bindStmtFieldDataString(hStmt, i++ , (char *)local_activity->mailbox_name, 0, 3999);
+       _bind_stmt_field_data_int(hStmt, i++, local_activity->account_id);
+       _bind_stmt_field_data_int(hStmt, i++, local_activity->mail_id);
+       _bind_stmt_field_data_int(hStmt, i++, local_activity->server_mail_id);
+       _bind_stmt_field_data_int(hStmt, i++, local_activity->activity_id);
+       _bind_stmt_field_data_int(hStmt, i++, local_activity->activity_type);
+       _bind_stmt_field_data_string(hStmt, i++ , (char *)local_activity->mailbox_name, 0, 3999);
 
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
 
-       EM_DEBUG_DB_EXEC((rc == SQLITE_FULL), {error = EM_STORAGE_ERROR_DB_IS_FULL;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+
+       EM_DEBUG_DB_EXEC((rc == SQLITE_FULL), {error = EMF_ERROR_MAIL_MEMORY_FULL;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("sqlite3_step fail:%d, errmsg = %s.", rc, sqlite3_errmsg(local_db_handle)));
        
        ret = true;
@@ -11835,11 +11450,11 @@ FINISH_OFF:
                hStmt = NULL;
                if (rc != SQLITE_OK) {
                        EM_DEBUG_EXCEPTION("sqlite3_finalize failed - %d", rc);
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
        }
 
-        EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+        EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        _DISCONNECT_DB;
         if (err_code != NULL)
                 *err_code = error;
@@ -11849,35 +11464,35 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int em_storage_get_pbd_mailbox_list(int account_id, char *** mailbox_list, int *count, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_get_pbd_mailbox_list(int account_id, char *** mailbox_list, int *count, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], mailbox_list[%p], count[%p] err_code[%p]", account_id, mailbox_list, count, err_code);
 
        if (account_id < FIRST_ACCOUNT_ID || NULL == &mailbox_list || NULL == count) {
                EM_DEBUG_EXCEPTION("account_id[%d], mailbox_list[%p], count[%p] err_code[%p]", account_id, mailbox_list, count, err_code);
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
 
        int ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        char **result;
        int i = 0, rc = -1;
        char **mbox_list = NULL;
        DB_STMT hStmt = NULL;
        char sql_query_string[QUERY_SIZE] = {0, };
 
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
        
-       EM_STORAGE_START_READ_TRANSACTION(transaction);
+       EMSTORAGE_START_READ_TRANSACTION(transaction);
 
        memset(sql_query_string, 0x00, sizeof(sql_query_string));
        SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT count(distinct mailbox_name) FROM mail_partial_body_activity_tbl WHERE account_id = %d order by mailbox_name", account_id);
 
-       /*  rc = sqlite3_get_table(local_db_handle, sql_query_string, &result, NULL, NULL, NULL); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        *count = atoi(result[1]);
@@ -11885,7 +11500,7 @@ EXPORT_API int em_storage_get_pbd_mailbox_list(int account_id, char *** mailbox_
 
        if (!*count) {
                EM_DEBUG_EXCEPTION(" no mailbox_name found...");
-               error = EM_STORAGE_ERROR_MAILBOX_NOT_FOUND;
+               error = EMF_ERROR_MAILBOX_NOT_FOUND;
                ret = true;
                goto FINISH_OFF;
        }
@@ -11899,31 +11514,31 @@ EXPORT_API int em_storage_get_pbd_mailbox_list(int account_id, char *** mailbox_
        EM_DEBUG_LOG(" Query [%s]", sql_query_string);
        
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
 
        EM_DEBUG_LOG(" Bbefore sqlite3_prepare hStmt = %p", hStmt);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
        
-       if (NULL == (mbox_list = (char **)em_core_malloc(sizeof(char *) * (*count)))) {
-               EM_DEBUG_EXCEPTION(" em_core_malloc failed...");
-               error = EM_STORAGE_ERROR_OUT_OF_MEMORY;
+       if (NULL == (mbox_list = (char **)em_malloc(sizeof(char *) * (*count)))) {
+               EM_DEBUG_EXCEPTION(" em_malloc failed...");
+               error = EMF_ERROR_OUT_OF_MEMORY;
                goto FINISH_OFF;
        }
 
        memset(mbox_list, 0x00, sizeof(char *) * (*count));
        
        for (i = 0; i < (*count); i++) {
-               _getStmtFieldDataString(hStmt, &mbox_list[i], 0, ACCOUNT_IDX_MAIL_PARTIAL_BODY_ACTIVITY_TBL);
-               /*  rc = sqlite3_step(hStmt); */
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-               /* EM_DEBUG_LOG("In em_storage_get_pdb_mailbox_list() loop, After sqlite3_step(), , i = %d, rc = %d.", i,  rc); */
-               EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+               _get_stmt_field_data_string(hStmt, &mbox_list[i], 0, ACCOUNT_IDX_MAIL_PARTIAL_BODY_ACTIVITY_TBL);
+
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+               /* EM_DEBUG_LOG("In emstorage_get_pdb_mailbox_list() loop, After sqlite3_step(), , i = %d, rc = %d.", i,  rc); */
+               EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                        ("sqlite3_step fail:%d", rc));
                EM_DEBUG_LOG("mbox_list %s", mbox_list[i]);
        }
@@ -11941,11 +11556,11 @@ FINISH_OFF:
                hStmt = NULL;
                if (rc != SQLITE_OK) {
                        EM_DEBUG_EXCEPTION(" sqlite3_finalize failed - %d", rc);
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
        }
 
-       EM_STORAGE_FINISH_READ_TRANSACTION(transaction);
+       EMSTORAGE_FINISH_READ_TRANSACTION(transaction);
        _DISCONNECT_DB;
        if (err_code != NULL)
                *err_code = error;
@@ -11954,19 +11569,19 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int em_storage_get_pbd_account_list(int **account_list, int *count, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_get_pbd_account_list(int **account_list, int *count, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("mailbox_list[%p], count[%p] err_code[%p]", account_list, count, err_code);
 
        if (NULL == &account_list || NULL == count) {
                EM_DEBUG_EXCEPTION("mailbox_list[%p], count[%p] err_code[%p]", account_list, count, err_code);
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
 
        int ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        char *sql;
        char **result;
        int i = 0, rc = -1;
@@ -11974,16 +11589,16 @@ EXPORT_API int em_storage_get_pbd_account_list(int **account_list, int *count, i
        DB_STMT hStmt = NULL;
        char sql_query_string[QUERY_SIZE] = {0, };
 
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
        
-       EM_STORAGE_START_READ_TRANSACTION(transaction);
+       EMSTORAGE_START_READ_TRANSACTION(transaction);
 
 
        sql = "SELECT count(distinct account_id) FROM mail_partial_body_activity_tbl";  
 
-       /*  rc = sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL);  */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql, rc, sqlite3_errmsg(local_db_handle)));
 
        *count = atoi(result[1]);
@@ -11991,7 +11606,7 @@ EXPORT_API int em_storage_get_pbd_account_list(int **account_list, int *count, i
 
        if (!*count) {
                EM_DEBUG_EXCEPTION("no account found...");
-               error = EM_STORAGE_ERROR_MAILBOX_NOT_FOUND;
+               error = EMF_ERROR_MAILBOX_NOT_FOUND;
                ret = true;
                goto FINISH_OFF;
        }
@@ -12005,30 +11620,30 @@ EXPORT_API int em_storage_get_pbd_account_list(int **account_list, int *count, i
        EM_DEBUG_LOG("Query [%s]", sql_query_string);
        
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
 
        EM_DEBUG_LOG("Before sqlite3_prepare hStmt = %p", hStmt);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
        
-       if (NULL == (result_account_list = (int *)em_core_malloc(sizeof(int) * (*count)))) {
-               EM_DEBUG_EXCEPTION(" em_core_malloc failed...");
-               error = EM_STORAGE_ERROR_OUT_OF_MEMORY;
+       if (NULL == (result_account_list = (int *)em_malloc(sizeof(int) * (*count)))) {
+               EM_DEBUG_EXCEPTION(" em_malloc failed...");
+               error = EMF_ERROR_OUT_OF_MEMORY;
                goto FINISH_OFF;
        }
 
        memset(result_account_list, 0x00, sizeof(int) * (*count));
        
        for (i = 0; i < (*count); i++) {
-               _getStmtFieldDataInt(hStmt, result_account_list + i, 0);
-               /*  rc = sqlite3_step(hStmt); */
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-               EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+               _get_stmt_field_data_int(hStmt, result_account_list + i, 0);
+
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+               EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                        ("sqlite3_step fail:%d", rc));
                EM_DEBUG_LOG("account id -> %d", result_account_list[i]);
        }
@@ -12046,11 +11661,11 @@ FINISH_OFF:
                hStmt = NULL;
                if (rc != SQLITE_OK) {
                        EM_DEBUG_EXCEPTION("sqlite3_finalize failed - %d", rc);
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
        }
 
-       EM_STORAGE_FINISH_READ_TRANSACTION(transaction);
+       EMSTORAGE_FINISH_READ_TRANSACTION(transaction);
        _DISCONNECT_DB;
        if (err_code != NULL)
                *err_code = error;
@@ -12060,7 +11675,7 @@ FINISH_OFF:
 
 
 
-EXPORT_API int em_storage_get_pbd_activity_data(int account_id, char *mailbox_name, emf_event_partial_body_thd** event_start, int *count, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_get_pbd_activity_data(int account_id, char *mailbox_name, emf_event_partial_body_thd** event_start, int *count, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], event_start[%p], err_code[%p]", account_id, event_start, err_code);
 
@@ -12068,29 +11683,29 @@ EXPORT_API int em_storage_get_pbd_activity_data(int account_id, char *mailbox_na
                EM_DEBUG_EXCEPTION("account_id[%d], emf_event_partial_body_thd[%p], mailbox_name[%p], count[%p], err_code[%p]", account_id, event_start, mailbox_name, count, err_code);
 
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
 
        int rc = -1;
        int ret = false;
        char **result;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        int i = 0;
        DB_STMT hStmt = NULL;
        emf_event_partial_body_thd* event_list = NULL;
        char sql_query_string[QUERY_SIZE] = {0, };
 
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
        
-       EM_STORAGE_START_READ_TRANSACTION(transaction);
+       EMSTORAGE_START_READ_TRANSACTION(transaction);
 
        memset(sql_query_string, 0x00, sizeof(sql_query_string));
        SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT count(*) FROM mail_partial_body_activity_tbl WHERE account_id = %d AND mailbox_name = '%s' order by activity_id", account_id, mailbox_name);
        
-       /*  rc = sqlite3_get_table(local_db_handle, sql_query_string, &result, NULL, NULL, NULL); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        *count = atoi(result[1]);
@@ -12101,7 +11716,7 @@ EXPORT_API int em_storage_get_pbd_activity_data(int account_id, char *mailbox_na
        if (!*count) {
                EM_DEBUG_EXCEPTION("No matched activity found in mail_partial_body_activity_tbl");
 
-               error = EM_STORAGE_ERROR_MAIL_NOT_FOUND;
+               error = EMF_ERROR_MAIL_NOT_FOUND;
                ret = true;
                goto FINISH_OFF;
        }
@@ -12113,37 +11728,37 @@ EXPORT_API int em_storage_get_pbd_activity_data(int account_id, char *mailbox_na
        EM_DEBUG_LOG("Query [%s]", sql_query_string);
 
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
 
        EM_DEBUG_LOG(" Bbefore sqlite3_prepare hStmt = %p", hStmt);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
        
-       if (!(event_list = (emf_event_partial_body_thd*)em_core_malloc(sizeof(emf_event_partial_body_thd) * (*count)))) {
+       if (!(event_list = (emf_event_partial_body_thd*)em_malloc(sizeof(emf_event_partial_body_thd) * (*count)))) {
                EM_DEBUG_EXCEPTION("Malloc failed");
 
-               error = EM_STORAGE_ERROR_OUT_OF_MEMORY;
+               error = EMF_ERROR_OUT_OF_MEMORY;
                goto FINISH_OFF;
        }
        memset(event_list, 0x00, sizeof(emf_event_partial_body_thd) * (*count));
        
        for (i=0; i < (*count); i++) {
-               _getStmtFieldDataInt(hStmt, &(event_list[i].account_id), ACCOUNT_IDX_MAIL_PARTIAL_BODY_ACTIVITY_TBL);
-               _getStmtFieldDataInt(hStmt, &(event_list[i].mail_id), MAIL_IDX_IN_MAIL_PARTIAL_BODY_ACTIVITY_TBL);
-               _getStmtFieldDataInt(hStmt, (int *)&(event_list[i].server_mail_id), SERVER_MAIL_IDX_IN_MAIL_PARTIAL_BODY_ACTIVITY_TBL);
-               _getStmtFieldDataInt(hStmt, &(event_list[i].activity_id), ACTIVITY_IDX_IN_MAIL_PARTIAL_BODY_ACTIVITY_TBL);
-               _getStmtFieldDataInt(hStmt, &(event_list[i].activity_type), ACTIVITY_TYPE_IDX_IN_MAIL_PARTIAL_BODY_ACTIVITY_TBL);
-               _getStmtFieldDataString(hStmt, &(event_list[i].mailbox_name), 0, MAILBOX_NAME_IDX_IN_MAIL_PARTIAL_BODY_ACTIVITY_TBL);
-               
-               /*  rc = sqlite3_step(hStmt); */
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-               /* EM_DEBUG_LOG("In em_storage_get_pbd_activity_data() loop, After sqlite3_step(), , i = %d, rc = %d.", i,  rc); */
-               EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+               _get_stmt_field_data_int(hStmt, &(event_list[i].account_id), ACCOUNT_IDX_MAIL_PARTIAL_BODY_ACTIVITY_TBL);
+               _get_stmt_field_data_int(hStmt, &(event_list[i].mail_id), MAIL_IDX_IN_MAIL_PARTIAL_BODY_ACTIVITY_TBL);
+               _get_stmt_field_data_int(hStmt, (int *)&(event_list[i].server_mail_id), SERVER_MAIL_IDX_IN_MAIL_PARTIAL_BODY_ACTIVITY_TBL);
+               _get_stmt_field_data_int(hStmt, &(event_list[i].activity_id), ACTIVITY_IDX_IN_MAIL_PARTIAL_BODY_ACTIVITY_TBL);
+               _get_stmt_field_data_int(hStmt, &(event_list[i].activity_type), ACTIVITY_TYPE_IDX_IN_MAIL_PARTIAL_BODY_ACTIVITY_TBL);
+               _get_stmt_field_data_string(hStmt, &(event_list[i].mailbox_name), 0, MAILBOX_NAME_IDX_IN_MAIL_PARTIAL_BODY_ACTIVITY_TBL);
+               
+
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+               /* EM_DEBUG_LOG("In emstorage_get_pbd_activity_data() loop, After sqlite3_step(), , i = %d, rc = %d.", i,  rc); */
+               EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                        ("sqlite3_step fail:%d", rc));
 
                event_list[i].event_type = 0;
@@ -12169,11 +11784,11 @@ FINISH_OFF:
                hStmt = NULL;
                if (rc != SQLITE_OK) {
                        EM_DEBUG_LOG("sqlite3_finalize failed - %d", rc);
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
        }
 
-       EM_STORAGE_FINISH_READ_TRANSACTION(transaction);
+       EMSTORAGE_FINISH_READ_TRANSACTION(transaction);
        _DISCONNECT_DB;
        if (err_code != NULL)
                *err_code = error;
@@ -12184,7 +11799,7 @@ FINISH_OFF:
 
 
 
-EXPORT_API int em_storage_delete_pbd_activity(int account_id, int mail_id, int activity_id, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_delete_pbd_activity(int account_id, int mail_id, int activity_id, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], mail_id[%d] , activity_id[%d], transaction[%d], err_code[%p]", account_id, mail_id, activity_id, transaction, err_code);
 
@@ -12193,18 +11808,18 @@ EXPORT_API int em_storage_delete_pbd_activity(int account_id, int mail_id, int a
                EM_DEBUG_EXCEPTION("account_id[%d], mail_id[%d], activity_id[%d], transaction[%d], err_code[%p]", account_id, mail_id, activity_id, transaction, err_code);
 
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
 
        int rc = -1;
        int ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        char sql_query_string[QUERY_SIZE] = {0, };
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
        
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
        memset(sql_query_string, 0x00, sizeof(sql_query_string));
        
        if (activity_id == 0)
@@ -12214,17 +11829,17 @@ EXPORT_API int em_storage_delete_pbd_activity(int account_id, int mail_id, int a
 
        EM_DEBUG_LOG("Query [%s]", sql_query_string);
 
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC((rc == SQLITE_FULL), {error = EM_STORAGE_ERROR_DB_IS_FULL;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC((rc == SQLITE_FULL), {error = EMF_ERROR_MAIL_MEMORY_FULL;goto FINISH_OFF; },
                ("sqlite3_exec fail:%d", rc));
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        /*  validate activity existence */
        rc = sqlite3_changes(local_db_handle);
        if (rc == 0)  {
                EM_DEBUG_EXCEPTION("No matching activity found");
-               error = EM_STORAGE_ERROR_DATA_NOT_FOUND;
+               error = EMF_ERROR_DATA_NOT_FOUND;
                ret = true;
                goto FINISH_OFF;
        }
@@ -12233,7 +11848,7 @@ EXPORT_API int em_storage_delete_pbd_activity(int account_id, int mail_id, int a
 
 FINISH_OFF:
        
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        
        _DISCONNECT_DB;
        if (err_code != NULL)
@@ -12243,26 +11858,26 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_get_mailbox_pbd_activity_count(int account_id, char *mailbox_name, int *activity_count, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_get_mailbox_pbd_activity_count(int account_id, char *mailbox_name, int *activity_count, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], activity_count[%p], err_code[%p]", account_id, activity_count, err_code);
 
        if (account_id < FIRST_ACCOUNT_ID || NULL == activity_count || NULL == err_code) {
                EM_DEBUG_EXCEPTION("account_id[%d], activity_count[%p], err_code[%p]", account_id, activity_count, err_code);
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        int rc = -1;
        int ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        char sql_query_string[QUERY_SIZE] = {0, };
 
        DB_STMT hStmt = NULL;
 
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
 
-       EM_STORAGE_START_READ_TRANSACTION(transaction);
+       EMSTORAGE_START_READ_TRANSACTION(transaction);
        memset(sql_query_string, 0x00, sizeof(sql_query_string));
        
        SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT count(*) FROM mail_partial_body_activity_tbl WHERE account_id = %d and mailbox_name = '%s'", account_id, mailbox_name);
@@ -12270,17 +11885,17 @@ EXPORT_API int em_storage_get_mailbox_pbd_activity_count(int account_id, char *m
        EM_DEBUG_LOG(" Query [%s]", sql_query_string);
 
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
        EM_DEBUG_LOG("before sqlite3_prepare hStmt = %p", hStmt);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
 
-       _getStmtFieldDataInt(hStmt, activity_count, 0);
+       _get_stmt_field_data_int(hStmt, activity_count, 0);
 
        EM_DEBUG_LOG("No. of activities in activity table [%d]", *activity_count);
 
@@ -12294,12 +11909,12 @@ FINISH_OFF:
                hStmt=NULL;
                if (rc != SQLITE_OK) {
                        EM_DEBUG_EXCEPTION("sqlite3_finalize failed - %d", rc);
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
                EM_DEBUG_LOG("sqlite3_finalize- %d", rc);
        }
 
-       EM_STORAGE_FINISH_READ_TRANSACTION(transaction);
+       EMSTORAGE_FINISH_READ_TRANSACTION(transaction);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -12310,25 +11925,25 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int em_storage_get_pbd_activity_count(int *activity_count, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_get_pbd_activity_count(int *activity_count, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("activity_count[%p], err_code[%p]", activity_count, err_code);
 
        if (NULL == activity_count || NULL == err_code) {
                EM_DEBUG_EXCEPTION("activity_count[%p], err_code[%p]", activity_count, err_code);
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        int rc = -1;
        int ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        DB_STMT hStmt = NULL;
        char sql_query_string[QUERY_SIZE] = {0, };
 
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
 
-       EM_STORAGE_START_READ_TRANSACTION(transaction);
+       EMSTORAGE_START_READ_TRANSACTION(transaction);
        memset(sql_query_string, 0x00, sizeof(sql_query_string));
        
        SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT count(*) FROM mail_partial_body_activity_tbl;");
@@ -12336,17 +11951,17 @@ EXPORT_API int em_storage_get_pbd_activity_count(int *activity_count, int transa
        EM_DEBUG_LOG(" Query [%s]", sql_query_string);
 
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
        EM_DEBUG_LOG("  before sqlite3_prepare hStmt = %p", hStmt);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
 
-       _getStmtFieldDataInt(hStmt, activity_count, 0);
+       _get_stmt_field_data_int(hStmt, activity_count, 0);
 
        EM_DEBUG_LOG("No. of activities in activity table [%d]", *activity_count);
 
@@ -12362,12 +11977,12 @@ FINISH_OFF:
                hStmt=NULL;
                if (rc != SQLITE_OK) {
                        EM_DEBUG_EXCEPTION("sqlite3_finalize failed - %d", rc);
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
                EM_DEBUG_LOG("sqlite3_finalize- %d", rc);
        }
 
-       EM_STORAGE_FINISH_READ_TRANSACTION(transaction);
+       EMSTORAGE_FINISH_READ_TRANSACTION(transaction);
        _DISCONNECT_DB;
        if (err_code != NULL)
                *err_code = error;
@@ -12376,39 +11991,39 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_delete_full_pbd_activity_data(int account_id, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_delete_full_pbd_activity_data(int account_id, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], transaction[%d], err_code[%p]", account_id, transaction, err_code);
        if (account_id < FIRST_ACCOUNT_ID) {
                EM_DEBUG_EXCEPTION("account_id[%d], transaction[%d], err_code[%p]", account_id, transaction, err_code);
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
 
        int rc = -1;
        int ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        char sql_query_string[QUERY_SIZE] = {0, };
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
        memset(sql_query_string, 0x00, sizeof(sql_query_string));
        SNPRINTF(sql_query_string, sizeof(sql_query_string), "DELETE FROM mail_partial_body_activity_tbl WHERE account_id = %d", account_id);
 
        EM_DEBUG_LOG("Query [%s]", sql_query_string);
 
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC((rc == SQLITE_FULL), {error = EM_STORAGE_ERROR_DB_IS_FULL;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC((rc == SQLITE_FULL), {error = EMF_ERROR_MAIL_MEMORY_FULL;goto FINISH_OFF; },
                ("sqlite3_exec fail:%d", rc));
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        
        rc = sqlite3_changes(local_db_handle);
        if (rc == 0) {
                EM_DEBUG_EXCEPTION("No matching activities found in mail_partial_body_activity_tbl");
-               error = EM_STORAGE_ERROR_DATA_NOT_FOUND;
+               error = EMF_ERROR_DATA_NOT_FOUND;
                ret = true;
                goto FINISH_OFF;
        }
@@ -12417,7 +12032,7 @@ EXPORT_API int em_storage_delete_full_pbd_activity_data(int account_id, int tran
 
 FINISH_OFF:
        
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        _DISCONNECT_DB;
        if (err_code != NULL)
                *err_code = error;
@@ -12429,40 +12044,40 @@ FINISH_OFF:
 /*Himanshu[h.gahlaut]-> Added below API to update mail_partial_body_activity_tbl
 if a mail is moved before its partial body is downloaded.Currently not used but should be used if mail move from server is enabled*/
 
-EXPORT_API int em_storage_update_pbd_activity(char *old_server_uid, char *new_server_uid, char *mbox_name, int *err_code)
+INTERNAL_FUNC int emstorage_update_pbd_activity(char *old_server_uid, char *new_server_uid, char *mbox_name, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("old_server_uid[%s], new_server_uid[%s], mbox_name[%s]", old_server_uid, new_server_uid, mbox_name);
 
        int rc = -1, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        char sql_query_string[QUERY_SIZE] = {0, };
 
        int transaction = true;
 
        if (!old_server_uid || !new_server_uid || !mbox_name)  {
                EM_DEBUG_EXCEPTION("Invalid parameters");
-               error = EM_STORAGE_ERROR_INVALID_PARAM;
+               error = EMF_ERROR_INVALID_PARAM;
                return false;
        }
 
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
        memset(sql_query_string, 0x00, sizeof(sql_query_string));
        SNPRINTF(sql_query_string, sizeof(sql_query_string),
                 "UPDATE mail_partial_body_activity_tbl SET server_mail_id = %s , mailbox_name=\'%s\' WHERE server_mail_id = %s ", new_server_uid, mbox_name, old_server_uid);
 
        EM_DEBUG_LOG("Query [%s]", sql_query_string);
 
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC((rc == SQLITE_FULL), {error = EM_STORAGE_ERROR_DB_IS_FULL;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC((rc == SQLITE_FULL), {error = EMF_ERROR_MAIL_MEMORY_FULL;goto FINISH_OFF; },
                ("sqlite3_exec fail:%d", rc));
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
        
        rc = sqlite3_changes(local_db_handle);
        if (rc == 0) {
                EM_DEBUG_EXCEPTION("No matching found in mail_partial_body_activity_tbl");
-               error = EM_STORAGE_ERROR_DATA_NOT_FOUND;
+               error = EMF_ERROR_DATA_NOT_FOUND;
                goto FINISH_OFF;
        }
 
@@ -12470,7 +12085,7 @@ EXPORT_API int em_storage_update_pbd_activity(char *old_server_uid, char *new_se
 
 FINISH_OFF:
 
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        _DISCONNECT_DB;
        if (err_code != NULL)
                *err_code = error;
@@ -12480,18 +12095,18 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int em_storage_create_file(char *data_string, size_t file_size, char *dst_file_name, int *err_code)
+INTERNAL_FUNC int emstorage_create_file(char *data_string, size_t file_size, char *dst_file_name, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("file_size[%d] , dst_file_name[%s], err_code[%p]", file_size, dst_file_name, err_code);
        
        int ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        
        FILE* fp_dst = NULL;
        
        if (!data_string || !dst_file_name)  {                          
                EM_DEBUG_EXCEPTION("data_string[%p], dst_file_name[%p]", data_string, dst_file_name);
-               error = EM_STORAGE_ERROR_INVALID_PARAM;
+               error = EMF_ERROR_INVALID_PARAM;
                goto FINISH_OFF;
        }
 
@@ -12502,13 +12117,13 @@ EXPORT_API int em_storage_create_file(char *data_string, size_t file_size, char
                if (errno == 28)
                        error = EMF_ERROR_MAIL_MEMORY_FULL;
                else
-                       error = EM_STORAGE_ERROR_SYSTEM_FAILURE;
+                       error = EMF_ERROR_SYSTEM_FAILURE;
                goto FINISH_OFF;                        
        }
        
        if (fwrite(data_string, 1, file_size, fp_dst) < 0) {
                EM_DEBUG_EXCEPTION("fwrite failed...");
-               error = EM_STORAGE_ERROR_UNKNOWN;
+               error = EMF_ERROR_UNKNOWN;
                goto FINISH_OFF;
        }
        
@@ -12532,26 +12147,26 @@ FINISH_OFF:
 
 #ifdef __FEATURE_BULK_DELETE_MOVE_UPDATE_REQUEST_OPTI__
 
-EXPORT_API int em_storage_update_read_mail_uid_by_server_uid(char *old_server_uid, char *new_server_uid, char *mbox_name, int *err_code)
+INTERNAL_FUNC int emstorage_update_read_mail_uid_by_server_uid(char *old_server_uid, char *new_server_uid, char *mbox_name, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
        int rc = -1;                               
        int ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        char sql_query_string[QUERY_SIZE] = {0, };
 
        int transaction = true;
                
        if (!old_server_uid || !new_server_uid || !mbox_name)  {                
                EM_DEBUG_EXCEPTION("Invalid parameters");
-               error = EM_STORAGE_ERROR_INVALID_PARAM;
+               error = EMF_ERROR_INVALID_PARAM;
                return false;
        }
 
        EM_DEBUG_LOG("old_server_uid[%s], new_server_uid[%s], mbox_name[%s]", old_server_uid, new_server_uid, mbox_name);
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
 
        
        SNPRINTF(sql_query_string, sizeof(sql_query_string),
@@ -12559,10 +12174,10 @@ EXPORT_API int em_storage_update_read_mail_uid_by_server_uid(char *old_server_ui
 
         EM_DEBUG_LOG(" Query [%s]", sql_query_string);
         
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-        EM_DEBUG_DB_EXEC((rc == SQLITE_FULL), {error = EM_STORAGE_ERROR_DB_IS_FULL;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+        EM_DEBUG_DB_EXEC((rc == SQLITE_FULL), {error = EMF_ERROR_MAIL_MEMORY_FULL;goto FINISH_OFF; },
                 ("sqlite3_exec fail:%d", rc));
-        EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+        EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                 ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
         
         
@@ -12570,7 +12185,7 @@ EXPORT_API int em_storage_update_read_mail_uid_by_server_uid(char *old_server_ui
         if (rc == 0)
         {
                 EM_DEBUG_EXCEPTION("No matching found in mail_partial_body_activity_tbl");
-                error = EM_STORAGE_ERROR_DATA_NOT_FOUND;
+                error = EMF_ERROR_DATA_NOT_FOUND;
                 goto FINISH_OFF;
         }
 
@@ -12579,7 +12194,7 @@ EXPORT_API int em_storage_update_read_mail_uid_by_server_uid(char *old_server_ui
          
 FINISH_OFF:
          
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        _DISCONNECT_DB;
 
        if (err_code != NULL)
@@ -12592,7 +12207,7 @@ FINISH_OFF:
 
 
 /**
- * @fn em_storage_get_id_set_from_mail_ids(int mail_ids[], int mail_id_count, emf_id_set_t** server_uids, int *id_set_count, int *err_code);
+ * @fn emstorage_get_id_set_from_mail_ids(int mail_ids[], int mail_id_count, emf_id_set_t** server_uids, int *id_set_count, int *err_code);
  * Prepare an array of mail_id and corresponding server mail id.
  *
  *@author                                      h.gahlaut@samsung.com
@@ -12606,12 +12221,12 @@ FINISH_OFF:
  * @return This function returns true on success or false on failure.
  */
  
-EXPORT_API int em_storage_get_id_set_from_mail_ids(char *mail_ids, emf_id_set_t** idset, int *id_set_count, int *err_code)
+INTERNAL_FUNC int emstorage_get_id_set_from_mail_ids(char *mail_ids, emf_id_set_t** idset, int *id_set_count, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
        EM_PROFILE_BEGIN(EmStorageGetIdSetFromMailIds);
 
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        int ret = false;
        emf_id_set_t* p_id_set = NULL;
        int count = 0;
@@ -12627,33 +12242,33 @@ EXPORT_API int em_storage_get_id_set_from_mail_ids(char *mail_ids, emf_id_set_t*
        
        if (NULL == mail_ids || NULL == idset || NULL == id_set_count) {
                EM_DEBUG_EXCEPTION("Invalid Parameters mail_ids[%p] idset[%p]  id_set_count [%p]", mail_ids, idset, id_set_count);
-               error = EM_STORAGE_ERROR_INVALID_PARAM;
+               error = EMF_ERROR_INVALID_PARAM;
                goto FINISH_OFF;
        }
 
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
 
        SNPRINTF(sql_query_string, space_left_in_query_buffer, "SELECT local_uid, s_uid FROM mail_read_mail_uid_tbl WHERE local_uid in (%s) ORDER BY s_uid", mail_ids);
 
        EM_DEBUG_LOG("SQL Query formed [%s] ", sql_query_string);
        
        /*  rc = sqlite3_get_table(local_db_handle, sql_query_string, &result, &count, 0, NULL); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, &count, 0, NULL), rc);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc && -1 != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, &count, 0, NULL), rc);
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc && -1 != rc), {error = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        EM_DEBUG_LOG(" Count of mails [%d ]", count);
 
        if (count <= 0) {
                EM_DEBUG_EXCEPTION("Can't find proper mail");
-               error = EM_STORAGE_ERROR_DATA_NOT_FOUND;
+               error = EMF_ERROR_DATA_NOT_FOUND;
                goto FINISH_OFF;
        }
 
 
-       if (NULL == (p_id_set = (emf_id_set_t*)em_core_malloc(sizeof(emf_id_set_t) * count)))  {
-               EM_DEBUG_EXCEPTION(" em_core_malloc failed...");
-               error = EM_STORAGE_ERROR_OUT_OF_MEMORY;
+       if (NULL == (p_id_set = (emf_id_set_t*)em_malloc(sizeof(emf_id_set_t) * count)))  {
+               EM_DEBUG_EXCEPTION(" em_malloc failed...");
+               error = EMF_ERROR_OUT_OF_MEMORY;
                goto FINISH_OFF;
        }
 
@@ -12662,8 +12277,8 @@ EXPORT_API int em_storage_get_id_set_from_mail_ids(char *mail_ids, emf_id_set_t*
        EM_PROFILE_BEGIN(EmStorageGetIdSetFromMailIds_Loop);
        EM_DEBUG_LOG(">>>> DATA ASSIGN START"); 
        for (i = 0; i < count; i++)  {
-               _getTableFieldDataInt(result, &(p_id_set[i].mail_id), col_index++);
-               _getTableFieldDataString(result, &server_mail_id, 1, col_index++);
+               _get_table_field_data_int(result, &(p_id_set[i].mail_id), col_index++);
+               _get_table_field_data_string(result, &server_mail_id, 1, col_index++);
                p_id_set[i].server_mail_id = strtoul(server_mail_id, NULL, 10);
                EM_SAFE_FREE(server_mail_id);           
        }
@@ -12700,40 +12315,40 @@ EXPORT_API int em_storage_get_id_set_from_mail_ids(char *mail_ids, emf_id_set_t*
 
 #endif
 
-EXPORT_API int em_storage_delete_triggers_from_lucene()
+INTERNAL_FUNC int emstorage_delete_triggers_from_lucene()
 {
        EM_DEBUG_FUNC_BEGIN();
        int rc, ret = true, transaction = true;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        char sql_query_string[QUERY_SIZE] = {0, };
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
 
        SNPRINTF(sql_query_string, sizeof(sql_query_string), "DROP TRIGGER triggerDelete;");
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        SNPRINTF(sql_query_string, sizeof(sql_query_string), "DROP TRIGGER triggerInsert;");
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
        
 
        SNPRINTF(sql_query_string, sizeof(sql_query_string), "DROP TRIGGER triggerUpdate;");
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
        
        ret = true;
        
 FINISH_OFF:
 
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
 
        _DISCONNECT_DB;
 
@@ -12741,7 +12356,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_filter_mails_by_rule(int account_id, char *dest_mailbox_name, emf_mail_rule_tbl_t *rule, int ** filtered_mail_id_list, int *count_of_mails, int *err_code)
+INTERNAL_FUNC int emstorage_filter_mails_by_rule(int account_id, char *dest_mailbox_name, emstorage_rule_tbl_t *rule, int ** filtered_mail_id_list, int *count_of_mails, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], dest_mailbox_name[%p] rule[%p], filtered_mail_id_list[%p], count_of_mails[%p], err_code[%p]", account_id, dest_mailbox_name, rule, filtered_mail_id_list, count_of_mails, err_code);
        
@@ -12749,16 +12364,16 @@ EXPORT_API int em_storage_filter_mails_by_rule(int account_id, char *dest_mailbo
                EM_DEBUG_EXCEPTION("Invalid Parameter");
                
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
 
-       int rc = -1, ret = false, error = EM_STORAGE_ERROR_NONE;
+       int rc = -1, ret = false, error = EMF_ERROR_NONE;
        int count = 0, col_index = 0, i = 0, where_pararaph_length = 0, *mail_list = NULL;
        char **result = NULL, *where_pararaph = NULL;
        char sql_query_string[QUERY_SIZE] = {0, };
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
 
        SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT mail_id FROM mail_tbl ");
        
@@ -12769,7 +12384,7 @@ EXPORT_API int em_storage_filter_mails_by_rule(int account_id, char *dest_mailbo
 
        if (where_pararaph == NULL) {
                EM_DEBUG_EXCEPTION("malloc failed for where_pararaph.");
-               error = EM_STORAGE_ERROR_OUT_OF_MEMORY;
+               error = EMF_ERROR_OUT_OF_MEMORY;
                goto FINISH_OFF;
        }
 
@@ -12790,7 +12405,7 @@ EXPORT_API int em_storage_filter_mails_by_rule(int account_id, char *dest_mailbo
                        SNPRINTF(where_pararaph, where_pararaph_length, "WHERE account_id = %d AND mailbox_type NOT in (3,5) AND subject = \'%s\'", account_id, rule->value);
        }
        else {
-               error = EM_STORAGE_ERROR_INVALID_PARAM;
+               error = EMF_ERROR_INVALID_PARAM;
                EM_DEBUG_EXCEPTION("rule->type is invald");
                goto FINISH_OFF;
        }
@@ -12801,8 +12416,8 @@ EXPORT_API int em_storage_filter_mails_by_rule(int account_id, char *dest_mailbo
        EM_DEBUG_LOG("query[%s]", sql_query_string);
        
        /*  rc = sqlite3_get_table(local_db_handle, sql_query_string, &result, &count, 0, NULL); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, &count, 0, NULL), rc);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc && -1 != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, &count, 0, NULL), rc);
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc && -1 != rc), {error = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        EM_DEBUG_LOG("Count of mails [%d]", count);
@@ -12811,22 +12426,22 @@ EXPORT_API int em_storage_filter_mails_by_rule(int account_id, char *dest_mailbo
                mail_list = malloc(sizeof(int) * count);
                if (mail_list == NULL) {
                        EM_DEBUG_EXCEPTION("malloc failed for mail_list.");
-                       error = EM_STORAGE_ERROR_OUT_OF_MEMORY;
+                       error = EMF_ERROR_OUT_OF_MEMORY;
                        goto FINISH_OFF;
                }
                
                col_index = 1;
 
                for (i = 0; i < count; i++) 
-                       _getTableFieldDataInt(result, &(mail_list[i]), col_index++);
+                       _get_table_field_data_int(result, &(mail_list[i]), col_index++);
 
                SNPRINTF(sql_query_string, sizeof(sql_query_string), "UPDATE mail_tbl SET mailbox_name = \'%s\', mailbox_type = 5 ", dest_mailbox_name);
 
                if (strlen(sql_query_string) + strlen(where_pararaph) < QUERY_SIZE)
                strcat(sql_query_string, where_pararaph);
 
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                        ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
        }       
        
@@ -12855,17 +12470,17 @@ FINISH_OFF:
 
 #define EMF_SLOT_UNIT 25
 
-EXPORT_API int em_storage_set_mail_slot_size(int account_id, char *mailbox_name, int new_slot_size, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_set_mail_slot_size(int account_id, char *mailbox_name, int new_slot_size, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], mailbox_name[%p] new_slot_size[%d], err_code[%p]", account_id, mailbox_name, new_slot_size, err_code);
-       int rc = -1, ret = false, err = EM_STORAGE_ERROR_NONE;
+       int rc = -1, ret = false, err = EMF_ERROR_NONE;
        int where_pararaph_length = 0;
        char *where_pararaph = NULL;
        char sql_query_string[QUERY_SIZE] = {0, };
        int and = 0;
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
 
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, err);
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, err);
 
        if (new_slot_size > 0)
                SNPRINTF(sql_query_string, sizeof(sql_query_string), "UPDATE mail_box_tbl SET mail_slot_size = %d ", new_slot_size);
@@ -12912,15 +12527,15 @@ EXPORT_API int em_storage_set_mail_slot_size(int account_id, char *mailbox_name,
 
        EM_DEBUG_LOG("query[%s]", sql_query_string);
 
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {err = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {err = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
        ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
        
        ret = true;
        
 FINISH_OFF:
 
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, err);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, err);
 
        _DISCONNECT_DB;
 
@@ -12933,7 +12548,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_add_meeting_request(int account_id, char *mailbox_name, emf_meeting_request_t* meeting_req, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_add_meeting_request(int account_id, char *mailbox_name, emf_meeting_request_t* meeting_req, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], mailbox_name[%s], meeting_req[%p], transaction[%d], err_code[%p]", account_id, mailbox_name, meeting_req, transaction, err_code);
        
@@ -12942,21 +12557,21 @@ EXPORT_API int em_storage_add_meeting_request(int account_id, char *mailbox_name
                EM_DEBUG_EXCEPTION("mail_id[%]d", meeting_req->mail_id);
                
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
 
                return false;
        }
        
        int rc = -1;
        int ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        DB_STMT hStmt = NULL;
        char sql_query_string[QUERY_SIZE] = {0, };
        int col_index = 0;
        time_t temp_unix_time = 0;
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
        
        SNPRINTF(sql_query_string, sizeof(sql_query_string),
                "INSERT INTO mail_meeting_tbl VALUES "
@@ -12977,12 +12592,12 @@ EXPORT_API int em_storage_add_meeting_request(int account_id, char *mailbox_name
                ", ?"           /*  daylight_bias */
                " )");
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
        if (rc != SQLITE_OK)  {
                EM_DEBUG_LOG(" before sqlite3_prepare hStmt = %p", hStmt);
                EM_DEBUG_EXCEPTION("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle));
                
-               error = EM_STORAGE_ERROR_DB_FAILURE;
+               error = EMF_ERROR_DB_FAILURE;
                goto FINISH_OFF;
        }
 
@@ -13004,35 +12619,35 @@ EXPORT_API int em_storage_add_meeting_request(int account_id, char *mailbox_name
        EM_DEBUG_LOG(">>>>> meeting_req->time_zone.daylight_time_start_date[%s]", asctime(&(meeting_req->time_zone.daylight_time_start_date)));
        EM_DEBUG_LOG(">>>>> meeting_req->time_zone.daylight_bias[%d]", meeting_req->time_zone.daylight_bias);
        */
-       _bindStmtFieldDataInt(hStmt, col_index++, meeting_req->mail_id);
-       _bindStmtFieldDataInt(hStmt, col_index++, account_id);
-       _bindStmtFieldDataString(hStmt, col_index++, (char *)mailbox_name, 0, MAILBOX_LEN_IN_MAIL_MEETING_TBL);
-       _bindStmtFieldDataInt(hStmt, col_index++, meeting_req->meeting_response);
+       _bind_stmt_field_data_int(hStmt, col_index++, meeting_req->mail_id);
+       _bind_stmt_field_data_int(hStmt, col_index++, account_id);
+       _bind_stmt_field_data_string(hStmt, col_index++, (char *)mailbox_name, 0, MAILBOX_LEN_IN_MAIL_MEETING_TBL);
+       _bind_stmt_field_data_int(hStmt, col_index++, meeting_req->meeting_response);
 
        temp_unix_time = timegm(&(meeting_req->start_time));
-       _bindStmtFieldDataInt(hStmt, col_index++, temp_unix_time);
+       _bind_stmt_field_data_int(hStmt, col_index++, temp_unix_time);
        temp_unix_time = timegm(&(meeting_req->end_time));
-       _bindStmtFieldDataInt(hStmt, col_index++, temp_unix_time);
+       _bind_stmt_field_data_int(hStmt, col_index++, temp_unix_time);
 
-       _bindStmtFieldDataString(hStmt, col_index++, (char *)meeting_req->location, 0, LOCATION_LEN_IN_MAIL_MEETING_TBL);
-       _bindStmtFieldDataString(hStmt, col_index++, (char *)meeting_req->global_object_id, 0, GLOBAL_OBJECT_ID_LEN_IN_MAIL_MEETING_TBL);
+       _bind_stmt_field_data_string(hStmt, col_index++, (char *)meeting_req->location, 0, LOCATION_LEN_IN_MAIL_MEETING_TBL);
+       _bind_stmt_field_data_string(hStmt, col_index++, (char *)meeting_req->global_object_id, 0, GLOBAL_OBJECT_ID_LEN_IN_MAIL_MEETING_TBL);
        
-       _bindStmtFieldDataInt(hStmt, col_index++, meeting_req->time_zone.offset_from_GMT);
-       _bindStmtFieldDataString(hStmt, col_index++, (char *)meeting_req->time_zone.standard_name, 0, STANDARD_NAME_LEN_IN_MAIL_MEETING_TBL);
+       _bind_stmt_field_data_int(hStmt, col_index++, meeting_req->time_zone.offset_from_GMT);
+       _bind_stmt_field_data_string(hStmt, col_index++, (char *)meeting_req->time_zone.standard_name, 0, STANDARD_NAME_LEN_IN_MAIL_MEETING_TBL);
        temp_unix_time = timegm(&(meeting_req->time_zone.standard_time_start_date));
-       _bindStmtFieldDataInt(hStmt, col_index++, temp_unix_time);
-       _bindStmtFieldDataInt(hStmt, col_index++, meeting_req->time_zone.standard_bias);
+       _bind_stmt_field_data_int(hStmt, col_index++, temp_unix_time);
+       _bind_stmt_field_data_int(hStmt, col_index++, meeting_req->time_zone.standard_bias);
 
-       _bindStmtFieldDataString(hStmt, col_index++, (char *)meeting_req->time_zone.daylight_name, 0, DAYLIGHT_NAME_LEN_IN_MAIL_MEETING_TBL);
+       _bind_stmt_field_data_string(hStmt, col_index++, (char *)meeting_req->time_zone.daylight_name, 0, DAYLIGHT_NAME_LEN_IN_MAIL_MEETING_TBL);
        temp_unix_time = timegm(&(meeting_req->time_zone.daylight_time_start_date));
-       _bindStmtFieldDataInt(hStmt, col_index++, temp_unix_time);
-       _bindStmtFieldDataInt(hStmt, col_index++, meeting_req->time_zone.daylight_bias);
+       _bind_stmt_field_data_int(hStmt, col_index++, temp_unix_time);
+       _bind_stmt_field_data_int(hStmt, col_index++, meeting_req->time_zone.daylight_bias);
 
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc == SQLITE_FULL), {error = EM_STORAGE_ERROR_DB_IS_FULL;goto FINISH_OFF; },
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+       EM_DEBUG_DB_EXEC((rc == SQLITE_FULL), {error = EMF_ERROR_MAIL_MEMORY_FULL;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
        
        ret = true;
@@ -13044,11 +12659,11 @@ FINISH_OFF:
                rc = sqlite3_finalize(hStmt);
                if (rc != SQLITE_OK)  {
                        EM_DEBUG_LOG(" sqlite3_finalize failed - %d", rc);
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
        }
  
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -13058,14 +12673,14 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_get_meeting_request(int mail_id, emf_meeting_request_t ** meeting_req, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_get_meeting_request(int mail_id, emf_meeting_request_t ** meeting_req, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
        
        int count = 0;
        int rc = -1;
        int ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        emf_meeting_request_t *p_temp_meeting_req = NULL;
        int col_index = 0;
        time_t temp_unix_time;
@@ -13075,8 +12690,8 @@ EXPORT_API int em_storage_get_meeting_request(int mail_id, emf_meeting_request_t
        DB_STMT hStmt = NULL;
        char sql_query_string[QUERY_SIZE] = {0, };
 
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_READ_TRANSACTION(transaction);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_READ_TRANSACTION(transaction);
 
        SNPRINTF(sql_query_string, sizeof(sql_query_string),
                "SELECT  mail_id, meeting_response, start_time, end_time, location, global_object_id, offset, standard_name, standard_time_start_date, standard_bias, daylight_name, daylight_time_start_date, daylight_bias "
@@ -13085,27 +12700,27 @@ EXPORT_API int em_storage_get_meeting_request(int mail_id, emf_meeting_request_t
        EM_DEBUG_LOG("sql : %s ", sql_query_string);
 
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
 
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
        
        if (rc == SQLITE_DONE)  {
                EM_DEBUG_EXCEPTION(" no Meeting request found...");
                count = 0;
                ret = false;
-               error= EM_STORAGE_ERROR_DATA_NOT_FOUND;
+               error= EMF_ERROR_DATA_NOT_FOUND;
                goto FINISH_OFF;
        }
        
        if (!(p_temp_meeting_req = (emf_meeting_request_t*)malloc(sizeof(emf_meeting_request_t)))) {
                EM_DEBUG_EXCEPTION(" malloc failed...");
-               error = EM_STORAGE_ERROR_OUT_OF_MEMORY;
+               error = EMF_ERROR_OUT_OF_MEMORY;
                goto FINISH_OFF;
        }
 
@@ -13113,25 +12728,25 @@ EXPORT_API int em_storage_get_meeting_request(int mail_id, emf_meeting_request_t
                
        col_index = 0;
 
-       _getStmtFieldDataInt(hStmt, &(p_temp_meeting_req->mail_id), col_index++);
-       _getStmtFieldDataInt(hStmt, (int *)&(p_temp_meeting_req->meeting_response), col_index++);
-       _getStmtFieldDataInt(hStmt, (int *)(&temp_unix_time), col_index++);
+       _get_stmt_field_data_int(hStmt, &(p_temp_meeting_req->mail_id), col_index++);
+       _get_stmt_field_data_int(hStmt, (int *)&(p_temp_meeting_req->meeting_response), col_index++);
+       _get_stmt_field_data_int(hStmt, (int *)(&temp_unix_time), col_index++);
        gmtime_r(&temp_unix_time, &(p_temp_meeting_req->start_time));
-       _getStmtFieldDataInt(hStmt, (int *)(&temp_unix_time), col_index++);
+       _get_stmt_field_data_int(hStmt, (int *)(&temp_unix_time), col_index++);
        gmtime_r(&temp_unix_time, &(p_temp_meeting_req->end_time));
-       _getStmtFieldDataString(hStmt, &p_temp_meeting_req->location, 1, col_index++);
-       _getStmtFieldDataStringWithoutAllocation(hStmt, p_temp_meeting_req->global_object_id, GLOBAL_OBJECT_ID_LEN_IN_MAIL_MEETING_TBL, 1, col_index++);
-       _getStmtFieldDataInt(hStmt, &(p_temp_meeting_req->time_zone.offset_from_GMT), col_index++);
+       _get_stmt_field_data_string(hStmt, &p_temp_meeting_req->location, 1, col_index++);
+       _get_stmt_field_data_string(hStmt, &p_temp_meeting_req->global_object_id, 1, col_index++);
+       _get_stmt_field_data_int(hStmt, &(p_temp_meeting_req->time_zone.offset_from_GMT), col_index++);
 
-       _getStmtFieldDataStringWithoutAllocation(hStmt, p_temp_meeting_req->time_zone.standard_name, STANDARD_NAME_LEN_IN_MAIL_MEETING_TBL, 1, col_index++);
-       _getStmtFieldDataInt(hStmt, (int *)(&temp_unix_time), col_index++);
+       _get_stmt_field_data_string_without_allocation(hStmt, p_temp_meeting_req->time_zone.standard_name, STANDARD_NAME_LEN_IN_MAIL_MEETING_TBL, 1, col_index++);
+       _get_stmt_field_data_int(hStmt, (int *)(&temp_unix_time), col_index++);
        gmtime_r(&temp_unix_time, &(p_temp_meeting_req->time_zone.standard_time_start_date));
-       _getStmtFieldDataInt(hStmt, &(p_temp_meeting_req->time_zone.standard_bias), col_index++);
+       _get_stmt_field_data_int(hStmt, &(p_temp_meeting_req->time_zone.standard_bias), col_index++);
 
-       _getStmtFieldDataStringWithoutAllocation(hStmt, p_temp_meeting_req->time_zone.daylight_name, DAYLIGHT_NAME_LEN_IN_MAIL_MEETING_TBL, 1, col_index++);
-       _getStmtFieldDataInt(hStmt, (int *)(&temp_unix_time), col_index++);
+       _get_stmt_field_data_string_without_allocation(hStmt, p_temp_meeting_req->time_zone.daylight_name, DAYLIGHT_NAME_LEN_IN_MAIL_MEETING_TBL, 1, col_index++);
+       _get_stmt_field_data_int(hStmt, (int *)(&temp_unix_time), col_index++);
        gmtime_r(&temp_unix_time, &(p_temp_meeting_req->time_zone.daylight_time_start_date));
-       _getStmtFieldDataInt(hStmt, &(p_temp_meeting_req->time_zone.daylight_bias), col_index++);
+       _get_stmt_field_data_int(hStmt, &(p_temp_meeting_req->time_zone.daylight_bias), col_index++);
 
        /*
        EM_DEBUG_LOG(">>>>> meeting_req->mail_id[%d]", p_temp_meeting_req->mail_id);
@@ -13164,11 +12779,11 @@ FINISH_OFF:
                hStmt = NULL;
                if (rc != SQLITE_OK)  {
                        EM_DEBUG_EXCEPTION("sqlite3_finalize failed - %d", rc);
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
        }
 
-       EM_STORAGE_FINISH_READ_TRANSACTION(transaction);
+       EMSTORAGE_FINISH_READ_TRANSACTION(transaction);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -13179,12 +12794,12 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int em_storage_update_meeting_request(emf_meeting_request_t* meeting_req, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_update_meeting_request(emf_meeting_request_t* meeting_req, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("meeting_req[%p], transaction[%d], err_code[%p]", meeting_req, transaction, err_code);
        
        int ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        int rc;
        DB_STMT hStmt = NULL;
        char sql_query_string[QUERY_SIZE] = {0, };
@@ -13192,12 +12807,12 @@ EXPORT_API int em_storage_update_meeting_request(emf_meeting_request_t* meeting_
 
        if (!meeting_req) {
                EM_DEBUG_EXCEPTION("Invalid Parameter!");
-               error = EM_STORAGE_ERROR_INVALID_PARAM;
+               error = EMF_ERROR_INVALID_PARAM;
                goto FINISH_OFF;
        }
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
 
        memset(sql_query_string, 0x00, sizeof(sql_query_string));
        SNPRINTF(sql_query_string, sizeof(sql_query_string),
@@ -13222,8 +12837,8 @@ EXPORT_API int em_storage_update_meeting_request(emf_meeting_request_t* meeting_
        
        EM_DEBUG_LOG("SQL(%s)", sql_query_string);
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 /*
        EM_DEBUG_LOG(">>>>> meeting_req->mail_id[%d]", meeting_req->mail_id);
@@ -13242,32 +12857,32 @@ EXPORT_API int em_storage_update_meeting_request(emf_meeting_request_t* meeting_
 */
        int col_index = 0;
 
-       _bindStmtFieldDataInt(hStmt, col_index++, meeting_req->meeting_response);
+       _bind_stmt_field_data_int(hStmt, col_index++, meeting_req->meeting_response);
        temp_unix_time = timegm(&(meeting_req->start_time));
-       _bindStmtFieldDataInt(hStmt, col_index++, temp_unix_time);
+       _bind_stmt_field_data_int(hStmt, col_index++, temp_unix_time);
        temp_unix_time = timegm(&(meeting_req->end_time));
-       _bindStmtFieldDataInt(hStmt, col_index++, temp_unix_time);
-       _bindStmtFieldDataString(hStmt, col_index++, meeting_req->location, 1, LOCATION_LEN_IN_MAIL_MEETING_TBL);
-       _bindStmtFieldDataString(hStmt, col_index++, meeting_req->global_object_id, 1, GLOBAL_OBJECT_ID_LEN_IN_MAIL_MEETING_TBL);
-       _bindStmtFieldDataInt(hStmt, col_index++, meeting_req->time_zone.offset_from_GMT);
-       _bindStmtFieldDataString(hStmt, col_index++, meeting_req->time_zone.standard_name, 1, STANDARD_NAME_LEN_IN_MAIL_MEETING_TBL);
+       _bind_stmt_field_data_int(hStmt, col_index++, temp_unix_time);
+       _bind_stmt_field_data_string(hStmt, col_index++, meeting_req->location, 1, LOCATION_LEN_IN_MAIL_MEETING_TBL);
+       _bind_stmt_field_data_string(hStmt, col_index++, meeting_req->global_object_id, 1, GLOBAL_OBJECT_ID_LEN_IN_MAIL_MEETING_TBL);
+       _bind_stmt_field_data_int(hStmt, col_index++, meeting_req->time_zone.offset_from_GMT);
+       _bind_stmt_field_data_string(hStmt, col_index++, meeting_req->time_zone.standard_name, 1, STANDARD_NAME_LEN_IN_MAIL_MEETING_TBL);
        temp_unix_time = timegm(&(meeting_req->time_zone.standard_time_start_date));
-       _bindStmtFieldDataInt(hStmt, col_index++, temp_unix_time);
-       _bindStmtFieldDataInt(hStmt, col_index++, meeting_req->time_zone.standard_bias);
-       _bindStmtFieldDataString(hStmt, col_index++, meeting_req->time_zone.daylight_name, 1, DAYLIGHT_NAME_LEN_IN_MAIL_MEETING_TBL);
+       _bind_stmt_field_data_int(hStmt, col_index++, temp_unix_time);
+       _bind_stmt_field_data_int(hStmt, col_index++, meeting_req->time_zone.standard_bias);
+       _bind_stmt_field_data_string(hStmt, col_index++, meeting_req->time_zone.daylight_name, 1, DAYLIGHT_NAME_LEN_IN_MAIL_MEETING_TBL);
        temp_unix_time = timegm(&(meeting_req->time_zone.daylight_time_start_date));
-       _bindStmtFieldDataInt(hStmt, col_index++, temp_unix_time);
-       _bindStmtFieldDataInt(hStmt, col_index++, meeting_req->time_zone.daylight_bias);
+       _bind_stmt_field_data_int(hStmt, col_index++, temp_unix_time);
+       _bind_stmt_field_data_int(hStmt, col_index++, meeting_req->time_zone.daylight_bias);
+
 
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
        ret = true;
 
 
 FINISH_OFF:
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        
        if (hStmt != NULL)  {
                EM_DEBUG_LOG("before sqlite3_finalize hStmt = %p", hStmt);
@@ -13276,7 +12891,7 @@ FINISH_OFF:
                if (rc != SQLITE_OK)  {
                        EM_DEBUG_EXCEPTION(" sqlite3_finalize failed - %d", rc);
 
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
        }
 
@@ -13290,7 +12905,7 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int em_storage_change_meeting_request_field(int account_id, char *mailbox_name, emf_mail_change_type_t type, emf_meeting_request_t* meeting_req, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_change_meeting_request_field(int account_id, char *mailbox_name, emf_mail_change_type_t type, emf_meeting_request_t* meeting_req, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], mailbox_name[%s], type[%d], meeting_req[%p], transaction[%d], err_code[%p]", account_id, mailbox_name,  type, meeting_req, transaction, err_code);
        
@@ -13299,53 +12914,53 @@ EXPORT_API int em_storage_change_meeting_request_field(int account_id, char *mai
                        EM_DEBUG_EXCEPTION("mail_id[%d]", meeting_req->mail_id);
                
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;;
        }
 
        int rc;
        int ret = false;
-       int error = EM_STORAGE_ERROR_NONE;      
+       int error = EMF_ERROR_NONE;
        DB_STMT hStmt = NULL;
        char sql_query_string[QUERY_SIZE] = {0, };
        
        int col_index = 0;
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
 
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
        
        switch (type)  {
                case UPDATE_MAILBOX:
                        EM_DEBUG_LOG(">>>>> UPDATE_MAILBOX : Move");
                        if (!mailbox_name)  {
                                EM_DEBUG_EXCEPTION(" mailbox_name[%p]", mailbox_name);
-                               error = EM_STORAGE_ERROR_INVALID_PARAM;
+                               error = EMF_ERROR_INVALID_PARAM;
                                goto FINISH_OFF;
                        }
                        SNPRINTF(sql_query_string, sizeof(sql_query_string),
                                "UPDATE mail_meeting_tbl SET mailbox_name = ? WHERE mail_id = %d", meeting_req->mail_id);
  
                        
-                       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+                       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
                        EM_DEBUG_LOG(" Before sqlite3_prepare hStmt = %p", hStmt);
-                       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+                       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                        ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
-                       _bindStmtFieldDataString(hStmt, col_index++, (char *)mailbox_name, 0, MAILBOX_LEN_IN_MAIL_MEETING_TBL);
+                       _bind_stmt_field_data_string(hStmt, col_index++, (char *)mailbox_name, 0, MAILBOX_LEN_IN_MAIL_MEETING_TBL);
                        break;
 
                default:
                        EM_DEBUG_LOG("type[%d]", type);
                        
-                       error = EM_STORAGE_ERROR_INVALID_PARAM;
+                       error = EMF_ERROR_INVALID_PARAM;
                        goto FINISH_OFF;
        }
        EM_DEBUG_LOG("Query = [%s]", sql_query_string);
 
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
 
        ret = true;
@@ -13356,11 +12971,11 @@ FINISH_OFF:
                rc = sqlite3_finalize(hStmt);
                if (rc != SQLITE_OK)  {
                        EM_DEBUG_EXCEPTION(" sqlite3_finalize failed - %d", rc);
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }
        }
 
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -13370,7 +12985,7 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int em_storage_change_meeting_request_mailbox(int account_id, char *old_mailbox_name, char *new_mailbox_name, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_change_meeting_request_mailbox(int account_id, char *old_mailbox_name, char *new_mailbox_name, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], old_mailbox_name[%p], new_mailbox_name[%p], transaction[%d], err_code[%p]", account_id, old_mailbox_name, new_mailbox_name, transaction, err_code);
 
@@ -13378,18 +12993,18 @@ EXPORT_API int em_storage_change_meeting_request_mailbox(int account_id, char *o
                EM_DEBUG_EXCEPTION("account_id[%d], old_mailbox_name[%p], new_mailbox_name[%p]", account_id, old_mailbox_name, new_mailbox_name);
                
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
        int rc;
        int ret = true;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        char sql_query_string[QUERY_SIZE] = {0, };
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
 
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
 
        EM_DEBUG_LOG("Update mailbox_name - searching by mailbox_name name"); 
        SNPRINTF(sql_query_string, sizeof(sql_query_string),
@@ -13401,10 +13016,10 @@ EXPORT_API int em_storage_change_meeting_request_mailbox(int account_id, char *o
                , account_id
                , old_mailbox_name);
 
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC((SQLITE_FULL == rc), {error = EM_STORAGE_ERROR_DB_IS_FULL;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC((SQLITE_FULL == rc), {error = EMF_ERROR_MAIL_MEMORY_FULL;goto FINISH_OFF; },
                ("sqlite3_exec fail:%d", rc));
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        rc = sqlite3_changes(local_db_handle);
@@ -13415,7 +13030,7 @@ EXPORT_API int em_storage_change_meeting_request_mailbox(int account_id, char *o
        
 FINISH_OFF:
 
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
@@ -13426,7 +13041,7 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int em_storage_delete_meeting_request(int account_id, int mail_id, char *mailbox_name, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_delete_meeting_request(int account_id, int mail_id, char *mailbox_name, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], mail_id[%d], mailbox_name[%s], transaction[%d], err_code[%p]", account_id, mail_id, mailbox_name, transaction, err_code);
        
@@ -13434,18 +13049,18 @@ EXPORT_API int em_storage_delete_meeting_request(int account_id, int mail_id, ch
                EM_DEBUG_EXCEPTION(" account_id[%d], mail_id[%d]", account_id, mail_id);
                
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
        int rc;
        int ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        int and = false;
        char sql_query_string[QUERY_SIZE] = {0, };
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
        
        SNPRINTF(sql_query_string, sizeof(sql_query_string), "DELETE FROM mail_meeting_tbl ");
 
@@ -13461,14 +13076,14 @@ EXPORT_API int em_storage_delete_meeting_request(int account_id, int mail_id, ch
                SNPRINTF(sql_query_string + strlen(sql_query_string), sizeof(sql_query_string)-(strlen(sql_query_string)+1), " %s mailbox_name = '%s'",  (and ? "AND" : "WHERE"), mailbox_name);
        }
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        ret = true;     
        
 FINISH_OFF:
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        _DISCONNECT_DB;
        
        if (err_code)
@@ -13478,25 +13093,26 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_free_meeting_request(emf_meeting_request_t **meeting_req, int count, int *err_code)
+INTERNAL_FUNC int emstorage_free_meeting_request(emf_meeting_request_t **meeting_req, int count, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("meeting_req[%p], count[%d], err_code[%p]", meeting_req, count, err_code);
        
        int ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        int i = 0;
        emf_meeting_request_t *cursor;
 
        if (count > 0) {
                if (!meeting_req || !*meeting_req) {
                        EM_DEBUG_EXCEPTION("meeting_req[%p], count[%d]", meeting_req, count);
-                       error = EM_STORAGE_ERROR_INVALID_PARAM;
+                       error = EMF_ERROR_INVALID_PARAM;
                        goto FINISH_OFF;
                }
                
                for (i = 0; i < count; i++) {
                        cursor = (*meeting_req) + i;
                        EM_SAFE_FREE(cursor->location);
+                       EM_SAFE_FREE(cursor->global_object_id);
                }
                EM_SAFE_FREE(*meeting_req);
        }
@@ -13513,14 +13129,14 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int em_storage_get_overflowed_mail_id_list(int account_id, char *mailbox_name, int mail_slot_size, int **mail_id_list, int *mail_id_count, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_get_overflowed_mail_id_list(int account_id, char *mailbox_name, int mail_slot_size, int **mail_id_list, int *mail_id_count, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id [%d], mailbox_name [%p], mail_slot_size [%d], mail_id_list [%p], mail_id_count [%p], transaction [%d], err_code [%p]", account_id, mailbox_name, mail_slot_size, mail_id_list, mail_id_count, transaction, err_code);
-       EM_PROFILE_BEGIN(profile_em_storage_get_overflowed_mail_id_list);
+       EM_PROFILE_BEGIN(profile_emstorage_get_overflowed_mail_id_list);
        char sql_query_string[QUERY_SIZE] = {0, };
        char **result = NULL;
        int rc = -1, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        int counter = 0, col_index = 0;
        int result_mail_id_count = 0;
        int *result_mail_id_list = NULL;
@@ -13535,18 +13151,17 @@ EXPORT_API int em_storage_get_overflowed_mail_id_list(int account_id, char *mail
        
        EM_DEBUG_LOG("query[%s].", sql_query_string);
 
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
-       EM_STORAGE_START_READ_TRANSACTION(transaction);
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
+       EMSTORAGE_START_READ_TRANSACTION(transaction);
        
-       /*  rc = sqlite3_get_table(local_db_handle, sql_query_string, &result, &result_mail_id_count, 0, NULL); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, &result_mail_id_count, 0, NULL), rc);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc && -1 != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, &result_mail_id_count, 0, NULL), rc);
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc && -1 != rc), {error = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        if (!result_mail_id_count) {
                EM_DEBUG_LOG("No mail found...");                       
                ret = false;
-               error= EM_STORAGE_ERROR_MAIL_NOT_FOUND;
+               error= EMF_ERROR_MAIL_NOT_FOUND;
                goto FINISH_OFF;
        }
        
@@ -13554,7 +13169,7 @@ EXPORT_API int em_storage_get_overflowed_mail_id_list(int account_id, char *mail
        
        if (!(result_mail_id_list = (int *)malloc(sizeof(int) * result_mail_id_count))) {
                EM_DEBUG_EXCEPTION("malloc for result_mail_id_list failed...");
-               error = EM_STORAGE_ERROR_OUT_OF_MEMORY;
+               error = EMF_ERROR_OUT_OF_MEMORY;
                sqlite3_free_table(result);
                goto FINISH_OFF;
        }
@@ -13564,7 +13179,7 @@ EXPORT_API int em_storage_get_overflowed_mail_id_list(int account_id, char *mail
        col_index = 1;
 
        for (counter = 0; counter < result_mail_id_count; counter++) 
-               _getTableFieldDataInt(result, result_mail_id_list + counter, col_index++);
+               _get_table_field_data_int(result, result_mail_id_list + counter, col_index++);
 
        ret = true;
        
@@ -13581,54 +13196,54 @@ FINISH_OFF:
        else 
                EM_SAFE_FREE(result_mail_id_list);
        
-       EM_STORAGE_FINISH_READ_TRANSACTION(transaction);
+       EMSTORAGE_FINISH_READ_TRANSACTION(transaction);
        _DISCONNECT_DB;
        
        if (err_code != NULL)
                *err_code = error;
 
-       EM_PROFILE_END(profile_em_storage_get_overflowed_mail_id_list);
+       EM_PROFILE_END(profile_emstorage_get_overflowed_mail_id_list);
        EM_DEBUG_FUNC_END("ret [%d]", ret);
        return ret;
 }
 
 
-EXPORT_API int em_storage_get_thread_id_by_mail_id(int mail_id, int *thread_id, int *err_code)
+INTERNAL_FUNC int emstorage_get_thread_id_by_mail_id(int mail_id, int *thread_id, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("mail_id[%d], thread_id[%p], err_code[%p]", mail_id, thread_id, err_code);
        
+       int rc = -1, ret = false;
+       int err = EMF_ERROR_NONE;
+       char sql_query_string[QUERY_SIZE] = {0, };
+       char **result;
+       int result_count = 0;
+
        if (mail_id == 0 || thread_id == NULL) {
                EM_DEBUG_EXCEPTION("Invalid Parameter");
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                goto FINISH_OFF;
        }
 
-       int rc = -1, ret = false;
-       int err = EM_STORAGE_ERROR_NONE;
-       char sql_query_string[QUERY_SIZE] = {0, };
-       char **result;
-       int result_count = 0;
-       
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
 
        memset(sql_query_string, 0, QUERY_SIZE);
        SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT thread_id FROM mail_tbl WHERE mail_id = %d", mail_id);
 
        /*  rc = sqlite3_get_table(local_db_handle, sql_query_string, &result, &result_count, 0, NULL); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, &result_count, 0, NULL), rc);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc && -1 != rc), {err = EM_STORAGE_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, &result_count, 0, NULL), rc);
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc && -1 != rc), {err = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        if (!result_count) {
                EM_DEBUG_EXCEPTION("No mail found...");                 
                ret = false;
-               err= EM_STORAGE_ERROR_MAIL_NOT_FOUND;
+               err= EMF_ERROR_MAIL_NOT_FOUND;
                /* sqlite3_free_table(result); */
                goto FINISH_OFF;
        }
 
-       _getTableFieldDataInt(result, thread_id, 1);
+       _get_table_field_data_int(result, thread_id, 1);
 
        sqlite3_free_table(result);
        
@@ -13646,44 +13261,44 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int em_storage_update_latest_thread_mail(int account_id, int thread_id, int latest_mail_id, int thread_item_count, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_update_latest_thread_mail(int account_id, int thread_id, int latest_mail_id, int thread_item_count, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id [%d], thread_id[%d], latest_mail_id [%d], thread_item_count[%d], err_code[%p]", account_id, thread_id, latest_mail_id, thread_item_count, err_code);
        
+       int rc = -1, ret = false;
+       int err = EMF_ERROR_NONE;
+       char sql_query_string[QUERY_SIZE] = {0, };
+       char **result;
+       int result_count = 0;
+
        if (thread_id == 0) {
                EM_DEBUG_EXCEPTION("Invalid Parameter");
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                goto FINISH_OFF;
        }
-
-       int rc = -1, ret = false;
-       int err = EM_STORAGE_ERROR_NONE;
-       char sql_query_string[QUERY_SIZE] = {0, };
-       char **result;
-       int result_count = 0;
        
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
 
        if (thread_item_count == 0 || latest_mail_id == 0) {
                memset(sql_query_string, 0, QUERY_SIZE);
                SNPRINTF(sql_query_string, sizeof(sql_query_string), "SELECT mail_id, count(*) FROM (SELECT account_id, mail_id, thread_id, mailbox_type FROM mail_tbl ORDER BY date_time) WHERE account_id = %d AND thread_id = %d AND mailbox_type NOT in (3,5,7)", account_id, thread_id);
 
                /*  rc = sqlite3_get_table(local_db_handle, sql_query_string, &result, &result_count, 0, NULL); */
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, &result_count, 0, NULL), rc);
-               EM_DEBUG_DB_EXEC((SQLITE_OK != rc && -1 != rc), {err = EM_STORAGE_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, &result_count, 0, NULL), rc);
+               EM_DEBUG_DB_EXEC((SQLITE_OK != rc && -1 != rc), {err = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
                        ("SQL(%s) sqlite3_get_table fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
                EM_DEBUG_LOG("result_count[%d]", result_count);
                if (result_count == 0) {
                        EM_DEBUG_EXCEPTION("No mail found...");                 
                        ret = false;
-                       err= EM_STORAGE_ERROR_MAIL_NOT_FOUND;
+                       err= EMF_ERROR_MAIL_NOT_FOUND;
                        sqlite3_free_table(result);
                        goto FINISH_OFF;
                }
 
-               _getTableFieldDataInt(result, &latest_mail_id, 2);
-               _getTableFieldDataInt(result, &thread_item_count, 3);
+               _get_table_field_data_int(result, &latest_mail_id, 2);
+               _get_table_field_data_int(result, &thread_item_count, 3);
 
                EM_DEBUG_LOG("latest_mail_id[%d]", latest_mail_id);
                EM_DEBUG_LOG("thread_item_count[%d]", thread_item_count);
@@ -13691,7 +13306,7 @@ EXPORT_API int em_storage_update_latest_thread_mail(int account_id, int thread_i
                sqlite3_free_table(result);
        }
 
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, err);
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, err);
 
        /* if (thread_item_count > 1) */
        /* { */
@@ -13699,8 +13314,8 @@ EXPORT_API int em_storage_update_latest_thread_mail(int account_id, int thread_i
                SNPRINTF(sql_query_string, sizeof(sql_query_string), "UPDATE mail_tbl SET thread_item_count = 0 WHERE account_id = %d AND thread_id = %d", account_id, thread_id);
                EM_DEBUG_LOG("query[%s]", sql_query_string);
 
-               EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-                       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {err = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+               EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+                       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {err = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                        ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
        /* } */
 
@@ -13708,15 +13323,15 @@ EXPORT_API int em_storage_update_latest_thread_mail(int account_id, int thread_i
        SNPRINTF(sql_query_string, sizeof(sql_query_string), "UPDATE mail_tbl SET thread_item_count = %d WHERE account_id = %d AND mail_id = %d ", thread_item_count, account_id, latest_mail_id);
        EM_DEBUG_LOG("query[%s]", sql_query_string);
 
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {err = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+               EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {err = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
        
        ret = true;
        
 FINISH_OFF:
                
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, err);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, err);
        
        _DISCONNECT_DB;
        
@@ -13728,25 +13343,25 @@ FINISH_OFF:
 }
 
 
-EXPORT_API void
-em_storage_flush_db_cache()
+INTERNAL_FUNC void
+emstorage_flush_db_cache()
 {
        sqlite3_release_memory(-1);
 }
 
-#ifdef __LOCAL_ACTIVITY__
+#ifdef __FEATURE_LOCAL_ACTIVITY__
 /**
-  *    em_storage_add_activity - Add Email Local activity during OFFLINE mode
+  *    emstorage_add_activity - Add Email Local activity during OFFLINE mode
   *
   */
-EXPORT_API int em_storage_add_activity(emf_activity_tbl_t* local_activity, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_add_activity(emstorage_activity_tbl_t* local_activity, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
        
        EM_DEBUG_LOG(" local_activity[%p], transaction[%d], err_code[%p]", local_activity, transaction, err_code);
 
        int rc = -1, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        DB_STMT hStmt = NULL;
        char sql_query_string[8192] = { 0x00, };
        int i = 0;
@@ -13754,13 +13369,13 @@ EXPORT_API int em_storage_add_activity(emf_activity_tbl_t* local_activity, int t
        if (!local_activity) {
                EM_DEBUG_EXCEPTION(" local_activity[%p], transaction[%d], err_code[%p]", local_activity, transaction, err_code);
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
 
-       sqlite3 *local_db_handle = em_storage_get_db_connection();
+       sqlite3 *local_db_handle = emstorage_get_db_connection();
        memset(sql_query_string, 0x00 , sizeof(sql_query_string));
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
        
        SNPRINTF(sql_query_string, sizeof(sql_query_string), "INSERT INTO mail_local_activity_tbl VALUES (?, ?, ?, ?, ?, ?, ?)");
 
@@ -13775,8 +13390,8 @@ EXPORT_API int em_storage_add_activity(emf_activity_tbl_t* local_activity, int t
        EM_DEBUG_LOG(">>>> SQL STMT [ %s ] ", sql_query_string);
        
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
-       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_prepare_v2(local_db_handle, sql_query_string, strlen(sql_query_string), &hStmt, NULL), rc);
+       EM_DEBUG_DB_EXEC((SQLITE_OK != rc), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) sqlite3_prepare fail:(%d) %s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        EM_DEBUG_LOG(">>>> SQL STMT [ %s ] ", sql_query_string);
@@ -13784,20 +13399,20 @@ EXPORT_API int em_storage_add_activity(emf_activity_tbl_t* local_activity, int t
 
 
 
-       _bindStmtFieldDataInt(hStmt, i++, local_activity->activity_id);
-       _bindStmtFieldDataInt(hStmt, i++, local_activity->account_id);
-       _bindStmtFieldDataInt(hStmt, i++, local_activity->mail_id);
-       _bindStmtFieldDataInt(hStmt, i++, local_activity->activity_type);
-       _bindStmtFieldDataString(hStmt, i++ , (char *)local_activity->server_mailid, 0, SERVER_MAIL_ID_LEN_IN_MAIL_TBL);
-       _bindStmtFieldDataString(hStmt, i++ , (char *)local_activity->src_mbox, 0, MAILBOX_NAME_LEN_IN_MAIL_BOX_TBL);
-       _bindStmtFieldDataString(hStmt, i++ , (char *)local_activity->dest_mbox, 0, MAILBOX_NAME_LEN_IN_MAIL_BOX_TBL);
+       _bind_stmt_field_data_int(hStmt, i++, local_activity->activity_id);
+       _bind_stmt_field_data_int(hStmt, i++, local_activity->account_id);
+       _bind_stmt_field_data_int(hStmt, i++, local_activity->mail_id);
+       _bind_stmt_field_data_int(hStmt, i++, local_activity->activity_type);
+       _bind_stmt_field_data_string(hStmt, i++ , (char *)local_activity->server_mailid, 0, SERVER_MAIL_ID_LEN_IN_MAIL_TBL);
+       _bind_stmt_field_data_string(hStmt, i++ , (char *)local_activity->src_mbox, 0, MAILBOX_NAME_LEN_IN_MAIL_BOX_TBL);
+       _bind_stmt_field_data_string(hStmt, i++ , (char *)local_activity->dest_mbox, 0, MAILBOX_NAME_LEN_IN_MAIL_BOX_TBL);
        
-       /*  rc = sqlite3_step(hStmt); */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
 
-       EM_DEBUG_DB_EXEC((rc == SQLITE_FULL), {error = EM_STORAGE_ERROR_DB_IS_FULL;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_step(hStmt), rc);
+
+       EM_DEBUG_DB_EXEC((rc == SQLITE_FULL), {error = EMF_ERROR_MAIL_MEMORY_FULL;goto FINISH_OFF; },
                ("sqlite3_step fail:%d", rc));
-       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EM_DEBUG_DB_EXEC((rc != SQLITE_ROW && rc != SQLITE_DONE), {error = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("sqlite3_step fail:%d, errmsg = %s.", rc, sqlite3_errmsg(local_db_handle)));
 
        ret = true;
@@ -13809,14 +13424,14 @@ FINISH_OFF:
                if (rc != SQLITE_OK)  {
                        EM_DEBUG_LOG(" sqlite3_finalize failed - %d", rc);
                        
-                       error = EM_STORAGE_ERROR_DB_FAILURE;
+                       error = EMF_ERROR_DB_FAILURE;
                }               
        }
        else {
                EM_DEBUG_LOG(" >>>>>>>>>> hStmt is NULL!!!");
        }
 
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        _DISCONNECT_DB;
 
        
@@ -13828,17 +13443,17 @@ FINISH_OFF:
 }
 
 /**
-  *    em_storage_get_activity - Get the Local activity Information
+  *    emstorage_get_activity - Get the Local activity Information
   *    
   *
   */
-EXPORT_API int em_storage_get_activity(int account_id, int activityid, emf_activity_tbl_t** activity_list, int *select_num, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_get_activity(int account_id, int activityid, emstorage_activity_tbl_t** activity_list, int *select_num, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
        
        int i = 0, count = 0, rc = -1, ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
-       emf_activity_tbl_t *p_activity_tbl = NULL;
+       int error = EMF_ERROR_NONE;
+       emstorage_activity_tbl_t *p_activity_tbl = NULL;
        char sql_query_string[1024] = {0x00, };
        char **result = NULL;
        int col_index ;
@@ -13850,11 +13465,11 @@ EXPORT_API int em_storage_get_activity(int account_id, int activityid, emf_activ
        if (!select_num || !activity_list || account_id <= 0 || activityid < 0) {
                EM_DEBUG_LOG(" select_num[%p], activity_list[%p] account_id [%d] activityid [%d] ", select_num, activity_list, account_id, activityid);
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
-       EM_STORAGE_START_READ_TRANSACTION(transaction);
+       EMSTORAGE_START_READ_TRANSACTION(transaction);
 
        memset(sql_query_string, 0x00, sizeof(sql_query_string));
 
@@ -13868,18 +13483,18 @@ EXPORT_API int em_storage_get_activity(int account_id, int activityid, emf_activ
        EM_DEBUG_LOG("Query [%s]", sql_query_string);
 
                
-       /*  rc = sqlite3_get_table(local_db_handle, sql_query_string, &result, &count, NULL, NULL);   */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, &count, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, &count, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
 
        
        col_index = 7;
        
-       if (!(p_activity_tbl = (emf_activity_tbl_t*)em_core_malloc(sizeof(emf_activity_tbl_t) * count))) {
-               EM_DEBUG_EXCEPTION(" em_core_malloc failed...");
-               error = EM_STORAGE_ERROR_OUT_OF_MEMORY;
+       if (!(p_activity_tbl = (emstorage_activity_tbl_t*)em_malloc(sizeof(emstorage_activity_tbl_t) * count))) {
+               EM_DEBUG_EXCEPTION(" em_malloc failed...");
+               error = EMF_ERROR_OUT_OF_MEMORY;
                goto FINISH_OFF;
        }
 
@@ -13936,10 +13551,10 @@ FINISH_OFF:
                EM_DEBUG_LOG(">>>> COUNT : %d >> ", count);
        }
        else if (p_activity_tbl != NULL) {
-               em_storage_free_local_activity(&p_activity_tbl, count, NULL);
+               emstorage_free_local_activity(&p_activity_tbl, count, NULL);
        }
        
-       EM_STORAGE_FINISH_READ_TRANSACTION(transaction);
+       EMSTORAGE_FINISH_READ_TRANSACTION(transaction);
        if (err_code != NULL)
                *err_code = error;
 
@@ -13948,7 +13563,7 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int em_storage_get_next_activity_id(int *activity_id, int *err_code)
+INTERNAL_FUNC int emstorage_get_next_activity_id(int *activity_id, int *err_code)
 {
 
        EM_DEBUG_FUNC_BEGIN();
@@ -13963,7 +13578,7 @@ EXPORT_API int em_storage_get_next_activity_id(int *activity_id, int *err_code)
        {
                EM_DEBUG_EXCEPTION(" activity_id[%p]", activity_id);
                
-               err = EM_STORAGE_ERROR_INVALID_PARAM;
+               err = EMF_ERROR_INVALID_PARAM;
                goto FINISH_OFF;
        }
 
@@ -13971,8 +13586,8 @@ EXPORT_API int em_storage_get_next_activity_id(int *activity_id, int *err_code)
 
        sql = "SELECT max(rowid) FROM mail_local_activity_tbl;";
        
-       /*  rc = sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL); n EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL), rc); */
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {err = EM_STORAGE_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
+       /*  rc = sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL); n EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql, &result, NULL, NULL, NULL), rc); */
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {err = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql, rc, sqlite3_errmsg(local_db_handle)));
 
        if (NULL==result[1])
@@ -13998,7 +13613,7 @@ EXPORT_API int em_storage_get_next_activity_id(int *activity_id, int *err_code)
 
 }
 
-EXPORT_API int em_storage_get_activity_id_list(int account_id, int ** activity_id_list, int *activity_id_count, int lowest_activity_type, int highest_activity_type, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_get_activity_id_list(int account_id, int ** activity_id_list, int *activity_id_count, int lowest_activity_type, int highest_activity_type, int transaction, int *err_code)
 {
 
        EM_DEBUG_FUNC_BEGIN();
@@ -14007,19 +13622,19 @@ EXPORT_API int em_storage_get_activity_id_list(int account_id, int ** activity_i
        
        if (account_id <= 0|| NULL == activity_id_list || NULL == activity_id_count ||lowest_activity_type <=0 || highest_activity_type <= 0)  {
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }
        
        int ret = false;
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        int i = 0, rc = -1, count = 0;
        char sql_query_string[1024] = {0x00, };
        int *activity_ids = NULL;
        int col_index = 0;
        char **result = NULL;
        
-       EM_STORAGE_START_READ_TRANSACTION(transaction);
+       EMSTORAGE_START_READ_TRANSACTION(transaction);
 
        memset(sql_query_string, 0x00, sizeof(sql_query_string));
        
@@ -14027,18 +13642,18 @@ EXPORT_API int em_storage_get_activity_id_list(int account_id, int ** activity_i
 
        EM_DEBUG_LOG(" Query [%s]", sql_query_string);
 
-       /*  rc = sqlite3_get_table(local_db_handle, sql_query_string, &result, &count, NULL, NULL);   */
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, &count, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EM_STORAGE_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
+
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_get_table(local_db_handle, sql_query_string, &result, &count, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {error = EMF_ERROR_DB_FAILURE;sqlite3_free_table(result);goto FINISH_OFF; },
                ("SQL(%s) sqlite3_get_table fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
 
        col_index = 1;
 
        EM_DEBUG_LOG(" Activity COUNT : %d ... ", count);
 
-       if (NULL == (activity_ids = (int *)em_core_malloc(sizeof(int) * count))) {
-               EM_DEBUG_EXCEPTION(" em_core_malloc failed...");
-               error = EM_STORAGE_ERROR_OUT_OF_MEMORY;
+       if (NULL == (activity_ids = (int *)em_malloc(sizeof(int) * count))) {
+               EM_DEBUG_EXCEPTION(" em_malloc failed...");
+               error = EMF_ERROR_OUT_OF_MEMORY;
                goto FINISH_OFF;
        }
 
@@ -14062,7 +13677,7 @@ FINISH_OFF:
                EM_SAFE_FREE(activity_ids);
        
 
-       EM_STORAGE_FINISH_READ_TRANSACTION(transaction);
+       EMSTORAGE_FINISH_READ_TRANSACTION(transaction);
        if (err_code != NULL) {
                *err_code = error;
        }
@@ -14071,17 +13686,17 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int em_storage_free_activity_id_list(int *activity_id_list, int *error_code)
+INTERNAL_FUNC int emstorage_free_activity_id_list(int *activity_id_list, int *error_code)
 {
        EM_DEBUG_FUNC_BEGIN();
 
-       int error = EM_STORAGE_ERROR_NONE;
+       int error = EMF_ERROR_NONE;
        int ret = false;
 
        EM_DEBUG_LOG(" activity_id_list [%p]", activity_id_list);
 
        if (NULL == activity_id_list) {
-               error = EM_STORAGE_ERROR_INVALID_PARAM;
+               error = EMF_ERROR_INVALID_PARAM;
                goto FINISH_OFF;
        }
        else {
@@ -14103,11 +13718,11 @@ EXPORT_API int em_storage_free_activity_id_list(int *activity_id_list, int *erro
 }
 
 /**
- * em_storage_delete_local_activity - Deletes the Local acitivity Generated based on activity_type
+ * emstorage_delete_local_activity - Deletes the Local acitivity Generated based on activity_type
  * or based on server mail id
  *
  */
-EXPORT_API int em_storage_delete_local_activity(emf_activity_tbl_t* local_activity, int transaction, int *err_code)
+INTERNAL_FUNC int emstorage_delete_local_activity(emstorage_activity_tbl_t* local_activity, int transaction, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
 
@@ -14117,16 +13732,16 @@ EXPORT_API int em_storage_delete_local_activity(emf_activity_tbl_t* local_activi
        if (!local_activity)  {
                EM_DEBUG_EXCEPTION(" local_activity[%p] ", local_activity);
                if (err_code != NULL)
-                       *err_code = EM_STORAGE_ERROR_INVALID_PARAM;
+                       *err_code = EMF_ERROR_INVALID_PARAM;
                return false;
        }               
        
        int rc = -1, ret = false;                       /* Prevent_FIX  */
-       int err = EM_STORAGE_ERROR_NONE;
+       int err = EMF_ERROR_NONE;
        int query_and = 0;
        int query_where = 0;
        char sql_query_string[8192] = { 0x00, };
-       EM_STORAGE_START_WRITE_TRANSACTION(transaction, error);
+       EMSTORAGE_START_WRITE_TRANSACTION(transaction, error);
 
        memset(sql_query_string, 0x00, sizeof(sql_query_string));
        
@@ -14173,20 +13788,20 @@ EXPORT_API int em_storage_delete_local_activity(emf_activity_tbl_t* local_activi
 
        EM_DEBUG_LOG(">>>>> Query [ %s ] ", sql_query_string);
        
-       EM_STORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
-       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {err = EM_STORAGE_ERROR_DB_FAILURE;goto FINISH_OFF; },
+       EMSTORAGE_PROTECTED_FUNC_CALL(sqlite3_exec(local_db_handle, sql_query_string, NULL, NULL, NULL), rc);
+       EM_DEBUG_DB_EXEC(SQLITE_OK != rc, {err = EMF_ERROR_DB_FAILURE;goto FINISH_OFF; },
                ("SQL(%s) exec fail:%d -%s", sql_query_string, rc, sqlite3_errmsg(local_db_handle)));
        
        rc = sqlite3_changes(local_db_handle);
        if (rc == 0)  {
                EM_DEBUG_EXCEPTION(" no (matched) mailbox_name found...");
-               err = EM_STORAGE_ERROR_MAILBOX_NOT_FOUND;
+               err = EMF_ERROR_MAILBOX_NOT_FOUND;
        }
 
        ret = true;
        
 FINISH_OFF:
-       EM_STORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
+       EMSTORAGE_FINISH_WRITE_TRANSACTION(transaction, ret, error);
        if (err_code != NULL)
                *err_code = err;
        EM_DEBUG_FUNC_END("ret [%d]", ret);
@@ -14194,26 +13809,26 @@ FINISH_OFF:
 }
 
 /**
-*      em_storage_free_local_activity - Free the Local Activity data
+*      emstorage_free_local_activity - Free the Local Activity data
 */
-EXPORT_API int em_storage_free_local_activity(emf_activity_tbl_t **local_activity_list, int count, int *err_code)
+INTERNAL_FUNC int emstorage_free_local_activity(emstorage_activity_tbl_t **local_activity_list, int count, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
        
        EM_DEBUG_LOG(" local_activity_list[%p], count[%d], err_code[%p]", local_activity_list, count, err_code);
        
        int ret = false;
-       int error = EM_STORAGE_ERROR_INVALID_PARAM;
+       int error = EMF_ERROR_INVALID_PARAM;
        
        if (count > 0) {
                if (!local_activity_list || !*local_activity_list) {
                        EM_DEBUG_EXCEPTION(" local_activity_list[%p], count[%d]", local_activity_list, count);
                        
-                       error = EM_STORAGE_ERROR_INVALID_PARAM;
+                       error = EMF_ERROR_INVALID_PARAM;
                        goto FINISH_OFF;
                }
                
-               emf_activity_tbl_t* p = *local_activity_list;
+               emstorage_activity_tbl_t* p = *local_activity_list;
                int i = 0;
                if (p) {
                        for (; i < count; i++)  {
@@ -14236,7 +13851,7 @@ FINISH_OFF:
        return ret;
 
 }
-#endif /* __LOCAL_ACTIVITY__ */
+#endif /* __FEATURE_LOCAL_ACTIVITY__ */
 
 
 /*EOF*/
diff --git a/email-core/email-storage/include/email-storage.h b/email-core/email-storage/include/email-storage.h
new file mode 100755 (executable)
index 0000000..a1a5aa7
--- /dev/null
@@ -0,0 +1,1457 @@
+/*
+*  email-service
+*
+* Copyright (c) 2000 - 2011 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.
+*
+*/
+
+
+/******************************************************************************
+ * File :  email-storage.h
+ * Desc :  email-core Storage Library Header
+ *
+ * Auth : 
+ *
+ * History : 
+ *    2006.07.28  :  created
+ *****************************************************************************/
+#ifndef __EMAIL_STORAGE_H__
+#define __EMAIL_STORAGE_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+#include <sqlite3.h>
+#include <time.h>
+#include "email-types.h"
+#include "email-internal-types.h"
+
+
+#define MAILTEMP            "tmp"
+#define FIRST_ACCOUNT_ID    1
+
+
+#ifdef __FEATURE_BULK_DELETE_MOVE_UPDATE_REQUEST_OPTI__
+#define QUERY_SIZE          8192
+#define MAX_INTEGER_LENGTH  5  /*  32767 -> 5 bytes */
+
+typedef struct 
+{
+       int mail_id;
+       unsigned long server_mail_id;
+} emf_id_set_t;
+
+#endif /* __FEATURE_BULK_DELETE_MOVE_UPDATE_REQUEST_OPTI__ */
+
+
+typedef struct 
+{
+       int            account_bind_type;
+       char          *account_name;
+       int            receiving_server_type;
+       char          *receiving_server_addr;
+       char          *email_addr;
+       char          *user_name;
+       char          *password;
+       int            retrieval_mode;
+       int            port_num;
+       int            use_security;
+       int            sending_server_type;
+       char          *sending_server_addr;
+       int            sending_port_num;
+       int            sending_auth;
+       int            sending_security;
+       char          *sending_user;
+       char          *sending_password;
+       char          *display_name;
+       char          *reply_to_addr;
+       char          *return_addr;
+       int            account_id;
+       int            keep_on_server;
+       int            flag1;                     /*  Specifies the downloading option 0 is subject only, 1 is text body, 2 is normal. */
+       int            flag2;
+       int            pop_before_smtp;           /*  POP before SMTP Authentication   */
+       int            apop;                      /*  APOP authentication  */
+       char          *logo_icon_path;            /*  Account logo icon  */
+       int            preset_account;            /*  Preset account or not  */
+       emf_option_t   options;                   /*  Specifies the Sending options  */
+       int            target_storage;            /*  Specifies the targetStorage. 0 is phone, 1 is MMC  */
+       int            check_interval;            /*  Specifies the check interval  */
+       int            my_account_id;             /*  Specifies accout id of my account */
+       int            index_color;               /*  index color in RGB */
+       int            sync_status;               /*  Sync Status */
+} emstorage_account_tbl_t;
+
+typedef struct 
+{
+       int   account_id;      /*  MUST BE '0'  :  currently, only global rule supported. */
+       int   rule_id;
+       int   type;            /*  from/subject/body  */
+       char *value;
+       int   action_type;     /*  move/block/delete  */
+       char *dest_mailbox;    /*  destination mailbox  */
+       int   flag1;           /*  for rule ON/OFF */
+       int   flag2;           /*  For rule type INCLUDE/Exactly SAME AS */
+} emstorage_rule_tbl_t;
+
+/* mail_box_tbl table entity */
+typedef struct 
+{
+       int                  mailbox_id;
+       int                  account_id;
+       int                  local_yn;
+       char                *mailbox_name;
+       emf_mailbox_type_e   mailbox_type;
+       char                *alias;
+       int                  sync_with_server_yn;      /*  whether mailbox is a sync IMAP mailbox */
+       int                  modifiable_yn;              /*  whether mailbox is able to be deleted/modified */
+       int                  unread_count;              /*  Removed. 16-Dec-2010, count unread mails at the moment it is required. not store in the DB */
+       int                  total_mail_count_on_local;  /*  Specifies the total number of mails in the mailbox in the local DB. count unread mails at the moment it is required. not store in the DB */
+       int                  total_mail_count_on_server;  /*  Specifies the total number of mails in the mailbox in the mail server */
+       int                  has_archived_mails;
+       int                  mail_slot_size;
+} emstorage_mailbox_tbl_t;
+
+/* mail_read_uid_tbl table entity */
+typedef struct 
+{
+       int     account_id;
+       char   *local_mbox;
+       int     local_uid;
+       char   *mailbox_name;   /*  server mailbox */
+       char   *s_uid;          /*  uid on server */
+       int     data1;          /*  rfc822 size */
+       char   *data2;
+       int     flag;           /*  rule id */
+       int     reserved;
+} emstorage_read_mail_uid_tbl_t;
+
+typedef struct 
+{
+       int        mail_id;
+       int        account_id;
+       int        mailbox_id;         /* For internal use. Currently, account_id and mailbox name is primary key of the table. */
+       char      *mailbox_name;
+       int        mailbox_type;
+       char      *subject;
+       time_t     date_time;
+       int        server_mail_status;
+       char      *server_mailbox_name;
+       char      *server_mail_id;
+       char      *message_id;
+       char      *full_address_from;
+       char      *full_address_reply;
+       char      *full_address_to;
+       char      *full_address_cc;
+       char      *full_address_bcc;
+       char      *full_address_return;
+       char      *email_address_sender;
+       char      *email_address_recipient;
+       char      *alias_sender;
+       char      *alias_recipient;
+       int        body_download_status;
+       char      *file_path_plain;
+       char      *file_path_html;
+       int        mail_size;
+       char       flags_seen_field;
+       char       flags_deleted_field;
+       char       flags_flagged_field;
+       char       flags_answered_field;
+       char       flags_recent_field;
+       char       flags_draft_field;
+       char       flags_forwarded_field;
+       int        DRM_status;
+       int        priority;
+       int        save_status;
+       int        lock_status;
+       int        report_status;
+       int        attachment_count;
+       int        inline_content_count;
+       int        thread_id;
+       int        thread_item_count;
+       char      *preview_text;
+       int        meeting_request_status;
+} emstorage_mail_tbl_t;
+
+/* mail_attachment_tbl entity */
+typedef struct 
+{
+       int   attachment_id;
+       char *attachment_name;
+       char *attachment_path;
+       int   attachment_size;
+       int   mail_id;
+       int   account_id;
+       char *mailbox_name;
+       int   attachment_save_status;              /* 1 : existing, 0 : not existing */
+       int   attachment_drm_type;                 /* 0 : none, 1 : object, 2 : rights, 3 : dcf */
+       int   attachment_drm_method;               /* 0 : none, 1 : FL, 2 : CD, 3 : SSD, 4 : SD */
+       int   attachment_inline_content_status;    /* 1 : inline content , 0 : not inline content */
+       char *attachment_mime_type;
+#ifdef __ATTACHMENT_OPTI__     
+       int   encoding;
+       char *section;  
+#endif 
+} emstorage_attachment_tbl_t;
+
+
+typedef enum {
+       RETRIEVE_ALL = 1,           /*  mail */
+       RETRIEVE_ENVELOPE,          /*  mail envelope */
+       RETRIEVE_SUMMARY,           /*  mail summary */
+       RETRIEVE_FIELDS_FOR_DELETE, /*  account_id, mail_id, server_mail_yn, server_mailbox, server_mail_id */
+       RETRIEVE_ACCOUNT,           /*  account_id */
+       RETRIEVE_FLAG,              /*  mailbox, flag1, thread_id */
+       RETRIEVE_ID,                /*  mail_id */
+       RETRIEVE_ADDRESS,           /*  mail_id, contact_info */
+} emstorage_mail_field_type_t;
+
+typedef struct _emstorage_search_filter_t {
+       char *key_type;
+       char *key_value;
+       struct _emstorage_search_filter_t *next;
+} emstorage_search_filter_t;
+
+typedef enum {
+       EMF_CREATE_DB_NORMAL = 0, 
+       EMF_CREATE_DB_CHECK, 
+} emstorage_create_db_type_t;
+
+typedef enum {
+       SET_TYPE_SET        = 1,
+       SET_TYPE_UNION      = 2,
+       SET_TYPE_MINUS      = 3, 
+       SET_TYPE_INTERSECT  = 4 /* Not supported */
+} emstorage_set_type_t;
+
+
+/*****************************************************************************
+                                                               etc
+*****************************************************************************/
+#define MAX_PW_FILE_NAME_LENGTH                   128 /*  password file name for secure storage */
+
+#ifdef __FEATURE_LOCAL_ACTIVITY__
+
+typedef enum
+{
+ ACTIVITY_FETCHIMAPFOLDER = 1,  /* Fetch Mail server Activity */
+ ACTIVITY_DELETEMAIL,                  /* Delete Mail Activity */              
+ ACTIVITY_MODIFYFLAG,                  /* Modify Mail flag Activity */         
+ ACTIVITY_MODIFYSEENFLAG,              /* Modify Mail seen flag Activity */
+ ACTIVITY_MOVEMAIL,                            /* Move Mail Activity */
+ ACTIVITY_DELETEALLMAIL,               /* Delete All Mails activity */
+ ACTIVITY_COPYMAIL,                            /* Copy Mail Activity */
+ ACTIVITY_SAVEMAIL,                            /* Save Mail activity */
+ ACTIVITY_DELETEMAIL_SEND,             /* New Delete Mail Activity added to be processed by send thread */
+}eActivity_type;
+
+
+/**
+ * emstorage_activity_tbl_t - Email Local activity Structure
+ *
+ */
+typedef struct
+{
+       int activity_id;                                /* Activity ID */
+       int account_id;                          /* Account ID */
+       int mail_id;                             /* Mail ID    */
+       int activity_type;    /* Local Activity Type */
+       char *server_mailid;                 /* Server Mail ID or Mailbox name */
+       char *src_mbox;                          /* Source Mailbox in case of mail_move */      
+       char *dest_mbox;                 /* Destination Mailbox name in case of Mail move operation */
+
+} emstorage_activity_tbl_t;
+
+#endif
+
+INTERNAL_FUNC int emstorage_shm_file_init(const char *shm_file_name);
+
+
+/************** Database Management ***************/
+/*
+ * em_db_open
+ * description  :  open db and register busy handler
+ */
+INTERNAL_FUNC int em_db_open(sqlite3 **sqlite_handle, int *err_code);
+
+/*
+ * emstorage_db_open
+ *
+ * description :  open db and set global variable sqlite_emmb 
+ * arguments : 
+ * return  : 
+ */
+INTERNAL_FUNC sqlite3* emstorage_db_open(int *err_code);
+
+/*
+ * emstorage_db_close
+ *
+ * description :  close db with global variable sqlite_emmb
+ * arguments : 
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_db_close(int *err_code);
+
+/*
+ * emstorage_open
+ *
+ * description :  initialize storage manager
+ * arguments : 
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_open(int *err_code);
+
+/*
+ * emstorage_close
+ *
+ * description :  cleanup storage manager
+ * arguments : 
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_close(int *err_code);
+
+/*
+ * emstorage_create_table
+ *
+ * description :  create account/address table in database.
+ * arguments : 
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_create_table(emstorage_create_db_type_t type, int *err_code);
+
+
+/**
+ * Check whether there is the same account information in the db
+ *
+ * @param[in] account  account that 
+ * @param[in] transaction      If the argument is true, engine commits transaction or executes rollback.
+ * @param[out] err_code        Error code.
+ * @remarks N/A
+ * @return This function returns true if there is no duplicated account. returns false and set error code if there are duplicated accounts or error 
+ */
+INTERNAL_FUNC int emstorage_check_duplicated_account(emf_account_t *account, int transaction, int *err_code);
+
+
+/**
+ * Get number of accounts from account table.
+ *
+ * @param[out] count           The number of accounts is saved here.
+ * @param[in] transaction      If the argument is true, engine commits transaction or executes rollback.
+ * @remarks N/A
+ * @return This function returns 0 on success or error code on failure.
+ */
+INTERNAL_FUNC int emstorage_get_account_count(int *count, int transaction, int *err_code);
+
+/**
+ * Get account from account table.
+ *
+ * @param[in, out] select_num  Upon entry, the argument contains the number of accounts to select.
+                                   Upon exit, it is set to the number of accounts to been selected.
+ * @param[out] account_list            The selected accounts is saved here. this pointer must be freed after being used.
+ * @param[in] transaction              If the argument is true, engine commits transaction or executes rollback.
+ * @remarks N/A
+ * @return This function returns 0 on success or error code on failure.
+ */
+INTERNAL_FUNC int emstorage_get_account_list(int *select_num, emstorage_account_tbl_t **account_list, int transaction, int with_password, int *err_code);
+
+/*
+ * emstorage_get_account_by_name
+ *
+ * description :  get account from account table by account name
+ * arguments : 
+ *    db  :  database pointer
+ *    account_id  :  account id
+ *    pulloption  :  option to specify fetching full or partial data
+ *    account  :  buffer to hold selected account
+ *              this buffer must be free after it has been used.
+ * return  : 
+ */
+/* sowmya.kr, 281209 Adding signature to options in emf_account_t changes */
+
+INTERNAL_FUNC int emstorage_get_account_by_id(int account_id, int pulloption, emstorage_account_tbl_t **account, int transaction, int *err_code);
+
+
+/*
+ * emstorage_get_password_length_of_account
+ *
+ * description: get password length of account.
+ * arguments:
+ *    account_id : account id
+ *    password_length : password length
+ * return :
+ */
+
+INTERNAL_FUNC int emstorage_get_password_length_of_account(int account_id, int *password_length, int* err_code);
+
+/*
+ * emstorage_update_account
+ *
+ * description :  change a account from account table
+ * arguments : 
+ *    account_id  :  account id
+ *    account  :  buffer to hold selected account
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_update_account(int account_id, emstorage_account_tbl_t *account, int transaction, int *err_code);
+
+/*
+ * emstorage_get_sync_status_of_account
+ *
+ * description :  get a sync status field from account table
+ * arguments : 
+ *    account_id  :  account id
+ *    result_sync_status : sync status value
+ * return  : 
+ */
+
+INTERNAL_FUNC int emstorage_get_sync_status_of_account(int account_id, int *result_sync_status,int *err_code);
+
+/*
+ * emstorage_update_sync_status_of_account
+ *
+ * description :  update a sync status field from account table
+ * arguments : 
+ *    account_id  :  account id
+ *    set_operator  :  set operater. refer emstorage_set_type_t
+ *    sync_status : sync status value
+ * return  : 
+ */
+
+INTERNAL_FUNC int emstorage_update_sync_status_of_account(int account_id, emstorage_set_type_t set_operator, int sync_status, int transaction, int *err_code);
+
+/*
+ * emstorage_add_account
+ *
+ * description :  add a account to account table
+ * arguments : 
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_add_account(emstorage_account_tbl_t *account, int transaction, int *err_code);
+
+/*
+ * emstorage_delete_account
+ *
+ * description :  delete a account from account table
+ * arguments : 
+ *    db  :  database pointer
+ *    account_id  :  account id to be deteted
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_delete_account(int account_id, int transaction, int *err_code);
+
+/*
+ * emstorage_free_account
+ *
+ * description :  free local accout memory
+ * arguments : 
+ *    account_list  :  double pointer
+ *    count  :  count of local account
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_free_account(emstorage_account_tbl_t **account_list, int count, int *err_code);
+
+
+/************** Mailbox(Local box And Imap mailbox) Management ******************/
+
+/*
+ * emstorage_get_mailbox_count
+ *
+ * description :  get number of mailbox from local mailbox table
+ * arguments : 
+ *    db  :  database pointer
+ *    count  :  number of accounts
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_get_mailbox_count(int account_id, int local_yn, int *count, int transaction, int *err_code);
+
+/*
+ * emstorage_get_mailbox
+ *
+ * description :  get local mailbox from local mailbox table
+ * arguments : 
+ *    db  :  database pointer
+ *    sort_type         :      in - sorting type.
+ *    select_num        :      in - number of selected account
+ *                             out - number to been selected
+ *    mailbox_list      :      buffer to hold selected account
+ *                     this buffer must be free after it has been used.
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_get_mailbox(int account_id, int local_yn, email_mailbox_sort_type_t sort_type, int *select_num, emstorage_mailbox_tbl_t **mailbox_list,  int transaction, int *err_code);
+
+/*
+ * emstorage_get_child_mailbox_list
+ *
+ * description :  get child mailbox list  from given  mailbox 
+ * arguments : 
+ *    account_id  :  in - account id
+ *    parent_mailbox_name  :  in - parent_mailbox_name to fetch child list
+ *    local_yn - in - local mailbox or not
+ *    select_num - out   :  count of mailboxes
+ *    mailbox_list - out  :    list of mailboxes        
+ *    err_code - out  :  error code, if any
+ */
+
+
+INTERNAL_FUNC int emstorage_get_child_mailbox_list(int account_id, char *parent_mailbox_name, int *select_num, emstorage_mailbox_tbl_t **mailbox_list, int transaction, int *err_code);
+
+/*
+ * emstorage_get_mailbox_by_name
+ *
+ * description :  get local mailbox from local mailbox table by mailbox name
+ * arguments : 
+ *    db  :  database pointer
+ *    mailbox_name  :  mailbox name
+ *    mailbox  :  buffer to hold selected local mailbox
+ *              this buffer must be free after it has been used.
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_get_mailbox_by_name(int account_id, int local_yn, char *mailbox_name, emstorage_mailbox_tbl_t **mailbox, int transaction, int *err_code);
+INTERNAL_FUNC int emstorage_get_mailbox_ex(int account_id, int local_yn, int with_count, int *select_num, emstorage_mailbox_tbl_t **mailbox_list, int transaction, int *err_code);
+INTERNAL_FUNC int emstorage_get_mailbox_by_mailbox_type(int account_id, emf_mailbox_type_e mailbox_type, emstorage_mailbox_tbl_t **mailbox, int transaction, int *err_code);
+INTERNAL_FUNC int emstorage_get_mailboxname_by_mailbox_type(int account_id, emf_mailbox_type_e mailbox_type, char **mailbox, int transaction, int *err_code);
+
+INTERNAL_FUNC int emstorage_update_mailbox_modifiable_yn(int account_id, int local_yn, char *mailbox_name, int modifiable_yn, int transaction, int *err_code);
+INTERNAL_FUNC int emstorage_update_mailbox_total_count(int account_id, char *mailbox_name, int total_count_on_server, int transaction, int *err_code);
+
+
+/*
+ * emstorage_update_mailbox
+ *
+ * description :  change a account from account table
+ * arguments : 
+ *    db  :  database pointer
+ *    mailbox_name  :  mailbox name
+ *    mailbox  :  buffer to hold selected local mailbox
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_update_mailbox(int account_id, int local_yn, char *mailbox_name, emstorage_mailbox_tbl_t *mailbox, int transaction, int *err_code);
+
+/*
+ * emstorage_update_mailbox_type
+ *
+ * description :  change a mailbox from mailbox tbl
+ * arguments : 
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_update_mailbox_type(int account_id, int local_yn, char *mailbox_name, emstorage_mailbox_tbl_t *mailbox, int transaction, int *err_code);
+
+/*
+ * emstorage_add_mailbox
+ *
+ * description :  add a local mailbox to local mailbox table
+ * arguments : 
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_add_mailbox(emstorage_mailbox_tbl_t *mailbox, int transaction, int *err_code);
+
+/*
+ * emstorage_delete_mailbox
+ *
+ * description :  delete a local mailbox from local mailbox table
+ * arguments : 
+ *    db  :  database pointer
+ *    mailbox_name  :  mailbox name of record to be deteted
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_delete_mailbox(int account_id, int local_yn, char *mailbox_name, int transaction, int *err_code);
+
+INTERNAL_FUNC int emstorage_rename_mailbox(int account_id, char *old_mailbox_name, char *new_mailbox_name, int transaction, int *err_code);
+INTERNAL_FUNC int emstorage_get_overflowed_mail_id_list(int account_id, char *mailbox_name, int mail_slot_size, int **mail_id_list, int *mail_id_count, int transaction, int *err_code);
+INTERNAL_FUNC int emstorage_set_mail_slot_size(int account_id, char *mailbox_name, int new_slot_size, int transaction, int *err_code);
+
+INTERNAL_FUNC int emstorage_set_all_mailbox_modifiable_yn(int account_id, int modifiable_yn, int transaction, int *err_code);
+INTERNAL_FUNC int emstorage_get_mailbox_by_modifiable_yn(int account_id, int modifiable_yn, int *select_num, emstorage_mailbox_tbl_t **mailbox_list, int transaction, int *err_code);
+
+/*
+ * emstorage_free_mailbox
+ *
+ * description :  free local mailbox memory
+ * arguments : 
+ *    mailbox_list  :  double pointer
+ *    count  :  count of local mailbox
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_free_mailbox(emstorage_mailbox_tbl_t **mailbox_list, int count, int *err_code);
+
+
+/************** Read Mail UID Management ******************/
+
+
+
+INTERNAL_FUNC int emstorage_get_count_read_mail_uid(int account_id, char *mailbox_name, int *count, int transaction, int *err_code);
+
+
+/*
+ * emstorage_check_read_mail_uid
+ *
+ * description :  check that this uid exists in uid table
+ * arguments : 
+ *    db  :  database pointer
+ *    mailbox_name  :  mailbox name
+ *    s_uid  :  uid string to be checked
+ *    exist  :  variable to hold checking result. (0 : not exist, 1 : exist)
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_check_read_mail_uid(int account_id, char *mailbox_name, char *uid, int *exist, int transaction, int *err_code);
+
+/*
+ * emstorage_get_read_mail_size
+ *
+ * description :  get mail size from read mail uid
+ * arguments : 
+ *    db  :  database pointer
+ *    local_mbox  :  local mailbox name
+ *    local_uid  :  mail uid of local mailbox
+ *    mailbox_name  :  server mailbox name
+ *    uid  :  mail uid string of server mail
+ *    read_mail_uid  :  variable to hold read mail uid information
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_get_downloaded_list(int account_id, char *local_mbox, emstorage_read_mail_uid_tbl_t **read_mail_uid, int *count, int transaction, int *err_code);
+
+INTERNAL_FUNC int emstorage_get_downloaded_mail(int mail_id, emstorage_mail_tbl_t **mail, int transaction, int *err_code);
+
+/*
+ * emstorage_get_read_mail_size
+ *
+ * description :  get mail size from read mail uid
+ * arguments : 
+ *    db  :  database pointer
+ *    mailbox_name  :  mailbox name
+ *    s_uid  :  mail uid string
+ *    size  :  variable to hold mail size
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_get_downloaded_mail_size(int account_id, char *local_mbox, int local_uid, char *mailbox_name, char *uid, int *mail_size, int transaction, int *err_code);
+
+/*
+ * emstorage_add_downloaded_mail
+ *
+ * description :  add read mail uid
+ * arguments : 
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_add_downloaded_mail(emstorage_read_mail_uid_tbl_t *read_mail_uid, int transaction, int *err_code);
+
+/*
+ * emstorage_change_read_mail_uid
+ *
+ * description :  modify read mail uid
+ * arguments : 
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_change_read_mail_uid(int account_id, char *local_mbox, int local_uid, char *mailbox_name, char *uid, 
+                                    emstorage_read_mail_uid_tbl_t *read_mail_uid, int transaction, int *err_code);
+
+/*
+ * emstorage_remove_downloaded_mail
+ *
+ * description :  
+ * arguments : 
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_remove_downloaded_mail(int account_id, char *mailbox_name, char *uid, int transaction, int *err_code);
+
+
+INTERNAL_FUNC int emstorage_update_read_mail_uid(int mail_id, char *new_server_uid, char *mbox_name, int *err_code);
+
+/*
+ *  free memroy
+ */
+INTERNAL_FUNC int emstorage_free_read_mail_uid(emstorage_read_mail_uid_tbl_t **read_mail_uid, int count, int *err_code);
+
+
+
+/************** Rules(Filtering) Management ******************/
+
+/*
+ * emstorage_get_rule_count
+ *
+ * description :  get number of rules from rule table
+ * arguments : 
+ *    db  :  database pointer
+ *    count  :  number of accounts
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_get_rule_count(int account_id, int *count, int transaction, int *err_code);
+
+/*
+ * emstorage_get_rule
+ *
+ * description :  get rules from rule table
+ * arguments : 
+ *    db  :  database pointer
+ *    start_idx  :  the first index to be selected (min : 0)
+ *    select_num  :  in - number of selected account
+ *                 out - number to been selected
+ *    is_completed  :  is completed ? 
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_get_rule(int account_id, int type, int start_idx, int *select_num, int *is_completed, emstorage_rule_tbl_t **rule_list, int transaction, int *err_code);
+
+/*
+ * emstorage_get_rule
+ *
+ * description :  get rules from rule table
+ * arguments : 
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_get_rule_by_id(int account_id, int rule_id, emstorage_rule_tbl_t **rule, int transaction, int *err_code);
+
+/*
+ * emstorage_change_rule
+ *
+ * description :  change a account from account table
+ * arguments : 
+ *    db  :  database pointer
+ *    mailbox_name  :  mailbox name
+ *    rule  :  buffer to hold selected rule
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_change_rule(int account_id, int rule_id, emstorage_rule_tbl_t *rule, int transaction, int *err_code);
+
+/*
+ * emstorage_find_rule
+ *
+ * description :  find a rule already exists
+ * arguments : 
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_find_rule(emstorage_rule_tbl_t *rule, int transaction, int *err_code);
+
+/*
+ * emstorage_add_rule
+ *
+ * description :  add a rule to rule table
+ * arguments : 
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_add_rule(emstorage_rule_tbl_t *rule, int transaction, int *err_code);
+
+/*
+ * emstorage_delete_rule
+ *
+ * description :  delete a rule from rule table
+ * arguments : 
+ *    db  :  database pointer
+ *    rule  :  rule to be deteted
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_delete_rule(int account_id, int rule_id, int transaction, int *err_code);
+
+/*
+ * emstorage_free_rule
+ *
+ * description :  free rule memory
+ * arguments : 
+ *    count  :  count of rule
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_free_rule(emstorage_rule_tbl_t **rule_list, int count, int *err_code);
+
+
+INTERNAL_FUNC int emstorage_filter_mails_by_rule(int account_id, char *dest_mailbox_name, emstorage_rule_tbl_t *rule, int **filtered_mail_id_list, int *count_of_mails, int *err_code);
+
+/************** Mail Management ******************/
+
+/*
+ * emstorage_get_mail_count
+ *
+ * description :  get mail total and unseen count from mail table
+ * arguments : 
+ *    total  :  total count
+ *    unseen  :  unseen mail count
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_get_mail_count(int account_id, const char *mailbox, int *total, int *unseen, int transaction, int *err_code);
+
+/*
+ * emstorage_get_mail_by_id
+ *
+ * description :  get mail from mail table by mail id
+ * arguments : 
+ *    mail_id  :  mail id
+ *    mail  :  double pointer to hold mail
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_get_mail_by_id(int mail_id, emstorage_mail_tbl_t **mail, int transaction, int *err_code);
+
+/*
+ * emstorage_get_mail
+ *
+ * description :  get mail from mail table by mail sequence
+ * arguments : 
+ *    account_id  :  account id
+ *    mailbox  :  mailbox name
+ *    mail_no  :  mail sequence number (not mail id)
+ *    mail  :  double pointer to hold mail
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_get_mail_field_by_id(int mail_id, int type, emstorage_mail_tbl_t **mail, int transaction, int *err_code);
+
+/*
+ * emstorage_get_mail_field_by_multiple_mail_id
+ *
+ * description :  
+ * arguments : 
+ *    mail_ids  : 
+ *    number_of_mails  :  
+ *    type  :  
+ *    mail  :  
+ *    transaction :
+ *    err_code :
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_get_mail_field_by_multiple_mail_id(int mail_ids[], int number_of_mails, int type, emstorage_mail_tbl_t** mail, int transaction, int *err_code);
+
+/*
+ * emstorage_query_mail_list
+ *
+ * description :  query mail list information
+ */
+INTERNAL_FUNC int emstorage_query_mail_list(const char *conditional_clause, int transaction, emf_mail_list_item_t** result_mail_list,  int *result_count,  int *err_code);
+
+/*
+ * emstorage_query_mail_tbl
+ *
+ * description :  query mail table information
+ */
+INTERNAL_FUNC int emstorage_query_mail_tbl(const char *conditional_clause, int transaction, emstorage_mail_tbl_t** result_mail_tbl, int *result_count, int *err_code);
+
+/*
+ * emstorage_get_mail_list
+ *
+ * description :  search mail list information
+ */
+INTERNAL_FUNC int emstorage_get_mail_list(int account_id, const char *mailbox_name, emf_email_address_list_t* addr_list, int thread_id, int start_index, int limit_count, int search_type, const char *search_value, emf_sort_type_t sorting, int transaction, emf_mail_list_item_t** mail_list,  int *result_count,  int *err_code);
+/*
+ * emstorage_get_mails
+ *
+ * description :  search mail list information
+ */
+INTERNAL_FUNC int emstorage_get_mails(int account_id, const char *mailbox_name, emf_email_address_list_t* addr_list, int thread_id, int start_index, int limit_count, emf_sort_type_t sorting,  int transaction, emstorage_mail_tbl_t** mail_list, int *result_count, int *err_code);
+INTERNAL_FUNC int emstorage_get_searched_mail_list(int account_id, const char *mailbox_name, int thread_id, int search_type, const char *search_value, int start_index, int limit_count, emf_sort_type_t sorting, int transaction, emf_mail_list_item_t **mail_list,  int *result_count,  int *err_code);
+INTERNAL_FUNC int emstorage_get_maildata_by_servermailid(int account_id, char *server_mail_id, emstorage_mail_tbl_t **mail, int transaction, int *err_code);
+INTERNAL_FUNC int emstorage_get_latest_unread_mailid(int account_id, int *mail_id, int *err_code);
+
+
+/**
+ * Prepare mail search.
+ *
+ * @param[in] search                   Specifies the searching condition.
+ * @param[in] account_id               Specifies the account id. if 0, all accounts.
+ * @param[in] mailbox                  Specifies the mailbox name. if NULL, all mailboxes.
+ * @param[in] sorting                  Specifies the sorting condition.
+ * @param[out] search_handle   the searching handle is saved here.
+ * @param[out] searched                        the result count is saved here.
+ * @remarks N/A
+ * @return This function returns 0 on success or error code on failure.
+ */
+INTERNAL_FUNC int emstorage_mail_search_start(emstorage_search_filter_t *search, int account_id, char *mailbox, int sorting, int *search_handle, int *searched, int transaction, int *err_code);
+
+/*
+ * emstorage_mail_search_result
+ *
+ * description :  retrieve mail as searching result
+ * arguments : 
+ *    search_handle  :  handle to been gotten from emstorage_mail_search_start
+ *    mail  :  double pointer to hold mail
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_mail_search_result(int search_handle, emstorage_mail_field_type_t type, void **data, int transaction, int *err_code);
+
+/*
+ * emstorage_mail_search_end
+ *
+ * description :  finish searching
+ * arguments : 
+ *    search_handle  :  handle to be finished
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_mail_search_end(int search_handle, int transaction, int *err_code);
+
+
+
+/*
+ * emstorage_set_field_of_mails_with_integer_value
+ *
+ * description       :  update a filed of mail
+ * arguments : 
+ *    account_id                :  Specifies the account id. 
+ *    mail_ids       :  mail id list to be changed
+ *    mail_ids_count :  count of mail list
+ *    field_name     :  specified field name
+ *    value          :  specified value
+ * return       : 
+ */
+INTERNAL_FUNC int emstorage_set_field_of_mails_with_integer_value(int account_id, int mail_ids[], int mail_ids_count, char *field_name, int value, int transaction, int *err_code);
+
+/*
+ * emstorage_change_mail_field
+ *
+ * description :  update partial mail data
+ * arguments : 
+ *    mail_id  :  mail id
+ *    type  :  changing type
+ *    mail  :  mail pointer
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_change_mail_field(int mail_id, emf_mail_change_type_t type, emstorage_mail_tbl_t *mail, int transaction, int *err_code);
+
+/*
+ * emstorage_increase_mail_id
+ *
+ * description :  increase unique mail id
+ * arguments : 
+ *    mail_id  :  pointer to store the unique id
+ * return  : 
+ */
+
+/*
+ * emstorage_change_mail
+ *
+ * description :  update mail
+ * arguments : 
+ *    mail_id  :  mail id to be changed
+ *    mail  :  mail pointer
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_change_mail(int mail_id, emstorage_mail_tbl_t *mail, int transaction, int *err_code);
+INTERNAL_FUNC int emstorage_clean_save_status(int save_status, int  *err_code);
+INTERNAL_FUNC int emstorage_update_server_uid(char *old_server_uid, char *new_server_uid, int *err_code);
+INTERNAL_FUNC int emstorage_modify_mailbox_of_mails(char *old_mailbox_name, char *new_mailbox_name, int transaction, int *err_code);
+
+INTERNAL_FUNC int emstorage_increase_mail_id(int *mail_id, int transaction, int *err_code);
+
+/*
+ * emstorage_add_mail
+ *
+ * description :  add a mail to mail table
+ * arguments : 
+ *    mail  :  mail pointer to be inserted
+ *   get_id :  must get uinque id in function
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_add_mail(emstorage_mail_tbl_t *mail, int get_id, int transaction, int *err_code);
+
+/*
+ * emstorage_move_multiple_mails
+ *
+ * description :
+ * arguments : 
+ *    account_id  :  
+ *   target_mailbox_name :
+ *   mail_ids :
+ *   number_of_mails :
+ *   transaction :
+ *   err_code :
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_move_multiple_mails(int account_id, char *target_mailbox_name, int mail_ids[], int number_of_mails, int transaction, int *err_code);
+
+/*
+ * emstorage_delete_mail
+ *
+ * description :  delete mail from mail table
+ * arguments : 
+ *    mail_id  :  mail id to be deleted. if 0, all mail will be deleted.
+ *    from_server  :  delete mail on server.
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_delete_mail(int mail_id, int from_server, int transaction, int *err_code);
+
+/*
+ * emstorage_delete_mail_by_account
+ *
+ * description :  delete mail from mail table by account id
+ * arguments : 
+ *    account_id  :  account id.
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_delete_mail_by_account(int account_id, int transaction, int *err_code);
+
+/*
+ * emstorage_delete_mail
+ *
+ * description :  delete mail from mail table
+ * arguments : 
+ *    account_id  :  account id.
+ *    mbox  :  mail box
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_delete_mail_by_mailbox(int account_id, char *mbox, int transaction, int *err_code);
+
+/*
+ * emstorage_delete_multiple_mails
+ *
+ * description :  
+ * arguments : 
+ *    mail_ids  :
+ *    number_of_mails  :
+ *    transaction  :
+ *    err_code  :
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_delete_multiple_mails(int mail_ids[], int number_of_mails, int transaction, int *err_code);
+
+/*
+ * emstorage_free_mail
+ *
+ * description :  free memory
+ * arguments : 
+ *    mail_list  :  mail array
+ *    count  :  the number of array element
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_free_mail(emstorage_mail_tbl_t **mail_list, int count, int *err_code);
+
+/*
+ * emstorage_get_attachment
+ *
+ * description :  get attachment from attachment table
+ * arguments : 
+ *    mail_id  :  mail id
+ *    no  :  attachment sequence
+ *    attachment  :  double pointer to hold attachment data
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_get_attachment_count(int mail_id, int *count, int transaction, int *err_code);
+
+/*
+ * emstorage_get_attachment_list
+ *
+ * description :  get attachment list from attachment table
+ * arguments : 
+ *    input_mail_id           : mail id
+ *    input_transaction       : transaction option
+ *    attachment_list         : result attachment list
+ *    output_attachment_count : result attachment count
+ * return  : This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR__XXX) on failure.
+ *    
+ */
+INTERNAL_FUNC int emstorage_get_attachment_list(int input_mail_id, int input_transaction, emstorage_attachment_tbl_t** output_attachment_list, int *output_attachment_count);
+
+
+/*
+ * emstorage_get_attachment
+ *
+ * description :  get attachment from attachment table
+ * arguments : 
+ *    mail_id  :  mail id
+ *    no  :  attachment id
+ *    attachment  :  double pointer to hold attachment data
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_get_attachment(int mail_id, int no, emstorage_attachment_tbl_t **attachment, int transaction, int *err_code);
+
+/*
+ * emstorage_get_attachment
+ *
+ * description :  get nth-attachment from attachment table
+ * arguments : 
+ *    mail_id  :  mail id
+ *    nth  :  index of the desired attachment (min : 1)
+ *    attachment  :  double pointer to hold attachment data
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_get_attachment_nth(int mail_id, int nth, emstorage_attachment_tbl_t **attachment, int transaction, int *err_code);
+
+/*
+ * emstorage_change_attachment_field
+ *
+ * description :  update partial mail attachment data
+ * arguments : 
+ *    mail_id  :  mail id
+ *    type  :  changing type
+ *    mail  :  mail pointer
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_change_attachment_field(int mail_id, emf_mail_change_type_t type, emstorage_attachment_tbl_t *attachment, int transaction, int *err_code);
+
+/*
+ * emstorage_change_attachment_mbox
+ *
+ * description :  update mailbox from attahcment table
+ * arguments : 
+ *    account_id  :  account id
+ *    old_mailbox_name  :  old mail box
+ *    new_mailbox_name  :  new mail box
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_change_attachment_mbox(int account_id, char *old_mailbox_name, char *new_mailbox_name, int transaction, int *err_code);
+
+/* Get new attachment id */
+/*
+ * emstorage_get_new_attachment_no
+ *
+ * description :  Get new attachment id
+ * arguments : 
+ *    attachment_no  :  attachment id pointer
+ * return  : 
+ */
+
+INTERNAL_FUNC int emstorage_get_new_attachment_no(int *attachment_no, int *err_code);
+
+/* insert attachment to mail attachment table */
+/*
+ * emstorage_add_attachment
+ *
+ * description :  insert a attachment to attachment table
+ * arguments : 
+ *    attachment  :  attachment pointer
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_add_attachment(emstorage_attachment_tbl_t *attachment, int iscopy, int transaction, int *err_code);
+
+
+INTERNAL_FUNC int emstorage_update_attachment(emstorage_attachment_tbl_t *attachment, int transaction, int *err_code);
+
+/* delete a mail from mail table */
+/*
+ * emstorage_delete_attachment_on_db
+ *
+ * description :  delete attachment from attachment table
+ * arguments : 
+ *    mail_id  :  mail id to contain attachment
+ *    no  :  attachment sequence number
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_delete_attachment_on_db(int mail_id, int no, int transaction, int *err_code);
+
+/*
+ * emstorage_delete_attachment_all_on_db
+ *
+ * description :  delete attachment from mail table
+ * arguments : 
+ *    account_id  :  account id.
+ *    mbox  :  mail box
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_delete_attachment_all_on_db(int account_id, char *mbox, int transaction, int *err_code);
+
+/*
+ * emstorage_free_attachment
+ *
+ * description :  free memory
+ * arguments : 
+ *    mail_list  :  mail array
+ *    count  :  the number of array element
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_free_attachment(emstorage_attachment_tbl_t **attachment_list, int count, int *err_code);
+
+/*  emstorage_get_mail_count_with_draft_flag - Send number of mails in a mailbox with draft flag enabled */
+INTERNAL_FUNC int emstorage_get_mail_count_with_draft_flag(int account_id, const char *mailbox, int *total, int transaction, int *err_code);
+
+/*  emstorage_get_mail_count_on_sending - Send number of mails being sent in a mailbox (status == EMF_MAIL_STATUS_SENDING) */
+INTERNAL_FUNC int emstorage_get_mail_count_on_sending(int account_id, const char *mailbox, int *total, int transaction, int * err_code);
+
+INTERNAL_FUNC int emstorage_is_mailbox_full(int account_id, emf_mailbox_t *mailbox, int *result, int *err_code);
+
+INTERNAL_FUNC int emstorage_get_max_mail_count();
+
+INTERNAL_FUNC int emstorage_mail_get_total_diskspace_usage(unsigned long *total_usage,  int transaction, int *err_code);
+
+
+/**
+ * begin a transaction.
+ *
+ * @param[in] d1       Reserved.
+ * @param[in] d2       Reserved.
+ * @remarks emstorage_commit_transaction or emstorage_commit_transaction must be called after this function.
+ * @return This function returns 0 on success or error code on failure.
+ */
+
+INTERNAL_FUNC int emstorage_begin_transaction(void *d1, void *d2, int *err_code);
+
+/**
+ * commit a transaction.
+ *
+ * @param[in] d1       Reserved.
+ * @param[in] d2       Reserved.
+ * @remarks N/A
+ * @return This function returns 0 on success or error code on failure.
+ */
+INTERNAL_FUNC int emstorage_commit_transaction(void *d1, void *d2, int *err_code);
+
+/**
+ * rollback db.
+ *
+ * @param[in] d1       Reserved.
+ * @param[in] d2       Reserved.
+ * @remarks N/A
+ * @return This function returns 0 on success or error code on failure.
+ */
+INTERNAL_FUNC int emstorage_rollback_transaction(void *d1, void *d2, int *err_code);
+
+/**
+ * clear mail data from db.
+ *
+ * @param[in]  transaction     
+ * @param[out] err_code        
+ * @remarks N/A
+ * @return This function returns 0 on success or error code on failure.
+ */
+
+INTERNAL_FUNC int emstorage_clear_mail_data(int transaction, int *err_code);
+
+/*
+ * emstorage_get_save_name
+ *
+ * description :  get file name for saving data
+ * arguments : 
+ *    account_id  :  account id
+ *    mail_id  :  mail id
+ *    atch_id  :  attachment id
+ *    fname  :  file name
+ *    name_buf  :  buffer to hold file name. (MAX : 512Bytes)
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_get_save_name(int account_id, int mail_id, int atch_id, char *fname, char *name_buf, int *err_code);
+
+/*
+ * emstorage_get_dele_name
+ *
+ * description :  get a name for deleting contents from file system.
+ * arguments : 
+ *    account_id  :  account id
+ *    mail_id  :  mail id
+ *    atch_id  :  attachment id
+ *    fname  :  reserved
+ *    name_buf  :  buffer to hold file name. (MAX : 512Bytes)
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_get_dele_name(int account_id, int mail_id, int atch_id, char *fname, char *name_buf, int *err_code);
+
+/*
+ * emstorage_create_dir
+ *
+ * description :  create directory
+ * arguments : 
+ *    name_buf  :  buffer to hold file name. (MAX : 512Bytes)
+ *    no  :  attachment no.
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_create_dir(int account_id, int mail_id, int atch_id, int *err_code);
+
+/*
+ * emstorage_copy_file
+ *
+ * description :  copy a attachment file
+ * arguments : 
+ *    src_file  :  source file
+ *    dst_file  :  destination file
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_copy_file(char *src_file, char *dst_file, int sync_file, int *err_code);
+
+/*
+ * emstorage_move_file
+ *
+ * description :  move a file
+ * arguments : 
+ *    src_file  :  source file
+ *    dst_file  :  destination file
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_move_file(char *src_file, char *dst_file, int sync_status, int *err_code);
+
+/*
+ * emstorage_move_file
+ *
+ * description :  delete a file
+ * arguments : 
+ *    src_file  :  file to be deleted
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_delete_file(char *src_file, int *err_code);
+
+/*
+ * emstorage_delete_dir
+ *
+ * description :  delete a directory
+ * arguments : 
+ *    src_dir  :  directory to be deleted
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_delete_dir(char *src_dir, int *err_code);
+
+
+
+INTERNAL_FUNC void emstorage_flush_db_cache();
+INTERNAL_FUNC int emstorage_test(int mail_id, int account_id, char *full_address_to, char *full_address_cc, char *full_address_bcc, int *err_code);
+/**
+ * emstorage_notify_storage_event - Notification for storage related operations
+ * 
+ */
+INTERNAL_FUNC int emstorage_notify_storage_event(emf_noti_on_storage_event event_type, int data1, int data2 , char *data3, int data4);
+
+/**
+ * emstorage_notify_network_event - Notification for network related operations
+ * 
+ */
+INTERNAL_FUNC int emstorage_notify_network_event(emf_noti_on_network_event event_type, int data1, char *data2, int data3, int data4);
+INTERNAL_FUNC int emstorage_get_sender_list(int account_id, const char *mailbox_name, int search_type, const char *search_value, emf_sort_type_t sorting, emf_sender_list_t** sender_list, int *sender_count,  int *err_code);
+INTERNAL_FUNC int emstorage_free_sender_list(emf_sender_list_t **sender_list, int count);
+
+/* Handling Thread mail */
+INTERNAL_FUNC int emstorage_get_thread_information(int thread_id, emstorage_mail_tbl_t **mail_table_data, int transaction, int *err_code);
+INTERNAL_FUNC int emstorage_get_thread_id_of_thread_mails(emstorage_mail_tbl_t *mail_table_data, int *thread_id, int *result_latest_mail_id_in_thread, int *thread_item_count);
+INTERNAL_FUNC int emstorage_get_thread_id_by_mail_id(int mail_id, int *thread_id, int *err_code);
+INTERNAL_FUNC int emstorage_update_latest_thread_mail(int account_id, int thread_id, int latest_mail_id, int thread_item_count, int transaction, int *err_code);
+
+#ifdef __FEATURE_PARTIAL_BODY_DOWNLOAD__
+
+#define BULK_PARTIAL_BODY_DOWNLOAD_COUNT 10
+enum
+{
+       ACCOUNT_IDX_MAIL_PARTIAL_BODY_ACTIVITY_TBL = 0, 
+       MAIL_IDX_IN_MAIL_PARTIAL_BODY_ACTIVITY_TBL, 
+       SERVER_MAIL_IDX_IN_MAIL_PARTIAL_BODY_ACTIVITY_TBL, 
+       ACTIVITY_IDX_IN_MAIL_PARTIAL_BODY_ACTIVITY_TBL, 
+       ACTIVITY_TYPE_IDX_IN_MAIL_PARTIAL_BODY_ACTIVITY_TBL, 
+       MAILBOX_NAME_IDX_IN_MAIL_PARTIAL_BODY_ACTIVITY_TBL, 
+};
+
+
+INTERNAL_FUNC int   emstorage_get_pbd_activity_data(int account_id, char *mailbox_name, emf_event_partial_body_thd** event_start, int *count, int transaction, int *err_code);
+INTERNAL_FUNC int   emstorage_add_pbd_activity(emf_event_partial_body_thd *local_activity, int *activity_id, int transaction, int *err_code);
+INTERNAL_FUNC int   emstorage_get_pbd_mailbox_list(int account_id, char ***mailbox_list, int *count, int transaction, int *err_code);
+INTERNAL_FUNC int   emstorage_get_pbd_account_list(int **account_list, int *count, int transaction, int *err_code);
+INTERNAL_FUNC int   emstorage_get_pbd_activity_count(int *activity_id_count, int transaction, int *err_code);
+INTERNAL_FUNC int   emstorage_delete_full_pbd_activity_data(int account_id, int transaction, int *err_code);
+INTERNAL_FUNC int   emstorage_delete_pbd_activity(int account_id, int mail_id, int activity_id, int transaction, int *err_code);
+INTERNAL_FUNC int   emstorage_get_mailbox_pbd_activity_count(int account_id, char *mailbox_name, int *activity_count, int transaction, int *err_code);
+INTERNAL_FUNC int   emstorage_update_pbd_activity(char *old_server_uid, char *new_server_uid, char *mbox_name, int *err_code);
+INTERNAL_FUNC int   emstorage_create_file(char *buf, size_t file_size, char *dst_file, int *err_code);
+
+#endif  
+
+INTERNAL_FUNC int   emstorage_free_address_info_list(emf_address_info_list_t **address_info_list);
+
+
+INTERNAL_FUNC void  emstorage_create_dir_if_delete();
+
+#ifdef __FEATURE_BULK_DELETE_MOVE_UPDATE_REQUEST_OPTI__
+INTERNAL_FUNC int emstorage_update_read_mail_uid_by_server_uid(char *old_server_uid, char *new_server_uid, char *mbox_name, int *err_code);
+
+/**
+ * @fn emstorage_get_id_set_from_mail_ids(int mail_ids[], int mail_id_count, emf_id_set_t **server_uids, int *id_set_count, int *err_code);
+ * Prepare an array of mail_id and corresponding server mail id.
+ *
+ *@author                                      h.gahlaut@samsung.com
+ * @param[in] mail_ids                 Specifies the comma separated string of mail_ids. Maximaum size of string should be less than or equal to (QUERY_SIZE - 88)
+ *                                                     where 88 is the length of fixed keywords including ending null character in the QUERY to be formed
+ * @param[out] idset                   Returns the array of mail_id and corresponding server_mail_id sorted by server_mail_ids in ascending order
+ * @param[out] id_set_count            Returns the no. of cells in idset array i.e. no. of sets of mail_ids and server_mail_ids
+ * @param[out] err_code                Returns the error code.
+ * @remarks                                    An Example of Query to be exexuted in this API : 
+ *                                                     SELECT local_uid, s_uid from mail_read_mail_uid_tbl where local_uid in (12, 13, 56, 78);
+ * @return This function returns true on success or false on failure.
+ */
+
+INTERNAL_FUNC int emstorage_get_id_set_from_mail_ids(char *mail_ids, emf_id_set_t **idset, int *id_set_count, int *err_code);
+
+#endif
+
+/**
+ * @fn emstorage_filter_mails_by_rule(int account_id, char dest_mailbox_name, emf_rule_t *rule, int **filtered_mail_id_list, int *count_of_mails, int err_code)
+ * Move mails by specified rule for spam filtering. 
+ *
+ * @author                                                             kyuho.jo@samsung.com
+ * @param[in] account_id                               Account id of the mails and the mailboxes.
+ * @param[in] dest_mailbox_name                        Mailbox name of spam mailbox.
+ * @param[in] rule                                             Filtering rule.
+ * @param[out] filtered_mail_id_list   Mail id list which are filtered by the rule.
+ * @param[out] count_of_mails                  Count of mails which are filtered by the rule.
+ * @param[out] err_code                                        Returns the error code.
+
+ * @remarks                                                                    
+ * @return This function returns true on success or false on failure.
+ */
+
+INTERNAL_FUNC int emstorage_add_meeting_request(int account_id, char *mailbox_name, emf_meeting_request_t *meeting_req, int transaction, int *err_code);
+INTERNAL_FUNC int emstorage_get_meeting_request(int mail_id, emf_meeting_request_t **meeting_req, int transaction, int *err_code);
+INTERNAL_FUNC int emstorage_update_meeting_request(emf_meeting_request_t *meeting_req, int transaction, int *err_code);
+INTERNAL_FUNC int emstorage_change_meeting_request_field(int account_id, char *mailbox_name, emf_mail_change_type_t type, emf_meeting_request_t *meeting_req, int transaction, int *err_code);
+INTERNAL_FUNC int emstorage_change_meeting_request_mailbox(int account_id, char *old_mailbox_name, char *new_mailbox_name, int transaction, int *err_code);
+INTERNAL_FUNC int emstorage_delete_meeting_request(int account_id, int mail_id, char *mailbox_name, int transaction, int *err_code);
+INTERNAL_FUNC int emstorage_free_meeting_request(emf_meeting_request_t **meeting_req, int count, int *err_code);
+
+#ifdef __FEATURE_LOCAL_ACTIVITY__
+/*
+*emstorage_get_next_activity_id
+*
+*description :  get an activity id for a new activity
+*/
+INTERNAL_FUNC int emstorage_get_next_activity_id(int *activity_id, int *err_code);
+
+ /*
+ *emstorage_get_activity_id_list
+ *description  :  get the list of activity ids
+ *arguments  : 
+ *return  : 
+ *
+ */
+ INTERNAL_FUNC int emstorage_get_activity_id_list(int account_id, int **activity_id_list, int *activity_count, int lowest_activity_type, int highest_activity_type, int transaction, int*err_code);
+ /*
+ * emstorage_add_activity
+ *
+ * description :  add an activity to activity table
+ * arguments : 
+ * return  : 
+ */
+INTERNAL_FUNC int emstorage_add_activity(emstorage_activity_tbl_t *local_activity, int transaction, int *err_code);
+
+/**
+  *    emstorage_get_activity - Get the Local activity from the Mail activity table
+  *
+  */
+INTERNAL_FUNC int emstorage_get_activity(int account_id, int activity_id, emstorage_activity_tbl_t **activity_list, int *select_num, int transaction, int *err_code);
+
+/**
+ * emstorage_delete_local_activity - Deletes the Local acitivity Generated based on activity_type
+ * or based on server mail id
+ *
+ */
+INTERNAL_FUNC int emstorage_delete_local_activity(emstorage_activity_tbl_t *local_activity, int transaction, int *err_code);
+
+/**
+ * emstorage_free_local_activity - Free the allocated Activity data
+ * 
+ *
+ */
+INTERNAL_FUNC int emstorage_free_local_activity(emstorage_activity_tbl_t **local_activity_list, int count, int *err_code);
+
+/**
+ * emstorage_free_activity_id_list - Free the allocated Activity List data
+ * 
+ *
+ */
+INTERNAL_FUNC int emstorage_free_activity_id_list(int *activity_id_list, int *error_code);
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __EMAIL_STORAGE_H__ */
+/* EOF */
diff --git a/email-core/include/em-core-account.h b/email-core/include/em-core-account.h
deleted file mode 100755 (executable)
index 4cc92a4..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-
-/****************************************************************************** 
- * File :  em-core-account.h
- * Desc :  Account Management
- * * Auth : 
- * * History : 
- *    2010.08.25  :  created
- *****************************************************************************/
-#ifndef _EM_CORE_ACCOUNT_H_
-#define _EM_CORE_ACCOUNT_H_
-
-#include "emf-types.h"
-#include "em-core-types.h"
-#include "em-storage.h"
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
-
-EXPORT_API emf_account_t *em_core_get_account_reference(int account_id);
-
-EXPORT_API int em_core_account_validate(int account_id, int *err_code);
-
-EXPORT_API int em_core_account_delete(int account_id, int *err_code);
-
-EXPORT_API int em_core_account_create(emf_account_t *account, int *err_code);
-
-EXPORT_API int em_core_init_account_reference();
-
-EXPORT_API int em_core_refresh_account_reference();
-
-EXPORT_API int em_core_free_account_reference();
-
-EXPORT_API int em_core_account_free(emf_account_t **account_list, int count, int *err_code);
-
-EXPORT_API int em_core_account_get_list_refer(emf_account_t **account_list, int *count, int *err_code);
-
-EXPORT_API int em_core_account_validate_with_account_info(emf_account_t *account, int *err_code);
-
-EXPORT_API int em_core_query_server_info(const char* domain_name, emf_server_info_t **result_server_info);
-
-EXPORT_API int em_core_free_server_info(emf_server_info_t **target_server_info);
-
-EXPORT_API int em_core_save_default_account_id(int input_account_id);
-
-EXPORT_API int em_core_load_default_account_id(int *output_account_id);
-
-
-#ifdef __FEATURE_BACKUP_ACCOUNT__
-EXPORT_API int em_core_backup_accounts(const char *file_path, int *error_code);
-
-EXPORT_API int em_core_restore_accounts(const char *file_path, int *error_code);
-#endif /*   __FEATURE_BACKUP_ACCOUNT_ */
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /*_EM_CORE_ACCOUNT_H_*/
-
diff --git a/email-core/include/em-core-api.h b/email-core/include/em-core-api.h
deleted file mode 100755 (executable)
index 5519058..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-/******************************************************************************
- * File :  em-core-api.h
- * Desc :  Mail Engine API Header
- *
- * Auth : 
- *
- * History : 
- *    2006.08.16  :  created
- *****************************************************************************/
-#ifndef _EM_CORE_API_H_
-#define _EM_CORE_API_H_
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
-
-
-int em_core_encode_base64(char *src, unsigned long src_len, char **enc, unsigned long* enc_len, int *err_code);
-
-int em_core_decode_quotedprintable(unsigned char *enc_text, unsigned long enc_len, char **dec_text, unsigned long*dec_len, int *err_code);
-
-int em_core_decode_base64(unsigned char *enc_text, unsigned long enc_len, char **dec_text, unsigned long* dec_len, int *err_code);
-
-int em_core_init(int *err_code);
-
-/*  em_core_set_logout_status - Set the logout status */
-EXPORT_API void em_core_set_logout_status(int status);
-
-/*  em_core_get_logout_status - Get the logout status */
-EXPORT_API void em_core_get_logout_status(int  *status);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /*_EM_CORE_API_H_*/
diff --git a/email-core/include/em-core-event.h b/email-core/include/em-core-event.h
deleted file mode 100755 (executable)
index a60963c..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-/******************************************************************************
- * File :  em-core-event.h
- * Desc :  Mail Engine Event Header
- *
- * Auth : 
- *
- * History : 
- *    2006.08.16  :  created
- *****************************************************************************/
-#ifndef __EM_CORE_EVNET_H__
-#define __EM_CORE_EVNET_H__
-
-#include "emf-types.h"
-#include "em-core-types.h"
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
-
-
-#if !defined(EXPORT_API)
-#define EXPORT_API __attribute__((visibility("default")))
-#endif
-
-void em_core_execute_event_callback(emf_action_t action, int total, int done, int status, int account_id, int mail_id, int handle, int error);
-int em_core_get_active_queue_idx(void);
-
-EXPORT_API int em_core_get_current_thread_type();
-EXPORT_API int em_core_register_event_callback(emf_action_t action, emf_event_callback callback, void *event_data);
-EXPORT_API int em_core_unregister_event_callback(emf_action_t action, emf_event_callback callback);
-EXPORT_API int em_core_get_pending_event(emf_action_t action, int account_id, int mail_id, emf_event_status_type_t *status);
-EXPORT_API int em_core_event_loop_start(int *err_code);
-EXPORT_API int em_core_event_loop_stop(int *err_code);
-EXPORT_API int em_core_insert_event(emf_event_t *event_data, int *handle, int *err_code);
-EXPORT_API int em_core_cancel_thread(int handle, void *arg, int *err_code);
-EXPORT_API int em_core_send_event_loop_start(int *err_code);
-EXPORT_API int em_core_send_event_loop_stop(int *err_code);
-EXPORT_API int em_core_cancel_send_mail_thread(int handle, void *arg, int *err_code);
-EXPORT_API int em_core_check_thread_status(void);
-EXPORT_API void em_core_get_event_queue_status(int *on_sending, int *on_receiving);
-EXPORT_API int em_core_insert_send_event(emf_event_t *event_data, int *handle, int *err_code);
-EXPORT_API int em_core_get_receiving_event_queue(emf_event_t **event_queue, int *event_count, int *err);
-EXPORT_API int em_core_cancel_all_threads_of_an_account(int account_id);
-EXPORT_API int em_core_free_event(emf_event_t *event_data);
-
-#ifdef _CONTACT_SUBSCRIBE_CHANGE_
-EXPORT_API int em_core_contact_sync_handler();
-EXPORT_API int em_core_init_last_sync_time(void);
-EXPORT_API int em_core_set_last_sync_time(int sync_time);
-EXPORT_API int em_core_get_last_sync_time(void);
-EXPORT_API int em_core_contact_sync_handler();
-#endif
-
-#ifdef __FEATURE_PARTIAL_BODY_DOWNLOAD__
-/*  Please contact -> Himanshu [h.gahlaut@samsung.com] for any explanation in code here under this MACRO */
-EXPORT_API int em_core_insert_partial_body_thread_event(emf_event_partial_body_thd *partial_body_thd_event, int *error_code);
-EXPORT_API int em_core_is_partial_body_thd_que_empty();
-EXPORT_API int em_core_is_partial_body_thd_que_full();
-EXPORT_API int em_core_partial_body_thread_loop_start(int *err_code);
-EXPORT_API int em_core_clear_partial_body_thd_event_que(int *err_code);
-EXPORT_API int em_core_free_partial_body_thd_event(emf_event_partial_body_thd *partial_body_thd_event, int *error_code);
-EXPORT_API unsigned int em_core_get_partial_body_thd_id();
-EXPORT_API int em_core_get_pbd_thd_state();
-unsigned int em_core_get_receiving_thd_id();
-#endif
-
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif
diff --git a/email-core/include/em-core-global.h b/email-core/include/em-core-global.h
deleted file mode 100755 (executable)
index c401a25..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-/******************************************************************************
- * File :  em-core-global.h
- * Desc :  Mail Engine Global Header
- *
- * Auth : 
- *
- * History : 
- *    2006.08.01  :  created
- *****************************************************************************/
-#ifndef __EM_CORE_GLOBAL_H__
-#define __EM_CORE_GLOBAL_H__
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
-
-#include <glib.h>
-#include "vconf-keys.h"
-#include "emf-types.h"
-
-extern emf_account_list_t *g_account_list;
-extern int g_account_num;
-extern int g_account_retrieved;
-
-EXPORT_API emf_account_t *em_core_account_get_new_account_ref();
-extern char *strcasestr (__const char *__haystack, __const char *__needle) __THROW __attribute_pure__ __nonnull ((1, 2));
-
-extern int pthread_mutexattr_settype (pthread_mutexattr_t *__attr, int __kind) __THROW __nonnull ((1));
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif
diff --git a/email-core/include/em-core-imap-idle.h b/email-core/include/em-core-imap-idle.h
deleted file mode 100755 (executable)
index 0bce49f..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-/**
- *
- * This file contains functinality related to IMAP IDLE.
- * @file               em-core-imap-idle.h
- * @author     
- * @version    0.1
- * @brief              This file contains functionality to provide IMAP IDLE support in email-service. 
- */
-
-#include "emflib.h"
-
-
-/**
-
- * @open
- * @fn em_core_imap_idle_thread_create(int *err_code)
- * @brief      Creates a thread that listens for IMAP IDLE Notifications.
- *
- * @param[out] err_code        Specifies the error code returned.
- * @remarks N/A
- * @return This function returns true on success or false on failure.
- */
-
-EXPORT_API int em_core_imap_idle_thread_create(int accountID, int *err_code);
-
-/**
-
- * @open
- * @fn em_core_imap_idle_thread_kill(int *err_code)
- * @brief      Kills IMAP IDLE thread
- *
- * @param[out] err_code        Specifies the error code returned.
- * @remarks N/A
- * @return This function returns true on success or false on failure.
- */
-EXPORT_API int em_core_imap_idle_thread_kill(int *err_code);
-
-
-
-/**
-
- * @open
- * @fn em_core_imap_idle_run(int *err_code, int iAccountID)
- * @brief      Make a list of mailboxes to IDLE on, connect to all mailboxes in list and start idle loop
- *
- * @param[out] err_code        Specifies the error code returned.
- * @remarks N/A
- * @return This function returns true on success or false on failure.
- */
-
-static int em_core_imap_idle_run(int iAccountID);
-
-/**
-
- * @open
- * @fn em_core_imap_idle_loop_start(emf_mailbox_t *mailbox_list,  int num, int *err_code)
- * @brief      starts a loop which waits on select call. Select call monitors all the socket descriptors in the hold_connection fields of mailbox_list 
- *
- * @param[in] mailbox_list     list of mailboxes
- * @param[in] num                      Count of mailboxes in list
- * @param[out] err_code        Specifies the error code returned.
- * @remarks N/A
- * @return This function returns true on success or false on failure.
- */
-static int em_core_imap_idle_loop_start(emf_mailbox_t *mailbox_list,  int num, int *err_code);
-
-
-
-/**
-
- * @open
- * @fn em_core_imap_idle_loop_start(emf_mailbox_t *mailbox_list,  int num, int *err_code)
- * @brief      Creates and inserts an event in event queue for syncing mailbox
- *
- * @param[in] mailbox          mailbox to be synced.
- * @param[out] err_code        Specifies the error code returned.
- * @remarks N/A
- * @return This function returns true on success or false on failure.
- */
-static int em_core_imap_idle_insert_sync_event(emf_mailbox_t *mailbox, int *err_code);
-
-
-
-/**
-
- * @open
- * @fn em_core_imap_idle_connect_and_idle_on_mailbox(emf_mailbox_t *mailbox, int *err_code)
- * @brief      Opens connection to mailbox(selects mailbox) and sends IDLE command
- *
- * @param[in] mailbox          mailbox to IDLE on.
- * @param[out] err_code        Specifies the error code returned.
- * @remarks N/A
- * @return This function returns true on success or false on failure.
- */
-static int em_core_imap_idle_connect_and_idle_on_mailbox(emf_mailbox_t *mailbox, int *err_code);
-
-
-
-/**
-
- * @open
- * @fn em_core_imap_idle_parse_response_stream(emf_mailbox_t *mailbox, int *err_code)
- * @brief      Gets and parsee the IDLE notification coming from network
- *
- * @param[in] mailbox          mailbox that got IDLE notification.
- * @param[out] err_code        Specifies the error code returned.
- * @remarks N/A
- * @return This function returns true on success or false on failure.
- */
-static int em_core_imap_idle_parse_response_stream(emf_mailbox_t *mailbox, int *err_code);
diff --git a/email-core/include/em-core-mailbox.h b/email-core/include/em-core-mailbox.h
deleted file mode 100755 (executable)
index 9c1066d..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-
-/******************************************************************************
- * File :  em-core-mailbox.h
- * Desc :  Local Mailbox Management Header
- *
- * Auth : 
- *
- * History : 
- *    2006.08.16  :  created
- *****************************************************************************/
-#ifndef __EM_CORE_MAILBOX_H__
-#define __EM_CORE_MAILBOX_H__
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
-
-#include "c-client.h"
-
-#if !defined(EXPORT_API)
-#define EXPORT_API __attribute__((visibility("default")))
-#endif
-
-typedef enum      
-{
-       EM_CORE_STREAM_TYPE_RECV = 0,   
-       EM_CORE_STREAM_TYPE_SEND,               
-} em_core_stream_type_t;
-
-#ifdef __FEATURE_KEEP_CONNECTION__
-EXPORT_API int em_core_remove_connection_info(int account_id);
-#endif /* __FEATURE_KEEP_CONNECTION__ */
-/*  in SMTP case, path argument must be (ENCODED_PATH_SMTP) */
-/*  ex) em_core_mailbox_open(xxx, (char *)ENCODED_PATH_SMTP, xxx, xxx); */
-EXPORT_API int em_core_mailbox_open_with_account_info(emf_account_t *ref_account, char *mailbox, void **mail_stream, int *err_code);
-EXPORT_API int em_core_mailbox_open(int account_id, char *mailbox, void **mail_stream, int *err_code);
-EXPORT_API int em_core_mailbox_close(int account_id, void *mail_stream);
-#ifdef __FEATURE_KEEP_CONNECTION__
-EXPORT_API void em_core_close_receiving_stream();
-EXPORT_API void em_core_close_partial_body_stream();
-EXPORT_API void em_core_reset_streams();
-#endif
-
-EXPORT_API int em_core_mailbox_get_list_to_be_sync(int account_id, emf_mailbox_t **mailbox_list, int *p_count, int *err_code);
-EXPORT_API int em_core_mailbox_get_list(int account_id, emf_mailbox_t **mailbox_list, int *p_count, int *err_code);
-EXPORT_API int em_core_mailbox_free(emf_mailbox_t **mailbox_list, int count, int *err_code);
-EXPORT_API int em_core_mailbox_get_mail_count(emf_mailbox_t *mailbox, int *total, int *unseen, int *err_code);
-EXPORT_API int em_core_mailbox_create(emf_mailbox_t *new_mailbox, int on_server, int *err_code);
-EXPORT_API int em_core_mailbox_delete(emf_mailbox_t *mailbox, int on_server, int *err_code);
-EXPORT_API int em_core_mailbox_delete_all(emf_mailbox_t *mailbox, int *err_code);
-EXPORT_API int em_core_mailbox_update(emf_mailbox_t *old_mailbox, emf_mailbox_t *new_mailbox, int *err_code);
-EXPORT_API int em_core_save_local_activity_sync(int account_id, int *err_code);
-EXPORT_API void em_core_bind_mailbox_type(emf_mailbox_t *mailbox_list);
-EXPORT_API int em_core_send_mail_event(emf_mailbox_t *mailbox, int mail_id , int *err_code);
-EXPORT_API int em_core_partial_body_thd_local_activity_sync(int *is_event_inserted, int *err_code);
-EXPORT_API int em_core_get_mailbox_by_type(int account_id, emf_mailbox_type_e mailbox_type, emf_mailbox_t *spam_mailbox, int *err_code);
-
-#ifdef __LOCAL_ACTIVITY__
-EXPORT_API int em_core_local_activity_sync(int account_id, int *err_code);
-EXPORT_API int em_core_save_local_activity_sync(int account_id, int *err_code);
-#endif
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif
diff --git a/email-core/include/em-core-mesg.h b/email-core/include/em-core-mesg.h
deleted file mode 100755 (executable)
index b40949a..0000000
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-/******************************************************************************
- * File :  em-core-mesg.h
- * Desc :  Mail Operation Header
- *
- * Auth : 
- *
- * History : 
- *    2006.08.16  :  created
- *****************************************************************************/
-#ifndef __EM_CORE_MESSAGE_H__
-#define __EM_CORE_MESSAGE_H__
-
-#include "em-storage.h"
-#include <contacts-svc.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#if !defined(EXPORT_API)
-#define EXPORT_API __attribute__((visibility("default")))
-#endif
-
-#define HTML_EXTENSION_STRING ".htm"
-#define MAX_PATH_HTML 256
-
-#ifdef __FEATURE_BULK_DELETE_MOVE_UPDATE_REQUEST_OPTI__
-
-#define MAX_SUBSET_STRING_SIZE 260     
-#define MAX_IMAP_COMMAND_LENGTH 1000
-#define MAX_TAG_SIZE 16
-
-
-typedef struct _emf_uid_range_set
-{
-       char *uid_range;
-       unsigned long lowest_uid;
-       unsigned long highest_uid;
-       
-       struct _emf_uid_range_set *next;
-       
-} emf_uid_range_set;
-
-#endif
-
-
-struct _m_content_info 
-{
-       int grab_type;              /*  1 :  download text and get attachment names (no saving attachment) - #define GRAB_TYPE_TEXT       retrieve text and attachment names */
-                              /*  2 :  download attachment - #define GRAB_TYPE_ATTACHMENT retrieve only attachment */
-       int file_no;                /*  attachment no to be download (min : 1) */
-       int report;                 /*  0 : Non 1 : DSN mail 2 : MDN mail 3 : mail to require MDN */
-
-       struct text_data 
-       {
-               char *plain;            /*  body plain text */
-               char *plain_charset;    /*  charset of body text */
-               char *html;             /*  body html text */
-       } text;
-
-       struct attachment_info 
-       {
-               int   type;             /*  1 : inline 2 : attachment */
-               char *name;             /*  attachment filename */
-               int   size;             /*  attachment size */
-               char *save;             /*  content saving filename */
-               int   drm;              /*  0 : none 1 : object 2 : rights 3 : dcf */
-               int   drm2;             /*  0 : none 1 : FL 2 : CD 3 : SSD 4 : SD */
-#ifdef __ATTACHMENT_OPTI__
-               int   encoding;         /*  encoding  */
-               char *section;          /*  section number */
-#endif
-               struct attachment_info *next;
-       } *file;
-};
-
-
-/**
- * Download email body from server.
- *
- * @param[in] mail_stream      Specifies the mail_stream.
- * @param[in] mailbox          Specifies the mailbox to contain account ID.
- * @param[in] mail_id          Specifies the mail ID.
- * @param[in] callback         Specifies the callback function for retrieving download status.
- * @param[in] with_attach      Specifies the flag for downloading attachments.
- * @param[in] limited_size     Specifies the size to be downloaded.
- * @param[out] err_code                Specifies the error code returned.
- * @remarks In POP3 case, body and attachment are downloaded in this function.
- *          In IMAP case, body and attachment list are downloaded and 
- *          attachments must be downloaded in em_core_mail_download_attachment.
- * @return This function returns true on success or false on failure.
- */
-
-EXPORT_API int em_core_mail_download_body_multi_sections_bulk(void *mail_stream, int account_id, int mail_id, int verbose, int with_attach, int limited_size, int event_handle , int *err_code);
-
-
-/**
- * Download a email nth-attachment from server.
- *
- * @param[in] mailbox          Specifies the mailbox to contain account ID.
- * @param[in] mail_id                  Specifies the mail ID.
- * @param[in] nth                              Specifies the buffer that a attachment number been saved. the minimum number is "1".
- * @param[in] callback         Specifies the callback function for retrieving download status.
- * @param[in] handle                   Specifies the handle for stopping downloading.
- * @param[out] err_code        Specifies the error code returned.
- * @remarks This function is used for only IMAP mail.
- * @return This function returns true on success or false on failure.
- */
-EXPORT_API int em_core_mail_download_attachment(int acconut_id, int mail_id,  char *nth, int *err_code);
-
-EXPORT_API int em_core_mail_get_info(int mail_id, emf_mail_info_t **info, int *err_code);
-EXPORT_API int em_core_mail_get_header(int mail_id, emf_mail_head_t **head, int *err_code);
-EXPORT_API int em_core_mail_get_body(int mail_id, emf_mail_body_t **body, int *err_code);
-EXPORT_API int em_core_mail_move(int mail_ids[], int num, char *dst_mailbox_name, int noti_param_1, int noti_param_2, int *err_code);
-EXPORT_API int em_core_mail_add_attachment(int mail_id, emf_attachment_info_t *attachment, int *err_code);
-EXPORT_API int em_core_mail_delete_attachment(int mail_id,  char *attachment_id, int *err_code);
-EXPORT_API int em_core_mail_add_attachment_data(int input_mail_id, emf_attachment_data_t *input_attachment_data);
-
-
-#ifdef __FEATURE_PARTIAL_BODY_DOWNLOAD__
-EXPORT_API int em_core_insert_pbd_activity(emf_event_partial_body_thd *local_activity, int *activity_id, int *err_code) ;
-EXPORT_API int em_core_delete_pbd_activity(int account_id, int mail_id, int activity_id, int *err_code);
-#endif 
-
-EXPORT_API int em_core_mail_get_contact_info(emf_mail_contact_info_t *contact_info, char *full_address, int *err_code);
-EXPORT_API int em_core_mail_get_contact_info_with_update(emf_mail_contact_info_t *contact_info, char *full_address, int mail_id, int *err_code);
-EXPORT_API int em_core_mail_free_contact_info(emf_mail_contact_info_t *contact_info, int *err_code);
-EXPORT_API int em_core_mail_contact_sync(int mail_id, int *err_code);
-EXPORT_API GList *em_core_get_recipients_list(GList *old_recipients_list, char *full_address, int *err_code);
-EXPORT_API int em_core_mail_get_address_info_list(int mail_id, emf_address_info_list_t **address_info_list, int *err_code);
-EXPORT_API int em_core_mail_get_display_name(CTSvalue *contact_name_value, char **contact_display_name);
-EXPORT_API int em_core_mail_get_mail(int msgno, emf_mail_t **mail, int *err_code);
-EXPORT_API int em_core_get_mail_data(int input_mail_id, emf_mail_data_t **output_mail_data);
-
-EXPORT_API int em_core_mail_update_old(int mail_id,  emf_mail_t *src_mail, emf_meeting_request_t *src_meeting_req,  int *err_code);
-EXPORT_API int em_core_update_mail(emf_mail_data_t *input_mail_data, emf_attachment_data_t *input_attachment_data_list, int input_attachment_count, emf_meeting_request_t* input_meeting_request, int sync_server);
-
-EXPORT_API int em_core_fetch_flags(int account_id, int mail_id, emf_mail_flag_t *mail_flag, int *err_code);
-EXPORT_API int em_core_mail_delete_from_local(int account_id, int *mail_ids, int num, int noti_param_1, int noti_param_2, int *err_code);
-EXPORT_API int em_core_mail_get_msgno_by_uid(emf_account_t *account, emf_mailbox_t *mailbox, char *uid, int *msgno, int *err_code);
-
-/**
- * Delete mails.
- *
- * @param[in] account_id      Specifies the account id.
- * @param[in] mail_id         Specifies the array for mail id.
- * @param[in] num             Specifies the number of id.
- * @param[in] from_server     Specifies whether mails is deleted from server.
- * @param[in] callback        Specifies the callback function for delivering status during deleting.
- * @param[in] noti_param_1    Specifies the first parameter for notification.
- * @param[in] noti_param_2    Specifies the second parameter for notification.
- * @param[out] err_code       Specifies the error code returned.
- * @remarks N/A
- * @return This function returns true on success or false on failure.
- */
-EXPORT_API int em_core_mail_delete(int account_id, int mail_id[], int num, int from_server, int noti_param_1, int noti_param_2, int *err_code);
-
-/**
- * Delete mails.
- *
- * @param[in] mailbox                  Specifies the mailbox. this argument is for account id or mailbox name.
- * @param[in] with_server              Specifies whether mails is also deleted from server.
- * @param[in] callback                 Specifies the callback function for delivering status during deleting.
- * @param[out] err_code                Specifies the error code returned.
- * @remarks N/A
- * @return This function returns true on success or false on failure.
- */
-EXPORT_API int   em_core_mail_delete_all(emf_mailbox_t *mailbox, int with_server, int *err_code);
-
-EXPORT_API int   em_core_mail_info_free(emf_mail_info_t **mail_info_list, int count, int *err_code);
-EXPORT_API int   em_core_mail_body_free(emf_mail_body_t **mail_body_list, int count, int *err_code);
-EXPORT_API int   em_core_mail_head_free(emf_mail_head_t **mail_head_list, int count, int *err_code);
-EXPORT_API int   em_core_mail_free(emf_mail_t **mail_list, int count, int *err_code);
-EXPORT_API int   em_core_free_mail_data(emf_mail_data_t **mail_list, int count, int *err_code);
-EXPORT_API void  em_core_mime_free_content_info(struct _m_content_info *cnt_info);
-EXPORT_API int   em_core_mail_attachment_info_free(emf_attachment_info_t **atch_info, int *err_code);
-EXPORT_API int   em_core_free_attachment_data(emf_attachment_data_t **attachment_data_list, int attachment_data_count, int *err_code);
-
-EXPORT_API int   em_core_mail_move_from_server(int account_id, char *src_mailbox,  int mail_ids[], int num, char *dest_mailbox, int *error_code);
-EXPORT_API int   em_core_mail_sync_flag_with_server(int mail_id, int *err_code);
-EXPORT_API int   em_core_mail_sync_seen_flag_with_server(int mail_ids[], int num, int *err_code);
-EXPORT_API int   em_core_mail_get_attachment(int mail_id, char *attachment_no, emf_attachment_info_t **attachment, int *err_code);
-EXPORT_API int   em_core_get_attachment_data_list(int input_mail_id, emf_attachment_data_t **output_attachment_data, int *output_attachment_count);
-EXPORT_API int   em_core_mail_modify_extra_flag(int mail_id, emf_extra_flag_t new_flag, int *err_code);
-EXPORT_API int   em_core_mail_modify_flag(int mail_id, emf_mail_flag_t new_flag, int sticky_flag, int *err_code);
-EXPORT_API int   em_core_mail_get_size(int mail_id, int *mail_size, int *err_code);
-EXPORT_API int   em_core_mail_set_flags_field(int account_id, int mail_ids[], int num, emf_flags_field_type field_type, int value, int *err_code);
-EXPORT_API char* em_core_convert_mutf7_to_utf8(char *mailbox_name); 
-EXPORT_API int   em_core_convert_string_to_structure(const char *encoded_string, void **struct_var, emf_convert_struct_type_e type);
-
-EXPORT_API int   em_core_mail_get_info_from_mail_tbl(emf_mail_info_t **pp_mail_info, emf_mail_tbl_t *mail , int *err_code);
-EXPORT_API int   em_core_mail_get_header_from_mail_tbl(emf_mail_head_t **header, emf_mail_tbl_t *mail , int *err_code); 
-EXPORT_API int   em_core_mail_get_body_from_mail_tbl(emf_mail_body_t **p_body, emf_mail_tbl_t *mail, int *err_code);
-
-
-#ifdef __FEATURE_BULK_DELETE_MOVE_UPDATE_REQUEST_OPTI__
-EXPORT_API int   em_core_mail_sync_flags_field_with_server(int mail_ids[], int num, emf_flags_field_type field_type, int value, int *err_code);
-EXPORT_API int   em_core_mail_move_from_server_ex(int account_id, char *src_mailbox,  int mail_ids[], int num, char *dest_mailbox, int *error_code);
-#endif
-
-#ifdef __ATTACHMENT_OPTI__
-EXPORT_API int em_core_mail_download_attachment_bulk(/*emf_mailbox_t *mailbox, */ int account_id, int mail_id, char *nth,  int *err_code);
-#endif
-EXPORT_API int   em_core_mail_filter_by_rule(emf_rule_t *filter_info, int *err_code);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif
-/* EOF */
diff --git a/email-core/include/em-core-mime.h b/email-core/include/em-core-mime.h
deleted file mode 100755 (executable)
index f95fd42..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-/******************************************************************************
- * File :  em-core-mime.h
- * Desc :  MIME Operation Header
- *
- * Auth : 
- *
- * History : 
- *    2011.04.14  :  created
- *****************************************************************************/
-#ifndef __EM_CORE_MIME_H__
-#define __EM_CORE_MIME_H__
-
-#include "em-core-types.h"
-#include "c-client.h"
-#include "em-storage.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-char *em_core_mime_get_line_from_file(void *stream, char *buf, int size, int *err_code);
-int em_core_mime_parse_mime(void *stream, int is_file, struct _m_content_info *cnt_info, int *err_code);
-EXPORT_API int   em_core_get_attribute_value_of_body_part(PARAMETER *input_param, char *atribute_name, char *output_value, int output_buffer_length, int with_rfc2047_text, int *err_code);
-EXPORT_API int   em_core_get_body_part_list_full(MAILSTREAM *stream, int msg_uid, int account_id, int mail_id, BODY *body, struct _m_content_info *cnt_info, int *err_code, PARTLIST * section_list, int event_handle);
-EXPORT_API int   em_core_get_body(MAILSTREAM *stream, int account_id, int mail_id, int msg_uid, BODY *body, struct _m_content_info *cnt_info, int *err_code);
-EXPORT_API int   em_core_get_body_structure(MAILSTREAM *stream, int msg_uid, BODY **body, int *err_code);
-EXPORT_API char *em_core_decode_rfc2047_text(char *rfc2047_text, int *err_code);
-EXPORT_API int   em_core_decode_body_text(char *enc_buf, int enc_len, int enc_type, int *dec_len, int *err_code);
-EXPORT_API int   em_core_set_fetch_body_section(BODY *body, int enable_inline_list, int *total_mail_size, int *err_code);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif
-/* EOF */
diff --git a/email-core/include/em-core-sound-conflict.h b/email-core/include/em-core-sound-conflict.h
deleted file mode 100755 (executable)
index a56ea74..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
diff --git a/email-core/include/em-core-utils.h b/email-core/include/em-core-utils.h
deleted file mode 100755 (executable)
index 1dda87f..0000000
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-/******************************************************************************
- * File :  em-core-utils.h
- * Desc :  Mail Utils Header
- *
- * Auth : 
- *
- * History : 
- *    2006.08.16  :  created
- *****************************************************************************/
-#ifndef __EM_CORE_UTILS_H__
-#define __EM_CORE_UTILS_H__
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
-
-#include "emf-types.h"
-#include "em-storage.h"
-#include "em-core-global.h"
-#include "em-core-mesg.h"
-#ifdef __FEATURE_BULK_DELETE_MOVE_UPDATE_REQUEST_OPTI__
-#include "em-core-mesg.h"
-#endif
-
-#if !defined(EXPORT_API)
-#define EXPORT_API __attribute__((visibility("default")))
-#endif
-
-/*  This is used for em_core_get_long_encoded_path */
-#define        ENCODED_PATH_SMTP       "UHDF_ENCODED_PATH_SMTP_EKJD"
-
-typedef int (*emf_get_unread_email_count_cb)(int unread, int *err_code);
-
-/* parse the Full mailbox Path and get the Alias Name of the Mailbox */
-char *em_core_get_alias_of_mailbox(const char *mailbox_path);
-
-/* Parse the Mailbox Path and get the Account Email address */
-EXPORT_API emf_option_t *em_core_get_option(int *err_code);
-EXPORT_API int em_core_set_option(emf_option_t *opt, int *err_code);
-int em_core_upper_path(char *path);
-int em_core_upper_string(char *str);
-int em_core_get_temp_file_name(char **filename, int *err_code);
-int em_core_get_long_encoded_path(int account_id, char *path, int delimiter, char **long_enc_path, int *err_code);
-int em_core_get_encoded_mailbox_name(char *name, char **enc_name, int *err_code);
-int em_core_get_file_name(char *path, char **filename, int *err_code);
-int em_core_get_file_size(char *path, int *size, int *err_code);
-int em_core_get_mail_size(emf_mail_t *mail_src, int *error_code);
-int em_core_calc_mail_size(emf_mail_data_t *mail_data_src, emf_attachment_data_t *attachment_data_src, int attachment_count, int *error_code);
-int em_core_get_actual_mail_size(char *pBodyPlane, char *pBodyHtml, struct attachment_info *pAttachment, int *error_code);
-int em_core_get_address_count(char *addr_str, int *to_num, int *err_code);
-
-void  em_core_skip_whitespace(char *addr_str , char **pAddr);
-EXPORT_API char *em_core_skip_whitespace_without_strdup(char *source_string);
-EXPORT_API char* em_core_replace_string(char *source_string, char *old_string, char *new_string);
-EXPORT_API int em_core_set_network_error(int err_code);
-EXPORT_API int em_core_check_unread_mail();
-int em_core_is_storage_full(int *error);
-int em_core_show_popup(int id, emf_action_t action, int error);
-int em_core_get_long_encoded_path_with_account_info(emf_account_t *account, char *path, int delimiter, char **long_enc_path, int *err_code);
-EXPORT_API int em_storage_get_emf_error_from_em_storage_error(int error);
-EXPORT_API int em_core_open_contact_db_library(void);
-EXPORT_API void em_core_close_contact_db_library();
-EXPORT_API void em_core_flush_memory();
-EXPORT_API int em_core_get_server_time(void *mail_stream , int account_id, char *uid, int msgno, time_t *log_time, int *err_code);
-EXPORT_API void em_core_fill_address_information_of_mail_tbl(emf_mail_tbl_t *mail_data);
-EXPORT_API int em_core_add_transaction_info(int mail_id , int handle  , int *err_code);
-EXPORT_API int em_core_get_handle_by_mailId_from_transaction_info(int mail_id , int *pHandle);
-EXPORT_API int em_core_delete_transaction_info_by_mailId(int mail_id);
-EXPORT_API int em_core_get_preview_text_from_file(const char *input_plain_path, const char *input_html_path, int input_preview_buffer_length, char **output_preview_buffer);
-EXPORT_API int em_core_strip_HTML(char *source_string);
-EXPORT_API int em_core_send_noti_for_new_mail(int account_id, char *mailbox_name, char *subject, char *from, char *uid, char *datetime);
-EXPORT_API int em_core_find_pos_stripped_subject_for_thread_view(char *subject, char *stripped_subject);
-EXPORT_API int em_core_find_tag_for_thread_view(char *subject, int *result);
-EXPORT_API int em_core_check_send_mail_thread_status();
-EXPORT_API int em_core_make_attachment_file_name_with_extension(char *source_file_name, char *sub_type, char *result_file_name, int result_file_name_buffer_length, int *err_code);
-EXPORT_API char *em_core_get_extension_from_file_path(char *source_file_path, int *err_code);
-EXPORT_API int em_core_get_encoding_type_from_file_path(const char *input_file_path, char **output_encoding_type);
-EXPORT_API int em_core_get_content_type(const char *extension_string, int *err_code);
-EXPORT_API char* em_core_get_current_time_string(int *err_code);
-
-
-/* Session Handling */
-EXPORT_API int em_core_get_empty_session(emf_session_t **session);
-EXPORT_API int em_core_clear_session(emf_session_t *session);
-EXPORT_API int em_core_get_current_session(emf_session_t **session);
-
-/* For notification */ 
-EXPORT_API int em_core_update_notification_for_unread_mail(int account_id);
-EXPORT_API int em_core_clear_all_notifications();
-EXPORT_API int em_core_add_notification_for_unread_mail_by_mail_header(int account_id, int mail_id, emf_mail_head_t *mail_header);
-EXPORT_API int em_core_add_notification_for_unread_mail(emf_mail_data_t *input_mail_data);
-EXPORT_API int em_core_delete_notification_for_read_mail(int mail_id);
-EXPORT_API int em_core_delete_notification_by_account(int account_id);
-EXPORT_API int em_core_finalize_sync(int account_id, int *error);
-
-EXPORT_API int em_core_verify_email_address(char *address, int without_bracket, int *err_code);
-EXPORT_API int em_core_verify_email_address_of_mail_header(emf_mail_head_t *mail_header, int without_bracket, int *err_code);
-EXPORT_API int em_core_verify_email_address_of_mail_data(emf_mail_data_t *mail_data, int without_bracket, int *err_code);
-
-
-#ifdef __FEATURE_BULK_DELETE_MOVE_UPDATE_REQUEST_OPTI__
-
-/**
- * @fn em_core_convert_to_uid_range_set(emf_id_set_t *id_set, int id_set_count, emf_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
- * @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, 
- *                                                     While using it the caller should remove the ending , (comma)                                    
- * @return This function returns true on success or false on failure.
- */
-EXPORT_API int em_core_convert_to_uid_range_set(emf_id_set_t *id_set, int id_set_count, emf_uid_range_set **uid_range_set, int range_len, int *err_code);
-
-/**
- * void em_core_free_uid_range_set(emf_uid_range_set **uid_range_head)
- * Frees the linked list of uid ranges 
- *
- * @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.
- */
-EXPORT_API void em_core_free_uid_range_set(emf_uid_range_set **uid_range_set);
-
-/**
- * @fn em_core_append_subset_string_to_uid_range(char *subset_string, emf_uid_range_set **uid_range_set, int range_len, unsigned long luid, unsigned long huid)
- * Appends the subset_string to uid range if the uid range has not exceeded maximum length(range_len), otherwise creates a new node in linked list of uid range set 
- * and stores the subset_string in its uid_range. Also sets the lowest and highest uids for the corresponsing uid_range
- * 
- * @author                                     h.gahlaut@samsung.com
- * @param[in] subset_string            Specifies the subset string to be appended. A subset string can be like X : Y or X where X and Y are uids.
- * @param[in] range_len                Specifies the maximum length of range string allowed. 
- * @param[in] luid                             Specifies the lowest uid in subset string
- * @param[in] huid                             Specifies the highest uid in subset string
- * @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                                                                            
- * @return This function returns true on success or false on failure.
- */
-int em_core_append_subset_string_to_uid_range(char *subset_string, emf_uid_range_set **current_node_adr, emf_uid_range_set **uid_range_set, int range_len, unsigned long luid, unsigned long huid);
-
-/**
- * @fn em_core_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
- * @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.
- *                                                     Then this function will form two comma separated strings as follows -
- *                                                     "2755, 2754, 2748"
- *                                                     "2749, 2750"
- * @return This function returns true on success or false on failure.
- */
-EXPORT_API int em_core_form_comma_separated_strings(int numbers[], int num_count, int max_string_len, char ***strings, int *string_count, int *err_code);
-
-/**
- * @fn em_core_free_comma_separated_strings(char ***string_list, int *string_count)
- * Frees the double dimensional array of strings. 
- *
- * @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                                                                    
- * @return This function does not return anything.
- */
-
-EXPORT_API void em_core_free_comma_separated_strings(char ***string_list, int *string_count);
-
-#endif
-
-#ifdef __LOCAL_ACTIVITY__
-/*  Added to get next activity id sequence */
-EXPORT_API int em_core_get_next_activity_id(int *activity_id, int *err_code);
-EXPORT_API int em_core_activity_add(emf_activity_tbl_t *new_activity, int *err_code);
-EXPORT_API int em_core_activity_delete(emf_activity_tbl_t *activity, int *err_code);
-#endif /* __LOCAL_ACTIVITY__ */
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __EM_CORE_UTILS_H__ */
diff --git a/email-core/include/email-core-account.h b/email-core/include/email-core-account.h
new file mode 100755 (executable)
index 0000000..4eba963
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+*  email-service
+*
+* Copyright (c) 2000 - 2011 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.
+*
+*/
+
+
+
+/****************************************************************************** 
+ * File :  email-core-account.h
+ * Desc :  Account Management
+ * * Auth : 
+ * * History : 
+ *    2010.08.25  :  created
+ *****************************************************************************/
+#ifndef _EMAIL_CORE_ACCOUNT_H_
+#define _EMAIL_CORE_ACCOUNT_H_
+
+#include "email-types.h"
+#include "email-internal-types.h"
+#include "email-storage.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+INTERNAL_FUNC int emcore_validate_account(int account_id, int *err_code);
+
+INTERNAL_FUNC int emcore_validate_account_with_account_info(emf_account_t *account, int *err_code);
+
+INTERNAL_FUNC int emcore_create_account(emf_account_t *account, int *err_code);
+
+INTERNAL_FUNC int emcore_delete_account_(int account_id, int *err_code);
+
+INTERNAL_FUNC int emcore_free_account(emf_account_t **account_list, int count, int *err_code);
+
+INTERNAL_FUNC int emcore_init_account_reference();
+
+INTERNAL_FUNC int emcore_refresh_account_reference();
+
+INTERNAL_FUNC int emcore_free_account_reference();
+
+INTERNAL_FUNC emf_account_t *emcore_get_account_reference(int account_id);
+
+INTERNAL_FUNC int emcore_get_account_reference_list(emf_account_t **account_list, int *count, int *err_code);
+
+INTERNAL_FUNC int emcore_query_server_info(const char* domain_name, emf_server_info_t **result_server_info);
+
+INTERNAL_FUNC int emcore_free_server_info(emf_server_info_t **target_server_info);
+
+INTERNAL_FUNC int emcore_save_default_account_id(int input_account_id);
+
+INTERNAL_FUNC int emcore_load_default_account_id(int *output_account_id);
+
+
+#ifdef __FEATURE_BACKUP_ACCOUNT__
+INTERNAL_FUNC int emcore_backup_accounts(const char *file_path, int *error_code);
+
+INTERNAL_FUNC int emcore_restore_accounts(const char *file_path, int *error_code);
+#endif /*   __FEATURE_BACKUP_ACCOUNT_ */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /*_EMAIL_CORE_ACCOUNT_H_*/
+
similarity index 79%
rename from include/emf-global.h
rename to email-core/include/email-core-api.h
index 609d049..3937b26 100755 (executable)
 */
 
 
-
 /******************************************************************************
- * File: emf-global.h
- * Desc: Mail Framework Global Header
+ * File :  email-core-api.h
+ * Desc :  email-core-api Header
  *
- * Auth:
+ * Auth : 
  *
- * History:
- *    2006.08.01 : created
+ * History : 
+ *    2006.08.16  :  created
  *****************************************************************************/
-#ifndef __EMF_GLOBAL_H__
-#define __EMF_GLOBAL_H__
+#ifndef __EMAIL_CORE_API_H__
+#define __EMAIL_CORE_API_H__
 
 #ifdef __cplusplus
 extern "C"
 {
 #endif /* __cplusplus */
 
-#include "emflib.h"
-
-#ifndef NULL
-#define NULL (char*)0
-#endif
-
-#include "vconf-keys.h"
-
+int emcore_init(int *err_code);
 
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
 
-#endif
+#endif /*__EMAIL_CORE_API_H__*/
diff --git a/email-core/include/email-core-event.h b/email-core/include/email-core-event.h
new file mode 100755 (executable)
index 0000000..6ee7a28
--- /dev/null
@@ -0,0 +1,82 @@
+/*
+*  email-service
+*
+* Copyright (c) 2000 - 2011 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.
+*
+*/
+
+
+/******************************************************************************
+ * File :  email-core-event.h
+ * Desc :  Mail Engine Event Header
+ *
+ * Auth : 
+ *
+ * History : 
+ *    2006.08.16  :  created
+ *****************************************************************************/
+#ifndef __EMAIL_CORE_EVNET_H__
+#define __EMAIL_CORE_EVNET_H__
+
+#include "email-types.h"
+#include "email-internal-types.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+void emcore_execute_event_callback(emf_action_t action, int total, int done, int status, int account_id, int mail_id, int handle, int error);
+int  emcore_get_active_queue_idx(void);
+int  emcore_check_send_mail_thread_status();
+
+INTERNAL_FUNC int          emcore_get_current_thread_type();
+INTERNAL_FUNC int          emcore_register_event_callback(emf_action_t action, emf_event_callback callback, void *event_data);
+INTERNAL_FUNC int          emcore_unregister_event_callback(emf_action_t action, emf_event_callback callback);
+INTERNAL_FUNC int          emcore_get_pending_event(emf_action_t action, int account_id, int mail_id, emf_event_status_type_t *status);
+INTERNAL_FUNC int          emcore_start_event_loop(int *err_code);
+INTERNAL_FUNC int          emcore_stop_event_loop(int *err_code);
+INTERNAL_FUNC int          emcore_insert_event(emf_event_t *event_data, int *handle, int *err_code);
+INTERNAL_FUNC int          emcore_cancel_thread(int handle, void *arg, int *err_code);
+INTERNAL_FUNC int          emcore_send_event_loop_start(int *err_code);
+INTERNAL_FUNC int          emcore_send_event_loop_stop(int *err_code);
+INTERNAL_FUNC int          emcore_cancel_send_mail_thread(int handle, void *arg, int *err_code);
+INTERNAL_FUNC int          emcore_check_thread_status(void);
+INTERNAL_FUNC void         emcore_get_event_queue_status(int *on_sending, int *on_receiving);
+INTERNAL_FUNC int          emcore_insert_send_event(emf_event_t *event_data, int *handle, int *err_code);
+INTERNAL_FUNC int          emcore_get_receiving_event_queue(emf_event_t **event_queue, int *event_count, int *err);
+INTERNAL_FUNC int          emcore_cancel_all_threads_of_an_account(int account_id);
+INTERNAL_FUNC int          emcore_free_event(emf_event_t *event_data);
+
+#ifdef __FEATURE_PARTIAL_BODY_DOWNLOAD__
+/*  Please contact -> Himanshu [h.gahlaut@samsung.com] for any explanation in code here under this MACRO */
+INTERNAL_FUNC int          emcore_insert_partial_body_thread_event(emf_event_partial_body_thd *partial_body_thd_event, int *error_code);
+INTERNAL_FUNC int          emcore_is_partial_body_thd_que_empty();
+INTERNAL_FUNC int          emcore_is_partial_body_thd_que_full();
+INTERNAL_FUNC int          emcore_partial_body_thread_loop_start(int *err_code);
+INTERNAL_FUNC int          emcore_clear_partial_body_thd_event_que(int *err_code);
+INTERNAL_FUNC int          emcore_free_partial_body_thd_event(emf_event_partial_body_thd *partial_body_thd_event, int *error_code);
+INTERNAL_FUNC unsigned int emcore_get_partial_body_thd_id();
+INTERNAL_FUNC int          emcore_get_pbd_thd_state();
+unsigned int emcore_get_receiving_thd_id();
+#endif
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif
diff --git a/email-core/include/email-core-global.h b/email-core/include/email-core-global.h
new file mode 100755 (executable)
index 0000000..2588aad
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+*  email-service
+*
+* Copyright (c) 2000 - 2011 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.
+*
+*/
+
+/******************************************************************************
+ * File :  email-core-global.h
+ * Desc :  email-core-global Header
+ *
+ * Auth : 
+ *
+ * History : 
+ *    2006.08.01  :  created
+ *****************************************************************************/
+#ifndef __EMAIL_CORE_GLOBAL_H__
+#define __EMAIL_CORE_GLOBAL_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+#include "email-internal-types.h"
+
+extern emf_account_list_t *g_account_list;
+extern int g_account_num;
+extern int g_account_retrieved;
+
+INTERNAL_FUNC emf_account_t *emcore_get_new_account_reference();
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif
diff --git a/email-core/include/email-core-imap-idle.h b/email-core/include/email-core-imap-idle.h
new file mode 100755 (executable)
index 0000000..6e81798
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+*  email-service
+*
+* Copyright (c) 2000 - 2011 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.
+*
+*/
+
+
+/**
+ *
+ * This file contains functinality related to IMAP IDLE.
+ * @file               email-core-imap-idle.h
+ * @author     
+ * @version    0.1
+ * @brief              This file contains functionality to provide IMAP IDLE support in email-service. 
+ */
+
+#include "email-internal-types.h"
+
+/**
+
+ * @open
+ * @fn emcore_create_imap_idle_thread(int *err_code)
+ * @brief      Creates a thread that listens for IMAP IDLE Notifications.
+ *
+ * @param[out] err_code        Specifies the error code returned.
+ * @remarks N/A
+ * @return This function returns true on success or false on failure.
+ */
+
+INTERNAL_FUNC int emcore_create_imap_idle_thread(int accountID, int *err_code);
+
+/**
+
+ * @open
+ * @fn emcore_kill_imap_idle_thread(int *err_code)
+ * @brief      Kills IMAP IDLE thread
+ *
+ * @param[out] err_code        Specifies the error code returned.
+ * @remarks N/A
+ * @return This function returns true on success or false on failure.
+ */
+INTERNAL_FUNC int emcore_kill_imap_idle_thread(int *err_code);
similarity index 63%
rename from email-core/include/em-core-imap-mailbox.h
rename to email-core/include/email-core-imap-mailbox.h
index c566c92..e643e38 100755 (executable)
@@ -22,7 +22,7 @@
 
 
 /******************************************************************************
- * File :  em-core-imap-mailbox.h
+ * File :  email-core-imap-mailbox.h
  * Desc :  Mail IMAP mailbox Header
  *
  * Auth : 
@@ -30,8 +30,8 @@
  * History : 
  *    2006.08.01  :  created
  *****************************************************************************/
-#ifndef __EM_CORE_IMAP_MAILBOX_H__
-#define __EM_CORE_IMAP_MAILBOX_H__
+#ifndef __EMAIL_CORE_IMAP_MAILBOX_H__
+#define __EMAIL_CORE_IMAP_MAILBOX_H__
 
 
 #ifdef __cplusplus
@@ -39,7 +39,7 @@ extern "C"
 {
 #endif /* __cplusplus */
 
-EXPORT_API int em_core_mailbox_check_sync_imap_mailbox(emf_mailbox_t *mailbox, int *synchronous, int *err_code);
+INTERNAL_FUNC int emcore_check_sync_imap_mailbox(emf_mailbox_t *mailbox, int *synchronous, int *err_code);
 /**
  * Get mailbox list from imap server.
  *
@@ -50,7 +50,7 @@ EXPORT_API int em_core_mailbox_check_sync_imap_mailbox(emf_mailbox_t *mailbox, i
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int em_core_mailbox_sync_mailbox_list(int account_id, char *mailbox, int *err_code);
+INTERNAL_FUNC int emcore_sync_mailbox_list(int account_id, char *mailbox, int *err_code);
 
 /**
  * Download mailbox list from imap server.
@@ -63,14 +63,14 @@ EXPORT_API int em_core_mailbox_sync_mailbox_list(int account_id, char *mailbox,
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int em_core_mailbox_download_mailbox_list(void *mail_stream, char *mailbox, emf_mailbox_t **mailbox_list, int *count, int *err_code);
-EXPORT_API int em_core_mailbox_delete_imap_mailbox(emf_mailbox_t *mailbox, int *err_code);
-EXPORT_API int em_core_mailbox_create_imap_mailbox(emf_mailbox_t *mailbox, int *err_code);
-EXPORT_API int em_core_mailbox_modify_imap_mailbox(emf_mailbox_t *old_mailbox,  emf_mailbox_t *new_mailbox, int *err_code);
-int em_core_mailbox_set_sync_imap_mailbox(emf_mailbox_t *mailbox, int synchronous, int *err_code);
-EXPORT_API int em_core_mailbox_set_mail_slot_size(int account_id, char *mailbox_name, int new_slot_size, int *err_code);
-EXPORT_API int em_core_mailbox_remove_overflowed_mails(emf_mailbox_tbl_t *intput_mailbox_tbl, int *err_code);  
-EXPORT_API int em_core_mailbox_get_default_mail_slot_count(int *output_count, int *err_code);
+INTERNAL_FUNC int emcore_download_mailbox_list(void *mail_stream, char *mailbox, emf_mailbox_t **mailbox_list, int *count, int *err_code);
+INTERNAL_FUNC int emcore_delete_imap_mailbox(emf_mailbox_t *mailbox, int *err_code);
+INTERNAL_FUNC int emcore_create_imap_mailbox(emf_mailbox_t *mailbox, int *err_code);
+INTERNAL_FUNC int emcore_modify_imap_mailbox(emf_mailbox_t *old_mailbox,  emf_mailbox_t *new_mailbox, int *err_code);
+INTERNAL_FUNC int emcore_set_sync_imap_mailbox(emf_mailbox_t *mailbox, int synchronous, int *err_code);
+INTERNAL_FUNC int emcore_set_mail_slot_size(int account_id, char *mailbox_name, int new_slot_size, int *err_code);
+INTERNAL_FUNC int emcore_remove_overflowed_mails(emstorage_mailbox_tbl_t *intput_mailbox_tbl, int *err_code);  
+INTERNAL_FUNC int emcore_get_default_mail_slot_count(int *output_count, int *err_code);
 
 #ifdef __cplusplus
 }
diff --git a/email-core/include/email-core-mail.h b/email-core/include/email-core-mail.h
new file mode 100755 (executable)
index 0000000..af5760c
--- /dev/null
@@ -0,0 +1,209 @@
+/*
+*  email-service
+*
+* Copyright (c) 2000 - 2011 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.
+*
+*/
+
+
+/******************************************************************************
+ * File :  email-core-mail.h
+ * Desc :  Mail Operation Header
+ *
+ * Auth : 
+ *
+ * History : 
+ *    2006.08.16  :  created
+ *****************************************************************************/
+#ifndef __EMAIL_CORE_MESSAGE_H__
+#define __EMAIL_CORE_MESSAGE_H__
+
+#include "email-storage.h"
+#include <contacts-svc.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#ifdef __FEATURE_BULK_DELETE_MOVE_UPDATE_REQUEST_OPTI__
+
+#define MAX_SUBSET_STRING_SIZE 260     
+#define MAX_IMAP_COMMAND_LENGTH 1000
+#define MAX_TAG_SIZE 16
+
+
+typedef struct _emf_uid_range_set
+{
+       char *uid_range;
+       unsigned long lowest_uid;
+       unsigned long highest_uid;
+       
+       struct _emf_uid_range_set *next;
+       
+} emf_uid_range_set;
+
+#endif
+
+
+struct _m_content_info 
+{
+       int grab_type;              /*  1 :  download text and get attachment names (no saving attachment) - #define GRAB_TYPE_TEXT       retrieve text and attachment names */
+                              /*  2 :  download attachment - #define GRAB_TYPE_ATTACHMENT retrieve only attachment */
+       int file_no;                /*  attachment no to be download (min : 1) */
+       int report;                 /*  0 : Non 1 : DSN mail 2 : MDN mail 3 : mail to require MDN */
+
+       struct text_data 
+       {
+               char *plain;            /*  body plain text */
+               char *plain_charset;    /*  charset of body text */
+               char *html;             /*  body html text */
+       } text;
+
+       struct attachment_info 
+       {
+               int   type;                 /*  1 : inline 2 : attachment */
+               char *name;                 /*  attachment filename */
+               int   size;                 /*  attachment size */
+               char *save;                 /*  content saving filename */
+               int   drm;                  /*  0 : none 1 : object 2 : rights 3 : dcf */
+               int   drm2;                 /*  0 : none 1 : FL 2 : CD 3 : SSD 4 : SD */
+               char *attachment_mime_type; /*  attachment mime type */
+#ifdef __ATTACHMENT_OPTI__
+               int   encoding;         /*  encoding  */
+               char *section;          /*  section number */
+#endif
+               struct attachment_info *next;
+       } *file;
+};
+
+/**
+ * Download email body from server.
+ *
+ * @param[in] mail_stream      Specifies the mail_stream.
+ * @param[in] mailbox          Specifies the mailbox to contain account ID.
+ * @param[in] mail_id          Specifies the mail ID.
+ * @param[in] callback         Specifies the callback function for retrieving download status.
+ * @param[in] with_attach      Specifies the flag for downloading attachments.
+ * @param[in] limited_size     Specifies the size to be downloaded.
+ * @param[out] err_code                Specifies the error code returned.
+ * @remarks In POP3 case, body and attachment are downloaded in this function.
+ *          In IMAP case, body and attachment list are downloaded and 
+ *          attachments must be downloaded in emcore_download_attachment.
+ * @return This function returns true on success or false on failure.
+ */
+
+INTERNAL_FUNC int emcore_download_body_multi_sections_bulk(void *mail_stream, int account_id, int mail_id, int verbose, int with_attach, int limited_size, int event_handle , int *err_code);
+
+
+/**
+ * Download a email nth-attachment from server.
+ *
+ * @param[in] mailbox          Specifies the mailbox to contain account ID.
+ * @param[in] mail_id                  Specifies the mail ID.
+ * @param[in] nth                              Specifies the buffer that a attachment number been saved. the minimum number is "1".
+ * @param[in] callback         Specifies the callback function for retrieving download status.
+ * @param[in] handle                   Specifies the handle for stopping downloading.
+ * @param[out] err_code        Specifies the error code returned.
+ * @remarks This function is used for only IMAP mail.
+ * @return This function returns true on success or false on failure.
+ */
+INTERNAL_FUNC int emcore_download_attachment(int acconut_id, int mail_id,  char *nth, int *err_code);
+
+INTERNAL_FUNC int emcore_mail_move(int mail_ids[], int num, char *dst_mailbox_name, int noti_param_1, int noti_param_2, int *err_code);
+INTERNAL_FUNC int emcore_mail_add_attachment(int mail_id, emf_attachment_info_t *attachment, int *err_code);
+INTERNAL_FUNC int emcore_delete_mail_attachment(int mail_id,  char *attachment_id, int *err_code);
+INTERNAL_FUNC int emcore_mail_add_attachment_data(int input_mail_id, emf_attachment_data_t *input_attachment_data);
+
+#ifdef __FEATURE_PARTIAL_BODY_DOWNLOAD__
+INTERNAL_FUNC int emcore_insert_pbd_activity(emf_event_partial_body_thd *local_activity, int *activity_id, int *err_code) ;
+INTERNAL_FUNC int emcore_delete_pbd_activity(int account_id, int mail_id, int activity_id, int *err_code);
+#endif 
+
+INTERNAL_FUNC int emcore_get_mail_contact_info(emf_mail_contact_info_t *contact_info, char *full_address, int *err_code);
+INTERNAL_FUNC int emcore_get_mail_contact_info_with_update(emf_mail_contact_info_t *contact_info, char *full_address, int mail_id, int *err_code);
+INTERNAL_FUNC int emcore_free_contact_info(emf_mail_contact_info_t *contact_info, int *err_code);
+INTERNAL_FUNC int emcore_sync_contact_info(int mail_id, int *err_code);
+INTERNAL_FUNC GList *emcore_get_recipients_list(GList *old_recipients_list, char *full_address, int *err_code);
+INTERNAL_FUNC int emcore_get_mail_address_info_list(int mail_id, emf_address_info_list_t **address_info_list, int *err_code);
+INTERNAL_FUNC int emcore_get_mail_display_name(CTSvalue *contact_name_value, char **contact_display_name);
+INTERNAL_FUNC int emcore_get_mail_data(int input_mail_id, emf_mail_data_t **output_mail_data);
+
+INTERNAL_FUNC int emcore_update_mail(emf_mail_data_t *input_mail_data, emf_attachment_data_t *input_attachment_data_list, int input_attachment_count, emf_meeting_request_t* input_meeting_request, int sync_server);
+
+INTERNAL_FUNC int emcore_fetch_flags(int account_id, int mail_id, emf_mail_flag_t *mail_flag, int *err_code);
+INTERNAL_FUNC int emcore_delete_mail_from_local_storage(int account_id, int *mail_ids, int num, int noti_param_1, int noti_param_2, int *err_code);
+INTERNAL_FUNC int emcore_get_mail_msgno_by_uid(emf_account_t *account, emf_mailbox_t *mailbox, char *uid, int *msgno, int *err_code);
+
+/**
+ * Delete mails.
+ *
+ * @param[in] account_id      Specifies the account id.
+ * @param[in] mail_id         Specifies the array for mail id.
+ * @param[in] num             Specifies the number of id.
+ * @param[in] from_server     Specifies whether mails is deleted from server.
+ * @param[in] callback        Specifies the callback function for delivering status during deleting.
+ * @param[in] noti_param_1    Specifies the first parameter for notification.
+ * @param[in] noti_param_2    Specifies the second parameter for notification.
+ * @param[out] err_code       Specifies the error code returned.
+ * @remarks N/A
+ * @return This function returns true on success or false on failure.
+ */
+INTERNAL_FUNC int emcore_delete_mail(int account_id, int mail_id[], int num, int from_server, int noti_param_1, int noti_param_2, int *err_code);
+
+/**
+ * Delete mails.
+ *
+ * @param[in] mailbox                  Specifies the mailbox. this argument is for account id or mailbox name.
+ * @param[in] with_server              Specifies whether mails is also deleted from server.
+ * @param[in] callback                 Specifies the callback function for delivering status during deleting.
+ * @param[out] err_code                Specifies the error code returned.
+ * @remarks N/A
+ * @return This function returns true on success or false on failure.
+ */
+INTERNAL_FUNC int   emcore_delete_mail_all(emf_mailbox_t *mailbox, int with_server, int *err_code);
+
+INTERNAL_FUNC int   emcore_free_mail_data(emf_mail_data_t **mail_list, int count, int *err_code);
+INTERNAL_FUNC void  emcore_free_content_info(struct _m_content_info *cnt_info);
+INTERNAL_FUNC int   emcore_free_attachment_info(emf_attachment_info_t **atch_info, int *err_code);
+INTERNAL_FUNC int   emcore_free_attachment_data(emf_attachment_data_t **attachment_data_list, int attachment_data_count, int *err_code);
+
+INTERNAL_FUNC int   emcore_move_mail_on_server(int account_id, char *src_mailbox,  int mail_ids[], int num, char *dest_mailbox, int *error_code);
+INTERNAL_FUNC int   emcore_sync_flag_with_server(int mail_id, int *err_code);
+INTERNAL_FUNC int   emcore_sync_seen_flag_with_server(int mail_ids[], int num, int *err_code);
+INTERNAL_FUNC int   emcore_get_attachment_info(int mail_id, char *attachment_no, emf_attachment_info_t **attachment, int *err_code);
+INTERNAL_FUNC int   emcore_get_attachment_data_list(int input_mail_id, emf_attachment_data_t **output_attachment_data, int *output_attachment_count);
+INTERNAL_FUNC int   emcore_modify_extra_flag(int mail_id, emf_extra_flag_t new_flag, int *err_code);
+INTERNAL_FUNC int   emcore_modify_flag(int mail_id, emf_mail_flag_t new_flag, int sticky_flag, int *err_code);
+INTERNAL_FUNC int   emcore_set_flags_field(int account_id, int mail_ids[], int num, emf_flags_field_type field_type, int value, int *err_code);
+INTERNAL_FUNC char* emcore_convert_mutf7_to_utf8(char *mailbox_name); 
+INTERNAL_FUNC int   emcore_convert_string_to_structure(const char *encoded_string, void **struct_var, emf_convert_struct_type_e type);
+
+#ifdef __FEATURE_BULK_DELETE_MOVE_UPDATE_REQUEST_OPTI__
+INTERNAL_FUNC int   emcore_sync_flags_field_with_server(int mail_ids[], int num, emf_flags_field_type field_type, int value, int *err_code);
+INTERNAL_FUNC int   emcore_move_mail_on_server_ex(int account_id, char *src_mailbox,  int mail_ids[], int num, char *dest_mailbox, int *error_code);
+#endif
+
+#ifdef __ATTACHMENT_OPTI__
+INTERNAL_FUNC int emcore_download_attachment_bulk(/*emf_mailbox_t *mailbox, */ int account_id, int mail_id, char *nth,  int *err_code);
+#endif
+INTERNAL_FUNC int   emcore_mail_filter_by_rule(emf_rule_t *filter_info, int *err_code);
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif
+/* EOF */
similarity index 74%
rename from email-core/include/em-core-mailbox-sync.h
rename to email-core/include/email-core-mailbox-sync.h
index 69625e8..d0858ca 100755 (executable)
@@ -21,7 +21,7 @@
 
 
 /******************************************************************************
- * File :  em-core-mailbox_sync.h
+ * File :  email-core-mailbox_sync.h
  * Desc :  Mail Header Sync Header
  *
  * Auth : 
  * History : 
  *    2006.08.16  :  created
  *****************************************************************************/
-#ifndef __EM_CORE_MAILBOX_SYNC_H__
-#define __EM_CORE_MAILBOX_SYNC_H__
+#ifndef __EMAIL_CORE_MAILBOX_SYNC_H__
+#define __EMAIL_CORE_MAILBOX_SYNC_H__
 
-#include "emf-types.h"
-#include "em-storage.h"
+#include "email-types.h"
+#include "email-storage.h"
 
 #ifdef __cplusplus
 extern "C"
 {
 #endif /* __cplusplus */
 
-#if !defined(EXPORT_API)
-#define EXPORT_API __attribute__((visibility("default")))
-#endif
-
 #ifdef __FEATURE_PARTIAL_BODY_DOWNLOAD__
 
 #define IMAGE_DISPLAY_PARTIAL_BODY_COUNT 30
@@ -53,6 +49,7 @@ typedef struct
        char *text_image;
        char *content_id;
        int   dec_len;
+       char *mime_type;
 } emf_image_data;
 
 typedef struct 
@@ -63,18 +60,20 @@ typedef struct
 
 #endif
 
-typedef struct em_core_uid_elem {
+typedef struct emcore_uid_elem {
        int msgno;
        char *uid;
        emf_mail_flag_t flag;
-       struct em_core_uid_elem *next;
-} em_core_uid_list; 
+       struct emcore_uid_elem *next;
+} emcore_uid_list; 
 
 int pop3_mail_calc_rfc822_size(MAILSTREAM *stream, int msgno, int *size, int *err_code);
-int pop3_mailbox_get_uids(MAILSTREAM *stream, em_core_uid_list** uid_list, int *err_code);
+int pop3_mailbox_get_uids(MAILSTREAM *stream, emcore_uid_list** uid_list, int *err_code);
 
 int imap4_mail_calc_rfc822_size(MAILSTREAM *stream, int msgno, int *size, int *err_code);
-int imap4_mailbox_get_uids(MAILSTREAM *stream, em_core_uid_list** uid_list, int *err_code);
+int imap4_mailbox_get_uids(MAILSTREAM *stream, emcore_uid_list** uid_list, int *err_code);
+
+int emcore_check_rule(const char *input_full_address_from, const char *input_subject, emstorage_rule_tbl_t *rule, int rule_len, int *matched, int *err_code);
 
 /**
  * Download unread all headers from mail server.
@@ -88,13 +87,13 @@ int imap4_mailbox_get_uids(MAILSTREAM *stream, em_core_uid_list** uid_list, int
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int em_core_mailbox_sync_header(emf_mailbox_tbl_t *input_mailbox_tbl, emf_mailbox_tbl_t *input_mailbox_tbl_spam, void *stream_recycle, em_core_uid_list **input_uid_list, int *unread_mail, int *err_code);
+INTERNAL_FUNC int emcore_sync_header(emstorage_mailbox_tbl_t *input_mailbox_tbl, emstorage_mailbox_tbl_t *input_mailbox_tbl_spam, void *stream_recycle, emcore_uid_list **input_uid_list, int *unread_mail, int *err_code);
 
 typedef enum
 {
        EM_CORE_GET_UIDS_FOR_NO_DELETE = 0, 
        EM_CORE_GET_UIDS_FOR_DELETE, 
-} em_core_get_uids_for_delete_t;
+} emcore_get_uids_for_delete_t;
 /**
  * Download UID list from mail server. 
  *
@@ -109,12 +108,12 @@ typedef enum
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-int em_core_mailbox_download_uid_all(emf_mailbox_t *mailbox, 
-                                                       em_core_uid_list                **uid_list,
+int emcore_download_uid_all(emf_mailbox_t *mailbox, 
+                                                       emcore_uid_list         **uid_list,
                                                        int                                                     *total,
-                                                       emf_mail_read_mail_uid_tbl_t *read_mail_uids, 
+                                                       emstorage_read_mail_uid_tbl_t *read_mail_uids, 
                                                        int                           count, 
-                                                       em_core_get_uids_for_delete_t  for_delete, 
+                                                       emcore_get_uids_for_delete_t  for_delete, 
                                                        int                                                     *err_code);
 
 
@@ -129,7 +128,7 @@ int em_core_mailbox_download_uid_all(emf_mailbox_t *mailbox,
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-int em_core_mailbox_download_imap_msgno(emf_mailbox_t *mailbox, char *uid, int *msgno, int *err_code);
+int emcore_download_imap_msgno(emf_mailbox_t *mailbox, char *uid, int *msgno, int *err_code);
 
 /**
  * Get a message number to be related to uid.
@@ -141,7 +140,7 @@ int em_core_mailbox_download_imap_msgno(emf_mailbox_t *mailbox, char *uid, int *
  * @remarks The uid list must be already saved in fpath before this fucntion is called.
  * @return This function returns true on success or false on failure.
  */
-int em_core_mailbox_get_msgno(em_core_uid_list *uid_list, char *uid, int *msgno, int *err_code);
+int emcore_get_msgno(emcore_uid_list *uid_list, char *uid, int *msgno, int *err_code);
 
 /**
  * Get a uid to be related to a message number.
@@ -153,7 +152,7 @@ int em_core_mailbox_get_msgno(em_core_uid_list *uid_list, char *uid, int *msgno,
  * @remarks The uid list must be already saved in fpath before this fucntion is called.
  * @return This function returns true on success or false on failure.
  */
-int em_core_mailbox_get_uid(em_core_uid_list *uid_list, int msgno, char **uid, int *err_code);
+int emcore_get_uid(emcore_uid_list *uid_list, int msgno, char **uid, int *err_code);
 
 /**
  * free fetch list.
@@ -162,13 +161,12 @@ int em_core_mailbox_get_uid(em_core_uid_list *uid_list, int msgno, char **uid, i
  * @param[out] err_code        Specifies the error code returned.
  * @return This function returns true on success or false on failure.
  */
-int em_core_mailbox_free_uids(em_core_uid_list *uid_list, int *err_code);
+int emcore_free_uids(emcore_uid_list *uid_list, int *err_code);
 
-EXPORT_API int em_core_mail_sync_from_client_to_server(int account_id, int mail_id, int *err_code);
-EXPORT_API int em_core_mail_check_rule(emf_mail_head_t *head, emf_mail_rule_tbl_t *rule, int rule_len, int *matched, int *err_code);
+INTERNAL_FUNC int emcore_sync_mail_from_client_to_server(int account_id, int mail_id, int *err_code);
 
 #ifdef __FEATURE_PARTIAL_BODY_DOWNLOAD__
-EXPORT_API int em_core_bulk_partial_mailbody_download(MAILSTREAM *stream, emf_event_partial_body_thd *pbd_event, int count, int *error);
+INTERNAL_FUNC int emcore_download_bulk_partial_mail_body(MAILSTREAM *stream, emf_event_partial_body_thd *pbd_event, int count, int *error);
 #endif /* __FEATURE_PARTIAL_BODY_DOWNLOAD__ */
 
 
diff --git a/email-core/include/email-core-mailbox.h b/email-core/include/email-core-mailbox.h
new file mode 100755 (executable)
index 0000000..7be9255
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+*  email-service
+*
+* Copyright (c) 2000 - 2011 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.
+*
+*/
+
+
+
+/******************************************************************************
+ * File :  email-core-mailbox.h
+ * Desc :  Local Mailbox Management Header
+ *
+ * Auth : 
+ *
+ * History : 
+ *    2006.08.16  :  created
+ *****************************************************************************/
+#ifndef __EMAIL_CORE_MAILBOX_H__
+#define __EMAIL_CORE_MAILBOX_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+#include "c-client.h"
+#include "email-types.h"
+#include "email-internal-types.h"
+
+typedef enum      
+{
+       EM_CORE_STREAM_TYPE_RECV = 0,   
+       EM_CORE_STREAM_TYPE_SEND,               
+} emcore_stream_type_t;
+
+#ifdef __FEATURE_KEEP_CONNECTION__
+INTERNAL_FUNC int emcore_remove_connection_info(int account_id);
+#endif /* __FEATURE_KEEP_CONNECTION__ */
+/*  in SMTP case, path argument must be (ENCODED_PATH_SMTP) */
+/*  ex) emcore_connect_to_remote_mailbox(xxx, (char *)ENCODED_PATH_SMTP, xxx, xxx); */
+INTERNAL_FUNC int  emcore_connect_to_remote_mailbox_with_account_info(emf_account_t *ref_account, char *mailbox, void **mail_stream, int *err_code);
+INTERNAL_FUNC int  emcore_connect_to_remote_mailbox(int account_id, char *mailbox, void **mail_stream, int *err_code);
+INTERNAL_FUNC int  emcore_close_mailbox(int account_id, void *mail_stream);
+#ifdef __FEATURE_KEEP_CONNECTION__
+INTERNAL_FUNC void emcore_close_mailbox_receiving_stream();
+INTERNAL_FUNC void emcore_close_mailbox_partial_body_stream();
+INTERNAL_FUNC void emcore_reset_streams();
+#endif
+
+INTERNAL_FUNC int  emcore_get_list_to_be_sync(int account_id, emf_mailbox_t **mailbox_list, int *p_count, int *err_code);
+INTERNAL_FUNC int  emcore_get_list(int account_id, emf_mailbox_t **mailbox_list, int *p_count, int *err_code);
+INTERNAL_FUNC int  emcore_free_mailbox(emf_mailbox_t **mailbox_list, int count, int *err_code);
+INTERNAL_FUNC int  emcore_get_mail_count(emf_mailbox_t *mailbox, int *total, int *unseen, int *err_code);
+INTERNAL_FUNC int  emcore_create_mailbox(emf_mailbox_t *new_mailbox, int on_server, int *err_code);
+INTERNAL_FUNC int  emcore_delete_mailbox(emf_mailbox_t *mailbox, int on_server, int *err_code);
+INTERNAL_FUNC int  emcore_delete_mailbox_all(emf_mailbox_t *mailbox, int *err_code);
+INTERNAL_FUNC int  emcore_update_mailbox(emf_mailbox_t *old_mailbox, emf_mailbox_t *new_mailbox, int *err_code);
+INTERNAL_FUNC int  emcore_save_local_activity_sync(int account_id, int *err_code);
+INTERNAL_FUNC void emcore_bind_mailbox_type(emf_mailbox_t *mailbox_list);
+INTERNAL_FUNC int  emcore_send_mail_event(emf_mailbox_t *mailbox, int mail_id , int *err_code);
+INTERNAL_FUNC int  emcore_partial_body_thd_local_activity_sync(int *is_event_inserted, int *err_code);
+INTERNAL_FUNC int  emcore_get_mailbox_by_type(int account_id, emf_mailbox_type_e mailbox_type, emf_mailbox_t *spam_mailbox, int *err_code);
+
+#ifdef __FEATURE_LOCAL_ACTIVITY__
+INTERNAL_FUNC int  emcore_local_activity_sync(int account_id, int *err_code);
+INTERNAL_FUNC int  emcore_save_local_activity_sync(int account_id, int *err_code);
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif
diff --git a/email-core/include/email-core-mime.h b/email-core/include/email-core-mime.h
new file mode 100755 (executable)
index 0000000..726c7f6
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+*  email-service
+*
+* Copyright (c) 2000 - 2011 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.
+*
+*/
+
+
+/******************************************************************************
+ * File :  email-core-mime.h
+ * Desc :  MIME Operation Header
+ *
+ * Auth : 
+ *
+ * History : 
+ *    2011.04.14  :  created
+ *****************************************************************************/
+#ifndef __EMAIL_CORE_MIME_H__
+#define __EMAIL_CORE_MIME_H__
+
+#include "email-internal-types.h"
+#include "c-client.h"
+#include "email-storage.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+char *emcore_get_line_from_file(void *stream, char *buf, int size, int *err_code);
+int   emcore_parse_mime(void *stream, int is_file, struct _m_content_info *cnt_info, int *err_code);
+INTERNAL_FUNC int   emcore_get_content_type_from_mime_string(char *input_mime_string, char **output_content_type);
+INTERNAL_FUNC int   emcore_get_content_type_from_mail_bodystruct(BODY *input_body, int input_buffer_length, char *output_content_type);
+INTERNAL_FUNC int   emcore_get_attribute_value_of_body_part(PARAMETER *input_param, char *atribute_name, char *output_value, int output_buffer_length, int with_rfc2047_text, int *err_code);
+INTERNAL_FUNC int   emcore_get_body_part_list_full(MAILSTREAM *stream, int msg_uid, int account_id, int mail_id, BODY *body, struct _m_content_info *cnt_info, int *err_code, PARTLIST * section_list, int event_handle);
+INTERNAL_FUNC int   emcore_get_body(MAILSTREAM *stream, int account_id, int mail_id, int msg_uid, BODY *body, struct _m_content_info *cnt_info, int *err_code);
+INTERNAL_FUNC int   emcore_get_body_structure(MAILSTREAM *stream, int msg_uid, BODY **body, int *err_code);
+INTERNAL_FUNC char *emcore_decode_rfc2047_text(char *rfc2047_text, int *err_code);
+INTERNAL_FUNC int   emcore_decode_body_text(char *enc_buf, int enc_len, int enc_type, int *dec_len, int *err_code);
+INTERNAL_FUNC int   emcore_set_fetch_body_section(BODY *body, int enable_inline_list, int *total_mail_size, int *err_code);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif
+/* EOF */
similarity index 51%
rename from email-core/include/em-core-smtp.h
rename to email-core/include/email-core-smtp.h
index e968a77..1c71665 100755 (executable)
@@ -22,7 +22,7 @@
 
 
 /******************************************************************************
- * File :  em-core-smtp.h
+ * File :  email-core-smtp.h
  * Desc :  Mail SMTP Header
  *
  * Auth : 
  * History : 
  *    2006.08.16  :  created
  *****************************************************************************/
-#ifndef __EM_CORE_SMTP_H__
-#define __EM_CORE_SMTP_H__
+#ifndef __EMAIL_CORE_SMTP_H__
+#define __EMAIL_CORE_SMTP_H__
 
 #ifdef __cplusplus
 extern "C"
 {
 #endif /* __cplusplus */
 
-/* /#include "emflib.h" */
 #include <stdio.h>
 #include "c-client.h"
+#include "email-internal-types.h"
 
-#if !defined(EXPORT_API)
-#define EXPORT_API __attribute__((visibility("default")))
-#endif
-
-
-EXPORT_API int em_core_mail_send(int account_id, char *mailbox, int mail_id, emf_option_t *sending_option, int *err_code);
+INTERNAL_FUNC int emcore_send_mail(int account_id, char *mailbox, int mail_id, emf_option_t *sending_option, int *err_code);
 
-EXPORT_API int em_core_mail_send_saved(int account_id, char *mailbox, emf_option_t *sending_option, int *err_code);
+INTERNAL_FUNC int emcore_send_saved_mail(int account_id, char *mailbox, emf_option_t *sending_option, int *err_code);
 
-EXPORT_API int em_core_mail_get_rfc822(emf_mail_t *mail, ENVELOPE **env, char **file_path, emf_option_t *sending_option, int *err_code);
+INTERNAL_FUNC int emcore_make_rfc822_file_from_mail(emstorage_mail_tbl_t *input_mail_tbl_data, emstorage_attachment_tbl_t *input_attachment_tbl_t, int input_attachment_count, ENVELOPE **env, char **file_path, emf_option_t *sending_option, int *err_code);
 
-EXPORT_API int em_core_mail_save(int account_id, char *mailbox_name, emf_mail_t *mail_src, emf_meeting_request_t *meeting_req, int from_composer, int *err_code);
+INTERNAL_FUNC int emcore_add_mail(emf_mail_data_t *input_mail_data, emf_attachment_data_t *input_attachment_data_list, int input_attachment_count, emf_meeting_request_t *input_meeting_request, int input_from_eas);
 
-EXPORT_API int em_core_add_mail(emf_mail_data_t *input_mail_data, emf_attachment_data_t *input_attachment_data_list, int input_attachment_count, emf_meeting_request_t *input_meeting_request, int input_sync_server);
+INTERNAL_FUNC int emcore_add_read_receipt(int input_read_mail_id, int *output_receipt_mail_id);
 
-EXPORT_API int em_core_mail_add_meeting_request(int account_id, char *mailbox_name, emf_meeting_request_t *meeting_req, int *err_code);
+INTERNAL_FUNC int emcore_add_meeting_request(int account_id, char *mailbox_name, emf_meeting_request_t *meeting_req, int *err_code);
 
 #ifdef __cplusplus
 }
similarity index 78%
rename from email-core/include/em-core-sound.h
rename to email-core/include/email-core-sound.h
index 34fbe1c..a0dea59 100755 (executable)
 #include <devman_haptic.h>
 #include <alarm.h>
 
-#define MAX_LENGTH 255
-#define TIMER 7000
-#define HAPTIC_TEST_ITERATION 1
-
-void em_core_set_repetition_alarm(int repetition);
-int em_core_vibration_destory();
-int em_core_vibration_stop();
-int em_core_sound_mp_player_stop();
-bool em_core_sound_mp_player_destory();
-void *start_alert_thread(void *arg);
-EXPORT_API int em_core_alert_loop_start(int *err_code);
-EXPORT_API void start_alert();
-
-#ifdef Min
-#undef Min
-#endif
-
 typedef enum
 {
        EMAIL_SOUND_STATUS, 
@@ -69,3 +52,10 @@ typedef enum
        EMAIL_GCONF_VALUE_REPEAT_5MINS,
        EMAIL_GCONF_VALUE_REPEAT_10MINS,
 } EMAIL_ALERT_REPEAT_ALARM;
+
+#ifdef Min
+#undef Min
+#endif
+
+INTERNAL_FUNC int  emcore_start_alert_thread(int *err_code);
+INTERNAL_FUNC void emcore_start_alert();
similarity index 84%
rename from email-core/include/em-core-timer.h
rename to email-core/include/email-core-timer.h
index e64cdbe..4bf4fe3 100755 (executable)
@@ -19,7 +19,7 @@
 *
 */
 
-
+#include "email-internal-types.h"
 
 typedef void (*EMF_TIMER_CALLBACK)(void *a_pData);
 
@@ -29,7 +29,7 @@ typedef void (*EMF_TIMER_CALLBACK)(void *a_pData);
  * @param[in] a_pData                  Specifies the data passed to callback.
  * @return This function returns true for repeat alerts or false for mail resend.
  */
-EXPORT_API int em_core_timer_ex_callback(void *a_pData);
+INTERNAL_FUNC int emcore_timer_ex_callback(void *a_pData);
 
 /**
  * Set timer
@@ -40,7 +40,7 @@ EXPORT_API int em_core_timer_ex_callback(void *a_pData);
  * @remarks N/A
  * @return This function returns the timer id.
  */
-EXPORT_API int em_core_set_timer_ex(long a_nSetTimeValue, EMF_TIMER_CALLBACK a_pCallBack, void *a_pData);
+INTERNAL_FUNC int emcore_set_timer_ex(long a_nSetTimeValue, EMF_TIMER_CALLBACK a_pCallBack, void *a_pData);
 
 /**
  * Kill timer.
@@ -49,4 +49,4 @@ EXPORT_API int em_core_set_timer_ex(long a_nSetTimeValue, EMF_TIMER_CALLBACK a_p
  * @remarks N/A
  * @return This function returns void.
  */
-EXPORT_API void em_core_kill_timer_ex(int a_nTimerID);
+INTERNAL_FUNC void emcore_kill_timer_ex(int a_nTimerID);
diff --git a/email-core/include/email-core-utils.h b/email-core/include/email-core-utils.h
new file mode 100755 (executable)
index 0000000..62f2ce3
--- /dev/null
@@ -0,0 +1,193 @@
+/*
+*  email-service
+*
+* Copyright (c) 2000 - 2011 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.
+*
+*/
+
+
+/******************************************************************************
+ * File :  email-core-utils.h
+ * Desc :  Mail Utils Header
+ *
+ * Auth : 
+ *
+ * History : 
+ *    2006.08.16  :  created
+ *****************************************************************************/
+#ifndef __EMAIL_CORE_UTILS_H__
+#define __EMAIL_CORE_UTILS_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+#include "email-types.h"
+#include "email-internal-types.h"
+#include "email-storage.h"
+#include "email-core-global.h"
+#include "email-core-mail.h"
+
+/*  This is used for emcore_get_long_encoded_path */
+#define        ENCODED_PATH_SMTP       "UHDF_ENCODED_PATH_SMTP_EKJD"
+
+typedef int (*emf_get_unread_email_count_cb)(int unread, int *err_code);
+
+/* parse the Full mailbox Path and get the Alias Name of the Mailbox */
+char* emcore_get_alias_of_mailbox(const char *mailbox_path);
+
+/* Parse the Mailbox Path and get the Account Email address */
+int   emcore_get_temp_file_name(char **filename, int *err_code);
+int   emcore_get_long_encoded_path(int account_id, char *path, int delimiter, char **long_enc_path, int *err_code);
+int   emcore_get_encoded_mailbox_name(char *name, char **enc_name, int *err_code);
+int   emcore_get_file_name(char *path, char **filename, int *err_code);
+int   emcore_get_file_size(char *path, int *size, int *err_code);
+int   emcore_get_actual_mail_size(char *pBodyPlane, char *pBodyHtml, struct attachment_info *pAttachment, int *error_code);
+int   emcore_calc_mail_size(emf_mail_data_t *mail_data_src, emf_attachment_data_t *attachment_data_src, int attachment_count, int *error_code);
+int   emcore_get_address_count(char *addr_str, int *to_num, int *err_code);
+int   emcore_is_storage_full(int *error);
+int   emcore_show_popup(int id, emf_action_t action, int error);
+int   emcore_get_long_encoded_path_with_account_info(emf_account_t *account, char *path, int delimiter, char **long_enc_path, int *err_code);
+void  emcore_fill_address_information_of_mail_tbl(emstorage_mail_tbl_t *mail_data);
+
+
+int   emcore_get_preview_text_from_file(const char *input_plain_path, const char *input_html_path, int input_preview_buffer_length, char **output_preview_buffer);
+int   emcore_strip_HTML(char *source_string);
+int   emcore_send_noti_for_new_mail(int account_id, char *mailbox_name, char *subject, char *from, char *uid, char *datetime);
+int   emcore_make_attachment_file_name_with_extension(char *source_file_name, char *sub_type, char *result_file_name, int result_file_name_buffer_length, int *err_code);
+
+/* Session Handling */
+int   emcore_get_empty_session(emf_session_t **session);
+int   emcore_clear_session(emf_session_t *session);
+int   emcore_get_current_session(emf_session_t **session);
+
+INTERNAL_FUNC emf_option_t *emcore_get_option(int *err_code);
+INTERNAL_FUNC int emcore_set_option(emf_option_t *opt, int *err_code);
+
+INTERNAL_FUNC int emcore_check_unread_mail();
+INTERNAL_FUNC int emcore_set_network_error(int err_code);
+
+/* Transaction Handling */
+INTERNAL_FUNC int emcore_add_transaction_info(int mail_id , int handle  , int *err_code);
+INTERNAL_FUNC int emcore_get_handle_by_mailId_from_transaction_info(int mail_id , int *pHandle);
+INTERNAL_FUNC int emcore_delete_transaction_info_by_mailId(int mail_id);
+
+/* For notification bar */
+INTERNAL_FUNC int emcore_update_notification_for_unread_mail(int account_id);
+INTERNAL_FUNC int emcore_clear_all_notifications();
+INTERNAL_FUNC int emcore_add_notification_for_unread_mail(emstorage_mail_tbl_t *input_mail_tbl_data);
+INTERNAL_FUNC int emcore_delete_notification_for_read_mail(int mail_id);
+INTERNAL_FUNC int emcore_delete_notification_by_account(int account_id);
+INTERNAL_FUNC int emcore_finalize_sync(int account_id, int *error);
+
+
+
+#ifdef __FEATURE_BULK_DELETE_MOVE_UPDATE_REQUEST_OPTI__
+
+/**
+ * @fn emcore_convert_to_uid_range_set(emf_id_set_t *id_set, int id_set_count, emf_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
+ * @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, 
+ *                                                     While using it the caller should remove the ending , (comma)                                    
+ * @return This function returns true on success or false on failure.
+ */
+INTERNAL_FUNC int emcore_convert_to_uid_range_set(emf_id_set_t *id_set, int id_set_count, emf_uid_range_set **uid_range_set, int range_len, int *err_code);
+
+/**
+ * void emcore_free_uid_range_set(emf_uid_range_set **uid_range_head)
+ * Frees the linked list of uid ranges 
+ *
+ * @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.
+ */
+INTERNAL_FUNC void emcore_free_uid_range_set(emf_uid_range_set **uid_range_set);
+
+/**
+ * @fn emcore_append_subset_string_to_uid_range(char *subset_string, emf_uid_range_set **uid_range_set, int range_len, unsigned long luid, unsigned long huid)
+ * Appends the subset_string to uid range if the uid range has not exceeded maximum length(range_len), otherwise creates a new node in linked list of uid range set 
+ * and stores the subset_string in its uid_range. Also sets the lowest and highest uids for the corresponsing uid_range
+ * 
+ * @author                                     h.gahlaut@samsung.com
+ * @param[in] subset_string            Specifies the subset string to be appended. A subset string can be like X : Y or X where X and Y are uids.
+ * @param[in] range_len                Specifies the maximum length of range string allowed. 
+ * @param[in] luid                             Specifies the lowest uid in subset string
+ * @param[in] huid                             Specifies the highest uid in subset string
+ * @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                                                                            
+ * @return This function returns true on success or false on failure.
+ */
+int emcore_append_subset_string_to_uid_range(char *subset_string, emf_uid_range_set **current_node_adr, emf_uid_range_set **uid_range_set, int range_len, unsigned long luid, unsigned long huid);
+
+/**
+ * @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
+ * @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.
+ *                                                     Then this function will form two comma separated strings as follows -
+ *                                                     "2755, 2754, 2748"
+ *                                                     "2749, 2750"
+ * @return This function returns true on success or false on failure.
+ */
+INTERNAL_FUNC int emcore_form_comma_separated_strings(int numbers[], int num_count, int max_string_len, char ***strings, int *string_count, int *err_code);
+
+/**
+ * @fn emcore_free_comma_separated_strings(char ***string_list, int *string_count)
+ * Frees the double dimensional array of strings. 
+ *
+ * @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                                                                    
+ * @return This function does not return anything.
+ */
+
+INTERNAL_FUNC void emcore_free_comma_separated_strings(char ***string_list, int *string_count);
+
+#endif
+
+#ifdef __FEATURE_LOCAL_ACTIVITY__
+/*  Added to get next activity id sequence */
+INTERNAL_FUNC int emcore_get_next_activity_id(int *activity_id, int *err_code);
+INTERNAL_FUNC int emcore_add_activity(emstorage_activity_tbl_t *new_activity, int *err_code);
+INTERNAL_FUNC int emcore_delete_activity(emstorage_activity_tbl_t *activity, int *err_code);
+#endif /* __FEATURE_LOCAL_ACTIVITY__ */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __EMAIL_CORE_UTILS_H__ */
similarity index 56%
rename from email-engine/CMakeLists.txt
rename to email-daemon/CMakeLists.txt
index 3344380..027c69d 100755 (executable)
@@ -11,7 +11,6 @@ MESSAGE("")
 MESSAGE(">>> current directory: ${CMAKE_CURRENT_SOURCE_DIR}")
 MESSAGE(">>> Build type: ${CMAKE_BUILD_TYPE}")
 
-SET(VISIBILITY "-DEXPORT_API=\"__attribute__((visibility(\\\"default\\\")))\"")
 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VISIBILITY} -fvisibility=hidden")
 
 ##########################################################
@@ -19,30 +18,27 @@ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VISIBILITY} -fvisibility=hidden")
 ##########################################################
 
 SET(MAIN-SRCS 
-       ${CMAKE_SOURCE_DIR}/email-engine/main.c
-       ${CMAKE_SOURCE_DIR}/email-engine/emf-init.c
-       ${CMAKE_SOURCE_DIR}/email-engine/emf-account.c
-       ${CMAKE_SOURCE_DIR}/email-engine/emf-global.c
-       ${CMAKE_SOURCE_DIR}/email-engine/emf-mail.c
-       ${CMAKE_SOURCE_DIR}/email-engine/emf-mailbox.c
-       ${CMAKE_SOURCE_DIR}/email-engine/emf-etc.c
-       ${CMAKE_SOURCE_DIR}/email-engine/emf-emn-noti.c
-       ${CMAKE_SOURCE_DIR}/email-engine/emf-emn.c
-       ${CMAKE_SOURCE_DIR}/email-engine/emf-auto-poll.c
+       ${CMAKE_SOURCE_DIR}/email-daemon/main.c
+       ${CMAKE_SOURCE_DIR}/email-daemon/email-daemon-init.c
+       ${CMAKE_SOURCE_DIR}/email-daemon/email-daemon-account.c
+       ${CMAKE_SOURCE_DIR}/email-daemon/email-daemon-mail.c
+       ${CMAKE_SOURCE_DIR}/email-daemon/email-daemon-mailbox.c
+       ${CMAKE_SOURCE_DIR}/email-daemon/email-daemon-etc.c
+       ${CMAKE_SOURCE_DIR}/email-daemon/email-daemon-emn.c
+       ${CMAKE_SOURCE_DIR}/email-daemon/email-daemon-auto-poll.c
 )
 
 INCLUDE_DIRECTORIES(
-       ${CMAKE_SOURCE_DIR}/Common/include
-       ${CMAKE_SOURCE_DIR}/ipc/include
-       ${CMAKE_SOURCE_DIR}/MAPI/include
-       ${CMAKE_SOURCE_DIR}/email-core/drivers
-       ${CMAKE_SOURCE_DIR}/email-core/em-storage/include
-       ${CMAKE_SOURCE_DIR}/include
+       ${CMAKE_SOURCE_DIR}/email-common-use/include
+       ${CMAKE_SOURCE_DIR}/email-ipc/include
+       ${CMAKE_SOURCE_DIR}/email-api/include
        ${CMAKE_SOURCE_DIR}/email-core/include
+       ${CMAKE_SOURCE_DIR}/email-core/email-storage/include
+       ${CMAKE_SOURCE_DIR}/email-daemon/include
 )
 
 INCLUDE(FindPkgConfig)
-pkg_check_modules(main_pkgs REQUIRED glib-2.0 drm-service dlog dbus-1 gthread-2.0  db-util openssl uw-imap-toolkit vconf contacts-service alarm-service mm-player devman_haptic)
+pkg_check_modules(main_pkgs REQUIRED glib-2.0 drm-service dlog dbus-1 gthread-2.0  db-util openssl uw-imap-toolkit vconf contacts-service alarm-service mm-player devman_haptic heynoti)
 
 
 FOREACH(flag ${main_pkgs_CFLAGS})
@@ -53,6 +49,6 @@ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
 SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
 
 ADD_EXECUTABLE(${PROJECT_NAME} ${MAIN-SRCS})
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${main_pkgs_LDFLAGS} dl ssl email-core email-storage email-network email-ipc email-base)
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${main_pkgs_LDFLAGS} dl ssl email-core email-storage email-network email-ipc email-common-use)
 INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
 
similarity index 67%
rename from email-engine/emf-account.c
rename to email-daemon/email-daemon-account.c
index ae18c00..bbb3aad 100755 (executable)
@@ -22,7 +22,7 @@
 
 /******************************************************************************
  * File: emf-account.c
- * Desc: Mail Framework Account
+ * Desc: email-daemon Account
  *
  * Auth:
  *
 #include <stdlib.h>
 #include <vconf.h>
 
-#include "emflib.h"
-#include "em-storage.h"
-#include "emf-global.h"
+#include "email-daemon.h"
+#include "email-storage.h"
 #include "c-client.h"
-#include "emf-dbglog.h"
-#include "emf-account.h"
+#include "email-debug-log.h"
+#include "email-daemon-account.h"
 #include <contacts-svc.h>
-#include "emf-types.h"
-#include "em-core-account.h" 
-#include "em-core-event.h" 
-#include "em-core-utils.h"
-#include "Msg_Convert.h"
-
-static int emf_refresh_account_reference()
+#include "email-types.h"
+#include "email-core-account.h" 
+#include "email-core-event.h" 
+#include "email-core-utils.h"
+#include "email-utilities.h"
+#include "email-convert.h"
+
+static int emdaemon_refresh_account_reference()
 {
        EM_DEBUG_FUNC_BEGIN();
-       return em_core_refresh_account_reference();
+       return emcore_refresh_account_reference();
 }
 
-static int emf_filter_check_filter_id(int account_id, int filter_id, int* err_code)
+static int emdaemon_check_filter_id(int account_id, int filter_id, int* err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], filter_id[%d], err_code[%p]", account_id, filter_id, err_code);
        
@@ -67,10 +67,10 @@ static int emf_filter_check_filter_id(int account_id, int filter_id, int* err_co
        
        int ret = false;
        int err = EMF_ERROR_NONE;
-       emf_mail_rule_tbl_t* filter = NULL;
+       emstorage_rule_tbl_t* filter = NULL;
        
-       if (!em_storage_get_rule_by_id(account_id, filter_id, &filter, true, &err)) {
-               EM_DEBUG_EXCEPTION(" em_storage_get_rule_by_id failed [%d]", err);
+       if (!emstorage_get_rule_by_id(account_id, filter_id, &filter, true, &err)) {
+               EM_DEBUG_EXCEPTION(" emstorage_get_rule_by_id failed [%d]", err);
                
                goto FINISH_OFF;
        }
@@ -79,7 +79,7 @@ static int emf_filter_check_filter_id(int account_id, int filter_id, int* err_co
        
 FINISH_OFF:
        if (filter != NULL)
-               em_storage_free_rule(&filter, 1, NULL);
+               emstorage_free_rule(&filter, 1, NULL);
        
        if (err_code != NULL)
                *err_code = err;
@@ -88,7 +88,7 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int emf_account_create(emf_account_t* account, int* err_code)
+INTERNAL_FUNC int emdaemon_create_account(emf_account_t* account, int* err_code)
 {
        int ret = false;
        int err = EMF_ERROR_NONE;
@@ -96,11 +96,11 @@ EXPORT_API int emf_account_create(emf_account_t* account, int* err_code)
        switch (account->account_bind_type)  {
                case EMF_BIND_TYPE_DISABLE: 
                case EMF_BIND_TYPE_EM_CORE:
-                       if (!em_core_account_create(account, &err)) {
-                               EM_DEBUG_EXCEPTION(" em_core_account_add failed [%d]", err);
+                       if (!emcore_create_account(account, &err)) {
+                               EM_DEBUG_EXCEPTION(" emcore_account_add failed [%d]", err);
                                goto FINISH_OFF;
                        }
-                       emf_refresh_account_reference();
+                       emdaemon_refresh_account_reference();
                        break;
                default:
                        EM_DEBUG_EXCEPTION(" unknown account bind type...");
@@ -117,18 +117,18 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int emf_account_delete(int account_id, int* err_code)
+INTERNAL_FUNC int emdaemon_delete_account(int account_id, int* err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
        int ret;
        
-       ret = em_core_account_delete(account_id, err_code);
+       ret = emcore_delete_account_(account_id, err_code);
        EM_DEBUG_FUNC_END();
        return ret;
 }
        
        
-EXPORT_API int emf_account_validate(int account_id, unsigned* handle, int* err_code)
+INTERNAL_FUNC int emdaemon_validate_account(int account_id, unsigned* handle, int* err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], handle[%p], err_code[%p]", account_id, handle, err_code);
        
@@ -144,8 +144,8 @@ EXPORT_API int emf_account_validate(int account_id, unsigned* handle, int* err_c
        emf_event_t event_data = {0};
        emf_account_t* ref_account = NULL;
        
-       if (!(ref_account = emf_get_account_reference(account_id))) {
-               EM_DEBUG_EXCEPTION(" emf_get_account_reference failed [%d]", account_id);
+       if (!(ref_account = emdaemon_get_account_reference(account_id))) {
+               EM_DEBUG_EXCEPTION(" emdaemon_get_account_reference failed [%d]", account_id);
                err = EMF_ERROR_INVALID_ACCOUNT;
                goto FINISH_OFF;
        }
@@ -157,8 +157,8 @@ EXPORT_API int emf_account_validate(int account_id, unsigned* handle, int* err_c
                        event_data.event_param_data_3 = NULL;
                        event_data.account_id = account_id;
                                                
-                       if (!em_core_insert_event(&event_data, (int*)handle, &err))  {
-                               EM_DEBUG_EXCEPTION(" em_core_insert_event falied [%d]", err);                   
+                       if (!emcore_insert_event(&event_data, (int*)handle, &err))  {
+                               EM_DEBUG_EXCEPTION(" emcore_insert_event falied [%d]", err);                    
                goto FINISH_OFF;
        }
                        break;
@@ -179,7 +179,7 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int emf_account_validate_and_create(emf_account_t* new_account, unsigned* handle, int* err_code)
+INTERNAL_FUNC int emdaemon_validate_account_and_create(emf_account_t* new_account, unsigned* handle, int* err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account[%p], handle[%p], err_code[%p]", new_account, handle, err_code);
        
@@ -194,8 +194,8 @@ EXPORT_API int emf_account_validate_and_create(emf_account_t* new_account, unsig
                        event_data.event_param_data_3 = NULL;
                        event_data.account_id = NEW_ACCOUNT_ID;
        
-                       if (!em_core_insert_event(&event_data, (int*)handle, &err))  {
-                               EM_DEBUG_EXCEPTION(" em_core_insert_event falied [%d]", err);                   
+                       if (!emcore_insert_event(&event_data, (int*)handle, &err))  {
+                               EM_DEBUG_EXCEPTION(" emcore_insert_event falied [%d]", err);                    
                                goto FINISH_OFF;
                        }
                        break;
@@ -215,14 +215,14 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int emf_account_modify(int account_id, emf_account_t* new_account, int* err_code)
+INTERNAL_FUNC int emdaemon_update_account(int account_id, emf_account_t* new_account, int* err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], new_account[%p], err_code[%p]", account_id, new_account, err_code);
        
        /*  default variable */
        int ret = false;
        int err = EMF_ERROR_NONE;
-       emf_mail_account_tbl_t *new_account_tbl = NULL;
+       emstorage_account_tbl_t *new_account_tbl = NULL;
        
        if ((account_id <= 0) || !new_account)  {
                EM_DEBUG_EXCEPTION("Invalid Parameters.");
@@ -231,14 +231,14 @@ EXPORT_API int emf_account_modify(int account_id, emf_account_t* new_account, in
        }
        EM_DEBUG_LOG("new_account->email_addr[%s]", new_account->email_addr);
        if(new_account->email_addr) {
-               if (!em_core_verify_email_address(new_account->email_addr, true, &err)) {
+               if (!em_verify_email_address(new_account->email_addr, true, &err)) {
                        err = EMF_ERROR_INVALID_ADDRESS;
                        EM_DEBUG_EXCEPTION("Invalid Email Address");
                        goto FINISH_OFF;
                }
        }
 
-       new_account_tbl = em_core_malloc(sizeof(emf_mail_account_tbl_t));
+       new_account_tbl = em_malloc(sizeof(emstorage_account_tbl_t));
        if(!new_account_tbl) {
                EM_DEBUG_EXCEPTION("allocation failed [%d]", err);
                goto FINISH_OFF;
@@ -246,25 +246,25 @@ EXPORT_API int emf_account_modify(int account_id, emf_account_t* new_account, in
 
        em_convert_account_to_account_tbl(new_account, new_account_tbl);
        
-       if (!em_storage_update_account(account_id, new_account_tbl, true, &err))  {
-               EM_DEBUG_EXCEPTION("em_storage_update_account falied [%d]", err);
+       if (!emstorage_update_account(account_id, new_account_tbl, true, &err))  {
+               EM_DEBUG_EXCEPTION("emstorage_update_account falied [%d]", err);
                goto FINISH_OFF;
        }
        
-       emf_refresh_account_reference();
+       emdaemon_refresh_account_reference();
        
        ret = true;
        
 FINISH_OFF:
        if(new_account_tbl)
-               em_storage_free_account(&new_account_tbl, 1, NULL);
+               emstorage_free_account(&new_account_tbl, 1, NULL);
        if (err_code)
                *err_code = err;
        EM_DEBUG_FUNC_END();
        return ret;
 }
 
-EXPORT_API int emf_account_validate_and_update(int old_account_id, emf_account_t* new_account_info, unsigned* handle,int *err_code)
+INTERNAL_FUNC int emdaemon_validate_account_and_update(int old_account_id, emf_account_t* new_account_info, unsigned* handle,int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account[%d], new_account_info[%p], handle[%p], err_code[%p]", old_account_id, new_account_info, handle, err_code);
        
@@ -287,8 +287,8 @@ EXPORT_API int emf_account_validate_and_update(int old_account_id, emf_account_t
                        memcpy(pAccount, new_account_info, sizeof(emf_account_t));
                        event_data.event_param_data_1 = (char *) pAccount;
 
-                       if (!em_core_insert_event(&event_data, (int*)handle, &err)) {
-                               EM_DEBUG_EXCEPTION("em_core_insert_event falied [%d]", err);                    
+                       if (!emcore_insert_event(&event_data, (int*)handle, &err)) {
+                               EM_DEBUG_EXCEPTION("emcore_insert_event falied [%d]", err);                     
                                goto FINISH_OFF;
                        }
 
@@ -309,14 +309,14 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int emf_account_get(int account_id, int pulloption, emf_account_t** account, int* err_code)
+INTERNAL_FUNC int emdaemon_get_account(int account_id, int pulloption, emf_account_t** account, int* err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], pulloption [%d], account[%p], err_code[%p]", account_id, pulloption, account, err_code);
        
        /*  default variable */
        int ret = false;
        int err = EMF_ERROR_NONE;
-       emf_mail_account_tbl_t *account_tbl = NULL;
+       emstorage_account_tbl_t *account_tbl = NULL;
        
        if (!account)  {
                EM_DEBUG_EXCEPTION("account_id[%d], account[%p]", account_id, account);
@@ -324,12 +324,12 @@ EXPORT_API int emf_account_get(int account_id, int pulloption, emf_account_t** a
                goto FINISH_OFF;
        }
 
-       if (!em_storage_get_account_by_id(account_id, pulloption, &account_tbl, true, &err)) {
-               EM_DEBUG_EXCEPTION("em_storage_get_account_by_id failed [%d]", err);
+       if (!emstorage_get_account_by_id(account_id, pulloption, &account_tbl, true, &err)) {
+               EM_DEBUG_EXCEPTION("emstorage_get_account_by_id failed [%d]", err);
                goto FINISH_OFF;
        }
 
-       *account = em_core_malloc(sizeof(emf_account_t));
+       *account = em_malloc(sizeof(emf_account_t));
        if(!*account) {
                EM_DEBUG_EXCEPTION("allocation failed [%d]", err);
                goto FINISH_OFF;
@@ -340,19 +340,19 @@ EXPORT_API int emf_account_get(int account_id, int pulloption, emf_account_t** a
        
 FINISH_OFF:
        if(account_tbl)
-               em_storage_free_account(&account_tbl, 1, NULL);
+               emstorage_free_account(&account_tbl, 1, NULL);
        if (err_code)
                *err_code = err;
        EM_DEBUG_FUNC_END("ret [%d]", ret);
        return ret;
 }
 
-EXPORT_API int emf_account_get_list(emf_account_t** account_list, int* count, int* err_code)
+INTERNAL_FUNC int emdaemon_get_account_list(emf_account_t** account_list, int* count, int* err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_list[%p], count[%p], err_code[%p]", account_list, count, err_code);
        
        int ret = false, err = EMF_ERROR_NONE, i = 0;
-       emf_mail_account_tbl_t *account_tbl_array = NULL;
+       emstorage_account_tbl_t *account_tbl_array = NULL;
        
        if (!account_list || !count)  {
                EM_DEBUG_EXCEPTION("account_list[%p], count[%p]", account_list, (*count));
@@ -362,13 +362,13 @@ EXPORT_API int emf_account_get_list(emf_account_t** account_list, int* count, in
        
        *count = 1000;
        
-       if (!em_storage_get_account_list(count, &account_tbl_array, true, true, &err))  {
-               EM_DEBUG_EXCEPTION("em_storage_get_account_list failed [%d]", err);
+       if (!emstorage_get_account_list(count, &account_tbl_array, true, true, &err))  {
+               EM_DEBUG_EXCEPTION("emstorage_get_account_list failed [%d]", err);
                goto FINISH_OFF;
        }
 
        if(account_tbl_array && (*count) > 0) {
-               *account_list = (emf_account_t*)em_core_malloc(sizeof(emf_account_t) * (*count));
+               *account_list = (emf_account_t*)em_malloc(sizeof(emf_account_t) * (*count));
                if(!*account_list) {
                        EM_DEBUG_EXCEPTION("allocation failed [%d]", err);
                        goto FINISH_OFF;
@@ -382,7 +382,7 @@ EXPORT_API int emf_account_get_list(emf_account_t** account_list, int* count, in
 
 FINISH_OFF:
        if(account_tbl_array)
-               em_storage_free_account(&account_tbl_array, (*count), NULL);
+               emstorage_free_account(&account_tbl_array, (*count), NULL);
        
        if (err_code != NULL)
                *err_code = err;
@@ -391,14 +391,14 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int emf_account_free(emf_account_t** account_list, int count, int* err_code)
+INTERNAL_FUNC int emdaemon_free_account(emf_account_t** account_list, int count, int* err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
-       return em_core_account_free(account_list, count, err_code);
+       return emcore_free_account(account_list, count, err_code);
 }
 
 
-EXPORT_API int emf_filter_get(int filter_id, emf_rule_t** filter_info, int* err_code)
+INTERNAL_FUNC int emdaemon_get_filter(int filter_id, emf_rule_t** filter_info, int* err_code)
 {
        EM_DEBUG_FUNC_BEGIN("filter_id[%d], filter_info[%p], err_code[%p]", filter_id, filter_info, err_code);
        
@@ -414,8 +414,8 @@ EXPORT_API int emf_filter_get(int filter_id, emf_rule_t** filter_info, int* err_
        int ret = false;
        int err = EMF_ERROR_NONE;
        
-       if (!em_storage_get_rule_by_id(ALL_ACCOUNT, filter_id, (emf_mail_rule_tbl_t**)filter_info, true, &err))  {
-               EM_DEBUG_EXCEPTION(" em_storage_get_rule_by_id failed [%d]", err);
+       if (!emstorage_get_rule_by_id(ALL_ACCOUNT, filter_id, (emstorage_rule_tbl_t**)filter_info, true, &err))  {
+               EM_DEBUG_EXCEPTION(" emstorage_get_rule_by_id failed [%d]", err);
                goto FINISH_OFF;
        }
        
@@ -428,7 +428,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int emf_filter_get_list(emf_rule_t** filter_info, int* count, int* err_code)
+INTERNAL_FUNC int emdaemon_get_filter_list(emf_rule_t** filter_info, int* count, int* err_code)
 {
        EM_DEBUG_FUNC_BEGIN("filter_info[%p], count[%p], err_code[%p]", filter_info, count, err_code);
        
@@ -445,8 +445,8 @@ EXPORT_API int emf_filter_get_list(emf_rule_t** filter_info, int* count, int* er
        
        *count = 1000;
        
-       if (!em_storage_get_rule(ALL_ACCOUNT, 0, 0, count, &is_completed, (emf_mail_rule_tbl_t**)filter_info, true, &err))  {
-               EM_DEBUG_EXCEPTION(" em_storage_get_rule failed [%d]", err);
+       if (!emstorage_get_rule(ALL_ACCOUNT, 0, 0, count, &is_completed, (emstorage_rule_tbl_t**)filter_info, true, &err))  {
+               EM_DEBUG_EXCEPTION(" emstorage_get_rule failed [%d]", err);
                goto FINISH_OFF;
        }
        
@@ -459,7 +459,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int emf_filter_find(emf_rule_t* filter_info, int* err_code)
+INTERNAL_FUNC int emdaemon_find_filter(emf_rule_t* filter_info, int* err_code)
 {
        EM_DEBUG_FUNC_BEGIN("filter_info[%p], err_code[%p]", filter_info, err_code);
        
@@ -481,8 +481,8 @@ EXPORT_API int emf_filter_find(emf_rule_t* filter_info, int* err_code)
 
        filter_info->account_id = ALL_ACCOUNT;          /*  MUST BE */
        
-       if (!em_storage_find_rule((emf_mail_rule_tbl_t*)filter_info, true, &err))  {
-               EM_DEBUG_EXCEPTION(" em_storage_find_rule failed [%d]", err);
+       if (!emstorage_find_rule((emstorage_rule_tbl_t*)filter_info, true, &err))  {
+               EM_DEBUG_EXCEPTION(" emstorage_find_rule failed [%d]", err);
                err = EMF_ERROR_FILTER_NOT_FOUND;
                goto FINISH_OFF;
        }
@@ -496,7 +496,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int emf_filter_add(emf_rule_t* filter_info, int* err_code)
+INTERNAL_FUNC int emdaemon_add_filter(emf_rule_t* filter_info, int* err_code)
 {
        EM_DEBUG_FUNC_BEGIN("filter_info[%p], err_code[%p]", filter_info, err_code);
        
@@ -524,19 +524,19 @@ EXPORT_API int emf_filter_add(emf_rule_t* filter_info, int* err_code)
        
        filter_info->account_id = ALL_ACCOUNT;
        
-       if (em_storage_find_rule((emf_mail_rule_tbl_t*)filter_info, true, &err))  {
-               EM_DEBUG_EXCEPTION("em_storage_find_rule failed [%d]", err);
+       if (emstorage_find_rule((emstorage_rule_tbl_t*)filter_info, true, &err))  {
+               EM_DEBUG_EXCEPTION("emstorage_find_rule failed [%d]", err);
                err = EMF_ERROR_ALREADY_EXISTS;
                goto FINISH_OFF;
        }
        
-       if (!em_storage_add_rule((emf_mail_rule_tbl_t*)filter_info, true, &err))  {
-               EM_DEBUG_EXCEPTION("em_storage_add_rule failed [%d]", err);
+       if (!emstorage_add_rule((emstorage_rule_tbl_t*)filter_info, true, &err))  {
+               EM_DEBUG_EXCEPTION("emstorage_add_rule failed [%d]", err);
                goto FINISH_OFF;
        }
 
-       if (!em_core_mail_filter_by_rule((emf_rule_t*)filter_info, &err))  {
-               EM_DEBUG_EXCEPTION("em_core_mail_filter_by_rule failed [%d]", err);
+       if (!emcore_mail_filter_by_rule((emf_rule_t*)filter_info, &err))  {
+               EM_DEBUG_EXCEPTION("emcore_mail_filter_by_rule failed [%d]", err);
                goto FINISH_OFF;
        }
 
@@ -550,7 +550,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int emf_filter_change(int filter_id, emf_rule_t* filter_info, int* err_code)
+INTERNAL_FUNC int emdaemon_update_filter(int filter_id, emf_rule_t* filter_info, int* err_code)
 {
        EM_DEBUG_FUNC_BEGIN("filter_id[%d], filter_info[%p], err_code[%p]", filter_id, filter_info, err_code);
        
@@ -564,13 +564,13 @@ EXPORT_API int emf_filter_change(int filter_id, emf_rule_t* filter_info, int* er
                goto FINISH_OFF;
        }
        
-       if (!emf_filter_check_filter_id(ALL_ACCOUNT, filter_id, &err))  {
-               EM_DEBUG_EXCEPTION("emf_filter_check_filter_id falied [%d]", err);
+       if (!emdaemon_check_filter_id(ALL_ACCOUNT, filter_id, &err))  {
+               EM_DEBUG_EXCEPTION("emdaemon_check_filter_id falied [%d]", err);
                goto FINISH_OFF;
        }
        
-       if (!em_storage_change_rule(ALL_ACCOUNT, filter_id, (emf_mail_rule_tbl_t*)filter_info, true, &err))  {
-               EM_DEBUG_EXCEPTION("em_storage_change_rule falied [%d]", err);
+       if (!emstorage_change_rule(ALL_ACCOUNT, filter_id, (emstorage_rule_tbl_t*)filter_info, true, &err))  {
+               EM_DEBUG_EXCEPTION("emstorage_change_rule falied [%d]", err);
                goto FINISH_OFF;
        }
        
@@ -583,7 +583,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int emf_filter_delete(int filter_id, int* err_code)
+INTERNAL_FUNC int emdaemon_delete_filter(int filter_id, int* err_code)
 {
        EM_DEBUG_FUNC_BEGIN("filter_id[%d, err_code[%p]", filter_id, err_code);
        
@@ -597,13 +597,13 @@ EXPORT_API int emf_filter_delete(int filter_id, int* err_code)
                goto FINISH_OFF;
        }
        
-       if (!emf_filter_check_filter_id(ALL_ACCOUNT, filter_id, &err))  {
-               EM_DEBUG_EXCEPTION(" emf_filter_check_filter_id failed [%d]", err);
+       if (!emdaemon_check_filter_id(ALL_ACCOUNT, filter_id, &err))  {
+               EM_DEBUG_EXCEPTION(" emdaemon_check_filter_id failed [%d]", err);
                goto FINISH_OFF;
        }
        
-       if (!em_storage_delete_rule(ALL_ACCOUNT, filter_id, true, &err))  {
-               EM_DEBUG_EXCEPTION(" em_storage_delete_rule failed [%d]", err);
+       if (!emstorage_delete_rule(ALL_ACCOUNT, filter_id, true, &err))  {
+               EM_DEBUG_EXCEPTION(" emstorage_delete_rule failed [%d]", err);
                goto FINISH_OFF;
        }
 
@@ -616,7 +616,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int emf_filter_free(emf_rule_t** filter_info, int count, int* err_code)
+INTERNAL_FUNC int emdaemon_free_filter(emf_rule_t** filter_info, int count, int* err_code)
 {
        EM_DEBUG_FUNC_BEGIN("filter_info[%p], count[%d], err_code[%p]", filter_info, count, err_code);
        
@@ -653,25 +653,25 @@ FINISH_OFF:
 
 
 /* ----- internal functions --------------------------------------------*/
-int emf_init_account_reference()
+int emdaemon_initialize_account_reference()
 {
        EM_DEBUG_FUNC_BEGIN();
-       return em_core_init_account_reference();
+       return emcore_init_account_reference();
 }
 
-emf_account_t* emf_get_account_reference(int account_id)
+emf_account_t* emdaemon_get_account_reference(int account_id)
 {
        EM_DEBUG_FUNC_BEGIN();
-       return em_core_get_account_reference(account_id);
+       return emcore_get_account_reference(account_id);
 }
 
-int emf_free_account_reference()
+int emdaemon_free_account_reference()
 {
        EM_DEBUG_FUNC_BEGIN();
-       return em_core_free_account_reference();
+       return emcore_free_account_reference();
 }
 
-EXPORT_API int emf_account_insert_accountinfo_to_contact(emf_account_t* account)
+INTERNAL_FUNC int emdaemon_insert_accountinfo_to_contact(emf_account_t* account)
 {
        EM_DEBUG_FUNC_BEGIN();
 
@@ -683,7 +683,7 @@ EXPORT_API int emf_account_insert_accountinfo_to_contact(emf_account_t* account)
        return ret;
 }
 
-EXPORT_API int emf_account_update_accountinfo_to_contact(emf_account_t* old_account, emf_account_t* new_account)
+INTERNAL_FUNC int emdaemon_update_accountinfo_to_contact(emf_account_t* old_account, emf_account_t* new_account)
 {
        EM_DEBUG_FUNC_BEGIN();
 
similarity index 73%
rename from email-engine/emf-auto-poll.c
rename to email-daemon/email-daemon-auto-poll.c
index 7c8eadd..0d8de32 100755 (executable)
@@ -20,7 +20,7 @@
 */
 
 
-#include "em-core-types.h"
+#include "email-internal-types.h"
 
 #ifdef __FEATURE_AUTO_POLLING__
 
 #include <stdarg.h>    /*  Needed for the definition of va_list */
 #include <glib.h>
 
-#include "emflib.h"
-
-#include "emf-auto-poll.h"
-#include "emf-types.h"
-#include "emf-dbglog.h"
-#include "em-storage.h" 
+#include "email-types.h"
+#include "email-daemon.h"
+#include "email-daemon-auto-poll.h"
+#include "email-core-utils.h"
+#include "email-debug-log.h"
+#include "email-storage.h"
+#include "email-utilities.h"
 
 typedef struct _emf_account_alarm_binder
 {
@@ -56,14 +57,14 @@ typedef struct _emf_account_alarm_binder_list_t
 
 emf_account_alarm_binder_list_t *g_account_alarm_binder_list  = NULL;
 
-static int emf_get_polling_alarm_and_timerinterval(int account_id, alarm_id_t *alarm_id, int *timer_interval);
-static int emf_get_polling_account_and_timeinterval(alarm_id_t  alarm_id, int *account_id, int *timer_interval);
-static int emf_create_alarm(int alarm_interval, alarm_id_t *p_alarm_id);
-static int  add_to_account_alarm_binder_list(emf_account_alarm_binder_list_t *p_account_alarm_binder);
-static int  remove_from_account_alarm_binder_list(int account_id);
-static int  update_account_alarm_binder_list(int account_id, alarm_id_t  alarm_id);
+static int _emdaemon_get_polling_alarm_and_timerinterval(int account_id, alarm_id_t *alarm_id, int *timer_interval);
+static int _emdaemon_get_polling_account_and_timeinterval(alarm_id_t  alarm_id, int *account_id, int *timer_interval);
+static int _emdaemon_create_alarm(int alarm_interval, alarm_id_t *p_alarm_id);
+static int _emdaemon_add_to_account_alarm_binder_list(emf_account_alarm_binder_list_t *p_account_alarm_binder);
+static int _emdaemon_remove_from_account_alarm_binder_list(int account_id);
+static int _emdaemon_update_account_alarm_binder_list(int account_id, alarm_id_t  alarm_id);
 
-EXPORT_API int emf_add_polling_alarm(int account_id, int alarm_interval)
+INTERNAL_FUNC int emdaemon_add_polling_alarm(int account_id, int alarm_interval)
 {
        EM_DEBUG_FUNC_BEGIN();
 
@@ -71,8 +72,8 @@ EXPORT_API int emf_add_polling_alarm(int account_id, int alarm_interval)
                EM_DEBUG_EXCEPTION("Invalid param");
                return false;
        }
-       EM_DEBUG_EXCEPTION(" emf_add_polling_alarm : account_id [%d]",account_id);
-       if(is_auto_polling_started(account_id)) {
+       EM_DEBUG_EXCEPTION(" emdaemon_add_polling_alarm : account_id [%d]",account_id);
+       if(emdaemon_check_auto_polling_started(account_id)) {
                EM_DEBUG_EXCEPTION("auto polling already started for account : return");
                return true;
        }
@@ -80,12 +81,12 @@ EXPORT_API int emf_add_polling_alarm(int account_id, int alarm_interval)
        alarm_id_t alarmID = 0;
        emf_account_alarm_binder_list_t *p_account_alarm_binder = NULL;
 
-       if(!emf_create_alarm(alarm_interval, &alarmID)) {
-               EM_DEBUG_EXCEPTION("emf_create_alarm failed");
+       if(!_emdaemon_create_alarm(alarm_interval, &alarmID)) {
+               EM_DEBUG_EXCEPTION("_emdaemon_create_alarm failed");
                return false;
        }
                        
-       p_account_alarm_binder = (emf_account_alarm_binder_list_t*)em_core_malloc(sizeof(emf_account_alarm_binder_list_t));
+       p_account_alarm_binder = (emf_account_alarm_binder_list_t*)em_malloc(sizeof(emf_account_alarm_binder_list_t));
        if(!p_account_alarm_binder) {
                EM_DEBUG_EXCEPTION("malloc  Failed ");
                return false;
@@ -95,15 +96,14 @@ EXPORT_API int emf_add_polling_alarm(int account_id, int alarm_interval)
        p_account_alarm_binder->account_alarm_binder.alarm_id = alarmID;
        p_account_alarm_binder->account_alarm_binder.timer_interval = alarm_interval;
        
-       add_to_account_alarm_binder_list(p_account_alarm_binder);
+       _emdaemon_add_to_account_alarm_binder_list(p_account_alarm_binder);
 
        return  true;   
 }
 
 
-EXPORT_API int emf_remove_polling_alarm(int account_id)
+INTERNAL_FUNC int emdaemon_remove_polling_alarm(int account_id)
 {
-       
        EM_DEBUG_FUNC_BEGIN();
 
        if(!account_id) {
@@ -114,8 +114,8 @@ EXPORT_API int emf_remove_polling_alarm(int account_id)
        alarm_id_t  alarm_id = 0;
        int a_nErrorCode = 0, retval =0;
 
-       if(!emf_get_polling_alarm_and_timerinterval(account_id,&alarm_id,NULL)) {
-               EM_DEBUG_EXCEPTION("emf_get_polling_alarm_and_timerinterval failed");
+       if(!_emdaemon_get_polling_alarm_and_timerinterval(account_id,&alarm_id,NULL)) {
+               EM_DEBUG_EXCEPTION("_emdaemon_get_polling_alarm_and_timerinterval failed");
                return false;
        }
 
@@ -130,15 +130,15 @@ EXPORT_API int emf_remove_polling_alarm(int account_id)
        }
 
        /* delete from list */
-       if(!remove_from_account_alarm_binder_list(account_id)) {
-               EM_DEBUG_EXCEPTION("remove_from_account_alarm_binder_list  failed");
+       if(!_emdaemon_remove_from_account_alarm_binder_list(account_id)) {
+               EM_DEBUG_EXCEPTION("_emdaemon_remove_from_account_alarm_binder_list  failed");
                return false;
        }
 
        return true;
 }
 
-EXPORT_API int is_auto_polling_started(int account_id)
+INTERNAL_FUNC int emdaemon_check_auto_polling_started(int account_id)
 {
        EM_DEBUG_FUNC_BEGIN();
 
@@ -165,7 +165,7 @@ EXPORT_API int is_auto_polling_started(int account_id)
        }
        return true;
 }
-EXPORT_API int emf_alarm_polling_cb(alarm_id_t  alarm_id, void* user_param)
+INTERNAL_FUNC int emdaemon_alarm_polling_cb(alarm_id_t  alarm_id, void* user_param)
 {
        EM_DEBUG_FUNC_BEGIN();
 
@@ -184,38 +184,38 @@ EXPORT_API int emf_alarm_polling_cb(alarm_id_t  alarm_id, void* user_param)
        int account_id = 0, err = EMF_ERROR_NONE, timer_interval =0, alarmID =0,ret = false;
        char* mailbox_name = NULL;
 
-       if(!emf_get_polling_account_and_timeinterval(alarm_id,&account_id,&timer_interval)) {
+       if(!_emdaemon_get_polling_account_and_timeinterval(alarm_id,&account_id,&timer_interval)) {
                EM_DEBUG_EXCEPTION("emf_get_polling_account failed");
                return false;
        }
 
-       EM_DEBUG_EXCEPTION(" emf_alarm_polling_cb : account_id [%d]",account_id);
+       EM_DEBUG_EXCEPTION(" emdaemon_alarm_polling_cb : account_id [%d]",account_id);
        /* create alarm, for polling */ 
-       if(!emf_create_alarm(timer_interval,&alarmID)) {
-               EM_DEBUG_EXCEPTION("emf_create_alarm failed");
+       if(!_emdaemon_create_alarm(timer_interval,&alarmID)) {
+               EM_DEBUG_EXCEPTION("_emdaemon_create_alarm failed");
                return false;
        }
 
        /*update alarm ID in list */
        /* delete from list */
-       if(!update_account_alarm_binder_list(account_id,alarmID)) {
-               EM_DEBUG_EXCEPTION("update_account_alarm_binder_list  failed");
+       if(!_emdaemon_update_account_alarm_binder_list(account_id,alarmID)) {
+               EM_DEBUG_EXCEPTION("_emdaemon_update_account_alarm_binder_list  failed");
                return false;
        }
 
        memset(&mailbox, 0x00, sizeof(emf_mailbox_t));
        mailbox.account_id = account_id;
 
-               if (!em_storage_get_mailboxname_by_mailbox_type(mailbox.account_id,EMF_MAILBOX_TYPE_INBOX,&mailbox_name, false, &err))  {
-                       EM_DEBUG_EXCEPTION("em_storage_get_mailboxname_by_mailbox_type failed [%d]", err);
+               if (!emstorage_get_mailboxname_by_mailbox_type(mailbox.account_id,EMF_MAILBOX_TYPE_INBOX,&mailbox_name, false, &err))  {
+                       EM_DEBUG_EXCEPTION("emstorage_get_mailboxname_by_mailbox_type failed [%d]", err);
                                                
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
+       
                        goto FINISH_OFF;
                }
                mailbox.name = mailbox_name;
 
-       if (!emf_mailbox_sync_header(&mailbox, NULL, &err))  {
-               EM_DEBUG_EXCEPTION("emf_mailbox_sync_header falied [%d]", err);         
+       if (!emdaemon_sync_header(&mailbox, NULL, &err))  {
+               EM_DEBUG_EXCEPTION("emdaemon_sync_header falied [%d]", err);            
                goto FINISH_OFF;
        }
 
@@ -226,7 +226,7 @@ FINISH_OFF :
        return ret;
 }
 
-static int emf_get_polling_alarm_and_timerinterval(int account_id, alarm_id_t *alarm_id, int *timer_interval)
+static int _emdaemon_get_polling_alarm_and_timerinterval(int account_id, alarm_id_t *alarm_id, int *timer_interval)
 {
        EM_DEBUG_FUNC_BEGIN();
 
@@ -265,7 +265,7 @@ static int emf_get_polling_alarm_and_timerinterval(int account_id, alarm_id_t *a
        return true;
 }
 
-static int emf_get_polling_account_and_timeinterval(alarm_id_t  alarm_id, int *account_id, int *timer_interval)
+static int _emdaemon_get_polling_account_and_timeinterval(alarm_id_t  alarm_id, int *account_id, int *timer_interval)
 {
        EM_DEBUG_FUNC_BEGIN();
 
@@ -303,8 +303,8 @@ static int emf_get_polling_account_and_timeinterval(alarm_id_t  alarm_id, int *a
        return true;
 }
 
-#define AUTO_POLL_DESTINATION  "email-service"
-static int emf_create_alarm(int alarm_interval, alarm_id_t *p_alarm_id)
+#define AUTO_POLL_DESTINATION  "com.samsung.email-service"
+static int _emdaemon_create_alarm(int alarm_interval, alarm_id_t *p_alarm_id)
 {
        EM_DEBUG_FUNC_BEGIN();
 
@@ -343,7 +343,7 @@ static int emf_create_alarm(int alarm_interval, alarm_id_t *p_alarm_id)
        if(!retval)
                return false;
        
-       a_nErrorCode = alarmmgr_set_cb(emf_alarm_polling_cb, NULL);
+       a_nErrorCode = alarmmgr_set_cb(emdaemon_alarm_polling_cb, NULL);
        EM_DEBUG_LOG("ErrorCode :%d, Return Value:%d ",a_nErrorCode,retval);
 
        if(!retval)
@@ -359,7 +359,7 @@ static int emf_create_alarm(int alarm_interval, alarm_id_t *p_alarm_id)
        return true;
 }
 
-EXPORT_API int emf_free_account_alarm_binder_list()
+INTERNAL_FUNC int emdaemon_free_account_alarm_binder_list()
 {
        EM_DEBUG_FUNC_BEGIN();
 
@@ -383,7 +383,7 @@ EXPORT_API int emf_free_account_alarm_binder_list()
        return true;
 }
 
-static int  add_to_account_alarm_binder_list(emf_account_alarm_binder_list_t *p_account_alarm_binder)
+static int  _emdaemon_add_to_account_alarm_binder_list(emf_account_alarm_binder_list_t *p_account_alarm_binder)
 {
        emf_account_alarm_binder_list_t  *p_temp = NULL;
 
@@ -408,7 +408,7 @@ static int  add_to_account_alarm_binder_list(emf_account_alarm_binder_list_t *p_
        return true;
 }
 
-static int  remove_from_account_alarm_binder_list(int account_id)
+static int  _emdaemon_remove_from_account_alarm_binder_list(int account_id)
 {
        emf_account_alarm_binder_list_t  *p_temp = g_account_alarm_binder_list,  *p_prev = NULL;
        int match_found = false;
@@ -448,7 +448,7 @@ static int  remove_from_account_alarm_binder_list(int account_id)
        return true;
 }
 
-static int  update_account_alarm_binder_list(int account_id, alarm_id_t  alarm_id)
+static int  _emdaemon_update_account_alarm_binder_list(int account_id, alarm_id_t  alarm_id)
 {
        emf_account_alarm_binder_list_t  *p_temp = g_account_alarm_binder_list;
        int match_found = false;
similarity index 89%
rename from email-engine/emf-emn.c
rename to email-daemon/email-daemon-emn.c
index 25ec298..940ad51 100755 (executable)
 #include <stdarg.h>    /*  Needed for the definition of va_list */
 #include <glib.h>
 
-#include "emflib.h"
-
-/* #include "emf-emn-storage.h" */
-#include "emf-emn.h"
+#include "email-daemon.h"
+#include "email-daemon-emn.h"
 
 /* --------------------------------------------------------------------------------*/
-/* ----- WBXML Parsing (2007.06.09) --------------------------------------------------*/
+/* ----- WBXML Parsing (2007.06.09) -----------------------------------------------*/
 /* --------------------------------------------------------------------------------*/
 #ifdef USE_OMA_EMN
 
 #include <wbxml.h>
 #include <wbxml_errors.h>
-#include "emf-dbglog.h"
+#include "email-debug-log.h"
 #include <vconf.h>
-#include "emf-global.h"
 
 typedef struct
 {
        int account_id;
        emf_emn_noti_cb callback;
        void* user_data;
-} 
-emf_emn_noti_pack_t;
+} emf_emn_noti_pack_t;
 
 
-char*
-__emn_get_username(char *account_username);
-static void 
-_cb_parser_start_document(void* ctx, WB_LONG charset, const WBXMLLangEntry* lang)
+/* Parse the Email address to Get the user Name for the account [deepam.p@samsung.com] */
+static char* _get_username(char *account_username)
+{
+       EM_IF_NULL_RETURN_VALUE(account_username, NULL);
+
+       int index = 0;
+       char **token_list = NULL;
+       char *username = NULL, *name = NULL;
+
+       username = g_strdup(account_username);
+       token_list = g_strsplit_set(username, "@", -1);
+
+       if (username) {
+               g_free(username);
+       }
+
+       if (token_list[index] != NULL)
+    {
+               name = g_strdup(token_list[index]);
+               g_strfreev(token_list); /*  MUST BE. */
+               EM_DEBUG_LOG("ACCOUNT USER NAME [%s] \n", name);
+               return name;
+       }
+       else
+               return NULL;
+}
+
+static void _cb_parser_start_document(void* ctx, WB_LONG charset, const WBXMLLangEntry* lang)
 {
     EM_DEBUG_LOG("_cb_parser_start_document\n");
     EM_DEBUG_LOG("Parsing Document:\n\tRoot Element: %s\n\tPublic ID: %s\n\tDTD: %s\n",
@@ -64,14 +84,12 @@ _cb_parser_start_document(void* ctx, WB_LONG charset, const WBXMLLangEntry* lang
                  lang->publicID->xmlDTD);
 }
 
-static void 
-_cb_parser_end_document(void* ctx)
+static void _cb_parser_end_document(void* ctx)
 {
     EM_DEBUG_LOG("_cb_parser_end_document\n");
 }
 
-static void 
-_cb_parser_start_element(void* ctx, WBXMLTag* element, WBXMLAttribute** atts, WB_BOOL empty)
+static void _cb_parser_start_element(void* ctx, WBXMLTag* element, WBXMLAttribute** atts, WB_BOOL empty)
 {
     WB_UTINY* p, **pp = ctx;
     WB_ULONG j = 0, len = 0;
@@ -132,14 +150,12 @@ _cb_parser_start_element(void* ctx, WBXMLTag* element, WBXMLAttribute** atts, WB
     *pp = p;
 }
 
-static void 
-_cb_parser_end_element(void* ctx, WBXMLTag* element, WB_BOOL empty)
+static void _cb_parser_end_element(void* ctx, WBXMLTag* element, WB_BOOL empty)
 {
     EM_DEBUG_LOG("parse_clb_end_element\n");
 }
 
-static void 
-_cb_parser_characters(void* ctx, WB_UTINY* ch, WB_ULONG start, WB_ULONG length)
+static void _cb_parser_characters(void* ctx, WB_UTINY* ch, WB_ULONG start, WB_ULONG length)
 {
     EM_DEBUG_LOG("_cb_parser_characters\n");
 }
@@ -265,8 +281,7 @@ static int _get_addr_from_element(unsigned char* elm,
     return 1;
 }
 
-static int     
-_get_time_from_element(unsigned char* elm,
+static int _get_time_from_element(unsigned char* elm,
                           unsigned char** time_stamp)
 {
     EM_DEBUG_FUNC_BEGIN();
@@ -329,35 +344,7 @@ static int _get_data_from_element(unsigned char* elm,
     return 1;
 }
 
-/* Parse the Email address to Get the user Name for the account [deepam.p@samsung.com] */
-char*
-__emn_get_username(char *account_username)
-{
 
-       EM_IF_NULL_RETURN_VALUE(account_username, NULL);
-
-       int index = 0;
-       char **token_list = NULL;
-       char *username = NULL, *name = NULL;
-
-       username = g_strdup(account_username);
-       token_list = g_strsplit_set(username, "@", -1);
-
-       if (username) {
-               g_free(username);
-       }
-
-       if (token_list[index] != NULL)
-    {
-               name = g_strdup(token_list[index]);
-               g_strfreev(token_list); /*  MUST BE. */
-               EM_DEBUG_LOG("ACCOUNT USER NAME [%s] \n", name);
-               return name;
-       }
-       else
-               return NULL;
-       
-}
 
 /* description
  *    get account from OMA EMN data
@@ -370,8 +357,7 @@ __emn_get_username(char *account_username)
  *    succeed : 1
  *    fail : 0
  */
-static int
-_get_emn_account(unsigned char* wbxml_b64, emf_account_t* account, char** mailbox, int* err_code)
+static int _get_emn_account(unsigned char* wbxml_b64, emf_account_t* account, char** mailbox, int* err_code)
 {
        EM_DEBUG_LOG("_get_emn_account Enter");
     WBXMLContentHandler parse_handler = {
@@ -467,9 +453,9 @@ _get_emn_account(unsigned char* wbxml_b64, emf_account_t* account, char** mailbo
     EM_DEBUG_LOG("auth_type = [%s]\n", (char *)auth_type ? (char*)auth_type : "NIL");
     EM_DEBUG_LOG("time_stamp= [%s]\n", (char *)time_stamp? (char*)time_stamp: "NIL");
 
-     if (!emf_account_get_list(&accounts, &count, &err))
+     if (!emdaemon_get_account_list(&accounts, &count, &err))
     {
-        EM_DEBUG_EXCEPTION("   emf_account_get_list error");
+        EM_DEBUG_EXCEPTION("   emdaemon_get_account_list error");
         err = EMF_ERROR_DB_FAILURE;
         goto FINISH_OFF;
     }
@@ -519,7 +505,7 @@ _get_emn_account(unsigned char* wbxml_b64, emf_account_t* account, char** mailbo
         *mailbox = mbox_name ? (char *)mbox_name : NULL;
         mbox_name = NULL;
     }
-    emf_account_free(&accounts, count, NULL);
+    emdaemon_free_account(&accounts, count, NULL);
     accounts = NULL;
 
     retr = true;
@@ -528,7 +514,7 @@ FINISH_OFF:
     if (wbxml) wbxml_free(wbxml);
     if (wbxml_parser) wbxml_parser_destroy(wbxml_parser);
     EM_SAFE_FREE(elm);
-    if (accounts) emf_account_free(&accounts, count, NULL);
+    if (accounts) emdaemon_free_account(&accounts, count, NULL);
     EM_SAFE_FREE(user_name);
     EM_SAFE_FREE(mbox_name);
     EM_SAFE_FREE(auth_type);
@@ -537,7 +523,7 @@ FINISH_OFF:
     return retr;
 }
 
-EXPORT_API int emf_emn_handler(unsigned char* wbxml_b64, emf_emn_noti_cb callback, int* err_code)
+INTERNAL_FUNC int emdaemon_handle_emn_notification(unsigned char* wbxml_b64, emf_emn_noti_cb callback, int* err_code)
 {
        EM_DEBUG_FUNC_BEGIN("wbxml_b64[%p], callback[%p], err_code[%p]", wbxml_b64, callback, err_code);
        
@@ -555,9 +541,9 @@ EXPORT_API int emf_emn_handler(unsigned char* wbxml_b64, emf_emn_noti_cb callbac
                goto FINISH_OFF;
        }
        
-       pack = (emf_emn_noti_pack_t*)em_core_malloc(sizeof(emf_emn_noti_pack_t));
+       pack = (emf_emn_noti_pack_t*)em_malloc(sizeof(emf_emn_noti_pack_t));
        if (!pack) {
-               EM_DEBUG_EXCEPTION("em_core_malloc failed");
+               EM_DEBUG_EXCEPTION("em_malloc failed");
                err = EMF_ERROR_OUT_OF_MEMORY;
                goto FINISH_OFF;
        }
@@ -569,9 +555,9 @@ EXPORT_API int emf_emn_handler(unsigned char* wbxml_b64, emf_emn_noti_cb callbac
 
        mailbox.account_id = account.account_id;
 
-       if (!em_storage_get_mailboxname_by_mailbox_type(mailbox.account_id,EMF_MAILBOX_TYPE_INBOX,&pmailbox, false, &err))  {
-               EM_DEBUG_EXCEPTION("em_storage_get_mailboxname_by_mailbox_type failed [%d", err);               
-               err = em_storage_get_emf_error_from_em_storage_error(err);
+       if (!emstorage_get_mailboxname_by_mailbox_type(mailbox.account_id,EMF_MAILBOX_TYPE_INBOX,&pmailbox, false, &err))  {
+               EM_DEBUG_EXCEPTION("emstorage_get_mailboxname_by_mailbox_type failed [%d", err);                
+
                goto FINISH_OFF;
        }
 
@@ -587,8 +573,8 @@ EXPORT_API int emf_emn_handler(unsigned char* wbxml_b64, emf_emn_noti_cb callbac
        /* sync header with mail server */
        mailbox.name = mailbox_tbl->mailbox_name;
        
-       if (!emf_mailbox_sync_header(&mailbox, NULL, &err))  {
-               EM_DEBUG_EXCEPTION("emf_mailbox_sync_header falied [%d]", err);
+       if (!emdaemon_sync_header(&mailbox, NULL, &err))  {
+               EM_DEBUG_EXCEPTION("emdaemon_sync_header falied [%d]", err);
                goto FINISH_OFF;
        }
        
@@ -606,6 +592,22 @@ FINISH_OFF:
        return ret;
 }
 
+int emdaemon_initialize_emn(void)
+{
+       EM_DEBUG_FUNC_BEGIN();
+
+       /* TODO : Write codes for subscribing OMA-EMN notification */
+
+       EM_DEBUG_FUNC_END();
+       return 0;
+}
+
+int emdaemon_finalize_emn(gboolean bExtDest)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       EM_DEBUG_FUNC_END();
+       return 0;
+}
 
 #endif /*  USE_OMA_EMN */
 
diff --git a/email-daemon/email-daemon-etc.c b/email-daemon/email-daemon-etc.c
new file mode 100755 (executable)
index 0000000..351dfc8
--- /dev/null
@@ -0,0 +1,264 @@
+/*
+*  email-service
+*
+* Copyright (c) 2000 - 2011 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.
+*
+*/
+
+
+
+/******************************************************************************
+ * File: emf-etc.c
+ * Desc: email-daemon Etc Implementations
+ *
+ * Auth:
+ *
+ * History:
+ *    2006.08.16 : created
+ *****************************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <vconf.h>
+#include "email-daemon.h"
+#include "email-daemon-account.h"
+#include "email-debug-log.h"
+#include "email-internal-types.h"
+#include "email-core-event.h"
+#include "email-core-utils.h"
+#include "email-storage.h"
+
+
+int emdaemon_register_event_callback(emf_action_t action, emf_event_callback callback, void* event_data)
+{
+       return emcore_register_event_callback(action, callback, event_data);
+}
+
+int emdaemon_unregister_event_callback(emf_action_t action, emf_event_callback callback)
+{
+       return emcore_unregister_event_callback(action, callback);
+}
+
+INTERNAL_FUNC void emdaemon_get_event_queue_status(int* on_sending, int* on_receiving)
+{
+       emcore_get_event_queue_status(on_sending, on_receiving);
+}
+
+INTERNAL_FUNC int emdaemon_get_pending_job(emf_action_t action, int account_id, int mail_id, emf_event_status_type_t* status)
+{
+       EM_DEBUG_FUNC_BEGIN("action[%d], account_id[%d], mail_id[%d]", action, account_id, mail_id);
+
+       return emcore_get_pending_event(action, account_id, mail_id, status);
+}
+
+INTERNAL_FUNC int emdaemon_cancel_job(int account_id, int handle, int* err_code)
+{
+       EM_DEBUG_FUNC_BEGIN("account_id[%d], handle[%d], err_code[%p]", account_id, handle, err_code);
+       
+       int ret = false;
+       int err = EMF_ERROR_NONE;
+       
+       
+       if (!emcore_cancel_thread(handle, NULL, &err))  {
+               EM_DEBUG_EXCEPTION("emcore_cancel_thread failed [%d]", err);
+               goto FINISH_OFF;
+       }
+       
+       ret = true;
+       
+FINISH_OFF:
+       if (err_code != NULL)
+               *err_code = err;
+       EM_DEBUG_FUNC_END();
+       return ret;
+}
+
+
+INTERNAL_FUNC int emdaemon_cancel_sending_mail_job(int account_id, int mail_id, int* err_code)
+{
+       EM_DEBUG_FUNC_BEGIN("account_id[%d], mail_id[%d], err_code[%p]", account_id, mail_id, err_code);
+       
+       int ret = false;
+       int err = EMF_ERROR_NONE;       
+       int handle = 0;
+       emf_account_t* ref_account = NULL;
+       
+       if (account_id <= 0)  {
+               EM_DEBUG_EXCEPTION("account_id[%d], mail_id[%d]", account_id, mail_id);
+               err = EMF_ERROR_INVALID_PARAM;
+               goto FINISH_OFF;
+       }
+
+#ifdef __FEATURE_PROGRESS_IN_OUTBOX__
+
+       /*      h.gahlaut@samsung.com: Moved this code from email_cancel_send_mail API to email-service engine
+               since this code has update DB operation which is failing in context of email application process 
+               with an sqlite error -> sqlite3_step fail:8 */
+               
+       /*      which means #define SQLITE_READONLY   8 */  /* Attempt to write a readonly database */ 
+       emstorage_mail_tbl_t *mail_tbl_data = NULL;
+
+       if (!emstorage_get_mail_by_id(mail_id, &mail_tbl_data, false, &err))  {
+               EM_DEBUG_EXCEPTION("emcore_get_mail failed [%d]", err);
+               goto FINISH_OFF;
+       }
+
+       if (mail_tbl_data) {
+               if (mail_tbl_data->save_status == EMF_MAIL_STATUS_SEND_CANCELED) {
+                       EM_DEBUG_EXCEPTION(">>>> EMF_MAIL_STATUS_SEND_CANCELED Already set for Mail ID [ %d ]", mail_id);
+                       goto FINISH_OFF;
+               }
+               else {                  
+                       mail_tbl_data->save_status = EMF_MAIL_STATUS_SEND_CANCELED;
+
+                       if(!emstorage_set_field_of_mails_with_integer_value(mail_tbl_data->account_id, &mail_id, 1, "save_status", EMF_MAIL_STATUS_SEND_CANCELED, true, &err)) {
+                               EM_DEBUG_EXCEPTION("emstorage_set_field_of_mails_with_integer_value failed [%d]",err);
+                               goto FINISH_OFF;
+                       }
+               }
+       }
+
+#endif
+
+       if(!emcore_get_handle_by_mailId_from_transaction_info(mail_id , &handle )) {
+               EM_DEBUG_EXCEPTION("emcore_get_handle_by_mailId_from_transaction_info failed for mail_id[%d]", mail_id);
+               err = EMF_ERROR_HANDLE_NOT_FOUND;
+               goto FINISH_OFF;
+       }
+
+       if (!(ref_account = emdaemon_get_account_reference(account_id)))  {
+               EM_DEBUG_EXCEPTION("emdaemon_get_account_reference failed [%d]", account_id);
+               err = EMF_ERROR_INVALID_ACCOUNT;
+               goto FINISH_OFF;
+       }
+
+       switch (ref_account->account_bind_type)  {
+               case EMF_BIND_TYPE_EM_CORE :
+                       if (!emcore_cancel_send_mail_thread(handle, NULL, &err))  {
+                               EM_DEBUG_EXCEPTION("emcore_cancel_send_mail_thread failed [%d]", err);
+                               goto FINISH_OFF;
+                       }
+                       break;
+
+               default:
+                       EM_DEBUG_EXCEPTION("unknown account bind type...");
+                       err = EMF_ERROR_INVALID_ACCOUNT;
+                       goto FINISH_OFF;
+       }       
+       
+       if(!emcore_delete_transaction_info_by_mailId(mail_id))
+               EM_DEBUG_EXCEPTION("emcore_delete_transaction_info_by_mailId failed for mail_id[%d]", mail_id);
+       
+       ret = true;
+       
+FINISH_OFF:
+       if(err_code != NULL)
+               *err_code = err;
+       
+#ifdef __FEATURE_PROGRESS_IN_OUTBOX__
+       if(!emstorage_free_mail(&mail_tbl_data, 1, &err))
+               EM_DEBUG_EXCEPTION("emcore_free_mail Failed [%d ]", err);       
+
+#endif
+       EM_DEBUG_FUNC_END();
+       return ret;
+}      
+
+INTERNAL_FUNC int emdaemon_search_mail_on_server(int input_account_id, const char *input_mailbox_name, email_search_filter_t *input_search_filter, int input_search_filter_count, unsigned int *output_handle)
+{
+       EM_DEBUG_FUNC_BEGIN("input_account_id [%d], input_mailbox_name [%p], input_search_filter [%p], input_search_filter_count [%d], output_handle [%p]", input_account_id, input_mailbox_name, input_search_filter, input_search_filter_count, output_handle);
+       int error = EMF_ERROR_NONE;
+       int i = 0;
+
+       for(i = 0; i < input_search_filter_count; i++) {
+               EM_DEBUG_LOG("search_filter_type [%d]", input_search_filter->search_filter_type);
+
+               switch(input_search_filter->search_filter_type) {
+                       case EMAIL_SEARCH_FILTER_TYPE_MESSAGE_NO       :
+                       case EMAIL_SEARCH_FILTER_TYPE_UID              :
+                       case EMAIL_SEARCH_FILTER_TYPE_SIZE_LARSER      :
+                       case EMAIL_SEARCH_FILTER_TYPE_SIZE_SMALLER     :
+                       case EMAIL_SEARCH_FILTER_TYPE_FLAGS_ANSWERED   :
+                       case EMAIL_SEARCH_FILTER_TYPE_FLAGS_DELETED    :
+                       case EMAIL_SEARCH_FILTER_TYPE_FLAGS_DRAFT      :
+                       case EMAIL_SEARCH_FILTER_TYPE_FLAGS_FLAGED     :
+                       case EMAIL_SEARCH_FILTER_TYPE_FLAGS_RECENT     :
+                       case EMAIL_SEARCH_FILTER_TYPE_FLAGS_SEEN       :
+                               EM_DEBUG_LOG("integer_type_key_value [%d]", input_search_filter->search_filter_key_value.integer_type_key_value);
+                               break;
+
+                       case EMAIL_SEARCH_FILTER_TYPE_BCC              :
+                       case EMAIL_SEARCH_FILTER_TYPE_CC               :
+                       case EMAIL_SEARCH_FILTER_TYPE_FROM             :
+                       case EMAIL_SEARCH_FILTER_TYPE_KEYWORD          :
+                       case EMAIL_SEARCH_FILTER_TYPE_SUBJECT          :
+                       case EMAIL_SEARCH_FILTER_TYPE_TO               :
+                       case EMAIL_SEARCH_FILTER_TYPE_MESSAGE_ID       :
+                               EM_DEBUG_LOG("string_type_key_value [%s]", input_search_filter->search_filter_key_value.string_type_key_value);
+                               break;
+
+                       case EMAIL_SEARCH_FILTER_TYPE_SENT_DATE_BEFORE :
+                       case EMAIL_SEARCH_FILTER_TYPE_SENT_DATE_ON     :
+                       case EMAIL_SEARCH_FILTER_TYPE_SENT_DATE_SINCE  :
+                               /* EM_DEBUG_LOG("time_type_key_value [%d]", input_search_filter->search_filter_key_value.time_type_key_value.); */
+                               break;
+                       default :
+                               EM_DEBUG_LOG("not proper search_filter_type [%d]", input_search_filter->search_filter_type);
+                               return FALSE;
+               }
+       }
+
+
+       EM_DEBUG_FUNC_END("error [%d]", error);
+       return error;
+}
+
+INTERNAL_FUNC int emdaemon_clear_all_mail_data(int* err_code)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       
+       int ret = false;
+       int error = EMF_ERROR_NONE;
+       
+       if (emdaemon_initialize(&error)) {
+               if (!emstorage_clear_mail_data(true, &error))
+                       EM_DEBUG_EXCEPTION("emstorage_clear_mail_data failed [%d]", error);
+       }
+       else {
+               EM_DEBUG_EXCEPTION("emdaemon_initialize failed [%d]", error);
+               if (err_code)
+                       *err_code = error;
+               return false;
+       }
+
+       emcore_check_unread_mail();
+
+       ret = true;
+
+       if (!emstorage_create_table(EMF_CREATE_DB_NORMAL, &error)) 
+               EM_DEBUG_EXCEPTION("emstorage_create_table failed [%d]", error);
+       
+       emdaemon_finalize(&error);
+       
+       if (err_code)
+               *err_code = error;
+       EM_DEBUG_FUNC_END();
+    return ret;
+}
+
+       
+/* --------------------------------------------------------------------------------*/
diff --git a/email-daemon/email-daemon-init.c b/email-daemon/email-daemon-init.c
new file mode 100755 (executable)
index 0000000..f75ef47
--- /dev/null
@@ -0,0 +1,245 @@
+/*
+*  email-service
+*
+* Copyright (c) 2000 - 2011 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.
+*
+*/
+
+
+
+/******************************************************************************
+ * File: email-daemon-init.c
+ * Desc: email-daemon Initialization
+ *
+ * Auth:
+ *
+ * History:
+ *    2006.08.16 : created
+ *****************************************************************************/
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <glib.h>
+#include <glib-object.h>
+#include <vconf.h>
+#include <dbus/dbus.h>
+#include <dlfcn.h>           /* added for Disabling the Pthread flag log */
+
+#include "email-daemon.h"
+#include "email-storage.h"
+#include "email-debug-log.h"
+#include "email-daemon-account.h"
+#include "email-daemon-auto-poll.h"   
+#include "email-core-utils.h"
+#include "email-core-mail.h"
+#include "email-core-event.h" 
+#include "email-core-account.h"    
+#include "email-core-mailbox.h"    
+#include "email-core-api.h"    
+#include "email-core-global.h"
+#include "email-storage.h"   
+#include "email-core-sound.h" 
+
+extern int g_client_count ;
+
+/*  static functions */
+static int _emdaemon_load_email_core()
+{
+       EM_DEBUG_FUNC_BEGIN();
+
+       int err = EMF_ERROR_NONE;
+
+       /* initialize mail core */
+       if (!emcore_init(&err))
+               goto FINISH_OFF;
+
+       if (emcore_start_event_loop(&err) < 0)
+               goto FINISH_OFF;
+
+       if (emcore_send_event_loop_start(&err) < 0)
+               goto FINISH_OFF;
+
+#ifdef __FEATURE_PARTIAL_BODY_DOWNLOAD__
+       if (emcore_partial_body_thread_loop_start(&err) < 0) {
+               EM_DEBUG_EXCEPTION("emcore_partial_body_thread_loop_start failed [%d]",err);
+               goto FINISH_OFF;
+       }
+#endif
+       if (emcore_start_alert_thread(&err) < 0)
+               goto FINISH_OFF;
+
+FINISH_OFF:
+
+       return err;
+}
+
+static int _emdaemon_unload_email_core()
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int err = EMF_ERROR_NONE;
+
+       /* finish event loop */
+       emcore_stop_event_loop(&err);
+
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+}
+
+INTERNAL_FUNC int emdaemon_initialize(int* err_code)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       
+       /*  default variable */
+       int ret = false;
+       int err = EMF_ERROR_NONE;
+       
+       if (g_client_count > 0)  {
+               EM_DEBUG_LOG("Initialization was already done. increased counter=[%d]", g_client_count);
+               g_client_count++;
+               return true;
+       }
+       else 
+               EM_DEBUG_LOG("************* start email service build time [%s %s] ************* ", __DATE__, __TIME__);
+
+       dbus_threads_init_default();
+       
+       g_type_init();
+
+       emstorage_shm_file_init(SHM_FILE_FOR_DB_LOCK);
+
+#ifdef __FEATURE_USE_SHARED_MUTEX_FOR_GENERATING_MAIL_ID__
+       emstorage_shm_file_init(SHM_FILE_FOR_MAIL_ID_LOCK);
+#endif /* __FEATURE_USE_SHARED_MUTEX_FOR_GENERATING_MAIL_ID__ */
+
+       /* open database */
+       if (!emstorage_open(&err))  {
+               EM_DEBUG_EXCEPTION("emstorage_open failed [%d]", err);
+               goto FINISH_OFF;
+       }
+
+       if (!emstorage_clean_save_status(EMF_MAIL_STATUS_SAVED, &err))
+               EM_DEBUG_EXCEPTION("emstorage_check_mail_status Failed [%d]", err );
+       
+       g_client_count = 0;    
+       
+       if (!emdaemon_initialize_account_reference())  {
+               EM_DEBUG_EXCEPTION("emdaemon_initialize_account_reference fail...");
+               err = EMF_ERROR_DB_FAILURE;
+               goto FINISH_OFF;
+       }
+    EM_DEBUG_LOG("emdaemon_initialize_account_reference over - g_client_count [%d]", g_client_count);  
+       
+       if ((err = _emdaemon_load_email_core()) != EMF_ERROR_NONE)  {
+               EM_DEBUG_EXCEPTION("_emdaemon_load_email_core failed [%d]", err);
+               goto FINISH_OFF;
+       }
+
+       emcore_check_unread_mail(); 
+       
+       ret = true;
+       
+FINISH_OFF:
+       if (ret == true)
+               g_client_count = 1;
+
+       if (err_code)
+               *err_code = err;
+       
+       EM_DEBUG_FUNC_END("ret [%d], g_client_count [%d]", ret, g_client_count);
+       return ret;
+}
+
+INTERNAL_FUNC int emdaemon_finalize(int* err_code)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       
+       /*  default variable */
+       int ret = false;
+       int err = EMF_ERROR_NONE;
+       
+       if (g_client_count > 1) {
+               EM_DEBUG_EXCEPTION("engine is still used by application. decreased counter=[%d]", g_client_count);
+               g_client_count--;
+               err = EMF_ERROR_CLOSE_FAILURE;
+               goto FINISH_OFF;
+       }
+       
+       if ( (err = _emdaemon_unload_email_core()) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("_emdaemon_unload_email_core failed [%d]", err);
+               goto FINISH_OFF;
+       }
+       
+       /* free account reference list */
+       emdaemon_free_account_reference();
+       
+       /* close database */
+       if (!emstorage_close(&err)) {
+               EM_DEBUG_EXCEPTION("emstorage_close failed [%d]", err);
+               goto FINISH_OFF;
+       }
+       
+       g_client_count = 0;
+       
+#ifdef __FEATURE_AUTO_POLLING__
+       emdaemon_free_account_alarm_binder_list();
+#endif
+
+       ret = true;
+       
+FINISH_OFF:
+       if (err_code)
+               *err_code = err;
+       
+       return ret;
+}
+
+#ifdef __FEATURE_AUTO_POLLING__
+INTERNAL_FUNC int emdaemon_start_auto_polling(int* err_code)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       
+       /*  default variable */
+       int ret = false, count = 0, i= 0;
+       int err = EMF_ERROR_NONE;
+       emstorage_account_tbl_t* account_list = NULL;
+
+       /* get account list */
+       if (!emstorage_get_account_list(&count, &account_list, false, false, &err))  {
+               EM_DEBUG_EXCEPTION("emstorage_get_account_list failed [%d]", err);              
+               goto FINISH_OFF;
+       }
+
+       for (i = 0; i < count; i++)  {
+               /* start auto polling, if check_interval not zero */
+               if(account_list[i].check_interval > 0) {
+                       if(!emdaemon_add_polling_alarm( account_list[i].account_id,account_list[i].check_interval))
+                               EM_DEBUG_EXCEPTION("emdaemon_add_polling_alarm failed");
+               }
+       }
+
+       ret = true;
+FINISH_OFF:  
+       if (account_list)
+               emstorage_free_account(&account_list, count, NULL);
+       
+       if (err_code != NULL)
+               *err_code = err;
+       
+       return ret;
+}
+#endif /* __FEATURE_AUTO_POLLING__ */
+
diff --git a/email-daemon/email-daemon-mail.c b/email-daemon/email-daemon-mail.c
new file mode 100755 (executable)
index 0000000..f8b65a2
--- /dev/null
@@ -0,0 +1,1473 @@
+/*
+*  email-service
+*
+* Copyright (c) 2000 - 2011 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.
+*
+*/
+
+
+
+/******************************************************************************
+ * File: email-daemon-mail.c
+ * Desc: email-daemon Mail Operation
+ *
+ * Auth: 
+ *
+ * History:
+ *    2006.08.16 : created
+ *****************************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <glib.h>
+#include <unistd.h>
+#include <malloc.h>
+#include <pthread.h>
+
+#include "email-internal-types.h"
+#include "email-daemon.h"
+#include "email-core-event.h"
+#include "email-daemon-account.h"
+#include "email-debug-log.h"
+#include "email-storage.h"
+#include "email-utilities.h"
+#include "email-core-account.h"
+#include "email-core-mail.h"
+#include "email-core-mailbox.h" 
+#include "email-core-utils.h" 
+#include "email-core-smtp.h" 
+#include "email-core-timer.h" 
+
+#ifdef __FEATURE_LOCAL_ACTIVITY__
+extern int g_local_activity_run;
+extern int g_save_local_activity_run;
+#endif
+static int _emdaemon_check_mail_id(int mail_id, int* err_code);
+
+INTERNAL_FUNC int emdaemon_send_mail(emf_mailbox_t* mailbox, int mail_id, emf_option_t* sending_option, unsigned* handle, int* err_code)
+{      
+       EM_DEBUG_FUNC_BEGIN("mailbox[%p], mail_id[%d], sending_option[%p], handle[%p], err_code[%p]", mailbox, mail_id, sending_option, handle, err_code);
+       
+       int ret = false, err = EMF_ERROR_NONE, err_2 = EMF_ERROR_NONE;
+       int  result_handle = 0, account_id = 0;
+       emf_mailbox_t dest_mbox;
+       emf_option_t* option = NULL;
+       emf_event_t event_data;
+       char* mailbox_name = NULL;
+       
+       if (!mailbox || !mailbox->name || mailbox->account_id <= 0) {
+               if (mailbox != NULL)
+                       EM_DEBUG_EXCEPTION(" mailbox->name[%s], mailbox->account_id[%d]", mailbox->name, mailbox->account_id);
+               if (err_code)
+                       *err_code = EMF_ERROR_INVALID_MAILBOX;          
+               return false;
+       }
+       
+       account_id = mailbox->account_id;
+       
+       if (sending_option != NULL) {
+               if (!(option = (emf_option_t*)em_malloc(sizeof(emf_option_t)))) {       
+                       EM_DEBUG_EXCEPTION("em_malloc for sending_option failed...");
+                       err = EMF_ERROR_OUT_OF_MEMORY;
+                       goto FINISH_OFF;
+               }
+               memcpy(option, sending_option, sizeof(emf_option_t));
+               option->display_name_from = EM_SAFE_STRDUP(sending_option->display_name_from);
+       }
+       
+       emf_account_t* ref_account = emdaemon_get_account_reference(account_id);
+
+       if (!ref_account) {
+               EM_DEBUG_EXCEPTION("emdaemon_get_account_reference failed [%d]", account_id);
+               err = EMF_ERROR_INVALID_ACCOUNT;
+               goto FINISH_OFF;
+       }
+
+#ifdef __FEATURE_MOVE_TO_OUTBOX_FIRST__
+       if (!emstorage_get_mailboxname_by_mailbox_type(account_id,EMF_MAILBOX_TYPE_OUTBOX,&mailbox_name, false, &err)) {
+               EM_DEBUG_EXCEPTION(" emstorage_get_mailboxname_by_mailbox_type failed [%d]", err);
+
+               goto FINISH_OFF;
+       }
+       if (strcmp(mailbox->name, mailbox_name)) {      
+               dest_mbox.name = mailbox_name;
+               dest_mbox.account_id = account_id;
+               
+               /*  mail is moved to 'OUTBOX' first of all. */
+               if (!emcore_mail_move(&mail_id, 1, dest_mbox.name, EMF_MOVED_AFTER_SENDING, 0, &err)) {
+                       EM_DEBUG_EXCEPTION("emcore_mail_move falied [%d]", err);
+                       goto FINISH_OFF;
+               }
+       }
+#endif /* __FEATURE_MOVE_TO_OUTBOX_FIRST__ */
+
+       if(!emstorage_notify_network_event(NOTI_SEND_START, account_id, NULL, mail_id, 0))
+               EM_DEBUG_EXCEPTION(" emstorage_notify_network_event [ NOTI_SEND_START] Failed >>>> ");
+       
+       /* set EMF_MAIL_STATUS_SEND_WAIT status */
+
+       if(!emstorage_set_field_of_mails_with_integer_value(account_id, &mail_id, 1, "save_status", EMF_MAIL_STATUS_SEND_WAIT, true, &err)) {
+               EM_DEBUG_EXCEPTION("emstorage_set_field_of_mails_with_integer_value [%d]",err);
+
+               goto FINISH_OFF;
+       }
+
+       switch (ref_account->account_bind_type) {
+               case EMF_BIND_TYPE_EM_CORE:
+                       memset(&event_data, 0x00, sizeof(emf_event_t));
+                       event_data.type               = EMF_EVENT_SEND_MAIL;
+                       event_data.account_id         = account_id;
+                       event_data.event_param_data_1 = (char*)option;
+                       event_data.event_param_data_3 = EM_SAFE_STRDUP(mailbox->name);
+                       event_data.event_param_data_4 = mail_id;
+                       
+                       if (!emcore_insert_send_event(&event_data, &result_handle, &err)) {
+                               EM_DEBUG_EXCEPTION(" emcore_insert_event failed [%d]", err);
+                               goto FINISH_OFF;
+                       }
+#ifdef __FEATURE_LOCAL_ACTIVITY__
+                       EM_DEBUG_LOG("Setting g_save_local_activity_run ");
+                       g_save_local_activity_run = 1;
+#endif
+                       break;
+               
+               default:
+                       EM_DEBUG_EXCEPTION("unsupported account binding type...");
+                       err = EMF_ERROR_NOT_SUPPORTED;
+                       goto FINISH_OFF;
+       }
+       
+       if ( handle )
+               *handle = result_handle;
+
+       ret = true;
+       
+FINISH_OFF:
+       if (ret == false) {     
+               EM_DEBUG_EXCEPTION("emdaemon_send_mail failed [%d]", err);                      
+
+               if(!emstorage_set_field_of_mails_with_integer_value(account_id, &mail_id, 1, "save_status", EMF_MAIL_STATUS_SAVED, true, &err))
+                       EM_DEBUG_EXCEPTION("emstorage_set_field_of_mails_with_integer_value [%d]",err);
+
+               EM_SAFE_FREE(event_data.event_param_data_3);
+               
+               if(option != NULL) {    
+                       EM_SAFE_FREE(option->display_name_from);
+                       EM_SAFE_FREE(option);
+               }
+       }
+
+       if(!emcore_add_transaction_info(mail_id , result_handle , &err_2))
+               EM_DEBUG_EXCEPTION("emcore_add_transaction_info failed [%d]", err_2);
+
+       EM_SAFE_FREE(mailbox_name);
+
+       if (err_code != NULL)
+               *err_code = err;
+
+       EM_DEBUG_FUNC_END();
+       return ret;
+}
+
+INTERNAL_FUNC int emdaemon_send_mail_saved(int account_id, emf_option_t* sending_option,  unsigned* handle, int* err_code)
+{      
+       EM_DEBUG_FUNC_BEGIN("account_id[%d], sending_option[%p], handle[%p], err_code[%p]", account_id, sending_option, handle, err_code);
+       
+       int ret = false;
+       int err = EMF_ERROR_NONE;
+       emf_option_t* option = NULL;
+       emf_event_t event_data;
+       char *mailbox_name = NULL;      
+       
+       memset(&event_data, 0x00, sizeof(emf_event_t));
+       
+       if (account_id <= 0)  {
+               EM_DEBUG_EXCEPTION("account_id = %d", account_id);
+               err = EMF_ERROR_INVALID_PARAM;
+               goto FINISH_OFF;
+       }
+       
+       if (sending_option)  {
+               option = (emf_option_t*)em_malloc(sizeof(emf_option_t));
+               if (!option)  {
+                       EM_DEBUG_EXCEPTION("em_malloc failed...");
+                       err = EMF_ERROR_OUT_OF_MEMORY;
+                       goto FINISH_OFF;
+               }
+
+               memcpy(option, sending_option, sizeof(emf_option_t));
+       }
+       
+       emf_account_t* ref_account = emdaemon_get_account_reference(account_id);
+
+       if (!ref_account)  {
+               EM_DEBUG_EXCEPTION("emdaemon_get_account_reference failed [%d]", account_id);
+               err = EMF_ERROR_INVALID_ACCOUNT;
+               goto FINISH_OFF;
+       }
+
+       
+       switch (ref_account->account_bind_type)  {
+               case EMF_BIND_TYPE_EM_CORE:
+                       event_data.type = EMF_EVENT_SEND_MAIL_SAVED;
+                                               
+                       if (!emstorage_get_mailboxname_by_mailbox_type(account_id,EMF_MAILBOX_TYPE_OUTBOX,&mailbox_name, false, &err))  {
+                               EM_DEBUG_EXCEPTION("emstorage_get_mailboxname_by_mailbox_type failed [%d]", err);
+                               goto FINISH_OFF;
+                       }
+                       event_data.event_param_data_3 = EM_SAFE_STRDUP(mailbox_name);           
+                       event_data.account_id  = account_id;
+                       event_data.event_param_data_1 = (char*)option;
+               
+                       if (!emcore_insert_event(&event_data, (int*)handle, &err))  {
+                               EM_DEBUG_EXCEPTION("emcore_insert_event failed [%d]", err);
+                               goto FINISH_OFF;
+                       }
+                       break;
+                       
+               default :
+                       EM_DEBUG_EXCEPTION("unknown account bind type...");
+                       err = EMF_ERROR_INVALID_ACCOUNT;
+                       goto FINISH_OFF;
+       }
+       
+       ret = true;
+       
+FINISH_OFF:
+       if (ret == false)  {
+               EM_SAFE_FREE(event_data.event_param_data_3);
+               EM_SAFE_FREE(option);
+       }
+
+       EM_SAFE_FREE(mailbox_name);
+       
+       if (err_code)
+               *err_code = err;
+
+       EM_DEBUG_FUNC_END();
+       return ret;
+}
+
+INTERNAL_FUNC int emdaemon_add_mail(emf_mail_data_t *input_mail_data, emf_attachment_data_t *input_attachment_data_list, int input_attachment_count, emf_meeting_request_t *input_meeting_request, int input_from_eas)
+{
+       EM_DEBUG_FUNC_BEGIN("input_mail_data[%p], input_attachment_data_list[%p], input_attachment_count [%d], input_meeting_req [%p], input_from_eas[%d]", input_mail_data, input_attachment_data_list, input_attachment_count, input_meeting_request, input_from_eas);
+
+       int         err = EMF_ERROR_NONE;
+       int         handle = 0;
+       emf_event_t event_data = { 0 };
+       
+       if (!input_mail_data || input_mail_data->account_id <= 0 ||
+               (input_mail_data->report_status == EMF_MAIL_REPORT_MDN && !input_mail_data->full_address_to))  {
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM"); 
+               err = EMF_ERROR_INVALID_PARAM;
+               goto FINISH_OFF;
+       }
+       
+       emf_account_t* ref_account = emdaemon_get_account_reference(input_mail_data->account_id);
+       if (!ref_account)  {
+               EM_DEBUG_LOG(" emdaemon_get_account_reference failed [%d]", input_mail_data->account_id);
+               err = EMF_ERROR_INVALID_ACCOUNT;
+               goto FINISH_OFF;
+       }
+       
+       switch (ref_account->account_bind_type)  {
+               case EMF_BIND_TYPE_EM_CORE : 
+                       if ((err = emcore_add_mail(input_mail_data, input_attachment_data_list, input_attachment_count, input_meeting_request, input_from_eas)) != EMF_ERROR_NONE) {
+                               EM_DEBUG_EXCEPTION("emcore_add_mail failed [%d]", err);
+                               goto FINISH_OFF;
+                       }
+
+#ifdef __FEATURE_SYNC_CLIENT_TO_SERVER__
+                       if ( input_from_eas == 0) {
+                               event_data.type               = EMF_EVENT_SAVE_MAIL;
+                               event_data.account_id         = input_mail_data->account_id;
+                               event_data.event_param_data_4 = input_mail_data->mail_id;
+
+                               if (!emcore_insert_send_event(&event_data, &handle, &err))  {
+                                       EM_DEBUG_EXCEPTION("emcore_insert_send_event failed [%d]", err);
+                                       goto FINISH_OFF;
+                               }
+                       }
+#endif                 
+               break;
+
+               default:
+                       EM_DEBUG_EXCEPTION("unknown account bind type...");
+                       err = EMF_ERROR_INVALID_ACCOUNT;
+                       goto FINISH_OFF;
+       }
+FINISH_OFF:
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+}
+       
+
+INTERNAL_FUNC int emdaemon_add_meeting_request(int account_id, char *mailbox_name, emf_meeting_request_t *meeting_req, int* err_code)
+{
+       EM_DEBUG_FUNC_BEGIN("account_id[%d], mailbox_name[%s], meeting_req[%p], err_code[%p]", account_id, mailbox_name, meeting_req, err_code);
+
+       /*  default variable */
+       int ret = false;
+       int err = EMF_ERROR_NONE;
+       
+       if ( account_id <= 0 || !meeting_req || meeting_req->mail_id <= 0 )  {
+               if(meeting_req)
+                       EM_DEBUG_EXCEPTION("mail_id[%d]", meeting_req->mail_id);
+               
+               err = EMF_ERROR_INVALID_PARAM;
+               goto FINISH_OFF;
+       }
+       
+       if (!emcore_add_meeting_request(account_id, mailbox_name, meeting_req, &err))  {
+               EM_DEBUG_EXCEPTION(" emcore_save_mail_meeting_request failed [%d]", err);
+               goto FINISH_OFF;
+       }
+
+       ret = true;
+       
+FINISH_OFF:
+       if (err_code)
+               *err_code = err;
+       EM_DEBUG_FUNC_END();
+       return ret;
+}
+
+INTERNAL_FUNC int emdaemon_download_body(emf_mailbox_t* mailbox, int mail_id, int verbose, int with_attachment,  unsigned* handle, int* err_code)
+{
+       EM_DEBUG_FUNC_BEGIN("mailbox[%p], mail_id[%d], verbose[%d], with_attachment[%d], handle[%p], err_code[%p]", mailbox, mail_id, verbose, with_attachment,  handle, err_code);
+       
+       /*  default variable */
+       int ret = false;
+       int err = EMF_ERROR_NONE;
+/*     mpNewMail_StopAlertSound(); */
+       
+       if (!_emdaemon_check_mail_id(mail_id, &err))  {
+               EM_DEBUG_EXCEPTION("_emdaemon_check_mail_id failed [%d]", err);
+               goto FINISH_OFF;
+       }
+       
+       emf_event_t event_data;
+       
+       memset(&event_data, 0x00, sizeof(emf_event_t));
+       
+       event_data.type = EMF_EVENT_DOWNLOAD_BODY;
+       event_data.event_param_data_1 = NULL;
+       event_data.event_param_data_4 = mail_id;
+       event_data.account_id = mailbox->account_id;
+       event_data.event_param_data_3 = GINT_TO_POINTER(verbose << 1 | with_attachment);
+       
+       if (!emcore_insert_event(&event_data, (int*)handle, &err))  {
+               EM_DEBUG_EXCEPTION("emcore_insert_event failed [%d]", err);
+               err = EMF_ERROR_DB_FAILURE;
+               goto FINISH_OFF;
+       }
+#ifdef __FEATURE_LOCAL_ACTIVITY__      
+       EM_DEBUG_LOG("Setting g_local_activity_run ");
+       g_local_activity_run = 1;       
+#endif
+       ret = true;
+       
+FINISH_OFF:
+       if (err_code)
+               *err_code = err;
+       EM_DEBUG_FUNC_END();
+       return ret;
+}
+
+int emdaemon_get_attachment(emf_mailbox_t* mailbox, int mail_id,  char* attachment_id, emf_attachment_info_t** attachment, int* err_code)
+{
+       EM_DEBUG_FUNC_BEGIN("mailbox[%p], mail_id[%d], attachment_id[%s], attachment[%p], err_code[%p]", mailbox, mail_id, attachment_id, attachment, err_code);
+       
+       /*  default variable */
+       int ret = false;
+       int err = EMF_ERROR_NONE;
+       
+       if (!attachment_id || !attachment)  {
+               EM_DEBUG_EXCEPTION("mailbox[%p], mail_id[%d], attachment_id[%p], attachment[%p]\n", mailbox, mail_id, attachment_id, attachment);
+               err = EMF_ERROR_INVALID_PARAM;
+               goto FINISH_OFF;
+       }
+       
+       if (!_emdaemon_check_mail_id(mail_id, &err))  {
+               EM_DEBUG_EXCEPTION("_emdaemon_check_mail_id failed [%d]", err);
+               goto FINISH_OFF;
+       }
+       
+       if (!emcore_get_attachment_info(/*mailbox,*/ mail_id, attachment_id, attachment, &err) || !attachment)  {
+               EM_DEBUG_EXCEPTION("emcore_get_attachment_info failed [%d]", err);
+               goto FINISH_OFF;
+       }
+       
+       ret = true;
+       
+FINISH_OFF:
+       if (err_code)
+               *err_code = err;
+       EM_DEBUG_FUNC_END();
+       return ret;
+}
+
+int emdaemon_add_attachment(emf_mailbox_t* mailbox, int mail_id, emf_attachment_info_t* attachment, int* err_code)
+{
+       EM_DEBUG_FUNC_BEGIN("mailbox[%p], mail_id[%d], attachment[%p], err_code[%p]", mailbox, mail_id, attachment, err_code);
+       
+       /*  default variable */
+       int ret = false;
+       int err = EMF_ERROR_NONE;
+
+       if (!attachment)  {
+               EM_DEBUG_EXCEPTION(" mailbox[%p], mail_id[%d], attachment[%p]", mailbox, mail_id, attachment);
+               err = EMF_ERROR_INVALID_PARAM;
+               goto FINISH_OFF;
+       }
+
+       if (!_emdaemon_check_mail_id(mail_id, &err))  {
+               EM_DEBUG_EXCEPTION(" _emdaemon_check_mail_id failed [%d]", err);
+               goto FINISH_OFF;
+       }
+
+       if (!emcore_mail_add_attachment(/*mailbox,*/ mail_id, attachment, &err))  {
+               EM_DEBUG_EXCEPTION(" emcore_mail_add_attachment failed [%d]", err);
+               goto FINISH_OFF;
+       }
+       
+       ret = true;
+
+FINISH_OFF:
+       if (err_code)
+               *err_code = err;
+       EM_DEBUG_FUNC_END();
+       return ret;
+}
+
+int emdaemon_delete_mail_attachment(emf_mailbox_t* mailbox, int mail_id,  char* attachment_id, int* err_code)
+{
+       EM_DEBUG_FUNC_BEGIN("mailbox[%p], mail_id[%d], attachment_id[%s], err_code[%p]", mailbox, mail_id, attachment_id, err_code);
+       
+       /*  default variable */
+       int ret = false;
+       int err = EMF_ERROR_NONE;
+       
+       if (!attachment_id)  {
+               EM_DEBUG_EXCEPTION(" mailbox[%p], mail_id[%d], attachment_id[%p]", mailbox, mail_id, attachment_id);
+               err = EMF_ERROR_INVALID_PARAM;
+               goto FINISH_OFF;
+       }
+       
+       if (!_emdaemon_check_mail_id(mail_id, &err))  {
+               EM_DEBUG_EXCEPTION(" _emdaemon_check_mail_id failed [%d]", err);
+               goto FINISH_OFF;
+       }
+       
+       if (!emcore_delete_mail_attachment(mail_id, attachment_id, &err))  {
+               EM_DEBUG_EXCEPTION(" emcore_delete_mail_attachment failed [%d]", err);
+               goto FINISH_OFF;
+       }
+       
+       ret = true;
+       
+FINISH_OFF:
+       if (err_code)
+               *err_code = err;
+       EM_DEBUG_FUNC_END();
+       return ret;
+}
+
+INTERNAL_FUNC int emdaemon_download_attachment(emf_mailbox_t* mailbox, int mail_id, char* attachment, unsigned* handle, int* err_code)
+{
+       EM_DEBUG_FUNC_BEGIN("mailbox[%p], mail_id[%d], attachment[%p], handle[%p], err_code[%p]", mailbox, mail_id, attachment, handle, err_code);
+       
+       int ret = false;
+       int err = EMF_ERROR_NONE;
+       
+       if (!attachment)  {
+               EM_DEBUG_EXCEPTION("attachment[%p] is invalid", attachment);
+               err = EMF_ERROR_INVALID_PARAM;
+               goto FINISH_OFF;
+       }
+       
+       if (!_emdaemon_check_mail_id(mail_id, &err))  {
+               EM_DEBUG_EXCEPTION("_emdaemon_check_mail_id failed [%d]", err);
+               goto FINISH_OFF;
+       }
+       
+       emf_event_t event_data;
+       
+       memset(&event_data, 0x00, sizeof(emf_event_t));
+       
+       event_data.type = EMF_EVENT_DOWNLOAD_ATTACHMENT;
+       event_data.event_param_data_1 = NULL;
+       event_data.event_param_data_4 = mail_id;
+       event_data.account_id = mailbox->account_id;    
+       event_data.event_param_data_3 = EM_SAFE_STRDUP(attachment);
+       
+       if (!emcore_insert_event(&event_data, (int*)handle, &err))  {
+               EM_DEBUG_EXCEPTION("emcore_insert_event failed [%d]", err);
+               goto FINISH_OFF;
+       }
+
+#ifdef __FEATURE_LOCAL_ACTIVITY__      
+       EM_DEBUG_LOG("Setting g_local_activity_run ");
+       g_local_activity_run = 1;       
+#endif
+
+       ret = true;
+       
+FINISH_OFF:
+       if (err_code)
+               *err_code = err;
+       
+       return ret;
+}
+
+INTERNAL_FUNC int emdaemon_free_attachment_info(emf_attachment_info_t** atch_info, int* err_code)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       return emcore_free_attachment_info(atch_info, err_code);
+}
+
+void* thread_func_to_delete_mail(void *thread_argument)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int *mail_id_list = NULL, mail_id_count, account_id, err;
+       unsigned handle = 0;
+       emf_event_t *event_data = (emf_event_t*)thread_argument;
+
+       account_id         = event_data->account_id;
+       mail_id_list       = (int*)event_data->event_param_data_3;
+       mail_id_count      = event_data->event_param_data_4;
+
+       if (!emcore_delete_mail(account_id, mail_id_list, mail_id_count, EMF_DELETE_LOCALLY, EMF_DELETED_BY_COMMAND, false, &err)) {
+               EM_DEBUG_EXCEPTION(" emcore_delete_mail falied [%d]", err);
+               goto FINISH_OFF;
+       }
+       
+       if (!emcore_insert_event(event_data, (int*)handle, &err)) {
+               EM_DEBUG_EXCEPTION("emcore_insert_event failed [%d]", err);
+               goto FINISH_OFF;
+       }
+
+FINISH_OFF:    
+       /* emcore_free_event(event_data); */ /* all of members will be freed after using in each event handler */
+       EM_SAFE_FREE(event_data);
+
+       EM_DEBUG_FUNC_END();
+       return SUCCESS;
+}
+
+INTERNAL_FUNC int emdaemon_delete_mail(int account_id, emf_mailbox_t* mailbox, int mail_ids[], int mail_ids_count, int from_server, unsigned* handle, int* err_code)
+{
+       EM_DEBUG_FUNC_BEGIN("mailbox[%p], mail_ids[%p], mail_ids_count[%d], from_server[%d], handle[%p], err_code[%p]", mailbox, mail_ids, mail_ids_count, from_server, handle, err_code);
+       
+       int ret = false;
+       int err = EMF_ERROR_NONE;
+       int* p = NULL, thread_error;
+       emf_event_t *event_data = NULL;
+       emf_account_t *account = NULL;
+       thread_t delete_thread;
+
+       /* mailbox can be NULL for deleting thread mail. */
+       if (mail_ids_count <= 0) {
+               EM_DEBUG_EXCEPTION("mail_ids_count [%d]", mail_ids_count);
+               err = EMF_ERROR_INVALID_PARAM;
+               goto FINISH_OFF;
+       }
+       
+       if (!(account = emcore_get_account_reference(account_id))) {
+               EM_DEBUG_EXCEPTION("emcore_get_account_reference failed [%d]", account_id);
+               err = EMF_ERROR_INVALID_ACCOUNT;
+               goto FINISH_OFF;
+       }
+
+       if ((p = em_malloc(sizeof(int) * mail_ids_count)) == NULL) {
+               EM_DEBUG_EXCEPTION("em_malloc for p failed...");
+               err = EMF_ERROR_OUT_OF_MEMORY;
+               goto FINISH_OFF;
+       }
+       
+       memcpy(p, mail_ids, sizeof(int) * mail_ids_count);
+
+       if ((event_data = em_malloc(sizeof(emf_event_t)) ) == NULL) {
+               EM_DEBUG_EXCEPTION("em_malloc for event_data failed...");
+               err = EMF_ERROR_OUT_OF_MEMORY;
+               goto FINISH_OFF;
+       }
+
+       event_data->type                   = EMF_EVENT_DELETE_MAIL;
+       event_data->account_id             = account_id;
+       if(mailbox)
+               event_data->event_param_data_1 = mailbox->name;
+       event_data->event_param_data_3     = (char*)p;
+       event_data->event_param_data_4     = mail_ids_count;
+
+       THREAD_CREATE(delete_thread, thread_func_to_delete_mail, (void*)event_data, thread_error);
+       THREAD_DETACH(delete_thread); /* free resources used for new thread */
+       ret = true;
+
+FINISH_OFF:
+       if (ret == false)
+               EM_SAFE_FREE(p);
+       
+       if (err_code)
+               *err_code = err;
+       
+       return ret;
+}
+
+int emdaemon_delete_mail_all(emf_mailbox_t* mailbox, int with_server, unsigned* handle, int* err_code)
+{
+       EM_DEBUG_FUNC_BEGIN("mailbox[%p], with_server[%d], handle[%p], err_code[%p]", mailbox, with_server, handle, err_code);
+       
+       int            ret = false;
+       int            err = EMF_ERROR_NONE;
+       emf_account_t *ref_account = NULL;
+       emf_event_t    event_data = { 0 };
+       
+       if (!mailbox || mailbox->account_id <= 0)  {
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
+               err = EMF_ERROR_INVALID_PARAM;
+               goto FINISH_OFF;
+       }
+       ref_account = emdaemon_get_account_reference(mailbox->account_id);
+
+       if (!ref_account)  {
+               EM_DEBUG_EXCEPTION("emdaemon_get_account_reference failed account_id [%d]", mailbox->account_id);
+               err = EMF_ERROR_INVALID_ACCOUNT;
+               goto FINISH_OFF;
+       }
+       
+#ifdef __FEATURE_SYNC_CLIENT_TO_SERVER__
+       event_data.type               = EMF_EVENT_DELETE_MAIL_ALL;
+       event_data.account_id         = mailbox->account_id;
+       event_data.event_param_data_1 = EM_SAFE_STRDUP(mailbox->name);
+       event_data.event_param_data_3 = NULL;
+       event_data.event_param_data_4 = with_server;
+
+       if (!emcore_insert_event(&event_data, (int*)handle, &err))  {
+               EM_DEBUG_EXCEPTION("emcore_insert_event falied [%d]", err);
+               EM_SAFE_FREE(event_data.event_param_data_1);
+               goto FINISH_OFF;
+       }
+       
+#ifdef __FEATURE_LOCAL_ACTIVITY__
+       int i, total = 0 , search_handle = 0;
+       int *mail_ids = NULL;
+       emstorage_activity_tbl_t new_activity;
+       int activityid = 0;
+       
+       if (false == emcore_get_next_activity_id(&activityid,&err)) {
+               EM_DEBUG_EXCEPTION(" emcore_get_next_activity_id Failed - %d ", err);
+       }
+       
+       if (!emstorage_mail_search_start(NULL, mailbox->account_id, mailbox->name, 0, &search_handle, &total, true, &err)) {
+               EM_DEBUG_EXCEPTION(" emstorage_mail_search_start failed [%d]", err);
+               
+
+               goto FINISH_OFF;
+       }
+       
+       mail_ids = em_malloc(sizeof(int) * total);
+       if (mail_ids == NULL)  {
+               EM_DEBUG_EXCEPTION(" mailloc failed...");
+               
+               err = EMF_ERROR_OUT_OF_MEMORY;
+               goto FINISH_OFF;
+       }
+       
+       for (i = 0; i < total; i++)  {
+               if (!emstorage_mail_search_result(search_handle, RETRIEVE_ID, (void**)&mail_ids[i], true, &err))  {
+                       EM_DEBUG_EXCEPTION(" emstorage_mail_search_result failed [%d]", err);
+                       
+       
+                       EM_SAFE_FREE(mail_ids);
+                       goto FINISH_OFF;
+               }
+                       
+               new_activity.activity_id        = activityid;
+               new_activity.activity_type      = ACTIVITY_DELETEMAIL;
+               new_activity.mail_id            = mail_ids[i];
+               new_activity.server_mailid      = NULL;
+               new_activity.src_mbox           = mailbox->name;
+               new_activity.dest_mbox          = NULL;
+               new_activity.account_id         = mailbox->account_id;
+                                               
+               if (! emcore_add_activity(&new_activity, &err))
+                       EM_DEBUG_EXCEPTION(" emcore_add_activity  Failed  - %d ", err);
+               
+       }
+
+       EM_SAFE_FREE(mail_ids);
+
+       EM_DEBUG_LOG("Setting g_local_activity_run ");
+       g_local_activity_run = 1;       
+#endif
+       
+#endif         /*  __FEATURE_SYNC_CLIENT_TO_SERVER__ */
+       
+       ret = true;
+       
+FINISH_OFF:
+       if (err_code)
+               *err_code = err;
+
+       return ret;
+}
+
+       
+
+INTERNAL_FUNC int emdaemon_move_mail_all_mails(emf_mailbox_t* src_mailbox, emf_mailbox_t* dst_mailbox, int* err_code)
+{
+       EM_DEBUG_FUNC_BEGIN("src_mailbox[%p], dst_mailbox[%p], err_code[%p]",  src_mailbox, dst_mailbox, err_code);
+       
+       int ret = false;
+       int err = EMF_ERROR_NONE;
+       emf_account_t *ref_account = NULL;
+       emf_mail_list_item_t *mail_list = NULL;
+       int select_num = 0;
+       int *mails = NULL;      
+       int i=0;
+       int num =0;
+       
+       if (!dst_mailbox || dst_mailbox->account_id <= 0 || !src_mailbox || src_mailbox->account_id <= 0)  {
+               EM_DEBUG_EXCEPTION("Invalid Parameter");
+               err = EMF_ERROR_INVALID_PARAM;
+               goto FINISH_OFF;
+       }
+       
+       ref_account = emdaemon_get_account_reference(dst_mailbox->account_id);
+
+       if (!ref_account)  {
+               EM_DEBUG_EXCEPTION("emdaemon_get_account_reference failed [%d]", dst_mailbox->account_id);
+               err = EMF_ERROR_INVALID_ACCOUNT;
+               goto FINISH_OFF;
+       }
+
+       if(!emstorage_get_mail_list(src_mailbox->account_id, src_mailbox->name, NULL, EMF_LIST_TYPE_NORMAL, -1, -1, 0, NULL, EMF_SORT_DATETIME_HIGH, false, &mail_list, &select_num, &err)) {
+               EM_DEBUG_EXCEPTION("emstorage_get_mail_list failed");
+               goto FINISH_OFF;
+       }
+
+       mails = malloc(sizeof(int) * select_num);
+
+       if( !mails ) {
+               EM_DEBUG_EXCEPTION("Malloc failed...!");
+               err = EMF_ERROR_OUT_OF_MEMORY;
+               goto FINISH_OFF;
+       }
+
+       memset(mails, 0x00, sizeof(int) * select_num);
+               
+       for(i = 0 ; i < select_num ; i++) {
+               if( mail_list[i].save_status != EMF_MAIL_STATUS_SENDING ) {
+                       mails[num] = mail_list[i].mail_id;
+                       num++;
+               }
+       }
+
+       if( num <= 0) {
+               EM_DEBUG_EXCEPTION("can't find avalable mails. num = %d", num);
+               err = EMF_ERROR_MAIL_NOT_FOUND;
+               goto FINISH_OFF;        
+       }
+       
+       if(!emcore_mail_move(mails, num, dst_mailbox->name, EMF_MOVED_BY_COMMAND, 0, &err)) {
+               EM_DEBUG_EXCEPTION("emcore_mail_move falied [%d]", err);
+               goto FINISH_OFF;
+       }
+
+               
+       ret = true;
+       
+FINISH_OFF:
+       if (err_code)
+               *err_code = err;
+
+       if(mail_list)
+               EM_SAFE_FREE(mail_list);
+
+       if(mails != NULL )
+               EM_SAFE_FREE(mails);
+       
+       return ret;
+}
+
+void* thread_func_to_move_mail(void *thread_argument)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int *mail_ids = NULL, mail_ids_count, noti_param_1, noti_param_2, err;
+       unsigned handle = 0;
+       emf_event_t *event_data = (emf_event_t*)thread_argument;
+       char *dst_mailbox_name = NULL;
+
+       dst_mailbox_name   = (char*)event_data->event_param_data_1;
+       mail_ids           = (int*)event_data->event_param_data_3;
+       mail_ids_count     = event_data->event_param_data_4;
+       noti_param_1       = event_data->event_param_data_6;
+       noti_param_2       = event_data->event_param_data_7;
+
+       if (!emcore_mail_move(mail_ids, mail_ids_count, dst_mailbox_name, noti_param_1, noti_param_2, &err)) {
+               EM_DEBUG_EXCEPTION("emcore_mail_move failed [%d]", err);
+               goto FINISH_OFF;
+       }
+
+       if (!emcore_insert_event(event_data, (int*)&handle, &err)) {
+               EM_DEBUG_EXCEPTION("emcore_insert_event failed [%d]", err);
+               goto FINISH_OFF;
+       }
+
+FINISH_OFF:    
+       /* emcore_free_event(event_data); */ /* all of members will be freed after using in each event handler */
+       EM_SAFE_FREE(event_data);
+
+       EM_DEBUG_FUNC_END();
+       return SUCCESS;
+}
+
+INTERNAL_FUNC int emdaemon_move_mail(int mail_ids[], int num, emf_mailbox_t* dst_mailbox, int noti_param_1, int noti_param_2, int* err_code)
+{
+       EM_DEBUG_FUNC_BEGIN("mail_ids[%p], num[%d], dst_mailbox[%p], err_code[%p]", mail_ids, num, dst_mailbox, err_code);
+       
+       /*  default variable */
+       int mail_id = 0, *p = NULL, thread_error;
+       int ret = false, err = EMF_ERROR_NONE;
+       char *src_mailbox_name = NULL;          
+       emstorage_mail_tbl_t* mail_table_data = NULL;
+       emf_account_t* ref_account = NULL;
+       emf_event_t *event_data = NULL;
+       thread_t move_thread;
+
+       if (num <= 0 || !dst_mailbox || dst_mailbox->account_id <= 0) {
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
+               err = EMF_ERROR_INVALID_PARAM;
+               goto FINISH_OFF;
+       }
+       
+       ref_account = emdaemon_get_account_reference(dst_mailbox->account_id);
+
+       if (!ref_account) {
+               EM_DEBUG_EXCEPTION("emdaemon_get_account_reference failed [%d]", dst_mailbox->account_id);
+               err = EMF_ERROR_INVALID_ACCOUNT;
+               goto FINISH_OFF;
+       }
+
+       /* Getting source mailbox name */
+       mail_id = mail_ids[0];
+
+       if (!emstorage_get_mail_field_by_id(mail_id, RETRIEVE_SUMMARY, &mail_table_data, true, &err) || !mail_table_data) {
+               EM_DEBUG_EXCEPTION("emstorage_get_mail_field_by_id failed [%d]", err);
+
+               goto FINISH_OFF;
+       }
+       
+       if (src_mailbox_name ==  NULL)
+               src_mailbox_name = EM_SAFE_STRDUP(mail_table_data->mailbox_name);               
+
+       emstorage_free_mail(&mail_table_data, 1, NULL);
+
+       if ((event_data = em_malloc(sizeof(emf_event_t)) ) == NULL) {
+               EM_DEBUG_EXCEPTION("em_malloc for event_data failed...");
+               err = EMF_ERROR_OUT_OF_MEMORY;
+               goto FINISH_OFF;
+       }
+
+       if ((p = em_malloc(sizeof(int) * num)) == NULL) {
+               EM_DEBUG_EXCEPTION("em_malloc for p failed...");
+               err = EMF_ERROR_OUT_OF_MEMORY;
+               goto FINISH_OFF;
+       }
+
+       memcpy(p, mail_ids, sizeof(int) * num);
+       
+       event_data->account_id        = dst_mailbox->account_id;
+       event_data->type               = EMF_EVENT_MOVE_MAIL;
+       event_data->event_param_data_1 = EM_SAFE_STRDUP(dst_mailbox->name);
+       event_data->event_param_data_2 = EM_SAFE_STRDUP(src_mailbox_name);
+       event_data->event_param_data_3 = (char*)p;
+       event_data->event_param_data_4 = num;
+       event_data->event_param_data_6 = noti_param_1;
+       event_data->event_param_data_7 = noti_param_2;
+
+#ifdef __FEATURE_LOCAL_ACTIVITY__
+       int i = 0, activityid = 0;
+       
+       if (false == emcore_get_next_activity_id(&activityid,&err))
+               EM_DEBUG_EXCEPTION(" emcore_get_next_activity_id Failed - %d ", err);
+       
+       for (i =0; i < event_data.event_param_data_4; i++) {
+               emstorage_activity_tbl_t        new_activity;
+               new_activity.activity_id = activityid;
+               new_activity.activity_type = ACTIVITY_MOVEMAIL;
+               new_activity.account_id    = event_data.account_id;
+               new_activity.mail_id       = mail_ids[i];
+               new_activity.dest_mbox     = event_data.event_param_data_1;
+               new_activity.server_mailid = NULL;
+               new_activity.src_mbox      = event_data.event_param_data_2;
+
+               if (!emcore_add_activity(&new_activity, &err))
+                       EM_DEBUG_EXCEPTION(" emcore_add_activity Failed - %d ", err);
+       }
+#endif /* __FEATURE_LOCAL_ACTIVITY__ */
+       THREAD_CREATE(move_thread, thread_func_to_move_mail, (void*)event_data, thread_error);
+       THREAD_DETACH(move_thread); /* free resources used for new thread */
+       ret = true;
+       
+FINISH_OFF:
+
+#ifdef __FEATURE_LOCAL_ACTIVITY__      
+       EM_DEBUG_LOG("Setting g_local_activity_run ");
+       g_local_activity_run = 1;       
+#endif /* __FEATURE_LOCAL_ACTIVITY__ */
+
+       if (err_code)
+               *err_code = err;
+
+       EM_SAFE_FREE(src_mailbox_name);
+       
+       EM_DEBUG_FUNC_END("ret [%d]", ret);
+       return ret;
+}
+
+INTERNAL_FUNC int emdaemon_modify_flag(int mail_id, emf_mail_flag_t new_flag, int onserver, int sticky_flag, int* err_code)
+{
+       EM_DEBUG_FUNC_BEGIN("mail_id[%d], new_flag[%d], onserver[%d], sticky_flag[%d], err_code[%p]", mail_id, new_flag, onserver, sticky_flag, err_code);
+       
+       /*  default variable */
+       int ret = false;
+       int err = EMF_ERROR_NONE;
+       
+       if (!emcore_modify_flag(mail_id, new_flag, sticky_flag, &err))  {
+               EM_DEBUG_EXCEPTION(" emcore_modify_flag falled [%d]", err);
+               goto FINISH_OFF;
+       }
+       
+#ifdef __FEATURE_SYNC_CLIENT_TO_SERVER__
+       if( onserver == 1)  {
+       emf_event_t event_data;
+       unsigned handle = 0;
+       memset(&event_data, 0x00, sizeof(emf_event_t));
+       
+       event_data.type = EMF_EVENT_SYNC_MAIL_FLAG_TO_SERVER;
+       event_data.event_param_data_1 = NULL;
+       event_data.event_param_data_4 = mail_id;
+       event_data.account_id = 0;      
+#ifdef __FEATURE_LOCAL_ACTIVITY__
+               emstorage_mail_tbl_t *mail_table_data = NULL;
+               if (!emstorage_get_mail_field_by_id(mail_id, RETRIEVE_SUMMARY, &mail_table_data, false, &err) || !mail_table_data)  {
+                       EM_DEBUG_LOG(" emstorage_get_mail_field_by_id failed [%d]", err);
+                       goto FINISH_OFF;
+               }
+               event_data.account_id = mail_table_data->account_id;
+               emstorage_free_mail(&mail_table_data,1,&err);
+
+               emstorage_activity_tbl_t        new_activity;
+               new_activity.activity_type = ACTIVITY_MODIFYFLAG;
+               new_activity.account_id    = event_data.account_id;
+               new_activity.mail_id       = event_data.event_param_data_4;
+               new_activity.dest_mbox     = NULL;
+               new_activity.server_mailid = NULL;
+               new_activity.src_mbox      = NULL;
+
+               if (false == emcore_get_next_activity_id(&new_activity.activity_id,&err)) {
+                       EM_DEBUG_EXCEPTION(" emcore_get_next_activity_id Failed - %d \n", err);
+               }
+
+               if (!emcore_add_activity(&new_activity, &err)) {
+                       EM_DEBUG_EXCEPTION(" emcore_add_activity [ACTIVITY_MODIFYFLAG] Failed - %d \n", err);
+               }
+               
+#endif /*  __FEATURE_LOCAL_ACTIVITY__ */
+       if (!emcore_insert_event(&event_data, (int*)&handle, &err)) {
+                       EM_DEBUG_EXCEPTION("emcore_insert_event failed [%d]", err);
+                       goto FINISH_OFF;
+       }
+
+#ifdef __FEATURE_LOCAL_ACTIVITY__      
+               EM_DEBUG_LOG("Setting g_local_activity_run ");
+               g_local_activity_run = 1;       
+#endif /*  __FEATURE_LOCAL_ACTIVITY__ */
+       }
+#endif /*  __FEATURE_SYNC_CLIENT_TO_SERVER__ */
+
+       ret = true;
+       
+FINISH_OFF:
+       if (err_code)
+               *err_code = err;
+       EM_DEBUG_FUNC_END();
+       return ret;
+}
+
+INTERNAL_FUNC int emdaemon_modify_extra_flag(int mail_id, emf_extra_flag_t new_flag, int* err_code)
+{
+       EM_DEBUG_FUNC_BEGIN("mail_id[%d], err_code[%p]", mail_id, err_code);
+
+       int ret = false;
+       int err = EMF_ERROR_NONE;
+               
+       if (!_emdaemon_check_mail_id(mail_id, &err))  {
+               EM_DEBUG_EXCEPTION("_emdaemon_check_mail_id failed [%d]", err);
+                       goto FINISH_OFF;
+               }
+
+       if (!emcore_modify_extra_flag(mail_id, new_flag, &err))  {
+               EM_DEBUG_EXCEPTION("engine_mail_modify_extra_flag failed [%d]", err);
+                       goto FINISH_OFF;
+               }
+               
+       ret = true;
+
+FINISH_OFF:
+       if (err_code)
+               *err_code = err;
+
+       EM_DEBUG_FUNC_END("ret [%d]", ret);
+       return ret;
+               }
+
+INTERNAL_FUNC int emdaemon_set_flags_field(int account_id, int mail_ids[], int num, emf_flags_field_type field_type, int value, int onserver, int* err_code)
+{
+       EM_DEBUG_FUNC_BEGIN("mail_ids[%d], num[%d], field_type [%d], value[%d], err_code[%p]", mail_ids[0], num, field_type, value, err_code);
+               
+       int ret = false, err = EMF_ERROR_NONE;
+
+       if(account_id <= 0 || !mail_ids || num <= 0) {
+               err = EMF_ERROR_INVALID_PARAM;
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
+                       goto FINISH_OFF;
+               }
+
+       if (!emcore_set_flags_field(account_id, mail_ids, num, field_type, value, &err))  {
+               EM_DEBUG_EXCEPTION("emcore_set_flags_field falled [%d]", err);
+               goto FINISH_OFF;
+       }
+
+       if( onserver )  {
+               int *mail_id_array = NULL;
+               emf_event_t event_data = {0};
+               unsigned handle = 0;
+
+               mail_id_array = em_malloc(sizeof(int) * num);
+              
+               if (mail_id_array == NULL)  {
+                       EM_DEBUG_EXCEPTION("em_malloc failed...");
+              err = EMF_ERROR_OUT_OF_MEMORY;
+              goto FINISH_OFF;
+               }
+
+               memcpy(mail_id_array, mail_ids, sizeof(int) * num);
+               
+               event_data.type               = EMF_EVENT_SYNC_FLAGS_FIELD_TO_SERVER;
+               event_data.account_id         = account_id;
+               event_data.event_param_data_1 = NULL;
+               event_data.event_param_data_3 = (char*)mail_id_array;
+               event_data.event_param_data_4  = num;
+               event_data.event_param_data_5 = field_type;
+               event_data.event_param_data_6 = value;
+
+               if (!emcore_insert_event(&event_data, (int*)&handle, &err))  {
+                       EM_DEBUG_LOG("emcore_insert_event failed [%d]", err);
+                       goto FINISH_OFF;
+               }
+       }
+
+       ret = true;
+       
+FINISH_OFF:
+       if (err_code)
+               *err_code = err;
+       EM_DEBUG_FUNC_END();
+       return ret;
+}
+
+
+INTERNAL_FUNC int emdaemon_update_mail(emf_mail_data_t *input_mail_data, emf_attachment_data_t *input_attachment_data_list, int input_attachment_count, emf_meeting_request_t *input_meeting_request, int input_from_eas)
+{
+       EM_DEBUG_FUNC_BEGIN("input_mail_data[%p], input_attachment_data_list[%p], input_attachment_count [%d], input_meeting_req [%p], input_from_eas[%d]", input_mail_data, input_attachment_data_list, input_attachment_count, input_meeting_request, input_from_eas);
+
+       int            err = EMF_ERROR_NONE;
+       int            handle = 0;
+       emf_event_t    event_data = { 0 };
+       emf_account_t *ref_account = NULL;
+       
+       if (!input_mail_data || input_mail_data->account_id <= 0 || input_mail_data->mail_id == 0 ||
+               (input_mail_data->report_status == EMF_MAIL_REPORT_MDN && !input_mail_data->full_address_to))  {
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM"); 
+               err = EMF_ERROR_INVALID_PARAM;
+               goto FINISH_OFF;
+       }
+       
+       ref_account = emdaemon_get_account_reference(input_mail_data->account_id);
+       if (!ref_account)  {
+               EM_DEBUG_LOG(" emdaemon_get_account_reference failed [%d]", input_mail_data->account_id);
+               err = EMF_ERROR_INVALID_ACCOUNT;
+               goto FINISH_OFF;
+       }
+       
+       switch (ref_account->account_bind_type)  {
+               case EMF_BIND_TYPE_EM_CORE : 
+                       if ( (err = emcore_update_mail(input_mail_data, input_attachment_data_list, input_attachment_count, input_meeting_request, input_from_eas)) != EMF_ERROR_NONE) {
+                               EM_DEBUG_EXCEPTION("emcore_update_mail failed [%d]", err);
+                               goto FINISH_OFF;
+                       }
+
+#ifdef __FEATURE_SYNC_CLIENT_TO_SERVER__
+                       if ( input_from_eas == 0) {
+                               event_data.type               = EMF_EVENT_UPDATE_MAIL;
+                               event_data.account_id         = input_mail_data->account_id;
+                               event_data.event_param_data_1 = (char*)input_mail_data;
+                               event_data.event_param_data_2 = (char*)input_attachment_data_list;
+                               event_data.event_param_data_3 = (char*)input_meeting_request;
+                               event_data.event_param_data_4 = input_attachment_count;
+                               event_data.event_param_data_5 = input_from_eas;
+
+                               if (!emcore_insert_send_event(&event_data, &handle, &err))  {
+                                       EM_DEBUG_EXCEPTION("emcore_insert_send_event failed [%d]", err);
+                                       err = EMF_ERROR_NONE;
+                                       goto FINISH_OFF;
+                               }
+                       }
+#endif                 
+               break;
+
+               default:
+                       EM_DEBUG_EXCEPTION("unknown account bind type...");
+                       err = EMF_ERROR_INVALID_ACCOUNT;
+                       goto FINISH_OFF;
+       }
+       
+FINISH_OFF:
+
+       EM_DEBUG_FUNC_END("err [%d]", err);
+       return err;
+}
+
+
+int _emdaemon_check_mail_id(int mail_id, int* err_code)
+{
+       EM_DEBUG_FUNC_BEGIN("mail_id[%d], err_code[%p]", mail_id, err_code);
+       
+       int ret = false;
+       int err = EMF_ERROR_NONE;
+       
+       emstorage_mail_tbl_t* mail = NULL;
+       
+       if (!emstorage_get_mail_field_by_id(mail_id, RETRIEVE_SUMMARY, &mail, true, &err))  {
+               EM_DEBUG_EXCEPTION("emstorage_get_mail_field_by_id failed [%d]", err);
+               goto FINISH_OFF;
+       }
+       
+       ret = true;
+
+FINISH_OFF:
+       if (mail != NULL)
+               emstorage_free_mail(&mail, 1, NULL);
+       
+       if (err_code != NULL)
+               *err_code = err;
+       EM_DEBUG_FUNC_END();
+       return ret;
+}
+
+
+INTERNAL_FUNC int emdaemon_send_mail_retry( int mail_id,  int timeout_in_sec, int* err_code)
+{
+       int ret = false;
+       int err = EMF_ERROR_NONE;
+       long nTimerValue = 0;
+       char mail_id_string[10] = { 0, };
+       emf_mailbox_t mailbox;
+       emstorage_mail_tbl_t* mail_table_data = NULL;
+       emf_option_t opt;
+       
+       memset(&opt, 0x00, sizeof(emf_option_t));
+       memset(&mailbox, 0x00, sizeof(emf_mailbox_t));
+
+       if (!_emdaemon_check_mail_id(mail_id, &err))  {
+               EM_DEBUG_EXCEPTION("_emdaemon_check_mail_id failed [%d]", err);
+               goto FINISH_OFF;
+       }       
+
+       if( ! emstorage_get_mail_by_id(mail_id, &mail_table_data, false, &err) && !mail_table_data)  {
+               EM_DEBUG_EXCEPTION("emstorage_get_mail_by_id failed [%d]", err);
+               goto FINISH_OFF;                
+       }
+       
+       mailbox.name = EM_SAFE_STRDUP(mail_table_data->mailbox_name);
+
+       memcpy(&opt, emcore_get_option(&err), sizeof(emf_option_t));
+
+       if( mail_table_data ) {
+               mailbox.account_id = mail_table_data->account_id;
+               opt.priority       = mail_table_data->priority;
+       }
+       
+       if ( timeout_in_sec == 0 ) {
+               if(!emdaemon_send_mail(&mailbox, mail_id, &opt, NULL, &err)) {
+                       EM_DEBUG_EXCEPTION("emdaemon_send_mail failed [%d]", err);
+                       goto FINISH_OFF;
+               }                       
+       }
+       else if ( timeout_in_sec > 0 ) {
+               sprintf(mail_id_string,"%d",mail_id);
+               nTimerValue = timeout_in_sec * 1000;
+               if ( emcore_set_timer_ex(nTimerValue, (EMF_TIMER_CALLBACK) _OnMailSendRetryTimerCB, (void*)mail_id_string) <= 0) {
+                       EM_DEBUG_EXCEPTION("Failed to start timer");
+                       goto FINISH_OFF;
+               }
+       }
+       ret = true;
+
+FINISH_OFF:
+       if (err_code)
+               *err_code = err;
+
+       if(mail_table_data)
+               emstorage_free_mail(&mail_table_data, 1, NULL);
+
+       EM_SAFE_FREE(mailbox.name);
+       
+       return ret;
+}
+
+
+INTERNAL_FUNC void _OnMailSendRetryTimerCB( void* data )
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int err = EMF_ERROR_NONE;
+       emf_mailbox_t mailbox;
+       emstorage_mail_tbl_t* mail_table_data = NULL;   
+       int mail_id = 0 ;
+       emf_option_t opt;
+
+       memset( &opt, 0x00, sizeof(emf_option_t));
+       memset( &mailbox, 0x00, sizeof(emf_mailbox_t));
+
+       if( !data ) {
+               EM_DEBUG_LOG("Invalid param");
+               goto FINISH_OFF;
+       }
+
+       mail_id = atoi((char*)data);
+       
+
+       if (!_emdaemon_check_mail_id(mail_id, &err))  {
+               EM_DEBUG_EXCEPTION("_emdaemon_check_mail_id failed [%d]", err);
+               goto FINISH_OFF;
+       }       
+       
+       if( ! emstorage_get_mail_by_id(mail_id, &mail_table_data, false, &err) && !mail_table_data) {
+               EM_DEBUG_EXCEPTION("emstorage_get_mail_by_id failed [%d]", err);
+               goto FINISH_OFF;                
+       }
+
+       mailbox.name = EM_SAFE_STRDUP(mail_table_data->mailbox_name);
+       memcpy(&opt, emcore_get_option(&err), sizeof(emf_option_t));
+
+       if( mail_table_data ) {
+               opt.priority       = mail_table_data->priority;
+               mailbox.account_id = mail_table_data->account_id;
+       }
+       
+       if(!emdaemon_send_mail(&mailbox, mail_id, &opt, NULL, &err)) {
+               EM_DEBUG_EXCEPTION("emdaemon_send_mail failed [%d]", err);
+               goto FINISH_OFF;
+       }
+
+FINISH_OFF:
+       if(mail_table_data)
+               emstorage_free_mail(&mail_table_data, 1, NULL);
+
+       EM_SAFE_FREE(mailbox.name);
+       
+       EM_DEBUG_FUNC_END();
+       return;
+}
+
+INTERNAL_FUNC int emdaemon_move_mail_thread_to_mailbox(int thread_id, char *target_mailbox_name, int move_always_flag, int *err_code)
+{
+       EM_DEBUG_FUNC_BEGIN("thread_id [%d], target_mailbox_name [%p], move_always_flag [%d], err_code [%p]", thread_id, target_mailbox_name, move_always_flag, err_code);
+       int ret = false;
+       int err = EMF_ERROR_NONE;
+       int *mail_id_list = NULL, result_count = 0, i, mailbox_count = 0, account_id;
+       emf_mail_list_item_t *mail_list = NULL;
+       emf_mailbox_t *target_mailbox_list = NULL, *target_mailbox = NULL;
+
+       if (!target_mailbox_name) {
+               EM_DEBUG_EXCEPTION("target_mailbox [%p]", target_mailbox_name);
+               err = EMF_ERROR_INVALID_PARAM;
+               goto FINISH_OFF;
+       }
+
+       if (!emstorage_get_mail_list(0, NULL, NULL, thread_id, -1, -1, 0, NULL, EMF_SORT_DATETIME_HIGH, true, &mail_list, &result_count, &err) || !mail_list || !result_count) {
+               EM_DEBUG_EXCEPTION("emstorage_get_mail_list failed [%d]", err);
+
+               goto FINISH_OFF;
+       }
+       
+       mail_id_list = em_malloc(sizeof(int) * result_count);
+       
+       if (mail_id_list == NULL) {
+               EM_DEBUG_EXCEPTION("em_malloc failed...");
+               err = EMF_ERROR_OUT_OF_MEMORY;
+               goto FINISH_OFF;
+       }
+
+       for(i = 0; i < result_count; i++) {
+               mail_id_list[i] = mail_list[i].mail_id;
+       }
+       account_id = mail_list[0].account_id;
+
+
+       if (!emcore_get_list(account_id, &target_mailbox_list, &mailbox_count, &err)) {
+               EM_DEBUG_EXCEPTION("emcore_get_list failed [%d]", err);
+               goto FINISH_OFF;
+       }
+
+       for(i = 0; i < mailbox_count; i++) {
+               EM_DEBUG_LOG("%s %s", target_mailbox_list[i].name, target_mailbox_name);
+               if(strcmp(target_mailbox_list[i].name, target_mailbox_name) == 0) {
+                       target_mailbox = (target_mailbox_list + i);
+                       break;
+               }
+       }
+
+       if(!target_mailbox) {
+               EM_DEBUG_EXCEPTION("couldn't find proper target mailbox.");
+               goto FINISH_OFF;
+       }
+
+       if (!emdaemon_move_mail(mail_id_list, result_count, target_mailbox, EMF_MOVED_BY_MOVING_THREAD, move_always_flag, &err)) {
+               EM_DEBUG_EXCEPTION("emdaemon_move_mail failed [%d]", err);
+               goto FINISH_OFF;
+       }
+
+       if (!emstorage_notify_storage_event(NOTI_THREAD_MOVE, account_id, thread_id, target_mailbox_name, move_always_flag)) 
+               EM_DEBUG_EXCEPTION(" emstorage_notify_storage_event Failed [NOTI_MAIL_MOVE] >>>> ");
+
+       ret = true;
+       
+FINISH_OFF:
+       if (!emcore_free_mailbox(&target_mailbox_list, mailbox_count, &err)) 
+               EM_DEBUG_EXCEPTION("target_mailbox_list failed [%d]", err);
+       EM_SAFE_FREE(mail_list);
+       EM_SAFE_FREE(mail_id_list);
+
+       if (err_code)
+               *err_code = err;
+       EM_DEBUG_FUNC_END();
+       return ret;
+}
+
+INTERNAL_FUNC int emdaemon_delete_mail_thread(int thread_id, int delete_always_flag, unsigned* handle, int *err_code)
+{
+       EM_DEBUG_FUNC_BEGIN("thread_id [%d], delete_always_flag [%d], err_code [%p]", thread_id, delete_always_flag, err_code);
+       int ret = false;
+       int err = EMF_ERROR_NONE;
+       int account_id, *mail_id_list = NULL, result_count = 0, i;
+       emf_mail_list_item_t *mail_list = NULL;
+
+       if (!emstorage_get_mail_list(0, NULL, NULL, thread_id, -1, -1, 0, NULL, EMF_SORT_MAILBOX_NAME_HIGH, true, &mail_list, &result_count, &err) || !mail_list || !result_count) {
+               EM_DEBUG_EXCEPTION("emstorage_get_mail_list failed [%d]", err);
+
+               goto FINISH_OFF;
+       }
+       
+       mail_id_list = em_malloc(sizeof(int) * result_count);
+       
+       if (mail_id_list == NULL) {
+               EM_DEBUG_EXCEPTION("em_malloc failed...");
+               err = EMF_ERROR_OUT_OF_MEMORY;
+               goto FINISH_OFF;
+       }
+
+       for(i = 0; i < result_count; i++) {
+               mail_id_list[i] = mail_list[i].mail_id;
+       }
+
+       account_id = mail_list[0].account_id;
+
+       // should remove requiring of mailbox information from this function. 
+       // email-service should find mailboxes itself by its mail id.
+       if (!emdaemon_delete_mail(account_id, NULL, mail_id_list, result_count, false, handle, &err)) {
+               EM_DEBUG_EXCEPTION("emdaemon_delete_mail failed [%d]", err);
+               goto FINISH_OFF;
+       }
+
+       if (!emstorage_notify_storage_event(NOTI_THREAD_DELETE, account_id, thread_id, NULL, delete_always_flag)) 
+               EM_DEBUG_EXCEPTION(" emstorage_notify_storage_event Failed [NOTI_MAIL_MOVE] >>>> ");
+
+       ret = true;
+       
+FINISH_OFF:
+       EM_SAFE_FREE(mail_list);
+       EM_SAFE_FREE(mail_id_list);
+
+       if (err_code)
+               *err_code = err;
+       EM_DEBUG_FUNC_END();
+       return ret;
+}
+
+INTERNAL_FUNC int emdaemon_modify_seen_flag_of_thread(int thread_id, int seen_flag, int on_server, unsigned* handle, int *err_code)
+{
+       EM_DEBUG_FUNC_BEGIN("thread_id [%d], seen_flag [%d], on_server [%d], handle [%p], err_code [%p]", thread_id, seen_flag, on_server, handle, err_code);
+       int ret = false;
+       int err = EMF_ERROR_NONE;
+       int account_id, *mail_id_list = NULL, result_count = 0, i;
+       emf_mail_list_item_t *mail_list = NULL;
+
+       if (!emstorage_get_mail_list(0, NULL, NULL, thread_id, -1, -1, 0, NULL, EMF_SORT_MAILBOX_NAME_HIGH, true, &mail_list, &result_count, &err) || !mail_list || !result_count) {
+               EM_DEBUG_EXCEPTION("emstorage_get_mail_list failed [%d]", err);
+
+               goto FINISH_OFF;
+       }
+       
+       mail_id_list = em_malloc(sizeof(int) * result_count);
+       
+       if (mail_id_list == NULL) {
+               EM_DEBUG_EXCEPTION("em_malloc failed...");
+               err = EMF_ERROR_OUT_OF_MEMORY;
+               goto FINISH_OFF;
+       }
+
+       for(i = 0; i < result_count; i++) {
+               mail_id_list[i] = mail_list[i].mail_id;
+       }
+
+       account_id = mail_list[0].account_id;
+
+       if (!emdaemon_set_flags_field(account_id, mail_id_list, result_count, EMF_FLAGS_SEEN_FIELD, seen_flag, on_server, &err)) {
+               EM_DEBUG_EXCEPTION("emdaemon_set_flags_field failed [%d]", err);
+               goto FINISH_OFF;
+       }
+
+       if (!emstorage_notify_storage_event(NOTI_THREAD_MODIFY_SEEN_FLAG, account_id, thread_id, NULL, seen_flag)) 
+               EM_DEBUG_EXCEPTION(" emstorage_notify_storage_event Failed [NOTI_MAIL_MOVE] >>>> ");
+
+       ret = true;
+       
+FINISH_OFF:
+       EM_SAFE_FREE(mail_list);
+       EM_SAFE_FREE(mail_id_list);
+
+       if (err_code)
+               *err_code = err;
+       EM_DEBUG_FUNC_END();
+       return ret;
+}
similarity index 71%
rename from email-engine/emf-mailbox.c
rename to email-daemon/email-daemon-mailbox.c
index ba75ea3..049c419 100755 (executable)
@@ -22,8 +22,8 @@
 
 
 /******************************************************************************
- * File: emf-mailbox.c
- * Desc: Mail Framework Mailbox Operation
+ * File: email-daemon-mailbox.c
+ * Desc: email-daemon Mailbox Operation
  *
  * Auth: 
  *
 #include <stdlib.h>
 #include <string.h>
 
-#include "emflib.h"
-#include "emf-global.h"
-#include "em-core-event.h"
-#include "emf-account.h"
-#include "emf-dbglog.h"
-#include "em-core-mailbox.h"
-#include "em-core-global.h"
-#include "em-core-utils.h"
+#include "email-daemon.h"
+#include "email-core-event.h"
+#include "email-daemon-account.h"
+#include "email-debug-log.h"
+#include "email-core-mailbox.h"
+#include "email-core-global.h"
+#include "email-core-utils.h"
 
-#ifdef __LOCAL_ACTIVITY__
+#ifdef __FEATURE_LOCAL_ACTIVITY__
 extern int g_local_activity_run;
 #endif
 
-EXPORT_API int
-emf_mailbox_get_imap_mailbox_list(int account_id, char* mailbox, unsigned* handle, int* err_code)
+INTERNAL_FUNC int emdaemon_get_imap_mailbox_list(int account_id, char* mailbox, unsigned* handle, int* err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d] mailbox[%p] err_code[%p]", account_id, mailbox, err_code);
 
@@ -62,10 +60,10 @@ emf_mailbox_get_imap_mailbox_list(int account_id, char* mailbox, unsigned* handl
                goto FINISH_OFF;
        }
 
-       emf_account_t* ref_account = emf_get_account_reference(account_id);
+       emf_account_t* ref_account = emdaemon_get_account_reference(account_id);
        
        if (!ref_account)  {
-               EM_DEBUG_EXCEPTION("emf_get_account_reference failed [%d]", account_id);
+               EM_DEBUG_EXCEPTION("emdaemon_get_account_reference failed [%d]", account_id);
                err = EMF_ERROR_INVALID_ACCOUNT;
                goto FINISH_OFF;
        }
@@ -79,8 +77,8 @@ emf_mailbox_get_imap_mailbox_list(int account_id, char* mailbox, unsigned* handl
                        event_data.account_id = account_id;
                        event_data.event_param_data_3 = EM_SAFE_STRDUP(mailbox);
 
-                       if (!em_core_insert_event(&event_data, (int*)handle, &err))  { 
-                               EM_DEBUG_EXCEPTION("em_core_insert_event failed [%d]", err);
+                       if (!emcore_insert_event(&event_data, (int*)handle, &err))  { 
+                               EM_DEBUG_EXCEPTION("emcore_insert_event failed [%d]", err);
                                goto FINISH_OFF;
                        }
                        break;
@@ -103,7 +101,7 @@ FINISH_OFF:
 
        
 
-EXPORT_API int emf_mailbox_get_list(int account_id, emf_mailbox_t** mailbox_list, int* count, int* err_code)
+INTERNAL_FUNC int emdaemon_get_mailbox_list(int account_id, emf_mailbox_t** mailbox_list, int* count, int* err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id[%d], mailbox_list[%p], count[%p], err_code[%p]", account_id, mailbox_list, count, err_code);
        
@@ -116,18 +114,18 @@ EXPORT_API int emf_mailbox_get_list(int account_id, emf_mailbox_t** mailbox_list
                goto FINISH_OFF;
        }
        
-       emf_account_t* ref_account = emf_get_account_reference(account_id);
+       emf_account_t* ref_account = emdaemon_get_account_reference(account_id);
        
        if (!ref_account)  {
-               EM_DEBUG_EXCEPTION("emf_get_account_reference failed [%d]", account_id);
+               EM_DEBUG_EXCEPTION("emdaemon_get_account_reference failed [%d]", account_id);
                err = EMF_ERROR_INVALID_ACCOUNT;
                goto FINISH_OFF;
        }
        
        switch (ref_account->account_bind_type)  {
                case EMF_BIND_TYPE_EM_CORE:
-                       if (!em_core_mailbox_get_list(account_id, mailbox_list, count, &err))  {
-                               EM_DEBUG_EXCEPTION("em_core_mailbox_get_list failed [%d]", err);
+                       if (!emcore_get_list(account_id, mailbox_list, count, &err))  {
+                               EM_DEBUG_EXCEPTION("emcore_get_list failed [%d]", err);
                                goto FINISH_OFF;
                        }
                        break;
@@ -148,7 +146,7 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int emf_mailbox_get_mail_count(emf_mailbox_t* mailbox, int* total, int* unseen, int* err_code)
+INTERNAL_FUNC int emdaemon_get_mail_count_of_mailbox(emf_mailbox_t* mailbox, int* total, int* unseen, int* err_code)
 {
        EM_DEBUG_FUNC_BEGIN("mailbox[%p], total[%p], unseen[%p], err_code[%p]", mailbox, total, unseen, err_code);
        
@@ -162,17 +160,17 @@ EXPORT_API int emf_mailbox_get_mail_count(emf_mailbox_t* mailbox, int* total, in
                goto FINISH_OFF;
        }
        
-       emf_account_t* ref_account = emf_get_account_reference(mailbox->account_id);
+       emf_account_t* ref_account = emdaemon_get_account_reference(mailbox->account_id);
        if (ref_account == NULL)  {     
-               EM_DEBUG_EXCEPTION(" emf_get_account_reference failed [%d]", mailbox->account_id);
+               EM_DEBUG_EXCEPTION(" emdaemon_get_account_reference failed [%d]", mailbox->account_id);
                err = EMF_ERROR_INVALID_ACCOUNT;                
                goto FINISH_OFF;
        }
        
        switch (ref_account->account_bind_type)  {
                case EMF_BIND_TYPE_EM_CORE: 
-                       if (!em_core_mailbox_get_mail_count(mailbox, total, unseen, &err))  {
-                               EM_DEBUG_EXCEPTION("em_core_mailbox_get_mail_count failed [%d]", err);
+                       if (!emcore_get_mail_count(mailbox, total, unseen, &err))  {
+                               EM_DEBUG_EXCEPTION("emcore_get_mail_count failed [%d]", err);
                                goto FINISH_OFF;
                        }
                        break;
@@ -192,7 +190,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int emf_mailbox_create(emf_mailbox_t* new_mailbox, int on_server, unsigned* handle, int* err_code)
+INTERNAL_FUNC int emdaemon_add_mailbox(emf_mailbox_t* new_mailbox, int on_server, unsigned* handle, int* err_code)
 {
        EM_DEBUG_FUNC_BEGIN("new_mailbox[%p], err_code[%p]", new_mailbox, err_code);
        
@@ -206,10 +204,10 @@ EXPORT_API int emf_mailbox_create(emf_mailbox_t* new_mailbox, int on_server, uns
                goto FINISH_OFF;
        }
        
-       emf_account_t* ref_account = emf_get_account_reference(new_mailbox->account_id);
+       emf_account_t* ref_account = emdaemon_get_account_reference(new_mailbox->account_id);
        
        if (!ref_account)  {
-               EM_DEBUG_EXCEPTION("emf_get_account_reference failed [%d]", new_mailbox->account_id);
+               EM_DEBUG_EXCEPTION("emdaemon_get_account_reference failed [%d]", new_mailbox->account_id);
                err = EMF_ERROR_INVALID_ACCOUNT;
                goto FINISH_OFF;
        }
@@ -230,14 +228,14 @@ EXPORT_API int emf_mailbox_create(emf_mailbox_t* new_mailbox, int on_server, uns
                                event_data.event_param_data_2 = EM_SAFE_STRDUP(new_mailbox->alias);
                                event_data.event_param_data_4 = on_server;
                                event_data.event_param_data_3 = GINT_TO_POINTER(new_mailbox->mailbox_type);
-                               if(!em_core_insert_event(&event_data, (int*)handle, &err))    {
-                                       EM_DEBUG_EXCEPTION("em_core_insert_event failed [%d]", err);
+                               if(!emcore_insert_event(&event_data, (int*)handle, &err))    {
+                                       EM_DEBUG_EXCEPTION("emcore_insert_event failed [%d]", err);
                                        goto FINISH_OFF;
                                }
                        }
                        else {  /*  sync */
-                               if (!em_core_mailbox_create(new_mailbox, on_server, &err))  {
-                                       EM_DEBUG_EXCEPTION("em_core_mailbox_create failed [%d]", err);
+                               if (!emcore_create_mailbox(new_mailbox, on_server, &err))  {
+                                       EM_DEBUG_EXCEPTION("emcore_create failed [%d]", err);
                                        goto FINISH_OFF;
                                }
                        }
@@ -260,7 +258,7 @@ FINISH_OFF:
 }
 
 
-EXPORT_API int emf_mailbox_update(emf_mailbox_t* old_mailbox, emf_mailbox_t* new_mailbox, int on_server, unsigned* handle, int* err_code)
+INTERNAL_FUNC int emdaemon_update_mailbox(emf_mailbox_t* old_mailbox, emf_mailbox_t* new_mailbox, int on_server, unsigned* handle, int* err_code)
 {
        EM_DEBUG_FUNC_BEGIN("old_mailbox[%p], new_mailbox[%p], on_server[%d], handle[%p], err_code[%p]", old_mailbox, new_mailbox, on_server, handle, err_code);
        
@@ -280,10 +278,10 @@ EXPORT_API int emf_mailbox_update(emf_mailbox_t* old_mailbox, emf_mailbox_t* new
                goto FINISH_OFF;
        }
        
-       emf_account_t* ref_account = emf_get_account_reference(old_mailbox->account_id);
+       emf_account_t* ref_account = emdaemon_get_account_reference(old_mailbox->account_id);
        
        if (!ref_account)  {
-               EM_DEBUG_EXCEPTION("emf_get_account_reference failed [%d]", old_mailbox->account_id);
+               EM_DEBUG_EXCEPTION("emdaemon_get_account_reference failed [%d]", old_mailbox->account_id);
                err = EMF_ERROR_INVALID_ACCOUNT;                /*  instead of EMF_ERROR_INVALID_PARAM; */
                goto FINISH_OFF;
        }
@@ -306,21 +304,21 @@ EXPORT_API int emf_mailbox_update(emf_mailbox_t* old_mailbox, emf_mailbox_t* new
                                event_data.event_param_data_2 = ;
                                event_data.event_param_data_4 = on_server;
                                event_data.event_param_data_3 = GINT_TO_POINTER(new_mailbox->mailbox_type);
-                               if(!em_core_insert_event(&event_data, handle, &err))  {
-                                       EM_DEBUG_EXCEPTION("em_core_insert_event failed [%d]", err);
+                               if(!emcore_insert_event(&event_data, handle, &err))  {
+                                       EM_DEBUG_EXCEPTION("emcore_insert_event failed [%d]", err);
                                        goto FINISH_OFF;
                                }
                        }
                        else {  
-                               if (!em_core_mailbox_modify(old_mailbox, new_mailbox, on_server, &err))  {
-                                       EM_DEBUG_EXCEPTION("em_core_mailbox_create failed [%d]", err);
+                               if (!emcore_modify(old_mailbox, new_mailbox, on_server, &err))  {
+                                       EM_DEBUG_EXCEPTION("emcore_create failed [%d]", err);
                                        goto FINISH_OFF;
                                }
                        }
                        */
                        /*  Update mailbox information only on local db */
-                       if (!em_core_mailbox_update(old_mailbox, new_mailbox, &err))  {
-                               EM_DEBUG_EXCEPTION("em_core_mailbox_modify failed [%d]", err);
+                       if (!emcore_update_mailbox(old_mailbox, new_mailbox, &err))  {
+                               EM_DEBUG_EXCEPTION("emcore_modify failed [%d]", err);
                                goto FINISH_OFF;
                        }
                        break;
@@ -343,7 +341,7 @@ FINISH_OFF:
 
 
 
-EXPORT_API int emf_mailbox_delete(emf_mailbox_t* mailbox, int on_server, unsigned* handle, int* err_code)
+INTERNAL_FUNC int emdaemon_delete_mailbox(emf_mailbox_t* mailbox, int on_server, unsigned* handle, int* err_code)
 {
        EM_DEBUG_FUNC_BEGIN("mailbox[%p], err_code[%p]", mailbox, err_code);
        
@@ -358,11 +356,11 @@ EXPORT_API int emf_mailbox_delete(emf_mailbox_t* mailbox, int on_server, unsigne
                goto FINISH_OFF;
        }
        
-       emf_account_t* ref_account = emf_get_account_reference(mailbox->account_id);
+       emf_account_t* ref_account = emdaemon_get_account_reference(mailbox->account_id);
        
 
        if (!ref_account)  {
-               EM_DEBUG_EXCEPTION("emf_get_account_reference failed [%d]", mailbox->account_id);
+               EM_DEBUG_EXCEPTION("emdaemon_get_account_reference failed [%d]", mailbox->account_id);
                err = EMF_ERROR_INVALID_ACCOUNT;
                goto FINISH_OFF;
        }
@@ -381,15 +379,15 @@ EXPORT_API int emf_mailbox_delete(emf_mailbox_t* mailbox, int on_server, unsigne
                                event_data.account_id = mailbox->account_id;
                                event_data.event_param_data_1 = EM_SAFE_STRDUP(mailbox->name);
                                event_data.event_param_data_4 = on_server;
-                               if(!em_core_insert_event(&event_data, (int*)handle, &err))    {
-                                       EM_DEBUG_EXCEPTION("em_core_insert_event failed [%d]", err);
+                               if(!emcore_insert_event(&event_data, (int*)handle, &err))    {
+                                       EM_DEBUG_EXCEPTION("emcore_insert_event failed [%d]", err);
                                        goto FINISH_OFF;
                                }
                        }
 
                        else {
-                               if (!em_core_mailbox_delete(mailbox, on_server,  &err))  {
-                                       EM_DEBUG_EXCEPTION("em_core_mailbox_delete failed [%d]", err);
+                               if (!emcore_delete_mailbox(mailbox, on_server,  &err))  {
+                                       EM_DEBUG_EXCEPTION("emcore_delete failed [%d]", err);
                                        goto FINISH_OFF;
                                }
                        }
@@ -410,8 +408,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int
-emf_mailbox_delete_all(emf_mailbox_t* mailbox, int* err_code)
+INTERNAL_FUNC int emdaemon_delete_mailbox_all(emf_mailbox_t* mailbox, int* err_code)
 {
        EM_DEBUG_FUNC_BEGIN("malibox[%p], err_code[%p]", mailbox, err_code);
        
@@ -426,19 +423,19 @@ emf_mailbox_delete_all(emf_mailbox_t* mailbox, int* err_code)
                goto FINISH_OFF;
        }
        
-       emf_account_t* ref_account = emf_get_account_reference(mailbox->account_id);
+       emf_account_t* ref_account = emdaemon_get_account_reference(mailbox->account_id);
        
 
        if (!ref_account)  {
-               EM_DEBUG_EXCEPTION("emf_get_account_reference failed [%d]", mailbox->account_id);
+               EM_DEBUG_EXCEPTION("emdaemon_get_account_reference failed [%d]", mailbox->account_id);
                err = EMF_ERROR_INVALID_ACCOUNT;
                goto FINISH_OFF;
        }
        
        switch (ref_account->account_bind_type)  {
                case EMF_BIND_TYPE_EM_CORE:
-                       if (!em_core_mailbox_delete_all(mailbox, &err))  {
-                               EM_DEBUG_EXCEPTION("em_core_mailbox_delete_all failed [%d]", err);
+                       if (!emcore_delete_mailbox_all(mailbox, &err))  {
+                               EM_DEBUG_EXCEPTION("emcore_delete_all failed [%d]", err);
                                goto FINISH_OFF;
                        }
                        break;
@@ -460,14 +457,14 @@ FINISH_OFF:
 
        
 
-EXPORT_API int emf_mailbox_free(emf_mailbox_t** mailbox_list, int count, int* err_code)
+INTERNAL_FUNC int emdaemon_free_mailbox(emf_mailbox_t** mailbox_list, int count, int* err_code)
 {
        EM_DEBUG_FUNC_BEGIN();
-       return em_core_mailbox_free(mailbox_list, count, err_code);
+       return emcore_free_mailbox(mailbox_list, count, err_code);
 }
                
 
-EXPORT_API int emf_mailbox_sync_header(emf_mailbox_t* mailbox,  unsigned* handle, int* err_code)
+INTERNAL_FUNC int emdaemon_sync_header(emf_mailbox_t* mailbox,  unsigned* handle, int* err_code)
 {
        EM_DEBUG_FUNC_BEGIN("mailbox[%p], handle[%p], err_code[%p]", mailbox, handle, err_code);
        
@@ -486,7 +483,7 @@ EXPORT_API int emf_mailbox_sync_header(emf_mailbox_t* mailbox,  unsigned* handle
        memset(&event_data, 0x00, sizeof(emf_event_t));
 
        if(mailbox->account_id == ALL_ACCOUNT) {
-               EM_DEBUG_LOG(">>>> emf_mailbox_sync_header for all account event_data.event_param_data_4 [%d]", event_data.event_param_data_4);
+               EM_DEBUG_LOG(">>>> emdaemon_sync_header for all account event_data.event_param_data_4 [%d]", event_data.event_param_data_4);
                event_data.type = EMF_EVENT_SYNC_HEADER;
                event_data.event_param_data_1 = mailbox ? EM_SAFE_STRDUP(mailbox->name) : NULL;
                event_data.event_param_data_3 = NULL;
@@ -495,15 +492,15 @@ EXPORT_API int emf_mailbox_sync_header(emf_mailbox_t* mailbox,  unsigned* handle
                if (!event_data.event_param_data_1)
                        event_data.event_param_data_4 = EMF_SYNC_ALL_MAILBOX;
                
-               if (!em_core_insert_event(&event_data, (int*)handle, &err))   {
-                       EM_DEBUG_EXCEPTION("em_core_insert_event falied [%d]", err);
+               if (!emcore_insert_event(&event_data, (int*)handle, &err))   {
+                       EM_DEBUG_EXCEPTION("emcore_insert_event falied [%d]", err);
                        goto FINISH_OFF;
                }
        }
        else {
        
-               if (!(ref_account = emf_get_account_reference(mailbox->account_id))) {
-                       EM_DEBUG_EXCEPTION("emf_get_account_reference failed [%d]", mailbox->account_id);
+               if (!(ref_account = emdaemon_get_account_reference(mailbox->account_id))) {
+                       EM_DEBUG_EXCEPTION("emdaemon_get_account_reference failed [%d]", mailbox->account_id);
                        err = EMF_ERROR_INVALID_ACCOUNT;
                        goto FINISH_OFF;
                }
@@ -520,8 +517,8 @@ EXPORT_API int emf_mailbox_sync_header(emf_mailbox_t* mailbox,  unsigned* handle
                                        event_data.event_param_data_4 = EMF_SYNC_ALL_MAILBOX;
                                EM_DEBUG_LOG(">>>> EVENT ARG [ %d ] ", event_data.event_param_data_4);
                                
-                               if (!em_core_insert_event(&event_data, (int*)handle, &err))   {
-                                       EM_DEBUG_EXCEPTION("em_core_insert_event falied [%d]", err);
+                               if (!emcore_insert_event(&event_data, (int*)handle, &err))   {
+                                       EM_DEBUG_EXCEPTION("emcore_insert_event falied [%d]", err);
                                        goto FINISH_OFF;
                                }
                                break;
@@ -533,7 +530,7 @@ EXPORT_API int emf_mailbox_sync_header(emf_mailbox_t* mailbox,  unsigned* handle
                }
        }
        
-#ifdef __LOCAL_ACTIVITY__      
+#ifdef __FEATURE_LOCAL_ACTIVITY__      
        EM_DEBUG_LOG("Setting g_local_activity_run ");
        g_local_activity_run = 1;       
 #endif
@@ -547,8 +544,7 @@ FINISH_OFF:
        return ret;
 }
 
-EXPORT_API int
-emf_mailbox_set_mail_slot_size(int account_id, char* mailbox_name, int new_slot_size, unsigned* handle, int *err_code)
+INTERNAL_FUNC int emdaemon_set_mail_slot_size_of_mailbox(int account_id, char* mailbox_name, int new_slot_size, unsigned* handle, int *err_code)
 {
        EM_DEBUG_FUNC_BEGIN("account_id [%d], mailbox_name[%p], handle[%p], err_code[%p]", account_id, mailbox_name, handle, err_code);
 
@@ -569,8 +565,8 @@ emf_mailbox_set_mail_slot_size(int account_id, char* mailbox_name, int new_slot_
        event_data.event_param_data_3 = EM_SAFE_STRDUP(mailbox_name);
        event_data.account_id = account_id;
        
-       if (!em_core_insert_event(&event_data, (int*)handle, &err))   {
-               EM_DEBUG_EXCEPTION("em_core_insert_event falied [%d]", err);
+       if (!emcore_insert_event(&event_data, (int*)handle, &err))   {
+               EM_DEBUG_EXCEPTION("emcore_insert_event falied [%d]", err);
                goto FINISH_OFF;
        }
        
similarity index 76%
rename from include/emf-account.h
rename to email-daemon/include/email-daemon-account.h
index 1891fda..c6ea1d3 100755 (executable)
 
 
 /******************************************************************************
- * File: emf-account.h
- * Desc: Mail Framework Account Header
+ * File: email-daemon-account.h
+ * Desc: email-daemon Account Header
  *
  * Auth:
  *
  * History:
  *    2006.08.01 : created
  *****************************************************************************/
-#ifndef __EMF_ACCONT_H__
-#define __EMF_ACCONT_H__
+#ifndef __EMAIL_DAEMON_ACCONT_H__
+#define __EMAIL_DAEMON_ACCONT_H__
 
 #ifdef __cplusplus
 extern "C"
 {
 #endif /* __cplusplus */
 
-#include "emflib.h"
+#include "email-daemon.h"
 
-       int
-       emf_init_account_reference();
-    emf_account_t* 
-    emf_get_account_reference(int account_id);
-    int     emf_free_account_reference(void);
+int            emdaemon_initialize_account_reference();
+emf_account_t* emdaemon_get_account_reference(int account_id);
+int            emdaemon_free_account_reference(void);
 
 #ifdef __cplusplus
 }
similarity index 65%
rename from include/emf-auto-poll.h
rename to email-daemon/include/email-daemon-auto-poll.h
index 1f8cd98..be30041 100755 (executable)
 
 /**
  * This file defines all APIs of Auto Poll.
- * @file       emf-auto-poll.h
+ * @file       email-daemon-auto-poll.h
  * @author  
  * @version    0.1
  * @brief      This file is the header file of Auto Poll.
  */
-#ifndef __EMF_AUTO_POLL_H__
-#define __EMF_AUTO_POLL_H__
+#ifndef __EMAIL_DAEMON_AUTO_POLL_H__
+#define __EMAIL_DAEMON_AUTO_POLL_H__
 
-#include "em-core-types.h"
+#include "email-internal-types.h"
+#include "alarm.h"
 
 #ifdef __FEATURE_AUTO_POLLING__
 
@@ -39,18 +40,12 @@ extern "C"
 {
 #endif /* __cplusplus */
 
- #include "alarm.h"
 
-#if !defined(EXPORT_API)
-#define EXPORT_API __attribute__((visibility("default")))
-#endif
-
-
-EXPORT_API int emf_add_polling_alarm(int account_id, int alarm_interval);
-EXPORT_API int emf_remove_polling_alarm(int account_id);
-EXPORT_API int is_auto_polling_started(int account_id);
-EXPORT_API int emf_alarm_polling_cb(alarm_id_t  alarm_id, void* user_param);
-EXPORT_API int emf_free_account_alarm_binder_list();
+INTERNAL_FUNC int emdaemon_add_polling_alarm(int account_id, int alarm_interval);
+INTERNAL_FUNC int emdaemon_remove_polling_alarm(int account_id);
+INTERNAL_FUNC int emdaemon_check_auto_polling_started(int account_id);
+INTERNAL_FUNC int emdaemon_alarm_polling_cb(alarm_id_t  alarm_id, void* user_param);
+INTERNAL_FUNC int emdaemon_free_account_alarm_binder_list();
 
 #ifdef __cplusplus
 }
@@ -58,5 +53,5 @@ EXPORT_API int emf_free_account_alarm_binder_list();
 
 #endif /* __FEATURE_AUTO_POLLING__ */
 
-#endif /* __EMF_AUTO_POLL_H__ */
+#endif /* __EMAIL_DAEMON_AUTO_POLL_H__ */
 /* EOF */
similarity index 70%
rename from include/emf-emn.h
rename to email-daemon/include/email-daemon-emn.h
index 01815f9..3607cf7 100755 (executable)
 
 /**
  * This file defines all APIs of EMN.
- * @file       emf-emn.h
+ * @file       email-daemon-emn.h
  * @author     Kyuho Jo(kyuho.jo@samsung.com)
  * @version    0.1
  * @brief      This file is the header file of EMN library.
  */
 
-#ifndef __EMF_EMN_H__
-#define __EMF_EMN_H__
+#ifndef __EMAIL_DAEMON_EMN_H__
+#define __EMAIL_DAEMON_EMN_H__
 
 /**
-* @ingroup EMAIL_FRAMEWORK
+* @ingroup EMAIL_SERVICE
 * @defgroup EMN EMN
 * @{
 */
 
+#include "email-internal-types.h"
+
 #ifdef __cplusplus
 extern "C"
 {
 #endif /* __cplusplus */
 
-#if !defined(EXPORT_API)
-#define EXPORT_API __attribute__((visibility("default")))
-#endif
+enum
+{
+       EMN_HEADER_DATA = 0,
+       EMN_WBXML_DATA,
+};
+
+/* Error Values for the Email options */
+enum
+{
+       EMAIL_OPTION_ERROR_NONE = 0,
+       EMAIL_OPTION_ERROR_INVALID_PARAM,
+       EMAIL_OPTION_ERROR_STORAGE,
+};
+
+/* Manual Network value */
+#define   EMAIL_OPTION_NETWORK_MANUAL  1
+
+
+/* Enums for the Gcong Option Key */
+typedef enum
+{
+       EMAIL_OPTION_KEY_HOME_NETWORK = 0,
+       EMAIL_OPTION_KEY_ROAMING_NETWORK,
+}optionkey;
+
+
+int emdaemon_initialize_emn(void);
+int emdaemon_finalize_emn(int bExtDest);
 
 /** 
  * This callback specifies the callback of retrieving the result that is downloaded new messages.
@@ -71,7 +98,7 @@ typedef int (*emf_emn_noti_cb)(
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int emf_emn_handler(unsigned char* wbxml_b64, emf_emn_noti_cb callback, int* err_code);
+INTERNAL_FUNC int emdaemon_handle_emn_notification(unsigned char* wbxml_b64, emf_emn_noti_cb callback, int* err_code);
 #endif
 
 #ifdef __cplusplus
@@ -83,6 +110,6 @@ EXPORT_API int emf_emn_handler(unsigned char* wbxml_b64, emf_emn_noti_cb callbac
 */
 
 
-#endif /* __EMF_EMN_H__ */
+#endif /* __EMAIL_DAEMON_EMN_H__ */
 /* EOF */
 
similarity index 86%
rename from include/emf-init.h
rename to email-daemon/include/email-daemon-init.h
index 0e4e61f..ad183c3 100755 (executable)
 
 
 /******************************************************************************
- * File: emf-init.h
- * Desc: Mail Framework Initialization Header
+ * File: email-daemon-init.h
+ * Desc: email-daemon Initialization Header
  *
  * Auth:
  *
  * History:
  *    2006.08.16 : created
  *****************************************************************************/
-#ifndef __EMF_INIT_H__
-#define __EMF_INIT_H__
+#ifndef __EMAIL_DAEMON_INIT_H__
+#define __EMAIL_DAEMON_INIT_H__
 
 #ifdef __cplusplus
 extern "C"
 {
 #endif /* __cplusplus */
 
-#include "em-storage.h"
+#include "email-storage.h"
 
 #ifdef __cplusplus
 }
diff --git a/email-daemon/include/email-daemon-mutex.h b/email-daemon/include/email-daemon-mutex.h
new file mode 100755 (executable)
index 0000000..0ab2cd8
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+*  email-service
+*
+* Copyright (c) 2000 - 2011 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.
+*
+*/
+
+
+#ifndef _EM_DAEMON_MUTEX_H_
+#define _EM_DAEMON_MUTEX_H_
+
+#include <sys/time.h>
+
+#endif /* _EM_DAEMON_MUTEX_H_ */
+
similarity index 61%
rename from include/emflib.h
rename to email-daemon/include/email-daemon.h
index c9c1992..4f3f213 100755 (executable)
 
 /**
  * This file defines all APIs of Email Framework.
- * @file       emflib.h
+ * @file       email-daemon.h
  * @author     Kyu-ho Jo(kyuho.jo@samsung.com)
  * @version    0.1
  * @brief      This file is the header file of email-engine library.
  */
-#ifndef __EMFLIB_H__
-#define __EMFLIB_H__
+#ifndef __EMAIL_DAEMON_H__
+#define __EMAIL_DAEMON_H__
 
 /**
-* @defgroup EMAIL_FRAMEWORK EmailFW
+* @defgroup EMAIL_SERVICE EmailFW
 * @{
 */
 
 /**
-* @ingroup EMAIL_FRAMEWORK
+* @ingroup EMAIL_SERVICE
 * @defgroup EMAIL_SERVICE Email Service
 * @{
 */
 
-#include "emf-types.h"
-#include "em-core-types.h"
+#include "email-types.h"
+#include "email-internal-types.h"
 
 #include <time.h>
 
@@ -52,10 +52,6 @@ extern "C"
 {
 #endif /* __cplusplus */
 
-#if !defined(EXPORT_API)
-#define EXPORT_API __attribute__((visibility("default")))
-#endif
-
 /*****************************************************************************/
 /*  Initialization                                                           */
 /*****************************************************************************/
@@ -66,7 +62,7 @@ extern "C"
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int emf_init(int* err_code);
+INTERNAL_FUNC int emdaemon_initialize(int* err_code);
 
 /**
  * Finalize Email-engine.
@@ -75,7 +71,7 @@ EXPORT_API int emf_init(int* err_code);
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int emf_close(int* err_code);
+INTERNAL_FUNC int emdaemon_finalize(int* err_code);
 
 
 /*****************************************************************************/
@@ -89,7 +85,7 @@ EXPORT_API int emf_close(int* err_code);
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int emf_account_create(emf_account_t* account, int* err_code);
+INTERNAL_FUNC int emdaemon_create_account(emf_account_t* account, int* err_code);
 
 /**
  * Delete a email account.
@@ -99,7 +95,7 @@ EXPORT_API int emf_account_create(emf_account_t* account, int* err_code);
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int emf_account_delete(int account_id, int* err_code);
+INTERNAL_FUNC int emdaemon_delete_account(int account_id, int* err_code);
 
 /**
  * Validate a email account.
@@ -109,7 +105,7 @@ EXPORT_API int emf_account_delete(int account_id, int* err_code);
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int emf_account_validate(int account_id, unsigned* handle, int* err_code);
+INTERNAL_FUNC int emdaemon_validate_account(int account_id, unsigned* handle, int* err_code);
 
 /**
  * Change the information of a email account.
@@ -120,7 +116,7 @@ EXPORT_API int emf_account_validate(int account_id, unsigned* handle, int* err_c
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int emf_account_modify(int account_id, emf_account_t* new_account, int* err_code);
+INTERNAL_FUNC int emdaemon_update_account(int account_id, emf_account_t* new_account, int* err_code);
 
 /**
  * Change the information of a email account after validation
@@ -132,7 +128,7 @@ EXPORT_API int emf_account_modify(int account_id, emf_account_t* new_account, in
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int emf_account_validate_and_update(int old_account_id, emf_account_t* new_account_info, unsigned* handle,int *err_code);
+INTERNAL_FUNC int emdaemon_validate_account_and_update(int old_account_id, emf_account_t* new_account_info, unsigned* handle,int *err_code);
 
 /**
  * Get a email account by ID.
@@ -144,7 +140,7 @@ EXPORT_API int emf_account_validate_and_update(int old_account_id, emf_account_t
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int emf_account_get(int account_id, int pulloption, emf_account_t** acount, int* err_code);
+INTERNAL_FUNC int emdaemon_get_account(int account_id, int pulloption, emf_account_t** acount, int* err_code);
 
 /**
  * Get all emails.
@@ -155,7 +151,7 @@ EXPORT_API int emf_account_get(int account_id, int pulloption, emf_account_t** a
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int emf_account_get_list(emf_account_t** acount_list, int* count, int* err_code);
+INTERNAL_FUNC int emdaemon_get_account_list(emf_account_t** acount_list, int* count, int* err_code);
 
 /**
  * Free allocated memory.
@@ -166,7 +162,7 @@ EXPORT_API int emf_account_get_list(emf_account_t** acount_list, int* count, int
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int emf_account_free(emf_account_t** account_list, int count, int* err_code);
+INTERNAL_FUNC int emdaemon_free_account(emf_account_t** account_list, int count, int* err_code);
 
 /**
  * Get a information of filtering.
@@ -177,7 +173,7 @@ EXPORT_API int emf_account_free(emf_account_t** account_list, int count, int* er
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int emf_filter_get(int filter_id, emf_rule_t** filtering_set, int* err_code);
+INTERNAL_FUNC int emdaemon_get_filter(int filter_id, emf_rule_t** filtering_set, int* err_code);
 
 /**
  * Get all filterings.
@@ -188,7 +184,7 @@ EXPORT_API int emf_filter_get(int filter_id, emf_rule_t** filtering_set, int* er
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int emf_filter_get_list(emf_rule_t** filtering_set, int* count, int* err_code);
+INTERNAL_FUNC int emdaemon_get_filter_list(emf_rule_t** filtering_set, int* count, int* err_code);
 
 /**
  * find a filter already exists.
@@ -198,7 +194,7 @@ EXPORT_API int emf_filter_get_list(emf_rule_t** filtering_set, int* count, int*
  * @remarks N/A
  * @return This function returns true if enable add filter, else returns false.
  */
-EXPORT_API int emf_filter_find(emf_rule_t* filter_info, int* err_code);
+INTERNAL_FUNC int emdaemon_find_filter(emf_rule_t* filter_info, int* err_code);
 
 /**
  * Add a filter information.
@@ -208,7 +204,7 @@ EXPORT_API int emf_filter_find(emf_rule_t* filter_info, int* err_code);
  * @remarks N/A
  * @return This function returns true on success or false on failure.(only EMF_FILTER_BLOCK supported.)
  */
-EXPORT_API int emf_filter_add(emf_rule_t* filtering_set, int* err_code);
+INTERNAL_FUNC int emdaemon_add_filter(emf_rule_t* filtering_set, int* err_code);
 
 /**
  * Change a filter information.
@@ -219,7 +215,7 @@ EXPORT_API int emf_filter_add(emf_rule_t* filtering_set, int* err_code);
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int emf_filter_change(int filter_id, emf_rule_t* new_set, int* err_code);
+INTERNAL_FUNC int emdaemon_update_filter(int filter_id, emf_rule_t* new_set, int* err_code);
 
 /**
  * Delete a filter information.
@@ -229,7 +225,7 @@ EXPORT_API int emf_filter_change(int filter_id, emf_rule_t* new_set, int* err_co
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int emf_filter_delete(int filter_id, int* err_code);
+INTERNAL_FUNC int emdaemon_delete_filter(int filter_id, int* err_code);
 
 /**
  * Free allocated memory.
@@ -240,7 +236,7 @@ EXPORT_API int emf_filter_delete(int filter_id, int* err_code);
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int emf_filter_free (emf_rule_t** filtering_set, int count, int* err_code);
+INTERNAL_FUNC int emdaemon_free_filter (emf_rule_t** filtering_set, int count, int* err_code);
 
 
 /*****************************************************************************/
@@ -259,7 +255,7 @@ EXPORT_API int emf_filter_free (emf_rule_t** filtering_set, int count, int* err_
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int emf_mail_send(emf_mailbox_t* mailbox, int mail_id, emf_option_t* sending_option,  unsigned* handle, int* err_code);
+INTERNAL_FUNC int emdaemon_send_mail(emf_mailbox_t* mailbox, int mail_id, emf_option_t* sending_option,  unsigned* handle, int* err_code);
 
 /**
  * Send all mails to been saved in Offline-mode.
@@ -272,37 +268,11 @@ EXPORT_API int emf_mail_send(emf_mailbox_t* mailbox, int mail_id, emf_option_t*
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int emf_mail_send_saved(int account_id, emf_option_t* sending_option,  unsigned* handle, int* err_code);
+INTERNAL_FUNC int emdaemon_send_mail_saved(int account_id, emf_option_t* sending_option,  unsigned* handle, int* err_code);
 
-/**
- * Send a read receipt mail.
- *
- * @param[in] mail                             Specifies the mail to been read.
- * @param[in] callback         Specifies the callback function for retrieving sending information.
- * @param[in] handle                   Specifies the handle for stopping sending.
- * @param[out] err_code            Specifies the error code returned.
- * @remarks N/A
- * @return This function returns true on success or false on failure.
- */
-EXPORT_API int emf_mail_send_report(emf_mail_t* mail,  unsigned* handle, int* err_code);
+INTERNAL_FUNC int emdaemon_add_mail(emf_mail_data_t *input_mail_data, emf_attachment_data_t *input_attachment_data_list, int input_attachment_count, emf_meeting_request_t *input_meeting_request, int input_from_eas);
 
-EXPORT_API int emf_add_mail(emf_mail_data_t *input_mail_data, emf_attachment_data_t *input_attachment_data_list, int input_attachment_count, emf_meeting_request_t *input_meeting_request, int input_sync_server);
-
-/**
- * Save a mail to specific mail box.
- *
- * @param[in] mail             Specifies the saving mail.
- * @param[in] mailbox  Specifies the mailbox structure for saving email.
- * @param[in] meeting_req      Specifies the meeting_req structure for saving email.
- * @param[in] from_composer    Specifies the mail is from composer.
- * @param[out] err_code        Specifies the error code returned.
- * @remarks N/A
- * @return This function returns true on success or false on failure.
- */
-
-EXPORT_API int emf_mail_save_to_mailbox(emf_mail_t* mail, emf_mailbox_t* mailbox, emf_meeting_request_t *meeting_req, int from_composer, int* err_code);
-
-EXPORT_API int emf_mail_add_meeting_request(int account_id, char *mailbox_name, emf_meeting_request_t *meeting_req, int* err_code);
+INTERNAL_FUNC int emdaemon_add_meeting_request(int account_id, char *mailbox_name, emf_meeting_request_t *meeting_req, int* err_code);
 
 /**
  * Delete a mail or multiple mails.
@@ -319,7 +289,7 @@ EXPORT_API int emf_mail_add_meeting_request(int account_id, char *mailbox_name,
  * @return This function returns true on success or false on failure.
  */
 
-EXPORT_API int emf_mail_delete(int account_id, emf_mailbox_t* mailbox, int mail_id[], int num, int from_server,  unsigned* handle, int* err_code);
+INTERNAL_FUNC int emdaemon_delete_mail(int account_id, emf_mailbox_t* mailbox, int mail_id[], int num, int from_server,  unsigned* handle, int* err_code);
 
 /**
  * Delete all mail from a mailbox.
@@ -332,7 +302,7 @@ EXPORT_API int emf_mail_delete(int account_id, emf_mailbox_t* mailbox, int mail_
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int emf_mail_delete_all(emf_mailbox_t* mailbox, int with_server,  unsigned* handle, int* err_code);
+INTERNAL_FUNC int emdaemon_delete_mail_all(emf_mailbox_t* mailbox, int with_server,  unsigned* handle, int* err_code);
 
 /**
  * Move a email to another mailbox.
@@ -346,7 +316,7 @@ EXPORT_API int emf_mail_delete_all(emf_mailbox_t* mailbox, int with_server,  uns
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int emf_mail_move(int mail_ids[], int num, emf_mailbox_t* dst_mailbox, int noti_param_1, int noti_param_2, int* err_code);
+INTERNAL_FUNC int emdaemon_move_mail(int mail_ids[], int num, emf_mailbox_t* dst_mailbox, int noti_param_1, int noti_param_2, int* err_code);
 
 /**
  * Move all email to another mailbox.
@@ -358,12 +328,9 @@ EXPORT_API int emf_mail_move(int mail_ids[], int num, emf_mailbox_t* dst_mailbox
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int emf_mail_move_all_mails(emf_mailbox_t* src_mailbox, emf_mailbox_t* dst_mailbox, int* err_code);
+INTERNAL_FUNC int emdaemon_move_mail_all_mails(emf_mailbox_t* src_mailbox, emf_mailbox_t* dst_mailbox, int* err_code);
 
 
-/* Deprecated */
-EXPORT_API int emf_mail_update(int mail_id, emf_mail_t* mail, emf_meeting_request_t *meeting_req, int with_server, int* err_code);
-
 /**
  * Update a existing email information.
  *
@@ -371,11 +338,11 @@ EXPORT_API int emf_mail_update(int mail_id, emf_mail_t* mail, emf_meeting_reques
  * @param[in] input_attachment_data_list       Specifies the structure of mail data.
  * @param[in] input_attachment_count   Specifies the pointer of attachment structure.
  * @param[in] input_meeting_request    Specifies the number of attachment data.
- * @param[in] input_sync_server        Specifies whether sync server.
+ * @param[in] input_from_eas   Specifies whether the mail is from EAS.
  * @remarks N/A
  * @return This function returns EMF_ERROR_NONE on success or error code on failure.
  */
-EXPORT_API int emf_update_mail(emf_mail_data_t *input_mail_data, emf_attachment_data_t *input_attachment_data_list, int input_attachment_count, emf_meeting_request_t *input_meeting_request, int input_sync_server);
+INTERNAL_FUNC int emdaemon_update_mail(emf_mail_data_t *input_mail_data, emf_attachment_data_t *input_attachment_data_list, int input_attachment_count, emf_meeting_request_t *input_meeting_request, int input_from_eas);
 
 
 /**
@@ -385,55 +352,7 @@ EXPORT_API int emf_update_mail(emf_mail_data_t *input_mail_data, emf_attachment_
  * @remarks N/A
  * @return This function returns void.
  */
-EXPORT_API void _OnMailSendRetryTimerCB( void* data );
-
-/**
- * Get a mail from mailbox.
- *
- * @param[in] mailbox  Reserved.
- * @param[in] mail_id  Specifies the mail ID.
- * @param[out] mail            The returned mail is save here.
- * @param[out] err_code        Specifies the error code returned.
- * @remarks N/A
- * @return This function returns true on success or false on failure.
- */
-EXPORT_API int emf_mail_get_mail(emf_mailbox_t* mailbox, int mail_id, emf_mail_t** mail, int* err_code);
-
-/**
- * Get a mail info.
- *
- * @param[in] mailbox                  Reserved.
- * @param[in] mail_id                          Specifies the mail ID.
- * @param[out] info                            The returned body of mail is saved here.
- * @param[out] err_code                Specifies the error code returned.
- * @remarks N/A
- * @return This function returns true on success or false on failure.
- */
-EXPORT_API int emf_mail_get_info(emf_mailbox_t* mailbox, int mail_id, emf_mail_info_t** info, int* err_code);
-
-/**
- * Get a mail head.
- *
- * @param[in] mailbox          Reserved.
- * @param[in] mail_id                  Specifies the mail ID.
- * @param[out] head                    The returned info of mail is saved here.
- * @param[out] err_code        Specifies the error code returned.
- * @remarks N/A
- * @return This function returns true on success or false on failure.
- */
-EXPORT_API int emf_mail_get_head(emf_mailbox_t* mailbox, int mail_id, emf_mail_head_t** head, int* err_code);
-
-/**
- * Get a mail body.
- *
- * @param[in] mailbox          Reserved.
- * @param[in] mail_id                  Specifies the mail ID.
- * @param[out] body                    The returned body of mail is saved here.
- * @param[out] err_code        Specifies the error code returned.
- * @remarks N/A
- * @return This function returns true on success or false on failure.
- */
-EXPORT_API int emf_mail_get_body(emf_mailbox_t* mailbox, int mail_id, emf_mail_body_t** body, int* err_code);
+INTERNAL_FUNC void _OnMailSendRetryTimerCB( void* data );
 
 /**
  * Download email body from server.
@@ -446,7 +365,7 @@ EXPORT_API int emf_mail_get_body(emf_mailbox_t* mailbox, int mail_id, emf_mail_b
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int emf_mail_download_body(emf_mailbox_t* mailbox, int mail_id, int verbose, int with_attachment,  unsigned* handle, int* err_code);
+INTERNAL_FUNC int emdaemon_download_body(emf_mailbox_t* mailbox, int mail_id, int verbose, int with_attachment,  unsigned* handle, int* err_code);
 
 /**
  * Get a mail attachment.
@@ -459,7 +378,7 @@ EXPORT_API int emf_mail_download_body(emf_mailbox_t* mailbox, int mail_id, int v
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int emf_mail_get_attachment(emf_mailbox_t* mailbox, int mail_id, char* attachment_id, emf_attachment_info_t** attachment, int* err_code);
+INTERNAL_FUNC int emdaemon_get_attachment(emf_mailbox_t* mailbox, int mail_id, char* attachment_id, emf_attachment_info_t** attachment, int* err_code);
 
 /**
  * Download a email nth-attachment from server.
@@ -473,7 +392,7 @@ EXPORT_API int emf_mail_get_attachment(emf_mailbox_t* mailbox, int mail_id, char
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int emf_mail_download_attachment(emf_mailbox_t* mailbox, int mail_id, char* nth,  unsigned* handle, int* err_code);
+INTERNAL_FUNC int emdaemon_download_attachment(emf_mailbox_t* mailbox, int mail_id, char* nth,  unsigned* handle, int* err_code);
 
 
 /**
@@ -486,7 +405,7 @@ EXPORT_API int emf_mail_download_attachment(emf_mailbox_t* mailbox, int mail_id,
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int emf_mail_add_attachment(emf_mailbox_t* mailbox, int mail_id, emf_attachment_info_t* attachment, int* err_code);
+INTERNAL_FUNC int emdaemon_add_attachment(emf_mailbox_t* mailbox, int mail_id, emf_attachment_info_t* attachment, int* err_code);
 
 /**
  * Delete a attachment from email.
@@ -498,51 +417,7 @@ EXPORT_API int emf_mail_add_attachment(emf_mailbox_t* mailbox, int mail_id, emf_
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int emf_mail_delete_attachment(emf_mailbox_t* mailbox, int mail_id, char* attachment_id, int* err_code);
-
-/**
- * Free allocated memroy for emails.
- *
- * @param[in] mail_list        Specifies the pointer of mail structure pointer.
- * @param[in] count            Specifies the count of mails.
- * @param[out] err_code        Specifies the error code returned.
- * @remarks N/A
- * @return This function returns true on success or false on failure.
- */
-EXPORT_API int emf_mail_free(emf_mail_t** mail_list, int count, int* err_code);
-
-/**
- * Free allocated memroy for email infoes.
- *
- * @param[in] head_list                Specifies the pointer of mail info structures.
- * @param[in] count                    Specifies the number of mail infoes.
- * @param[out] err_code        Specifies the error code returned.
- * @remarks N/A
- * @return This function returns true on success or false on failure.
- */
-EXPORT_API int emf_mail_info_free(emf_mail_info_t** info_list, int count, int* err_code);
-
-/**
- * Free allocated memroy for email headers.
- *
- * @param[in] head_list                Specifies the pointer of mail head structure list.
- * @param[in] count                    Specifies the number of mail heads.
- * @param[out] err_code        Specifies the error code returned.
- * @remarks N/A
- * @return This function returns true on success or false on failure.
- */
-EXPORT_API int emf_mail_head_free(emf_mail_head_t** head_list, int count, int* err_code);
-
-/**
- * Free allocated memroy for email bodies.
- *
- * @param[in] body_list                Specifies the pointer of mail body structures.
- * @param[in] count                    Specifies the number of mail bodies.
- * @param[out] err_code        Specifies the error code returned.
- * @remarks N/A
- * @return This function returns true on success or false on failure.
- */
-EXPORT_API int emf_mail_body_free(emf_mail_body_t** body_list, int count, int* err_code);
+INTERNAL_FUNC int emdaemon_delete_mail_attachment(emf_mailbox_t* mailbox, int mail_id, char* attachment_id, int* err_code);
 
 /**
  * Free allocated memroy for email attachment.
@@ -552,7 +427,7 @@ EXPORT_API int emf_mail_body_free(emf_mail_body_t** body_list, int count, int* e
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int emf_mail_attachment_info_free(emf_attachment_info_t** atch_info, int* err_code);
+INTERNAL_FUNC int emdaemon_free_attachment_info(emf_attachment_info_t** atch_info, int* err_code);
 
 /**
  * Change email flag.
@@ -564,7 +439,7 @@ EXPORT_API int emf_mail_attachment_info_free(emf_attachment_info_t** atch_info,
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int emf_mail_modify_flag(int mail_id, emf_mail_flag_t new_flag, int onserver, int sticky_flag, int* err_code);
+INTERNAL_FUNC int emdaemon_modify_flag(int mail_id, emf_mail_flag_t new_flag, int onserver, int sticky_flag, int* err_code);
 
 /**
  * Change email extra flag.
@@ -576,7 +451,7 @@ EXPORT_API int emf_mail_modify_flag(int mail_id, emf_mail_flag_t new_flag, int o
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int emf_mail_modify_extra_flag(int mail_id, emf_extra_flag_t new_flag, int* err_code);
+INTERNAL_FUNC int emdaemon_modify_extra_flag(int mail_id, emf_extra_flag_t new_flag, int* err_code);
 
 /**
  * Change email read/unread flag.
@@ -590,12 +465,12 @@ EXPORT_API int emf_mail_modify_extra_flag(int mail_id, emf_extra_flag_t new_flag
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int emf_mail_set_flags_field(int account_id, int mail_ids[], int num, emf_flags_field_type field_type, int value, int onserver, int* err_code);
+INTERNAL_FUNC int emdaemon_set_flags_field(int account_id, int mail_ids[], int num, emf_flags_field_type field_type, int value, int onserver, int* err_code);
 
 /*****************************************************************************/
 /*  Mailbox                                                                  */
 /*****************************************************************************/
-EXPORT_API int emf_mailbox_get_imap_mailbox_list(int account_id, char* mailbox, unsigned* handle, int* err_code);
+INTERNAL_FUNC int emdaemon_get_imap_mailbox_list(int account_id, char* mailbox, unsigned* handle, int* err_code);
 
 /**
  * Download header of new emails from mail server. 
@@ -607,13 +482,8 @@ EXPORT_API int emf_mailbox_get_imap_mailbox_list(int account_id, char* mailbox,
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int emf_mailbox_sync_header(emf_mailbox_t* mailbox, unsigned* handle, int* err_code);
-
+INTERNAL_FUNC int emdaemon_sync_header(emf_mailbox_t* mailbox, unsigned* handle, int* err_code);
 
-EXPORT_API int emf_mailbox_oma_sync_header(int account_id, char*email_address, unsigned* handle, int* err_code);
-
-
-EXPORT_API int emf_mailbox_get_by_now_account_addr(int account_id, char* now_address, emf_mailbox_t** mailbox_list, int* count, int* err_code);
 
 /**
  * Get mail count from mailbox.
@@ -625,7 +495,7 @@ EXPORT_API int emf_mailbox_get_by_now_account_addr(int account_id, char* now_add
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int emf_mailbox_get_mail_count(emf_mailbox_t* mailbox, int* total, int* unseen, int* err_code);
+INTERNAL_FUNC int emdaemon_get_mail_count_of_mailbox(emf_mailbox_t* mailbox, int* total, int* unseen, int* err_code);
 
 /**
  * Get all mailboxes from account.
@@ -637,7 +507,7 @@ EXPORT_API int emf_mailbox_get_mail_count(emf_mailbox_t* mailbox, int* total, in
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int emf_mailbox_get_list(int account_id, emf_mailbox_t** mailbox_list, int* count, int* err_code);
+INTERNAL_FUNC int emdaemon_get_mailbox_list(int account_id, emf_mailbox_t** mailbox_list, int* count, int* err_code);
 
 /**
  * Create a new mailbox.
@@ -648,7 +518,7 @@ EXPORT_API int emf_mailbox_get_list(int account_id, emf_mailbox_t** mailbox_list
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int emf_mailbox_create(emf_mailbox_t* new_mailbox, int on_server, unsigned* handle, int* err_code);
+INTERNAL_FUNC int emdaemon_add_mailbox(emf_mailbox_t* new_mailbox, int on_server, unsigned* handle, int* err_code);
 
 /**
  * Delete a mailbox.
@@ -659,7 +529,7 @@ EXPORT_API int emf_mailbox_create(emf_mailbox_t* new_mailbox, int on_server, uns
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int emf_mailbox_delete(emf_mailbox_t* mailbox, int on_server, unsigned* handle, int* err_code);
+INTERNAL_FUNC int emdaemon_delete_mailbox(emf_mailbox_t* mailbox, int on_server, unsigned* handle, int* err_code);
 
 /**
  * Delete all sub-mailboxes from a specific mailbox.
@@ -669,7 +539,7 @@ EXPORT_API int emf_mailbox_delete(emf_mailbox_t* mailbox, int on_server, unsigne
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int emf_mailbox_delete_all(emf_mailbox_t* mailbox, int* err_code);
+INTERNAL_FUNC int emdaemon_delete_mailbox_all(emf_mailbox_t* mailbox, int* err_code);
 
 /**
  * Free allocated memory for mailbox information.
@@ -680,7 +550,7 @@ EXPORT_API int emf_mailbox_delete_all(emf_mailbox_t* mailbox, int* err_code);
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int emf_mailbox_free(emf_mailbox_t** mailbox_list, int count, int* err_code);
+INTERNAL_FUNC int emdaemon_free_mailbox(emf_mailbox_t** mailbox_list, int count, int* err_code);
 
 /*****************************************************************************/
 /*  Etc                                                                      */
@@ -696,7 +566,7 @@ EXPORT_API int emf_mailbox_free(emf_mailbox_t** mailbox_list, int count, int* er
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int emf_register_event_callback(emf_action_t action, emf_event_callback callback, void* event_data);
+INTERNAL_FUNC int emdaemon_register_event_callback(emf_action_t action, emf_event_callback callback, void* event_data);
 
 /**
  * Unregister a callback for event processing.
@@ -706,7 +576,7 @@ EXPORT_API int emf_register_event_callback(emf_action_t action, emf_event_callba
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int emf_unregister_event_callback(emf_action_t action, emf_event_callback callback);
+INTERNAL_FUNC int emdaemon_unregister_event_callback(emf_action_t action, emf_event_callback callback);
 
 /**
  * Get current event queue status.
@@ -715,7 +585,7 @@ EXPORT_API int emf_unregister_event_callback(emf_action_t action, emf_event_call
  * @param[out] on_receiving            True if receiving is in progress.
  * @remarks N/A
  */
-EXPORT_API void emf_get_event_queue_status(int* on_sending, int* on_receiving);
+INTERNAL_FUNC void emdaemon_get_event_queue_status(int* on_sending, int* on_receiving);
 
 /**
  * Get the handle of a pending job.
@@ -726,7 +596,7 @@ EXPORT_API void emf_get_event_queue_status(int* on_sending, int* on_receiving);
  * @remarks N/A
  * @return This function return its handle if a pending job exists, otherwise -1.
  */
-EXPORT_API int emf_get_pending_job(emf_action_t action, int account_id, int mail_id, emf_event_status_type_t* status);
+INTERNAL_FUNC int emdaemon_get_pending_job(emf_action_t action, int account_id, int mail_id, emf_event_status_type_t* status);
 
 /**
  * Cancel a progressive work.
@@ -737,7 +607,7 @@ EXPORT_API int emf_get_pending_job(emf_action_t action, int account_id, int mail
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int emf_cancel_job(int account_id, int handle, int* err_code);
+INTERNAL_FUNC int emdaemon_cancel_job(int account_id, int handle, int* err_code);
 
 
 
@@ -750,23 +620,7 @@ EXPORT_API int emf_cancel_job(int account_id, int handle, int* err_code);
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int emf_mail_send_mail_cancel_job(int account_id, int mail_id, int* err_code);
-
-
-
-#ifdef PARSING_EMN_WBXML
-/**
- * Retrieve a account from OMA EMN data.
- *
- * @param[in] wbxml_b64                Specifies the EMN data. The data is a BASE64 encoded string.
- * @param[out] account_id      The account ID is saved here.
- * @param[out] mailbox         The name of mailbox is saved here.
- * @param[out] err_code                Specifies the error code returned.
- * @remarks N/A
- * @return This function returns true on success or false on failure.
- */
-EXPORT_API int emf_get_emn_account (unsigned char* wbxml_b64, int* account_id, char** mailbox, int* err_code);
-#endif
+INTERNAL_FUNC int emdaemon_cancel_sending_mail_job(int account_id, int mail_id, int* err_code);
 
 /**
  * set email options.
@@ -776,7 +630,7 @@ EXPORT_API int emf_get_emn_account (unsigned char* wbxml_b64, int* account_id, c
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int emf_set_option(emf_option_t* option, int* err_code);
+INTERNAL_FUNC int emdaemon_set_option(emf_option_t* option, int* err_code);
 
 /**
  * get email options.
@@ -786,7 +640,7 @@ EXPORT_API int emf_set_option(emf_option_t* option, int* err_code);
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int emf_get_option(emf_option_t* option, int* err_code);
+INTERNAL_FUNC int emdaemon_get_option(emf_option_t* option, int* err_code);
 
 /**
  * Sync the Local activity 
@@ -797,34 +651,34 @@ EXPORT_API int emf_get_option(emf_option_t* option, int* err_code);
  * @remarks N/A
  * @return This function returns true on success or false on failure.
  */
-EXPORT_API int emf_local_activity_sync(int account_id, int *err_code);
+INTERNAL_FUNC int emdaemon_sync_local_activity(int account_id, int *err_code);
 
 
 #ifdef __FEATURE_AUTO_POLLING__
-EXPORT_API int emf_auto_polling(int* err_code);
-#endif
+INTERNAL_FUNC int emdaemon_start_auto_polling(int* err_code);
+#endif /* __FEATURE_AUTO_POLLING__ */
 
-EXPORT_API int emf_account_insert_accountinfo_to_contact(emf_account_t* account);
+INTERNAL_FUNC int emdaemon_insert_accountinfo_to_contact(emf_account_t* account);
 
-EXPORT_API int emf_account_update_accountinfo_to_contact(emf_account_t* old_account, emf_account_t* new_account);
+INTERNAL_FUNC int emdaemon_update_accountinfo_to_contact(emf_account_t* old_account, emf_account_t* new_account);
 
-EXPORT_API int emf_mail_get_mail_by_uid(int account_id, char *uid, emf_mail_t **mail, int *err);
+INTERNAL_FUNC int emdaemon_update_mailbox(emf_mailbox_t* old_mailbox, emf_mailbox_t* new_mailbox, int on_server, unsigned* handle, int* err_code);
 
-EXPORT_API int emf_mailbox_update(emf_mailbox_t* old_mailbox, emf_mailbox_t* new_mailbox, int on_server, unsigned* handle, int* err_code);
+INTERNAL_FUNC int emdaemon_search_mail_on_server(int input_account_id, const char *input_mailbox_name, email_search_filter_t *input_search_filter, int input_search_filter_count, unsigned int *output_handle);
 
-EXPORT_API int emf_clear_mail_data(int* err_code);
+INTERNAL_FUNC int emdaemon_clear_all_mail_data(int* err_code);
 
-EXPORT_API int emf_mail_send_retry( int mail_id,  int timeout_in_sec, int* err_code);
+INTERNAL_FUNC int emdaemon_send_mail_retry( int mail_id,  int timeout_in_sec, int* err_code);
 
-EXPORT_API int emf_account_validate_and_create(emf_account_t* new_account, unsigned* handle, int* err_code);
+INTERNAL_FUNC int emdaemon_validate_account_and_create(emf_account_t* new_account, unsigned* handle, int* err_code);
 
-EXPORT_API int emf_mailbox_set_mail_slot_size(int account_id, char* mailbox_name, int new_slot_size, unsigned* handle, int *err_code);
+INTERNAL_FUNC int emdaemon_set_mail_slot_size_of_mailbox(int account_id, char* mailbox_name, int new_slot_size, unsigned* handle, int *err_code);
 
-EXPORT_API int emf_mail_move_thread_to_mailbox(int thread_id, char *target_mailbox_name, int move_always_flag, int *err_code);
+INTERNAL_FUNC int emdaemon_move_mail_thread_to_mailbox(int thread_id, char *target_mailbox_name, int move_always_flag, int *err_code);
 
-EXPORT_API int emf_mail_delete_thread(int thread_id, int delete_always_flag, unsigned* handle, int *err_code);
+INTERNAL_FUNC int emdaemon_delete_mail_thread(int thread_id, int delete_always_flag, unsigned* handle, int *err_code);
 
-EXPORT_API int emf_mail_modify_seen_flag_of_thread(int thread_id, int seen_flag, int on_server, unsigned* handle, int *err_code);
+INTERNAL_FUNC int emdaemon_modify_seen_flag_of_thread(int thread_id, int seen_flag, int on_server, unsigned* handle, int *err_code);
 
 #ifdef __cplusplus
 }
@@ -834,4 +688,4 @@ EXPORT_API int emf_mail_modify_seen_flag_of_thread(int thread_id, int seen_flag,
 * @} @}
 */
 
-#endif /* __EMFLIB_H__ */
+#endif /* __EMAIL_DAEMON_H__ */
diff --git a/email-daemon/main.c b/email-daemon/main.c
new file mode 100755 (executable)
index 0000000..e8997b1
--- /dev/null
@@ -0,0 +1,2924 @@
+/*
+*  email-service
+*
+* Copyright (c) 2000 - 2011 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 Main .c */
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <malloc.h>
+#include <glib.h>
+#include <glib-object.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <heynoti/heynoti.h>
+#include <signal.h>
+#include <time.h>
+
+#include "email-daemon.h"
+#include "email-ipc.h"
+#include "email-utilities.h"
+#include "email-debug-log.h"
+#include "email-daemon-auto-poll.h"   
+#include "email-daemon-account.h"
+#include "email-convert.h"
+#include "email-internal-types.h" 
+#include "email-types.h"
+#include "email-core-account.h" 
+#include "email-core-mail.h" 
+#include "email-core-smtp.h"
+#include "email-core-event.h" 
+#include "email-core-global.h" 
+#include "email-core-mailbox.h" 
+#include "email-core-utils.h"
+#include "email-storage.h"    
+
+void stb_create_account(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int buffer_size = 0;
+       int local_result = 0;
+       char* local_account_stream = NULL;
+       emf_account_t account;
+       int err = EMF_ERROR_NONE;
+
+       buffer_size = emipc_get_parameter_length(a_hAPI, ePARAMETER_IN, 0);
+       EM_DEBUG_LOG("size [%d]", buffer_size);
+
+       if(buffer_size <= 0)    {
+               err = EMF_ERROR_INVALID_PARAM;
+               goto FINISH_OFF;
+       }
+
+       local_account_stream = (char*)em_malloc(buffer_size+1);
+       if(!local_account_stream) {
+               err = EMF_ERROR_INVALID_PARAM;
+               goto FINISH_OFF;
+       }
+
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, buffer_size, local_account_stream);
+       /* Convert account stream to structure */
+       EM_DEBUG_LOG("Before Convert_ByteStream_To_Account");
+       em_convert_byte_stream_to_account(local_account_stream, &account);
+       EM_SAFE_FREE(local_account_stream);
+
+       if (account.account_name)
+               EM_DEBUG_LOG("Account name - %s", account.account_name);
+       if(account.email_addr)
+               EM_DEBUG_LOG("Email Address - %s", account.email_addr);
+       
+       if(!emdaemon_create_account(&account, &err)) {
+               EM_DEBUG_EXCEPTION("emdaemon_create_account fail ");
+               goto FINISH_OFF;
+       }
+
+#ifdef __FEATURE_AUTO_POLLING__
+       /* start auto polling, if check_interval not zero */
+       if(account.check_interval > 0) {
+               if(!emdaemon_add_polling_alarm( account.account_id,account.check_interval))
+                       EM_DEBUG_EXCEPTION("emdaemon_add_polling_alarm[NOTI_ACCOUNT_ADD] : start auto poll failed >>> ");
+       }
+#endif
+       /* add account details to contact DB */
+       emdaemon_insert_accountinfo_to_contact(&account);
+       local_result = 1;
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &local_result, sizeof(int)))
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed ");
+       
+       EM_DEBUG_LOG("[3] APPID[%d], APIID [%d]", emipc_get_app_id(a_hAPI), emipc_get_api_id(a_hAPI));
+       EM_DEBUG_LOG("account id[%d]", account.account_id);
+       
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &(account.account_id), sizeof(int)))
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed ");
+       if (!emipc_execute_stub_api(a_hAPI))
+               EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed  ");
+
+FINISH_OFF:
+       if ( local_result == 0 ) {                      
+               if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &local_result, sizeof(int)))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed : local_result ");
+               if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed : err");
+               if (!emipc_execute_stub_api(a_hAPI))
+                       EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed  ");
+       }
+       EM_DEBUG_FUNC_END();
+}
+
+void stb_delete_account(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int account_id = 0;
+       int local_result = 0;
+       int err = EMF_ERROR_NONE;
+       
+       /* account_id */
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, sizeof(int), &account_id);
+       if(!emdaemon_delete_account(account_id, &err)) {
+               if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &local_result, sizeof(int)))
+                       EM_DEBUG_LOG("emipc_add_parameter failed ");
+               if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+                               
+               if (!emipc_execute_stub_api(a_hAPI))
+                       EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed  ");
+               goto FINISH_OFF;
+       }
+
+#ifdef __FEATURE_AUTO_POLLING__
+       /* stop auto polling for this acount */
+       if(emdaemon_check_auto_polling_started(account_id)) {
+               if(!emdaemon_remove_polling_alarm(account_id))
+                       EM_DEBUG_EXCEPTION("emdaemon_remove_polling_alarm[ NOTI_ACCOUNT_DELETE] : remove auto poll failed >>> ");
+       }
+#endif
+       local_result = 1;
+
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &local_result, sizeof(int)))
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed ");
+                       
+       if (!emipc_execute_stub_api(a_hAPI))
+               EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed");
+
+FINISH_OFF:
+
+       EM_DEBUG_FUNC_END();
+}
+
+void stb_update_account(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int account_id = 0, buffer_size = 0, local_result = 0, with_validation = 0;
+       char* local_account_stream = NULL;
+       emf_account_t  *new_account_info = NULL;
+       int err = EMF_ERROR_NONE;
+       unsigned int handle = 0;  
+
+       /* filter_id */
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, sizeof(int), &account_id);
+       
+       buffer_size = emipc_get_parameter_length(a_hAPI, ePARAMETER_IN, 1);
+       EM_DEBUG_LOG("size [%d]", buffer_size);
+       
+       if(buffer_size > 0)      {
+               local_account_stream = (char*)em_malloc(buffer_size+1);
+               if(local_account_stream) {
+                       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 1, buffer_size, local_account_stream);
+                       /* Convert Byte stream to account structure */
+                       EM_DEBUG_LOG("Before Convert_ByteStream_To_account");
+                       new_account_info = (emf_account_t*)em_malloc(sizeof(emf_account_t));
+
+                       if(NULL == new_account_info)                     {
+                               EM_SAFE_FREE(local_account_stream);
+                               err = EMF_ERROR_OUT_OF_MEMORY;
+                               goto FINISH_OFF;
+                       }
+                       em_convert_byte_stream_to_account(local_account_stream, new_account_info);
+                       EM_SAFE_FREE(local_account_stream);
+               }
+               else {
+                       err = EMF_ERROR_OUT_OF_MEMORY;
+                       goto FINISH_OFF;
+               }
+                       
+               emipc_get_parameter(a_hAPI, ePARAMETER_IN, 2, sizeof(int), &with_validation);
+       }
+
+       if ( NULL == new_account_info ) {
+               err = EMF_ERROR_INVALID_PARAM;
+               goto FINISH_OFF;
+       }
+
+       emf_account_t  *old_account_info = NULL;
+       
+       if(!emdaemon_get_account(account_id, GET_FULL_DATA, &old_account_info, &err)) {
+               EM_DEBUG_EXCEPTION("emdaemon_get_account failed ");
+               goto FINISH_OFF;
+       }
+
+       if(new_account_info->password == NULL || (new_account_info->password != NULL && strlen(new_account_info->password) == 0) ) {
+               EM_SAFE_FREE(new_account_info->password);
+               if(old_account_info->password) {
+                       new_account_info->password = strdup(old_account_info->password);
+                       if(new_account_info->password == NULL) {
+                               EM_DEBUG_EXCEPTION("allocation for new_account_info->password failed");
+                               err = EMF_ERROR_OUT_OF_MEMORY;
+                               goto FINISH_OFF;
+                       }
+               }
+       }
+       
+       if(new_account_info->sending_password == NULL || (new_account_info->sending_password != NULL && strlen(new_account_info->sending_password) == 0) ) {
+               if(new_account_info->sending_password != NULL)
+                       free(new_account_info->sending_password);
+               if(old_account_info->sending_password) {
+                       new_account_info->sending_password = strdup(old_account_info->sending_password);
+                       if(new_account_info->sending_password == NULL) {
+                               EM_DEBUG_EXCEPTION("allocation for new_account_info->sending_password failed");
+                               err = EMF_ERROR_OUT_OF_MEMORY;
+                               goto FINISH_OFF;
+                       }
+               }
+       }
+
+       
+       if(with_validation) {
+               emdaemon_validate_account_and_update(account_id, new_account_info, &handle, &err);
+               local_result = 1;
+       }
+       else {
+               if(emdaemon_update_account(account_id, new_account_info, &err)) {
+#ifdef __FEATURE_AUTO_POLLING__
+                       int  old_check_interval = old_account_info->check_interval;
+                       if( old_check_interval == 0 && new_account_info->check_interval > 0) {
+                               if(!emdaemon_add_polling_alarm( account_id,new_account_info->check_interval))
+                                       EM_DEBUG_EXCEPTION("emdaemon_add_polling_alarm[ CHANGEACCOUNT] : start auto poll failed >>> ");
+                               
+                       }
+                       else if( (old_check_interval > 0) && (new_account_info->check_interval == 0)) {
+                               if(!emdaemon_remove_polling_alarm(account_id))
+                                       EM_DEBUG_EXCEPTION("emdaemon_remove_polling_alarm[ CHANGEACCOUNT] : start auto poll failed >>> ");
+                       }
+                       else if(old_check_interval != new_account_info->check_interval) {
+                               if(!emdaemon_remove_polling_alarm(account_id)) {
+                                       EM_DEBUG_EXCEPTION("emdaemon_remove_polling_alarm[ CHANGEACCOUNT] : start auto poll failed >>> ");
+                                       goto FINISH_OFF;
+                               }               
+                               if(!emdaemon_add_polling_alarm( account_id,new_account_info->check_interval))
+                                       EM_DEBUG_EXCEPTION("emdaemon_add_polling_alarm[ CHANGEACCOUNT] : start auto poll failed >>> ");
+                       }
+#endif
+                       emdaemon_update_accountinfo_to_contact(old_account_info,new_account_info);
+                       local_result = 1;
+               }
+               else {
+                       EM_DEBUG_EXCEPTION("emdaemon_update_account failed [%d]", err);
+                       goto FINISH_OFF;
+               }
+               
+       }
+       
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &local_result, sizeof(int)))
+               EM_DEBUG_EXCEPTION("emipc_add_parameter for result failed");
+
+       if(with_validation) {
+               if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &handle, sizeof(int)))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter for handle failed");
+       }
+               
+       if (!emipc_execute_stub_api(a_hAPI))
+               EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed");
+
+FINISH_OFF:
+       if ( local_result == 0 ) {
+               if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &local_result, sizeof(int)))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+
+               if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+                               
+               if (!emipc_execute_stub_api(a_hAPI))
+                       EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed");
+       }
+       EM_SAFE_FREE(new_account_info);         
+       EM_SAFE_FREE(old_account_info);
+       EM_DEBUG_FUNC_END();
+}
+
+void stb_validate_account(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+
+       int account_id = 0;
+       int local_result = 0;
+       int err_code = 0;
+       int handle = 0;
+       
+       /* account_id */
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, sizeof(int), &account_id);
+       local_result = emdaemon_validate_account(account_id, (unsigned*)&handle,&err_code);
+
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &local_result, sizeof(int)))
+               EM_DEBUG_LOG("emipc_add_parameter failed ");
+
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err_code, sizeof(int)))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed ");
+                               
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &handle, sizeof(int)))
+               EM_DEBUG_EXCEPTION("emipc_add_parameter result failed ");
+                               
+       if (!emipc_execute_stub_api(a_hAPI))
+               EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed  ");
+
+       EM_DEBUG_FUNC_END();
+}
+
+void stb_account_get_refer(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int local_result = 0;
+       int account_id = 0;
+       emf_account_t* account = NULL;
+       char* local_stream = NULL;
+       int size = 0;
+
+       EM_DEBUG_LOG("account_id");
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, sizeof(int), &account_id);
+
+       account = emdaemon_get_account_reference(account_id);
+       if(account != NULL) {
+               EM_DEBUG_LOG("emdaemon_get_account_reference success");
+               local_result = 1;
+               
+               /* result */
+               if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &local_result, sizeof(int)))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter local_result failed ");
+               
+               /* Address */
+               local_stream = em_convert_account_to_byte_stream(account, &size);
+
+               EM_NULL_CHECK_FOR_VOID(local_stream);
+
+               if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, local_stream, size))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+
+               if (!emipc_execute_stub_api(a_hAPI)) {
+                       EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed");
+                       EM_SAFE_FREE(local_stream);
+                       return;
+               }
+
+       }
+       else {
+               EM_DEBUG_LOG("emdaemon_get_account_reference failed");
+               if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &local_result, sizeof(int)))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter local_result failed ");
+               if (!emipc_execute_stub_api(a_hAPI)) {
+                       EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed  ");
+                       EM_SAFE_FREE(local_stream);
+                       return;
+               }
+       }
+
+       EM_SAFE_FREE(local_stream);
+       EM_DEBUG_FUNC_END();
+}
+
+void stb_get_account_list(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       
+       int local_result = 0;
+       int counter = 0;
+       char* local_stream = NULL;
+       emf_account_t* account_list;
+       int count;
+       int size = 0;
+       int err = EMF_ERROR_NONE;
+
+       EM_DEBUG_LOG("begin");
+       
+       if(emdaemon_get_account_list(&account_list, &count, &err)) {
+               EM_DEBUG_LOG("emdaemon_get_account_list success");
+               local_result = 1;
+               if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &local_result, sizeof(int)))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter local_result failed ");
+
+               EM_DEBUG_LOG("Count [%d]", count);
+               if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &count, sizeof(int)))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter count failed ");
+
+               for(counter=0; counter<count; counter++) {
+                       EM_DEBUG_LOG("Name - %s", account_list[counter].account_name);
+
+                       local_stream = em_convert_account_to_byte_stream(account_list+counter, &size);
+
+                       EM_NULL_CHECK_FOR_VOID(local_stream);
+
+                       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, local_stream, size))
+                               EM_DEBUG_EXCEPTION("Add  Param mailbox failed  ");
+
+                       size = 0;
+                       EM_SAFE_FREE(local_stream);
+               }
+
+               emdaemon_free_account(&account_list, count, NULL);  
+               if (!emipc_execute_stub_api(a_hAPI))
+                       EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed  ");
+       }
+
+       else {
+               EM_DEBUG_LOG("emdaemon_get_account_list failed");
+               if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &local_result, sizeof(int)))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter local_result failed ");
+               if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed : err");
+               if (!emipc_execute_stub_api(a_hAPI))
+                       EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed  ");
+       }
+
+       EM_SAFE_FREE(local_stream);
+       EM_DEBUG_FUNC_END();
+}
+       
+void stb_modify_mail_flag(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int err = EMF_ERROR_NONE;
+       int mail_id = 0;
+       int i_flag = 0;
+       int onserver = 0;
+       int sticky_flag = 0;
+       emf_mail_flag_t new_flag = { 0 };
+
+       EM_DEBUG_LOG("mail_id");
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, sizeof(int), &mail_id);
+       EM_DEBUG_LOG("mail_id[%d]", mail_id);
+
+       EM_DEBUG_LOG("i_flag");
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 1, sizeof(int), &i_flag);
+       EM_DEBUG_LOG("i_flag[%d]", i_flag);
+
+       EM_DEBUG_LOG("Sticky flag");
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 2, sizeof(int), &sticky_flag);
+       EM_DEBUG_LOG(">>> STICKY flag Value [ %d] ", sticky_flag);
+
+       EM_DEBUG_LOG("onserver");
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 3, sizeof(int), &onserver);
+       EM_DEBUG_LOG("onserver[%d]", onserver);
+
+       EM_DEBUG_LOG("Flag Change 1>>> ");
+       if(!em_convert_mail_int_to_flag(i_flag, &new_flag, &err)) {
+               EM_DEBUG_EXCEPTION("em_convert_mail_int_to_flag failed");
+               return;
+       }
+       if(emdaemon_modify_flag(mail_id, new_flag, onserver, sticky_flag, &err))                
+               EM_DEBUG_LOG("emdaemon_modify_flag - success");
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter local_result failed ");
+               if (!emipc_execute_stub_api(a_hAPI))
+                       EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed  ");
+       EM_DEBUG_FUNC_END();
+}
+
+void stb_modify_mail_extra_flag(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int err = EMF_ERROR_NONE;
+       int mail_id = 0;
+       int buffer_size = 0;
+       emf_extra_flag_t new_flag= { 0 };
+       char* local_stream = NULL;
+
+       EM_DEBUG_LOG("mail_id");
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, sizeof(int), &mail_id);
+
+       EM_DEBUG_LOG("extra_flag");
+       buffer_size = emipc_get_parameter_length(a_hAPI, ePARAMETER_IN, 1);
+
+       if(buffer_size > 0) {
+               local_stream = (char*)em_malloc(buffer_size+1);
+               EM_NULL_CHECK_FOR_VOID(local_stream);
+               if(local_stream) {
+                       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 1, buffer_size, local_stream);
+                       em_convert_byte_stream_to_extra_flags(local_stream, &new_flag);
+                       EM_SAFE_FREE(local_stream);
+               }
+
+               if(emdaemon_modify_extra_flag(mail_id, new_flag, &err))         
+                       EM_DEBUG_LOG("emdaemon_modify_extra_flag - success");
+               
+               if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+                               EM_DEBUG_EXCEPTION("emipc_add_parameter local_result failed ");
+               
+                       if (!emipc_execute_stub_api(a_hAPI))
+                               EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed  ");
+               
+       }
+       EM_DEBUG_FUNC_END();
+}
+
+void stb_get_mail_count_of_mailbox(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int buffer_size = 0;
+       int local_result = 0;
+       char* local_stream = NULL;
+       emf_mailbox_t mailbox;
+       int total_count = 0;
+       int unseen= 0;
+
+       EM_DEBUG_LOG("mailbox");
+       buffer_size = emipc_get_parameter_length(a_hAPI, ePARAMETER_IN, 0);
+
+       if(buffer_size > 0)     {
+               local_stream = (char*)em_malloc(buffer_size+1);
+               if(!local_stream) {
+                       EM_DEBUG_EXCEPTION("EMF_ERROR_OUT_OF_MEMORY");
+                       goto FINISH_OFF;
+               }
+               emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, buffer_size, local_stream);
+               em_convert_byte_stream_to_mailbox(local_stream, &mailbox);
+               EM_SAFE_FREE(local_stream);
+       }
+
+       /*get the Mailbox Count */
+       if (!emdaemon_get_mail_count_of_mailbox(&mailbox, &total_count, &unseen, NULL)) {
+               EM_DEBUG_EXCEPTION("emdaemon_get_mail_count_of_mailbox - failed");
+               goto FINISH_OFF;
+       }
+       else {
+               EM_DEBUG_LOG("emdaemon_get_mail_count_of_mailbox - success");
+               local_result = 1;
+       }
+
+FINISH_OFF:
+
+       if(local_result) {
+               if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &local_result, sizeof(int)))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter local_result failed ");
+
+               /* Totol count of mails */
+               if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &total_count, sizeof(int)))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed  ");
+
+               /* Unread Mail */
+               if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &unseen, sizeof(int)))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed  ");
+
+               if (!emipc_execute_stub_api(a_hAPI))
+                       EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed  ");
+       }
+       else {
+               if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &local_result, sizeof(int)))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter local_result failed ");
+               if (!emipc_execute_stub_api(a_hAPI))
+                       EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed");
+       }
+
+       EM_DEBUG_FUNC_END();
+}
+
+
+/* sowmya.kr, 10-May-2010, changes for API improvement */
+void stb_sync_header(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int buffer_size = 0;
+       int err = EMF_ERROR_NONE;
+       char* local_stream = NULL;
+       emf_mailbox_t mailbox, *pointer_mailbox = NULL;
+       int handle = -1;
+       
+       EM_DEBUG_LOG("mailbox");
+       buffer_size = emipc_get_parameter_length(a_hAPI, ePARAMETER_IN, 0);
+
+       if(buffer_size > 0) {
+               local_stream = (char*)em_malloc(buffer_size+1);
+               EM_NULL_CHECK_FOR_VOID(local_stream);
+               if(!local_stream) {
+                       err = EMF_ERROR_OUT_OF_MEMORY;
+                       goto FINISH_OFF;
+               }
+               emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, buffer_size, local_stream);
+               em_convert_byte_stream_to_mailbox(local_stream, &mailbox);
+               EM_SAFE_FREE(local_stream);
+               pointer_mailbox = &mailbox;
+       }
+
+  if(emdaemon_sync_header(pointer_mailbox, (unsigned*)&handle, &err)) {
+               EM_DEBUG_LOG("emdaemon_sync_header success ");
+  }
+
+FINISH_OFF:
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed ");
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &handle, sizeof(int)))
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed ");
+       if (!emipc_execute_stub_api(a_hAPI))
+               EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed  ");
+       EM_DEBUG_FUNC_END();
+}
+
+void stb_download_body(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int buffer_size = 0;
+       int err = EMF_ERROR_NONE;
+       char* local_stream = NULL;
+       emf_mailbox_t mailbox;
+       int mail_id = 0;
+       int has_attachment = 0;
+       unsigned int handle = 0;
+       
+       buffer_size = emipc_get_parameter_length(a_hAPI, ePARAMETER_IN, 0);
+
+       if(buffer_size > 0)     {
+               local_stream = (char*)em_malloc(buffer_size+1);
+               EM_NULL_CHECK_FOR_VOID(local_stream);
+               if(local_stream) {
+                       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, buffer_size, local_stream);
+                       em_convert_byte_stream_to_mailbox(local_stream, &mailbox);
+                       EM_SAFE_FREE(local_stream);
+               }
+       }
+
+       /* Mail Id */
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 1, sizeof(int), &mail_id);
+
+       /* Has Attachment */
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 2, sizeof(int), &has_attachment);
+
+       /*Download Body */
+       if (!emdaemon_download_body(&mailbox, mail_id, 1, has_attachment, &handle, &err)) {
+               EM_DEBUG_EXCEPTION("emdaemon_download_body - failed");
+               goto FINISH_OFF;
+       }
+
+       err = EMF_ERROR_NONE;
+
+FINISH_OFF:
+
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+       EM_DEBUG_EXCEPTION("emipc_add_parameter local_result failed ");
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &handle, sizeof(int)))
+               EM_DEBUG_EXCEPTION("emipc_add_parameter local_result failed ");
+       if (!emipc_execute_stub_api(a_hAPI))
+               EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed  ");
+
+       EM_DEBUG_FUNC_END();
+}
+
+
+void stb_create_mailbox(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int             buffer_size                     = 0;
+       int             err = EMF_ERROR_NONE;
+       char            *local_stream  = NULL;
+       int             on_server               = 0;
+       emf_mailbox_t mailbox;
+       int handle = 0; /* Added for cancelling mailbox creating  */
+
+       buffer_size = emipc_get_parameter_length(a_hAPI, ePARAMETER_IN, 0);
+       EM_DEBUG_LOG("size [%d]", buffer_size);
+
+       if(buffer_size > 0) {
+               local_stream = (char*)em_malloc(buffer_size+1);
+               EM_NULL_CHECK_FOR_VOID(local_stream);
+               if(local_stream) {
+                       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, buffer_size, local_stream);
+                       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 1, sizeof(int), &on_server);
+                       em_convert_byte_stream_to_mailbox(local_stream, &mailbox);
+                       EM_SAFE_FREE(local_stream);
+                                       
+                       if (mailbox.name)
+                               EM_DEBUG_LOG("Mailbox name - %s", mailbox.name);
+                       
+                       if(emdaemon_add_mailbox(&mailbox, on_server, (unsigned*)&handle, &err))
+                               err = EMF_ERROR_NONE;
+                       
+                       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+                               EM_DEBUG_EXCEPTION("emipc_add_parameter failed 1");
+                       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &handle, sizeof(int)))
+                               EM_DEBUG_EXCEPTION("emipc_add_parameter failed 2");
+                       
+                       if (!emipc_execute_stub_api(a_hAPI)) {
+                               EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed  ");
+                               return;
+                       }
+               }
+       }       
+       EM_DEBUG_FUNC_END();
+}
+
+
+void stb_delete_mailbox(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int             buffer_size                     = 0;
+       int              err = EMF_ERROR_NONE;
+       char    *local_stream  = NULL;
+       int             on_server               = 0;
+       emf_mailbox_t mailbox;
+       int handle = 0; /* Added for cancelling mailbox deleting */
+
+       buffer_size = emipc_get_parameter_length(a_hAPI, ePARAMETER_IN, 0);
+       
+       EM_DEBUG_LOG("size [%d]", buffer_size);
+
+       if(buffer_size > 0) {
+               local_stream = (char*)em_malloc(buffer_size+1);
+               EM_NULL_CHECK_FOR_VOID(local_stream);
+               if(local_stream) {
+                       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, buffer_size, local_stream);
+                       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 1, sizeof(int), &on_server);
+                       
+                       em_convert_byte_stream_to_mailbox(local_stream, &mailbox);
+                       EM_SAFE_FREE(local_stream);
+
+                       if (mailbox.name)
+                               EM_DEBUG_LOG("Mailbox name - %s", mailbox.name);
+                       if(emdaemon_delete_mailbox(&mailbox, on_server, (unsigned*)&handle, &err))
+                               err = EMF_ERROR_NONE;
+                       
+                       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+                               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+                       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &handle, sizeof(int)))
+                               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+                       
+                       if (!emipc_execute_stub_api(a_hAPI))
+                               EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed");
+                       
+               }
+       }       
+       EM_DEBUG_FUNC_END();
+}
+
+void stb_update_mailbox(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int             buffer_size                     = 0;
+       int              err = EMF_ERROR_NONE;
+       char    *old_mailbox_stream  = NULL;
+       char    *new_mailbox_stream  = NULL;
+       int             on_server               = 0;
+       emf_mailbox_t *old_mailbox = NULL;
+       emf_mailbox_t *new_mailbox = NULL;
+       int handle = 0; /* Added for cancelling mailbox updating */
+
+       buffer_size = emipc_get_parameter_length(a_hAPI, ePARAMETER_IN, 0);
+       EM_DEBUG_LOG("size [%d]", buffer_size);
+       if(buffer_size > 0)       {
+               old_mailbox_stream = (char*)em_malloc(buffer_size+1);
+               EM_NULL_CHECK_FOR_VOID(old_mailbox_stream);
+               if(old_mailbox_stream) {
+                       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, buffer_size, old_mailbox_stream);
+                       old_mailbox = (emf_mailbox_t*)em_malloc(sizeof(emf_mailbox_t));
+                       if ( old_mailbox == NULL ) {
+                               EM_DEBUG_EXCEPTION("em_malloc failed.");
+                               err = EMF_ERROR_OUT_OF_MEMORY;
+                               goto FINISH_OFF;
+                       }
+
+                       em_convert_byte_stream_to_mailbox(old_mailbox_stream, old_mailbox);
+                       EM_SAFE_FREE(old_mailbox_stream);
+               }
+       }
+       else {
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
+               err = EMF_ERROR_INVALID_PARAM;
+               goto FINISH_OFF;
+       }
+
+       buffer_size = emipc_get_parameter_length(a_hAPI, ePARAMETER_IN, 1);
+       EM_DEBUG_LOG("size [%d]", buffer_size);
+       if(buffer_size > 0)       {
+               new_mailbox_stream = (char*)em_malloc(buffer_size+1);
+               EM_NULL_CHECK_FOR_VOID(new_mailbox_stream);
+               if(new_mailbox_stream) {
+                       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 1, buffer_size, new_mailbox_stream);
+                       new_mailbox = (emf_mailbox_t*)em_malloc(sizeof(emf_mailbox_t));
+                       if ( new_mailbox == NULL ) {
+                               EM_DEBUG_EXCEPTION("em_malloc failed.");
+                               err = EMF_ERROR_OUT_OF_MEMORY;
+                               goto FINISH_OFF;
+                       }
+                       em_convert_byte_stream_to_mailbox(new_mailbox_stream, new_mailbox);
+                       EM_SAFE_FREE(new_mailbox_stream);
+               }
+       }
+       else {
+               EM_DEBUG_EXCEPTION("INVALID PARAM : old mailbox");
+               err = EMF_ERROR_INVALID_PARAM;
+               goto FINISH_OFF;
+       }
+       
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 2, sizeof(int), &on_server);
+       
+       if(emdaemon_update_mailbox(old_mailbox, new_mailbox, on_server, (unsigned*)&handle, &err))
+               err = EMF_ERROR_NONE;
+
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &handle, sizeof(int)))
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+       
+       if (!emipc_execute_stub_api(a_hAPI))
+               EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed");
+                       
+
+FINISH_OFF:
+       EM_SAFE_FREE(old_mailbox_stream);
+       EM_SAFE_FREE(new_mailbox_stream);
+
+       emdaemon_free_mailbox(&old_mailbox, 1, NULL);
+       emdaemon_free_mailbox(&new_mailbox, 1, NULL);
+       EM_DEBUG_FUNC_END();
+}
+
+
+void stb_set_mail_slot_size_of_mailbox(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int buffer_size  = 0;
+       int     err    = EMF_ERROR_NONE;
+       int handle = 0; 
+       int account_id = 0, mail_slot_size = 0;
+       char *mailbox_name = NULL;
+
+
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, sizeof(int), &account_id);
+       EM_DEBUG_LOG("account_id[%d]", account_id);
+
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 1, sizeof(int), &mail_slot_size);
+       EM_DEBUG_LOG("mail_slot_size[%d]", mail_slot_size);
+
+       buffer_size = emipc_get_parameter_length(a_hAPI, ePARAMETER_IN, 2);
+       EM_DEBUG_LOG("mailbox name string size[%d]", buffer_size);
+       if(buffer_size > 0)       {
+               mailbox_name = (char*)em_malloc(buffer_size + 1);
+               emipc_get_parameter(a_hAPI, ePARAMETER_IN, 2, buffer_size, mailbox_name);
+               EM_DEBUG_LOG("mailbox_name [%s]", mailbox_name);
+       }
+       
+       if(emdaemon_set_mail_slot_size_of_mailbox(account_id, mailbox_name, mail_slot_size, (unsigned*)&handle, &err))
+               err = EMF_ERROR_NONE;
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed 1");
+
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &handle, sizeof(int)))
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed 2");
+       
+       if (!emipc_execute_stub_api(a_hAPI))
+               EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed  ");
+
+       EM_SAFE_FREE(mailbox_name);
+       EM_DEBUG_FUNC_END();
+}
+
+void stb_send_mail(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int buffer_size = 0;
+       char* local_option_stream = NULL;
+       char* local_stream = NULL;
+       emf_mailbox_t* mailbox = NULL;
+       emf_option_t sending_option;
+       int mail_id;
+       int handle;
+       int err = EMF_ERROR_NONE;
+       char* mailbox_name = NULL;
+
+       /* Mailbox */
+       buffer_size = emipc_get_parameter_length(a_hAPI, ePARAMETER_IN, 0);
+
+       if(buffer_size > 0) {
+               local_stream = (char*)em_malloc(buffer_size+1);
+               EM_NULL_CHECK_FOR_VOID(local_stream);
+               if(local_stream) {
+                       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, buffer_size, local_stream);
+                       mailbox = (emf_mailbox_t*)em_malloc(sizeof(emf_mailbox_t));
+                       em_convert_byte_stream_to_mailbox(local_stream, mailbox);
+
+                       if (!emstorage_get_mailboxname_by_mailbox_type(mailbox->account_id,EMF_MAILBOX_TYPE_DRAFT,&mailbox_name, false, &err))  {
+                               EM_DEBUG_EXCEPTION("emstorage_get_mailboxname_by_mailbox_type failed [%d]", err);
+               
+                               goto FINISH_OFF;
+                       }
+                       mailbox->name = mailbox_name;
+               }
+       }
+
+       /* Mail_id */
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 1, sizeof(int), &mail_id);
+       EM_DEBUG_LOG("mail_id [%d]", mail_id);
+
+       /* Sending Option */
+       buffer_size = emipc_get_parameter_length(a_hAPI, ePARAMETER_IN, 2);
+
+       if(buffer_size > 0) {
+               local_option_stream = (char*)em_malloc(buffer_size+1);
+               
+               if(NULL == local_option_stream) {
+                       err = EMF_ERROR_OUT_OF_MEMORY;
+                       goto FINISH_OFF;
+               }
+               
+               if(local_option_stream) {
+                       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 2, buffer_size, local_option_stream);
+                       em_convert_byte_stream_to_option(local_option_stream, &sending_option);
+               }
+       }
+
+       if(emdaemon_send_mail(mailbox, mail_id, &sending_option, (unsigned*)&handle, &err)) {
+               err = EMF_ERROR_NONE;
+               if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter result failed ");
+               if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &handle, sizeof(int)))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter result failed ");
+               if (!emipc_execute_stub_api(a_hAPI))
+                       EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed  ");
+       }
+       else {
+               if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed ");
+               if (!emipc_execute_stub_api(a_hAPI))
+                       EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed  ");
+       }
+
+FINISH_OFF:    
+       EM_SAFE_FREE(local_stream);
+       EM_SAFE_FREE(local_option_stream);
+       EM_SAFE_FREE(mailbox);
+       EM_SAFE_FREE(mailbox_name);
+       
+       EM_DEBUG_FUNC_END();
+}
+
+void stb_get_mailbox_list(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int err = EMF_ERROR_NONE;
+       int counter = 0;
+       char* local_stream = NULL;
+       int account_id;
+       emf_mailbox_t* mailbox_list = NULL;
+       int count = 0;
+       int size = 0;
+
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, sizeof(int), &account_id);
+
+       if(emdaemon_get_mailbox_list(account_id, &mailbox_list, &count, &err))
+               EM_DEBUG_LOG("emdaemon_get_mailbox_list - success");
+               
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed ");
+
+       if(EMF_ERROR_NONE == err) {
+               EM_DEBUG_LOG("Count [%d]", count);
+               if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &count, sizeof(int)))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed ");
+
+               for(counter=0; counter<count; counter++) {
+                       EM_DEBUG_LOG("Name - %s", mailbox_list[counter].name);
+
+                       local_stream = em_convert_mailbox_to_byte_stream(mailbox_list+counter, &size);
+
+                       EM_NULL_CHECK_FOR_VOID(local_stream);
+
+                       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, local_stream, size))
+                               EM_DEBUG_EXCEPTION("Add  Param mailbox failed  ");
+
+                       EM_SAFE_FREE(local_stream);
+                       size = 0;
+               }
+       }
+
+       if (!emipc_execute_stub_api(a_hAPI))
+               EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed  ");
+       EM_DEBUG_FUNC_END();
+}
+
+void stb_delete_all_mails(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int buffer_size = 0;
+       char* local_stream = NULL;
+       emf_mailbox_t *mailbox = NULL;
+       int with_server = 0;
+       int err = EMF_ERROR_NONE;
+
+       /* Mailbox */
+       buffer_size = emipc_get_parameter_length(a_hAPI, ePARAMETER_IN, 0);
+
+       if(buffer_size > 0)     {
+               local_stream = (char*)em_malloc(buffer_size+1);
+               EM_NULL_CHECK_FOR_VOID(local_stream);
+               if(local_stream) {
+                       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, buffer_size, local_stream);
+                       mailbox = (emf_mailbox_t*)em_malloc(sizeof(emf_mailbox_t));
+                       em_convert_byte_stream_to_mailbox(local_stream, mailbox);
+               }
+       }
+
+       /* with_server */
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 1, sizeof(int), &with_server);
+
+       emdaemon_delete_mail_all(mailbox, with_server, NULL, &err);
+       
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed ");
+       if (!emipc_execute_stub_api(a_hAPI))
+               EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed  ");
+
+       EM_SAFE_FREE(local_stream);
+       EM_SAFE_FREE(mailbox);
+
+       EM_DEBUG_FUNC_END();
+}
+
+void stb_delete_mail(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int buffer_size = 0;
+       int err = EMF_ERROR_NONE;
+       char* local_stream = NULL;
+       emf_mailbox_t *mailbox = NULL;
+       int with_server = 0;
+       int counter = 0;
+       int num;
+
+       /* Mailbox */
+       EM_DEBUG_LOG("mailbox");
+       buffer_size = emipc_get_parameter_length(a_hAPI, ePARAMETER_IN, 0);
+
+       if(buffer_size > 0)      {
+               local_stream = (char*)em_malloc(buffer_size+1);
+               EM_NULL_CHECK_FOR_VOID(local_stream);
+               if(local_stream) {
+                       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, buffer_size, local_stream);
+                       /* Memory is not yet allocated for mailbox */
+                       mailbox = (emf_mailbox_t*)em_malloc(sizeof(emf_mailbox_t));
+                       em_convert_byte_stream_to_mailbox(local_stream, mailbox);
+               }
+               EM_DEBUG_LOG("account_id [%d]", mailbox->account_id);
+               EM_DEBUG_LOG("mailbox name - %s", mailbox->name);
+
+               /* Number of mail_ids */
+               emipc_get_parameter(a_hAPI, ePARAMETER_IN, 1, sizeof(int), &num);
+               EM_DEBUG_LOG("number of mails [%d]", num);
+
+               int mail_ids[num];      
+               emipc_get_parameter(a_hAPI, ePARAMETER_IN, 2, num * sizeof(int), mail_ids);
+               for(counter = 0; counter < num; counter++)
+                       EM_DEBUG_LOG("mail_ids [%d]", mail_ids[counter]);
+               
+               /* with_server */
+               emipc_get_parameter(a_hAPI, ePARAMETER_IN, 3, sizeof(int), &with_server);
+               EM_DEBUG_LOG("with_Server [%d]", with_server);
+
+               emdaemon_delete_mail(mailbox->account_id, mailbox, mail_ids, num, with_server, NULL, &err);
+       }
+       else
+               err = EMF_ERROR_IPC_CRASH;
+       
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+       if (!emipc_execute_stub_api(a_hAPI))
+               EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed");
+
+       EM_SAFE_FREE(local_stream);
+       EM_SAFE_FREE(mailbox);  
+
+       EM_DEBUG_FUNC_END();    
+}
+void stb_clear_mail_data (HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int err = EMF_ERROR_NONE;
+       
+       if(emdaemon_clear_all_mail_data(&err)) {
+               EM_DEBUG_LOG(">>> stb_clear_mail_data Success [ %d]  >> ", err);
+       }
+       
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed : err");
+       if (!emipc_execute_stub_api(a_hAPI))
+               EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed  ");
+       EM_DEBUG_FUNC_END();
+}
+
+void stb_add_rule(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int buffer_size = 0;
+       int err = EMF_ERROR_NONE;
+       char* local_rule_stream = NULL;
+       emf_rule_t rule = { 0 };
+
+       buffer_size = emipc_get_parameter_length(a_hAPI, ePARAMETER_IN, 0);
+
+       if(buffer_size > 0)     {
+               local_rule_stream = (char*)em_malloc(buffer_size + 1);
+               EM_NULL_CHECK_FOR_VOID(local_rule_stream);
+               if(local_rule_stream) {
+                       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, buffer_size, local_rule_stream);
+                       em_convert_byte_stream_to_rule(local_rule_stream, &rule);
+                       EM_DEBUG_LOG("account ID  [%d]", rule.account_id);
+
+                       if(emdaemon_add_filter(&rule, &err))
+                               err = EMF_ERROR_NONE;
+                       
+                       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+                               EM_DEBUG_EXCEPTION("emipc_add_parameter failed ");
+                       if (!emipc_execute_stub_api(a_hAPI))
+                               EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed  ");
+       
+               }
+       }       
+
+       EM_SAFE_FREE(local_rule_stream);
+
+       EM_DEBUG_FUNC_END();
+}
+
+void stb_get_rule(HIPC_API a_hAPI)
+{
+       int err = EMF_ERROR_NONE;
+       int filter_id = 0;
+       emf_rule_t* rule = NULL;
+       int size =0;
+       char* local_rule_stream = NULL;
+
+       EM_DEBUG_LOG(" filter_id");
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, sizeof(int), &filter_id);
+
+       if(emdaemon_get_filter(filter_id, &rule, &err)) {
+               err = EMF_ERROR_NONE;
+               if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed ");
+               
+               /* Rule */
+               local_rule_stream = em_convert_rule_to_byte_stream(rule, &size);
+
+               EM_NULL_CHECK_FOR_VOID(local_rule_stream);
+
+               if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, local_rule_stream, size))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed  ");
+
+               if (!emipc_execute_stub_api(a_hAPI)) {
+                       EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed  ");
+                       EM_SAFE_FREE( local_rule_stream );
+                       return;
+               }
+       }
+       else {
+               if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed ");
+
+               if (!emipc_execute_stub_api(a_hAPI)) {
+                       EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed  ");
+                       EM_SAFE_FREE( local_rule_stream );                      
+                       return;
+               }
+       }
+       EM_SAFE_FREE( local_rule_stream );      
+       EM_DEBUG_FUNC_END();
+}
+
+void stb_get_rule_list(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       /* int buffer_size = 0; */
+       int err = EMF_ERROR_NONE;
+       int counter = 0;
+       char* local_stream = NULL;
+       int count = 0;
+       int size = 0;
+
+       emf_rule_t* filtering_list = NULL;
+
+       if(emdaemon_get_filter_list(&filtering_list, &count, &err)) {
+               EM_DEBUG_LOG("emdaemon_get_filter_list - success");
+               err = EMF_ERROR_NONE;
+               if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed ");
+
+               EM_DEBUG_LOG("Count [%d]", count);
+               if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &count, sizeof(int)))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed ");
+
+               for(counter=0; counter<count; counter++) {
+                       EM_DEBUG_LOG("Value - %s", filtering_list[counter].value);
+
+                       local_stream = em_convert_rule_to_byte_stream(filtering_list+counter, &size);
+
+                       EM_NULL_CHECK_FOR_VOID(local_stream);
+
+                       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, local_stream, size))
+                               EM_DEBUG_EXCEPTION("emipc_add_parameter failed  ");
+
+                       EM_SAFE_FREE(local_stream);
+                       size = 0;
+               }
+
+               if (!emipc_execute_stub_api(a_hAPI)) {
+                       EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed  ");
+                       return;
+               }
+       }
+
+       else {
+               EM_DEBUG_EXCEPTION("emdaemon_get_filter_list - failed");
+               if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter local_result failed ");
+               
+               if (!emipc_execute_stub_api(a_hAPI)) {
+                       EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed  ");
+                       return;
+               }
+       }
+       EM_DEBUG_FUNC_END();
+}
+
+void stb_find_rule(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int buffer_size = 0;
+       int err = EMF_ERROR_NONE;
+       char* local_rule_stream = NULL;
+       emf_rule_t rule = { 0 };
+
+
+       buffer_size = emipc_get_parameter_length(a_hAPI, ePARAMETER_IN, 0);
+
+       if(buffer_size > 0)      {
+               local_rule_stream = (char*)em_malloc(buffer_size+1);
+               EM_NULL_CHECK_FOR_VOID(local_rule_stream);
+               if(local_rule_stream) {
+                       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, buffer_size, local_rule_stream);
+                       em_convert_byte_stream_to_rule(local_rule_stream, &rule);
+                       EM_SAFE_FREE(local_rule_stream);
+                       EM_DEBUG_LOG("account ID  [%d]", rule.account_id);
+               
+                       if(emdaemon_find_filter(&rule, &err))
+                               err = EMF_ERROR_NONE;
+                       
+                       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+                               EM_DEBUG_EXCEPTION("emipc_add_parameter failed ");
+                       if (!emipc_execute_stub_api(a_hAPI))
+                               EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed  ");
+       
+               }
+       }       
+       EM_DEBUG_FUNC_END();
+}
+
+void stb_update_change(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       
+       int filter_id = 0;
+       int buffer_size = 0;
+       int err = EMF_ERROR_NONE;
+       char* rule_stream = NULL;
+       emf_rule_t  *rule = NULL;
+
+       /* filter_id */
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, sizeof(int), &filter_id);
+       
+       buffer_size = emipc_get_parameter_length(a_hAPI, ePARAMETER_IN, 1);
+       EM_DEBUG_LOG("size [%d]", buffer_size);
+       
+       if(buffer_size > 0)  {
+               rule_stream = (char*)em_malloc(buffer_size+1);
+               EM_NULL_CHECK_FOR_VOID(rule_stream);
+               if(rule_stream) {
+                       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 1, buffer_size, rule_stream);
+                       rule = (emf_rule_t*)em_malloc(sizeof(emf_rule_t));
+
+                       if(NULL == rule)                         {
+                               EM_SAFE_FREE(rule_stream);
+                               return;
+                       }
+                       
+                       em_convert_byte_stream_to_rule(rule_stream, rule);
+                       EM_SAFE_FREE(rule_stream);
+               }
+       }
+
+       if(emdaemon_update_filter(filter_id, rule, &err))
+               err = EMF_ERROR_NONE;
+
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+                       
+       if (!emipc_execute_stub_api(a_hAPI))
+               EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed");
+
+       EM_SAFE_FREE(rule);     
+       EM_DEBUG_FUNC_END();    
+}
+
+void stb_move_all_mails(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int buffer_size = 0;
+       int err = EMF_ERROR_NONE;
+       char* src_mailbox_stream = NULL;        
+       char* dst_mailbox_stream = NULL;
+       emf_mailbox_t dst_mailbox;
+       emf_mailbox_t src_mailbox;      
+
+       buffer_size = emipc_get_parameter_length(a_hAPI, ePARAMETER_IN, 0);
+       EM_DEBUG_LOG("buffer_size [%d]", buffer_size);
+       
+       if(buffer_size > 0)      {
+               src_mailbox_stream = (char*)em_malloc(buffer_size+1);
+               EM_NULL_CHECK_FOR_VOID(src_mailbox_stream);
+               if(src_mailbox_stream) {
+                       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, buffer_size, src_mailbox_stream);
+                       /* Convert Byte stream to mailbox structure */
+                       EM_DEBUG_LOG("Before em_convert_byte_stream_to_mailbox");
+                       em_convert_byte_stream_to_mailbox(src_mailbox_stream, &src_mailbox);
+                       EM_SAFE_FREE(src_mailbox_stream);
+                       if (src_mailbox.name)
+                               EM_DEBUG_LOG("Mailbox name - %s", src_mailbox.name);
+                       else
+                               EM_DEBUG_EXCEPTION(">>>> Mailbox Information is NULL >> ");
+                       
+               }
+       }
+
+       buffer_size =0;
+       buffer_size = emipc_get_parameter_length(a_hAPI, ePARAMETER_IN, 1);
+       EM_DEBUG_LOG(" size [%d]", buffer_size);
+       
+       if(buffer_size > 0)      {
+               dst_mailbox_stream = (char*)em_malloc(buffer_size+1);
+               EM_NULL_CHECK_FOR_VOID(dst_mailbox_stream);
+               if(dst_mailbox_stream) {
+                       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 1, buffer_size, dst_mailbox_stream);
+                       em_convert_byte_stream_to_mailbox(dst_mailbox_stream, &dst_mailbox);
+                       EM_SAFE_FREE(dst_mailbox_stream);
+                       if (dst_mailbox.name)
+                               EM_DEBUG_LOG("Mailbox name - %s", dst_mailbox.name);
+                       else
+                               EM_DEBUG_EXCEPTION(">>>> Mailbox Information is NULL >> ");
+               }
+       }
+       
+       if(emdaemon_move_mail_all_mails(&src_mailbox, &dst_mailbox, &err))
+               EM_DEBUG_LOG("emdaemon_move_mail_all_mails:Success");
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed ");
+               return;
+       }
+       
+       if (!emipc_execute_stub_api(a_hAPI)) {
+               EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed");
+               return;
+       }
+       EM_DEBUG_FUNC_END();
+}
+
+void stb_set_flags_field(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int err = EMF_ERROR_NONE;
+       emf_flags_field_type field_type = 0;
+       int account_id;
+       int value = 0;
+       int onserver = 0;
+       int num = 0;
+       int counter = 0;
+       int *mail_ids = NULL;
+
+       /* account_id */
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, sizeof(int), &account_id);
+       EM_DEBUG_LOG("account_id [%d]", account_id);
+
+       /* Number of mail_ids */
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 1, sizeof(int), &num);
+       EM_DEBUG_LOG("number of mails [%d]", num);
+       
+       /* mail_id */
+       mail_ids = em_malloc(sizeof(int) * num);
+       
+       if(!mail_ids) {
+               EM_DEBUG_EXCEPTION("em_malloc failed ");
+               err = EMF_ERROR_OUT_OF_MEMORY;
+               goto FINISH_OFF;
+       }
+
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 2, num * sizeof(int), mail_ids);
+       
+       for(counter=0; counter < num; counter++)
+               EM_DEBUG_LOG("mailids [%d]", mail_ids[counter]);
+
+       /* field type */
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 3, sizeof(int), &field_type);
+       EM_DEBUG_LOG("field_type [%d]", field_type);
+
+       /* value */
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 4, sizeof(int), &value);
+       EM_DEBUG_LOG("value [%d]", value);
+       
+       /*  on server */
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 5, sizeof(int), &onserver);
+       EM_DEBUG_LOG("onserver [%d]", onserver);
+
+       if(emdaemon_set_flags_field(account_id, mail_ids, num, field_type, value, onserver, &err))      
+               EM_DEBUG_LOG("emdaemon_set_flags_field - success");
+
+FINISH_OFF:
+
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+               EM_DEBUG_EXCEPTION("emipc_add_parameter local_result failed ");
+               
+       if (!emipc_execute_stub_api(a_hAPI))
+               EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed  ");
+       EM_DEBUG_FUNC_END();
+}
+
+void stb_add_mail(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int  buffer_size = 0;
+       int  local_result = 0;
+       int  result_mail_data_count = 0;
+       int  result_attachment_data_count = 0;
+       int  parameter_index = 0;
+       int  sync_server = 0;
+       int  err = EMF_ERROR_NONE;
+       char *mail_data_stream = NULL;
+       char *attachment_data_list_stream = NULL;
+       char *meeting_request_stream = NULL;
+       emf_mail_data_t *result_mail_data = NULL;
+       emf_attachment_data_t *result_attachment_data = NULL;
+       emf_meeting_request_t *result_meeting_request = NULL;
+       
+       EM_DEBUG_LOG("emf_mail_data_t");
+       buffer_size = emipc_get_parameter_length(a_hAPI, ePARAMETER_IN, parameter_index);
+
+       if(buffer_size > 0)      {
+               mail_data_stream = (char*)em_malloc(buffer_size + 1);
+               if(!mail_data_stream) {
+                       err = EMF_ERROR_OUT_OF_MEMORY;
+                       goto FINISH_OFF;
+               }
+               emipc_get_parameter(a_hAPI, ePARAMETER_IN, parameter_index++, buffer_size, mail_data_stream);
+               em_convert_byte_stream_to_mail_data(mail_data_stream, &result_mail_data, &result_mail_data_count);
+               if(!result_mail_data) {
+                       EM_DEBUG_EXCEPTION("em_convert_byte_stream_to_mail_data failed");
+                       err = EMF_ERROR_ON_PARSING;
+                       goto FINISH_OFF;
+               }
+       }
+
+       buffer_size = emipc_get_parameter_length(a_hAPI, ePARAMETER_IN, parameter_index);
+       EM_DEBUG_LOG("emf_attachment_data_t buffer_size[%d]", buffer_size);
+
+       if(buffer_size > 0)      {
+               attachment_data_list_stream = (char*)em_malloc(buffer_size + 1);
+               if(!attachment_data_list_stream) {
+                       EM_DEBUG_EXCEPTION("em_malloc failed");
+                       err = EMF_ERROR_OUT_OF_MEMORY;
+                       goto FINISH_OFF;
+               }
+
+               emipc_get_parameter(a_hAPI, ePARAMETER_IN, parameter_index++, buffer_size, attachment_data_list_stream);
+               em_convert_byte_stream_to_attachment_data(attachment_data_list_stream, &result_attachment_data, &result_attachment_data_count);
+
+               EM_DEBUG_LOG("result_attachment_data_count[%d]", result_attachment_data_count);
+
+               if(result_attachment_data_count && !result_attachment_data) {
+                       EM_DEBUG_EXCEPTION("em_convert_byte_stream_to_attachment_data failed");
+                       err = EMF_ERROR_ON_PARSING;
+                       goto FINISH_OFF;
+               }
+       }
+
+       EM_DEBUG_LOG("emf_meeting_request_t");
+
+       if ( result_mail_data->meeting_request_status == EMF_MAIL_TYPE_MEETING_REQUEST 
+               || result_mail_data->meeting_request_status == EMF_MAIL_TYPE_MEETING_RESPONSE 
+               || result_mail_data->meeting_request_status == EMF_MAIL_TYPE_MEETING_ORIGINATINGREQUEST) {
+               buffer_size = emipc_get_parameter_length(a_hAPI, ePARAMETER_IN, parameter_index);
+
+               if(buffer_size > 0) {
+                       meeting_request_stream = (char*)em_malloc(buffer_size + 1);
+                       if(!meeting_request_stream) {
+                               EM_DEBUG_EXCEPTION("em_convert_byte_stream_to_mail_data failed");
+                               err = EMF_ERROR_OUT_OF_MEMORY;
+                               goto FINISH_OFF;
+                       }
+                       emipc_get_parameter(a_hAPI, ePARAMETER_IN, parameter_index++, buffer_size, meeting_request_stream);
+                       result_meeting_request = (emf_meeting_request_t*)em_malloc(sizeof(emf_meeting_request_t));
+                       if(result_meeting_request)
+                               em_convert_byte_stream_to_meeting_req(meeting_request_stream, result_meeting_request);
+               }
+       }
+
+       EM_DEBUG_LOG("sync_server");
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, parameter_index++, sizeof(int), &sync_server);
+
+       if( (err = emdaemon_add_mail(result_mail_data, result_attachment_data, result_attachment_data_count, result_meeting_request, sync_server)) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("emdaemon_add_mail failed [%d]", err);
+               goto FINISH_OFF;
+       }
+
+       local_result = 1;
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &(result_mail_data->mail_id), sizeof(int)))
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &(result_mail_data->thread_id), sizeof(int)))
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+       if (!emipc_execute_stub_api(a_hAPI))
+               EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed");
+
+FINISH_OFF:
+       if ( local_result == 0 ) {
+               if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               if (!emipc_execute_stub_api(a_hAPI))
+                       EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed");
+       }
+
+       EM_SAFE_FREE(mail_data_stream);
+       EM_SAFE_FREE(attachment_data_list_stream);
+       EM_SAFE_FREE(meeting_request_stream); 
+
+       if(result_mail_data)
+               emcore_free_mail_data(&result_mail_data, 1, NULL);
+
+       if(result_attachment_data)
+               emcore_free_attachment_data(&result_attachment_data, result_attachment_data_count, NULL);
+
+       if(result_meeting_request)
+               emstorage_free_meeting_request(&result_meeting_request, 1, NULL);
+
+       em_flush_memory();
+       EM_DEBUG_FUNC_END();
+}
+
+
+void stb_update_mail(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int  buffer_size = 0;
+       int  local_result = 0;
+       int  result_mail_data_count = 0;
+       int  result_attachment_data_count = 0;
+       int  parameter_index = 0;
+       int  sync_server = 0;
+       int  err = EMF_ERROR_NONE;
+       char *mail_data_stream = NULL;
+       char *attachment_data_list_stream = NULL;
+       char *meeting_request_stream = NULL;
+       emf_mail_data_t *result_mail_data = NULL;
+       emf_attachment_data_t *result_attachment_data = NULL;
+       emf_meeting_request_t *result_meeting_request = NULL;
+
+       EM_DEBUG_LOG("emf_mail_data_t");
+       buffer_size = emipc_get_parameter_length(a_hAPI, ePARAMETER_IN, parameter_index);
+
+       if(buffer_size > 0)      {
+               mail_data_stream = (char*)em_malloc(buffer_size + 1);
+               if(!mail_data_stream) {
+                       err = EMF_ERROR_OUT_OF_MEMORY;
+                       goto FINISH_OFF;
+               }
+               emipc_get_parameter(a_hAPI, ePARAMETER_IN, parameter_index++, buffer_size,mail_data_stream);
+               em_convert_byte_stream_to_mail_data(mail_data_stream, &result_mail_data, &result_mail_data_count);
+               if(!result_mail_data) {
+                       EM_DEBUG_EXCEPTION("em_convert_byte_stream_to_mail_data failed");
+                       err = EMF_ERROR_ON_PARSING;
+                       goto FINISH_OFF;
+               }
+       }
+
+       buffer_size = emipc_get_parameter_length(a_hAPI, ePARAMETER_IN, parameter_index);
+       EM_DEBUG_LOG("emf_attachment_data_t buffer_size[%d]", buffer_size);
+
+       if(buffer_size > 0)      {
+               attachment_data_list_stream = (char*)em_malloc(buffer_size + 1);
+               if(!attachment_data_list_stream) {
+                       EM_DEBUG_EXCEPTION("em_malloc failed");
+                       err = EMF_ERROR_OUT_OF_MEMORY;
+                       goto FINISH_OFF;
+               }
+
+               emipc_get_parameter(a_hAPI, ePARAMETER_IN, parameter_index++, buffer_size, attachment_data_list_stream);
+               em_convert_byte_stream_to_attachment_data(attachment_data_list_stream, &result_attachment_data, &result_attachment_data_count);
+
+               EM_DEBUG_LOG("result_attachment_data_count[%d]", result_attachment_data_count);
+
+               if(result_attachment_data_count && !result_attachment_data) {
+                       EM_DEBUG_EXCEPTION("em_convert_byte_stream_to_attachment_data failed");
+                       err = EMF_ERROR_ON_PARSING;
+                       goto FINISH_OFF;
+               }
+       }
+
+       EM_DEBUG_LOG("emf_meeting_request_t");
+
+       if ( result_mail_data->meeting_request_status == EMF_MAIL_TYPE_MEETING_REQUEST
+               || result_mail_data->meeting_request_status == EMF_MAIL_TYPE_MEETING_RESPONSE
+               || result_mail_data->meeting_request_status == EMF_MAIL_TYPE_MEETING_ORIGINATINGREQUEST) {
+               buffer_size = emipc_get_parameter_length(a_hAPI, ePARAMETER_IN, parameter_index);
+
+               if(buffer_size > 0) {
+                       meeting_request_stream = (char*)em_malloc(buffer_size + 1);
+                       if(!meeting_request_stream) {
+                               EM_DEBUG_EXCEPTION("em_convert_byte_stream_to_mail_data failed");
+                               err = EMF_ERROR_OUT_OF_MEMORY;
+                               goto FINISH_OFF;
+                       }
+                       emipc_get_parameter(a_hAPI, ePARAMETER_IN, parameter_index++, buffer_size, meeting_request_stream);
+                       result_meeting_request = (emf_meeting_request_t*)em_malloc(sizeof(emf_meeting_request_t));
+                       if(result_meeting_request)
+                               em_convert_byte_stream_to_meeting_req(meeting_request_stream, result_meeting_request);
+               }
+       }
+
+       EM_DEBUG_LOG("sync_server");
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, parameter_index++, sizeof(int), &sync_server);
+
+       if( (err = emdaemon_update_mail(result_mail_data, result_attachment_data, result_attachment_data_count, result_meeting_request, sync_server)) != EMF_ERROR_NONE) {
+               EM_DEBUG_EXCEPTION("emdaemon_update_mail failed [%d]", err);
+               goto FINISH_OFF;
+       }
+
+       local_result = 1;
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &(result_mail_data->mail_id), sizeof(int)))
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &(result_mail_data->thread_id), sizeof(int)))
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+       if (!emipc_execute_stub_api(a_hAPI))
+               EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed");
+
+FINISH_OFF:
+       if ( local_result == 0 ) {
+               if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+               if (!emipc_execute_stub_api(a_hAPI))
+                       EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed");
+       }
+
+       EM_SAFE_FREE(mail_data_stream);
+       EM_SAFE_FREE(attachment_data_list_stream);
+       EM_SAFE_FREE(meeting_request_stream);
+
+       if(result_mail_data)
+               emcore_free_mail_data(&result_mail_data, 1, NULL);
+
+       if(result_attachment_data)
+               emcore_free_attachment_data(&result_attachment_data, result_attachment_data_count, NULL);
+
+       if(result_meeting_request)
+               emstorage_free_meeting_request(&result_meeting_request, 1, NULL);
+
+       em_flush_memory();
+       EM_DEBUG_FUNC_END();
+}
+
+
+void stb_move_thread_to_mailbox(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int buffer_size = 0, thread_id = 0, move_always_flag = 0;
+       int err = EMF_ERROR_NONE;
+       char *target_mailbox_name = NULL;
+
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, sizeof(int), &thread_id);
+       EM_DEBUG_LOG("thread_id [%d]", thread_id);
+       
+       buffer_size = emipc_get_parameter_length(a_hAPI, ePARAMETER_IN, 1);
+       EM_DEBUG_LOG("mailbox stream size [%d]", buffer_size);
+       
+       if(buffer_size > 0) {
+               target_mailbox_name = (char*)em_malloc(buffer_size + 1);
+               EM_NULL_CHECK_FOR_VOID(target_mailbox_name);
+               if(target_mailbox_name) {
+                       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 1, buffer_size, target_mailbox_name);
+                       /* Convert Byte stream to mailbox structure */
+                       if (target_mailbox_name)
+                               EM_DEBUG_LOG("Mailbox name - %s", target_mailbox_name);
+                       else
+                               EM_DEBUG_EXCEPTION("Mailbox name is NULL");
+               }
+       }
+
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 2, sizeof(int), &move_always_flag);
+       EM_DEBUG_LOG("move_always_flag [%d]", move_always_flag);
+       
+       if(emdaemon_move_mail_thread_to_mailbox(thread_id, target_mailbox_name, move_always_flag, &err))
+               EM_DEBUG_LOG("emdaemon_move_mail_thread_to_mailbox success");
+
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter fail");
+               EM_SAFE_FREE(target_mailbox_name);
+               return;
+       }
+
+       if (!emipc_execute_stub_api(a_hAPI)) {
+               EM_DEBUG_EXCEPTION("emipc_execute_stub_api fail");
+               EM_SAFE_FREE(target_mailbox_name);
+               return;
+       }
+
+       EM_SAFE_FREE(target_mailbox_name);
+       EM_DEBUG_FUNC_END();
+}
+
+void stb_delete_thread(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       
+       int thread_id = 0, delete_always_flag = 0;
+       unsigned int handle = 0;
+       int err = EMF_ERROR_NONE;
+
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, sizeof(int), &thread_id);
+       EM_DEBUG_LOG("thread_id [%d]", thread_id);
+
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 1, sizeof(int), &delete_always_flag);
+       EM_DEBUG_LOG("delete_always_flag [%d]", delete_always_flag);
+       
+       if(emdaemon_delete_mail_thread(thread_id, delete_always_flag, &handle, &err))
+               EM_DEBUG_LOG("emdaemon_delete_mail_thread success");
+
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter fail");
+               return;
+       }
+
+       if (!emipc_execute_stub_api(a_hAPI)) {
+               EM_DEBUG_EXCEPTION("emipc_execute_stub_api fail");
+               return;
+       }
+       EM_DEBUG_FUNC_END();
+}
+
+void stb_modify_seen_flag_of_thread(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       
+       int thread_id = 0, seen_flag = 0, on_server = 0;
+       unsigned int handle = 0;
+       int err = EMF_ERROR_NONE;
+
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, sizeof(int), &thread_id);
+       EM_DEBUG_LOG("thread_id [%d]", thread_id);
+
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 1, sizeof(int), &seen_flag);
+       EM_DEBUG_LOG("seen_flag [%d]", seen_flag);
+
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 2, sizeof(int), &on_server);
+       EM_DEBUG_LOG("on_server [%d]", on_server);
+       
+       if(emdaemon_modify_seen_flag_of_thread(thread_id, seen_flag, on_server, &handle, &err))
+               EM_DEBUG_LOG("emdaemon_modify_seen_flag_of_thread success");
+
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int))) {
+               EM_DEBUG_EXCEPTION("emipc_add_parameter fail");
+               return;
+       }
+
+       if (!emipc_execute_stub_api(a_hAPI)) {
+               EM_DEBUG_EXCEPTION("emipc_execute_stub_api fail");
+               return;
+       }
+       EM_DEBUG_FUNC_END();
+}
+
+
+void stb_move_mail(HIPC_API a_hAPI)
+{
+       int err = EMF_ERROR_NONE;
+       int buffer_size = 0, num = 0, counter = 0;
+       char *local_stream = NULL;
+       emf_mailbox_t mailbox;
+
+       /* Number of mail_ids */
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, sizeof(int), &num);
+       EM_DEBUG_LOG("number of mails [%d]", num);
+
+       /* mail_id */
+       int mail_ids[num];      
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 1, num * sizeof(int), mail_ids);
+       
+       for(counter = 0; counter < num; counter++)
+               EM_DEBUG_LOG("mailids [%d]", mail_ids[counter]);
+       
+       buffer_size = emipc_get_parameter_length(a_hAPI, ePARAMETER_IN, 2);
+       EM_DEBUG_LOG("size [%d]", buffer_size);
+       
+       if(buffer_size > 0) {
+               local_stream = (char*)em_malloc(buffer_size+1);
+               EM_NULL_CHECK_FOR_VOID(local_stream);
+               if(local_stream) {
+                       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 2, buffer_size, local_stream);
+                       em_convert_byte_stream_to_mailbox(local_stream, &mailbox);
+                       EM_SAFE_FREE(local_stream);
+                       
+                       if (mailbox.name)
+                               EM_DEBUG_LOG("mailbox.name [%s]", mailbox.name);
+                       else
+                               EM_DEBUG_EXCEPTION("mailbox.name is NULL");
+                       
+                       if(emdaemon_move_mail(mail_ids, num, &mailbox, EMF_MOVED_BY_COMMAND, 0, &err))
+                               EM_DEBUG_LOG("emdaemon_move_mail success");
+               }
+       }
+       
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+               EM_DEBUG_EXCEPTION("emipc_add_parameter fail");
+       
+       if (!emipc_execute_stub_api(a_hAPI))
+               EM_DEBUG_EXCEPTION("emipc_execute_stub_api fail");
+       EM_DEBUG_FUNC_END();
+}
+
+void stb_delete_rule(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       
+       int filter_id = 0;
+       int err = EMF_ERROR_NONE;
+       
+       /* filter_id */
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, sizeof(int), &filter_id);
+       
+       if(emdaemon_delete_filter(filter_id, &err))
+               err = EMF_ERROR_NONE;
+
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed ");
+                               
+       if (!emipc_execute_stub_api(a_hAPI))
+               EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed  ");
+       EM_DEBUG_FUNC_END();
+}
+
+void stb_add_attachment(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int buffer_size = 0;
+       int err = EMF_ERROR_NONE;
+       char* local_stream = NULL;
+       emf_mailbox_t mailbox;
+       int mail_id = -1;
+       char* attachment_stream = NULL;
+       emf_attachment_info_t* attachment = NULL;
+
+       /* mailbox */
+       EM_DEBUG_LOG("mailbox");
+       buffer_size = emipc_get_parameter_length(a_hAPI, ePARAMETER_IN, 0);
+
+       if(buffer_size > 0)      {
+               local_stream = (char*)em_malloc(buffer_size+1);
+               EM_NULL_CHECK_FOR_VOID(local_stream);
+               if(local_stream) {
+                       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, buffer_size, local_stream);
+                       em_convert_byte_stream_to_mailbox(local_stream, &mailbox);
+                       EM_SAFE_FREE(local_stream);
+               }
+       }
+
+       /* mail_id */
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 1, sizeof(int), &mail_id);
+
+       /* attachment */
+       buffer_size = emipc_get_parameter_length(a_hAPI, ePARAMETER_IN, 2);
+
+       if(buffer_size > 0)      {
+               attachment_stream = (char*)em_malloc(buffer_size+1);
+               EM_NULL_CHECK_FOR_VOID(attachment_stream);
+               if(attachment_stream) {
+                       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 2, buffer_size, attachment_stream);
+                       em_convert_byte_stream_to_attachment_info(attachment_stream, 1, &attachment);
+                       EM_SAFE_FREE(attachment_stream);
+               }
+       }
+
+       emdaemon_add_attachment(&mailbox, mail_id, attachment, &err);
+       
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+               EM_DEBUG_EXCEPTION("emipc_add_parameter local_result failed ");
+       if(EMF_ERROR_NONE == err) {
+               EM_DEBUG_LOG("emdaemon_add_attachment -Success");
+               
+               if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &(attachment->attachment_id), sizeof(int)))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter attachment_id failed ");
+       }
+               if (!emipc_execute_stub_api(a_hAPI))
+                       EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed  ");
+
+       EM_SAFE_FREE(attachment);               
+       EM_DEBUG_FUNC_END();
+}
+
+void stb_get_attachment(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int buffer_size = 0;
+       int err = EMF_ERROR_NONE;
+       char* local_stream = NULL;
+       emf_mailbox_t mailbox;
+       int mail_id = -1;
+       char* attachment_no = NULL;
+       char* attachment_stream = NULL;
+       emf_attachment_info_t* attachment = NULL;
+       int size = 0;
+
+       /* mailbox */
+       EM_DEBUG_LOG("mailbox");
+       buffer_size = emipc_get_parameter_length(a_hAPI, ePARAMETER_IN, 0);
+
+       if(buffer_size > 0)      {
+               local_stream = (char*)em_malloc(buffer_size+1);
+               EM_NULL_CHECK_FOR_VOID(local_stream);
+               if(local_stream) {
+                       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, buffer_size, local_stream);
+                       em_convert_byte_stream_to_mailbox(local_stream, &mailbox);
+                       EM_SAFE_FREE(local_stream);
+               }
+       }
+
+       /* mail_id */
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 1, sizeof(int), &mail_id);
+
+       /* attachment_no */
+       buffer_size = emipc_get_parameter_length(a_hAPI, ePARAMETER_IN, 2);
+       if(buffer_size > 0)      {
+               attachment_no = (char*)em_malloc(buffer_size+1);
+               if(attachment_no) {
+                       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 2, buffer_size, attachment_no);
+               }
+       }
+       emdaemon_get_attachment(&mailbox, mail_id, attachment_no, &attachment, &err);
+
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+               EM_DEBUG_EXCEPTION("emipc_add_parameter local_result failed ");
+       if(EMF_ERROR_NONE == err) {
+               EM_DEBUG_LOG("emdaemon_get_attachment - Success");
+               /* attachment */
+               attachment_stream = em_convert_attachment_info_to_byte_stream(attachment, &size);
+
+               EM_NULL_CHECK_FOR_VOID(attachment_stream);
+               
+               if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, attachment_stream, size))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed  ");
+       }
+               if (!emipc_execute_stub_api(a_hAPI)) {
+                       EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed  ");
+                       EM_SAFE_FREE(attachment_no);            
+                       EM_SAFE_FREE(attachment_stream); 
+                       return;
+               }
+
+       EM_SAFE_FREE(attachment_no);            
+       EM_SAFE_FREE(attachment_stream); 
+       EM_DEBUG_FUNC_END();
+}
+
+void stb_get_imap_mailbox_list(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int err = EMF_ERROR_NONE;
+       int account_id = 0;
+       unsigned int handle = 0;  
+
+       /* account_id */
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, sizeof(int), &account_id);
+
+       if(emdaemon_get_imap_mailbox_list(account_id, "", &handle, &err))
+               err = EMF_ERROR_NONE;
+               
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+               EM_DEBUG_LOG("ipcAPI_AddParameter local_result failed ");
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &handle, sizeof(int)))
+               EM_DEBUG_LOG("ipcAPI_AddParameter local_result failed ");
+       if (!emipc_execute_stub_api(a_hAPI))
+               EM_DEBUG_LOG("emipc_execute_stub_api failed  ");
+       EM_DEBUG_FUNC_END();
+}
+
+void stb_delete_attachment(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int buffer_size = 0;
+       int err = EMF_ERROR_NONE;
+       char* local_stream = NULL;
+       emf_mailbox_t mailbox;
+       int mail_id = -1;
+       char* attachment_no = NULL;
+
+       /* mailbox */
+       EM_DEBUG_LOG("mailbox");
+       buffer_size = emipc_get_parameter_length(a_hAPI, ePARAMETER_IN, 0);
+
+       if(buffer_size > 0)      {
+               local_stream = (char*)em_malloc(buffer_size+1);
+               EM_NULL_CHECK_FOR_VOID(local_stream);
+               if(local_stream) {
+                       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, buffer_size, local_stream);
+                       em_convert_byte_stream_to_mailbox(local_stream, &mailbox);
+                       EM_SAFE_FREE(local_stream);
+               }
+       }
+
+       /* mail_id */
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 1, sizeof(int), &mail_id);
+
+       /* attachment_no */
+       buffer_size = emipc_get_parameter_length(a_hAPI, ePARAMETER_IN, 2);
+       if(buffer_size > 0)      {
+               attachment_no = (char*)em_malloc(buffer_size+1);
+               if(attachment_no) {
+                       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 2, buffer_size, attachment_no);
+               }
+       }
+
+       emdaemon_delete_mail_attachment(&mailbox, mail_id, attachment_no, &err);
+       
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+               EM_DEBUG_EXCEPTION("emipc_add_parameter local_result failed ");
+       if (!emipc_execute_stub_api(a_hAPI))
+               EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed  ");
+
+       EM_SAFE_FREE(attachment_no);            
+       EM_DEBUG_FUNC_END();
+}
+
+void stb_download_attachment(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       
+       int buffer_size = 0;
+       int err = EMF_ERROR_NONE;
+       char* local_stream = NULL;
+       emf_mailbox_t mailbox;
+       int mail_id = 0;
+       char *nth = NULL;
+       unsigned int handle = 0;  
+       
+       EM_DEBUG_LOG("mailbox");
+       buffer_size = emipc_get_parameter_length(a_hAPI, ePARAMETER_IN, 0);
+
+       if(buffer_size > 0)      {
+               local_stream = (char*)em_malloc(buffer_size+1);
+               EM_NULL_CHECK_FOR_VOID(local_stream);
+               if(local_stream) {
+                       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, buffer_size, local_stream);
+                       em_convert_byte_stream_to_mailbox(local_stream, &mailbox);
+                       EM_SAFE_FREE(local_stream);
+               }
+       }
+
+       EM_DEBUG_LOG("mail_id");
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 1, sizeof(int), &mail_id);
+
+       /* nth */
+       EM_DEBUG_LOG("nth");
+       buffer_size = emipc_get_parameter_length(a_hAPI, ePARAMETER_IN, 2);
+       if(buffer_size > 0)      {
+               nth = (char*)em_malloc(buffer_size+1);
+               if(nth) {
+                       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 2, buffer_size, nth);
+               }
+       }
+
+       if(emdaemon_download_attachment(&mailbox, mail_id, nth, &handle, &err)) {
+               err = EMF_ERROR_NONE;
+
+               if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed ");
+               EM_DEBUG_LOG(">>>>>>>>>> HANDLE = %d", handle);
+               if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &handle, sizeof(int)))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter handle failed ");               
+               if (!emipc_execute_stub_api(a_hAPI))
+                       EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed  ");
+       }
+       else {
+               if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed ");
+               /* Download handle - 17-Apr-09 */
+               EM_DEBUG_LOG(">>>>>>>>>> HANDLE = %d", handle);
+               if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &handle, sizeof(int)))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter handle failed ");               
+               if (!emipc_execute_stub_api(a_hAPI))
+                       EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed  ");
+       }
+
+       EM_SAFE_FREE(nth);              
+       EM_DEBUG_FUNC_END();
+}
+
+void stb_mail_send_saved(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int buffer_size = 0;
+       int err = EMF_ERROR_NONE;
+       char* local_option_stream = NULL;
+       emf_option_t sending_option;
+       int account_id = 0;
+       /* unsigned *handle = NULL; */
+       
+       /* account_id */
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, sizeof(int), &account_id);
+       
+       /* Sending Option */
+       EM_DEBUG_LOG("Sending option");
+       buffer_size = emipc_get_parameter_length(a_hAPI, ePARAMETER_IN, 1);
+
+       if(buffer_size > 0)  {
+               local_option_stream = (char*)em_malloc(buffer_size+1);
+               EM_NULL_CHECK_FOR_VOID(local_option_stream);
+               if(local_option_stream) {
+                       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 1, buffer_size, local_option_stream);
+                       em_convert_byte_stream_to_option(local_option_stream, &sending_option);
+                       /* EM_SAFE_FREE(local_option_stream); */
+               }
+       }
+
+       EM_DEBUG_LOG("calling emdaemon_send_mail_saved");
+       if(emdaemon_send_mail_saved(account_id, &sending_option, NULL, &err))
+               err = EMF_ERROR_NONE;
+               
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+               EM_DEBUG_EXCEPTION("emipc_add_parameter result failed ");
+               
+       if (!emipc_execute_stub_api(a_hAPI))
+               EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed  ");
+       EM_DEBUG_FUNC_END();
+}      
+
+void stb_add_read_receipt(HIPC_API a_hAPI){
+       EM_DEBUG_FUNC_BEGIN();
+       int read_mail_id = 0;
+       int receipt_mail_id = 0;
+       int err = EMF_ERROR_NONE;
+
+       /* read_mail_id */
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, sizeof(int), &read_mail_id);
+       EM_DEBUG_LOG("read_mail_id [%d]", read_mail_id);
+
+       if( (err = emcore_add_read_receipt(read_mail_id, &receipt_mail_id)) != EMF_ERROR_NONE )
+               EM_DEBUG_EXCEPTION("emcore_add_read_receipt failed [%d]", err);
+
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed ");
+
+       if (err == EMF_ERROR_NONE) {
+               if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &receipt_mail_id, sizeof(int)))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed ");
+       }
+
+       if (!emipc_execute_stub_api(a_hAPI))
+               EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed");
+
+       EM_DEBUG_FUNC_END("err [%d]", err);
+}
+
+void stb_retry_sending_mail(HIPC_API a_hAPI)
+{
+
+       EM_DEBUG_FUNC_BEGIN();
+       int mail_id = 0;
+       int timeout_in_sec = 0;
+       int err = EMF_ERROR_NONE;
+
+       /* Mail_id */
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, sizeof(int), &mail_id);
+       EM_DEBUG_LOG("mail_id [%d]", mail_id);
+
+       /* timeout_in_sec */
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 1, sizeof(int), &timeout_in_sec);
+       EM_DEBUG_LOG("timeout_in_sec [%d]", timeout_in_sec);
+
+       if(emdaemon_send_mail_retry(mail_id, timeout_in_sec,&err))
+               EM_DEBUG_LOG("emdaemon_get_mailbox_list - success");    
+
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed ");
+                               
+               if (!emipc_execute_stub_api(a_hAPI))
+                       EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed  ");
+       EM_DEBUG_FUNC_END();
+}
+
+void stb_get_event_queue_status(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int on_sending = 0;
+       int on_receiving = 0;
+       
+       /*get the network status */
+       emdaemon_get_event_queue_status(&on_sending, &on_receiving);
+       
+       /* on_sending */
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &on_sending, sizeof(int)))
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+
+       /* on_receving */
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &on_receiving, sizeof(int)))
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+
+       EM_DEBUG_LOG("stb_get_event_queue_status - Before Execute API");
+       if (!emipc_execute_stub_api(a_hAPI))
+               EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed");
+
+       EM_DEBUG_FUNC_END();
+}
+
+void stb_cancel_job(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int account_id = 0;
+       int handle = 0;
+       int err = EMF_ERROR_NONE;
+
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, sizeof(int), &account_id);
+       EM_DEBUG_LOG("account_id [%d]", account_id);
+
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 1, sizeof(int), &handle);
+       EM_DEBUG_LOG("handle [%d]", handle);    
+
+       if(emdaemon_cancel_job(account_id, handle, &err))
+               err = EMF_ERROR_NONE;
+
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+               EM_DEBUG_EXCEPTION("emipc_add_parameter local_result failed ");
+       if (!emipc_execute_stub_api(a_hAPI))
+               EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed  ");
+       EM_DEBUG_FUNC_END();
+}
+
+void stb_get_pending_job(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       emf_action_t action = -1;
+       int account_id = 0;
+       int mail_id = -1;
+       int err = EMF_ERROR_NONE;
+       emf_event_status_type_t status = 0;
+
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, sizeof(int), &action);
+       EM_DEBUG_LOG("action [%d]", action);
+
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 1, sizeof(int), &account_id);
+       EM_DEBUG_LOG("account_id [%d]", account_id);
+
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 2, sizeof(int), &mail_id);
+       EM_DEBUG_LOG("mail_id [%d]", mail_id);
+
+       if(emdaemon_get_pending_job(action, account_id, mail_id, &status))
+               err = EMF_ERROR_NONE;
+       else
+               err = EMF_ERROR_UNKNOWN;
+
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+               EM_DEBUG_EXCEPTION("emipc_add_parameter local_result failed ");
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &status, sizeof(int)))
+               EM_DEBUG_EXCEPTION("emipc_add_parameter status failed ");
+       if (!emipc_execute_stub_api(a_hAPI))
+               EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed  ");
+       EM_DEBUG_FUNC_END();
+}
+
+void stb_print_receiving_event_queue_via_debug_msg(HIPC_API a_hAPI)
+{
+       emf_event_t *event_queue = NULL;
+       int event_active_queue = 0, err, i;
+
+       emcore_get_receiving_event_queue(&event_queue, &event_active_queue, &err);      
+
+       EM_DEBUG_LOG("======================================================================");
+       EM_DEBUG_LOG("Event active index [%d]", event_active_queue);
+       EM_DEBUG_LOG("======================================================================");
+       for(i = 1; i < 32; i++)
+               EM_DEBUG_LOG("event[%d] : type[%d], account_id[%d], arg[%d], status[%d]", i, event_queue[i].type, event_queue[i].account_id, event_queue[i].event_param_data_4, event_queue[i].status);
+       EM_DEBUG_LOG("======================================================================");
+       EM_DEBUG_LOG("======================================================================");
+       
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed ");
+
+       if (!emipc_execute_stub_api(a_hAPI))
+               EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed");
+       EM_DEBUG_FUNC_END();
+}
+
+void stb_cancel_send_mail_job(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int mail_id = 0;
+       int err = EMF_ERROR_NONE;
+       int account_id = 0;
+
+       /* account_id */
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, sizeof(int), &account_id);
+       EM_DEBUG_LOG("account_id [%d]", account_id);
+       
+       /* Mail_id */
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 1, sizeof(int), &mail_id);
+       EM_DEBUG_LOG("mail_id [%d]", mail_id);
+
+       if(emdaemon_cancel_sending_mail_job(account_id,mail_id,&err))
+               EM_DEBUG_LOG("success");                
+
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+                               
+       if (!emipc_execute_stub_api(a_hAPI))
+               EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed");
+       EM_DEBUG_FUNC_END();
+}
+
+void stb_search_mail_on_server(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int                    i = 0;
+       int                    err = EMF_ERROR_NONE;
+       int                    account_id = 0;
+       int                    buffer_size = 0;
+       int                    search_filter_count = 0;
+       char                  *mailbox_name = NULL;
+       char                  *stream_for_search_filter_list = NULL;
+       unsigned int           job_handle = 0;
+       email_search_filter_t *search_filter_list = NULL;
+
+       /* account_id */
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, sizeof(int), &account_id);
+       EM_DEBUG_LOG("account_id [%d]", account_id);
+
+       /* mailbox_name */
+       buffer_size = emipc_get_parameter_length(a_hAPI, ePARAMETER_IN, 1);
+       if(buffer_size > 0)      {
+               mailbox_name = (char*)em_malloc(buffer_size + 1);
+               EM_NULL_CHECK_FOR_VOID(mailbox_name);
+               emipc_get_parameter(a_hAPI, ePARAMETER_IN, 1, buffer_size, mailbox_name);
+               EM_DEBUG_LOG("mailbox_name [%s]", mailbox_name);
+       }
+
+       /* search_filter_list */
+       buffer_size = emipc_get_parameter_length(a_hAPI, ePARAMETER_IN, 2);
+
+       if(buffer_size > 0)      {
+               stream_for_search_filter_list = (char*)em_malloc(buffer_size+1);
+               EM_NULL_CHECK_FOR_VOID(stream_for_search_filter_list);
+               emipc_get_parameter(a_hAPI, ePARAMETER_IN, 2, buffer_size, stream_for_search_filter_list);
+               em_convert_byte_stream_to_search_filter(stream_for_search_filter_list, &search_filter_list, &search_filter_count);
+               EM_SAFE_FREE(stream_for_search_filter_list);
+       }
+
+       if( (err = emdaemon_search_mail_on_server(account_id ,mailbox_name, search_filter_list, search_filter_count, &job_handle)) == EMF_ERROR_NONE)
+               EM_DEBUG_LOG("success");
+
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed");
+
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &job_handle, sizeof(int)))
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed ");
+
+       if (!emipc_execute_stub_api(a_hAPI))
+               EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed");
+
+       if(search_filter_list) {
+               for(i = 0; i < search_filter_count; i++) {
+                       switch(search_filter_list[i].search_filter_type) {
+                               case EMAIL_SEARCH_FILTER_TYPE_BCC              :
+                               case EMAIL_SEARCH_FILTER_TYPE_CC               :
+                               case EMAIL_SEARCH_FILTER_TYPE_FROM             :
+                               case EMAIL_SEARCH_FILTER_TYPE_KEYWORD          :
+                               case EMAIL_SEARCH_FILTER_TYPE_SUBJECT          :
+                               case EMAIL_SEARCH_FILTER_TYPE_TO               :
+                               case EMAIL_SEARCH_FILTER_TYPE_MESSAGE_ID       :
+                                       EM_SAFE_FREE(search_filter_list[i].search_filter_key_value.string_type_key_value);
+                                       break;
+                               default :
+                                       break;
+                       }
+               }
+       }
+
+       EM_SAFE_FREE(mailbox_name);
+       EM_SAFE_FREE(search_filter_list);
+
+       EM_DEBUG_FUNC_END();
+}
+
+void stb_create_account_with_validation(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int buffer_size = 0;
+       int local_result = 0;
+       unsigned int handle = 0;  
+       char* local_account_stream = NULL;
+       emf_account_t *account;
+       int err = EMF_ERROR_NONE;
+
+       buffer_size = emipc_get_parameter_length(a_hAPI, ePARAMETER_IN, 0);
+       EM_DEBUG_LOG("size [%d]", buffer_size);
+
+       if(buffer_size > 0)      {
+               local_account_stream = (char*)em_malloc(buffer_size+1);
+               if(local_account_stream) {
+                       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, buffer_size, local_account_stream);
+                       /* Convert account stream to structure */
+                       EM_DEBUG_LOG("Before Convert_ByteStream_To_Account");
+                       
+                       account = emcore_get_new_account_reference(); 
+                       em_convert_byte_stream_to_account(local_account_stream, account);
+                       EM_SAFE_FREE(local_account_stream);
+               
+                       account->account_id = NEW_ACCOUNT_ID;
+
+                       if (account->account_name)
+                               EM_DEBUG_LOG("Account name - %s", account->account_name);
+                       if(account->email_addr)
+                               EM_DEBUG_LOG("Email Address - %s", account->email_addr);
+               
+                       if(emdaemon_validate_account_and_create(account, &handle, &err)) {      
+                               
+#ifdef __FEATURE_AUTO_POLLING__
+                               /*  start auto polling, if check_interval not zero */
+                               if(account->check_interval > 0) {
+                                       if(!emdaemon_add_polling_alarm( account->account_id,account->check_interval))
+                                               EM_DEBUG_EXCEPTION("emdaemon_add_polling_alarm[NOTI_ACCOUNT_ADD] : start auto poll failed >>> ");
+                               }
+#endif /*  __FEATURE_AUTO_POLLING__ */
+                               /*  add account details to contact DB  */
+                               /*  emdaemon_insert_accountinfo_to_contact(account); */
+
+                               local_result = 1;
+                               if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &local_result, sizeof(int)))
+                                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed ");              
+                               if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &handle, sizeof(int)))
+                                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed ");
+                               if (!emipc_execute_stub_api(a_hAPI))
+                                       EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed  ");
+                               }
+                       else {
+                               EM_DEBUG_EXCEPTION("emdaemon_validate_account_and_create fail ");
+                               goto FINISH_OFF;
+                       }
+               }
+               else {
+                       err = EMF_ERROR_INVALID_PARAM;
+                       goto FINISH_OFF;
+               }
+       }       
+       else {
+               err = EMF_ERROR_INVALID_PARAM;
+               goto FINISH_OFF;
+       }
+FINISH_OFF:
+       if ( local_result == 0 ) {                      
+               if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &local_result, sizeof(int)))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed : local_result ");
+               if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed : err");
+               if (!emipc_execute_stub_api(a_hAPI))
+                       EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed  ");
+       }
+       EM_DEBUG_FUNC_END();
+}
+
+void stb_backup_account(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+
+#ifdef __FEATURE_BACKUP_ACCOUNT__      
+       char *file_path = NULL;
+       int local_result = 0, err_code = 0, handle = 0, file_path_length = 0;
+       
+       /* file_path_length */
+       file_path_length = emipc_get_parameter_length(a_hAPI, ePARAMETER_IN, 0);
+       if(file_path_length > 0) {
+               EM_DEBUG_LOG("file_path_length [%d]", file_path_length);
+               file_path = em_malloc(file_path_length + 1);
+               emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, file_path_length, file_path);
+               EM_DEBUG_LOG("file_path [%s]", file_path);
+               local_result = emcore_backup_accounts((const char*)file_path, &err_code);
+       }
+
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &local_result, sizeof(int)))
+               EM_DEBUG_LOG("emipc_add_parameter failed ");
+
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err_code, sizeof(int)))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed ");
+                               
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &handle, sizeof(int)))
+               EM_DEBUG_EXCEPTION("emipc_add_parameter result failed ");
+                               
+       if (!emipc_execute_stub_api(a_hAPI))
+               EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed  ");
+
+       EM_SAFE_FREE(file_path);
+#endif /*  __FEATURE_BACKUP_ACCOUNT__ */
+       EM_DEBUG_FUNC_END();
+}
+
+void stb_restore_account(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+#ifdef __FEATURE_BACKUP_ACCOUNT__
+       char *file_path = NULL;
+       int local_result = 0, err_code = 0, handle = 0, file_path_length = 0;
+       
+       /* file_path_length */
+       file_path_length = emipc_get_parameter_length(a_hAPI, ePARAMETER_IN, 0);
+       if(file_path_length > 0)  {
+               EM_DEBUG_LOG("file_path_length [%d]", file_path_length);
+               file_path = em_malloc(file_path_length + 1);
+               emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, file_path_length, file_path);
+               EM_DEBUG_LOG("file_path [%s]", file_path);
+               local_result = emcore_restore_accounts((const char*)file_path, &err_code);
+       }
+
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &local_result, sizeof(int)))
+               EM_DEBUG_LOG("emipc_add_parameter failed ");
+
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err_code, sizeof(int)))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed ");
+                               
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &handle, sizeof(int)))
+               EM_DEBUG_EXCEPTION("emipc_add_parameter result failed ");
+                               
+       if (!emipc_execute_stub_api(a_hAPI))
+               EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed  ");
+
+       EM_SAFE_FREE(file_path);
+#endif /*  __FEATURE_BACKUP_ACCOUNT__ */
+       EM_DEBUG_FUNC_END();
+}
+
+
+void stb_get_password_length(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int account_id = 0;
+       int local_result = 0;
+       int err_code = 0;
+       int password_length = 0;
+       
+       /* account_id */
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, sizeof(int), &account_id);
+       local_result = emstorage_get_password_length_of_account(account_id, &password_length,&err_code);
+
+       EM_DEBUG_LOG("password_length [%d]", password_length);
+
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &local_result, sizeof(int)))
+               EM_DEBUG_LOG("emipc_add_parameter failed ");
+
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err_code, sizeof(int)))
+                       EM_DEBUG_EXCEPTION("emipc_add_parameter failed ");
+                               
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &password_length, sizeof(int)))
+               EM_DEBUG_EXCEPTION("emipc_add_parameter result failed ");
+                               
+       if (!emipc_execute_stub_api(a_hAPI))
+               EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed  ");
+       EM_DEBUG_FUNC_END();
+}
+
+
+void stb_ping_service(HIPC_API a_hAPI)
+{
+       int err = EMF_ERROR_NONE;
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed ");
+
+       if (!emipc_execute_stub_api(a_hAPI))
+               EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed  ");  
+       EM_DEBUG_FUNC_END();
+}
+
+void stb_update_notification_bar_for_unread_mail(HIPC_API a_hAPI)
+{
+       int err = EMF_ERROR_NONE, account_id;
+
+       /* account_id */
+       emipc_get_parameter(a_hAPI, ePARAMETER_IN, 0, sizeof(int), &account_id);
+       EM_DEBUG_LOG("account_id [%d]", account_id);
+
+       if(!emcore_finalize_sync(account_id, &err)) {
+               EM_DEBUG_EXCEPTION("emcore_finalize_sync failed [%d]", err);
+       }
+
+       if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
+               EM_DEBUG_EXCEPTION("emipc_add_parameter failed ");
+
+       if (!emipc_execute_stub_api(a_hAPI))
+               EM_DEBUG_EXCEPTION("emipc_execute_stub_api failed  ");  
+       EM_DEBUG_FUNC_END();
+}
+
+
+void stb_API_mapper(HIPC_API a_hAPI)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int nAPIID = emipc_get_api_id(a_hAPI);
+       
+       switch(nAPIID) {
+               case _EMAIL_API_ADD_ACCOUNT:
+                       stb_create_account(a_hAPI);
+                       break;
+
+               case _EMAIL_API_ADD_MAILBOX:
+                       stb_create_mailbox(a_hAPI);
+                       break;
+
+               case _EMAIL_API_DELETE_MAILBOX:
+                       stb_delete_mailbox(a_hAPI);
+                       break;
+               case _EMAIL_API_UPDATE_MAILBOX:
+                       stb_update_mailbox(a_hAPI);
+                       break;
+
+               case _EMAIL_API_SET_MAIL_SLOT_SIZE:
+                       stb_set_mail_slot_size_of_mailbox(a_hAPI);
+                       break;
+
+               case _EMAIL_API_SEND_MAIL:
+                       stb_send_mail(a_hAPI);
+                       break;
+               
+               case _EMAIL_API_GET_MAILBOX_COUNT:
+                       stb_get_mail_count_of_mailbox(a_hAPI);
+                       break;
+
+               case _EMAIL_API_GET_MAILBOX_LIST:
+                       stb_get_mailbox_list(a_hAPI);
+                       break;
+                       
+               case _EMAIL_API_SYNC_HEADER:
+                       stb_sync_header(a_hAPI);
+                       break;
+                       
+               case _EMAIL_API_DOWNLOAD_BODY:
+                       stb_download_body(a_hAPI);
+                       break;
+
+               case _EMAIL_API_CLEAR_DATA:
+                       stb_clear_mail_data (a_hAPI);
+                       break;
+                       
+               case _EMAIL_API_DELETE_ALL_MAIL:
+                       stb_delete_all_mails(a_hAPI);
+                       break;
+                       
+               case _EMAIL_API_DELETE_MAIL:
+                       stb_delete_mail(a_hAPI);
+                       break;
+
+               case _EMAIL_API_MODIFY_MAIL_FLAG:
+                       stb_modify_mail_flag(a_hAPI);
+                       break;
+
+               case _EMAIL_API_MODIFY_MAIL_EXTRA_FLAG:
+                       stb_modify_mail_extra_flag(a_hAPI);
+                       break;          
+
+               case _EMAIL_API_ADD_RULE:
+                       stb_add_rule(a_hAPI);
+                       break;
+
+               case _EMAIL_API_GET_RULE:
+                       stb_get_rule(a_hAPI);
+                       break;
+
+               case _EMAIL_API_GET_RULE_LIST:
+                       stb_get_rule_list(a_hAPI);
+                       break;
+
+               case _EMAIL_API_FIND_RULE:
+                       stb_find_rule(a_hAPI);
+                       break;
+
+               case _EMAIL_API_UPDATE_RULE:
+                       stb_update_change(a_hAPI);
+                       break;
+                       
+               case _EMAIL_API_DELETE_RULE:
+                       stb_delete_rule(a_hAPI);
+                       break;
+
+               case _EMAIL_API_MOVE_MAIL:
+                       stb_move_mail(a_hAPI);
+                       break;
+
+               case _EMAIL_API_MOVE_ALL_MAIL:
+                       stb_move_all_mails(a_hAPI);
+                       break;  
+
+               case _EMAIL_API_SET_FLAGS_FIELD:
+                       stb_set_flags_field(a_hAPI);
+                       break;
+
+               case _EMAIL_API_ADD_MAIL:
+                       stb_add_mail(a_hAPI);
+                       break;
+
+               case _EMAIL_API_UPDATE_MAIL:
+                       stb_update_mail(a_hAPI);
+                       break;
+
+               case _EMAIL_API_MOVE_THREAD_TO_MAILBOX:
+                       stb_move_thread_to_mailbox(a_hAPI);
+                       break;
+
+               case _EMAIL_API_DELETE_THREAD:
+                       stb_delete_thread(a_hAPI);
+                       break;
+
+               case _EMAIL_API_MODIFY_SEEN_FLAG_OF_THREAD:
+                       stb_modify_seen_flag_of_thread(a_hAPI);
+                       break;
+
+               case _EMAIL_API_DELETE_ACCOUNT:
+                       stb_delete_account(a_hAPI);
+                       break;
+
+               case _EMAIL_API_UPDATE_ACCOUNT:
+                       stb_update_account(a_hAPI);
+                       break;
+
+               case _EMAIL_API_ADD_ATTACHMENT:
+                       stb_add_attachment(a_hAPI);
+                       break;
+
+               case _EMAIL_API_GET_IMAP_MAILBOX_LIST:
+                       stb_get_imap_mailbox_list(a_hAPI);
+                       break;
+                       
+               case _EMAIL_API_GET_ATTACHMENT:
+                       stb_get_attachment(a_hAPI);
+                       break;
+
+               case _EMAIL_API_DELETE_ATTACHMENT:
+                       stb_delete_attachment(a_hAPI);
+                       break;
+
+               case _EMAIL_API_DOWNLOAD_ATTACHMENT:
+                       stb_download_attachment(a_hAPI);
+                       break;
+
+               case _EMAIL_API_GET_ACCOUNT_LIST:
+                       stb_get_account_list(a_hAPI);
+                       break;
+
+               case _EMAIL_API_SEND_SAVED:
+                       stb_mail_send_saved(a_hAPI);
+                       break;
+
+               case _EMAIL_API_ADD_READ_RECEIPT:
+                       stb_add_read_receipt(a_hAPI);
+                       break;
+
+               case _EMAIL_API_CANCEL_JOB:
+                       stb_cancel_job(a_hAPI);
+                       break;
+
+               case _EMAIL_API_GET_PENDING_JOB:
+                       stb_get_pending_job(a_hAPI);
+                       break;
+
+               case _EMAIL_API_NETWORK_GET_STATUS:
+                       stb_get_event_queue_status(a_hAPI);
+                       break;
+
+               case _EMAIL_API_SEND_RETRY:
+                       stb_retry_sending_mail(a_hAPI);
+                       break;
+
+               case _EMAIL_API_VALIDATE_ACCOUNT :
+                       stb_validate_account(a_hAPI);
+                       break;
+
+               case _EMAIL_API_SEND_MAIL_CANCEL_JOB :
+                       stb_cancel_send_mail_job(a_hAPI);
+                       break;
+
+               case _EMAIL_API_SEARCH_MAIL_ON_SERVER :
+                       stb_search_mail_on_server(a_hAPI);
+                       break;
+
+               case _EMAIL_API_ADD_ACCOUNT_WITH_VALIDATION :
+                       stb_create_account_with_validation(a_hAPI);
+                       break;
+
+               case _EMAIL_API_BACKUP_ACCOUNTS:
+                       stb_backup_account(a_hAPI);
+                       break;
+
+               case _EMAIL_API_RESTORE_ACCOUNTS:
+                       stb_restore_account(a_hAPI);
+                       break;
+               
+               case _EMAIL_API_GET_PASSWORD_LENGTH_OF_ACCOUNT:
+                       stb_get_password_length(a_hAPI);
+                       break;
+
+               case _EMAIL_API_PRINT_RECEIVING_EVENT_QUEUE :
+                       stb_print_receiving_event_queue_via_debug_msg(a_hAPI);
+                       break;
+               
+               case _EMAIL_API_PING_SERVICE :
+                       stb_ping_service(a_hAPI);
+                       break;
+
+               case _EMAIL_API_UPDATE_NOTIFICATION_BAR_FOR_UNREAD_MAIL :
+                       stb_update_notification_bar_for_unread_mail(a_hAPI);
+                       break;
+       }
+       EM_DEBUG_FUNC_END();
+}
+
+
+
+
+void hibernation_enter_callback()
+{
+       EM_DEBUG_FUNC_BEGIN();
+       emstorage_db_close(NULL);
+       EM_DEBUG_FUNC_END();
+}
+
+void hibernation_leave_callback()
+{
+       EM_DEBUG_FUNC_BEGIN();
+       emstorage_db_open(NULL);
+       EM_DEBUG_FUNC_END();
+}
+
+INTERNAL_FUNC int main(int argc, char *argv[])
+{
+       /* Do the email-service Initialization 
+       1. Create all DB tables and load the email engine */
+       EM_DEBUG_LOG("Email service begin");
+       int err = 0, ret;
+
+       signal(SIGPIPE, SIG_IGN); /*  to ignore signal 13(SIGPIPE) */
+
+       emdaemon_initialize(&err);
+
+#ifdef USE_OMA_EMN
+       EM_DEBUG_LOG("emdaemon_initialize_emn Start");
+       emdaemon_initialize_emn();
+#endif
+
+       EM_DEBUG_LOG("ipcEmailStub_Initialize Start");
+       
+       ret = emipc_initialize_stub(stb_API_mapper);
+
+       if(ret == true)
+               EM_DEBUG_LOG("ipcEmailStub_Initialize Success");
+       else
+               EM_DEBUG_EXCEPTION("ipcEmailStub_Initialize failed");
+
+       /* Start auto polling */
+#ifdef __FEATURE_AUTO_POLLING__
+       emdaemon_start_auto_polling(&err);
+#endif
+
+       int fd_HibernationNoti;
+
+    fd_HibernationNoti = heynoti_init();
+
+    if(fd_HibernationNoti == -1)
+       EM_DEBUG_EXCEPTION("heynoti_init failed");
+    else {
+               EM_DEBUG_LOG("heynoti_init Success");
+               ret = heynoti_subscribe(fd_HibernationNoti, "HIBERNATION_ENTER", hibernation_enter_callback, (void *)fd_HibernationNoti);
+               EM_DEBUG_LOG("heynoti_subscribe returns %d", ret);
+           ret = heynoti_subscribe(fd_HibernationNoti, "HIBERNATION_LEAVE", hibernation_leave_callback, (void *)fd_HibernationNoti);
+           EM_DEBUG_LOG("heynoti_subscribe returns %d", ret);
+               ret = heynoti_attach_handler(fd_HibernationNoti);
+               EM_DEBUG_LOG("heynoti_attach_handler returns %d", ret);
+       }
+       
+       GMainLoop *mainloop;
+
+       mainloop = g_main_loop_new (NULL, 0);
+
+       g_type_init();
+
+       g_main_loop_run (mainloop);
+
+       if(fd_HibernationNoti != -1) {
+               heynoti_unsubscribe(fd_HibernationNoti, "HIBERNATION_ENTER", hibernation_enter_callback);
+               heynoti_unsubscribe(fd_HibernationNoti, "HIBERNATION_LEAVE", hibernation_leave_callback);
+               heynoti_close(fd_HibernationNoti);
+       }
+       
+       EM_DEBUG_FUNC_END();
+       return 0;
+}
+
diff --git a/email-engine/emf-etc.c b/email-engine/emf-etc.c
deleted file mode 100755 (executable)
index b615b12..0000000
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-
-/******************************************************************************
- * File: emf-etc.c
- * Desc: Mail Framework Etc Implementations
- *
- * Auth:
- *
- * History:
- *    2006.08.16 : created
- *****************************************************************************/
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <vconf.h>
-#include "emflib.h"
-#include "emf-account.h"
-#include "emf-dbglog.h"
-#include "emf-global.h"
-#include "em-core-types.h"
-#include "em-core-event.h"
-#include "em-core-utils.h"
-#include "em-storage.h"
-
-
-int emf_register_event_callback(emf_action_t action, emf_event_callback callback, void* event_data)
-{
-       return em_core_register_event_callback(action, callback, event_data);
-}
-
-int emf_unregister_event_callback(emf_action_t action, emf_event_callback callback)
-{
-       return em_core_unregister_event_callback(action, callback);
-}
-
-
-EXPORT_API void emf_get_event_queue_status(int* on_sending, int* on_receiving)
-{
-       em_core_get_event_queue_status(on_sending, on_receiving);
-}
-
-EXPORT_API int emf_get_pending_job(emf_action_t action, int account_id, int mail_id, emf_event_status_type_t* status)
-{
-       EM_DEBUG_FUNC_BEGIN("action[%d], account_id[%d], mail_id[%d]", action, account_id, mail_id);
-
-       return em_core_get_pending_event(action, account_id, mail_id, status);
-}
-
-EXPORT_API int emf_cancel_job(int account_id, int handle, int* err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("account_id[%d], handle[%d], err_code[%p]", account_id, handle, err_code);
-       
-       int ret = false;
-       int err = EMF_ERROR_NONE;
-       
-       
-       if (!em_core_cancel_thread(handle, NULL, &err))  {
-               EM_DEBUG_EXCEPTION("em_core_cancel_thread failed [%d]", err);
-               goto FINISH_OFF;
-       }
-       
-       ret = true;
-       
-FINISH_OFF:
-       if (err_code != NULL)
-               *err_code = err;
-       EM_DEBUG_FUNC_END();
-       return ret;
-}
-
-
-EXPORT_API int emf_mail_send_mail_cancel_job(int account_id, int mail_id, int* err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("account_id[%d], mail_id[%d], err_code[%p]", account_id, mail_id, err_code);
-       
-       int ret = false;
-       int err = EMF_ERROR_NONE;       
-       int handle = 0;
-       emf_account_t* ref_account = NULL;
-       
-       if (account_id <= 0)  {
-               EM_DEBUG_EXCEPTION("account_id[%d], mail_id[%d]", account_id, mail_id);
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-
-#ifdef __FEATURE_PROGRESS_IN_OUTBOX__
-
-       /*      h.gahlaut@samsung.com: Moved this code from email_cancel_send_mail API to email-service engine
-               since this code has update DB operation which is failing in context of email application process 
-               with an sqlite error -> sqlite3_step fail:8 */
-               
-       /*      which means #define SQLITE_READONLY   8 */  /* Attempt to write a readonly database */ 
-       emf_mail_t* mail = NULL;
-
-       if (!em_core_mail_get_mail(mail_id, &mail, &err))  {
-               EM_DEBUG_EXCEPTION("em_core_mail_get_mail failed [%d]", err);
-               goto FINISH_OFF;
-       }
-
-       if (mail && mail->info) {
-               if (mail->info->extra_flags.status == EMF_MAIL_STATUS_SEND_CANCELED) {
-                       EM_DEBUG_EXCEPTION(">>>> EMF_MAIL_STATUS_SEND_CANCELED Already set for Mail ID [ %d ]", mail_id);
-                       goto FINISH_OFF;
-               }
-               else {                  
-                       mail->info->extra_flags.status = EMF_MAIL_STATUS_SEND_CANCELED;
-
-                       if(!em_core_mail_modify_extra_flag(mail_id, mail->info->extra_flags, &err)) {
-                               EM_DEBUG_EXCEPTION("Failed to modify extra flag [%d]",err);
-                               goto FINISH_OFF;
-                       }
-               }
-       }
-
-#endif
-
-       if(!em_core_get_handle_by_mailId_from_transaction_info(mail_id , &handle )) {
-               EM_DEBUG_EXCEPTION("em_core_get_handle_by_mailId_from_transaction_info failed for mail_id[%d]", mail_id);
-               err = EMF_ERROR_HANDLE_NOT_FOUND;
-               goto FINISH_OFF;
-       }
-
-       if (!(ref_account = emf_get_account_reference(account_id)))  {
-               EM_DEBUG_EXCEPTION("emf_get_account_reference failed [%d]", account_id);
-               err = EMF_ERROR_INVALID_ACCOUNT;
-               goto FINISH_OFF;
-       }
-
-       switch (ref_account->account_bind_type)  {
-               case EMF_BIND_TYPE_EM_CORE :
-                       if (!em_core_cancel_send_mail_thread(handle, NULL, &err))  {
-                               EM_DEBUG_EXCEPTION("em_core_cancel_send_mail_thread failed [%d]", err);
-                               goto FINISH_OFF;
-                       }
-                       break;
-
-               default:
-                       EM_DEBUG_EXCEPTION("unknown account bind type...");
-                       err = EMF_ERROR_INVALID_ACCOUNT;
-                       goto FINISH_OFF;
-       }       
-       
-       if(!em_core_delete_transaction_info_by_mailId(mail_id))
-               EM_DEBUG_EXCEPTION("em_core_delete_transaction_info_by_mailId failed for mail_id[%d]", mail_id);
-       
-       ret = true;
-       
-FINISH_OFF:
-       if(err_code != NULL)
-               *err_code = err;
-       
-#ifdef __FEATURE_PROGRESS_IN_OUTBOX__
-       if(!em_core_mail_free(&mail, 1, &err))
-               EM_DEBUG_EXCEPTION("em_core_mail_free Failed [%d ]", err);      
-
-#endif
-       EM_DEBUG_FUNC_END();
-       return ret;
-}      
-
-
-EXPORT_API int
-emf_clear_mail_data(int* err_code)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       
-       int ret = false;
-       int error = EMF_ERROR_NONE;
-       
-       if (emf_init(&error)) {
-               if (!em_storage_clear_mail_data(true, &error))
-                       EM_DEBUG_EXCEPTION("em_storage_clear_mail_data failed [%d]", error);
-       }
-       else {
-               EM_DEBUG_EXCEPTION("emf_init failed [%d]", error);
-               if (err_code)
-                       *err_code = error;
-               return false;
-       }
-
-       em_core_check_unread_mail();
-
-       ret = true;
-
-       if (!em_storage_create_table(EMF_CREATE_DB_NORMAL, &error)) 
-               EM_DEBUG_EXCEPTION("em_storage_create_table failed [%d]", error);
-       
-       emf_close(&error);
-       
-       if (err_code)
-               *err_code = error;
-       EM_DEBUG_FUNC_END();
-    return ret;
-}
-
-       
-/* --------------------------------------------------------------------------------*/
diff --git a/email-engine/emf-global.c b/email-engine/emf-global.c
deleted file mode 100755 (executable)
index 2555d09..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-
-/******************************************************************************
- * File: emf-global.c
- * Desc: Mail Framework Global Variable Declaration
- *
- * Auth:
- *
- * History:
- *    2006.09.02 : created
- *****************************************************************************/
-#include "emflib.h"
-#include "c-client.h"
-#include "emf-global.h"
-#include "emf-types.h"
-
-
diff --git a/email-engine/emf-init.c b/email-engine/emf-init.c
deleted file mode 100755 (executable)
index eb6a1ba..0000000
+++ /dev/null
@@ -1,333 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-
-/******************************************************************************
- * File: emf-init.c
- * Desc: Mail Framework Initialization
- *
- * Auth:
- *
- * History:
- *    2006.08.16 : created
- *****************************************************************************/
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <glib.h>
-#include <glib-object.h>
-#include <vconf.h>
-#include <dbus/dbus.h>
-
-#include "emflib.h"
-#include "em-storage.h"
-#include "emf-global.h"
-#include "emf-dbglog.h"
-#include "emf-account.h"
-#include "emf-auto-poll.h"   
-#include "em-core-utils.h"
-#include "em-core-mesg.h"
-#include "em-core-event.h" 
-#include "em-core-account.h"    
-#include "em-core-mailbox.h"    
-#include "em-core-api.h"    
-#include "em-core-global.h"
-#include "em-storage.h"   
-#include "em-core-sound.h" 
-
-
-/* added for Disabling the Pthread flag log */
-
-#ifdef API_TEST
-#include "emf-api-test.h"
-#endif
-
-#ifdef _CONTACT_SUBSCRIBE_CHANGE_
-#include <contacts-svc.h>
-#endif
-
-#include <dlfcn.h>
-#define ENGINE_PATH_EM_CORE    "libemail-core.so"
-
-extern int g_client_count ;
-extern int g_client_run;
-
-/*  static functions */
-static int _emf_load_engine(emf_engine_type_t type, int* err_code);
-static int _emf_unload_engine(emf_engine_type_t type, int* err_code);
-
-#ifdef _CONTACT_SUBSCRIBE_CHANGE_
-static void _emf_contact_change_cb(void *data)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       /*  Run new thread and contact sync */
-       EM_DEBUG_LOG("Contact Changed.");
-       em_core_contact_sync_handler();
-}
-#endif
-
-EXPORT_API int emf_init(int* err_code)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       
-       /*  default variable */
-       int ret = false;
-       int err = EMF_ERROR_NONE;
-       
-       if (g_client_count > 0)  {
-               EM_DEBUG_LOG("Initialization was already done. increased counter=[%d]", g_client_count);
-               g_client_count++;
-               return true;
-       }
-       else 
-               EM_DEBUG_LOG("************* start email service build time [%s %s] ************* ", __DATE__, __TIME__);
-
-#ifdef __FEATURE_USE_PTHREAD__
-       dbus_threads_init_default();
-#else  /*  __FEATURE_USE_PTHREAD__ */
-       if (!g_thread_supported())
-               g_thread_init(NULL);
-       dbus_g_thread_init ();
-#endif /*  __FEATURE_USE_PTHREAD__ */
-       
-       g_type_init();
-
-
-       em_storage_shm_file_init(SHM_FILE_FOR_DB_LOCK);
-
-#ifdef __FEATURE_USE_SHARED_MUTEX_FOR_GENERATING_MAIL_ID__
-       em_storage_shm_file_init(SHM_FILE_FOR_MAIL_ID_LOCK);
-#endif /* __FEATURE_USE_SHARED_MUTEX_FOR_GENERATING_MAIL_ID__ */
-
-       /* open database */
-       if (!em_storage_open(&err))  {
-               EM_DEBUG_EXCEPTION("em_storage_open failed [%d]", err);
-               goto FINISH_OFF;
-       }
-
-       if (!em_storage_clean_save_status(EMF_MAIL_STATUS_SAVED, &err))
-               EM_DEBUG_EXCEPTION("em_storage_check_mail_status Failed [%d]", err );
-       
-       g_client_count = 0;    
-       
-       if (!emf_init_account_reference())  {
-               EM_DEBUG_EXCEPTION("emf_init_account_reference fail...");
-               err = EMF_ERROR_DB_FAILURE;
-               goto FINISH_OFF;
-       }
-    EM_DEBUG_LOG("emf_init_account_reference over - g_client_count [%d]", g_client_count);     
-       
-       if (!_emf_load_engine(EMF_ENGINE_TYPE_EM_CORE, &err))  {
-               EM_DEBUG_EXCEPTION("_emf_load_engine failed [%d]", err);
-               
-               /* err = EMF_ERROR_DB_FAILURE; */
-               goto FINISH_OFF;
-       }
-
-       em_core_check_unread_mail(); 
-       
-#ifdef _CONTACT_SUBSCRIBE_CHANGE_
-       em_core_init_last_sync_time();
-       contacts_svc_subscribe_change(CTS_SUBSCRIBE_CONTACT_CHANGE, _emf_contact_change_cb, NULL);
-#endif
-       
-       ret = true;
-       
-FINISH_OFF:
-       if (ret == true)
-               g_client_count = 1;
-
-       EM_DEBUG_LOG(">>>>>>>>> ret value : %d g_client_count [%d]", ret, g_client_count);      
-#ifdef API_TEST
-       emf_api_test_send_mail();
-#endif
-       
-       if (err_code)
-               *err_code = err;
-       
-       EM_DEBUG_FUNC_END();
-       return ret;
-}
-
-EXPORT_API int emf_close(int* err_code)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       
-       /*  default variable */
-       int ret = false;
-       int err = EMF_ERROR_NONE;
-       
-       if (g_client_count > 1) {
-               EM_DEBUG_EXCEPTION("engine is still used by application. decreased counter=[%d]", g_client_count);
-               
-               g_client_count--;
-               
-               /* err = EMF_ERROR_CLOSE_FAILURE; */
-               goto FINISH_OFF;
-       }
-       
-       if (!_emf_unload_engine(EMF_ENGINE_TYPE_EM_CORE, &err)) {
-               EM_DEBUG_EXCEPTION("_emf_unload_engine failed [%d]", err);
-               goto FINISH_OFF;
-       }
-       
-       /* free account reference list */
-       emf_free_account_reference();
-       
-       /* close database */
-       if (!em_storage_close(&err)) {
-               EM_DEBUG_EXCEPTION("em_storage_close failed [%d]", err);
-               goto FINISH_OFF;
-       }
-       
-       g_client_count = 0;
-       
-#ifdef _CONTACT_SUBSCRIBE_CHANGE_
-       contacts_svc_unsubscribe_change(CTS_SUBSCRIBE_CONTACT_CHANGE, _emf_contact_change_cb);
-#endif
-       
-#ifdef __FEATURE_AUTO_POLLING__
-       emf_free_account_alarm_binder_list();
-#endif
-
-       
-       ret = true;
-       
-FINISH_OFF:
-       if (err_code)
-               *err_code = err;
-       
-       return ret;
-}
-
-static int _emf_load_engine(emf_engine_type_t type, int* err_code)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       
-       int err = EMF_ERROR_NONE;
-       int ret = false;
-       
-       switch (type)  {
-               case 1:
-                       /* initialize mail core */
-                       if (!em_core_init(&err)) 
-                               goto FINISH_OFF;
-                       
-                       if (em_core_event_loop_start(&err) < 0) 
-                               goto FINISH_OFF;
-
-                       if (em_core_send_event_loop_start(&err) < 0) 
-                               goto FINISH_OFF;
-
-#ifdef __FEATURE_PARTIAL_BODY_DOWNLOAD__
-                       if (em_core_partial_body_thread_loop_start(&err) < 0) {
-                               EM_DEBUG_EXCEPTION("em_core_partial_body_thread_loop_start failed [%d]",err);
-                               goto FINISH_OFF;
-                       }
-#endif
-/*
-                       if ( em_core_open_contact_db_library() == false )
-                               goto FINISH_OFF;
-*/
-                       if (em_core_alert_loop_start(&err) < 0)         
-                               goto FINISH_OFF;
-               
-                       break;
-               
-               default:
-                       return false;
-       }
-       
-       ret = true;
-       
-FINISH_OFF:
-       if (err_code)
-               *err_code = err;
-       
-       return ret;
-}
-
-static int _emf_unload_engine(emf_engine_type_t type, int* err_code)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       
-       int ret = false;
-       int err = EMF_ERROR_NONE;
-       
-       switch (type)  {
-               case EMF_ENGINE_TYPE_EM_CORE:
-                               /* finish event loop */
-                               em_core_event_loop_stop(&err);
-/*                             
-                       em_core_close_contact_db_library();
-*/                     
-                       ret = true;
-                       break;
-                       
-               default:
-                       err = EMF_ERROR_NOT_SUPPORTED;
-                       break;
-       }
-       
-       if (err_code != NULL)
-               *err_code = err;
-       
-       return ret;
-}
-
-#ifdef __FEATURE_AUTO_POLLING__
-EXPORT_API int emf_auto_polling(int* err_code)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       
-       /*  default variable */
-       int ret = false, count = 0, i= 0;
-       int err = EMF_ERROR_NONE;
-       emf_mail_account_tbl_t* account_list = NULL;
-
-       /* get account list */
-       if (!em_storage_get_account_list(&count, &account_list, false, false, &err))  {
-               EM_DEBUG_EXCEPTION("em_storage_get_account_list failed [%d]", err);             
-               goto FINISH_OFF;
-       }
-
-       for (i = 0; i < count; i++)  {
-               /* start auto poll */
-               /* start auto polling, if check_interval not zero */
-               if(account_list[i].check_interval > 0) {
-                       if(!emf_add_polling_alarm( account_list[i].account_id,account_list[i].check_interval))
-                               EM_DEBUG_EXCEPTION("emf_add_polling_alarm[ NOTI_ACCOUNT_ADD] : start auto poll Failed >>> ");
-               }
-       }
-
-       ret = true;
-FINISH_OFF:  
-       if (account_list)
-               em_storage_free_account(&account_list, count, NULL);
-       
-       if (err_code != NULL)
-               *err_code = err;
-       
-       return ret;
-}
-#endif
-
diff --git a/email-engine/emf-mail.c b/email-engine/emf-mail.c
deleted file mode 100755 (executable)
index 34a8f65..0000000
+++ /dev/null
@@ -1,2124 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-
-/******************************************************************************
- * File: emf-mail.c
- * Desc: Mail Framework Mail Operation
- *
- * Auth: 
- *
- * History:
- *    2006.08.16 : created
- *****************************************************************************/
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <glib.h>
-#include <unistd.h>
-#include <malloc.h>
-
-#include "emflib.h"
-#include "emf-global.h"
-#include "em-core-event.h"
-#include "emf-account.h"
-#include "emf-dbglog.h"
-#include "em-storage.h"
-#include "em-core-account.h"
-#include "em-core-mesg.h"
-#include "em-core-mailbox.h" 
-#include "em-core-utils.h" 
-#include "em-core-smtp.h" 
-#include "em-core-timer.h" 
-
-#ifdef __LOCAL_ACTIVITY__
-extern int g_local_activity_run;
-extern int g_save_local_activity_run;
-#endif
-static int emf_mail_check_mail_id(int mail_id, int* err_code);
-
-EXPORT_API int emf_mail_send(emf_mailbox_t* mailbox, int mail_id, emf_option_t* sending_option, unsigned* handle, int* err_code)
-{      
-       EM_DEBUG_FUNC_BEGIN("mailbox[%p], mail_id[%d], sending_option[%p], handle[%p], err_code[%p]", mailbox, mail_id, sending_option, handle, err_code);
-       
-       int ret = false, err = EMF_ERROR_NONE, err_2 = EMF_ERROR_NONE;
-       int  result_handle = 0, account_id = 0;
-       emf_mailbox_t dest_mbox;
-       emf_option_t* option = NULL;
-       emf_event_t event_data;
-       char* mailbox_name = NULL;
-       
-       if (!mailbox || !mailbox->name || mailbox->account_id <= 0) {
-               if (mailbox != NULL)
-                       EM_DEBUG_EXCEPTION(" mailbox->name[%s], mailbox->account_id[%d]", mailbox->name, mailbox->account_id);
-               if (err_code)
-                       *err_code = EMF_ERROR_INVALID_MAILBOX;          
-               return false;
-       }
-       
-       account_id = mailbox->account_id;
-       
-       if (sending_option != NULL) {
-               if (!(option = (emf_option_t*)em_core_malloc(sizeof(emf_option_t)))) {  
-                       EM_DEBUG_EXCEPTION("em_core_malloc for sending_option failed...");
-                       err = EMF_ERROR_OUT_OF_MEMORY;
-                       goto FINISH_OFF;
-               }
-               memcpy(option, sending_option, sizeof(emf_option_t));
-               option->display_name_from = EM_SAFE_STRDUP(sending_option->display_name_from);
-       }
-       
-       emf_account_t* ref_account = emf_get_account_reference(account_id);
-
-       if (!ref_account) {
-               EM_DEBUG_EXCEPTION("emf_get_account_reference failed [%d]", account_id);
-               err = EMF_ERROR_INVALID_ACCOUNT;
-               goto FINISH_OFF;
-       }
-
-#ifdef __FEATURE_MOVE_TO_OUTBOX_FIRST__
-       if (!em_storage_get_mailboxname_by_mailbox_type(account_id,EMF_MAILBOX_TYPE_OUTBOX,&mailbox_name, false, &err)) {
-               EM_DEBUG_EXCEPTION(" em_storage_get_mailboxname_by_mailbox_type failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
-               goto FINISH_OFF;
-       }
-       if (strcmp(mailbox->name, mailbox_name)) {      
-               dest_mbox.name = mailbox_name;
-               dest_mbox.account_id = account_id;
-               
-               /*  mail is moved to 'OUTBOX' first of all. */
-               if (!em_core_mail_move(&mail_id, 1, dest_mbox.name, EMF_MOVED_AFTER_SENDING, 0, &err)) {
-                       EM_DEBUG_EXCEPTION("em_core_mail_move falied [%d]", err);
-                       goto FINISH_OFF;
-               }
-       }
-#endif /* __FEATURE_MOVE_TO_OUTBOX_FIRST__ */
-
-       if(!em_storage_notify_network_event(NOTI_SEND_START, account_id, NULL, mail_id, 0))
-               EM_DEBUG_EXCEPTION(" em_storage_notify_network_event [ NOTI_SEND_START] Failed >>>> ");
-       
-       /* set EMF_MAIL_STATUS_SEND_WAIT status */
-
-       if(!em_storage_set_field_of_mails_with_integer_value(account_id, &mail_id, 1, "save_status", EMF_MAIL_STATUS_SEND_WAIT, true, &err)) {
-               EM_DEBUG_EXCEPTION("em_storage_set_field_of_mails_with_integer_value [%d]",err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
-               goto FINISH_OFF;
-       }
-
-       switch (ref_account->account_bind_type) {
-               case EMF_BIND_TYPE_EM_CORE:
-                       memset(&event_data, 0x00, sizeof(emf_event_t));
-                       event_data.type               = EMF_EVENT_SEND_MAIL;
-                       event_data.account_id         = account_id;
-                       event_data.event_param_data_1 = (char*)option;
-                       event_data.event_param_data_3 = EM_SAFE_STRDUP(mailbox->name);
-                       event_data.event_param_data_4 = mail_id;
-                       
-                       if (!em_core_insert_send_event(&event_data, &result_handle, &err)) {
-                               EM_DEBUG_EXCEPTION(" em_core_insert_event failed [%d]", err);
-                               goto FINISH_OFF;
-                       }
-#ifdef __LOCAL_ACTIVITY__
-                       EM_DEBUG_LOG("Setting g_save_local_activity_run ");
-                       g_save_local_activity_run = 1;
-#endif
-                       break;
-               
-               default:
-                       EM_DEBUG_EXCEPTION("unsupported account binding type...");
-                       err = EMF_ERROR_NOT_SUPPORTED;
-                       goto FINISH_OFF;
-       }
-       
-       if ( handle )
-               *handle = result_handle;
-
-       ret = true;
-       
-FINISH_OFF:
-       if (ret == false) {     
-               EM_DEBUG_EXCEPTION("emf_mail_send failed [%d]", err);                   
-
-               if(!em_storage_set_field_of_mails_with_integer_value(account_id, &mail_id, 1, "save_status", EMF_MAIL_STATUS_SAVED, true, &err))
-                       EM_DEBUG_EXCEPTION("em_storage_set_field_of_mails_with_integer_value [%d]",err);
-
-               EM_SAFE_FREE(event_data.event_param_data_3);
-               
-               if(option != NULL) {    
-                       EM_SAFE_FREE(option->display_name_from);
-                       EM_SAFE_FREE(option);
-               }
-       }
-
-       if(!em_core_add_transaction_info(mail_id , result_handle , &err_2))
-               EM_DEBUG_EXCEPTION("em_core_add_transaction_info failed [%d]", err_2);
-
-       EM_SAFE_FREE(mailbox_name);
-
-       if (err_code != NULL)
-               *err_code = err;
-
-       EM_DEBUG_FUNC_END();
-       return ret;
-}
-
-EXPORT_API int emf_mail_send_saved(int account_id, emf_option_t* sending_option,  unsigned* handle, int* err_code)
-{      
-       EM_DEBUG_FUNC_BEGIN("account_id[%d], sending_option[%p], handle[%p], err_code[%p]", account_id, sending_option, handle, err_code);
-       
-       /*  default variable */
-       int ret = false;
-       int err = EMF_ERROR_NONE;
-       
-       emf_option_t* option = NULL;
-       emf_event_t event_data;
-       char *mailbox_name = NULL;      
-       
-       memset(&event_data, 0x00, sizeof(emf_event_t));
-       
-       if (account_id <= 0)  {
-               EM_DEBUG_EXCEPTION("account_id = %d", account_id);
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-       
-       if (sending_option)  {
-               option = (emf_option_t*)em_core_malloc(sizeof(emf_option_t));
-               if (!option)  {
-                       EM_DEBUG_EXCEPTION("em_core_malloc failed...");
-                       err = EMF_ERROR_OUT_OF_MEMORY;
-                       goto FINISH_OFF;
-               }
-
-               memcpy(option, sending_option, sizeof(emf_option_t));
-       }
-       
-       emf_account_t* ref_account = emf_get_account_reference(account_id);
-
-       if (!ref_account)  {
-               EM_DEBUG_EXCEPTION("emf_get_account_reference failed [%d]", account_id);
-               err = EMF_ERROR_INVALID_ACCOUNT;
-               goto FINISH_OFF;
-       }
-
-       
-       switch (ref_account->account_bind_type)  {
-               case EMF_BIND_TYPE_EM_CORE:
-                       event_data.type = EMF_EVENT_SEND_MAIL_SAVED;
-                                               
-                       if (!em_storage_get_mailboxname_by_mailbox_type(account_id,EMF_MAILBOX_TYPE_OUTBOX,&mailbox_name, false, &err))  {
-                               EM_DEBUG_EXCEPTION("em_storage_get_mailboxname_by_mailbox_type failed [%d]", err);
-                                                       
-                               err = em_storage_get_emf_error_from_em_storage_error(err);
-                               goto FINISH_OFF;
-                       }
-                       event_data.event_param_data_3 = EM_SAFE_STRDUP(mailbox_name);           
-                       event_data.account_id  = account_id;
-                       event_data.event_param_data_1 = (char*)option;
-               
-                       if (!em_core_insert_event(&event_data, (int*)handle, &err))  {
-                               EM_DEBUG_EXCEPTION("em_core_insert_event failed [%d]", err);
-                               goto FINISH_OFF;
-                       }
-                       break;
-                       
-               default :
-                       EM_DEBUG_EXCEPTION("unknown account bind type...");
-                       err = EMF_ERROR_INVALID_ACCOUNT;
-                       goto FINISH_OFF;
-       }
-       
-       ret = true;
-       
-FINISH_OFF:
-       if (ret == false)  {
-               EM_SAFE_FREE(event_data.event_param_data_3);
-               EM_SAFE_FREE(option);
-       }
-
-       EM_SAFE_FREE(mailbox_name);
-       
-       if (err_code)
-               *err_code = err;
-
-       EM_DEBUG_FUNC_END();
-       return ret;
-}
-
-EXPORT_API int emf_mail_send_report(emf_mail_t* mail,     unsigned* handle, int* err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("mail[%p], handle[%p], err_code[%p]", mail, handle, err_code);
-       
-       /*  default variable */
-       int ret = false;
-       int err = EMF_ERROR_NONE;
-
-       emf_mail_t* tmail = NULL;
-       char* mailbox = NULL;
-       char *mailbox_name = NULL;
-       
-       if (!mail || !mail->info || mail->info->account_id <= 0 || !mail->head || 
-               !mail->head->from || !mail->head->mid)  {
-               if (mail != NULL)  {
-                       if (mail->info != NULL)  {
-                               if (mail->head != NULL)
-                                       EM_DEBUG_LOG("mail->info->account_id[%d], mail->head->from[%p], mail->head->mid[%p]", mail->info->account_id, mail->head->from, mail->head->mid);
-                               else
-                                       EM_DEBUG_LOG("mail->info->account_id[%d], mail->head[%p]", mail->info->account_id, mail->head);         
-                       }
-                       else {
-                               if (mail->head != NULL)
-                                       EM_DEBUG_LOG("mail->info[%p],  mail->head->from[%p], mail->head->mid[%p]", mail->info, mail->head->from, mail->head->mid);
-                               else
-                                       EM_DEBUG_LOG("mail->info[%p],  mail->head[%p]", mail->info, mail->head);
-                       }
-               }
-               else
-                       EM_DEBUG_LOG("mail[%p]", mail);
-               
-               err = EMF_ERROR_INVALID_MAIL; /* EMF_ERROR_INVALID_PARAM */
-               goto FINISH_OFF;
-       }
-
-       emf_account_t* ref_account = emf_get_account_reference(mail->info->account_id);
-       if (!ref_account)  {
-               EM_DEBUG_EXCEPTION("emf_get_account_reference failed [%d]", mail->info->account_id);
-               err = EMF_ERROR_INVALID_ACCOUNT;
-               goto FINISH_OFF;
-       }
-
-       switch (ref_account->account_bind_type)  {
-               case EMF_BIND_TYPE_EM_CORE:
-                       tmail = em_core_malloc(sizeof(emf_mail_t));
-                       tmail->head = em_core_malloc(sizeof(emf_mail_head_t));
-                       
-                       if (!tmail || !tmail->head)  {
-                               EM_DEBUG_EXCEPTION("mailloc failed...");
-                               err = EMF_ERROR_OUT_OF_MEMORY;
-                               goto FINISH_OFF;
-                       }
-
-                       memset(tmail, 0x00, sizeof(emf_mail_t));
-                       memset(tmail->head, 0x00, sizeof(emf_mail_head_t));
-                       
-                       tmail->head->to = EM_SAFE_STRDUP(mail->head->from);
-                       tmail->head->mid = EM_SAFE_STRDUP(mail->head->mid);
-                       
-                       if (mail->head->subject)  {
-                               tmail->head->subject = malloc(strlen(mail->head->subject) + 7);
-                               if (!(tmail->head->subject))  { 
-                                       EM_DEBUG_EXCEPTION("mailloc failed...");
-                                       err = EMF_ERROR_OUT_OF_MEMORY;
-                                       goto FINISH_OFF;
-                               }
-                               
-                               SNPRINTF(tmail->head->subject, strlen(mail->head->subject) + 7 - 1,  "Read: %s", mail->head->subject);
-                       }
-                       
-                       tmail->info = em_core_malloc(sizeof(emf_mail_info_t));
-                       if (!(tmail->info))  {  
-                               EM_DEBUG_EXCEPTION("mailloc failed...");
-                               err = EMF_ERROR_OUT_OF_MEMORY;
-                               goto FINISH_OFF;
-                       }
-                       
-                       memset(tmail->info, 0x00, sizeof(emf_mail_info_t));
-                       
-                       tmail->info->account_id = mail->info->account_id;
-                       tmail->info->flags.draft = 1;
-                       tmail->info->extra_flags.status = (unsigned char)EMF_MAIL_STATUS_SENDING;/* 4; */
-                       tmail->info->extra_flags.report = (unsigned char)EMF_MAIL_REPORT_MDN;
-                                               
-               if (!em_storage_get_mailboxname_by_mailbox_type(mail->info->account_id,EMF_MAILBOX_TYPE_OUTBOX,&mailbox_name, false, &err))  {
-                       EM_DEBUG_EXCEPTION("em_storage_get_mailboxname_by_mailbox_type failed [%d]", err);
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
-                       goto FINISH_OFF;
-               }
-               mailbox = EM_SAFE_STRDUP(mailbox_name);
-                       
-                       
-                       if (!em_core_mail_save(tmail->info->account_id, mailbox, tmail, NULL, 1, &err)) {
-                               EM_DEBUG_EXCEPTION("em_core_mail_save failed [%d]", err);
-                               goto FINISH_OFF;
-                       }
-                       else  {
-                               emf_event_t event_data = { 0 };
-                               event_data.type = EMF_EVENT_SEND_MAIL;
-                               event_data.account_id = tmail->info->account_id;
-                               event_data.event_param_data_4 = tmail->info->uid;
-                               event_data.event_param_data_3 = mailbox;
-                               event_data.event_param_data_1 = NULL;
-                               
-                               if (!em_core_insert_event(&event_data,(int*) handle, &err))  { 
-                                       EM_DEBUG_EXCEPTION("em_core_insert_event failed [%d]", err);
-                                       goto FINISH_OFF;
-                               }
-#ifdef __LOCAL_ACTIVITY__
-                               EM_DEBUG_LOG("Setting g_save_local_activity_run ");
-                               g_save_local_activity_run = 1;
-#endif
-
-                       }
-                       break;
-                       
-               default:
-                       EM_DEBUG_EXCEPTION("unknown account bind type...");
-                       err = EMF_ERROR_INVALID_ACCOUNT;
-                       goto FINISH_OFF;
-
-       }
-       
-       ret = true;
-
-FINISH_OFF:
-       if (tmail != NULL)
-               em_core_mail_free(&tmail, 1, NULL);     
-       if (ret == false)
-               EM_SAFE_FREE(mailbox);
-
-       EM_SAFE_FREE(mailbox_name);
-       
-       if (err_code)
-               *err_code = err;
-       EM_DEBUG_FUNC_END();
-       return ret;
-}
-
-EXPORT_API int emf_add_mail(emf_mail_data_t *input_mail_data, emf_attachment_data_t *input_attachment_data_list, int input_attachment_count, emf_meeting_request_t *input_meeting_request, int input_sync_server)
-{
-       EM_DEBUG_FUNC_BEGIN("input_mail_data[%p], input_attachment_data_list[%p], input_attachment_count [%d], input_meeting_req [%p], input_sync_server[%d]", input_mail_data, input_attachment_data_list, input_attachment_count, input_meeting_request, input_sync_server);
-
-       int         err = EMF_ERROR_NONE;
-       int         handle = 0;
-       emf_event_t event_data = { 0 };
-       
-       if (!input_mail_data || input_mail_data->account_id <= 0 ||
-               (input_mail_data->report_status == EMF_MAIL_REPORT_MDN && !input_mail_data->full_address_to))  {
-               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM"); 
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-       
-       emf_account_t* ref_account = emf_get_account_reference(input_mail_data->account_id);
-       if (!ref_account)  {
-               EM_DEBUG_LOG(" emf_get_account_reference failed [%d]", input_mail_data->account_id);
-               err = EMF_ERROR_INVALID_ACCOUNT;
-               goto FINISH_OFF;
-       }
-       
-       switch (ref_account->account_bind_type)  {
-               case EMF_BIND_TYPE_EM_CORE : 
-                       if ((err = em_core_add_mail(input_mail_data, input_attachment_data_list, input_attachment_count, input_meeting_request, input_sync_server)) != EMF_ERROR_NONE) {
-                               EM_DEBUG_EXCEPTION("em_core_add_mail failed [%d]", err);
-                               goto FINISH_OFF;
-                       }
-
-#ifdef __FEATURE_SYNC_CLIENT_TO_SERVER__
-                       if ( input_sync_server ) {      
-                               event_data.type               = EMF_EVENT_SAVE_MAIL;
-                               event_data.account_id         = input_mail_data->account_id;
-                               event_data.event_param_data_4 = input_mail_data->mail_id;
-
-                               if (!em_core_insert_send_event(&event_data, &handle, &err))  {
-                                       EM_DEBUG_EXCEPTION("em_core_insert_send_event failed [%d]", err);
-                                       goto FINISH_OFF;
-                               }
-                       }
-#endif                 
-               break;
-
-               default:
-                       EM_DEBUG_EXCEPTION("unknown account bind type...");
-                       err = EMF_ERROR_INVALID_ACCOUNT;
-                       goto FINISH_OFF;
-       }
-FINISH_OFF:
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-}
-       
-EXPORT_API int emf_mail_save_to_mailbox(emf_mail_t* mail, emf_mailbox_t* mailbox, emf_meeting_request_t *meeting_req, int from_composer, int* err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("mail[%p], mailbox[%p], err_code[%p]", mail, mailbox, err_code);
-
-       /*  default variable */
-       int ret = false;
-       int err = EMF_ERROR_NONE;
-       struct stat st_buf;
-       emf_event_t event_data;
-       int  handle;
-       
-       if (!mail || !mail->head || !mail->body || !mailbox || mailbox->account_id <= 0 ||
-               (mail->info && mail->info->extra_flags.report == EMF_MAIL_REPORT_MDN && !mail->head->to))  {
-               EM_DEBUG_EXCEPTION("mail[%p], head[%p], body[%p], mailbox[%p], account_id[%d], info[%p], report[%d], to[%p]",
-               mail, mail ? mail->head : 0, mail ? mail->body : 0, mailbox, mailbox ? mailbox->account_id : 0, 
-               mail ? mail->info : 0, mail ? (mail->info?mail->info->extra_flags.report : 0) : 0, mail ? (mail->head ? mail->head->to : 0) : 0); 
-               
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-       
-#ifdef __LOCAL_ACTIVITY__      
-       char *mailbox_name = NULL;
-       if( mailbox->name ) {
-               mailbox_name =  EM_SAFE_STRDUP(mailbox->name) ;  
-       }
-
-#endif
-
-       if(from_composer) {
-               if (mail->body->plain)  {
-                       if (stat(mail->body->plain, &st_buf) < 0)  {
-                               EM_DEBUG_EXCEPTION("mail->body->plain, stat(\"%s\") failed...", mail->body->plain);
-                               err = EMF_ERROR_INVALID_MAIL;
-                               goto FINISH_OFF;
-                       }
-               }
-               
-               if (mail->body->html)  {
-                       if (stat(mail->body->html, &st_buf) < 0)  {
-                               EM_DEBUG_EXCEPTION("mail->body->html, stat(\"%s\") failed...", mail->body->html);
-                               
-                               err = EMF_ERROR_INVALID_MAIL;
-                               goto FINISH_OFF;
-                       }
-
-               }
-               
-               if (mail->body->attachment)  {
-                       emf_attachment_info_t* p = mail->body->attachment;
-                       while (p)  {
-                               if(p->downloaded) {
-                                       if (!p->savename || stat(p->savename, &st_buf) < 0)  {
-                                               EM_DEBUG_EXCEPTION("stat(\"%s\") failed...", p->savename);
-                                               err = EMF_ERROR_INVALID_ATTACHMENT;             
-                                               goto FINISH_OFF;
-                                       }
-                               }
-                               p = p->next;
-                       }
-               }
-       }
-       
-       emf_account_t* ref_account = emf_get_account_reference(mailbox->account_id);
-       if (!ref_account)  {
-               EM_DEBUG_LOG(" emf_get_account_reference failed [%d]", mailbox->account_id);
-               err = EMF_ERROR_INVALID_ACCOUNT;                /* EMF_ERROR_ACCOUNT_NOT_FOUND; */
-               goto FINISH_OFF;
-       }
-       
-       switch (ref_account->account_bind_type)  {
-               case EMF_BIND_TYPE_EM_CORE : 
-                       if (!em_core_mail_save(mailbox->account_id, mailbox->name, mail, meeting_req, from_composer, &err)) {
-                               EM_DEBUG_EXCEPTION("em_core_mail_save failed [%d]", err);
-                               goto FINISH_OFF;
-                       }
-
-
-#ifdef __FEATURE_SYNC_CLIENT_TO_SERVER__       /*  Disable temporarily */
-/*                     if ( from_composer && ref_account->receiving_server_type == EMF_SERVER_TYPE_IMAP4 ) */
-                       if ( from_composer && !mailbox->local) /* Not to be considered for Outbox mails which is local mailbox */ {     
-                               memset(&event_data, 0x00, sizeof(emf_event_t));
-
-                               EM_DEBUG_LOG(">>>>> Save to mailbox on a server: MAIL ID [ %d ] >>>>", mail->info->uid);
-
-                               event_data.type = EMF_EVENT_SAVE_MAIL;
-                               event_data.account_id = mailbox->account_id;
-                               event_data.event_param_data_4 = mail->info->uid;
-
-#ifdef __LOCAL_ACTIVITY__
-                               emf_activity_tbl_t new_activity;
-                               memset( &new_activity, 0x00, sizeof(emf_activity_tbl_t));
-                               new_activity.activity_type = ACTIVITY_SAVEMAIL;
-                               new_activity.account_id    = event_data.account_id;
-                               new_activity.mail_id       = event_data.event_param_data_4;
-       
-                               if( mailbox_name ) {
-                                       new_activity.dest_mbox =  mailbox_name ;  
-                               }
-
-                               if (false == em_core_get_next_activity_id(&new_activity.activity_id,&err)) {
-                                       EM_DEBUG_EXCEPTION(" em_core_get_next_activity_id Failed - %d \n", err);
-                               }
-       
-                               if (!em_core_activity_add(&new_activity, &err)) {
-                                       EM_DEBUG_EXCEPTION(" em_core_activity_add Failed - %d \n", err);
-                               }
-#endif /* __LOCAL_ACTIVITY__ */
-
-                               if (!em_core_insert_send_event(&event_data, &handle, &err))  {
-                                       EM_DEBUG_EXCEPTION("em_core_insert_send_event failed [%d]", err);
-                                       err = EMF_ERROR_NONE;
-                                       ret = true;
-                                       goto FINISH_OFF;
-                               }
-#ifdef __LOCAL_ACTIVITY__
-                               EM_DEBUG_LOG("Setting g_save_local_activity_run ");
-                               g_save_local_activity_run = 1;
-#endif                         
-                       }
-#endif                 
-               break;
-
-               default:
-                       EM_DEBUG_EXCEPTION("unknown account bind type...");
-                       err = EMF_ERROR_INVALID_ACCOUNT;
-                       goto FINISH_OFF;
-       }/*  if with_server */
-
-       ret = true;
-       
-FINISH_OFF:
-
-#ifdef __LOCAL_ACTIVITY__
-       EM_SAFE_FREE(mailbox_name);
-#endif
-       
-       if (err_code)
-               *err_code = err;
-       EM_DEBUG_FUNC_END();
-       return ret;
-}
-
-EXPORT_API int emf_mail_add_meeting_request(int account_id, char *mailbox_name, emf_meeting_request_t *meeting_req, int* err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("account_id[%d], mailbox_name[%s], meeting_req[%p], err_code[%p]", account_id, mailbox_name, meeting_req, err_code);
-
-       /*  default variable */
-       int ret = false;
-       int err = EMF_ERROR_NONE;
-       
-       if ( account_id <= 0 || !meeting_req || meeting_req->mail_id <= 0 )  {
-               if(meeting_req)
-                       EM_DEBUG_EXCEPTION("mail_id[%d]", meeting_req->mail_id);
-               
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-       
-       if (!em_core_mail_add_meeting_request(account_id, mailbox_name, meeting_req, &err))  {
-               EM_DEBUG_EXCEPTION(" em_core_mail_save_meeting_request failed [%d]", err);
-               goto FINISH_OFF;
-       }
-
-       ret = true;
-       
-FINISH_OFF:
-       if (err_code)
-               *err_code = err;
-       EM_DEBUG_FUNC_END();
-       return ret;
-}
-
-/*  unused API */
-int emf_mail_get_size(emf_mailbox_t* mailbox, int mail_id, int* size, int* err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("mailbox[%p], mail_id[%d], size[%p], err_code[%p]", mailbox, mail_id, size, err_code);
-       
-       /*  default variable */
-       int ret = false;
-       int err = EMF_ERROR_NONE;
-       
-       if (!size)  {
-               EM_DEBUG_EXCEPTION("mailbox[%p], mail_id[%d], size[%p]", mailbox, mail_id, size);
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-       
-       if (!emf_mail_check_mail_id(mail_id, &err))  {
-               EM_DEBUG_EXCEPTION("emf_mail_check_mail_id failed [%d]", err);
-               goto FINISH_OFF;
-       }
-       
-       
-       if (!em_core_mail_get_size(/*mailbox,*/ mail_id, size, &err))  {
-               EM_DEBUG_EXCEPTION("em_core_mail_get_size failed [%d]", err);
-               goto FINISH_OFF;
-       }
-       
-       ret = true;
-       
-FINISH_OFF:
-       if (err_code)
-               *err_code = err;
-       EM_DEBUG_FUNC_END();
-       return ret;
-}
-
-int emf_mail_get_mail(emf_mailbox_t* mailbox, int mail_id, emf_mail_t** mail, int* err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("mailbox[%p], mail_id[%d], mail[%p], err_code[%p]", mailbox, mail_id, mail, err_code);
-       
-       /*  default variable */
-       int ret = false;
-       int err = EMF_ERROR_NONE;
-       
-       if (!mail)  {
-               EM_DEBUG_EXCEPTION("mailbox[%p], mail_id[%d], mail[%p]", mailbox, mail_id, mail);
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-       
-       if (!emf_mail_check_mail_id(mail_id, &err))  {
-               EM_DEBUG_EXCEPTION("emf_mail_check_mail_id failed [%d]", err);
-               goto FINISH_OFF;
-       }
-       
-       if (!em_core_mail_get_mail(/*mailbox,*/ mail_id, mail, &err) || !mail)  {
-               EM_DEBUG_EXCEPTION("em_core_mail_get_mail failed [%d]", err);
-               goto FINISH_OFF;
-       }
-       
-       ret = true;
-       
-FINISH_OFF:
-       if (err_code)
-               *err_code = err;
-       EM_DEBUG_FUNC_END();
-       return ret;
-}
-
-EXPORT_API int emf_mail_get_info(emf_mailbox_t* mailbox, int mail_id, emf_mail_info_t** info, int* err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("mailbox[%p], mail_id[%d], info[%p], err_code[%p]", mailbox, mail_id, info, err_code);
-       
-       /*  default variable */
-       int ret = false;
-       int err = EMF_ERROR_NONE;
-       
-       if (!info)  {
-               EM_DEBUG_EXCEPTION("mailbox[%p], mail_id[%d], info[%p]", mailbox, mail_id, info);
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-       
-       if (!emf_mail_check_mail_id(mail_id, &err))  {
-               EM_DEBUG_EXCEPTION("emf_mail_check_mail_id failed [%d]", err);
-               goto FINISH_OFF;
-       }
-       
-       if (!em_core_mail_get_info(mail_id, info, &err) || !info)  {
-               EM_DEBUG_EXCEPTION("em_core_mail_get_info failed [%d]", err);
-               goto FINISH_OFF;
-       }
-       
-       ret = true;
-       
-FINISH_OFF:
-       if (err_code)
-               *err_code = err;
-       EM_DEBUG_FUNC_END();
-       return ret;
-}
-
-int emf_mail_get_head(emf_mailbox_t* mailbox, int mail_id, emf_mail_head_t** head, int* err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("mailbox[%p], mail_id[%d], head[%p], err_code[%p]", mailbox, mail_id, head, err_code);
-       
-       /*  default variable */
-       int ret = false;
-       int err = EMF_ERROR_NONE;
-       
-       if (!head)  {
-               EM_DEBUG_EXCEPTION("mailbox[%p], mail_id[%d], head[%p]", mailbox, mail_id, head);
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-       
-       if (!emf_mail_check_mail_id(mail_id, &err))  {
-               EM_DEBUG_EXCEPTION("emf_mail_check_mail_id failed [%d]", err);
-               goto FINISH_OFF;
-       }
-       
-       if (!em_core_mail_get_header(/*mailbox,*/ mail_id, head, &err) || !head)  {
-               EM_DEBUG_EXCEPTION("em_core_mail_get_header failed [%d]", err);
-               goto FINISH_OFF;
-       }
-       
-       ret = true;
-       
-FINISH_OFF:
-       if (err_code)
-               *err_code = err;
-       
-       return ret;
-}
-
-int emf_mail_get_body(emf_mailbox_t* mailbox, int mail_id, emf_mail_body_t** body, int* err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("mailbox[%p], mail_id[%d], body[%p], err_code[%p]", mailbox, mail_id, body, err_code);
-       
-       /*  default variable */
-       int ret = false;
-       int err = EMF_ERROR_NONE;
-       
-       if (!body)  {
-               EM_DEBUG_EXCEPTION("mailbox[%p], mail_id[%d], body[%p]", mailbox, mail_id, body);
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-       
-       if (!emf_mail_check_mail_id(mail_id, &err))  {
-               EM_DEBUG_EXCEPTION("emf_mail_check_mail_id failed [%d]", err);
-               goto FINISH_OFF;
-       }
-       
-       if (!em_core_mail_get_body(/*mailbox,*/ mail_id, body, &err) || !body)  {
-               EM_DEBUG_EXCEPTION("em_core_mail_get_body failed [%d]", err);
-               goto FINISH_OFF;
-       }
-       
-       ret = true;
-       
-FINISH_OFF:
-       if (err_code)
-               *err_code = err;
-       EM_DEBUG_FUNC_END();
-       return ret;
-}
-
-EXPORT_API int emf_mail_download_body(emf_mailbox_t* mailbox, int mail_id, int verbose, int with_attachment,  unsigned* handle, int* err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("mailbox[%p], mail_id[%d], verbose[%d], with_attachment[%d], handle[%p], err_code[%p]", mailbox, mail_id, verbose, with_attachment,  handle, err_code);
-       
-       /*  default variable */
-       int ret = false;
-       int err = EMF_ERROR_NONE;
-/*     mpNewMail_StopAlertSound(); */
-       
-       if (!emf_mail_check_mail_id(mail_id, &err))  {
-               EM_DEBUG_EXCEPTION("emf_mail_check_mail_id failed [%d]", err);
-               goto FINISH_OFF;
-       }
-       
-       emf_event_t event_data;
-       
-       memset(&event_data, 0x00, sizeof(emf_event_t));
-       
-       event_data.type = EMF_EVENT_DOWNLOAD_BODY;
-       event_data.event_param_data_1 = NULL;
-       event_data.event_param_data_4 = mail_id;
-       event_data.account_id = mailbox->account_id;
-       event_data.event_param_data_3 = GINT_TO_POINTER(verbose << 1 | with_attachment);
-       
-       if (!em_core_insert_event(&event_data, (int*)handle, &err))  {
-               EM_DEBUG_EXCEPTION("em_core_insert_event failed [%d]", err);
-               err = EMF_ERROR_DB_FAILURE;
-               goto FINISH_OFF;
-       }
-#ifdef __LOCAL_ACTIVITY__      
-       EM_DEBUG_LOG("Setting g_local_activity_run ");
-       g_local_activity_run = 1;       
-#endif
-       ret = true;
-       
-FINISH_OFF:
-       if (err_code)
-               *err_code = err;
-       EM_DEBUG_FUNC_END();
-       return ret;
-}
-
-int emf_mail_get_attachment(emf_mailbox_t* mailbox, int mail_id,  char* attachment_id, emf_attachment_info_t** attachment, int* err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("mailbox[%p], mail_id[%d], attachment_id[%s], attachment[%p], err_code[%p]", mailbox, mail_id, attachment_id, attachment, err_code);
-       
-       /*  default variable */
-       int ret = false;
-       int err = EMF_ERROR_NONE;
-       
-       if (!attachment_id || !attachment)  {
-               EM_DEBUG_EXCEPTION("mailbox[%p], mail_id[%d], attachment_id[%p], attachment[%p]\n", mailbox, mail_id, attachment_id, attachment);
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-       
-       if (!emf_mail_check_mail_id(mail_id, &err))  {
-               EM_DEBUG_EXCEPTION("emf_mail_check_mail_id failed [%d]", err);
-               goto FINISH_OFF;
-       }
-       
-       if (!em_core_mail_get_attachment(/*mailbox,*/ mail_id, attachment_id, attachment, &err) || !attachment)  {
-               EM_DEBUG_EXCEPTION("em_core_mail_get_attachment failed [%d]", err);
-               goto FINISH_OFF;
-       }
-       
-       ret = true;
-       
-FINISH_OFF:
-       if (err_code)
-               *err_code = err;
-       EM_DEBUG_FUNC_END();
-       return ret;
-}
-
-int emf_mail_add_attachment(emf_mailbox_t* mailbox, int mail_id, emf_attachment_info_t* attachment, int* err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("mailbox[%p], mail_id[%d], attachment[%p], err_code[%p]", mailbox, mail_id, attachment, err_code);
-       
-       /*  default variable */
-       int ret = false;
-       int err = EMF_ERROR_NONE;
-
-       if (!attachment)  {
-               EM_DEBUG_EXCEPTION(" mailbox[%p], mail_id[%d], attachment[%p]", mailbox, mail_id, attachment);
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-
-       if (!emf_mail_check_mail_id(mail_id, &err))  {
-               EM_DEBUG_EXCEPTION(" emf_mail_check_mail_id failed [%d]", err);
-               goto FINISH_OFF;
-       }
-
-       if (!em_core_mail_add_attachment(/*mailbox,*/ mail_id, attachment, &err))  {
-               EM_DEBUG_EXCEPTION(" em_core_mail_add_attachment failed [%d]", err);
-               goto FINISH_OFF;
-       }
-       
-       ret = true;
-
-FINISH_OFF:
-       if (err_code)
-               *err_code = err;
-       EM_DEBUG_FUNC_END();
-       return ret;
-}
-
-int emf_mail_delete_attachment(emf_mailbox_t* mailbox, int mail_id,  char* attachment_id, int* err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("mailbox[%p], mail_id[%d], attachment_id[%s], err_code[%p]", mailbox, mail_id, attachment_id, err_code);
-       
-       /*  default variable */
-       int ret = false;
-       int err = EMF_ERROR_NONE;
-       
-       if (!attachment_id)  {
-               EM_DEBUG_EXCEPTION(" mailbox[%p], mail_id[%d], attachment_id[%p]", mailbox, mail_id, attachment_id);
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-       
-       if (!emf_mail_check_mail_id(mail_id, &err))  {
-               EM_DEBUG_EXCEPTION(" emf_mail_check_mail_id failed [%d]", err);
-               goto FINISH_OFF;
-       }
-       
-       if (!em_core_mail_delete_attachment(mail_id, attachment_id, &err))  {
-               EM_DEBUG_EXCEPTION(" em_core_mail_delete_attachment failed [%d]", err);
-               goto FINISH_OFF;
-       }
-       
-       ret = true;
-       
-FINISH_OFF:
-       if (err_code)
-               *err_code = err;
-       EM_DEBUG_FUNC_END();
-       return ret;
-}
-
-EXPORT_API int emf_mail_download_attachment(emf_mailbox_t* mailbox, int mail_id, char* attachment, unsigned* handle, int* err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("mailbox[%p], mail_id[%d], attachment[%p], handle[%p], err_code[%p]", mailbox, mail_id, attachment, handle, err_code);
-       
-       int ret = false;
-       int err = EMF_ERROR_NONE;
-       
-       if (!attachment)  {
-               EM_DEBUG_EXCEPTION("attachment[%p] is invalid", attachment);
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-       
-       if (!emf_mail_check_mail_id(mail_id, &err))  {
-               EM_DEBUG_EXCEPTION("emf_mail_check_mail_id failed [%d]", err);
-               goto FINISH_OFF;
-       }
-       
-       emf_event_t event_data;
-       
-       memset(&event_data, 0x00, sizeof(emf_event_t));
-       
-       event_data.type = EMF_EVENT_DOWNLOAD_ATTACHMENT;
-       event_data.event_param_data_1 = NULL;
-       event_data.event_param_data_4 = mail_id;
-       event_data.account_id = mailbox->account_id;    
-       event_data.event_param_data_3 = EM_SAFE_STRDUP(attachment);
-       
-       if (!em_core_insert_event(&event_data, (int*)handle, &err))  {
-               EM_DEBUG_EXCEPTION("em_core_insert_event failed [%d]", err);
-               goto FINISH_OFF;
-       }
-
-#ifdef __LOCAL_ACTIVITY__      
-       EM_DEBUG_LOG("Setting g_local_activity_run ");
-       g_local_activity_run = 1;       
-#endif
-
-       ret = true;
-       
-FINISH_OFF:
-       if (err_code)
-               *err_code = err;
-       
-       return ret;
-}
-
-int emf_mail_info_free(emf_mail_info_t** mail_info_list, int count, int* err_code)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       
-       return em_core_mail_info_free(mail_info_list, count, err_code);
-}
-
-int emf_mail_head_free(emf_mail_head_t** mail_head_list, int count, int* err_code)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       return em_core_mail_head_free(mail_head_list, count, err_code);
-}
-
-int emf_mail_body_free(emf_mail_body_t**  mail_body_list,  int count, int* err_code)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       return em_core_mail_body_free(mail_body_list, count, err_code);
-}
-
-int emf_mail_free(emf_mail_t** mail_list, int count, int* err_code)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       return em_core_mail_free(mail_list, count, err_code);
-}
-
-EXPORT_API int emf_mail_attachment_info_free(emf_attachment_info_t** atch_info, int* err_code)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       return em_core_mail_attachment_info_free(atch_info, err_code);
-}
-
-void* thread_func_to_delete_mail(void *thread_argument)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int *mail_id_list = NULL, mail_id_count, account_id, err;
-       unsigned handle = 0;
-       emf_event_t *event_data = (emf_event_t*)thread_argument;
-
-       account_id         = event_data->account_id;
-       mail_id_list       = (int*)event_data->event_param_data_3;
-       mail_id_count      = event_data->event_param_data_4;
-
-       if (!em_core_mail_delete(account_id, mail_id_list, mail_id_count, EMF_DELETE_LOCALLY, EMF_DELETED_BY_COMMAND, false, &err)) {
-               EM_DEBUG_EXCEPTION(" em_core_mail_delete falied [%d]", err);
-               goto FINISH_OFF;
-       }
-       
-       if (!em_core_insert_event(event_data, (int*)handle, &err)) {
-               EM_DEBUG_EXCEPTION("em_core_insert_event failed [%d]", err);
-               goto FINISH_OFF;
-       }
-
-FINISH_OFF:    
-       /* em_core_free_event(event_data); */ /* all of members will be freed after using in each event handler */
-       EM_SAFE_FREE(event_data);
-
-       EM_DEBUG_FUNC_END();
-       return SUCCESS;
-}
-
-EXPORT_API int emf_mail_delete(int account_id, emf_mailbox_t* mailbox, int mail_ids[], int mail_ids_count, int from_server, unsigned* handle, int* err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("mailbox[%p], mail_ids[%p], mail_ids_count[%d], from_server[%d], handle[%p], err_code[%p]", mailbox, mail_ids, mail_ids_count, from_server, handle, err_code);
-       
-       int ret = false;
-       int err = EMF_ERROR_NONE;
-       int* p = NULL, thread_error;
-       emf_event_t *event_data = NULL;
-       emf_account_t *account = NULL;
-       thread_t delete_thread;
-
-       /* mailbox can be NULL for deleting thread mail. */
-       if (mail_ids_count <= 0) {
-               EM_DEBUG_EXCEPTION("mail_ids_count [%d]", mail_ids_count);
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-       
-       if (!(account = em_core_get_account_reference(account_id))) {
-               EM_DEBUG_EXCEPTION("em_core_get_account_reference failed [%d]", account_id);
-               err = EMF_ERROR_INVALID_ACCOUNT;
-               goto FINISH_OFF;
-       }
-
-       if ((p = em_core_malloc(sizeof(int) * mail_ids_count)) == NULL) {
-               EM_DEBUG_EXCEPTION("em_core_malloc for p failed...");
-               err = EMF_ERROR_OUT_OF_MEMORY;
-               goto FINISH_OFF;
-       }
-       
-       memcpy(p, mail_ids, sizeof(int) * mail_ids_count);
-
-       if ((event_data = em_core_malloc(sizeof(emf_event_t)) ) == NULL) {
-               EM_DEBUG_EXCEPTION("em_core_malloc for event_data failed...");
-               err = EMF_ERROR_OUT_OF_MEMORY;
-               goto FINISH_OFF;
-       }
-
-       event_data->type                   = EMF_EVENT_DELETE_MAIL;
-       event_data->account_id             = account_id;
-       if(mailbox)
-               event_data->event_param_data_1 = mailbox->name;
-       event_data->event_param_data_3     = (char*)p;
-       event_data->event_param_data_4     = mail_ids_count;
-
-       THREAD_CREATE(delete_thread, thread_func_to_delete_mail, (void*)event_data, thread_error);
-       THREAD_DETACH(delete_thread); /* free resources used for new thread */
-       ret = true;
-
-FINISH_OFF:
-       if (ret == false)
-               EM_SAFE_FREE(p);
-       
-       if (err_code)
-               *err_code = err;
-       
-       return ret;
-}
-
-int emf_mail_delete_all(emf_mailbox_t* mailbox, int with_server, unsigned* handle, int* err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("mailbox[%p], with_server[%d], handle[%p], err_code[%p]", mailbox, with_server, handle, err_code);
-       
-       int            ret = false;
-       int            err = EMF_ERROR_NONE;
-       emf_account_t *ref_account = NULL;
-       emf_event_t    event_data = { 0 };
-       
-       if (!mailbox || mailbox->account_id <= 0)  {
-               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-       ref_account = emf_get_account_reference(mailbox->account_id);
-
-       if (!ref_account)  {
-               EM_DEBUG_EXCEPTION("emf_get_account_reference failed account_id [%d]", mailbox->account_id);
-               err = EMF_ERROR_INVALID_ACCOUNT;
-               goto FINISH_OFF;
-       }
-       
-#ifdef __FEATURE_SYNC_CLIENT_TO_SERVER__
-       event_data.type               = EMF_EVENT_DELETE_MAIL_ALL;
-       event_data.account_id         = mailbox->account_id;
-       event_data.event_param_data_1 = EM_SAFE_STRDUP(mailbox->name);
-       event_data.event_param_data_3 = NULL;
-       event_data.event_param_data_4 = with_server;
-
-       if (!em_core_insert_event(&event_data, (int*)handle, &err))  {
-               EM_DEBUG_EXCEPTION("em_core_insert_event falied [%d]", err);
-               EM_SAFE_FREE(event_data.event_param_data_1);
-               goto FINISH_OFF;
-       }
-       
-#ifdef __LOCAL_ACTIVITY__
-       int i, total = 0 , search_handle = 0;
-       int *mail_ids = NULL;
-       emf_activity_tbl_t new_activity;
-       int activityid = 0;
-       
-       if (false == em_core_get_next_activity_id(&activityid,&err)) {
-               EM_DEBUG_EXCEPTION(" em_core_get_next_activity_id Failed - %d ", err);
-       }
-       
-       if (!em_storage_mail_search_start(NULL, mailbox->account_id, mailbox->name, 0, &search_handle, &total, true, &err)) {
-               EM_DEBUG_EXCEPTION(" em_storage_mail_search_start failed [%d]", err);
-               
-               err = em_storage_get_emf_error_from_em_storage_error(err);
-               goto FINISH_OFF;
-       }
-       
-       mail_ids = em_core_malloc(sizeof(int) * total);
-       if (mail_ids == NULL)  {
-               EM_DEBUG_EXCEPTION(" mailloc failed...");
-               
-               err = EMF_ERROR_OUT_OF_MEMORY;
-               goto FINISH_OFF;
-       }
-       
-       for (i = 0; i < total; i++)  {
-               if (!em_storage_mail_search_result(search_handle, RETRIEVE_ID, (void**)&mail_ids[i], true, &err))  {
-                       EM_DEBUG_EXCEPTION(" em_storage_mail_search_result failed [%d]", err);
-                       
-                       err = em_storage_get_emf_error_from_em_storage_error(err);
-                       EM_SAFE_FREE(mail_ids);
-                       goto FINISH_OFF;
-               }
-                       
-               new_activity.activity_id        = activityid;
-               new_activity.activity_type      = ACTIVITY_DELETEMAIL;
-               new_activity.mail_id            = mail_ids[i];
-               new_activity.server_mailid      = NULL;
-               new_activity.src_mbox           = mailbox->name;
-               new_activity.dest_mbox          = NULL;
-               new_activity.account_id         = mailbox->account_id;
-                                               
-               if (! em_core_activity_add(&new_activity, &err))
-                       EM_DEBUG_EXCEPTION(" em_core_activity_add  Failed  - %d ", err);
-               
-       }
-
-       EM_SAFE_FREE(mail_ids);
-
-       EM_DEBUG_LOG("Setting g_local_activity_run ");
-       g_local_activity_run = 1;       
-#endif
-       
-#endif         /*  __FEATURE_SYNC_CLIENT_TO_SERVER__ */
-       
-       ret = true;
-       
-FINISH_OFF:
-       if (err_code)
-               *err_code = err;
-
-       return ret;
-}
-
-       
-
-EXPORT_API int emf_mail_move_all_mails(emf_mailbox_t* src_mailbox, emf_mailbox_t* dst_mailbox, int* err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("src_mailbox[%p], dst_mailbox[%p], err_code[%p]",  src_mailbox, dst_mailbox, err_code);
-       
-       int ret = false;
-       int err = EMF_ERROR_NONE;
-       emf_account_t *ref_account = NULL;
-       emf_mail_list_item_t *mail_list = NULL;
-       int select_num = 0;
-       int *mails = NULL;      
-       int i=0;
-       int num =0;
-       
-       if (!dst_mailbox || dst_mailbox->account_id <= 0 || !src_mailbox || src_mailbox->account_id <= 0)  {
-               EM_DEBUG_EXCEPTION("Invalid Parameter");
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-       
-       ref_account = emf_get_account_reference(dst_mailbox->account_id);
-
-       if (!ref_account)  {
-               EM_DEBUG_EXCEPTION("emf_get_account_reference failed [%d]", dst_mailbox->account_id);
-               err = EMF_ERROR_INVALID_ACCOUNT;
-               goto FINISH_OFF;
-       }
-
-       if(!em_storage_get_mail_list(src_mailbox->account_id, src_mailbox->name, NULL, EMF_LIST_TYPE_NORMAL, -1, -1, 0, NULL, EMF_SORT_DATETIME_HIGH, false, &mail_list, &select_num, &err)) {
-               EM_DEBUG_EXCEPTION("em_storage_get_mail_list failed");
-               goto FINISH_OFF;
-       }
-
-       mails = malloc(sizeof(int) * select_num);
-
-       if( !mails ) {
-               EM_DEBUG_EXCEPTION("Malloc failed...!");
-               err = EMF_ERROR_OUT_OF_MEMORY;
-               goto FINISH_OFF;
-       }
-
-       memset(mails, 0x00, sizeof(int) * select_num);
-               
-       for(i = 0 ; i < select_num ; i++) {
-               if( mail_list[i].save_status != EMF_MAIL_STATUS_SENDING ) {
-                       mails[num] = mail_list[i].mail_id;
-                       num++;
-               }
-       }
-
-       if( num <= 0) {
-               EM_DEBUG_EXCEPTION("can't find avalable mails. num = %d", num);
-               err = EMF_ERROR_MAIL_NOT_FOUND;
-               goto FINISH_OFF;        
-       }
-       
-       if(!em_core_mail_move(mails, num, dst_mailbox->name, EMF_MOVED_BY_COMMAND, 0, &err)) {
-               EM_DEBUG_EXCEPTION("em_core_mail_move falied [%d]", err);
-               goto FINISH_OFF;
-       }
-
-               
-       ret = true;
-       
-FINISH_OFF:
-       if (err_code)
-               *err_code = err;
-
-       if(mail_list)
-               EM_SAFE_FREE(mail_list);
-
-       if(mails != NULL )
-               EM_SAFE_FREE(mails);
-       
-       return ret;
-}
-
-void* thread_func_to_move_mail(void *thread_argument)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int *mail_ids = NULL, mail_ids_count, noti_param_1, noti_param_2, err;
-       unsigned handle = 0;
-       emf_event_t *event_data = (emf_event_t*)thread_argument;
-       char *dst_mailbox_name = NULL;
-
-       dst_mailbox_name   = (char*)event_data->event_param_data_1;
-       mail_ids           = (int*)event_data->event_param_data_3;
-       mail_ids_count     = event_data->event_param_data_4;
-       noti_param_1       = event_data->event_param_data_6;
-       noti_param_2       = event_data->event_param_data_7;
-
-       if (!em_core_mail_move(mail_ids, mail_ids_count, dst_mailbox_name, noti_param_1, noti_param_2, &err)) {
-               EM_DEBUG_EXCEPTION("em_core_mail_move failed [%d]", err);
-               goto FINISH_OFF;
-       }
-
-       if (!em_core_insert_event(event_data, (int*)&handle, &err)) {
-               EM_DEBUG_EXCEPTION("em_core_insert_event failed [%d]", err);
-               goto FINISH_OFF;
-       }
-
-FINISH_OFF:    
-       /* em_core_free_event(event_data); */ /* all of members will be freed after using in each event handler */
-       EM_SAFE_FREE(event_data);
-
-       EM_DEBUG_FUNC_END();
-       return SUCCESS;
-}
-
-EXPORT_API int emf_mail_move(int mail_ids[], int num, emf_mailbox_t* dst_mailbox, int noti_param_1, int noti_param_2, int* err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("mail_ids[%p], num[%d], dst_mailbox[%p], err_code[%p]", mail_ids, num, dst_mailbox, err_code);
-       
-       /*  default variable */
-       int mail_id = 0, *p = NULL, thread_error;
-       int ret = false, err = EMF_ERROR_NONE;
-       char *src_mailbox_name = NULL;          
-       emf_mail_tbl_t* mail_table_data = NULL;
-       emf_account_t* ref_account = NULL;
-       emf_event_t *event_data = NULL;
-       thread_t move_thread;
-
-       if (num <= 0 || !dst_mailbox || dst_mailbox->account_id <= 0) {
-               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-       
-       ref_account = emf_get_account_reference(dst_mailbox->account_id);
-
-       if (!ref_account) {
-               EM_DEBUG_EXCEPTION("emf_get_account_reference failed [%d]", dst_mailbox->account_id);
-               err = EMF_ERROR_INVALID_ACCOUNT;
-               goto FINISH_OFF;
-       }
-
-       /* Getting source mailbox name */
-       mail_id = mail_ids[0];
-
-       if (!em_storage_get_mail_field_by_id(mail_id, RETRIEVE_SUMMARY, &mail_table_data, true, &err) || !mail_table_data) {
-               EM_DEBUG_EXCEPTION("em_storage_get_mail_field_by_id failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
-               goto FINISH_OFF;
-       }
-       
-       if (src_mailbox_name ==  NULL)
-               src_mailbox_name = EM_SAFE_STRDUP(mail_table_data->mailbox_name);               
-
-       em_storage_free_mail(&mail_table_data, 1, NULL);
-
-       if ((event_data = em_core_malloc(sizeof(emf_event_t)) ) == NULL) {
-               EM_DEBUG_EXCEPTION("em_core_malloc for event_data failed...");
-               err = EMF_ERROR_OUT_OF_MEMORY;
-               goto FINISH_OFF;
-       }
-
-       if ((p = em_core_malloc(sizeof(int) * num)) == NULL) {
-               EM_DEBUG_EXCEPTION("em_core_malloc for p failed...");
-               err = EMF_ERROR_OUT_OF_MEMORY;
-               goto FINISH_OFF;
-       }
-
-       memcpy(p, mail_ids, sizeof(int) * num);
-       
-       event_data->account_id        = dst_mailbox->account_id;
-       event_data->type               = EMF_EVENT_MOVE_MAIL;
-       event_data->event_param_data_1 = EM_SAFE_STRDUP(dst_mailbox->name);
-       event_data->event_param_data_2 = EM_SAFE_STRDUP(src_mailbox_name);
-       event_data->event_param_data_3 = (char*)p;
-       event_data->event_param_data_4 = num;
-       event_data->event_param_data_6 = noti_param_1;
-       event_data->event_param_data_7 = noti_param_2;
-
-#ifdef __LOCAL_ACTIVITY__
-       int i = 0, activityid = 0;
-       
-       if (false == em_core_get_next_activity_id(&activityid,&err))
-               EM_DEBUG_EXCEPTION(" em_core_get_next_activity_id Failed - %d ", err);
-       
-       for (i =0; i < event_data.event_param_data_4; i++) {
-               emf_activity_tbl_t      new_activity;
-               new_activity.activity_id = activityid;
-               new_activity.activity_type = ACTIVITY_MOVEMAIL;
-               new_activity.account_id    = event_data.account_id;
-               new_activity.mail_id       = mail_ids[i];
-               new_activity.dest_mbox     = event_data.event_param_data_1;
-               new_activity.server_mailid = NULL;
-               new_activity.src_mbox      = event_data.event_param_data_2;
-
-               if (!em_core_activity_add(&new_activity, &err))
-                       EM_DEBUG_EXCEPTION(" em_core_activity_add Failed - %d ", err);
-       }
-#endif /* __LOCAL_ACTIVITY__ */
-       THREAD_CREATE(move_thread, thread_func_to_move_mail, (void*)event_data, thread_error);
-       THREAD_DETACH(move_thread); /* free resources used for new thread */
-       ret = true;
-       
-FINISH_OFF:
-
-#ifdef __LOCAL_ACTIVITY__      
-       EM_DEBUG_LOG("Setting g_local_activity_run ");
-       g_local_activity_run = 1;       
-#endif /* __LOCAL_ACTIVITY__ */
-
-       if (err_code)
-               *err_code = err;
-
-       EM_SAFE_FREE(src_mailbox_name);
-       
-       EM_DEBUG_FUNC_END("ret [%d]", ret);
-       return ret;
-}
-
-EXPORT_API int emf_mail_modify_flag(int mail_id, emf_mail_flag_t new_flag, int onserver, int sticky_flag, int* err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("mail_id[%d], new_flag[%d], onserver[%d], sticky_flag[%d], err_code[%p]", mail_id, new_flag, onserver, sticky_flag, err_code);
-       
-       /*  default variable */
-       int ret = false;
-       int err = EMF_ERROR_NONE;
-       
-       if (!em_core_mail_modify_flag(mail_id, new_flag, sticky_flag, &err))  {
-               EM_DEBUG_EXCEPTION(" em_core_mail_modify_flag falled [%d]", err);
-               goto FINISH_OFF;
-       }
-       
-#ifdef __FEATURE_SYNC_CLIENT_TO_SERVER__
-       if( onserver == 1)  {
-       emf_event_t event_data;
-       unsigned handle = 0;
-       memset(&event_data, 0x00, sizeof(emf_event_t));
-       
-       event_data.type = EMF_EVENT_SYNC_MAIL_FLAG_TO_SERVER;
-       event_data.event_param_data_1 = NULL;
-       event_data.event_param_data_4 = mail_id;
-       event_data.account_id = 0;      
-#ifdef __LOCAL_ACTIVITY__
-               emf_mail_tbl_t *mail_table_data = NULL;
-               if (!em_storage_get_mail_field_by_id(mail_id, RETRIEVE_SUMMARY, &mail_table_data, false, &err) || !mail_table_data)  {
-                       EM_DEBUG_LOG(" em_storage_get_mail_field_by_id failed [%d]", err);
-                       goto FINISH_OFF;
-               }
-               event_data.account_id = mail_table_data->account_id;
-               em_storage_free_mail(&mail_table_data,1,&err);
-
-               emf_activity_tbl_t      new_activity;
-               new_activity.activity_type = ACTIVITY_MODIFYFLAG;
-               new_activity.account_id    = event_data.account_id;
-               new_activity.mail_id       = event_data.event_param_data_4;
-               new_activity.dest_mbox     = NULL;
-               new_activity.server_mailid = NULL;
-               new_activity.src_mbox      = NULL;
-
-               if (false == em_core_get_next_activity_id(&new_activity.activity_id,&err)) {
-                       EM_DEBUG_EXCEPTION(" em_core_get_next_activity_id Failed - %d \n", err);
-               }
-
-               if (!em_core_activity_add(&new_activity, &err)) {
-                       EM_DEBUG_EXCEPTION(" em_core_activity_add [ACTIVITY_MODIFYFLAG] Failed - %d \n", err);
-               }
-               
-#endif /*  __LOCAL_ACTIVITY__ */
-       if (!em_core_insert_event(&event_data, (int*)&handle, &err)) {
-                       EM_DEBUG_EXCEPTION("em_core_insert_event failed [%d]", err);
-                       goto FINISH_OFF;
-       }
-
-#ifdef __LOCAL_ACTIVITY__      
-               EM_DEBUG_LOG("Setting g_local_activity_run ");
-               g_local_activity_run = 1;       
-#endif /*  __LOCAL_ACTIVITY__ */
-       }
-#endif /*  __FEATURE_SYNC_CLIENT_TO_SERVER__ */
-
-       ret = true;
-       
-FINISH_OFF:
-       if (err_code)
-               *err_code = err;
-       EM_DEBUG_FUNC_END();
-       return ret;
-}
-
-EXPORT_API int emf_mail_modify_extra_flag(int mail_id, emf_extra_flag_t new_flag, int* err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("mail_id[%d], err_code[%p]", mail_id, err_code);
-
-       int ret = false;
-       int err = EMF_ERROR_NONE;
-               
-       if (!emf_mail_check_mail_id(mail_id, &err))  {
-               EM_DEBUG_EXCEPTION("emf_mail_check_mail_id failed [%d]", err);
-                       goto FINISH_OFF;
-               }
-
-       if (!em_core_mail_modify_extra_flag(mail_id, new_flag, &err))  {
-               EM_DEBUG_EXCEPTION("engine_mail_modify_extra_flag failed [%d]", err);
-                       goto FINISH_OFF;
-               }
-               
-       ret = true;
-
-FINISH_OFF:
-       if (err_code)
-               *err_code = err;
-
-       EM_DEBUG_FUNC_END("ret [%d]", ret);
-       return ret;
-               }
-
-EXPORT_API int emf_mail_set_flags_field(int account_id, int mail_ids[], int num, emf_flags_field_type field_type, int value, int onserver, int* err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("mail_ids[%d], num[%d], field_type [%d], value[%d], err_code[%p]", mail_ids[0], num, field_type, value, err_code);
-               
-       int ret = false, err = EMF_ERROR_NONE;
-
-       if(account_id <= 0 || !mail_ids || num <= 0) {
-               err = EMF_ERROR_INVALID_PARAM;
-               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
-                       goto FINISH_OFF;
-               }
-
-       if (!em_core_mail_set_flags_field(account_id, mail_ids, num, field_type, value, &err))  {
-               EM_DEBUG_EXCEPTION("em_core_mail_set_flags_field falled [%d]", err);
-               goto FINISH_OFF;
-       }
-
-       if( onserver )  {
-               int *mail_id_array = NULL;
-               emf_event_t event_data = {0};
-               unsigned handle = 0;
-
-               mail_id_array = em_core_malloc(sizeof(int) * num);
-              
-               if (mail_id_array == NULL)  {
-                       EM_DEBUG_EXCEPTION("em_core_malloc failed...");
-              err = EMF_ERROR_OUT_OF_MEMORY;
-              goto FINISH_OFF;
-               }
-
-               memcpy(mail_id_array, mail_ids, sizeof(int) * num);
-               
-               event_data.type               = EMF_EVENT_SYNC_FLAGS_FIELD_TO_SERVER;
-               event_data.account_id         = account_id;
-               event_data.event_param_data_1 = NULL;
-               event_data.event_param_data_3 = (char*)mail_id_array;
-               event_data.event_param_data_4  = num;
-               event_data.event_param_data_5 = field_type;
-               event_data.event_param_data_6 = value;
-
-               if (!em_core_insert_event(&event_data, (int*)&handle, &err))  {
-                       EM_DEBUG_LOG("em_core_insert_event failed [%d]", err);
-                       goto FINISH_OFF;
-               }
-       }
-
-       ret = true;
-       
-FINISH_OFF:
-       if (err_code)
-               *err_code = err;
-       EM_DEBUG_FUNC_END();
-       return ret;
-}
-
-       
-
-EXPORT_API int emf_mail_update(int mail_id, emf_mail_t* mail, emf_meeting_request_t *meeting_req, int with_server, int* err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("mail_id[%d], mail[%p], with_server[%d], err_code[%p]", mail_id, mail, with_server, err_code);
-       
-       int ret = false;
-       int err = EMF_ERROR_NONE;
-       emf_mail_tbl_t* mail_table_data = NULL; 
-       int handle= 0;
-       emf_event_t event_data; 
-       char* p_mail = NULL;    
-       
-       if (!mail || !mail->info)  {
-               EM_DEBUG_EXCEPTION("mail_id[%d], mali[%p]", mail_id, mail);
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-       
-       if (!emf_mail_check_mail_id(mail_id, &err))  {
-               EM_DEBUG_EXCEPTION("emf_mail_check_mail_id failed [%d]", err);
-               goto FINISH_OFF;
-       }
-       
-       if (mail->body && mail->body->attachment)  {
-               emf_attachment_info_t* p = mail->body->attachment;
-               struct stat st_buf;
-               
-               while (p)  {
-                       if(p->downloaded) {
-                               if (!p->savename || stat(p->savename, &st_buf) < 0)  {
-                                       EM_DEBUG_EXCEPTION("stat(\"%s\" failed...", p->savename);
-                                       err = EMF_ERROR_INVALID_PARAM;
-                                       goto FINISH_OFF;
-                               }
-                       }
-                       p = p->next;
-               }
-       }
-       
-       emf_account_t* ref_account = emf_get_account_reference(mail->info->account_id);
-       
-       if (!ref_account)  {
-               EM_DEBUG_EXCEPTION("emf_get_account_reference failed [%d]", mail->info->account_id);
-               err = EMF_ERROR_INVALID_ACCOUNT;        
-               goto FINISH_OFF;
-       }
-
-       if( with_server && ref_account->receiving_server_type == EMF_SERVER_TYPE_IMAP4) {
-               if (!em_storage_get_mail_field_by_id(mail_id, RETRIEVE_SUMMARY, &mail_table_data, false, &err)) 
-                       EM_DEBUG_LOG("em_storage_get_mail_field_by_id failed [%d]", err);
-
-               p_mail= malloc(sizeof(int));
-               if (p_mail == NULL)  {
-                       EM_DEBUG_EXCEPTION("malloc failed...");
-                       err = EMF_ERROR_OUT_OF_MEMORY;
-                       goto FINISH_OFF;
-               }
-               memcpy(p_mail, &mail_id, sizeof(int));
-
-               memset(&event_data, 0x00, sizeof(emf_event_t));
-               event_data.type = EMF_EVENT_DELETE_MAIL;
-               event_data.account_id  = mail->info->account_id;
-               event_data.event_param_data_3  = (char*)p_mail;
-               event_data.event_param_data_4  = 1;
-               event_data.event_param_data_1 = EM_SAFE_STRDUP(mail_table_data->mailbox_name);
-
-#ifdef __LOCAL_ACTIVITY__
-               emf_activity_tbl_t new_activity;        
-               EM_DEBUG_LOG(" mail_id - %d\n", mail_id);
-               new_activity.activity_type      = ACTIVITY_DELETEMAIL_SEND;                     
-               new_activity.account_id    = event_data.account_id;                     
-               new_activity.mail_id            = mail_id;
-               new_activity.server_mailid  = NULL;
-               new_activity.src_mbox           = EM_SAFE_STRDUP(mail_table_data->mailbox);
-               new_activity.dest_mbox          = NULL;
-                                               
-               if (false == em_core_get_next_activity_id(&new_activity.activity_id,&err)) {
-                       EM_DEBUG_EXCEPTION(" em_core_get_next_activity_id Failed - %d \n", err);
-               }
-               
-               if (! em_core_activity_add(&new_activity, &err))
-                       EM_DEBUG_EXCEPTION(" em_core_activity_add  Failed  - %d \n", err);
-               else
-                       EM_SAFE_FREE(new_activity.src_mbox); /* Memory Leak Fix */
-
-#endif /* __LOCAL_ACTIVITY__ */                
-               if (!em_core_insert_send_event(&event_data, &handle, &err))  {
-                       EM_DEBUG_EXCEPTION("em_core_insert_event failed [%d]", err);
-                       goto FINISH_OFF;
-               }
-
-#ifdef __LOCAL_ACTIVITY__
-               EM_DEBUG_LOG("Setting g_save_local_activity_run ");
-               g_save_local_activity_run = 1;
-#endif
-       }
-
-       switch (ref_account->account_bind_type)  {
-               case EMF_BIND_TYPE_EM_CORE: 
-                       memset(&event_data, 0x00, sizeof(emf_event_t));
-                       event_data.type = EMF_EVENT_UPDATE_MAIL_OLD;
-                       event_data.account_id  = mail->info->account_id;
-                       event_data.event_param_data_3  = NULL;
-                       event_data.event_param_data_4  = mail_id;
-                       event_data.event_param_data_1 = (char*)mail;                            /*  will be freed in event handler */
-                       event_data.event_param_data_2 = (char*)meeting_req;             /*  will be freed in event handler */
-
-#ifdef __LOCAL_ACTIVITY__
-                       if( with_server ) {
-                               emf_activity_tbl_t new_activity;        
-
-                               new_activity.activity_type = ACTIVITY_SAVEMAIL;
-                               new_activity.account_id    = event_data.account_id;
-                               new_activity.mail_id       = event_data.event_param_data_4;
-                               new_activity.dest_mbox     = NULL;
-                               new_activity.server_mailid = NULL;
-                               new_activity.src_mbox      = NULL;
-
-                               if (false == em_core_get_next_activity_id(&new_activity.activity_id,&err)) {
-                                       EM_DEBUG_EXCEPTION(" em_core_get_next_activity_id Failed - %d \n", err);
-                               }
-
-                               if (!em_core_activity_add(&new_activity, &err)) {
-                                       EM_DEBUG_EXCEPTION(" em_core_activity_add Failed - %d \n", err);
-                               }
-                       }
-#endif /* __LOCAL_ACTIVITY__ */
-
-                       if (!em_core_insert_event(&event_data, &handle, &err))  {
-                               EM_DEBUG_EXCEPTION("em_core_insert_event failed [%d]", err);
-                               goto FINISH_OFF;
-                       }
-
-                       #ifdef __LOCAL_ACTIVITY__
-                       EM_DEBUG_LOG("Setting g_save_local_activity_run ");
-                       g_save_local_activity_run = 1;
-                       #endif
-                       
-                       break;
-
-               default:
-                       EM_DEBUG_EXCEPTION("unknown account bind type...");
-                       err = EMF_ERROR_INVALID_ACCOUNT;
-                       goto FINISH_OFF;
-       }
-
-       ret = true;
-       
-FINISH_OFF:
-       if (err_code)
-               *err_code = err;
-       EM_DEBUG_FUNC_END();
-       return ret;
-}
-
-EXPORT_API int emf_update_mail(emf_mail_data_t *input_mail_data, emf_attachment_data_t *input_attachment_data_list, int input_attachment_count, emf_meeting_request_t *input_meeting_request, int input_sync_server)
-{
-       EM_DEBUG_FUNC_BEGIN("input_mail_data[%p], input_attachment_data_list[%p], input_attachment_count [%d], input_meeting_req [%p], input_sync_server[%d]", input_mail_data, input_attachment_data_list, input_attachment_count, input_meeting_request, input_sync_server);
-
-       int            err = EMF_ERROR_NONE;
-       int            handle = 0;
-       emf_event_t    event_data = { 0 };
-       emf_account_t *ref_account = NULL;
-       
-       if (!input_mail_data || input_mail_data->account_id <= 0 || input_mail_data->mail_id == 0 ||
-               (input_mail_data->report_status == EMF_MAIL_REPORT_MDN && !input_mail_data->full_address_to))  {
-               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM"); 
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-       
-       ref_account = emf_get_account_reference(input_mail_data->account_id);
-       if (!ref_account)  {
-               EM_DEBUG_LOG(" emf_get_account_reference failed [%d]", input_mail_data->account_id);
-               err = EMF_ERROR_INVALID_ACCOUNT;
-               goto FINISH_OFF;
-       }
-       
-       switch (ref_account->account_bind_type)  {
-               case EMF_BIND_TYPE_EM_CORE : 
-                       if ( (err = em_core_update_mail(input_mail_data, input_attachment_data_list, input_attachment_count, input_meeting_request, input_sync_server)) != EMF_ERROR_NONE) {
-                               EM_DEBUG_EXCEPTION("em_core_update_mail failed [%d]", err);
-                               goto FINISH_OFF;
-                       }
-
-#ifdef __FEATURE_SYNC_CLIENT_TO_SERVER__
-                       if ( input_sync_server ) {      
-                               event_data.type               = EMF_EVENT_UPDATE_MAIL;
-                               event_data.account_id         = input_mail_data->account_id;
-                               event_data.event_param_data_1 = (char*)input_mail_data;
-                               event_data.event_param_data_2 = (char*)input_attachment_data_list;
-                               event_data.event_param_data_3 = (char*)input_meeting_request;
-                               event_data.event_param_data_4 = input_attachment_count;
-                               event_data.event_param_data_5 = input_sync_server;
-
-                               if (!em_core_insert_send_event(&event_data, &handle, &err))  {
-                                       EM_DEBUG_EXCEPTION("em_core_insert_send_event failed [%d]", err);
-                                       err = EMF_ERROR_NONE;
-                                       goto FINISH_OFF;
-                               }
-                       }
-#endif                 
-               break;
-
-               default:
-                       EM_DEBUG_EXCEPTION("unknown account bind type...");
-                       err = EMF_ERROR_INVALID_ACCOUNT;
-                       goto FINISH_OFF;
-       }
-       
-FINISH_OFF:
-
-       EM_DEBUG_FUNC_END("err [%d]", err);
-       return err;
-}
-
-
-int emf_mail_check_mail_id(int mail_id, int* err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("mail_id[%d], err_code[%p]", mail_id, err_code);
-       
-       int ret = false;
-       int err = EMF_ERROR_NONE;
-       
-       emf_mail_tbl_t* mail = NULL;
-       
-       if (!em_storage_get_mail_field_by_id(mail_id, RETRIEVE_SUMMARY, &mail, true, &err))  {
-               EM_DEBUG_EXCEPTION("em_storage_get_mail_field_by_id failed [%d]", err);
-               
-               if (err == EM_STORAGE_ERROR_MAIL_NOT_FOUND)
-                       err = EMF_ERROR_MAIL_NOT_FOUND;
-               else if (err == EM_STORAGE_ERROR_OUT_OF_MEMORY)
-                       err = EMF_ERROR_OUT_OF_MEMORY;
-               else if (err == EM_STORAGE_ERROR_DB_FAILURE)
-                       err = EMF_ERROR_DB_FAILURE;
-               else if (err == EM_STORAGE_ERROR_INVALID_PARAM)
-                       err = EMF_ERROR_INVALID_PARAM;
-               else
-                       err = EMF_ERROR_UNKNOWN;
-               
-               goto FINISH_OFF;
-       }
-       
-       ret = true;
-
-FINISH_OFF:
-       if (mail != NULL)
-               em_storage_free_mail(&mail, 1, NULL);
-       
-       if (err_code != NULL)
-               *err_code = err;
-       EM_DEBUG_FUNC_END();
-       return ret;
-}
-
-
-EXPORT_API int emf_mail_send_retry( int mail_id,  int timeout_in_sec, int* err_code)
-{
-       int ret = false;
-       int err = EMF_ERROR_NONE;
-       long nTimerValue = 0;
-       emf_mailbox_t mailbox;
-       emf_mail_t*     mail = NULL;
-       emf_mail_tbl_t* mail_table_data = NULL;
-       char mailId[10];
-       emf_option_t opt;
-       
-       memset( &opt, 0x00, sizeof(emf_option_t));
-       memset( &mailbox, 0x00, sizeof(emf_mailbox_t));
-       memset(mailId, 0x00, 10);
-
-       if (!emf_mail_check_mail_id(mail_id, &err))  {
-               EM_DEBUG_EXCEPTION("emf_mail_check_mail_id failed [%d]", err);
-               goto FINISH_OFF;
-       }       
-
-       if( ! em_storage_get_mail_by_id(mail_id, &mail_table_data, false, &err) && !mail_table_data)  {
-               EM_DEBUG_EXCEPTION("em_storage_get_mail_by_id failed [%d]", err);
-               goto FINISH_OFF;                
-       }
-       
-       if (!em_core_mail_get_mail(mail_id, &mail, &err) && !mail) {
-               EM_DEBUG_EXCEPTION("em_core_mail_get_mail failed [%d]", err);
-               goto FINISH_OFF;
-       }
-
-       
-       mailbox.name = EM_SAFE_STRDUP(mail_table_data->mailbox_name);
-       memcpy(&opt, em_core_get_option(&err), sizeof(emf_mail_t));
-       if( mail && mail->info ) {
-               mailbox.account_id = mail->info->account_id;
-               opt.priority = mail->info->extra_flags.priority;
-       }
-       
-       if ( timeout_in_sec == 0 ) {
-               if(!emf_mail_send(&mailbox, mail_id, &opt, NULL, &err)) {
-                       EM_DEBUG_EXCEPTION("emf_mail_send failed [%d]", err);
-                       goto FINISH_OFF;
-               }                       
-       }
-       else if ( timeout_in_sec > 0 ) {
-               sprintf(mailId,"%d",mail_id);
-               nTimerValue = timeout_in_sec * 1000;
-               if ( em_core_set_timer_ex(nTimerValue, (EMF_TIMER_CALLBACK) _OnMailSendRetryTimerCB, (void*)mailId) <= 0) {
-                       EM_DEBUG_EXCEPTION("emf_mail_send_retry - Failed to start timer");
-                       goto FINISH_OFF;
-               }
-       }
-       ret = true;
-FINISH_OFF:
-       if (err_code)
-               *err_code = err;
-       if (mail)  em_core_mail_free(&mail, 1, NULL);
-       if(mail_table_data) em_storage_free_mail(&mail_table_data, 1, NULL);
-       EM_SAFE_FREE(mailbox.name);
-       
-       return ret;
-}
-
-
-EXPORT_API 
-void _OnMailSendRetryTimerCB( void* data )
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int err = EMF_ERROR_NONE;
-       emf_mailbox_t mailbox;
-       emf_mail_t*     mail = NULL;
-       emf_mail_tbl_t* mail_table_data = NULL; 
-       int mail_id = 0 ;
-       emf_option_t opt;
-
-       memset( &opt, 0x00, sizeof(emf_option_t));
-       memset( &mailbox, 0x00, sizeof(emf_mailbox_t));
-
-       if( !data ) {
-               EM_DEBUG_LOG("Invalid param");
-               goto FINISH_OFF;
-       }
-
-       mail_id = atoi((char*)data);
-       
-
-       if (!emf_mail_check_mail_id(mail_id, &err))  {
-               EM_DEBUG_EXCEPTION("emf_mail_check_mail_id failed [%d]", err);
-               goto FINISH_OFF;
-       }       
-
-       if (!em_core_mail_get_mail(mail_id, &mail, &err) && !mail) {
-               EM_DEBUG_EXCEPTION("em_core_mail_get_mail failed [%d]", err);
-               goto FINISH_OFF;
-       }
-       
-       if( ! em_storage_get_mail_by_id(mail_id, &mail_table_data, false, &err) && !mail_table_data) {
-               EM_DEBUG_EXCEPTION("em_storage_get_mail_by_id failed [%d]", err);
-               goto FINISH_OFF;                
-       }
-
-       mailbox.name = EM_SAFE_STRDUP(mail_table_data->mailbox_name);
-       memcpy(&opt, em_core_get_option(&err), sizeof(emf_mail_t));
-
-       if( mail && mail->info ) {
-               opt.priority = mail->info->extra_flags.priority;
-               mailbox.account_id = mail->info->account_id;
-       }
-       
-       if(!emf_mail_send(&mailbox, mail_id, &opt, NULL, &err)) {
-               EM_DEBUG_EXCEPTION("emf_mail_send failed [%d]", err);
-               goto FINISH_OFF;
-       }
-
-FINISH_OFF:
-       if (mail)  em_core_mail_free(&mail, 1, NULL);
-       if(mail_table_data) em_storage_free_mail(&mail_table_data, 1, NULL);    
-       EM_SAFE_FREE(mailbox.name);
-       
-       EM_DEBUG_FUNC_END();
-       return;
-}
-
-EXPORT_API int emf_mail_move_thread_to_mailbox(int thread_id, char *target_mailbox_name, int move_always_flag, int *err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("thread_id [%d], target_mailbox_name [%p], move_always_flag [%d], err_code [%p]", thread_id, target_mailbox_name, move_always_flag, err_code);
-       int ret = false;
-       int err = EMF_ERROR_NONE;
-       int *mail_id_list = NULL, result_count = 0, i, mailbox_count = 0, account_id;
-       emf_mail_list_item_t *mail_list = NULL;
-       emf_mailbox_t *target_mailbox_list = NULL, *target_mailbox = NULL;
-
-       if (!target_mailbox_name) {
-               EM_DEBUG_EXCEPTION("target_mailbox [%p]", target_mailbox_name);
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-
-       if (!em_storage_get_mail_list(0, NULL, NULL, thread_id, -1, -1, 0, NULL, EMF_SORT_DATETIME_HIGH, true, &mail_list, &result_count, &err) || !mail_list || !result_count) {
-               EM_DEBUG_EXCEPTION("em_storage_get_mail_list failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
-               goto FINISH_OFF;
-       }
-       
-       mail_id_list = em_core_malloc(sizeof(int) * result_count);
-       
-       if (mail_id_list == NULL) {
-               EM_DEBUG_EXCEPTION("em_core_malloc failed...");
-               err = EMF_ERROR_OUT_OF_MEMORY;
-               goto FINISH_OFF;
-       }
-
-       for(i = 0; i < result_count; i++) {
-               mail_id_list[i] = mail_list[i].mail_id;
-       }
-       account_id = mail_list[0].account_id;
-
-
-       if (!em_core_mailbox_get_list(account_id, &target_mailbox_list, &mailbox_count, &err)) {
-               EM_DEBUG_EXCEPTION("em_core_mailbox_get_list failed [%d]", err);
-               goto FINISH_OFF;
-       }
-
-       for(i = 0; i < mailbox_count; i++) {
-               EM_DEBUG_LOG("%s %s", target_mailbox_list[i].name, target_mailbox_name);
-               if(strcmp(target_mailbox_list[i].name, target_mailbox_name) == 0) {
-                       target_mailbox = (target_mailbox_list + i);
-                       break;
-               }
-       }
-
-       if(!target_mailbox) {
-               EM_DEBUG_EXCEPTION("couldn't find proper target mailbox.");
-               goto FINISH_OFF;
-       }
-
-       if (!emf_mail_move(mail_id_list, result_count, target_mailbox, EMF_MOVED_BY_MOVING_THREAD, move_always_flag, &err)) {
-               EM_DEBUG_EXCEPTION("emf_mail_move failed [%d]", err);
-               goto FINISH_OFF;
-       }
-
-       if (!em_storage_notify_storage_event(NOTI_THREAD_MOVE, account_id, thread_id, target_mailbox_name, move_always_flag)) 
-               EM_DEBUG_EXCEPTION(" em_storage_notify_storage_event Failed [NOTI_MAIL_MOVE] >>>> ");
-
-       ret = true;
-       
-FINISH_OFF:
-       if (!em_core_mailbox_free(&target_mailbox_list, mailbox_count, &err)) 
-               EM_DEBUG_EXCEPTION("target_mailbox_list failed [%d]", err);
-       EM_SAFE_FREE(mail_list);
-       EM_SAFE_FREE(mail_id_list);
-
-       if (err_code)
-               *err_code = err;
-       EM_DEBUG_FUNC_END();
-       return ret;
-}
-
-EXPORT_API int emf_mail_delete_thread(int thread_id, int delete_always_flag, unsigned* handle, int *err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("thread_id [%d], delete_always_flag [%d], err_code [%p]", thread_id, delete_always_flag, err_code);
-       int ret = false;
-       int err = EMF_ERROR_NONE;
-       int account_id, *mail_id_list = NULL, result_count = 0, i;
-       emf_mail_list_item_t *mail_list = NULL;
-
-       if (!em_storage_get_mail_list(0, NULL, NULL, thread_id, -1, -1, 0, NULL, EMF_SORT_MAILBOX_NAME_HIGH, true, &mail_list, &result_count, &err) || !mail_list || !result_count) {
-               EM_DEBUG_EXCEPTION("em_storage_get_mail_list failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
-               goto FINISH_OFF;
-       }
-       
-       mail_id_list = em_core_malloc(sizeof(int) * result_count);
-       
-       if (mail_id_list == NULL) {
-               EM_DEBUG_EXCEPTION("em_core_malloc failed...");
-               err = EMF_ERROR_OUT_OF_MEMORY;
-               goto FINISH_OFF;
-       }
-
-       for(i = 0; i < result_count; i++) {
-               mail_id_list[i] = mail_list[i].mail_id;
-       }
-
-       account_id = mail_list[0].account_id;
-
-       // should remove requiring of mailbox information from this function. 
-       // email-service should find mailboxes itself by its mail id.
-       if (!emf_mail_delete(account_id, NULL, mail_id_list, result_count, false, handle, &err)) {
-               EM_DEBUG_EXCEPTION("emf_mail_delete failed [%d]", err);
-               goto FINISH_OFF;
-       }
-
-       if (!em_storage_notify_storage_event(NOTI_THREAD_DELETE, account_id, thread_id, NULL, delete_always_flag)) 
-               EM_DEBUG_EXCEPTION(" em_storage_notify_storage_event Failed [NOTI_MAIL_MOVE] >>>> ");
-
-       ret = true;
-       
-FINISH_OFF:
-       EM_SAFE_FREE(mail_list);
-       EM_SAFE_FREE(mail_id_list);
-
-       if (err_code)
-               *err_code = err;
-       EM_DEBUG_FUNC_END();
-       return ret;
-}
-
-EXPORT_API int emf_mail_modify_seen_flag_of_thread(int thread_id, int seen_flag, int on_server, unsigned* handle, int *err_code)
-{
-       EM_DEBUG_FUNC_BEGIN("thread_id [%d], seen_flag [%d], on_server [%d], handle [%p], err_code [%p]", thread_id, seen_flag, on_server, handle, err_code);
-       int ret = false;
-       int err = EMF_ERROR_NONE;
-       int account_id, *mail_id_list = NULL, result_count = 0, i;
-       emf_mail_list_item_t *mail_list = NULL;
-
-       if (!em_storage_get_mail_list(0, NULL, NULL, thread_id, -1, -1, 0, NULL, EMF_SORT_MAILBOX_NAME_HIGH, true, &mail_list, &result_count, &err) || !mail_list || !result_count) {
-               EM_DEBUG_EXCEPTION("em_storage_get_mail_list failed [%d]", err);
-               err = em_storage_get_emf_error_from_em_storage_error(err);
-               goto FINISH_OFF;
-       }
-       
-       mail_id_list = em_core_malloc(sizeof(int) * result_count);
-       
-       if (mail_id_list == NULL) {
-               EM_DEBUG_EXCEPTION("em_core_malloc failed...");
-               err = EMF_ERROR_OUT_OF_MEMORY;
-               goto FINISH_OFF;
-       }
-
-       for(i = 0; i < result_count; i++) {
-               mail_id_list[i] = mail_list[i].mail_id;
-       }
-
-       account_id = mail_list[0].account_id;
-
-       if (!emf_mail_set_flags_field(account_id, mail_id_list, result_count, EMF_FLAGS_SEEN_FIELD, seen_flag, on_server, &err)) {
-               EM_DEBUG_EXCEPTION("emf_mail_set_flags_field failed [%d]", err);
-               goto FINISH_OFF;
-       }
-
-       if (!em_storage_notify_storage_event(NOTI_THREAD_MODIFY_SEEN_FLAG, account_id, thread_id, NULL, seen_flag)) 
-               EM_DEBUG_EXCEPTION(" em_storage_notify_storage_event Failed [NOTI_MAIL_MOVE] >>>> ");
-
-       ret = true;
-       
-FINISH_OFF:
-       EM_SAFE_FREE(mail_list);
-       EM_SAFE_FREE(mail_id_list);
-
-       if (err_code)
-               *err_code = err;
-       EM_DEBUG_FUNC_END();
-       return ret;
-}
diff --git a/email-engine/main.c b/email-engine/main.c
deleted file mode 100755 (executable)
index f7abb94..0000000
+++ /dev/null
@@ -1,3593 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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 Main .c */
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <malloc.h>
-#include <glib.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <heynoti/heynoti.h>
-#include <signal.h>
-#include <time.h>
-
-#include "emflib.h"
-#include "Emf_Mapi.h"
-#include "Msg_Convert.h"
-#include "ipc-library.h"
-#include "emf-dbglog.h"
-#include "emf-auto-poll.h"   
-#include "emf-account.h"   
-#include "em-core-types.h" 
-#include "em-core-account.h" 
-#include "em-core-mesg.h" 
-#include "em-core-event.h" 
-#include "em-core-global.h" 
-#include "em-core-mailbox.h" 
-#include "em-core-utils.h"
-#include "em-storage.h"    
-#include "db-util.h"
-#include "emf-emn-noti.h"
-#include "emf-emn-storage.h"
-
-void stb_account_create(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int buffer_size = 0;
-       int local_result = 0;
-       char* local_account_stream = NULL;
-       emf_account_t account;
-       int err = EMF_ERROR_NONE;
-
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 0);
-       EM_DEBUG_LOG("size [%d]", buffer_size);
-
-       if(buffer_size <= 0)    {
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-
-       local_account_stream = (char*)em_core_malloc(buffer_size+1);
-       if(!local_account_stream) {
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-
-       memcpy(local_account_stream, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), buffer_size);
-       /* Convert account stream to structure */
-       EM_DEBUG_LOG("Before Convert_ByteStream_To_Account");
-       em_convert_byte_stream_to_account(local_account_stream, &account);
-       EM_SAFE_FREE(local_account_stream);
-
-       if (account.account_name)
-               EM_DEBUG_LOG("Account name - %s", account.account_name);
-       if(account.email_addr)
-               EM_DEBUG_LOG("Email Address - %s", account.email_addr);
-       
-       if(!emf_account_create(&account, &err)) {
-               EM_DEBUG_EXCEPTION("emf_account_create fail ");
-               goto FINISH_OFF;
-       }
-
-#ifdef __FEATURE_AUTO_POLLING__
-       /* start auto polling, if check_interval not zero */
-       if(account.check_interval > 0) {
-               if(!emf_add_polling_alarm( account.account_id,account.check_interval))
-                       EM_DEBUG_EXCEPTION("emf_add_polling_alarm[NOTI_ACCOUNT_ADD] : start auto poll failed >>> ");
-       }
-#endif
-       /* add account details to contact DB */
-       emf_account_insert_accountinfo_to_contact(&account);
-       local_result = 1;
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &local_result, sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed ");
-       
-       EM_DEBUG_LOG("[3] APPID[%d], APIID [%d]", ipcEmailAPI_GetAPPID(a_hAPI), ipcEmailAPI_GetAPIID(a_hAPI));
-       EM_DEBUG_LOG("account id[%d]", account.account_id);
-       
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &(account.account_id), sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed ");
-       if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-               EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-
-FINISH_OFF:
-       if ( local_result == 0 ) {                      
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &local_result, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed : local_result ");
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed : err");
-               if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-                       EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-       }
-       EM_DEBUG_FUNC_END();
-}
-
-void stb_account_delete(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int account_id = 0;
-       int local_result = 0;
-       int err = EMF_ERROR_NONE;
-       
-       /* account_id */
-       memcpy(&account_id, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), sizeof(int));;
-       if(!emf_account_delete(account_id, &err)) {
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &local_result, sizeof(int)))
-                       EM_DEBUG_LOG("ipcEmailAPI_AddParameter failed ");
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-                               
-               if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-                       EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-               goto FINISH_OFF;
-       }
-
-#ifdef __FEATURE_AUTO_POLLING__
-       /* stop auto polling for this acount */
-       if(is_auto_polling_started(account_id)) {
-               if(!emf_remove_polling_alarm(account_id))
-                       EM_DEBUG_EXCEPTION("emf_remove_polling_alarm[ NOTI_ACCOUNT_DELETE] : remove auto poll failed >>> ");
-       }
-#endif
-       local_result = 1;
-
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &local_result, sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed ");
-                       
-       if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-               EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed");
-
-FINISH_OFF:
-
-       EM_DEBUG_FUNC_END();
-}
-
-void stb_account_update(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int account_id = 0, buffer_size = 0, local_result = 0, with_validation = 0;
-       char* AccountStream = NULL;
-       emf_account_t  *new_account_info = NULL;
-       int err = EMF_ERROR_NONE;
-       unsigned int handle = 0;  
-
-       /* filter_id */
-       memcpy(&account_id, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), sizeof(int));;
-       
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 1);
-       EM_DEBUG_LOG("size [%d]", buffer_size);
-       
-       if(buffer_size > 0)      {
-               AccountStream = (char*)em_core_malloc(buffer_size+1);
-               if(AccountStream) {
-                       memcpy(AccountStream, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 1), buffer_size);
-                       /* Convert Byte stream to account structure */
-                       EM_DEBUG_LOG("Before Convert_ByteStream_To_account");
-                       new_account_info = (emf_account_t*)em_core_malloc(sizeof(emf_account_t));
-
-                       if(NULL == new_account_info)                     {
-                               EM_SAFE_FREE(AccountStream);
-                               err = EMF_ERROR_OUT_OF_MEMORY;
-                               goto FINISH_OFF;
-                       }
-                       em_convert_byte_stream_to_account(AccountStream, new_account_info);
-                       EM_SAFE_FREE(AccountStream);
-               }
-               else {
-                       err = EMF_ERROR_OUT_OF_MEMORY;
-                       goto FINISH_OFF;
-               }
-                       
-               memcpy(&with_validation, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 2), sizeof(int));
-       }
-
-       if ( NULL == new_account_info ) {
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-
-       emf_account_t  *old_account_info = NULL;
-       
-       if(!emf_account_get(account_id, GET_FULL_DATA, &old_account_info, &err)) {
-               EM_DEBUG_EXCEPTION("emf_account_get failed ");
-               goto FINISH_OFF;
-       }
-
-       if(new_account_info->password == NULL || (new_account_info->password != NULL && strlen(new_account_info->password) == 0) ) {
-               EM_SAFE_FREE(new_account_info->password);
-               if(old_account_info->password) {
-                       new_account_info->password = strdup(old_account_info->password);
-                       if(new_account_info->password == NULL) {
-                               EM_DEBUG_EXCEPTION("allocation for new_account_info->password failed");
-                               err = EMF_ERROR_OUT_OF_MEMORY;
-                               goto FINISH_OFF;
-                       }
-               }
-       }
-       
-       if(new_account_info->sending_password == NULL || (new_account_info->sending_password != NULL && strlen(new_account_info->sending_password) == 0) ) {
-               if(new_account_info->sending_password != NULL)
-                       free(new_account_info->sending_password);
-               if(old_account_info->sending_password) {
-                       new_account_info->sending_password = strdup(old_account_info->sending_password);
-                       if(new_account_info->sending_password == NULL) {
-                               EM_DEBUG_EXCEPTION("allocation for new_account_info->sending_password failed");
-                               err = EMF_ERROR_OUT_OF_MEMORY;
-                               goto FINISH_OFF;
-                       }
-               }
-       }
-
-       
-       if(with_validation) {
-               emf_account_validate_and_update(account_id, new_account_info, &handle, &err);
-               local_result = 1;
-       }
-       else {
-               if(emf_account_modify(account_id, new_account_info, &err)) {
-#ifdef __FEATURE_AUTO_POLLING__
-                       int  old_check_interval = old_account_info->check_interval;
-                       if( old_check_interval == 0 && new_account_info->check_interval > 0) {
-                               if(!emf_add_polling_alarm( account_id,new_account_info->check_interval))
-                                       EM_DEBUG_EXCEPTION("emf_add_polling_alarm[ CHANGEACCOUNT] : start auto poll failed >>> ");
-                               
-                       }
-                       else if( (old_check_interval > 0) && (new_account_info->check_interval == 0)) {
-                               if(!emf_remove_polling_alarm(account_id))
-                                       EM_DEBUG_EXCEPTION("emf_remove_polling_alarm[ CHANGEACCOUNT] : start auto poll failed >>> ");
-                       }
-                       else if(old_check_interval != new_account_info->check_interval) {
-                               if(!emf_remove_polling_alarm(account_id)) {
-                                       EM_DEBUG_EXCEPTION("emf_remove_polling_alarm[ CHANGEACCOUNT] : start auto poll failed >>> ");
-                                       goto FINISH_OFF;
-                               }               
-                               if(!emf_add_polling_alarm( account_id,new_account_info->check_interval))
-                                       EM_DEBUG_EXCEPTION("emf_add_polling_alarm[ CHANGEACCOUNT] : start auto poll failed >>> ");
-                       }
-#endif
-                       emf_account_update_accountinfo_to_contact(old_account_info,new_account_info);
-                       local_result = 1;
-               }
-               else {
-                       EM_DEBUG_EXCEPTION("emf_account_modify failed [%d]", err);
-                       goto FINISH_OFF;
-               }
-               
-       }
-       
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &local_result, sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter for result failed");
-
-       if(with_validation) {
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &handle, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter for handle failed");
-       }
-               
-       if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-               EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed");
-
-FINISH_OFF:
-       if ( local_result == 0 ) {
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &local_result, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-                               
-               if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-                       EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed");
-       }
-       EM_SAFE_FREE(new_account_info);         
-       EM_SAFE_FREE(old_account_info);
-       EM_DEBUG_FUNC_END();
-}
-
-void stb_account_validate(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-
-       int account_id = 0;
-       int local_result = 0;
-       int err_code = 0;
-       int handle = 0;
-       
-       /* account_id */
-       memcpy(&account_id, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), sizeof(int));;
-       local_result = emf_account_validate(account_id, (unsigned*)&handle,&err_code);
-
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &local_result, sizeof(int)))
-               EM_DEBUG_LOG("ipcEmailAPI_AddParameter failed ");
-
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err_code, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed ");
-                               
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &handle, sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter result failed ");
-                               
-       if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-               EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-
-       EM_DEBUG_FUNC_END();
-}
-
-void stb_account_get_refer(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int local_result = 0;
-       int account_id = 0;
-       emf_account_t* account = NULL;
-       char* local_stream = NULL;
-       int size = 0;
-
-       EM_DEBUG_LOG("account_id");
-       memcpy(&account_id, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), sizeof(int));
-
-       account = emf_get_account_reference(account_id);
-       if(account != NULL) {
-               EM_DEBUG_LOG("emf_get_account_reference success");
-               local_result = 1;
-               
-               /* result */
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &local_result, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter local_result failed ");
-               
-               /* Address */
-               local_stream = em_convert_account_to_byte_stream(account, &size);
-
-               EM_NULL_CHECK_FOR_VOID(local_stream);
-
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, local_stream, size))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-
-               if (!ipcEmailStub_ExecuteAPI(a_hAPI)) {
-                       EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed");
-                       EM_SAFE_FREE(local_stream);
-                       return;
-               }
-
-       }
-       else {
-               EM_DEBUG_LOG("emf_get_account_reference failed");
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &local_result, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter local_result failed ");
-               if (!ipcEmailStub_ExecuteAPI(a_hAPI)) {
-                       EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-                       EM_SAFE_FREE(local_stream);
-                       return;
-               }
-       }
-
-       EM_SAFE_FREE(local_stream);
-       EM_DEBUG_FUNC_END();
-}
-
-void stb_account_get_list(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       
-       int local_result = 0;
-       int counter = 0;
-       char* local_stream = NULL;
-       emf_account_t* account_list;
-       int count;
-       int size = 0;
-       int err = EMF_ERROR_NONE;
-
-       EM_DEBUG_LOG("begin");
-       
-       if(emf_account_get_list(&account_list, &count, &err)) {
-               EM_DEBUG_LOG("emf_account_get_list success");
-               local_result = 1;
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &local_result, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter local_result failed ");
-
-               EM_DEBUG_LOG("Count [%d]", count);
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &count, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter count failed ");
-
-               for(counter=0; counter<count; counter++) {
-                       EM_DEBUG_LOG("Name - %s", account_list[counter].account_name);
-
-                       local_stream = em_convert_account_to_byte_stream(account_list+counter, &size);
-
-                       EM_NULL_CHECK_FOR_VOID(local_stream);
-
-                       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, local_stream, size))
-                               EM_DEBUG_EXCEPTION("Add  Param mailbox failed  ");
-
-                       size = 0;
-                       EM_SAFE_FREE(local_stream);
-               }
-
-               emf_account_free(&account_list, count, NULL);  
-               if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-                       EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-       }
-
-       else {
-               EM_DEBUG_LOG("emf_account_get_list failed");
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &local_result, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter local_result failed ");
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed : err");
-               if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-                       EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-       }
-
-       EM_SAFE_FREE(local_stream);
-       EM_DEBUG_FUNC_END();
-}
-       
-void stb_modify_mail_flag(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int err = EMF_ERROR_NONE;
-       int mail_id = 0;
-       int i_flag = 0;
-       int onserver = 0;
-       int sticky_flag = 0;
-       emf_mail_flag_t new_flag = { 0 };
-
-       EM_DEBUG_LOG("mail_id");
-       memcpy(&mail_id, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), sizeof(int));
-       EM_DEBUG_LOG("mail_id[%d]", mail_id);
-
-       EM_DEBUG_LOG("i_flag");
-       memcpy(&i_flag, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 1), sizeof(int));
-       EM_DEBUG_LOG("i_flag[%d]", i_flag);
-
-       EM_DEBUG_LOG("Sticky flag");
-       memcpy(&sticky_flag, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 2), sizeof(int));
-       EM_DEBUG_LOG(">>> STICKY flag Value [ %d] ", sticky_flag);
-
-       EM_DEBUG_LOG("onserver");
-       memcpy(&onserver, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 3), sizeof(int));
-       EM_DEBUG_LOG("onserver[%d]", onserver);
-
-       EM_DEBUG_LOG("Flag Change 1>>> ");
-       if(!em_convert_mail_int_to_flag(i_flag, &new_flag, &err)) {
-               EM_DEBUG_EXCEPTION("em_convert_mail_int_to_flag failed");
-               return;
-       }
-       if(emf_mail_modify_flag(mail_id, new_flag, onserver, sticky_flag, &err))                
-               EM_DEBUG_LOG("emf_mail_modify_flag - success");
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter local_result failed ");
-               if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-                       EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-       EM_DEBUG_FUNC_END();
-}
-
-void stb_modify_mail_extra_flag(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int err = EMF_ERROR_NONE;
-       int mail_id = 0;
-       int buffer_size = 0;
-       emf_extra_flag_t new_flag= { 0 };
-       char* local_stream = NULL;
-
-       EM_DEBUG_LOG("mail_id");
-       memcpy(&mail_id, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), sizeof(int));
-
-       EM_DEBUG_LOG("extra_flag");
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 1);
-
-       if(buffer_size > 0) {
-               local_stream = (char*)em_core_malloc(buffer_size+1);
-               EM_NULL_CHECK_FOR_VOID(local_stream);
-               if(local_stream) {
-                       memcpy(local_stream, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 1), buffer_size);
-                       em_convert_byte_stream_to_extra_flags(local_stream, &new_flag);
-                       EM_SAFE_FREE(local_stream);
-               }
-
-               if(emf_mail_modify_extra_flag(mail_id, new_flag, &err))         
-                       EM_DEBUG_LOG("emf_mail_modify_extra_flag - success");
-               
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-                               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter local_result failed ");
-               
-                       if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-                               EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-               
-       }
-       EM_DEBUG_FUNC_END();
-}
-
-
-void stb_mail_save_to_mailbox(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int buffer_size = 0;
-       int local_result = 0;
-       char* local_head_stream = NULL;
-       char* local_body_stream = NULL;
-       char* local_info_stream = NULL;
-       char* local_stream = NULL;
-       int from_composer = 0;
-       emf_mail_t *mail = NULL;
-       emf_mailbox_t *mailbox = NULL;
-       int err = EMF_ERROR_NONE;
-       emf_meeting_request_t *meeting_req = NULL;
-
-       EM_DEBUG_LOG("head");
-
-       mail = (emf_mail_t*)em_core_malloc(sizeof(emf_mail_t));
-
-       if(mail == NULL) {
-               err = EMF_ERROR_OUT_OF_MEMORY;
-               goto FINISH_OFF;
-       }
-
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 0);
-
-       if(buffer_size > 0)      {
-               local_head_stream = (char*)em_core_malloc(buffer_size+1);
-               if(local_head_stream) {
-                       memcpy(local_head_stream, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), buffer_size);
-                       mail->head = (emf_mail_head_t*)em_core_malloc(sizeof(emf_mail_head_t));
-                       
-                       if(NULL == mail->head) {
-                               err = EMF_ERROR_OUT_OF_MEMORY;
-                               goto FINISH_OFF;
-                       }
-                       em_convert_byte_stream_to_mail_head(local_head_stream, mail->head);
-               }
-               else {
-                       err = EMF_ERROR_OUT_OF_MEMORY;
-                       goto FINISH_OFF;
-               }
-       }
-
-       EM_DEBUG_LOG("Body - mod");
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 1);
-
-       if(buffer_size > 0)      {
-               local_body_stream = (char*)em_core_malloc(buffer_size+1);
-               if(local_body_stream) {
-                       memcpy(local_body_stream, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 1), buffer_size);
-                       mail->body = (emf_mail_body_t*)em_core_malloc(sizeof(emf_mail_body_t));
-
-                       if(NULL == mail->body)           {
-                               err = EMF_ERROR_OUT_OF_MEMORY;
-                               goto FINISH_OFF;
-                       }
-                       em_convert_byte_stream_to_mail_body(local_body_stream, mail->body);
-               }
-               else {
-                       err = EMF_ERROR_OUT_OF_MEMORY;
-                       goto FINISH_OFF;
-               }
-       }
-
-       EM_DEBUG_LOG("Info");
-
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 2);
-
-       if(buffer_size > 0)      {
-               local_info_stream = (char*)em_core_malloc(buffer_size+1);
-               if(local_info_stream) {
-                       memcpy(local_info_stream, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 2), buffer_size);
-                       mail->info = (emf_mail_info_t*)em_core_malloc(sizeof(emf_mail_info_t));
-
-                       if(NULL == mail->info) {
-                               err = EMF_ERROR_OUT_OF_MEMORY;
-                               goto FINISH_OFF;
-                       }
-                       em_convert_byte_stream_to_mail_info(local_info_stream, mail->info);
-               }
-               else {
-                       err = EMF_ERROR_OUT_OF_MEMORY;
-                       goto FINISH_OFF;
-               }
-       }
-
-       EM_DEBUG_LOG("mailbox");
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 3);
-
-       if(buffer_size > 0) {
-               local_stream = (char*)em_core_malloc(buffer_size+1);
-               if(local_stream) {
-                       memcpy(local_stream, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 3), buffer_size);
-                       mailbox = (emf_mailbox_t*)em_core_malloc(sizeof(emf_mailbox_t));
-                       if(!mailbox) {
-                               err = EMF_ERROR_OUT_OF_MEMORY;
-                               goto FINISH_OFF;
-                       }
-                       em_convert_byte_stream_to_mailbox(local_stream, mailbox);
-               }
-               else {
-                       err = EMF_ERROR_OUT_OF_MEMORY;
-                       goto FINISH_OFF;
-               }
-       }
-
-       EM_DEBUG_LOG("from_composer");
-       memcpy(&from_composer, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 4), sizeof(int));
-
-       EM_DEBUG_LOG("calling emf_mail_save_to_mailbox");
-
-       if ( mail->info->is_meeting_request == EMF_MAIL_TYPE_MEETING_REQUEST 
-               || mail->info->is_meeting_request == EMF_MAIL_TYPE_MEETING_RESPONSE 
-               || mail->info->is_meeting_request == EMF_MAIL_TYPE_MEETING_ORIGINATINGREQUEST) {
-               buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 5);
-
-               if(buffer_size > 0) {
-                       local_stream = (char*)em_core_malloc(buffer_size+1);
-                       if(local_stream) {
-                               memcpy(local_stream, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 5), buffer_size);
-                               meeting_req = (emf_meeting_request_t*)em_core_malloc(sizeof(emf_meeting_request_t));
-                               if(meeting_req) {
-                                       err = EMF_ERROR_OUT_OF_MEMORY;
-                                       goto FINISH_OFF;
-                               }
-                               em_convert_byte_stream_to_meeting_req(local_stream, meeting_req);
-                       }
-                       else {
-                               err = EMF_ERROR_OUT_OF_MEMORY;
-                               goto FINISH_OFF;
-                       }
-               }
-       }
-       
-       EM_DEBUG_LOG("calling emf_mail_save_to_mailbox with meeting request");
-       if(emf_mail_save_to_mailbox(mail, mailbox, meeting_req, from_composer, &err)) { /*  successfully saving */
-               local_result = 1;
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter result failed ");
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &(mail->info->uid), sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter mail_idFail ");
-               if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-                       EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-       }
-
-FINISH_OFF:
-       if ( local_result == 0 ) {
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed ");
-               if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-                       EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-       }
-
-       EM_SAFE_FREE(local_head_stream);
-       EM_SAFE_FREE(local_body_stream);
-       EM_SAFE_FREE(local_info_stream); 
-       EM_SAFE_FREE(local_stream);
-       
-       if(mail)
-               em_core_mail_free(&mail, 1, &err);
-
-       if(mailbox)
-               em_core_mailbox_free(&mailbox, 1, &err);
-
-       em_core_flush_memory();
-       EM_DEBUG_FUNC_END();
-}
-
-void stb_mail_get_mailbox_count(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int buffer_size = 0;
-       int local_result = 0;
-       char* local_stream = NULL;
-       emf_mailbox_t mailbox;
-       int total_count = 0;
-       int unseen= 0;
-
-       EM_DEBUG_LOG("mailbox");
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 0);
-
-       if(buffer_size > 0)     {
-               local_stream = (char*)em_core_malloc(buffer_size+1);
-               if(!local_stream) {
-                       EM_DEBUG_EXCEPTION("EMF_ERROR_OUT_OF_MEMORY");
-                       goto FINISH_OFF;
-               }
-               memcpy(local_stream, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), buffer_size);
-               em_convert_byte_stream_to_mailbox(local_stream, &mailbox);
-               EM_SAFE_FREE(local_stream);
-       }
-
-       /*get the Mailbox Count */
-       if (!emf_mailbox_get_mail_count(&mailbox, &total_count, &unseen, NULL)) {
-               EM_DEBUG_EXCEPTION("emf_mailbox_get_mail_count - failed");
-               goto FINISH_OFF;
-       }
-       else {
-               EM_DEBUG_LOG("emf_mailbox_get_mail_count - success");
-               local_result = 1;
-       }
-
-FINISH_OFF:
-
-       if(local_result) {
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &local_result, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter local_result failed ");
-
-               /* Totol count of mails */
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &total_count, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed  ");
-
-               /* Unread Mail */
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &unseen, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed  ");
-
-               if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-                       EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-       }
-       else {
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &local_result, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter local_result failed ");
-               if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-                       EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed");
-       }
-
-       EM_DEBUG_FUNC_END();
-}
-
-
-/* sowmya.kr, 10-May-2010, changes for API improvement */
-void stb_mailbox_sync_header(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int buffer_size = 0;
-       int err = EMF_ERROR_NONE;
-       char* local_stream = NULL;
-       emf_mailbox_t mailbox, *pointer_mailbox = NULL;
-       int handle = -1;
-       
-       EM_DEBUG_LOG("mailbox");
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 0);
-
-       if(buffer_size > 0) {
-               local_stream = (char*)em_core_malloc(buffer_size+1);
-               EM_NULL_CHECK_FOR_VOID(local_stream);
-               if(!local_stream) {
-                       err = EMF_ERROR_OUT_OF_MEMORY;
-                       goto FINISH_OFF;
-               }
-               memcpy(local_stream, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), buffer_size);
-               em_convert_byte_stream_to_mailbox(local_stream, &mailbox);
-               EM_SAFE_FREE(local_stream);
-               pointer_mailbox = &mailbox;
-       }
-
-  if(emf_mailbox_sync_header(pointer_mailbox, (unsigned*)&handle, &err)) {
-               EM_DEBUG_LOG("emf_mailbox_sync_header success ");
-  }
-
-FINISH_OFF:
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed ");
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &handle, sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed ");
-       if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-               EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-       EM_DEBUG_FUNC_END();
-}
-
-void stb_mailbox_download_body(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int buffer_size = 0;
-       int err = EMF_ERROR_NONE;
-       char* local_stream = NULL;
-       emf_mailbox_t mailbox;
-       int mail_id = 0;
-       int has_attachment = 0;
-       unsigned int handle = 0;
-       
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 0);
-
-       if(buffer_size > 0)     {
-               local_stream = (char*)em_core_malloc(buffer_size+1);
-               EM_NULL_CHECK_FOR_VOID(local_stream);
-               if(local_stream) {
-                       memcpy(local_stream, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), buffer_size);
-                       em_convert_byte_stream_to_mailbox(local_stream, &mailbox);
-                       EM_SAFE_FREE(local_stream);
-               }
-       }
-
-       /* Mail Id */
-       memcpy(&mail_id, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 1), sizeof(int));
-
-       /* Has Attachment */
-       memcpy(&has_attachment, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 2), sizeof(int));
-
-       /*Download Body */
-       if (!emf_mail_download_body(&mailbox, mail_id, 1, has_attachment, &handle, &err)) {
-               EM_DEBUG_EXCEPTION("emf_mail_download_body - failed");
-               goto FINISH_OFF;
-       }
-
-       err = EMF_ERROR_NONE;
-
-FINISH_OFF:
-
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter local_result failed ");
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &handle, sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter local_result failed ");
-       if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-               EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-
-       EM_DEBUG_FUNC_END();
-}
-
-
-
-void stb_mail_get_mail(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       emf_mailbox_t mailbox;
-       int mail_id = 0;
-       emf_mail_t* mail = NULL;
-       int size =0;
-       char* local_head_stream = NULL;
-       char* local_body_stream = NULL;
-       char* local_info_stream = NULL;
-       int err=EMF_ERROR_NONE;
-       
-       EM_DEBUG_LOG("mail_id");
-       memcpy(&mail_id, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), sizeof(int));
-       
-       if(emf_mail_get_mail(&mailbox, mail_id, &mail, &err))
-               EM_DEBUG_LOG("success");
-
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-                       EM_DEBUG_EXCEPTION(" stb_mail_get_mail ipcEmailAPI_AddParameter local_result failed ");
-       if(EMF_ERROR_NONE == err) {             
-               /* Head */
-               EM_DEBUG_LOG("convert mail head");
-               local_head_stream = em_convert_mail_head_to_byte_stream(mail->head, &size);
-
-               EM_NULL_CHECK_FOR_VOID(local_head_stream);
-
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, local_head_stream, size))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed  ");
-
-               /* Body */
-               EM_DEBUG_LOG("convert mail Body");
-               local_body_stream = em_convert_mail_body_to_byte_stream(mail->body, &size);
-
-               if ( !local_body_stream ) {
-                       EM_SAFE_FREE(local_head_stream);
-                       return;
-               }
-                       
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, local_body_stream, size))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed  ");
-       
-               /* Info */
-               EM_DEBUG_LOG("convert mail Info");
-               local_info_stream = em_convert_mail_info_to_byte_stream(mail->info, &size);
-
-               if ( !local_info_stream ) {
-                       EM_SAFE_FREE(local_head_stream);
-                       EM_SAFE_FREE(local_body_stream);
-                       return;
-               }
-
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, local_info_stream, size))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed  ");
-       }
-       
-       EM_DEBUG_LOG("Before Execute API");
-               if (!ipcEmailStub_ExecuteAPI(a_hAPI)) {
-                       EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-                       EM_SAFE_FREE(local_head_stream);
-                       EM_SAFE_FREE(local_body_stream);
-                       EM_SAFE_FREE(local_info_stream);
-                       return;
-               }
-
-       EM_SAFE_FREE(local_head_stream);
-       EM_SAFE_FREE(local_body_stream);
-       EM_SAFE_FREE(local_info_stream);
-       
-       EM_DEBUG_FUNC_END();
-}
-
-void stb_mailbox_create(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int             buffer_size                     = 0;
-       int             err = EMF_ERROR_NONE;
-       char            *local_stream  = NULL;
-       int             on_server               = 0;
-       emf_mailbox_t mailbox;
-       int handle = 0; /* Added for cancelling mailbox creating  */
-
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 0);
-       EM_DEBUG_LOG("size [%d]", buffer_size);
-
-       if(buffer_size > 0) {
-               local_stream = (char*)em_core_malloc(buffer_size+1);
-               EM_NULL_CHECK_FOR_VOID(local_stream);
-               if(local_stream) {
-                       memcpy(local_stream, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), buffer_size);
-                       memcpy(&on_server, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 1), sizeof(int));
-                       em_convert_byte_stream_to_mailbox(local_stream, &mailbox);
-                       EM_SAFE_FREE(local_stream);
-                                       
-                       if (mailbox.name)
-                               EM_DEBUG_LOG("Mailbox name - %s", mailbox.name);
-                       
-                       if(emf_mailbox_create(&mailbox, on_server, (unsigned*)&handle, &err))
-                               err = EMF_ERROR_NONE;
-                       
-                       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-                               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed 1");
-                       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &handle, sizeof(int)))
-                               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed 2");
-                       
-                       if (!ipcEmailStub_ExecuteAPI(a_hAPI)) {
-                               EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-                               return;
-                       }
-               }
-       }       
-       EM_DEBUG_FUNC_END();
-}
-
-
-void stb_mailbox_delete(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int             buffer_size                     = 0;
-       int              err = EMF_ERROR_NONE;
-       char    *local_stream  = NULL;
-       int             on_server               = 0;
-       emf_mailbox_t mailbox;
-       int handle = 0; /* Added for cancelling mailbox deleting */
-
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 0);
-       
-       EM_DEBUG_LOG("size [%d]", buffer_size);
-
-       if(buffer_size > 0) {
-               local_stream = (char*)em_core_malloc(buffer_size+1);
-               EM_NULL_CHECK_FOR_VOID(local_stream);
-               if(local_stream) {
-                       memcpy(local_stream, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), buffer_size);
-                       memcpy(&on_server, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 1), sizeof(int));
-                       
-                       em_convert_byte_stream_to_mailbox(local_stream, &mailbox);
-                       EM_SAFE_FREE(local_stream);
-
-                       if (mailbox.name)
-                               EM_DEBUG_LOG("Mailbox name - %s", mailbox.name);
-                       if(emf_mailbox_delete(&mailbox, on_server, (unsigned*)&handle, &err))
-                               err = EMF_ERROR_NONE;
-                       
-                       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-                               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-                       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &handle, sizeof(int)))
-                               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-                       
-                       if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-                               EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed");
-                       
-               }
-       }       
-       EM_DEBUG_FUNC_END();
-}
-
-void stb_mailbox_update(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int             buffer_size                     = 0;
-       int              err = EMF_ERROR_NONE;
-       char    *old_mailbox_stream  = NULL;
-       char    *new_mailbox_stream  = NULL;
-       int             on_server               = 0;
-       emf_mailbox_t *old_mailbox = NULL;
-       emf_mailbox_t *new_mailbox = NULL;
-       int handle = 0; /* Added for cancelling mailbox updating */
-
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 0);
-       EM_DEBUG_LOG("size [%d]", buffer_size);
-       if(buffer_size > 0)       {
-               old_mailbox_stream = (char*)em_core_malloc(buffer_size+1);
-               EM_NULL_CHECK_FOR_VOID(old_mailbox_stream);
-               if(old_mailbox_stream) {
-                       memcpy(old_mailbox_stream, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), buffer_size);
-                       old_mailbox = (emf_mailbox_t*)em_core_malloc(sizeof(emf_mailbox_t));
-                       if ( old_mailbox == NULL ) {
-                               EM_DEBUG_EXCEPTION("em_core_malloc failed.");
-                               err = EMF_ERROR_OUT_OF_MEMORY;
-                               goto FINISH_OFF;
-                       }
-
-                       em_convert_byte_stream_to_mailbox(old_mailbox_stream, old_mailbox);
-                       EM_SAFE_FREE(old_mailbox_stream);
-               }
-       }
-       else {
-               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 1);
-       EM_DEBUG_LOG("size [%d]", buffer_size);
-       if(buffer_size > 0)       {
-               new_mailbox_stream = (char*)em_core_malloc(buffer_size+1);
-               EM_NULL_CHECK_FOR_VOID(new_mailbox_stream);
-               if(new_mailbox_stream) {
-                       memcpy(new_mailbox_stream, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 1), buffer_size);
-                       new_mailbox = (emf_mailbox_t*)em_core_malloc(sizeof(emf_mailbox_t));
-                       if ( new_mailbox == NULL ) {
-                               EM_DEBUG_EXCEPTION("em_core_malloc failed.");
-                               err = EMF_ERROR_OUT_OF_MEMORY;
-                               goto FINISH_OFF;
-                       }
-                       em_convert_byte_stream_to_mailbox(new_mailbox_stream, new_mailbox);
-                       EM_SAFE_FREE(new_mailbox_stream);
-               }
-       }
-       else {
-               EM_DEBUG_EXCEPTION("INVALID PARAM : old mailbox");
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-       
-       memcpy(&on_server, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 2), sizeof(int));
-       
-       if(emf_mailbox_update(old_mailbox, new_mailbox, on_server, (unsigned*)&handle, &err))
-               err = EMF_ERROR_NONE;
-
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &handle, sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-       
-       if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-               EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed");
-                       
-
-FINISH_OFF:
-       EM_SAFE_FREE(old_mailbox_stream);
-       EM_SAFE_FREE(new_mailbox_stream);
-
-       emf_mailbox_free(&old_mailbox, 1, NULL);
-       emf_mailbox_free(&new_mailbox, 1, NULL);
-       EM_DEBUG_FUNC_END();
-}
-
-
-void stb_mailbox_set_mail_slot_size(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int buffer_size  = 0;
-       int     err    = EMF_ERROR_NONE;
-       int handle = 0; 
-       int account_id = 0, mail_slot_size = 0;
-       char *mailbox_name = NULL;
-
-
-       memcpy(&account_id, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), sizeof(int));
-       EM_DEBUG_LOG("account_id[%d]", account_id);
-
-       memcpy(&mail_slot_size, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 1), sizeof(int));
-       EM_DEBUG_LOG("mail_slot_size[%d]", mail_slot_size);
-
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 2);
-       EM_DEBUG_LOG("mailbox name string size[%d]", buffer_size);
-       if(buffer_size > 0)       {
-               mailbox_name = (char*)em_core_malloc(buffer_size + 1);
-               memcpy(mailbox_name, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 2), buffer_size);
-               EM_DEBUG_LOG("mailbox_name [%s]", mailbox_name);
-       }
-       
-       if(emf_mailbox_set_mail_slot_size(account_id, mailbox_name, mail_slot_size, (unsigned*)&handle, &err))
-               err = EMF_ERROR_NONE;
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed 1");
-
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &handle, sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed 2");
-       
-       if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-               EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-
-       EM_SAFE_FREE(mailbox_name);
-       EM_DEBUG_FUNC_END();
-}
-
-void stb_mail_send(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int buffer_size = 0;
-       char* local_option_stream = NULL;
-       char* local_stream = NULL;
-       emf_mailbox_t* mailbox = NULL;
-       emf_option_t sending_option;
-       int mail_id;
-       int handle;
-       int err = EMF_ERROR_NONE;
-       char* mailbox_name = NULL;
-
-       /* Mailbox */
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 0);
-
-       if(buffer_size > 0) {
-               local_stream = (char*)em_core_malloc(buffer_size+1);
-               EM_NULL_CHECK_FOR_VOID(local_stream);
-               if(local_stream) {
-                       memcpy(local_stream, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), buffer_size);
-                       mailbox = (emf_mailbox_t*)em_core_malloc(sizeof(emf_mailbox_t));
-                       em_convert_byte_stream_to_mailbox(local_stream, mailbox);
-
-                       if (!em_storage_get_mailboxname_by_mailbox_type(mailbox->account_id,EMF_MAILBOX_TYPE_DRAFT,&mailbox_name, false, &err))  {
-                               EM_DEBUG_EXCEPTION("em_storage_get_mailboxname_by_mailbox_type failed [%d]", err);
-                               err = em_storage_get_emf_error_from_em_storage_error(err);
-                               goto FINISH_OFF;
-                       }
-                       mailbox->name = mailbox_name;
-               }
-       }
-
-       /* Mail_id */
-       memcpy(&mail_id, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 1), sizeof(int));
-       EM_DEBUG_LOG("mail_id [%d]", mail_id);
-
-       /* Sending Option */
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 2);
-
-       if(buffer_size > 0) {
-               local_option_stream = (char*)em_core_malloc(buffer_size+1);
-               
-               if(NULL == local_option_stream) {
-                       err = EMF_ERROR_OUT_OF_MEMORY;
-                       goto FINISH_OFF;
-               }
-               
-               if(local_option_stream) {
-                       memcpy(local_option_stream, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 2), buffer_size);
-                       em_convert_byte_stream_to_option(local_option_stream, &sending_option);
-               }
-       }
-
-       if(emf_mail_send(mailbox, mail_id, &sending_option, (unsigned*)&handle, &err)) {
-               err = EMF_ERROR_NONE;
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter result failed ");
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &handle, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter result failed ");
-               if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-                       EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-       }
-       else {
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed ");
-               if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-                       EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-       }
-
-FINISH_OFF:    
-       EM_SAFE_FREE(local_stream);
-       EM_SAFE_FREE(local_option_stream);
-       EM_SAFE_FREE(mailbox);
-       EM_SAFE_FREE(mailbox_name);
-       
-       EM_DEBUG_FUNC_END();
-}
-
-void stb_mailbox_get_list(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int err = EMF_ERROR_NONE;
-       int counter = 0;
-       char* local_stream = NULL;
-       int account_id;
-       emf_mailbox_t* mailbox_list = NULL;
-       int count = 0;
-       int size = 0;
-
-       memcpy(&account_id, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), sizeof(int));
-
-       if(emf_mailbox_get_list(account_id, &mailbox_list, &count, &err))
-               EM_DEBUG_LOG("emf_mailbox_get_list - success");
-               
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed ");
-
-       if(EMF_ERROR_NONE == err) {
-               EM_DEBUG_LOG("Count [%d]", count);
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &count, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed ");
-
-               for(counter=0; counter<count; counter++) {
-                       EM_DEBUG_LOG("Name - %s", mailbox_list[counter].name);
-
-                       local_stream = em_convert_mailbox_to_byte_stream(mailbox_list+counter, &size);
-
-                       EM_NULL_CHECK_FOR_VOID(local_stream);
-
-                       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, local_stream, size))
-                               EM_DEBUG_EXCEPTION("Add  Param mailbox failed  ");
-
-                       EM_SAFE_FREE(local_stream);
-                       size = 0;
-               }
-       }
-
-       if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-               EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-       EM_DEBUG_FUNC_END();
-}
-
-
-void stb_update_mail_old(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       
-       int mail_id;
-       int buffer_size = 0;
-       int local_result = 0;
-       char* stream_for_head = NULL;   
-       char* stream_for_body = NULL;   
-       char* local_info_stream = NULL;
-       emf_mail_t *mail = NULL;
-       int err = EMF_ERROR_NONE;
-       char* stream_for_meeting_request = NULL;
-       emf_meeting_request_t *meeting_req = NULL;
-
-       mail = (emf_mail_t*)em_core_malloc(sizeof(emf_mail_t));
-
-       memcpy(&mail_id, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), sizeof(int));;
-       
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 1);
-               
-       if(buffer_size > 0)      {
-               stream_for_head = (char*)em_core_malloc(buffer_size+1);
-               EM_NULL_CHECK_FOR_VOID(stream_for_head);
-               if(stream_for_head) {
-                       memcpy(stream_for_head, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 1), buffer_size);
-                       mail->head = (emf_mail_head_t*)em_core_malloc(sizeof(emf_mail_head_t));
-                       if(NULL == mail->head)                   {
-                               err = EMF_ERROR_OUT_OF_MEMORY;
-                               goto FINISH_OFF;
-                       }
-                       em_convert_byte_stream_to_mail_head(stream_for_head, mail->head);
-               }
-               else {
-                       err = EMF_ERROR_OUT_OF_MEMORY;
-                       goto FINISH_OFF;
-               }
-       }
-
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 2);
-       if ( buffer_size == sizeof(int) ) {     
-               EM_DEBUG_LOG(">>>>> Mail body is Null");
-               mail->body = NULL;
-       }
-       else if(buffer_size > 0) {      
-               stream_for_body = (char*)em_core_malloc(buffer_size+1);
-               if(stream_for_body) {
-                       memcpy(stream_for_body, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 2), buffer_size);
-                       mail->body = (emf_mail_body_t*)em_core_malloc(sizeof(emf_mail_body_t));
-                       if(NULL == mail->body) {
-                               err = EMF_ERROR_OUT_OF_MEMORY;
-                               goto FINISH_OFF;
-                       }
-                       em_convert_byte_stream_to_mail_body(stream_for_body,  mail->body);
-               }
-               else {
-                       err = EMF_ERROR_OUT_OF_MEMORY;
-                       goto FINISH_OFF;
-               }
-       }       
-
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 3);
-       if(buffer_size > 0)      {
-               local_info_stream = (char*)em_core_malloc(buffer_size+1);
-               if(local_info_stream) {
-                       memcpy(local_info_stream, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 3), buffer_size);
-                       mail->info = (emf_mail_info_t*)em_core_malloc(sizeof(emf_mail_info_t));
-                       if(NULL == mail->info)           {
-                               err = EMF_ERROR_OUT_OF_MEMORY;
-                               goto FINISH_OFF;
-                       }
-                       em_convert_byte_stream_to_mail_info(local_info_stream,  mail->info);
-               }
-               else {
-                       err = EMF_ERROR_OUT_OF_MEMORY;
-                       goto FINISH_OFF;
-               }
-       }       
-
-       EM_DEBUG_LOG("meeting request[%d]", mail->info->is_meeting_request);
-
-       if ( mail->info->is_meeting_request == EMF_MAIL_TYPE_MEETING_REQUEST
-               || mail->info->is_meeting_request == EMF_MAIL_TYPE_MEETING_RESPONSE 
-               || mail->info->is_meeting_request == EMF_MAIL_TYPE_MEETING_ORIGINATINGREQUEST) {
-               buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 4);
-
-               if(buffer_size > 0) {
-                       stream_for_meeting_request = (char*)em_core_malloc(buffer_size+1);
-                       if(stream_for_meeting_request) {
-                               memcpy(stream_for_meeting_request, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 4), buffer_size);
-                               meeting_req = (emf_meeting_request_t*)em_core_malloc(sizeof(emf_meeting_request_t));
-                               if(meeting_req) {
-                                       em_convert_byte_stream_to_meeting_req(stream_for_meeting_request, meeting_req);
-                               }
-                       }
-                       else {
-                               err = EMF_ERROR_OUT_OF_MEMORY;
-                               goto FINISH_OFF;
-                       }
-               }
-       }
-
-       EM_DEBUG_LOG("calling emf_mail_update with meeting request");
-       if(emf_mail_update(mail_id, mail, meeting_req, 0, &err)) {
-               local_result = 1;
-
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &local_result, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed ");
-                               
-               if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-                       EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-       }
-
-FINISH_OFF:
-       if ( local_result == 0 ) {
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &local_result, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed ");
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed ");
-                               
-               if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-                       EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-       }
-
-       EM_SAFE_FREE(stream_for_head);
-       EM_SAFE_FREE(stream_for_body);
-       EM_SAFE_FREE(local_info_stream);
-       
-       /* Caution!! Don't free mail here. mail will be freed after using in event loop. 
-       if (mail)
-               em_core_mail_free(&mail, 1, &err_code);
-       EM_SAFE_FREE(meeting_req);
-       */
-
-       em_core_flush_memory();
-       EM_DEBUG_FUNC_END();
-}
-
-void stb_mail_delete_all(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int buffer_size = 0;
-       char* local_stream = NULL;
-       emf_mailbox_t *mailbox = NULL;
-       int with_server = 0;
-       int err = EMF_ERROR_NONE;
-
-       /* Mailbox */
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 0);
-
-       if(buffer_size > 0)     {
-               local_stream = (char*)em_core_malloc(buffer_size+1);
-               EM_NULL_CHECK_FOR_VOID(local_stream);
-               if(local_stream) {
-                       memcpy(local_stream, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), buffer_size);
-                       mailbox = (emf_mailbox_t*)em_core_malloc(sizeof(emf_mailbox_t));
-                       em_convert_byte_stream_to_mailbox(local_stream, mailbox);
-               }
-       }
-
-       /* with_server */
-       memcpy(&with_server, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 1), sizeof(int));
-
-       emf_mail_delete_all(mailbox, with_server, NULL, &err);
-       
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed ");
-       if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-               EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-
-       EM_SAFE_FREE(local_stream);
-       EM_SAFE_FREE(mailbox);
-
-       EM_DEBUG_FUNC_END();
-}
-
-void stb_mail_delete(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int buffer_size = 0;
-       int err = EMF_ERROR_NONE;
-       char* local_stream = NULL;
-       emf_mailbox_t *mailbox = NULL;
-       int with_server = 0;
-       int counter = 0;
-       int num;
-
-       /* Mailbox */
-       EM_DEBUG_LOG("mailbox");
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 0);
-
-       if(buffer_size > 0)      {
-               local_stream = (char*)em_core_malloc(buffer_size+1);
-               EM_NULL_CHECK_FOR_VOID(local_stream);
-               if(local_stream) {
-                       memcpy(local_stream, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), buffer_size);
-                       /* Memory is not yet allocated for mailbox */
-                       mailbox = (emf_mailbox_t*)em_core_malloc(sizeof(emf_mailbox_t));
-                       em_convert_byte_stream_to_mailbox(local_stream, mailbox);
-               }
-               EM_DEBUG_LOG("account_id [%d]", mailbox->account_id);
-               EM_DEBUG_LOG("mailbox name - %s", mailbox->name);
-
-               /* Number of mail_ids */
-               memcpy(&num, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 1), sizeof(int));
-               EM_DEBUG_LOG("number of mails [%d]", num);
-
-               int mail_ids[num];      
-               memcpy(mail_ids, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 2), num * sizeof(int));
-               for(counter = 0; counter < num; counter++)
-                       EM_DEBUG_LOG("mail_ids [%d]", mail_ids[counter]);
-               
-               /* with_server */
-               memcpy(&with_server, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 3), sizeof(int));
-               EM_DEBUG_LOG("with_Server [%d]", with_server);
-
-               emf_mail_delete(mailbox->account_id, mailbox, mail_ids, num, with_server, NULL, &err);
-       }
-       else
-               err = EMF_ERROR_IPC_CRASH;
-       
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-       if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-               EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed");
-
-       EM_SAFE_FREE(local_stream);
-       EM_SAFE_FREE(mailbox);  
-
-       EM_DEBUG_FUNC_END();    
-}
-void stb_clear_mail_data (HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int err = EMF_ERROR_NONE;
-       
-       if(emf_clear_mail_data(&err)) {
-               EM_DEBUG_LOG(">>> stb_clear_mail_data Success [ %d]  >> ", err);
-       }
-       
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed : err");
-       if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-               EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-       EM_DEBUG_FUNC_END();
-}
-
-void stb_rule_add(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int buffer_size = 0;
-       int err = EMF_ERROR_NONE;
-       char* local_rule_stream = NULL;
-       emf_rule_t rule = { 0 };
-
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 0);
-
-       if(buffer_size > 0)     {
-               local_rule_stream = (char*)em_core_malloc(buffer_size + 1);
-               EM_NULL_CHECK_FOR_VOID(local_rule_stream);
-               if(local_rule_stream) {
-                       memcpy(local_rule_stream, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), buffer_size);
-                       em_convert_byte_stream_to_rule(local_rule_stream, &rule);
-                       EM_DEBUG_LOG("account ID  [%d]", rule.account_id);
-
-                       if(emf_filter_add(&rule, &err))
-                               err = EMF_ERROR_NONE;
-                       
-                       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-                               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed ");
-                       if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-                               EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-       
-               }
-       }       
-
-       EM_SAFE_FREE(local_rule_stream);
-
-       EM_DEBUG_FUNC_END();
-}
-
-void stb_rule_get(HIPC_API a_hAPI)
-{
-       int err = EMF_ERROR_NONE;
-       int filter_id = 0;
-       emf_rule_t* rule = NULL;
-       int size =0;
-       char* local_rule_stream = NULL;
-
-       EM_DEBUG_LOG(" filter_id");
-       memcpy(&filter_id, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), sizeof(int));
-
-       if(emf_filter_get(filter_id, &rule, &err)) {
-               err = EMF_ERROR_NONE;
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed ");
-               
-               /* Rule */
-               local_rule_stream = em_convert_rule_to_byte_stream(rule, &size);
-
-               EM_NULL_CHECK_FOR_VOID(local_rule_stream);
-
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, local_rule_stream, size))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed  ");
-
-               if (!ipcEmailStub_ExecuteAPI(a_hAPI)) {
-                       EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-                       EM_SAFE_FREE( local_rule_stream );
-                       return;
-               }
-       }
-       else {
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed ");
-
-               if (!ipcEmailStub_ExecuteAPI(a_hAPI)) {
-                       EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-                       EM_SAFE_FREE( local_rule_stream );                      
-                       return;
-               }
-       }
-       EM_SAFE_FREE( local_rule_stream );      
-       EM_DEBUG_FUNC_END();
-}
-
-void stb_rule_get_list(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       /* int buffer_size = 0; */
-       int err = EMF_ERROR_NONE;
-       int counter = 0;
-       char* local_stream = NULL;
-       int count = 0;
-       int size = 0;
-
-       emf_rule_t* filtering_list = NULL;
-
-       if(emf_filter_get_list(&filtering_list, &count, &err)) {
-               EM_DEBUG_LOG("emf_filter_get_list - success");
-               err = EMF_ERROR_NONE;
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed ");
-
-               EM_DEBUG_LOG("Count [%d]", count);
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &count, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed ");
-
-               for(counter=0; counter<count; counter++) {
-                       EM_DEBUG_LOG("Value - %s", filtering_list[counter].value);
-
-                       local_stream = em_convert_rule_to_byte_stream(filtering_list+counter, &size);
-
-                       EM_NULL_CHECK_FOR_VOID(local_stream);
-
-                       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, local_stream, size))
-                               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed  ");
-
-                       EM_SAFE_FREE(local_stream);
-                       size = 0;
-               }
-
-               if (!ipcEmailStub_ExecuteAPI(a_hAPI)) {
-                       EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-                       return;
-               }
-       }
-
-       else {
-               EM_DEBUG_EXCEPTION("emf_filter_get_list - failed");
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter local_result failed ");
-               
-               if (!ipcEmailStub_ExecuteAPI(a_hAPI)) {
-                       EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-                       return;
-               }
-       }
-       EM_DEBUG_FUNC_END();
-}
-
-void stb_rule_find(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int buffer_size = 0;
-       int err = EMF_ERROR_NONE;
-       char* local_rule_stream = NULL;
-       emf_rule_t rule = { 0 };
-
-
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 0);
-
-       if(buffer_size > 0)      {
-               local_rule_stream = (char*)em_core_malloc(buffer_size+1);
-               EM_NULL_CHECK_FOR_VOID(local_rule_stream);
-               if(local_rule_stream) {
-                       memcpy(local_rule_stream, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), buffer_size);
-                       em_convert_byte_stream_to_rule(local_rule_stream, &rule);
-                       EM_SAFE_FREE(local_rule_stream);
-                       EM_DEBUG_LOG("account ID  [%d]", rule.account_id);
-               
-                       if(emf_filter_find(&rule, &err))
-                               err = EMF_ERROR_NONE;
-                       
-                       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-                               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed ");
-                       if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-                               EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-       
-               }
-       }       
-       EM_DEBUG_FUNC_END();
-}
-
-void stb_rule_change(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       
-       int filter_id = 0;
-       int buffer_size = 0;
-       int err = EMF_ERROR_NONE;
-       char* rule_stream = NULL;
-       emf_rule_t  *rule = NULL;
-
-       /* filter_id */
-       memcpy(&filter_id, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), sizeof(int));;
-       
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 1);
-       EM_DEBUG_LOG("size [%d]", buffer_size);
-       
-       if(buffer_size > 0)  {
-               rule_stream = (char*)em_core_malloc(buffer_size+1);
-               EM_NULL_CHECK_FOR_VOID(rule_stream);
-               if(rule_stream) {
-                       memcpy(rule_stream, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 1), buffer_size);
-                       rule = (emf_rule_t*)em_core_malloc(sizeof(emf_rule_t));
-
-                       if(NULL == rule)                         {
-                               EM_SAFE_FREE(rule_stream);
-                               return;
-                       }
-                       
-                       em_convert_byte_stream_to_rule(rule_stream, rule);
-                       EM_SAFE_FREE(rule_stream);
-               }
-       }
-
-       if(emf_filter_change(filter_id, rule, &err))
-               err = EMF_ERROR_NONE;
-
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-                       
-       if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-               EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed");
-
-       EM_SAFE_FREE(rule);     
-       EM_DEBUG_FUNC_END();    
-}
-
-void stb_mail_move_all_mails(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int buffer_size = 0;
-       int err = EMF_ERROR_NONE;
-       char* src_mailbox_stream = NULL;        
-       char* dst_mailbox_stream = NULL;
-       emf_mailbox_t dst_mailbox;
-       emf_mailbox_t src_mailbox;      
-
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 0);
-       EM_DEBUG_LOG("buffer_size [%d]", buffer_size);
-       
-       if(buffer_size > 0)      {
-               src_mailbox_stream = (char*)em_core_malloc(buffer_size+1);
-               EM_NULL_CHECK_FOR_VOID(src_mailbox_stream);
-               if(src_mailbox_stream) {
-                       memcpy(src_mailbox_stream, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), buffer_size);
-                       /* Convert Byte stream to mailbox structure */
-                       EM_DEBUG_LOG("Before em_convert_byte_stream_to_mailbox");
-                       em_convert_byte_stream_to_mailbox(src_mailbox_stream, &src_mailbox);
-                       EM_SAFE_FREE(src_mailbox_stream);
-                       if (src_mailbox.name)
-                               EM_DEBUG_LOG("Mailbox name - %s", src_mailbox.name);
-                       else
-                               EM_DEBUG_EXCEPTION(">>>> Mailbox Information is NULL >> ");
-                       
-               }
-       }
-
-       buffer_size =0;
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 1);
-       EM_DEBUG_LOG(" size [%d]", buffer_size);
-       
-       if(buffer_size > 0)      {
-               dst_mailbox_stream = (char*)em_core_malloc(buffer_size+1);
-               EM_NULL_CHECK_FOR_VOID(dst_mailbox_stream);
-               if(dst_mailbox_stream) {
-                       memcpy(dst_mailbox_stream, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 1), buffer_size);
-                       em_convert_byte_stream_to_mailbox(dst_mailbox_stream, &dst_mailbox);
-                       EM_SAFE_FREE(dst_mailbox_stream);
-                       if (dst_mailbox.name)
-                               EM_DEBUG_LOG("Mailbox name - %s", dst_mailbox.name);
-                       else
-                               EM_DEBUG_EXCEPTION(">>>> Mailbox Information is NULL >> ");
-               }
-       }
-       
-       if(emf_mail_move_all_mails(&src_mailbox, &dst_mailbox, &err))
-               EM_DEBUG_LOG("emf_mail_move_all_mails:Success");
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int))) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed ");
-               return;
-       }
-       
-       if (!ipcEmailStub_ExecuteAPI(a_hAPI)) {
-               EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed");
-               return;
-       }
-       EM_DEBUG_FUNC_END();
-}
-
-void stb_set_flags_field(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int err = EMF_ERROR_NONE;
-       emf_flags_field_type field_type = 0;
-       void *temp_buffer = NULL;
-       int account_id;
-       int value = 0;
-       int onserver = 0;
-       int num = 0;
-       int counter = 0;
-       int *mail_ids = NULL;
-
-       /* account_id */
-       temp_buffer = ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0);
-       if(!temp_buffer) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter failed ");
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-
-       memcpy(&account_id, temp_buffer, sizeof(int));
-       EM_DEBUG_LOG("account_id [%d]", account_id);
-
-       /* Number of mail_ids */
-       temp_buffer = ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 1);
-       if(!temp_buffer) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter failed ");
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-
-       memcpy(&num, temp_buffer, sizeof(int));
-       EM_DEBUG_LOG("number of mails [%d]", num);
-       
-       /* mail_id */
-       mail_ids = em_core_malloc(sizeof(int) * num);
-       
-       if(!mail_ids) {
-               EM_DEBUG_EXCEPTION("em_core_malloc failed ");
-               err = EMF_ERROR_OUT_OF_MEMORY;
-               goto FINISH_OFF;
-       }
-
-       temp_buffer = ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 2);
-       if(!temp_buffer) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter failed ");
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-
-       memcpy(mail_ids, temp_buffer, num * sizeof(int));
-       
-       for(counter=0; counter < num; counter++) {
-               EM_DEBUG_LOG("mailids [%d]", mail_ids[counter]);
-       }
-
-       /* field type */
-       temp_buffer = ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 3);
-       if(!temp_buffer) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter failed ");
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-
-       memcpy(&field_type, temp_buffer, sizeof(int));
-       EM_DEBUG_LOG("field_type [%d]", field_type);
-
-       /* value */
-       temp_buffer = ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 4);
-       if(!temp_buffer) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter failed ");
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-
-       memcpy(&value, temp_buffer, sizeof(int));
-       EM_DEBUG_LOG("value [%d]", value);
-       
-       /*  on server */
-       temp_buffer = ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 5);
-       if(!temp_buffer) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter failed ");
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-
-       memcpy(&onserver, temp_buffer, sizeof(int));
-       EM_DEBUG_LOG("onserver [%d]", value);
-
-       if(emf_mail_set_flags_field(account_id, mail_ids, num, field_type, value, onserver, &err))      
-               EM_DEBUG_LOG("emf_mail_set_flags_field - success");
-
-FINISH_OFF:
-
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter local_result failed ");
-               
-       if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-               EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-       EM_DEBUG_FUNC_END();
-}
-
-void stb_add_mail(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int  buffer_size = 0;
-       int  local_result = 0;
-       int  result_mail_data_count = 0;
-       int  result_attachment_data_count = 0;
-       int  parameter_index = 0;
-       int  sync_server = 0;
-       int  err = EMF_ERROR_NONE;
-       char *mail_data_stream = NULL;
-       char *attachment_data_list_stream = NULL;
-       char *meeting_request_stream = NULL;
-       char *parameter_data = NULL;
-       emf_mail_data_t *result_mail_data = NULL;
-       emf_attachment_data_t *result_attachment_data = NULL;
-       emf_meeting_request_t *result_meeting_request = NULL;
-       
-       EM_DEBUG_LOG("emf_mail_data_t");
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, parameter_index);
-
-       if(buffer_size > 0)      {
-               mail_data_stream = (char*)em_core_malloc(buffer_size + 1);
-               if(!mail_data_stream) {
-                       err = EMF_ERROR_OUT_OF_MEMORY;
-                       goto FINISH_OFF;
-               }
-               parameter_data = ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, parameter_index++);
-
-               if(!parameter_data) {
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter failed");
-                       err = EMF_ERROR_ON_PARSING;
-                       goto FINISH_OFF;
-               }
-
-               memcpy(mail_data_stream, parameter_data, buffer_size);
-
-               em_convert_byte_stream_to_mail_data(mail_data_stream, &result_mail_data, &result_mail_data_count);
-               if(!result_mail_data) {
-                       EM_DEBUG_EXCEPTION("em_convert_byte_stream_to_mail_data failed");
-                       err = EMF_ERROR_ON_PARSING;
-                       goto FINISH_OFF;
-               }
-       }
-
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, parameter_index);
-       EM_DEBUG_LOG("emf_attachment_data_t buffer_size[%d]", buffer_size);
-
-       if(buffer_size > 0)      {
-               attachment_data_list_stream = (char*)em_core_malloc(buffer_size + 1);
-               if(!attachment_data_list_stream) {
-                       EM_DEBUG_EXCEPTION("em_core_malloc failed");
-                       err = EMF_ERROR_OUT_OF_MEMORY;
-                       goto FINISH_OFF;
-               }
-
-               parameter_data = ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, parameter_index++);
-
-               if(!parameter_data) {
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter failed");
-                       err = EMF_ERROR_ON_PARSING;
-                       goto FINISH_OFF;
-               }
-
-               memcpy(attachment_data_list_stream, parameter_data, buffer_size);
-
-               em_convert_byte_stream_to_attachment_data(attachment_data_list_stream, &result_attachment_data, &result_attachment_data_count);
-
-               EM_DEBUG_LOG("result_attachment_data_count[%d]", result_attachment_data_count);
-
-               if(result_attachment_data_count && !result_attachment_data) {
-                       EM_DEBUG_EXCEPTION("em_convert_byte_stream_to_attachment_data failed");
-                       err = EMF_ERROR_ON_PARSING;
-                       goto FINISH_OFF;
-               }
-       }
-
-       EM_DEBUG_LOG("emf_meeting_request_t");
-
-       if ( result_mail_data->meeting_request_status == EMF_MAIL_TYPE_MEETING_REQUEST 
-               || result_mail_data->meeting_request_status == EMF_MAIL_TYPE_MEETING_RESPONSE 
-               || result_mail_data->meeting_request_status == EMF_MAIL_TYPE_MEETING_ORIGINATINGREQUEST) {
-               buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, parameter_index);
-
-               if(buffer_size > 0) {
-                       meeting_request_stream = (char*)em_core_malloc(buffer_size + 1);
-                       if(!meeting_request_stream) {
-                               EM_DEBUG_EXCEPTION("em_convert_byte_stream_to_mail_data failed");
-                               err = EMF_ERROR_OUT_OF_MEMORY;
-                               goto FINISH_OFF;
-                       }
-                       parameter_data = ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, parameter_index++);
-
-                       if(!parameter_data) {
-                               EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter failed");
-                               err = EMF_ERROR_ON_PARSING;
-                               goto FINISH_OFF;
-                       }
-
-                       memcpy(meeting_request_stream, parameter_data, buffer_size);
-                       result_meeting_request = (emf_meeting_request_t*)em_core_malloc(sizeof(emf_meeting_request_t));
-                       if(result_meeting_request)
-                               em_convert_byte_stream_to_meeting_req(meeting_request_stream, result_meeting_request);
-               }
-       }
-
-       EM_DEBUG_LOG("sync_server");
-       memcpy(&sync_server, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, parameter_index++), sizeof(int));
-
-       if( (err = emf_add_mail(result_mail_data, result_attachment_data, result_attachment_data_count, result_meeting_request, sync_server)) != EMF_ERROR_NONE) {
-               EM_DEBUG_EXCEPTION("emf_add_mail failed [%d]", err);
-               goto FINISH_OFF;
-       }
-
-       local_result = 1;
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &(result_mail_data->mail_id), sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &(result_mail_data->thread_id), sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-       if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-               EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed");
-
-FINISH_OFF:
-       if ( local_result == 0 ) {
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-                       EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed");
-       }
-
-       EM_SAFE_FREE(mail_data_stream);
-       EM_SAFE_FREE(attachment_data_list_stream);
-       EM_SAFE_FREE(meeting_request_stream); 
-
-       if(result_mail_data)
-               em_core_free_mail_data(&result_mail_data, 1, NULL);
-
-       if(result_attachment_data)
-               em_core_free_attachment_data(&result_attachment_data, result_attachment_data_count, NULL);
-
-       if(result_meeting_request)
-               em_storage_free_meeting_request(&result_meeting_request, 1, NULL);
-
-       em_core_flush_memory();
-       EM_DEBUG_FUNC_END();
-}
-
-
-void stb_update_mail(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int  buffer_size = 0;
-       int  local_result = 0;
-       int  result_mail_data_count = 0;
-       int  result_attachment_data_count = 0;
-       int  parameter_index = 0;
-       int  sync_server = 0;
-       int  err = EMF_ERROR_NONE;
-       char *mail_data_stream = NULL;
-       char *attachment_data_list_stream = NULL;
-       char *meeting_request_stream = NULL;
-       char *parameter_data = NULL;
-       emf_mail_data_t *result_mail_data = NULL;
-       emf_attachment_data_t *result_attachment_data = NULL;
-       emf_meeting_request_t *result_meeting_request = NULL;
-
-       EM_DEBUG_LOG("emf_mail_data_t");
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, parameter_index);
-
-       if(buffer_size > 0)      {
-               mail_data_stream = (char*)em_core_malloc(buffer_size + 1);
-               if(!mail_data_stream) {
-                       err = EMF_ERROR_OUT_OF_MEMORY;
-                       goto FINISH_OFF;
-               }
-               parameter_data = ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, parameter_index++);
-
-               if(!parameter_data) {
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter failed");
-                       err = EMF_ERROR_ON_PARSING;
-                       goto FINISH_OFF;
-               }
-
-               memcpy(mail_data_stream, parameter_data, buffer_size);
-
-               em_convert_byte_stream_to_mail_data(mail_data_stream, &result_mail_data, &result_mail_data_count);
-               if(!result_mail_data) {
-                       EM_DEBUG_EXCEPTION("em_convert_byte_stream_to_mail_data failed");
-                       err = EMF_ERROR_ON_PARSING;
-                       goto FINISH_OFF;
-               }
-       }
-
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, parameter_index);
-       EM_DEBUG_LOG("emf_attachment_data_t buffer_size[%d]", buffer_size);
-
-       if(buffer_size > 0)      {
-               attachment_data_list_stream = (char*)em_core_malloc(buffer_size + 1);
-               if(!attachment_data_list_stream) {
-                       EM_DEBUG_EXCEPTION("em_core_malloc failed");
-                       err = EMF_ERROR_OUT_OF_MEMORY;
-                       goto FINISH_OFF;
-               }
-
-               parameter_data = ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, parameter_index++);
-
-               if(!parameter_data) {
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter failed");
-                       err = EMF_ERROR_ON_PARSING;
-                       goto FINISH_OFF;
-               }
-
-               memcpy(attachment_data_list_stream, parameter_data, buffer_size);
-
-               em_convert_byte_stream_to_attachment_data(attachment_data_list_stream, &result_attachment_data, &result_attachment_data_count);
-
-               EM_DEBUG_LOG("result_attachment_data_count[%d]", result_attachment_data_count);
-
-               if(result_attachment_data_count && !result_attachment_data) {
-                       EM_DEBUG_EXCEPTION("em_convert_byte_stream_to_attachment_data failed");
-                       err = EMF_ERROR_ON_PARSING;
-                       goto FINISH_OFF;
-               }
-       }
-
-       EM_DEBUG_LOG("emf_meeting_request_t");
-
-       if ( result_mail_data->meeting_request_status == EMF_MAIL_TYPE_MEETING_REQUEST
-               || result_mail_data->meeting_request_status == EMF_MAIL_TYPE_MEETING_RESPONSE
-               || result_mail_data->meeting_request_status == EMF_MAIL_TYPE_MEETING_ORIGINATINGREQUEST) {
-               buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, parameter_index);
-
-               if(buffer_size > 0) {
-                       meeting_request_stream = (char*)em_core_malloc(buffer_size + 1);
-                       if(!meeting_request_stream) {
-                               EM_DEBUG_EXCEPTION("em_convert_byte_stream_to_mail_data failed");
-                               err = EMF_ERROR_OUT_OF_MEMORY;
-                               goto FINISH_OFF;
-                       }
-                       parameter_data = ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, parameter_index++);
-
-                       if(!parameter_data) {
-                               EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter failed");
-                               err = EMF_ERROR_ON_PARSING;
-                               goto FINISH_OFF;
-                       }
-
-                       memcpy(meeting_request_stream, parameter_data, buffer_size);
-                       result_meeting_request = (emf_meeting_request_t*)em_core_malloc(sizeof(emf_meeting_request_t));
-                       if(result_meeting_request)
-                               em_convert_byte_stream_to_meeting_req(meeting_request_stream, result_meeting_request);
-               }
-       }
-
-       EM_DEBUG_LOG("sync_server");
-       memcpy(&sync_server, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, parameter_index++), sizeof(int));
-
-       if( (err = emf_update_mail(result_mail_data, result_attachment_data, result_attachment_data_count, result_meeting_request, sync_server)) != EMF_ERROR_NONE) {
-               EM_DEBUG_EXCEPTION("emf_update_mail failed [%d]", err);
-               goto FINISH_OFF;
-       }
-
-       local_result = 1;
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &(result_mail_data->mail_id), sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &(result_mail_data->thread_id), sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-       if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-               EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed");
-
-FINISH_OFF:
-       if ( local_result == 0 ) {
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-                       EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed");
-       }
-
-       EM_SAFE_FREE(mail_data_stream);
-       EM_SAFE_FREE(attachment_data_list_stream);
-       EM_SAFE_FREE(meeting_request_stream);
-
-       if(result_mail_data)
-               em_core_free_mail_data(&result_mail_data, 1, NULL);
-
-       if(result_attachment_data)
-               em_core_free_attachment_data(&result_attachment_data, result_attachment_data_count, NULL);
-
-       if(result_meeting_request)
-               em_storage_free_meeting_request(&result_meeting_request, 1, NULL);
-
-       em_core_flush_memory();
-       EM_DEBUG_FUNC_END();
-}
-
-
-void stb_move_thread_to_mailbox(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int buffer_size = 0, thread_id = 0, move_always_flag = 0;
-       int err = EMF_ERROR_NONE;
-       char *target_mailbox_name = NULL;
-
-       memcpy(&thread_id, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), sizeof(int));
-       EM_DEBUG_LOG("thread_id [%d]", thread_id);
-       
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 1);
-       EM_DEBUG_LOG("mailbox stream size [%d]", buffer_size);
-       
-       if(buffer_size > 0) {
-               target_mailbox_name = (char*)em_core_malloc(buffer_size + 1);
-               EM_NULL_CHECK_FOR_VOID(target_mailbox_name);
-               if(target_mailbox_name) {
-                       memcpy(target_mailbox_name, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 1), buffer_size);
-                       /* Convert Byte stream to mailbox structure */
-                       if (target_mailbox_name)
-                               EM_DEBUG_LOG("Mailbox name - %s", target_mailbox_name);
-                       else
-                               EM_DEBUG_EXCEPTION("Mailbox name is NULL");
-               }
-       }
-
-       memcpy(&move_always_flag, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 2), sizeof(int));
-       EM_DEBUG_LOG("move_always_flag [%d]", move_always_flag);
-       
-       if(emf_mail_move_thread_to_mailbox(thread_id, target_mailbox_name, move_always_flag, &err))
-               EM_DEBUG_LOG("emf_mail_move_thread_to_mailbox success");
-
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int))) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter fail");
-               EM_SAFE_FREE(target_mailbox_name);
-               return;
-       }
-
-       if (!ipcEmailStub_ExecuteAPI(a_hAPI)) {
-               EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI fail");
-               EM_SAFE_FREE(target_mailbox_name);
-               return;
-       }
-
-       EM_SAFE_FREE(target_mailbox_name);
-       EM_DEBUG_FUNC_END();
-}
-
-void stb_delete_thread(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       
-       int thread_id = 0, delete_always_flag = 0;
-       unsigned int handle = 0;
-       int err = EMF_ERROR_NONE;
-
-       memcpy(&thread_id, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), sizeof(int));
-       EM_DEBUG_LOG("thread_id [%d]", thread_id);
-
-       memcpy(&delete_always_flag, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 1), sizeof(int));
-       EM_DEBUG_LOG("delete_always_flag [%d]", delete_always_flag);
-       
-       if(emf_mail_delete_thread(thread_id, delete_always_flag, &handle, &err))
-               EM_DEBUG_LOG("emf_mail_delete_thread success");
-
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int))) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter fail");
-               return;
-       }
-
-       if (!ipcEmailStub_ExecuteAPI(a_hAPI)) {
-               EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI fail");
-               return;
-       }
-       EM_DEBUG_FUNC_END();
-}
-
-void stb_modify_seen_flag_of_thread(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       
-       int thread_id = 0, seen_flag = 0, on_server = 0;
-       unsigned int handle = 0;
-       int err = EMF_ERROR_NONE;
-
-       memcpy(&thread_id, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), sizeof(int));
-       EM_DEBUG_LOG("thread_id [%d]", thread_id);
-
-       memcpy(&seen_flag, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 1), sizeof(int));
-       EM_DEBUG_LOG("seen_flag [%d]", seen_flag);
-
-       memcpy(&on_server, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 2), sizeof(int));
-       EM_DEBUG_LOG("on_server [%d]", on_server);
-       
-       if(emf_mail_modify_seen_flag_of_thread(thread_id, seen_flag, on_server, &handle, &err))
-               EM_DEBUG_LOG("emf_mail_modify_seen_flag_of_thread success");
-
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int))) {
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter fail");
-               return;
-       }
-
-       if (!ipcEmailStub_ExecuteAPI(a_hAPI)) {
-               EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI fail");
-               return;
-       }
-       EM_DEBUG_FUNC_END();
-}
-
-
-void stb_mail_move(HIPC_API a_hAPI)
-{
-       int err = EMF_ERROR_NONE;
-       int buffer_size = 0, num = 0, counter = 0;
-       char *local_stream = NULL;
-       emf_mailbox_t mailbox;
-
-       /* Number of mail_ids */
-       memcpy(&num, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), sizeof(int));
-       EM_DEBUG_LOG("number of mails [%d]", num);
-
-       /* mail_id */
-       int mail_ids[num];      
-       memcpy(mail_ids, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 1), num * sizeof(int));
-       
-       for(counter = 0; counter < num; counter++)
-               EM_DEBUG_LOG("mailids [%d]", mail_ids[counter]);
-       
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 2);
-       EM_DEBUG_LOG("size [%d]", buffer_size);
-       
-       if(buffer_size > 0) {
-               local_stream = (char*)em_core_malloc(buffer_size+1);
-               EM_NULL_CHECK_FOR_VOID(local_stream);
-               if(local_stream) {
-                       memcpy(local_stream, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 2), buffer_size);
-                       em_convert_byte_stream_to_mailbox(local_stream, &mailbox);
-                       EM_SAFE_FREE(local_stream);
-                       
-                       if (mailbox.name)
-                               EM_DEBUG_LOG("mailbox.name [%s]", mailbox.name);
-                       else
-                               EM_DEBUG_EXCEPTION("mailbox.name is NULL");
-                       
-                       if(emf_mail_move(mail_ids, num, &mailbox, EMF_MOVED_BY_COMMAND, 0, &err))
-                               EM_DEBUG_LOG("emf_mail_move success");
-               }
-       }
-       
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter fail");
-       
-       if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-               EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI fail");
-       EM_DEBUG_FUNC_END();
-}
-
-void stb_rule_delete(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       
-       int filter_id = 0;
-       int err = EMF_ERROR_NONE;
-       
-       /* filter_id */
-       memcpy(&filter_id, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), sizeof(int));;
-       
-       if(emf_filter_delete(filter_id, &err))
-               err = EMF_ERROR_NONE;
-
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed ");
-                               
-       if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-               EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-       EM_DEBUG_FUNC_END();
-}
-
-void stb_mail_add_attachment(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int buffer_size = 0;
-       int err = EMF_ERROR_NONE;
-       char* local_stream = NULL;
-       emf_mailbox_t mailbox;
-       int mail_id = -1;
-       char* attachment_stream = NULL;
-       emf_attachment_info_t* attachment = NULL;
-
-       /* mailbox */
-       EM_DEBUG_LOG("mailbox");
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 0);
-
-       if(buffer_size > 0)      {
-               local_stream = (char*)em_core_malloc(buffer_size+1);
-               EM_NULL_CHECK_FOR_VOID(local_stream);
-               if(local_stream) {
-                       memcpy(local_stream, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), buffer_size);
-                       em_convert_byte_stream_to_mailbox(local_stream, &mailbox);
-                       EM_SAFE_FREE(local_stream);
-               }
-       }
-
-       /* mail_id */
-       memcpy(&mail_id, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 1), sizeof(int));
-
-       /* attachment */
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 2);
-
-       if(buffer_size > 0)      {
-               attachment_stream = (char*)em_core_malloc(buffer_size+1);
-               EM_NULL_CHECK_FOR_VOID(attachment_stream);
-               if(attachment_stream) {
-                       memcpy(attachment_stream, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 2), buffer_size);
-                       em_convert_byte_stream_to_attachment_info(attachment_stream, 1, &attachment);
-                       EM_SAFE_FREE(attachment_stream);
-               }
-       }
-
-       emf_mail_add_attachment(&mailbox, mail_id, attachment, &err);
-       
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter local_result failed ");
-       if(EMF_ERROR_NONE == err) {
-               EM_DEBUG_LOG("emf_mail_add_attachment -Success");
-               
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &(attachment->attachment_id), sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter attachment_id failed ");
-       }
-               if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-                       EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-
-       EM_SAFE_FREE(attachment);               
-       EM_DEBUG_FUNC_END();
-}
-
-void stb_mail_get_attachment(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int buffer_size = 0;
-       int err = EMF_ERROR_NONE;
-       char* local_stream = NULL;
-       emf_mailbox_t mailbox;
-       int mail_id = -1;
-       char* attachment_no = NULL;
-       char* attachment_stream = NULL;
-       emf_attachment_info_t* attachment = NULL;
-       int size = 0;
-
-       /* mailbox */
-       EM_DEBUG_LOG("mailbox");
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 0);
-
-       if(buffer_size > 0)      {
-               local_stream = (char*)em_core_malloc(buffer_size+1);
-               EM_NULL_CHECK_FOR_VOID(local_stream);
-               if(local_stream) {
-                       memcpy(local_stream, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), buffer_size);
-                       em_convert_byte_stream_to_mailbox(local_stream, &mailbox);
-                       EM_SAFE_FREE(local_stream);
-               }
-       }
-
-       /* mail_id */
-       memcpy(&mail_id, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 1), sizeof(int));
-
-       /* attachment_no */
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 2);
-       if(buffer_size > 0)      {
-               attachment_no = (char*)em_core_malloc(buffer_size+1);
-               if(attachment_no) {
-                       memcpy(attachment_no, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 2), buffer_size);
-               }
-       }
-       emf_mail_get_attachment(&mailbox, mail_id, attachment_no, &attachment, &err);
-
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter local_result failed ");
-       if(EMF_ERROR_NONE == err) {
-               EM_DEBUG_LOG("emf_mail_get_attachment - Success");
-               /* attachment */
-               attachment_stream = em_convert_attachment_info_to_byte_stream(attachment, &size);
-
-               EM_NULL_CHECK_FOR_VOID(attachment_stream);
-               
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, attachment_stream, size))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed  ");
-       }
-               if (!ipcEmailStub_ExecuteAPI(a_hAPI)) {
-                       EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-                       EM_SAFE_FREE(attachment_no);            
-                       EM_SAFE_FREE(attachment_stream); 
-                       return;
-               }
-
-       EM_SAFE_FREE(attachment_no);            
-       EM_SAFE_FREE(attachment_stream); 
-       EM_DEBUG_FUNC_END();
-}
-
-void stb_mailbox_get_imap_mailbox_list(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int err = EMF_ERROR_NONE;
-       int account_id = 0;
-       unsigned int handle = 0;  
-
-       /* account_id */
-       memcpy(&account_id, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), sizeof(int));
-
-       if(emf_mailbox_get_imap_mailbox_list(account_id, "", &handle, &err))
-               err = EMF_ERROR_NONE;
-               
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-               EM_DEBUG_LOG("ipcAPI_AddParameter local_result failed ");
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &handle, sizeof(int)))
-               EM_DEBUG_LOG("ipcAPI_AddParameter local_result failed ");
-       if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-               EM_DEBUG_LOG("ipcEmailStub_ExecuteAPI failed  ");
-       EM_DEBUG_FUNC_END();
-}
-
-void stb_mail_delete_attachment(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int buffer_size = 0;
-       int err = EMF_ERROR_NONE;
-       char* local_stream = NULL;
-       emf_mailbox_t mailbox;
-       int mail_id = -1;
-       char* attachment_no = NULL;
-
-       /* mailbox */
-       EM_DEBUG_LOG("mailbox");
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 0);
-
-       if(buffer_size > 0)      {
-               local_stream = (char*)em_core_malloc(buffer_size+1);
-               EM_NULL_CHECK_FOR_VOID(local_stream);
-               if(local_stream) {
-                       memcpy(local_stream, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), buffer_size);
-                       em_convert_byte_stream_to_mailbox(local_stream, &mailbox);
-                       EM_SAFE_FREE(local_stream);
-               }
-       }
-
-       /* mail_id */
-       memcpy(&mail_id, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 1), sizeof(int));
-
-       /* attachment_no */
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 2);
-       if(buffer_size > 0)      {
-               attachment_no = (char*)em_core_malloc(buffer_size+1);
-               if(attachment_no) {
-                       memcpy(attachment_no, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 2), buffer_size);
-               }
-       }
-
-       emf_mail_delete_attachment(&mailbox, mail_id, attachment_no, &err);
-       
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter local_result failed ");
-       if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-               EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-
-       EM_SAFE_FREE(attachment_no);            
-       EM_DEBUG_FUNC_END();
-}
-
-void stb_download_attachment(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       
-       int buffer_size = 0;
-       int err = EMF_ERROR_NONE;
-       char* local_stream = NULL;
-       emf_mailbox_t mailbox;
-       int mail_id = 0;
-       char *nth = NULL;
-       unsigned int handle = 0;  
-       
-       EM_DEBUG_LOG("mailbox");
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 0);
-
-       if(buffer_size > 0)      {
-               local_stream = (char*)em_core_malloc(buffer_size+1);
-               EM_NULL_CHECK_FOR_VOID(local_stream);
-               if(local_stream) {
-                       memcpy(local_stream, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), buffer_size);
-                       em_convert_byte_stream_to_mailbox(local_stream, &mailbox);
-                       EM_SAFE_FREE(local_stream);
-               }
-       }
-
-       EM_DEBUG_LOG("mail_id");
-       memcpy(&mail_id, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 1), sizeof(int));
-
-       /* nth */
-       EM_DEBUG_LOG("nth");
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 2);
-       if(buffer_size > 0)      {
-               nth = (char*)em_core_malloc(buffer_size+1);
-               if(nth) {
-                       memcpy(nth, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 2), buffer_size);
-               }
-       }
-
-       if(emf_mail_download_attachment(&mailbox, mail_id, nth, &handle, &err)) {
-               err = EMF_ERROR_NONE;
-
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed ");
-               EM_DEBUG_LOG(">>>>>>>>>> HANDLE = %d", handle);
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &handle, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter handle failed ");          
-               if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-                       EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-       }
-       else {
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed ");
-               /* Download handle - 17-Apr-09 */
-               EM_DEBUG_LOG(">>>>>>>>>> HANDLE = %d", handle);
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &handle, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter handle failed ");          
-               if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-                       EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-       }
-
-       EM_SAFE_FREE(nth);              
-       EM_DEBUG_FUNC_END();
-}
-
-void stb_get_info(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int buffer_size = 0;
-       int err = EMF_ERROR_NONE;
-       char* local_stream = NULL;
-       char* local_info_stream = NULL;
-       emf_mailbox_t mailbox = { 0 };
-       int mail_id = 0;
-       emf_mail_info_t* info = NULL;
-       int size =0;
-
-       EM_DEBUG_LOG("mailbox");
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 0);
-
-       if(buffer_size > 0)      {
-               local_stream = (char*)em_core_malloc(buffer_size+1);
-               EM_NULL_CHECK_FOR_VOID(local_stream);
-               if(local_stream) {
-                       memcpy(local_stream, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), buffer_size);
-                       em_convert_byte_stream_to_mailbox(local_stream, &mailbox);
-                       EM_SAFE_FREE(local_stream);
-               }
-       }
-
-       EM_DEBUG_LOG("mail_id");
-       memcpy(&mail_id, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 1), sizeof(int));
-
-       emf_mail_get_info(&mailbox, mail_id, &info, &err);
-
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed ");
-       if(EMF_ERROR_NONE == err) {
-               EM_DEBUG_LOG("emf_mail_get_info - success");            
-               /* Info */
-               EM_DEBUG_LOG("emf_mail_get_info - convert mail Info");
-               local_info_stream = em_convert_mail_info_to_byte_stream(info, &size);
-
-               EM_NULL_CHECK_FOR_VOID(local_info_stream);
-
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, local_info_stream, size))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed  ");
-       }
-       
-               if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-                       EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-
-       EM_SAFE_FREE(local_info_stream); 
-       EM_DEBUG_FUNC_END();
-}
-
-void stb_get_header_info(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int buffer_size = 0;
-       int err = EMF_ERROR_NONE;
-       char* local_stream = NULL;
-       emf_mailbox_t mailbox;
-       int mail_id = 0;
-       emf_mail_head_t* head = NULL;
-       int size =0;
-       char* local_head_stream = NULL;
-       
-       EM_DEBUG_LOG("mailbox");
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 0);
-
-       if(buffer_size > 0)      {
-               local_stream = (char*)em_core_malloc(buffer_size+1);
-               EM_NULL_CHECK_FOR_VOID(local_stream);
-               if(local_stream) {
-                       memcpy(local_stream, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), buffer_size);
-                       em_convert_byte_stream_to_mailbox(local_stream, &mailbox);
-                       EM_SAFE_FREE(local_stream);
-               }
-       }
-
-       EM_DEBUG_LOG("mail_id");
-       memcpy(&mail_id, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 1), sizeof(int));
-
-       emf_mail_get_head(&mailbox, mail_id, &head, &err);
-
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed ");
-               
-       if(EMF_ERROR_NONE == err) {
-               EM_DEBUG_LOG("success");                        
-               /* Head */
-               EM_DEBUG_LOG("convert mail head");
-               local_head_stream = em_convert_mail_head_to_byte_stream(head, &size);
-
-               EM_NULL_CHECK_FOR_VOID(local_head_stream);
-
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, local_head_stream, size))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-       }
-               if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-                       EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed");
-
-       EM_SAFE_FREE(local_head_stream);        
-       EM_DEBUG_FUNC_END();
-}
-
-void stb_get_mail_body_info(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int buffer_size = 0;
-       int err = EMF_ERROR_NONE;
-       char* local_stream = NULL;
-       char* local_body_stream = NULL;
-       emf_mailbox_t mailbox = { 0 };
-       emf_mail_body_t* body = NULL;
-       int size =0;
-       int mail_id = 0;
-       
-       EM_DEBUG_LOG("mailbox");
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 0);
-
-       if(buffer_size > 0)      {
-               local_stream = (char*)em_core_malloc(buffer_size+1);
-               EM_NULL_CHECK_FOR_VOID(local_stream);
-               if(local_stream) {
-                       memcpy(local_stream, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), buffer_size);
-                       em_convert_byte_stream_to_mailbox(local_stream, &mailbox);
-                       EM_SAFE_FREE(local_stream);
-               }
-       }
-
-       EM_DEBUG_LOG("mail_id");
-       memcpy(&mail_id, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 1), sizeof(int));
-
-       emf_mail_get_body(&mailbox, mail_id, &body, &err);
-
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter local_result failed ");
-
-       if(EMF_ERROR_NONE == err) {
-               EM_DEBUG_LOG("success");
-               /* Body */
-               EM_DEBUG_LOG("convert mail Body[%p]", body);
-
-               local_body_stream = em_convert_mail_body_to_byte_stream(body, &size);
-
-               /* EM_NULL_CHECK_FOR_VOID(local_body_stream); */
-               if ( !local_body_stream ) {
-                       EM_DEBUG_EXCEPTION("local_body_stream is NULL");
-               }
-               else {
-                       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, local_body_stream, size))
-                               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-               }
-       }       
-       
-       EM_DEBUG_LOG("Before ipcEmailStub_ExecuteAPI");
-       if (!ipcEmailStub_ExecuteAPI(a_hAPI)) {
-               EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-               EM_SAFE_FREE(local_body_stream); 
-               return;
-       }
-       
-       EM_SAFE_FREE(local_body_stream); 
-       EM_DEBUG_FUNC_END();
-}
-
-void stb_mail_send_saved(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int buffer_size = 0;
-       int err = EMF_ERROR_NONE;
-       char* local_option_stream = NULL;
-       emf_option_t sending_option;
-       int account_id = 0;
-       /* unsigned *handle = NULL; */
-       
-       /* account_id */
-       memcpy(&account_id, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), sizeof(int));
-       
-       /* Sending Option */
-       EM_DEBUG_LOG("Sending option");
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 1);
-
-       if(buffer_size > 0)  {
-               local_option_stream = (char*)em_core_malloc(buffer_size+1);
-               EM_NULL_CHECK_FOR_VOID(local_option_stream);
-               if(local_option_stream) {
-                       memcpy(local_option_stream, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 1), buffer_size);
-                       em_convert_byte_stream_to_option(local_option_stream, &sending_option);
-                       /* EM_SAFE_FREE(local_option_stream); */
-               }
-       }
-
-       EM_DEBUG_LOG("calling emf_mail_send_saved");
-       if(emf_mail_send_saved(account_id, &sending_option, NULL, &err))
-               err = EMF_ERROR_NONE;
-               
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter result failed ");
-               
-       if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-               EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-       EM_DEBUG_FUNC_END();
-}      
-
-void stb_mail_send_report(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       
-       int buffer_size = 0;
-       int err = EMF_ERROR_NONE;
-       char* local_mail_stream = NULL;
-       char* local_info_stream = NULL;
-       emf_mail_t  mail = { 0 };
-
-       /* head */
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 0);
-       EM_DEBUG_LOG("size [%d]", buffer_size);
-       
-       if(buffer_size > 0)      {
-               local_mail_stream = (char*)em_core_malloc(buffer_size+1);
-               if(local_mail_stream) {
-                       memcpy(local_mail_stream, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), buffer_size);
-                       /* Convert Byte stream to Mail Head structure */
-                       EM_DEBUG_LOG("Before em_convert_byte_stream_to_mail");
-                       mail.head = (emf_mail_head_t*)em_core_malloc(sizeof(emf_mail_head_t));
-                       /* EM_NULL_CHECK_FOR_VOID(mail.head); */
-                       if(NULL == mail.head)                    {
-                               EM_SAFE_FREE(local_mail_stream);
-                               return;
-                       }
-                       
-                       em_convert_byte_stream_to_mail_head(local_mail_stream, mail.head);
-                       EM_SAFE_FREE(local_mail_stream);
-               }
-       }
-
-       /* body */
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 1);
-       if(buffer_size > 0)      {
-               local_mail_stream = (char*)em_core_malloc(buffer_size+1);
-               EM_NULL_CHECK_FOR_VOID(local_mail_stream);
-               if(local_mail_stream) {
-                       memcpy(local_mail_stream, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 1), buffer_size);
-                       /* Convert Byte stream to Mail Body structure */
-                       EM_DEBUG_LOG("Before em_convert_byte_stream_to_mail");
-                       mail.body = (emf_mail_body_t*)em_core_malloc(sizeof(emf_mail_body_t));
-                       /* EM_NULL_CHECK_FOR_VOID(mail.body); */
-                       if(NULL == mail.body)                    {
-                               EM_SAFE_FREE(local_mail_stream);
-                               return;
-                       }
-                       
-                       em_convert_byte_stream_to_mail_body(local_mail_stream,  mail.body);
-                       EM_SAFE_FREE(local_mail_stream);
-               }
-       }       
-
-       /* info */
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 2);
-       if(buffer_size > 0)      {
-               local_info_stream = (char*)em_core_malloc(buffer_size+1);
-               EM_NULL_CHECK_FOR_VOID(local_info_stream);
-               if(local_info_stream) {
-                       memcpy(local_info_stream, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 2), buffer_size);
-                       /* Convert Byte stream to Mail Info structure */
-                       EM_DEBUG_LOG("Before em_convert_byte_stream_to_mail");
-                       mail.info = (emf_mail_info_t*)em_core_malloc(sizeof(emf_mail_info_t));
-                       /* EM_NULL_CHECK_FOR_VOID(mail.info); */
-
-                       if(NULL == mail.info)                    {
-                               EM_SAFE_FREE(local_info_stream);
-                               return;
-                       }
-                       
-                       em_convert_byte_stream_to_mail_info(local_info_stream,  mail.info);
-                       EM_SAFE_FREE(local_info_stream);
-               }
-       }       
-
-       if(emf_mail_send_report(&mail, NULL, &err))
-               err = EMF_ERROR_NONE;
-
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed ");
-                               
-       if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-               EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-
-       EM_SAFE_FREE(mail.head);
-       EM_SAFE_FREE(mail.info);
-       EM_SAFE_FREE(mail.body);        
-       EM_DEBUG_FUNC_END();
-}
-
-void stb_mail_send_retry(HIPC_API a_hAPI)
-{
-
-       EM_DEBUG_FUNC_BEGIN();
-       int mail_id = 0;
-       int timeout_in_sec = 0;
-       int err = EMF_ERROR_NONE;
-
-       /* Mail_id */
-       memcpy(&mail_id, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), sizeof(int));
-       EM_DEBUG_LOG("mail_id [%d]", mail_id);
-
-       /* timeout_in_sec */
-       memcpy(&timeout_in_sec, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 1), sizeof(int));
-       EM_DEBUG_LOG("mail_id [%d]", timeout_in_sec);
-
-       if(emf_mail_send_retry(mail_id, timeout_in_sec,&err))
-               EM_DEBUG_LOG("emf_mailbox_get_list - success"); 
-
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed ");
-                               
-               if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-                       EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-       EM_DEBUG_FUNC_END();
-}
-
-void stb_get_event_queue_status(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int on_sending = 0;
-       int on_receiving = 0;
-       
-       /*get the network status */
-       emf_get_event_queue_status(&on_sending, &on_receiving);
-       
-       /* on_sending */
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &on_sending, sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-
-       /* on_receving */
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &on_receiving, sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-
-       EM_DEBUG_LOG("stb_get_event_queue_status - Before Execute API");
-       if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-               EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed");
-
-       EM_DEBUG_FUNC_END();
-}
-
-void stb_cancel_job(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int account_id = 0;
-       int handle = 0;
-       int err = EMF_ERROR_NONE;
-
-       memcpy(&account_id, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), sizeof(int));
-       EM_DEBUG_LOG("account_id [%d]", account_id);
-
-       memcpy(&handle, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 1), sizeof(int));
-       EM_DEBUG_LOG("handle [%d]", handle);    
-
-       if(emf_cancel_job(account_id, handle, &err))
-               err = EMF_ERROR_NONE;
-
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter local_result failed ");
-       if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-               EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-       EM_DEBUG_FUNC_END();
-}
-
-void stb_get_pending_job(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       emf_action_t action = -1;
-       int account_id = 0;
-       int mail_id = -1;
-       int err = EMF_ERROR_NONE;
-       emf_event_status_type_t status = 0;
-
-       memcpy(&action, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), sizeof(int));
-       EM_DEBUG_LOG("action [%d]", action);
-
-       memcpy(&account_id, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 1), sizeof(int));
-       EM_DEBUG_LOG("account_id [%d]", account_id);
-
-       memcpy(&mail_id, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 2), sizeof(int));
-       EM_DEBUG_LOG("mail_id [%d]", mail_id);
-
-       if(emf_get_pending_job(action, account_id, mail_id, &status))
-               err = EMF_ERROR_NONE;
-       else
-               err = EMF_ERROR_UNKNOWN;
-
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter local_result failed ");
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &status, sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter status failed ");
-       if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-               EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-       EM_DEBUG_FUNC_END();
-}
-
-void stb_print_receiving_event_queue_via_debug_msg(HIPC_API a_hAPI)
-{
-       emf_event_t *event_queue = NULL;
-       int event_active_queue = 0, err, i;
-
-       em_core_get_receiving_event_queue(&event_queue, &event_active_queue, &err);     
-
-       EM_DEBUG_LOG("======================================================================");
-       EM_DEBUG_LOG("Event active index [%d]", event_active_queue);
-       EM_DEBUG_LOG("======================================================================");
-       for(i = 1; i < 32; i++)
-               EM_DEBUG_LOG("event[%d] : type[%d], account_id[%d], arg[%d], status[%d]", i, event_queue[i].type, event_queue[i].account_id, event_queue[i].event_param_data_4, event_queue[i].status);
-       EM_DEBUG_LOG("======================================================================");
-       EM_DEBUG_LOG("======================================================================");
-       
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed ");
-
-       if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-               EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed");
-       EM_DEBUG_FUNC_END();
-}
-
-void stb_send_mail_cancel_job(HIPC_API a_hAPI)
-{
-
-       EM_DEBUG_FUNC_BEGIN();
-       int mail_id = 0;
-       int err = EMF_ERROR_NONE;
-       int account_id = 0;
-
-
-       /* account_id */
-       memcpy(&account_id, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), sizeof(int));
-       EM_DEBUG_LOG("account_id [%d]", account_id);
-
-       
-       /* Mail_id */
-       memcpy(&mail_id, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 1), sizeof(int));
-       EM_DEBUG_LOG("mail_id [%d]", mail_id);
-
-
-       if(emf_mail_send_mail_cancel_job(account_id,mail_id,&err))
-               EM_DEBUG_LOG("success");                
-
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
-                               
-               if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-                       EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed");
-       EM_DEBUG_FUNC_END();
-}
-
-void stb_find_mail_on_server(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       EM_DEBUG_FUNC_END();
-}
-
-void stb_account_create_with_validation(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int buffer_size = 0;
-       int local_result = 0;
-       unsigned int handle = 0;  
-       char* local_account_stream = NULL;
-       emf_account_t *account;
-       int err = EMF_ERROR_NONE;
-
-       buffer_size = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 0);
-       EM_DEBUG_LOG("size [%d]", buffer_size);
-
-       if(buffer_size > 0)      {
-               local_account_stream = (char*)em_core_malloc(buffer_size+1);
-               if(local_account_stream) {
-                       memcpy(local_account_stream, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), buffer_size);
-                       /* Convert account stream to structure */
-                       EM_DEBUG_LOG("Before Convert_ByteStream_To_Account");
-                       
-                       account = em_core_account_get_new_account_ref(); 
-                       em_convert_byte_stream_to_account(local_account_stream, account);
-                       EM_SAFE_FREE(local_account_stream);
-               
-                       account->account_id = NEW_ACCOUNT_ID;
-
-                       if (account->account_name)
-                               EM_DEBUG_LOG("Account name - %s", account->account_name);
-                       if(account->email_addr)
-                               EM_DEBUG_LOG("Email Address - %s", account->email_addr);
-               
-                       if(emf_account_validate_and_create(account, &handle, &err)) {   
-                               
-#ifdef __FEATURE_AUTO_POLLING__
-                               /*  start auto polling, if check_interval not zero */
-                               if(account->check_interval > 0) {
-                                       if(!emf_add_polling_alarm( account->account_id,account->check_interval))
-                                               EM_DEBUG_EXCEPTION("emf_add_polling_alarm[NOTI_ACCOUNT_ADD] : start auto poll failed >>> ");
-                               }
-#endif /*  __FEATURE_AUTO_POLLING__ */
-                               /*  add account details to contact DB  */
-                               /*  emf_account_insert_accountinfo_to_contact(account); */
-
-                               local_result = 1;
-                               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &local_result, sizeof(int)))
-                                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed ");         
-                               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &handle, sizeof(int)))
-                                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed ");
-                               if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-                                       EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-                               }
-                       else {
-                               EM_DEBUG_EXCEPTION("emf_account_validate_and_create fail ");
-                               goto FINISH_OFF;
-                       }
-               }
-               else {
-                       err = EMF_ERROR_INVALID_PARAM;
-                       goto FINISH_OFF;
-               }
-       }       
-       else {
-               err = EMF_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-FINISH_OFF:
-       if ( local_result == 0 ) {                      
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &local_result, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed : local_result ");
-               if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed : err");
-               if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-                       EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-       }
-       EM_DEBUG_FUNC_END();
-}
-
-void stb_account_backup(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-
-#ifdef __FEATURE_BACKUP_ACCOUNT__      
-       char *file_path = NULL;
-       int local_result = 0, err_code = 0, handle = 0, file_path_length = 0;
-       
-       /* file_path_length */
-       file_path_length = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 0);
-       if(file_path_length > 0) {
-               EM_DEBUG_LOG("file_path_length [%d]", file_path_length);
-               file_path = em_core_malloc(file_path_length + 1);
-               memcpy(file_path, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), file_path_length);;
-               EM_DEBUG_LOG("file_path [%s]", file_path);
-               local_result = em_core_backup_accounts((const char*)file_path, &err_code);
-       }
-
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &local_result, sizeof(int)))
-               EM_DEBUG_LOG("ipcEmailAPI_AddParameter failed ");
-
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err_code, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed ");
-                               
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &handle, sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter result failed ");
-                               
-       if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-               EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-
-       EM_SAFE_FREE(file_path);
-#endif /*  __FEATURE_BACKUP_ACCOUNT__ */
-       EM_DEBUG_FUNC_END();
-}
-
-void stb_account_restore(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-#ifdef __FEATURE_BACKUP_ACCOUNT__
-       char *file_path = NULL;
-       int local_result = 0, err_code = 0, handle = 0, file_path_length = 0;
-       
-       /* file_path_length */
-       file_path_length = ipcEmailAPI_GetParameterLength(a_hAPI, ePARAMETER_IN, 0);
-       if(file_path_length > 0)  {
-               EM_DEBUG_LOG("file_path_length [%d]", file_path_length);
-               file_path = em_core_malloc(file_path_length + 1);
-               memcpy(file_path, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), file_path_length);
-               EM_DEBUG_LOG("file_path [%s]", file_path);
-               local_result = em_core_restore_accounts((const char*)file_path, &err_code);
-       }
-
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &local_result, sizeof(int)))
-               EM_DEBUG_LOG("ipcEmailAPI_AddParameter failed ");
-
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err_code, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed ");
-                               
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &handle, sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter result failed ");
-                               
-       if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-               EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-
-       EM_SAFE_FREE(file_path);
-#endif /*  __FEATURE_BACKUP_ACCOUNT__ */
-       EM_DEBUG_FUNC_END();
-}
-
-
-void stb_account_get_password_length(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int account_id = 0;
-       int local_result = 0;
-       int err_code = 0;
-       int password_length = 0;
-       
-       /* account_id */
-       memcpy(&account_id, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), sizeof(int));;
-       local_result = em_storage_get_password_length_of_account(account_id, &password_length,&err_code);
-
-       EM_DEBUG_LOG("password_length [%d]", password_length);
-
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &local_result, sizeof(int)))
-               EM_DEBUG_LOG("ipcEmailAPI_AddParameter failed ");
-
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err_code, sizeof(int)))
-                       EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed ");
-                               
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &password_length, sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter result failed ");
-                               
-       if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-               EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  ");
-       EM_DEBUG_FUNC_END();
-}
-
-
-void stb_ping_service(HIPC_API a_hAPI)
-{
-       int err = EMF_ERROR_NONE;
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed ");
-
-       if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-               EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  "); 
-       EM_DEBUG_FUNC_END();
-}
-
-void stb_update_notification_bar_for_unread_mail(HIPC_API a_hAPI)
-{
-       int err = EMF_ERROR_NONE, account_id;
-
-       /* account_id */
-       memcpy(&account_id, ipcEmailAPI_GetParameter(a_hAPI, ePARAMETER_IN, 0), sizeof(int));
-       EM_DEBUG_LOG("account_id [%d]", account_id);
-
-       if(!em_core_finalize_sync(account_id, &err)) {
-               EM_DEBUG_EXCEPTION("em_core_finalize_sync failed [%d]", err);
-       }
-
-       if(!ipcEmailAPI_AddParameter(a_hAPI, ePARAMETER_OUT, &err, sizeof(int)))
-               EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed ");
-
-       if (!ipcEmailStub_ExecuteAPI(a_hAPI))
-               EM_DEBUG_EXCEPTION("ipcEmailStub_ExecuteAPI failed  "); 
-       EM_DEBUG_FUNC_END();
-}
-
-
-void stb_API_mapper(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       int nAPIID = ipcEmailAPI_GetAPIID(a_hAPI);
-       
-       switch(nAPIID) {
-               case _EMAIL_API_ADD_ACCOUNT:
-                       stb_account_create(a_hAPI);
-                       break;
-
-               case _EMAIL_API_ADD_MAIL_OLD:
-                       stb_mail_save_to_mailbox(a_hAPI);
-                       break;
-
-               case _EMAIL_API_GET_MAIL:
-                       stb_mail_get_mail(a_hAPI);
-                       break;
-
-               case _EMAIL_API_ADD_MAILBOX:
-                       stb_mailbox_create(a_hAPI);
-                       break;
-
-               case _EMAIL_API_DELETE_MAILBOX:
-                       stb_mailbox_delete(a_hAPI);
-                       break;
-               case _EMAIL_API_UPDATE_MAILBOX:
-                       stb_mailbox_update(a_hAPI);
-                       break;
-
-               case _EMAIL_API_SET_MAIL_SLOT_SIZE:
-                       stb_mailbox_set_mail_slot_size(a_hAPI);
-                       break;
-
-               case _EMAIL_API_SEND_MAIL:
-                       stb_mail_send(a_hAPI);
-                       break;
-               
-               case _EMAIL_API_GET_MAILBOX_COUNT:
-                       stb_mail_get_mailbox_count(a_hAPI);
-                       break;
-
-               case _EMAIL_API_GET_MAILBOX_LIST:
-                       stb_mailbox_get_list(a_hAPI);
-                       break;
-
-               case _EMAIL_API_GET_SUBMAILBOX_LIST:
-                       break;
-                       
-               case _EMAIL_API_SYNC_HEADER:
-                       stb_mailbox_sync_header(a_hAPI);
-                       break;
-                       
-               case _EMAIL_API_DOWNLOAD_BODY:
-                       stb_mailbox_download_body(a_hAPI);
-                       break;
-
-               case _EMAIL_API_CLEAR_DATA:
-                       stb_clear_mail_data (a_hAPI);
-                       break;
-                       
-               case _EMAIL_API_UPDATE_MAIL_OLD:
-                       stb_update_mail_old(a_hAPI);
-                       break;
-                       
-               case _EMAIL_API_DELETE_ALL_MAIL:
-                       stb_mail_delete_all(a_hAPI);
-                       break;
-                       
-               case _EMAIL_API_DELETE_MAIL:
-                       stb_mail_delete(a_hAPI);
-                       break;
-
-               case _EMAIL_API_MODIFY_MAIL_FLAG:
-                       stb_modify_mail_flag(a_hAPI);
-                       break;
-
-               case _EMAIL_API_MODIFY_MAIL_EXTRA_FLAG:
-                       stb_modify_mail_extra_flag(a_hAPI);
-                       break;          
-
-               case _EMAIL_API_ADD_RULE:
-                       stb_rule_add(a_hAPI);
-                       break;
-
-               case _EMAIL_API_GET_RULE:
-                       stb_rule_get(a_hAPI);
-                       break;
-
-               case _EMAIL_API_GET_RULE_LIST:
-                       stb_rule_get_list(a_hAPI);
-                       break;
-
-               case _EMAIL_API_FIND_RULE:
-                       stb_rule_find(a_hAPI);
-                       break;
-
-               case _EMAIL_API_UPDATE_RULE:
-                       stb_rule_change(a_hAPI);
-                       break;
-                       
-               case _EMAIL_API_DELETE_RULE:
-                       stb_rule_delete(a_hAPI);
-                       break;
-
-               case _EMAIL_API_MOVE_MAIL:
-                       stb_mail_move(a_hAPI);
-                       break;
-
-               case _EMAIL_API_MOVE_ALL_MAIL:
-                       stb_mail_move_all_mails(a_hAPI);
-                       break;  
-
-               case _EMAIL_API_SET_FLAGS_FIELD:
-                       stb_set_flags_field(a_hAPI);
-                       break;
-
-               case _EMAIL_API_ADD_MAIL:
-                       stb_add_mail(a_hAPI);
-                       break;
-
-               case _EMAIL_API_UPDATE_MAIL:
-                       stb_update_mail(a_hAPI);
-                       break;
-
-               case _EMAIL_API_MOVE_THREAD_TO_MAILBOX:
-                       stb_move_thread_to_mailbox(a_hAPI);
-                       break;
-
-               case _EMAIL_API_DELETE_THREAD:
-                       stb_delete_thread(a_hAPI);
-                       break;
-
-               case _EMAIL_API_MODIFY_SEEN_FLAG_OF_THREAD:
-                       stb_modify_seen_flag_of_thread(a_hAPI);
-                       break;
-
-               case _EMAIL_API_DELETE_ACCOUNT:
-                       stb_account_delete(a_hAPI);
-                       break;
-
-               case _EMAIL_API_UPDATE_ACCOUNT:
-                       stb_account_update(a_hAPI);
-                       break;
-
-               case _EMAIL_API_ADD_ATTACHMENT:
-                       stb_mail_add_attachment(a_hAPI);
-                       break;
-
-               case _EMAIL_API_GET_IMAP_MAILBOX_LIST:
-                       stb_mailbox_get_imap_mailbox_list(a_hAPI);
-                       break;
-                       
-               case _EMAIL_API_GET_ATTACHMENT:
-                       stb_mail_get_attachment(a_hAPI);
-                       break;
-
-               case _EMAIL_API_DELETE_ATTACHMENT:
-                       stb_mail_delete_attachment(a_hAPI);
-                       break;
-
-               case _EMAIL_API_DOWNLOAD_ATTACHMENT:
-                       stb_download_attachment(a_hAPI);
-                       break;
-
-               case _EMAIL_API_GET_INFO:
-                       stb_get_info(a_hAPI);
-                       break;
-
-               case _EMAIL_API_GET_HEADER_INFO:
-                       stb_get_header_info(a_hAPI);
-                       break;
-
-               case _EMAIL_API_GET_BODY_INFO:
-                       stb_get_mail_body_info(a_hAPI);
-                       break;
-
-               case _EMAIL_API_GET_ACCOUNT_LIST:
-                       stb_account_get_list(a_hAPI);
-                       break;
-
-               case _EMAIL_API_MAIL_SEND_SAVED:
-                       stb_mail_send_saved(a_hAPI);
-                       break;
-
-               case _EMAIL_API_MAIL_SEND_REPORT:
-                       stb_mail_send_report(a_hAPI);
-                       break;
-
-               case _EMAIL_API_CANCEL_JOB:
-                       stb_cancel_job(a_hAPI);
-                       break;
-
-               case _EMAIL_API_GET_PENDING_JOB:
-                       stb_get_pending_job(a_hAPI);
-                       break;
-
-               case _EMAIL_API_NETWORK_GET_STATUS:
-                       stb_get_event_queue_status(a_hAPI);
-                       break;
-
-               case _EMAIL_API_SEND_RETRY:
-                       stb_mail_send_retry(a_hAPI);
-                       break;
-
-               case _EMAIL_API_VALIDATE_ACCOUNT :
-                       stb_account_validate(a_hAPI);
-                       break;
-
-               case _EMAIL_API_SEND_MAIL_CANCEL_JOB :
-                       stb_send_mail_cancel_job(a_hAPI);
-                       break;
-
-               case _EMAIL_API_FIND_MAIL_ON_SERVER :
-                       stb_find_mail_on_server(a_hAPI);
-                       break;
-
-               case _EMAIL_API_ADD_ACCOUNT_WITH_VALIDATION :
-                       stb_account_create_with_validation(a_hAPI);
-                       break;
-
-               case _EMAIL_API_BACKUP_ACCOUNTS:
-                       stb_account_backup(a_hAPI);
-                       break;
-
-               case _EMAIL_API_RESTORE_ACCOUNTS:
-                       stb_account_restore(a_hAPI);
-                       break;
-               
-               case _EMAIL_API_GET_PASSWORD_LENGTH_OF_ACCOUNT:
-                       stb_account_get_password_length(a_hAPI);
-                       break;
-
-               case _EMAIL_API_PRINT_RECEIVING_EVENT_QUEUE :
-                       stb_print_receiving_event_queue_via_debug_msg(a_hAPI);
-                       break;
-               
-               case _EMAIL_API_PING_SERVICE :
-                       stb_ping_service(a_hAPI);
-                       break;
-
-               case _EMAIL_API_UPDATE_NOTIFICATION_BAR_FOR_UNREAD_MAIL :
-                       stb_update_notification_bar_for_unread_mail(a_hAPI);
-                       break;
-       }
-       EM_DEBUG_FUNC_END();
-}
-
-
-
-
-void hibernation_enter_callback()
-{
-       EM_DEBUG_FUNC_BEGIN();
-       em_storage_db_close(NULL);
-       EM_DEBUG_FUNC_END();
-}
-
-void hibernation_leave_callback()
-{
-       EM_DEBUG_FUNC_BEGIN();
-       em_storage_db_open(NULL);
-       EM_DEBUG_FUNC_END();
-}
-
-EXPORT_API int main(int argc, char *argv[])
-{
-       /* Do the Email Engine Initialization 
-       1. Create all DB tables and load the email engine */
-       EM_DEBUG_LOG("Email service begin");
-       int err = 0, ret;
-
-       signal(SIGPIPE, SIG_IGN); /*  to ignore signal 13(SIGPIPE) */
-
-       emf_init(&err);
-       EM_DEBUG_LOG("emf_emn_noti_init Start");
-#ifdef USE_OMA_EMN
-       emf_emn_noti_init();
-#endif
-
-       EM_DEBUG_LOG("ipcEmailStub_Initialize Start");
-       
-       ret = ipcEmailStub_Initialize(stb_API_mapper);
-
-       if(ret == true)
-               EM_DEBUG_LOG("ipcEmailStub_Initialize Success");
-       else
-               EM_DEBUG_EXCEPTION("ipcEmailStub_Initialize failed");
-
-       /* Start auto polling */
-#ifdef __FEATURE_AUTO_POLLING__
-       emf_auto_polling(&err);
-#endif
-
-       int fd_HibernationNoti;
-
-    fd_HibernationNoti = heynoti_init();
-
-    if(fd_HibernationNoti == -1)
-       EM_DEBUG_EXCEPTION("heynoti_init failed");
-    else        {      
-               EM_DEBUG_LOG("heynoti_init Success");
-               ret = heynoti_subscribe(fd_HibernationNoti, "HIBERNATION_ENTER", hibernation_enter_callback, (void *)fd_HibernationNoti);
-               EM_DEBUG_LOG("heynoti_subscribe returns %d", ret);
-           ret = heynoti_subscribe(fd_HibernationNoti, "HIBERNATION_LEAVE", hibernation_leave_callback, (void *)fd_HibernationNoti);
-           EM_DEBUG_LOG("heynoti_subscribe returns %d", ret);
-               ret = heynoti_attach_handler(fd_HibernationNoti);
-               EM_DEBUG_LOG("heynoti_attach_handler returns %d", ret);
-       }
-       
-       GMainLoop *mainloop;
-
-       mainloop = g_main_loop_new (NULL, 0);
-
-       g_type_init();
-
-       g_main_loop_run (mainloop);
-
-       if(fd_HibernationNoti != -1) {
-               heynoti_unsubscribe(fd_HibernationNoti, "HIBERNATION_ENTER", hibernation_enter_callback);
-               heynoti_unsubscribe(fd_HibernationNoti, "HIBERNATION_LEAVE", hibernation_leave_callback);
-               heynoti_close(fd_HibernationNoti);
-       }
-       
-       EM_DEBUG_FUNC_END();
-       return 0;
-}
-
diff --git a/email-ipc/CMakeLists.txt b/email-ipc/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..2962ba5
--- /dev/null
@@ -0,0 +1,78 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(email-ipc)
+
+SET(CMAKE_SKIP_BUILD_RPATH TRUE)
+
+IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+       SET(CMAKE_BUILD_TYPE "Debug")
+ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+
+MESSAGE("")
+MESSAGE(">>> current directory: ${CMAKE_CURRENT_SOURCE_DIR}")
+MESSAGE(">>> Build type: ${CMAKE_BUILD_TYPE}")
+
+#SET(VISIBILITY "-DEXPORT_API=\"__attribute__((visibility(\\\"default\\\")))\"")
+#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${VISIBILITY} -fvisibility=hidden")
+#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VISIBILITY} -fvisibility=hidden")
+
+SET(IPC-LIB "email-ipc")
+SET(IPC-SRCS 
+       ${CMAKE_SOURCE_DIR}/email-ipc/email-ipc-api.c
+       ${CMAKE_SOURCE_DIR}/email-ipc/email-ipc-build.c
+       ${CMAKE_SOURCE_DIR}/email-ipc/email-ipc-proxy.c
+       ${CMAKE_SOURCE_DIR}/email-ipc/email-ipc-stub.c
+       ${CMAKE_SOURCE_DIR}/email-ipc/email-ipc-api/email-ipc-api-info.c
+       ${CMAKE_SOURCE_DIR}/email-ipc/email-ipc-api/email-ipc-param.c
+       ${CMAKE_SOURCE_DIR}/email-ipc/email-ipc-api/email-ipc-param-list.c
+#      ${CMAKE_SOURCE_DIR}/email-ipc/email-common/email-common-list.c
+#      ${CMAKE_SOURCE_DIR}/email-ipc/email-common/email-common-msg-queue.c
+       ${CMAKE_SOURCE_DIR}/email-ipc/email-proxy/email-proxy-callback-info.c
+       ${CMAKE_SOURCE_DIR}/email-ipc/email-proxy/email-proxy-main.c
+       ${CMAKE_SOURCE_DIR}/email-ipc/email-proxy/email-proxy-socket.c
+       ${CMAKE_SOURCE_DIR}/email-ipc/email-socket/email-ipc-socket.c
+       ${CMAKE_SOURCE_DIR}/email-ipc/email-stub/email-stub-queue.c
+       ${CMAKE_SOURCE_DIR}/email-ipc/email-stub/email-stub-response-info.c
+       ${CMAKE_SOURCE_DIR}/email-ipc/email-stub/email-stub-main.c
+       ${CMAKE_SOURCE_DIR}/email-ipc/email-stub/email-stub-socket.c
+       ${CMAKE_SOURCE_DIR}/email-ipc/email-stub/email-stub-task.c
+       ${CMAKE_SOURCE_DIR}/email-ipc/email-stub/email-stub-task-manager.c
+)
+
+INCLUDE_DIRECTORIES(
+       ${CMAKE_SOURCE_DIR}/email-daemon/include
+       ${CMAKE_SOURCE_DIR}/email-ipc/include
+       ${CMAKE_SOURCE_DIR}/email-ipc/email-proxy/include
+       ${CMAKE_SOURCE_DIR}/email-ipc/email-stub/include
+#      ${CMAKE_SOURCE_DIR}/email-ipc/email-common/include
+       ${CMAKE_SOURCE_DIR}/email-ipc/email-socket/include
+       ${CMAKE_SOURCE_DIR}/email-ipc/email-ipc-api/include
+       ${CMAKE_SOURCE_DIR}/email-common-use/include
+       ${CMAKE_SOURCE_DIR}/email-api/include
+)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(ipc_pkgs REQUIRED dlog glib-2.0)
+
+FOREACH(flag ${ipc_pkgs_CFLAGS})
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS}")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+#message("***cmake_c_flags ${CMAKE_C_FLAGS}")
+#message("***extra_cflags ${EXTRA_CFLAGS}")
+#message("***base_pkgs_cflags ${base_pkgs_CFLAGS}")
+#message("***result ${CMAKE_CXX_FLAGS}")
+
+
+ADD_DEFINITIONS("-DBRSDK_VER=\"2\"")
+
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
+
+ADD_LIBRARY(${IPC-LIB} SHARED ${IPC-SRCS})
+TARGET_LINK_LIBRARIES(${IPC-LIB} ${ipc_pkgs_LDFLAGS} email-common-use pthread)
+SET_TARGET_PROPERTIES(${IPC-LIB} PROPERTIES SOVERSION ${VERSION_MAJOR})
+SET_TARGET_PROPERTIES(${IPC-LIB} PROPERTIES VERSION ${VERSION})
+
+INSTALL(TARGETS ${IPC-LIB} DESTINATION lib COMPONENT RuntimeLibraries)
+
diff --git a/email-ipc/cscope.files b/email-ipc/cscope.files
new file mode 100644 (file)
index 0000000..23443ab
--- /dev/null
@@ -0,0 +1,36 @@
+./email-socket/include/email-ipc-socket.h
+./email-socket/email-ipc-socket.c
+./include/email-ipc-build.h
+./include/email-ipc.h
+./email-stub/email-stub-main.c
+./email-stub/include/email-stub-task-manager.h
+./email-stub/include/email-stub-task.h
+./email-stub/include/email-stub-queue.h
+./email-stub/include/email-stub-response-info.h
+./email-stub/include/email-stub-socket.h
+./email-stub/include/email-stub-main.h
+./email-stub/email-stub-queue.c
+./email-stub/email-stub-task-manager.c
+./email-stub/email-stub-response-info.c
+./email-stub/email-stub-socket.c
+./email-stub/email-stub-task.c
+./email-ipc-build.c
+./email-common/include/email-common-msg-queue.h
+./email-common/include/email-common-list.h
+./email-common/email-common-list.c
+./email-common/email-common-msg-queue.c
+./email-proxy/email-proxy-callback-info.c
+./email-proxy/include/email-proxy-main.h
+./email-proxy/include/email-proxy-callback-info.h
+./email-proxy/include/email-proxy-socket.h
+./email-proxy/email-proxy-main.c
+./email-proxy/email-proxy-socket.c
+./email-ipc-stub.c
+./email-ipc-api/email-ipc-param.c
+./email-ipc-api/include/email-ipc-api-info.h
+./email-ipc-api/include/email-ipc-param-list.h
+./email-ipc-api/include/email-ipc-param.h
+./email-ipc-api/email-ipc-api-info.c
+./email-ipc-api/email-ipc-param-list.c
+./email-ipc-api.c
+./email-ipc-proxy.c
diff --git a/email-ipc/cscope.out b/email-ipc/cscope.out
new file mode 100644 (file)
index 0000000..2e25b91
--- /dev/null
@@ -0,0 +1,78905 @@
+cscope 15 $HOME/myfolder/git/private/api/email-service/email-ipc               0000459104
+       @email-common/email-common-list.c
+
+23 \ 2
+       ~<¡dio.h
+>
+
+24 \ 2
+       ~<m®loc.h
+>
+
+26 \ 2
+       ~"ema\9e-commÚ-li¡.h
+"
+
+27 \ 2
+       ~"ema\9e-¡ub-queue.h
+"
+
+28 \ 2
+       ~"ema\9e-\9dc-bu\9ed.h
+"
+
+30 \ 2
+       ~"ema\9e-debug-log.h
+"
+
+32 \18
+em\9dc_ema\9e_queue_\99em
+ *
+       gh\97d
+;
+
+33 \18
+em\9dc_ema\9e_queue_\99em
+ *
+       g\8f\9e
+;
+
+34 \18\12
+       gcouÁ
+ = -1;
+
+36 
+EXPORT_API
+boÞ
+       $emcm_\9a\99_li¡
+()
+
+38 
+h\97d
+ = (
+em\9dc_ema\9e_queue_\99em
+ *)
+       `m®loc
+(\17(emipc_email_queue_item));
+
+39 ià(
+h\97d
+ =ð
+NULL
+) {
+
+40 
+       `EM_DEBUG_EXCEPTION
+("Malloc failed.");
+
+41 \15 
+çl£
+;
+
+43 
+       `mem£t
+(
+h\97d
+, 0x00, \17(
+em\9dc_ema\9e_queue_\99em
+));
+
+45 
+\8f\9e
+ = (
+em\9dc_ema\9e_queue_\99em
+ *)
+       `m®loc
+(\17(emipc_email_queue_item));
+
+46 ià(
+\8f\9e
+ =ð
+NULL
+) {
+
+47 
+       `EM_DEBUG_EXCEPTION
+("Malloc failed.");
+
+48 \15 
+çl£
+;
+
+50 
+       `mem£t
+(
+\8f\9e
+, 0x00, \17(
+em\9dc_ema\9e_queue_\99em
+));
+
+52 
+couÁ
+ = 0;
+
+54 \15 
+\8cue
+;
+
+55 
+       }
+}
+
+57 
+EXPORT_API
\1e
+       $emcm_ä\93_li¡
+()
+
+59 
+       `EM_SAFE_FREE
+(
+h\97d
+);
+
+60 
+       `EM_SAFE_FREE
+(
+\8f\9e
+);
+
+61 
+       }
+}
+
+63 
+EXPORT_API
+boÞ
+       $emcm_add_\8f\9e_of_li¡
+(\1e*
+d©a
+)
+
+65 
+em\9dc_ema\9e_queue_\99em
+ *
+Ãw_\99em
+ = 
+NULL
+;
+
+67 ià(!
+d©a
+)
+
+68 \15 
+çl£
+;
+
+70 
+Ãw_\99em
+ = (
+em\9dc_ema\9e_queue_\99em
+ *)
+       `m®loc
+(\17(emipc_email_queue_item));
+
+71 ià(
+Ãw_\99em
+ =ð
+NULL
+) {
+
+72 
+       `EM_DEBUG_EXCEPTION
+("Malloc failed.");
+
+73 \15 
+çl£
+;
+
+75 
+       `mem£t
+(
+Ãw_\99em
+, 0x00, \17(
+em\9dc_ema\9e_queue_\99em
+));
+
+77 
+Ãw_\99em
+->
+d©a
+ = data;
+
+79 ià(
+\8f\9e
+) {
+
+80 
+\8f\9e
+->
+Ãxt
+ = 
+Ãw_\99em
+;
+
+81 
+\8f\9e
+ = 
+Ãw_\99em
+;
+
+83 
+h\97d
+ = 
+\8f\9e
+ = 
+Ãw_\99em
+;
+
+86 
+couÁ
+++;
+
+88 \15 
+\8cue
+;
+
+89 
+       }
+}
+
+91 
+EXPORT_API
+boÞ
+       $emcm_»move_\99em_of_li¡
+(\1e*
+d©a
+)
+
+93 \12
+\9adex
+ = 0;
+
+94 
+em\9dc_ema\9e_queue_\99em
+ *
+tmp_\99em
+ = 
+h\97d
+;
+
+95 
+em\9dc_ema\9e_queue_\99em
+ *
+´e_\99em
+ = 
+NULL
+;
+
+97 ià(
+h\97d
+) {
+
+98 \ f
+\9adex
+ = 0; index < 
+couÁ
+; index++) {
+
+99 ià(
+tmp_\99em
+->
+d©a
+ == data) {
+
+100 ià(
+´e_\99em
+) {
+
+101 
+´e_\99em
+->
+Ãxt
+ = 
+tmp_\99em
+->next;
+
+103 ià(
+tmp_\99em
+->
+Ãxt
+ =ð
+NULL
+)
+
+104 
+\8f\9e
+ = 
+´e_\99em
+;
+
+106 
+h\97d
+ = h\97d->
+Ãxt
+;
+
+108 ià(
+h\97d
+ =ð
+NULL
+)
+
+109 
+\8f\9e
+ = 
+NULL
+;
+
+112 
+       `EM_SAFE_FREE
+(
+tmp_\99em
+);
+
+113 
+couÁ
+--;
+
+114 \15 
+\8cue
+;
+
+116 
+´e_\99em
+ = 
+tmp_\99em
+;
+
+117 
+tmp_\99em
+ =\81mp_\99em->
+Ãxt
+;
+
+120 \15 
+çl£
+;
+
+121 
+       }
+}
+
+123 
+EXPORT_API
\1e*
+       $emcm_g\91_©_of_li¡
+(\12
+\9adex
+)
+
+125 
+em\9dc_ema\9e_queue_\99em
+ *
+tmp_\99em
+ = 
+h\97d
+;
+
+127 ià(
+h\97d
+) {
+
+128 \ f
+\9adex
+ = 0; index < 0; index++) {
+
+129 
+tmp_\99em
+ =\81mp_\99em->
+Ãxt
+;
+
+132 ià(
+tmp_\99em
+)
+
+133 \15 
+tmp_\99em
+->
+d©a
+;
+
+135 \15 
+NULL
+;
+
+136 
+       }
+}
+
+138 
+EXPORT_API
\12
+       $emcm_g\91_couÁ_of_li¡
+()
+
+140 \15 
+couÁ
+;
+
+141 
+       }
+}
+
+       @email-common/email-common-msg-queue.c
+
+22 \ 2
+       ~<¡r\9ag.h
+>
+
+23 \ 2
+       ~<uni¡d.h
+>
+
+24 \ 2
+       ~<¡dlib.h
+>
+
+25 \ 2
+       ~<\94ºo.h
+>
+
+27 \ 2
+       ~<sys/\9dc.h
+>
+
+28 \ 2
+       ~<sys/msg.h
+>
+
+30 \ 2
+       ~"ema\9e-commÚ-msg-queue.h
+"
+
+31 \ 2
+       ~"ema\9e-\9dc-bu\9ed.h
+"
+
+33 \ 2
+       ~"ema\9e-debug-log.h
+"
+
+35 \18\12
+       gcm_msg_ty³
+ = 0;
+
+36 \18\12
+       gcm_msg_qid
+ = -1;
+
+37 \18
+em\9dc_msg_buf
+ *
+       gcm_£nd_buf
+ = 
+NULL
+;
+
+38 \18
+em\9dc_msg_buf
+ *
+       gcm_»cv_buf
+ = 
+NULL
+;
+
+40 
+EXPORT_API
+boÞ
+       $emcm_\9a\99_msg_queue
+(\12
+msg_ty³
+)
+
+42 
+       `EM_DEBUG_FUNC_BEGIN
+();
+
+43 
+cm_msg_ty³
+ = 
+msg_ty³
+;
+
+44 
+cm_£nd_buf
+ = (
+em\9dc_msg_buf
+ *)
+       `m®loc
+(\17(emipc_msg_buf));
+
+45 ià(
+cm_£nd_buf
+ =ð
+NULL
+) {
+
+46 
+       `EM_DEBUG_EXCEPTION
+("Malloc failed.");
+
+47 \15 
+çl£
+;
+
+49 
+       `mem£t
+(
+cm_£nd_buf
+, 0x00, \17(
+em\9dc_msg_buf
+));
+
+51 
+cm_»cv_buf
+ = (
+em\9dc_msg_buf
+ *)
+       `m®loc
+(\17(emipc_msg_buf));
+
+52 ià(
+cm_»cv_buf
+ =ð
+NULL
+) {
+
+53 
+       `EM_DEBUG_EXCEPTION
+("Malloc failed.");
+
+54 \15 
+çl£
+;
+
+56 
+       `mem£t
+(
+cm_»cv_buf
+, 0x00, \17(
+em\9dc_msg_buf
+));
+
+58 
+       `EM_DEBUG_FUNC_END
+();
+
+59 \15 
+\8cue
+;
+
+60 
+       }
+}
+
+62 
+EXPORT_API
\1e
+       $emcm_ä\93_msg_queue
+()
+
+64 
+       `EM_DEBUG_FUNC_BEGIN
+();
+
+65 
+       `EM_SAFE_FREE
+(
+cm_£nd_buf
+);
+
+66 
+       `EM_SAFE_FREE
+(
+cm_»cv_buf
+);
+
+67 
+       `EM_DEBUG_FUNC_END
+();
+
+68 
+       }
+}
+
+70 
+EXPORT_API
\1e
+       $emcm_ü\97\8b_msg_qid
+()
+
+72 
+       `EM_DEBUG_FUNC_BEGIN
+();
+
+73 
+key_t
+key
+ = (key_t)640;
+
+75 ià((
+cm_msg_qid
+ = 
+       `msgg\91
+(
+key
+, 
+IPC_CREAT
+ | 
+IPC_EXCL
+ | 0777)) == -1) {
+
+76 
+cm_msg_qid
+ = 
+       `msgg\91
+(
+key
+, 1);
+
+78 ià(
+\94ºo
+ =ð
+EEXIST
+) {
+
+79 
+       `EM_DEBUG_LOG
+("Message Queue Exist");
+
+80 
+       `EM_DEBUG_LOG
+("===================================================== ");
+
+81 
+       `EM_DEBUG_LOG
+("[emcm_msg_queue :\83mcm_create_msg][Exist]");
+
+82 
+       `EM_DEBUG_LOG
+("===================================================== ");
+
+85 
+       `EM_DEBUG_LOG
+("=====================================================");
+
+86 
+       `EM_DEBUG_LOG
+("[emcm_msg_queue:emcm_ü\97\8b_msg][msg_qid = %d]", 
+cm_msg_qid
+);
+
+87 
+       `EM_DEBUG_LOG
+("=====================================================");
+
+88 
+       }
+}
+
+90 
+EXPORT_API
\12
+       $emcm_£nd_msg
+(\1e*
+msg
+, \12
+size
+, \13
+ty³
+)
+
+92 
+       `EM_DEBUG_FUNC_BEGIN
+();
+
+94 \12
+»t
+ = 0;
+
+96 
+cm_£nd_buf
+->
+mty³
+ = 
+ty³
+;
+
+97 
+       `memýy
+(
+cm_£nd_buf
+->
+m\8bxt
+, 
+msg
+, 
+size
+);
+
+99 
+       `EM_DEBUG_LOG
+("===========================================================");
+
+100 
+       `EM_DEBUG_LOG
+("[emcm_msg_queue:msg_£nd][Msgqid = %d]", 
+cm_msg_qid
+);
+
+101 
+       `EM_DEBUG_LOG
+("[emcm_msg_queue:msg_£nd][Siz\90ð%d]", 
+size
+);
+
+102 
+       `EM_DEBUG_LOG
+("[emcm_msg_queue:msg_£nd][Ty³ = %d]", 
+ty³
+);
+
+103 
+       `EM_DEBUG_LOG
+("===========================================================");
+
+104 
+»t
+ = 
+       `msg¢d
+(
+cm_msg_qid
+, 
+cm_£nd_buf
+, 
+IPC_MSGQ_SIZE
+, 0);
+
+106 
+       `EM_DEBUG_LOG
+("=====================================================");
+
+107 
+       `EM_DEBUG_LOG
+("[emcm_msg_queue:msg_£nd][»\88ð%d]", 
+»t
+);
+
+108 
+       `EM_DEBUG_LOG
+("=====================================================");
+
+109 \15 
+»t
+;
+
+110 
+       }
+}
+
+112 
+EXPORT_API
\12
+       $emcm_»cv_msg
+(\1e*
+msg
+, \12
+size
+)
+
+114 \12
+»t
+ = 0;
+
+115 
+       `EM_DEBUG_LOG
+("===========================================================");
+
+116 
+       `EM_DEBUG_LOG
+("[emcm_msg_queue:msg_»cv][cm_msg_qid = %d]", 
+cm_msg_qid
+);
+
+117 
+       `EM_DEBUG_LOG
+("[emcm_msg_queue:msg_»cv][cm_msg_ty³ = %d]", 
+cm_msg_ty³
+);
+
+118 
+       `EM_DEBUG_LOG
+("===========================================================");
+
+119 
+»t
+ = 
+       `msgrcv
+(
+cm_msg_qid
+, 
+cm_»cv_buf
+, 
+IPC_MSGQ_SIZE
+, 
+cm_msg_ty³
+, 0);
+
+120 ià(
+»t
+ == -1) {
+
+121 
+       `EM_DEBUG_LOG
+("===========================================================");
+
+122 
+       `EM_DEBUG_LOG
+("[emcm_msg_queue:msg_recv][FAIL]");
+
+123 
+       `EM_DEBUG_LOG
+("[emcm_msg_queue:msg_»cv][\94rÜ:=%d][\94rÜ¡¸=%s]", 
+\94ºo
+, 
+       `¡»¼Ü
+(errno));
+
+124 
+       `EM_DEBUG_LOG
+("===========================================================");
+
+126 
+       `memýy
+(
+msg
+, 
+cm_»cv_buf
+->
+m\8bxt
+, 
+size
+);
+
+127 
+       `EM_DEBUG_LOG
+("=====================================================");
+
+128 
+       `EM_DEBUG_LOG
+("[emcm_msg_queue:msg_»cv][»\88ð%d][mty³ = %x][Siz\90ð%d]", 
+»t
+, 
+cm_msg_ty³
+, 
+size
+);
+
+129 
+       `EM_DEBUG_LOG
+("=====================================================");
+
+131 \15 
+»t
+;
+
+132 
+       }
+}
+
+134 
+EXPORT_API
+boÞ
+       $emcm_de¡roy_msg_qid
+()
+
+136 if(
+       `msgùl
+(
+cm_msg_qid
+, 
+IPC_RMID
+, 
+NULL
+) == -1)
+
+137 \15 
+çl£
+;
+
+139 
+       `EM_DEBUG_LOG
+("=====================================================");
+
+140 
+       `EM_DEBUG_LOG
+("[cmSysMsgQueue][MsgDestroy]");
+
+141 
+       `EM_DEBUG_LOG
+("=====================================================");
+
+142 \15 
+\8cue
+;
+
+143 
+       }
+}
+
+       @email-common/include/email-common-list.h
+
+23 #iâdeà
+_IPC_LIST_H_
+
+
+24 \ 1
+       #_IPC_LIST_H_
+
+
+       )
+
+26 \ 2
+       ~"ema\9e-ty³s.h
+"
+
+28 
+EXPORT_API
+boÞ
+emcm_\9a\99_li¡
+();
+
+30 
+EXPORT_API
\1e
+emcm_ä\93_li¡
+();
+
+32 
+EXPORT_API
+boÞ
+emcm_add_\8f\9e_of_li¡
+(\1e*
+d©a
+);
+
+34 
+EXPORT_API
+boÞ
+emcm_»move_\99em_of_li¡
+(\1e*
+d©a
+);
+
+36 
+EXPORT_API
\1e*
+emcm_g\91_©_of_li¡
+(\12
+\9adex
+);
+
+38 
+EXPORT_API
\12
+emcm_g\91_couÁ_of_li¡
+();
+
+       @email-common/include/email-common-msg-queue.h
+
+23 #iâdeà
+_IPC_MESSAGE_Q_H_
+
+
+24 \ 1
+       #_IPC_MESSAGE_Q_H_
+
+
+       )
+
+26 \ 2
+       ~"ema\9e-ty³s.h
+"
+
+28 \ 1
+       #IPC_MSGQ_SIZE
+ 512
+
+       )
+
+31 \13
+       mmty³
+;
+
+32 \ 5
+       mm\8bxt
+[
+IPC_MSGQ_SIZE
+];
+
+33 } 
+       tem\9dc_msg_buf
+;
+
+35 
+EXPORT_API
+boÞ
+emcm_\9a\99_msg_queue
+(\12
+msg_ty³
+);
+
+37 
+EXPORT_API
\1e
+emcm_ä\93_msg_queue
+();
+
+39 
+EXPORT_API
\1e
+emcm_ü\97\8b_msg_qid
+();
+
+41 
+EXPORT_API
\12
+emcm_£nd_msg
+(\1e*
+msg
+, \12
+size
+, \13
+ty³
+);
+
+43 
+EXPORT_API
\12
+emcm_»cv_msg
+(\1e*
+msg
+, \12
+size
+);
+
+45 
+EXPORT_API
+boÞ
+emcm_de¡roy_msg_qid
+();
+
+       @email-ipc-api.c
+
+22 \ 2
+       ~<m®loc.h
+>
+
+24 \ 2
+       ~"ema\9e-\9dc.h
+"
+
+25 \ 2
+       ~"ema\9e-\9dc-bu\9ed.h
+"
+
+26 \ 2
+       ~"ema\9e-\9dc-­i-\9afo.h
+"
+
+27 \ 2
+       ~"ema\9e-\9dc-·¿m-li¡.h
+"
+
+28 \ 2
+       ~"ema\9e-\9dc-sock\91.h
+"
+
+29 \ 2
+       ~"ema\9e-´oxy-ma\9a.h
+"
+
+31 \ 2
+       ~"ema\9e-debug-log.h
+"
+
+32 \ 2
+       ~"ema\9e-\94rÜs.h
+"
+
+34 
+EXPORT_API
+em\9dc_·¿m_li¡
+ *
+       $em\9dc_g\91_­i_·¿m\91\94s
+(
+HIPC_API
+­i
+, 
+EPARAMETER_DIRECTION
+d\9ceùiÚ
+)
+
+36 
+       `EM_DEBUG_FUNC_BEGIN
+();
+
+37 
+em\9dc_ema\9e_­i_\9afo
+ *
+­i_\9afo
+ = (em\9dc_ema\9e_­i_\9afØ*)
+­i
+;
+
+39 \15 (
+em\9dc_·¿m_li¡
+ *)
+       `em\9dc_g\91_·¿m\91\94s_of_­i_\9afo
+(
+­i_\9afo
+, 
+d\9ceùiÚ
+);
+
+40 
+       }
+}
+
+42 
+EXPORT_API
+HIPC_API
+       $em\9dc_ü\97\8b_ema\9e_­i
+(\13
+­i_id
+)
+
+44 
+       `EM_DEBUG_FUNC_BEGIN
+();
+
+46 
+em\9dc_ema\9e_­i_\9afo
+ *
+­i_\9afo
+ = 
+NULL
+;
+
+48 
+­i_\9afo
+ = (
+em\9dc_ema\9e_­i_\9afo
+ *)
+       `m®loc
+(\17(emipc_email_api_info));
+
+49 if(
+­i_\9afo
+ =ð
+NULL
+) {
+
+50 
+       `EM_DEBUG_EXCEPTION
+("Malloc failed");
+
+51 \15 
+NULL
+;
+
+53 
+       `mem£t
+(
+­i_\9afo
+, 0x00, \17(
+em\9dc_ema\9e_­i_\9afo
+));
+
+55 
+       `em\9dc_£t_­i_id_of_­i_\9afo
+(
+­i_\9afo
+, 
+­i_id
+);
+
+57 \15 (
+HIPC_API
+)
+­i_\9afo
+;
+
+58 
+       }
+}
+
+60 
+EXPORT_API
\1e
+       $em\9dc_de¡roy_ema\9e_­i
+(
+HIPC_API
+­i
+)
+
+62 
+       `EM_DEBUG_FUNC_BEGIN
+("API = %p", 
+­i
+);
+
+63 
+em\9dc_ema\9e_­i_\9afo
+ *
+­i_\9afo
+ = (em\9dc_ema\9e_­i_\9afØ*)
+­i
+;
+
+64 
+       `EM_SAFE_FREE
+(
+­i_\9afo
+);
+
+65 
+       }
+}
+
+67 
+EXPORT_API
\13
+       $em\9dc_g\91_­i_id
+(
+HIPC_API
+­i
+)
+
+69 
+       `EM_DEBUG_FUNC_BEGIN
+();
+
+70 
+em\9dc_ema\9e_­i_\9afo
+ *
+­i_\9afo
+ = (em\9dc_ema\9e_­i_\9afo*)
+­i
+;
+
+71 \15 
+       `em\9dc_g\91_­i_id_of_­i_\9afo
+(
+­i_\9afo
+);
+
+72 
+       }
+}
+
+74 
+EXPORT_API
\13
+       $em\9dc_g\91_­p_id
+(
+HIPC_API
+­i
+)
+
+76 
+       `EM_DEBUG_FUNC_BEGIN
+();
+
+77 
+em\9dc_ema\9e_­i_\9afo
+ *
+­i_\9afo
+ = (em\9dc_ema\9e_­i_\9afØ*)
+­i
+;
+
+78 \15 
+       `em\9dc_g\91_­p_id_of_­i_\9afo
+(
+­i_\9afo
+);
+
+79 
+       }
+}
+
+81 
+EXPORT_API
+boÞ
+       $em\9dc_add_·¿m\91\94
+(
+HIPC_API
+­i
+, 
+EPARAMETER_DIRECTION
+d\9ceùiÚ
+, \1e*
+d©a
+, \12
+d©a_Ëngth
+)
+
+83 
+       `EM_DEBUG_FUNC_BEGIN
+();
+
+85 
+em\9dc_·¿m_li¡
+ *
+·¿m\91\94s
+ = 
+       `em\9dc_g\91_­i_·¿m\91\94s
+(
+­i
+, 
+d\9ceùiÚ
+);
+
+86 ià(
+·¿m\91\94s
+)
+
+87 \15 
+       `em\9dc_add_·¿m_of_·¿m_li¡
+(
+·¿m\91\94s
+, 
+d©a
+, 
+d©a_Ëngth
+);
+
+89 \15 
+çl£
+;
+
+90 
+       }
+}
+
+92 
+EXPORT_API
\12
+       $em\9dc_g\91_·¿m\91\94_couÁ
+(
+HIPC_API
+­i
+, 
+EPARAMETER_DIRECTION
+d\9ceùiÚ
+)
+
+94 
+       `EM_DEBUG_FUNC_BEGIN
+();
+
+96 
+em\9dc_·¿m_li¡
+ *
+·¿m\91\94s
+ = 
+       `em\9dc_g\91_­i_·¿m\91\94s
+(
+­i
+, 
+d\9ceùiÚ
+);
+
+98 if(
+·¿m\91\94s
+)
+
+99 \15 
+       `em\9dc_g\91_·¿m_couÁ_of_·¿m_li¡
+(
+·¿m\91\94s
+);
+
+102 
+       }
+}
+
+104 
+EXPORT_API
\12
+       $em\9dc_g\91_·¿m\91\94
+(
+HIPC_API
+\9aput_­i_hªdË
+, 
+EPARAMETER_DIRECTION
+\9aput_·¿m\91\94_d\9ceùiÚ
+, \12
+\9aput_·¿m\91\94_\9adex
+, \12
+\9aput_·¿m\91\94_bufãr_size
+, \1e*
+ou\8dut_·¿m\91\94_bufãr
+)
+
+106 
+       `EM_DEBUG_FUNC_BEGIN
+("\9aput_­i_hªdË [%d], iÅut_·¿m\91\94_d\9ceùiÚ [%d], iÅut_·¿m\91\94_\9adex [%d], iÅut_·¿m\91\94_bufãr_siz\90[%d], ou\8dut_·¿m\91\94_bufã¸[%p]", 
+\9aput_­i_hªdË
+ , 
+\9aput_·¿m\91\94_d\9ceùiÚ
+ , 
+\9aput_·¿m\91\94_\9adex
+, 
+\9aput_·¿m\91\94_bufãr_size
+, 
+ou\8dut_·¿m\91\94_bufãr
+);
+
+107 
+em\9dc_·¿m_li¡
+ *
+·¿m\91\94s
+ = 
+NULL
+;
+
+108 \1e*
+loÿl_bufãr
+ = 
+NULL
+;
+
+110 ià(
+\9aput_·¿m\91\94_bufãr_size
+ =ð0 || 
+ou\8dut_·¿m\91\94_bufãr
+ =ð
+NULL
+) {
+
+111 
+       `EM_DEBUG_EXCEPTION
+("EMF_ERROR_INVALID_PARAM");
+
+112 \15 
+EMF_ERROR_INVALID_PARAM
+;
+
+115 
+·¿m\91\94s
+ = 
+       `em\9dc_g\91_­i_·¿m\91\94s
+(
+\9aput_­i_hªdË
+, 
+\9aput_·¿m\91\94_d\9ceùiÚ
+);
+
+117 ià(
+·¿m\91\94s
+ =ð
+NULL
+) {
+
+118 
+       `EM_DEBUG_EXCEPTION
+("EMF_ERROR_IPC_PROTOCOL_FAILURE");
+
+119 \15 
+EMF_ERROR_IPC_PROTOCOL_FAILURE
+;
+
+122 
+loÿl_bufãr
+ = 
+       `em\9dc_g\91_·¿m_of_·¿m_li¡
+(
+·¿m\91\94s
+, 
+\9aput_·¿m\91\94_\9adex
+);
+
+124 ià(
+loÿl_bufãr
+ =ð
+NULL
+) {
+
+125 
+       `EM_DEBUG_EXCEPTION
+("EMF_ERROR_IPC_PROTOCOL_FAILURE");
+
+126 \15 
+EMF_ERROR_IPC_PROTOCOL_FAILURE
+;
+
+129 ià(
+       `em\9dc_g\91_·¿m_Ën_of_·¿m_li¡
+(
+·¿m\91\94s
+, 
+\9aput_·¿m\91\94_\9adex
+è!ð
+\9aput_·¿m\91\94_bufãr_size
+) {
+
+130 
+       `EM_DEBUG_EXCEPTION
+("EMF_ERROR_IPC_PROTOCOL_FAILURE");
+
+131 \15 
+EMF_ERROR_IPC_PROTOCOL_FAILURE
+;
+
+134 
+       `memýy
+(
+ou\8dut_·¿m\91\94_bufãr
+, 
+loÿl_bufãr
+, 
+\9aput_·¿m\91\94_bufãr_size
+);
+
+136 
+       `EM_DEBUG_FUNC_END
+("Suceeded");
+
+137 \15 
+EMF_ERROR_NONE
+;
+
+138 
+       }
+}
+
+140 
+EXPORT_API
\12
+       $em\9dc_g\91_·¿m\91\94_Ëngth
+(
+HIPC_API
+­i
+, 
+EPARAMETER_DIRECTION
+d\9ceùiÚ
+, \12
+·¿m\91\94_\9adex
+)
+
+142 
+       `EM_DEBUG_FUNC_BEGIN
+();
+
+143 
+em\9dc_·¿m_li¡
+ *
+·¿m\91\94s
+ = 
+       `em\9dc_g\91_­i_·¿m\91\94s
+(
+­i
+, 
+d\9ceùiÚ
+);
+
+144 ià(
+·¿m\91\94s
+) {
+
+145 
+       `EM_DEBUG_FUNC_END
+("Suceeded");
+
+146 \15 
+       `em\9dc_g\91_·¿m_Ën_of_·¿m_li¡
+(
+·¿m\91\94s
+, 
+·¿m\91\94_\9adex
+);
+
+148 
+       `EM_DEBUG_FUNC_END
+("Failed");
+
+150 
+       }
+}
+
+       @email-ipc-api/email-ipc-api-info.c
+
+23 \ 2
+       ~<¡r\9ag.h
+>
+
+24 \ 2
+       ~<uni¡d.h
+>
+
+25 \ 2
+       ~<m®loc.h
+>
+
+27 \ 2
+       ~"ema\9e-\9dc-­i-\9afo.h
+"
+
+28 \ 2
+       ~"ema\9e-\9dc-·¿m-li¡.h
+"
+
+29 \ 2
+       ~"ema\9e-\9dc-bu\9ed.h
+"
+
+31 \ 2
+       ~"ema\9e-debug-log.h
+"
+
+33 \18\13
+em\9dc_·r£_­i_id_of_­i_\9afo
+(
+em\9dc_ema\9e_­i_\9afo
+ *
+­i_\9afo
+, \1e*
+¡»am
+);
+
+34 \18\13
+em\9dc_·r£_»¥Ú£_id_of_­i_\9afo
+(
+em\9dc_ema\9e_­i_\9afo
+ *
+­i_\9afo
+, \1e
+¡»am
+);
+
+35 \18\13
+em\9dc_·r£_­p_id_of_­i_\9afo
+(
+em\9dc_ema\9e_­i_\9afo
+ *
+­i_\9afo
+, \1e
+¡»am
+);
+
+37 
+EXPORT_API
+boÞ
+       $em\9dc_£t_­i_id_of_­i_\9afo
+(
+em\9dc_ema\9e_­i_\9afo
+ *
+­i_\9afo
+, \13
+­i_id
+)
+
+39 
+­i_\9afo
+->
+­i_id
+ =\87pi_id;
+
+40 \15 
+\8cue
+;
+
+41 
+       }
+}
+
+43 
+EXPORT_API
\13
+       $em\9dc_g\91_­i_id_of_­i_\9afo
+(
+em\9dc_ema\9e_­i_\9afo
+ *
+­i_\9afo
+)
+
+45 \15 
+­i_\9afo
+->
+­i_id
+;
+
+46 
+       }
+}
+
+48 
+EXPORT_API
+boÞ
+       $em\9dc_£t_­p_id_of_­i_\9afo
+(
+em\9dc_ema\9e_­i_\9afo
+ *
+­i_\9afo
+, \13
+­p_id
+)
+
+50 
+­i_\9afo
+->
+­p_id
+ =\87pp_id;
+
+51 \15 
+\8cue
+;
+
+52 
+       }
+}
+
+54 
+EXPORT_API
\13
+       $em\9dc_g\91_­p_id_of_­i_\9afo
+(
+em\9dc_ema\9e_­i_\9afo
+ *
+­i_\9afo
+)
+
+56 \15 
+­i_\9afo
+->
+­p_id
+;
+
+57 
+       }
+}
+
+59 
+EXPORT_API
+boÞ
+       $em\9dc_£t_»¥Ú£_id_of_­i_\9afo
+(
+em\9dc_ema\9e_­i_\9afo
+ *
+­i_\9afo
+, \13
+»¥Ú£_id
+)
+
+61 
+­i_\9afo
+->
+»¥Ú£_id
+ =\84esponse_id;
+
+62 \15 
+\8cue
+;
+
+63 
+       }
+}
+
+65 
+EXPORT_API
\13
+       $em\9dc_g\91_»¥Ú£_id_of_­i_\9afo
+(
+em\9dc_ema\9e_­i_\9afo
+ *
+­i_\9afo
+)
+
+67 \15 
+­i_\9afo
+->
+»¥Ú£_id
+;
+
+68 
+       }
+}
+
+70 
+EXPORT_API
+boÞ
+       $em\9dc_·r£_¡»am_of_­i_\9afo
+(
+em\9dc_ema\9e_­i_\9afo
+ *
+­i_\9afo
+, 
+EPARAMETER_DIRECTION
+d\9ceùiÚ
+, \1e*
+¡»am
+)
+
+72 
+em\9dc_·¿m_li¡
+ *
+Ãw_·¿m_li¡
+ = 
+NULL
+;
+
+74 ià(
+­i_\9afo
+->
+·¿ms
+[
+d\9ceùiÚ
+] =ð
+NULL
+) {
+
+75 
+Ãw_·¿m_li¡
+ = (
+em\9dc_·¿m_li¡
+ *)
+       `m®loc
+(\17(emipc_param_list));
+
+76 ià(
+Ãw_·¿m_li¡
+ =ð
+NULL
+) {
+
+77 
+       `EM_DEBUG_EXCEPTION
+("Memory\87llocation failed.");
+
+78 \15 
+çl£
+;
+
+80 
+       `mem£t
+(
+Ãw_·¿m_li¡
+, 0x00, \17(
+em\9dc_·¿m_li¡
+));
+
+81 
+­i_\9afo
+->
+·¿ms
+[
+d\9ceùiÚ
+] = 
+Ãw_·¿m_li¡
+;
+
+84 
+       `em\9dc_·r£_­i_id_of_­i_\9afo
+(
+­i_\9afo
+, 
+¡»am
+);
+
+85 
+       `em\9dc_·r£_­p_id_of_­i_\9afo
+(
+­i_\9afo
+, 
+¡»am
+);
+
+86 
+       `em\9dc_·r£_»¥Ú£_id_of_­i_\9afo
+(
+­i_\9afo
+, 
+¡»am
+);
+
+87 \15 
+       `em\9dc_·r£_¡»am_of_·¿m_li¡
+(
+­i_\9afo
+->
+·¿ms
+[
+d\9ceùiÚ
+], 
+¡»am
+);
+
+88 
+       }
+}
+
+90 
+EXPORT_API
\1e*
+       $em\9dc_g\91_¡»am_of_­i_\9afo
+(
+em\9dc_ema\9e_­i_\9afo
+ *
+­i_\9afo
+, 
+EPARAMETER_DIRECTION
+d\9ceùiÚ
+)
+
+92 
+em\9dc_·¿m_li¡
+ *
+Ãw_·¿m_li¡
+ = 
+NULL
+;
+
+93 \1d\ 5*
+¡»am
+ = 
+NULL
+;
+
+95 ià(
+­i_\9afo
+->
+·¿ms
+[
+d\9ceùiÚ
+] =ð
+NULL
+) {
+
+96 
+Ãw_·¿m_li¡
+ = (
+em\9dc_·¿m_li¡
+ *)
+       `m®loc
+(\17(emipc_param_list));
+
+97 ià(
+Ãw_·¿m_li¡
+ =ð
+NULL
+) {
+
+98 
+       `EM_DEBUG_EXCEPTION
+("Memory\87llocation failed.");
+
+99 \15 
+çl£
+;
+
+101 
+       `mem£t
+(
+Ãw_·¿m_li¡
+, 0x00, \17(
+em\9dc_·¿m_li¡
+));
+
+102 
+­i_\9afo
+->
+·¿ms
+[
+d\9ceùiÚ
+] = 
+Ãw_·¿m_li¡
+;
+
+105 
+¡»am
+ = 
+       `em\9dc_g\91_¡»am_of_·¿m_li¡
+(
+­i_\9afo
+->
+·¿ms
+[
+d\9ceùiÚ
+]);
+
+106 ià(
+¡»am
+ !ð
+NULL
+) {
+
+107 
+       `memýy
+(
+¡»am
+, (\1e*)&(
+­i_\9afo
+->
+­i_id
+), \17(api_info->api_id));
+
+108 
+       `memýy
+(
+¡»am
++(\17(\13)*
+eSTREAM_RESID
+), (\1e*)&(
+­i_\9afo
+->
+»¥Ú£_id
+), \17(api_info->response_id));
+
+109 
+       `memýy
+(
+¡»am
++(\17(\13)*
+eSTREAM_APPID
+), (\1e*)&(
+­i_\9afo
+->
+­p_id
+), \17(api_info->app_id));
+
+111 \15 (\1e*)
+¡»am
+;
+
+112 
+       }
+}
+
+114 
+EXPORT_API
\12
+       $em\9dc_g\91_¡»am_Ëngth_of_­i_\9afo
+(
+em\9dc_ema\9e_­i_\9afo
+ *
+­i_\9afo
+, 
+EPARAMETER_DIRECTION
+d\9ceùiÚ
+)
+
+116 ià(
+­i_\9afo
+->
+·¿ms
+[
+d\9ceùiÚ
+] =ð
+NULL
+)
+
+119 \15 
+       `em\9dc_g\91_¡»am_Ëngth_of_·¿m_li¡
+(
+­i_\9afo
+->
+·¿ms
+[
+d\9ceùiÚ
+]);
+
+120 
+       }
+}
+
+122 
+EXPORT_API
\1e*
+       $em\9dc_g\91_·¿m\91\94s_of_­i_\9afo
+(
+em\9dc_ema\9e_­i_\9afo
+ *
+­i_\9afo
+, 
+EPARAMETER_DIRECTION
+d\9ceùiÚ
+)
+
+124 
+em\9dc_·¿m_li¡
+ *
+Ãw_·¿m_li¡
+ = 
+NULL
+;
+
+126 ià(
+­i_\9afo
+->
+·¿ms
+[
+d\9ceùiÚ
+] =ð
+NULL
+) {
+
+127 
+Ãw_·¿m_li¡
+ = (
+em\9dc_·¿m_li¡
+ *)
+       `m®loc
+(\17(emipc_param_list));
+
+128 ià(
+Ãw_·¿m_li¡
+ =ð
+NULL
+) {
+
+129 
+       `EM_DEBUG_EXCEPTION
+("Memory\87llocation failed.");
+
+130 \15 
+çl£
+;
+
+132 
+       `mem£t
+(
+Ãw_·¿m_li¡
+, 0x00, \17(
+em\9dc_·¿m_li¡
+));
+
+133 
+­i_\9afo
+->
+·¿ms
+[
+d\9ceùiÚ
+] = 
+Ãw_·¿m_li¡
+;
+
+135 \15 
+­i_\9afo
+->
+·¿ms
+[
+d\9ceùiÚ
+];
+
+136 
+       }
+}
+
+138 \18\13
+       $em\9dc_·r£_­i_id_of_­i_\9afo
+(
+em\9dc_ema\9e_­i_\9afo
+ *
+­i_\9afo
+, \1e*
+¡»am
+)
+
+140 
+­i_\9afo
+->
+­i_id
+ = *((\13*)
+¡»am
+ + 
+eSTREAM_APIID
+);
+
+141 \15 
+­i_\9afo
+->
+­i_id
+;
+
+142 
+       }
+}
+
+144 \18\13
+       $em\9dc_·r£_»¥Ú£_id_of_­i_\9afo
+(
+em\9dc_ema\9e_­i_\9afo
+ *
+­i_\9afo
+, \1e
+¡»am
+)
+
+146 
+­i_\9afo
+->
+»¥Ú£_id
+ = *((\13*)
+¡»am
+ + 
+eSTREAM_RESID
+);
+
+147 \15 
+­i_\9afo
+->
+»¥Ú£_id
+;
+
+148 
+       }
+}
+
+150 \18\13
+       $em\9dc_·r£_­p_id_of_­i_\9afo
+(
+em\9dc_ema\9e_­i_\9afo
+ *
+­i_\9afo
+, \1e
+¡»am
+)
+
+152 
+­i_\9afo
+->
+­p_id
+ = *((\13*)
+¡»am
+ + 
+eSTREAM_APPID
+);
+
+153 \15 
+­i_\9afo
+->
+­p_id
+;
+
+155 
+       }
+}
+
+       @email-ipc-api/email-ipc-param-list.c
+
+23 \ 2
+       ~<¡r\9ag.h
+>
+
+24 \ 2
+       ~<¡dlib.h
+>
+
+26 \ 2
+       ~"ema\9e-\9dc-bu\9ed.h
+"
+
+27 \ 2
+       ~"ema\9e-\9dc-·¿m-li¡.h
+"
+
+29 \ 2
+       ~"ema\9e-debug-log.h
+"
+
+36 \18\13
+em\9dc_·r£_·¿m\91\94_couÁ
+(\1e*
+¡»am
+);
+
+38 
+EXPORT_API
+boÞ
+       $em\9dc_·r£_¡»am_of_·¿m_li¡
+(
+em\9dc_·¿m_li¡
+ *
+·¿m_li¡
+, \1e*
+¡»am_d©a
+)
+
+40 
+       `EM_DEBUG_FUNC_BEGIN
+();
+
+41 \13
+·¿m\91\94_couÁ
+ = 
+       `em\9dc_·r£_·¿m\91\94_couÁ
+(
+¡»am_d©a
+);
+
+42 if(
+·¿m\91\94_couÁ
+ <= 0) {
+
+43 
+       `EM_DEBUG_EXCEPTION
+("There is\82o\85arameter. ");
+
+44 \15 
+çl£
+;
+
+47 \1d\ 5
+¡»am
+ = (\1d\ 5*)
+¡»am_d©a
+;
+
+48 \13
+\9adex
+, 
+·¿m_Ën
+, 
+pos
+ = \17(\13)*
+eSTREAM_DATA
+;
+
+50 \ f
+\9adex
+ = 0; index < 
+·¿m\91\94_couÁ
+; index++) {
+
+51 \13
+Ën
+ =0;
+
+52 
+       `memýy
+(&
+Ën
+, 
+¡»am
++
+pos
+, \17(\13));
+
+53 
+·¿m_Ën
+ = 
+Ën
+;
+
+54 
+       `EM_DEBUG_LOG
+("P¬am\91\94 L\92gth [%d] : %d ", 
+\9adex
+, 
+·¿m_Ën
+);
+
+55 
+pos
+ += \17(\13);
+
+57 
+       `em\9dc_add_·¿m_of_·¿m_li¡
+(
+·¿m_li¡
+, (\1e*)(
+¡»am
++
+pos
+), 
+·¿m_Ën
+);
+
+58 
+pos
+ +ð
+·¿m_Ën
+;
+
+61 \15 
+\8cue
+;
+
+62 
+       }
+}
+
+64 
+EXPORT_API
\1e*
+       $em\9dc_g\91_¡»am_of_·¿m_li¡
+(
+em\9dc_·¿m_li¡
+ *
+·¿m_li¡
+)
+
+66 
+       `EM_DEBUG_FUNC_BEGIN
+();
+
+67 if(
+·¿m_li¡
+->
+by\8b_¡»am
+)
+
+68 \15 
+·¿m_li¡
+->
+by\8b_¡»am
+;
+
+70 \12
+¡»am_Ën
+ = 
+       `em\9dc_g\91_¡»am_Ëngth_of_·¿m_li¡
+(
+·¿m_li¡
+);
+
+72 ià(
+¡»am_Ën
+ > 0) {
+
+73 
+·¿m_li¡
+->
+by\8b_¡»am
+ = (\1d\ 5*)
+       `ÿÎoc
+(1, 
+¡»am_Ën
+);
+
+74 \12
+pos
+ = \17(\13)*
+eSTREAM_COUNT
+;
+
+76 ià(
+pos
+ + (\12)\17(
+·¿m_li¡
+->
+·¿m_couÁ
+è> 
+¡»am_Ën
+ ) {
+
+77 
+       `EM_DEBUG_EXCEPTION
+("%d > s\8c\97m_Ën", 
+pos
+ + \17(
+·¿m_li¡
+->
+·¿m_couÁ
+));
+
+78 
+       `EM_SAFE_FREE
+(
+·¿m_li¡
+->
+by\8b_¡»am
+);
+
+79 \15 
+NULL
+;
+
+82 
+       `memýy
+((\1e*)(
+·¿m_li¡
+->
+by\8b_¡»am
++
+pos
+), (\1e*)&·¿m_li¡->
+·¿m_couÁ
+, \17(param_list->param_count));
+
+84 
+pos
+ += \17(\13);
+
+85 \12
+\9adex
+ = 0, 
+Ëngth
+ = 0;
+
+88 \ f
+\9adex
+=0; index<
+·¿m_li¡
+->
+·¿m_couÁ
+; index++) {
+
+89 
+Ëngth
+ = 
+       `em\9dc_g\91_Ëngth
+(
+·¿m_li¡
+->
+·¿ms
+[
+\9adex
+]);
+
+90 ià(
+Ëngth
+ <= 0) {
+
+91 
+       `EM_DEBUG_EXCEPTION
+("Ëngth = %d", 
+\9adex
+, 
+Ëngth
+);
+
+92 
+       `EM_SAFE_FREE
+(
+·¿m_li¡
+->
+by\8b_¡»am
+);
+
+93 \15 
+NULL
+;
+
+96 ià(
+pos
+ + (\12)\17(\13è> 
+¡»am_Ën
+) {
+
+97 
+       `EM_DEBUG_EXCEPTION
+("%d > s\8c\97m_Ën", 
+pos
+ + \17(\13));
+
+98 
+       `EM_SAFE_FREE
+(
+·¿m_li¡
+->
+by\8b_¡»am
+);
+
+99 \15 
+NULL
+;
+
+101 
+       `memýy
+((\1e*)(
+·¿m_li¡
+->
+by\8b_¡»am
++
+pos
+), (\1e*)&
+Ëngth
+, \17(\13));
+
+102 
+pos
+ += \17(\13);
+
+104 ià(
+pos
+ + 
+Ëngth
+ > 
+¡»am_Ën
+) {
+
+105 
+       `EM_DEBUG_EXCEPTION
+("%d > s\8c\97m_Ën", 
+pos
+ + 
+Ëngth
+);
+
+106 
+       `EM_SAFE_FREE
+(
+·¿m_li¡
+->
+by\8b_¡»am
+);
+
+107 \15 
+NULL
+;
+
+110 
+       `memýy
+((\1e*)(
+·¿m_li¡
+->
+by\8b_¡»am
++
+pos
+), 
+       `em\9dc_g\91_d©a
+Õ¬am_li¡->
+·¿ms
+[
+\9adex
+]), 
+Ëngth
+);
+
+111 
+pos
+ +ð
+Ëngth
+;
+
+113 \15 (\1e*)
+·¿m_li¡
+->
+by\8b_¡»am
+;
+
+116 
+       `EM_DEBUG_EXCEPTION
+("failed.");
+
+117 
+       `EM_SAFE_FREE
+(
+·¿m_li¡
+->
+by\8b_¡»am
+);
+
+119 
+       `EM_DEBUG_FUNC_END
+();
+
+120 \15 
+NULL
+;
+
+121 
+       }
+}
+
+123 
+EXPORT_API
\12
+       $em\9dc_g\91_¡»am_Ëngth_of_·¿m_li¡
+(
+em\9dc_·¿m_li¡
+ *
+·¿m_li¡
+)
+
+125 \12
+Ëngth
+ = \17(\13è* 
+eSTREAM_DATA
+;
+
+126 \12
+\9adex
+;
+
+127 \ f
+\9adex
+ = 0; index < 
+·¿m_li¡
+->
+·¿m_couÁ
+; index++) {
+
+128 
+Ëngth
+ += \17(\13);
+
+129 
+Ëngth
+ +ð
+       `em\9dc_g\91_Ëngth
+(
+·¿m_li¡
+->
+·¿ms
+[
+\9adex
+]);
+
+131 \15 
+Ëngth
+;
+
+132 
+       }
+}
+
+134 
+EXPORT_API
+boÞ
+       $em\9dc_add_·¿m_of_·¿m_li¡
+(
+em\9dc_·¿m_li¡
+ *
+·¿m_li¡
+, \1e*
+d©a
+, \12
+Ën
+)
+
+136 
+       `EM_DEBUG_FUNC_BEGIN
+();
+
+137 ià(
+       `em\9dc_£t_·¿m
+(&(
+·¿m_li¡
+->
+·¿ms
+[·¿m_li¡->
+·¿m_couÁ
+]), 
+d©a
+, 
+Ën
+)) {
+
+138 
+·¿m_li¡
+->
+·¿m_couÁ
+++;
+
+139 
+       `EM_SAFE_FREE
+(
+·¿m_li¡
+->
+by\8b_¡»am
+);
+
+140 \15 
+\8cue
+;
+
+142 \15 
+çl£
+;
+
+143 
+       }
+}
+
+145 
+EXPORT_API
\1e*
+       $em\9dc_g\91_·¿m_of_·¿m_li¡
+(
+em\9dc_·¿m_li¡
+ *
+·¿m_li¡
+, \12
+\9adex
+)
+
+147 
+       `EM_DEBUG_FUNC_BEGIN
+("\9adex [%d]", 
+\9adex
+);
+
+148 ià(
+\9adex
+ < 0 || index >ð
+·¿m_li¡
+->
+·¿m_couÁ
+) {
+
+149 
+       `EM_DEBUG_EXCEPTION
+("Index value is\82ot valid");
+
+150 \15 
+NULL
+;
+
+152 \15 
+       `em\9dc_g\91_d©a
+(
+·¿m_li¡
+->
+·¿ms
+[
+\9adex
+]);
+
+153 
+       }
+}
+
+155 
+EXPORT_API
\12
+       $em\9dc_g\91_·¿m_Ën_of_·¿m_li¡
+(
+em\9dc_·¿m_li¡
+ *
+·¿m_li¡
+, \12
+\9adex
+)
+
+157 
+       `EM_DEBUG_FUNC_BEGIN
+();
+
+158 ià(
+\9adex
+ < 0 || index >ð
+·¿m_li¡
+->
+·¿m_couÁ
+) {
+
+159 
+       `EM_DEBUG_EXCEPTION
+("Index valud is\82ot valid");
+
+162 \15 
+       `em\9dc_g\91_Ëngth
+(
+·¿m_li¡
+->
+·¿ms
+[
+\9adex
+]);
+
+163 
+       }
+}
+
+165 
+EXPORT_API
\12
+       $em\9dc_g\91_·¿m_couÁ_of_·¿m_li¡
+(
+em\9dc_·¿m_li¡
+ *
+·¿m_li¡
+)
+
+167 
+       `EM_DEBUG_FUNC_BEGIN
+("P¬am\91\94 couÁ [%d]", 
+·¿m_li¡
+->
+·¿m_couÁ
+);
+
+168 \15 
+·¿m_li¡
+->
+·¿m_couÁ
+;
+
+169 
+       }
+}
+
+171 \18\13
+       $em\9dc_·r£_·¿m\91\94_couÁ
+(\1e*
+¡»am
+)
+
+173 
+       `EM_DEBUG_FUNC_BEGIN
+();
+
+174 \13*
+·¿m\91\94_couÁ_pos\99
+ = (\13*)
+¡»am
+ + 
+eSTREAM_COUNT
+;
+
+176 \15 *
+·¿m\91\94_couÁ_pos\99
+;
+
+177 
+       }
+}
+
+       @email-ipc-api/email-ipc-param.c
+
+23 \ 2
+       ~<¡r\9ag.h
+>
+
+24 \ 2
+       ~<¡dlib.h
+>
+
+26 \ 2
+       ~"ema\9e-\9dc-·¿m.h
+"
+
+27 \ 2
+       ~"ema\9e-debug-log.h
+"
+
+29 
+EXPORT_API
+boÞ
+       $em\9dc_£t_·¿m
+(
+em\9dc_·¿m
+ *
+·¿m
+, \1e*
+d©a
+, \12
+Ën
+)
+
+31 
+       `EM_DEBUG_FUNC_BEGIN
+();
+
+33 ià(!
+·¿m
+) {
+
+34 
+       `EM_DEBUG_EXCEPTION
+("Invalid\85aramter");
+
+35 \15 
+çl£
+;
+
+38 ià(
+Ën
+ == 0)
+
+39 \15 
+\8cue
+;
+
+41 
+·¿m
+->
+d©a
+ = (\1e*)
+       `m®loc
+(
+Ën
+);
+
+42 ià(
+·¿m
+->
+d©a
+ =ð
+NULL
+) {
+
+43 \15 
+çl£
+;
+
+45 
+       `mem£t
+(
+·¿m
+->
+d©a
+, 0x00, 
+Ën
+);
+
+46 
+       `memýy
+(
+·¿m
+->
+d©a
+, d©a, 
+Ën
+);
+
+47 
+·¿m
+->
+Ëngth
+ = 
+Ën
+;
+
+48 \15 
+\8cue
+;
+
+49 
+       }
+}
+
+51 
+EXPORT_API
\12
+       $em\9dc_g\91_Ëngth
+(
+em\9dc_·¿m
+·¿m
+)
+
+53 \15 
+·¿m
+.
+Ëngth
+;
+
+54 
+       }
+}
+
+56 
+EXPORT_API
\1e*
+       $em\9dc_g\91_d©a
+(
+em\9dc_·¿m
+·¿m
+)
+
+58 \15 
+·¿m
+.
+d©a
+;
+
+59 
+       }
+}
+
+       @email-ipc-api/include/email-ipc-api-info.h
+
+23 #iâdeà
+_IPC_APIINFO_H_
+
+
+24 \ 1
+       #_IPC_APIINFO_H_
+
+
+       )
+
+26 \ 2
+       ~<¡dio.h
+>
+
+28 \ 2
+       ~"ema\9e-\9dc.h
+"
+
+29 \ 2
+       ~"ema\9e-\9dc-­i-\9afo.h
+"
+
+30 \ 2
+       ~"ema\9e-\9dc-·¿m-li¡.h
+"
+
+33 \13
+       m­i_id
+;
+
+34 \13
+       m»¥Ú£_id
+;
+
+35 \13
+       m­p_id
+;
+
+36 
+em\9dc_·¿m_li¡
+ *
+       m·¿ms
+[2];
+
+37 } 
+       tem\9dc_ema\9e_­i_\9afo
+;
+
+39 
+EXPORT_API
+boÞ
+em\9dc_£t_­i_id_of_­i_\9afo
+(
+em\9dc_ema\9e_­i_\9afo
+ *
+­i_\9afo
+, \13
+­i_id
+);
+
+41 
+EXPORT_API
\13
+em\9dc_g\91_­i_id_of_­i_\9afo
+(
+em\9dc_ema\9e_­i_\9afo
+ *
+­i_\9afo
+);
+
+43 
+EXPORT_API
+boÞ
+em\9dc_£t_­p_id_of_­i_\9afo
+(
+em\9dc_ema\9e_­i_\9afo
+ *
+­i_\9afo
+, \13
+­p_id
+);
+
+45 
+EXPORT_API
\13
+em\9dc_g\91_­p_id_of_­i_\9afo
+(
+em\9dc_ema\9e_­i_\9afo
+ *
+­i_\9afo
+);
+
+47 
+EXPORT_API
+boÞ
+em\9dc_£t_»¥Ú£_id_of_­i_\9afo
+(
+em\9dc_ema\9e_­i_\9afo
+ *
+­i_\9afo
+, \13
+»¥Ú£_id
+);
+
+49 
+EXPORT_API
\13
+em\9dc_g\91_»¥Ú£_id_of_­i_\9afo
+(
+em\9dc_ema\9e_­i_\9afo
+ *
+­i_\9afo
+);
+
+51 
+EXPORT_API
+boÞ
+em\9dc_·r£_¡»am_of_­i_\9afo
+(
+em\9dc_ema\9e_­i_\9afo
+ *
+­i_\9afo
+, 
+EPARAMETER_DIRECTION
+d\9ceùiÚ
+, \1e*
+¡»am
+);
+
+53 
+EXPORT_API
\1e*
+em\9dc_g\91_¡»am_of_­i_\9afo
+(
+em\9dc_ema\9e_­i_\9afo
+ *
+­i_\9afo
+, 
+EPARAMETER_DIRECTION
+d\9ceùiÚ
+);
+
+55 
+EXPORT_API
\12
+em\9dc_g\91_¡»am_Ëngth_of_­i_\9afo
+(
+em\9dc_ema\9e_­i_\9afo
+ *
+­i_\9afo
+, 
+EPARAMETER_DIRECTION
+d\9ceùiÚ
+);
+
+57 
+EXPORT_API
\1e*
+em\9dc_g\91_·¿m\91\94s_of_­i_\9afo
+(
+em\9dc_ema\9e_­i_\9afo
+ *
+­i_\9afo
+, 
+EPARAMETER_DIRECTION
+d\9ceùiÚ
+);
+
+62 \ 1
+       #EM_APIID_TO_STR
+(
+nAPIID
+) \
+
+64 \12
+id
+=
+nAPIID
+;\
+
+65 cڡ \ 5
+s
+=
+NULL
+;\
+
+66 \1a
+id
+) {\
+
+67 \ 4
+_EMAIL_API_ADD_ACCOUNT
+:\
+
+68 
+s
+ = "_EMAIL_API_ADD_ACCOUNT";\
+
+70 \ 4
+_EMAIL_API_ADD_MAILBOX
+:\
+
+71 
+s
+ = "_EMAIL_API_ADD_MAILBOX";\
+
+73 \ 4
+_EMAIL_API_DELETE_MAILBOX
+:\
+
+74 
+s
+ = "_EMAIL_API_DELETE_MAILBOX";\
+
+76 \ 4
+_EMAIL_API_UPDATE_MAILBOX
+:\
+
+77 
+s
+ = "_EMAIL_API_UPDATE_MAILBOX";\
+
+79 \ 4
+_EMAIL_API_SET_MAIL_SLOT_SIZE
+:\
+
+80 
+s
+ = "_EMAIL_API_SET_MAIL_SLOT_SIZE";\
+
+82 \ 4
+_EMAIL_API_SEND_MAIL
+:\
+
+83 
+s
+ = "_EMAIL_API_SEND_MAIL";\
+
+85 \ 4
+_EMAIL_API_GET_MAILBOX_COUNT
+:\
+
+86 
+s
+ = "_EMAIL_API_GET_MAILBOX_COUNT";\
+
+88 \ 4
+_EMAIL_API_GET_MAILBOX_LIST
+:\
+
+89 
+s
+ = "_EMAIL_API_GET_MAILBOX_LIST";\
+
+91 \ 4
+_EMAIL_API_GET_SUBMAILBOX_LIST
+:\
+
+92 
+s
+ = "_EMAIL_API_GET_SUBMAILBOX_LIST";\
+
+94 \ 4
+_EMAIL_API_SYNC_HEADER
+:\
+
+95 
+s
+ = "_EMAIL_API_SYNC_HEADER";\
+
+97 \ 4
+_EMAIL_API_DOWNLOAD_BODY
+:\
+
+98 
+s
+ = "_EMAIL_API_DOWNLOAD_BODY";\
+
+100 \ 4
+_EMAIL_API_CLEAR_DATA
+:\
+
+101 
+s
+ = "_EMAIL_API_CLEAR_DATA";\
+
+103 \ 4
+_EMAIL_API_DELETE_ALL_MAIL
+:\
+
+104 
+s
+ = "_EMAIL_API_DELETE_ALL_MAIL";\
+
+106 \ 4
+_EMAIL_API_DELETE_MAIL
+:\
+
+107 
+s
+ = "_EMAIL_API_DELETE_MAIL";\
+
+109 \ 4
+_EMAIL_API_MODIFY_MAIL_FLAG
+:\
+
+110 
+s
+ = "_EMAIL_API_MODIFY_MAIL_FLAG";\
+
+112 \ 4
+_EMAIL_API_MODIFY_MAIL_EXTRA_FLAG
+:\
+
+113 
+s
+ = "_EMAIL_API_MODIFY_MAIL_EXTRA_FLAG";\
+
+115 \ 4
+_EMAIL_API_ADD_RULE
+:\
+
+116 
+s
+ = "_EMAIL_API_ADD_RULE";\
+
+118 \ 4
+_EMAIL_API_GET_RULE
+:\
+
+119 
+s
+ = "_EMAIL_API_GET_RULE";\
+
+121 \ 4
+_EMAIL_API_GET_RULE_LIST
+:\
+
+122 
+s
+ = "_EMAIL_API_GET_RULE";\
+
+124 \ 4
+_EMAIL_API_FIND_RULE
+:\
+
+125 
+s
+ = "_EMAIL_API_FIND_RULE";\
+
+127 \ 4
+_EMAIL_API_UPDATE_RULE
+:\
+
+128 
+s
+ = "_EMAIL_API_UPDATE_RULE";\
+
+130 \ 4
+_EMAIL_API_DELETE_RULE
+:\
+
+131 
+s
+ = "_EMAIL_API_DELETE_RULE";\
+
+133 \ 4
+_EMAIL_API_MOVE_MAIL
+:\
+
+134 
+s
+ = "_EMAIL_API_MOVE_MAIL";\
+
+136 \ 4
+_EMAIL_API_MOVE_ALL_MAIL
+:\
+
+137 
+s
+ = "_EMAIL_API_MOVE_ALL_MAIL";\
+
+139 \ 4
+_EMAIL_API_SET_FLAGS_FIELD
+:\
+
+140 
+s
+ = "_EMAIL_API_SET_FLAGS_FIELD";\
+
+142 \ 4
+_EMAIL_API_ADD_MAIL
+:\
+
+143 
+s
+ = "_EMAIL_API_ADD_MAIL";\
+
+145 \ 4
+_EMAIL_API_UPDATE_MAIL
+:\
+
+146 
+s
+ = "_EMAIL_API_UPDATE_MAIL";\
+
+148 \ 4
+_EMAIL_API_MOVE_THREAD_TO_MAILBOX
+:\
+
+149 
+s
+ = "_EMAIL_API_MOVE_THREAD_TO_MAILBOX";\
+
+151 \ 4
+_EMAIL_API_DELETE_THREAD
+:\
+
+152 
+s
+ = "_EMAIL_API_DELETE_THREAD";\
+
+154 \ 4
+_EMAIL_API_MODIFY_SEEN_FLAG_OF_THREAD
+:\
+
+155 
+s
+ = "_EMAIL_API_MODIFY_SEEN_FLAG_OF_THREAD";\
+
+157 \ 4
+_EMAIL_API_UPDATE_ACCOUNT
+:\
+
+158 
+s
+ = "_EMAIL_API_UPDATE_ACCOUNT";\
+
+160 \ 4
+_EMAIL_API_ADD_ATTACHMENT
+:\
+
+161 
+s
+ = "_EMAIL_API_ADD_ATTACHMENT";\
+
+163 \ 4
+_EMAIL_API_GET_IMAP_MAILBOX_LIST
+:\
+
+164 
+s
+ = "_EMAIL_API_GET_IMAP_MAILBOX_LIST";\
+
+166 \ 4
+_EMAIL_API_GET_ATTACHMENT
+:\
+
+167 
+s
+ = "_EMAIL_API_GET_ATTACHMENT";\
+
+169 \ 4
+_EMAIL_API_DELETE_ATTACHMENT
+:\
+
+170 
+s
+ = "_EMAIL_API_DELETE_ATTACHMENT";\
+
+172 \ 4
+_EMAIL_API_DOWNLOAD_ATTACHMENT
+:\
+
+173 
+s
+ = "_EMAIL_API_DOWNLOAD_ATTACHMENT";\
+
+175 \ 4
+_EMAIL_API_GET_ACCOUNT_LIST
+:\
+
+176 
+s
+ = "_EMAIL_API_GET_ACCOUNT_LIST";\
+
+178 \ 4
+_EMAIL_API_SEND_SAVED
+:\
+
+179 
+s
+ = "_EMAIL_API_SEND_SAVED";\
+
+181 \ 4
+_EMAIL_API_CANCEL_JOB
+:\
+
+182 
+s
+ = "_EMAIL_API_CANCEL_JOB";\
+
+184 \ 4
+_EMAIL_API_GET_PENDING_JOB
+:\
+
+185 
+s
+ = "_EMAIL_API_GET_PENDING_JOB";\
+
+187 \ 4
+_EMAIL_API_NETWORK_GET_STATUS
+:\
+
+188 
+s
+ = "_EMAIL_API_NETWORK_GET_STATUS";\
+
+190 \ 4
+_EMAIL_API_SEND_RETRY
+:\
+
+191 
+s
+ = "_EMAIL_API_SEND_RETRY";\
+
+193 \ 4
+_EMAIL_API_VALIDATE_ACCOUNT
+ :\
+
+194 
+s
+ = "_EMAIL_API_VALIDATE_ACCOUNT";\
+
+196 \ 4
+_EMAIL_API_SEND_MAIL_CANCEL_JOB
+ :\
+
+197 
+s
+ = "_EMAIL_API_SEND_MAIL_CANCEL_JOB";\
+
+199 \ 4
+_EMAIL_API_SEARCH_MAIL_ON_SERVER
+ :\
+
+200 
+s
+ = "_EMAIL_API_SEARCH_MAIL_ON_SERVER";\
+
+202 \ 4
+_EMAIL_API_ADD_ACCOUNT_WITH_VALIDATION
+ :\
+
+203 
+s
+ = "_EMAIL_API_ADD_ACCOUNT_WITH_VALIDATION";\
+
+205 \ 4
+_EMAIL_API_BACKUP_ACCOUNTS
+ :\
+
+206 
+s
+ = "_EMAIL_API_BACKUP_ACCOUNTS";\
+
+208 \ 4
+_EMAIL_API_RESTORE_ACCOUNTS
+ :\
+
+209 
+s
+ = "_EMAIL_API_RESTORE_ACCOUNTS";\
+
+211 \ 4
+_EMAIL_API_PRINT_RECEIVING_EVENT_QUEUE
+ :\
+
+212 
+s
+ = "_EMAIL_API_PRINT_RECEIVING_EVENT_QUEUE";\
+
+214 \ 4
+_EMAIL_API_PING_SERVICE
+ :\
+
+215 
+s
+ = "_EMAIL_API_PING_SERVICE";\
+
+217 \ 4
+_EMAIL_API_UPDATE_NOTIFICATION_BAR_FOR_UNREAD_MAIL
+ :\
+
+218 
+s
+ = "_EMAIL_API_UPDATE_NOTIFICATION_BAR_FOR_UNREAD_MAIL";\
+
+220 \ 4
+_EMAIL_API_GET_PASSWORD_LENGTH_OF_ACCOUNT
+:\
+
+221 
+s
+ = "_EMAIL_API_GET_PASSWORD_LENGTH_OF_ACCOUNT";\
+
+224 
+s
+ = "UNKNOWN_APIID";\
+
+226 
+s
+;\
+
+227 })
+
+       )
+
+       @email-ipc-api/include/email-ipc-param-list.h
+
+23 #iâdeà
+_IPC_PARAMLIST_H_
+
+
+24 \ 1
+       #_IPC_PARAMLIST_H_
+
+
+       )
+
+26 \ 2
+       ~"ema\9e-\9dc-·¿m.h
+"
+
+27 \ 2
+       ~"ema\9e-ty³s.h
+"
+
+30 
+       meSTREAM_APIID
+,
+
+31 
+       meSTREAM_RESID
+,
+
+32 
+       meSTREAM_APPID
+,
+
+33 
+       meSTREAM_COUNT
+,
+
+34 
+       meSTREAM_DATA
+,
+
+35 
+       meSTREAM_MAX
+
+
+36 }
+       tIPC_STREAM_INFO
+;
+
+39 \12
+       m·¿m_couÁ
+;
+
+40 
+em\9dc_·¿m
+       m·¿ms
+[10];
+
+41 \1d\ 5*
+       mby\8b_¡»am
+;
+
+42 } 
+       tem\9dc_·¿m_li¡
+;
+
+44 
+EXPORT_API
+boÞ
+em\9dc_·r£_¡»am_of_·¿m_li¡
+(
+em\9dc_·¿m_li¡
+ *
+·¿m_li¡
+, \1e*
+¡»am_d©a
+);
+
+46 
+EXPORT_API
\1e*
+em\9dc_g\91_¡»am_of_·¿m_li¡
+(
+em\9dc_·¿m_li¡
+ *
+·¿m_li¡
+);
+
+48 
+EXPORT_API
\12
+em\9dc_g\91_¡»am_Ëngth_of_·¿m_li¡
+(
+em\9dc_·¿m_li¡
+ *
+·¿m_li¡
+);
+
+50 
+EXPORT_API
+boÞ
+em\9dc_add_·¿m_of_·¿m_li¡
+(
+em\9dc_·¿m_li¡
+ *
+·¿m_li¡
+, \1e*
+d©a
+, \12
+Ën
+);
+
+52 
+EXPORT_API
\1e*
+em\9dc_g\91_·¿m_of_·¿m_li¡
+(
+em\9dc_·¿m_li¡
+ *
+·¿m_li¡
+, \12
+\9adex
+);
+
+54 
+EXPORT_API
\12
+em\9dc_g\91_·¿m_Ën_of_·¿m_li¡
+(
+em\9dc_·¿m_li¡
+ *
+·¿m_li¡
+, \12
+\9adex
+);
+
+56 
+EXPORT_API
\12
+em\9dc_g\91_·¿m_couÁ_of_·¿m_li¡
+(
+em\9dc_·¿m_li¡
+ *
+·¿m_li¡
+);
+
+       @email-ipc-api/include/email-ipc-param.h
+
+23 #iâdeà
+_IPC_PARAM_H_
+
+
+24 \ 1
+       #_IPC_PARAM_H_
+
+
+       )
+
+26 \ 2
+       ~"ema\9e-ty³s.h
+"
+
+29 \12
+       mËngth
+;
+
+30 \1e*
+       md©a
+;
+
+31 } 
+       tem\9dc_·¿m
+;
+
+33 
+EXPORT_API
+boÞ
+em\9dc_£t_·¿m
+(
+em\9dc_·¿m
+ *
+·¿m
+, \1e*
+d©a
+, \12
+Ën
+);
+
+35 
+EXPORT_API
\12
+em\9dc_g\91_Ëngth
+(
+em\9dc_·¿m
+·¿m
+);
+
+37 
+EXPORT_API
\1e*
+em\9dc_g\91_d©a
+(
+em\9dc_·¿m
+·¿m
+);
+
+       @email-ipc-build.c
+
+23 \ 2
+       ~<¡dlib.h
+>
+
+24 \ 2
+       ~<¡d¬g.h
+>
+
+26 \ 2
+       ~"ema\9e-\9dc-bu\9ed.h
+"
+
+       @email-ipc-proxy.c
+
+18 \ 2
+       ~"ema\9e-\9dc-bu\9ed.h
+"
+
+19 \ 2
+       ~"ema\9e-\9dc.h
+"
+
+20 \ 2
+       ~"ema\9e-\9dc-­i-\9afo.h
+"
+
+21 \ 2
+       ~"ema\9e-\9dc-·¿m-li¡.h
+"
+
+22 \ 2
+       ~"ema\9e-\9dc-sock\91.h
+"
+
+23 \ 2
+       ~"ema\9e-´oxy-ma\9a.h
+"
+
+25 \ 2
+       ~"ema\9e-debug-log.h
+"
+
+26 \ 2
+       ~"ema\9e-­i.h
+"
+
+27 \ 2
+       ~"ema\9e-ty³s.h
+"
+
+29 
+EXPORT_API
\12
+       $em\9dc_\9a\99\9flize_´oxy
+()
+
+31 
+       `EM_DEBUG_FUNC_BEGIN
+();
+
+33 \12
+\94r
+ = 
+       `em\9dc_\9a\99\9flize_´oxy_ma\9a
+();
+
+37 
+       `EM_DEBUG_FUNC_END
+();
+
+38 \15 
+\94r
+;
+
+39 
+       }
+}
+
+41 
+EXPORT_API
\12
+       $em\9dc_f\9a®ize_´oxy
+()
+
+43 
+       `EM_DEBUG_FUNC_BEGIN
+();
+
+44 \15 
+       `em\9dc_f\9a®ize_´oxy_ma\9a
+();
+
+48 
+       }
+}
+
+50 
+EXPORT_API
+boÞ
+       $em\9dc_execu\8b_´oxy_­i
+(
+HIPC_API
+­i
+)
+
+52 
+       `EM_DEBUG_FUNC_BEGIN
+();
+
+53 \12
+»t
+;
+
+54 \12
+\94r
+ = 
+EMF_ERROR_NONE
+;
+
+55 
+em\9dc_ema\9e_­i_\9afo
+ *
+­i_\9afo
+ = (em\9dc_ema\9e_­i_\9afØ*)
+­i
+;
+
+57 
+       `EM_DEBUG_LOG
+("API [%p]", 
+­i_\9afo
+);
+
+59 if(
+­i_\9afo
+ =ð
+NULL
+) {
+
+60 
+       `EM_DEBUG_EXCEPTION
+("EMF_ERROR_INVALID_PARAM");
+
+61 \15 
+EMF_ERROR_INVALID_PARAM
+;
+
+64 
+       `EM_DEBUG_LOG
+("APIID [%s], Re¥Ú£ID [%d], APPID[%d]", 
+       `EM_APIID_TO_STR
+(
+       `em\9dc_g\91_­i_id_of_­i_\9afo
+(
+­i_\9afo
+)), 
+       `em\9dc_g\91_»¥Ú£_id_of_­i_\9afo
+×pi_\9afo), 
+       `em\9dc_g\91_­p_id_of_­i_\9afo
+(api_info));
+
+66 
+»t
+ = 
+       `em\9dc_execu\8b_­i_of_´oxy_ma\9a
+(
+­i_\9afo
+);
+
+72 ià(!
+»t
+) {
+
+73 
+       `em\9dc_f\9a®ize_´oxy
+();
+
+75 
+\94r
+ = 
+       `em\9dc_\9a\99\9flize_´oxy
+();
+
+76 ià(
+\94r
+ !ð
+EMF_ERROR_NONE
+) {
+
+77 
+       `EM_DEBUG_EXCEPTION
+("Fa\9eed\81ØÝ\92\81h\90sock\91 : [%d]", 
+\94r
+);
+
+78 \15 
+EMF_ERROR_CONNECTION_FAILURE
+;
+
+80 
+»t
+ = 
+       `em\9dc_execu\8b_­i_of_´oxy_ma\9a
+(
+­i_\9afo
+);
+
+84 ià(!
+»t
+) {
+
+85 
+       `EM_DEBUG_EXCEPTION
+("em\9dc_´oxy_ma\9a :\83m\9dc_execu\8b\98ç\9eed [%d]", 
+\94r
+);
+
+86 \15 
+EMF_ERROR_CONNECTION_FAILURE
+;
+
+89 
+       `EM_DEBUG_FUNC_END
+("\94¸[%d]", 
+\94r
+);
+
+90 \15 
+\94r
+;
+
+91 
+       }
+}
+
+       @email-ipc-stub.c
+
+23 \ 2
+       ~"ema\9e-\9dc.h
+"
+
+24 \ 2
+       ~"ema\9e-\9dc-bu\9ed.h
+"
+
+25 \ 2
+       ~"ema\9e-¡ub-ma\9a.h
+"
+
+27 \ 2
+       ~"ema\9e-debug-log.h
+"
+
+29 
+EXPORT_API
+boÞ
+       $em\9dc_\9a\99\9flize_¡ub
+(
+PFN_EXECUTE_API
+­i_m­³r
+)
+
+31 
+       `EM_DEBUG_LOG
+("[IPCLib] ipcEmailStub_Initialize ");
+
+33 \15 
+       `em\9dc_\9a\99\9flize_¡ub_ma\9a
+(
+­i_m­³r
+);
+
+37 
+       }
+}
+
+39 
+EXPORT_API
+boÞ
+       $em\9dc_f\9a®ize_¡ub
+()
+
+41 
+       `em\9dc_f\9a®ize_¡ub_ma\9a
+();
+
+42 \15 
+\8cue
+;
+
+48 
+       }
+}
+
+50 
+EXPORT_API
+boÞ
+       $em\9dc_execu\8b_¡ub_­i
+(
+HIPC_API
+­i
+)
+
+52 
+       `EM_DEBUG_LOG
+("\9dcEma\9eStub_Execu\8bAPI [%x]", 
+­i
+);
+
+53 
+em\9dc_ema\9e_­i_\9afo
+ *
+­i_\9afo
+ = (em\9dc_ema\9e_­i_\9afØ*)
+­i
+;
+
+54 ià(
+­i_\9afo
+ =ð
+NULL
+)
+
+55 \15 
+çl£
+;
+
+57 \15 
+       `em\9dc_execu\8b_­i_¡ub_to_´oxy
+(
+­i_\9afo
+);
+
+64 
+       }
+}
+
+       @email-proxy/email-proxy-callback-info.c
+
+23 \ 2
+       ~"ema\9e-´oxy-ÿÎback-\9afo.h
+"
+
+25 
+EXPORT_API
+boÞ
+       $em\9dc_£t_cb_\9afo_v®ue
+(
+em\9dc_ema\9e_cb_\9afo
+ *
+cb_\9afo
+, \12
+­i_id
+, \1e*
+â_ÿÎback
+)
+
+27 
+cb_\9afo
+->
+­i_id
+ =\87pi_id;
+
+28 
+cb_\9afo
+->
+â_ÿÎback
+ = fn_callback;
+
+29 \15 
+\8cue
+;
+
+30 
+       }
+}
+
+       @email-proxy/email-proxy-main.c
+
+23 \ 2
+       ~<uni¡d.h
+>
+
+24 \ 2
+       ~<±h»ad.h
+>
+
+25 \ 2
+       ~<m®loc.h
+>
+
+27 \ 2
+       ~"ema\9e-\9dc.h
+"
+
+28 \ 2
+       ~"ema\9e-\9dc-bu\9ed.h
+"
+
+29 \ 2
+       ~"ema\9e-commÚ-li¡.h
+"
+
+30 \ 2
+       ~"ema\9e-commÚ-msg-queue.h
+"
+
+31 \ 2
+       ~"ema\9e-´oxy-ma\9a.h
+"
+
+32 \ 2
+       ~"ema\9e-´oxy-sock\91.h
+"
+
+33 \ 2
+       ~"ema\9e-´oxy-ÿÎback-\9afo.h
+"
+
+35 \ 2
+       ~"ema\9e-\9a\8bº®-ty³s.h
+"
+
+36 \ 2
+       ~"ema\9e-debug-log.h
+"
+
+38 \18\12
+       g»ã»nû
+ = 0;
+
+39 \18
+boÞ
+       g»cv_¡Ý_æag
+ = 
+çl£
+;
+
+41 
+±h»ad_mu\8bx_t
+       g\9dc_´oxy_mu\8bx
+ = 
+PTHREAD_MUTEX_INITIALIZER
+;
+
+42 
+±h»ad_cÚd_t
+       g\9dc_´oxy_cÚd
+ = 
+PTHREAD_COND_INITIALIZER
+;
+
+45 
+EXPORT_API
\12
+       $em\9dc_\9a\99\9flize_´oxy_ma\9a
+()
+
+47 
+       `EM_DEBUG_FUNC_BEGIN
+();
+
+49 ià(
+»ã»nû
+ > 0) {
+
+50 
+       `EM_DEBUG_EXCEPTION
+("AÌ\97dy IÁ\9flized\84eã»nû[%d]", 
+»ã»nû
+);
+
+51 \15 
+EMF_ERROR_NONE
+;
+
+54 
+»ã»nû
+++;
+
+56 ià(!
+       `em\9dc_¡¬t_´oxy_sock\91
+()) {
+
+57 
+       `EM_DEBUG_EXCEPTION
+("Socket start failed");
+
+58 \15 
+EMF_ERROR_IPC_CONNECTION_FAILURE
+;
+
+61 
+       `EM_DEBUG_LOG
+("Sock\91 ID : %d", 
+       `em\9dc_g\91_´oxy_sock\91_id
+());
+
+62 
+       `EM_DEBUG_FUNC_END
+();
+
+63 \15 
+EMF_ERROR_NONE
+;
+
+64 
+       }
+}
+
+66 
+EXPORT_API
\12
+       $em\9dc_f\9a®ize_´oxy_ma\9a
+()
+
+68 
+       `EM_DEBUG_FUNC_BEGIN
+();
+
+70 ià(--
+»ã»nû
+ > 0) {
+
+71 
+       `EM_DEBUG_EXCEPTION
+("MÜ\90thª oÃ\84eã»nû[%d]", 
+»ã»nû
+);
+
+72 \15 
+EMF_ERROR_NONE
+;
+
+80 
+       `EM_DEBUG_FUNC_END
+();
+
+81 \15 
+EMF_ERROR_NONE
+;
+
+82 
+       }
+}
+
+84 
+EXPORT_API
+boÞ
+       $em\9dc_execu\8b_­i_of_´oxy_ma\9a
+(
+em\9dc_ema\9e_­i_\9afo
+ *
+­i_\9afo
+)
+
+86 
+       `EM_DEBUG_FUNC_BEGIN
+();
+
+88 \12
+»t
+;
+
+89 \ 5*
+\9a_¡»am
+ = (\ 5*)
+       `em\9dc_g\91_¡»am_of_­i_\9afo
+(
+­i_\9afo
+, 
+ePARAMETER_IN
+);
+
+90 \12
+Ëngth
+ = 
+       `em\9dc_g\91_¡»am_Ëngth_of_­i_\9afo
+(
+­i_\9afo
+, 
+ePARAMETER_IN
+);
+
+91 
+boÞ
+»suÉ
+ = 
+çl£
+;
+
+92 \12
+£nd\9ag_by\8bs
+;
+
+94 ià(!
+­i_\9afo
+) {
+
+95 
+       `EM_DEBUG_EXCEPTION
+("Invalid Parameter");
+
+96 \15 
+çl£
+;
+
+99 
+       `ENTER_CRITICAL_SECTION
+(
+\9dc_´oxy_mu\8bx
+);
+
+100 
+£nd\9ag_by\8bs
+ = 
+       `em\9dc_£nd_´oxy_sock\91
+(
+\9a_¡»am
+, 
+Ëngth
+);
+
+101 
+       `LEAVE_CRITICAL_SECTION
+(
+\9dc_´oxy_mu\8bx
+);
+
+103 
+       `EM_DEBUG_LOG
+("Proxy=>¡ub s\92d\9ag %d by\8b.", 
+£nd\9ag_by\8bs
+);
+
+105 ià(
+£nd\9ag_by\8bs
+ > 0) {
+
+106 #ifdeà
+IPCLIB_STREAM_TRACE_ON
+
+
+107 \12
+\9adex
+ = 0;
+
+108 \ f
+\9adex
+=0;\9adex<
+Ëngth
+;index++)
+
+109 
+       `EM_DEBUG_LOG
+("\9a_¡»am[\9adex] : [%x]", 
+\9a_¡»am
+[
+\9adex
+]);
+
+111 \ 5*
+\9dc_buf
+ = 
+NULL
+;
+
+113 
+       `ENTER_CRITICAL_SECTION
+(
+\9dc_´oxy_mu\8bx
+);
+
+114 
+»t
+ = 
+       `em\9dc_»cv_´oxy_sock\91
+(&
+\9dc_buf
+);
+
+115 
+       `LEAVE_CRITICAL_SECTION
+(
+\9dc_´oxy_mu\8bx
+);
+
+117 
+       `EM_DEBUG_LOG
+("Recv\86\92gth : %d", 
+»t
+);
+
+119 ià(
+»t
+ > 0)
+
+120 
+»suÉ
+ = 
+       `em\9dc_·r£_¡»am_of_­i_\9afo
+(
+­i_\9afo
+, 
+ePARAMETER_OUT
+, 
+\9dc_buf
+);
+
+122 
+»suÉ
+ = 
+çl£
+;
+
+124 
+       `EM_SAFE_FREE
+(
+\9dc_buf
+);
+
+127 
+       `EM_DEBUG_FUNC_END
+();
+
+128 \15 
+»suÉ
+;
+
+129 
+       }
+}
+
+131 
+EXPORT_API
+boÞ
+       $em\9dc_di¥©ch_´oxy_ma\9a
+()
+
+133 
+       `EM_DEBUG_FUNC_BEGIN
+();
+
+135 \1d\ 5
+¡»am
+[
+IPC_MSGQ_SIZE
+];
+
+136 
+em\9dc_ema\9e_­i_\9afo
+ *
+­i_\9afo
+ = 
+NULL
+;
+
+137 \12
+­i_id
+ = 0;
+
+138 \12
+¡»am_Ëngth
+ = 0;
+
+140 \1f!
+»cv_¡Ý_æag
+) {
+
+141 
+       `mem£t
+(
+¡»am
+, 0x00, \17(stream));
+
+143 ià(
+       `emcm_»cv_msg
+(
+¡»am
+, \17(stream)) > 0) {
+
+144 
+­i_\9afo
+ = (
+em\9dc_ema\9e_­i_\9afo
+ *)
+       `m®loc
+(\17(emipc_email_api_info));
+
+145 ià(
+­i_\9afo
+ =ð
+NULL
+) {
+
+146 
+       `EM_DEBUG_EXCEPTION
+("Malloc failed.");
+
+147 \15 
+çl£
+;
+
+149 
+       `mem£t
+(
+­i_\9afo
+, 0x00, \17(
+em\9dc_ema\9e_­i_\9afo
+));
+
+151 
+­i_id
+ = *((\12*)
+¡»am
+);
+
+153 
+       `em\9dc_£t_­i_id_of_­i_\9afo
+(
+­i_\9afo
+, 
+­i_id
+);
+
+154 
+       `em\9dc_·r£_¡»am_of_­i_\9afo
+(
+­i_\9afo
+, 
+ePARAMETER_OUT
+, 
+¡»am
+);
+
+155 
+¡»am_Ëngth
+ = 
+       `em\9dc_g\91_¡»am_Ëngth_of_­i_\9afo
+(
+­i_\9afo
+, 
+ePARAMETER_OUT
+);
+
+156 
+       `EM_DEBUG_LOG
+("Proxy Mes§g\90Queu\90Recv [­i_id=%x], [Recv_Ën=%d]", 
+­i_id
+, 
+¡»am_Ëngth
+);
+
+158 #ifdeà
+IPCLIB_STREAM_TRACE_ON
+
+
+159 \12
+\9adex
+ = 0;
+
+160 \ f
+\9adex
+ = 0; index<
+¡»am_Ëngth
+; index++)
+
+161 
+       `EM_DEBUG_LOG
+("[%x]", 
+¡»am
+[
+\9adex
+]);
+
+164 
+       `u¦\93p
+(1000);
+
+166 
+       `EM_DEBUG_FUNC_END
+();
+
+167 \15 
+çl£
+;
+
+168 
+       }
+}
+
+       @email-proxy/email-proxy-socket.c
+
+24 \ 2
+       ~<uni¡d.h
+>
+
+25 \ 2
+       ~<sys/£Ëù.h
+>
+
+27 \ 2
+       ~"ema\9e-\9dc-bu\9ed.h
+"
+
+28 \ 2
+       ~"ema\9e-´oxy-sock\91.h
+"
+
+29 \ 2
+       ~"ema\9e-\9dc-sock\91.h
+"
+
+31 \ 2
+       ~"ema\9e-debug-log.h
+"
+
+33 \18\12
+       g´oxy_sock\91_fd
+ = 0;
+
+35 
+EXPORT_API
+boÞ
+       $em\9dc_¡¬t_´oxy_sock\91
+()
+
+37 
+       `EM_DEBUG_FUNC_BEGIN
+();
+
+38 \12
+»t
+ = 
+\8cue
+;
+
+40 
+»t
+ = 
+       `em\9dc_\9a\99_ema\9e_sock\91
+(&
+´oxy_sock\91_fd
+);
+
+41 ià(!
+»t
+)
+
+42 
+»t
+ = 
+çl£
+;
+
+44 
+»t
+ = 
+       `em\9dc_cÚÃù_ema\9e_sock\91
+(
+´oxy_sock\91_fd
+);
+
+46 \15 
+»t
+;
+
+47 
+       }
+}
+
+49 
+EXPORT_API
+boÞ
+       $em\9dc_\92d_´oxy_sock\91
+()
+
+51 
+       `EM_DEBUG_FUNC_BEGIN
+();
+
+52 
+       `EM_DEBUG_LOG
+("[IPCLib]\83mipc_end_proxy_socket_fd");
+
+54 ià(
+´oxy_sock\91_fd
+) {
+
+55 
+       `em\9dc_þo£_ema\9e_sock\91
+(
+´oxy_sock\91_fd
+);
+
+58 \15 
+\8cue
+;
+
+59 
+       }
+}
+
+61 
+EXPORT_API
\12
+       $em\9dc_£nd_´oxy_sock\91
+(\ 5*
+d©a
+, \12
+Ën
+)
+
+63 
+       `EM_DEBUG_FUNC_BEGIN
+();
+
+64 ià(
+´oxy_sock\91_fd
+ && 
+       `em\9dc_is_cÚÃùed_ema\9e_sock\91
+(proxy_socket_fd)) {
+
+65 \15 
+       `em\9dc_£nd_ema\9e_sock\91
+(
+´oxy_sock\91_fd
+, 
+d©a
+, 
+Ën
+);
+
+67 
+       `EM_DEBUG_EXCEPTION
+("[IPCLib]\83mipc_send_proxy_socket_fd\82ot connect");
+
+70 
+       }
+}
+
+72 
+EXPORT_API
\12
+       $em\9dc_g\91_´oxy_sock\91_id
+()
+
+74 
+       `EM_DEBUG_FUNC_BEGIN
+();
+
+75 \15 
+´oxy_sock\91_fd
+;
+
+76 
+       }
+}
+
+78 
+EXPORT_API
\12
+       $em\9dc_»cv_´oxy_sock\91
+(\ 5**
+d©a
+)
+
+80 
+       `EM_DEBUG_FUNC_BEGIN
+();
+
+82 \12
+»cv_Ën
+ = 0;
+
+84 ià(
+´oxy_sock\91_fd
+)
+
+85 
+»cv_Ën
+ = 
+       `em\9dc_»cv_ema\9e_sock\91
+(
+´oxy_sock\91_fd
+, 
+d©a
+);
+
+87 
+       `EM_DEBUG_EXCEPTION
+("[IPCLib]\85roxy_sock\91_fd[%p] i nÙ\87va\9eabË o¸discÚÃùed", 
+´oxy_sock\91_fd
+);
+
+91 ià(
+»cv_Ën
+ == 0) {
+
+92 
+       `EM_DEBUG_EXCEPTION
+("[IPCLib] Proxy\84ecv d\96\91\90%x", 
+´oxy_sock\91_fd
+);
+
+93 
+       `em\9dc_þo£_ema\9e_sock\91
+(
+´oxy_sock\91_fd
+);
+
+94 } \vià(
+»cv_Ën
+ == -1) {
+
+95 
+       `EM_DEBUG_EXCEPTION
+("[IPCLib] Proxy\84ecv\83rror");
+
+98 \15 
+»cv_Ën
+;
+
+99 
+       }
+}
+
+       @email-proxy/include/email-proxy-callback-info.h
+
+23 #iâdeà
+_IPC_CALLBACK_INFO_H_
+
+
+24 \ 1
+       #_IPC_CALLBACK_INFO_H_
+
+
+       )
+
+26 \ 2
+       ~"ema\9e-ty³s.h
+"
+
+29 \12
+       m­i_id
+;
+
+30 \1e*
+       mâ_ÿÎback
+;
+
+31 } 
+       tem\9dc_ema\9e_cb_\9afo
+;
+
+       @email-proxy/include/email-proxy-main.h
+
+24 #iâdef 
+_IPC_PROXY_MAIN_H_
+
+
+25 \ 1
+       #_IPC_PROXY_MAIN_H_
+
+
+       )
+
+27 \ 2
+       ~"ema\9e-\9dc-­i-\9afo.h
+"
+
+28 \ 2
+       ~"ema\9e-ty³s.h
+"
+
+30 
+EXPORT_API
\12
+em\9dc_\9a\99\9flize_´oxy_ma\9a
+();
+
+32 
+EXPORT_API
\12
+em\9dc_f\9a®ize_´oxy_ma\9a
+();
+
+34 
+EXPORT_API
+boÞ
+em\9dc_execu\8b_­i_of_´oxy_ma\9a
+(
+em\9dc_ema\9e_­i_\9afo
+ *
+­i_\9afo
+);
+
+36 
+EXPORT_API
+boÞ
+em\9dc_di¥©ch_´oxy_ma\9a
+();
+
+       @email-proxy/include/email-proxy-socket.h
+
+24 #iâdef 
+_IPC_PROXY_SOCKET_H_
+
+
+25 \ 1
+       #_IPC_PROXY_SOCKET_H_
+
+
+       )
+
+27 \ 2
+       ~"ema\9e-ty³s.h
+"
+
+29 
+EXPORT_API
+boÞ
+em\9dc_¡¬t_´oxy_sock\91
+();
+
+31 
+EXPORT_API
+boÞ
+em\9dc_\92d_´oxy_sock\91
+();
+
+33 
+EXPORT_API
\12
+em\9dc_£nd_´oxy_sock\91
+(\ 5*
+d©a
+, \12
+Ën
+);
+
+35 
+EXPORT_API
\12
+em\9dc_g\91_´oxy_sock\91_id
+();
+
+37 
+EXPORT_API
\12
+em\9dc_»cv_´oxy_sock\91
+(\ 5**
+d©a
+);
+
+       @email-socket/email-ipc-socket.c
+
+23 \ 2
+       ~"ema\9e-\9dc-sock\91.h
+"
+
+24 \ 2
+       ~"ema\9e-\9dc-bu\9ed.h
+"
+
+26 \ 2
+       ~"ema\9e-debug-log.h
+"
+
+27 \ 2
+       ~"ema\9e-ty³s.h
+"
+
+29 \ 2
+       ~<glib.h
+>
+
+31 \ 2
+       ~<sys/sock\91.h
+>
+
+32 \ 2
+       ~<sys/un.h
+>
+
+33 \ 2
+       ~<sys/ioùl.h
+>
+
+34 \ 2
+       ~<sys/ty³s.h
+>
+
+35 \ 2
+       ~<sys/¡©.h
+>
+
+36 \ 2
+       ~<m®loc.h
+>
+
+38 \ 2
+       ~<\94ºo.h
+>
+
+39 \ 2
+       ~<uni¡d.h
+>
+
+41 \ 2
+       ~"sd-d«mÚ.h
+"
+
+43 \18
+GHashTabË
+ *
+       ghash_\8f
+ = 
+NULL
+;
+
+44 \18
+boÞ
+       gcÚÃùed
+ = 
+çl£
+;
+
+46 
+EXPORT_API
+boÞ
+       $em\9dc_\9a\99_ema\9e_sock\91
+(\12*
+fd
+)
+
+48 
+boÞ
+»t
+ = 
+\8cue
+;
+
+50 
+hash_\8f
+ = 
+       `g_hash_\8fbË_Ãw
+(
+g_\9at_hash
+, 
+g_\9at_equ®
+);
+
+52 *
+fd
+ = 
+       `sock\91
+(
+AF_UNIX
+, 
+SOCK_STREAM
+, 0);
+
+54 ià(*
+fd
+ < 0) {
+
+55 
+       `EM_DEBUG_EXCEPTION
+("sock\91 c»©iÚ fa\9es!!!: %s", 
+       `¡»¼Ü
+(
+\94ºo
+));
+
+56 
+»t
+ = 
+çl£
+;
+
+59 
+       `EM_DEBUG_LOG
+("Sock\91 fd = %d", *
+fd
+);
+
+61 \15 
+»t
+;
+
+62 
+       }
+}
+
+65 
+EXPORT_API
+boÞ
+       $em\9dc_þo£_ema\9e_sock\91
+(\12
+fd
+)
+
+67 
+       `EM_DEBUG_FUNC_BEGIN
+("fd[%d]\81Øb\90»moved", 
+fd
+);
+
+68 \12
+»t
+ = 
+\8cue
+;
+
+70 ià(!
+       `g_hash_\8fbË_»move
+(
+hash_\8f
+, 
+       `GINT_TO_POINTER
+(
+fd
+))) {
+
+71 
+       `EM_DEBUG_LOG
+("NØm©ch\9ag sock\91 fd [%d]", 
+fd
+);
+
+72 
+»t
+ = 
+çl£
+;
+
+75 
+       `EM_DEBUG_LOG
+("fd %d\84emov® dÚe", 
+fd
+);
+
+76 
+       `þo£
+(
+fd
+);
+
+78 
+cÚÃùed
+ = 
+çl£
+;
+
+79 
+       `EM_DEBUG_FUNC_END
+();
+
+80 \15 
+»t
+;
+
+81 
+       }
+}
+
+83 
+EXPORT_API
+boÞ
+       $em\9dc_is_cÚÃùed_ema\9e_sock\91
+()
+
+85 \15 
+cÚÃùed
+;
+
+86 
+       }
+}
+
+88 \18\12
+       $em\9dc_wr\99\92
+(\12
+fd
+, cڡ \ 5*
+buf
+, \12
+Ën
+)
+
+90 \12
+Ëngth
+ = 
+Ën
+;
+
+91 \12
+·s£d_Ën
+ = 0;
+
+93 \1f
+Ëngth
+ > 0) {
+
+94 
+·s£d_Ën
+ = 
+       `£nd
+(
+fd
+, (cڡ \1e*)
+buf
+, 
+Ëngth
+, 
+MSG_NOSIGNAL
+);
+
+95 ià(
+·s£d_Ën
+ == -1) {
+
+96 
+       `EM_DEBUG_LOG
+("wr\99\90: %s", 
+       `EM_STRERROR
+(
+\94ºo
+));
+
+97 ià(
+\94ºo
+ =ð
+EINTR
+) \ 6;
+
+98 \15 
+·s£d_Ën
+;
+
+99 } \vià(
+·s£d_Ën
+ == 0)
+
+101 
+Ëngth
+ -ð
+·s£d_Ën
+;
+
+102 
+buf
+ +ð
+·s£d_Ën
+;
+
+104 \15 (
+Ën
+ - 
+Ëngth
+);
+
+105 
+       }
+}
+
+107 
+EXPORT_API
\12
+       $em\9dc_£nd_ema\9e_sock\91
+(\12
+fd
+, \ 5*
+buf
+, \12
+Ën
+)
+
+109 
+       `EM_DEBUG_FUNC_BEGIN
+("fd [%d], bufã¸[%p], buf_ËÀ[%d]", 
+fd
+, 
+buf
+, 
+Ën
+);
+
+111 \12
+£nd_by\8bs
+ = \17(\12)+
+Ën
+;
+
+112 \12
+»t
+ = 0;
+
+113 \ 5
+bufãr
+[
+£nd_by\8bs
+];
+
+114 
+       `mem£t
+(
+bufãr
+, 0x00, 
+£nd_by\8bs
+);
+
+116 ià(!
+buf
+) {
+
+117 
+       `EM_DEBUG_EXCEPTION
+("No data\81o send");
+
+120 
+       `memýy
+(
+bufãr
+, (\ 5*)&
+Ën
+, \17(\12));
+
+121 
+       `memýy
+(
+bufãr
+ + \17(\12), 
+buf
+, 
+Ën
+);
+
+123 
+       `EM_DEBUG_LOG
+("S\92d\9ag %dB d©¨tØ[fd = %d]", 
+£nd_by\8bs
+, 
+fd
+);
+
+125 
+»t
+ = 
+       `em\9dc_wr\99\92
+(
+fd
+, 
+bufãr
+, 
+£nd_by\8bs
+);
+
+127 
+       `EM_DEBUG_FUNC_END
+();
+
+128 \15 
+»t
+;
+
+129 
+       }
+}
+
+131 \18\12
+       $em\9dc_»adn
+(\12
+fd
+, \ 5*
+buf
+, \12
+Ën
+)
+
+133 \12
+Ëngth
+ = 
+Ën
+;
+
+134 \12
+»ad_Ën
+ = 0;
+
+136 \1f
+Ëngth
+ > 0) {
+
+137 
+»ad_Ën
+ = 
+       `»ad
+(
+fd
+, (\1e*)
+buf
+, 
+Ëngth
+);
+
+138 ià(
+»ad_Ën
+ < 0) {
+
+139 
+       `EM_DEBUG_EXCEPTION
+("R\97d : %s", 
+       `EM_STRERROR
+(
+\94ºo
+));
+
+140 ià(
+\94ºo
+ =ð
+EINTR
+) \ 6;
+
+141 \15 
+»ad_Ën
+;
+
+142 } \vià(
+»ad_Ën
+ == 0)
+
+145 
+Ëngth
+ -ð
+»ad_Ën
+;
+
+146 
+buf
+ +ð
+»ad_Ën
+;
+
+148 \15 (
+Ën
+-
+Ëngth
+);
+
+149 
+       }
+}
+
+151 
+EXPORT_API
\12
+       $em\9dc_»cv_ema\9e_sock\91
+(\12
+fd
+, \ 5**
+buf
+)
+
+153 
+       `EM_DEBUG_FUNC_BEGIN
+();
+
+155 \12
+Ën
+ = 0;
+
+156 \12
+»ad_Ën
+ = 0;
+
+158 ià(!
+buf
+) {
+
+159 
+       `EM_DEBUG_LOG
+("Buffer must\82ot\82ull");
+
+160 \15 
+EMF_ERROR_INVALID_PARAM
+;
+
+163 
+       `EM_DEBUG_LOG
+("[IPC Socket] Receiving header begins");
+
+164 
+»ad_Ën
+ = 
+       `em\9dc_»adn
+(
+fd
+, (\ 5*)&
+Ën
+, \17(\12));
+
+165 
+       `EM_DEBUG_LOG
+("[IPC Scok\91] Reûiv\9ag h\97d\94 %dB d©a", 
+Ën
+);
+
+167 ià(
+»ad_Ën
+ == 0)
+
+168 \15 
+»ad_Ën
+;
+
+169 \vià(
+»ad_Ën
+ != \17(\12)) {
+
+170 
+       `EM_DEBUG_LOG
+("WARNING: R\97d h\97d\94_size[%d]\82Ù m©ched [%d]", 
+»ad_Ën
+, \17(\12));
+
+171 \15 
+EMF_ERROR_IPC_SOCKET_FAILURE
+;
+
+174 *
+buf
+ = (\1e*)
+       `m®loc
+(
+Ën
+);
+
+175 ià(*
+buf
+ =ð
+NULL
+) {
+
+176 
+       `EM_DEBUG_EXCEPTION
+("Malloc failed");
+
+177 \15 
+EMF_ERROR_OUT_OF_MEMORY
+;
+
+179 
+       `mem£t
+(*
+buf
+, 0x00, 
+Ën
+);
+
+181 
+       `EM_DEBUG_LOG
+("[IPC Sock\91] Reûiv\9ag Body beg\9a fÜ [%d] by\8bs", 
+Ën
+);
+
+182 
+»ad_Ën
+ = 
+       `em\9dc_»adn
+(
+fd
+, *
+buf
+, 
+Ën
+);
+
+183 ià(
+»ad_Ën
+ !ð
+Ën
+) {
+
+184 
+       `EM_SAFE_FREE
+(*
+buf
+);
+
+185 
+       `EM_DEBUG_LOG
+("WARNING: R\97d buf_siz\90[%d] !ð»ad_Ën[%d]", 
+»ad_Ën
+, 
+Ën
+);
+
+186 \15 
+EMF_ERROR_IPC_SOCKET_FAILURE
+;
+
+188 
+       `EM_DEBUG_LOG
+("[IPC Sock\91] Reûiv\9ag [%d] by\8b Com¶\91ed", 
+Ën
+);
+
+190 \15 
+»ad_Ën
+;
+
+191 
+       }
+}
+
+193 
+EXPORT_API
\12
+       $em\9dc_acû±_ema\9e_sock\91
+(\12
+fd
+)
+
+195 
+       `EM_DEBUG_FUNC_BEGIN
+();
+
+197 ià(
+fd
+ == -1) {
+
+198 
+       `EM_DEBUG_LOG
+("Server_socket\82ot init");
+
+199 \15 
+EMF_ERROR_INVALID_PARAM
+;
+
+202 \19
+sockaddr_un
+»mÙe
+;
+
+203 \12
+»mÙe_Ën
+ = \17(
+»mÙe
+);
+
+204 \12
\9bÁ_fd
+ = 
+       `acû±
+(
+fd
+, (\19
+sockaddr
+ *)&
+»mÙe
+, (
+sockËn_t
+*è&
+»mÙe_Ën
+);
+
+205 ià(
\9bÁ_fd
+ == -1) {
+
+206 
+       `EM_DEBUG_LOG
+("acû±: %s", 
+       `EM_STRERROR
+(
+\94ºo
+));
+
+207 \15 
+EMF_ERROR_IPC_SOCKET_FAILURE
+;
+
+210 
+       `em\9dc_add_sock\91_fd
+(
\9bÁ_fd
+);
+
+211 
+       `EM_DEBUG_LOG
+("%d i added", 
\9bÁ_fd
+);
+
+213 
+       `EM_DEBUG_FUNC_END
+();
+
+214 \15 
\9bÁ_fd
+;
+
+215 
+       }
+}
+
+217 
+EXPORT_API
\12
+       $em\9dc_Ý\92_ema\9e_sock\91
+(\12
+fd
+, cڡ \ 5*
+·th
+)
+
+219 
+       `EM_DEBUG_FUNC_BEGIN
+("·th [%s]", 
+·th
+);
+
+220 \12
+sock_fd
+ = 0;
+
+222 ià(
+       `¡rcmp
+(
+·th
+, 
+EM_SOCKET_PATH
+) == 0 &&
+
+223 
+       `sd_li¡\92_fds
+(1) == 1 &&
+
+224 
+       `sd_is_sock\91_unix
+(
+SD_LISTEN_FDS_START
+, 
+SOCK_STREAM
+, -1, 
+EM_SOCKET_PATH
+, 0) > 0) {
+
+225 
+       `þo£
+(
+fd
+);
+
+226 
+sock_fd
+ = 
+SD_LISTEN_FDS_START
+ + 0;
+
+227 
+       `em\9dc_add_sock\91_fd
+(
+sock_fd
+);
+
+228 \15 
+sock_fd
+;
+
+231 ià(!
+·th
+ || 
+       `¡¾\92
+(path) > 108) {
+
+232 
+       `EM_DEBUG_LOG
+("Path is\82ull");
+
+233 \15 
+EMF_ERROR_IPC_SOCKET_FAILURE
+;
+
+236 ià(
+fd
+ <= 0) {
+
+237 
+       `EM_DEBUG_LOG
+("Sock\91\82Ù c»©ed %d", 
+fd
+);
+
+238 \15 
+EMF_ERROR_IPC_SOCKET_FAILURE
+;
+
+241 \19
+sockaddr_un
+loÿl
+;
+
+242 
+loÿl
+.
+sun_çm\9ey
+ = 
+AF_UNIX
+;
+
+243 
+       `¡rýy
+(
+loÿl
+.
+sun_·th
+, 
+·th
+);
+
+244 
+       `uƚk
+(
+loÿl
+.
+sun_·th
+);
+
+246 \12
+Ën
+ = 
+       `¡¾\92
+(
+loÿl
+.
+sun_·th
+è+ \17Öoÿl.
+sun_çm\9ey
+);
+
+248 ià(
+       `b\9ad
+(
+fd
+, (\19
+sockaddr
+ *)&
+loÿl
+, 
+Ën
+) == -1) {
+
+249 
+       `EM_DEBUG_LOG
+("b\9ad: %s", 
+       `EM_STRERROR
+(
+\94ºo
+));
+
+250 \15 
+EMF_ERROR_IPC_SOCKET_FAILURE
+;
+
+264 
+mode_t
+sock_mode
+ = (
+S_IRWXU
+ | 
+S_IRWXG
+ | 
+S_IRWXO
+);
+
+266 ià(
+       `chmod
+(
+·th
+, 
+sock_mode
+) == -1) {
+
+267 
+       `EM_DEBUG_LOG
+("chmod: %s", 
+       `EM_STRERROR
+(
+\94ºo
+));
+
+268 \15 
+EMF_ERROR_IPC_SOCKET_FAILURE
+;
+
+271 ià(
+       `li¡\92
+(
+fd
+, 10) == -1) {
+
+272 
+       `EM_DEBUG_LOG
+("li¡\92: %s", 
+       `EM_STRERROR
+(
+\94ºo
+));
+
+273 \15 
+EMF_ERROR_IPC_SOCKET_FAILURE
+;
+
+276 
+       `em\9dc_add_sock\91_fd
+(
+fd
+);
+
+278 
+       `EM_DEBUG_FUNC_END
+();
+
+279 \15 
+fd
+;
+
+280 
+       }
+}
+
+282 
+EXPORT_API
+boÞ
+       $em\9dc_cÚÃù_ema\9e_sock\91
+(\12
+fd
+)
+
+284 
+       `EM_DEBUG_FUNC_BEGIN
+();
+
+285 \12
+»t
+ = 
+\8cue
+;
+
+286 \19
+sockaddr_un
+£rv\94
+;
+
+287 
+£rv\94
+.
+sun_çm\9ey
+ = 
+AF_UNIX
+;
+
+288 
+       `¡rýy
+(
+£rv\94
+.
+sun_·th
+, 
+EM_SOCKET_PATH
+);
+
+290 \12
+Ën
+ = 
+       `¡¾\92
+(
+£rv\94
+.
+sun_·th
+è+ \17(£rv\94.
+sun_çm\9ey
+);
+
+292 ià(
+       `cÚÃù
+(
+fd
+, (\19
+sockaddr
+ *)&
+£rv\94
+, 
+Ën
+) == -1) {
+
+293 
+       `EM_DEBUG_LOG
+("CªnÙ cÚÃù s\94v\94 %s", 
+       `EM_STRERROR
+(
+\94ºo
+));
+
+294 
+»t
+ = 
+çl£
+;
+
+296 
+       `em\9dc_add_sock\91_fd
+(
+fd
+);
+
+297 
+cÚÃùed
+ = 
+\8cue
+;
+
+300 \15 
+»t
+;
+
+301 
+       }
+}
+
+303 
+EXPORT_API
+boÞ
+       $em\9dc_add_sock\91_fd
+(\12
+fd
+)
+
+305 
+       `EM_DEBUG_LOG
+("[%d]\87dded", 
+fd
+);
+
+306 \12
+»t
+ = 
+\8cue
+;
+
+307 \12
+key
+ = 
+fd
+;
+
+308 \12
+\9aput_d©a
+ = 
+fd
+;
+
+310 ià(
+       `g_hash_\8fbË_lookup
+(
+hash_\8f
+, &
+key
+è!ð
+NULL
+) {
+
+311 
+       `EM_DEBUG_LOG
+("Du¶iÿ\8b FD %d", 
+fd
+);
+
+312 
+»t
+ = 
+çl£
+;
+
+315 
+       `g_hash_\8fbË_\9a£¹
+(
+hash_\8f
+, &
+key
+, &
+\9aput_d©a
+);
+
+317 \15 
+»t
+;
+
+318 
+       }
+}
+
+       @email-socket/include/email-ipc-socket.h
+
+23 #iâdeà
+_IPC_SOCKET_H_
+
+
+24 \ 1
+       #_IPC_SOCKET_H_
+
+
+       )
+
+26 \ 2
+       ~"ema\9e-ty³s.h
+"
+
+28 \ 1
+       #SOCKET_IP
+ "127.0.0.1"
+
+       )
+
+29 \ 1
+       #SOCKET_PORT
+ 9000
+
+       )
+
+31 \ 1
+       #BUF_SIZE
+ 204800
+
+       )
+
+32 \ 1
+       #OPT_USEC
+ 100000
+
+       )
+
+35 \ 1
+       #EM_SOCKET_PATH
+ "/tmp/.ema\9efw_sock\91"
+
+       )
+
+37 
+EXPORT_API
+boÞ
+em\9dc_\9a\99_ema\9e_sock\91
+(\12*
+fd
+);
+
+39 
+EXPORT_API
+boÞ
+em\9dc_þo£_ema\9e_sock\91
+(\12
+fd
+);
+
+41 
+EXPORT_API
+boÞ
+em\9dc_is_cÚÃùed_ema\9e_sock\91
+();
+
+43 
+EXPORT_API
\12
+em\9dc_£nd_ema\9e_sock\91
+(\12
+fd
+, \ 5*
+buf
+, \12
+Ën
+);
+
+45 
+EXPORT_API
\12
+em\9dc_»cv_ema\9e_sock\91
+(\12
+fd
+, \ 5**
+buf
+);
+
+47 
+EXPORT_API
\12
+em\9dc_acû±_ema\9e_sock\91
+(\12
+fd
+);
+
+49 
+EXPORT_API
\12
+em\9dc_Ý\92_ema\9e_sock\91
+(\12
+fd
+, cڡ \ 5*
+·th
+);
+
+51 
+EXPORT_API
+boÞ
+em\9dc_cÚÃù_ema\9e_sock\91
+(\12
+fd
+);
+
+53 
+EXPORT_API
+boÞ
+em\9dc_add_sock\91_fd
+(\12
+fd
+);
+
+       @email-stub/email-stub-main.c
+
+24 \ 2
+       ~"ema\9e-¡ub-ma\9a.h
+"
+
+25 \ 2
+       ~"ema\9e-\9dc.h
+"
+
+26 \ 2
+       ~"ema\9e-¡ub-»¥Ú£-\9afo.h
+"
+
+27 \ 2
+       ~"ema\9e-\9dc-·¿m-li¡.h
+"
+
+28 \ 2
+       ~"ema\9e-\9dc-bu\9ed.h
+"
+
+29 \ 2
+       ~"ema\9e-commÚ-li¡.h
+"
+
+30 \ 2
+       ~"ema\9e-commÚ-msg-queue.h
+"
+
+31 \ 2
+       ~"ema\9e-¡ub-sock\91.h
+"
+
+33 \ 2
+       ~"ema\9e-­i.h
+"
+
+34 \ 2
+       ~"ema\9e-debug-log.h
+"
+
+36 \18
+boÞ
+       g¡ub_sock\91
+ = 
+çl£
+;
+
+37 \18
+boÞ
+       g»¥Ú£_li¡
+ = 
+çl£
+;
+
+38 \18
+boÞ
+       gmsg_£nd\94
+ = 
+çl£
+;
+
+39 \18
+PFN_EXECUTE_API
+       gthis_â_­i_m­³r
+ = 
+NULL
+;
+
+41 
+EXPORT_API
+boÞ
+       $em\9dc_\9a\99\9flize_¡ub_ma\9a
+(
+PFN_EXECUTE_API
+â_­i_m­³r
+)
+
+43 
+       `EM_DEBUG_FUNC_BEGIN
+();
+
+45 ià(!
+â_­i_m­³r
+) {
+
+46 
+       `EM_DEBUG_EXCEPTION
+("Invalid Param");
+
+47 \15 
+çl£
+;
+
+50 
+this_â_­i_m­³r
+ = 
+â_­i_m­³r
+;
+
+53 
+»¥Ú£_li¡
+ = 
+       `emcm_\9a\99_li¡
+();
+
+54 ià(!
+»¥Ú£_li¡
+) {
+
+55 
+       `EM_DEBUG_EXCEPTION
+("response_list did\82ot create\n");
+
+56 \15 
+çl£
+;
+
+60 
+msg_£nd\94
+ = 
+       `emcm_\9a\99_msg_queue
+(0);
+
+61 ià(!
+msg_£nd\94
+) {
+
+62 
+       `EM_DEBUG_EXCEPTION
+("Queue initialize failed.\n");
+
+63 \15 
+çl£
+;
+
+65 
+       `emcm_ü\97\8b_msg_qid
+();
+
+68 
+¡ub_sock\91
+ = 
+       `em\9dc_¡¬t_¡ub_sock\91
+();
+
+69 ià(!
+¡ub_sock\91
+) {
+
+70 
+       `EM_DEBUG_EXCEPTION
+("Socket did\82ot create");
+
+71 \15 
+çl£
+;
+
+74 
+       `EM_DEBUG_FUNC_END
+();
+
+75 \15 
+\8cue
+;
+
+76 
+       }
+}
+
+78 
+EXPORT_API
+boÞ
+       $em\9dc_f\9a®ize_¡ub_ma\9a
+()
+
+80 
+       `EM_DEBUG_FUNC_BEGIN
+();
+
+81 \12
+\9adex
+ = 0;
+
+83 ià(
+»¥Ú£_li¡
+) {
+
+84 \ f
+\9adex
+ = 0; index < 
+       `emcm_g\91_couÁ_of_li¡
+() ; index++) {
+
+85 
+em\9dc_ema\9e_»¥Ú£_\9afo
+ *
+»¥Ú£_\9afo
+ = (em\9dc_ema\9e_»¥Ú£_\9afØ*)
+       `emcm_g\91_©_of_li¡
+(
+\9adex
+);
+
+87 ià(
+»¥Ú£_\9afo
+)
+
+88 
+       `emcm_»move_\99em_of_li¡
+(
+»¥Ú£_\9afo
+);
+
+92 ià(
+msg_£nd\94
+) {
+
+93 ià(
+       `emcm_de¡roy_msg_qid
+())
+
+94 
+msg_£nd\94
+ = 
+çl£
+;
+
+97 ià(
+¡ub_sock\91
+) {
+
+98 
+       `em\9dc_\92d_¡ub_sock\91
+();
+
+99 
+¡ub_sock\91
+ = 
+çl£
+;
+
+102 ià(
+this_â_­i_m­³r
+)
+
+103 
+this_â_­i_m­³r
+ = 
+NULL
+;
+
+105 
+       `EM_DEBUG_FUNC_END
+();
+
+106 \15 
+\8cue
+;
+
+107 
+       }
+}
+
+109 
+EXPORT_API
+boÞ
+       $em\9dc_execu\8b_­i_´oxy_to_¡ub
+(
+em\9dc_ema\9e_­i_\9afo
+ *
+­i_\9afo
+)
+
+111 
+       `EM_DEBUG_FUNC_BEGIN
+();
+
+112 ià(!
+­i_\9afo
+) {
+
+113 
+       `EM_DEBUG_EXCEPTION
+("Invalid Param");
+
+114 \15 
+çl£
+;
+
+117 ià(
+this_â_­i_m­³r
+) {
+
+118 
+       `this_â_­i_m­³r
+(
+­i_\9afo
+);
+
+121 
+       `EM_DEBUG_FUNC_END
+();
+
+122 \15 
+\8cue
+;
+
+123 
+       }
+}
+
+125 
+EXPORT_API
+boÞ
+       $em\9dc_execu\8b_­i_¡ub_to_´oxy
+(
+em\9dc_ema\9e_­i_\9afo
+ *
+­i_\9afo
+)
+
+127 
+       `EM_DEBUG_FUNC_BEGIN
+("­i_\9afØ[%p]", 
+­i_\9afo
+);
+
+128 
+       `EM_IF_NULL_RETURN_VALUE
+(
+­i_\9afo
+, 
+çl£
+);
+
+129 
+       `EM_DEBUG_LOG
+("APIID [%s],\84e¥Ú£ Sock\91 ID [%d], APPID [%d]", 
+       `EM_APIID_TO_STR
+(
+       `em\9dc_g\91_­i_id_of_­i_\9afo
+(
+­i_\9afo
+)), 
+       `em\9dc_g\91_»¥Ú£_id_of_­i_\9afo
+×pi_\9afo), 
+       `em\9dc_g\91_­p_id_of_­i_\9afo
+(api_info));
+
+131 \1d\ 5*
+¡»am
+ = (\1d\ 5*)
+       `em\9dc_g\91_¡»am_of_­i_\9afo
+(
+­i_\9afo
+, 
+ePARAMETER_OUT
+);
+
+132 \12
+¡»am_Ëngth
+ = 
+       `em\9dc_g\91_¡»am_Ëngth_of_­i_\9afo
+(
+­i_\9afo
+, 
+ePARAMETER_OUT
+);
+
+134 
+       `EM_DEBUG_LOG
+("D©¨: %p, D©¨Ëngth : %dB", 
+¡»am
+, 
+¡»am_Ëngth
+);
+
+135 
+       `EM_DEBUG_LOG
+("Stub => Proxy S\92d\9ag %dB", 
+¡»am_Ëngth
+);
+
+136 
+       `em\9dc_£nd_¡ub_sock\91
+(
+       `em\9dc_g\91_»¥Ú£_id_of_­i_\9afo
+(
+­i_\9afo
+), 
+¡»am
+, 
+¡»am_Ëngth
+);
+
+138 #ifdeà
+IPCLIB_STREAM_TRACE_ON
+
+
+139 \12
+\9adex
+ = 0;
+
+140 \ f
+\9adex
+ = 0; index < 
+¡»am_Ëngth
+; index++)
+
+141 
+       `EM_DEBUG_LOG
+("S\8c\97m[\9adex] : [%d]", 
+¡»am
+[
+\9adex
+]);
+
+144 
+       `EM_DEBUG_FUNC_END
+();
+
+145 \15 
+\8cue
+;
+
+146 
+       }
+}
+
+148 
+EXPORT_API
+boÞ
+       $em\9dc_£t_»¥Ú£_\9afo
+(\13
+­p_id
+, \13
+­i_id
+)
+
+150 
+       `EM_DEBUG_FUNC_BEGIN
+("Re¥Ú£ ID [%d]", 
+­p_id
+);
+
+152 ià(
+­p_id
+ <= 0)
+
+153 \15 
+\8cue
+;
+
+155 
+em\9dc_ema\9e_»¥Ú£_\9afo
+ *
+»¥Ú£_\9afo
+ = 
+NULL
+;
+
+156 
+»¥Ú£_\9afo
+ = (
+em\9dc_ema\9e_»¥Ú£_\9afo
+ *)
+       `m®loc
+(\17(response_info));
+
+157 ià(
+»¥Ú£_\9afo
+ =ð
+NULL
+) {
+
+158 
+       `EM_DEBUG_EXCEPTION
+("Malloc failed");
+
+159 \15 
+çl£
+;
+
+161 
+       `mem£t
+(
+»¥Ú£_\9afo
+, 0x00, \17(response_info));
+
+163 ià(
+»¥Ú£_\9afo
+) {
+
+164 
+       `em\9dc_£t_v®ue_\9a_»¥Ú£_\9afo
+(
+»¥Ú£_\9afo
+, 
+­p_id
+, 
+­i_id
+);
+
+165 
+       `emcm_add_\8f\9e_of_li¡
+(
+»¥Ú£_\9afo
+);
+
+166 \15 
+\8cue
+;
+
+168 
+       `EM_DEBUG_FUNC_END
+();
+
+169 \15 
+çl£
+;
+
+170 
+       }
+}
+
+       @email-stub/email-stub-queue.c
+
+23 \ 2
+       ~<¡dio.h
+>
+
+24 \ 2
+       ~<m®loc.h
+>
+
+26 \ 2
+       ~"ema\9e-¡ub-queue.h
+"
+
+27 \ 2
+       ~"ema\9e-\9dc-bu\9ed.h
+"
+
+29 \ 2
+       ~"ema\9e-debug-log.h
+"
+
+31 \18
+em\9dc_ema\9e_queue_\99em
+ *
+       gh\97d
+ = 
+NULL
+;
+
+32 \18
+em\9dc_ema\9e_queue_\99em
+ *
+       g\8f\9e
+ = 
+NULL
+;
+
+33 \12
+       gcouÁ
+ = 0;
+
+35 
+EXPORT_API
\1e*
+       $em\9dc_pÝ_\9a_queue
+()
+
+37 \1e*
+d©a
+ = 
+NULL
+;
+
+39 ià(
+h\97d
+) {
+
+40 
+em\9dc_ema\9e_queue_\99em
+ *
+pݳd
+ = 
+h\97d
+;
+
+41 
+d©a
+ = 
+pݳd
+->data;
+
+43 ià(
+pݳd
+->
+Ãxt
+) {
+
+44 
+h\97d
+ = 
+pݳd
+->
+Ãxt
+;
+
+46 
+h\97d
+ = 
+\8f\9e
+ = 
+NULL
+;
+
+49 
+       `EM_SAFE_FREE
+(
+pݳd
+);
+
+50 
+couÁ
+ = (count <= 0) ? 0 : count-1;
+
+52 \15 
+d©a
+;
+
+54 \15 
+NULL
+;
+
+55 
+       }
+}
+
+57 
+EXPORT_API
+boÞ
+       $em\9dc_push_\9a_queue
+(\1e*
+d©a
+)
+
+59 
+em\9dc_ema\9e_queue_\99em
+ *
+\99em
+ = 
+NULL
+;
+
+60 ià(!
+d©a
+) {
+
+61 
+       `EM_DEBUG_EXCEPTION
+("[IPCLib]\83mipc_push_in_queue - invalid input\n");
+
+62 \15 
+çl£
+;
+
+65 
+\99em
+ = (
+em\9dc_ema\9e_queue_\99em
+ *)
+       `m®loc
+(\17(emipc_email_queue_item));
+
+66 ià(
+\99em
+ =ð
+NULL
+) {
+
+67 
+       `EM_DEBUG_EXCEPTION
+("Malloc failed.");
+
+68 \15 
+çl£
+;
+
+70 
+       `mem£t
+(
+\99em
+, 0x00, \17(
+em\9dc_ema\9e_queue_\99em
+));
+
+72 
+\99em
+->
+d©a
+ = data;
+
+73 
+\99em
+->
+Ãxt
+ = 
+NULL
+;
+
+74 ià(
+\8f\9e
+) {
+
+75 
+\8f\9e
+->
+Ãxt
+ = 
+\99em
+;
+
+76 
+\8f\9e
+ = 
+\99em
+;
+
+78 
+h\97d
+ = 
+\8f\9e
+ = 
+\99em
+;
+
+81 
+couÁ
+++;
+
+83 \15 
+\8cue
+;
+
+84 
+       }
+}
+
+86 
+EXPORT_API
\12
+       $em\9dc_g\91_couÁ_of_\99em
+()
+
+88 \15 
+couÁ
+;
+
+89 
+       }
+}
+
+       @email-stub/email-stub-response-info.c
+
+22 \ 2
+       ~"ema\9e-¡ub-»¥Ú£-\9afo.h
+"
+
+24 
+EXPORT_API
+boÞ
+       $em\9dc_£t_v®ue_\9a_»¥Ú£_\9afo
+(
+em\9dc_ema\9e_»¥Ú£_\9afo
+ *
+»¥Ú£_\9afo
+, \13
+»¥Ú£_id
+, \13
+­i_id
+)
+
+26 
+»¥Ú£_\9afo
+->
+»¥Ú£_id
+ =\84esponse_id;
+
+27 
+»¥Ú£_\9afo
+->
+­i_id
+ =\87pi_id;
+
+28 \15 
+\8cue
+;
+
+29 
+       }
+}
+
+31 
+EXPORT_API
\13
+       $em\9dc_g\91_»¥Ú£_id_\9a_»¥Ú£_\9afo
+(
+em\9dc_ema\9e_»¥Ú£_\9afo
+ *
+»¥Ú£_\9afo
+)
+
+33 \15 
+»¥Ú£_\9afo
+->
+»¥Ú£_id
+;
+
+34 
+       }
+}
+
+36 
+EXPORT_API
\13
+       $em\9dc_g\91_­i_id_\9a_»¥Ú£_\9afo
+(
+em\9dc_ema\9e_»¥Ú£_\9afo
+ *
+»¥Ú£_\9afo
+)
+
+38 \15 
+»¥Ú£_\9afo
+->
+­i_id
+;
+
+39 
+       }
+}
+
+       @email-stub/email-stub-socket.c
+
+24 \ 2
+       ~<¡dlib.h
+>
+
+25 \ 2
+       ~<uni¡d.h
+>
+
+26 \ 2
+       ~<\94ºo.h
+>
+
+27 \ 2
+       ~<m®loc.h
+>
+
+28 \ 2
+       ~<sys/\95Þl.h
+>
+
+29 \ 2
+       ~<±h»ad.h
+>
+
+31 \ 2
+       ~"ema\9e-\9dc-bu\9ed.h
+"
+
+32 \ 2
+       ~"ema\9e-\9dc-­i-\9afo.h
+"
+
+33 \ 2
+       ~"ema\9e-\9dc-sock\91.h
+"
+
+34 \ 2
+       ~"ema\9e-¡ub-\8fsk.h
+"
+
+35 \ 2
+       ~"ema\9e-¡ub-\8fsk-mªag\94.h
+"
+
+36 \ 2
+       ~"ema\9e-¡ub-sock\91.h
+"
+
+38 \ 2
+       ~"ema\9e-debug-log.h
+"
+
+40 \ 1
+       #MAX_EPOLL_EVENT
+ 50
+
+       )
+
+42 \18\12
+       g¡ub_sock\91
+ = 0;
+
+43 \18
+±h»ad_t
+       g¡ub_sock\91_th»ad
+ = 0;
+
+44 \18
+boÞ
+       g¡Ý_th»ad
+ = 
+çl£
+;
+
+46 \18\1e*
+em\9dc_¡ub_sock\91_th»ad_´oc
+();
+
+48 
+EXPORT_API
+boÞ
+       $em\9dc_¡¬t_¡ub_sock\91
+()
+
+50 
+boÞ
+»t
+ = 
+\8cue
+;
+
+52 
+»t
+ = 
+       `em\9dc_\9a\99_ema\9e_sock\91
+(&
+¡ub_sock\91
+);
+
+53 ià(!
+»t
+) {
+
+54 
+       `EM_DEBUG_EXCEPTION
+("emipc_init_email_socket failed");
+
+55 \15 
+»t
+;
+
+58 
+»t
+ = 
+       `em\9dc_¡¬t_¡ub_sock\91_th»ad
+();
+
+59 ià(!
+»t
+) {
+
+60 
+       `EM_DEBUG_EXCEPTION
+("emipc_start_stub_socket_thread failed");
+
+61 \15 
+»t
+;
+
+64 
+»t
+ = 
+       `em\9dc_¡¬t_\8fsk_th»ad
+();
+
+65 ià(!
+»t
+) {
+
+66 
+       `EM_DEBUG_EXCEPTION
+("emipc_start_task_thread failed");
+
+67 \15 
+»t
+;
+
+70 \15 
+»t
+;
+
+71 
+       }
+}
+
+73 
+EXPORT_API
+boÞ
+       $em\9dc_¡¬t_¡ub_sock\91_th»ad
+()
+
+75 
+       `EM_DEBUG_LOG
+("[IPCLib]\83mipc_email_stub_socket_thread start");
+
+76 ià(
+¡ub_sock\91_th»ad
+)
+
+77 \15 
+\8cue
+;
+
+79 
+±h»ad_©\8c_t
+th»ad_©\8c
+;
+
+80 
+       `±h»ad_©\8c_\9a\99
+(&
+th»ad_©\8c
+);
+
+81 
+       `±h»ad_©\8c_£td\91ach¡©e
+(&
+th»ad_©\8c
+, 
+PTHREAD_CREATE_DETACHED
+);
+
+82 ià(
+       `±h»ad_ü\97\8b
+(&
+¡ub_sock\91_th»ad
+, &
+th»ad_©\8c
+, &
+em\9dc_¡ub_sock\91_th»ad_´oc
+, 
+NULL
+) != 0) {
+
+83 
+       `EM_DEBUG_EXCEPTION
+("[IPCLib]\83mipc_start_stub_socket_thread() - fail\81o create\87\81hread");
+
+84 \15 
+çl£
+;
+
+86 \15 
+\8cue
+;
+
+87 
+       }
+}
+
+89 
+EXPORT_API
+boÞ
+       $em\9dc_¡Ý_¡ub_sock\91_th»ad
+()
+
+91 ià(
+¡ub_sock\91_th»ad
+)
+
+92 
+¡Ý_th»ad
+ = 
+\8cue
+;
+
+94 \15 
+\8cue
+;
+
+95 
+       }
+}
+
+97 \18\1e*
+       $em\9dc_¡ub_sock\91_th»ad_´oc
+()
+
+99 
+       `em\9dc_wa\99_fÜ_\9dc_»que¡
+();
+
+100 
+¡ub_sock\91_th»ad
+ = 0;
+
+101 \15 
+NULL
+;
+
+102 
+       }
+}
+
+104 
+EXPORT_API
\1e
+       $em\9dc_wa\99_fÜ_\9dc_»que¡
+()
+
+106 \19
+\95Þl_ev\92t
+ev
+ = {0};
+
+107 \19
+\95Þl_ev\92t
+ev\92ts
+[
+MAX_EPOLL_EVENT
+] = {{0}, };
+
+108 \12
+\95fd
+ = 0;
+
+109 \12
+ev\92t_num
+ = 0;
+
+111 ià(!
+¡ub_sock\91
+) {
+
+112 
+       `EM_DEBUG_EXCEPTION
+("Server Socket is\82ot initialized");
+
+116 
+       `em\9dc_Ý\92_ema\9e_sock\91
+(
+¡ub_sock\91
+, 
+EM_SOCKET_PATH
+);
+
+118 
+\95fd
+ = 
+       `\95Þl_ü\97\8b
+(
+MAX_EPOLL_EVENT
+);
+
+119 ià(
+\95fd
+ < 0) {
+
+120 
+       `EM_DEBUG_EXCEPTION
+("\95Þl_ùl: %s[%d]", 
+       `¡»¼Ü
+(
+\94ºo
+),\83rrno);
+
+121 
+       `EM_DEBUG_CRITICAL_EXCEPTION
+("\95Þl_ü\97\8b: %s[%d]", 
+       `¡»¼Ü
+(
+\94ºo
+),\83rrno);
+
+122 
+       `abÜt
+();
+
+125 
+ev
+.
+ev\92ts
+ = 
+EPOLLIN
+;
+
+126 
+ev
+.
+d©a
+.
+fd
+ = 
+¡ub_sock\91
+;
+
+128 ià(
+       `\95Þl_ùl
+(
+\95fd
+, 
+EPOLL_CTL_ADD
+, 
+¡ub_sock\91
+, &
+ev
+) == -1) {
+
+129 
+       `EM_DEBUG_EXCEPTION
+("\95Þl_ùl: %s[%d]", 
+       `¡»¼Ü
+(
+\94ºo
+),\83rrno);
+
+130 
+       `EM_DEBUG_CRITICAL_EXCEPTION
+("\95Þl_ùl:%s[%d]", 
+       `¡»¼Ü
+(
+\94ºo
+),\83rrno);
+
+133 \12
+i
+ = 0;
+
+135 
+ev\92t_num
+ = 
+       `\95Þl_wa\99
+(
+\95fd
+, 
+ev\92ts
+, 
+MAX_EPOLL_EVENT
+, -1);
+
+137 ià(
+ev\92t_num
+ == -1) {
+
+138 
+       `EM_DEBUG_EXCEPTION
+("\95Þl_wa\99: %s[%d]", 
+       `¡»¼Ü
+(
+\94ºo
+),\83rrno);
+
+139 
+       `EM_DEBUG_CRITICAL_EXCEPTION
+("\95Þl_wa\99: %s[%d]", 
+       `¡»¼Ü
+(
+\94ºo
+),\83rrno);
+
+140 ià(
+\94ºo
+ =ð
+EINTR
+) \ 6;
+
+141 \v
+       `abÜt
+();
+
+143 \ f
+i
+ = 0; i < 
+ev\92t_num
+; i++) {
+
+144 \12
+ev\92t_fd
+ = 
+ev\92ts
+[
+i
+].
+d©a
+.
+fd
+;
+
+146 ià(
+ev\92t_fd
+ =ð
+¡ub_sock\91
+) {
+
+147 \12
+cfd
+ = 
+       `em\9dc_acû±_ema\9e_sock\91
+(
+¡ub_sock\91
+);
+
+148 ià(
+cfd
+ < 0) {
+
+149 
+       `EM_DEBUG_EXCEPTION
+("acû±\83¼Ü: %s[%d]", 
+       `¡»¼Ü
+(
+\94ºo
+),\83rrno);
+
+150 
+       `EM_DEBUG_CRITICAL_EXCEPTION
+("acû±\83¼Ü: %s[%d]", 
+       `¡»¼Ü
+(
+\94ºo
+),\83rrno);
+
+153 
+ev
+.
+ev\92ts
+ = 
+EPOLLIN
+;
+
+154 
+ev
+.
+d©a
+.
+fd
+ = 
+cfd
+;
+
+155 
+       `\95Þl_ùl
+(
+\95fd
+, 
+EPOLL_CTL_ADD
+, 
+cfd
+, &
+ev
+);
+
+157 \12
+»cv_Ën
+;
+
+158 \ 5*
+sz_buf
+ = 
+NULL
+;
+
+160 
+»cv_Ën
+ = 
+       `em\9dc_»cv_ema\9e_sock\91
+(
+ev\92t_fd
+, &
+sz_buf
+);
+
+162 if(
+»cv_Ën
+ > 0) {
+
+163 
+       `EM_DEBUG_LOG
+("====================================================================");
+
+164 
+       `EM_DEBUG_LOG
+("[IPCLib]Stub Sock\91 Recv [Sock\91 ID = %d], [»cv_ËÀð%d]", 
+ev\92t_fd
+, 
+»cv_Ën
+);
+
+165 
+       `EM_DEBUG_LOG
+("====================================================================");
+
+166 
+       `em\9dc_ü\97\8b_\8fsk
+((\1d\ 5*)
+sz_buf
+, 
+ev\92t_fd
+);
+
+168 
+       `EM_DEBUG_LOG
+("[IPCLib] Sock\91 [%d]\84emoved - [%d] ", 
+ev\92t_fd
+, 
+»cv_Ën
+);
+
+169 
+       `\95Þl_ùl
+(
+\95fd
+, 
+EPOLL_CTL_DEL
+, 
+ev\92t_fd
+, 
+ev\92ts
+);
+
+170 
+       `þo£
+(
+ev\92t_fd
+);
+
+172 if(
+sz_buf
+)
+
+173 
+       `EM_SAFE_FREE
+(
+sz_buf
+);
+
+178 
+       }
+}
+
+180 
+EXPORT_API
+boÞ
+       $em\9dc_\92d_¡ub_sock\91
+()
+
+182 
+       `EM_DEBUG_FUNC_BEGIN
+();
+
+184 ià(
+¡ub_sock\91
+) {
+
+185 
+       `em\9dc_þo£_ema\9e_sock\91
+(
+¡ub_sock\91
+);
+
+188 ià(
+¡ub_sock\91_th»ad
+) {
+
+189 
+       `em\9dc_¡Ý_¡ub_sock\91_th»ad
+(
+¡ub_sock\91_th»ad
+);
+
+190 
+       `±h»ad_ÿnûl
+(
+¡ub_sock\91_th»ad
+);
+
+191 
+¡ub_sock\91_th»ad
+ = 0;
+
+194 ià(!
+       `em\9dc_¡Ý_\8fsk_th»ad
+()) {
+
+195 
+       `EM_DEBUG_EXCEPTION
+("emipc_stop_task_thread failed");
+
+196 \15 
+çl£
+;
+
+199 \15 
+\8cue
+;
+
+200 
+       }
+}
+
+202 
+EXPORT_API
\12
+       $em\9dc_£nd_¡ub_sock\91
+(\12
+sock_fd
+, \1e*
+d©a
+, \12
+Ën
+)
+
+204 
+       `EM_DEBUG_FUNC_BEGIN
+("Stub sock\91 s\92d\9ag %d by\8bs", 
+Ën
+);
+
+206 \12
+£nd\9ag_by\8bs
+ = 
+       `em\9dc_£nd_ema\9e_sock\91
+(
+sock_fd
+, 
+d©a
+, 
+Ën
+);
+
+208 
+       `EM_DEBUG_FUNC_END
+("£nd\9ag_by\8b ð%d", 
+£nd\9ag_by\8bs
+);
+
+209 \15 
+£nd\9ag_by\8bs
+;
+
+210 
+       }
+}
+
+       @email-stub/email-stub-task-manager.c
+
+24 \ 2
+       ~<¡r\9ag.h
+>
+
+25 \ 2
+       ~<±h»ad.h
+>
+
+26 \ 2
+       ~<\94ºo.h
+>
+
+28 \ 2
+       ~"ema\9e-¡ub-\8fsk-mªag\94.h
+"
+
+29 \ 2
+       ~"ema\9e-¡ub-\8fsk.h
+"
+
+30 \ 2
+       ~"ema\9e-¡ub-queue.h
+"
+
+31 \ 2
+       ~"ema\9e-\9dc-bu\9ed.h
+"
+
+33 \ 2
+       ~"ema\9e-debug-log.h
+"
+
+34 \ 2
+       ~"ema\9e-­i.h
+"
+
+35 \ 2
+       ~"ema\9e-\9a\8bº®-ty³s.h
+"
+
+37 \18
+±h»ad_t
+       g\8fsk_th»ad
+ = 0;
+
+38 \18
+boÞ
+       g¡Ý_æag
+ = 
+çl£
+;
+
+40 
+±h»ad_mu\8bx_t
+       g\9dc_\8fsk_mu\8bx
+ = 
+PTHREAD_MUTEX_INITIALIZER
+;
+
+41 
+±h»ad_cÚd_t
+       g\9dc_\8fsk_cÚd
+ = 
+PTHREAD_COND_INITIALIZER
+;
+
+43 
+EXPORT_API
+boÞ
+       $em\9dc_¡¬t_\8fsk_th»ad
+()
+
+45 
+       `EM_DEBUG_FUNC_BEGIN
+();
+
+46 ià(
+\8fsk_th»ad
+)
+
+47 \15 
+\8cue
+;
+
+49 ià(
+       `±h»ad_ü\97\8b
+(&
+\8fsk_th»ad
+, 
+NULL
+, &
+em\9dc_do_\8fsk_th»ad
+, NULL) != 0) {
+
+50 
+       `EM_DEBUG_LOG
+("WÜk\94\81h»ad c»©iÚ fa\9eed: %s", 
+       `¡»¼Ü
+(
+\94ºo
+));
+
+51 \15 
+çl£
+;
+
+54 \15 
+\8cue
+;
+
+55 
+       }
+}
+
+57 
+EXPORT_API
\1e
+       $em\9dc_\8brm\9a©e_\8fsk_th»ad
+()
+
+59 
+       `em\9dc_¡Ý_\8fsk_th»ad
+();
+
+60 
+       `±h»ad_ÿnûl
+(
+\8fsk_th»ad
+);
+
+62 
+em\9dc_ema\9e_\8fsk
+ *
+\8fsk
+ = (em\9dc_ema\9e_\8fsk *)
+       `em\9dc_pÝ_\9a_queue
+();
+
+63 \1f
+\8fsk
+) {
+
+64 
+       `EM_SAFE_FREE
+(
+\8fsk
+);
+
+65 
+\8fsk
+ = (
+em\9dc_ema\9e_\8fsk
+ *)
+       `em\9dc_pÝ_\9a_queue
+();
+
+67 
+       }
+}
+
+69 
+EXPORT_API
+boÞ
+       $em\9dc_¡Ý_\8fsk_th»ad
+()
+
+71 
+¡Ý_æag
+ = 
+\8cue
+;
+
+72 \15 
+\8cue
+;
+
+73 
+       }
+}
+
+76 
+EXPORT_API
\1e*
+       $em\9dc_do_\8fsk_th»ad
+()
+
+78 
+       `EM_DEBUG_FUNC_BEGIN
+();
+
+80 
+em\9dc_ema\9e_\8fsk
+ *
+\8fsk
+ = 
+NULL
+;
+
+82 \1f!
+¡Ý_æag
+) {
+
+83 
+       `ENTER_CRITICAL_SECTION
+(
+\9dc_\8fsk_mu\8bx
+);
+
+84 \1f
+       `em\9dc_g\91_couÁ_of_\99em
+() == 0) {
+
+85 
+       `EM_DEBUG_LOG
+("Blocked uÁ\9e\82ew\81ask\87¼iv\94 %p.", &
+\9dc_\8fsk_cÚd
+);
+
+86 
+       `SLEEP_CONDITION_VARIABLE
+(
+\9dc_\8fsk_cÚd
+, 
+\9dc_\8fsk_mu\8bx
+);
+
+89 
+\8fsk
+ = (
+em\9dc_ema\9e_\8fsk
+ *)
+       `em\9dc_pÝ_\9a_queue
+();
+
+90 
+       `LEAVE_CRITICAL_SECTION
+(
+\9dc_\8fsk_mu\8bx
+);
+
+92 ià(
+\8fsk
+) {
+
+93 
+       `em\9dc_run_\8fsk
+(
+\8fsk
+);
+
+94 
+       `EM_SAFE_FREE
+(
+\8fsk
+);
+
+98 \15 
+NULL
+;
+
+99 
+       }
+}
+
+102 
+EXPORT_API
+boÞ
+       $em\9dc_ü\97\8b_\8fsk
+(\1d\ 5*
+\8fsk_¡»am
+, \12
+»¥Ú£_chªÃl
+)
+
+104 
+em\9dc_ema\9e_\8fsk
+ *
+\8fsk
+ = 
+NULL
+;
+
+105 
+boÞ
+»t
+ = 
+\8cue
+;
+
+107 
+\8fsk
+ = (
+em\9dc_ema\9e_\8fsk
+ *)
+       `m®loc
+(\17(emipc_email_task));
+
+108 ià(
+\8fsk
+ =ð
+NULL
+) {
+
+109 
+       `EM_DEBUG_EXCEPTION
+("Malloc failed.");
+
+110 
+»t
+ = 
+çl£
+;
+
+112 
+       `em\9dc_·r£_¡»am_ema\9e_\8fsk
+(
+\8fsk
+, 
+\8fsk_¡»am
+, 
+»¥Ú£_chªÃl
+);
+
+114 
+       `EM_DEBUG_LOG
+("[IPCLib] ======================================================");
+
+115 
+       `EM_DEBUG_LOG
+("[IPCLib] Regi¡\94\82ew\81ask : %p", 
+\8fsk
+);
+
+116 
+       `EM_DEBUG_LOG
+("[IPCLib] Task API ID : %s", 
+       `EM_APIID_TO_STR
+(
+       `em\9dc_g\91_­i_\9afo
+(
+\8fsk
+)->
+­i_id
+));
+
+117 
+       `EM_DEBUG_LOG
+("[IPCLib] Task Re¥Ú£ ID : %d", 
+       `EM_APIID_TO_STR
+(
+       `em\9dc_g\91_­i_\9afo
+(
+\8fsk
+)->
+»¥Ú£_id
+));
+
+118 
+       `EM_DEBUG_LOG
+("[IPCLib] Task APP ID : %d", 
+       `em\9dc_g\91_­i_\9afo
+(
+\8fsk
+)->
+­p_id
+);
+
+119 
+       `EM_DEBUG_LOG
+("[IPCLib] ======================================================");
+
+121 
+       `ENTER_CRITICAL_SECTION
+(
+\9dc_\8fsk_mu\8bx
+);
+
+122 
+»t
+ = 
+       `em\9dc_push_\9a_queue
+((\1e*)
+\8fsk
+);
+
+124 
+       `WAKE_CONDITION_VARIABLE
+(
+\9dc_\8fsk_cÚd
+);
+
+125 
+       `LEAVE_CRITICAL_SECTION
+(
+\9dc_\8fsk_mu\8bx
+);
+
+127 \15 
+»t
+;
+
+128 
+       }
+}
+
+       @email-stub/email-stub-task.c
+
+24 \ 2
+       ~<sys/sock\91.h
+>
+
+25 \ 2
+       ~<m®loc.h
+>
+
+27 \ 2
+       ~"ema\9e-\9dc.h
+"
+
+28 \ 2
+       ~"ema\9e-\9dc-·¿m-li¡.h
+"
+
+29 \ 2
+       ~"ema\9e-\9dc-bu\9ed.h
+"
+
+30 \ 2
+       ~"ema\9e-¡ub-\8fsk.h
+"
+
+31 \ 2
+       ~"ema\9e-¡ub-ma\9a.h
+"
+
+33 \ 2
+       ~"ema\9e-­i.h
+"
+
+34 \ 2
+       ~"ema\9e-debug-log.h
+"
+
+36 
+EXPORT_API
+boÞ
+       $em\9dc_·r£_¡»am_ema\9e_\8fsk
+(
+em\9dc_ema\9e_\8fsk
+ *
+\8fsk
+, \1e*
+¡»am
+, \12
+»¥Ú£_id
+)
+
+38 
+       `EM_DEBUG_FUNC_BEGIN
+();
+
+40 
+\8fsk
+->
+­i_\9afo
+ = (
+em\9dc_ema\9e_­i_\9afo
+ *)
+       `m®loc
+(\17(emipc_email_api_info));
+
+41 ià(
+\8fsk
+->
+­i_\9afo
+ =ð
+NULL
+) {
+
+42 
+       `EM_DEBUG_EXCEPTION
+("Malloc failed.");
+
+43 \15 
+çl£
+;
+
+45 
+       `mem£t
+(
+\8fsk
+->
+­i_\9afo
+, 0x00, \17(
+em\9dc_ema\9e_­i_\9afo
+));
+
+47 ià(
+\8fsk
+->
+­i_\9afo
+) {
+
+48 
+       `em\9dc_·r£_¡»am_of_­i_\9afo
+(
+\8fsk
+->
+­i_\9afo
+, 
+ePARAMETER_IN
+, 
+¡»am
+);
+
+49 
+       `em\9dc_£t_»¥Ú£_id_of_­i_\9afo
+(
+\8fsk
+->
+­i_\9afo
+, 
+»¥Ú£_id
+);
+
+50 \15 
+\8cue
+;
+
+52 \15 
+çl£
+;
+
+53 
+       }
+}
+
+55 
+EXPORT_API
+em\9dc_ema\9e_­i_\9afo
+ *
+       $em\9dc_g\91_­i_\9afo
+(
+em\9dc_ema\9e_\8fsk
+ *
+\8fsk
+)
+
+57 \15 
+\8fsk
+->
+­i_\9afo
+;
+
+58 
+       }
+}
+
+60 
+EXPORT_API
\12
+       $em\9dc_g\91_»¥Ú£_chªÃl
+(
+em\9dc_ema\9e_\8fsk
+ *
+\8fsk
+)
+
+62 \15 
+\8fsk
+->
+»¥Ú£_chªÃl
+;
+
+63 
+       }
+}
+
+65 
+EXPORT_API
+boÞ
+       $em\9dc_run_\8fsk
+(
+em\9dc_ema\9e_\8fsk
+ *
+\8fsk
+)
+
+67 
+       `EM_DEBUG_LOG
+("[IPCLib] starting\87\82ew\81ask...");
+
+69 \12
+­p_id
+ = 
+       `em\9dc_g\91_­p_id_of_­i_\9afo
+(
+\8fsk
+->
+­i_\9afo
+);
+
+70 \12
+­i_id
+ = 
+       `em\9dc_g\91_­i_id_of_­i_\9afo
+(
+\8fsk
+->
+­i_\9afo
+);
+
+72 ià(
+­p_id
+ > 0) {
+
+73 
+       `EM_DEBUG_LOG
+("[IPCLib] Thi \8fsk (%sèi fÜ\87sync. Re¥Ú£ ID [%d]", 
+       `EM_APIID_TO_STR
+(
+­i_id
+),\87pi_id);
+
+74 ià(!
+       `em\9dc_£t_»¥Ú£_\9afo
+(
+­p_id
+, 
+­i_id
+)) {
+
+75 
+       `EM_DEBUG_EXCEPTION
+("emipc_set_response_info failed");
+
+76 \15 
+çl£
+;
+
+79 \15 
+       `em\9dc_execu\8b_­i_´oxy_to_¡ub
+(
+\8fsk
+->
+­i_\9afo
+);
+
+80 
+       }
+}
+
+       @email-stub/include/email-stub-main.h
+
+24 #iâdef 
+_IPC_STUB_MAIN_H_
+
+
+25 \ 1
+       #_IPC_STUB_MAIN_H_
+
+
+       )
+
+27 \ 2
+       ~"ema\9e-\9dc.h
+"
+
+28 \ 2
+       ~"ema\9e-\9dc-­i-\9afo.h
+"
+
+30 
+EXPORT_API
+boÞ
+em\9dc_\9a\99\9flize_¡ub_ma\9a
+(
+PFN_EXECUTE_API
+â_­i_m­³r
+);
+
+32 
+EXPORT_API
+boÞ
+em\9dc_f\9a®ize_¡ub_ma\9a
+();
+
+34 
+EXPORT_API
+boÞ
+em\9dc_execu\8b_­i_´oxy_to_¡ub
+(
+em\9dc_ema\9e_­i_\9afo
+ *
+­i_\9afo
+);
+
+36 
+EXPORT_API
+boÞ
+em\9dc_execu\8b_­i_¡ub_to_´oxy
+(
+em\9dc_ema\9e_­i_\9afo
+ *
+­i_\9afo
+);
+
+38 
+EXPORT_API
+boÞ
+em\9dc_£t_»¥Ú£_\9afo
+(\13
+­p_id
+, \13
+­i_id
+);
+
+       @email-stub/include/email-stub-queue.h
+
+24 #iâdeà
+_IPC_QUEUE_H_
+
+
+25 \ 1
+       #_IPC_QUEUE_H_
+
+
+       )
+
+27 \ 2
+       ~"ema\9e-ty³s.h
+"
+
+29 \e\19
+       sem\9dc_ema\9e_queue_\99em
+ {
+
+30 \1e*
+       md©a
+;
+
+31 \19
+em\9dc_ema\9e_queue_\99em
+ *
+       mÃxt
+;
+
+32 } 
+       tem\9dc_ema\9e_queue_\99em
+;
+
+35 
+EXPORT_API
\1e*
+em\9dc_pÝ_\9a_queue
+();
+
+37 
+EXPORT_API
+boÞ
+em\9dc_push_\9a_queue
+(\1e*
+d©a
+);
+
+39 
+EXPORT_API
\12
+em\9dc_g\91_couÁ_of_\99em
+();
+
+       @email-stub/include/email-stub-response-info.h
+
+24 #iâdeà
+_IPC_RESPONSE_INFO_H_
+
+
+25 \ 1
+       #_IPC_RESPONSE_INFO_H_
+
+
+       )
+
+27 \ 2
+       ~"ema\9e-ty³s.h
+"
+
+30 \13
+       m»¥Ú£_id
+;
+
+31 \13
+       m­i_id
+;
+
+32 } 
+       tem\9dc_ema\9e_»¥Ú£_\9afo
+;
+
+34 
+EXPORT_API
+boÞ
+em\9dc_£t_v®ue_\9a_»¥Ú£_\9afo
+(
+em\9dc_ema\9e_»¥Ú£_\9afo
+ *
+»¥Ú£_\9afo
+, \13
+»¥Ú£_id
+, \13
+­i_id
+);
+
+36 
+EXPORT_API
\13
+em\9dc_g\91_»¥Ú£_id_\9a_»¥Ú£_\9afo
+(
+em\9dc_ema\9e_»¥Ú£_\9afo
+ *
+»¥Ú£_\9afo
+);
+
+38 
+EXPORT_API
\13
+em\9dc_g\91_­i_id_\9a_»¥Ú£_\9afo
+(
+em\9dc_ema\9e_»¥Ú£_\9afo
+ *
+»¥Ú£_\9afo
+);
+
+       @email-stub/include/email-stub-socket.h
+
+24 #iâdef 
+_IPC_STUB_SOCKET_H_
+
+
+25 \ 1
+       #_IPC_STUB_SOCKET_H_
+
+
+       )
+
+27 \ 2
+       ~"ema\9e-ty³s.h
+"
+
+37 
+EXPORT_API
+boÞ
+em\9dc_¡¬t_¡ub_sock\91
+();
+
+39 
+EXPORT_API
+boÞ
+em\9dc_¡¬t_¡ub_sock\91_th»ad
+();
+
+41 
+EXPORT_API
+boÞ
+em\9dc_¡Ý_¡ub_sock\91
+();
+
+43 
+EXPORT_API
\1e
+em\9dc_wa\99_fÜ_\9dc_»que¡
+();
+
+45 
+EXPORT_API
+boÞ
+em\9dc_\92d_¡ub_sock\91
+();
+
+47 
+EXPORT_API
\12
+em\9dc_£nd_¡ub_sock\91
+(\12
+sock_fd
+, \1e*
+d©a
+, \12
+Ën
+);
+
+       @email-stub/include/email-stub-task-manager.h
+
+23 #iâdeà
+_IPC_TASK_MANAGER_H_
+
+
+24 \ 1
+       #_IPC_TASK_MANAGER_H_
+
+
+       )
+
+26 \ 2
+       ~"ema\9e-ty³s.h
+"
+
+28 \ 1
+       #IPC_TASK_MAX
+ 64
+
+       )
+
+30 
+EXPORT_API
+boÞ
+em\9dc_¡¬t_\8fsk_th»ad
+();
+
+32 
+EXPORT_API
\1e
+em\9dc_\8brm\9a©e_\8fsk_th»ad
+();
+
+34 
+EXPORT_API
+boÞ
+em\9dc_¡Ý_\8fsk_th»ad
+();
+
+36 
+EXPORT_API
\1e*
+em\9dc_do_\8fsk_th»ad
+();
+
+38 
+EXPORT_API
+boÞ
+em\9dc_ü\97\8b_\8fsk
+(\1d\ 5*
+\8fsk_¡»am
+, \12
+»¥Ú£_chªÃl
+);
+
+       @email-stub/include/email-stub-task.h
+
+23 #iâdeà
+_IPC_TASK_H_
+
+
+24 \ 1
+       #_IPC_TASK_H_
+
+
+       )
+
+26 \ 2
+       ~"ema\9e-\9dc-­i-\9afo.h
+"
+
+27 \ 2
+       ~"ema\9e-ty³s.h
+"
+
+30 \12
+       m»¥Ú£_chªÃl
+;
+
+31 
+em\9dc_ema\9e_­i_\9afo
+ *
+       m­i_\9afo
+;
+
+32 } 
+       tem\9dc_ema\9e_\8fsk
+;
+
+34 
+EXPORT_API
+boÞ
+em\9dc_·r£_¡»am_ema\9e_\8fsk
+(
+em\9dc_ema\9e_\8fsk
+ *
+\8fsk
+, \1e*
+¡»am
+, \12
+»¥Ú£_id
+);
+
+36 
+EXPORT_API
+em\9dc_ema\9e_­i_\9afo
+ *
+em\9dc_g\91_­i_\9afo
+(
+em\9dc_ema\9e_\8fsk
+ *
+\8fsk
+);
+
+38 
+EXPORT_API
\12
+em\9dc_g\91_»¥Ú£_chªÃl
+(
+em\9dc_ema\9e_\8fsk
+ *
+\8fsk
+);
+
+40 
+EXPORT_API
+boÞ
+em\9dc_run_\8fsk
+(
+em\9dc_ema\9e_\8fsk
+ *
+\8fsk
+);
+
+       @include/email-ipc-build.h
+
+23 #iâdeà
+__IPC_LIBRARY_BUILD_H_
+
+
+24 \ 1
+       #__IPC_LIBRARY_BUILD_H_
+
+
+       )
+
+26 \ 2
+       ~<¡dio.h
+>
+
+       @include/email-ipc.h
+
+23 #iâdeà
+__IPC_LIBRARY_H
+
+
+24 \ 1
+       #__IPC_LIBRARY_H
+
+
+       )
+
+26 \ 2
+       ~"ema\9e-ty³s.h
+"
+
+28 #ifdeà
+__ýlu¥lus
+
+
+32 \ 1
+       #EM_PROXY_IF_NULL_RETURN_VALUE
+(
+ex´1
+, 
+ex´2
+, 
+v®
+) { \
+
+33 ià(!
+ex´1
+&& 
+ex´2
+) { \
+
+34 
+       `EM_DEBUG_LOG
+ ("EM_PROXY_IF_NULL_RETURN_VALUE : PARAM IS NULL \n"); \
+
+35 
+       `em\9dc_de¡roy_ema\9e_­i
+(
+ex´2
+); \
+
+36 \15 
+v®
+; \
+
+37 }; }
+
+       )
+
+44 
+ePARAMETER_IN
+ = 0,
+
+45 
+ePARAMETER_OUT
+,
+
+46 } 
+       tEPARAMETER_DIRECTION
+;
+
+48 \e\1e
+       tHIPC_API
+;
+
+49 \e\1e
+       tHIPC_PARAMETER
+;
+
+50 \e\1e(*
+PFN_PROXY_CALLBACK
+è(
+       tHIPC_API
+       t\9aput_­i_hªdË
+, \1e
+       tpP¬am1
+, \1e
+       tpP¬am2
+);
+
+51 \e\1e(*
+PFN_EXECUTE_API
+è(
+       tHIPC_API
+       t\9aput_­i_hªdË
+);
+
+56 
+EXPORT_API
\12
+em\9dc_\9a\99\9flize_´oxy
+();
+
+58 
+EXPORT_API
\12
+em\9dc_f\9a®ize_´oxy
+();
+
+60 
+EXPORT_API
+boÞ
+em\9dc_execu\8b_´oxy_­i
+(
+HIPC_API
+\9aput_­i_hªdË
+);
+
+65 
+EXPORT_API
+boÞ
+em\9dc_\9a\99\9flize_¡ub
+(
+PFN_EXECUTE_API
+\9aput_­i_m­³r
+);
+
+67 
+EXPORT_API
+boÞ
+em\9dc_f\9a®ize_¡ub
+();
+
+69 
+EXPORT_API
+boÞ
+em\9dc_execu\8b_¡ub_­i
+(
+HIPC_API
+\9aput_­i_hªdË
+);
+
+74 
+EXPORT_API
+HIPC_API
+em\9dc_ü\97\8b_ema\9e_­i
+(\13
+­i_id
+);
+
+75 
+EXPORT_API
\1e
+em\9dc_de¡roy_ema\9e_­i
+(
+HIPC_API
+\9aput_­i_hªdË
+);
+
+77 
+EXPORT_API
\13
+em\9dc_g\91_­i_id
+(
+HIPC_API
+\9aput_­i_hªdË
+);
+
+78 
+EXPORT_API
\13
+em\9dc_g\91_­p_id
+(
+HIPC_API
+\9aput_­i_hªdË
+);
+
+80 
+EXPORT_API
+boÞ
+em\9dc_add_·¿m\91\94
+(
+HIPC_API
+\9aput_­i_hªdË
+, 
+EPARAMETER_DIRECTION
+\9aput_·¿m\91\94_d\9ceùiÚ
+, \1e*
+\9aput_·¿m\91\94_d©a
+, \12
+\9aput_d©a_Ëngth
+);
+
+81 
+EXPORT_API
\12
+em\9dc_g\91_·¿m\91\94_couÁ
+(
+HIPC_API
+\9aput_­i_hªdË
+, 
+EPARAMETER_DIRECTION
+\9aput_·¿m\91\94_d\9ceùiÚ
+);
+
+82 
+EXPORT_API
\12
+em\9dc_g\91_·¿m\91\94
+(
+HIPC_API
+\9aput_­i_hªdË
+, 
+EPARAMETER_DIRECTION
+\9aput_·¿m\91\94_d\9ceùiÚ
+, \12
+\9aput_·¿m\91\94_\9adex
+, \12
+\9aput_·¿m\91\94_bufãr_size
+, \1e*
+ou\8dut_·¿m\91\94
+);
+
+83 
+EXPORT_API
\12
+em\9dc_g\91_·¿m\91\94_Ëngth
+(
+HIPC_API
+\9aput_­i_hªdË
+, 
+EPARAMETER_DIRECTION
+\9aput_·¿m\91\94_d\9ceùiÚ
+, \12
+\9aput_·¿m\91\94_\9adex
+);
+
+86 #ifdeà
+__ýlu¥lus
+
+
+       @/usr/include/errno.h
+
+23 #iâdef 
+_ERRNO_H
+
+
+27 #iâdef 
+__Ãed_Em©h
+
+
+28 \ 1
+       #_ERRNO_H
+ 1
+
+       )
+
+29 \ 2
+       ~<ã©u»s.h
+>
+
+32 
+       g__BEGIN_DECLS
+
+
+36 \ 2
+       ~<b\99s/\94ºo.h
+>
+
+37 #undeà
+__Ãed_Em©h
+
+
+39 #ifdef 
+_ERRNO_H
+
+
+46 #iâdef 
+\94ºo
+
+
+47 \r\12
+\94ºo
+;
+
+50 #ifdeà
+__USE_GNU
+
+
+55 \r\ 5*
+´og¿m_\9avoÿtiÚ_Çme
+, *
+´og¿m_\9avoÿtiÚ_shÜt_Çme
+;
+
+59 
+       g__END_DECLS
+
+
+67 #ià
+def\9aed
+__USE_GNU
+ || def\9aed 
+__Ãed_\94rÜ_t
+
+
+68 #iâdeà
+__\94rÜ_t_def\9aed
+
+
+69 \e\12
+       t\94rÜ_t
+;
+
+70 \ 1
+       #__\94rÜ_t_def\9aed
+ 1
+
+       )
+
+72 #undeà
+__Ãed_\94rÜ_t
+
+
+       @/usr/include/malloc.h
+
+21 #iâdeà
+_MALLOC_H
+
+
+22 \ 1
+       #_MALLOC_H
+ 1
+
+       )
+
+24 \ 2
+       ~<ã©u»s.h
+>
+
+25 \ 2
+       ~<¡ddef.h
+>
+
+26 \ 2
+       ~<¡dio.h
+>
+
+27 \ 1
+       #__m®loc_±r_t
\1e*
+
+       )
+
+30 \ 1
+       #__m®loc_size_t
+size_t
+
+
+       )
+
+31 \ 1
+       #__m®loc_±rdiff_t
+±rdiff_t
+
+
+       )
+
+33 #ifdeà
+__GNUC__
+
+
+35 \ 1
+       #__MALLOC_P
+(
+¬gs
+è¬g 
+__THROW
+
+
+       )
+
+38 \ 1
+       #__MALLOC_PMT
+(
+¬gs
+       )
+args
+
+42 \ 1
+       #__MALLOC_P
+(
+¬gs
+       )
+args
+
+43 \ 1
+       #__MALLOC_PMT
+(
+¬gs
+       )
+args
+
+48 
+__BEGIN_DECLS
+
+
+51 \r\1e*
+m®loc
+__MALLOC_P
+ ((
+size_t
+__size
+)è
+__©\8cibu\8b_m®loc__
+__wur
+;
+
+54 \r\1e*
+ÿÎoc
+__MALLOC_P
+ ((
+size_t
+__nmemb
+, size_\88
+__size
+))
+
+55 
+__©\8cibu\8b_m®loc__
+__wur
+;
+
+62 \r\1e*
+»®loc
+__MALLOC_P
+ ((\1e*
+__±r
+, 
+size_t
+__size
+))
+
+63 
+__©\8cibu\8b_w¬n_unu£d_»suÉ__
+;
+
+66 \r\1e
\93
+__MALLOC_P
+ ((\1e*
+__±r
+));
+
+69 \r\1e
+cä\93
+__MALLOC_P
+ ((\1e*
+__±r
+));
+
+72 \r\1e*
+mem®ign
+__MALLOC_P
+ ((
+size_t
+__®ignm\92t
+, size_\88
+__size
+))
+
+73 
+__©\8cibu\8b_m®loc__
+__wur
+;
+
+76 \r\1e*
+v®loc
+__MALLOC_P
+ ((
+size_t
+__size
+))
+
+77 
+__©\8cibu\8b_m®loc__
+__wur
+;
+
+81 \r\1e
+pv®loc
+__MALLOC_P
+ ((
+size_t
+__size
+))
+
+82 
+__©\8cibu\8b_m®loc__
+__wur
+;
+
+86 \r\1e*(*
+__mÜecÜe
+__MALLOC_PMT
+ ((
+±rdiff_t
+__size
+));
+
+89 \r\1e*
+__deçuÉ_mÜecÜe
+__MALLOC_P
+ ((
+±rdiff_t
+__size
+))
+
+90 
+__©\8cibu\8b_m®loc__
+;
+
+94 \19
+       sm®l\9afo
+ {
+
+95 \12
+       m¬\92a
+;
+
+96 \12
+       mÜdblks
+;
+
+97 \12
+       msmblks
+;
+
+98 \12
+       mhblks
+;
+
+99 \12
+       mhblkhd
+;
+
+100 \12
+       musmblks
+;
+
+101 \12
+       mfsmblks
+;
+
+102 \12
+       muÜdblks
+;
+
+103 \12
+       mfÜdblks
+;
+
+104 \12
+       mk\93pco¡
+;
+
+108 \r\19
+m®l\9afo
+ m®l\9a
+__MALLOC_P
+ ((\1e));
+
+111 #iâdeà
+M_MXFAST
+
+
+112 \ 1
+       #M_MXFAST
+ 1
+
+       )
+
+114 #iâdeà
+M_NLBLKS
+
+
+115 \ 1
+       #M_NLBLKS
+ 2
+
+       )
+
+117 #iâdeà
+M_GRAIN
+
+
+118 \ 1
+       #M_GRAIN
+ 3
+
+       )
+
+120 #iâdeà
+M_KEEP
+
+
+121 \ 1
+       #M_KEEP
+ 4
+
+       )
+
+125 \ 1
+       #M_TRIM_THRESHOLD
+ -1
+
+       )
+
+126 \ 1
+       #M_TOP_PAD
+ -2
+
+       )
+
+127 \ 1
+       #M_MMAP_THRESHOLD
+ -3
+
+       )
+
+128 \ 1
+       #M_MMAP_MAX
+ -4
+
+       )
+
+129 \ 1
+       #M_CHECK_ACTION
+ -5
+
+       )
+
+130 \ 1
+       #M_PERTURB
+ -6
+
+       )
+
+131 \ 1
+       #M_ARENA_TEST
+ -7
+
+       )
+
+132 \ 1
+       #M_ARENA_MAX
+ -8
+
+       )
+
+135 \r\12
+m®lÝt
+__MALLOC_P
+ ((\12
+__·¿m
+, \12
+__v®
+));
+
+139 \r\12
+m®loc_\8cim
+__MALLOC_P
+ ((
+size_t
+__·d
+));
+
+143 \r
+size_t
+m®loc_u§bË_size
+__MALLOC_P
+ ((\1e*
+__±r
+));
+
+146 \r\1e
+m®loc_¡©s
+__MALLOC_P
+ ((\1e));
+
+149 \r\12
+m®loc_\9afo
+ (\12
+__ÝtiÚs
+, 
+FILE
+ *
+__å
+);
+
+152 \r\1e*
+m®loc_g\91_¡©e
+__MALLOC_P
+ ((\1e));
+
+156 \r\12
+m®loc_£t_¡©e
+__MALLOC_P
+ ((\1e*
+__±r
+));
+
+161 \r\1e(*
+__m®loc_\9a\99\9flize_hook
+       `__MALLOC_PMT
+ ((\1e));
+
+163 \r\1e(*
+__ä\93_hook
+       `__MALLOC_PMT
+ ((\1e*
+__±r
+,
+
+164 
+__cڡ
+__m®loc_±r_t
+));
+
+165 \r\1e*(*
+__m®loc_hook
+       `__MALLOC_PMT
+ ((
+size_t
+__size
+,
+
+166 
+__cڡ
+__m®loc_±r_t
+));
+
+167 \r\1e*(*
+__»®loc_hook
+       `__MALLOC_PMT
+ ((\1e*
+__±r
+, 
+size_t
+__size
+,
+
+168 
+__cڡ
+__m®loc_±r_t
+));
+
+169 \r\1e*(*
+__mem®ign_hook
+       `__MALLOC_PMT
+ ((
+size_t
+__®ignm\92t
+,
+
+170 
+size_t
+__size
+,
+
+171 
+__cڡ
+__m®loc_±r_t
+));
+
+172 \r\1e(*
+__aá\94_mÜecÜe_hook
+       `__MALLOC_PMT
+ ((\1e));
+
+175 \r\1e
+__m®loc_check_\9a\99
+       `__MALLOC_P
+ ((\1e));
+
+178 
+__END_DECLS
+
+
+       @/usr/include/pthread.h
+
+20 #iâdeà
+_PTHREAD_H
+
+
+21 \ 1
+       #_PTHREAD_H
+ 1
+
+       )
+
+23 \ 2
+       ~<ã©u»s.h
+>
+
+24 \ 2
+       ~<\92d\9fn.h
+>
+
+25 \ 2
+       ~<sched.h
+>
+
+26 \ 2
+       ~<time.h
+>
+
+28 \ 2
+       ~<b\99s/±h»adty³s.h
+>
+
+29 \ 2
+       ~<b\99s/£tjmp.h
+>
+
+30 \ 2
+       ~<b\99s/wÜdsize.h
+>
+
+36 
+       mPTHREAD_CREATE_JOINABLE
+,
+
+37 \ 1
+       #PTHREAD_CREATE_JOINABLE
+PTHREAD_CREATE_JOINABLE
+
+
+       )
+
+38 
+       mPTHREAD_CREATE_DETACHED
+
+
+39 \ 1
+       #PTHREAD_CREATE_DETACHED
+PTHREAD_CREATE_DETACHED
+
+
+       )
+
+46 
+       mPTHREAD_MUTEX_TIMED_NP
+,
+
+47 
+       mPTHREAD_MUTEX_RECURSIVE_NP
+,
+
+48 
+       mPTHREAD_MUTEX_ERRORCHECK_NP
+,
+
+49 
+       mPTHREAD_MUTEX_ADAPTIVE_NP
+
+
+50 #ià
+def\9aed
+__USE_UNIX98
+ || def\9aed 
+__USE_XOPEN2K8
+
+
+52 
+       mPTHREAD_MUTEX_NORMAL
+ = 
+PTHREAD_MUTEX_TIMED_NP
+,
+
+53 
+       mPTHREAD_MUTEX_RECURSIVE
+ = 
+PTHREAD_MUTEX_RECURSIVE_NP
+,
+
+54 
+       mPTHREAD_MUTEX_ERRORCHECK
+ = 
+PTHREAD_MUTEX_ERRORCHECK_NP
+,
+
+55 
+       mPTHREAD_MUTEX_DEFAULT
+ = 
+PTHREAD_MUTEX_NORMAL
+
+
+57 #ifdeà
+__USE_GNU
+
+
+59 , 
+       mPTHREAD_MUTEX_FAST_NP
+ = 
+PTHREAD_MUTEX_TIMED_NP
+
+
+64 #ifdeà
+__USE_XOPEN2K
+
+
+68 
+       mPTHREAD_MUTEX_STALLED
+,
+
+69 
+       mPTHREAD_MUTEX_STALLED_NP
+ = 
+PTHREAD_MUTEX_STALLED
+,
+
+70 
+       mPTHREAD_MUTEX_ROBUST
+,
+
+71 
+       mPTHREAD_MUTEX_ROBUST_NP
+ = 
+PTHREAD_MUTEX_ROBUST
+
+
+76 #ifdeà
+__USE_UNIX98
+
+
+80 
+       mPTHREAD_PRIO_NONE
+,
+
+81 
+       mPTHREAD_PRIO_INHERIT
+,
+
+82 
+       mPTHREAD_PRIO_PROTECT
+
+
+88 #ià
+__WORDSIZE
+ == 64
+
+89 \ 1
+       #PTHREAD_MUTEX_INITIALIZER
+ \
+
+90 { { 0, 0, 0, 0, 0, 0, { 0, 0 } } }
+
+       )
+
+91 #ifdeà
+__USE_GNU
+
+
+92 \ 1
+       #PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
+ \
+
+93 { { 0, 0, 0, 0, 
+PTHREAD_MUTEX_RECURSIVE_NP
+, 0, { 0, 0 } } }
+
+       )
+
+94 \ 1
+       #PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
+ \
+
+95 { { 0, 0, 0, 0, 
+PTHREAD_MUTEX_ERRORCHECK_NP
+, 0, { 0, 0 } } }
+
+       )
+
+96 \ 1
+       #PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
+ \
+
+97 { { 0, 0, 0, 0, 
+PTHREAD_MUTEX_ADAPTIVE_NP
+, 0, { 0, 0 } } }
+
+       )
+
+100 \ 1
+       #PTHREAD_MUTEX_INITIALIZER
+ \
+
+101 { { 0, 0, 0, 0, 0, { 0 } } }
+
+       )
+
+102 #ifdeà
+__USE_GNU
+
+
+103 \ 1
+       #PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
+ \
+
+104 { { 0, 0, 0, 
+PTHREAD_MUTEX_RECURSIVE_NP
+, 0, { 0 } } }
+
+       )
+
+105 \ 1
+       #PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
+ \
+
+106 { { 0, 0, 0, 
+PTHREAD_MUTEX_ERRORCHECK_NP
+, 0, { 0 } } }
+
+       )
+
+107 \ 1
+       #PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
+ \
+
+108 { { 0, 0, 0, 
+PTHREAD_MUTEX_ADAPTIVE_NP
+, 0, { 0 } } }
+
+       )
+
+114 #ià
+def\9aed
+__USE_UNIX98
+ || def\9aed 
+__USE_XOPEN2K
+
+
+117 
+       mPTHREAD_RWLOCK_PREFER_READER_NP
+,
+
+118 
+       mPTHREAD_RWLOCK_PREFER_WRITER_NP
+,
+
+119 
+       mPTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP
+,
+
+120 
+       mPTHREAD_RWLOCK_DEFAULT_NP
+ = 
+PTHREAD_RWLOCK_PREFER_READER_NP
+
+
+124 \ 1
+       #PTHREAD_RWLOCK_INITIALIZER
+ \
+
+125 { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }
+
+       )
+
+126 #ifdeà
+__USE_GNU
+
+
+127 #ià
+__WORDSIZE
+ == 64
+
+128 \ 1
+       #PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP
+ \
+
+130 
+PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP
+ } }
+
+       )
+
+132 #ià
+__BYTE_ORDER
+ =ð
+__LITTLE_ENDIAN
+
+
+133 \ 1
+       #PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP
+ \
+
+134 { { 0, 0, 0, 0, 0, 0, 
+PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP
+, \
+
+135 0, 0, 0, 0 } }
+
+       )
+
+137 \ 1
+       #PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP
+ \
+
+138 { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP
+,\
+
+139 0 } }
+
+       )
+
+149 
+       mPTHREAD_INHERIT_SCHED
+,
+
+150 \ 1
+       #PTHREAD_INHERIT_SCHED
+PTHREAD_INHERIT_SCHED
+
+
+       )
+
+151 
+       mPTHREAD_EXPLICIT_SCHED
+
+
+152 \ 1
+       #PTHREAD_EXPLICIT_SCHED
+PTHREAD_EXPLICIT_SCHED
+
+
+       )
+
+159 
+       mPTHREAD_SCOPE_SYSTEM
+,
+
+160 \ 1
+       #PTHREAD_SCOPE_SYSTEM
+PTHREAD_SCOPE_SYSTEM
+
+
+       )
+
+161 
+       mPTHREAD_SCOPE_PROCESS
+
+
+162 \ 1
+       #PTHREAD_SCOPE_PROCESS
+PTHREAD_SCOPE_PROCESS
+
+
+       )
+
+169 
+       mPTHREAD_PROCESS_PRIVATE
+,
+
+170 \ 1
+       #PTHREAD_PROCESS_PRIVATE
+PTHREAD_PROCESS_PRIVATE
+
+
+       )
+
+171 
+       mPTHREAD_PROCESS_SHARED
+
+
+172 \ 1
+       #PTHREAD_PROCESS_SHARED
+PTHREAD_PROCESS_SHARED
+
+
+       )
+
+178 \ 1
+       #PTHREAD_COND_INITIALIZER
+ { { 0, 0, 0, 0, 0, (\1e*è0, 0, 0 } }
+
+       )
+
+182 \19
+       s_±h»ad_þ\97nup_bufãr
+
+
+184 \1e(*
+       m__rout\9ae
+) (\1e*);
+
+185 \1e*
+       m__¬g
+;
+
+186 \12
+       m__ÿnûÉy³
+;
+
+187 \19
+_±h»ad_þ\97nup_bufãr
+ *
+       m__´ev
+;
+
+193 
+       mPTHREAD_CANCEL_ENABLE
+,
+
+194 \ 1
+       #PTHREAD_CANCEL_ENABLE
+PTHREAD_CANCEL_ENABLE
+
+
+       )
+
+195 
+       mPTHREAD_CANCEL_DISABLE
+
+
+196 \ 1
+       #PTHREAD_CANCEL_DISABLE
+PTHREAD_CANCEL_DISABLE
+
+
+       )
+
+200 
+       mPTHREAD_CANCEL_DEFERRED
+,
+
+201 \ 1
+       #PTHREAD_CANCEL_DEFERRED
+PTHREAD_CANCEL_DEFERRED
+
+
+       )
+
+202 
+       mPTHREAD_CANCEL_ASYNCHRONOUS
+
+
+203 \ 1
+       #PTHREAD_CANCEL_ASYNCHRONOUS
+PTHREAD_CANCEL_ASYNCHRONOUS
+
+
+       )
+
+205 \ 1
+       #PTHREAD_CANCELED
+ ((\1e*è-1)
+
+       )
+
+209 \ 1
+       #PTHREAD_ONCE_INIT
+ 0
+
+       )
+
+212 #ifdeà
+__USE_XOPEN2K
+
+
+216 \ 1
+       #PTHREAD_BARRIER_SERIAL_THREAD
+ -1
+
+       )
+
+220 
+__BEGIN_DECLS
+
+
+225 \r\12
+±h»ad_ü\97\8b
+ (
+±h»ad_t
+ *
+__»¡riù
+__Ãwth»ad
+,
+
+226 
+__cڡ
+±h»ad_©\8c_t
+ *
+__»¡riù
+__©\8c
+,
+
+227 \1e*(*
+__¡¬t_rout\9ae
+) (\1e*),
+
+228 \1e*
+__»¡riù
+__¬g
+__THROW
+__nÚnuÎ
+ ((1, 3));
+
+234 \r\1e
+       $±h»ad_ex\99
+ (\1e*
+__»tv®
+       `__©\8cibu\8b__
+ ((
+__nÜ\91uº__
+));
+
+242 \r\12
+       `±h»ad_jo\9a
+ (
+±h»ad_t
+__th
+, \1e**
+__th»ad_»tuº
+);
+
+244 #ifdeà
+__USE_GNU
+
+
+247 \r\12
+       $±h»ad_\8cyjo\9a
+ (
+±h»ad_t
+__th
+, \1e**
+__th»ad_»tuº
+__THROW
+;
+
+255 \r\12
+       `±h»ad_timedjo\9a
+ (
+±h»ad_t
+__th
+, \1e**
+__th»ad_»tuº
+,
+
+256 
+__cڡ
\19
+time¥ec
+ *
+__ab¡ime
+);
+
+263 \r\12
+       $±h»ad_d\91ach
+ (
+±h»ad_t
+__th
+__THROW
+;
+
+267 \r
+±h»ad_t
+       $±h»ad_£lf
+ (\1eè
+__THROW
+       `__©\8cibu\8b__
+ ((
+__cڡ__
+));
+
+270 \r\12
+       $±h»ad_equ®
+ (
+±h»ad_t
+__th»ad1
+,\85th»ad_\88
+__th»ad2
+__THROW
+;
+
+278 \r\12
+       $±h»ad_©\8c_\9a\99
+ (
+±h»ad_©\8c_t
+ *
+__©\8c
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+281 \r\12
+       $±h»ad_©\8c_de¡roy
+ (
+±h»ad_©\8c_t
+ *
+__©\8c
+)
+
+282 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+285 \r\12
+       $±h»ad_©\8c_g\91d\91ach¡©e
+ (
+__cڡ
+±h»ad_©\8c_t
+ *
+__©\8c
+,
+
+286 \12*
+__d\91ach¡©e
+)
+
+287 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+290 \r\12
+       $±h»ad_©\8c_£td\91ach¡©e
+ (
+±h»ad_©\8c_t
+ *
+__©\8c
+,
+
+291 \12
+__d\91ach¡©e
+)
+
+292 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+296 \r\12
+       $±h»ad_©\8c_g\91gu¬dsize
+ (
+__cڡ
+±h»ad_©\8c_t
+ *
+__©\8c
+,
+
+297 
+size_t
+ *
+__gu¬dsize
+)
+
+298 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+301 \r\12
+       $±h»ad_©\8c_£tgu¬dsize
+ (
+±h»ad_©\8c_t
+ *
+__©\8c
+,
+
+302 
+size_t
+__gu¬dsize
+)
+
+303 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+307 \r\12
+       $±h»ad_©\8c_g\91sched·¿m
+ (
+__cڡ
+±h»ad_©\8c_t
+ *
+__»¡riù
+
+
+308 
+__©\8c
+,
+
+309 \19
+sched_·¿m
+ *
+__»¡riù
+__·¿m
+)
+
+310 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+313 \r\12
+       $±h»ad_©\8c_£tsched·¿m
+ (
+±h»ad_©\8c_t
+ *
+__»¡riù
+__©\8c
+,
+
+314 
+__cڡ
\19
+sched_·¿m
+ *
+__»¡riù
+
+
+315 
+__·¿m
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+318 \r\12
+       $±h»ad_©\8c_g\91schedpÞicy
+ (
+__cڡ
+±h»ad_©\8c_t
+ *
+__»¡riù
+
+
+319 
+__©\8c
+, \12*
+__»¡riù
+__pÞicy
+)
+
+320 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+323 \r\12
+       $±h»ad_©\8c_£tschedpÞicy
+ (
+±h»ad_©\8c_t
+ *
+__©\8c
+, \12
+__pÞicy
+)
+
+324 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+327 \r\12
+       $±h»ad_©\8c_g\91\9ah\94\99sched
+ (
+__cڡ
+±h»ad_©\8c_t
+ *
+__»¡riù
+
+
+328 
+__©\8c
+, \12*
+__»¡riù
+__\9ah\94\99
+)
+
+329 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+332 \r\12
+       $±h»ad_©\8c_£t\9ah\94\99sched
+ (
+±h»ad_©\8c_t
+ *
+__©\8c
+,
+
+333 \12
+__\9ah\94\99
+)
+
+334 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+338 \r\12
+       $±h»ad_©\8c_g\91scÝe
+ (
+__cڡ
+±h»ad_©\8c_t
+ *
+__»¡riù
+__©\8c
+,
+
+339 \12*
+__»¡riù
+__scÝe
+)
+
+340 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+343 \r\12
+       $±h»ad_©\8c_£tscÝe
+ (
+±h»ad_©\8c_t
+ *
+__©\8c
+, \12
+__scÝe
+)
+
+344 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+347 \r\12
+       $±h»ad_©\8c_g\91¡ackaddr
+ (
+__cڡ
+±h»ad_©\8c_t
+ *
+__»¡riù
+
+
+348 
+__©\8c
+, \1e**
+__»¡riù
+__¡ackaddr
+)
+
+349 
+__THROW
+       `__nÚnuÎ
+ ((1, 2)è
+__©\8cibu\8b_d\95»ÿ\8bd__
+;
+
+355 \r\12
+       $±h»ad_©\8c_£t¡ackaddr
+ (
+±h»ad_©\8c_t
+ *
+__©\8c
+,
+
+356 \1e*
+__¡ackaddr
+)
+
+357 
+__THROW
+       `__nÚnuÎ
+ ((1)è
+__©\8cibu\8b_d\95»ÿ\8bd__
+;
+
+360 \r\12
+       $±h»ad_©\8c_g\91¡acksize
+ (
+__cڡ
+±h»ad_©\8c_t
+ *
+__»¡riù
+
+
+361 
+__©\8c
+, 
+size_t
+ *
+__»¡riù
+__¡acksize
+)
+
+362 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+367 \r\12
+       $±h»ad_©\8c_£t¡acksize
+ (
+±h»ad_©\8c_t
+ *
+__©\8c
+,
+
+368 
+size_t
+__¡acksize
+)
+
+369 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+371 #ifdeà
+__USE_XOPEN2K
+
+
+373 \r\12
+       $±h»ad_©\8c_g\91¡ack
+ (
+__cڡ
+±h»ad_©\8c_t
+ *
+__»¡riù
+__©\8c
+,
+
+374 \1e**
+__»¡riù
+__¡ackaddr
+,
+
+375 
+size_t
+ *
+__»¡riù
+__¡acksize
+)
+
+376 
+__THROW
+       `__nÚnuÎ
+ ((1, 2, 3));
+
+381 \r\12
+       $±h»ad_©\8c_£t¡ack
+ (
+±h»ad_©\8c_t
+ *
+__©\8c
+, \1e*
+__¡ackaddr
+,
+
+382 
+size_t
+__¡acksize
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+385 #ifdeà
+__USE_GNU
+
+
+388 \r\12
+       $±h»ad_©\8c\8fff\9a\99y_Å
+ (
+±h»ad_©\8c_t
+ *
+__©\8c
+,
+
+389 
+size_t
+__ýu£tsize
+,
+
+390 
+__cڡ
+ýu_£t_t
+ *
+__ýu£t
+)
+
+391 
+__THROW
+       `__nÚnuÎ
+ ((1, 3));
+
+395 \r\12
+       $±h»ad_©\8c_g\91aff\9a\99y_Å
+ (
+__cڡ
+±h»ad_©\8c_t
+ *
+__©\8c
+,
+
+396 
+size_t
+__ýu£tsize
+,
+
+397 
+ýu_£t_t
+ *
+__ýu£t
+)
+
+398 
+__THROW
+       `__nÚnuÎ
+ ((1, 3));
+
+404 \r\12
+       $±h»ad_g\91©\8c
+ (
+±h»ad_t
+__th
+, 
+±h»ad_©\8c_t
+ *
+__©\8c
+)
+
+405 
+__THROW
+       `__nÚnuÎ
+ ((2));
+
+413 \r\12
+       $±h»ad_£tsched·¿m
+ (
+±h»ad_t
+__\8frg\91_th»ad
+, \12
+__pÞicy
+,
+
+414 
+__cڡ
\19
+sched_·¿m
+ *
+__·¿m
+)
+
+415 
+__THROW
+       `__nÚnuÎ
+ ((3));
+
+418 \r\12
+       $±h»ad_g\91sched·¿m
+ (
+±h»ad_t
+__\8frg\91_th»ad
+,
+
+419 \12*
+__»¡riù
+__pÞicy
+,
+
+420 \19
+sched_·¿m
+ *
+__»¡riù
+__·¿m
+)
+
+421 
+__THROW
+       `__nÚnuÎ
+ ((2, 3));
+
+424 \r\12
+       $±h»ad_£tsched´io
+ (
+±h»ad_t
+__\8frg\91_th»ad
+, \12
+__´io
+)
+
+425 
+__THROW
+;
+
+428 #ifdeà
+__USE_GNU
+
+
+430 \r\12
+       $±h»ad_g\91Çme_Å
+ (
+±h»ad_t
+__\8frg\91_th»ad
+, \ 5*
+__buf
+,
+
+431 
+size_t
+__buæ\92
+)
+
+432 
+__THROW
+       `__nÚnuÎ
+ ((2));
+
+435 \r\12
+       $±h»ad_£\8aame_Å
+ (
+±h»ad_t
+__\8frg\91_th»ad
+, 
+__cڡ
\ 5*
+__Çme
+)
+
+436 
+__THROW
+       `__nÚnuÎ
+ ((2));
+
+440 #ifdeà
+__USE_UNIX98
+
+
+442 \r\12
+       $±h»ad_g\91cÚcu¼\92cy
+ (\1eè
+__THROW
+;
+
+445 \r\12
+       $±h»ad_£tcÚcu¼\92cy
+ (\12
+__Ëv\96
+__THROW
+;
+
+448 #ifdeà
+__USE_GNU
+
+
+453 \r\12
+       $±h»ad_y\9bld
+ (\1eè
+__THROW
+;
+
+458 \r\12
+       $±h»ad_£\8fff\9a\99y_Å
+ (
+±h»ad_t
+__th
+, 
+size_t
+__ýu£tsize
+,
+
+459 
+__cڡ
+ýu_£t_t
+ *
+__ýu£t
+)
+
+460 
+__THROW
+       `__nÚnuÎ
+ ((3));
+
+463 \r\12
+       $±h»ad_g\91aff\9a\99y_Å
+ (
+±h»ad_t
+__th
+, 
+size_t
+__ýu£tsize
+,
+
+464 
+ýu_£t_t
+ *
+__ýu£t
+)
+
+465 
+__THROW
+       `__nÚnuÎ
+ ((3));
+
+478 \r\12
+       `±h»ad_Úû
+ (
+±h»ad_Úû_t
+ *
+__Úû_cÚ\8cÞ
+,
+
+479 \1e(*
+__\9a\99_rout\9ae
+è(\1e
+       `__nÚnuÎ
+ ((1, 2));
+
+490 \r\12
+       `±h»ad_£tÿnûl¡©e
+ (\12
+__¡©e
+, \12*
+__Þd¡©e
+);
+
+494 \r\12
+       `±h»ad_£tÿnûÉy³
+ (\12
+__ty³
+, \12*
+__Þdty³
+);
+
+497 \r\12
+       `±h»ad_ÿnûl
+ (
+±h»ad_t
+__th
+);
+
+502 \r\1e
+       `±h»ad_\8b¡ÿnûl
+ (\1e);
+
+511 
+__jmp_buf
+__ÿnûl_jmp_buf
+;
+
+512 \12
+__mask_was_§ved
+;
+
+513 } 
+__ÿnûl_jmp_buf
+[1];
+
+514 \1e*
+__·d
+[4];
+
+515 } 
+       t__±h»ad_unw\9ad_buf_t
+       t__©\8cibu\8b__
+ ((
+       t__®igÃd__
+));
+
+518 #iâdeà
+__þ\97nup_fù_©\8cibu\8b
+
+
+519 \ 1
+       #__þ\97nup_fù_©\8cibu\8b
+
+
+       )
+
+524 \19
+       s__±h»ad_þ\97nup_äame
+
+
+526 \1e(*
+__ÿnûl_rout\9ae
+) (\1e*);
+
+527 \1e*
+__ÿnûl_¬g
+;
+
+528 \12
+__do_\99
+;
+
+529 \12
+__ÿnûl_ty³
+;
+
+532 #ià
+def\9aed
+__GNUC__
+ && def\9aed 
+__EXCEPTIONS
+
+
+533 #ifdeà
+__ýlu¥lus
+
+
+535 þas 
+       c__±h»ad_þ\97nup_þass
+
+
+537 \1e(*
+__ÿnûl_rout\9ae
+) (\1e*);
+
+538 \1e*
+__ÿnûl_¬g
+;
+
+539 \12
+__do_\99
+;
+
+540 \12
+__ÿnûl_ty³
+;
+
+542 
+public
+:
+
+543 
+       `__±h»ad_þ\97nup_þass
+ (\1e(*
+__fù
+è(\1e*), \1e*
+__¬g
+)
+
+544 : 
+       `__ÿnûl_rout\9ae
+ (
+__fù
+), 
+       `__ÿnûl_¬g
+ (
+__¬g
+), 
+       $__do_\99
+ (1) { }
+
+545 ~
+       $__±h»ad_þ\97nup_þass
+ (è{ ià(
+__do_\99
+       `__ÿnûl_rout\9ae
+ (
+__ÿnûl_¬g
+); 
+       }
+}
+
+546 \1e
+       $__£tdo\99
+ (\12
+__Ãwv®
+è{ 
+__do_\99
+ = __Ãwv®; 
+       }
+}
+
+547 \1e
+       $__deãr
+ (è{ 
+       `±h»ad_£tÿnûÉy³
+ (
+PTHREAD_CANCEL_DEFERRED
+,
+
+548 &
+__ÿnûl_ty³
+); 
+       }
+}
+
+549 \1e
+       $__»¡Üe
+ (ècÚ¡ { 
+       `±h»ad_£tÿnûÉy³
+ (
+__ÿnûl_ty³
+, 0); 
+       }
+}
+
+559 \ 1
+       #±h»ad_þ\97nup_push
+(
+rout\9ae
+, 
+¬g
+) \
+
+561 
+__±h»ad_þ\97nup_þass
+       `__þäame
+ (
+rout\9ae
+, 
+¬g
+)
+
+       )
+
+565 \ 1
+       #±h»ad_þ\97nup_pÝ
+(
+execu\8b
+) \
+
+566 
+__þäame
+.
+       `__£tdo\99
+ (
+execu\8b
+); \
+
+567 } \1f0)
+
+       )
+
+569 #ifdeà
+__USE_GNU
+
+
+573 \ 1
+       #±h»ad_þ\97nup_push_deãr_Å
+(
+rout\9ae
+, 
+¬g
+) \
+
+575 
+__±h»ad_þ\97nup_þass
+       `__þäame
+ (
+rout\9ae
+, 
+¬g
+); \
+
+576 
+__þäame
+.
+       `__deãr
+ ()
+
+       )
+
+581 \ 1
+       #±h»ad_þ\97nup_pÝ_»¡Üe_Å
+(
+execu\8b
+) \
+
+582 
+__þäame
+.
+       `__»¡Üe
+ (); \
+
+583 
+__þäame
+.
+       `__£tdo\99
+ (
+execu\8b
+); \
+
+584 } \1f0)
+
+       )
+
+591 
+__ex\8bº_\9al\9ae
\1e
+
+592 
+       $__±h»ad_þ\97nup_rout\9ae
+ (\19
+__±h»ad_þ\97nup_äame
+ *
+__äame
+)
+
+594 ià(
+__äame
+->
+__do_\99
+)
+
+595 
+__äame
+->
+       `__ÿnûl_rout\9ae
+ (__äame->
+__ÿnûl_¬g
+);
+
+596 
+       }
+}
+
+605 \ 1
+       #±h»ad_þ\97nup_push
+(
+rout\9ae
+, 
+¬g
+) \
+
+607 \19
+__±h»ad_þ\97nup_äame
+__þäame
+ \
+
+608 
+       `__©\8cibu\8b__
+ ((
+       `__þ\97nup__
+ (
+__±h»ad_þ\97nup_rout\9ae
+))) \
+
+609 ð{ .
+__ÿnûl_rout\9ae
+ = (
+rout\9ae
+), .
+__ÿnûl_¬g
+ = (
+¬g
+), \
+
+610 .
+__do_\99
+ = 1 };
+
+       )
+
+614 \ 1
+       #±h»ad_þ\97nup_pÝ
+(
+execu\8b
+) \
+
+615 
+__þäame
+.
+__do_\99
+ = (
+execu\8b
+); \
+
+616 } \1f0)
+
+       )
+
+618 #ifdeà
+__USE_GNU
+
+
+622 \ 1
+       #±h»ad_þ\97nup_push_deãr_Å
+(
+rout\9ae
+, 
+¬g
+) \
+
+624 \19
+__±h»ad_þ\97nup_äame
+__þäame
+ \
+
+625 
+       `__©\8cibu\8b__
+ ((
+       `__þ\97nup__
+ (
+__±h»ad_þ\97nup_rout\9ae
+))) \
+
+626 ð{ .
+__ÿnûl_rout\9ae
+ = (
+rout\9ae
+), .
+__ÿnûl_¬g
+ = (
+¬g
+), \
+
+627 .
+__do_\99
+ = 1 }; \
+
+628 (\1eè
+       `±h»ad_£tÿnûÉy³
+ (
+PTHREAD_CANCEL_DEFERRED
+, \
+
+629 &
+__þäame
+.
+__ÿnûl_ty³
+)
+
+       )
+
+634 \ 1
+       #±h»ad_þ\97nup_pÝ_»¡Üe_Å
+(
+execu\8b
+) \
+
+635 (\1eè
+       `±h»ad_£tÿnûÉy³
+ (
+__þäame
+.
+__ÿnûl_ty³
+, 
+NULL
+); \
+
+636 
+__þäame
+.
+__do_\99
+ = (
+execu\8b
+); \
+
+637 } \1f0)
+
+       )
+
+648 \ 1
+       #±h»ad_þ\97nup_push
+(
+rout\9ae
+, 
+¬g
+) \
+
+650 
+__±h»ad_unw\9ad_buf_t
+__ÿnûl_buf
+; \
+
+651 \1e(*
+__ÿnûl_rout\9ae
+è(\1e*èð(
+rout\9ae
+); \
+
+652 \1e*
+__ÿnûl_¬g
+ = (
+¬g
+); \
+
+653 \12
+__nÙ_f\9c¡_ÿÎ
+ = 
+       `__sig£tjmp
+ ((\19
+__jmp_buf_\8fg
+ *) (\1e*) \
+
+654 
+__ÿnûl_buf
+.
+__ÿnûl_jmp_buf
+, 0); \
+
+655 ià(
+       `__bu\9et\9a_ex³ù
+ (
+__nÙ_f\9c¡_ÿÎ
+, 0)) \
+
+657 
+       `__ÿnûl_rout\9ae
+ (
+__ÿnûl_¬g
+); \
+
+658 
+       `__±h»ad_unw\9ad_Ãxt
+ (&
+__ÿnûl_buf
+); \
+
+662 
+       `__±h»ad_»gi¡\94_ÿnûl
+ (&
+__ÿnûl_buf
+); \
+
+663 dØ{
+
+       )
+
+664 \r\1e
+__±h»ad_»gi¡\94_ÿnûl
+ (
+__±h»ad_unw\9ad_buf_t
+ *
+__buf
+)
+
+665 
+__þ\97nup_fù_©\8cibu\8b
+;
+
+669 \ 1
+       #±h»ad_þ\97nup_pÝ
+(
+execu\8b
+) \
+
+672 
+       `__±h»ad_uÄegi¡\94_ÿnûl
+ (&
+__ÿnûl_buf
+); \
+
+673 ià(
+execu\8b
+) \
+
+674 
+       `__ÿnûl_rout\9ae
+ (
+__ÿnûl_¬g
+); \
+
+675 } \1f0)
+
+       )
+
+676 \r\1e
+       $__±h»ad_uÄegi¡\94_ÿnûl
+ (
+__±h»ad_unw\9ad_buf_t
+ *
+__buf
+)
+
+677 
+__þ\97nup_fù_©\8cibu\8b
+;
+
+679 #ifdeà
+__USE_GNU
+
+
+683 \ 1
+       #±h»ad_þ\97nup_push_deãr_Å
+(
+rout\9ae
+, 
+¬g
+) \
+
+685 
+__±h»ad_unw\9ad_buf_t
+__ÿnûl_buf
+; \
+
+686 \1e(*
+__ÿnûl_rout\9ae
+è(\1e*èð(
+rout\9ae
+); \
+
+687 \1e*
+__ÿnûl_¬g
+ = (
+¬g
+); \
+
+688 \12
+__nÙ_f\9c¡_ÿÎ
+ = 
+       `__sig£tjmp
+ ((\19
+__jmp_buf_\8fg
+ *) (\1e*) \
+
+689 
+__ÿnûl_buf
+.
+__ÿnûl_jmp_buf
+, 0); \
+
+690 ià(
+       `__bu\9et\9a_ex³ù
+ (
+__nÙ_f\9c¡_ÿÎ
+, 0)) \
+
+692 
+       `__ÿnûl_rout\9ae
+ (
+__ÿnûl_¬g
+); \
+
+693 
+       `__±h»ad_unw\9ad_Ãxt
+ (&
+__ÿnûl_buf
+); \
+
+697 
+       `__±h»ad_»gi¡\94_ÿnûl_deãr
+ (&
+__ÿnûl_buf
+); \
+
+698 dØ{
+
+       )
+
+699 \r\1e
+       `__±h»ad_»gi¡\94_ÿnûl_deãr
+ (
+__±h»ad_unw\9ad_buf_t
+ *
+__buf
+)
+
+700 
+__þ\97nup_fù_©\8cibu\8b
+;
+
+705 \ 1
+       #±h»ad_þ\97nup_pÝ_»¡Üe_Å
+(
+execu\8b
+) \
+
+708 
+       `__±h»ad_uÄegi¡\94_ÿnûl_»¡Üe
+ (&
+__ÿnûl_buf
+); \
+
+709 ià(
+execu\8b
+) \
+
+710 
+       `__ÿnûl_rout\9ae
+ (
+__ÿnûl_¬g
+); \
+
+711 
+       }
+} \1f0)
+
+       )
+
+712 \r\1e
+       $__±h»ad_uÄegi¡\94_ÿnûl_»¡Üe
+ (
+__±h»ad_unw\9ad_buf_t
+ *
+__buf
+)
+
+713 
+__þ\97nup_fù_©\8cibu\8b
+;
+
+717 \r\1e
+       $__±h»ad_unw\9ad_Ãxt
+ (
+__±h»ad_unw\9ad_buf_t
+ *
+__buf
+)
+
+718 
+__þ\97nup_fù_©\8cibu\8b
+       `__©\8cibu\8b__
+ ((
+__nÜ\91uº__
+))
+
+719 #iâdeà
+SHARED
+
+
+720 
+       `__©\8cibu\8b__
+ ((
+__w\97k__
+))
+
+726 \19
+__jmp_buf_\8fg
+;
+
+727 \r\12
+       $__sig£tjmp
+ (\19
+__jmp_buf_\8fg
+ *
+__\92v
+, \12
+__§vemask
+__THROW
+;
+
+733 \r\12
+       $±h»ad_mu\8bx_\9a\99
+ (
+±h»ad_mu\8bx_t
+ *
+__mu\8bx
+,
+
+734 
+__cڡ
+±h»ad_mu\8b\8c_t
+ *
+__mu\8b\8c
+)
+
+735 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+738 \r\12
+       $±h»ad_mu\8bx_de¡roy
+ (
+±h»ad_mu\8bx_t
+ *
+__mu\8bx
+)
+
+739 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+742 \r\12
+       $±h»ad_mu\8bx_\8cylock
+ (
+±h»ad_mu\8bx_t
+ *
+__mu\8bx
+)
+
+743 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+746 \r\12
+       $±h»ad_mu\8bx_lock
+ (
+±h»ad_mu\8bx_t
+ *
+__mu\8bx
+)
+
+747 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+749 #ifdeà
+__USE_XOPEN2K
+
+
+751 \r\12
+       $±h»ad_mu\8bx_timedlock
+ (
+±h»ad_mu\8bx_t
+ *
+__»¡riù
+__mu\8bx
+,
+
+752 
+__cڡ
\19
+time¥ec
+ *
+__»¡riù
+
+
+753 
+__ab¡ime
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+757 \r\12
+       $±h»ad_mu\8bx_uÆock
+ (
+±h»ad_mu\8bx_t
+ *
+__mu\8bx
+)
+
+758 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+762 \r\12
+       $±h»ad_mu\8bx_g\91´ioû\9e\9ag
+ (
+__cڡ
+±h»ad_mu\8bx_t
+ *
+
+763 
+__»¡riù
+__mu\8bx
+,
+
+764 \12*
+__»¡riù
+__´ioû\9e\9ag
+)
+
+765 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+769 \r\12
+       $±h»ad_mu\8bx_£\8drioû\9e\9ag
+ (
+±h»ad_mu\8bx_t
+ *
+__»¡riù
+__mu\8bx
+,
+
+770 \12
+__´ioû\9e\9ag
+,
+
+771 \12*
+__»¡riù
+__Þd_û\9e\9ag
+)
+
+772 
+__THROW
+       `__nÚnuÎ
+ ((1, 3));
+
+775 #ifdeà
+__USE_XOPEN2K8
+
+
+777 \r\12
+       $±h»ad_mu\8bx_cÚsi¡\92t
+ (
+±h»ad_mu\8bx_t
+ *
+__mu\8bx
+)
+
+778 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+779 #ifdeà
+__USE_GNU
+
+
+780 \r\12
+       $±h»ad_mu\8bx_cÚsi¡\92t_Å
+ (
+±h»ad_mu\8bx_t
+ *
+__mu\8bx
+)
+
+781 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+790 \r\12
+       $±h»ad_mu\8b\8c_\9a\99
+ (
+±h»ad_mu\8b\8c_t
+ *
+__©\8c
+)
+
+791 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+794 \r\12
+       $±h»ad_mu\8b\8c_de¡roy
+ (
+±h»ad_mu\8b\8c_t
+ *
+__©\8c
+)
+
+795 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+798 \r\12
+       $±h»ad_mu\8b\8c_g\91psh¬ed
+ (
+__cڡ
+±h»ad_mu\8b\8c_t
+ *
+
+799 
+__»¡riù
+__©\8c
+,
+
+800 \12*
+__»¡riù
+__psh¬ed
+)
+
+801 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+804 \r\12
+       $±h»ad_mu\8b\8c\8dsh¬ed
+ (
+±h»ad_mu\8b\8c_t
+ *
+__©\8c
+,
+
+805 \12
+__psh¬ed
+)
+
+806 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+808 #ià
+def\9aed
+__USE_UNIX98
+ || def\9aed 
+__USE_XOPEN2K8
+
+
+810 \r\12
+       $±h»ad_mu\8b\8c_g\91ty³
+ (
+__cڡ
+±h»ad_mu\8b\8c_t
+ *
+__»¡riù
+
+
+811 
+__©\8c
+, \12*
+__»¡riù
+__k\9ad
+)
+
+812 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+817 \r\12
+       $±h»ad_mu\8b\8c\89
+ (
+±h»ad_mu\8b\8c_t
+ *
+__©\8c
+, \12
+__k\9ad
+)
+
+818 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+822 \r\12
+       $±h»ad_mu\8b\8c_g\91´ÙocÞ
+ (
+__cڡ
+±h»ad_mu\8b\8c_t
+ *
+
+823 
+__»¡riù
+__©\8c
+,
+
+824 \12*
+__»¡riù
+__´ÙocÞ
+)
+
+825 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+829 \r\12
+       $±h»ad_mu\8b\8c\8drÙocÞ
+ (
+±h»ad_mu\8b\8c_t
+ *
+__©\8c
+,
+
+830 \12
+__´ÙocÞ
+)
+
+831 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+834 \r\12
+       $±h»ad_mu\8b\8c_g\91´ioû\9e\9ag
+ (
+__cڡ
+±h»ad_mu\8b\8c_t
+ *
+
+835 
+__»¡riù
+__©\8c
+,
+
+836 \12*
+__»¡riù
+__´ioû\9e\9ag
+)
+
+837 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+840 \r\12
+       $±h»ad_mu\8b\8c\8drioû\9e\9ag
+ (
+±h»ad_mu\8b\8c_t
+ *
+__©\8c
+,
+
+841 \12
+__´ioû\9e\9ag
+)
+
+842 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+844 #ifdeà
+__USE_XOPEN2K
+
+
+846 \r\12
+       $±h»ad_mu\8b\8c_g\91robu¡
+ (
+__cڡ
+±h»ad_mu\8b\8c_t
+ *
+__©\8c
+,
+
+847 \12*
+__robu¡Ãss
+)
+
+848 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+849 #ifdeà
+__USE_GNU
+
+
+850 \r\12
+       $±h»ad_mu\8b\8c_g\91robu¡_Å
+ (
+__cڡ
+±h»ad_mu\8b\8c_t
+ *
+__©\8c
+,
+
+851 \12*
+__robu¡Ãss
+)
+
+852 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+856 \r\12
+       $±h»ad_mu\8b\8c\8cobu¡
+ (
+±h»ad_mu\8b\8c_t
+ *
+__©\8c
+,
+
+857 \12
+__robu¡Ãss
+)
+
+858 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+859 #ifdeà
+__USE_GNU
+
+
+860 \r\12
+       $±h»ad_mu\8b\8c\8cobu¡_Å
+ (
+±h»ad_mu\8b\8c_t
+ *
+__©\8c
+,
+
+861 \12
+__robu¡Ãss
+)
+
+862 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+867 #ià
+def\9aed
+__USE_UNIX98
+ || def\9aed 
+__USE_XOPEN2K
+
+
+872 \r\12
+       $±h»ad_rwlock_\9a\99
+ (
+±h»ad_rwlock_t
+ *
+__»¡riù
+__rwlock
+,
+
+873 
+__cڡ
+±h»ad_rwlock©\8c_t
+ *
+__»¡riù
+
+
+874 
+__©\8c
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+877 \r\12
+       $±h»ad_rwlock_de¡roy
+ (
+±h»ad_rwlock_t
+ *
+__rwlock
+)
+
+878 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+881 \r\12
+       $±h»ad_rwlock_rdlock
+ (
+±h»ad_rwlock_t
+ *
+__rwlock
+)
+
+882 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+885 \r\12
+       $±h»ad_rwlock_\8cyrdlock
+ (
+±h»ad_rwlock_t
+ *
+__rwlock
+)
+
+886 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+888 #ifdeà
+__USE_XOPEN2K
+
+
+890 \r\12
+       $±h»ad_rwlock_timedrdlock
+ (
+±h»ad_rwlock_t
+ *
+__»¡riù
+__rwlock
+,
+
+891 
+__cڡ
\19
+time¥ec
+ *
+__»¡riù
+
+
+892 
+__ab¡ime
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+896 \r\12
+       $±h»ad_rwlock_w¾ock
+ (
+±h»ad_rwlock_t
+ *
+__rwlock
+)
+
+897 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+900 \r\12
+       $±h»ad_rwlock_\8cyw¾ock
+ (
+±h»ad_rwlock_t
+ *
+__rwlock
+)
+
+901 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+903 #ifdeà
+__USE_XOPEN2K
+
+
+905 \r\12
+       $±h»ad_rwlock_timedw¾ock
+ (
+±h»ad_rwlock_t
+ *
+__»¡riù
+__rwlock
+,
+
+906 
+__cڡ
\19
+time¥ec
+ *
+__»¡riù
+
+
+907 
+__ab¡ime
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+911 \r\12
+       $±h»ad_rwlock_uÆock
+ (
+±h»ad_rwlock_t
+ *
+__rwlock
+)
+
+912 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+918 \r\12
+       $±h»ad_rwlock©\8c_\9a\99
+ (
+±h»ad_rwlock©\8c_t
+ *
+__©\8c
+)
+
+919 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+922 \r\12
+       $±h»ad_rwlock©\8c_de¡roy
+ (
+±h»ad_rwlock©\8c_t
+ *
+__©\8c
+)
+
+923 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+926 \r\12
+       $±h»ad_rwlock©\8c_g\91psh¬ed
+ (
+__cڡ
+±h»ad_rwlock©\8c_t
+ *
+
+927 
+__»¡riù
+__©\8c
+,
+
+928 \12*
+__»¡riù
+__psh¬ed
+)
+
+929 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+932 \r\12
+       $±h»ad_rwlock©\8c\8dsh¬ed
+ (
+±h»ad_rwlock©\8c_t
+ *
+__©\8c
+,
+
+933 \12
+__psh¬ed
+)
+
+934 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+937 \r\12
+       $±h»ad_rwlock©\8c_g\91k\9ad_Å
+ (
+__cڡ
+±h»ad_rwlock©\8c_t
+ *
+
+938 
+__»¡riù
+__©\8c
+,
+
+939 \12*
+__»¡riù
+__´ef
+)
+
+940 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+943 \r\12
+       $±h»ad_rwlock©\8c_£tk\9ad_Å
+ (
+±h»ad_rwlock©\8c_t
+ *
+__©\8c
+,
+
+944 \12
+__´ef
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+952 \r\12
+       $±h»ad_cÚd_\9a\99
+ (
+±h»ad_cÚd_t
+ *
+__»¡riù
+__cÚd
+,
+
+953 
+__cڡ
+±h»ad_cÚd©\8c_t
+ *
+__»¡riù
+
+
+954 
+__cÚd_©\8c
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+957 \r\12
+       $±h»ad_cÚd_de¡roy
+ (
+±h»ad_cÚd_t
+ *
+__cÚd
+)
+
+958 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+961 \r\12
+       $±h»ad_cÚd_sigÇl
+ (
+±h»ad_cÚd_t
+ *
+__cÚd
+)
+
+962 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+965 \r\12
+       $±h»ad_cÚd_brßdÿ¡
+ (
+±h»ad_cÚd_t
+ *
+__cÚd
+)
+
+966 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+973 \r\12
+       $±h»ad_cÚd_wa\99
+ (
+±h»ad_cÚd_t
+ *
+__»¡riù
+__cÚd
+,
+
+974 
+±h»ad_mu\8bx_t
+ *
+__»¡riù
+__mu\8bx
+)
+
+975 
+       `__nÚnuÎ
+ ((1, 2));
+
+984 \r\12
+       $±h»ad_cÚd_timedwa\99
+ (
+±h»ad_cÚd_t
+ *
+__»¡riù
+__cÚd
+,
+
+985 
+±h»ad_mu\8bx_t
+ *
+__»¡riù
+__mu\8bx
+,
+
+986 
+__cڡ
\19
+time¥ec
+ *
+__»¡riù
+
+
+987 
+__ab¡ime
+       `__nÚnuÎ
+ ((1, 2, 3));
+
+992 \r\12
+       $±h»ad_cÚd©\8c_\9a\99
+ (
+±h»ad_cÚd©\8c_t
+ *
+__©\8c
+)
+
+993 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+996 \r\12
+       $±h»ad_cÚd©\8c_de¡roy
+ (
+±h»ad_cÚd©\8c_t
+ *
+__©\8c
+)
+
+997 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+1000 \r\12
+       $±h»ad_cÚd©\8c_g\91psh¬ed
+ (
+__cڡ
+±h»ad_cÚd©\8c_t
+ *
+
+1001 
+__»¡riù
+__©\8c
+,
+
+1002 \12*
+__»¡riù
+__psh¬ed
+)
+
+1003 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+1006 \r\12
+       $±h»ad_cÚd©\8c\8dsh¬ed
+ (
+±h»ad_cÚd©\8c_t
+ *
+__©\8c
+,
+
+1007 \12
+__psh¬ed
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+1009 #ifdeà
+__USE_XOPEN2K
+
+
+1011 \r\12
+       $±h»ad_cÚd©\8c_g\91þock
+ (
+__cڡ
+±h»ad_cÚd©\8c_t
+ *
+
+1012 
+__»¡riù
+__©\8c
+,
+
+1013 
+__þockid_t
+ *
+__»¡riù
+__þock_id
+)
+
+1014 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+1017 \r\12
+       $±h»ad_cÚd©\8c_£tþock
+ (
+±h»ad_cÚd©\8c_t
+ *
+__©\8c
+,
+
+1018 
+__þockid_t
+__þock_id
+)
+
+1019 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+1023 #ifdeà
+__USE_XOPEN2K
+
+
+1028 \r\12
+       $±h»ad_¥\9a_\9a\99
+ (
+±h»ad_¥\9alock_t
+ *
+__lock
+, \12
+__psh¬ed
+)
+
+1029 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+1032 \r\12
+       $±h»ad_¥\9a_de¡roy
+ (
+±h»ad_¥\9alock_t
+ *
+__lock
+)
+
+1033 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+1036 \r\12
+       $±h»ad_¥\9a_lock
+ (
+±h»ad_¥\9alock_t
+ *
+__lock
+)
+
+1037 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+1040 \r\12
+       $±h»ad_¥\9a_\8cylock
+ (
+±h»ad_¥\9alock_t
+ *
+__lock
+)
+
+1041 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+1044 \r\12
+       $±h»ad_¥\9a_uÆock
+ (
+±h»ad_¥\9alock_t
+ *
+__lock
+)
+
+1045 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+1052 \r\12
+       $±h»ad_b¬r\9br_\9a\99
+ (
+±h»ad_b¬r\9br_t
+ *
+__»¡riù
+__b¬r\9br
+,
+
+1053 
+__cڡ
+±h»ad_b¬r\9b¿\89r_t
+ *
+__»¡riù
+
+
+1054 
+__©\8c
+, \1d\12
+__couÁ
+)
+
+1055 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+1058 \r\12
+       $±h»ad_b¬r\9br_de¡roy
+ (
+±h»ad_b¬r\9br_t
+ *
+__b¬r\9br
+)
+
+1059 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+1062 \r\12
+       $±h»ad_b¬r\9br_wa\99
+ (
+±h»ad_b¬r\9br_t
+ *
+__b¬r\9br
+)
+
+1063 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+1067 \r\12
+       $±h»ad_b¬r\9b¿\89r_\9a\99
+ (
+±h»ad_b¬r\9b¿\89r_t
+ *
+__©\8c
+)
+
+1068 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+1071 \r\12
+       $±h»ad_b¬r\9b¿\89r_de¡roy
+ (
+±h»ad_b¬r\9b¿\89r_t
+ *
+__©\8c
+)
+
+1072 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+1075 \r\12
+       $±h»ad_b¬r\9b¿\89r_g\91psh¬ed
+ (
+__cڡ
+±h»ad_b¬r\9b¿\89r_t
+ *
+
+1076 
+__»¡riù
+__©\8c
+,
+
+1077 \12*
+__»¡riù
+__psh¬ed
+)
+
+1078 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+1081 \r\12
+       $±h»ad_b¬r\9b¿\89r_£\8dsh¬ed
+ (
+±h»ad_b¬r\9b¿\89r_t
+ *
+__©\8c
+,
+
+1082 \12
+__psh¬ed
+)
+
+1083 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+1095 \r\12
+       `±h»ad_key_ü\97\8b
+ (
+±h»ad_key_t
+ *
+__key
+,
+
+1096 \1e(*
+__de¡r_funùiÚ
+) (\1e*))
+
+1097 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+1100 \r\12
+       $±h»ad_key_d\96\91e
+ (
+±h»ad_key_t
+__key
+__THROW
+;
+
+1103 \r\1e*
+       $±h»ad_g\91¥ecific
+ (
+±h»ad_key_t
+__key
+__THROW
+;
+
+1106 \r\12
+       $±h»ad_£t¥ecific
+ (
+±h»ad_key_t
+__key
+,
+
+1107 
+__cڡ
\1e*
+__po\9a\8br
+__THROW
+ ;
+
+1110 #ifdeà
+__USE_XOPEN2K
+
+
+1112 \r\12
+       $±h»ad_g\91ýuþockid
+ (
+±h»ad_t
+__th»ad_id
+,
+
+1113 
+__þockid_t
+ *
+__þock_id
+)
+
+1114 
+__THROW
+       `__nÚnuÎ
+ ((2));
+
+1129 \r\12
+       `±h»ad_©fÜk
+ (\1e(*
+__´\95¬e
+) (\1e),
+
+1130 \1e(*
+__·»Á
+) (\1e),
+
+1131 \1e(*
+__ch\9ed
+è(\1e
+__THROW
+;
+
+1134 #ifdeà
+__USE_EXTERN_INLINES
+
+
+1136 
+__ex\8bº_\9al\9ae
\12
+
+1137 
+       `__NTH
+ (
+       $±h»ad_equ®
+ (
+±h»ad_t
+__th»ad1
+,\85th»ad_\88
+__th»ad2
+))
+
+1139 \15 
+__th»ad1
+ =ð
+__th»ad2
+;
+
+1140 
+       }
+}
+
+1143 
+       g__END_DECLS
+
+
+       @/usr/include/stdio.h
+
+24 #iâdeà
+_STDIO_H
+
+
+26 #ià!
+def\9aed
+__Ãed_FILE
+ && !def\9aed 
+__Ãed___FILE
+
+
+27 \ 1
+       #_STDIO_H
+ 1
+
+       )
+
+28 \ 2
+       ~<ã©u»s.h
+>
+
+30 
+       g__BEGIN_DECLS
+
+
+32 \ 1
+       #__Ãed_size_t
+
+
+       )
+
+33 \ 1
+       #__Ãed_NULL
+
+
+       )
+
+34 \ 2
+       ~<¡ddef.h
+>
+
+36 \ 2
+       ~<b\99s/ty³s.h
+>
+
+37 \ 1
+       #__Ãed_FILE
+
+
+       )
+
+38 \ 1
+       #__Ãed___FILE
+
+
+       )
+
+42 #ià!
+def\9aed
+__FILE_def\9aed
+ && def\9aed 
+__Ãed_FILE
+
+
+45 \19
+       g_IO_FILE
+;
+
+47 
+__BEGIN_NAMESPACE_STD
+
+
+49 \e\19
+_IO_FILE
+       tFILE
+;
+
+50 
+       g__END_NAMESPACE_STD
+
+
+51 #ià
+def\9aed
+__USE_LARGEFILE64
+ || def\9aed 
+__USE_SVID
+ || def\9aed 
+__USE_POSIX
+ \
+
+52 || 
+def\9aed
+       g__USE_BSD
+ || def\9aed 
+       g__USE_ISOC99
+ || def\9aed 
+       g__USE_XOPEN
+ \
+
+53 || 
+def\9aed
+__USE_POSIX2
+
+
+54 
+       $__USING_NAMESPACE_STD
+(
+FILE
+)
+
+57 \ 1
+       #__FILE_def\9aed
+ 1
+
+       )
+
+59 #undeà
+__Ãed_FILE
+
+
+62 #ià!
+def\9aed
+____FILE_def\9aed
+ && def\9aed 
+__Ãed___FILE
+
+
+65 \e\19
+_IO_FILE
+       t__FILE
+;
+
+67 \ 1
+       #____FILE_def\9aed
+ 1
+
+       )
+
+69 #undeà
+__Ãed___FILE
+
+
+72 #ifdef 
+_STDIO_H
+
+
+73 \ 1
+       #_STDIO_USES_IOSTREAM
+
+
+       )
+
+75 \ 2
+       ~<libio.h
+>
+
+77 #ià
+def\9aed
+__USE_XOPEN
+ || def\9aed 
+__USE_XOPEN2K8
+
+
+78 #ifdeà
+__GNUC__
+
+
+79 #iâdeà
+_VA_LIST_DEFINED
+
+
+80 \e
+_G_va_li¡
+       tva_li¡
+;
+
+81 \ 1
+       #_VA_LIST_DEFINED
+
+
+       )
+
+84 \ 2
+       ~<¡d¬g.h
+>
+
+88 #ifdeà
+__USE_XOPEN2K8
+
+
+89 #iâdeà
+__off_t_def\9aed
+
+
+90 #iâdeà
+__USE_FILE_OFFSET64
+
+
+91 \e
+__off_t
+       toff_t
+;
+
+93 \e
+__off64_t
+       toff_t
+;
+
+95 \ 1
+       #__off_t_def\9aed
+
+
+       )
+
+97 #ià
+def\9aed
+__USE_LARGEFILE64
+ && !def\9aed 
+__off64_t_def\9aed
+
+
+98 \e
+__off64_t
+       toff64_t
+;
+
+99 \ 1
+       #__off64_t_def\9aed
+
+
+       )
+
+102 #iâdeà
+__ssize_t_def\9aed
+
+
+103 \e
+__ssize_t
+       tssize_t
+;
+
+104 \ 1
+       #__ssize_t_def\9aed
+
+
+       )
+
+109 
+__BEGIN_NAMESPACE_STD
+
+
+110 #iâdeà
+__USE_FILE_OFFSET64
+
+
+111 \e
+_G_åos_t
+       tåos_t
+;
+
+113 \e
+_G_åos64_t
+       tåos_t
+;
+
+115 
+__END_NAMESPACE_STD
+
+
+116 #ifdeà
+__USE_LARGEFILE64
+
+
+117 \e
+_G_åos64_t
+       tåos64_t
+;
+
+121 \ 1
+       #_IOFBF
+ 0
+
+       )
+
+122 \ 1
+       #_IOLBF
+ 1
+
+       )
+
+123 \ 1
+       #_IONBF
+ 2
+
+       )
+
+127 #iâdeà
+BUFSIZ
+
+
+128 \ 1
+       #BUFSIZ
+_IO_BUFSIZ
+
+
+       )
+
+134 #iâdeà
+EOF
+
+
+135 \ 1
+       #EOF
+ (-1)
+
+       )
+
+141 \ 1
+       #SEEK_SET
+ 0
+
+       )
+
+142 \ 1
+       #SEEK_CUR
+ 1
+
+       )
+
+143 \ 1
+       #SEEK_END
+ 2
+
+       )
+
+146 #ià
+def\9aed
+__USE_SVID
+ || def\9aed 
+__USE_XOPEN
+
+
+148 \ 1
+       #P_tmpd\9c
+ "/tmp"
+
+       )
+
+161 \ 2
+       ~<b\99s/¡dio_lim.h
+>
+
+165 \r\19
+_IO_FILE
+ *
+¡d\9a
+;
+
+166 \r\19
+_IO_FILE
+ *
+¡dout
+;
+
+167 \r\19
+_IO_FILE
+ *
+¡d\94r
+;
+
+169 \ 1
+       #¡d\9a
+¡d\9a
+
+
+       )
+
+170 \ 1
+       #¡dout
+¡dout
+
+
+       )
+
+171 \ 1
+       #¡d\94r
+¡d\94r
+
+
+       )
+
+173 
+__BEGIN_NAMESPACE_STD
+
+
+175 \r\12
+       $»move
+ (
+__cڡ
\ 5*
+__f\9e\92ame
+__THROW
+;
+
+177 \r\12
+       $»Çme
+ (
+__cڡ
\ 5*
+__Þd
+, __cڡ \ 5*
+__Ãw
+__THROW
+;
+
+178 
+__END_NAMESPACE_STD
+
+
+180 #ifdeà
+__USE_ATFILE
+
+
+182 \r\12
+       $»Çm\97t
+ (\12
+__Þdfd
+, 
+__cڡ
\ 5*
+__Þd
+, \12
+__Ãwfd
+,
+
+183 
+__cڡ
\ 5*
+__Ãw
+__THROW
+;
+
+186 
+__BEGIN_NAMESPACE_STD
+
+
+191 #iâdeà
+__USE_FILE_OFFSET64
+
+
+192 \r
+FILE
+ *
+       $tmpf\9ee
+ (\1eè
+__wur
+;
+
+194 #ifdeà
+__REDIRECT
+
+
+195 \r
+FILE
+ *
+       `__REDIRECT
+ (
+tmpf\9ee
+, (\1e), 
+tmpf\9ee64
+__wur
+;
+
+197 \ 1
+       #tmpf\9ee
+tmpf\9ee64
+
+
+       )
+
+201 #ifdeà
+__USE_LARGEFILE64
+
+
+202 \r
+FILE
+ *
+       $tmpf\9ee64
+ (\1eè
+__wur
+;
+
+206 \r\ 5*
+       $tm²am
+ (\ 5*
+__s
+__THROW
+__wur
+;
+
+207 
+__END_NAMESPACE_STD
+
+
+209 #ifdeà
+__USE_MISC
+
+
+212 \r\ 5*
+       $tm²am_r
+ (\ 5*
+__s
+__THROW
+__wur
+;
+
+216 #ià
+def\9aed
+__USE_SVID
+ || def\9aed 
+__USE_XOPEN
+
+
+224 \r\ 5*
+       $\8bm²am
+ (
+__cڡ
\ 5*
+__d\9c
+, __cڡ \ 5*
+__pfx
+)
+
+225 
+__THROW
+__©\8cibu\8b_m®loc__
+__wur
+;
+
+229 
+__BEGIN_NAMESPACE_STD
+
+
+234 \r\12
+       `fþo£
+ (
+FILE
+ *
+__¡»am
+);
+
+239 \r\12
+       `fæush
+ (
+FILE
+ *
+__¡»am
+);
+
+240 
+__END_NAMESPACE_STD
+
+
+242 #ifdeà
+__USE_MISC
+
+
+249 \r\12
+       `fæush_uÆocked
+ (
+FILE
+ *
+__¡»am
+);
+
+252 #ifdeà
+__USE_GNU
+
+
+259 \r\12
+       `fþo£®l
+ (\1e);
+
+263 
+__BEGIN_NAMESPACE_STD
+
+
+264 #iâdeà
+__USE_FILE_OFFSET64
+
+
+269 \r
+FILE
+ *
+       $fݒ
+ (
+__cڡ
\ 5*
+__»¡riù
+__f\9e\92ame
+,
+
+270 
+__cڡ
\ 5*
+__»¡riù
+__modes
+__wur
+;
+
+275 \r
+FILE
+ *
+       $äeÝ\92
+ (
+__cڡ
\ 5*
+__»¡riù
+__f\9e\92ame
+,
+
+276 
+__cڡ
\ 5*
+__»¡riù
+__modes
+,
+
+277 
+FILE
+ *
+__»¡riù
+__¡»am
+__wur
+;
+
+279 #ifdeà
+__REDIRECT
+
+
+280 \r
+FILE
+ *
+       `__REDIRECT
+ (
+fݒ
+, (
+__cڡ
\ 5*
+__»¡riù
+__f\9e\92ame
+,
+
+281 
+__cڡ
\ 5*
+__»¡riù
+__modes
+), 
+fݒ64
+)
+
+282 
+__wur
+;
+
+283 \r
+FILE
+ *
+       `__REDIRECT
+ (
+äeÝ\92
+, (
+__cڡ
\ 5*
+__»¡riù
+__f\9e\92ame
+,
+
+284 
+__cڡ
\ 5*
+__»¡riù
+__modes
+,
+
+285 
+FILE
+ *
+__»¡riù
+__¡»am
+), 
+äeÝ\9264
+)
+
+286 
+__wur
+;
+
+288 \ 1
+       #fݒ
+fݒ64
+
+
+       )
+
+289 \ 1
+       #äeÝ\92
+äeÝ\9264
+
+
+       )
+
+292 
+__END_NAMESPACE_STD
+
+
+293 #ifdeà
+__USE_LARGEFILE64
+
+
+294 \r
+FILE
+ *
+       $fݒ64
+ (
+__cڡ
\ 5*
+__»¡riù
+__f\9e\92ame
+,
+
+295 
+__cڡ
\ 5*
+__»¡riù
+__modes
+__wur
+;
+
+296 \r
+FILE
+ *
+       $äeÝ\9264
+ (
+__cڡ
\ 5*
+__»¡riù
+__f\9e\92ame
+,
+
+297 
+__cڡ
\ 5*
+__»¡riù
+__modes
+,
+
+298 
+FILE
+ *
+__»¡riù
+__¡»am
+__wur
+;
+
+301 #ifdef 
+__USE_POSIX
+
+
+303 \r
+FILE
+ *
+       $fdݒ
+ (\12
+__fd
+, 
+__cڡ
\ 5*
+__modes
+__THROW
+__wur
+;
+
+306 #ifdef 
+__USE_GNU
+
+
+309 \r
+FILE
+ *
+       $fÝ\92cook\9b
+ (\1e*
+__»¡riù
+__magic_cook\9b
+,
+
+310 
+__cڡ
\ 5*
+__»¡riù
+__modes
+,
+
+311 
+_IO_cook\9b_io_funùiÚs_t
+__io_funcs
+__THROW
+__wur
+;
+
+314 #ifdeà
+__USE_XOPEN2K8
+
+
+316 \r
+FILE
+ *
+       $fmemݒ
+ (\1e*
+__s
+, 
+size_t
+__Ën
+, 
+__cڡ
\ 5*
+__modes
+)
+
+317 
+__THROW
+__wur
+;
+
+322 \r
+FILE
+ *
+       $Ý\92_mem¡»am
+ (\ 5**
+__buæoc
+, 
+size_t
+ *
+__siz\96oc
+__THROW
+__wur
+;
+
+326 
+__BEGIN_NAMESPACE_STD
+
+
+329 \r\1e
+       $£tbuf
+ (
+FILE
+ *
+__»¡riù
+__¡»am
+, \ 5*__»¡riù 
+__buf
+__THROW
+;
+
+333 \r\12
+       $£tvbuf
+ (
+FILE
+ *
+__»¡riù
+__¡»am
+, \ 5*__»¡riù 
+__buf
+,
+
+334 \12
+__modes
+, 
+size_t
+__n
+__THROW
+;
+
+335 
+__END_NAMESPACE_STD
+
+
+337 #ifdef 
+__USE_BSD
+
+
+340 \r\1e
+       $£tbufãr
+ (
+FILE
+ *
+__»¡riù
+__¡»am
+, \ 5*__»¡riù 
+__buf
+,
+
+341 
+size_t
+__size
+__THROW
+;
+
+344 \r\1e
+       $£\8e\9aebuf
+ (
+FILE
+ *
+__¡»am
+__THROW
+;
+
+348 
+__BEGIN_NAMESPACE_STD
+
+
+353 \r\12
+       `år\9atf
+ (
+FILE
+ *
+__»¡riù
+__¡»am
+,
+
+354 
+__cڡ
\ 5*
+__»¡riù
+__fÜm©
+, ...);
+
+359 \r\12
+       `´\9atf
+ (
+__cڡ
\ 5*
+__»¡riù
+__fÜm©
+, ...);
+
+361 \r\12
+       $¥r\9atf
+ (\ 5*
+__»¡riù
+__s
+,
+
+362 
+__cڡ
\ 5*
+__»¡riù
+__fÜm©
+, ...è
+__THROW
+;
+
+368 \r\12
+       `vår\9atf
+ (
+FILE
+ *
+__»¡riù
+__s
+, 
+__cڡ
\ 5*__»¡riù 
+__fÜm©
+,
+
+369 
+_G_va_li¡
+__¬g
+);
+
+374 \r\12
+       `v´\9atf
+ (
+__cڡ
\ 5*
+__»¡riù
+__fÜm©
+, 
+_G_va_li¡
+__¬g
+);
+
+376 \r\12
+       $v¥r\9atf
+ (\ 5*
+__»¡riù
+__s
+, 
+__cڡ
\ 5*__»¡riù 
+__fÜm©
+,
+
+377 
+_G_va_li¡
+__¬g
+__THROW
+;
+
+378 
+__END_NAMESPACE_STD
+
+
+380 #ià
+def\9aed
+__USE_BSD
+ || def\9aed 
+__USE_ISOC99
+ || def\9aed 
+__USE_UNIX98
+
+
+381 
+__BEGIN_NAMESPACE_C99
+
+
+383 \r\12
+       $¢´\9atf
+ (\ 5*
+__»¡riù
+__s
+, 
+size_t
+__maxËn
+,
+
+384 
+__cڡ
\ 5*
+__»¡riù
+__fÜm©
+, ...)
+
+385 
+__THROW
+       `__©\8cibu\8b__
+ ((
+       `__fÜm©__
+ (
+__´\9atf__
+, 3, 4)));
+
+387 \r\12
+       $v¢´\9atf
+ (\ 5*
+__»¡riù
+__s
+, 
+size_t
+__maxËn
+,
+
+388 
+__cڡ
\ 5*
+__»¡riù
+__fÜm©
+, 
+_G_va_li¡
+__¬g
+)
+
+389 
+__THROW
+       `__©\8cibu\8b__
+ ((
+       `__fÜm©__
+ (
+__´\9atf__
+, 3, 0)));
+
+390 
+__END_NAMESPACE_C99
+
+
+393 #ifdeà
+__USE_GNU
+
+
+396 \r\12
+       $va¥r\9atf
+ (\ 5**
+__»¡riù
+__±r
+, 
+__cڡ
\ 5*__»¡riù 
+__f
+,
+
+397 
+_G_va_li¡
+__¬g
+)
+
+398 
+__THROW
+       `__©\8cibu\8b__
+ ((
+       $__fÜm©__
+ (
+__´\9atf__
+, 2, 0))è
+__wur
+;
+
+399 \r\12
+       $__a¥r\9atf
+ (\ 5**
+__»¡riù
+__±r
+,
+
+400 
+__cڡ
\ 5*
+__»¡riù
+__fmt
+, ...)
+
+401 
+__THROW
+       `__©\8cibu\8b__
+ ((
+       $__fÜm©__
+ (
+__´\9atf__
+, 2, 3))è
+__wur
+;
+
+402 \r\12
+       $a¥r\9atf
+ (\ 5**
+__»¡riù
+__±r
+,
+
+403 
+__cڡ
\ 5*
+__»¡riù
+__fmt
+, ...)
+
+404 
+__THROW
+       `__©\8cibu\8b__
+ ((
+       $__fÜm©__
+ (
+__´\9atf__
+, 2, 3))è
+__wur
+;
+
+407 #ifdeà
+__USE_XOPEN2K8
+
+
+414 \r\12
+       $vd´\9atf
+ (\12
+__fd
+, 
+__cڡ
\ 5*
+__»¡riù
+__fmt
+,
+
+415 
+_G_va_li¡
+__¬g
+)
+
+416 
+       `__©\8cibu\8b__
+ ((
+       `__fÜm©__
+ (
+__´\9atf__
+, 2, 0)));
+
+417 \r\12
+       $d´\9atf
+ (\12
+__fd
+, 
+__cڡ
\ 5*
+__»¡riù
+__fmt
+, ...)
+
+418 
+       `__©\8cibu\8b__
+ ((
+       `__fÜm©__
+ (
+__´\9atf__
+, 2, 3)));
+
+422 
+__BEGIN_NAMESPACE_STD
+
+
+427 \r\12
+       $fsÿnf
+ (
+FILE
+ *
+__»¡riù
+__¡»am
+,
+
+428 
+__cڡ
\ 5*
+__»¡riù
+__fÜm©
+, ...è
+__wur
+;
+
+433 \r\12
+       $sÿnf
+ (
+__cڡ
\ 5*
+__»¡riù
+__fÜm©
+, ...è
+__wur
+;
+
+435 \r\12
+       $ssÿnf
+ (
+__cڡ
\ 5*
+__»¡riù
+__s
+,
+
+436 
+__cڡ
\ 5*
+__»¡riù
+__fÜm©
+, ...è
+__THROW
+;
+
+438 #ià
+def\9aed
+__USE_ISOC99
+ && !def\9aed 
+__USE_GNU
+ \
+
+439 && (!
+def\9aed
+__LDBL_COMPAT
+ || !def\9aed 
+__REDIRECT
+) \
+
+440 && (
+def\9aed
+__STRICT_ANSI__
+ || def\9aed 
+__USE_XOPEN2K
+)
+
+441 #ifdeà
+__REDIRECT
+
+
+445 \r\12
+       `__REDIRECT
+ (
+fsÿnf
+, (
+FILE
+ *
+__»¡riù
+__¡»am
+,
+
+446 
+__cڡ
\ 5*
+__»¡riù
+__fÜm©
+, ...),
+
+447 
+__isoc99_fsÿnf
+__wur
+;
+
+448 \r\12
+       `__REDIRECT
+ (
+sÿnf
+, (
+__cڡ
\ 5*
+__»¡riù
+__fÜm©
+, ...),
+
+449 
+__isoc99_sÿnf
+__wur
+;
+
+450 \r\12
+       `__REDIRECT_NTH
+ (
+ssÿnf
+, (
+__cڡ
\ 5*
+__»¡riù
+__s
+,
+
+451 
+__cڡ
\ 5*
+__»¡riù
+__fÜm©
+, ...),
+
+452 
+__isoc99_ssÿnf
+);
+
+454 \r\12
+       $__isoc99_fsÿnf
+ (
+FILE
+ *
+__»¡riù
+__¡»am
+,
+
+455 
+__cڡ
\ 5*
+__»¡riù
+__fÜm©
+, ...è
+__wur
+;
+
+456 \r\12
+       $__isoc99_sÿnf
+ (
+__cڡ
\ 5*
+__»¡riù
+__fÜm©
+, ...è
+__wur
+;
+
+457 \r\12
+       $__isoc99_ssÿnf
+ (
+__cڡ
\ 5*
+__»¡riù
+__s
+,
+
+458 
+__cڡ
\ 5*
+__»¡riù
+__fÜm©
+, ...è
+__THROW
+;
+
+459 \ 1
+       #fsÿnf
+__isoc99_fsÿnf
+
+
+       )
+
+460 \ 1
+       #sÿnf
+__isoc99_sÿnf
+
+
+       )
+
+461 \ 1
+       #ssÿnf
+__isoc99_ssÿnf
+
+
+       )
+
+465 
+__END_NAMESPACE_STD
+
+
+467 #ifdef 
+__USE_ISOC99
+
+
+468 
+__BEGIN_NAMESPACE_C99
+
+
+473 \r\12
+       $vfsÿnf
+ (
+FILE
+ *
+__»¡riù
+__s
+, 
+__cڡ
\ 5*__»¡riù 
+__fÜm©
+,
+
+474 
+_G_va_li¡
+__¬g
+)
+
+475 
+       `__©\8cibu\8b__
+ ((
+       $__fÜm©__
+ (
+__sÿnf__
+, 2, 0))è
+__wur
+;
+
+481 \r\12
+       $vsÿnf
+ (
+__cڡ
\ 5*
+__»¡riù
+__fÜm©
+, 
+_G_va_li¡
+__¬g
+)
+
+482 
+       `__©\8cibu\8b__
+ ((
+       $__fÜm©__
+ (
+__sÿnf__
+, 1, 0))è
+__wur
+;
+
+485 \r\12
+       $vssÿnf
+ (
+__cڡ
\ 5*
+__»¡riù
+__s
+,
+
+486 
+__cڡ
\ 5*
+__»¡riù
+__fÜm©
+, 
+_G_va_li¡
+__¬g
+)
+
+487 
+__THROW
+       `__©\8cibu\8b__
+ ((
+       `__fÜm©__
+ (
+__sÿnf__
+, 2, 0)));
+
+489 #ià!
+def\9aed
+__USE_GNU
+ \
+
+490 && (!
+def\9aed
+__LDBL_COMPAT
+ || !def\9aed 
+__REDIRECT
+) \
+
+491 && (
+def\9aed
+__STRICT_ANSI__
+ || def\9aed 
+__USE_XOPEN2K
+)
+
+492 #ifdeà
+__REDIRECT
+
+
+496 \r\12
+       `__REDIRECT
+ (
+vfsÿnf
+,
+
+497 (
+FILE
+ *
+__»¡riù
+__s
+,
+
+498 
+__cڡ
\ 5*
+__»¡riù
+__fÜm©
+, 
+_G_va_li¡
+__¬g
+),
+
+499 
+__isoc99_vfsÿnf
+)
+
+500 
+       `__©\8cibu\8b__
+ ((
+       $__fÜm©__
+ (
+__sÿnf__
+, 2, 0))è
+__wur
+;
+
+501 \r\12
+       `__REDIRECT
+ (
+vsÿnf
+, (
+__cڡ
\ 5*
+__»¡riù
+__fÜm©
+,
+
+502 
+_G_va_li¡
+__¬g
+), 
+__isoc99_vsÿnf
+)
+
+503 
+       `__©\8cibu\8b__
+ ((
+       $__fÜm©__
+ (
+__sÿnf__
+, 1, 0))è
+__wur
+;
+
+504 \r\12
+       `__REDIRECT_NTH
+ (
+vssÿnf
+,
+
+505 (
+__cڡ
\ 5*
+__»¡riù
+__s
+,
+
+506 
+__cڡ
\ 5*
+__»¡riù
+__fÜm©
+,
+
+507 
+_G_va_li¡
+__¬g
+), 
+__isoc99_vssÿnf
+)
+
+508 
+       `__©\8cibu\8b__
+ ((
+       `__fÜm©__
+ (
+__sÿnf__
+, 2, 0)));
+
+510 \r\12
+       $__isoc99_vfsÿnf
+ (
+FILE
+ *
+__»¡riù
+__s
+,
+
+511 
+__cڡ
\ 5*
+__»¡riù
+__fÜm©
+,
+
+512 
+_G_va_li¡
+__¬g
+__wur
+;
+
+513 \r\12
+       $__isoc99_vsÿnf
+ (
+__cڡ
\ 5*
+__»¡riù
+__fÜm©
+,
+
+514 
+_G_va_li¡
+__¬g
+__wur
+;
+
+515 \r\12
+       $__isoc99_vssÿnf
+ (
+__cڡ
\ 5*
+__»¡riù
+__s
+,
+
+516 
+__cڡ
\ 5*
+__»¡riù
+__fÜm©
+,
+
+517 
+_G_va_li¡
+__¬g
+__THROW
+;
+
+518 \ 1
+       #vfsÿnf
+__isoc99_vfsÿnf
+
+
+       )
+
+519 \ 1
+       #vsÿnf
+__isoc99_vsÿnf
+
+
+       )
+
+520 \ 1
+       #vssÿnf
+__isoc99_vssÿnf
+
+
+       )
+
+524 
+__END_NAMESPACE_C99
+
+
+528 
+__BEGIN_NAMESPACE_STD
+
+
+533 \r\12
+       `fg\91c
+ (
+FILE
+ *
+__¡»am
+);
+
+534 \r\12
+       `g\91c
+ (
+FILE
+ *
+__¡»am
+);
+
+540 \r\12
+       `g\91ch¬
+ (\1e);
+
+541 
+__END_NAMESPACE_STD
+
+
+545 \ 1
+       #g\91c
+(
+_å
+       `_IO_g\91c
+ (_å)
+
+       )
+
+547 #ià
+def\9aed
+__USE_POSIX
+ || def\9aed 
+__USE_MISC
+
+
+552 \r\12
+       `g\91c_uÆocked
+ (
+FILE
+ *
+__¡»am
+);
+
+553 \r\12
+       `g\91ch¬_uÆocked
+ (\1e);
+
+556 #ifdeà
+__USE_MISC
+
+
+563 \r\12
+       `fg\91c_uÆocked
+ (
+FILE
+ *
+__¡»am
+);
+
+567 
+__BEGIN_NAMESPACE_STD
+
+
+575 \r\12
+       `åutc
+ (\12
+__c
+, 
+FILE
+ *
+__¡»am
+);
+
+576 \r\12
+       `putc
+ (\12
+__c
+, 
+FILE
+ *
+__¡»am
+);
+
+582 \r\12
+       `putch¬
+ (\12
+__c
+);
+
+583 
+__END_NAMESPACE_STD
+
+
+587 \ 1
+       #putc
+(
+_ch
+, 
+_å
+       `_IO_putc
+ (_ch, _å)
+
+       )
+
+589 #ifdeà
+__USE_MISC
+
+
+596 \r\12
+       `åutc_uÆocked
+ (\12
+__c
+, 
+FILE
+ *
+__¡»am
+);
+
+599 #ià
+def\9aed
+__USE_POSIX
+ || def\9aed 
+__USE_MISC
+
+
+604 \r\12
+       `putc_uÆocked
+ (\12
+__c
+, 
+FILE
+ *
+__¡»am
+);
+
+605 \r\12
+       `putch¬_uÆocked
+ (\12
+__c
+);
+
+609 #ià
+def\9aed
+__USE_SVID
+ || def\9aed 
+__USE_MISC
+ \
+
+610 || (
+def\9aed
+__USE_XOPEN
+ && !def\9aed 
+__USE_XOPEN2K
+)
+
+612 \r\12
+       `g\91w
+ (
+FILE
+ *
+__¡»am
+);
+
+615 \r\12
+       `putw
+ (\12
+__w
+, 
+FILE
+ *
+__¡»am
+);
+
+619 
+__BEGIN_NAMESPACE_STD
+
+
+624 \r\ 5*
+       $fg\91s
+ (\ 5*
+__»¡riù
+__s
+, \12
+__n
+, 
+FILE
+ *__»¡riù 
+__¡»am
+)
+
+625 
+__wur
+;
+
+632 \r\ 5*
+       $g\91s
+ (\ 5*
+__s
+__wur
+;
+
+633 
+__END_NAMESPACE_STD
+
+
+635 #ifdeà
+__USE_GNU
+
+
+642 \r\ 5*
+       $fg\91s_uÆocked
+ (\ 5*
+__»¡riù
+__s
+, \12
+__n
+,
+
+643 
+FILE
+ *
+__»¡riù
+__¡»am
+__wur
+;
+
+647 #ifdef 
+__USE_XOPEN2K8
+
+
+658 \r
+_IO_ssize_t
+       $__g\91d\96im
+ (\ 5**
+__»¡riù
+__l\9a\95\8c
+,
+
+659 
+size_t
+ *
+__»¡riù
+__n
+, \12
+__d\96im\99\94
+,
+
+660 
+FILE
+ *
+__»¡riù
+__¡»am
+__wur
+;
+
+661 \r
+_IO_ssize_t
+       $g\91d\96im
+ (\ 5**
+__»¡riù
+__l\9a\95\8c
+,
+
+662 
+size_t
+ *
+__»¡riù
+__n
+, \12
+__d\96im\99\94
+,
+
+663 
+FILE
+ *
+__»¡riù
+__¡»am
+__wur
+;
+
+671 \r
+_IO_ssize_t
+       $g\91l\9ae
+ (\ 5**
+__»¡riù
+__l\9a\95\8c
+,
+
+672 
+size_t
+ *
+__»¡riù
+__n
+,
+
+673 
+FILE
+ *
+__»¡riù
+__¡»am
+__wur
+;
+
+677 
+__BEGIN_NAMESPACE_STD
+
+
+682 \r\12
+       `åuts
+ (
+__cڡ
\ 5*
+__»¡riù
+__s
+, 
+FILE
+ *__»¡riù 
+__¡»am
+);
+
+688 \r\12
+       `puts
+ (
+__cڡ
\ 5*
+__s
+);
+
+695 \r\12
+       `ung\91c
+ (\12
+__c
+, 
+FILE
+ *
+__¡»am
+);
+
+702 \r
+size_t
+       $ä\97d
+ (\1e*
+__»¡riù
+__±r
+, 
+size_t
+__size
+,
+
+703 
+size_t
+__n
+, 
+FILE
+ *
+__»¡riù
+__¡»am
+__wur
+;
+
+708 \r
+size_t
+       `fwr\99e
+ (
+__cڡ
\1e*
+__»¡riù
+__±r
+, size_\88
+__size
+,
+
+709 
+size_t
+__n
+, 
+FILE
+ *
+__»¡riù
+__s
+);
+
+710 
+__END_NAMESPACE_STD
+
+
+712 #ifdeà
+__USE_GNU
+
+
+719 \r\12
+       `åuts_uÆocked
+ (
+__cڡ
\ 5*
+__»¡riù
+__s
+,
+
+720 
+FILE
+ *
+__»¡riù
+__¡»am
+);
+
+723 #ifdeà
+__USE_MISC
+
+
+730 \r
+size_t
+       $ä\97d_uÆocked
+ (\1e*
+__»¡riù
+__±r
+, 
+size_t
+__size
+,
+
+731 
+size_t
+__n
+, 
+FILE
+ *
+__»¡riù
+__¡»am
+__wur
+;
+
+732 \r
+size_t
+       `fwr\99e_uÆocked
+ (
+__cڡ
\1e*
+__»¡riù
+__±r
+, size_\88
+__size
+,
+
+733 
+size_t
+__n
+, 
+FILE
+ *
+__»¡riù
+__¡»am
+);
+
+737 
+__BEGIN_NAMESPACE_STD
+
+
+742 \r\12
+       `f£ek
+ (
+FILE
+ *
+__¡»am
+, \13\12
+__off
+, \12
+__wh\92û
+);
+
+747 \r\13\12
+       $á\96l
+ (
+FILE
+ *
+__¡»am
+__wur
+;
+
+752 \r\1e
+       `»w\9ad
+ (
+FILE
+ *
+__¡»am
+);
+
+753 
+__END_NAMESPACE_STD
+
+
+760 #ià
+def\9aed
+__USE_LARGEFILE
+ || def\9aed 
+__USE_XOPEN2K
+
+
+761 #iâdeà
+__USE_FILE_OFFSET64
+
+
+766 \r\12
+       `f£eko
+ (
+FILE
+ *
+__¡»am
+, 
+__off_t
+__off
+, \12
+__wh\92û
+);
+
+771 \r
+__off_t
+       $á\96lo
+ (
+FILE
+ *
+__¡»am
+__wur
+;
+
+773 #ifdeà
+__REDIRECT
+
+
+774 \r\12
+       `__REDIRECT
+ (
+f£eko
+,
+
+775 (
+FILE
+ *
+__¡»am
+, 
+__off64_t
+__off
+, \12
+__wh\92û
+),
+
+776 
+f£eko64
+);
+
+777 \r
+__off64_t
+       `__REDIRECT
+ (
\96lo
+, (
+FILE
+ *
+__¡»am
+), 
\96lo64
+);
+
+779 \ 1
+       #f£eko
+f£eko64
+
+
+       )
+
+780 \ 1
+       #á\96lo
\96lo64
+
+
+       )
+
+785 
+__BEGIN_NAMESPACE_STD
+
+
+786 #iâdeà
+__USE_FILE_OFFSET64
+
+
+791 \r\12
+       `fg\91pos
+ (
+FILE
+ *
+__»¡riù
+__¡»am
+, 
+åos_t
+ *__»¡riù 
+__pos
+);
+
+796 \r\12
+       `f£\8dos
+ (
+FILE
+ *
+__¡»am
+, 
+__cڡ
+åos_t
+ *
+__pos
+);
+
+798 #ifdeà
+__REDIRECT
+
+
+799 \r\12
+       `__REDIRECT
+ (
+fg\91pos
+, (
+FILE
+ *
+__»¡riù
+__¡»am
+,
+
+800 
+åos_t
+ *
+__»¡riù
+__pos
+), 
+fg\91pos64
+);
+
+801 \r\12
+       `__REDIRECT
+ (
+f£\8dos
+,
+
+802 (
+FILE
+ *
+__¡»am
+, 
+__cڡ
+åos_t
+ *
+__pos
+), 
+f£\8dos64
+);
+
+804 \ 1
+       #fg\91pos
+fg\91pos64
+
+
+       )
+
+805 \ 1
+       #f£\8dos
+f£\8dos64
+
+
+       )
+
+808 
+__END_NAMESPACE_STD
+
+
+810 #ifdeà
+__USE_LARGEFILE64
+
+
+811 \r\12
+       `f£eko64
+ (
+FILE
+ *
+__¡»am
+, 
+__off64_t
+__off
+, \12
+__wh\92û
+);
+
+812 \r
+__off64_t
+       $á\96lo64
+ (
+FILE
+ *
+__¡»am
+__wur
+;
+
+813 \r\12
+       `fg\91pos64
+ (
+FILE
+ *
+__»¡riù
+__¡»am
+, 
+åos64_t
+ *__»¡riù 
+__pos
+);
+
+814 \r\12
+       `f£\8dos64
+ (
+FILE
+ *
+__¡»am
+, 
+__cڡ
+åos64_t
+ *
+__pos
+);
+
+817 
+__BEGIN_NAMESPACE_STD
+
+
+819 \r\1e
+       $þ\97»¼
+ (
+FILE
+ *
+__¡»am
+__THROW
+;
+
+821 \r\12
+       $ãof
+ (
+FILE
+ *
+__¡»am
+__THROW
+__wur
+;
+
+823 \r\12
+       $ã¼Ü
+ (
+FILE
+ *
+__¡»am
+__THROW
+__wur
+;
+
+824 
+__END_NAMESPACE_STD
+
+
+826 #ifdeà
+__USE_MISC
+
+
+828 \r\1e
+       $þ\97»¼_uÆocked
+ (
+FILE
+ *
+__¡»am
+__THROW
+;
+
+829 \r\12
+       $ãof_uÆocked
+ (
+FILE
+ *
+__¡»am
+__THROW
+__wur
+;
+
+830 \r\12
+       $ã¼Ü_uÆocked
+ (
+FILE
+ *
+__¡»am
+__THROW
+__wur
+;
+
+834 
+__BEGIN_NAMESPACE_STD
+
+
+839 \r\1e
+       `³¼Ü
+ (
+__cڡ
\ 5*
+__s
+);
+
+840 
+__END_NAMESPACE_STD
+
+
+846 \ 2
+       ~<b\99s/sys_\94¾i¡.h
+>
+
+849 #ifdef 
+__USE_POSIX
+
+
+851 \r\12
+       $f\9e\92o
+ (
+FILE
+ *
+__¡»am
+__THROW
+__wur
+;
+
+854 #ifdeà
+__USE_MISC
+
+
+856 \r\12
+       $f\9e\92o_uÆocked
+ (
+FILE
+ *
+__¡»am
+__THROW
+__wur
+;
+
+860 #ià(
+def\9aed
+__USE_POSIX2
+ || def\9aed 
+__USE_SVID
+ || def\9aed 
+__USE_BSD
+ || \
+
+861 
+def\9aed
+__USE_MISC
+)
+
+866 \r
+FILE
+ *
+       $pݒ
+ (
+__cڡ
\ 5*
+__commªd
+, __cڡ \ 5*
+__modes
+__wur
+;
+
+872 \r\12
+       `pþo£
+ (
+FILE
+ *
+__¡»am
+);
+
+876 #ifdef 
+__USE_POSIX
+
+
+878 \r\ 5*
+       $ù\94mid
+ (\ 5*
+__s
+__THROW
+;
+
+882 #ifdeà
+__USE_XOPEN
+
+
+884 \r\ 5*
+       `cu£rid
+ (\ 5*
+__s
+);
+
+888 #ifdef 
+__USE_GNU
+
+
+889 \19
+ob¡ack
+;
+
+892 \r\12
+       $ob¡ack_´\9atf
+ (\19
+ob¡ack
+ *
+__»¡riù
+__ob¡ack
+,
+
+893 
+__cڡ
\ 5*
+__»¡riù
+__fÜm©
+, ...)
+
+894 
+__THROW
+       `__©\8cibu\8b__
+ ((
+       `__fÜm©__
+ (
+__´\9atf__
+, 2, 3)));
+
+895 \r\12
+       $ob¡ack_v´\9atf
+ (\19
+ob¡ack
+ *
+__»¡riù
+__ob¡ack
+,
+
+896 
+__cڡ
\ 5*
+__»¡riù
+__fÜm©
+,
+
+897 
+_G_va_li¡
+__¬gs
+)
+
+898 
+__THROW
+       `__©\8cibu\8b__
+ ((
+       `__fÜm©__
+ (
+__´\9atf__
+, 2, 0)));
+
+902 #ià
+def\9aed
+__USE_POSIX
+ || def\9aed 
+__USE_MISC
+
+
+906 \r\1e
+       $æockf\9ee
+ (
+FILE
+ *
+__¡»am
+__THROW
+;
+
+910 \r\12
+       $árylockf\9ee
+ (
+FILE
+ *
+__¡»am
+__THROW
+__wur
+;
+
+913 \r\1e
+       $fuÆockf\9ee
+ (
+FILE
+ *
+__¡»am
+__THROW
+;
+
+916 #ià
+def\9aed
+__USE_XOPEN
+ && !def\9aed 
+__USE_XOPEN2K
+ && !def\9aed 
+__USE_GNU
+
+
+920 \ 1
+       #__Ãed_g\91Ýt
+
+
+       )
+
+921 \ 2
+       ~<g\91Ýt.h
+>
+
+926 #ifdeà
+__USE_EXTERN_INLINES
+
+
+927 \ 2
+       ~<b\99s/¡dio.h
+>
+
+929 #ià
+__USE_FORTIFY_LEVEL
+ > 0 && 
+def\9aed
+__ex\8bº_®ways_\9al\9ae
+
+
+930 \ 2
+       ~<b\99s/¡dio2.h
+>
+
+932 #ifdeà
+__LDBL_COMPAT
+
+
+933 \ 2
+       ~<b\99s/¡dio-ldbl.h
+>
+
+936 
+__END_DECLS
+
+
+       @/usr/include/stdlib.h
+
+23 #iâdef 
+_STDLIB_H
+
+
+25 \ 2
+       ~<ã©u»s.h
+>
+
+28 \ 1
+       #__Ãed_size_t
+
+
+       )
+
+29 #iâdeà
+__Ãed_m®loc_ªd_ÿÎoc
+
+
+30 \ 1
+       #__Ãed_wch¬_t
+
+
+       )
+
+31 \ 1
+       #__Ãed_NULL
+
+
+       )
+
+33 \ 2
+       ~<¡ddef.h
+>
+
+35 
+       g__BEGIN_DECLS
+
+
+37 #iâdeà
+__Ãed_m®loc_ªd_ÿÎoc
+
+
+38 \ 1
+       #_STDLIB_H
+ 1
+
+       )
+
+40 #ià(
+def\9aed
+__USE_XOPEN
+ || def\9aed 
+__USE_XOPEN2K8
+è&& !def\9aed 
+_SYS_WAIT_H
+
+
+42 \ 2
+       ~<b\99s/wa\99æags.h
+>
+
+43 \ 2
+       ~<b\99s/wa\99¡©us.h
+>
+
+45 #ifdeà
+__USE_BSD
+
+
+50 #ià
+def\9aed
+__GNUC__
+ && !def\9aed 
+__ýlu¥lus
+
+
+51 \ 1
+       #__WAIT_INT
+(
+¡©us
+) \
+
+52 (
+       `__ex\8bnsiÚ__
+ (((uniÚ { 
+       `__ty³of
+(
+¡©us
+__\9a
+; \12
+__i
+; }) \
+
+53 { .
+__\9a
+ = (
+¡©us
+è}).
+__i
+))
+
+       )
+
+55 \ 1
+       #__WAIT_INT
+(
+¡©us
+è(*(\12*è&(¡©us))
+
+       )
+
+63 #ià!
+def\9aed
+__GNUC__
+ || __GNUC__ < 2 || def\9aed 
+__ýlu¥lus
+
+
+64 \ 1
+       #__WAIT_STATUS
\1e*
+
+       )
+
+65 \ 1
+       #__WAIT_STATUS_DEFN
\1e*
+
+       )
+
+70 \1c
+wa\99
+ *
+       m__u±r
+;
+
+71 \12*
+       m__\9d\8c
+;
+
+72 } 
+       t__WAIT_STATUS
+       t__©\8cibu\8b__
+ ((
+       t__\8cª¥¬\92t_uniÚ__
+));
+
+73 \ 1
+       #__WAIT_STATUS_DEFN
\12*
+
+       )
+
+78 \ 1
+       #__WAIT_INT
+(
+¡©us
+è(¡©us)
+
+       )
+
+79 \ 1
+       #__WAIT_STATUS
\12*
+
+       )
+
+80 \ 1
+       #__WAIT_STATUS_DEFN
\12*
+
+       )
+
+85 \ 1
+       #WEXITSTATUS
+(
+¡©us
+       `__WEXITSTATUS
+ (
+       `__WAIT_INT
+ (¡©us))
+
+       )
+
+86 \ 1
+       #WTERMSIG
+(
+¡©us
+       `__WTERMSIG
+ (
+       `__WAIT_INT
+ (¡©us))
+
+       )
+
+87 \ 1
+       #WSTOPSIG
+(
+¡©us
+       `__WSTOPSIG
+ (
+       `__WAIT_INT
+ (¡©us))
+
+       )
+
+88 \ 1
+       #WIFEXITED
+(
+¡©us
+       `__WIFEXITED
+ (
+       `__WAIT_INT
+ (¡©us))
+
+       )
+
+89 \ 1
+       #WIFSIGNALED
+(
+¡©us
+       `__WIFSIGNALED
+ (
+       `__WAIT_INT
+ (¡©us))
+
+       )
+
+90 \ 1
+       #WIFSTOPPED
+(
+¡©us
+       `__WIFSTOPPED
+ (
+       `__WAIT_INT
+ (¡©us))
+
+       )
+
+91 #ifdeà
+__WIFCONTINUED
+
+
+92 \ 1
+       #WIFCONTINUED
+(
+¡©us
+       `__WIFCONTINUED
+ (
+       `__WAIT_INT
+ (¡©us))
+
+       )
+
+96 
+__BEGIN_NAMESPACE_STD
+
+
+100 \12
+       mquÙ
+;
+
+101 \12
+       m»m
+;
+
+102 } 
+       tdiv_t
+;
+
+105 #iâdeà
+__ldiv_t_def\9aed
+
+
+108 \13\12
+       mquÙ
+;
+
+109 \13\12
+       m»m
+;
+
+110 } 
+       tldiv_t
+;
+
+111 \ 1
+       #__ldiv_t_def\9aed
+ 1
+
+       )
+
+113 
+       g__END_NAMESPACE_STD
+
+
+115 #ià
+def\9aed
+__USE_ISOC99
+ && !def\9aed 
+__Îdiv_t_def\9aed
+
+
+116 
+__BEGIN_NAMESPACE_C99
+
+
+118 
+__ex\8bnsiÚ__
\estruct
+
+120 \13\13\12
+       mquÙ
+;
+
+121 \13\13\12
+       m»m
+;
+
+122 } 
+       tÎdiv_t
+;
+
+123 \ 1
+       #__Îdiv_t_def\9aed
+ 1
+
+       )
+
+124 
+       g__END_NAMESPACE_C99
+
+
+129 \ 1
+       #RAND_MAX
+ 2147483647
+
+       )
+
+134 \ 1
+       #EXIT_FAILURE
+ 1
+
+       )
+
+135 \ 1
+       #EXIT_SUCCESS
+ 0
+
+       )
+
+139 \ 1
+       #MB_CUR_MAX
+ (
+       `__ùy³_g\91_mb_cur_max
+ ())
+
+       )
+
+140 \r
+size_t
+       $__ùy³_g\91_mb_cur_max
+ (\1eè
+__THROW
+__wur
+;
+
+143 
+__BEGIN_NAMESPACE_STD
+
+
+145 \r\b
+       $©of
+ (
+__cڡ
\ 5*
+__Ō
+)
+
+146 
+__THROW
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+148 \r\12
+       $©oi
+ (
+__cڡ
\ 5*
+__Ō
+)
+
+149 
+__THROW
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+151 \r\13\12
+       $©Þ
+ (
+__cڡ
\ 5*
+__Ō
+)
+
+152 
+__THROW
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+153 
+__END_NAMESPACE_STD
+
+
+155 #ià
+def\9aed
+__USE_ISOC99
+ || (def\9aed 
+__GLIBC_HAVE_LONG_LONG
+ && def\9aed 
+__USE_MISC
+)
+
+156 
+__BEGIN_NAMESPACE_C99
+
+
+158 
+__ex\8bnsiÚ__
\r\13\13\12
+       $©Þl
+ (
+__cڡ
\ 5*
+__Ō
+)
+
+159 
+__THROW
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+160 
+__END_NAMESPACE_C99
+
+
+163 
+__BEGIN_NAMESPACE_STD
+
+
+165 \r\b
+       $¡¹od
+ (
+__cڡ
\ 5*
+__»¡riù
+__Ō
+,
+
+166 \ 5**
+__»¡riù
+__\92d±r
+)
+
+167 
+__THROW
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+168 
+__END_NAMESPACE_STD
+
+
+170 #ifdef 
+__USE_ISOC99
+
+
+171 
+__BEGIN_NAMESPACE_C99
+
+
+173 \r\ e
+       $¡¹of
+ (
+__cڡ
\ 5*
+__»¡riù
+__Ō
+,
+
+174 \ 5**
+__»¡riù
+__\92d±r
+__THROW
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+176 \r\13\b
+       $¡¹Þd
+ (
+__cڡ
\ 5*
+__»¡riù
+__Ō
+,
+
+177 \ 5**
+__»¡riù
+__\92d±r
+)
+
+178 
+__THROW
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+179 
+__END_NAMESPACE_C99
+
+
+182 
+__BEGIN_NAMESPACE_STD
+
+
+184 \r\13\12
+       $¡¹Þ
+ (
+__cڡ
\ 5*
+__»¡riù
+__Ō
+,
+
+185 \ 5**
+__»¡riù
+__\92d±r
+, \12
+__ba£
+)
+
+186 
+__THROW
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+188 \r\1d\13\12
+       $¡¹oul
+ (
+__cڡ
\ 5*
+__»¡riù
+__Ō
+,
+
+189 \ 5**
+__»¡riù
+__\92d±r
+, \12
+__ba£
+)
+
+190 
+__THROW
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+191 
+__END_NAMESPACE_STD
+
+
+193 #ià
+def\9aed
+__GLIBC_HAVE_LONG_LONG
+ && def\9aed 
+__USE_BSD
+
+
+195 
+__ex\8bnsiÚ__
+
+
+196 \r\13\13\12
+       $¡¹oq
+ (
+__cڡ
\ 5*
+__»¡riù
+__Ō
+,
+
+197 \ 5**
+__»¡riù
+__\92d±r
+, \12
+__ba£
+)
+
+198 
+__THROW
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+200 
+__ex\8bnsiÚ__
+
+
+201 \r\1d\13\13\12
+       $¡¹ouq
+ (
+__cڡ
\ 5*
+__»¡riù
+__Ō
+,
+
+202 \ 5**
+__»¡riù
+__\92d±r
+, \12
+__ba£
+)
+
+203 
+__THROW
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+206 #ià
+def\9aed
+__USE_ISOC99
+ || (def\9aed 
+__GLIBC_HAVE_LONG_LONG
+ && def\9aed 
+__USE_MISC
+)
+
+207 
+__BEGIN_NAMESPACE_C99
+
+
+209 
+__ex\8bnsiÚ__
+
+
+210 \r\13\13\12
+       $¡¹Þl
+ (
+__cڡ
\ 5*
+__»¡riù
+__Ō
+,
+
+211 \ 5**
+__»¡riù
+__\92d±r
+, \12
+__ba£
+)
+
+212 
+__THROW
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+214 
+__ex\8bnsiÚ__
+
+
+215 \r\1d\13\13\12
+       $¡¹ouÎ
+ (
+__cڡ
\ 5*
+__»¡riù
+__Ō
+,
+
+216 \ 5**
+__»¡riù
+__\92d±r
+, \12
+__ba£
+)
+
+217 
+__THROW
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+218 
+__END_NAMESPACE_C99
+
+
+222 #ifdeà
+__USE_GNU
+
+
+236 \ 2
+       ~<xloÿË.h
+>
+
+240 \r\13\12
+       $¡¹Þ_l
+ (
+__cڡ
\ 5*
+__»¡riù
+__Ō
+,
+
+241 \ 5**
+__»¡riù
+__\92d±r
+, \12
+__ba£
+,
+
+242 
+__loÿË_t
+__loc
+__THROW
+       `__nÚnuÎ
+ ((1, 4)è
+__wur
+;
+
+244 \r\1d\13\12
+       $¡¹oul_l
+ (
+__cڡ
\ 5*
+__»¡riù
+__Ō
+,
+
+245 \ 5**
+__»¡riù
+__\92d±r
+,
+
+246 \12
+__ba£
+, 
+__loÿË_t
+__loc
+)
+
+247 
+__THROW
+       `__nÚnuÎ
+ ((1, 4)è
+__wur
+;
+
+249 
+__ex\8bnsiÚ__
+
+
+250 \r\13\13\12
+       $¡¹Þl_l
+ (
+__cڡ
\ 5*
+__»¡riù
+__Ō
+,
+
+251 \ 5**
+__»¡riù
+__\92d±r
+, \12
+__ba£
+,
+
+252 
+__loÿË_t
+__loc
+)
+
+253 
+__THROW
+       `__nÚnuÎ
+ ((1, 4)è
+__wur
+;
+
+255 
+__ex\8bnsiÚ__
+
+
+256 \r\1d\13\13\12
+       $¡¹ouÎ_l
+ (
+__cڡ
\ 5*
+__»¡riù
+__Ō
+,
+
+257 \ 5**
+__»¡riù
+__\92d±r
+,
+
+258 \12
+__ba£
+, 
+__loÿË_t
+__loc
+)
+
+259 
+__THROW
+       `__nÚnuÎ
+ ((1, 4)è
+__wur
+;
+
+261 \r\b
+       $¡¹od_l
+ (
+__cڡ
\ 5*
+__»¡riù
+__Ō
+,
+
+262 \ 5**
+__»¡riù
+__\92d±r
+, 
+__loÿË_t
+__loc
+)
+
+263 
+__THROW
+       `__nÚnuÎ
+ ((1, 3)è
+__wur
+;
+
+265 \r\ e
+       $¡¹of_l
+ (
+__cڡ
\ 5*
+__»¡riù
+__Ō
+,
+
+266 \ 5**
+__»¡riù
+__\92d±r
+, 
+__loÿË_t
+__loc
+)
+
+267 
+__THROW
+       `__nÚnuÎ
+ ((1, 3)è
+__wur
+;
+
+269 \r\13\b
+       $¡¹Þd_l
+ (
+__cڡ
\ 5*
+__»¡riù
+__Ō
+,
+
+270 \ 5**
+__»¡riù
+__\92d±r
+,
+
+271 
+__loÿË_t
+__loc
+)
+
+272 
+__THROW
+       `__nÚnuÎ
+ ((1, 3)è
+__wur
+;
+
+276 #ifdeà
+__USE_EXTERN_INLINES
+
+
+277 
+__BEGIN_NAMESPACE_STD
+
+
+278 
+__ex\8bº_\9al\9ae
\b
+
+279 
+       `__NTH
+ (
+       $©of
+ (
+__cڡ
\ 5*
+__Ō
+))
+
+281 \15 
+       `¡¹od
+ (
+__Ō
+, (\ 5**è
+NULL
+);
+
+282 
+       }
+}
+
+283 
+__ex\8bº_\9al\9ae
\12
+
+284 
+__NTH
+ (
+       $©oi
+ (
+__cڡ
\ 5*
+__Ō
+))
+
+286 \15 (\12è
+       `¡¹Þ
+ (
+__Ō
+, (\ 5**è
+NULL
+, 10);
+
+287 
+       }
+}
+
+288 
+__ex\8bº_\9al\9ae
\13\12
+
+289 
+__NTH
+ (
+       $©Þ
+ (
+__cڡ
\ 5*
+__Ō
+))
+
+291 \15 
+       `¡¹Þ
+ (
+__Ō
+, (\ 5**è
+NULL
+, 10);
+
+292 
+       }
+}
+
+293 
+       g__END_NAMESPACE_STD
+
+
+295 #ià
+def\9aed
+__USE_MISC
+ || def\9aed 
+__USE_ISOC99
+
+
+296 
+__BEGIN_NAMESPACE_C99
+
+
+297 
+__ex\8bnsiÚ__
+__ex\8bº_\9al\9ae
\13\13\12
+
+298 
+__NTH
+ (
+       $©Þl
+ (
+__cڡ
\ 5*
+__Ō
+))
+
+300 \15 
+       `¡¹Þl
+ (
+__Ō
+, (\ 5**è
+NULL
+, 10);
+
+301 
+       }
+}
+
+302 
+       g__END_NAMESPACE_C99
+
+
+307 #ià
+def\9aed
+__USE_SVID
+ || def\9aed 
+__USE_XOPEN_EXTENDED
+
+
+311 \r\ 5*
+       $l64a
+ (\13\12
+__n
+__THROW
+__wur
+;
+
+314 \r\13\12
+       $a64l
+ (
+__cڡ
\ 5*
+__s
+)
+
+315 
+__THROW
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+319 #ià
+def\9aed
+__USE_SVID
+ || def\9aed 
+__USE_XOPEN_EXTENDED
+ || def\9aed 
+__USE_BSD
+
+
+320 \ 2
+       ~<sys/ty³s.h
+>
+
+327 \r\13\12
+       $¿ndom
+ (\1eè
+__THROW
+;
+
+330 \r\1e
+       $¤ªdom
+ (\1d\12
+__£ed
+__THROW
+;
+
+336 \r\ 5*
+       $\9a\99¡©e
+ (\1d\12
+__£ed
+, \ 5*
+__¡©ebuf
+,
+
+337 
+size_t
+__¡©\96\92
+__THROW
+       `__nÚnuÎ
+ ((2));
+
+341 \r\ 5*
+       $£t¡©e
+ (\ 5*
+__¡©ebuf
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+344 #ifdeà
+__USE_MISC
+
+
+349 \19
+       s¿ndom_d©a
+
+
+351 
+\9at32_t
+ *
\8c
+;
+
+352 
+\9at32_t
+ *
\8c
+;
+
+353 
+\9at32_t
+ *
+¡©e
+;
+
+354 \12
+¿nd_ty³
+;
+
+355 \12
+¿nd_deg
+;
+
+356 \12
+¿nd_£p
+;
+
+357 
+\9at32_t
+ *
+\92d_±r
+;
+
+360 \r\12
+       $¿ndom_r
+ (\19
+¿ndom_d©a
+ *
+__»¡riù
+__buf
+,
+
+361 
+\9at32_t
+ *
+__»¡riù
+__»suÉ
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+363 \r\12
+       $¤ªdom_r
+ (\1d\12
+__£ed
+, \19
+¿ndom_d©a
+ *
+__buf
+)
+
+364 
+__THROW
+       `__nÚnuÎ
+ ((2));
+
+366 \r\12
+       $\9a\99¡©e_r
+ (\1d\12
+__£ed
+, \ 5*
+__»¡riù
+__¡©ebuf
+,
+
+367 
+size_t
+__¡©\96\92
+,
+
+368 \19
+¿ndom_d©a
+ *
+__»¡riù
+__buf
+)
+
+369 
+__THROW
+       `__nÚnuÎ
+ ((2, 4));
+
+371 \r\12
+       $£t¡©e_r
+ (\ 5*
+__»¡riù
+__¡©ebuf
+,
+
+372 \19
+¿ndom_d©a
+ *
+__»¡riù
+__buf
+)
+
+373 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+378 
+__BEGIN_NAMESPACE_STD
+
+
+380 \r\12
+       $¿nd
+ (\1eè
+__THROW
+;
+
+382 \r\1e
+       $¤ªd
+ (\1d\12
+__£ed
+__THROW
+;
+
+383 
+__END_NAMESPACE_STD
+
+
+385 #ifdeà
+__USE_POSIX
+
+
+387 \r\12
+       $¿nd_r
+ (\1d\12*
+__£ed
+__THROW
+;
+
+391 #ià
+def\9aed
+__USE_SVID
+ || def\9aed 
+__USE_XOPEN
+
+
+395 \r\b
+       $d¿nd48
+ (\1eè
+__THROW
+;
+
+396 \r\b
+       $\94ªd48
+ (\1d\16\12
+__xsubi
+[3]è
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+399 \r\13\12
+       $̪d48
+ (\1eè
+__THROW
+;
+
+400 \r\13\12
+       $Īd48
+ (\1d\16\12
+__xsubi
+[3])
+
+401 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+404 \r\13\12
+       $m¿nd48
+ (\1eè
+__THROW
+;
+
+405 \r\13\12
+       $j¿nd48
+ (\1d\16\12
+__xsubi
+[3])
+
+406 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+409 \r\1e
+       $¤ªd48
+ (\13\12
+__£edv®
+__THROW
+;
+
+410 \r\1d\16\12*
+       $£ed48
+ (\1d\16\12
+__£ed16v
+[3])
+
+411 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+412 \r\1e
+       $lcÚg48
+ (\1d\16\12
+__·¿m
+[7]è
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+414 #ifdeà
+__USE_MISC
+
+
+418 \19
+       sd¿nd48_d©a
+
+
+420 \1d\16\12
+__x
+[3];
+
+421 \1d\16\12
+__Þd_x
+[3];
+
+422 \1d\16\12
+__c
+;
+
+423 \1d\16\12
+__\9a\99
+;
+
+424 \1d\13\13\12
+__a
+;
+
+428 \r\12
+       $d¿nd48_r
+ (\19
+d¿nd48_d©a
+ *
+__»¡riù
+__bufãr
+,
+
+429 \b*
+__»¡riù
+__»suÉ
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+430 \r\12
+       $\94ªd48_r
+ (\1d\16\12
+__xsubi
+[3],
+
+431 \19
+d¿nd48_d©a
+ *
+__»¡riù
+__bufãr
+,
+
+432 \b*
+__»¡riù
+__»suÉ
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+435 \r\12
+       $̪d48_r
+ (\19
+d¿nd48_d©a
+ *
+__»¡riù
+__bufãr
+,
+
+436 \13\12*
+__»¡riù
+__»suÉ
+)
+
+437 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+438 \r\12
+       $Īd48_r
+ (\1d\16\12
+__xsubi
+[3],
+
+439 \19
+d¿nd48_d©a
+ *
+__»¡riù
+__bufãr
+,
+
+440 \13\12*
+__»¡riù
+__»suÉ
+)
+
+441 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+444 \r\12
+       $m¿nd48_r
+ (\19
+d¿nd48_d©a
+ *
+__»¡riù
+__bufãr
+,
+
+445 \13\12*
+__»¡riù
+__»suÉ
+)
+
+446 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+447 \r\12
+       $j¿nd48_r
+ (\1d\16\12
+__xsubi
+[3],
+
+448 \19
+d¿nd48_d©a
+ *
+__»¡riù
+__bufãr
+,
+
+449 \13\12*
+__»¡riù
+__»suÉ
+)
+
+450 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+453 \r\12
+       $¤ªd48_r
+ (\13\12
+__£edv®
+, \19
+d¿nd48_d©a
+ *
+__bufãr
+)
+
+454 
+__THROW
+       `__nÚnuÎ
+ ((2));
+
+456 \r\12
+       $£ed48_r
+ (\1d\16\12
+__£ed16v
+[3],
+
+457 \19
+d¿nd48_d©a
+ *
+__bufãr
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+459 \r\12
+       $lcÚg48_r
+ (\1d\16\12
+__·¿m
+[7],
+
+460 \19
+d¿nd48_d©a
+ *
+__bufãr
+)
+
+461 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+467 #iâdeà
+__m®loc_ªd_ÿÎoc_def\9aed
+
+
+468 \ 1
+       #__m®loc_ªd_ÿÎoc_def\9aed
+
+
+       )
+
+469 
+__BEGIN_NAMESPACE_STD
+
+
+471 \r\1e*
+       $m®loc
+ (
+size_t
+__size
+__THROW
+__©\8cibu\8b_m®loc__
+__wur
+;
+
+473 \r\1e*
+       $ÿÎoc
+ (
+size_t
+__nmemb
+, size_\88
+__size
+)
+
+474 
+__THROW
+__©\8cibu\8b_m®loc__
+__wur
+;
+
+475 
+__END_NAMESPACE_STD
+
+
+478 #iâdeà
+__Ãed_m®loc_ªd_ÿÎoc
+
+
+479 
+__BEGIN_NAMESPACE_STD
+
+
+485 \r\1e*
+       $»®loc
+ (\1e*
+__±r
+, 
+size_t
+__size
+)
+
+486 
+__THROW
+__©\8cibu\8b_w¬n_unu£d_»suÉ__
+;
+
+488 \r\1e
+       $ä\93
+ (\1e*
+__±r
+__THROW
+;
+
+489 
+__END_NAMESPACE_STD
+
+
+491 #ifdef 
+__USE_MISC
+
+
+493 \r\1e
+       $cä\93
+ (\1e*
+__±r
+__THROW
+;
+
+496 #ià
+def\9aed
+__USE_GNU
+ || def\9aed 
+__USE_BSD
+ || def\9aed 
+__USE_MISC
+
+
+497 \ 2
+       ~<®loÿ.h
+>
+
+500 #ià(
+def\9aed
+__USE_XOPEN_EXTENDED
+ && !def\9aed 
+__USE_XOPEN2K
+) \
+
+501 || 
+def\9aed
+__USE_BSD
+
+
+503 \r\1e*
+       $v®loc
+ (
+size_t
+__size
+__THROW
+__©\8cibu\8b_m®loc__
+__wur
+;
+
+506 #ifdeà
+__USE_XOPEN2K
+
+
+508 \r\12
+       $posix_mem®ign
+ (\1e**
+__mem±r
+, 
+size_t
+__®ignm\92t
+, size_\88
+__size
+)
+
+509 
+__THROW
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+512 
+__BEGIN_NAMESPACE_STD
+
+
+514 \r\1e
+       $abÜt
+ (\1eè
+__THROW
+       `__©\8cibu\8b__
+ ((
+__nÜ\91uº__
+));
+
+518 \r\12
+       `©ex\99
+ (\1e(*
+__func
+è(\1e
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+520 #ifdeà
+__USE_GNU
+
+
+524 #ifdeà
+__ýlu¥lus
+
+
+525 \r"C++" \12
+       `©_quick_ex\99
+ (\1e(*
+__func
+) (\1e))
+
+526 
+__THROW
+       `__asm
+ ("©_quick_ex\99
+       `__nÚnuÎ
+ ((1));
+
+528 \r\12
+       `©_quick_ex\99
+ (\1e(*
+__func
+è(\1e
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+531 
+__END_NAMESPACE_STD
+
+
+533 #ifdef 
+__USE_MISC
+
+
+536 \r\12
+       `Ú_ex\99
+ (\1e(*
+__func
+è(\12
+__¡©us
+, \1e*
+__¬g
+), \1e*__arg)
+
+537 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+540 
+__BEGIN_NAMESPACE_STD
+
+
+544 \r\1e
+       $ex\99
+ (\12
+__¡©us
+__THROW
+       `__©\8cibu\8b__
+ ((
+__nÜ\91uº__
+));
+
+546 #ifdeà
+__USE_GNU
+
+
+552 \r\1e
+       $quick_ex\99
+ (\12
+__¡©us
+__THROW
+       `__©\8cibu\8b__
+ ((
+__nÜ\91uº__
+));
+
+554 
+__END_NAMESPACE_STD
+
+
+556 #ifdeà
+__USE_ISOC99
+
+
+557 
+__BEGIN_NAMESPACE_C99
+
+
+560 \r\1e
+       $_Ex\99
+ (\12
+__¡©us
+__THROW
+       `__©\8cibu\8b__
+ ((
+__nÜ\91uº__
+));
+
+561 
+__END_NAMESPACE_C99
+
+
+565 
+__BEGIN_NAMESPACE_STD
+
+
+567 \r\ 5*
+       $g\91\92v
+ (
+__cڡ
\ 5*
+__Çme
+__THROW
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+568 
+__END_NAMESPACE_STD
+
+
+572 \r\ 5*
+       $__£cu»_g\91\92v
+ (
+__cڡ
\ 5*
+__Çme
+)
+
+573 
+__THROW
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+575 #ià
+def\9aed
+__USE_SVID
+ || def\9aed 
+__USE_XOPEN
+
+
+579 \r\12
+       $pu\8bnv
+ (\ 5*
+__¡r\9ag
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+582 #ià
+def\9aed
+__USE_BSD
+ || def\9aed 
+__USE_XOPEN2K
+
+
+585 \r\12
+       $£\8bnv
+ (
+__cڡ
\ 5*
+__Çme
+, __cڡ \ 5*
+__v®ue
+, \12
+__»¶aû
+)
+
+586 
+__THROW
+       `__nÚnuÎ
+ ((2));
+
+589 \r\12
+       $un£\8bnv
+ (
+__cڡ
\ 5*
+__Çme
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+592 #ifdef 
+__USE_MISC
+
+
+596 \r\12
+       $þ\97»nv
+ (\1eè
+__THROW
+;
+
+600 #ià
+def\9aed
+__USE_MISC
+ \
+
+601 || (
+def\9aed
+__USE_XOPEN_EXTENDED
+ && !def\9aed 
+__USE_XOPEN2K
+)
+
+606 \r\ 5*
+       $mk\8bmp
+ (\ 5*
+__\8bm¶©e
+__THROW
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+609 #ià
+def\9aed
+__USE_MISC
+ || def\9aed 
+__USE_XOPEN_EXTENDED
+ \
+
+610 || 
+def\9aed
+__USE_XOPEN2K8
+
+
+619 #iâdeà
+__USE_FILE_OFFSET64
+
+
+620 \r\12
+       $mk¡emp
+ (\ 5*
+__\8bm¶©e
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+622 #ifdeà
+__REDIRECT
+
+
+623 \r\12
+       `__REDIRECT
+ (
+mk¡emp
+, (\ 5*
+__\8bm¶©e
+), 
+mk¡emp64
+)
+
+624 
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+626 \ 1
+       #mk¡emp
+mk¡emp64
+
+
+       )
+
+629 #ifdeà
+__USE_LARGEFILE64
+
+
+630 \r\12
+       $mk¡emp64
+ (\ 5*
+__\8bm¶©e
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+634 #ifdeà
+__USE_MISC
+
+
+641 #iâdeà
+__USE_FILE_OFFSET64
+
+
+642 \r\12
+       $mk¡emps
+ (\ 5*
+__\8bm¶©e
+, \12
+__suffixËn
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+644 #ifdeà
+__REDIRECT
+
+
+645 \r\12
+       `__REDIRECT
+ (
+mk¡emps
+, (\ 5*
+__\8bm¶©e
+, \12
+__suffixËn
+),
+
+646 
+mk¡emps64
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+648 \ 1
+       #mk¡emps
+mk¡emps64
+
+
+       )
+
+651 #ifdeà
+__USE_LARGEFILE64
+
+
+652 \r\12
+       $mk¡emps64
+ (\ 5*
+__\8bm¶©e
+, \12
+__suffixËn
+)
+
+653 
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+657 #ià
+def\9aed
+__USE_BSD
+ || def\9aed 
+__USE_XOPEN2K8
+
+
+663 \r\ 5*
+       $mkd\8bmp
+ (\ 5*
+__\8bm¶©e
+__THROW
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+666 #ifdeà
+__USE_GNU
+
+
+673 #iâdeà
+__USE_FILE_OFFSET64
+
+
+674 \r\12
+       $mko¡emp
+ (\ 5*
+__\8bm¶©e
+, \12
+__æags
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+676 #ifdeà
+__REDIRECT
+
+
+677 \r\12
+       `__REDIRECT
+ (
+mko¡emp
+, (\ 5*
+__\8bm¶©e
+, \12
+__æags
+), 
+mko¡emp64
+)
+
+678 
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+680 \ 1
+       #mko¡emp
+mko¡emp64
+
+
+       )
+
+683 #ifdeà
+__USE_LARGEFILE64
+
+
+684 \r\12
+       $mko¡emp64
+ (\ 5*
+__\8bm¶©e
+, \12
+__æags
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+693 #iâdeà
+__USE_FILE_OFFSET64
+
+
+694 \r\12
+       $mko¡emps
+ (\ 5*
+__\8bm¶©e
+, \12
+__suffixËn
+, \12
+__æags
+)
+
+695 
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+697 #ifdeà
+__REDIRECT
+
+
+698 \r\12
+       `__REDIRECT
+ (
+mko¡emps
+, (\ 5*
+__\8bm¶©e
+, \12
+__suffixËn
+,
+
+699 \12
+__æags
+), 
+mko¡emps64
+)
+
+700 
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+702 \ 1
+       #mko¡emps
+mko¡emps64
+
+
+       )
+
+705 #ifdeà
+__USE_LARGEFILE64
+
+
+706 \r\12
+       $mko¡emps64
+ (\ 5*
+__\8bm¶©e
+, \12
+__suffixËn
+, \12
+__æags
+)
+
+707 
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+712 
+__BEGIN_NAMESPACE_STD
+
+
+717 \r\12
+       $sy¡em
+ (
+__cڡ
\ 5*
+__commªd
+__wur
+;
+
+718 
+__END_NAMESPACE_STD
+
+
+721 #ifdef 
+__USE_GNU
+
+
+724 \r\ 5*
+       $ÿnÚiÿlize_f\9ee_Çme
+ (
+__cڡ
\ 5*
+__Çme
+)
+
+725 
+__THROW
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+728 #ià
+def\9aed
+__USE_BSD
+ || def\9aed 
+__USE_XOPEN_EXTENDED
+
+
+734 \r\ 5*
+       $»®·th
+ (
+__cڡ
\ 5*
+__»¡riù
+__Çme
+,
+
+735 \ 5*
+__»¡riù
+__»sÞved
+__THROW
+__wur
+;
+
+740 #iâdeà
+__COMPAR_FN_T
+
+
+741 \ 1
+       #__COMPAR_FN_T
+
+
+       )
+
+742 \e\12(*
+       t__com·r_â_t
+è(
+       t__cڡ
\1e*, __const \1e*);
+
+744 #ifdef 
+__USE_GNU
+
+
+745 \e
+__com·r_â_t
+       tcom·risÚ_â_t
+;
+
+748 #ifdeà
+__USE_GNU
+
+
+749 \e\12(*
+       t__com·r_d_â_t
+è(
+       t__cڡ
\1e*, __const \1e*, \1e*);
+
+752 
+__BEGIN_NAMESPACE_STD
+
+
+755 \r\1e*
+       $b£¬ch
+ (
+__cڡ
\1e*
+__key
+, __cڡ \1e*
+__ba£
+,
+
+756 
+size_t
+__nmemb
+, size_\88
+__size
+, 
+__com·r_â_t
+__com·r
+)
+
+757 
+       `__nÚnuÎ
+ ((1, 2, 5)è
+__wur
+;
+
+761 \r\1e
+       $qsÜt
+ (\1e*
+__ba£
+, 
+size_t
+__nmemb
+, size_\88
+__size
+,
+
+762 
+__com·r_â_t
+__com·r
+       `__nÚnuÎ
+ ((1, 4));
+
+763 #ifdeà
+__USE_GNU
+
+
+764 \r\1e
+       $qsÜt_r
+ (\1e*
+__ba£
+, 
+size_t
+__nmemb
+, size_\88
+__size
+,
+
+765 
+__com·r_d_â_t
+__com·r
+, \1e*
+__¬g
+)
+
+766 
+       `__nÚnuÎ
+ ((1, 4));
+
+771 \r\12
+       $abs
+ (\12
+__x
+__THROW
+       `__©\8cibu\8b__
+ ((
+__cڡ__
+)è
+__wur
+;
+
+772 \r\13\12
+       $Ïbs
+ (\13\12
+__x
+__THROW
+       `__©\8cibu\8b__
+ ((
+__cڡ__
+)è
+__wur
+;
+
+773 
+__END_NAMESPACE_STD
+
+
+775 #ifdeà
+__USE_ISOC99
+
+
+776 
+__ex\8bnsiÚ__
\r\13\13\12
+       $Îabs
+ (\13\13\12
+__x
+)
+
+777 
+__THROW
+       `__©\8cibu\8b__
+ ((
+__cڡ__
+)è
+__wur
+;
+
+781 
+__BEGIN_NAMESPACE_STD
+
+
+785 \r
+div_t
+       $div
+ (\12
+__num\94
+, \12
+__d\92om
+)
+
+786 
+__THROW
+       `__©\8cibu\8b__
+ ((
+__cڡ__
+)è
+__wur
+;
+
+787 \r
+ldiv_t
+       $ldiv
+ (\13\12
+__num\94
+, \13\12
+__d\92om
+)
+
+788 
+__THROW
+       `__©\8cibu\8b__
+ ((
+__cڡ__
+)è
+__wur
+;
+
+789 
+__END_NAMESPACE_STD
+
+
+791 #ifdeà
+__USE_ISOC99
+
+
+792 
+__BEGIN_NAMESPACE_C99
+
+
+793 
+__ex\8bnsiÚ__
\r
+Îdiv_t
+       $Îdiv
+ (\13\13\12
+__num\94
+,
+
+794 \13\13\12
+__d\92om
+)
+
+795 
+__THROW
+       `__©\8cibu\8b__
+ ((
+__cڡ__
+)è
+__wur
+;
+
+796 
+__END_NAMESPACE_C99
+
+
+800 #ià(
+def\9aed
+__USE_XOPEN_EXTENDED
+ && !def\9aed 
+__USE_XOPEN2K
+) \
+
+801 || 
+def\9aed
+__USE_SVID
+
+
+808 \r\ 5*
+       $ecvt
+ (\b
+__v®ue
+, \12
+__ndig\99
+, \12*
+__»¡riù
+__deýt
+,
+
+809 \12*
+__»¡riù
+__sign
+__THROW
+       `__nÚnuÎ
+ ((3, 4)è
+__wur
+;
+
+814 \r\ 5*
+       $fcvt
+ (\b
+__v®ue
+, \12
+__ndig\99
+, \12*
+__»¡riù
+__deýt
+,
+
+815 \12*
+__»¡riù
+__sign
+__THROW
+       `__nÚnuÎ
+ ((3, 4)è
+__wur
+;
+
+820 \r\ 5*
+       $gcvt
+ (\b
+__v®ue
+, \12
+__ndig\99
+, \ 5*
+__buf
+)
+
+821 
+__THROW
+       `__nÚnuÎ
+ ((3)è
+__wur
+;
+
+824 #ifdeà
+__USE_MISC
+
+
+826 \r\ 5*
+       $qecvt
+ (\13\b
+__v®ue
+, \12
+__ndig\99
+,
+
+827 \12*
+__»¡riù
+__deýt
+, \12*__»¡riù 
+__sign
+)
+
+828 
+__THROW
+       `__nÚnuÎ
+ ((3, 4)è
+__wur
+;
+
+829 \r\ 5*
+       $qfcvt
+ (\13\b
+__v®ue
+, \12
+__ndig\99
+,
+
+830 \12*
+__»¡riù
+__deýt
+, \12*__»¡riù 
+__sign
+)
+
+831 
+__THROW
+       `__nÚnuÎ
+ ((3, 4)è
+__wur
+;
+
+832 \r\ 5*
+       $qgcvt
+ (\13\b
+__v®ue
+, \12
+__ndig\99
+, \ 5*
+__buf
+)
+
+833 
+__THROW
+       `__nÚnuÎ
+ ((3)è
+__wur
+;
+
+838 \r\12
+       $ecvt_r
+ (\b
+__v®ue
+, \12
+__ndig\99
+, \12*
+__»¡riù
+__deýt
+,
+
+839 \12*
+__»¡riù
+__sign
+, \ 5*__»¡riù 
+__buf
+,
+
+840 
+size_t
+__Ën
+__THROW
+       `__nÚnuÎ
+ ((3, 4, 5));
+
+841 \r\12
+       $fcvt_r
+ (\b
+__v®ue
+, \12
+__ndig\99
+, \12*
+__»¡riù
+__deýt
+,
+
+842 \12*
+__»¡riù
+__sign
+, \ 5*__»¡riù 
+__buf
+,
+
+843 
+size_t
+__Ën
+__THROW
+       `__nÚnuÎ
+ ((3, 4, 5));
+
+845 \r\12
+       $qecvt_r
+ (\13\b
+__v®ue
+, \12
+__ndig\99
+,
+
+846 \12*
+__»¡riù
+__deýt
+, \12*__»¡riù 
+__sign
+,
+
+847 \ 5*
+__»¡riù
+__buf
+, 
+size_t
+__Ën
+)
+
+848 
+__THROW
+       `__nÚnuÎ
+ ((3, 4, 5));
+
+849 \r\12
+       $qfcvt_r
+ (\13\b
+__v®ue
+, \12
+__ndig\99
+,
+
+850 \12*
+__»¡riù
+__deýt
+, \12*__»¡riù 
+__sign
+,
+
+851 \ 5*
+__»¡riù
+__buf
+, 
+size_t
+__Ën
+)
+
+852 
+__THROW
+       `__nÚnuÎ
+ ((3, 4, 5));
+
+857 
+__BEGIN_NAMESPACE_STD
+
+
+860 \r\12
+       $mbËn
+ (
+__cڡ
\ 5*
+__s
+, 
+size_t
+__n
+__THROW
+__wur
+;
+
+863 \r\12
+       $mbtowc
+ (
+wch¬_t
+ *
+__»¡riù
+__pwc
+,
+
+864 
+__cڡ
\ 5*
+__»¡riù
+__s
+, 
+size_t
+__n
+__THROW
+__wur
+;
+
+867 \r\12
+       $wùomb
+ (\ 5*
+__s
+, 
+wch¬_t
+__wch¬
+__THROW
+__wur
+;
+
+871 \r
+size_t
+       $mb¡owcs
+ (
+wch¬_t
+ *
+__»¡riù
+__pwcs
+,
+
+872 
+__cڡ
\ 5*
+__»¡riù
+__s
+, 
+size_t
+__n
+__THROW
+;
+
+874 \r
+size_t
+       $wc¡ombs
+ (\ 5*
+__»¡riù
+__s
+,
+
+875 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__pwcs
+, 
+size_t
+__n
+)
+
+876 
+__THROW
+;
+
+877 
+__END_NAMESPACE_STD
+
+
+880 #ifdeà
+__USE_SVID
+
+
+885 \r\12
+       $½m©ch
+ (
+__cڡ
\ 5*
+__»¥Ú£
+__THROW
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+889 #ià
+def\9aed
+__USE_XOPEN_EXTENDED
+ || def\9aed 
+__USE_XOPEN2K8
+
+
+896 \r\12
+       $g\91subÝt
+ (\ 5**
+__»¡riù
+__ÝtiÚp
+,
+
+897 \ 5*
+__cڡ
+ *
+__»¡riù
+__tok\92s
+,
+
+898 \ 5**
+__»¡riù
+__v®u\95
+)
+
+899 
+__THROW
+       `__nÚnuÎ
+ ((1, 2, 3)è
+__wur
+;
+
+903 #ifdeà
+__USE_XOPEN
+
+
+905 \r\1e
+       $£tkey
+ (
+__cڡ
\ 5*
+__key
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+911 #ifdeà
+__USE_XOPEN2KXSI
+
+
+913 \r\12
+       $posix_Ý\92±
+ (\12
+__oæag
+__wur
+;
+
+916 #ifdeà
+__USE_XOPEN
+
+
+921 \r\12
+       $g¿Á±
+ (\12
+__fd
+__THROW
+;
+
+925 \r\12
+       $uÆock±
+ (\12
+__fd
+__THROW
+;
+
+930 \r\ 5*
+       $±¢ame
+ (\12
+__fd
+__THROW
+__wur
+;
+
+933 #ifdeà
+__USE_GNU
+
+
+937 \r\12
+       $±¢ame_r
+ (\12
+__fd
+, \ 5*
+__buf
+, 
+size_t
+__buæ\92
+)
+
+938 
+__THROW
+       `__nÚnuÎ
+ ((2));
+
+941 \r\12
+       `g\91±
+ (\1e);
+
+944 #ifdeà
+__USE_BSD
+
+
+948 \r\12
+       $g\91lßdavg
+ (\b
+__lßdavg
+[], \12
+__ÃËm
+)
+
+949 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+954 #ià
+__USE_FORTIFY_LEVEL
+ > 0 && 
+def\9aed
+__ex\8bº_®ways_\9al\9ae
+
+
+955 \ 2
+       ~<b\99s/¡dlib.h
+>
+
+957 #ifdeà
+__LDBL_COMPAT
+
+
+958 \ 2
+       ~<b\99s/¡dlib-ldbl.h
+>
+
+962 #undeà
+__Ãed_m®loc_ªd_ÿÎoc
+
+
+964 
+__END_DECLS
+
+
+       @/usr/include/string.h
+
+24 #iâdef 
+_STRING_H
+
+
+25 \ 1
+       #_STRING_H
+ 1
+
+       )
+
+27 \ 2
+       ~<ã©u»s.h
+>
+
+29 
+       g__BEGIN_DECLS
+
+
+32 \ 1
+       #__Ãed_size_t
+
+
+       )
+
+33 \ 1
+       #__Ãed_NULL
+
+
+       )
+
+34 \ 2
+       ~<¡ddef.h
+>
+
+37 #ià
+def\9aed
+__ýlu¥lus
+ && 
+__GNUC_PREREQ
+ (4, 4)
+
+38 \ 1
+       #__CORRECT_ISO_CPP_STRING_H_PROTO
+
+
+       )
+
+42 
+__BEGIN_NAMESPACE_STD
+
+
+44 \r\1e*
+       $memýy
+ (\1e*
+__»¡riù
+__de¡
+,
+
+45 
+__cڡ
\1e*
+__»¡riù
+__¤c
+, 
+size_t
+__n
+)
+
+46 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+49 \r\1e*
+       $memmove
+ (\1e*
+__de¡
+, 
+__cڡ
\1e*
+__¤c
+, 
+size_t
+__n
+)
+
+50 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+51 
+__END_NAMESPACE_STD
+
+
+56 #ià
+def\9aed
+__USE_SVID
+ || def\9aed 
+__USE_BSD
+ || def\9aed 
+__USE_XOPEN
+
+
+57 \r\1e*
+       $memcýy
+ (\1e*
+__»¡riù
+__de¡
+, 
+__cڡ
\1e*__»¡riù 
+__¤c
+,
+
+58 \12
+__c
+, 
+size_t
+__n
+)
+
+59 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+63 
+__BEGIN_NAMESPACE_STD
+
+
+65 \r\1e*
+       $mem£t
+ (\1e*
+__s
+, \12
+__c
+, 
+size_t
+__n
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+68 \r\12
+       $memcmp
+ (
+__cڡ
\1e*
+__s1
+, __cڡ \1e*
+__s2
+, 
+size_t
+__n
+)
+
+69 
+__THROW
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1, 2));
+
+72 #ifdeà
+__CORRECT_ISO_CPP_STRING_H_PROTO
+
+
+75 \r\1e*
+       `memchr
+ (\1e*
+__s
+, \12
+__c
+, 
+size_t
+__n
+)
+
+76 
+__THROW
+       `__asm
+ ("memchr"è
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1));
+
+77 \r
+__cڡ
\1e*
+       `memchr
+ (__cڡ \1e*
+__s
+, \12
+__c
+, 
+size_t
+__n
+)
+
+78 
+__THROW
+       `__asm
+ ("memchr"è
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1));
+
+80 #ifdeà
+__OPTIMIZE__
+
+
+81 
+__ex\8bº_®ways_\9al\9ae
\1e*
+
+82 
+       `memchr
+ (\1e*
+__s
+, \12
+__c
+, 
+size_t
+__n
+__THROW
+
+
+84 \15 
+       `__bu\9et\9a_memchr
+ (
+__s
+, 
+__c
+, 
+__n
+);
+
+87 
+__ex\8bº_®ways_\9al\9ae
+__cڡ
\1e*
+
+88 
+       `memchr
+ (
+__cڡ
\1e*
+__s
+, \12
+__c
+, 
+size_t
+__n
+__THROW
+
+
+90 \15 
+       `__bu\9et\9a_memchr
+ (
+__s
+, 
+__c
+, 
+__n
+);
+
+93 
+       }
+}
+
+95 \r\1e*
+       $memchr
+ (
+__cڡ
\1e*
+__s
+, \12
+__c
+, 
+size_t
+__n
+)
+
+96 
+__THROW
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1));
+
+98 
+__END_NAMESPACE_STD
+
+
+100 #ifdeà
+__USE_GNU
+
+
+103 #ifdeà
+__CORRECT_ISO_CPP_STRING_H_PROTO
+
+
+104 \r"C++" \1e*
+       $¿wmemchr
+ (\1e*
+__s
+, \12
+__c
+)
+
+105 
+__THROW
+       `__asm
+ ("¿wmemchr"è
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1));
+
+106 \r"C++" 
+__cڡ
\1e*
+       $¿wmemchr
+ (
+__cڡ
\1e*
+__s
+, \12
+__c
+)
+
+107 
+__THROW
+       `__asm
+ ("¿wmemchr"è
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1));
+
+109 \r\1e*
+       $¿wmemchr
+ (
+__cڡ
\1e*
+__s
+, \12
+__c
+)
+
+110 
+__THROW
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1));
+
+114 #ifdeà
+__CORRECT_ISO_CPP_STRING_H_PROTO
+
+
+115 \r"C++" \1e*
+       $memrchr
+ (\1e*
+__s
+, \12
+__c
+, 
+size_t
+__n
+)
+
+116 
+__THROW
+       `__asm
+ ("memrchr"è
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1));
+
+117 \r"C++" 
+__cڡ
\1e*
+       $memrchr
+ (
+__cڡ
\1e*
+__s
+, \12
+__c
+, 
+size_t
+__n
+)
+
+118 
+__THROW
+       `__asm
+ ("memrchr"è
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1));
+
+120 \r\1e*
+       $memrchr
+ (
+__cڡ
\1e*
+__s
+, \12
+__c
+, 
+size_t
+__n
+)
+
+121 
+__THROW
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1));
+
+126 
+__BEGIN_NAMESPACE_STD
+
+
+128 \r\ 5*
+       $¡rýy
+ (\ 5*
+__»¡riù
+__de¡
+, 
+__cڡ
\ 5*__»¡riù 
+__¤c
+)
+
+129 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+131 \r\ 5*
+       $¡ºýy
+ (\ 5*
+__»¡riù
+__de¡
+,
+
+132 
+__cڡ
\ 5*
+__»¡riù
+__¤c
+, 
+size_t
+__n
+)
+
+133 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+136 \r\ 5*
+       $¡rÿt
+ (\ 5*
+__»¡riù
+__de¡
+, 
+__cڡ
\ 5*__»¡riù 
+__¤c
+)
+
+137 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+139 \r\ 5*
+       $¡ºÿt
+ (\ 5*
+__»¡riù
+__de¡
+, 
+__cڡ
\ 5*__»¡riù 
+__¤c
+,
+
+140 
+size_t
+__n
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+143 \r\12
+       $¡rcmp
+ (
+__cڡ
\ 5*
+__s1
+, __cڡ \ 5*
+__s2
+)
+
+144 
+__THROW
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1, 2));
+
+146 \r\12
+       $¡ºcmp
+ (
+__cڡ
\ 5*
+__s1
+, __cڡ \ 5*
+__s2
+, 
+size_t
+__n
+)
+
+147 
+__THROW
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1, 2));
+
+150 \r\12
+       $¡rcÞl
+ (
+__cڡ
\ 5*
+__s1
+, __cڡ \ 5*
+__s2
+)
+
+151 
+__THROW
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1, 2));
+
+153 \r
+size_t
+       $¡rxäm
+ (\ 5*
+__»¡riù
+__de¡
+,
+
+154 
+__cڡ
\ 5*
+__»¡riù
+__¤c
+, 
+size_t
+__n
+)
+
+155 
+__THROW
+       `__nÚnuÎ
+ ((2));
+
+156 
+__END_NAMESPACE_STD
+
+
+158 #ifdeà
+__USE_XOPEN2K8
+
+
+162 \ 2
+       ~<xloÿË.h
+>
+
+165 \r\12
+       $¡rcÞl_l
+ (
+__cڡ
\ 5*
+__s1
+, __cڡ \ 5*
+__s2
+, 
+__loÿË_t
+__l
+)
+
+166 
+__THROW
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1, 2, 3));
+
+168 \r
+size_t
+       $¡rxäm_l
+ (\ 5*
+__de¡
+, 
+__cڡ
\ 5*
+__¤c
+, 
+size_t
+__n
+,
+
+169 
+__loÿË_t
+__l
+__THROW
+       `__nÚnuÎ
+ ((2, 4));
+
+172 #ià
+def\9aed
+__USE_SVID
+ || def\9aed 
+__USE_BSD
+ || def\9aed 
+__USE_XOPEN_EXTENDED
+ \
+
+173 || 
+def\9aed
+__USE_XOPEN2K8
+
+
+175 \r\ 5*
+       $¡rdup
+ (
+__cڡ
\ 5*
+__s
+)
+
+176 
+__THROW
+__©\8cibu\8b_m®loc__
+       `__nÚnuÎ
+ ((1));
+
+182 #ià
+def\9aed
+__USE_XOPEN2K8
+
+
+183 \r\ 5*
+       $¡ºdup
+ (
+__cڡ
\ 5*
+__¡r\9ag
+, 
+size_t
+__n
+)
+
+184 
+__THROW
+__©\8cibu\8b_m®loc__
+       `__nÚnuÎ
+ ((1));
+
+187 #ià
+def\9aed
+__USE_GNU
+ && def\9aed 
+__GNUC__
+
+
+189 \ 1
+       #¡rdu·
+(
+s
+) \
+
+190 (
+__ex\8bnsiÚ__
+ \
+
+192 
+__cڡ
\ 5*
+__Þd
+ = (
+s
+); \
+
+193 
+size_t
+__Ën
+ = 
+       `¡¾\92
+ (
+__Þd
+) + 1; \
+
+194 \ 5*
+__Ãw
+ = (\ 5
+       `__bu\9et\9a_®loÿ
+ (
+__Ën
+); \
+
+195 (\ 5
+       `memýy
+ (
+__Ãw
+, 
+__Þd
+, 
+__Ën
+); \
+
+196 
+       }
+}))
+
+       )
+
+199 \ 1
+       #¡ºdu·
+(
+s
+, 
+n
+) \
+
+200 (
+__ex\8bnsiÚ__
+ \
+
+202 
+__cڡ
\ 5*
+__Þd
+ = (
+s
+); \
+
+203 
+size_t
+__Ën
+ = 
+       `¡ºËn
+ (
+__Þd
+, (
+n
+)); \
+
+204 \ 5*
+__Ãw
+ = (\ 5
+       `__bu\9et\9a_®loÿ
+ (
+__Ën
+ + 1); \
+
+205 
+__Ãw
+[
+__Ën
+] = '\0'; \
+
+206 (\ 5
+       `memýy
+ (
+__Ãw
+, 
+__Þd
+, 
+__Ën
+); \
+
+207 }))
+
+       )
+
+210 
+       g__BEGIN_NAMESPACE_STD
+
+
+212 #ifdeà
+__CORRECT_ISO_CPP_STRING_H_PROTO
+
+
+215 \r\ 5*
+¡rchr
+ (\ 5*
+__s
+, \12
+__c
+)
+
+216 
+__THROW
+__asm
+ ("¡rchr"è
+__©\8cibu\8b_pu»__
+__nÚnuÎ
+ ((1));
+
+217 \r
+__cڡ
\ 5*
+¡rchr
+ (__cڡ \ 5*
+__s
+, \12
+__c
+)
+
+218 
+__THROW
+__asm
+ ("¡rchr"è
+__©\8cibu\8b_pu»__
+__nÚnuÎ
+ ((1));
+
+220 #ifdeà
+__OPTIMIZE__
+
+
+221 
+__ex\8bº_®ways_\9al\9ae
\ 5*
+
+222 
+¡rchr
+ (\ 5*
+__s
+, \12
+__c
+       g__THROW
+
+
+224 \15 
+__bu\9et\9a_¡rchr
+ (
+__s
+, 
+__c
+);
+
+227 
+__ex\8bº_®ways_\9al\9ae
+__cڡ
\ 5*
+
+228 
+¡rchr
+ (
+__cڡ
\ 5*
+__s
+, \12
+__c
+       g__THROW
+
+
+230 \15 
+__bu\9et\9a_¡rchr
+ (
+__s
+, 
+__c
+);
+
+235 \r\ 5*
+       $¡rchr
+ (
+__cڡ
\ 5*
+__s
+, \12
+__c
+)
+
+236 
+__THROW
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1));
+
+239 #ifdeà
+__CORRECT_ISO_CPP_STRING_H_PROTO
+
+
+242 \r\ 5*
+       `¡¼chr
+ (\ 5*
+__s
+, \12
+__c
+)
+
+243 
+__THROW
+       `__asm
+ ("¡¼chr"è
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1));
+
+244 \r
+__cڡ
\ 5*
+       `¡¼chr
+ (__cڡ \ 5*
+__s
+, \12
+__c
+)
+
+245 
+__THROW
+       `__asm
+ ("¡¼chr"è
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1));
+
+247 #ifdeà
+__OPTIMIZE__
+
+
+248 
+__ex\8bº_®ways_\9al\9ae
\ 5*
+
+249 
+       `¡¼chr
+ (\ 5*
+__s
+, \12
+__c
+__THROW
+
+
+251 \15 
+       `__bu\9et\9a_¡¼chr
+ (
+__s
+, 
+__c
+);
+
+254 
+__ex\8bº_®ways_\9al\9ae
+__cڡ
\ 5*
+
+255 
+       `¡¼chr
+ (
+__cڡ
\ 5*
+__s
+, \12
+__c
+__THROW
+
+
+257 \15 
+       `__bu\9et\9a_¡¼chr
+ (
+__s
+, 
+__c
+);
+
+260 
+       }
+}
+
+262 \r\ 5*
+       $¡¼chr
+ (
+__cڡ
\ 5*
+__s
+, \12
+__c
+)
+
+263 
+__THROW
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1));
+
+265 
+__END_NAMESPACE_STD
+
+
+267 #ifdeà
+__USE_GNU
+
+
+270 #ifdeà
+__CORRECT_ISO_CPP_STRING_H_PROTO
+
+
+271 \r"C++" \ 5*
+       $¡rchºul
+ (\ 5*
+__s
+, \12
+__c
+)
+
+272 
+__THROW
+       `__asm
+ ("¡rchºul"è
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1));
+
+273 \r"C++" 
+__cڡ
\ 5*
+       $¡rchºul
+ (
+__cڡ
\ 5*
+__s
+, \12
+__c
+)
+
+274 
+__THROW
+       `__asm
+ ("¡rchºul"è
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1));
+
+276 \r\ 5*
+       $¡rchºul
+ (
+__cڡ
\ 5*
+__s
+, \12
+__c
+)
+
+277 
+__THROW
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1));
+
+281 
+__BEGIN_NAMESPACE_STD
+
+
+284 \r
+size_t
+       $¡rc¥n
+ (
+__cڡ
\ 5*
+__s
+, __cڡ \ 5*
+__»jeù
+)
+
+285 
+__THROW
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1, 2));
+
+288 \r
+size_t
+       $¡r¥n
+ (
+__cڡ
\ 5*
+__s
+, __cڡ \ 5*
+__acû±
+)
+
+289 
+__THROW
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1, 2));
+
+291 #ifdeà
+__CORRECT_ISO_CPP_STRING_H_PROTO
+
+
+294 \r\ 5*
+       `¡½brk
+ (\ 5*
+__s
+, 
+__cڡ
\ 5*
+__acû±
+)
+
+295 
+__THROW
+       `__asm
+ ("¡½brk"è
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1, 2));
+
+296 \r
+__cڡ
\ 5*
+       `¡½brk
+ (__cڡ \ 5*
+__s
+, __cڡ \ 5*
+__acû±
+)
+
+297 
+__THROW
+       `__asm
+ ("¡½brk"è
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1, 2));
+
+299 #ifdeà
+__OPTIMIZE__
+
+
+300 
+__ex\8bº_®ways_\9al\9ae
\ 5*
+
+301 
+       `¡½brk
+ (\ 5*
+__s
+, 
+__cڡ
\ 5*
+__acû±
+__THROW
+
+
+303 \15 
+       `__bu\9et\9a_¡½brk
+ (
+__s
+, 
+__acû±
+);
+
+306 
+__ex\8bº_®ways_\9al\9ae
+__cڡ
\ 5*
+
+307 
+       `¡½brk
+ (
+__cڡ
\ 5*
+__s
+, __cڡ \ 5*
+__acû±
+__THROW
+
+
+309 \15 
+       `__bu\9et\9a_¡½brk
+ (
+__s
+, 
+__acû±
+);
+
+312 
+       }
+}
+
+314 \r\ 5*
+       $¡½brk
+ (
+__cڡ
\ 5*
+__s
+, __cڡ \ 5*
+__acû±
+)
+
+315 
+__THROW
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1, 2));
+
+318 #ifdeà
+__CORRECT_ISO_CPP_STRING_H_PROTO
+
+
+321 \r\ 5*
+       `¡r¡r
+ (\ 5*
+__hay¡ack
+, 
+__cڡ
\ 5*
+__ÃedË
+)
+
+322 
+__THROW
+       `__asm
+ ("¡r¡r"è
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1, 2));
+
+323 \r
+__cڡ
\ 5*
+       `¡r¡r
+ (__cڡ \ 5*
+__hay¡ack
+,
+
+324 
+__cڡ
\ 5*
+__ÃedË
+)
+
+325 
+__THROW
+       `__asm
+ ("¡r¡r"è
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1, 2));
+
+327 #ifdeà
+__OPTIMIZE__
+
+
+328 
+__ex\8bº_®ways_\9al\9ae
\ 5*
+
+329 
+       `¡r¡r
+ (\ 5*
+__hay¡ack
+, 
+__cڡ
\ 5*
+__ÃedË
+__THROW
+
+
+331 \15 
+       `__bu\9et\9a_¡r¡r
+ (
+__hay¡ack
+, 
+__ÃedË
+);
+
+334 
+__ex\8bº_®ways_\9al\9ae
+__cڡ
\ 5*
+
+335 
+       `¡r¡r
+ (
+__cڡ
\ 5*
+__hay¡ack
+, __cڡ \ 5*
+__ÃedË
+__THROW
+
+
+337 \15 
+       `__bu\9et\9a_¡r¡r
+ (
+__hay¡ack
+, 
+__ÃedË
+);
+
+340 
+       }
+}
+
+342 \r\ 5*
+       $¡r¡r
+ (
+__cڡ
\ 5*
+__hay¡ack
+, __cڡ \ 5*
+__ÃedË
+)
+
+343 
+__THROW
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1, 2));
+
+348 \r\ 5*
+       $¡¹ok
+ (\ 5*
+__»¡riù
+__s
+, 
+__cڡ
\ 5*__»¡riù 
+__d\96im
+)
+
+349 
+__THROW
+       `__nÚnuÎ
+ ((2));
+
+350 
+__END_NAMESPACE_STD
+
+
+354 \r\ 5*
+       $__¡¹ok_r
+ (\ 5*
+__»¡riù
+__s
+,
+
+355 
+__cڡ
\ 5*
+__»¡riù
+__d\96im
+,
+
+356 \ 5**
+__»¡riù
+__§ve_±r
+)
+
+357 
+__THROW
+       `__nÚnuÎ
+ ((2, 3));
+
+358 #ià
+def\9aed
+__USE_POSIX
+ || def\9aed 
+__USE_MISC
+
+
+359 \r\ 5*
+       $¡¹ok_r
+ (\ 5*
+__»¡riù
+__s
+, 
+__cڡ
\ 5*__»¡riù 
+__d\96im
+,
+
+360 \ 5**
+__»¡riù
+__§ve_±r
+)
+
+361 
+__THROW
+       `__nÚnuÎ
+ ((2, 3));
+
+364 #ifdeà
+__USE_GNU
+
+
+366 #ifdeà
+__CORRECT_ISO_CPP_STRING_H_PROTO
+
+
+367 \r"C++" \ 5*
+       $¡rÿ£¡r
+ (\ 5*
+__hay¡ack
+, 
+__cڡ
\ 5*
+__ÃedË
+)
+
+368 
+__THROW
+       `__asm
+ ("¡rÿ£¡r"è
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1, 2));
+
+369 \r"C++" 
+__cڡ
\ 5*
+       $¡rÿ£¡r
+ (
+__cڡ
\ 5*
+__hay¡ack
+,
+
+370 
+__cڡ
\ 5*
+__ÃedË
+)
+
+371 
+__THROW
+       `__asm
+ ("¡rÿ£¡r"è
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1, 2));
+
+373 \r\ 5*
+       $¡rÿ£¡r
+ (
+__cڡ
\ 5*
+__hay¡ack
+, __cڡ \ 5*
+__ÃedË
+)
+
+374 
+__THROW
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1, 2));
+
+378 #ifdeà
+__USE_GNU
+
+
+382 \r\1e*
+       $memmem
+ (
+__cڡ
\1e*
+__hay¡ack
+, 
+size_t
+__hay¡ackËn
+,
+
+383 
+__cڡ
\1e*
+__ÃedË
+, 
+size_t
+__ÃedËËn
+)
+
+384 
+__THROW
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1, 3));
+
+388 \r\1e*
+       $__mempýy
+ (\1e*
+__»¡riù
+__de¡
+,
+
+389 
+__cڡ
\1e*
+__»¡riù
+__¤c
+, 
+size_t
+__n
+)
+
+390 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+391 \r\1e*
+       $mempýy
+ (\1e*
+__»¡riù
+__de¡
+,
+
+392 
+__cڡ
\1e*
+__»¡riù
+__¤c
+, 
+size_t
+__n
+)
+
+393 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+397 
+__BEGIN_NAMESPACE_STD
+
+
+399 \r
+size_t
+       $¡¾\92
+ (
+__cڡ
\ 5*
+__s
+)
+
+400 
+__THROW
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1));
+
+401 
+__END_NAMESPACE_STD
+
+
+403 #ifdef 
+__USE_XOPEN2K8
+
+
+406 \r
+size_t
+       $¡ºËn
+ (
+__cڡ
\ 5*
+__¡r\9ag
+, 
+size_t
+__maxËn
+)
+
+407 
+__THROW
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1));
+
+411 
+__BEGIN_NAMESPACE_STD
+
+
+413 \r\ 5*
+       $¡»¼Ü
+ (\12
+__\94ºum
+__THROW
+;
+
+414 
+__END_NAMESPACE_STD
+
+
+415 #ià
+def\9aed
+__USE_XOPEN2K
+ || def\9aed 
+__USE_MISC
+
+
+423 #ià
+def\9aed
+__USE_XOPEN2K
+ && !def\9aed 
+__USE_GNU
+
+
+426 #ifdeà
+__REDIRECT_NTH
+
+
+427 \r\12
+       `__REDIRECT_NTH
+ (
+¡»¼Ü_r
+,
+
+428 (\12
+__\94ºum
+, \ 5*
+__buf
+, 
+size_t
+__buæ\92
+),
+
+429 
+__xpg_¡»¼Ü_r
+       `__nÚnuÎ
+ ((2));
+
+431 \r\12
+       $__xpg_¡»¼Ü_r
+ (\12
+__\94ºum
+, \ 5*
+__buf
+, 
+size_t
+__buæ\92
+)
+
+432 
+__THROW
+       `__nÚnuÎ
+ ((2));
+
+433 \ 1
+       #¡»¼Ü_r
+__xpg_¡»¼Ü_r
+
+
+       )
+
+438 \r\ 5*
+       $¡»¼Ü_r
+ (\12
+__\94ºum
+, \ 5*
+__buf
+, 
+size_t
+__buæ\92
+)
+
+439 
+__THROW
+       `__nÚnuÎ
+ ((2));
+
+443 #ifdeà
+__USE_XOPEN2K8
+
+
+445 \r\ 5*
+       $¡»¼Ü_l
+ (\12
+__\94ºum
+, 
+__loÿË_t
+__l
+__THROW
+;
+
+451 \r\1e
+       $__bz\94o
+ (\1e*
+__s
+, 
+size_t
+__n
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+453 #ifdeà
+__USE_BSD
+
+
+455 \r\1e
+       $bcÝy
+ (
+__cڡ
\1e*
+__¤c
+, \1e*
+__de¡
+, 
+size_t
+__n
+)
+
+456 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+459 \r\1e
+       $bz\94o
+ (\1e*
+__s
+, 
+size_t
+__n
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+462 \r\12
+       $bcmp
+ (
+__cڡ
\1e*
+__s1
+, __cڡ \1e*
+__s2
+, 
+size_t
+__n
+)
+
+463 
+__THROW
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1, 2));
+
+466 #ifdeà
+__CORRECT_ISO_CPP_STRING_H_PROTO
+
+
+469 \r\ 5*
+       `\9adex
+ (\ 5*
+__s
+, \12
+__c
+)
+
+470 
+__THROW
+       `__asm
+ ("\9adex"è
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1));
+
+471 \r
+__cڡ
\ 5*
+       `\9adex
+ (__cڡ \ 5*
+__s
+, \12
+__c
+)
+
+472 
+__THROW
+       `__asm
+ ("\9adex"è
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1));
+
+474 #ià
+def\9aed
+__OPTIMIZE__
+ && !def\9aed 
+__CORRECT_ISO_CPP_STRINGS_H_PROTO
+
+
+475 
+__ex\8bº_®ways_\9al\9ae
\ 5*
+
+476 
+       `\9adex
+ (\ 5*
+__s
+, \12
+__c
+__THROW
+
+
+478 \15 
+       `__bu\9et\9a_\9adex
+ (
+__s
+, 
+__c
+);
+
+481 
+__ex\8bº_®ways_\9al\9ae
+__cڡ
\ 5*
+
+482 
+       `\9adex
+ (
+__cڡ
\ 5*
+__s
+, \12
+__c
+__THROW
+
+
+484 \15 
+       `__bu\9et\9a_\9adex
+ (
+__s
+, 
+__c
+);
+
+487 
+       }
+}
+
+489 \r\ 5*
+       $\9adex
+ (
+__cڡ
\ 5*
+__s
+, \12
+__c
+)
+
+490 
+__THROW
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1));
+
+494 #ifdeà
+__CORRECT_ISO_CPP_STRING_H_PROTO
+
+
+497 \r\ 5*
+       `r\9adex
+ (\ 5*
+__s
+, \12
+__c
+)
+
+498 
+__THROW
+       `__asm
+ ("r\9adex"è
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1));
+
+499 \r
+__cڡ
\ 5*
+       `r\9adex
+ (__cڡ \ 5*
+__s
+, \12
+__c
+)
+
+500 
+__THROW
+       `__asm
+ ("r\9adex"è
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1));
+
+502 #ià
+def\9aed
+__OPTIMIZE__
+ && !def\9aed 
+__CORRECT_ISO_CPP_STRINGS_H_PROTO
+
+
+503 
+__ex\8bº_®ways_\9al\9ae
\ 5*
+
+504 
+       `r\9adex
+ (\ 5*
+__s
+, \12
+__c
+__THROW
+
+
+506 \15 
+       `__bu\9et\9a_r\9adex
+ (
+__s
+, 
+__c
+);
+
+509 
+__ex\8bº_®ways_\9al\9ae
+__cڡ
\ 5*
+
+510 
+       `r\9adex
+ (
+__cڡ
\ 5*
+__s
+, \12
+__c
+__THROW
+
+
+512 \15 
+       `__bu\9et\9a_r\9adex
+ (
+__s
+, 
+__c
+);
+
+515 
+       }
+}
+
+517 \r\ 5*
+       $r\9adex
+ (
+__cڡ
\ 5*
+__s
+, \12
+__c
+)
+
+518 
+__THROW
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1));
+
+523 \r\12
+       $ffs
+ (\12
+__i
+__THROW
+       `__©\8cibu\8b__
+ ((
+__cڡ__
+));
+
+527 #ifdef 
+__USE_GNU
+
+
+528 \r\12
+       $ff¦
+ (\13\12
+__l
+__THROW
+       `__©\8cibu\8b__
+ ((
+__cڡ__
+));
+
+529 #ifdeà
+__GNUC__
+
+
+530 
+__ex\8bnsiÚ__
\r\12
+       $ff¦l
+ (\13\13\12
+__Î
+)
+
+531 
+__THROW
+       `__©\8cibu\8b__
+ ((
+__cڡ__
+));
+
+536 \r\12
+       $¡rÿ£cmp
+ (
+__cڡ
\ 5*
+__s1
+, __cڡ \ 5*
+__s2
+)
+
+537 
+__THROW
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1, 2));
+
+540 \r\12
+       $¡ºÿ£cmp
+ (
+__cڡ
\ 5*
+__s1
+, __cڡ \ 5*
+__s2
+, 
+size_t
+__n
+)
+
+541 
+__THROW
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1, 2));
+
+544 #ifdef 
+__USE_GNU
+
+
+547 \r\12
+       $¡rÿ£cmp_l
+ (
+__cڡ
\ 5*
+__s1
+, __cڡ \ 5*
+__s2
+,
+
+548 
+__loÿË_t
+__loc
+)
+
+549 
+__THROW
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1, 2, 3));
+
+551 \r\12
+       $¡ºÿ£cmp_l
+ (
+__cڡ
\ 5*
+__s1
+, __cڡ \ 5*
+__s2
+,
+
+552 
+size_t
+__n
+, 
+__loÿË_t
+__loc
+)
+
+553 
+__THROW
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1, 2, 4));
+
+556 #ifdef 
+__USE_BSD
+
+
+559 \r\ 5*
+       $¡r£p
+ (\ 5**
+__»¡riù
+__¡r\9agp
+,
+
+560 
+__cڡ
\ 5*
+__»¡riù
+__d\96im
+)
+
+561 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+564 #ifdef 
+__USE_XOPEN2K8
+
+
+566 \r\ 5*
+       $¡rsigÇl
+ (\12
+__sig
+__THROW
+;
+
+569 \r\ 5*
+       $__¡pýy
+ (\ 5*
+__»¡riù
+__de¡
+, 
+__cڡ
\ 5*__»¡riù 
+__¤c
+)
+
+570 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+571 \r\ 5*
+       $¡pýy
+ (\ 5*
+__»¡riù
+__de¡
+, 
+__cڡ
\ 5*__»¡riù 
+__¤c
+)
+
+572 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+576 \r\ 5*
+       $__¡²ýy
+ (\ 5*
+__»¡riù
+__de¡
+,
+
+577 
+__cڡ
\ 5*
+__»¡riù
+__¤c
+, 
+size_t
+__n
+)
+
+578 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+579 \r\ 5*
+       $¡²ýy
+ (\ 5*
+__»¡riù
+__de¡
+,
+
+580 
+__cڡ
\ 5*
+__»¡riù
+__¤c
+, 
+size_t
+__n
+)
+
+581 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+584 #ifdef 
+__USE_GNU
+
+
+586 \r\12
+       $¡rv\94scmp
+ (
+__cڡ
\ 5*
+__s1
+, __cڡ \ 5*
+__s2
+)
+
+587 
+__THROW
+__©\8cibu\8b_pu»__
+       `__nÚnuÎ
+ ((1, 2));
+
+590 \r\ 5*
+       $¡räy
+ (\ 5*
+__¡r\9ag
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+593 \r\1e*
+       $memäob
+ (\1e*
+__s
+, 
+size_t
+__n
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+595 #iâdeà
+ba£Çme
+
+
+600 #ifdeà
+__CORRECT_ISO_CPP_STRING_H_PROTO
+
+
+601 \r"C++" \ 5*
+       $ba£Çme
+ (\ 5*
+__f\9e\92ame
+)
+
+602 
+__THROW
+       `__asm
+ ("ba£Çme"è
+       `__nÚnuÎ
+ ((1));
+
+603 \r"C++" 
+__cڡ
\ 5*
+       $ba£Çme
+ (
+__cڡ
\ 5*
+__f\9e\92ame
+)
+
+604 
+__THROW
+       `__asm
+ ("ba£Çme"è
+       `__nÚnuÎ
+ ((1));
+
+606 \r\ 5*
+       $ba£Çme
+ (
+__cڡ
\ 5*
+__f\9e\92ame
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+612 #ià
+def\9aed
+__GNUC__
+ && __GNUC__ >= 2
+
+613 #ià
+def\9aed
+__OPTIMIZE__
+ && !def\9aed 
+__OPTIMIZE_SIZE__
+ \
+
+614 && !
+def\9aed
+__NO_INLINE__
+ && !def\9aed 
+__ýlu¥lus
+
+
+634 \ 2
+       ~<b\99s/¡r\9ag.h
+>
+
+637 \ 2
+       ~<b\99s/¡r\9ag2.h
+>
+
+640 #ià
+__USE_FORTIFY_LEVEL
+ > 0 && 
+def\9aed
+__ex\8bº_®ways_\9al\9ae
+
+
+642 \ 2
+       ~<b\99s/¡r\9ag3.h
+>
+
+646 
+__END_DECLS
+
+
+       @/usr/include/sys/epoll.h
+
+19 #iâdef 
+_SYS_EPOLL_H
+
+
+20 \ 1
+       #_SYS_EPOLL_H
+ 1
+
+       )
+
+22 \ 2
+       ~<¡d\9at.h
+>
+
+23 \ 2
+       ~<sys/ty³s.h
+>
+
+26 \ 2
+       ~<b\99s/sig£t.h
+>
+
+28 #iâdeà
+__sig£t_t_def\9aed
+
+
+29 \ 1
+       #__sig£t_t_def\9aed
+
+
+       )
+
+30 \e
+__sig£t_t
+       tsig£t_t
+;
+
+37 
+       mEPOLL_CLOEXEC
+ = 02000000,
+
+38 \ 1
+       #EPOLL_CLOEXEC
+EPOLL_CLOEXEC
+
+
+       )
+
+39 
+       mEPOLL_NONBLOCK
+ = 04000
+
+40 \ 1
+       #EPOLL_NONBLOCK
+EPOLL_NONBLOCK
+
+
+       )
+
+44 \f
+       eEPOLL_EVENTS
+
+
+46 
+       mEPOLLIN
+ = 0x001,
+
+47 \ 1
+       #EPOLLIN
+EPOLLIN
+
+
+       )
+
+48 
+       mEPOLLPRI
+ = 0x002,
+
+49 \ 1
+       #EPOLLPRI
+EPOLLPRI
+
+
+       )
+
+50 
+       mEPOLLOUT
+ = 0x004,
+
+51 \ 1
+       #EPOLLOUT
+EPOLLOUT
+
+
+       )
+
+52 
+       mEPOLLRDNORM
+ = 0x040,
+
+53 \ 1
+       #EPOLLRDNORM
+EPOLLRDNORM
+
+
+       )
+
+54 
+       mEPOLLRDBAND
+ = 0x080,
+
+55 \ 1
+       #EPOLLRDBAND
+EPOLLRDBAND
+
+
+       )
+
+56 
+       mEPOLLWRNORM
+ = 0x100,
+
+57 \ 1
+       #EPOLLWRNORM
+EPOLLWRNORM
+
+
+       )
+
+58 
+       mEPOLLWRBAND
+ = 0x200,
+
+59 \ 1
+       #EPOLLWRBAND
+EPOLLWRBAND
+
+
+       )
+
+60 
+       mEPOLLMSG
+ = 0x400,
+
+61 \ 1
+       #EPOLLMSG
+EPOLLMSG
+
+
+       )
+
+62 
+       mEPOLLERR
+ = 0x008,
+
+63 \ 1
+       #EPOLLERR
+EPOLLERR
+
+
+       )
+
+64 
+       mEPOLLHUP
+ = 0x010,
+
+65 \ 1
+       #EPOLLHUP
+EPOLLHUP
+
+
+       )
+
+66 
+       mEPOLLRDHUP
+ = 0x2000,
+
+67 \ 1
+       #EPOLLRDHUP
+EPOLLRDHUP
+
+
+       )
+
+68 
+       mEPOLLONESHOT
+ = (1 << 30),
+
+69 \ 1
+       #EPOLLONESHOT
+EPOLLONESHOT
+
+
+       )
+
+70 
+       mEPOLLET
+ = (1 << 31)
+
+71 \ 1
+       #EPOLLET
+EPOLLET
+
+
+       )
+
+76 \ 1
+       #EPOLL_CTL_ADD
+ 1
+
+       )
+
+77 \ 1
+       #EPOLL_CTL_DEL
+ 2
+
+       )
+
+78 \ 1
+       #EPOLL_CTL_MOD
+ 3
+
+       )
+
+81 \e\1c
+       u\95Þl_d©a
+
+
+83 \1e*
+       m±r
+;
+
+84 \12
+       mfd
+;
+
+85 
+u\9at32_t
+       mu32
+;
+
+86 
+u\9at64_t
+       mu64
+;
+
+87 } 
+       t\95Þl_d©a_t
+;
+
+89 \19
+       s\95Þl_ev\92t
+
+
+91 
+u\9at32_t
+       mev\92ts
+;
+
+92 
+\95Þl_d©a_t
+       md©a
+;
+
+93 } 
+__©\8cibu\8b__
+ ((
+__·cked__
+));
+
+96 
+__BEGIN_DECLS
+
+
+102 \r\12
+       $\95Þl_ü\97\8b
+ (\12
+__size
+__THROW
+;
+
+106 \r\12
+       $\95Þl_ü\97\8b1
+ (\12
+__æags
+__THROW
+;
+
+115 \r\12
+       $\95Þl_ùl
+ (\12
+__\95fd
+, \12
+__Ý
+, \12
+__fd
+,
+
+116 \19
+\95Þl_ev\92t
+ *
+__ev\92t
+__THROW
+;
+
+129 \r\12
+       `\95Þl_wa\99
+ (\12
+__\95fd
+, \19
+\95Þl_ev\92t
+ *
+__ev\92ts
+,
+
+130 \12
+__maxev\92ts
+, \12
+__timeout
+);
+
+138 \r\12
+       `\95Þl_pwa\99
+ (\12
+__\95fd
+, \19
+\95Þl_ev\92t
+ *
+__ev\92ts
+,
+
+139 \12
+__maxev\92ts
+, \12
+__timeout
+,
+
+140 
+__cڡ
+__sig£t_t
+ *
+__ss
+);
+
+142 
+__END_DECLS
+
+
+       @/usr/include/sys/ioctl.h
+
+19 #iâdef 
+_SYS_IOCTL_H
+
+
+20 \ 1
+       #_SYS_IOCTL_H
+ 1
+
+       )
+
+22 \ 2
+       ~<ã©u»s.h
+>
+
+24 
+       g__BEGIN_DECLS
+
+
+27 \ 2
+       ~<b\99s/ioùls.h
+>
+
+30 \ 2
+       ~<b\99s/ioùl-ty³s.h
+>
+
+37 \ 2
+       ~<sys/\89ydeçuÉs.h
+>
+
+42 \r\12
+       $ioùl
+ (\12
+__fd
+, \1d\13\12
+__»que¡
+, ...è
+__THROW
+;
+
+44 
+__END_DECLS
+
+
+       @/usr/include/sys/ipc.h
+
+19 #iâdeà
+_SYS_IPC_H
+
+
+20 \ 1
+       #_SYS_IPC_H
+ 1
+
+       )
+
+22 \ 2
+       ~<ã©u»s.h
+>
+
+24 #ià!
+def\9aed
+__USE_SVID
+ && !def\9aed 
+__USE_XOPEN
+ && 
+__GNUC__
+ >= 2
+
+29 \ 2
+       ~<b\99s/\9dùy³s.h
+>
+
+30 \ 2
+       ~<b\99s/\9dc.h
+>
+
+32 #iâdeà
+__uid_t_def\9aed
+
+
+33 \e
+__uid_t
+       tuid_t
+;
+
+34 \ 1
+       #__uid_t_def\9aed
+
+
+       )
+
+37 #iâdeà
+__gid_t_def\9aed
+
+
+38 \e
+__gid_t
+       tgid_t
+;
+
+39 \ 1
+       #__gid_t_def\9aed
+
+
+       )
+
+42 #iâdeà
+__mode_t_def\9aed
+
+
+43 \e
+__mode_t
+       tmode_t
+;
+
+44 \ 1
+       #__mode_t_def\9aed
+
+
+       )
+
+47 #iâdeà
+__key_t_def\9aed
+
+
+48 \e
+__key_t
+       tkey_t
+;
+
+49 \ 1
+       #__key_t_def\9aed
+
+
+       )
+
+52 
+__BEGIN_DECLS
+
+
+55 \r
+key_t
+       $áok
+ (
+__cڡ
\ 5*
+__·thÇme
+, \12
+__´oj_id
+__THROW
+;
+
+57 
+__END_DECLS
+
+
+       @/usr/include/sys/msg.h
+
+20 #iâdeà
+_SYS_MSG_H
+
+
+21 \ 1
+       #_SYS_MSG_H
+
+
+       )
+
+23 \ 2
+       ~<ã©u»s.h
+>
+
+25 \ 1
+       #__Ãed_size_t
+
+
+       )
+
+26 \ 2
+       ~<¡ddef.h
+>
+
+29 \ 2
+       ~<sys/\9dc.h
+>
+
+32 \ 2
+       ~<b\99s/msq.h
+>
+
+35 \ 1
+       #__Ãed_time_t
+
+
+       )
+
+36 \ 2
+       ~<time.h
+>
+
+38 #iâdeà
+__pid_t_def\9aed
+
+
+39 \e
+__pid_t
+       tpid_t
+;
+
+40 \ 1
+       #__pid_t_def\9aed
+
+
+       )
+
+43 #iâdeà
+__ssize_t_def\9aed
+
+
+44 \e
+__ssize_t
+       tssize_t
+;
+
+45 \ 1
+       #__ssize_t_def\9aed
+
+
+       )
+
+51 #ifdeà
+__USE_GNU
+
+
+53 \19
+       smsgbuf
+
+
+55 \13\12
+       mmty³
+;
+
+56 \ 5
+       mm\8bxt
+[1];
+
+61 
+__BEGIN_DECLS
+
+
+64 \r\12
+       $msgùl
+ (\12
+__msqid
+, \12
+__cmd
+, \19
+msqid_ds
+ *
+__buf
+__THROW
+;
+
+67 \r\12
+       $msgg\91
+ (
+key_t
+__key
+, \12
+__msgæg
+__THROW
+;
+
+73 \r
+ssize_t
+       `msgrcv
+ (\12
+__msqid
+, \1e*
+__msgp
+, 
+size_t
+__msgsz
+,
+
+74 \13\12
+__msgtyp
+, \12
+__msgæg
+);
+
+80 \r\12
+       `msg¢d
+ (\12
+__msqid
+, 
+__cڡ
\1e*
+__msgp
+, 
+size_t
+__msgsz
+,
+
+81 \12
+__msgæg
+);
+
+83 
+__END_DECLS
+
+
+       @/usr/include/sys/select.h
+
+22 #iâdeà
+_SYS_SELECT_H
+
+
+23 \ 1
+       #_SYS_SELECT_H
+ 1
+
+       )
+
+25 \ 2
+       ~<ã©u»s.h
+>
+
+28 \ 2
+       ~<b\99s/ty³s.h
+>
+
+31 \ 2
+       ~<b\99s/£Ëù.h
+>
+
+34 \ 2
+       ~<b\99s/sig£t.h
+>
+
+36 #iâdeà
+__sig£t_t_def\9aed
+
+
+37 \ 1
+       #__sig£t_t_def\9aed
+
+
+       )
+
+38 \e
+__sig£t_t
+       tsig£t_t
+;
+
+42 \ 1
+       #__Ãed_time_t
+
+
+       )
+
+43 \ 1
+       #__Ãed_time¥ec
+
+
+       )
+
+44 \ 2
+       ~<time.h
+>
+
+45 \ 1
+       #__Ãed_timev®
+
+
+       )
+
+46 \ 2
+       ~<b\99s/time.h
+>
+
+48 #iâdeà
+__su£cÚds_t_def\9aed
+
+
+49 \e
+__su£cÚds_t
+       tsu£cÚds_t
+;
+
+50 \ 1
+       #__su£cÚds_t_def\9aed
+
+
+       )
+
+55 \e\13\12
+       t__fd_mask
+;
+
+58 #undeà
+__NFDBITS
+
+
+59 #undeà
+__FDELT
+
+
+60 #undeà
+__FDMASK
+
+
+62 \ 1
+       #__NFDBITS
+ (8 * (\12è\17 (
+__fd_mask
+))
+
+       )
+
+63 \ 1
+       #__FDELT
+(
+d
+è((dè/ 
+__NFDBITS
+)
+
+       )
+
+64 \ 1
+       #__FDMASK
+(
+d
+è((
+__fd_mask
+è1 << ((dè% 
+__NFDBITS
+))
+
+       )
+
+71 #ifdeà
+__USE_XOPEN
+
+
+72 
+__fd_mask
+       mfds_b\99s
+[
+__FD_SETSIZE
+ / 
+__NFDBITS
+];
+
+73 \ 1
+       #__FDS_BITS
+(
+£t
+è((£t)->
+fds_b\99s
+)
+
+       )
+
+75 
+__fd_mask
+       m__fds_b\99s
+[
+__FD_SETSIZE
+ / 
+__NFDBITS
+];
+
+76 \ 1
+       #__FDS_BITS
+(
+£t
+è((£t)->
+__fds_b\99s
+)
+
+       )
+
+78 } 
+       tfd_£t
+;
+
+81 \ 1
+       #FD_SETSIZE
+__FD_SETSIZE
+
+
+       )
+
+83 #ifdeà
+__USE_MISC
+
+
+85 \e
+__fd_mask
+       tfd_mask
+;
+
+88 \ 1
+       #NFDBITS
+__NFDBITS
+
+
+       )
+
+93 \ 1
+       #FD_SET
+(
+fd
+, 
+fd£\8d
+       `__FD_SET
+ (fd, fd£\8d)
+
+       )
+
+94 \ 1
+       #FD_CLR
+(
+fd
+, 
+fd£\8d
+       `__FD_CLR
+ (fd, fd£\8d)
+
+       )
+
+95 \ 1
+       #FD_ISSET
+(
+fd
+, 
+fd£\8d
+       `__FD_ISSET
+ (fd, fd£\8d)
+
+       )
+
+96 \ 1
+       #FD_ZERO
+(
+fd£\8d
+       `__FD_ZERO
+ (fd£\8d)
+
+       )
+
+99 
+__BEGIN_DECLS
+
+
+109 \r\12
+£Ëù
+ (\12
+__nfds
+, 
+fd_£t
+ *
+__»¡riù
+__»adfds
+,
+
+110 
+fd_£t
+ *
+__»¡riù
+__wr\99efds
+,
+
+111 
+fd_£t
+ *
+__»¡riù
+__exû±fds
+,
+
+112 \19
+timev®
+ *
+__»¡riù
+__timeout
+);
+
+114 #ifdeà
+__USE_XOPEN2K
+
+
+121 \r\12
+p£Ëù
+ (\12
+__nfds
+, 
+fd_£t
+ *
+__»¡riù
+__»adfds
+,
+
+122 
+fd_£t
+ *
+__»¡riù
+__wr\99efds
+,
+
+123 
+fd_£t
+ *
+__»¡riù
+__exû±fds
+,
+
+124 cڡ \19
+time¥ec
+ *
+__»¡riù
+__timeout
+,
+
+125 cڡ 
+__sig£t_t
+ *
+__»¡riù
+__sigmask
+);
+
+128 
+       g__END_DECLS
+
+
+       @/usr/include/sys/socket.h
+
+21 #iâdef 
+_SYS_SOCKET_H
+
+
+22 \ 1
+       #_SYS_SOCKET_H
+ 1
+
+       )
+
+24 \ 2
+       ~<ã©u»s.h
+>
+
+26 
+       g__BEGIN_DECLS
+
+
+28 \ 2
+       ~<sys/uio.h
+>
+
+29 \ 1
+       #__Ãed_size_t
+
+
+       )
+
+30 \ 2
+       ~<¡ddef.h
+>
+
+31 #ifdeà
+__USE_GNU
+
+
+33 \ 2
+       ~<b\99s/sig£t.h
+>
+
+40 \ 2
+       ~<b\99s/sock\91.h
+>
+
+42 #ifdeà
+__USE_BSD
+
+
+45 \19
+       sosockaddr
+
+
+47 \1d\16\12
+       m§_çm\9ey
+;
+
+48 \1d\ 5
+       m§_d©a
+[14];
+
+56 
+       mSHUT_RD
+ = 0,
+
+57 \ 1
+       #SHUT_RD
+SHUT_RD
+
+
+       )
+
+58 
+       mSHUT_WR
+,
+
+59 \ 1
+       #SHUT_WR
+SHUT_WR
+
+
+       )
+
+60 
+       mSHUT_RDWR
+
+
+61 \ 1
+       #SHUT_RDWR
+SHUT_RDWR
+
+
+       )
+
+70 #ià
+def\9aed
+__ýlu¥lus
+ || !
+__GNUC_PREREQ
+ (2, 7è|| !def\9aed 
+__USE_GNU
+
+
+71 \ 1
+       #__SOCKADDR_ARG
\19
+sockaddr
+ *
+__»¡riù
+
+
+       )
+
+72 \ 1
+       #__CONST_SOCKADDR_ARG
+__cڡ
\19
+sockaddr
+ *
+
+       )
+
+76 \ 1
+       #__SOCKADDR_ALLTYPES
+ \
+
+77 
+       `__SOCKADDR_ONETYPE
+ (
+sockaddr
+) \
+
+78 
+       `__SOCKADDR_ONETYPE
+ (
+sockaddr_©
+) \
+
+79 
+       `__SOCKADDR_ONETYPE
+ (
+sockaddr_ax25
+) \
+
+80 
+       `__SOCKADDR_ONETYPE
+ (
+sockaddr_dl
+) \
+
+81 
+       `__SOCKADDR_ONETYPE
+ (
+sockaddr_eÚ
+) \
+
+82 
+       `__SOCKADDR_ONETYPE
+ (
+sockaddr_\9a
+) \
+
+83 
+       `__SOCKADDR_ONETYPE
+ (
+sockaddr_\9a6
+) \
+
+84 
+       `__SOCKADDR_ONETYPE
+ (
+sockaddr_\9a¬p
+) \
+
+85 
+       `__SOCKADDR_ONETYPE
+ (
+sockaddr_\9dx
+) \
+
+86 
+       `__SOCKADDR_ONETYPE
+ (
+sockaddr_iso
+) \
+
+87 
+       `__SOCKADDR_ONETYPE
+ (
+sockaddr_ns
+) \
+
+88 
+       `__SOCKADDR_ONETYPE
+ (
+sockaddr_un
+) \
+
+89 
+       `__SOCKADDR_ONETYPE
+ (
+sockaddr_x25
+)
+
+       )
+
+91 \ 1
+       #__SOCKADDR_ONETYPE
+(
+ty³
\19ty³ *
+__»¡riù
+__
+##ty³##__;
+
+       )
+
+92 \euniÚ { 
+       m__SOCKADDR_ALLTYPES
+
+
+93 } 
+       t__SOCKADDR_ARG
+       t__©\8cibu\8b__
+ ((
+       t__\8cª¥¬\92t_uniÚ__
+));
+
+94 #undeà
+__SOCKADDR_ONETYPE
+
+
+95 \ 1
+       #__SOCKADDR_ONETYPE
+(
+ty³
+__cڡ
\19ty³ *
+__»¡riù
+__
+##ty³##__;
+
+       )
+
+96 \euniÚ { 
+       m__SOCKADDR_ALLTYPES
+
+
+97 } 
+       t__CONST_SOCKADDR_ARG
+       t__©\8cibu\8b__
+ ((
+       t__\8cª¥¬\92t_uniÚ__
+));
+
+98 #undeà
+__SOCKADDR_ONETYPE
+
+
+105 \r\12
+       $sock\91
+ (\12
+__doma\9a
+, \12
+__ty³
+, \12
+__´ÙocÞ
+__THROW
+;
+
+111 \r\12
+       $sock\91·\9c
+ (\12
+__doma\9a
+, \12
+__ty³
+, \12
+__´ÙocÞ
+,
+
+112 \12
+__fds
+[2]è
+__THROW
+;
+
+115 \r\12
+       $b\9ad
+ (\12
+__fd
+, 
+__CONST_SOCKADDR_ARG
+__addr
+, 
+sockËn_t
+__Ën
+)
+
+116 
+__THROW
+;
+
+119 \r\12
+       $g\91sockÇme
+ (\12
+__fd
+, 
+__SOCKADDR_ARG
+__addr
+,
+
+120 
+sockËn_t
+ *
+__»¡riù
+__Ën
+__THROW
+;
+
+129 \r\12
+       `cÚÃù
+ (\12
+__fd
+, 
+__CONST_SOCKADDR_ARG
+__addr
+, 
+sockËn_t
+__Ën
+);
+
+133 \r\12
+       $g\91³\94Çme
+ (\12
+__fd
+, 
+__SOCKADDR_ARG
+__addr
+,
+
+134 
+sockËn_t
+ *
+__»¡riù
+__Ën
+__THROW
+;
+
+141 \r
+ssize_t
+       `£nd
+ (\12
+__fd
+, 
+__cڡ
\1e*
+__buf
+, 
+size_t
+__n
+, \12
+__æags
+);
+
+148 \r
+ssize_t
+       `»cv
+ (\12
+__fd
+, \1e*
+__buf
+, 
+size_t
+__n
+, \12
+__æags
+);
+
+155 \r
+ssize_t
+       `£ndto
+ (\12
+__fd
+, 
+__cڡ
\1e*
+__buf
+, 
+size_t
+__n
+,
+
+156 \12
+__æags
+, 
+__CONST_SOCKADDR_ARG
+__addr
+,
+
+157 
+sockËn_t
+__addr_Ën
+);
+
+166 \r
+ssize_t
+       `»cväom
+ (\12
+__fd
+, \1e*
+__»¡riù
+__buf
+, 
+size_t
+__n
+,
+
+167 \12
+__æags
+, 
+__SOCKADDR_ARG
+__addr
+,
+
+168 
+sockËn_t
+ *
+__»¡riù
+__addr_Ën
+);
+
+176 \r
+ssize_t
+       `£ndmsg
+ (\12
+__fd
+, 
+__cڡ
\19
+msghdr
+ *
+__mes§ge
+,
+
+177 \12
+__æags
+);
+
+184 \r
+ssize_t
+       `»cvmsg
+ (\12
+__fd
+, \19
+msghdr
+ *
+__mes§ge
+, \12
+__æags
+);
+
+190 \r\12
+       $g\91sockÝt
+ (\12
+__fd
+, \12
+__Ëv\96
+, \12
+__݊ame
+,
+
+191 \1e*
+__»¡riù
+__Ýtv®
+,
+
+192 
+sockËn_t
+ *
+__»¡riù
+__Ý\8e\92
+__THROW
+;
+
+197 \r\12
+       $£tsockÝt
+ (\12
+__fd
+, \12
+__Ëv\96
+, \12
+__݊ame
+,
+
+198 
+__cڡ
\1e*
+__Ýtv®
+, 
+sockËn_t
+__Ý\8e\92
+__THROW
+;
+
+204 \r\12
+       $li¡\92
+ (\12
+__fd
+, \12
+__n
+__THROW
+;
+
+214 \r\12
+       `acû±
+ (\12
+__fd
+, 
+__SOCKADDR_ARG
+__addr
+,
+
+215 
+sockËn_t
+ *
+__»¡riù
+__addr_Ën
+);
+
+217 #ifdeà
+__USE_GNU
+
+
+222 \r\12
+       `acû±4
+ (\12
+__fd
+, 
+__SOCKADDR_ARG
+__addr
+,
+
+223 
+sockËn_t
+ *
+__»¡riù
+__addr_Ën
+, \12
+__æags
+);
+
+232 \r\12
+       $shutdown
+ (\12
+__fd
+, \12
+__how
+__THROW
+;
+
+235 #ifdeà
+__USE_XOPEN2K
+
+
+237 \r\12
+       $sock©m¬k
+ (\12
+__fd
+__THROW
+;
+
+241 #ifdeà
+__USE_MISC
+
+
+245 \r\12
+       $isfdty³
+ (\12
+__fd
+, \12
+__fdty³
+__THROW
+;
+
+250 #ià
+__USE_FORTIFY_LEVEL
+ > 0 && 
+def\9aed
+__ex\8bº_®ways_\9al\9ae
+
+
+251 \ 2
+       ~<b\99s/sock\912.h
+>
+
+254 
+__END_DECLS
+
+
+       @/usr/include/sys/stat.h
+
+24 #iâdef 
+_SYS_STAT_H
+
+
+25 \ 1
+       #_SYS_STAT_H
+ 1
+
+       )
+
+27 \ 2
+       ~<ã©u»s.h
+>
+
+29 \ 2
+       ~<b\99s/ty³s.h
+>
+
+31 #ià
+def\9aed
+__USE_XOPEN
+ || def\9aed 
+__USE_XOPEN2K
+ || def\9aed 
+__USE_MISC
+ \
+
+32 || 
+def\9aed
+       g__USE_ATFILE
+
+
+33 #ià
+def\9aed
+__USE_XOPEN
+ || def\9aed 
+__USE_XOPEN2K
+
+
+34 \ 1
+       #__Ãed_time_t
+
+
+       )
+
+36 #ià
+def\9aed
+__USE_MISC
+ || def\9aed 
+__USE_ATFILE
+
+
+37 \ 1
+       #__Ãed_time¥ec
+
+
+       )
+
+39 \ 2
+       ~<time.h
+>
+
+42 #ià
+def\9aed
+__USE_XOPEN
+ || def\9aed 
+__USE_XOPEN2K
+
+
+45 #iâdeà
+__dev_t_def\9aed
+
+
+46 \e
+__dev_t
+       tdev_t
+;
+
+47 \ 1
+       #__dev_t_def\9aed
+
+
+       )
+
+50 #iâdeà
+__gid_t_def\9aed
+
+
+51 \e
+__gid_t
+       tgid_t
+;
+
+52 \ 1
+       #__gid_t_def\9aed
+
+
+       )
+
+55 #iâdeà
+__\9ao_t_def\9aed
+
+
+56 #iâdeà
+__USE_FILE_OFFSET64
+
+
+57 \e
+__\9ao_t
+       t\9ao_t
+;
+
+59 \e
+__\9ao64_t
+       t\9ao_t
+;
+
+61 \ 1
+       #__\9ao_t_def\9aed
+
+
+       )
+
+64 #iâdeà
+__mode_t_def\9aed
+
+
+65 \e
+__mode_t
+       tmode_t
+;
+
+66 \ 1
+       #__mode_t_def\9aed
+
+
+       )
+
+69 #iâdeà
+__Æ\9ak_t_def\9aed
+
+
+70 \e
+__ƚk_t
+       tƚk_t
+;
+
+71 \ 1
+       #__Æ\9ak_t_def\9aed
+
+
+       )
+
+74 #iâdeà
+__off_t_def\9aed
+
+
+75 #iâdeà
+__USE_FILE_OFFSET64
+
+
+76 \e
+__off_t
+       toff_t
+;
+
+78 \e
+__off64_t
+       toff_t
+;
+
+80 \ 1
+       #__off_t_def\9aed
+
+
+       )
+
+83 #iâdeà
+__uid_t_def\9aed
+
+
+84 \e
+__uid_t
+       tuid_t
+;
+
+85 \ 1
+       #__uid_t_def\9aed
+
+
+       )
+
+89 #ifdeà
+__USE_UNIX98
+
+
+90 #iâdeà
+__blkút_t_def\9aed
+
+
+91 #iâdeà
+__USE_FILE_OFFSET64
+
+
+92 \e
+__blkút_t
+       tblkút_t
+;
+
+94 \e
+__blkút64_t
+       tblkút_t
+;
+
+96 \ 1
+       #__blkút_t_def\9aed
+
+
+       )
+
+99 #iâdeà
+__blksize_t_def\9aed
+
+
+100 \e
+__blksize_t
+       tblksize_t
+;
+
+101 \ 1
+       #__blksize_t_def\9aed
+
+
+       )
+
+105 
+       g__BEGIN_DECLS
+
+
+107 \ 2
+       ~<b\99s/¡©.h
+>
+
+109 #ià
+def\9aed
+__USE_BSD
+ || def\9aed 
+__USE_MISC
+ || def\9aed 
+__USE_XOPEN
+
+
+110 \ 1
+       #S_IFMT
+__S_IFMT
+
+
+       )
+
+111 \ 1
+       #S_IFDIR
+__S_IFDIR
+
+
+       )
+
+112 \ 1
+       #S_IFCHR
+__S_IFCHR
+
+
+       )
+
+113 \ 1
+       #S_IFBLK
+__S_IFBLK
+
+
+       )
+
+114 \ 1
+       #S_IFREG
+__S_IFREG
+
+
+       )
+
+115 #ifdeà
+__S_IFIFO
+
+
+116 \ 1
+       #S_IFIFO
+__S_IFIFO
+
+
+       )
+
+118 #ifdeà
+__S_IFLNK
+
+
+119 \ 1
+       #S_IFLNK
+__S_IFLNK
+
+
+       )
+
+121 #ià(
+def\9aed
+__USE_BSD
+ || def\9aed 
+__USE_MISC
+ || def\9aed 
+__USE_UNIX98
+) \
+
+122 && 
+def\9aed
+       g__S_IFSOCK
+
+
+123 \ 1
+       #S_IFSOCK
+__S_IFSOCK
+
+
+       )
+
+129 \ 1
+       #__S_ISTYPE
+(
+mode
+, 
+mask
+è(((modeè& 
+__S_IFMT
+è=ð(mask))
+
+       )
+
+131 \ 1
+       #S_ISDIR
+(
+mode
+       `__S_ISTYPE
+((mode), 
+__S_IFDIR
+)
+
+       )
+
+132 \ 1
+       #S_ISCHR
+(
+mode
+       `__S_ISTYPE
+((mode), 
+__S_IFCHR
+)
+
+       )
+
+133 \ 1
+       #S_ISBLK
+(
+mode
+       `__S_ISTYPE
+((mode), 
+__S_IFBLK
+)
+
+       )
+
+134 \ 1
+       #S_ISREG
+(
+mode
+       `__S_ISTYPE
+((mode), 
+__S_IFREG
+)
+
+       )
+
+135 #ifdeà
+__S_IFIFO
+
+
+136 \ 1
+       #S_ISFIFO
+(
+mode
+       `__S_ISTYPE
+((mode), 
+__S_IFIFO
+)
+
+       )
+
+138 #ifdeà
+__S_IFLNK
+
+
+139 \ 1
+       #S_ISLNK
+(
+mode
+       `__S_ISTYPE
+((mode), 
+__S_IFLNK
+)
+
+       )
+
+142 #ià
+def\9aed
+__USE_BSD
+ && !def\9aed 
+__S_IFLNK
+
+
+143 \ 1
+       #S_ISLNK
+(
+mode
+è0
+
+       )
+
+146 #ià(
+def\9aed
+__USE_BSD
+ || def\9aed 
+__USE_UNIX98
+ || def\9aed 
+__USE_XOPEN2K
+) \
+
+147 && 
+def\9aed
+       g__S_IFSOCK
+
+
+148 \ 1
+       #S_ISSOCK
+(
+mode
+       `__S_ISTYPE
+((mode), 
+__S_IFSOCK
+)
+
+       )
+
+149 #\96
+def\9aed
+__USE_XOPEN2K
+
+
+150 \ 1
+       #S_ISSOCK
+(
+mode
+è0
+
+       )
+
+157 #ifdef 
+__USE_POSIX199309
+
+
+158 \ 1
+       #S_TYPEISMQ
+(
+buf
+       `__S_TYPEISMQ
+(buf)
+
+       )
+
+159 \ 1
+       #S_TYPEISSEM
+(
+buf
+       `__S_TYPEISSEM
+(buf)
+
+       )
+
+160 \ 1
+       #S_TYPEISSHM
+(
+buf
+       `__S_TYPEISSHM
+(buf)
+
+       )
+
+166 \ 1
+       #S_ISUID
+__S_ISUID
+
+
+       )
+
+167 \ 1
+       #S_ISGID
+__S_ISGID
+
+
+       )
+
+169 #ià
+def\9aed
+__USE_BSD
+ || def\9aed 
+__USE_MISC
+ || def\9aed 
+__USE_XOPEN
+
+
+171 \ 1
+       #S_ISVTX
+__S_ISVTX
+
+
+       )
+
+174 \ 1
+       #S_IRUSR
+__S_IREAD
+
+
+       )
+
+175 \ 1
+       #S_IWUSR
+__S_IWRITE
+
+
+       )
+
+176 \ 1
+       #S_IXUSR
+__S_IEXEC
+
+
+       )
+
+178 \ 1
+       #S_IRWXU
+ (
+__S_IREAD
+|
+__S_IWRITE
+|
+__S_IEXEC
+)
+
+       )
+
+180 #ià
+def\9aed
+__USE_MISC
+ && def\9aed 
+__USE_BSD
+
+
+181 \ 1
+       #S_IREAD
+S_IRUSR
+
+
+       )
+
+182 \ 1
+       #S_IWRITE
+S_IWUSR
+
+
+       )
+
+183 \ 1
+       #S_IEXEC
+S_IXUSR
+
+
+       )
+
+186 \ 1
+       #S_IRGRP
+ (
+S_IRUSR
+ >> 3è
+
+       )
+
+187 \ 1
+       #S_IWGRP
+ (
+S_IWUSR
+ >> 3è
+
+       )
+
+188 \ 1
+       #S_IXGRP
+ (
+S_IXUSR
+ >> 3è
+
+       )
+
+190 \ 1
+       #S_IRWXG
+ (
+S_IRWXU
+ >> 3)
+
+       )
+
+192 \ 1
+       #S_IROTH
+ (
+S_IRGRP
+ >> 3è
+
+       )
+
+193 \ 1
+       #S_IWOTH
+ (
+S_IWGRP
+ >> 3è
+
+       )
+
+194 \ 1
+       #S_IXOTH
+ (
+S_IXGRP
+ >> 3è
+
+       )
+
+196 \ 1
+       #S_IRWXO
+ (
+S_IRWXG
+ >> 3)
+
+       )
+
+199 #ifdef 
+__USE_BSD
+
+
+201 \ 1
+       #ACCESSPERMS
+ (
+S_IRWXU
+|
+S_IRWXG
+|
+S_IRWXO
+
+       )
+
+202 \ 1
+       #ALLPERMS
+ (
+S_ISUID
+|
+S_ISGID
+|
+S_ISVTX
+|
+S_IRWXU
+|
+S_IRWXG
+|
+S_IRWXO
+)
+
+       )
+
+203 \ 1
+       #DEFFILEMODE
+ (
+S_IRUSR
+|
+S_IWUSR
+|
+S_IRGRP
+|
+S_IWGRP
+|
+S_IROTH
+|
+S_IWOTH
+)
+
+       )
+
+205 \ 1
+       #S_BLKSIZE
+ 512
+
+       )
+
+209 #iâdeà
+__USE_FILE_OFFSET64
+
+
+211 \r\12
+       $¡©
+ (
+__cڡ
\ 5*
+__»¡riù
+__f\9ee
+,
+
+212 \19
+¡©
+ *
+__»¡riù
+__buf
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+216 \r\12
+       $f¡©
+ (\12
+__fd
+, \19
+¡©
+ *
+__buf
+__THROW
+       `__nÚnuÎ
+ ((2));
+
+218 #ifdeà
+__REDIRECT_NTH
+
+
+219 \r\12
+       `__REDIRECT_NTH
+ (
+¡©
+, (
+__cڡ
\ 5*
+__»¡riù
+__f\9ee
+,
+
+220 \19
+¡©
+ *
+__»¡riù
+__buf
+), 
+¡©64
+)
+
+221 
+       `__nÚnuÎ
+ ((1, 2));
+
+222 \r\12
+       `__REDIRECT_NTH
+ (
+f¡©
+, (\12
+__fd
+, \19
+¡©
+ *
+__buf
+), 
+f¡©64
+)
+
+223 
+       `__nÚnuÎ
+ ((2));
+
+225 \ 1
+       #¡©
+¡©64
+
+
+       )
+
+226 \ 1
+       #f¡©
+f¡©64
+
+
+       )
+
+229 #ifdeà
+__USE_LARGEFILE64
+
+
+230 \r\12
+       $¡©64
+ (
+__cڡ
\ 5*
+__»¡riù
+__f\9ee
+,
+
+231 \19
+¡©64
+ *
+__»¡riù
+__buf
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+232 \r\12
+       $f¡©64
+ (\12
+__fd
+, \19
+¡©64
+ *
+__buf
+__THROW
+       `__nÚnuÎ
+ ((2));
+
+235 #ifdeà
+__USE_ATFILE
+
+
+239 #iâdeà
+__USE_FILE_OFFSET64
+
+
+240 \r\12
+       $f¡©©
+ (\12
+__fd
+, 
+__cڡ
\ 5*
+__»¡riù
+__f\9ee
+,
+
+241 \19
+¡©
+ *
+__»¡riù
+__buf
+, \12
+__æag
+)
+
+242 
+__THROW
+       `__nÚnuÎ
+ ((2, 3));
+
+244 #ifdeà
+__REDIRECT_NTH
+
+
+245 \r\12
+       `__REDIRECT_NTH
+ (
+f¡©©
+, (\12
+__fd
+, 
+__cڡ
\ 5*
+__»¡riù
+__f\9ee
+,
+
+246 \19
+¡©
+ *
+__»¡riù
+__buf
+,
+
+247 \12
+__æag
+),
+
+248 
+f¡©©64
+       `__nÚnuÎ
+ ((2, 3));
+
+250 \ 1
+       #f¡©©
+f¡©©64
+
+
+       )
+
+254 #ifdeà
+__USE_LARGEFILE64
+
+
+255 \r\12
+       $f¡©©64
+ (\12
+__fd
+, 
+__cڡ
\ 5*
+__»¡riù
+__f\9ee
+,
+
+256 \19
+¡©64
+ *
+__»¡riù
+__buf
+, \12
+__æag
+)
+
+257 
+__THROW
+       `__nÚnuÎ
+ ((2, 3));
+
+261 #ià
+def\9aed
+__USE_BSD
+ || def\9aed 
+__USE_XOPEN_EXTENDED
+ || def\9aed 
+__USE_XOPEN2K
+
+
+262 #iâdeà
+__USE_FILE_OFFSET64
+
+
+265 \r\12
+       $l¡©
+ (
+__cڡ
\ 5*
+__»¡riù
+__f\9ee
+,
+
+266 \19
+¡©
+ *
+__»¡riù
+__buf
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+268 #ifdeà
+__REDIRECT_NTH
+
+
+269 \r\12
+       `__REDIRECT_NTH
+ (
+l¡©
+,
+
+270 (
+__cڡ
\ 5*
+__»¡riù
+__f\9ee
+,
+
+271 \19
+¡©
+ *
+__»¡riù
+__buf
+), 
+l¡©64
+)
+
+272 
+       `__nÚnuÎ
+ ((1, 2));
+
+274 \ 1
+       #l¡©
+l¡©64
+
+
+       )
+
+277 #ifdeà
+__USE_LARGEFILE64
+
+
+278 \r\12
+       $l¡©64
+ (
+__cڡ
\ 5*
+__»¡riù
+__f\9ee
+,
+
+279 \19
+¡©64
+ *
+__»¡riù
+__buf
+)
+
+280 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+286 \r\12
+       $chmod
+ (
+__cڡ
\ 5*
+__f\9ee
+, 
+__mode_t
+__mode
+)
+
+287 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+289 #ifdeà
+__USE_BSD
+
+
+293 \r\12
+       $lchmod
+ (
+__cڡ
\ 5*
+__f\9ee
+, 
+__mode_t
+__mode
+)
+
+294 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+298 #ià
+def\9aed
+__USE_BSD
+ || def\9aed 
+__USE_XOPEN_EXTENDED
+ || def\9aed 
+__USE_XOPEN2K8
+
+
+299 \r\12
+       $fchmod
+ (\12
+__fd
+, 
+__mode_t
+__mode
+__THROW
+;
+
+302 #ifdeà
+__USE_ATFILE
+
+
+305 \r\12
+       $fchmod©
+ (\12
+__fd
+, 
+__cڡ
\ 5*
+__f\9ee
+, 
+__mode_t
+__mode
+,
+
+306 \12
+__æag
+)
+
+307 
+__THROW
+       `__nÚnuÎ
+ ((2)è
+__wur
+;
+
+314 \r
+__mode_t
+       $umask
+ (
+__mode_t
+__mask
+__THROW
+;
+
+316 #ifdef 
+__USE_GNU
+
+
+319 \r
+__mode_t
+       $g\91umask
+ (\1eè
+__THROW
+;
+
+323 \r\12
+       $mkd\9c
+ (
+__cڡ
\ 5*
+__·th
+, 
+__mode_t
+__mode
+)
+
+324 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+326 #ifdeà
+__USE_ATFILE
+
+
+330 \r\12
+       $mkd\9c©
+ (\12
+__fd
+, 
+__cڡ
\ 5*
+__·th
+, 
+__mode_t
+__mode
+)
+
+331 
+__THROW
+       `__nÚnuÎ
+ ((2));
+
+337 #ià
+def\9aed
+__USE_MISC
+ || def\9aed 
+__USE_BSD
+ || def\9aed 
+__USE_XOPEN_EXTENDED
+
+
+338 \r\12
+       $mknod
+ (
+__cڡ
\ 5*
+__·th
+, 
+__mode_t
+__mode
+, 
+__dev_t
+__dev
+)
+
+339 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+341 #ifdeà
+__USE_ATFILE
+
+
+345 \r\12
+       $mknod©
+ (\12
+__fd
+, 
+__cڡ
\ 5*
+__·th
+, 
+__mode_t
+__mode
+,
+
+346 
+__dev_t
+__dev
+__THROW
+       `__nÚnuÎ
+ ((2));
+
+352 \r\12
+       $mkfifo
+ (
+__cڡ
\ 5*
+__·th
+, 
+__mode_t
+__mode
+)
+
+353 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+355 #ifdeà
+__USE_ATFILE
+
+
+359 \r\12
+       $mkfifßt
+ (\12
+__fd
+, 
+__cڡ
\ 5*
+__·th
+, 
+__mode_t
+__mode
+)
+
+360 
+__THROW
+       `__nÚnuÎ
+ ((2));
+
+363 #ifdeà
+__USE_ATFILE
+
+
+366 \r\12
+       $utim\92§t
+ (\12
+__fd
+, 
+__cڡ
\ 5*
+__·th
+,
+
+367 
+__cڡ
\19
+time¥ec
+__times
+[2],
+
+368 \12
+__æags
+)
+
+369 
+__THROW
+       `__nÚnuÎ
+ ((2));
+
+372 #ifdeà
+__USE_XOPEN2K8
+
+
+374 \r\12
+       $futim\92s
+ (\12
+__fd
+, 
+__cڡ
\19
+time¥ec
+__times
+[2]è
+__THROW
+;
+
+392 #iâdeà
+_STAT_VER
+
+
+393 \ 1
+       #_STAT_VER
+ 0
+
+       )
+
+395 #iâdeà
+_MKNOD_VER
+
+
+396 \ 1
+       #_MKNOD_VER
+ 0
+
+       )
+
+400 #iâdeà
+__USE_FILE_OFFSET64
+
+
+401 \r\12
+       $__fx¡©
+ (\12
+__v\94
+, \12
+__f\9edes
+, \19
+¡©
+ *
+__¡©_buf
+)
+
+402 
+__THROW
+       `__nÚnuÎ
+ ((3));
+
+403 \r\12
+       $__x¡©
+ (\12
+__v\94
+, 
+__cڡ
\ 5*
+__f\9e\92ame
+,
+
+404 \19
+¡©
+ *
+__¡©_buf
+__THROW
+       `__nÚnuÎ
+ ((2, 3));
+
+405 \r\12
+       $__lx¡©
+ (\12
+__v\94
+, 
+__cڡ
\ 5*
+__f\9e\92ame
+,
+
+406 \19
+¡©
+ *
+__¡©_buf
+__THROW
+       `__nÚnuÎ
+ ((2, 3));
+
+407 \r\12
+       $__fx¡©©
+ (\12
+__v\94
+, \12
+__f\9edes
+, 
+__cڡ
\ 5*
+__f\9e\92ame
+,
+
+408 \19
+¡©
+ *
+__¡©_buf
+, \12
+__æag
+)
+
+409 
+__THROW
+       `__nÚnuÎ
+ ((3, 4));
+
+411 #ifdeà
+__REDIRECT_NTH
+
+
+412 \r\12
+       `__REDIRECT_NTH
+ (
+__fx¡©
+, (\12
+__v\94
+, \12
+__f\9edes
+,
+
+413 \19
+¡©
+ *
+__¡©_buf
+), 
+__fx¡©64
+)
+
+414 
+       `__nÚnuÎ
+ ((3));
+
+415 \r\12
+       `__REDIRECT_NTH
+ (
+__x¡©
+, (\12
+__v\94
+, 
+__cڡ
\ 5*
+__f\9e\92ame
+,
+
+416 \19
+¡©
+ *
+__¡©_buf
+), 
+__x¡©64
+)
+
+417 
+       `__nÚnuÎ
+ ((2, 3));
+
+418 \r\12
+       `__REDIRECT_NTH
+ (
+__lx¡©
+, (\12
+__v\94
+, 
+__cڡ
\ 5*
+__f\9e\92ame
+,
+
+419 \19
+¡©
+ *
+__¡©_buf
+), 
+__lx¡©64
+)
+
+420 
+       `__nÚnuÎ
+ ((2, 3));
+
+421 \r\12
+       `__REDIRECT_NTH
+ (
+__fx¡©©
+, (\12
+__v\94
+, \12
+__f\9edes
+,
+
+422 
+__cڡ
\ 5*
+__f\9e\92ame
+,
+
+423 \19
+¡©
+ *
+__¡©_buf
+, \12
+__æag
+),
+
+424 
+__fx¡©©64
+       `__nÚnuÎ
+ ((3, 4));
+
+427 \ 1
+       #__fx¡©
+__fx¡©64
+
+
+       )
+
+428 \ 1
+       #__x¡©
+__x¡©64
+
+
+       )
+
+429 \ 1
+       #__lx¡©
+__lx¡©64
+
+
+       )
+
+433 #ifdeà
+__USE_LARGEFILE64
+
+
+434 \r\12
+       $__fx¡©64
+ (\12
+__v\94
+, \12
+__f\9edes
+, \19
+¡©64
+ *
+__¡©_buf
+)
+
+435 
+__THROW
+       `__nÚnuÎ
+ ((3));
+
+436 \r\12
+       $__x¡©64
+ (\12
+__v\94
+, 
+__cڡ
\ 5*
+__f\9e\92ame
+,
+
+437 \19
+¡©64
+ *
+__¡©_buf
+__THROW
+       `__nÚnuÎ
+ ((2, 3));
+
+438 \r\12
+       $__lx¡©64
+ (\12
+__v\94
+, 
+__cڡ
\ 5*
+__f\9e\92ame
+,
+
+439 \19
+¡©64
+ *
+__¡©_buf
+__THROW
+       `__nÚnuÎ
+ ((2, 3));
+
+440 \r\12
+       $__fx¡©©64
+ (\12
+__v\94
+, \12
+__f\9edes
+, 
+__cڡ
\ 5*
+__f\9e\92ame
+,
+
+441 \19
+¡©64
+ *
+__¡©_buf
+, \12
+__æag
+)
+
+442 
+__THROW
+       `__nÚnuÎ
+ ((3, 4));
+
+444 \r\12
+       $__xmknod
+ (\12
+__v\94
+, 
+__cڡ
\ 5*
+__·th
+, 
+__mode_t
+__mode
+,
+
+445 
+__dev_t
+ *
+__dev
+__THROW
+       `__nÚnuÎ
+ ((2, 4));
+
+447 \r\12
+       $__xmknod©
+ (\12
+__v\94
+, \12
+__fd
+, 
+__cڡ
\ 5*
+__·th
+,
+
+448 
+__mode_t
+__mode
+, 
+__dev_t
+ *
+__dev
+)
+
+449 
+__THROW
+       `__nÚnuÎ
+ ((3, 5));
+
+451 #ià
+def\9aed
+__GNUC__
+ && __GNUC__ >ð2 && def\9aed 
+__USE_EXTERN_INLINES_IN_LIBC
+
+
+454 
+__ex\8bº_\9al\9ae
\12
+
+455 
+       `__NTH
+ (
+       $¡©
+ (
+__cڡ
\ 5*
+__·th
+, \19
+¡©
+ *
+__¡©buf
+))
+
+457 \15 
+       `__x¡©
+ (
+_STAT_VER
+, 
+__·th
+, 
+__¡©buf
+);
+
+458 
+       }
+}
+
+460 #ià
+def\9aed
+__USE_BSD
+ || def\9aed 
+__USE_XOPEN_EXTENDED
+
+
+461 
+__ex\8bº_\9al\9ae
\12
+
+462 
+__NTH
+ (
+       $l¡©
+ (
+__cڡ
\ 5*
+__·th
+, \19
+¡©
+ *
+__¡©buf
+))
+
+464 \15 
+       `__lx¡©
+ (
+_STAT_VER
+, 
+__·th
+, 
+__¡©buf
+);
+
+465 
+       }
+}
+
+468 
+__ex\8bº_\9al\9ae
\12
+
+469 
+__NTH
+ (
+       $f¡©
+ (\12
+__fd
+, \19
+¡©
+ *
+__¡©buf
+))
+
+471 \15 
+       `__fx¡©
+ (
+_STAT_VER
+, 
+__fd
+, 
+__¡©buf
+);
+
+472 
+       }
+}
+
+474 #ifdeà
+__USE_ATFILE
+
+
+475 
+__ex\8bº_\9al\9ae
\12
+
+476 
+__NTH
+ (
+       $f¡©©
+ (\12
+__fd
+, 
+__cڡ
\ 5*
+__f\9e\92ame
+, \19
+¡©
+ *
+__¡©buf
+,
+
+477 \12
+__æag
+))
+
+479 \15 
+       `__fx¡©©
+ (
+_STAT_VER
+, 
+__fd
+, 
+__f\9e\92ame
+, 
+__¡©buf
+, 
+__æag
+);
+
+480 
+       }
+}
+
+483 #ià
+def\9aed
+__USE_MISC
+ || def\9aed 
+__USE_BSD
+
+
+484 
+__ex\8bº_\9al\9ae
\12
+
+485 
+__NTH
+ (
+       $mknod
+ (
+__cڡ
\ 5*
+__·th
+, 
+__mode_t
+__mode
+, 
+__dev_t
+__dev
+))
+
+487 \15 
+       `__xmknod
+ (
+_MKNOD_VER
+, 
+__·th
+, 
+__mode
+, &
+__dev
+);
+
+488 
+       }
+}
+
+491 #ifdeà
+__USE_ATFILE
+
+
+492 
+__ex\8bº_\9al\9ae
\12
+
+493 
+__NTH
+ (
+       $mknod©
+ (\12
+__fd
+, 
+__cڡ
\ 5*
+__·th
+, 
+__mode_t
+__mode
+,
+
+494 
+__dev_t
+__dev
+))
+
+496 \15 
+       `__xmknod©
+ (
+_MKNOD_VER
+, 
+__fd
+, 
+__·th
+, 
+__mode
+, &
+__dev
+);
+
+497 
+       }
+}
+
+500 #ià
+def\9aed
+__USE_LARGEFILE64
+ \
+
+501 && (! 
+def\9aed
+       g__USE_FILE_OFFSET64
+ \
+
+502 || (
+def\9aed
+       g__REDIRECT_NTH
+ && def\9aed 
+       g__OPTIMIZE__
+))
+
+503 
+__ex\8bº_\9al\9ae
\12
+
+504 
+__NTH
+ (
+       $¡©64
+ (
+__cڡ
\ 5*
+__·th
+, \19
+¡©64
+ *
+__¡©buf
+))
+
+506 \15 
+       `__x¡©64
+ (
+_STAT_VER
+, 
+__·th
+, 
+__¡©buf
+);
+
+507 
+       }
+}
+
+509 #ià
+def\9aed
+__USE_BSD
+ || def\9aed 
+__USE_XOPEN_EXTENDED
+
+
+510 
+__ex\8bº_\9al\9ae
\12
+
+511 
+__NTH
+ (
+       $l¡©64
+ (
+__cڡ
\ 5*
+__·th
+, \19
+¡©64
+ *
+__¡©buf
+))
+
+513 \15 
+       `__lx¡©64
+ (
+_STAT_VER
+, 
+__·th
+, 
+__¡©buf
+);
+
+514 
+       }
+}
+
+517 
+__ex\8bº_\9al\9ae
\12
+
+518 
+__NTH
+ (
+       $f¡©64
+ (\12
+__fd
+, \19
+¡©64
+ *
+__¡©buf
+))
+
+520 \15 
+       `__fx¡©64
+ (
+_STAT_VER
+, 
+__fd
+, 
+__¡©buf
+);
+
+521 
+       }
+}
+
+523 #ifdeà
+__USE_ATFILE
+
+
+524 
+__ex\8bº_\9al\9ae
\12
+
+525 
+__NTH
+ (
+       $f¡©©64
+ (\12
+__fd
+, 
+__cڡ
\ 5*
+__f\9e\92ame
+, \19
+¡©64
+ *
+__¡©buf
+,
+
+526 \12
+__æag
+))
+
+528 \15 
+       `__fx¡©©64
+ (
+_STAT_VER
+, 
+__fd
+, 
+__f\9e\92ame
+, 
+__¡©buf
+, 
+__æag
+);
+
+529 
+       }
+}
+
+536 
+       g__END_DECLS
+
+
+       @/usr/include/sys/types.h
+
+23 #iâdef 
+_SYS_TYPES_H
+
+
+24 \ 1
+       #_SYS_TYPES_H
+ 1
+
+       )
+
+26 \ 2
+       ~<ã©u»s.h
+>
+
+28 
+       g__BEGIN_DECLS
+
+
+30 \ 2
+       ~<b\99s/ty³s.h
+>
+
+32 #ifdef 
+__USE_BSD
+
+
+33 #iâdeà
+__u_ch¬_def\9aed
+
+
+34 \e
+__u_ch¬
+       tu_ch¬
+;
+
+35 \e
+__u_shÜt
+       tu_shÜt
+;
+
+36 \e
+__u_\9at
+       tu_\9at
+;
+
+37 \e
+__u_lÚg
+       tu_lÚg
+;
+
+38 \e
+__quad_t
+       tquad_t
+;
+
+39 \e
+__u_quad_t
+       tu_quad_t
+;
+
+40 \e
+__fsid_t
+       tfsid_t
+;
+
+41 \ 1
+       #__u_ch¬_def\9aed
+
+
+       )
+
+45 \e
+__loff_t
+       tloff_t
+;
+
+47 #iâdeà
+__\9ao_t_def\9aed
+
+
+48 #iâdeà
+__USE_FILE_OFFSET64
+
+
+49 \e
+__\9ao_t
+       t\9ao_t
+;
+
+51 \e
+__\9ao64_t
+       t\9ao_t
+;
+
+53 \ 1
+       #__\9ao_t_def\9aed
+
+
+       )
+
+55 #ià
+def\9aed
+__USE_LARGEFILE64
+ && !def\9aed 
+__\9ao64_t_def\9aed
+
+
+56 \e
+__\9ao64_t
+       t\9ao64_t
+;
+
+57 \ 1
+       #__\9ao64_t_def\9aed
+
+
+       )
+
+60 #iâdeà
+__dev_t_def\9aed
+
+
+61 \e
+__dev_t
+       tdev_t
+;
+
+62 \ 1
+       #__dev_t_def\9aed
+
+
+       )
+
+65 #iâdeà
+__gid_t_def\9aed
+
+
+66 \e
+__gid_t
+       tgid_t
+;
+
+67 \ 1
+       #__gid_t_def\9aed
+
+
+       )
+
+70 #iâdeà
+__mode_t_def\9aed
+
+
+71 \e
+__mode_t
+       tmode_t
+;
+
+72 \ 1
+       #__mode_t_def\9aed
+
+
+       )
+
+75 #iâdeà
+__Æ\9ak_t_def\9aed
+
+
+76 \e
+__ƚk_t
+       tƚk_t
+;
+
+77 \ 1
+       #__Æ\9ak_t_def\9aed
+
+
+       )
+
+80 #iâdeà
+__uid_t_def\9aed
+
+
+81 \e
+__uid_t
+       tuid_t
+;
+
+82 \ 1
+       #__uid_t_def\9aed
+
+
+       )
+
+85 #iâdeà
+__off_t_def\9aed
+
+
+86 #iâdeà
+__USE_FILE_OFFSET64
+
+
+87 \e
+__off_t
+       toff_t
+;
+
+89 \e
+__off64_t
+       toff_t
+;
+
+91 \ 1
+       #__off_t_def\9aed
+
+
+       )
+
+93 #ià
+def\9aed
+__USE_LARGEFILE64
+ && !def\9aed 
+__off64_t_def\9aed
+
+
+94 \e
+__off64_t
+       toff64_t
+;
+
+95 \ 1
+       #__off64_t_def\9aed
+
+
+       )
+
+98 #iâdeà
+__pid_t_def\9aed
+
+
+99 \e
+__pid_t
+       tpid_t
+;
+
+100 \ 1
+       #__pid_t_def\9aed
+
+
+       )
+
+103 #ià(
+def\9aed
+__USE_SVID
+ || def\9aed 
+__USE_XOPEN
+ || def\9aed 
+__USE_XOPEN2K8
+) \
+
+104 && !
+def\9aed
+__id_t_def\9aed
+
+
+105 \e
+__id_t
+       tid_t
+;
+
+106 \ 1
+       #__id_t_def\9aed
+
+
+       )
+
+109 #iâdeà
+__ssize_t_def\9aed
+
+
+110 \e
+__ssize_t
+       tssize_t
+;
+
+111 \ 1
+       #__ssize_t_def\9aed
+
+
+       )
+
+114 #ifdef 
+__USE_BSD
+
+
+115 #iâdeà
+__daddr_t_def\9aed
+
+
+116 \e
+__daddr_t
+       tdaddr_t
+;
+
+117 \e
+__ÿddr_t
+       tÿddr_t
+;
+
+118 \ 1
+       #__daddr_t_def\9aed
+
+
+       )
+
+122 #ià(
+def\9aed
+__USE_SVID
+ || def\9aed 
+__USE_XOPEN
+è&& !def\9aed 
+__key_t_def\9aed
+
+
+123 \e
+__key_t
+       tkey_t
+;
+
+124 \ 1
+       #__key_t_def\9aed
+
+
+       )
+
+127 #ià
+def\9aed
+__USE_XOPEN
+ || def\9aed 
+__USE_XOPEN2K8
+
+
+128 \ 1
+       #__Ãed_þock_t
+
+
+       )
+
+130 \ 1
+       #__Ãed_time_t
+
+
+       )
+
+131 \ 1
+       #__Ãed_tim\94_t
+
+
+       )
+
+132 \ 1
+       #__Ãed_þockid_t
+
+
+       )
+
+133 \ 2
+       ~<time.h
+>
+
+135 #ifdeà
+__USE_XOPEN
+
+
+136 #iâdeà
+__u£cÚds_t_def\9aed
+
+
+137 \e
+__u£cÚds_t
+       tu£cÚds_t
+;
+
+138 \ 1
+       #__u£cÚds_t_def\9aed
+
+
+       )
+
+140 #iâdeà
+__su£cÚds_t_def\9aed
+
+
+141 \e
+__su£cÚds_t
+       tsu£cÚds_t
+;
+
+142 \ 1
+       #__su£cÚds_t_def\9aed
+
+
+       )
+
+146 \ 1
+       #__Ãed_size_t
+
+
+       )
+
+147 \ 2
+       ~<¡ddef.h
+>
+
+149 #ifdeà
+__USE_MISC
+
+
+151 \e\1d\13\12
+       tulÚg
+;
+
+152 \e\1d\16\12
+       tushÜt
+;
+
+153 \e\1d\12
+       tu\9at
+;
+
+158 #ià!
+__GNUC_PREREQ
+ (2, 7)
+
+161 #iâdeà
+__\9at8_t_def\9aed
+
+
+162 \ 1
+       #__\9at8_t_def\9aed
+
+
+       )
+
+163 \e\ 5
+       t\9at8_t
+;
+
+164 \e\16\12
+       t\9at16_t
+;
+
+165 \e\12
+       t\9at32_t
+;
+
+166 #ià
+__WORDSIZE
+ == 64
+
+167 \e\13\12
+       t\9at64_t
+;
+
+168 #\96
+__GLIBC_HAVE_LONG_LONG
+
+
+169 
+__ex\8bnsiÚ__
\e\13\13\12
+       t\9at64_t
+;
+
+174 \e\1d\ 5
+       tu_\9at8_t
+;
+
+175 \e\1d\16\12
+       tu_\9at16_t
+;
+
+176 \e\1d\12
+       tu_\9at32_t
+;
+
+177 #ià
+__WORDSIZE
+ == 64
+
+178 \e\1d\13\12
+       tu_\9at64_t
+;
+
+179 #\96
+__GLIBC_HAVE_LONG_LONG
+
+
+180 
+__ex\8bnsiÚ__
\e\1d\13\13\12
+       tu_\9at64_t
+;
+
+183 \e\12
+       t»gi¡\94_t
+;
+
+188 \ 1
+       #__\9atN_t
+(
+N
+, 
+MODE
+) \
+
+189 \e\12\12##
+       tN
+##
+       t_t
+       t__©\8cibu\8b__
+ ((
+       t__mode__
+ (
+       tMODE
+)))
+
+       )
+
+190 \ 1
+       t__u_\9atN_t
+(
+       tN
+, 
+       tMODE
+) \
+
+191 \e\1d\12
+       tu_\9at
+##
+       tN
+##
+       t_t
+       t__©\8cibu\8b__
+ ((
+       t__mode__
+ (
+       tMODE
+)))
+
+       )
+
+193 #iâdeà
+       t__\9at8_t_def\9aed
+
+
+194 \ 1
+       t__\9at8_t_def\9aed
+
+
+       )
+
+195 
+       t__\9atN_t
+ (8, 
+       t__QI__
+);
+
+196 
+__\9atN_t
+ (16, 
+__HI__
+);
+
+197 
+__\9atN_t
+ (32, 
+__SI__
+);
+
+198 
+__\9atN_t
+ (64, 
+__DI__
+);
+
+201 
+__u_\9atN_t
+ (8, 
+__QI__
+);
+
+202 
+__u_\9atN_t
+ (16, 
+__HI__
+);
+
+203 
+__u_\9atN_t
+ (32, 
+__SI__
+);
+
+204 
+__u_\9atN_t
+ (64, 
+__DI__
+);
+
+206 \e\12
+       t»gi¡\94_t
+       t__©\8cibu\8b__
+ ((
+       t__mode__
+ (
+       t__wÜd__
+)));
+
+212 \ 1
+       #__BIT_TYPES_DEFINED__
+ 1
+
+       )
+
+215 #ifdef 
+__USE_BSD
+
+
+217 \ 2
+       ~<\92d\9fn.h
+>
+
+220 \ 2
+       ~<sys/£Ëù.h
+>
+
+223 \ 2
+       ~<sys/sysmaüos.h
+>
+
+227 #ià(
+def\9aed
+__USE_UNIX98
+ || def\9aed 
+__USE_XOPEN2K8
+) \
+
+228 && !
+def\9aed
+__blksize_t_def\9aed
+
+
+229 \e
+__blksize_t
+       tblksize_t
+;
+
+230 \ 1
+       #__blksize_t_def\9aed
+
+
+       )
+
+234 #iâdeà
+__USE_FILE_OFFSET64
+
+
+235 #iâdeà
+__blkút_t_def\9aed
+
+
+236 \e
+__blkút_t
+       tblkút_t
+;
+
+237 \ 1
+       #__blkút_t_def\9aed
+
+
+       )
+
+239 #iâdeà
+__fsblkút_t_def\9aed
+
+
+240 \e
+__fsblkút_t
+       tfsblkút_t
+;
+
+241 \ 1
+       #__fsblkút_t_def\9aed
+
+
+       )
+
+243 #iâdeà
+__fsf\9eút_t_def\9aed
+
+
+244 \e
+__fsf\9eút_t
+       tfsf\9eút_t
+;
+
+245 \ 1
+       #__fsf\9eút_t_def\9aed
+
+
+       )
+
+248 #iâdeà
+__blkút_t_def\9aed
+
+
+249 \e
+__blkút64_t
+       tblkút_t
+;
+
+250 \ 1
+       #__blkút_t_def\9aed
+
+
+       )
+
+252 #iâdeà
+__fsblkút_t_def\9aed
+
+
+253 \e
+__fsblkút64_t
+       tfsblkút_t
+;
+
+254 \ 1
+       #__fsblkút_t_def\9aed
+
+
+       )
+
+256 #iâdeà
+__fsf\9eút_t_def\9aed
+
+
+257 \e
+__fsf\9eút64_t
+       tfsf\9eút_t
+;
+
+258 \ 1
+       #__fsf\9eút_t_def\9aed
+
+
+       )
+
+262 #ifdeà
+__USE_LARGEFILE64
+
+
+263 \e
+__blkút64_t
+       tblkút64_t
+;
+
+264 \e
+__fsblkút64_t
+       tfsblkút64_t
+;
+
+265 \e
+__fsf\9eút64_t
+       tfsf\9eút64_t
+;
+
+270 #ià
+def\9aed
+__USE_POSIX199506
+ || def\9aed 
+__USE_UNIX98
+
+
+271 \ 2
+       ~<b\99s/±h»adty³s.h
+>
+
+274 
+       g__END_DECLS
+
+
+       @/usr/include/sys/un.h
+
+19 #iâdef 
+_SYS_UN_H
+
+
+20 \ 1
+       #_SYS_UN_H
+ 1
+
+       )
+
+22 \ 2
+       ~<sys/cdefs.h
+>
+
+25 \ 2
+       ~<b\99s/sockaddr.h
+>
+
+27 
+__BEGIN_DECLS
+
+
+30 \19
+       ssockaddr_un
+
+
+32 
+__SOCKADDR_COMMON
+ (
+sun_
+);
+
+33 \ 5
+       msun_·th
+[108];
+
+37 #ifdeà
+__USE_MISC
+
+
+38 \ 2
+       ~<¡r\9ag.h
+>
+
+41 \ 1
+       #SUN_LEN
+(
+±r
+è((
+size_t
+è(((\19
+sockaddr_un
+ *è0)->
+sun_·th
+) \
+
+42 + 
+       `¡¾\92
+ ((
+±r
+)->
+sun_·th
+))
+
+       )
+
+45 
+       g__END_DECLS
+
+
+       @/usr/include/unistd.h
+
+23 #iâdef 
+_UNISTD_H
+
+
+24 \ 1
+       #_UNISTD_H
+ 1
+
+       )
+
+26 \ 2
+       ~<ã©u»s.h
+>
+
+28 
+       g__BEGIN_DECLS
+
+
+33 #ifdeà
+__USE_XOPEN2K8
+
+
+35 \ 1
+       #_POSIX_VERSION
+ 200809L
+
+       )
+
+36 #\96
+def\9aed
+__USE_XOPEN2K
+
+
+38 \ 1
+       #_POSIX_VERSION
+ 200112L
+
+       )
+
+39 #\96
+def\9aed
+__USE_POSIX199506
+
+
+41 \ 1
+       #_POSIX_VERSION
+ 199506L
+
+       )
+
+42 #\96
+def\9aed
+__USE_POSIX199309
+
+
+44 \ 1
+       #_POSIX_VERSION
+ 199309L
+
+       )
+
+47 \ 1
+       #_POSIX_VERSION
+ 199009L
+
+       )
+
+53 #ifdeà
+__USE_XOPEN2K8
+
+
+54 \ 1
+       #__POSIX2_THIS_VERSION
+ 200809L
+
+       )
+
+56 #\96
+def\9aed
+__USE_XOPEN2K
+
+
+58 \ 1
+       #__POSIX2_THIS_VERSION
+ 200112L
+
+       )
+
+59 #\96
+def\9aed
+__USE_POSIX199506
+
+
+61 \ 1
+       #__POSIX2_THIS_VERSION
+ 199506L
+
+       )
+
+64 \ 1
+       #__POSIX2_THIS_VERSION
+ 199209L
+
+       )
+
+68 \ 1
+       #_POSIX2_VERSION
+__POSIX2_THIS_VERSION
+
+
+       )
+
+72 \ 1
+       #_POSIX2_C_BIND
+__POSIX2_THIS_VERSION
+
+
+       )
+
+76 \ 1
+       #_POSIX2_C_DEV
+__POSIX2_THIS_VERSION
+
+
+       )
+
+80 \ 1
+       #_POSIX2_SW_DEV
+__POSIX2_THIS_VERSION
+
+
+       )
+
+84 \ 1
+       #_POSIX2_LOCALEDEF
+__POSIX2_THIS_VERSION
+
+
+       )
+
+87 #ifdeà
+__USE_XOPEN2K8
+
+
+88 \ 1
+       #_XOPEN_VERSION
+ 700
+
+       )
+
+89 #\96
+def\9aed
+__USE_XOPEN2K
+
+
+90 \ 1
+       #_XOPEN_VERSION
+ 600
+
+       )
+
+91 #\96
+def\9aed
+__USE_UNIX98
+
+
+92 \ 1
+       #_XOPEN_VERSION
+ 500
+
+       )
+
+94 \ 1
+       #_XOPEN_VERSION
+ 4
+
+       )
+
+98 \ 1
+       #_XOPEN_XCU_VERSION
+ 4
+
+       )
+
+101 \ 1
+       #_XOPEN_XPG2
+ 1
+
+       )
+
+102 \ 1
+       #_XOPEN_XPG3
+ 1
+
+       )
+
+103 \ 1
+       #_XOPEN_XPG4
+ 1
+
+       )
+
+106 \ 1
+       #_XOPEN_UNIX
+ 1
+
+       )
+
+109 \ 1
+       #_XOPEN_CRYPT
+ 1
+
+       )
+
+113 \ 1
+       #_XOPEN_ENH_I18N
+ 1
+
+       )
+
+116 \ 1
+       #_XOPEN_LEGACY
+ 1
+
+       )
+
+203 \ 2
+       ~<b\99s/posix_Ýt.h
+>
+
+206 #ià
+def\9aed
+__USE_UNIX98
+ || def\9aed 
+__USE_XOPEN2K
+
+
+207 \ 2
+       ~<b\99s/\92v\9cÚm\92ts.h
+>
+
+211 \ 1
+       #STDIN_FILENO
+ 0
+
+       )
+
+212 \ 1
+       #STDOUT_FILENO
+ 1
+
+       )
+
+213 \ 1
+       #STDERR_FILENO
+ 2
+
+       )
+
+218 \ 2
+       ~<b\99s/ty³s.h
+>
+
+220 #iâdef 
+__ssize_t_def\9aed
+
+
+221 \e
+__ssize_t
+       tssize_t
+;
+
+222 \ 1
+       #__ssize_t_def\9aed
+
+
+       )
+
+225 \ 1
+       #__Ãed_size_t
+
+
+       )
+
+226 \ 1
+       #__Ãed_NULL
+
+
+       )
+
+227 \ 2
+       ~<¡ddef.h
+>
+
+229 #ià
+def\9aed
+__USE_XOPEN
+ || def\9aed 
+__USE_XOPEN2K
+
+
+232 #iâdeà
+__gid_t_def\9aed
+
+
+233 \e
+__gid_t
+       tgid_t
+;
+
+234 \ 1
+       #__gid_t_def\9aed
+
+
+       )
+
+237 #iâdeà
+__uid_t_def\9aed
+
+
+238 \e
+__uid_t
+       tuid_t
+;
+
+239 \ 1
+       #__uid_t_def\9aed
+
+
+       )
+
+242 #iâdeà
+__off_t_def\9aed
+
+
+243 #iâdeà
+__USE_FILE_OFFSET64
+
+
+244 \e
+__off_t
+       toff_t
+;
+
+246 \e
+__off64_t
+       toff_t
+;
+
+248 \ 1
+       #__off_t_def\9aed
+
+
+       )
+
+250 #ià
+def\9aed
+__USE_LARGEFILE64
+ && !def\9aed 
+__off64_t_def\9aed
+
+
+251 \e
+__off64_t
+       toff64_t
+;
+
+252 \ 1
+       #__off64_t_def\9aed
+
+
+       )
+
+255 #iâdeà
+__u£cÚds_t_def\9aed
+
+
+256 \e
+__u£cÚds_t
+       tu£cÚds_t
+;
+
+257 \ 1
+       #__u£cÚds_t_def\9aed
+
+
+       )
+
+260 #iâdeà
+__pid_t_def\9aed
+
+
+261 \e
+__pid_t
+       tpid_t
+;
+
+262 \ 1
+       #__pid_t_def\9aed
+
+
+       )
+
+266 #ià
+def\9aed
+__USE_MISC
+ || def\9aed 
+__USE_XOPEN_EXTENDED
+ || def\9aed 
+__USE_XOPEN2K
+
+
+267 #iâdeà
+__\9a\8d\8c_t_def\9aed
+
+
+268 \e
+__\9a\8d\8c_t
+       t\9a\8d\8c_t
+;
+
+269 \ 1
+       #__\9a\8d\8c_t_def\9aed
+
+
+       )
+
+273 #ià
+def\9aed
+__USE_BSD
+ || def\9aed 
+__USE_XOPEN
+
+
+274 #iâdeà
+__sockËn_t_def\9aed
+
+
+275 \e
+__sockËn_t
+       tsockËn_t
+;
+
+276 \ 1
+       #__sockËn_t_def\9aed
+
+
+       )
+
+282 \ 1
+       #R_OK
+ 4
+
+       )
+
+283 \ 1
+       #W_OK
+ 2
+
+       )
+
+284 \ 1
+       #X_OK
+ 1
+
+       )
+
+285 \ 1
+       #F_OK
+ 0
+
+       )
+
+288 \r\12
+       $acûss
+ (
+__cڡ
\ 5*
+__Çme
+, \12
+__ty³
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+290 #ifdeà
+__USE_GNU
+
+
+293 \r\12
+       $euidacûss
+ (
+__cڡ
\ 5*
+__Çme
+, \12
+__ty³
+)
+
+294 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+297 \r\12
+       $\97cûss
+ (
+__cڡ
\ 5*
+__Çme
+, \12
+__ty³
+)
+
+298 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+301 #ifdeà
+__USE_ATFILE
+
+
+305 \r\12
+       $çcûs§t
+ (\12
+__fd
+, 
+__cڡ
\ 5*
+__f\9ee
+, \12
+__ty³
+, \12
+__æag
+)
+
+306 
+__THROW
+       `__nÚnuÎ
+ ((2)è
+__wur
+;
+
+311 #iâdef 
+_STDIO_H
+
+
+312 \ 1
+       #SEEK_SET
+ 0
+
+       )
+
+313 \ 1
+       #SEEK_CUR
+ 1
+
+       )
+
+314 \ 1
+       #SEEK_END
+ 2
+
+       )
+
+317 #ià
+def\9aed
+__USE_BSD
+ && !def\9aed 
+L_SET
+
+
+319 \ 1
+       #L_SET
+SEEK_SET
+
+
+       )
+
+320 \ 1
+       #L_INCR
+SEEK_CUR
+
+
+       )
+
+321 \ 1
+       #L_XTND
+SEEK_END
+
+
+       )
+
+330 #iâdeà
+__USE_FILE_OFFSET64
+
+
+331 \r
+__off_t
+       $l£ek
+ (\12
+__fd
+, 
+__off_t
+__off£t
+, \12
+__wh\92û
+__THROW
+;
+
+333 #ifdeà
+__REDIRECT_NTH
+
+
+334 \r
+__off64_t
+       `__REDIRECT_NTH
+ (
+l£ek
+,
+
+335 (\12
+__fd
+, 
+__off64_t
+__off£t
+, \12
+__wh\92û
+),
+
+336 
+l£ek64
+);
+
+338 \ 1
+       #l£ek
+l£ek64
+
+
+       )
+
+341 #ifdeà
+__USE_LARGEFILE64
+
+
+342 \r
+__off64_t
+       $l£ek64
+ (\12
+__fd
+, 
+__off64_t
+__off£t
+, \12
+__wh\92û
+)
+
+343 
+__THROW
+;
+
+350 \r\12
+       `þo£
+ (\12
+__fd
+);
+
+357 \r
+ssize_t
+       $»ad
+ (\12
+__fd
+, \1e*
+__buf
+, 
+size_t
+__nby\8bs
+__wur
+;
+
+363 \r
+ssize_t
+       $wr\99e
+ (\12
+__fd
+, 
+__cڡ
\1e*
+__buf
+, 
+size_t
+__n
+__wur
+;
+
+365 #ià
+def\9aed
+__USE_UNIX98
+ || def\9aed 
+__USE_XOPEN2K8
+
+
+366 #iâdeà
+__USE_FILE_OFFSET64
+
+
+373 \r
+ssize_t
+       $´\97d
+ (\12
+__fd
+, \1e*
+__buf
+, 
+size_t
+__nby\8bs
+,
+
+374 
+__off_t
+__off£t
+__wur
+;
+
+381 \r
+ssize_t
+       $pwr\99e
+ (\12
+__fd
+, 
+__cڡ
\1e*
+__buf
+, 
+size_t
+__n
+,
+
+382 
+__off_t
+__off£t
+__wur
+;
+
+384 #ifdeà
+__REDIRECT
+
+
+385 \r
+ssize_t
+       `__REDIRECT
+ (
\97d
+, (\12
+__fd
+, \1e*
+__buf
+, 
+size_t
+__nby\8bs
+,
+
+386 
+__off64_t
+__off£t
+),
+
+387 
\97d64
+__wur
+;
+
+388 \r
+ssize_t
+       `__REDIRECT
+ (
+pwr\99e
+, (\12
+__fd
+, 
+__cڡ
\1e*
+__buf
+,
+
+389 
+size_t
+__nby\8bs
+, 
+__off64_t
+__off£t
+),
+
+390 
+pwr\99e64
+__wur
+;
+
+392 \ 1
+       #´\97d
\97d64
+
+
+       )
+
+393 \ 1
+       #pwr\99e
+pwr\99e64
+
+
+       )
+
+397 #ifdeà
+__USE_LARGEFILE64
+
+
+401 \r
+ssize_t
+       $´\97d64
+ (\12
+__fd
+, \1e*
+__buf
+, 
+size_t
+__nby\8bs
+,
+
+402 
+__off64_t
+__off£t
+__wur
+;
+
+405 \r
+ssize_t
+       $pwr\99e64
+ (\12
+__fd
+, 
+__cڡ
\1e*
+__buf
+, 
+size_t
+__n
+,
+
+406 
+__off64_t
+__off£t
+__wur
+;
+
+414 \r\12
+       $p\9de
+ (\12
+__p\9dedes
+[2]è
+__THROW
+__wur
+;
+
+416 #ifdeà
+__USE_GNU
+
+
+419 \r\12
+       $p\9de2
+ (\12
+__p\9dedes
+[2], \12
+__æags
+__THROW
+__wur
+;
+
+429 \r\1d\12
+       $®¬m
+ (\1d\12
+__£cÚds
+__THROW
+;
+
+441 \r\1d\12
+       `¦\93p
+ (\1d\12
+__£cÚds
+);
+
+443 #ià(
+def\9aed
+__USE_XOPEN_EXTENDED
+ && !def\9aed 
+__USE_XOPEN2K8
+) \
+
+444 || 
+def\9aed
+__USE_BSD
+
+
+449 \r
+__u£cÚds_t
+       $u®¬m
+ (
+__u£cÚds_t
+__v®ue
+, __u£cÚds_\88
+__\9a\8brv®
+)
+
+450 
+__THROW
+;
+
+457 \r\12
+       `u¦\93p
+ (
+__u£cÚds_t
+__u£cÚds
+);
+
+466 \r\12
+       `·u£
+ (\1e);
+
+470 \r\12
+       $chown
+ (
+__cڡ
\ 5*
+__f\9ee
+, 
+__uid_t
+__owÃr
+, 
+__gid_t
+__group
+)
+
+471 
+__THROW
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+473 #ià
+def\9aed
+__USE_BSD
+ || def\9aed 
+__USE_XOPEN_EXTENDED
+ || def\9aed 
+__USE_XOPEN2K8
+
+
+475 \r\12
+       $fchown
+ (\12
+__fd
+, 
+__uid_t
+__owÃr
+, 
+__gid_t
+__group
+__THROW
+__wur
+;
+
+480 \r\12
+       $lchown
+ (
+__cڡ
\ 5*
+__f\9ee
+, 
+__uid_t
+__owÃr
+, 
+__gid_t
+__group
+)
+
+481 
+__THROW
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+485 #ifdeà
+__USE_ATFILE
+
+
+488 \r\12
+       $fchowÇt
+ (\12
+__fd
+, 
+__cڡ
\ 5*
+__f\9ee
+, 
+__uid_t
+__owÃr
+,
+
+489 
+__gid_t
+__group
+, \12
+__æag
+)
+
+490 
+__THROW
+       `__nÚnuÎ
+ ((2)è
+__wur
+;
+
+494 \r\12
+       $chd\9c
+ (
+__cڡ
\ 5*
+__·th
+__THROW
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+496 #ià
+def\9aed
+__USE_BSD
+ || def\9aed 
+__USE_XOPEN_EXTENDED
+ || def\9aed 
+__USE_XOPEN2K8
+
+
+498 \r\12
+       $fchd\9c
+ (\12
+__fd
+__THROW
+__wur
+;
+
+508 \r\ 5*
+       $g\91cwd
+ (\ 5*
+__buf
+, 
+size_t
+__size
+__THROW
+__wur
+;
+
+510 #ifdef 
+__USE_GNU
+
+
+514 \r\ 5*
+       $g\91_cu¼\92t_d\9c_Çme
+ (\1eè
+__THROW
+;
+
+517 #ià(
+def\9aed
+__USE_XOPEN_EXTENDED
+ && !def\9aed 
+__USE_XOPEN2K8
+) \
+
+518 || 
+def\9aed
+__USE_BSD
+
+
+522 \r\ 5*
+       $g\91wd
+ (\ 5*
+__buf
+)
+
+523 
+__THROW
+       `__nÚnuÎ
+ ((1)è
+__©\8cibu\8b_d\95»ÿ\8bd__
+__wur
+;
+
+528 \r\12
+       $dup
+ (\12
+__fd
+__THROW
+__wur
+;
+
+531 \r\12
+       $dup2
+ (\12
+__fd
+, \12
+__fd2
+__THROW
+;
+
+533 #ifdeà
+__USE_GNU
+
+
+536 \r\12
+       $dup3
+ (\12
+__fd
+, \12
+__fd2
+, \12
+__æags
+__THROW
+;
+
+540 \r\ 5**
+__\92v\9cÚ
+;
+
+541 #ifdeà
+__USE_GNU
+
+
+542 \r\ 5**
+\92v\9cÚ
+;
+
+548 \r\12
+       $execve
+ (
+__cڡ
\ 5*
+__·th
+, \ 5*__cڡ 
+__¬gv
+[],
+
+549 \ 5*
+__cڡ
+__\92vp
+[]è
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+551 #ifdeà
+__USE_XOPEN2K8
+
+
+554 \r\12
+       $ãxecve
+ (\12
+__fd
+, \ 5*
+__cڡ
+__¬gv
+[], \ 5*__cڡ 
+__\92vp
+[])
+
+555 
+__THROW
+       `__nÚnuÎ
+ ((2));
+
+560 \r\12
+       $execv
+ (
+__cڡ
\ 5*
+__·th
+, \ 5*__cڡ 
+__¬gv
+[])
+
+561 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+565 \r\12
+       $exeþe
+ (
+__cڡ
\ 5*
+__·th
+, __cڡ \ 5*
+__¬g
+, ...)
+
+566 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+570 \r\12
+       $exeþ
+ (
+__cڡ
\ 5*
+__·th
+, __cڡ \ 5*
+__¬g
+, ...)
+
+571 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+575 \r\12
+       $execvp
+ (
+__cڡ
\ 5*
+__f\9ee
+, \ 5*__cڡ 
+__¬gv
+[])
+
+576 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+581 \r\12
+       $exeþp
+ (
+__cڡ
\ 5*
+__f\9ee
+, __cڡ \ 5*
+__¬g
+, ...)
+
+582 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+584 #ifdeà
+__USE_GNU
+
+
+587 \r\12
+       $execv³
+ (
+__cڡ
\ 5*
+__f\9ee
+, \ 5*__cڡ 
+__¬gv
+[],
+
+588 \ 5*
+__cڡ
+__\92vp
+[])
+
+589 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+593 #ià
+def\9aed
+__USE_MISC
+ || def\9aed 
+__USE_XOPEN
+
+
+595 \r\12
+       $niû
+ (\12
+__\9ac
+__THROW
+__wur
+;
+
+600 \r\1e
+       $_ex\99
+ (\12
+__¡©us
+       `__©\8cibu\8b__
+ ((
+__nÜ\91uº__
+));
+
+606 \ 2
+       ~<b\99s/cÚâame.h
+>
+
+609 \r\13\12
+       $·thcÚf
+ (
+__cڡ
\ 5*
+__·th
+, \12
+__Çme
+)
+
+610 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+613 \r\13\12
+       $å©hcÚf
+ (\12
+__fd
+, \12
+__Çme
+__THROW
+;
+
+616 \r\13\12
+       $syscÚf
+ (\12
+__Çme
+__THROW
+;
+
+618 #ifdef 
+__USE_POSIX2
+
+
+620 \r
+size_t
+       $cÚf¡r
+ (\12
+__Çme
+, \ 5*
+__buf
+, 
+size_t
+__Ën
+__THROW
+;
+
+625 \r
+__pid_t
+       $g\91pid
+ (\1eè
+__THROW
+;
+
+628 \r
+__pid_t
+       $g\91µid
+ (\1eè
+__THROW
+;
+
+632 #iâdeà
+__FAVOR_BSD
+
+
+633 \r
+__pid_t
+       $g\91pg½
+ (\1eè
+__THROW
+;
+
+635 #ifdeà
+__REDIRECT_NTH
+
+
+636 \r
+__pid_t
+       `__REDIRECT_NTH
+ (
+g\91pg½
+, (__pid_\88
+__pid
+), 
+__g\91pgid
+);
+
+638 \ 1
+       #g\91pg½
+__g\91pgid
+
+
+       )
+
+643 \r
+__pid_t
+       $__g\91pgid
+ (
+__pid_t
+__pid
+__THROW
+;
+
+644 #ià
+def\9aed
+__USE_XOPEN_EXTENDED
+ || def\9aed 
+__USE_XOPEN2K8
+
+
+645 \r
+__pid_t
+       $g\91pgid
+ (
+__pid_t
+__pid
+__THROW
+;
+
+652 \r\12
+       $£\8dgid
+ (
+__pid_t
+__pid
+, __pid_\88
+__pgid
+__THROW
+;
+
+654 #ià
+def\9aed
+__USE_SVID
+ || def\9aed 
+__USE_BSD
+ || def\9aed 
+__USE_XOPEN_EXTENDED
+
+
+665 #iâdeà
+__FAVOR_BSD
+
+
+669 \r\12
+       $£\8d
+ (\1eè
+__THROW
+;
+
+674 #ifdeà
+__REDIRECT_NTH
+
+
+675 \r\12
+       `__REDIRECT_NTH
+ (
\8d
+, (
+__pid_t
+__pid
+, __pid_\88
+__pg½
+), 
\8dgid
+);
+
+677 \ 1
+       #£\8d
\8dgid
+
+
+       )
+
+686 \r
+__pid_t
+       $£tsid
+ (\1eè
+__THROW
+;
+
+688 #ià
+def\9aed
+__USE_XOPEN_EXTENDED
+ || def\9aed 
+__USE_XOPEN2K8
+
+
+690 \r
+__pid_t
+       $g\91sid
+ (
+__pid_t
+__pid
+__THROW
+;
+
+694 \r
+__uid_t
+       $g\91uid
+ (\1eè
+__THROW
+;
+
+697 \r
+__uid_t
+       $g\91euid
+ (\1eè
+__THROW
+;
+
+700 \r
+__gid_t
+       $g\91gid
+ (\1eè
+__THROW
+;
+
+703 \r
+__gid_t
+       $g\91egid
+ (\1eè
+__THROW
+;
+
+708 \r\12
+       $g\91groups
+ (\12
+__size
+, 
+__gid_t
+__li¡
+[]è
+__THROW
+__wur
+;
+
+710 #ifdef 
+__USE_GNU
+
+
+712 \r\12
+       $group_memb\94
+ (
+__gid_t
+__gid
+__THROW
+;
+
+719 \r\12
+       $£tuid
+ (
+__uid_t
+__uid
+__THROW
+;
+
+721 #ià
+def\9aed
+__USE_BSD
+ || def\9aed 
+__USE_XOPEN_EXTENDED
+
+
+724 \r\12
+       $£\8ceuid
+ (
+__uid_t
+__ruid
+, __uid_\88
+__euid
+__THROW
+;
+
+727 #ià
+def\9aed
+__USE_BSD
+ || def\9aed 
+__USE_XOPEN2K
+
+
+729 \r\12
+       $£\8buid
+ (
+__uid_t
+__uid
+__THROW
+;
+
+736 \r\12
+       $£tgid
+ (
+__gid_t
+__gid
+__THROW
+;
+
+738 #ià
+def\9aed
+__USE_BSD
+ || def\9aed 
+__USE_XOPEN_EXTENDED
+
+
+741 \r\12
+       $£\8cegid
+ (
+__gid_t
+__rgid
+, __gid_\88
+__egid
+__THROW
+;
+
+744 #ià
+def\9aed
+__USE_BSD
+ || def\9aed 
+__USE_XOPEN2K
+
+
+746 \r\12
+       $£\8bgid
+ (
+__gid_t
+__gid
+__THROW
+;
+
+749 #ifdeà
+__USE_GNU
+
+
+752 \r\12
+       $g\91»suid
+ (
+__uid_t
+ *
+__ruid
+, __uid_\88*
+__euid
+, __uid_\88*
+__suid
+)
+
+753 
+__THROW
+;
+
+757 \r\12
+       $g\91»sgid
+ (
+__gid_t
+ *
+__rgid
+, __gid_\88*
+__egid
+, __gid_\88*
+__sgid
+)
+
+758 
+__THROW
+;
+
+762 \r\12
+       $£\8cesuid
+ (
+__uid_t
+__ruid
+, __uid_\88
+__euid
+, __uid_\88
+__suid
+)
+
+763 
+__THROW
+;
+
+767 \r\12
+       $£\8cesgid
+ (
+__gid_t
+__rgid
+, __gid_\88
+__egid
+, __gid_\88
+__sgid
+)
+
+768 
+__THROW
+;
+
+775 \r
+__pid_t
+       $fÜk
+ (\1eè
+__THROW
+;
+
+777 #ià(
+def\9aed
+__USE_XOPEN_EXTENDED
+ && !def\9aed 
+__USE_XOPEN2K8
+) \
+
+778 || 
+def\9aed
+__USE_BSD
+
+
+783 \r
+__pid_t
+       $vfÜk
+ (\1eè
+__THROW
+;
+
+789 \r\ 5*
+       $\89yÇme
+ (\12
+__fd
+__THROW
+;
+
+793 \r\12
+       $\89yÇme_r
+ (\12
+__fd
+, \ 5*
+__buf
+, 
+size_t
+__buæ\92
+)
+
+794 
+__THROW
+       `__nÚnuÎ
+ ((2)è
+__wur
+;
+
+798 \r\12
+       $i§\89y
+ (\12
+__fd
+__THROW
+;
+
+800 #ià
+def\9aed
+__USE_BSD
+ \
+
+801 || (
+def\9aed
+__USE_XOPEN_EXTENDED
+ && !def\9aed 
+__USE_UNIX98
+)
+
+804 \r\12
+       $\89y¦Ù
+ (\1eè
+__THROW
+;
+
+809 \r\12
+       $l\9ak
+ (
+__cڡ
\ 5*
+__äom
+, __cڡ \ 5*
+__to
+)
+
+810 
+__THROW
+       `__nÚnuÎ
+ ((1, 2)è
+__wur
+;
+
+812 #ifdeà
+__USE_ATFILE
+
+
+815 \r\12
+       $l\9a
+ (\12
+__äomfd
+, 
+__cڡ
\ 5*
+__äom
+, \12
+__tofd
+,
+
+816 
+__cڡ
\ 5*
+__to
+, \12
+__æags
+)
+
+817 
+__THROW
+       `__nÚnuÎ
+ ((2, 4)è
+__wur
+;
+
+820 #ià
+def\9aed
+__USE_BSD
+ || def\9aed 
+__USE_XOPEN_EXTENDED
+ || def\9aed 
+__USE_XOPEN2K
+
+
+822 \r\12
+       $syml\9ak
+ (
+__cڡ
\ 5*
+__äom
+, __cڡ \ 5*
+__to
+)
+
+823 
+__THROW
+       `__nÚnuÎ
+ ((1, 2)è
+__wur
+;
+
+828 \r
+ssize_t
+       $»adl\9ak
+ (
+__cڡ
\ 5*
+__»¡riù
+__·th
+,
+
+829 \ 5*
+__»¡riù
+__buf
+, 
+size_t
+__Ën
+)
+
+830 
+__THROW
+       `__nÚnuÎ
+ ((1, 2)è
+__wur
+;
+
+833 #ifdeà
+__USE_ATFILE
+
+
+835 \r\12
+       $syml\9a
+ (
+__cڡ
\ 5*
+__äom
+, \12
+__tofd
+,
+
+836 
+__cڡ
\ 5*
+__to
+__THROW
+       `__nÚnuÎ
+ ((1, 3)è
+__wur
+;
+
+839 \r
+ssize_t
+       $»adl\9a
+ (\12
+__fd
+, 
+__cڡ
\ 5*
+__»¡riù
+__·th
+,
+
+840 \ 5*
+__»¡riù
+__buf
+, 
+size_t
+__Ën
+)
+
+841 
+__THROW
+       `__nÚnuÎ
+ ((2, 3)è
+__wur
+;
+
+845 \r\12
+       $uƚk
+ (
+__cڡ
\ 5*
+__Çme
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+847 #ifdeà
+__USE_ATFILE
+
+
+849 \r\12
+       $uÆ\9a
+ (\12
+__fd
+, 
+__cڡ
\ 5*
+__Çme
+, \12
+__æag
+)
+
+850 
+__THROW
+       `__nÚnuÎ
+ ((2));
+
+854 \r\12
+       $rmd\9c
+ (
+__cڡ
\ 5*
+__·th
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+858 \r
+__pid_t
+       $tcg\91pg½
+ (\12
+__fd
+__THROW
+;
+
+861 \r\12
+       $tc£\8d
+ (\12
+__fd
+, 
+__pid_t
+__pg½_id
+__THROW
+;
+
+868 \r\ 5*
+       `g\91log\9a
+ (\1e);
+
+869 #ià
+def\9aed
+__USE_REENTRANT
+ || def\9aed 
+__USE_POSIX199506
+
+
+876 \r\12
+       $g\91log\9a_r
+ (\ 5*
+__Çme
+, 
+size_t
+__Çme_Ën
+       `__nÚnuÎ
+ ((1));
+
+879 #ifdef 
+__USE_BSD
+
+
+881 \r\12
+       $£\8eog\9a
+ (
+__cڡ
\ 5*
+__Çme
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+885 #ifdef 
+__USE_POSIX2
+
+
+889 \ 1
+       #__Ãed_g\91Ýt
+
+
+       )
+
+890 \ 2
+       ~<g\91Ýt.h
+>
+
+894 #ià
+def\9aed
+__USE_BSD
+ || def\9aed 
+__USE_UNIX98
+ || def\9aed 
+__USE_XOPEN2K
+
+
+898 \r\12
+       $g\91ho¡Çme
+ (\ 5*
+__Çme
+, 
+size_t
+__Ën
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+902 #ià
+def\9aed
+__USE_BSD
+ || (def\9aed 
+__USE_XOPEN
+ && !def\9aed 
+__USE_UNIX98
+)
+
+905 \r\12
+       $£tho¡Çme
+ (
+__cڡ
\ 5*
+__Çme
+, 
+size_t
+__Ën
+)
+
+906 
+__THROW
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+910 \r\12
+       $£tho¡id
+ (\13\12
+__id
+__THROW
+__wur
+;
+
+916 \r\12
+       $g\91doma\9aÇme
+ (\ 5*
+__Çme
+, 
+size_t
+__Ën
+)
+
+917 
+__THROW
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+918 \r\12
+       $£tdoma\9aÇme
+ (
+__cڡ
\ 5*
+__Çme
+, 
+size_t
+__Ën
+)
+
+919 
+__THROW
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+925 \r\12
+       $vhªgup
+ (\1eè
+__THROW
+;
+
+928 \r\12
+       $»voke
+ (
+__cڡ
\ 5*
+__f\9ee
+__THROW
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+936 \r\12
+       $´of\9e
+ (\1d\16\12*
+__§m¶e_bufãr
+, 
+size_t
+__size
+,
+
+937 
+size_t
+__off£t
+, \1d\12
+__sÿË
+)
+
+938 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+944 \r\12
+       $acù
+ (
+__cڡ
\ 5*
+__Çme
+__THROW
+;
+
+948 \r\ 5*
+       $g\91u£rsh\96l
+ (\1eè
+__THROW
+;
+
+949 \r\1e
+       $\92du£rsh\96l
+ (\1eè
+__THROW
+;
+
+950 \r\1e
+       $£tu£rsh\96l
+ (\1eè
+__THROW
+;
+
+956 \r\12
+       $d«mÚ
+ (\12
+__nochd\9c
+, \12
+__noþo£
+__THROW
+__wur
+;
+
+960 #ià
+def\9aed
+__USE_BSD
+ || (def\9aed 
+__USE_XOPEN
+ && !def\9aed 
+__USE_XOPEN2K
+)
+
+963 \r\12
+       $chroÙ
+ (
+__cڡ
\ 5*
+__·th
+__THROW
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+967 \r\ 5*
+       $g\91·ss
+ (
+__cڡ
\ 5*
+__´om±
+       `__nÚnuÎ
+ ((1));
+
+971 #ià
+def\9aed
+__USE_BSD
+ || def\9aed 
+__USE_XOPEN
+ || def\9aed 
+__USE_XOPEN2K
+
+
+976 \r\12
+       `fsync
+ (\12
+__fd
+);
+
+980 #ià
+def\9aed
+__USE_BSD
+ || def\9aed 
+__USE_XOPEN_EXTENDED
+
+
+983 \r\13\12
+       `g\91ho¡id
+ (\1e);
+
+986 \r\1e
+       $sync
+ (\1eè
+__THROW
+;
+
+989 #ià
+def\9aed
+__USE_BSD
+ || !def\9aed 
+__USE_XOPEN2K
+
+
+992 \r\12
+       $g\91·gesize
+ (\1eè
+__THROW
+       `__©\8cibu\8b__
+ ((
+__cڡ__
+));
+
+997 \r\12
+       $g\91d\8fbËsize
+ (\1eè
+__THROW
+;
+
+1003 #ià
+def\9aed
+__USE_BSD
+ || def\9aed 
+__USE_XOPEN_EXTENDED
+ || def\9aed 
+__USE_XOPEN2K8
+
+
+1006 #iâdeà
+__USE_FILE_OFFSET64
+
+
+1007 \r\12
+       $\8cunÿ\8b
+ (
+__cڡ
\ 5*
+__f\9ee
+, 
+__off_t
+__Ëngth
+)
+
+1008 
+__THROW
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+1010 #ifdeà
+__REDIRECT_NTH
+
+
+1011 \r\12
+       `__REDIRECT_NTH
+ (
+\8cunÿ\8b
+,
+
+1012 (
+__cڡ
\ 5*
+__f\9ee
+, 
+__off64_t
+__Ëngth
+),
+
+1013 
+\8cunÿ\8b64
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+1015 \ 1
+       #\8cunÿ\8b
+\8cunÿ\8b64
+
+
+       )
+
+1018 #ifdeà
+__USE_LARGEFILE64
+
+
+1019 \r\12
+       $\8cunÿ\8b64
+ (
+__cڡ
\ 5*
+__f\9ee
+, 
+__off64_t
+__Ëngth
+)
+
+1020 
+__THROW
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+1025 #ià
+def\9aed
+__USE_BSD
+ || def\9aed 
+__USE_XOPEN_EXTENDED
+ || def\9aed 
+__USE_XOPEN2K
+
+
+1028 #iâdeà
+__USE_FILE_OFFSET64
+
+
+1029 \r\12
+       $árunÿ\8b
+ (\12
+__fd
+, 
+__off_t
+__Ëngth
+__THROW
+__wur
+;
+
+1031 #ifdeà
+__REDIRECT_NTH
+
+
+1032 \r\12
+       `__REDIRECT_NTH
+ (
+árunÿ\8b
+, (\12
+__fd
+, 
+__off64_t
+__Ëngth
+),
+
+1033 
+árunÿ\8b64
+__wur
+;
+
+1035 \ 1
+       #árunÿ\8b
+árunÿ\8b64
+
+
+       )
+
+1038 #ifdeà
+__USE_LARGEFILE64
+
+
+1039 \r\12
+       $árunÿ\8b64
+ (\12
+__fd
+, 
+__off64_t
+__Ëngth
+__THROW
+__wur
+;
+
+1045 #ià(
+def\9aed
+__USE_XOPEN_EXTENDED
+ && !def\9aed 
+__USE_XOPEN2K
+) \
+
+1046 || 
+def\9aed
+__USE_MISC
+
+
+1050 \r\12
+       $brk
+ (\1e*
+__addr
+__THROW
+__wur
+;
+
+1056 \r\1e*
+       $sbrk
+ (
+\9a\8d\8c_t
+__d\96\8f
+__THROW
+;
+
+1060 #ifdeà
+__USE_MISC
+
+
+1071 \r\13\12
+       $sysÿÎ
+ (\13\12
+__sy¢o
+, ...è
+__THROW
+;
+
+1076 #ià(
+def\9aed
+__USE_MISC
+ || def\9aed 
+__USE_XOPEN_EXTENDED
+è&& !def\9aed 
+F_LOCK
+
+
+1088 \ 1
+       #F_ULOCK
+ 0
+
+       )
+
+1089 \ 1
+       #F_LOCK
+ 1
+
+       )
+
+1090 \ 1
+       #F_TLOCK
+ 2
+
+       )
+
+1091 \ 1
+       #F_TEST
+ 3
+
+       )
+
+1093 #iâdeà
+__USE_FILE_OFFSET64
+
+
+1094 \r\12
+       $lockf
+ (\12
+__fd
+, \12
+__cmd
+, 
+__off_t
+__Ën
+__wur
+;
+
+1096 #ifdeà
+__REDIRECT
+
+
+1097 \r\12
+       `__REDIRECT
+ (
+lockf
+, (\12
+__fd
+, \12
+__cmd
+, 
+__off64_t
+__Ën
+),
+
+1098 
+lockf64
+__wur
+;
+
+1100 \ 1
+       #lockf
+lockf64
+
+
+       )
+
+1103 #ifdeà
+__USE_LARGEFILE64
+
+
+1104 \r\12
+       $lockf64
+ (\12
+__fd
+, \12
+__cmd
+, 
+__off64_t
+__Ën
+__wur
+;
+
+1109 #ifdeà
+__USE_GNU
+
+
+1114 \ 1
+       #TEMP_FAILURE_RETRY
+(
+ex´essiÚ
+) \
+
+1115 (
+__ex\8bnsiÚ__
+ \
+
+1116 ({ \13\12
+__»suÉ
+; \
+
+1117 dØ
+__»suÉ
+ = (\13\12è(
+ex´essiÚ
+); \
+
+1118 \1f
+__»suÉ
+ =ð-1L && 
+\94ºo
+ =ð
+EINTR
+); \
+
+1119 
+__»suÉ
+; 
+       }
+}))
+
+       )
+
+1122 #ià
+def\9aed
+__USE_POSIX199309
+ || def\9aed 
+__USE_UNIX98
+
+
+1125 \r\12
+fd©async
+ (\12
+__f\9edes
+);
+
+1131 #ifdef 
+__USE_XOPEN
+
+
+1133 \r\ 5*
+       $üy±
+ (
+__cڡ
\ 5*
+__key
+, __cڡ \ 5*
+__§É
+)
+
+1134 
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+1138 \r\1e
+       $\92üy±
+ (\ 5*
+__libc_block
+, \12
+__edæag
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+1145 \r\1e
+       $swab
+ (
+__cڡ
\1e*
+__»¡riù
+__äom
+, \1e*__»¡riù 
+__to
+,
+
+1146 
+ssize_t
+__n
+__THROW
+       `__nÚnuÎ
+ ((1, 2));
+
+1152 #ià
+def\9aed
+__USE_XOPEN
+ || def\9aed 
+__USE_XOPEN2K8
+
+
+1154 \r\ 5*
+       $ù\94mid
+ (\ 5*
+__s
+__THROW
+;
+
+1159 #ià
+__USE_FORTIFY_LEVEL
+ > 0 && 
+def\9aed
+__ex\8bº_®ways_\9al\9ae
+
+
+1160 \ 2
+       ~<b\99s/uni¡d.h
+>
+
+1163 
+__END_DECLS
+
+
+       @/usr/include/alloca.h
+
+19 #iâdef 
+_ALLOCA_H
+
+
+20 \ 1
+       #_ALLOCA_H
+ 1
+
+       )
+
+22 \ 2
+       ~<ã©u»s.h
+>
+
+24 \ 1
+       #__Ãed_size_t
+
+
+       )
+
+25 \ 2
+       ~<¡ddef.h
+>
+
+27 
+       g__BEGIN_DECLS
+
+
+30 #undeà
+®loÿ
+
+
+33 \r\1e*
+       $®loÿ
+ (
+size_t
+__size
+__THROW
+;
+
+35 #ifdef 
+__GNUC__
+
+
+36 \ 1
+       #®loÿ
+(
+size
+       `__bu\9et\9a_®loÿ
+ (size)
+
+       )
+
+39 
+__END_DECLS
+
+
+       @/usr/include/bits/confname.h
+
+21 #iâdeà
+_UNISTD_H
+
+
+28 
+       m_PC_LINK_MAX
+,
+
+29 \ 1
+       #_PC_LINK_MAX
+_PC_LINK_MAX
+
+
+       )
+
+30 
+       m_PC_MAX_CANON
+,
+
+31 \ 1
+       #_PC_MAX_CANON
+_PC_MAX_CANON
+
+
+       )
+
+32 
+       m_PC_MAX_INPUT
+,
+
+33 \ 1
+       #_PC_MAX_INPUT
+_PC_MAX_INPUT
+
+
+       )
+
+34 
+       m_PC_NAME_MAX
+,
+
+35 \ 1
+       #_PC_NAME_MAX
+_PC_NAME_MAX
+
+
+       )
+
+36 
+       m_PC_PATH_MAX
+,
+
+37 \ 1
+       #_PC_PATH_MAX
+_PC_PATH_MAX
+
+
+       )
+
+38 
+       m_PC_PIPE_BUF
+,
+
+39 \ 1
+       #_PC_PIPE_BUF
+_PC_PIPE_BUF
+
+
+       )
+
+40 
+       m_PC_CHOWN_RESTRICTED
+,
+
+41 \ 1
+       #_PC_CHOWN_RESTRICTED
+_PC_CHOWN_RESTRICTED
+
+
+       )
+
+42 
+       m_PC_NO_TRUNC
+,
+
+43 \ 1
+       #_PC_NO_TRUNC
+_PC_NO_TRUNC
+
+
+       )
+
+44 
+       m_PC_VDISABLE
+,
+
+45 \ 1
+       #_PC_VDISABLE
+_PC_VDISABLE
+
+
+       )
+
+46 
+       m_PC_SYNC_IO
+,
+
+47 \ 1
+       #_PC_SYNC_IO
+_PC_SYNC_IO
+
+
+       )
+
+48 
+       m_PC_ASYNC_IO
+,
+
+49 \ 1
+       #_PC_ASYNC_IO
+_PC_ASYNC_IO
+
+
+       )
+
+50 
+       m_PC_PRIO_IO
+,
+
+51 \ 1
+       #_PC_PRIO_IO
+_PC_PRIO_IO
+
+
+       )
+
+52 
+       m_PC_SOCK_MAXBUF
+,
+
+53 \ 1
+       #_PC_SOCK_MAXBUF
+_PC_SOCK_MAXBUF
+
+
+       )
+
+54 
+       m_PC_FILESIZEBITS
+,
+
+55 \ 1
+       #_PC_FILESIZEBITS
+_PC_FILESIZEBITS
+
+
+       )
+
+56 
+       m_PC_REC_INCR_XFER_SIZE
+,
+
+57 \ 1
+       #_PC_REC_INCR_XFER_SIZE
+_PC_REC_INCR_XFER_SIZE
+
+
+       )
+
+58 
+       m_PC_REC_MAX_XFER_SIZE
+,
+
+59 \ 1
+       #_PC_REC_MAX_XFER_SIZE
+_PC_REC_MAX_XFER_SIZE
+
+
+       )
+
+60 
+       m_PC_REC_MIN_XFER_SIZE
+,
+
+61 \ 1
+       #_PC_REC_MIN_XFER_SIZE
+_PC_REC_MIN_XFER_SIZE
+
+
+       )
+
+62 
+       m_PC_REC_XFER_ALIGN
+,
+
+63 \ 1
+       #_PC_REC_XFER_ALIGN
+_PC_REC_XFER_ALIGN
+
+
+       )
+
+64 
+       m_PC_ALLOC_SIZE_MIN
+,
+
+65 \ 1
+       #_PC_ALLOC_SIZE_MIN
+_PC_ALLOC_SIZE_MIN
+
+
+       )
+
+66 
+       m_PC_SYMLINK_MAX
+,
+
+67 \ 1
+       #_PC_SYMLINK_MAX
+_PC_SYMLINK_MAX
+
+
+       )
+
+68 
+       m_PC_2_SYMLINKS
+
+
+69 \ 1
+       #_PC_2_SYMLINKS
+_PC_2_SYMLINKS
+
+
+       )
+
+75 
+       m_SC_ARG_MAX
+,
+
+76 \ 1
+       #_SC_ARG_MAX
+_SC_ARG_MAX
+
+
+       )
+
+77 
+       m_SC_CHILD_MAX
+,
+
+78 \ 1
+       #_SC_CHILD_MAX
+_SC_CHILD_MAX
+
+
+       )
+
+79 
+       m_SC_CLK_TCK
+,
+
+80 \ 1
+       #_SC_CLK_TCK
+_SC_CLK_TCK
+
+
+       )
+
+81 
+       m_SC_NGROUPS_MAX
+,
+
+82 \ 1
+       #_SC_NGROUPS_MAX
+_SC_NGROUPS_MAX
+
+
+       )
+
+83 
+       m_SC_OPEN_MAX
+,
+
+84 \ 1
+       #_SC_OPEN_MAX
+_SC_OPEN_MAX
+
+
+       )
+
+85 
+       m_SC_STREAM_MAX
+,
+
+86 \ 1
+       #_SC_STREAM_MAX
+_SC_STREAM_MAX
+
+
+       )
+
+87 
+       m_SC_TZNAME_MAX
+,
+
+88 \ 1
+       #_SC_TZNAME_MAX
+_SC_TZNAME_MAX
+
+
+       )
+
+89 
+       m_SC_JOB_CONTROL
+,
+
+90 \ 1
+       #_SC_JOB_CONTROL
+_SC_JOB_CONTROL
+
+
+       )
+
+91 
+       m_SC_SAVED_IDS
+,
+
+92 \ 1
+       #_SC_SAVED_IDS
+_SC_SAVED_IDS
+
+
+       )
+
+93 
+       m_SC_REALTIME_SIGNALS
+,
+
+94 \ 1
+       #_SC_REALTIME_SIGNALS
+_SC_REALTIME_SIGNALS
+
+
+       )
+
+95 
+       m_SC_PRIORITY_SCHEDULING
+,
+
+96 \ 1
+       #_SC_PRIORITY_SCHEDULING
+_SC_PRIORITY_SCHEDULING
+
+
+       )
+
+97 
+       m_SC_TIMERS
+,
+
+98 \ 1
+       #_SC_TIMERS
+_SC_TIMERS
+
+
+       )
+
+99 
+       m_SC_ASYNCHRONOUS_IO
+,
+
+100 \ 1
+       #_SC_ASYNCHRONOUS_IO
+_SC_ASYNCHRONOUS_IO
+
+
+       )
+
+101 
+       m_SC_PRIORITIZED_IO
+,
+
+102 \ 1
+       #_SC_PRIORITIZED_IO
+_SC_PRIORITIZED_IO
+
+
+       )
+
+103 
+       m_SC_SYNCHRONIZED_IO
+,
+
+104 \ 1
+       #_SC_SYNCHRONIZED_IO
+_SC_SYNCHRONIZED_IO
+
+
+       )
+
+105 
+       m_SC_FSYNC
+,
+
+106 \ 1
+       #_SC_FSYNC
+_SC_FSYNC
+
+
+       )
+
+107 
+       m_SC_MAPPED_FILES
+,
+
+108 \ 1
+       #_SC_MAPPED_FILES
+_SC_MAPPED_FILES
+
+
+       )
+
+109 
+       m_SC_MEMLOCK
+,
+
+110 \ 1
+       #_SC_MEMLOCK
+_SC_MEMLOCK
+
+
+       )
+
+111 
+       m_SC_MEMLOCK_RANGE
+,
+
+112 \ 1
+       #_SC_MEMLOCK_RANGE
+_SC_MEMLOCK_RANGE
+
+
+       )
+
+113 
+       m_SC_MEMORY_PROTECTION
+,
+
+114 \ 1
+       #_SC_MEMORY_PROTECTION
+_SC_MEMORY_PROTECTION
+
+
+       )
+
+115 
+       m_SC_MESSAGE_PASSING
+,
+
+116 \ 1
+       #_SC_MESSAGE_PASSING
+_SC_MESSAGE_PASSING
+
+
+       )
+
+117 
+       m_SC_SEMAPHORES
+,
+
+118 \ 1
+       #_SC_SEMAPHORES
+_SC_SEMAPHORES
+
+
+       )
+
+119 
+       m_SC_SHARED_MEMORY_OBJECTS
+,
+
+120 \ 1
+       #_SC_SHARED_MEMORY_OBJECTS
+_SC_SHARED_MEMORY_OBJECTS
+
+
+       )
+
+121 
+       m_SC_AIO_LISTIO_MAX
+,
+
+122 \ 1
+       #_SC_AIO_LISTIO_MAX
+_SC_AIO_LISTIO_MAX
+
+
+       )
+
+123 
+       m_SC_AIO_MAX
+,
+
+124 \ 1
+       #_SC_AIO_MAX
+_SC_AIO_MAX
+
+
+       )
+
+125 
+       m_SC_AIO_PRIO_DELTA_MAX
+,
+
+126 \ 1
+       #_SC_AIO_PRIO_DELTA_MAX
+_SC_AIO_PRIO_DELTA_MAX
+
+
+       )
+
+127 
+       m_SC_DELAYTIMER_MAX
+,
+
+128 \ 1
+       #_SC_DELAYTIMER_MAX
+_SC_DELAYTIMER_MAX
+
+
+       )
+
+129 
+       m_SC_MQ_OPEN_MAX
+,
+
+130 \ 1
+       #_SC_MQ_OPEN_MAX
+_SC_MQ_OPEN_MAX
+
+
+       )
+
+131 
+       m_SC_MQ_PRIO_MAX
+,
+
+132 \ 1
+       #_SC_MQ_PRIO_MAX
+_SC_MQ_PRIO_MAX
+
+
+       )
+
+133 
+       m_SC_VERSION
+,
+
+134 \ 1
+       #_SC_VERSION
+_SC_VERSION
+
+
+       )
+
+135 
+       m_SC_PAGESIZE
+,
+
+136 \ 1
+       #_SC_PAGESIZE
+_SC_PAGESIZE
+
+
+       )
+
+137 \ 1
+       #_SC_PAGE_SIZE
+_SC_PAGESIZE
+
+
+       )
+
+138 
+       m_SC_RTSIG_MAX
+,
+
+139 \ 1
+       #_SC_RTSIG_MAX
+_SC_RTSIG_MAX
+
+
+       )
+
+140 
+       m_SC_SEM_NSEMS_MAX
+,
+
+141 \ 1
+       #_SC_SEM_NSEMS_MAX
+_SC_SEM_NSEMS_MAX
+
+
+       )
+
+142 
+       m_SC_SEM_VALUE_MAX
+,
+
+143 \ 1
+       #_SC_SEM_VALUE_MAX
+_SC_SEM_VALUE_MAX
+
+
+       )
+
+144 
+       m_SC_SIGQUEUE_MAX
+,
+
+145 \ 1
+       #_SC_SIGQUEUE_MAX
+_SC_SIGQUEUE_MAX
+
+
+       )
+
+146 
+       m_SC_TIMER_MAX
+,
+
+147 \ 1
+       #_SC_TIMER_MAX
+_SC_TIMER_MAX
+
+
+       )
+
+151 
+       m_SC_BC_BASE_MAX
+,
+
+152 \ 1
+       #_SC_BC_BASE_MAX
+_SC_BC_BASE_MAX
+
+
+       )
+
+153 
+       m_SC_BC_DIM_MAX
+,
+
+154 \ 1
+       #_SC_BC_DIM_MAX
+_SC_BC_DIM_MAX
+
+
+       )
+
+155 
+       m_SC_BC_SCALE_MAX
+,
+
+156 \ 1
+       #_SC_BC_SCALE_MAX
+_SC_BC_SCALE_MAX
+
+
+       )
+
+157 
+       m_SC_BC_STRING_MAX
+,
+
+158 \ 1
+       #_SC_BC_STRING_MAX
+_SC_BC_STRING_MAX
+
+
+       )
+
+159 
+       m_SC_COLL_WEIGHTS_MAX
+,
+
+160 \ 1
+       #_SC_COLL_WEIGHTS_MAX
+_SC_COLL_WEIGHTS_MAX
+
+
+       )
+
+161 
+       m_SC_EQUIV_CLASS_MAX
+,
+
+162 \ 1
+       #_SC_EQUIV_CLASS_MAX
+_SC_EQUIV_CLASS_MAX
+
+
+       )
+
+163 
+       m_SC_EXPR_NEST_MAX
+,
+
+164 \ 1
+       #_SC_EXPR_NEST_MAX
+_SC_EXPR_NEST_MAX
+
+
+       )
+
+165 
+       m_SC_LINE_MAX
+,
+
+166 \ 1
+       #_SC_LINE_MAX
+_SC_LINE_MAX
+
+
+       )
+
+167 
+       m_SC_RE_DUP_MAX
+,
+
+168 \ 1
+       #_SC_RE_DUP_MAX
+_SC_RE_DUP_MAX
+
+
+       )
+
+169 
+       m_SC_CHARCLASS_NAME_MAX
+,
+
+170 \ 1
+       #_SC_CHARCLASS_NAME_MAX
+_SC_CHARCLASS_NAME_MAX
+
+
+       )
+
+172 
+       m_SC_2_VERSION
+,
+
+173 \ 1
+       #_SC_2_VERSION
+_SC_2_VERSION
+
+
+       )
+
+174 
+       m_SC_2_C_BIND
+,
+
+175 \ 1
+       #_SC_2_C_BIND
+_SC_2_C_BIND
+
+
+       )
+
+176 
+       m_SC_2_C_DEV
+,
+
+177 \ 1
+       #_SC_2_C_DEV
+_SC_2_C_DEV
+
+
+       )
+
+178 
+       m_SC_2_FORT_DEV
+,
+
+179 \ 1
+       #_SC_2_FORT_DEV
+_SC_2_FORT_DEV
+
+
+       )
+
+180 
+       m_SC_2_FORT_RUN
+,
+
+181 \ 1
+       #_SC_2_FORT_RUN
+_SC_2_FORT_RUN
+
+
+       )
+
+182 
+       m_SC_2_SW_DEV
+,
+
+183 \ 1
+       #_SC_2_SW_DEV
+_SC_2_SW_DEV
+
+
+       )
+
+184 
+       m_SC_2_LOCALEDEF
+,
+
+185 \ 1
+       #_SC_2_LOCALEDEF
+_SC_2_LOCALEDEF
+
+
+       )
+
+187 
+       m_SC_PII
+,
+
+188 \ 1
+       #_SC_PII
+_SC_PII
+
+
+       )
+
+189 
+       m_SC_PII_XTI
+,
+
+190 \ 1
+       #_SC_PII_XTI
+_SC_PII_XTI
+
+
+       )
+
+191 
+       m_SC_PII_SOCKET
+,
+
+192 \ 1
+       #_SC_PII_SOCKET
+_SC_PII_SOCKET
+
+
+       )
+
+193 
+       m_SC_PII_INTERNET
+,
+
+194 \ 1
+       #_SC_PII_INTERNET
+_SC_PII_INTERNET
+
+
+       )
+
+195 
+       m_SC_PII_OSI
+,
+
+196 \ 1
+       #_SC_PII_OSI
+_SC_PII_OSI
+
+
+       )
+
+197 
+       m_SC_POLL
+,
+
+198 \ 1
+       #_SC_POLL
+_SC_POLL
+
+
+       )
+
+199 
+       m_SC_SELECT
+,
+
+200 \ 1
+       #_SC_SELECT
+_SC_SELECT
+
+
+       )
+
+201 
+       m_SC_UIO_MAXIOV
+,
+
+202 \ 1
+       #_SC_UIO_MAXIOV
+_SC_UIO_MAXIOV
+
+
+       )
+
+203 
+       m_SC_IOV_MAX
+ = 
+_SC_UIO_MAXIOV
+,
+
+204 \ 1
+       #_SC_IOV_MAX
+_SC_IOV_MAX
+
+
+       )
+
+205 
+       m_SC_PII_INTERNET_STREAM
+,
+
+206 \ 1
+       #_SC_PII_INTERNET_STREAM
+_SC_PII_INTERNET_STREAM
+
+
+       )
+
+207 
+       m_SC_PII_INTERNET_DGRAM
+,
+
+208 \ 1
+       #_SC_PII_INTERNET_DGRAM
+_SC_PII_INTERNET_DGRAM
+
+
+       )
+
+209 
+       m_SC_PII_OSI_COTS
+,
+
+210 \ 1
+       #_SC_PII_OSI_COTS
+_SC_PII_OSI_COTS
+
+
+       )
+
+211 
+       m_SC_PII_OSI_CLTS
+,
+
+212 \ 1
+       #_SC_PII_OSI_CLTS
+_SC_PII_OSI_CLTS
+
+
+       )
+
+213 
+       m_SC_PII_OSI_M
+,
+
+214 \ 1
+       #_SC_PII_OSI_M
+_SC_PII_OSI_M
+
+
+       )
+
+215 
+       m_SC_T_IOV_MAX
+,
+
+216 \ 1
+       #_SC_T_IOV_MAX
+_SC_T_IOV_MAX
+
+
+       )
+
+219 
+       m_SC_THREADS
+,
+
+220 \ 1
+       #_SC_THREADS
+_SC_THREADS
+
+
+       )
+
+221 
+       m_SC_THREAD_SAFE_FUNCTIONS
+,
+
+222 \ 1
+       #_SC_THREAD_SAFE_FUNCTIONS
+_SC_THREAD_SAFE_FUNCTIONS
+
+
+       )
+
+223 
+       m_SC_GETGR_R_SIZE_MAX
+,
+
+224 \ 1
+       #_SC_GETGR_R_SIZE_MAX
+_SC_GETGR_R_SIZE_MAX
+
+
+       )
+
+225 
+       m_SC_GETPW_R_SIZE_MAX
+,
+
+226 \ 1
+       #_SC_GETPW_R_SIZE_MAX
+_SC_GETPW_R_SIZE_MAX
+
+
+       )
+
+227 
+       m_SC_LOGIN_NAME_MAX
+,
+
+228 \ 1
+       #_SC_LOGIN_NAME_MAX
+_SC_LOGIN_NAME_MAX
+
+
+       )
+
+229 
+       m_SC_TTY_NAME_MAX
+,
+
+230 \ 1
+       #_SC_TTY_NAME_MAX
+_SC_TTY_NAME_MAX
+
+
+       )
+
+231 
+       m_SC_THREAD_DESTRUCTOR_ITERATIONS
+,
+
+232 \ 1
+       #_SC_THREAD_DESTRUCTOR_ITERATIONS
+_SC_THREAD_DESTRUCTOR_ITERATIONS
+
+
+       )
+
+233 
+       m_SC_THREAD_KEYS_MAX
+,
+
+234 \ 1
+       #_SC_THREAD_KEYS_MAX
+_SC_THREAD_KEYS_MAX
+
+
+       )
+
+235 
+       m_SC_THREAD_STACK_MIN
+,
+
+236 \ 1
+       #_SC_THREAD_STACK_MIN
+_SC_THREAD_STACK_MIN
+
+
+       )
+
+237 
+       m_SC_THREAD_THREADS_MAX
+,
+
+238 \ 1
+       #_SC_THREAD_THREADS_MAX
+_SC_THREAD_THREADS_MAX
+
+
+       )
+
+239 
+       m_SC_THREAD_ATTR_STACKADDR
+,
+
+240 \ 1
+       #_SC_THREAD_ATTR_STACKADDR
+_SC_THREAD_ATTR_STACKADDR
+
+
+       )
+
+241 
+       m_SC_THREAD_ATTR_STACKSIZE
+,
+
+242 \ 1
+       #_SC_THREAD_ATTR_STACKSIZE
+_SC_THREAD_ATTR_STACKSIZE
+
+
+       )
+
+243 
+       m_SC_THREAD_PRIORITY_SCHEDULING
+,
+
+244 \ 1
+       #_SC_THREAD_PRIORITY_SCHEDULING
+_SC_THREAD_PRIORITY_SCHEDULING
+
+
+       )
+
+245 
+       m_SC_THREAD_PRIO_INHERIT
+,
+
+246 \ 1
+       #_SC_THREAD_PRIO_INHERIT
+_SC_THREAD_PRIO_INHERIT
+
+
+       )
+
+247 
+       m_SC_THREAD_PRIO_PROTECT
+,
+
+248 \ 1
+       #_SC_THREAD_PRIO_PROTECT
+_SC_THREAD_PRIO_PROTECT
+
+
+       )
+
+249 
+       m_SC_THREAD_PROCESS_SHARED
+,
+
+250 \ 1
+       #_SC_THREAD_PROCESS_SHARED
+_SC_THREAD_PROCESS_SHARED
+
+
+       )
+
+252 
+       m_SC_NPROCESSORS_CONF
+,
+
+253 \ 1
+       #_SC_NPROCESSORS_CONF
+_SC_NPROCESSORS_CONF
+
+
+       )
+
+254 
+       m_SC_NPROCESSORS_ONLN
+,
+
+255 \ 1
+       #_SC_NPROCESSORS_ONLN
+_SC_NPROCESSORS_ONLN
+
+
+       )
+
+256 
+       m_SC_PHYS_PAGES
+,
+
+257 \ 1
+       #_SC_PHYS_PAGES
+_SC_PHYS_PAGES
+
+
+       )
+
+258 
+       m_SC_AVPHYS_PAGES
+,
+
+259 \ 1
+       #_SC_AVPHYS_PAGES
+_SC_AVPHYS_PAGES
+
+
+       )
+
+260 
+       m_SC_ATEXIT_MAX
+,
+
+261 \ 1
+       #_SC_ATEXIT_MAX
+_SC_ATEXIT_MAX
+
+
+       )
+
+262 
+       m_SC_PASS_MAX
+,
+
+263 \ 1
+       #_SC_PASS_MAX
+_SC_PASS_MAX
+
+
+       )
+
+265 
+       m_SC_XOPEN_VERSION
+,
+
+266 \ 1
+       #_SC_XOPEN_VERSION
+_SC_XOPEN_VERSION
+
+
+       )
+
+267 
+       m_SC_XOPEN_XCU_VERSION
+,
+
+268 \ 1
+       #_SC_XOPEN_XCU_VERSION
+_SC_XOPEN_XCU_VERSION
+
+
+       )
+
+269 
+       m_SC_XOPEN_UNIX
+,
+
+270 \ 1
+       #_SC_XOPEN_UNIX
+_SC_XOPEN_UNIX
+
+
+       )
+
+271 
+       m_SC_XOPEN_CRYPT
+,
+
+272 \ 1
+       #_SC_XOPEN_CRYPT
+_SC_XOPEN_CRYPT
+
+
+       )
+
+273 
+       m_SC_XOPEN_ENH_I18N
+,
+
+274 \ 1
+       #_SC_XOPEN_ENH_I18N
+_SC_XOPEN_ENH_I18N
+
+
+       )
+
+275 
+       m_SC_XOPEN_SHM
+,
+
+276 \ 1
+       #_SC_XOPEN_SHM
+_SC_XOPEN_SHM
+
+
+       )
+
+278 
+       m_SC_2_CHAR_TERM
+,
+
+279 \ 1
+       #_SC_2_CHAR_TERM
+_SC_2_CHAR_TERM
+
+
+       )
+
+280 
+       m_SC_2_C_VERSION
+,
+
+281 \ 1
+       #_SC_2_C_VERSION
+_SC_2_C_VERSION
+
+
+       )
+
+282 
+       m_SC_2_UPE
+,
+
+283 \ 1
+       #_SC_2_UPE
+_SC_2_UPE
+
+
+       )
+
+285 
+       m_SC_XOPEN_XPG2
+,
+
+286 \ 1
+       #_SC_XOPEN_XPG2
+_SC_XOPEN_XPG2
+
+
+       )
+
+287 
+       m_SC_XOPEN_XPG3
+,
+
+288 \ 1
+       #_SC_XOPEN_XPG3
+_SC_XOPEN_XPG3
+
+
+       )
+
+289 
+       m_SC_XOPEN_XPG4
+,
+
+290 \ 1
+       #_SC_XOPEN_XPG4
+_SC_XOPEN_XPG4
+
+
+       )
+
+292 
+       m_SC_CHAR_BIT
+,
+
+293 \ 1
+       #_SC_CHAR_BIT
+_SC_CHAR_BIT
+
+
+       )
+
+294 
+       m_SC_CHAR_MAX
+,
+
+295 \ 1
+       #_SC_CHAR_MAX
+_SC_CHAR_MAX
+
+
+       )
+
+296 
+       m_SC_CHAR_MIN
+,
+
+297 \ 1
+       #_SC_CHAR_MIN
+_SC_CHAR_MIN
+
+
+       )
+
+298 
+       m_SC_INT_MAX
+,
+
+299 \ 1
+       #_SC_INT_MAX
+_SC_INT_MAX
+
+
+       )
+
+300 
+       m_SC_INT_MIN
+,
+
+301 \ 1
+       #_SC_INT_MIN
+_SC_INT_MIN
+
+
+       )
+
+302 
+       m_SC_LONG_BIT
+,
+
+303 \ 1
+       #_SC_LONG_BIT
+_SC_LONG_BIT
+
+
+       )
+
+304 
+       m_SC_WORD_BIT
+,
+
+305 \ 1
+       #_SC_WORD_BIT
+_SC_WORD_BIT
+
+
+       )
+
+306 
+       m_SC_MB_LEN_MAX
+,
+
+307 \ 1
+       #_SC_MB_LEN_MAX
+_SC_MB_LEN_MAX
+
+
+       )
+
+308 
+       m_SC_NZERO
+,
+
+309 \ 1
+       #_SC_NZERO
+_SC_NZERO
+
+
+       )
+
+310 
+       m_SC_SSIZE_MAX
+,
+
+311 \ 1
+       #_SC_SSIZE_MAX
+_SC_SSIZE_MAX
+
+
+       )
+
+312 
+       m_SC_SCHAR_MAX
+,
+
+313 \ 1
+       #_SC_SCHAR_MAX
+_SC_SCHAR_MAX
+
+
+       )
+
+314 
+       m_SC_SCHAR_MIN
+,
+
+315 \ 1
+       #_SC_SCHAR_MIN
+_SC_SCHAR_MIN
+
+
+       )
+
+316 
+       m_SC_SHRT_MAX
+,
+
+317 \ 1
+       #_SC_SHRT_MAX
+_SC_SHRT_MAX
+
+
+       )
+
+318 
+       m_SC_SHRT_MIN
+,
+
+319 \ 1
+       #_SC_SHRT_MIN
+_SC_SHRT_MIN
+
+
+       )
+
+320 
+       m_SC_UCHAR_MAX
+,
+
+321 \ 1
+       #_SC_UCHAR_MAX
+_SC_UCHAR_MAX
+
+
+       )
+
+322 
+       m_SC_UINT_MAX
+,
+
+323 \ 1
+       #_SC_UINT_MAX
+_SC_UINT_MAX
+
+
+       )
+
+324 
+       m_SC_ULONG_MAX
+,
+
+325 \ 1
+       #_SC_ULONG_MAX
+_SC_ULONG_MAX
+
+
+       )
+
+326 
+       m_SC_USHRT_MAX
+,
+
+327 \ 1
+       #_SC_USHRT_MAX
+_SC_USHRT_MAX
+
+
+       )
+
+329 
+       m_SC_NL_ARGMAX
+,
+
+330 \ 1
+       #_SC_NL_ARGMAX
+_SC_NL_ARGMAX
+
+
+       )
+
+331 
+       m_SC_NL_LANGMAX
+,
+
+332 \ 1
+       #_SC_NL_LANGMAX
+_SC_NL_LANGMAX
+
+
+       )
+
+333 
+       m_SC_NL_MSGMAX
+,
+
+334 \ 1
+       #_SC_NL_MSGMAX
+_SC_NL_MSGMAX
+
+
+       )
+
+335 
+       m_SC_NL_NMAX
+,
+
+336 \ 1
+       #_SC_NL_NMAX
+_SC_NL_NMAX
+
+
+       )
+
+337 
+       m_SC_NL_SETMAX
+,
+
+338 \ 1
+       #_SC_NL_SETMAX
+_SC_NL_SETMAX
+
+
+       )
+
+339 
+       m_SC_NL_TEXTMAX
+,
+
+340 \ 1
+       #_SC_NL_TEXTMAX
+_SC_NL_TEXTMAX
+
+
+       )
+
+342 
+       m_SC_XBS5_ILP32_OFF32
+,
+
+343 \ 1
+       #_SC_XBS5_ILP32_OFF32
+_SC_XBS5_ILP32_OFF32
+
+
+       )
+
+344 
+       m_SC_XBS5_ILP32_OFFBIG
+,
+
+345 \ 1
+       #_SC_XBS5_ILP32_OFFBIG
+_SC_XBS5_ILP32_OFFBIG
+
+
+       )
+
+346 
+       m_SC_XBS5_LP64_OFF64
+,
+
+347 \ 1
+       #_SC_XBS5_LP64_OFF64
+_SC_XBS5_LP64_OFF64
+
+
+       )
+
+348 
+       m_SC_XBS5_LPBIG_OFFBIG
+,
+
+349 \ 1
+       #_SC_XBS5_LPBIG_OFFBIG
+_SC_XBS5_LPBIG_OFFBIG
+
+
+       )
+
+351 
+       m_SC_XOPEN_LEGACY
+,
+
+352 \ 1
+       #_SC_XOPEN_LEGACY
+_SC_XOPEN_LEGACY
+
+
+       )
+
+353 
+       m_SC_XOPEN_REALTIME
+,
+
+354 \ 1
+       #_SC_XOPEN_REALTIME
+_SC_XOPEN_REALTIME
+
+
+       )
+
+355 
+       m_SC_XOPEN_REALTIME_THREADS
+,
+
+356 \ 1
+       #_SC_XOPEN_REALTIME_THREADS
+_SC_XOPEN_REALTIME_THREADS
+
+
+       )
+
+358 
+       m_SC_ADVISORY_INFO
+,
+
+359 \ 1
+       #_SC_ADVISORY_INFO
+_SC_ADVISORY_INFO
+
+
+       )
+
+360 
+       m_SC_BARRIERS
+,
+
+361 \ 1
+       #_SC_BARRIERS
+_SC_BARRIERS
+
+
+       )
+
+362 
+       m_SC_BASE
+,
+
+363 \ 1
+       #_SC_BASE
+_SC_BASE
+
+
+       )
+
+364 
+       m_SC_C_LANG_SUPPORT
+,
+
+365 \ 1
+       #_SC_C_LANG_SUPPORT
+_SC_C_LANG_SUPPORT
+
+
+       )
+
+366 
+       m_SC_C_LANG_SUPPORT_R
+,
+
+367 \ 1
+       #_SC_C_LANG_SUPPORT_R
+_SC_C_LANG_SUPPORT_R
+
+
+       )
+
+368 
+       m_SC_CLOCK_SELECTION
+,
+
+369 \ 1
+       #_SC_CLOCK_SELECTION
+_SC_CLOCK_SELECTION
+
+
+       )
+
+370 
+       m_SC_CPUTIME
+,
+
+371 \ 1
+       #_SC_CPUTIME
+_SC_CPUTIME
+
+
+       )
+
+372 
+       m_SC_THREAD_CPUTIME
+,
+
+373 \ 1
+       #_SC_THREAD_CPUTIME
+_SC_THREAD_CPUTIME
+
+
+       )
+
+374 
+       m_SC_DEVICE_IO
+,
+
+375 \ 1
+       #_SC_DEVICE_IO
+_SC_DEVICE_IO
+
+
+       )
+
+376 
+       m_SC_DEVICE_SPECIFIC
+,
+
+377 \ 1
+       #_SC_DEVICE_SPECIFIC
+_SC_DEVICE_SPECIFIC
+
+
+       )
+
+378 
+       m_SC_DEVICE_SPECIFIC_R
+,
+
+379 \ 1
+       #_SC_DEVICE_SPECIFIC_R
+_SC_DEVICE_SPECIFIC_R
+
+
+       )
+
+380 
+       m_SC_FD_MGMT
+,
+
+381 \ 1
+       #_SC_FD_MGMT
+_SC_FD_MGMT
+
+
+       )
+
+382 
+       m_SC_FIFO
+,
+
+383 \ 1
+       #_SC_FIFO
+_SC_FIFO
+
+
+       )
+
+384 
+       m_SC_PIPE
+,
+
+385 \ 1
+       #_SC_PIPE
+_SC_PIPE
+
+
+       )
+
+386 
+       m_SC_FILE_ATTRIBUTES
+,
+
+387 \ 1
+       #_SC_FILE_ATTRIBUTES
+_SC_FILE_ATTRIBUTES
+
+
+       )
+
+388 
+       m_SC_FILE_LOCKING
+,
+
+389 \ 1
+       #_SC_FILE_LOCKING
+_SC_FILE_LOCKING
+
+
+       )
+
+390 
+       m_SC_FILE_SYSTEM
+,
+
+391 \ 1
+       #_SC_FILE_SYSTEM
+_SC_FILE_SYSTEM
+
+
+       )
+
+392 
+       m_SC_MONOTONIC_CLOCK
+,
+
+393 \ 1
+       #_SC_MONOTONIC_CLOCK
+_SC_MONOTONIC_CLOCK
+
+
+       )
+
+394 
+       m_SC_MULTI_PROCESS
+,
+
+395 \ 1
+       #_SC_MULTI_PROCESS
+_SC_MULTI_PROCESS
+
+
+       )
+
+396 
+       m_SC_SINGLE_PROCESS
+,
+
+397 \ 1
+       #_SC_SINGLE_PROCESS
+_SC_SINGLE_PROCESS
+
+
+       )
+
+398 
+       m_SC_NETWORKING
+,
+
+399 \ 1
+       #_SC_NETWORKING
+_SC_NETWORKING
+
+
+       )
+
+400 
+       m_SC_READER_WRITER_LOCKS
+,
+
+401 \ 1
+       #_SC_READER_WRITER_LOCKS
+_SC_READER_WRITER_LOCKS
+
+
+       )
+
+402 
+       m_SC_SPIN_LOCKS
+,
+
+403 \ 1
+       #_SC_SPIN_LOCKS
+_SC_SPIN_LOCKS
+
+
+       )
+
+404 
+       m_SC_REGEXP
+,
+
+405 \ 1
+       #_SC_REGEXP
+_SC_REGEXP
+
+
+       )
+
+406 
+       m_SC_REGEX_VERSION
+,
+
+407 \ 1
+       #_SC_REGEX_VERSION
+_SC_REGEX_VERSION
+
+
+       )
+
+408 
+       m_SC_SHELL
+,
+
+409 \ 1
+       #_SC_SHELL
+_SC_SHELL
+
+
+       )
+
+410 
+       m_SC_SIGNALS
+,
+
+411 \ 1
+       #_SC_SIGNALS
+_SC_SIGNALS
+
+
+       )
+
+412 
+       m_SC_SPAWN
+,
+
+413 \ 1
+       #_SC_SPAWN
+_SC_SPAWN
+
+
+       )
+
+414 
+       m_SC_SPORADIC_SERVER
+,
+
+415 \ 1
+       #_SC_SPORADIC_SERVER
+_SC_SPORADIC_SERVER
+
+
+       )
+
+416 
+       m_SC_THREAD_SPORADIC_SERVER
+,
+
+417 \ 1
+       #_SC_THREAD_SPORADIC_SERVER
+_SC_THREAD_SPORADIC_SERVER
+
+
+       )
+
+418 
+       m_SC_SYSTEM_DATABASE
+,
+
+419 \ 1
+       #_SC_SYSTEM_DATABASE
+_SC_SYSTEM_DATABASE
+
+
+       )
+
+420 
+       m_SC_SYSTEM_DATABASE_R
+,
+
+421 \ 1
+       #_SC_SYSTEM_DATABASE_R
+_SC_SYSTEM_DATABASE_R
+
+
+       )
+
+422 
+       m_SC_TIMEOUTS
+,
+
+423 \ 1
+       #_SC_TIMEOUTS
+_SC_TIMEOUTS
+
+
+       )
+
+424 
+       m_SC_TYPED_MEMORY_OBJECTS
+,
+
+425 \ 1
+       #_SC_TYPED_MEMORY_OBJECTS
+_SC_TYPED_MEMORY_OBJECTS
+
+
+       )
+
+426 
+       m_SC_USER_GROUPS
+,
+
+427 \ 1
+       #_SC_USER_GROUPS
+_SC_USER_GROUPS
+
+
+       )
+
+428 
+       m_SC_USER_GROUPS_R
+,
+
+429 \ 1
+       #_SC_USER_GROUPS_R
+_SC_USER_GROUPS_R
+
+
+       )
+
+430 
+       m_SC_2_PBS
+,
+
+431 \ 1
+       #_SC_2_PBS
+_SC_2_PBS
+
+
+       )
+
+432 
+       m_SC_2_PBS_ACCOUNTING
+,
+
+433 \ 1
+       #_SC_2_PBS_ACCOUNTING
+_SC_2_PBS_ACCOUNTING
+
+
+       )
+
+434 
+       m_SC_2_PBS_LOCATE
+,
+
+435 \ 1
+       #_SC_2_PBS_LOCATE
+_SC_2_PBS_LOCATE
+
+
+       )
+
+436 
+       m_SC_2_PBS_MESSAGE
+,
+
+437 \ 1
+       #_SC_2_PBS_MESSAGE
+_SC_2_PBS_MESSAGE
+
+
+       )
+
+438 
+       m_SC_2_PBS_TRACK
+,
+
+439 \ 1
+       #_SC_2_PBS_TRACK
+_SC_2_PBS_TRACK
+
+
+       )
+
+440 
+       m_SC_SYMLOOP_MAX
+,
+
+441 \ 1
+       #_SC_SYMLOOP_MAX
+_SC_SYMLOOP_MAX
+
+
+       )
+
+442 
+       m_SC_STREAMS
+,
+
+443 \ 1
+       #_SC_STREAMS
+_SC_STREAMS
+
+
+       )
+
+444 
+       m_SC_2_PBS_CHECKPOINT
+,
+
+445 \ 1
+       #_SC_2_PBS_CHECKPOINT
+_SC_2_PBS_CHECKPOINT
+
+
+       )
+
+447 
+       m_SC_V6_ILP32_OFF32
+,
+
+448 \ 1
+       #_SC_V6_ILP32_OFF32
+_SC_V6_ILP32_OFF32
+
+
+       )
+
+449 
+       m_SC_V6_ILP32_OFFBIG
+,
+
+450 \ 1
+       #_SC_V6_ILP32_OFFBIG
+_SC_V6_ILP32_OFFBIG
+
+
+       )
+
+451 
+       m_SC_V6_LP64_OFF64
+,
+
+452 \ 1
+       #_SC_V6_LP64_OFF64
+_SC_V6_LP64_OFF64
+
+
+       )
+
+453 
+       m_SC_V6_LPBIG_OFFBIG
+,
+
+454 \ 1
+       #_SC_V6_LPBIG_OFFBIG
+_SC_V6_LPBIG_OFFBIG
+
+
+       )
+
+456 
+       m_SC_HOST_NAME_MAX
+,
+
+457 \ 1
+       #_SC_HOST_NAME_MAX
+_SC_HOST_NAME_MAX
+
+
+       )
+
+458 
+       m_SC_TRACE
+,
+
+459 \ 1
+       #_SC_TRACE
+_SC_TRACE
+
+
+       )
+
+460 
+       m_SC_TRACE_EVENT_FILTER
+,
+
+461 \ 1
+       #_SC_TRACE_EVENT_FILTER
+_SC_TRACE_EVENT_FILTER
+
+
+       )
+
+462 
+       m_SC_TRACE_INHERIT
+,
+
+463 \ 1
+       #_SC_TRACE_INHERIT
+_SC_TRACE_INHERIT
+
+
+       )
+
+464 
+       m_SC_TRACE_LOG
+,
+
+465 \ 1
+       #_SC_TRACE_LOG
+_SC_TRACE_LOG
+
+
+       )
+
+467 
+       m_SC_LEVEL1_ICACHE_SIZE
+,
+
+468 \ 1
+       #_SC_LEVEL1_ICACHE_SIZE
+_SC_LEVEL1_ICACHE_SIZE
+
+
+       )
+
+469 
+       m_SC_LEVEL1_ICACHE_ASSOC
+,
+
+470 \ 1
+       #_SC_LEVEL1_ICACHE_ASSOC
+_SC_LEVEL1_ICACHE_ASSOC
+
+
+       )
+
+471 
+       m_SC_LEVEL1_ICACHE_LINESIZE
+,
+
+472 \ 1
+       #_SC_LEVEL1_ICACHE_LINESIZE
+_SC_LEVEL1_ICACHE_LINESIZE
+
+
+       )
+
+473 
+       m_SC_LEVEL1_DCACHE_SIZE
+,
+
+474 \ 1
+       #_SC_LEVEL1_DCACHE_SIZE
+_SC_LEVEL1_DCACHE_SIZE
+
+
+       )
+
+475 
+       m_SC_LEVEL1_DCACHE_ASSOC
+,
+
+476 \ 1
+       #_SC_LEVEL1_DCACHE_ASSOC
+_SC_LEVEL1_DCACHE_ASSOC
+
+
+       )
+
+477 
+       m_SC_LEVEL1_DCACHE_LINESIZE
+,
+
+478 \ 1
+       #_SC_LEVEL1_DCACHE_LINESIZE
+_SC_LEVEL1_DCACHE_LINESIZE
+
+
+       )
+
+479 
+       m_SC_LEVEL2_CACHE_SIZE
+,
+
+480 \ 1
+       #_SC_LEVEL2_CACHE_SIZE
+_SC_LEVEL2_CACHE_SIZE
+
+
+       )
+
+481 
+       m_SC_LEVEL2_CACHE_ASSOC
+,
+
+482 \ 1
+       #_SC_LEVEL2_CACHE_ASSOC
+_SC_LEVEL2_CACHE_ASSOC
+
+
+       )
+
+483 
+       m_SC_LEVEL2_CACHE_LINESIZE
+,
+
+484 \ 1
+       #_SC_LEVEL2_CACHE_LINESIZE
+_SC_LEVEL2_CACHE_LINESIZE
+
+
+       )
+
+485 
+       m_SC_LEVEL3_CACHE_SIZE
+,
+
+486 \ 1
+       #_SC_LEVEL3_CACHE_SIZE
+_SC_LEVEL3_CACHE_SIZE
+
+
+       )
+
+487 
+       m_SC_LEVEL3_CACHE_ASSOC
+,
+
+488 \ 1
+       #_SC_LEVEL3_CACHE_ASSOC
+_SC_LEVEL3_CACHE_ASSOC
+
+
+       )
+
+489 
+       m_SC_LEVEL3_CACHE_LINESIZE
+,
+
+490 \ 1
+       #_SC_LEVEL3_CACHE_LINESIZE
+_SC_LEVEL3_CACHE_LINESIZE
+
+
+       )
+
+491 
+       m_SC_LEVEL4_CACHE_SIZE
+,
+
+492 \ 1
+       #_SC_LEVEL4_CACHE_SIZE
+_SC_LEVEL4_CACHE_SIZE
+
+
+       )
+
+493 
+       m_SC_LEVEL4_CACHE_ASSOC
+,
+
+494 \ 1
+       #_SC_LEVEL4_CACHE_ASSOC
+_SC_LEVEL4_CACHE_ASSOC
+
+
+       )
+
+495 
+       m_SC_LEVEL4_CACHE_LINESIZE
+,
+
+496 \ 1
+       #_SC_LEVEL4_CACHE_LINESIZE
+_SC_LEVEL4_CACHE_LINESIZE
+
+
+       )
+
+499 
+       m_SC_IPV6
+ = 
+_SC_LEVEL1_ICACHE_SIZE
+ + 50,
+
+500 \ 1
+       #_SC_IPV6
+_SC_IPV6
+
+
+       )
+
+501 
+       m_SC_RAW_SOCKETS
+,
+
+502 \ 1
+       #_SC_RAW_SOCKETS
+_SC_RAW_SOCKETS
+
+
+       )
+
+504 
+       m_SC_V7_ILP32_OFF32
+,
+
+505 \ 1
+       #_SC_V7_ILP32_OFF32
+_SC_V7_ILP32_OFF32
+
+
+       )
+
+506 
+       m_SC_V7_ILP32_OFFBIG
+,
+
+507 \ 1
+       #_SC_V7_ILP32_OFFBIG
+_SC_V7_ILP32_OFFBIG
+
+
+       )
+
+508 
+       m_SC_V7_LP64_OFF64
+,
+
+509 \ 1
+       #_SC_V7_LP64_OFF64
+_SC_V7_LP64_OFF64
+
+
+       )
+
+510 
+       m_SC_V7_LPBIG_OFFBIG
+,
+
+511 \ 1
+       #_SC_V7_LPBIG_OFFBIG
+_SC_V7_LPBIG_OFFBIG
+
+
+       )
+
+513 
+       m_SC_SS_REPL_MAX
+,
+
+514 \ 1
+       #_SC_SS_REPL_MAX
+_SC_SS_REPL_MAX
+
+
+       )
+
+516 
+       m_SC_TRACE_EVENT_NAME_MAX
+,
+
+517 \ 1
+       #_SC_TRACE_EVENT_NAME_MAX
+_SC_TRACE_EVENT_NAME_MAX
+
+
+       )
+
+518 
+       m_SC_TRACE_NAME_MAX
+,
+
+519 \ 1
+       #_SC_TRACE_NAME_MAX
+_SC_TRACE_NAME_MAX
+
+
+       )
+
+520 
+       m_SC_TRACE_SYS_MAX
+,
+
+521 \ 1
+       #_SC_TRACE_SYS_MAX
+_SC_TRACE_SYS_MAX
+
+
+       )
+
+522 
+       m_SC_TRACE_USER_EVENT_MAX
+,
+
+523 \ 1
+       #_SC_TRACE_USER_EVENT_MAX
+_SC_TRACE_USER_EVENT_MAX
+
+
+       )
+
+525 
+       m_SC_XOPEN_STREAMS
+,
+
+526 \ 1
+       #_SC_XOPEN_STREAMS
+_SC_XOPEN_STREAMS
+
+
+       )
+
+528 
+       m_SC_THREAD_ROBUST_PRIO_INHERIT
+,
+
+529 \ 1
+       #_SC_THREAD_ROBUST_PRIO_INHERIT
+_SC_THREAD_ROBUST_PRIO_INHERIT
+
+
+       )
+
+530 
+       m_SC_THREAD_ROBUST_PRIO_PROTECT
+
+
+531 \ 1
+       #_SC_THREAD_ROBUST_PRIO_PROTECT
+_SC_THREAD_ROBUST_PRIO_PROTECT
+
+
+       )
+
+537 
+       m_CS_PATH
+,
+
+538 \ 1
+       #_CS_PATH
+_CS_PATH
+
+
+       )
+
+540 
+       m_CS_V6_WIDTH_RESTRICTED_ENVS
+,
+
+541 \ 1
+       #_CS_V6_WIDTH_RESTRICTED_ENVS
+_CS_V6_WIDTH_RESTRICTED_ENVS
+
+
+       )
+
+542 \ 1
+       #_CS_POSIX_V6_WIDTH_RESTRICTED_ENVS
+_CS_V6_WIDTH_RESTRICTED_ENVS
+
+
+       )
+
+544 
+       m_CS_GNU_LIBC_VERSION
+,
+
+545 \ 1
+       #_CS_GNU_LIBC_VERSION
+_CS_GNU_LIBC_VERSION
+
+
+       )
+
+546 
+       m_CS_GNU_LIBPTHREAD_VERSION
+,
+
+547 \ 1
+       #_CS_GNU_LIBPTHREAD_VERSION
+_CS_GNU_LIBPTHREAD_VERSION
+
+
+       )
+
+549 
+       m_CS_V5_WIDTH_RESTRICTED_ENVS
+,
+
+550 \ 1
+       #_CS_V5_WIDTH_RESTRICTED_ENVS
+_CS_V5_WIDTH_RESTRICTED_ENVS
+
+
+       )
+
+551 \ 1
+       #_CS_POSIX_V5_WIDTH_RESTRICTED_ENVS
+_CS_V5_WIDTH_RESTRICTED_ENVS
+
+
+       )
+
+553 
+       m_CS_V7_WIDTH_RESTRICTED_ENVS
+,
+
+554 \ 1
+       #_CS_V7_WIDTH_RESTRICTED_ENVS
+_CS_V7_WIDTH_RESTRICTED_ENVS
+
+
+       )
+
+555 \ 1
+       #_CS_POSIX_V7_WIDTH_RESTRICTED_ENVS
+_CS_V7_WIDTH_RESTRICTED_ENVS
+
+
+       )
+
+557 
+       m_CS_LFS_CFLAGS
+ = 1000,
+
+558 \ 1
+       #_CS_LFS_CFLAGS
+_CS_LFS_CFLAGS
+
+
+       )
+
+559 
+       m_CS_LFS_LDFLAGS
+,
+
+560 \ 1
+       #_CS_LFS_LDFLAGS
+_CS_LFS_LDFLAGS
+
+
+       )
+
+561 
+       m_CS_LFS_LIBS
+,
+
+562 \ 1
+       #_CS_LFS_LIBS
+_CS_LFS_LIBS
+
+
+       )
+
+563 
+       m_CS_LFS_LINTFLAGS
+,
+
+564 \ 1
+       #_CS_LFS_LINTFLAGS
+_CS_LFS_LINTFLAGS
+
+
+       )
+
+565 
+       m_CS_LFS64_CFLAGS
+,
+
+566 \ 1
+       #_CS_LFS64_CFLAGS
+_CS_LFS64_CFLAGS
+
+
+       )
+
+567 
+       m_CS_LFS64_LDFLAGS
+,
+
+568 \ 1
+       #_CS_LFS64_LDFLAGS
+_CS_LFS64_LDFLAGS
+
+
+       )
+
+569 
+       m_CS_LFS64_LIBS
+,
+
+570 \ 1
+       #_CS_LFS64_LIBS
+_CS_LFS64_LIBS
+
+
+       )
+
+571 
+       m_CS_LFS64_LINTFLAGS
+,
+
+572 \ 1
+       #_CS_LFS64_LINTFLAGS
+_CS_LFS64_LINTFLAGS
+
+
+       )
+
+574 
+       m_CS_XBS5_ILP32_OFF32_CFLAGS
+ = 1100,
+
+575 \ 1
+       #_CS_XBS5_ILP32_OFF32_CFLAGS
+_CS_XBS5_ILP32_OFF32_CFLAGS
+
+
+       )
+
+576 
+       m_CS_XBS5_ILP32_OFF32_LDFLAGS
+,
+
+577 \ 1
+       #_CS_XBS5_ILP32_OFF32_LDFLAGS
+_CS_XBS5_ILP32_OFF32_LDFLAGS
+
+
+       )
+
+578 
+       m_CS_XBS5_ILP32_OFF32_LIBS
+,
+
+579 \ 1
+       #_CS_XBS5_ILP32_OFF32_LIBS
+_CS_XBS5_ILP32_OFF32_LIBS
+
+
+       )
+
+580 
+       m_CS_XBS5_ILP32_OFF32_LINTFLAGS
+,
+
+581 \ 1
+       #_CS_XBS5_ILP32_OFF32_LINTFLAGS
+_CS_XBS5_ILP32_OFF32_LINTFLAGS
+
+
+       )
+
+582 
+       m_CS_XBS5_ILP32_OFFBIG_CFLAGS
+,
+
+583 \ 1
+       #_CS_XBS5_ILP32_OFFBIG_CFLAGS
+_CS_XBS5_ILP32_OFFBIG_CFLAGS
+
+
+       )
+
+584 
+       m_CS_XBS5_ILP32_OFFBIG_LDFLAGS
+,
+
+585 \ 1
+       #_CS_XBS5_ILP32_OFFBIG_LDFLAGS
+_CS_XBS5_ILP32_OFFBIG_LDFLAGS
+
+
+       )
+
+586 
+       m_CS_XBS5_ILP32_OFFBIG_LIBS
+,
+
+587 \ 1
+       #_CS_XBS5_ILP32_OFFBIG_LIBS
+_CS_XBS5_ILP32_OFFBIG_LIBS
+
+
+       )
+
+588 
+       m_CS_XBS5_ILP32_OFFBIG_LINTFLAGS
+,
+
+589 \ 1
+       #_CS_XBS5_ILP32_OFFBIG_LINTFLAGS
+_CS_XBS5_ILP32_OFFBIG_LINTFLAGS
+
+
+       )
+
+590 
+       m_CS_XBS5_LP64_OFF64_CFLAGS
+,
+
+591 \ 1
+       #_CS_XBS5_LP64_OFF64_CFLAGS
+_CS_XBS5_LP64_OFF64_CFLAGS
+
+
+       )
+
+592 
+       m_CS_XBS5_LP64_OFF64_LDFLAGS
+,
+
+593 \ 1
+       #_CS_XBS5_LP64_OFF64_LDFLAGS
+_CS_XBS5_LP64_OFF64_LDFLAGS
+
+
+       )
+
+594 
+       m_CS_XBS5_LP64_OFF64_LIBS
+,
+
+595 \ 1
+       #_CS_XBS5_LP64_OFF64_LIBS
+_CS_XBS5_LP64_OFF64_LIBS
+
+
+       )
+
+596 
+       m_CS_XBS5_LP64_OFF64_LINTFLAGS
+,
+
+597 \ 1
+       #_CS_XBS5_LP64_OFF64_LINTFLAGS
+_CS_XBS5_LP64_OFF64_LINTFLAGS
+
+
+       )
+
+598 
+       m_CS_XBS5_LPBIG_OFFBIG_CFLAGS
+,
+
+599 \ 1
+       #_CS_XBS5_LPBIG_OFFBIG_CFLAGS
+_CS_XBS5_LPBIG_OFFBIG_CFLAGS
+
+
+       )
+
+600 
+       m_CS_XBS5_LPBIG_OFFBIG_LDFLAGS
+,
+
+601 \ 1
+       #_CS_XBS5_LPBIG_OFFBIG_LDFLAGS
+_CS_XBS5_LPBIG_OFFBIG_LDFLAGS
+
+
+       )
+
+602 
+       m_CS_XBS5_LPBIG_OFFBIG_LIBS
+,
+
+603 \ 1
+       #_CS_XBS5_LPBIG_OFFBIG_LIBS
+_CS_XBS5_LPBIG_OFFBIG_LIBS
+
+
+       )
+
+604 
+       m_CS_XBS5_LPBIG_OFFBIG_LINTFLAGS
+,
+
+605 \ 1
+       #_CS_XBS5_LPBIG_OFFBIG_LINTFLAGS
+_CS_XBS5_LPBIG_OFFBIG_LINTFLAGS
+
+
+       )
+
+607 
+       m_CS_POSIX_V6_ILP32_OFF32_CFLAGS
+,
+
+608 \ 1
+       #_CS_POSIX_V6_ILP32_OFF32_CFLAGS
+_CS_POSIX_V6_ILP32_OFF32_CFLAGS
+
+
+       )
+
+609 
+       m_CS_POSIX_V6_ILP32_OFF32_LDFLAGS
+,
+
+610 \ 1
+       #_CS_POSIX_V6_ILP32_OFF32_LDFLAGS
+_CS_POSIX_V6_ILP32_OFF32_LDFLAGS
+
+
+       )
+
+611 
+       m_CS_POSIX_V6_ILP32_OFF32_LIBS
+,
+
+612 \ 1
+       #_CS_POSIX_V6_ILP32_OFF32_LIBS
+_CS_POSIX_V6_ILP32_OFF32_LIBS
+
+
+       )
+
+613 
+       m_CS_POSIX_V6_ILP32_OFF32_LINTFLAGS
+,
+
+614 \ 1
+       #_CS_POSIX_V6_ILP32_OFF32_LINTFLAGS
+_CS_POSIX_V6_ILP32_OFF32_LINTFLAGS
+
+
+       )
+
+615 
+       m_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS
+,
+
+616 \ 1
+       #_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS
+_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS
+
+
+       )
+
+617 
+       m_CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS
+,
+
+618 \ 1
+       #_CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS
+_CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS
+
+
+       )
+
+619 
+       m_CS_POSIX_V6_ILP32_OFFBIG_LIBS
+,
+
+620 \ 1
+       #_CS_POSIX_V6_ILP32_OFFBIG_LIBS
+_CS_POSIX_V6_ILP32_OFFBIG_LIBS
+
+
+       )
+
+621 
+       m_CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS
+,
+
+622 \ 1
+       #_CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS
+_CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS
+
+
+       )
+
+623 
+       m_CS_POSIX_V6_LP64_OFF64_CFLAGS
+,
+
+624 \ 1
+       #_CS_POSIX_V6_LP64_OFF64_CFLAGS
+_CS_POSIX_V6_LP64_OFF64_CFLAGS
+
+
+       )
+
+625 
+       m_CS_POSIX_V6_LP64_OFF64_LDFLAGS
+,
+
+626 \ 1
+       #_CS_POSIX_V6_LP64_OFF64_LDFLAGS
+_CS_POSIX_V6_LP64_OFF64_LDFLAGS
+
+
+       )
+
+627 
+       m_CS_POSIX_V6_LP64_OFF64_LIBS
+,
+
+628 \ 1
+       #_CS_POSIX_V6_LP64_OFF64_LIBS
+_CS_POSIX_V6_LP64_OFF64_LIBS
+
+
+       )
+
+629 
+       m_CS_POSIX_V6_LP64_OFF64_LINTFLAGS
+,
+
+630 \ 1
+       #_CS_POSIX_V6_LP64_OFF64_LINTFLAGS
+_CS_POSIX_V6_LP64_OFF64_LINTFLAGS
+
+
+       )
+
+631 
+       m_CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS
+,
+
+632 \ 1
+       #_CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS
+_CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS
+
+
+       )
+
+633 
+       m_CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS
+,
+
+634 \ 1
+       #_CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS
+_CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS
+
+
+       )
+
+635 
+       m_CS_POSIX_V6_LPBIG_OFFBIG_LIBS
+,
+
+636 \ 1
+       #_CS_POSIX_V6_LPBIG_OFFBIG_LIBS
+_CS_POSIX_V6_LPBIG_OFFBIG_LIBS
+
+
+       )
+
+637 
+       m_CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS
+,
+
+638 \ 1
+       #_CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS
+_CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS
+
+
+       )
+
+640 
+       m_CS_POSIX_V7_ILP32_OFF32_CFLAGS
+,
+
+641 \ 1
+       #_CS_POSIX_V7_ILP32_OFF32_CFLAGS
+_CS_POSIX_V7_ILP32_OFF32_CFLAGS
+
+
+       )
+
+642 
+       m_CS_POSIX_V7_ILP32_OFF32_LDFLAGS
+,
+
+643 \ 1
+       #_CS_POSIX_V7_ILP32_OFF32_LDFLAGS
+_CS_POSIX_V7_ILP32_OFF32_LDFLAGS
+
+
+       )
+
+644 
+       m_CS_POSIX_V7_ILP32_OFF32_LIBS
+,
+
+645 \ 1
+       #_CS_POSIX_V7_ILP32_OFF32_LIBS
+_CS_POSIX_V7_ILP32_OFF32_LIBS
+
+
+       )
+
+646 
+       m_CS_POSIX_V7_ILP32_OFF32_LINTFLAGS
+,
+
+647 \ 1
+       #_CS_POSIX_V7_ILP32_OFF32_LINTFLAGS
+_CS_POSIX_V7_ILP32_OFF32_LINTFLAGS
+
+
+       )
+
+648 
+       m_CS_POSIX_V7_ILP32_OFFBIG_CFLAGS
+,
+
+649 \ 1
+       #_CS_POSIX_V7_ILP32_OFFBIG_CFLAGS
+_CS_POSIX_V7_ILP32_OFFBIG_CFLAGS
+
+
+       )
+
+650 
+       m_CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS
+,
+
+651 \ 1
+       #_CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS
+_CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS
+
+
+       )
+
+652 
+       m_CS_POSIX_V7_ILP32_OFFBIG_LIBS
+,
+
+653 \ 1
+       #_CS_POSIX_V7_ILP32_OFFBIG_LIBS
+_CS_POSIX_V7_ILP32_OFFBIG_LIBS
+
+
+       )
+
+654 
+       m_CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS
+,
+
+655 \ 1
+       #_CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS
+_CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS
+
+
+       )
+
+656 
+       m_CS_POSIX_V7_LP64_OFF64_CFLAGS
+,
+
+657 \ 1
+       #_CS_POSIX_V7_LP64_OFF64_CFLAGS
+_CS_POSIX_V7_LP64_OFF64_CFLAGS
+
+
+       )
+
+658 
+       m_CS_POSIX_V7_LP64_OFF64_LDFLAGS
+,
+
+659 \ 1
+       #_CS_POSIX_V7_LP64_OFF64_LDFLAGS
+_CS_POSIX_V7_LP64_OFF64_LDFLAGS
+
+
+       )
+
+660 
+       m_CS_POSIX_V7_LP64_OFF64_LIBS
+,
+
+661 \ 1
+       #_CS_POSIX_V7_LP64_OFF64_LIBS
+_CS_POSIX_V7_LP64_OFF64_LIBS
+
+
+       )
+
+662 
+       m_CS_POSIX_V7_LP64_OFF64_LINTFLAGS
+,
+
+663 \ 1
+       #_CS_POSIX_V7_LP64_OFF64_LINTFLAGS
+_CS_POSIX_V7_LP64_OFF64_LINTFLAGS
+
+
+       )
+
+664 
+       m_CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS
+,
+
+665 \ 1
+       #_CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS
+_CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS
+
+
+       )
+
+666 
+       m_CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS
+,
+
+667 \ 1
+       #_CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS
+_CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS
+
+
+       )
+
+668 
+       m_CS_POSIX_V7_LPBIG_OFFBIG_LIBS
+,
+
+669 \ 1
+       #_CS_POSIX_V7_LPBIG_OFFBIG_LIBS
+_CS_POSIX_V7_LPBIG_OFFBIG_LIBS
+
+
+       )
+
+670 
+       m_CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS
+,
+
+671 \ 1
+       #_CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS
+_CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS
+
+
+       )
+
+673 
+       m_CS_V6_ENV
+,
+
+674 \ 1
+       #_CS_V6_ENV
+_CS_V6_ENV
+
+
+       )
+
+675 
+       m_CS_V7_ENV
+
+
+676 \ 1
+       #_CS_V7_ENV
+_CS_V7_ENV
+
+
+       )
+
+       @/usr/include/bits/environments.h
+
+19 #iâdeà
+_UNISTD_H
+
+
+23 \ 2
+       ~<b\99s/wÜdsize.h
+>
+
+43 #ià
+__WORDSIZE
+ == 64
+
+57 \ 1
+       #_POSIX_V7_LPBIG_OFFBIG
+ -1
+
+       )
+
+58 \ 1
+       #_POSIX_V6_LPBIG_OFFBIG
+ -1
+
+       )
+
+59 \ 1
+       #_XBS5_LPBIG_OFFBIG
+ -1
+
+       )
+
+62 \ 1
+       #_POSIX_V7_LP64_OFF64
+ 1
+
+       )
+
+63 \ 1
+       #_POSIX_V6_LP64_OFF64
+ 1
+
+       )
+
+64 \ 1
+       #_XBS5_LP64_OFF64
+ 1
+
+       )
+
+70 \ 1
+       #_POSIX_V7_ILP32_OFF32
+ 1
+
+       )
+
+71 \ 1
+       #_POSIX_V7_ILP32_OFFBIG
+ 1
+
+       )
+
+72 \ 1
+       #_POSIX_V6_ILP32_OFF32
+ 1
+
+       )
+
+73 \ 1
+       #_POSIX_V6_ILP32_OFFBIG
+ 1
+
+       )
+
+74 \ 1
+       #_XBS5_ILP32_OFF32
+ 1
+
+       )
+
+75 \ 1
+       #_XBS5_ILP32_OFFBIG
+ 1
+
+       )
+
+92 \ 1
+       #__ILP32_OFF32_CFLAGS
+ "-m32"
+
+       )
+
+93 \ 1
+       #__ILP32_OFFBIG_CFLAGS
+ "-m32 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
+
+       )
+
+94 \ 1
+       #__ILP32_OFF32_LDFLAGS
+ "-m32"
+
+       )
+
+95 \ 1
+       #__ILP32_OFFBIG_LDFLAGS
+ "-m32"
+
+       )
+
+96 \ 1
+       #__LP64_OFF64_CFLAGS
+ "-m64"
+
+       )
+
+97 \ 1
+       #__LP64_OFF64_LDFLAGS
+ "-m64"
+
+       )
+
+       @/usr/include/bits/errno.h
+
+20 #ifdeà
+_ERRNO_H
+
+
+22 #undeà
+EDOM
+
+
+23 #undeà
+EILSEQ
+
+
+24 #undeà
+ERANGE
+
+
+25 \ 2
+       ~<l\9aux/\94ºo.h
+>
+
+28 \ 1
+       #ENOTSUP
+EOPNOTSUPP
+
+
+       )
+
+31 #iâdeà
+ECANCELED
+
+
+32 \ 1
+       #ECANCELED
+ 125
+
+       )
+
+36 #iâdeà
+EOWNERDEAD
+
+
+37 \ 1
+       #EOWNERDEAD
+ 130
+
+       )
+
+38 \ 1
+       #ENOTRECOVERABLE
+ 131
+
+       )
+
+41 #iâdeà
+ERFKILL
+
+
+42 \ 1
+       #ERFKILL
+ 132
+
+       )
+
+45 #iâdeà
+__ASSEMBLER__
+
+
+47 \r\12*
+       $__\94ºo_loÿtiÚ
+ (\1eè
+__THROW
+       `__©\8cibu\8b__
+ ((
+__cڡ__
+));
+
+49 #ià!
+def\9aed
+_LIBC
+ || def\9aed 
+_LIBC_REENTRANT
+
+
+51 \ 1
+       #\94ºo
+ (*
+       `__\94ºo_loÿtiÚ
+ ())
+
+       )
+
+56 #ià!
+def\9aed
+_ERRNO_H
+ && def\9aed 
+__Ãed_Em©h
+
+
+60 \ 1
+       #EDOM
+ 33
+
+       )
+
+61 \ 1
+       #EILSEQ
+ 84
+
+       )
+
+62 \ 1
+       #ERANGE
+ 34
+
+       )
+
+       @/usr/include/bits/ioctl-types.h
+
+20 #iâdeà
+_SYS_IOCTL_H
+
+
+25 \ 2
+       ~<asm/ioùls.h
+>
+
+28 \19
+       sw\9asize
+
+
+30 \1d\16\12
+       mws_row
+;
+
+31 \1d\16\12
+       mws_cÞ
+;
+
+32 \1d\16\12
+       mws_xpix\96
+;
+
+33 \1d\16\12
+       mws_ypix\96
+;
+
+36 \ 1
+       #NCC
+ 8
+
+       )
+
+37 \19
+       s\8brmio
+
+
+39 \1d\16\12
+       mc_iæag
+;
+
+40 \1d\16\12
+       mc_oæag
+;
+
+41 \1d\16\12
+       mc_cæag
+;
+
+42 \1d\16\12
+       mc_læag
+;
+
+43 \1d\ 5
+       mc_l\9ae
+;
+
+44 \1d\ 5
+       mc_cc
+[
+NCC
+];
+
+48 \ 1
+       #TIOCM_LE
+ 0x001
+
+       )
+
+49 \ 1
+       #TIOCM_DTR
+ 0x002
+
+       )
+
+50 \ 1
+       #TIOCM_RTS
+ 0x004
+
+       )
+
+51 \ 1
+       #TIOCM_ST
+ 0x008
+
+       )
+
+52 \ 1
+       #TIOCM_SR
+ 0x010
+
+       )
+
+53 \ 1
+       #TIOCM_CTS
+ 0x020
+
+       )
+
+54 \ 1
+       #TIOCM_CAR
+ 0x040
+
+       )
+
+55 \ 1
+       #TIOCM_RNG
+ 0x080
+
+       )
+
+56 \ 1
+       #TIOCM_DSR
+ 0x100
+
+       )
+
+57 \ 1
+       #TIOCM_CD
+TIOCM_CAR
+
+
+       )
+
+58 \ 1
+       #TIOCM_RI
+TIOCM_RNG
+
+
+       )
+
+63 \ 1
+       #N_TTY
+ 0
+
+       )
+
+64 \ 1
+       #N_SLIP
+ 1
+
+       )
+
+65 \ 1
+       #N_MOUSE
+ 2
+
+       )
+
+66 \ 1
+       #N_PPP
+ 3
+
+       )
+
+67 \ 1
+       #N_STRIP
+ 4
+
+       )
+
+68 \ 1
+       #N_AX25
+ 5
+
+       )
+
+69 \ 1
+       #N_X25
+ 6
+
+       )
+
+70 \ 1
+       #N_6PACK
+ 7
+
+       )
+
+71 \ 1
+       #N_MASC
+ 8
+
+       )
+
+72 \ 1
+       #N_R3964
+ 9
+
+       )
+
+73 \ 1
+       #N_PROFIBUS_FDL
+ 10
+
+       )
+
+74 \ 1
+       #N_IRDA
+ 11
+
+       )
+
+75 \ 1
+       #N_SMSBLOCK
+ 12
+
+       )
+
+76 \ 1
+       #N_HDLC
+ 13
+
+       )
+
+77 \ 1
+       #N_SYNC_PPP
+ 14
+
+       )
+
+78 \ 1
+       #N_HCI
+ 15
+
+       )
+
+       @/usr/include/bits/ioctls.h
+
+19 #iâdeà
+_SYS_IOCTL_H
+
+
+24 \ 2
+       ~<asm/ioùls.h
+>
+
+27 \ 1
+       #SIOCADDRT
+ 0x890B
+
+       )
+
+28 \ 1
+       #SIOCDELRT
+ 0x890C
+
+       )
+
+29 \ 1
+       #SIOCRTMSG
+ 0x890D
+
+       )
+
+32 \ 1
+       #SIOCGIFNAME
+ 0x8910
+
+       )
+
+33 \ 1
+       #SIOCSIFLINK
+ 0x8911
+
+       )
+
+34 \ 1
+       #SIOCGIFCONF
+ 0x8912
+
+       )
+
+35 \ 1
+       #SIOCGIFFLAGS
+ 0x8913
+
+       )
+
+36 \ 1
+       #SIOCSIFFLAGS
+ 0x8914
+
+       )
+
+37 \ 1
+       #SIOCGIFADDR
+ 0x8915
+
+       )
+
+38 \ 1
+       #SIOCSIFADDR
+ 0x8916
+
+       )
+
+39 \ 1
+       #SIOCGIFDSTADDR
+ 0x8917
+
+       )
+
+40 \ 1
+       #SIOCSIFDSTADDR
+ 0x8918
+
+       )
+
+41 \ 1
+       #SIOCGIFBRDADDR
+ 0x8919
+
+       )
+
+42 \ 1
+       #SIOCSIFBRDADDR
+ 0x891¨
+
+       )
+
+43 \ 1
+       #SIOCGIFNETMASK
+ 0x891b
+
+       )
+
+44 \ 1
+       #SIOCSIFNETMASK
+ 0x891ø
+
+       )
+
+45 \ 1
+       #SIOCGIFMETRIC
+ 0x891d
+
+       )
+
+46 \ 1
+       #SIOCSIFMETRIC
+ 0x891\90
+
+       )
+
+47 \ 1
+       #SIOCGIFMEM
+ 0x891à
+
+       )
+
+48 \ 1
+       #SIOCSIFMEM
+ 0x8920
+
+       )
+
+49 \ 1
+       #SIOCGIFMTU
+ 0x8921
+
+       )
+
+50 \ 1
+       #SIOCSIFMTU
+ 0x8922
+
+       )
+
+51 \ 1
+       #SIOCSIFNAME
+ 0x8923
+
+       )
+
+52 \ 1
+       #SIOCSIFHWADDR
+ 0x8924
+
+       )
+
+53 \ 1
+       #SIOCGIFENCAP
+ 0x8925
+
+       )
+
+54 \ 1
+       #SIOCSIFENCAP
+ 0x8926
+
+       )
+
+55 \ 1
+       #SIOCGIFHWADDR
+ 0x8927
+
+       )
+
+56 \ 1
+       #SIOCGIFSLAVE
+ 0x8929
+
+       )
+
+57 \ 1
+       #SIOCSIFSLAVE
+ 0x8930
+
+       )
+
+58 \ 1
+       #SIOCADDMULTI
+ 0x8931
+
+       )
+
+59 \ 1
+       #SIOCDELMULTI
+ 0x8932
+
+       )
+
+60 \ 1
+       #SIOCGIFINDEX
+ 0x8933
+
+       )
+
+61 \ 1
+       #SIOGIFINDEX
+SIOCGIFINDEX
+
+
+       )
+
+62 \ 1
+       #SIOCSIFPFLAGS
+ 0x8934
+
+       )
+
+63 \ 1
+       #SIOCGIFPFLAGS
+ 0x8935
+
+       )
+
+64 \ 1
+       #SIOCDIFADDR
+ 0x8936
+
+       )
+
+65 \ 1
+       #SIOCSIFHWBROADCAST
+ 0x8937
+
+       )
+
+66 \ 1
+       #SIOCGIFCOUNT
+ 0x8938
+
+       )
+
+68 \ 1
+       #SIOCGIFBR
+ 0x8940
+
+       )
+
+69 \ 1
+       #SIOCSIFBR
+ 0x8941
+
+       )
+
+71 \ 1
+       #SIOCGIFTXQLEN
+ 0x8942
+
+       )
+
+72 \ 1
+       #SIOCSIFTXQLEN
+ 0x8943
+
+       )
+
+77 \ 1
+       #SIOCDARP
+ 0x8953
+
+       )
+
+78 \ 1
+       #SIOCGARP
+ 0x8954
+
+       )
+
+79 \ 1
+       #SIOCSARP
+ 0x8955
+
+       )
+
+82 \ 1
+       #SIOCDRARP
+ 0x8960
+
+       )
+
+83 \ 1
+       #SIOCGRARP
+ 0x8961
+
+       )
+
+84 \ 1
+       #SIOCSRARP
+ 0x8962
+
+       )
+
+88 \ 1
+       #SIOCGIFMAP
+ 0x8970
+
+       )
+
+89 \ 1
+       #SIOCSIFMAP
+ 0x8971
+
+       )
+
+93 \ 1
+       #SIOCADDDLCI
+ 0x8980
+
+       )
+
+94 \ 1
+       #SIOCDELDLCI
+ 0x8981
+
+       )
+
+103 \ 1
+       #SIOCDEVPRIVATE
+ 0x89F0
+
+       )
+
+109 \ 1
+       #SIOCPROTOPRIVATE
+ 0x89E0
+
+       )
+
+       @/usr/include/bits/ipc.h
+
+19 #iâdeà
+_SYS_IPC_H
+
+
+23 \ 2
+       ~<b\99s/ty³s.h
+>
+
+26 \ 1
+       #IPC_CREAT
+ 01000
+
+       )
+
+27 \ 1
+       #IPC_EXCL
+ 02000
+
+       )
+
+28 \ 1
+       #IPC_NOWAIT
+ 04000
+
+       )
+
+31 \ 1
+       #IPC_RMID
+ 0
+
+       )
+
+32 \ 1
+       #IPC_SET
+ 1
+
+       )
+
+33 \ 1
+       #IPC_STAT
+ 2
+
+       )
+
+34 #ifdeà
+__USE_GNU
+
+
+35 \ 1
+       #IPC_INFO
+ 3
+
+       )
+
+39 \ 1
+       #IPC_PRIVATE
+ ((
+__key_t
+è0è
+
+       )
+
+43 \19
+       s\9dc_³rm
+
+
+45 
+__key_t
+       m__key
+;
+
+46 
+__uid_t
+       muid
+;
+
+47 
+__gid_t
+       mgid
+;
+
+48 
+__uid_t
+       mcuid
+;
+
+49 
+__gid_t
+       mcgid
+;
+
+50 \1d\16\12
+       mmode
+;
+
+51 \1d\16\12
+       m__·d1
+;
+
+52 \1d\16\12
+       m__£q
+;
+
+53 \1d\16\12
+       m__·d2
+;
+
+54 \1d\13\12
+       m__unu£d1
+;
+
+55 \1d\13\12
+       m__unu£d2
+;
+
+       @/usr/include/bits/ipctypes.h
+
+24 #iâdeà
+_BITS_IPCTYPES_H
+
+
+25 \ 1
+       #_BITS_IPCTYPES_H
+ 1
+
+       )
+
+27 \ 2
+       ~<b\99s/ty³s.h
+>
+
+30 #ià
+__WORDSIZE
+ == 32
+
+31 \e\1d\16\12
+       t__\9dc_pid_t
+;
+
+33 \e\12
+       t__\9dc_pid_t
+;
+
+       @/usr/include/bits/msq.h
+
+19 #iâdeà
+_SYS_MSG_H
+
+
+23 \ 2
+       ~<b\99s/ty³s.h
+>
+
+24 \ 2
+       ~<b\99s/wÜdsize.h
+>
+
+27 \ 1
+       #MSG_NOERROR
+ 010000
+
+       )
+
+28 #ifdeà
+__USE_GNU
+
+
+29 \ 1
+       #MSG_EXCEPT
+ 020000
+
+       )
+
+33 \e\1d\13\12
+       tmsgqnum_t
+;
+
+34 \e\1d\13\12
+       tmsgËn_t
+;
+
+38 \19
+       smsqid_ds
+
+
+40 \19
+\9dc_³rm
+       mmsg_³rm
+;
+
+41 
+__time_t
+       mmsg_¡ime
+;
+
+42 #ià
+__WORDSIZE
+ == 32
+
+43 \1d\13\12
+       m__unu£d1
+;
+
+45 
+__time_t
+       mmsg_¹ime
+;
+
+46 #ià
+__WORDSIZE
+ == 32
+
+47 \1d\13\12
+       m__unu£d2
+;
+
+49 
+__time_t
+       mmsg_ùime
+;
+
+50 #ià
+__WORDSIZE
+ == 32
+
+51 \1d\13\12
+       m__unu£d3
+;
+
+53 \1d\13\12
+       m__msg_cby\8bs
+;
+
+54 
+msgqnum_t
+       mmsg_qnum
+;
+
+55 
+msgËn_t
+       mmsg_qby\8bs
+;
+
+56 
+__pid_t
+       mmsg_l¥id
+;
+
+57 
+__pid_t
+       mmsg_Ìpid
+;
+
+58 \1d\13\12
+       m__unu£d4
+;
+
+59 \1d\13\12
+       m__unu£d5
+;
+
+62 #ifdeà
+__USE_MISC
+
+
+64 \ 1
+       #msg_cby\8bs
+__msg_cby\8bs
+
+
+       )
+
+67 \ 1
+       #MSG_STAT
+ 11
+
+       )
+
+68 \ 1
+       #MSG_INFO
+ 12
+
+       )
+
+71 \19
+       smsg\9afo
+
+
+73 \12
+       mmsgpoÞ
+;
+
+74 \12
+       mmsgm­
+;
+
+75 \12
+       mmsgmax
+;
+
+76 \12
+       mmsgmnb
+;
+
+77 \12
+       mmsgmni
+;
+
+78 \12
+       mmsgssz
+;
+
+79 \12
+       mmsgtql
+;
+
+80 \1d\16\12
+       mmsg£g
+;
+
+       @/usr/include/bits/posix_opt.h
+
+20 #iâdef 
+_BITS_POSIX_OPT_H
+
+
+21 \ 1
+       #_BITS_POSIX_OPT_H
+ 1
+
+       )
+
+24 \ 1
+       #_POSIX_JOB_CONTROL
+ 1
+
+       )
+
+27 \ 1
+       #_POSIX_SAVED_IDS
+ 1
+
+       )
+
+30 \ 1
+       #_POSIX_PRIORITY_SCHEDULING
+ 200809L
+
+       )
+
+33 \ 1
+       #_POSIX_SYNCHRONIZED_IO
+ 200809L
+
+       )
+
+36 \ 1
+       #_POSIX_FSYNC
+ 200809L
+
+       )
+
+39 \ 1
+       #_POSIX_MAPPED_FILES
+ 200809L
+
+       )
+
+42 \ 1
+       #_POSIX_MEMLOCK
+ 200809L
+
+       )
+
+45 \ 1
+       #_POSIX_MEMLOCK_RANGE
+ 200809L
+
+       )
+
+48 \ 1
+       #_POSIX_MEMORY_PROTECTION
+ 200809L
+
+       )
+
+51 \ 1
+       #_POSIX_CHOWN_RESTRICTED
+ 0
+
+       )
+
+55 \ 1
+       #_POSIX_VDISABLE
+ '\0'
+
+       )
+
+58 \ 1
+       #_POSIX_NO_TRUNC
+ 1
+
+       )
+
+61 \ 1
+       #_XOPEN_REALTIME
+ 1
+
+       )
+
+64 \ 1
+       #_XOPEN_REALTIME_THREADS
+ 1
+
+       )
+
+67 \ 1
+       #_XOPEN_SHM
+ 1
+
+       )
+
+70 \ 1
+       #_POSIX_THREADS
+ 200809L
+
+       )
+
+73 \ 1
+       #_POSIX_REENTRANT_FUNCTIONS
+ 1
+
+       )
+
+74 \ 1
+       #_POSIX_THREAD_SAFE_FUNCTIONS
+ 200809L
+
+       )
+
+77 \ 1
+       #_POSIX_THREAD_PRIORITY_SCHEDULING
+ 200809L
+
+       )
+
+80 \ 1
+       #_POSIX_THREAD_ATTR_STACKSIZE
+ 200809L
+
+       )
+
+83 \ 1
+       #_POSIX_THREAD_ATTR_STACKADDR
+ 200809L
+
+       )
+
+86 \ 1
+       #_POSIX_THREAD_PRIO_INHERIT
+ 200809L
+
+       )
+
+90 \ 1
+       #_POSIX_THREAD_PRIO_PROTECT
+ 200809L
+
+       )
+
+92 #ifdeà
+__USE_XOPEN2K8
+
+
+94 \ 1
+       #_POSIX_THREAD_ROBUST_PRIO_INHERIT
+ 200809L
+
+       )
+
+97 \ 1
+       #_POSIX_THREAD_ROBUST_PRIO_PROTECT
+ -1
+
+       )
+
+101 \ 1
+       #_POSIX_SEMAPHORES
+ 200809L
+
+       )
+
+104 \ 1
+       #_POSIX_REALTIME_SIGNALS
+ 200809L
+
+       )
+
+107 \ 1
+       #_POSIX_ASYNCHRONOUS_IO
+ 200809L
+
+       )
+
+108 \ 1
+       #_POSIX_ASYNC_IO
+ 1
+
+       )
+
+110 \ 1
+       #_LFS_ASYNCHRONOUS_IO
+ 1
+
+       )
+
+112 \ 1
+       #_POSIX_PRIORITIZED_IO
+ 200809L
+
+       )
+
+115 \ 1
+       #_LFS64_ASYNCHRONOUS_IO
+ 1
+
+       )
+
+118 \ 1
+       #_LFS_LARGEFILE
+ 1
+
+       )
+
+119 \ 1
+       #_LFS64_LARGEFILE
+ 1
+
+       )
+
+120 \ 1
+       #_LFS64_STDIO
+ 1
+
+       )
+
+123 \ 1
+       #_POSIX_SHARED_MEMORY_OBJECTS
+ 200809L
+
+       )
+
+126 \ 1
+       #_POSIX_CPUTIME
+ 0
+
+       )
+
+129 \ 1
+       #_POSIX_THREAD_CPUTIME
+ 0
+
+       )
+
+132 \ 1
+       #_POSIX_REGEXP
+ 1
+
+       )
+
+135 \ 1
+       #_POSIX_READER_WRITER_LOCKS
+ 200809L
+
+       )
+
+138 \ 1
+       #_POSIX_SHELL
+ 1
+
+       )
+
+141 \ 1
+       #_POSIX_TIMEOUTS
+ 200809L
+
+       )
+
+144 \ 1
+       #_POSIX_SPIN_LOCKS
+ 200809L
+
+       )
+
+147 \ 1
+       #_POSIX_SPAWN
+ 200809L
+
+       )
+
+150 \ 1
+       #_POSIX_TIMERS
+ 200809L
+
+       )
+
+153 \ 1
+       #_POSIX_BARRIERS
+ 200809L
+
+       )
+
+156 \ 1
+       #_POSIX_MESSAGE_PASSING
+ 200809L
+
+       )
+
+159 \ 1
+       #_POSIX_THREAD_PROCESS_SHARED
+ 200809L
+
+       )
+
+162 \ 1
+       #_POSIX_MONOTONIC_CLOCK
+ 0
+
+       )
+
+165 \ 1
+       #_POSIX_CLOCK_SELECTION
+ 200809L
+
+       )
+
+168 \ 1
+       #_POSIX_ADVISORY_INFO
+ 200809L
+
+       )
+
+171 \ 1
+       #_POSIX_IPV6
+ 200809L
+
+       )
+
+174 \ 1
+       #_POSIX_RAW_SOCKETS
+ 200809L
+
+       )
+
+177 \ 1
+       #_POSIX2_CHAR_TERM
+ 200809L
+
+       )
+
+180 \ 1
+       #_POSIX_SPORADIC_SERVER
+ -1
+
+       )
+
+181 \ 1
+       #_POSIX_THREAD_SPORADIC_SERVER
+ -1
+
+       )
+
+184 \ 1
+       #_POSIX_TRACE
+ -1
+
+       )
+
+185 \ 1
+       #_POSIX_TRACE_EVENT_FILTER
+ -1
+
+       )
+
+186 \ 1
+       #_POSIX_TRACE_INHERIT
+ -1
+
+       )
+
+187 \ 1
+       #_POSIX_TRACE_LOG
+ -1
+
+       )
+
+190 \ 1
+       #_POSIX_TYPED_MEMORY_OBJECTS
+ -1
+
+       )
+
+       @/usr/include/bits/pthreadtypes.h
+
+20 #iâdeà
+_BITS_PTHREADTYPES_H
+
+
+21 \ 1
+       #_BITS_PTHREADTYPES_H
+ 1
+
+       )
+
+23 \ 2
+       ~<b\99s/wÜdsize.h
+>
+
+25 #ià
+__WORDSIZE
+ == 64
+
+26 \ 1
+       #__SIZEOF_PTHREAD_ATTR_T
+ 56
+
+       )
+
+27 \ 1
+       #__SIZEOF_PTHREAD_MUTEX_T
+ 40
+
+       )
+
+28 \ 1
+       #__SIZEOF_PTHREAD_MUTEXATTR_T
+ 4
+
+       )
+
+29 \ 1
+       #__SIZEOF_PTHREAD_COND_T
+ 48
+
+       )
+
+30 \ 1
+       #__SIZEOF_PTHREAD_CONDATTR_T
+ 4
+
+       )
+
+31 \ 1
+       #__SIZEOF_PTHREAD_RWLOCK_T
+ 56
+
+       )
+
+32 \ 1
+       #__SIZEOF_PTHREAD_RWLOCKATTR_T
+ 8
+
+       )
+
+33 \ 1
+       #__SIZEOF_PTHREAD_BARRIER_T
+ 32
+
+       )
+
+34 \ 1
+       #__SIZEOF_PTHREAD_BARRIERATTR_T
+ 4
+
+       )
+
+36 \ 1
+       #__SIZEOF_PTHREAD_ATTR_T
+ 36
+
+       )
+
+37 \ 1
+       #__SIZEOF_PTHREAD_MUTEX_T
+ 24
+
+       )
+
+38 \ 1
+       #__SIZEOF_PTHREAD_MUTEXATTR_T
+ 4
+
+       )
+
+39 \ 1
+       #__SIZEOF_PTHREAD_COND_T
+ 48
+
+       )
+
+40 \ 1
+       #__SIZEOF_PTHREAD_CONDATTR_T
+ 4
+
+       )
+
+41 \ 1
+       #__SIZEOF_PTHREAD_RWLOCK_T
+ 32
+
+       )
+
+42 \ 1
+       #__SIZEOF_PTHREAD_RWLOCKATTR_T
+ 8
+
+       )
+
+43 \ 1
+       #__SIZEOF_PTHREAD_BARRIER_T
+ 20
+
+       )
+
+44 \ 1
+       #__SIZEOF_PTHREAD_BARRIERATTR_T
+ 4
+
+       )
+
+50 \e\1d\13\12
+       t±h»ad_t
+;
+
+55 \ 5
+       m__size
+[
+__SIZEOF_PTHREAD_ATTR_T
+];
+
+56 \13\12
+       m__®ign
+;
+
+57 } 
+       t±h»ad_©\8c_t
+;
+
+60 #ià
+__WORDSIZE
+ == 64
+
+61 \e\19
+       s__±h»ad_\9a\8bº®_li¡
+
+
+63 \19
+__±h»ad_\9a\8bº®_li¡
+ *
+       m__´ev
+;
+
+64 \19
+__±h»ad_\9a\8bº®_li¡
+ *
+       m__Ãxt
+;
+
+65 } 
+       t__±h»ad_li¡_t
+;
+
+67 \e\19
+       s__±h»ad_\9a\8bº®_¦i¡
+
+
+69 \19
+__±h»ad_\9a\8bº®_¦i¡
+ *
+       m__Ãxt
+;
+
+70 } 
+       t__±h»ad_¦i¡_t
+;
+
+78 \19
+       s__±h»ad_mu\8bx_s
+
+
+80 \12
+       m__lock
+;
+
+81 \1d\12
+       m__couÁ
+;
+
+82 \12
+       m__owÃr
+;
+
+83 #ià
+__WORDSIZE
+ == 64
+
+84 \1d\12
+       m__nu£rs
+;
+
+88 \12
+       m__k\9ad
+;
+
+89 #ià
+__WORDSIZE
+ == 64
+
+90 \12
+       m__¥\9as
+;
+
+91 
+__±h»ad_li¡_t
+       m__li¡
+;
+
+92 \ 1
+       #__PTHREAD_MUTEX_HAVE_PREV
+ 1
+
+       )
+
+94 \1d\12
+       m__nu£rs
+;
+
+95 
+__ex\8bnsiÚ__
+ union
+
+97 \12
+       m__¥\9as
+;
+
+98 
+__±h»ad_¦i¡_t
+       m__li¡
+;
+
+101 } 
+       m__d©a
+;
+
+102 \ 5
+       m__size
+[
+__SIZEOF_PTHREAD_MUTEX_T
+];
+
+103 \13\12
+       m__®ign
+;
+
+104 } 
+       t±h»ad_mu\8bx_t
+;
+
+108 \ 5
+       m__size
+[
+__SIZEOF_PTHREAD_MUTEXATTR_T
+];
+
+109 \12
+       m__®ign
+;
+
+110 } 
+       t±h»ad_mu\8b\8c_t
+;
+
+119 \12
+       m__lock
+;
+
+120 \1d\12
+       m__fu\8bx
+;
+
+121 
+__ex\8bnsiÚ__
\1d\13\13\12
+       m__tÙ®_£q
+;
+
+122 
+__ex\8bnsiÚ__
\1d\13\13\12
+       m__wakeup_£q
+;
+
+123 
+__ex\8bnsiÚ__
\1d\13\13\12
+       m__wok\92_£q
+;
+
+124 \1e*
+       m__mu\8bx
+;
+
+125 \1d\12
+       m__nwa\99\94s
+;
+
+126 \1d\12
+       m__brßdÿ¡_£q
+;
+
+127 } 
+       m__d©a
+;
+
+128 \ 5
+       m__size
+[
+__SIZEOF_PTHREAD_COND_T
+];
+
+129 
+__ex\8bnsiÚ__
\13\13\12
+       m__®ign
+;
+
+130 } 
+       t±h»ad_cÚd_t
+;
+
+134 \ 5
+       m__size
+[
+__SIZEOF_PTHREAD_CONDATTR_T
+];
+
+135 \12
+       m__®ign
+;
+
+136 } 
+       t±h»ad_cÚd©\8c_t
+;
+
+140 \e\1d\12
+       t±h»ad_key_t
+;
+
+144 \e\12
+       t±h»ad_Úû_t
+;
+
+147 #ià
+def\9aed
+__USE_UNIX98
+ || def\9aed 
+__USE_XOPEN2K
+
+
+152 #ià
+__WORDSIZE
+ == 64
+
+155 \12
+       m__lock
+;
+
+156 \1d\12
+       m__Ä_»ad\94s
+;
+
+157 \1d\12
+       m__»ad\94s_wakeup
+;
+
+158 \1d\12
+       m__wr\99\94_wakeup
+;
+
+159 \1d\12
+       m__Ä_»ad\94s_queued
+;
+
+160 \1d\12
+       m__Ä_wr\99\94s_queued
+;
+
+161 \12
+       m__wr\99\94
+;
+
+162 \12
+       m__sh¬ed
+;
+
+163 \1d\13\12
+       m__·d1
+;
+
+164 \1d\13\12
+       m__·d2
+;
+
+167 \1d\12
+       m__æags
+;
+
+168 } 
+       m__d©a
+;
+
+172 \12
+       m__lock
+;
+
+173 \1d\12
+       m__Ä_»ad\94s
+;
+
+174 \1d\12
+       m__»ad\94s_wakeup
+;
+
+175 \1d\12
+       m__wr\99\94_wakeup
+;
+
+176 \1d\12
+       m__Ä_»ad\94s_queued
+;
+
+177 \1d\12
+       m__Ä_wr\99\94s_queued
+;
+
+180 \1d\ 5
+       m__æags
+;
+
+181 \1d\ 5
+       m__sh¬ed
+;
+
+182 \1d\ 5
+       m__·d1
+;
+
+183 \1d\ 5
+       m__·d2
+;
+
+184 \12
+       m__wr\99\94
+;
+
+185 } 
+       m__d©a
+;
+
+187 \ 5
+       m__size
+[
+__SIZEOF_PTHREAD_RWLOCK_T
+];
+
+188 \13\12
+       m__®ign
+;
+
+189 } 
+       t±h»ad_rwlock_t
+;
+
+193 \ 5
+       m__size
+[
+__SIZEOF_PTHREAD_RWLOCKATTR_T
+];
+
+194 \13\12
+       m__®ign
+;
+
+195 } 
+       t±h»ad_rwlock©\8c_t
+;
+
+199 #ifdeà
+__USE_XOPEN2K
+
+
+201 \evÞ©\9e\90\12
+       t±h»ad_¥\9alock_t
+;
+
+208 \ 5
+       m__size
+[
+__SIZEOF_PTHREAD_BARRIER_T
+];
+
+209 \13\12
+       m__®ign
+;
+
+210 } 
+       t±h»ad_b¬r\9br_t
+;
+
+214 \ 5
+       m__size
+[
+__SIZEOF_PTHREAD_BARRIERATTR_T
+];
+
+215 \12
+       m__®ign
+;
+
+216 } 
+       t±h»ad_b¬r\9b¿\89r_t
+;
+
+220 #ià
+__WORDSIZE
+ == 32
+
+222 \ 1
+       #__þ\97nup_fù_©\8cibu\8b
+       `__©\8cibu\8b__
+ ((
+       `__»g·rm__
+ (1)))
+
+       )
+
+       @/usr/include/bits/select.h
+
+19 #iâdeà
+_SYS_SELECT_H
+
+
+23 \ 2
+       ~<b\99s/wÜdsize.h
+>
+
+26 #ià
+def\9aed
+__GNUC__
+ && __GNUC__ >= 2
+
+28 #ià
+__WORDSIZE
+ == 64
+
+29 \ 1
+       #__FD_ZERO_STOS
+ "¡osq"
+
+       )
+
+31 \ 1
+       #__FD_ZERO_STOS
+ "¡o¦"
+
+       )
+
+34 \ 1
+       #__FD_ZERO
+(
+fd¥
+) \
+
+36 \12
+__d0
+, 
+__d1
+; \
+
+37 
+__asm__
+       `__vÞ©\9ee__
+ ("þd;\84\95; " 
+__FD_ZERO_STOS
+ \
+
+38 : "=c" (
+__d0
+), "=D" (
+__d1
+) \
+
+39 : "a" (0), "0" (\17 (
+fd_£t
+) \
+
+40 / \17 (
+__fd_mask
+)), \
+
+41 "1" (&
+       `__FDS_BITS
+ (
+fd¥
+)[0]) \
+
+43 } \1f0)
+
+       )
+
+49 \ 1
+       #__FD_ZERO
+(
+£t
+) \
+
+51 \1d\12
+__i
+; \
+
+52 
+fd_£t
+ *
+__¬r
+ = (
+£t
+); \
+
+53 \ f
+__i
+ = 0; __\98\17 (
+fd_£t
+è/ \17 (
+__fd_mask
+); ++__i) \
+
+54 
+       `__FDS_BITS
+ (
+__¬r
+)[
+__i
+] = 0; \
+
+55 } \1f0)
+
+       )
+
+59 \ 1
+       #__FD_SET
+(
+d
+, 
+£t
+) \
+
+60 ((\1eè(
+       `__FDS_BITS
+ (
+£t
+)[
+       `__FDELT
+ (
+d
+)] |ð
+       `__FDMASK
+ (d)))
+
+       )
+
+61 \ 1
+       #__FD_CLR
+(
+d
+, 
+£t
+) \
+
+62 ((\1eè(
+       `__FDS_BITS
+ (
+£t
+)[
+       `__FDELT
+ (
+d
+)] &ð~
+       `__FDMASK
+ (d)))
+
+       )
+
+63 \ 1
+       #__FD_ISSET
+(
+d
+, 
+£t
+) \
+
+64 ((
+       `__FDS_BITS
+ (
+£t
+)[
+       `__FDELT
+ (
+d
+)] & 
+       `__FDMASK
+ (d)è!ð0)
+
+       )
+
+       @/usr/include/bits/setjmp.h
+
+20 #iâdeà
+_BITS_SETJMP_H
+
+
+21 \ 1
+       #_BITS_SETJMP_H
+ 1
+
+       )
+
+23 #ià!
+def\9aed
+_SETJMP_H
+ && !def\9aed 
+_PTHREAD_H
+
+
+27 \ 2
+       ~<b\99s/wÜdsize.h
+>
+
+29 #iâdeà
+_ASM
+
+
+31 #ià
+__WORDSIZE
+ == 64
+
+32 \e\13\12
+       t__jmp_buf
+[8];
+
+34 \e\12
+       t__jmp_buf
+[6];
+
+       @/usr/include/bits/sigset.h
+
+21 #iâdef 
+_SIGSET_H_ty³s
+
+
+22 \ 1
+       #_SIGSET_H_ty³s
+ 1
+
+       )
+
+24 \e\12
+       t__sig_©omic_t
+;
+
+28 \ 1
+       #_SIGSET_NWORDS
+ (1024 / (8 * \17 (\1d\13\12)))
+
+       )
+
+31 \1d\13\12
+       m__v®
+[
+_SIGSET_NWORDS
+];
+
+32 } 
+       t__sig£t_t
+;
+
+43 #ià!
+def\9aed
+_SIGSET_H_âs
+ && def\9aed 
+_SIGNAL_H
+
+
+44 \ 1
+       #_SIGSET_H_âs
+ 1
+
+       )
+
+46 #iâdeà
+_EXTERN_INLINE
+
+
+47 \ 1
+       #_EXTERN_INLINE
+__ex\8bº_\9al\9ae
+
+
+       )
+
+51 \ 1
+       #__sigmask
+(
+sig
+) \
+
+52 (((\1d\13\12è1è<< (((
+sig
+è- 1è% (8 * \17 (\1d\13\12))))
+
+       )
+
+55 \ 1
+       #__sigwÜd
+(
+sig
+è(((sigè- 1è/ (8 * \17 (\1d\13\12)))
+
+       )
+
+57 #ià
+def\9aed
+__GNUC__
+ && __GNUC__ >= 2
+
+58 \ 1
+       #__sigem±y£t
+(
+£t
+) \
+
+59 (
+       `__ex\8bnsiÚ__
+ ({ \12
+__út
+ = 
+_SIGSET_NWORDS
+; \
+
+60 
+sig£t_t
+ *
+__£t
+ = (
+£t
+); \
+
+61 \1f--
+__út
+ >ð0è
+__£t
+->
+__v®
+[__cnt] = 0; \
+
+62 0; }))
+
+       )
+
+63 \ 1
+       #__sigf\9el£t
+(
+£t
+) \
+
+64 (
+       `__ex\8bnsiÚ__
+ ({ \12
+__út
+ = 
+_SIGSET_NWORDS
+; \
+
+65 
+sig£t_t
+ *
+__£t
+ = (
+£t
+); \
+
+66 \1f--
+__út
+ >ð0è
+__£t
+->
+__v®
+[__cnt] = ~0UL; \
+
+67 0; }))
+
+       )
+
+69 #ifdeà
+__USE_GNU
+
+
+73 \ 1
+       #__sigi£m±y£t
+(
+£t
+) \
+
+74 (
+       `__ex\8bnsiÚ__
+ ({ \12
+__út
+ = 
+_SIGSET_NWORDS
+; \
+
+75 cڡ 
+sig£t_t
+ *
+__£t
+ = (
+£t
+); \
+
+76 \12
+__»t
+ = 
+__£t
+->
+__v®
+[--
+__út
+]; \
+
+77 \1f!
+__»t
+ && --
+__út
+ >= 0) \
+
+78 
+__»t
+ = 
+__£t
+->
+__v®
+[
+__út
+]; \
+
+79 
+__»t
+ =ð0; }))
+
+       )
+
+80 \ 1
+       #__sigªd£t
+(
+de¡
+, 
+Ëá
+, 
+right
+) \
+
+81 (
+       `__ex\8bnsiÚ__
+ ({ \12
+__út
+ = 
+_SIGSET_NWORDS
+; \
+
+82 
+sig£t_t
+ *
+__de¡
+ = (
+de¡
+); \
+
+83 cڡ 
+sig£t_t
+ *
+__Ëá
+ = (
+Ëá
+); \
+
+84 cڡ 
+sig£t_t
+ *
+__right
+ = (
+right
+); \
+
+85 \1f--
+__út
+ >= 0) \
+
+86 
+__de¡
+->
+__v®
+[
+__út
+] = (
+__Ëá
+->__val[__cnt] \
+
+87 & 
+__right
+->
+__v®
+[
+__út
+]); \
+
+88 0; }))
+
+       )
+
+89 \ 1
+       #__sigܣt
+(
+de¡
+, 
+Ëá
+, 
+right
+) \
+
+90 (
+       `__ex\8bnsiÚ__
+ ({ \12
+__út
+ = 
+_SIGSET_NWORDS
+; \
+
+91 
+sig£t_t
+ *
+__de¡
+ = (
+de¡
+); \
+
+92 cڡ 
+sig£t_t
+ *
+__Ëá
+ = (
+Ëá
+); \
+
+93 cڡ 
+sig£t_t
+ *
+__right
+ = (
+right
+); \
+
+94 \1f--
+__út
+ >= 0) \
+
+95 
+__de¡
+->
+__v®
+[
+__út
+] = (
+__Ëá
+->__val[__cnt] \
+
+96 | 
+__right
+->
+__v®
+[
+__út
+]); \
+
+97 0; }))
+
+       )
+
+104 \r\12
+__sigismemb\94
+ (
+__cڡ
+__sig£t_t
+ *, \12);
+
+105 \r\12
+__sigadd£t
+ (
+__sig£t_t
+ *, \12);
+
+106 \r\12
+__sigd\96£t
+ (
+__sig£t_t
+ *, \12);
+
+108 #ifdeà
+__USE_EXTERN_INLINES
+
+
+109 \ 1
+       #__SIGSETFN
+(
+NAME
+, 
+BODY
+, 
+CONST
+) \
+
+110 
+_EXTERN_INLINE
\12\
+
+111 
+       `NAME
+ (
+CONST
+__sig£t_t
+ *
+__£t
+, \12
+__sig
+) \
+
+113 \1d\13\12
+__mask
+ = 
+       `__sigmask
+ (
+__sig
+); \
+
+114 \1d\13\12
+__wÜd
+ = 
+       `__sigwÜd
+ (
+__sig
+); \
+
+115 \15 
+BODY
+; \
+
+116 }
+
+       )
+
+118 
+__SIGSETFN
+ (
+__sigismemb\94
+, (
+__£t
+->
+__v®
+[
+__wÜd
+] & 
+__mask
+è? 1 : 0, 
+__cڡ
+)
+
+119 
+__SIGSETFN
+ (
+__sigadd£t
+, ((
+__£t
+->
+__v®
+[
+__wÜd
+] |ð
+__mask
+), 0), )
+
+120 
+__SIGSETFN
+ (
+__sigd\96£t
+, ((
+__£t
+->
+__v®
+[
+__wÜd
+] &ð~
+__mask
+), 0), )
+
+122 #undeà
+__SIGSETFN
+
+
+       @/usr/include/bits/sockaddr.h
+
+24 #iâdeà
+_BITS_SOCKADDR_H
+
+
+25 \ 1
+       #_BITS_SOCKADDR_H
+ 1
+
+       )
+
+29 \e\1d\16\12
+       t§_çm\9ey_t
+;
+
+35 \ 1
+       #__SOCKADDR_COMMON
+(
+§_´efix
+) \
+
+36 
+§_çm\9ey_t
+§_´efix
+##
+çm\9ey
+
+
+       )
+
+38 \ 1
+       #__SOCKADDR_COMMON_SIZE
+ (\17 (\1d\16\12))
+
+       )
+
+       @/usr/include/bits/socket.h
+
+21 #iâdeà
+__BITS_SOCKET_H
+
+
+22 \ 1
+       #__BITS_SOCKET_H
+
+
+       )
+
+24 #iâdeà
+_SYS_SOCKET_H
+
+
+28 \ 1
+       #__Ãed_size_t
+
+
+       )
+
+29 \ 2
+       ~<¡ddef.h
+>
+
+31 \ 2
+       ~<sys/ty³s.h
+>
+
+34 #iâdeà
+__sockËn_t_def\9aed
+
+
+35 \e
+__sockËn_t
+       tsockËn_t
+;
+
+36 \ 1
+       #__sockËn_t_def\9aed
+
+
+       )
+
+40 \f
+       e__sock\91_ty³
+
+
+42 
+       mSOCK_STREAM
+ = 1,
+
+44 \ 1
+       #SOCK_STREAM
+SOCK_STREAM
+
+
+       )
+
+45 
+       mSOCK_DGRAM
+ = 2,
+
+47 \ 1
+       #SOCK_DGRAM
+SOCK_DGRAM
+
+
+       )
+
+48 
+       mSOCK_RAW
+ = 3,
+
+49 \ 1
+       #SOCK_RAW
+SOCK_RAW
+
+
+       )
+
+50 
+       mSOCK_RDM
+ = 4,
+
+51 \ 1
+       #SOCK_RDM
+SOCK_RDM
+
+
+       )
+
+52 
+       mSOCK_SEQPACKET
+ = 5,
+
+54 \ 1
+       #SOCK_SEQPACKET
+SOCK_SEQPACKET
+
+
+       )
+
+55 
+       mSOCK_DCCP
+ = 6,
+
+56 \ 1
+       #SOCK_DCCP
+SOCK_DCCP
+
+
+       )
+
+57 
+       mSOCK_PACKET
+ = 10,
+
+60 \ 1
+       #SOCK_PACKET
+SOCK_PACKET
+
+
+       )
+
+65 
+       mSOCK_CLOEXEC
+ = 02000000,
+
+67 \ 1
+       #SOCK_CLOEXEC
+SOCK_CLOEXEC
+
+
+       )
+
+68 
+       mSOCK_NONBLOCK
+ = 04000
+
+70 \ 1
+       #SOCK_NONBLOCK
+SOCK_NONBLOCK
+
+
+       )
+
+74 \ 1
+       #PF_UNSPEC
+ 0
+
+       )
+
+75 \ 1
+       #PF_LOCAL
+ 1
+
+       )
+
+76 \ 1
+       #PF_UNIX
+PF_LOCAL
+
+
+       )
+
+77 \ 1
+       #PF_FILE
+PF_LOCAL
+
+
+       )
+
+78 \ 1
+       #PF_INET
+ 2
+
+       )
+
+79 \ 1
+       #PF_AX25
+ 3
+
+       )
+
+80 \ 1
+       #PF_IPX
+ 4
+
+       )
+
+81 \ 1
+       #PF_APPLETALK
+ 5
+
+       )
+
+82 \ 1
+       #PF_NETROM
+ 6
+
+       )
+
+83 \ 1
+       #PF_BRIDGE
+ 7
+
+       )
+
+84 \ 1
+       #PF_ATMPVC
+ 8
+
+       )
+
+85 \ 1
+       #PF_X25
+ 9
+
+       )
+
+86 \ 1
+       #PF_INET6
+ 10
+
+       )
+
+87 \ 1
+       #PF_ROSE
+ 11
+
+       )
+
+88 \ 1
+       #PF_DECÃt
+ 12
+
+       )
+
+89 \ 1
+       #PF_NETBEUI
+ 13
+
+       )
+
+90 \ 1
+       #PF_SECURITY
+ 14
+
+       )
+
+91 \ 1
+       #PF_KEY
+ 15
+
+       )
+
+92 \ 1
+       #PF_NETLINK
+ 16
+
+       )
+
+93 \ 1
+       #PF_ROUTE
+PF_NETLINK
+
+
+       )
+
+94 \ 1
+       #PF_PACKET
+ 17
+
+       )
+
+95 \ 1
+       #PF_ASH
+ 18
+
+       )
+
+96 \ 1
+       #PF_ECONET
+ 19
+
+       )
+
+97 \ 1
+       #PF_ATMSVC
+ 20
+
+       )
+
+98 \ 1
+       #PF_RDS
+ 21
+
+       )
+
+99 \ 1
+       #PF_SNA
+ 22
+
+       )
+
+100 \ 1
+       #PF_IRDA
+ 23
+
+       )
+
+101 \ 1
+       #PF_PPPOX
+ 24
+
+       )
+
+102 \ 1
+       #PF_WANPIPE
+ 25
+
+       )
+
+103 \ 1
+       #PF_LLC
+ 26
+
+       )
+
+104 \ 1
+       #PF_CAN
+ 29
+
+       )
+
+105 \ 1
+       #PF_TIPC
+ 30
+
+       )
+
+106 \ 1
+       #PF_BLUETOOTH
+ 31
+
+       )
+
+107 \ 1
+       #PF_IUCV
+ 32
+
+       )
+
+108 \ 1
+       #PF_RXRPC
+ 33
+
+       )
+
+109 \ 1
+       #PF_ISDN
+ 34
+
+       )
+
+110 \ 1
+       #PF_PHONET
+ 35
+
+       )
+
+111 \ 1
+       #PF_IEEE802154
+ 36
+
+       )
+
+112 \ 1
+       #PF_CAIF
+ 37
+
+       )
+
+113 \ 1
+       #PF_ALG
+ 38
+
+       )
+
+114 \ 1
+       #PF_MAX
+ 39
+
+       )
+
+117 \ 1
+       #AF_UNSPEC
+PF_UNSPEC
+
+
+       )
+
+118 \ 1
+       #AF_LOCAL
+PF_LOCAL
+
+
+       )
+
+119 \ 1
+       #AF_UNIX
+PF_UNIX
+
+
+       )
+
+120 \ 1
+       #AF_FILE
+PF_FILE
+
+
+       )
+
+121 \ 1
+       #AF_INET
+PF_INET
+
+
+       )
+
+122 \ 1
+       #AF_AX25
+PF_AX25
+
+
+       )
+
+123 \ 1
+       #AF_IPX
+PF_IPX
+
+
+       )
+
+124 \ 1
+       #AF_APPLETALK
+PF_APPLETALK
+
+
+       )
+
+125 \ 1
+       #AF_NETROM
+PF_NETROM
+
+
+       )
+
+126 \ 1
+       #AF_BRIDGE
+PF_BRIDGE
+
+
+       )
+
+127 \ 1
+       #AF_ATMPVC
+PF_ATMPVC
+
+
+       )
+
+128 \ 1
+       #AF_X25
+PF_X25
+
+
+       )
+
+129 \ 1
+       #AF_INET6
+PF_INET6
+
+
+       )
+
+130 \ 1
+       #AF_ROSE
+PF_ROSE
+
+
+       )
+
+131 \ 1
+       #AF_DECÃt
+PF_DECÃt
+
+
+       )
+
+132 \ 1
+       #AF_NETBEUI
+PF_NETBEUI
+
+
+       )
+
+133 \ 1
+       #AF_SECURITY
+PF_SECURITY
+
+
+       )
+
+134 \ 1
+       #AF_KEY
+PF_KEY
+
+
+       )
+
+135 \ 1
+       #AF_NETLINK
+PF_NETLINK
+
+
+       )
+
+136 \ 1
+       #AF_ROUTE
+PF_ROUTE
+
+
+       )
+
+137 \ 1
+       #AF_PACKET
+PF_PACKET
+
+
+       )
+
+138 \ 1
+       #AF_ASH
+PF_ASH
+
+
+       )
+
+139 \ 1
+       #AF_ECONET
+PF_ECONET
+
+
+       )
+
+140 \ 1
+       #AF_ATMSVC
+PF_ATMSVC
+
+
+       )
+
+141 \ 1
+       #AF_RDS
+PF_RDS
+
+
+       )
+
+142 \ 1
+       #AF_SNA
+PF_SNA
+
+
+       )
+
+143 \ 1
+       #AF_IRDA
+PF_IRDA
+
+
+       )
+
+144 \ 1
+       #AF_PPPOX
+PF_PPPOX
+
+
+       )
+
+145 \ 1
+       #AF_WANPIPE
+PF_WANPIPE
+
+
+       )
+
+146 \ 1
+       #AF_LLC
+PF_LLC
+
+
+       )
+
+147 \ 1
+       #AF_CAN
+PF_CAN
+
+
+       )
+
+148 \ 1
+       #AF_TIPC
+PF_TIPC
+
+
+       )
+
+149 \ 1
+       #AF_BLUETOOTH
+PF_BLUETOOTH
+
+
+       )
+
+150 \ 1
+       #AF_IUCV
+PF_IUCV
+
+
+       )
+
+151 \ 1
+       #AF_RXRPC
+PF_RXRPC
+
+
+       )
+
+152 \ 1
+       #AF_ISDN
+PF_ISDN
+
+
+       )
+
+153 \ 1
+       #AF_PHONET
+PF_PHONET
+
+
+       )
+
+154 \ 1
+       #AF_IEEE802154
+PF_IEEE802154
+
+
+       )
+
+155 \ 1
+       #AF_CAIF
+PF_CAIF
+
+
+       )
+
+156 \ 1
+       #AF_ALG
+PF_ALG
+
+
+       )
+
+157 \ 1
+       #AF_MAX
+PF_MAX
+
+
+       )
+
+163 \ 1
+       #SOL_RAW
+ 255
+
+       )
+
+164 \ 1
+       #SOL_DECNET
+ 261
+
+       )
+
+165 \ 1
+       #SOL_X25
+ 262
+
+       )
+
+166 \ 1
+       #SOL_PACKET
+ 263
+
+       )
+
+167 \ 1
+       #SOL_ATM
+ 264
+
+       )
+
+168 \ 1
+       #SOL_AAL
+ 265
+
+       )
+
+169 \ 1
+       #SOL_IRDA
+ 266
+
+       )
+
+172 \ 1
+       #SOMAXCONN
+ 128
+
+       )
+
+175 \ 2
+       ~<b\99s/sockaddr.h
+>
+
+178 \19
+       ssockaddr
+
+
+180 
+__SOCKADDR_COMMON
+ (
+§_
+);
+
+181 \ 5
+       m§_d©a
+[14];
+
+187 \ 1
+       #__ss_®igÁy³
\1d\13\12
+
+       )
+
+188 \ 1
+       #_SS_SIZE
+ 128
+
+       )
+
+189 \ 1
+       #_SS_PADSIZE
+ (
+_SS_SIZE
+ - (2 * \17 (
+__ss_®igÁy³
+)))
+
+       )
+
+191 \19
+       ssockaddr_¡Üage
+
+
+193 
+__SOCKADDR_COMMON
+ (
+ss_
+);
+
+194 
+__ss_®igÁy³
+       m__ss_®ign
+;
+
+195 \ 5
+       m__ss_·dd\9ag
+[
+_SS_PADSIZE
+];
+
+202 
+       mMSG_OOB
+ = 0x01,
+
+203 \ 1
+       #MSG_OOB
+MSG_OOB
+
+
+       )
+
+204 
+       mMSG_PEEK
+ = 0x02,
+
+205 \ 1
+       #MSG_PEEK
+MSG_PEEK
+
+
+       )
+
+206 
+       mMSG_DONTROUTE
+ = 0x04,
+
+207 \ 1
+       #MSG_DONTROUTE
+MSG_DONTROUTE
+
+
+       )
+
+208 #ifdeà
+__USE_GNU
+
+
+210 
+       mMSG_TRYHARD
+ = 
+MSG_DONTROUTE
+,
+
+211 \ 1
+       #MSG_TRYHARD
+MSG_DONTROUTE
+
+
+       )
+
+213 
+       mMSG_CTRUNC
+ = 0x08,
+
+214 \ 1
+       #MSG_CTRUNC
+MSG_CTRUNC
+
+
+       )
+
+215 
+       mMSG_PROXY
+ = 0x10,
+
+216 \ 1
+       #MSG_PROXY
+MSG_PROXY
+
+
+       )
+
+217 
+       mMSG_TRUNC
+ = 0x20,
+
+218 \ 1
+       #MSG_TRUNC
+MSG_TRUNC
+
+
+       )
+
+219 
+       mMSG_DONTWAIT
+ = 0x40,
+
+220 \ 1
+       #MSG_DONTWAIT
+MSG_DONTWAIT
+
+
+       )
+
+221 
+       mMSG_EOR
+ = 0x80,
+
+222 \ 1
+       #MSG_EOR
+MSG_EOR
+
+
+       )
+
+223 
+       mMSG_WAITALL
+ = 0x100,
+
+224 \ 1
+       #MSG_WAITALL
+MSG_WAITALL
+
+
+       )
+
+225 
+       mMSG_FIN
+ = 0x200,
+
+226 \ 1
+       #MSG_FIN
+MSG_FIN
+
+
+       )
+
+227 
+       mMSG_SYN
+ = 0x400,
+
+228 \ 1
+       #MSG_SYN
+MSG_SYN
+
+
+       )
+
+229 
+       mMSG_CONFIRM
+ = 0x800,
+
+230 \ 1
+       #MSG_CONFIRM
+MSG_CONFIRM
+
+
+       )
+
+231 
+       mMSG_RST
+ = 0x1000,
+
+232 \ 1
+       #MSG_RST
+MSG_RST
+
+
+       )
+
+233 
+       mMSG_ERRQUEUE
+ = 0x2000,
+
+234 \ 1
+       #MSG_ERRQUEUE
+MSG_ERRQUEUE
+
+
+       )
+
+235 
+       mMSG_NOSIGNAL
+ = 0x4000,
+
+236 \ 1
+       #MSG_NOSIGNAL
+MSG_NOSIGNAL
+
+
+       )
+
+237 
+       mMSG_MORE
+ = 0x8000,
+
+238 \ 1
+       #MSG_MORE
+MSG_MORE
+
+
+       )
+
+239 
+       mMSG_WAITFORONE
+ = 0x10000,
+
+240 \ 1
+       #MSG_WAITFORONE
+MSG_WAITFORONE
+
+
+       )
+
+242 
+       mMSG_CMSG_CLOEXEC
+ = 0x40000000
+
+245 \ 1
+       #MSG_CMSG_CLOEXEC
+MSG_CMSG_CLOEXEC
+
+
+       )
+
+251 \19
+       smsghdr
+
+
+253 \1e*
+       mmsg_Çme
+;
+
+254 
+sockËn_t
+       mmsg_Çm\96\92
+;
+
+256 \19
+iovec
+ *
+       mmsg_iov
+;
+
+257 
+size_t
+       mmsg_iovËn
+;
+
+259 \1e*
+       mmsg_cÚ\8cÞ
+;
+
+260 
+size_t
+       mmsg_cÚ\8cÞËn
+;
+
+265 \12
+       mmsg_æags
+;
+
+268 #ifdeà
+__USE_GNU
+
+
+270 \19
+       smmsghdr
+
+
+272 \19
+msghdr
+       mmsg_hdr
+;
+
+273 \1d\12
+       mmsg_Ën
+;
+
+278 \19
+       scmsghdr
+
+
+280 
+size_t
+       mcmsg_Ën
+;
+
+285 \12
+       mcmsg_Ëv\96
+;
+
+286 \12
+       mcmsg_ty³
+;
+
+287 #ià(!
+def\9aed
+__STRICT_ANSI__
+ && 
+__GNUC__
+ >ð2è|| 
+__STDC_VERSION__
+ >= 199901L
+
+288 
+__ex\8bnsiÚ__
\1d\ 5
+__cmsg_d©a
+       m__æex¬r
+;
+
+293 #ià(!
+def\9aed
+__STRICT_ANSI__
+ && 
+__GNUC__
+ >ð2è|| 
+__STDC_VERSION__
+ >= 199901L
+
+294 \ 1
+       #CMSG_DATA
+(
+cmsg
+è((cmsg)->
+__cmsg_d©a
+)
+
+       )
+
+296 \ 1
+       #CMSG_DATA
+(
+cmsg
+è((\1d\ 5*è((\19
+cmsghdr
+ *è(cmsgè+ 1))
+
+       )
+
+298 \ 1
+       #CMSG_NXTHDR
+(
+mhdr
+, 
+cmsg
+       `__cmsg_nxthdr
+ (mhdr, cmsg)
+
+       )
+
+299 \ 1
+       #CMSG_FIRSTHDR
+(
+mhdr
+) \
+
+300 ((
+size_t
+è(
+mhdr
+)->
+msg_cÚ\8cÞËn
+ >ð\17 (\19
+cmsghdr
+) \
+
+301 ? (\19
+cmsghdr
+ *è(
+mhdr
+)->
+msg_cÚ\8cÞ
+ : (\19cmsghd¸*è0)
+
+       )
+
+302 \ 1
+       #CMSG_ALIGN
+(
+Ën
+è((Ö\92è+ \17 (
+size_t
+) - 1) \
+
+303 & (
+size_t
+è~(\17 (size_tè- 1))
+
+       )
+
+304 \ 1
+       #CMSG_SPACE
+(
+Ën
+è(
+       `CMSG_ALIGN
+ (len) \
+
+305 + 
+       `CMSG_ALIGN
+ (\17 (\19
+cmsghdr
+)))
+
+       )
+
+306 \ 1
+       #CMSG_LEN
+(
+Ën
+è(
+       `CMSG_ALIGN
+ (\17 (\19
+cmsghdr
+)è+ (Ën))
+
+       )
+
+308 \r\19
+cmsghdr
+ *
+       $__cmsg_nxthdr
+ (\19
+msghdr
+ *
+__mhdr
+,
+
+309 \19
+cmsghdr
+ *
+__cmsg
+__THROW
+;
+
+310 #ifdeà
+__USE_EXTERN_INLINES
+
+
+311 #iâdeà
+_EXTERN_INLINE
+
+
+312 \ 1
+       #_EXTERN_INLINE
+__ex\8bº_\9al\9ae
+
+
+       )
+
+314 
+_EXTERN_INLINE
\19
+cmsghdr
+ *
+
+315 
+       `__NTH
+ (
+       $__cmsg_nxthdr
+ (\19
+msghdr
+ *
+__mhdr
+, \19
+cmsghdr
+ *
+__cmsg
+))
+
+317 ià((
+size_t
+__cmsg
+->
+cmsg_Ën
+ < \17 (\19
+cmsghdr
+))
+
+321 
+__cmsg
+ = (\19
+cmsghdr
+ *) ((\1d\ 5*) __cmsg
+
+322 + 
+       `CMSG_ALIGN
+ (
+__cmsg
+->
+cmsg_Ën
+));
+
+323 ià((\1d\ 5*è(
+__cmsg
+ + 1è> ((\1d\ 5
+__mhdr
+->
+msg_cÚ\8cÞ
+
+
+324 + 
+__mhdr
+->
+msg_cÚ\8cÞËn
+)
+
+325 || ((\1d\ 5
+__cmsg
+ + 
+       `CMSG_ALIGN
+ (__cmsg->
+cmsg_Ën
+)
+
+326 > ((\1d\ 5
+__mhdr
+->
+msg_cÚ\8cÞ
+ + __mhdr->
+msg_cÚ\8cÞËn
+)))
+
+329 \15 
+__cmsg
+;
+
+330 
+       }
+}
+
+337 
+       mSCM_RIGHTS
+ = 0x01
+
+338 \ 1
+       #SCM_RIGHTS
+SCM_RIGHTS
+
+
+       )
+
+339 #ifdeà
+__USE_GNU
+
+
+340 , 
+       mSCM_CREDENTIALS
+ = 0x02
+
+341 \ 1
+       #SCM_CREDENTIALS
+SCM_CREDENTIALS
+
+
+       )
+
+345 #ifdeà
+__USE_GNU
+
+
+347 \19
+       suüed
+
+
+349 
+pid_t
+       mpid
+;
+
+350 
+uid_t
+       muid
+;
+
+351 
+gid_t
+       mgid
+;
+
+356 #ià!
+def\9aed
+__USE_MISC
+ && !def\9aed 
+__USE_GNU
+
+
+357 #iâdeà
+FIOGETOWN
+
+
+358 \ 1
+       #__SYS_SOCKET_H_undef_FIOGETOWN
+
+
+       )
+
+360 #iâdeà
+FIOSETOWN
+
+
+361 \ 1
+       #__SYS_SOCKET_H_undef_FIOSETOWN
+
+
+       )
+
+363 #iâdeà
+SIOCATMARK
+
+
+364 \ 1
+       #__SYS_SOCKET_H_undef_SIOCATMARK
+
+
+       )
+
+366 #iâdeà
+SIOCGPGRP
+
+
+367 \ 1
+       #__SYS_SOCKET_H_undef_SIOCGPGRP
+
+
+       )
+
+369 #iâdeà
+SIOCGSTAMP
+
+
+370 \ 1
+       #__SYS_SOCKET_H_undef_SIOCGSTAMP
+
+
+       )
+
+372 #iâdeà
+SIOCGSTAMPNS
+
+
+373 \ 1
+       #__SYS_SOCKET_H_undef_SIOCGSTAMPNS
+
+
+       )
+
+375 #iâdeà
+SIOCSPGRP
+
+
+376 \ 1
+       #__SYS_SOCKET_H_undef_SIOCSPGRP
+
+
+       )
+
+381 \ 2
+       ~<asm/sock\91.h
+>
+
+383 #ià!
+def\9aed
+__USE_MISC
+ && !def\9aed 
+__USE_GNU
+
+
+384 #ifdeà
+__SYS_SOCKET_H_undef_FIOGETOWN
+
+
+385 #undeà
+__SYS_SOCKET_H_undef_FIOGETOWN
+
+
+386 #undeà
+FIOGETOWN
+
+
+388 #ifdeà
+__SYS_SOCKET_H_undef_FIOSETOWN
+
+
+389 #undeà
+__SYS_SOCKET_H_undef_FIOSETOWN
+
+
+390 #undeà
+FIOSETOWN
+
+
+392 #ifdeà
+__SYS_SOCKET_H_undef_SIOCATMARK
+
+
+393 #undeà
+__SYS_SOCKET_H_undef_SIOCATMARK
+
+
+394 #undeà
+SIOCATMARK
+
+
+396 #ifdeà
+__SYS_SOCKET_H_undef_SIOCGPGRP
+
+
+397 #undeà
+__SYS_SOCKET_H_undef_SIOCGPGRP
+
+
+398 #undeà
+SIOCGPGRP
+
+
+400 #ifdeà
+__SYS_SOCKET_H_undef_SIOCGSTAMP
+
+
+401 #undeà
+__SYS_SOCKET_H_undef_SIOCGSTAMP
+
+
+402 #undeà
+SIOCGSTAMP
+
+
+404 #ifdeà
+__SYS_SOCKET_H_undef_SIOCGSTAMPNS
+
+
+405 #undeà
+__SYS_SOCKET_H_undef_SIOCGSTAMPNS
+
+
+406 #undeà
+SIOCGSTAMPNS
+
+
+408 #ifdeà
+__SYS_SOCKET_H_undef_SIOCSPGRP
+
+
+409 #undeà
+__SYS_SOCKET_H_undef_SIOCSPGRP
+
+
+410 #undeà
+SIOCSPGRP
+
+
+415 \19
+       sl\9ag\94
+
+
+417 \12
+       ml_Úoff
+;
+
+418 \12
+       ml_l\9ag\94
+;
+
+422 
+__BEGIN_DECLS
+
+
+429 \r\12
+»cvmmsg
+ (\12
+__fd
+, \19
+mmsghdr
+ *
+__vmes§ges
+,
+
+430 \1d\12
+__vËn
+, \12
+__æags
+,
+
+431 
+__cڡ
\19
+time¥ec
+ *
+__tmo
+);
+
+433 
+       g__END_DECLS
+
+
+       @/usr/include/bits/socket2.h
+
+20 #iâdeà
+_SYS_SOCKET_H
+
+
+24 \r
+ssize_t
+__»cv_chk
+ (\12
+__fd
+, \1e*
+__buf
+, 
+size_t
+__n
+, size_\88
+__buæ\92
+,
+
+25 \12
+__æags
+);
+
+26 \r
+ssize_t
+__REDIRECT
+ (
+__»cv_®\9fs
+, (\12
+__fd
+, \1e*
+__buf
+, 
+size_t
+__n
+,
+
+27 \12
+__æags
+), 
+»cv
+);
+
+28 \r
+ssize_t
+__REDIRECT
+ (
+__»cv_chk_w¬n
+,
+
+29 (\12
+__fd
+, \1e*
+__buf
+, 
+size_t
+__n
+, size_\88
+__buæ\92
+,
+
+30 \12
+__æags
+), 
+__»cv_chk
+)
+
+31 
+__w‚\89r
+ ("recv called with bigger\86ength\81han size of destination "
+
+34 
+__ex\8bº_®ways_\9al\9ae
+ssize_t
+
+
+35 
+       $»cv
+ (\12
+__fd
+, \1e*
+__buf
+, 
+size_t
+__n
+, \12
+__æags
+)
+
+37 ià(
+       `__bos0
+ (
+__buf
+è!ð(
+size_t
+) -1)
+
+39 ià(!
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__n
+))
+
+40 \15 
+       `__»cv_chk
+ (
+__fd
+, 
+__buf
+, 
+__n
+, 
+       `__bos0
+ (__buf), 
+__æags
+);
+
+42 ià(
+__n
+ > 
+       `__bos0
+ (
+__buf
+))
+
+43 \15 
+       `__»cv_chk_w¬n
+ (
+__fd
+, 
+__buf
+, 
+__n
+, 
+       `__bos0
+ (__buf), 
+__æags
+);
+
+45 \15 
+       `__»cv_®\9fs
+ (
+__fd
+, 
+__buf
+, 
+__n
+, 
+__æags
+);
+
+46 
+       }
+}
+
+48 \r
+ssize_t
+__»cväom_chk
+ (\12
+__fd
+, \1e*
+__»¡riù
+__buf
+, 
+size_t
+__n
+,
+
+49 
+size_t
+__buæ\92
+, \12
+__æags
+,
+
+50 
+__SOCKADDR_ARG
+__addr
+,
+
+51 
+sockËn_t
+ *
+__»¡riù
+__addr_Ën
+);
+
+52 \r
+ssize_t
+__REDIRECT
+ (
+__»cväom_®\9fs
+,
+
+53 (\12
+__fd
+, \1e*
+__»¡riù
+__buf
+, 
+size_t
+__n
+,
+
+54 \12
+__æags
+, 
+__SOCKADDR_ARG
+__addr
+,
+
+55 
+sockËn_t
+ *
+__»¡riù
+__addr_Ën
+), 
+»cväom
+);
+
+56 \r
+ssize_t
+__REDIRECT
+ (
+__»cväom_chk_w¬n
+,
+
+57 (\12
+__fd
+, \1e*
+__»¡riù
+__buf
+, 
+size_t
+__n
+,
+
+58 
+size_t
+__buæ\92
+, \12
+__æags
+,
+
+59 
+__SOCKADDR_ARG
+__addr
+,
+
+60 
+sockËn_t
+ *
+__»¡riù
+__addr_Ën
+), 
+__»cväom_chk
+)
+
+61 
+__w‚\89r
+ ("recvfrom called with bigger\86ength\81han size of "
+
+64 
+__ex\8bº_®ways_\9al\9ae
+ssize_t
+
+
+65 
+       $»cväom
+ (\12
+__fd
+, \1e*
+__»¡riù
+__buf
+, 
+size_t
+__n
+, \12
+__æags
+,
+
+66 
+__SOCKADDR_ARG
+__addr
+, 
+sockËn_t
+ *
+__»¡riù
+__addr_Ën
+)
+
+68 ià(
+       `__bos0
+ (
+__buf
+è!ð(
+size_t
+) -1)
+
+70 ià(!
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__n
+))
+
+71 \15 
+       `__»cväom_chk
+ (
+__fd
+, 
+__buf
+, 
+__n
+, 
+       `__bos0
+ (__buf), 
+__æags
+,
+
+72 
+__addr
+, 
+__addr_Ën
+);
+
+73 ià(
+__n
+ > 
+       `__bos0
+ (
+__buf
+))
+
+74 \15 
+       `__»cväom_chk_w¬n
+ (
+__fd
+, 
+__buf
+, 
+__n
+, 
+       `__bos0
+ (__buf), 
+__æags
+,
+
+75 
+__addr
+, 
+__addr_Ën
+);
+
+77 \15 
+       `__»cväom_®\9fs
+ (
+__fd
+, 
+__buf
+, 
+__n
+, 
+__æags
+, 
+__addr
+, 
+__addr_Ën
+);
+
+78 
+       }
+}
+
+       @/usr/include/bits/stat.h
+
+19 #ià!
+def\9aed
+_SYS_STAT_H
+ && !def\9aed 
+_FCNTL_H
+
+
+23 #iâdeà
+_BITS_STAT_H
+
+
+24 \ 1
+       #_BITS_STAT_H
+ 1
+
+       )
+
+27 \ 1
+       #_STAT_VER_KERNEL
+ 0
+
+       )
+
+29 #ià
+__WORDSIZE
+ == 32
+
+30 \ 1
+       #_STAT_VER_SVR4
+ 2
+
+       )
+
+31 \ 1
+       #_STAT_VER_LINUX
+ 3
+
+       )
+
+34 \ 1
+       #_MKNOD_VER_LINUX
+ 1
+
+       )
+
+35 \ 1
+       #_MKNOD_VER_SVR4
+ 2
+
+       )
+
+36 \ 1
+       #_MKNOD_VER
+_MKNOD_VER_LINUX
+
+
+       )
+
+38 \ 1
+       #_STAT_VER_LINUX
+ 1
+
+       )
+
+41 \ 1
+       #_MKNOD_VER_LINUX
+ 0
+
+       )
+
+44 \ 1
+       #_STAT_VER
+_STAT_VER_LINUX
+
+
+       )
+
+46 \19
+       s¡©
+
+
+48 
+__dev_t
+       m¡_dev
+;
+
+49 #ià
+__WORDSIZE
+ == 32
+
+50 \1d\16\12
+       m__·d1
+;
+
+52 #ià
+__WORDSIZE
+ =ð64 || !
+def\9aed
+__USE_FILE_OFFSET64
+
+
+53 
+__\9ao_t
+       m¡_\9ao
+;
+
+55 
+__\9ao_t
+       m__¡_\9ao
+;
+
+57 #ià
+__WORDSIZE
+ == 32
+
+58 
+__mode_t
+       m¡_mode
+;
+
+59 
+__ƚk_t
+       m¡_Æ\9ak
+;
+
+61 
+__ƚk_t
+       m¡_Æ\9ak
+;
+
+62 
+__mode_t
+       m¡_mode
+;
+
+64 
+__uid_t
+       m¡_uid
+;
+
+65 
+__gid_t
+       m¡_gid
+;
+
+66 #ià
+__WORDSIZE
+ == 64
+
+67 \12
+       m__·d0
+;
+
+69 
+__dev_t
+       m¡_rdev
+;
+
+70 #ià
+__WORDSIZE
+ == 32
+
+71 \1d\16\12
+       m__·d2
+;
+
+73 #ià
+__WORDSIZE
+ =ð64 || !
+def\9aed
+__USE_FILE_OFFSET64
+
+
+74 
+__off_t
+       m¡_size
+;
+
+76 
+__off64_t
+       m¡_size
+;
+
+78 
+__blksize_t
+       m¡_blksize
+;
+
+79 #ià
+__WORDSIZE
+ =ð64 || !
+def\9aed
+__USE_FILE_OFFSET64
+
+
+80 
+__blkút_t
+       m¡_blocks
+;
+
+82 
+__blkút64_t
+       m¡_blocks
+;
+
+84 #ià
+def\9aed
+__USE_MISC
+ || def\9aed 
+__USE_XOPEN2K8
+
+
+91 \19
+time¥ec
+       m¡_©im
+;
+
+92 \19
+time¥ec
+       m¡_mtim
+;
+
+93 \19
+time¥ec
+       m¡_ùim
+;
+
+94 \ 1
+       #¡_©ime
+¡_©im
+.
+tv_£c
+
+
+       )
+
+95 \ 1
+       #¡_mtime
+¡_mtim
+.
+tv_£c
+
+
+       )
+
+96 \ 1
+       #¡_ùime
+¡_ùim
+.
+tv_£c
+
+
+       )
+
+98 
+__time_t
+       m¡_©ime
+;
+
+99 \1d\13\12
+       m¡_©im\92£c
+;
+
+100 
+__time_t
+       m¡_mtime
+;
+
+101 \1d\13\12
+       m¡_mtim\92£c
+;
+
+102 
+__time_t
+       m¡_ùime
+;
+
+103 \1d\13\12
+       m¡_ùim\92£c
+;
+
+105 #ià
+__WORDSIZE
+ == 64
+
+106 \13\12
+       m__unu£d
+[3];
+
+108 #iâdeà
+__USE_FILE_OFFSET64
+
+
+109 \1d\13\12
+       m__unu£d4
+;
+
+110 \1d\13\12
+       m__unu£d5
+;
+
+112 
+__\9ao64_t
+       m¡_\9ao
+;
+
+117 #ifdeà
+__USE_LARGEFILE64
+
+
+119 \19
+       s¡©64
+
+
+121 
+__dev_t
+       m¡_dev
+;
+
+122 #ià
+__WORDSIZE
+ == 64
+
+123 
+__\9ao64_t
+       m¡_\9ao
+;
+
+124 
+__ƚk_t
+       m¡_Æ\9ak
+;
+
+125 
+__mode_t
+       m¡_mode
+;
+
+127 \1d\12
+       m__·d1
+;
+
+128 
+__\9ao_t
+       m__¡_\9ao
+;
+
+129 
+__mode_t
+       m¡_mode
+;
+
+130 
+__ƚk_t
+       m¡_Æ\9ak
+;
+
+132 
+__uid_t
+       m¡_uid
+;
+
+133 
+__gid_t
+       m¡_gid
+;
+
+134 #ià
+__WORDSIZE
+ == 64
+
+135 \12
+       m__·d0
+;
+
+136 
+__dev_t
+       m¡_rdev
+;
+
+137 
+__off_t
+       m¡_size
+;
+
+139 
+__dev_t
+       m¡_rdev
+;
+
+140 \1d\12
+       m__·d2
+;
+
+141 
+__off64_t
+       m¡_size
+;
+
+143 
+__blksize_t
+       m¡_blksize
+;
+
+144 
+__blkút64_t
+       m¡_blocks
+;
+
+145 #ià
+def\9aed
+__USE_MISC
+ || def\9aed 
+__USE_XOPEN2K8
+
+
+152 \19
+time¥ec
+       m¡_©im
+;
+
+153 \19
+time¥ec
+       m¡_mtim
+;
+
+154 \19
+time¥ec
+       m¡_ùim
+;
+
+155 \ 1
+       #¡_©ime
+¡_©im
+.
+tv_£c
+
+
+       )
+
+156 \ 1
+       #¡_mtime
+¡_mtim
+.
+tv_£c
+
+
+       )
+
+157 \ 1
+       #¡_ùime
+¡_ùim
+.
+tv_£c
+
+
+       )
+
+159 
+__time_t
+       m¡_©ime
+;
+
+160 \1d\13\12
+       m¡_©im\92£c
+;
+
+161 
+__time_t
+       m¡_mtime
+;
+
+162 \1d\13\12
+       m¡_mtim\92£c
+;
+
+163 
+__time_t
+       m¡_ùime
+;
+
+164 \1d\13\12
+       m¡_ùim\92£c
+;
+
+166 #ià
+__WORDSIZE
+ == 64
+
+167 \13\12
+       m__unu£d
+[3];
+
+169 
+__\9ao64_t
+       m¡_\9ao
+;
+
+175 \ 1
+       #_STATBUF_ST_BLKSIZE
+
+
+       )
+
+176 \ 1
+       #_STATBUF_ST_RDEV
+
+
+       )
+
+178 \ 1
+       #_STATBUF_ST_NSEC
+
+
+       )
+
+182 \ 1
+       #__S_IFMT
+ 0170000
+
+       )
+
+185 \ 1
+       #__S_IFDIR
+ 0040000
+
+       )
+
+186 \ 1
+       #__S_IFCHR
+ 0020000
+
+       )
+
+187 \ 1
+       #__S_IFBLK
+ 0060000
+
+       )
+
+188 \ 1
+       #__S_IFREG
+ 0100000
+
+       )
+
+189 \ 1
+       #__S_IFIFO
+ 0010000
+
+       )
+
+190 \ 1
+       #__S_IFLNK
+ 0120000
+
+       )
+
+191 \ 1
+       #__S_IFSOCK
+ 0140000
+
+       )
+
+195 \ 1
+       #__S_TYPEISMQ
+(
+buf
+è((buf)->
+¡_mode
+ - (buf)->¡_mode)
+
+       )
+
+196 \ 1
+       #__S_TYPEISSEM
+(
+buf
+è((buf)->
+¡_mode
+ - (buf)->¡_mode)
+
+       )
+
+197 \ 1
+       #__S_TYPEISSHM
+(
+buf
+è((buf)->
+¡_mode
+ - (buf)->¡_mode)
+
+       )
+
+201 \ 1
+       #__S_ISUID
+ 04000
+
+       )
+
+202 \ 1
+       #__S_ISGID
+ 02000
+
+       )
+
+203 \ 1
+       #__S_ISVTX
+ 01000
+
+       )
+
+204 \ 1
+       #__S_IREAD
+ 0400
+
+       )
+
+205 \ 1
+       #__S_IWRITE
+ 0200
+
+       )
+
+206 \ 1
+       #__S_IEXEC
+ 0100
+
+       )
+
+208 #ifdeà
+__USE_ATFILE
+
+
+209 \ 1
+       #UTIME_NOW
+ ((1È<< 30è- 1l)
+
+       )
+
+210 \ 1
+       #UTIME_OMIT
+ ((1È<< 30è- 2l)
+
+       )
+
+       @/usr/include/bits/stdio-ldbl.h
+
+20 #iâdeà
+_STDIO_H
+
+
+24 
+__BEGIN_NAMESPACE_STD
+
+
+25 
+       $__LDBL_REDIR_DECL
+ (
+år\9atf
+)
+
+26 
+       $__LDBL_REDIR_DECL
+ (
\9atf
+)
+
+27 
+       $__LDBL_REDIR_DECL
+ (
+¥r\9atf
+)
+
+28 
+       $__LDBL_REDIR_DECL
+ (
+vår\9atf
+)
+
+29 
+       $__LDBL_REDIR_DECL
+ (
+v´\9atf
+)
+
+30 
+       $__LDBL_REDIR_DECL
+ (
+v¥r\9atf
+)
+
+31 #ià
+def\9aed
+__USE_ISOC99
+ && !def\9aed 
+__USE_GNU
+ \
+
+32 && !
+def\9aed
+__REDIRECT
+ \
+
+33 && (
+def\9aed
+__STRICT_ANSI__
+ || def\9aed 
+__USE_XOPEN2K
+)
+
+34 
+       $__LDBL_REDIR1_DECL
+ (
+fsÿnf
+, 
+__Ædbl___isoc99_fsÿnf
+)
+
+35 
+       $__LDBL_REDIR1_DECL
+ (
+sÿnf
+, 
+__Ædbl___isoc99_sÿnf
+)
+
+36 
+       $__LDBL_REDIR1_DECL
+ (
+ssÿnf
+, 
+__Ædbl___isoc99_ssÿnf
+)
+
+38 
+       $__LDBL_REDIR_DECL
+ (
+fsÿnf
+)
+
+39 
+       $__LDBL_REDIR_DECL
+ (
+sÿnf
+)
+
+40 
+       $__LDBL_REDIR_DECL
+ (
+ssÿnf
+)
+
+42 
+__END_NAMESPACE_STD
+
+
+44 #ià
+def\9aed
+__USE_BSD
+ || def\9aed 
+__USE_ISOC99
+ || def\9aed 
+__USE_UNIX98
+
+
+45 
+__BEGIN_NAMESPACE_C99
+
+
+46 
+       $__LDBL_REDIR_DECL
+ (
+¢´\9atf
+)
+
+47 
+       $__LDBL_REDIR_DECL
+ (
+v¢´\9atf
+)
+
+48 
+__END_NAMESPACE_C99
+
+
+51 #ifdef 
+__USE_ISOC99
+
+
+52 
+__BEGIN_NAMESPACE_C99
+
+
+53 #ià!
+def\9aed
+__USE_GNU
+ && !def\9aed 
+__REDIRECT
+ \
+
+54 && (
+def\9aed
+__STRICT_ANSI__
+ || def\9aed 
+__USE_XOPEN2K
+)
+
+55 
+       $__LDBL_REDIR1_DECL
+ (
+vfsÿnf
+, 
+__Ædbl___isoc99_vfsÿnf
+)
+
+56 
+       $__LDBL_REDIR1_DECL
+ (
+vsÿnf
+, 
+__Ædbl___isoc99_vsÿnf
+)
+
+57 
+       $__LDBL_REDIR1_DECL
+ (
+vssÿnf
+, 
+__Ædbl___isoc99_vssÿnf
+)
+
+59 
+       $__LDBL_REDIR_DECL
+ (
+vfsÿnf
+)
+
+60 
+       $__LDBL_REDIR_DECL
+ (
+vssÿnf
+)
+
+61 
+       $__LDBL_REDIR_DECL
+ (
+vsÿnf
+)
+
+63 
+__END_NAMESPACE_C99
+
+
+66 #ifdeà
+__USE_GNU
+
+
+67 
+       $__LDBL_REDIR_DECL
+ (
+vd´\9atf
+)
+
+68 
+       $__LDBL_REDIR_DECL
+ (
+d´\9atf
+)
+
+69 
+       $__LDBL_REDIR_DECL
+ (
+va¥r\9atf
+)
+
+70 
+       $__LDBL_REDIR_DECL
+ (
+__a¥r\9atf
+)
+
+71 
+       $__LDBL_REDIR_DECL
+ (
+a¥r\9atf
+)
+
+72 
+       $__LDBL_REDIR_DECL
+ (
+ob¡ack_´\9atf
+)
+
+73 
+       $__LDBL_REDIR_DECL
+ (
+ob¡ack_v´\9atf
+)
+
+76 #ià
+__USE_FORTIFY_LEVEL
+ > 0 && 
+def\9aed
+__ex\8bº_®ways_\9al\9ae
+
+
+77 
+       $__LDBL_REDIR_DECL
+ (
+__¥r\9atf_chk
+)
+
+78 
+       $__LDBL_REDIR_DECL
+ (
+__v¥r\9atf_chk
+)
+
+79 #ià
+def\9aed
+__USE_BSD
+ || def\9aed 
+__USE_ISOC99
+ || def\9aed 
+__USE_UNIX98
+
+
+80 
+       $__LDBL_REDIR_DECL
+ (
+__¢´\9atf_chk
+)
+
+81 
+       $__LDBL_REDIR_DECL
+ (
+__v¢´\9atf_chk
+)
+
+83 #ià
+__USE_FORTIFY_LEVEL
+ > 1
+
+84 
+       $__LDBL_REDIR_DECL
+ (
+__år\9atf_chk
+)
+
+85 
+       $__LDBL_REDIR_DECL
+ (
+__´\9atf_chk
+)
+
+86 
+       $__LDBL_REDIR_DECL
+ (
+__vår\9atf_chk
+)
+
+87 
+       $__LDBL_REDIR_DECL
+ (
+__v´\9atf_chk
+)
+
+88 #ifdeà
+__USE_GNU
+
+
+89 
+       $__LDBL_REDIR_DECL
+ (
+__a¥r\9atf_chk
+)
+
+90 
+       $__LDBL_REDIR_DECL
+ (
+__va¥r\9atf_chk
+)
+
+91 
+       $__LDBL_REDIR_DECL
+ (
+__d´\9atf_chk
+)
+
+92 
+       $__LDBL_REDIR_DECL
+ (
+__vd´\9atf_chk
+)
+
+93 
+       $__LDBL_REDIR_DECL
+ (
+__ob¡ack_´\9atf_chk
+)
+
+94 
+       $__LDBL_REDIR_DECL
+ (
+__ob¡ack_v´\9atf_chk
+)
+
+       @/usr/include/bits/stdio.h
+
+20 #iâdeà
+_STDIO_H
+
+
+24 #iâdeà
+__ex\8bº_\9al\9ae
+
+
+25 \ 1
+       #__STDIO_INLINE
+\9al\9ae
+
+
+       )
+
+27 \ 1
+       #__STDIO_INLINE
+__ex\8bº_\9al\9ae
+
+
+       )
+
+31 #ifdeà
+__USE_EXTERN_INLINES
+
+
+34 #ià!(
+__USE_FORTIFY_LEVEL
+ > 0 && 
+def\9aed
+__ex\8bº_®ways_\9al\9ae
+)
+
+36 
+__STDIO_INLINE
\12
+
+37 
+       $v´\9atf
+ (
+__cڡ
\ 5*
+__»¡riù
+__fmt
+, 
+_G_va_li¡
+__¬g
+)
+
+39 \15 
+       `vår\9atf
+ (
+¡dout
+, 
+__fmt
+, 
+__¬g
+);
+
+40 
+       }
+}
+
+44 
+__STDIO_INLINE
\12
+
+45 
+       $g\91ch¬
+ (\1e)
+
+47 \15 
+       `_IO_g\91c
+ (
+¡d\9a
+);
+
+48 
+       }
+}
+
+51 #ifdeà
+__USE_MISC
+
+
+53 
+__STDIO_INLINE
\12
+
+54 
+       $fg\91c_uÆocked
+ (
+FILE
+ *
+__å
+)
+
+56 \15 
+       `_IO_g\91c_uÆocked
+ (
+__å
+);
+
+57 
+       }
+}
+
+61 #ià
+def\9aed
+__USE_POSIX
+ || def\9aed 
+__USE_MISC
+
+
+63 
+__STDIO_INLINE
\12
+
+64 
+       $g\91c_uÆocked
+ (
+FILE
+ *
+__å
+)
+
+66 \15 
+       `_IO_g\91c_uÆocked
+ (
+__å
+);
+
+67 
+       }
+}
+
+70 
+__STDIO_INLINE
\12
+
+71 
+       $g\91ch¬_uÆocked
+ (\1e)
+
+73 \15 
+       `_IO_g\91c_uÆocked
+ (
+¡d\9a
+);
+
+74 
+       }
+}
+
+79 
+__STDIO_INLINE
\12
+
+80 
+       $putch¬
+ (\12
+__c
+)
+
+82 \15 
+       `_IO_putc
+ (
+__c
+, 
+¡dout
+);
+
+83 
+       }
+}
+
+86 #ifdeà
+__USE_MISC
+
+
+88 
+__STDIO_INLINE
\12
+
+89 
+       $åutc_uÆocked
+ (\12
+__c
+, 
+FILE
+ *
+__¡»am
+)
+
+91 \15 
+       `_IO_putc_uÆocked
+ (
+__c
+, 
+__¡»am
+);
+
+92 
+       }
+}
+
+96 #ià
+def\9aed
+__USE_POSIX
+ || def\9aed 
+__USE_MISC
+
+
+98 
+__STDIO_INLINE
\12
+
+99 
+       $putc_uÆocked
+ (\12
+__c
+, 
+FILE
+ *
+__¡»am
+)
+
+101 \15 
+       `_IO_putc_uÆocked
+ (
+__c
+, 
+__¡»am
+);
+
+102 
+       }
+}
+
+105 
+__STDIO_INLINE
\12
+
+106 
+       $putch¬_uÆocked
+ (\12
+__c
+)
+
+108 \15 
+       `_IO_putc_uÆocked
+ (
+__c
+, 
+¡dout
+);
+
+109 
+       }
+}
+
+113 #ifdef 
+__USE_GNU
+
+
+115 
+__STDIO_INLINE
+_IO_ssize_t
+
+
+116 
+       $g\91l\9ae
+ (\ 5**
+__l\9a\95\8c
+, 
+size_t
+ *
+__n
+, 
+FILE
+ *
+__¡»am
+)
+
+118 \15 
+       `__g\91d\96im
+ (
+__l\9a\95\8c
+, 
+__n
+, '\n', 
+__¡»am
+);
+
+119 
+       }
+}
+
+123 #ifdeà
+__USE_MISC
+
+
+125 
+__STDIO_INLINE
\12
+
+126 
+__NTH
+ (
+       $ãof_uÆocked
+ (
+FILE
+ *
+__¡»am
+))
+
+128 \15 
+       `_IO_ãof_uÆocked
+ (
+__¡»am
+);
+
+129 
+       }
+}
+
+132 
+__STDIO_INLINE
\12
+
+133 
+__NTH
+ (
+       $ã¼Ü_uÆocked
+ (
+FILE
+ *
+__¡»am
+))
+
+135 \15 
+       `_IO_ã¼Ü_uÆocked
+ (
+__¡»am
+);
+
+136 
+       }
+}
+
+142 #ià
+def\9aed
+__USE_MISC
+ && def\9aed 
+__GNUC__
+ && def\9aed 
+__OPTIMIZE__
+ \
+
+143 && !
+def\9aed
+       g__ýlu¥lus
+
+
+145 \ 1
+       #ä\97d_uÆocked
+(
+±r
+, 
+size
+, 
+n
+, 
+¡»am
+) \
+
+146 (
+       `__ex\8bnsiÚ__
+ ((
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+size
+è&& __bu\9et\9a_cÚ¡ªt_°(
+n
+) \
+
+147 && (
+size_t
+è(
+size
+è* (size_tè(
+n
+) <= 8 \
+
+148 && (
+size_t
+è(
+size
+) != 0) \
+
+149 ? ({ \ 5*
+__±r
+ = (\ 5*è(
+±r
+); \
+
+150 
+FILE
+ *
+__¡»am
+ = (
+¡»am
+); \
+
+151 
+size_t
+__út
+; \
+
+152 \ f
+__út
+ = (
+size_t
+è(
+size
+è* (size_tè(
+n
+); \
+
+153 
+__út
+ > 0; --__cnt) \
+
+155 \12
+__c
+ = 
+       `_IO_g\91c_uÆocked
+ (
+__¡»am
+); \
+
+156 ià(
+__c
+ =ð
+EOF
+) \
+
+158 *
+__±r
+++ = 
+__c
+; \
+
+160 ((
+size_t
+è(
+size
+è* (size_tè(
+n
+è- 
+__út
+) \
+
+161 / (
+size_t
+è(
+size
+); }) \
+
+162 : (((
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+size
+è&& (
+size_t
+) (size) == 0) \
+
+163 || (
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+n
+è&& (
+size_t
+) (n) == 0)) \
+
+165 ? ((\1eè(
+±r
+), (\1eè(
+¡»am
+), (\1eè(
+size
+), \
+
+166 (\1eè(
+n
+), (
+size_t
+) 0) \
+
+167 : 
+       `ä\97d_uÆocked
+ (
+±r
+, 
+size
+, 
+n
+, 
+¡»am
+))))
+
+       )
+
+169 \ 1
+       #fwr\99e_uÆocked
+(
+±r
+, 
+size
+, 
+n
+, 
+¡»am
+) \
+
+170 (
+       `__ex\8bnsiÚ__
+ ((
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+size
+è&& __bu\9et\9a_cÚ¡ªt_°(
+n
+) \
+
+171 && (
+size_t
+è(
+size
+è* (size_tè(
+n
+) <= 8 \
+
+172 && (
+size_t
+è(
+size
+) != 0) \
+
+173 ? ({ cڡ \ 5*
+__±r
+ = (cÚ¡ \ 5*è(
+±r
+); \
+
+174 
+FILE
+ *
+__¡»am
+ = (
+¡»am
+); \
+
+175 
+size_t
+__út
+; \
+
+176 \ f
+__út
+ = (
+size_t
+è(
+size
+è* (size_tè(
+n
+); \
+
+177 
+__út
+ > 0; --__cnt) \
+
+178 ià(
+       `_IO_putc_uÆocked
+ (*
+__±r
+++, 
+__¡»am
+è=ð
+EOF
+) \
+
+180 ((
+size_t
+è(
+size
+è* (size_tè(
+n
+è- 
+__út
+) \
+
+181 / (
+size_t
+è(
+size
+); }) \
+
+182 : (((
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+size
+è&& (
+size_t
+) (size) == 0) \
+
+183 || (
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+n
+è&& (
+size_t
+) (n) == 0)) \
+
+185 ? ((\1eè(
+±r
+), (\1eè(
+¡»am
+), (\1eè(
+size
+), \
+
+186 (\1eè(
+n
+), (
+size_t
+) 0) \
+
+187 : 
+       `fwr\99e_uÆocked
+ (
+±r
+, 
+size
+, 
+n
+, 
+¡»am
+))))
+
+       )
+
+191 #undeà
+__STDIO_INLINE
+
+
+       @/usr/include/bits/stdio2.h
+
+20 #iâdeà
+_STDIO_H
+
+
+24 \r\12
+       $__¥r\9atf_chk
+ (\ 5*
+__»¡riù
+__s
+, \12
+__æag
+, 
+size_t
+__¦\92
+,
+
+25 
+__cڡ
\ 5*
+__»¡riù
+__fÜm©
+, ...è
+__THROW
+;
+
+26 \r\12
+       $__v¥r\9atf_chk
+ (\ 5*
+__»¡riù
+__s
+, \12
+__æag
+, 
+size_t
+__¦\92
+,
+
+27 
+__cڡ
\ 5*
+__»¡riù
+__fÜm©
+,
+
+28 
+_G_va_li¡
+__­
+__THROW
+;
+
+30 #ifdeà
+__va_¬g_·ck
+
+
+31 
+__ex\8bº_®ways_\9al\9ae
\12
+
+32 
+       `__NTH
+ (
+       $¥r\9atf
+ (\ 5*
+__»¡riù
+__s
+, 
+__cڡ
\ 5*__»¡riù 
+__fmt
+, ...))
+
+34 \15 
+       `__bu\9et\9a___¥r\9atf_chk
+ (
+__s
+, 
+__USE_FORTIFY_LEVEL
+ - 1,
+
+35 
+       `__bos
+ (
+__s
+), 
+__fmt
+, 
+       `__va_¬g_·ck
+ ());
+
+36 
+       }
+}
+
+37 #\96ià!
+def\9aed
+__ýlu¥lus
+
+
+38 \ 1
+       #¥r\9atf
+(
+¡r
+, ...) \
+
+39 
+       `__bu\9et\9a___¥r\9atf_chk
+ (
+¡r
+, 
+__USE_FORTIFY_LEVEL
+ - 1, 
+       `__bos
+ (str), \
+
+40 
+__VA_ARGS__
+)
+
+       )
+
+43 
+__ex\8bº_®ways_\9al\9ae
\12
+
+44 
+__NTH
+ (
+       $v¥r\9atf
+ (\ 5*
+__»¡riù
+__s
+, 
+__cڡ
\ 5*__»¡riù 
+__fmt
+,
+
+45 
+_G_va_li¡
+__­
+))
+
+47 \15 
+       `__bu\9et\9a___v¥r\9atf_chk
+ (
+__s
+, 
+__USE_FORTIFY_LEVEL
+ - 1,
+
+48 
+       `__bos
+ (
+__s
+), 
+__fmt
+, 
+__­
+);
+
+49 
+       }
+}
+
+51 #ià
+def\9aed
+__USE_BSD
+ || def\9aed 
+__USE_ISOC99
+ || def\9aed 
+__USE_UNIX98
+
+
+53 \r\12
+       $__¢´\9atf_chk
+ (\ 5*
+__»¡riù
+__s
+, 
+size_t
+__n
+, \12
+__æag
+,
+
+54 
+size_t
+__¦\92
+, 
+__cڡ
\ 5*
+__»¡riù
+__fÜm©
+,
+
+55 ...è
+__THROW
+;
+
+56 \r\12
+       $__v¢´\9atf_chk
+ (\ 5*
+__»¡riù
+__s
+, 
+size_t
+__n
+, \12
+__æag
+,
+
+57 
+size_t
+__¦\92
+, 
+__cڡ
\ 5*
+__»¡riù
+__fÜm©
+,
+
+58 
+_G_va_li¡
+__­
+__THROW
+;
+
+60 #ifdeà
+__va_¬g_·ck
+
+
+61 
+__ex\8bº_®ways_\9al\9ae
\12
+
+62 
+       `__NTH
+ (
+       $¢´\9atf
+ (\ 5*
+__»¡riù
+__s
+, 
+size_t
+__n
+,
+
+63 
+__cڡ
\ 5*
+__»¡riù
+__fmt
+, ...))
+
+65 \15 
+       `__bu\9et\9a___¢´\9atf_chk
+ (
+__s
+, 
+__n
+, 
+__USE_FORTIFY_LEVEL
+ - 1,
+
+66 
+       `__bos
+ (
+__s
+), 
+__fmt
+, 
+       `__va_¬g_·ck
+ ());
+
+67 
+       }
+}
+
+68 #\96ià!
+def\9aed
+__ýlu¥lus
+
+
+69 \ 1
+       #¢´\9atf
+(
+¡r
+, 
+Ën
+, ...) \
+
+70 
+       `__bu\9et\9a___¢´\9atf_chk
+ (
+¡r
+, 
+Ën
+, 
+__USE_FORTIFY_LEVEL
+ - 1, 
+       `__bos
+ (str), \
+
+71 
+__VA_ARGS__
+)
+
+       )
+
+74 
+__ex\8bº_®ways_\9al\9ae
\12
+
+75 
+__NTH
+ (
+       $v¢´\9atf
+ (\ 5*
+__»¡riù
+__s
+, 
+size_t
+__n
+,
+
+76 
+__cڡ
\ 5*
+__»¡riù
+__fmt
+, 
+_G_va_li¡
+__­
+))
+
+78 \15 
+       `__bu\9et\9a___v¢´\9atf_chk
+ (
+__s
+, 
+__n
+, 
+__USE_FORTIFY_LEVEL
+ - 1,
+
+79 
+       `__bos
+ (
+__s
+), 
+__fmt
+, 
+__­
+);
+
+80 
+       }
+}
+
+84 #ià
+__USE_FORTIFY_LEVEL
+ > 1
+
+86 \r\12
+__år\9atf_chk
+ (
+FILE
+ *
+__»¡riù
+__¡»am
+, \12
+__æag
+,
+
+87 
+__cڡ
\ 5*
+__»¡riù
+__fÜm©
+, ...);
+
+88 \r\12
+__´\9atf_chk
+ (\12
+__æag
+, 
+__cڡ
\ 5*
+__»¡riù
+__fÜm©
+, ...);
+
+89 \r\12
+__vår\9atf_chk
+ (
+FILE
+ *
+__»¡riù
+__¡»am
+, \12
+__æag
+,
+
+90 
+__cڡ
\ 5*
+__»¡riù
+__fÜm©
+, 
+_G_va_li¡
+__­
+);
+
+91 \r\12
+__v´\9atf_chk
+ (\12
+__æag
+, 
+__cڡ
\ 5*
+__»¡riù
+__fÜm©
+,
+
+92 
+_G_va_li¡
+__­
+);
+
+94 #ifdeà
+__va_¬g_·ck
+
+
+95 
+__ex\8bº_®ways_\9al\9ae
\12
+
+96 
+       $år\9atf
+ (
+FILE
+ *
+__»¡riù
+__¡»am
+, 
+__cڡ
\ 5*__»¡riù 
+__fmt
+, ...)
+
+98 \15 
+       `__år\9atf_chk
+ (
+__¡»am
+, 
+__USE_FORTIFY_LEVEL
+ - 1, 
+__fmt
+,
+
+99 
+       `__va_¬g_·ck
+ ());
+
+100 
+       }
+}
+
+102 
+__ex\8bº_®ways_\9al\9ae
\12
+
+103 
+       $´\9atf
+ (
+__cڡ
\ 5*
+__»¡riù
+__fmt
+, ...)
+
+105 \15 
+       `__´\9atf_chk
+ (
+__USE_FORTIFY_LEVEL
+ - 1, 
+__fmt
+, 
+       `__va_¬g_·ck
+ ());
+
+106 
+       }
+}
+
+107 #\96ià!
+def\9aed
+__ýlu¥lus
+
+
+108 \ 1
+       #´\9atf
+(...) \
+
+109 
+       `__´\9atf_chk
+ (
+__USE_FORTIFY_LEVEL
+ - 1, 
+__VA_ARGS__
+)
+
+       )
+
+110 \ 1
+       #år\9atf
+(
+¡»am
+, ...) \
+
+111 
+       `__år\9atf_chk
+ (
+¡»am
+, 
+__USE_FORTIFY_LEVEL
+ - 1, 
+__VA_ARGS__
+)
+
+       )
+
+114 
+__ex\8bº_®ways_\9al\9ae
\12
+
+115 
+       $v´\9atf
+ (
+__cڡ
\ 5*
+__»¡riù
+__fmt
+, 
+_G_va_li¡
+__­
+)
+
+117 #ifdeà
+__USE_EXTERN_INLINES
+
+
+118 \15 
+       `__vår\9atf_chk
+ (
+¡dout
+, 
+__USE_FORTIFY_LEVEL
+ - 1, 
+__fmt
+, 
+__­
+);
+
+120 \15 
+       `__v´\9atf_chk
+ (
+__USE_FORTIFY_LEVEL
+ - 1, 
+__fmt
+, 
+__­
+);
+
+122 
+       }
+}
+
+124 
+__ex\8bº_®ways_\9al\9ae
\12
+
+125 
+       $vår\9atf
+ (
+FILE
+ *
+__»¡riù
+__¡»am
+,
+
+126 
+__cڡ
\ 5*
+__»¡riù
+__fmt
+, 
+_G_va_li¡
+__­
+)
+
+128 \15 
+       `__vår\9atf_chk
+ (
+__¡»am
+, 
+__USE_FORTIFY_LEVEL
+ - 1, 
+__fmt
+, 
+__­
+);
+
+129 
+       }
+}
+
+131 #ifdeà
+__USE_GNU
+
+
+133 \r\12
+       $__a¥r\9atf_chk
+ (\ 5**
+__»¡riù
+__±r
+, \12
+__æag
+,
+
+134 
+__cڡ
\ 5*
+__»¡riù
+__fmt
+, ...)
+
+135 
+__THROW
+       `__©\8cibu\8b__
+ ((
+       $__fÜm©__
+ (
+__´\9atf__
+, 3, 4))è
+__wur
+;
+
+136 \r\12
+       $__va¥r\9atf_chk
+ (\ 5**
+__»¡riù
+__±r
+, \12
+__æag
+,
+
+137 
+__cڡ
\ 5*
+__»¡riù
+__fmt
+, 
+_G_va_li¡
+__¬g
+)
+
+138 
+__THROW
+       `__©\8cibu\8b__
+ ((
+       $__fÜm©__
+ (
+__´\9atf__
+, 3, 0))è
+__wur
+;
+
+139 \r\12
+       $__d´\9atf_chk
+ (\12
+__fd
+, \12
+__æag
+, 
+__cڡ
\ 5*
+__»¡riù
+__fmt
+,
+
+140 ...è
+       `__©\8cibu\8b__
+ ((
+       `__fÜm©__
+ (
+__´\9atf__
+, 3, 4)));
+
+141 \r\12
+       $__vd´\9atf_chk
+ (\12
+__fd
+, \12
+__æag
+,
+
+142 
+__cڡ
\ 5*
+__»¡riù
+__fmt
+, 
+_G_va_li¡
+__¬g
+)
+
+143 
+       `__©\8cibu\8b__
+ ((
+       `__fÜm©__
+ (
+__´\9atf__
+, 3, 0)));
+
+144 \r\12
+       $__ob¡ack_´\9atf_chk
+ (\19
+ob¡ack
+ *
+__»¡riù
+__ob¡ack
+,
+
+145 \12
+__æag
+, 
+__cڡ
\ 5*
+__»¡riù
+__fÜm©
+,
+
+147 
+__THROW
+       `__©\8cibu\8b__
+ ((
+       `__fÜm©__
+ (
+__´\9atf__
+, 3, 4)));
+
+148 \r\12
+       $__ob¡ack_v´\9atf_chk
+ (\19
+ob¡ack
+ *
+__»¡riù
+__ob¡ack
+,
+
+149 \12
+__æag
+,
+
+150 
+__cڡ
\ 5*
+__»¡riù
+__fÜm©
+,
+
+151 
+_G_va_li¡
+__¬gs
+)
+
+152 
+__THROW
+       `__©\8cibu\8b__
+ ((
+       `__fÜm©__
+ (
+__´\9atf__
+, 3, 0)));
+
+154 #ifdeà
+__va_¬g_·ck
+
+
+155 
+__ex\8bº_®ways_\9al\9ae
\12
+
+156 
+       `__NTH
+ (
+       $a¥r\9atf
+ (\ 5**
+__»¡riù
+__±r
+, 
+__cڡ
\ 5*__»¡riù 
+__fmt
+, ...))
+
+158 \15 
+       `__a¥r\9atf_chk
+ (
+__±r
+, 
+__USE_FORTIFY_LEVEL
+ - 1, 
+__fmt
+,
+
+159 
+       `__va_¬g_·ck
+ ());
+
+160 
+       }
+}
+
+162 
+__ex\8bº_®ways_\9al\9ae
\12
+
+163 
+__NTH
+ (
+       $__a¥r\9atf
+ (\ 5**
+__»¡riù
+__±r
+, 
+__cڡ
\ 5*__»¡riù 
+__fmt
+,
+
+166 \15 
+       `__a¥r\9atf_chk
+ (
+__±r
+, 
+__USE_FORTIFY_LEVEL
+ - 1, 
+__fmt
+,
+
+167 
+       `__va_¬g_·ck
+ ());
+
+168 
+       }
+}
+
+170 
+__ex\8bº_®ways_\9al\9ae
\12
+
+171 
+       $d´\9atf
+ (\12
+__fd
+, 
+__cڡ
\ 5*
+__»¡riù
+__fmt
+, ...)
+
+173 \15 
+       `__d´\9atf_chk
+ (
+__fd
+, 
+__USE_FORTIFY_LEVEL
+ - 1, 
+__fmt
+,
+
+174 
+       `__va_¬g_·ck
+ ());
+
+175 
+       }
+}
+
+177 
+__ex\8bº_®ways_\9al\9ae
\12
+
+178 
+__NTH
+ (
+       $ob¡ack_´\9atf
+ (\19
+ob¡ack
+ *
+__»¡riù
+__ob¡ack
+,
+
+179 
+__cڡ
\ 5*
+__»¡riù
+__fmt
+, ...))
+
+181 \15 
+       `__ob¡ack_´\9atf_chk
+ (
+__ob¡ack
+, 
+__USE_FORTIFY_LEVEL
+ - 1, 
+__fmt
+,
+
+182 
+       `__va_¬g_·ck
+ ());
+
+183 
+       }
+}
+
+184 #\96ià!
+def\9aed
+__ýlu¥lus
+
+
+185 \ 1
+       #a¥r\9atf
+(
+±r
+, ...) \
+
+186 
+       `__a¥r\9atf_chk
+ (
+±r
+, 
+__USE_FORTIFY_LEVEL
+ - 1, 
+__VA_ARGS__
+)
+
+       )
+
+187 \ 1
+       #__a¥r\9atf
+(
+±r
+, ...) \
+
+188 
+       `__a¥r\9atf_chk
+ (
+±r
+, 
+__USE_FORTIFY_LEVEL
+ - 1, 
+__VA_ARGS__
+)
+
+       )
+
+189 \ 1
+       #d´\9atf
+(
+fd
+, ...) \
+
+190 
+       `__d´\9atf_chk
+ (
+fd
+, 
+__USE_FORTIFY_LEVEL
+ - 1, 
+__VA_ARGS__
+)
+
+       )
+
+191 \ 1
+       #ob¡ack_´\9atf
+(
+ob¡ack
+, ...) \
+
+192 
+       `__ob¡ack_´\9atf_chk
+ (
+ob¡ack
+, 
+__USE_FORTIFY_LEVEL
+ - 1, 
+__VA_ARGS__
+)
+
+       )
+
+195 
+__ex\8bº_®ways_\9al\9ae
\12
+
+196 
+__NTH
+ (
+       $va¥r\9atf
+ (\ 5**
+__»¡riù
+__±r
+, 
+__cڡ
\ 5*__»¡riù 
+__fmt
+,
+
+197 
+_G_va_li¡
+__­
+))
+
+199 \15 
+       `__va¥r\9atf_chk
+ (
+__±r
+, 
+__USE_FORTIFY_LEVEL
+ - 1, 
+__fmt
+, 
+__­
+);
+
+200 
+       }
+}
+
+202 
+__ex\8bº_®ways_\9al\9ae
\12
+
+203 
+       $vd´\9atf
+ (\12
+__fd
+, 
+__cڡ
\ 5*
+__»¡riù
+__fmt
+, 
+_G_va_li¡
+__­
+)
+
+205 \15 
+       `__vd´\9atf_chk
+ (
+__fd
+, 
+__USE_FORTIFY_LEVEL
+ - 1, 
+__fmt
+, 
+__­
+);
+
+206 
+       }
+}
+
+208 
+__ex\8bº_®ways_\9al\9ae
\12
+
+209 
+__NTH
+ (
+       $ob¡ack_v´\9atf
+ (\19
+ob¡ack
+ *
+__»¡riù
+__ob¡ack
+,
+
+210 
+__cڡ
\ 5*
+__»¡riù
+__fmt
+, 
+_G_va_li¡
+__­
+))
+
+212 \15 
+       `__ob¡ack_v´\9atf_chk
+ (
+__ob¡ack
+, 
+__USE_FORTIFY_LEVEL
+ - 1, 
+__fmt
+,
+
+213 
+__­
+);
+
+214 
+       }
+}
+
+220 \r\ 5*
+       $__g\91s_chk
+ (\ 5*
+__¡r
+, 
+size_t
+__wur
+;
+
+221 \r\ 5*
+       `__REDIRECT
+ (
+__g\91s_w¬n
+, (\ 5*
+__¡r
+), 
+g\91s
+)
+
+222 
+__wur
+       `__w¬Ç\89r
+ ("please use fgets or getline instead, gets can't "
+
+225 
+__ex\8bº_®ways_\9al\9ae
+__wur
\ 5*
+
+226 
+       $g\91s
+ (\ 5*
+__¡r
+)
+
+228 ià(
+       `__bos
+ (
+__¡r
+è!ð(
+size_t
+) -1)
+
+229 \15 
+       `__g\91s_chk
+ (
+__¡r
+, 
+       `__bos
+ (__str));
+
+230 \15 
+       `__g\91s_w¬n
+ (
+__¡r
+);
+
+231 
+       }
+}
+
+233 \r\ 5*
+       $__fg\91s_chk
+ (\ 5*
+__»¡riù
+__s
+, 
+size_t
+__size
+, \12
+__n
+,
+
+234 
+FILE
+ *
+__»¡riù
+__¡»am
+__wur
+;
+
+235 \r\ 5*
+       `__REDIRECT
+ (
+__fg\91s_®\9fs
+,
+
+236 (\ 5*
+__»¡riù
+__s
+, \12
+__n
+,
+
+237 
+FILE
+ *
+__»¡riù
+__¡»am
+), 
+fg\91s
+__wur
+;
+
+238 \r\ 5*
+       `__REDIRECT
+ (
+__fg\91s_chk_w¬n
+,
+
+239 (\ 5*
+__»¡riù
+__s
+, 
+size_t
+__size
+, \12
+__n
+,
+
+240 
+FILE
+ *
+__»¡riù
+__¡»am
+), 
+__fg\91s_chk
+)
+
+241 
+__wur
+       `__w¬Ç\89r
+ ("fgets called with bigger size\81han\86ength "
+
+244 
+__ex\8bº_®ways_\9al\9ae
+__wur
\ 5*
+
+245 
+       $fg\91s
+ (\ 5*
+__»¡riù
+__s
+, \12
+__n
+, 
+FILE
+ *__»¡riù 
+__¡»am
+)
+
+247 ià(
+       `__bos
+ (
+__s
+è!ð(
+size_t
+) -1)
+
+249 ià(!
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__n
+) || __n <= 0)
+
+250 \15 
+       `__fg\91s_chk
+ (
+__s
+, 
+       `__bos
+ (__s), 
+__n
+, 
+__¡»am
+);
+
+252 ià((
+size_t
+__n
+ > 
+       `__bos
+ (
+__s
+))
+
+253 \15 
+       `__fg\91s_chk_w¬n
+ (
+__s
+, 
+       `__bos
+ (__s), 
+__n
+, 
+__¡»am
+);
+
+255 \15 
+       `__fg\91s_®\9fs
+ (
+__s
+, 
+__n
+, 
+__¡»am
+);
+
+256 
+       }
+}
+
+258 \r
+size_t
+       $__ä\97d_chk
+ (\1e*
+__»¡riù
+__±r
+, 
+size_t
+__±¾\92
+,
+
+259 
+size_t
+__size
+, size_\88
+__n
+,
+
+260 
+FILE
+ *
+__»¡riù
+__¡»am
+__wur
+;
+
+261 \r
+size_t
+       `__REDIRECT
+ (
+__ä\97d_®\9fs
+,
+
+262 (\1e*
+__»¡riù
+__±r
+, 
+size_t
+__size
+,
+
+263 
+size_t
+__n
+, 
+FILE
+ *
+__»¡riù
+__¡»am
+),
+
+264 
\97d
+__wur
+;
+
+265 \r
+size_t
+       `__REDIRECT
+ (
+__ä\97d_chk_w¬n
+,
+
+266 (\1e*
+__»¡riù
+__±r
+, 
+size_t
+__±¾\92
+,
+
+267 
+size_t
+__size
+, size_\88
+__n
+,
+
+268 
+FILE
+ *
+__»¡riù
+__¡»am
+),
+
+269 
+__ä\97d_chk
+)
+
+270 
+__wur
+       `__w¬Ç\89r
+ ("fread called with bigger size *\82memb\81han\86ength "
+
+273 
+__ex\8bº_®ways_\9al\9ae
+__wur
+size_t
+
+
+274 
+       $ä\97d
+ (\1e*
+__»¡riù
+__±r
+, 
+size_t
+__size
+, size_\88
+__n
+,
+
+275 
+FILE
+ *
+__»¡riù
+__¡»am
+)
+
+277 ià(
+       `__bos0
+ (
+__±r
+è!ð(
+size_t
+) -1)
+
+279 ià(!
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__size
+)
+
+280 || !
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__n
+)
+
+281 || (
+__size
+ | 
+__n
+è>ð(((
+size_t
+) 1) << (8 * \17 (size_t) / 2)))
+
+282 \15 
+       `__ä\97d_chk
+ (
+__±r
+, 
+       `__bos0
+ (__±r), 
+__size
+, 
+__n
+, 
+__¡»am
+);
+
+284 ià(
+__size
+ * 
+__n
+ > 
+       `__bos0
+ (
+__±r
+))
+
+285 \15 
+       `__ä\97d_chk_w¬n
+ (
+__±r
+, 
+       `__bos0
+ (__±r), 
+__size
+, 
+__n
+, 
+__¡»am
+);
+
+287 \15 
+       `__ä\97d_®\9fs
+ (
+__±r
+, 
+__size
+, 
+__n
+, 
+__¡»am
+);
+
+288 
+       }
+}
+
+290 #ifdeà
+__USE_GNU
+
+
+291 \r\ 5*
+       $__fg\91s_uÆocked_chk
+ (\ 5*
+__»¡riù
+__s
+, 
+size_t
+__size
+,
+
+292 \12
+__n
+, 
+FILE
+ *
+__»¡riù
+__¡»am
+__wur
+;
+
+293 \r\ 5*
+       `__REDIRECT
+ (
+__fg\91s_uÆocked_®\9fs
+,
+
+294 (\ 5*
+__»¡riù
+__s
+, \12
+__n
+,
+
+295 
+FILE
+ *
+__»¡riù
+__¡»am
+), 
+fg\91s_uÆocked
+__wur
+;
+
+296 \r\ 5*
+       `__REDIRECT
+ (
+__fg\91s_uÆocked_chk_w¬n
+,
+
+297 (\ 5*
+__»¡riù
+__s
+, 
+size_t
+__size
+, \12
+__n
+,
+
+298 
+FILE
+ *
+__»¡riù
+__¡»am
+), 
+__fg\91s_uÆocked_chk
+)
+
+299 
+__wur
+       `__w¬Ç\89r
+ ("fgets_unlocked called with bigger size\81han\86ength "
+
+302 
+__ex\8bº_®ways_\9al\9ae
+__wur
\ 5*
+
+303 
+       $fg\91s_uÆocked
+ (\ 5*
+__»¡riù
+__s
+, \12
+__n
+, 
+FILE
+ *__»¡riù 
+__¡»am
+)
+
+305 ià(
+       `__bos
+ (
+__s
+è!ð(
+size_t
+) -1)
+
+307 ià(!
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__n
+) || __n <= 0)
+
+308 \15 
+       `__fg\91s_uÆocked_chk
+ (
+__s
+, 
+       `__bos
+ (__s), 
+__n
+, 
+__¡»am
+);
+
+310 ià((
+size_t
+__n
+ > 
+       `__bos
+ (
+__s
+))
+
+311 \15 
+       `__fg\91s_uÆocked_chk_w¬n
+ (
+__s
+, 
+       `__bos
+ (__s), 
+__n
+, 
+__¡»am
+);
+
+313 \15 
+       `__fg\91s_uÆocked_®\9fs
+ (
+__s
+, 
+__n
+, 
+__¡»am
+);
+
+314 
+       }
+}
+
+317 #ifdeà
+__USE_MISC
+
+
+318 #undeà
\97d_uÆocked
+
+
+319 \r
+size_t
+       $__ä\97d_uÆocked_chk
+ (\1e*
+__»¡riù
+__±r
+, 
+size_t
+__±¾\92
+,
+
+320 
+size_t
+__size
+, size_\88
+__n
+,
+
+321 
+FILE
+ *
+__»¡riù
+__¡»am
+__wur
+;
+
+322 \r
+size_t
+       `__REDIRECT
+ (
+__ä\97d_uÆocked_®\9fs
+,
+
+323 (\1e*
+__»¡riù
+__±r
+, 
+size_t
+__size
+,
+
+324 
+size_t
+__n
+, 
+FILE
+ *
+__»¡riù
+__¡»am
+),
+
+325 
\97d_uÆocked
+__wur
+;
+
+326 \r
+size_t
+       `__REDIRECT
+ (
+__ä\97d_uÆocked_chk_w¬n
+,
+
+327 (\1e*
+__»¡riù
+__±r
+, 
+size_t
+__±¾\92
+,
+
+328 
+size_t
+__size
+, size_\88
+__n
+,
+
+329 
+FILE
+ *
+__»¡riù
+__¡»am
+),
+
+330 
+__ä\97d_uÆocked_chk
+)
+
+331 
+__wur
+       `__w¬Ç\89r
+ ("fread_unlocked called with bigger size *\82memb\81han "
+
+334 
+__ex\8bº_®ways_\9al\9ae
+__wur
+size_t
+
+
+335 
+       $ä\97d_uÆocked
+ (\1e*
+__»¡riù
+__±r
+, 
+size_t
+__size
+, size_\88
+__n
+,
+
+336 
+FILE
+ *
+__»¡riù
+__¡»am
+)
+
+338 ià(
+       `__bos0
+ (
+__±r
+è!ð(
+size_t
+) -1)
+
+340 ià(!
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__size
+)
+
+341 || !
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__n
+)
+
+342 || (
+__size
+ | 
+__n
+è>ð(((
+size_t
+) 1) << (8 * \17 (size_t) / 2)))
+
+343 \15 
+       `__ä\97d_uÆocked_chk
+ (
+__±r
+, 
+       `__bos0
+ (__±r), 
+__size
+, 
+__n
+,
+
+344 
+__¡»am
+);
+
+346 ià(
+__size
+ * 
+__n
+ > 
+       `__bos0
+ (
+__±r
+))
+
+347 \15 
+       `__ä\97d_uÆocked_chk_w¬n
+ (
+__±r
+, 
+       `__bos0
+ (__±r), 
+__size
+, 
+__n
+,
+
+348 
+__¡»am
+);
+
+351 #ifdeà
+__USE_EXTERN_INLINES
+
+
+352 ià(
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__size
+)
+
+353 && 
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__n
+)
+
+354 && (
+__size
+ | 
+__n
+è< (((
+size_t
+) 1) << (8 * \17 (size_t) / 2))
+
+355 && 
+__size
+ * 
+__n
+ <= 8)
+
+357 
+size_t
+__út
+ = 
+__size
+ * 
+__n
+;
+
+358 \ 5*
+__ý\8c
+ = (\ 5
+__±r
+;
+
+359 ià(
+__út
+ == 0)
+
+362 \ f
+__út
+ > 0; --__cnt)
+
+364 \12
+__c
+ = 
+       `_IO_g\91c_uÆocked
+ (
+__¡»am
+);
+
+365 ià(
+__c
+ =ð
+EOF
+)
+
+367 *
+__ý\8c
+++ = 
+__c
+;
+
+369 \15 (
+__ý\8c
+ - (\ 5
+__±r
+è/ 
+__size
+;
+
+372 \15 
+       `__ä\97d_uÆocked_®\9fs
+ (
+__±r
+, 
+__size
+, 
+__n
+, 
+__¡»am
+);
+
+373 
+       }
+}
+
+       @/usr/include/bits/stdio_lim.h
+
+19 #ià!
+def\9aed
+_STDIO_H
+ && !def\9aed 
+__Ãed_FOPEN_MAX
+ && !def\9aed 
+__Ãed_IOV_MAX
+
+
+23 #ifdeà
+_STDIO_H
+
+
+24 \ 1
+       #L_tm²am
+ 20
+
+       )
+
+25 \ 1
+       #TMP_MAX
+ 238328
+
+       )
+
+26 \ 1
+       #FILENAME_MAX
+ 4096
+
+       )
+
+28 #ifdeà
+__USE_POSIX
+
+
+29 \ 1
+       #L_ù\94mid
+ 9
+
+       )
+
+30 #ià!
+def\9aed
+__USE_XOPEN2K
+ || def\9aed 
+__USE_GNU
+
+
+31 \ 1
+       #L_cu£rid
+ 9
+
+       )
+
+36 #ià
+def\9aed
+__Ãed_FOPEN_MAX
+ || def\9aed 
+_STDIO_H
+
+
+37 #undeà
+FOPEN_MAX
+
+
+38 \ 1
+       #FOPEN_MAX
+ 16
+
+       )
+
+41 #ià
+def\9aed
+__Ãed_IOV_MAX
+ && !def\9aed 
+IOV_MAX
+
+
+42 \ 1
+       #IOV_MAX
+ 1024
+
+       )
+
+       @/usr/include/bits/stdlib-ldbl.h
+
+20 #iâdeà
+_STDLIB_H
+
+
+24 #ifdef 
+__USE_ISOC99
+
+
+25 
+__BEGIN_NAMESPACE_C99
+
+
+26 
+       $__LDBL_REDIR1_DECL
+ (
+¡¹Þd
+, 
+¡¹od
+)
+
+27 
+__END_NAMESPACE_C99
+
+
+30 #ifdeà
+__USE_GNU
+
+
+31 
+       $__LDBL_REDIR1_DECL
+ (
+¡¹Þd_l
+, 
+¡¹od_l
+)
+
+34 #ià
+def\9aed
+__USE_SVID
+ || def\9aed 
+__USE_XOPEN_EXTENDED
+
+
+35 #ifdeà
+__USE_MISC
+
+
+36 
+       $__LDBL_REDIR1_DECL
+ (
+qecvt
+, 
+ecvt
+)
+
+37 
+       $__LDBL_REDIR1_DECL
+ (
+qfcvt
+, 
+fcvt
+)
+
+38 
+       $__LDBL_REDIR1_DECL
+ (
+qgcvt
+, 
+gcvt
+)
+
+39 
+       $__LDBL_REDIR1_DECL
+ (
+qecvt_r
+, 
+ecvt_r
+)
+
+40 
+       $__LDBL_REDIR1_DECL
+ (
+qfcvt_r
+, 
+fcvt_r
+)
+
+       @/usr/include/bits/stdlib.h
+
+20 #iâdeà
+_STDLIB_H
+
+
+24 \r\ 5*
+       $__»®·th_chk
+ (
+__cڡ
\ 5*
+__»¡riù
+__Çme
+,
+
+25 \ 5*
+__»¡riù
+__»sÞved
+,
+
+26 
+size_t
+__»sÞvedËn
+__THROW
+__wur
+;
+
+27 \r\ 5*
+       `__REDIRECT_NTH
+ (
+__»®·th_®\9fs
+,
+
+28 (
+__cڡ
\ 5*
+__»¡riù
+__Çme
+,
+
+29 \ 5*
+__»¡riù
+__»sÞved
+), 
+»®·th
+__wur
+;
+
+30 \r\ 5*
+       `__REDIRECT_NTH
+ (
+__»®·th_chk_w¬n
+,
+
+31 (
+__cڡ
\ 5*
+__»¡riù
+__Çme
+,
+
+32 \ 5*
+__»¡riù
+__»sÞved
+,
+
+33 
+size_t
+__»sÞvedËn
+), 
+__»®·th_chk
+__wur
+
+
+34 
+       `__w¬Ç\89r
+ ("second\87rgument of\84ealpath must be\83ither NULL or\87t "
+
+37 
+__ex\8bº_®ways_\9al\9ae
+__wur
\ 5*
+
+38 
+       `__NTH
+ (
+       $»®·th
+ (
+__cڡ
\ 5*
+__»¡riù
+__Çme
+, \ 5*__»¡riù 
+__»sÞved
+))
+
+40 ià(
+       `__bos
+ (
+__»sÞved
+è!ð(
+size_t
+) -1)
+
+42 #ià
+def\9aed
+_LIBC_LIMITS_H_
+ && def\9aed 
+PATH_MAX
+
+
+43 ià(
+       `__bos
+ (
+__»sÞved
+è< 
+PATH_MAX
+)
+
+44 \15 
+       `__»®·th_chk_w¬n
+ (
+__Çme
+, 
+__»sÞved
+, 
+       `__bos
+ (__resolved));
+
+46 \15 
+       `__»®·th_chk
+ (
+__Çme
+, 
+__»sÞved
+, 
+       `__bos
+ (__resolved));
+
+49 \15 
+       `__»®·th_®\9fs
+ (
+__Çme
+, 
+__»sÞved
+);
+
+50 
+       }
+}
+
+53 \r\12
+       $__±¢ame_r_chk
+ (\12
+__fd
+, \ 5*
+__buf
+, 
+size_t
+__buæ\92
+,
+
+54 
+size_t
+__ėl
+__THROW
+       `__nÚnuÎ
+ ((2));
+
+55 \r\12
+       `__REDIRECT_NTH
+ (
+__±¢ame_r_®\9fs
+, (\12
+__fd
+, \ 5*
+__buf
+,
+
+56 
+size_t
+__buæ\92
+), 
+±¢ame_r
+)
+
+57 
+       `__nÚnuÎ
+ ((2));
+
+58 \r\12
+       `__REDIRECT_NTH
+ (
+__±¢ame_r_chk_w¬n
+,
+
+59 (\12
+__fd
+, \ 5*
+__buf
+, 
+size_t
+__buæ\92
+,
+
+60 
+size_t
+__ėl
+), 
+__±¢ame_r_chk
+)
+
+61 
+       `__nÚnuÎ
+ ((2)è
+       `__w¬Ç\89r
+ ("ptsname_r called with buflen bigger\81han "
+
+64 
+__ex\8bº_®ways_\9al\9ae
\12
+
+65 
+       `__NTH
+ (
+       $±¢ame_r
+ (\12
+__fd
+, \ 5*
+__buf
+, 
+size_t
+__buæ\92
+))
+
+67 ià(
+       `__bos
+ (
+__buf
+è!ð(
+size_t
+) -1)
+
+69 ià(!
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__buæ\92
+))
+
+70 \15 
+       `__±¢ame_r_chk
+ (
+__fd
+, 
+__buf
+, 
+__buæ\92
+, 
+       `__bos
+ (__buf));
+
+71 ià(
+__buæ\92
+ > 
+       `__bos
+ (
+__buf
+))
+
+72 \15 
+       `__±¢ame_r_chk_w¬n
+ (
+__fd
+, 
+__buf
+, 
+__buæ\92
+, 
+       `__bos
+ (__buf));
+
+74 \15 
+       `__±¢ame_r_®\9fs
+ (
+__fd
+, 
+__buf
+, 
+__buæ\92
+);
+
+75 
+       }
+}
+
+78 \r\12
+       $__wùomb_chk
+ (\ 5*
+__s
+, 
+wch¬_t
+__wch¬
+, 
+size_t
+__buæ\92
+)
+
+79 
+__THROW
+__wur
+;
+
+80 \r\12
+       `__REDIRECT_NTH
+ (
+__wùomb_®\9fs
+, (\ 5*
+__s
+, 
+wch¬_t
+__wch¬
+),
+
+81 
+wùomb
+__wur
+;
+
+83 
+__ex\8bº_®ways_\9al\9ae
+__wur
\12
+
+84 
+       `__NTH
+ (
+       $wùomb
+ (\ 5*
+__s
+, 
+wch¬_t
+__wch¬
+))
+
+89 \ 1
+       #__STDLIB_MB_LEN_MAX
+ 16
+
+       )
+
+90 #ià
+def\9aed
+MB_LEN_MAX
+ && MB_LEN_MAX !ð
+__STDLIB_MB_LEN_MAX
+
+
+93 ià(
+       `__bos
+ (
+__s
+è!ð(
+size_t
+è-1 && 
+__STDLIB_MB_LEN_MAX
+ > __bos (__s))
+
+94 \15 
+       `__wùomb_chk
+ (
+__s
+, 
+__wch¬
+, 
+       `__bos
+ (__s));
+
+95 \15 
+       `__wùomb_®\9fs
+ (
+__s
+, 
+__wch¬
+);
+
+96 
+       }
+}
+
+99 \r
+size_t
+       $__mb¡owcs_chk
+ (
+wch¬_t
+ *
+__»¡riù
+__d¡
+,
+
+100 
+__cڡ
\ 5*
+__»¡riù
+__¤c
+,
+
+101 
+size_t
+__Ën
+, size_\88
+__d¡Ën
+__THROW
+;
+
+102 \r
+size_t
+       `__REDIRECT_NTH
+ (
+__mb¡owcs_®\9fs
+,
+
+103 (
+wch¬_t
+ *
+__»¡riù
+__d¡
+,
+
+104 
+__cڡ
\ 5*
+__»¡riù
+__¤c
+,
+
+105 
+size_t
+__Ën
+), 
+mb¡owcs
+);
+
+106 \r
+size_t
+       `__REDIRECT_NTH
+ (
+__mb¡owcs_chk_w¬n
+,
+
+107 (
+wch¬_t
+ *
+__»¡riù
+__d¡
+,
+
+108 
+__cڡ
\ 5*
+__»¡riù
+__¤c
+,
+
+109 
+size_t
+__Ën
+, size_\88
+__d¡Ën
+), 
+__mb¡owcs_chk
+)
+
+110 
+       `__w¬Ç\89r
+ ("mbstowcs called with dst buffer smaller\81han\86en "
+
+113 
+__ex\8bº_®ways_\9al\9ae
+size_t
+
+
+114 
+       `__NTH
+ (
+       $mb¡owcs
+ (
+wch¬_t
+ *
+__»¡riù
+__d¡
+, 
+__cڡ
\ 5*__»¡riù 
+__¤c
+,
+
+115 
+size_t
+__Ën
+))
+
+117 ià(
+       `__bos
+ (
+__d¡
+è!ð(
+size_t
+) -1)
+
+119 ià(!
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__Ën
+))
+
+120 \15 
+       `__mb¡owcs_chk
+ (
+__d¡
+, 
+__¤c
+, 
+__Ën
+,
+
+121 
+       `__bos
+ (
+__d¡
+è/ \17 (
+wch¬_t
+));
+
+123 ià(
+__Ën
+ > 
+       `__bos
+ (
+__d¡
+è/ \17 (
+wch¬_t
+))
+
+124 \15 
+       `__mb¡owcs_chk_w¬n
+ (
+__d¡
+, 
+__¤c
+, 
+__Ën
+,
+
+125 
+       `__bos
+ (
+__d¡
+è/ \17 (
+wch¬_t
+));
+
+127 \15 
+       `__mb¡owcs_®\9fs
+ (
+__d¡
+, 
+__¤c
+, 
+__Ën
+);
+
+128 
+       }
+}
+
+131 \r
+size_t
+       $__wc¡ombs_chk
+ (\ 5*
+__»¡riù
+__d¡
+,
+
+132 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__¤c
+,
+
+133 
+size_t
+__Ën
+, size_\88
+__d¡Ën
+__THROW
+;
+
+134 \r
+size_t
+       `__REDIRECT_NTH
+ (
+__wc¡ombs_®\9fs
+,
+
+135 (\ 5*
+__»¡riù
+__d¡
+,
+
+136 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__¤c
+,
+
+137 
+size_t
+__Ën
+), 
+wc¡ombs
+);
+
+138 \r
+size_t
+       `__REDIRECT_NTH
+ (
+__wc¡ombs_chk_w¬n
+,
+
+139 (\ 5*
+__»¡riù
+__d¡
+,
+
+140 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__¤c
+,
+
+141 
+size_t
+__Ën
+, size_\88
+__d¡Ën
+), 
+__wc¡ombs_chk
+)
+
+142 
+       `__w¬Ç\89r
+ ("wcstombs called with dst buffer smaller\81han\86en");
+
+144 
+__ex\8bº_®ways_\9al\9ae
+size_t
+
+
+145 
+       `__NTH
+ (
+       $wc¡ombs
+ (\ 5*
+__»¡riù
+__d¡
+, 
+__cڡ
+wch¬_t
+ *__»¡riù 
+__¤c
+,
+
+146 
+size_t
+__Ën
+))
+
+148 ià(
+       `__bos
+ (
+__d¡
+è!ð(
+size_t
+) -1)
+
+150 ià(!
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__Ën
+))
+
+151 \15 
+       `__wc¡ombs_chk
+ (
+__d¡
+, 
+__¤c
+, 
+__Ën
+, 
+       `__bos
+ (__dst));
+
+152 ià(
+__Ën
+ > 
+       `__bos
+ (
+__d¡
+))
+
+153 \15 
+       `__wc¡ombs_chk_w¬n
+ (
+__d¡
+, 
+__¤c
+, 
+__Ën
+, 
+       `__bos
+ (__dst));
+
+155 \15 
+       `__wc¡ombs_®\9fs
+ (
+__d¡
+, 
+__¤c
+, 
+__Ën
+);
+
+156 
+       }
+}
+
+       @/usr/include/bits/string.h
+
+20 #iâdeà
+_STRING_H
+
+
+26 \ 1
+       #_STRING_ARCH_uÇligÃd
+ 1
+
+       )
+
+       @/usr/include/bits/string2.h
+
+21 #iâdeà
+_STRING_H
+
+
+25 #ià!
+def\9aed
+__NO_STRING_INLINES
+ && !def\9aed 
+__BOUNDED_POINTERS__
+
+
+42 #iâdeà
+__STRING_INLINE
+
+
+43 #ifdeà
+__ýlu¥lus
+
+
+44 \ 1
+       #__STRING_INLINE
+\9al\9ae
+
+
+       )
+
+46 \ 1
+       #__STRING_INLINE
+__ex\8bº_\9al\9ae
+
+
+       )
+
+50 #ià
+_STRING_ARCH_uÇligÃd
+
+
+52 \ 2
+       ~<\92d\9fn.h
+>
+
+53 \ 2
+       ~<b\99s/ty³s.h
+>
+
+55 #ià
+__BYTE_ORDER
+ =ð
+__LITTLE_ENDIAN
+
+
+56 \ 1
+       #__STRING2_SMALL_GET16
+(
+¤c
+, 
+idx
+) \
+
+57 (((
+__cڡ
\1d\ 5*è(__cÚ¡ \ 5*è(
+¤c
+))[
+idx
+ + 1] << 8 \
+
+58 | ((
+__cڡ
\1d\ 5*è(__cÚ¡ \ 5*è(
+¤c
+))[
+idx
+])
+
+       )
+
+59 \ 1
+       #__STRING2_SMALL_GET32
+(
+¤c
+, 
+idx
+) \
+
+60 (((((
+__cڡ
\1d\ 5*è(__cÚ¡ \ 5*è(
+¤c
+))[
+idx
+ + 3] << 8 \
+
+61 | ((
+__cڡ
\1d\ 5*è(__cÚ¡ \ 5*è(
+¤c
+))[
+idx
+ + 2]) << 8 \
+
+62 | ((
+__cڡ
\1d\ 5*è(__cÚ¡ \ 5*è(
+¤c
+))[
+idx
+ + 1]) << 8 \
+
+63 | ((
+__cڡ
\1d\ 5*è(__cÚ¡ \ 5*è(
+¤c
+))[
+idx
+])
+
+       )
+
+65 \ 1
+       #__STRING2_SMALL_GET16
+(
+¤c
+, 
+idx
+) \
+
+66 (((
+__cڡ
\1d\ 5*è(__cÚ¡ \ 5*è(
+¤c
+))[
+idx
+] << 8 \
+
+67 | ((
+__cڡ
\1d\ 5*è(__cÚ¡ \ 5*è(
+¤c
+))[
+idx
+ + 1])
+
+       )
+
+68 \ 1
+       #__STRING2_SMALL_GET32
+(
+¤c
+, 
+idx
+) \
+
+69 (((((
+__cڡ
\1d\ 5*è(__cÚ¡ \ 5*è(
+¤c
+))[
+idx
+] << 8 \
+
+70 | ((
+__cڡ
\1d\ 5*è(__cÚ¡ \ 5*è(
+¤c
+))[
+idx
+ + 1]) << 8 \
+
+71 | ((
+__cڡ
\1d\ 5*è(__cÚ¡ \ 5*è(
+¤c
+))[
+idx
+ + 2]) << 8 \
+
+72 | ((
+__cڡ
\1d\ 5*è(__cÚ¡ \ 5*è(
+¤c
+))[
+idx
+ + 3])
+
+       )
+
+77 \ 1
+       #__STRING2_COPY_TYPE
+(
+N
+) \
+
+78 \e¡ruù { \1d\ 5
+__¬r
+[
+N
+]; } \
+
+79 
+       t__©\8cibu\8b__
+ ((
+       t__·cked__
+)è
+       t__STRING2_COPY_ARR
+##
+       tN
+
+
+       )
+
+80 
+       t__STRING2_COPY_TYPE
+ (2);
+
+81 
+__STRING2_COPY_TYPE
+ (3);
+
+82 
+__STRING2_COPY_TYPE
+ (4);
+
+83 
+__STRING2_COPY_TYPE
+ (5);
+
+84 
+__STRING2_COPY_TYPE
+ (6);
+
+85 
+__STRING2_COPY_TYPE
+ (7);
+
+86 
+__STRING2_COPY_TYPE
+ (8);
+
+87 #undeà
+__STRING2_COPY_TYPE
+
+
+93 \ 1
+       #__¡r\9ag2_1b±r_p
+(
+__x
+) \
+
+94 ((
+size_t
+)(cڡ \1e*)((
+__x
+è+ 1è- (size_t)(cÚ¡ \1e*)(__xè=ð1)
+
+       )
+
+97 #ià!
+def\9aed
+_HAVE_STRING_ARCH_mem£t
+
+
+98 #ià!
+__GNUC_PREREQ
+ (3, 0)
+
+99 #ià
+_STRING_ARCH_uÇligÃd
+
+
+100 \ 1
+       #mem£t
+(
+s
+, 
+c
+, 
+n
+) \
+
+101 (
+       `__ex\8bnsiÚ__
+ (
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+n
+) && (n) <= 16 \
+
+102 ? ((
+n
+) == 1 \
+
+103 ? 
+       `__mem£t_1
+ (
+s
+, 
+c
+) \
+
+104 : 
+       `__mem£t_gc
+ (
+s
+, 
+c
+, 
+n
+)) \
+
+105 : (
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+c
+) && (c) == '\0' \
+
+106 ? ({ \1e*
+__s
+ = (
+s
+); 
+       `__bz\94o
+ (__s, 
+n
+); __s; }) \
+
+107 : 
+       `mem£t
+ (
+s
+, 
+c
+, 
+n
+))))
+
+       )
+
+109 \ 1
+       #__mem£t_1
+(
+s
+, 
+c
+è({ \1e*
+__s
+ = (s); \
+
+110 *((
+__u\9at8_t
+ *è
+__s
+èð(__u\9at8_tè
+c
+; __s; })
+
+       )
+
+112 \ 1
+       #__mem£t_gc
+(
+s
+, 
+c
+, 
+n
+) \
+
+113 ({ \1e*
+__s
+ = (
+s
+); \
+
+115 \1d\12
+__ui
+; \
+
+116 \1d\16\12
+__usi
+; \
+
+117 \1d\ 5
+__uc
+; \
+
+118 } *
+__u
+ = 
+__s
+; \
+
+119 
+__u\9at8_t
+__c
+ = (__u\9at8_tè(
+c
+); \
+
+122 \1a(\1d\12è(
+n
+)) \
+
+125 
+__u
+->
+__ui
+ = 
+__c
+ * 0x01010101; \
+
+126 
+__u
+ = 
+       `__ex\8bnsiÚ__
+ ((\1e*) __u + 4); \
+
+128 
+__u
+->
+__ui
+ = 
+__c
+ * 0x01010101; \
+
+129 
+__u
+ = 
+       `__ex\8bnsiÚ__
+ ((\1e*) __u + 4); \
+
+131 
+__u
+->
+__ui
+ = 
+__c
+ * 0x01010101; \
+
+132 
+__u
+ = 
+       `__ex\8bnsiÚ__
+ ((\1e*) __u + 4); \
+
+134 
+__u
+->
+__usi
+ = (\1d\16\12è
+__c
+ * 0x0101; \
+
+135 
+__u
+ = 
+       `__ex\8bnsiÚ__
+ ((\1e*) __u + 2); \
+
+136 
+__u
+->
+__uc
+ = (\1d\ 5è
+__c
+; \
+
+140 
+__u
+->
+__ui
+ = 
+__c
+ * 0x01010101; \
+
+141 
+__u
+ = 
+       `__ex\8bnsiÚ__
+ ((\1e*) __u + 4); \
+
+143 
+__u
+->
+__ui
+ = 
+__c
+ * 0x01010101; \
+
+144 
+__u
+ = 
+       `__ex\8bnsiÚ__
+ ((\1e*) __u + 4); \
+
+146 
+__u
+->
+__ui
+ = 
+__c
+ * 0x01010101; \
+
+147 
+__u
+ = 
+       `__ex\8bnsiÚ__
+ ((\1e*) __u + 4); \
+
+149 
+__u
+->
+__usi
+ = (\1d\16\12è
+__c
+ * 0x0101; \
+
+153 
+__u
+->
+__ui
+ = 
+__c
+ * 0x01010101; \
+
+154 
+__u
+ = 
+       `__ex\8bnsiÚ__
+ ((\1e*) __u + 4); \
+
+156 
+__u
+->
+__ui
+ = 
+__c
+ * 0x01010101; \
+
+157 
+__u
+ = 
+       `__ex\8bnsiÚ__
+ ((\1e*) __u + 4); \
+
+159 
+__u
+->
+__ui
+ = 
+__c
+ * 0x01010101; \
+
+160 
+__u
+ = 
+       `__ex\8bnsiÚ__
+ ((\1e*) __u + 4); \
+
+162 
+__u
+->
+__uc
+ = (\1d\ 5è
+__c
+; \
+
+166 
+__u
+->
+__ui
+ = 
+__c
+ * 0x01010101; \
+
+167 
+__u
+ = 
+       `__ex\8bnsiÚ__
+ ((\1e*) __u + 4); \
+
+169 
+__u
+->
+__ui
+ = 
+__c
+ * 0x01010101; \
+
+170 
+__u
+ = 
+       `__ex\8bnsiÚ__
+ ((\1e*) __u + 4); \
+
+172 
+__u
+->
+__ui
+ = 
+__c
+ * 0x01010101; \
+
+173 
+__u
+ = 
+       `__ex\8bnsiÚ__
+ ((\1e*) __u + 4); \
+
+175 
+__u
+->
+__ui
+ = 
+__c
+ * 0x01010101; \
+
+180 
+__s
+; })
+
+       )
+
+182 \ 1
+       #mem£t
+(
+s
+, 
+c
+, 
+n
+) \
+
+183 (
+       `__ex\8bnsiÚ__
+ (
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+c
+) && (c) == '\0' \
+
+184 ? ({ \1e*
+__s
+ = (
+s
+); 
+       `__bz\94o
+ (__s, 
+n
+); __s; }) \
+
+185 : 
+       `mem£t
+ (
+s
+, 
+c
+, 
+n
+)))
+
+       )
+
+194 #ià
+__GNUC_PREREQ
+ (2, 91)
+
+195 \ 1
+       #__bz\94o
+(
+s
+, 
+n
+       `__bu\9et\9a_mem£t
+ (s, '\0',\82)
+
+       )
+
+203 #ifdeà
+__USE_GNU
+
+
+204 #ià!
+def\9aed
+_HAVE_STRING_ARCH_mempýy
+ || def\9aed 
+_FORCE_INLINES
+
+
+205 #iâdeà
+_HAVE_STRING_ARCH_mempýy
+
+
+206 #ià
+__GNUC_PREREQ
+ (3, 4)
+
+207 \ 1
+       #__mempýy
+(
+de¡
+, 
+¤c
+, 
+n
+       `__bu\9et\9a_mempýy
+ (de¡, src,\82)
+
+       )
+
+208 #\96
+__GNUC_PREREQ
+ (3, 0)
+
+209 \ 1
+       #__mempýy
+(
+de¡
+, 
+¤c
+, 
+n
+) \
+
+210 (
+       `__ex\8bnsiÚ__
+ (
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+¤c
+è&& __bu\9et\9a_cÚ¡ªt_°(
+n
+) \
+
+211 && 
+       `__¡r\9ag2_1b±r_p
+ (
+¤c
+è&& 
+n
+ <= 8 \
+
+212 ? 
+       `__bu\9et\9a_memýy
+ (
+de¡
+, 
+¤c
+, 
+n
+) + (n) \
+
+213 : 
+       `__mempýy
+ (
+de¡
+, 
+¤c
+, 
+n
+)))
+
+       )
+
+215 \ 1
+       #__mempýy
+(
+de¡
+, 
+¤c
+, 
+n
+) \
+
+216 (
+       `__ex\8bnsiÚ__
+ (
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+¤c
+è&& __bu\9et\9a_cÚ¡ªt_°(
+n
+) \
+
+217 && 
+       `__¡r\9ag2_1b±r_p
+ (
+¤c
+è&& 
+n
+ <= 8 \
+
+218 ? 
+       `__mempýy_sm®l
+ (
+de¡
+, 
+       `__mempýy_¬gs
+ (
+¤c
+), 
+n
+) \
+
+219 : 
+       `__mempýy
+ (
+de¡
+, 
+¤c
+, 
+n
+)))
+
+       )
+
+223 \ 1
+       #mempýy
+(
+de¡
+, 
+¤c
+, 
+n
+       `__mempýy
+ (de¡, src,\82)
+
+       )
+
+226 #ià!
+__GNUC_PREREQ
+ (3, 0è|| 
+def\9aed
+_FORCE_INLINES
+
+
+227 #ià
+_STRING_ARCH_uÇligÃd
+
+
+228 #iâdeà
+_FORCE_INLINES
+
+
+229 \ 1
+       #__mempýy_¬gs
+(
+¤c
+) \
+
+230 ((
+__cڡ
\ 5*è(
+¤c
+))[0], ((__const \ 5*) (src))[2], \
+
+231 ((
+__cڡ
\ 5*è(
+¤c
+))[4], ((__const \ 5*) (src))[6], \
+
+232 
+__ex\8bnsiÚ__
+       `__STRING2_SMALL_GET16
+ (
+¤c
+, 0), \
+
+233 
+__ex\8bnsiÚ__
+       `__STRING2_SMALL_GET16
+ (
+¤c
+, 4), \
+
+234 
+__ex\8bnsiÚ__
+       `__STRING2_SMALL_GET32
+ (
+¤c
+, 0), \
+
+235 
+__ex\8bnsiÚ__
+       `__STRING2_SMALL_GET32
+ (
+¤c
+, 4)
+
+       )
+
+237 
+__STRING_INLINE
\1e*
+__mempýy_sm®l
+ (\1e*, \ 5\ 5\ 5\ 5,
+
+238 
+__u\9at16_t
+, __u\9at16_t, 
+__u\9at32_t
+,
+
+239 
+__u\9at32_t
+, 
+size_t
+);
+
+240 
+__STRING_INLINE
\1e*
+
+241 
+       $__mempýy_sm®l
+ (\1e*
+__de¡1
+,
+
+242 \ 5
+__¤c0_1
+, \ 5
+__¤c2_1
+, \ 5
+__¤c4_1
+, \ 5
+__¤c6_1
+,
+
+243 
+__u\9at16_t
+__¤c0_2
+, __u\9at16_\88
+__¤c4_2
+,
+
+244 
+__u\9at32_t
+__¤c0_4
+, __u\9at32_\88
+__¤c4_4
+,
+
+245 
+size_t
+__¤þ\92
+)
+
+248 
+__u\9at32_t
+__ui
+;
+
+249 
+__u\9at16_t
+__usi
+;
+
+250 \1d\ 5
+__uc
+;
+
+251 \1d\ 5
+__c
+;
+
+252 } *
+__u
+ = 
+__de¡1
+;
+
+253 \1a(\1d\12è
+__¤þ\92
+)
+
+256 
+__u
+->
+__c
+ = 
+__¤c0_1
+;
+
+257 
+__u
+ = 
+       `__ex\8bnsiÚ__
+ ((\1e*) __u + 1);
+
+260 
+__u
+->
+__usi
+ = 
+__¤c0_2
+;
+
+261 
+__u
+ = 
+       `__ex\8bnsiÚ__
+ ((\1e*) __u + 2);
+
+264 
+__u
+->
+__usi
+ = 
+__¤c0_2
+;
+
+265 
+__u
+ = 
+       `__ex\8bnsiÚ__
+ ((\1e*) __u + 2);
+
+266 
+__u
+->
+__c
+ = 
+__¤c2_1
+;
+
+267 
+__u
+ = 
+       `__ex\8bnsiÚ__
+ ((\1e*) __u + 1);
+
+270 
+__u
+->
+__ui
+ = 
+__¤c0_4
+;
+
+271 
+__u
+ = 
+       `__ex\8bnsiÚ__
+ ((\1e*) __u + 4);
+
+274 
+__u
+->
+__ui
+ = 
+__¤c0_4
+;
+
+275 
+__u
+ = 
+       `__ex\8bnsiÚ__
+ ((\1e*) __u + 4);
+
+276 
+__u
+->
+__c
+ = 
+__¤c4_1
+;
+
+277 
+__u
+ = 
+       `__ex\8bnsiÚ__
+ ((\1e*) __u + 1);
+
+280 
+__u
+->
+__ui
+ = 
+__¤c0_4
+;
+
+281 
+__u
+ = 
+       `__ex\8bnsiÚ__
+ ((\1e*) __u + 4);
+
+282 
+__u
+->
+__usi
+ = 
+__¤c4_2
+;
+
+283 
+__u
+ = 
+       `__ex\8bnsiÚ__
+ ((\1e*) __u + 2);
+
+286 
+__u
+->
+__ui
+ = 
+__¤c0_4
+;
+
+287 
+__u
+ = 
+       `__ex\8bnsiÚ__
+ ((\1e*) __u + 4);
+
+288 
+__u
+->
+__usi
+ = 
+__¤c4_2
+;
+
+289 
+__u
+ = 
+       `__ex\8bnsiÚ__
+ ((\1e*) __u + 2);
+
+290 
+__u
+->
+__c
+ = 
+__¤c6_1
+;
+
+291 
+__u
+ = 
+       `__ex\8bnsiÚ__
+ ((\1e*) __u + 1);
+
+294 
+__u
+->
+__ui
+ = 
+__¤c0_4
+;
+
+295 
+__u
+ = 
+       `__ex\8bnsiÚ__
+ ((\1e*) __u + 4);
+
+296 
+__u
+->
+__ui
+ = 
+__¤c4_4
+;
+
+297 
+__u
+ = 
+       `__ex\8bnsiÚ__
+ ((\1e*) __u + 4);
+
+300 \15 (\1e
+__u
+;
+
+301 
+       }
+}
+
+303 #iâdeà
+_FORCE_INLINES
+
+
+304 \ 1
+       #__mempýy_¬gs
+(
+¤c
+) \
+
+305 ((
+__cڡ
\ 5*è(
+¤c
+))[0], \
+
+306 
+       `__ex\8bnsiÚ__
+ ((
+__STRING2_COPY_ARR2
+) \
+
+307 { { ((
+__cڡ
\ 5*è(
+¤c
+))[0], ((__const \ 5*) (src))[1] } }), \
+
+308 
+       `__ex\8bnsiÚ__
+ ((
+__STRING2_COPY_ARR3
+) \
+
+309 { { ((
+__cڡ
\ 5*è(
+¤c
+))[0], ((__const \ 5*) (src))[1], \
+
+310 ((
+__cڡ
\ 5*è(
+¤c
+))[2] } }), \
+
+311 
+       `__ex\8bnsiÚ__
+ ((
+__STRING2_COPY_ARR4
+) \
+
+312 { { ((
+__cڡ
\ 5*è(
+¤c
+))[0], ((__const \ 5*) (src))[1], \
+
+313 ((
+__cڡ
\ 5*è(
+¤c
+))[2], ((__const \ 5*) (src))[3] } }), \
+
+314 
+       `__ex\8bnsiÚ__
+ ((
+__STRING2_COPY_ARR5
+) \
+
+315 { { ((
+__cڡ
\ 5*è(
+¤c
+))[0], ((__const \ 5*) (src))[1], \
+
+316 ((
+__cڡ
\ 5*è(
+¤c
+))[2], ((__const \ 5*) (src))[3], \
+
+317 ((
+__cڡ
\ 5*è(
+¤c
+))[4] } }), \
+
+318 
+       `__ex\8bnsiÚ__
+ ((
+__STRING2_COPY_ARR6
+) \
+
+319 { { ((
+__cڡ
\ 5*è(
+¤c
+))[0], ((__const \ 5*) (src))[1], \
+
+320 ((
+__cڡ
\ 5*è(
+¤c
+))[2], ((__const \ 5*) (src))[3], \
+
+321 ((
+__cڡ
\ 5*è(
+¤c
+))[4], ((__const \ 5*) (src))[5] } }), \
+
+322 
+       `__ex\8bnsiÚ__
+ ((
+__STRING2_COPY_ARR7
+) \
+
+323 { { ((
+__cڡ
\ 5*è(
+¤c
+))[0], ((__const \ 5*) (src))[1], \
+
+324 ((
+__cڡ
\ 5*è(
+¤c
+))[2], ((__const \ 5*) (src))[3], \
+
+325 ((
+__cڡ
\ 5*è(
+¤c
+))[4], ((__const \ 5*) (src))[5], \
+
+326 ((
+__cڡ
\ 5*è(
+¤c
+))[6] } }), \
+
+327 
+       `__ex\8bnsiÚ__
+ ((
+__STRING2_COPY_ARR8
+) \
+
+328 { { ((
+__cڡ
\ 5*è(
+¤c
+))[0], ((__const \ 5*) (src))[1], \
+
+329 ((
+__cڡ
\ 5*è(
+¤c
+))[2], ((__const \ 5*) (src))[3], \
+
+330 ((
+__cڡ
\ 5*è(
+¤c
+))[4], ((__const \ 5*) (src))[5], \
+
+331 ((
+__cڡ
\ 5*è(
+¤c
+))[6], ((__cÚ¡ \ 5*è(¤c))[7] } })
+
+       )
+
+333 
+__STRING_INLINE
\1e*
+__mempýy_sm®l
+ (\1e*, \ 5
+__STRING2_COPY_ARR2
+,
+
+334 
+__STRING2_COPY_ARR3
+,
+
+335 
+__STRING2_COPY_ARR4
+,
+
+336 
+__STRING2_COPY_ARR5
+,
+
+337 
+__STRING2_COPY_ARR6
+,
+
+338 
+__STRING2_COPY_ARR7
+,
+
+339 
+__STRING2_COPY_ARR8
+, 
+size_t
+);
+
+340 
+__STRING_INLINE
\1e*
+
+341 
+       $__mempýy_sm®l
+ (\1e*
+__de¡
+, \ 5
+__¤c1
+,
+
+342 
+__STRING2_COPY_ARR2
+__¤c2
+, 
+__STRING2_COPY_ARR3
+__¤c3
+,
+
+343 
+__STRING2_COPY_ARR4
+__¤c4
+, 
+__STRING2_COPY_ARR5
+__¤c5
+,
+
+344 
+__STRING2_COPY_ARR6
+__¤c6
+, 
+__STRING2_COPY_ARR7
+__¤c7
+,
+
+345 
+__STRING2_COPY_ARR8
+__¤c8
+, 
+size_t
+__¤þ\92
+)
+
+348 \ 5
+__c
+;
+
+349 
+__STRING2_COPY_ARR2
+__sÿ2
+;
+
+350 
+__STRING2_COPY_ARR3
+__sÿ3
+;
+
+351 
+__STRING2_COPY_ARR4
+__sÿ4
+;
+
+352 
+__STRING2_COPY_ARR5
+__sÿ5
+;
+
+353 
+__STRING2_COPY_ARR6
+__sÿ6
+;
+
+354 
+__STRING2_COPY_ARR7
+__sÿ7
+;
+
+355 
+__STRING2_COPY_ARR8
+__sÿ8
+;
+
+356 } *
+__u
+ = 
+__de¡
+;
+
+357 \1a(\1d\12è
+__¤þ\92
+)
+
+360 
+__u
+->
+__c
+ = 
+__¤c1
+;
+
+363 
+__ex\8bnsiÚ__
+__u
+->
+__sÿ2
+ = 
+__¤c2
+;
+
+366 
+__ex\8bnsiÚ__
+__u
+->
+__sÿ3
+ = 
+__¤c3
+;
+
+369 
+__ex\8bnsiÚ__
+__u
+->
+__sÿ4
+ = 
+__¤c4
+;
+
+372 
+__ex\8bnsiÚ__
+__u
+->
+__sÿ5
+ = 
+__¤c5
+;
+
+375 
+__ex\8bnsiÚ__
+__u
+->
+__sÿ6
+ = 
+__¤c6
+;
+
+378 
+__ex\8bnsiÚ__
+__u
+->
+__sÿ7
+ = 
+__¤c7
+;
+
+381 
+__ex\8bnsiÚ__
+__u
+->
+__sÿ8
+ = 
+__¤c8
+;
+
+384 \15 
+       `__ex\8bnsiÚ__
+ ((\1e
+__u
+ + 
+__¤þ\92
+);
+
+385 
+       }
+}
+
+393 #iâdeà
+_HAVE_STRING_ARCH_¡rchr
+
+
+394 \r\1e*
+__¿wmemchr
+ (cڡ \1e*
+__s
+, \12
+__c
+);
+
+395 #ià
+__GNUC_PREREQ
+ (3, 2)
+
+396 \ 1
+       #¡rchr
+(
+s
+, 
+c
+) \
+
+397 (
+       `__ex\8bnsiÚ__
+ (
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+c
+è&& !__bu\9et\9a_cÚ¡ªt_°(
+s
+) \
+
+398 && (
+c
+) == '\0' \
+
+399 ? (\ 5
+       `__¿wmemchr
+ (
+s
+, 
+c
+) \
+
+400 : 
+       `__bu\9et\9a_¡rchr
+ (
+s
+, 
+c
+)))
+
+       )
+
+402 \ 1
+       #¡rchr
+(
+s
+, 
+c
+) \
+
+403 (
+       `__ex\8bnsiÚ__
+ (
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+c
+) && (c) == '\0' \
+
+404 ? (\ 5
+       `__¿wmemchr
+ (
+s
+, 
+c
+) \
+
+405 : 
+       `¡rchr
+ (
+s
+, 
+c
+)))
+
+       )
+
+411 #ià(!
+def\9aed
+_HAVE_STRING_ARCH_¡rýy
+ && !
+__GNUC_PREREQ
+ (3, 0)) \
+
+412 || 
+def\9aed
+       g_FORCE_INLINES
+
+
+413 #ià!
+def\9aed
+_HAVE_STRING_ARCH_¡rýy
+ && !
+__GNUC_PREREQ
+ (3, 0)
+
+414 \ 1
+       #¡rýy
+(
+de¡
+, 
+¤c
+) \
+
+415 (
+       `__ex\8bnsiÚ__
+ (
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+¤c
+) \
+
+416 ? (
+       `__¡r\9ag2_1b±r_p
+ (
+¤c
+è&& 
+       `¡¾\92
+ (src) + 1 <= 8 \
+
+417 ? 
+       `__¡rýy_sm®l
+ (
+de¡
+, 
+       `__¡rýy_¬gs
+ (
+¤c
+), \
+
+418 
+       `¡¾\92
+ (
+¤c
+) + 1) \
+
+419 : (\ 5
+       `memýy
+ (
+de¡
+, 
+¤c
+, 
+       `¡¾\92
+ (src) + 1)) \
+
+420 : 
+       `¡rýy
+ (
+de¡
+, 
+¤c
+)))
+
+       )
+
+423 #ià
+_STRING_ARCH_uÇligÃd
+
+
+424 #iâdeà
+_FORCE_INLINES
+
+
+425 \ 1
+       #__¡rýy_¬gs
+(
+¤c
+) \
+
+426 
+__ex\8bnsiÚ__
+       `__STRING2_SMALL_GET16
+ (
+¤c
+, 0), \
+
+427 
+__ex\8bnsiÚ__
+       `__STRING2_SMALL_GET16
+ (
+¤c
+, 4), \
+
+428 
+__ex\8bnsiÚ__
+       `__STRING2_SMALL_GET32
+ (
+¤c
+, 0), \
+
+429 
+__ex\8bnsiÚ__
+       `__STRING2_SMALL_GET32
+ (
+¤c
+, 4)
+
+       )
+
+431 
+__STRING_INLINE
\ 5*
+__¡rýy_sm®l
+ (\ 5*, 
+__u\9at16_t
+, __uint16_t,
+
+432 
+__u\9at32_t
+, __u\9at32_t, 
+size_t
+);
+
+433 
+__STRING_INLINE
\ 5*
+
+434 
+       $__¡rýy_sm®l
+ (\ 5*
+__de¡
+,
+
+435 
+__u\9at16_t
+__¤c0_2
+, __u\9at16_\88
+__¤c4_2
+,
+
+436 
+__u\9at32_t
+__¤c0_4
+, __u\9at32_\88
+__¤c4_4
+,
+
+437 
+size_t
+__¤þ\92
+)
+
+440 
+__u\9at32_t
+__ui
+;
+
+441 
+__u\9at16_t
+__usi
+;
+
+442 \1d\ 5
+__uc
+;
+
+443 } *
+__u
+ = (\1e
+__de¡
+;
+
+444 \1a(\1d\12è
+__¤þ\92
+)
+
+447 
+__u
+->
+__uc
+ = '\0';
+
+450 
+__u
+->
+__usi
+ = 
+__¤c0_2
+;
+
+453 
+__u
+->
+__usi
+ = 
+__¤c0_2
+;
+
+454 
+__u
+ = 
+       `__ex\8bnsiÚ__
+ ((\1e*) __u + 2);
+
+455 
+__u
+->
+__uc
+ = '\0';
+
+458 
+__u
+->
+__ui
+ = 
+__¤c0_4
+;
+
+461 
+__u
+->
+__ui
+ = 
+__¤c0_4
+;
+
+462 
+__u
+ = 
+       `__ex\8bnsiÚ__
+ ((\1e*) __u + 4);
+
+463 
+__u
+->
+__uc
+ = '\0';
+
+466 
+__u
+->
+__ui
+ = 
+__¤c0_4
+;
+
+467 
+__u
+ = 
+       `__ex\8bnsiÚ__
+ ((\1e*) __u + 4);
+
+468 
+__u
+->
+__usi
+ = 
+__¤c4_2
+;
+
+471 
+__u
+->
+__ui
+ = 
+__¤c0_4
+;
+
+472 
+__u
+ = 
+       `__ex\8bnsiÚ__
+ ((\1e*) __u + 4);
+
+473 
+__u
+->
+__usi
+ = 
+__¤c4_2
+;
+
+474 
+__u
+ = 
+       `__ex\8bnsiÚ__
+ ((\1e*) __u + 2);
+
+475 
+__u
+->
+__uc
+ = '\0';
+
+478 
+__u
+->
+__ui
+ = 
+__¤c0_4
+;
+
+479 
+__u
+ = 
+       `__ex\8bnsiÚ__
+ ((\1e*) __u + 4);
+
+480 
+__u
+->
+__ui
+ = 
+__¤c4_4
+;
+
+483 \15 
+__de¡
+;
+
+484 
+       }
+}
+
+486 #iâdeà
+_FORCE_INLINES
+
+
+487 \ 1
+       #__¡rýy_¬gs
+(
+¤c
+) \
+
+488 
+       `__ex\8bnsiÚ__
+ ((
+__STRING2_COPY_ARR2
+) \
+
+489 { { ((
+__cڡ
\ 5*è(
+¤c
+))[0], '\0' } }), \
+
+490 
+       `__ex\8bnsiÚ__
+ ((
+__STRING2_COPY_ARR3
+) \
+
+491 { { ((
+__cڡ
\ 5*è(
+¤c
+))[0], ((__const \ 5*) (src))[1], \
+
+493 
+       `__ex\8bnsiÚ__
+ ((
+__STRING2_COPY_ARR4
+) \
+
+494 { { ((
+__cڡ
\ 5*è(
+¤c
+))[0], ((__const \ 5*) (src))[1], \
+
+495 ((
+__cڡ
\ 5*è(
+¤c
+))[2], '\0' } }), \
+
+496 
+       `__ex\8bnsiÚ__
+ ((
+__STRING2_COPY_ARR5
+) \
+
+497 { { ((
+__cڡ
\ 5*è(
+¤c
+))[0], ((__const \ 5*) (src))[1], \
+
+498 ((
+__cڡ
\ 5*è(
+¤c
+))[2], ((__const \ 5*) (src))[3], \
+
+500 
+       `__ex\8bnsiÚ__
+ ((
+__STRING2_COPY_ARR6
+) \
+
+501 { { ((
+__cڡ
\ 5*è(
+¤c
+))[0], ((__const \ 5*) (src))[1], \
+
+502 ((
+__cڡ
\ 5*è(
+¤c
+))[2], ((__const \ 5*) (src))[3], \
+
+503 ((
+__cڡ
\ 5*è(
+¤c
+))[4], '\0' } }), \
+
+504 
+       `__ex\8bnsiÚ__
+ ((
+__STRING2_COPY_ARR7
+) \
+
+505 { { ((
+__cڡ
\ 5*è(
+¤c
+))[0], ((__const \ 5*) (src))[1], \
+
+506 ((
+__cڡ
\ 5*è(
+¤c
+))[2], ((__const \ 5*) (src))[3], \
+
+507 ((
+__cڡ
\ 5*è(
+¤c
+))[4], ((__const \ 5*) (src))[5], \
+
+509 
+       `__ex\8bnsiÚ__
+ ((
+__STRING2_COPY_ARR8
+) \
+
+510 { { ((
+__cڡ
\ 5*è(
+¤c
+))[0], ((__const \ 5*) (src))[1], \
+
+511 ((
+__cڡ
\ 5*è(
+¤c
+))[2], ((__const \ 5*) (src))[3], \
+
+512 ((
+__cڡ
\ 5*è(
+¤c
+))[4], ((__const \ 5*) (src))[5], \
+
+513 ((
+__cڡ
\ 5*è(
+¤c
+))[6], '\0' } })
+
+       )
+
+515 
+__STRING_INLINE
\ 5*
+__¡rýy_sm®l
+ (\ 5*, 
+__STRING2_COPY_ARR2
+,
+
+516 
+__STRING2_COPY_ARR3
+,
+
+517 
+__STRING2_COPY_ARR4
+,
+
+518 
+__STRING2_COPY_ARR5
+,
+
+519 
+__STRING2_COPY_ARR6
+,
+
+520 
+__STRING2_COPY_ARR7
+,
+
+521 
+__STRING2_COPY_ARR8
+, 
+size_t
+);
+
+522 
+__STRING_INLINE
\ 5*
+
+523 
+       $__¡rýy_sm®l
+ (\ 5*
+__de¡
+,
+
+524 
+__STRING2_COPY_ARR2
+__¤c2
+, 
+__STRING2_COPY_ARR3
+__¤c3
+,
+
+525 
+__STRING2_COPY_ARR4
+__¤c4
+, 
+__STRING2_COPY_ARR5
+__¤c5
+,
+
+526 
+__STRING2_COPY_ARR6
+__¤c6
+, 
+__STRING2_COPY_ARR7
+__¤c7
+,
+
+527 
+__STRING2_COPY_ARR8
+__¤c8
+, 
+size_t
+__¤þ\92
+)
+
+530 \ 5
+__c
+;
+
+531 
+__STRING2_COPY_ARR2
+__sÿ2
+;
+
+532 
+__STRING2_COPY_ARR3
+__sÿ3
+;
+
+533 
+__STRING2_COPY_ARR4
+__sÿ4
+;
+
+534 
+__STRING2_COPY_ARR5
+__sÿ5
+;
+
+535 
+__STRING2_COPY_ARR6
+__sÿ6
+;
+
+536 
+__STRING2_COPY_ARR7
+__sÿ7
+;
+
+537 
+__STRING2_COPY_ARR8
+__sÿ8
+;
+
+538 } *
+__u
+ = (\1e
+__de¡
+;
+
+539 \1a(\1d\12è
+__¤þ\92
+)
+
+542 
+__u
+->
+__c
+ = '\0';
+
+545 
+__ex\8bnsiÚ__
+__u
+->
+__sÿ2
+ = 
+__¤c2
+;
+
+548 
+__ex\8bnsiÚ__
+__u
+->
+__sÿ3
+ = 
+__¤c3
+;
+
+551 
+__ex\8bnsiÚ__
+__u
+->
+__sÿ4
+ = 
+__¤c4
+;
+
+554 
+__ex\8bnsiÚ__
+__u
+->
+__sÿ5
+ = 
+__¤c5
+;
+
+557 
+__ex\8bnsiÚ__
+__u
+->
+__sÿ6
+ = 
+__¤c6
+;
+
+560 
+__ex\8bnsiÚ__
+__u
+->
+__sÿ7
+ = 
+__¤c7
+;
+
+563 
+__ex\8bnsiÚ__
+__u
+->
+__sÿ8
+ = 
+__¤c8
+;
+
+566 \15 
+__de¡
+;
+
+567 
+       }
+}
+
+573 #ifdeà
+__USE_GNU
+
+
+574 #ià!
+def\9aed
+_HAVE_STRING_ARCH_¡pýy
+ || def\9aed 
+_FORCE_INLINES
+
+
+575 #iâdeà
+_HAVE_STRING_ARCH_¡pýy
+
+
+576 #ià
+__GNUC_PREREQ
+ (3, 4)
+
+577 \ 1
+       #__¡pýy
+(
+de¡
+, 
+¤c
+       `__bu\9et\9a_¡pýy
+ (de¡, src)
+
+       )
+
+578 #\96
+__GNUC_PREREQ
+ (3, 0)
+
+579 \ 1
+       #__¡pýy
+(
+de¡
+, 
+¤c
+) \
+
+580 (
+       `__ex\8bnsiÚ__
+ (
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+¤c
+) \
+
+581 ? (
+       `__¡r\9ag2_1b±r_p
+ (
+¤c
+è&& 
+       `¡¾\92
+ (src) + 1 <= 8 \
+
+582 ? 
+       `__bu\9et\9a_¡rýy
+ (
+de¡
+, 
+¤c
+è+ 
+       `¡¾\92
+ (src) \
+
+583 : ((\ 5*è(
+__mempýy
+è(
+de¡
+, 
+¤c
+, 
+       `¡¾\92
+ (src) + 1) \
+
+585 : 
+       `__¡pýy
+ (
+de¡
+, 
+¤c
+)))
+
+       )
+
+587 \ 1
+       #__¡pýy
+(
+de¡
+, 
+¤c
+) \
+
+588 (
+       `__ex\8bnsiÚ__
+ (
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+¤c
+) \
+
+589 ? (
+       `__¡r\9ag2_1b±r_p
+ (
+¤c
+è&& 
+       `¡¾\92
+ (src) + 1 <= 8 \
+
+590 ? 
+       `__¡pýy_sm®l
+ (
+de¡
+, 
+       `__¡pýy_¬gs
+ (
+¤c
+), \
+
+591 
+       `¡¾\92
+ (
+¤c
+) + 1) \
+
+592 : ((\ 5*è(
+__mempýy
+è(
+de¡
+, 
+¤c
+, 
+       `¡¾\92
+ (src) + 1) \
+
+594 : 
+       `__¡pýy
+ (
+de¡
+, 
+¤c
+)))
+
+       )
+
+598 \ 1
+       #¡pýy
+(
+de¡
+, 
+¤c
+       `__¡pýy
+ (de¡, src)
+
+       )
+
+601 #ià!
+__GNUC_PREREQ
+ (3, 0è|| 
+def\9aed
+_FORCE_INLINES
+
+
+602 #ià
+_STRING_ARCH_uÇligÃd
+
+
+603 #iâdeà
+_FORCE_INLINES
+
+
+604 \ 1
+       #__¡pýy_¬gs
+(
+¤c
+) \
+
+605 
+__ex\8bnsiÚ__
+       `__STRING2_SMALL_GET16
+ (
+¤c
+, 0), \
+
+606 
+__ex\8bnsiÚ__
+       `__STRING2_SMALL_GET16
+ (
+¤c
+, 4), \
+
+607 
+__ex\8bnsiÚ__
+       `__STRING2_SMALL_GET32
+ (
+¤c
+, 0), \
+
+608 
+__ex\8bnsiÚ__
+       `__STRING2_SMALL_GET32
+ (
+¤c
+, 4)
+
+       )
+
+610 
+__STRING_INLINE
\ 5*
+__¡pýy_sm®l
+ (\ 5*, 
+__u\9at16_t
+, __uint16_t,
+
+611 
+__u\9at32_t
+, __u\9at32_t, 
+size_t
+);
+
+612 
+__STRING_INLINE
\ 5*
+
+613 
+       $__¡pýy_sm®l
+ (\ 5*
+__de¡
+,
+
+614 
+__u\9at16_t
+__¤c0_2
+, __u\9at16_\88
+__¤c4_2
+,
+
+615 
+__u\9at32_t
+__¤c0_4
+, __u\9at32_\88
+__¤c4_4
+,
+
+616 
+size_t
+__¤þ\92
+)
+
+619 \1d\12
+__ui
+;
+
+620 \1d\16\12
+__usi
+;
+
+621 \1d\ 5
+__uc
+;
+
+622 \ 5
+__c
+;
+
+623 } *
+__u
+ = (\1e
+__de¡
+;
+
+624 \1a(\1d\12è
+__¤þ\92
+)
+
+627 
+__u
+->
+__uc
+ = '\0';
+
+630 
+__u
+->
+__usi
+ = 
+__¤c0_2
+;
+
+631 
+__u
+ = 
+       `__ex\8bnsiÚ__
+ ((\1e*) __u + 1);
+
+634 
+__u
+->
+__usi
+ = 
+__¤c0_2
+;
+
+635 
+__u
+ = 
+       `__ex\8bnsiÚ__
+ ((\1e*) __u + 2);
+
+636 
+__u
+->
+__uc
+ = '\0';
+
+639 
+__u
+->
+__ui
+ = 
+__¤c0_4
+;
+
+640 
+__u
+ = 
+       `__ex\8bnsiÚ__
+ ((\1e*) __u + 3);
+
+643 
+__u
+->
+__ui
+ = 
+__¤c0_4
+;
+
+644 
+__u
+ = 
+       `__ex\8bnsiÚ__
+ ((\1e*) __u + 4);
+
+645 
+__u
+->
+__uc
+ = '\0';
+
+648 
+__u
+->
+__ui
+ = 
+__¤c0_4
+;
+
+649 
+__u
+ = 
+       `__ex\8bnsiÚ__
+ ((\1e*) __u + 4);
+
+650 
+__u
+->
+__usi
+ = 
+__¤c4_2
+;
+
+651 
+__u
+ = 
+       `__ex\8bnsiÚ__
+ ((\1e*) __u + 1);
+
+654 
+__u
+->
+__ui
+ = 
+__¤c0_4
+;
+
+655 
+__u
+ = 
+       `__ex\8bnsiÚ__
+ ((\1e*) __u + 4);
+
+656 
+__u
+->
+__usi
+ = 
+__¤c4_2
+;
+
+657 
+__u
+ = 
+       `__ex\8bnsiÚ__
+ ((\1e*) __u + 2);
+
+658 
+__u
+->
+__uc
+ = '\0';
+
+661 
+__u
+->
+__ui
+ = 
+__¤c0_4
+;
+
+662 
+__u
+ = 
+       `__ex\8bnsiÚ__
+ ((\1e*) __u + 4);
+
+663 
+__u
+->
+__ui
+ = 
+__¤c4_4
+;
+
+664 
+__u
+ = 
+       `__ex\8bnsiÚ__
+ ((\1e*) __u + 3);
+
+667 \15 &
+__u
+->
+__c
+;
+
+668 
+       }
+}
+
+670 #iâdeà
+_FORCE_INLINES
+
+
+671 \ 1
+       #__¡pýy_¬gs
+(
+¤c
+) \
+
+672 
+       `__ex\8bnsiÚ__
+ ((
+__STRING2_COPY_ARR2
+) \
+
+673 { { ((
+__cڡ
\ 5*è(
+¤c
+))[0], '\0' } }), \
+
+674 
+       `__ex\8bnsiÚ__
+ ((
+__STRING2_COPY_ARR3
+) \
+
+675 { { ((
+__cڡ
\ 5*è(
+¤c
+))[0], ((__const \ 5*) (src))[1], \
+
+677 
+       `__ex\8bnsiÚ__
+ ((
+__STRING2_COPY_ARR4
+) \
+
+678 { { ((
+__cڡ
\ 5*è(
+¤c
+))[0], ((__const \ 5*) (src))[1], \
+
+679 ((
+__cڡ
\ 5*è(
+¤c
+))[2], '\0' } }), \
+
+680 
+       `__ex\8bnsiÚ__
+ ((
+__STRING2_COPY_ARR5
+) \
+
+681 { { ((
+__cڡ
\ 5*è(
+¤c
+))[0], ((__const \ 5*) (src))[1], \
+
+682 ((
+__cڡ
\ 5*è(
+¤c
+))[2], ((__const \ 5*) (src))[3], \
+
+684 
+       `__ex\8bnsiÚ__
+ ((
+__STRING2_COPY_ARR6
+) \
+
+685 { { ((
+__cڡ
\ 5*è(
+¤c
+))[0], ((__const \ 5*) (src))[1], \
+
+686 ((
+__cڡ
\ 5*è(
+¤c
+))[2], ((__const \ 5*) (src))[3], \
+
+687 ((
+__cڡ
\ 5*è(
+¤c
+))[4], '\0' } }), \
+
+688 
+       `__ex\8bnsiÚ__
+ ((
+__STRING2_COPY_ARR7
+) \
+
+689 { { ((
+__cڡ
\ 5*è(
+¤c
+))[0], ((__const \ 5*) (src))[1], \
+
+690 ((
+__cڡ
\ 5*è(
+¤c
+))[2], ((__const \ 5*) (src))[3], \
+
+691 ((
+__cڡ
\ 5*è(
+¤c
+))[4], ((__const \ 5*) (src))[5], \
+
+693 
+       `__ex\8bnsiÚ__
+ ((
+__STRING2_COPY_ARR8
+) \
+
+694 { { ((
+__cڡ
\ 5*è(
+¤c
+))[0], ((__const \ 5*) (src))[1], \
+
+695 ((
+__cڡ
\ 5*è(
+¤c
+))[2], ((__const \ 5*) (src))[3], \
+
+696 ((
+__cڡ
\ 5*è(
+¤c
+))[4], ((__const \ 5*) (src))[5], \
+
+697 ((
+__cڡ
\ 5*è(
+¤c
+))[6], '\0' } })
+
+       )
+
+699 
+__STRING_INLINE
\ 5*
+__¡pýy_sm®l
+ (\ 5*, 
+__STRING2_COPY_ARR2
+,
+
+700 
+__STRING2_COPY_ARR3
+,
+
+701 
+__STRING2_COPY_ARR4
+,
+
+702 
+__STRING2_COPY_ARR5
+,
+
+703 
+__STRING2_COPY_ARR6
+,
+
+704 
+__STRING2_COPY_ARR7
+,
+
+705 
+__STRING2_COPY_ARR8
+, 
+size_t
+);
+
+706 
+__STRING_INLINE
\ 5*
+
+707 
+       $__¡pýy_sm®l
+ (\ 5*
+__de¡
+,
+
+708 
+__STRING2_COPY_ARR2
+__¤c2
+, 
+__STRING2_COPY_ARR3
+__¤c3
+,
+
+709 
+__STRING2_COPY_ARR4
+__¤c4
+, 
+__STRING2_COPY_ARR5
+__¤c5
+,
+
+710 
+__STRING2_COPY_ARR6
+__¤c6
+, 
+__STRING2_COPY_ARR7
+__¤c7
+,
+
+711 
+__STRING2_COPY_ARR8
+__¤c8
+, 
+size_t
+__¤þ\92
+)
+
+714 \ 5
+__c
+;
+
+715 
+__STRING2_COPY_ARR2
+__sÿ2
+;
+
+716 
+__STRING2_COPY_ARR3
+__sÿ3
+;
+
+717 
+__STRING2_COPY_ARR4
+__sÿ4
+;
+
+718 
+__STRING2_COPY_ARR5
+__sÿ5
+;
+
+719 
+__STRING2_COPY_ARR6
+__sÿ6
+;
+
+720 
+__STRING2_COPY_ARR7
+__sÿ7
+;
+
+721 
+__STRING2_COPY_ARR8
+__sÿ8
+;
+
+722 } *
+__u
+ = (\1e
+__de¡
+;
+
+723 \1a(\1d\12è
+__¤þ\92
+)
+
+726 
+__u
+->
+__c
+ = '\0';
+
+729 
+__ex\8bnsiÚ__
+__u
+->
+__sÿ2
+ = 
+__¤c2
+;
+
+732 
+__ex\8bnsiÚ__
+__u
+->
+__sÿ3
+ = 
+__¤c3
+;
+
+735 
+__ex\8bnsiÚ__
+__u
+->
+__sÿ4
+ = 
+__¤c4
+;
+
+738 
+__ex\8bnsiÚ__
+__u
+->
+__sÿ5
+ = 
+__¤c5
+;
+
+741 
+__ex\8bnsiÚ__
+__u
+->
+__sÿ6
+ = 
+__¤c6
+;
+
+744 
+__ex\8bnsiÚ__
+__u
+->
+__sÿ7
+ = 
+__¤c7
+;
+
+747 
+__ex\8bnsiÚ__
+__u
+->
+__sÿ8
+ = 
+__¤c8
+;
+
+750 \15 
+__de¡
+ + 
+__¤þ\92
+ - 1;
+
+751 
+       }
+}
+
+759 #iâdeà
+_HAVE_STRING_ARCH_¡ºýy
+
+
+760 #ià
+__GNUC_PREREQ
+ (3, 2)
+
+761 \ 1
+       #¡ºýy
+(
+de¡
+, 
+¤c
+, 
+n
+       `__bu\9et\9a_¡ºýy
+ (de¡, src,\82)
+
+       )
+
+763 \ 1
+       #¡ºýy
+(
+de¡
+, 
+¤c
+, 
+n
+) \
+
+764 (
+       `__ex\8bnsiÚ__
+ (
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+¤c
+è&& __bu\9et\9a_cÚ¡ªt_°(
+n
+) \
+
+765 ? (
+       `¡¾\92
+ (
+¤c
+è+ 1 >ð((
+size_t
+è(
+n
+)) \
+
+766 ? (\ 5
+       `memýy
+ (
+de¡
+, 
+¤c
+, 
+n
+) \
+
+767 : 
+       `¡ºýy
+ (
+de¡
+, 
+¤c
+, 
+n
+)) \
+
+768 : 
+       `¡ºýy
+ (
+de¡
+, 
+¤c
+, 
+n
+)))
+
+       )
+
+774 #iâdeà
+_HAVE_STRING_ARCH_¡ºÿt
+
+
+775 #ifdeà
+_USE_STRING_ARCH_¡rchr
+
+
+776 \ 1
+       #¡ºÿt
+(
+de¡
+, 
+¤c
+, 
+n
+) \
+
+777 (
+       `__ex\8bnsiÚ__
+ ({ \ 5*
+__de¡
+ = (
+de¡
+); \
+
+778 
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+¤c
+è&& __bu\9et\9a_cÚ¡ªt_°(
+n
+) \
+
+779 ? (
+       `¡¾\92
+ (
+¤c
+è< ((
+size_t
+è(
+n
+)) \
+
+780 ? 
+       `¡rÿt
+ (
+__de¡
+, 
+¤c
+) \
+
+781 : (*((\ 5
+       `__mempýy
+ (
+       `¡rchr
+ (
+__de¡
+, '\0'), \
+
+782 
+¤c
+, 
+n
+)èð'\0', 
+__de¡
+)) \
+
+783 : 
+       `¡ºÿt
+ (
+de¡
+, 
+¤c
+, 
+n
+); }))
+
+       )
+
+784 #\96
+__GNUC_PREREQ
+ (3, 2)
+
+785 \ 1
+       #¡ºÿt
+(
+de¡
+, 
+¤c
+, 
+n
+       `__bu\9et\9a_¡ºÿt
+ (de¡, src,\82)
+
+       )
+
+787 \ 1
+       #¡ºÿt
+(
+de¡
+, 
+¤c
+, 
+n
+) \
+
+788 (
+       `__ex\8bnsiÚ__
+ (
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+¤c
+è&& __bu\9et\9a_cÚ¡ªt_°(
+n
+) \
+
+789 ? (
+       `¡¾\92
+ (
+¤c
+è< ((
+size_t
+è(
+n
+)) \
+
+790 ? 
+       `¡rÿt
+ (
+de¡
+, 
+¤c
+) \
+
+791 : 
+       `¡ºÿt
+ (
+de¡
+, 
+¤c
+, 
+n
+)) \
+
+792 : 
+       `¡ºÿt
+ (
+de¡
+, 
+¤c
+, 
+n
+)))
+
+       )
+
+798 #iâdeà
+_HAVE_STRING_ARCH_¡rcmp
+
+
+799 #ià
+__GNUC_PREREQ
+ (3, 2)
+
+800 \ 1
+       #¡rcmp
+(
+s1
+, 
+s2
+) \
+
+801 
+__ex\8bnsiÚ__
+ \
+
+802 ({ 
+size_t
+__s1_Ën
+, 
+__s2_Ën
+; \
+
+803 (
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+s1
+è&& __bu\9et\9a_cÚ¡ªt_°(
+s2
+) \
+
+804 && (
+__s1_Ën
+ = 
+       `__bu\9et\9a_¡¾\92
+ (
+s1
+), 
+__s2_Ën
+ = __bu\9et\9a_¡¾\92 (
+s2
+), \
+
+805 (!
+       `__¡r\9ag2_1b±r_p
+ (
+s1
+è|| 
+__s1_Ën
+ >= 4) \
+
+806 && (!
+       `__¡r\9ag2_1b±r_p
+ (
+s2
+è|| 
+__s2_Ën
+ >= 4)) \
+
+807 ? 
+       `__bu\9et\9a_¡rcmp
+ (
+s1
+, 
+s2
+) \
+
+808 : (
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+s1
+è&& 
+       `__¡r\9ag2_1b±r_p
+ (s1) \
+
+809 && (
+__s1_Ën
+ = 
+       `__bu\9et\9a_¡¾\92
+ (
+s1
+), __s1_len < 4) \
+
+810 ? (
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+s2
+è&& 
+       `__¡r\9ag2_1b±r_p
+ (s2) \
+
+811 ? 
+       `__bu\9et\9a_¡rcmp
+ (
+s1
+, 
+s2
+) \
+
+812 : 
+       `__¡rcmp_cg
+ (
+s1
+, 
+s2
+, 
+__s1_Ën
+)) \
+
+813 : (
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+s2
+è&& 
+       `__¡r\9ag2_1b±r_p
+ (s2) \
+
+814 && (
+__s2_Ën
+ = 
+       `__bu\9et\9a_¡¾\92
+ (
+s2
+), __s2_len < 4) \
+
+815 ? (
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+s1
+è&& 
+       `__¡r\9ag2_1b±r_p
+ (s1) \
+
+816 ? 
+       `__bu\9et\9a_¡rcmp
+ (
+s1
+, 
+s2
+) \
+
+817 : 
+       `__¡rcmp_gc
+ (
+s1
+, 
+s2
+, 
+__s2_Ën
+)) \
+
+818 : 
+       `__bu\9et\9a_¡rcmp
+ (
+s1
+, 
+s2
+)))); })
+
+       )
+
+820 \ 1
+       #¡rcmp
+(
+s1
+, 
+s2
+) \
+
+821 
+__ex\8bnsiÚ__
+ \
+
+822 ({ 
+size_t
+__s1_Ën
+, 
+__s2_Ën
+; \
+
+823 (
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+s1
+è&& __bu\9et\9a_cÚ¡ªt_°(
+s2
+) \
+
+824 && (
+__s1_Ën
+ = 
+       `¡¾\92
+ (
+s1
+), 
+__s2_Ën
+ = s\8cËÀ(
+s2
+), \
+
+825 (!
+       `__¡r\9ag2_1b±r_p
+ (
+s1
+è|| 
+__s1_Ën
+ >= 4) \
+
+826 && (!
+       `__¡r\9ag2_1b±r_p
+ (
+s2
+è|| 
+__s2_Ën
+ >= 4)) \
+
+827 ? 
+       `memcmp
+ ((
+__cڡ
\ 5*è(
+s1
+), (__cÚ¡ \ 5*è(
+s2
+), \
+
+828 (
+__s1_Ën
+ < 
+__s2_Ën
+ ? __s1_len : __s2_len) + 1) \
+
+829 : (
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+s1
+è&& 
+       `__¡r\9ag2_1b±r_p
+ (s1) \
+
+830 && (
+__s1_Ën
+ = 
+       `¡¾\92
+ (
+s1
+), __s1_len < 4) \
+
+831 ? (
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+s2
+è&& 
+       `__¡r\9ag2_1b±r_p
+ (s2) \
+
+832 ? 
+       `__¡rcmp_cc
+ (
+s1
+, 
+s2
+, 
+__s1_Ën
+) \
+
+833 : 
+       `__¡rcmp_cg
+ (
+s1
+, 
+s2
+, 
+__s1_Ën
+)) \
+
+834 : (
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+s2
+è&& 
+       `__¡r\9ag2_1b±r_p
+ (s2) \
+
+835 && (
+__s2_Ën
+ = 
+       `¡¾\92
+ (
+s2
+), __s2_len < 4) \
+
+836 ? (
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+s1
+è&& 
+       `__¡r\9ag2_1b±r_p
+ (s1) \
+
+837 ? 
+       `__¡rcmp_cc
+ (
+s1
+, 
+s2
+, 
+__s2_Ën
+) \
+
+838 : 
+       `__¡rcmp_gc
+ (
+s1
+, 
+s2
+, 
+__s2_Ën
+)) \
+
+839 : 
+       `¡rcmp
+ (
+s1
+, 
+s2
+)))); })
+
+       )
+
+842 \ 1
+       #__¡rcmp_cc
+(
+s1
+, 
+s2
+, 
+l
+) \
+
+843 (
+       `__ex\8bnsiÚ__
+ ({ \14\12
+__»suÉ
+ = \
+
+844 (((
+__cڡ
\1d\ 5*è(__cÚ¡ \ 5*è(
+s1
+))[0] \
+
+845 - ((
+__cڡ
\1d\ 5*è(__cÚ¡ \ 5*)(
+s2
+))[0]);\
+
+846 ià(
+l
+ > 0 && 
+__»suÉ
+ == 0) \
+
+848 
+__»suÉ
+ = (((
+__cڡ
\1d\ 5*) \
+
+849 (
+__cڡ
\ 5*è(
+s1
+))[1] \
+
+850 - ((
+__cڡ
\1d\ 5*) \
+
+851 (
+__cڡ
\ 5*è(
+s2
+))[1]); \
+
+852 ià(
+l
+ > 1 && 
+__»suÉ
+ == 0) \
+
+854 
+__»suÉ
+ = \
+
+855 (((
+__cڡ
\1d\ 5*) \
+
+856 (
+__cڡ
\ 5*è(
+s1
+))[2] \
+
+857 - ((
+__cڡ
\1d\ 5*) \
+
+858 (
+__cڡ
\ 5*è(
+s2
+))[2]); \
+
+859 ià(
+l
+ > 2 && 
+__»suÉ
+ == 0) \
+
+860 
+__»suÉ
+ = \
+
+861 (((
+__cڡ
\1d\ 5*) \
+
+862 (
+__cڡ
\ 5*è(
+s1
+))[3] \
+
+863 - ((
+__cڡ
\1d\ 5*) \
+
+864 (
+__cڡ
\ 5*è(
+s2
+))[3]); \
+
+867 
+__»suÉ
+; }))
+
+       )
+
+869 \ 1
+       #__¡rcmp_cg
+(
+s1
+, 
+s2
+, 
+l1
+) \
+
+870 (
+       `__ex\8bnsiÚ__
+ ({ 
+__cڡ
\1d\ 5*
+__s2
+ = \
+
+871 (
+__cڡ
\1d\ 5*è(__cÚ¡ \ 5*è(
+s2
+); \
+
+872 \14\12
+__»suÉ
+ = \
+
+873 (((
+__cڡ
\1d\ 5*è(__cÚ¡ \ 5*è(
+s1
+))[0] \
+
+874 - 
+__s2
+[0]); \
+
+875 ià(
+l1
+ > 0 && 
+__»suÉ
+ == 0) \
+
+877 
+__»suÉ
+ = (((
+__cڡ
\1d\ 5*) \
+
+878 (
+__cڡ
\ 5*è(
+s1
+))[1] - 
+__s2
+[1]); \
+
+879 ià(
+l1
+ > 1 && 
+__»suÉ
+ == 0) \
+
+881 
+__»suÉ
+ = (((
+__cڡ
\1d\ 5*) \
+
+882 (
+__cڡ
\ 5*è(
+s1
+))[2] - 
+__s2
+[2]);\
+
+883 ià(
+l1
+ > 2 && 
+__»suÉ
+ == 0) \
+
+884 
+__»suÉ
+ = (((
+__cڡ
\1d\ 5*) \
+
+885 (
+__cڡ
\ 5*è(
+s1
+))[3] \
+
+886 - 
+__s2
+[3]); \
+
+889 
+__»suÉ
+; }))
+
+       )
+
+891 \ 1
+       #__¡rcmp_gc
+(
+s1
+, 
+s2
+, 
+l2
+) \
+
+892 (
+       `__ex\8bnsiÚ__
+ ({ 
+__cڡ
\1d\ 5*
+__s1
+ = \
+
+893 (
+__cڡ
\1d\ 5*è(__cÚ¡ \ 5*è(
+s1
+); \
+
+894 \14\12
+__»suÉ
+ = \
+
+895 
+__s1
+[0] - ((
+__cڡ
\1d\ 5*) \
+
+896 (
+__cڡ
\ 5*è(
+s2
+))[0]; \
+
+897 ià(
+l2
+ > 0 && 
+__»suÉ
+ == 0) \
+
+899 
+__»suÉ
+ = (
+__s1
+[1] \
+
+900 - ((
+__cڡ
\1d\ 5*) \
+
+901 (
+__cڡ
\ 5*è(
+s2
+))[1]); \
+
+902 ià(
+l2
+ > 1 && 
+__»suÉ
+ == 0) \
+
+904 
+__»suÉ
+ = \
+
+905 (
+__s1
+[2] - ((
+__cڡ
\1d\ 5*) \
+
+906 (
+__cڡ
\ 5*è(
+s2
+))[2]); \
+
+907 ià(
+l2
+ > 2 && 
+__»suÉ
+ == 0) \
+
+908 
+__»suÉ
+ = \
+
+909 (
+__s1
+[3] \
+
+910 - ((
+__cڡ
\1d\ 5*) \
+
+911 (
+__cڡ
\ 5*è(
+s2
+))[3]); \
+
+914 
+__»suÉ
+; }))
+
+       )
+
+919 #iâdeà
+_HAVE_STRING_ARCH_¡ºcmp
+
+
+920 \ 1
+       #¡ºcmp
+(
+s1
+, 
+s2
+, 
+n
+) \
+
+921 (
+       `__ex\8bnsiÚ__
+ (
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+n
+) \
+
+922 && ((
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+s1
+) \
+
+923 && 
+       `¡¾\92
+ (
+s1
+è< ((
+size_t
+è(
+n
+))) \
+
+924 || (
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+s2
+) \
+
+925 && 
+       `¡¾\92
+ (
+s2
+è< ((
+size_t
+è(
+n
+)))) \
+
+926 ? 
+       `¡rcmp
+ (
+s1
+, 
+s2
+è: 
+       `¡ºcmp
+ (s1, s2, 
+n
+)))
+
+       )
+
+932 #ià!
+def\9aed
+_HAVE_STRING_ARCH_¡rc¥n
+ || def\9aed 
+_FORCE_INLINES
+
+
+933 #iâdeà
+_HAVE_STRING_ARCH_¡rc¥n
+
+
+934 #ià
+__GNUC_PREREQ
+ (3, 2)
+
+935 \ 1
+       #¡rc¥n
+(
+s
+, 
+»jeù
+) \
+
+936 
+__ex\8bnsiÚ__
+ \
+
+937 ({ \ 5
+__r0
+, 
+__r1
+, 
+__r2
+; \
+
+938 (
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+»jeù
+è&& 
+       `__¡r\9ag2_1b±r_p
+ (reject) \
+
+939 ? ((
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+s
+è&& 
+       `__¡r\9ag2_1b±r_p
+ (s)) \
+
+940 ? 
+       `__bu\9et\9a_¡rc¥n
+ (
+s
+, 
+»jeù
+) \
+
+941 : ((
+__r0
+ = ((
+__cڡ
\ 5*è(
+»jeù
+))[0], __r0 == '\0') \
+
+942 ? 
+       `¡¾\92
+ (
+s
+) \
+
+943 : ((
+__r1
+ = ((
+__cڡ
\ 5*è(
+»jeù
+))[1], __r1 == '\0') \
+
+944 ? 
+       `__¡rc¥n_c1
+ (
+s
+, 
+__r0
+) \
+
+945 : ((
+__r2
+ = ((
+__cڡ
\ 5*è(
+»jeù
+))[2], __r2 == '\0') \
+
+946 ? 
+       `__¡rc¥n_c2
+ (
+s
+, 
+__r0
+, 
+__r1
+) \
+
+947 : (((
+__cڡ
\ 5*è(
+»jeù
+))[3] == '\0' \
+
+948 ? 
+       `__¡rc¥n_c3
+ (
+s
+, 
+__r0
+, 
+__r1
+, 
+__r2
+) \
+
+949 : 
+       `__bu\9et\9a_¡rc¥n
+ (
+s
+, 
+»jeù
+)))))) \
+
+950 : 
+       `__bu\9et\9a_¡rc¥n
+ (
+s
+, 
+»jeù
+)); })
+
+       )
+
+952 \ 1
+       #¡rc¥n
+(
+s
+, 
+»jeù
+) \
+
+953 
+__ex\8bnsiÚ__
+ \
+
+954 ({ \ 5
+__r0
+, 
+__r1
+, 
+__r2
+; \
+
+955 (
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+»jeù
+è&& 
+       `__¡r\9ag2_1b±r_p
+ (reject) \
+
+956 ? ((
+__r0
+ = ((
+__cڡ
\ 5*è(
+»jeù
+))[0], __r0 == '\0') \
+
+957 ? 
+       `¡¾\92
+ (
+s
+) \
+
+958 : ((
+__r1
+ = ((
+__cڡ
\ 5*è(
+»jeù
+))[1], __r1 == '\0') \
+
+959 ? 
+       `__¡rc¥n_c1
+ (
+s
+, 
+__r0
+) \
+
+960 : ((
+__r2
+ = ((
+__cڡ
\ 5*è(
+»jeù
+))[2], __r2 == '\0') \
+
+961 ? 
+       `__¡rc¥n_c2
+ (
+s
+, 
+__r0
+, 
+__r1
+) \
+
+962 : (((
+__cڡ
\ 5*è(
+»jeù
+))[3] == '\0' \
+
+963 ? 
+       `__¡rc¥n_c3
+ (
+s
+, 
+__r0
+, 
+__r1
+, 
+__r2
+) \
+
+964 : 
+       `¡rc¥n
+ (
+s
+, 
+»jeù
+))))) \
+
+965 : 
+       `¡rc¥n
+ (
+s
+, 
+»jeù
+)); })
+
+       )
+
+969 
+__STRING_INLINE
+size_t
+__¡rc¥n_c1
+ (
+__cڡ
\ 5*
+__s
+, \12
+__»jeù
+);
+
+970 
+__STRING_INLINE
+size_t
+
+
+971 
+       $__¡rc¥n_c1
+ (
+__cڡ
\ 5*
+__s
+, \12
+__»jeù
+)
+
+973 \14
+size_t
+__»suÉ
+ = 0;
+
+974 \1f
+__s
+[
+__»suÉ
+] !ð'\0' && __s[__»suÉ] !ð
+__»jeù
+)
+
+975 ++
+__»suÉ
+;
+
+976 \15 
+__»suÉ
+;
+
+977 
+       }
+}
+
+979 
+__STRING_INLINE
+size_t
+__¡rc¥n_c2
+ (
+__cڡ
\ 5*
+__s
+, \12
+__»jeù1
+,
+
+980 \12
+__»jeù2
+);
+
+981 
+__STRING_INLINE
+size_t
+
+
+982 
+       $__¡rc¥n_c2
+ (
+__cڡ
\ 5*
+__s
+, \12
+__»jeù1
+, \12
+__»jeù2
+)
+
+984 \14
+size_t
+__»suÉ
+ = 0;
+
+985 \1f
+__s
+[
+__»suÉ
+] !ð'\0' && __s[__»suÉ] !ð
+__»jeù1
+
+
+986 && 
+__s
+[
+__»suÉ
+] !ð
+__»jeù2
+)
+
+987 ++
+__»suÉ
+;
+
+988 \15 
+__»suÉ
+;
+
+989 
+       }
+}
+
+991 
+__STRING_INLINE
+size_t
+__¡rc¥n_c3
+ (
+__cڡ
\ 5*
+__s
+, \12
+__»jeù1
+,
+
+992 \12
+__»jeù2
+, \12
+__»jeù3
+);
+
+993 
+__STRING_INLINE
+size_t
+
+
+994 
+       $__¡rc¥n_c3
+ (
+__cڡ
\ 5*
+__s
+, \12
+__»jeù1
+, \12
+__»jeù2
+,
+
+995 \12
+__»jeù3
+)
+
+997 \14
+size_t
+__»suÉ
+ = 0;
+
+998 \1f
+__s
+[
+__»suÉ
+] !ð'\0' && __s[__»suÉ] !ð
+__»jeù1
+
+
+999 && 
+__s
+[
+__»suÉ
+] !ð
+__»jeù2
+ && __s[__»suÉ] !ð
+__»jeù3
+)
+
+1000 ++
+__»suÉ
+;
+
+1001 \15 
+__»suÉ
+;
+
+1002 
+       }
+}
+
+1008 #ià!
+def\9aed
+_HAVE_STRING_ARCH_¡r¥n
+ || def\9aed 
+_FORCE_INLINES
+
+
+1009 #iâdeà
+_HAVE_STRING_ARCH_¡r¥n
+
+
+1010 #ià
+__GNUC_PREREQ
+ (3, 2)
+
+1011 \ 1
+       #¡r¥n
+(
+s
+, 
+acû±
+) \
+
+1012 
+__ex\8bnsiÚ__
+ \
+
+1013 ({ \ 5
+__a0
+, 
+__a1
+, 
+__a2
+; \
+
+1014 (
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+acû±
+è&& 
+       `__¡r\9ag2_1b±r_p
+ (accept) \
+
+1015 ? ((
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+s
+è&& 
+       `__¡r\9ag2_1b±r_p
+ (s)) \
+
+1016 ? 
+       `__bu\9et\9a_¡r¥n
+ (
+s
+, 
+acû±
+) \
+
+1017 : ((
+__a0
+ = ((
+__cڡ
\ 5*è(
+acû±
+))[0], __a0 == '\0') \
+
+1018 ? ((\1eè(
+s
+), 0) \
+
+1019 : ((
+__a1
+ = ((
+__cڡ
\ 5*è(
+acû±
+))[1], __a1 == '\0') \
+
+1020 ? 
+       `__¡r¥n_c1
+ (
+s
+, 
+__a0
+) \
+
+1021 : ((
+__a2
+ = ((
+__cڡ
\ 5*è(
+acû±
+))[2], __a2 == '\0') \
+
+1022 ? 
+       `__¡r¥n_c2
+ (
+s
+, 
+__a0
+, 
+__a1
+) \
+
+1023 : (((
+__cڡ
\ 5*è(
+acû±
+))[3] == '\0' \
+
+1024 ? 
+       `__¡r¥n_c3
+ (
+s
+, 
+__a0
+, 
+__a1
+, 
+__a2
+) \
+
+1025 : 
+       `__bu\9et\9a_¡r¥n
+ (
+s
+, 
+acû±
+)))))) \
+
+1026 : 
+       `__bu\9et\9a_¡r¥n
+ (
+s
+, 
+acû±
+)); })
+
+       )
+
+1028 \ 1
+       #¡r¥n
+(
+s
+, 
+acû±
+) \
+
+1029 
+__ex\8bnsiÚ__
+ \
+
+1030 ({ \ 5
+__a0
+, 
+__a1
+, 
+__a2
+; \
+
+1031 (
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+acû±
+è&& 
+       `__¡r\9ag2_1b±r_p
+ (accept) \
+
+1032 ? ((
+__a0
+ = ((
+__cڡ
\ 5*è(
+acû±
+))[0], __a0 == '\0') \
+
+1033 ? ((\1eè(
+s
+), 0) \
+
+1034 : ((
+__a1
+ = ((
+__cڡ
\ 5*è(
+acû±
+))[1], __a1 == '\0') \
+
+1035 ? 
+       `__¡r¥n_c1
+ (
+s
+, 
+__a0
+) \
+
+1036 : ((
+__a2
+ = ((
+__cڡ
\ 5*è(
+acû±
+))[2], __a2 == '\0') \
+
+1037 ? 
+       `__¡r¥n_c2
+ (
+s
+, 
+__a0
+, 
+__a1
+) \
+
+1038 : (((
+__cڡ
\ 5*è(
+acû±
+))[3] == '\0' \
+
+1039 ? 
+       `__¡r¥n_c3
+ (
+s
+, 
+__a0
+, 
+__a1
+, 
+__a2
+) \
+
+1040 : 
+       `¡r¥n
+ (
+s
+, 
+acû±
+))))) \
+
+1041 : 
+       `¡r¥n
+ (
+s
+, 
+acû±
+)); })
+
+       )
+
+1045 
+__STRING_INLINE
+size_t
+__¡r¥n_c1
+ (
+__cڡ
\ 5*
+__s
+, \12
+__acû±
+);
+
+1046 
+__STRING_INLINE
+size_t
+
+
+1047 
+       $__¡r¥n_c1
+ (
+__cڡ
\ 5*
+__s
+, \12
+__acû±
+)
+
+1049 \14
+size_t
+__»suÉ
+ = 0;
+
+1051 \1f
+__s
+[
+__»suÉ
+] =ð
+__acû±
+)
+
+1052 ++
+__»suÉ
+;
+
+1053 \15 
+__»suÉ
+;
+
+1054 
+       }
+}
+
+1056 
+__STRING_INLINE
+size_t
+__¡r¥n_c2
+ (
+__cڡ
\ 5*
+__s
+, \12
+__acû±1
+,
+
+1057 \12
+__acû±2
+);
+
+1058 
+__STRING_INLINE
+size_t
+
+
+1059 
+       $__¡r¥n_c2
+ (
+__cڡ
\ 5*
+__s
+, \12
+__acû±1
+, \12
+__acû±2
+)
+
+1061 \14
+size_t
+__»suÉ
+ = 0;
+
+1063 \1f
+__s
+[
+__»suÉ
+] =ð
+__acû±1
+ || __s[__»suÉ] =ð
+__acû±2
+)
+
+1064 ++
+__»suÉ
+;
+
+1065 \15 
+__»suÉ
+;
+
+1066 
+       }
+}
+
+1068 
+__STRING_INLINE
+size_t
+__¡r¥n_c3
+ (
+__cڡ
\ 5*
+__s
+, \12
+__acû±1
+,
+
+1069 \12
+__acû±2
+, \12
+__acû±3
+);
+
+1070 
+__STRING_INLINE
+size_t
+
+
+1071 
+       $__¡r¥n_c3
+ (
+__cڡ
\ 5*
+__s
+, \12
+__acû±1
+, \12
+__acû±2
+, \12
+__acû±3
+)
+
+1073 \14
+size_t
+__»suÉ
+ = 0;
+
+1075 \1f
+__s
+[
+__»suÉ
+] =ð
+__acû±1
+ || __s[__»suÉ] =ð
+__acû±2
+
+
+1076 || 
+__s
+[
+__»suÉ
+] =ð
+__acû±3
+)
+
+1077 ++
+__»suÉ
+;
+
+1078 \15 
+__»suÉ
+;
+
+1079 
+       }
+}
+
+1084 #ià!
+def\9aed
+_HAVE_STRING_ARCH_¡½brk
+ || def\9aed 
+_FORCE_INLINES
+
+
+1085 #iâdeà
+_HAVE_STRING_ARCH_¡½brk
+
+
+1086 #ià
+__GNUC_PREREQ
+ (3, 2)
+
+1087 \ 1
+       #¡½brk
+(
+s
+, 
+acû±
+) \
+
+1088 
+__ex\8bnsiÚ__
+ \
+
+1089 ({ \ 5
+__a0
+, 
+__a1
+, 
+__a2
+; \
+
+1090 (
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+acû±
+è&& 
+       `__¡r\9ag2_1b±r_p
+ (accept) \
+
+1091 ? ((
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+s
+è&& 
+       `__¡r\9ag2_1b±r_p
+ (s)) \
+
+1092 ? 
+       `__bu\9et\9a_¡½brk
+ (
+s
+, 
+acû±
+) \
+
+1093 : ((
+__a0
+ = ((
+__cڡ
\ 5*è(
+acû±
+))[0], __a0 == '\0') \
+
+1094 ? ((\1eè(
+s
+), (\ 5
+NULL
+) \
+
+1095 : ((
+__a1
+ = ((
+__cڡ
\ 5*è(
+acû±
+))[1], __a1 == '\0') \
+
+1096 ? 
+       `__bu\9et\9a_¡rchr
+ (
+s
+, 
+__a0
+) \
+
+1097 : ((
+__a2
+ = ((
+__cڡ
\ 5*è(
+acû±
+))[2], __a2 == '\0') \
+
+1098 ? 
+       `__¡½brk_c2
+ (
+s
+, 
+__a0
+, 
+__a1
+) \
+
+1099 : (((
+__cڡ
\ 5*è(
+acû±
+))[3] == '\0' \
+
+1100 ? 
+       `__¡½brk_c3
+ (
+s
+, 
+__a0
+, 
+__a1
+, 
+__a2
+) \
+
+1101 : 
+       `__bu\9et\9a_¡½brk
+ (
+s
+, 
+acû±
+)))))) \
+
+1102 : 
+       `__bu\9et\9a_¡½brk
+ (
+s
+, 
+acû±
+)); })
+
+       )
+
+1104 \ 1
+       #¡½brk
+(
+s
+, 
+acû±
+) \
+
+1105 
+__ex\8bnsiÚ__
+ \
+
+1106 ({ \ 5
+__a0
+, 
+__a1
+, 
+__a2
+; \
+
+1107 (
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+acû±
+è&& 
+       `__¡r\9ag2_1b±r_p
+ (accept) \
+
+1108 ? ((
+__a0
+ = ((
+__cڡ
\ 5*è(
+acû±
+))[0], __a0 == '\0') \
+
+1109 ? ((\1eè(
+s
+), (\ 5
+NULL
+) \
+
+1110 : ((
+__a1
+ = ((
+__cڡ
\ 5*è(
+acû±
+))[1], __a1 == '\0') \
+
+1111 ? 
+       `¡rchr
+ (
+s
+, 
+__a0
+) \
+
+1112 : ((
+__a2
+ = ((
+__cڡ
\ 5*è(
+acû±
+))[2], __a2 == '\0') \
+
+1113 ? 
+       `__¡½brk_c2
+ (
+s
+, 
+__a0
+, 
+__a1
+) \
+
+1114 : (((
+__cڡ
\ 5*è(
+acû±
+))[3] == '\0' \
+
+1115 ? 
+       `__¡½brk_c3
+ (
+s
+, 
+__a0
+, 
+__a1
+, 
+__a2
+) \
+
+1116 : 
+       `¡½brk
+ (
+s
+, 
+acû±
+))))) \
+
+1117 : 
+       `¡½brk
+ (
+s
+, 
+acû±
+)); })
+
+       )
+
+1121 
+__STRING_INLINE
\ 5*
+__¡½brk_c2
+ (
+__cڡ
\ 5*
+__s
+, \12
+__acû±1
+,
+
+1122 \12
+__acû±2
+);
+
+1123 
+__STRING_INLINE
\ 5*
+
+1124 
+       $__¡½brk_c2
+ (
+__cڡ
\ 5*
+__s
+, \12
+__acû±1
+, \12
+__acû±2
+)
+
+1127 \1f*
+__s
+ !ð'\0' && *__ !ð
+__acû±1
+ && *__ !ð
+__acû±2
+)
+
+1128 ++
+__s
+;
+
+1129 \15 *
+__s
+ =ð'\0' ? 
+NULL
+ : (\ 5*è(
+size_t
+) __s;
+
+1130 
+       }
+}
+
+1132 
+__STRING_INLINE
\ 5*
+__¡½brk_c3
+ (
+__cڡ
\ 5*
+__s
+, \12
+__acû±1
+,
+
+1133 \12
+__acû±2
+, \12
+__acû±3
+);
+
+1134 
+__STRING_INLINE
\ 5*
+
+1135 
+       $__¡½brk_c3
+ (
+__cڡ
\ 5*
+__s
+, \12
+__acû±1
+, \12
+__acû±2
+,
+
+1136 \12
+__acû±3
+)
+
+1139 \1f*
+__s
+ !ð'\0' && *__ !ð
+__acû±1
+ && *__ !ð
+__acû±2
+
+
+1140 && *
+__s
+ !ð
+__acû±3
+)
+
+1141 ++
+__s
+;
+
+1142 \15 *
+__s
+ =ð'\0' ? 
+NULL
+ : (\ 5*è(
+size_t
+) __s;
+
+1143 
+       }
+}
+
+1149 #ià!
+def\9aed
+_HAVE_STRING_ARCH_¡r¡r
+ && !
+__GNUC_PREREQ
+ (2, 97)
+
+1150 \ 1
+       #¡r¡r
+(
+hay¡ack
+, 
+ÃedË
+) \
+
+1151 (
+       `__ex\8bnsiÚ__
+ (
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+ÃedË
+è&& 
+       `__¡r\9ag2_1b±r_p
+ (needle) \
+
+1152 ? (((
+__cڡ
\ 5*è(
+ÃedË
+))[0] == '\0' \
+
+1153 ? (\ 5*è(
+size_t
+è(
+hay¡ack
+) \
+
+1154 : (((
+__cڡ
\ 5*è(
+ÃedË
+))[1] == '\0' \
+
+1155 ? 
+       `¡rchr
+ (
+hay¡ack
+, \
+
+1156 ((
+__cڡ
\ 5*è(
+ÃedË
+))[0]) \
+
+1157 : 
+       `¡r¡r
+ (
+hay¡ack
+, 
+ÃedË
+))) \
+
+1158 : 
+       `¡r¡r
+ (
+hay¡ack
+, 
+ÃedË
+)))
+
+       )
+
+1162 #ià!
+def\9aed
+_HAVE_STRING_ARCH_¡¹ok_r
+ || def\9aed 
+_FORCE_INLINES
+
+
+1163 #iâdeà
+_HAVE_STRING_ARCH_¡¹ok_r
+
+
+1164 \ 1
+       #__¡¹ok_r
+(
+s
+, 
+£p
+, 
+Ãx\8d
+) \
+
+1165 (
+       `__ex\8bnsiÚ__
+ (
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+£p
+è&& 
+       `__¡r\9ag2_1b±r_p
+ (sep) \
+
+1166 && ((
+__cڡ
\ 5*è(
+£p
+))[0] != '\0' \
+
+1167 && ((
+__cڡ
\ 5*è(
+£p
+))[1] == '\0' \
+
+1168 ? 
+       `__¡¹ok_r_1c
+ (
+s
+, ((
+__cڡ
\ 5*è(
+£p
+))[0], 
+Ãx\8d
+) \
+
+1169 : 
+       `__¡¹ok_r
+ (
+s
+, 
+£p
+, 
+Ãx\8d
+)))
+
+       )
+
+1172 
+__STRING_INLINE
\ 5*
+__¡¹ok_r_1c
+ (\ 5*
+__s
+, \ 5
+__£p
+, \ 5**
+__Ãx\8d
+);
+
+1173 
+__STRING_INLINE
\ 5*
+
+1174 
+       $__¡¹ok_r_1c
+ (\ 5*
+__s
+, \ 5
+__£p
+, \ 5**
+__Ãx\8d
+)
+
+1176 \ 5*
+__»suÉ
+;
+
+1177 ià(
+__s
+ =ð
+NULL
+)
+
+1178 
+__s
+ = *
+__Ãx\8d
+;
+
+1179 \1f*
+__s
+ =ð
+__£p
+)
+
+1180 ++
+__s
+;
+
+1181 
+__»suÉ
+ = 
+NULL
+;
+
+1182 ià(*
+__s
+ != '\0')
+
+1184 
+__»suÉ
+ = 
+__s
+++;
+
+1185 \1f*
+__s
+ != '\0')
+
+1186 ià(*
+__s
+++ =ð
+__£p
+)
+
+1188 
+__s
+[-1] = '\0';
+
+1192 *
+__Ãx\8d
+ = 
+__s
+;
+
+1193 \15 
+__»suÉ
+;
+
+1194 
+       }
+}
+
+1195 #ià
+def\9aed
+__USE_POSIX
+ || def\9aed 
+__USE_MISC
+
+
+1196 \ 1
+       #¡¹ok_r
+(
+s
+, 
+£p
+, 
+Ãx\8d
+       `__¡¹ok_r
+ (s, s\95,\82ex\8d)
+
+       )
+
+1201 #ià!
+def\9aed
+_HAVE_STRING_ARCH_¡r£p
+ || def\9aed 
+_FORCE_INLINES
+
+
+1202 #iâdeà
+_HAVE_STRING_ARCH_¡r£p
+
+
+1204 \r\ 5*
+__¡r£p_g
+ (\ 5**
+__¡r\9agp
+, 
+__cڡ
\ 5*
+__d\96im
+);
+
+1205 \ 1
+       #__¡r£p
+(
+s
+, 
+»jeù
+) \
+
+1206 
+__ex\8bnsiÚ__
+ \
+
+1207 ({ \ 5
+__r0
+, 
+__r1
+, 
+__r2
+; \
+
+1208 (
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+»jeù
+è&& 
+       `__¡r\9ag2_1b±r_p
+ (reject) \
+
+1209 && (
+__r0
+ = ((
+__cڡ
\ 5*è(
+»jeù
+))[0], \
+
+1210 ((
+__cڡ
\ 5*è(
+»jeù
+))[0] != '\0') \
+
+1211 ? ((
+__r1
+ = ((
+__cڡ
\ 5*è(
+»jeù
+))[1], \
+
+1212 ((
+__cڡ
\ 5*è(
+»jeù
+))[1] == '\0') \
+
+1213 ? 
+       `__¡r£p_1c
+ (
+s
+, 
+__r0
+) \
+
+1214 : ((
+__r2
+ = ((
+__cڡ
\ 5*è(
+»jeù
+))[2], __r2 == '\0') \
+
+1215 ? 
+       `__¡r£p_2c
+ (
+s
+, 
+__r0
+, 
+__r1
+) \
+
+1216 : (((
+__cڡ
\ 5*è(
+»jeù
+))[3] == '\0' \
+
+1217 ? 
+       `__¡r£p_3c
+ (
+s
+, 
+__r0
+, 
+__r1
+, 
+__r2
+) \
+
+1218 : 
+       `__¡r£p_g
+ (
+s
+, 
+»jeù
+)))) \
+
+1219 : 
+       `__¡r£p_g
+ (
+s
+, 
+»jeù
+)); })
+
+       )
+
+1222 
+__STRING_INLINE
\ 5*
+__¡r£p_1c
+ (\ 5**
+__s
+, \ 5
+__»jeù
+);
+
+1223 
+__STRING_INLINE
\ 5*
+
+1224 
+       $__¡r£p_1c
+ (\ 5**
+__s
+, \ 5
+__»jeù
+)
+
+1226 \14\ 5*
+__»tv®
+ = *
+__s
+;
+
+1227 ià(
+__»tv®
+ !ð
+NULL
+ && (*
+__s
+ = 
+       `¡rchr
+ (__»tv®, 
+__»jeù
+)) != NULL)
+
+1228 *(*
+__s
+)++ = '\0';
+
+1229 \15 
+__»tv®
+;
+
+1230 
+       }
+}
+
+1232 
+__STRING_INLINE
\ 5*
+__¡r£p_2c
+ (\ 5**
+__s
+, \ 5
+__»jeù1
+, \ 5
+__»jeù2
+);
+
+1233 
+__STRING_INLINE
\ 5*
+
+1234 
+       $__¡r£p_2c
+ (\ 5**
+__s
+, \ 5
+__»jeù1
+, \ 5
+__»jeù2
+)
+
+1236 \14\ 5*
+__»tv®
+ = *
+__s
+;
+
+1237 ià(
+__»tv®
+ !ð
+NULL
+)
+
+1239 \14\ 5*
+__ý
+ = 
+__»tv®
+;
+
+1242 ià(*
+__ý
+ == '\0')
+
+1244 
+__ý
+ = 
+NULL
+;
+
+1247 ià(*
+__ý
+ =ð
+__»jeù1
+ || *__ý =ð
+__»jeù2
+)
+
+1249 *
+__ý
+++ = '\0';
+
+1252 ++
+__ý
+;
+
+1254 *
+__s
+ = 
+__ý
+;
+
+1256 \15 
+__»tv®
+;
+
+1257 
+       }
+}
+
+1259 
+__STRING_INLINE
\ 5*
+__¡r£p_3c
+ (\ 5**
+__s
+, \ 5
+__»jeù1
+, \ 5
+__»jeù2
+,
+
+1260 \ 5
+__»jeù3
+);
+
+1261 
+__STRING_INLINE
\ 5*
+
+1262 
+       $__¡r£p_3c
+ (\ 5**
+__s
+, \ 5
+__»jeù1
+, \ 5
+__»jeù2
+, \ 5
+__»jeù3
+)
+
+1264 \14\ 5*
+__»tv®
+ = *
+__s
+;
+
+1265 ià(
+__»tv®
+ !ð
+NULL
+)
+
+1267 \14\ 5*
+__ý
+ = 
+__»tv®
+;
+
+1270 ià(*
+__ý
+ == '\0')
+
+1272 
+__ý
+ = 
+NULL
+;
+
+1275 ià(*
+__ý
+ =ð
+__»jeù1
+ || *__ý =ð
+__»jeù2
+ || *__ý =ð
+__»jeù3
+)
+
+1277 *
+__ý
+++ = '\0';
+
+1280 ++
+__ý
+;
+
+1282 *
+__s
+ = 
+__ý
+;
+
+1284 \15 
+__»tv®
+;
+
+1285 
+       }
+}
+
+1286 #ifdeà
+__USE_BSD
+
+
+1287 \ 1
+       #¡r£p
+(
+s
+, 
+»jeù
+       `__¡r£p
+ (s,\84ejeù)
+
+       )
+
+1294 #ifdeà
+__USE_MISC
+
+
+1296 #ià!
+def\9aed
+_HAVE_STRING_ARCH_¡rdup
+ || !def\9aed 
+_HAVE_STRING_ARCH_¡ºdup
+
+
+1297 \ 1
+       #__Ãed_m®loc_ªd_ÿÎoc
+
+
+       )
+
+1298 \ 2
+       ~<¡dlib.h
+>
+
+1301 #iâdeà
+_HAVE_STRING_ARCH_¡rdup
+
+
+1303 \r\ 5*
+       $__¡rdup
+ (
+__cڡ
\ 5*
+__¡r\9ag
+__THROW
+__©\8cibu\8b_m®loc__
+;
+
+1304 \ 1
+       #__¡rdup
+(
+s
+) \
+
+1305 (
+       `__ex\8bnsiÚ__
+ (
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+s
+è&& 
+       `__¡r\9ag2_1b±r_p
+ (s) \
+
+1306 ? (((
+__cڡ
\ 5*è(
+s
+))[0] == '\0' \
+
+1307 ? (\ 5
+       `ÿÎoc
+ ((
+size_t
+) 1, (size_t) 1) \
+
+1308 : ({ 
+size_t
+__Ën
+ = 
+       `¡¾\92
+ (
+s
+) + 1; \
+
+1309 \ 5*
+__»tv®
+ = (\ 5
+       `m®loc
+ (
+__Ën
+); \
+
+1310 ià(
+__»tv®
+ !ð
+NULL
+) \
+
+1311 
+__»tv®
+ = (\ 5
+       `memýy
+ (__»tv®, 
+s
+, 
+__Ën
+); \
+
+1312 
+__»tv®
+; 
+       }
+})) \
+
+1313 : 
+       `__¡rdup
+ (
+s
+)))
+
+       )
+
+1315 #ià
+def\9aed
+__USE_SVID
+ || def\9aed 
+__USE_BSD
+ || def\9aed 
+__USE_XOPEN_EXTENDED
+
+
+1316 \ 1
+       #¡rdup
+(
+s
+       `__¡rdup
+ (s)
+
+       )
+
+1320 #iâdeà
+_HAVE_STRING_ARCH_¡ºdup
+
+
+1322 \r\ 5*
+       $__¡ºdup
+ (
+__cڡ
\ 5*
+__¡r\9ag
+, 
+size_t
+__n
+)
+
+1323 
+__THROW
+__©\8cibu\8b_m®loc__
+;
+
+1324 \ 1
+       #__¡ºdup
+(
+s
+, 
+n
+) \
+
+1325 (
+       `__ex\8bnsiÚ__
+ (
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+s
+è&& 
+       `__¡r\9ag2_1b±r_p
+ (s) \
+
+1326 ? (((
+__cڡ
\ 5*è(
+s
+))[0] == '\0' \
+
+1327 ? (\ 5
+       `ÿÎoc
+ ((
+size_t
+) 1, (size_t) 1) \
+
+1328 : ({ 
+size_t
+__Ën
+ = 
+       `¡¾\92
+ (
+s
+) + 1; \
+
+1329 
+size_t
+__n
+ = (
+n
+); \
+
+1330 \ 5*
+__»tv®
+; \
+
+1331 ià(
+__n
+ < 
+__Ën
+) \
+
+1332 
+__Ën
+ = 
+__n
+ + 1; \
+
+1333 
+__»tv®
+ = (\ 5
+       `m®loc
+ (
+__Ën
+); \
+
+1334 ià(
+__»tv®
+ !ð
+NULL
+) \
+
+1336 
+__»tv®
+[
+__Ën
+ - 1] = '\0'; \
+
+1337 
+__»tv®
+ = (\ 5
+       `memýy
+ (__»tv®, 
+s
+, \
+
+1338 
+__Ën
+ - 1); \
+
+1340 
+__»tv®
+; 
+       }
+})) \
+
+1341 : 
+       `__¡ºdup
+ (
+s
+, 
+n
+)))
+
+       )
+
+1343 #ifdeà
+__USE_GNU
+
+
+1344 \ 1
+       #¡ºdup
+(
+s
+, 
+n
+       `__¡ºdup
+ (s,\82)
+
+       )
+
+1350 #iâdeà
+_FORCE_INLINES
+
+
+1351 #undeà
+__STRING_INLINE
+
+
+       @/usr/include/bits/string3.h
+
+19 #iâdeà
+_STRING_H
+
+
+23 
+__w¬ndeþ
+ (
+__w¬n_mem£t_z\94o_Ën
+,
+
+26 #iâdeà
+__ýlu¥lus
+
+
+30 #undeà
+memýy
+
+
+31 #undeà
+memmove
+
+
+32 #undeà
+mem£t
+
+
+33 #undeà
+¡rÿt
+
+
+34 #undeà
+¡rýy
+
+
+35 #undeà
+¡ºÿt
+
+
+36 #undeà
+¡ºýy
+
+
+37 #ifdeà
+__USE_GNU
+
+
+38 #undeà
+mempýy
+
+
+39 #undeà
+¡pýy
+
+
+41 #ifdeà
+__USE_BSD
+
+
+42 #undeà
+bcÝy
+
+
+43 #undeà
+bz\94o
+
+
+48 
+__ex\8bº_®ways_\9al\9ae
\1e*
+
+49 
+__NTH
+ (
+       $memýy
+ (\1e*
+__»¡riù
+__de¡
+, 
+__cڡ
\1e*__»¡riù 
+__¤c
+,
+
+50 
+size_t
+__Ën
+))
+
+52 \15 
+       `__bu\9et\9a___memýy_chk
+ (
+__de¡
+, 
+__¤c
+, 
+__Ën
+, 
+       `__bos0
+ (__dest));
+
+53 
+       }
+}
+
+55 
+__ex\8bº_®ways_\9al\9ae
\1e*
+
+56 
+__NTH
+ (
+       $memmove
+ (\1e*
+__de¡
+, 
+__cڡ
\1e*
+__¤c
+, 
+size_t
+__Ën
+))
+
+58 \15 
+       `__bu\9et\9a___memmove_chk
+ (
+__de¡
+, 
+__¤c
+, 
+__Ën
+, 
+       `__bos0
+ (__dest));
+
+59 
+       }
+}
+
+61 #ifdeà
+__USE_GNU
+
+
+62 
+__ex\8bº_®ways_\9al\9ae
\1e*
+
+63 
+__NTH
+ (
+       $mempýy
+ (\1e*
+__»¡riù
+__de¡
+, 
+__cڡ
\1e*__»¡riù 
+__¤c
+,
+
+64 
+size_t
+__Ën
+))
+
+66 \15 
+       `__bu\9et\9a___mempýy_chk
+ (
+__de¡
+, 
+__¤c
+, 
+__Ën
+, 
+       `__bos0
+ (__dest));
+
+67 
+       }
+}
+
+76 
+__ex\8bº_®ways_\9al\9ae
\1e*
+
+77 
+__NTH
+ (
+       $mem£t
+ (\1e*
+__de¡
+, \12
+__ch
+, 
+size_t
+__Ën
+))
+
+79 ià(
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__Ën
+) && __len == 0
+
+80 && (!
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__ch
+) || __ch != 0))
+
+82 
+       `__w¬n_mem£t_z\94o_Ën
+ ();
+
+83 \15 
+__de¡
+;
+
+85 \15 
+       `__bu\9et\9a___mem£t_chk
+ (
+__de¡
+, 
+__ch
+, 
+__Ën
+, 
+       `__bos0
+ (__dest));
+
+86 
+       }
+}
+
+88 #ifdeà
+__USE_BSD
+
+
+89 
+__ex\8bº_®ways_\9al\9ae
\1e
+
+90 
+__NTH
+ (
+       $bcÝy
+ (
+__cڡ
\1e*
+__¤c
+, \1e*
+__de¡
+, 
+size_t
+__Ën
+))
+
+92 (\1eè
+       `__bu\9et\9a___memmove_chk
+ (
+__de¡
+, 
+__¤c
+, 
+__Ën
+, 
+       `__bos0
+ (__dest));
+
+93 
+       }
+}
+
+95 
+__ex\8bº_®ways_\9al\9ae
\1e
+
+96 
+__NTH
+ (
+       $bz\94o
+ (\1e*
+__de¡
+, 
+size_t
+__Ën
+))
+
+98 (\1eè
+       `__bu\9et\9a___mem£t_chk
+ (
+__de¡
+, '\0', 
+__Ën
+, 
+       `__bos0
+ (__dest));
+
+99 
+       }
+}
+
+102 
+__ex\8bº_®ways_\9al\9ae
\ 5*
+
+103 
+__NTH
+ (
+       $¡rýy
+ (\ 5*
+__»¡riù
+__de¡
+, 
+__cڡ
\ 5*__»¡riù 
+__¤c
+))
+
+105 \15 
+       `__bu\9et\9a___¡rýy_chk
+ (
+__de¡
+, 
+__¤c
+, 
+       `__bos
+ (__dest));
+
+106 
+       }
+}
+
+108 #ifdeà
+__USE_GNU
+
+
+109 
+__ex\8bº_®ways_\9al\9ae
\ 5*
+
+110 
+__NTH
+ (
+       $¡pýy
+ (\ 5*
+__»¡riù
+__de¡
+, 
+__cڡ
\ 5*__»¡riù 
+__¤c
+))
+
+112 \15 
+       `__bu\9et\9a___¡pýy_chk
+ (
+__de¡
+, 
+__¤c
+, 
+       `__bos
+ (__dest));
+
+113 
+       }
+}
+
+117 
+__ex\8bº_®ways_\9al\9ae
\ 5*
+
+118 
+__NTH
+ (
+       $¡ºýy
+ (\ 5*
+__»¡riù
+__de¡
+, 
+__cڡ
\ 5*__»¡riù 
+__¤c
+,
+
+119 
+size_t
+__Ën
+))
+
+121 \15 
+       `__bu\9et\9a___¡ºýy_chk
+ (
+__de¡
+, 
+__¤c
+, 
+__Ën
+, 
+       `__bos
+ (__dest));
+
+122 
+       }
+}
+
+125 \r\ 5*
+       $__¡²ýy_chk
+ (\ 5*
+__de¡
+, 
+__cڡ
\ 5*
+__¤c
+, 
+size_t
+__n
+,
+
+126 
+size_t
+__de¡Ën
+__THROW
+;
+
+127 \r\ 5*
+       `__REDIRECT_NTH
+ (
+__¡²ýy_®\9fs
+, (\ 5*
+__de¡
+,
+
+128 
+__cڡ
\ 5*
+__¤c
+,
+
+129 
+size_t
+__n
+), 
+¡²ýy
+);
+
+131 
+__ex\8bº_®ways_\9al\9ae
\ 5*
+
+132 
+       `__NTH
+ (
+       $¡²ýy
+ (\ 5*
+__de¡
+, 
+__cڡ
\ 5*
+__¤c
+, 
+size_t
+__n
+))
+
+134 ià(
+       `__bos
+ (
+__de¡
+è!ð(
+size_t
+) -1
+
+135 && (!
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__n
+è|| __À<ð
+       `__bos
+ (
+__de¡
+)))
+
+136 \15 
+       `__¡²ýy_chk
+ (
+__de¡
+, 
+__¤c
+, 
+__n
+, 
+       `__bos
+ (__dest));
+
+137 \15 
+       `__¡²ýy_®\9fs
+ (
+__de¡
+, 
+__¤c
+, 
+__n
+);
+
+138 
+       }
+}
+
+141 
+__ex\8bº_®ways_\9al\9ae
\ 5*
+
+142 
+__NTH
+ (
+       $¡rÿt
+ (\ 5*
+__»¡riù
+__de¡
+, 
+__cڡ
\ 5*__»¡riù 
+__¤c
+))
+
+144 \15 
+       `__bu\9et\9a___¡rÿt_chk
+ (
+__de¡
+, 
+__¤c
+, 
+       `__bos
+ (__dest));
+
+145 
+       }
+}
+
+148 
+__ex\8bº_®ways_\9al\9ae
\ 5*
+
+149 
+__NTH
+ (
+       $¡ºÿt
+ (\ 5*
+__»¡riù
+__de¡
+, 
+__cڡ
\ 5*__»¡riù 
+__¤c
+,
+
+150 
+size_t
+__Ën
+))
+
+152 \15 
+       `__bu\9et\9a___¡ºÿt_chk
+ (
+__de¡
+, 
+__¤c
+, 
+__Ën
+, 
+       `__bos
+ (__dest));
+
+153 
+       }
+}
+
+       @/usr/include/bits/sys_errlist.h
+
+20 #iâdeà
+_STDIO_H
+
+
+26 #ifdeà 
+__USE_BSD
+
+
+27 \r\12
+sys_ü
+;
+
+28 \r
+__cڡ
\ 5*__cڡ 
+sys_\94¾i¡
+[];
+
+30 #ifdeà 
+__USE_GNU
+
+
+31 \r\12
+_sys_ü
+;
+
+32 \r
+__cڡ
\ 5*__cڡ 
+_sys_\94¾i¡
+[];
+
+       @/usr/include/bits/time.h
+
+24 #iâdeà
+__Ãed_timev®
+
+
+25 #iâdeà
+_BITS_TIME_H
+
+
+26 \ 1
+       #_BITS_TIME_H
+ 1
+
+       )
+
+34 \ 1
+       #CLOCKS_PER_SEC
+ 1000000l
+
+       )
+
+36 #ià!
+def\9aed
+__STRICT_ANSI__
+ && !def\9aed 
+__USE_XOPEN2K
+
+
+39 \ 2
+       ~<b\99s/ty³s.h
+>
+
+40 \r\13\12
+__syscÚf
+ (\12);
+
+41 \ 1
+       #CLK_TCK
+ ((
+__þock_t
+       `__syscÚf
+ (2)è
+
+       )
+
+44 #ifdeà
+__USE_POSIX199309
+
+
+46 \ 1
+       #CLOCK_REALTIME
+ 0
+
+       )
+
+48 \ 1
+       #CLOCK_MONOTONIC
+ 1
+
+       )
+
+50 \ 1
+       #CLOCK_PROCESS_CPUTIME_ID
+ 2
+
+       )
+
+52 \ 1
+       #CLOCK_THREAD_CPUTIME_ID
+ 3
+
+       )
+
+54 \ 1
+       #CLOCK_MONOTONIC_RAW
+ 4
+
+       )
+
+56 \ 1
+       #CLOCK_REALTIME_COARSE
+ 5
+
+       )
+
+58 \ 1
+       #CLOCK_MONOTONIC_COARSE
+ 6
+
+       )
+
+61 \ 1
+       #TIMER_ABSTIME
+ 1
+
+       )
+
+67 #ifdeà
+__Ãed_timev®
+
+
+68 #undeà
+__Ãed_timev®
+
+
+69 #iâdeà
+_STRUCT_TIMEVAL
+
+
+70 \ 1
+       #_STRUCT_TIMEVAL
+ 1
+
+       )
+
+71 \ 2
+       ~<b\99s/ty³s.h
+>
+
+75 \19
+       stimev®
+
+
+77 
+__time_t
+       mtv_£c
+;
+
+78 
+__su£cÚds_t
+       mtv_u£c
+;
+
+       @/usr/include/bits/types.h
+
+24 #iâdef 
+_BITS_TYPES_H
+
+
+25 \ 1
+       #_BITS_TYPES_H
+ 1
+
+       )
+
+27 \ 2
+       ~<ã©u»s.h
+>
+
+28 \ 2
+       ~<b\99s/wÜdsize.h
+>
+
+31 \e\1d\ 5
+       t__u_ch¬
+;
+
+32 \e\1d\16\12
+       t__u_shÜt
+;
+
+33 \e\1d\12
+       t__u_\9at
+;
+
+34 \e\1d\13\12
+       t__u_lÚg
+;
+
+37 \esigÃd \ 5
+       t__\9at8_t
+;
+
+38 \e\1d\ 5
+       t__u\9at8_t
+;
+
+39 \esigÃd \16\12
+       t__\9at16_t
+;
+
+40 \e\1d\16\12
+       t__u\9at16_t
+;
+
+41 \esigÃd \12
+       t__\9at32_t
+;
+
+42 \e\1d\12
+       t__u\9at32_t
+;
+
+43 #ià
+__WORDSIZE
+ == 64
+
+44 \esigÃd \13\12
+       t__\9at64_t
+;
+
+45 \e\1d\13\12
+       t__u\9at64_t
+;
+
+46 #\96
+def\9aed
+__GLIBC_HAVE_LONG_LONG
+
+
+47 
+__ex\8bnsiÚ__
\esigÃd \13\13\12
+       t__\9at64_t
+;
+
+48 
+__ex\8bnsiÚ__
\e\1d\13\13\12
+       t__u\9at64_t
+;
+
+52 #ià
+__WORDSIZE
+ == 64
+
+53 \e\13\12
+       t__quad_t
+;
+
+54 \e\1d\13\12
+       t__u_quad_t
+;
+
+55 #\96
+def\9aed
+__GLIBC_HAVE_LONG_LONG
+
+
+56 
+__ex\8bnsiÚ__
\e\13\13\12
+       t__quad_t
+;
+
+57 
+__ex\8bnsiÚ__
\e\1d\13\13\12
+       t__u_quad_t
+;
+
+61 \13
+       m__v®
+[2];
+
+62 } 
+       t__quad_t
+;
+
+65 
+__u_lÚg
+       m__v®
+[2];
+
+66 } 
+       t__u_quad_t
+;
+
+99 \ 1
+       #__S16_TYPE
\16\12
+
+       )
+
+100 \ 1
+       #__U16_TYPE
\1d\16\12
+
+       )
+
+101 \ 1
+       #__S32_TYPE
\12
+
+       )
+
+102 \ 1
+       #__U32_TYPE
\1d\12
+
+       )
+
+103 \ 1
+       #__SLONGWORD_TYPE
\13\12
+
+       )
+
+104 \ 1
+       #__ULONGWORD_TYPE
\1d\13\12
+
+       )
+
+105 #ià
+__WORDSIZE
+ == 32
+
+106 \ 1
+       #__SQUAD_TYPE
+__quad_t
+
+
+       )
+
+107 \ 1
+       #__UQUAD_TYPE
+__u_quad_t
+
+
+       )
+
+108 \ 1
+       #__SWORD_TYPE
\12
+
+       )
+
+109 \ 1
+       #__UWORD_TYPE
\1d\12
+
+       )
+
+110 \ 1
+       #__SLONG32_TYPE
\13\12
+
+       )
+
+111 \ 1
+       #__ULONG32_TYPE
\1d\13\12
+
+       )
+
+112 \ 1
+       #__S64_TYPE
+__quad_t
+
+
+       )
+
+113 \ 1
+       #__U64_TYPE
+__u_quad_t
+
+
+       )
+
+116 \ 1
+       #__STD_TYPE
+__ex\8bnsiÚ__
\e
+
+       )
+
+117 #\96
+__WORDSIZE
+ == 64
+
+118 \ 1
+       t__SQUAD_TYPE
\13\12
+
+       )
+
+119 \ 1
+       t__UQUAD_TYPE
\1d\13\12
+
+       )
+
+120 \ 1
+       t__SWORD_TYPE
\13\12
+
+       )
+
+121 \ 1
+       t__UWORD_TYPE
\1d\13\12
+
+       )
+
+122 \ 1
+       t__SLONG32_TYPE
\12
+
+       )
+
+123 \ 1
+       t__ULONG32_TYPE
\1d\12
+
+       )
+
+124 \ 1
+       t__S64_TYPE
\13\12
+
+       )
+
+125 \ 1
+       t__U64_TYPE
\1d\13\12
+
+       )
+
+127 \ 1
+       t__STD_TYPE
\e
+
+       )
+
+131 \ 2
+       ~<b\99s/ty³sizes.h
+>
+
+134 
+__STD_TYPE
+       t__DEV_T_TYPE
+       t__dev_t
+;
+
+135 
+__STD_TYPE
+__UID_T_TYPE
+       g__uid_t
+;
+
+136 
+__STD_TYPE
+__GID_T_TYPE
+       g__gid_t
+;
+
+137 
+__STD_TYPE
+__INO_T_TYPE
+       g__\9ao_t
+;
+
+138 
+__STD_TYPE
+__INO64_T_TYPE
+       g__\9ao64_t
+;
+
+139 
+__STD_TYPE
+__MODE_T_TYPE
+       g__mode_t
+;
+
+140 
+__STD_TYPE
+__NLINK_T_TYPE
+       g__ƚk_t
+;
+
+141 
+__STD_TYPE
+__OFF_T_TYPE
+       g__off_t
+;
+
+142 
+__STD_TYPE
+__OFF64_T_TYPE
+       g__off64_t
+;
+
+143 
+__STD_TYPE
+__PID_T_TYPE
+       g__pid_t
+;
+
+144 
+__STD_TYPE
+__FSID_T_TYPE
+       g__fsid_t
+;
+
+145 
+__STD_TYPE
+__CLOCK_T_TYPE
+       g__þock_t
+;
+
+146 
+__STD_TYPE
+__RLIM_T_TYPE
+       g__¾im_t
+;
+
+147 
+__STD_TYPE
+__RLIM64_T_TYPE
+       g__¾im64_t
+;
+
+148 
+__STD_TYPE
+__ID_T_TYPE
+       g__id_t
+;
+
+149 
+__STD_TYPE
+__TIME_T_TYPE
+       g__time_t
+;
+
+150 
+__STD_TYPE
+__USECONDS_T_TYPE
+       g__u£cÚds_t
+;
+
+151 
+__STD_TYPE
+__SUSECONDS_T_TYPE
+       g__su£cÚds_t
+;
+
+153 
+__STD_TYPE
+__DADDR_T_TYPE
+       g__daddr_t
+;
+
+154 
+__STD_TYPE
+__SWBLK_T_TYPE
+       g__swblk_t
+;
+
+155 
+__STD_TYPE
+__KEY_T_TYPE
+       g__key_t
+;
+
+158 
+__STD_TYPE
+__CLOCKID_T_TYPE
+       g__þockid_t
+;
+
+161 
+__STD_TYPE
+__TIMER_T_TYPE
+       g__tim\94_t
+;
+
+164 
+__STD_TYPE
+__BLKSIZE_T_TYPE
+       g__blksize_t
+;
+
+169 
+__STD_TYPE
+__BLKCNT_T_TYPE
+       g__blkút_t
+;
+
+170 
+__STD_TYPE
+__BLKCNT64_T_TYPE
+       g__blkút64_t
+;
+
+173 
+__STD_TYPE
+__FSBLKCNT_T_TYPE
+       g__fsblkút_t
+;
+
+174 
+__STD_TYPE
+__FSBLKCNT64_T_TYPE
+       g__fsblkút64_t
+;
+
+177 
+__STD_TYPE
+__FSFILCNT_T_TYPE
+       g__fsf\9eút_t
+;
+
+178 
+__STD_TYPE
+__FSFILCNT64_T_TYPE
+       g__fsf\9eút64_t
+;
+
+180 
+__STD_TYPE
+__SSIZE_T_TYPE
+       g__ssize_t
+;
+
+184 \e
+__off64_t
+       t__loff_t
+;
+
+185 \e
+__quad_t
+ *
+       t__qaddr_t
+;
+
+186 \e\ 5*
+       t__ÿddr_t
+;
+
+189 
+__STD_TYPE
+__SWORD_TYPE
+       g__\9a\8d\8c_t
+;
+
+192 
+__STD_TYPE
+__U32_TYPE
+       g__sockËn_t
+;
+
+195 #undeà
+__STD_TYPE
+
+
+       @/usr/include/bits/unistd.h
+
+20 #iâdeà
+_UNISTD_H
+
+
+24 \r
+ssize_t
+       $__»ad_chk
+ (\12
+__fd
+, \1e*
+__buf
+, 
+size_t
+__nby\8bs
+,
+
+25 
+size_t
+__buæ\92
+__wur
+;
+
+26 \r
+ssize_t
+       `__REDIRECT
+ (
+__»ad_®\9fs
+, (\12
+__fd
+, \1e*
+__buf
+,
+
+27 
+size_t
+__nby\8bs
+), 
+»ad
+__wur
+;
+
+28 \r
+ssize_t
+       `__REDIRECT
+ (
+__»ad_chk_w¬n
+,
+
+29 (\12
+__fd
+, \1e*
+__buf
+, 
+size_t
+__nby\8bs
+,
+
+30 
+size_t
+__buæ\92
+), 
+__»ad_chk
+)
+
+31 
+__wur
+       `__w¬Ç\89r
+ ("read called with bigger\86ength\81han size of "
+
+34 
+__ex\8bº_®ways_\9al\9ae
+__wur
+ssize_t
+
+
+35 
+       $»ad
+ (\12
+__fd
+, \1e*
+__buf
+, 
+size_t
+__nby\8bs
+)
+
+37 ià(
+       `__bos0
+ (
+__buf
+è!ð(
+size_t
+) -1)
+
+39 ià(!
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__nby\8bs
+))
+
+40 \15 
+       `__»ad_chk
+ (
+__fd
+, 
+__buf
+, 
+__nby\8bs
+, 
+       `__bos0
+ (__buf));
+
+42 ià(
+__nby\8bs
+ > 
+       `__bos0
+ (
+__buf
+))
+
+43 \15 
+       `__»ad_chk_w¬n
+ (
+__fd
+, 
+__buf
+, 
+__nby\8bs
+, 
+       `__bos0
+ (__buf));
+
+45 \15 
+       `__»ad_®\9fs
+ (
+__fd
+, 
+__buf
+, 
+__nby\8bs
+);
+
+46 
+       }
+}
+
+48 #ifdeà
+__USE_UNIX98
+
+
+49 \r
+ssize_t
+       $__´\97d_chk
+ (\12
+__fd
+, \1e*
+__buf
+, 
+size_t
+__nby\8bs
+,
+
+50 
+__off_t
+__off£t
+, 
+size_t
+__bufsize
+__wur
+;
+
+51 \r
+ssize_t
+       $__´\97d64_chk
+ (\12
+__fd
+, \1e*
+__buf
+, 
+size_t
+__nby\8bs
+,
+
+52 
+__off64_t
+__off£t
+, 
+size_t
+__bufsize
+__wur
+;
+
+53 \r
+ssize_t
+       `__REDIRECT
+ (
+__´\97d_®\9fs
+,
+
+54 (\12
+__fd
+, \1e*
+__buf
+, 
+size_t
+__nby\8bs
+,
+
+55 
+__off_t
+__off£t
+), 
\97d
+__wur
+;
+
+56 \r
+ssize_t
+       `__REDIRECT
+ (
+__´\97d64_®\9fs
+,
+
+57 (\12
+__fd
+, \1e*
+__buf
+, 
+size_t
+__nby\8bs
+,
+
+58 
+__off64_t
+__off£t
+), 
\97d64
+__wur
+;
+
+59 \r
+ssize_t
+       `__REDIRECT
+ (
+__´\97d_chk_w¬n
+,
+
+60 (\12
+__fd
+, \1e*
+__buf
+, 
+size_t
+__nby\8bs
+,
+
+61 
+__off_t
+__off£t
+, 
+size_t
+__bufsize
+), 
+__´\97d_chk
+)
+
+62 
+__wur
+       `__w¬Ç\89r
+ ("pread called with bigger\86ength\81han size of "
+
+64 \r
+ssize_t
+       `__REDIRECT
+ (
+__´\97d64_chk_w¬n
+,
+
+65 (\12
+__fd
+, \1e*
+__buf
+, 
+size_t
+__nby\8bs
+,
+
+66 
+__off64_t
+__off£t
+, 
+size_t
+__bufsize
+),
+
+67 
+__´\97d64_chk
+)
+
+68 
+__wur
+       `__w¬Ç\89r
+ ("pread64 called with bigger\86ength\81han size of "
+
+71 #iâdeà
+__USE_FILE_OFFSET64
+
+
+72 
+__ex\8bº_®ways_\9al\9ae
+__wur
+ssize_t
+
+
+73 
+       $´\97d
+ (\12
+__fd
+, \1e*
+__buf
+, 
+size_t
+__nby\8bs
+, 
+__off_t
+__off£t
+)
+
+75 ià(
+       `__bos0
+ (
+__buf
+è!ð(
+size_t
+) -1)
+
+77 ià(!
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__nby\8bs
+))
+
+78 \15 
+       `__´\97d_chk
+ (
+__fd
+, 
+__buf
+, 
+__nby\8bs
+, 
+__off£t
+, 
+       `__bos0
+ (__buf));
+
+80 iàÐ
+__nby\8bs
+ > 
+       `__bos0
+ (
+__buf
+))
+
+81 \15 
+       `__´\97d_chk_w¬n
+ (
+__fd
+, 
+__buf
+, 
+__nby\8bs
+, 
+__off£t
+,
+
+82 
+       `__bos0
+ (
+__buf
+));
+
+84 \15 
+       `__´\97d_®\9fs
+ (
+__fd
+, 
+__buf
+, 
+__nby\8bs
+, 
+__off£t
+);
+
+85 
+       }
+}
+
+87 
+__ex\8bº_®ways_\9al\9ae
+__wur
+ssize_t
+
+
+88 
+       $´\97d
+ (\12
+__fd
+, \1e*
+__buf
+, 
+size_t
+__nby\8bs
+, 
+__off64_t
+__off£t
+)
+
+90 ià(
+       `__bos0
+ (
+__buf
+è!ð(
+size_t
+) -1)
+
+92 ià(!
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__nby\8bs
+))
+
+93 \15 
+       `__´\97d64_chk
+ (
+__fd
+, 
+__buf
+, 
+__nby\8bs
+, 
+__off£t
+, 
+       `__bos0
+ (__buf));
+
+95 iàÐ
+__nby\8bs
+ > 
+       `__bos0
+ (
+__buf
+))
+
+96 \15 
+       `__´\97d64_chk_w¬n
+ (
+__fd
+, 
+__buf
+, 
+__nby\8bs
+, 
+__off£t
+,
+
+97 
+       `__bos0
+ (
+__buf
+));
+
+100 \15 
+       `__´\97d64_®\9fs
+ (
+__fd
+, 
+__buf
+, 
+__nby\8bs
+, 
+__off£t
+);
+
+101 
+       }
+}
+
+104 #ifdeà
+__USE_LARGEFILE64
+
+
+105 
+__ex\8bº_®ways_\9al\9ae
+__wur
+ssize_t
+
+
+106 
+       $´\97d64
+ (\12
+__fd
+, \1e*
+__buf
+, 
+size_t
+__nby\8bs
+, 
+__off64_t
+__off£t
+)
+
+108 ià(
+       `__bos0
+ (
+__buf
+è!ð(
+size_t
+) -1)
+
+110 ià(!
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__nby\8bs
+))
+
+111 \15 
+       `__´\97d64_chk
+ (
+__fd
+, 
+__buf
+, 
+__nby\8bs
+, 
+__off£t
+, 
+       `__bos0
+ (__buf));
+
+113 iàÐ
+__nby\8bs
+ > 
+       `__bos0
+ (
+__buf
+))
+
+114 \15 
+       `__´\97d64_chk_w¬n
+ (
+__fd
+, 
+__buf
+, 
+__nby\8bs
+, 
+__off£t
+,
+
+115 
+       `__bos0
+ (
+__buf
+));
+
+118 \15 
+       `__´\97d64_®\9fs
+ (
+__fd
+, 
+__buf
+, 
+__nby\8bs
+, 
+__off£t
+);
+
+119 
+       }
+}
+
+123 #ià
+def\9aed
+__USE_BSD
+ || def\9aed 
+__USE_XOPEN_EXTENDED
+ || def\9aed 
+__USE_XOPEN2K
+
+
+124 \r
+ssize_t
+       $__»adl\9ak_chk
+ (
+__cڡ
\ 5*
+__»¡riù
+__·th
+,
+
+125 \ 5*
+__»¡riù
+__buf
+, 
+size_t
+__Ën
+,
+
+126 
+size_t
+__buæ\92
+)
+
+127 
+__THROW
+       `__nÚnuÎ
+ ((1, 2)è
+__wur
+;
+
+128 \r
+ssize_t
+       `__REDIRECT_NTH
+ (
+__»adl\9ak_®\9fs
+,
+
+129 (
+__cڡ
\ 5*
+__»¡riù
+__·th
+,
+
+130 \ 5*
+__»¡riù
+__buf
+, 
+size_t
+__Ën
+), 
+»adl\9ak
+)
+
+131 
+       `__nÚnuÎ
+ ((1, 2)è
+__wur
+;
+
+132 \r
+ssize_t
+       `__REDIRECT_NTH
+ (
+__»adl\9ak_chk_w¬n
+,
+
+133 (
+__cڡ
\ 5*
+__»¡riù
+__·th
+,
+
+134 \ 5*
+__»¡riù
+__buf
+, 
+size_t
+__Ën
+,
+
+135 
+size_t
+__buæ\92
+), 
+__»adl\9ak_chk
+)
+
+136 
+       `__nÚnuÎ
+ ((1, 2)è
+__wur
+       `__w¬Ç\89r
+ ("readlink called with bigger\86ength "
+
+139 
+__ex\8bº_®ways_\9al\9ae
+       `__nÚnuÎ
+ ((1, 2)è
+__wur
+ssize_t
+
+
+140 
+       `__NTH
+ (
+       $»adl\9ak
+ (
+__cڡ
\ 5*
+__»¡riù
+__·th
+, \ 5*__»¡riù 
+__buf
+,
+
+141 
+size_t
+__Ën
+))
+
+143 ià(
+       `__bos
+ (
+__buf
+è!ð(
+size_t
+) -1)
+
+145 ià(!
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__Ën
+))
+
+146 \15 
+       `__»adl\9ak_chk
+ (
+__·th
+, 
+__buf
+, 
+__Ën
+, 
+       `__bos
+ (__buf));
+
+148 iàÐ
+__Ën
+ > 
+       `__bos
+ (
+__buf
+))
+
+149 \15 
+       `__»adl\9ak_chk_w¬n
+ (
+__·th
+, 
+__buf
+, 
+__Ën
+, 
+       `__bos
+ (__buf));
+
+151 \15 
+       `__»adl\9ak_®\9fs
+ (
+__·th
+, 
+__buf
+, 
+__Ën
+);
+
+152 
+       }
+}
+
+155 #ifdeà
+__USE_ATFILE
+
+
+156 \r
+ssize_t
+       $__»adl\9ak©_chk
+ (\12
+__fd
+, 
+__cڡ
\ 5*
+__»¡riù
+__·th
+,
+
+157 \ 5*
+__»¡riù
+__buf
+, 
+size_t
+__Ën
+,
+
+158 
+size_t
+__buæ\92
+)
+
+159 
+__THROW
+       `__nÚnuÎ
+ ((2, 3)è
+__wur
+;
+
+160 \r
+ssize_t
+       `__REDIRECT_NTH
+ (
+__»adl\9ak©_®\9fs
+,
+
+161 (\12
+__fd
+, 
+__cڡ
\ 5*
+__»¡riù
+__·th
+,
+
+162 \ 5*
+__»¡riù
+__buf
+, 
+size_t
+__Ën
+),
+
+163 
+»adl\9a
+)
+
+164 
+       `__nÚnuÎ
+ ((2, 3)è
+__wur
+;
+
+165 \r
+ssize_t
+       `__REDIRECT_NTH
+ (
+__»adl\9ak©_chk_w¬n
+,
+
+166 (\12
+__fd
+, 
+__cڡ
\ 5*
+__»¡riù
+__·th
+,
+
+167 \ 5*
+__»¡riù
+__buf
+, 
+size_t
+__Ën
+,
+
+168 
+size_t
+__buæ\92
+), 
+__»adl\9ak©_chk
+)
+
+169 
+       `__nÚnuÎ
+ ((2, 3)è
+__wur
+       `__w¬Ç\89r
+ ("readlinkat called with bigger "
+
+173 
+__ex\8bº_®ways_\9al\9ae
+       `__nÚnuÎ
+ ((2, 3)è
+__wur
+ssize_t
+
+
+174 
+       `__NTH
+ (
+       $»adl\9a
+ (\12
+__fd
+, 
+__cڡ
\ 5*
+__»¡riù
+__·th
+,
+
+175 \ 5*
+__»¡riù
+__buf
+, 
+size_t
+__Ën
+))
+
+177 ià(
+       `__bos
+ (
+__buf
+è!ð(
+size_t
+) -1)
+
+179 ià(!
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__Ën
+))
+
+180 \15 
+       `__»adl\9ak©_chk
+ (
+__fd
+, 
+__·th
+, 
+__buf
+, 
+__Ën
+, 
+       `__bos
+ (__buf));
+
+182 ià(
+__Ën
+ > 
+       `__bos
+ (
+__buf
+))
+
+183 \15 
+       `__»adl\9ak©_chk_w¬n
+ (
+__fd
+, 
+__·th
+, 
+__buf
+, 
+__Ën
+,
+
+184 
+       `__bos
+ (
+__buf
+));
+
+186 \15 
+       `__»adl\9ak©_®\9fs
+ (
+__fd
+, 
+__·th
+, 
+__buf
+, 
+__Ën
+);
+
+187 
+       }
+}
+
+190 \r\ 5*
+       $__g\91cwd_chk
+ (\ 5*
+__buf
+, 
+size_t
+__size
+, size_\88
+__buæ\92
+)
+
+191 
+__THROW
+__wur
+;
+
+192 \r\ 5*
+       `__REDIRECT_NTH
+ (
+__g\91cwd_®\9fs
+,
+
+193 (\ 5*
+__buf
+, 
+size_t
+__size
+), 
+g\91cwd
+__wur
+;
+
+194 \r\ 5*
+       `__REDIRECT_NTH
+ (
+__g\91cwd_chk_w¬n
+,
+
+195 (\ 5*
+__buf
+, 
+size_t
+__size
+, size_\88
+__buæ\92
+),
+
+196 
+__g\91cwd_chk
+)
+
+197 
+__wur
+       `__w¬Ç\89r
+ ("getcwd caller with bigger\86ength\81han size of "
+
+200 
+__ex\8bº_®ways_\9al\9ae
+__wur
\ 5*
+
+201 
+       `__NTH
+ (
+       $g\91cwd
+ (\ 5*
+__buf
+, 
+size_t
+__size
+))
+
+203 ià(
+       `__bos
+ (
+__buf
+è!ð(
+size_t
+) -1)
+
+205 ià(!
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__size
+))
+
+206 \15 
+       `__g\91cwd_chk
+ (
+__buf
+, 
+__size
+, 
+       `__bos
+ (__buf));
+
+208 ià(
+__size
+ > 
+       `__bos
+ (
+__buf
+))
+
+209 \15 
+       `__g\91cwd_chk_w¬n
+ (
+__buf
+, 
+__size
+, 
+       `__bos
+ (__buf));
+
+211 \15 
+       `__g\91cwd_®\9fs
+ (
+__buf
+, 
+__size
+);
+
+212 
+       }
+}
+
+214 #ià
+def\9aed
+__USE_BSD
+ || def\9aed 
+__USE_XOPEN_EXTENDED
+
+
+215 \r\ 5*
+       $__g\91wd_chk
+ (\ 5*
+__buf
+, 
+size_t
+buæ\92
+)
+
+216 
+__THROW
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+217 \r\ 5*
+       `__REDIRECT_NTH
+ (
+__g\91wd_w¬n
+, (\ 5*
+__buf
+), 
+g\91wd
+)
+
+218 
+       `__nÚnuÎ
+ ((1)è
+__wur
+       `__w¬Ç\89r
+ ("please use getcwd instead,\87s getwd "
+
+221 
+__ex\8bº_®ways_\9al\9ae
+       `__nÚnuÎ
+ ((1)è
+__©\8cibu\8b_d\95»ÿ\8bd__
+__wur
\ 5*
+
+222 
+       `__NTH
+ (
+       $g\91wd
+ (\ 5*
+__buf
+))
+
+224 ià(
+       `__bos
+ (
+__buf
+è!ð(
+size_t
+) -1)
+
+225 \15 
+       `__g\91wd_chk
+ (
+__buf
+, 
+       `__bos
+ (__buf));
+
+226 \15 
+       `__g\91wd_w¬n
+ (
+__buf
+);
+
+227 
+       }
+}
+
+230 \r
+size_t
+       $__cÚf¡r_chk
+ (\12
+__Çme
+, \ 5*
+__buf
+, 
+size_t
+__Ën
+,
+
+231 
+size_t
+__buæ\92
+__THROW
+;
+
+232 \r
+size_t
+       `__REDIRECT_NTH
+ (
+__cÚf¡r_®\9fs
+, (\12
+__Çme
+, \ 5*
+__buf
+,
+
+233 
+size_t
+__Ën
+), 
+cÚf¡r
+);
+
+234 \r
+size_t
+       `__REDIRECT_NTH
+ (
+__cÚf¡r_chk_w¬n
+,
+
+235 (\12
+__Çme
+, \ 5*
+__buf
+, 
+size_t
+__Ën
+,
+
+236 
+size_t
+__buæ\92
+), 
+__cÚf¡r_chk
+)
+
+237 
+       `__w¬Ç\89r
+ ("confstr called with bigger\86ength\81han size of destination "
+
+240 
+__ex\8bº_®ways_\9al\9ae
+size_t
+
+
+241 
+       `__NTH
+ (
+       $cÚf¡r
+ (\12
+__Çme
+, \ 5*
+__buf
+, 
+size_t
+__Ën
+))
+
+243 ià(
+       `__bos
+ (
+__buf
+è!ð(
+size_t
+) -1)
+
+245 ià(!
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__Ën
+))
+
+246 \15 
+       `__cÚf¡r_chk
+ (
+__Çme
+, 
+__buf
+, 
+__Ën
+, 
+       `__bos
+ (__buf));
+
+248 ià(
+       `__bos
+ (
+__buf
+è< 
+__Ën
+)
+
+249 \15 
+       `__cÚf¡r_chk_w¬n
+ (
+__Çme
+, 
+__buf
+, 
+__Ën
+, 
+       `__bos
+ (__buf));
+
+251 \15 
+       `__cÚf¡r_®\9fs
+ (
+__Çme
+, 
+__buf
+, 
+__Ën
+);
+
+252 
+       }
+}
+
+255 \r\12
+       $__g\91groups_chk
+ (\12
+__size
+, 
+__gid_t
+__li¡
+[], 
+size_t
+__li¡Ën
+)
+
+256 
+__THROW
+__wur
+;
+
+257 \r\12
+       `__REDIRECT_NTH
+ (
+__g\91groups_®\9fs
+, (\12
+__size
+, 
+__gid_t
+__li¡
+[]),
+
+258 
+g\91groups
+__wur
+;
+
+259 \r\12
+       `__REDIRECT_NTH
+ (
+__g\91groups_chk_w¬n
+,
+
+260 (\12
+__size
+, 
+__gid_t
+__li¡
+[], 
+size_t
+__li¡Ën
+),
+
+261 
+__g\91groups_chk
+)
+
+262 
+__wur
+       `__w¬Ç\89r
+ ("getgroups called with bigger group count\81han what "
+
+265 
+__ex\8bº_®ways_\9al\9ae
\12
+
+266 
+       `__NTH
+ (
+       $g\91groups
+ (\12
+__size
+, 
+__gid_t
+__li¡
+[]))
+
+268 ià(
+       `__bos
+ (
+__li¡
+è!ð(
+size_t
+) -1)
+
+270 ià(!
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__size
+) || __size < 0)
+
+271 \15 
+       `__g\91groups_chk
+ (
+__size
+, 
+__li¡
+, 
+       `__bos
+ (__list));
+
+273 ià(
+__size
+ * \17 (
+__gid_t
+è> 
+       `__bos
+ (
+__li¡
+))
+
+274 \15 
+       `__g\91groups_chk_w¬n
+ (
+__size
+, 
+__li¡
+, 
+       `__bos
+ (__list));
+
+276 \15 
+       `__g\91groups_®\9fs
+ (
+__size
+, 
+__li¡
+);
+
+277 
+       }
+}
+
+280 \r\12
+       $__\89yÇme_r_chk
+ (\12
+__fd
+, \ 5*
+__buf
+, 
+size_t
+__buæ\92
+,
+
+281 
+size_t
+__ėl
+__THROW
+       `__nÚnuÎ
+ ((2));
+
+282 \r\12
+       `__REDIRECT_NTH
+ (
+__\89yÇme_r_®\9fs
+, (\12
+__fd
+, \ 5*
+__buf
+,
+
+283 
+size_t
+__buæ\92
+), 
+\89yÇme_r
+)
+
+284 
+       `__nÚnuÎ
+ ((2));
+
+285 \r\12
+       `__REDIRECT_NTH
+ (
+__\89yÇme_r_chk_w¬n
+,
+
+286 (\12
+__fd
+, \ 5*
+__buf
+, 
+size_t
+__buæ\92
+,
+
+287 
+size_t
+__ėl
+), 
+__\89yÇme_r_chk
+)
+
+288 
+       `__nÚnuÎ
+ ((2)è
+       `__w¬Ç\89r
+ ("ttyname_r called with bigger buflen\81han "
+
+291 
+__ex\8bº_®ways_\9al\9ae
\12
+
+292 
+       `__NTH
+ (
+       $\89yÇme_r
+ (\12
+__fd
+, \ 5*
+__buf
+, 
+size_t
+__buæ\92
+))
+
+294 ià(
+       `__bos
+ (
+__buf
+è!ð(
+size_t
+) -1)
+
+296 ià(!
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__buæ\92
+))
+
+297 \15 
+       `__\89yÇme_r_chk
+ (
+__fd
+, 
+__buf
+, 
+__buæ\92
+, 
+       `__bos
+ (__buf));
+
+299 ià(
+__buæ\92
+ > 
+       `__bos
+ (
+__buf
+))
+
+300 \15 
+       `__\89yÇme_r_chk_w¬n
+ (
+__fd
+, 
+__buf
+, 
+__buæ\92
+, 
+       `__bos
+ (__buf));
+
+302 \15 
+       `__\89yÇme_r_®\9fs
+ (
+__fd
+, 
+__buf
+, 
+__buæ\92
+);
+
+303 
+       }
+}
+
+306 #ià
+def\9aed
+__USE_REENTRANT
+ || def\9aed 
+__USE_POSIX199506
+
+
+307 \r\12
+       $__g\91log\9a_r_chk
+ (\ 5*
+__buf
+, 
+size_t
+__buæ\92
+, size_\88
+__ėl
+)
+
+308 
+       `__nÚnuÎ
+ ((1));
+
+309 \r\12
+       `__REDIRECT
+ (
+__g\91log\9a_r_®\9fs
+, (\ 5*
+__buf
+, 
+size_t
+__buæ\92
+),
+
+310 
+g\91log\9a_r
+       `__nÚnuÎ
+ ((1));
+
+311 \r\12
+       `__REDIRECT
+ (
+__g\91log\9a_r_chk_w¬n
+,
+
+312 (\ 5*
+__buf
+, 
+size_t
+__buæ\92
+, size_\88
+__ėl
+),
+
+313 
+__g\91log\9a_r_chk
+)
+
+314 
+       `__nÚnuÎ
+ ((1)è
+       `__w¬Ç\89r
+ ("getlogin_r called with bigger buflen\81han "
+
+317 
+__ex\8bº_®ways_\9al\9ae
\12
+
+318 
+       $g\91log\9a_r
+ (\ 5*
+__buf
+, 
+size_t
+__buæ\92
+)
+
+320 ià(
+       `__bos
+ (
+__buf
+è!ð(
+size_t
+) -1)
+
+322 ià(!
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__buæ\92
+))
+
+323 \15 
+       `__g\91log\9a_r_chk
+ (
+__buf
+, 
+__buæ\92
+, 
+       `__bos
+ (__buf));
+
+325 ià(
+__buæ\92
+ > 
+       `__bos
+ (
+__buf
+))
+
+326 \15 
+       `__g\91log\9a_r_chk_w¬n
+ (
+__buf
+, 
+__buæ\92
+, 
+       `__bos
+ (__buf));
+
+328 \15 
+       `__g\91log\9a_r_®\9fs
+ (
+__buf
+, 
+__buæ\92
+);
+
+329 
+       }
+}
+
+333 #ià
+def\9aed
+__USE_BSD
+ || def\9aed 
+__USE_UNIX98
+
+
+334 \r\12
+       $__g\91ho¡Çme_chk
+ (\ 5*
+__buf
+, 
+size_t
+__buæ\92
+, size_\88
+__ėl
+)
+
+335 
+__THROW
+       `__nÚnuÎ
+ ((1));
+
+336 \r\12
+       `__REDIRECT_NTH
+ (
+__g\91ho¡Çme_®\9fs
+, (\ 5*
+__buf
+, 
+size_t
+__buæ\92
+),
+
+337 
+g\91ho¡Çme
+       `__nÚnuÎ
+ ((1));
+
+338 \r\12
+       `__REDIRECT_NTH
+ (
+__g\91ho¡Çme_chk_w¬n
+,
+
+339 (\ 5*
+__buf
+, 
+size_t
+__buæ\92
+, size_\88
+__ėl
+),
+
+340 
+__g\91ho¡Çme_chk
+)
+
+341 
+       `__nÚnuÎ
+ ((1)è
+       `__w¬Ç\89r
+ ("gethostname called with bigger buflen\81han "
+
+344 
+__ex\8bº_®ways_\9al\9ae
\12
+
+345 
+       `__NTH
+ (
+       $g\91ho¡Çme
+ (\ 5*
+__buf
+, 
+size_t
+__buæ\92
+))
+
+347 ià(
+       `__bos
+ (
+__buf
+è!ð(
+size_t
+) -1)
+
+349 ià(!
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__buæ\92
+))
+
+350 \15 
+       `__g\91ho¡Çme_chk
+ (
+__buf
+, 
+__buæ\92
+, 
+       `__bos
+ (__buf));
+
+352 ià(
+__buæ\92
+ > 
+       `__bos
+ (
+__buf
+))
+
+353 \15 
+       `__g\91ho¡Çme_chk_w¬n
+ (
+__buf
+, 
+__buæ\92
+, 
+       `__bos
+ (__buf));
+
+355 \15 
+       `__g\91ho¡Çme_®\9fs
+ (
+__buf
+, 
+__buæ\92
+);
+
+356 
+       }
+}
+
+360 #ià
+def\9aed
+__USE_BSD
+ || (def\9aed 
+__USE_XOPEN
+ && !def\9aed 
+__USE_UNIX98
+)
+
+361 \r\12
+       $__g\91doma\9aÇme_chk
+ (\ 5*
+__buf
+, 
+size_t
+__buæ\92
+, size_\88
+__ėl
+)
+
+362 
+__THROW
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+363 \r\12
+       `__REDIRECT_NTH
+ (
+__g\91doma\9aÇme_®\9fs
+, (\ 5*
+__buf
+,
+
+364 
+size_t
+__buæ\92
+),
+
+365 
+g\91doma\9aÇme
+       `__nÚnuÎ
+ ((1)è
+__wur
+;
+
+366 \r\12
+       `__REDIRECT_NTH
+ (
+__g\91doma\9aÇme_chk_w¬n
+,
+
+367 (\ 5*
+__buf
+, 
+size_t
+__buæ\92
+, size_\88
+__ėl
+),
+
+368 
+__g\91doma\9aÇme_chk
+)
+
+369 
+       `__nÚnuÎ
+ ((1)è
+__wur
+       `__w¬Ç\89r
+ ("getdomainname called with bigger "
+
+373 
+__ex\8bº_®ways_\9al\9ae
\12
+
+374 
+       `__NTH
+ (
+       $g\91doma\9aÇme
+ (\ 5*
+__buf
+, 
+size_t
+__buæ\92
+))
+
+376 ià(
+       `__bos
+ (
+__buf
+è!ð(
+size_t
+) -1)
+
+378 ià(!
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__buæ\92
+))
+
+379 \15 
+       `__g\91doma\9aÇme_chk
+ (
+__buf
+, 
+__buæ\92
+, 
+       `__bos
+ (__buf));
+
+381 ià(
+__buæ\92
+ > 
+       `__bos
+ (
+__buf
+))
+
+382 \15 
+       `__g\91doma\9aÇme_chk_w¬n
+ (
+__buf
+, 
+__buæ\92
+, 
+       `__bos
+ (__buf));
+
+384 \15 
+       `__g\91doma\9aÇme_®\9fs
+ (
+__buf
+, 
+__buæ\92
+);
+
+385 
+       }
+}
+
+       @/usr/include/bits/waitflags.h
+
+20 #ià!
+def\9aed
+_SYS_WAIT_H
+ && !def\9aed 
+_STDLIB_H
+
+
+26 \ 1
+       #WNOHANG
+ 1
+
+       )
+
+27 \ 1
+       #WUNTRACED
+ 2
+
+       )
+
+30 \ 1
+       #WSTOPPED
+ 2
+
+       )
+
+31 \ 1
+       #WEXITED
+ 4
+
+       )
+
+32 \ 1
+       #WCONTINUED
+ 8
+
+       )
+
+33 \ 1
+       #WNOWAIT
+ 0x01000000
+
+       )
+
+35 \ 1
+       #__WNOTHREAD
+ 0x20000000
+
+       )
+
+37 \ 1
+       #__WALL
+ 0x40000000
+
+       )
+
+38 \ 1
+       #__WCLONE
+ 0x80000000
+
+       )
+
+       @/usr/include/bits/waitstatus.h
+
+20 #ià!
+def\9aed
+_SYS_WAIT_H
+ && !def\9aed 
+_STDLIB_H
+
+
+29 \ 1
+       #__WEXITSTATUS
+(
+¡©us
+è(((¡©usè& 0xff00è>> 8)
+
+       )
+
+32 \ 1
+       #__WTERMSIG
+(
+¡©us
+è((¡©usè& 0x7f)
+
+       )
+
+35 \ 1
+       #__WSTOPSIG
+(
+¡©us
+       `__WEXITSTATUS
+(¡©us)
+
+       )
+
+38 \ 1
+       #__WIFEXITED
+(
+¡©us
+è(
+       `__WTERMSIG
+(¡©usè=ð0)
+
+       )
+
+41 \ 1
+       #__WIFSIGNALED
+(
+¡©us
+) \
+
+42 (((sigÃd \ 5è(((
+¡©us
+è& 0x7fè+ 1è>> 1è> 0)
+
+       )
+
+45 \ 1
+       #__WIFSTOPPED
+(
+¡©us
+è(((¡©usè& 0xffè=ð0x7f)
+
+       )
+
+49 #ifdeà
+WCONTINUED
+
+
+50 \ 1
+       #__WIFCONTINUED
+(
+¡©us
+è((¡©usè=ð
+__W_CONTINUED
+)
+
+       )
+
+54 \ 1
+       #__WCOREDUMP
+(
+¡©us
+è((¡©usè& 
+__WCOREFLAG
+)
+
+       )
+
+57 \ 1
+       #__W_EXITCODE
+(
+»t
+, 
+sig
+è(Ô\91è<< 8 | (sig))
+
+       )
+
+58 \ 1
+       #__W_STOPCODE
+(
+sig
+è((sigè<< 8 | 0x7f)
+
+       )
+
+59 \ 1
+       #__W_CONTINUED
+ 0xffff
+
+       )
+
+60 \ 1
+       #__WCOREFLAG
+ 0x80
+
+       )
+
+63 #ifdef 
+__USE_BSD
+
+
+65 \ 2
+       ~<\92d\9fn.h
+>
+
+67 \1c
+       uwa\99
+
+
+69 \12
+       mw_¡©us
+;
+
+72 #if 
+__BYTE_ORDER
+ =ð
+__LITTLE_ENDIAN
+
+
+73 \1d\12
+       m__w_\8brmsig
+:7;
+
+74 \1d\12
+       m__w_cÜedump
+:1;
+
+75 \1d\12
+       m__w_»tcode
+:8;
+
+78 #if 
+__BYTE_ORDER
+ =ð
+__BIG_ENDIAN
+
+
+80 \1d\12
+       m__w_»tcode
+:8;
+
+81 \1d\12
+       m__w_cÜedump
+:1;
+
+82 \1d\12
+       m__w_\8brmsig
+:7;
+
+84 } 
+       m__wa\99_\8brm\9a©ed
+;
+
+87 #if 
+__BYTE_ORDER
+ =ð
+__LITTLE_ENDIAN
+
+
+88 \1d\12
+       m__w_¡Ýv®
+:8;
+
+89 \1d\12
+       m__w_¡Ýsig
+:8;
+
+92 #if 
+__BYTE_ORDER
+ =ð
+__BIG_ENDIAN
+
+
+94 \1d\12
+       m__w_¡Ýsig
+:8;
+
+95 \1d\12
+       m__w_¡Ýv®
+:8;
+
+97 } 
+       m__wa\99_¡Ý³d
+;
+
+100 \ 1
+       #w_\8brmsig
+__wa\99_\8brm\9a©ed
+.
+__w_\8brmsig
+
+
+       )
+
+101 \ 1
+       #w_cÜedump
+__wa\99_\8brm\9a©ed
+.
+__w_cÜedump
+
+
+       )
+
+102 \ 1
+       #w_»tcode
+__wa\99_\8brm\9a©ed
+.
+__w_»tcode
+
+
+       )
+
+103 \ 1
+       #w_¡Ýsig
+__wa\99_¡Ý³d
+.
+__w_¡Ýsig
+
+
+       )
+
+104 \ 1
+       #w_¡Ýv®
+__wa\99_¡Ý³d
+.
+__w_¡Ýv®
+
+
+       )
+
+       @/usr/include/bits/wordsize.h
+
+3 #ià
+def\9aed
+__x86_64__
+
+
+4 \ 1
+       #__WORDSIZE
+ 64
+
+       )
+
+5 \ 1
+       #__WORDSIZE_COMPAT32
+ 1
+
+       )
+
+7 \ 1
+       #__WORDSIZE
+ 32
+
+       )
+
+       @/usr/include/endian.h
+
+19 #iâdef 
+_ENDIAN_H
+
+
+20 \ 1
+       #_ENDIAN_H
+ 1
+
+       )
+
+22 \ 2
+       ~<ã©u»s.h
+>
+
+32 \ 1
+       #__LITTLE_ENDIAN
+ 1234
+
+       )
+
+33 \ 1
+       #__BIG_ENDIAN
+ 4321
+
+       )
+
+34 \ 1
+       #__PDP_ENDIAN
+ 3412
+
+       )
+
+37 \ 2
+       ~<b\99s/\92d\9fn.h
+>
+
+41 #iâdeà
+__FLOAT_WORD_ORDER
+
+
+42 \ 1
+       #__FLOAT_WORD_ORDER
+__BYTE_ORDER
+
+
+       )
+
+45 #ifdef 
+__USE_BSD
+
+
+46 \ 1
+       #LITTLE_ENDIAN
+__LITTLE_ENDIAN
+
+
+       )
+
+47 \ 1
+       #BIG_ENDIAN
+__BIG_ENDIAN
+
+
+       )
+
+48 \ 1
+       #PDP_ENDIAN
+__PDP_ENDIAN
+
+
+       )
+
+49 \ 1
+       #BYTE_ORDER
+__BYTE_ORDER
+
+
+       )
+
+52 #ià
+__BYTE_ORDER
+ =ð
+__LITTLE_ENDIAN
+
+
+53 \ 1
+       #__LONG_LONG_PAIR
+(
+HI
+, 
+LO
+èLO, 
+       )
+HI
+
+54 #\96
+__BYTE_ORDER
+ =ð
+__BIG_ENDIAN
+
+
+55 \ 1
+       #__LONG_LONG_PAIR
+(
+HI
+, 
+LO
+èHI, 
+       )
+LO
+
+59 #ifdeà
+__USE_BSD
+
+
+61 \ 2
+       ~<b\99s/by\8bsw­.h
+>
+
+63 #ià
+__BYTE_ORDER
+ =ð
+__LITTLE_ENDIAN
+
+
+64 \ 1
+       #htobe16
+(
+x
+       `__bsw­_16
+ (x)
+
+       )
+
+65 \ 1
+       #htÞe16
+(
+x
+è(x)
+
+       )
+
+66 \ 1
+       #be16toh
+(
+x
+       `__bsw­_16
+ (x)
+
+       )
+
+67 \ 1
+       #Ë16toh
+(
+x
+è(x)
+
+       )
+
+69 \ 1
+       #htobe32
+(
+x
+       `__bsw­_32
+ (x)
+
+       )
+
+70 \ 1
+       #htÞe32
+(
+x
+è(x)
+
+       )
+
+71 \ 1
+       #be32toh
+(
+x
+       `__bsw­_32
+ (x)
+
+       )
+
+72 \ 1
+       #Ë32toh
+(
+x
+è(x)
+
+       )
+
+74 \ 1
+       #htobe64
+(
+x
+       `__bsw­_64
+ (x)
+
+       )
+
+75 \ 1
+       #htÞe64
+(
+x
+è(x)
+
+       )
+
+76 \ 1
+       #be64toh
+(
+x
+       `__bsw­_64
+ (x)
+
+       )
+
+77 \ 1
+       #Ë64toh
+(
+x
+è(x)
+
+       )
+
+79 \ 1
+       #htobe16
+(
+x
+è(x)
+
+       )
+
+80 \ 1
+       #htÞe16
+(
+x
+       `__bsw­_16
+ (x)
+
+       )
+
+81 \ 1
+       #be16toh
+(
+x
+è(x)
+
+       )
+
+82 \ 1
+       #Ë16toh
+(
+x
+       `__bsw­_16
+ (x)
+
+       )
+
+84 \ 1
+       #htobe32
+(
+x
+è(x)
+
+       )
+
+85 \ 1
+       #htÞe32
+(
+x
+       `__bsw­_32
+ (x)
+
+       )
+
+86 \ 1
+       #be32toh
+(
+x
+è(x)
+
+       )
+
+87 \ 1
+       #Ë32toh
+(
+x
+       `__bsw­_32
+ (x)
+
+       )
+
+89 \ 1
+       #htobe64
+(
+x
+è(x)
+
+       )
+
+90 \ 1
+       #htÞe64
+(
+x
+       `__bsw­_64
+ (x)
+
+       )
+
+91 \ 1
+       #be64toh
+(
+x
+è(x)
+
+       )
+
+92 \ 1
+       #Ë64toh
+(
+x
+       `__bsw­_64
+ (x)
+
+       )
+
+       @/usr/include/features.h
+
+20 #iâdef 
+_FEATURES_H
+
+
+21 \ 1
+       #_FEATURES_H
+ 1
+
+       )
+
+97 #undeà
+__USE_ISOC99
+
+
+98 #undeà
+__USE_ISOC95
+
+
+99 #undeà
+__USE_POSIX
+
+
+100 #undeà
+__USE_POSIX2
+
+
+101 #undeà
+__USE_POSIX199309
+
+
+102 #undeà
+__USE_POSIX199506
+
+
+103 #undeà
+__USE_XOPEN
+
+
+104 #undeà
+__USE_XOPEN_EXTENDED
+
+
+105 #undeà
+__USE_UNIX98
+
+
+106 #undeà
+__USE_XOPEN2K
+
+
+107 #undeà
+__USE_XOPEN2KXSI
+
+
+108 #undeà
+__USE_XOPEN2K8
+
+
+109 #undeà
+__USE_XOPEN2K8XSI
+
+
+110 #undeà
+__USE_LARGEFILE
+
+
+111 #undeà
+__USE_LARGEFILE64
+
+
+112 #undeà
+__USE_FILE_OFFSET64
+
+
+113 #undeà
+__USE_BSD
+
+
+114 #undeà
+__USE_SVID
+
+
+115 #undeà
+__USE_MISC
+
+
+116 #undeà
+__USE_ATFILE
+
+
+117 #undeà
+__USE_GNU
+
+
+118 #undeà
+__USE_REENTRANT
+
+
+119 #undeà
+__USE_FORTIFY_LEVEL
+
+
+120 #undeà
+__FAVOR_BSD
+
+
+121 #undeà
+__KERNEL_STRICT_NAMES
+
+
+125 #iâdeà
+_LOOSE_KERNEL_NAMES
+
+
+126 \ 1
+       #__KERNEL_STRICT_NAMES
+
+
+       )
+
+130 \ 1
+       #__USE_ANSI
+ 1
+
+       )
+
+139 #ià
+def\9aed
+__GNUC__
+ && def\9aed 
+__GNUC_MINOR__
+
+
+140 \ 1
+       #__GNUC_PREREQ
+(
+maj
+, 
+m\9a
+) \
+
+141 ((
+__GNUC__
+ << 16è+ 
+__GNUC_MINOR__
+ >ð((
+maj
+è<< 16è+ (
+m\9a
+))
+
+       )
+
+143 \ 1
+       #__GNUC_PREREQ
+(
+maj
+, 
+m\9a
+è0
+
+       )
+
+148 #ià
+def\9aed
+_BSD_SOURCE
+ && \
+
+149 !(
+def\9aed
+       g_POSIX_SOURCE
+ || def\9aed 
+       g_POSIX_C_SOURCE
+ || \
+
+150 
+def\9aed
+       g_XOPEN_SOURCE
+ || def\9aed 
+       g_GNU_SOURCE
+ || def\9aed 
+       g_SVID_SOURCE
+)
+
+151 \ 1
+       #__FAVOR_BSD
+ 1
+
+       )
+
+155 #ifdeà
+_GNU_SOURCE
+
+
+156 #undeà
+_ISOC95_SOURCE
+
+
+157 \ 1
+       #_ISOC95_SOURCE
+ 1
+
+       )
+
+158 #undeà
+_ISOC99_SOURCE
+
+
+159 \ 1
+       #_ISOC99_SOURCE
+ 1
+
+       )
+
+160 #undeà
+_POSIX_SOURCE
+
+
+161 \ 1
+       #_POSIX_SOURCE
+ 1
+
+       )
+
+162 #undeà
+_POSIX_C_SOURCE
+
+
+163 \ 1
+       #_POSIX_C_SOURCE
+ 200809L
+
+       )
+
+164 #undeà
+_XOPEN_SOURCE
+
+
+165 \ 1
+       #_XOPEN_SOURCE
+ 700
+
+       )
+
+166 #undeà
+_XOPEN_SOURCE_EXTENDED
+
+
+167 \ 1
+       #_XOPEN_SOURCE_EXTENDED
+ 1
+
+       )
+
+168 #undeà
+_LARGEFILE64_SOURCE
+
+
+169 \ 1
+       #_LARGEFILE64_SOURCE
+ 1
+
+       )
+
+170 #undeà
+_BSD_SOURCE
+
+
+171 \ 1
+       #_BSD_SOURCE
+ 1
+
+       )
+
+172 #undeà
+_SVID_SOURCE
+
+
+173 \ 1
+       #_SVID_SOURCE
+ 1
+
+       )
+
+174 #undeà
+_ATFILE_SOURCE
+
+
+175 \ 1
+       #_ATFILE_SOURCE
+ 1
+
+       )
+
+180 #ià(!
+def\9aed
+__STRICT_ANSI__
+ && !def\9aed 
+_ISOC99_SOURCE
+ && \
+
+181 !
+def\9aed
+       g_POSIX_SOURCE
+ && !def\9aed 
+       g_POSIX_C_SOURCE
+ && \
+
+182 !
+def\9aed
+       g_XOPEN_SOURCE
+ && !def\9aed 
+       g_BSD_SOURCE
+ && !def\9aed 
+       g_SVID_SOURCE
+)
+
+183 \ 1
+       #_BSD_SOURCE
+ 1
+
+       )
+
+184 \ 1
+       #_SVID_SOURCE
+ 1
+
+       )
+
+191 #ià(
+def\9aed
+_ISOC99_SOURCE
+ || def\9aed 
+_ISOC9X_SOURCE
+ \
+
+192 || (
+def\9aed
+       g__STDC_VERSION__
+ && __STDC_VERSION__ >= 199901L))
+
+193 \ 1
+       #__USE_ISOC99
+ 1
+
+       )
+
+197 #ià(
+def\9aed
+_ISOC99_SOURCE
+ || def\9aed 
+_ISOC9X_SOURCE
+ \
+
+198 || (
+def\9aed
+__STDC_VERSION__
+ && __STDC_VERSION__ >= 199409L))
+
+199 \ 1
+       #__USE_ISOC95
+ 1
+
+       )
+
+204 #ià((!
+def\9aed
+__STRICT_ANSI__
+ || (
+_XOPEN_SOURCE
+ - 0) >= 500) && \
+
+205 !
+def\9aed
+_POSIX_SOURCE
+ && !def\9aed 
+_POSIX_C_SOURCE
+)
+
+206 \ 1
+       #_POSIX_SOURCE
+ 1
+
+       )
+
+207 #ià
+def\9aed
+_XOPEN_SOURCE
+ && (_XOPEN_SOURCE - 0) < 500
+
+208 \ 1
+       #_POSIX_C_SOURCE
+ 2
+
+       )
+
+209 #\96
+def\9aed
+_XOPEN_SOURCE
+ && (_XOPEN_SOURCE - 0) < 600
+
+210 \ 1
+       #_POSIX_C_SOURCE
+ 199506L
+
+       )
+
+211 #\96
+def\9aed
+_XOPEN_SOURCE
+ && (_XOPEN_SOURCE - 0) < 700
+
+212 \ 1
+       #_POSIX_C_SOURCE
+ 200112L
+
+       )
+
+214 \ 1
+       #_POSIX_C_SOURCE
+ 200809L
+
+       )
+
+216 \ 1
+       #__USE_POSIX_IMPLICITLY
+ 1
+
+       )
+
+219 #ià
+def\9aed
+_POSIX_SOURCE
+ || 
+_POSIX_C_SOURCE
+ >ð1 || def\9aed 
+_XOPEN_SOURCE
+
+
+220 \ 1
+       #__USE_POSIX
+ 1
+
+       )
+
+223 #ià
+def\9aed
+_POSIX_C_SOURCE
+ && _POSIX_C_SOURCE >ð2 || def\9aed 
+_XOPEN_SOURCE
+
+
+224 \ 1
+       #__USE_POSIX2
+ 1
+
+       )
+
+227 #ià(
+_POSIX_C_SOURCE
+ - 0) >= 199309L
+
+228 \ 1
+       #__USE_POSIX199309
+ 1
+
+       )
+
+231 #ià(
+_POSIX_C_SOURCE
+ - 0) >= 199506L
+
+232 \ 1
+       #__USE_POSIX199506
+ 1
+
+       )
+
+235 #ià(
+_POSIX_C_SOURCE
+ - 0) >= 200112L
+
+236 \ 1
+       #__USE_XOPEN2K
+ 1
+
+       )
+
+237 #undeà
+__USE_ISOC95
+
+
+238 \ 1
+       #__USE_ISOC95
+ 1
+
+       )
+
+239 #undeà
+__USE_ISOC99
+
+
+240 \ 1
+       #__USE_ISOC99
+ 1
+
+       )
+
+243 #ià(
+_POSIX_C_SOURCE
+ - 0) >= 200809L
+
+244 \ 1
+       #__USE_XOPEN2K8
+ 1
+
+       )
+
+245 #undeà
+_ATFILE_SOURCE
+
+
+246 \ 1
+       #_ATFILE_SOURCE
+ 1
+
+       )
+
+249 #ifdef 
+_XOPEN_SOURCE
+
+
+250 \ 1
+       #__USE_XOPEN
+ 1
+
+       )
+
+251 #ià(
+_XOPEN_SOURCE
+ - 0) >= 500
+
+252 \ 1
+       #__USE_XOPEN_EXTENDED
+ 1
+
+       )
+
+253 \ 1
+       #__USE_UNIX98
+ 1
+
+       )
+
+254 #undeà
+_LARGEFILE_SOURCE
+
+
+255 \ 1
+       #_LARGEFILE_SOURCE
+ 1
+
+       )
+
+256 #ià(
+_XOPEN_SOURCE
+ - 0) >= 600
+
+257 #ià(
+_XOPEN_SOURCE
+ - 0) >= 700
+
+258 \ 1
+       #__USE_XOPEN2K8
+ 1
+
+       )
+
+259 \ 1
+       #__USE_XOPEN2K8XSI
+ 1
+
+       )
+
+261 \ 1
+       #__USE_XOPEN2K
+ 1
+
+       )
+
+262 \ 1
+       #__USE_XOPEN2KXSI
+ 1
+
+       )
+
+263 #undeà
+__USE_ISOC95
+
+
+264 \ 1
+       #__USE_ISOC95
+ 1
+
+       )
+
+265 #undeà
+__USE_ISOC99
+
+
+266 \ 1
+       #__USE_ISOC99
+ 1
+
+       )
+
+269 #ifdeà
+_XOPEN_SOURCE_EXTENDED
+
+
+270 \ 1
+       #__USE_XOPEN_EXTENDED
+ 1
+
+       )
+
+275 #ifdeà
+_LARGEFILE_SOURCE
+
+
+276 \ 1
+       #__USE_LARGEFILE
+ 1
+
+       )
+
+279 #ifdeà
+_LARGEFILE64_SOURCE
+
+
+280 \ 1
+       #__USE_LARGEFILE64
+ 1
+
+       )
+
+283 #ià
+def\9aed
+_FILE_OFFSET_BITS
+ && _FILE_OFFSET_BITS == 64
+
+284 \ 1
+       #__USE_FILE_OFFSET64
+ 1
+
+       )
+
+287 #ià
+def\9aed
+_BSD_SOURCE
+ || def\9aed 
+_SVID_SOURCE
+
+
+288 \ 1
+       #__USE_MISC
+ 1
+
+       )
+
+291 #ifdef 
+_BSD_SOURCE
+
+
+292 \ 1
+       #__USE_BSD
+ 1
+
+       )
+
+295 #ifdef 
+_SVID_SOURCE
+
+
+296 \ 1
+       #__USE_SVID
+ 1
+
+       )
+
+299 #ifdef 
+_ATFILE_SOURCE
+
+
+300 \ 1
+       #__USE_ATFILE
+ 1
+
+       )
+
+303 #ifdef 
+_GNU_SOURCE
+
+
+304 \ 1
+       #__USE_GNU
+ 1
+
+       )
+
+307 #ià
+def\9aed
+_REENTRANT
+ || def\9aed 
+_THREAD_SAFE
+
+
+308 \ 1
+       #__USE_REENTRANT
+ 1
+
+       )
+
+311 #ià
+def\9aed
+_FORTIFY_SOURCE
+ && _FORTIFY_SOURCE > 0 \
+
+312 && 
+__GNUC_PREREQ
+ (4, 1è&& 
+def\9aed
+       g__OPTIMIZE__
+ && __OPTIMIZE__ > 0
+
+313 #ià
+_FORTIFY_SOURCE
+ > 1
+
+314 \ 1
+       #__USE_FORTIFY_LEVEL
+ 2
+
+       )
+
+316 \ 1
+       #__USE_FORTIFY_LEVEL
+ 1
+
+       )
+
+319 \ 1
+       #__USE_FORTIFY_LEVEL
+ 0
+
+       )
+
+323 \ 2
+       ~<b\99s/´edefs.h
+>
+
+326 \ 1
+       #__STDC_ISO_10646__
+ 200009L
+
+       )
+
+334 #undeà
+__GNU_LIBRARY__
+
+
+335 \ 1
+       #__GNU_LIBRARY__
+ 6
+
+       )
+
+339 \ 1
+       #__GLIBC__
+ 2
+
+       )
+
+340 \ 1
+       #__GLIBC_MINOR__
+ 13
+
+       )
+
+342 \ 1
+       #__GLIBC_PREREQ
+(
+maj
+, 
+m\9a
+) \
+
+343 ((
+__GLIBC__
+ << 16è+ 
+__GLIBC_MINOR__
+ >ð((
+maj
+è<< 16è+ (
+m\9a
+))
+
+       )
+
+346 #ià
+def\9aed
+__GNUC__
+ \
+
+347 || (
+def\9aed
+       g__PGI
+ && def\9aed 
+       g__i386__
+ ) \
+
+348 || (
+def\9aed
+       g__INTEL_COMPILER
+ && (def\9aed 
+       g__i386__
+ || def\9aed 
+       g__\9f64__
+)) \
+
+349 || (
+def\9aed
+       g__STDC_VERSION__
+ && __STDC_VERSION__ >= 199901L)
+
+350 \ 1
+       #__GLIBC_HAVE_LONG_LONG
+ 1
+
+       )
+
+354 #iâdeà
+__ASSEMBLER__
+
+
+355 #iâdeà
+_SYS_CDEFS_H
+
+
+356 \ 2
+       ~<sys/cdefs.h
+>
+
+361 #ià
+def\9aed
+__USE_FILE_OFFSET64
+ && !def\9aed 
+__REDIRECT
+
+
+362 \ 1
+       #__USE_LARGEFILE
+ 1
+
+       )
+
+363 \ 1
+       #__USE_LARGEFILE64
+ 1
+
+       )
+
+369 #ià
+__GNUC_PREREQ
+ (2, 7è&& 
+def\9aed
+__OPTIMIZE__
+ \
+
+370 && !
+def\9aed
+       g__OPTIMIZE_SIZE__
+ && !def\9aed 
+       g__NO_INLINE__
+ \
+
+371 && 
+def\9aed
+       g__ex\8bº_\9al\9ae
+
+
+372 \ 1
+       #__USE_EXTERN_INLINES
+ 1
+
+       )
+
+377 #ià
+__GNUC_PREREQ
+ (2, 7è&& 
+def\9aed
+__OPTIMIZE__
+ \
+
+378 && (
+def\9aed
+       g_LIBC
+ || !def\9aed 
+       g__OPTIMIZE_SIZE__
+è&& !def\9aed 
+       g__NO_INLINE__
+ \
+
+379 && 
+def\9aed
+       g__ex\8bº_\9al\9ae
+
+
+380 \ 1
+       #__USE_EXTERN_INLINES_IN_LIBC
+ 1
+
+       )
+
+388 \ 2
+       ~<gnu/¡ubs.h
+>
+
+       @/usr/include/getopt.h
+
+21 #iâdeà
+_GETOPT_H
+
+
+23 #iâdeà
+__Ãed_g\91Ýt
+
+
+24 \ 1
+       #_GETOPT_H
+ 1
+
+       )
+
+34 #ià!
+def\9aed
+__GNU_LIBRARY__
+
+
+35 \ 2
+       ~<ùy³.h
+>
+
+38 #iâdeà
+__THROW
+
+
+39 #iâdeà
+__GNUC_PREREQ
+
+
+40 \ 1
+       #__GNUC_PREREQ
+(
+maj
+, 
+m\9a
+è(0)
+
+       )
+
+42 #ià
+def\9aed
+__ýlu¥lus
+ && 
+__GNUC_PREREQ
+ (2,8)
+
+43 \ 1
+       #__THROW
+       `throw
+ ()
+
+       )
+
+45 \ 1
+       #__THROW
+
+
+       )
+
+49 #ifdef 
+__ýlu¥lus
+
+
+59 \r\ 5*
+ݏrg
+;
+
+73 \r\12
+Ýt\9ad
+;
+
+78 \r\12
\8b¼
+;
+
+82 \r\12
+ÝtÝt
+;
+
+84 #iâdeà
+__Ãed_g\91Ýt
+
+
+106 \19
+       sÝtiÚ
+
+
+108 cڡ \ 5*
+       gÇme
+;
+
+111 \12
+       ghas_¬g
+;
+
+112 \12*
+       gæag
+;
+
+113 \12
+       gv®
+;
+
+118 \ 1
+       #no_¬gum\92t
+ 0
+
+       )
+
+119 \ 1
+       #»qu\9ced_¬gum\92t
+ 1
+
+       )
+
+120 \ 1
+       #ÝtiÚ®_¬gum\92t
+ 2
+
+       )
+
+148 #ifdeà
+__GNU_LIBRARY__
+
+
+152 \r\12
+g\91Ýt
+ (\12
+___¬gc
+, \ 5*cڡ *
+___¬gv
+, cڡ \ 5*
+__shÜtÝts
+)
+
+153 
+__THROW
+;
+
+155 #ià
+def\9aed
+__Ãed_g\91Ýt
+ && def\9aed 
+__USE_POSIX2
+ \
+
+156 && !
+def\9aed
+       g__USE_POSIX_IMPLICITLY
+ && !def\9aed 
+       g__USE_GNU
+
+
+160 #ifdeà
+__REDIRECT
+
+
+161 \r\12
+__REDIRECT_NTH
+ (
+g\91Ýt
+, (\12
+___¬gc
+, \ 5*cڡ *
+___¬gv
+,
+
+162 cڡ \ 5*
+__shÜtÝts
+),
+
+163 
+__posix_g\91Ýt
+);
+
+165 \r\12
+__posix_g\91Ýt
+ (\12
+___¬gc
+, \ 5*cڡ *
+___¬gv
+,
+
+166 cڡ \ 5*
+__shÜtÝts
+__THROW
+;
+
+167 \ 1
+       #g\91Ýt
+__posix_g\91Ýt
+
+
+       )
+
+171 \r\12
+g\91Ýt
+ ();
+
+174 #iâdeà
+__Ãed_g\91Ýt
+
+
+175 \r\12
+g\91Ýt_lÚg
+ (\12
+___¬gc
+, \ 5*cڡ *
+___¬gv
+,
+
+176 cڡ \ 5*
+__shÜtÝts
+,
+
+177 cڡ \19
+ÝtiÚ
+ *
+__lÚgÝts
+, \12*
+__lÚg\9ad
+)
+
+178 
+__THROW
+;
+
+179 \r\12
+g\91Ýt_lÚg_Úly
+ (\12
+___¬gc
+, \ 5*cڡ *
+___¬gv
+,
+
+180 cڡ \ 5*
+__shÜtÝts
+,
+
+181 cڡ \19
+ÝtiÚ
+ *
+__lÚgÝts
+, \12*
+__lÚg\9ad
+)
+
+182 
+__THROW
+;
+
+186 #ifdef 
+__ýlu¥lus
+
+
+191 #undeà
+__Ãed_g\91Ýt
+
+
+       @/usr/include/libio.h
+
+29 #iâdeà
+_IO_STDIO_H
+
+
+30 \ 1
+       #_IO_STDIO_H
+
+
+       )
+
+32 \ 2
+       ~<_G_cÚfig.h
+>
+
+34 \ 1
+       #_IO_pos_t
+_G_åos_t
+
+
+       )
+
+35 \ 1
+       #_IO_åos_t
+_G_åos_t
+
+
+       )
+
+36 \ 1
+       #_IO_åos64_t
+_G_åos64_t
+
+
+       )
+
+37 \ 1
+       #_IO_size_t
+_G_size_t
+
+
+       )
+
+38 \ 1
+       #_IO_ssize_t
+_G_ssize_t
+
+
+       )
+
+39 \ 1
+       #_IO_off_t
+_G_off_t
+
+
+       )
+
+40 \ 1
+       #_IO_off64_t
+_G_off64_t
+
+
+       )
+
+41 \ 1
+       #_IO_pid_t
+_G_pid_t
+
+
+       )
+
+42 \ 1
+       #_IO_uid_t
+_G_uid_t
+
+
+       )
+
+43 \ 1
+       #_IO_icÚv_t
+_G_icÚv_t
+
+
+       )
+
+44 \ 1
+       #_IO_HAVE_SYS_WAIT
+_G_HAVE_SYS_WAIT
+
+
+       )
+
+45 \ 1
+       #_IO_HAVE_ST_BLKSIZE
+_G_HAVE_ST_BLKSIZE
+
+
+       )
+
+46 \ 1
+       #_IO_BUFSIZ
+_G_BUFSIZ
+
+
+       )
+
+47 \ 1
+       #_IO_va_li¡
+_G_va_li¡
+
+
+       )
+
+48 \ 1
+       #_IO_w\9at_t
+_G_w\9at_t
+
+
+       )
+
+50 #ifdeà
+_G_NEED_STDARG_H
+
+
+52 \ 1
+       #__Ãed___va_li¡
+
+
+       )
+
+53 \ 2
+       ~<¡d¬g.h
+>
+
+54 #ifdeà
+__GNUC_VA_LIST
+
+
+55 #undeà
+_IO_va_li¡
+
+
+56 \ 1
+       #_IO_va_li¡
+__gnuc_va_li¡
+
+
+       )
+
+60 #iâdeà
+__P
+
+
+61 #ià
+_G_HAVE_SYS_CDEFS
+
+
+62 \ 2
+       ~<sys/cdefs.h
+>
+
+64 #ifdeà
+__STDC__
+
+
+65 \ 1
+       #__P
+(
+p
+       )
+p
+
+66 \ 1
+       #__PMT
+(
+p
+       )
+p
+
+68 \ 1
+       #__P
+(
+p
+è()
+
+       )
+
+69 \ 1
+       #__PMT
+(
+p
+è()
+
+       )
+
+75 #iâdeà
+_PARAMS
+
+
+76 \ 1
+       #_PARAMS
+(
+´Ùos
+       `__P
+ÕrÙos)
+
+       )
+
+79 #iâdeà
+__STDC__
+
+
+81 \ 1
+
+       )
+
+84 \ 1
+       #_IO_UNIFIED_JUMPTABLES
+ 1
+
+       )
+
+85 #iâdeà
+_G_HAVE_PRINTF_FP
+
+
+86 \ 1
+       #_IO_USE_DTOA
+ 1
+
+       )
+
+89 #iâdeà
+EOF
+
+
+90 \ 1
+       #EOF
+ (-1)
+
+       )
+
+92 #iâdeà
+NULL
+
+
+93 #ià
+def\9aed
+__GNUG__
+ && \
+
+94 (
+       g__GNUC__
+ > 2 || (__GNUC__ =ð2 && 
+__GNUC_MINOR__
+ >= 8))
+
+95 \ 1
+       #NULL
+ (
+__nuÎ
+)
+
+       )
+
+97 #ià!
+def\9aed
+(
+__ýlu¥lus
+)
+
+98 \ 1
+       #NULL
+ ((\1e*)0)
+
+       )
+
+100 \ 1
+       #NULL
+ (0)
+
+       )
+
+105 \ 1
+       #_IOS_INPUT
+ 1
+
+       )
+
+106 \ 1
+       #_IOS_OUTPUT
+ 2
+
+       )
+
+107 \ 1
+       #_IOS_ATEND
+ 4
+
+       )
+
+108 \ 1
+       #_IOS_APPEND
+ 8
+
+       )
+
+109 \ 1
+       #_IOS_TRUNC
+ 16
+
+       )
+
+110 \ 1
+       #_IOS_NOCREATE
+ 32
+
+       )
+
+111 \ 1
+       #_IOS_NOREPLACE
+ 64
+
+       )
+
+112 \ 1
+       #_IOS_BIN
+ 128
+
+       )
+
+120 \ 1
+       #_IO_MAGIC
+ 0xFBAD0000
+
+       )
+
+121 \ 1
+       #_OLD_STDIO_MAGIC
+ 0xFABC0000
+
+       )
+
+122 \ 1
+       #_IO_MAGIC_MASK
+ 0xFFFF0000
+
+       )
+
+123 \ 1
+       #_IO_USER_BUF
+ 1
+
+       )
+
+124 \ 1
+       #_IO_UNBUFFERED
+ 2
+
+       )
+
+125 \ 1
+       #_IO_NO_READS
+ 4
+
+       )
+
+126 \ 1
+       #_IO_NO_WRITES
+ 8
+
+       )
+
+127 \ 1
+       #_IO_EOF_SEEN
+ 0x10
+
+       )
+
+128 \ 1
+       #_IO_ERR_SEEN
+ 0x20
+
+       )
+
+129 \ 1
+       #_IO_DELETE_DONT_CLOSE
+ 0x40
+
+       )
+
+130 \ 1
+       #_IO_LINKED
+ 0x80
+
+       )
+
+131 \ 1
+       #_IO_IN_BACKUP
+ 0x100
+
+       )
+
+132 \ 1
+       #_IO_LINE_BUF
+ 0x200
+
+       )
+
+133 \ 1
+       #_IO_TIED_PUT_GET
+ 0x400
+
+       )
+
+134 \ 1
+       #_IO_CURRENTLY_PUTTING
+ 0x800
+
+       )
+
+135 \ 1
+       #_IO_IS_APPENDING
+ 0x1000
+
+       )
+
+136 \ 1
+       #_IO_IS_FILEBUF
+ 0x2000
+
+       )
+
+137 \ 1
+       #_IO_BAD_SEEN
+ 0x4000
+
+       )
+
+138 \ 1
+       #_IO_USER_LOCK
+ 0x8000
+
+       )
+
+140 \ 1
+       #_IO_FLAGS2_MMAP
+ 1
+
+       )
+
+141 \ 1
+       #_IO_FLAGS2_NOTCANCEL
+ 2
+
+       )
+
+142 #ifdeà
+_LIBC
+
+
+143 \ 1
+       #_IO_FLAGS2_FORTIFY
+ 4
+
+       )
+
+145 \ 1
+       #_IO_FLAGS2_USER_WBUF
+ 8
+
+       )
+
+146 #ifdeà
+_LIBC
+
+
+147 \ 1
+       #_IO_FLAGS2_SCANF_STD
+ 16
+
+       )
+
+151 \ 1
+       #_IO_SKIPWS
+ 01
+
+       )
+
+152 \ 1
+       #_IO_LEFT
+ 02
+
+       )
+
+153 \ 1
+       #_IO_RIGHT
+ 04
+
+       )
+
+154 \ 1
+       #_IO_INTERNAL
+ 010
+
+       )
+
+155 \ 1
+       #_IO_DEC
+ 020
+
+       )
+
+156 \ 1
+       #_IO_OCT
+ 040
+
+       )
+
+157 \ 1
+       #_IO_HEX
+ 0100
+
+       )
+
+158 \ 1
+       #_IO_SHOWBASE
+ 0200
+
+       )
+
+159 \ 1
+       #_IO_SHOWPOINT
+ 0400
+
+       )
+
+160 \ 1
+       #_IO_UPPERCASE
+ 01000
+
+       )
+
+161 \ 1
+       #_IO_SHOWPOS
+ 02000
+
+       )
+
+162 \ 1
+       #_IO_SCIENTIFIC
+ 04000
+
+       )
+
+163 \ 1
+       #_IO_FIXED
+ 010000
+
+       )
+
+164 \ 1
+       #_IO_UNITBUF
+ 020000
+
+       )
+
+165 \ 1
+       #_IO_STDIO
+ 040000
+
+       )
+
+166 \ 1
+       #_IO_DONT_CLOSE
+ 0100000
+
+       )
+
+167 \ 1
+       #_IO_BOOLALPHA
+ 0200000
+
+       )
+
+170 \19
+_IO_jump_t
+; \19
+       g_IO_FILE
+;
+
+173 #ifdeà
+_IO_MTSAFE_IO
+
+
+174 #ià
+def\9aed
+__GLIBC__
+ && __GLIBC__ >= 2
+
+175 \ 2
+       ~<b\99s/¡dio-lock.h
+>
+
+180 \e\1e
+       t_IO_lock_t
+;
+
+186 \19
+       s_IO_m¬k\94
+ {
+
+187 \19
+_IO_m¬k\94
+ *
+       m_Ãxt
+;
+
+188 \19
+_IO_FILE
+ *
+       m_sbuf
+;
+
+192 \12
+       m_pos
+;
+
+194 \1e
+£t_¡»ampos
+(
+¡»ampos
+è{ 
+       m_¥os
+ = sp; }
+
+195 \1e
+£t_off£t
+(\12
+off£t
+è{ 
+       m_pos
+ = off£t; 
+       m_¥os
+ = (
+¡»ampos
+)(-2); }
+
+196 
+       mpublic
+:
+
+197 
+¡»amm¬k\94
+(
+¡»ambuf
+ *
+sb
+);
+
+198 ~
+¡»amm¬k\94
+();
+
+199 \12
+§v\9ag
+(è{ \15 
+       m_¥os
+ == -2; }
+
+200 \12
+d\96\8f
+(
+¡»amm¬k\94
+&);
+
+201 \12
+d\96\8f
+();
+
+206 \f
+       e__codecvt_»suÉ
+
+
+208 
+       m__codecvt_ok
+,
+
+209 
+       m__codecvt_·¹\9fl
+,
+
+210 
+       m__codecvt_\94
+,
+
+211 
+       m__codecvt_nocÚv
+
+
+214 #ià
+def\9aed
+_LIBC
+ || def\9aed 
+_GLIBCPP_USE_WCHAR_T
+
+
+217 \19
+       s_IO_codecvt
+
+
+219 \1e(*
+       m__codecvt_de¡r
+è(\19
+       m_IO_codecvt
+ *);
+
+220 \f
+__codecvt_»suÉ
+ (*
+__codecvt_do_out
+è(\19
+       m_IO_codecvt
+ *,
+
+221 
+       m__mb¡©e_t
+ *,
+
+222 cڡ 
+       mwch¬_t
+ *,
+
+223 cڡ 
+       mwch¬_t
+ *,
+
+224 cڡ 
+       mwch¬_t
+ **, \ 5*,
+
+226 \f
+__codecvt_»suÉ
+ (*
+__codecvt_do_unshiá
+è(\19
+       m_IO_codecvt
+ *,
+
+227 
+       m__mb¡©e_t
+ *, \ 5*,
+
+229 \f
+__codecvt_»suÉ
+ (*
+__codecvt_do_\9a
+è(\19
+       m_IO_codecvt
+ *,
+
+230 
+       m__mb¡©e_t
+ *,
+
+232 cڡ \ 5**, 
+       mwch¬_t
+ *,
+
+233 
+       mwch¬_t
+ *, wchar_t **);
+
+234 \12(*
+       m__codecvt_do_\92cod\9ag
+è(\19
+       m_IO_codecvt
+ *);
+
+235 \12(*
+       m__codecvt_do_®ways_nocÚv
+è(\19
+       m_IO_codecvt
+ *);
+
+236 \12(*
+       m__codecvt_do_Ëngth
+è(\19
+       m_IO_codecvt
+ *, 
+       m__mb¡©e_t
+ *,
+
+237 cڡ \ 5*, cڡ \ 5*, 
+       m_IO_size_t
+);
+
+238 \12(*
+       m__codecvt_do_max_Ëngth
+è(\19
+       m_IO_codecvt
+ *);
+
+240 
+_IO_icÚv_t
+       m__cd_\9a
+;
+
+241 
+_IO_icÚv_t
+       m__cd_out
+;
+
+245 \19
+       s_IO_wide_d©a
+
+
+247 
+wch¬_t
+ *
+       m_IO_»ad_±r
+;
+
+248 
+wch¬_t
+ *
+       m_IO_»ad_\92d
+;
+
+249 
+wch¬_t
+ *
+       m_IO_»ad_ba£
+;
+
+250 
+wch¬_t
+ *
+       m_IO_wr\99e_ba£
+;
+
+251 
+wch¬_t
+ *
+       m_IO_wr\99e_±r
+;
+
+252 
+wch¬_t
+ *
+       m_IO_wr\99e_\92d
+;
+
+253 
+wch¬_t
+ *
+       m_IO_buf_ba£
+;
+
+254 
+wch¬_t
+ *
+       m_IO_buf_\92d
+;
+
+256 
+wch¬_t
+ *
+       m_IO_§ve_ba£
+;
+
+257 
+wch¬_t
+ *
+       m_IO_backup_ba£
+;
+
+259 
+wch¬_t
+ *
+       m_IO_§ve_\92d
+;
+
+261 
+__mb¡©e_t
+       m_IO_¡©e
+;
+
+262 
+__mb¡©e_t
+       m_IO_Ï¡_¡©e
+;
+
+263 \19
+_IO_codecvt
+       m_codecvt
+;
+
+265 
+wch¬_t
+       m_shÜtbuf
+[1];
+
+267 cڡ \19
+_IO_jump_t
+ *
+       m_wide_v\8f
+;
+
+271 \19
+       s_IO_FILE
+ {
+
+272 \12
+       m_æags
+;
+
+273 \ 1
+       #_IO_f\9ee_æags
+_æags
+
+
+       )
+
+277 \ 5
+       m_IO_»ad_±r
+;
+
+278 \ 5
+       m_IO_»ad_\92d
+;
+
+279 \ 5
+       m_IO_»ad_ba£
+;
+
+280 \ 5
+       m_IO_wr\99e_ba£
+;
+
+281 \ 5
+       m_IO_wr\99e_±r
+;
+
+282 \ 5
+       m_IO_wr\99e_\92d
+;
+
+283 \ 5
+       m_IO_buf_ba£
+;
+
+284 \ 5
+       m_IO_buf_\92d
+;
+
+286 \ 5*
+       m_IO_§ve_ba£
+;
+
+287 \ 5*
+       m_IO_backup_ba£
+;
+
+288 \ 5*
+       m_IO_§ve_\92d
+;
+
+290 \19
+_IO_m¬k\94
+ *
+       m_m¬k\94s
+;
+
+292 \19
+_IO_FILE
+ *
+       m_cha\9a
+;
+
+294 \12
+       m_f\9e\92o
+;
+
+296 \12
+       m_blksize
+;
+
+298 \12
+       m_æags2
+;
+
+300 
+_IO_off_t
+       m_Þd_off£t
+;
+
+302 \ 1
+       #__HAVE_COLUMN
+
+
+       )
+
+304 \1d\16
+       m_cur_cÞumn
+;
+
+305 sigÃd \ 5
+       m_v\8fbË_off£t
+;
+
+306 \ 5
+       m_shÜtbuf
+[1];
+
+310 
+_IO_lock_t
+ *
+       m_lock
+;
+
+311 #ifdeà
+_IO_USE_OLD_IO_FILE
+
+
+314 \19
+       s_IO_FILE_com¶\91e
+
+
+316 \19
+_IO_FILE
+       m_f\9ee
+;
+
+318 #ià
+def\9aed
+_G_IO_IO_FILE_VERSION
+ && _G_IO_IO_FILE_VERSION == 0x20001
+
+319 
+_IO_off64_t
+       m_off£t
+;
+
+320 #ià
+def\9aed
+_LIBC
+ || def\9aed 
+_GLIBCPP_USE_WCHAR_T
+
+
+322 \19
+_IO_codecvt
+ *
+       m_codecvt
+;
+
+323 \19
+_IO_wide_d©a
+ *
+       m_wide_d©a
+;
+
+324 \19
+_IO_FILE
+ *
+       m_ä\93»s_li¡
+;
+
+325 \1e*
+       m_䓻s_buf
+;
+
+326 
+size_t
+       m_䓻s_size
+;
+
+328 \1e*
+       m__·d1
+;
+
+329 \1e*
+       m__·d2
+;
+
+330 \1e*
+       m__·d3
+;
+
+331 \1e*
+       m__·d4
+;
+
+332 
+size_t
+       m__·d5
+;
+
+334 \12
+       m_mode
+;
+
+336 \ 5
+       m_unu£d2
+[15 * \17 (\12è- 4 * \17 (\1e*è- \17 (
+size_t
+)];
+
+340 #iâdeà
+__ýlu¥lus
+
+
+341 \e\19
+_IO_FILE
+       t_IO_FILE
+;
+
+344 \19
+       g_IO_FILE_¶us
+;
+
+346 \r\19
+_IO_FILE_¶us
+_IO_2_1_¡d\9a_
+;
+
+347 \r\19
+_IO_FILE_¶us
+_IO_2_1_¡dout_
+;
+
+348 \r\19
+_IO_FILE_¶us
+_IO_2_1_¡d\94r_
+;
+
+349 #iâdeà
+_LIBC
+
+
+350 \ 1
+       #_IO_¡d\9a
+ ((
+_IO_FILE
+*)(&
+_IO_2_1_¡d\9a_
+))
+
+       )
+
+351 \ 1
+       #_IO_¡dout
+ ((
+_IO_FILE
+*)(&
+_IO_2_1_¡dout_
+))
+
+       )
+
+352 \ 1
+       #_IO_¡d\94r
+ ((
+_IO_FILE
+*)(&
+_IO_2_1_¡d\94r_
+))
+
+       )
+
+354 \r
+_IO_FILE
+ *
+_IO_¡d\9a
\8cibu\8b_hidd\92
+;
+
+355 \r
+_IO_FILE
+ *
+_IO_¡dout
\8cibu\8b_hidd\92
+;
+
+356 \r
+_IO_FILE
+ *
+_IO_¡d\94r
\8cibu\8b_hidd\92
+;
+
+364 \e
+__ssize_t
+       t__io_»ad_â
+ (\1e*
+       t__cook\9b
+, \ 5*
+       t__buf
+, 
+       tsize_t
+       t__nby\8bs
+);
+
+372 \e
+__ssize_t
+       t__io_wr\99e_â
+ (\1e*
+       t__cook\9b
+, 
+       t__cڡ
\ 5*
+       t__buf
+,
+
+373 
+       tsize_t
+       t__n
+);
+
+381 \e\12
+       t__io_£ek_â
+ (\1e*
+       t__cook\9b
+, 
+       t_IO_off64_t
+ *
+       t__pos
+, \12
+       t__w
+);
+
+384 \e\12
+       t__io_þo£_â
+ (\1e*
+       t__cook\9b
+);
+
+387 #ifdeà
+_GNU_SOURCE
+
+
+389 \e
+__io_»ad_â
+       tcook\9b_»ad_funùiÚ_t
+;
+
+390 \e
+__io_wr\99e_â
+       tcook\9b_wr\99e_funùiÚ_t
+;
+
+391 \e
+__io_£ek_â
+       tcook\9b_£ek_funùiÚ_t
+;
+
+392 \e
+__io_þo£_â
+       tcook\9b_þo£_funùiÚ_t
+;
+
+397 
+__io_»ad_â
+ *
+       m»ad
+;
+
+398 
+__io_wr\99e_â
+ *
+       mwr\99e
+;
+
+399 
+__io_£ek_â
+ *
+       m£ek
+;
+
+400 
+__io_þo£_â
+ *
+       mþo£
+;
+
+401 } 
+       t_IO_cook\9b_io_funùiÚs_t
+;
+
+402 \e
+_IO_cook\9b_io_funùiÚs_t
+       tcook\9b_io_funùiÚs_t
+;
+
+404 \19
+       g_IO_cook\9b_f\9ee
+;
+
+407 \r\1e
+_IO_cook\9b_\9a\99
+ (\19
+_IO_cook\9b_f\9ee
+ *
+__cf\9ee
+, \12
+__»ad_wr\99e
+,
+
+408 \1e*
+__cook\9b
+, 
+_IO_cook\9b_io_funùiÚs_t
+__âs
+);
+
+412 #ifdeà
+__ýlu¥lus
+
+
+416 \r\12
+__und\94æow
+ (
+_IO_FILE
+ *);
+
+417 \r\12
+__uæow
+ (
+_IO_FILE
+ *);
+
+418 \r\12
+__ov\94æow
+ (
+_IO_FILE
+ *, \12);
+
+419 #ià
+def\9aed
+_LIBC
+ || def\9aed 
+_GLIBCPP_USE_WCHAR_T
+
+
+420 \r
+_IO_w\9at_t
+__wund\94æow
+ (
+_IO_FILE
+ *);
+
+421 \r
+_IO_w\9at_t
+__wuæow
+ (
+_IO_FILE
+ *);
+
+422 \r
+_IO_w\9at_t
+__wov\94æow
+ (
+_IO_FILE
+ *, _IO_wint_t);
+
+425 #ià 
+__GNUC__
+ >= 3
+
+426 \ 1
+       #_IO_BE
+(
+ex´
+, 
+»s
+       `__bu\9et\9a_ex³ù
+ (Óx´),\84es)
+
+       )
+
+428 \ 1
+       #_IO_BE
+(
+ex´
+, 
+»s
+èÓx´)
+
+       )
+
+431 \ 1
+       #_IO_g\91c_uÆocked
+(
+_å
+) \
+
+432 (
+       `_IO_BE
+ ((
+_å
+)->
+_IO_»ad_±r
+ >ð(_å)->
+_IO_»ad_\92d
+, 0) \
+
+433 ? 
+       `__uæow
+ (
+_å
+è: *(\1d\ 5*è(_å)->
+_IO_»ad_±r
+++)
+
+       )
+
+434 \ 1
+       #_IO_³ekc_uÆocked
+(
+_å
+) \
+
+435 (
+       `_IO_BE
+ ((
+_å
+)->
+_IO_»ad_±r
+ >ð(_å)->
+_IO_»ad_\92d
+, 0) \
+
+436 && 
+       `__und\94æow
+ (
+_å
+è=ð
+EOF
+ ? EOF \
+
+437 : *(\1d\ 5*è(
+_å
+)->
+_IO_»ad_±r
+)
+
+       )
+
+438 \ 1
+       #_IO_putc_uÆocked
+(
+_ch
+, 
+_å
+) \
+
+439 (
+       `_IO_BE
+ ((
+_å
+)->
+_IO_wr\99e_±r
+ >ð(_å)->
+_IO_wr\99e_\92d
+, 0) \
+
+440 ? 
+       `__ov\94æow
+ (
+_å
+, (\1d\ 5è(
+_ch
+)) \
+
+441 : (\1d\ 5è(*(
+_å
+)->
+_IO_wr\99e_±r
+++ = (
+_ch
+)))
+
+       )
+
+443 #ià
+def\9aed
+_LIBC
+ || def\9aed 
+_GLIBCPP_USE_WCHAR_T
+
+
+444 \ 1
+       #_IO_g\91wc_uÆocked
+(
+_å
+) \
+
+445 (
+       `_IO_BE
+ ((
+_å
+)->
+_wide_d©a
+ =ð
+NULL
+ \
+
+446 || ((
+_å
+)->
+_wide_d©a
+->
+_IO_»ad_±r
+ \
+
+447 >ð(
+_å
+)->
+_wide_d©a
+->
+_IO_»ad_\92d
+), 0) \
+
+448 ? 
+       `__wuæow
+ (
+_å
+è: (
+_IO_w\9at_t
+è*(_å)->
+_wide_d©a
+->
+_IO_»ad_±r
+++)
+
+       )
+
+449 \ 1
+       #_IO_putwc_uÆocked
+(
+_wch
+, 
+_å
+) \
+
+450 (
+       `_IO_BE
+ ((
+_å
+)->
+_wide_d©a
+ =ð
+NULL
+ \
+
+451 || ((
+_å
+)->
+_wide_d©a
+->
+_IO_wr\99e_±r
+ \
+
+452 >ð(
+_å
+)->
+_wide_d©a
+->
+_IO_wr\99e_\92d
+), 0) \
+
+453 ? 
+       `__wov\94æow
+ (
+_å
+, 
+_wch
+) \
+
+454 : (
+_IO_w\9at_t
+è(*(
+_å
+)->
+_wide_d©a
+->
+_IO_wr\99e_±r
+++ = (
+_wch
+)))
+
+       )
+
+457 \ 1
+       #_IO_ãof_uÆocked
+(
+__å
+è(((__å)->
+_æags
+ & 
+_IO_EOF_SEEN
+è!ð0)
+
+       )
+
+458 \ 1
+       #_IO_ã¼Ü_uÆocked
+(
+__å
+è(((__å)->
+_æags
+ & 
+_IO_ERR_SEEN
+è!ð0)
+
+       )
+
+460 \r\12
+_IO_g\91c
+ (
+_IO_FILE
+ *
+__å
+);
+
+461 \r\12
+_IO_putc
+ (\12
+__c
+, 
+_IO_FILE
+ *
+__å
+);
+
+462 \r\12
+_IO_ãof
+ (
+_IO_FILE
+ *
+__å
+__THROW
+;
+
+463 \r\12
+_IO_ã¼Ü
+ (
+_IO_FILE
+ *
+__å
+__THROW
+;
+
+465 \r\12
+_IO_³ekc_locked
+ (
+_IO_FILE
+ *
+__å
+);
+
+468 \ 1
+       #_IO_PENDING_OUTPUT_COUNT
+(
+_å
+) \
+
+469 ((
+_å
+)->
+_IO_wr\99e_±r
+ - (_å)->
+_IO_wr\99e_ba£
+)
+
+       )
+
+471 \r\1e
+_IO_æockf\9ee
+ (
+_IO_FILE
+ *è
+__THROW
+;
+
+472 \r\1e
+_IO_fuÆockf\9ee
+ (
+_IO_FILE
+ *è
+__THROW
+;
+
+473 \r\12
+_IO_árylockf\9ee
+ (
+_IO_FILE
+ *è
+__THROW
+;
+
+475 #ifdeà
+_IO_MTSAFE_IO
+
+
+476 \ 1
+       #_IO_³ekc
+(
+_å
+       `_IO_³ekc_locked
+ (_å)
+
+       )
+
+477 \ 1
+       #_IO_æockf\9ee
+(
+_å
+) \
+
+478 ià(((
+_å
+)->
+_æags
+ & 
+_IO_USER_LOCK
+è=ð0è
+       `_IO_æockf\9ee
+ (_å)
+
+       )
+
+479 \ 1
+       #_IO_fuÆockf\9ee
+(
+_å
+) \
+
+480 ià(((
+_å
+)->
+_æags
+ & 
+_IO_USER_LOCK
+è=ð0è
+       `_IO_fuÆockf\9ee
+ (_å)
+
+       )
+
+482 \ 1
+       #_IO_³ekc
+(
+_å
+       `_IO_³ekc_uÆocked
+ (_å)
+
+       )
+
+483 \ 1
+       #_IO_æockf\9ee
+(
+_å
+
+       )
+
+484 \ 1
+       #_IO_fuÆockf\9ee
+(
+_å
+
+       )
+
+485 \ 1
+       #_IO_árylockf\9ee
+(
+_å
+
+       )
+
+486 \ 1
+       #_IO_þ\97nup_»giÚ_¡¬t
+(
+_fù
+, 
+_å
+
+       )
+
+487 \ 1
+       #_IO_þ\97nup_»giÚ_\92d
+(
+_Do\99
+
+       )
+
+490 \r\12
+_IO_vfsÿnf
+ (
+_IO_FILE
+ * 
+__»¡riù
+, const \ 5* __restrict,
+
+491 
+_IO_va_li¡
+, \12*
+__»¡riù
+);
+
+492 \r\12
+_IO_vår\9atf
+ (
+_IO_FILE
+ *
+__»¡riù
+, const \ 5*__restrict,
+
+493 
+_IO_va_li¡
+);
+
+494 \r
+_IO_ssize_t
+_IO_·dn
+ (
+_IO_FILE
+ *, \12, _IO_ssize_t);
+
+495 \r
+_IO_size_t
+_IO_sg\91n
+ (
+_IO_FILE
+ *, \1e*, _IO_size_t);
+
+497 \r
+_IO_off64_t
+_IO_£ekoff
+ (
+_IO_FILE
+ *, _IO_off64_t, \12\12);
+
+498 \r
+_IO_off64_t
+_IO_£ekpos
+ (
+_IO_FILE
+ *, _IO_off64_t, \12);
+
+500 \r\1e
+_IO_ä\93_backup_¬\97
+ (
+_IO_FILE
+ *è
+__THROW
+;
+
+502 #ià
+def\9aed
+_LIBC
+ || def\9aed 
+_GLIBCPP_USE_WCHAR_T
+
+
+503 \r
+_IO_w\9at_t
+_IO_g\91wc
+ (
+_IO_FILE
+ *
+__å
+);
+
+504 \r
+_IO_w\9at_t
+_IO_putwc
+ (
+wch¬_t
+__wc
+, 
+_IO_FILE
+ *
+__å
+);
+
+505 \r\12
+_IO_fwide
+ (
+_IO_FILE
+ *
+__å
+, \12
+__mode
+__THROW
+;
+
+506 #ià
+__GNUC__
+ >= 2
+
+509 #ià
+def\9aed
+_LIBC
+ && def\9aed 
+SHARED
+
+
+510 \ 2
+       ~<shlib-com·t.h
+>
+
+511 #ià
+SHLIB_COMPAT
+ (
+libc
+, 
+GLIBC_2_0
+, 
+GLIBC_2_1
+)
+
+512 \ 1
+       #_IO_fwide_maybe_\9acom·tibË
+ \
+
+513 (
+       `__bu\9et\9a_ex³ù
+ (&
+_IO_¡d\9a_u£d
+ =ð
+NULL
+, 0))
+
+       )
+
+514 \rcڡ \12
+_IO_¡d\9a_u£d
+;
+
+515 
+w\97k_ex\8bº
+ (
+_IO_¡d\9a_u£d
+);
+
+518 #iâdeà
+_IO_fwide_maybe_\9acom·tibË
+
+
+519 \ 1
+       #_IO_fwide_maybe_\9acom·tibË
+ (0)
+
+       )
+
+523 \ 1
+       #_IO_fwide
+(
+__å
+, 
+__mode
+) \
+
+524 ({ \12
+__»suÉ
+ = (
+__mode
+); \
+
+525 ià(
+__»suÉ
+ < 0 && ! 
+_IO_fwide_maybe_\9acom·tibË
+) \
+
+527 ià((
+__å
+)->
+_mode
+ == 0) \
+
+529 (
+__å
+)->
+_mode
+ = -1; \
+
+530 
+__»suÉ
+ = (
+__å
+)->
+_mode
+; \
+
+532 \vià(
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__mode
+) && (__mode) == 0) \
+
+533 
+__»suÉ
+ = 
+_IO_fwide_maybe_\9acom·tibË
+ ? -1 : (
+__å
+)->
+_mode
+; \
+
+535 
+__»suÉ
+ = 
+       `_IO_fwide
+ (
+__å
+, __result); \
+
+536 
+__»suÉ
+; })
+
+       )
+
+539 \r\12
+_IO_vfwsÿnf
+ (
+_IO_FILE
+ * 
+__»¡riù
+, cڡ 
+wch¬_t
+ * __restrict,
+
+540 
+_IO_va_li¡
+, \12*
+__»¡riù
+);
+
+541 \r\12
+_IO_vfw´\9atf
+ (
+_IO_FILE
+ *
+__»¡riù
+, cڡ 
+wch¬_t
+ *__restrict,
+
+542 
+_IO_va_li¡
+);
+
+543 \r
+_IO_ssize_t
+_IO_w·dn
+ (
+_IO_FILE
+ *, 
+w\9at_t
+, _IO_ssize_t);
+
+544 \r\1e
+_IO_ä\93_wbackup_¬\97
+ (
+_IO_FILE
+ *è
+__THROW
+;
+
+547 #ifdeà
+__LDBL_COMPAT
+
+
+548 \ 2
+       ~<b\99s/libio-ldbl.h
+>
+
+551 #ifdeà
+__ýlu¥lus
+
+
+       @/usr/include/sched.h
+
+21 #iâdef 
+_SCHED_H
+
+
+22 \ 1
+       #_SCHED_H
+ 1
+
+       )
+
+24 \ 2
+       ~<ã©u»s.h
+>
+
+27 \ 2
+       ~<b\99s/ty³s.h
+>
+
+29 \ 1
+       #__Ãed_size_t
+
+
+       )
+
+30 \ 2
+       ~<¡ddef.h
+>
+
+32 \ 1
+       #__Ãed_time_t
+
+
+       )
+
+33 \ 1
+       #__Ãed_time¥ec
+
+
+       )
+
+34 \ 2
+       ~<time.h
+>
+
+36 #iâdeà
+__pid_t_def\9aed
+
+
+37 \e
+__pid_t
+       tpid_t
+;
+
+38 \ 1
+       #__pid_t_def\9aed
+
+
+       )
+
+43 \ 2
+       ~<b\99s/sched.h
+>
+
+45 \ 1
+       #sched_´iÜ\99y
+__sched_´iÜ\99y
+
+
+       )
+
+48 
+__BEGIN_DECLS
+
+
+51 \r\12
+       $sched_£\8d¬am
+ (
+__pid_t
+__pid
+, 
+__cڡ
\19
+sched_·¿m
+ *
+__·¿m
+)
+
+52 
+__THROW
+;
+
+55 \r\12
+       $sched_g\91·¿m
+ (
+__pid_t
+__pid
+, \19
+sched_·¿m
+ *
+__·¿m
+__THROW
+;
+
+58 \r\12
+       $sched_£tscheduËr
+ (
+__pid_t
+__pid
+, \12
+__pÞicy
+,
+
+59 
+__cڡ
\19
+sched_·¿m
+ *
+__·¿m
+__THROW
+;
+
+62 \r\12
+       $sched_g\91scheduËr
+ (
+__pid_t
+__pid
+__THROW
+;
+
+65 \r\12
+       $sched_y\9bld
+ (\1eè
+__THROW
+;
+
+68 \r\12
+       $sched_g\91_´iÜ\99y_max
+ (\12
+__®gÜ\99hm
+__THROW
+;
+
+71 \r\12
+       $sched_g\91_´iÜ\99y_m\9a
+ (\12
+__®gÜ\99hm
+__THROW
+;
+
+74 \r\12
+       $sched_¼_g\91_\9a\8brv®
+ (
+__pid_t
+__pid
+, \19
+time¥ec
+ *
+__t
+__THROW
+;
+
+77 #ifdeà
+__USE_GNU
+
+
+79 \ 1
+       #CPU_SETSIZE
+__CPU_SETSIZE
+
+
+       )
+
+80 \ 1
+       #CPU_SET
+(
+ýu
+, 
+ýu£\8d
+       `__CPU_SET_S
+ (ýu, \17 (
+ýu_£t_t
+), cpu£\8d)
+
+       )
+
+81 \ 1
+       #CPU_CLR
+(
+ýu
+, 
+ýu£\8d
+       `__CPU_CLR_S
+ (ýu, \17 (
+ýu_£t_t
+), cpu£\8d)
+
+       )
+
+82 \ 1
+       #CPU_ISSET
+(
+ýu
+, 
+ýu£\8d
+       `__CPU_ISSET_S
+ (ýu, \17 (
+ýu_£t_t
+), \
+
+83 
+ýu£\8d
+)
+
+       )
+
+84 \ 1
+       #CPU_ZERO
+(
+ýu£\8d
+       `__CPU_ZERO_S
+ (\17 (
+ýu_£t_t
+), cpu£\8d)
+
+       )
+
+85 \ 1
+       #CPU_COUNT
+(
+ýu£\8d
+       `__CPU_COUNT_S
+ (\17 (
+ýu_£t_t
+), cpu£\8d)
+
+       )
+
+87 \ 1
+       #CPU_SET_S
+(
+ýu
+, 
+£tsize
+, 
+ýu£\8d
+       `__CPU_SET_S
+ (ýu, s\91size, cpu£\8d)
+
+       )
+
+88 \ 1
+       #CPU_CLR_S
+(
+ýu
+, 
+£tsize
+, 
+ýu£\8d
+       `__CPU_CLR_S
+ (ýu, s\91size, cpu£\8d)
+
+       )
+
+89 \ 1
+       #CPU_ISSET_S
+(
+ýu
+, 
+£tsize
+, 
+ýu£\8d
+       `__CPU_ISSET_S
+ (cpu, setsize, \
+
+90 
+ýu£\8d
+)
+
+       )
+
+91 \ 1
+       #CPU_ZERO_S
+(
+£tsize
+, 
+ýu£\8d
+       `__CPU_ZERO_S
+ (£tsize, cpu£\8d)
+
+       )
+
+92 \ 1
+       #CPU_COUNT_S
+(
+£tsize
+, 
+ýu£\8d
+       `__CPU_COUNT_S
+ (£tsize, cpu£\8d)
+
+       )
+
+94 \ 1
+       #CPU_EQUAL
+(
+ýu£\8d1
+, 
+ýu£\8d2
+) \
+
+95 
+       `__CPU_EQUAL_S
+ (\17 (
+ýu_£t_t
+), 
+ýu£\8d1
+, 
+ýu£\8d2
+)
+
+       )
+
+96 \ 1
+       #CPU_EQUAL_S
+(
+£tsize
+, 
+ýu£\8d1
+, 
+ýu£\8d2
+) \
+
+97 
+       `__CPU_EQUAL_S
+ (
+£tsize
+, 
+ýu£\8d1
+, 
+ýu£\8d2
+)
+
+       )
+
+99 \ 1
+       #CPU_AND
+(
+de¡£t
+, 
+¤c£t1
+, 
+¤c£t2
+) \
+
+100 
+       `__CPU_OP_S
+ (\17 (
+ýu_£t_t
+), 
+de¡£t
+, 
+¤c£t1
+, 
+¤c£t2
+, &)
+
+       )
+
+101 \ 1
+       #CPU_OR
+(
+de¡£t
+, 
+¤c£t1
+, 
+¤c£t2
+) \
+
+102 
+       `__CPU_OP_S
+ (\17 (
+ýu_£t_t
+), 
+de¡£t
+, 
+¤c£t1
+, 
+¤c£t2
+, |)
+
+       )
+
+103 \ 1
+       #CPU_XOR
+(
+de¡£t
+, 
+¤c£t1
+, 
+¤c£t2
+) \
+
+104 
+       `__CPU_OP_S
+ (\17 (
+ýu_£t_t
+), 
+de¡£t
+, 
+¤c£t1
+, 
+¤c£t2
+, ^)
+
+       )
+
+105 \ 1
+       #CPU_AND_S
+(
+£tsize
+, 
+de¡£t
+, 
+¤c£t1
+, 
+¤c£t2
+) \
+
+106 
+       `__CPU_OP_S
+ (
+£tsize
+, 
+de¡£t
+, 
+¤c£t1
+, 
+¤c£t2
+, &)
+
+       )
+
+107 \ 1
+       #CPU_OR_S
+(
+£tsize
+, 
+de¡£t
+, 
+¤c£t1
+, 
+¤c£t2
+) \
+
+108 
+       `__CPU_OP_S
+ (
+£tsize
+, 
+de¡£t
+, 
+¤c£t1
+, 
+¤c£t2
+, |)
+
+       )
+
+109 \ 1
+       #CPU_XOR_S
+(
+£tsize
+, 
+de¡£t
+, 
+¤c£t1
+, 
+¤c£t2
+) \
+
+110 
+       `__CPU_OP_S
+ (
+£tsize
+, 
+de¡£t
+, 
+¤c£t1
+, 
+¤c£t2
+, ^)
+
+       )
+
+112 \ 1
+       #CPU_ALLOC_SIZE
+(
+couÁ
+       `__CPU_ALLOC_SIZE
+ (couÁ)
+
+       )
+
+113 \ 1
+       #CPU_ALLOC
+(
+couÁ
+       `__CPU_ALLOC
+ (couÁ)
+
+       )
+
+114 \ 1
+       #CPU_FREE
+(
+ýu£t
+       `__CPU_FREE
+ (ýu£t)
+
+       )
+
+118 \r\12
+       $sched_£\8fff\9a\99y
+ (
+__pid_t
+__pid
+, 
+size_t
+__ýu£tsize
+,
+
+119 
+__cڡ
+ýu_£t_t
+ *
+__ýu£t
+__THROW
+;
+
+122 \r\12
+       $sched_g\91aff\9a\99y
+ (
+__pid_t
+__pid
+, 
+size_t
+__ýu£tsize
+,
+
+123 
+ýu_£t_t
+ *
+__ýu£t
+__THROW
+;
+
+126 
+__END_DECLS
+
+
+       @/usr/include/stdint.h
+
+23 #iâdeà
+_STDINT_H
+
+
+24 \ 1
+       #_STDINT_H
+ 1
+
+       )
+
+26 \ 2
+       ~<ã©u»s.h
+>
+
+27 \ 2
+       ~<b\99s/wch¬.h
+>
+
+28 \ 2
+       ~<b\99s/wÜdsize.h
+>
+
+35 #iâdeà
+__\9at8_t_def\9aed
+
+
+36 \ 1
+       #__\9at8_t_def\9aed
+
+
+       )
+
+37 \esigÃd \ 5
+       t\9at8_t
+;
+
+38 \e\16\12
+       t\9at16_t
+;
+
+39 \e\12
+       t\9at32_t
+;
+
+40 #ià
+__WORDSIZE
+ == 64
+
+41 \e\13\12
+       t\9at64_t
+;
+
+43 
+__ex\8bnsiÚ__
+
+
+44 \e\13\13\12
+       t\9at64_t
+;
+
+49 \e\1d\ 5
+       tu\9at8_t
+;
+
+50 \e\1d\16\12
+       tu\9at16_t
+;
+
+51 #iâdeà
+__u\9at32_t_def\9aed
+
+
+52 \e\1d\12
+       tu\9at32_t
+;
+
+53 \ 1
+       #__u\9at32_t_def\9aed
+
+
+       )
+
+55 #ià
+__WORDSIZE
+ == 64
+
+56 \e\1d\13\12
+       tu\9at64_t
+;
+
+58 
+__ex\8bnsiÚ__
+
+
+59 \e\1d\13\13\12
+       tu\9at64_t
+;
+
+66 \esigÃd \ 5
+       t\9at_Ëa¡8_t
+;
+
+67 \e\16\12
+       t\9at_Ëa¡16_t
+;
+
+68 \e\12
+       t\9at_Ëa¡32_t
+;
+
+69 #ià
+__WORDSIZE
+ == 64
+
+70 \e\13\12
+       t\9at_Ëa¡64_t
+;
+
+72 
+__ex\8bnsiÚ__
+
+
+73 \e\13\13\12
+       t\9at_Ëa¡64_t
+;
+
+77 \e\1d\ 5
+       tu\9at_Ëa¡8_t
+;
+
+78 \e\1d\16\12
+       tu\9at_Ëa¡16_t
+;
+
+79 \e\1d\12
+       tu\9at_Ëa¡32_t
+;
+
+80 #ià
+__WORDSIZE
+ == 64
+
+81 \e\1d\13\12
+       tu\9at_Ëa¡64_t
+;
+
+83 
+__ex\8bnsiÚ__
+
+
+84 \e\1d\13\13\12
+       tu\9at_Ëa¡64_t
+;
+
+91 \esigÃd \ 5
+       t\9at_ç¡8_t
+;
+
+92 #ià
+__WORDSIZE
+ == 64
+
+93 \e\13\12
+       t\9at_ç¡16_t
+;
+
+94 \e\13\12
+       t\9at_ç¡32_t
+;
+
+95 \e\13\12
+       t\9at_ç¡64_t
+;
+
+97 \e\12
+       t\9at_ç¡16_t
+;
+
+98 \e\12
+       t\9at_ç¡32_t
+;
+
+99 
+__ex\8bnsiÚ__
+
+
+100 \e\13\13\12
+       t\9at_ç¡64_t
+;
+
+104 \e\1d\ 5
+       tu\9at_ç¡8_t
+;
+
+105 #ià
+__WORDSIZE
+ == 64
+
+106 \e\1d\13\12
+       tu\9at_ç¡16_t
+;
+
+107 \e\1d\13\12
+       tu\9at_ç¡32_t
+;
+
+108 \e\1d\13\12
+       tu\9at_ç¡64_t
+;
+
+110 \e\1d\12
+       tu\9at_ç¡16_t
+;
+
+111 \e\1d\12
+       tu\9at_ç¡32_t
+;
+
+112 
+__ex\8bnsiÚ__
+
+
+113 \e\1d\13\13\12
+       tu\9at_ç¡64_t
+;
+
+118 #ià
+__WORDSIZE
+ == 64
+
+119 #iâdeà
+__\9a\8d\8c_t_def\9aed
+
+
+120 \e\13\12
+       t\9a\8d\8c_t
+;
+
+121 \ 1
+       #__\9a\8d\8c_t_def\9aed
+
+
+       )
+
+123 \e\1d\13\12
+       tu\9a\8d\8c_t
+;
+
+125 #iâdeà
+__\9a\8d\8c_t_def\9aed
+
+
+126 \e\12
+       t\9a\8d\8c_t
+;
+
+127 \ 1
+       #__\9a\8d\8c_t_def\9aed
+
+
+       )
+
+129 \e\1d\12
+       tu\9a\8d\8c_t
+;
+
+134 #ià
+__WORDSIZE
+ == 64
+
+135 \e\13\12
+       t\9atmax_t
+;
+
+136 \e\1d\13\12
+       tu\9atmax_t
+;
+
+138 
+__ex\8bnsiÚ__
+
+
+139 \e\13\13\12
+       t\9atmax_t
+;
+
+140 
+__ex\8bnsiÚ__
+
+
+141 \e\1d\13\13\12
+       tu\9atmax_t
+;
+
+147 #ià!
+def\9aed
+__ýlu¥lus
+ || def\9aed 
+__STDC_LIMIT_MACROS
+
+
+149 #ià
+__WORDSIZE
+ == 64
+
+150 \ 1
+       #__INT64_C
+(
+c
+èø## 
+L
+
+
+       )
+
+151 \ 1
+       #__UINT64_C
+(
+c
+èø## 
+UL
+
+
+       )
+
+153 \ 1
+       #__INT64_C
+(
+c
+èø## 
+LL
+
+
+       )
+
+154 \ 1
+       #__UINT64_C
+(
+c
+èø## 
+ULL
+
+
+       )
+
+160 \ 1
+       #INT8_MIN
+ (-128)
+
+       )
+
+161 \ 1
+       #INT16_MIN
+ (-32767-1)
+
+       )
+
+162 \ 1
+       #INT32_MIN
+ (-2147483647-1)
+
+       )
+
+163 \ 1
+       #INT64_MIN
+ (-
+       `__INT64_C
+(9223372036854775807)-1)
+
+       )
+
+165 \ 1
+       #INT8_MAX
+ (127)
+
+       )
+
+166 \ 1
+       #INT16_MAX
+ (32767)
+
+       )
+
+167 \ 1
+       #INT32_MAX
+ (2147483647)
+
+       )
+
+168 \ 1
+       #INT64_MAX
+ (
+       `__INT64_C
+(9223372036854775807))
+
+       )
+
+171 \ 1
+       #UINT8_MAX
+ (255)
+
+       )
+
+172 \ 1
+       #UINT16_MAX
+ (65535)
+
+       )
+
+173 \ 1
+       #UINT32_MAX
+ (4294967295U)
+
+       )
+
+174 \ 1
+       #UINT64_MAX
+ (
+       `__UINT64_C
+(18446744073709551615))
+
+       )
+
+178 \ 1
+       #INT_LEAST8_MIN
+ (-128)
+
+       )
+
+179 \ 1
+       #INT_LEAST16_MIN
+ (-32767-1)
+
+       )
+
+180 \ 1
+       #INT_LEAST32_MIN
+ (-2147483647-1)
+
+       )
+
+181 \ 1
+       #INT_LEAST64_MIN
+ (-
+       `__INT64_C
+(9223372036854775807)-1)
+
+       )
+
+183 \ 1
+       #INT_LEAST8_MAX
+ (127)
+
+       )
+
+184 \ 1
+       #INT_LEAST16_MAX
+ (32767)
+
+       )
+
+185 \ 1
+       #INT_LEAST32_MAX
+ (2147483647)
+
+       )
+
+186 \ 1
+       #INT_LEAST64_MAX
+ (
+       `__INT64_C
+(9223372036854775807))
+
+       )
+
+189 \ 1
+       #UINT_LEAST8_MAX
+ (255)
+
+       )
+
+190 \ 1
+       #UINT_LEAST16_MAX
+ (65535)
+
+       )
+
+191 \ 1
+       #UINT_LEAST32_MAX
+ (4294967295U)
+
+       )
+
+192 \ 1
+       #UINT_LEAST64_MAX
+ (
+       `__UINT64_C
+(18446744073709551615))
+
+       )
+
+196 \ 1
+       #INT_FAST8_MIN
+ (-128)
+
+       )
+
+197 #ià
+__WORDSIZE
+ == 64
+
+198 \ 1
+       #INT_FAST16_MIN
+ (-9223372036854775807L-1)
+
+       )
+
+199 \ 1
+       #INT_FAST32_MIN
+ (-9223372036854775807L-1)
+
+       )
+
+201 \ 1
+       #INT_FAST16_MIN
+ (-2147483647-1)
+
+       )
+
+202 \ 1
+       #INT_FAST32_MIN
+ (-2147483647-1)
+
+       )
+
+204 \ 1
+       #INT_FAST64_MIN
+ (-
+       `__INT64_C
+(9223372036854775807)-1)
+
+       )
+
+206 \ 1
+       #INT_FAST8_MAX
+ (127)
+
+       )
+
+207 #ià
+__WORDSIZE
+ == 64
+
+208 \ 1
+       #INT_FAST16_MAX
+ (9223372036854775807L)
+
+       )
+
+209 \ 1
+       #INT_FAST32_MAX
+ (9223372036854775807L)
+
+       )
+
+211 \ 1
+       #INT_FAST16_MAX
+ (2147483647)
+
+       )
+
+212 \ 1
+       #INT_FAST32_MAX
+ (2147483647)
+
+       )
+
+214 \ 1
+       #INT_FAST64_MAX
+ (
+       `__INT64_C
+(9223372036854775807))
+
+       )
+
+217 \ 1
+       #UINT_FAST8_MAX
+ (255)
+
+       )
+
+218 #ià
+__WORDSIZE
+ == 64
+
+219 \ 1
+       #UINT_FAST16_MAX
+ (18446744073709551615UL)
+
+       )
+
+220 \ 1
+       #UINT_FAST32_MAX
+ (18446744073709551615UL)
+
+       )
+
+222 \ 1
+       #UINT_FAST16_MAX
+ (4294967295U)
+
+       )
+
+223 \ 1
+       #UINT_FAST32_MAX
+ (4294967295U)
+
+       )
+
+225 \ 1
+       #UINT_FAST64_MAX
+ (
+       `__UINT64_C
+(18446744073709551615))
+
+       )
+
+229 #ià
+__WORDSIZE
+ == 64
+
+230 \ 1
+       #INTPTR_MIN
+ (-9223372036854775807L-1)
+
+       )
+
+231 \ 1
+       #INTPTR_MAX
+ (9223372036854775807L)
+
+       )
+
+232 \ 1
+       #UINTPTR_MAX
+ (18446744073709551615UL)
+
+       )
+
+234 \ 1
+       #INTPTR_MIN
+ (-2147483647-1)
+
+       )
+
+235 \ 1
+       #INTPTR_MAX
+ (2147483647)
+
+       )
+
+236 \ 1
+       #UINTPTR_MAX
+ (4294967295U)
+
+       )
+
+241 \ 1
+       #INTMAX_MIN
+ (-
+       `__INT64_C
+(9223372036854775807)-1)
+
+       )
+
+243 \ 1
+       #INTMAX_MAX
+ (
+       `__INT64_C
+(9223372036854775807))
+
+       )
+
+246 \ 1
+       #UINTMAX_MAX
+ (
+       `__UINT64_C
+(18446744073709551615))
+
+       )
+
+252 #ià
+__WORDSIZE
+ == 64
+
+253 \ 1
+       #PTRDIFF_MIN
+ (-9223372036854775807L-1)
+
+       )
+
+254 \ 1
+       #PTRDIFF_MAX
+ (9223372036854775807L)
+
+       )
+
+256 \ 1
+       #PTRDIFF_MIN
+ (-2147483647-1)
+
+       )
+
+257 \ 1
+       #PTRDIFF_MAX
+ (2147483647)
+
+       )
+
+261 \ 1
+       #SIG_ATOMIC_MIN
+ (-2147483647-1)
+
+       )
+
+262 \ 1
+       #SIG_ATOMIC_MAX
+ (2147483647)
+
+       )
+
+265 #ià
+__WORDSIZE
+ == 64
+
+266 \ 1
+       #SIZE_MAX
+ (18446744073709551615UL)
+
+       )
+
+268 \ 1
+       #SIZE_MAX
+ (4294967295U)
+
+       )
+
+272 #iâdeà
+WCHAR_MIN
+
+
+274 \ 1
+       #WCHAR_MIN
+__WCHAR_MIN
+
+
+       )
+
+275 \ 1
+       #WCHAR_MAX
+__WCHAR_MAX
+
+
+       )
+
+279 \ 1
+       #WINT_MIN
+ (0u)
+
+       )
+
+280 \ 1
+       #WINT_MAX
+ (4294967295u)
+
+       )
+
+287 #ià!
+def\9aed
+__ýlu¥lus
+ || def\9aed 
+__STDC_CONSTANT_MACROS
+
+
+290 \ 1
+       #INT8_C
+(
+c
+       )
+c
+
+291 \ 1
+       #INT16_C
+(
+c
+       )
+c
+
+292 \ 1
+       #INT32_C
+(
+c
+       )
+c
+
+293 #ià
+__WORDSIZE
+ == 64
+
+294 \ 1
+       #INT64_C
+(
+c
+èø## 
+L
+
+
+       )
+
+296 \ 1
+       #INT64_C
+(
+c
+èø## 
+LL
+
+
+       )
+
+300 \ 1
+       #UINT8_C
+(
+c
+       )
+c
+
+301 \ 1
+       #UINT16_C
+(
+c
+       )
+c
+
+302 \ 1
+       #UINT32_C
+(
+c
+èø## 
+U
+
+
+       )
+
+303 #ià
+__WORDSIZE
+ == 64
+
+304 \ 1
+       #UINT64_C
+(
+c
+èø## 
+UL
+
+
+       )
+
+306 \ 1
+       #UINT64_C
+(
+c
+èø## 
+ULL
+
+
+       )
+
+310 #ià
+__WORDSIZE
+ == 64
+
+311 \ 1
+       #INTMAX_C
+(
+c
+èø## 
+L
+
+
+       )
+
+312 \ 1
+       #UINTMAX_C
+(
+c
+èø## 
+UL
+
+
+       )
+
+314 \ 1
+       #INTMAX_C
+(
+c
+èø## 
+LL
+
+
+       )
+
+315 \ 1
+       #UINTMAX_C
+(
+c
+èø## 
+ULL
+
+
+       )
+
+       @/usr/include/sys/cdefs.h
+
+20 #iâdef 
+_SYS_CDEFS_H
+
+
+21 \ 1
+       #_SYS_CDEFS_H
+ 1
+
+       )
+
+24 #iâdeà
+_FEATURES_H
+
+
+25 \ 2
+       ~<ã©u»s.h
+>
+
+31 #ià
+def\9aed
+__GNUC__
+ && !def\9aed 
+__STDC__
+
+
+36 #undeà
+__P
+
+
+37 #undeà
+__PMT
+
+
+39 #ifdeà
+__GNUC__
+
+
+46 #ià!
+def\9aed
+__ýlu¥lus
+ && 
+__GNUC_PREREQ
+ (3, 3)
+
+47 \ 1
+       #__THROW
+       `__©\8cibu\8b__
+ ((
+__nÙhrow__
+))
+
+       )
+
+48 \ 1
+       #__NTH
+(
+fù
+       `__©\8cibu\8b__
+ ((
+__nÙhrow__
+)è
+       )
+fct
+
+50 #ià
+def\9aed
+__ýlu¥lus
+ && 
+__GNUC_PREREQ
+ (2,8)
+
+51 \ 1
+       #__THROW
+       `throw
+ ()
+
+       )
+
+52 \ 1
+       #__NTH
+(
+fù
+èfù 
+       `throw
+ ()
+
+       )
+
+54 \ 1
+       #__THROW
+
+
+       )
+
+55 \ 1
+       #__NTH
+(
+fù
+       )
+fct
+
+61 \ 1
+       #__\9al\9ae
+
+
+       )
+
+63 \ 1
+       #__THROW
+
+
+       )
+
+64 \ 1
+       #__NTH
+(
+fù
+       )
+fct
+
+66 \ 1
+       #__cڡ
+ cڡ
+
+       )
+
+67 \ 1
+       #__sigÃd
+ sigÃd
+
+       )
+
+68 \ 1
+       #__vÞ©\9ee
+ vÞ©\9ee
+
+       )
+
+74 \ 1
+       #__P
+(
+¬gs
+       )
+args
+
+75 \ 1
+       #__PMT
+(
+¬gs
+       )
+args
+
+80 \ 1
+       #__CONCAT
+(
+x
+,
+y
+èx ## 
+       )
+y
+
+81 \ 1
+       #__STRING
+(
+x
+è#x
+
+       )
+
+84 \ 1
+       #__±r_t
\1e*
+
+       )
+
+85 \ 1
+       #__lÚg_doubË_t
\13\b
+
+       )
+
+89 #ifdef 
+__ýlu¥lus
+
+
+90 \ 1
+       #__BEGIN_DECLS
\r"C" {
+
+       )
+
+91 \ 1
+       #__END_DECLS
+ }
+
+       )
+
+93 \ 1
+       #__BEGIN_DECLS
+
+
+       )
+
+94 \ 1
+       #__END_DECLS
+
+
+       )
+
+103 #ià
+def\9aed
+__ýlu¥lus
+ && def\9aed 
+_GLIBCPP_USE_NAMESPACES
+
+
+104 \ 1
+       #__BEGIN_NAMESPACE_STD
+Çme¥aû
+¡d
+ {
+
+       )
+
+105 \ 1
+       #__END_NAMESPACE_STD
+ }
+
+       )
+
+106 \ 1
+       #__USING_NAMESPACE_STD
+(
+Çme
+us\9ag
+¡d
+::Çme;
+
+       )
+
+107 \ 1
+       #__BEGIN_NAMESPACE_C99
+Çme¥aû
+__c99
+ {
+
+       )
+
+108 \ 1
+       #__END_NAMESPACE_C99
+ }
+
+       )
+
+109 \ 1
+       #__USING_NAMESPACE_C99
+(
+Çme
+us\9ag
+__c99
+::Çme;
+
+       )
+
+114 \ 1
+       #__BEGIN_NAMESPACE_STD
+
+
+       )
+
+115 \ 1
+       #__END_NAMESPACE_STD
+
+
+       )
+
+116 \ 1
+       #__USING_NAMESPACE_STD
+(
+Çme
+)
+
+       )
+
+117 \ 1
+       #__BEGIN_NAMESPACE_C99
+
+
+       )
+
+118 \ 1
+       #__END_NAMESPACE_C99
+
+
+       )
+
+119 \ 1
+       #__USING_NAMESPACE_C99
+(
+Çme
+)
+
+       )
+
+124 #iâdeà
+__BOUNDED_POINTERS__
+
+
+125 \ 1
+       #__bounded
+
+
+       )
+
+126 \ 1
+       #__unbounded
+
+
+       )
+
+127 \ 1
+       #__±rv®ue
+
+
+       )
+
+132 \ 1
+       #__bos
+(
+±r
+       `__bu\9et\9a_objeù_size
+ (±r, 
+__USE_FORTIFY_LEVEL
+ > 1)
+
+       )
+
+133 \ 1
+       #__bos0
+(
+±r
+       `__bu\9et\9a_objeù_size
+ (±r, 0)
+
+       )
+
+135 #ià
+__GNUC_PREREQ
+ (4,3)
+
+136 \ 1
+       #__w¬ndeþ
+(
+Çme
+, 
+msg
+) \
+
+137 \r\1e
+       `Çme
+ (\1eè
+       `__©\8cibu\8b__
+((
+       `__w¬n\9ag__
+ (
+msg
+)))
+
+       )
+
+138 \ 1
+       #__w¬Ç\89r
+(
+msg
+       `__©\8cibu\8b__
+((
+       `__w¬n\9ag__
+ (msg)))
+
+       )
+
+139 \ 1
+       #__\94rÜdeþ
+(
+Çme
+, 
+msg
+) \
+
+140 \r\1e
+       `Çme
+ (\1eè
+       `__©\8cibu\8b__
+((
+       `__\94rÜ__
+ (
+msg
+)))
+
+       )
+
+142 \ 1
+       #__w¬ndeþ
+(
+Çme
+, 
+msg
\r\1e
+       `Çme
+ (\1e)
+
+       )
+
+143 \ 1
+       #__w¬Ç\89r
+(
+msg
+)
+
+       )
+
+144 \ 1
+       #__\94rÜdeþ
+(
+Çme
+, 
+msg
\r\1e
+       `Çme
+ (\1e)
+
+       )
+
+148 #ià
+__GNUC_PREREQ
+ (2,97)
+
+150 \ 1
+       #__æex¬r
+ []
+
+       )
+
+152 #ifdeà
+__GNUC__
+
+
+153 \ 1
+       #__æex¬r
+ [0]
+
+       )
+
+155 #ià
+def\9aed
+__STDC_VERSION__
+ && __STDC_VERSION__ >= 199901L
+
+156 \ 1
+       #__æex¬r
+ []
+
+       )
+
+159 \ 1
+       #__æex¬r
+ [1]
+
+       )
+
+175 #ià
+def\9aed
+__GNUC__
+ && __GNUC__ >= 2
+
+177 \ 1
+       #__REDIRECT
+(
+Çme
+, 
+´Ùo
+, 
\9fs
+èÇm\90´ÙØ
+       `__asm__
+ (
+       `__ASMNAME
+ (#®\9fs))
+
+       )
+
+178 #ifdeà
+__ýlu¥lus
+
+
+179 \ 1
+       #__REDIRECT_NTH
+(
+Çme
+, 
+´Ùo
+, 
\9fs
+) \
+
+180 
+Çme
+´Ùo
+__THROW
+       `__asm__
+ (
+       `__ASMNAME
+ (#®\9fs))
+
+       )
+
+182 \ 1
+       #__REDIRECT_NTH
+(
+Çme
+, 
+´Ùo
+, 
\9fs
+) \
+
+183 
+Çme
+´Ùo
+       `__asm__
+ (
+       `__ASMNAME
+ (#®\9fs)è
+__THROW
+
+
+       )
+
+185 \ 1
+       #__ASMNAME
+(
+úame
+       `__ASMNAME2
+ (
+__USER_LABEL_PREFIX__
+, cÇme)
+
+       )
+
+186 \ 1
+       #__ASMNAME2
+(
+´efix
+, 
+úame
+       `__STRING
+ (´efixè
+       )
+cname
+
+199 #ià!
+def\9aed
+__GNUC__
+ || __GNUC__ < 2
+
+200 \ 1
+       #__©\8cibu\8b__
+(
+xyz
+
+       )
+
+206 #ià
+__GNUC_PREREQ
+ (2,96)
+
+207 \ 1
+       #__©\8cibu\8b_m®loc__
+       `__©\8cibu\8b__
+ ((
+__m®loc__
+))
+
+       )
+
+209 \ 1
+       #__©\8cibu\8b_m®loc__
+
+
+       )
+
+215 #ià
+__GNUC_PREREQ
+ (2,96)
+
+216 \ 1
+       #__©\8cibu\8b_pu»__
+       `__©\8cibu\8b__
+ ((
+__pu»__
+))
+
+       )
+
+218 \ 1
+       #__©\8cibu\8b_pu»__
+
+
+       )
+
+224 #ià
+__GNUC_PREREQ
+ (3,1)
+
+225 \ 1
+       #__©\8cibu\8b_u£d__
+       `__©\8cibu\8b__
+ ((
+__u£d__
+))
+
+       )
+
+226 \ 1
+       #__©\8cibu\8b_no\9al\9ae__
+       `__©\8cibu\8b__
+ ((
+__no\9al\9ae__
+))
+
+       )
+
+228 \ 1
+       #__©\8cibu\8b_u£d__
+       `__©\8cibu\8b__
+ ((
+__unu£d__
+))
+
+       )
+
+229 \ 1
+       #__©\8cibu\8b_no\9al\9ae__
+
+
+       )
+
+233 #ià
+__GNUC_PREREQ
+ (3,2)
+
+234 \ 1
+       #__©\8cibu\8b_d\95»ÿ\8bd__
+       `__©\8cibu\8b__
+ ((
+__d\95»ÿ\8bd__
+))
+
+       )
+
+236 \ 1
+       #__©\8cibu\8b_d\95»ÿ\8bd__
+
+
+       )
+
+245 #ià
+__GNUC_PREREQ
+ (2,8)
+
+246 \ 1
+       #__©\8cibu\8b_fÜm©_¬g__
+(
+x
+       `__©\8cibu\8b__
+ ((
+       `__fÜm©_¬g__
+ (x)))
+
+       )
+
+248 \ 1
+       #__©\8cibu\8b_fÜm©_¬g__
+(
+x
+
+       )
+
+255 #ià
+__GNUC_PREREQ
+ (2,97)
+
+256 \ 1
+       #__©\8cibu\8b_fÜm©_¡rfmÚ__
+(
+a
+,
+b
+) \
+
+257 
+       `__©\8cibu\8b__
+ ((
+       `__fÜm©__
+ (
+__¡rfmÚ__
+, 
+a
+, 
+b
+)))
+
+       )
+
+259 \ 1
+       #__©\8cibu\8b_fÜm©_¡rfmÚ__
+(
+a
+,
+b
+
+       )
+
+264 #ià
+__GNUC_PREREQ
+ (3,3)
+
+265 \ 1
+       #__nÚnuÎ
+(
+·¿ms
+       `__©\8cibu\8b__
+ ((
+__nÚnuÎ__
+\85¬ams))
+
+       )
+
+267 \ 1
+       #__nÚnuÎ
+(
+·¿ms
+)
+
+       )
+
+272 #ià
+__GNUC_PREREQ
+ (3,4)
+
+273 \ 1
+       #__©\8cibu\8b_w¬n_unu£d_»suÉ__
+ \
+
+274 
+       `__©\8cibu\8b__
+ ((
+__w¬n_unu£d_»suÉ__
+))
+
+       )
+
+275 #ià
+__USE_FORTIFY_LEVEL
+ > 0
+
+276 \ 1
+       #__wur
+__©\8cibu\8b_w¬n_unu£d_»suÉ__
+
+
+       )
+
+279 \ 1
+       #__©\8cibu\8b_w¬n_unu£d_»suÉ__
+
+
+       )
+
+281 #iâdeà
+__wur
+
+
+282 \ 1
+       #__wur
+
+
+       )
+
+286 #ià
+__GNUC_PREREQ
+ (3,2)
+
+287 \ 1
+       #__®ways_\9al\9ae
+__\9al\9ae
+       `__©\8cibu\8b__
+ ((
+__®ways_\9al\9ae__
+))
+
+       )
+
+289 \ 1
+       #__®ways_\9al\9ae
+__\9al\9ae
+
+
+       )
+
+294 #ià!
+def\9aed
+__ýlu¥lus
+ || 
+__GNUC_PREREQ
+ (4,3)
+
+295 #ià
+def\9aed
+__GNUC_STDC_INLINE__
+ || def\9aed 
+__ýlu¥lus
+
+
+296 \ 1
+       #__ex\8bº_\9al\9ae
\r
+__\9al\9ae
+       `__©\8cibu\8b__
+ ((
+__gnu_\9al\9ae__
+))
+
+       )
+
+297 #ià
+__GNUC_PREREQ
+ (4,3)
+
+298 \ 1
+       #__ex\8bº_®ways_\9al\9ae
+ \
+
+299 \r
+__®ways_\9al\9ae
+       `__©\8cibu\8b__
+ ((
+__gnu_\9al\9ae__
+, 
+__¬tific\9fl__
+))
+
+       )
+
+301 \ 1
+       #__ex\8bº_®ways_\9al\9ae
+ \
+
+302 \r
+__®ways_\9al\9ae
+       `__©\8cibu\8b__
+ ((
+__gnu_\9al\9ae__
+))
+
+       )
+
+305 \ 1
+       #__ex\8bº_\9al\9ae
\r
+__\9al\9ae
+
+
+       )
+
+306 #ià
+__GNUC_PREREQ
+ (4,3)
+
+307 \ 1
+       #__ex\8bº_®ways_\9al\9ae
+ \
+
+308 \r
+__®ways_\9al\9ae
+       `__©\8cibu\8b__
+ ((
+__¬tific\9fl__
+))
+
+       )
+
+310 \ 1
+       #__ex\8bº_®ways_\9al\9ae
\r
+__®ways_\9al\9ae
+
+
+       )
+
+317 #ià
+__GNUC_PREREQ
+ (4,3)
+
+318 \ 1
+       #__va_¬g_·ck
+(è
+       `__bu\9et\9a_va_¬g_·ck
+ ()
+
+       )
+
+319 \ 1
+       #__va_¬g_·ck_Ën
+(è
+       `__bu\9et\9a_va_¬g_·ck_Ën
+ ()
+
+       )
+
+326 #ià!
+__GNUC_PREREQ
+ (2,8)
+
+327 \ 1
+       #__ex\8bnsiÚ__
+
+
+       )
+
+331 #ià!
+__GNUC_PREREQ
+ (2,92)
+
+332 \ 1
+       #__»¡riù
+
+
+       )
+
+338 #ià
+__GNUC_PREREQ
+ (3,1è&& !
+def\9aed
+__GNUG__
+
+
+339 \ 1
+       #__»¡riù_¬r
+__»¡riù
+
+
+       )
+
+341 #ifdeà
+__GNUC__
+
+
+342 \ 1
+       #__»¡riù_¬r
+
+
+       )
+
+344 #ià
+def\9aed
+__STDC_VERSION__
+ && __STDC_VERSION__ >= 199901L
+
+345 \ 1
+       #__»¡riù_¬r
+»¡riù
+
+
+       )
+
+348 \ 1
+       #__»¡riù_¬r
+
+
+       )
+
+353 \ 2
+       ~<b\99s/wÜdsize.h
+>
+
+355 #ià
+def\9aed
+__LONG_DOUBLE_MATH_OPTIONAL
+ && def\9aed 
+__NO_LONG_DOUBLE_MATH
+
+
+356 \ 1
+       #__LDBL_COMPAT
+ 1
+
+       )
+
+357 #ifdeà
+__REDIRECT
+
+
+358 \ 1
+       #__LDBL_REDIR1
+(
+Çme
+, 
+´Ùo
+, 
\9fs
+       `__REDIRECT
+ (Çme,\85rÙo,\87l\9fs)
+
+       )
+
+359 \ 1
+       #__LDBL_REDIR
+(
+Çme
+, 
+´Ùo
+) \
+
+360 
+       `__LDBL_REDIR1
+ (
+Çme
+, 
+´Ùo
+, 
+__Ædbl_
+##Çme)
+
+       )
+
+361 \ 1
+       #__LDBL_REDIR1_NTH
+(
+Çme
+, 
+´Ùo
+, 
\9fs
+       `__REDIRECT_NTH
+ (Çme,\85rÙo,\87l\9fs)
+
+       )
+
+362 \ 1
+       #__LDBL_REDIR_NTH
+(
+Çme
+, 
+´Ùo
+) \
+
+363 
+       `__LDBL_REDIR1_NTH
+ (
+Çme
+, 
+´Ùo
+, 
+__Ædbl_
+##Çme)
+
+       )
+
+364 \ 1
+       #__LDBL_REDIR1_DECL
+(
+Çme
+, 
\9fs
+) \
+
+365 \r
+       `__ty³of
+ (
+Çme
+èÇm\90
+       `__asm
+ (
+       `__ASMNAME
+ (#®\9fs));
+
+       )
+
+366 \ 1
+       #__LDBL_REDIR_DECL
+(
+Çme
+) \
+
+367 \r
+       `__ty³of
+ (
+Çme
+èÇm\90
+       `__asm
+ (
+       `__ASMNAME
+ ("__Ædbl_" #Çme));
+
+       )
+
+368 \ 1
+       #__REDIRECT_LDBL
+(
+Çme
+, 
+´Ùo
+, 
\9fs
+) \
+
+369 
+       `__LDBL_REDIR1
+ (
+Çme
+, 
+´Ùo
+, 
+__Ædbl_
+##
\9fs
+)
+
+       )
+
+370 \ 1
+       #__REDIRECT_NTH_LDBL
+(
+Çme
+, 
+´Ùo
+, 
\9fs
+) \
+
+371 
+       `__LDBL_REDIR1_NTH
+ (
+Çme
+, 
+´Ùo
+, 
+__Ædbl_
+##
\9fs
+)
+
+       )
+
+374 #ià!
+def\9aed
+__LDBL_COMPAT
+ || !def\9aed 
+__REDIRECT
+
+
+375 \ 1
+       #__LDBL_REDIR1
+(
+Çme
+, 
+´Ùo
+, 
\9fs
+èÇm\90
+       )
+proto
+
+376 \ 1
+       #__LDBL_REDIR
+(
+Çme
+, 
+´Ùo
+èÇm\90
+       )
+proto
+
+377 \ 1
+       #__LDBL_REDIR1_NTH
+(
+Çme
+, 
+´Ùo
+, 
\9fs
+èÇm\90´ÙØ
+__THROW
+
+
+       )
+
+378 \ 1
+       #__LDBL_REDIR_NTH
+(
+Çme
+, 
+´Ùo
+èÇm\90´ÙØ
+__THROW
+
+
+       )
+
+379 \ 1
+       #__LDBL_REDIR_DECL
+(
+Çme
+)
+
+       )
+
+380 #ifdeà
+__REDIRECT
+
+
+381 \ 1
+       #__REDIRECT_LDBL
+(
+Çme
+, 
+´Ùo
+, 
\9fs
+       `__REDIRECT
+ (Çme,\85rÙo,\87l\9fs)
+
+       )
+
+382 \ 1
+       #__REDIRECT_NTH_LDBL
+(
+Çme
+, 
+´Ùo
+, 
\9fs
+) \
+
+383 
+       `__REDIRECT_NTH
+ (
+Çme
+, 
+´Ùo
+, 
\9fs
+)
+
+       )
+
+       @/usr/include/sys/sysmacros.h
+
+21 #iâdeà
+_SYS_SYSMACROS_H
+
+
+22 \ 1
+       #_SYS_SYSMACROS_H
+ 1
+
+       )
+
+24 \ 2
+       ~<ã©u»s.h
+>
+
+29 #ifdeà
+__GLIBC_HAVE_LONG_LONG
+
+
+30 
+__ex\8bnsiÚ__
+
+
+31 \r\1d\12
+       $gnu_dev_majÜ
+ (\1d\13\13\12
+__dev
+)
+
+32 
+__THROW
+;
+
+33 
+__ex\8bnsiÚ__
+
+
+34 \r\1d\12
+       $gnu_dev_m\9aÜ
+ (\1d\13\13\12
+__dev
+)
+
+35 
+__THROW
+;
+
+36 
+__ex\8bnsiÚ__
+
+
+37 \r\1d\13\13\12
+       $gnu_dev_makedev
+ (\1d\12
+__majÜ
+,
+
+38 \1d\12
+__m\9aÜ
+)
+
+39 
+__THROW
+;
+
+41 #ià
+def\9aed
+__GNUC__
+ && __GNUC__ >ð2 && def\9aed 
+__USE_EXTERN_INLINES
+
+
+42 
+__ex\8bnsiÚ__
+__ex\8bº_\9al\9ae
\1d\12
+
+43 
+       `__NTH
+ (
+       $gnu_dev_majÜ
+ (\1d\13\13\12
+__dev
+))
+
+45 \15 ((
+__dev
+ >> 8) & 0xfff) | ((\1d\12) (__dev >> 32) & ~0xfff);
+
+46 
+       }
+}
+
+48 
+__ex\8bnsiÚ__
+__ex\8bº_\9al\9ae
\1d\12
+
+49 
+__NTH
+ (
+       $gnu_dev_m\9aÜ
+ (\1d\13\13\12
+__dev
+))
+
+51 \15 (
+__dev
+ & 0xff) | ((\1d\12) (__dev >> 12) & ~0xff);
+
+52 
+       }
+}
+
+54 
+__ex\8bnsiÚ__
+__ex\8bº_\9al\9ae
\1d\13\13\12
+
+55 
+__NTH
+ (
+       $gnu_dev_makedev
+ (\1d\12
+__majÜ
+, \1d\12
+__m\9aÜ
+))
+
+57 \15 ((
+__m\9aÜ
+ & 0xffè| ((
+__majÜ
+ & 0xfff) << 8)
+
+58 | (((\1d\13\13\12è(
+__m\9aÜ
+ & ~0xff)) << 12)
+
+59 | (((\1d\13\13\12è(
+__majÜ
+ & ~0xfff)) << 32));
+
+60 
+       }
+}
+
+65 \ 1
+       #majÜ
+(
+dev
+       `gnu_dev_majÜ
+ (dev)
+
+       )
+
+66 \ 1
+       #m\9aÜ
+(
+dev
+       `gnu_dev_m\9aÜ
+ (dev)
+
+       )
+
+67 \ 1
+       #makedev
+(
+maj
+, 
+m\9a
+       `gnu_dev_makedev
+ (maj, m\9a)
+
+       )
+
+       @/usr/include/sys/ttydefaults.h
+
+40 #iâdeà
+_SYS_TTYDEFAULTS_H_
+
+
+41 \ 1
+       #_SYS_TTYDEFAULTS_H_
+
+
+       )
+
+46 \ 1
+       #TTYDEF_IFLAG
+ (
+BRKINT
+ | 
+ISTRIP
+ | 
+ICRNL
+ | 
+IMAXBEL
+ | 
+IXON
+ | 
+IXANY
+)
+
+       )
+
+47 \ 1
+       #TTYDEF_OFLAG
+ (
+OPOST
+ | 
+ONLCR
+ | 
+XTABS
+)
+
+       )
+
+48 \ 1
+       #TTYDEF_LFLAG
+ (
+ECHO
+ | 
+ICANON
+ | 
+ISIG
+ | 
+IEXTEN
+ | 
+ECHOE
+|
+ECHOKE
+|
+ECHOCTL
+)
+
+       )
+
+49 \ 1
+       #TTYDEF_CFLAG
+ (
+CREAD
+ | 
+CS7
+ | 
+PARENB
+ | 
+HUPCL
+)
+
+       )
+
+50 \ 1
+       #TTYDEF_SPEED
+ (
+B9600
+)
+
+       )
+
+55 \ 1
+       #CTRL
+(
+x
+è(x&037)
+
+       )
+
+56 \ 1
+       #CEOF
+       `CTRL
+('d')
+
+       )
+
+57 #ifdeà
+_POSIX_VDISABLE
+
+
+58 \ 1
+       #CEOL
+_POSIX_VDISABLE
+
+
+       )
+
+60 \ 1
+       #CEOL
+ '\0'
+
+       )
+
+62 \ 1
+       #CERASE
+ 0177
+
+       )
+
+63 \ 1
+       #CINTR
+       `CTRL
+('c')
+
+       )
+
+64 #ifdeà
+_POSIX_VDISABLE
+
+
+65 \ 1
+       #CSTATUS
+_POSIX_VDISABLE
+
+
+       )
+
+67 \ 1
+       #CSTATUS
+ '\0'
+
+       )
+
+69 \ 1
+       #CKILL
+       `CTRL
+('u')
+
+       )
+
+70 \ 1
+       #CMIN
+ 1
+
+       )
+
+71 \ 1
+       #CQUIT
+ 034
+
+       )
+
+72 \ 1
+       #CSUSP
+       `CTRL
+('z')
+
+       )
+
+73 \ 1
+       #CTIME
+ 0
+
+       )
+
+74 \ 1
+       #CDSUSP
+       `CTRL
+('y')
+
+       )
+
+75 \ 1
+       #CSTART
+       `CTRL
+('q')
+
+       )
+
+76 \ 1
+       #CSTOP
+       `CTRL
+('s')
+
+       )
+
+77 \ 1
+       #CLNEXT
+       `CTRL
+('v')
+
+       )
+
+78 \ 1
+       #CDISCARD
+       `CTRL
+('o')
+
+       )
+
+79 \ 1
+       #CWERASE
+       `CTRL
+('w')
+
+       )
+
+80 \ 1
+       #CREPRINT
+       `CTRL
+('r')
+
+       )
+
+81 \ 1
+       #CEOT
+CEOF
+
+
+       )
+
+83 \ 1
+       #CBRK
+CEOL
+
+
+       )
+
+84 \ 1
+       #CRPRNT
+CREPRINT
+
+
+       )
+
+85 \ 1
+       #CFLUSH
+CDISCARD
+
+
+       )
+
+93 #ifdeà
+TTYDEFCHARS
+
+
+94 
+cc_t
+       g\89ydefch¬s
+[
+NCCS
+] = {
+
+95 
+CEOF
+, 
+CEOL
+, CEOL, 
+CERASE
+, 
+CWERASE
+, 
+CKILL
+, 
+CREPRINT
+,
+
+96 
+_POSIX_VDISABLE
+, 
+CINTR
+, 
+CQUIT
+, 
+CSUSP
+, 
+CDSUSP
+, 
+CSTART
+, 
+CSTOP
+, 
+CLNEXT
+,
+
+97 
+CDISCARD
+, 
+CMIN
+, 
+CTIME
+, 
+CSTATUS
+, 
+_POSIX_VDISABLE
+
+
+99 #undeà
+TTYDEFCHARS
+
+
+       @/usr/include/sys/uio.h
+
+19 #iâdeà
+_SYS_UIO_H
+
+
+20 \ 1
+       #_SYS_UIO_H
+ 1
+
+       )
+
+22 \ 2
+       ~<ã©u»s.h
+>
+
+24 \ 2
+       ~<sys/ty³s.h
+>
+
+26 
+       g__BEGIN_DECLS
+
+
+29 \ 2
+       ~<b\99s/uio.h
+>
+
+40 \r
+ssize_t
+       $»adv
+ (\12
+__fd
+, 
+__cڡ
\19
+iovec
+ *
+__iovec
+, \12
+__couÁ
+)
+
+41 
+__wur
+;
+
+51 \r
+ssize_t
+       $wr\99ev
+ (\12
+__fd
+, 
+__cڡ
\19
+iovec
+ *
+__iovec
+, \12
+__couÁ
+)
+
+52 
+__wur
+;
+
+55 #ifdeà
+__USE_BSD
+
+
+56 #iâdeà
+__USE_FILE_OFFSET64
+
+
+66 \r
+ssize_t
+       $´\97dv
+ (\12
+__fd
+, 
+__cڡ
\19
+iovec
+ *
+__iovec
+, \12
+__couÁ
+,
+
+67 
+__off_t
+__off£t
+__wur
+;
+
+78 \r
+ssize_t
+       $pwr\99ev
+ (\12
+__fd
+, 
+__cڡ
\19
+iovec
+ *
+__iovec
+, \12
+__couÁ
+,
+
+79 
+__off_t
+__off£t
+__wur
+;
+
+81 #ifdeà
+__REDIRECT
+
+
+82 \r
+ssize_t
+       `__REDIRECT
+ (
\97dv
+, (\12
+__fd
+, 
+__cڡ
\19
+iovec
+ *
+__iovec
+,
+
+83 \12
+__couÁ
+, 
+__off64_t
+__off£t
+),
+
+84 
\97dv64
+__wur
+;
+
+85 \r
+ssize_t
+       `__REDIRECT
+ (
+pwr\99ev
+, (\12
+__fd
+, 
+__cڡ
\19
+iovec
+ *
+__iovec
+,
+
+86 \12
+__couÁ
+, 
+__off64_t
+__off£t
+),
+
+87 
+pwr\99ev64
+__wur
+;
+
+89 \ 1
+       #´\97dv
\97dv64
+
+
+       )
+
+90 \ 1
+       #pwr\99ev
+pwr\99ev64
+
+
+       )
+
+94 #ifdeà
+__USE_LARGEFILE64
+
+
+104 \r
+ssize_t
+       $´\97dv64
+ (\12
+__fd
+, 
+__cڡ
\19
+iovec
+ *
+__iovec
+, \12
+__couÁ
+,
+
+105 
+__off64_t
+__off£t
+__wur
+;
+
+116 \r
+ssize_t
+       $pwr\99ev64
+ (\12
+__fd
+, 
+__cڡ
\19
+iovec
+ *
+__iovec
+, \12
+__couÁ
+,
+
+117 
+__off64_t
+__off£t
+__wur
+;
+
+121 
+__END_DECLS
+
+
+       @/usr/include/time.h
+
+23 #iâdef 
+_TIME_H
+
+
+25 #ià(! 
+def\9aed
+__Ãed_time_t
+ && !def\9aed 
+__Ãed_þock_t
+ && \
+
+26 ! 
+def\9aed
+       g__Ãed_time¥ec
+)
+
+27 \ 1
+       #_TIME_H
+ 1
+
+       )
+
+28 \ 2
+       ~<ã©u»s.h
+>
+
+30 
+       g__BEGIN_DECLS
+
+
+34 #ifdef 
+_TIME_H
+
+
+36 \ 1
+       #__Ãed_size_t
+
+
+       )
+
+37 \ 1
+       #__Ãed_NULL
+
+
+       )
+
+38 \ 2
+       ~<¡ddef.h
+>
+
+42 \ 2
+       ~<b\99s/time.h
+>
+
+45 #ià!
+def\9aed
+__STRICT_ANSI__
+ && !def\9aed 
+__USE_XOPEN2K
+
+
+46 #iâdeà
+CLK_TCK
+
+
+47 \ 1
+       #CLK_TCK
+CLOCKS_PER_SEC
+
+
+       )
+
+53 #ià!
+def\9aed
+__þock_t_def\9aed
+ && (def\9aed 
+_TIME_H
+ || def\9aed 
+__Ãed_þock_t
+)
+
+54 \ 1
+       #__þock_t_def\9aed
+ 1
+
+       )
+
+56 \ 2
+       ~<b\99s/ty³s.h
+>
+
+58 
+__BEGIN_NAMESPACE_STD
+
+
+60 \e
+__þock_t
+       tþock_t
+;
+
+61 
+       g__END_NAMESPACE_STD
+
+
+62 #ià
+def\9aed
+__USE_XOPEN
+ || def\9aed 
+__USE_POSIX
+ || def\9aed 
+__USE_MISC
+
+
+63 
+       $__USING_NAMESPACE_STD
+(
+þock_t
+)
+
+67 #undeà
+__Ãed_þock_t
+
+
+69 #ià!
+def\9aed
+__time_t_def\9aed
+ && (def\9aed 
+_TIME_H
+ || def\9aed 
+__Ãed_time_t
+)
+
+70 \ 1
+       #__time_t_def\9aed
+ 1
+
+       )
+
+72 \ 2
+       ~<b\99s/ty³s.h
+>
+
+74 
+__BEGIN_NAMESPACE_STD
+
+
+76 \e
+__time_t
+       ttime_t
+;
+
+77 
+__END_NAMESPACE_STD
+
+
+78 #ià
+def\9aed
+__USE_POSIX
+ || def\9aed 
+__USE_MISC
+ || def\9aed 
+__USE_SVID
+
+
+79 
+       $__USING_NAMESPACE_STD
+(
+time_t
+)
+
+83 #undeà
+__Ãed_time_t
+
+
+85 #ià!
+def\9aed
+__þockid_t_def\9aed
+ && \
+
+86 ((
+def\9aed
+_TIME_H
+ && def\9aed 
+__USE_POSIX199309
+è|| def\9aed 
+__Ãed_þockid_t
+)
+
+87 \ 1
+       #__þockid_t_def\9aed
+ 1
+
+       )
+
+89 \ 2
+       ~<b\99s/ty³s.h
+>
+
+92 \e
+__þockid_t
+       tþockid_t
+;
+
+95 #undeà
+__þockid_time_t
+
+
+97 #ià!
+def\9aed
+__tim\94_t_def\9aed
+ && \
+
+98 ((
+def\9aed
+_TIME_H
+ && def\9aed 
+__USE_POSIX199309
+è|| def\9aed 
+__Ãed_tim\94_t
+)
+
+99 \ 1
+       #__tim\94_t_def\9aed
+ 1
+
+       )
+
+101 \ 2
+       ~<b\99s/ty³s.h
+>
+
+104 \e
+__tim\94_t
+       ttim\94_t
+;
+
+107 #undeà
+__Ãed_tim\94_t
+
+
+110 #ià!
+def\9aed
+__time¥ec_def\9aed
+ && \
+
+111 ((
+def\9aed
+_TIME_H
+ && \
+
+112 (
+def\9aed
+__USE_POSIX199309
+ || def\9aed 
+__USE_MISC
+)) || \
+
+113 
+def\9aed
+__Ãed_time¥ec
+)
+
+114 \ 1
+       #__time¥ec_def\9aed
+ 1
+
+       )
+
+116 \ 2
+       ~<b\99s/ty³s.h
+>
+
+120 \19
+       stime¥ec
+
+
+122 
+__time_t
+tv_£c
+;
+
+123 \13\12
+tv_n£c
+;
+
+127 #undeà
+__Ãed_time¥ec
+
+
+130 #ifdef 
+_TIME_H
+
+
+131 
+__BEGIN_NAMESPACE_STD
+
+
+133 \19
+       stm
+
+
+135 \12
+tm_£c
+;
+
+136 \12
+tm_m\9a
+;
+
+137 \12
+tm_hour
+;
+
+138 \12
+tm_mday
+;
+
+139 \12
+tm_mÚ
+;
+
+140 \12
+tm_y\97r
+;
+
+141 \12
+tm_wday
+;
+
+142 \12
+tm_yday
+;
+
+143 \12
+tm_isd¡
+;
+
+145 #ifdef 
+__USE_BSD
+
+
+146 \13\12
+tm_gmtoff
+;
+
+147 
+__cڡ
\ 5*
+tm_zÚe
+;
+
+149 \13\12
+__tm_gmtoff
+;
+
+150 
+__cڡ
\ 5*
+__tm_zÚe
+;
+
+153 
+__END_NAMESPACE_STD
+
+
+154 #ià
+def\9aed
+__USE_XOPEN
+ || def\9aed 
+__USE_POSIX
+ || def\9aed 
+__USE_MISC
+
+
+155 
+       $__USING_NAMESPACE_STD
+(
+tm
+)
+
+159 #ifdeà
+__USE_POSIX199309
+
+
+161 \19
+       s\99im\94¥ec
+
+
+163 \19
+time¥ec
+\99_\9a\8brv®
+;
+
+164 \19
+time¥ec
+\99_v®ue
+;
+
+168 \19
+sigev\92t
+;
+
+172 #ifdeà
+__USE_XOPEN2K
+
+
+173 #iâdeà
+__pid_t_def\9aed
+
+
+174 \e
+__pid_t
+       tpid_t
+;
+
+175 \ 1
+       #__pid_t_def\9aed
+
+
+       )
+
+180 
+__BEGIN_NAMESPACE_STD
+
+
+183 \r
+þock_t
+       $þock
+ (\1eè
+__THROW
+;
+
+186 \r
+time_t
+       $time
+ (
+time_t
+ *
+__tim\94
+__THROW
+;
+
+189 \r\b
+       $difáime
+ (
+time_t
+__time1
+,\81ime_\88
+__time0
+)
+
+190 
+__THROW
+       `__©\8cibu\8b__
+ ((
+__cڡ__
+));
+
+193 \r
+time_t
+       $mktime
+ (\19
+tm
+ *
+__\8d
+__THROW
+;
+
+199 \r
+size_t
+       $¡ráime
+ (\ 5*
+__»¡riù
+__s
+, 
+size_t
+__maxsize
+,
+
+200 
+__cڡ
\ 5*
+__»¡riù
+__fÜm©
+,
+
+201 
+__cڡ
\19
+tm
+ *
+__»¡riù
+__\8d
+__THROW
+;
+
+202 
+__END_NAMESPACE_STD
+
+
+204 #ifdeà
+__USE_XOPEN
+
+
+207 \r\ 5*
+       $¡½time
+ (
+__cڡ
\ 5*
+__»¡riù
+__s
+,
+
+208 
+__cڡ
\ 5*
+__»¡riù
+__fmt
+, \19
+tm
+ *
+__\8d
+)
+
+209 
+__THROW
+;
+
+212 #ifdeà
+__USE_XOPEN2K8
+
+
+215 \ 2
+       ~<xloÿË.h
+>
+
+217 \r
+size_t
+       $¡ráime_l
+ (\ 5*
+__»¡riù
+__s
+, 
+size_t
+__maxsize
+,
+
+218 
+__cڡ
\ 5*
+__»¡riù
+__fÜm©
+,
+
+219 
+__cڡ
\19
+tm
+ *
+__»¡riù
+__\8d
+,
+
+220 
+__loÿË_t
+__loc
+__THROW
+;
+
+223 #ifdeà
+__USE_GNU
+
+
+224 \r\ 5*
+       $¡½time_l
+ (
+__cڡ
\ 5*
+__»¡riù
+__s
+,
+
+225 
+__cڡ
\ 5*
+__»¡riù
+__fmt
+, \19
+tm
+ *
+__\8d
+,
+
+226 
+__loÿË_t
+__loc
+__THROW
+;
+
+230 
+__BEGIN_NAMESPACE_STD
+
+
+233 \r\19
+tm
+ *
+       $gmtime
+ (
+__cڡ
+time_t
+ *
+__tim\94
+__THROW
+;
+
+237 \r\19
+tm
+ *
+       $loÿÉime
+ (
+__cڡ
+time_t
+ *
+__tim\94
+__THROW
+;
+
+238 
+__END_NAMESPACE_STD
+
+
+240 #ià
+def\9aed
+__USE_POSIX
+ || def\9aed 
+__USE_MISC
+
+
+243 \r\19
+tm
+ *
+       $gmtime_r
+ (
+__cڡ
+time_t
+ *
+__»¡riù
+__tim\94
+,
+
+244 \19
+tm
+ *
+__»¡riù
+__\8d
+__THROW
+;
+
+248 \r\19
+tm
+ *
+       $loÿÉime_r
+ (
+__cڡ
+time_t
+ *
+__»¡riù
+__tim\94
+,
+
+249 \19
+tm
+ *
+__»¡riù
+__\8d
+__THROW
+;
+
+252 
+__BEGIN_NAMESPACE_STD
+
+
+255 \r\ 5*
+       $asùime
+ (
+__cڡ
\19
+tm
+ *
+__\8d
+__THROW
+;
+
+258 \r\ 5*
+       $ùime
+ (
+__cڡ
+time_t
+ *
+__tim\94
+__THROW
+;
+
+259 
+__END_NAMESPACE_STD
+
+
+261 #ià
+def\9aed
+__USE_POSIX
+ || def\9aed 
+__USE_MISC
+
+
+266 \r\ 5*
+       $asùime_r
+ (
+__cڡ
\19
+tm
+ *
+__»¡riù
+__\8d
+,
+
+267 \ 5*
+__»¡riù
+__buf
+__THROW
+;
+
+270 \r\ 5*
+       $ùime_r
+ (
+__cڡ
+time_t
+ *
+__»¡riù
+__tim\94
+,
+
+271 \ 5*
+__»¡riù
+__buf
+__THROW
+;
+
+276 \r\ 5*
+__tzÇme
+[2];
+
+277 \r\12
+__daylight
+;
+
+278 \r\13\12
+__timezÚe
+;
+
+281 #ifdef 
+__USE_POSIX
+
+
+283 \r\ 5*
+tzÇme
+[2];
+
+287 \r\1e
+       $tz£t
+ (\1eè
+__THROW
+;
+
+290 #ià
+def\9aed
+__USE_SVID
+ || def\9aed 
+__USE_XOPEN
+
+
+291 \r\12
+daylight
+;
+
+292 \r\13\12
+timezÚe
+;
+
+295 #ifdeà
+__USE_SVID
+
+
+298 \r\12
+       $¡ime
+ (
+__cڡ
+time_t
+ *
+__wh\92
+__THROW
+;
+
+304 \ 1
+       #__i¦\97p
+(
+y\97r
+) \
+
+305 ((
+y\97r
+è% 4 =ð0 && ((y\97rè% 100 !ð0 || (y\97rè% 400 =ð0))
+
+       )
+
+308 #ifdeà
+__USE_MISC
+
+
+313 \r
+time_t
+       $timegm
+ (\19
+tm
+ *
+__\8d
+__THROW
+;
+
+316 \r
+time_t
+       $tim\96oÿl
+ (\19
+tm
+ *
+__\8d
+__THROW
+;
+
+319 \r\12
+       $dysize
+ (\12
+__y\97r
+__THROW
+       `__©\8cibu\8b__
+ ((
+__cڡ__
+));
+
+323 #ifdeà
+__USE_POSIX199309
+
+
+328 \r\12
+       `Çno¦\93p
+ (
+__cڡ
\19
+time¥ec
+ *
+__»que¡ed_time
+,
+
+329 \19
+time¥ec
+ *
+__»ma\9a\9ag
+);
+
+333 \r\12
+       $þock_g\91»s
+ (
+þockid_t
+__þock_id
+, \19
+time¥ec
+ *
+__»s
+__THROW
+;
+
+336 \r\12
+       $þock_g\91time
+ (
+þockid_t
+__þock_id
+, \19
+time¥ec
+ *
+__\8d
+__THROW
+;
+
+339 \r\12
+       $þock_£\89ime
+ (
+þockid_t
+__þock_id
+, 
+__cڡ
\19
+time¥ec
+ *
+__\8d
+)
+
+340 
+__THROW
+;
+
+342 #ifdeà
+__USE_XOPEN2K
+
+
+347 \r\12
+       `þock_Çno¦\93p
+ (
+þockid_t
+__þock_id
+, \12
+__æags
+,
+
+348 
+__cڡ
\19
+time¥ec
+ *
+__»q
+,
+
+349 \19
+time¥ec
+ *
+__»m
+);
+
+352 \r\12
+       $þock_g\91ýuþockid
+ (
+pid_t
+__pid
+, 
+þockid_t
+ *
+__þock_id
+__THROW
+;
+
+357 \r\12
+       $tim\94\97\8b
+ (
+þockid_t
+__þock_id
+,
+
+358 \19
+sigev\92t
+ *
+__»¡riù
+__evp
+,
+
+359 
+tim\94_t
+ *
+__»¡riù
+__tim\94id
+__THROW
+;
+
+362 \r\12
+       $tim\94_d\96\91e
+ (
+tim\94_t
+__tim\94id
+__THROW
+;
+
+365 \r\12
+       $tim\94\89ime
+ (
+tim\94_t
+__tim\94id
+, \12
+__æags
+,
+
+366 
+__cڡ
\19
+\99im\94¥ec
+ *
+__»¡riù
+__v®ue
+,
+
+367 \19
+\99im\94¥ec
+ *
+__»¡riù
+__ov®ue
+__THROW
+;
+
+370 \r\12
+       $tim\94_g\91time
+ (
+tim\94_t
+__tim\94id
+, \19
+\99im\94¥ec
+ *
+__v®ue
+)
+
+371 
+__THROW
+;
+
+374 \r\12
+       $tim\94_g\91ov\94run
+ (
+tim\94_t
+__tim\94id
+__THROW
+;
+
+378 #ifdeà
+__USE_XOPEN_EXTENDED
+
+
+390 \r\12
+g\91d©e_\94r
+;
+
+399 \r\19
+tm
+ *
+       `g\91d©e
+ (
+__cڡ
\ 5*
+__¡r\9ag
+);
+
+402 #ifdeà
+__USE_GNU
+
+
+413 \r\12
+       `g\91d©e_r
+ (
+__cڡ
\ 5*
+__»¡riù
+__¡r\9ag
+,
+
+414 \19
+tm
+ *
+__»¡riù
+__»sbuå
+);
+
+417 
+__END_DECLS
+
+
+       @/usr/include/xlocale.h
+
+21 #iâdeà
+_XLOCALE_H
+
+
+22 \ 1
+       #_XLOCALE_H
+ 1
+
+       )
+
+28 \e\19
+       s__loÿË_¡ruù
+
+
+31 \19
+__loÿË_d©a
+ *
+       m__loÿËs
+[13];
+
+34 cڡ \1d\16\12*
+       m__ùy³_b
+;
+
+35 cڡ \12*
+       m__ùy³_tÞow\94
+;
+
+36 cڡ \12*
+       m__ùy³_touµ\94
+;
+
+39 cڡ \ 5*
+       m__Çmes
+[13];
+
+40 } *
+       t__loÿË_t
+;
+
+43 \e
+__loÿË_t
+       tloÿË_t
+;
+
+       @/usr/include/_G_config.h
+
+4 #iâdeà
+_G_cÚfig_h
+
+
+5 \ 1
+       #_G_cÚfig_h
+ 1
+
+       )
+
+9 \ 2
+       ~<b\99s/ty³s.h
+>
+
+10 \ 1
+       #__Ãed_size_t
+
+
+       )
+
+11 #ià
+def\9aed
+_LIBC
+ || def\9aed 
+_GLIBCPP_USE_WCHAR_T
+
+
+12 \ 1
+       #__Ãed_wch¬_t
+
+
+       )
+
+14 \ 1
+       #__Ãed_NULL
+
+
+       )
+
+15 \ 2
+       ~<¡ddef.h
+>
+
+16 \ 1
+       #__Ãed_mb¡©e_t
+
+
+       )
+
+17 #ià
+def\9aed
+_LIBC
+ || def\9aed 
+_GLIBCPP_USE_WCHAR_T
+
+
+18 \ 1
+       #__Ãed_w\9at_t
+
+
+       )
+
+20 \ 2
+       ~<wch¬.h
+>
+
+21 \ 1
+       #_G_size_t
+size_t
+
+
+       )
+
+24 
+__off_t
+       m__pos
+;
+
+25 
+__mb¡©e_t
+       m__¡©e
+;
+
+26 } 
+       t_G_åos_t
+;
+
+29 
+__off64_t
+       m__pos
+;
+
+30 
+__mb¡©e_t
+       m__¡©e
+;
+
+31 } 
+       t_G_åos64_t
+;
+
+32 \ 1
+       #_G_ssize_t
+__ssize_t
+
+
+       )
+
+33 \ 1
+       #_G_off_t
+__off_t
+
+
+       )
+
+34 \ 1
+       #_G_off64_t
+__off64_t
+
+
+       )
+
+35 \ 1
+       #_G_pid_t
+__pid_t
+
+
+       )
+
+36 \ 1
+       #_G_uid_t
+__uid_t
+
+
+       )
+
+37 \ 1
+       #_G_wch¬_t
+wch¬_t
+
+
+       )
+
+38 \ 1
+       #_G_w\9at_t
+w\9at_t
+
+
+       )
+
+39 \ 1
+       #_G_¡©64
+¡©64
+
+
+       )
+
+40 #ià
+def\9aed
+_LIBC
+ || def\9aed 
+_GLIBCPP_USE_WCHAR_T
+
+
+41 \ 2
+       ~<gcÚv.h
+>
+
+44 \19
+__gcÚv_\9afo
+       m__cd
+;
+
+47 \19
+__gcÚv_\9afo
+       m__cd
+;
+
+48 \19
+__gcÚv_¡\95_d©a
+       m__d©a
+;
+
+49 } 
+       m__comb\9aed
+;
+
+50 } 
+       t_G_icÚv_t
+;
+
+53 \e\12
+       t_G_\9at16_t
+       t__©\8cibu\8b__
+ ((
+       t__mode__
+ (
+       t__HI__
+)));
+
+54 \e\12
+       t_G_\9at32_t
+       t__©\8cibu\8b__
+ ((
+       t__mode__
+ (
+       t__SI__
+)));
+
+55 \e\1d\12
+       t_G_u\9at16_t
+       t__©\8cibu\8b__
+ ((
+       t__mode__
+ (
+       t__HI__
+)));
+
+56 \e\1d\12
+       t_G_u\9at32_t
+       t__©\8cibu\8b__
+ ((
+       t__mode__
+ (
+       t__SI__
+)));
+
+58 \ 1
+       #_G_HAVE_BOOL
+ 1
+
+       )
+
+62 \ 1
+       #_G_HAVE_ATEXIT
+ 1
+
+       )
+
+63 \ 1
+       #_G_HAVE_SYS_CDEFS
+ 1
+
+       )
+
+64 \ 1
+       #_G_HAVE_SYS_WAIT
+ 1
+
+       )
+
+65 \ 1
+       #_G_NEED_STDARG_H
+ 1
+
+       )
+
+66 \ 1
+       #_G_va_li¡
+__gnuc_va_li¡
+
+
+       )
+
+68 \ 1
+       #_G_HAVE_PRINTF_FP
+ 1
+
+       )
+
+69 \ 1
+       #_G_HAVE_MMAP
+ 1
+
+       )
+
+70 \ 1
+       #_G_HAVE_MREMAP
+ 1
+
+       )
+
+71 \ 1
+       #_G_HAVE_LONG_DOUBLE_IO
+ 1
+
+       )
+
+72 \ 1
+       #_G_HAVE_IO_FILE_OPEN
+ 1
+
+       )
+
+73 \ 1
+       #_G_HAVE_IO_GETLINE_INFO
+ 1
+
+       )
+
+75 \ 1
+       #_G_IO_IO_FILE_VERSION
+ 0x20001
+
+       )
+
+77 \ 1
+       #_G_OPEN64
+__ݒ64
+
+
+       )
+
+78 \ 1
+       #_G_LSEEK64
+__l£ek64
+
+
+       )
+
+79 \ 1
+       #_G_MMAP64
+__mm­64
+
+
+       )
+
+80 \ 1
+       #_G_FSTAT64
+(
+fd
+,
+buf
+       `__fx¡©64
+ (
+_STAT_VER
+, fd, buf)
+
+       )
+
+83 \ 1
+       #_G_HAVE_ST_BLKSIZE
+       `def\9aed
+ (
+_STATBUF_ST_BLKSIZE
+)
+
+       )
+
+85 \ 1
+       #_G_BUFSIZ
+ 8192
+
+       )
+
+88 \ 1
+       #_G_NAMES_HAVE_UNDERSCORE
+ 0
+
+       )
+
+89 \ 1
+       #_G_VTABLE_LABEL_HAS_LENGTH
+ 1
+
+       )
+
+90 \ 1
+       #_G_USING_THUNKS
+ 1
+
+       )
+
+91 \ 1
+       #_G_VTABLE_LABEL_PREFIX
+ "__vt_"
+
+       )
+
+92 \ 1
+       #_G_VTABLE_LABEL_PREFIX_ID
+__vt_
+
+
+       )
+
+95 #ià
+def\9aed
+__ýlu¥lus
+ || def\9aed 
+__STDC__
+
+
+96 \ 1
+       #_G_ARGS
+(
+ARGLIST
+       )
+ARGLIST
+
+98 \ 1
+       #_G_ARGS
+(
+ARGLIST
+è()
+
+       )
+
+       @/usr/include/bits/byteswap.h
+
+21 #ià!
+def\9aed
+_BYTESWAP_H
+ && !def\9aed 
+_NETINET_IN_H
+ && !def\9aed 
+_ENDIAN_H
+
+
+25 #iâdeà
+_BITS_BYTESWAP_H
+
+
+26 \ 1
+       #_BITS_BYTESWAP_H
+ 1
+
+       )
+
+28 \ 2
+       ~<b\99s/wÜdsize.h
+>
+
+31 \ 1
+       #__bsw­_cÚ¡ªt_16
+(
+x
+) \
+
+32 ((\1d\16\12è((((
+x
+è>> 8è& 0xffè| (((xè& 0xffè<< 8)))
+
+       )
+
+34 #ià
+def\9aed
+__GNUC__
+ && __GNUC__ >= 2
+
+35 \ 1
+       #__bsw­_16
+(
+x
+) \
+
+36 (
+__ex\8bnsiÚ__
+ \
+
+37 ({ \14\1d\16\12
+__v
+, 
+__x
+ = (\1d\16\12è(
+x
+); \
+
+38 ià(
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__x
+)) \
+
+39 
+__v
+ = 
+       `__bsw­_cÚ¡ªt_16
+ (
+__x
+); \
+
+41 
+       `__asm__
+ ("rorw $8, %w0" \
+
+42 : "ô" (
+__v
+) \
+
+43 : "0" (
+__x
+) \
+
+45 
+__v
+; }))
+
+       )
+
+48 \ 1
+       #__bsw­_16
+(
+x
+) \
+
+49 (
+__ex\8bnsiÚ__
+ \
+
+50 ({ \14\1d\16\12
+__x
+ = (\1d\16\12è(
+x
+); \
+
+51 
+       `__bsw­_cÚ¡ªt_16
+ (
+__x
+); }))
+
+       )
+
+56 \ 1
+       #__bsw­_cÚ¡ªt_32
+(
+x
+) \
+
+57 ((((
+x
+) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \
+
+58 (((
+x
+è& 0x0000ff00è<< 8è| (((xè& 0x000000ffè<< 24))
+
+       )
+
+60 #ià
+def\9aed
+__GNUC__
+ && __GNUC__ >= 2
+
+61 #ià
+__WORDSIZE
+ =ð64 || (
+def\9aed
+__i486__
+ || def\9aed 
+__³Áium__
+ \
+
+62 || 
+def\9aed
+       g__³Áium´o__
+ || def\9aed 
+       g__³Áium4__
+ \
+
+63 || 
+def\9aed
+       g__k8__
+ || def\9aed 
+       g__©hlÚ__
+ \
+
+64 || 
+def\9aed
+       g__k6__
+ || def\9aed 
+       g__nocÚa__
+ \
+
+65 || 
+def\9aed
+       g__cÜe2__
+ || def\9aed 
+       g__geode__
+ \
+
+66 || 
+def\9aed
+       g__amdçm10__
+)
+
+69 \ 1
+       #__bsw­_32
+(
+x
+) \
+
+70 (
+__ex\8bnsiÚ__
+ \
+
+71 ({ \14\1d\12
+__v
+, 
+__x
+ = (
+x
+); \
+
+72 ià(
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__x
+)) \
+
+73 
+__v
+ = 
+       `__bsw­_cÚ¡ªt_32
+ (
+__x
+); \
+
+75 
+       `__asm__
+ ("bsw­ %0" : "ô" (
+__v
+è: "0" (
+__x
+)); \
+
+76 
+__v
+; }))
+
+       )
+
+78 \ 1
+       #__bsw­_32
+(
+x
+) \
+
+79 (
+__ex\8bnsiÚ__
+ \
+
+80 ({ \14\1d\12
+__v
+, 
+__x
+ = (
+x
+); \
+
+81 ià(
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__x
+)) \
+
+82 
+__v
+ = 
+       `__bsw­_cÚ¡ªt_32
+ (
+__x
+); \
+
+84 
+       `__asm__
+ ("rorw $8, %w0;" \
+
+87 : "ô" (
+__v
+) \
+
+88 : "0" (
+__x
+) \
+
+90 
+__v
+; }))
+
+       )
+
+93 \ 1
+       #__bsw­_32
+(
+x
+) \
+
+94 (
+__ex\8bnsiÚ__
+ \
+
+95 ({ \14\1d\12
+__x
+ = (
+x
+); 
+       `__bsw­_cÚ¡ªt_32
+ (__x); }))
+
+       )
+
+99 #ià
+def\9aed
+__GNUC__
+ && __GNUC__ >= 2
+
+101 \ 1
+       #__bsw­_cÚ¡ªt_64
+(
+x
+) \
+
+102 ((((
+x
+) & 0xff00000000000000ull) >> 56) \
+
+103 | (((
+x
+) & 0x00ff000000000000ull) >> 40) \
+
+104 | (((
+x
+) & 0x0000ff0000000000ull) >> 24) \
+
+105 | (((
+x
+) & 0x000000ff00000000ull) >> 8) \
+
+106 | (((
+x
+) & 0x00000000ff000000ull) << 8) \
+
+107 | (((
+x
+) & 0x0000000000ff0000ull) << 24) \
+
+108 | (((
+x
+) & 0x000000000000ff00ull) << 40) \
+
+109 | (((
+x
+è& 0x00000000000000ffuÎè<< 56))
+
+       )
+
+111 #ià
+__WORDSIZE
+ == 64
+
+112 \ 1
+       #__bsw­_64
+(
+x
+) \
+
+113 (
+__ex\8bnsiÚ__
+ \
+
+114 ({ \14\1d\13
+__v
+, 
+__x
+ = (
+x
+); \
+
+115 ià(
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__x
+)) \
+
+116 
+__v
+ = 
+       `__bsw­_cÚ¡ªt_64
+ (
+__x
+); \
+
+118 
+       `__asm__
+ ("bsw­ %q0" : "ô" (
+__v
+è: "0" (
+__x
+)); \
+
+119 
+__v
+; }))
+
+       )
+
+121 \ 1
+       #__bsw­_64
+(
+x
+) \
+
+122 (
+__ex\8bnsiÚ__
+ \
+
+123 ({ uniÚ { 
+__ex\8bnsiÚ__
\1d\13\13\12
+__Î
+; \
+
+124 \1d\12
+__l
+[2]; } 
+__w
+, 
+__r
+; \
+
+125 ià(
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+x
+)) \
+
+126 
+__r
+.
+__Î
+ = 
+       `__bsw­_cÚ¡ªt_64
+ (
+x
+); \
+
+129 
+__w
+.
+__Î
+ = (
+x
+); \
+
+130 
+__r
+.
+__l
+[0] = 
+       `__bsw­_32
+ (
+__w
+.__l[1]); \
+
+131 
+__r
+.
+__l
+[1] = 
+       `__bsw­_32
+ (
+__w
+.__l[0]); \
+
+133 
+__r
+.
+__Î
+; }))
+
+       )
+
+       @/usr/include/bits/endian.h
+
+3 #iâdeà
+_ENDIAN_H
+
+
+7 \ 1
+       #__BYTE_ORDER
+__LITTLE_ENDIAN
+
+
+       )
+
+       @/usr/include/bits/libio-ldbl.h
+
+20 #iâdeà
+_IO_STDIO_H
+
+
+24 
+       $__LDBL_REDIR_DECL
+ (
+_IO_vfsÿnf
+)
+
+25 
+       `__LDBL_REDIR_DECL
+ (
+_IO_vår\9atf
+)
+
+       @/usr/include/bits/predefs.h
+
+19 #iâdeà
+_FEATURES_H
+
+
+23 #iâdeà
+_PREDEFS_H
+
+
+24 \ 1
+       #_PREDEFS_H
+
+
+       )
+
+27 \ 1
+       #__STDC_IEC_559__
+ 1
+
+       )
+
+28 \ 1
+       #__STDC_IEC_559_COMPLEX__
+ 1
+
+       )
+
+       @/usr/include/bits/sched.h
+
+22 #iâdeà
+__Ãed_sched·¿m
+
+
+24 #iâdeà
+_SCHED_H
+
+
+30 \ 1
+       #SCHED_OTHER
+ 0
+
+       )
+
+31 \ 1
+       #SCHED_FIFO
+ 1
+
+       )
+
+32 \ 1
+       #SCHED_RR
+ 2
+
+       )
+
+33 #ifdeà
+__USE_GNU
+
+
+34 \ 1
+       #SCHED_BATCH
+ 3
+
+       )
+
+35 \ 1
+       #SCHED_IDLE
+ 5
+
+       )
+
+37 \ 1
+       #SCHED_RESET_ON_FORK
+ 0x40000000
+
+       )
+
+40 #ifdeà
+__USE_MISC
+
+
+42 \ 1
+       #CSIGNAL
+ 0x000000fà
+
+       )
+
+43 \ 1
+       #CLONE_VM
+ 0x00000100
+
+       )
+
+44 \ 1
+       #CLONE_FS
+ 0x00000200
+
+       )
+
+45 \ 1
+       #CLONE_FILES
+ 0x00000400
+
+       )
+
+46 \ 1
+       #CLONE_SIGHAND
+ 0x00000800
+
+       )
+
+47 \ 1
+       #CLONE_PTRACE
+ 0x00002000
+
+       )
+
+48 \ 1
+       #CLONE_VFORK
+ 0x00004000
+
+       )
+
+50 \ 1
+       #CLONE_PARENT
+ 0x00008000
+
+       )
+
+52 \ 1
+       #CLONE_THREAD
+ 0x00010000
+
+       )
+
+53 \ 1
+       #CLONE_NEWNS
+ 0x00020000
+
+       )
+
+54 \ 1
+       #CLONE_SYSVSEM
+ 0x00040000
+
+       )
+
+55 \ 1
+       #CLONE_SETTLS
+ 0x00080000
+
+       )
+
+56 \ 1
+       #CLONE_PARENT_SETTID
+ 0x00100000
+
+       )
+
+58 \ 1
+       #CLONE_CHILD_CLEARTID
+ 0x00200000
+
+       )
+
+60 \ 1
+       #CLONE_DETACHED
+ 0x00400000
+
+       )
+
+61 \ 1
+       #CLONE_UNTRACED
+ 0x00800000
+
+       )
+
+63 \ 1
+       #CLONE_CHILD_SETTID
+ 0x01000000
+
+       )
+
+65 \ 1
+       #CLONE_NEWUTS
+ 0x04000000
+
+       )
+
+66 \ 1
+       #CLONE_NEWIPC
+ 0x08000000
+
+       )
+
+67 \ 1
+       #CLONE_NEWUSER
+ 0x10000000
+
+       )
+
+68 \ 1
+       #CLONE_NEWPID
+ 0x20000000
+
+       )
+
+69 \ 1
+       #CLONE_NEWNET
+ 0x40000000
+
+       )
+
+70 \ 1
+       #CLONE_IO
+ 0x80000000
+
+       )
+
+74 \19
+       ssched_·¿m
+
+
+76 \12
+       m__sched_´iÜ\99y
+;
+
+79 
+       g__BEGIN_DECLS
+
+
+81 #ifdeà
+__USE_MISC
+
+
+83 \r\12
+þÚe
+ (\12(*
+__â
+è(\1e*
+__¬g
+), \1e*
+__ch\9ed_¡ack
+,
+
+84 \12
+__æags
+, \1e*
+__¬g
+, ...è
+__THROW
+;
+
+87 \r\12
+       $unsh¬e
+ (\12
+__æags
+__THROW
+;
+
+90 \r\12
+       $sched_g\91ýu
+ (\1eè
+__THROW
+;
+
+93 
+__END_DECLS
+
+
+97 #ià!
+def\9aed
+__def\9aed_sched·¿m
+ \
+
+98 && (
+def\9aed
+__Ãed_sched·¿m
+ || def\9aed 
+_SCHED_H
+)
+
+99 \ 1
+       #__def\9aed_sched·¿m
+ 1
+
+       )
+
+101 \19
+       s__sched_·¿m
+
+
+103 \12
+__sched_´iÜ\99y
+;
+
+105 #undeà
+__Ãed_sched·¿m
+
+
+109 #ià
+def\9aed
+_SCHED_H
+ && !def\9aed 
+__ýu_£t_t_def\9aed
+
+
+110 \ 1
+       #__ýu_£t_t_def\9aed
+
+
+       )
+
+112 \ 1
+       #__CPU_SETSIZE
+ 1024
+
+       )
+
+113 \ 1
+       #__NCPUBITS
+ (8 * \17 (
+__ýu_mask
+))
+
+       )
+
+116 \e\1d\13\12
+       t__ýu_mask
+;
+
+119 \ 1
+       #__CPUELT
+(
+ýu
+è((ýuè/ 
+__NCPUBITS
+)
+
+       )
+
+120 \ 1
+       #__CPUMASK
+(
+ýu
+è((
+__ýu_mask
+è1 << ((ýuè% 
+__NCPUBITS
+))
+
+       )
+
+125 
+__ýu_mask
+__b\99s
+[
+__CPU_SETSIZE
+ / 
+__NCPUBITS
+];
+
+126 } 
+       týu_£t_t
+;
+
+129 #ià
+       `__GNUC_PREREQ
+ (2, 91)
+
+130 \ 1
+       #__CPU_ZERO_S
+(
+£tsize
+, 
+ýu£\8d
+) \
+
+131 dØ
+       `__bu\9et\9a_mem£t
+ (
+ýu£\8d
+, '\0', 
+£tsize
+); \1f0)
+
+       )
+
+133 \ 1
+       #__CPU_ZERO_S
+(
+£tsize
+, 
+ýu£\8d
+) \
+
+135 
+size_t
+__i
+; \
+
+136 
+size_t
+__imax
+ = (
+£tsize
+è/ \17 (
+__ýu_mask
+); \
+
+137 
+__ýu_mask
+ *
+__b\99s
+ = (
+ýu£\8d
+)->__bits; \
+
+138 \ f
+__i
+ = 0; __\98
+__imax
+; ++__i) \
+
+139 
+__b\99s
+[
+__i
+] = 0; \
+
+140 
+       }
+} \1f0)
+
+       )
+
+142 \ 1
+       #__CPU_SET_S
+(
+ýu
+, 
+£tsize
+, 
+ýu£\8d
+) \
+
+143 (
+__ex\8bnsiÚ__
+ \
+
+144 ({ 
+size_t
+__ýu
+ = (
+ýu
+); \
+
+145 
+__ýu
+ < 8 * (
+£tsize
+) \
+
+146 ? (((
+__ýu_mask
+ *è((
+ýu£\8d
+)->
+__b\99s
+))[
+       `__CPUELT
+ (
+__ýu
+)] \
+
+147 |ð
+       `__CPUMASK
+ (
+__ýu
+)) \
+
+148 : 0; }))
+
+       )
+
+149 \ 1
+       #__CPU_CLR_S
+(
+ýu
+, 
+£tsize
+, 
+ýu£\8d
+) \
+
+150 (
+__ex\8bnsiÚ__
+ \
+
+151 ({ 
+size_t
+__ýu
+ = (
+ýu
+); \
+
+152 
+__ýu
+ < 8 * (
+£tsize
+) \
+
+153 ? (((
+__ýu_mask
+ *è((
+ýu£\8d
+)->
+__b\99s
+))[
+       `__CPUELT
+ (
+__ýu
+)] \
+
+154 &ð~
+       `__CPUMASK
+ (
+__ýu
+)) \
+
+155 : 0; }))
+
+       )
+
+156 \ 1
+       #__CPU_ISSET_S
+(
+ýu
+, 
+£tsize
+, 
+ýu£\8d
+) \
+
+157 (
+__ex\8bnsiÚ__
+ \
+
+158 ({ 
+size_t
+__ýu
+ = (
+ýu
+); \
+
+159 
+__ýu
+ < 8 * (
+£tsize
+) \
+
+160 ? ((((
+__cڡ
+__ýu_mask
+ *è((
+ýu£\8d
+)->
+__b\99s
+))[
+       `__CPUELT
+ (
+__ýu
+)] \
+
+161 & 
+       `__CPUMASK
+ (
+__ýu
+))) != 0 \
+
+162 : 0; }))
+
+       )
+
+164 \ 1
+       #__CPU_COUNT_S
+(
+£tsize
+, 
+ýu£\8d
+) \
+
+165 
+       `__sched_ýucouÁ
+ (
+£tsize
+, 
+ýu£\8d
+)
+
+       )
+
+167 #ià
+__GNUC_PREREQ
+ (2, 91)
+
+168 \ 1
+       #__CPU_EQUAL_S
+(
+£tsize
+, 
+ýu£\8d1
+, 
+ýu£\8d2
+) \
+
+169 (
+       `__bu\9et\9a_memcmp
+ (
+ýu£\8d1
+, 
+ýu£\8d2
+, 
+£tsize
+è=ð0)
+
+       )
+
+171 \ 1
+       #__CPU_EQUAL_S
+(
+£tsize
+, 
+ýu£\8d1
+, 
+ýu£\8d2
+) \
+
+172 (
+__ex\8bnsiÚ__
+ \
+
+173 ({ 
+__cڡ
+__ýu_mask
+ *
+__¬r1
+ = (
+ýu£\8d1
+)->
+__b\99s
+; \
+
+174 
+__cڡ
+__ýu_mask
+ *
+__¬r2
+ = (
+ýu£\8d2
+)->
+__b\99s
+; \
+
+175 
+size_t
+__imax
+ = (
+£tsize
+è/ \17 (
+__ýu_mask
+); \
+
+176 
+size_t
+__i
+; \
+
+177 \ f
+__i
+ = 0; __\98
+__imax
+; ++__i) \
+
+178 ià(
+__b\99s
+[
+__i
+] != __bits[__i]) \
+
+180 
+__i
+ =ð
+__imax
+; }))
+
+       )
+
+183 \ 1
+       #__CPU_OP_S
+(
+£tsize
+, 
+de¡£t
+, 
+¤c£t1
+, 
+¤c£t2
+, 
+) \
+
+184 (
+__ex\8bnsiÚ__
+ \
+
+185 ({ 
+ýu_£t_t
+ *
+__de¡
+ = (
+de¡£t
+); \
+
+186 
+__cڡ
+__ýu_mask
+ *
+__¬r1
+ = (
+¤c£t1
+)->
+__b\99s
+; \
+
+187 
+__cڡ
+__ýu_mask
+ *
+__¬r2
+ = (
+¤c£t2
+)->
+__b\99s
+; \
+
+188 
+size_t
+__imax
+ = (
+£tsize
+è/ \17 (
+__ýu_mask
+); \
+
+189 
+size_t
+__i
+; \
+
+190 \ f
+__i
+ = 0; __\98
+__imax
+; ++__i) \
+
+191 ((
+__ýu_mask
+ *è
+__de¡
+->
+__b\99s
+)[
+__i
+] = 
+__¬r1
+[__i] 
+__¬r2
+[__i]; \
+
+192 
+__de¡
+; }))
+
+       )
+
+194 \ 1
+       #__CPU_ALLOC_SIZE
+(
+couÁ
+) \
+
+195 ((((
+couÁ
+è+ 
+__NCPUBITS
+ - 1è/ __NCPUBITSè* \17 (
+__ýu_mask
+))
+
+       )
+
+196 \ 1
+       #__CPU_ALLOC
+(
+couÁ
+       `__sched_ýu®loc
+ (couÁ)
+
+       )
+
+197 \ 1
+       #__CPU_FREE
+(
+ýu£t
+       `__sched_ýuä\93
+ (ýu£t)
+
+       )
+
+199 
+__BEGIN_DECLS
+
+
+201 \r\12
+       $__sched_ýucouÁ
+ (
+size_t
+__£tsize
+, cڡ 
+ýu_£t_t
+ *
+__£\8d
+)
+
+202 
+__THROW
+;
+
+203 \r
+ýu_£t_t
+ *
+       $__sched_ýu®loc
+ (
+size_t
+__couÁ
+__THROW
+__wur
+;
+
+204 \r\1e
+       $__sched_ýuä\93
+ (
+ýu_£t_t
+ *
+__£t
+__THROW
+;
+
+206 
+__END_DECLS
+
+
+       @/usr/include/bits/stdio-lock.h
+
+20 #iâdeà
+_BITS_STDIO_LOCK_H
+
+
+21 \ 1
+       #_BITS_STDIO_LOCK_H
+ 1
+
+       )
+
+23 \ 2
+       ~<b\99s/libc-lock.h
+>
+
+24 \ 2
+       ~<lowËv\96lock.h
+>
+
+28 \ 1
+       #_IO_lock_\9aex³nsive
+ 1
+
+       )
+
+30 \e¡ruù { \12
+       mlock
+; \12
+       mút
+; \1e*
+       mowÃr
+; } 
+       t_IO_lock_t
+;
+
+32 \ 1
+       #_IO_lock_\9a\99\9fliz\94
+ { 
+LLL_LOCK_INITIALIZER
+, 0, 
+NULL
+ }
+
+       )
+
+34 \ 1
+       #_IO_lock_\9a\99
+(
+_Çme
+) \
+
+35 ((
+_Çme
+èð(
+_IO_lock_t
+_IO_lock_\9a\99\9fliz\94
+ , 0)
+
+       )
+
+37 \ 1
+       #_IO_lock_f\9ai
+(
+_Çme
+) \
+
+38 ((\1eè0)
+
+       )
+
+40 \ 1
+       #_IO_lock_lock
+(
+_Çme
+) \
+
+42 \1e*
+__£lf
+ = 
+THREAD_SELF
+; \
+
+43 ià((
+_Çme
+).
+owÃr
+ !ð
+__£lf
+) \
+
+45 
+       `Îl_lock
+ ((
+_Çme
+).
+lock
+, 
+LLL_PRIVATE
+); \
+
+46 (
+_Çme
+).
+owÃr
+ = 
+__£lf
+; \
+
+48 ++(
+_Çme
+).
+út
+; \
+
+49 } \1f0)
+
+       )
+
+51 \ 1
+       #_IO_lock_\8cylock
+(
+_Çme
+) \
+
+53 \12
+__»suÉ
+ = 0; \
+
+54 \1e*
+__£lf
+ = 
+THREAD_SELF
+; \
+
+55 ià((
+_Çme
+).
+owÃr
+ !ð
+__£lf
+) \
+
+57 ià(
+       `Îl_\8cylock
+ ((
+_Çme
+).
+lock
+) == 0) \
+
+59 (
+_Çme
+).
+owÃr
+ = 
+__£lf
+; \
+
+60 (
+_Çme
+).
+út
+ = 1; \
+
+63 
+__»suÉ
+ = 
+EBUSY
+; \
+
+66 ++(
+_Çme
+).
+út
+; \
+
+67 
+__»suÉ
+; \
+
+68 })
+
+       )
+
+70 \ 1
+       #_IO_lock_uÆock
+(
+_Çme
+) \
+
+72 ià(--(
+_Çme
+).
+út
+ == 0) \
+
+74 (
+_Çme
+).
+owÃr
+ = 
+NULL
+; \
+
+75 
+       `Îl_uÆock
+ ((
+_Çme
+).
+lock
+, 
+LLL_PRIVATE
+); \
+
+77 } \1f0)
+
+       )
+
+81 \ 1
+       #_IO_þ\97nup_»giÚ_¡¬t
+(
+_fù
+, 
+_å
+) \
+
+82 
+       `__libc_þ\97nup_»giÚ_¡¬t
+ (((
+_å
+)->
+_æags
+ & 
+_IO_USER_LOCK
+è=ð0, 
+_fù
+, _å)
+
+       )
+
+83 \ 1
+       #_IO_þ\97nup_»giÚ_¡¬t_nßrg
+(
+_fù
+) \
+
+84 
+       `__libc_þ\97nup_»giÚ_¡¬t
+ (1, 
+_fù
+, 
+NULL
+)
+
+       )
+
+85 \ 1
+       #_IO_þ\97nup_»giÚ_\92d
+(
+_do\99
+) \
+
+86 
+       `__libc_þ\97nup_»giÚ_\92d
+ (
+_do\99
+)
+
+       )
+
+88 #ià
+def\9aed
+_LIBC
+ && !def\9aed 
+NOT_IN_libc
+
+
+90 #ifdeà
+__EXCEPTIONS
+
+
+91 \ 1
+       #_IO_acqu\9ce_lock
+(
+_å
+) \
+
+93 
+_IO_FILE
+ *
+_IO_acqu\9ce_lock_f\9ee
+ \
+
+94 
+       `__©\8cibu\8b__
+((
+       `þ\97nup
+ (
+_IO_acqu\9ce_lock_fù
+))) \
+
+95 ð(
+_å
+); \
+
+96 
+       `_IO_æockf\9ee
+ (
+_IO_acqu\9ce_lock_f\9ee
+);
+
+       )
+
+97 \ 1
+       #_IO_acqu\9ce_lock_þ\97r_æags2
+(
+_å
+) \
+
+99 
+_IO_FILE
+ *
+_IO_acqu\9ce_lock_f\9ee
+ \
+
+100 
+       `__©\8cibu\8b__
+((
+       `þ\97nup
+ (
+_IO_acqu\9ce_lock_þ\97r_æags2_fù
+))) \
+
+101 ð(
+_å
+); \
+
+102 
+       `_IO_æockf\9ee
+ (
+_IO_acqu\9ce_lock_f\9ee
+);
+
+       )
+
+104 \ 1
+       #_IO_acqu\9ce_lock
+(
+_å
+_IO_acqu\9ce_lock_Ãeds_exû±iÚs_\92abËd
+
+
+       )
+
+105 \ 1
+       #_IO_acqu\9ce_lock_þ\97r_æags2
+(
+_å
+       `_IO_acqu\9ce_lock
+ (_å)
+
+       )
+
+107 \ 1
+       #_IO_»Ëa£_lock
+(
+_å
+è; } \1f0)
+
+       )
+
+       @/usr/include/bits/typesizes.h
+
+20 #iâdeà
+_BITS_TYPES_H
+
+
+24 #iâdef 
+_BITS_TYPESIZES_H
+
+
+25 \ 1
+       #_BITS_TYPESIZES_H
+ 1
+
+       )
+
+30 \ 1
+       #__DEV_T_TYPE
+__UQUAD_TYPE
+
+
+       )
+
+31 \ 1
+       #__UID_T_TYPE
+__U32_TYPE
+
+
+       )
+
+32 \ 1
+       #__GID_T_TYPE
+__U32_TYPE
+
+
+       )
+
+33 \ 1
+       #__INO_T_TYPE
+__ULONGWORD_TYPE
+
+
+       )
+
+34 \ 1
+       #__INO64_T_TYPE
+__UQUAD_TYPE
+
+
+       )
+
+35 \ 1
+       #__MODE_T_TYPE
+__U32_TYPE
+
+
+       )
+
+36 \ 1
+       #__NLINK_T_TYPE
+__UWORD_TYPE
+
+
+       )
+
+37 \ 1
+       #__OFF_T_TYPE
+__SLONGWORD_TYPE
+
+
+       )
+
+38 \ 1
+       #__OFF64_T_TYPE
+__SQUAD_TYPE
+
+
+       )
+
+39 \ 1
+       #__PID_T_TYPE
+__S32_TYPE
+
+
+       )
+
+40 \ 1
+       #__RLIM_T_TYPE
+__ULONGWORD_TYPE
+
+
+       )
+
+41 \ 1
+       #__RLIM64_T_TYPE
+__UQUAD_TYPE
+
+
+       )
+
+42 \ 1
+       #__BLKCNT_T_TYPE
+__SLONGWORD_TYPE
+
+
+       )
+
+43 \ 1
+       #__BLKCNT64_T_TYPE
+__SQUAD_TYPE
+
+
+       )
+
+44 \ 1
+       #__FSBLKCNT_T_TYPE
+__ULONGWORD_TYPE
+
+
+       )
+
+45 \ 1
+       #__FSBLKCNT64_T_TYPE
+__UQUAD_TYPE
+
+
+       )
+
+46 \ 1
+       #__FSFILCNT_T_TYPE
+__ULONGWORD_TYPE
+
+
+       )
+
+47 \ 1
+       #__FSFILCNT64_T_TYPE
+__UQUAD_TYPE
+
+
+       )
+
+48 \ 1
+       #__ID_T_TYPE
+__U32_TYPE
+
+
+       )
+
+49 \ 1
+       #__CLOCK_T_TYPE
+__SLONGWORD_TYPE
+
+
+       )
+
+50 \ 1
+       #__TIME_T_TYPE
+__SLONGWORD_TYPE
+
+
+       )
+
+51 \ 1
+       #__USECONDS_T_TYPE
+__U32_TYPE
+
+
+       )
+
+52 \ 1
+       #__SUSECONDS_T_TYPE
+__SLONGWORD_TYPE
+
+
+       )
+
+53 \ 1
+       #__DADDR_T_TYPE
+__S32_TYPE
+
+
+       )
+
+54 \ 1
+       #__SWBLK_T_TYPE
+__SLONGWORD_TYPE
+
+
+       )
+
+55 \ 1
+       #__KEY_T_TYPE
+__S32_TYPE
+
+
+       )
+
+56 \ 1
+       #__CLOCKID_T_TYPE
+__S32_TYPE
+
+
+       )
+
+57 \ 1
+       #__TIMER_T_TYPE
\1e*
+
+       )
+
+58 \ 1
+       #__BLKSIZE_T_TYPE
+__SLONGWORD_TYPE
+
+
+       )
+
+59 \ 1
+       #__FSID_T_TYPE
+ s\8cuù { \12
+__v®
+[2]; }
+
+       )
+
+60 \ 1
+       #__SSIZE_T_TYPE
+__SWORD_TYPE
+
+
+       )
+
+63 \ 1
+       #__FD_SETSIZE
+ 1024
+
+       )
+
+       @/usr/include/bits/uio.h
+
+19 #ià!
+def\9aed
+_SYS_UIO_H
+ && !def\9aed 
+_FCNTL_H
+
+
+23 #iâdeà
+_BITS_UIO_H
+
+
+24 \ 1
+       #_BITS_UIO_H
+ 1
+
+       )
+
+26 \ 2
+       ~<sys/ty³s.h
+>
+
+40 \ 1
+       #UIO_MAXIOV
+ 1024
+
+       )
+
+44 \19
+       siovec
+
+
+46 \1e*
+       miov_ba£
+;
+
+47 
+size_t
+       miov_Ën
+;
+
+       @/usr/include/bits/wchar.h
+
+20 #iâdeà
+_BITS_WCHAR_H
+
+
+21 \ 1
+       #_BITS_WCHAR_H
+ 1
+
+       )
+
+24 #ifdeà
+__WCHAR_MAX__
+
+
+25 \ 1
+       #__WCHAR_MAX
+__WCHAR_MAX__
+
+
+       )
+
+27 \ 1
+       #__WCHAR_MAX
+ (2147483647)
+
+       )
+
+32 #ifdeà
+__WCHAR_UNSIGNED__
+
+
+33 \ 1
+       #__WCHAR_MIN
+L
+'\0'
+
+       )
+
+37 #\96
+L
+'\0' - 1 > 0
+
+38 \ 1
+       #__WCHAR_MIN
+L
+'\0'
+
+       )
+
+40 \ 1
+       #__WCHAR_MIN
+ (-
+__WCHAR_MAX
+ - 1)
+
+       )
+
+       @/usr/include/ctype.h
+
+24 #iâdef 
+_CTYPE_H
+
+
+25 \ 1
+       #_CTYPE_H
+ 1
+
+       )
+
+27 \ 2
+       ~<ã©u»s.h
+>
+
+28 \ 2
+       ~<b\99s/ty³s.h
+>
+
+30 
+       g__BEGIN_DECLS
+
+
+32 #iâdeà
+_ISb\99
+
+
+41 \ 2
+       ~<\92d\9fn.h
+>
+
+42 #ià
+__BYTE_ORDER
+ =ð
+__BIG_ENDIAN
+
+
+43 \ 1
+       #_ISb\99
+(
+b\99
+è(1 << (b\99))
+
+       )
+
+45 \ 1
+       #_ISb\99
+(
+b\99
+è((b\99è< 8 ? ((1 << (b\99)è<< 8è: ((1 << (b\99)è>> 8))
+
+       )
+
+50 
+       m_ISuµ\94
+ = 
+_ISb\99
+ (0),
+
+51 
+       m_ISlow\94
+ = 
+_ISb\99
+ (1),
+
+52 
+       m_IS®pha
+ = 
+_ISb\99
+ (2),
+
+53 
+       m_ISdig\99
+ = 
+_ISb\99
+ (3),
+
+54 
+       m_ISxdig\99
+ = 
+_ISb\99
+ (4),
+
+55 
+       m_IS¥aû
+ = 
+_ISb\99
+ (5),
+
+56 
+       m_IS´\9at
+ = 
+_ISb\99
+ (6),
+
+57 
+       m_ISg¿ph
+ = 
+_ISb\99
+ (7),
+
+58 
+       m_ISbÏnk
+ = 
+_ISb\99
+ (8),
+
+59 
+       m_ISú\8cl
+ = 
+_ISb\99
+ (9),
+
+60 
+       m_ISpunù
+ = 
+_ISb\99
+ (10),
+
+61 
+       m_IS®num
+ = 
+_ISb\99
+ (11)
+
+81 \r
+__cڡ
\1d\16\12**
+       $__ùy³_b_loc
+ (\1e)
+
+82 
+__THROW
+       `__©\8cibu\8b__
+ ((
+__cڡ
+));
+
+83 \r
+__cڡ
+__\9at32_t
+ **
+       $__ùy³_tÞow\94_loc
+ (\1e)
+
+84 
+__THROW
+       `__©\8cibu\8b__
+ ((
+__cڡ
+));
+
+85 \r
+__cڡ
+__\9at32_t
+ **
+       $__ùy³_touµ\94_loc
+ (\1e)
+
+86 
+__THROW
+       `__©\8cibu\8b__
+ ((
+__cڡ
+));
+
+88 \ 1
+       #__isùy³
+(
+c
+, 
+ty³
+) \
+
+89 ((*
+       `__ùy³_b_loc
+ ())[(\12è(
+c
+)] & (\1d\16\12è
+ty³
+)
+
+       )
+
+91 \ 1
+       #__i§scii
+(
+c
+è(((cè& ~0x7fè=ð0è
+
+       )
+
+92 \ 1
+       #__tßscii
+(
+c
+è((cè& 0x7fè
+
+       )
+
+94 \ 1
+       #__exùy³
+(
+Çme
\r\12
+       `Çme
+ (\12è
+__THROW
+
+
+       )
+
+96 
+__BEGIN_NAMESPACE_STD
+
+
+102 
+       `__exùy³
+ (
+i§Êum
+);
+
+103 
+       `__exùy³
+ (
+i§Íha
+);
+
+104 
+       `__exùy³
+ (
+isú\8cl
+);
+
+105 
+       `__exùy³
+ (
+isdig\99
+);
+
+106 
+       `__exùy³
+ (
+i¦ow\94
+);
+
+107 
+       `__exùy³
+ (
+isg¿ph
+);
+
+108 
+       `__exùy³
+ (
+i¥r\9at
+);
+
+109 
+       `__exùy³
+ (
+i¥unù
+);
+
+110 
+       `__exùy³
+ (
+is¥aû
+);
+
+111 
+       `__exùy³
+ (
+isuµ\94
+);
+
+112 
+       `__exùy³
+ (
+isxdig\99
+);
+
+116 \r\12
+       $tÞow\94
+ (\12
+__c
+__THROW
+;
+
+119 \r\12
+       $touµ\94
+ (\12
+__c
+__THROW
+;
+
+121 
+__END_NAMESPACE_STD
+
+
+125 #ifdef 
+__USE_ISOC99
+
+
+126 
+__BEGIN_NAMESPACE_C99
+
+
+128 
+       `__exùy³
+ (
+isbÏnk
+);
+
+130 
+__END_NAMESPACE_C99
+
+
+133 #ifdeà
+__USE_GNU
+
+
+135 \r\12
+       $isùy³
+ (\12
+__c
+, \12
+__mask
+__THROW
+;
+
+138 #ià
+def\9aed
+__USE_SVID
+ || def\9aed 
+__USE_MISC
+ || def\9aed 
+__USE_XOPEN
+
+
+142 \r\12
+       $i§scii
+ (\12
+__c
+__THROW
+;
+
+146 \r\12
+       $tßscii
+ (\12
+__c
+__THROW
+;
+
+150 
+       `__exùy³
+ (
+_touµ\94
+);
+
+151 
+       `__exùy³
+ (
+_tÞow\94
+);
+
+155 \ 1
+       #__tobody
+(
+c
+, 
+f
+, 
+a
+, 
+¬gs
+) \
+
+156 (
+__ex\8bnsiÚ__
+ \
+
+157 ({ \12
+__»s
+; \
+
+158 ià(\17 (
+c
+) > 1) \
+
+160 ià(
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+c
+)) \
+
+162 \12
+__c
+ = (
+c
+); \
+
+163 
+__»s
+ = 
+__c
+ < -128 || __ø> 255 ? __ø: (
+a
+)[__c]; \
+
+166 
+__»s
+ = 
+f
+¬gs
+; \
+
+169 
+__»s
+ = (
+a
+)[(\12è(
+c
+)]; \
+
+170 
+__»s
+; 
+       }
+}))
+
+       )
+
+172 #ià!
+def\9aed
+__NO_CTYPE
+ && !def\9aed 
+__ýlu¥lus
+
+
+173 \ 1
+       #i§Êum
+(
+c
+       `__isùy³
+((c), 
+_IS®num
+)
+
+       )
+
+174 \ 1
+       #i§Íha
+(
+c
+       `__isùy³
+((c), 
+_IS®pha
+)
+
+       )
+
+175 \ 1
+       #isú\8cl
+(
+c
+       `__isùy³
+((c), 
+_ISú\8cl
+)
+
+       )
+
+176 \ 1
+       #isdig\99
+(
+c
+       `__isùy³
+((c), 
+_ISdig\99
+)
+
+       )
+
+177 \ 1
+       #i¦ow\94
+(
+c
+       `__isùy³
+((c), 
+_ISlow\94
+)
+
+       )
+
+178 \ 1
+       #isg¿ph
+(
+c
+       `__isùy³
+((c), 
+_ISg¿ph
+)
+
+       )
+
+179 \ 1
+       #i¥r\9at
+(
+c
+       `__isùy³
+((c), 
+_IS´\9at
+)
+
+       )
+
+180 \ 1
+       #i¥unù
+(
+c
+       `__isùy³
+((c), 
+_ISpunù
+)
+
+       )
+
+181 \ 1
+       #is¥aû
+(
+c
+       `__isùy³
+((c), 
+_IS¥aû
+)
+
+       )
+
+182 \ 1
+       #isuµ\94
+(
+c
+       `__isùy³
+((c), 
+_ISuµ\94
+)
+
+       )
+
+183 \ 1
+       #isxdig\99
+(
+c
+       `__isùy³
+((c), 
+_ISxdig\99
+)
+
+       )
+
+185 #ifdeà
+__USE_ISOC99
+
+
+186 \ 1
+       #isbÏnk
+(
+c
+       `__isùy³
+((c), 
+_ISbÏnk
+)
+
+       )
+
+189 #ifdeà
+__USE_EXTERN_INLINES
+
+
+190 
+__ex\8bº_\9al\9ae
\12
+
+191 
+__NTH
+ (
+       $tÞow\94
+ (\12
+__c
+))
+
+193 \15 
+__c
+ >ð-128 && __ø< 256 ? (*
+       `__ùy³_tÞow\94_loc
+ ())[__c] : __c;
+
+194 
+       }
+}
+
+196 
+__ex\8bº_\9al\9ae
\12
+
+197 
+__NTH
+ (
+       $touµ\94
+ (\12
+__c
+))
+
+199 \15 
+__c
+ >ð-128 && __ø< 256 ? (*
+       `__ùy³_touµ\94_loc
+ ())[__c] : __c;
+
+200 
+       }
+}
+
+203 #ià
+__GNUC__
+ >ð2 && 
+def\9aed
+__OPTIMIZE__
+ && !def\9aed 
+__ýlu¥lus
+
+
+204 \ 1
+       #tÞow\94
+(
+c
+       `__tobody
+ (c, 
+tÞow\94
+, *
+       `__ùy³_tÞow\94_loc
+ (), (c))
+
+       )
+
+205 \ 1
+       #touµ\94
+(
+c
+       `__tobody
+ (c, 
+touµ\94
+, *
+       `__ùy³_touµ\94_loc
+ (), (c))
+
+       )
+
+208 #ià
+def\9aed
+__USE_SVID
+ || def\9aed 
+__USE_MISC
+ || def\9aed 
+__USE_XOPEN
+
+
+209 \ 1
+       #i§scii
+(
+c
+       `__i§scii
+ (c)
+
+       )
+
+210 \ 1
+       #tßscii
+(
+c
+       `__tßscii
+ (c)
+
+       )
+
+212 \ 1
+       #_tÞow\94
+(
+c
+è((\12è(*
+       `__ùy³_tÞow\94_loc
+ ())[(\12è(c)])
+
+       )
+
+213 \ 1
+       #_touµ\94
+(
+c
+è((\12è(*
+       `__ùy³_touµ\94_loc
+ ())[(\12è(c)])
+
+       )
+
+219 #ifdeà
+__USE_XOPEN2K8
+
+
+233 \ 2
+       ~<xloÿË.h
+>
+
+237 \ 1
+       #__isùy³_l
+(
+c
+, 
+ty³
+, 
+loÿË
+) \
+
+238 ((
+loÿË
+)->
+__ùy³_b
+[(\12è(
+c
+)] & (\1d\16\12è
+ty³
+)
+
+       )
+
+240 \ 1
+       #__exùy³_l
+(
+Çme
+) \
+
+241 \r\12
+       `Çme
+ (\12
+__loÿË_t
+__THROW
+
+
+       )
+
+247 
+__exùy³_l
+ (
+i§Êum_l
+);
+
+248 
+__exùy³_l
+ (
+i§Íha_l
+);
+
+249 
+__exùy³_l
+ (
+isú\8cl_l
+);
+
+250 
+__exùy³_l
+ (
+isdig\99_l
+);
+
+251 
+__exùy³_l
+ (
+i¦ow\94_l
+);
+
+252 
+__exùy³_l
+ (
+isg¿ph_l
+);
+
+253 
+__exùy³_l
+ (
+i¥r\9at_l
+);
+
+254 
+__exùy³_l
+ (
+i¥unù_l
+);
+
+255 
+__exùy³_l
+ (
+is¥aû_l
+);
+
+256 
+__exùy³_l
+ (
+isuµ\94_l
+);
+
+257 
+__exùy³_l
+ (
+isxdig\99_l
+);
+
+259 
+__exùy³_l
+ (
+isbÏnk_l
+);
+
+263 \r\12
+       $__tÞow\94_l
+ (\12
+__c
+, 
+__loÿË_t
+__l
+__THROW
+;
+
+264 \r\12
+       $tÞow\94_l
+ (\12
+__c
+, 
+__loÿË_t
+__l
+__THROW
+;
+
+267 \r\12
+       $__touµ\94_l
+ (\12
+__c
+, 
+__loÿË_t
+__l
+__THROW
+;
+
+268 \r\12
+       $touµ\94_l
+ (\12
+__c
+, 
+__loÿË_t
+__l
+__THROW
+;
+
+270 #ià
+__GNUC__
+ >ð2 && 
+def\9aed
+__OPTIMIZE__
+ && !def\9aed 
+__ýlu¥lus
+
+
+271 \ 1
+       #__tÞow\94_l
+(
+c
+, 
+loÿË
+) \
+
+272 
+       `__tobody
+ (
+c
+, 
+__tÞow\94_l
+, (
+loÿË
+)->
+__ùy³_tÞow\94
+, (c,\86oÿË))
+
+       )
+
+273 \ 1
+       #__touµ\94_l
+(
+c
+, 
+loÿË
+) \
+
+274 
+       `__tobody
+ (
+c
+, 
+__touµ\94_l
+, (
+loÿË
+)->
+__ùy³_touµ\94
+, (c,\86oÿË))
+
+       )
+
+275 \ 1
+       #tÞow\94_l
+(
+c
+, 
+loÿË
+       `__tÞow\94_l
+ ((c), (loÿË))
+
+       )
+
+276 \ 1
+       #touµ\94_l
+(
+c
+, 
+loÿË
+       `__touµ\94_l
+ ((c), (loÿË))
+
+       )
+
+280 #iâdeà
+__NO_CTYPE
+
+
+281 \ 1
+       #__i§Êum_l
+(
+c
+,
+l
+       `__isùy³_l
+((c), 
+_IS®num
+, (l))
+
+       )
+
+282 \ 1
+       #__i§Íha_l
+(
+c
+,
+l
+       `__isùy³_l
+((c), 
+_IS®pha
+, (l))
+
+       )
+
+283 \ 1
+       #__isú\8cl_l
+(
+c
+,
+l
+       `__isùy³_l
+((c), 
+_ISú\8cl
+, (l))
+
+       )
+
+284 \ 1
+       #__isdig\99_l
+(
+c
+,
+l
+       `__isùy³_l
+((c), 
+_ISdig\99
+, (l))
+
+       )
+
+285 \ 1
+       #__i¦ow\94_l
+(
+c
+,
+l
+       `__isùy³_l
+((c), 
+_ISlow\94
+, (l))
+
+       )
+
+286 \ 1
+       #__isg¿ph_l
+(
+c
+,
+l
+       `__isùy³_l
+((c), 
+_ISg¿ph
+, (l))
+
+       )
+
+287 \ 1
+       #__i¥r\9at_l
+(
+c
+,
+l
+       `__isùy³_l
+((c), 
+_IS´\9at
+, (l))
+
+       )
+
+288 \ 1
+       #__i¥unù_l
+(
+c
+,
+l
+       `__isùy³_l
+((c), 
+_ISpunù
+, (l))
+
+       )
+
+289 \ 1
+       #__is¥aû_l
+(
+c
+,
+l
+       `__isùy³_l
+((c), 
+_IS¥aû
+, (l))
+
+       )
+
+290 \ 1
+       #__isuµ\94_l
+(
+c
+,
+l
+       `__isùy³_l
+((c), 
+_ISuµ\94
+, (l))
+
+       )
+
+291 \ 1
+       #__isxdig\99_l
+(
+c
+,
+l
+       `__isùy³_l
+((c), 
+_ISxdig\99
+, (l))
+
+       )
+
+293 \ 1
+       #__isbÏnk_l
+(
+c
+,
+l
+       `__isùy³_l
+((c), 
+_ISbÏnk
+, (l))
+
+       )
+
+295 #ià
+def\9aed
+__USE_SVID
+ || def\9aed 
+__USE_MISC
+
+
+296 \ 1
+       #__i§scii_l
+(
+c
+,
+l
+è(Ö), 
+       `__i§scii
+ (c))
+
+       )
+
+297 \ 1
+       #__tßscii_l
+(
+c
+,
+l
+è(Ö), 
+       `__tßscii
+ (c))
+
+       )
+
+300 \ 1
+       #i§Êum_l
+(
+c
+,
+l
+       `__i§Êum_l
+ ((c), (l))
+
+       )
+
+301 \ 1
+       #i§Íha_l
+(
+c
+,
+l
+       `__i§Íha_l
+ ((c), (l))
+
+       )
+
+302 \ 1
+       #isú\8cl_l
+(
+c
+,
+l
+       `__isú\8cl_l
+ ((c), (l))
+
+       )
+
+303 \ 1
+       #isdig\99_l
+(
+c
+,
+l
+       `__isdig\99_l
+ ((c), (l))
+
+       )
+
+304 \ 1
+       #i¦ow\94_l
+(
+c
+,
+l
+       `__i¦ow\94_l
+ ((c), (l))
+
+       )
+
+305 \ 1
+       #isg¿ph_l
+(
+c
+,
+l
+       `__isg¿ph_l
+ ((c), (l))
+
+       )
+
+306 \ 1
+       #i¥r\9at_l
+(
+c
+,
+l
+       `__i¥r\9at_l
+ ((c), (l))
+
+       )
+
+307 \ 1
+       #i¥unù_l
+(
+c
+,
+l
+       `__i¥unù_l
+ ((c), (l))
+
+       )
+
+308 \ 1
+       #is¥aû_l
+(
+c
+,
+l
+       `__is¥aû_l
+ ((c), (l))
+
+       )
+
+309 \ 1
+       #isuµ\94_l
+(
+c
+,
+l
+       `__isuµ\94_l
+ ((c), (l))
+
+       )
+
+310 \ 1
+       #isxdig\99_l
+(
+c
+,
+l
+       `__isxdig\99_l
+ ((c), (l))
+
+       )
+
+312 \ 1
+       #isbÏnk_l
+(
+c
+,
+l
+       `__isbÏnk_l
+ ((c), (l))
+
+       )
+
+314 #ià
+def\9aed
+__USE_SVID
+ || def\9aed 
+__USE_MISC
+
+
+315 \ 1
+       #i§scii_l
+(
+c
+,
+l
+       `__i§scii_l
+ ((c), (l))
+
+       )
+
+316 \ 1
+       #tßscii_l
+(
+c
+,
+l
+       `__tßscii_l
+ ((c), (l))
+
+       )
+
+323 
+__END_DECLS
+
+
+       @/usr/include/gnu/stubs.h
+
+4 \ 2
+       ~<b\99s/wÜdsize.h
+>
+
+6 #ià
+__WORDSIZE
+ == 32
+
+7 \ 2
+       ~<gnu/¡ubs-32.h
+>
+
+8 #\96
+__WORDSIZE
+ == 64
+
+9 \ 2
+       ~<gnu/¡ubs-64.h
+>
+
+       @/usr/include/linux/errno.h
+
+1 #iâdeà
+_LINUX_ERRNO_H
+
+
+2 \ 1
+       #_LINUX_ERRNO_H
+
+
+       )
+
+4 \ 2
+       ~<asm/\94ºo.h
+>
+
+       @/usr/include/bits/libc-lock.h
+
+20 #iâdeà
+_BITS_LIBC_LOCK_H
+
+
+21 \ 1
+       #_BITS_LIBC_LOCK_H
+ 1
+
+       )
+
+23 \ 2
+       ~<±h»ad.h
+>
+
+24 \ 1
+       #__Ãed_NULL
+
+
+       )
+
+25 \ 2
+       ~<¡ddef.h
+>
+
+34 #ifdeà
+_LIBC
+
+
+35 \ 2
+       ~<lowËv\96lock.h
+>
+
+36 \ 2
+       ~<\8es.h
+>
+
+37 \ 2
+       ~<±h»ad-funùiÚs.h
+>
+
+38 \ 2
+       ~<\94ºo.h
+>
+
+39 \ 2
+       ~<gnu/ÝtiÚ-groups.h
+>
+
+43 #ià
+def\9aed
+_LIBC
+ || def\9aed 
+_IO_MTSAFE_IO
+
+
+44 #ià(
+def\9aed
+NOT_IN_libc
+ && !def\9aed 
+IS_IN_lib±h»ad
+è|| !def\9aed 
+_LIBC
+
+
+45 \e
+±h»ad_mu\8bx_t
+       t__libc_lock_t
+;
+
+46 \e¡ruù { 
+±h»ad_mu\8bx_t
+       mmu\8bx
+; } 
+       t__libc_lock_»cursive_t
+;
+
+48 \e\12
+       t__libc_lock_t
+;
+
+49 \e¡ruù { \12
+       mlock
+; \12
+       mút
+; \1e*
+       mowÃr
+; } 
+       t__libc_lock_»cursive_t
+;
+
+51 \e¡ruù { 
+±h»ad_mu\8bx_t
+       mmu\8bx
+; } 
+       t__¹ld_lock_»cursive_t
+;
+
+52 #ifdeà
+__USE_UNIX98
+
+
+53 \e
+±h»ad_rwlock_t
+       t__libc_rwlock_t
+;
+
+55 \e\19
+__libc_rwlock_Ýaque__
+       t__libc_rwlock_t
+;
+
+58 \e\19
+__libc_lock_Ýaque__
+       t__libc_lock_t
+;
+
+59 \e\19
+__libc_lock_»cursive_Ýaque__
+       t__libc_lock_»cursive_t
+;
+
+60 \e\19
+__libc_rwlock_Ýaque__
+       t__libc_rwlock_t
+;
+
+64 \e
+±h»ad_key_t
+       t__libc_key_t
+;
+
+73 \ 1
+       #__libc_lock_def\9ae
+(
+CLASS
+,
+NAME
+) \
+
+74 
+CLASS
+__libc_lock_t
+NAME
+;
+
+       )
+
+75 \ 1
+       #__libc_rwlock_def\9ae
+(
+CLASS
+,
+NAME
+) \
+
+76 
+CLASS
+__libc_rwlock_t
+NAME
+;
+
+       )
+
+77 \ 1
+       #__libc_lock_def\9ae_»cursive
+(
+CLASS
+,
+NAME
+) \
+
+78 
+CLASS
+__libc_lock_»cursive_t
+NAME
+;
+
+       )
+
+79 \ 1
+       #__¹ld_lock_def\9ae_»cursive
+(
+CLASS
+,
+NAME
+) \
+
+80 
+CLASS
+__¹ld_lock_»cursive_t
+NAME
+;
+
+       )
+
+91 #ià
+def\9aed
+_LIBC
+ && (!def\9aed 
+NOT_IN_libc
+ || def\9aed 
+IS_IN_lib±h»ad
+)
+
+92 #ià
+LLL_LOCK_INITIALIZER
+ == 0
+
+93 \ 1
+       #__libc_lock_def\9ae_\9a\99\9flized
+(
+CLASS
+,
+NAME
+) \
+
+94 
+CLASS
+__libc_lock_t
+NAME
+;
+
+       )
+
+96 \ 1
+       #__libc_lock_def\9ae_\9a\99\9flized
+(
+CLASS
+,
+NAME
+) \
+
+97 
+CLASS
+__libc_lock_t
+NAME
+ = 
+LLL_LOCK_INITIALIZER
+;
+
+       )
+
+100 #ià
+__LT_SPINLOCK_INIT
+ == 0
+
+101 \ 1
+       #__libc_lock_def\9ae_\9a\99\9flized
+(
+CLASS
+,
+NAME
+) \
+
+102 
+CLASS
+__libc_lock_t
+NAME
+;
+
+       )
+
+104 \ 1
+       #__libc_lock_def\9ae_\9a\99\9flized
+(
+CLASS
+,
+NAME
+) \
+
+105 
+CLASS
+__libc_lock_t
+NAME
+ = 
+PTHREAD_MUTEX_INITIALIZER
+;
+
+       )
+
+109 \ 1
+       #__libc_rwlock_def\9ae_\9a\99\9flized
+(
+CLASS
+,
+NAME
+) \
+
+110 
+CLASS
+__libc_rwlock_t
+NAME
+ = 
+PTHREAD_RWLOCK_INITIALIZER
+;
+
+       )
+
+114 #ià
+def\9aed
+_LIBC
+ && (!def\9aed 
+NOT_IN_libc
+ || def\9aed 
+IS_IN_lib±h»ad
+)
+
+115 #ià
+LLL_LOCK_INITIALIZER
+ == 0
+
+116 \ 1
+       #__libc_lock_def\9ae_\9a\99\9flized_»cursive
+(
+CLASS
+,
+NAME
+) \
+
+117 
+CLASS
+__libc_lock_»cursive_t
+NAME
+;
+
+       )
+
+119 \ 1
+       #__libc_lock_def\9ae_\9a\99\9flized_»cursive
+(
+CLASS
+,
+NAME
+) \
+
+120 
+CLASS
+__libc_lock_»cursive_t
+NAME
+ = 
+_LIBC_LOCK_RECURSIVE_INITIALIZER
+;
+
+       )
+
+122 \ 1
+       #_LIBC_LOCK_RECURSIVE_INITIALIZER
+ \
+
+123 { 
+LLL_LOCK_INITIALIZER
+, 0, 
+NULL
+ }
+
+       )
+
+125 \ 1
+       #__libc_lock_def\9ae_\9a\99\9flized_»cursive
+(
+CLASS
+,
+NAME
+) \
+
+126 
+CLASS
+__libc_lock_»cursive_t
+NAME
+ = 
+_LIBC_LOCK_RECURSIVE_INITIALIZER
+;
+
+       )
+
+127 \ 1
+       #_LIBC_LOCK_RECURSIVE_INITIALIZER
+ \
+
+128 {
+PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
+}
+
+       )
+
+131 \ 1
+       #__¹ld_lock_def\9ae_\9a\99\9flized_»cursive
+(
+CLASS
+,
+NAME
+) \
+
+132 
+CLASS
+__¹ld_lock_»cursive_t
+NAME
+ = 
+_RTLD_LOCK_RECURSIVE_INITIALIZER
+;
+
+       )
+
+133 \ 1
+       #_RTLD_LOCK_RECURSIVE_INITIALIZER
+ \
+
+134 {
+PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
+}
+
+       )
+
+136 \ 1
+       #__¹ld_lock_\9a\99\9flize
+(
+NAME
+) \
+
+137 (\1eè((
+NAME
+èð(
+__¹ld_lock_»cursive_t
+_RTLD_LOCK_RECURSIVE_INITIALIZER
+)
+
+       )
+
+144 #ifdeà
+__PIC__
+
+
+145 \ 1
+       #__libc_maybe_ÿÎ
+(
+FUNC
+, 
+ARGS
+, 
+ELSE
+) \
+
+146 (
+       `__ex\8bnsiÚ__
+ ({ 
+       `__ty³of
+ (
+FUNC
+è*
+_â
+ = (FUNC); \
+
+147 
+_â
+ !ð
+NULL
+ ? (*_âè
+ARGS
+ : 
+ELSE
+; }))
+
+       )
+
+149 \ 1
+       #__libc_maybe_ÿÎ
+(
+FUNC
+, 
+ARGS
+, 
+ELSE
+) \
+
+150 (
+FUNC
+ !ð
+NULL
+ ? FUNC 
+ARGS
+ : 
+ELSE
+)
+
+       )
+
+154 #ià
+def\9aed
+SHARED
+ && !def\9aed 
+NOT_IN_libc
+
+
+155 \ 1
+       #PTFAVAIL
+(
+NAME
+__libc_±h»ad_funùiÚs_\9a\99
+
+
+       )
+
+156 \ 1
+       #__libc_±f_ÿÎ
+(
+FUNC
+, 
+ARGS
+, 
+ELSE
+) \
+
+157 (
+__libc_±h»ad_funùiÚs_\9a\99
+ ? 
+       `PTHFCT_CALL
+ (
+±r_
+##
+FUNC
+, 
+ARGS
+è: 
+ELSE
+)
+
+       )
+
+158 \ 1
+       #__libc_±f_ÿÎ_®ways
+(
+FUNC
+, 
+ARGS
+) \
+
+159 
+       `PTHFCT_CALL
+ (
+±r_
+##
+FUNC
+, 
+ARGS
+)
+
+       )
+
+161 \ 1
+       #PTFAVAIL
+(
+NAME
+è(NAME !ð
+NULL
+)
+
+       )
+
+162 \ 1
+       #__libc_±f_ÿÎ
+(
+FUNC
+, 
+ARGS
+, 
+ELSE
+) \
+
+163 
+       `__libc_maybe_ÿÎ
+ (
+FUNC
+, 
+ARGS
+, 
+ELSE
+)
+
+       )
+
+164 \ 1
+       #__libc_±f_ÿÎ_®ways
+(
+FUNC
+, 
+ARGS
+) \
+
+165 
+FUNC
+ARGS
+
+
+       )
+
+171 #ià
+def\9aed
+_LIBC
+ && (!def\9aed 
+NOT_IN_libc
+ || def\9aed 
+IS_IN_lib±h»ad
+)
+
+172 \ 1
+       #__libc_lock_\9a\99
+(
+NAME
+è((NAMEèð
+LLL_LOCK_INITIALIZER
+, 0)
+
+       )
+
+174 \ 1
+       #__libc_lock_\9a\99
+(
+NAME
+) \
+
+175 
+       `__libc_maybe_ÿÎ
+ (
+__±h»ad_mu\8bx_\9a\99
+, (&(
+NAME
+), 
+NULL
+), 0)
+
+       )
+
+177 #ià
+def\9aed
+SHARED
+ && !def\9aed 
+NOT_IN_libc
+
+
+180 \ 1
+       #__libc_rwlock_\9a\99
+(
+NAME
+) \
+
+181 (
+       `__bu\9et\9a_mem£t
+ (&(
+NAME
+), '\0', \17 (NAME)), 0)
+
+       )
+
+183 \ 1
+       #__libc_rwlock_\9a\99
+(
+NAME
+) \
+
+184 
+       `__libc_maybe_ÿÎ
+ (
+__±h»ad_rwlock_\9a\99
+, (&(
+NAME
+), 
+NULL
+), 0)
+
+       )
+
+188 #ià
+def\9aed
+_LIBC
+ && (!def\9aed 
+NOT_IN_libc
+ || def\9aed 
+IS_IN_lib±h»ad
+)
+
+189 \ 1
+       #__libc_lock_\9a\99_»cursive
+(
+NAME
+) \
+
+190 ((
+NAME
+èð(
+__libc_lock_»cursive_t
+_LIBC_LOCK_RECURSIVE_INITIALIZER
+, 0)
+
+       )
+
+192 \ 1
+       #__libc_lock_\9a\99_»cursive
+(
+NAME
+) \
+
+194 ià(
+__±h»ad_mu\8bx_\9a\99
+ !ð
+NULL
+) \
+
+196 
+±h»ad_mu\8b\8c_t
+__©\8c
+; \
+
+197 
+       `__±h»ad_mu\8b\8c_\9a\99
+ (&
+__©\8c
+); \
+
+198 
+       `__±h»ad_mu\8b\8c\89
+ (&
+__©\8c
+, 
+PTHREAD_MUTEX_RECURSIVE_NP
+); \
+
+199 
+       `__±h»ad_mu\8bx_\9a\99
+ (&(
+NAME
+).
+mu\8bx
+, &
+__©\8c
+); \
+
+200 
+       `__±h»ad_mu\8b\8c_de¡roy
+ (&
+__©\8c
+); \
+
+202 } \1f0)
+
+       )
+
+205 \ 1
+       #__¹ld_lock_\9a\99_»cursive
+(
+NAME
+) \
+
+207 ià(
+__±h»ad_mu\8bx_\9a\99
+ !ð
+NULL
+) \
+
+209 
+±h»ad_mu\8b\8c_t
+__©\8c
+; \
+
+210 
+       `__±h»ad_mu\8b\8c_\9a\99
+ (&
+__©\8c
+); \
+
+211 
+       `__±h»ad_mu\8b\8c\89
+ (&
+__©\8c
+, 
+PTHREAD_MUTEX_RECURSIVE_NP
+); \
+
+212 
+       `__±h»ad_mu\8bx_\9a\99
+ (&(
+NAME
+).
+mu\8bx
+, &
+__©\8c
+); \
+
+213 
+       `__±h»ad_mu\8b\8c_de¡roy
+ (&
+__©\8c
+); \
+
+215 } \1f0)
+
+       )
+
+220 #ià
+def\9aed
+_LIBC
+ && (!def\9aed 
+NOT_IN_libc
+ || def\9aed 
+IS_IN_lib±h»ad
+)
+
+221 \ 1
+       #__libc_lock_f\9ai
+(
+NAME
+è((\1eè0)
+
+       )
+
+223 \ 1
+       #__libc_lock_f\9ai
+(
+NAME
+) \
+
+224 
+       `__libc_maybe_ÿÎ
+ (
+__±h»ad_mu\8bx_de¡roy
+, (&(
+NAME
+)), 0)
+
+       )
+
+226 #ià
+def\9aed
+SHARED
+ && !def\9aed 
+NOT_IN_libc
+
+
+227 \ 1
+       #__libc_rwlock_f\9ai
+(
+NAME
+è((\1eè0)
+
+       )
+
+229 \ 1
+       #__libc_rwlock_f\9ai
+(
+NAME
+) \
+
+230 
+       `__libc_maybe_ÿÎ
+ (
+__±h»ad_rwlock_de¡roy
+, (&(
+NAME
+)), 0)
+
+       )
+
+234 #ià
+def\9aed
+_LIBC
+ && (!def\9aed 
+NOT_IN_libc
+ || def\9aed 
+IS_IN_lib±h»ad
+)
+
+235 \ 1
+       #__libc_lock_f\9ai_»cursive
+(
+NAME
+è((\1eè0)
+
+       )
+
+237 \ 1
+       #__libc_lock_f\9ai_»cursive
+(
+NAME
+) \
+
+238 
+       `__libc_maybe_ÿÎ
+ (
+__±h»ad_mu\8bx_de¡roy
+, (&(
+NAME
+)), 0)
+
+       )
+
+242 #ià
+def\9aed
+_LIBC
+ && (!def\9aed 
+NOT_IN_libc
+ || def\9aed 
+IS_IN_lib±h»ad
+)
+
+243 #ià
+__OPTION_EGLIBC_BIG_MACROS
+ != 1
+
+247 \r\1e
+__libc_lock_lock_â
+ (
+__libc_lock_t
+ *);
+
+248 
+libc_hidd\92_´Ùo
+ (
+__libc_lock_lock_â
+);
+
+250 #ià
+__OPTION_EGLIBC_BIG_MACROS
+
+
+251 \ 1
+       #__libc_lock_lock
+(
+NAME
+) \
+
+252 ({ 
+       `Îl_lock
+ (
+NAME
+, 
+LLL_PRIVATE
+); 0; })
+
+       )
+
+254 \ 1
+       #__libc_lock_lock
+(
+NAME
+) \
+
+255 
+       `__libc_lock_lock_â
+ (&(
+NAME
+))
+
+       )
+
+258 \ 1
+       #__libc_lock_lock
+(
+NAME
+) \
+
+259 
+       `__libc_maybe_ÿÎ
+ (
+__±h»ad_mu\8bx_lock
+, (&(
+NAME
+)), 0)
+
+       )
+
+261 \ 1
+       #__libc_rwlock_rdlock
+(
+NAME
+) \
+
+262 
+       `__libc_±f_ÿÎ
+ (
+__±h»ad_rwlock_rdlock
+, (&(
+NAME
+)), 0)
+
+       )
+
+263 \ 1
+       #__libc_rwlock_w¾ock
+(
+NAME
+) \
+
+264 
+       `__libc_±f_ÿÎ
+ (
+__±h»ad_rwlock_w¾ock
+, (&(
+NAME
+)), 0)
+
+       )
+
+267 #ià
+def\9aed
+_LIBC
+ && (!def\9aed 
+NOT_IN_libc
+ || def\9aed 
+IS_IN_lib±h»ad
+)
+
+268 #ià
+__OPTION_EGLIBC_BIG_MACROS
+ != 1
+
+272 \r\1e
+__libc_lock_lock_»cursive_â
+ (
+__libc_lock_»cursive_t
+ *);
+
+273 
+libc_hidd\92_´Ùo
+ (
+__libc_lock_lock_»cursive_â
+);
+
+275 #ià
+__OPTION_EGLIBC_BIG_MACROS
+
+
+276 \ 1
+       #__libc_lock_lock_»cursive
+(
+NAME
+) \
+
+278 \1e*
+£lf
+ = 
+THREAD_SELF
+; \
+
+279 ià((
+NAME
+).
+owÃr
+ !ð
+£lf
+) \
+
+281 
+       `Îl_lock
+ ((
+NAME
+).
+lock
+, 
+LLL_PRIVATE
+); \
+
+282 (
+NAME
+).
+owÃr
+ = 
+£lf
+; \
+
+284 ++(
+NAME
+).
+út
+; \
+
+285 } \1f0)
+
+       )
+
+287 \ 1
+       #__libc_lock_lock_»cursive
+(
+NAME
+) \
+
+288 
+       `__libc_lock_lock_»cursive_â
+ (&(
+NAME
+))
+
+       )
+
+291 \ 1
+       #__libc_lock_lock_»cursive
+(
+NAME
+) \
+
+292 
+       `__libc_maybe_ÿÎ
+ (
+__±h»ad_mu\8bx_lock
+, (&(
+NAME
+).
+mu\8bx
+), 0)
+
+       )
+
+296 #ià
+def\9aed
+_LIBC
+ && (!def\9aed 
+NOT_IN_libc
+ || def\9aed 
+IS_IN_lib±h»ad
+)
+
+297 #ià
+__OPTION_EGLIBC_BIG_MACROS
+ != 1
+
+301 \r\12
+__libc_lock_\8cylock_â
+ (
+__libc_lock_t
+ *);
+
+302 
+libc_hidd\92_´Ùo
+ (
+__libc_lock_\8cylock_â
+);
+
+304 #ià
+__OPTION_EGLIBC_BIG_MACROS
+
+
+305 \ 1
+       #__libc_lock_\8cylock
+(
+NAME
+) \
+
+306 
+       `Îl_\8cylock
+ (
+NAME
+)
+
+       )
+
+308 \ 1
+       #__libc_lock_\8cylock
+(
+NAME
+) \
+
+309 
+       `__libc_lock_\8cylock_â
+ (&(
+NAME
+))
+
+       )
+
+312 \ 1
+       #__libc_lock_\8cylock
+(
+NAME
+) \
+
+313 
+       `__libc_maybe_ÿÎ
+ (
+__±h»ad_mu\8bx_\8cylock
+, (&(
+NAME
+)), 0)
+
+       )
+
+315 \ 1
+       #__libc_rwlock_\8cyrdlock
+(
+NAME
+) \
+
+316 
+       `__libc_maybe_ÿÎ
+ (
+__±h»ad_rwlock_\8cyrdlock
+, (&(
+NAME
+)), 0)
+
+       )
+
+317 \ 1
+       #__libc_rwlock_\8cyw¾ock
+(
+NAME
+) \
+
+318 
+       `__libc_maybe_ÿÎ
+ (
+__±h»ad_rwlock_\8cyw¾ock
+, (&(
+NAME
+)), 0)
+
+       )
+
+321 #ià
+def\9aed
+_LIBC
+ && (!def\9aed 
+NOT_IN_libc
+ || def\9aed 
+IS_IN_lib±h»ad
+)
+
+322 #ià
+__OPTION_EGLIBC_BIG_MACROS
+ != 1
+
+326 \r\12
+__libc_lock_\8cylock_»cursive_â
+ (
+__libc_lock_»cursive_t
+ *);
+
+327 
+libc_hidd\92_´Ùo
+ (
+__libc_lock_\8cylock_»cursive_â
+);
+
+329 #ià
+__OPTION_EGLIBC_BIG_MACROS
+
+
+330 \ 1
+       #__libc_lock_\8cylock_»cursive
+(
+NAME
+) \
+
+332 \12
+»suÉ
+ = 0; \
+
+333 \1e*
+£lf
+ = 
+THREAD_SELF
+; \
+
+334 ià((
+NAME
+).
+owÃr
+ !ð
+£lf
+) \
+
+336 ià(
+       `Îl_\8cylock
+ ((
+NAME
+).
+lock
+) == 0) \
+
+338 (
+NAME
+).
+owÃr
+ = 
+£lf
+; \
+
+339 (
+NAME
+).
+út
+ = 1; \
+
+342 
+»suÉ
+ = 
+EBUSY
+; \
+
+345 ++(
+NAME
+).
+út
+; \
+
+346 
+»suÉ
+; \
+
+347 })
+
+       )
+
+349 \ 1
+       #__libc_lock_\8cylock_»cursive
+(
+NAME
+) \
+
+350 
+       `__libc_lock_\8cylock_»cursive_â
+ (&(
+NAME
+))
+
+       )
+
+353 \ 1
+       #__libc_lock_\8cylock_»cursive
+(
+NAME
+) \
+
+354 
+       `__libc_maybe_ÿÎ
+ (
+__±h»ad_mu\8bx_\8cylock
+, (&(
+NAME
+)), 0)
+
+       )
+
+357 \ 1
+       #__¹ld_lock_\8cylock_»cursive
+(
+NAME
+) \
+
+358 
+       `__libc_maybe_ÿÎ
+ (
+__±h»ad_mu\8bx_\8cylock
+, (&(
+NAME
+).
+mu\8bx
+), 0)
+
+       )
+
+361 #ià
+def\9aed
+_LIBC
+ && (!def\9aed 
+NOT_IN_libc
+ || def\9aed 
+IS_IN_lib±h»ad
+)
+
+362 #ià
+__OPTION_EGLIBC_BIG_MACROS
+ != 1
+
+366 \r\1e
+__libc_lock_uÆock_â
+ (
+__libc_lock_t
+ *);
+
+367 
+libc_hidd\92_´Ùo
+ (
+__libc_lock_uÆock_â
+);
+
+369 #ià
+__OPTION_EGLIBC_BIG_MACROS
+
+
+370 \ 1
+       #__libc_lock_uÆock
+(
+NAME
+) \
+
+371 
+       `Îl_uÆock
+ (
+NAME
+, 
+LLL_PRIVATE
+)
+
+       )
+
+373 \ 1
+       #__libc_lock_uÆock
+(
+NAME
+) \
+
+374 
+       `__libc_lock_uÆock_â
+ (&(
+NAME
+))
+
+       )
+
+377 \ 1
+       #__libc_lock_uÆock
+(
+NAME
+) \
+
+378 
+       `__libc_maybe_ÿÎ
+ (
+__±h»ad_mu\8bx_uÆock
+, (&(
+NAME
+)), 0)
+
+       )
+
+380 \ 1
+       #__libc_rwlock_uÆock
+(
+NAME
+) \
+
+381 
+       `__libc_±f_ÿÎ
+ (
+__±h»ad_rwlock_uÆock
+, (&(
+NAME
+)), 0)
+
+       )
+
+384 #ià
+def\9aed
+_LIBC
+ && (!def\9aed 
+NOT_IN_libc
+ || def\9aed 
+IS_IN_lib±h»ad
+)
+
+385 #ià
+__OPTION_EGLIBC_BIG_MACROS
+ != 1
+
+389 \r\1e
+__libc_lock_uÆock_»cursive_â
+ (
+__libc_lock_»cursive_t
+ *);
+
+390 
+libc_hidd\92_´Ùo
+ (
+__libc_lock_uÆock_»cursive_â
+);
+
+392 #ià
+__OPTION_EGLIBC_BIG_MACROS
+
+
+394 \ 1
+       #__libc_lock_uÆock_»cursive
+(
+NAME
+) \
+
+396 ià(--(
+NAME
+).
+út
+ == 0) \
+
+398 (
+NAME
+).
+owÃr
+ = 
+NULL
+; \
+
+399 
+       `Îl_uÆock
+ ((
+NAME
+).
+lock
+, 
+LLL_PRIVATE
+); \
+
+401 } \1f0)
+
+       )
+
+403 \ 1
+       #__libc_lock_uÆock_»cursive
+(
+NAME
+) \
+
+404 
+       `__libc_lock_uÆock_»cursive_â
+ (&(
+NAME
+))
+
+       )
+
+407 \ 1
+       #__libc_lock_uÆock_»cursive
+(
+NAME
+) \
+
+408 
+       `__libc_maybe_ÿÎ
+ (
+__±h»ad_mu\8bx_uÆock
+, (&(
+NAME
+)), 0)
+
+       )
+
+411 #ià
+def\9aed
+_LIBC
+ && def\9aed 
+SHARED
+
+
+412 \ 1
+       #__¹ld_lock_deçuÉ_lock_»cursive
+(
+lock
+) \
+
+413 ++((
+±h»ad_mu\8bx_t
+ *)(
+lock
+))->
+__d©a
+.
+__couÁ
+;
+
+       )
+
+415 \ 1
+       #__¹ld_lock_deçuÉ_uÆock_»cursive
+(
+lock
+) \
+
+416 --((
+±h»ad_mu\8bx_t
+ *)(
+lock
+))->
+__d©a
+.
+__couÁ
+;
+
+       )
+
+418 \ 1
+       #__¹ld_lock_lock_»cursive
+(
+NAME
+) \
+
+419 
+       `GL
+(
+dl_¹ld_lock_»cursive
+è(&(
+NAME
+).
+mu\8bx
+)
+
+       )
+
+421 \ 1
+       #__¹ld_lock_uÆock_»cursive
+(
+NAME
+) \
+
+422 
+       `GL
+(
+dl_¹ld_uÆock_»cursive
+è(&(
+NAME
+).
+mu\8bx
+)
+
+       )
+
+424 \ 1
+       #__¹ld_lock_lock_»cursive
+(
+NAME
+) \
+
+425 
+       `__libc_maybe_ÿÎ
+ (
+__±h»ad_mu\8bx_lock
+, (&(
+NAME
+).
+mu\8bx
+), 0)
+
+       )
+
+427 \ 1
+       #__¹ld_lock_uÆock_»cursive
+(
+NAME
+) \
+
+428 
+       `__libc_maybe_ÿÎ
+ (
+__±h»ad_mu\8bx_uÆock
+, (&(
+NAME
+).
+mu\8bx
+), 0)
+
+       )
+
+432 #ià
+PTHREAD_ONCE_INIT
+ == 0
+
+435 \ 1
+       #__libc_Úû_def\9ae
+(
+CLASS
+, 
+NAME
+) \
+
+436 
+CLASS
+±h»ad_Úû_t
+NAME
+
+
+       )
+
+438 \ 1
+       #__libc_Úû_def\9ae
+(
+CLASS
+, 
+NAME
+) \
+
+439 
+CLASS
+±h»ad_Úû_t
+NAME
+ = 
+PTHREAD_ONCE_INIT
+
+
+       )
+
+443 \ 1
+       #__libc_Úû
+(
+ONCE_CONTROL
+, 
+INIT_FUNCTION
+) \
+
+445 ià(
+       `PTFAVAIL
+ (
+__±h»ad_Úû
+)) \
+
+446 
+       `__libc_±f_ÿÎ_®ways
+ (
+__±h»ad_Úû
+, (&(
+ONCE_CONTROL
+), \
+
+447 
+INIT_FUNCTION
+)); \
+
+448 \vià((
+ONCE_CONTROL
+è=ð
+PTHREAD_ONCE_INIT
+) { \
+
+449 
+       `INIT_FUNCTION
+ (); \
+
+450 (
+ONCE_CONTROL
+) |= 2; \
+
+452 } \1f0)
+
+       )
+
+459 \r\1e
+_±h»ad_þ\97nup_push
+ (\19
+_±h»ad_þ\97nup_bufãr
+ *
+bufãr
+,
+
+460 \1e(*
+rout\9ae
+è(\1e*), \1e*
+¬g
+);
+
+461 \r\1e
+       `_±h»ad_þ\97nup_pÝ
+ (\19
+_±h»ad_þ\97nup_bufãr
+ *
+bufãr
+,
+
+462 \12
+execu\8b
+);
+
+463 \r\1e
+       `_±h»ad_þ\97nup_push_deãr
+ (\19
+_±h»ad_þ\97nup_bufãr
+ *
+bufãr
+,
+
+464 \1e(*
+rout\9ae
+è(\1e*), \1e*
+¬g
+);
+
+465 \r\1e
+       `_±h»ad_þ\97nup_pÝ_»¡Üe
+ (\19
+_±h»ad_þ\97nup_bufãr
+ *
+bufãr
+,
+
+466 \12
+execu\8b
+);
+
+469 \ 1
+       #__libc_þ\97nup_»giÚ_¡¬t
+(
+DOIT
+, 
+FCT
+, 
+ARG
+) \
+
+470 { \19
+_±h»ad_þ\97nup_bufãr
+_bufãr
+; \
+
+471 \12
+_ava\9e
+; \
+
+472 ià(
+DOIT
+) { \
+
+473 
+_ava\9e
+ = 
+       `PTFAVAIL
+ (
+_±h»ad_þ\97nup_push_deãr
+); \
+
+474 ià(
+_ava\9e
+) { \
+
+475 
+       `__libc_±f_ÿÎ_®ways
+ (
+_±h»ad_þ\97nup_push_deãr
+, (&
+_bufãr
+, 
+FCT
+, \
+
+476 
+ARG
+)); \
+
+478 
+_bufãr
+.
+__rout\9ae
+ = (
+FCT
+); \
+
+479 
+_bufãr
+.
+__¬g
+ = (
+ARG
+); \
+
+482 
+_ava\9e
+ = 0; \
+
+483 }
+
+       )
+
+486 \ 1
+       #__libc_þ\97nup_»giÚ_\92d
+(
+DOIT
+) \
+
+487 ià(
+_ava\9e
+) { \
+
+488 
+       `__libc_±f_ÿÎ_®ways
+ (
+_±h»ad_þ\97nup_pÝ_»¡Üe
+, (&
+_bufãr
+, 
+DOIT
+));\
+
+489 } \vià(
+DOIT
+) \
+
+490 
+_bufãr
+.
+       `__rout\9ae
+ (_bufãr.
+__¬g
+); \
+
+491 
+       }
+
+       )
+}
+
+494 \ 1
+       #__libc_þ\97nup_\92d
+(
+DOIT
+) \
+
+495 ià(
+_ava\9e
+) { \
+
+496 
+       `__libc_±f_ÿÎ_®ways
+ (
+_±h»ad_þ\97nup_pÝ_»¡Üe
+, (&
+_bufãr
+, 
+DOIT
+));\
+
+497 } \vià(
+DOIT
+) \
+
+498 
+_bufãr
+.
+       `__rout\9ae
+ (_bufãr.
+__¬g
+)
+
+       )
+
+502 
+__ex\8bº_\9al\9ae
\1e
+
+503 
+       $__libc_þ\97nup_rout\9ae
+ (\19
+__±h»ad_þ\97nup_äame
+ *
+f
+)
+
+505 ià(
+f
+->
+__do_\99
+)
+
+506 
+f
+->
+       `__ÿnûl_rout\9ae
+ (f->
+__ÿnûl_¬g
+);
+
+507 
+       }
+}
+
+509 \ 1
+       #__libc_þ\97nup_push
+(
+fù
+, 
+¬g
+) \
+
+511 \19
+__±h»ad_þ\97nup_äame
+__þäame
+ \
+
+512 
+       `__©\8cibu\8b__
+ ((
+       `__þ\97nup__
+ (
+__libc_þ\97nup_rout\9ae
+))) \
+
+513 ð{ .
+__ÿnûl_rout\9ae
+ = (
+fù
+), .
+__ÿnûl_¬g
+ = (
+¬g
+), \
+
+514 .
+__do_\99
+ = 1 };
+
+       )
+
+516 \ 1
+       #__libc_þ\97nup_pÝ
+(
+execu\8b
+) \
+
+517 
+__þäame
+.
+__do_\99
+ = (
+execu\8b
+); \
+
+518 } \1f0)
+
+       )
+
+522 \ 1
+       #__libc_key_ü\97\8b
+(
+KEY
+, 
+DESTRUCTOR
+) \
+
+523 
+       `__libc_±f_ÿÎ
+ (
+__±h»ad_key_ü\97\8b
+, (
+KEY
+, 
+DESTRUCTOR
+), 1)
+
+       )
+
+526 \ 1
+       #__libc_g\91¥ecific
+(
+KEY
+) \
+
+527 
+       `__libc_±f_ÿÎ
+ (
+__±h»ad_g\91¥ecific
+, (
+KEY
+), 
+NULL
+)
+
+       )
+
+530 \ 1
+       #__libc_£t¥ecific
+(
+KEY
+, 
+VALUE
+) \
+
+531 
+       `__libc_±f_ÿÎ
+ (
+__±h»ad_£t¥ecific
+, (
+KEY
+, 
+VALUE
+), 0)
+
+       )
+
+537 \ 1
+       #__libc_©fÜk
+(
+PREPARE
+, 
+PARENT
+, 
+CHILD
+) \
+
+538 
+       `__»gi¡\94_©fÜk
+ (
+PREPARE
+, 
+PARENT
+, 
+CHILD
+, 
+NULL
+)
+
+       )
+
+539 \r\12
+__»gi¡\94_©fÜk
+ (\1e(*
+__´\95¬e
+) (\1e),
+
+540 \1e(*
+__·»Á
+) (\1e),
+
+541 \1e(*
+__ch\9ed
+) (\1e),
+
+542 \1e*
+__dso_hªdË
+);
+
+547 \r\12
+       `__±h»ad_mu\8bx_\9a\99
+ (
+±h»ad_mu\8bx_t
+ *
+__mu\8bx
+,
+
+548 
+__cڡ
+±h»ad_mu\8b\8c_t
+ *
+__mu\8bx_©\8c
+);
+
+550 \r\12
+       `__±h»ad_mu\8bx_de¡roy
+ (
+±h»ad_mu\8bx_t
+ *
+__mu\8bx
+);
+
+552 \r\12
+       `__±h»ad_mu\8bx_\8cylock
+ (
+±h»ad_mu\8bx_t
+ *
+__mu\8bx
+);
+
+554 \r\12
+       `__±h»ad_mu\8bx_lock
+ (
+±h»ad_mu\8bx_t
+ *
+__mu\8bx
+);
+
+556 \r\12
+       `__±h»ad_mu\8bx_uÆock
+ (
+±h»ad_mu\8bx_t
+ *
+__mu\8bx
+);
+
+558 \r\12
+       `__±h»ad_mu\8b\8c_\9a\99
+ (
+±h»ad_mu\8b\8c_t
+ *
+__©\8c
+);
+
+560 \r\12
+       `__±h»ad_mu\8b\8c_de¡roy
+ (
+±h»ad_mu\8b\8c_t
+ *
+__©\8c
+);
+
+562 \r\12
+       `__±h»ad_mu\8b\8c\89
+ (
+±h»ad_mu\8b\8c_t
+ *
+__©\8c
+,
+
+563 \12
+__k\9ad
+);
+
+565 #ifdeà
+__USE_UNIX98
+
+
+566 \r\12
+       `__±h»ad_rwlock_\9a\99
+ (
+±h»ad_rwlock_t
+ *
+__rwlock
+,
+
+567 
+__cڡ
+±h»ad_rwlock©\8c_t
+ *
+__©\8c
+);
+
+569 \r\12
+       `__±h»ad_rwlock_de¡roy
+ (
+±h»ad_rwlock_t
+ *
+__rwlock
+);
+
+571 \r\12
+       `__±h»ad_rwlock_rdlock
+ (
+±h»ad_rwlock_t
+ *
+__rwlock
+);
+
+573 \r\12
+       `__±h»ad_rwlock_\8cyrdlock
+ (
+±h»ad_rwlock_t
+ *
+__rwlock
+);
+
+575 \r\12
+       `__±h»ad_rwlock_w¾ock
+ (
+±h»ad_rwlock_t
+ *
+__rwlock
+);
+
+577 \r\12
+       `__±h»ad_rwlock_\8cyw¾ock
+ (
+±h»ad_rwlock_t
+ *
+__rwlock
+);
+
+579 \r\12
+       `__±h»ad_rwlock_uÆock
+ (
+±h»ad_rwlock_t
+ *
+__rwlock
+);
+
+582 \r\12
+       `__±h»ad_key_ü\97\8b
+ (
+±h»ad_key_t
+ *
+__key
+,
+
+583 \1e(*
+__de¡r_funùiÚ
+) (\1e*));
+
+585 \r\12
+       `__±h»ad_£t¥ecific
+ (
+±h»ad_key_t
+__key
+,
+
+586 
+__cڡ
\1e*
+__po\9a\8br
+);
+
+588 \r\1e*
+       `__±h»ad_g\91¥ecific
+ (
+±h»ad_key_t
+__key
+);
+
+590 \r\12
+       `__±h»ad_Úû
+ (
+±h»ad_Úû_t
+ *
+__Úû_cÚ\8cÞ
+,
+
+591 \1e(*
+__\9a\99_rout\9ae
+) (\1e));
+
+593 \r\12
+       `__±h»ad_©fÜk
+ (\1e(*
+__´\95¬e
+) (\1e),
+
+594 \1e(*
+__·»Á
+) (\1e),
+
+595 \1e(*
+__ch\9ed
+) (\1e));
+
+601 #iâdeà
+__NO_WEAK_PTHREAD_ALIASES
+
+
+602 #ifdeà
+w\97k_ex\8bº
+
+
+603 #ià
+_LIBC
+
+
+604 \ 2
+       ~<bp-sym.h
+>
+
+606 \ 1
+       #BP_SYM
+(
+sym
+       )
+sym
+
+608 
+       `w\97k_ex\8bº
+ (
+       $BP_SYM
+ (
+__±h»ad_mu\8bx_\9a\99
+))
+
+609 
+       `w\97k_ex\8bº
+ (
+       $BP_SYM
+ (
+__±h»ad_mu\8bx_de¡roy
+))
+
+610 
+       `w\97k_ex\8bº
+ (
+       $BP_SYM
+ (
+__±h»ad_mu\8bx_lock
+))
+
+611 
+       `w\97k_ex\8bº
+ (
+       $BP_SYM
+ (
+__±h»ad_mu\8bx_\8cylock
+))
+
+612 
+       `w\97k_ex\8bº
+ (
+       $BP_SYM
+ (
+__±h»ad_mu\8bx_uÆock
+))
+
+613 
+       `w\97k_ex\8bº
+ (
+       $BP_SYM
+ (
+__±h»ad_mu\8b\8c_\9a\99
+))
+
+614 
+       `w\97k_ex\8bº
+ (
+       $BP_SYM
+ (
+__±h»ad_mu\8b\8c_de¡roy
+))
+
+615 
+       `w\97k_ex\8bº
+ (
+       $BP_SYM
+ (
+__±h»ad_mu\8b\8c\89
+))
+
+616 
+       `w\97k_ex\8bº
+ (
+       $BP_SYM
+ (
+__±h»ad_rwlock_\9a\99
+))
+
+617 
+       `w\97k_ex\8bº
+ (
+       $BP_SYM
+ (
+__±h»ad_rwlock_de¡roy
+))
+
+618 
+       `w\97k_ex\8bº
+ (
+       $BP_SYM
+ (
+__±h»ad_rwlock_rdlock
+))
+
+619 
+       `w\97k_ex\8bº
+ (
+       $BP_SYM
+ (
+__±h»ad_rwlock_\8cyrdlock
+))
+
+620 
+       `w\97k_ex\8bº
+ (
+       $BP_SYM
+ (
+__±h»ad_rwlock_w¾ock
+))
+
+621 
+       `w\97k_ex\8bº
+ (
+       $BP_SYM
+ (
+__±h»ad_rwlock_\8cyw¾ock
+))
+
+622 
+       `w\97k_ex\8bº
+ (
+       $BP_SYM
+ (
+__±h»ad_rwlock_uÆock
+))
+
+623 
+       `w\97k_ex\8bº
+ (
+       $BP_SYM
+ (
+__±h»ad_key_ü\97\8b
+))
+
+624 
+       `w\97k_ex\8bº
+ (
+       $BP_SYM
+ (
+__±h»ad_£t¥ecific
+))
+
+625 
+       `w\97k_ex\8bº
+ (
+       $BP_SYM
+ (
+__±h»ad_g\91¥ecific
+))
+
+626 
+       `w\97k_ex\8bº
+ (
+       $BP_SYM
+ (
+__±h»ad_Úû
+))
+
+627 
+       $w\97k_ex\8bº
+ (
+__±h»ad_\9a\99\9flize
+)
+
+628 
+       $w\97k_ex\8bº
+ (
+__±h»ad_©fÜk
+)
+
+629 
+       `w\97k_ex\8bº
+ (
+       $BP_SYM
+ (
+_±h»ad_þ\97nup_push_deãr
+))
+
+630 
+       `w\97k_ex\8bº
+ (
+       $BP_SYM
+ (
+_±h»ad_þ\97nup_pÝ_»¡Üe
+))
+
+631 
+       `w\97k_ex\8bº
+ (
+       $BP_SYM
+ (
+±h»ad_£tÿnûl¡©e
+))
+
+633 #´agm¨
+w\97k
+__±h»ad_mu\8bx_\9a\99
+
+
+634 #´agm¨
+w\97k
+__±h»ad_mu\8bx_de¡roy
+
+
+635 #´agm¨
+w\97k
+__±h»ad_mu\8bx_lock
+
+
+636 #´agm¨
+w\97k
+__±h»ad_mu\8bx_\8cylock
+
+
+637 #´agm¨
+w\97k
+__±h»ad_mu\8bx_uÆock
+
+
+638 #´agm¨
+w\97k
+__±h»ad_mu\8b\8c_\9a\99
+
+
+639 #´agm¨
+w\97k
+__±h»ad_mu\8b\8c_de¡roy
+
+
+640 #´agm¨
+w\97k
+__±h»ad_mu\8b\8c\89
+
+
+641 #´agm¨
+w\97k
+__±h»ad_rwlock_de¡roy
+
+
+642 #´agm¨
+w\97k
+__±h»ad_rwlock_rdlock
+
+
+643 #´agm¨
+w\97k
+__±h»ad_rwlock_\8cyrdlock
+
+
+644 #´agm¨
+w\97k
+__±h»ad_rwlock_w¾ock
+
+
+645 #´agm¨
+w\97k
+__±h»ad_rwlock_\8cyw¾ock
+
+
+646 #´agm¨
+w\97k
+__±h»ad_rwlock_uÆock
+
+
+647 #´agm¨
+w\97k
+__±h»ad_key_ü\97\8b
+
+
+648 #´agm¨
+w\97k
+__±h»ad_£t¥ecific
+
+
+649 #´agm¨
+w\97k
+__±h»ad_g\91¥ecific
+
+
+650 #´agm¨
+w\97k
+__±h»ad_Úû
+
+
+651 #´agm¨
+w\97k
+__±h»ad_\9a\99\9flize
+
+
+652 #´agm¨
+w\97k
+__±h»ad_©fÜk
+
+
+653 #´agm¨
+w\97k
+_±h»ad_þ\97nup_push_deãr
+
+
+654 #´agm¨
+w\97k
+_±h»ad_þ\97nup_pÝ_»¡Üe
+
+
+655 #´agm¨
+w\97k
+±h»ad_£tÿnûl¡©e
+
+
+       @/usr/include/gconv.h
+
+23 #iâdeà
+_GCONV_H
+
+
+24 \ 1
+       #_GCONV_H
+ 1
+
+       )
+
+26 \ 2
+       ~<ã©u»s.h
+>
+
+27 \ 1
+       #__Ãed_mb¡©e_t
+
+
+       )
+
+28 \ 1
+       #__Ãed_w\9at_t
+
+
+       )
+
+29 \ 2
+       ~<wch¬.h
+>
+
+30 \ 1
+       #__Ãed_size_t
+
+
+       )
+
+31 \ 1
+       #__Ãed_wch¬_t
+
+
+       )
+
+32 \ 2
+       ~<¡ddef.h
+>
+
+35 \ 1
+       #__UNKNOWN_10646_CHAR
+ ((
+wch¬_t
+è0xfffd)
+
+       )
+
+40 
+       m__GCONV_OK
+ = 0,
+
+41 
+       m__GCONV_NOCONV
+,
+
+42 
+       m__GCONV_NODB
+,
+
+43 
+       m__GCONV_NOMEM
+,
+
+45 
+       m__GCONV_EMPTY_INPUT
+,
+
+46 
+       m__GCONV_FULL_OUTPUT
+,
+
+47 
+       m__GCONV_ILLEGAL_INPUT
+,
+
+48 
+       m__GCONV_INCOMPLETE_INPUT
+,
+
+50 
+       m__GCONV_ILLEGAL_DESCRIPTOR
+,
+
+51 
+       m__GCONV_INTERNAL_ERROR
+
+
+58 
+       m__GCONV_IS_LAST
+ = 0x0001,
+
+59 
+       m__GCONV_IGNORE_ERRORS
+ = 0x0002
+
+64 \19
+       g__gcÚv_¡\95
+;
+
+65 \19
+       g__gcÚv_¡\95_d©a
+;
+
+66 \19
+       g__gcÚv_lßded_objeù
+;
+
+67 \19
+       g__gcÚv_\8cªs_d©a
+;
+
+71 \e\12(*
+       t__gcÚv_fù
+è(\19
+       t__gcÚv_¡\95
+ *, \19
+       t__gcÚv_¡\95_d©a
+ *,
+
+72 
+       t__cڡ
\1d\ 5**, __const \1d\ 5*,
+
+73 \1d\ 5**, 
+       tsize_t
+ *, \12\12);
+
+76 \e
+       $w\9at_t
+ (*
+       t__gcÚv_btowc_fù
+è(\19
+       t__gcÚv_¡\95
+ *, \1d\ 5);
+
+79 \e\12(*
+       t__gcÚv_\9a\99_fù
+è(\19
+       t__gcÚv_¡\95
+ *);
+
+80 \e\1e(*
+       t__gcÚv_\92d_fù
+è(\19
+       t__gcÚv_¡\95
+ *);
+
+84 \e\12(*
+       t__gcÚv_\8cªs_fù
+è(\19
+       t__gcÚv_¡\95
+ *,
+
+85 \19
+       t__gcÚv_¡\95_d©a
+ *, \1e*,
+
+86 
+       t__cڡ
\1d\ 5*,
+
+87 
+       t__cڡ
\1d\ 5**,
+
+88 
+       t__cڡ
\1d\ 5*, \1d\ 5**,
+
+89 
+       tsize_t
+ *);
+
+92 \e\12(*
+       t__gcÚv_\8cªs_cÚ\8bxt_fù
+è(\1e*, 
+       t__cڡ
\1d\ 5*,
+
+93 
+       t__cڡ
\1d\ 5*,
+
+97 \e\12(*
+       t__gcÚv_\8cªs_qu\94y_fù
+è(
+       t__cڡ
\ 5*, __const \ 5***,
+
+98 
+       tsize_t
+ *);
+
+101 \e\12(*
+       t__gcÚv_\8cªs_\9a\99_fù
+) (\1e**, const \ 5*);
+
+102 \e\1e(*
+       t__gcÚv_\8cªs_\92d_fù
+) (\1e*);
+
+104 \19
+       s__gcÚv_\8cªs_d©a
+
+
+107 
+__gcÚv_\8cªs_fù
+__\8cªs_fù
+;
+
+108 
+__gcÚv_\8cªs_cÚ\8bxt_fù
+__\8cªs_cÚ\8bxt_fù
+;
+
+109 
+__gcÚv_\8cªs_\92d_fù
+__\8cªs_\92d_fù
+;
+
+110 \1e*
+__d©a
+;
+
+111 \19
+__gcÚv_\8cªs_d©a
+ *
+__Ãxt
+;
+
+116 \19
+       s__gcÚv_¡\95
+
+
+118 \19
+__gcÚv_lßded_objeù
+ *
+__shlib_hªdË
+;
+
+119 
+__cڡ
\ 5*
+__modÇme
+;
+
+121 \12
+__couÁ\94
+;
+
+123 \ 5*
+__äom_Çme
+;
+
+124 \ 5*
+__to_Çme
+;
+
+126 
+__gcÚv_fù
+__fù
+;
+
+127 
+__gcÚv_btowc_fù
+__btowc_fù
+;
+
+128 
+__gcÚv_\9a\99_fù
+__\9a\99_fù
+;
+
+129 
+__gcÚv_\92d_fù
+__\92d_fù
+;
+
+133 \12
+__m\9a_Ãeded_äom
+;
+
+134 \12
+__max_Ãeded_äom
+;
+
+135 \12
+__m\9a_Ãeded_to
+;
+
+136 \12
+__max_Ãeded_to
+;
+
+139 \12
+__¡©eful
+;
+
+141 \1e*
+__d©a
+;
+
+146 \19
+       s__gcÚv_¡\95_d©a
+
+
+148 \1d\ 5*
+__outbuf
+;
+
+149 \1d\ 5*
+__outbuãnd
+;
+
+153 \12
+__æags
+;
+
+157 \12
+__\9avoÿtiÚ_couÁ\94
+;
+
+161 \12
+__\9a\8bº®_u£
+;
+
+163 
+__mb¡©e_t
+ *
+__¡©\95
+;
+
+164 
+__mb¡©e_t
+__¡©e
+;
+
+168 \19
+__gcÚv_\8cªs_d©a
+ *
+__\8cªs
+;
+
+173 \e\19
+       s__gcÚv_\9afo
+
+
+175 
+size_t
+__n¡\95s
+;
+
+176 \19
+__gcÚv_¡\95
+ *
+__¡\95s
+;
+
+177 
+__ex\8bnsiÚ__
\19
+__gcÚv_¡\95_d©a
+__d©a
+__æex¬r
+;
+
+178 } *
+       t__gcÚv_t
+;
+
+       @/usr/include/gnu/stubs-32.h
+
+6 #ifdeà
+_LIBC
+
+
+7 #\94rÜ 
+AµliÿtiÚs
+may
+nÙ
+def\9ae
+the
+maüo
+_LIBC
+
+
+10 \ 1
+       #__¡ub___k\94Ãl_co¦
+
+
+       )
+
+11 \ 1
+       #__¡ub___k\94Ãl_s\9al
+
+
+       )
+
+12 \ 1
+       #__¡ub___k\94Ãl_\8fÆ
+
+
+       )
+
+13 \ 1
+       #__¡ub_chæags
+
+
+       )
+
+14 \ 1
+       #__¡ub_ç\89ach
+
+
+       )
+
+15 \ 1
+       #__¡ub_fchæags
+
+
+       )
+
+16 \ 1
+       #__¡ub_fd\91ach
+
+
+       )
+
+17 \ 1
+       #__¡ub_g\89y
+
+
+       )
+
+18 \ 1
+       #__¡ub_lchmod
+
+
+       )
+
+19 \ 1
+       #__¡ub_»voke
+
+
+       )
+
+20 \ 1
+       #__¡ub_£\8eog\9a
+
+
+       )
+
+21 \ 1
+       #__¡ub_sig»tuº
+
+
+       )
+
+22 \ 1
+       #__¡ub_s¡k
+
+
+       )
+
+23 \ 1
+       #__¡ub_¡ty
+
+
+       )
+
+       @/usr/include/wchar.h
+
+24 #iâdeà
+_WCHAR_H
+
+
+26 #ià!
+def\9aed
+__Ãed_mb¡©e_t
+ && !def\9aed 
+__Ãed_w\9at_t
+
+
+27 \ 1
+       #_WCHAR_H
+ 1
+
+       )
+
+28 \ 2
+       ~<ã©u»s.h
+>
+
+31 #ifdeà
+_WCHAR_H
+
+
+33 \ 1
+       #__Ãed___FILE
+
+
+       )
+
+34 #ià
+def\9aed
+__USE_UNIX98
+ || def\9aed 
+__USE_XOPEN2K
+
+
+35 \ 1
+       #__Ãed_FILE
+
+
+       )
+
+37 \ 2
+       ~<¡dio.h
+>
+
+39 \ 1
+       #__Ãed___va_li¡
+
+
+       )
+
+40 \ 2
+       ~<¡d¬g.h
+>
+
+42 \ 2
+       ~<b\99s/wch¬.h
+>
+
+45 \ 1
+       #__Ãed_size_t
+
+
+       )
+
+46 \ 1
+       #__Ãed_wch¬_t
+
+
+       )
+
+47 \ 1
+       #__Ãed_NULL
+
+
+       )
+
+49 #ià
+def\9aed
+_WCHAR_H
+ || def\9aed 
+__Ãed_w\9at_t
+ || !def\9aed 
+__WINT_TYPE__
+
+
+50 #undeà
+__Ãed_w\9at_t
+
+
+51 \ 1
+       #__Ãed_w\9at_t
+
+
+       )
+
+52 \ 2
+       ~<¡ddef.h
+>
+
+56 #iâdeà
+_WINT_T
+
+
+61 \ 1
+       #_WINT_T
+
+
+       )
+
+62 \e\1d\12
+       tw\9at_t
+;
+
+66 #ià
+def\9aed
+__ýlu¥lus
+ && def\9aed 
+_GLIBCPP_USE_NAMESPACES
+ \
+
+67 && 
+def\9aed
+__WINT_TYPE__
+
+
+68 
+__BEGIN_NAMESPACE_STD
+
+
+69 \e
+__WINT_TYPE__
+       tw\9at_t
+;
+
+70 
+       g__END_NAMESPACE_STD
+
+
+75 #ià
+def\9aed
+__ýlu¥lus
+ && 
+__GNUC_PREREQ
+ (4, 4)
+
+76 \ 1
+       #__CORRECT_ISO_CPP_WCHAR_H_PROTO
+
+
+       )
+
+80 #ià(
+def\9aed
+_WCHAR_H
+ || def\9aed 
+__Ãed_mb¡©e_t
+è&& !def\9aed 
+__mb¡©e_t_def\9aed
+
+
+81 \ 1
+       #__mb¡©e_t_def\9aed
+ 1
+
+       )
+
+85 \12
+       m__couÁ
+;
+
+88 #ifdeà
+__WINT_TYPE__
+
+
+89 
+__WINT_TYPE__
+       m__wch
+;
+
+91 
+w\9at_t
+       m__wch
+;
+
+93 \ 5
+       m__wchb
+[4];
+
+94 } 
+       m__v®ue
+;
+
+95 } 
+       t__mb¡©e_t
+;
+
+97 #undeà
+__Ãed_mb¡©e_t
+
+
+102 #ifdeà
+_WCHAR_H
+
+
+104 
+__BEGIN_NAMESPACE_C99
+
+
+106 \e
+__mb¡©e_t
+       tmb¡©e_t
+;
+
+107 
+       g__END_NAMESPACE_C99
+
+
+108 #ifdeà
+__USE_GNU
+
+
+109 
+       $__USING_NAMESPACE_C99
+(
+mb¡©e_t
+)
+
+112 #iâdeà
+WCHAR_MIN
+
+
+114 \ 1
+       #WCHAR_MIN
+__WCHAR_MIN
+
+
+       )
+
+115 \ 1
+       #WCHAR_MAX
+__WCHAR_MAX
+
+
+       )
+
+118 #iâdeà
+WEOF
+
+
+119 \ 1
+       #WEOF
+ (0xffffffffu)
+
+       )
+
+124 #ià
+def\9aed
+__USE_XOPEN
+ && !def\9aed 
+__USE_UNIX98
+
+
+125 \ 2
+       ~<wùy³.h
+>
+
+129 
+__BEGIN_DECLS
+
+
+131 
+__BEGIN_NAMESPACE_STD
+
+
+134 \19
+tm
+;
+
+135 
+__END_NAMESPACE_STD
+
+
+139 
+       $__USING_NAMESPACE_STD
+(
+tm
+)
+
+142 
+__BEGIN_NAMESPACE_STD
+
+
+144 \r
+wch¬_t
+ *
+       $wcsýy
+ (
+wch¬_t
+ *
+__»¡riù
+__de¡
+,
+
+145 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__¤c
+__THROW
+;
+
+147 \r
+wch¬_t
+ *
+       $wc¢ýy
+ (
+wch¬_t
+ *
+__»¡riù
+__de¡
+,
+
+148 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__¤c
+, 
+size_t
+__n
+)
+
+149 
+__THROW
+;
+
+152 \r
+wch¬_t
+ *
+       $wcsÿt
+ (
+wch¬_t
+ *
+__»¡riù
+__de¡
+,
+
+153 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__¤c
+__THROW
+;
+
+155 \r
+wch¬_t
+ *
+       $wc¢ÿt
+ (
+wch¬_t
+ *
+__»¡riù
+__de¡
+,
+
+156 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__¤c
+, 
+size_t
+__n
+)
+
+157 
+__THROW
+;
+
+160 \r\12
+       $wcscmp
+ (
+__cڡ
+wch¬_t
+ *
+__s1
+, __cÚ¡ wch¬_\88*
+__s2
+)
+
+161 
+__THROW
+__©\8cibu\8b_pu»__
+;
+
+163 \r\12
+       $wc¢cmp
+ (
+__cڡ
+wch¬_t
+ *
+__s1
+, __cÚ¡ wch¬_\88*
+__s2
+, 
+size_t
+__n
+)
+
+164 
+__THROW
+__©\8cibu\8b_pu»__
+;
+
+165 
+__END_NAMESPACE_STD
+
+
+167 #ifdeà
+__USE_XOPEN2K8
+
+
+169 \r\12
+       $wcsÿ£cmp
+ (
+__cڡ
+wch¬_t
+ *
+__s1
+, __cÚ¡ wch¬_\88*
+__s2
+__THROW
+;
+
+172 \r\12
+       $wc¢ÿ£cmp
+ (
+__cڡ
+wch¬_t
+ *
+__s1
+, __cÚ¡ wch¬_\88*
+__s2
+,
+
+173 
+size_t
+__n
+__THROW
+;
+
+177 \ 2
+       ~<xloÿË.h
+>
+
+179 \r\12
+       $wcsÿ£cmp_l
+ (
+__cڡ
+wch¬_t
+ *
+__s1
+, __cÚ¡ wch¬_\88*
+__s2
+,
+
+180 
+__loÿË_t
+__loc
+__THROW
+;
+
+182 \r\12
+       $wc¢ÿ£cmp_l
+ (
+__cڡ
+wch¬_t
+ *
+__s1
+, __cÚ¡ wch¬_\88*
+__s2
+,
+
+183 
+size_t
+__n
+, 
+__loÿË_t
+__loc
+__THROW
+;
+
+186 
+__BEGIN_NAMESPACE_STD
+
+
+189 \r\12
+       $wcscÞl
+ (
+__cڡ
+wch¬_t
+ *
+__s1
+, __cÚ¡ wch¬_\88*
+__s2
+__THROW
+;
+
+193 \r
+size_t
+       $wcsxäm
+ (
+wch¬_t
+ *
+__»¡riù
+__s1
+,
+
+194 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__s2
+, 
+size_t
+__n
+__THROW
+;
+
+195 
+__END_NAMESPACE_STD
+
+
+197 #ifdeà
+__USE_XOPEN2K8
+
+
+203 \r\12
+       $wcscÞl_l
+ (
+__cڡ
+wch¬_t
+ *
+__s1
+, __cÚ¡ wch¬_\88*
+__s2
+,
+
+204 
+__loÿË_t
+__loc
+__THROW
+;
+
+209 \r
+size_t
+       $wcsxäm_l
+ (
+wch¬_t
+ *
+__s1
+, 
+__cڡ
+ wch¬_\88*
+__s2
+,
+
+210 
+size_t
+__n
+, 
+__loÿË_t
+__loc
+__THROW
+;
+
+213 \r
+wch¬_t
+ *
+       $wcsdup
+ (
+__cڡ
+wch¬_t
+ *
+__s
+__THROW
+__©\8cibu\8b_m®loc__
+;
+
+216 
+__BEGIN_NAMESPACE_STD
+
+
+218 #ifdeà
+__CORRECT_ISO_CPP_WCHAR_H_PROTO
+
+
+219 \r"C++" 
+wch¬_t
+ *
+       $wcschr
+ (
+wch¬_t
+ *
+__wcs
+, wch¬_\88
+__wc
+)
+
+220 
+__THROW
+       `__asm
+ ("wcschr"è
+__©\8cibu\8b_pu»__
+;
+
+221 \r"C++" 
+__cڡ
+wch¬_t
+ *
+       $wcschr
+ (
+__cڡ
+wch¬_t
+ *
+__wcs
+, wch¬_\88
+__wc
+)
+
+222 
+__THROW
+       `__asm
+ ("wcschr"è
+__©\8cibu\8b_pu»__
+;
+
+224 \r
+wch¬_t
+ *
+       $wcschr
+ (
+__cڡ
+wch¬_t
+ *
+__wcs
+, wch¬_\88
+__wc
+)
+
+225 
+__THROW
+__©\8cibu\8b_pu»__
+;
+
+228 #ifdeà
+__CORRECT_ISO_CPP_WCHAR_H_PROTO
+
+
+229 \r"C++" 
+wch¬_t
+ *
+       $wc¤chr
+ (
+wch¬_t
+ *
+__wcs
+, wch¬_\88
+__wc
+)
+
+230 
+__THROW
+       `__asm
+ ("wc¤chr"è
+__©\8cibu\8b_pu»__
+;
+
+231 \r"C++" 
+__cڡ
+wch¬_t
+ *
+       $wc¤chr
+ (
+__cڡ
+wch¬_t
+ *
+__wcs
+, wch¬_\88
+__wc
+)
+
+232 
+__THROW
+       `__asm
+ ("wc¤chr"è
+__©\8cibu\8b_pu»__
+;
+
+234 \r
+wch¬_t
+ *
+       $wc¤chr
+ (
+__cڡ
+wch¬_t
+ *
+__wcs
+, wch¬_\88
+__wc
+)
+
+235 
+__THROW
+__©\8cibu\8b_pu»__
+;
+
+237 
+__END_NAMESPACE_STD
+
+
+239 #ifdeà
+__USE_GNU
+
+
+242 \r
+wch¬_t
+ *
+       $wcschºul
+ (
+__cڡ
+wch¬_t
+ *
+__s
+, wch¬_\88
+__wc
+)
+
+243 
+__THROW
+__©\8cibu\8b_pu»__
+;
+
+246 
+__BEGIN_NAMESPACE_STD
+
+
+249 \r
+size_t
+       $wcsc¥n
+ (
+__cڡ
+wch¬_t
+ *
+__wcs
+, __cÚ¡ wch¬_\88*
+__»jeù
+)
+
+250 
+__THROW
+__©\8cibu\8b_pu»__
+;
+
+253 \r
+size_t
+       $wcs¥n
+ (
+__cڡ
+wch¬_t
+ *
+__wcs
+, __cÚ¡ wch¬_\88*
+__acû±
+)
+
+254 
+__THROW
+__©\8cibu\8b_pu»__
+;
+
+256 #ifdeà
+__CORRECT_ISO_CPP_WCHAR_H_PROTO
+
+
+257 \r"C++" 
+wch¬_t
+ *
+       $wc¥brk
+ (
+wch¬_t
+ *
+__wcs
+, 
+__cڡ
+ wch¬_\88*
+__acû±
+)
+
+258 
+__THROW
+       `__asm
+ ("wc¥brk"è
+__©\8cibu\8b_pu»__
+;
+
+259 \r"C++" 
+__cڡ
+wch¬_t
+ *
+       $wc¥brk
+ (
+__cڡ
+wch¬_t
+ *
+__wcs
+,
+
+260 
+__cڡ
+wch¬_t
+ *
+__acû±
+)
+
+261 
+__THROW
+       `__asm
+ ("wc¥brk"è
+__©\8cibu\8b_pu»__
+;
+
+263 \r
+wch¬_t
+ *
+       $wc¥brk
+ (
+__cڡ
+wch¬_t
+ *
+__wcs
+, __cÚ¡ wch¬_\88*
+__acû±
+)
+
+264 
+__THROW
+__©\8cibu\8b_pu»__
+;
+
+267 #ifdeà
+__CORRECT_ISO_CPP_WCHAR_H_PROTO
+
+
+268 \r"C++" 
+wch¬_t
+ *
+       $wcs¡r
+ (
+wch¬_t
+ *
+__hay¡ack
+, 
+__cڡ
+ wch¬_\88*
+__ÃedË
+)
+
+269 
+__THROW
+       `__asm
+ ("wcs¡r"è
+__©\8cibu\8b_pu»__
+;
+
+270 \r"C++" 
+__cڡ
+wch¬_t
+ *
+       $wcs¡r
+ (
+__cڡ
+wch¬_t
+ *
+__hay¡ack
+,
+
+271 
+__cڡ
+wch¬_t
+ *
+__ÃedË
+)
+
+272 
+__THROW
+       `__asm
+ ("wcs¡r"è
+__©\8cibu\8b_pu»__
+;
+
+274 \r
+wch¬_t
+ *
+       $wcs¡r
+ (
+__cڡ
+wch¬_t
+ *
+__hay¡ack
+, __cÚ¡ wch¬_\88*
+__ÃedË
+)
+
+275 
+__THROW
+__©\8cibu\8b_pu»__
+;
+
+279 \r
+wch¬_t
+ *
+       $wc¡ok
+ (
+wch¬_t
+ *
+__»¡riù
+__s
+,
+
+280 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__d\96im
+,
+
+281 
+wch¬_t
+ **
+__»¡riù
+__±r
+__THROW
+;
+
+284 \r
+size_t
+       $wc¦\92
+ (
+__cڡ
+wch¬_t
+ *
+__s
+__THROW
+__©\8cibu\8b_pu»__
+;
+
+285 
+__END_NAMESPACE_STD
+
+
+287 #ifdeà
+__USE_XOPEN
+
+
+289 #ifdeà
+__CORRECT_ISO_CPP_WCHAR_H_PROTO
+
+
+290 \r"C++" 
+wch¬_t
+ *
+       $wcswcs
+ (
+wch¬_t
+ *
+__hay¡ack
+, 
+__cڡ
+ wch¬_\88*
+__ÃedË
+)
+
+291 
+__THROW
+       `__asm
+ ("wcswcs"è
+__©\8cibu\8b_pu»__
+;
+
+292 \r"C++" 
+__cڡ
+wch¬_t
+ *
+       $wcswcs
+ (
+__cڡ
+wch¬_t
+ *
+__hay¡ack
+,
+
+293 
+__cڡ
+wch¬_t
+ *
+__ÃedË
+)
+
+294 
+__THROW
+       `__asm
+ ("wcswcs"è
+__©\8cibu\8b_pu»__
+;
+
+296 \r
+wch¬_t
+ *
+       $wcswcs
+ (
+__cڡ
+wch¬_t
+ *
+__hay¡ack
+, __cÚ¡ wch¬_\88*
+__ÃedË
+)
+
+297 
+__THROW
+__©\8cibu\8b_pu»__
+;
+
+301 #ifdeà
+__USE_XOPEN2K8
+
+
+303 \r
+size_t
+       $wc¢Ën
+ (
+__cڡ
+wch¬_t
+ *
+__s
+, 
+size_t
+__maxËn
+)
+
+304 
+__THROW
+__©\8cibu\8b_pu»__
+;
+
+308 
+__BEGIN_NAMESPACE_STD
+
+
+310 #ifdeà
+__CORRECT_ISO_CPP_WCHAR_H_PROTO
+
+
+311 \r"C++" 
+wch¬_t
+ *
+       $wmemchr
+ (
+wch¬_t
+ *
+__s
+, wch¬_\88
+__c
+, 
+size_t
+__n
+)
+
+312 
+__THROW
+       `__asm
+ ("wmemchr"è
+__©\8cibu\8b_pu»__
+;
+
+313 \r"C++" 
+__cڡ
+wch¬_t
+ *
+       $wmemchr
+ (
+__cڡ
+wch¬_t
+ *
+__s
+, wch¬_\88
+__c
+,
+
+314 
+size_t
+__n
+)
+
+315 
+__THROW
+       `__asm
+ ("wmemchr"è
+__©\8cibu\8b_pu»__
+;
+
+317 \r
+wch¬_t
+ *
+       $wmemchr
+ (
+__cڡ
+wch¬_t
+ *
+__s
+, wch¬_\88
+__c
+, 
+size_t
+__n
+)
+
+318 
+__THROW
+__©\8cibu\8b_pu»__
+;
+
+322 \r\12
+       $wmemcmp
+ (
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__s1
+,
+
+323 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__s2
+, 
+size_t
+__n
+)
+
+324 
+__THROW
+__©\8cibu\8b_pu»__
+;
+
+327 \r
+wch¬_t
+ *
+       $wmemýy
+ (
+wch¬_t
+ *
+__»¡riù
+__s1
+,
+
+328 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__s2
+, 
+size_t
+__n
+__THROW
+;
+
+332 \r
+wch¬_t
+ *
+       $wmemmove
+ (
+wch¬_t
+ *
+__s1
+, 
+__cڡ
+ wch¬_\88*
+__s2
+, 
+size_t
+__n
+)
+
+333 
+__THROW
+;
+
+336 \r
+wch¬_t
+ *
+       $wmem£t
+ (
+wch¬_t
+ *
+__s
+, wch¬_\88
+__c
+, 
+size_t
+__n
+__THROW
+;
+
+337 
+__END_NAMESPACE_STD
+
+
+339 #ifdeà
+__USE_GNU
+
+
+342 \r
+wch¬_t
+ *
+       $wmempýy
+ (
+wch¬_t
+ *
+__»¡riù
+__s1
+,
+
+343 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__s2
+, 
+size_t
+__n
+)
+
+344 
+__THROW
+;
+
+348 
+__BEGIN_NAMESPACE_STD
+
+
+351 \r
+w\9at_t
+       $btowc
+ (\12
+__c
+__THROW
+;
+
+355 \r\12
+       $wùob
+ (
+w\9at_t
+__c
+__THROW
+;
+
+359 \r\12
+       $mbs\9a\99
+ (
+__cڡ
+mb¡©e_t
+ *
+__ps
+__THROW
+__©\8cibu\8b_pu»__
+;
+
+363 \r
+size_t
+       $mb¹owc
+ (
+wch¬_t
+ *
+__»¡riù
+__pwc
+,
+
+364 
+__cڡ
\ 5*
+__»¡riù
+__s
+, 
+size_t
+__n
+,
+
+365 
+mb¡©e_t
+ *
+__p
+__THROW
+;
+
+368 \r
+size_t
+       $wütomb
+ (\ 5*
+__»¡riù
+__s
+, 
+wch¬_t
+__wc
+,
+
+369 
+mb¡©e_t
+ *
+__»¡riù
+__ps
+__THROW
+;
+
+372 \r
+size_t
+       $__mb¾\92
+ (
+__cڡ
\ 5*
+__»¡riù
+__s
+, 
+size_t
+__n
+,
+
+373 
+mb¡©e_t
+ *
+__»¡riù
+__ps
+__THROW
+;
+
+374 \r
+size_t
+       $mb¾\92
+ (
+__cڡ
\ 5*
+__»¡riù
+__s
+, 
+size_t
+__n
+,
+
+375 
+mb¡©e_t
+ *
+__»¡riù
+__ps
+__THROW
+;
+
+376 
+__END_NAMESPACE_STD
+
+
+378 #ifdeà
+__USE_EXTERN_INLINES
+
+
+384 \r
+w\9at_t
+       $__btowc_®\9fs
+ (\12
+__c
+       `__asm
+ ("btowc");
+
+385 
+__ex\8bº_\9al\9ae
+w\9at_t
+
+
+386 
+       `__NTH
+ (
+       $btowc
+ (\12
+__c
+))
+
+387 { \15 (
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__c
+) && __c >= '\0' && __c <= '\x7f'
+
+388 ? (
+w\9at_t
+__c
+ : 
+       `__btowc_®\9fs
+ (__c)); 
+       }
+}
+
+390 \r\12
+       $__wùob_®\9fs
+ (
+w\9at_t
+__c
+       `__asm
+ ("wctob");
+
+391 
+__ex\8bº_\9al\9ae
\12
+
+392 
+       `__NTH
+ (
+       $wùob
+ (
+w\9at_t
+__wc
+))
+
+393 { \15 (
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__wc
+è&& __wø>ð
+L
+'\0' && __wc <= L'\x7f'
+
+394 ? (\12è
+__wc
+ : 
+       `__wùob_®\9fs
+ (__wc)); 
+       }
+}
+
+396 
+__ex\8bº_\9al\9ae
+size_t
+
+
+397 
+__NTH
+ (
+       $mb¾\92
+ (
+__cڡ
\ 5*
+__»¡riù
+__s
+, 
+size_t
+__n
+,
+
+398 
+mb¡©e_t
+ *
+__»¡riù
+__ps
+))
+
+399 { \15 (
+__ps
+ !ð
+NULL
+
+
+400 ? 
+       `mb¹owc
+ (
+NULL
+, 
+__s
+, 
+__n
+, 
+__ps
+è: 
+       `__mb¾\92
+ (__s, __n, NULL)); 
+       }
+}
+
+403 
+__BEGIN_NAMESPACE_STD
+
+
+406 \r
+size_t
+       $mb¤towcs
+ (
+wch¬_t
+ *
+__»¡riù
+__d¡
+,
+
+407 
+__cڡ
\ 5**
+__»¡riù
+__¤c
+, 
+size_t
+__Ën
+,
+
+408 
+mb¡©e_t
+ *
+__»¡riù
+__ps
+__THROW
+;
+
+412 \r
+size_t
+       $wc¤tombs
+ (\ 5*
+__»¡riù
+__d¡
+,
+
+413 
+__cڡ
+wch¬_t
+ **
+__»¡riù
+__¤c
+, 
+size_t
+__Ën
+,
+
+414 
+mb¡©e_t
+ *
+__»¡riù
+__ps
+__THROW
+;
+
+415 
+__END_NAMESPACE_STD
+
+
+418 #ifdef 
+__USE_XOPEN2K8
+
+
+421 \r
+size_t
+       $mb¢¹owcs
+ (
+wch¬_t
+ *
+__»¡riù
+__d¡
+,
+
+422 
+__cڡ
\ 5**
+__»¡riù
+__¤c
+, 
+size_t
+__nmc
+,
+
+423 
+size_t
+__Ën
+, 
+mb¡©e_t
+ *
+__»¡riù
+__ps
+__THROW
+;
+
+427 \r
+size_t
+       $wc¢¹ombs
+ (\ 5*
+__»¡riù
+__d¡
+,
+
+428 
+__cڡ
+wch¬_t
+ **
+__»¡riù
+__¤c
+,
+
+429 
+size_t
+__nwc
+, size_\88
+__Ën
+,
+
+430 
+mb¡©e_t
+ *
+__»¡riù
+__ps
+__THROW
+;
+
+435 #ifdeà
+__USE_XOPEN
+
+
+437 \r\12
+       $wcwidth
+ (
+wch¬_t
+__c
+__THROW
+;
+
+441 \r\12
+       $wcswidth
+ (
+__cڡ
+wch¬_t
+ *
+__s
+, 
+size_t
+__n
+__THROW
+;
+
+445 
+__BEGIN_NAMESPACE_STD
+
+
+448 \r\b
+       $wc¡od
+ (
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__Ō
+,
+
+449 
+wch¬_t
+ **
+__»¡riù
+__\92d±r
+__THROW
+;
+
+450 
+__END_NAMESPACE_STD
+
+
+452 #ifdeà
+__USE_ISOC99
+
+
+453 
+__BEGIN_NAMESPACE_C99
+
+
+455 \r\ e
+       $wc¡of
+ (
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__Ō
+,
+
+456 
+wch¬_t
+ **
+__»¡riù
+__\92d±r
+__THROW
+;
+
+457 \r\13\b
+       $wc¡Þd
+ (
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__Ō
+,
+
+458 
+wch¬_t
+ **
+__»¡riù
+__\92d±r
+__THROW
+;
+
+459 
+__END_NAMESPACE_C99
+
+
+463 
+__BEGIN_NAMESPACE_STD
+
+
+466 \r\13\12
+       $wc¡Þ
+ (
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__Ō
+,
+
+467 
+wch¬_t
+ **
+__»¡riù
+__\92d±r
+, \12
+__ba£
+__THROW
+;
+
+471 \r\1d\13\12
+       $wc¡oul
+ (
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__Ō
+,
+
+472 
+wch¬_t
+ **
+__»¡riù
+__\92d±r
+, \12
+__ba£
+)
+
+473 
+__THROW
+;
+
+474 
+__END_NAMESPACE_STD
+
+
+476 #ià
+def\9aed
+__USE_ISOC99
+ || (def\9aed 
+__GNUC__
+ && def\9aed 
+__USE_GNU
+)
+
+477 
+__BEGIN_NAMESPACE_C99
+
+
+480 
+__ex\8bnsiÚ__
+
+
+481 \r\13\13\12
+       $wc¡Þl
+ (
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__Ō
+,
+
+482 
+wch¬_t
+ **
+__»¡riù
+__\92d±r
+, \12
+__ba£
+)
+
+483 
+__THROW
+;
+
+487 
+__ex\8bnsiÚ__
+
+
+488 \r\1d\13\13\12
+       $wc¡ouÎ
+ (
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__Ō
+,
+
+489 
+wch¬_t
+ **
+__»¡riù
+__\92d±r
+,
+
+490 \12
+__ba£
+__THROW
+;
+
+491 
+__END_NAMESPACE_C99
+
+
+494 #ià
+def\9aed
+__GNUC__
+ && def\9aed 
+__USE_GNU
+
+
+497 
+__ex\8bnsiÚ__
+
+
+498 \r\13\13\12
+       $wc¡oq
+ (
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__Ō
+,
+
+499 
+wch¬_t
+ **
+__»¡riù
+__\92d±r
+, \12
+__ba£
+)
+
+500 
+__THROW
+;
+
+504 
+__ex\8bnsiÚ__
+
+
+505 \r\1d\13\13\12
+       $wc¡ouq
+ (
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__Ō
+,
+
+506 
+wch¬_t
+ **
+__»¡riù
+__\92d±r
+,
+
+507 \12
+__ba£
+__THROW
+;
+
+510 #ifdeà
+__USE_GNU
+
+
+524 \ 2
+       ~<xloÿË.h
+>
+
+528 \r\13\12
+       $wc¡Þ_l
+ (
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__Ō
+,
+
+529 
+wch¬_t
+ **
+__»¡riù
+__\92d±r
+, \12
+__ba£
+,
+
+530 
+__loÿË_t
+__loc
+__THROW
+;
+
+532 \r\1d\13\12
+       $wc¡oul_l
+ (
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__Ō
+,
+
+533 
+wch¬_t
+ **
+__»¡riù
+__\92d±r
+,
+
+534 \12
+__ba£
+, 
+__loÿË_t
+__loc
+__THROW
+;
+
+536 
+__ex\8bnsiÚ__
+
+
+537 \r\13\13\12
+       $wc¡Þl_l
+ (
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__Ō
+,
+
+538 
+wch¬_t
+ **
+__»¡riù
+__\92d±r
+,
+
+539 \12
+__ba£
+, 
+__loÿË_t
+__loc
+__THROW
+;
+
+541 
+__ex\8bnsiÚ__
+
+
+542 \r\1d\13\13\12
+       $wc¡ouÎ_l
+ (
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__Ō
+,
+
+543 
+wch¬_t
+ **
+__»¡riù
+__\92d±r
+,
+
+544 \12
+__ba£
+, 
+__loÿË_t
+__loc
+)
+
+545 
+__THROW
+;
+
+547 \r\b
+       $wc¡od_l
+ (
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__Ō
+,
+
+548 
+wch¬_t
+ **
+__»¡riù
+__\92d±r
+, 
+__loÿË_t
+__loc
+)
+
+549 
+__THROW
+;
+
+551 \r\ e
+       $wc¡of_l
+ (
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__Ō
+,
+
+552 
+wch¬_t
+ **
+__»¡riù
+__\92d±r
+, 
+__loÿË_t
+__loc
+)
+
+553 
+__THROW
+;
+
+555 \r\13\b
+       $wc¡Þd_l
+ (
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__Ō
+,
+
+556 
+wch¬_t
+ **
+__»¡riù
+__\92d±r
+,
+
+557 
+__loÿË_t
+__loc
+__THROW
+;
+
+562 \r
+wch¬_t
+ *
+       $wýýy
+ (
+wch¬_t
+ *
+__»¡riù
+__de¡
+,
+
+563 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__¤c
+__THROW
+;
+
+567 \r
+wch¬_t
+ *
+       $wýnýy
+ (
+wch¬_t
+ *
+__»¡riù
+__de¡
+,
+
+568 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__¤c
+, 
+size_t
+__n
+)
+
+569 
+__THROW
+;
+
+575 #ifdef 
+__USE_XOPEN2K8
+
+
+578 \r
+__FILE
+ *
+       $Ý\92_wmem¡»am
+ (
+wch¬_t
+ **
+__buæoc
+, 
+size_t
+ *
+__siz\96oc
+__THROW
+;
+
+581 #ià
+def\9aed
+__USE_ISOC95
+ || def\9aed 
+__USE_UNIX98
+
+
+582 
+__BEGIN_NAMESPACE_STD
+
+
+585 \r\12
+       $fwide
+ (
+__FILE
+ *
+__å
+, \12
+__mode
+__THROW
+;
+
+592 \r\12
+       `fw´\9atf
+ (
+__FILE
+ *
+__»¡riù
+__¡»am
+,
+
+593 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__fÜm©
+, ...)
+
+599 \r\12
+       `w´\9atf
+ (
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__fÜm©
+, ...)
+
+602 \r\12
+       $sw´\9atf
+ (
+wch¬_t
+ *
+__»¡riù
+__s
+, 
+size_t
+__n
+,
+
+603 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__fÜm©
+, ...)
+
+604 
+__THROW
+ ;
+
+610 \r\12
+       `vfw´\9atf
+ (
+__FILE
+ *
+__»¡riù
+__s
+,
+
+611 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__fÜm©
+,
+
+612 
+__gnuc_va_li¡
+__¬g
+)
+
+618 \r\12
+       `vw´\9atf
+ (
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__fÜm©
+,
+
+619 
+__gnuc_va_li¡
+__¬g
+)
+
+623 \r\12
+       $vsw´\9atf
+ (
+wch¬_t
+ *
+__»¡riù
+__s
+, 
+size_t
+__n
+,
+
+624 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__fÜm©
+,
+
+625 
+__gnuc_va_li¡
+__¬g
+)
+
+626 
+__THROW
+ ;
+
+633 \r\12
+       `fwsÿnf
+ (
+__FILE
+ *
+__»¡riù
+__¡»am
+,
+
+634 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__fÜm©
+, ...)
+
+640 \r\12
+       `wsÿnf
+ (
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__fÜm©
+, ...)
+
+643 \r\12
+       $swsÿnf
+ (
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__s
+,
+
+644 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__fÜm©
+, ...)
+
+645 
+__THROW
+ ;
+
+647 #ià
+def\9aed
+__USE_ISOC99
+ && !def\9aed 
+__USE_GNU
+ \
+
+648 && (!
+def\9aed
+__LDBL_COMPAT
+ || !def\9aed 
+__REDIRECT
+) \
+
+649 && (
+def\9aed
+__STRICT_ANSI__
+ || def\9aed 
+__USE_XOPEN2K
+)
+
+650 #ifdeà
+__REDIRECT
+
+
+654 \r\12
+       `__REDIRECT
+ (
+fwsÿnf
+, (
+__FILE
+ *
+__»¡riù
+__¡»am
+,
+
+655 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__fÜm©
+, ...),
+
+656 
+__isoc99_fwsÿnf
+)
+
+658 \r\12
+       `__REDIRECT
+ (
+wsÿnf
+, (
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__fÜm©
+, ...),
+
+659 
+__isoc99_wsÿnf
+)
+
+661 \r\12
+       `__REDIRECT_NTH
+ (
+swsÿnf
+, (
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__s
+,
+
+662 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__fÜm©
+,
+
+663 ...), 
+__isoc99_swsÿnf
+)
+
+666 \r\12
+       `__isoc99_fwsÿnf
+ (
+__FILE
+ *
+__»¡riù
+__¡»am
+,
+
+667 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__fÜm©
+, ...);
+
+668 \r\12
+       `__isoc99_wsÿnf
+ (
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__fÜm©
+, ...);
+
+669 \r\12
+       $__isoc99_swsÿnf
+ (
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__s
+,
+
+670 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__fÜm©
+, ...)
+
+671 
+__THROW
+;
+
+672 \ 1
+       #fwsÿnf
+__isoc99_fwsÿnf
+
+
+       )
+
+673 \ 1
+       #wsÿnf
+__isoc99_wsÿnf
+
+
+       )
+
+674 \ 1
+       #swsÿnf
+__isoc99_swsÿnf
+
+
+       )
+
+678 
+__END_NAMESPACE_STD
+
+
+681 #ifdeà
+__USE_ISOC99
+
+
+682 
+__BEGIN_NAMESPACE_C99
+
+
+687 \r\12
+       `vfwsÿnf
+ (
+__FILE
+ *
+__»¡riù
+__s
+,
+
+688 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__fÜm©
+,
+
+689 
+__gnuc_va_li¡
+__¬g
+)
+
+695 \r\12
+       `vwsÿnf
+ (
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__fÜm©
+,
+
+696 
+__gnuc_va_li¡
+__¬g
+)
+
+699 \r\12
+       $vswsÿnf
+ (
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__s
+,
+
+700 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__fÜm©
+,
+
+701 
+__gnuc_va_li¡
+__¬g
+)
+
+702 
+__THROW
+ ;
+
+704 #ià!
+def\9aed
+__USE_GNU
+ \
+
+705 && (!
+def\9aed
+__LDBL_COMPAT
+ || !def\9aed 
+__REDIRECT
+) \
+
+706 && (
+def\9aed
+__STRICT_ANSI__
+ || def\9aed 
+__USE_XOPEN2K
+)
+
+707 #ifdeà
+__REDIRECT
+
+
+708 \r\12
+       `__REDIRECT
+ (
+vfwsÿnf
+, (
+__FILE
+ *
+__»¡riù
+__s
+,
+
+709 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__fÜm©
+,
+
+710 
+__gnuc_va_li¡
+__¬g
+), 
+__isoc99_vfwsÿnf
+)
+
+712 \r\12
+       `__REDIRECT
+ (
+vwsÿnf
+, (
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__fÜm©
+,
+
+713 
+__gnuc_va_li¡
+__¬g
+), 
+__isoc99_vwsÿnf
+)
+
+715 \r\12
+       `__REDIRECT_NTH
+ (
+vswsÿnf
+, (
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__s
+,
+
+716 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__fÜm©
+,
+
+717 
+__gnuc_va_li¡
+__¬g
+), 
+__isoc99_vswsÿnf
+)
+
+720 \r\12
+       `__isoc99_vfwsÿnf
+ (
+__FILE
+ *
+__»¡riù
+__s
+,
+
+721 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__fÜm©
+,
+
+722 
+__gnuc_va_li¡
+__¬g
+);
+
+723 \r\12
+       `__isoc99_vwsÿnf
+ (
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__fÜm©
+,
+
+724 
+__gnuc_va_li¡
+__¬g
+);
+
+725 \r\12
+       $__isoc99_vswsÿnf
+ (
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__s
+,
+
+726 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__fÜm©
+,
+
+727 
+__gnuc_va_li¡
+__¬g
+__THROW
+;
+
+728 \ 1
+       #vfwsÿnf
+__isoc99_vfwsÿnf
+
+
+       )
+
+729 \ 1
+       #vwsÿnf
+__isoc99_vwsÿnf
+
+
+       )
+
+730 \ 1
+       #vswsÿnf
+__isoc99_vswsÿnf
+
+
+       )
+
+734 
+__END_NAMESPACE_C99
+
+
+738 
+__BEGIN_NAMESPACE_STD
+
+
+743 \r
+w\9at_t
+       `fg\91wc
+ (
+__FILE
+ *
+__¡»am
+);
+
+744 \r
+w\9at_t
+       `g\91wc
+ (
+__FILE
+ *
+__¡»am
+);
+
+750 \r
+w\9at_t
+       `g\91wch¬
+ (\1e);
+
+757 \r
+w\9at_t
+       `åutwc
+ (
+wch¬_t
+__wc
+, 
+__FILE
+ *
+__¡»am
+);
+
+758 \r
+w\9at_t
+       `putwc
+ (
+wch¬_t
+__wc
+, 
+__FILE
+ *
+__¡»am
+);
+
+764 \r
+w\9at_t
+       `putwch¬
+ (
+wch¬_t
+__wc
+);
+
+772 \r
+wch¬_t
+ *
+       `fg\91ws
+ (wch¬_\88*
+__»¡riù
+__ws
+, \12
+__n
+,
+
+773 
+__FILE
+ *
+__»¡riù
+__¡»am
+);
+
+779 \r\12
+       `åutws
+ (
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__ws
+,
+
+780 
+__FILE
+ *
+__»¡riù
+__¡»am
+);
+
+787 \r
+w\9at_t
+       `ung\91wc
+ (w\9at_\88
+__wc
+, 
+__FILE
+ *
+__¡»am
+);
+
+788 
+__END_NAMESPACE_STD
+
+
+791 #ifdeà
+__USE_GNU
+
+
+799 \r
+w\9at_t
+       `g\91wc_uÆocked
+ (
+__FILE
+ *
+__¡»am
+);
+
+800 \r
+w\9at_t
+       `g\91wch¬_uÆocked
+ (\1e);
+
+808 \r
+w\9at_t
+       `fg\91wc_uÆocked
+ (
+__FILE
+ *
+__¡»am
+);
+
+816 \r
+w\9at_t
+       `åutwc_uÆocked
+ (
+wch¬_t
+__wc
+, 
+__FILE
+ *
+__¡»am
+);
+
+825 \r
+w\9at_t
+       `putwc_uÆocked
+ (
+wch¬_t
+__wc
+, 
+__FILE
+ *
+__¡»am
+);
+
+826 \r
+w\9at_t
+       `putwch¬_uÆocked
+ (
+wch¬_t
+__wc
+);
+
+835 \r
+wch¬_t
+ *
+       `fg\91ws_uÆocked
+ (wch¬_\88*
+__»¡riù
+__ws
+, \12
+__n
+,
+
+836 
+__FILE
+ *
+__»¡riù
+__¡»am
+);
+
+844 \r\12
+       `åutws_uÆocked
+ (
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__ws
+,
+
+845 
+__FILE
+ *
+__»¡riù
+__¡»am
+);
+
+849 
+__BEGIN_NAMESPACE_C99
+
+
+853 \r
+size_t
+       $wcsáime
+ (
+wch¬_t
+ *
+__»¡riù
+__s
+, 
+size_t
+__maxsize
+,
+
+854 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__fÜm©
+,
+
+855 
+__cڡ
\19
+tm
+ *
+__»¡riù
+__\8d
+__THROW
+;
+
+856 
+__END_NAMESPACE_C99
+
+
+858 #ifdeà
+__USE_GNU
+
+
+859 \ 2
+       ~<xloÿË.h
+>
+
+863 \r
+size_t
+       $wcsáime_l
+ (
+wch¬_t
+ *
+__»¡riù
+__s
+, 
+size_t
+__maxsize
+,
+
+864 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__fÜm©
+,
+
+865 
+__cڡ
\19
+tm
+ *
+__»¡riù
+__\8d
+,
+
+866 
+__loÿË_t
+__loc
+__THROW
+;
+
+875 #ià
+def\9aed
+__USE_UNIX98
+ && !def\9aed 
+__USE_GNU
+
+
+876 \ 1
+       #__Ãed_iswxxx
+
+
+       )
+
+877 \ 2
+       ~<wùy³.h
+>
+
+881 #ià
+__USE_FORTIFY_LEVEL
+ > 0 && 
+def\9aed
+__ex\8bº_®ways_\9al\9ae
+
+
+882 \ 2
+       ~<b\99s/wch¬2.h
+>
+
+885 #ifdeà
+__LDBL_COMPAT
+
+
+886 \ 2
+       ~<b\99s/wch¬-ldbl.h
+>
+
+889 
+__END_DECLS
+
+
+897 #undeà
+__Ãed_mb¡©e_t
+
+
+898 #undeà
+__Ãed_w\9at_t
+
+
+       @/usr/include/bits/wchar-ldbl.h
+
+20 #iâdeà
+_WCHAR_H
+
+
+24 #ià
+def\9aed
+__USE_ISOC95
+ || def\9aed 
+__USE_UNIX98
+
+
+25 
+__BEGIN_NAMESPACE_C99
+
+
+26 
+__LDBL_REDIR_DECL
+ (
+fw´\9atf
+);
+
+27 
+__LDBL_REDIR_DECL
+ (
+w´\9atf
+);
+
+28 
+__LDBL_REDIR_DECL
+ (
+sw´\9atf
+);
+
+29 
+__LDBL_REDIR_DECL
+ (
+vfw´\9atf
+);
+
+30 
+__LDBL_REDIR_DECL
+ (
+vw´\9atf
+);
+
+31 
+__LDBL_REDIR_DECL
+ (
+vsw´\9atf
+);
+
+32 #ià
+def\9aed
+__USE_ISOC99
+ && !def\9aed 
+__USE_GNU
+ \
+
+33 && !
+def\9aed
+       g__REDIRECT
+ \
+
+34 && (
+def\9aed
+       g__STRICT_ANSI__
+ || def\9aed 
+       g__USE_XOPEN2K
+)
+
+35 
+       $__LDBL_REDIR1_DECL
+ (
+fwsÿnf
+, 
+__Ædbl___isoc99_fwsÿnf
+)
+
+36 
+       $__LDBL_REDIR1_DECL
+ (
+wsÿnf
+, 
+__Ædbl___isoc99_wsÿnf
+)
+
+37 
+       $__LDBL_REDIR1_DECL
+ (
+swsÿnf
+, 
+__Ædbl___isoc99_swsÿnf
+)
+
+39 
+       `__LDBL_REDIR_DECL
+ (
+fwsÿnf
+);
+
+40 
+       `__LDBL_REDIR_DECL
+ (
+wsÿnf
+);
+
+41 
+       `__LDBL_REDIR_DECL
+ (
+swsÿnf
+);
+
+43 
+__END_NAMESPACE_C99
+
+
+46 #ifdeà
+__USE_ISOC99
+
+
+47 
+__BEGIN_NAMESPACE_C99
+
+
+48 
+       `__LDBL_REDIR1_DECL
+ (
+wc¡Þd
+, 
+wc¡od
+);
+
+49 #ià!
+def\9aed
+__USE_GNU
+ && !def\9aed 
+__REDIRECT
+ \
+
+50 && (
+def\9aed
+__STRICT_ANSI__
+ || def\9aed 
+__USE_XOPEN2K
+)
+
+51 
+       $__LDBL_REDIR1_DECL
+ (
+vfwsÿnf
+, 
+__Ædbl___isoc99_vfwsÿnf
+)
+
+52 
+       $__LDBL_REDIR1_DECL
+ (
+vwsÿnf
+, 
+__Ædbl___isoc99_vwsÿnf
+)
+
+53 
+       $__LDBL_REDIR1_DECL
+ (
+vswsÿnf
+, 
+__Ædbl___isoc99_vswsÿnf
+)
+
+55 
+       `__LDBL_REDIR_DECL
+ (
+vfwsÿnf
+);
+
+56 
+       `__LDBL_REDIR_DECL
+ (
+vwsÿnf
+);
+
+57 
+       `__LDBL_REDIR_DECL
+ (
+vswsÿnf
+);
+
+59 
+__END_NAMESPACE_C99
+
+
+62 #ifdeà
+__USE_GNU
+
+
+63 
+       `__LDBL_REDIR1_DECL
+ (
+wc¡Þd_l
+, 
+wc¡od_l
+);
+
+66 #ià
+__USE_FORTIFY_LEVEL
+ > 0 && 
+def\9aed
+__ex\8bº_®ways_\9al\9ae
+
+
+67 
+       $__LDBL_REDIR_DECL
+ (
+__sw´\9atf_chk
+)
+
+68 
+       $__LDBL_REDIR_DECL
+ (
+__vsw´\9atf_chk
+)
+
+69 #ià
+__USE_FORTIFY_LEVEL
+ > 1
+
+70 
+       $__LDBL_REDIR_DECL
+ (
+__fw´\9atf_chk
+)
+
+71 
+       $__LDBL_REDIR_DECL
+ (
+__w´\9atf_chk
+)
+
+72 
+       $__LDBL_REDIR_DECL
+ (
+__vfw´\9atf_chk
+)
+
+73 
+       $__LDBL_REDIR_DECL
+ (
+__vw´\9atf_chk
+)
+
+       @/usr/include/bits/wchar2.h
+
+20 #iâdeà
+_WCHAR_H
+
+
+25 \r
+wch¬_t
+ *
+       $__wmemýy_chk
+ (
+wch¬_t
+ *
+__»¡riù
+__s1
+,
+
+26 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__s2
+, 
+size_t
+__n
+,
+
+27 
+size_t
+__ns1
+__THROW
+;
+
+28 \r
+wch¬_t
+ *
+       `__REDIRECT_NTH
+ (
+__wmemýy_®\9fs
+,
+
+29 (
+wch¬_t
+ *
+__»¡riù
+__s1
+,
+
+30 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__s2
+, 
+size_t
+__n
+),
+
+31 
+wmemýy
+);
+
+32 \r
+wch¬_t
+ *
+       `__REDIRECT_NTH
+ (
+__wmemýy_chk_w¬n
+,
+
+33 (
+wch¬_t
+ *
+__»¡riù
+__s1
+,
+
+34 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__s2
+, 
+size_t
+__n
+,
+
+35 
+size_t
+__ns1
+), 
+__wmemýy_chk
+)
+
+36 
+       `__w¬Ç\89r
+ ("wmemcpy called with\86ength bigger\81han size of destination "
+
+39 
+__ex\8bº_®ways_\9al\9ae
+wch¬_t
+ *
+
+40 
+       `__NTH
+ (
+       $wmemýy
+ (
+wch¬_t
+ *
+__»¡riù
+__s1
+, 
+__cڡ
+ wch¬_\88*__»¡riù 
+__s2
+,
+
+41 
+size_t
+__n
+))
+
+43 ià(
+       `__bos0
+ (
+__s1
+è!ð(
+size_t
+) -1)
+
+45 ià(!
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__n
+))
+
+46 \15 
+       `__wmemýy_chk
+ (
+__s1
+, 
+__s2
+, 
+__n
+,
+
+47 
+       `__bos0
+ (
+__s1
+è/ \17 (
+wch¬_t
+));
+
+49 ià(
+__n
+ > 
+       `__bos0
+ (
+__s1
+è/ \17 (
+wch¬_t
+))
+
+50 \15 
+       `__wmemýy_chk_w¬n
+ (
+__s1
+, 
+__s2
+, 
+__n
+,
+
+51 
+       `__bos0
+ (
+__s1
+è/ \17 (
+wch¬_t
+));
+
+53 \15 
+       `__wmemýy_®\9fs
+ (
+__s1
+, 
+__s2
+, 
+__n
+);
+
+54 
+       }
+}
+
+57 \r
+wch¬_t
+ *
+       $__wmemmove_chk
+ (
+wch¬_t
+ *
+__s1
+, 
+__cڡ
+ wch¬_\88*
+__s2
+,
+
+58 
+size_t
+__n
+, size_\88
+__ns1
+__THROW
+;
+
+59 \r
+wch¬_t
+ *
+       `__REDIRECT_NTH
+ (
+__wmemmove_®\9fs
+, (wch¬_\88*
+__s1
+,
+
+60 
+__cڡ
+wch¬_t
+ *
+__s2
+,
+
+61 
+size_t
+__n
+), 
+wmemmove
+);
+
+62 \r
+wch¬_t
+ *
+       `__REDIRECT_NTH
+ (
+__wmemmove_chk_w¬n
+,
+
+63 (
+wch¬_t
+ *
+__s1
+, 
+__cڡ
+ wch¬_\88*
+__s2
+,
+
+64 
+size_t
+__n
+, size_\88
+__ns1
+), 
+__wmemmove_chk
+)
+
+65 
+       `__w¬Ç\89r
+ ("wmemmove called with\86ength bigger\81han size of destination "
+
+68 
+__ex\8bº_®ways_\9al\9ae
+wch¬_t
+ *
+
+69 
+       `__NTH
+ (
+       $wmemmove
+ (
+wch¬_t
+ *
+__s1
+, 
+__cڡ
+ wch¬_\88*
+__s2
+, 
+size_t
+__n
+))
+
+71 ià(
+       `__bos0
+ (
+__s1
+è!ð(
+size_t
+) -1)
+
+73 ià(!
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__n
+))
+
+74 \15 
+       `__wmemmove_chk
+ (
+__s1
+, 
+__s2
+, 
+__n
+,
+
+75 
+       `__bos0
+ (
+__s1
+è/ \17 (
+wch¬_t
+));
+
+77 ià(
+__n
+ > 
+       `__bos0
+ (
+__s1
+è/ \17 (
+wch¬_t
+))
+
+78 \15 
+       `__wmemmove_chk_w¬n
+ (
+__s1
+, 
+__s2
+, 
+__n
+,
+
+79 
+       `__bos0
+ (
+__s1
+è/ \17 (
+wch¬_t
+));
+
+81 \15 
+       `__wmemmove_®\9fs
+ (
+__s1
+, 
+__s2
+, 
+__n
+);
+
+82 
+       }
+}
+
+85 #ifdeà
+__USE_GNU
+
+
+86 \r
+wch¬_t
+ *
+       $__wmempýy_chk
+ (
+wch¬_t
+ *
+__»¡riù
+__s1
+,
+
+87 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__s2
+, 
+size_t
+__n
+,
+
+88 
+size_t
+__ns1
+__THROW
+;
+
+89 \r
+wch¬_t
+ *
+       `__REDIRECT_NTH
+ (
+__wmempýy_®\9fs
+,
+
+90 (
+wch¬_t
+ *
+__»¡riù
+__s1
+,
+
+91 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__s2
+,
+
+92 
+size_t
+__n
+), 
+wmempýy
+);
+
+93 \r
+wch¬_t
+ *
+       `__REDIRECT_NTH
+ (
+__wmempýy_chk_w¬n
+,
+
+94 (
+wch¬_t
+ *
+__»¡riù
+__s1
+,
+
+95 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__s2
+, 
+size_t
+__n
+,
+
+96 
+size_t
+__ns1
+), 
+__wmempýy_chk
+)
+
+97 
+       `__w¬Ç\89r
+ ("wmempcpy called with\86ength bigger\81han size of destination "
+
+100 
+__ex\8bº_®ways_\9al\9ae
+wch¬_t
+ *
+
+101 
+       `__NTH
+ (
+       $wmempýy
+ (
+wch¬_t
+ *
+__»¡riù
+__s1
+, 
+__cڡ
+ wch¬_\88*__»¡riù 
+__s2
+,
+
+102 
+size_t
+__n
+))
+
+104 ià(
+       `__bos0
+ (
+__s1
+è!ð(
+size_t
+) -1)
+
+106 ià(!
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__n
+))
+
+107 \15 
+       `__wmempýy_chk
+ (
+__s1
+, 
+__s2
+, 
+__n
+,
+
+108 
+       `__bos0
+ (
+__s1
+è/ \17 (
+wch¬_t
+));
+
+110 ià(
+__n
+ > 
+       `__bos0
+ (
+__s1
+è/ \17 (
+wch¬_t
+))
+
+111 \15 
+       `__wmempýy_chk_w¬n
+ (
+__s1
+, 
+__s2
+, 
+__n
+,
+
+112 
+       `__bos0
+ (
+__s1
+è/ \17 (
+wch¬_t
+));
+
+114 \15 
+       `__wmempýy_®\9fs
+ (
+__s1
+, 
+__s2
+, 
+__n
+);
+
+115 
+       }
+}
+
+119 \r
+wch¬_t
+ *
+       $__wmem£t_chk
+ (
+wch¬_t
+ *
+__s
+, wch¬_\88
+__c
+, 
+size_t
+__n
+,
+
+120 
+size_t
+__ns
+__THROW
+;
+
+121 \r
+wch¬_t
+ *
+       `__REDIRECT_NTH
+ (
+__wmem£t_®\9fs
+, (wch¬_\88*
+__s
+, wch¬_\88
+__c
+,
+
+122 
+size_t
+__n
+), 
+wmem£t
+);
+
+123 \r
+wch¬_t
+ *
+       `__REDIRECT_NTH
+ (
+__wmem£t_chk_w¬n
+,
+
+124 (
+wch¬_t
+ *
+__s
+, wch¬_\88
+__c
+, 
+size_t
+__n
+,
+
+125 
+size_t
+__ns
+), 
+__wmem£t_chk
+)
+
+126 
+       `__w¬Ç\89r
+ ("wmemset called with\86ength bigger\81han size of destination "
+
+129 
+__ex\8bº_®ways_\9al\9ae
+wch¬_t
+ *
+
+130 
+       `__NTH
+ (
+       $wmem£t
+ (
+wch¬_t
+ *
+__s
+, wch¬_\88
+__c
+, 
+size_t
+__n
+))
+
+132 ià(
+       `__bos0
+ (
+__s
+è!ð(
+size_t
+) -1)
+
+134 ià(!
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__n
+))
+
+135 \15 
+       `__wmem£t_chk
+ (
+__s
+, 
+__c
+, 
+__n
+, 
+       `__bos0
+ (__sè/ \17 (
+wch¬_t
+));
+
+137 ià(
+__n
+ > 
+       `__bos0
+ (
+__s
+è/ \17 (
+wch¬_t
+))
+
+138 \15 
+       `__wmem£t_chk_w¬n
+ (
+__s
+, 
+__c
+, 
+__n
+,
+
+139 
+       `__bos0
+ (
+__s
+è/ \17 (
+wch¬_t
+));
+
+141 \15 
+       `__wmem£t_®\9fs
+ (
+__s
+, 
+__c
+, 
+__n
+);
+
+142 
+       }
+}
+
+145 \r
+wch¬_t
+ *
+       $__wcsýy_chk
+ (
+wch¬_t
+ *
+__»¡riù
+__de¡
+,
+
+146 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__¤c
+,
+
+147 
+size_t
+__n
+__THROW
+;
+
+148 \r
+wch¬_t
+ *
+       `__REDIRECT_NTH
+ (
+__wcsýy_®\9fs
+,
+
+149 (
+wch¬_t
+ *
+__»¡riù
+__de¡
+,
+
+150 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__¤c
+), 
+wcsýy
+);
+
+152 
+__ex\8bº_®ways_\9al\9ae
+wch¬_t
+ *
+
+153 
+       `__NTH
+ (
+       $wcsýy
+ (
+wch¬_t
+ *
+__»¡riù
+__de¡
+, 
+__cڡ
+ wch¬_\88*__»¡riù 
+__¤c
+))
+
+155 ià(
+       `__bos
+ (
+__de¡
+è!ð(
+size_t
+) -1)
+
+156 \15 
+       `__wcsýy_chk
+ (
+__de¡
+, 
+__¤c
+, 
+       `__bos
+ (__de¡è/ \17 (
+wch¬_t
+));
+
+157 \15 
+       `__wcsýy_®\9fs
+ (
+__de¡
+, 
+__¤c
+);
+
+158 
+       }
+}
+
+161 \r
+wch¬_t
+ *
+       $__wýýy_chk
+ (
+wch¬_t
+ *
+__»¡riù
+__de¡
+,
+
+162 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__¤c
+,
+
+163 
+size_t
+__de¡Ën
+__THROW
+;
+
+164 \r
+wch¬_t
+ *
+       `__REDIRECT_NTH
+ (
+__wýýy_®\9fs
+,
+
+165 (
+wch¬_t
+ *
+__»¡riù
+__de¡
+,
+
+166 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__¤c
+), 
+wýýy
+);
+
+168 
+__ex\8bº_®ways_\9al\9ae
+wch¬_t
+ *
+
+169 
+       `__NTH
+ (
+       $wýýy
+ (
+wch¬_t
+ *
+__»¡riù
+__de¡
+, 
+__cڡ
+ wch¬_\88*__»¡riù 
+__¤c
+))
+
+171 ià(
+       `__bos
+ (
+__de¡
+è!ð(
+size_t
+) -1)
+
+172 \15 
+       `__wýýy_chk
+ (
+__de¡
+, 
+__¤c
+, 
+       `__bos
+ (__de¡è/ \17 (
+wch¬_t
+));
+
+173 \15 
+       `__wýýy_®\9fs
+ (
+__de¡
+, 
+__¤c
+);
+
+174 
+       }
+}
+
+177 \r
+wch¬_t
+ *
+       $__wc¢ýy_chk
+ (
+wch¬_t
+ *
+__»¡riù
+__de¡
+,
+
+178 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__¤c
+, 
+size_t
+__n
+,
+
+179 
+size_t
+__de¡Ën
+__THROW
+;
+
+180 \r
+wch¬_t
+ *
+       `__REDIRECT_NTH
+ (
+__wc¢ýy_®\9fs
+,
+
+181 (
+wch¬_t
+ *
+__»¡riù
+__de¡
+,
+
+182 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__¤c
+,
+
+183 
+size_t
+__n
+), 
+wc¢ýy
+);
+
+184 \r
+wch¬_t
+ *
+       `__REDIRECT_NTH
+ (
+__wc¢ýy_chk_w¬n
+,
+
+185 (
+wch¬_t
+ *
+__»¡riù
+__de¡
+,
+
+186 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__¤c
+,
+
+187 
+size_t
+__n
+, size_\88
+__de¡Ën
+), 
+__wc¢ýy_chk
+)
+
+188 
+       `__w¬Ç\89r
+ ("wcsncpy called with\86ength bigger\81han size of destination "
+
+191 
+__ex\8bº_®ways_\9al\9ae
+wch¬_t
+ *
+
+192 
+       `__NTH
+ (
+       $wc¢ýy
+ (
+wch¬_t
+ *
+__»¡riù
+__de¡
+, 
+__cڡ
+ wch¬_\88*__»¡riù 
+__¤c
+,
+
+193 
+size_t
+__n
+))
+
+195 ià(
+       `__bos
+ (
+__de¡
+è!ð(
+size_t
+) -1)
+
+197 ià(!
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__n
+))
+
+198 \15 
+       `__wc¢ýy_chk
+ (
+__de¡
+, 
+__¤c
+, 
+__n
+,
+
+199 
+       `__bos
+ (
+__de¡
+è/ \17 (
+wch¬_t
+));
+
+200 ià(
+__n
+ > 
+       `__bos
+ (
+__de¡
+è/ \17 (
+wch¬_t
+))
+
+201 \15 
+       `__wc¢ýy_chk_w¬n
+ (
+__de¡
+, 
+__¤c
+, 
+__n
+,
+
+202 
+       `__bos
+ (
+__de¡
+è/ \17 (
+wch¬_t
+));
+
+204 \15 
+       `__wc¢ýy_®\9fs
+ (
+__de¡
+, 
+__¤c
+, 
+__n
+);
+
+205 
+       }
+}
+
+208 \r
+wch¬_t
+ *
+       $__wýnýy_chk
+ (
+wch¬_t
+ *
+__»¡riù
+__de¡
+,
+
+209 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__¤c
+, 
+size_t
+__n
+,
+
+210 
+size_t
+__de¡Ën
+__THROW
+;
+
+211 \r
+wch¬_t
+ *
+       `__REDIRECT_NTH
+ (
+__wýnýy_®\9fs
+,
+
+212 (
+wch¬_t
+ *
+__»¡riù
+__de¡
+,
+
+213 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__¤c
+,
+
+214 
+size_t
+__n
+), 
+wýnýy
+);
+
+215 \r
+wch¬_t
+ *
+       `__REDIRECT_NTH
+ (
+__wýnýy_chk_w¬n
+,
+
+216 (
+wch¬_t
+ *
+__»¡riù
+__de¡
+,
+
+217 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__¤c
+,
+
+218 
+size_t
+__n
+, size_\88
+__de¡Ën
+), 
+__wýnýy_chk
+)
+
+219 
+       `__w¬Ç\89r
+ ("wcpncpy called with\86ength bigger\81han size of destination "
+
+222 
+__ex\8bº_®ways_\9al\9ae
+wch¬_t
+ *
+
+223 
+       `__NTH
+ (
+       $wýnýy
+ (
+wch¬_t
+ *
+__»¡riù
+__de¡
+, 
+__cڡ
+ wch¬_\88*__»¡riù 
+__¤c
+,
+
+224 
+size_t
+__n
+))
+
+226 ià(
+       `__bos
+ (
+__de¡
+è!ð(
+size_t
+) -1)
+
+228 ià(!
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__n
+))
+
+229 \15 
+       `__wýnýy_chk
+ (
+__de¡
+, 
+__¤c
+, 
+__n
+,
+
+230 
+       `__bos
+ (
+__de¡
+è/ \17 (
+wch¬_t
+));
+
+231 ià(
+__n
+ > 
+       `__bos
+ (
+__de¡
+è/ \17 (
+wch¬_t
+))
+
+232 \15 
+       `__wýnýy_chk_w¬n
+ (
+__de¡
+, 
+__¤c
+, 
+__n
+,
+
+233 
+       `__bos
+ (
+__de¡
+è/ \17 (
+wch¬_t
+));
+
+235 \15 
+       `__wýnýy_®\9fs
+ (
+__de¡
+, 
+__¤c
+, 
+__n
+);
+
+236 
+       }
+}
+
+239 \r
+wch¬_t
+ *
+       $__wcsÿt_chk
+ (
+wch¬_t
+ *
+__»¡riù
+__de¡
+,
+
+240 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__¤c
+,
+
+241 
+size_t
+__de¡Ën
+__THROW
+;
+
+242 \r
+wch¬_t
+ *
+       `__REDIRECT_NTH
+ (
+__wcsÿt_®\9fs
+,
+
+243 (
+wch¬_t
+ *
+__»¡riù
+__de¡
+,
+
+244 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__¤c
+), 
+wcsÿt
+);
+
+246 
+__ex\8bº_®ways_\9al\9ae
+wch¬_t
+ *
+
+247 
+       `__NTH
+ (
+       $wcsÿt
+ (
+wch¬_t
+ *
+__»¡riù
+__de¡
+, 
+__cڡ
+ wch¬_\88*__»¡riù 
+__¤c
+))
+
+249 ià(
+       `__bos
+ (
+__de¡
+è!ð(
+size_t
+) -1)
+
+250 \15 
+       `__wcsÿt_chk
+ (
+__de¡
+, 
+__¤c
+, 
+       `__bos
+ (__de¡è/ \17 (
+wch¬_t
+));
+
+251 \15 
+       `__wcsÿt_®\9fs
+ (
+__de¡
+, 
+__¤c
+);
+
+252 
+       }
+}
+
+255 \r
+wch¬_t
+ *
+       $__wc¢ÿt_chk
+ (
+wch¬_t
+ *
+__»¡riù
+__de¡
+,
+
+256 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__¤c
+,
+
+257 
+size_t
+__n
+, size_\88
+__de¡Ën
+__THROW
+;
+
+258 \r
+wch¬_t
+ *
+       `__REDIRECT_NTH
+ (
+__wc¢ÿt_®\9fs
+,
+
+259 (
+wch¬_t
+ *
+__»¡riù
+__de¡
+,
+
+260 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__¤c
+,
+
+261 
+size_t
+__n
+), 
+wc¢ÿt
+);
+
+263 
+__ex\8bº_®ways_\9al\9ae
+wch¬_t
+ *
+
+264 
+       `__NTH
+ (
+       $wc¢ÿt
+ (
+wch¬_t
+ *
+__»¡riù
+__de¡
+, 
+__cڡ
+ wch¬_\88*__»¡riù 
+__¤c
+,
+
+265 
+size_t
+__n
+))
+
+267 ià(
+       `__bos
+ (
+__de¡
+è!ð(
+size_t
+) -1)
+
+268 \15 
+       `__wc¢ÿt_chk
+ (
+__de¡
+, 
+__¤c
+, 
+__n
+,
+
+269 
+       `__bos
+ (
+__de¡
+è/ \17 (
+wch¬_t
+));
+
+270 \15 
+       `__wc¢ÿt_®\9fs
+ (
+__de¡
+, 
+__¤c
+, 
+__n
+);
+
+271 
+       }
+}
+
+274 \r\12
+       $__sw´\9atf_chk
+ (
+wch¬_t
+ *
+__»¡riù
+__s
+, 
+size_t
+__n
+,
+
+275 \12
+__æag
+, 
+size_t
+__s_Ën
+,
+
+276 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__fÜm©
+, ...)
+
+277 
+__THROW
+ ;
+
+279 \r\12
+       `__REDIRECT_NTH_LDBL
+ (
+__sw´\9atf_®\9fs
+,
+
+280 (
+wch¬_t
+ *
+__»¡riù
+__s
+, 
+size_t
+__n
+,
+
+281 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__fmt
+, ...),
+
+282 
+sw´\9atf
+);
+
+284 #ifdeà
+__va_¬g_·ck
+
+
+285 
+__ex\8bº_®ways_\9al\9ae
\12
+
+286 
+       `__NTH
+ (
+       $sw´\9atf
+ (
+wch¬_t
+ *
+__»¡riù
+__s
+, 
+size_t
+__n
+,
+
+287 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__fmt
+, ...))
+
+289 ià(
+       `__bos
+ (
+__s
+è!ð(
+size_t
+è-1 || 
+__USE_FORTIFY_LEVEL
+ > 1)
+
+290 \15 
+       `__sw´\9atf_chk
+ (
+__s
+, 
+__n
+, 
+__USE_FORTIFY_LEVEL
+ - 1,
+
+291 
+       `__bos
+ (
+__s
+è/ \17 (
+wch¬_t
+),
+
+292 
+__fmt
+, 
+       `__va_¬g_·ck
+ ());
+
+293 \15 
+       `__sw´\9atf_®\9fs
+ (
+__s
+, 
+__n
+, 
+__fmt
+, 
+       `__va_¬g_·ck
+ ());
+
+294 
+       }
+}
+
+295 #\96ià!
+def\9aed
+__ýlu¥lus
+
+
+297 \ 1
+       #sw´\9atf
+(
+s
+, 
+n
+, ...) \
+
+298 (
+       `__bos
+ (
+s
+è!ð(
+size_t
+è-1 || 
+__USE_FORTIFY_LEVEL
+ > 1 \
+
+299 ? 
+       `__sw´\9atf_chk
+ (
+s
+, 
+n
+, 
+__USE_FORTIFY_LEVEL
+ - 1, \
+
+300 
+       `__bos
+ (
+s
+è/ \17 (
+wch¬_t
+), 
+__VA_ARGS__
+) \
+
+301 : 
+       `sw´\9atf
+ (
+s
+, 
+n
+, 
+__VA_ARGS__
+))
+
+       )
+
+304 \r\12
+       $__vsw´\9atf_chk
+ (
+wch¬_t
+ *
+__»¡riù
+__s
+, 
+size_t
+__n
+,
+
+305 \12
+__æag
+, 
+size_t
+__s_Ën
+,
+
+306 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__fÜm©
+,
+
+307 
+__gnuc_va_li¡
+__¬g
+)
+
+308 
+__THROW
+ ;
+
+310 \r\12
+       `__REDIRECT_NTH_LDBL
+ (
+__vsw´\9atf_®\9fs
+,
+
+311 (
+wch¬_t
+ *
+__»¡riù
+__s
+, 
+size_t
+__n
+,
+
+312 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__fmt
+,
+
+313 
+__gnuc_va_li¡
+__­
+), 
+vsw´\9atf
+);
+
+315 
+__ex\8bº_®ways_\9al\9ae
\12
+
+316 
+       `__NTH
+ (
+       $vsw´\9atf
+ (
+wch¬_t
+ *
+__»¡riù
+__s
+, 
+size_t
+__n
+,
+
+317 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__fmt
+, 
+__gnuc_va_li¡
+__­
+))
+
+319 ià(
+       `__bos
+ (
+__s
+è!ð(
+size_t
+è-1 || 
+__USE_FORTIFY_LEVEL
+ > 1)
+
+320 \15 
+       `__vsw´\9atf_chk
+ (
+__s
+, 
+__n
+, 
+__USE_FORTIFY_LEVEL
+ - 1,
+
+321 
+       `__bos
+ (
+__s
+è/ \17 (
+wch¬_t
+), 
+__fmt
+, 
+__­
+);
+
+322 \15 
+       `__vsw´\9atf_®\9fs
+ (
+__s
+, 
+__n
+, 
+__fmt
+, 
+__­
+);
+
+323 
+       }
+}
+
+326 #ià
+__USE_FORTIFY_LEVEL
+ > 1
+
+328 \r\12
+__fw´\9atf_chk
+ (
+__FILE
+ *
+__»¡riù
+__¡»am
+, \12
+__æag
+,
+
+329 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__fÜm©
+, ...);
+
+330 \r\12
+__w´\9atf_chk
+ (\12
+__æag
+, 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__fÜm©
+,
+
+332 \r\12
+__vfw´\9atf_chk
+ (
+__FILE
+ *
+__»¡riù
+__¡»am
+, \12
+__æag
+,
+
+333 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__fÜm©
+,
+
+334 
+__gnuc_va_li¡
+__­
+);
+
+335 \r\12
+__vw´\9atf_chk
+ (\12
+__æag
+, 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__fÜm©
+,
+
+336 
+__gnuc_va_li¡
+__­
+);
+
+338 #ifdeà
+__va_¬g_·ck
+
+
+339 
+__ex\8bº_®ways_\9al\9ae
\12
+
+340 
+       $w´\9atf
+ (
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__fmt
+, ...)
+
+342 \15 
+       `__w´\9atf_chk
+ (
+__USE_FORTIFY_LEVEL
+ - 1, 
+__fmt
+, 
+       `__va_¬g_·ck
+ ());
+
+343 
+       }
+}
+
+345 
+__ex\8bº_®ways_\9al\9ae
\12
+
+346 
+       $fw´\9atf
+ (
+__FILE
+ *
+__»¡riù
+__¡»am
+, 
+__cڡ
+wch¬_t
+ *__»¡riù 
+__fmt
+, ...)
+
+348 \15 
+       `__fw´\9atf_chk
+ (
+__¡»am
+, 
+__USE_FORTIFY_LEVEL
+ - 1, 
+__fmt
+,
+
+349 
+       `__va_¬g_·ck
+ ());
+
+350 
+       }
+}
+
+351 #\96ià!
+def\9aed
+__ýlu¥lus
+
+
+352 \ 1
+       #w´\9atf
+(...) \
+
+353 
+       `__w´\9atf_chk
+ (
+__USE_FORTIFY_LEVEL
+ - 1, 
+__VA_ARGS__
+)
+
+       )
+
+354 \ 1
+       #fw´\9atf
+(
+¡»am
+, ...) \
+
+355 
+       `__fw´\9atf_chk
+ (
+¡»am
+, 
+__USE_FORTIFY_LEVEL
+ - 1, 
+__VA_ARGS__
+)
+
+       )
+
+358 
+__ex\8bº_®ways_\9al\9ae
\12
+
+359 
+       $vw´\9atf
+ (
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__fmt
+, 
+__gnuc_va_li¡
+__­
+)
+
+361 \15 
+       `__vw´\9atf_chk
+ (
+__USE_FORTIFY_LEVEL
+ - 1, 
+__fmt
+, 
+__­
+);
+
+362 
+       }
+}
+
+364 
+__ex\8bº_®ways_\9al\9ae
\12
+
+365 
+       $vfw´\9atf
+ (
+__FILE
+ *
+__»¡riù
+__¡»am
+,
+
+366 
+__cڡ
+wch¬_t
+ *
+__»¡riù
+__fmt
+, 
+__gnuc_va_li¡
+__­
+)
+
+368 \15 
+       `__vfw´\9atf_chk
+ (
+__¡»am
+, 
+__USE_FORTIFY_LEVEL
+ - 1, 
+__fmt
+, 
+__­
+);
+
+369 
+       }
+}
+
+373 \r
+wch¬_t
+ *
+       $__fg\91ws_chk
+ (
+wch¬_t
+ *
+__»¡riù
+__s
+, 
+size_t
+__size
+, \12
+__n
+,
+
+374 
+__FILE
+ *
+__»¡riù
+__¡»am
+__wur
+;
+
+375 \r
+wch¬_t
+ *
+       `__REDIRECT
+ (
+__fg\91ws_®\9fs
+,
+
+376 (
+wch¬_t
+ *
+__»¡riù
+__s
+, \12
+__n
+,
+
+377 
+__FILE
+ *
+__»¡riù
+__¡»am
+), 
+fg\91ws
+__wur
+;
+
+378 \r
+wch¬_t
+ *
+       `__REDIRECT
+ (
+__fg\91ws_chk_w¬n
+,
+
+379 (
+wch¬_t
+ *
+__»¡riù
+__s
+, 
+size_t
+__size
+, \12
+__n
+,
+
+380 
+__FILE
+ *
+__»¡riù
+__¡»am
+), 
+__fg\91ws_chk
+)
+
+381 
+__wur
+       `__w¬Ç\89r
+ ("fgetws called with bigger size\81han\86ength "
+
+384 
+__ex\8bº_®ways_\9al\9ae
+__wur
+wch¬_t
+ *
+
+385 
+       $fg\91ws
+ (
+wch¬_t
+ *
+__»¡riù
+__s
+, \12
+__n
+, 
+__FILE
+ *__»¡riù 
+__¡»am
+)
+
+387 ià(
+       `__bos
+ (
+__s
+è!ð(
+size_t
+) -1)
+
+389 ià(!
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__n
+) || __n <= 0)
+
+390 \15 
+       `__fg\91ws_chk
+ (
+__s
+, 
+       `__bos
+ (__sè/ \17 (
+wch¬_t
+),
+
+391 
+__n
+, 
+__¡»am
+);
+
+393 ià((
+size_t
+__n
+ > 
+       `__bos
+ (
+__s
+è/ \17 (
+wch¬_t
+))
+
+394 \15 
+       `__fg\91ws_chk_w¬n
+ (
+__s
+, 
+       `__bos
+ (__sè/ \17 (
+wch¬_t
+),
+
+395 
+__n
+, 
+__¡»am
+);
+
+397 \15 
+       `__fg\91ws_®\9fs
+ (
+__s
+, 
+__n
+, 
+__¡»am
+);
+
+398 
+       }
+}
+
+400 #ifdeà
+__USE_GNU
+
+
+401 \r
+wch¬_t
+ *
+       $__fg\91ws_uÆocked_chk
+ (
+wch¬_t
+ *
+__»¡riù
+__s
+, 
+size_t
+__size
+,
+
+402 \12
+__n
+, 
+__FILE
+ *
+__»¡riù
+__¡»am
+)
+
+403 
+__wur
+;
+
+404 \r
+wch¬_t
+ *
+       `__REDIRECT
+ (
+__fg\91ws_uÆocked_®\9fs
+,
+
+405 (
+wch¬_t
+ *
+__»¡riù
+__s
+, \12
+__n
+,
+
+406 
+__FILE
+ *
+__»¡riù
+__¡»am
+), 
+fg\91ws_uÆocked
+)
+
+407 
+__wur
+;
+
+408 \r
+wch¬_t
+ *
+       `__REDIRECT
+ (
+__fg\91ws_uÆocked_chk_w¬n
+,
+
+409 (
+wch¬_t
+ *
+__»¡riù
+__s
+, 
+size_t
+__size
+, \12
+__n
+,
+
+410 
+__FILE
+ *
+__»¡riù
+__¡»am
+),
+
+411 
+__fg\91ws_uÆocked_chk
+)
+
+412 
+__wur
+       `__w¬Ç\89r
+ ("fgetws_unlocked called with bigger size\81han\86ength "
+
+415 
+__ex\8bº_®ways_\9al\9ae
+__wur
+wch¬_t
+ *
+
+416 
+       $fg\91ws_uÆocked
+ (
+wch¬_t
+ *
+__»¡riù
+__s
+, \12
+__n
+, 
+__FILE
+ *__»¡riù 
+__¡»am
+)
+
+418 ià(
+       `__bos
+ (
+__s
+è!ð(
+size_t
+) -1)
+
+420 ià(!
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__n
+) || __n <= 0)
+
+421 \15 
+       `__fg\91ws_uÆocked_chk
+ (
+__s
+, 
+       `__bos
+ (__sè/ \17 (
+wch¬_t
+),
+
+422 
+__n
+, 
+__¡»am
+);
+
+424 ià((
+size_t
+__n
+ > 
+       `__bos
+ (
+__s
+è/ \17 (
+wch¬_t
+))
+
+425 \15 
+       `__fg\91ws_uÆocked_chk_w¬n
+ (
+__s
+, 
+       `__bos
+ (__sè/ \17 (
+wch¬_t
+),
+
+426 
+__n
+, 
+__¡»am
+);
+
+428 \15 
+       `__fg\91ws_uÆocked_®\9fs
+ (
+__s
+, 
+__n
+, 
+__¡»am
+);
+
+429 
+       }
+}
+
+433 \r
+size_t
+       $__wütomb_chk
+ (\ 5*
+__»¡riù
+__s
+, 
+wch¬_t
+__wch¬
+,
+
+434 
+mb¡©e_t
+ *
+__»¡riù
+__p
+,
+
+435 
+size_t
+__buæ\92
+__THROW
+__wur
+;
+
+436 \r
+size_t
+       `__REDIRECT_NTH
+ (
+__wütomb_®\9fs
+,
+
+437 (\ 5*
+__»¡riù
+__s
+, 
+wch¬_t
+__wch¬
+,
+
+438 
+mb¡©e_t
+ *
+__»¡riù
+__ps
+), 
+wütomb
+__wur
+;
+
+440 
+__ex\8bº_®ways_\9al\9ae
+__wur
+size_t
+
+
+441 
+       `__NTH
+ (
+       $wütomb
+ (\ 5*
+__»¡riù
+__s
+, 
+wch¬_t
+__wch¬
+,
+
+442 
+mb¡©e_t
+ *
+__»¡riù
+__ps
+))
+
+447 \ 1
+       #__WCHAR_MB_LEN_MAX
+ 16
+
+       )
+
+448 #ià
+def\9aed
+MB_LEN_MAX
+ && MB_LEN_MAX !ð
+__WCHAR_MB_LEN_MAX
+
+
+451 ià(
+       `__bos
+ (
+__s
+è!ð(
+size_t
+è-1 && 
+__WCHAR_MB_LEN_MAX
+ > __bos (__s))
+
+452 \15 
+       `__wütomb_chk
+ (
+__s
+, 
+__wch¬
+, 
+__ps
+, 
+       `__bos
+ (__s));
+
+453 \15 
+       `__wütomb_®\9fs
+ (
+__s
+, 
+__wch¬
+, 
+__ps
+);
+
+454 
+       }
+}
+
+457 \r
+size_t
+       $__mb¤towcs_chk
+ (
+wch¬_t
+ *
+__»¡riù
+__d¡
+,
+
+458 
+__cڡ
\ 5**
+__»¡riù
+__¤c
+,
+
+459 
+size_t
+__Ën
+, 
+mb¡©e_t
+ *
+__»¡riù
+__ps
+,
+
+460 
+size_t
+__d¡Ën
+__THROW
+;
+
+461 \r
+size_t
+       `__REDIRECT_NTH
+ (
+__mb¤towcs_®\9fs
+,
+
+462 (
+wch¬_t
+ *
+__»¡riù
+__d¡
+,
+
+463 
+__cڡ
\ 5**
+__»¡riù
+__¤c
+,
+
+464 
+size_t
+__Ën
+, 
+mb¡©e_t
+ *
+__»¡riù
+__ps
+),
+
+465 
+mb¤towcs
+);
+
+466 \r
+size_t
+       `__REDIRECT_NTH
+ (
+__mb¤towcs_chk_w¬n
+,
+
+467 (
+wch¬_t
+ *
+__»¡riù
+__d¡
+,
+
+468 
+__cڡ
\ 5**
+__»¡riù
+__¤c
+,
+
+469 
+size_t
+__Ën
+, 
+mb¡©e_t
+ *
+__»¡riù
+__ps
+,
+
+470 
+size_t
+__d¡Ën
+), 
+__mb¤towcs_chk
+)
+
+471 
+       `__w¬Ç\89r
+ ("mbsrtowcs called with dst buffer smaller\81han\86en "
+
+474 
+__ex\8bº_®ways_\9al\9ae
+size_t
+
+
+475 
+       `__NTH
+ (
+       $mb¤towcs
+ (
+wch¬_t
+ *
+__»¡riù
+__d¡
+, 
+__cڡ
\ 5**__»¡riù 
+__¤c
+,
+
+476 
+size_t
+__Ën
+, 
+mb¡©e_t
+ *
+__»¡riù
+__ps
+))
+
+478 ià(
+       `__bos
+ (
+__d¡
+è!ð(
+size_t
+) -1)
+
+480 ià(!
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__Ën
+))
+
+481 \15 
+       `__mb¤towcs_chk
+ (
+__d¡
+, 
+__¤c
+, 
+__Ën
+, 
+__ps
+,
+
+482 
+       `__bos
+ (
+__d¡
+è/ \17 (
+wch¬_t
+));
+
+484 ià(
+__Ën
+ > 
+       `__bos
+ (
+__d¡
+è/ \17 (
+wch¬_t
+))
+
+485 \15 
+       `__mb¤towcs_chk_w¬n
+ (
+__d¡
+, 
+__¤c
+, 
+__Ën
+, 
+__ps
+,
+
+486 
+       `__bos
+ (
+__d¡
+è/ \17 (
+wch¬_t
+));
+
+488 \15 
+       `__mb¤towcs_®\9fs
+ (
+__d¡
+, 
+__¤c
+, 
+__Ën
+, 
+__ps
+);
+
+489 
+       }
+}
+
+492 \r
+size_t
+       $__wc¤tombs_chk
+ (\ 5*
+__»¡riù
+__d¡
+,
+
+493 
+__cڡ
+wch¬_t
+ **
+__»¡riù
+__¤c
+,
+
+494 
+size_t
+__Ën
+, 
+mb¡©e_t
+ *
+__»¡riù
+__ps
+,
+
+495 
+size_t
+__d¡Ën
+__THROW
+;
+
+496 \r
+size_t
+       `__REDIRECT_NTH
+ (
+__wc¤tombs_®\9fs
+,
+
+497 (\ 5*
+__»¡riù
+__d¡
+,
+
+498 
+__cڡ
+wch¬_t
+ **
+__»¡riù
+__¤c
+,
+
+499 
+size_t
+__Ën
+, 
+mb¡©e_t
+ *
+__»¡riù
+__ps
+),
+
+500 
+wc¤tombs
+);
+
+501 \r
+size_t
+       `__REDIRECT_NTH
+ (
+__wc¤tombs_chk_w¬n
+,
+
+502 (\ 5*
+__»¡riù
+__d¡
+,
+
+503 
+__cڡ
+wch¬_t
+ **
+__»¡riù
+__¤c
+,
+
+504 
+size_t
+__Ën
+, 
+mb¡©e_t
+ *
+__»¡riù
+__ps
+,
+
+505 
+size_t
+__d¡Ën
+), 
+__wc¤tombs_chk
+)
+
+506 
+       `__w¬Ç\89r
+ ("wcsrtombs called with dst buffer smaller\81han\86en");
+
+508 
+__ex\8bº_®ways_\9al\9ae
+size_t
+
+
+509 
+       `__NTH
+ (
+       $wc¤tombs
+ (\ 5*
+__»¡riù
+__d¡
+, 
+__cڡ
+wch¬_t
+ **__»¡riù 
+__¤c
+,
+
+510 
+size_t
+__Ën
+, 
+mb¡©e_t
+ *
+__»¡riù
+__ps
+))
+
+512 ià(
+       `__bos
+ (
+__d¡
+è!ð(
+size_t
+) -1)
+
+514 ià(!
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__Ën
+))
+
+515 \15 
+       `__wc¤tombs_chk
+ (
+__d¡
+, 
+__¤c
+, 
+__Ën
+, 
+__ps
+, 
+       `__bos
+ (__dst));
+
+517 ià(
+__Ën
+ > 
+       `__bos
+ (
+__d¡
+))
+
+518 \15 
+       `__wc¤tombs_chk_w¬n
+ (
+__d¡
+, 
+__¤c
+, 
+__Ën
+, 
+__ps
+, 
+       `__bos
+ (__dst));
+
+520 \15 
+       `__wc¤tombs_®\9fs
+ (
+__d¡
+, 
+__¤c
+, 
+__Ën
+, 
+__ps
+);
+
+521 
+       }
+}
+
+524 #ifdeà
+__USE_GNU
+
+
+525 \r
+size_t
+       $__mb¢¹owcs_chk
+ (
+wch¬_t
+ *
+__»¡riù
+__d¡
+,
+
+526 
+__cڡ
\ 5**
+__»¡riù
+__¤c
+, 
+size_t
+__nmc
+,
+
+527 
+size_t
+__Ën
+, 
+mb¡©e_t
+ *
+__»¡riù
+__ps
+,
+
+528 
+size_t
+__d¡Ën
+__THROW
+;
+
+529 \r
+size_t
+       `__REDIRECT_NTH
+ (
+__mb¢¹owcs_®\9fs
+,
+
+530 (
+wch¬_t
+ *
+__»¡riù
+__d¡
+,
+
+531 
+__cڡ
\ 5**
+__»¡riù
+__¤c
+, 
+size_t
+__nmc
+,
+
+532 
+size_t
+__Ën
+, 
+mb¡©e_t
+ *
+__»¡riù
+__ps
+),
+
+533 
+mb¢¹owcs
+);
+
+534 \r
+size_t
+       `__REDIRECT_NTH
+ (
+__mb¢¹owcs_chk_w¬n
+,
+
+535 (
+wch¬_t
+ *
+__»¡riù
+__d¡
+,
+
+536 
+__cڡ
\ 5**
+__»¡riù
+__¤c
+, 
+size_t
+__nmc
+,
+
+537 
+size_t
+__Ën
+, 
+mb¡©e_t
+ *
+__»¡riù
+__ps
+,
+
+538 
+size_t
+__d¡Ën
+), 
+__mb¢¹owcs_chk
+)
+
+539 
+       `__w¬Ç\89r
+ ("mbsnrtowcs called with dst buffer smaller\81han\86en "
+
+542 
+__ex\8bº_®ways_\9al\9ae
+size_t
+
+
+543 
+       `__NTH
+ (
+       $mb¢¹owcs
+ (
+wch¬_t
+ *
+__»¡riù
+__d¡
+, 
+__cڡ
\ 5**__»¡riù 
+__¤c
+,
+
+544 
+size_t
+__nmc
+, size_\88
+__Ën
+, 
+mb¡©e_t
+ *
+__»¡riù
+__ps
+))
+
+546 ià(
+       `__bos
+ (
+__d¡
+è!ð(
+size_t
+) -1)
+
+548 ià(!
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__Ën
+))
+
+549 \15 
+       `__mb¢¹owcs_chk
+ (
+__d¡
+, 
+__¤c
+, 
+__nmc
+, 
+__Ën
+, 
+__ps
+,
+
+550 
+       `__bos
+ (
+__d¡
+è/ \17 (
+wch¬_t
+));
+
+552 ià(
+__Ën
+ > 
+       `__bos
+ (
+__d¡
+è/ \17 (
+wch¬_t
+))
+
+553 \15 
+       `__mb¢¹owcs_chk_w¬n
+ (
+__d¡
+, 
+__¤c
+, 
+__nmc
+, 
+__Ën
+, 
+__ps
+,
+
+554 
+       `__bos
+ (
+__d¡
+è/ \17 (
+wch¬_t
+));
+
+556 \15 
+       `__mb¢¹owcs_®\9fs
+ (
+__d¡
+, 
+__¤c
+, 
+__nmc
+, 
+__Ën
+, 
+__ps
+);
+
+557 
+       }
+}
+
+560 \r
+size_t
+       $__wc¢¹ombs_chk
+ (\ 5*
+__»¡riù
+__d¡
+,
+
+561 
+__cڡ
+wch¬_t
+ **
+__»¡riù
+__¤c
+,
+
+562 
+size_t
+__nwc
+, size_\88
+__Ën
+,
+
+563 
+mb¡©e_t
+ *
+__»¡riù
+__ps
+, 
+size_t
+__d¡Ën
+)
+
+564 
+__THROW
+;
+
+565 \r
+size_t
+       `__REDIRECT_NTH
+ (
+__wc¢¹ombs_®\9fs
+,
+
+566 (\ 5*
+__»¡riù
+__d¡
+,
+
+567 
+__cڡ
+wch¬_t
+ **
+__»¡riù
+__¤c
+,
+
+568 
+size_t
+__nwc
+, size_\88
+__Ën
+,
+
+569 
+mb¡©e_t
+ *
+__»¡riù
+__ps
+), 
+wc¢¹ombs
+);
+
+570 \r
+size_t
+       `__REDIRECT_NTH
+ (
+__wc¢¹ombs_chk_w¬n
+,
+
+571 (\ 5*
+__»¡riù
+__d¡
+,
+
+572 
+__cڡ
+wch¬_t
+ **
+__»¡riù
+__¤c
+,
+
+573 
+size_t
+__nwc
+, size_\88
+__Ën
+,
+
+574 
+mb¡©e_t
+ *
+__»¡riù
+__ps
+,
+
+575 
+size_t
+__d¡Ën
+), 
+__wc¢¹ombs_chk
+)
+
+576 
+       `__w¬Ç\89r
+ ("wcsnrtombs called with dst buffer smaller\81han\86en");
+
+578 
+__ex\8bº_®ways_\9al\9ae
+size_t
+
+
+579 
+       `__NTH
+ (
+       $wc¢¹ombs
+ (\ 5*
+__»¡riù
+__d¡
+, 
+__cڡ
+wch¬_t
+ **__»¡riù 
+__¤c
+,
+
+580 
+size_t
+__nwc
+, size_\88
+__Ën
+, 
+mb¡©e_t
+ *
+__»¡riù
+__ps
+))
+
+582 ià(
+       `__bos
+ (
+__d¡
+è!ð(
+size_t
+) -1)
+
+584 ià(!
+       `__bu\9et\9a_cÚ¡ªt_p
+ (
+__Ën
+))
+
+585 \15 
+       `__wc¢¹ombs_chk
+ (
+__d¡
+, 
+__¤c
+, 
+__nwc
+, 
+__Ën
+, 
+__ps
+,
+
+586 
+       `__bos
+ (
+__d¡
+));
+
+588 ià(
+__Ën
+ > 
+       `__bos
+ (
+__d¡
+))
+
+589 \15 
+       `__wc¢¹ombs_chk_w¬n
+ (
+__d¡
+, 
+__¤c
+, 
+__nwc
+, 
+__Ën
+, 
+__ps
+,
+
+590 
+       `__bos
+ (
+__d¡
+));
+
+592 \15 
+       `__wc¢¹ombs_®\9fs
+ (
+__d¡
+, 
+__¤c
+, 
+__nwc
+, 
+__Ën
+, 
+__ps
+);
+
+593 
+       }
+}
+
+       @/usr/include/gnu/option-groups.h
+
+10 #iâdeà
+__GNU_OPTION_GROUPS_H
+
+
+11 \ 1
+       #__GNU_OPTION_GROUPS_H
+
+
+       )
+
+13 \ 1
+       #__OPTION_EGLIBC_ADVANCED_INET6
+ 1
+
+       )
+
+14 \ 1
+       #__OPTION_EGLIBC_BACKTRACE
+ 1
+
+       )
+
+15 \ 1
+       #__OPTION_EGLIBC_BIG_MACROS
+ 1
+
+       )
+
+16 \ 1
+       #__OPTION_EGLIBC_BSD
+ 1
+
+       )
+
+17 \ 1
+       #__OPTION_EGLIBC_CATGETS
+ 1
+
+       )
+
+18 \ 1
+       #__OPTION_EGLIBC_CHARSETS
+ 1
+
+       )
+
+19 \ 1
+       #__OPTION_EGLIBC_CRYPT
+ 1
+
+       )
+
+20 \ 1
+       #__OPTION_EGLIBC_CRYPT_UFC
+ 1
+
+       )
+
+21 \ 1
+       #__OPTION_EGLIBC_CXX_TESTS
+ 1
+
+       )
+
+22 \ 1
+       #__OPTION_EGLIBC_DB_ALIASES
+ 1
+
+       )
+
+23 \ 1
+       #__OPTION_EGLIBC_ENVZ
+ 1
+
+       )
+
+24 \ 1
+       #__OPTION_EGLIBC_FCVT
+ 1
+
+       )
+
+25 \ 1
+       #__OPTION_EGLIBC_FMTMSG
+ 1
+
+       )
+
+26 \ 1
+       #__OPTION_EGLIBC_FSTAB
+ 1
+
+       )
+
+27 \ 1
+       #__OPTION_EGLIBC_FTRAVERSE
+ 1
+
+       )
+
+28 \ 1
+       #__OPTION_EGLIBC_GETLOGIN
+ 1
+
+       )
+
+29 \ 1
+       #__OPTION_EGLIBC_IDN
+ 1
+
+       )
+
+30 \ 1
+       #__OPTION_EGLIBC_INET
+ 1
+
+       )
+
+31 \ 1
+       #__OPTION_EGLIBC_INET_ANL
+ 1
+
+       )
+
+32 \ 1
+       #__OPTION_EGLIBC_LIBM
+ 1
+
+       )
+
+33 \ 1
+       #__OPTION_EGLIBC_LIBM_BIG
+ 1
+
+       )
+
+34 \ 1
+       #__OPTION_EGLIBC_LOCALES
+ 1
+
+       )
+
+35 \ 1
+       #__OPTION_EGLIBC_LOCALE_CODE
+ 1
+
+       )
+
+36 \ 1
+       #__OPTION_EGLIBC_MEMUSAGE
+ 1
+
+       )
+
+37 \ 1
+       #__OPTION_EGLIBC_NIS
+ 1
+
+       )
+
+38 \ 1
+       #__OPTION_EGLIBC_NSSWITCH
+ 1
+
+       )
+
+39 \ 1
+       #__OPTION_EGLIBC_RCMD
+ 1
+
+       )
+
+40 \ 1
+       #__OPTION_EGLIBC_RTLD_DEBUG
+ 1
+
+       )
+
+41 \ 1
+       #__OPTION_EGLIBC_SPAWN
+ 1
+
+       )
+
+42 \ 1
+       #__OPTION_EGLIBC_STREAMS
+ 1
+
+       )
+
+43 \ 1
+       #__OPTION_EGLIBC_SUNRPC
+ 1
+
+       )
+
+44 \ 1
+       #__OPTION_EGLIBC_UTMP
+ 1
+
+       )
+
+45 \ 1
+       #__OPTION_EGLIBC_UTMPX
+ 1
+
+       )
+
+46 \ 1
+       #__OPTION_EGLIBC_WORDEXP
+ 1
+
+       )
+
+47 \ 1
+       #__OPTION_POSIX_C_LANG_WIDE_CHAR
+ 1
+
+       )
+
+48 \ 1
+       #__OPTION_POSIX_REGEXP
+ 1
+
+       )
+
+49 \ 1
+       #__OPTION_POSIX_REGEXP_GLIBC
+ 1
+
+       )
+
+50 \ 1
+       #__OPTION_POSIX_WIDE_CHAR_DEVICE_IO
+ 1
+
+       )
+
+       @/usr/include/wctype.h
+
+24 #iâdeà
+_WCTYPE_H
+
+
+26 \ 2
+       ~<ã©u»s.h
+>
+
+27 \ 2
+       ~<b\99s/ty³s.h
+>
+
+29 #iâdeà
+__Ãed_iswxxx
+
+
+30 \ 1
+       #_WCTYPE_H
+ 1
+
+       )
+
+33 \ 1
+       #__Ãed_w\9at_t
+
+
+       )
+
+34 \ 2
+       ~<wch¬.h
+>
+
+38 #iâdeà
+WEOF
+
+
+39 \ 1
+       #WEOF
+ (0xffffffffu)
+
+       )
+
+42 #undeà
+__Ãed_iswxxx
+
+
+47 #iâdeà
+__iswxxx_def\9aed
+
+
+48 \ 1
+       #__iswxxx_def\9aed
+ 1
+
+       )
+
+50 
+__BEGIN_NAMESPACE_C99
+
+
+53 \e\1d\13\12
+       twùy³_t
+;
+
+54 
+       g__END_NAMESPACE_C99
+
+
+56 #iâdeà
+_ISwb\99
+
+
+61 \ 2
+       ~<\92d\9fn.h
+>
+
+62 #ià
+__BYTE_ORDER
+ =ð
+__BIG_ENDIAN
+
+
+63 \ 1
+       #_ISwb\99
+(
+b\99
+è(1 << (b\99))
+
+       )
+
+65 \ 1
+       #_ISwb\99
+(
+b\99
+) \
+
+66 ((
+b\99
+) < 8 ? (\12) ((1UL << (bit)) << 24) \
+
+67 : ((
+b\99
+) < 16 ? (\12) ((1UL << (bit)) << 8) \
+
+68 : ((
+b\99
+) < 24 ? (\12) ((1UL << (bit)) >> 8) \
+
+69 : (\12è((1UL << (
+b\99
+)è>> 24))))
+
+       )
+
+74 
+       m__ISwuµ\94
+ = 0,
+
+75 
+       m__ISwlow\94
+ = 1,
+
+76 
+       m__ISw®pha
+ = 2,
+
+77 
+       m__ISwdig\99
+ = 3,
+
+78 
+       m__ISwxdig\99
+ = 4,
+
+79 
+       m__ISw¥aû
+ = 5,
+
+80 
+       m__ISw´\9at
+ = 6,
+
+81 
+       m__ISwg¿ph
+ = 7,
+
+82 
+       m__ISwbÏnk
+ = 8,
+
+83 
+       m__ISwú\8cl
+ = 9,
+
+84 
+       m__ISwpunù
+ = 10,
+
+85 
+       m__ISw®num
+ = 11,
+
+87 
+       m_ISwuµ\94
+ = 
+_ISwb\99
+ (
+__ISwuµ\94
+),
+
+88 
+       m_ISwlow\94
+ = 
+_ISwb\99
+ (
+__ISwlow\94
+),
+
+89 
+       m_ISw®pha
+ = 
+_ISwb\99
+ (
+__ISw®pha
+),
+
+90 
+       m_ISwdig\99
+ = 
+_ISwb\99
+ (
+__ISwdig\99
+),
+
+91 
+       m_ISwxdig\99
+ = 
+_ISwb\99
+ (
+__ISwxdig\99
+),
+
+92 
+       m_ISw¥aû
+ = 
+_ISwb\99
+ (
+__ISw¥aû
+),
+
+93 
+       m_ISw´\9at
+ = 
+_ISwb\99
+ (
+__ISw´\9at
+),
+
+94 
+       m_ISwg¿ph
+ = 
+_ISwb\99
+ (
+__ISwg¿ph
+),
+
+95 
+       m_ISwbÏnk
+ = 
+_ISwb\99
+ (
+__ISwbÏnk
+),
+
+96 
+       m_ISwú\8cl
+ = 
+_ISwb\99
+ (
+__ISwú\8cl
+),
+
+97 
+       m_ISwpunù
+ = 
+_ISwb\99
+ (
+__ISwpunù
+),
+
+98 
+       m_ISw®num
+ = 
+_ISwb\99
+ (
+__ISw®num
+)
+
+103 
+__BEGIN_DECLS
+
+
+105 
+__BEGIN_NAMESPACE_C99
+
+
+112 \r\12
+       $isw®num
+ (
+w\9at_t
+__wc
+__THROW
+;
+
+118 \r\12
+       $isw®pha
+ (
+w\9at_t
+__wc
+__THROW
+;
+
+121 \r\12
+       $iswú\8cl
+ (
+w\9at_t
+__wc
+__THROW
+;
+
+125 \r\12
+       $iswdig\99
+ (
+w\9at_t
+__wc
+__THROW
+;
+
+129 \r\12
+       $iswg¿ph
+ (
+w\9at_t
+__wc
+__THROW
+;
+
+134 \r\12
+       $iswlow\94
+ (
+w\9at_t
+__wc
+__THROW
+;
+
+137 \r\12
+       $isw´\9at
+ (
+w\9at_t
+__wc
+__THROW
+;
+
+142 \r\12
+       $iswpunù
+ (
+w\9at_t
+__wc
+__THROW
+;
+
+147 \r\12
+       $isw¥aû
+ (
+w\9at_t
+__wc
+__THROW
+;
+
+152 \r\12
+       $iswuµ\94
+ (
+w\9at_t
+__wc
+__THROW
+;
+
+157 \r\12
+       $iswxdig\99
+ (
+w\9at_t
+__wc
+__THROW
+;
+
+162 #ifdeà
+__USE_ISOC99
+
+
+163 \r\12
+       $iswbÏnk
+ (
+w\9at_t
+__wc
+__THROW
+;
+
+172 \r
+wùy³_t
+       $wùy³
+ (
+__cڡ
\ 5*
+__´Ý\94ty
+__THROW
+;
+
+176 \r\12
+       $iswùy³
+ (
+w\9at_t
+__wc
+, 
+wùy³_t
+__desc
+__THROW
+;
+
+177 
+__END_NAMESPACE_C99
+
+
+184 
+__BEGIN_NAMESPACE_C99
+
+
+187 \e
+__cڡ
+       t__\9at32_t
+ *
+       twù¿ns_t
+;
+
+188 
+__END_NAMESPACE_C99
+
+
+189 #ifdeà
+__USE_GNU
+
+
+190 
+       $__USING_NAMESPACE_C99
+(
+wù¿ns_t
+)
+
+193 
+__BEGIN_NAMESPACE_C99
+
+
+195 \r
+w\9at_t
+       $towlow\94
+ (
+w\9at_t
+__wc
+__THROW
+;
+
+198 \r
+w\9at_t
+       $towuµ\94
+ (
+w\9at_t
+__wc
+__THROW
+;
+
+199 
+__END_NAMESPACE_C99
+
+
+201 
+__END_DECLS
+
+
+208 #ifdeà
+_WCTYPE_H
+
+
+214 
+__BEGIN_DECLS
+
+
+216 
+__BEGIN_NAMESPACE_C99
+
+
+219 \r
+wù¿ns_t
+       $wù¿ns
+ (
+__cڡ
\ 5*
+__´Ý\94ty
+__THROW
+;
+
+222 \r
+w\9at_t
+       $towù¿ns
+ (
+w\9at_t
+__wc
+, 
+wù¿ns_t
+__desc
+__THROW
+;
+
+223 
+__END_NAMESPACE_C99
+
+
+225 #ifdeà
+__USE_XOPEN2K8
+
+
+227 \ 2
+       ~<xloÿË.h
+>
+
+231 \r\12
+       $isw®num_l
+ (
+w\9at_t
+__wc
+, 
+__loÿË_t
+__loÿË
+__THROW
+;
+
+237 \r\12
+       $isw®pha_l
+ (
+w\9at_t
+__wc
+, 
+__loÿË_t
+__loÿË
+__THROW
+;
+
+240 \r\12
+       $iswú\8cl_l
+ (
+w\9at_t
+__wc
+, 
+__loÿË_t
+__loÿË
+__THROW
+;
+
+244 \r\12
+       $iswdig\99_l
+ (
+w\9at_t
+__wc
+, 
+__loÿË_t
+__loÿË
+__THROW
+;
+
+248 \r\12
+       $iswg¿ph_l
+ (
+w\9at_t
+__wc
+, 
+__loÿË_t
+__loÿË
+__THROW
+;
+
+253 \r\12
+       $iswlow\94_l
+ (
+w\9at_t
+__wc
+, 
+__loÿË_t
+__loÿË
+__THROW
+;
+
+256 \r\12
+       $isw´\9at_l
+ (
+w\9at_t
+__wc
+, 
+__loÿË_t
+__loÿË
+__THROW
+;
+
+261 \r\12
+       $iswpunù_l
+ (
+w\9at_t
+__wc
+, 
+__loÿË_t
+__loÿË
+__THROW
+;
+
+266 \r\12
+       $isw¥aû_l
+ (
+w\9at_t
+__wc
+, 
+__loÿË_t
+__loÿË
+__THROW
+;
+
+271 \r\12
+       $iswuµ\94_l
+ (
+w\9at_t
+__wc
+, 
+__loÿË_t
+__loÿË
+__THROW
+;
+
+276 \r\12
+       $iswxdig\99_l
+ (
+w\9at_t
+__wc
+, 
+__loÿË_t
+__loÿË
+__THROW
+;
+
+281 \r\12
+       $iswbÏnk_l
+ (
+w\9at_t
+__wc
+, 
+__loÿË_t
+__loÿË
+__THROW
+;
+
+285 \r
+wùy³_t
+       $wùy³_l
+ (
+__cڡ
\ 5*
+__´Ý\94ty
+, 
+__loÿË_t
+__loÿË
+)
+
+286 
+__THROW
+;
+
+290 \r\12
+       $iswùy³_l
+ (
+w\9at_t
+__wc
+, 
+wùy³_t
+__desc
+, 
+__loÿË_t
+__loÿË
+)
+
+291 
+__THROW
+;
+
+299 \r
+w\9at_t
+       $towlow\94_l
+ (
+w\9at_t
+__wc
+, 
+__loÿË_t
+__loÿË
+__THROW
+;
+
+302 \r
+w\9at_t
+       $towuµ\94_l
+ (
+w\9at_t
+__wc
+, 
+__loÿË_t
+__loÿË
+__THROW
+;
+
+306 \r
+wù¿ns_t
+       $wù¿ns_l
+ (
+__cڡ
\ 5*
+__´Ý\94ty
+, 
+__loÿË_t
+__loÿË
+)
+
+307 
+__THROW
+;
+
+310 \r
+w\9at_t
+       $towù¿ns_l
+ (
+w\9at_t
+__wc
+, 
+wù¿ns_t
+__desc
+,
+
+311 
+__loÿË_t
+__loÿË
+__THROW
+;
+
+315 
+__END_DECLS
+
+
+       @
+1
+.
+1
+/usr/include
+119
+3418
+email-common/email-common-list.c
+email-common/email-common-msg-queue.c
+email-common/include/email-common-list.h
+email-common/include/email-common-msg-queue.h
+email-ipc-api.c
+email-ipc-api/email-ipc-api-info.c
+email-ipc-api/email-ipc-param-list.c
+email-ipc-api/email-ipc-param.c
+email-ipc-api/include/email-ipc-api-info.h
+email-ipc-api/include/email-ipc-param-list.h
+email-ipc-api/include/email-ipc-param.h
+email-ipc-build.c
+email-ipc-proxy.c
+email-ipc-stub.c
+email-proxy/email-proxy-callback-info.c
+email-proxy/email-proxy-main.c
+email-proxy/email-proxy-socket.c
+email-proxy/include/email-proxy-callback-info.h
+email-proxy/include/email-proxy-main.h
+email-proxy/include/email-proxy-socket.h
+email-socket/email-ipc-socket.c
+email-socket/include/email-ipc-socket.h
+email-stub/email-stub-main.c
+email-stub/email-stub-queue.c
+email-stub/email-stub-response-info.c
+email-stub/email-stub-socket.c
+email-stub/email-stub-task-manager.c
+email-stub/email-stub-task.c
+email-stub/include/email-stub-main.h
+email-stub/include/email-stub-queue.h
+email-stub/include/email-stub-response-info.h
+email-stub/include/email-stub-socket.h
+email-stub/include/email-stub-task-manager.h
+email-stub/include/email-stub-task.h
+include/email-ipc-build.h
+include/email-ipc.h
+/usr/include/errno.h
+/usr/include/malloc.h
+/usr/include/pthread.h
+/usr/include/stdio.h
+/usr/include/stdlib.h
+/usr/include/string.h
+/usr/include/sys/epoll.h
+/usr/include/sys/ioctl.h
+/usr/include/sys/ipc.h
+/usr/include/sys/msg.h
+/usr/include/sys/select.h
+/usr/include/sys/socket.h
+/usr/include/sys/stat.h
+/usr/include/sys/types.h
+/usr/include/sys/un.h
+/usr/include/unistd.h
+/usr/include/alloca.h
+/usr/include/bits/confname.h
+/usr/include/bits/environments.h
+/usr/include/bits/errno.h
+/usr/include/bits/ioctl-types.h
+/usr/include/bits/ioctls.h
+/usr/include/bits/ipc.h
+/usr/include/bits/ipctypes.h
+/usr/include/bits/msq.h
+/usr/include/bits/posix_opt.h
+/usr/include/bits/pthreadtypes.h
+/usr/include/bits/select.h
+/usr/include/bits/setjmp.h
+/usr/include/bits/sigset.h
+/usr/include/bits/sockaddr.h
+/usr/include/bits/socket.h
+/usr/include/bits/socket2.h
+/usr/include/bits/stat.h
+/usr/include/bits/stdio-ldbl.h
+/usr/include/bits/stdio.h
+/usr/include/bits/stdio2.h
+/usr/include/bits/stdio_lim.h
+/usr/include/bits/stdlib-ldbl.h
+/usr/include/bits/stdlib.h
+/usr/include/bits/string.h
+/usr/include/bits/string2.h
+/usr/include/bits/string3.h
+/usr/include/bits/sys_errlist.h
+/usr/include/bits/time.h
+/usr/include/bits/types.h
+/usr/include/bits/unistd.h
+/usr/include/bits/waitflags.h
+/usr/include/bits/waitstatus.h
+/usr/include/bits/wordsize.h
+/usr/include/endian.h
+/usr/include/features.h
+/usr/include/getopt.h
+/usr/include/libio.h
+/usr/include/sched.h
+/usr/include/stdint.h
+/usr/include/sys/cdefs.h
+/usr/include/sys/sysmacros.h
+/usr/include/sys/ttydefaults.h
+/usr/include/sys/uio.h
+/usr/include/time.h
+/usr/include/xlocale.h
+/usr/include/_G_config.h
+/usr/include/bits/byteswap.h
+/usr/include/bits/endian.h
+/usr/include/bits/libio-ldbl.h
+/usr/include/bits/predefs.h
+/usr/include/bits/sched.h
+/usr/include/bits/stdio-lock.h
+/usr/include/bits/typesizes.h
+/usr/include/bits/uio.h
+/usr/include/bits/wchar.h
+/usr/include/ctype.h
+/usr/include/gnu/stubs.h
+/usr/include/linux/errno.h
+/usr/include/bits/libc-lock.h
+/usr/include/gconv.h
+/usr/include/gnu/stubs-32.h
+/usr/include/wchar.h
+/usr/include/bits/wchar-ldbl.h
+/usr/include/bits/wchar2.h
+/usr/include/gnu/option-groups.h
+/usr/include/wctype.h
diff --git a/email-ipc/email-ipc-api.c b/email-ipc/email-ipc-api.c
new file mode 100755 (executable)
index 0000000..b2fd4f8
--- /dev/null
@@ -0,0 +1,155 @@
+/*
+*  email-service
+*
+* Copyright (c) 2000 - 2011 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.
+*
+*/
+
+#include <malloc.h>
+
+#include "email-ipc.h"
+#include "email-ipc-build.h"
+#include "email-ipc-api-info.h"
+#include "email-ipc-param-list.h"
+#include "email-ipc-socket.h"
+#include "email-proxy-main.h"
+
+#include "email-debug-log.h"
+#include "email-errors.h"
+
+EXPORT_API emipc_param_list *emipc_get_api_parameters(HIPC_API api, EPARAMETER_DIRECTION direction)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       emipc_email_api_info *api_info = (emipc_email_api_info *)api;
+
+       return (emipc_param_list *)emipc_get_parameters_of_api_info(api_info, direction);
+}
+
+EXPORT_API HIPC_API emipc_create_email_api(long api_id)
+{
+       EM_DEBUG_FUNC_BEGIN();
+
+       emipc_email_api_info *api_info = NULL;
+
+       api_info = (emipc_email_api_info *)malloc(sizeof(emipc_email_api_info));        
+       if(api_info == NULL) {
+               EM_DEBUG_EXCEPTION("Malloc failed");
+               return NULL;
+       }
+       memset(api_info, 0x00, sizeof(emipc_email_api_info));
+
+       emipc_set_api_id_of_api_info(api_info, api_id);
+
+       return (HIPC_API)api_info;
+}
+
+EXPORT_API void emipc_destroy_email_api(HIPC_API api)
+{
+       EM_DEBUG_FUNC_BEGIN("API = %p", api);
+       emipc_email_api_info *api_info = (emipc_email_api_info *)api;
+       EM_SAFE_FREE(api_info);
+}
+
+EXPORT_API long emipc_get_api_id(HIPC_API api)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       emipc_email_api_info *api_info = (emipc_email_api_info*)api;
+       return emipc_get_api_id_of_api_info(api_info);
+}
+
+EXPORT_API long emipc_get_app_id(HIPC_API api)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       emipc_email_api_info *api_info = (emipc_email_api_info *)api;
+       return emipc_get_app_id_of_api_info(api_info);
+}
+
+EXPORT_API bool emipc_add_parameter(HIPC_API api, EPARAMETER_DIRECTION direction, void *data, int data_length)
+{
+       EM_DEBUG_FUNC_BEGIN();
+
+       emipc_param_list *parameters = emipc_get_api_parameters(api, direction);
+       if (parameters)
+               return emipc_add_param_of_param_list(parameters, data, data_length);
+       else
+               return false;
+}
+
+EXPORT_API int emipc_get_parameter_count(HIPC_API api, EPARAMETER_DIRECTION direction)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       
+       emipc_param_list *parameters = emipc_get_api_parameters(api, direction);
+
+       if(parameters) 
+               return emipc_get_param_count_of_param_list(parameters);
+       else
+               return -1;
+}
+
+EXPORT_API int emipc_get_parameter(HIPC_API input_api_handle, EPARAMETER_DIRECTION input_parameter_direction, int input_parameter_index, int input_parameter_buffer_size, void *output_parameter_buffer)
+{
+       EM_DEBUG_FUNC_BEGIN("input_api_handle [%d], input_parameter_direction [%d], input_parameter_index [%d], input_parameter_buffer_size [%d], output_parameter_buffer [%p]", input_api_handle , input_parameter_direction , input_parameter_index, input_parameter_buffer_size, output_parameter_buffer);
+       emipc_param_list *parameters = NULL;
+       void *local_buffer = NULL;
+
+       if (input_parameter_buffer_size == 0 || output_parameter_buffer == NULL) {
+               EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
+               return EMF_ERROR_INVALID_PARAM;
+       }
+
+       parameters = emipc_get_api_parameters(input_api_handle, input_parameter_direction);
+
+       if (parameters == NULL) {
+               EM_DEBUG_EXCEPTION("EMF_ERROR_IPC_PROTOCOL_FAILURE");
+               return EMF_ERROR_IPC_PROTOCOL_FAILURE;
+       }
+
+       local_buffer = emipc_get_param_of_param_list(parameters, input_parameter_index);
+
+       if (local_buffer == NULL) {
+               EM_DEBUG_EXCEPTION("EMF_ERROR_IPC_PROTOCOL_FAILURE");
+               return EMF_ERROR_IPC_PROTOCOL_FAILURE;
+       }
+
+       if (emipc_get_param_len_of_param_list(parameters, input_parameter_index) != input_parameter_buffer_size) {
+               EM_DEBUG_EXCEPTION("EMF_ERROR_IPC_PROTOCOL_FAILURE");
+               return EMF_ERROR_IPC_PROTOCOL_FAILURE;
+       }
+
+       memcpy(output_parameter_buffer, local_buffer, input_parameter_buffer_size);
+
+       EM_DEBUG_FUNC_END("Suceeded");
+       return EMF_ERROR_NONE;
+}
+
+EXPORT_API int emipc_get_parameter_length(HIPC_API api, EPARAMETER_DIRECTION direction, int parameter_index)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       emipc_param_list *parameters = emipc_get_api_parameters(api, direction);
+       if (parameters) {
+               EM_DEBUG_FUNC_END("Suceeded");
+               return emipc_get_param_len_of_param_list(parameters, parameter_index);
+       }
+       EM_DEBUG_FUNC_END("Failed");
+       return -1;
+}
+
+
+
+
+
diff --git a/email-ipc/email-ipc-api/email-ipc-api-info.c b/email-ipc/email-ipc-api/email-ipc-api-info.c
new file mode 100755 (executable)
index 0000000..c4e2cba
--- /dev/null
@@ -0,0 +1,155 @@
+/*
+*  email-service
+*
+* Copyright (c) 2000 - 2011 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.
+*
+*/
+
+
+#include <string.h>
+#include <unistd.h>
+#include <malloc.h>
+
+#include "email-ipc-api-info.h"
+#include "email-ipc-param-list.h"
+#include "email-ipc-build.h"
+
+#include "email-debug-log.h"
+
+static long emipc_parse_api_id_of_api_info(emipc_email_api_info *api_info, void *stream);
+static long emipc_parse_response_id_of_api_info(emipc_email_api_info *api_info, void* stream);
+static long emipc_parse_app_id_of_api_info(emipc_email_api_info *api_info, void* stream);
+
+EXPORT_API bool emipc_set_api_id_of_api_info(emipc_email_api_info *api_info, long api_id)
+{
+       api_info->api_id = api_id;
+       return true;
+}
+
+EXPORT_API long emipc_get_api_id_of_api_info(emipc_email_api_info *api_info)
+{
+       return api_info->api_id;
+}
+
+EXPORT_API bool emipc_set_app_id_of_api_info(emipc_email_api_info *api_info, long app_id)
+{
+       api_info->app_id = app_id;
+       return true;
+}
+
+EXPORT_API long emipc_get_app_id_of_api_info(emipc_email_api_info *api_info)
+{
+       return api_info->app_id;
+}
+
+EXPORT_API bool emipc_set_response_id_of_api_info(emipc_email_api_info *api_info, long response_id)
+{
+       api_info->response_id = response_id;
+       return true;
+}
+
+EXPORT_API long emipc_get_response_id_of_api_info(emipc_email_api_info *api_info)
+{
+       return api_info->response_id;
+}
+
+EXPORT_API bool emipc_parse_stream_of_api_info(emipc_email_api_info *api_info, EPARAMETER_DIRECTION direction, void *stream)
+{
+       emipc_param_list *new_param_list = NULL;
+
+       if (api_info->params[direction] == NULL) {
+               new_param_list = (emipc_param_list *)malloc(sizeof(emipc_param_list));
+               if (new_param_list == NULL) {
+                       EM_DEBUG_EXCEPTION("Memory allocation failed.");
+                       return false;
+               }
+               memset(new_param_list, 0x00, sizeof(emipc_param_list));
+               api_info->params[direction] = new_param_list;
+       }
+
+       emipc_parse_api_id_of_api_info(api_info, stream);
+       emipc_parse_app_id_of_api_info(api_info, stream);
+       emipc_parse_response_id_of_api_info(api_info, stream);
+       return emipc_parse_stream_of_param_list(api_info->params[direction], stream);
+}
+
+EXPORT_API unsigned char *emipc_get_stream_of_api_info(emipc_email_api_info *api_info, EPARAMETER_DIRECTION direction)
+{
+       emipc_param_list *new_param_list = NULL;
+       unsigned char *stream = NULL;
+
+       if (api_info->params[direction] == NULL) {
+               new_param_list = (emipc_param_list *)malloc(sizeof(emipc_param_list));
+               if (new_param_list == NULL) {
+                       EM_DEBUG_EXCEPTION("Memory allocation failed.");
+                       return false;
+               }
+               memset(new_param_list, 0x00, sizeof(emipc_param_list));
+               api_info->params[direction] = new_param_list;
+       }
+
+       stream = emipc_get_stream_of_param_list(api_info->params[direction]);
+       if (stream != NULL) {
+               memcpy(stream, &(api_info->api_id), sizeof(api_info->api_id));
+               memcpy(stream+(sizeof(long)*eSTREAM_RESID), &(api_info->response_id), sizeof(api_info->response_id));
+               memcpy(stream+(sizeof(long)*eSTREAM_APPID), &(api_info->app_id), sizeof(api_info->app_id));
+       }
+       return stream;
+}
+
+EXPORT_API int emipc_get_stream_length_of_api_info(emipc_email_api_info *api_info, EPARAMETER_DIRECTION direction)
+{
+       if (api_info->params[direction] == NULL)
+               return 0;
+
+       return emipc_get_stream_length_of_param_list(api_info->params[direction]);
+}
+
+EXPORT_API void *emipc_get_parameters_of_api_info(emipc_email_api_info *api_info, EPARAMETER_DIRECTION direction)
+{
+       emipc_param_list *new_param_list = NULL;
+
+       if (api_info->params[direction] == NULL) {
+               new_param_list = (emipc_param_list *)malloc(sizeof(emipc_param_list));
+               if (new_param_list == NULL) {
+                       EM_DEBUG_EXCEPTION("Memory allocation failed.");
+                       return false;
+               }
+               memset(new_param_list, 0x00, sizeof(emipc_param_list));
+               api_info->params[direction] = new_param_list;
+       }
+       return api_info->params[direction];
+}
+
+static long emipc_parse_api_id_of_api_info(emipc_email_api_info *api_info, void *stream)
+{
+       api_info->api_id = *((long *)stream + eSTREAM_APIID);
+       return api_info->api_id;
+}
+
+static long emipc_parse_response_id_of_api_info(emipc_email_api_info *api_info, void* stream)
+{
+       api_info->response_id = *((long*)stream + eSTREAM_RESID);
+       return api_info->response_id;
+}
+
+static long emipc_parse_app_id_of_api_info(emipc_email_api_info *api_info, void* stream)
+{
+       api_info->app_id = *((long*)stream + eSTREAM_APPID);
+       return api_info->app_id;
+
+}
diff --git a/email-ipc/email-ipc-api/email-ipc-param-list.c b/email-ipc/email-ipc-api/email-ipc-param-list.c
new file mode 100755 (executable)
index 0000000..d899743
--- /dev/null
@@ -0,0 +1,177 @@
+/*
+*  email-service
+*
+* Copyright (c) 2000 - 2011 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.
+*
+*/
+
+
+#include <string.h>
+#include <stdlib.h>
+
+#include "email-ipc-build.h"
+#include "email-ipc-param-list.h"
+
+#include "email-debug-log.h"
+
+/*  stream */
+/*  +----------------------------------------------------------------------------------------------------------+ */
+/*  | API ID(4B) | Resp. ID (4B) | Param Count(4B) | Param1 Len | Param1 Data | ... | ParamN Len | ParamN data |  */
+/*  +----------------------------------------------------------------------------------------------------------+ */
+
+static long emipc_parse_parameter_count(void *stream);
+
+EXPORT_API bool emipc_parse_stream_of_param_list(emipc_param_list *param_list, void *stream_data)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       long parameter_count = emipc_parse_parameter_count(stream_data);
+       if(parameter_count <= 0) {
+               EM_DEBUG_EXCEPTION("There is no parameter. ");
+               return false;
+       }
+
+       unsigned char* stream = (unsigned char*)stream_data;
+       long index, param_len, pos = sizeof(long)*eSTREAM_DATA;
+
+       for(index = 0; index < parameter_count; index++) {
+               long len =0;
+               memcpy(&len, stream+pos, sizeof(long));
+               param_len = len;
+               EM_DEBUG_LOG("Parameter Length [%d] : %d ", index, param_len);
+               pos += sizeof(long);    /*  Move from length position to data position */
+
+               emipc_add_param_of_param_list(param_list, (void*)(stream+pos), param_len);
+               pos += param_len;               /*  move to next parameter       */
+       }
+       
+       return true;
+}
+
+EXPORT_API unsigned char *emipc_get_stream_of_param_list(emipc_param_list *param_list)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       if(param_list->byte_stream)
+               return param_list->byte_stream;
+       
+       int stream_len = emipc_get_stream_length_of_param_list(param_list);
+       
+       if (stream_len > 0) {
+               param_list->byte_stream = (unsigned char*)calloc(1, stream_len);
+               int pos = sizeof(long)*eSTREAM_COUNT;
+
+               if (pos + (int)sizeof(param_list->param_count) > stream_len ) {
+                       EM_DEBUG_EXCEPTION("%d > stream_len", pos + sizeof(param_list->param_count));                   
+                       EM_SAFE_FREE(param_list->byte_stream);
+                       return NULL;
+               }
+               
+               memcpy((param_list->byte_stream + pos), &param_list->param_count, sizeof(param_list->param_count));
+               
+               pos += sizeof(long);
+               int index = 0, length = 0;
+
+               /*   check memory overflow */
+               for(index=0; index<param_list->param_count; index++) {
+                       length = emipc_get_length(param_list->params[index]);
+                       if (length <= 0) {
+                               EM_DEBUG_EXCEPTION("index = %d, length = %d", index, length);                   
+                               EM_SAFE_FREE(param_list->byte_stream);
+                               return NULL;
+                       }
+
+                       if (pos + (int)sizeof(long) > stream_len) {
+                               EM_DEBUG_EXCEPTION("%d > stream_len", pos + sizeof(long));                      
+                               EM_SAFE_FREE(param_list->byte_stream);
+                               return NULL;
+                       }
+                       memcpy((param_list->byte_stream+pos), &length, sizeof(long));
+                       pos += sizeof(long);
+
+                       if (pos + length > stream_len) {
+                               EM_DEBUG_EXCEPTION("%d > stream_len", pos + length);                    
+                               EM_SAFE_FREE(param_list->byte_stream);
+                               return NULL;
+                       }
+                       
+                       memcpy((param_list->byte_stream+pos), emipc_get_data(param_list->params[index]), length);
+                       pos += length;
+               }
+               return param_list->byte_stream;
+       }
+       
+       EM_DEBUG_EXCEPTION("failed.");                  
+       EM_SAFE_FREE(param_list->byte_stream);
+
+       EM_DEBUG_FUNC_END();
+       return NULL;
+}
+
+EXPORT_API int emipc_get_stream_length_of_param_list(emipc_param_list *param_list)
+{
+       int length = sizeof(long) * eSTREAM_DATA;
+       int index;
+       for (index = 0; index < param_list->param_count; index++) {
+               length += sizeof(long);
+               length += emipc_get_length(param_list->params[index]);
+       }
+       return length;
+}
+
+EXPORT_API bool emipc_add_param_of_param_list(emipc_param_list *param_list, void *data, int len)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       if (emipc_set_param(&(param_list->params[param_list->param_count]), data, len)) {
+               param_list->param_count++;
+               EM_SAFE_FREE(param_list->byte_stream);
+               return true;
+       }
+       return false;
+}
+
+EXPORT_API void *emipc_get_param_of_param_list(emipc_param_list *param_list, int index)
+{
+       EM_DEBUG_FUNC_BEGIN("index [%d]", index);
+       if (index < 0 || index >= param_list->param_count) {
+               EM_DEBUG_EXCEPTION("Index value is not valid");
+               return NULL;
+       }
+       return emipc_get_data(param_list->params[index]);
+}
+
+EXPORT_API int emipc_get_param_len_of_param_list(emipc_param_list *param_list, int index)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       if (index < 0 || index >= param_list->param_count) {
+               EM_DEBUG_EXCEPTION("Index valud is not valid");
+               return 0;
+       }
+       return emipc_get_length(param_list->params[index]);
+}
+
+EXPORT_API int emipc_get_param_count_of_param_list(emipc_param_list *param_list)
+{
+       EM_DEBUG_FUNC_BEGIN("Parameter count [%d]", param_list->param_count);
+       return param_list->param_count;
+}
+
+static long emipc_parse_parameter_count(void *stream)
+{
+       EM_DEBUG_FUNC_BEGIN();  
+       long *parameter_count_position = (long *)stream + eSTREAM_COUNT;
+       
+       return *parameter_count_position;
+}
similarity index 60%
rename from ipc/api/ipc-param.cpp
rename to email-ipc/email-ipc-api/email-ipc-param.c
index f704626..57db8c3 100755 (executable)
 #include <string.h>
 #include <stdlib.h>
 
-#include "ipc-param.h"
-#include "emf-dbglog.h"
+#include "email-ipc-param.h"
+#include "email-debug-log.h"
 
-ipcEmailParam::ipcEmailParam()
+EXPORT_API bool emipc_set_param(emipc_param *param, void *data, int len)
 {
-       m_nLength = 0;
-       m_pData = NULL;
+       EM_DEBUG_FUNC_BEGIN();
 
-}
-ipcEmailParam::~ipcEmailParam()
-{
-       EM_SAFE_FREE(m_pData);
-}
+       if (!param) {
+               EM_DEBUG_EXCEPTION("Invalid paramter");
+               return false;
+       }
 
-bool ipcEmailParam::SetParam(void* a_pData, int a_nLen)
-{
-       if(a_nLen == 0)
+       if (len == 0)
                return true;
        
-       m_pData = (void*)malloc(a_nLen);
-       if(m_pData == NULL)
+       param->data = (void *)malloc(len);
+       if (param->data == NULL) {
                return false;
-       memset(m_pData, 0x00, a_nLen);
-       
-       if(a_pData != NULL) {
-               memcpy(m_pData, a_pData, a_nLen);
        }
-       m_nLength = a_nLen;
+       memset(param->data, 0x00, len);
+       memcpy(param->data, data, len);
+       param->length = len;
        return true;
 }
 
-int ipcEmailParam::GetLength()
+EXPORT_API int emipc_get_length(emipc_param param)
 {
-       return m_nLength;
+       return param.length;
 }
 
-void* ipcEmailParam::GetData()
+EXPORT_API void *emipc_get_data(emipc_param param)
 {
-       return m_pData;
+       return param.data;
 }
-
-
similarity index 77%
rename from ipc/api/include/ipc-api-info.h
rename to email-ipc/email-ipc-api/include/email-ipc-api-info.h
index 50d5146..705b97d 100755 (executable)
 #define _IPC_APIINFO_H_
 
 #include <stdio.h>
-#include "ipc-library.h"
-#include "emf-dbglog.h"
-#include "Emf_Mapi.h"
 
-class ipcEmailParamList;
+#include "email-ipc.h"
+#include "email-ipc-api-info.h"
+#include "email-ipc-param-list.h"
 
-class ipcEmailAPIInfo {
-public:
-       ipcEmailAPIInfo();
-       virtual ~ipcEmailAPIInfo();
+typedef struct {
+       long api_id;
+       long response_id;
+       long app_id;
+       emipc_param_list *params[2];
+} emipc_email_api_info;
 
-private:
+EXPORT_API bool emipc_set_api_id_of_api_info(emipc_email_api_info *api_info, long api_id);
 
-       long m_nAPIID;
-       long m_nResponseID;                             /* sync */
-       long m_nAPPID;                                  /* Async 0 : Sync, > 0 : Async */
-       ipcEmailParamList *m_pParams[2];
+EXPORT_API long emipc_get_api_id_of_api_info(emipc_email_api_info *api_info);
 
-public:
-       bool    SetAPIID(long a_nAPIID);
-       long    GetAPIID();
-       bool    SetAPPID(long a_nResponseID);
-       long            GetAPPID();
-       bool    SetResponseID(long a_nResponseID);
-       long            GetResponseID();
+EXPORT_API bool emipc_set_app_id_of_api_info(emipc_email_api_info *api_info, long app_id);
 
-       bool    ParseStream(EPARAMETER_DIRECTION a_eDirection, void* a_pStream);
-       void*   GetStream(EPARAMETER_DIRECTION a_eDirection);
+EXPORT_API long emipc_get_app_id_of_api_info(emipc_email_api_info *api_info);
 
-       int     GetStreamLength(EPARAMETER_DIRECTION a_eDirection);
-       void*   GetParameters(EPARAMETER_DIRECTION a_eDirection);
+EXPORT_API bool emipc_set_response_id_of_api_info(emipc_email_api_info *api_info, long response_id);
 
-private:
-       long            ParseAPIID(void* a_pStream);
-       long            ParseResponseID(void* a_pStream);
-       long            ParseAPPID(void* a_pStream);
+EXPORT_API long emipc_get_response_id_of_api_info(emipc_email_api_info *api_info);
+
+EXPORT_API bool emipc_parse_stream_of_api_info(emipc_email_api_info *api_info, EPARAMETER_DIRECTION direction, void *stream);
+
+EXPORT_API unsigned char *emipc_get_stream_of_api_info(emipc_email_api_info *api_info, EPARAMETER_DIRECTION direction);
+
+EXPORT_API int emipc_get_stream_length_of_api_info(emipc_email_api_info *api_info, EPARAMETER_DIRECTION direction);
+
+EXPORT_API void *emipc_get_parameters_of_api_info(emipc_email_api_info *api_info, EPARAMETER_DIRECTION direction);
 
-};
 
 
 /* don't insert empty line */
@@ -73,12 +67,6 @@ private:
                        case _EMAIL_API_ADD_ACCOUNT:\
                                        s = "_EMAIL_API_ADD_ACCOUNT";\
                                        break;\
-                       case _EMAIL_API_ADD_MAIL_OLD:\
-                                       s = "_EMAIL_API_ADD_MAIL_OLD";\
-                                       break;\
-                       case _EMAIL_API_GET_MAIL:\
-                                       s = "_EMAIL_API_GET_MAIL";\
-                                       break;\
                        case _EMAIL_API_ADD_MAILBOX:\
                                        s = "_EMAIL_API_ADD_MAILBOX";\
                                        break;\
@@ -112,9 +100,6 @@ private:
                        case _EMAIL_API_CLEAR_DATA:\
                                        s = "_EMAIL_API_CLEAR_DATA";\
                                        break;\
-                       case _EMAIL_API_UPDATE_MAIL_OLD:\
-                                       s = "_EMAIL_API_UPDATE_MAIL_OLD";\
-                                       break;\
                        case _EMAIL_API_DELETE_ALL_MAIL:\
                                        s = "_EMAIL_API_DELETE_ALL_MAIL";\
                                        break;\
@@ -187,23 +172,11 @@ private:
                        case _EMAIL_API_DOWNLOAD_ATTACHMENT:\
                                        s = "_EMAIL_API_DOWNLOAD_ATTACHMENT";\
                                        break;\
-                       case _EMAIL_API_GET_INFO:\
-                                       s = "_EMAIL_API_GET_INFO";\
-                                       break;\
-                       case _EMAIL_API_GET_HEADER_INFO:\
-                                       s = "_EMAIL_API_GET_INFO";\
-                                       break;\
-                       case _EMAIL_API_GET_BODY_INFO:\
-                                       s = "_EMAIL_API_GET_BODY_INFO";\
-                                       break;\
                        case _EMAIL_API_GET_ACCOUNT_LIST:\
                                        s = "_EMAIL_API_GET_ACCOUNT_LIST";\
                                        break;\
-                       case _EMAIL_API_MAIL_SEND_SAVED:\
-                                       s = "_EMAIL_API_MAIL_SEND_SAVED";\
-                                       break;\
-                       case _EMAIL_API_MAIL_SEND_REPORT:\
-                                       s = "_EMAIL_API_MAIL_SEND_REPORT";\
+                       case _EMAIL_API_SEND_SAVED:\
+                                       s = "_EMAIL_API_SEND_SAVED";\
                                        break;\
                        case _EMAIL_API_CANCEL_JOB:\
                                        s = "_EMAIL_API_CANCEL_JOB";\
@@ -223,8 +196,8 @@ private:
                        case _EMAIL_API_SEND_MAIL_CANCEL_JOB :\
                                        s = "_EMAIL_API_SEND_MAIL_CANCEL_JOB";\
                                        break;\
-                       case _EMAIL_API_FIND_MAIL_ON_SERVER :\
-                                       s = "_EMAIL_API_FIND_MAIL_ON_SERVER";\
+                       case _EMAIL_API_SEARCH_MAIL_ON_SERVER :\
+                                       s = "_EMAIL_API_SEARCH_MAIL_ON_SERVER";\
                                        break;\
                        case _EMAIL_API_ADD_ACCOUNT_WITH_VALIDATION :\
                                        s = "_EMAIL_API_ADD_ACCOUNT_WITH_VALIDATION";\
similarity index 53%
rename from ipc/api/include/ipc-param-list.h
rename to email-ipc/email-ipc-api/include/email-ipc-param-list.h
index 0da39c1..c7d71ba 100755 (executable)
 #ifndef _IPC_PARAMLIST_H_
 #define _IPC_PARAMLIST_H_
 
-
-#include "ipc-param.h"
-#include "emf-dbglog.h"
+#include "email-ipc-param.h"
+#include "email-types.h"
 
 typedef enum {
-       eSTREAM_APIID,
+       eSTREAM_APIID = 0,
        eSTREAM_RESID,
        eSTREAM_APPID,
        eSTREAM_COUNT,
        eSTREAM_DATA,
        eSTREAM_MAX
-       
 }IPC_STREAM_INFO;
 
-class ipcEmailParamList {
-public:
-       ipcEmailParamList();
-       virtual ~ipcEmailParamList();
-       
-       bool    ParseStream(void* a_pStreamData);
-       void*   GetStream();
-       int     GetStreamLength();
+typedef struct {
+       int param_count;
+       emipc_param params[10];
+       unsigned char *byte_stream;
+} emipc_param_list;
+
+EXPORT_API bool emipc_parse_stream_of_param_list(emipc_param_list *param_list, void *stream_data);
+
+EXPORT_API unsigned char *emipc_get_stream_of_param_list(emipc_param_list *param_list);
 
-       bool    AddParam(void* a_pData, int a_nLen);
+EXPORT_API int emipc_get_stream_length_of_param_list(emipc_param_list *param_list);
 
-       void*   GetParam(int a_nIndex);
-       int     GetParamLen(int a_nIndex);
-       int     GetParamCount();
+EXPORT_API bool emipc_add_param_of_param_list(emipc_param_list *param_list, void *data, int len);
 
-private:
-       long    ParseParameterCount(void *a_pStream);
-       
-private:
-       int m_nParamCount;
-       ipcEmailParam m_lstParams[10];
-       unsigned char *m_pbyteStream;
+EXPORT_API void *emipc_get_param_of_param_list(emipc_param_list *param_list, int index);
 
-};
+EXPORT_API int emipc_get_param_len_of_param_list(emipc_param_list *param_list, int index);
 
+EXPORT_API int emipc_get_param_count_of_param_list(emipc_param_list *param_list);
 #endif /* _IPC_PARAMLIST_H_ */
 
 
similarity index 75%
rename from ipc/api/include/ipc-param.h
rename to email-ipc/email-ipc-api/include/email-ipc-param.h
index f363219..361927b 100755 (executable)
 #ifndef _IPC_PARAM_H_
 #define _IPC_PARAM_H_
 
-class ipcEmailParam {
-       public:
-               ipcEmailParam();
-               virtual ~ipcEmailParam();
-
-       private:
-               int     m_nLength;
-               void*   m_pData;
-       public:
-               bool    SetParam(void* a_pData, int a_nLen);
-               int     GetLength();
-               void*   GetData();
-
-};
+#include "email-types.h"
+
+typedef struct {
+       int length;
+       void *data;
+} emipc_param;
+
+EXPORT_API bool emipc_set_param(emipc_param *param, void *data, int len);
+
+EXPORT_API int emipc_get_length(emipc_param param);
+
+EXPORT_API void *emipc_get_data(emipc_param param);
 
 #endif /* _IPC_PARAM_H_ */
 
similarity index 96%
rename from ipc/ipc-library-build.cpp
rename to email-ipc/email-ipc-build.c
index 53c2428..a554047 100755 (executable)
@@ -22,7 +22,8 @@
 
 #include <stdlib.h>
 #include <stdarg.h>
-#include "ipc-library-build.h"
+
+#include "email-ipc-build.h"
 
 
 
similarity index 58%
rename from ipc/ipc-library-proxy.cpp
rename to email-ipc/email-ipc-proxy.c
index b750751..2aa6833 100755 (executable)
  * \r
  */\r
 \r
-#include "include/ipc-library-build.h"\r
-#include "include/ipc-library.h"\r
-#include "proxy/include/ipc-proxy-main.h"\r
-#include "api/include/ipc-api-info.h"\r
-#include "api/include/ipc-param-list.h"\r
-#include "emf-dbglog.h"\r
-#include "ipc-socket.h"\r
+#include "email-ipc-build.h"\r
+#include "email-ipc.h"\r
+#include "email-ipc-api-info.h"\r
+#include "email-ipc-param-list.h"\r
+#include "email-ipc-socket.h"\r
+#include "email-proxy-main.h"\r
 \r
-EXPORT_API int ipcEmailProxy_Initialize()\r
+#include "email-debug-log.h"\r
+#include "email-api.h"\r
+#include "email-types.h"\r
+\r
+EXPORT_API int emipc_initialize_proxy()\r
 {\r
        EM_DEBUG_FUNC_BEGIN();\r
 \r
-       int err = ipcEmailProxyMain::Instance()->Initialize();\r
+       int err = emipc_initialize_proxy_main();\r
 \r
        EM_DEBUG_FUNC_END();\r
        return err;\r
 }\r
 \r
-EXPORT_API int ipcEmailProxy_Finalize()\r
+EXPORT_API int emipc_finalize_proxy()\r
 {\r
        EM_DEBUG_FUNC_BEGIN();\r
-       return ipcEmailProxyMain::Instance()->Finalize();;\r
+       return emipc_finalize_proxy_main();\r
 }\r
 \r
-EXPORT_API bool ipcEmailProxy_ExecuteAPI(HIPC_API a_hAPI)\r
+EXPORT_API bool emipc_execute_proxy_api(HIPC_API api)\r
 {\r
        EM_DEBUG_FUNC_BEGIN();\r
        int ret;\r
        int err = EMF_ERROR_NONE;\r
-       ipcEmailAPIInfo *pApi = static_cast<ipcEmailAPIInfo *>(a_hAPI);\r
+       emipc_email_api_info *api_info = (emipc_email_api_info *)api;\r
 \r
-       EM_DEBUG_LOG("pApi [%p]", pApi);\r
+       EM_DEBUG_LOG("API [%p]", api_info);\r
                \r
-       if(pApi == NULL) {\r
+       if(api_info == NULL) {\r
                EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");\r
                return EMF_ERROR_INVALID_PARAM;\r
        }\r
                \r
-       EM_DEBUG_LOG("APIID [%s], ResponseID [%d], APPID[%d]", EM_APIID_TO_STR(pApi->GetAPIID()), pApi->GetResponseID(), pApi->GetAPPID());\r
+       EM_DEBUG_LOG("APIID [%s], ResponseID [%d], APPID[%d]", EM_APIID_TO_STR(emipc_get_api_id_of_api_info(api_info)), emipc_get_response_id_of_api_info(api_info), emipc_get_app_id_of_api_info(api_info));\r
 \r
-       ret = ipcEmailProxyMain::Instance()->ExecuteAPI(pApi);\r
+       ret = emipc_execute_api_of_proxy_main(api_info);\r
 \r
        /* connection retry */\r
-\r
        if (!ret) {\r
-               ipcEmailProxy_Finalize();\r
+               emipc_finalize_proxy();\r
 \r
-               err = ipcEmailProxy_Initialize();\r
+               err = emipc_initialize_proxy();\r
                if (err != EMF_ERROR_NONE) {\r
                        EM_DEBUG_EXCEPTION("Failed to open the socket : [%d]", err);\r
                        return EMF_ERROR_CONNECTION_FAILURE;\r
                }\r
-       \r
-               ret = ipcEmailProxyMain::Instance()->ExecuteAPI(pApi);\r
 \r
+               ret = emipc_execute_api_of_proxy_main(api_info);\r
                if (!ret) {\r
-                       EM_DEBUG_EXCEPTION("ipcEmailProxyMain::ExecuteAPI failed [%d]", err);\r
+                       EM_DEBUG_EXCEPTION("emipc_proxy_main : emipc_execute_api failed [%d]", err);\r
                        return EMF_ERROR_CONNECTION_FAILURE;\r
                }\r
        }\r
similarity index 62%
rename from ipc/ipc-library-stub.cpp
rename to email-ipc/email-ipc-stub.c
index 8900b2f..94e04e7 100755 (executable)
 */
 
 
-#include "include/ipc-library.h"
-#include "stub/include/ipc-stub-main.h"
-#include "include/ipc-library-build.h"
-#include "emf-dbglog.h"
+#include "email-ipc.h"
+#include "email-ipc-build.h"
+#include "email-stub-main.h"
 
-EXPORT_API bool ipcEmailStub_Initialize(PFN_EXECUTE_API a_pfnAPIMapper)
+#include "email-debug-log.h"
+
+EXPORT_API bool emipc_initialize_stub(PFN_EXECUTE_API api_mapper)
 {
        EM_DEBUG_LOG("[IPCLib] ipcEmailStub_Initialize ");
 
-       return ipcEmailStubMain::Instance()->Initialize(a_pfnAPIMapper);
+       return emipc_initialize_stub_main(api_mapper);
+/*
+       return ipcEmailStubMain::Instance()->Initialize(api_mapper);
+*/
 }
 
-EXPORT_API bool ipcEmailStub_Finalize(void)
+EXPORT_API bool emipc_finalize_stub()
 {
-
+       emipc_finalize_stub_main();
+       return true;
+/*
        ipcEmailStubMain::Instance()->Finalize();
        ipcEmailStubMain::Instance()->FreeInstance();
        return true;
+*/
 }
 
-EXPORT_API bool ipcEmailStub_ExecuteAPI(HIPC_API a_hAPI)
+EXPORT_API bool emipc_execute_stub_api(HIPC_API api)
 {
-       EM_DEBUG_LOG("ipcEmailStub_ExecuteAPI [%x]", a_hAPI);
+       EM_DEBUG_LOG("ipcEmailStub_ExecuteAPI [%x]", api);
+       emipc_email_api_info *api_info = (emipc_email_api_info *)api;
+       if (api_info == NULL)
+               return false;
+
+       return emipc_execute_api_stub_to_proxy(api_info);
+/*
        ipcEmailAPIInfo *pApi = static_cast<ipcEmailAPIInfo *>(a_hAPI);
        if(pApi == NULL)
                return false;
        return ipcEmailStubMain::Instance()->ExecuteAPIStubToProxy(pApi);
-
+*/
 }    
 
diff --git a/email-ipc/email-proxy/email-proxy-callback-info.c b/email-ipc/email-proxy/email-proxy-callback-info.c
new file mode 100755 (executable)
index 0000000..5079b99
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+*  email-service
+*
+* Copyright (c) 2000 - 2011 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.
+*
+*/
+
+
+#include "email-proxy-callback-info.h"
+
+EXPORT_API bool emipc_set_cb_info_value(emipc_email_cb_info *cb_info, int api_id, void *fn_callback)
+{
+       cb_info->api_id = api_id;
+       cb_info->fn_callback = fn_callback;
+       return true;
+}
diff --git a/email-ipc/email-proxy/email-proxy-main.c b/email-ipc/email-proxy/email-proxy-main.c
new file mode 100755 (executable)
index 0000000..d95d4d0
--- /dev/null
@@ -0,0 +1,161 @@
+/*
+*  email-service
+*
+* Copyright (c) 2000 - 2011 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.
+*
+*/
+
+
+#include <unistd.h>
+#include <pthread.h>
+#include <malloc.h>
+
+#include "email-ipc.h"
+#include "email-ipc-build.h"
+#include "email-proxy-main.h"
+#include "email-proxy-socket.h"
+#include "email-proxy-callback-info.h"
+
+#include "email-internal-types.h"
+#include "email-debug-log.h"
+
+static int reference = 0;
+
+pthread_mutex_t ipc_proxy_mutex = PTHREAD_MUTEX_INITIALIZER;
+pthread_cond_t ipc_proxy_cond = PTHREAD_COND_INITIALIZER;
+
+
+EXPORT_API int emipc_initialize_proxy_main()
+{
+       EM_DEBUG_FUNC_BEGIN();
+       
+       if (reference > 0) {
+               EM_DEBUG_EXCEPTION("Already Intialized reference[%d]", reference);
+               return EMF_ERROR_NONE;
+       }
+
+       reference++;
+       
+       if (!emipc_start_proxy_socket()) {
+               EM_DEBUG_EXCEPTION("Socket start failed");
+               return EMF_ERROR_IPC_CONNECTION_FAILURE;
+       }
+       
+       EM_DEBUG_LOG("Socket ID : %d", emipc_get_proxy_socket_id());
+       EM_DEBUG_FUNC_END();
+       return EMF_ERROR_NONE; 
+}
+
+EXPORT_API int emipc_finalize_proxy_main()
+{
+       EM_DEBUG_FUNC_BEGIN();
+       
+       if (--reference > 0) {
+               EM_DEBUG_EXCEPTION("More than one reference[%d]", reference);
+               return EMF_ERROR_NONE;
+       }
+
+       EM_DEBUG_FUNC_END();
+       return EMF_ERROR_NONE;
+}
+
+EXPORT_API bool emipc_execute_api_of_proxy_main(emipc_email_api_info *api_info)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       
+       int ret;
+       unsigned char *in_stream = emipc_get_stream_of_api_info(api_info, ePARAMETER_IN);
+       int length = emipc_get_stream_length_of_api_info(api_info, ePARAMETER_IN);
+       bool result = false;
+       int sending_bytes;
+
+       if (!api_info) {
+               EM_DEBUG_EXCEPTION("Invalid Parameter");
+               return false;
+       }
+
+       ENTER_CRITICAL_SECTION(ipc_proxy_mutex);
+       sending_bytes = emipc_send_proxy_socket(in_stream, length);
+       LEAVE_CRITICAL_SECTION(ipc_proxy_mutex);        
+
+       EM_DEBUG_LOG("Proxy=>stub sending %d byte.", sending_bytes);
+
+       if (sending_bytes > 0) {
+#ifdef IPCLIB_STREAM_TRACE_ON
+               int index = 0;
+               for (index=0;index<length;index++) 
+                       EM_DEBUG_LOG("in_stream[index] : [%x]", in_stream[index]);
+#endif
+               char *ipc_buf = NULL;
+                       
+               ENTER_CRITICAL_SECTION(ipc_proxy_mutex);
+               ret = emipc_recv_proxy_socket(&ipc_buf);
+               LEAVE_CRITICAL_SECTION(ipc_proxy_mutex);
+
+               EM_DEBUG_LOG("Recv length : %d", ret);
+
+               if (ret > 0)
+                       result = emipc_parse_stream_of_api_info(api_info, ePARAMETER_OUT, ipc_buf);
+               else
+                       result = false; 
+
+               EM_SAFE_FREE(ipc_buf);
+       }
+       
+       EM_DEBUG_FUNC_END();
+       return result;          
+}
+#if 0
+EXPORT_API bool emipc_dispatch_proxy_main()
+{
+       EM_DEBUG_FUNC_BEGIN();
+       
+       unsigned char stream[IPC_MSGQ_SIZE];
+       emipc_email_api_info *api_info = NULL;
+       int api_id = 0;
+       int stream_length = 0;
+
+       while(!recv_stop_flag) {
+               memset(stream, 0x00, sizeof(stream));
+
+               if (emcm_recv_msg(stream, sizeof(stream)) > 0) {
+                       api_info = (emipc_email_api_info *)malloc(sizeof(emipc_email_api_info));
+                       if (api_info == NULL) {
+                               EM_DEBUG_EXCEPTION("Malloc failed.");
+                               return false;
+                       }
+                       memset(api_info, 0x00, sizeof(emipc_email_api_info));
+
+                       api_id = *((int *)stream);
+
+                       emipc_set_api_id_of_api_info(api_info, api_id);
+                       emipc_parse_stream_of_api_info(api_info, ePARAMETER_OUT, stream);
+                       stream_length = emipc_get_stream_length_of_api_info(api_info, ePARAMETER_OUT);
+                       EM_DEBUG_LOG("Proxy Message Queue Recv [api_id=%x], [Recv_len=%d]", api_id, stream_length);
+                       
+#ifdef IPCLIB_STREAM_TRACE_ON
+                       int index = 0;
+                       for (index = 0; index<stream_length; index++)
+                               EM_DEBUG_LOG("[%x]", stream[index]);
+#endif
+               }
+               usleep(1000);                           
+       }
+       EM_DEBUG_FUNC_END();
+       return false;
+}
+#endif
diff --git a/email-ipc/email-proxy/email-proxy-socket.c b/email-ipc/email-proxy/email-proxy-socket.c
new file mode 100755 (executable)
index 0000000..8c36367
--- /dev/null
@@ -0,0 +1,122 @@
+/*
+*  email-service
+*
+* Copyright (c) 2000 - 2011 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.
+*
+*/
+
+
+
+#include <unistd.h>
+#include <sys/select.h>
+
+#include "email-ipc-build.h"
+#include "email-proxy-socket.h"
+#include "email-ipc-socket.h"
+
+#include "email-debug-log.h"
+#include <errno.h>
+
+static int proxy_socket_fd = 0;
+
+EXPORT_API bool emipc_start_proxy_socket()
+{
+       EM_DEBUG_FUNC_BEGIN();
+       int ret = true;
+
+       ret = emipc_init_email_socket(&proxy_socket_fd);
+       if (!ret) {
+               return false;
+       }
+
+       ret = emipc_connect_email_socket(proxy_socket_fd);
+
+       return ret;     
+}
+
+EXPORT_API bool emipc_end_proxy_socket()
+{
+       EM_DEBUG_FUNC_BEGIN();
+       EM_DEBUG_LOG("[IPCLib] emipc_end_proxy_socket_fd");
+       
+       if (proxy_socket_fd) {
+               emipc_close_email_socket(proxy_socket_fd);
+               proxy_socket_fd = 0;
+       }
+       
+       return true;
+}
+
+EXPORT_API int emipc_send_proxy_socket(unsigned char *data, int len)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       if (!proxy_socket_fd) {
+               EM_DEBUG_EXCEPTION("[IPCLib] emipc_send_proxy_socket_fd not connect");
+               return false;
+       }
+       return emipc_send_email_socket(proxy_socket_fd, data, len);
+}
+
+EXPORT_API int emipc_get_proxy_socket_id()
+{
+       EM_DEBUG_FUNC_BEGIN();
+       return proxy_socket_fd;
+}
+
+static bool wait_for_reply (int fd)
+{
+       fd_set fds;
+
+       FD_ZERO(&fds);
+       FD_SET(fd, &fds);
+
+       if (select(fd + 1, &fds, NULL, NULL, NULL) == -1) {
+               EM_DEBUG_EXCEPTION("[IPCLib] select: %s", strerror(errno) );
+               return false;
+       }
+
+       if (FD_ISSET(fd, &fds)) return true;
+       else return false;
+}
+
+
+EXPORT_API int emipc_recv_proxy_socket(char **data)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       
+       int recv_len = 0;
+       
+       if (!proxy_socket_fd) {
+               EM_DEBUG_EXCEPTION("[IPCLib] proxy_socket_fd[%p] is not available or disconnected", proxy_socket_fd);
+               return 0;
+       }
+
+       if( !wait_for_reply(proxy_socket_fd) )  return 0;
+
+       recv_len = emipc_recv_email_socket(proxy_socket_fd, data);
+
+       if (recv_len == 0) {
+               EM_DEBUG_EXCEPTION("[IPCLib] Proxy recv delete %x", proxy_socket_fd);
+               emipc_close_email_socket(proxy_socket_fd);
+               proxy_socket_fd = 0;
+       } else if (recv_len == -1) {
+               EM_DEBUG_EXCEPTION("[IPCLib] Proxy recv error");
+       }
+       
+       return recv_len;
+}
+
diff --git a/email-ipc/email-proxy/include/email-proxy-callback-info.h b/email-ipc/email-proxy/include/email-proxy-callback-info.h
new file mode 100755 (executable)
index 0000000..1b7b0c2
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+*  email-service
+*
+* Copyright (c) 2000 - 2011 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.
+*
+*/
+
+
+#ifndef _IPC_CALLBACK_INFO_H_
+#define _IPC_CALLBACK_INFO_H_
+
+#include "email-types.h"
+
+typedef struct {
+       int api_id;
+       void *fn_callback;
+} emipc_email_cb_info;
+
+
+#endif /* _IPC_CALLBACK_INFO_H_ */
+
+
similarity index 67%
rename from ipc/common/include/cm-list.h
rename to email-ipc/email-proxy/include/email-proxy-main.h
index ba84e8a..c84dadc 100755 (executable)
 */
 
 
-#ifndef _IPC_LIST_H_
-#define _IPC_LIST_H_
 
-class ipcEmailQueueItem;
+#ifndef        _IPC_PROXY_MAIN_H_
+#define        _IPC_PROXY_MAIN_H_
 
-class cmList
-{
-public:
-       cmList();
-       virtual ~cmList();
+#include "email-ipc-api-info.h"
+#include "email-types.h"
 
-private:
-       ipcEmailQueueItem* m_pHead;
-       ipcEmailQueueItem* m_pTail;
-       int m_nCount;
+EXPORT_API int emipc_initialize_proxy_main();
 
-public:
-       bool    AddTail(void* a_pData);
+EXPORT_API int emipc_finalize_proxy_main();
 
-       bool    RemoveItem(void* a_pData);
-       void*   GetAt(int a_nIndex);
-       int     GetCount();
-};
+EXPORT_API bool emipc_execute_api_of_proxy_main(emipc_email_api_info *api_info);
 
-#endif /* _IPC_LIST_H_ */
+EXPORT_API bool emipc_dispatch_proxy_main();
 
+#endif/* _IPC_PROXY_MAIN_H_ */
 
similarity index 71%
rename from ipc/proxy/include/ipc-proxy-socket.h
rename to email-ipc/email-proxy/include/email-proxy-socket.h
index bcca207..3b62f22 100755 (executable)
 
 #ifndef        _IPC_PROXY_SOCKET_H_
 #define        _IPC_PROXY_SOCKET_H_
-#include "ipc-socket.h"
-#include "emf-dbglog.h"
-
-class ipcEmailProxySocket
-{
-       public:
-               ipcEmailProxySocket();
-               virtual ~ipcEmailProxySocket();
-
-       private:
-               fd_set fds_read;
-               ipcEmailSocket *m_pSocket;
-       public:
-               int Start();
-               bool End();
-               int Send(char* pData , int a_nLen );
-               int Recv(char** pData);
-               int GetSocketID();
-};
+
+#include "email-types.h"
+
+EXPORT_API bool emipc_start_proxy_socket();
+
+EXPORT_API bool emipc_end_proxy_socket();
+
+EXPORT_API int emipc_send_proxy_socket(unsigned char *data, int len);
+
+EXPORT_API int emipc_get_proxy_socket_id();
+
+EXPORT_API int emipc_recv_proxy_socket(char **data);
 
 #endif /* _IPC_PROXY_SOCKET_H_ */
 
diff --git a/email-ipc/email-socket/email-ipc-socket.c b/email-ipc/email-socket/email-ipc-socket.c
new file mode 100755 (executable)
index 0000000..1c9c5aa
--- /dev/null
@@ -0,0 +1,258 @@
+/*
+*  email-service
+*
+* Copyright (c) 2000 - 2011 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.
+*
+*/
+
+
+#include "email-ipc-socket.h"
+#include "email-ipc-build.h"
+
+#include "email-debug-log.h"
+#include "email-types.h"
+
+#include <glib.h>
+
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <malloc.h>
+
+#include <errno.h>
+#include <unistd.h>
+
+
+EXPORT_API bool emipc_init_email_socket(int *fd)
+{
+       bool ret = true;
+
+       *fd = socket(AF_UNIX, SOCK_STREAM, 0);
+
+       if (*fd < 0) {
+               EM_DEBUG_EXCEPTION("socket creation fails!!!: %s", strerror(errno));
+               ret = false;
+       }
+
+       EM_DEBUG_LOG("Socket fd = %d", *fd);
+
+       return ret;     
+}
+
+/*  Close */
+EXPORT_API bool emipc_close_email_socket(int fd)
+{
+       EM_DEBUG_FUNC_BEGIN("fd[%d] to be removed", fd);
+       int ret = true;
+
+       EM_DEBUG_LOG("fd %d removal done", fd);
+       close(fd);
+
+       EM_DEBUG_FUNC_END();
+       return ret;
+}
+
+static int emipc_writen(int fd, const char *buf, int len)
+{
+       int length = len;
+       int passed_len = 0;
+
+       while (length > 0) {
+               passed_len = send(fd, (const void *)buf, length, MSG_NOSIGNAL);
+               if (passed_len == -1) {
+                       EM_DEBUG_LOG("write : %s", EM_STRERROR(errno));
+                       if (errno == EINTR) continue;
+                       return passed_len;
+               } else if (passed_len == 0)
+                       break;
+               length -= passed_len;
+               buf += passed_len;
+       }
+       return (len - length);
+}
+
+EXPORT_API int emipc_send_email_socket(int fd, unsigned char *buf, int len)
+{
+       EM_DEBUG_FUNC_BEGIN("fd [%d], buffer [%p], buf_len [%d]", fd, buf, len);
+
+       if (!buf) {
+               EM_DEBUG_EXCEPTION("No data to send");
+               return 0;
+       }
+
+       EM_DEBUG_LOG("Sending %dB data to [fd = %d]", len, fd);
+       
+       int write_len = emipc_writen(fd, (char*) buf, len);
+       if ( write_len != len) {
+               EM_DEBUG_LOG("WARNING: buf_size [%d] != write_len[%d]", len, write_len);
+               return EMF_ERROR_IPC_SOCKET_FAILURE;
+       }
+       EM_DEBUG_FUNC_END();
+       return write_len;
+}
+
+static int emipc_readn(int fd, char *buf, int len)
+{
+       int length = len;
+       int read_len = 0;
+
+       while (length > 0) {
+               read_len = read(fd, (void *)buf, length);
+               if (read_len < 0) {
+                       EM_DEBUG_EXCEPTION("Read : %s", EM_STRERROR(errno));
+                       if (errno == EINTR) continue;
+                       return read_len;
+               } else if (read_len == 0)
+                       break;
+
+               length -= read_len;
+               buf += read_len;
+       }
+       return (len-length);
+}
+
+
+EXPORT_API int emipc_recv_email_socket(int fd, char **buf)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       
+       if (!buf) {
+               EM_DEBUG_LOG("Buffer must not null");
+               return EMF_ERROR_INVALID_PARAM;
+       }
+
+       int read_len = 0;
+       if (ioctl(fd, FIONREAD, &read_len)) {
+               EM_DEBUG_EXCEPTION("ioctl: %s", strerror(errno));
+               return EMF_ERROR_IPC_SOCKET_FAILURE;
+       }
+
+       *buf = (char *) malloc(read_len);
+       if (*buf == NULL) {
+               EM_DEBUG_EXCEPTION("Malloc failed");
+               return EMF_ERROR_OUT_OF_MEMORY;
+       }
+       memset(*buf, 0x00, read_len);
+       
+       EM_DEBUG_LOG("[IPC Socket] Receiving Body begins for [%d] bytes", read_len);
+       int len = emipc_readn(fd, *buf, read_len);
+       if (read_len != len) {
+               EM_SAFE_FREE(*buf);
+               EM_DEBUG_LOG("WARNING: buf_size [%d] != read_len[%d]", read_len, len);
+               return EMF_ERROR_IPC_SOCKET_FAILURE;
+       }
+
+       EM_DEBUG_LOG("[IPC Socket] Receiving [%d] bytes Completed", len);
+
+       return len;
+}
+
+EXPORT_API int emipc_accept_email_socket(int fd)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       
+       if (fd == -1) {
+               EM_DEBUG_LOG("Server_socket not init");
+               return EMF_ERROR_INVALID_PARAM;
+       }
+       
+       struct sockaddr_un remote;
+       int remote_len = sizeof(remote);
+       int client_fd = accept(fd, (struct sockaddr *)&remote, (socklen_t*) &remote_len);
+       if (client_fd == -1) {
+               EM_DEBUG_LOG("accept: %s", EM_STRERROR(errno));
+               return EMF_ERROR_IPC_SOCKET_FAILURE;
+       }
+
+       EM_DEBUG_LOG("%d is added", client_fd);
+       
+       EM_DEBUG_FUNC_END();
+       return client_fd;
+}
+
+EXPORT_API int emipc_open_email_socket(int fd, const char *path)
+{
+       EM_DEBUG_FUNC_BEGIN("path [%s]", path);
+
+       if (!path || strlen(path) > 108) {
+               EM_DEBUG_LOG("Path is null");
+               return EMF_ERROR_IPC_SOCKET_FAILURE;
+       }
+       
+       if (fd <= 0) {
+               EM_DEBUG_LOG("Socket not created %d", fd);
+               return EMF_ERROR_IPC_SOCKET_FAILURE;
+       }
+
+       struct sockaddr_un local;
+       local.sun_family = AF_UNIX;
+       strcpy(local.sun_path, path);
+       unlink(local.sun_path);
+
+       int len = strlen(local.sun_path) + sizeof(local.sun_family);
+
+       if (bind(fd, (struct sockaddr *)&local, len) == -1) {
+               EM_DEBUG_LOG("bind: %s", EM_STRERROR(errno));
+               return EMF_ERROR_IPC_SOCKET_FAILURE;
+       }
+
+       /**
+        * determine permission of socket file
+        *
+        *  - S_IRWXU : for user, allow read and write and execute
+        *  - S_IRWXG : for group, allow read and write and execute
+        *  - S_IRWXO : for other, allow read and write and execute
+        *
+        *  - S_IRUSR, S_IWUSR, S_IXUSR : for user, allow only read, write, execute respectively
+        *  - S_IRGRP, S_IWGRP, S_IXGRP : for group, allow only read, write, execute respectively
+        *  - S_IROTH, S_IWOTH, S_IXOTH : for other, allow only read, write, execute respectively
+        */
+       mode_t sock_mode = (S_IRWXU | S_IRWXG | S_IRWXO); /*  has 777 permission */
+
+       if (chmod(path, sock_mode) == -1) {
+               EM_DEBUG_LOG("chmod: %s", EM_STRERROR(errno));
+               return EMF_ERROR_IPC_SOCKET_FAILURE;
+       }
+
+       if (listen(fd, 10) == -1) {
+               EM_DEBUG_LOG("listen: %s", EM_STRERROR(errno));
+               return EMF_ERROR_IPC_SOCKET_FAILURE;
+       }
+
+       EM_DEBUG_FUNC_END();
+       return fd;
+}
+
+EXPORT_API bool emipc_connect_email_socket(int fd)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       struct sockaddr_un server;
+       server.sun_family = AF_UNIX;
+       strcpy(server.sun_path, EM_SOCKET_PATH);
+
+       int len = strlen(server.sun_path) + sizeof(server.sun_family);
+       
+       if (connect(fd, (struct sockaddr *)&server, len) == -1) {
+               EM_DEBUG_LOG("Cannot connect server %s", EM_STRERROR(errno));
+               return false;
+       }
+
+       return true;
+}
+
similarity index 55%
rename from ipc/socket/include/ipc-socket.h
rename to email-ipc/email-socket/include/email-ipc-socket.h
index 5d11503..9534af7 100755 (executable)
 #ifndef _IPC_SOCKET_H_ 
 #define _IPC_SOCKET_H_ 
 
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <map>
+#include "email-types.h"
 
 #define SOCKET_IP              "127.0.0.1"
 #define SOCKET_PORT            9000
 
 #define EM_SOCKET_PATH "/tmp/.emailfw_socket"
 
-class ipcEmailSocket
-{
-       
-       protected:      
-               int m_sockfd;
-               bool m_bConnect;
-
-               fd_set                          fds; 
-               int                             maxfd;
-               std::map<int, int>      mapFds;
-               
-       public:
-               ipcEmailSocket();
-               ~ipcEmailSocket();
-
-       private:
-               int readn( int fd, char *buf, int len );
-               int writen (int fd, const char *buf, int len);
-
-       public:
-               bool IsConnected();
-
-               void Close();
-               void Close(int fd);
-               int Recv(int fd, char** buffer);
-               int Send(int fd, char* buffer, int len);
-               int GetSocketID();
-
-               int accept();
-               int open(const char* path);
-               int Connect();
-               void addfd(int fd);
-
-               int     maxFd() { return (maxfd+1); }
-               fd_set  fdSet() { return fds; }
-
-};
+EXPORT_API bool emipc_init_email_socket(int *fd);
+
+EXPORT_API bool emipc_close_email_socket(int fd);
+
+EXPORT_API int emipc_send_email_socket(int fd, unsigned char *buf, int len);
+
+EXPORT_API int emipc_recv_email_socket(int fd, char **buf);
+
+EXPORT_API int emipc_accept_email_socket(int fd);
+
+EXPORT_API int emipc_open_email_socket(int fd, const char *path);
+
+EXPORT_API bool emipc_connect_email_socket(int fd);
 
 #endif /*  _IPC_SOCKET_H_               */
 
diff --git a/email-ipc/email-stub/email-stub-main.c b/email-ipc/email-stub/email-stub-main.c
new file mode 100755 (executable)
index 0000000..703ce54
--- /dev/null
@@ -0,0 +1,140 @@
+/*
+*  email-service
+*
+* Copyright (c) 2000 - 2011 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.
+*
+*/
+
+#include <glib.h>
+
+#include "email-stub-main.h"
+#include "email-ipc.h"
+#include "email-stub-response-info.h"
+#include "email-ipc-param-list.h"
+#include "email-ipc-build.h"
+#include "email-stub-socket.h"
+
+#include "email-api.h"
+#include "email-debug-log.h"
+
+static bool stub_socket = false;
+static GList *response_list = NULL;
+static PFN_EXECUTE_API this_fn_api_mapper = NULL;
+
+EXPORT_API bool emipc_initialize_stub_main(PFN_EXECUTE_API fn_api_mapper)
+{
+       EM_DEBUG_FUNC_BEGIN();
+
+       if (!fn_api_mapper) {
+               EM_DEBUG_EXCEPTION("Invalid Param");
+               return false;
+       }
+
+       this_fn_api_mapper = fn_api_mapper;
+
+       /* Initialize the socket */
+       stub_socket = emipc_start_stub_socket();
+       if (!stub_socket) {
+               EM_DEBUG_EXCEPTION("Socket did not create");
+               return false;
+       }
+
+       EM_DEBUG_FUNC_END();
+       return true;
+}
+
+EXPORT_API bool emipc_finalize_stub_main()
+{
+       EM_DEBUG_FUNC_BEGIN();
+
+       if (response_list)
+               response_list = NULL;
+
+       if (stub_socket) {
+               emipc_end_stub_socket();
+               stub_socket = false;
+       }
+       
+       if (this_fn_api_mapper)
+               this_fn_api_mapper = NULL;
+               
+       EM_DEBUG_FUNC_END();
+       return true;
+}
+
+EXPORT_API bool emipc_execute_api_proxy_to_stub(emipc_email_api_info *api_info)
+{
+       EM_DEBUG_FUNC_BEGIN();
+       if (!api_info) {
+               EM_DEBUG_EXCEPTION("Invalid Param");
+               return false;
+       }
+       
+       if (this_fn_api_mapper) {
+               this_fn_api_mapper(api_info);
+       }
+
+       EM_DEBUG_FUNC_END();
+       return true;
+}
+
+EXPORT_API bool emipc_execute_api_stub_to_proxy(emipc_email_api_info *api_info)
+{
+       EM_DEBUG_FUNC_BEGIN("api_info [%p]", api_info);
+       EM_IF_NULL_RETURN_VALUE(api_info, false);
+       EM_DEBUG_LOG("APIID [%s], response Socket ID [%d], APPID [%d]", EM_APIID_TO_STR(emipc_get_api_id_of_api_info(api_info)), emipc_get_response_id_of_api_info(api_info), emipc_get_app_id_of_api_info(api_info));
+       
+       unsigned char *stream = emipc_get_stream_of_api_info(api_info, ePARAMETER_OUT);
+       int stream_length = emipc_get_stream_length_of_api_info(api_info, ePARAMETER_OUT);
+       
+       EM_DEBUG_LOG("Data : %p, Data length : %dB", stream, stream_length);
+       EM_DEBUG_LOG("Stub => Proxy Sending %dB", stream_length);
+       emipc_send_stub_socket(emipc_get_response_id_of_api_info(api_info), stream, stream_length);
+       
+#ifdef IPCLIB_STREAM_TRACE_ON
+       int index = 0;
+       for (index = 0; index < stream_length; index++)
+               EM_DEBUG_LOG("Stream[index] : [%d]", stream[index]);
+#endif
+
+       EM_DEBUG_FUNC_END();
+       return true;
+}
+
+EXPORT_API bool emipc_set_response_info(long app_id, long api_id)
+{
+       EM_DEBUG_FUNC_BEGIN("Response ID [%d]", app_id);
+       
+       if (app_id <= 0)
+               return true;
+
+       emipc_email_response_info *response_info = NULL;
+       response_info = (emipc_email_response_info *)malloc(sizeof(response_info));
+       if (response_info == NULL) {
+               EM_DEBUG_EXCEPTION("Malloc failed");
+               return false;
+       }
+       memset(response_info, 0x00, sizeof(response_info));
+
+       if (response_info) {
+               emipc_set_value_in_response_info(response_info, app_id, api_id);
+               response_list = g_list_append(response_list, response_info);
+               return true;
+       }
+       EM_DEBUG_FUNC_END();
+       return false;
+}
diff --git a/email-ipc/email-stub/email-stub-queue.c b/email-ipc/email-stub/email-stub-queue.c
new file mode 100755 (executable)
index 0000000..ce6dcc9
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+*  email-service
+*
+* Copyright (c) 2000 - 2011 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.
+*
+*/
+
+
+#include <stdio.h>
+#include <malloc.h>
+
+#include "email-stub-queue.h"
+#include "email-ipc-build.h"
+
+#include "email-debug-log.h"
+
+static emipc_email_queue_item *head = NULL;
+static emipc_email_queue_item *tail = NULL;
+int count = 0;
+
+EXPORT_API void *emipc_pop_in_queue()
+{
+       void *data = NULL;
+
+       if (head) {
+               emipc_email_queue_item *popped = head;
+               data = popped->data;
+       
+               if (popped->next) {
+                       head = popped->next;
+               } else {
+                       head = tail = NULL;
+               }
+               
+               EM_SAFE_FREE(popped);
+               count = (count <= 0) ? 0 : count-1;
+               
+               return data;
+       }
+       return NULL;
+}      
+
+EXPORT_API bool emipc_push_in_queue(void *data)
+{
+       emipc_email_queue_item *item = NULL;
+       if (!data) {
+               EM_DEBUG_EXCEPTION("[IPCLib] emipc_push_in_queue - invalid input\n");
+               return false;
+       }
+
+       item = (emipc_email_queue_item *)malloc(sizeof(emipc_email_queue_item));
+       if (item == NULL) {
+               EM_DEBUG_EXCEPTION("Malloc failed.");
+               return false;
+       }
+       memset(item, 0x00, sizeof(emipc_email_queue_item));
+
+       item->data = data;
+       item->next = NULL;
+       if (tail) {
+               tail->next = item;
+               tail = item;
+       } else {
+               head = tail = item;
+       }
+
+       count++;
+       
+       return true;
+}
+
+EXPORT_API int emipc_get_count_of_item()
+{
+       return count;
+}
similarity index 59%
rename from ipc/proxy/ipc-callback-info.cpp
rename to email-ipc/email-stub/email-stub-response-info.c
index e89d22b..01d67e8 100755 (executable)
 *
 */
 
+#include "email-stub-response-info.h"
 
-
-#include "ipc-callback-info.h"
-
-ipcEmailCallbackInfo::ipcEmailCallbackInfo()
-{
-       m_nAPIID = 0;
-       m_pfnCallBack = 0;
-}
-
-ipcEmailCallbackInfo::~ipcEmailCallbackInfo()
-{
-}
-
-
-bool ipcEmailCallbackInfo::SetValue(int a_nAPIID, void* a_pfnCallBack)
+EXPORT_API bool emipc_set_value_in_response_info(emipc_email_response_info *response_info, long response_id, long api_id)
 {
-       m_nAPIID = a_nAPIID;
-       m_pfnCallBack = a_pfnCallBack;
-       return true;
+       response_info->response_id = response_id;
+       response_info->api_id = api_id;
+       return true; 
 }
 
-int  ipcEmailCallbackInfo::GetAPIID()
+EXPORT_API long emipc_get_response_id_in_response_info(emipc_email_response_info *response_info)
 {
-       return m_nAPIID;
+       return response_info->response_id;
 }
 
-void* ipcEmailCallbackInfo::GetCallBack()
+EXPORT_API long emipc_get_api_id_in_response_info(emipc_email_response_info *response_info)
 {
-       return m_pfnCallBack;
+       return response_info->api_id;
 }
diff --git a/email-ipc/email-stub/email-stub-socket.c b/email-ipc/email-stub/email-stub-socket.c
new file mode 100755 (executable)
index 0000000..d018634
--- /dev/null
@@ -0,0 +1,211 @@
+/*
+*  email-service
+*
+* Copyright (c) 2000 - 2011 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.
+*
+*/
+
+
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include <malloc.h>
+#include <sys/epoll.h>
+#include <pthread.h>
+
+#include "email-ipc-build.h"
+#include "email-ipc-api-info.h"
+#include "email-ipc-socket.h"
+#include "email-stub-task.h"
+#include "email-stub-task-manager.h"
+#include "email-stub-socket.h"
+
+#include "email-debug-log.h"
+
+#define MAX_EPOLL_EVENT 50
+
+static int stub_socket = 0;
+static pthread_t stub_socket_thread = 0;
+static bool stop_thread = false;
+
+static void *emipc_stub_socket_thread_proc();
+
+EXPORT_API bool emipc_start_stub_socket()
+{
+       bool ret = true;
+
+       ret = emipc_init_email_socket(&stub_socket);
+       if (!ret) {
+               EM_DEBUG_EXCEPTION("emipc_init_email_socket failed");
+               return ret;
+       }
+
+       ret = emipc_start_stub_socket_thread();
+       if (!ret) {
+               EM_DEBUG_EXCEPTION("emipc_start_stub_socket_thread failed");
+               return ret;
+       }
+
+       ret = emipc_start_task_thread();
+       if (!ret) {
+               EM_DEBUG_EXCEPTION("emipc_start_task_thread failed");
+               return ret;
+       }
+
+       return ret;
+}
+
+EXPORT_API bool emipc_start_stub_socket_thread()
+{
+       EM_DEBUG_LOG("[IPCLib] emipc_email_stub_socket_thread start");
+       if (stub_socket_thread)
+               return true;
+               
+       pthread_attr_t thread_attr;
+       pthread_attr_init(&thread_attr);
+       pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED);
+       if (pthread_create(&stub_socket_thread, &thread_attr, &emipc_stub_socket_thread_proc, NULL) != 0) {
+               EM_DEBUG_EXCEPTION("[IPCLib] emipc_start_stub_socket_thread() - fail to create a thread");
+               return false;
+       }
+       return true;
+}
+
+EXPORT_API bool emipc_stop_stub_socket_thread()
+{
+       if (stub_socket_thread)
+               stop_thread = true;
+
+       return true;
+}
+
+static void *emipc_stub_socket_thread_proc()
+{
+       emipc_wait_for_ipc_request();
+       stub_socket_thread = 0;
+       return NULL;
+}
+
+EXPORT_API void emipc_wait_for_ipc_request()
+{
+       struct epoll_event ev = {0};
+       struct epoll_event events[MAX_EPOLL_EVENT] = {{0}, };
+       int epfd = 0;
+       int event_num = 0;
+
+       if (!stub_socket) {
+               EM_DEBUG_EXCEPTION("Server Socket is not initialized");
+               return;
+       }
+
+       emipc_open_email_socket(stub_socket, EM_SOCKET_PATH);
+       
+       epfd = epoll_create(MAX_EPOLL_EVENT);
+       if (epfd < 0) {
+               EM_DEBUG_EXCEPTION("epoll_ctl: %s[%d]", strerror(errno), errno);
+               EM_DEBUG_CRITICAL_EXCEPTION("epoll_create: %s[%d]", strerror(errno), errno);
+               abort();
+       }
+
+       ev.events = EPOLLIN;
+       ev.data.fd = stub_socket;
+       
+       if (epoll_ctl(epfd, EPOLL_CTL_ADD, stub_socket, &ev) == -1) {
+               EM_DEBUG_EXCEPTION("epoll_ctl: %s[%d]", strerror(errno), errno);
+               EM_DEBUG_CRITICAL_EXCEPTION("epoll_ctl:%s[%d]", strerror(errno), errno);        
+       }
+       while (1) {
+               int i = 0;
+
+               event_num = epoll_wait(epfd, events, MAX_EPOLL_EVENT, -1);
+               
+               if (event_num == -1) {
+                       EM_DEBUG_EXCEPTION("epoll_wait: %s[%d]", strerror(errno), errno);
+                       EM_DEBUG_CRITICAL_EXCEPTION("epoll_wait: %s[%d]", strerror(errno), errno);
+                       if (errno == EINTR) continue; /* resume when interrupted system call*/
+                       else abort();
+               } else {
+                       for (i = 0; i < event_num; i++) {
+                               int event_fd = events[i].data.fd;
+
+                               if (event_fd == stub_socket) { /*  if it is socket connection request */
+                                       int cfd = emipc_accept_email_socket(stub_socket);
+                                       if (cfd < 0) {
+                                               EM_DEBUG_EXCEPTION("accept error: %s[%d]", strerror(errno), errno);
+                                               EM_DEBUG_CRITICAL_EXCEPTION("accept error: %s[%d]", strerror(errno), errno);
+                                               /*  abort(); */
+                                       }
+                                       ev.events = EPOLLIN;
+                                       ev.data.fd = cfd;
+                                       epoll_ctl(epfd, EPOLL_CTL_ADD, cfd, &ev);
+                               } else {
+                                       int recv_len;
+                                       char *sz_buf = NULL;
+                                       
+                                       recv_len = emipc_recv_email_socket(event_fd, &sz_buf);
+                                       
+                                       if(recv_len > 0) {
+                                               EM_DEBUG_LOG("====================================================================");
+                                               EM_DEBUG_LOG("[IPCLib]Stub Socket Recv [Socket ID = %d], [recv_len = %d]", event_fd, recv_len);
+                                               EM_DEBUG_LOG("====================================================================");
+                                               emipc_create_task((unsigned char *)sz_buf, event_fd);
+                                       }  else {
+                                               EM_DEBUG_LOG("[IPCLib] Socket [%d] removed - [%d] ", event_fd, recv_len);
+                                               epoll_ctl(epfd, EPOLL_CTL_DEL, event_fd, events);
+                                               close(event_fd);
+                                       } 
+                                       EM_SAFE_FREE(sz_buf);
+                               }
+                       }
+               }
+       }       
+}
+
+EXPORT_API bool emipc_end_stub_socket()
+{
+       EM_DEBUG_FUNC_BEGIN();
+       
+       if (stub_socket) {
+               emipc_close_email_socket(stub_socket);
+       }
+
+       if (stub_socket_thread) {
+               emipc_stop_stub_socket_thread(stub_socket_thread);
+               pthread_cancel(stub_socket_thread);
+               stub_socket_thread = 0;
+       }
+
+       if (!emipc_stop_task_thread()) {
+               EM_DEBUG_EXCEPTION("emipc_stop_task_thread failed");
+               return false;   
+       }
+               
+       return true;
+}
+
+EXPORT_API int emipc_send_stub_socket(int sock_fd, void *data, int len)
+{
+       EM_DEBUG_FUNC_BEGIN("Stub socket sending %d bytes", len);
+
+       int sending_bytes = emipc_send_email_socket(sock_fd, data, len);
+       
+       EM_DEBUG_FUNC_END("sending_bytes = %d", sending_bytes);
+       return sending_bytes;
+}
+/* stub socket accpet, recv, send */
+
diff --git a/email-ipc/email-stub/email-stub-task-manager.c b/email-ipc/email-stub/email-stub-task-manager.c
new file mode 100755 (executable)
index 0000000..04a2f43
--- /dev/null
@@ -0,0 +1,133 @@
+/*
+*  email-service
+*
+* Copyright (c) 2000 - 2011 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.
+*
+*/
+
+
+
+#include <string.h>
+#include <pthread.h>
+#include <errno.h>
+#include <glib.h>
+
+#include "email-stub-task-manager.h"
+#include "email-stub-task.h"
+#include "email-ipc-build.h"
+
+#include "email-debug-log.h"
+#include "email-api.h"
+#include "email-internal-types.h"
+
+static pthread_t task_thread = 0;
+static bool stop_flag = false;
+static GQueue *task_queue = NULL;
+
+pthread_mutex_t ipc_task_mutex = PTHREAD_MUTEX_INITIALIZER;
+pthread_cond_t ipc_task_cond = PTHREAD_COND_INITIALIZER;
+
+EXPORT_API bool emipc_start_task_thread()
+{
+       EM_DEBUG_FUNC_BEGIN();
+       if (task_thread)
+               return true;
+
+       task_queue = g_queue_new();
+
+       if (pthread_create(&task_thread, NULL, &emipc_do_task_thread, NULL) != 0) {
+               EM_DEBUG_LOG("Worker thread creation failed: %s", strerror(errno));
+               return false;   
+       }
+
+       return true;
+}
+
+EXPORT_API void emipc_terminate_task_thread()
+{
+       emipc_stop_task_thread();
+       pthread_cancel(task_thread);
+
+       emipc_email_task *task = (emipc_email_task *)g_queue_pop_head(task_queue);
+       while (task) {
+               EM_SAFE_FREE(task);
+               task = (emipc_email_task *)g_queue_pop_head(task_queue);
+       }
+       g_queue_free(task_queue);
+}
+
+EXPORT_API bool emipc_stop_task_thread()
+{
+       stop_flag = true;
+       return true;
+}
+
+
+EXPORT_API void *emipc_do_task_thread()
+{
+       EM_DEBUG_FUNC_BEGIN();
+       
+       emipc_email_task *task = NULL;
+
+       while (!stop_flag) {
+               ENTER_CRITICAL_SECTION(ipc_task_mutex);
+               while (g_queue_is_empty(task_queue)) {
+                       EM_DEBUG_LOG("Blocked until new task arrivers %p.", &ipc_task_cond);
+                       SLEEP_CONDITION_VARIABLE(ipc_task_cond, ipc_task_mutex);
+               }
+               
+               task = (emipc_email_task *)g_queue_pop_head(task_queue);
+               LEAVE_CRITICAL_SECTION(ipc_task_mutex);
+
+               if (task) {
+                       emipc_run_task(task);
+                       EM_SAFE_FREE(task);
+               }
+       }
+       
+       return NULL;                    
+}
+
+/* code for ipc handler */
+EXPORT_API bool emipc_create_task(unsigned char *task_stream, int response_channel)
+{
+       emipc_email_task *task = NULL;
+       bool ret = true;
+
+       task = (emipc_email_task *)malloc(sizeof(emipc_email_task));
+       if (task == NULL) {
+               EM_DEBUG_EXCEPTION("Malloc failed.");
+               ret = false;
+       } else {
+               emipc_parse_stream_email_task(task, task_stream, response_channel);
+               
+               EM_DEBUG_LOG("[IPCLib] ======================================================");
+               EM_DEBUG_LOG("[IPCLib] Register new task : %p", task);
+               EM_DEBUG_LOG("[IPCLib] Task API ID : %s", EM_APIID_TO_STR(emipc_get_api_info(task)->api_id));
+               EM_DEBUG_LOG("[IPCLib] Task Response ID : %d", EM_APIID_TO_STR(emipc_get_api_info(task)->response_id));
+               EM_DEBUG_LOG("[IPCLib] Task APP ID : %d", emipc_get_api_info(task)->app_id);
+               EM_DEBUG_LOG("[IPCLib] ======================================================");
+
+               ENTER_CRITICAL_SECTION(ipc_task_mutex);
+               g_queue_push_head(task_queue, (void *)task);
+               
+               WAKE_CONDITION_VARIABLE(ipc_task_cond);
+               LEAVE_CRITICAL_SECTION(ipc_task_mutex);
+       }
+       return ret;
+}
+
diff --git a/email-ipc/email-stub/email-stub-task.c b/email-ipc/email-stub/email-stub-task.c
new file mode 100755 (executable)
index 0000000..f7dbbd7
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+*  email-service
+*
+* Copyright (c) 2000 - 2011 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.
+*
+*/
+
+
+
+#include <sys/socket.h>
+#include <malloc.h>
+
+#include "email-ipc.h"
+#include "email-ipc-param-list.h"
+#include "email-ipc-build.h"
+#include "email-stub-task.h"
+#include "email-stub-main.h"
+
+#include "email-api.h"
+#include "email-debug-log.h"
+
+EXPORT_API bool emipc_parse_stream_email_task(emipc_email_task *task, void *stream, int response_id)
+{
+       EM_DEBUG_FUNC_BEGIN();
+
+       task->api_info = (emipc_email_api_info *)malloc(sizeof(emipc_email_api_info));
+       if (task->api_info == NULL) {
+               EM_DEBUG_EXCEPTION("Malloc failed.");
+               return false;
+       }
+       memset(task->api_info, 0x00, sizeof(emipc_email_api_info));
+       
+       if (task->api_info) {
+               emipc_parse_stream_of_api_info(task->api_info, ePARAMETER_IN, stream);
+               emipc_set_response_id_of_api_info(task->api_info, response_id);
+               return true;
+       }
+       return false;
+}
+
+EXPORT_API emipc_email_api_info *emipc_get_api_info(emipc_email_task *task)
+{
+       return task->api_info;
+}
+
+EXPORT_API int emipc_get_response_channel(emipc_email_task *task)
+{
+       return task->response_channel;
+}
+
+EXPORT_API bool emipc_run_task(emipc_email_task *task)
+{
+       EM_DEBUG_LOG("[IPCLib] starting a new task...");
+
+       int app_id = emipc_get_app_id_of_api_info(task->api_info);
+       int api_id = emipc_get_api_id_of_api_info(task->api_info);
+
+       if (app_id > 0) {
+               EM_DEBUG_LOG("[IPCLib] This task (%s) is for async. Response ID [%d]", EM_APIID_TO_STR(api_id), api_id);
+               if (!emipc_set_response_info(app_id, api_id)) {
+                       EM_DEBUG_EXCEPTION("emipc_set_response_info failed");
+                       return false;
+               }
+       }
+       return emipc_execute_api_proxy_to_stub(task->api_info);
+}
+
diff --git a/email-ipc/email-stub/include/email-stub-main.h b/email-ipc/email-stub/include/email-stub-main.h
new file mode 100755 (executable)
index 0000000..c11f148
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+*  email-service
+*
+* Copyright (c) 2000 - 2011 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.
+*
+*/
+
+
+
+#ifndef        _IPC_STUB_MAIN_H_
+#define        _IPC_STUB_MAIN_H_
+
+#include "email-ipc.h"
+#include "email-ipc-api-info.h"
+
+EXPORT_API bool emipc_initialize_stub_main(PFN_EXECUTE_API fn_api_mapper);
+
+EXPORT_API bool emipc_finalize_stub_main();
+
+EXPORT_API bool emipc_execute_api_proxy_to_stub(emipc_email_api_info *api_info);
+
+EXPORT_API bool emipc_execute_api_stub_to_proxy(emipc_email_api_info *api_info);
+
+EXPORT_API bool emipc_set_response_info(long app_id, long api_id);
+
+#endif /* _IPC_STUB_MAIN_H_ */
+
+
similarity index 68%
rename from ipc/stub/include/ipc-response-info.h
rename to email-ipc/email-stub/include/email-stub-queue.h
index 2b876a4..bda8777 100755 (executable)
 
 
 
-#ifndef _IPC_RESPONSE_INFO_H_
-#define _IPC_RESPONSE_INFO_H_
+#ifndef _IPC_QUEUE_H_
+#define _IPC_QUEUE_H_
 
-class ipcEmailResponseInfo
-{
-public:
-       ipcEmailResponseInfo();
-       virtual ~ipcEmailResponseInfo();
+#include "email-types.h"
 
-private:
-       long    m_nResponseID;
-       long    m_nAPIID;
+typedef struct emipc_email_queue_item {
+       void *data;
+       struct emipc_email_queue_item *next;
+} emipc_email_queue_item;
 
-public:
-       bool SetVaue(long a_nResponseID, long a_nAPIID);
-       long GetResponseID();
-       long GetAPIID();
-       
-};
 
-#endif /* _IPC_RESPONSE_INFO_H_ */
+EXPORT_API void *emipc_pop_in_queue();
 
+EXPORT_API bool emipc_push_in_queue(void *data);
 
+EXPORT_API int emipc_get_count_of_item();
+#endif /* _IPC_QUEUE_H_ */
diff --git a/email-ipc/email-stub/include/email-stub-response-info.h b/email-ipc/email-stub/include/email-stub-response-info.h
new file mode 100755 (executable)
index 0000000..c3194b7
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+*  email-service
+*
+* Copyright (c) 2000 - 2011 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.
+*
+*/
+
+
+
+#ifndef _IPC_RESPONSE_INFO_H_
+#define _IPC_RESPONSE_INFO_H_
+
+#include "email-types.h"
+
+typedef struct {
+       long response_id;
+       long api_id;
+} emipc_email_response_info;
+
+EXPORT_API bool emipc_set_value_in_response_info(emipc_email_response_info *response_info, long response_id, long api_id);
+
+EXPORT_API long emipc_get_response_id_in_response_info(emipc_email_response_info *response_info);
+
+EXPORT_API long emipc_get_api_id_in_response_info(emipc_email_response_info *response_info);
+
+#endif /* _IPC_RESPONSE_INFO_H_ */
+
+
similarity index 60%
rename from ipc/stub/include/ipc-stub-socket.h
rename to email-ipc/email-stub/include/email-stub-socket.h
index 7eade99..1542715 100755 (executable)
 #ifndef        _IPC_STUB_SOCKET_H_
 #define        _IPC_STUB_SOCKET_H_
 
-#include <pthread.h>
-#include "ipc-library.h"
-#include "ipc-socket.h"
-#include "ipc-task-manager.h"
-
-
-class ipcEmailStubSocket
-{
-public:
-       ipcEmailStubSocket();
-       virtual ~ipcEmailStubSocket();
-       bool Start();
-       bool End();
-       int Send(int fd, void* pData , int a_nLen);
-       void WaitForIPCRequest();
-
-private:
-       bool StartStubSocketThread();
-       bool StopStubSocketThread();
-       static void* StubSocketThreadProc(void *a_pOwner);
-
-
-private:
-       ipcEmailSocket *m_pSocket;
-       pthread_t       m_hStubSocketThread;
-       bool            m_bStopThread;
-               
-       ipcEmailTaskManager *m_pTaskManager;    
-
-};
+#include "email-types.h"
+/*
+typedef struct {
+       emipc_email_socket sock_fd;
+       pthread_t       stub_socket_thread;
+       bool            stop_thread;
+       emipc_email_task_manager        *task_manager;
+} emipc_email_stub_socket;
+*/
+
+EXPORT_API bool emipc_start_stub_socket();
+
+EXPORT_API bool emipc_start_stub_socket_thread();
+
+EXPORT_API bool emipc_stop_stub_socket();
+
+EXPORT_API void emipc_wait_for_ipc_request();
+
+EXPORT_API bool emipc_end_stub_socket();
+
+EXPORT_API int emipc_send_stub_socket(int sock_fd, void *data, int len);
 
 #endif /* _IPC_STUB_SOCKET_H_ */
 
similarity index 65%
rename from ipc/proxy/include/ipc-callback-info.h
rename to email-ipc/email-stub/include/email-stub-task-manager.h
index 0af5b7d..cdc83ad 100755 (executable)
 */
 
 
-#ifndef _IPC_CALLBACK_INFO_H_
-#define _IPC_CALLBACK_INFO_H_
+#ifndef _IPC_TASK_MANAGER_H_
+#define _IPC_TASK_MANAGER_H_
 
+#include "email-types.h"
 
-class ipcEmailAPIInfo;
+#define IPC_TASK_MAX   64
 
+EXPORT_API bool emipc_start_task_thread();
 
-class ipcEmailCallbackInfo
-{
-public:
-       ipcEmailCallbackInfo();
-       virtual ~ipcEmailCallbackInfo();
+EXPORT_API void emipc_terminate_task_thread();
 
-private:
-       int             m_nAPIID;
-       void            *m_pfnCallBack;
+EXPORT_API bool emipc_stop_task_thread();
 
-public:
-       bool SetValue(int m_nAPIID, void* a_pfnCallBack);
-       int  GetAPIID();
-       void* GetCallBack();
-};
+EXPORT_API void *emipc_do_task_thread();
 
-#endif /* _IPC_CALLBACK_INFO_H_ */
+EXPORT_API bool emipc_create_task(unsigned char *task_stream, int response_channel);
+
+#endif /* _IPC_TASK_MANAGER_H_ */
 
 
similarity index 64%
rename from ipc/stub/include/ipc-task.h
rename to email-ipc/email-stub/include/email-stub-task.h
index e12357d..54fc8f6 100755 (executable)
 #ifndef _IPC_TASK_H_
 #define _IPC_TASK_H_
 
-#include "ipc-api-info.h"
+#include "email-ipc-api-info.h"
+#include "email-types.h"
 
-class ipcEmailTask
-{
-public:
-       ipcEmailTask();
-       virtual ~ipcEmailTask();
+typedef struct {
+       int response_channel;
+       emipc_email_api_info *api_info;
+} emipc_email_task;
 
-private:
-       ipcEmailAPIInfo *m_pAPIInfo;
-       int m_nResponseChannel;
+EXPORT_API bool emipc_parse_stream_email_task(emipc_email_task *task, void *stream, int response_id);
 
-public:
-       bool Run();
+EXPORT_API emipc_email_api_info *emipc_get_api_info(emipc_email_task *task);
 
-       bool ParseStream(void* a_pStream, int nResponseFD);
+EXPORT_API int emipc_get_response_channel(emipc_email_task *task);
 
-       ipcEmailAPIInfo* GetAPIInfo();
-       int GetResponseChannel();
-};
+EXPORT_API bool emipc_run_task(emipc_email_task *task);
 
 #endif /* _IPC_TASK_H */
 
similarity index 57%
rename from ipc/include/ipc-library.h
rename to email-ipc/include/email-ipc.h
index 3df7c59..ff7206c 100755 (executable)
 #ifndef __IPC_LIBRARY_H
 #define __IPC_LIBRARY_H
 
+#include "email-types.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-#define EM_PROXY_IF_NULL_RETURN_VALUE(expr1, expr2, val) {                                     \
-       if (!expr1&& expr2) {                                                                                                                                                           \
-               EM_DEBUG_LOG ("EM_PROXY_IF_NULL_RETURN_VALUE : PARAM IS NULL \n");                                                              \
-               ipcEmailAPI_Destroy(expr2);                                                                                     \
-               return val;                                                                                                                                     \
+#define EM_PROXY_IF_NULL_RETURN_VALUE(expr1, expr2, val) {     \
+       if (!expr1&& expr2) {   \
+               EM_DEBUG_LOG ("EM_PROXY_IF_NULL_RETURN_VALUE : PARAM IS NULL \n");      \
+               emipc_destroy_email_api(expr2); \
+               return val;     \
        }; }
 
        
@@ -45,38 +47,40 @@ typedef enum {
 
 typedef void* HIPC_API;
 typedef void* HIPC_PARAMETER;
-typedef void (*PFN_PROXY_CALLBACK)     (HIPC_API a_hAPI, void* pParam1, void* pParam2);
-typedef void (*PFN_EXECUTE_API)                (HIPC_API a_hAPI);
+typedef void (*PFN_PROXY_CALLBACK)     (HIPC_API input_api_handle, void* pParam1, void* pParam2);
+typedef void (*PFN_EXECUTE_API)                (HIPC_API input_api_handle);
 
 /*  ------------------------------------------------------------------------------------------------------------ */
 /*     Proxy AP */
 /*  ------------------------------------------------------------------------------------------------------------ */
-int ipcEmailProxy_Initialize();
-int ipcEmailProxy_Finalize(void);
+EXPORT_API int emipc_initialize_proxy();
+
+EXPORT_API int emipc_finalize_proxy();
 
-bool ipcEmailProxy_ExecuteAPI(HIPC_API a_hAPI);
+EXPORT_API bool emipc_execute_proxy_api(HIPC_API input_api_handle);
 
 /*  ------------------------------------------------------------------------------------------------------------ */
 /*     Stub AP */
 /*  ------------------------------------------------------------------------------------------------------------ */
-bool ipcEmailStub_Initialize(PFN_EXECUTE_API a_pfnAPIMapper);
-bool ipcEmailStub_Finalize(void);
+EXPORT_API bool emipc_initialize_stub(PFN_EXECUTE_API input_api_mapper);
+
+EXPORT_API bool emipc_finalize_stub();
 
-bool ipcEmailStub_ExecuteAPI(HIPC_API a_hAPI);
+EXPORT_API bool emipc_execute_stub_api(HIPC_API input_api_handle);
 
 /*  ------------------------------------------------------------------------------------------------------------ */
 /*     AP */
 /*  ------------------------------------------------------------------------------------------------------------ */
-HIPC_API       ipcEmailAPI_Create(long a_nAPIID);
-void           ipcEmailAPI_Destroy(HIPC_API a_hAPI);
+EXPORT_API HIPC_API emipc_create_email_api(long api_id);
+EXPORT_API void     emipc_destroy_email_api(HIPC_API input_api_handle);
 
-long                   ipcEmailAPI_GetAPIID(HIPC_API a_hAPI);
-long                   ipcEmailAPI_GetAPPID(HIPC_API a_hAPI);
+EXPORT_API long     emipc_get_api_id(HIPC_API input_api_handle);
+EXPORT_API long     emipc_get_app_id(HIPC_API input_api_handle);
 
-bool           ipcEmailAPI_AddParameter(HIPC_API a_hAPI, EPARAMETER_DIRECTION a_eDirection, void *a_pData, int a_nDataLength);
-int            ipcEmailAPI_GetParameterCount(HIPC_API a_hAPI, EPARAMETER_DIRECTION a_eDirection);
-void*          ipcEmailAPI_GetParameter(HIPC_API a_hAPI, EPARAMETER_DIRECTION a_eDirection, int a_nParameterIndex);
-int            ipcEmailAPI_GetParameterLength(HIPC_API a_hAPI, EPARAMETER_DIRECTION a_eDirection, int a_nParameterIndex);
+EXPORT_API bool     emipc_add_parameter(HIPC_API input_api_handle, EPARAMETER_DIRECTION input_parameter_direction, void *input_parameter_data, int input_data_length);
+EXPORT_API int      emipc_get_parameter_count(HIPC_API input_api_handle, EPARAMETER_DIRECTION input_parameter_direction);
+EXPORT_API int      emipc_get_parameter(HIPC_API input_api_handle, EPARAMETER_DIRECTION input_parameter_direction, int input_parameter_index, int input_parameter_buffer_size, void *output_parameter);
+EXPORT_API int      emipc_get_parameter_length(HIPC_API input_api_handle, EPARAMETER_DIRECTION input_parameter_direction, int input_parameter_index);
 
 
 #ifdef __cplusplus
index 9458dd5..45af536 100755 (executable)
@@ -2,8 +2,8 @@ prefix=/usr
 libdir=${prefix}/lib\r
 includedir=${prefix}/include\r
  \r
-Name: Email Engine Library\r
-Description: Email Engine Library 1.0\r
+Name: email-service library\r
+Description: email-service library 1.0\r
 Version: $version\r
-Libs: -L${libdir} -lemail-storage -lemail-core -lemail-base -lemail-ipc -lemail-api -lemail-network \r
-Cflags: -I${includedir}/email-service -D_PREVIEW_IN_MAILIST \r
+Libs: -L${libdir} -lemail-storage -lemail-core -lemail-common-use -lemail-ipc -lemail-api -lemail-network \r
+Cflags: -I${includedir}/email-service \r
similarity index 81%
rename from SLP_EmailService_PG.h
rename to email-service_PG.h
index 4394176..bce43f7 100755 (executable)
@@ -1,6 +1,6 @@
 /**\r
  *\r
- * @ingroup   TIZEN_PG\r
+ * @ingroup   PG\r
  * @defgroup   EMAILSVC Email Service\r
 @{\r
 <h1 class="pg">Introduction</h1>\r
@@ -8,7 +8,7 @@
 Electronic mail, most commonly abbreviated email or e-mail, is a method of exchanging digital messages. E-mail systems are based on a store-and-forward model in which e-mail server computer systems accept, forward, deliver and store messages on behalf of users, who only need to connect to the e-mail infrastructure, typically an e-mail server, with a network-enabled device for the duration of message submission or retrieval.\r
 \r
        <h2 class="pg">Purpose of Programming Guide</h2>\r
-This document is mainly aimed at the core functionality of the Email Service.  The EMail Service component is implemented to provide EMail service to applications that make use of EMail Engine. Email Engine provides functionality for the user like composing mail, saving mail, sending mail, and creating user mailbox according to the settings. Mobile subscribers can use the Email Engine to perform storage opearations such as save, update, get, delete and transport operations such as send, download and other email operations.\r
+This document is mainly aimed at the core functionality of the Email Service.  The EMail Service component is implemented by Samsung to provide EMail service to applications that make use of EMail Engine. Email Engine provides functionality for the user like composing mail, saving mail, sending mail, and creating user mailbox according to the settings. Mobile subscribers can use the Email Engine to perform storage opearations such as save, update, get, delete and transport operations such as send, download and other email operations.\r
 \r
 This programming guide is prepared for application developers who will use the email-service. It contains: \r
 - List of features offered by email-service\r
@@ -198,7 +198,7 @@ emf_account_t
 @code\r
 /* Add account */       \r
 \r
-/*  Assign values for new account */
+/*  Assign values for new account */\r
 emf_account_t *account = NULL;\r
  \r
 account = malloc(sizeof(emf_account_t));\r
@@ -254,12 +254,12 @@ account->options.signature= strdup("Signature");
 account->check_interval = 0;  \r
       \r
 if(EMF_ERROR_NONE != email_add_account(account))\r
-       /* failure */
+       /* failure */\r
 else\r
 {\r
-       /* success     */
+       /* success     */\r
        if(account_id)\r
-               *account_id = account->account_id;              /*  Use this returned account id when calling APIs which need it */
+               *account_id = account->account_id;              /*  Use this returned account id when calling APIs which need it */\r
 }\r
 \r
 /* free account */\r
@@ -272,12 +272,12 @@ email_free_account(&account, 1);
 /* Get account */\r
  \r
 emf_account_t *account = NULL;\r
-int account_id = 1;            /*  account id to be gotten */
+int account_id = 1;            /*  account id to be gotten */\r
  \r
 if(EMF_ERROR_NONE != email_get_account(account_id,GET_FULL_DATA,&account))\r
-       /* failure */
+       /* failure */\r
 else\r
-       /* success */
+       /* success */\r
  \r
 /* free account */\r
 email_free_account(&account, 1);\r
@@ -289,15 +289,15 @@ email_free_account(&account, 1);
 /* Update account */               \r
 \r
 emf_account_t *new_account = NULL;\r
-int account_id = 1;            /*  account id to be updated */
+int account_id = 1;            /*  account id to be updated */\r
  \r
-/*  Get account to be updated */
+/*  Get account to be updated */\r
 if(EMF_ERROR_NONE != email_get_account(account_id,GET_FULL_DATA,&new_account))\r
-       /* failure */
+       /* failure */\r
 else\r
-       /* success */
+       /* success */\r
  \r
-/*  Set the new values */
+/*  Set the new values */\r
 new_account->flag1 = 1;\r
 new_account->account_name           = strdup("gmail"); \r
 new_account->display_name           = strdup("Tom001");             \r
@@ -305,9 +305,9 @@ new_account->options.keep_local_copy = 1;
 new_account->check_interval = 55;  \r
  \r
 if(EMF_ERROR_NONE != email_update_account(account_id,new_account))\r
-       /* failure */
+       /* failure */\r
 else\r
-       /* success */
+       /* success */\r
  \r
 /* free account */\r
 email_free_account(&new_account, 1);\r
@@ -318,12 +318,12 @@ email_free_account(&new_account, 1);
 @code \r
 /* Delete account */\r
 \r
-int account_id = 1;            /*  account id to be deleted */
+int account_id = 1;            /*  account id to be deleted */\r
  \r
 if(EMF_ERROR_NONE != email_delete_account(account_id))\r
-      /* failure */
+      /* failure */\r
 else\r
-      /* success */
+      /* success */\r
  \r
 @endcode\r
 \r
@@ -337,13 +337,13 @@ int count = 0;
 int i;\r
  \r
 if(EMF_ERROR_NONE != email_get_account_list(&account_list,&count))\r
-       /* failure */
+       /* failure */\r
 else\r
 {\r
-       /* success */
+       /* success */\r
        for ( i = 0; i < count; i++ )\r
        {\r
-               /*  Do something with each account */
+               /*  Do something with each account */\r
                printf("account id : %d\n", account_list[i].account_id);\r
        }\r
 }      \r
@@ -360,9 +360,9 @@ unsigned account_handle = 0;
 int account_id = 1;\r
  \r
 if(EMF_ERROR_NONE != email_validate_account(account_id,&account_handle))\r
-       /* failure */
+       /* failure */\r
 else\r
-       /* success */
+       /* success */\r
 @endcode\r
  \r
 <b>Flow Diagram</b>\r
@@ -422,9 +422,9 @@ mailbox->mailbox_type    = 7;
       \r
 /* create new mailbox */           \r
 if(EMF_ERROR_NONE != email_add_mailbox(mailbox,on_server,&handle))\r
-      /* failure */
+      /* failure */\r
 else\r
-      /* success   */
+      /* success   */\r
 \r
 @endcode\r
 \r
@@ -442,15 +442,15 @@ new_mailbox->name =  strdup("Personal001");
  \r
 /* update mailbox */\r
 if(EMF_ERROR_NONE != email_update_mailbox(mailbox,new_mailbox))\r
-      /* failure */
+      /* failure */\r
 else\r
-      /* success   */
+      /* success   */\r
  \r
 /* delete mailbox */\r
 if(EMF_ERROR_NONE != email_delete_mailbox(mailbox,on_server,&handle))\r
-      /* failure */
+      /* failure */\r
 else\r
-      /* success   */
+      /* success   */\r
  \r
 email_free_mailbox(&mailbox, 1);\r
 email_free_mailbox(&new_mailbox, 1);\r
@@ -466,10 +466,10 @@ int count = 0;
  \r
 /*get list of mailboxes */\r
 if(EMF_ERROR_NONE != email_get_mailbox_list(account_id, local_yn, &mailbox_list, &count))\r
-      /* failure */
+      /* failure */\r
 else\r
 {\r
-      /* success   */
+      /* success   */\r
       email_free_mailbox(&mailbox_list,count);\r
 }\r
 @endcode\r
@@ -490,11 +490,11 @@ emf_mail_t
 <tr><td>API</td>\r
 <td>Return Value / Exceptions</td></tr>\r
  \r
-<tr><td>int email_add_message(emf_mail_t* mail, emf_mailbox_t* mailbox, int with_server)  </td>\r
-<td>Returns EMF_ERROR_NONE on success or negative value on failure@n Remarks: -  Memory for params emf_mail_t* mail and emf_mailbox_t* mailbox should be allocated and deallocated by Application</td></tr>\r
+<tr><td>int email_add_mail(emf_mail_data_t *input_mail_data, emf_attachment_data_t *input_attachment_data_list, int input_attachment_count, emf_meeting_request_t* input_meeting_request, int input_from_eas)  </td>\r
+<td>Returns EMF_ERROR_NONE on success or negative value on failure@n Remarks: -  Memory for params emf_mail_data_t* input_mail_data and emf_attachment_data_t *input_attachment_data_list and emf_meeting_request_t* input_meeting_request should be allocated and deallocated by Application</td></tr>\r
  \r
-<tr><td>int email_update_message(int mail_id, emf_mail_t* mail)  </td>\r
-<td>Returns EMF_ERROR_NONE on success or negative value on failure@n Remarks: - Memory for param emf_mail_t* mail should be allocated and deallocated by Application</td></tr>\r
+<tr><td>int email_update_mail(emf_mail_data_t *input_mail_data, emf_attachment_data_t *input_attachment_data_list, int input_attachment_count, emf_meeting_request_t* input_meeting_request, int input_from_eas)  </td>\r
+<td>Returns EMF_ERROR_NONE on success or negative value on failure@n Remarks: -  Memory for params emf_mail_data_t* input_mail_data and emf_attachment_data_t *input_attachment_data_list and emf_meeting_request_t* input_meeting_request should be allocated and deallocated by Application</td></tr>\r
  \r
 <tr><td>int email_count_message(emf_mailbox_t* mailbox, int* total, int* unseen)  </td>\r
 <td>Returns EMF_ERROR_NONE on success or negative value on failure@n Remarks: - Memory for param emf_mailbox_t* mailbox should be allocated and deallocated by Application</td></tr>\r
@@ -513,30 +513,6 @@ emf_mail_t
  \r
 <tr><td>int email_delete_attachment(emf_mailbox_t * mailbox, int mail_id, const char * attachment_id)</td>\r
 <td>Returns EMF_ERROR_NONE on success or negative value on failure@n Remarks: - Memory for param emf_mailbox_t* mailbox should be allocated and deallocated by Application</td></tr>\r
-\r
-<tr><td>int email_get_info(emf_mailbox_t* mailbox, int mail_id, emf_mail_info_t** info)   </td>\r
-<td>Returns EMF_ERROR_NONE on success or negative value on failure.@n Remarks: \r
--# Memory for param emf_mailbox_t* mailbox should be allocated and deallocated by Application \r
--# Memory allocation for param emf_mail_info_t** info will happen in email_get_info (). To free this memory application should call email_free_mail_info () </td></tr>\r
\r
-<tr><td>int email_free_mail_info(emf_mail_info_t** info_list, int count)  </td>\r
-<td>Returns EMF_ERROR_NONE on success or negative value on failure.</td></tr>\r
\r
-<tr><td>int email_get_header_info(emf_mailbox_t* mailbox, int mail_id, emf_mail_head_t** head)  </td>\r
-<td>Returns EMF_ERROR_NONE on success or negative value on failure.@n Remarks: \r
--# Memory for param emf_mailbox_t* mailbox should be allocated and deallocated by Application \r
--# Memory allocation for param emf_mail_head_t** head will happen in email_get_header_info (). To free this memory, application should call email_free_header_info () </td></tr>\r
\r
-<tr><td>int email_free_header_info(emf_mail_head_t** head_list, int count)  </td>\r
-<td>Returns EMF_ERROR_NONE on success or negative value on failure.</td></tr>\r
\r
-<tr><td>int email_get_body_info(emf_mailbox_t* mailbox, int mail_id ,emf_mail_body_t**  body)  </td>\r
-<td>Returns EMF_ERROR_NONE on success or negative value on failure.@n Remarks:\r
--# Memory for param emf_mailbox_t* mailbox should be allocated and deallocated by Application \r
--# Memory allocation for param emf_mail_body_t** body will happen in email_get_body_info (). To free this memory, application should call email_free_body_info () </td></tr>\r
\r
-<tr><td>int email_free_body_info(emf_mail_body_t** body_list, int count)  </td>\r
-<td>Returns EMF_ERROR_NONE on success or negative value on failure.</td></tr>\r
  \r
 <tr><td>int email_get_attachment_info(emf_mailbox_t* mailbox, int mail_id, const char* attachment_id, emf_attachment_info_t** attachment)</td>\r
 <td>Returns EMF_ERROR_NONE on success or negative value on failure.@n Remarks:\r
@@ -546,11 +522,6 @@ emf_mail_t
 <tr><td>int email_free_attachment_info(emf_attachment_info_t** atch_info)  </td>\r
 <td>Returns EMF_ERROR_NONE on success or negative value on failure.</td></tr>\r
  \r
-<tr><td>int email_get_mail(emf_mailbox_t* mailbox,  int mail_id, emf_mail_t** mail)  </td>\r
-<td>Returns EMF_ERROR_NONE on success or negative value on failure.@n Remarks:\r
--# Memory for param emf_mailbox_t* mailbox should be allocated and deallocated by Application \r
--# Memory allocation for param emf_mail_t** mail will happen in email_get_mail (). To free this memory, application should call email_free_mail () </td></tr>\r
\r
 <tr><td>int email_modify_mail_flag(int mail_id, emf_mail_flag_t new_flag, int onserver)  </td>\r
 <td>Returns EMF_ERROR_NONE on success or negative value on failure.</td></tr>\r
  \r
@@ -577,9 +548,6 @@ emf_mail_t
  \r
 <tr><td>int email_free_mailbox(emf_mailbox_t** mailbox_list, int count)  </td>\r
 <td>Returns EMF_ERROR_NONE on success or negative value on failure</td></tr>\r
\r
-<tr><td>int email_free_mail(emf_mail_t** mail_list, int count)  </td>\r
-<td>Returns EMF_ERROR_NONE on success or negative value on failure</td></tr>\r
    \r
 <tr><td>int email_get_mail_flag(int account_id, int mail_id, emf_mail_flag_t* mail_flag)  </td>\r
 <td>Returns EMF_ERROR_NONE on success or negative value on failure</td></tr>\r
@@ -614,72 +582,87 @@ emf_mail_t
 @li Add, Update, Count and Delete message\r
 @code\r
 emf_mailbox_t *mailbox = NULL;\r
-emf_mail_t *mail = NULL;\r
 int on_server = 0, account_id = 0, mail_id = 0;\r
 char *pFilePath = "/tmp/mail.txt";\r
\r
-/* Fill mail data to save */\r
-mailbox = malloc(sizeof(emf_mailbox_t));\r
-memset(mailbox, 0x00, sizeof(emf_mailbox_t));\r
\r
-mail = malloc(sizeof(emf_mail_t));\r
-memset(mail, 0x00, sizeof(emf_mail_t));\r
\r
-mail->info = malloc(sizeof(emf_mail_info_t));\r
-memset(mail->info, 0x00, sizeof(emf_mail_info_t));\r
-mail->info->account_id = /*account_id*/;\r
\r
-mail->head = malloc(sizeof(emf_mail_head_t));\r
-memset(mail->head, 0x00, sizeof(emf_mail_head_t));\r
-      \r
-mail->body = malloc(sizeof(emf_mail_body_t));\r
-memset(mail->body, 0x00, sizeof(emf_mail_body_t));\r
\r
-mail->head->to = strdup("\"ActiveSync8\" <ActiveSync8@test.local>"); \r
-mail->head->cc = strdup("bapina@gawab.com");\r
-mail->head->bcc= strdup("<tom@gmail.com>");      \r
-mail->head->subject = strdup("save.mailbox...");\r
\r
-mail->body->plain = strdup(pFilePath);\r
\r
-mailbox->name = strdup("DRAFT");\r
-mailbox->account_id = account_id;\r
\r
-/* Add message */\r
-if(EMF_ERROR_NONE != email_add_message(mail, mailbox, on_server))\r
-      /* failure */
+int                    i = 0;\r
+int                    account_id = 0;\r
+int                    from_eas = 0;\r
+int                    attachment_count = 0;\r
+int                    err = EMF_ERROR_NONE;\r
+char                   arg[50] = { 0 , };\r
+char                  *body_file_path = "/opt/data/email/.emfdata/tmp/mail.txt";\r
+emf_mailbox_t         *mailbox_data = NULL;\r
+emf_mail_data_t       *test_mail_data = NULL;\r
+emf_attachment_data_t *attachment_data = NULL;\r
+emf_meeting_request_t *meeting_req = NULL;\r
+FILE                  *body_file;\r
+\r
+printf("\n > Enter account id : ");\r
+scanf("%d", &account_id);\r
+\r
+memset(arg, 0x00, 50);\r
+printf("\n > Enter mailbox name : ");\r
+scanf("%s", arg);\r
+\r
+email_get_mailbox_by_name(account_id, arg, &mailbox_data);\r
+\r
+test_mail_data = malloc(sizeof(emf_mail_data_t));\r
+memset(test_mail_data, 0x00, sizeof(emf_mail_data_t));\r
+\r
+printf("\n From EAS? [0/1]> ");\r
+scanf("%d", &from_eas);\r
+\r
+test_mail_data->account_id        = account_id;\r
+test_mail_data->save_status       = 1;\r
+test_mail_data->flags_seen_field  = 1;\r
+test_mail_data->file_path_plain   = strdup(body_file_path);\r
+test_mail_data->mailbox_name      = strdup(mailbox_data->name);\r
+test_mail_data->mailbox_type      = mailbox_data->mailbox_type;\r
+test_mail_data->full_address_from = strdup("<test1@test.com>");\r
+test_mail_data->full_address_to   = strdup("<test2@test.com>");\r
+test_mail_data->full_address_cc   = strdup("<test3@test.com>");\r
+test_mail_data->full_address_bcc  = strdup("<test4@test.com>");\r
+test_mail_data->subject           = strdup("Meeting request mail");\r
+\r
+body_file = fopen(body_file_path, "w");\r
+\r
+for(i = 0; i < 500; i++)\r
+       fprintf(body_file, "X2 X2 X2 X2 X2 X2 X2");\r
+fflush(body_file);\r
+ fclose(body_file);\r
+\r
+\r
+if((err = email_add_mail(test_mail_data, attachment_data, attachment_count, meeting_req, from_eas)) != EMF_ERROR_NONE)\r
+       printf("email_add_mail failed. [%d]\n", err);\r
 else\r
-{\r
-      /* success   */
-      mail_id = mail->info->uid;\r
-}\r
+       printf("email_add_mail success.\n");\r
  \r
 /* Update message */\r
-/*  variable 'mail' should be filled with data on DB. */
-/*  And change values you want to update. */
+/*  variable 'mail' should be filled with data on DB. */\r
+/*  And change values you want to update. */\r
 mail->head->subject = strdup("save.mailbox again...");\r
  \r
 if(EMF_ERROR_NONE != email_update_message(mail_id,mail))\r
-       /* failure */
+       /* failure */\r
 else\r
-       /* success   */
+       /* success   */\r
  \r
 /* Count message */\r
 int total = 0, unseen = 0;\r
  \r
-/*  Get the total number of mails and the number of unseen mails */
+/*  Get the total number of mails and the number of unseen mails */\r
 if(EMF_ERROR_NONE != email_count_message(mailbox,&total,&unseen))\r
-       /* failure */
+       /* failure */\r
 else\r
-       /* success   */
+       /* success   */\r
  \r
 /* Delete message */\r
 int *mail_ids, num = 0;\r
  \r
 if(EMF_ERROR_NONE != email_delete_message(mailbox,mail_ids,num,on_server))\r
-       /* failure */
+       /* failure */\r
 else\r
-       /* success   */
+       /* success   */\r
 @endcode \r
  \r
 @li Delete all message in a specific mailbox\r
@@ -695,10 +678,10 @@ mailbox->account_id = 1;
 mailbox->name = strdup("INBOX");               \r
 \r
 if( EMF_ERROR_NONE != email_delete_all_message_in_mailbox(mailbox, on_server))\r
-      /* failure */
+      /* failure */\r
 else\r
 \r
-      /* success   */
+      /* success   */\r
 @endcode\r
 \r
 \r
@@ -706,76 +689,11 @@ else
 @code\r
 /* clear mail data */\r
 if(EMF_ERROR_NONE !=  email_clear_mail_data())\r
-      /* failure */
-else\r
-      /* success   */
-@endcode\r
-\r
-@li Get mail information : information, header, body, mail\r
-@code\r
-emf_mailbox_t *mailbox = NULL;\r
-emf_mail_info_t *mail_info = NULL;\r
-int mail_id = 1, account_id = 1;               /*  mail id and its account id to be gotten  */
\r
-mailbox = malloc(sizeof(emf_mailbox_t));\r
-memset(mailbox, 0x00, sizeof(emf_mailbox_t));\r
-\r
-/* Get mail info */\r
-mailbox->account_id = account_id;\r
\r
-if ( EMF_ERROR_NONE != email_get_info(mailbox, mail_id, &mail_info))\r
-      /* failure */
-else\r
-      /* success   */
\r
-/* free mail info */\r
-email_free_mail_info(&mail_info,1);\r
\r
-/* Get mail header info */\r
-emf_mail_head_t *head = NULL;\r
\r
-mailbox->account_id = account_id;\r
\r
-if(EMF_ERROR_NONE !=  email_get_header_info(mailbox,mail_id,&head))\r
-      /* failure */
-else\r
-      /* success   */
-\r
-/* free mail header info */\r
-email_free_header_info(&head,1);\r
\r
-/* Get mail body info */\r
-emf_mail_body_t *head = NULL;\r
\r
-mailbox->account_id = account_id;\r
\r
-if(EMF_ERROR_NONE !=  email_get_body_info(mailbox,mail_id,&body))\r
-       /* failure */
-else\r
-       /* success   */
\r
-/* free mail body info */\r
-email_free_body_info(&body,1);\r
\r
-/* Get mail info*/\r
-emf_mail_t *mail = NULL;\r
-int mail_id = 0;\r
\r
-if(EMF_ERROR_NONE !=  email_get_mail(mailbox,mail_id,&mail))\r
-       /* failure */
+      /* failure */\r
 else\r
-       /* success   */
\r
-/* free mail body info */\r
-email_free_mail(&mail,1);\r
\r
-/* free mailbox*/\r
-email_free_mailbox(&mailbox,1);\r
\r
+      /* success   */\r
 @endcode\r
 \r
-\r
-\r
 @li Modify flag\r
 @code\r
 emf_mail_flag_t newflag = {0};\r
@@ -784,9 +702,9 @@ int on_server = 0;
  \r
 /* Modify mail flag*/\r
 if(EMF_ERROR_NONE != email_modify_mail_flag(mail_id,newflag,on_server))\r
-       /* failure */
+       /* failure */\r
 else\r
-       /* success   */
+       /* success   */\r
 \r
 int mail_ids[] = {1, 2}; \r
 int num = 2;\r
@@ -795,16 +713,16 @@ int on_server = 0;
  \r
 /* Modify seen flag*/\r
 if(EMF_ERROR_NONE != email_modify_seen_flag(mail_ids, num, seen_flag,on_server))\r
-       /* failure */
+       /* failure */\r
 else\r
-       /* success   */
+       /* success   */\r
  \r
 /* Modify extra flag*/\r
 int mail_id = 1;\r
 if(EMF_ERROR_NONE != email_modify_extra_mail_flag(mail_id, newflag))\r
-       /* failure */
+       /* failure */\r
 else\r
-       /* success   */
+       /* success   */\r
 @endcode\r
 \r
 \r
@@ -822,9 +740,9 @@ mailbox->name = mailbox_name;
  \r
 /* Move mail to given mailbox*/\r
 if(EMF_ERROR_NONE !=  email_move_mail_to_mailbox(/*mail_id*/,/*num*/,mailbox))\r
-      /* failure */
+      /* failure */\r
 else\r
-      /* success   */
+      /* success   */\r
  \r
 /* free mailbox*/\r
 email_free_mailbox(&mailbox,1);\r
@@ -847,9 +765,9 @@ dest_mailbox->name = /*dest_mailbox_name*/
  \r
 /*move all mails to given mailbox*/\r
 if(EMF_ERROR_NONE !=  email_move_all_mails_to_mailbox(src_mailbox,dest_mailbox))\r
-      /* failure */
+      /* failure */\r
 else\r
-      /* success   */
+      /* success   */\r
  \r
 /* free mailbox*/\r
 email_free_mailbox(&src_mailbox,1);\r
@@ -867,9 +785,9 @@ mailbox->name = /*mailbox_name*/
  \r
 /*count of draft msgs*/\r
 if(EMF_ERROR_NONE !=  email_count_message_with_draft_flag(mailbox,&total))\r
-      /* failure */
+      /* failure */\r
 else\r
-      /* success   */
+      /* success   */\r
  \r
 /* free mailbox*/\r
 email_free_mailbox(&mailbox,1);\r
@@ -889,9 +807,9 @@ mailbox->name = /*mailbox_name*/
  \r
 /*count of msgs sent from given mailbox*/\r
 if(EMF_ERROR_NONE != email_count_message_on_sending(mailbox,&total))\r
-      /* failure */
+      /* failure */\r
 else\r
-      /* success   */
+      /* success   */\r
  \r
 /* free mailbox*/\r
 email_free_mailbox(&mailbox,1);\r
@@ -907,9 +825,9 @@ int account_id = 1, count = 0;
  \r
 /* Get mailbox list*/\r
 if(EMF_ERROR_NONE != email_get_mailbox_list(account_id,&mailbox_list,&count))\r
-      /* failure */
+      /* failure */\r
 else\r
-      /* success   */
+      /* success   */\r
  \r
 /* free mailbox list*/\r
 email_free_mailbox(&mailbox,count);\r
@@ -932,7 +850,7 @@ free(pMailbox_name);
 @code \r
  \r
 /* email_cancel_send_mail*/\r
-int mail_id = 1;       /*  mail id of a mail which is on sending */
+int mail_id = 1;       /*  mail id of a mail which is on sending */\r
 err = email_cancel_send_mail(mail_id);\r
  \r
 @endcode\r
@@ -1000,10 +918,6 @@ emf_option_t
 <tr><td>void email_get_network_status(int* on_sending, int* on_receiving) </td>\r
 <td>Returns EMF_ERROR_NONE on success or negative value on failure</td></tr>\r
  \r
-<tr><td>int email_send_report(emf_mail_t* mail,  unsigned* handle) </td>\r
-<td>Returns EMF_ERROR_NONE on success or negative value on failure@n Remarks:\r
--# Memory allocation and de-allocation for input param is to be done by application.</td></tr>\r
\r
 <tr><td>int email_send_saved(int account_id, emf_option_t* sending_option, unsigned* handle)</td>\r
 <td>Returns EMF_ERROR_NONE on success or negative value on failure@n Remarks:\r
 -# Memory allocation and de-allocation for input param is to be done by application.</td></tr>\r
@@ -1018,48 +932,7 @@ emf_option_t
 <b>Sample Code</b>\r
 @li Send a mail\r
 @code\r
-/* Send a mail */\r
-emf_mailbox_t mbox;\r
-emf_mail_t *mail = NULL;\r
-emf_mail_head_t *head =NULL;\r
-emf_mail_body_t *body =NULL;\r
-emf_attachment_info_t attachment;\r
-emf_option_t option;\r
-int account_id = 1;\r
-int err = EMF_ERROR_NONE;\r
\r
-mail =( emf_mail_t *)malloc(sizeof(emf_mail_t));\r
-head =( emf_mail_head_t *)malloc(sizeof(emf_mail_head_t));\r
-body =( emf_mail_body_t *)malloc(sizeof(emf_mail_body_t));\r
-mail->info =( emf_mail_info_t*) malloc(sizeof(emf_mail_info_t));\r
-memset(mail->info, 0x00, sizeof(emf_mail_info_t));\r
\r
-memset(&mbox, 0x00, sizeof(emf_mailbox_t));\r
-memset(&option, 0x00, sizeof(emf_option_t));\r
-memset(mail, 0x00, sizeof(emf_mail_t));\r
-memset(head, 0x00, sizeof(emf_mail_head_t));\r
-memset(body, 0x00, sizeof(emf_mail_body_t));\r
-memset(&attachment, 0x00, sizeof(emf_attachment_info_t));\r
\r
-option.keep_local_copy = 1;\r
-mbox.account_id = account_id;\r
-mbox.name = strdup("OUTBOX");\r
-head->to=strdup("test@test.com";\r
-head->subject =strdup("test");\r
-body->plain = strdup("/tmp/mail.txt");\r
-mail->info->account_id = account_id;\r
-mail->info->flags.draft = 1;\r
-mail->body = body;\r
-mail->head = head;\r
-attachment.name = strdup("attach");\r
-attachment.savename = strdup("tmp/mail.txt");\r
-attachment.next = NULL;\r
-mail->body->attachment = &attachment;\r
-mail->body->attachment_num = 1;\r
-if(EMF_ERROR_NONE  == email_add_message(mail,&mbox,1))\r
-{\r
-      err= email_send_mail(&mbox, mail->info->uid,&option,&handle);\r
-}\r
+/* TODO : Write sample to send a mail. */\r
 @endcode\r
 \r
 @li Download header of new emails from mail server\r
@@ -1099,7 +972,7 @@ err= email_download_body (&mbox,mail_id,0,&handle);
 emf_mailbox_t mailbox;\r
 int mail_id = 1;\r
 int account_id = 1;     \r
-char arg[50]; /* Input attachment number need to be download */
+char arg[50]; /* Input attachment number need to be download */\r
 unsigned handle = 0;\r
 int err = EMF_ERROR_NONE;\r
  \r
@@ -1226,7 +1099,7 @@ And it MUST finalize IPC proxy and disconnect to the DB if the application doesn
 @code\r
 int err = EMF_ERROR_NONE;\r
  \r
-/*  Initialize Email MAPI Layer before calling other MAPIs */
+/*  Initialize Email MAPI Layer before calling other MAPIs */\r
 if(EMF_ERROR_NONE == email_service_begin())\r
 {\r
        if(EMF_ERROR_NONE != email_open_db())\r
@@ -1239,11 +1112,11 @@ if(EMF_ERROR_NONE == email_service_begin())
        }\r
 }\r
 \r
-/*  Call other MAPIs */
+/*  Call other MAPIs */\r
 \r
 ......\r
 \r
-/*  Finalize Email MAPI Layer when finishing application */
+/*  Finalize Email MAPI Layer when finishing application */\r
 err = email_close_db();\r
 err = email_service_end();\r
 @endcode\r
@@ -1256,7 +1129,7 @@ err = email_service_end();
 @{\r
 <h1 class="pg">System Configuration</h1>\r
        <h2 class="pg">Files to be included</h2>\r
-Emf_Mapi.h\r
+email-api.h\r
 @n Emf_Mapi_Types.h\r
 \r
        <h2 class="pg">System Initialization and De-Initialization</h2>\r
diff --git a/emf-emn-storage/emf-emn-storage.c b/emf-emn-storage/emf-emn-storage.c
deleted file mode 100755 (executable)
index c184d6f..0000000
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <time.h>
-#include <sys/types.h>
-#include "db-util.h"
-#include "em-storage.h"
-#include "emf-emn-storage.h"
-#include "emf-dbglog.h"
-#include "emflib.h"
-
-#define EMF_DB_PARS_ERR(code__, msg__)                 memset(msg__, 0x00, sizeof(msg__)); EDBGetErrorInfo(&code__, msg__)
-
-#ifdef UNUSED
-sqlite3* sqlite_emmb;
-
-static int _string_to_tm(struct tm* time, const char* string);
-static void _tm_to_string(const struct tm* time, char* string, size_t string_size);
-
-
-static void __emn_storage_log_func(const char* format, ...)
-{
-       FILE* fp = NULL;
-       va_list va_args;
-       char msg_buffer[256] = {0, };
-       
-       va_start(va_args, format);
-       vsnprintf(msg_buffer, sizeof(msg_buffer), format, va_args);
-       va_end(va_args);
-       
-       if (strlen(LOG_FILE_PATH) > 0)
-               fp = fopen(LOG_FILE_PATH, "a");
-       else 
-               fp = fopen("/var/log/email_ui.log", "a");
-       
-       if (fp != NULL) {
-/*             tzset(); */
-               time_t ct = time(&ct);
-               struct tm* lt = localtime(&ct);
-               
-               if (lt) {
-                       fprintf(fp, "[%d-%d-%d %d:%d:%d] %s: %s\n",
-                               lt->tm_year + 1900, lt->tm_mon + 1, lt->tm_mday,
-                               lt->tm_hour, lt->tm_min, lt->tm_sec,
-                               "EMN", msg_buffer);
-               }
-               
-               fclose(fp);
-       }
-}
-
-
-enum {
-       ACCOUNT_ID___MAIL_NEW_TBL = 0,
-       ACCOUNT_NAME___MAIL_NEW_TBL,
-       ARRIVALTIME___MAIL_NEW_TBL,
-       NEW_MAIL_COUNT___MAIL_NEW_TBL,
-       SVC_TYPE___MAIL_NEW_TBL,                
-};
-
-/*  static char _g_sql_query[1024] = {0x00, }; */
-/*  char _g_err_msg[1024] = {0x00, }; */
-/*  int _g_err = 0; */
-
-
-static char* _cpy_str(char* src)
-{
-       char* p = NULL;
-       if (src) {
-               if (!(p = malloc((int)strlen(src) + 1)))
-                       return NULL;
-               
-               strcpy(p, src);
-       }
-       return p;
-}
-
-static int _emf_storage_close(int* err_code)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       
-       int ret = true;
-       int rc = -1;
-       rc = db_util_close( sqlite_emmb);
-       sqlite_emmb = NULL;
-       if(SQLITE_OK != rc) {
-               EM_DEBUG_LOG("\t db_util_close failed - %d\n", rc);
-               ret = false;    
-       }
-       
-       if (err_code != NULL)
-               *err_code = rc;
-       
-    return ret;
-}
-
-static int _emf_storage_open(int* err_code)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       
-       int ret = true;
-       
-       if ( !em_db_open(&sqlite_emmb, NULL) ) {
-               EM_DEBUG_EXCEPTION("em_db_open failed\n");
-               ret = false;
-       }                                       
-       
-       return ret;
-}
-
-
-
-static int _string_to_tm(struct tm* time, const char* string)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       
-       char year[5] = {0x00, };
-       char month[3] = {0x00, };
-       char hour[3] = {0x00, };
-       char day[3] = {0x00, };
-       char min[3] = {0x00, };
-       char sec[3] = {0x00, };
-       
-       if (!time)
-               return false;
-       
-       if ((!string) || (strlen(string) != 14)) 
-               return false;
-       
-       strncpy(year, string, 4); time->tm_year = atoi(year); string += 4;
-       strncpy(month, string, 2); time->tm_mon = atoi(month); string += 2;
-       strncpy(day, string, 2); time->tm_mday = atoi(day); string += 2;
-       strncpy(hour, string, 2); time->tm_hour = atoi(hour); string += 2;
-       strncpy(min, string, 2);  time->tm_min = atoi(min); string += 2;
-       strncpy(sec, string, 2); time->tm_sec = atoi(sec);
-       
-       return true;
-}
-
-static void _tm_to_string(const struct tm* time, char* string, size_t string_size)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       
-       memset(string, 0x00, string_size);
-       
-       snprintf(string, string_size, "%04d%02d%02d%02d%02d%02d", 
-                                                  time->tm_year, time->tm_mon,
-                                                  time->tm_mday, time->tm_hour,
-                                                  time->tm_min,  time->tm_sec);
-       
-       return;
-}
-
-#endif
-
diff --git a/image/email_image001.png b/image/email_image001.png
deleted file mode 100755 (executable)
index 0d78bfd..0000000
Binary files a/image/email_image001.png and /dev/null differ
diff --git a/image/email_image002.png b/image/email_image002.png
deleted file mode 100755 (executable)
index 5eda4be..0000000
Binary files a/image/email_image002.png and /dev/null differ
diff --git a/image/email_image003.png b/image/email_image003.png
deleted file mode 100755 (executable)
index cf8be88..0000000
Binary files a/image/email_image003.png and /dev/null differ
diff --git a/image/email_image004.png b/image/email_image004.png
deleted file mode 100755 (executable)
index c90711f..0000000
Binary files a/image/email_image004.png and /dev/null differ
diff --git a/image/email_image005.png b/image/email_image005.png
deleted file mode 100755 (executable)
index e913091..0000000
Binary files a/image/email_image005.png and /dev/null differ
diff --git a/image/email_image006.png b/image/email_image006.png
deleted file mode 100755 (executable)
index 1d2708c..0000000
Binary files a/image/email_image006.png and /dev/null differ
diff --git a/image/email_image007.png b/image/email_image007.png
deleted file mode 100755 (executable)
index 46b0dc7..0000000
Binary files a/image/email_image007.png and /dev/null differ
diff --git a/image/email_image008.png b/image/email_image008.png
deleted file mode 100755 (executable)
index 1f117c5..0000000
Binary files a/image/email_image008.png and /dev/null differ
diff --git a/image/email_image009.png b/image/email_image009.png
deleted file mode 100755 (executable)
index 1141e51..0000000
Binary files a/image/email_image009.png and /dev/null differ
diff --git a/image/email_image010.png b/image/email_image010.png
deleted file mode 100755 (executable)
index df9aac0..0000000
Binary files a/image/email_image010.png and /dev/null differ
diff --git a/image/email_image011.png b/image/email_image011.png
deleted file mode 100755 (executable)
index 70a54fe..0000000
Binary files a/image/email_image011.png and /dev/null differ
diff --git a/image/email_image012.png b/image/email_image012.png
deleted file mode 100755 (executable)
index bd6b019..0000000
Binary files a/image/email_image012.png and /dev/null differ
diff --git a/include/.gitignore b/include/.gitignore
deleted file mode 100644 (file)
index f42dfd4..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-contact-engine-h
-filemanager-service-h
diff --git a/include/emf-emn-noti.h b/include/emf-emn-noti.h
deleted file mode 100755 (executable)
index fc458c9..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-/******************************************************************************
- * File: emf_noti.h
- * Desc: Email notification
- *
- * Auth:
- *
- * History:
- *    2006.08.01 : created
- *****************************************************************************/
-#ifndef __EMF_EMN_NOTI_H__
-#define __EMF_EMN_NOTI_H__
-
-
-enum
-{
-       EMN_HEADER_DATA = 0,
-       EMN_WBXML_DATA,
-};
-
-/* Error Values for the Email options */
-enum
-{
-       EMAIL_OPTION_ERROR_NONE = 0,
-       EMAIL_OPTION_ERROR_INVALID_PARAM,
-       EMAIL_OPTION_ERROR_STORAGE,
-};
-
-/* Manual Network value */
-#define   EMAIL_OPTION_NETWORK_MANUAL  1
-
-
-/* Enums for the Gcong Option Key */
-typedef enum
-{
-       EMAIL_OPTION_KEY_HOME_NETWORK = 0,
-       EMAIL_OPTION_KEY_ROAMING_NETWORK,       
-}optionkey;
-
-#define EMAIL_GCONF_DIR  "/Apps/Email"
-
-
-int emf_emn_noti_init(void);
-int emf_emn_noti_quit(int bExtDest);
-
-void 
-emn_test_func(void);
-#endif /*__EMF_EMN_NOTI_H__*/
diff --git a/include/emf-emn-storage.h b/include/emf-emn-storage.h
deleted file mode 100755 (executable)
index 812fd92..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-/**
- * This file defines all APIs of EMN's storage.
- * @file       emf-emn-storage.h
- * @version    0.1
- * @brief      This file is the header file of EMN's storage library.
- */
-
-#ifndef __EMF_EMN_STORAGE_H__
-#define __EMF_EMN_STORAGE_H__
-
-/**
-* @ingroup EMAIL_FRAMEWORK
-* @defgroup EMN_STORAGE EMN Storage
-* @{
-*/
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
-
-#if !defined(EXPORT_API)
-#define EXPORT_API __attribute__((visibility("default")))
-#endif
-
-#ifdef MAILHOME
-#undef MAILHOME
-#endif
-
-#define MAILHOME DATA_PATH"/.email-service/.emfdata"   /**< This defines the storage mailbox. */ 
-#define MAILTEMP "tmp" /**< This defines the temporary mailbox. */
-#ifndef true
-#define true 1         /**< This defines true. */
-#define false 0                /**< This defines false. */
-#endif
-       
-/** 
- * This enumeration specifies the mail service type.
- */
-typedef enum
-{
-    EMF_SVC_EMN = 1,   /**< Specifies the EMN service.*/
-    EMF_SVC_VISTO,             /**< Specifies the Pushmail service(VISTO).*/
-    EMF_SVC_IMAP_IDLE  /**< Specifies the normal email service.*/
-} emf_svc_type_t;
-
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-/**
-* @} @}
-*/
-
-
-
-#endif /* __EMF_EMN_STORAGE_H__ */
-/* EOF */
-
diff --git a/include/emf-mutex.h b/include/emf-mutex.h
deleted file mode 100755 (executable)
index 27b8fe9..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-#ifndef _EMF_MUTEX_H_
-#define _EMF_MUTEX_H_
-
-#include <sys/time.h>
-
-class Mutex
-{
-public:
-       Mutex(){ pthread_mutex_init(&m, NULL); }
-       void lock(){ pthread_mutex_lock(&m); }
-       void unlock(){ pthread_mutex_unlock(&m); }
-       pthread_mutex_t* pMutex() { return &m; }        
-
-private:
-       pthread_mutex_t m;
-};
-
-class MutexLocker
-{
-public:
-       MutexLocker(Mutex& mx) {
-               pm = &mx;
-               pm->lock();
-       }
-
-       ~MutexLocker() {
-               pm->unlock();
-       }
-
-private:
-       Mutex *pm;
-};
-
-class CndVar
-{
-public:
-       CndVar(){ pthread_cond_init(&c, NULL); }
-       void wait(pthread_mutex_t* m) { pthread_cond_wait(&c, m); }
-       int timedwait(pthread_mutex_t* m, int sec)  { 
-               struct timeval now = {0};
-               struct timespec timeout = {0};
-               gettimeofday(&now, NULL);
-               timeout.tv_sec = now.tv_sec+sec;
-               timeout.tv_nsec = now.tv_usec;
-               int retcode = pthread_cond_timedwait(&c, m, &timeout);
-               return retcode;
-       }
-       int signal(){ return pthread_cond_signal(&c); }
-       int broadcast(){ return pthread_cond_broadcast(&c); }
-
-private:
-       pthread_cond_t c;
-};
-
-
-#endif
-
diff --git a/ipc/CMakeLists.txt b/ipc/CMakeLists.txt
deleted file mode 100755 (executable)
index e11a628..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(email-ipc)
-
-SET(CMAKE_SKIP_BUILD_RPATH TRUE)
-
-IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
-       SET(CMAKE_BUILD_TYPE "Debug")
-ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
-
-MESSAGE("")
-MESSAGE(">>> current directory: ${CMAKE_CURRENT_SOURCE_DIR}")
-MESSAGE(">>> Build type: ${CMAKE_BUILD_TYPE}")
-
-SET(VISIBILITY "-DEXPORT_API=\"__attribute__((visibility(\\\"default\\\")))\"")
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${VISIBILITY} -fvisibility=hidden")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VISIBILITY} -fvisibility=hidden")
-
-SET(IPC-LIB "email-ipc")
-SET(IPC-SRCS 
-       ${CMAKE_SOURCE_DIR}/ipc/ipc-library-api.cpp 
-       ${CMAKE_SOURCE_DIR}/ipc/ipc-library-build.cpp
-       ${CMAKE_SOURCE_DIR}/ipc/ipc-library-proxy.cpp
-       ${CMAKE_SOURCE_DIR}/ipc/ipc-library-stub.cpp
-       ${CMAKE_SOURCE_DIR}/ipc/api/ipc-api-info.cpp
-       ${CMAKE_SOURCE_DIR}/ipc/api/ipc-param.cpp
-       ${CMAKE_SOURCE_DIR}/ipc/api/ipc-param-list.cpp
-       ${CMAKE_SOURCE_DIR}/ipc/common/cm-list.cpp
-       ${CMAKE_SOURCE_DIR}/ipc/common/cm-sys-msg-queue.cpp
-       ${CMAKE_SOURCE_DIR}/ipc/proxy/ipc-callback-info.cpp
-       ${CMAKE_SOURCE_DIR}/ipc/proxy/ipc-proxy-main.cpp
-       ${CMAKE_SOURCE_DIR}/ipc/proxy/ipc-proxy-socket.cpp
-       ${CMAKE_SOURCE_DIR}/ipc/socket/ipc-socket.cpp
-       ${CMAKE_SOURCE_DIR}/ipc/stub/ipc-queue.cpp
-       ${CMAKE_SOURCE_DIR}/ipc/stub/ipc-response-info.cpp
-       ${CMAKE_SOURCE_DIR}/ipc/stub/ipc-stub-main.cpp
-       ${CMAKE_SOURCE_DIR}/ipc/stub/ipc-stub-socket.cpp
-       ${CMAKE_SOURCE_DIR}/ipc/stub/ipc-task.cpp
-       ${CMAKE_SOURCE_DIR}/ipc/stub/ipc-task-manager.cpp
-)
-
-INCLUDE_DIRECTORIES(
-       ${CMAKE_SOURCE_DIR}/include
-       ${CMAKE_SOURCE_DIR}/ipc/include
-       ${CMAKE_SOURCE_DIR}/ipc/proxy/include
-       ${CMAKE_SOURCE_DIR}/ipc/stub/include
-       ${CMAKE_SOURCE_DIR}/ipc/common/include
-       ${CMAKE_SOURCE_DIR}/ipc/socket/include
-       ${CMAKE_SOURCE_DIR}/ipc/api/include
-       ${CMAKE_SOURCE_DIR}/Common/include
-       ${CMAKE_SOURCE_DIR}/MAPI/include
-)
-
-INCLUDE(FindPkgConfig)
-pkg_check_modules(ipc_pkgs REQUIRED dlog glib-2.0)
-
-FOREACH(flag ${ipc_pkgs_CFLAGS})
-       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS}")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
-#message("***cmake_c_flags ${CMAKE_C_FLAGS}")
-#message("***extra_cflags ${EXTRA_CFLAGS}")
-#message("***base_pkgs_cflags ${base_pkgs_CFLAGS}")
-#message("***result ${CMAKE_CXX_FLAGS}")
-
-
-ADD_DEFINITIONS("-DBRSDK_VER=\"2\"")
-
-SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
-
-ADD_LIBRARY(${IPC-LIB} SHARED ${IPC-SRCS})
-TARGET_LINK_LIBRARIES(${IPC-LIB} ${ipc_pkgs_LDFLAGS} email-base pthread)
-SET_TARGET_PROPERTIES(${IPC-LIB} PROPERTIES SOVERSION ${VERSION_MAJOR})
-SET_TARGET_PROPERTIES(${IPC-LIB} PROPERTIES VERSION ${VERSION})
-
-INSTALL(TARGETS ${IPC-LIB} DESTINATION lib COMPONENT RuntimeLibraries)
-
diff --git a/ipc/api/ipc-api-info.cpp b/ipc/api/ipc-api-info.cpp
deleted file mode 100755 (executable)
index 7fd8720..0000000
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-#include <string.h>
-#include <unistd.h>
-#include "ipc-api-info.h"
-#include "ipc-param-list.h"
-#include "ipc-library-build.h"
-
-ipcEmailAPIInfo::ipcEmailAPIInfo()
-{
-       m_pParams[ePARAMETER_IN] = NULL;
-       m_pParams[ePARAMETER_OUT] = NULL;
-       m_nAPIID = 0;
-       m_nResponseID = 0;
-       m_nAPPID = 0;
-}
-
-ipcEmailAPIInfo::~ipcEmailAPIInfo()
-{
-       if(m_pParams[ePARAMETER_IN]) {
-               delete m_pParams[ePARAMETER_IN];
-               m_pParams[ePARAMETER_IN] = NULL;
-       }
-
-       if(m_pParams[ePARAMETER_OUT]) {
-               delete m_pParams[ePARAMETER_OUT];
-               m_pParams[ePARAMETER_OUT] = NULL;
-       }
-}
-
-bool ipcEmailAPIInfo::SetAPIID(long a_nAPIID)
-{
-       m_nAPIID = a_nAPIID;
-       return true;
-}
-
-long ipcEmailAPIInfo::GetAPIID()
-{
-       return m_nAPIID;
-}
-
-
-bool ipcEmailAPIInfo::SetAPPID(long a_nAPPID)
-{
-       m_nAPPID = a_nAPPID;
-       return true;
-}
-
-long ipcEmailAPIInfo::GetAPPID()
-{
-       return m_nAPPID;
-}
-
-
-bool ipcEmailAPIInfo::SetResponseID(long a_nResponseID)
-{
-       m_nResponseID = a_nResponseID;
-       return true;
-}
-
-long ipcEmailAPIInfo::GetResponseID()
-{
-       return m_nResponseID;
-}
-
-bool ipcEmailAPIInfo::ParseStream(EPARAMETER_DIRECTION a_eDirection, void* a_pStream)
-{
-       if(m_pParams[a_eDirection] == NULL) {
-               m_pParams[a_eDirection] = new ipcEmailParamList();
-       }
-
-       ParseAPIID(a_pStream);
-       ParseResponseID(a_pStream);
-       ParseAPPID(a_pStream);
-       return m_pParams[a_eDirection]->ParseStream(a_pStream);
-}
-
-void* ipcEmailAPIInfo::GetStream(EPARAMETER_DIRECTION a_eDirection)
-{
-
-       if(m_pParams[a_eDirection] == NULL) {
-               m_pParams[a_eDirection] = new ipcEmailParamList();
-       }
-
-       unsigned char* pStream = (unsigned char*)m_pParams[a_eDirection]->GetStream();
-       if ( pStream != NULL ) {
-               memcpy(pStream, (void*)&m_nAPIID, sizeof(m_nAPIID));
-               memcpy(pStream+(sizeof(long)*eSTREAM_RESID), (void*)&m_nResponseID, sizeof(m_nResponseID));
-               memcpy(pStream+(sizeof(long)*eSTREAM_APPID), (void*)&m_nAPPID, sizeof(m_nAPPID));
-       }
-
-       return (void*)pStream;
-}
-
-int ipcEmailAPIInfo::GetStreamLength(EPARAMETER_DIRECTION a_eDirection)
-{
-       if(m_pParams[a_eDirection] == NULL)
-               return 0;
-
-       return m_pParams[a_eDirection]->GetStreamLength();
-}
-
-void* ipcEmailAPIInfo::GetParameters(EPARAMETER_DIRECTION a_eDirection)
-{
-       if(m_pParams[a_eDirection] == NULL) {
-               m_pParams[a_eDirection] = new ipcEmailParamList();
-       }
-       return m_pParams[a_eDirection];
-}
-
-
-long ipcEmailAPIInfo::ParseAPIID(void* a_pStream)
-{
-       m_nAPIID = *((long*)a_pStream + eSTREAM_APIID);
-       return m_nAPIID;
-}
-
-long ipcEmailAPIInfo::ParseResponseID(void* a_pStream)
-{
-       m_nResponseID = *((long*)a_pStream + eSTREAM_RESID);
-       return m_nResponseID;
-}
-
-
-long ipcEmailAPIInfo::ParseAPPID(void* a_pStream)
-{
-       m_nAPPID = *((long*)a_pStream + eSTREAM_APPID);
-       return m_nAPPID;
-
-}
diff --git a/ipc/api/ipc-param-list.cpp b/ipc/api/ipc-param-list.cpp
deleted file mode 100755 (executable)
index 074ce23..0000000
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-#include <string.h>
-#include <stdlib.h>
-#include "ipc-library-build.h"
-#include "ipc-param-list.h"
-
-
-ipcEmailParamList::ipcEmailParamList()
-{
-       EM_DEBUG_FUNC_BEGIN();
-       m_nParamCount = 0;
-       m_pbyteStream = NULL;
-}
-
-ipcEmailParamList::~ipcEmailParamList()
-{
-       EM_DEBUG_FUNC_BEGIN();
-       EM_SAFE_FREE(m_pbyteStream);
-       EM_DEBUG_FUNC_END();
-}
-
-/*  stream */
-/*  +----------------------------------------------------------------------------------------------------------+ */
-/*  | API ID(4B) | Resp. ID (4B) | Param Count(4B) | Param1 Len | Param1 Data | ... | ParamN Len | ParamN data |  */
-/*  +----------------------------------------------------------------------------------------------------------+ */
-bool ipcEmailParamList::ParseStream(void* a_pStreamData)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       long nParameterCount = ParseParameterCount(a_pStreamData);
-       if(nParameterCount <= 0) {
-               EM_DEBUG_EXCEPTION("There is no parameter. ");
-               return false;
-       }
-
-       unsigned char* pStream = (unsigned char*)a_pStreamData;
-       long nIndex, nParamLen, nPos = sizeof(long)*eSTREAM_DATA;
-/*     _pal_ITrace_IPCPrintF("[IPCLib] Parameter Count [%x]  ", nParameterCount); */
-
-       for(nIndex = 0; nIndex < nParameterCount; nIndex++) {
-/*             unsigned char szLen[5] = {NULL,}; */
-/*             memcpy(szLen, pStream+nPos, sizeof(long)); */
-/*             nParamLen = *(long*)(szLen); */
-
-               long nLen =0;
-               memcpy(&nLen, pStream+nPos, sizeof(long));
-               nParamLen = nLen;
-               EM_DEBUG_LOG("Parameter Length [%d] : %d ", nIndex, nParamLen);
-               nPos += sizeof(long);   /*  Move from length position to data position */
-
-               AddParam((void*)(pStream+nPos), nParamLen);
-               nPos += nParamLen;              /*  move to next parameter       */
-       }
-       
-       return true;
-}
-
-void* ipcEmailParamList::GetStream()
-{
-       EM_DEBUG_FUNC_BEGIN();
-       if(m_pbyteStream)
-               return m_pbyteStream;
-       
-       int nStreamLen = GetStreamLength();
-       
-       if ( nStreamLen > 0 )  {
-               m_pbyteStream = (unsigned char*) calloc(1, nStreamLen);
-               int nPos = sizeof(long)*eSTREAM_COUNT;
-
-               if ( nPos + (int)sizeof(m_nParamCount) > nStreamLen ) {
-                       EM_DEBUG_EXCEPTION("%d > nStreamLen", nPos + sizeof(m_nParamCount));                    
-                       EM_SAFE_FREE(m_pbyteStream);
-                       return NULL;
-               }
-               
-               memcpy((void*)(m_pbyteStream+nPos), (void*)&m_nParamCount, sizeof(m_nParamCount));
-               
-               nPos += sizeof(long);
-               int nIndex = 0, nLength = 0;
-
-               /*   check memory overflow */
-               for(nIndex=0; nIndex<m_nParamCount; nIndex++) {
-                       nLength = m_lstParams[nIndex].GetLength();
-                       if ( nLength <= 0 ) {
-                               EM_DEBUG_EXCEPTION("nLength = %d", nIndex, nLength);                    
-                               EM_SAFE_FREE(m_pbyteStream);
-                               return NULL;
-                       }
-
-                       if ( nPos + (int)sizeof(long) > nStreamLen ) {
-                               EM_DEBUG_EXCEPTION("%d > nStreamLen", nPos + sizeof(long));                     
-                               EM_SAFE_FREE(m_pbyteStream);
-                               return NULL;
-                       }
-                       memcpy((void*)(m_pbyteStream+nPos), (void*)&nLength, sizeof(long));
-                       nPos += sizeof(long);
-
-                       if ( nPos + nLength > nStreamLen ) {
-                               EM_DEBUG_EXCEPTION("%d > nStreamLen", nPos + nLength);                  
-                               EM_SAFE_FREE(m_pbyteStream);
-                               return NULL;
-                       }
-                       
-                       memcpy((void*)(m_pbyteStream+nPos), (void*)m_lstParams[nIndex].GetData(), nLength);
-                       nPos += nLength;
-               }
-               return (void*)m_pbyteStream;
-       }
-       
-       EM_DEBUG_EXCEPTION("failed.");                  
-       EM_SAFE_FREE(m_pbyteStream);
-
-       EM_DEBUG_FUNC_END();
-       return NULL;
-}
-
-
-int ipcEmailParamList::GetStreamLength()
-{
-       /* if(m_lstParams ) // prevent 20071030 : m_lstParams is array */ {
-               int nLength = sizeof(long)*eSTREAM_DATA;        /* API ID, Response ID, Param count */
-               int nIndex;
-               for(nIndex=0; nIndex<m_nParamCount; nIndex++) {
-                       nLength += sizeof(long);                                        /* Length size */
-                       nLength += m_lstParams[nIndex].GetLength();     /* data size */
-               }
-               return nLength;
-       }
-       return 0;       
-}
-
-bool ipcEmailParamList::AddParam(void* a_pData, int a_nLen)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       
-       if(m_lstParams[m_nParamCount].SetParam(a_pData, a_nLen)) {
-               m_nParamCount++;
-               EM_SAFE_FREE(m_pbyteStream);
-               return true;
-       }
-
-       return false;
-       
-}
-
-void* ipcEmailParamList::GetParam(int a_nIndex)
-{
-       EM_DEBUG_FUNC_BEGIN("a_nIndex [%d]", a_nIndex);
-       if(a_nIndex < 0 || a_nIndex >= m_nParamCount) {
-               EM_DEBUG_EXCEPTION("Index value is not valid ");
-               return NULL;
-       }
-
-       return (void*)m_lstParams[a_nIndex].GetData();
-}
-
-int ipcEmailParamList::GetParamLen(int a_nIndex)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       if(a_nIndex < 0 || a_nIndex >= m_nParamCount) {
-               EM_DEBUG_EXCEPTION("Index value is not valid ");
-               return 0;
-       }
-       
-       return m_lstParams[a_nIndex].GetLength();
-}
-
-int ipcEmailParamList::GetParamCount()
-{
-       EM_DEBUG_FUNC_BEGIN("Paramter count [%d]  ", m_nParamCount);
-       return m_nParamCount;
-}
-
-long ipcEmailParamList::ParseParameterCount(void *a_pStream)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       long *pParameterCountPostion = (long*)a_pStream + eSTREAM_COUNT;
-
-       return *pParameterCountPostion;
-}
-
diff --git a/ipc/common/cm-list.cpp b/ipc/common/cm-list.cpp
deleted file mode 100755 (executable)
index 43959c0..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-#include <stdio.h>
-#include "cm-list.h"
-#include "ipc-queue.h"
-#include "ipc-library-build.h"
-
-cmList::cmList()
-{
-       m_pHead = NULL;
-       m_pTail = NULL;
-       m_nCount = 0;
-}
-
-cmList::~cmList()
-{
-}
-
-bool cmList::AddTail(void* a_pData)
-{
-       if(!a_pData)
-               return false;
-
-       ipcEmailQueueItem *pItem = new ipcEmailQueueItem(a_pData);
-       if(!pItem)
-               return false;
-
-       if(m_pTail) {
-               m_pTail->m_pNext = pItem;
-               m_pTail = pItem;
-       } else {
-               m_pHead = m_pTail = pItem;
-       }
-       
-       m_nCount++;
-       
-       return true;
-}
-
-bool cmList::RemoveItem(void* a_pData)
-{
-       if(m_pHead) {
-               ipcEmailQueueItem *pItem = m_pHead;
-               ipcEmailQueueItem *pPrevItem = NULL;
-               int nIndex = 0;
-               for(nIndex = 0; nIndex < m_nCount; nIndex++) {
-                       if(pItem->m_pData == a_pData) {
-                               if(pPrevItem) {
-                                       pPrevItem->m_pNext = pItem->m_pNext;
-
-                                       if(pItem->m_pNext == NULL)      /*  TailÀ» Áö¿ì´Â °æ¿ì */
-                                               m_pTail = pPrevItem;    /*  TailÀ» ¹Ù·Î ÀÌÀü °ÍÀ¸·Î ¼³Á¤ */
-                               } else  /*  Head¸¦ Áö¿ì´Â °æ¿ì */ {
-                                       m_pHead = m_pHead->m_pNext;
-
-                                       if(m_pHead == NULL)     /*  ´Ù Áö¿öÁ³À¸¸é Tailµµ NULL·Î ÃʱâÈ­ */
-                                               m_pTail = NULL;
-                               }
-       
-                               delete pItem;
-                               pItem = NULL;
-                               m_nCount--;
-                               return true;
-                       }
-                       pPrevItem = pItem; /*  prevent 20071030 */
-                       pItem = pItem->m_pNext;
-               }
-       }
-       return false;
-}
-
-void* cmList::GetAt(int a_nIndex)
-{
-       if(m_pHead) {
-               ipcEmailQueueItem *pItem = m_pHead;
-               int nIndex = 0;
-               for(nIndex = 0; nIndex < a_nIndex; nIndex++) {
-                       pItem = pItem->m_pNext;
-               }
-               
-               if(pItem) {
-                       return pItem->m_pData;
-               }
-       }
-       return NULL;
-}
-
-int cmList::GetCount()
-{
-       return m_nCount;
-}
-
-
diff --git a/ipc/common/cm-sys-msg-queue.cpp b/ipc/common/cm-sys-msg-queue.cpp
deleted file mode 100755 (executable)
index 1adefd1..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-#include <string.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include "cm-sys-msg-queue.h"
-#include "ipc-library-build.h"
-
-cmSysMsgQueue::cmSysMsgQueue(int a_nMsgType)
-{
-       m_nMsgType = a_nMsgType;
-       m_pSendBuf = NULL;
-       m_pRecvBuf = NULL;      
-       m_nMsgqid = -1;
-       m_pSendBuf = (ipcMsgbuf * )malloc(sizeof(ipcMsgbuf));
-       m_pRecvBuf = (ipcMsgbuf * )malloc(sizeof(ipcMsgbuf));
-}
-
-cmSysMsgQueue::~cmSysMsgQueue()
-{
-       if(m_pSendBuf) {
-               free(m_pSendBuf);
-               m_pSendBuf = NULL;
-       }
-       if(m_pRecvBuf) {
-               free(m_pRecvBuf);
-               m_pRecvBuf = NULL;
-       }
-       
-}
-
-void cmSysMsgQueue::MsgCreate()
-{
-       EM_DEBUG_FUNC_BEGIN();
-       key_t key = (key_t)640;/* (key_t)a_nKey; */
-       
-       /* if ((m_nMsgqid = msgget(key, IPC_CREAT | IPC_EXCL | 0640)) == -1)  */
-       if ((m_nMsgqid = msgget(key, IPC_CREAT | IPC_EXCL | 0777)) == -1) /*  Security Issue - DAC */ {
-               m_nMsgqid = msgget(key, 1);
-
-               /* ±âÁ¸ÀÇ ¸Þ¼¼Áö Å¥°¡ Á¸ÀçÇÑ´Ù¸é ÀÏ´Ü Áö¿ì°í ´Ù½Ã »ý¼ºÇÑ´Ù. */
-               if(errno == EEXIST) {
-                       EM_DEBUG_LOG("Message Queue Exist ");
-                       /* msgctl(m_nMsgqid, IPC_RMID, (struct msqid_ds *)NULL);  */
-                       /* m_nMsgqid = msgget(key, IPC_CREAT | IPC_EXCL | 0640); */
-                       EM_DEBUG_LOG("===================================================== ");
-                       EM_DEBUG_LOG("[cmSysMsgQueue::MsgCreate][EXIST]");
-                       EM_DEBUG_LOG("=====================================================");
-               }
-       } 
-       EM_DEBUG_LOG("=====================================================");
-       EM_DEBUG_LOG("[cmSysMsgQueue::MsgCreate][msggid = %d]", m_nMsgqid);
-       EM_DEBUG_LOG("=====================================================");
-       
-}
-int cmSysMsgQueue::MsgSnd(void *a_pMsg, int a_nSize, long a_nType)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       memset(m_pSendBuf, 0x00, sizeof(ipcMsgbuf));
-       m_pSendBuf->mtype = a_nType;
-       memcpy(m_pSendBuf->mtext, a_pMsg, a_nSize);
-       int nRet;
-       EM_DEBUG_LOG("===========================================================");
-       EM_DEBUG_LOG("[cmSysMsgQueue::MsgSnd][m_nMsgqid = %d]", m_nMsgqid);
-       EM_DEBUG_LOG("[cmSysMsgQueue::MsgSnd][a_nSize = %d]", a_nSize);
-       EM_DEBUG_LOG("[cmSysMsgQueue::MsgSnd][a_nType = %d]", a_nType);
-       EM_DEBUG_LOG("===========================================================");
-       nRet = msgsnd(m_nMsgqid, m_pSendBuf, IPC_MSGQ_SIZE, 0);         /*  0 °ª ¸»°í IPC_NOWAIT */
-
-       EM_DEBUG_LOG("=====================================================");
-       EM_DEBUG_LOG("[cmSysMsgQueue::MsgSnd][ret = %d]", nRet);
-       EM_DEBUG_LOG("=====================================================");
-       return nRet;
-}
-
-int cmSysMsgQueue::MsgRcv(void *a_pMsg, int a_nSize)
-{
-       int nRet;
-       EM_DEBUG_LOG("===========================================================");
-       EM_DEBUG_LOG("[cmSysMsgQueue::MsgRcv][m_nMsgqid = %d]", m_nMsgqid);
-       EM_DEBUG_LOG("[cmSysMsgQueue::MsgRcv][m_nMsgType = %d]", m_nMsgType);
-       EM_DEBUG_LOG("===========================================================");
-       nRet = msgrcv(m_nMsgqid, m_pRecvBuf, IPC_MSGQ_SIZE, m_nMsgType, 0);
-       if (nRet == -1) {       EM_DEBUG_LOG("===========================================================");
-               EM_DEBUG_LOG("[cmSysMsgQueue::MsgRcv][FAIL]");
-               EM_DEBUG_LOG("[cmSysMsgQueue::MsgRcv][error:=%d][errorstr =%s]", errno, strerror(errno));
-               EM_DEBUG_LOG("===========================================================");
-       }
-       memcpy(a_pMsg, m_pRecvBuf->mtext, a_nSize);
-       EM_DEBUG_LOG("=====================================================");
-       EM_DEBUG_LOG("[cmSysMsgQueue::MsgRcv][ret = %d][mtype = %x][Size = %d]", nRet, m_nMsgType, a_nSize);
-       EM_DEBUG_LOG("=====================================================");
-       return nRet;
-}
-
-bool cmSysMsgQueue::MsgDestroy()
-{
-       if(msgctl(m_nMsgqid, IPC_RMID, NULL) == -1)
-               return false;
-       
-       
-       EM_DEBUG_LOG("=====================================================");
-       EM_DEBUG_LOG("[cmSysMsgQueue][MsgDestroy]");
-       EM_DEBUG_LOG("=====================================================");
-       return true;
-}
-
diff --git a/ipc/common/include/cm-sys-msg-queue.h b/ipc/common/include/cm-sys-msg-queue.h
deleted file mode 100755 (executable)
index aabde81..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-#ifndef _IPC_MESSAGE_Q_H_
-#define _IPC_MESSAGE_Q_H_
-#include <sys/ipc.h>
-#include <sys/msg.h>
-#include <errno.h>
-
-#include "emf-dbglog.h"
-#define IPC_MSGQ_SIZE 512
-
-typedef struct {
-       long mtype;                                     /* type of message ¸Þ¼¼Áö Å¸ÀÔ */
-       char mtext[IPC_MSGQ_SIZE];      /* message text ¸Þ¼¼Áö ³»¿ë */
-}ipcMsgbuf;
-
-class cmSysMsgQueue
-{
-public:
-       cmSysMsgQueue(int a_nMsgType);
-       virtual ~ cmSysMsgQueue();
-
-private:
-       int             m_nMsgType;
-       /* key_t                m_nKey; */ /*CID = 17033 BU not used */
-       long            m_nMsgqid;
-       ipcMsgbuf       *m_pSendBuf;
-       ipcMsgbuf       *m_pRecvBuf;
-       
-public:
-       void MsgCreate();
-       int MsgSnd(void *a_pMsg, int a_nSize, long a_nType);
-       int MsgRcv(void *a_pMsg, int a_nSize);
-       bool MsgDestroy();
-
-};
-
-#endif /* _IPC_MESSAGE_Q_H_ */
-
-
-
-
diff --git a/ipc/ipc-library-api.cpp b/ipc/ipc-library-api.cpp
deleted file mode 100755 (executable)
index 12ae808..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-
-#include "include/ipc-library-build.h"
-#include "include/ipc-library.h"
-#include "proxy/include/ipc-proxy-main.h"
-#include "api/include/ipc-api-info.h"
-#include "api/include/ipc-param-list.h"
-#include "socket/include/ipc-socket.h"
-#include "emf-dbglog.h"
-
-EXPORT_API ipcEmailParamList* _ipcAPI_GetParameters(HIPC_API a_hAPI, EPARAMETER_DIRECTION a_eDirection)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       ipcEmailAPIInfo *pAPI = (ipcEmailAPIInfo*)a_hAPI;
-       if(pAPI) {
-               return (ipcEmailParamList*)pAPI->GetParameters(a_eDirection);
-       }
-       return 0;
-}
-
-EXPORT_API HIPC_API ipcEmailAPI_Create(long a_nAPIID)
-{
-
-       EM_DEBUG_FUNC_BEGIN();
-
-       ipcEmailAPIInfo *pApi = new ipcEmailAPIInfo();
-       if(pApi == NULL) {
-               return NULL;
-       }
-
-       pApi->SetAPIID(a_nAPIID);
-       return (HIPC_API)pApi;
-}
-
-EXPORT_API void ipcEmailAPI_Destroy(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN("a_hAPI = %p", a_hAPI);
-       ipcEmailAPIInfo *pAPI = (ipcEmailAPIInfo*)a_hAPI;
-       if(pAPI) {
-               delete pAPI;
-       }
-}
-
-
-EXPORT_API long ipcEmailAPI_GetAPIID(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       ipcEmailAPIInfo *pAPI = (ipcEmailAPIInfo*)a_hAPI;
-       if(pAPI) {
-               return pAPI->GetAPIID();
-       }
-       return -1;
-}
-
-
-EXPORT_API long ipcEmailAPI_GetAPPID(HIPC_API a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       ipcEmailAPIInfo *pAPI = (ipcEmailAPIInfo*)a_hAPI;
-       if(pAPI) {
-               return pAPI->GetAPPID();
-       }
-       return -1;
-}
-
-EXPORT_API bool ipcEmailAPI_AddParameter(HIPC_API a_hAPI, EPARAMETER_DIRECTION a_eDirection, void *a_pData, int a_nDataLength)
-{
-       EM_DEBUG_FUNC_BEGIN();
-
-       ipcEmailParamList *pParameters = _ipcAPI_GetParameters(a_hAPI, a_eDirection);
-
-       if(pParameters) {
-               pParameters->AddParam(a_pData, a_nDataLength);
-               return true;
-       }
-       return false;
-}
-
-EXPORT_API int ipcEmailAPI_GetParameterCount(HIPC_API a_hAPI, EPARAMETER_DIRECTION a_eDirection)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       
-       ipcEmailParamList *pParameters = _ipcAPI_GetParameters(a_hAPI, a_eDirection);
-       if(pParameters) {
-               return pParameters->GetParamCount();
-       }
-       return -1;
-}
-
-EXPORT_API void* ipcEmailAPI_GetParameter(HIPC_API a_hAPI, EPARAMETER_DIRECTION a_eDirection, int a_nParameterIndex)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       ipcEmailParamList *pParameters = _ipcAPI_GetParameters(a_hAPI, a_eDirection);
-
-       if(pParameters) {
-               EM_DEBUG_FUNC_END("Suceeded");
-               return pParameters->GetParam(a_nParameterIndex);
-       }
-       EM_DEBUG_FUNC_END("Failed");
-       return 0;
-}
-
-EXPORT_API int ipcEmailAPI_GetParameterLength(HIPC_API a_hAPI, EPARAMETER_DIRECTION a_eDirection, int a_nParameterIndex)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       ipcEmailParamList *pParameters = _ipcAPI_GetParameters(a_hAPI, a_eDirection);
-       if(pParameters) {
-               EM_DEBUG_FUNC_END("Suceeded");
-               return pParameters->GetParamLen(a_nParameterIndex);
-       }
-       EM_DEBUG_FUNC_END("Failed");
-       return -1;
-}
-
-
-
-
-
diff --git a/ipc/proxy/include/ipc-proxy-main.h b/ipc/proxy/include/ipc-proxy-main.h
deleted file mode 100755 (executable)
index 268d2a2..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-
-#ifndef        _IPC_PROXY_MAIN_H_
-#define        _IPC_PROXY_MAIN_H_
-
-#include "ipc-library.h"
-#include <pthread.h>
-#include "cm-list.h"
-#include "cm-sys-msg-queue.h"
-#include "ipc-api-info.h"
-#include "ipc-proxy-socket.h"
-#include "ipc-callback-info.h"
-#include "emf-mutex.h"
-
-
-class ipcEmailProxyMain
-{
-public:
-       ipcEmailProxyMain();
-       virtual ~ipcEmailProxyMain();
-
-private:
-       static ipcEmailProxyMain* s_pThis;
-       int                                     m_nReference;
-       ipcEmailProxySocket                *m_pSyncSocket;
-       bool                                          m_bRecvStopFlag;
-       cmSysMsgQueue                    *m_pProxyMessageQ;
-       int                                           m_nAPPID;
-       Mutex                       mx;
-
-private:
-       bool RegisterTask(ipcEmailAPIInfo *a_pApiInfo);
-
-public:
-       
-       static ipcEmailProxyMain* Instance();
-       static void FreeInstance();
-       int Initialize();
-       int Finalize();
-       bool ExecuteAPI(ipcEmailAPIInfo* pApi);
-       bool Dispatch();
-
-};     
-#endif/* _IPC_PROXY_MAIN_H_ */
-
diff --git a/ipc/proxy/ipc-proxy-main.cpp b/ipc/proxy/ipc-proxy-main.cpp
deleted file mode 100755 (executable)
index 7490033..0000000
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-
-#include <unistd.h>
-#include "ipc-library-build.h"
-#include "ipc-proxy-main.h"
-#include "emf-types.h"
-
-ipcEmailProxyMain* ipcEmailProxyMain::s_pThis = NULL;
-
-ipcEmailProxyMain::ipcEmailProxyMain() : mx()
-{
-       EM_DEBUG_FUNC_BEGIN();
-       m_pSyncSocket = NULL;
-       m_pProxyMessageQ = NULL;
-       m_bRecvStopFlag = false;
-       m_nReference = 0;
-       m_nAPPID = 0;
-       EM_DEBUG_FUNC_END();
-}
-
-ipcEmailProxyMain::~ipcEmailProxyMain()
-{
-       EM_DEBUG_FUNC_BEGIN();
-       EM_DEBUG_FUNC_END();
-}
-
-ipcEmailProxyMain* ipcEmailProxyMain::Instance()
-{
-       EM_DEBUG_FUNC_BEGIN();
-       if(s_pThis)
-               return s_pThis;
-
-       s_pThis = new ipcEmailProxyMain();
-
-       EM_DEBUG_FUNC_END();
-       return s_pThis;
-}
-
-void ipcEmailProxyMain::FreeInstance()
-{
-       EM_DEBUG_FUNC_BEGIN();
-       
-       if(s_pThis) {
-               s_pThis->Finalize();
-               delete s_pThis;
-               s_pThis = NULL;
-       }
-       EM_DEBUG_FUNC_END();
-}
-
-int ipcEmailProxyMain::Initialize()
-{
-       EM_DEBUG_FUNC_BEGIN();
-
-       if (m_nReference > 0) {
-               EM_DEBUG_EXCEPTION("Already Initialized m_nReference[%d]", m_nReference);
-               return EMF_ERROR_NONE;
-       }
-       
-       m_nReference++;
-
-       m_pSyncSocket = new ipcEmailProxySocket();
-
-       if(!m_pSyncSocket) {
-               EM_DEBUG_EXCEPTION("m_pSyncSocket == NULL");
-               return EMF_ERROR_IPC_SOCKET_FAILURE;
-       }
-       
-       if( m_pSyncSocket->Start() != EMF_SUCCESS ) {
-               EM_DEBUG_EXCEPTION("Socket start FAILs");
-               return EMF_ERROR_IPC_CONNECTION_FAILURE;
-       }
-
-       EM_DEBUG_LOG("Socket ID : %x", m_pSyncSocket->GetSocketID());
-       EM_DEBUG_FUNC_END();
-       return EMF_ERROR_NONE;
-}
-
-int ipcEmailProxyMain::Finalize()
-{
-       EM_DEBUG_FUNC_BEGIN();
-       
-       if (--m_nReference > 0) {
-               EM_DEBUG_EXCEPTION("More than one reference m_nReference[%d]",m_nReference);
-               return EMF_ERROR_NONE;
-       }
-
-       if(m_pSyncSocket) {
-               delete m_pSyncSocket;
-               m_pSyncSocket = NULL;
-       }
-       
-       if(m_pProxyMessageQ) {
-               delete m_pProxyMessageQ;
-               m_pProxyMessageQ = NULL;
-       }
-       EM_DEBUG_FUNC_END();
-       return EMF_ERROR_NONE;
-}
-
-
-bool ipcEmailProxyMain::ExecuteAPI(ipcEmailAPIInfo* a_hAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-
-       if(!a_hAPI) {
-               EM_DEBUG_EXCEPTION("Invalid Parameter");
-               return false;
-       }
-       
-       int nRet;
-       char* pInStream = (char*)a_hAPI->GetStream(ePARAMETER_IN);
-       int nLength = a_hAPI->GetStreamLength(ePARAMETER_IN);
-       bool result = false;
-       int sending_bytes;
-
-       mx.lock();
-       sending_bytes = m_pSyncSocket->Send(pInStream, nLength);
-       mx.unlock();
-       
-       EM_DEBUG_LOG("Proxy=>Stub Sending %dB.", sending_bytes);
-
-       if( sending_bytes > 0 ) {
-#ifdef IPCLIB_STREAM_TRACE_ON  
-               int index;
-               for(index=0; index< nLength; index++)
-                       EM_DEBUG_LOG("pInStream[index] : [%x]", pInStream[index]);
-#endif 
-
-               char* ipc_buf = NULL;
-
-               /* now waiting for response from email-service */
-               mx.lock();
-               nRet = m_pSyncSocket->Recv(&ipc_buf);
-               mx.unlock();
-               EM_DEBUG_LOG("Recv length : %d", nRet);
-
-               if (nRet > 0)
-                       result = a_hAPI->ParseStream(ePARAMETER_OUT, ipc_buf);
-               else
-                       result = false;
-
-               if(ipc_buf)
-                       delete []ipc_buf;
-       }
-
-       EM_DEBUG_FUNC_END();
-       return result;
-}
-
-bool ipcEmailProxyMain::Dispatch()
-{
-       EM_DEBUG_FUNC_BEGIN();
-       
-       unsigned char pStream[IPC_MSGQ_SIZE];
-       
-       while(!m_bRecvStopFlag) {
-               memset(pStream, 0x00, sizeof(pStream));
-               
-               if(m_pProxyMessageQ->MsgRcv(pStream, sizeof(pStream))>0) {
-                       ipcEmailAPIInfo *pAPIInfo = new ipcEmailAPIInfo();
-                       int nAPIID = *((int*)pStream);
-                       
-                       pAPIInfo->SetAPIID(nAPIID);
-                       pAPIInfo->ParseStream(ePARAMETER_OUT, pStream);
-                       EM_DEBUG_LOG("Proxy Message Queue Recv [APIID=%x], [RecvLen=%d]", nAPIID, pAPIInfo->GetStreamLength(ePARAMETER_OUT));
-
-#ifdef IPCLIB_STREAM_TRACE_ON          
-                       int index;
-                       for(index=0; index< pAPIInfo->GetStreamLength(ePARAMETER_OUT); index++)
-                               EM_DEBUG_LOG("[%x]", pStream[index]);
-#endif
-               }
-               usleep(1000);   
-       }
-       EM_DEBUG_FUNC_END();
-       return false;
-}
diff --git a/ipc/proxy/ipc-proxy-socket.cpp b/ipc/proxy/ipc-proxy-socket.cpp
deleted file mode 100755 (executable)
index 44507a9..0000000
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-
-#include <unistd.h>
-#include <sys/select.h>
-#include "ipc-library-build.h"
-#include "ipc-proxy-socket.h"
-
-ipcEmailProxySocket::ipcEmailProxySocket()
-{
-       EM_DEBUG_FUNC_BEGIN();
-       memset(&fds_read, 0, sizeof(fd_set));/*  CID = 17042 BU */
-       m_pSocket = NULL;       
-}
-
-ipcEmailProxySocket::~ipcEmailProxySocket()
-{
-       EM_DEBUG_FUNC_BEGIN();
-       End();
-}
-
-int ipcEmailProxySocket::Start()
-{
-       EM_DEBUG_FUNC_BEGIN();
-       m_pSocket = new ipcEmailSocket();
-
-       if(m_pSocket) {
-               return m_pSocket->Connect();
-       }
-       
-       return -1;
-}
-
-bool ipcEmailProxySocket::End()
-{
-       EM_DEBUG_FUNC_BEGIN();  
-       EM_DEBUG_LOG("[IPCLib] ipcEmailProxySocket::End ");
-
-       if(m_pSocket) {
-               m_pSocket->Close(); /*  prevent 20071030 */
-               delete(m_pSocket);
-               m_pSocket = NULL;
-       }
-
-       return true;
-}
-
-int ipcEmailProxySocket::Send(char* pData , int a_nLen)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       if(m_pSocket && m_pSocket->IsConnected()) {
-               return m_pSocket->Send(m_pSocket->GetSocketID(), pData, a_nLen);
-       } else {
-               EM_DEBUG_EXCEPTION("[IPCLib] ipcEmailProxySocket not connect");
-               /* m_pSocket->Connect(); */
-               return 0;
-       }
-}
-
-int ipcEmailProxySocket::GetSocketID()
-{
-       EM_DEBUG_FUNC_BEGIN();
-       if(m_pSocket)
-               return m_pSocket->GetSocketID();
-
-       return 0;
-}
-
-
-int ipcEmailProxySocket::Recv(char** pData)
-{
-       EM_DEBUG_FUNC_BEGIN();
-
-
-       int nRecvLen = 0;
-
-       if(m_pSocket /*&& m_pSocket->IsConnected()*/)
-               nRecvLen = m_pSocket->Recv(m_pSocket->GetSocketID(), pData); else {
-               EM_DEBUG_EXCEPTION("[IPCLib] m_pSocket[%p] is not available or disconnected", m_pSocket);
-               return 0;
-       }
-
-       if( nRecvLen == 0 ) {
-               EM_DEBUG_EXCEPTION("[IPCLib] Proxy Recv delete %x", m_pSocket->GetSocketID());
-               m_pSocket->Close();
-       } else if(nRecvLen == -1) {
-               EM_DEBUG_EXCEPTION("[IPCLib] Proxy Recv error");
-       }
-
-       return nRecvLen;
-/*
-       int ret_select;
-       fd_set fds_buf;
-       int nRecvLen = -2, timeout_count = 0;
-       struct timeval timeout;
-
-       while(1) {
-               fds_buf = fds_read;
-
-               FD_ZERO(&fds_buf);
-
-               FD_SET(m_pSocket->GetSocketID(), &fds_buf);
-               timeout.tv_sec = 0;             
-               timeout.tv_usec = 1000000;      
-               ret_select = select(m_pSocket->GetSocketID()+1, &fds_buf, NULL, NULL, &timeout);
-
-               if(ret_select == -1) {
-                       EM_DEBUG_EXCEPTION("[IPCLib] Proxy select error");
-                       break;
-               } else if(ret_select ==  0) {
-                       EM_DEBUG_EXCEPTION("[IPCLib] Proxy select timeout");
-                       
-                       if(timeout_count++ > 10) {
-                               EM_DEBUG_EXCEPTION("[IPCLib] exit from select loop");
-                               break;
-                       }
-                       continue;
-               }
-               
-               if(FD_ISSET(m_pSocket->GetSocketID(), &fds_buf)) {
-                       nRecvLen = m_pSocket->Recv(m_pSocket->GetSocketID(), pData);
-                       if(nRecvLen > 0) {
-                               EM_DEBUG_LOG("[IPCLib] Proxy Recv[fd = %x], [nRecvLen = %d]", m_pSocket->GetSocketID(), nRecvLen);
-                               break;
-                       }
-                       else if(nRecvLen == 0) {
-                               EM_DEBUG_EXCEPTION("[IPCLib] Proxy Recv delete %x", m_pSocket->GetSocketID());
-                               m_pSocket->Close();
-                               break;
-                       }
-                       else if(nRecvLen == -1) {
-                               EM_DEBUG_EXCEPTION("[IPCLib] Proxy Recv error");
-                               break;
-                       }
-               }
-
-       }
-*/
-       return nRecvLen;
-       
-}
diff --git a/ipc/socket/ipc-socket.cpp b/ipc/socket/ipc-socket.cpp
deleted file mode 100755 (executable)
index c2a4a83..0000000
+++ /dev/null
@@ -1,353 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-#include "ipc-socket.h"
-#include "ipc-library-build.h"
-#include "emf-dbglog.h"
-#include "emf-types.h"
-
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <errno.h>
-#include <unistd.h>
-#include <errno.h>
-
-/*  Constructor */
-ipcEmailSocket::ipcEmailSocket() : maxfd(-1)
-{
-       m_sockfd = socket(AF_UNIX, SOCK_STREAM, 0);
-
-       EM_DEBUG_LOG("fd = %d", m_sockfd);
-
-       if (m_sockfd < 0)  {
-               EM_DEBUG_LOG("socket creation fails!!!: %s", strerror(errno));
-       }
-
-       FD_ZERO(&fds);
-}
-
-/*  Destructor */
-ipcEmailSocket::~ipcEmailSocket()
-{
-       FD_ZERO(&fds);
-       mapFds.clear();
-       EM_DEBUG_LOG("socket object is destoryed");
-}
-
-/*  Close */
-void ipcEmailSocket::Close()
-{
-       close(m_sockfd);
-       m_sockfd = 0;
-       m_bConnect = false;
-       EM_DEBUG_LOG("sockfd = [%d] is closed", m_sockfd);
-}
-
-void ipcEmailSocket::Close(int fd)
-{
-       EM_DEBUG_FUNC_BEGIN("fd [%d]",fd);
-
-       if (fd == -1)  {
-               EM_DEBUG_LOG("server_socket not init");
-               return;
-       }
-       
-       EM_DEBUG_LOG("%d to be removed", fd);
-       FD_CLR(fd, &fds);
-
-       std::map<int, int>::iterator it = mapFds.find(fd);
-       if(it == mapFds.end()) {
-               EM_DEBUG_LOG("No matching socket fd [%d]", fd);
-               return;
-       } else
-               mapFds.erase(it);
-
-       if ( fd == maxfd ) {
-               int newmax = 0;
-               for( it = mapFds.begin() ; it != mapFds.end() ; it++ )
-                       newmax = (it->second > newmax )? it->second : newmax; 
-               maxfd = newmax;
-       }
-       EM_DEBUG_LOG("fd %d removal done", fd);
-       ::close(fd);
-       EM_DEBUG_FUNC_END();
-}
-
-bool ipcEmailSocket::IsConnected()
-{
-       return m_bConnect;
-}
-
-int ipcEmailSocket::writen (int fd, const char *buf, int len)
-{
-       int nleft, nwrite;
-
-       nleft = len;
-       while( nleft > 0 )  {
-               nwrite = ::send(fd, (const void*) buf, nleft, MSG_NOSIGNAL);
-/*             nwrite = ::write(fd, (const void*) buf, nleft); */
-               if( nwrite == -1 )  {
-                       EM_DEBUG_LOG("write: %s", EM_STRERROR(errno));
-                       if (errno == EINTR) continue;
-                       return nwrite;
-               } else if ( nwrite == 0 ) 
-                       break;
-               
-               nleft -= nwrite;
-               buf += nwrite;
-       }
-       return (len-nleft);
-}
-
-int ipcEmailSocket::Send(int fd, char* buffer, int buf_len)
-{
-       EM_DEBUG_FUNC_BEGIN("fd [%d], buffer [%p], buf_len [%d]", fd, buffer, buf_len);
-
-       if( !buffer ) {
-               EM_DEBUG_EXCEPTION("No data to send");
-               return 0;
-       }
-
-       /*
-       if(!IsConnected()) {
-               EM_DEBUG_EXCEPTION("Socket is not connected.");
-               return FAILURE;
-       }
-       */
-
-       int send_bytes = sizeof(int)+buf_len;
-       char buf[send_bytes];
-       memcpy(buf, (char*) &buf_len, sizeof(int)); /*  write buffer lenth */
-       memcpy(buf + sizeof(int), buffer, buf_len); /*  write buffer */
-
-       EM_DEBUG_LOG("Sending %dB data to [fd = %d] ", send_bytes, fd);
-    int nRet = writen(fd, buf, send_bytes);
-
-       EM_DEBUG_FUNC_END();    
-    return nRet;
-/*
-       EM_DEBUG_LOG("Sending %dB data to [fd = %d] ", buf_len, fd);
-       int n = writen(fd, buffer, buf_len);
-
-       if( n != buf_len ) {
-               EM_DEBUG_LOG("WARNING: write buf_size[%d] != send_len [%d]", n, buf_len);
-               return FAILURE;
-       }
-       EM_DEBUG_FUNC_END();            
-       return n;
-*/
-}
-
-
-int ipcEmailSocket::readn( int fd, char *buf, int len )
-{
-       int nleft, nread;
-
-       nleft = len;
-       while( nleft > 0 ) {
-               nread = ::read(fd, (void*)buf, nleft);
-               if( nread < 0 ) {
-                       EM_DEBUG_EXCEPTION("read: %s", strerror(errno));
-                       if (errno == EINTR) continue;
-                       return nread;
-               } else if( nread == 0 )
-                       break;
-               
-               nleft -= nread;
-               buf += nread;
-       }
-       return (len-nleft);
-}
-
-int ipcEmailSocket::Recv(int fd, char** buffer)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       if ( !buffer ) {
-               EM_DEBUG_LOG("buffer MUST NOT NULL");
-               return FAILURE;
-       }
-
-       /*  read the data size first and store it to len */
-       int n, len = 0;
-       
-       EM_DEBUG_LOG("[IPC Socket] Receiving header begins");
-       n = readn(fd, (char*) &len, sizeof(int));
-       EM_DEBUG_LOG("[IPC Socket] Receiving header %dB data", len);
-       
-       if ( n == 0 ) /*  if service gets down, it signals to all IPC clients */
-               return n; else if ( n != sizeof(int) ) {
-               EM_DEBUG_LOG("WARNING: read header_size[%d] not matched [%d]", n, sizeof(int));
-               return FAILURE;
-       }
-/*     if( ioctl(fd, FIONREAD, &len) == -1 )  {
-        EM_DEBUG_LOG("FIONREAD %s", EM_STRERROR(errno));
-        return FAILURE;
-    }
-*/
-       /*  alloc buffer and read data */
-       *buffer = new char[len];
-
-       EM_DEBUG_LOG("[IPC Socket] Receiving Body begins for [%d] bytes", len);
-       n = readn(fd, *buffer, len);
-       if ( n !=  len ) {
-               delete[] *buffer;
-               *buffer = NULL;
-               EM_DEBUG_LOG("WARNING: read buf_size [%d] != read_len[%d]", n, len);
-               return FAILURE;
-       }
-
-       EM_DEBUG_LOG("[IPC Socket] Receiving [%d] bytes Completed", len);
-
-       return n;
-}
-
-int ipcEmailSocket::GetSocketID()
-{
-       return m_sockfd;
-}
-
-
-int ipcEmailSocket::accept()
-{
-       EM_DEBUG_FUNC_BEGIN();
-
-       if (m_sockfd == -1)  {
-               EM_DEBUG_LOG("server_socket not init");
-               return FAILURE;
-       }
-       
-       struct sockaddr_un remote;
-
-       int t = sizeof(remote);
-       int fd = ::accept(m_sockfd, (struct sockaddr *)&remote, (socklen_t*) &t);
-       if (fd == -1)  {
-               EM_DEBUG_LOG("accept: %s", EM_STRERROR(errno));
-               return FAILURE;
-       }
-
-       addfd(fd);
-       EM_DEBUG_LOG("%d is added", fd);
-
-       EM_DEBUG_FUNC_END();
-       return fd;
-}
-
-int ipcEmailSocket::open(const char* path)
-{
-       EM_DEBUG_FUNC_BEGIN("path [%s]", path);
-
-       if (!path || strlen(path) > 108) {
-               EM_DEBUG_LOG("path is null");
-               return FAILURE;
-       }
-       
-       if ( m_sockfd <= 0 ) {
-               EM_DEBUG_LOG("Server_socket not created %d", m_sockfd);
-               return FAILURE;
-       }
-
-       struct sockaddr_un local;
-       
-       local.sun_family = AF_UNIX;
-       strcpy(local.sun_path, path);
-       unlink(local.sun_path);
-       
-       int len = strlen(local.sun_path) + sizeof(local.sun_family);
-       
-       if (bind(m_sockfd, (struct sockaddr *)&local, len) == -1)  {
-               EM_DEBUG_LOG("bind: %s", strerror(errno));
-               return FAILURE;
-       }
-
-       /**
-        * determine permission of socket file
-        *
-        *  - S_IRWXU : for user, allow read and write and execute
-        *  - S_IRWXG : for group, allow read and write and execute
-        *  - S_IRWXO : for other, allow read and write and execute
-        *
-        *  - S_IRUSR, S_IWUSR, S_IXUSR : for user, allow only read, write, execute respectively
-        *  - S_IRGRP, S_IWGRP, S_IXGRP : for group, allow only read, write, execute respectively
-        *  - S_IROTH, S_IWOTH, S_IXOTH : for other, allow only read, write, execute respectively
-        */
-       mode_t sock_mode = (S_IRWXU | S_IRWXG | S_IRWXO); /*  has 777 permission */
-
-       if (chmod(path, sock_mode) == -1) {
-               EM_DEBUG_LOG("chmod: %s", strerror(errno));
-               return FAILURE;
-       }
-
-       if (listen(m_sockfd, 10) == -1) {
-               EM_DEBUG_LOG("listen: %s", strerror(errno));
-               return FAILURE;
-       }
-
-       addfd(m_sockfd);
-
-       EM_DEBUG_FUNC_END();
-       return 0;
-}
-
-
-int ipcEmailSocket::Connect()
-{
-       EM_DEBUG_FUNC_BEGIN();
-       
-       struct sockaddr_un serverSA;
-       serverSA.sun_family = AF_UNIX;
-       strcpy(serverSA.sun_path, EM_SOCKET_PATH); /*  "./socket" */
-       
-       int len = strlen(serverSA.sun_path) + sizeof(serverSA.sun_family);
-       
-       if (::connect(m_sockfd, (struct sockaddr *)&serverSA, len) == -1)  {
-               EM_DEBUG_LOG("cannot connect server %s", strerror(errno));
-               return FAILURE;
-       }
-
-       /* add fd for select() */
-       addfd(m_sockfd);
-       m_bConnect = true;
-
-       return 0;
-}
-
-void ipcEmailSocket::addfd(int fd)
-{
-       EM_DEBUG_LOG("%d added", fd);
-       FD_SET(fd, &fds);
-
-       std::map<int, int>::iterator it = mapFds.find(fd);
-       if(it != mapFds.end()) {
-               EM_DEBUG_LOG("Duplicate FD %d", fd);
-               return;
-       } else
-               mapFds[fd] = fd;
-       
-       if ( fd > maxfd )
-               maxfd = fd;
-}
-
-
diff --git a/ipc/stub/include/ipc-queue.h b/ipc/stub/include/ipc-queue.h
deleted file mode 100755 (executable)
index f51a51a..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-
-#ifndef _IPC_QUEUE_H_
-#define _IPC_QUEUE_H_
-
-class ipcEmailQueueItem
-{
-public:
-       ipcEmailQueueItem();
-       ipcEmailQueueItem(void* a_pData);
-       virtual ~ipcEmailQueueItem();
-
-private:
-public:
-       void*                   m_pData;
-       ipcEmailQueueItem*      m_pNext;
-
-public:
-       void* Get();
-       void Set(void* a_pData);
-};
-
-class ipcEmailQueue
-{
-public:
-       ipcEmailQueue();
-       virtual ~ipcEmailQueue();
-
-private:
-       ipcEmailQueueItem* m_pHead;
-       ipcEmailQueueItem* m_pTail;
-       int m_nCount;
-
-public:
-       void* Pop();
-       bool Push(void* a_pData);
-
-       int GetCount();
-};
-
-#endif /* _IPC_QUEUE_H_ */
-
-
diff --git a/ipc/stub/include/ipc-stub-main.h b/ipc/stub/include/ipc-stub-main.h
deleted file mode 100755 (executable)
index 7596358..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-
-#ifndef        _IPC_STUB_MAIN_H_
-#define        _IPC_STUB_MAIN_H_
-
-#include "ipc-library.h"
-#include "cm-sys-msg-queue.h"
-#include "cm-list.h"
-#include "ipc-stub-socket.h"
-
-class ipcEmailAPIInfo;
-
-class ipcEmailStubMain
-{
-public:
-       ipcEmailStubMain();
-       virtual ~ipcEmailStubMain();
-
-private:
-       static ipcEmailStubMain *s_pThis;
-       PFN_EXECUTE_API                m_pfnAPIMapper;
-       ipcEmailStubSocket*                m_pStubSocket;
-
-       cmSysMsgQueue                   *m_pMsgSender;
-       cmList                                    *m_pResponseList;
-public:
-       static ipcEmailStubMain* Instance();
-       static void FreeInstance();
-
-       bool Initialize(PFN_EXECUTE_API a_pfnAPIMapper);
-       bool Finalize();
-
-       bool ExecuteAPIProxyToStub(ipcEmailAPIInfo *a_pAPI);
-       bool ExecuteAPIStubToProxy(ipcEmailAPIInfo *a_pAPI);
-       bool SetResponseInfo(long a_nResponseID, long a_nAPIID);
-};     
-
-#endif /* _IPC_STUB_MAIN_H_ */
-
-
diff --git a/ipc/stub/include/ipc-task-manager.h b/ipc/stub/include/ipc-task-manager.h
deleted file mode 100755 (executable)
index 15e7e63..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-#ifndef _IPC_TASK_MANAGER_H_
-#define _IPC_TASK_MANAGER_H_
-
-#include <unistd.h>
-#include <pthread.h>
-#include "ipc-task.h"
-#include "ipc-queue.h"
-#include "emf-mutex.h"
-
-#define IPC_TASK_MAX   64
-
-
-class ipcEmailTaskManager
-{
-public:
-       ipcEmailTaskManager();
-       virtual ~ipcEmailTaskManager();
-
-private:
-       ipcEmailQueue m_TaskQueue;
-       pthread_t       m_hTaskThread;
-       bool            m_bStopFlag;
-       Mutex mx;
-       CndVar cv;
-
-public:
-       bool StartTaskThread();
-       bool StopTaskThread();
-
-       bool CreateTask(unsigned char* a_pTaskStream, int a_nResponseChannel);
-       bool DoTask();
-private:
-       static void* TaskThreadProc(void *a_pOwner);
-};
-
-#endif /* _IPC_TASK_MANAGER_H_ */
-
-
diff --git a/ipc/stub/ipc-queue.cpp b/ipc/stub/ipc-queue.cpp
deleted file mode 100755 (executable)
index 490c904..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-#include <stdio.h>
-#include "ipc-queue.h"
-#include "ipc-library-build.h"
-#include "emf-dbglog.h"
-
-ipcEmailQueue::ipcEmailQueue()
-{
-       m_pHead = NULL;
-       m_pTail = NULL;
-       m_nCount = 0;
-}
-
-ipcEmailQueue::~ipcEmailQueue()
-{
-}
-
-void* ipcEmailQueue::Pop()
-{
-       if(m_pHead) {
-               ipcEmailQueueItem *pPopped = m_pHead;
-               void* pData = pPopped->Get();
-
-               if(pPopped->m_pNext) {
-                       m_pHead = pPopped->m_pNext;
-               } else {
-                       m_pHead = m_pTail = NULL;
-               }
-
-               delete pPopped;
-               pPopped = NULL;
-               m_nCount = (m_nCount <= 0)? 0 : m_nCount-1;
-
-               return pData;
-       }
-       return NULL;
-}
-
-bool ipcEmailQueue::Push(void* a_pData)
-{
-       /* EM_DEBUG_FUNC_BEGIN(); */
-       if(!a_pData) {
-               EM_DEBUG_EXCEPTION("[IPCLib] ipcEmailQueue::Push - invalid input \n");
-               return false;
-       }
-
-       ipcEmailQueueItem *pItem = new ipcEmailQueueItem(a_pData);
-       if(m_pTail) {
-               m_pTail->m_pNext = pItem;
-               m_pTail = pItem;
-       } else {
-               m_pHead = m_pTail = pItem;
-       }
-
-       m_nCount++;
-       pItem->m_pNext = NULL;
-       return true;
-}
-
-int ipcEmailQueue::GetCount()
-{
-       return m_nCount;
-}
-
-
-
-
-ipcEmailQueueItem::ipcEmailQueueItem()
-{
-       m_pData = NULL;
-       m_pNext = NULL;
-}
-
-ipcEmailQueueItem::ipcEmailQueueItem(void* a_pData)
-{
-       m_pData = a_pData;
-       m_pNext = NULL;
-}
-
-ipcEmailQueueItem::~ipcEmailQueueItem()
-{
-}
-
-void* ipcEmailQueueItem::Get()
-{
-       return m_pData;
-}
-
-void ipcEmailQueueItem::Set(void* a_pData)
-{
-       m_pData = a_pData;
-}
-
diff --git a/ipc/stub/ipc-response-info.cpp b/ipc/stub/ipc-response-info.cpp
deleted file mode 100755 (executable)
index f181e75..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-#include "ipc-response-info.h"
-
-ipcEmailResponseInfo::ipcEmailResponseInfo()
-{
-       m_nResponseID = 0;
-       m_nAPIID = 0;
-}
-
-ipcEmailResponseInfo::~ipcEmailResponseInfo()
-{
-}
-
-bool ipcEmailResponseInfo::SetVaue(long a_nResponseID, long a_nAPIID)
-{
-       m_nResponseID = a_nResponseID;
-       m_nAPIID = a_nAPIID;
-       return true;
-}
-
-long ipcEmailResponseInfo::GetResponseID()
-{
-       return m_nResponseID;
-}
-
-
-long ipcEmailResponseInfo::GetAPIID()
-{
-       return m_nAPIID;
-}
-
-
diff --git a/ipc/stub/ipc-stub-main.cpp b/ipc/stub/ipc-stub-main.cpp
deleted file mode 100755 (executable)
index 454e6a0..0000000
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-
-#include "ipc-stub-main.h"
-#include "ipc-library.h"
-#include "ipc-response-info.h"
-#include "ipc-param-list.h"
-#include "ipc-library-build.h"
-
-
-ipcEmailStubMain* ipcEmailStubMain::s_pThis = NULL;
-
-ipcEmailStubMain::ipcEmailStubMain()
-{
-       EM_DEBUG_FUNC_BEGIN();
-       m_pfnAPIMapper = NULL;
-       m_pStubSocket = NULL;
-       m_pMsgSender = NULL;
-       m_pResponseList = NULL;
-       EM_DEBUG_FUNC_END();
-}
-
-ipcEmailStubMain::~ipcEmailStubMain()
-{
-       EM_DEBUG_FUNC_BEGIN();
-       Finalize();
-       EM_DEBUG_FUNC_END();
-}
-
-
-ipcEmailStubMain* ipcEmailStubMain::Instance()
-{
-       EM_DEBUG_FUNC_BEGIN();
-       if(s_pThis)
-               return s_pThis;
-
-       s_pThis = new ipcEmailStubMain();       
-       EM_DEBUG_FUNC_END();
-       return s_pThis;
-}
-
-void ipcEmailStubMain::FreeInstance()
-{
-       EM_DEBUG_FUNC_BEGIN();
-       if(s_pThis) {
-               delete s_pThis;
-               s_pThis = NULL;
-       }
-       EM_DEBUG_FUNC_END();
-}
-
-bool ipcEmailStubMain::Initialize(PFN_EXECUTE_API a_pfnAPIMapper)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       m_pfnAPIMapper = a_pfnAPIMapper;
-
-       if(!a_pfnAPIMapper || m_pStubSocket) {
-               EM_DEBUG_EXCEPTION("Invalid Param");
-               return false;
-       }
-
-       m_pfnAPIMapper = a_pfnAPIMapper;
-
-       m_pResponseList = new cmList();
-       if(!m_pResponseList) {
-               EM_DEBUG_EXCEPTION("m_pResponseList == NULL\n");
-               return false;
-       }
-
-       m_pMsgSender = new cmSysMsgQueue(0);
-       if(!m_pMsgSender) {
-               EM_DEBUG_EXCEPTION("m_pMsgSender == NULL\n");
-               return false;
-       }
-       m_pMsgSender->MsgCreate();
-
-       m_pStubSocket = new ipcEmailStubSocket;
-       
-       if(m_pStubSocket) {
-               return m_pStubSocket->Start();
-       } else {
-               EM_DEBUG_EXCEPTION("m_pStubSocket == NULL\n");
-               return false;
-       }
-       EM_DEBUG_FUNC_END();
-       return false;
-}
-
-bool ipcEmailStubMain::Finalize()
-{
-       EM_DEBUG_FUNC_BEGIN();
-
-       if(m_pResponseList) {
-               int nIndex;
-               for(nIndex = 0; nIndex<m_pResponseList->GetCount(); nIndex++) {
-                       ipcEmailResponseInfo *pResponseInfo = (ipcEmailResponseInfo *)m_pResponseList->GetAt(nIndex);
-                       if(pResponseInfo)
-                               m_pResponseList->RemoveItem(pResponseInfo);
-               }
-               delete m_pResponseList;
-       }
-       if(m_pMsgSender) {
-               m_pMsgSender->MsgDestroy();
-               m_pMsgSender = NULL;
-       }
-       
-       if(m_pStubSocket) {
-               m_pStubSocket->End();
-               delete m_pStubSocket;
-               m_pStubSocket = NULL;
-       }
-       
-       if(m_pfnAPIMapper)
-               m_pfnAPIMapper = NULL;
-               
-       EM_DEBUG_FUNC_END();
-       return true;
-}
-
-bool ipcEmailStubMain::ExecuteAPIProxyToStub(ipcEmailAPIInfo *a_pAPI)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       if(!m_pfnAPIMapper || !a_pAPI) {
-               EM_DEBUG_EXCEPTION("Invalid Param");
-               return false;
-       }
-       
-       m_pfnAPIMapper(a_pAPI);
-       EM_DEBUG_FUNC_END();
-       return true;
-}
-
-bool ipcEmailStubMain::ExecuteAPIStubToProxy(ipcEmailAPIInfo *a_pAPI)
-{
-       EM_DEBUG_FUNC_BEGIN("a_pAPI [%p]", a_pAPI);
-       EM_IF_NULL_RETURN_VALUE(a_pAPI, false);
-       EM_DEBUG_LOG("APIID [%s], Response SockID [%d], APPID [%d]", EM_APIID_TO_STR(a_pAPI->GetAPIID()), a_pAPI->GetResponseID(), a_pAPI->GetAPPID());
-       
-       unsigned char* pStream = (unsigned char*)a_pAPI->GetStream(ePARAMETER_OUT);
-       int nStreamLength = a_pAPI->GetStreamLength(ePARAMETER_OUT);
-       EM_DEBUG_LOG("Data : %p, Data length : %dB",pStream, nStreamLength);
-       EM_DEBUG_LOG("Stub => Proxy Sending %dB", nStreamLength);
-       m_pStubSocket->Send(a_pAPI->GetResponseID(), pStream, nStreamLength);
-
-#ifdef IPCLIB_STREAM_TRACE_ON
-       int nIndex;
-       for(nIndex=0; nIndex< nStreamLength; nIndex++)
-               EM_DEBUG_LOG("pStream[nIndex] :[%d]", pStream[nIndex]);
-#endif
-
-       EM_DEBUG_FUNC_END();
-       return true;
-}
-
-bool ipcEmailStubMain::SetResponseInfo( long a_nAPPID, long a_nAPIID)
-{
-       EM_DEBUG_FUNC_BEGIN("ResponseID [%d]", a_nAPPID);
-
-       if(a_nAPPID <= 0)       
-               return true;
-
-       ipcEmailResponseInfo *pResponseInfo = new ipcEmailResponseInfo();
-       if(pResponseInfo) {
-               pResponseInfo->SetVaue(a_nAPPID, a_nAPIID);
-               m_pResponseList->AddTail(pResponseInfo);
-               return true;
-       }
-       EM_DEBUG_FUNC_END();
-       return false;
-}
-
diff --git a/ipc/stub/ipc-stub-socket.cpp b/ipc/stub/ipc-stub-socket.cpp
deleted file mode 100755 (executable)
index 9244419..0000000
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-
-
-#include <unistd.h>
-#include "ipc-task.h"
-#include "ipc-library-build.h"
-#include "emf-dbglog.h"
-#include "ipc-stub-socket.h"
-#include <errno.h>
-#include <sys/epoll.h>
-
-ipcEmailStubSocket::ipcEmailStubSocket()
-{
-       m_pSocket = NULL;       
-       m_hStubSocketThread = 0;
-       m_pTaskManager = NULL;
-       m_bStopThread = false;
-}
-
-ipcEmailStubSocket::~ipcEmailStubSocket()
-{
-       End();
-}
-
-bool ipcEmailStubSocket::Start()
-{
-       m_pTaskManager = new ipcEmailTaskManager();
-       if(m_pTaskManager == NULL)
-               return false;
-
-       m_pSocket = new ipcEmailSocket();
-       if( m_pSocket == NULL )
-               return false;
-
-       if( m_pSocket ) {
-               StartStubSocketThread();
-       }
-
-       return m_pTaskManager->StartTaskThread();
-}
-
-/* stub socket accpet, recv, send */
-bool ipcEmailStubSocket::StartStubSocketThread()
-{
-       EM_DEBUG_LOG("[IPCLib] ipcEmailStubSocket::StartStubSocketThread \n");
-       if(m_hStubSocketThread)
-               return true;    
-
-       pthread_attr_t thread_attr;
-       pthread_attr_init(&thread_attr);
-       pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED);     
-       if (pthread_create(&m_hStubSocketThread, &thread_attr, &StubSocketThreadProc, (void*)this) != 0)  {
-               EM_DEBUG_EXCEPTION("[IPCLib] ipcEmailStubSocket::StartStubSocketThread() - fail to create a thread \n");
-               return false; 
-       }
-       return true;
-
-}
-
-bool ipcEmailStubSocket::StopStubSocketThread()
-{
-       if(m_hStubSocketThread)
-               m_bStopThread = true;
-
-       return true;
-}
-
-void* ipcEmailStubSocket::StubSocketThreadProc(void *a_pOwner)
-{
-       ipcEmailStubSocket *pStubSocket = (ipcEmailStubSocket*)a_pOwner;
-       if(pStubSocket) {
-               pStubSocket->WaitForIPCRequest();
-               pStubSocket->m_hStubSocketThread = 0; /*  prevent 20071030 */
-       }       
-       return NULL;
-}
-
-#define MAX_EPOLL_EVENT 50
-
-void ipcEmailStubSocket::WaitForIPCRequest()
-{
-       if ( !m_pSocket ) {
-               EM_DEBUG_EXCEPTION("server socket is not initialized");
-               return;
-       }
-
-       m_pSocket->open(EM_SOCKET_PATH);
-
-       struct epoll_event ev = {0};
-       struct epoll_event events[MAX_EPOLL_EVENT] = {{0}, };
-       int epfd = epoll_create(MAX_EPOLL_EVENT);
-       if( epfd < 0 ) {
-               EM_DEBUG_EXCEPTION("epoll_create: %s[%d]", EM_STRERROR(errno), errno);
-               EM_DEBUG_CRITICAL_EXCEPTION("epoll_create: %s[%d]", EM_STRERROR(errno), errno);
-               abort();
-       }
-       int server_fd = m_pSocket->GetSocketID();
-       ev.events = EPOLLIN;
-       ev.data.fd = server_fd;
-       if( epoll_ctl(epfd, EPOLL_CTL_ADD, server_fd, &ev) == -1 ) {
-               EM_DEBUG_EXCEPTION("epoll_ctl: %s[%d]", EM_STRERROR(errno), errno);
-               EM_DEBUG_CRITICAL_EXCEPTION("epoll_ctl: %s[%d]", EM_STRERROR(errno), errno);
-       }
-
-       int event_num = 0;
-       while(1){
-
-               event_num = epoll_wait(epfd, events, MAX_EPOLL_EVENT, -1);
-               
-               if( event_num == -1 ) {
-                       EM_DEBUG_EXCEPTION("epoll_wait: %s[%d]", EM_STRERROR(errno), errno);
-                       EM_DEBUG_CRITICAL_EXCEPTION("epoll_wait: %s[%d]", EM_STRERROR(errno), errno);
-                       if (errno == EINTR) continue; /* resume when interrupted system call*/
-                       else abort();
-               }  else
-                       for (int i=0 ; i < event_num; i++) {
-                               int event_fd = events[i].data.fd;
-
-                               if (event_fd == server_fd) { /*  if it is socket connection request */
-                                       int cfd = m_pSocket->accept();
-                                       if( cfd < 0 ) {
-                                               EM_DEBUG_EXCEPTION("accept error: %s[%d]", EM_STRERROR(errno), errno);
-                                               EM_DEBUG_CRITICAL_EXCEPTION("accept error: %s[%d]", EM_STRERROR(errno), errno);
-                                               /*  abort(); */
-                                       }
-                                       ev.events = EPOLLIN;
-                                       ev.data.fd = cfd;
-                                       epoll_ctl(epfd, EPOLL_CTL_ADD, cfd, &ev);
-                               } else {
-                                       int nRecvLen;
-                                       char *szBuff = NULL;
-                                       
-                                       nRecvLen = m_pSocket->Recv(event_fd, &szBuff);
-                                       
-                                       if(nRecvLen > 0) {
-                                               EM_DEBUG_LOG("====================================================================");
-                                               EM_DEBUG_LOG("[IPCLib]Stub Socket Recv [Socket ID = %d], [RecvLen = %d]", event_fd, nRecvLen);
-                                               EM_DEBUG_LOG("====================================================================");
-                                               m_pTaskManager->CreateTask((unsigned char*)szBuff, event_fd);
-                                       }  else {
-                                               EM_DEBUG_LOG("[IPCLib] Socket [%d] removed - [%d] ", event_fd, nRecvLen);
-                                               epoll_ctl(epfd, EPOLL_CTL_DEL, event_fd, events);
-                                               close(event_fd);
-                                       } 
-                                       if(szBuff)
-                                               delete []szBuff;
-                               }
-                       }
-       }
-}
-
-
-bool ipcEmailStubSocket::End()
-{
-       EM_DEBUG_FUNC_BEGIN();
-       
-       if(m_pSocket) {
-               m_pSocket->Close();     /*  prevent 20071030 */
-               delete m_pSocket;
-               m_pSocket = NULL;
-       }
-
-       if(m_hStubSocketThread) {
-               StopStubSocketThread();
-               pthread_cancel(m_hStubSocketThread);
-               m_hStubSocketThread = 0;
-       }
-       if(m_pTaskManager) {
-               m_pTaskManager->StopTaskThread();
-               delete m_pTaskManager;
-               m_pTaskManager = NULL;
-       }       
-       
-       return true;
-}
-
-int ipcEmailStubSocket::Send(int fd, void* pData , int a_nLen)
-{
-       EM_DEBUG_FUNC_END();
-
-       EM_DEBUG_LOG("Stub socket sending %d bytes", a_nLen);
-       int sending_bytes = m_pSocket->Send(fd, (char*)pData, a_nLen);
-
-       EM_DEBUG_FUNC_END();
-       return sending_bytes;
-}
-
diff --git a/ipc/stub/ipc-task-manager.cpp b/ipc/stub/ipc-task-manager.cpp
deleted file mode 100755 (executable)
index bca67c0..0000000
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-
-#include <string.h>
-#include "ipc-task-manager.h"
-#include "ipc-task.h"
-#include "ipc-library-build.h"
-#include "emf-dbglog.h"
-#include <pthread.h>
-#include <errno.h>
-
-pthread_cond_t email_task_queue_signal;
-pthread_mutex_t email_task_queue_lock;
-
-
-/*
-void* worker_func(void *a_pOwner)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       ipcEmailTaskManager *pTaskManager = (ipcEmailTaskManager*) a_pOwner;
-       if(pTaskManager) {
-               pTaskManager->DoTask();
-       }
-       return NULL;
-}
-*/
-ipcEmailTaskManager::ipcEmailTaskManager() : m_TaskQueue(), m_hTaskThread(0), m_bStopFlag(false),  mx(), cv()
-{
-}
-
-ipcEmailTaskManager::~ipcEmailTaskManager()
-{
-       StopTaskThread();
-       pthread_cancel(m_hTaskThread);
-
-       ipcEmailTask* pTask = (ipcEmailTask*)m_TaskQueue.Pop();
-       while(pTask) {
-               delete pTask;
-               pTask = (ipcEmailTask*)m_TaskQueue.Pop();
-       }
-}
-
-bool ipcEmailTaskManager::StartTaskThread()
-{
-       EM_DEBUG_FUNC_BEGIN();
-       if(m_hTaskThread)
-               return true;
-/*
-       pthread_attr_t thread_attr;
-       pthread_attr_init(&thread_attr);
-       pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED);     
-
-       if (pthread_create(&m_hTaskThread, &thread_attr, &TaskThreadProc, (void*)this) != 0) 
-*/
-       if (pthread_create(&m_hTaskThread, NULL, &TaskThreadProc, (void*)this) != 0)  {
-               EM_DEBUG_LOG("Worker thread creation failed: %s", strerror(errno));
-               return false;
-       }
-
-       return true;
-}
-
-bool ipcEmailTaskManager::StopTaskThread()
-{
-       m_bStopFlag = true;
-       return true;
-}
-
-void* ipcEmailTaskManager::TaskThreadProc(void *a_pOwner)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       ipcEmailTaskManager *pTaskManager = (ipcEmailTaskManager*)a_pOwner;
-       if(pTaskManager) {
-               pTaskManager->DoTask();
-       }
-       return NULL;
-}
-
-
-/* important! m_TaskQueue is shared by worker thread and ipc handler thread */
-/* code for worker thread */
-bool ipcEmailTaskManager::DoTask()
-{
-       EM_DEBUG_FUNC_BEGIN();
-
-       ipcEmailTask *pTask = NULL;
-
-       while(!m_bStopFlag) {
-
-               mx.lock();
-               while(m_TaskQueue.GetCount() == 0) {
-                       EM_DEBUG_LOG("Blocked until new task arrives %p.", &cv);
-                       cv.wait(mx.pMutex());
-               }
-
-               pTask = (ipcEmailTask*)m_TaskQueue.Pop();
-               mx.unlock();
-               
-               if(pTask) {
-                       pTask->Run();
-                       delete pTask;
-                       pTask = NULL;
-               }
-       }
-
-       return false;
-}
-
-/* code for ipc handler */
-bool ipcEmailTaskManager::CreateTask(unsigned char* a_pTaskStream, int a_nResponseChannel)
-{
-       EM_DEBUG_FUNC_BEGIN();
-
-/*     pthread_mutex_init(&email_task_queue_lock, NULL); */
-/*     pthread_cond_init(&email_task_queue_signal, NULL); */
-
-/*
-       if(!m_hTaskThread) {
-               if (pthread_create(&m_hTaskThread, NULL, &worker_func, (void*)this) != 0)  {
-                       EM_DEBUG_LOG("Worker thread creation failed: %s", strerror(errno));
-                       return false;
-               }
-               EM_DEBUG_LOG("* Worker thread now running *");
-       }
-*/     
-       ipcEmailTask *pTask = new ipcEmailTask();
-       if(pTask) {
-               pTask->ParseStream(a_pTaskStream, a_nResponseChannel);
-
-               EM_DEBUG_LOG("[IPCLib] ====================================================");
-               EM_DEBUG_LOG("[IPCLib] Register new task : %p", pTask);
-               EM_DEBUG_LOG("[IPCLib] Task API ID : %s", EM_APIID_TO_STR(pTask->GetAPIInfo()->GetAPIID()));
-               EM_DEBUG_LOG("[IPCLib] Task Response ID : %d", pTask->GetAPIInfo()->GetResponseID());
-               EM_DEBUG_LOG("[IPCLib] Task APP ID : %d", pTask->GetAPIInfo()->GetAPPID());     
-               EM_DEBUG_LOG("[IPCLib] ====================================================");
-
-               mx.lock();
-               bool bRtn = m_TaskQueue.Push(pTask);
-
-               int err = cv.signal();
-               if(err)
-                       EM_DEBUG_LOG("cv wakeup error: %s", strerror(errno));
-
-               mx.unlock();
-               
-               return bRtn;
-       }
-       return false;
-}
-
-
diff --git a/ipc/stub/ipc-task.cpp b/ipc/stub/ipc-task.cpp
deleted file mode 100755 (executable)
index cabf04a..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2000 - 2011 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.
-*
-*/
-
-
-
-#include <sys/socket.h>
-#include "ipc-library.h"
-#include "ipc-task.h"
-#include "ipc-stub-main.h"
-#include "ipc-param-list.h"
-#include "ipc-library-build.h"
-
-ipcEmailTask::ipcEmailTask()
-{
-       EM_DEBUG_FUNC_BEGIN();
-       m_nResponseChannel = 0;
-       m_pAPIInfo = NULL;
-       EM_DEBUG_LOG("pcTask::ipcEmailTask()  ");
-}
-
-ipcEmailTask::~ipcEmailTask()
-{
-       EM_DEBUG_FUNC_BEGIN();
-       if(m_pAPIInfo) {
-               delete m_pAPIInfo;
-               m_pAPIInfo = NULL;
-       }
-}
-
-bool ipcEmailTask::ParseStream(void* a_pStream, int a_nResponseID)
-{
-       EM_DEBUG_FUNC_BEGIN();
-       if(m_pAPIInfo)
-               delete m_pAPIInfo;
-
-       m_pAPIInfo = new ipcEmailAPIInfo();
-
-       if(m_pAPIInfo) {
-               m_pAPIInfo->ParseStream(ePARAMETER_IN, a_pStream);
-               m_pAPIInfo->SetResponseID(a_nResponseID);
-               return true;
-       }
-       return false;
-}
-
-ipcEmailAPIInfo *ipcEmailTask::GetAPIInfo()
-{
-       return m_pAPIInfo;
-}
-
-int  ipcEmailTask::GetResponseChannel()
-{
-       return m_nResponseChannel;
-}
-
-bool ipcEmailTask::Run()
-{
-       EM_DEBUG_LOG("[IPCLib]  Starting a new task...");
-       
-       int nAPPID =  m_pAPIInfo->GetAPPID();
-       if(nAPPID > 0)  /* If the call is for async, APP ID is passed. */ {     /* It means this call is for async, response ID set. */
-               EM_DEBUG_LOG("[IPCLib] This task (%s) is for async. Response ID [%d]", EM_APIID_TO_STR(m_pAPIInfo->GetAPIID()), m_pAPIInfo->GetAPIID());
-               ipcEmailStubMain::Instance()->SetResponseInfo(nAPPID, m_pAPIInfo->GetAPIID());  
-       }
-       
-       return ipcEmailStubMain::Instance()->ExecuteAPIProxyToStub(m_pAPIInfo);
-       
-}
-
-
old mode 100644 (file)
new mode 100755 (executable)
index 5f08be4..33cce0e
@@ -1,16 +1,15 @@
 Name:       email-service
 Summary:    E-mail Framework Middleware package
-Version:    0.3.6
-Release:    3
-Group:      System/Services
-License:    Apache-2.0
+Version:    0.4.2
+Release:    1
+Group:      System/Libraries
+License:    TBD
 Source0:    %{name}-%{version}.tar.gz
 Requires(post):    /sbin/ldconfig
 Requires(post):    /usr/bin/sqlite3
 Requires(post):    /usr/bin/vconftool
 Requires(postun):  /sbin/ldconfig
 BuildRequires:  cmake
-BuildRequires:  gettext-tools
 BuildRequires:  pkgconfig(glib-2.0)
 BuildRequires:  pkgconfig(gthread-2.0)
 BuildRequires:  pkgconfig(aul)
@@ -26,16 +25,18 @@ BuildRequires:  pkgconfig(drm-service)
 BuildRequires:  pkgconfig(openssl)
 BuildRequires:  pkgconfig(alarm-service)
 BuildRequires:  pkgconfig(mm-player)
+BuildRequires:  pkgconfig(mm-session)
 BuildRequires:  pkgconfig(devman_haptic)
 BuildRequires:  pkgconfig(secure-storage)
 BuildRequires:  pkgconfig(notification)
 BuildRequires:  pkgconfig(accounts-svc)
+BuildRequires:  pkgconfig(capi-base-common)
 BuildRequires:  pkgconfig(libcurl)
+BuildRequires:  pkgconfig(libxml-2.0)
 BuildRequires:  pkgconfig(gconf-2.0)
-BuildRequires:  pkgconfig(mm-session)
-BuildRequires:  pkgconfig(capi-base-common)
 
 
+BuildRoot:  %{_tmppath}/%{name}-%{version}-build
 
 %description
 E-mail Framework Middleware Library/Binary package
@@ -50,15 +51,6 @@ Requires:   %{name} = %{version}-%{release}
 E-mail Framework Middleware Development package
 
 
-%package tools
-Summary:    Tools for use with email-service
-Group:      Development/Libraries
-Requires:   %{name} = %{version}-%{release}
-
-%description tools
-Tools for use with email-service
-
-
 %prep
 %setup -q
 
@@ -77,140 +69,206 @@ make
 %install
 %make_install
 
+%clean
+rm -rf %{buildroot}
+
 %post
 /sbin/ldconfig
 
+
 #################################################################
 # Add preset account information
 #################################################################
-echo "[EMAIL-SERVICE] Start adding preset account information..."
+echo "[EMAIL-SERVICE] Start adding preset account information..." 
 
 #################################################################
 # Email Settings
 #################################################################
 
-## Setting
-# Sending
-vconftool set -g 5000 -t bool   db/Services/Email/Sending/KeepCopy                      "1"
-vconftool set -g 5000 -t bool   db/Services/Email/Sending/SendMeCopy            "1"
-vconftool set -g 5000 -t bool   db/Services/Email/Sending/ReqDeliveryRep        "0"
-vconftool set -g 5000 -t bool   db/Services/Email/Sending/ReqReadRep            "0"
-vconftool set -g 5000 -t int    db/Services/Email/Sending/Priority                      "1"
-vconftool set -g 5000 -t string db/Services/Email/Sending/ActiveAccount         ""
-vconftool set -g 5000 -t bool   db/Services/Email/Sending/IncBodyReply          "1"
-vconftool set -g 5000 -t bool   db/Services/Email/Sending/IncAttachFwd          "1"
-# Receiving
-vconftool set -g 5000 -t int    db/Services/Email/Receiving/AutoPoll            "0"
-vconftool set -g 5000 -t int    db/Services/Email/Receiving/PollTime            "0"
-vconftool set -g 5000 -t int    db/Services/Email/Receiving/SendReadRep         "2"
-vconftool set -g 5000 -t int    db/Services/Email/Receiving/Reclimit            "0"
-vconftool set -g 5000 -t int    db/Services/Email/Receiving/FetchOption         "0"
-vconftool set -g 5000 -t bool   db/Services/Email/Receiving/KeepServer          "1"
-vconftool set -g 5000 -t int    db/Services/Email/Receiving/ServDelOption       "1"
-
-vconftool set -g 5000 -t int    db/Services/Email/NbAccount                     "6"
-
-## Accounts
-
-# Gmail
-vconftool set -g 5000 -t string db/Services/Email/1/General/NetworkName         "default"
-vconftool set -g 5000 -t string db/Services/Email/1/General/AccountName         "Gmail"
-vconftool set -g 5000 -t string db/Services/Email/1/General/EmailAddr           ""
-vconftool set -g 5000 -t string db/Services/Email/1/General/UserId                      ""
-vconftool set -g 5000 -t string db/Services/Email/1/General/Password            ""
-vconftool set -g 5000 -t string db/Services/Email/1/General/LoginType           "username_type"
-
-# MailboxType : pop3(0), imap4(1) -> pop3(1), imap4(2) in email-service
-vconftool set -g 5000 -t int    db/Services/Email/1/Incoming/MailboxType        "1"
-vconftool set -g 5000 -t string db/Services/Email/1/Incoming/ServAddr       "imap.gmail.com"
-vconftool set -g 5000 -t int    db/Services/Email/1/Incoming/Port           "993"
-vconftool set -g 5000 -t int    db/Services/Email/1/Incoming/Secure         "1"
-vconftool set -g 5000 -t bool   db/Services/Email/1/Incoming/Apop                       "0"
-vconftool set -g 5000 -t bool   db/Services/Email/1/Incoming/AutoEmailSync      "0"
-vconftool set -g 5000 -t bool   db/Services/Email/1/Incoming/IncludeAttach      "0"
-vconftool set -g 5000 -t int    db/Services/Email/1/Incoming/ImapFetchOpt       "1"
-
-vconftool set -g 5000 -t string db/Services/Email/1/Outgoing/ServAddr           "smtp.gmail.com"
-vconftool set -g 5000 -t int    db/Services/Email/1/Outgoing/Port                       "465"
-vconftool set -g 5000 -t bool   db/Services/Email/1/Outgoing/SmtpAuth           "0"
-vconftool set -g 5000 -t int    db/Services/Email/1/Outgoing/Secure                     "1"
-vconftool set -g 5000 -t bool   db/Services/Email/1/Outgoing/SameIdPwd          "1"
-vconftool set -g 5000 -t bool   db/Services/Email/1/Outgoing/PopBeforeSmtp      "0"
-
-# Hotmail
-vconftool set -g 5000 -t string db/Services/Email/2/General/NetworkName         "default"
-vconftool set -g 5000 -t string db/Services/Email/2/General/AccountName         "Hotmail"
-vconftool set -g 5000 -t string db/Services/Email/2/General/EmailAddr           ""
-vconftool set -g 5000 -t string db/Services/Email/2/General/UserId                      ""
-vconftool set -g 5000 -t string db/Services/Email/2/General/Password            ""
-vconftool set -g 5000 -t string db/Services/Email/2/General/LoginType           "username_type"
-
-# MailboxType : pop3(0), imap4(1) -> pop3(1), imap4(2) in email-service
-vconftool set -g 5000 -t int    db/Services/Email/2/Incoming/MailboxType        "0"
-vconftool set -g 5000 -t string db/Services/Email/2/Incoming/ServAddr       "pop3.live.com"
-vconftool set -g 5000 -t int    db/Services/Email/2/Incoming/Port           "995"
-vconftool set -g 5000 -t int    db/Services/Email/2/Incoming/Secure         "1"
-vconftool set -g 5000 -t bool   db/Services/Email/2/Incoming/Apop                       "0"
-vconftool set -g 5000 -t bool   db/Services/Email/2/Incoming/AutoEmailSync      "0"
-vconftool set -g 5000 -t bool   db/Services/Email/2/Incoming/IncludeAttach      "0"
-vconftool set -g 5000 -t int    db/Services/Email/2/Incoming/ImapFetchOpt       "1"
-
-vconftool set -g 5000 -t string db/Services/Email/2/Outgoing/ServAddr           "smtp.live.com"
-vconftool set -g 5000 -t int    db/Services/Email/2/Outgoing/Port                       "587"
-vconftool set -g 5000 -t bool   db/Services/Email/2/Outgoing/SmtpAuth           "0"
-vconftool set -g 5000 -t int    db/Services/Email/2/Outgoing/Secure                     "2"
-vconftool set -g 5000 -t bool   db/Services/Email/2/Outgoing/SameIdPwd          "1"
-vconftool set -g 5000 -t bool   db/Services/Email/2/Outgoing/PopBeforeSmtp      "0"
-
-# AOL
-vconftool set -g 5000 -t string db/Services/Email/3/General/NetworkName         "default"
-vconftool set -g 5000 -t string db/Services/Email/3/General/AccountName         "AOL"
-vconftool set -g 5000 -t string db/Services/Email/3/General/EmailAddr           ""
-vconftool set -g 5000 -t string db/Services/Email/3/General/UserId                      ""
-vconftool set -g 5000 -t string db/Services/Email/3/General/Password            ""
-vconftool set -g 5000 -t string db/Services/Email/3/General/LoginType           "username_type"
-
-# MailboxType : pop3(0), imap4(1) -> pop3(1), imap4(2) in email-service
-vconftool set -g 5000 -t int    db/Services/Email/3/Incoming/MailboxType        "1"
-vconftool set -g 5000 -t string db/Services/Email/3/Incoming/ServAddr       "imap.aol.com"
-vconftool set -g 5000 -t int    db/Services/Email/3/Incoming/Port           "143"
-vconftool set -g 5000 -t int    db/Services/Email/3/Incoming/Secure         "0"
-vconftool set -g 5000 -t bool   db/Services/Email/3/Incoming/Apop                       "0"
-vconftool set -g 5000 -t bool   db/Services/Email/3/Incoming/AutoEmailSync      "0"
-vconftool set -g 5000 -t bool   db/Services/Email/3/Incoming/IncludeAttach      "0"
-vconftool set -g 5000 -t int    db/Services/Email/3/Incoming/ImapFetchOpt       "0"
-
-vconftool set -g 5000 -t string db/Services/Email/3/Outgoing/ServAddr           "smtp.aol.com"
-vconftool set -g 5000 -t int    db/Services/Email/3/Outgoing/Port                       "587"
-vconftool set -g 5000 -t bool   db/Services/Email/3/Outgoing/SmtpAuth           "0"
-vconftool set -g 5000 -t int    db/Services/Email/3/Outgoing/Secure                     "0"
-vconftool set -g 5000 -t bool   db/Services/Email/3/Outgoing/SameIdPwd          "1"
-vconftool set -g 5000 -t bool   db/Services/Email/3/Outgoing/PopBeforeSmtp      "0"
-
-# Yahoo
-vconftool set -g 5000 -t string db/Services/Email/6/General/NetworkName         "default"
-vconftool set -g 5000 -t string db/Services/Email/6/General/AccountName         "Yahoomail"
-vconftool set -g 5000 -t string db/Services/Email/6/General/EmailAddr           ""
-vconftool set -g 5000 -t string db/Services/Email/6/General/UserId                      ""
-vconftool set -g 5000 -t string db/Services/Email/6/General/Password            ""
-vconftool set -g 5000 -t string db/Services/Email/6/General/LoginType           "username_type"
-
-# MailboxType : pop3(0), imap4(1) -> pop3(1), imap4(2) in email-service
-vconftool set -g 5000 -t int    db/Services/Email/6/Incoming/MailboxType        "0"
-vconftool set -g 5000 -t string db/Services/Email/6/Incoming/ServAddr       "pop.mail.yahoo.co.kr"
-vconftool set -g 5000 -t int    db/Services/Email/6/Incoming/Port           "995"
-vconftool set -g 5000 -t int    db/Services/Email/6/Incoming/Secure         "1"
-vconftool set -g 5000 -t bool   db/Services/Email/6/Incoming/Apop                       "0"
-vconftool set -g 5000 -t bool   db/Services/Email/6/Incoming/AutoEmailSync      "0"
-vconftool set -g 5000 -t bool   db/Services/Email/6/Incoming/IncludeAttach      "0"
-vconftool set -g 5000 -t int    db/Services/Email/6/Incoming/ImapFetchOpt       "1"
-
-vconftool set -g 5000 -t string db/Services/Email/6/Outgoing/ServAddr           "smtp.mail.yahoo.co.kr"
-vconftool set -g 5000 -t int    db/Services/Email/6/Outgoing/Port                       "465"
-vconftool set -g 5000 -t bool   db/Services/Email/6/Outgoing/SmtpAuth           "0"
-vconftool set -g 5000 -t int    db/Services/Email/6/Outgoing/Secure                     "1"
-vconftool set -g 5000 -t bool   db/Services/Email/6/Outgoing/SameIdPwd          "1"
-vconftool set -g 5000 -t bool   db/Services/Email/6/Outgoing/PopBeforeSmtp      "0"
+#if [ ${USER} = "root" ]
+#then
+
+       ## Setting
+       # Sending
+       vconftool set -g 5000 -t bool   db/Services/Email/Sending/KeepCopy                      "1"
+       vconftool set -g 5000 -t bool   db/Services/Email/Sending/SendMeCopy            "1"
+       vconftool set -g 5000 -t bool   db/Services/Email/Sending/ReqDeliveryRep        "0"
+       vconftool set -g 5000 -t bool   db/Services/Email/Sending/ReqReadRep            "0"
+       vconftool set -g 5000 -t int    db/Services/Email/Sending/Priority                      "1"
+       vconftool set -g 5000 -t string db/Services/Email/Sending/ActiveAccount         ""
+       vconftool set -g 5000 -t bool   db/Services/Email/Sending/IncBodyReply          "1"
+       vconftool set -g 5000 -t bool   db/Services/Email/Sending/IncAttachFwd          "1"
+       # Receiving
+       vconftool set -g 5000 -t int    db/Services/Email/Receiving/AutoPoll            "0"
+       vconftool set -g 5000 -t int    db/Services/Email/Receiving/PollTime            "0"
+       vconftool set -g 5000 -t int    db/Services/Email/Receiving/SendReadRep         "2"
+       vconftool set -g 5000 -t int    db/Services/Email/Receiving/Reclimit            "0"
+       vconftool set -g 5000 -t int    db/Services/Email/Receiving/FetchOption         "0"
+       vconftool set -g 5000 -t bool   db/Services/Email/Receiving/KeepServer          "1"
+       vconftool set -g 5000 -t int    db/Services/Email/Receiving/ServDelOption       "1"
+
+       vconftool set -g 5000 -t int    db/Services/Email/NbAccount                     "6"
+
+       ## Accounts
+
+       # Gmail
+       vconftool set -g 5000 -t string db/Services/Email/1/General/NetworkName         "default"
+       vconftool set -g 5000 -t string db/Services/Email/1/General/AccountName         "Gmail"
+       vconftool set -g 5000 -t string db/Services/Email/1/General/EmailAddr           ""
+       vconftool set -g 5000 -t string db/Services/Email/1/General/UserId                      ""
+       vconftool set -g 5000 -t string db/Services/Email/1/General/Password            ""
+       vconftool set -g 5000 -t string db/Services/Email/1/General/LoginType           "username_type"
+
+       # MailboxType : pop3(0), imap4(1) -> pop3(1), imap4(2) in email-service
+       vconftool set -g 5000 -t int    db/Services/Email/1/Incoming/MailboxType        "1"
+       vconftool set -g 5000 -t string db/Services/Email/1/Incoming/ServAddr       "imap.gmail.com"
+       vconftool set -g 5000 -t int    db/Services/Email/1/Incoming/Port           "993"
+       vconftool set -g 5000 -t int    db/Services/Email/1/Incoming/Secure         "1"
+       vconftool set -g 5000 -t bool   db/Services/Email/1/Incoming/Apop                       "0"
+       vconftool set -g 5000 -t bool   db/Services/Email/1/Incoming/AutoEmailSync      "0"
+       vconftool set -g 5000 -t bool   db/Services/Email/1/Incoming/IncludeAttach      "0"
+       vconftool set -g 5000 -t int    db/Services/Email/1/Incoming/ImapFetchOpt       "1"
+
+       vconftool set -g 5000 -t string db/Services/Email/1/Outgoing/ServAddr           "smtp.gmail.com"
+       vconftool set -g 5000 -t int    db/Services/Email/1/Outgoing/Port                       "465"
+       vconftool set -g 5000 -t bool   db/Services/Email/1/Outgoing/SmtpAuth           "0"
+       vconftool set -g 5000 -t int    db/Services/Email/1/Outgoing/Secure                     "1"
+       vconftool set -g 5000 -t bool   db/Services/Email/1/Outgoing/SameIdPwd          "1"
+       vconftool set -g 5000 -t bool   db/Services/Email/1/Outgoing/PopBeforeSmtp      "0"
+
+       # Hotmail
+       vconftool set -g 5000 -t string db/Services/Email/2/General/NetworkName         "default"
+       vconftool set -g 5000 -t string db/Services/Email/2/General/AccountName         "Hotmail"
+       vconftool set -g 5000 -t string db/Services/Email/2/General/EmailAddr           ""
+       vconftool set -g 5000 -t string db/Services/Email/2/General/UserId                      ""
+       vconftool set -g 5000 -t string db/Services/Email/2/General/Password            ""
+       vconftool set -g 5000 -t string db/Services/Email/2/General/LoginType           "username_type"
+
+       # MailboxType : pop3(0), imap4(1) -> pop3(1), imap4(2) in email-service
+       vconftool set -g 5000 -t int    db/Services/Email/2/Incoming/MailboxType        "0"
+       vconftool set -g 5000 -t string db/Services/Email/2/Incoming/ServAddr       "pop3.live.com"
+       vconftool set -g 5000 -t int    db/Services/Email/2/Incoming/Port           "995"
+       vconftool set -g 5000 -t int    db/Services/Email/2/Incoming/Secure         "1"
+       vconftool set -g 5000 -t bool   db/Services/Email/2/Incoming/Apop                       "0"
+       vconftool set -g 5000 -t bool   db/Services/Email/2/Incoming/AutoEmailSync      "0"
+       vconftool set -g 5000 -t bool   db/Services/Email/2/Incoming/IncludeAttach      "0"
+       vconftool set -g 5000 -t int    db/Services/Email/2/Incoming/ImapFetchOpt       "1"
+
+       vconftool set -g 5000 -t string db/Services/Email/2/Outgoing/ServAddr           "smtp.live.com"
+       vconftool set -g 5000 -t int    db/Services/Email/2/Outgoing/Port                       "587"
+       vconftool set -g 5000 -t bool   db/Services/Email/2/Outgoing/SmtpAuth           "0"
+       vconftool set -g 5000 -t int    db/Services/Email/2/Outgoing/Secure                     "2"
+       vconftool set -g 5000 -t bool   db/Services/Email/2/Outgoing/SameIdPwd          "1"
+       vconftool set -g 5000 -t bool   db/Services/Email/2/Outgoing/PopBeforeSmtp      "0"
+
+       # AOL
+       vconftool set -g 5000 -t string db/Services/Email/3/General/NetworkName         "default"
+       vconftool set -g 5000 -t string db/Services/Email/3/General/AccountName         "AOL"
+       vconftool set -g 5000 -t string db/Services/Email/3/General/EmailAddr           ""
+       vconftool set -g 5000 -t string db/Services/Email/3/General/UserId                      ""
+       vconftool set -g 5000 -t string db/Services/Email/3/General/Password            ""
+       vconftool set -g 5000 -t string db/Services/Email/3/General/LoginType           "username_type"
+
+       # MailboxType : pop3(0), imap4(1) -> pop3(1), imap4(2) in email-service
+       vconftool set -g 5000 -t int    db/Services/Email/3/Incoming/MailboxType        "1"
+       vconftool set -g 5000 -t string db/Services/Email/3/Incoming/ServAddr       "imap.aol.com"
+       vconftool set -g 5000 -t int    db/Services/Email/3/Incoming/Port           "143"
+       vconftool set -g 5000 -t int    db/Services/Email/3/Incoming/Secure         "0"
+       vconftool set -g 5000 -t bool   db/Services/Email/3/Incoming/Apop                       "0"
+       vconftool set -g 5000 -t bool   db/Services/Email/3/Incoming/AutoEmailSync      "0"
+       vconftool set -g 5000 -t bool   db/Services/Email/3/Incoming/IncludeAttach      "0"
+       vconftool set -g 5000 -t int    db/Services/Email/3/Incoming/ImapFetchOpt       "0"
+
+       vconftool set -g 5000 -t string db/Services/Email/3/Outgoing/ServAddr           "smtp.aol.com"
+       vconftool set -g 5000 -t int    db/Services/Email/3/Outgoing/Port                       "587"
+       vconftool set -g 5000 -t bool   db/Services/Email/3/Outgoing/SmtpAuth           "0"
+       vconftool set -g 5000 -t int    db/Services/Email/3/Outgoing/Secure                     "0"
+       vconftool set -g 5000 -t bool   db/Services/Email/3/Outgoing/SameIdPwd          "1"
+       vconftool set -g 5000 -t bool   db/Services/Email/3/Outgoing/PopBeforeSmtp      "0"
+
+       # Samsung 3G for test
+       vconftool set -g 5000 -t string db/Services/Email/4/General/NetworkName         "default"
+       vconftool set -g 5000 -t string db/Services/Email/4/General/AccountName         "Samsung 3G"
+       vconftool set -g 5000 -t string db/Services/Email/4/General/EmailAddr           ""
+       vconftool set -g 5000 -t string db/Services/Email/4/General/UserId                      ""
+       vconftool set -g 5000 -t string db/Services/Email/4/General/Password            ""
+       vconftool set -g 5000 -t string db/Services/Email/4/General/LoginType           "username_type"
+
+       # MailboxType : pop3(0), imap4(1) -> pop3(1), imap4(2) in email-service
+       vconftool set -g 5000 -t int    db/Services/Email/4/Incoming/MailboxType        "0"
+       vconftool set -g 5000 -t string db/Services/Email/4/Incoming/ServAddr       "165.213.73.235"
+       vconftool set -g 5000 -t int    db/Services/Email/4/Incoming/Port           "995"
+       vconftool set -g 5000 -t int    db/Services/Email/4/Incoming/Secure         "1"
+       vconftool set -g 5000 -t bool   db/Services/Email/4/Incoming/Apop                       "0"
+       vconftool set -g 5000 -t bool   db/Services/Email/4/Incoming/AutoEmailSync      "0"
+       vconftool set -g 5000 -t bool   db/Services/Email/4/Incoming/IncludeAttach      "0"
+       vconftool set -g 5000 -t int    db/Services/Email/4/Incoming/ImapFetchOpt       "1"
+
+       vconftool set -g 5000 -t string db/Services/Email/4/Outgoing/ServAddr           "165.213.73.235"
+       vconftool set -g 5000 -t int    db/Services/Email/4/Outgoing/Port                       "465"
+       vconftool set -g 5000 -t bool   db/Services/Email/4/Outgoing/SmtpAuth           "0"
+       vconftool set -g 5000 -t int    db/Services/Email/4/Outgoing/Secure                     "1"
+       vconftool set -g 5000 -t bool   db/Services/Email/4/Outgoing/SameIdPwd          "1"
+       vconftool set -g 5000 -t bool   db/Services/Email/4/Outgoing/PopBeforeSmtp      "0"
+
+       # Samsung Imap for test
+       vconftool set -g 5000 -t string db/Services/Email/5/General/NetworkName         "default"
+       vconftool set -g 5000 -t string db/Services/Email/5/General/AccountName         "Samsung Imap"
+       vconftool set -g 5000 -t string db/Services/Email/5/General/EmailAddr           ""
+       vconftool set -g 5000 -t string db/Services/Email/5/General/UserId                      ""
+       vconftool set -g 5000 -t string db/Services/Email/5/General/Password            ""
+       vconftool set -g 5000 -t string db/Services/Email/5/General/LoginType           "username_type"
+
+       # MailboxType : pop3(0), imap4(1) -> pop3(1), imap4(2) in email-service
+       vconftool set -g 5000 -t int    db/Services/Email/5/Incoming/MailboxType        "1"
+       vconftool set -g 5000 -t string db/Services/Email/5/Incoming/ServAddr       "165.213.73.235"
+       vconftool set -g 5000 -t int    db/Services/Email/5/Incoming/Port           "993"
+       vconftool set -g 5000 -t int    db/Services/Email/5/Incoming/Secure         "1"
+       vconftool set -g 5000 -t bool   db/Services/Email/5/Incoming/Apop                       "0"
+       vconftool set -g 5000 -t bool   db/Services/Email/5/Incoming/AutoEmailSync      "0"
+       vconftool set -g 5000 -t bool   db/Services/Email/5/Incoming/IncludeAttach      "0"
+       vconftool set -g 5000 -t int    db/Services/Email/5/Incoming/ImapFetchOpt       "1"
+
+       vconftool set -g 5000 -t string db/Services/Email/5/Outgoing/ServAddr           "165.213.73.235"
+       vconftool set -g 5000 -t int    db/Services/Email/5/Outgoing/Port                       "465"
+       vconftool set -g 5000 -t bool   db/Services/Email/5/Outgoing/SmtpAuth           "0"
+       vconftool set -g 5000 -t int    db/Services/Email/5/Outgoing/Secure                     "1"
+       vconftool set -g 5000 -t bool   db/Services/Email/5/Outgoing/SameIdPwd          "1"
+       vconftool set -g 5000 -t bool   db/Services/Email/5/Outgoing/PopBeforeSmtp      "0"
+
+
+       # Yahoo
+       vconftool set -g 5000 -t string db/Services/Email/6/General/NetworkName         "default"
+       vconftool set -g 5000 -t string db/Services/Email/6/General/AccountName         "Yahoomail"
+       vconftool set -g 5000 -t string db/Services/Email/6/General/EmailAddr           ""
+       vconftool set -g 5000 -t string db/Services/Email/6/General/UserId                      ""
+       vconftool set -g 5000 -t string db/Services/Email/6/General/Password            ""
+       vconftool set -g 5000 -t string db/Services/Email/6/General/LoginType           "username_type"
+
+       # MailboxType : pop3(0), imap4(1) -> pop3(1), imap4(2) in email-service
+       vconftool set -g 5000 -t int    db/Services/Email/6/Incoming/MailboxType        "0"
+       vconftool set -g 5000 -t string db/Services/Email/6/Incoming/ServAddr       "pop.mail.yahoo.co.kr"
+       vconftool set -g 5000 -t int    db/Services/Email/6/Incoming/Port           "995"
+       vconftool set -g 5000 -t int    db/Services/Email/6/Incoming/Secure         "1"
+       vconftool set -g 5000 -t bool   db/Services/Email/6/Incoming/Apop                       "0"
+       vconftool set -g 5000 -t bool   db/Services/Email/6/Incoming/AutoEmailSync      "0"
+       vconftool set -g 5000 -t bool   db/Services/Email/6/Incoming/IncludeAttach      "0"
+       vconftool set -g 5000 -t int    db/Services/Email/6/Incoming/ImapFetchOpt       "1"
+
+       vconftool set -g 5000 -t string db/Services/Email/6/Outgoing/ServAddr           "smtp.mail.yahoo.co.kr"
+       vconftool set -g 5000 -t int    db/Services/Email/6/Outgoing/Port                       "465"
+       vconftool set -g 5000 -t bool   db/Services/Email/6/Outgoing/SmtpAuth           "0"
+       vconftool set -g 5000 -t int    db/Services/Email/6/Outgoing/Secure                     "1"
+       vconftool set -g 5000 -t bool   db/Services/Email/6/Outgoing/SameIdPwd          "1"
+       vconftool set -g 5000 -t bool   db/Services/Email/6/Outgoing/PopBeforeSmtp      "0"
+
+#fi
+
+
+################################################################################################
+
+#if [ ${USER} = "root" ]
+#then
 
 vconftool set -t string db/email/preset_account/aol/sending_address   "smtp.aol.com"
 vconftool set -t int    db/email/preset_account/aol/sending_port      "587"
@@ -248,7 +306,23 @@ vconftool set -t string db/email/preset_account/hotmail/receiving_address "pop3.
 vconftool set -t int    db/email/preset_account/hotmail/receiving_port    "995"
 vconftool set -t int    db/email/preset_account/hotmail/receiving_ssl     "1"
 
-# for Active Sync       - Let email app create this key
+vconftool set -t string db/email/preset_account/samsung_pop3/sending_address   "165.213.73.235"
+vconftool set -t int    db/email/preset_account/samsung_pop3/sending_port      "465"
+vconftool set -t int    db/email/preset_account/samsung_pop3/sending_ssl       "1"
+vconftool set -t int    db/email/preset_account/samsung_pop3/receiving_type    "1"
+vconftool set -t string db/email/preset_account/samsung_pop3/receiving_address "165.213.73.235"
+vconftool set -t int    db/email/preset_account/samsung_pop3/receiving_port    "995"
+vconftool set -t int    db/email/preset_account/samsung_pop3/receiving_ssl     "1"
+
+vconftool set -t string db/email/preset_account/samsung_imap4/sending_address   "165.213.73.235"
+vconftool set -t int    db/email/preset_account/samsung_imap4/sending_port      "465"
+vconftool set -t int    db/email/preset_account/samsung_imap4/sending_ssl       "1"
+vconftool set -t int    db/email/preset_account/samsung_imap4/receiving_type    "2"
+vconftool set -t string db/email/preset_account/samsung_imap4/receiving_address "165.213.73.235"
+vconftool set -t int    db/email/preset_account/samsung_imap4/receiving_port    "993"
+vconftool set -t int    db/email/preset_account/samsung_imap4/receiving_ssl     "1"
+
+# for Active Sync      - Let email app create this key
 #vconftool set -t int    db/email_handle/active_sync_handle     "0"
 
 # for contact sync - sync from the first contact change
@@ -258,8 +332,9 @@ vconftool set -t int    db/email/last_sync_time "0"
 vconftool set -t int    db/email/slot_size "100"
 
 # for badge
-vconftool set -t int    db/badge/org.tizen.email "0"
+vconftool set -t int   db/badge/com.samsung.email "0"
 
+#fi
 
 echo "[EMAIL-SERVICE] Finish adding preset account information"
 
@@ -272,11 +347,11 @@ EMAIL_SERVICE_EXEC_SCRIPT=/etc/rc.d/init.d/email-service
 EMAIL_SERVICE_BOOT_SCRIPT=/etc/rc.d/rc3.d/S70email-service
 EMAIL_SERVICE_FASTBOOT_SCRIPT=/etc/rc.d/rc5.d/S70email-service
 echo '#!/bin/sh' > ${EMAIL_SERVICE_EXEC_SCRIPT}
-echo '/usr/bin/email-service &' >> ${EMAIL_SERVICE_EXEC_SCRIPT}
+echo '/usr/bin/email-service &' >> ${EMAIL_SERVICE_EXEC_SCRIPT} 
 chmod 755 ${EMAIL_SERVICE_EXEC_SCRIPT}
 rm -rf ${EMAIL_SERVICE_BOOT_SCRIPT}
 rm -rf ${EMAIL_SERVICE_FASTBOOT_SCRIPT}
-ln -s ${EMAIL_SERVICE_EXEC_SCRIPT} ${EMAIL_SERVICE_BOOT_SCRIPT}
+ln -s ${EMAIL_SERVICE_EXEC_SCRIPT} ${EMAIL_SERVICE_BOOT_SCRIPT} 
 ln -s ${EMAIL_SERVICE_EXEC_SCRIPT} ${EMAIL_SERVICE_FASTBOOT_SCRIPT}
 echo "[EMAIL-SERVICE] Finish executing script ..."
 
@@ -285,174 +360,184 @@ echo "[EMAIL-SERVICE] Finish executing script ..."
 #################################################################
 echo "[EMAIL-SERVICE] Creating Email Tables ..."
 sqlite3 /opt/dbspace/.email-service.db 'PRAGMA journal_mode = PERSIST;
-CREATE TABLE mail_account_tbl
-(
-        account_bind_type INTEGER,
-        account_name varchar(51),
-        receiving_server_type INTEGER,
-        receiving_server_addr varchar(51),
-        email_addr varchar(129),
-        user_name varchar(51),
-        password varchar(51),
-        retrieval_mode INTEGER,
-        port_num INTEGER,
-        use_security INTEGER,
-        sending_server_type INTEGER,
-        sending_server_addr varchar(51),
-        sending_port_num INTEGER,
-        sending_auth INTEGER,
-        sending_security INTEGER,
-        sending_user varchar(51),
-        sending_password varchar(51),
-        display_name varchar(31),
-        reply_to_addr varchar(129),
-        return_addr varchar(129),
-        account_id INTEGER,
-        keep_on_server INTEGER,
-        flag1 INTEGER,
-        flag2 INTEGER,
-        pop_before_smtp INTEGER,
-        apop INTEGER,
-        logo_icon_path varchar(256),
-        preset_account INTEGER,
-        target_storage INTEGER,
-        check_interval INTEGER,
-        priority INTEGER,
-        keep_local_copy INTEGER,
-        req_delivery_receipt INTEGER,
-        req_read_receipt INTEGER,
-        download_limit INTEGER,
-        block_address INTEGER,
-        block_subject INTEGER,
-        display_name_from varchar(256),
-        reply_with_body INTEGER,
-        forward_with_files INTEGER,
-        add_myname_card INTEGER,
-        add_signature INTEGER,
-        signature varchar(256),
-        add_my_address_to_bcc INTEGER,
-        my_account_id INTEGER,
-        index_color INTEGER
+CREATE TABLE mail_account_tbl 
+( 
+       account_bind_type                INTEGER,
+       account_name                     VARCHAR(51),
+       receiving_server_type            INTEGER,
+       receiving_server_addr            VARCHAR(51),
+       email_addr                       VARCHAR(129),
+       user_name                        VARCHAR(51),
+       password                         VARCHAR(51),
+       retrieval_mode                   INTEGER,
+       port_num                         INTEGER,
+       use_security                     INTEGER,
+       sending_server_type              INTEGER,
+       sending_server_addr              VARCHAR(51),
+       sending_port_num                 INTEGER,
+       sending_auth                     INTEGER,
+       sending_security                 INTEGER,
+       sending_user                     VARCHAR(51),
+       sending_password                 VARCHAR(51),
+       display_name                     VARCHAR(31),
+       reply_to_addr                    VARCHAR(129),
+       return_addr                      VARCHAR(129),
+       account_id                       INTEGER PRIMARY KEY,
+       keep_on_server                   INTEGER,
+       flag1                            INTEGER,
+       flag2                            INTEGER,
+       pop_before_smtp                  INTEGER,
+       apop                             INTEGER,
+       logo_icon_path                   VARCHAR(256),
+       preset_account                   INTEGER,
+       target_storage                   INTEGER,
+       check_interval                   INTEGER,
+       priority                         INTEGER,
+       keep_local_copy                  INTEGER,
+       req_delivery_receipt             INTEGER,
+       req_read_receipt                 INTEGER,
+       download_limit                   INTEGER,
+       block_address                    INTEGER,
+       block_subject                    INTEGER,
+       display_name_from                VARCHAR(256),
+       reply_with_body                  INTEGER,
+       forward_with_files               INTEGER,
+       add_myname_card                  INTEGER,
+       add_signature                    INTEGER,
+       signature                        VARCHAR(256),
+       add_my_address_to_bcc            INTEGER,
+       my_account_id                    INTEGER,
+       index_color                      INTEGER,
+       sync_status                      INTEGER
 );
 
-CREATE TABLE mail_attachment_tbl
-(
-        attachment_id       INTEGER PRIMARY KEY,
-        attachment_name     varchar(257),
-        attachment_path     varchar(257),
-        attachment_size     INTEGER,
-        mail_id             INTEGER,
-        account_id          INTEGER,
-        mailbox_name        varchar(129),
-        file_yn             INTEGER,
-        flag1               INTEGER,
-        flag2               INTEGER,
-        flag3               INTEGER
+CREATE TABLE mail_attachment_tbl 
+( 
+       attachment_id                    INTEGER PRIMARY KEY,
+       attachment_name                  VARCHAR(257),
+       attachment_path                  VARCHAR(257),
+       attachment_size                  INTEGER,
+       mail_id                          INTEGER,
+       account_id                       INTEGER,
+       mailbox_name                     VARCHAR(129),
+       attachment_save_status           INTEGER,
+       attachment_drm_type              INTEGER,
+       attachment_drm_method            INTEGER,
+       attachment_inline_content_status INTEGER,
+       attachment_mime_type             VARCHAR(257)
 );
 
-CREATE TABLE mail_box_tbl
-(
-        mailbox_id                  INTEGER,
-        account_id                  INTEGER,
-        local_yn                    INTEGER,
-        mailbox_name                varchar(256),
-        mailbox_type                INTEGER,
-        alias                       varchar(256),
-        sync_with_server_yn         INTEGER,
-        modifiable_yn               INTEGER,
-        total_mail_count_on_server  INTEGER,
-        has_archived_mails          INTEGER,
-        mail_slot_size              INTEGER
+CREATE TABLE mail_box_tbl 
+(    
+       mailbox_id                       INTEGER,
+       account_id                       INTEGER,
+       local_yn                         INTEGER,
+       mailbox_name                     VARCHAR(256),    
+       mailbox_type                     INTEGER,    
+       alias                            VARCHAR(256),    
+       sync_with_server_yn              INTEGER,    
+       modifiable_yn                    INTEGER,    
+       total_mail_count_on_server       INTEGER,
+       has_archived_mails               INTEGER,    
+       mail_slot_size                   INTEGER
 );
-CREATE TABLE mail_read_mail_uid_tbl
-(
-        account_id            INTEGER ,
-        local_mbox                 varchar(129)  ,
-        local_uid             INTEGER ,
-        mailbox_name       varchar(129)  ,
-        s_uid                       varchar(129)  ,
-        data1                       INTEGER ,
-        data2                        varchar(257)  ,
-        flag                    INTEGER ,
-        idx_num              INTEGER  PRIMARY KEY
+CREATE TABLE mail_read_mail_uid_tbl          
+(    
+       account_id                       INTEGER ,
+       local_mbox                       VARCHAR(129)  ,
+       local_uid                        INTEGER ,
+       mailbox_name                     VARCHAR(129)  ,
+       s_uid                            VARCHAR(129)  ,
+       data1                            INTEGER ,
+       data2                            VARCHAR(257)  ,
+       flag                             INTEGER ,
+       idx_num                          INTEGER  PRIMARY KEY
 );
-CREATE TABLE mail_rule_tbl
-(
-        account_id     INTEGER ,
-        rule_id        INTEGER  PRIMARY KEY,
-        type           INTEGER ,
-        value          varchar(257)  ,
-        action_type    INTEGER ,
-        dest_mailbox   varchar(129),
-        flag1          INTEGER  ,
-        flag2          INTEGER
+CREATE TABLE mail_rule_tbl          
+(    
+       account_id                       INTEGER ,
+       rule_id                          INTEGER  PRIMARY KEY,
+       type                             INTEGER ,
+       value                            VARCHAR(257)  ,
+       action_type                      INTEGER ,
+       dest_mailbox                     VARCHAR(129),
+       flag1                            INTEGER  ,
+       flag2                            INTEGER    
 );
 CREATE TABLE mail_tbl
 (
-        mail_id                   INTEGER,
-        account_id                INTEGER,
-        mailbox_name              VARCHAR(129),
-        mailbox_type              INTEGER,
-        subject                   UCS2TEXT,
-        date_time                 VARCHAR(129),
-        server_mail_status        INTEGER,
-        server_mailbox_name       VARCHAR(129),
-        server_mail_id            VARCHAR(129),
-        message_id                VARCHAR(257),
-        full_address_from         UCS2TEXT,
-        full_address_reply        UCS2TEXT,
-        full_address_to           UCS2TEXT,
-        full_address_cc           UCS2TEXT,
-        full_address_bcc          UCS2TEXT,
-        full_address_return       UCS2TEXT,
-        email_address_sender      UCS2TEXT collation user1,
-        email_address_recipient   UCS2TEXT collation user1,
-        alias_sender              UCS2TEXT,
-        alias_recipient           UCS2TEXT,
-        body_download_status      INTEGER,
-        file_path_plain           VARCHAR(257),
-        file_path_html            VARCHAR(257),
-        mail_size                 INTEGER,
-        mail_status               INTEGER,
-        DRM_status                INTEGER,
-        priority                  INTEGER,
-        save_status               INTEGER,
-        lock_status               INTEGER,
-        report_status             INTEGER,
-        attachment_count          INTEGER,
-        inline_content_count      INTEGER,
-        thread_id                 INTEGER,
-        thread_item_count         INTEGER,
-        preview_text              UCS2TEXT,
-        meeting_request_status    INTEGER
+       mail_id                          INTEGER PRIMARY_KEY,
+       account_id                       INTEGER,
+       mailbox_id                       INTEGER,
+       mailbox_name                     VARCHAR(129),
+       mailbox_type                     INTEGER,
+       subject                          TEXT,
+       date_time                        DATETIME,
+       server_mail_status               INTEGER,
+       server_mailbox_name              VARCHAR(129),
+       server_mail_id                   VARCHAR(129),
+       message_id                       VARCHAR(257),
+       full_address_from                TEXT,
+       full_address_reply               TEXT,
+       full_address_to                  TEXT,
+       full_address_cc                  TEXT,
+       full_address_bcc                 TEXT,
+       full_address_return              TEXT,
+       email_address_sender             TEXT collation user1,
+       email_address_recipient          TEXT collation user1,
+       alias_sender                     TEXT,
+       alias_recipient                  TEXT,
+       body_download_status             INTEGER,
+       file_path_plain                  VARCHAR(257),
+       file_path_html                   VARCHAR(257),
+       mail_size                        INTEGER,
+       flags_seen_field                 BOOLEAN,
+       flags_deleted_field              BOOLEAN,
+       flags_flagged_field              BOOLEAN,
+       flags_answered_field             BOOLEAN,
+       flags_recent_field               BOOLEAN,
+       flags_draft_field                BOOLEAN,
+       flags_forwarded_field            BOOLEAN,
+       DRM_status                       INTEGER,
+       priority                         INTEGER,
+       save_status                      INTEGER,
+       lock_status                      INTEGER,
+       report_status                    INTEGER,
+       attachment_count                 INTEGER,
+       inline_content_count             INTEGER,
+       thread_id                        INTEGER,
+       thread_item_count                INTEGER,
+       preview_text                     TEXT, 
+       meeting_request_status           INTEGER,
+       FOREIGN KEY(account_id)          REFERENCES mail_account_tbl(account_id)
 );
 CREATE TABLE mail_meeting_tbl
 (
-        mail_id             INTEGER PRIMARY KEY,
-        account_id          INTEGER,
-        mailbox_name        UCS2TEXT ,
-        meeting_response        INTEGER,
-        start_time          INTEGER,
-        end_time            INTEGER,
-        location            UCS2TEXT ,
-        global_object_id    UCS2TEXT ,
-        offset              INTEGER,
-        standard_name       UCS2TEXT ,
-        standard_time_start_date          INTEGER,
-        standard_bias       INTEGER,
-        daylight_name       UCS2TEXT ,
-        daylight_time_start_date          INTEGER,
-        daylight_bias       INTEGER
+       mail_id                          INTEGER PRIMARY KEY,
+       account_id                       INTEGER,
+       mailbox_name                     TEXT ,
+       meeting_response                 INTEGER,
+       start_time                       INTEGER,
+       end_time                         INTEGER,
+       location                         TEXT ,
+       global_object_id                 TEXT ,
+       offset                           INTEGER,
+       standard_name                    TEXT ,
+       standard_time_start_date         INTEGER,
+       standard_bias                    INTEGER,
+       daylight_name                    TEXT ,
+       daylight_time_start_date         INTEGER,
+       daylight_bias                    INTEGER
 );
-CREATE TABLE mail_local_activity_tbl
-(
-        activity_id              INTEGER,
-        account_id       INTEGER,
-        mail_id                  INTEGER,
-        activity_type    INTEGER,
-        server_mailid    VARCHAR(129),
-        src_mbox                 VARCHAR(129),
-        dest_mbox                VARCHAR(129)
+CREATE TABLE mail_local_activity_tbl  
+(  
+       activity_id                      INTEGER,
+       account_id                       INTEGER,
+       mail_id                          INTEGER,
+       activity_type                    INTEGER, 
+       server_mailid                    VARCHAR(129),
+       src_mbox                         VARCHAR(129),
+       dest_mbox                        VARCHAR(129) 
 );
 
 
@@ -501,8 +586,8 @@ echo "[EMAIL-SERVICE] Finish Creating Email Tables."
 #chmod 700 /usr/bin/email-service
 
 # 3. DB files
-chmod 644 /opt/dbspace/.email-service.db
-chmod 644 /opt/dbspace/.email-service.db-journal
+chmod 644 /opt/dbspace/.email-service.db                                   
+chmod 644 /opt/dbspace/.email-service.db-journal       
 
 
 #################################################################
@@ -510,78 +595,55 @@ chmod 644 /opt/dbspace/.email-service.db-journal
 #################################################################
 #echo "[EMAIL-SERVICE] Start setting owner ..."
 
-        # 1. libraries
-#       chown root:root /usr/lib/libemail-ipc.so.0.0.0
-#       chown root:root /usr/lib/libemail-core.so.0.0.0
-#       chown root:root /usr/lib/libemail-emn-storage.so.0.0.0
-#       chown root:root /usr/lib/libemail-base.so.0.0.0
-#       chown root:root /usr/lib/libem-storage.so.0.0.0
-#       chown root:root /usr/lib/libem-network.so.0.0.0
-#       chown root:root /usr/lib/libemail-mapi.so.0.0.0
-#       chown root:root /usr/lib/libem-storage.so
-#       chown root:root /usr/lib/libemail-base.so.0
-#       chown root:root /usr/lib/libem-network.so.0
-#       chown root:root /usr/lib/libemail-core.so.0
-#       chown root:root /usr/lib/libemail-emn-storage.so
-#       chown root:root /usr/lib/libemail-ipc.so
-#       chown root:root /usr/lib/libemail-mapi.so.0
-#       chown root:root /usr/lib/libem-storage.so.0
-#       chown root:root /usr/lib/libem-network.so
-#       chown root:root /usr/lib/libemail-ipc.so.0
-#       chown root:root /usr/lib/libemail-core.so
-#       chown root:root /usr/lib/libemail-base.so
-#       chown root:root /usr/lib/libemail-mapi.so
-#       chown root:root /usr/lib/libemail-emn-storage.so.0
-
-        # 2. executables
-#       chown root:root /usr/bin/email-service_initDB
-#       chown root:root /usr/bin/email-service
-
-        # 3. DB files
-chown root:root /opt/dbspace/.email-service.db
-chown root:root /opt/dbspace/.email-service.db-journal
+       # 1. libraries
+#      chown root:root /usr/lib/libemail-ipc.so.0.0.0
+#      chown root:root /usr/lib/libemail-core.so.0.0.0
+#      chown root:root /usr/lib/libemail-emn-storage.so.0.0.0
+#      chown root:root /usr/lib/libemail-base.so.0.0.0
+#      chown root:root /usr/lib/libem-storage.so.0.0.0
+#      chown root:root /usr/lib/libem-network.so.0.0.0
+#      chown root:root /usr/lib/libemail-mapi.so.0.0.0
+#      chown root:root /usr/lib/libem-storage.so
+#      chown root:root /usr/lib/libemail-base.so.0
+#      chown root:root /usr/lib/libem-network.so.0
+#      chown root:root /usr/lib/libemail-core.so.0
+#      chown root:root /usr/lib/libemail-emn-storage.so
+#      chown root:root /usr/lib/libemail-ipc.so
+#      chown root:root /usr/lib/libemail-mapi.so.0
+#      chown root:root /usr/lib/libem-storage.so.0
+#      chown root:root /usr/lib/libem-network.so
+#      chown root:root /usr/lib/libemail-ipc.so.0
+#      chown root:root /usr/lib/libemail-core.so
+#      chown root:root /usr/lib/libemail-base.so
+#      chown root:root /usr/lib/libemail-mapi.so
+#      chown root:root /usr/lib/libemail-emn-storage.so.0
+
+       # 2. executables
+#      chown root:root /usr/bin/email-service_initDB
+#      chown root:root /usr/bin/email-service
+
+       # 3. DB files
+#if [ ${USER} = "root" ]
+#then
+    chown root:root /opt/dbspace/.email-service.db
+    chown root:root /opt/dbspace/.email-service.db-journal
+#fi
 
 %postun -p /sbin/ldconfig
 
 
 
 %files
-%defattr(-,root,root,-)
 %exclude /opt/dbspace/.email-service.db
 %exclude /opt/dbspace/.email-service.db-journal
-%exclude %{_bindir}/email-test-app
-%{_libdir}/libemail-api.so.*
-%{_libdir}/libemail-base.so.*
-%{_libdir}/libemail-core.so.*
-%{_libdir}/libemail-ipc.so.*
-%{_libdir}/libemail-network.so.*
-%{_libdir}/libemail-storage.so.*
+%exclude /usr/bin/email-test-app
+%{_libdir}/lib*.so.*
 %{_bindir}/email-service
-/opt/apps/email-service/res/locale/de_DE/LC_MESSAGES/email.mo
-/opt/apps/email-service/res/locale/el_GR/LC_MESSAGES/email.mo
-/opt/apps/email-service/res/locale/en/LC_MESSAGES/email.mo
-/opt/apps/email-service/res/locale/es_ES/LC_MESSAGES/email.mo
-/opt/apps/email-service/res/locale/fr_FR/LC_MESSAGES/email.mo
-/opt/apps/email-service/res/locale/it_IT/LC_MESSAGES/email.mo
-/opt/apps/email-service/res/locale/ja_JP/LC_MESSAGES/email.mo
-/opt/apps/email-service/res/locale/ko_KR/LC_MESSAGES/email.mo
-/opt/apps/email-service/res/locale/nl_NL/LC_MESSAGES/email.mo
-/opt/apps/email-service/res/locale/pt_PT/LC_MESSAGES/email.mo
-/opt/apps/email-service/res/locale/ru_RU/LC_MESSAGES/email.mo
-/opt/apps/email-service/res/locale/tr_TR/LC_MESSAGES/email.mo
-/opt/apps/email-service/res/locale/zh_CN/LC_MESSAGES/email.mo
-/opt/apps/email-service/res/locale/zh_HK/LC_MESSAGES/email.mo
-/opt/apps/email-service/res/locale/zh_TW/LC_MESSAGES/email.mo
 
 
 %files devel
-%defattr(-,root,root,-)
 %{_includedir}/email-service/*.h
-%{_libdir}/libemail-api.so
-%{_libdir}/libemail-base.so
-%{_libdir}/libemail-core.so
-%{_libdir}/libemail-ipc.so
-%{_libdir}/libemail-network.so
-%{_libdir}/libemail-storage.so
+%{_libdir}/lib*.so
 %{_libdir}/pkgconfig/*.pc
 
+
diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt
deleted file mode 100755 (executable)
index b27e5bc..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-# for i18n
-
-#SET(POFILES en_US.po en_GB.po ja.po ko.po zh_CN.po)
-#SET(POFILES de.po el.po en_US.po es.po fr.po it.po ja.po ko.po nl.po pt.po ru.po tk.po zh_CN.po zh_HK.po zh_TW.po)
-SET(POFILES en.po nl_NL.po de_DE.po zh_HK.po zh_CN.po ru_RU.po ko_KR.po zh_TW.po ja_JP.po es_ES.po el_GR.po it_IT.po tr_TR.po pt_PT.po fr_FR.po)
-
-SET(MSGFMT "/usr/bin/msgfmt")
-
-FOREACH(pofile ${POFILES})
-       SET(pofile ${CMAKE_CURRENT_SOURCE_DIR}/${pofile})
-       MESSAGE("PO: ${pofile}")
-       GET_FILENAME_COMPONENT(absPofile ${pofile} ABSOLUTE)
-       GET_FILENAME_COMPONENT(lang ${absPofile} NAME_WE)
-       SET(moFile ${CMAKE_CURRENT_BINARY_DIR}/${lang}.mo)
-       ADD_CUSTOM_COMMAND(
-                       OUTPUT ${moFile}
-                       COMMAND ${MSGFMT} -o ${moFile} ${absPofile}
-                       DEPENDS ${absPofile}
-       )
-
-       INSTALL(FILES ${moFile}
-                       DESTINATION /opt/apps/email-service/res/locale/${lang}/LC_MESSAGES RENAME email.mo)
-
-       SET(moFiles ${moFiles} ${moFile})
-ENDFOREACH(pofile)
-
-MESSAGE(".mo files: ${moFiles}")
-ADD_CUSTOM_TARGET(po ALL DEPENDS ${moFiles})
diff --git a/po/POTFILES.in b/po/POTFILES.in
deleted file mode 100755 (executable)
index dcff06f..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-# List of source files containing translatable strings.
-account/email-account.c
-block/email-block.c
-common/email-debug.c
-common/email-dialog-util.c
-common/email-drm-util.c
-common/email-engine.c
-common/email-evt-delivery-util.c
-common/email-external.c
-common/email-gconf-util.c
-common/email-html-converter.c
-common/email-ime-util.c
-common/email-launch-ext.c
-common/email-settings.c
-common/email-utils.c
-mailbox/email-mailbox.c
-main/email.c
-popup/email-popup.c
-setting/email-setting.c
-setting/email-setting-account-set.c
-setting/email-setting-utils.c
-setting/email-setting-view.c
-setting/email-view-account-edit.c
-setting/email-view-account-options.c
-setting/email-view-default-account.c
-setting/email-view-other-account.c
-setting/email-view-receiving-option-mailbox-setup.c
-setting/email-view-receiving-option-size.c
-setting/email-view-select-account.c
-setting/email-view-server-type.c
-setting/email-view-setting.c
-setting/email-view-show-email-list.c
-viewer/email-viewer.c
-viewer/email-viewer-logic.c
-viewer/email-viewer-multitouch.c
-viewer/email-viewer-utils.c
-viewer/email-viewer-webview.c
-composer/email-composer.c
-composer/email-composer-attachment.c
-composer/email-composer-callback.c
-composer/email-composer-contents.c
-composer/email-composer-predictive-search.c
-composer/email-composer-recent.c
-composer/email-composer-recipient.c
-composer/email-composer-ug-caller.c
-composer/email-composer-util.c
\ No newline at end of file
diff --git a/po/de_DE.po b/po/de_DE.po
deleted file mode 100755 (executable)
index 1f476fd..0000000
+++ /dev/null
@@ -1,465 +0,0 @@
-msgid "IDS_EMAIL_POP_NO_EMAIL_ADDRESS"
-msgstr "Keine E-Mail-Adresse"
-
-msgid "IDS_EMAIL_BODY_COMPLETE"
-msgstr "Abgeschlossen"
-
-msgid "IDS_EMAIL_BODY_ACCEPTED_C_PS"
-msgstr "Angenommen: %s"
-
-msgid "IDS_EMAIL_BODY_DECLINED_C_PS"
-msgstr "Abgelehnt: %s"
-
-msgid "IDS_EMAIL_BODY_DOWNLOAD_FULL_MESSAGE"
-msgstr "Vollständige Nachricht herunterladen"
-
-msgid "IDS_EMAIL_BODY_GENERAL_SETTINGS"
-msgstr "Allgemeine Einstellungen"
-
-msgid "IDS_EMAIL_BODY_TENTATIVE_C_PS"
-msgstr "Vorläufig: %s"
-
-msgid "IDS_EMAIL_BODY_WHEN_C_PS"
-msgstr "Wann: %s"
-
-msgid "IDS_EMAIL_BODY_WHERE_C_PS"
-msgstr "Wo: %s"
-
-msgid "IDS_EMAIL_BUTTON_DECLINE_ABB"
-msgstr "Ablehnen"
-
-msgid "IDS_EMAIL_BODY_NO_CONTENTS"
-msgstr "Kein Inhalt"
-
-msgid "IDS_EMAIL_BODY_ORIGINAL_MESSAGE"
-msgstr "Ursprüngliche Nachricht"
-
-msgid "IDS_EMAIL_HEADER_ACCOUNT_SETTINGS"
-msgstr "Kontoeinstellungen"
-
-msgid "IDS_EMAIL_OPT_BLOCK"
-msgstr "Sperren"
-
-msgid "IDS_EMAIL_OPT_MARK_AS_READ"
-msgstr "Als gelesen markieren"
-
-msgid "IDS_EMAIL_OPT_MARK_AS_UNREAD"
-msgstr "Als ungelesen markieren"
-
-msgid "IDS_EMAIL_OPT_OTHERS"
-msgstr "Sonstiges"
-
-msgid "IDS_EMAIL_OPT_UNREAD"
-msgstr "Ungelesen"
-
-msgid "IDS_EMAIL_SK_COMPOSE"
-msgstr "Verfassen"
-
-msgid "IDS_EMAIL_HEADER_DOWNLOAD_FAILED"
-msgstr "Herunterladen fehlgeschlagen"
-
-msgid "IDS_EMAIL_OPT_ADD_TO_CONTACT"
-msgstr "Zu Kontakt hinzufügen"
-
-msgid "IDS_EMAIL_OPT_VOICE_CALL"
-msgstr "Sprachanruf"
-
-msgid "IDS_EMAIL_BODY_ACCOUNT_NAME"
-msgstr "Kontoname"
-
-msgid "IDS_EMAIL_BODY_ATTACHMENTS"
-msgstr "Anhänge"
-
-msgid "IDS_EMAIL_BODY_FROM_C"
-msgstr "Von:"
-
-msgid "IDS_EMAIL_BODY_IMAP4_SERVER"
-msgstr "IMAP4-Server"
-
-msgid "IDS_EMAIL_BODY_INCLUDES"
-msgstr "Enthält"
-
-msgid "IDS_EMAIL_BODY_INCOMING_PORT"
-msgstr "Eingangsport"
-
-msgid "IDS_EMAIL_BODY_INCOMING_SERVER"
-msgstr "Eingangsserver"
-
-msgid "IDS_EMAIL_BODY_IN_PD_MINUTES"
-msgstr "In %d Minuten"
-
-msgid "IDS_EMAIL_BODY_KEEP_IN_SERVER"
-msgstr "Auf Server behalten"
-
-msgid "IDS_EMAIL_BODY_NO_TEXT"
-msgstr "Kein Text"
-
-msgid "IDS_EMAIL_BODY_OUTGOING_PORT"
-msgstr "Ausgangs-Port"
-
-msgid "IDS_EMAIL_BODY_OUTGOING_SERVER"
-msgstr "Ausgangsserver"
-
-msgid "IDS_EMAIL_BODY_PD_EMAILS"
-msgstr "%d E-Mails"
-
-msgid "IDS_EMAIL_BODY_POP3_SERVER"
-msgstr "POP3-Server"
-
-msgid "IDS_EMAIL_BODY_RECENT"
-msgstr "Kürzlich"
-
-msgid "IDS_EMAIL_BODY_RETRIEVING_OPTIONS"
-msgstr "Abrufoptionen"
-
-msgid "IDS_EMAIL_BODY_RE_C"
-msgstr "AW:"
-
-msgid "IDS_EMAIL_BODY_SENT_C"
-msgstr "Gesendet:"
-
-msgid "IDS_EMAIL_BODY_SENT_FROM_SAMSUNG_MOBILE"
-msgstr "Von Samsung Mobile gesendet"
-
-msgid "IDS_EMAIL_BODY_USER_PASSWORD"
-msgstr "Benutzerpasswort"
-
-msgid "IDS_EMAIL_HEADER_EDIT_RULES"
-msgstr "Regeln bearbeiten"
-
-msgid "IDS_EMAIL_HEADER_EMAIL_SETTINGS"
-msgstr "E-Mail Einstellungen"
-
-msgid "IDS_EMAIL_HEADER_MAILBOXES"
-msgstr "Mailboxen"
-
-msgid "IDS_EMAIL_POP_ALERT"
-msgstr "Signal"
-
-msgid "IDS_EMAIL_POP_FILE_ALREADY_EXISTS"
-msgstr "Datei bereits vorhanden."
-
-msgid "IDS_EMAIL_POP_NO_SENDER"
-msgstr "Kein Absender"
-
-msgid "IDS_EMAIL_POP_SUCCEEDED"
-msgstr "Erfolgreich"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ATTACH_MAXIMUM_NUMBER_OF_FILES_IS_PD"
-msgstr "Anhängen nicht möglich. Maximale Dateianzahl ist %d"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ATTACH_MAXIMUM_SIZE_OF_FILES_IS_PD_KB"
-msgstr "Anhängen nicht möglich. Maximale Dateigröße ist %d KB"
-
-msgid "IDS_EMAIL_POP_VALIDATION_FAILED"
-msgstr "Validierung fehlgeschlagen"
-
-msgid "IDS_EMAIL_SK_REPLY_ALL"
-msgstr "Allen antworten"
-
-msgid "IDS_EMAIL_BODY_1_ITEM"
-msgstr "1 Element"
-
-msgid "IDS_EMAIL_BODY_ADD_MY_NAMECARD"
-msgstr "Eigene Visitenkarte hinzufügen"
-
-msgid "IDS_EMAIL_BODY_ADD_SIGNATURE"
-msgstr "Signatur anfügen"
-
-msgid "IDS_EMAIL_BODY_ALL_EMAILS"
-msgstr "Alle E-Mails"
-
-msgid "IDS_EMAIL_BODY_ALWAYS_BCC_MYSELF"
-msgstr "Mich immer Bcc setzen"
-
-msgid "IDS_EMAIL_BODY_BCC"
-msgstr "Bcc"
-
-msgid "IDS_EMAIL_BODY_BLOCK_EMAILS"
-msgstr "E-Mails sperren"
-
-msgid "IDS_EMAIL_BODY_BODY"
-msgstr "Körper"
-
-msgid "IDS_EMAIL_BODY_CC"
-msgstr "Cc"
-
-msgid "IDS_EMAIL_BODY_CC_BCC"
-msgstr "Cc/Bcc"
-
-msgid "IDS_EMAIL_BODY_CHECK_INTERVAL"
-msgstr "Prüfintervall"
-
-msgid "IDS_EMAIL_BODY_DEFAULT_ACCOUNT"
-msgstr "Standardkonto"
-
-msgid "IDS_EMAIL_BODY_DRAFTS"
-msgstr "Entwürfe"
-
-msgid "IDS_EMAIL_BODY_EMAIL_ACCOUNTS"
-msgstr "E-Mail-Konten"
-
-msgid "IDS_EMAIL_BODY_END_TIME"
-msgstr "Endzeit"
-
-msgid "IDS_EMAIL_BODY_ENTIRE_EMAIL"
-msgstr "Gesamte E-Mail"
-
-msgid "IDS_EMAIL_BODY_EXACTLY_THE_SAME_AS"
-msgstr "Identisch mit"
-
-msgid "IDS_EMAIL_BODY_EXAMPLE"
-msgstr "Beispiel"
-
-msgid "IDS_EMAIL_BODY_FROM_M_SENDER"
-msgstr "Von:"
-
-msgid "IDS_EMAIL_BODY_INBOX"
-msgstr "Posteingang"
-
-msgid "IDS_EMAIL_BODY_INCLUDE"
-msgstr "Enthält"
-
-msgid "IDS_EMAIL_BODY_MATCH_CRITERIA"
-msgstr "Passende Kriterien"
-
-msgid "IDS_EMAIL_BODY_NOT_USED"
-msgstr "Nicht verwendet"
-
-msgid "IDS_EMAIL_BODY_NO_ACCOUNTS"
-msgstr "Keine Konten"
-
-msgid "IDS_EMAIL_BODY_PD_DAYS"
-msgstr "%d Tage"
-
-msgid "IDS_EMAIL_BODY_PD_ITEMS"
-msgstr "%d Einträge"
-
-msgid "IDS_EMAIL_BODY_PRIORITY"
-msgstr "Priorität"
-
-msgid "IDS_EMAIL_BODY_RECEIVING_OPTIONS"
-msgstr "Empfangsoptionen"
-
-msgid "IDS_EMAIL_BODY_SECURE_CONNECTION"
-msgstr "Sichere Verbindung"
-
-msgid "IDS_EMAIL_BODY_SENDING_OPTIONS"
-msgstr "Sendeoptionen"
-
-msgid "IDS_EMAIL_BODY_SENTBOX"
-msgstr "Gesendete Nachrichten"
-
-msgid "IDS_EMAIL_BODY_SERVER_URL"
-msgstr "Server-URL"
-
-msgid "IDS_EMAIL_BODY_SIGNATURE"
-msgstr "Signatur"
-
-msgid "IDS_EMAIL_BODY_SPAMBOX"
-msgstr "Spamordner"
-
-msgid "IDS_EMAIL_BODY_START_TIME"
-msgstr "Startzeit"
-
-msgid "IDS_EMAIL_BODY_SYNC_SCHEDULE_TMO"
-msgstr "Abrufeinstellungen"
-
-msgid "IDS_EMAIL_BODY_TRASH"
-msgstr "Papierkorb"
-
-msgid "IDS_EMAIL_BODY_WITHOUT_ATTACHMENTS"
-msgstr "Ohne Anhänge"
-
-msgid "IDS_EMAIL_BUTTON_GROUP"
-msgstr "Gruppe"
-
-msgid "IDS_EMAIL_HEADER_ADD_RULES"
-msgstr "Regeln hinzufügen"
-
-msgid "IDS_EMAIL_OPT_ATTACH_ITEMS"
-msgstr "Elemente anhängen"
-
-msgid "IDS_EMAIL_OPT_EXCHANGE"
-msgstr "Exchange"
-
-msgid "IDS_EMAIL_OPT_FILE"
-msgstr "Datei"
-
-msgid "IDS_EMAIL_OPT_NAMECARD"
-msgstr "Visitenkarte"
-
-msgid "IDS_EMAIL_OPT_OPEN_URL"
-msgstr "URL öffnen"
-
-msgid "IDS_EMAIL_OPT_SENDER"
-msgstr "Absender"
-
-msgid "IDS_EMAIL_OPT_SEND_EMAIL"
-msgstr "E-Mail senden"
-
-msgid "IDS_EMAIL_OPT_UPDATE_EXISTING"
-msgstr "Vorhandene aktualisieren"
-
-msgid "IDS_EMAIL_POP_ADD_ACCOUNTS"
-msgstr "Konten hinzufügen"
-
-msgid "IDS_EMAIL_POP_DOWNLOADING_ATTACHMENT_ING"
-msgstr "Anhang wird heruntergeladen..."
-
-msgid "IDS_EMAIL_POP_INVALID_EMAIL_ADDRESS"
-msgstr "Ungültige E-Mail-Adresse"
-
-msgid "IDS_EMAIL_POP_LOADING_CONTENTS_ING"
-msgstr "Inhalte werden geladen..."
-
-msgid "IDS_EMAIL_POP_MAXIMUM_NUMBER_OF_ATTACHMENTS_REACHED"
-msgstr "Maximale Anzahl an Anhängen erreicht"
-
-msgid "IDS_EMAIL_POP_MOVE_TO_SPAMBOX_Q"
-msgstr "In Spamordner verschieben?"
-
-msgid "IDS_EMAIL_POP_NO_RECIPIENTS_ADDED_ENTER_RECIPIENTS"
-msgstr "Keine Empfänger hinzugefügt. Empfänger hinzufügen."
-
-msgid "IDS_EMAIL_POP_PLEASE_FILL_ALL_THE_MANDATORY_FIELDS"
-msgstr "Füllen Sie alle obligatorischen Felder aus"
-
-msgid "IDS_EMAIL_POP_SAVE_IN_DRAFTS_Q"
-msgstr "In Entwürfe speichern"
-
-msgid "IDS_EMAIL_POP_THERE_IS_NO_ACCOUNT_CREATE_A_NEW_ACCOUNT_FIRST"
-msgstr "Kein Konto vorhanden. Erstellen Sie zunächst ein neues Konto"
-
-msgid "IDS_EMAIL_POP_TOO_MANY_RECIPIENTS"
-msgstr "Zu viele Empfänger"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_DOWNLOAD"
-msgstr "Download nicht möglich"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ENTER_TEXT"
-msgstr "Text kann nicht eingegeben werden"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_LAUNCH_APPLICATION"
-msgstr "Anwendung kann nicht gestartet werden"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_OPEN_ATTACHMENT"
-msgstr "Anhang kann nicht geöffnet werden"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_SAVE_ATTACHMENT"
-msgstr "Anhang kann nicht gespeichert werden"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_SAVE_IN_DRAFTS"
-msgstr "Kann nicht in Entwürfe gespeichert werden"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_SEND_EMAIL"
-msgstr "E-Mail kann nicht gesendet werden."
-
-msgid "IDS_EMAIL_POP_UNSUPPORTED_FILE_TYPE"
-msgstr "Nicht unterstützter Dateityp"
-
-msgid "IDS_EMAIL_POP_VALIDATING_ACCOUNT_ING"
-msgstr "Konto wird validiert..."
-
-msgid "IDS_EMAIL_SK_RESEND"
-msgstr "Erneut senden"
-
-msgid "IDS_EMAIL_BODY_ACCEPT_ALL_SSL_CERTIFICATES"
-msgstr "Alle SSL-Zertifikate akzeptieren"
-
-msgid "IDS_EMAIL_SK3_ACCOUNT_LIST"
-msgstr "Kontoliste"
-
-msgid "IDS_EMAIL_BODY_USER_ID"
-msgstr "Benutzerkennung"
-
-msgid "IDS_EMAIL_POP_ACCOUNT_ALREADY_REGISTERED"
-msgstr "Konto bereits registriert"
-
-msgid "IDS_EMAIL_HEADER_ATTACH_FILE"
-msgstr "Datei anhängen"
-
-msgid "IDS_EMAIL_BODY_EXCHANGE_SYNC_SETTINGS_MSG"
-msgstr "Durch Aktivieren dieser Anwendung stimmen Sie zu, dass einige Ihrer Gerätedaten (eindeutige Geräte-ID und Modellname) von Samsung gespeichert, verarbeitet und dazu verwendet werden, den Lizenzgebern der Anwendungssoftware die Aktivierung dieser Anwendung zu melden. Der Umgang mit von Samsung unterhaltenen Daten erfolgt unter strenger Einhaltung der Datenschutzrichtlinie von Samsung, welche auf www.samsung.com verfügbar ist. Fortfahren?"
-
-msgid "IDS_EMAIL_BODY_FORWARD_WITH_FILES"
-msgstr "Mit Dateien weiterleiten"
-
-msgid "IDS_EMAIL_BODY_REPLY_WITH_BODY"
-msgstr "Mit Text antworten"
-
-msgid "IDS_EMAIL_BODY_NO_SUBJECT"
-msgstr "Kein Betreff"
-
-msgid "IDS_EMAIL_BODY_FROM"
-msgstr "Von"
-
-msgid "IDS_EMAIL_BODY_NO_ADDRESS"
-msgstr "Keine Adresse"
-
-msgid "IDS_EMAIL_OPT_RECORD_SOUND"
-msgstr "Ton aufzeichnen"
-
-msgid "IDS_EMAIL_OPT_RECORD_VIDEO"
-msgstr "Video aufzeichnen"
-
-msgid "IDS_EMAIL_OPT_INSERT_IMAGE"
-msgstr "Bild einfügen"
-
-msgid "IDS_EMAIL_OPT_ADD_TO_CALENDAR"
-msgstr "Zu Kalender hinzufügen"
-
-msgid "IDS_EMAIL_OPT_CHANGE_EMAIL_ADDRESS_ABB"
-msgstr "E-Mail-Adresse ändern"
-
-msgid "IDS_EMAIL_OPT_CLIPBOARD"
-msgstr "Zwischenablage"
-
-msgid "IDS_EMAIL_OPT_MARKED_AS_UNREAD"
-msgstr "Als ungelesen markiert"
-
-msgid "IDS_EMAIL_OPT_VIEW_CONTACT_DETAILS"
-msgstr "Kontaktdetails anzeigen"
-
-msgid "IDS_EMAIL_POP_SAVED_IN_DRAFTS"
-msgstr "In Entwürfe gespeichert"
-
-msgid "IDS_EMAIL_POP_NETWORK_BUSY"
-msgstr "Netz besetzt"
-
-msgid "IDS_EMAIL_POP_LOGIN_ALLOWED_ONLY_EVERY_PD_MINUTES"
-msgstr "Das Anmelden ist nur alle %d Minuten zulässig."
-
-msgid "IDS_EMAIL_POP_HOST_NOT_FOUND"
-msgstr "Host nicht gefunden"
-
-msgid "IDS_EMAIL_POP_HOST_NOT_REACHABLE"
-msgstr "Host nicht erreichbar"
-
-msgid "IDS_EMAIL_POP_NO_SERVICE"
-msgstr "Kein Netz"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_FORWARD_DRM_CONTENTS"
-msgstr "DRM-Inhalte können nicht weitergeleitet werden"
-
-msgid "IDS_EMAIL_POP_BLOCKED"
-msgstr "Gesperrt"
-
-msgid "IDS_EMAIL_POP_1_EMAIL_SELECTED"
-msgstr "1 E-Mail ausgewählt"
-
-msgid "IDS_EMAIL_POP_PD_EMAILS_SELECTED"
-msgstr "%d E-Mails ausgewählt"
-
-msgid "IDS_EMAIL_POP_1_RECIPIENT_SELECTED"
-msgstr "1 Empfänger ausgewählt"
-
-msgid "IDS_EMAIL_POP_PD_RECIPIENTS_SELECTED"
-msgstr "%d Empfänger ausgewählt"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ADD_ACCOUNT"
-msgstr "Konto kann nicht hinzugefügt werden"
-
-msgid "IDS_EMAIL_SK3_MOVE_HERE"
-msgstr "Hierher verschieben"
-
diff --git a/po/el_GR.po b/po/el_GR.po
deleted file mode 100755 (executable)
index ce8f169..0000000
+++ /dev/null
@@ -1,465 +0,0 @@
-msgid "IDS_EMAIL_POP_NO_EMAIL_ADDRESS"
-msgstr "Δεν υπάρχει διεύθυνση email"
-
-msgid "IDS_EMAIL_BODY_COMPLETE"
-msgstr "Ολοκληρώθηκε"
-
-msgid "IDS_EMAIL_BODY_ACCEPTED_C_PS"
-msgstr "Έγινε αποδεκτό: %s"
-
-msgid "IDS_EMAIL_BODY_DECLINED_C_PS"
-msgstr "Απορρίφθηκε: %s"
-
-msgid "IDS_EMAIL_BODY_DOWNLOAD_FULL_MESSAGE"
-msgstr "Λήψη πλήρους μηνύματος"
-
-msgid "IDS_EMAIL_BODY_GENERAL_SETTINGS"
-msgstr "Γεν. Ρυθμίσεις"
-
-msgid "IDS_EMAIL_BODY_TENTATIVE_C_PS"
-msgstr "Αβέβαιη: %s"
-
-msgid "IDS_EMAIL_BODY_WHEN_C_PS"
-msgstr "Πότε: %s"
-
-msgid "IDS_EMAIL_BODY_WHERE_C_PS"
-msgstr "Πού: %s"
-
-msgid "IDS_EMAIL_BUTTON_DECLINE_ABB"
-msgstr "Απόρριψη"
-
-msgid "IDS_EMAIL_BODY_NO_CONTENTS"
-msgstr "Κανένα περιεχόμενο"
-
-msgid "IDS_EMAIL_BODY_ORIGINAL_MESSAGE"
-msgstr "Αρχικό μήνυμα"
-
-msgid "IDS_EMAIL_HEADER_ACCOUNT_SETTINGS"
-msgstr "Ρυθμίσεις λογαριασμού"
-
-msgid "IDS_EMAIL_OPT_BLOCK"
-msgstr "Αποκλεισμός"
-
-msgid "IDS_EMAIL_OPT_MARK_AS_READ"
-msgstr "Σήμανση ως αναγνωσμένου"
-
-msgid "IDS_EMAIL_OPT_MARK_AS_UNREAD"
-msgstr "Σήμανση ως μη αναγνωσμένο"
-
-msgid "IDS_EMAIL_OPT_OTHERS"
-msgstr "Άλλα"
-
-msgid "IDS_EMAIL_OPT_UNREAD"
-msgstr "Μη αναγνωσμένο"
-
-msgid "IDS_EMAIL_SK_COMPOSE"
-msgstr "Compose"
-
-msgid "IDS_EMAIL_HEADER_DOWNLOAD_FAILED"
-msgstr "Αποτυχία λήψης"
-
-msgid "IDS_EMAIL_OPT_ADD_TO_CONTACT"
-msgstr "Προσθήκη σε επαφή"
-
-msgid "IDS_EMAIL_OPT_VOICE_CALL"
-msgstr "Φωνητική κλήση"
-
-msgid "IDS_EMAIL_BODY_ACCOUNT_NAME"
-msgstr "Όνομα λογαριασμού"
-
-msgid "IDS_EMAIL_BODY_ATTACHMENTS"
-msgstr "Συνημμένα"
-
-msgid "IDS_EMAIL_BODY_FROM_C"
-msgstr "Από:"
-
-msgid "IDS_EMAIL_BODY_IMAP4_SERVER"
-msgstr "Διακομιστής IMAP4"
-
-msgid "IDS_EMAIL_BODY_INCLUDES"
-msgstr "Περιέχει"
-
-msgid "IDS_EMAIL_BODY_INCOMING_PORT"
-msgstr "Θύρα εισερχόμενων"
-
-msgid "IDS_EMAIL_BODY_INCOMING_SERVER"
-msgstr "Διακομιστής εισερχομένων"
-
-msgid "IDS_EMAIL_BODY_IN_PD_MINUTES"
-msgstr "Σε %d λεπτά"
-
-msgid "IDS_EMAIL_BODY_KEEP_IN_SERVER"
-msgstr "Φύλαξη στο διακομιστή"
-
-msgid "IDS_EMAIL_BODY_NO_TEXT"
-msgstr "Χωρίς κείμενο"
-
-msgid "IDS_EMAIL_BODY_OUTGOING_PORT"
-msgstr "Θύρα εξερχόμενων"
-
-msgid "IDS_EMAIL_BODY_OUTGOING_SERVER"
-msgstr "Διακομιστής εξερχομένων"
-
-msgid "IDS_EMAIL_BODY_PD_EMAILS"
-msgstr "%d emails"
-
-msgid "IDS_EMAIL_BODY_POP3_SERVER"
-msgstr "Διακομιστής POP3"
-
-msgid "IDS_EMAIL_BODY_RECENT"
-msgstr "Πρόσφατα"
-
-msgid "IDS_EMAIL_BODY_RETRIEVING_OPTIONS"
-msgstr "Επιλογές ανάκτησης"
-
-msgid "IDS_EMAIL_BODY_RE_C"
-msgstr "ΠΡΟΣ:"
-
-msgid "IDS_EMAIL_BODY_SENT_C"
-msgstr "Εστάλη:"
-
-msgid "IDS_EMAIL_BODY_SENT_FROM_SAMSUNG_MOBILE"
-msgstr "Αποστολή από κινητό Samsung"
-
-msgid "IDS_EMAIL_BODY_USER_PASSWORD"
-msgstr "Κωδικός χρήστη"
-
-msgid "IDS_EMAIL_HEADER_EDIT_RULES"
-msgstr "Επεξεργασία κανόνων"
-
-msgid "IDS_EMAIL_HEADER_EMAIL_SETTINGS"
-msgstr "Ρυθμίσεις email"
-
-msgid "IDS_EMAIL_HEADER_MAILBOXES"
-msgstr "Φάκελοι αλληλογραφίας"
-
-msgid "IDS_EMAIL_POP_ALERT"
-msgstr "Ειδοποίηση"
-
-msgid "IDS_EMAIL_POP_FILE_ALREADY_EXISTS"
-msgstr "Το αρχείο υπάρχει ήδη"
-
-msgid "IDS_EMAIL_POP_NO_SENDER"
-msgstr "Χωρίς αποστολέα"
-
-msgid "IDS_EMAIL_POP_SUCCEEDED"
-msgstr "Πέτυχε"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ATTACH_MAXIMUM_NUMBER_OF_FILES_IS_PD"
-msgstr "Δεν είναι δυνατή η επισύναψη. Ο μέγιστος αριθμός αρχείων είναι %d"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ATTACH_MAXIMUM_SIZE_OF_FILES_IS_PD_KB"
-msgstr "Δεν είναι δυνατή η επισύναψη. Το μέγιστο όριο μεγέθους των αρχείων είναι %d KB"
-
-msgid "IDS_EMAIL_POP_VALIDATION_FAILED"
-msgstr "Αποτυχία επικύρωσης"
-
-msgid "IDS_EMAIL_SK_REPLY_ALL"
-msgstr "Απάντ. σε όλους"
-
-msgid "IDS_EMAIL_BODY_1_ITEM"
-msgstr "1 στοιχείο"
-
-msgid "IDS_EMAIL_BODY_ADD_MY_NAMECARD"
-msgstr "Προσθήκη κάρτας στοιχείων μου"
-
-msgid "IDS_EMAIL_BODY_ADD_SIGNATURE"
-msgstr "Προσθήκη υπογραφής"
-
-msgid "IDS_EMAIL_BODY_ALL_EMAILS"
-msgstr "Όλα τα email"
-
-msgid "IDS_EMAIL_BODY_ALWAYS_BCC_MYSELF"
-msgstr "Να γίνεται πάντα Ιδ.Κοιν. σε εμένα"
-
-msgid "IDS_EMAIL_BODY_BCC"
-msgstr "Ιδιαίτερη κοινοποίηση"
-
-msgid "IDS_EMAIL_BODY_BLOCK_EMAILS"
-msgstr "Αποκλεισμός μηνυμάτων email"
-
-msgid "IDS_EMAIL_BODY_BODY"
-msgstr "Το σώμα μου"
-
-msgid "IDS_EMAIL_BODY_CC"
-msgstr "Κοιν."
-
-msgid "IDS_EMAIL_BODY_CC_BCC"
-msgstr "Κ./Ιδ.κ."
-
-msgid "IDS_EMAIL_BODY_CHECK_INTERVAL"
-msgstr "Έλεγχος διαστήματος"
-
-msgid "IDS_EMAIL_BODY_DEFAULT_ACCOUNT"
-msgstr "Προεπ. λογαριασμός"
-
-msgid "IDS_EMAIL_BODY_DRAFTS"
-msgstr "Πρόχειρο"
-
-msgid "IDS_EMAIL_BODY_EMAIL_ACCOUNTS"
-msgstr "Λογαριασμοί email"
-
-msgid "IDS_EMAIL_BODY_END_TIME"
-msgstr "Ώρα λήξης"
-
-msgid "IDS_EMAIL_BODY_ENTIRE_EMAIL"
-msgstr "Ολόκληρο μήνυμα email"
-
-msgid "IDS_EMAIL_BODY_EXACTLY_THE_SAME_AS"
-msgstr "Ακριβώς ίδιο με"
-
-msgid "IDS_EMAIL_BODY_EXAMPLE"
-msgstr "Παράδειγμα"
-
-msgid "IDS_EMAIL_BODY_FROM_M_SENDER"
-msgstr "Από:"
-
-msgid "IDS_EMAIL_BODY_INBOX"
-msgstr "Εισερχόμενα"
-
-msgid "IDS_EMAIL_BODY_INCLUDE"
-msgstr "Να συμπεριληφθεί"
-
-msgid "IDS_EMAIL_BODY_MATCH_CRITERIA"
-msgstr "Αντιστοίχιση κριτηρίων"
-
-msgid "IDS_EMAIL_BODY_NOT_USED"
-msgstr "Δεν χρησιμοποιείται"
-
-msgid "IDS_EMAIL_BODY_NO_ACCOUNTS"
-msgstr "Δεν υπάρχουν λογαριασμοί"
-
-msgid "IDS_EMAIL_BODY_PD_DAYS"
-msgstr "%d ημέρες"
-
-msgid "IDS_EMAIL_BODY_PD_ITEMS"
-msgstr "%d στοιχεία"
-
-msgid "IDS_EMAIL_BODY_PRIORITY"
-msgstr "Προτεραιότητα"
-
-msgid "IDS_EMAIL_BODY_RECEIVING_OPTIONS"
-msgstr "Επιλογές λήψης"
-
-msgid "IDS_EMAIL_BODY_SECURE_CONNECTION"
-msgstr "Ασφαλής σύνδεση"
-
-msgid "IDS_EMAIL_BODY_SENDING_OPTIONS"
-msgstr "Επιλογές αποστολής"
-
-msgid "IDS_EMAIL_BODY_SENTBOX"
-msgstr "Απεσταλμένα"
-
-msgid "IDS_EMAIL_BODY_SERVER_URL"
-msgstr "URL διακομιστή"
-
-msgid "IDS_EMAIL_BODY_SIGNATURE"
-msgstr "Υπογραφή"
-
-msgid "IDS_EMAIL_BODY_SPAMBOX"
-msgstr "Φάκελος ανεπιθύμητης αλληλογραφίας"
-
-msgid "IDS_EMAIL_BODY_START_TIME"
-msgstr "Ώρα έναρξης"
-
-msgid "IDS_EMAIL_BODY_SYNC_SCHEDULE_TMO"
-msgstr "Συγχρονισμός προγράμματος"
-
-msgid "IDS_EMAIL_BODY_TRASH"
-msgstr "Απορρίμματα"
-
-msgid "IDS_EMAIL_BODY_WITHOUT_ATTACHMENTS"
-msgstr "Χωρίς συνημμένα"
-
-msgid "IDS_EMAIL_BUTTON_GROUP"
-msgstr "Ομάδα"
-
-msgid "IDS_EMAIL_HEADER_ADD_RULES"
-msgstr "Προσθήκη κανόνων"
-
-msgid "IDS_EMAIL_OPT_ATTACH_ITEMS"
-msgstr "Επισύναψη στοιχείου"
-
-msgid "IDS_EMAIL_OPT_EXCHANGE"
-msgstr "Exchange"
-
-msgid "IDS_EMAIL_OPT_FILE"
-msgstr "Αρχείο"
-
-msgid "IDS_EMAIL_OPT_NAMECARD"
-msgstr "Κάρτα στοιχειών"
-
-msgid "IDS_EMAIL_OPT_OPEN_URL"
-msgstr "Άνοιγμα διεύθυνσης URL"
-
-msgid "IDS_EMAIL_OPT_SENDER"
-msgstr "Αποστολέας"
-
-msgid "IDS_EMAIL_OPT_SEND_EMAIL"
-msgstr "Αποστολή email"
-
-msgid "IDS_EMAIL_OPT_UPDATE_EXISTING"
-msgstr "Ενημέρωση υπάρχοντων"
-
-msgid "IDS_EMAIL_POP_ADD_ACCOUNTS"
-msgstr "Προσθήκη λογαριασμών"
-
-msgid "IDS_EMAIL_POP_DOWNLOADING_ATTACHMENT_ING"
-msgstr "Λήψη συνημμένου..."
-
-msgid "IDS_EMAIL_POP_INVALID_EMAIL_ADDRESS"
-msgstr "Μη έγκυρη διεύθυνση email"
-
-msgid "IDS_EMAIL_POP_LOADING_CONTENTS_ING"
-msgstr "Φόρτωση περιεχομένων..."
-
-msgid "IDS_EMAIL_POP_MAXIMUM_NUMBER_OF_ATTACHMENTS_REACHED"
-msgstr "Συμπληρώθηκε ο μέγιστος αριθμός συνημμένων"
-
-msgid "IDS_EMAIL_POP_MOVE_TO_SPAMBOX_Q"
-msgstr "Μετακίνηση στο φάκελο ανεπιθύμητης αλληλογραφίας;"
-
-msgid "IDS_EMAIL_POP_NO_RECIPIENTS_ADDED_ENTER_RECIPIENTS"
-msgstr "Δεν έχουν προστεθεί παραλήπτες. Εισάγετε παραλήπτες"
-
-msgid "IDS_EMAIL_POP_PLEASE_FILL_ALL_THE_MANDATORY_FIELDS"
-msgstr "Συμπληρώστε όλα τα υποχρεωτικά πεδία"
-
-msgid "IDS_EMAIL_POP_SAVE_IN_DRAFTS_Q"
-msgstr "Αποθήκευση στα πρόχειρα"
-
-msgid "IDS_EMAIL_POP_THERE_IS_NO_ACCOUNT_CREATE_A_NEW_ACCOUNT_FIRST"
-msgstr "Δεν υπάρχει κανένας λογαριασμός. Δημιουργήστε ένα νέο λογαριασμό πρώτα."
-
-msgid "IDS_EMAIL_POP_TOO_MANY_RECIPIENTS"
-msgstr "Μεγάλος αριθμός παραληπτών"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_DOWNLOAD"
-msgstr "Δεν είναι δυνατή η λήψη"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ENTER_TEXT"
-msgstr "Δεν είναι δυνατή η εισαγωγή κειμένου"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_LAUNCH_APPLICATION"
-msgstr "Αδύνατη η εκκίνηση της εφαρμογής"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_OPEN_ATTACHMENT"
-msgstr "Δεν ήταν δυνατό το άνοιγμα του συνημμένου"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_SAVE_ATTACHMENT"
-msgstr "Δεν ήταν δυνατή η αποθήκευση του συνημμένου"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_SAVE_IN_DRAFTS"
-msgstr "Δεν ήταν δυνατή η αποθήκευση στα Πρόχειρα"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_SEND_EMAIL"
-msgstr "Δεν ήταν δυνατή η αποστολή email"
-
-msgid "IDS_EMAIL_POP_UNSUPPORTED_FILE_TYPE"
-msgstr "Μη υποστηριζόμενος τύπος αρχείου"
-
-msgid "IDS_EMAIL_POP_VALIDATING_ACCOUNT_ING"
-msgstr "Επαλήθευση λογαριασμού..."
-
-msgid "IDS_EMAIL_SK_RESEND"
-msgstr "Επανάληψη αποστολής"
-
-msgid "IDS_EMAIL_BODY_ACCEPT_ALL_SSL_CERTIFICATES"
-msgstr "Αποδοχή όλων των πιστοποιητικών SSL"
-
-msgid "IDS_EMAIL_SK3_ACCOUNT_LIST"
-msgstr "Λίστα\nλογαρ."
-
-msgid "IDS_EMAIL_BODY_USER_ID"
-msgstr "Ταυτότητα χρήστη"
-
-msgid "IDS_EMAIL_POP_ACCOUNT_ALREADY_REGISTERED"
-msgstr "Ο λογαριασμός έχει ήδη καταχωρηθεί"
-
-msgid "IDS_EMAIL_HEADER_ATTACH_FILE"
-msgstr "Επισύναψη αρχείου"
-
-msgid "IDS_EMAIL_BODY_EXCHANGE_SYNC_SETTINGS_MSG"
-msgstr "Ενεργοποιώντας αυτή την εφαρμογή, αποδέχεστε ότι μέρος των δεδομένων της συσκευής σας (περιλαμβανομένου του μοναδικού αναγνωριστικού συσκευής και του ονόματος μοντέλου) θα αποθηκευτούν, θα υποστούν επεξεργασία και θα χρησιμοποιηθούν από τη Samsung για την αναφορά της ενεργοποίησης της εφαρμογής στους παρέχοντες την άδεια χρήσης του ίδιου του λογισμικού της εφαρμογής. Τα δεδομένα που φυλάσσονται από τη Samsung θα υποστούν επεξεργασία σε αυστηρή συμμόρφωση με την πολιτική ιδιωτικού απορρήτου της Samsung που είναι διαθέσιμα στη διεύθυνση www.samsung.com. Θέλετε να συνεχίσετε;"
-
-msgid "IDS_EMAIL_BODY_FORWARD_WITH_FILES"
-msgstr "Προώθηση με αρχεία"
-
-msgid "IDS_EMAIL_BODY_REPLY_WITH_BODY"
-msgstr "Απαν.με κύριο κείμενο"
-
-msgid "IDS_EMAIL_BODY_NO_SUBJECT"
-msgstr "Χωρίς θέμα"
-
-msgid "IDS_EMAIL_BODY_FROM"
-msgstr "Από"
-
-msgid "IDS_EMAIL_BODY_NO_ADDRESS"
-msgstr "Καμία διεύθυνση"
-
-msgid "IDS_EMAIL_OPT_RECORD_SOUND"
-msgstr "Εγγραφή ήχου"
-
-msgid "IDS_EMAIL_OPT_RECORD_VIDEO"
-msgstr "Εγγραφή βίντεο"
-
-msgid "IDS_EMAIL_OPT_INSERT_IMAGE"
-msgstr "Εισαγωγή εικόνας"
-
-msgid "IDS_EMAIL_OPT_ADD_TO_CALENDAR"
-msgstr "Προσθήκη στο ημερολόγιο"
-
-msgid "IDS_EMAIL_OPT_CHANGE_EMAIL_ADDRESS_ABB"
-msgstr "Αλλαγή διεύθυνσης email"
-
-msgid "IDS_EMAIL_OPT_CLIPBOARD"
-msgstr "Πρόχειρο"
-
-msgid "IDS_EMAIL_OPT_MARKED_AS_UNREAD"
-msgstr "Σήμανση ως μη αναγνωσμένο"
-
-msgid "IDS_EMAIL_OPT_VIEW_CONTACT_DETAILS"
-msgstr "Προβολή λεπτομερειών επαφής"
-
-msgid "IDS_EMAIL_POP_SAVED_IN_DRAFTS"
-msgstr "Αποθηκεύτηκε στα πρόχειρα"
-
-msgid "IDS_EMAIL_POP_NETWORK_BUSY"
-msgstr "Κατειλημμένο δίκτυο"
-
-msgid "IDS_EMAIL_POP_LOGIN_ALLOWED_ONLY_EVERY_PD_MINUTES"
-msgstr "Login allowed only every %d minutes"
-
-msgid "IDS_EMAIL_POP_HOST_NOT_FOUND"
-msgstr "Δεν εντοπίστηκε ο κεντρικός υπολογιστής"
-
-msgid "IDS_EMAIL_POP_HOST_NOT_REACHABLE"
-msgstr "Δεν είναι δυνατή η πρόσβαση στον κεντρικό υπολογιστή"
-
-msgid "IDS_EMAIL_POP_NO_SERVICE"
-msgstr "Μη διαθέσιμη υπηρεσία"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_FORWARD_DRM_CONTENTS"
-msgstr "Δεν ήταν δυνατή η προώθηση περιεχομένων DRM"
-
-msgid "IDS_EMAIL_POP_BLOCKED"
-msgstr "Αποκλεισμένο"
-
-msgid "IDS_EMAIL_POP_1_EMAIL_SELECTED"
-msgstr "Επιλέχθηκε 1 email"
-
-msgid "IDS_EMAIL_POP_PD_EMAILS_SELECTED"
-msgstr "%d email επιλέχθηκαν"
-
-msgid "IDS_EMAIL_POP_1_RECIPIENT_SELECTED"
-msgstr "1 επιλογή αποδέκτη"
-
-msgid "IDS_EMAIL_POP_PD_RECIPIENTS_SELECTED"
-msgstr "Επιλογή %d αποδεκτών"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ADD_ACCOUNT"
-msgstr "Δεν είναι δυνατή η προσθήκη του λογαριασμού"
-
-msgid "IDS_EMAIL_SK3_MOVE_HERE"
-msgstr "Μετακίνηση εδώ"
-
diff --git a/po/email.pot b/po/email.pot
deleted file mode 100755 (executable)
index c979cde..0000000
+++ /dev/null
@@ -1,1546 +0,0 @@
-# SOME DESCRIPTIVE TITLE.
-# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
-#
-#, fuzzy
-msgid ""
-msgstr ""
-"Project-Id-Version: PACKAGE VERSION\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-05-11 17:44-0700\n"
-"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
-"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
-"Language-Team: LANGUAGE <LL@li.org>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=CHARSET\n"
-"Content-Transfer-Encoding: 8bit\n"
-
-#. snprintf(buf, sizeof(buf), "%s", N_("Accounts"));
-#: account/email-account.c:396 mailbox/email-mailbox.c:6069
-#: setting/email-view-setting.c:411
-msgid "IDS_COM_BODY_ACCOUNTS"
-msgstr ""
-
-#: account/email-account.c:448
-msgid "IDS_EMAIL_SK_UPDATE"
-msgstr ""
-
-#: account/email-account.c:787
-#, c-format
-msgid "IDS_EMAIL_BODY_NO_TEXT"
-msgstr ""
-
-#: account/email-account.c:830 mailbox/email-mailbox.c:4432
-#: mailbox/email-mailbox.c:6375 mailbox/email-mailbox.c:7485
-#: mailbox/email-mailbox.c:8218
-msgid "IDS_EMAIL_BODY_ALL_EMAILS"
-msgstr ""
-
-#: account/email-account.c:1232 mailbox/email-mailbox.c:4023
-msgid "IDS_COM_POP_EMPTY"
-msgstr ""
-
-#: block/email-block.c:502 composer/email-composer-callback.c:1520
-msgid "IDS_COM_ADD"
-msgstr ""
-
-#: block/email-block.c:511 block/email-block.c:863 block/email-block.c:1222
-msgid "IDS_COM_POP_ADDRESS"
-msgstr ""
-
-#: block/email-block.c:512 block/email-block.c:868 block/email-block.c:1201
-#: mailbox/email-mailbox.c:6284 composer/email-composer-contents.c:70
-#: composer/email-composer-util.c:2421 composer/email-composer-util.c:2425
-#: composer/email-composer-util.c:2604
-msgid "IDS_COM_BODY_SUBJECT"
-msgstr ""
-
-#. elm_button_label_set(ug_data->edit_button, _("Edit"));
-#. Change button label
-#. elm_button_label_set(ug_data->edit_button, _("Edit"));
-#. elm_button_label_set(edit_btn, _("Edit"));
-#. elm_navigationbar_ex_item_title_label_set(mailbox_sg->navibar_item[mailbox_sg->previous_view], _("Edit"));
-#: block/email-block.c:543 block/email-block.c:1368 block/email-block.c:2058
-#: mailbox/email-mailbox.c:6103 mailbox/email-mailbox.c:6776
-#: setting/email-view-account-edit.c:1105
-#: composer/email-composer-callback.c:432
-msgid "IDS_COM_SK_EDIT"
-msgstr ""
-
-#: block/email-block.c:573 setting/email-view-setting.c:395
-#: setting/email-view-setting.c:777
-msgid "IDS_EMAIL_BODY_BLOCK_EMAILS"
-msgstr ""
-
-#. elm_nocontents_label_set(ug_data->noc, N_("No content"));
-#: block/email-block.c:739
-msgid "IDS_EMAIL_BODY_NO_CONTENTS"
-msgstr ""
-
-#: block/email-block.c:929 setting/email-view-account-edit.c:1101
-#: setting/email-view-other-account.c:975
-#: setting/email-view-server-type.c:1167
-msgid "IDS_COM_SK_SAVE"
-msgstr ""
-
-#. elm_button_label_set(ug_data->l_button3, _("Cancel"));
-#. elm_button_label_set(button, "Cancel");
-#. elm_button_label_set(cancel_button, _("Cancel"));
-#. elm_button_label_set(third_button, "Cancel");
-#: block/email-block.c:935 block/email-block.c:1874
-#: mailbox/email-mailbox.c:2832 mailbox/email-mailbox.c:6186
-#: popup/email-popup.c:507 setting/email-view-account-edit.c:523
-#: setting/email-view-account-edit.c:556
-#: setting/email-view-other-account.c:359 setting/email-view-server-type.c:294
-#: setting/email-view-setting.c:314 viewer/email-viewer.c:5127
-#: viewer/email-viewer.c:5129 viewer/email-viewer.c:5131
-#: viewer/email-viewer.c:5133 viewer/email-viewer.c:5313
-#: composer/email-composer.c:387 composer/email-composer-callback.c:100
-#: composer/email-composer-callback.c:1070 composer/email-composer-util.c:1343
-#: composer/email-composer-util.c:1388
-msgid "IDS_COM_SK_CANCEL"
-msgstr ""
-
-#: block/email-block.c:940
-msgid "IDS_EMAIL_HEADER_EDIT_RULES"
-msgstr ""
-
-#: block/email-block.c:944
-msgid "IDS_EMAIL_HEADER_ADD_RULES"
-msgstr ""
-
-#: block/email-block.c:986 setting/email-view-account-edit.c:589
-#: setting/email-view-other-account.c:467
-#: setting/email-view-other-account.c:525 setting/email-view-server-type.c:383
-msgid "IDS_EMAIL_POP_PLEASE_FILL_ALL_THE_MANDATORY_FIELDS"
-msgstr ""
-
-#: block/email-block.c:987 block/email-block.c:1025 block/email-block.c:1064
-#: block/email-block.c:1146 mailbox/email-mailbox.c:2314
-#: viewer/email-viewer.c:3755
-msgid "IDS_EMAIL_POP_ALERT"
-msgstr ""
-
-#: block/email-block.c:1024 setting/email-view-other-account.c:476
-#: setting/email-view-other-account.c:546
-#: composer/email-composer-callback.c:491
-#: composer/email-composer-callback.c:521
-#: composer/email-composer-callback.c:551
-#: composer/email-composer-callback.c:945 composer/email-composer-util.c:1899
-msgid "IDS_EMAIL_POP_INVALID_EMAIL_ADDRESS"
-msgstr ""
-
-#. elm_popup_desc_set(ug_data->popup_empty, _("IDS_EMAIL_POP_INVALID_SUBJECT"));
-#. elm_popup_desc_set(ug_data->popup_empty,  dgettext("sys_string", "IDS_COM_POP_EMPTY")); //print EMPTY
-#: block/email-block.c:1063
-msgid "Empty subject"
-msgstr ""
-
-#: block/email-block.c:1143
-msgid "Already blocked for this address"
-msgstr ""
-
-#: block/email-block.c:1145
-msgid "Already blocked for this subject"
-msgstr ""
-
-#: block/email-block.c:1213 mailbox/email-mailbox.c:4757
-msgid "No subject"
-msgstr ""
-
-#: block/email-block.c:1234
-msgid "No address"
-msgstr ""
-
-#. Change button label
-#. elm_button_label_set(ug_data->edit_button, _("Done"));
-#: block/email-block.c:1304 block/email-block.c:2258
-#: composer/email-composer-recent.c:79
-msgid "IDS_COM_SK_DONE"
-msgstr ""
-
-#. elm_button_label_set(g_delete_button, _("Delete"));
-#: block/email-block.c:1315 block/email-block.c:2066
-#: mailbox/email-mailbox.c:3177 mailbox/email-mailbox.c:6203
-#: setting/email-view-account-edit.c:1085 viewer/email-viewer.c:639
-#: composer/email-composer-callback.c:424
-#: composer/email-composer-callback.c:431
-msgid "IDS_COM_SK_DELETE"
-msgstr ""
-
-#. elm_layout_text_set(ug_data->select_all_layout, "elm.text", "Select All");
-#. elm_layout_text_set(mailbox_sg->select_all_layout, "elm.text", "Select All");
-#. elm_layout_text_set(ugd->select_all_layout, "elm.text", "Select all");
-#: block/email-block.c:1337 block/email-block.c:2315
-#: mailbox/email-mailbox.c:6766 composer/email-composer-recent.c:144
-msgid "IDS_COM_BODY_SELECT_ALL"
-msgstr ""
-
-#: block/email-block.c:1683 composer/email-composer-callback.c:1544
-#: composer/email-composer-recipient.c:164
-msgid "IDS_COM_BODY_CONTACTS"
-msgstr ""
-
-#. elm_button_label_set(ugd->recent_button, _("Recent"));
-#: block/email-block.c:1692 block/email-block.c:2273 block/email-block.c:2283
-#: setting/email-view-setting.c:446 setting/email-view-setting.c:767
-#: setting/email-view-show-email-list.c:161
-#: composer/email-composer-recent.c:92 composer/email-composer-recent.c:104
-#: composer/email-composer-recipient.c:156
-msgid "IDS_COM_BUTTON_RECENT"
-msgstr ""
-
-#. elm_entry_entry_set(elm_editfield_entry_get(ug_data->ef_match), _("IDS_EMAIL_BODY_EXACTLY_THE_SAME_AS"));
-#: block/email-block.c:1832 block/email-block.c:1896
-msgid "IDS_EMAIL_BODY_EXACTLY_THE_SAME_AS"
-msgstr ""
-
-#. elm_entry_entry_set(elm_editfield_entry_get(ug_data->ef_match), _("IDS_EMAIL_BODY_INCLUDES"));
-#: block/email-block.c:1847 block/email-block.c:1902
-msgid "IDS_EMAIL_BODY_INCLUDES"
-msgstr ""
-
-#. elm_button_label_set(ug_data->r_button3, _("Set"));
-#. p->icon = elm_icon_add(p->r_button);
-#. snprintf(buf, sizeof(buf), "%s/logo_small.png", ICON_DIR);
-#. elm_icon_file_set(p->icon, buf, NULL);
-#. elm_button_icon_set(p->r_button, p->icon);
-#: block/email-block.c:1879
-#: setting/email-view-receiving-option-mailbox-setup.c:128
-#: setting/email-view-receiving-option-size.c:342
-msgid "IDS_COM_SK_SET"
-msgstr ""
-
-#: block/email-block.c:1882
-msgid "IDS_EMAIL_BODY_MATCH_CRITERIA"
-msgstr ""
-
-#: block/email-block.c:1938 mailbox/email-mailbox.c:4739
-#: mailbox/email-mailbox.c:4747
-msgid "IDS_COM_BODY_NO_NAME"
-msgstr ""
-
-#: block/email-block.c:2265
-msgid "IDS_COM_BODY_BACK"
-msgstr ""
-
-#: block/email-block.c:2715 mailbox/email-mailbox.c:3661
-#: mailbox/email-mailbox.c:7562 viewer/email-viewer.c:6200
-#: composer/email-composer-recent.c:372
-msgid "IDS_COM_BODY_NO_CONTENTS"
-msgstr ""
-
-#: block/email-block.c:2736
-#, c-format
-msgid "%d address selected"
-msgstr ""
-
-#: block/email-block.c:2738
-#, c-format
-msgid "%d addresses selected"
-msgstr ""
-
-#. elm_button_label_set(left_bt, _("Yes"));
-#: common/email-dialog-util.c:136 viewer/email-viewer.c:2797
-msgid "IDS_COM_SK_YES"
-msgstr ""
-
-#. elm_button_label_set(right_bt, _("No"));
-#: common/email-dialog-util.c:144 viewer/email-viewer.c:2797
-msgid "IDS_COM_SK_NO"
-msgstr ""
-
-#: common/email-utils.c:39
-msgid "JAN"
-msgstr ""
-
-#: common/email-utils.c:40
-msgid "FEB"
-msgstr ""
-
-#: common/email-utils.c:41
-msgid "MAR"
-msgstr ""
-
-#: common/email-utils.c:42
-msgid "APR"
-msgstr ""
-
-#: common/email-utils.c:43
-msgid "MAY"
-msgstr ""
-
-#: common/email-utils.c:44
-msgid "JUN"
-msgstr ""
-
-#: common/email-utils.c:45
-msgid "JUL"
-msgstr ""
-
-#: common/email-utils.c:46
-msgid "AUG"
-msgstr ""
-
-#: common/email-utils.c:47
-msgid "SEP"
-msgstr ""
-
-#: common/email-utils.c:48
-msgid "OCT"
-msgstr ""
-
-#: common/email-utils.c:49
-msgid "NOV"
-msgstr ""
-
-#: common/email-utils.c:50
-msgid "DEC"
-msgstr ""
-
-#: common/email-utils.c:52 composer/email-composer-util.c:55
-msgid "IDS_COM_BODY_JAN"
-msgstr ""
-
-#: common/email-utils.c:53 composer/email-composer-util.c:56
-msgid "IDS_COM_BODY_FEB"
-msgstr ""
-
-#: common/email-utils.c:54 composer/email-composer-util.c:57
-msgid "IDS_COM_BODY_MAR"
-msgstr ""
-
-#: common/email-utils.c:55 composer/email-composer-util.c:58
-msgid "IDS_COM_BODY_APR"
-msgstr ""
-
-#: common/email-utils.c:56 composer/email-composer-util.c:59
-msgid "IDS_COM_BODY_MAY"
-msgstr ""
-
-#: common/email-utils.c:57 composer/email-composer-util.c:60
-msgid "IDS_COM_BODY_JUN"
-msgstr ""
-
-#: common/email-utils.c:58 composer/email-composer-util.c:61
-msgid "IDS_COM_BODY_JUL"
-msgstr ""
-
-#: common/email-utils.c:59 composer/email-composer-util.c:62
-msgid "IDS_COM_BODY_AUG"
-msgstr ""
-
-#: common/email-utils.c:60 composer/email-composer-util.c:63
-msgid "IDS_COM_BODY_SEP"
-msgstr ""
-
-#: common/email-utils.c:61 composer/email-composer-util.c:64
-msgid "IDS_COM_BODY_OCT"
-msgstr ""
-
-#: common/email-utils.c:62 composer/email-composer-util.c:65
-msgid "IDS_COM_BODY_NOV"
-msgstr ""
-
-#: common/email-utils.c:63 composer/email-composer-util.c:66
-msgid "IDS_COM_BODY_DEC"
-msgstr ""
-
-#: common/email-utils.c:406 viewer/email-viewer.c:1530
-#: viewer/email-viewer.c:1623 viewer/email-viewer.c:1694
-msgid "B"
-msgstr ""
-
-#: common/email-utils.c:413 viewer/email-viewer.c:1538
-#: viewer/email-viewer.c:1631 viewer/email-viewer.c:1701
-#: composer/email-composer-attachment.c:356
-#: composer/email-composer-attachment.c:373
-msgid "KB"
-msgstr ""
-
-#: common/email-utils.c:420 viewer/email-viewer.c:1546
-#: viewer/email-viewer.c:1639 viewer/email-viewer.c:1708
-#: composer/email-composer-attachment.c:356
-#: composer/email-composer-attachment.c:373
-msgid "MB"
-msgstr ""
-
-#: common/email-utils.c:424 viewer/email-viewer.c:1551
-#: viewer/email-viewer.c:1644 viewer/email-viewer.c:1713
-msgid "GB"
-msgstr ""
-
-#. strcpy(date, N_("Sun"));
-#. sprintf(wday, "%s", N_("Sun"));
-#: common/email-utils.c:933 composer/email-composer-util.c:1611
-msgid "IDS_COM_BODY_SUN"
-msgstr ""
-
-#. strcpy(date, "Mon");
-#: common/email-utils.c:937 composer/email-composer-util.c:1614
-msgid "IDS_COM_BODY_MON"
-msgstr ""
-
-#. strcpy(date, "Tue");
-#: common/email-utils.c:941 composer/email-composer-util.c:1617
-msgid "IDS_COM_BODY_TUE"
-msgstr ""
-
-#. strcpy(date, "Wed");
-#: common/email-utils.c:945 composer/email-composer-util.c:1620
-msgid "IDS_COM_BODY_WED"
-msgstr ""
-
-#. strncpy(date, "Thu");
-#: common/email-utils.c:949 composer/email-composer-util.c:1623
-msgid "IDS_COM_BODY_THU"
-msgstr ""
-
-#. strcpy(date, "Fri");
-#: common/email-utils.c:953 composer/email-composer-util.c:1626
-msgid "IDS_COM_BODY_FRI"
-msgstr ""
-
-#. strcpy(date, "Sat");
-#: common/email-utils.c:957 composer/email-composer-util.c:1629
-msgid "IDS_COM_BODY_SAT"
-msgstr ""
-
-#: common/email-utils.c:966
-msgid "IDS_COM_BODY_TODAY"
-msgstr ""
-
-#: common/email-utils.c:973
-msgid "IDS_COM_BODY_YESTERDAY"
-msgstr ""
-
-#: common/email-utils.c:979
-msgid "IDS_COM_BODY_PREVIOUS_DAYS"
-msgstr ""
-
-#. (t2_hour < 12) ? _("AM") : _("PM"));
-#: common/email-utils.c:1039 composer/email-composer-util.c:1594
-msgid "IDS_COM_BODY_AM"
-msgstr ""
-
-#: common/email-utils.c:1039 composer/email-composer-util.c:1594
-msgid "IDS_COM_POP_PM"
-msgstr ""
-
-#. elm_popup_desc_set(popup,N_("<b>Adding an account</b> <br>Default account is not set.<br>Move to account wizard."));
-#. ugd->popup_one = email_setting_get_auto_notify(vd, dgettext("sys_string", "IDS_COM_POP_NO_ACCOUNTS"));
-#: mailbox/email-mailbox.c:2313 mailbox/email-mailbox.c:5973
-#: mailbox/email-mailbox.c:6011 mailbox/email-mailbox.c:6304
-#: mailbox/email-mailbox.c:6441 setting/email-view-setting.c:165
-#: setting/email-view-setting.c:192 setting/email-view-setting.c:213
-#: setting/email-view-setting.c:629 composer/email-composer.c:1302
-msgid "IDS_EMAIL_POP_THERE_IS_NO_ACCOUNT_CREATE_A_NEW_ACCOUNT_FIRST"
-msgstr ""
-
-#. elm_popup_buttons_add(ugd->popup_color, 2, "Ok", ELM_POPUP_RESPONSE_OK, "Cancel", ELM_POPUP_RESPONSE_CANCEL, NULL);
-#: mailbox/email-mailbox.c:2315 mailbox/email-mailbox.c:7152
-#: mailbox/email-mailbox.c:7214 setting/email-view-account-edit.c:488
-#: setting/email-view-account-edit.c:493 setting/email-view-account-edit.c:556
-#: setting/email-view-account-edit.c:589
-#: setting/email-view-other-account.c:319
-#: setting/email-view-other-account.c:323
-#: setting/email-view-other-account.c:398
-#: setting/email-view-other-account.c:400
-#: setting/email-view-other-account.c:467
-#: setting/email-view-other-account.c:476
-#: setting/email-view-other-account.c:525
-#: setting/email-view-other-account.c:535
-#: setting/email-view-other-account.c:546 setting/email-view-server-type.c:254
-#: setting/email-view-server-type.c:259 setting/email-view-server-type.c:332
-#: setting/email-view-server-type.c:334 setting/email-view-server-type.c:383
-#: setting/email-view-setting.c:314 viewer/email-viewer.c:2320
-#: viewer/email-viewer.c:2786 viewer/email-viewer.c:4113
-#: viewer/email-viewer.c:4472 viewer/email-viewer.c:5235
-#: viewer/email-viewer.c:5781 viewer/email-viewer.c:5964
-#: viewer/email-viewer.c:6007 viewer/email-viewer.c:6018
-#: viewer/email-viewer.c:6135 viewer/email-viewer.c:6137
-#: viewer/email-viewer.c:6139 viewer/email-viewer.c:7773
-#: viewer/email-viewer.c:7808 viewer/email-viewer.c:7963
-#: viewer/email-viewer.c:8010 viewer/email-viewer.c:8014
-#: viewer/email-viewer.c:8018 composer/email-composer.c:387
-#: composer/email-composer.c:1915 composer/email-composer-callback.c:100
-#: composer/email-composer-util.c:1343
-msgid "IDS_COM_SK_OK"
-msgstr ""
-
-#. Mail send is cancelled . Change the label of button to Resend
-#. elm_button_label_set(obj, "Resend");
-#. elm_button_label_set(button, "Resend");
-#: mailbox/email-mailbox.c:2747 mailbox/email-mailbox.c:2849
-#: viewer/email-viewer.c:686
-msgid "IDS_EMAIL_SK_RESEND"
-msgstr ""
-
-#. Trash or Spam Box. Set Label as Move
-#. ug_data->item[2] = elm_controlbar_tool_item_append(obj, NULL, N_("Calendar"), ev_sk_add_to_calendar_cb, ug_data);
-#: mailbox/email-mailbox.c:3140 mailbox/email-mailbox.c:4948
-#: mailbox/email-mailbox.c:6253 mailbox/email-mailbox.c:7726
-#: viewer/email-viewer.c:638
-msgid "IDS_COM_BODY_MOVE"
-msgstr ""
-
-#. elm_button_label_set(button, N_("Mark as Read"));
-#: mailbox/email-mailbox.c:3149 mailbox/email-mailbox.c:3163
-msgid "IDS_EMAIL_OPT_MARK_AS_READ"
-msgstr ""
-
-#. elm_button_label_set(button, N_("Mark as Unread"));
-#: mailbox/email-mailbox.c:3152 mailbox/email-mailbox.c:3166
-msgid "IDS_EMAIL_OPT_MARK_AS_UNREAD"
-msgstr ""
-
-#: mailbox/email-mailbox.c:3646 mailbox/email-mailbox.c:7553
-#: mailbox/email-mailbox.c:8102
-msgid "No search result"
-msgstr ""
-
-#: mailbox/email-mailbox.c:4037
-msgid "Loading more emails"
-msgstr ""
-
-#: mailbox/email-mailbox.c:4080
-msgid "Move to email account setting"
-msgstr ""
-
-#: mailbox/email-mailbox.c:4084
-msgid "Welcome to Email App"
-msgstr ""
-
-#: mailbox/email-mailbox.c:4483 mailbox/email-mailbox.c:8199
-#: mailbox/email-mailbox.c:8227 setting/email-view-setting.c:445
-#: setting/email-view-setting.c:766 setting/email-view-show-email-list.c:160
-#, c-format
-msgid "IDS_EMAIL_BODY_PD_EMAILS"
-msgstr ""
-
-#: mailbox/email-mailbox.c:4767 mailbox/email-mailbox.c:7121
-msgid "IDS_EMAIL_POP_NO_SENDER"
-msgstr ""
-
-#: mailbox/email-mailbox.c:6037
-msgid "IDS_COM_POP_DATE"
-msgstr ""
-
-#: mailbox/email-mailbox.c:6038
-msgid "IDS_EMAIL_OPT_SENDER"
-msgstr ""
-
-#: mailbox/email-mailbox.c:6039
-msgid "IDS_EMAIL_OPT_UNREAD"
-msgstr ""
-
-#: mailbox/email-mailbox.c:6132
-msgid "IDS_COM_POP_UPDATE"
-msgstr ""
-
-#: mailbox/email-mailbox.c:6151 composer/email-composer.c:843
-msgid "IDS_EMAIL_SK_COMPOSE"
-msgstr ""
-
-#: mailbox/email-mailbox.c:6227 viewer/email-viewer.c:3001
-#: viewer/email-viewer.c:3051 viewer/email-viewer.c:4295
-msgid "IDS_EMAIL_OPT_BLOCK"
-msgstr ""
-
-#: mailbox/email-mailbox.c:6283
-msgid "IDS_COM_BODY_ALL"
-msgstr ""
-
-#. ugd->from_popup = elm_popup_add(ugd->main_layout);
-#. sprintf(from_str, "%s %s", _("IDS_EMAIL_BODY_FROM_M_SENDER"), ": ");
-#: mailbox/email-mailbox.c:6285 composer/email-composer-callback.c:1200
-#: composer/email-composer-recipient.c:127
-#: composer/email-composer-recipient.c:131
-#: composer/email-composer-recipient.c:361 composer/email-composer-util.c:2394
-#: composer/email-composer-util.c:2398 composer/email-composer-util.c:2586
-msgid "IDS_EMAIL_BODY_FROM_M_SENDER"
-msgstr ""
-
-#: mailbox/email-mailbox.c:6286 popup/email-popup.c:443
-#: viewer/email-viewer.c:863 viewer/email-viewer.c:1318
-#: composer/email-composer-recipient.c:27
-#: composer/email-composer-recipient.c:80
-#: composer/email-composer-recipient.c:83 composer/email-composer-util.c:2412
-#: composer/email-composer-util.c:2416 composer/email-composer-util.c:2596
-#: composer/email-composer-util.c:2600
-msgid "IDS_COM_BODY_TO"
-msgstr ""
-
-#: mailbox/email-mailbox.c:7151
-msgid "Selected mail's sender was blocked"
-msgstr ""
-
-#: mailbox/email-mailbox.c:7213
-msgid "Selected sender was blocked"
-msgstr ""
-
-#: mailbox/email-mailbox.c:8075
-msgid "IDS_COM_BODY_SEARCH"
-msgstr ""
-
-#: mailbox/email-mailbox.c:8315
-#, c-format
-msgid "%d thread selected"
-msgstr ""
-
-#: mailbox/email-mailbox.c:8317
-#, c-format
-msgid "%d threads selected"
-msgstr ""
-
-#: mailbox/email-mailbox.c:8322
-#, c-format
-msgid "%d sender selected"
-msgstr ""
-
-#: mailbox/email-mailbox.c:8324
-#, c-format
-msgid "%d senders selected"
-msgstr ""
-
-#: mailbox/email-mailbox.c:8329
-#, c-format
-msgid "%d email selected"
-msgstr ""
-
-#: mailbox/email-mailbox.c:8331
-#, c-format
-msgid "%d emails selected"
-msgstr ""
-
-#: main/email.c:94 viewer/email-viewer.c:238
-msgid "Application template"
-msgstr ""
-
-#: main/email.c:95 viewer/email-viewer.c:239
-msgid "Click to exit"
-msgstr ""
-
-#: popup/email-popup.c:443 composer/email-composer-callback.c:958
-msgid "IDS_EMAIL_POP_UNABLE_TO_SEND_EMAIL"
-msgstr ""
-
-#: popup/email-popup.c:443
-msgid "IDS_COM_BODY_DETAILS_TITLE"
-msgstr ""
-
-#: popup/email-popup.c:473
-msgid "IDS_COM_SK_RETRY"
-msgstr ""
-
-#: popup/email-popup.c:490
-msgid "Retry in 5 minutes"
-msgstr ""
-
-#: setting/email-setting.c:901 setting/email-view-other-account.c:288
-#: setting/email-view-server-type.c:219
-msgid "IDS_EMAIL_POP_SUCCEEDED"
-msgstr ""
-
-#: setting/email-setting-account-set.c:134
-#: setting/email-setting-account-set.c:202
-#: setting/email-setting-account-set.c:270
-#: setting/email-setting-account-set.c:340
-#: setting/email-setting-account-set.c:406
-#: setting/email-setting-account-set.c:475
-#: setting/email-setting-account-set.c:544 composer/email-composer-util.c:2649
-#: composer/email-composer-util.c:2691 composer/email-composer-util.c:3032
-#: composer/email-composer-util.c:3034 composer/email-composer-util.c:3087
-msgid "Sent from SLP"
-msgstr ""
-
-#: setting/email-setting-utils.c:921 viewer/email-viewer.c:8072
-#: composer/email-composer-util.c:3404
-msgid "PDP activation failure:Transport Error"
-msgstr ""
-
-#: setting/email-setting-utils.c:926 viewer/email-viewer.c:8077
-#: composer/email-composer-util.c:3409
-msgid "PDP activation failure:IP full"
-msgstr ""
-
-#: setting/email-setting-utils.c:931 viewer/email-viewer.c:8082
-#: composer/email-composer-util.c:3414
-msgid "Network busy"
-msgstr ""
-
-#: setting/email-setting-utils.c:936 viewer/email-viewer.c:8087
-#: composer/email-composer-util.c:3419
-msgid "Login allowed only every 15 minutes"
-msgstr ""
-
-#. ret = N_("Connection failure:Unknown");
-#: setting/email-setting-utils.c:942 viewer/email-viewer.c:8093
-#: composer/email-composer-util.c:3425
-msgid "IDS_COM_POP_CONNECTION_FAILED"
-msgstr ""
-
-#: setting/email-setting-utils.c:947
-msgid "Incorrect username or password"
-msgstr ""
-
-#: setting/email-setting-utils.c:952 viewer/email-viewer.c:8103
-#: composer/email-composer-util.c:3435
-msgid "Authentication failure"
-msgstr ""
-
-#: setting/email-setting-utils.c:957 viewer/email-viewer.c:8108
-#: composer/email-composer-util.c:3440
-msgid "Download canceled"
-msgstr ""
-
-#: setting/email-setting-utils.c:962 viewer/email-viewer.c:8113
-#: composer/email-composer-util.c:3445
-msgid "This mail was deleted at server side"
-msgstr ""
-
-#: setting/email-setting-utils.c:967 viewer/email-viewer.c:8118
-#: composer/email-composer-util.c:3450
-msgid "No such host"
-msgstr ""
-
-#: setting/email-setting-utils.c:972 viewer/email-viewer.c:8123
-#: composer/email-composer-util.c:3455
-msgid "Server unavailable"
-msgstr ""
-
-#: setting/email-setting-utils.c:977 viewer/email-viewer.c:8128
-#: composer/email-composer-util.c:3460
-msgid "No service"
-msgstr ""
-
-#: setting/email-setting-utils.c:982 viewer/email-viewer.c:8133
-#: composer/email-composer-util.c:3465
-msgid "Other failure"
-msgstr ""
-
-#: setting/email-view-account-edit.c:363
-msgid "IDS_COM_POP_DELETED"
-msgstr ""
-
-#: setting/email-view-account-edit.c:370
-msgid "IDS_COM_POP_UNABLE_TO_DELETE"
-msgstr ""
-
-#. ugd->popup_one = email_setting_get_auto_notify(vd, N_("Success to Edit Account"));
-#: setting/email-view-account-edit.c:454
-msgid "Succeeded in editing account"
-msgstr ""
-
-#: setting/email-view-account-edit.c:487 setting/email-view-server-type.c:253
-msgid "Creating account is canceled"
-msgstr ""
-
-#: setting/email-view-account-edit.c:492 setting/email-view-server-type.c:258
-msgid "IDS_EMAIL_POP_VALIDATION_FAILED"
-msgstr ""
-
-#: setting/email-view-account-edit.c:523
-#: setting/email-view-other-account.c:359 setting/email-view-server-type.c:294
-msgid "IDS_EMAIL_POP_VALIDATING_ACCOUNT_ING"
-msgstr ""
-
-#: setting/email-view-account-edit.c:556 viewer/email-viewer.c:2797
-msgid "IDS_COM_POP_DELETE_Q"
-msgstr ""
-
-#. elm_editfield_label_set(p->ef_incoming_port, _("Incoming Port"));
-#: setting/email-view-account-edit.c:712 setting/email-view-account-edit.c:821
-#: setting/email-view-account-edit.c:918 setting/email-view-account-edit.c:982
-#: setting/email-view-server-type.c:681
-msgid "IDS_EMAIL_BODY_INCOMING_PORT"
-msgstr ""
-
-#. elm_editfield_label_set(p->ef_smtp_port, N_("SMTP port"));
-#: setting/email-view-account-edit.c:713 setting/email-view-account-edit.c:823
-#: setting/email-view-account-edit.c:919 setting/email-view-account-edit.c:994
-#: setting/email-view-server-type.c:637
-msgid "IDS_EMAIL_BODY_OUTGOING_PORT"
-msgstr ""
-
-#. set entry name
-#: setting/email-view-account-edit.c:717 setting/email-view-account-edit.c:816
-#: setting/email-view-account-edit.c:913 setting/email-view-account-edit.c:952
-#: setting/email-view-other-account.c:826
-#: setting/email-view-other-account.c:852
-#: setting/email-view-other-account.c:889
-msgid "IDS_EMAIL_BODY_ACCOUNT_NAME"
-msgstr ""
-
-#. p->ly_title3 = elm_layout_add(p->bx);
-#. elm_layout_file_set(p->ly_title3, EV_THEME_PATH, "email.title.nbeat");
-#. evas_object_size_hint_align_set(p->ly_title3, EVAS_HINT_FILL, EVAS_HINT_FILL);
-#. evas_object_show(p->ly_title3);
-#. elm_box_pack_end(p->bx, p->ly_title3);
-#. edje_object_part_text_set(_EDJ(p->ly_title3), "elm.text", dgettext("sys_string", "IDS_COM_BODY_AUTH_PASSWORD"));
-#: setting/email-view-account-edit.c:771 setting/email-view-account-edit.c:819
-#: setting/email-view-account-edit.c:916 setting/email-view-account-edit.c:964
-#: setting/email-view-other-account.c:763
-#: setting/email-view-other-account.c:835
-#: setting/email-view-other-account.c:860
-#: setting/email-view-other-account.c:931
-msgid "IDS_COM_BODY_AUTH_PASSWORD"
-msgstr ""
-
-#: setting/email-view-account-edit.c:772 setting/email-view-account-edit.c:825
-#: setting/email-view-account-edit.c:922
-#: setting/email-view-account-edit.c:1002
-msgid "Sending Password"
-msgstr ""
-
-#. edje_object_part_text_set(_EDJ(p->ly_title1), "elm.text", dgettext("sys_string", "IDS_COM_BODY_EMAIL_ADDRESS"));
-#: setting/email-view-account-edit.c:817 setting/email-view-account-edit.c:914
-#: setting/email-view-account-edit.c:956
-#: setting/email-view-other-account.c:833
-#: setting/email-view-other-account.c:858
-#: setting/email-view-other-account.c:901
-msgid "IDS_COM_BODY_EMAIL_ADDRESS"
-msgstr ""
-
-#. p->ly_title2 = elm_layout_add(p->bx);
-#. elm_layout_file_set(p->ly_title2, EV_THEME_PATH, "email.title.nbeat");
-#. evas_object_size_hint_align_set(p->ly_title2, EVAS_HINT_FILL, EVAS_HINT_FILL);
-#. evas_object_show(p->ly_title2);
-#. elm_box_pack_end(p->bx, p->ly_title2);
-#. edje_object_part_text_set(_EDJ(p->ly_title2), "elm.text", dgettext("sys_string", "IDS_COM_BODY_USER_NAME"));
-#: setting/email-view-account-edit.c:818 setting/email-view-account-edit.c:915
-#: setting/email-view-account-edit.c:960
-#: setting/email-view-other-account.c:834
-#: setting/email-view-other-account.c:859
-#: setting/email-view-other-account.c:916
-msgid "IDS_COM_BODY_USER_NAME"
-msgstr ""
-
-#. elm_editfield_label_set(p->ef_incoming_server, _("Incoming Server"));
-#: setting/email-view-account-edit.c:820 setting/email-view-account-edit.c:917
-#: setting/email-view-server-type.c:659
-msgid "IDS_EMAIL_BODY_INCOMING_SERVER"
-msgstr ""
-
-#. elm_editfield_label_set(p->ef_smtp_server, N_("SMTP server"));
-#: setting/email-view-account-edit.c:822 setting/email-view-account-edit.c:920
-#: setting/email-view-account-edit.c:990 setting/email-view-server-type.c:615
-msgid "IDS_EMAIL_BODY_OUTGOING_SERVER"
-msgstr ""
-
-#: setting/email-view-account-edit.c:824 setting/email-view-account-edit.c:921
-#: setting/email-view-account-edit.c:998
-msgid "Sending Username"
-msgstr ""
-
-#: setting/email-view-account-edit.c:971
-msgid "IDS_EMAIL_BODY_IMAP4_SERVER"
-msgstr ""
-
-#: setting/email-view-account-edit.c:978
-msgid "IDS_EMAIL_BODY_POP3_SERVER"
-msgstr ""
-
-#. snprintf(buf, sizeof(buf), "%s", _("Off"));
-#: setting/email-view-account-edit.c:986
-#: setting/email-view-account-edit.c:1007 setting/email-view-server-type.c:509
-#: setting/email-view-server-type.c:548 setting/email-view-server-type.c:714
-msgid "IDS_COM_SK_OFF"
-msgstr ""
-
-#. snprintf(buf, sizeof(buf), "%s", N_("Sending security"));
-#. snprintf(buf, sizeof(buf), "%s", N_("Incoming security"));
-#: setting/email-view-account-edit.c:988
-#: setting/email-view-account-edit.c:1009 setting/email-view-server-type.c:481
-#: setting/email-view-server-type.c:496
-msgid "IDS_EMAIL_BODY_SECURE_CONNECTION"
-msgstr ""
-
-#: setting/email-view-account-options.c:382
-#: setting/email-view-account-options.c:622
-msgid "IDS_EMAIL_BODY_REPLY_WITH_BODY"
-msgstr ""
-
-#: setting/email-view-account-options.c:398
-#: setting/email-view-account-options.c:627
-msgid "IDS_EMAIL_BODY_FORWARD_WITH_FILES"
-msgstr ""
-
-#: setting/email-view-account-options.c:414
-#: setting/email-view-account-options.c:632
-msgid "IDS_EMAIL_BODY_ALWAYS_BCC_MYSELF"
-msgstr ""
-
-#: setting/email-view-account-options.c:430
-#: setting/email-view-account-options.c:642
-msgid "IDS_EMAIL_BODY_ADD_SIGNATURE"
-msgstr ""
-
-#: setting/email-view-account-options.c:443
-#: setting/email-view-account-options.c:659
-#: setting/email-view-account-options.c:905
-msgid "IDS_EMAIL_BODY_SIGNATURE"
-msgstr ""
-
-#: setting/email-view-account-options.c:490
-#: setting/email-view-account-options.c:674
-#: setting/email-view-receiving-option-size.c:356
-msgid "IDS_COM_BODY_EMAIL_SIZE"
-msgstr ""
-
-#. set the struct values
-#: setting/email-view-account-options.c:494
-#: setting/email-view-account-options.c:498
-#: setting/email-view-account-options.c:684
-#: setting/email-view-account-options.c:688
-#: setting/email-view-account-options.c:759
-#: setting/email-view-receiving-option-size.c:112
-msgid "IDS_EMAIL_BODY_WITHOUT_ATTACHMENTS"
-msgstr ""
-
-#: setting/email-view-account-options.c:502
-#: setting/email-view-account-options.c:692
-#: setting/email-view-account-options.c:763
-#: setting/email-view-receiving-option-size.c:113
-msgid "IDS_EMAIL_BODY_ENTIRE_EMAIL"
-msgstr ""
-
-#: setting/email-view-account-options.c:515
-#: setting/email-view-account-options.c:637
-msgid "IDS_EMAIL_BODY_KEEP_IN_SERVER"
-msgstr ""
-
-#: setting/email-view-account-options.c:545
-msgid "IDS_EMAIL_HEADER_MAILBOXES"
-msgstr ""
-
-#: setting/email-view-account-options.c:552
-#: setting/email-view-account-options.c:713
-msgid "IDS_EMAIL_BODY_SENTBOX"
-msgstr ""
-
-#: setting/email-view-account-options.c:560
-#: setting/email-view-account-options.c:717
-msgid "IDS_EMAIL_BODY_DRAFTS"
-msgstr ""
-
-#: setting/email-view-account-options.c:568
-#: setting/email-view-account-options.c:721
-msgid "IDS_EMAIL_BODY_TRASH"
-msgstr ""
-
-#: setting/email-view-account-options.c:576
-#: setting/email-view-account-options.c:725
-msgid "IDS_EMAIL_BODY_SPAMBOX"
-msgstr ""
-
-#: setting/email-view-account-options.c:797
-msgid "Mailbox setup"
-msgstr ""
-
-#. elm_navigationbar_push(vd->ugd->navi_bar, N_("Account Settings"), p->l_button, NULL, NULL, p->layout);
-#: setting/email-view-account-options.c:1421
-msgid "IDS_EMAIL_HEADER_ACCOUNT_SETTINGS"
-msgstr ""
-
-#: setting/email-view-default-account.c:326 setting/email-view-setting.c:422
-#: setting/email-view-setting.c:752
-msgid "IDS_EMAIL_BODY_DEFAULT_ACCOUNT"
-msgstr ""
-
-#: setting/email-view-other-account.c:319
-msgid "<align=center>Creating account is canceled"
-msgstr ""
-
-#: setting/email-view-other-account.c:398 setting/email-view-server-type.c:332
-#: composer/email-composer-attachment.c:44
-#: composer/email-composer-predictive-search.c:550
-#: composer/email-composer-predictive-search.c:565
-#: composer/email-composer-predictive-search.c:580
-#: composer/email-composer-predictive-search.c:1008
-#: composer/email-composer-predictive-search.c:1023
-#: composer/email-composer-predictive-search.c:1038
-#: composer/email-composer-recent.c:581
-#: composer/email-composer-ug-caller.c:870
-#: composer/email-composer-ug-caller.c:1100
-#: composer/email-composer-util.c:1800 composer/email-composer-util.c:1890
-#: composer/email-composer-util.c:2013 composer/email-composer-util.c:2135
-msgid "IDS_COM_POP_ALREDY_EXISTS"
-msgstr ""
-
-#: setting/email-view-other-account.c:400 setting/email-view-server-type.c:334
-msgid "Failed to create account"
-msgstr ""
-
-#: setting/email-view-other-account.c:535
-msgid "Please check server name in email address"
-msgstr ""
-
-#: setting/email-view-other-account.c:888
-msgid "IDS_EMAIL_BODY_EXAMPLE"
-msgstr ""
-
-#: setting/email-view-other-account.c:931
-msgid "IDS_EMAIL_BODY_USER_PASSWORD"
-msgstr ""
-
-#: setting/email-view-other-account.c:970
-msgid "IDS_COM_SK_NEXT"
-msgstr ""
-
-#: setting/email-view-other-account.c:990
-#: setting/email-view-select-account.c:270
-#: setting/email-view-server-type.c:1181
-msgid "IDS_COM_SK_ADD_ACCOUNT"
-msgstr ""
-
-#: setting/email-view-receiving-option-mailbox-setup.c:142
-msgid "Mailbox Setup"
-msgstr ""
-
-#. str =       strdup(N_("Others"));   //20110208_string
-#: setting/email-view-select-account.c:143
-msgid "IDS_EMAIL_OPT_OTHERS"
-msgstr ""
-
-#: setting/email-view-server-type.c:488
-msgid "Incoming server type"
-msgstr ""
-
-#: setting/email-view-server-type.c:515 setting/email-view-server-type.c:554
-#: setting/email-view-server-type.c:718
-msgid "SSL"
-msgstr ""
-
-#: setting/email-view-server-type.c:521 setting/email-view-server-type.c:560
-#: setting/email-view-server-type.c:722
-msgid "TLS"
-msgstr ""
-
-#: setting/email-view-server-type.c:531 setting/email-view-server-type.c:766
-msgid "POP3"
-msgstr ""
-
-#: setting/email-view-server-type.c:537 setting/email-view-server-type.c:770
-msgid "IMAP4"
-msgstr ""
-
-#: setting/email-view-setting.c:125
-msgid "IDS_COM_POP_NO_ACCOUNTS"
-msgstr ""
-
-#: setting/email-view-setting.c:311
-msgid "Change account color"
-msgstr ""
-
-#. snprintf(buf, sizeof(buf), "%s", N_("General settings"));
-#: setting/email-view-setting.c:403
-msgid "IDS_EMAIL_BODY_GENERAL_SETTINGS"
-msgstr ""
-
-#: setting/email-view-setting.c:429 setting/email-view-setting.c:762
-#: setting/email-view-show-email-list.c:367
-msgid "IDS_EMAIL_BODY_RETRIEVING_OPTIONS"
-msgstr ""
-
-#: setting/email-view-setting.c:691
-msgid "IDS_COM_SK_ADD"
-msgstr ""
-
-#: setting/email-view-setting.c:705
-msgid "IDS_EMAIL_HEADER_EMAIL_SETTINGS"
-msgstr ""
-
-#. snprintf(send_subject, sizeof(send_subject), "%s: %s", N_("None"), ugd->emf_data->mail_info->head->subject);
-#. snprintf(send_subject, sizeof(send_subject), "%s: ", N_("None"));
-#: setting/email-view-setting.c:1007 viewer/email-viewer.c:771
-#: viewer/email-viewer.c:796
-msgid "IDS_COM_BODY_NONE"
-msgstr ""
-
-#: viewer/email-viewer.c:634
-msgid "IDS_COM_SK_REPLY"
-msgstr ""
-
-#: viewer/email-viewer.c:635
-msgid "IDS_EMAIL_SK_REPLY_ALL"
-msgstr ""
-
-#: viewer/email-viewer.c:636
-msgid "IDS_COM_BODY_FORWARD"
-msgstr ""
-
-#: viewer/email-viewer.c:751 viewer/email-viewer.c:776
-#: viewer/email-viewer.c:909 viewer/email-viewer.c:1208
-msgid "IDS_COM_POP_ACCEPT"
-msgstr ""
-
-#. snprintf(send_subject, sizeof(send_subject), "%s: %s", N_("Accepted"), ugd->emf_data->mail_info->head->subject);
-#. snprintf(send_subject, sizeof(send_subject), "%s: ", N_("Accepted"));
-#: viewer/email-viewer.c:754 viewer/email-viewer.c:779
-#, c-format
-msgid "IDS_EMAIL_BODY_ACCEPTED_C_PS"
-msgstr ""
-
-#. else if(!strcmp(button_label, N_("Decline")))
-#. elm_button_label_set( peoDeclineBtn, N_("Decline") );
-#: viewer/email-viewer.c:757 viewer/email-viewer.c:782
-#: viewer/email-viewer.c:918 viewer/email-viewer.c:1211
-msgid "IDS_EMAIL_BUTTON_DECLINE_ABB"
-msgstr ""
-
-#. snprintf(send_subject, sizeof(send_subject), "%s: %s", N_("Declined"), ugd->emf_data->mail_info->head->subject);
-#. snprintf(send_subject, sizeof(send_subject), "%s: ", N_("Declined"));
-#: viewer/email-viewer.c:760 viewer/email-viewer.c:785
-#, c-format
-msgid "IDS_EMAIL_BODY_DECLINED_C_PS"
-msgstr ""
-
-#: viewer/email-viewer.c:762 viewer/email-viewer.c:787
-#: viewer/email-viewer.c:913 viewer/email-viewer.c:1209
-msgid "Tentative"
-msgstr ""
-
-#. snprintf(send_subject, sizeof(send_subject), "%s: %s", N_("Tentative"), ugd->emf_data->mail_info->head->subject);
-#. snprintf(send_subject, sizeof(send_subject), "%s: ", N_("Tentative"));
-#: viewer/email-viewer.c:765 viewer/email-viewer.c:790
-#, c-format
-msgid "IDS_EMAIL_BODY_TENTATIVE_C_PS"
-msgstr ""
-
-#: viewer/email-viewer.c:848
-#, c-format
-msgid "IDS_EMAIL_BODY_WHEN_C_PS"
-msgstr ""
-
-#. sprintf(send_text_body, "%s: %s\n%s: %s      - %s\n%s: %s", dgettext("sys_string", "IDS_COM_BODY_TO"), reply,
-#. N_("When"), asctime(&(meeting_req->start_time)), asctime(&(meeting_req->end_time)),
-#. N_("Where"), meeting_req->location);
-#. sprintf(send_text_body, "%s: %s\n%s: %s      - %s\n%s: ", dgettext("sys_string", "IDS_COM_BODY_TO"), reply,
-#. N_("When"), asctime(&(meeting_req->start_time)), asctime(&(meeting_req->end_time)),
-#. N_("Where"));
-#: viewer/email-viewer.c:854 viewer/email-viewer.c:861
-#, c-format
-msgid "IDS_EMAIL_BODY_WHERE_C_PS"
-msgstr ""
-
-#: viewer/email-viewer.c:1394 composer/email-composer.c:788
-#: composer/email-composer-recipient.c:89
-#: composer/email-composer-recipient.c:92
-#: composer/email-composer-recipient.c:198
-#: composer/email-composer-recipient.c:267
-#: composer/email-composer-recipient.c:596
-#: composer/email-composer-recipient.c:607
-#: composer/email-composer-recipient.c:625
-#: composer/email-composer-recipient.c:633
-msgid "IDS_EMAIL_BODY_CC"
-msgstr ""
-
-#: viewer/email-viewer.c:1473 composer/email-composer.c:803
-#: composer/email-composer-recipient.c:107
-#: composer/email-composer-recipient.c:110
-#: composer/email-composer-recipient.c:276
-msgid "IDS_EMAIL_BODY_BCC"
-msgstr ""
-
-#: viewer/email-viewer.c:1618 composer/email-composer.c:817
-msgid "IDS_EMAIL_BODY_ATTACHMENTS"
-msgstr ""
-
-#. elm_button_label_set(dn_btn, N_("Download full message"));
-#: viewer/email-viewer.c:1912
-msgid "IDS_EMAIL_BODY_DOWNLOAD_FULL_MESSAGE"
-msgstr ""
-
-#: viewer/email-viewer.c:2283 viewer/email-viewer.c:4105
-#: viewer/email-viewer.c:5561
-msgid "IDS_COM_POP_DOWNLOADING"
-msgstr ""
-
-#. show popup
-#: viewer/email-viewer.c:2320 viewer/email-viewer.c:4113
-#: viewer/email-viewer.c:4472 viewer/email-viewer.c:5235
-#: viewer/email-viewer.c:5781
-msgid "IDS_COM_POP_WARNING"
-msgstr ""
-
-#: viewer/email-viewer.c:2320 viewer/email-viewer.c:4113
-#: viewer/email-viewer.c:4472 viewer/email-viewer.c:5780
-#: viewer/email-viewer.c:5963 viewer/email-viewer.c:6006
-#: viewer/email-viewer.c:6017 composer/email-composer.c:1914
-msgid "IDS_EMAIL_POP_UNABLE_TO_DOWNLOAD"
-msgstr ""
-
-#: viewer/email-viewer.c:2731 viewer/email-viewer.c:3631
-#: viewer/email-viewer.c:3667 viewer/email-viewer.c:3703
-msgid "IDS_COM_OPT_CREATE_CONTACT"
-msgstr ""
-
-#. 20101104_string
-#: viewer/email-viewer.c:2732 viewer/email-viewer.c:3041
-#: viewer/email-viewer.c:3632 viewer/email-viewer.c:3668
-#: viewer/email-viewer.c:3704 viewer/email-viewer.c:4294
-msgid "IDS_EMAIL_OPT_UPDATE_EXISTING"
-msgstr ""
-
-#: viewer/email-viewer.c:2786
-msgid "Delete is under construction in Split-view"
-msgstr ""
-
-#. elm_button_label_set(ug_data->opt_btn1, N_("View detail contact"));
-#: viewer/email-viewer.c:2991
-msgid "View contact detail"
-msgstr ""
-
-#. elm_ctxpopup_item_append(ug_data->con_popup, _("IDS_EMAIL_OPT_SEND_MESSAGE"), NULL, ev_ctxpopup_send_message_by_email_cb, link_text);
-#: viewer/email-viewer.c:3031 viewer/email-viewer.c:4293
-#: viewer/email-viewer.c:8401 viewer/email-viewer.c:8420
-#: viewer/email-viewer.c:8438 viewer/email-viewer.c:8457
-#: viewer/email-viewer.c:8906 viewer/email-viewer.c:8931
-#: viewer/email-viewer.c:8955 viewer/email-viewer.c:8980
-#: viewer/email-viewer.c:9006
-msgid "IDS_COM_OPT_ADD_TO_CONTACTS"
-msgstr ""
-
-#: viewer/email-viewer.c:3754
-msgid "Failed to add block rule"
-msgstr ""
-
-#. snprintf(desc, MAX_STR_LEN, "%s %s", addr, N_("is blocked"));
-#. elm_popup_desc_set(ug_data->timeout_popup, desc);
-#. elm_popup_title_label_set(ug_data->timeout_popup, N_("Notice"));
-#. 20110208_string
-#: viewer/email-viewer.c:3770
-msgid "Blocked"
-msgstr ""
-
-#: viewer/email-viewer.c:4464
-msgid "IDS_EMAIL_POP_DOWNLOADING_ING"
-msgstr ""
-
-#. if(info && info->name)
-#. snprintf(buf, sizeof(buf), N_("Saving %s %d%%"), info->name, per);
-#. else
-#: viewer/email-viewer.c:5193
-#, c-format
-msgid "Saving in My files %d%%"
-msgstr ""
-
-#: viewer/email-viewer.c:5234
-msgid "Cancelling all attachment download operations..."
-msgstr ""
-
-#: viewer/email-viewer.c:5283
-msgid "Saving in My files"
-msgstr ""
-
-#: viewer/email-viewer.c:5287
-#, c-format
-msgid "Saving in My files 0%%"
-msgstr ""
-
-#. must be
-#. ug_data->b_eng_att_start = 1;
-#: viewer/email-viewer.c:5810 viewer/email-viewer.c:7801
-#: viewer/email-viewer.c:7899 viewer/email-viewer.c:7956
-#: composer/email-composer.c:1803 composer/email-composer.c:1889
-#: composer/email-composer-util.c:1385
-msgid "IDS_EMAIL_POP_DOWNLOADING_ATTACHMENT_ING"
-msgstr ""
-
-#: viewer/email-viewer.c:6135
-msgid "IDS_EMAIL_POP_FILE_ALREADY_EXISTS"
-msgstr ""
-
-#: viewer/email-viewer.c:6137
-msgid "IDS_COM_POP_SAVED"
-msgstr ""
-
-#: viewer/email-viewer.c:6139
-msgid "IDS_EMAIL_POP_UNABLE_TO_SAVE_ATTACHMENT"
-msgstr ""
-
-#: viewer/email-viewer.c:6205
-msgid "Download message"
-msgstr ""
-
-#: viewer/email-viewer.c:7773
-msgid "Download already in progress"
-msgstr ""
-
-#. attachment open fail popup
-#: viewer/email-viewer.c:7808 viewer/email-viewer.c:7963
-msgid "IDS_EMAIL_POP_UNABLE_TO_OPEN_ATTACHMENT"
-msgstr ""
-
-#: viewer/email-viewer.c:8010
-msgid "IDS_EMAIL_POP_UNABLE_TO_LAUNCH_APPLICATION"
-msgstr ""
-
-#: viewer/email-viewer.c:8014 viewer/email-viewer.c:8018
-msgid "IDS_COM_POP_UNSUPPORTED_FILE_TYPE"
-msgstr ""
-
-#: viewer/email-viewer.c:8098 composer/email-composer-util.c:3430
-msgid "Login failure"
-msgstr ""
-
-#: viewer/email-viewer.c:8398 viewer/email-viewer.c:8903
-msgid "IDS_COM_BODY_VOICE_CALL"
-msgstr ""
-
-#: viewer/email-viewer.c:8399 viewer/email-viewer.c:8904
-msgid "IDS_COM_BODY_VIDEO_CALL"
-msgstr ""
-
-#: viewer/email-viewer.c:8400 viewer/email-viewer.c:8905
-msgid "IDS_COM_BODY_SEND_MESSAGE"
-msgstr ""
-
-#: viewer/email-viewer.c:8418 viewer/email-viewer.c:8929
-msgid "IDS_EMAIL_OPT_SEND_EMAIL"
-msgstr ""
-
-#: viewer/email-viewer.c:8437 viewer/email-viewer.c:8456
-#: viewer/email-viewer.c:8954 viewer/email-viewer.c:8979
-#: viewer/email-viewer.c:9005
-msgid "IDS_EMAIL_OPT_OPEN_URL"
-msgstr ""
-
-#: viewer/email-viewer.c:8439 viewer/email-viewer.c:8458
-#: viewer/email-viewer.c:8956 viewer/email-viewer.c:8981
-#: viewer/email-viewer.c:9007
-msgid "IDS_COM_OPT_ADD_TO_BOOKMARKS"
-msgstr ""
-
-#: viewer/email-viewer-webview.c:219
-msgid "IDS_EMAIL_POP_LOADING_CONTENTS_ING"
-msgstr ""
-
-#: composer/email-composer.c:386 composer/email-composer-callback.c:99
-msgid "IDS_EMAIL_POP_SAVE_IN_DRAFTS_Q"
-msgstr ""
-
-#: composer/email-composer.c:775 composer/email-composer.c:830
-msgid "IDS_COM_SK_SEND_ABB"
-msgstr ""
-
-#: composer/email-composer-attachment.c:101
-#: composer/email-composer-util.c:2883
-#, c-format
-msgid "IDS_EMAIL_POP_UNABLE_TO_ATTACH_MAXIMUM_NUMBER_OF_FILES_IS_PD"
-msgstr ""
-
-#: composer/email-composer-attachment.c:113
-#: composer/email-composer-util.c:2903
-#, c-format
-msgid "IDS_EMAIL_POP_UNABLE_TO_ATTACH_MAXIMUM_SIZE_OF_FILES_IS_PD_KB"
-msgstr ""
-
-#: composer/email-composer-attachment.c:348
-#, c-format
-msgid "IDS_EMAIL_BODY_PD_ITEMS"
-msgstr ""
-
-#: composer/email-composer-attachment.c:356
-#: composer/email-composer-attachment.c:373
-msgid "Byte"
-msgstr ""
-
-#: composer/email-composer-callback.c:415
-#: composer/email-composer-callback.c:1201
-#: composer/email-composer-callback.c:1521
-msgid "IDS_COM_POP_CLOSE"
-msgstr ""
-
-#: composer/email-composer-callback.c:427
-#: composer/email-composer-callback.c:1069
-msgid "Change address"
-msgstr ""
-
-#. _composer_popup_add(ugd, 0, dgettext("sys_string", "IDS_COM_POP_SENDING")); //20110104_string
-#: composer/email-composer-callback.c:940
-#: composer/email-composer-callback.c:1571
-msgid "IDS_COM_POP_SENDING"
-msgstr ""
-
-#: composer/email-composer-callback.c:952
-msgid "IDS_EMAIL_POP_TOO_MANY_RECIPIENTS"
-msgstr ""
-
-#: composer/email-composer-callback.c:1186
-msgid "IDS_EMAIL_POP_UNABLE_TO_ENTER_TEXT"
-msgstr ""
-
-#: composer/email-composer-callback.c:1537
-msgid "Inline image"
-msgstr ""
-
-#: composer/email-composer-callback.c:1539
-msgid "IDS_COM_BODY_GALLERY"
-msgstr ""
-
-#: composer/email-composer-callback.c:1540
-msgid "IDS_COM_BODY_TAKE_PHOTO"
-msgstr ""
-
-#: composer/email-composer-callback.c:1541
-msgid "Record sound"
-msgstr ""
-
-#: composer/email-composer-callback.c:1542
-msgid "IDS_COM_BODY_MY_FILES"
-msgstr ""
-
-#: composer/email-composer-callback.c:1546
-msgid "IDS_COM_BODY_CALENDAR"
-msgstr ""
-
-#: composer/email-composer-callback.c:1547
-msgid "IDS_COM_BODY_MEMO"
-msgstr ""
-
-#: composer/email-composer-callback.c:1550
-msgid "IDS_COM_OPT_IMAGE"
-msgstr ""
-
-#. 20110104_string
-#: composer/email-composer-callback.c:1551
-msgid "IDS_COM_BODY_VIDEO"
-msgstr ""
-
-#: composer/email-composer-callback.c:1552
-msgid "IDS_COM_BODY_SOUNDS"
-msgstr ""
-
-#: composer/email-composer-contents.c:87 composer/email-composer-contents.c:93
-msgid "Content"
-msgstr ""
-
-#: composer/email-composer-contents.c:642
-#: composer/email-composer-contents.c:746
-msgid "Clipboard"
-msgstr ""
-
-#: composer/email-composer-recent.c:635
-#: composer/email-composer-ug-caller.c:613 composer/email-composer-util.c:1715
-msgid "Duplicated recipient"
-msgstr ""
-
-#: composer/email-composer-recipient.c:42
-msgid "Cc/Bcc/From"
-msgstr ""
-
-#: composer/email-composer-recipient.c:46
-#: composer/email-composer-recipient.c:98
-#: composer/email-composer-recipient.c:101
-#: composer/email-composer-recipient.c:713
-#: composer/email-composer-recipient.c:795
-msgid "IDS_EMAIL_BODY_CC_BCC"
-msgstr ""
-
-#. else if(strcmp(title, N_("Cc/Bcc/From")) == 0)      //20101104_string
-#. sprintf(str, "%s %s", N_("Cc/Bcc/From"), ": ");
-#. snprintf(str, sizeof(str)-1, "%s %s", N_("Cc/Bcc/From"), ": ");
-#: composer/email-composer-recipient.c:117
-#: composer/email-composer-recipient.c:121
-#: composer/email-composer-recipient.c:677
-#: composer/email-composer-recipient.c:757
-msgid "IDS_EMAIL_BODY_CC_BCC_FROM"
-msgstr ""
-
-#: composer/email-composer-ug-caller.c:689
-#: composer/email-composer-ug-caller.c:993
-msgid "Contact has no email address."
-msgstr ""
-
-#: composer/email-composer-util.c:42
-msgid "Jan"
-msgstr ""
-
-#: composer/email-composer-util.c:43
-msgid "Feb"
-msgstr ""
-
-#: composer/email-composer-util.c:44
-msgid "Mar"
-msgstr ""
-
-#: composer/email-composer-util.c:45
-msgid "Apr"
-msgstr ""
-
-#: composer/email-composer-util.c:46
-msgid "May"
-msgstr ""
-
-#: composer/email-composer-util.c:47
-msgid "Jun"
-msgstr ""
-
-#: composer/email-composer-util.c:48
-msgid "Jul"
-msgstr ""
-
-#: composer/email-composer-util.c:49
-msgid "Aug"
-msgstr ""
-
-#: composer/email-composer-util.c:50
-msgid "Sep"
-msgstr ""
-
-#: composer/email-composer-util.c:51
-msgid "Oct"
-msgstr ""
-
-#: composer/email-composer-util.c:52
-msgid "Nov"
-msgstr ""
-
-#: composer/email-composer-util.c:53
-msgid "Dec"
-msgstr ""
-
-#: composer/email-composer-util.c:976
-msgid "IDS_EMAIL_POP_UNABLE_TO_SAVE_IN_DRAFTS"
-msgstr ""
-
-#: composer/email-composer-util.c:987
-msgid "Saved in Drafts"
-msgstr ""
-
-#: composer/email-composer-util.c:1342
-msgid "Download attachment?"
-msgstr ""
-
-#: composer/email-composer-util.c:1841 composer/email-composer-util.c:1978
-#: composer/email-composer-util.c:2095
-msgid "Maximum number of recipients reached. <br>(Maximum = 100)"
-msgstr ""
-
-#. sprintf(subject_temp, "%s: %s",N_("Fwd"), ugd->mail_info->mail->head->subject);     //20101105_string
-#: composer/email-composer-util.c:2187
-msgid "IDS_EMAIL_BODY_FWD_C"
-msgstr ""
-
-#: composer/email-composer-util.c:2195
-msgid "RE"
-msgstr ""
-
-#. sprintf(subject_temp, "%s: %s",N_("RE"), ugd->mail_info->mail->head->subject);
-#: composer/email-composer-util.c:2199
-msgid "IDS_EMAIL_BODY_RE_C"
-msgstr ""
-
-#: composer/email-composer-util.c:2403 composer/email-composer-util.c:2407
-#: composer/email-composer-util.c:2592
-msgid "IDS_EMAIL_BODY_SENT_C"
-msgstr ""
-
-#. text_for_original_info = g_strconcat(BODY_TAG_START, DIVIDE_LINE_FOR_HTML, text_for_from, text_for_sent, text_for_to, text_for_subject, BODY_TAG_END, NULL);
-#. text_for_original_info = g_strconcat(BODY_TAG_START, DIVIDE_LEFT_LINE_FOR_HTML, N_("Original Message"), DIVIDE_RIGHT_LINE_FOR_HTML, text_for_from, text_for_sent, text_for_to, text_for_subject, BODY_TAG_END, NULL);
-#: composer/email-composer-util.c:2609
-msgid "IDS_EMAIL_BODY_ORIGINAL_MESSAGE"
-msgstr ""
diff --git a/po/en.po b/po/en.po
deleted file mode 100755 (executable)
index 14172f4..0000000
--- a/po/en.po
+++ /dev/null
@@ -1,465 +0,0 @@
-msgid "IDS_EMAIL_POP_NO_EMAIL_ADDRESS"
-msgstr "No email address"
-
-msgid "IDS_EMAIL_BODY_COMPLETE"
-msgstr "Complete"
-
-msgid "IDS_EMAIL_BODY_ACCEPTED_C_PS"
-msgstr "Accepted: %s"
-
-msgid "IDS_EMAIL_BODY_DECLINED_C_PS"
-msgstr "Declined: %s"
-
-msgid "IDS_EMAIL_BODY_DOWNLOAD_FULL_MESSAGE"
-msgstr "Download full message"
-
-msgid "IDS_EMAIL_BODY_GENERAL_SETTINGS"
-msgstr "General settings"
-
-msgid "IDS_EMAIL_BODY_TENTATIVE_C_PS"
-msgstr "Tentative: %s"
-
-msgid "IDS_EMAIL_BODY_WHEN_C_PS"
-msgstr "When: %s"
-
-msgid "IDS_EMAIL_BODY_WHERE_C_PS"
-msgstr "Where: %s"
-
-msgid "IDS_EMAIL_BUTTON_DECLINE_ABB"
-msgstr "Decline"
-
-msgid "IDS_EMAIL_BODY_NO_CONTENTS"
-msgstr "No contents"
-
-msgid "IDS_EMAIL_BODY_ORIGINAL_MESSAGE"
-msgstr "Original message"
-
-msgid "IDS_EMAIL_HEADER_ACCOUNT_SETTINGS"
-msgstr "Account settings"
-
-msgid "IDS_EMAIL_OPT_BLOCK"
-msgstr "Block"
-
-msgid "IDS_EMAIL_OPT_MARK_AS_READ"
-msgstr "Mark as read"
-
-msgid "IDS_EMAIL_OPT_MARK_AS_UNREAD"
-msgstr "Mark as unread"
-
-msgid "IDS_EMAIL_OPT_OTHERS"
-msgstr "Others"
-
-msgid "IDS_EMAIL_OPT_UNREAD"
-msgstr "Unread"
-
-msgid "IDS_EMAIL_SK_COMPOSE"
-msgstr "Compose"
-
-msgid "IDS_EMAIL_HEADER_DOWNLOAD_FAILED"
-msgstr "Download failed"
-
-msgid "IDS_EMAIL_OPT_ADD_TO_CONTACT"
-msgstr "Add to contact"
-
-msgid "IDS_EMAIL_OPT_VOICE_CALL"
-msgstr "Voice call"
-
-msgid "IDS_EMAIL_BODY_ACCOUNT_NAME"
-msgstr "Account name"
-
-msgid "IDS_EMAIL_BODY_ATTACHMENTS"
-msgstr "Attachments"
-
-msgid "IDS_EMAIL_BODY_FROM_C"
-msgstr "From:"
-
-msgid "IDS_EMAIL_BODY_IMAP4_SERVER"
-msgstr "IMAP4 server"
-
-msgid "IDS_EMAIL_BODY_INCLUDES"
-msgstr "Includes"
-
-msgid "IDS_EMAIL_BODY_INCOMING_PORT"
-msgstr "Incoming port"
-
-msgid "IDS_EMAIL_BODY_INCOMING_SERVER"
-msgstr "Incoming server"
-
-msgid "IDS_EMAIL_BODY_IN_PD_MINUTES"
-msgstr "In %d minutes"
-
-msgid "IDS_EMAIL_BODY_KEEP_IN_SERVER"
-msgstr "Keep in server"
-
-msgid "IDS_EMAIL_BODY_NO_TEXT"
-msgstr "No text"
-
-msgid "IDS_EMAIL_BODY_OUTGOING_PORT"
-msgstr "Outgoing port"
-
-msgid "IDS_EMAIL_BODY_OUTGOING_SERVER"
-msgstr "Outgoing server"
-
-msgid "IDS_EMAIL_BODY_PD_EMAILS"
-msgstr "%d emails"
-
-msgid "IDS_EMAIL_BODY_POP3_SERVER"
-msgstr "POP3 server"
-
-msgid "IDS_EMAIL_BODY_RECENT"
-msgstr "Recent"
-
-msgid "IDS_EMAIL_BODY_RETRIEVING_OPTIONS"
-msgstr "Retrieving options"
-
-msgid "IDS_EMAIL_BODY_RE_C"
-msgstr "RE:"
-
-msgid "IDS_EMAIL_BODY_SENT_C"
-msgstr "Sent:"
-
-msgid "IDS_EMAIL_BODY_SENT_FROM_SAMSUNG_MOBILE"
-msgstr "Sent from Samsung Mobile"
-
-msgid "IDS_EMAIL_BODY_USER_PASSWORD"
-msgstr "User password"
-
-msgid "IDS_EMAIL_HEADER_EDIT_RULES"
-msgstr "Edit rules"
-
-msgid "IDS_EMAIL_HEADER_EMAIL_SETTINGS"
-msgstr "Email settings"
-
-msgid "IDS_EMAIL_HEADER_MAILBOXES"
-msgstr "Mailboxes"
-
-msgid "IDS_EMAIL_POP_ALERT"
-msgstr "Alert"
-
-msgid "IDS_EMAIL_POP_FILE_ALREADY_EXISTS"
-msgstr "File already exists"
-
-msgid "IDS_EMAIL_POP_NO_SENDER"
-msgstr "No sender"
-
-msgid "IDS_EMAIL_POP_SUCCEEDED"
-msgstr "Succeeded"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ATTACH_MAXIMUM_NUMBER_OF_FILES_IS_PD"
-msgstr "Unable to attach. Maximum number of files is %d"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ATTACH_MAXIMUM_SIZE_OF_FILES_IS_PD_KB"
-msgstr "Unable to attach. Maximum size of files is %d KB"
-
-msgid "IDS_EMAIL_POP_VALIDATION_FAILED"
-msgstr "Validation failed"
-
-msgid "IDS_EMAIL_SK_REPLY_ALL"
-msgstr "Reply all"
-
-msgid "IDS_EMAIL_BODY_1_ITEM"
-msgstr "1 item"
-
-msgid "IDS_EMAIL_BODY_ADD_MY_NAMECARD"
-msgstr "Add my namecard"
-
-msgid "IDS_EMAIL_BODY_ADD_SIGNATURE"
-msgstr "Add signature"
-
-msgid "IDS_EMAIL_BODY_ALL_EMAILS"
-msgstr "All emails"
-
-msgid "IDS_EMAIL_BODY_ALWAYS_BCC_MYSELF"
-msgstr "Always Bcc myself"
-
-msgid "IDS_EMAIL_BODY_BCC"
-msgstr "Bcc"
-
-msgid "IDS_EMAIL_BODY_BLOCK_EMAILS"
-msgstr "Block emails"
-
-msgid "IDS_EMAIL_BODY_BODY"
-msgstr "Body"
-
-msgid "IDS_EMAIL_BODY_CC"
-msgstr "Cc"
-
-msgid "IDS_EMAIL_BODY_CC_BCC"
-msgstr "Cc/Bcc"
-
-msgid "IDS_EMAIL_BODY_CHECK_INTERVAL"
-msgstr "Check interval"
-
-msgid "IDS_EMAIL_BODY_DEFAULT_ACCOUNT"
-msgstr "Default account"
-
-msgid "IDS_EMAIL_BODY_DRAFTS"
-msgstr "Drafts"
-
-msgid "IDS_EMAIL_BODY_EMAIL_ACCOUNTS"
-msgstr "Email accounts"
-
-msgid "IDS_EMAIL_BODY_END_TIME"
-msgstr "End time"
-
-msgid "IDS_EMAIL_BODY_ENTIRE_EMAIL"
-msgstr "Entire email"
-
-msgid "IDS_EMAIL_BODY_EXACTLY_THE_SAME_AS"
-msgstr "Exactly the same as"
-
-msgid "IDS_EMAIL_BODY_EXAMPLE"
-msgstr "Example"
-
-msgid "IDS_EMAIL_BODY_FROM_M_SENDER"
-msgstr "From:"
-
-msgid "IDS_EMAIL_BODY_INBOX"
-msgstr "Inbox"
-
-msgid "IDS_EMAIL_BODY_INCLUDE"
-msgstr "Include"
-
-msgid "IDS_EMAIL_BODY_MATCH_CRITERIA"
-msgstr "Match criteria"
-
-msgid "IDS_EMAIL_BODY_NOT_USED"
-msgstr "Not used"
-
-msgid "IDS_EMAIL_BODY_NO_ACCOUNTS"
-msgstr "No accounts"
-
-msgid "IDS_EMAIL_BODY_PD_DAYS"
-msgstr "%d days"
-
-msgid "IDS_EMAIL_BODY_PD_ITEMS"
-msgstr "%d items"
-
-msgid "IDS_EMAIL_BODY_PRIORITY"
-msgstr "Priority"
-
-msgid "IDS_EMAIL_BODY_RECEIVING_OPTIONS"
-msgstr "Receiving options"
-
-msgid "IDS_EMAIL_BODY_SECURE_CONNECTION"
-msgstr "Secure connection"
-
-msgid "IDS_EMAIL_BODY_SENDING_OPTIONS"
-msgstr "Sending options"
-
-msgid "IDS_EMAIL_BODY_SENTBOX"
-msgstr "Sentbox"
-
-msgid "IDS_EMAIL_BODY_SERVER_URL"
-msgstr "Server URL"
-
-msgid "IDS_EMAIL_BODY_SIGNATURE"
-msgstr "Signature"
-
-msgid "IDS_EMAIL_BODY_SPAMBOX"
-msgstr "Spambox"
-
-msgid "IDS_EMAIL_BODY_START_TIME"
-msgstr "Start time"
-
-msgid "IDS_EMAIL_BODY_SYNC_SCHEDULE_TMO"
-msgstr "Sync schedule"
-
-msgid "IDS_EMAIL_BODY_TRASH"
-msgstr "Recycle bin"
-
-msgid "IDS_EMAIL_BODY_WITHOUT_ATTACHMENTS"
-msgstr "Without attachments"
-
-msgid "IDS_EMAIL_BUTTON_GROUP"
-msgstr "Group"
-
-msgid "IDS_EMAIL_HEADER_ADD_RULES"
-msgstr "Add rules"
-
-msgid "IDS_EMAIL_OPT_ATTACH_ITEMS"
-msgstr "Attach items"
-
-msgid "IDS_EMAIL_OPT_EXCHANGE"
-msgstr "Exchange"
-
-msgid "IDS_EMAIL_OPT_FILE"
-msgstr "File"
-
-msgid "IDS_EMAIL_OPT_NAMECARD"
-msgstr "Namecard"
-
-msgid "IDS_EMAIL_OPT_OPEN_URL"
-msgstr "Open URL"
-
-msgid "IDS_EMAIL_OPT_SENDER"
-msgstr "Sender"
-
-msgid "IDS_EMAIL_OPT_SEND_EMAIL"
-msgstr "Send email"
-
-msgid "IDS_EMAIL_OPT_UPDATE_EXISTING"
-msgstr "Update existing"
-
-msgid "IDS_EMAIL_POP_ADD_ACCOUNTS"
-msgstr "Add accounts"
-
-msgid "IDS_EMAIL_POP_DOWNLOADING_ATTACHMENT_ING"
-msgstr "Downloading attachment..."
-
-msgid "IDS_EMAIL_POP_INVALID_EMAIL_ADDRESS"
-msgstr "Invalid email address"
-
-msgid "IDS_EMAIL_POP_LOADING_CONTENTS_ING"
-msgstr "Loading contents..."
-
-msgid "IDS_EMAIL_POP_MAXIMUM_NUMBER_OF_ATTACHMENTS_REACHED"
-msgstr "Maximum number of attachments reached"
-
-msgid "IDS_EMAIL_POP_MOVE_TO_SPAMBOX_Q"
-msgstr "Move to Spambox?"
-
-msgid "IDS_EMAIL_POP_NO_RECIPIENTS_ADDED_ENTER_RECIPIENTS"
-msgstr "No recipients added. Enter recipients"
-
-msgid "IDS_EMAIL_POP_PLEASE_FILL_ALL_THE_MANDATORY_FIELDS"
-msgstr "Please fill all the mandatory fields"
-
-msgid "IDS_EMAIL_POP_SAVE_IN_DRAFTS_Q"
-msgstr "Save in Drafts?"
-
-msgid "IDS_EMAIL_POP_THERE_IS_NO_ACCOUNT_CREATE_A_NEW_ACCOUNT_FIRST"
-msgstr "There is no account. Create a new account first"
-
-msgid "IDS_EMAIL_POP_TOO_MANY_RECIPIENTS"
-msgstr "Too many recipients"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_DOWNLOAD"
-msgstr "Unable to download"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ENTER_TEXT"
-msgstr "Unable to enter text"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_LAUNCH_APPLICATION"
-msgstr "Unable to launch application"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_OPEN_ATTACHMENT"
-msgstr "Unable to open attachment"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_SAVE_ATTACHMENT"
-msgstr "Unable to save attachment"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_SAVE_IN_DRAFTS"
-msgstr "Unable to save in Drafts"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_SEND_EMAIL"
-msgstr "Unable to send email"
-
-msgid "IDS_EMAIL_POP_UNSUPPORTED_FILE_TYPE"
-msgstr "Unsupported file type"
-
-msgid "IDS_EMAIL_POP_VALIDATING_ACCOUNT_ING"
-msgstr "Validating account..."
-
-msgid "IDS_EMAIL_SK_RESEND"
-msgstr "Resend"
-
-msgid "IDS_EMAIL_BODY_ACCEPT_ALL_SSL_CERTIFICATES"
-msgstr "Accept all SSL certificates"
-
-msgid "IDS_EMAIL_SK3_ACCOUNT_LIST"
-msgstr "Account list"
-
-msgid "IDS_EMAIL_BODY_USER_ID"
-msgstr "User ID"
-
-msgid "IDS_EMAIL_POP_ACCOUNT_ALREADY_REGISTERED"
-msgstr "Account already registered"
-
-msgid "IDS_EMAIL_HEADER_ATTACH_FILE"
-msgstr "Attach file"
-
-msgid "IDS_EMAIL_BODY_EXCHANGE_SYNC_SETTINGS_MSG"
-msgstr "By activating this application, you accept that some of your device data (the unique device identifier and model name) will be stored, processed, and used by Samsung to report the activation of this application to the licensors of the application software. Data held by Samsung will be dealt with strictly in accordance with Samsung's privacy policy which is available at www.samsung.com. Continue?"
-
-msgid "IDS_EMAIL_BODY_FORWARD_WITH_FILES"
-msgstr "Forward with files"
-
-msgid "IDS_EMAIL_BODY_REPLY_WITH_BODY"
-msgstr "Reply with body"
-
-msgid "IDS_EMAIL_BODY_NO_SUBJECT"
-msgstr "No subject"
-
-msgid "IDS_EMAIL_BODY_FROM"
-msgstr "From"
-
-msgid "IDS_EMAIL_BODY_NO_ADDRESS"
-msgstr "No address"
-
-msgid "IDS_EMAIL_OPT_RECORD_SOUND"
-msgstr "Record sound"
-
-msgid "IDS_EMAIL_OPT_RECORD_VIDEO"
-msgstr "Record video"
-
-msgid "IDS_EMAIL_OPT_INSERT_IMAGE"
-msgstr "Insert image"
-
-msgid "IDS_EMAIL_OPT_ADD_TO_CALENDAR"
-msgstr "Add to Calendar"
-
-msgid "IDS_EMAIL_OPT_CHANGE_EMAIL_ADDRESS_ABB"
-msgstr "Change email address"
-
-msgid "IDS_EMAIL_OPT_CLIPBOARD"
-msgstr "Clipboard"
-
-msgid "IDS_EMAIL_OPT_MARKED_AS_UNREAD"
-msgstr "Marked as unread"
-
-msgid "IDS_EMAIL_OPT_VIEW_CONTACT_DETAILS"
-msgstr "View contact details"
-
-msgid "IDS_EMAIL_POP_SAVED_IN_DRAFTS"
-msgstr "Saved in Drafts"
-
-msgid "IDS_EMAIL_POP_NETWORK_BUSY"
-msgstr "Network busy"
-
-msgid "IDS_EMAIL_POP_LOGIN_ALLOWED_ONLY_EVERY_PD_MINUTES"
-msgstr "Login allowed only every %d minutes"
-
-msgid "IDS_EMAIL_POP_HOST_NOT_FOUND"
-msgstr "Host not found"
-
-msgid "IDS_EMAIL_POP_HOST_NOT_REACHABLE"
-msgstr "Host not reachable"
-
-msgid "IDS_EMAIL_POP_NO_SERVICE"
-msgstr "No service"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_FORWARD_DRM_CONTENTS"
-msgstr "Unable to forward DRM contents"
-
-msgid "IDS_EMAIL_POP_BLOCKED"
-msgstr "Blocked"
-
-msgid "IDS_EMAIL_POP_1_EMAIL_SELECTED"
-msgstr "1 email selected"
-
-msgid "IDS_EMAIL_POP_PD_EMAILS_SELECTED"
-msgstr "%d emails selected"
-
-msgid "IDS_EMAIL_POP_1_RECIPIENT_SELECTED"
-msgstr "1 recipient selected"
-
-msgid "IDS_EMAIL_POP_PD_RECIPIENTS_SELECTED"
-msgstr "%d recipients selected"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ADD_ACCOUNT"
-msgstr "Unable to add account"
-
-msgid "IDS_EMAIL_SK3_MOVE_HERE"
-msgstr "Move here"
-
diff --git a/po/es_ES.po b/po/es_ES.po
deleted file mode 100755 (executable)
index 859e34b..0000000
+++ /dev/null
@@ -1,465 +0,0 @@
-msgid "IDS_EMAIL_POP_NO_EMAIL_ADDRESS"
-msgstr "Sin dirección de correo"
-
-msgid "IDS_EMAIL_BODY_COMPLETE"
-msgstr "Completo"
-
-msgid "IDS_EMAIL_BODY_ACCEPTED_C_PS"
-msgstr "Aceptado: %s"
-
-msgid "IDS_EMAIL_BODY_DECLINED_C_PS"
-msgstr "No aceptado: %s"
-
-msgid "IDS_EMAIL_BODY_DOWNLOAD_FULL_MESSAGE"
-msgstr "Descargar mensaje completo"
-
-msgid "IDS_EMAIL_BODY_GENERAL_SETTINGS"
-msgstr "Ajustes generales"
-
-msgid "IDS_EMAIL_BODY_TENTATIVE_C_PS"
-msgstr "Provisional: %s"
-
-msgid "IDS_EMAIL_BODY_WHEN_C_PS"
-msgstr "Cuándo: %s"
-
-msgid "IDS_EMAIL_BODY_WHERE_C_PS"
-msgstr "Dónde: %s"
-
-msgid "IDS_EMAIL_BUTTON_DECLINE_ABB"
-msgstr "Rechazar"
-
-msgid "IDS_EMAIL_BODY_NO_CONTENTS"
-msgstr "No hay contenido"
-
-msgid "IDS_EMAIL_BODY_ORIGINAL_MESSAGE"
-msgstr "Mensaje original"
-
-msgid "IDS_EMAIL_HEADER_ACCOUNT_SETTINGS"
-msgstr "Ajustes de cuenta"
-
-msgid "IDS_EMAIL_OPT_BLOCK"
-msgstr "Bloquear"
-
-msgid "IDS_EMAIL_OPT_MARK_AS_READ"
-msgstr "Marcar como leído"
-
-msgid "IDS_EMAIL_OPT_MARK_AS_UNREAD"
-msgstr "Marcar como no leído"
-
-msgid "IDS_EMAIL_OPT_OTHERS"
-msgstr "Otros"
-
-msgid "IDS_EMAIL_OPT_UNREAD"
-msgstr "No leídos"
-
-msgid "IDS_EMAIL_SK_COMPOSE"
-msgstr "Crear"
-
-msgid "IDS_EMAIL_HEADER_DOWNLOAD_FAILED"
-msgstr "Descarga no disponible"
-
-msgid "IDS_EMAIL_OPT_ADD_TO_CONTACT"
-msgstr "Añadir a contacto"
-
-msgid "IDS_EMAIL_OPT_VOICE_CALL"
-msgstr "Llamada de voz"
-
-msgid "IDS_EMAIL_BODY_ACCOUNT_NAME"
-msgstr "Nombre de cuenta"
-
-msgid "IDS_EMAIL_BODY_ATTACHMENTS"
-msgstr "Archivos adjuntos"
-
-msgid "IDS_EMAIL_BODY_FROM_C"
-msgstr "De:"
-
-msgid "IDS_EMAIL_BODY_IMAP4_SERVER"
-msgstr "Servidor IMAP4"
-
-msgid "IDS_EMAIL_BODY_INCLUDES"
-msgstr "Incluye"
-
-msgid "IDS_EMAIL_BODY_INCOMING_PORT"
-msgstr "Puerto entrante"
-
-msgid "IDS_EMAIL_BODY_INCOMING_SERVER"
-msgstr "Servidor entrante"
-
-msgid "IDS_EMAIL_BODY_IN_PD_MINUTES"
-msgstr "Dentro de %d minutos"
-
-msgid "IDS_EMAIL_BODY_KEEP_IN_SERVER"
-msgstr "Mantener en el servidor"
-
-msgid "IDS_EMAIL_BODY_NO_TEXT"
-msgstr "Sin texto"
-
-msgid "IDS_EMAIL_BODY_OUTGOING_PORT"
-msgstr "Puerto saliente"
-
-msgid "IDS_EMAIL_BODY_OUTGOING_SERVER"
-msgstr "Servidor saliente"
-
-msgid "IDS_EMAIL_BODY_PD_EMAILS"
-msgstr "%d correos electrónicos"
-
-msgid "IDS_EMAIL_BODY_POP3_SERVER"
-msgstr "Servidor POP3"
-
-msgid "IDS_EMAIL_BODY_RECENT"
-msgstr "Reciente"
-
-msgid "IDS_EMAIL_BODY_RETRIEVING_OPTIONS"
-msgstr "Ajustes de recepción"
-
-msgid "IDS_EMAIL_BODY_RE_C"
-msgstr "RE:"
-
-msgid "IDS_EMAIL_BODY_SENT_C"
-msgstr "Enviado:"
-
-msgid "IDS_EMAIL_BODY_SENT_FROM_SAMSUNG_MOBILE"
-msgstr "Enviado de Samsung Mobile"
-
-msgid "IDS_EMAIL_BODY_USER_PASSWORD"
-msgstr "Contraseña de usuario"
-
-msgid "IDS_EMAIL_HEADER_EDIT_RULES"
-msgstr "Editar reglas"
-
-msgid "IDS_EMAIL_HEADER_EMAIL_SETTINGS"
-msgstr "Ajustes de email"
-
-msgid "IDS_EMAIL_HEADER_MAILBOXES"
-msgstr "Buzones de correo"
-
-msgid "IDS_EMAIL_POP_ALERT"
-msgstr "Alerta"
-
-msgid "IDS_EMAIL_POP_FILE_ALREADY_EXISTS"
-msgstr "El archivo ya existe"
-
-msgid "IDS_EMAIL_POP_NO_SENDER"
-msgstr "Ningún remitente"
-
-msgid "IDS_EMAIL_POP_SUCCEEDED"
-msgstr "Realizado con éxito"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ATTACH_MAXIMUM_NUMBER_OF_FILES_IS_PD"
-msgstr "No se puede adjuntar. El número máximo de archivos es de %d"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ATTACH_MAXIMUM_SIZE_OF_FILES_IS_PD_KB"
-msgstr "No se puede adjuntar. El tamaño máximo de archivos es de %d KB"
-
-msgid "IDS_EMAIL_POP_VALIDATION_FAILED"
-msgstr "Error de validación"
-
-msgid "IDS_EMAIL_SK_REPLY_ALL"
-msgstr "Responder  todos"
-
-msgid "IDS_EMAIL_BODY_1_ITEM"
-msgstr "1 elemento"
-
-msgid "IDS_EMAIL_BODY_ADD_MY_NAMECARD"
-msgstr "Añadir mi tarjeta de contacto"
-
-msgid "IDS_EMAIL_BODY_ADD_SIGNATURE"
-msgstr "Añadir firma"
-
-msgid "IDS_EMAIL_BODY_ALL_EMAILS"
-msgstr "Todos los correos"
-
-msgid "IDS_EMAIL_BODY_ALWAYS_BCC_MYSELF"
-msgstr "Copiarme siempre en copia oculta"
-
-msgid "IDS_EMAIL_BODY_BCC"
-msgstr "Cco"
-
-msgid "IDS_EMAIL_BODY_BLOCK_EMAILS"
-msgstr "Bloquear mensajes de correo electrónico"
-
-msgid "IDS_EMAIL_BODY_BODY"
-msgstr "Cuerpo"
-
-msgid "IDS_EMAIL_BODY_CC"
-msgstr "Cc"
-
-msgid "IDS_EMAIL_BODY_CC_BCC"
-msgstr "CC/CCO"
-
-msgid "IDS_EMAIL_BODY_CHECK_INTERVAL"
-msgstr "Comprobar intervalo"
-
-msgid "IDS_EMAIL_BODY_DEFAULT_ACCOUNT"
-msgstr "Cuenta predetermin"
-
-msgid "IDS_EMAIL_BODY_DRAFTS"
-msgstr "Borradores"
-
-msgid "IDS_EMAIL_BODY_EMAIL_ACCOUNTS"
-msgstr "Cuentas de correo electrónico"
-
-msgid "IDS_EMAIL_BODY_END_TIME"
-msgstr "Hora de finalización"
-
-msgid "IDS_EMAIL_BODY_ENTIRE_EMAIL"
-msgstr "Correo electrónico completo"
-
-msgid "IDS_EMAIL_BODY_EXACTLY_THE_SAME_AS"
-msgstr "Exactamente igual a"
-
-msgid "IDS_EMAIL_BODY_EXAMPLE"
-msgstr "Ejemplo"
-
-msgid "IDS_EMAIL_BODY_FROM_M_SENDER"
-msgstr "De:"
-
-msgid "IDS_EMAIL_BODY_INBOX"
-msgstr "Entrada"
-
-msgid "IDS_EMAIL_BODY_INCLUDE"
-msgstr "Incluir"
-
-msgid "IDS_EMAIL_BODY_MATCH_CRITERIA"
-msgstr "Coincidir criterios"
-
-msgid "IDS_EMAIL_BODY_NOT_USED"
-msgstr "No usado"
-
-msgid "IDS_EMAIL_BODY_NO_ACCOUNTS"
-msgstr "Ninguna cuenta"
-
-msgid "IDS_EMAIL_BODY_PD_DAYS"
-msgstr "%d días"
-
-msgid "IDS_EMAIL_BODY_PD_ITEMS"
-msgstr "%d elementos"
-
-msgid "IDS_EMAIL_BODY_PRIORITY"
-msgstr "Prioridad"
-
-msgid "IDS_EMAIL_BODY_RECEIVING_OPTIONS"
-msgstr "Opciones de recepción"
-
-msgid "IDS_EMAIL_BODY_SECURE_CONNECTION"
-msgstr "Conexión segura"
-
-msgid "IDS_EMAIL_BODY_SENDING_OPTIONS"
-msgstr "Opciones de envío"
-
-msgid "IDS_EMAIL_BODY_SENTBOX"
-msgstr "Enviados"
-
-msgid "IDS_EMAIL_BODY_SERVER_URL"
-msgstr "URL del servidor"
-
-msgid "IDS_EMAIL_BODY_SIGNATURE"
-msgstr "Firma"
-
-msgid "IDS_EMAIL_BODY_SPAMBOX"
-msgstr "Correo no deseado"
-
-msgid "IDS_EMAIL_BODY_START_TIME"
-msgstr "Hora de inicio"
-
-msgid "IDS_EMAIL_BODY_SYNC_SCHEDULE_TMO"
-msgstr "Sincronizar planificación"
-
-msgid "IDS_EMAIL_BODY_TRASH"
-msgstr "Papelera"
-
-msgid "IDS_EMAIL_BODY_WITHOUT_ATTACHMENTS"
-msgstr "Sin archivos adjuntos"
-
-msgid "IDS_EMAIL_BUTTON_GROUP"
-msgstr "Grupo"
-
-msgid "IDS_EMAIL_HEADER_ADD_RULES"
-msgstr "Añadir reglas"
-
-msgid "IDS_EMAIL_OPT_ATTACH_ITEMS"
-msgstr "Adjuntar elementos"
-
-msgid "IDS_EMAIL_OPT_EXCHANGE"
-msgstr "Exchange"
-
-msgid "IDS_EMAIL_OPT_FILE"
-msgstr "Archivo"
-
-msgid "IDS_EMAIL_OPT_NAMECARD"
-msgstr "Tarjeta de contacto"
-
-msgid "IDS_EMAIL_OPT_OPEN_URL"
-msgstr "Abrir URL"
-
-msgid "IDS_EMAIL_OPT_SENDER"
-msgstr "Remitente"
-
-msgid "IDS_EMAIL_OPT_SEND_EMAIL"
-msgstr "Enviar correo electrónico"
-
-msgid "IDS_EMAIL_OPT_UPDATE_EXISTING"
-msgstr "Actualizar existente"
-
-msgid "IDS_EMAIL_POP_ADD_ACCOUNTS"
-msgstr "Añadir cuentas"
-
-msgid "IDS_EMAIL_POP_DOWNLOADING_ATTACHMENT_ING"
-msgstr "Descargando adjunto..."
-
-msgid "IDS_EMAIL_POP_INVALID_EMAIL_ADDRESS"
-msgstr "Dirección de correo electrónico no válida"
-
-msgid "IDS_EMAIL_POP_LOADING_CONTENTS_ING"
-msgstr "Cargando contenidos..."
-
-msgid "IDS_EMAIL_POP_MAXIMUM_NUMBER_OF_ATTACHMENTS_REACHED"
-msgstr "Alcanzado el número máximo de adjuntos"
-
-msgid "IDS_EMAIL_POP_MOVE_TO_SPAMBOX_Q"
-msgstr "¿Mover a bandeja de correo no deseado?"
-
-msgid "IDS_EMAIL_POP_NO_RECIPIENTS_ADDED_ENTER_RECIPIENTS"
-msgstr "No se han añadido destinatarios. Introduzca destinatarios"
-
-msgid "IDS_EMAIL_POP_PLEASE_FILL_ALL_THE_MANDATORY_FIELDS"
-msgstr "Rellene todos los campos obligatorios"
-
-msgid "IDS_EMAIL_POP_SAVE_IN_DRAFTS_Q"
-msgstr "¿Guardar en Borradores?"
-
-msgid "IDS_EMAIL_POP_THERE_IS_NO_ACCOUNT_CREATE_A_NEW_ACCOUNT_FIRST"
-msgstr "No hay ninguna cuenta. Cree una cuenta nueva primero"
-
-msgid "IDS_EMAIL_POP_TOO_MANY_RECIPIENTS"
-msgstr "Demasiados destinatarios"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_DOWNLOAD"
-msgstr "No se puede descargar"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ENTER_TEXT"
-msgstr "No se puede escribir texto"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_LAUNCH_APPLICATION"
-msgstr "No se puede iniciar aplicación"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_OPEN_ATTACHMENT"
-msgstr "No se puede abrir adjunto"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_SAVE_ATTACHMENT"
-msgstr "No se puede guardar adjunto"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_SAVE_IN_DRAFTS"
-msgstr "No se puede guardar en Borradores"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_SEND_EMAIL"
-msgstr "No se puede enviar el correo electrónico"
-
-msgid "IDS_EMAIL_POP_UNSUPPORTED_FILE_TYPE"
-msgstr "Tipo de archivo no admitido"
-
-msgid "IDS_EMAIL_POP_VALIDATING_ACCOUNT_ING"
-msgstr "Validando cuenta..."
-
-msgid "IDS_EMAIL_SK_RESEND"
-msgstr "Reenviar"
-
-msgid "IDS_EMAIL_BODY_ACCEPT_ALL_SSL_CERTIFICATES"
-msgstr "Aceptar todos los certificados de SSL"
-
-msgid "IDS_EMAIL_SK3_ACCOUNT_LIST"
-msgstr "Lista de cuentas"
-
-msgid "IDS_EMAIL_BODY_USER_ID"
-msgstr "ID de usuario"
-
-msgid "IDS_EMAIL_POP_ACCOUNT_ALREADY_REGISTERED"
-msgstr "Cuenta ya registrada"
-
-msgid "IDS_EMAIL_HEADER_ATTACH_FILE"
-msgstr "Adjuntar archivo"
-
-msgid "IDS_EMAIL_BODY_EXCHANGE_SYNC_SETTINGS_MSG"
-msgstr "Al activar esta aplicación acepta el almacenamiento, procesamiento y uso de algunos de datos de su dispositivo (identificador único de dispositivo y nombre del modelo) por parte de Samsung, para informar de la activación de esta aplicación a los cedentes de licencia del propio software. Los datos que Samsung posea serán tratados estrictamente conforme a la directiva de privacidad de Samsung, que está disponible en www.samsung.com. ¿Continuar?"
-
-msgid "IDS_EMAIL_BODY_FORWARD_WITH_FILES"
-msgstr "Reenviar con archivos"
-
-msgid "IDS_EMAIL_BODY_REPLY_WITH_BODY"
-msgstr "Responder con cuerpo"
-
-msgid "IDS_EMAIL_BODY_NO_SUBJECT"
-msgstr "Sin asunto"
-
-msgid "IDS_EMAIL_BODY_FROM"
-msgstr "De"
-
-msgid "IDS_EMAIL_BODY_NO_ADDRESS"
-msgstr "Sin dirección"
-
-msgid "IDS_EMAIL_OPT_RECORD_SOUND"
-msgstr "Grabar sonido"
-
-msgid "IDS_EMAIL_OPT_RECORD_VIDEO"
-msgstr "Grabar vídeo"
-
-msgid "IDS_EMAIL_OPT_INSERT_IMAGE"
-msgstr "Insertar imagen"
-
-msgid "IDS_EMAIL_OPT_ADD_TO_CALENDAR"
-msgstr "Añadir a calendario"
-
-msgid "IDS_EMAIL_OPT_CHANGE_EMAIL_ADDRESS_ABB"
-msgstr "Cambiar dirección de correo electrónico"
-
-msgid "IDS_EMAIL_OPT_CLIPBOARD"
-msgstr "Portapapeles"
-
-msgid "IDS_EMAIL_OPT_MARKED_AS_UNREAD"
-msgstr "Marcado como no leído"
-
-msgid "IDS_EMAIL_OPT_VIEW_CONTACT_DETAILS"
-msgstr "Ver detalles de contacto"
-
-msgid "IDS_EMAIL_POP_SAVED_IN_DRAFTS"
-msgstr "Guardado en Borradores"
-
-msgid "IDS_EMAIL_POP_NETWORK_BUSY"
-msgstr "Red ocupada"
-
-msgid "IDS_EMAIL_POP_LOGIN_ALLOWED_ONLY_EVERY_PD_MINUTES"
-msgstr "Login allowed only every %d minutes"
-
-msgid "IDS_EMAIL_POP_HOST_NOT_FOUND"
-msgstr "Host no encontrado"
-
-msgid "IDS_EMAIL_POP_HOST_NOT_REACHABLE"
-msgstr "Host no localizable"
-
-msgid "IDS_EMAIL_POP_NO_SERVICE"
-msgstr "Sin servicio"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_FORWARD_DRM_CONTENTS"
-msgstr "No se pueden reenviar contenidos de DRM"
-
-msgid "IDS_EMAIL_POP_BLOCKED"
-msgstr "Bloqueado"
-
-msgid "IDS_EMAIL_POP_1_EMAIL_SELECTED"
-msgstr "1 correo electrónico seleccionado"
-
-msgid "IDS_EMAIL_POP_PD_EMAILS_SELECTED"
-msgstr "%d correos electrónicos seleccionados"
-
-msgid "IDS_EMAIL_POP_1_RECIPIENT_SELECTED"
-msgstr "1 destinatario seleccionado"
-
-msgid "IDS_EMAIL_POP_PD_RECIPIENTS_SELECTED"
-msgstr "%d destinatarios seleccionados"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ADD_ACCOUNT"
-msgstr "No se puede añadir cuenta"
-
-msgid "IDS_EMAIL_SK3_MOVE_HERE"
-msgstr "Mover aquí"
-
diff --git a/po/fr_FR.po b/po/fr_FR.po
deleted file mode 100755 (executable)
index 3820c65..0000000
+++ /dev/null
@@ -1,465 +0,0 @@
-msgid "IDS_EMAIL_POP_NO_EMAIL_ADDRESS"
-msgstr "Aucune adresse e-mail"
-
-msgid "IDS_EMAIL_BODY_COMPLETE"
-msgstr "OK"
-
-msgid "IDS_EMAIL_BODY_ACCEPTED_C_PS"
-msgstr "Accepté : %s"
-
-msgid "IDS_EMAIL_BODY_DECLINED_C_PS"
-msgstr "Refusé : %s"
-
-msgid "IDS_EMAIL_BODY_DOWNLOAD_FULL_MESSAGE"
-msgstr "Télécharger l'intégralité du message"
-
-msgid "IDS_EMAIL_BODY_GENERAL_SETTINGS"
-msgstr "Paramètres généraux"
-
-msgid "IDS_EMAIL_BODY_TENTATIVE_C_PS"
-msgstr "Tentative : %s"
-
-msgid "IDS_EMAIL_BODY_WHEN_C_PS"
-msgstr "Date : %s"
-
-msgid "IDS_EMAIL_BODY_WHERE_C_PS"
-msgstr "Emplacement : %s"
-
-msgid "IDS_EMAIL_BUTTON_DECLINE_ABB"
-msgstr "Refuser"
-
-msgid "IDS_EMAIL_BODY_NO_CONTENTS"
-msgstr "Aucun fichier"
-
-msgid "IDS_EMAIL_BODY_ORIGINAL_MESSAGE"
-msgstr "Message d'origine"
-
-msgid "IDS_EMAIL_HEADER_ACCOUNT_SETTINGS"
-msgstr "Paramètres du compte"
-
-msgid "IDS_EMAIL_OPT_BLOCK"
-msgstr "Bloquer"
-
-msgid "IDS_EMAIL_OPT_MARK_AS_READ"
-msgstr "Marqué comme lu"
-
-msgid "IDS_EMAIL_OPT_MARK_AS_UNREAD"
-msgstr "Marquer comme Non lu"
-
-msgid "IDS_EMAIL_OPT_OTHERS"
-msgstr "Autres"
-
-msgid "IDS_EMAIL_OPT_UNREAD"
-msgstr "Non lu"
-
-msgid "IDS_EMAIL_SK_COMPOSE"
-msgstr "Rédiger"
-
-msgid "IDS_EMAIL_HEADER_DOWNLOAD_FAILED"
-msgstr "Téléchargement impossible"
-
-msgid "IDS_EMAIL_OPT_ADD_TO_CONTACT"
-msgstr "Ajouter aux contacts"
-
-msgid "IDS_EMAIL_OPT_VOICE_CALL"
-msgstr "Appel vocal"
-
-msgid "IDS_EMAIL_BODY_ACCOUNT_NAME"
-msgstr "Nom du compte"
-
-msgid "IDS_EMAIL_BODY_ATTACHMENTS"
-msgstr "pièce(s) jointe(s)"
-
-msgid "IDS_EMAIL_BODY_FROM_C"
-msgstr "De :"
-
-msgid "IDS_EMAIL_BODY_IMAP4_SERVER"
-msgstr "Serveur IMAP4"
-
-msgid "IDS_EMAIL_BODY_INCLUDES"
-msgstr "Inclut"
-
-msgid "IDS_EMAIL_BODY_INCOMING_PORT"
-msgstr "Port entrant"
-
-msgid "IDS_EMAIL_BODY_INCOMING_SERVER"
-msgstr "Serveur entrant"
-
-msgid "IDS_EMAIL_BODY_IN_PD_MINUTES"
-msgstr "Dans %d minutes"
-
-msgid "IDS_EMAIL_BODY_KEEP_IN_SERVER"
-msgstr "Garder sur le serveur"
-
-msgid "IDS_EMAIL_BODY_NO_TEXT"
-msgstr "Aucun texte"
-
-msgid "IDS_EMAIL_BODY_OUTGOING_PORT"
-msgstr "Port sortant"
-
-msgid "IDS_EMAIL_BODY_OUTGOING_SERVER"
-msgstr "Serveur sortant"
-
-msgid "IDS_EMAIL_BODY_PD_EMAILS"
-msgstr "%d e-mails"
-
-msgid "IDS_EMAIL_BODY_POP3_SERVER"
-msgstr "Serveur POP3"
-
-msgid "IDS_EMAIL_BODY_RECENT"
-msgstr "Récent"
-
-msgid "IDS_EMAIL_BODY_RETRIEVING_OPTIONS"
-msgstr "Paramètres de récupération"
-
-msgid "IDS_EMAIL_BODY_RE_C"
-msgstr "RE :"
-
-msgid "IDS_EMAIL_BODY_SENT_C"
-msgstr "Envoyé :"
-
-msgid "IDS_EMAIL_BODY_SENT_FROM_SAMSUNG_MOBILE"
-msgstr "Envoyé depuis un mobile Samsung"
-
-msgid "IDS_EMAIL_BODY_USER_PASSWORD"
-msgstr "Mot de passe utilisateur"
-
-msgid "IDS_EMAIL_HEADER_EDIT_RULES"
-msgstr "Modifier les règles"
-
-msgid "IDS_EMAIL_HEADER_EMAIL_SETTINGS"
-msgstr "Paramètres e-mail"
-
-msgid "IDS_EMAIL_HEADER_MAILBOXES"
-msgstr "Messageries"
-
-msgid "IDS_EMAIL_POP_ALERT"
-msgstr "Alerte"
-
-msgid "IDS_EMAIL_POP_FILE_ALREADY_EXISTS"
-msgstr "Le fichier existe déjà"
-
-msgid "IDS_EMAIL_POP_NO_SENDER"
-msgstr "Aucun expéditeur"
-
-msgid "IDS_EMAIL_POP_SUCCEEDED"
-msgstr "Opérations terminées"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ATTACH_MAXIMUM_NUMBER_OF_FILES_IS_PD"
-msgstr "Impossible d'ajouter la pièce jointe. Le nombre maximum de fichiers est %d"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ATTACH_MAXIMUM_SIZE_OF_FILES_IS_PD_KB"
-msgstr "Impossible d'ajouter la pièce jointe. La taille maximale des fichiers est de %d Ko"
-
-msgid "IDS_EMAIL_POP_VALIDATION_FAILED"
-msgstr "Echec de la validation"
-
-msgid "IDS_EMAIL_SK_REPLY_ALL"
-msgstr "Répondre à tous"
-
-msgid "IDS_EMAIL_BODY_1_ITEM"
-msgstr "1 élément"
-
-msgid "IDS_EMAIL_BODY_ADD_MY_NAMECARD"
-msgstr "Ajouter ma carte de visite"
-
-msgid "IDS_EMAIL_BODY_ADD_SIGNATURE"
-msgstr "Ajouter une signature"
-
-msgid "IDS_EMAIL_BODY_ALL_EMAILS"
-msgstr "Tous les e-mails"
-
-msgid "IDS_EMAIL_BODY_ALWAYS_BCC_MYSELF"
-msgstr "Toujours me mettre en copie"
-
-msgid "IDS_EMAIL_BODY_BCC"
-msgstr "Cci"
-
-msgid "IDS_EMAIL_BODY_BLOCK_EMAILS"
-msgstr "Bloquer les e-mails"
-
-msgid "IDS_EMAIL_BODY_BODY"
-msgstr "Corps"
-
-msgid "IDS_EMAIL_BODY_CC"
-msgstr "Cc"
-
-msgid "IDS_EMAIL_BODY_CC_BCC"
-msgstr "Cc/Cci"
-
-msgid "IDS_EMAIL_BODY_CHECK_INTERVAL"
-msgstr "Fréquence de vérification"
-
-msgid "IDS_EMAIL_BODY_DEFAULT_ACCOUNT"
-msgstr "Compte par défaut"
-
-msgid "IDS_EMAIL_BODY_DRAFTS"
-msgstr "Brouillons"
-
-msgid "IDS_EMAIL_BODY_EMAIL_ACCOUNTS"
-msgstr "Comptes e-mail"
-
-msgid "IDS_EMAIL_BODY_END_TIME"
-msgstr "Heure de fin"
-
-msgid "IDS_EMAIL_BODY_ENTIRE_EMAIL"
-msgstr "E-mail entier"
-
-msgid "IDS_EMAIL_BODY_EXACTLY_THE_SAME_AS"
-msgstr "Identique à"
-
-msgid "IDS_EMAIL_BODY_EXAMPLE"
-msgstr "Exemple"
-
-msgid "IDS_EMAIL_BODY_FROM_M_SENDER"
-msgstr "De :"
-
-msgid "IDS_EMAIL_BODY_INBOX"
-msgstr "Boîte de réception"
-
-msgid "IDS_EMAIL_BODY_INCLUDE"
-msgstr "Inclure"
-
-msgid "IDS_EMAIL_BODY_MATCH_CRITERIA"
-msgstr "Critères correspondants"
-
-msgid "IDS_EMAIL_BODY_NOT_USED"
-msgstr "Non utilisé"
-
-msgid "IDS_EMAIL_BODY_NO_ACCOUNTS"
-msgstr "Aucun compte"
-
-msgid "IDS_EMAIL_BODY_PD_DAYS"
-msgstr "%d jours"
-
-msgid "IDS_EMAIL_BODY_PD_ITEMS"
-msgstr "%d éléments"
-
-msgid "IDS_EMAIL_BODY_PRIORITY"
-msgstr "Priorité"
-
-msgid "IDS_EMAIL_BODY_RECEIVING_OPTIONS"
-msgstr "Options de réception"
-
-msgid "IDS_EMAIL_BODY_SECURE_CONNECTION"
-msgstr "Connexion sécurisée"
-
-msgid "IDS_EMAIL_BODY_SENDING_OPTIONS"
-msgstr "Options d'envoi"
-
-msgid "IDS_EMAIL_BODY_SENTBOX"
-msgstr "Messages envoyés"
-
-msgid "IDS_EMAIL_BODY_SERVER_URL"
-msgstr "URL serveur"
-
-msgid "IDS_EMAIL_BODY_SIGNATURE"
-msgstr "Signature"
-
-msgid "IDS_EMAIL_BODY_SPAMBOX"
-msgstr "Boîte des spams"
-
-msgid "IDS_EMAIL_BODY_START_TIME"
-msgstr "Heure de début"
-
-msgid "IDS_EMAIL_BODY_SYNC_SCHEDULE_TMO"
-msgstr "Paramètres de synchronisation"
-
-msgid "IDS_EMAIL_BODY_TRASH"
-msgstr "Corbeille"
-
-msgid "IDS_EMAIL_BODY_WITHOUT_ATTACHMENTS"
-msgstr "Sans pièce jointe"
-
-msgid "IDS_EMAIL_BUTTON_GROUP"
-msgstr "Groupe"
-
-msgid "IDS_EMAIL_HEADER_ADD_RULES"
-msgstr "Ajouter des règles"
-
-msgid "IDS_EMAIL_OPT_ATTACH_ITEMS"
-msgstr "Pièces jointes"
-
-msgid "IDS_EMAIL_OPT_EXCHANGE"
-msgstr "Exchange"
-
-msgid "IDS_EMAIL_OPT_FILE"
-msgstr "Fichier"
-
-msgid "IDS_EMAIL_OPT_NAMECARD"
-msgstr "Carte de visite"
-
-msgid "IDS_EMAIL_OPT_OPEN_URL"
-msgstr "Ouvrir la page internet"
-
-msgid "IDS_EMAIL_OPT_SENDER"
-msgstr "Expéditeur"
-
-msgid "IDS_EMAIL_OPT_SEND_EMAIL"
-msgstr "Envoyer un e-mail"
-
-msgid "IDS_EMAIL_OPT_UPDATE_EXISTING"
-msgstr "Mettre à jour les contacts existants"
-
-msgid "IDS_EMAIL_POP_ADD_ACCOUNTS"
-msgstr "Ajouter des comptes"
-
-msgid "IDS_EMAIL_POP_DOWNLOADING_ATTACHMENT_ING"
-msgstr "Téléchargement de la pièce jointe..."
-
-msgid "IDS_EMAIL_POP_INVALID_EMAIL_ADDRESS"
-msgstr "E-mail incorrect"
-
-msgid "IDS_EMAIL_POP_LOADING_CONTENTS_ING"
-msgstr " Chargement du contenu..."
-
-msgid "IDS_EMAIL_POP_MAXIMUM_NUMBER_OF_ATTACHMENTS_REACHED"
-msgstr "Nombre maximum de pièces jointes atteint"
-
-msgid "IDS_EMAIL_POP_MOVE_TO_SPAMBOX_Q"
-msgstr "Déplacer vers la boîte des spams ?"
-
-msgid "IDS_EMAIL_POP_NO_RECIPIENTS_ADDED_ENTER_RECIPIENTS"
-msgstr "Aucun destinataire ajouté. Sélectionnez"
-
-msgid "IDS_EMAIL_POP_PLEASE_FILL_ALL_THE_MANDATORY_FIELDS"
-msgstr "Complétez les champs obligatoires"
-
-msgid "IDS_EMAIL_POP_SAVE_IN_DRAFTS_Q"
-msgstr "Enregistrer dans Brouillons ?"
-
-msgid "IDS_EMAIL_POP_THERE_IS_NO_ACCOUNT_CREATE_A_NEW_ACCOUNT_FIRST"
-msgstr "Aucun compte existant. Créez d'abord un compte"
-
-msgid "IDS_EMAIL_POP_TOO_MANY_RECIPIENTS"
-msgstr "Trop de destinataires"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_DOWNLOAD"
-msgstr "Téléchargement impossible"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ENTER_TEXT"
-msgstr "Impossible de saisir du texte"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_LAUNCH_APPLICATION"
-msgstr "Impossible de lancer l'application"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_OPEN_ATTACHMENT"
-msgstr "Impossible d'ouvrir la pièce jointe"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_SAVE_ATTACHMENT"
-msgstr "Impossible d'enregistrer la pièce jointe"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_SAVE_IN_DRAFTS"
-msgstr "Impossible d'enregistrer dans Brouillons"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_SEND_EMAIL"
-msgstr "Impossible d'envoyer l'e-mail"
-
-msgid "IDS_EMAIL_POP_UNSUPPORTED_FILE_TYPE"
-msgstr "Type de fichier non pris en charge"
-
-msgid "IDS_EMAIL_POP_VALIDATING_ACCOUNT_ING"
-msgstr "Validation du compte..."
-
-msgid "IDS_EMAIL_SK_RESEND"
-msgstr "Renvoyer"
-
-msgid "IDS_EMAIL_BODY_ACCEPT_ALL_SSL_CERTIFICATES"
-msgstr "Accepter tous les certificats SSL"
-
-msgid "IDS_EMAIL_SK3_ACCOUNT_LIST"
-msgstr "Liste comptes"
-
-msgid "IDS_EMAIL_BODY_USER_ID"
-msgstr "ID utilisateur"
-
-msgid "IDS_EMAIL_POP_ACCOUNT_ALREADY_REGISTERED"
-msgstr "Compte déjà enregistré"
-
-msgid "IDS_EMAIL_HEADER_ATTACH_FILE"
-msgstr "Joindre le fichier"
-
-msgid "IDS_EMAIL_BODY_EXCHANGE_SYNC_SETTINGS_MSG"
-msgstr "En activant cette application, vous acceptez que certaines données stockées sur votre périphérique (ID périphérique unique et nom de modèle) soient enregistrées, traitées et utilisées par Samsung afin de signaler l'activation de l'application aux concédants de licences du logiciel. Les données détenues par Samsung seront diffusées conformément à la politique de confidentialité de Samsung qui est disponible sur www.samsung.com. Continuer ?"
-
-msgid "IDS_EMAIL_BODY_FORWARD_WITH_FILES"
-msgstr "Transférer fichiers"
-
-msgid "IDS_EMAIL_BODY_REPLY_WITH_BODY"
-msgstr "Répondre avec le corps"
-
-msgid "IDS_EMAIL_BODY_NO_SUBJECT"
-msgstr "Aucun objet"
-
-msgid "IDS_EMAIL_BODY_FROM"
-msgstr "De"
-
-msgid "IDS_EMAIL_BODY_NO_ADDRESS"
-msgstr "Aucune adresse"
-
-msgid "IDS_EMAIL_OPT_RECORD_SOUND"
-msgstr "Enregistrer un mémo"
-
-msgid "IDS_EMAIL_OPT_RECORD_VIDEO"
-msgstr "Enregistrer une vidéo"
-
-msgid "IDS_EMAIL_OPT_INSERT_IMAGE"
-msgstr "Insérer une image"
-
-msgid "IDS_EMAIL_OPT_ADD_TO_CALENDAR"
-msgstr "Ajouter au calendrier"
-
-msgid "IDS_EMAIL_OPT_CHANGE_EMAIL_ADDRESS_ABB"
-msgstr "Changer l'adresse e-mail"
-
-msgid "IDS_EMAIL_OPT_CLIPBOARD"
-msgstr "Presse-papiers"
-
-msgid "IDS_EMAIL_OPT_MARKED_AS_UNREAD"
-msgstr "Marqué comme non lu"
-
-msgid "IDS_EMAIL_OPT_VIEW_CONTACT_DETAILS"
-msgstr "Afficher détails du contact"
-
-msgid "IDS_EMAIL_POP_SAVED_IN_DRAFTS"
-msgstr "Enregistré dans Brouillons"
-
-msgid "IDS_EMAIL_POP_NETWORK_BUSY"
-msgstr "Réseau occupé"
-
-msgid "IDS_EMAIL_POP_LOGIN_ALLOWED_ONLY_EVERY_PD_MINUTES"
-msgstr "Connexion autorisée toutes les %d minutes uniquement"
-
-msgid "IDS_EMAIL_POP_HOST_NOT_FOUND"
-msgstr "Hôte introuvable"
-
-msgid "IDS_EMAIL_POP_HOST_NOT_REACHABLE"
-msgstr "Hôte non disponible"
-
-msgid "IDS_EMAIL_POP_NO_SERVICE"
-msgstr "Aucun service"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_FORWARD_DRM_CONTENTS"
-msgstr "Impossible de transférer les contenus DRM"
-
-msgid "IDS_EMAIL_POP_BLOCKED"
-msgstr "Bloqué"
-
-msgid "IDS_EMAIL_POP_1_EMAIL_SELECTED"
-msgstr "1 e-mail sélectionné"
-
-msgid "IDS_EMAIL_POP_PD_EMAILS_SELECTED"
-msgstr "%d e-mails sélectionnés"
-
-msgid "IDS_EMAIL_POP_1_RECIPIENT_SELECTED"
-msgstr "1 destinataire sélectionné"
-
-msgid "IDS_EMAIL_POP_PD_RECIPIENTS_SELECTED"
-msgstr "%d destinataires sélectionnés"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ADD_ACCOUNT"
-msgstr "Impossible d'ajouter le compte"
-
-msgid "IDS_EMAIL_SK3_MOVE_HERE"
-msgstr "Déplacer ici"
-
diff --git a/po/it_IT.po b/po/it_IT.po
deleted file mode 100755 (executable)
index a9f69c6..0000000
+++ /dev/null
@@ -1,465 +0,0 @@
-msgid "IDS_EMAIL_POP_NO_EMAIL_ADDRESS"
-msgstr "Nessun indirizzo e-mail"
-
-msgid "IDS_EMAIL_BODY_COMPLETE"
-msgstr "Completo"
-
-msgid "IDS_EMAIL_BODY_ACCEPTED_C_PS"
-msgstr "Accettato: %s"
-
-msgid "IDS_EMAIL_BODY_DECLINED_C_PS"
-msgstr "Rifiutato: %s"
-
-msgid "IDS_EMAIL_BODY_DOWNLOAD_FULL_MESSAGE"
-msgstr "Scarica messaggio completo"
-
-msgid "IDS_EMAIL_BODY_GENERAL_SETTINGS"
-msgstr "Generali"
-
-msgid "IDS_EMAIL_BODY_TENTATIVE_C_PS"
-msgstr "Provvisorio: %s"
-
-msgid "IDS_EMAIL_BODY_WHEN_C_PS"
-msgstr "Quando: %s"
-
-msgid "IDS_EMAIL_BODY_WHERE_C_PS"
-msgstr "Dove: %s"
-
-msgid "IDS_EMAIL_BUTTON_DECLINE_ABB"
-msgstr "Rifiuta"
-
-msgid "IDS_EMAIL_BODY_NO_CONTENTS"
-msgstr "Nessun contenuto"
-
-msgid "IDS_EMAIL_BODY_ORIGINAL_MESSAGE"
-msgstr "Messaggio originale"
-
-msgid "IDS_EMAIL_HEADER_ACCOUNT_SETTINGS"
-msgstr "Impostazioni account"
-
-msgid "IDS_EMAIL_OPT_BLOCK"
-msgstr "Blocca"
-
-msgid "IDS_EMAIL_OPT_MARK_AS_READ"
-msgstr "Segna come letto"
-
-msgid "IDS_EMAIL_OPT_MARK_AS_UNREAD"
-msgstr "Segna come non letto"
-
-msgid "IDS_EMAIL_OPT_OTHERS"
-msgstr "Altro"
-
-msgid "IDS_EMAIL_OPT_UNREAD"
-msgstr "Non letto"
-
-msgid "IDS_EMAIL_SK_COMPOSE"
-msgstr "Componi"
-
-msgid "IDS_EMAIL_HEADER_DOWNLOAD_FAILED"
-msgstr "Errore download"
-
-msgid "IDS_EMAIL_OPT_ADD_TO_CONTACT"
-msgstr "Aggiungi a contatto"
-
-msgid "IDS_EMAIL_OPT_VOICE_CALL"
-msgstr "Chiamata vocale"
-
-msgid "IDS_EMAIL_BODY_ACCOUNT_NAME"
-msgstr "Nome account"
-
-msgid "IDS_EMAIL_BODY_ATTACHMENTS"
-msgstr "Allegati"
-
-msgid "IDS_EMAIL_BODY_FROM_C"
-msgstr "Da:"
-
-msgid "IDS_EMAIL_BODY_IMAP4_SERVER"
-msgstr "Server IMAP4"
-
-msgid "IDS_EMAIL_BODY_INCLUDES"
-msgstr "Include"
-
-msgid "IDS_EMAIL_BODY_INCOMING_PORT"
-msgstr "Porta in arrivo"
-
-msgid "IDS_EMAIL_BODY_INCOMING_SERVER"
-msgstr "Server posta in arrivo"
-
-msgid "IDS_EMAIL_BODY_IN_PD_MINUTES"
-msgstr "Tra %d minuti"
-
-msgid "IDS_EMAIL_BODY_KEEP_IN_SERVER"
-msgstr "Conserva sul server"
-
-msgid "IDS_EMAIL_BODY_NO_TEXT"
-msgstr "Nessun testo"
-
-msgid "IDS_EMAIL_BODY_OUTGOING_PORT"
-msgstr "Porta in uscita"
-
-msgid "IDS_EMAIL_BODY_OUTGOING_SERVER"
-msgstr "Server posta in uscita"
-
-msgid "IDS_EMAIL_BODY_PD_EMAILS"
-msgstr "%d e-mail"
-
-msgid "IDS_EMAIL_BODY_POP3_SERVER"
-msgstr "Server POP3"
-
-msgid "IDS_EMAIL_BODY_RECENT"
-msgstr "Recenti"
-
-msgid "IDS_EMAIL_BODY_RETRIEVING_OPTIONS"
-msgstr "Opzioni di recupero"
-
-msgid "IDS_EMAIL_BODY_RE_C"
-msgstr "R:"
-
-msgid "IDS_EMAIL_BODY_SENT_C"
-msgstr "Inviato:"
-
-msgid "IDS_EMAIL_BODY_SENT_FROM_SAMSUNG_MOBILE"
-msgstr "Inviato da Samsung Mobile"
-
-msgid "IDS_EMAIL_BODY_USER_PASSWORD"
-msgstr "Password utente"
-
-msgid "IDS_EMAIL_HEADER_EDIT_RULES"
-msgstr "Modifica regole"
-
-msgid "IDS_EMAIL_HEADER_EMAIL_SETTINGS"
-msgstr "Impostaz. e-mail"
-
-msgid "IDS_EMAIL_HEADER_MAILBOXES"
-msgstr "Caselle di posta"
-
-msgid "IDS_EMAIL_POP_ALERT"
-msgstr "Avviso"
-
-msgid "IDS_EMAIL_POP_FILE_ALREADY_EXISTS"
-msgstr "File già esistente"
-
-msgid "IDS_EMAIL_POP_NO_SENDER"
-msgstr "Nessun mittente"
-
-msgid "IDS_EMAIL_POP_SUCCEEDED"
-msgstr "Operazioni eseguite"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ATTACH_MAXIMUM_NUMBER_OF_FILES_IS_PD"
-msgstr "Impossibile allegare. Numero massimo file %d"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ATTACH_MAXIMUM_SIZE_OF_FILES_IS_PD_KB"
-msgstr "Impossibile allegare. Dimensioni massime file %d KB"
-
-msgid "IDS_EMAIL_POP_VALIDATION_FAILED"
-msgstr "Convalida non eseguita"
-
-msgid "IDS_EMAIL_SK_REPLY_ALL"
-msgstr "Rispondi a tutti"
-
-msgid "IDS_EMAIL_BODY_1_ITEM"
-msgstr "1 elemento"
-
-msgid "IDS_EMAIL_BODY_ADD_MY_NAMECARD"
-msgstr "Aggiungi biglietto da visita personale"
-
-msgid "IDS_EMAIL_BODY_ADD_SIGNATURE"
-msgstr "Aggiungi firma"
-
-msgid "IDS_EMAIL_BODY_ALL_EMAILS"
-msgstr "Tutte le e-mail"
-
-msgid "IDS_EMAIL_BODY_ALWAYS_BCC_MYSELF"
-msgstr "Sempre Ccn a me stesso"
-
-msgid "IDS_EMAIL_BODY_BCC"
-msgstr "Ccn"
-
-msgid "IDS_EMAIL_BODY_BLOCK_EMAILS"
-msgstr "Blocca e-mail"
-
-msgid "IDS_EMAIL_BODY_BODY"
-msgstr "Corpo"
-
-msgid "IDS_EMAIL_BODY_CC"
-msgstr "Cc"
-
-msgid "IDS_EMAIL_BODY_CC_BCC"
-msgstr "Cc/Ccn"
-
-msgid "IDS_EMAIL_BODY_CHECK_INTERVAL"
-msgstr "Frequenza controllo"
-
-msgid "IDS_EMAIL_BODY_DEFAULT_ACCOUNT"
-msgstr "Account predefinito"
-
-msgid "IDS_EMAIL_BODY_DRAFTS"
-msgstr "Bozze"
-
-msgid "IDS_EMAIL_BODY_EMAIL_ACCOUNTS"
-msgstr "Account e-mail"
-
-msgid "IDS_EMAIL_BODY_END_TIME"
-msgstr "Ora fine"
-
-msgid "IDS_EMAIL_BODY_ENTIRE_EMAIL"
-msgstr "Intera e-mail"
-
-msgid "IDS_EMAIL_BODY_EXACTLY_THE_SAME_AS"
-msgstr "Esattamente uguale a"
-
-msgid "IDS_EMAIL_BODY_EXAMPLE"
-msgstr "Esempio"
-
-msgid "IDS_EMAIL_BODY_FROM_M_SENDER"
-msgstr "Da:"
-
-msgid "IDS_EMAIL_BODY_INBOX"
-msgstr "Ricevuti"
-
-msgid "IDS_EMAIL_BODY_INCLUDE"
-msgstr "Contiene"
-
-msgid "IDS_EMAIL_BODY_MATCH_CRITERIA"
-msgstr "Criteri esatti"
-
-msgid "IDS_EMAIL_BODY_NOT_USED"
-msgstr "Non attivo"
-
-msgid "IDS_EMAIL_BODY_NO_ACCOUNTS"
-msgstr "Nessun account"
-
-msgid "IDS_EMAIL_BODY_PD_DAYS"
-msgstr "%d giorni"
-
-msgid "IDS_EMAIL_BODY_PD_ITEMS"
-msgstr "%d elementi"
-
-msgid "IDS_EMAIL_BODY_PRIORITY"
-msgstr "Priorità"
-
-msgid "IDS_EMAIL_BODY_RECEIVING_OPTIONS"
-msgstr "Opzioni di ricezione"
-
-msgid "IDS_EMAIL_BODY_SECURE_CONNECTION"
-msgstr "Connessione protetta"
-
-msgid "IDS_EMAIL_BODY_SENDING_OPTIONS"
-msgstr "Opzioni di invio"
-
-msgid "IDS_EMAIL_BODY_SENTBOX"
-msgstr "Inviati"
-
-msgid "IDS_EMAIL_BODY_SERVER_URL"
-msgstr "URL server"
-
-msgid "IDS_EMAIL_BODY_SIGNATURE"
-msgstr "Firma"
-
-msgid "IDS_EMAIL_BODY_SPAMBOX"
-msgstr "Cartella spam"
-
-msgid "IDS_EMAIL_BODY_START_TIME"
-msgstr "Ora inizio"
-
-msgid "IDS_EMAIL_BODY_SYNC_SCHEDULE_TMO"
-msgstr "Pianifica sincronizzazione"
-
-msgid "IDS_EMAIL_BODY_TRASH"
-msgstr "Cestino"
-
-msgid "IDS_EMAIL_BODY_WITHOUT_ATTACHMENTS"
-msgstr "Senza allegati"
-
-msgid "IDS_EMAIL_BUTTON_GROUP"
-msgstr "Gruppo"
-
-msgid "IDS_EMAIL_HEADER_ADD_RULES"
-msgstr "Aggiungi regole"
-
-msgid "IDS_EMAIL_OPT_ATTACH_ITEMS"
-msgstr "Allega elementi"
-
-msgid "IDS_EMAIL_OPT_EXCHANGE"
-msgstr "Exchange"
-
-msgid "IDS_EMAIL_OPT_FILE"
-msgstr "File"
-
-msgid "IDS_EMAIL_OPT_NAMECARD"
-msgstr "Biglietto da visita"
-
-msgid "IDS_EMAIL_OPT_OPEN_URL"
-msgstr "Apri URL"
-
-msgid "IDS_EMAIL_OPT_SENDER"
-msgstr "Mittente"
-
-msgid "IDS_EMAIL_OPT_SEND_EMAIL"
-msgstr "Invia e-mail"
-
-msgid "IDS_EMAIL_OPT_UPDATE_EXISTING"
-msgstr "Aggiorna esistente"
-
-msgid "IDS_EMAIL_POP_ADD_ACCOUNTS"
-msgstr "Aggiungi account"
-
-msgid "IDS_EMAIL_POP_DOWNLOADING_ATTACHMENT_ING"
-msgstr "Download allegato..."
-
-msgid "IDS_EMAIL_POP_INVALID_EMAIL_ADDRESS"
-msgstr "Indirizzo e-mail non valido"
-
-msgid "IDS_EMAIL_POP_LOADING_CONTENTS_ING"
-msgstr "Caricamento contenuti..."
-
-msgid "IDS_EMAIL_POP_MAXIMUM_NUMBER_OF_ATTACHMENTS_REACHED"
-msgstr "Raggiunto numero massimo di allegati"
-
-msgid "IDS_EMAIL_POP_MOVE_TO_SPAMBOX_Q"
-msgstr "Spostare in Casella spam?"
-
-msgid "IDS_EMAIL_POP_NO_RECIPIENTS_ADDED_ENTER_RECIPIENTS"
-msgstr "Nessun destinatario aggiunto. Immettere i destinatari"
-
-msgid "IDS_EMAIL_POP_PLEASE_FILL_ALL_THE_MANDATORY_FIELDS"
-msgstr "Compilare tutti i campi obbligatori"
-
-msgid "IDS_EMAIL_POP_SAVE_IN_DRAFTS_Q"
-msgstr "Salvare in Bozze?"
-
-msgid "IDS_EMAIL_POP_THERE_IS_NO_ACCOUNT_CREATE_A_NEW_ACCOUNT_FIRST"
-msgstr "Nessun account esistente. Creare prima un nuovo account"
-
-msgid "IDS_EMAIL_POP_TOO_MANY_RECIPIENTS"
-msgstr "Troppi destinatari"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_DOWNLOAD"
-msgstr "Impossibile eseguire download"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ENTER_TEXT"
-msgstr "Impossibile immettere testo"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_LAUNCH_APPLICATION"
-msgstr "Impossibile avviare applicazione"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_OPEN_ATTACHMENT"
-msgstr "Impossibile aprire allegato"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_SAVE_ATTACHMENT"
-msgstr "Impossibile salvare allegato"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_SAVE_IN_DRAFTS"
-msgstr "Impossibile salvare in Bozze"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_SEND_EMAIL"
-msgstr "Impossibile inviare e-mail"
-
-msgid "IDS_EMAIL_POP_UNSUPPORTED_FILE_TYPE"
-msgstr "Tipo file non supportato"
-
-msgid "IDS_EMAIL_POP_VALIDATING_ACCOUNT_ING"
-msgstr "Convalida account..."
-
-msgid "IDS_EMAIL_SK_RESEND"
-msgstr "Invia di nuovo"
-
-msgid "IDS_EMAIL_BODY_ACCEPT_ALL_SSL_CERTIFICATES"
-msgstr "Accetta tutti i certificati SSL"
-
-msgid "IDS_EMAIL_SK3_ACCOUNT_LIST"
-msgstr "Elenco account"
-
-msgid "IDS_EMAIL_BODY_USER_ID"
-msgstr "ID utente"
-
-msgid "IDS_EMAIL_POP_ACCOUNT_ALREADY_REGISTERED"
-msgstr "Account già registrato"
-
-msgid "IDS_EMAIL_HEADER_ATTACH_FILE"
-msgstr "Allega file"
-
-msgid "IDS_EMAIL_BODY_EXCHANGE_SYNC_SETTINGS_MSG"
-msgstr "Attivando questa applicazione, l'utente accetta che parte dei dati del dispositivo (identificatore univoco del dispositivo e nome del modello) siano memorizzati, elaborati e utilizzati da Samsung allo scopo di segnalare l'attivazione dell'applicazione ai concessori della licenza del software stesso. I dati in possesso di Samsung saranno trattati in modo strettamente conforme all'informativa sulla privacy di Samsung disponibile sul sito Web www.samsung.com. Continuare?"
-
-msgid "IDS_EMAIL_BODY_FORWARD_WITH_FILES"
-msgstr "Inoltra con allegati"
-
-msgid "IDS_EMAIL_BODY_REPLY_WITH_BODY"
-msgstr "Rispondi con msg. origin."
-
-msgid "IDS_EMAIL_BODY_NO_SUBJECT"
-msgstr "Nessun oggetto"
-
-msgid "IDS_EMAIL_BODY_FROM"
-msgstr "Da"
-
-msgid "IDS_EMAIL_BODY_NO_ADDRESS"
-msgstr "Nessun indirizzo"
-
-msgid "IDS_EMAIL_OPT_RECORD_SOUND"
-msgstr "Registra suono"
-
-msgid "IDS_EMAIL_OPT_RECORD_VIDEO"
-msgstr "Registra video"
-
-msgid "IDS_EMAIL_OPT_INSERT_IMAGE"
-msgstr "Inserisci immagine"
-
-msgid "IDS_EMAIL_OPT_ADD_TO_CALENDAR"
-msgstr "Aggiungi in Agenda"
-
-msgid "IDS_EMAIL_OPT_CHANGE_EMAIL_ADDRESS_ABB"
-msgstr "Cambia indirizzo e-mail"
-
-msgid "IDS_EMAIL_OPT_CLIPBOARD"
-msgstr "Appunti"
-
-msgid "IDS_EMAIL_OPT_MARKED_AS_UNREAD"
-msgstr "Contrassegnato come non letto"
-
-msgid "IDS_EMAIL_OPT_VIEW_CONTACT_DETAILS"
-msgstr "Visualizza dettagli contatto"
-
-msgid "IDS_EMAIL_POP_SAVED_IN_DRAFTS"
-msgstr "Salvato in Bozze"
-
-msgid "IDS_EMAIL_POP_NETWORK_BUSY"
-msgstr "Rete occupata"
-
-msgid "IDS_EMAIL_POP_LOGIN_ALLOWED_ONLY_EVERY_PD_MINUTES"
-msgstr "Accesso consentito solo ogni %d minuti"
-
-msgid "IDS_EMAIL_POP_HOST_NOT_FOUND"
-msgstr "Host non trovato"
-
-msgid "IDS_EMAIL_POP_HOST_NOT_REACHABLE"
-msgstr "Host non raggiungibile"
-
-msgid "IDS_EMAIL_POP_NO_SERVICE"
-msgstr "Nessun servizio"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_FORWARD_DRM_CONTENTS"
-msgstr "Impossibile inoltrare contenuti DRM"
-
-msgid "IDS_EMAIL_POP_BLOCKED"
-msgstr "Bloccato"
-
-msgid "IDS_EMAIL_POP_1_EMAIL_SELECTED"
-msgstr "1 e-mail selezionata"
-
-msgid "IDS_EMAIL_POP_PD_EMAILS_SELECTED"
-msgstr "%d email selezionate"
-
-msgid "IDS_EMAIL_POP_1_RECIPIENT_SELECTED"
-msgstr "1 destinatario selezionato"
-
-msgid "IDS_EMAIL_POP_PD_RECIPIENTS_SELECTED"
-msgstr "%d destinatari selezionati"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ADD_ACCOUNT"
-msgstr "Impossibile aggiungere account"
-
-msgid "IDS_EMAIL_SK3_MOVE_HERE"
-msgstr "Sposta qui"
-
diff --git a/po/ja_JP.po b/po/ja_JP.po
deleted file mode 100755 (executable)
index 866281f..0000000
+++ /dev/null
@@ -1,465 +0,0 @@
-msgid "IDS_EMAIL_POP_NO_EMAIL_ADDRESS"
-msgstr "Eメール​アドレス​が​ありません"
-
-msgid "IDS_EMAIL_BODY_COMPLETE"
-msgstr "完了"
-
-msgid "IDS_EMAIL_BODY_ACCEPTED_C_PS"
-msgstr "この予定は受理されました: %s"
-
-msgid "IDS_EMAIL_BODY_DECLINED_C_PS"
-msgstr "この予定は拒否されました: %s"
-
-msgid "IDS_EMAIL_BODY_DOWNLOAD_FULL_MESSAGE"
-msgstr "メッセージ​全体​を​ダウンロード"
-
-msgid "IDS_EMAIL_BODY_GENERAL_SETTINGS"
-msgstr "基本設定"
-
-msgid "IDS_EMAIL_BODY_TENTATIVE_C_PS"
-msgstr "仮の予定:%s"
-
-msgid "IDS_EMAIL_BODY_WHEN_C_PS"
-msgstr "予定日時: %s"
-
-msgid "IDS_EMAIL_BODY_WHERE_C_PS"
-msgstr "予定場所: %s"
-
-msgid "IDS_EMAIL_BUTTON_DECLINE_ABB"
-msgstr "拒否"
-
-msgid "IDS_EMAIL_BODY_NO_CONTENTS"
-msgstr "コンテンツがありません。"
-
-msgid "IDS_EMAIL_BODY_ORIGINAL_MESSAGE"
-msgstr "元のメール"
-
-msgid "IDS_EMAIL_HEADER_ACCOUNT_SETTINGS"
-msgstr "アカウント設定"
-
-msgid "IDS_EMAIL_OPT_BLOCK"
-msgstr "ブロック"
-
-msgid "IDS_EMAIL_OPT_MARK_AS_READ"
-msgstr "既読に変更"
-
-msgid "IDS_EMAIL_OPT_MARK_AS_UNREAD"
-msgstr "未読に変更"
-
-msgid "IDS_EMAIL_OPT_OTHERS"
-msgstr "その他"
-
-msgid "IDS_EMAIL_OPT_UNREAD"
-msgstr "未読"
-
-msgid "IDS_EMAIL_SK_COMPOSE"
-msgstr "作成"
-
-msgid "IDS_EMAIL_HEADER_DOWNLOAD_FAILED"
-msgstr "ダウンロードに失敗しました。"
-
-msgid "IDS_EMAIL_OPT_ADD_TO_CONTACT"
-msgstr "電話帳に追加"
-
-msgid "IDS_EMAIL_OPT_VOICE_CALL"
-msgstr "音声通話"
-
-msgid "IDS_EMAIL_BODY_ACCOUNT_NAME"
-msgstr "アカウント名"
-
-msgid "IDS_EMAIL_BODY_ATTACHMENTS"
-msgstr "ファイル添付"
-
-msgid "IDS_EMAIL_BODY_FROM_C"
-msgstr "発信元:"
-
-msgid "IDS_EMAIL_BODY_IMAP4_SERVER"
-msgstr "IMAP4​サーバー"
-
-msgid "IDS_EMAIL_BODY_INCLUDES"
-msgstr "部分一致"
-
-msgid "IDS_EMAIL_BODY_INCOMING_PORT"
-msgstr "受信​ポート"
-
-msgid "IDS_EMAIL_BODY_INCOMING_SERVER"
-msgstr "受信サーバー"
-
-msgid "IDS_EMAIL_BODY_IN_PD_MINUTES"
-msgstr "%d​分​後"
-
-msgid "IDS_EMAIL_BODY_KEEP_IN_SERVER"
-msgstr "サーバーに​保存​"
-
-msgid "IDS_EMAIL_BODY_NO_TEXT"
-msgstr "テキスト​が​ありません"
-
-msgid "IDS_EMAIL_BODY_OUTGOING_PORT"
-msgstr "外部​ポート"
-
-msgid "IDS_EMAIL_BODY_OUTGOING_SERVER"
-msgstr "送信サーバー"
-
-msgid "IDS_EMAIL_BODY_PD_EMAILS"
-msgstr "Eメール%d件"
-
-msgid "IDS_EMAIL_BODY_POP3_SERVER"
-msgstr "POP3サーバー"
-
-msgid "IDS_EMAIL_BODY_RECENT"
-msgstr "最近"
-
-msgid "IDS_EMAIL_BODY_RETRIEVING_OPTIONS"
-msgstr "オプション​の​取得"
-
-msgid "IDS_EMAIL_BODY_RE_C"
-msgstr "RE:"
-
-msgid "IDS_EMAIL_BODY_SENT_C"
-msgstr "送信済み:"
-
-msgid "IDS_EMAIL_BODY_SENT_FROM_SAMSUNG_MOBILE"
-msgstr "Samsung Mobileから送信しました"
-
-msgid "IDS_EMAIL_BODY_USER_PASSWORD"
-msgstr "ユーザ​ーパスワード"
-
-msgid "IDS_EMAIL_HEADER_EDIT_RULES"
-msgstr "ルール​を​編集"
-
-msgid "IDS_EMAIL_HEADER_EMAIL_SETTINGS"
-msgstr "Eメール​設定"
-
-msgid "IDS_EMAIL_HEADER_MAILBOXES"
-msgstr "メールボックス"
-
-msgid "IDS_EMAIL_POP_ALERT"
-msgstr "通知"
-
-msgid "IDS_EMAIL_POP_FILE_ALREADY_EXISTS"
-msgstr "ファイルが​既に​存在します。"
-
-msgid "IDS_EMAIL_POP_NO_SENDER"
-msgstr "送信者​が​未入力​です"
-
-msgid "IDS_EMAIL_POP_SUCCEEDED"
-msgstr "成功しました"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ATTACH_MAXIMUM_NUMBER_OF_FILES_IS_PD"
-msgstr "添付​できません。​最大件数​は​%d​件です"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ATTACH_MAXIMUM_SIZE_OF_FILES_IS_PD_KB"
-msgstr "添付​できません。​ファイルの最大​サイズ​は​%dKB​です"
-
-msgid "IDS_EMAIL_POP_VALIDATION_FAILED"
-msgstr "認証​に​失敗​しました"
-
-msgid "IDS_EMAIL_SK_REPLY_ALL"
-msgstr "全員に返信"
-
-msgid "IDS_EMAIL_BODY_1_ITEM"
-msgstr "1 ​件​の​アイテム"
-
-msgid "IDS_EMAIL_BODY_ADD_MY_NAMECARD"
-msgstr "ネームカード​​追加​"
-
-msgid "IDS_EMAIL_BODY_ADD_SIGNATURE"
-msgstr "署名を追加"
-
-msgid "IDS_EMAIL_BODY_ALL_EMAILS"
-msgstr "全てのEメール"
-
-msgid "IDS_EMAIL_BODY_ALWAYS_BCC_MYSELF"
-msgstr "必ず自分にBccを送信"
-
-msgid "IDS_EMAIL_BODY_BCC"
-msgstr "Bcc"
-
-msgid "IDS_EMAIL_BODY_BLOCK_EMAILS"
-msgstr "Eメール​を​ブロック​"
-
-msgid "IDS_EMAIL_BODY_BODY"
-msgstr "本文"
-
-msgid "IDS_EMAIL_BODY_CC"
-msgstr "Cc"
-
-msgid "IDS_EMAIL_BODY_CC_BCC"
-msgstr "Cc/Bcc"
-
-msgid "IDS_EMAIL_BODY_CHECK_INTERVAL"
-msgstr "チェック​間隔"
-
-msgid "IDS_EMAIL_BODY_DEFAULT_ACCOUNT"
-msgstr "メインアカウント"
-
-msgid "IDS_EMAIL_BODY_DRAFTS"
-msgstr "下書き"
-
-msgid "IDS_EMAIL_BODY_EMAIL_ACCOUNTS"
-msgstr "Eメール​アカウント"
-
-msgid "IDS_EMAIL_BODY_END_TIME"
-msgstr "終了時刻"
-
-msgid "IDS_EMAIL_BODY_ENTIRE_EMAIL"
-msgstr "Eメール全体"
-
-msgid "IDS_EMAIL_BODY_EXACTLY_THE_SAME_AS"
-msgstr "完全一致"
-
-msgid "IDS_EMAIL_BODY_EXAMPLE"
-msgstr "サンプル"
-
-msgid "IDS_EMAIL_BODY_FROM_M_SENDER"
-msgstr "発信元:"
-
-msgid "IDS_EMAIL_BODY_INBOX"
-msgstr "受信トレイ"
-
-msgid "IDS_EMAIL_BODY_INCLUDE"
-msgstr "内容"
-
-msgid "IDS_EMAIL_BODY_MATCH_CRITERIA"
-msgstr "振り分けルール"
-
-msgid "IDS_EMAIL_BODY_NOT_USED"
-msgstr "利用​不可"
-
-msgid "IDS_EMAIL_BODY_NO_ACCOUNTS"
-msgstr "アカウント​が​ありません。"
-
-msgid "IDS_EMAIL_BODY_PD_DAYS"
-msgstr "%d日"
-
-msgid "IDS_EMAIL_BODY_PD_ITEMS"
-msgstr "%d​アイテム"
-
-msgid "IDS_EMAIL_BODY_PRIORITY"
-msgstr "優先度"
-
-msgid "IDS_EMAIL_BODY_RECEIVING_OPTIONS"
-msgstr "受信​オプション"
-
-msgid "IDS_EMAIL_BODY_SECURE_CONNECTION"
-msgstr "セキュア​コネクション"
-
-msgid "IDS_EMAIL_BODY_SENDING_OPTIONS"
-msgstr "送信オプション"
-
-msgid "IDS_EMAIL_BODY_SENTBOX"
-msgstr "送信済トレイ"
-
-msgid "IDS_EMAIL_BODY_SERVER_URL"
-msgstr "サーバーURL"
-
-msgid "IDS_EMAIL_BODY_SIGNATURE"
-msgstr "署名"
-
-msgid "IDS_EMAIL_BODY_SPAMBOX"
-msgstr "スパムボックス"
-
-msgid "IDS_EMAIL_BODY_START_TIME"
-msgstr "開始時刻"
-
-msgid "IDS_EMAIL_BODY_SYNC_SCHEDULE_TMO"
-msgstr "予定を同期"
-
-msgid "IDS_EMAIL_BODY_TRASH"
-msgstr "削除"
-
-msgid "IDS_EMAIL_BODY_WITHOUT_ATTACHMENTS"
-msgstr "添付​なし"
-
-msgid "IDS_EMAIL_BUTTON_GROUP"
-msgstr "グループ"
-
-msgid "IDS_EMAIL_HEADER_ADD_RULES"
-msgstr "ルール​を​追加"
-
-msgid "IDS_EMAIL_OPT_ATTACH_ITEMS"
-msgstr "添付​"
-
-msgid "IDS_EMAIL_OPT_EXCHANGE"
-msgstr "交換"
-
-msgid "IDS_EMAIL_OPT_FILE"
-msgstr "ファイル"
-
-msgid "IDS_EMAIL_OPT_NAMECARD"
-msgstr "連絡先"
-
-msgid "IDS_EMAIL_OPT_OPEN_URL"
-msgstr "URLを開く"
-
-msgid "IDS_EMAIL_OPT_SENDER"
-msgstr "送信者"
-
-msgid "IDS_EMAIL_OPT_SEND_EMAIL"
-msgstr "Eメール送信"
-
-msgid "IDS_EMAIL_OPT_UPDATE_EXISTING"
-msgstr "既存連絡先の更新"
-
-msgid "IDS_EMAIL_POP_ADD_ACCOUNTS"
-msgstr "アカウント​を​追加​します"
-
-msgid "IDS_EMAIL_POP_DOWNLOADING_ATTACHMENT_ING"
-msgstr "添付​ファイルを​ダウンロード中..."
-
-msgid "IDS_EMAIL_POP_INVALID_EMAIL_ADDRESS"
-msgstr "Eメールアドレスが正しくありません。"
-
-msgid "IDS_EMAIL_POP_LOADING_CONTENTS_ING"
-msgstr "コンテンツ​の​読み込み​中​..."
-
-msgid "IDS_EMAIL_POP_MAXIMUM_NUMBER_OF_ATTACHMENTS_REACHED"
-msgstr "最大​添付数​に​なりました"
-
-msgid "IDS_EMAIL_POP_MOVE_TO_SPAMBOX_Q"
-msgstr "Spambox​に​移動​しますか?"
-
-msgid "IDS_EMAIL_POP_NO_RECIPIENTS_ADDED_ENTER_RECIPIENTS"
-msgstr "宛先は追加されませんでした。宛先を入力してください。"
-
-msgid "IDS_EMAIL_POP_PLEASE_FILL_ALL_THE_MANDATORY_FIELDS"
-msgstr "必須​事項​を​全て​記入​して​ください"
-
-msgid "IDS_EMAIL_POP_SAVE_IN_DRAFTS_Q"
-msgstr "下書きに保存しますか?"
-
-msgid "IDS_EMAIL_POP_THERE_IS_NO_ACCOUNT_CREATE_A_NEW_ACCOUNT_FIRST"
-msgstr "アカウント​が​ありません。はじめ​に​アカウント​を​作成​して​ください"
-
-msgid "IDS_EMAIL_POP_TOO_MANY_RECIPIENTS"
-msgstr "宛先が多すぎます"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_DOWNLOAD"
-msgstr "ダウンロード​でき​ません"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ENTER_TEXT"
-msgstr "テキスト​を​入力​でき​ません"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_LAUNCH_APPLICATION"
-msgstr "アプリケーションを​起動​できません"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_OPEN_ATTACHMENT"
-msgstr "添付​を​開け​ません"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_SAVE_ATTACHMENT"
-msgstr "添付​書類を​保存できません"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_SAVE_IN_DRAFTS"
-msgstr "下書き​に​保存​できません"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_SEND_EMAIL"
-msgstr "Eメール​を​送信​できません"
-
-msgid "IDS_EMAIL_POP_UNSUPPORTED_FILE_TYPE"
-msgstr "未対応のファイルです"
-
-msgid "IDS_EMAIL_POP_VALIDATING_ACCOUNT_ING"
-msgstr "アカウント​の​認証中..."
-
-msgid "IDS_EMAIL_SK_RESEND"
-msgstr "再送信"
-
-msgid "IDS_EMAIL_BODY_ACCEPT_ALL_SSL_CERTIFICATES"
-msgstr "全てのSSL証明書を受け入れる"
-
-msgid "IDS_EMAIL_SK3_ACCOUNT_LIST"
-msgstr "アカウント​リスト"
-
-msgid "IDS_EMAIL_BODY_USER_ID"
-msgstr "ユーザー​ID"
-
-msgid "IDS_EMAIL_POP_ACCOUNT_ALREADY_REGISTERED"
-msgstr "アカウント​は​既に​登録​されています"
-
-msgid "IDS_EMAIL_HEADER_ATTACH_FILE"
-msgstr "ファイル​を​添付"
-
-msgid "IDS_EMAIL_BODY_EXCHANGE_SYNC_SETTINGS_MSG"
-msgstr "この​アプリ​を​起動​する​と、​Samsung​が​アプリ​ソフト​の​使用許諾者​に​アプリ​の​起動​を​通知​する​ために​本体​の​データ​(端末固有ID​と​モデル名)​を​保管、​処理、​および​使用​する​ことを​承認​した​ことに​なります。​この​データ​は、​www.samsung.com​で​記載​されて​いる​Samsung​の​プライバシー​ポリシー​に​よって​守られて​います。​続行​しますか?"
-
-msgid "IDS_EMAIL_BODY_FORWARD_WITH_FILES"
-msgstr "添付ファイル付きで転送"
-
-msgid "IDS_EMAIL_BODY_REPLY_WITH_BODY"
-msgstr "引用返信"
-
-msgid "IDS_EMAIL_BODY_NO_SUBJECT"
-msgstr "件名なし"
-
-msgid "IDS_EMAIL_BODY_FROM"
-msgstr "送信元"
-
-msgid "IDS_EMAIL_BODY_NO_ADDRESS"
-msgstr "アドレスはありません"
-
-msgid "IDS_EMAIL_OPT_RECORD_SOUND"
-msgstr "ボイスレコーダー起動"
-
-msgid "IDS_EMAIL_OPT_RECORD_VIDEO"
-msgstr "ビデオカメラ起動"
-
-msgid "IDS_EMAIL_OPT_INSERT_IMAGE"
-msgstr "画像​を​挿入"
-
-msgid "IDS_EMAIL_OPT_ADD_TO_CALENDAR"
-msgstr "Add to Calendar"
-
-msgid "IDS_EMAIL_OPT_CHANGE_EMAIL_ADDRESS_ABB"
-msgstr "Eメールアドレス変更"
-
-msgid "IDS_EMAIL_OPT_CLIPBOARD"
-msgstr "クリップ​ボード"
-
-msgid "IDS_EMAIL_OPT_MARKED_AS_UNREAD"
-msgstr "未読​に​マーク済みです"
-
-msgid "IDS_EMAIL_OPT_VIEW_CONTACT_DETAILS"
-msgstr "電話帳​詳細​表示​"
-
-msgid "IDS_EMAIL_POP_SAVED_IN_DRAFTS"
-msgstr "下書きに保存"
-
-msgid "IDS_EMAIL_POP_NETWORK_BUSY"
-msgstr "ネットワーク​混雑中"
-
-msgid "IDS_EMAIL_POP_LOGIN_ALLOWED_ONLY_EVERY_PD_MINUTES"
-msgstr "Login allowed only every %d minutes"
-
-msgid "IDS_EMAIL_POP_HOST_NOT_FOUND"
-msgstr "ホスト​が​見つかり​ません"
-
-msgid "IDS_EMAIL_POP_HOST_NOT_REACHABLE"
-msgstr "ホスト​は​まだ​到着​して​いません"
-
-msgid "IDS_EMAIL_POP_NO_SERVICE"
-msgstr "サービスが利用できません。"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_FORWARD_DRM_CONTENTS"
-msgstr "DRMコンテンツを転送できません"
-
-msgid "IDS_EMAIL_POP_BLOCKED"
-msgstr "ブロック"
-
-msgid "IDS_EMAIL_POP_1_EMAIL_SELECTED"
-msgstr "Eメール​を​1件​選択​しました"
-
-msgid "IDS_EMAIL_POP_PD_EMAILS_SELECTED"
-msgstr "%d件​の​Eメール​を​選択​しました"
-
-msgid "IDS_EMAIL_POP_1_RECIPIENT_SELECTED"
-msgstr "1受信者を​選択​しました"
-
-msgid "IDS_EMAIL_POP_PD_RECIPIENTS_SELECTED"
-msgstr "%dの​受信者を​選択しました"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ADD_ACCOUNT"
-msgstr "Unable to add account"
-
-msgid "IDS_EMAIL_SK3_MOVE_HERE"
-msgstr "ここに​移動"
-
diff --git a/po/ko_KR.po b/po/ko_KR.po
deleted file mode 100755 (executable)
index db9066a..0000000
+++ /dev/null
@@ -1,465 +0,0 @@
-msgid "IDS_EMAIL_POP_NO_EMAIL_ADDRESS"
-msgstr "이메일 주소가 없습니다"
-
-msgid "IDS_EMAIL_BODY_COMPLETE"
-msgstr "완료"
-
-msgid "IDS_EMAIL_BODY_ACCEPTED_C_PS"
-msgstr "수락: %s"
-
-msgid "IDS_EMAIL_BODY_DECLINED_C_PS"
-msgstr "거절: %s"
-
-msgid "IDS_EMAIL_BODY_DOWNLOAD_FULL_MESSAGE"
-msgstr "전체 메시지 다운로드"
-
-msgid "IDS_EMAIL_BODY_GENERAL_SETTINGS"
-msgstr "일반 설정"
-
-msgid "IDS_EMAIL_BODY_TENTATIVE_C_PS"
-msgstr "임시: %s"
-
-msgid "IDS_EMAIL_BODY_WHEN_C_PS"
-msgstr "언제: %s"
-
-msgid "IDS_EMAIL_BODY_WHERE_C_PS"
-msgstr "위치: %s"
-
-msgid "IDS_EMAIL_BUTTON_DECLINE_ABB"
-msgstr "거절"
-
-msgid "IDS_EMAIL_BODY_NO_CONTENTS"
-msgstr "내용이 없습니다"
-
-msgid "IDS_EMAIL_BODY_ORIGINAL_MESSAGE"
-msgstr "원본 메시지"
-
-msgid "IDS_EMAIL_HEADER_ACCOUNT_SETTINGS"
-msgstr "계정 설정"
-
-msgid "IDS_EMAIL_OPT_BLOCK"
-msgstr "차단"
-
-msgid "IDS_EMAIL_OPT_MARK_AS_READ"
-msgstr "읽음으로 표시"
-
-msgid "IDS_EMAIL_OPT_MARK_AS_UNREAD"
-msgstr "읽지 않음으로 표시"
-
-msgid "IDS_EMAIL_OPT_OTHERS"
-msgstr "기타"
-
-msgid "IDS_EMAIL_OPT_UNREAD"
-msgstr "읽지 않음"
-
-msgid "IDS_EMAIL_SK_COMPOSE"
-msgstr "작성"
-
-msgid "IDS_EMAIL_HEADER_DOWNLOAD_FAILED"
-msgstr "다운로드할 수 없습니다"
-
-msgid "IDS_EMAIL_OPT_ADD_TO_CONTACT"
-msgstr "연락처에 추가"
-
-msgid "IDS_EMAIL_OPT_VOICE_CALL"
-msgstr "음성통화"
-
-msgid "IDS_EMAIL_BODY_ACCOUNT_NAME"
-msgstr "계정 이름"
-
-msgid "IDS_EMAIL_BODY_ATTACHMENTS"
-msgstr "첨부파일"
-
-msgid "IDS_EMAIL_BODY_FROM_C"
-msgstr "발신:"
-
-msgid "IDS_EMAIL_BODY_IMAP4_SERVER"
-msgstr "IMAP4 서버"
-
-msgid "IDS_EMAIL_BODY_INCLUDES"
-msgstr "입력 번호를 포함"
-
-msgid "IDS_EMAIL_BODY_INCOMING_PORT"
-msgstr "수신 포트"
-
-msgid "IDS_EMAIL_BODY_INCOMING_SERVER"
-msgstr "받는 메일 서버"
-
-msgid "IDS_EMAIL_BODY_IN_PD_MINUTES"
-msgstr "%d분 후에"
-
-msgid "IDS_EMAIL_BODY_KEEP_IN_SERVER"
-msgstr "서버에 저장"
-
-msgid "IDS_EMAIL_BODY_NO_TEXT"
-msgstr "메시지 내용이 없습니다"
-
-msgid "IDS_EMAIL_BODY_OUTGOING_PORT"
-msgstr "전송 포트‏"
-
-msgid "IDS_EMAIL_BODY_OUTGOING_SERVER"
-msgstr "보내는 메일 서버"
-
-msgid "IDS_EMAIL_BODY_PD_EMAILS"
-msgstr "이메일 %d개"
-
-msgid "IDS_EMAIL_BODY_POP3_SERVER"
-msgstr "POP3 서버"
-
-msgid "IDS_EMAIL_BODY_RECENT"
-msgstr "최근 검색 결과"
-
-msgid "IDS_EMAIL_BODY_RETRIEVING_OPTIONS"
-msgstr "가져오기 옵션"
-
-msgid "IDS_EMAIL_BODY_RE_C"
-msgstr "회신:"
-
-msgid "IDS_EMAIL_BODY_SENT_C"
-msgstr "발신:"
-
-msgid "IDS_EMAIL_BODY_SENT_FROM_SAMSUNG_MOBILE"
-msgstr "삼성 모바일에서 전송하였습니다"
-
-msgid "IDS_EMAIL_BODY_USER_PASSWORD"
-msgstr "사용자 비밀번호"
-
-msgid "IDS_EMAIL_HEADER_EDIT_RULES"
-msgstr "규칙 편집"
-
-msgid "IDS_EMAIL_HEADER_EMAIL_SETTINGS"
-msgstr "이메일 설정"
-
-msgid "IDS_EMAIL_HEADER_MAILBOXES"
-msgstr "메일함"
-
-msgid "IDS_EMAIL_POP_ALERT"
-msgstr "알림"
-
-msgid "IDS_EMAIL_POP_FILE_ALREADY_EXISTS"
-msgstr "같은 파일이 있습니다"
-
-msgid "IDS_EMAIL_POP_NO_SENDER"
-msgstr "발신인이 없습니다"
-
-msgid "IDS_EMAIL_POP_SUCCEEDED"
-msgstr "성공하였습니다"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ATTACH_MAXIMUM_NUMBER_OF_FILES_IS_PD"
-msgstr "첨부할 수 없습니다. 첨부할 수 있는 파일 수는 %d개입니다"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ATTACH_MAXIMUM_SIZE_OF_FILES_IS_PD_KB"
-msgstr "첨부할 수 없습니다. 첨부할 수 있는 파일 크기는 %dKB까지 입니다"
-
-msgid "IDS_EMAIL_POP_VALIDATION_FAILED"
-msgstr "확인할 수 없습니다"
-
-msgid "IDS_EMAIL_SK_REPLY_ALL"
-msgstr "전체 회신"
-
-msgid "IDS_EMAIL_BODY_1_ITEM"
-msgstr "1개"
-
-msgid "IDS_EMAIL_BODY_ADD_MY_NAMECARD"
-msgstr "내 명함 추가"
-
-msgid "IDS_EMAIL_BODY_ADD_SIGNATURE"
-msgstr "서명 추가"
-
-msgid "IDS_EMAIL_BODY_ALL_EMAILS"
-msgstr "모든 이메일"
-
-msgid "IDS_EMAIL_BODY_ALWAYS_BCC_MYSELF"
-msgstr "항상 나를 숨은참조에 포함"
-
-msgid "IDS_EMAIL_BODY_BCC"
-msgstr "숨은참조"
-
-msgid "IDS_EMAIL_BODY_BLOCK_EMAILS"
-msgstr "이메일 차단"
-
-msgid "IDS_EMAIL_BODY_BODY"
-msgstr "본문"
-
-msgid "IDS_EMAIL_BODY_CC"
-msgstr "참조"
-
-msgid "IDS_EMAIL_BODY_CC_BCC"
-msgstr "참조/숨은참조"
-
-msgid "IDS_EMAIL_BODY_CHECK_INTERVAL"
-msgstr "수신 확인 간격"
-
-msgid "IDS_EMAIL_BODY_DEFAULT_ACCOUNT"
-msgstr "기본 계정"
-
-msgid "IDS_EMAIL_BODY_DRAFTS"
-msgstr "임시보관함"
-
-msgid "IDS_EMAIL_BODY_EMAIL_ACCOUNTS"
-msgstr "이메일 계정"
-
-msgid "IDS_EMAIL_BODY_END_TIME"
-msgstr "종료 시간"
-
-msgid "IDS_EMAIL_BODY_ENTIRE_EMAIL"
-msgstr "전체 이메일"
-
-msgid "IDS_EMAIL_BODY_EXACTLY_THE_SAME_AS"
-msgstr "입력 내용과 일치"
-
-msgid "IDS_EMAIL_BODY_EXAMPLE"
-msgstr "예시"
-
-msgid "IDS_EMAIL_BODY_FROM_M_SENDER"
-msgstr "발신:"
-
-msgid "IDS_EMAIL_BODY_INBOX"
-msgstr "수신함"
-
-msgid "IDS_EMAIL_BODY_INCLUDE"
-msgstr "포함"
-
-msgid "IDS_EMAIL_BODY_MATCH_CRITERIA"
-msgstr "적용 기준"
-
-msgid "IDS_EMAIL_BODY_NOT_USED"
-msgstr "사용 안 함"
-
-msgid "IDS_EMAIL_BODY_NO_ACCOUNTS"
-msgstr "설정된 계정이 없습니다"
-
-msgid "IDS_EMAIL_BODY_PD_DAYS"
-msgstr "%d일"
-
-msgid "IDS_EMAIL_BODY_PD_ITEMS"
-msgstr "%d개"
-
-msgid "IDS_EMAIL_BODY_PRIORITY"
-msgstr "중요도"
-
-msgid "IDS_EMAIL_BODY_RECEIVING_OPTIONS"
-msgstr "수신 옵션"
-
-msgid "IDS_EMAIL_BODY_SECURE_CONNECTION"
-msgstr "보안 연결"
-
-msgid "IDS_EMAIL_BODY_SENDING_OPTIONS"
-msgstr "전송 옵션"
-
-msgid "IDS_EMAIL_BODY_SENTBOX"
-msgstr "발신함"
-
-msgid "IDS_EMAIL_BODY_SERVER_URL"
-msgstr "서버 URL"
-
-msgid "IDS_EMAIL_BODY_SIGNATURE"
-msgstr "서명"
-
-msgid "IDS_EMAIL_BODY_SPAMBOX"
-msgstr "스팸메시지함"
-
-msgid "IDS_EMAIL_BODY_START_TIME"
-msgstr "시작 시간"
-
-msgid "IDS_EMAIL_BODY_SYNC_SCHEDULE_TMO"
-msgstr "동기화 일정"
-
-msgid "IDS_EMAIL_BODY_TRASH"
-msgstr "휴지통"
-
-msgid "IDS_EMAIL_BODY_WITHOUT_ATTACHMENTS"
-msgstr "첨부파일 제외"
-
-msgid "IDS_EMAIL_BUTTON_GROUP"
-msgstr "그룹"
-
-msgid "IDS_EMAIL_HEADER_ADD_RULES"
-msgstr "규칙 추가"
-
-msgid "IDS_EMAIL_OPT_ATTACH_ITEMS"
-msgstr "파일 첨부"
-
-msgid "IDS_EMAIL_OPT_EXCHANGE"
-msgstr "Exchange"
-
-msgid "IDS_EMAIL_OPT_FILE"
-msgstr "파일"
-
-msgid "IDS_EMAIL_OPT_NAMECARD"
-msgstr "명함"
-
-msgid "IDS_EMAIL_OPT_OPEN_URL"
-msgstr "URL 연결"
-
-msgid "IDS_EMAIL_OPT_SENDER"
-msgstr "발신인"
-
-msgid "IDS_EMAIL_OPT_SEND_EMAIL"
-msgstr "이메일 보내기"
-
-msgid "IDS_EMAIL_OPT_UPDATE_EXISTING"
-msgstr "기존 연락처에 추가"
-
-msgid "IDS_EMAIL_POP_ADD_ACCOUNTS"
-msgstr "계정 추가"
-
-msgid "IDS_EMAIL_POP_DOWNLOADING_ATTACHMENT_ING"
-msgstr "첨부파일 다운로드 중..."
-
-msgid "IDS_EMAIL_POP_INVALID_EMAIL_ADDRESS"
-msgstr "이메일 주소가 바르지 않습니다"
-
-msgid "IDS_EMAIL_POP_LOADING_CONTENTS_ING"
-msgstr "컨텐츠 불러오는 중..."
-
-msgid "IDS_EMAIL_POP_MAXIMUM_NUMBER_OF_ATTACHMENTS_REACHED"
-msgstr "최대 첨부파일 수를 초과하였습니다"
-
-msgid "IDS_EMAIL_POP_MOVE_TO_SPAMBOX_Q"
-msgstr "스팸메시지함으로 이동시킬까요?"
-
-msgid "IDS_EMAIL_POP_NO_RECIPIENTS_ADDED_ENTER_RECIPIENTS"
-msgstr "추가된 수신인이 없습니다. 수신인을 입력하세요"
-
-msgid "IDS_EMAIL_POP_PLEASE_FILL_ALL_THE_MANDATORY_FIELDS"
-msgstr "필수 항목을 모두 입력하세요"
-
-msgid "IDS_EMAIL_POP_SAVE_IN_DRAFTS_Q"
-msgstr "임시보관함에 저장할까요?"
-
-msgid "IDS_EMAIL_POP_THERE_IS_NO_ACCOUNT_CREATE_A_NEW_ACCOUNT_FIRST"
-msgstr "저장된 계정이 없습니다. 계정을 추가하세요"
-
-msgid "IDS_EMAIL_POP_TOO_MANY_RECIPIENTS"
-msgstr "수신인이 너무 많습니다"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_DOWNLOAD"
-msgstr "다운로드할 수 없습니다"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ENTER_TEXT"
-msgstr "텍스트를 입력할 수 없습니다"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_LAUNCH_APPLICATION"
-msgstr "애플리케이션을 실행할 수 없습니다"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_OPEN_ATTACHMENT"
-msgstr "첨부파일을 열 수 없습니다"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_SAVE_ATTACHMENT"
-msgstr "첨부파일을 저장할 수 없습니다"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_SAVE_IN_DRAFTS"
-msgstr "임시보관함에 저장할 수 없습니다"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_SEND_EMAIL"
-msgstr "이메일을 전송할 수 없습니다"
-
-msgid "IDS_EMAIL_POP_UNSUPPORTED_FILE_TYPE"
-msgstr "지원되지 않는 파일 형식입니다"
-
-msgid "IDS_EMAIL_POP_VALIDATING_ACCOUNT_ING"
-msgstr "계정 확인 중..."
-
-msgid "IDS_EMAIL_SK_RESEND"
-msgstr "재전송"
-
-msgid "IDS_EMAIL_BODY_ACCEPT_ALL_SSL_CERTIFICATES"
-msgstr "모든 SSL 인증서에 동의"
-
-msgid "IDS_EMAIL_SK3_ACCOUNT_LIST"
-msgstr "계정 목록"
-
-msgid "IDS_EMAIL_BODY_USER_ID"
-msgstr "사용자 ID"
-
-msgid "IDS_EMAIL_POP_ACCOUNT_ALREADY_REGISTERED"
-msgstr "계정이 이미 등록되어 있습니다"
-
-msgid "IDS_EMAIL_HEADER_ATTACH_FILE"
-msgstr "파일 첨부"
-
-msgid "IDS_EMAIL_BODY_EXCHANGE_SYNC_SETTINGS_MSG"
-msgstr "이 애플리케이션을 실행하면 소프트웨어의 저작권자에게 애플리케이션 실행을 보고하기 위하여 삼성이 디바이스의 일부 정보(단말 고유번호 구성 및 모델명)를 저장, 가공, 사용하는 것에 동의한 것으로 인정됩니다. 이러한 정보는 삼성의 개인정보 보호정책에 따라 철저히 취급됩니다. 개인정보 보호정책은 www.samsung.com에서 확인할 수 있습니다. 계속할까요?"
-
-msgid "IDS_EMAIL_BODY_FORWARD_WITH_FILES"
-msgstr "전달시 첨부파일 포함"
-
-msgid "IDS_EMAIL_BODY_REPLY_WITH_BODY"
-msgstr "본문 포함하여 회신"
-
-msgid "IDS_EMAIL_BODY_NO_SUBJECT"
-msgstr "제목이 없습니다"
-
-msgid "IDS_EMAIL_BODY_FROM"
-msgstr "발신"
-
-msgid "IDS_EMAIL_BODY_NO_ADDRESS"
-msgstr "저장된 주소가 없습니다"
-
-msgid "IDS_EMAIL_OPT_RECORD_SOUND"
-msgstr "음성녹음"
-
-msgid "IDS_EMAIL_OPT_RECORD_VIDEO"
-msgstr "동영상 촬영"
-
-msgid "IDS_EMAIL_OPT_INSERT_IMAGE"
-msgstr "이미지 추가"
-
-msgid "IDS_EMAIL_OPT_ADD_TO_CALENDAR"
-msgstr "일정에 추가"
-
-msgid "IDS_EMAIL_OPT_CHANGE_EMAIL_ADDRESS_ABB"
-msgstr "이메일 주소 변경"
-
-msgid "IDS_EMAIL_OPT_CLIPBOARD"
-msgstr "클립보드"
-
-msgid "IDS_EMAIL_OPT_MARKED_AS_UNREAD"
-msgstr "읽지 않음으로 표시"
-
-msgid "IDS_EMAIL_OPT_VIEW_CONTACT_DETAILS"
-msgstr "연락처 상세보기"
-
-msgid "IDS_EMAIL_POP_SAVED_IN_DRAFTS"
-msgstr "임시보관함에 저장되었습니다"
-
-msgid "IDS_EMAIL_POP_NETWORK_BUSY"
-msgstr "네트워크 연결 상태가 원활하지 않습니다"
-
-msgid "IDS_EMAIL_POP_LOGIN_ALLOWED_ONLY_EVERY_PD_MINUTES"
-msgstr "%d분마다 한 번 로그인할 수 있습니다"
-
-msgid "IDS_EMAIL_POP_HOST_NOT_FOUND"
-msgstr "호스트를 찾을 수 없습니다"
-
-msgid "IDS_EMAIL_POP_HOST_NOT_REACHABLE"
-msgstr "호스트와 연결할 수 없습니다"
-
-msgid "IDS_EMAIL_POP_NO_SERVICE"
-msgstr "서비스 지역이 아닙니다"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_FORWARD_DRM_CONTENTS"
-msgstr "DRM 컨텐츠는 전송할 수 없습니다"
-
-msgid "IDS_EMAIL_POP_BLOCKED"
-msgstr "차단되었습니다"
-
-msgid "IDS_EMAIL_POP_1_EMAIL_SELECTED"
-msgstr "이메일 1개가 선택되었습니다"
-
-msgid "IDS_EMAIL_POP_PD_EMAILS_SELECTED"
-msgstr "%d개가 선택되었습니다"
-
-msgid "IDS_EMAIL_POP_1_RECIPIENT_SELECTED"
-msgstr "수신인이 한 명 선택되었습니다"
-
-msgid "IDS_EMAIL_POP_PD_RECIPIENTS_SELECTED"
-msgstr "수신인 %d명 선택되었습니다"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ADD_ACCOUNT"
-msgstr "계정을 추가할 수 없습니다"
-
-msgid "IDS_EMAIL_SK3_MOVE_HERE"
-msgstr "여기로 이동"
-
diff --git a/po/nl_NL.po b/po/nl_NL.po
deleted file mode 100755 (executable)
index c6172ff..0000000
+++ /dev/null
@@ -1,465 +0,0 @@
-msgid "IDS_EMAIL_POP_NO_EMAIL_ADDRESS"
-msgstr "Geen e-mailadres"
-
-msgid "IDS_EMAIL_BODY_COMPLETE"
-msgstr "Voltooid"
-
-msgid "IDS_EMAIL_BODY_ACCEPTED_C_PS"
-msgstr "Geaccepteerd: %s"
-
-msgid "IDS_EMAIL_BODY_DECLINED_C_PS"
-msgstr "Afgewezen: %s"
-
-msgid "IDS_EMAIL_BODY_DOWNLOAD_FULL_MESSAGE"
-msgstr "Volledig bericht downloaden"
-
-msgid "IDS_EMAIL_BODY_GENERAL_SETTINGS"
-msgstr "Algemene instellingen"
-
-msgid "IDS_EMAIL_BODY_TENTATIVE_C_PS"
-msgstr "Proef: %s"
-
-msgid "IDS_EMAIL_BODY_WHEN_C_PS"
-msgstr "Wanneer: %s"
-
-msgid "IDS_EMAIL_BODY_WHERE_C_PS"
-msgstr "Waar: %s"
-
-msgid "IDS_EMAIL_BUTTON_DECLINE_ABB"
-msgstr "Weigeren"
-
-msgid "IDS_EMAIL_BODY_NO_CONTENTS"
-msgstr "Geen inhoud"
-
-msgid "IDS_EMAIL_BODY_ORIGINAL_MESSAGE"
-msgstr "Oorspronkelijk bericht"
-
-msgid "IDS_EMAIL_HEADER_ACCOUNT_SETTINGS"
-msgstr "Accountinstellingen"
-
-msgid "IDS_EMAIL_OPT_BLOCK"
-msgstr "Blokkeren"
-
-msgid "IDS_EMAIL_OPT_MARK_AS_READ"
-msgstr "Markeren als gelezen"
-
-msgid "IDS_EMAIL_OPT_MARK_AS_UNREAD"
-msgstr "Markeren als Ongelezen"
-
-msgid "IDS_EMAIL_OPT_OTHERS"
-msgstr "Overige"
-
-msgid "IDS_EMAIL_OPT_UNREAD"
-msgstr "Ongelezen"
-
-msgid "IDS_EMAIL_SK_COMPOSE"
-msgstr "Opstellen"
-
-msgid "IDS_EMAIL_HEADER_DOWNLOAD_FAILED"
-msgstr "Downloaden mislukt"
-
-msgid "IDS_EMAIL_OPT_ADD_TO_CONTACT"
-msgstr "Toevoegen aan contactpersoon"
-
-msgid "IDS_EMAIL_OPT_VOICE_CALL"
-msgstr "Spraakoproep"
-
-msgid "IDS_EMAIL_BODY_ACCOUNT_NAME"
-msgstr "Accountnaam"
-
-msgid "IDS_EMAIL_BODY_ATTACHMENTS"
-msgstr "Bijlagen"
-
-msgid "IDS_EMAIL_BODY_FROM_C"
-msgstr "Van:"
-
-msgid "IDS_EMAIL_BODY_IMAP4_SERVER"
-msgstr "IMAP4-server"
-
-msgid "IDS_EMAIL_BODY_INCLUDES"
-msgstr "Inclusief"
-
-msgid "IDS_EMAIL_BODY_INCOMING_PORT"
-msgstr "Poort inkomende e-mail"
-
-msgid "IDS_EMAIL_BODY_INCOMING_SERVER"
-msgstr "Inkomende server"
-
-msgid "IDS_EMAIL_BODY_IN_PD_MINUTES"
-msgstr "In %d minuten"
-
-msgid "IDS_EMAIL_BODY_KEEP_IN_SERVER"
-msgstr "Op server bewaren"
-
-msgid "IDS_EMAIL_BODY_NO_TEXT"
-msgstr "Geen tekst"
-
-msgid "IDS_EMAIL_BODY_OUTGOING_PORT"
-msgstr "Poort uitgaande e-mail"
-
-msgid "IDS_EMAIL_BODY_OUTGOING_SERVER"
-msgstr "Uitgaande server"
-
-msgid "IDS_EMAIL_BODY_PD_EMAILS"
-msgstr "%d e-mails"
-
-msgid "IDS_EMAIL_BODY_POP3_SERVER"
-msgstr "POP3-server"
-
-msgid "IDS_EMAIL_BODY_RECENT"
-msgstr "Recent"
-
-msgid "IDS_EMAIL_BODY_RETRIEVING_OPTIONS"
-msgstr "Ophaalopties"
-
-msgid "IDS_EMAIL_BODY_RE_C"
-msgstr "Re:"
-
-msgid "IDS_EMAIL_BODY_SENT_C"
-msgstr "Verzonden:"
-
-msgid "IDS_EMAIL_BODY_SENT_FROM_SAMSUNG_MOBILE"
-msgstr "Verzonden vanaf Samsung Mobile"
-
-msgid "IDS_EMAIL_BODY_USER_PASSWORD"
-msgstr "Wachtwoord"
-
-msgid "IDS_EMAIL_HEADER_EDIT_RULES"
-msgstr "Regels bewerken"
-
-msgid "IDS_EMAIL_HEADER_EMAIL_SETTINGS"
-msgstr "E-mailinstellingen"
-
-msgid "IDS_EMAIL_HEADER_MAILBOXES"
-msgstr "Mailboxen"
-
-msgid "IDS_EMAIL_POP_ALERT"
-msgstr "Signaal"
-
-msgid "IDS_EMAIL_POP_FILE_ALREADY_EXISTS"
-msgstr "Bestand bestaat al"
-
-msgid "IDS_EMAIL_POP_NO_SENDER"
-msgstr "Geen afzender"
-
-msgid "IDS_EMAIL_POP_SUCCEEDED"
-msgstr "Gelukt"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ATTACH_MAXIMUM_NUMBER_OF_FILES_IS_PD"
-msgstr "Kan niet toevoegen. Maximumaantal bestanden is %d"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ATTACH_MAXIMUM_SIZE_OF_FILES_IS_PD_KB"
-msgstr "Kan niet toevoegen. Maximumgrootte van bestanden is %d KB"
-
-msgid "IDS_EMAIL_POP_VALIDATION_FAILED"
-msgstr "Validatie mislukt"
-
-msgid "IDS_EMAIL_SK_REPLY_ALL"
-msgstr "Allen beantw."
-
-msgid "IDS_EMAIL_BODY_1_ITEM"
-msgstr "1 item"
-
-msgid "IDS_EMAIL_BODY_ADD_MY_NAMECARD"
-msgstr "Mijn visitekaartje toevoegen"
-
-msgid "IDS_EMAIL_BODY_ADD_SIGNATURE"
-msgstr "Handtekening toevoegen"
-
-msgid "IDS_EMAIL_BODY_ALL_EMAILS"
-msgstr "Alle e-mailberichten"
-
-msgid "IDS_EMAIL_BODY_ALWAYS_BCC_MYSELF"
-msgstr "Altijd BCC aan mijzelf"
-
-msgid "IDS_EMAIL_BODY_BCC"
-msgstr "BCC"
-
-msgid "IDS_EMAIL_BODY_BLOCK_EMAILS"
-msgstr "E-mail blokkeren"
-
-msgid "IDS_EMAIL_BODY_BODY"
-msgstr "Hoofdtekst"
-
-msgid "IDS_EMAIL_BODY_CC"
-msgstr "CC"
-
-msgid "IDS_EMAIL_BODY_CC_BCC"
-msgstr "Cc/Bcc"
-
-msgid "IDS_EMAIL_BODY_CHECK_INTERVAL"
-msgstr "Controle-interval"
-
-msgid "IDS_EMAIL_BODY_DEFAULT_ACCOUNT"
-msgstr "Standaard account"
-
-msgid "IDS_EMAIL_BODY_DRAFTS"
-msgstr "Concepten"
-
-msgid "IDS_EMAIL_BODY_EMAIL_ACCOUNTS"
-msgstr "E-mailaccounts"
-
-msgid "IDS_EMAIL_BODY_END_TIME"
-msgstr "Eindtijd"
-
-msgid "IDS_EMAIL_BODY_ENTIRE_EMAIL"
-msgstr "Volledige e-mail"
-
-msgid "IDS_EMAIL_BODY_EXACTLY_THE_SAME_AS"
-msgstr "Precies gelijk aan"
-
-msgid "IDS_EMAIL_BODY_EXAMPLE"
-msgstr "Voorbeeld"
-
-msgid "IDS_EMAIL_BODY_FROM_M_SENDER"
-msgstr "Van:"
-
-msgid "IDS_EMAIL_BODY_INBOX"
-msgstr "Postvak IN"
-
-msgid "IDS_EMAIL_BODY_INCLUDE"
-msgstr "Invoegen"
-
-msgid "IDS_EMAIL_BODY_MATCH_CRITERIA"
-msgstr "Blokkeringscriteria"
-
-msgid "IDS_EMAIL_BODY_NOT_USED"
-msgstr "Niet gebruiken"
-
-msgid "IDS_EMAIL_BODY_NO_ACCOUNTS"
-msgstr "Geen accounts"
-
-msgid "IDS_EMAIL_BODY_PD_DAYS"
-msgstr "%d dagen"
-
-msgid "IDS_EMAIL_BODY_PD_ITEMS"
-msgstr "%d items"
-
-msgid "IDS_EMAIL_BODY_PRIORITY"
-msgstr "Prioriteit"
-
-msgid "IDS_EMAIL_BODY_RECEIVING_OPTIONS"
-msgstr "Ontvangstopties"
-
-msgid "IDS_EMAIL_BODY_SECURE_CONNECTION"
-msgstr "Veilige verbinding"
-
-msgid "IDS_EMAIL_BODY_SENDING_OPTIONS"
-msgstr "Verzendopties"
-
-msgid "IDS_EMAIL_BODY_SENTBOX"
-msgstr "Verzonden berichten"
-
-msgid "IDS_EMAIL_BODY_SERVER_URL"
-msgstr "URL server"
-
-msgid "IDS_EMAIL_BODY_SIGNATURE"
-msgstr "Handtekening"
-
-msgid "IDS_EMAIL_BODY_SPAMBOX"
-msgstr "Ongewenste berichten"
-
-msgid "IDS_EMAIL_BODY_START_TIME"
-msgstr "Begintijd"
-
-msgid "IDS_EMAIL_BODY_SYNC_SCHEDULE_TMO"
-msgstr "Synchronisatieschema"
-
-msgid "IDS_EMAIL_BODY_TRASH"
-msgstr "Prullenbak"
-
-msgid "IDS_EMAIL_BODY_WITHOUT_ATTACHMENTS"
-msgstr "Zonder bijlagen"
-
-msgid "IDS_EMAIL_BUTTON_GROUP"
-msgstr "Groep"
-
-msgid "IDS_EMAIL_HEADER_ADD_RULES"
-msgstr "Regels toevoegen"
-
-msgid "IDS_EMAIL_OPT_ATTACH_ITEMS"
-msgstr "Items toevoegen"
-
-msgid "IDS_EMAIL_OPT_EXCHANGE"
-msgstr "Exchange"
-
-msgid "IDS_EMAIL_OPT_FILE"
-msgstr "Bestand"
-
-msgid "IDS_EMAIL_OPT_NAMECARD"
-msgstr "Visitekaartje"
-
-msgid "IDS_EMAIL_OPT_OPEN_URL"
-msgstr "URL openen"
-
-msgid "IDS_EMAIL_OPT_SENDER"
-msgstr "Afzender"
-
-msgid "IDS_EMAIL_OPT_SEND_EMAIL"
-msgstr "E-mail verzenden"
-
-msgid "IDS_EMAIL_OPT_UPDATE_EXISTING"
-msgstr "Bestaande bijwerken"
-
-msgid "IDS_EMAIL_POP_ADD_ACCOUNTS"
-msgstr "Accounts toevoegen"
-
-msgid "IDS_EMAIL_POP_DOWNLOADING_ATTACHMENT_ING"
-msgstr "Bijlage downloaden..."
-
-msgid "IDS_EMAIL_POP_INVALID_EMAIL_ADDRESS"
-msgstr "Ongeldig e-mailadres"
-
-msgid "IDS_EMAIL_POP_LOADING_CONTENTS_ING"
-msgstr "Inhoud laden..."
-
-msgid "IDS_EMAIL_POP_MAXIMUM_NUMBER_OF_ATTACHMENTS_REACHED"
-msgstr "Maximumaantal bijlagen bereikt"
-
-msgid "IDS_EMAIL_POP_MOVE_TO_SPAMBOX_Q"
-msgstr "Verplaatsen naar Ongewenste e-mail?"
-
-msgid "IDS_EMAIL_POP_NO_RECIPIENTS_ADDED_ENTER_RECIPIENTS"
-msgstr "Geen ontvangers toegevoegd. Geef ontvangers in"
-
-msgid "IDS_EMAIL_POP_PLEASE_FILL_ALL_THE_MANDATORY_FIELDS"
-msgstr "Vul alle verplichte velden in"
-
-msgid "IDS_EMAIL_POP_SAVE_IN_DRAFTS_Q"
-msgstr "Opslaan in Concepten?"
-
-msgid "IDS_EMAIL_POP_THERE_IS_NO_ACCOUNT_CREATE_A_NEW_ACCOUNT_FIRST"
-msgstr "Er is geen account. Maak eerst een nieuwe account"
-
-msgid "IDS_EMAIL_POP_TOO_MANY_RECIPIENTS"
-msgstr "Te veel ontvangers"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_DOWNLOAD"
-msgstr "Kan niet downloaden"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ENTER_TEXT"
-msgstr "Kan tekst niet ingeven"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_LAUNCH_APPLICATION"
-msgstr "Kan applicatie niet starten"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_OPEN_ATTACHMENT"
-msgstr "Kan bijlage niet openen"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_SAVE_ATTACHMENT"
-msgstr "Kan bijlage niet opslaan"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_SAVE_IN_DRAFTS"
-msgstr "Kan niet opslaan in Concepten"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_SEND_EMAIL"
-msgstr "Kan e-mail niet verzenden"
-
-msgid "IDS_EMAIL_POP_UNSUPPORTED_FILE_TYPE"
-msgstr "Niet-ondersteund bestandstype"
-
-msgid "IDS_EMAIL_POP_VALIDATING_ACCOUNT_ING"
-msgstr "Account controleren..."
-
-msgid "IDS_EMAIL_SK_RESEND"
-msgstr "Opnieuw verzenden"
-
-msgid "IDS_EMAIL_BODY_ACCEPT_ALL_SSL_CERTIFICATES"
-msgstr "Alle SSL-certificaten accepteren"
-
-msgid "IDS_EMAIL_SK3_ACCOUNT_LIST"
-msgstr "Account-lijst"
-
-msgid "IDS_EMAIL_BODY_USER_ID"
-msgstr "Gebruikersnaam"
-
-msgid "IDS_EMAIL_POP_ACCOUNT_ALREADY_REGISTERED"
-msgstr "Account reeds geregistreerd"
-
-msgid "IDS_EMAIL_HEADER_ATTACH_FILE"
-msgstr "Bestand toevoegen"
-
-msgid "IDS_EMAIL_BODY_EXCHANGE_SYNC_SETTINGS_MSG"
-msgstr "Door deze applicatie te activeren accepteert u dat bepaalde apparaatgegevens (unieke apparaat-id en modelnaam) door Samsung worden opgeslagen, verwerkt en gebruikt om het activeren van deze applicatie te rapporteren aan de licentiegevers van de applicatiesoftware. Gegevens worden door Samsung strikt volgens het Samsung-privacybeleid behandeld. Een exemplaar van dit beleid is op www.samsung.com beschikbaar. Doorgaan?"
-
-msgid "IDS_EMAIL_BODY_FORWARD_WITH_FILES"
-msgstr "Doorsturen met bestanden"
-
-msgid "IDS_EMAIL_BODY_REPLY_WITH_BODY"
-msgstr "Beantwoorden met oorspronkelijke tekst"
-
-msgid "IDS_EMAIL_BODY_NO_SUBJECT"
-msgstr "Geen onderwerp"
-
-msgid "IDS_EMAIL_BODY_FROM"
-msgstr "Van"
-
-msgid "IDS_EMAIL_BODY_NO_ADDRESS"
-msgstr "Geen adres"
-
-msgid "IDS_EMAIL_OPT_RECORD_SOUND"
-msgstr "Geluid opnemen"
-
-msgid "IDS_EMAIL_OPT_RECORD_VIDEO"
-msgstr "Video opnemen"
-
-msgid "IDS_EMAIL_OPT_INSERT_IMAGE"
-msgstr "Afbeelding invoegen"
-
-msgid "IDS_EMAIL_OPT_ADD_TO_CALENDAR"
-msgstr "Toevoegen aan agenda"
-
-msgid "IDS_EMAIL_OPT_CHANGE_EMAIL_ADDRESS_ABB"
-msgstr "E-mailadres wijzigen"
-
-msgid "IDS_EMAIL_OPT_CLIPBOARD"
-msgstr "Klembord"
-
-msgid "IDS_EMAIL_OPT_MARKED_AS_UNREAD"
-msgstr "Markeren als ongelezen"
-
-msgid "IDS_EMAIL_OPT_VIEW_CONTACT_DETAILS"
-msgstr "Details contact weergeven"
-
-msgid "IDS_EMAIL_POP_SAVED_IN_DRAFTS"
-msgstr "Opgeslagen in Concepten"
-
-msgid "IDS_EMAIL_POP_NETWORK_BUSY"
-msgstr "Netwerk bezet"
-
-msgid "IDS_EMAIL_POP_LOGIN_ALLOWED_ONLY_EVERY_PD_MINUTES"
-msgstr "Login allowed only every %d minutes"
-
-msgid "IDS_EMAIL_POP_HOST_NOT_FOUND"
-msgstr "Host niet gevonden"
-
-msgid "IDS_EMAIL_POP_HOST_NOT_REACHABLE"
-msgstr "Host onbereikbaar"
-
-msgid "IDS_EMAIL_POP_NO_SERVICE"
-msgstr "Geen netwerk"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_FORWARD_DRM_CONTENTS"
-msgstr "Kan DRM-inhoud niet doorsturen"
-
-msgid "IDS_EMAIL_POP_BLOCKED"
-msgstr "Geblokkeerd"
-
-msgid "IDS_EMAIL_POP_1_EMAIL_SELECTED"
-msgstr "1 e-mail geselecteerd"
-
-msgid "IDS_EMAIL_POP_PD_EMAILS_SELECTED"
-msgstr "%d e-mails geselecteerd"
-
-msgid "IDS_EMAIL_POP_1_RECIPIENT_SELECTED"
-msgstr "1 ontvanger geselecteerd"
-
-msgid "IDS_EMAIL_POP_PD_RECIPIENTS_SELECTED"
-msgstr "%d ontvangers geselecteerd"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ADD_ACCOUNT"
-msgstr "Kan account niet toevoegen"
-
-msgid "IDS_EMAIL_SK3_MOVE_HERE"
-msgstr "Hier plaatsen"
-
diff --git a/po/pt_PT.po b/po/pt_PT.po
deleted file mode 100755 (executable)
index 7ec97f2..0000000
+++ /dev/null
@@ -1,465 +0,0 @@
-msgid "IDS_EMAIL_POP_NO_EMAIL_ADDRESS"
-msgstr "Nenhum endereço de e-mail"
-
-msgid "IDS_EMAIL_BODY_COMPLETE"
-msgstr "Concluída"
-
-msgid "IDS_EMAIL_BODY_ACCEPTED_C_PS"
-msgstr "Aceite: %s"
-
-msgid "IDS_EMAIL_BODY_DECLINED_C_PS"
-msgstr "Declinado: %s"
-
-msgid "IDS_EMAIL_BODY_DOWNLOAD_FULL_MESSAGE"
-msgstr "Transferir mensagem completa"
-
-msgid "IDS_EMAIL_BODY_GENERAL_SETTINGS"
-msgstr "Defin. gerais"
-
-msgid "IDS_EMAIL_BODY_TENTATIVE_C_PS"
-msgstr "Tentativa: %s"
-
-msgid "IDS_EMAIL_BODY_WHEN_C_PS"
-msgstr "Quando: %s"
-
-msgid "IDS_EMAIL_BODY_WHERE_C_PS"
-msgstr "Onde: %s"
-
-msgid "IDS_EMAIL_BUTTON_DECLINE_ABB"
-msgstr "Declinar"
-
-msgid "IDS_EMAIL_BODY_NO_CONTENTS"
-msgstr "Sem conteúdo"
-
-msgid "IDS_EMAIL_BODY_ORIGINAL_MESSAGE"
-msgstr "Mensagem original"
-
-msgid "IDS_EMAIL_HEADER_ACCOUNT_SETTINGS"
-msgstr "Definições da conta"
-
-msgid "IDS_EMAIL_OPT_BLOCK"
-msgstr "Bloquear"
-
-msgid "IDS_EMAIL_OPT_MARK_AS_READ"
-msgstr "Marcar como lida"
-
-msgid "IDS_EMAIL_OPT_MARK_AS_UNREAD"
-msgstr "Marcar como não lida"
-
-msgid "IDS_EMAIL_OPT_OTHERS"
-msgstr "Outros"
-
-msgid "IDS_EMAIL_OPT_UNREAD"
-msgstr "Não lida"
-
-msgid "IDS_EMAIL_SK_COMPOSE"
-msgstr "Escrever"
-
-msgid "IDS_EMAIL_HEADER_DOWNLOAD_FAILED"
-msgstr "Falha na transferência"
-
-msgid "IDS_EMAIL_OPT_ADD_TO_CONTACT"
-msgstr "Adicionar a contacto"
-
-msgid "IDS_EMAIL_OPT_VOICE_CALL"
-msgstr "Chamada de voz"
-
-msgid "IDS_EMAIL_BODY_ACCOUNT_NAME"
-msgstr "Nome da conta"
-
-msgid "IDS_EMAIL_BODY_ATTACHMENTS"
-msgstr "Anexos"
-
-msgid "IDS_EMAIL_BODY_FROM_C"
-msgstr "De:"
-
-msgid "IDS_EMAIL_BODY_IMAP4_SERVER"
-msgstr "Servidor IMAP4"
-
-msgid "IDS_EMAIL_BODY_INCLUDES"
-msgstr "Inclui"
-
-msgid "IDS_EMAIL_BODY_INCOMING_PORT"
-msgstr "Porta de recepção"
-
-msgid "IDS_EMAIL_BODY_INCOMING_SERVER"
-msgstr "Servidor de recepção"
-
-msgid "IDS_EMAIL_BODY_IN_PD_MINUTES"
-msgstr "Dentro de %d minutos"
-
-msgid "IDS_EMAIL_BODY_KEEP_IN_SERVER"
-msgstr "Manter cópia no servidor"
-
-msgid "IDS_EMAIL_BODY_NO_TEXT"
-msgstr "Sem texto"
-
-msgid "IDS_EMAIL_BODY_OUTGOING_PORT"
-msgstr "Porta de envio"
-
-msgid "IDS_EMAIL_BODY_OUTGOING_SERVER"
-msgstr "Servidor de envio"
-
-msgid "IDS_EMAIL_BODY_PD_EMAILS"
-msgstr "%d e-mails"
-
-msgid "IDS_EMAIL_BODY_POP3_SERVER"
-msgstr "Servidor POP3"
-
-msgid "IDS_EMAIL_BODY_RECENT"
-msgstr "Recente"
-
-msgid "IDS_EMAIL_BODY_RETRIEVING_OPTIONS"
-msgstr "Opções de recepção"
-
-msgid "IDS_EMAIL_BODY_RE_C"
-msgstr "RE:"
-
-msgid "IDS_EMAIL_BODY_SENT_C"
-msgstr "Enviado:"
-
-msgid "IDS_EMAIL_BODY_SENT_FROM_SAMSUNG_MOBILE"
-msgstr "Enviado de Samsung Mobile"
-
-msgid "IDS_EMAIL_BODY_USER_PASSWORD"
-msgstr "Palavra-passe de utilizador"
-
-msgid "IDS_EMAIL_HEADER_EDIT_RULES"
-msgstr "Editar regras"
-
-msgid "IDS_EMAIL_HEADER_EMAIL_SETTINGS"
-msgstr "Definições e-mail"
-
-msgid "IDS_EMAIL_HEADER_MAILBOXES"
-msgstr "Caixas de correio"
-
-msgid "IDS_EMAIL_POP_ALERT"
-msgstr "Alerta"
-
-msgid "IDS_EMAIL_POP_FILE_ALREADY_EXISTS"
-msgstr "Ficheiro já existe"
-
-msgid "IDS_EMAIL_POP_NO_SENDER"
-msgstr "Nenhum remetente"
-
-msgid "IDS_EMAIL_POP_SUCCEEDED"
-msgstr "Com êxito"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ATTACH_MAXIMUM_NUMBER_OF_FILES_IS_PD"
-msgstr "Impossível anexar. O número máximo de ficheiros é %d"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ATTACH_MAXIMUM_SIZE_OF_FILES_IS_PD_KB"
-msgstr "Impossível anexar. O tamanho máximo dos ficheiros é %d KB"
-
-msgid "IDS_EMAIL_POP_VALIDATION_FAILED"
-msgstr "Validação falhou"
-
-msgid "IDS_EMAIL_SK_REPLY_ALL"
-msgstr "Respond. a todos"
-
-msgid "IDS_EMAIL_BODY_1_ITEM"
-msgstr "1 item"
-
-msgid "IDS_EMAIL_BODY_ADD_MY_NAMECARD"
-msgstr "Adicionar o meu cartão de visita"
-
-msgid "IDS_EMAIL_BODY_ADD_SIGNATURE"
-msgstr "Adicionar assinatura"
-
-msgid "IDS_EMAIL_BODY_ALL_EMAILS"
-msgstr "Todos os e-mails"
-
-msgid "IDS_EMAIL_BODY_ALWAYS_BCC_MYSELF"
-msgstr "Sempre com Bcc para mim"
-
-msgid "IDS_EMAIL_BODY_BCC"
-msgstr "Bcc"
-
-msgid "IDS_EMAIL_BODY_BLOCK_EMAILS"
-msgstr "Bloquear e-mails"
-
-msgid "IDS_EMAIL_BODY_BODY"
-msgstr "Corpo"
-
-msgid "IDS_EMAIL_BODY_CC"
-msgstr "Cc"
-
-msgid "IDS_EMAIL_BODY_CC_BCC"
-msgstr "Cc/Bcc"
-
-msgid "IDS_EMAIL_BODY_CHECK_INTERVAL"
-msgstr "Verificar intervalo"
-
-msgid "IDS_EMAIL_BODY_DEFAULT_ACCOUNT"
-msgstr "Conta padrão"
-
-msgid "IDS_EMAIL_BODY_DRAFTS"
-msgstr "Rascunhos"
-
-msgid "IDS_EMAIL_BODY_EMAIL_ACCOUNTS"
-msgstr "Contas de e-mail"
-
-msgid "IDS_EMAIL_BODY_END_TIME"
-msgstr "Hora de fim"
-
-msgid "IDS_EMAIL_BODY_ENTIRE_EMAIL"
-msgstr "E-mail completo"
-
-msgid "IDS_EMAIL_BODY_EXACTLY_THE_SAME_AS"
-msgstr "Exactamente o mesmo que"
-
-msgid "IDS_EMAIL_BODY_EXAMPLE"
-msgstr "Exemplo"
-
-msgid "IDS_EMAIL_BODY_FROM_M_SENDER"
-msgstr "De :"
-
-msgid "IDS_EMAIL_BODY_INBOX"
-msgstr "Caixa de Entrada"
-
-msgid "IDS_EMAIL_BODY_INCLUDE"
-msgstr "Incluir"
-
-msgid "IDS_EMAIL_BODY_MATCH_CRITERIA"
-msgstr "Corresponder critérios"
-
-msgid "IDS_EMAIL_BODY_NOT_USED"
-msgstr "Não utilizado"
-
-msgid "IDS_EMAIL_BODY_NO_ACCOUNTS"
-msgstr "Sem contas"
-
-msgid "IDS_EMAIL_BODY_PD_DAYS"
-msgstr "%d dias"
-
-msgid "IDS_EMAIL_BODY_PD_ITEMS"
-msgstr "%d itens"
-
-msgid "IDS_EMAIL_BODY_PRIORITY"
-msgstr "Prioridade"
-
-msgid "IDS_EMAIL_BODY_RECEIVING_OPTIONS"
-msgstr "Opções de recepção"
-
-msgid "IDS_EMAIL_BODY_SECURE_CONNECTION"
-msgstr "Ligação segura"
-
-msgid "IDS_EMAIL_BODY_SENDING_OPTIONS"
-msgstr "Opções de envio"
-
-msgid "IDS_EMAIL_BODY_SENTBOX"
-msgstr "Itens enviados"
-
-msgid "IDS_EMAIL_BODY_SERVER_URL"
-msgstr "URL do servidor"
-
-msgid "IDS_EMAIL_BODY_SIGNATURE"
-msgstr "Assinatura"
-
-msgid "IDS_EMAIL_BODY_SPAMBOX"
-msgstr "Caixa de Spam"
-
-msgid "IDS_EMAIL_BODY_START_TIME"
-msgstr "Hora de início"
-
-msgid "IDS_EMAIL_BODY_SYNC_SCHEDULE_TMO"
-msgstr "Agenda de sincronização"
-
-msgid "IDS_EMAIL_BODY_TRASH"
-msgstr "Lixo"
-
-msgid "IDS_EMAIL_BODY_WITHOUT_ATTACHMENTS"
-msgstr "Sem anexos"
-
-msgid "IDS_EMAIL_BUTTON_GROUP"
-msgstr "Grupo"
-
-msgid "IDS_EMAIL_HEADER_ADD_RULES"
-msgstr "Adicionar regras"
-
-msgid "IDS_EMAIL_OPT_ATTACH_ITEMS"
-msgstr "Anexar itens"
-
-msgid "IDS_EMAIL_OPT_EXCHANGE"
-msgstr "Exchange"
-
-msgid "IDS_EMAIL_OPT_FILE"
-msgstr "Ficheiro"
-
-msgid "IDS_EMAIL_OPT_NAMECARD"
-msgstr "Cartão de visita"
-
-msgid "IDS_EMAIL_OPT_OPEN_URL"
-msgstr "Abrir URL"
-
-msgid "IDS_EMAIL_OPT_SENDER"
-msgstr "Remetente"
-
-msgid "IDS_EMAIL_OPT_SEND_EMAIL"
-msgstr "Enviar e-mail"
-
-msgid "IDS_EMAIL_OPT_UPDATE_EXISTING"
-msgstr "Actualizar existente"
-
-msgid "IDS_EMAIL_POP_ADD_ACCOUNTS"
-msgstr "Adicionar contas"
-
-msgid "IDS_EMAIL_POP_DOWNLOADING_ATTACHMENT_ING"
-msgstr "A transferir anexo..."
-
-msgid "IDS_EMAIL_POP_INVALID_EMAIL_ADDRESS"
-msgstr "Endereço de e-mail inválido"
-
-msgid "IDS_EMAIL_POP_LOADING_CONTENTS_ING"
-msgstr "A carregar conteúdos..."
-
-msgid "IDS_EMAIL_POP_MAXIMUM_NUMBER_OF_ATTACHMENTS_REACHED"
-msgstr "Número máximo de anexos atingido"
-
-msgid "IDS_EMAIL_POP_MOVE_TO_SPAMBOX_Q"
-msgstr "Mover para caixa de spam?"
-
-msgid "IDS_EMAIL_POP_NO_RECIPIENTS_ADDED_ENTER_RECIPIENTS"
-msgstr "Nenhum destinatário adicionado. Introduzir destinatários"
-
-msgid "IDS_EMAIL_POP_PLEASE_FILL_ALL_THE_MANDATORY_FIELDS"
-msgstr "Preencha todos os campos obrigatórios"
-
-msgid "IDS_EMAIL_POP_SAVE_IN_DRAFTS_Q"
-msgstr "Guardar nos Rascunhos?"
-
-msgid "IDS_EMAIL_POP_THERE_IS_NO_ACCOUNT_CREATE_A_NEW_ACCOUNT_FIRST"
-msgstr "Não existe conta. Primeiro, tem de criar uma conta nova"
-
-msgid "IDS_EMAIL_POP_TOO_MANY_RECIPIENTS"
-msgstr "Demasiados destinatários"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_DOWNLOAD"
-msgstr "Impossível transferir"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ENTER_TEXT"
-msgstr "Impossível introduzir texto"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_LAUNCH_APPLICATION"
-msgstr "Impossível iniciar aplicação"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_OPEN_ATTACHMENT"
-msgstr "Impossível abrir anexo"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_SAVE_ATTACHMENT"
-msgstr "Impossível guardar anexo"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_SAVE_IN_DRAFTS"
-msgstr "Impossível guardar em Rascunhos"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_SEND_EMAIL"
-msgstr "Impossível enviar e-mail"
-
-msgid "IDS_EMAIL_POP_UNSUPPORTED_FILE_TYPE"
-msgstr "Tipo de ficheiro não suportado"
-
-msgid "IDS_EMAIL_POP_VALIDATING_ACCOUNT_ING"
-msgstr "A validar conta..."
-
-msgid "IDS_EMAIL_SK_RESEND"
-msgstr "Reenviar"
-
-msgid "IDS_EMAIL_BODY_ACCEPT_ALL_SSL_CERTIFICATES"
-msgstr "Aceitar todos os certificados SSL"
-
-msgid "IDS_EMAIL_SK3_ACCOUNT_LIST"
-msgstr "Lista contas"
-
-msgid "IDS_EMAIL_BODY_USER_ID"
-msgstr "ID de utilizador"
-
-msgid "IDS_EMAIL_POP_ACCOUNT_ALREADY_REGISTERED"
-msgstr "Conta já registada"
-
-msgid "IDS_EMAIL_HEADER_ATTACH_FILE"
-msgstr "Anexar ficheiro"
-
-msgid "IDS_EMAIL_BODY_EXCHANGE_SYNC_SETTINGS_MSG"
-msgstr "Ao activar esta aplicação, aceita que parte dos dados do seu dispositivo (o identificador único do dispositivo e o nome do modelo) sejam guardados, processados e utilizados pela Samsung para comunicar a activação desta aplicação aos licenciadores do software. Os dados que estejam na posse da Samsung serão rigorosamente tratados de acordo com a política de privacidade da Samsung que está disponível em www.samsung.com. Continuar?"
-
-msgid "IDS_EMAIL_BODY_FORWARD_WITH_FILES"
-msgstr "Reencam. com ficheiros"
-
-msgid "IDS_EMAIL_BODY_REPLY_WITH_BODY"
-msgstr "Responder com corpo"
-
-msgid "IDS_EMAIL_BODY_NO_SUBJECT"
-msgstr "Sem assunto"
-
-msgid "IDS_EMAIL_BODY_FROM"
-msgstr "De"
-
-msgid "IDS_EMAIL_BODY_NO_ADDRESS"
-msgstr "Nenhum endereço"
-
-msgid "IDS_EMAIL_OPT_RECORD_SOUND"
-msgstr "Gravar som"
-
-msgid "IDS_EMAIL_OPT_RECORD_VIDEO"
-msgstr "Gravar vídeo"
-
-msgid "IDS_EMAIL_OPT_INSERT_IMAGE"
-msgstr "Introduzir imagem"
-
-msgid "IDS_EMAIL_OPT_ADD_TO_CALENDAR"
-msgstr "Adicionar à Agenda"
-
-msgid "IDS_EMAIL_OPT_CHANGE_EMAIL_ADDRESS_ABB"
-msgstr "Alterar endereço de e-mail"
-
-msgid "IDS_EMAIL_OPT_CLIPBOARD"
-msgstr "Área de transferência"
-
-msgid "IDS_EMAIL_OPT_MARKED_AS_UNREAD"
-msgstr "Marcada como não lida"
-
-msgid "IDS_EMAIL_OPT_VIEW_CONTACT_DETAILS"
-msgstr "Ver detalhes de contacto"
-
-msgid "IDS_EMAIL_POP_SAVED_IN_DRAFTS"
-msgstr "Guardado nos Rascunhos"
-
-msgid "IDS_EMAIL_POP_NETWORK_BUSY"
-msgstr "Rede ocupada"
-
-msgid "IDS_EMAIL_POP_LOGIN_ALLOWED_ONLY_EVERY_PD_MINUTES"
-msgstr "Login allowed only every %d minutes"
-
-msgid "IDS_EMAIL_POP_HOST_NOT_FOUND"
-msgstr "Anfitrião não encontrado"
-
-msgid "IDS_EMAIL_POP_HOST_NOT_REACHABLE"
-msgstr "Anfitrião incontactável"
-
-msgid "IDS_EMAIL_POP_NO_SERVICE"
-msgstr "Sem serviço"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_FORWARD_DRM_CONTENTS"
-msgstr "Impossível reencaminhar conteúdos DRM"
-
-msgid "IDS_EMAIL_POP_BLOCKED"
-msgstr "Bloqueado"
-
-msgid "IDS_EMAIL_POP_1_EMAIL_SELECTED"
-msgstr "1 e-mail seleccionado"
-
-msgid "IDS_EMAIL_POP_PD_EMAILS_SELECTED"
-msgstr "%d e-mails seleccionados"
-
-msgid "IDS_EMAIL_POP_1_RECIPIENT_SELECTED"
-msgstr "1 destinatário seleccionado"
-
-msgid "IDS_EMAIL_POP_PD_RECIPIENTS_SELECTED"
-msgstr "%d destinatários seleccionados"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ADD_ACCOUNT"
-msgstr "Impossível adicionar conta"
-
-msgid "IDS_EMAIL_SK3_MOVE_HERE"
-msgstr "Mover para aqui"
-
diff --git a/po/ru_RU.po b/po/ru_RU.po
deleted file mode 100755 (executable)
index f17d76e..0000000
+++ /dev/null
@@ -1,465 +0,0 @@
-msgid "IDS_EMAIL_POP_NO_EMAIL_ADDRESS"
-msgstr "Нет адреса E-mail"
-
-msgid "IDS_EMAIL_BODY_COMPLETE"
-msgstr "Завершено"
-
-msgid "IDS_EMAIL_BODY_ACCEPTED_C_PS"
-msgstr "Принято: %s"
-
-msgid "IDS_EMAIL_BODY_DECLINED_C_PS"
-msgstr "Отклонено: %s"
-
-msgid "IDS_EMAIL_BODY_DOWNLOAD_FULL_MESSAGE"
-msgstr "Загрузить все сообщение"
-
-msgid "IDS_EMAIL_BODY_GENERAL_SETTINGS"
-msgstr "Общие настройки"
-
-msgid "IDS_EMAIL_BODY_TENTATIVE_C_PS"
-msgstr "Под вопросом: %s"
-
-msgid "IDS_EMAIL_BODY_WHEN_C_PS"
-msgstr "Когда: %s"
-
-msgid "IDS_EMAIL_BODY_WHERE_C_PS"
-msgstr "Где: %s"
-
-msgid "IDS_EMAIL_BUTTON_DECLINE_ABB"
-msgstr "Отклонить"
-
-msgid "IDS_EMAIL_BODY_NO_CONTENTS"
-msgstr "Нет содержимого"
-
-msgid "IDS_EMAIL_BODY_ORIGINAL_MESSAGE"
-msgstr "Исходное сообщение"
-
-msgid "IDS_EMAIL_HEADER_ACCOUNT_SETTINGS"
-msgstr "Параметры учетной записи"
-
-msgid "IDS_EMAIL_OPT_BLOCK"
-msgstr "Блокировать"
-
-msgid "IDS_EMAIL_OPT_MARK_AS_READ"
-msgstr "Пометить как прочитанное"
-
-msgid "IDS_EMAIL_OPT_MARK_AS_UNREAD"
-msgstr "Пометить как непрочитанное"
-
-msgid "IDS_EMAIL_OPT_OTHERS"
-msgstr "Прочее"
-
-msgid "IDS_EMAIL_OPT_UNREAD"
-msgstr "Непрочитанные"
-
-msgid "IDS_EMAIL_SK_COMPOSE"
-msgstr "Создать"
-
-msgid "IDS_EMAIL_HEADER_DOWNLOAD_FAILED"
-msgstr "Загрузка невозможна"
-
-msgid "IDS_EMAIL_OPT_ADD_TO_CONTACT"
-msgstr "Добавить к контакту"
-
-msgid "IDS_EMAIL_OPT_VOICE_CALL"
-msgstr "Голосовой вызов"
-
-msgid "IDS_EMAIL_BODY_ACCOUNT_NAME"
-msgstr "Имя учетной записи"
-
-msgid "IDS_EMAIL_BODY_ATTACHMENTS"
-msgstr "Вложения"
-
-msgid "IDS_EMAIL_BODY_FROM_C"
-msgstr "От:"
-
-msgid "IDS_EMAIL_BODY_IMAP4_SERVER"
-msgstr "Сервер IMAP4"
-
-msgid "IDS_EMAIL_BODY_INCLUDES"
-msgstr "Содержит"
-
-msgid "IDS_EMAIL_BODY_INCOMING_PORT"
-msgstr "Порт сервера вх. почты"
-
-msgid "IDS_EMAIL_BODY_INCOMING_SERVER"
-msgstr "Входящий сервер"
-
-msgid "IDS_EMAIL_BODY_IN_PD_MINUTES"
-msgstr "Через %d мин."
-
-msgid "IDS_EMAIL_BODY_KEEP_IN_SERVER"
-msgstr "Хранить копии на сервере"
-
-msgid "IDS_EMAIL_BODY_NO_TEXT"
-msgstr "Нет текста"
-
-msgid "IDS_EMAIL_BODY_OUTGOING_PORT"
-msgstr "Порт сервера исх. почты"
-
-msgid "IDS_EMAIL_BODY_OUTGOING_SERVER"
-msgstr "Исходящий сервер"
-
-msgid "IDS_EMAIL_BODY_PD_EMAILS"
-msgstr "Сообщений электронной почты: %d"
-
-msgid "IDS_EMAIL_BODY_POP3_SERVER"
-msgstr "Сервер POP3"
-
-msgid "IDS_EMAIL_BODY_RECENT"
-msgstr "Последние"
-
-msgid "IDS_EMAIL_BODY_RETRIEVING_OPTIONS"
-msgstr "Параметры приема"
-
-msgid "IDS_EMAIL_BODY_RE_C"
-msgstr "RE:"
-
-msgid "IDS_EMAIL_BODY_SENT_C"
-msgstr "Отправлено:"
-
-msgid "IDS_EMAIL_BODY_SENT_FROM_SAMSUNG_MOBILE"
-msgstr "Отправлено с Samsung Mobile"
-
-msgid "IDS_EMAIL_BODY_USER_PASSWORD"
-msgstr "Пароль пользователя"
-
-msgid "IDS_EMAIL_HEADER_EDIT_RULES"
-msgstr "Изменить правила"
-
-msgid "IDS_EMAIL_HEADER_EMAIL_SETTINGS"
-msgstr "Настройки эл.почты"
-
-msgid "IDS_EMAIL_HEADER_MAILBOXES"
-msgstr "Почтовые ящики"
-
-msgid "IDS_EMAIL_POP_ALERT"
-msgstr "Сигнал"
-
-msgid "IDS_EMAIL_POP_FILE_ALREADY_EXISTS"
-msgstr "Файл уже существует"
-
-msgid "IDS_EMAIL_POP_NO_SENDER"
-msgstr "Отправитель отсутствует"
-
-msgid "IDS_EMAIL_POP_SUCCEEDED"
-msgstr "Успешно"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ATTACH_MAXIMUM_NUMBER_OF_FILES_IS_PD"
-msgstr "Невозможно вложить. Максимальное количество файлов: %d"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ATTACH_MAXIMUM_SIZE_OF_FILES_IS_PD_KB"
-msgstr "Невозможно вложить. Максимальный размер файлов: %d КБ"
-
-msgid "IDS_EMAIL_POP_VALIDATION_FAILED"
-msgstr "Сбой проверки"
-
-msgid "IDS_EMAIL_SK_REPLY_ALL"
-msgstr "Ответить всем"
-
-msgid "IDS_EMAIL_BODY_1_ITEM"
-msgstr "1 элемент"
-
-msgid "IDS_EMAIL_BODY_ADD_MY_NAMECARD"
-msgstr "Добавить мою визитку"
-
-msgid "IDS_EMAIL_BODY_ADD_SIGNATURE"
-msgstr "Добавлять подпись"
-
-msgid "IDS_EMAIL_BODY_ALL_EMAILS"
-msgstr "Все сообщения"
-
-msgid "IDS_EMAIL_BODY_ALWAYS_BCC_MYSELF"
-msgstr "Всегда отправлять себе скрытую копию"
-
-msgid "IDS_EMAIL_BODY_BCC"
-msgstr "СК"
-
-msgid "IDS_EMAIL_BODY_BLOCK_EMAILS"
-msgstr "Блокировка E-mail сообщений"
-
-msgid "IDS_EMAIL_BODY_BODY"
-msgstr "Телосложение"
-
-msgid "IDS_EMAIL_BODY_CC"
-msgstr "Копия"
-
-msgid "IDS_EMAIL_BODY_CC_BCC"
-msgstr "Копия/скрытая копия"
-
-msgid "IDS_EMAIL_BODY_CHECK_INTERVAL"
-msgstr "Интервал проверки"
-
-msgid "IDS_EMAIL_BODY_DEFAULT_ACCOUNT"
-msgstr "Уч. зап. по умолч."
-
-msgid "IDS_EMAIL_BODY_DRAFTS"
-msgstr "Черновики"
-
-msgid "IDS_EMAIL_BODY_EMAIL_ACCOUNTS"
-msgstr "Учетные записи"
-
-msgid "IDS_EMAIL_BODY_END_TIME"
-msgstr "Время окончания"
-
-msgid "IDS_EMAIL_BODY_ENTIRE_EMAIL"
-msgstr "Все сообщения электронной почты"
-
-msgid "IDS_EMAIL_BODY_EXACTLY_THE_SAME_AS"
-msgstr "Точное совпадение"
-
-msgid "IDS_EMAIL_BODY_EXAMPLE"
-msgstr "Пример"
-
-msgid "IDS_EMAIL_BODY_FROM_M_SENDER"
-msgstr "От:"
-
-msgid "IDS_EMAIL_BODY_INBOX"
-msgstr "Входящие"
-
-msgid "IDS_EMAIL_BODY_INCLUDE"
-msgstr "Содержит"
-
-msgid "IDS_EMAIL_BODY_MATCH_CRITERIA"
-msgstr "Условие совпадения"
-
-msgid "IDS_EMAIL_BODY_NOT_USED"
-msgstr "Не используется"
-
-msgid "IDS_EMAIL_BODY_NO_ACCOUNTS"
-msgstr "Нет учетных записей"
-
-msgid "IDS_EMAIL_BODY_PD_DAYS"
-msgstr "%d дней"
-
-msgid "IDS_EMAIL_BODY_PD_ITEMS"
-msgstr "Элементов: %d"
-
-msgid "IDS_EMAIL_BODY_PRIORITY"
-msgstr "Приоритет"
-
-msgid "IDS_EMAIL_BODY_RECEIVING_OPTIONS"
-msgstr "Параметры приема"
-
-msgid "IDS_EMAIL_BODY_SECURE_CONNECTION"
-msgstr "Безопасное соединение"
-
-msgid "IDS_EMAIL_BODY_SENDING_OPTIONS"
-msgstr "Параметры отправки"
-
-msgid "IDS_EMAIL_BODY_SENTBOX"
-msgstr "Отправленные"
-
-msgid "IDS_EMAIL_BODY_SERVER_URL"
-msgstr "URL сервера"
-
-msgid "IDS_EMAIL_BODY_SIGNATURE"
-msgstr "Подпись"
-
-msgid "IDS_EMAIL_BODY_SPAMBOX"
-msgstr "Спам"
-
-msgid "IDS_EMAIL_BODY_START_TIME"
-msgstr "Время начала"
-
-msgid "IDS_EMAIL_BODY_SYNC_SCHEDULE_TMO"
-msgstr "Расписание синхронизации"
-
-msgid "IDS_EMAIL_BODY_TRASH"
-msgstr "Корзина"
-
-msgid "IDS_EMAIL_BODY_WITHOUT_ATTACHMENTS"
-msgstr "Без вложений"
-
-msgid "IDS_EMAIL_BUTTON_GROUP"
-msgstr "Группа"
-
-msgid "IDS_EMAIL_HEADER_ADD_RULES"
-msgstr "Добавить правила"
-
-msgid "IDS_EMAIL_OPT_ATTACH_ITEMS"
-msgstr "Вложить элементы"
-
-msgid "IDS_EMAIL_OPT_EXCHANGE"
-msgstr "Exchange"
-
-msgid "IDS_EMAIL_OPT_FILE"
-msgstr "Файл"
-
-msgid "IDS_EMAIL_OPT_NAMECARD"
-msgstr "Визитка"
-
-msgid "IDS_EMAIL_OPT_OPEN_URL"
-msgstr "Открыть URL"
-
-msgid "IDS_EMAIL_OPT_SENDER"
-msgstr "Отправитель"
-
-msgid "IDS_EMAIL_OPT_SEND_EMAIL"
-msgstr "Отправить E-mail"
-
-msgid "IDS_EMAIL_OPT_UPDATE_EXISTING"
-msgstr "Обновить контакт"
-
-msgid "IDS_EMAIL_POP_ADD_ACCOUNTS"
-msgstr "Добавить учетные записи"
-
-msgid "IDS_EMAIL_POP_DOWNLOADING_ATTACHMENT_ING"
-msgstr "Загрузка вложения..."
-
-msgid "IDS_EMAIL_POP_INVALID_EMAIL_ADDRESS"
-msgstr "Неправильный адрес эл. почты"
-
-msgid "IDS_EMAIL_POP_LOADING_CONTENTS_ING"
-msgstr "Загрузка содержимого..."
-
-msgid "IDS_EMAIL_POP_MAXIMUM_NUMBER_OF_ATTACHMENTS_REACHED"
-msgstr "Достигнуто максимальное число вложений"
-
-msgid "IDS_EMAIL_POP_MOVE_TO_SPAMBOX_Q"
-msgstr "Переместить в папку нежелательной почты?"
-
-msgid "IDS_EMAIL_POP_NO_RECIPIENTS_ADDED_ENTER_RECIPIENTS"
-msgstr "Получатели не введены. Введите получателей"
-
-msgid "IDS_EMAIL_POP_PLEASE_FILL_ALL_THE_MANDATORY_FIELDS"
-msgstr "Заполните все обязательные поля"
-
-msgid "IDS_EMAIL_POP_SAVE_IN_DRAFTS_Q"
-msgstr "Сохранить в черновиках?"
-
-msgid "IDS_EMAIL_POP_THERE_IS_NO_ACCOUNT_CREATE_A_NEW_ACCOUNT_FIRST"
-msgstr "Нет учетной записи. Сначала создайте новую учетную запись"
-
-msgid "IDS_EMAIL_POP_TOO_MANY_RECIPIENTS"
-msgstr "Слишком много получателей"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_DOWNLOAD"
-msgstr "Невозможно выполнить загрузку"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ENTER_TEXT"
-msgstr "Не удается ввести текст"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_LAUNCH_APPLICATION"
-msgstr "Не удается запустить приложение"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_OPEN_ATTACHMENT"
-msgstr "Не удается открыть вложение"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_SAVE_ATTACHMENT"
-msgstr "Не удается сохранить вложение"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_SAVE_IN_DRAFTS"
-msgstr "Не удается сохранить как черновик"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_SEND_EMAIL"
-msgstr "Не удается отправить сообщение электронной почты"
-
-msgid "IDS_EMAIL_POP_UNSUPPORTED_FILE_TYPE"
-msgstr "Неподдерживаемый тип файла"
-
-msgid "IDS_EMAIL_POP_VALIDATING_ACCOUNT_ING"
-msgstr "Проверка учетной записи..."
-
-msgid "IDS_EMAIL_SK_RESEND"
-msgstr "Отправить повторно"
-
-msgid "IDS_EMAIL_BODY_ACCEPT_ALL_SSL_CERTIFICATES"
-msgstr "Принимать все сертификаты SSL"
-
-msgid "IDS_EMAIL_SK3_ACCOUNT_LIST"
-msgstr "Учетные записи"
-
-msgid "IDS_EMAIL_BODY_USER_ID"
-msgstr "Логин"
-
-msgid "IDS_EMAIL_POP_ACCOUNT_ALREADY_REGISTERED"
-msgstr "Учетная запись уже зарегистрирована"
-
-msgid "IDS_EMAIL_HEADER_ATTACH_FILE"
-msgstr "Вложить файл"
-
-msgid "IDS_EMAIL_BODY_EXCHANGE_SYNC_SETTINGS_MSG"
-msgstr "Активируя это приложение, вы соглашаетесь с тем, что часть данных об устройстве (идентификатор и название модели) будет храниться, обрабатываться и использоваться компанией Samsung для отправки отчетов об активации приложения его лицензиарам. Данные, которые хранятся корпорацией Samsung, будут использоваться исключительно в соответствии с политикой конфиденциальности Samsung, опубликованной на сайте www.samsung.com. Продолжить?"
-
-msgid "IDS_EMAIL_BODY_FORWARD_WITH_FILES"
-msgstr "Пересылать с файлами"
-
-msgid "IDS_EMAIL_BODY_REPLY_WITH_BODY"
-msgstr "Текст сообщения при ответе"
-
-msgid "IDS_EMAIL_BODY_NO_SUBJECT"
-msgstr "Нет темы"
-
-msgid "IDS_EMAIL_BODY_FROM"
-msgstr "От"
-
-msgid "IDS_EMAIL_BODY_NO_ADDRESS"
-msgstr "Нет адреса"
-
-msgid "IDS_EMAIL_OPT_RECORD_SOUND"
-msgstr "Записать звук"
-
-msgid "IDS_EMAIL_OPT_RECORD_VIDEO"
-msgstr "Записать видео"
-
-msgid "IDS_EMAIL_OPT_INSERT_IMAGE"
-msgstr "Вставить изображение"
-
-msgid "IDS_EMAIL_OPT_ADD_TO_CALENDAR"
-msgstr "Добавить в календарь"
-
-msgid "IDS_EMAIL_OPT_CHANGE_EMAIL_ADDRESS_ABB"
-msgstr "Изменить электронный адрес"
-
-msgid "IDS_EMAIL_OPT_CLIPBOARD"
-msgstr "Буфер обмена"
-
-msgid "IDS_EMAIL_OPT_MARKED_AS_UNREAD"
-msgstr "Отмечено как непрочитанное"
-
-msgid "IDS_EMAIL_OPT_VIEW_CONTACT_DETAILS"
-msgstr "Сведения о контакте"
-
-msgid "IDS_EMAIL_POP_SAVED_IN_DRAFTS"
-msgstr "Сохранено в Черновики"
-
-msgid "IDS_EMAIL_POP_NETWORK_BUSY"
-msgstr "Сеть занята"
-
-msgid "IDS_EMAIL_POP_LOGIN_ALLOWED_ONLY_EVERY_PD_MINUTES"
-msgstr "Login allowed only every %d minutes"
-
-msgid "IDS_EMAIL_POP_HOST_NOT_FOUND"
-msgstr "Хост не обнаружен"
-
-msgid "IDS_EMAIL_POP_HOST_NOT_REACHABLE"
-msgstr "Хост недоступен"
-
-msgid "IDS_EMAIL_POP_NO_SERVICE"
-msgstr "Нет сети"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_FORWARD_DRM_CONTENTS"
-msgstr "Не удается переслать содержимое DRM"
-
-msgid "IDS_EMAIL_POP_BLOCKED"
-msgstr "Заблокировано"
-
-msgid "IDS_EMAIL_POP_1_EMAIL_SELECTED"
-msgstr "Выбрано 1 сообщение электронной почты"
-
-msgid "IDS_EMAIL_POP_PD_EMAILS_SELECTED"
-msgstr "Выбрано сообщений электронной почты: %d"
-
-msgid "IDS_EMAIL_POP_1_RECIPIENT_SELECTED"
-msgstr "Выбран 1 получатель"
-
-msgid "IDS_EMAIL_POP_PD_RECIPIENTS_SELECTED"
-msgstr "Выбрано получателей: %d"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ADD_ACCOUNT"
-msgstr "Не удается добавить учетную запись"
-
-msgid "IDS_EMAIL_SK3_MOVE_HERE"
-msgstr "Переместить сюда"
-
diff --git a/po/tr_TR.po b/po/tr_TR.po
deleted file mode 100755 (executable)
index eb1e8b3..0000000
+++ /dev/null
@@ -1,465 +0,0 @@
-msgid "IDS_EMAIL_POP_NO_EMAIL_ADDRESS"
-msgstr "E-posta adresi yok"
-
-msgid "IDS_EMAIL_BODY_COMPLETE"
-msgstr "Tamamlandı"
-
-msgid "IDS_EMAIL_BODY_ACCEPTED_C_PS"
-msgstr "Kabul edildi: %s"
-
-msgid "IDS_EMAIL_BODY_DECLINED_C_PS"
-msgstr "Reddedildi: %s"
-
-msgid "IDS_EMAIL_BODY_DOWNLOAD_FULL_MESSAGE"
-msgstr "Tam mesajı indirin"
-
-msgid "IDS_EMAIL_BODY_GENERAL_SETTINGS"
-msgstr "Genel ayarlar"
-
-msgid "IDS_EMAIL_BODY_TENTATIVE_C_PS"
-msgstr "Deneysel: %s"
-
-msgid "IDS_EMAIL_BODY_WHEN_C_PS"
-msgstr "Ne zaman: %s"
-
-msgid "IDS_EMAIL_BODY_WHERE_C_PS"
-msgstr "Yeri: %s"
-
-msgid "IDS_EMAIL_BUTTON_DECLINE_ABB"
-msgstr "Reddetme"
-
-msgid "IDS_EMAIL_BODY_NO_CONTENTS"
-msgstr "İçerik yok"
-
-msgid "IDS_EMAIL_BODY_ORIGINAL_MESSAGE"
-msgstr "Orjinal mesaj"
-
-msgid "IDS_EMAIL_HEADER_ACCOUNT_SETTINGS"
-msgstr "Hesap ayarları"
-
-msgid "IDS_EMAIL_OPT_BLOCK"
-msgstr "Engelle"
-
-msgid "IDS_EMAIL_OPT_MARK_AS_READ"
-msgstr "Okundu olarak işaretle"
-
-msgid "IDS_EMAIL_OPT_MARK_AS_UNREAD"
-msgstr "Okunmadı olarak işaretle"
-
-msgid "IDS_EMAIL_OPT_OTHERS"
-msgstr "Diğerleri"
-
-msgid "IDS_EMAIL_OPT_UNREAD"
-msgstr "Okunmadı"
-
-msgid "IDS_EMAIL_SK_COMPOSE"
-msgstr "Yaz"
-
-msgid "IDS_EMAIL_HEADER_DOWNLOAD_FAILED"
-msgstr "İndirme başarısız"
-
-msgid "IDS_EMAIL_OPT_ADD_TO_CONTACT"
-msgstr "Rehbere ekle"
-
-msgid "IDS_EMAIL_OPT_VOICE_CALL"
-msgstr "Sesli arama"
-
-msgid "IDS_EMAIL_BODY_ACCOUNT_NAME"
-msgstr "Hesap adı"
-
-msgid "IDS_EMAIL_BODY_ATTACHMENTS"
-msgstr "Eklentiler"
-
-msgid "IDS_EMAIL_BODY_FROM_C"
-msgstr "Başlangıç tarihi:"
-
-msgid "IDS_EMAIL_BODY_IMAP4_SERVER"
-msgstr "IMAP4 sunucusu"
-
-msgid "IDS_EMAIL_BODY_INCLUDES"
-msgstr "İçerik"
-
-msgid "IDS_EMAIL_BODY_INCOMING_PORT"
-msgstr "Gelen bağlantı noktası"
-
-msgid "IDS_EMAIL_BODY_INCOMING_SERVER"
-msgstr "Gelen sunucu"
-
-msgid "IDS_EMAIL_BODY_IN_PD_MINUTES"
-msgstr "%d dakika içinde"
-
-msgid "IDS_EMAIL_BODY_KEEP_IN_SERVER"
-msgstr "Sunucuda sakla"
-
-msgid "IDS_EMAIL_BODY_NO_TEXT"
-msgstr "Metin yok"
-
-msgid "IDS_EMAIL_BODY_OUTGOING_PORT"
-msgstr "Giden bağlantı noktası"
-
-msgid "IDS_EMAIL_BODY_OUTGOING_SERVER"
-msgstr "Giden sunucu"
-
-msgid "IDS_EMAIL_BODY_PD_EMAILS"
-msgstr "%d e-posta"
-
-msgid "IDS_EMAIL_BODY_POP3_SERVER"
-msgstr "POP3 sunucusu"
-
-msgid "IDS_EMAIL_BODY_RECENT"
-msgstr "Yakın"
-
-msgid "IDS_EMAIL_BODY_RETRIEVING_OPTIONS"
-msgstr "Alma seçenekleri"
-
-msgid "IDS_EMAIL_BODY_RE_C"
-msgstr "YNT:"
-
-msgid "IDS_EMAIL_BODY_SENT_C"
-msgstr "Gönderildi:"
-
-msgid "IDS_EMAIL_BODY_SENT_FROM_SAMSUNG_MOBILE"
-msgstr "Samsung Mobile tarafından gönderildi"
-
-msgid "IDS_EMAIL_BODY_USER_PASSWORD"
-msgstr "Kullanıcı şifresi"
-
-msgid "IDS_EMAIL_HEADER_EDIT_RULES"
-msgstr "Kuralları düzenle"
-
-msgid "IDS_EMAIL_HEADER_EMAIL_SETTINGS"
-msgstr "E-Posta ayarları"
-
-msgid "IDS_EMAIL_HEADER_MAILBOXES"
-msgstr "Posta kutuları"
-
-msgid "IDS_EMAIL_POP_ALERT"
-msgstr "Uyarı"
-
-msgid "IDS_EMAIL_POP_FILE_ALREADY_EXISTS"
-msgstr "Dosya zaten var"
-
-msgid "IDS_EMAIL_POP_NO_SENDER"
-msgstr "Gönderici yok"
-
-msgid "IDS_EMAIL_POP_SUCCEEDED"
-msgstr "Başarılı"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ATTACH_MAXIMUM_NUMBER_OF_FILES_IS_PD"
-msgstr "Eklenemiyor. Maksimum dosya sayısı %d"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ATTACH_MAXIMUM_SIZE_OF_FILES_IS_PD_KB"
-msgstr "Eklenemiyor. Maksimum dosya boyutu %d KB"
-
-msgid "IDS_EMAIL_POP_VALIDATION_FAILED"
-msgstr "Onaylama başarısız"
-
-msgid "IDS_EMAIL_SK_REPLY_ALL"
-msgstr "Tümünü yanıtla"
-
-msgid "IDS_EMAIL_BODY_1_ITEM"
-msgstr "1 öğe"
-
-msgid "IDS_EMAIL_BODY_ADD_MY_NAMECARD"
-msgstr "Kartvizitimi ekle"
-
-msgid "IDS_EMAIL_BODY_ADD_SIGNATURE"
-msgstr "İmza ekle"
-
-msgid "IDS_EMAIL_BODY_ALL_EMAILS"
-msgstr "Tüm e-postalar"
-
-msgid "IDS_EMAIL_BODY_ALWAYS_BCC_MYSELF"
-msgstr "Kendimi her zaman Bcc’ye ekle"
-
-msgid "IDS_EMAIL_BODY_BCC"
-msgstr "Gizli"
-
-msgid "IDS_EMAIL_BODY_BLOCK_EMAILS"
-msgstr "E-postaları engelle"
-
-msgid "IDS_EMAIL_BODY_BODY"
-msgstr "Gövde"
-
-msgid "IDS_EMAIL_BODY_CC"
-msgstr "Bilgi"
-
-msgid "IDS_EMAIL_BODY_CC_BCC"
-msgstr "Cc/Bcc"
-
-msgid "IDS_EMAIL_BODY_CHECK_INTERVAL"
-msgstr "Aralığı denetle"
-
-msgid "IDS_EMAIL_BODY_DEFAULT_ACCOUNT"
-msgstr "Varsayılan hesap"
-
-msgid "IDS_EMAIL_BODY_DRAFTS"
-msgstr "Taslaklar"
-
-msgid "IDS_EMAIL_BODY_EMAIL_ACCOUNTS"
-msgstr "E-posta hesapları"
-
-msgid "IDS_EMAIL_BODY_END_TIME"
-msgstr "Bitiş saati"
-
-msgid "IDS_EMAIL_BODY_ENTIRE_EMAIL"
-msgstr "Bütün e-posta"
-
-msgid "IDS_EMAIL_BODY_EXACTLY_THE_SAME_AS"
-msgstr "Aynısı"
-
-msgid "IDS_EMAIL_BODY_EXAMPLE"
-msgstr "Örnek"
-
-msgid "IDS_EMAIL_BODY_FROM_M_SENDER"
-msgstr "Kimden:"
-
-msgid "IDS_EMAIL_BODY_INBOX"
-msgstr "Gelen kutusu"
-
-msgid "IDS_EMAIL_BODY_INCLUDE"
-msgstr "Dahil et"
-
-msgid "IDS_EMAIL_BODY_MATCH_CRITERIA"
-msgstr "Eşleşme kriterleri"
-
-msgid "IDS_EMAIL_BODY_NOT_USED"
-msgstr "Kullanılmıyor"
-
-msgid "IDS_EMAIL_BODY_NO_ACCOUNTS"
-msgstr "Hesap yok"
-
-msgid "IDS_EMAIL_BODY_PD_DAYS"
-msgstr "%d gün"
-
-msgid "IDS_EMAIL_BODY_PD_ITEMS"
-msgstr "%d öğe"
-
-msgid "IDS_EMAIL_BODY_PRIORITY"
-msgstr "Öncelik"
-
-msgid "IDS_EMAIL_BODY_RECEIVING_OPTIONS"
-msgstr "Alma seçenekleri"
-
-msgid "IDS_EMAIL_BODY_SECURE_CONNECTION"
-msgstr "Güvenli bağlantı"
-
-msgid "IDS_EMAIL_BODY_SENDING_OPTIONS"
-msgstr "Gönderme seçenekleri"
-
-msgid "IDS_EMAIL_BODY_SENTBOX"
-msgstr "Gönderilenler kutusu"
-
-msgid "IDS_EMAIL_BODY_SERVER_URL"
-msgstr "Sunucu Url'si"
-
-msgid "IDS_EMAIL_BODY_SIGNATURE"
-msgstr "İmza"
-
-msgid "IDS_EMAIL_BODY_SPAMBOX"
-msgstr "Spam kutusu"
-
-msgid "IDS_EMAIL_BODY_START_TIME"
-msgstr "Başlangıç saati"
-
-msgid "IDS_EMAIL_BODY_SYNC_SCHEDULE_TMO"
-msgstr "Program senkronizasyonu"
-
-msgid "IDS_EMAIL_BODY_TRASH"
-msgstr "Çöp kutusu"
-
-msgid "IDS_EMAIL_BODY_WITHOUT_ATTACHMENTS"
-msgstr "Ekler olmadan"
-
-msgid "IDS_EMAIL_BUTTON_GROUP"
-msgstr "Grup"
-
-msgid "IDS_EMAIL_HEADER_ADD_RULES"
-msgstr "Kural ekle"
-
-msgid "IDS_EMAIL_OPT_ATTACH_ITEMS"
-msgstr "Dosya ekle"
-
-msgid "IDS_EMAIL_OPT_EXCHANGE"
-msgstr "Değişim"
-
-msgid "IDS_EMAIL_OPT_FILE"
-msgstr "Dosya"
-
-msgid "IDS_EMAIL_OPT_NAMECARD"
-msgstr "Kartvizit"
-
-msgid "IDS_EMAIL_OPT_OPEN_URL"
-msgstr "URL'yi aç"
-
-msgid "IDS_EMAIL_OPT_SENDER"
-msgstr "Gönderen"
-
-msgid "IDS_EMAIL_OPT_SEND_EMAIL"
-msgstr "E-posta gönder"
-
-msgid "IDS_EMAIL_OPT_UPDATE_EXISTING"
-msgstr "Mevcut kişiyi güncelle"
-
-msgid "IDS_EMAIL_POP_ADD_ACCOUNTS"
-msgstr "Hesapları ekle"
-
-msgid "IDS_EMAIL_POP_DOWNLOADING_ATTACHMENT_ING"
-msgstr "Ek indiriliyor..."
-
-msgid "IDS_EMAIL_POP_INVALID_EMAIL_ADDRESS"
-msgstr "Geçersiz e-posta adresi"
-
-msgid "IDS_EMAIL_POP_LOADING_CONTENTS_ING"
-msgstr "İçerik yükleniyor..."
-
-msgid "IDS_EMAIL_POP_MAXIMUM_NUMBER_OF_ATTACHMENTS_REACHED"
-msgstr "Maksimum ek sayısına ulaşıldı"
-
-msgid "IDS_EMAIL_POP_MOVE_TO_SPAMBOX_Q"
-msgstr "Spam kutusuna taşınsın mı?"
-
-msgid "IDS_EMAIL_POP_NO_RECIPIENTS_ADDED_ENTER_RECIPIENTS"
-msgstr "Alıcı eklenemedi. Alıcı girin"
-
-msgid "IDS_EMAIL_POP_PLEASE_FILL_ALL_THE_MANDATORY_FIELDS"
-msgstr "Lütfen tüm zorunlu alanları doldurun"
-
-msgid "IDS_EMAIL_POP_SAVE_IN_DRAFTS_Q"
-msgstr "Taslaklara kaydedilsin mi?"
-
-msgid "IDS_EMAIL_POP_THERE_IS_NO_ACCOUNT_CREATE_A_NEW_ACCOUNT_FIRST"
-msgstr "Hesap yok. Önce yeni bir hesap oluşturun"
-
-msgid "IDS_EMAIL_POP_TOO_MANY_RECIPIENTS"
-msgstr "Çok fazla alıcı"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_DOWNLOAD"
-msgstr "İndirilemiyor"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ENTER_TEXT"
-msgstr "Metin girilemiyor"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_LAUNCH_APPLICATION"
-msgstr "Uygulama başlatılamıyor"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_OPEN_ATTACHMENT"
-msgstr "Ek açılamıyor"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_SAVE_ATTACHMENT"
-msgstr "Ek kaydedilemiyor"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_SAVE_IN_DRAFTS"
-msgstr "Taslaklara kaydedilemiyor"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_SEND_EMAIL"
-msgstr "E-posta gönderilemiyor"
-
-msgid "IDS_EMAIL_POP_UNSUPPORTED_FILE_TYPE"
-msgstr "Desteklenmeyen dosya türü"
-
-msgid "IDS_EMAIL_POP_VALIDATING_ACCOUNT_ING"
-msgstr "Hesap doğrulanıyor..."
-
-msgid "IDS_EMAIL_SK_RESEND"
-msgstr "Tekrar Gönder"
-
-msgid "IDS_EMAIL_BODY_ACCEPT_ALL_SSL_CERTIFICATES"
-msgstr "Tüm SSL sertifikalarını kabul edin"
-
-msgid "IDS_EMAIL_SK3_ACCOUNT_LIST"
-msgstr "Hesap listesi"
-
-msgid "IDS_EMAIL_BODY_USER_ID"
-msgstr "Kullanıcı kimliği"
-
-msgid "IDS_EMAIL_POP_ACCOUNT_ALREADY_REGISTERED"
-msgstr "Hesap zaten kaydedilmiş"
-
-msgid "IDS_EMAIL_HEADER_ATTACH_FILE"
-msgstr "Dosya ekle"
-
-msgid "IDS_EMAIL_BODY_EXCHANGE_SYNC_SETTINGS_MSG"
-msgstr "Bu uygulamayı etkinleştirerek bu uygulama aktivasyonunun lisans sahiplerine bildirilmesi amacıyla cihaz bilgilerinizin bir kısmının (eşsiz cihaz tanımlayıcı ve model adı) Samsung tarafından saklanacağını, işleneceğini ve kullanılacağını kabul etmiş oluyorsunuz. Samsung tarafından tutulan bilgiler Samsung’un gizlilik politikası uyarınca muhafaza edilen gizlilik politikasının kopyası, isteğe bağlı olarak www.samsung.com'da bulunabilir. Devam edilsin mi?"
-
-msgid "IDS_EMAIL_BODY_FORWARD_WITH_FILES"
-msgstr "Dosyalar ile ilet"
-
-msgid "IDS_EMAIL_BODY_REPLY_WITH_BODY"
-msgstr "Gövde ile yanıtla"
-
-msgid "IDS_EMAIL_BODY_NO_SUBJECT"
-msgstr "Konu yok"
-
-msgid "IDS_EMAIL_BODY_FROM"
-msgstr "Kimden"
-
-msgid "IDS_EMAIL_BODY_NO_ADDRESS"
-msgstr "Adres yok"
-
-msgid "IDS_EMAIL_OPT_RECORD_SOUND"
-msgstr "Ses kaydet"
-
-msgid "IDS_EMAIL_OPT_RECORD_VIDEO"
-msgstr "Video kaydet"
-
-msgid "IDS_EMAIL_OPT_INSERT_IMAGE"
-msgstr "Resim ekle"
-
-msgid "IDS_EMAIL_OPT_ADD_TO_CALENDAR"
-msgstr "Takvime Ekle"
-
-msgid "IDS_EMAIL_OPT_CHANGE_EMAIL_ADDRESS_ABB"
-msgstr "E-posta adresini değiştir"
-
-msgid "IDS_EMAIL_OPT_CLIPBOARD"
-msgstr "Pano"
-
-msgid "IDS_EMAIL_OPT_MARKED_AS_UNREAD"
-msgstr "Okunmadı olarak işaretlendi"
-
-msgid "IDS_EMAIL_OPT_VIEW_CONTACT_DETAILS"
-msgstr "Kişi detaylarını göster"
-
-msgid "IDS_EMAIL_POP_SAVED_IN_DRAFTS"
-msgstr "Taslaklara kaydedildi"
-
-msgid "IDS_EMAIL_POP_NETWORK_BUSY"
-msgstr "Şebeke meşgul"
-
-msgid "IDS_EMAIL_POP_LOGIN_ALLOWED_ONLY_EVERY_PD_MINUTES"
-msgstr "Login allowed only every %d minutes"
-
-msgid "IDS_EMAIL_POP_HOST_NOT_FOUND"
-msgstr "Ana makine bulunamadı"
-
-msgid "IDS_EMAIL_POP_HOST_NOT_REACHABLE"
-msgstr "Ana makine ulaşılamaz"
-
-msgid "IDS_EMAIL_POP_NO_SERVICE"
-msgstr "Servis yok"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_FORWARD_DRM_CONTENTS"
-msgstr "DRM içerikleri iletilemiyor"
-
-msgid "IDS_EMAIL_POP_BLOCKED"
-msgstr "Engellendi"
-
-msgid "IDS_EMAIL_POP_1_EMAIL_SELECTED"
-msgstr "1 e-posta seçildi"
-
-msgid "IDS_EMAIL_POP_PD_EMAILS_SELECTED"
-msgstr "%d e-posta seçildi"
-
-msgid "IDS_EMAIL_POP_1_RECIPIENT_SELECTED"
-msgstr "1 alıcı seçildi"
-
-msgid "IDS_EMAIL_POP_PD_RECIPIENTS_SELECTED"
-msgstr "%d alıcı seçildi"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ADD_ACCOUNT"
-msgstr "Hesaba eklenemiyor"
-
-msgid "IDS_EMAIL_SK3_MOVE_HERE"
-msgstr "Buraya taşı"
-
diff --git a/po/update-po.sh b/po/update-po.sh
deleted file mode 100755 (executable)
index 665dd9e..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/bin/sh
-
-PACKAGE=email
-SRCROOT=..
-POTFILES=POTFILES.in
-
-#ALL_LINGUAS= "am az be ca cs da de el en_CA en_GB en_US es et fi fr hr hu it ja ko lv mk ml ms nb ne nl pa pl pt pt_BR ru rw sk sl sr sr@Latn sv ta tr uk vi zh_CN zh_TW ko_KR"
-#ALL_LINGUAS="en_US en_GB ja ko zh_CN"
-#ALL_LINGUAS="en_US"
-
-XGETTEXT=/usr/bin/xgettext
-MSGMERGE=/usr/bin/msgmerge
-
-echo -n "Make ${PACKAGE}.pot"
-if [ ! -e $POTFILES ] ; then
-       echo "$POTFILES not found"
-       exit 1
-fi
-
-$XGETTEXT --default-domain=${PACKAGE} --directory=${SRCROOT} \
-               --add-comments --keyword=_ --keyword=N_ --files-from=$POTFILES \
-&& test ! -f ${PACKAGE}.po \
-       || (rm -f ${PACKAGE}.pot && mv ${PACKAGE}.po ${PACKAGE}.pot)
-
-if [ $? -ne 0 ]; then
-       echo "error"
-       exit 1
-else
-       echo "done"
-fi
-
-for LANG in $ALL_LINGUAS; do 
-       echo "$LANG : "
-
-       if [ ! -e $LANG.po ] ; then
-               sed 's/CHARSET/UTF-8/g' ${PACKAGE}.pot > ${LANG}.po
-               echo "${LANG}.po created"
-       else
-               if $MSGMERGE ${LANG}.po ${PACKAGE}.pot -o ${LANG}.new.po ; then
-                       if cmp ${LANG}.po ${LANG}.new.po > /dev/null 2>&1; then
-                               rm -f ${LANG}.new.po
-                       else
-                               if mv -f ${LANG}.new.po ${LANG}.po; then
-                                       echo "" 
-                               else
-                                       echo "msgmerge for $LANG.po failed: cannot move $LANG.new.po to $LANG.po" 1>&2
-                                       rm -f ${LANG}.new.po
-                                       exit 1
-                               fi
-                       fi
-               else
-                       echo "msgmerge for $LANG failed!"
-                       rm -f ${LANG}.new.po
-               fi
-       fi
-       echo ""
-done
-
diff --git a/po/zh_CN.po b/po/zh_CN.po
deleted file mode 100755 (executable)
index 2a43cfb..0000000
+++ /dev/null
@@ -1,465 +0,0 @@
-msgid "IDS_EMAIL_POP_NO_EMAIL_ADDRESS"
-msgstr "没有电邮地址"
-
-msgid "IDS_EMAIL_BODY_COMPLETE"
-msgstr "完成"
-
-msgid "IDS_EMAIL_BODY_ACCEPTED_C_PS"
-msgstr "已接收:%s"
-
-msgid "IDS_EMAIL_BODY_DECLINED_C_PS"
-msgstr "已取消:%s"
-
-msgid "IDS_EMAIL_BODY_DOWNLOAD_FULL_MESSAGE"
-msgstr "下载完整信息"
-
-msgid "IDS_EMAIL_BODY_GENERAL_SETTINGS"
-msgstr "基本设置"
-
-msgid "IDS_EMAIL_BODY_TENTATIVE_C_PS"
-msgstr "测试:%s"
-
-msgid "IDS_EMAIL_BODY_WHEN_C_PS"
-msgstr "时间:%s"
-
-msgid "IDS_EMAIL_BODY_WHERE_C_PS"
-msgstr "地点:%s"
-
-msgid "IDS_EMAIL_BUTTON_DECLINE_ABB"
-msgstr "拒绝"
-
-msgid "IDS_EMAIL_BODY_NO_CONTENTS"
-msgstr "无内容"
-
-msgid "IDS_EMAIL_BODY_ORIGINAL_MESSAGE"
-msgstr "原始信息"
-
-msgid "IDS_EMAIL_HEADER_ACCOUNT_SETTINGS"
-msgstr "帐户设置"
-
-msgid "IDS_EMAIL_OPT_BLOCK"
-msgstr "阻止"
-
-msgid "IDS_EMAIL_OPT_MARK_AS_READ"
-msgstr "记为已读"
-
-msgid "IDS_EMAIL_OPT_MARK_AS_UNREAD"
-msgstr "记为未读"
-
-msgid "IDS_EMAIL_OPT_OTHERS"
-msgstr "其它"
-
-msgid "IDS_EMAIL_OPT_UNREAD"
-msgstr "未读"
-
-msgid "IDS_EMAIL_SK_COMPOSE"
-msgstr "编写"
-
-msgid "IDS_EMAIL_HEADER_DOWNLOAD_FAILED"
-msgstr "不能下载"
-
-msgid "IDS_EMAIL_OPT_ADD_TO_CONTACT"
-msgstr "添加到联系人"
-
-msgid "IDS_EMAIL_OPT_VOICE_CALL"
-msgstr "语音通话"
-
-msgid "IDS_EMAIL_BODY_ACCOUNT_NAME"
-msgstr "帐户名称"
-
-msgid "IDS_EMAIL_BODY_ATTACHMENTS"
-msgstr "附件"
-
-msgid "IDS_EMAIL_BODY_FROM_C"
-msgstr "由:"
-
-msgid "IDS_EMAIL_BODY_IMAP4_SERVER"
-msgstr "IMAP4 服务器"
-
-msgid "IDS_EMAIL_BODY_INCLUDES"
-msgstr "包括"
-
-msgid "IDS_EMAIL_BODY_INCOMING_PORT"
-msgstr "接收端口"
-
-msgid "IDS_EMAIL_BODY_INCOMING_SERVER"
-msgstr "接收服务器"
-
-msgid "IDS_EMAIL_BODY_IN_PD_MINUTES"
-msgstr "在%d分钟内"
-
-msgid "IDS_EMAIL_BODY_KEEP_IN_SERVER"
-msgstr "保存在服务器中"
-
-msgid "IDS_EMAIL_BODY_NO_TEXT"
-msgstr "无文本"
-
-msgid "IDS_EMAIL_BODY_OUTGOING_PORT"
-msgstr "呼出端口"
-
-msgid "IDS_EMAIL_BODY_OUTGOING_SERVER"
-msgstr "发送服务器"
-
-msgid "IDS_EMAIL_BODY_PD_EMAILS"
-msgstr "%d电子邮件"
-
-msgid "IDS_EMAIL_BODY_POP3_SERVER"
-msgstr "POP3 服务器"
-
-msgid "IDS_EMAIL_BODY_RECENT"
-msgstr "最近"
-
-msgid "IDS_EMAIL_BODY_RETRIEVING_OPTIONS"
-msgstr "取回选项"
-
-msgid "IDS_EMAIL_BODY_RE_C"
-msgstr "回复:"
-
-msgid "IDS_EMAIL_BODY_SENT_C"
-msgstr "已发送:"
-
-msgid "IDS_EMAIL_BODY_SENT_FROM_SAMSUNG_MOBILE"
-msgstr "已从三星手机发送"
-
-msgid "IDS_EMAIL_BODY_USER_PASSWORD"
-msgstr "用户密码"
-
-msgid "IDS_EMAIL_HEADER_EDIT_RULES"
-msgstr "编辑规则"
-
-msgid "IDS_EMAIL_HEADER_EMAIL_SETTINGS"
-msgstr "电邮设置"
-
-msgid "IDS_EMAIL_HEADER_MAILBOXES"
-msgstr "邮箱"
-
-msgid "IDS_EMAIL_POP_ALERT"
-msgstr "提示音"
-
-msgid "IDS_EMAIL_POP_FILE_ALREADY_EXISTS"
-msgstr "文件已存在"
-
-msgid "IDS_EMAIL_POP_NO_SENDER"
-msgstr "无发件人"
-
-msgid "IDS_EMAIL_POP_SUCCEEDED"
-msgstr "成功"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ATTACH_MAXIMUM_NUMBER_OF_FILES_IS_PD"
-msgstr "无法附加。最大文件数量是 %d"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ATTACH_MAXIMUM_SIZE_OF_FILES_IS_PD_KB"
-msgstr "无法附加。最大文件大小是 %d KB"
-
-msgid "IDS_EMAIL_POP_VALIDATION_FAILED"
-msgstr "确认失败"
-
-msgid "IDS_EMAIL_SK_REPLY_ALL"
-msgstr "回复全部"
-
-msgid "IDS_EMAIL_BODY_1_ITEM"
-msgstr "1个"
-
-msgid "IDS_EMAIL_BODY_ADD_MY_NAMECARD"
-msgstr "添加我的名片"
-
-msgid "IDS_EMAIL_BODY_ADD_SIGNATURE"
-msgstr "添加签名"
-
-msgid "IDS_EMAIL_BODY_ALL_EMAILS"
-msgstr "全部电邮"
-
-msgid "IDS_EMAIL_BODY_ALWAYS_BCC_MYSELF"
-msgstr "总是密送给自己"
-
-msgid "IDS_EMAIL_BODY_BCC"
-msgstr "暗送"
-
-msgid "IDS_EMAIL_BODY_BLOCK_EMAILS"
-msgstr "阻止电子邮件"
-
-msgid "IDS_EMAIL_BODY_BODY"
-msgstr "正文"
-
-msgid "IDS_EMAIL_BODY_CC"
-msgstr "抄送"
-
-msgid "IDS_EMAIL_BODY_CC_BCC"
-msgstr "抄送/密送"
-
-msgid "IDS_EMAIL_BODY_CHECK_INTERVAL"
-msgstr "检查时间间隔"
-
-msgid "IDS_EMAIL_BODY_DEFAULT_ACCOUNT"
-msgstr "预置帐户"
-
-msgid "IDS_EMAIL_BODY_DRAFTS"
-msgstr "草稿箱"
-
-msgid "IDS_EMAIL_BODY_EMAIL_ACCOUNTS"
-msgstr "电子邮件帐户"
-
-msgid "IDS_EMAIL_BODY_END_TIME"
-msgstr "结束时间"
-
-msgid "IDS_EMAIL_BODY_ENTIRE_EMAIL"
-msgstr "完整电子邮件"
-
-msgid "IDS_EMAIL_BODY_EXACTLY_THE_SAME_AS"
-msgstr "完全一样"
-
-msgid "IDS_EMAIL_BODY_EXAMPLE"
-msgstr "举例"
-
-msgid "IDS_EMAIL_BODY_FROM_M_SENDER"
-msgstr "从:"
-
-msgid "IDS_EMAIL_BODY_INBOX"
-msgstr "收件箱"
-
-msgid "IDS_EMAIL_BODY_INCLUDE"
-msgstr "包括"
-
-msgid "IDS_EMAIL_BODY_MATCH_CRITERIA"
-msgstr "匹配标准"
-
-msgid "IDS_EMAIL_BODY_NOT_USED"
-msgstr "未使用"
-
-msgid "IDS_EMAIL_BODY_NO_ACCOUNTS"
-msgstr "没有帐户"
-
-msgid "IDS_EMAIL_BODY_PD_DAYS"
-msgstr "%d 天"
-
-msgid "IDS_EMAIL_BODY_PD_ITEMS"
-msgstr "%d个"
-
-msgid "IDS_EMAIL_BODY_PRIORITY"
-msgstr "优先级"
-
-msgid "IDS_EMAIL_BODY_RECEIVING_OPTIONS"
-msgstr "接收选项"
-
-msgid "IDS_EMAIL_BODY_SECURE_CONNECTION"
-msgstr "安全连接"
-
-msgid "IDS_EMAIL_BODY_SENDING_OPTIONS"
-msgstr "发送选项"
-
-msgid "IDS_EMAIL_BODY_SENTBOX"
-msgstr "已发件箱"
-
-msgid "IDS_EMAIL_BODY_SERVER_URL"
-msgstr "服务器网址"
-
-msgid "IDS_EMAIL_BODY_SIGNATURE"
-msgstr "签名"
-
-msgid "IDS_EMAIL_BODY_SPAMBOX"
-msgstr "垃圾箱"
-
-msgid "IDS_EMAIL_BODY_START_TIME"
-msgstr "开始时间"
-
-msgid "IDS_EMAIL_BODY_SYNC_SCHEDULE_TMO"
-msgstr "同步计划"
-
-msgid "IDS_EMAIL_BODY_TRASH"
-msgstr "垃圾"
-
-msgid "IDS_EMAIL_BODY_WITHOUT_ATTACHMENTS"
-msgstr "不含附件"
-
-msgid "IDS_EMAIL_BUTTON_GROUP"
-msgstr "分组"
-
-msgid "IDS_EMAIL_HEADER_ADD_RULES"
-msgstr "添加规则"
-
-msgid "IDS_EMAIL_OPT_ATTACH_ITEMS"
-msgstr "附加项目"
-
-msgid "IDS_EMAIL_OPT_EXCHANGE"
-msgstr "更换"
-
-msgid "IDS_EMAIL_OPT_FILE"
-msgstr "文件"
-
-msgid "IDS_EMAIL_OPT_NAMECARD"
-msgstr "联系人"
-
-msgid "IDS_EMAIL_OPT_OPEN_URL"
-msgstr "打开网址"
-
-msgid "IDS_EMAIL_OPT_SENDER"
-msgstr "发件人"
-
-msgid "IDS_EMAIL_OPT_SEND_EMAIL"
-msgstr "发送邮件"
-
-msgid "IDS_EMAIL_OPT_UPDATE_EXISTING"
-msgstr "更新现存"
-
-msgid "IDS_EMAIL_POP_ADD_ACCOUNTS"
-msgstr "添加帐户"
-
-msgid "IDS_EMAIL_POP_DOWNLOADING_ATTACHMENT_ING"
-msgstr "正在下载附件…"
-
-msgid "IDS_EMAIL_POP_INVALID_EMAIL_ADDRESS"
-msgstr "电子邮件地址无效"
-
-msgid "IDS_EMAIL_POP_LOADING_CONTENTS_ING"
-msgstr "正在加载内容…"
-
-msgid "IDS_EMAIL_POP_MAXIMUM_NUMBER_OF_ATTACHMENTS_REACHED"
-msgstr "已达附件最大数量"
-
-msgid "IDS_EMAIL_POP_MOVE_TO_SPAMBOX_Q"
-msgstr "移动到垃圾箱?"
-
-msgid "IDS_EMAIL_POP_NO_RECIPIENTS_ADDED_ENTER_RECIPIENTS"
-msgstr "没有添加收件人,请输入联系人"
-
-msgid "IDS_EMAIL_POP_PLEASE_FILL_ALL_THE_MANDATORY_FIELDS"
-msgstr "请填写所有必填字段"
-
-msgid "IDS_EMAIL_POP_SAVE_IN_DRAFTS_Q"
-msgstr "保存到草稿箱?"
-
-msgid "IDS_EMAIL_POP_THERE_IS_NO_ACCOUNT_CREATE_A_NEW_ACCOUNT_FIRST"
-msgstr "没有帐户。 请先创建新帐户"
-
-msgid "IDS_EMAIL_POP_TOO_MANY_RECIPIENTS"
-msgstr "太多接收人"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_DOWNLOAD"
-msgstr "无法下载"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ENTER_TEXT"
-msgstr "无法输入文本"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_LAUNCH_APPLICATION"
-msgstr "无法启动应用程序"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_OPEN_ATTACHMENT"
-msgstr "无法打开附件"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_SAVE_ATTACHMENT"
-msgstr "无法保存附件"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_SAVE_IN_DRAFTS"
-msgstr "无法保存到草稿箱"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_SEND_EMAIL"
-msgstr "无法发送电子邮件"
-
-msgid "IDS_EMAIL_POP_UNSUPPORTED_FILE_TYPE"
-msgstr "不支持的文件类型"
-
-msgid "IDS_EMAIL_POP_VALIDATING_ACCOUNT_ING"
-msgstr "帐户确认中…"
-
-msgid "IDS_EMAIL_SK_RESEND"
-msgstr "重新发送"
-
-msgid "IDS_EMAIL_BODY_ACCEPT_ALL_SSL_CERTIFICATES"
-msgstr "接受全部SSL证书"
-
-msgid "IDS_EMAIL_SK3_ACCOUNT_LIST"
-msgstr "帐户列表"
-
-msgid "IDS_EMAIL_BODY_USER_ID"
-msgstr "用户ID"
-
-msgid "IDS_EMAIL_POP_ACCOUNT_ALREADY_REGISTERED"
-msgstr "已注册帐户"
-
-msgid "IDS_EMAIL_HEADER_ATTACH_FILE"
-msgstr "附加文件"
-
-msgid "IDS_EMAIL_BODY_EXCHANGE_SYNC_SETTINGS_MSG"
-msgstr "激活此应用程序,表示您接受三星保存、处理和使用您的部分设备数据(唯一设备标识符和机型名称),用于向应用程序软件授权方报告应用程序激活情况。三星将严格根据三星隐私政策处理数据,三星隐私政策提供于 www.samsung.com。是否继续?"
-
-msgid "IDS_EMAIL_BODY_FORWARD_WITH_FILES"
-msgstr "转发附件"
-
-msgid "IDS_EMAIL_BODY_REPLY_WITH_BODY"
-msgstr "回复包括正文"
-
-msgid "IDS_EMAIL_BODY_NO_SUBJECT"
-msgstr "没有主题"
-
-msgid "IDS_EMAIL_BODY_FROM"
-msgstr "发件人"
-
-msgid "IDS_EMAIL_BODY_NO_ADDRESS"
-msgstr "无地址"
-
-msgid "IDS_EMAIL_OPT_RECORD_SOUND"
-msgstr "录音"
-
-msgid "IDS_EMAIL_OPT_RECORD_VIDEO"
-msgstr "拍摄录像"
-
-msgid "IDS_EMAIL_OPT_INSERT_IMAGE"
-msgstr "插入图像"
-
-msgid "IDS_EMAIL_OPT_ADD_TO_CALENDAR"
-msgstr "添加至日历"
-
-msgid "IDS_EMAIL_OPT_CHANGE_EMAIL_ADDRESS_ABB"
-msgstr "更改电子邮件地址"
-
-msgid "IDS_EMAIL_OPT_CLIPBOARD"
-msgstr "剪贴板"
-
-msgid "IDS_EMAIL_OPT_MARKED_AS_UNREAD"
-msgstr "已标记为未读"
-
-msgid "IDS_EMAIL_OPT_VIEW_CONTACT_DETAILS"
-msgstr "查看联系人详细信息"
-
-msgid "IDS_EMAIL_POP_SAVED_IN_DRAFTS"
-msgstr "已保存到草稿箱"
-
-msgid "IDS_EMAIL_POP_NETWORK_BUSY"
-msgstr "网络繁忙"
-
-msgid "IDS_EMAIL_POP_LOGIN_ALLOWED_ONLY_EVERY_PD_MINUTES"
-msgstr "仅允许每%d分钟登录一次"
-
-msgid "IDS_EMAIL_POP_HOST_NOT_FOUND"
-msgstr "未找到主机"
-
-msgid "IDS_EMAIL_POP_HOST_NOT_REACHABLE"
-msgstr "无法访问主机"
-
-msgid "IDS_EMAIL_POP_NO_SERVICE"
-msgstr "无服务"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_FORWARD_DRM_CONTENTS"
-msgstr "无法转发DRM内容"
-
-msgid "IDS_EMAIL_POP_BLOCKED"
-msgstr "已阻止"
-
-msgid "IDS_EMAIL_POP_1_EMAIL_SELECTED"
-msgstr "已选中 1 封电子邮件"
-
-msgid "IDS_EMAIL_POP_PD_EMAILS_SELECTED"
-msgstr "已选择 %d 封电子邮件"
-
-msgid "IDS_EMAIL_POP_1_RECIPIENT_SELECTED"
-msgstr "已选择1个收件人"
-
-msgid "IDS_EMAIL_POP_PD_RECIPIENTS_SELECTED"
-msgstr "已选择%d个收件人"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ADD_ACCOUNT"
-msgstr "无法添加帐户"
-
-msgid "IDS_EMAIL_SK3_MOVE_HERE"
-msgstr "移动到这里"
-
diff --git a/po/zh_HK.po b/po/zh_HK.po
deleted file mode 100755 (executable)
index cbe511e..0000000
+++ /dev/null
@@ -1,465 +0,0 @@
-msgid "IDS_EMAIL_POP_NO_EMAIL_ADDRESS"
-msgstr "無電子郵件地址"
-
-msgid "IDS_EMAIL_BODY_COMPLETE"
-msgstr "完成"
-
-msgid "IDS_EMAIL_BODY_ACCEPTED_C_PS"
-msgstr "已接受: %s"
-
-msgid "IDS_EMAIL_BODY_DECLINED_C_PS"
-msgstr "已拒絕: %s"
-
-msgid "IDS_EMAIL_BODY_DOWNLOAD_FULL_MESSAGE"
-msgstr "下載完整訊息"
-
-msgid "IDS_EMAIL_BODY_GENERAL_SETTINGS"
-msgstr "一般設定"
-
-msgid "IDS_EMAIL_BODY_TENTATIVE_C_PS"
-msgstr "暫定: %s"
-
-msgid "IDS_EMAIL_BODY_WHEN_C_PS"
-msgstr "時間: %s"
-
-msgid "IDS_EMAIL_BODY_WHERE_C_PS"
-msgstr "地點: %s"
-
-msgid "IDS_EMAIL_BUTTON_DECLINE_ABB"
-msgstr "拒絕"
-
-msgid "IDS_EMAIL_BODY_NO_CONTENTS"
-msgstr "無內容"
-
-msgid "IDS_EMAIL_BODY_ORIGINAL_MESSAGE"
-msgstr "原有訊息"
-
-msgid "IDS_EMAIL_HEADER_ACCOUNT_SETTINGS"
-msgstr "帳戶設定"
-
-msgid "IDS_EMAIL_OPT_BLOCK"
-msgstr "封鎖"
-
-msgid "IDS_EMAIL_OPT_MARK_AS_READ"
-msgstr "標記為已讀"
-
-msgid "IDS_EMAIL_OPT_MARK_AS_UNREAD"
-msgstr "標記為未讀"
-
-msgid "IDS_EMAIL_OPT_OTHERS"
-msgstr "其他"
-
-msgid "IDS_EMAIL_OPT_UNREAD"
-msgstr "未讀"
-
-msgid "IDS_EMAIL_SK_COMPOSE"
-msgstr "撰寫"
-
-msgid "IDS_EMAIL_HEADER_DOWNLOAD_FAILED"
-msgstr "不能下載"
-
-msgid "IDS_EMAIL_OPT_ADD_TO_CONTACT"
-msgstr "加到聯絡人"
-
-msgid "IDS_EMAIL_OPT_VOICE_CALL"
-msgstr "語音通話"
-
-msgid "IDS_EMAIL_BODY_ACCOUNT_NAME"
-msgstr "帳戶名稱"
-
-msgid "IDS_EMAIL_BODY_ATTACHMENTS"
-msgstr "附件"
-
-msgid "IDS_EMAIL_BODY_FROM_C"
-msgstr "由:"
-
-msgid "IDS_EMAIL_BODY_IMAP4_SERVER"
-msgstr "IMAP4 伺服器"
-
-msgid "IDS_EMAIL_BODY_INCLUDES"
-msgstr "包括"
-
-msgid "IDS_EMAIL_BODY_INCOMING_PORT"
-msgstr "接收端口"
-
-msgid "IDS_EMAIL_BODY_INCOMING_SERVER"
-msgstr "內送伺服器"
-
-msgid "IDS_EMAIL_BODY_IN_PD_MINUTES"
-msgstr "在 %d 分鐘內"
-
-msgid "IDS_EMAIL_BODY_KEEP_IN_SERVER"
-msgstr "保存在伺服器中"
-
-msgid "IDS_EMAIL_BODY_NO_TEXT"
-msgstr "無文字"
-
-msgid "IDS_EMAIL_BODY_OUTGOING_PORT"
-msgstr "外寄端口"
-
-msgid "IDS_EMAIL_BODY_OUTGOING_SERVER"
-msgstr "外寄伺服器"
-
-msgid "IDS_EMAIL_BODY_PD_EMAILS"
-msgstr "%d個電郵"
-
-msgid "IDS_EMAIL_BODY_POP3_SERVER"
-msgstr "POP3 伺服器"
-
-msgid "IDS_EMAIL_BODY_RECENT"
-msgstr "最近"
-
-msgid "IDS_EMAIL_BODY_RETRIEVING_OPTIONS"
-msgstr "取回選項"
-
-msgid "IDS_EMAIL_BODY_RE_C"
-msgstr "回覆:"
-
-msgid "IDS_EMAIL_BODY_SENT_C"
-msgstr "已發送:"
-
-msgid "IDS_EMAIL_BODY_SENT_FROM_SAMSUNG_MOBILE"
-msgstr "從三星手機發送"
-
-msgid "IDS_EMAIL_BODY_USER_PASSWORD"
-msgstr "用戶密碼"
-
-msgid "IDS_EMAIL_HEADER_EDIT_RULES"
-msgstr "編輯規則"
-
-msgid "IDS_EMAIL_HEADER_EMAIL_SETTINGS"
-msgstr "電子郵件設定"
-
-msgid "IDS_EMAIL_HEADER_MAILBOXES"
-msgstr "郵箱"
-
-msgid "IDS_EMAIL_POP_ALERT"
-msgstr "提醒"
-
-msgid "IDS_EMAIL_POP_FILE_ALREADY_EXISTS"
-msgstr "檔案已存在"
-
-msgid "IDS_EMAIL_POP_NO_SENDER"
-msgstr "無寄件人"
-
-msgid "IDS_EMAIL_POP_SUCCEEDED"
-msgstr "已成功"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ATTACH_MAXIMUM_NUMBER_OF_FILES_IS_PD"
-msgstr "無法附加。最大檔案數量是 %d"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ATTACH_MAXIMUM_SIZE_OF_FILES_IS_PD_KB"
-msgstr "無法附加。檔案最大為%d KB"
-
-msgid "IDS_EMAIL_POP_VALIDATION_FAILED"
-msgstr "驗證失敗"
-
-msgid "IDS_EMAIL_SK_REPLY_ALL"
-msgstr "全部回覆"
-
-msgid "IDS_EMAIL_BODY_1_ITEM"
-msgstr "1個項目"
-
-msgid "IDS_EMAIL_BODY_ADD_MY_NAMECARD"
-msgstr "加入我的名片"
-
-msgid "IDS_EMAIL_BODY_ADD_SIGNATURE"
-msgstr "加入簽名"
-
-msgid "IDS_EMAIL_BODY_ALL_EMAILS"
-msgstr "全部電子郵件"
-
-msgid "IDS_EMAIL_BODY_ALWAYS_BCC_MYSELF"
-msgstr "總是密送給自己"
-
-msgid "IDS_EMAIL_BODY_BCC"
-msgstr "密送"
-
-msgid "IDS_EMAIL_BODY_BLOCK_EMAILS"
-msgstr "封鎖電子郵件"
-
-msgid "IDS_EMAIL_BODY_BODY"
-msgstr "正文"
-
-msgid "IDS_EMAIL_BODY_CC"
-msgstr "抄送"
-
-msgid "IDS_EMAIL_BODY_CC_BCC"
-msgstr "抄送/密送"
-
-msgid "IDS_EMAIL_BODY_CHECK_INTERVAL"
-msgstr "檢查時間間隔"
-
-msgid "IDS_EMAIL_BODY_DEFAULT_ACCOUNT"
-msgstr "預設帳戶"
-
-msgid "IDS_EMAIL_BODY_DRAFTS"
-msgstr "草稿匣"
-
-msgid "IDS_EMAIL_BODY_EMAIL_ACCOUNTS"
-msgstr "電子郵件帳戶"
-
-msgid "IDS_EMAIL_BODY_END_TIME"
-msgstr "結束時間"
-
-msgid "IDS_EMAIL_BODY_ENTIRE_EMAIL"
-msgstr "完整電郵"
-
-msgid "IDS_EMAIL_BODY_EXACTLY_THE_SAME_AS"
-msgstr "完全相同於"
-
-msgid "IDS_EMAIL_BODY_EXAMPLE"
-msgstr "範例"
-
-msgid "IDS_EMAIL_BODY_FROM_M_SENDER"
-msgstr "由:"
-
-msgid "IDS_EMAIL_BODY_INBOX"
-msgstr "收件匣"
-
-msgid "IDS_EMAIL_BODY_INCLUDE"
-msgstr "包括"
-
-msgid "IDS_EMAIL_BODY_MATCH_CRITERIA"
-msgstr "符合標準"
-
-msgid "IDS_EMAIL_BODY_NOT_USED"
-msgstr "未有使用"
-
-msgid "IDS_EMAIL_BODY_NO_ACCOUNTS"
-msgstr "無帳戶"
-
-msgid "IDS_EMAIL_BODY_PD_DAYS"
-msgstr "%d 天"
-
-msgid "IDS_EMAIL_BODY_PD_ITEMS"
-msgstr "%d 個項目"
-
-msgid "IDS_EMAIL_BODY_PRIORITY"
-msgstr "優先次序"
-
-msgid "IDS_EMAIL_BODY_RECEIVING_OPTIONS"
-msgstr "接收選項"
-
-msgid "IDS_EMAIL_BODY_SECURE_CONNECTION"
-msgstr "安全連接"
-
-msgid "IDS_EMAIL_BODY_SENDING_OPTIONS"
-msgstr "發送選項"
-
-msgid "IDS_EMAIL_BODY_SENTBOX"
-msgstr "寄件備份匣"
-
-msgid "IDS_EMAIL_BODY_SERVER_URL"
-msgstr "伺服器網址"
-
-msgid "IDS_EMAIL_BODY_SIGNATURE"
-msgstr "簽名"
-
-msgid "IDS_EMAIL_BODY_SPAMBOX"
-msgstr "垃圾箱"
-
-msgid "IDS_EMAIL_BODY_START_TIME"
-msgstr "開始時間"
-
-msgid "IDS_EMAIL_BODY_SYNC_SCHEDULE_TMO"
-msgstr "同步日程"
-
-msgid "IDS_EMAIL_BODY_TRASH"
-msgstr "垃圾"
-
-msgid "IDS_EMAIL_BODY_WITHOUT_ATTACHMENTS"
-msgstr "無附件"
-
-msgid "IDS_EMAIL_BUTTON_GROUP"
-msgstr "分組"
-
-msgid "IDS_EMAIL_HEADER_ADD_RULES"
-msgstr "加入規則"
-
-msgid "IDS_EMAIL_OPT_ATTACH_ITEMS"
-msgstr "附加項目"
-
-msgid "IDS_EMAIL_OPT_EXCHANGE"
-msgstr "Exchange"
-
-msgid "IDS_EMAIL_OPT_FILE"
-msgstr "檔案"
-
-msgid "IDS_EMAIL_OPT_NAMECARD"
-msgstr "名片"
-
-msgid "IDS_EMAIL_OPT_OPEN_URL"
-msgstr "開啟網址"
-
-msgid "IDS_EMAIL_OPT_SENDER"
-msgstr "寄件人"
-
-msgid "IDS_EMAIL_OPT_SEND_EMAIL"
-msgstr "發送電子郵件"
-
-msgid "IDS_EMAIL_OPT_UPDATE_EXISTING"
-msgstr "更新現有的"
-
-msgid "IDS_EMAIL_POP_ADD_ACCOUNTS"
-msgstr "加入帳戶"
-
-msgid "IDS_EMAIL_POP_DOWNLOADING_ATTACHMENT_ING"
-msgstr "正在下載附件..."
-
-msgid "IDS_EMAIL_POP_INVALID_EMAIL_ADDRESS"
-msgstr "無效電子郵件地址"
-
-msgid "IDS_EMAIL_POP_LOADING_CONTENTS_ING"
-msgstr "正在載入內容..."
-
-msgid "IDS_EMAIL_POP_MAXIMUM_NUMBER_OF_ATTACHMENTS_REACHED"
-msgstr "附件數目已達上限"
-
-msgid "IDS_EMAIL_POP_MOVE_TO_SPAMBOX_Q"
-msgstr "要移動到垃圾箱嗎?"
-
-msgid "IDS_EMAIL_POP_NO_RECIPIENTS_ADDED_ENTER_RECIPIENTS"
-msgstr "未加入收件人。請輸入收件人"
-
-msgid "IDS_EMAIL_POP_PLEASE_FILL_ALL_THE_MANDATORY_FIELDS"
-msgstr "請填寫所有必填欄位"
-
-msgid "IDS_EMAIL_POP_SAVE_IN_DRAFTS_Q"
-msgstr "要儲存到草稿匣嗎?"
-
-msgid "IDS_EMAIL_POP_THERE_IS_NO_ACCOUNT_CREATE_A_NEW_ACCOUNT_FIRST"
-msgstr "沒有帳戶。請先建立一個新帳戶"
-
-msgid "IDS_EMAIL_POP_TOO_MANY_RECIPIENTS"
-msgstr "太多收件人"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_DOWNLOAD"
-msgstr "無法下載"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ENTER_TEXT"
-msgstr "無法輸入文字"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_LAUNCH_APPLICATION"
-msgstr "無法啟動應用程式"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_OPEN_ATTACHMENT"
-msgstr "無法開啟附件"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_SAVE_ATTACHMENT"
-msgstr "無法儲存附件"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_SAVE_IN_DRAFTS"
-msgstr "無法儲存到草稿匣"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_SEND_EMAIL"
-msgstr "無法發送電子郵件"
-
-msgid "IDS_EMAIL_POP_UNSUPPORTED_FILE_TYPE"
-msgstr "不支援的檔案類型"
-
-msgid "IDS_EMAIL_POP_VALIDATING_ACCOUNT_ING"
-msgstr "正在確認帳戶..."
-
-msgid "IDS_EMAIL_SK_RESEND"
-msgstr "重新發送"
-
-msgid "IDS_EMAIL_BODY_ACCEPT_ALL_SSL_CERTIFICATES"
-msgstr "接受所有SSL證書"
-
-msgid "IDS_EMAIL_SK3_ACCOUNT_LIST"
-msgstr "帳戶清單"
-
-msgid "IDS_EMAIL_BODY_USER_ID"
-msgstr "用戶 ID"
-
-msgid "IDS_EMAIL_POP_ACCOUNT_ALREADY_REGISTERED"
-msgstr "帳戶已註冊"
-
-msgid "IDS_EMAIL_HEADER_ATTACH_FILE"
-msgstr "附加檔案"
-
-msgid "IDS_EMAIL_BODY_EXCHANGE_SYNC_SETTINGS_MSG"
-msgstr "通過啟動此應用程式,您接受三星還原、處理及使用部分裝置資料 (唯一的裝置 ID 和型號名稱),將該應用程式的啟動向應用程式軟件的授權者彙報。三星持有的資料將依據三星的隱私權政策嚴格處理 (請參見 www.samsung.com) 。要繼續嗎?"
-
-msgid "IDS_EMAIL_BODY_FORWARD_WITH_FILES"
-msgstr "連檔案轉寄"
-
-msgid "IDS_EMAIL_BODY_REPLY_WITH_BODY"
-msgstr "以正文回覆"
-
-msgid "IDS_EMAIL_BODY_NO_SUBJECT"
-msgstr "無主題"
-
-msgid "IDS_EMAIL_BODY_FROM"
-msgstr "由"
-
-msgid "IDS_EMAIL_BODY_NO_ADDRESS"
-msgstr "無地址"
-
-msgid "IDS_EMAIL_OPT_RECORD_SOUND"
-msgstr "錄音"
-
-msgid "IDS_EMAIL_OPT_RECORD_VIDEO"
-msgstr "錄影"
-
-msgid "IDS_EMAIL_OPT_INSERT_IMAGE"
-msgstr "插入圖像"
-
-msgid "IDS_EMAIL_OPT_ADD_TO_CALENDAR"
-msgstr "加到日曆"
-
-msgid "IDS_EMAIL_OPT_CHANGE_EMAIL_ADDRESS_ABB"
-msgstr "更改電子郵件地址"
-
-msgid "IDS_EMAIL_OPT_CLIPBOARD"
-msgstr "剪貼板"
-
-msgid "IDS_EMAIL_OPT_MARKED_AS_UNREAD"
-msgstr "已標記為未讀"
-
-msgid "IDS_EMAIL_OPT_VIEW_CONTACT_DETAILS"
-msgstr "檢視聯絡人詳細資料"
-
-msgid "IDS_EMAIL_POP_SAVED_IN_DRAFTS"
-msgstr "已儲存到草稿匣"
-
-msgid "IDS_EMAIL_POP_NETWORK_BUSY"
-msgstr "網絡繁忙"
-
-msgid "IDS_EMAIL_POP_LOGIN_ALLOWED_ONLY_EVERY_PD_MINUTES"
-msgstr "Login allowed only every %d minutes"
-
-msgid "IDS_EMAIL_POP_HOST_NOT_FOUND"
-msgstr "找不到主機"
-
-msgid "IDS_EMAIL_POP_HOST_NOT_REACHABLE"
-msgstr "無法到達主機"
-
-msgid "IDS_EMAIL_POP_NO_SERVICE"
-msgstr "無服務"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_FORWARD_DRM_CONTENTS"
-msgstr "無法轉寄DRM內容"
-
-msgid "IDS_EMAIL_POP_BLOCKED"
-msgstr "已封鎖"
-
-msgid "IDS_EMAIL_POP_1_EMAIL_SELECTED"
-msgstr "已選擇 1 封電子郵件"
-
-msgid "IDS_EMAIL_POP_PD_EMAILS_SELECTED"
-msgstr "已選擇 %d 封電子郵件"
-
-msgid "IDS_EMAIL_POP_1_RECIPIENT_SELECTED"
-msgstr "1個收件人已選取"
-
-msgid "IDS_EMAIL_POP_PD_RECIPIENTS_SELECTED"
-msgstr "%d個收件人已選取"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ADD_ACCOUNT"
-msgstr "無法加入帳戶"
-
-msgid "IDS_EMAIL_SK3_MOVE_HERE"
-msgstr "移到這裡"
-
diff --git a/po/zh_TW.po b/po/zh_TW.po
deleted file mode 100755 (executable)
index 7dcdde8..0000000
+++ /dev/null
@@ -1,465 +0,0 @@
-msgid "IDS_EMAIL_POP_NO_EMAIL_ADDRESS"
-msgstr "無電子郵件地址"
-
-msgid "IDS_EMAIL_BODY_COMPLETE"
-msgstr "完成"
-
-msgid "IDS_EMAIL_BODY_ACCEPTED_C_PS"
-msgstr "已接受:%s"
-
-msgid "IDS_EMAIL_BODY_DECLINED_C_PS"
-msgstr "拒絕:%s"
-
-msgid "IDS_EMAIL_BODY_DOWNLOAD_FULL_MESSAGE"
-msgstr "下載完整的郵件"
-
-msgid "IDS_EMAIL_BODY_GENERAL_SETTINGS"
-msgstr "一般設定"
-
-msgid "IDS_EMAIL_BODY_TENTATIVE_C_PS"
-msgstr "暫定:%s"
-
-msgid "IDS_EMAIL_BODY_WHEN_C_PS"
-msgstr "時間:%s"
-
-msgid "IDS_EMAIL_BODY_WHERE_C_PS"
-msgstr "地點:%s"
-
-msgid "IDS_EMAIL_BUTTON_DECLINE_ABB"
-msgstr "拒絕"
-
-msgid "IDS_EMAIL_BODY_NO_CONTENTS"
-msgstr "無內容"
-
-msgid "IDS_EMAIL_BODY_ORIGINAL_MESSAGE"
-msgstr "原始郵件"
-
-msgid "IDS_EMAIL_HEADER_ACCOUNT_SETTINGS"
-msgstr "帳號設定"
-
-msgid "IDS_EMAIL_OPT_BLOCK"
-msgstr "封鎖"
-
-msgid "IDS_EMAIL_OPT_MARK_AS_READ"
-msgstr "標記為已讀"
-
-msgid "IDS_EMAIL_OPT_MARK_AS_UNREAD"
-msgstr "標記為未讀"
-
-msgid "IDS_EMAIL_OPT_OTHERS"
-msgstr "其他"
-
-msgid "IDS_EMAIL_OPT_UNREAD"
-msgstr "未讀"
-
-msgid "IDS_EMAIL_SK_COMPOSE"
-msgstr "撰寫"
-
-msgid "IDS_EMAIL_HEADER_DOWNLOAD_FAILED"
-msgstr "無法下載"
-
-msgid "IDS_EMAIL_OPT_ADD_TO_CONTACT"
-msgstr "加到聯絡人"
-
-msgid "IDS_EMAIL_OPT_VOICE_CALL"
-msgstr "語音通話"
-
-msgid "IDS_EMAIL_BODY_ACCOUNT_NAME"
-msgstr "帳號名稱"
-
-msgid "IDS_EMAIL_BODY_ATTACHMENTS"
-msgstr "附件"
-
-msgid "IDS_EMAIL_BODY_FROM_C"
-msgstr "自:"
-
-msgid "IDS_EMAIL_BODY_IMAP4_SERVER"
-msgstr "IMAP4 伺服器"
-
-msgid "IDS_EMAIL_BODY_INCLUDES"
-msgstr "包括"
-
-msgid "IDS_EMAIL_BODY_INCOMING_PORT"
-msgstr "傳入連接埠"
-
-msgid "IDS_EMAIL_BODY_INCOMING_SERVER"
-msgstr "內送伺服器"
-
-msgid "IDS_EMAIL_BODY_IN_PD_MINUTES"
-msgstr "在%d分鐘後"
-
-msgid "IDS_EMAIL_BODY_KEEP_IN_SERVER"
-msgstr "保留在伺服器中"
-
-msgid "IDS_EMAIL_BODY_NO_TEXT"
-msgstr "無文字"
-
-msgid "IDS_EMAIL_BODY_OUTGOING_PORT"
-msgstr "外寄連接埠"
-
-msgid "IDS_EMAIL_BODY_OUTGOING_SERVER"
-msgstr "外寄郵件伺服器"
-
-msgid "IDS_EMAIL_BODY_PD_EMAILS"
-msgstr "%d個電子郵件"
-
-msgid "IDS_EMAIL_BODY_POP3_SERVER"
-msgstr "POP3 伺服器"
-
-msgid "IDS_EMAIL_BODY_RECENT"
-msgstr "最近"
-
-msgid "IDS_EMAIL_BODY_RETRIEVING_OPTIONS"
-msgstr "擷取選項"
-
-msgid "IDS_EMAIL_BODY_RE_C"
-msgstr "收件人:"
-
-msgid "IDS_EMAIL_BODY_SENT_C"
-msgstr "已傳送:"
-
-msgid "IDS_EMAIL_BODY_SENT_FROM_SAMSUNG_MOBILE"
-msgstr "從三星手機發送"
-
-msgid "IDS_EMAIL_BODY_USER_PASSWORD"
-msgstr "使用者密碼"
-
-msgid "IDS_EMAIL_HEADER_EDIT_RULES"
-msgstr "編輯規則"
-
-msgid "IDS_EMAIL_HEADER_EMAIL_SETTINGS"
-msgstr "電子郵件設定"
-
-msgid "IDS_EMAIL_HEADER_MAILBOXES"
-msgstr "收件匣"
-
-msgid "IDS_EMAIL_POP_ALERT"
-msgstr "提醒"
-
-msgid "IDS_EMAIL_POP_FILE_ALREADY_EXISTS"
-msgstr "文件已存在"
-
-msgid "IDS_EMAIL_POP_NO_SENDER"
-msgstr "無寄件人"
-
-msgid "IDS_EMAIL_POP_SUCCEEDED"
-msgstr "已成功"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ATTACH_MAXIMUM_NUMBER_OF_FILES_IS_PD"
-msgstr "無法連接。文件的最大編號為%d個"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ATTACH_MAXIMUM_SIZE_OF_FILES_IS_PD_KB"
-msgstr "無法附加。最大文件%d KB"
-
-msgid "IDS_EMAIL_POP_VALIDATION_FAILED"
-msgstr "驗證失敗"
-
-msgid "IDS_EMAIL_SK_REPLY_ALL"
-msgstr "全部回覆"
-
-msgid "IDS_EMAIL_BODY_1_ITEM"
-msgstr "1個項目"
-
-msgid "IDS_EMAIL_BODY_ADD_MY_NAMECARD"
-msgstr "加入我的名片"
-
-msgid "IDS_EMAIL_BODY_ADD_SIGNATURE"
-msgstr "加入簽名"
-
-msgid "IDS_EMAIL_BODY_ALL_EMAILS"
-msgstr "全部電子郵件"
-
-msgid "IDS_EMAIL_BODY_ALWAYS_BCC_MYSELF"
-msgstr "總是寄送密件副本給自己"
-
-msgid "IDS_EMAIL_BODY_BCC"
-msgstr "密件副本"
-
-msgid "IDS_EMAIL_BODY_BLOCK_EMAILS"
-msgstr "封鎖電子郵件"
-
-msgid "IDS_EMAIL_BODY_BODY"
-msgstr "本文"
-
-msgid "IDS_EMAIL_BODY_CC"
-msgstr "副本"
-
-msgid "IDS_EMAIL_BODY_CC_BCC"
-msgstr "副本/密件"
-
-msgid "IDS_EMAIL_BODY_CHECK_INTERVAL"
-msgstr "檢查時間間隔"
-
-msgid "IDS_EMAIL_BODY_DEFAULT_ACCOUNT"
-msgstr "預設帳戶"
-
-msgid "IDS_EMAIL_BODY_DRAFTS"
-msgstr "草稿匣"
-
-msgid "IDS_EMAIL_BODY_EMAIL_ACCOUNTS"
-msgstr "電子郵件帳戶"
-
-msgid "IDS_EMAIL_BODY_END_TIME"
-msgstr "結束時間"
-
-msgid "IDS_EMAIL_BODY_ENTIRE_EMAIL"
-msgstr "整封電子郵件"
-
-msgid "IDS_EMAIL_BODY_EXACTLY_THE_SAME_AS"
-msgstr "完全相同於"
-
-msgid "IDS_EMAIL_BODY_EXAMPLE"
-msgstr "範例"
-
-msgid "IDS_EMAIL_BODY_FROM_M_SENDER"
-msgstr "自:"
-
-msgid "IDS_EMAIL_BODY_INBOX"
-msgstr "收件匣"
-
-msgid "IDS_EMAIL_BODY_INCLUDE"
-msgstr "包括"
-
-msgid "IDS_EMAIL_BODY_MATCH_CRITERIA"
-msgstr "符合條件"
-
-msgid "IDS_EMAIL_BODY_NOT_USED"
-msgstr "未使用"
-
-msgid "IDS_EMAIL_BODY_NO_ACCOUNTS"
-msgstr "沒有任何帳戶"
-
-msgid "IDS_EMAIL_BODY_PD_DAYS"
-msgstr "%d 天"
-
-msgid "IDS_EMAIL_BODY_PD_ITEMS"
-msgstr "%d 個項目"
-
-msgid "IDS_EMAIL_BODY_PRIORITY"
-msgstr "優先順序"
-
-msgid "IDS_EMAIL_BODY_RECEIVING_OPTIONS"
-msgstr "接收選項"
-
-msgid "IDS_EMAIL_BODY_SECURE_CONNECTION"
-msgstr "安全連接"
-
-msgid "IDS_EMAIL_BODY_SENDING_OPTIONS"
-msgstr "傳送選項"
-
-msgid "IDS_EMAIL_BODY_SENTBOX"
-msgstr "已傳送訊息"
-
-msgid "IDS_EMAIL_BODY_SERVER_URL"
-msgstr "伺服器 URL"
-
-msgid "IDS_EMAIL_BODY_SIGNATURE"
-msgstr "簽名"
-
-msgid "IDS_EMAIL_BODY_SPAMBOX"
-msgstr "垃圾郵件"
-
-msgid "IDS_EMAIL_BODY_START_TIME"
-msgstr "開始時間"
-
-msgid "IDS_EMAIL_BODY_SYNC_SCHEDULE_TMO"
-msgstr "同步處理排程"
-
-msgid "IDS_EMAIL_BODY_TRASH"
-msgstr "垃圾"
-
-msgid "IDS_EMAIL_BODY_WITHOUT_ATTACHMENTS"
-msgstr "無附件"
-
-msgid "IDS_EMAIL_BUTTON_GROUP"
-msgstr "群組"
-
-msgid "IDS_EMAIL_HEADER_ADD_RULES"
-msgstr "加入規則"
-
-msgid "IDS_EMAIL_OPT_ATTACH_ITEMS"
-msgstr "附加項目"
-
-msgid "IDS_EMAIL_OPT_EXCHANGE"
-msgstr "交換"
-
-msgid "IDS_EMAIL_OPT_FILE"
-msgstr "檔案"
-
-msgid "IDS_EMAIL_OPT_NAMECARD"
-msgstr "名片"
-
-msgid "IDS_EMAIL_OPT_OPEN_URL"
-msgstr "開啟 URL"
-
-msgid "IDS_EMAIL_OPT_SENDER"
-msgstr "寄件人"
-
-msgid "IDS_EMAIL_OPT_SEND_EMAIL"
-msgstr "傳送電子郵件"
-
-msgid "IDS_EMAIL_OPT_UPDATE_EXISTING"
-msgstr "更新現有"
-
-msgid "IDS_EMAIL_POP_ADD_ACCOUNTS"
-msgstr "新增帳戶"
-
-msgid "IDS_EMAIL_POP_DOWNLOADING_ATTACHMENT_ING"
-msgstr "下載附件..."
-
-msgid "IDS_EMAIL_POP_INVALID_EMAIL_ADDRESS"
-msgstr "電子郵件地址無效"
-
-msgid "IDS_EMAIL_POP_LOADING_CONTENTS_ING"
-msgstr "讀取中"
-
-msgid "IDS_EMAIL_POP_MAXIMUM_NUMBER_OF_ATTACHMENTS_REACHED"
-msgstr "附件數已達上限"
-
-msgid "IDS_EMAIL_POP_MOVE_TO_SPAMBOX_Q"
-msgstr "要移至垃圾郵件嗎?"
-
-msgid "IDS_EMAIL_POP_NO_RECIPIENTS_ADDED_ENTER_RECIPIENTS"
-msgstr "沒有收件人,請輸入收件人"
-
-msgid "IDS_EMAIL_POP_PLEASE_FILL_ALL_THE_MANDATORY_FIELDS"
-msgstr "請填入所有必填欄位"
-
-msgid "IDS_EMAIL_POP_SAVE_IN_DRAFTS_Q"
-msgstr "要儲存在草稿匣中嗎?"
-
-msgid "IDS_EMAIL_POP_THERE_IS_NO_ACCOUNT_CREATE_A_NEW_ACCOUNT_FIRST"
-msgstr "沒有帳戶。請先建立新帳戶"
-
-msgid "IDS_EMAIL_POP_TOO_MANY_RECIPIENTS"
-msgstr "收件人太多"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_DOWNLOAD"
-msgstr "無法下載"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ENTER_TEXT"
-msgstr "無法輸入文字"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_LAUNCH_APPLICATION"
-msgstr "無法執行應用程式"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_OPEN_ATTACHMENT"
-msgstr "無法開啟附件"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_SAVE_ATTACHMENT"
-msgstr "無法儲存附件"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_SAVE_IN_DRAFTS"
-msgstr "無法儲存在草稿匣中"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_SEND_EMAIL"
-msgstr "無法傳送電子郵件"
-
-msgid "IDS_EMAIL_POP_UNSUPPORTED_FILE_TYPE"
-msgstr "不支援的檔案類型"
-
-msgid "IDS_EMAIL_POP_VALIDATING_ACCOUNT_ING"
-msgstr "正在驗證帳戶..."
-
-msgid "IDS_EMAIL_SK_RESEND"
-msgstr "重新傳送"
-
-msgid "IDS_EMAIL_BODY_ACCEPT_ALL_SSL_CERTIFICATES"
-msgstr "接受所有SSL證書"
-
-msgid "IDS_EMAIL_SK3_ACCOUNT_LIST"
-msgstr "帳戶列表"
-
-msgid "IDS_EMAIL_BODY_USER_ID"
-msgstr "使用者 ID"
-
-msgid "IDS_EMAIL_POP_ACCOUNT_ALREADY_REGISTERED"
-msgstr "帳號已經被註冊"
-
-msgid "IDS_EMAIL_HEADER_ATTACH_FILE"
-msgstr "附加文件"
-
-msgid "IDS_EMAIL_BODY_EXCHANGE_SYNC_SETTINGS_MSG"
-msgstr "藉由啟動此應用程式,您接受三星還原、處理及使用部分裝置資料 (唯一的裝置 ID 和型號名稱),將該應用程式的啟動向應用程式軟體的授權者彙報。 三星持有的資料將依據三星的隱私權政策 (請參見 www.samsung.com) 嚴格處理。要繼續嗎?"
-
-msgid "IDS_EMAIL_BODY_FORWARD_WITH_FILES"
-msgstr "連檔案轉寄"
-
-msgid "IDS_EMAIL_BODY_REPLY_WITH_BODY"
-msgstr "以正文回覆"
-
-msgid "IDS_EMAIL_BODY_NO_SUBJECT"
-msgstr "無主旨"
-
-msgid "IDS_EMAIL_BODY_FROM"
-msgstr "自"
-
-msgid "IDS_EMAIL_BODY_NO_ADDRESS"
-msgstr "無地址"
-
-msgid "IDS_EMAIL_OPT_RECORD_SOUND"
-msgstr "錄音"
-
-msgid "IDS_EMAIL_OPT_RECORD_VIDEO"
-msgstr "錄影"
-
-msgid "IDS_EMAIL_OPT_INSERT_IMAGE"
-msgstr "插入影像"
-
-msgid "IDS_EMAIL_OPT_ADD_TO_CALENDAR"
-msgstr "加到日曆"
-
-msgid "IDS_EMAIL_OPT_CHANGE_EMAIL_ADDRESS_ABB"
-msgstr "變更電子郵件地址"
-
-msgid "IDS_EMAIL_OPT_CLIPBOARD"
-msgstr "剪貼簿"
-
-msgid "IDS_EMAIL_OPT_MARKED_AS_UNREAD"
-msgstr "標記為未讀"
-
-msgid "IDS_EMAIL_OPT_VIEW_CONTACT_DETAILS"
-msgstr "檢視聯絡人詳細資料"
-
-msgid "IDS_EMAIL_POP_SAVED_IN_DRAFTS"
-msgstr "已儲存在草稿匣中"
-
-msgid "IDS_EMAIL_POP_NETWORK_BUSY"
-msgstr "網路繁忙"
-
-msgid "IDS_EMAIL_POP_LOGIN_ALLOWED_ONLY_EVERY_PD_MINUTES"
-msgstr "Login allowed only every %d minutes"
-
-msgid "IDS_EMAIL_POP_HOST_NOT_FOUND"
-msgstr "找不到主機"
-
-msgid "IDS_EMAIL_POP_HOST_NOT_REACHABLE"
-msgstr "無法到達主機"
-
-msgid "IDS_EMAIL_POP_NO_SERVICE"
-msgstr "無服務"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_FORWARD_DRM_CONTENTS"
-msgstr "無法轉發 DRM 內容"
-
-msgid "IDS_EMAIL_POP_BLOCKED"
-msgstr "已封鎖"
-
-msgid "IDS_EMAIL_POP_1_EMAIL_SELECTED"
-msgstr "已選擇 1 封電子郵件"
-
-msgid "IDS_EMAIL_POP_PD_EMAILS_SELECTED"
-msgstr "已選擇 %d 封電子郵件"
-
-msgid "IDS_EMAIL_POP_1_RECIPIENT_SELECTED"
-msgstr "1收件人已選擇"
-
-msgid "IDS_EMAIL_POP_PD_RECIPIENTS_SELECTED"
-msgstr "已選擇%d個收件者"
-
-msgid "IDS_EMAIL_POP_UNABLE_TO_ADD_ACCOUNT"
-msgstr "無法加入帳戶"
-
-msgid "IDS_EMAIL_SK3_MOVE_HERE"
-msgstr "移到這裡"
-
index dca696f..f0e1545 100755 (executable)
@@ -20,23 +20,23 @@ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VISIBILITY} -fvisibility=hidden")
 
 
 SET(TEST-APP-SRCS
-       ${CMAKE_SOURCE_DIR}/utilities/email-service-test-application/email-service-test-application/emf-test-main.c
-       ${CMAKE_SOURCE_DIR}/utilities/email-service-test-application/email-service-test-application/emf-test-utility.c
-       ${CMAKE_SOURCE_DIR}/utilities/email-service-test-application/email-service-test-application/emf-test-message.c
-       ${CMAKE_SOURCE_DIR}/utilities/email-service-test-application/email-service-test-application/emf-test-mailbox.c
-       ${CMAKE_SOURCE_DIR}/utilities/email-service-test-application/email-service-test-application/emf-test-account.c
-       ${CMAKE_SOURCE_DIR}/utilities/email-service-test-application/email-service-test-application/emf-test-rule.c
-       ${CMAKE_SOURCE_DIR}/utilities/email-service-test-application/email-service-test-application/emf-test-thread.c
-       ${CMAKE_SOURCE_DIR}/utilities/email-service-test-application/email-service-test-application/emf-test-others.c
+       ${CMAKE_SOURCE_DIR}/utilities/test-application/main.c
+       ${CMAKE_SOURCE_DIR}/utilities/test-application/testapp-utility.c
+       ${CMAKE_SOURCE_DIR}/utilities/test-application/testapp-mail.c
+       ${CMAKE_SOURCE_DIR}/utilities/test-application/testapp-mailbox.c
+       ${CMAKE_SOURCE_DIR}/utilities/test-application/testapp-account.c
+       ${CMAKE_SOURCE_DIR}/utilities/test-application/testapp-rule.c
+       ${CMAKE_SOURCE_DIR}/utilities/test-application/testapp-thread.c
+       ${CMAKE_SOURCE_DIR}/utilities/test-application/testapp-others.c
 )
 
 INCLUDE_DIRECTORIES(
-       ${CMAKE_SOURCE_DIR}/utilities/email-service-test-application/email-service-test-application/include
-       ${CMAKE_SOURCE_DIR}/MAPI/include
-       ${CMAKE_SOURCE_DIR}/include
-       ${CMAKE_SOURCE_DIR}/email-core/em-storage/include
+       ${CMAKE_SOURCE_DIR}/utilities/test-application/include
+       ${CMAKE_SOURCE_DIR}/email-api/include
+       ${CMAKE_SOURCE_DIR}/email-common-use/include
        ${CMAKE_SOURCE_DIR}/email-core/include
-       ${CMAKE_SOURCE_DIR}/ipc/include
+       ${CMAKE_SOURCE_DIR}/email-core/email-storage/include
+       ${CMAKE_SOURCE_DIR}/email-ipc/include
 )
 
 INCLUDE(FindPkgConfig)
@@ -30,7 +30,7 @@ typedef enum
 {
        EMF_MAIN_MENU = 0x0,
        EMF_ACCOUNT_MENU,
-       EMF_MESSAGE_MENU,
+       EMF_MAIL_MENU,
        EMF_MAILBOX_MENU,
        EMF_RULE_MENU,
        EMF_THREAD_MENU,
@@ -38,7 +38,6 @@ typedef enum
 } eEMF_MENU;
 
 
-/* export API */
 void testapp_print(char *fmt, ...);
 void testapp_show_menu(eEMF_MENU menu);
 void testapp_show_prompt(eEMF_MENU menu);
 /* open header */
 #include <glib.h>
 
-#include "Emf_Mapi_Init.h"
+#include "email-api-init.h"
 
 /* internal header */
-#include "emf-test-utility.h"
-#include "emf-test-account.h"
-#include "emf-test-message.h"
-#include "emf-test-mailbox.h"
-#include "emf-test-rule.h"
-#include "emf-test-thread.h"
-#include "emf-test-others.h"
+#include "testapp-utility.h"
+#include "testapp-account.h"
+#include "testapp-mail.h"
+#include "testapp-mailbox.h"
+#include "testapp-rule.h"
+#include "testapp-thread.h"
+#include "testapp-others.h"
 #include "db-util.h"
 
 /* function prototype */
 /* open header */
 #include <glib.h>
 
-#include "Emf_Mapi_Account.h"
-#include "Emf_Mapi_Network.h"
+#include "email-api-account.h"
+#include "email-api-network.h"
 
 /* internal header */
-#include "emf-test-utility.h"
-#include "emf-test-account.h"
+#include "testapp-utility.h"
+#include "testapp-account.h"
 #include <sys/time.h>
 #include <sys/times.h>
 
 #define VDF_RECV_SERVER_ADDR  "imap.email.vodafone.de"
 #define VDF_SMTP_SERVER_ADDR  "smtp.email.vodafone.de"
 
+/*  SAMSUNG 3G TEST */
+#define S3G_RECV_SERVER_ADDR               "165.213.73.235"
+#define S3G_RECV_SERVER_PORT               EMF_POP3_PORT
+#define S3G_RECV_USE_SECURITY              0
+#define S3G_RECV_IMAP_USE_SECURITY     1
+#define S3G_SMTP_SERVER_ADDR               "165.213.73.235"
+#define S3G_SMTP_SERVER_PORT               465
+#define S3G_SMTP_AUTH                                  1
+#define S3G_SMTP_USE_SECURITY        1
+#define S3G_KEEP_ON_SERVER                   1
 
 gboolean testapp_test_create_account_by_account_type(int account_type,int *account_id) 
 {
@@ -140,6 +150,28 @@ gboolean testapp_test_create_account_by_account_type(int account_type,int *accou
                        account->sending_auth           = 0; 
                        break;
 
+               case 4:/*  SAMSUNG 3G TEST */
+                       account->receiving_server_type  = EMF_SERVER_TYPE_POP3;
+                       account->receiving_server_addr  = strdup(S3G_RECV_SERVER_ADDR); 
+                       account->port_num               = S3G_RECV_SERVER_PORT;        
+                       account->sending_server_addr    = strdup(S3G_SMTP_SERVER_ADDR); 
+                       account->sending_port_num       = S3G_SMTP_SERVER_PORT;
+                       account->use_security           = S3G_RECV_USE_SECURITY;                                                   
+                       account->sending_security       = S3G_SMTP_USE_SECURITY;
+                       account->sending_auth                   = S3G_SMTP_AUTH;
+                       break;
+       
+               case 5:/*  SAMSUNG 3G TEST */
+                       account->receiving_server_type  = EMF_SERVER_TYPE_IMAP4;
+                       account->receiving_server_addr  = strdup(S3G_RECV_SERVER_ADDR); 
+                       account->port_num               = EMF_IMAPS_PORT;        
+                       account->sending_server_addr    = strdup(S3G_SMTP_SERVER_ADDR); 
+                       account->sending_port_num       = S3G_SMTP_SERVER_PORT;
+                       account->use_security           = 1;                                                   
+                       account->sending_security           = S3G_SMTP_USE_SECURITY;
+                       account->sending_auth                   = S3G_SMTP_AUTH;
+                       break;
+
                case 6:/*  Gmail POP3 */
                        account->receiving_server_type  = EMF_SERVER_TYPE_POP3; 
                        account->receiving_server_addr  = strdup("pop.gmail.com"); 
@@ -246,6 +278,8 @@ static gboolean testapp_test_create_account()
        
        testapp_print("1. Gawab\n");
        testapp_print("2. Vodafone\n");
+       testapp_print("4. SAMSUNG 3G TEST (POP)\n");
+       testapp_print("5. SAMSUNG 3G TEST (IMAP)\n");
        testapp_print("6. Gmail (POP3)\n");
        testapp_print("7. Gmail (IMAP4)\n");
        testapp_print("8. Active Sync (dummy)\n");
@@ -543,6 +577,21 @@ static gboolean testapp_test_get_password_length_of_account()
        return FALSE;
 }
 
+static gboolean testapp_test_query_server_info()
+{
+       int error_code;
+       char domain_name[255];
+       emf_server_info_t *result_server_info;
+
+       testapp_print("\n input domain name\n");
+       scanf("%s", domain_name);
+
+       error_code = email_query_server_info(domain_name, &result_server_info);
+       testapp_print("email_query_server_info returned [%d]\n",error_code);
+       if(error_code == EMF_ERROR_NONE)
+               testapp_print("service_name [%s]\n", result_server_info->service_name);
+       return FALSE;
+}
 
 static gboolean testapp_test_clear_all_notification()
 {
@@ -594,12 +643,18 @@ static gboolean testapp_test_interpret_command (int selected_number)
                        testapp_test_get_password_length_of_account();
                        break;
 
+               case 12:
+                       testapp_test_query_server_info();
+                       break;
+
                case 13:
                        testapp_test_clear_all_notification();
+                       break;
 
                case 0:
                        go_to_loop = FALSE;
                        break;
+
                default:
                        break;
        }
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
+#include <sys/stat.h>
 
 /* open header */
 #include <glib.h>
 #include <time.h>
 
-#include "Emf_Mapi_Message.h"
-#include "Emf_Mapi_Network.h"
-#include "Emf_Mapi_Mailbox.h"
+#include "email-api-account.h"
+#include "email-api-network.h"
+#include "email-api-mail.h"
+#include "email-api-mailbox.h"
 
 /* internal header */
-#include "emf-test-utility.h"
-#include "emf-test-message.h"
-#include "em-core-utils.h"
+#include "testapp-utility.h"
+#include "testapp-mail.h"
+#include "email-core-utils.h"
 
 #define MAIL_TEMP_BODY "/tmp/mail.txt"
-#define NO_OF_TESTS    40
 
 /*
 static void testapp_test_print_sorting_menu()
@@ -84,9 +85,7 @@ static void testapp_test_print_mail_list_item(emf_mail_list_item_t *mail_list_it
                        testapp_print(" >>> subject [ %s ] \n", mail_list_item[i].subject);
                }
                testapp_print(" >>> text_download_yn [ %d ] \n", mail_list_item[i].is_text_downloaded);
-               if (  mail_list_item[i].datetime != NULL ) {
-                       testapp_print(" >>> datetime [ %s ] \n", mail_list_item[i].datetime);
-               }
+               testapp_print(" >>> date_time [ %d ] \n", mail_list_item[i].date_time);
                testapp_print(" >>> flags_seen_field [ %d ] \n", mail_list_item[i].flags_seen_field);
                testapp_print(" >>> priority [ %d ] \n", mail_list_item[i].priority);
                testapp_print(" >>> save_status [ %d ] \n", mail_list_item[i].save_status);
@@ -106,147 +105,15 @@ static void testapp_test_print_mail_list_item(emf_mail_list_item_t *mail_list_it
 }
 */
 
-static gboolean testapp_test_send_html_mail_with_inline_content()
-{
-       int   account_id = 0, i = 0, from_composer = 1;
-       int   err_code = EMF_ERROR_NONE;
-       unsigned handle = 0;
-       FILE *p_file = NULL;
-       char *p_plain_text_file_path = "/opt/data/email/.emfdata/tmp/mail.txt";
-       char *p_html_text_file_path  = "/opt/data/email/.emfdata/tmp/mail.html";
-       char *p_attachment_file_path = "/opt/media/Images and videos/Wallpapers/Default.png";
-       char *p_attachment_name      = "Default.png";
-       emf_mail_t            *mail = NULL;
-       emf_mailbox_t         *mailbox = NULL;
-       emf_attachment_info_t *attachment = NULL;
-       emf_option_t           option;
-
-       
-       testapp_print("\n > Enter account no:");
-       scanf("%d", &account_id);
-
-       mail = malloc(sizeof(emf_mail_t));
-       memset(mail, 0x00, sizeof(emf_mail_t));
-
-       mail->info = malloc(sizeof(emf_mail_info_t));
-       memset(mail->info, 0x00, sizeof(emf_mail_info_t));
-
-
-       mail->info->account_id = account_id;
-       mail->info->extra_flags.text_download_yn = 1;
-       mail->info->flags.seen = 1;
-       mail->info->account_id = account_id;
-
-       mail->head = malloc(sizeof(emf_mail_head_t));
-       memset(mail->head, 0x00, sizeof(emf_mail_head_t));
-
-       mail->head->to      = strdup("<kyuho.jo@samsung.com>"); 
-       mail->head->cc      = strdup("<slpmany@gmail.com>");
-       mail->head->bcc     = strdup("<samsungtest09@gmail.com>");
-       mail->head->from    = strdup("<slpmany@gmail.com>");
-       mail->head->subject = strdup("HTML Inline");
-       
-       mail->body = malloc(sizeof(emf_mail_body_t));
-       memset(mail->body, 0x00, sizeof(emf_mail_body_t));
-       mail->body->plain = strdup(p_plain_text_file_path);
-       mail->body->html  = strdup(p_html_text_file_path);
-
-       mailbox = malloc(sizeof(emf_mailbox_t));
-       if(!mailbox) {
-               testapp_print("malloc failed\n");
-               email_free_mail(&mail, 1);
-               return false;
-       }
-       memset(mailbox, 0x00, sizeof(emf_mailbox_t));
-       mailbox->name = strdup("INBOX");
-       mailbox->account_id = account_id;
-       
-       attachment = malloc(sizeof(emf_attachment_info_t));
-       memset(attachment, 0x00, sizeof(emf_attachment_info_t));
-       attachment->name = strdup(p_attachment_name);
-       attachment->savename = strdup(p_attachment_file_path);
-       attachment->downloaded = 1;
-       attachment->inline_content = 1;
-       attachment->next = NULL;
-       
-       mail->body->attachment = attachment;
-       mail->body->attachment_num = 1;
-
-       p_file = fopen(p_plain_text_file_path, "w");
-
-       if(!p_file) {
-               testapp_print("fopen failed\n");
-               email_free_mail(&mail, 1);
-               email_free_mailbox(&mailbox, 1);                
-               return false;
-       }
-       for(i = 0; i < 50; i++)
-       fprintf(p_file, "X2 X2 X2 X2 X2 X2 X2");
-    fclose(p_file);
-
-       p_file = fopen(p_html_text_file_path, "w");
-       if(!p_file) {
-               testapp_print("fopen failed\n");
-               email_free_mail(&mail, 1);
-               email_free_mailbox(&mailbox, 1);
-               return false;
-       }
-       fprintf(p_file, "<HTML><HEAD></HEAD>\r\n<BODY>\r\n<IMG SRC = \"%s\"></IMG>\r\n</BODY></HTML>", p_attachment_name);
-    fclose(p_file);
-
-       if((err_code = email_add_message(mail, mailbox, from_composer)) < 0)
-               testapp_print("email_add_message failed. [%d]\n", err_code);
-       else
-               testapp_print("email_add_message success\n");
-
-       testapp_print("saved mail id = [%d]\n", mail->info->uid);
-
-       memset(&option, 0x00, sizeof(emf_option_t));
-       option.keep_local_copy = 1;
-       err_code = email_send_mail(mailbox, mail->info->uid, &option, &handle);
-       if( err_code < 0)
-               testapp_print("   fail sending [%d]\n", err_code);
-       else 
-               testapp_print("   finish sending. handle[%d]\n", handle);
-
-       email_free_mail(&mail, 1);
-       email_free_mailbox(&mailbox, 1);
-
-       return true;
-}
-
-static char *testapp_test_generate_random_string(int length)
-{
-       int i, string_length = length + 10,  random_number, loop_cnt = length / 8;
-       char *result_string = NULL, temp_string[20] = { 0, };
-
-       result_string = em_core_malloc(string_length);
-
-       if (!result_string) {
-               return NULL;
-       }
-       
-       memset(result_string, 0, string_length);
-       srand(time(NULL));
-
-       for(i = 0; i < loop_cnt; i++) { 
-               random_number = rand() * rand();
-               snprintf(temp_string, 20, "%08x", random_number);
-               strcat(result_string, temp_string);
-       }
-       
-       return result_string;
-}
-
-static gboolean testapp_test_add_mail ()
+static gboolean testapp_test_add_mail (int *result_mail_id)
 {
        int                    i = 0;
        int                    account_id = 0;
-       int                    sync_server = 0;
+       int                    from_eas = 0;
        int                    attachment_count = 0;
        int                    err = EMF_ERROR_NONE;
        char                   arg[50] = { 0 , };
-       char                  *body_file_path = "/opt/data/email/.emfdata/tmp/mail.txt";
+       const char            *body_file_path = MAIL_TEMP_BODY;
        emf_mailbox_t         *mailbox_data = NULL;
        emf_mail_data_t       *test_mail_data = NULL;
        emf_attachment_data_t *attachment_data = NULL;
@@ -267,26 +134,34 @@ static gboolean testapp_test_add_mail ()
        memset(test_mail_data, 0x00, sizeof(emf_mail_data_t));
        
        testapp_print("\n Sync server? [0/1]> ");
-       scanf("%d", &sync_server);
-
-       test_mail_data->account_id        = account_id;
-       test_mail_data->save_status       = 1;
-       test_mail_data->flags_seen_field  = 1;
-       test_mail_data->file_path_plain   = strdup(body_file_path);
-       test_mail_data->mailbox_name      = strdup(mailbox_data->name);
-       test_mail_data->mailbox_type      = mailbox_data->mailbox_type;
-       test_mail_data->full_address_from = strdup("<test1@test.com>");
-       test_mail_data->full_address_to   = strdup("<test2@test.com>"); 
-       test_mail_data->full_address_cc   = strdup("<test3@test.com>");
-       test_mail_data->full_address_bcc  = strdup("<test4@test.com>");
-       test_mail_data->subject           = strdup("Meeting request mail");
+       scanf("%d", &from_eas);
+
+       test_mail_data->account_id           = account_id;
+       test_mail_data->save_status          = 1;
+       test_mail_data->body_download_status = 1;
+       test_mail_data->flags_seen_field     = 1;
+       test_mail_data->file_path_plain      = strdup(body_file_path);
+       test_mail_data->mailbox_name         = strdup(mailbox_data->name);
+       test_mail_data->mailbox_type         = mailbox_data->mailbox_type;
+       test_mail_data->full_address_from    = strdup("<test1@test.com>");
+       test_mail_data->full_address_to      = strdup("<test2@test.com>");
+       test_mail_data->full_address_cc      = strdup("<test3@test.com>");
+       test_mail_data->full_address_bcc     = strdup("<test4@test.com>");
+       test_mail_data->subject              = strdup("Meeting request mail");
 
        body_file = fopen(body_file_path, "w");
+
+       testapp_print("\n body_file [%p]\n", body_file);
+
+       if(body_file == NULL) {
+               testapp_print("\n fopen [%s]failed\n", body_file_path);
+               return FALSE;
+       }
                
        for(i = 0; i < 500; i++)
                fprintf(body_file, "X2 X2 X2 X2 X2 X2 X2");
        fflush(body_file);
-  fclose(body_file);
+       fclose(body_file);
        
        testapp_print(" > Attach file? [0/1] : ");
        scanf("%d",&attachment_count);
@@ -339,11 +214,16 @@ static gboolean testapp_test_add_mail ()
 
        }
        
-       if((err = email_add_mail(test_mail_data, attachment_data, attachment_count, meeting_req, sync_server)) != EMF_ERROR_NONE)
+       if((err = email_add_mail(test_mail_data, attachment_data, attachment_count, meeting_req, from_eas)) != EMF_ERROR_NONE)
                testapp_print("email_add_mail failed. [%d]\n", err);
        else
                testapp_print("email_add_mail success.\n");
 
+       testapp_print("saved mail id = [%d]\n", test_mail_data->mail_id);
+
+       if(result_mail_id)
+               *result_mail_id = test_mail_data->mail_id;
+
        if(attachment_data)
                email_free_attachment_data(&attachment_data, attachment_count);
                
@@ -352,8 +232,6 @@ static gboolean testapp_test_add_mail ()
                
        email_free_mail_data(&test_mail_data, 1);
        email_free_mailbox(&mailbox_data, 1);
-       
-       testapp_print("saved mail id = [%d]\n", test_mail_data->mail_id);
 
        return FALSE;
 }
@@ -378,8 +256,6 @@ static gboolean testapp_test_update_mail()
 
        test_mail_data->subject= strdup(arg);
 
-       
-
        if (test_mail_data->attachment_count > 0) {
                if ( (err = email_get_attachment_data_list(mail_id, &test_attachment_data_list, &test_attachment_data_count)) != EMF_ERROR_NONE ) {
                        testapp_print("email_get_meeting_request() failed [%d]\n", err);
@@ -417,445 +293,137 @@ static gboolean testapp_test_update_mail()
        return TRUE;
 }
 
-
-static gboolean testapp_test_save_mail ()
+static gboolean testapp_test_get_mails()
 {
-       int account_id=0;
-       int i, j, from_composer = 0, mail_count = 0;
-       int attach_num = 0;
-       int err;
-       emf_mailbox_t *mailbox = NULL;
-       emf_mail_t *mail = malloc(sizeof(emf_mail_t));
-       emf_attachment_info_t attachment;
-       char arg[50], *temp_string_1 = NULL, *temp_string_2 = NULL, temp_address[512] = {0, };
-       emf_meeting_request_t *meeting_req = NULL;
-
-       testapp_print("\n > Enter account no:");
-       scanf("%d", &account_id);
-       memset(mail, 0x00, sizeof(emf_mail_t));
-       mail->info = malloc(sizeof(emf_mail_info_t));
-       memset(mail->info, 0x00, sizeof(emf_mail_info_t));
-       mail->info->account_id = account_id;
-       mail->info->extra_flags.text_download_yn = 1;
-       mail->info->flags.seen = 1;
-       mail->info->account_id = account_id;
-
-       mail->head = malloc(sizeof(emf_mail_head_t));
-       memset(mail->head, 0x00, sizeof(emf_mail_head_t));
-       
-       mail->body = malloc(sizeof(emf_mail_body_t));
-       memset(mail->body, 0x00, sizeof(emf_mail_body_t));
-       
-       FILE *pFile;
-    char *pFilePath = "/opt/data/email/.emfdata/tmp/mail.txt";
-    
-       mail->body->plain = strdup(pFilePath);
-
-       mailbox = malloc(sizeof(emf_mailbox_t));
-       memset(mailbox, 0x00, sizeof(emf_mailbox_t));
-
-       memset(arg, 0x00, 50);
-       testapp_print("\n > Enter Mailbox:");
-       scanf("%s", arg);       
-               
-       mailbox->name = strdup(arg);
-       mailbox->account_id = account_id;
-       
-       testapp_print(" Attach file 1/0 > ");
-       scanf("%d",&attach_num);
-       if ( attach_num )  {
-               memset(&attachment, 0x00, sizeof(emf_attachment_info_t));
-               memset(arg, 0x00, 50);
-               testapp_print("\n > Enter attachment name: ");
-               scanf("%s",arg);
-               
-               attachment.name = strdup(arg);
-               
-               memset(arg, 0x00, 50);
-               testapp_print("\n > Enter attachment absolute path: ");
-               scanf("%s",arg);                
-               
-               attachment.savename = strdup(arg);
-               attachment.downloaded = 1;
-               attachment.next = NULL;
-               
-               mail->body->attachment = &attachment;
-               mail->body->attachment_num = attach_num;
-       }
-       /* set flag1 as seen */
-       
-       
-       testapp_print("\n From composer? (0/1)> ");
-       scanf("%d", &from_composer);
-
-       testapp_print("\n mail count? (n)> ");
-       scanf("%d", &mail_count);
-       
-       testapp_print("\n > Meeting Request? (0: no, 1: yes (request from server), 2: yes (response from local) )");
-       scanf("%d", &(mail->info->is_meeting_request));
-       if ( mail->info->is_meeting_request == 1 
-               || mail->info->is_meeting_request == 2 ) {
-               time_t current_time;
-
-               mail->head->from = strdup("<test@test.com>");
-               mail->head->to   = strdup("\"ActiveSync8\" <ActiveSync8@test.local>"); 
-               mail->head->cc   = strdup("<bapina@gawab.com>");
-               mail->head->bcc  = strdup("<tom@gmail.com>");
-               
-               mail->head->subject = strdup("save.mailbox...........");
-
-               /*  dummy data for meeting request */
-               meeting_req = malloc(sizeof(emf_meeting_request_t));
-               memset(meeting_req, 0x00, sizeof(emf_meeting_request_t));
-               
-               meeting_req->meeting_response = 1;
-               current_time = time(NULL);
-               gmtime_r(&current_time, &(meeting_req->start_time));
-               gmtime_r(&current_time, &(meeting_req->end_time));
-               meeting_req->location = malloc(strlen("Seoul") + 1);
-               memset(meeting_req->location, 0x00, strlen("Seoul") + 1);
-               strcpy(meeting_req->location, "Seoul");
-               strcpy(meeting_req->global_object_id, "abcdef12345");
-
-               meeting_req->time_zone.offset_from_GMT = 9;
-               strcpy(meeting_req->time_zone.standard_name, "STANDARD_NAME");
-               gmtime_r(&current_time, &(meeting_req->time_zone.standard_time_start_date));
-               meeting_req->time_zone.standard_bias = 3;
-               
-               strcpy(meeting_req->time_zone.daylight_name, "DAYLIGHT_NAME");
-               gmtime_r(&current_time, &(meeting_req->time_zone.daylight_time_start_date));
-               meeting_req->time_zone.daylight_bias = 7;
-
-               if((err = email_add_message_with_meeting_request(mail, mailbox, meeting_req, from_composer)) < 0)
-                       testapp_print("email_add_message failed. [%d]\n", err);
-               else
-                       testapp_print("email_add_message success\n");
-       }
-       else {
-               mail->info->is_meeting_request = 0;
-
-               for(j = 0; j < mail_count; j++) {
-                       pFile = fopen(pFilePath, "w");
-                       for(i = 0; i < 500; i++)
-                       fprintf(pFile, "X2 X2 X2 X2 X2 X2 X2");
-                       fflush(pFile);
-                   fclose(pFile);
-
-                       temp_string_1 = testapp_test_generate_random_string(128);
-                       temp_string_2 = testapp_test_generate_random_string(128);
-                       if(temp_string_1 && temp_string_2) {
-                               snprintf(temp_address, 512, "<%s@%s.com>", temp_string_1, temp_string_2);
-                               free(temp_string_1);
-                               free(temp_string_2);
-                               temp_string_1 = NULL;
-                               temp_string_2 = NULL;
-                       }
-
-                       mail->head->from = strdup(temp_address);
-
-                       temp_string_1 = testapp_test_generate_random_string(128);
-                       temp_string_2 = testapp_test_generate_random_string(128);
-                       if(temp_string_1 && temp_string_2) {
-                               snprintf(temp_address, 512, "<%s@%s.com>", temp_string_1, temp_string_2);
-                               free(temp_string_1);
-                               free(temp_string_2);
-                               temp_string_1 = NULL;
-                               temp_string_2 = NULL;
-
-                       }
-
-                       mail->head->to   = strdup(temp_address);
-
-                       temp_string_1 = testapp_test_generate_random_string(128);
-                       temp_string_2 = testapp_test_generate_random_string(128);
-                       if(temp_string_1 && temp_string_2) {
-                               snprintf(temp_address, 512, "<%s@%s.com>", temp_string_1, temp_string_2);
-                               free(temp_string_1);
-                               free(temp_string_2);
-                               temp_string_1 = NULL;
-                               temp_string_2 = NULL;
-                       }
-
-                       mail->head->cc   = strdup(temp_address);
-                       
-                       temp_string_1 = testapp_test_generate_random_string(128);
-                       temp_string_2 = testapp_test_generate_random_string(128);
-                       if(temp_string_1 && temp_string_2) {
-                               snprintf(temp_address, 512, "<%s@%s.com>", temp_string_1, temp_string_2);
-                               free(temp_string_1);
-                               free(temp_string_2);
-                               temp_string_1 = NULL;
-                               temp_string_2 = NULL;
-                       }
-
-                       mail->head->bcc  = strdup(temp_address);
-                       
-                       mail->head->subject = testapp_test_generate_random_string(128);
-
-                       if((err = email_add_message(mail, mailbox, from_composer)) < 0)
-                               testapp_print("email_add_message failed. [%d]\n", err);
-                       else {
-                               testapp_print("email_add_message success [%d/%d]\n", j, mail_count);
-                               if(attach_num) {
-                                       testapp_print("attachment id[%d]\n", mail->body->attachment->attachment_id);
-                               }
-                       }
-                       if(mail->head->from) free(mail->head->from);
-                       if(mail->head->to) free(mail->head->to);
-                       if(mail->head->cc) free(mail->head->cc);
-                       if(mail->head->bcc) free(mail->head->bcc);
-                       if(mail->head->subject) free(mail->head->subject);
-               }
-       }
-
-       testapp_print("saved mail id = [%d]\n", mail->info->uid);
-
-       return FALSE;
-}
-
-
-static gboolean testapp_test_mail_send ()
-{
-       FILE *fp;
-       emf_mailbox_t mbox;
-       emf_mail_t *mail = malloc(sizeof(emf_mail_t));
-       emf_mail_head_t *head = malloc(sizeof(emf_mail_head_t));
-       emf_mail_body_t *body = malloc(sizeof(emf_mail_body_t));
-       char arg[4096];
-       int i=0;
+       testapp_print("\n >>> testapp_test_get_mails : Entered \n");
+       emf_mail_data_t *mails = NULL, **mails_pointer = NULL;
+       char mailbox_name[50] = { 0, };
+       int count = 0, i = 0;
        int account_id = 0;
-       emf_option_t option;
-       emf_attachment_info_t attachment;
-       int attach_num = 0;
-       int err = EMF_ERROR_NONE;;
-       
-       memset(&option, 0x00, sizeof(emf_option_t));
+       int start_index =0;
+       int limit_count = 0;
+       int sorting = 0;
+       int err_code = EMF_ERROR_NONE;
+       int to_get_count = 0;
+       int is_for_thread_view = 0;
+       int list_type;
+       struct tm *temp_time_info;
 
-       memset(mail, 0x00, sizeof(emf_mail_t));
-       memset(head, 0x00, sizeof(emf_mail_head_t));
-       memset(body, 0x00, sizeof(emf_mail_body_t));
+       testapp_print("\n > Enter Account_id (0 = all accounts) : ");
+       scanf("%d",&account_id);
 
-       memset(arg, 0x00, 4096);
-       testapp_print("   mail to> ");
-       scanf("%s",arg);
+       testapp_print("\n > Enter Mailbox name (0 = all mailboxes) :");
+       scanf("%s", mailbox_name);
 
-       if(arg[0]=='\0' || !strstr(arg, "@")) {
-               printf("   invalid argument");
-               return false;
-       }
-       
-       for(i=0; i<strlen(arg); i++) {
-               if(arg[i]==';') arg[i] = ',';
-       }
-       head->to = malloc(strlen(arg)+1); 
-       strcpy(head->to, arg);
+       testapp_print("\n > Enter Sorting : ");
+       scanf("%d",&sorting);
 
-       head->from = strdup("<tom@gmail.com>");
+       testapp_print("\n > Enter Start index : ");
+       scanf("%d",&start_index);
 
-       /* head->to = strdup("&quot;test09&quot; <+ test09@gmail.com>"); */
+       testapp_print("\n > Enter max_count : ");
+       scanf("%d",&limit_count);
 
-       memset(arg, 0x00, 4096);
-       testapp_print("   input subject> ");
-       scanf("%s",arg);
-               
-       if(arg[0]=='\0') {
-               printf("   invalid argument");
-               return FALSE;
-       }
-       head->subject = malloc(strlen(arg)+1); 
-       strcpy(head->subject, arg);
+       testapp_print("\n > For thread view : ");
+       scanf("%d",&is_for_thread_view);
 
-       testapp_print("mail account_id >");
-       scanf("%d",&account_id);
-       
-       memset(arg, 0x00, 4096);
-       testapp_print("   input body> ");
-       scanf("%s",arg);
-       
-       if(arg[0]=='\0') {
-               printf("   invalid argument");
-               return FALSE;
-       }
+       testapp_print("\n > To get count : ");
+       scanf("%d",&to_get_count);
 
-       fp = fopen(MAIL_TEMP_BODY, "w+");
-       fprintf(fp, arg);
-       fclose(fp);
-       body->plain = strdup(MAIL_TEMP_BODY);
-       mail->body = body;
-       mail->head = head;
-       mail->info = malloc(sizeof(emf_mail_info_t));
-       memset(mail->info, 0x00, sizeof(emf_mail_info_t));
-       mail->info->account_id = account_id;
-       mail->info->flags.draft = 1;
-       mail->info->extra_flags.priority = 4;
-
-       /* set flag1 as seen */
-       mail->info->flags.seen = 1;
-       testapp_print("\n > mail->info->flags:%d \n",mail->info->flags);
-       
-       memset(&mbox, 0x00, sizeof(emf_mailbox_t));
-       mbox.account_id = account_id;
-       mbox.name = strdup("OUTBOX");
-
-       testapp_print(" Attach file 1/0 > ");
-       scanf("%d",&attach_num);
-       if ( attach_num ) {
-               memset(&attachment, 0x00, sizeof(emf_attachment_info_t));
-               memset(arg, 0x00, 4096);
-               testapp_print("\n > Enter attachment name: ");
-               scanf("%s",arg);
-               
-               attachment.name = strdup(arg);
-               
-               memset(arg, 0x00, 4096);
-               testapp_print("\n > Enter attachment absolute path: ");
-               scanf("%s",arg);                
+       if(to_get_count)
+               mails_pointer = NULL;
+       else
+               mails_pointer = &mails;
 
-               attachment.savename = strdup(arg);
-               attachment.next = NULL;
-               
-               mail->body->attachment = &attachment;
-               mail->body->attachment_num = attach_num;
+       if(is_for_thread_view == -2) {
+               list_type = EMF_LIST_TYPE_LOCAL;
        }
-
-       if(email_add_message(mail, &mbox, 1) < 0) {
-               testapp_print("email_add_message failed[%d]\n", err);
-               return FALSE;
-       } 
+       else if(is_for_thread_view == -1)
+               list_type = EMF_LIST_TYPE_THREAD;
        else
-               testapp_print("email_add_message success\n");
+               list_type = EMF_LIST_TYPE_NORMAL;
 
-       testapp_print("   sending...\n");
+       /* Get mail list */
+       if(strcmp(mailbox_name, "0") == 0) {
+               testapp_print("Calling email_get_mail_list_ex for all mailbox.\n");
+               err_code = email_get_mails(account_id, NULL, list_type, start_index, limit_count, sorting, mails_pointer, &count);
+               if ( err_code < 0)
+                       testapp_print("email_get_mails failed - err[%d]\n", err_code);
+       }
+       else {
+               testapp_print("Calling email_get_mail_list_ex for %s mailbox.\n", mailbox_name);
+               err_code = email_get_mails(account_id, mailbox_name, list_type, start_index, limit_count, sorting,  mails_pointer, &count);
+               if ( err_code < 0)
+                       testapp_print("email_get_mails failed - err[%d]\n", err_code);
+       }
+       testapp_print("email_get_mails >>>>>>count - %d\n",count);
 
-       unsigned handle = 0;
-       option.keep_local_copy = 1;
-       
-       if( email_send_mail(&mbox, mail->info->uid, &option, &handle) < 0) {
-               testapp_print("   fail sending [%d]\n", err);
-       } 
-       else  {
-               testapp_print("   finish sending. handle[%d]\n", handle);
+       if (mails) {
+               for (i=0; i< count; i++) {
+                       testapp_print("\n[%d]\n", i);
+                       testapp_print(" >>> mailbox_name [ %s ] \n", mails[i].mailbox_name);
+                       testapp_print(" >>> mail_id [ %d ] \n", mails[i].mail_id);
+                       testapp_print(" >>> account_id [ %d ] \n", mails[i].account_id);
+                       if (  mails[i].full_address_from != NULL )
+                               testapp_print(" >>> full_address_from [ %s ] \n", mails[i].full_address_from);
+                       if (  mails[i].full_address_to != NULL )
+                               testapp_print(" >>> recipients [ %s ] \n", mails[i].full_address_to);
+                       if (  mails[i].subject != NULL )
+                               testapp_print(" >>> subject [ %s ] \n", mails[i].subject);
+                       testapp_print(" >>> body_download_status [ %d ] \n", mails[i].body_download_status);
+                       temp_time_info = localtime(&mails[i].date_time);
+                       testapp_print(" >>> date_time [ %d/%d/%d %d:%d:%d] \n", temp_time_info->tm_year + 1970, temp_time_info->tm_mon, temp_time_info->tm_mday, temp_time_info->tm_hour, temp_time_info->tm_min, temp_time_info->tm_sec);
+                       testapp_print(" >>> flags_seen_field [ %d ] \n", mails[i].flags_seen_field);
+                       testapp_print(" >>> priority [ %d ] \n", mails[i].priority);
+                       testapp_print(" >>> save_status [ %d ] \n", mails[i].save_status);
+                       testapp_print(" >>> lock_status [ %d ] \n", mails[i].lock_status);
+                       testapp_print(" >>> attachment_count [ %d ] \n", mails[i].attachment_count);
+                       if (  mails[i].preview_text != NULL )
+                               testapp_print(" >>> previewBodyText [ %s ] \n", mails[i].preview_text);
+               }
+               free(mails);
        }
 
-       return FALSE;
+       testapp_print(" >>> testapp_test_get_mails : End \n");
+       return 0;
 }
 
-static gboolean testapp_test_send_test (int *MailId)
-{
-
-       FILE *fp;
-       emf_mailbox_t mbox;
-       emf_mail_t *mail = malloc(sizeof(emf_mail_t));
-       emf_mail_head_t *head = malloc(sizeof(emf_mail_head_t));
-       emf_mail_body_t *body = malloc(sizeof(emf_mail_body_t));
-       char arg[4096];
-       int i=0;
-       int account_id = 0;
-       emf_option_t option;
-       emf_attachment_info_t attachment;
-       int attach_num = 0;
-       int err = EMF_ERROR_NONE;;
-       
-       memset(&option, 0x00, sizeof(emf_option_t));
+#define TEMP_ARGUMENT_SIZE 4096
 
-       memset(mail, 0x00, sizeof(emf_mail_t));
-       memset(head, 0x00, sizeof(emf_mail_head_t));
-       memset(body, 0x00, sizeof(emf_mail_body_t));
+static gboolean testapp_test_mail_send (int *result_mail_id)
+{
+       int                    added_mail_id = 0;
+       int                    err = EMF_ERROR_NONE;
+       unsigned               handle = 0;
+       emf_option_t           option = { 0 };
+       emf_mailbox_t          mailbox_data = { 0 };
+       emf_mail_data_t       *result_mail_data = NULL;
 
-       memset(arg, 0x00, 4096);
-       testapp_print("   mail to> ");
-       scanf("%s",arg);
-       
-       if(arg[0]=='\0' || !strstr(arg, "@")){
-               printf("   invalid argument");
-               return false;
-       }
+       testapp_test_add_mail(&added_mail_id);
        
-       for(i=0; i<strlen(arg); i++){
-               if(arg[i]==';') arg[i] = ',';
-       }
-       head->to = malloc(strlen(arg)+1); 
-       strcpy(head->to, arg);
+       if(result_mail_id) {
+               email_get_mail_data(added_mail_id, &result_mail_data);
 
-       memset(arg, 0x00, 4096);
-       testapp_print("   input subject> ");
-       scanf("%s",arg);
-               
-       if(arg[0]=='\0'){
-               printf("   invalid argument");
-               return FALSE;
-       }
-       head->subject = malloc(strlen(arg)+1); 
-       strcpy(head->subject, arg);
+               memset(&mailbox_data, 0x00, sizeof(emf_mailbox_t));
+               mailbox_data.account_id  = result_mail_data->account_id;
+               mailbox_data.name        = result_mail_data->mailbox_name;
+               option.keep_local_copy   = 1;
 
-       testapp_print("mail account_id >");
-       scanf("%d",&account_id);
-       
-       memset(arg, 0x00, 4096);
-       testapp_print("   input body> ");
-       scanf("%s",arg);
-       
-       if(arg[0]=='\0'){
-               printf("   invalid argument");
-               return FALSE;
-       }
+               testapp_print("Calling email_send_mail...\n");
 
-       fp = fopen(MAIL_TEMP_BODY, "w+");
-       fprintf(fp, arg);
-       fclose(fp);
-       body->plain = strdup(MAIL_TEMP_BODY);
-       mail->body = body;
-       mail->head = head;
-       mail->info = malloc(sizeof(emf_mail_info_t));
-       memset(mail->info, 0x00, sizeof(emf_mail_info_t));
-       mail->info->account_id = account_id;
-       mail->info->flags.draft = 1;
-       
-       /* set flag1 as seen */
-       mail->info->flags.seen = 1;
-       testapp_print("\n > mail->info->flags:%d \n",mail->info->flags);
-       
-       memset(&mbox, 0x00, sizeof(emf_mailbox_t));
-       mbox.account_id = account_id;
-       mbox.name = strdup("OUTBOX");
-
-       testapp_print(" Attach file 1/0 > ");
-       scanf("%d",&attach_num);
-       if ( attach_num ) {
-               memset(&attachment, 0x00, sizeof(emf_attachment_info_t));
-               memset(arg, 0x00, 4096);
-               testapp_print("\n > Enter attachment name: ");
-               scanf("%s",arg);
-               
-               attachment.name = strdup(arg);
-               
-               memset(arg, 0x00, 4096);
-               testapp_print("\n > Enter attachment absolute path: ");
-               scanf("%s",arg);                
+               if( email_send_mail(&mailbox_data, added_mail_id, &option, &handle) < 0) {
+                       testapp_print("Sending failed[%d]\n", err);
+               }
+               else  {
+                       testapp_print("Start sending. handle[%d]\n", handle);
+               }
 
-               attachment.savename = strdup(arg);
-               attachment.next = NULL;
-               
-               mail->body->attachment = &attachment;
-               mail->body->attachment_num = attach_num;
+               email_free_mail_data(&result_mail_data, 1);
        }
 
-       if(email_add_message(mail, &mbox, 1) < 0) {
-               testapp_print("email_add_message failed[%d]\n", err);
-               return FALSE;
-       } 
-       else
-               testapp_print("email_add_message success\n");
-
-       testapp_print("   sending...\n");
+       if(result_mail_id)
+               *result_mail_id = added_mail_id;
 
-       unsigned handle = 0;
-       option.keep_local_copy = 1;
-       email_send_mail(&mbox, mail->info->uid, &option, &handle);
-       *MailId = mail->info->uid;
-       testapp_print("*MailId[%d]\n",*MailId);
-       printf("*MailId[%d]\n",*MailId);
-       testapp_print("handle[%d]\n", handle);
        return FALSE;
 }
 
@@ -875,7 +443,7 @@ static gboolean testapp_test_send_cancel ()
                return false ;
        
        for(i = 1;i <=num ; i++) {
-               testapp_test_send_test(&mail_id);
+               testapp_test_mail_send(&mail_id);
                
                testapp_print("mail_id[%d]",mail_id);
 
@@ -898,171 +466,6 @@ static gboolean testapp_test_send_cancel ()
        return FALSE;
 }
 
-static gboolean testapp_test_send_mail_with_option ()
-{
-       FILE *fp;
-       emf_mailbox_t mbox;
-       emf_mail_t *mail = malloc(sizeof(emf_mail_t));
-       emf_mail_head_t *head = malloc(sizeof(emf_mail_head_t));
-       emf_mail_body_t *body = malloc(sizeof(emf_mail_body_t));
-       char arg[4096];
-       int i=0;
-       int account_id = 0;
-       emf_option_t option;
-       emf_attachment_info_t attachment;
-       int attach_num = 0;     
-       
-       memset(&option, 0x00, sizeof(emf_option_t));
-
-       memset(mail, 0x00, sizeof(emf_mail_t));
-       memset(head, 0x00, sizeof(emf_mail_head_t));
-       memset(body, 0x00, sizeof(emf_mail_body_t));
-
-       memset(arg, 0x00, 4096);
-       testapp_print("   mail to> ");
-       scanf("%s",arg);
-       if(arg[0]=='\0' || !strstr(arg, "@")){
-               printf("   invalid argument");
-               return false;
-       }
-       for(i=0; i<strlen(arg); i++){
-               if(arg[i]==';') arg[i] = ',';
-       }
-       head->to = malloc(strlen(arg)+1); 
-       strcpy(head->to, arg);
-
-       memset(arg, 0x00, 4096);
-       testapp_print("   input subject> ");
-       scanf("%s",arg);
-               
-       if(arg[0]=='\0'){
-               printf("   invalid argument");
-               return FALSE;
-       }
-       head->subject = malloc(strlen(arg)+1); 
-       strcpy(head->subject, arg);
-
-       testapp_print("mail account_id >");
-       scanf("%d",&account_id);
-       
-       memset(arg, 0x00, 4096);
-       testapp_print("   input body> ");
-       scanf("%s",arg);
-       
-       if(arg[0]=='\0'){
-               printf("   invalid argument");
-               return FALSE;
-       }
-
-       fp = fopen(MAIL_TEMP_BODY, "w+");
-       fprintf(fp, arg);
-       fclose(fp);
-       body->plain = strdup(MAIL_TEMP_BODY);
-       mail->body = body;
-       mail->head = head;
-       mail->info = malloc(sizeof(emf_mail_info_t));
-       memset(mail->info, 0x00, sizeof(emf_mail_info_t));
-       mail->info->account_id = account_id;
-       mail->info->flags.draft = 1;
-       
-       /* set flag1 as seen */
-       mail->info->flags.seen = 1;
-       testapp_print("\n > mail->info->flags:%d ",mail->info->flags);
-       
-       memset(&mbox, 0x00, sizeof(emf_mailbox_t));
-       mbox.account_id = account_id;
-       mbox.name = strdup("OUTBOX");
-
-       testapp_print(" Attach file 1/0 > ");
-       scanf("%d",&attach_num);
-       if ( attach_num ) {
-               memset(&attachment, 0x00, sizeof(emf_attachment_info_t));
-               memset(arg, 0x00, 4096);
-               testapp_print("\n > Enter attachment name: ");
-               scanf("%s",arg);
-               
-               attachment.name = strdup(arg);
-               
-               memset(arg, 0x00, 4096);
-               testapp_print("\n > Enter attachment absolute path: ");
-               scanf("%s",arg);                
-
-               attachment.savename = strdup(arg);
-               attachment.next = NULL;
-               
-               mail->body->attachment = &attachment;
-               mail->body->attachment_num = attach_num;
-       }
-
-       testapp_print("Keep local copy? (1=true, 0=false)");
-       scanf("%d",&option.keep_local_copy);
-
-       testapp_print("Request  delivery  receipt? (1=true, 0=false)");
-       scanf("%d",&option.req_delivery_receipt);
-
-       testapp_print("Request read receipt? (1=true, 0=false)");
-       scanf("%d",&option.req_read_receipt);
-
-       if(email_add_message(mail, &mbox, 1) < 0) {
-               testapp_print("email_add_message failed\n");
-       } 
-       else
-               testapp_print("email_add_message success\n");
-
-       testapp_print("   sending...\n");
-
-       unsigned handle = 0;
-
-       
-       if(email_send_mail(&mbox, mail->info->uid, &option, &handle) < 0) {
-               testapp_print("   fail sending\n");
-       } else {
-               testapp_print("   finish sending\n");
-               testapp_print("handle[%d]\n", handle);
-       }
-
-       return FALSE;
-}
-       
-static gboolean testapp_test_download()
-{
-       
-       emf_mailbox_t mbox;
-       int account_id = 0;
-       char arg[50];
-       unsigned handle = 0;    
-       testapp_print("\n > Enter Account id (0: for all account) : ");
-       scanf("%d",&account_id);
-
-       memset(arg, 0x00, 50);
-       testapp_print("\n > Enter Mailbox name (ALL: for all mailboxes) : ");
-       scanf("%s",arg);
-
-       memset(&mbox, 0x00, sizeof(emf_mailbox_t));
-       
-       mbox.account_id = account_id;
-
-       if(strcmp("ALL", arg) == 0)
-               mbox.name = NULL;
-       else
-               mbox.name = strdup(arg);
-
-       if(account_id == ALL_ACCOUNT) {
-               if(email_sync_header_for_all_account(&handle) < 0)
-                       testapp_print("\n email_sync_header_for_all_account failed\n");
-               else
-                       testapp_print("\n email_sync_header_for_all_account success. Handle[%d]\n", handle);
-       }
-       else {
-               if(email_sync_header(&mbox,&handle) < 0)
-                       testapp_print("\n email_sync_header failed\n");
-               else
-                       testapp_print("\n email_sync_header success. Handle[%d]\n", handle);
-       }
-               
-       return FALSE;
-}
-
 static gboolean testapp_test_delete()
 {
        int mail_id=0, account_id =0;
@@ -1099,68 +502,7 @@ static gboolean testapp_test_delete()
        return FALSE;
 }
 
-static gboolean testapp_test_get_mailbox_list ()
-{
-
-       int account_id =0;
-       int mailbox_sync_type;
-       int count = 0;
-       int i = 0, error_code = EMF_ERROR_NONE;
-       emf_mailbox_t *mailbox_list=NULL;
-       testapp_print("\n > Enter account id: ");
-       scanf("%d", &account_id);
-       testapp_print("\n > Enter mailbox_sync_type\n[-1 :for all mailboxes, 0 : for mailboxes from server, 1 : local mailboxes\n : ");
-       scanf("%d", &mailbox_sync_type);
-
-       if((error_code = email_get_mailbox_list(account_id, mailbox_sync_type, &mailbox_list, &count)) < 0) {
-               testapp_print("   email_get_mailbox_list error %d\n", error_code);
-               return false ;
-       }
-
-       testapp_print("There are %d mailboxes\n", count);
-
-       testapp_print("============================================================================\n");
-       testapp_print("number\taccount_id\t name\t\t alias\t local_yn\t unread\tmailbox_type\t has_archived_mails\n");
-       testapp_print("============================================================================\n");
-       if ( count == 0 ) {
-               testapp_print("No mailbox is matched\n");
-       }
-       else {
-               for(i=0;i<count;i++) {
-               testapp_print("[%d] - ", i);
-                       testapp_print(" %2d\t [%-15s]\t[%-15s]\t", mailbox_list[i].account_id, mailbox_list[i].name, mailbox_list[i].alias);
-                       testapp_print(" %d\t %d\t %d\n", mailbox_list[i].local, mailbox_list[i].unread_count,mailbox_list[i].mailbox_type, mailbox_list[i].has_archived_mails);
-               }
-       }
-       testapp_print("============================================================================\n");
-       /* EmfMailboxFree(emf_mailbox_t** mailbox_list, int count, int* err_code) */
-
-       if((error_code = email_get_mailbox_list_ex(account_id, mailbox_sync_type, 1, &mailbox_list, &count)) < 0) {
-               testapp_print("   email_get_mailbox_list_ex error %d\n", error_code);
-               return false ;
-       }
 
-       testapp_print("There are %d mailboxes\n", count);
-
-       testapp_print("============================================================================\n");
-       testapp_print("number\taccount_id\t name\t\t alias\t local_yn\t unread\t total\t total_on_ server\tmailbox_type\t has_archived_mails\n");
-       testapp_print("============================================================================\n");
-       if ( count == 0 ) {
-               testapp_print("No mailbox is matched\n");
-       }
-       else {
-               for(i=0;i<count;i++) {
-               testapp_print("[%d] - ", i);
-                       testapp_print(" %2d\t [%-15s]\t[%-15s]\t", mailbox_list[i].account_id, mailbox_list[i].name, mailbox_list[i].alias);
-                       testapp_print(" %d\t %d\t %d\t %d\t %d\t %d\n", mailbox_list[i].local, mailbox_list[i].unread_count, mailbox_list[i].total_mail_count_on_local, mailbox_list[i].total_mail_count_on_server, mailbox_list[i].mailbox_type, mailbox_list[i].has_archived_mails);
-               }
-       }
-       testapp_print("============================================================================\n");
-       testapp_print("Start to free\n");
-       
-       email_free_mailbox(&mailbox_list, count);
-       return FALSE;
-}
 
 static gboolean testapp_test_move()
 {
@@ -1245,99 +587,26 @@ static gboolean testapp_test_add_attachment()
        
        memset(arg, 0x00, 100);
        testapp_print("\n > Enter attachment absolute path: ");
-       scanf("%s",arg);                
-
-       attachment.downloaded = true;
-       attachment.savename = strdup(arg);
-       attachment.next = NULL;
-       if(email_add_attachment( &mbox, mail_id, &attachment) < 0)
-               testapp_print("email_add_attachment failed\n"); 
-       else
-               testapp_print("email_add_attachment success\n");
-
-
-       return FALSE;
-
-}
-static gboolean testapp_test_update()
-{
-       emf_mailbox_t mailbox;
-       emf_mail_t *mail = NULL;
-       int mail_id = 0;
-       int err = EMF_ERROR_NONE;
-       char arg[50];
-       
-       memset(&mailbox, 0x00, sizeof(emf_mailbox_t));
-       
-       testapp_print("\n > Enter Mail Id: ");
-       scanf("%d", &mail_id);
-
-       if (email_get_mail(&mailbox, mail_id, &mail) < 0) {     
-               testapp_print("email_get_mail failed\n");
-               return FALSE;
-       }
-
-       testapp_print("\n > Enter Subject: ");
-       scanf("%s", arg);       
-
-       mail->head->subject= strdup(arg);
-
-       if (mail->body && mail->body->attachment) {
-               emf_attachment_info_t* p = mail->body->attachment;
-               struct stat st_buf;
-               
-               while (p) {
-                       if (!p->savename || stat(p->savename, &st_buf) < 0) {
-                               testapp_print("\t stat(\"%s\" failed...\n", p->savename);
-                               
-                               err = EMF_ERROR_INVALID_PARAM;          /* TODO: confirm me */
-                               goto FINISH_OFF;
-                       }
-
-                       p->downloaded = 1;
-                       
-                       p = p->next;
-               }
-       }       
-
-       if ( mail->info->is_meeting_request == EMF_MAIL_TYPE_MEETING_REQUEST 
-               || mail->info->is_meeting_request == EMF_MAIL_TYPE_MEETING_RESPONSE 
-               || mail->info->is_meeting_request == EMF_MAIL_TYPE_MEETING_ORIGINATINGREQUEST) {
-               emf_meeting_request_t *meeting_req = NULL;
-               if ( (err = email_get_meeting_request(mail_id, &meeting_req)) < 0 ) {
-                       testapp_print("email_get_meeting_request() failed\n");
-                       return FALSE;
-               }
-       
-               testapp_print("\n > Enter meeting response: ");
-               scanf("%d", (int*)&(meeting_req->meeting_response));
-               if ( (err = email_update_message_with_meeting_request(mail_id, mail, meeting_req)) < 0) 
-                       testapp_print("email_update_message failed.[%d]\n", err);
-               else
-                       testapp_print("email_update_message success\n");
+       scanf("%s",arg);                
 
-               email_free_meeting_request(&meeting_req, 1);
-       }
-       else {
-               if (email_update_message(mail_id, mail) < 0)    
-                       testapp_print("email_update_message failed.[%d]\n", err);
-               else
-                       testapp_print("email_update_message success\n");
-       }
+       attachment.downloaded = true;
+       attachment.savename = strdup(arg);
+       attachment.next = NULL;
+       if(email_add_attachment( &mbox, mail_id, &attachment) < 0)
+               testapp_print("email_add_attachment failed\n"); 
+       else
+               testapp_print("email_add_attachment success\n");
 
-FINISH_OFF:
 
        return FALSE;
-       
+
 }
 
 static gboolean testapp_test_get_mail_list_ex()
 {
-       testapp_print(" >>> testapp_test_get_mail_list_ex : Entered \n");
+       testapp_print("\n >>> testapp_test_get_mail_list_ex : Entered \n");
        emf_mail_list_item_t *mail_list = NULL, **mail_list_pointer = NULL;
-       char mailbox_name[50];
+       char mailbox_name[50] = { 0, };
        int count = 0, i = 0;
        int account_id = 0;
        int start_index =0;
@@ -1347,13 +616,13 @@ static gboolean testapp_test_get_mail_list_ex()
        int to_get_count = 0;
        int is_for_thread_view = 0;
        int list_type;
-
-       memset(mailbox_name, 0x00, 10);
-       testapp_print("\n > Enter Mailbox name (0 = all mailboxes) :");
-               scanf("%s", mailbox_name);
+       struct tm *temp_time_info;
 
        testapp_print("\n > Enter Account_id (0 = all accounts) : ");
-       scanf("%d",&account_id);                
+       scanf("%d",&account_id);
+
+       testapp_print("\n > Enter Mailbox name (0 = all mailboxes) :");
+       scanf("%s", mailbox_name);
 
        testapp_print("\n > Enter Sorting : ");
        scanf("%d",&sorting);   
@@ -1411,8 +680,8 @@ static gboolean testapp_test_get_mail_list_ex()
                        if (  mail_list[i].subject != NULL )
                                testapp_print(" >>> subject [ %s ] \n", mail_list[i].subject);
                        testapp_print(" >>> is_text_downloaded [ %d ] \n", mail_list[i].is_text_downloaded);
-                       if (  mail_list[i].datetime != NULL )
-                               testapp_print(" >>> datetime [ %s ] \n", mail_list[i].datetime);
+                       temp_time_info = localtime(&mail_list[i].date_time);
+                       testapp_print(" >>> date_time [ %d/%d/%d %d:%d:%d] \n", temp_time_info->tm_year + 1970, temp_time_info->tm_mon, temp_time_info->tm_mday, temp_time_info->tm_hour, temp_time_info->tm_min, temp_time_info->tm_sec);
                        testapp_print(" >>> flags_seen_field [ %d ] \n", mail_list[i].flags_seen_field);
                        testapp_print(" >>> priority [ %d ] \n", mail_list[i].priority);
                        testapp_print(" >>> save_status [ %d ] \n", mail_list[i].save_status);
@@ -1424,7 +693,7 @@ static gboolean testapp_test_get_mail_list_ex()
                free(mail_list);
        }
        
-       testapp_print(" >>> email_get_mail_list_ex : End \n");
+       testapp_print("\n >>> email_get_mail_list_ex : End \n");
        return 0;
 }
 
@@ -1436,6 +705,7 @@ static gboolean testapp_test_get_mail_list_for_thread_view()
        int count = 0, i = 0;
        int account_id = 0;
        int err_code = EMF_ERROR_NONE;
+       struct tm *time_info;
 
        /* Get mail list */
        if ( email_get_mail_list_ex(account_id, NULL , EMF_LIST_TYPE_THREAD, 0, 500, EMF_SORT_DATETIME_HIGH, &mail_list, &count) < 0)  {
@@ -1453,7 +723,8 @@ static gboolean testapp_test_get_mail_list_for_thread_view()
                        testapp_print(" >>> recipients [ %s ] \n", mail_list[i].recipients);
                        testapp_print(" >>> subject [ %s ] \n", mail_list[i].subject);
                        testapp_print(" >>> is_text_downloaded [ %d ] \n", mail_list[i].is_text_downloaded);
-                       testapp_print(" >>> datetime [ %s ] \n", mail_list[i].datetime);
+                       time_info = localtime(&mail_list[i].date_time);
+                       testapp_print(" >>> date_time [ %s ] \n", asctime(time_info));
                        testapp_print(" >>> flags_seen_field [ %d ] \n", mail_list[i].flags_seen_field);
                        testapp_print(" >>> priority [ %d ] \n", mail_list[i].priority);
                        testapp_print(" >>> save_status [ %d ] \n", mail_list[i].save_status);
@@ -1468,144 +739,6 @@ static gboolean testapp_test_get_mail_list_for_thread_view()
        testapp_print(" >>> testapp_test_get_mail_list_for_thread_view : End \n");
        return 0;
 }
-
-static gboolean        testapp_test_get ()
-{
-       
-       emf_mailbox_t mailbox;
-       emf_mail_t *mail = NULL;
-       int mail_id = 0;
-       int err = EMF_ERROR_NONE;
-       
-       memset(&mailbox, 0x00, sizeof(emf_mailbox_t));
-
-       testapp_print("\n > Enter Mail Id: ");
-       scanf("%d", &mail_id);
-
-       if ( (err = email_get_mail(&mailbox, mail_id, &mail)) < 0)
-               testapp_print("email_get_mail failed[%d]\n", err);
-       else {
-               testapp_print("email_get_mail success\n");
-               testapp_print("preview : [%s]\n", mail->head->previewBodyText);
-
-               emf_meeting_request_t *meeting_req = NULL;
-               testapp_print("mail->info->is_meeting_request[%d]\n", mail->info->is_meeting_request);
-               if ( mail->info->is_meeting_request != 0 ) {
-                       if ( (err = email_get_meeting_request(mail->info->uid, &meeting_req)) < 0 ) {
-                               testapp_print("email_get_meeting_request() failed[%d]\n", err);
-                       }
-                       else {
-                               testapp_print("email_get_meeting_request() success\n");
-                               testapp_print(">>>>> meeting_req->mail_id[%d]\n", meeting_req->mail_id);
-                               testapp_print(">>>>> meeting_req->meeting_response[%d]\n", meeting_req->meeting_response);
-                               testapp_print(">>>>> meeting_req->start_time[%s]\n", asctime(&(meeting_req->start_time)));
-                               testapp_print(">>>>> meeting_req->end_time[%s]\n", asctime(&(meeting_req->end_time)));
-                               testapp_print(">>>>> meeting_req->location[%s]\n", meeting_req->location);
-                               testapp_print(">>>>> meeting_req->global_object_id[%s]\n", meeting_req->global_object_id);
-                               testapp_print(">>>>> meeting_req->time_zone.offset_from_GMT[%d]\n", meeting_req->time_zone.offset_from_GMT);
-                               testapp_print(">>>>> meeting_req->time_zone.standard_name[%s]\n", meeting_req->time_zone.standard_name);
-                               testapp_print(">>>>> meeting_req->time_zone.standard_time_start_date[%s]\n", asctime(&(meeting_req->time_zone.standard_time_start_date)));
-                               testapp_print(">>>>> meeting_req->time_zone.standard_bias[%d]\n", meeting_req->time_zone.standard_bias);
-                               testapp_print(">>>>> meeting_req->time_zone.daylight_name[%s]\n", meeting_req->time_zone.daylight_name);
-                               testapp_print(">>>>> meeting_req->time_zone.daylight_time_start_date[%s]\n", asctime(&(meeting_req->time_zone.daylight_time_start_date)));
-                               testapp_print(">>>>> meeting_req->time_zone.daylight_bias[%d]\n", meeting_req->time_zone.daylight_bias);
-                       }
-               }
-
-               if ( meeting_req != NULL )
-                   email_free_meeting_request(&meeting_req, 1);
-       }
-
-       if ( mail )
-               email_free_mail(&mail, 1);
-               
-       return TRUE;
-}
-
-static gboolean testapp_test_get_info()
-{
-       emf_mailbox_t mailbox;
-       emf_mail_info_t *mail_info = NULL;
-       int mail_id = 0,account_id = 0;
-       
-       memset(&mailbox, 0x00, sizeof(emf_mailbox_t));
-
-       testapp_print("\n > Enter Mail Id: ");
-       scanf("%d", &mail_id);
-
-       testapp_print("\n > Enter account Id: ");
-       scanf("%d", &account_id);
-
-       mailbox.account_id = account_id;
-       if (email_get_info(&mailbox, mail_id, &mail_info) < 0)
-               testapp_print("email_get_info failed\n");
-       else    
-               testapp_print("email_get_info SUCCESS\n");
-
-       if (mail_info != NULL) {
-               em_core_mail_info_free(&mail_info, 1, NULL);
-       }
-       return TRUE;
-}
-
-
-static gboolean testapp_test_get_header ()
-{
-       emf_mailbox_t mailbox;
-       emf_mail_head_t *head = NULL;
-       int mail_id = 0,account_id = 0;
-       
-       memset(&mailbox, 0x00, sizeof(emf_mailbox_t));
-
-       testapp_print("\n > Enter Mail Id: ");
-       scanf("%d", &mail_id);
-
-       testapp_print("\n > Enter account Id: ");
-       scanf("%d", &account_id);
-
-       mailbox.account_id = account_id;
-
-       if ( email_get_header_info(&mailbox, mail_id, &head) < 0) {
-               testapp_print("email_get_header_info failed\n");
-               return FALSE;
-       }
-       else    
-               testapp_print("email_get_header_info SUCCESS\n");
-
-       if(head->subject)
-               testapp_print("\n subject : %s", head->subject);
-       if(head->from)
-               testapp_print("\n from : %s", head->from);
-       if(head->reply_to)
-               testapp_print("\n reply_to : %s", head->reply_to);
-
-       return TRUE;
-}
-
-static gboolean testapp_test_get_body ()
-{
-       emf_mailbox_t mailbox;
-       emf_mail_body_t *body = NULL;
-       int mail_id = 0,account_id = 0;
-       
-       memset(&mailbox, 0x00, sizeof(emf_mailbox_t));
-
-       testapp_print("\n > Enter Mail Id: ");
-       scanf("%d", &mail_id);
-
-       testapp_print("\n > Enter account Id: ");
-       scanf("%d", &account_id);
-
-       mailbox.account_id = account_id;
-
-       if ( email_get_body_info(&mailbox, mail_id, &body) < 0)
-               testapp_print("email_get_body_info failed\n");
-       else    
-               testapp_print("email_get_body_info SUCCESS\n");
-
-       return TRUE;
-}
 
 static gboolean testapp_test_count ()
 {
@@ -1854,128 +987,6 @@ static gboolean testapp_test_find()
        return TRUE;
 }
 
-static gboolean testapp_test_load_test_mail_send()
-{
-       FILE *fp;
-       emf_mailbox_t mbox;
-       emf_mail_t *mail = malloc(sizeof(emf_mail_t));
-       emf_mail_head_t *head = malloc(sizeof(emf_mail_head_t));
-       emf_mail_body_t *body = malloc(sizeof(emf_mail_body_t));
-       char arg[4096];
-       int i=0, count =0;
-       int account_id = 0;
-       emf_option_t option;
-       emf_attachment_info_t attachment;
-       int attach_num = 0;
-       int interval =0;
-       int no_of_tests=0;
-       memset(&option, 0x00, sizeof(emf_option_t));
-
-       memset(mail, 0x00, sizeof(emf_mail_t));
-       memset(head, 0x00, sizeof(emf_mail_head_t));
-       memset(body, 0x00, sizeof(emf_mail_body_t));
-        
-       memset(arg, 0x00, 4096);
-       testapp_print("   mail to> ");
-       scanf("%s",arg);
-       if(arg[0]=='\0' || !strstr(arg, "@")){
-               printf("   invalid argument");
-               return false;
-       }
-       for(i=0; i<strlen(arg); i++){
-               if(arg[i]==';') arg[i] = ',';
-       }
-       head->to = malloc(strlen(arg)+1); 
-       strcpy(head->to, arg);
-
-       memset(arg, 0x00, 4096);
-       testapp_print("   input subject> ");
-       scanf("%s",arg);
-               
-       if(arg[0]=='\0'){
-               printf("   invalid argument");
-               return FALSE;
-       }
-       head->subject = malloc(strlen(arg)+1); 
-       strcpy(head->subject, arg);
-
-       testapp_print("mail account_id >");
-       scanf("%d",&account_id);
-       
-       memset(arg, 0x00, 4096);
-       testapp_print("   input body> ");
-       scanf("%s",arg);
-       
-       if(arg[0]=='\0'){
-               printf("   invalid argument");
-               return FALSE;
-       }
-
-       fp = fopen(MAIL_TEMP_BODY, "w+");
-       fprintf(fp, arg);
-       fclose(fp);
-       body->plain = strdup(MAIL_TEMP_BODY);
-       mail->body = body;
-       mail->head = head;
-       mail->info = malloc(sizeof(emf_mail_info_t));
-       memset(mail->info, 0x00, sizeof(emf_mail_info_t));
-       mail->info->account_id = account_id;
-       mail->info->flags.draft = 1;
-       
-       memset(&mbox, 0x00, sizeof(emf_mailbox_t));
-       mbox.account_id = account_id;
-       /* mbox.name = strdup("Drafts"); */
-       mbox.name = strdup("DRAFTBOX");
-
-       testapp_print(" Attach file 1/0 > ");
-       scanf("%d",&attach_num);
-       if ( attach_num ) {
-               
-               memset(&attachment, 0x00, sizeof(emf_attachment_info_t));
-               memset(arg, 0x00, 4096);
-               testapp_print("\n > Enter attachment name: ");
-               scanf("%s",arg);
-               
-               attachment.name = strdup(arg);
-               
-               memset(arg, 0x00, 4096);
-               testapp_print("\n > Enter attachment absolute path: ");
-               scanf("%s",arg);                
-
-               attachment.savename = strdup(arg);
-               attachment.next = NULL;
-               
-               mail->body->attachment = &attachment;
-               mail->body->attachment_num = attach_num;
-       }
-
-       testapp_print("> Enter Number of tests: ");
-       scanf("%d",&no_of_tests);
-
-       testapp_print("> Enter time interval: ");
-       scanf("%d",&interval);
-       for(count=0;count<no_of_tests;count++)  {
-               if(email_add_message(mail, &mbox, 1) < 0) {
-                       testapp_print("email_add_message failed\n");
-               } 
-
-               testapp_print("   sending...\n");
-
-               unsigned handle = 0;
-               option.keep_local_copy = 1;
-               
-               if(email_send_mail(&mbox, mail->info->uid, &option, &handle) < 0){
-                       testapp_print("   fail sending\n");
-               } else {
-                       testapp_print("   finish sending\n");
-                       testapp_print("handle[%d]\n", handle);
-               }
-               sleep(interval);
-       }
-       return FALSE;
-}
-       
 static gboolean testapp_test_count_message_on_sending()
 {
        emf_mailbox_t mailbox;
@@ -2196,7 +1207,7 @@ static gboolean testapp_test_db_test()
        testapp_print("Input BCC field:\n");
        scanf("%s", bcc);
        
-       if ( em_storage_test(mail_id, account_id, to, cc, bcc, &err) == true ) {
+       if ( emstorage_test(mail_id, account_id, to, cc, bcc, &err) == true ) {
                testapp_print(">> Saving Succeeded\n");
        }
        else {
@@ -2212,6 +1223,7 @@ static gboolean testapp_test_db_test()
 
 static gboolean testapp_test_address_format_check_test()
 {
+       /*
        int i;
        int type;
        int index;
@@ -2287,7 +1299,7 @@ static gboolean testapp_test_address_format_check_test()
                                scanf("%d", &check_yn);
                                if ( check_yn == 1 ) {
                                        pAddress = strdup(address_list[index]);
-                                       if ( em_core_verify_email_address(pAddress, false, &err ) == true ) {
+                                       if ( em_verify_email_address(pAddress, false, &err ) == true ) {
                                                testapp_print("<< [%d] Checking Succeeded : addr[%s]\n", index, address_list[index]);
                                        }
                                        else {
@@ -2307,7 +1319,7 @@ static gboolean testapp_test_address_format_check_test()
                case 2:
                        testapp_print("Input address: \n");
                        scanf("%s", input_address);
-                       if ( em_core_verify_email_address(input_address, false, &err ) == true ) {
+                       if ( em_verify_email_address(input_address, false, &err ) == true ) {
                                testapp_print(">> Saving Succeeded : addr[%s]\n", input_address);
                        }
                        else {
@@ -2318,7 +1330,7 @@ static gboolean testapp_test_address_format_check_test()
                        testapp_print("wrong nuber... [%d]\n", type);
                        break;
        }
-
+       */
        return FALSE;
 }
 
@@ -2333,7 +1345,7 @@ static gboolean testapp_test_get_max_mail_count()
        return false;
 }
 
-#include "em-storage.h"
+#include "email-storage.h"
 static gboolean testapp_test_test_get_thread_information()
 {
        int error_code, thread_id= 38;
@@ -2466,10 +1478,12 @@ static gboolean testapp_test_find_mail_on_server()
 
        int err_code = EMF_ERROR_NONE;
        int account_id = 0;
-       int search_type = 0;
+       int search_key_value_integer = 0;
+       email_search_filter_type search_filter_type = 0;
+       email_search_filter_t search_filter;
        unsigned int handle = 0;
        char mailbox_name[MAILBOX_NAME_LENGTH];
-       char search_value[MAX_EMAIL_ADDRESS_LENGTH];
+       char search_key_value_string[MAX_EMAIL_ADDRESS_LENGTH];
 
        testapp_print("input account id : ");
        scanf("%d",&account_id);
@@ -2477,20 +1491,197 @@ static gboolean testapp_test_find_mail_on_server()
        testapp_print("input mailbox name : ");
        scanf("%s", mailbox_name);
 
-       testapp_print("input search type : ");
-       scanf("%d",&search_type);
+       testapp_print(
+               "       EMAIL_SEARCH_FILTER_TYPE_MESSAGE_NO       =  1,  ( integet type ) \n"
+               "       EMAIL_SEARCH_FILTER_TYPE_UID              =  2,  ( integet type ) \n"
+               "       EMAIL_SEARCH_FILTER_TYPE_BCC              =  7,  ( string type ) \n"
+               "       EMAIL_SEARCH_FILTER_TYPE_CC               =  9,  ( string type ) \n"
+               "       EMAIL_SEARCH_FILTER_TYPE_FROM             = 10,  ( string type ) \n"
+               "       EMAIL_SEARCH_FILTER_TYPE_KEYWORD          = 11,  ( string type ) \n"
+               "       EMAIL_SEARCH_FILTER_TYPE_SUBJECT          = 13,  ( string type ) \n"
+               "       EMAIL_SEARCH_FILTER_TYPE_TO               = 15,  ( string type ) \n"
+               "       EMAIL_SEARCH_FILTER_TYPE_SIZE_LARSER      = 16,  ( integet type ) \n"
+               "       EMAIL_SEARCH_FILTER_TYPE_SIZE_SMALLER     = 17,  ( integet type ) \n"
+               "       EMAIL_SEARCH_FILTER_TYPE_SENT_DATE_BEFORE = 20,  ( time type ) \n"
+               "       EMAIL_SEARCH_FILTER_TYPE_SENT_DATE_ON     = 21,  ( time type ) \n"
+               "       EMAIL_SEARCH_FILTER_TYPE_SENT_DATE_SINCE  = 22,  ( time type ) \n"
+               "       EMAIL_SEARCH_FILTER_TYPE_FLAGS_ANSWERED   = 26,  ( integet type ) \n"
+               "       EMAIL_SEARCH_FILTER_TYPE_FLAGS_DELETED    = 28,  ( integet type ) \n"
+               "       EMAIL_SEARCH_FILTER_TYPE_FLAGS_DRAFT      = 30,  ( integet type ) \n"
+               "       EMAIL_SEARCH_FILTER_TYPE_FLAGS_FLAGED     = 32,  ( integet type ) \n"
+               "       EMAIL_SEARCH_FILTER_TYPE_FLAGS_RECENT     = 34,  ( integet type ) \n"
+               "       EMAIL_SEARCH_FILTER_TYPE_FLAGS_SEEN       = 36,  ( integet type ) \n"
+               "       EMAIL_SEARCH_FILTER_TYPE_MESSAGE_ID       = 43,  ( string type ) \n");
+       testapp_print("input search filter type : ");
+       scanf("%d", (int*)&search_filter_type);
+
+       search_filter.search_filter_type = search_filter_type;
+
+       switch(search_filter_type) {
+               case EMAIL_SEARCH_FILTER_TYPE_MESSAGE_NO       :
+               case EMAIL_SEARCH_FILTER_TYPE_UID              :
+               case EMAIL_SEARCH_FILTER_TYPE_SIZE_LARSER      :
+               case EMAIL_SEARCH_FILTER_TYPE_SIZE_SMALLER     :
+               case EMAIL_SEARCH_FILTER_TYPE_FLAGS_ANSWERED   :
+               case EMAIL_SEARCH_FILTER_TYPE_FLAGS_DELETED    :
+               case EMAIL_SEARCH_FILTER_TYPE_FLAGS_DRAFT      :
+               case EMAIL_SEARCH_FILTER_TYPE_FLAGS_FLAGED     :
+               case EMAIL_SEARCH_FILTER_TYPE_FLAGS_RECENT     :
+               case EMAIL_SEARCH_FILTER_TYPE_FLAGS_SEEN       :
+                       testapp_print("input search filter key value : ");
+                       scanf("%d", &search_key_value_integer);
+                       search_filter.search_filter_key_value.integer_type_key_value = search_key_value_integer;
+                       break;
+
+               case EMAIL_SEARCH_FILTER_TYPE_BCC              :
+               case EMAIL_SEARCH_FILTER_TYPE_CC               :
+               case EMAIL_SEARCH_FILTER_TYPE_FROM             :
+               case EMAIL_SEARCH_FILTER_TYPE_KEYWORD          :
+               case EMAIL_SEARCH_FILTER_TYPE_SUBJECT          :
+               case EMAIL_SEARCH_FILTER_TYPE_TO               :
+               case EMAIL_SEARCH_FILTER_TYPE_MESSAGE_ID       :
+                       testapp_print("input search filter key value : ");
+                       scanf("%s", search_key_value_string);
+                       search_filter.search_filter_key_value.string_type_key_value = search_key_value_string;
+                       break;
 
-       testapp_print("input search type : ");
-       scanf("%s", search_value);
+               case EMAIL_SEARCH_FILTER_TYPE_SENT_DATE_BEFORE :
+               case EMAIL_SEARCH_FILTER_TYPE_SENT_DATE_ON     :
+               case EMAIL_SEARCH_FILTER_TYPE_SENT_DATE_SINCE  :
+                       testapp_print("input search filter key value (format = YYYYMMDDHHMMSS) : ");
+                       scanf("%s", search_key_value_string);
+                       /* TODO : write codes for converting string to time */
+                       /* search_filter.search_filter_key_value.time_type_key_value = search_key_value_string; */
+                       break;
+               default :
+                       testapp_print("Invalid filter type [%d]", search_filter_type);
+                       return FALSE;
+       }
 
-       if( (err_code = email_find_mail_on_server(account_id, mailbox_name, search_type, search_value, &handle)) != EMF_ERROR_NONE) {
-               testapp_print("email_find_mail_on_server failed [%d]", err_code);
+       if( (err_code = email_search_mail_on_server(account_id, mailbox_name, &search_filter,1, &handle)) != EMF_ERROR_NONE) {
+               testapp_print("email_search_mail_on_server failed [%d]", err_code);
        }
 
        testapp_print(" >>> testapp_test_find_mail_on_server : END \n");
        return TRUE;
 }
 
+static gboolean testapp_test_add_mail_to_search_result_box()
+{
+       int                    i = 0;
+       int                    account_id = 0;
+       int                    from_eas = 0;
+       int                    attachment_count = 0;
+       int                    err = EMF_ERROR_NONE;
+       char                   arg[50] = { 0 , };
+       char                  *body_file_path = MAIL_TEMP_BODY;
+       emf_mailbox_t         *mailbox_data = NULL;
+       emf_mail_data_t       *test_mail_data = NULL;
+       emf_attachment_data_t *attachment_data = NULL;
+       emf_meeting_request_t *meeting_req = NULL;
+       FILE                  *body_file = NULL;
+
+       testapp_print("\n > Enter account id : ");
+       scanf("%d", &account_id);
+
+       email_get_mailbox_by_name(account_id, EMF_SEARCH_RESULT_MAILBOX_NAME, &mailbox_data);
+
+       test_mail_data = malloc(sizeof(emf_mail_data_t));
+       memset(test_mail_data, 0x00, sizeof(emf_mail_data_t));
+
+       testapp_print("\n From EAS? [0/1]> ");
+       scanf("%d", &from_eas);
+
+       test_mail_data->account_id           = account_id;
+       test_mail_data->save_status          = 1;
+       test_mail_data->body_download_status = 1;
+       test_mail_data->flags_seen_field     = 1;
+       test_mail_data->file_path_plain      = strdup(body_file_path);
+       test_mail_data->mailbox_name         = strdup(mailbox_data->name);
+       test_mail_data->mailbox_type         = mailbox_data->mailbox_type;
+       test_mail_data->full_address_from    = strdup("<test1@test.com>");
+       test_mail_data->full_address_to      = strdup("<test2@test.com>");
+       test_mail_data->full_address_cc      = strdup("<test3@test.com>");
+       test_mail_data->full_address_bcc     = strdup("<test4@test.com>");
+       test_mail_data->subject              = strdup("Into search result mailbox");
+
+       body_file = fopen(body_file_path, "w");
+
+       for(i = 0; i < 500; i++)
+               fprintf(body_file, "X2 X2 X2 X2 X2 X2 X2");
+       fflush(body_file);
+       fclose(body_file);
+
+       testapp_print(" > Attach file? [0/1] : ");
+       scanf("%d",&attachment_count);
+
+       if ( attachment_count )  {
+               memset(arg, 0x00, 50);
+               testapp_print("\n > Enter attachment name : ");
+               scanf("%s", arg);
+
+               attachment_data = malloc(sizeof(emf_attachment_data_t));
+
+               attachment_data->attachment_name  = strdup(arg);
+
+               memset(arg, 0x00, 50);
+               testapp_print("\n > Enter attachment absolute path : ");
+               scanf("%s",arg);
+
+               attachment_data->attachment_path  = strdup(arg);
+               attachment_data->save_status      = 1;
+               test_mail_data->attachment_count  = attachment_count;
+       }
+
+       testapp_print("\n > Meeting Request? [0: no, 1: yes (request from server), 2: yes (response from local)]");
+       scanf("%d", &(test_mail_data->meeting_request_status));
+
+       if ( test_mail_data->meeting_request_status == 1
+               || test_mail_data->meeting_request_status == 2 ) {
+               time_t current_time;
+               /*  dummy data for meeting request */
+               meeting_req = malloc(sizeof(emf_meeting_request_t));
+               memset(meeting_req, 0x00, sizeof(emf_meeting_request_t));
+
+               meeting_req->meeting_response     = 1;
+               current_time = time(NULL);
+               gmtime_r(&current_time, &(meeting_req->start_time));
+               gmtime_r(&current_time, &(meeting_req->end_time));
+               meeting_req->location = malloc(strlen("Seoul") + 1);
+               memset(meeting_req->location, 0x00, strlen("Seoul") + 1);
+               strcpy(meeting_req->location, "Seoul");
+               strcpy(meeting_req->global_object_id, "abcdef12345");
+
+               meeting_req->time_zone.offset_from_GMT = 9;
+               strcpy(meeting_req->time_zone.standard_name, "STANDARD_NAME");
+               gmtime_r(&current_time, &(meeting_req->time_zone.standard_time_start_date));
+               meeting_req->time_zone.standard_bias = 3;
+
+               strcpy(meeting_req->time_zone.daylight_name, "DAYLIGHT_NAME");
+               gmtime_r(&current_time, &(meeting_req->time_zone.daylight_time_start_date));
+               meeting_req->time_zone.daylight_bias = 7;
+
+       }
+
+       if((err = email_add_mail(test_mail_data, attachment_data, attachment_count, meeting_req, from_eas)) != EMF_ERROR_NONE)
+               testapp_print("email_add_mail failed. [%d]\n", err);
+       else
+               testapp_print("email_add_mail success.\n");
+
+       testapp_print("saved mail id = [%d]\n", test_mail_data->mail_id);
+
+       if(attachment_data)
+               email_free_attachment_data(&attachment_data, attachment_count);
+
+       if(meeting_req)
+               email_free_meeting_request(&meeting_req, 1);
+
+       email_free_mail_data(&test_mail_data, 1);
+       email_free_mailbox(&mailbox_data, 1);
+
+       return FALSE;
+}
+
 /* internal functions */
 static gboolean testapp_test_interpret_command (int menu_number)
 {
@@ -2498,29 +1689,14 @@ static gboolean testapp_test_interpret_command (int menu_number)
        
        switch (menu_number) {
                case 1:
-                       testapp_test_save_mail();
+                       testapp_test_get_mails();
                        break;
                case 2:
-                       testapp_test_mail_send ();
-                       break;
-               case 3:
-                       testapp_test_update();
+                       testapp_test_mail_send (NULL);
                        break;
                case 4:
                        testapp_test_add_attachment();
                        break;                  
-               case 5:
-                       testapp_test_get ();
-                       break;
-               case 6:
-                       testapp_test_get_info();
-                       break;
-               case 7:
-                       testapp_test_get_header ();
-                       break;                  
-               case 8:
-                       testapp_test_get_body ();
-                       break;
                case 9:
                        testapp_test_count ();
                        break;
@@ -2530,9 +1706,6 @@ static gboolean testapp_test_interpret_command (int menu_number)
                case 11:
                        testapp_test_modify_extra_flag ();
                        break;  
-               case 12:
-                       testapp_test_download();
-                       break;  
                case 14:
                        testapp_test_delete ();
                        break;
@@ -2542,12 +1715,6 @@ static gboolean testapp_test_interpret_command (int menu_number)
                case 17:
                        testapp_test_download_attachment();
                        break;          
-               case 18:
-                       testapp_test_load_test_mail_send();
-                       break;
-               case 19:
-                       testapp_test_get_mailbox_list ();
-                       break;
                case 20:
                        testapp_test_delete_all();
                        break;
@@ -2575,9 +1742,6 @@ static gboolean testapp_test_interpret_command (int menu_number)
                case 38:
                        testapp_test_get_totaldiskusage();
                        break;
-               case 39:
-                       testapp_test_send_mail_with_option();
-                       break;
                case 40:
                        testapp_test_address_format_check_test();
                        break;
@@ -2608,9 +1772,6 @@ static gboolean testapp_test_interpret_command (int menu_number)
                case 52:
                        testapp_test_get_address_info_list();
                        break;
-               case 53:
-                       testapp_test_send_html_mail_with_inline_content();
-                       break;
                case 54:
                        email_get_recipients_list(1, NULL, NULL);
                        break;
@@ -2618,7 +1779,7 @@ static gboolean testapp_test_interpret_command (int menu_number)
                        testapp_test_set_flags_field();
                        break;
                case 56:
-                       testapp_test_add_mail();
+                       testapp_test_add_mail(NULL);
                        break;
                case 57:
                        testapp_test_update_mail();
@@ -2626,6 +1787,9 @@ static gboolean testapp_test_interpret_command (int menu_number)
                case 58:
                        testapp_test_find_mail_on_server();
                        break;
+               case 59:
+                       testapp_test_add_mail_to_search_result_box();
+                       break;
                case 0:
                        go_to_loop = FALSE;
                        break;
@@ -2642,8 +1806,8 @@ void testapp_mail_main()
        int menu_number = 0;
        
        while (go_to_loop) {
-               testapp_show_menu (EMF_MESSAGE_MENU);
-               testapp_show_prompt (EMF_MESSAGE_MENU);
+               testapp_show_menu (EMF_MAIL_MENU);
+               testapp_show_prompt (EMF_MAIL_MENU);
                        
                scanf ("%d", &menu_number);
 
 /* open header */
 #include <glib.h>
 
-#include "Emf_Mapi_Message.h"
-#include "Emf_Mapi_Network.h"
-#include "Emf_Mapi_Mailbox.h"
+#include "email-api-account.h"
+#include "email-api-network.h"
+#include "email-api-mailbox.h"
 
 /* internal header */
-#include "emf-test-utility.h"
-#include "emf-test-mailbox.h"
-
+#include "testapp-utility.h"
+#include "testapp-mailbox.h"
 
 static gboolean testapp_test_add_mailbox()
 {
@@ -298,6 +297,106 @@ static gboolean testapp_test_set_mail_slot_size ()
        return FALSE;
 }
 
+static gboolean testapp_test_get_mailbox_list ()
+{
+
+       int account_id =0;
+       int mailbox_sync_type;
+       int count = 0;
+       int i = 0, error_code = EMF_ERROR_NONE;
+       emf_mailbox_t *mailbox_list=NULL;
+       testapp_print("\n > Enter account id: ");
+       scanf("%d", &account_id);
+       testapp_print("\n > Enter mailbox_sync_type\n[-1 :for all mailboxes, 0 : for mailboxes from server, 1 : local mailboxes\n : ");
+       scanf("%d", &mailbox_sync_type);
+
+       if((error_code = email_get_mailbox_list(account_id, mailbox_sync_type, &mailbox_list, &count)) < 0) {
+               testapp_print("   email_get_mailbox_list error %d\n", error_code);
+               return false ;
+       }
+
+       testapp_print("There are %d mailboxes\n", count);
+
+       testapp_print("============================================================================\n");
+       testapp_print("number\taccount_id\t name\t\t alias\t local_yn\t unread\tmailbox_type\t has_archived_mails\n");
+       testapp_print("============================================================================\n");
+       if ( count == 0 ) {
+               testapp_print("No mailbox is matched\n");
+       }
+       else {
+               for(i=0;i<count;i++) {
+               testapp_print("[%d] - ", i);
+                       testapp_print(" %2d\t [%-15s]\t[%-15s]\t", mailbox_list[i].account_id, mailbox_list[i].name, mailbox_list[i].alias);
+                       testapp_print(" %d\t %d\t %d\n", mailbox_list[i].local, mailbox_list[i].unread_count,mailbox_list[i].mailbox_type, mailbox_list[i].has_archived_mails);
+               }
+       }
+       testapp_print("============================================================================\n");
+       /* EmfMailboxFree(emf_mailbox_t** mailbox_list, int count, int* err_code) */
+
+       if((error_code = email_get_mailbox_list_ex(account_id, mailbox_sync_type, 1, &mailbox_list, &count)) < 0) {
+               testapp_print("   email_get_mailbox_list_ex error %d\n", error_code);
+               return false ;
+       }
+
+       testapp_print("There are %d mailboxes\n", count);
+
+       testapp_print("============================================================================\n");
+       testapp_print("number\taccount_id\t name\t\t alias\t local_yn\t unread\t total\t total_on_ server\tmailbox_type\t has_archived_mails\n");
+       testapp_print("============================================================================\n");
+       if ( count == 0 ) {
+               testapp_print("No mailbox is matched\n");
+       }
+       else {
+               for(i=0;i<count;i++) {
+               testapp_print("[%d] - ", i);
+                       testapp_print(" %2d\t [%-15s]\t[%-15s]\t", mailbox_list[i].account_id, mailbox_list[i].name, mailbox_list[i].alias);
+                       testapp_print(" %d\t %d\t %d\t %d\t %d\t %d\n", mailbox_list[i].local, mailbox_list[i].unread_count, mailbox_list[i].total_mail_count_on_local, mailbox_list[i].total_mail_count_on_server, mailbox_list[i].mailbox_type, mailbox_list[i].has_archived_mails);
+               }
+       }
+       testapp_print("============================================================================\n");
+       testapp_print("Start to free\n");
+
+       email_free_mailbox(&mailbox_list, count);
+       return FALSE;
+}
+
+static gboolean testapp_test_sync_mailbox()
+{
+       emf_mailbox_t mbox;
+       int account_id = 0;
+       char arg[50];
+       unsigned handle = 0;
+       testapp_print("\n > Enter Account id (0: for all account) : ");
+       scanf("%d",&account_id);
+
+       memset(arg, 0x00, 50);
+       testapp_print("\n > Enter Mailbox name (ALL: for all mailboxes) : ");
+       scanf("%s",arg);
+
+       memset(&mbox, 0x00, sizeof(emf_mailbox_t));
+
+       mbox.account_id = account_id;
+
+       if(strcmp("ALL", arg) == 0)
+               mbox.name = NULL;
+       else
+               mbox.name = strdup(arg);
+
+       if(account_id == ALL_ACCOUNT) {
+               if(email_sync_header_for_all_account(&handle) < 0)
+                       testapp_print("\n email_sync_header_for_all_account failed\n");
+               else
+                       testapp_print("\n email_sync_header_for_all_account success. Handle[%d]\n", handle);
+       }
+       else {
+               if(email_sync_header(&mbox,&handle) < 0)
+                       testapp_print("\n email_sync_header failed\n");
+               else
+                       testapp_print("\n email_sync_header success. Handle[%d]\n", handle);
+       }
+
+       return FALSE;
+}
 
 static gboolean testapp_test_interpret_command (int menu_number)
 {
@@ -332,6 +431,14 @@ static gboolean testapp_test_interpret_command (int menu_number)
                        testapp_test_set_mail_slot_size();
                        break;  
 
+               case 9:
+                       testapp_test_get_mailbox_list ();
+                       break;
+
+               case 10:
+                       testapp_test_sync_mailbox();
+                       break;
+
                case 0:
                        go_to_loop = FALSE;
                        break;
 #include "c-client.h" 
 
 
-#include "Emf_Mapi.h"
-#include "Emf_Mapi_Message.h"
-#include "Emf_Mapi_Network.h"
+#include "email-api.h"
+#include "email-api-account.h"
+#include "email-api-network.h"
 
 
 /* internal header */
-#include "emf-test-utility.h"
-#include "emf-test-others.h"
-#include "ipc-library.h"
+#include "testapp-utility.h"
+#include "testapp-others.h"
+#include "email-ipc.h"
 
 static gboolean testapp_test_get_network_status()
 {
@@ -104,45 +104,25 @@ static gboolean testapp_test_get_dnet_proper_profile_type()
        return TRUE;
 }
 
-static gboolean testapp_test_test_thread_functions()
-{
-       /*
-       int result, thread_id, thread_item_count = 0;
-       char sampletext[200] = " RE: re: FW: Re: RE: FWD: Hello re fw:qwe", *latest_thread_datetime = NULL;
-
-       
-       em_core_find_tag_for_thread_view(sampletext, &result);
-
-       testapp_print("em_core_find_tag_for_thread_view returns = %d\n", result);
-
-       if(result) {
-               em_storage_get_thread_id_of_thread_mails(1, "Inbox", sampletext, &thread_id, &latest_thread_datetime, &thread_item_count);
-               testapp_print("em_storage_get_thread_id_of_thread_mails returns = %d\n", thread_id);
-       }
-       */
-       
-       return TRUE;
-}
-
 static gboolean testapp_test_print_receving_queue_via_debug_msg()
 {
        int err;
-       void* hAPI = (void*)ipcEmailAPI_Create(_EMAIL_API_PRINT_RECEIVING_EVENT_QUEUE);
+       void* hAPI = (void*)emipc_create_email_api(_EMAIL_API_PRINT_RECEIVING_EVENT_QUEUE);
 
        if(hAPI == NULL)
                return EMF_ERROR_NULL_VALUE;
                
-       if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
-               testapp_print("testapp_test_print_receving_queue_via_debug_msg - ipcEmailProxy_ExecuteAPI failed \n ");
+       if(emipc_execute_proxy_api(hAPI) != EMF_ERROR_NONE) {
+               testapp_print("testapp_test_print_receving_queue_via_debug_msg - emipc_execute_proxy_api failed \n ");
                if(hAPI == NULL)
                        return EMF_ERROR_NULL_VALUE;
        }
 
-       err = *(int*)ipcEmailAPI_GetParameter(hAPI, 1, 0);
+       emipc_get_parameter(hAPI, 1, 0, sizeof(int), &err);
        
        testapp_print(" >>>> RETURN VALUE : %d \n", err);
 
-       ipcEmailAPI_Destroy(hAPI);
+       emipc_destroy_email_api(hAPI);
 
        hAPI = NULL;
        testapp_print("testapp_test_print_receving_queue_via_debug_msg  ..........End\n");
@@ -231,7 +211,7 @@ static gboolean testapp_test_encoding_test()
                free(encoded_file_name);
                encoded_file_name = malloc(strlen(base64_file_name) + 15);
                if(!encoded_file_name) {
-                       testapp_print("em_core_malloc failed.");
+                       testapp_print("em_malloc failed.");
                        goto FINISH_OFF;
                }
                snprintf(encoded_file_name, strlen(base64_file_name) + 15, "=?UTF-8?B?%s?=", base64_file_name);
@@ -404,9 +384,6 @@ static gboolean testapp_test_interpret_command (int menu_number)
                case 6:
                        testapp_test_get_dnet_proper_profile_type();
                        break;
-               case 8:
-                       testapp_test_test_thread_functions();
-                       break;
                case 11:
                        testapp_test_print_receving_queue_via_debug_msg();
                        break;
 /* open header */
 #include <glib.h>
 
-#include "Emf_Mapi_Rule.h"
+#include "email-api-rule.h"
 
 /* internal header */
-#include "emf-test-utility.h"
-#include "emf-test-mailbox.h"
+#include "testapp-utility.h"
+#include "testapp-mailbox.h"
 
 static gboolean testapp_test_add_rule()
 {
 /* open header */
 #include <glib.h>
 
-#include "Emf_Mapi_Message.h"
+#include "email-api-account.h"
+#include "email-api-mail.h"
 
 /* internal header */
-#include "emf-test-utility.h"
-#include "emf-test-thread.h"
+#include "testapp-utility.h"
+#include "testapp-thread.h"
 
 static gboolean testapp_test_move_thread()
 {
@@ -131,4 +132,4 @@ void testapp_thread_main()
 
                go_to_loop = testapp_test_interpret_command (menu_number);
        }
-}
\ No newline at end of file
+}
@@ -30,7 +30,7 @@
 #include <glib/gprintf.h>
 
 /* internal header */
-#include "emf-test-utility.h"
+#include "testapp-utility.h"
 
 /* internal data struct */
 
@@ -48,7 +48,7 @@ void testapp_show_menu (eEMF_MENU menu)
        switch (menu) {
                case EMF_MAIN_MENU:
                        testapp_print ("==========================================\n");
-                       testapp_print ("    Email service test application \n");
+                       testapp_print ("    Email test application \n");
                        testapp_print ("==========================================\n");
                        testapp_print ("1. Account Test\n");
                        testapp_print ("2. Message Test\n");
@@ -74,43 +74,35 @@ void testapp_show_menu (eEMF_MENU menu)
                        testapp_print (" 9.  Backup All Accounts\n");
                        testapp_print (" 10. Restore accounts\n");
                        testapp_print (" 11. Get password length of account\n");
+                       testapp_print (" 12. Query server info\n");
                        testapp_print (" 13. Clear all notifications\n");
                        testapp_print (" 0.  Go to Main Menu\n");
                        testapp_print ("------------------------------------------\n");
                        break;
                        
-               case EMF_MESSAGE_MENU:
+               case EMF_MAIL_MENU:
                        testapp_print ("==========================================\n");
-                       testapp_print ("    MESSAGE MENU\n");
+                       testapp_print ("    MAIL MENU\n");
                        testapp_print ("==========================================\n");
-                       testapp_print ("1.  Mail Save\n");
-                       testapp_print ("2.  Mail Send\n");
-                       testapp_print ("3.  Mail Update\n");
+                       testapp_print ("1.  Get mails\n");
+                       testapp_print ("2.  Send a mail \n");
                        testapp_print ("4.  Add Attachment\n");
-                       testapp_print ("5.  Get Mail \n");
-                       testapp_print ("6.  Get Mail Info\n");
-                       testapp_print ("7.  Get Mail Header\n");
-                       testapp_print ("8.  Get Mail Body\n");
                        testapp_print ("9.  Mail Count \n");
-                       testapp_print ("10. Mail Flag Modify\n");
-                       testapp_print ("11. Mail Extra Flag Modify\n");
-                       testapp_print ("12. Download \n");
-                       testapp_print ("14. Mail Delete\n");
-                       testapp_print ("16. Download body\n");
-                       testapp_print ("17. Download attachment\n");
-                       testapp_print ("18. Load test - mail send\n");
-                       testapp_print ("19. Mailbox Get List\n");
-                       testapp_print ("20. Mail Delete All\n");
-                       testapp_print ("21. Mail move\n");              
-                       testapp_print ("23. Mail Resend\n");                            
+                       testapp_print ("10. Modify mail flag \n");
+                       testapp_print ("11. Modify mail extra flag modify\n");
+                       testapp_print ("14. Delete a mail \n");
+                       testapp_print ("16. Download mail body\n");
+                       testapp_print ("17. Download an attachment\n");
+                       testapp_print ("20. Delete all mail\n");
+                       testapp_print ("21. Move Mail \n");
+                       testapp_print ("23. Resend Mail \n");
                        testapp_print ("24. Find mails\n");                             
-                       testapp_print ("26. Count Messages On Sending\n");
+                       testapp_print ("26. Count mails On Sending\n");
                        testapp_print ("27. Move all mails to mailbox\n");
-                       testapp_print ("28. Count Messages with Draft Flag\n");
+                       testapp_print ("28. Count mails with Draft Flag\n");
                        testapp_print ("29. Get latest unread mail Id\n");
                        testapp_print ("38. Get total email disk usage \n");    
-                       testapp_print ("39. Send Mail with Option \n"); 
-                       testapp_print ("40. Email Address Format Check\n");
+                       testapp_print ("40. Verify Email Address Format\n");
                        testapp_print ("41. Get Max Mail Count\n");
                        testapp_print ("42. Storage test : (Input : to fields)\n");
                        testapp_print ("43. Send mail Cancel\n");
@@ -119,10 +111,11 @@ void testapp_show_menu (eEMF_MENU menu)
                        testapp_print ("49. Get sender list\n");
                        testapp_print ("51. Get mail list ex\n");
                        testapp_print ("52. Get address info list\n");
-                       testapp_print ("53. Save HTML mail with inline content\n");
                        testapp_print ("55. Set a field of flags\n");
                        testapp_print ("56. Add mail\n");
                        testapp_print ("57. Update mail\n");
+                       testapp_print ("58. Search on server\n");
+                       testapp_print ("59. Add mail to search result table\n");
                        testapp_print ("0.  Go to Main Menu\n");
                        testapp_print ("------------------------------------------\n");
                        break;
@@ -131,13 +124,15 @@ void testapp_show_menu (eEMF_MENU menu)
                        testapp_print ("==========================================\n");
                        testapp_print ("   MAILBOX MENU\n");
                        testapp_print ("==========================================\n");
-                       testapp_print ("1. Add mailbox\n");
-                       testapp_print ("2. Delete mailbox\n");
-                       testapp_print ("3. Update mailbox\n");
-                       testapp_print ("4. Get IMAP mailbox List\n");
-                       testapp_print ("6. Get Child List for given mailbox \n");
-                       testapp_print ("7. Get mailbox by mailbox type\n");
-                       testapp_print ("8. Set mail slot size\n");
+                       testapp_print (" 1. Add mailbox\n");
+                       testapp_print (" 2. Delete mailbox\n");
+                       testapp_print (" 3. Update mailbox\n");
+                       testapp_print (" 4. Get IMAP mailbox List\n");
+                       testapp_print (" 6. Get Child List for given mailbox \n");
+                       testapp_print (" 7. Get mailbox by mailbox type\n");
+                       testapp_print (" 8. Set mail slot size\n");
+                       testapp_print (" 9. Get mailbox list\n");
+                       testapp_print ("10. Sync mailbox\n");
                        testapp_print ("0. Go to Main Menu\n");
                        testapp_print ("------------------------------------------\n");
                        break;
@@ -176,7 +171,6 @@ void testapp_show_menu (eEMF_MENU menu)
                        testapp_print ("5.  Set DNET Proper Profile Type\n");
                        testapp_print ("6.  Get DNET Proper Profile Type\n");
                        testapp_print ("7.  Send mail cancel job\n");
-                       testapp_print ("8.  Thread View Test\n");
                        testapp_print ("11. Print receiving event queue via debug msg\n");
                        testapp_print ("12. Create DB full\n");
                        testapp_print ("13. Encoding Test\n");
@@ -200,8 +194,8 @@ void testapp_show_prompt (eEMF_MENU menu)
                        testapp_print ("[ACCOUNT]# ");
                        break;
                        
-               case EMF_MESSAGE_MENU:
-                       testapp_print ("[MESSAGE]# ");
+               case EMF_MAIL_MENU:
+                       testapp_print ("[MAIL]# ");
                        break;
                        
                case EMF_MAILBOX_MENU: