tizen 2.4 release accepted/tizen_2.4_mobile tizen_2.4 accepted/tizen/2.4/mobile/20151029.032805 submit/tizen_2.4/20151028.064312 tizen_2.4_mobile_release
authorjk7744.park <jk7744.park@samsung.com>
Sat, 24 Oct 2015 07:46:33 +0000 (16:46 +0900)
committerjk7744.park <jk7744.park@samsung.com>
Sat, 24 Oct 2015 07:46:33 +0000 (16:46 +0900)
197 files changed:
CMakeLists.txt
doc/msg_service_doc.h
externals/CMakeLists.txt
externals/MsgAlarm.cpp
externals/MsgDevicedWrapper.cpp
externals/MsgNotificationWrapper.cpp
externals/MsgSensorWrapper.cpp
externals/MsgSoundPlayer.cpp
externals/MsgSpamFilter.cpp
framework/CMakeLists.txt
framework/deliver-handler/MsgDeliverHandler.cpp
framework/main.cpp
framework/plugin-manager/MsgPluginManager.cpp
framework/setting-handler/MsgSettingHandler.cpp
framework/storage-handler/MsgStorageManager.cpp
framework/storage-handler/MsgStorageMessage.cpp
framework/storage-handler/MsgStorageMms.cpp
framework/storage-handler/MsgStorageUtil.cpp
framework/submit-handler/MsgSubmitHandler.cpp
framework/transaction-manager/MsgCmdHandlerStorage.cpp
framework/transaction-manager/MsgCmdHandlerTransport.cpp
framework/transaction-manager/MsgTransManager.cpp
include/common/MsgCmdTypes.h
include/common/MsgCppTypes.h
include/common/MsgInternalTypes.h
include/common/MsgSettingTypes.h
include/common/MsgStorageTypes.h
include/externals/MsgAlarm.h
include/externals/MsgNotificationWrapper.h
include/externals/MsgSensorWrapper.h
include/externals/MsgSoundPlayer.h
include/externals/MsgSpamFilter.h
include/framework/MsgCmdHandler.h
include/framework/MsgStorageHandler.h
include/framework/MsgTransManager.h
include/mapi/msg.h
include/mapi/msg_private.h
include/mapi/msg_storage.h
include/mapi/msg_storage_types.h
include/mapi/msg_transport.h
include/mapi/msg_transport_types.h
include/mapi/msg_types.h
include/proxy/MsgHandle.h
include/proxy/MsgProxyListener.h
include/utils/MsgCallStatusManager.h [new file with mode: 0644]
include/utils/MsgContact.h
include/utils/MsgDebug.h
include/utils/MsgGconfWrapper.h
include/utils/MsgMmsMessage.h
include/utils/MsgSqliteWrapper.h
include/utils/MsgTextConvert.h
include/utils/MsgUtilFile.h
include/utils/MsgUtilFunction.h
include/utils/MsgUtilStorage.h
include/utils/MsgZoneManager.h [new file with mode: 0755]
mapi/CMakeLists.txt
mapi/msg_control.cpp
mapi/msg_filter.cpp
mapi/msg_message.cpp
mapi/msg_mms.cpp
mapi/msg_setting.cpp
mapi/msg_storage.cpp
mapi/msg_svc.cpp
mapi/msg_transport.cpp
msg-server [deleted file]
msg-service-tools.manifest
msg-service.manifest
msg-service.res [new file with mode: 0755]
msg-service.rule [deleted file]
packaging/msg-server.service
packaging/msg-server.socket [new file with mode: 0644]
packaging/msg-service.spec
plugin/mms_plugin/CMakeLists.txt
plugin/mms_plugin/MmsPluginAppBase.cpp
plugin/mms_plugin/MmsPluginCodecCommon.cpp
plugin/mms_plugin/MmsPluginComposer.cpp
plugin/mms_plugin/MmsPluginConnManWrapper.cpp
plugin/mms_plugin/MmsPluginDecode.cpp
plugin/mms_plugin/MmsPluginEncode.cpp
plugin/mms_plugin/MmsPluginEventHandler.cpp
plugin/mms_plugin/MmsPluginHttp.cpp
plugin/mms_plugin/MmsPluginInternal.cpp
plugin/mms_plugin/MmsPluginMIME.cpp
plugin/mms_plugin/MmsPluginMain.cpp
plugin/mms_plugin/MmsPluginMessage.cpp
plugin/mms_plugin/MmsPluginSMILValidate.cpp
plugin/mms_plugin/MmsPluginStorage.cpp
plugin/mms_plugin/MmsPluginTcs.cpp
plugin/mms_plugin/MmsPluginTextConvert.cpp
plugin/mms_plugin/MmsPluginTransport.cpp
plugin/mms_plugin/MmsPluginUserAgent.cpp
plugin/mms_plugin/MmsPluginUtil.cpp
plugin/mms_plugin/include/MmsPluginAppBase.h
plugin/mms_plugin/include/MmsPluginCodec.h
plugin/mms_plugin/include/MmsPluginCodecCommon.h
plugin/mms_plugin/include/MmsPluginCodecTypes.h
plugin/mms_plugin/include/MmsPluginComposer.h
plugin/mms_plugin/include/MmsPluginConnManWrapper.h
plugin/mms_plugin/include/MmsPluginDebug.h
plugin/mms_plugin/include/MmsPluginDecode.h
plugin/mms_plugin/include/MmsPluginDrm.h
plugin/mms_plugin/include/MmsPluginEncode.h
plugin/mms_plugin/include/MmsPluginEventHandler.h
plugin/mms_plugin/include/MmsPluginHttp.h
plugin/mms_plugin/include/MmsPluginInternal.h
plugin/mms_plugin/include/MmsPluginMIME.h
plugin/mms_plugin/include/MmsPluginMain.h
plugin/mms_plugin/include/MmsPluginMessage.h
plugin/mms_plugin/include/MmsPluginStorage.h
plugin/mms_plugin/include/MmsPluginTcs.h
plugin/mms_plugin/include/MmsPluginTextConvert.h
plugin/mms_plugin/include/MmsPluginTransport.h
plugin/mms_plugin/include/MmsPluginTypes.h
plugin/mms_plugin/include/MmsPluginUserAgent.h
plugin/mms_plugin/include/MmsPluginUtil.h
plugin/sms_cdma_plugin/SmsCdmaPluginCallback.cpp
plugin/sms_cdma_plugin/SmsCdmaPluginCodec.cpp
plugin/sms_cdma_plugin/SmsCdmaPluginEventHandler.cpp
plugin/sms_cdma_plugin/SmsCdmaPluginMain.cpp
plugin/sms_cdma_plugin/SmsCdmaPluginParamCodec.cpp
plugin/sms_cdma_plugin/SmsCdmaPluginSetting.cpp
plugin/sms_cdma_plugin/SmsCdmaPluginStorage.cpp
plugin/sms_cdma_plugin/SmsCdmaPluginTransport.cpp
plugin/sms_cdma_plugin/SmsCdmaPluginUAManager.cpp
plugin/sms_cdma_plugin/SmsCdmaPluginWapPushHandler.cpp
plugin/sms_cdma_plugin/include/SmsCdmaPluginCallback.h
plugin/sms_cdma_plugin/include/SmsCdmaPluginCodec.h
plugin/sms_cdma_plugin/include/SmsCdmaPluginEventHandler.h
plugin/sms_cdma_plugin/include/SmsCdmaPluginMain.h
plugin/sms_cdma_plugin/include/SmsCdmaPluginParamCodec.h
plugin/sms_cdma_plugin/include/SmsCdmaPluginSetting.h
plugin/sms_cdma_plugin/include/SmsCdmaPluginStorage.h
plugin/sms_cdma_plugin/include/SmsCdmaPluginTransport.h
plugin/sms_cdma_plugin/include/SmsCdmaPluginTypes.h
plugin/sms_cdma_plugin/include/SmsCdmaPluginUAManager.h
plugin/sms_cdma_plugin/include/SmsCdmaPluginWapPushHandler.h
plugin/sms_plugin/CMakeLists.txt
plugin/sms_plugin/SmsPluginCallback.cpp
plugin/sms_plugin/SmsPluginCbMsgHandler.cpp
plugin/sms_plugin/SmsPluginConcatHandler.cpp
plugin/sms_plugin/SmsPluginDSHandler.cpp
plugin/sms_plugin/SmsPluginEventHandler.cpp
plugin/sms_plugin/SmsPluginMain.cpp
plugin/sms_plugin/SmsPluginParamCodec.cpp
plugin/sms_plugin/SmsPluginSatHandler.cpp
plugin/sms_plugin/SmsPluginSetting.cpp
plugin/sms_plugin/SmsPluginSimMsg.cpp
plugin/sms_plugin/SmsPluginStorage.cpp
plugin/sms_plugin/SmsPluginTpduCodec.cpp
plugin/sms_plugin/SmsPluginTransport.cpp
plugin/sms_plugin/SmsPluginUAManager.cpp
plugin/sms_plugin/SmsPluginUDCodec.cpp
plugin/sms_plugin/SmsPluginWapPushHandler.cpp
plugin/sms_plugin/include/SmsPluginCallback.h
plugin/sms_plugin/include/SmsPluginCbMsgHandler.h
plugin/sms_plugin/include/SmsPluginConcatHandler.h
plugin/sms_plugin/include/SmsPluginDSHandler.h
plugin/sms_plugin/include/SmsPluginEventHandler.h
plugin/sms_plugin/include/SmsPluginMain.h
plugin/sms_plugin/include/SmsPluginParamCodec.h
plugin/sms_plugin/include/SmsPluginSatHandler.h
plugin/sms_plugin/include/SmsPluginSetting.h
plugin/sms_plugin/include/SmsPluginSimMsg.h
plugin/sms_plugin/include/SmsPluginStorage.h
plugin/sms_plugin/include/SmsPluginTpduCodec.h
plugin/sms_plugin/include/SmsPluginTransport.h
plugin/sms_plugin/include/SmsPluginTypes.h
plugin/sms_plugin/include/SmsPluginUAManager.h
plugin/sms_plugin/include/SmsPluginUDCodec.h
plugin/sms_plugin/include/SmsPluginWapPushHandler.h
proxy/CMakeLists.txt
proxy/MsgHandleControl.cpp
proxy/MsgHandleFilter.cpp
proxy/MsgHandleSetting.cpp
proxy/MsgHandleStorage.cpp
proxy/MsgHandleTransport.cpp
proxy/MsgProxyListener.cpp
utils/CMakeLists.txt
utils/MsgCallStatusManager.cpp [new file with mode: 0644]
utils/MsgContact.cpp
utils/MsgDebug.cpp
utils/MsgGconfWrapper.cpp
utils/MsgIpcSocket.cpp
utils/MsgMmsMessage.cpp
utils/MsgSerialize.cpp
utils/MsgSmil.cpp
utils/MsgSqliteWrapper.cpp
utils/MsgTextConvert.cpp
utils/MsgUtilFile.cpp
utils/MsgUtilFunction.cpp
utils/MsgUtilStorage.cpp
utils/MsgVMessage.cpp
utils/MsgZoneManager.cpp [new file with mode: 0755]
vobject-engine/CMakeLists.txt
vobject-engine/VCard.c
vobject-engine/VCardCalUtil.c
vobject-engine/VMessage.c

index f4d7bdb..b91f2af 100755 (executable)
@@ -23,18 +23,21 @@ IF(_MSG_WEARABLE_PROFILE)
        ADD_DEFINITIONS("-DMSG_WEARABLE_PROFILE")
 ENDIF(_MSG_WEARABLE_PROFILE)
 
+IF(_FEATURE_CONTAINER_ENABLE)
+       ADD_DEFINITIONS("-DFEATURE_CONTAINER_ENABLE")
+ENDIF(_FEATURE_CONTAINER_ENABLE)
+
 ADD_DEFINITIONS("-D_FILE_OFFSET_BITS=64")
 
 CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
 CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
 IF(COMPILER_SUPPORTS_CXX11)
-    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+       SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
 ELSEIF(COMPILER_SUPPORTS_CXX0X)
-    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
+       SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
 ELSE()
-    MESSAGE(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
+       MESSAGE(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
 ENDIF()
-
 ##########################################################
 # Add Subdirectories
 ##########################################################
@@ -74,15 +77,8 @@ INSTALL(FILES ${MAPI-HEADERS} DESTINATION include/msg-service)
 CONFIGURE_FILE(msg-service.pc.in msg-service.pc @ONLY)
 INSTALL(FILES ${CMAKE_BINARY_DIR}/msg-service.pc DESTINATION lib/pkgconfig)
 
-SET(RC_LOCAL_SCRIPT msg-server)
-INSTALL(PROGRAMS ${RC_LOCAL_SCRIPT} DESTINATION /etc/rc.d/init.d)
-
-# systemd
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/packaging/msg-server.service DESTINATION /usr/lib/systemd/system)
-
 # LICENSE file
 INSTALL(FILES ${CMAKE_SOURCE_DIR}/LICENSE.APLv2 DESTINATION /usr/share/license/msg-service)
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/msg-service.rule DESTINATION /etc/smack/accesses.d/)
 
 #Install sysinfo file to provide which features are supported.
 IF(_FEATURE_SMS_CDMA)
@@ -92,3 +88,8 @@ ELSE(_FEATURE_SMS_CDMA)
        INSTALL(FILES ${CMAKE_SOURCE_DIR}/config/msg-service-db.sql DESTINATION /usr/share/msg-service RENAME msg-service-db.sql)
        INSTALL(FILES ${CMAKE_SOURCE_DIR}/config/sysinfo-message.xml DESTINATION /etc/config)
 ENDIF(_FEATURE_SMS_CDMA)
+
+#For container enabled
+IF(_FEATURE_CONTAINER_ENABLE)
+       INSTALL (FILES ${CMAKE_SOURCE_DIR}/msg-service.res DESTINATION /usr/share/msg-service)
+ENDIF(_FEATURE_CONTAINER_ENABLE)
index 6617947..77be966 100644 (file)
@@ -20,7 +20,6 @@
 
 
 /**
- * @internal
  * @ingroup CAPI_MESSAGING_FRAMEWORK
  * @defgroup MSG_SERVICE_FRAMEWORK msg-service
  * @brief The @ref MSG_SERVICE_FRAMEWORK API provides functions to create, set properties and send or receive a SMS/MMS message.
index 10c4638..a8de2c4 100755 (executable)
@@ -8,7 +8,7 @@ IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
 ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
 MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")
 
-SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -O0 -g -Wall")
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -O2 -g -Wall")
 
 ##########################################################
 # Define Framework Utils
index 1c53a3f..fb6091b 100755 (executable)
@@ -70,7 +70,8 @@ msg_error_t MsgAlarmInit()
        }
 
        retval = alarmmgr_set_cb(MsgAlarmCB, NULL);
-       if (retval != ALARMMGR_RESULT_SUCCESS) MSG_DEBUG("alarmmgr_set_cb() [%d]", retval);
+       if (retval != ALARMMGR_RESULT_SUCCESS)
+               MSG_DEBUG("alarmmgr_set_cb() [%d]", retval);
 
        alarmInit = true;
 
@@ -100,9 +101,9 @@ msg_error_t MsgAlarmRegistration(struct tm *timeInfo, msg_alarm_cb userCB, int *
        }
 
        *alarmId = 0;
-       alarm_info_talarm_info = NULL;
-       alarm_id_t      alarm_id = -1;
-       alarm_date_t    target_time;
+       alarm_info_t *alarm_info = NULL;
+       alarm_id_t alarm_id = -1;
+       alarm_date_t target_time;
 
        int retval = ALARMMGR_RESULT_SUCCESS;
 
@@ -124,16 +125,23 @@ msg_error_t MsgAlarmRegistration(struct tm *timeInfo, msg_alarm_cb userCB, int *
                        target_time.hour, target_time.min, target_time.sec);
 
        retval = alarmmgr_set_time(alarm_info, target_time);
-       if (retval != ALARMMGR_RESULT_SUCCESS) MSG_DEBUG("alarmmgr_set_time ret[%d]", retval);
+       if (retval != ALARMMGR_RESULT_SUCCESS)
+               MSG_DEBUG("alarmmgr_set_time ret[%d]", retval);
+
        retval = alarmmgr_set_repeat_mode(alarm_info, ALARM_REPEAT_MODE_ONCE, 0);
-       if (retval != ALARMMGR_RESULT_SUCCESS) MSG_DEBUG("alarmmgr_set_repeat_mode ret[%d]", retval);
+       if (retval != ALARMMGR_RESULT_SUCCESS)
+               MSG_DEBUG("alarmmgr_set_repeat_mode ret[%d]", retval);
+
        retval = alarmmgr_set_type(alarm_info, ALARM_TYPE_DEFAULT);
-       if (retval != ALARMMGR_RESULT_SUCCESS) MSG_DEBUG("alarmmgr_set_type ret[%d]", retval);
+       if (retval != ALARMMGR_RESULT_SUCCESS)
+               MSG_DEBUG("alarmmgr_set_type ret[%d]", retval);
+
        retval = alarmmgr_add_alarm_with_localtime(alarm_info, NULL, &alarm_id);
        MSG_DEBUG("alarmmgr_add_alarm_with_localtime ret[%d], alarm_id[%d]", retval, alarm_id);
 
        retval = alarmmgr_free_alarm(alarm_info);
-       if (retval != ALARMMGR_RESULT_SUCCESS) MSG_DEBUG("alarmmgr_free_alarm ret[%d]", retval);
+       if (retval != ALARMMGR_RESULT_SUCCESS)
+               MSG_DEBUG("alarmmgr_free_alarm ret[%d]", retval);
 
        *alarmId = (int)alarm_id;
 
index 005aa77..2648090 100644 (file)
@@ -17,6 +17,7 @@
 
 #include <dd-display.h>
 
+#include "MsgCallStatusManager.h"
 #include "MsgDebug.h"
 #include "MsgMutex.h"
 #include "MsgGconfWrapper.h"
@@ -80,10 +81,10 @@ void MsgChangePmState()
        MSG_BEGIN();
        int callStatus = 0;
 
-       callStatus = MsgSettingGetInt(VCONFKEY_CALL_STATE);
+       callStatus = MsgGetCallStatus();
        MSG_DEBUG("Call Status = %d", callStatus);
 
-       if (callStatus > VCONFKEY_CALL_OFF && callStatus < VCONFKEY_CALL_STATE_MAX) {
+       if (callStatus > 0 && callStatus < 3) {
                MSG_DEBUG("Call is activated. Do not turn on the lcd.");
        } else {
                MSG_DEBUG("Call is not activated. Turn on the lcd.");
index 01e781e..0370069 100755 (executable)
 #include "MsgNotificationWrapper.h"
 #include "MsgSoundPlayer.h"
 #include "MsgDevicedWrapper.h"
+#include "MsgZoneManager.h"
+
 #include <libintl.h>
 #include <locale.h>
 #include <stdarg.h>
 
 extern "C"
 {
-#include <app_control.h>
-#include <notification.h>
+#include <bundle_internal.h>
+#include <app_control_internal.h>
+#ifndef MSG_WEARABLE_PROFILE
+#include <notification_list.h>
+#include <notification_text_domain.h>
 #include <notification_internal.h>
 #include <feedback.h>
-#include <badge.h>
+#include <badge_internal.h>
+#endif /* MSG_WEARABLE_PROFILE */
 }
 
+#ifndef MSG_WEARABLE_PROFILE
 
 /*======================================================================================*/
 /*                                                             VARIABLES AND STRUCTURES                                                                */
 /*======================================================================================*/
 
 int g_alarmId = 0;
-bool bFeedbackInit;
 
 GList *msg_report_notification_list;
 
@@ -65,9 +71,14 @@ typedef struct _msg_noti_info_s
        char            imagePath[MAX_IMAGE_PATH_LEN + 1];              /**< Indicates the image path of contact. */
        int                     applist;
        app_control_h           svc_h;
+       app_control_h           active_noti_svc_h[MSG_ACTIVE_NOTI_BUTTON_NUM];
        msg_message_id_t        msg_id;
        unsigned char           extra_data;
        int             sim_idx;
+       int                     active_noti_button_num;
+       char            active_sender[MSG_NOTI_TEXT_LEN_S];
+       char            active_subject[MSG_NOTI_TEXT_LEN_S];
+       char            active_text[MSG_NOTI_TEXT_LEN];
 }MSG_NOTI_INFO_S;
 
 typedef struct _report_notification_s
@@ -85,8 +96,9 @@ notification_h getHandle(int *noti_id);
 int getPrivId(msg_notification_type_t noti_type, int sim_idx);
 void updatePrivId(msg_notification_type_t noti_type, int noti_id, int sim_idx);
 
-void createInfoData(MSG_NOTI_INFO_S *noti_info, MSG_MESSAGE_INFO_S *msg_info); // For addNoti()
-void createInfoData(MSG_NOTI_INFO_S *noti_info, bool bTicker); // For refreshNoti()
+void createInfoData(MSG_NOTI_INFO_S *noti_info, MSG_MESSAGE_INFO_S *msg_info); /* For addNoti() */
+void createInfoData(MSG_NOTI_INFO_S *noti_info, msg_active_notification_type_t active_noti); /* For refreshNoti() */
+void createActiveInfoData(MSG_NOTI_INFO_S *noti_info, MSG_MESSAGE_INFO_S *msg_info);
 void clearInfoData(notification_h noti_h, MSG_NOTI_INFO_S *noti_info);
 
 msg_error_t getLatestMsgInfo(MSG_NOTI_INFO_S *noti_info, bool isForInstantMessage);
@@ -97,6 +109,10 @@ void setText(notification_h noti_h, MSG_NOTI_INFO_S *noti_info);
 void setIcon(notification_h noti_h, MSG_NOTI_INFO_S *noti_info);
 void setPkgName(notification_h noti_h, msg_notification_type_t noti_type);
 void setSoundAndVibration(notification_h noti_h, char *addressVal, bool bVoiceMail);
+void setActiveNotification(notification_h noti_h, MSG_NOTI_INFO_S *noti_info);
+void setActiveProperty(notification_h noti_h, MSG_NOTI_INFO_S *noti_info);
+void setActiveText(notification_h noti_h, MSG_NOTI_INFO_S *noti_info);
+void setActiveIcon(notification_h noti_h, MSG_NOTI_INFO_S *noti_info);
 
 void setNotification(notification_h noti_h, MSG_NOTI_INFO_S *noti_info, bool bFeedback);
 
@@ -105,7 +121,7 @@ void MsgRefreshNotiCb(void *data);
 
 bool isExistAddressInReportTable(const char *addr);
 
-// Wrapper
+/* Wrapper */
 void createServiceHandle(app_control_h *svc_h);
 void setServiceAppId(app_control_h svc_h, const char* app_id);
 void setServiceOperation(app_control_h svc_h, const char* operation);
@@ -121,16 +137,18 @@ void setNotiTime(notification_h noti_h, time_t time);
 void setNotiImage(notification_h noti_h, notification_image_type_e type, const char *image_path);
 void setNotiSound(notification_h noti_h, notification_sound_type_e type, const char *path);
 void setNotiVibration(notification_h noti_h, notification_vibration_type_e type, const char *path);
-void setFlashNoti(void);
+void setNotiEventHandler(notification_h noti_h, notification_event_type_e type, app_control_h event_handler);
 
 
-// Alarm
+/* Alarm */
 void MsgNotiSoundRepeatAlarmCB(int alarmId);
 void MsgSoundCreateRepeatAlarm(int RepeatTime);
 void MsgSoundSetRepeatAlarm();
 
 void sendMsgReplyPopup(MSG_NOTI_INFO_S *noti_info);
 
+#endif /* MSG_WEARABLE_PROFILE */
+
 /*======================================================================================*/
 /*                                                             FUNCTION IMPLEMENTATION                                                                 */
 /*======================================================================================*/
@@ -146,96 +164,91 @@ msg_error_t MsgInsertNotification(MSG_MESSAGE_INFO_S *msg_info)
 
        msg_notification_type_t noti_type;
 
-       switch (msg_info->msgType.subType)
-       {
+       switch (msg_info->msgType.subType) {
 #ifdef MSG_NOTI_INTEGRATION
-               case MSG_NORMAL_SMS :
-               case MSG_CB_SMS :
-                       {
-                               if (msg_info->msgType.classType == MSG_CLASS_0) {
-                                       noti_type = MSG_NOTI_TYPE_CLASS0;
-                               } else {
-                                       noti_type = MSG_NOTI_TYPE_NORMAL;
-                               }
-                       }
-                       break;
+       case MSG_NORMAL_SMS:
+       case MSG_CB_SMS: {
+               if (msg_info->msgType.classType == MSG_CLASS_0) {
+                       noti_type = MSG_NOTI_TYPE_CLASS0;
+               } else {
+                       noti_type = MSG_NOTI_TYPE_NORMAL;
+               }
+               break;
+       }
 #else
-               case MSG_NORMAL_SMS :
-                       {
-                               if (msg_info->msgType.classType == MSG_CLASS_0) {
-                                       noti_type = MSG_NOTI_TYPE_CLASS0;
-                               } else if (msg_info->msgType.classType == MSG_CLASS_2) {
-                                       noti_type = MSG_NOTI_TYPE_SIM;
-                               } else {
-                                       noti_type = MSG_NOTI_TYPE_NORMAL;
-                               }
-                       }
-                       break;
-               case MSG_CB_SMS :
-                       noti_type = MSG_NOTI_TYPE_CB;
-                       break;
+       case MSG_NORMAL_SMS: {
+               if (msg_info->msgType.classType == MSG_CLASS_0) {
+                       noti_type = MSG_NOTI_TYPE_CLASS0;
+               } else if (msg_info->msgType.classType == MSG_CLASS_2) {
+                       noti_type = MSG_NOTI_TYPE_SIM;
+               } else {
+                       noti_type = MSG_NOTI_TYPE_NORMAL;
+               }
+               break;
+       }
+       case MSG_CB_SMS:
+               noti_type = MSG_NOTI_TYPE_CB;
+               break;
 #endif
-               case MSG_MWI_FAX_SMS :
-               case MSG_MWI_EMAIL_SMS :
-               case MSG_MWI_OTHER_SMS :
-                       noti_type = MSG_NOTI_TYPE_MWI;
-                       break;
-               case MSG_MWI_VOICE_SMS :
-                       noti_type = MSG_NOTI_TYPE_VOICE_1;
-                       break;
-               case MSG_MWI_VOICE2_SMS :
-                       noti_type = MSG_NOTI_TYPE_VOICE_2;
-                       break;
-               case MSG_STATUS_REPORT_SMS :
-                       noti_type = MSG_NOTI_TYPE_SMS_DELIVERY_REPORT;
-                       break;
-               case MSG_DELIVERYIND_MMS :
-                       noti_type = MSG_NOTI_TYPE_MMS_DELIVERY_REPORT;
-                       break;
-               case MSG_READORGIND_MMS :
-                       noti_type = MSG_NOTI_TYPE_MMS_READ_REPORT;
-                       break;
-               default :
-               {
+       case MSG_MWI_FAX_SMS:
+       case MSG_MWI_EMAIL_SMS:
+       case MSG_MWI_OTHER_SMS:
+               noti_type = MSG_NOTI_TYPE_MWI;
+               break;
+       case MSG_MWI_VOICE_SMS:
+               noti_type = MSG_NOTI_TYPE_VOICE_1;
+               break;
+       case MSG_MWI_VOICE2_SMS:
+               noti_type = MSG_NOTI_TYPE_VOICE_2;
+               break;
+       case MSG_STATUS_REPORT_SMS:
+               noti_type = MSG_NOTI_TYPE_SMS_DELIVERY_REPORT;
+               break;
+       case MSG_DELIVERYIND_MMS:
+               noti_type = MSG_NOTI_TYPE_MMS_DELIVERY_REPORT;
+               break;
+       case MSG_READORGIND_MMS:
+               noti_type = MSG_NOTI_TYPE_MMS_READ_REPORT;
+               break;
+       default: {
 #ifdef MSG_NOTI_INTEGRATION
-                       noti_type = MSG_NOTI_TYPE_NORMAL;
+               noti_type = MSG_NOTI_TYPE_NORMAL;
 #else
-                       if (msg_info->msgType.classType == MSG_CLASS_2) {
-                               noti_type = MSG_NOTI_TYPE_SIM;
-                       } else {
-                               noti_type = MSG_NOTI_TYPE_NORMAL;
-                       }
-#endif
+               if (msg_info->msgType.classType == MSG_CLASS_2) {
+                       noti_type = MSG_NOTI_TYPE_SIM;
+               } else {
+                       noti_type = MSG_NOTI_TYPE_NORMAL;
                }
+#endif
                break;
        }
+       }
 
        MSG_DEBUG("Notification type = [%d]", noti_type);
 
-       switch (noti_type)
-       {
-               case MSG_NOTI_TYPE_NORMAL :
-               case MSG_NOTI_TYPE_SIM :
-               case MSG_NOTI_TYPE_CB :
-                       err = MsgRefreshNotification(noti_type, true, true);
-                       break;
-               case MSG_NOTI_TYPE_SMS_DELIVERY_REPORT :
-               case MSG_NOTI_TYPE_MMS_DELIVERY_REPORT :
-               case MSG_NOTI_TYPE_MMS_READ_REPORT :
-                       err = MsgAddReportNotification(noti_type, msg_info);
-                       break;
-               case MSG_NOTI_TYPE_VOICE_1 :
-               case MSG_NOTI_TYPE_VOICE_2 :
-               case MSG_NOTI_TYPE_MWI :
-               case MSG_NOTI_TYPE_CLASS0 :
-                       err = MsgAddNotification(noti_type, msg_info);
-                       break;
-               default :
-                       MSG_DEBUG("No matching type [%d]");
-                       break;
+       switch (noti_type) {
+       case MSG_NOTI_TYPE_NORMAL:
+       case MSG_NOTI_TYPE_SIM:
+       case MSG_NOTI_TYPE_CB:
+               err = MsgRefreshNotification(noti_type, true, MSG_ACTIVE_NOTI_TYPE_ACTIVE);
+               break;
+       case MSG_NOTI_TYPE_SMS_DELIVERY_REPORT:
+       case MSG_NOTI_TYPE_MMS_DELIVERY_REPORT:
+       case MSG_NOTI_TYPE_MMS_READ_REPORT:
+               err = MsgAddReportNotification(noti_type, msg_info);
+               break;
+       case MSG_NOTI_TYPE_VOICE_1:
+       case MSG_NOTI_TYPE_VOICE_2:
+       case MSG_NOTI_TYPE_MWI:
+       case MSG_NOTI_TYPE_CLASS0:
+               err = MsgAddNotification(noti_type, msg_info);
+               break;
+       default:
+               MSG_DEBUG("No matching type [%d]");
+               break;
        }
 
-#endif // MSG_WEARABLE_PROFILE
+#endif /* MSG_WEARABLE_PROFILE */
 
        MSG_END();
 
@@ -243,6 +256,32 @@ msg_error_t MsgInsertNotification(MSG_MESSAGE_INFO_S *msg_info)
 
 }
 
+msg_error_t MsgInsertOnlyActiveNotification(msg_notification_type_t noti_type, MSG_MESSAGE_INFO_S *msg_info)
+{
+       MSG_BEGIN();
+
+       msg_error_t msg_err = MSG_SUCCESS;
+#ifndef MSG_WEARABLE_PROFILE
+       notification_h noti_h = NULL;
+
+       MSG_NOTI_INFO_S noti_info = {0,};
+
+       noti_info.type = noti_type;
+       noti_info.active_noti_button_num = 1;
+
+       createActiveInfoData(&noti_info, msg_info);
+
+       noti_h = notification_create(NOTIFICATION_TYPE_NOTI);
+
+       setActiveNotification(noti_h, &noti_info);
+
+       clearInfoData(noti_h, &noti_info);
+#endif /* MSG_WEARABLE_PROFILE */
+       MSG_END();
+       return msg_err;
+}
+
+
 msg_error_t MsgDeleteReportNotification(const char *addr)
 {
        MSG_BEGIN();
@@ -251,6 +290,8 @@ msg_error_t MsgDeleteReportNotification(const char *addr)
 
 #ifndef MSG_WEARABLE_PROFILE
 
+       MsgZoneChange();
+
        notification_h noti_h = NULL;
        bool bNotification = true;
 
@@ -263,6 +304,7 @@ msg_error_t MsgDeleteReportNotification(const char *addr)
 
        if (bNotification == false) {
                MSG_DEBUG("Msg Alert notification is off.");
+               MsgZoneRevert();
                return msg_err;
        }
 
@@ -275,20 +317,19 @@ msg_error_t MsgDeleteReportNotification(const char *addr)
        if (list_length > 0) {
                GList *iter = g_list_first(msg_report_notification_list);
 
-               while (iter != NULL)
-               {
+               while (iter != NULL) {
                        isDelete = false;
                        report_notification_s *info = (report_notification_s*)(iter->data);
                        if (info == NULL) {
                                MSG_DEBUG("info is NULL!");
+                               MsgZoneRevert();
                                return MSG_ERR_UNKNOWN;
                        }
 
                        MSG_SEC_DEBUG("list data = [priv_id = %d address = %s]", info->priv_id, info->addressVal);
 
                        noti_h = notification_load(NULL, info->priv_id);
-                       if (noti_h == NULL)
-                       {
+                       if (noti_h == NULL) {
                                MSG_DEBUG("notification with priv_id [%d] is NULL", info->priv_id);
                                isDelete = true;
                        } else {
@@ -300,8 +341,7 @@ msg_error_t MsgDeleteReportNotification(const char *addr)
                                        if (notification_delete(noti_h) == NOTIFICATION_ERROR_NONE) {
                                                MSG_SEC_DEBUG("delete report notification address [%s]", info->addressVal);
                                                isDelete = true;
-                                       }
-                                       else {
+                                       } else {
                                                MSG_DEBUG("delete notification failed");
                                        }
                                }
@@ -314,7 +354,7 @@ msg_error_t MsgDeleteReportNotification(const char *addr)
 
                        if (isDelete) {
                                msg_report_notification_list = g_list_remove(msg_report_notification_list, (void *)info);
-                               if(info) {
+                               if (info) {
                                        delete info;
                                        info = NULL;
                                }
@@ -322,7 +362,9 @@ msg_error_t MsgDeleteReportNotification(const char *addr)
                }
        }
 
-#endif // MSG_WEARABLE_PROFILE
+       MsgZoneRevert();
+
+#endif /* MSG_WEARABLE_PROFILE */
 
        MSG_END();
 
@@ -332,7 +374,11 @@ msg_error_t MsgDeleteReportNotification(const char *addr)
 msg_error_t MsgAddReportNotification(msg_notification_type_t noti_type, MSG_MESSAGE_INFO_S *msg_info)
 {
        msg_error_t msg_err = MSG_SUCCESS;
+
 #ifndef MSG_WEARABLE_PROFILE
+
+       MsgZoneChange();
+
        notification_h noti_h = NULL;
 
        MSG_NOTI_INFO_S noti_info;
@@ -362,18 +408,25 @@ msg_error_t MsgAddReportNotification(msg_notification_type_t noti_type, MSG_MESS
 
 __END_OF_REFRESH_NOTI :
        clearInfoData(noti_h, &noti_info);
-#endif // MSG_WEARABLE_PROFILE
+
+       MsgZoneRevert();
+
+#endif /* MSG_WEARABLE_PROFILE */
        return msg_err;
 }
 
-msg_error_t MsgRefreshNotification(msg_notification_type_t noti_type, bool bFeedback, bool bTicker)
+msg_error_t MsgRefreshNotification(msg_notification_type_t noti_type, bool bFeedback, msg_active_notification_type_t active_type)
 {
 
        msg_error_t msg_err = MSG_SUCCESS;
+
 #ifndef MSG_WEARABLE_PROFILE
+
+       MsgZoneChange();
+
        notification_h noti_h = NULL;
        bool bNotification = true;
-       bool bReplyPopup = false;
+/*     bool bReplyPopup = false; */
 
        MSG_NOTI_INFO_S noti_info;
        memset(&noti_info, 0x00, sizeof(MSG_NOTI_INFO_S));
@@ -389,7 +442,7 @@ msg_error_t MsgRefreshNotification(msg_notification_type_t noti_type, bool bFeed
                goto __END_OF_REFRESH_NOTI;
        }
 
-       if (bTicker) {
+       if (active_type == MSG_ACTIVE_NOTI_TYPE_INSTANT) {
                msg_err = MsgInsertInstantMessage(noti_type);
 
                if (msg_err != MSG_SUCCESS) {
@@ -404,10 +457,10 @@ msg_error_t MsgRefreshNotification(msg_notification_type_t noti_type, bool bFeed
 
        if (bNotification == false) {
                MSG_DEBUG("Msg Alert notification is off.");
-               return msg_err;
+               goto __END_OF_REFRESH_NOTI;
        }
 
-       createInfoData(&noti_info, bTicker);
+       createInfoData(&noti_info, active_type);
 
        noti_h = getHandle(&noti_info.id);
 
@@ -419,6 +472,7 @@ msg_error_t MsgRefreshNotification(msg_notification_type_t noti_type, bool bFeed
 
        setNotification(noti_h, &noti_info, bFeedback);
 
+#if 0
        if (MsgSettingGetBool(VCONFKEY_MESSAGE_POPUP_DISPLAY_ENABLE , &bReplyPopup) != MSG_SUCCESS) {
                MSG_DEBUG("MsgSettingGetBool is failed.");
        }
@@ -427,10 +481,14 @@ msg_error_t MsgRefreshNotification(msg_notification_type_t noti_type, bool bFeed
                MSG_DEBUG("Msg reply popup is on.");
                sendMsgReplyPopup(&noti_info);
        }
+#endif
 
 __END_OF_REFRESH_NOTI :
        clearInfoData(noti_h, &noti_info);
-#endif // MSG_WEARABLE_PROFILE
+
+       MsgZoneRevert();
+
+#endif /* MSG_WEARABLE_PROFILE */
        return msg_err;
 }
 
@@ -438,7 +496,11 @@ __END_OF_REFRESH_NOTI :
 msg_error_t MsgAddNotification(msg_notification_type_t noti_type, MSG_MESSAGE_INFO_S *msg_info)
 {
        msg_error_t msg_err = MSG_SUCCESS;
+
 #ifndef MSG_WEARABLE_PROFILE
+
+       MsgZoneChange();
+
        notification_h noti_h = NULL;
 
        MSG_NOTI_INFO_S noti_info = {0,};
@@ -459,45 +521,48 @@ msg_error_t MsgAddNotification(msg_notification_type_t noti_type, MSG_MESSAGE_IN
 
 __END_OF_ADD_NOTI :
        clearInfoData(noti_h, &noti_info);
-#endif // MSG_WEARABLE_PROFILE
+
+       MsgZoneRevert();
+
+#endif /* MSG_WEARABLE_PROFILE */
        return msg_err;
 }
 
 
-void MsgRefreshAllNotification(bool bWithSimNoti, bool bFeedback, bool bTickerNoti)
+void MsgRefreshAllNotification(bool bWithSimNoti, bool bFeedback, msg_active_notification_type_t active_type)
 {
        MSG_BEGIN();
 
 #ifndef MSG_WEARABLE_PROFILE
        msg_error_t err = MSG_SUCCESS;
 
-//     MsgDeleteNotification(MSG_NOTI_TYPE_SIM);
+/*     MsgDeleteNotification(MSG_NOTI_TYPE_SIM); */
 
 #ifdef MSG_NOTI_INTEGRATION
-       err = MsgRefreshNotification(MSG_NOTI_TYPE_NORMAL, bFeedback, bTickerNoti);
+       err = MsgRefreshNotification(MSG_NOTI_TYPE_NORMAL, bFeedback, active_type);
        if (err != MSG_SUCCESS)
                MSG_DEBUG("refreshNoti is failed, [type=%d, err=%d]", MSG_NOTI_TYPE_NORMAL, err);
 #else
-       err = MsgRefreshNotification(MSG_NOTI_TYPE_NORMAL, bFeedback, bTickerNoti);
+       err = MsgRefreshNotification(MSG_NOTI_TYPE_NORMAL, bFeedback, active_type);
        if (err != MSG_SUCCESS)
                MSG_DEBUG("refreshNoti is failed, [type=%d, err=%d]", MSG_NOTI_TYPE_NORMAL, err);
 
-       err = MsgRefreshNotification(MSG_NOTI_TYPE_CB, bFeedback, bTickerNoti);
+       err = MsgRefreshNotification(MSG_NOTI_TYPE_CB, bFeedback, active_type);
        if (err != MSG_SUCCESS)
                MSG_DEBUG("refreshNoti is failed, [type=%d, err=%d]", MSG_NOTI_TYPE_CB, err);
 
        if (bWithSimNoti) {
-               err = MsgRefreshNotification(MSG_NOTI_TYPE_SIM, bFeedback, bTickerNoti);
+               err = MsgRefreshNotification(MSG_NOTI_TYPE_SIM, bFeedback, active_type);
                if (err != MSG_SUCCESS)
                        MSG_DEBUG("refreshNoti is failed, [type=%d, err=%d]", MSG_NOTI_TYPE_SIM, err);
        }
 #endif
 
-       err = MsgRefreshNotification(MSG_NOTI_TYPE_FAILED, bFeedback, bTickerNoti);
+       err = MsgRefreshNotification(MSG_NOTI_TYPE_FAILED, bFeedback, active_type);
        if (err != MSG_SUCCESS)
                MSG_DEBUG("refreshNoti is failed, [type=%d, err=%d]", MSG_NOTI_TYPE_FAILED, err);
 
-#endif // MSG_WEARABLE_PROFILE
+#endif /* MSG_WEARABLE_PROFILE */
        MSG_END();
 }
 
@@ -505,6 +570,9 @@ void MsgRefreshAllNotification(bool bWithSimNoti, bool bFeedback, bool bTickerNo
 void MsgDeleteNotification(msg_notification_type_t noti_type, int simIndex)
 {
 #ifndef MSG_WEARABLE_PROFILE
+
+       MsgZoneChange();
+
        int noti_err = NOTIFICATION_ERROR_NONE;
 
        if (noti_type == MSG_NOTI_TYPE_ALL) {
@@ -529,7 +597,10 @@ void MsgDeleteNotification(msg_notification_type_t noti_type, int simIndex)
        }
 
        updatePrivId(noti_type, 0, simIndex);
-#endif // MSG_WEARABLE_PROFILE
+
+       MsgZoneRevert();
+
+#endif /* MSG_WEARABLE_PROFILE */
 }
 
 
@@ -568,7 +639,11 @@ bool isExistAddressInReportTable(const char *addr)
 void MsgInitReportNotiList()
 {
        MSG_BEGIN();
+
 #ifndef MSG_WEARABLE_PROFILE
+
+       MsgZoneChange();
+
        msg_report_notification_list = NULL;
 
        notification_h noti = NULL;
@@ -580,6 +655,7 @@ void MsgInitReportNotiList()
        noti_err = notification_get_list(NOTIFICATION_TYPE_NONE, -1, &noti_list);
        if (noti_err != NOTIFICATION_ERROR_NONE) {
                MSG_DEBUG("notification_get_list() is failed!!");
+               MsgZoneRevert();
                return;
        }
 
@@ -591,7 +667,7 @@ void MsgInitReportNotiList()
                char tempAddr[MAX_ADDRESS_VAL_LEN+1];
                memset(tempAddr, 0x00, sizeof(tempAddr));
 
-               noti_err  = notification_get_execute_option(noti, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, &b);
+               noti_err = notification_get_execute_option(noti, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, &b);
                if (noti_err != NOTIFICATION_ERROR_NONE) {
                        MSG_DEBUG("notification_get_excute_option() failed!!");
                        break;
@@ -618,7 +694,9 @@ void MsgInitReportNotiList()
        if (head_noti_list)
                notification_free_list(head_noti_list);
 
-#endif // MSG_WEARABLE_PROFILE
+       MsgZoneRevert();
+
+#endif /* MSG_WEARABLE_PROFILE */
        MSG_END();
 }
 
@@ -626,6 +704,9 @@ void MsgInitReportNotiList()
 msg_error_t MsgInitNoti()
 {
 #ifndef MSG_WEARABLE_PROFILE
+
+       MsgZoneChange();
+
        bool bNotiSvcReady = false;
 
        bNotiSvcReady = notification_is_service_ready();
@@ -635,10 +716,9 @@ msg_error_t MsgInitNoti()
 #ifndef MSG_NOTI_INTEGRATION
                MsgDeleteNotification(MSG_NOTI_TYPE_SIM, -1);
 #endif
-               MsgRefreshAllNotification(false, true, true);           // On Booting
+               MsgRefreshAllNotification(false, true, MSG_ACTIVE_NOTI_TYPE_INSTANT);           /* On Booting */
                MsgInitReportNotiList();
-       }
-       else {
+       } else {
                MSG_DEBUG("Notification server is not available. Init is defered");
 #ifndef MSG_NOTI_INTEGRATION
                MSG_NOTI_INFO_S *delNotiInfo = (MSG_NOTI_INFO_S *)calloc(1, sizeof(MSG_NOTI_INFO_S));
@@ -651,7 +731,9 @@ msg_error_t MsgInitNoti()
                notification_add_deferred_task(MsgRefreshNotiCb, (void *)NULL);
        }
 
-#endif // MSG_WEARABLE_PROFILE
+       MsgZoneRevert();
+
+#endif /* MSG_WEARABLE_PROFILE */
        return MSG_SUCCESS;
 }
 
@@ -659,6 +741,9 @@ msg_error_t MsgInitNoti()
 msg_error_t MsgDeleteNoti(msg_notification_type_t noti_type, int simIndex)
 {
 #ifndef MSG_WEARABLE_PROFILE
+
+       MsgZoneChange();
+
        bool bNotiSvcReady = false;
 
        MSG_NOTI_INFO_S *delNotiInfo = (MSG_NOTI_INFO_S *)calloc(1, sizeof(MSG_NOTI_INFO_S));
@@ -677,7 +762,10 @@ msg_error_t MsgDeleteNoti(msg_notification_type_t noti_type, int simIndex)
                MSG_DEBUG("Notification server is not available. Delete is defered");
                notification_add_deferred_task(MsgDeleteNotiCb, (void *)delNotiInfo);
        }
-#endif // MSG_WEARABLE_PROFILE
+
+       MsgZoneRevert();
+
+#endif /* MSG_WEARABLE_PROFILE */
        return MSG_SUCCESS;
 }
 
@@ -685,13 +773,16 @@ msg_error_t MsgDeleteNoti(msg_notification_type_t noti_type, int simIndex)
 msg_error_t MsgInsertTicker(const char* pTickerMsg, const char* pLocaleTickerMsg, bool bPlayFeedback, int msgId)
 {
 #ifndef MSG_WEARABLE_PROFILE
+
+       MsgZoneChange();
+
        MSG_DEBUG("pTickerMsg=[%s], pLocaleTickerMsg=[%s]", pTickerMsg, pLocaleTickerMsg);
        MSG_DEBUG("play feedback=[%d], msgId=[%d]", bPlayFeedback, msgId);
 
        MsgChangePmState();
 
        char *notiMsg = NULL;
-       bool bTicker = false;
+       msg_active_notification_type_t active_type = MSG_ACTIVE_NOTI_TYPE_NONE;
 
        notiMsg = getTranslateText(MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR, pLocaleTickerMsg);
        MSG_DEBUG("notiMsg %s", notiMsg);
@@ -705,8 +796,8 @@ msg_error_t MsgInsertTicker(const char* pTickerMsg, const char* pLocaleTickerMsg
                        notification_status_message_post(notiMsg);
                }
        } else {
-               //Show ticker popup for sending failed msg.
-               bTicker = true;
+               /* Show ticker popup for sending failed msg. */
+               active_type = MSG_ACTIVE_NOTI_TYPE_INSTANT;
        }
 
        if (notiMsg) {
@@ -715,26 +806,27 @@ msg_error_t MsgInsertTicker(const char* pTickerMsg, const char* pLocaleTickerMsg
        }
 
        if (bPlayFeedback) {
-               if (msgId > 0 && \
-                       (g_strcmp0(pLocaleTickerMsg, SMS_MESSAGE_SENDING_FAIL) == 0 || g_strcmp0(pLocaleTickerMsg, SENDING_MULTIMEDIA_MESSAGE_FAILED) == 0))
-               {
+               if (msgId > 0 &&
+                       (g_strcmp0(pLocaleTickerMsg, SMS_MESSAGE_SENDING_FAIL) == 0 || g_strcmp0(pLocaleTickerMsg, SENDING_MULTIMEDIA_MESSAGE_FAILED) == 0)) {
                        msg_error_t err = MSG_SUCCESS;
-                       err = MsgRefreshNotification(MSG_NOTI_TYPE_FAILED, true, bTicker);
+                       err = MsgRefreshNotification(MSG_NOTI_TYPE_FAILED, true, active_type);
                        if (err != MSG_SUCCESS) {
                                MSG_DEBUG("MsgRefreshFailedNoti err=[%d]", err);
                        }
                } else if (g_strcmp0(pLocaleTickerMsg, SMS_MESSAGE_SIM_MESSAGE_FULL) == 0) {
                        msg_error_t err = MSG_SUCCESS;
-                       err = MsgRefreshNotification(MSG_NOTI_TYPE_SIM_FULL, true, false);
+                       err = MsgRefreshNotification(MSG_NOTI_TYPE_SIM_FULL, true, MSG_ACTIVE_NOTI_TYPE_NONE);
                        if (err != MSG_SUCCESS) {
                                MSG_DEBUG("MsgRefreshSimFullNoti err=[%d]", err);
                        }
-               }
-               else {
+               } else {
                        MsgSoundPlayer::instance()->MsgSoundPlayStart(NULL, MSG_SOUND_PLAY_DEFAULT);
                }
        }
-#endif // MSG_WEARABLE_PROFILE
+
+       MsgZoneRevert();
+
+#endif /* MSG_WEARABLE_PROFILE */
        return MSG_SUCCESS;
 }
 
@@ -742,6 +834,9 @@ msg_error_t MsgInsertTicker(const char* pTickerMsg, const char* pLocaleTickerMsg
 msg_error_t MsgInsertBadge(unsigned int unreadMsgCnt)
 {
 #ifndef MSG_WEARABLE_PROFILE
+
+       MsgZoneChange();
+
        MSG_DEBUG("Start to set badge to [%d].", unreadMsgCnt);
 
        int err = BADGE_ERROR_NONE;
@@ -751,14 +846,16 @@ msg_error_t MsgInsertBadge(unsigned int unreadMsgCnt)
 
        if (err != BADGE_ERROR_NONE) {
                MSG_DEBUG("Fail to badge_is_existing : %d", err);
+               MsgZoneRevert();
                return MSG_ERR_UNKNOWN;
        }
 
        if (!exist) {
                /* create badge */
-               err = badge_new(MSG_DEFAULT_APP_ID);
+               err = badge_create(MSG_DEFAULT_APP_ID, "/usr/bin/msg-server");
                if (err != BADGE_ERROR_NONE) {
                        MSG_DEBUG("Fail to badge_new : %d", err);
+                       MsgZoneRevert();
                        return MSG_ERR_UNKNOWN;
                }
        }
@@ -767,17 +864,21 @@ msg_error_t MsgInsertBadge(unsigned int unreadMsgCnt)
 
        if (err != BADGE_ERROR_NONE) {
                MSG_DEBUG("Fail to badge_set_count : %d", err);
+               MsgZoneRevert();
                return MSG_ERR_UNKNOWN;
        }
 
-#endif // MSG_WEARABLE_PROFILE
+       MsgZoneRevert();
+
+#endif /* MSG_WEARABLE_PROFILE */
        return MSG_SUCCESS;
 }
 
+#ifndef MSG_WEARABLE_PROFILE
 
 void MsgRefreshNotiCb(void *data)
 {
-       MsgRefreshAllNotification(false, true, true);
+       MsgRefreshAllNotification(false, true, MSG_ACTIVE_NOTI_TYPE_INSTANT);
        MsgInitReportNotiList();
 
        if (data) {
@@ -806,6 +907,8 @@ void MsgDeleteNotiCb(void *data)
 
 notification_h getHandle(int *noti_id)
 {
+       MsgZoneChange();
+
        notification_h noti_h = NULL;
 
        if (*noti_id > 0) {
@@ -826,6 +929,8 @@ notification_h getHandle(int *noti_id)
                *noti_id = 0;
        }
 
+       MsgZoneRevert();
+
        return noti_h;
 }
 
@@ -836,48 +941,45 @@ int getPrivId(msg_notification_type_t noti_type, int sim_idx)
 
        int noti_id = 0;
 
-       switch (noti_type)
-       {
+       switch (noti_type) {
 #ifdef MSG_NOTI_INTEGRATION
-               case MSG_NOTI_TYPE_NORMAL :
-               case MSG_NOTI_TYPE_SIM :
-               case MSG_NOTI_TYPE_CB :
-                       noti_id = MsgSettingGetInt(NOTIFICATION_PRIV_ID);
-                       break;
+       case MSG_NOTI_TYPE_NORMAL:
+       case MSG_NOTI_TYPE_SIM:
+       case MSG_NOTI_TYPE_CB:
+               noti_id = MsgSettingGetInt(NOTIFICATION_PRIV_ID);
+               break;
 #else
-               case MSG_NOTI_TYPE_NORMAL :
-                       noti_id = MsgSettingGetInt(NOTIFICATION_PRIV_ID);
-                       break;
-               case MSG_NOTI_TYPE_SIM :
-                       noti_id = MsgSettingGetInt(SIM_MSG_NOTI_PRIV_ID);
-                       break;
-               case MSG_NOTI_TYPE_CB :
-                       noti_id = MsgSettingGetInt(CB_NOTI_PRIV_ID);
-                       break;
+       case MSG_NOTI_TYPE_NORMAL:
+               noti_id = MsgSettingGetInt(NOTIFICATION_PRIV_ID);
+               break;
+       case MSG_NOTI_TYPE_SIM:
+               noti_id = MsgSettingGetInt(SIM_MSG_NOTI_PRIV_ID);
+               break;
+       case MSG_NOTI_TYPE_CB:
+               noti_id = MsgSettingGetInt(CB_NOTI_PRIV_ID);
+               break;
 #endif
-               case MSG_NOTI_TYPE_FAILED :
-                       noti_id = MsgSettingGetInt(MSG_SENTFAIL_NOTI_ID);
-                       break;
-               case MSG_NOTI_TYPE_VOICE_1 :
-                       {
-                               char keyName[MAX_VCONFKEY_NAME_LEN] = {0,};
-                               snprintf(keyName, sizeof(keyName), "%s/%d", VOICE_NOTI_ID_1, sim_idx);
-                               noti_id = MsgSettingGetInt(keyName);
-                       }
-                       break;
-               case MSG_NOTI_TYPE_VOICE_2 :
-                       {
-                               char keyName[MAX_VCONFKEY_NAME_LEN] = {0,};
-                               snprintf(keyName, sizeof(keyName), "%s/%d", VOICE_NOTI_ID_2, sim_idx);
-                               noti_id = MsgSettingGetInt(keyName);
-                       }
-                       break;
-               case MSG_NOTI_TYPE_SIM_FULL :
-                       noti_id = MsgSettingGetInt(SIM_FULL_NOTI_PRIV_ID);
-                       break;
-               default :
-                       MSG_DEBUG("No matching noti type [%d]", noti_type);
-                       break;
+       case MSG_NOTI_TYPE_FAILED:
+               noti_id = MsgSettingGetInt(MSG_SENTFAIL_NOTI_ID);
+               break;
+       case MSG_NOTI_TYPE_VOICE_1: {
+               char keyName[MAX_VCONFKEY_NAME_LEN] = {0,};
+               snprintf(keyName, sizeof(keyName), "%s/%d", VOICE_NOTI_ID_1, sim_idx);
+               noti_id = MsgSettingGetInt(keyName);
+               break;
+       }
+       case MSG_NOTI_TYPE_VOICE_2: {
+               char keyName[MAX_VCONFKEY_NAME_LEN] = {0,};
+               snprintf(keyName, sizeof(keyName), "%s/%d", VOICE_NOTI_ID_2, sim_idx);
+               noti_id = MsgSettingGetInt(keyName);
+               break;
+       }
+       case MSG_NOTI_TYPE_SIM_FULL:
+               noti_id = MsgSettingGetInt(SIM_FULL_NOTI_PRIV_ID);
+               break;
+       default:
+               MSG_DEBUG("No matching noti type [%d]", noti_type);
+               break;
        }
 
        MSG_DEBUG("Get noti type = %d, id = %d, sim_idx:%d", noti_type, noti_id, sim_idx);
@@ -896,48 +998,45 @@ void updatePrivId(msg_notification_type_t noti_type, int noti_id, int sim_idx)
 
        MSG_DEBUG("Update noti type = %d, id = %d, sim_idx = %d", noti_type, noti_id, sim_idx);
 
-       switch (noti_type)
-       {
+       switch (noti_type) {
 #ifdef MSG_NOTI_INTEGRATION
-               case MSG_NOTI_TYPE_NORMAL :
-               case MSG_NOTI_TYPE_SIM :
-               case MSG_NOTI_TYPE_CB :
-                       err = MsgSettingSetInt(NOTIFICATION_PRIV_ID, noti_id);
-                       break;
+       case MSG_NOTI_TYPE_NORMAL:
+       case MSG_NOTI_TYPE_SIM:
+       case MSG_NOTI_TYPE_CB:
+               err = MsgSettingSetInt(NOTIFICATION_PRIV_ID, noti_id);
+               break;
 #else
-               case MSG_NOTI_TYPE_NORMAL :
-                       err = MsgSettingSetInt(NOTIFICATION_PRIV_ID, noti_id);
-                       break;
-               case MSG_NOTI_TYPE_SIM :
-                       err = MsgSettingSetInt(SIM_MSG_NOTI_PRIV_ID, noti_id);
-                       break;
-               case MSG_NOTI_TYPE_CB :
-                       err = MsgSettingSetInt(CB_NOTI_PRIV_ID, noti_id);
-                       break;
+       case MSG_NOTI_TYPE_NORMAL:
+               err = MsgSettingSetInt(NOTIFICATION_PRIV_ID, noti_id);
+               break;
+       case MSG_NOTI_TYPE_SIM:
+               err = MsgSettingSetInt(SIM_MSG_NOTI_PRIV_ID, noti_id);
+               break;
+       case MSG_NOTI_TYPE_CB:
+               err = MsgSettingSetInt(CB_NOTI_PRIV_ID, noti_id);
+               break;
 #endif
-               case MSG_NOTI_TYPE_FAILED :
-                       err = MsgSettingSetInt(MSG_SENTFAIL_NOTI_ID, noti_id);
-                       break;
-               case MSG_NOTI_TYPE_VOICE_1 :
-                       {
-                               char keyName[MAX_VCONFKEY_NAME_LEN] = {0,};
-                               snprintf(keyName, sizeof(keyName), "%s/%d", VOICE_NOTI_ID_1, sim_idx);
-                               err = MsgSettingSetInt(keyName, noti_id);
-                       }
-                       break;
-               case MSG_NOTI_TYPE_VOICE_2 :
-                       {
-                               char keyName[MAX_VCONFKEY_NAME_LEN] = {0,};
-                               snprintf(keyName, sizeof(keyName), "%s/%d", VOICE_NOTI_ID_2, sim_idx);
-                               err = MsgSettingSetInt(keyName, noti_id);
-                       }
-                       break;
-               case MSG_NOTI_TYPE_SIM_FULL :
-                       err = MsgSettingSetInt(SIM_FULL_NOTI_PRIV_ID, noti_id);
-                       break;
-               default:
-                       MSG_DEBUG("No matching type [%d]", noti_type);
-                       break;
+       case MSG_NOTI_TYPE_FAILED:
+               err = MsgSettingSetInt(MSG_SENTFAIL_NOTI_ID, noti_id);
+               break;
+       case MSG_NOTI_TYPE_VOICE_1: {
+               char keyName[MAX_VCONFKEY_NAME_LEN] = {0,};
+               snprintf(keyName, sizeof(keyName), "%s/%d", VOICE_NOTI_ID_1, sim_idx);
+               err = MsgSettingSetInt(keyName, noti_id);
+               break;
+       }
+       case MSG_NOTI_TYPE_VOICE_2: {
+               char keyName[MAX_VCONFKEY_NAME_LEN] = {0,};
+               snprintf(keyName, sizeof(keyName), "%s/%d", VOICE_NOTI_ID_2, sim_idx);
+               err = MsgSettingSetInt(keyName, noti_id);
+               break;
+       }
+       case MSG_NOTI_TYPE_SIM_FULL:
+               err = MsgSettingSetInt(SIM_FULL_NOTI_PRIV_ID, noti_id);
+               break;
+       default:
+               MSG_DEBUG("No matching type [%d]", noti_type);
+               break;
        }
 
        if (err != MSG_SUCCESS)
@@ -947,101 +1046,102 @@ void updatePrivId(msg_notification_type_t noti_type, int noti_id, int sim_idx)
 }
 
 
-void createInfoData(MSG_NOTI_INFO_S *noti_info, bool bTicker)
+void createInfoData(MSG_NOTI_INFO_S *noti_info, msg_active_notification_type_t active_noti)
 {
        MSG_BEGIN();
 
        createServiceHandle(&noti_info->svc_h);
 
-       switch (noti_info->type)
-       {
-               case MSG_NOTI_TYPE_NORMAL :
-                       {
-                               if (noti_info->count > 1) {
-                                       noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_MULTIPLE;
-                               } else {
-                                       noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_SINGLE;
-                               }
-
-                               setServiceAppId(noti_info->svc_h, MSG_DEFAULT_APP_ID);
-                               addServiceExtraData(noti_info->svc_h, "type", "new_msg");
-                               addServiceExtraData(noti_info->svc_h, "msgId", noti_info->msg_id);
-                               addServiceExtraData(noti_info->svc_h, "http://tizen.org/appcontrol/data/notification", "new_message");
-
-                               bool bReplyPopup = false;
-                               if (MsgSettingGetBool(VCONFKEY_MESSAGE_POPUP_DISPLAY_ENABLE , &bReplyPopup) != MSG_SUCCESS) {
-                                       MSG_DEBUG("MsgSettingGetBool is failed.");
-                               }
+       switch (noti_info->type) {
+       case MSG_NOTI_TYPE_NORMAL: {
+               if (noti_info->count > 1) {
+                       noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_MULTIPLE;
+               } else {
+                       noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_SINGLE;
+               }
 
-                               noti_info->applist = NOTIFICATION_DISPLAY_APP_ALL^NOTIFICATION_DISPLAY_APP_TICKER;
-                       }
-                       break;
+               setServiceAppId(noti_info->svc_h, MSG_DEFAULT_APP_ID);
+               addServiceExtraData(noti_info->svc_h, "type", "new_msg");
+               addServiceExtraData(noti_info->svc_h, "msgId", noti_info->msg_id);
+               addServiceExtraData(noti_info->svc_h, "http://tizen.org/appcontrol/data/notification", "new_message");
 
-               case MSG_NOTI_TYPE_CB :
-                       {
-                               if (noti_info->count > 1) {
-                                       noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_MULTIPLE;
-                               } else {
-                                       noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_SINGLE;
-                               }
+#if 0
+               bool bReplyPopup = false;
+               if (MsgSettingGetBool(VCONFKEY_MESSAGE_POPUP_DISPLAY_ENABLE , &bReplyPopup) != MSG_SUCCESS) {
+                       MSG_DEBUG("MsgSettingGetBool is failed.");
+               }
+#endif
+               noti_info->applist = NOTIFICATION_DISPLAY_APP_ALL^NOTIFICATION_DISPLAY_APP_TICKER;
 
-                               setServiceAppId(noti_info->svc_h, MSG_DEFAULT_APP_ID);
-                               addServiceExtraData(noti_info->svc_h, "type", "new_msg");
-                               addServiceExtraData(noti_info->svc_h, "msgId", noti_info->msg_id);
+               if (noti_info->active_noti_button_num == 0)
+                       noti_info->active_noti_button_num = 3;
+               break;
+       }
+       case MSG_NOTI_TYPE_CB: {
+               if (noti_info->count > 1) {
+                       noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_MULTIPLE;
+               } else {
+                       noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_SINGLE;
+               }
 
-                               if (bTicker)
-                                       noti_info->applist = NOTIFICATION_DISPLAY_APP_ALL^NOTIFICATION_DISPLAY_APP_LOCK;
-                               else
-                                       noti_info->applist = NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY|NOTIFICATION_DISPLAY_APP_INDICATOR;
-                       }
-                       break;
+               setServiceAppId(noti_info->svc_h, MSG_DEFAULT_APP_ID);
+               addServiceExtraData(noti_info->svc_h, "type", "new_msg");
+               addServiceExtraData(noti_info->svc_h, "msgId", noti_info->msg_id);
 
-               case MSG_NOTI_TYPE_SIM :
-                       {
-                               if (noti_info->count > 1) {
-                                       noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_MULTIPLE;
-                               } else {
-                                       noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_SINGLE;
-                               }
+               if (active_noti == MSG_ACTIVE_NOTI_TYPE_INSTANT)
+                       noti_info->applist = NOTIFICATION_DISPLAY_APP_ALL^NOTIFICATION_DISPLAY_APP_LOCK;
+               else
+                       noti_info->applist = NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY|NOTIFICATION_DISPLAY_APP_INDICATOR;
 
-                               setServiceAppId(noti_info->svc_h, MSG_DEFAULT_APP_ID);
-                               addServiceExtraData(noti_info->svc_h, "type", "new_msg");
-                               addServiceExtraData(noti_info->svc_h, "msgId", noti_info->msg_id);
+               noti_info->active_noti_button_num = 1;
+               break;
+       }
+       case MSG_NOTI_TYPE_SIM: {
+               if (noti_info->count > 1) {
+                       noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_MULTIPLE;
+               } else {
+                       noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_SINGLE;
+               }
 
-                               if (bTicker)
-                                       noti_info->applist = NOTIFICATION_DISPLAY_APP_ALL^NOTIFICATION_DISPLAY_APP_LOCK;
-                               else
-                                       noti_info->applist = NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY|NOTIFICATION_DISPLAY_APP_INDICATOR;
-                       }
-                       break;
+               setServiceAppId(noti_info->svc_h, MSG_DEFAULT_APP_ID);
+               addServiceExtraData(noti_info->svc_h, "type", "new_msg");
+               addServiceExtraData(noti_info->svc_h, "msgId", noti_info->msg_id);
 
-               case MSG_NOTI_TYPE_FAILED :
-                       {
-                               noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_SINGLE;
+               if (active_noti == MSG_ACTIVE_NOTI_TYPE_INSTANT)
+                       noti_info->applist = NOTIFICATION_DISPLAY_APP_ALL^NOTIFICATION_DISPLAY_APP_LOCK;
+               else
+                       noti_info->applist = NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY|NOTIFICATION_DISPLAY_APP_INDICATOR;
 
-                               setServiceAppId(noti_info->svc_h, MSG_DEFAULT_APP_ID);
-                               addServiceExtraData(noti_info->svc_h, "type", "send_failed_msg");
-                               addServiceExtraData(noti_info->svc_h, "msgId", noti_info->msg_id);
+               if (noti_info->active_noti_button_num == 0)
+                       noti_info->active_noti_button_num = 3;
+               break;
+       }
+       case MSG_NOTI_TYPE_FAILED: {
+               noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_SINGLE;
 
-                               noti_info->applist = NOTIFICATION_DISPLAY_APP_ALL^NOTIFICATION_DISPLAY_APP_TICKER^NOTIFICATION_DISPLAY_APP_LOCK;
-                       }
-                       break;
+               setServiceAppId(noti_info->svc_h, MSG_DEFAULT_APP_ID);
+               addServiceExtraData(noti_info->svc_h, "type", "send_failed_msg");
+               addServiceExtraData(noti_info->svc_h, "msgId", noti_info->msg_id);
 
-               case MSG_NOTI_TYPE_SIM_FULL :
-                       {
-                               noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_SINGLE;
+               noti_info->applist = NOTIFICATION_DISPLAY_APP_ALL^NOTIFICATION_DISPLAY_APP_TICKER^NOTIFICATION_DISPLAY_APP_LOCK;
+               break;
+       }
+       case MSG_NOTI_TYPE_SIM_FULL: {
+               noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_SINGLE;
 
-                               setServiceAppId(noti_info->svc_h, MSG_DEFAULT_APP_ID);
-                               addServiceExtraData(noti_info->svc_h, "sim_list_show", "sim_setting");
+               setServiceAppId(noti_info->svc_h, MSG_DEFAULT_APP_ID);
+               addServiceExtraData(noti_info->svc_h, "sim_list_show", "sim_setting");
 
-                               noti_info->applist = NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY|NOTIFICATION_DISPLAY_APP_INDICATOR;
-                       }
+               noti_info->applist = NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY|NOTIFICATION_DISPLAY_APP_INDICATOR;
+               break;
+       }
+       default:
                break;
-
-               default :
-                       break;
        }
 
+       if (active_noti != MSG_ACTIVE_NOTI_TYPE_ACTIVE)
+               noti_info->active_noti_button_num = 0;
+
        MSG_END();
 }
 
@@ -1063,200 +1163,228 @@ void createInfoData(MSG_NOTI_INFO_S *noti_info, MSG_MESSAGE_INFO_S *msg_info)
        createServiceHandle(&noti_info->svc_h);
        char keyName[MAX_VCONFKEY_NAME_LEN];
 
-       switch (noti_info->type)
-       {
-               case MSG_NOTI_TYPE_VOICE_1 :
-               case MSG_NOTI_TYPE_VOICE_2 :
-                       {
-                               memset(keyName, 0x00, sizeof(keyName));
-                               snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_COUNT, msg_info->sim_idx);
-                               noti_info->count = MsgSettingGetInt(keyName);
-                               noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_SINGLE;
-                               noti_info->time = msg_info->displayTime;
-
-                               memset(keyName, 0x00, sizeof(keyName));
-                               snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_NUMBER, msg_info->sim_idx);
-                               char *voiceNumber = MsgSettingGetString(keyName);
-                               memset(keyName, 0x00, sizeof(keyName));
-                               snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_ALPHA_ID, msg_info->sim_idx);
-                               char *voiceAlphaId = MsgSettingGetString(keyName);
-                               char *dialNumber = NULL;
-
-                               MSG_SEC_DEBUG("Voice mail server - alpha id = [%s], default num = [%s]", voiceAlphaId, voiceNumber);
-
-                               if (voiceNumber && strlen(voiceNumber))
-                                       dialNumber = voiceNumber;
-
-                               if (voiceAlphaId && strlen(voiceAlphaId) > 0) {
-                                       snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", voiceAlphaId);
-                               } else if(dialNumber && strlen(dialNumber) > 0){
-                                       snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", dialNumber);
-                               }
+       switch (noti_info->type) {
+       case MSG_NOTI_TYPE_VOICE_1:
+       case MSG_NOTI_TYPE_VOICE_2: {
+               memset(keyName, 0x00, sizeof(keyName));
+               snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_COUNT, msg_info->sim_idx);
+               noti_info->count = MsgSettingGetInt(keyName);
+               noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_SINGLE;
+               noti_info->time = msg_info->displayTime;
+
+               memset(keyName, 0x00, sizeof(keyName));
+               snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_NUMBER, msg_info->sim_idx);
+               char *voiceNumber = MsgSettingGetString(keyName);
+               memset(keyName, 0x00, sizeof(keyName));
+               snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_ALPHA_ID, msg_info->sim_idx);
+               char *voiceAlphaId = MsgSettingGetString(keyName);
+               char *dialNumber = NULL;
+
+               MSG_SEC_DEBUG("Voice mail server - alpha id = [%s], default num = [%s]", voiceAlphaId, voiceNumber);
+
+               if (voiceNumber && strlen(voiceNumber))
+                       dialNumber = voiceNumber;
+
+               if (voiceAlphaId && strlen(voiceAlphaId) > 0) {
+                       snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", voiceAlphaId);
+               } else if (dialNumber && strlen(dialNumber) > 0) {
+                       snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", dialNumber);
+               }
+
+               if (dialNumber && strlen(dialNumber) > 0)
+                       snprintf(noti_info->number, sizeof(noti_info->number), "%s", dialNumber);
 
-                               if (dialNumber && strlen(dialNumber) > 0)
-                                       snprintf(noti_info->number, sizeof(noti_info->number), "%s", dialNumber);
+               if (noti_info->svc_h) {
+                       char telnum[256] = {0,};
+                       app_control_set_operation(noti_info->svc_h, APP_CONTROL_OPERATION_CALL);
+                       snprintf(telnum, sizeof(telnum), "tel:%s", noti_info->number);
+                       app_control_set_uri(noti_info->svc_h, telnum);
+               }
 
-                               setServiceAppId(noti_info->svc_h, "org.tizen.call");
+               MSG_FREE(voiceNumber);
+               MSG_FREE(voiceAlphaId);
+               break;
+       }
+       case MSG_NOTI_TYPE_MWI:
+       case MSG_NOTI_TYPE_CLASS0: {
+               noti_info->count = 1;
+               noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_SINGLE;
+               noti_info->time = msg_info->displayTime;
 
-                               addServiceExtraData(noti_info->svc_h, "launch-type", "MO");
+               if (msg_info->addressList[0].displayName[0] == '\0')
+                       snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", msg_info->addressList[0].addressVal);
+               else
+                       snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", msg_info->addressList[0].displayName);
 
-                               addServiceExtraData(noti_info->svc_h, "number", "VOICEMAIL");
+               snprintf(noti_info->number, sizeof(noti_info->number), "%s", msg_info->addressList[0].addressVal);
 
-                               char slot_id[5] = {0,};
-                               snprintf(slot_id, sizeof(slot_id), "%d", msg_info->sim_idx - 1);
-                               addServiceExtraData(noti_info->svc_h, "slot_id", slot_id);
+               snprintf(noti_info->text, sizeof(noti_info->text), "%s", msg_info->msgText);
 
-                               MSG_FREE(voiceNumber);
-                               MSG_FREE(voiceAlphaId);
+               if (noti_info->type == MSG_NOTI_TYPE_MWI) {
+                       if (noti_info->svc_h) {
+                               char telnum[256] = {0,};
+                               app_control_set_operation(noti_info->svc_h, APP_CONTROL_OPERATION_CALL);
+                               snprintf(telnum, sizeof(telnum), "tel:%s", noti_info->number);
+                               app_control_set_uri(noti_info->svc_h, telnum);
                        }
-                       break;
-
-               case MSG_NOTI_TYPE_MWI :
-               case MSG_NOTI_TYPE_CLASS0 :
-                       {
-                               noti_info->count = 1;
-                               noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_SINGLE;
-                               noti_info->time = msg_info->displayTime;
 
-                               if (msg_info->addressList[0].displayName[0] == '\0')
-                                       snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", msg_info->addressList[0].addressVal);
-                               else
-                                       snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", msg_info->addressList[0].displayName);
+               } else {
+                       setServiceAppId(noti_info->svc_h, "org.tizen.msg-ui-class0");
+                       addServiceExtraData(noti_info->svc_h, "type", "new_msg");
+                       addServiceExtraData(noti_info->svc_h, "msgId", noti_info->msg_id);
+               }
+               break;
+       }
+       case MSG_NOTI_TYPE_SMS_DELIVERY_REPORT: {
+               noti_info->count = 1;
+               noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_SINGLE;
+               noti_info->time = msg_info->displayTime;
+               noti_info->extra_data = msg_info->networkStatus;
 
-                               snprintf(noti_info->number, sizeof(noti_info->number), "%s", msg_info->addressList[0].addressVal);
+               MSG_CONTACT_INFO_S contactInfo;
+               memset(&contactInfo, 0x00, sizeof(MSG_CONTACT_INFO_S));
 
-                               snprintf(noti_info->text, sizeof(noti_info->text), "%s", msg_info->msgText);
+               if (MsgGetContactInfo(&(msg_info->addressList[0]), &contactInfo) != MSG_SUCCESS) {
+                       MSG_DEBUG("MsgGetContactInfo() fail.");
+               }
 
-                               if (noti_info->type == MSG_NOTI_TYPE_MWI) {
-                                       setServiceAppId(noti_info->svc_h, "org.tizen.call");
-                                       addServiceExtraData(noti_info->svc_h, "launch-type", "MO");
-                                       addServiceExtraData(noti_info->svc_h, "number", "VOICEMAIL");
+               snprintf(msg_info->addressList[0].displayName, sizeof(msg_info->addressList[0].displayName), "%s", contactInfo.firstName);
 
-                                       char slot_id[5] = {0,};
-                                       snprintf(slot_id, sizeof(slot_id), "%d", msg_info->sim_idx - 1);
-                                       addServiceExtraData(noti_info->svc_h, "slot_id", slot_id);
+               if (msg_info->addressList[0].displayName[0] == '\0')
+                       snprintf(noti_info->sender, sizeof(noti_info->sender), "%s",msg_info->addressList[0].addressVal);
+               else
+                       snprintf(noti_info->sender, sizeof(noti_info->sender), "%s",msg_info->addressList[0].displayName);
 
-                               } else {
-                                       setServiceAppId(noti_info->svc_h, "org.tizen.msg-ui-class0");
-                                       addServiceExtraData(noti_info->svc_h, "type", "new_msg");
-                                       addServiceExtraData(noti_info->svc_h, "msgId", noti_info->msg_id);
-                               }
-                       }
-                       break;
+               snprintf(noti_info->number, sizeof(noti_info->number), "%s", msg_info->addressList[0].addressVal);
 
-               case MSG_NOTI_TYPE_SMS_DELIVERY_REPORT :
-                       {
-                               noti_info->count = 1;
-                               noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_SINGLE;
-                               noti_info->time = msg_info->displayTime;
-                               noti_info->extra_data = msg_info->networkStatus;
+               if (noti_info->msg_id > 0) {
+                       setServiceAppId(noti_info->svc_h, MSG_DEFAULT_APP_ID);
+                       addServiceExtraData(noti_info->svc_h, "type", "new_msg");
+                       addServiceExtraData(noti_info->svc_h, "msgId", noti_info->msg_id);
+                       addServiceExtraData(noti_info->svc_h, "address", msg_info->addressList[0].addressVal);
+               }
+               break;
+       }
+       case MSG_NOTI_TYPE_MMS_READ_REPORT:
+       case MSG_NOTI_TYPE_MMS_DELIVERY_REPORT: {
+               noti_info->count = 1;
+               noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_SINGLE;
+               noti_info->time = msg_info->displayTime;
 
-                               MSG_CONTACT_INFO_S contactInfo;
-                               memset(&contactInfo, 0x00, sizeof(MSG_CONTACT_INFO_S));
+               MSG_CONTACT_INFO_S contactInfo;
+               memset(&contactInfo, 0x00, sizeof(MSG_CONTACT_INFO_S));
 
-                               if (MsgGetContactInfo(&(msg_info->addressList[0]), &contactInfo) != MSG_SUCCESS) {
-                                       MSG_DEBUG("MsgGetContactInfo() fail.");
-                               }
+               if (MsgGetContactInfo(&(msg_info->addressList[0]), &contactInfo) != MSG_SUCCESS) {
+                       MSG_DEBUG("MsgGetContactInfo() fail.");
+               }
 
-                               snprintf(msg_info->addressList[0].displayName, sizeof(msg_info->addressList[0].displayName), "%s", contactInfo.firstName);
+               snprintf(msg_info->addressList[0].displayName, sizeof(msg_info->addressList[0].displayName), "%s", contactInfo.firstName);
 
-                               if (msg_info->addressList[0].displayName[0] == '\0')
-                                       snprintf(noti_info->sender, sizeof(noti_info->sender), "%s",msg_info->addressList[0].addressVal);
-                               else
-                                       snprintf(noti_info->sender, sizeof(noti_info->sender), "%s",msg_info->addressList[0].displayName);
+               if (msg_info->addressList[0].displayName[0] == '\0')
+                       snprintf(noti_info->sender, sizeof(noti_info->sender), "%s",msg_info->addressList[0].addressVal);
+               else
+                       snprintf(noti_info->sender, sizeof(noti_info->sender), "%s",msg_info->addressList[0].displayName);
 
-                               snprintf(noti_info->number, sizeof(noti_info->number), "%s", msg_info->addressList[0].addressVal);
+               snprintf(noti_info->number, sizeof(noti_info->number), "%s",msg_info->addressList[0].addressVal);
 
-                               if (noti_info->msg_id > 0) {
-                                       setServiceAppId(noti_info->svc_h, MSG_DEFAULT_APP_ID);
-                                       addServiceExtraData(noti_info->svc_h, "type", "new_msg");
-                                       addServiceExtraData(noti_info->svc_h, "msgId", noti_info->msg_id);
-                                       addServiceExtraData(noti_info->svc_h, "address", msg_info->addressList[0].addressVal);
-                               }
-                       }
-                       break;
-               case MSG_NOTI_TYPE_MMS_READ_REPORT :
-               case MSG_NOTI_TYPE_MMS_DELIVERY_REPORT :
-                       {
-                               noti_info->count = 1;
-                               noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_SINGLE;
-                               noti_info->time = msg_info->displayTime;
-
-                               MSG_CONTACT_INFO_S contactInfo;
-                               memset(&contactInfo, 0x00, sizeof(MSG_CONTACT_INFO_S));
-
-                               if (MsgGetContactInfo(&(msg_info->addressList[0]), &contactInfo) != MSG_SUCCESS) {
-                                       MSG_DEBUG("MsgGetContactInfo() fail.");
-                               }
+               MsgDbHandler *dbhandler = getDbHandle();
+               char sqlQuery[MAX_QUERY_LEN+1];
+               memset(sqlQuery, 0x00, sizeof(sqlQuery));
 
-                               snprintf(msg_info->addressList[0].displayName, sizeof(msg_info->addressList[0].displayName), "%s", contactInfo.firstName);
+               int report_status_type;
+               int report_status_value;
 
-                               if (msg_info->addressList[0].displayName[0] == '\0')
-                                       snprintf(noti_info->sender, sizeof(noti_info->sender), "%s",msg_info->addressList[0].addressVal);
-                               else
-                                       snprintf(noti_info->sender, sizeof(noti_info->sender), "%s",msg_info->addressList[0].displayName);
+               if (noti_info->type == MSG_NOTI_TYPE_MMS_READ_REPORT) {
+                       report_status_type = MSG_REPORT_TYPE_READ;
+               } else {
+                       report_status_type = MSG_REPORT_TYPE_DELIVERY;
+               }
 
-                               snprintf(noti_info->number, sizeof(noti_info->number), "%s",msg_info->addressList[0].addressVal);
+               char *normalNum = NULL;
+               if (msg_info->addressList[0].addressVal[0] != '\0') {
+                       normalNum = msg_normalize_number(msg_info->addressList[0].addressVal);
+               }
 
-                               MsgDbHandler *dbhandler = getDbHandle();
-                               char sqlQuery[MAX_QUERY_LEN+1];
-                               memset(sqlQuery, 0x00, sizeof(sqlQuery));
+               snprintf(sqlQuery, sizeof(sqlQuery), "SELECT "
+                               "STATUS "
+                               "FROM %s "
+                               "WHERE MSG_ID=%d AND STATUS_TYPE=%d AND ADDRESS_VAL LIKE '%%%s';",
+                               MSGFW_REPORT_TABLE_NAME, msg_info->msgId, report_status_type, normalNum);
 
-                               int report_status_type;
-                               int report_status_value;
+               MSG_DEBUG("sqlQuery = [%s]", sqlQuery);
 
-                               if (noti_info->type == MSG_NOTI_TYPE_MMS_READ_REPORT) {
-                                       report_status_type = MSG_REPORT_TYPE_READ;
-                               } else {
-                                       report_status_type = MSG_REPORT_TYPE_DELIVERY;
-                               }
+               if (dbhandler->prepareQuery(sqlQuery) != MSG_SUCCESS) {
+                       MSG_DEBUG("prepareQuery is failed");
+                       return;
+               }
 
-                               char *normalNum = NULL;
-                               if (msg_info->addressList[0].addressVal[0] != '\0') {
-                                       normalNum = msg_normalize_number(msg_info->addressList[0].addressVal);
-                               }
+               if (dbhandler->stepQuery() == MSG_ERR_DB_ROW) {
+                       report_status_value = dbhandler->columnInt(0);
+                       MSG_DEBUG("report status [type = %d, value = %d]", report_status_type, report_status_value);
+               } else {
+                       MSG_DEBUG("DB Query Result Fail");
+                       dbhandler->finalizeQuery();
+                       return;
+               }
 
-                               snprintf(sqlQuery, sizeof(sqlQuery), "SELECT "
-                                               "STATUS "
-                                               "FROM %s "
-                                               "WHERE MSG_ID=%d AND STATUS_TYPE=%d AND ADDRESS_VAL LIKE '%%%s';",
-                                               MSGFW_REPORT_TABLE_NAME, msg_info->msgId, report_status_type, normalNum);
+               dbhandler->finalizeQuery();
 
-                               MSG_DEBUG("sqlQuery = [%s]", sqlQuery);
+               if (noti_info->msg_id > 0) {
+                       setServiceAppId(noti_info->svc_h, MSG_DEFAULT_APP_ID);
+                       addServiceExtraData(noti_info->svc_h, "type", "new_msg");
+                       addServiceExtraData(noti_info->svc_h, "msgId", noti_info->msg_id);
+                       addServiceExtraData(noti_info->svc_h, "address", msg_info->addressList[0].addressVal);
+               }
 
-                               if (dbhandler->prepareQuery(sqlQuery) != MSG_SUCCESS) {
-                                       MSG_DEBUG("prepareQuery is failed");
-                                       return;
-                               }
+               noti_info->extra_data = (unsigned char)report_status_value;
+               break;
+       }
+       default:
+               MSG_DEBUG("No matching type [%d]", noti_info->type);
+               break;
+       }
 
-                               if (dbhandler->stepQuery() == MSG_ERR_DB_ROW) {
-                                       report_status_value = dbhandler->columnInt(0);
-                                       MSG_DEBUG("report status [type = %d, value = %d]", report_status_type, report_status_value);
-                               } else {
-                                       MSG_DEBUG("DB Query Result Fail");
-                                       dbhandler->finalizeQuery();
-                                       return;
-                               }
+       noti_info->applist = NOTIFICATION_DISPLAY_APP_ALL^NOTIFICATION_DISPLAY_APP_LOCK;
 
-                               dbhandler->finalizeQuery();
+       MSG_END();
+}
 
-                               if (noti_info->msg_id > 0) {
-                                       setServiceAppId(noti_info->svc_h, MSG_DEFAULT_APP_ID);
-                                       addServiceExtraData(noti_info->svc_h, "type", "new_msg");
-                                       addServiceExtraData(noti_info->svc_h, "msgId", noti_info->msg_id);
-                                       addServiceExtraData(noti_info->svc_h, "address", msg_info->addressList[0].addressVal);
-                               }
 
-                               noti_info->extra_data = (unsigned char)report_status_value;
-                       }
-                       break;
+void createActiveInfoData(MSG_NOTI_INFO_S *noti_info, MSG_MESSAGE_INFO_S *msg_info)
+{
+       MSG_BEGIN();
 
-               default:
-                       MSG_DEBUG("No matching type [%d]", noti_info->type);
-                       break;
+       if (!msg_info) {
+               MSG_DEBUG("msg_info is NULL");
+               return;
        }
 
-       noti_info->applist = NOTIFICATION_DISPLAY_APP_ALL^NOTIFICATION_DISPLAY_APP_LOCK;
+       noti_info->msg_id = msg_info->msgId;
+       noti_info->sim_idx = msg_info->sim_idx;
+
+       switch (noti_info->type) {
+       case MSG_NOTI_TYPE_NORMAL: {
+               char *senderStr = getTranslateText(MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR, PUSH_MESSAGE);
+               snprintf(noti_info->active_sender, MSG_NOTI_TEXT_LEN_S, "%s", senderStr);
+               if (senderStr) {
+                       free(senderStr);
+                       senderStr = NULL;
+               }
+               break;
+       }
+       case MSG_NOTI_TYPE_CLASS0: {
+               if (msg_info->addressList[0].displayName[0] == '\0')
+                       snprintf(noti_info->active_sender, MSG_NOTI_TEXT_LEN_S, "%s", msg_info->addressList[0].addressVal);
+               else
+                       snprintf(noti_info->active_sender, MSG_NOTI_TEXT_LEN_S, "%s", msg_info->addressList[0].displayName);
+
+               snprintf(noti_info->active_text, MSG_NOTI_TEXT_LEN, "%s", msg_info->msgText);
+               break;
+       }
+       default:
+               MSG_DEBUG("No matching type [%d]", noti_info->type);
+               break;
+       }
 
        MSG_END();
 }
@@ -1266,6 +1394,8 @@ void clearInfoData(notification_h noti_h, MSG_NOTI_INFO_S *noti_info)
 {
        MSG_BEGIN();
 
+       MsgZoneChange();
+
        if (noti_h) {
                notification_free(noti_h);
                noti_h = NULL;
@@ -1276,6 +1406,15 @@ void clearInfoData(notification_h noti_h, MSG_NOTI_INFO_S *noti_info)
                noti_info->svc_h = NULL;
        }
 
+       for (int i = 0; i < MSG_ACTIVE_NOTI_BUTTON_NUM; i++) {
+               if (noti_info->active_noti_svc_h[i]) {
+                       app_control_destroy(noti_info->active_noti_svc_h[i]);
+                       noti_info->active_noti_svc_h[i] = NULL;
+               }
+       }
+
+       MsgZoneRevert();
+
        MSG_END();
 }
 
@@ -1284,21 +1423,23 @@ void setProperty(notification_h noti_h, MSG_NOTI_INFO_S *noti_info)
 {
        MSG_BEGIN();
 
+       MsgZoneChange();
+
        int noti_err = NOTIFICATION_ERROR_NONE;
 
-       // set layout
+       /* set layout */
        noti_err = notification_set_layout(noti_h, (notification_ly_type_e)noti_info->layout);
        if (noti_err != NOTIFICATION_ERROR_NONE) {
                MSG_DEBUG("Fail to notification_set_layout : %d", noti_err);
        }
 
-       // set led
+       /* set led */
        noti_err = notification_set_led(noti_h, NOTIFICATION_LED_OP_ON, 0x00);
        if (noti_err != NOTIFICATION_ERROR_NONE) {
                MSG_DEBUG("Fail to notification_set_led.");
        }
 
-       // set execute option
+       /* set execute option */
        bundle *bundle_data = NULL;
        bundle *reply_msg = NULL;
 
@@ -1308,77 +1449,68 @@ void setProperty(notification_h noti_h, MSG_NOTI_INFO_S *noti_info)
                MSG_DEBUG("bundle is NULL");
        }
 
-       // set execute option and property
-       switch (noti_info->type)
-       {
-               case MSG_NOTI_TYPE_NORMAL :
-                       {
-                               if (noti_info->count > 1) {
-                                       notification_set_execute_option(noti_h, NOTIFICATION_EXECUTE_TYPE_MULTI_LAUNCH, NULL, NULL, bundle_data);
-                                       notification_set_execute_option(noti_h, NOTIFICATION_EXECUTE_TYPE_RESPONDING, NULL, NULL, NULL);
-                               } else {
-                                       if (noti_info->svc_h){ // overwrite bundle key "type"
-                                               //addServiceExtraData(noti_info->svc_h, "type", "reply");
-                                               addServiceExtraData(noti_info->svc_h, "show_list", "list_show");
-
-                                               app_control_to_bundle(noti_info->svc_h, &reply_msg);
-                                       }
-                                       notification_set_execute_option(noti_h, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, bundle_data);
-                                       notification_set_execute_option(noti_h, NOTIFICATION_EXECUTE_TYPE_RESPONDING, NULL, NULL, reply_msg);
-                               }
-
-                               notification_set_property(noti_h, NOTIFICATION_PROP_DISABLE_AUTO_DELETE);
-                       }
-                       break;
-
-               case MSG_NOTI_TYPE_CB :
-               case MSG_NOTI_TYPE_SIM :
-                       {
-                               if (noti_info->count > 1) {
-                                       notification_set_execute_option(noti_h, NOTIFICATION_EXECUTE_TYPE_MULTI_LAUNCH, NULL, NULL, bundle_data);
-                               } else {
-                                       notification_set_execute_option(noti_h, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, bundle_data);
-                               }
-
-                               notification_set_property(noti_h, NOTIFICATION_PROP_DISABLE_AUTO_DELETE|NOTIFICATION_PROP_VOLATILE_DISPLAY);
-                       }
-                       break;
+       /* set execute option and property */
+       switch (noti_info->type) {
+       case MSG_NOTI_TYPE_NORMAL: {
+               if (noti_info->count > 1) {
+                       notification_set_execute_option(noti_h, NOTIFICATION_EXECUTE_TYPE_MULTI_LAUNCH, NULL, NULL, bundle_data);
+                       notification_set_execute_option(noti_h, NOTIFICATION_EXECUTE_TYPE_RESPONDING, NULL, NULL, NULL);
+               } else {
+                       if (noti_info->svc_h) { /* overwrite bundle key "type" */
+                               /* addServiceExtraData(noti_info->svc_h, "type", "reply"); */
+                               addServiceExtraData(noti_info->svc_h, "show_list", "list_show");
 
-               case MSG_NOTI_TYPE_FAILED :
-                       {
-                               notification_set_execute_option(noti_h, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, bundle_data);
-                               notification_set_property(noti_h, NOTIFICATION_PROP_DISABLE_AUTO_DELETE);
+                               app_control_to_bundle(noti_info->svc_h, &reply_msg);
                        }
-                       break;
+                       notification_set_execute_option(noti_h, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, bundle_data);
+                       notification_set_execute_option(noti_h, NOTIFICATION_EXECUTE_TYPE_RESPONDING, NULL, NULL, reply_msg);
+               }
 
-               case MSG_NOTI_TYPE_SIM_FULL :
-                       {
-                               notification_set_execute_option(noti_h, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, bundle_data);
-                       }
-                       break;
+               notification_set_property(noti_h, NOTIFICATION_PROP_DISABLE_AUTO_DELETE);
+               break;
+       }
+       case MSG_NOTI_TYPE_CB:
+       case MSG_NOTI_TYPE_SIM: {
+               if (noti_info->count > 1) {
+                       notification_set_execute_option(noti_h, NOTIFICATION_EXECUTE_TYPE_MULTI_LAUNCH, NULL, NULL, bundle_data);
+               } else {
+                       notification_set_execute_option(noti_h, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, bundle_data);
+               }
 
-               case MSG_NOTI_TYPE_VOICE_1 :
-               case MSG_NOTI_TYPE_VOICE_2 :
-               case MSG_NOTI_TYPE_MWI :
-               case MSG_NOTI_TYPE_CLASS0 :
-               case MSG_NOTI_TYPE_SMS_DELIVERY_REPORT :
-               case MSG_NOTI_TYPE_MMS_READ_REPORT :
-               case MSG_NOTI_TYPE_MMS_DELIVERY_REPORT :
-                       {
-                               notification_set_execute_option(noti_h, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, bundle_data);
-                       }
-                       break;
-               default:
-                       MSG_DEBUG("No matching type for notification_set_execute_option() [%d]", noti_info->type);
-                       break;
+               notification_set_property(noti_h, NOTIFICATION_PROP_DISABLE_AUTO_DELETE|NOTIFICATION_PROP_VOLATILE_DISPLAY);
+               break;
+       }
+       case MSG_NOTI_TYPE_FAILED: {
+               notification_set_execute_option(noti_h, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, bundle_data);
+               notification_set_property(noti_h, NOTIFICATION_PROP_DISABLE_AUTO_DELETE);
+               break;
+       }
+       case MSG_NOTI_TYPE_SIM_FULL: {
+               notification_set_execute_option(noti_h, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, bundle_data);
+               break;
+       }
+       case MSG_NOTI_TYPE_VOICE_1:
+       case MSG_NOTI_TYPE_VOICE_2:
+       case MSG_NOTI_TYPE_MWI:
+       case MSG_NOTI_TYPE_CLASS0:
+       case MSG_NOTI_TYPE_SMS_DELIVERY_REPORT:
+       case MSG_NOTI_TYPE_MMS_READ_REPORT:
+       case MSG_NOTI_TYPE_MMS_DELIVERY_REPORT: {
+               notification_set_execute_option(noti_h, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, bundle_data);
+               break;
+       }
+       default:
+               MSG_DEBUG("No matching type for notification_set_execute_option() [%d]", noti_info->type);
+               break;
        }
 
-       // set applist
+       /* set applist */
        noti_err = notification_set_display_applist(noti_h, noti_info->applist);
        if (noti_err != NOTIFICATION_ERROR_NONE) {
                MSG_DEBUG("Fail to notification_set_display_applist");
        }
 
+       MsgZoneRevert();
 
        MSG_END();
 }
@@ -1389,6 +1521,7 @@ void setTextDomain(notification_h noti_h, msg_notification_type_t noti_type)
        MSG_BEGIN();
 
        setNotiTextDomain(noti_h, MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR);
+
        MSG_END();
 }
 
@@ -1404,234 +1537,360 @@ void setText(notification_h noti_h, MSG_NOTI_INFO_S *noti_info)
                MSG_DEBUG("MsgSettingGetBool is failed.");
        }
 
-       // set title and content
-       switch (noti_info->type)
-       {
+       /* set title and content */
+       switch (noti_info->type) {
 #ifdef MSG_NOTI_INTEGRATION
-               case MSG_NOTI_TYPE_NORMAL :
-               case MSG_NOTI_TYPE_CB :
-               case MSG_NOTI_TYPE_SIM :
-                       {
-                               if (noti_info->count > 1) {
-                                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "New Messages", NEW_MESSAGES);
-                                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL);
-                                       setNotiTime(noti_h, noti_info->time);
-
-                                       snprintf(unreadMsgCntStr, sizeof(unreadMsgCntStr), "%d", noti_info->count);
-                                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, unreadMsgCntStr, NULL);
+       case MSG_NOTI_TYPE_NORMAL:
+       case MSG_NOTI_TYPE_CB:
+       case MSG_NOTI_TYPE_SIM: {
+               if (noti_info->count > 1) {
+                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "New Messages", NEW_MESSAGE);
+                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL);
+                       setNotiTime(noti_h, noti_info->time);
 
-                               } else {
-                                       if (bPreview) {
-                                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, noti_info->sender, NULL);
-                                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->text, NULL);
-                                       } else {
-                                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "New Message", NEW_MESSAGE);
-                                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL);
-                                       }
-                                       setNotiTime(noti_h, noti_info->time);
-                               }
+                       snprintf(unreadMsgCntStr, sizeof(unreadMsgCntStr), "%d", noti_info->count);
+                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, unreadMsgCntStr, NULL);
+
+               } else {
+                       if (bPreview) {
+                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, noti_info->sender, NULL);
+                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->text, NULL);
+                       } else {
+                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "New Message", NEW_MESSAGE);
+                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL);
                        }
-                       break;
+                       setNotiTime(noti_h, noti_info->time);
+               }
+               break;
+       }
 #else
-               case MSG_NOTI_TYPE_NORMAL :
-                       {
-                               if (noti_info->count > 1) {
-                                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "New Messages", NEW_MESSAGES);
-                                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL);
-                                       setNotiTime(noti_h, noti_info->time);
+       case MSG_NOTI_TYPE_NORMAL: {
+               if (noti_info->count > 1) {
+                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "New Messages", NEW_MESSAGE);
+                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL);
+                       setNotiTime(noti_h, noti_info->time);
+
+                       snprintf(unreadMsgCntStr, sizeof(unreadMsgCntStr), "%d", noti_info->count);
+                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, unreadMsgCntStr, NULL);
+               } else {
+                       if (bPreview) {
+                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, noti_info->sender, NULL);
+                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->text, NULL);
+                       } else {
+                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "New Message", NEW_MESSAGE);
+                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL);
+                       }
+                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, "1", NULL);
+                       setNotiTime(noti_h, noti_info->time);
+               }
+               break;
+       }
+       case MSG_NOTI_TYPE_CB: {
+               if (noti_info->count > 1) {
+                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "Broadcast message", CB_MESSAGE);
+                       snprintf(unreadMsgCntStr, sizeof(unreadMsgCntStr), "%d", noti_info->count);
+                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, unreadMsgCntStr, NULL);
+                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL);
+                       setNotiTime(noti_h, noti_info->time);
 
-                                       snprintf(unreadMsgCntStr, sizeof(unreadMsgCntStr), "%d", noti_info->count);
-                                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, unreadMsgCntStr, NULL);
+               } else {
+                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, "1", NULL);
+                       setNotiTime(noti_h, noti_info->time);
 
-                               } else {
-                                       if (bPreview) {
-                                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, noti_info->sender, NULL);
-                                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->text, NULL);
-                                       } else {
-                                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "New Message", NEW_MESSAGE);
-                                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL);
-                                       }
-                                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, "1", NULL);
-                                       setNotiTime(noti_h, noti_info->time);
-                               }
+                       if (bPreview) {
+                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, noti_info->sender, NULL);
+                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->text, NULL);
+                       } else {
+                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "Broadcast message", CB_MESSAGE);
+                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL);
                        }
-                       break;
-
-               case MSG_NOTI_TYPE_CB :
-                       {
-                               if (noti_info->count > 1) {
-                                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "Broadcast message", CB_MESSAGE);
-                                       snprintf(unreadMsgCntStr, sizeof(unreadMsgCntStr), "%d", noti_info->count);
-                                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, unreadMsgCntStr, NULL);
-                                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL);
-                                       setNotiTime(noti_h, noti_info->time);
+               }
+               break;
+       }
+       case MSG_NOTI_TYPE_SIM: {
+               if (noti_info->count > 1) {
+                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "SIM card Message", SIM_CARD_MESSAGE);
+                       snprintf(unreadMsgCntStr, sizeof(unreadMsgCntStr), "%d", noti_info->count);
+                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, unreadMsgCntStr, NULL);
 
-                               } else {
-                                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, "1", NULL);
-                                       setNotiTime(noti_h, noti_info->time);
+                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL);
+                       setNotiTime(noti_h, noti_info->time);
+               } else {
+                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, "1", NULL);
+                       setNotiTime(noti_h, noti_info->time);
 
-                                       if (bPreview) {
-                                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, noti_info->sender, NULL);
-                                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->text, NULL);
-                                       } else {
-                                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "Broadcast message", CB_MESSAGE);
-                                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL);
-                                       }
-                               }
+                       if (bPreview) {
+                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, noti_info->sender, NULL);
+                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->text, NULL);
+                       } else {
+                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "SIM card Message", SIM_CARD_MESSAGE);
+                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL);
                        }
-                       break;
+               }
+               break;
+       }
+#endif
+       case MSG_NOTI_TYPE_FAILED: {
+               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "Message", MSG_MESSAGE);
+               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, "Failed to send message.", FAILED_TO_SEND_MESSAGE);
+               snprintf(unreadMsgCntStr, sizeof(unreadMsgCntStr), "%d", noti_info->count);
+               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, unreadMsgCntStr, NULL);
+               setNotiTime(noti_h, noti_info->time);
+               break;
+       }
+       case MSG_NOTI_TYPE_VOICE_1:
+       case MSG_NOTI_TYPE_VOICE_2: {
+               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "Voicemail", VOICE_MAIL);
+               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL);
+               setNotiTime(noti_h, noti_info->time);
+
+               if (noti_info->count == 1) {
+                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, "1", NULL);
+               } else if (noti_info->count > 1) {
+                       snprintf(unreadMsgCntStr, sizeof(unreadMsgCntStr), "%d", noti_info->count);
+                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, unreadMsgCntStr, NULL);
+               } else {
+                       MSG_DEBUG("Invalid notification count, [cnt = %d]", noti_info->count);
+               }
+               break;
+       }
+       case MSG_NOTI_TYPE_MWI: {
+               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "MWI Message", NULL);
+               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL);
+               setNotiTime(noti_h, noti_info->time);
+               break;
+       }
+       case MSG_NOTI_TYPE_CLASS0: {
+               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "CLASS 0 Message", NULL);
+               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL);
+               setNotiTime(noti_h, noti_info->time);
+               break;
+       }
+       case MSG_NOTI_TYPE_SMS_DELIVERY_REPORT: {
+               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "Delivery report", DELIVERY_MESSAGE);
+               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL);
 
-               case MSG_NOTI_TYPE_SIM :
-                       {
-                               if (noti_info->count > 1) {
-                                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "SIM card Message", SIM_CARD_MESSAGE);
-                                       snprintf(unreadMsgCntStr, sizeof(unreadMsgCntStr), "%d", noti_info->count);
-                                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, unreadMsgCntStr, NULL);
+               if (noti_info->extra_data == MSG_NETWORK_DELIVER_SUCCESS) {
+                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message delivered", DELIVERED_MESSAGE);
+               } else if (noti_info->extra_data == MSG_NETWORK_DELIVER_EXPIRED) {
+                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message expired", EXPIRED_MESSAGE);
+               } else {
+                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message deferred", DEFERRED_MESSAGE);
+               }
 
-                                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL);
-                                       setNotiTime(noti_h, noti_info->time);
-                               } else {
-                                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, "1", NULL);
-                                       setNotiTime(noti_h, noti_info->time);
+               setNotiTime(noti_h, noti_info->time);
+               break;
+       }
+       case MSG_NOTI_TYPE_MMS_READ_REPORT: {
+               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "Read Report", READ_REPORT_MESSAGE);
+               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL);
 
-                                       if (bPreview) {
-                                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, noti_info->sender, NULL);
-                                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->text, NULL);
-                                       } else {
-                                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "SIM card Message", SIM_CARD_MESSAGE);
-                                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL);
-                                       }
-                               }
-                       }
-                       break;
+               if (noti_info->extra_data == MSG_READ_REPORT_IS_DELETED) {
+                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message deleted", READ_REPORT_DELETE);
+               /* CID 45672: noti_info->extra_data in unsigned char but MSG_READ_REPORT_NONE is -1. So the expression is always false */
+#if 0
+               } else if (noti_info->extra_data == MSG_READ_REPORT_NONE) {
+                       /* notification free */
 #endif
-               case MSG_NOTI_TYPE_FAILED :
-                       {
-                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "Message", MSG_MESSAGE);
-                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, "Failed to send message.", FAILED_TO_SEND_MESSAGE);
-                               snprintf(unreadMsgCntStr, sizeof(unreadMsgCntStr), "%d", noti_info->count);
-                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, unreadMsgCntStr, NULL);
-                               setNotiTime(noti_h, noti_info->time);
-                       }
-                       break;
+               } else {
+                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message read", READ_REPORT_READ);
+               }
 
-               case MSG_NOTI_TYPE_VOICE_1 :
-               case MSG_NOTI_TYPE_VOICE_2 :
-                       {
-                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "Voicemail", VOICE_MAIL);
-                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL);
-                               setNotiTime(noti_h, noti_info->time);
+               setNotiTime(noti_h, noti_info->time);
+               break;
+       }
+       case MSG_NOTI_TYPE_MMS_DELIVERY_REPORT: {
+               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "Delivery Report", DELIVERY_MESSAGE);
+               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL);
+
+               if (noti_info->extra_data == MSG_DELIVERY_REPORT_EXPIRED)
+                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message expired", EXPIRED_MESSAGE);
+               else if (noti_info->extra_data == MSG_DELIVERY_REPORT_REJECTED)
+                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message rejected", REJECTED_MESSAGE);
+               else if (noti_info->extra_data == MSG_DELIVERY_REPORT_DEFERRED)
+                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message deferred", DEFERRED_MESSAGE);
+               else if (noti_info->extra_data == MSG_DELIVERY_REPORT_UNRECOGNISED)
+                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message unrecognised", UNRECOGNISED_MESSAGE);
+               else if (noti_info->extra_data == MSG_DELIVERY_REPORT_INDETERMINATE)
+                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message indeterminate", INDETEMINATE_MESSAGE);
+               else if (noti_info->extra_data == MSG_DELIVERY_REPORT_FORWARDED)
+                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message forwarded", NULL);
+               else if (noti_info->extra_data == MSG_DELIVERY_REPORT_UNREACHABLE)
+                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message unreachable", UNREACHABLE_MESSAGE);
+               else if (noti_info->extra_data == MSG_DELIVERY_REPORT_ERROR)
+                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message error", NULL);
+               /* CID 45672: noti_info->extra_data in unsigned char but MSG_READ_REPORT_NONE is -1. So the expression is always false */
+#if 0
+               else if (noti_info->extra_data == MSG_DELIVERY_REPORT_NONE) {
+                       /* notification free */
+               }
+#endif
+               else
+                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message delivered", DELIVERED_MESSAGE);
 
-                               if (noti_info->count == 1) {
-                                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, "1", NULL);
-                               } else if (noti_info->count > 1) {
-                                       snprintf(unreadMsgCntStr, sizeof(unreadMsgCntStr), "%d", noti_info->count);
-                                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, unreadMsgCntStr, NULL);
-                               } else {
-                                       MSG_DEBUG("Invalid notification count, [cnt = %d]", noti_info->count);
-                               }
-                       }
-                       break;
+               setNotiTime(noti_h, noti_info->time);
+               break;
+       }
+       case MSG_NOTI_TYPE_SIM_FULL: {
+               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "SIM card full", SMS_SIM_CARD_FULL);
+               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, "Not enough memory. Delete some items.", SMS_MESSAGE_MEMORY_FULL);
+               break;
+       }
+       default:
+               MSG_DEBUG("No matching type [%d]", noti_info->type);
+               break;
+       }
 
-               case MSG_NOTI_TYPE_MWI :
-                       {
-                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "MWI Message", NULL);
-                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL);
-                               setNotiTime(noti_h, noti_info->time);
-                       }
-                       break;
+       MSG_END();
 
-               case MSG_NOTI_TYPE_CLASS0 :
-                       {
-                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "CLASS 0 Message", NULL);
-                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL);
-                               setNotiTime(noti_h, noti_info->time);
-                       }
-                       break;
+}
 
-               case MSG_NOTI_TYPE_SMS_DELIVERY_REPORT :
-                       {
-                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "Delivery report", DELIVERY_MESSAGE);
-                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL);
 
-                               if(noti_info->extra_data == MSG_NETWORK_DELIVER_SUCCESS) {
-                                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message delivered", DELIVERED_MESSAGE);
-                               } else if(noti_info->extra_data == MSG_NETWORK_DELIVER_EXPIRED) {
-                                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message expired", EXPIRED_MESSAGE);
-                               } else {
-                                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message deferred", DEFERRED_MESSAGE);
-                               }
+void setIcon(notification_h noti_h, MSG_NOTI_INFO_S *noti_info)
+{
+       MSG_BEGIN();
 
-                               setNotiTime(noti_h, noti_info->time);
+       switch (noti_info->type) {
+#ifdef MSG_NOTI_INTEGRATION
+       case MSG_NOTI_TYPE_NORMAL :
+       case MSG_NOTI_TYPE_CB :
+       case MSG_NOTI_TYPE_SIM :
+       {
+               setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, MSG_NORMAL_STATUS_ICON);
+               if (noti_info->count > 1) {
+                       setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_LOCK, MSG_NORMAL_ICON_PATH);
+                       setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_NORMAL_ICON_PATH);
+                       setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_SUB, "");
+               } else {
+                       if (noti_info->imagePath[0] != '\0') {
+                               setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_LOCK, noti_info->imagePath);
+                               setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, noti_info->imagePath);
+                       } else {
+                               setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_LOCK, MSG_NO_CONTACT_PROFILE_ICON_PATH);
+                               setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_NO_CONTACT_PROFILE_ICON_PATH);
                        }
-                       break;
 
-               case MSG_NOTI_TYPE_MMS_READ_REPORT :
-                       {
-                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "Read Report", READ_REPORT_MESSAGE);
-                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL);
+                       setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_SUB, MSG_MESSAGE_APP_SUB_ICON);
+               }
+               break;
+       }
+#else
+       case MSG_NOTI_TYPE_NORMAL :
+       {
+               setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, MSG_NORMAL_STATUS_ICON);
+               setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_LOCK, MSG_NORMAL_ICON_PATH);
 
-                               if (noti_info->extra_data == MSG_READ_REPORT_IS_DELETED) {
-                                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message deleted", READ_REPORT_DELETE);
-                               }
-                               //CID 45672: noti_info->extra_data in unsigned char but MSG_READ_REPORT_NONE is -1. So the expression is always false
-#if 0
-                               else if (noti_info->extra_data == MSG_READ_REPORT_NONE) {
-                                       //notification free
-                               }
+               if (noti_info->count > 1) {
+                       setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_NORMAL_ICON_PATH);
+               } else {
+                       setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_REPLY_ICON_PATH);
+               }
+               break;
+       }
+       case MSG_NOTI_TYPE_CB: {
+               setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_CB_ICON_PATH);
+               setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, MSG_CB_ICON_PATH);
+               break;
+       }
+       case MSG_NOTI_TYPE_SIM: {
+               setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_SIM_ICON_PATH);
+               setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, MSG_SIM_ICON_PATH);
+               break;
+       }
 #endif
-                               else {
-                                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message read", READ_REPORT_READ);
-                               }
+       case MSG_NOTI_TYPE_FAILED: {
+               setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_NORMAL_ICON_PATH);
+               setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, MSG_NORMAL_STATUS_ICON);
+               break;
+       }
+       case MSG_NOTI_TYPE_VOICE_1:
+       case MSG_NOTI_TYPE_VOICE_2:
+       case MSG_NOTI_TYPE_MWI: {
+               setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, MSG_VOICE_MSG_STATUS_ICON);
+               setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_VOICE_ICON_PATH);
+               break;
+       }
+       case MSG_NOTI_TYPE_CLASS0:
+               setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_NORMAL_ICON_PATH);
+               break;
+       case MSG_NOTI_TYPE_SMS_DELIVERY_REPORT:
+               setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, MSG_NORMAL_STATUS_ICON);
+               setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_NORMAL_ICON_PATH);
+               break;
+       case MSG_NOTI_TYPE_MMS_READ_REPORT:
+               setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, MSG_NORMAL_STATUS_ICON);
+               setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_NORMAL_ICON_PATH);
+               break;
+       case MSG_NOTI_TYPE_MMS_DELIVERY_REPORT:
+               setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, MSG_NORMAL_STATUS_ICON);
+               setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_NORMAL_ICON_PATH);
+               break;
+       case MSG_NOTI_TYPE_SIM_FULL:
+               setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_NORMAL_ICON_PATH);
+               setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, MSG_NORMAL_STATUS_ICON);
+               break;
+       default:
+               MSG_DEBUG("No matching type for MsgNotiSetImage [%d]", noti_info->type);
+               break;
+       }
 
-                               setNotiTime(noti_h, noti_info->time);
-                       }
-                       break;
+       MSG_END();
+}
 
-               case MSG_NOTI_TYPE_MMS_DELIVERY_REPORT :
-                       {
-                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "Delivery Report", DELIVERY_MESSAGE);
-                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL);
+void setActiveProperty(notification_h noti_h, MSG_NOTI_INFO_S *noti_info)
+{
+       MSG_BEGIN();
 
-                               if (noti_info->extra_data == MSG_DELIVERY_REPORT_EXPIRED)
-                                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message expired", EXPIRED_MESSAGE);
-                               else if (noti_info->extra_data == MSG_DELIVERY_REPORT_REJECTED)
-                                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message rejected", REJECTED_MESSAGE);
-                               else if (noti_info->extra_data == MSG_DELIVERY_REPORT_DEFERRED)
-                                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message deferred", DEFERRED_MESSAGE);
-                               else if (noti_info->extra_data == MSG_DELIVERY_REPORT_UNRECOGNISED)
-                                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message unrecognised", UNRECOGNISED_MESSAGE);
-                               else if (noti_info->extra_data == MSG_DELIVERY_REPORT_INDETERMINATE)
-                                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message indeterminate", INDETEMINATE_MESSAGE);
-                               else if (noti_info->extra_data == MSG_DELIVERY_REPORT_FORWARDED)
-                                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message forwarded", NULL);
-                               else if (noti_info->extra_data == MSG_DELIVERY_REPORT_UNREACHABLE)
-                                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message unreachable", UNREACHABLE_MESSAGE);
-                               else if (noti_info->extra_data == MSG_DELIVERY_REPORT_ERROR)
-                                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message error", NULL);
-
-                               //CID 45672: noti_info->extra_data in unsigned char but MSG_READ_REPORT_NONE is -1. So the expression is always false
-#if 0
-                               else if (noti_info->extra_data == MSG_DELIVERY_REPORT_NONE) {
-                                       //notification free
-                               }
-#endif
-                               else
-                                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message delivered", DELIVERED_MESSAGE);
+       int noti_err = NOTIFICATION_ERROR_NONE;
 
-                               setNotiTime(noti_h, noti_info->time);
-                       }
-                       break;
+       /* set layout */
+       noti_err = notification_set_layout(noti_h, NOTIFICATION_LY_NOTI_EVENT_SINGLE);
+       if (noti_err != NOTIFICATION_ERROR_NONE) {
+               MSG_DEBUG("Fail to notification_set_layout : %d", noti_err);
+       }
 
-               case MSG_NOTI_TYPE_SIM_FULL :
-                       {
-                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "SIM card full", SMS_SIM_CARD_FULL);
-                               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, "Not enough memory. Delete some items.", SMS_MESSAGE_MEMORY_FULL);
-                       }
-                       break;
-               default:
-                       MSG_DEBUG("No matching type [%d]", noti_info->type);
-                       break;
+       /* set led */
+       noti_err = notification_set_led(noti_h, NOTIFICATION_LED_OP_ON, 0x00);
+       if (noti_err != NOTIFICATION_ERROR_NONE) {
+               MSG_DEBUG("Fail to notification_set_led.");
+       }
+
+       /* set applist */
+       noti_err = notification_set_display_applist(noti_h, NOTIFICATION_DISPLAY_APP_ACTIVE);
+       if (noti_err != NOTIFICATION_ERROR_NONE) {
+               MSG_DEBUG("Fail to notification_set_display_applist");
+       }
+
+       MSG_END();
+}
+
+
+void setActiveText(notification_h noti_h, MSG_NOTI_INFO_S *noti_info)
+{
+       MSG_BEGIN();
+
+       switch (noti_info->type) {
+       case MSG_NOTI_TYPE_NORMAL:
+       case MSG_NOTI_TYPE_SIM:
+       case MSG_NOTI_TYPE_CB: {
+               if (noti_info->active_subject[0] == '\0') {
+                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, noti_info->active_sender, NULL);
+                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->active_text, NULL);
+               } else {
+                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, noti_info->active_sender, NULL);
+                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, noti_info->active_subject, NULL);
+                       setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->active_text, NULL);
+               }
+               break;
+       }
+       case MSG_NOTI_TYPE_CLASS0: {
+               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "CLASS 0 Message", NULL);
+               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->active_sender, NULL);
+               break;
+       }
+       default:
+               MSG_DEBUG("No matching type [%d]", noti_info->type);
+               break;
        }
 
        MSG_END();
@@ -1639,84 +1898,33 @@ void setText(notification_h noti_h, MSG_NOTI_INFO_S *noti_info)
 }
 
 
-void setIcon(notification_h noti_h, MSG_NOTI_INFO_S *noti_info)
+void setActiveIcon(notification_h noti_h, MSG_NOTI_INFO_S *noti_info)
 {
        MSG_BEGIN();
 
-       switch(noti_info->type)
+       switch (noti_info->type) {
+       case MSG_NOTI_TYPE_NORMAL :
+       case MSG_NOTI_TYPE_SIM :
        {
-#ifdef MSG_NOTI_INTEGRATION
-               case MSG_NOTI_TYPE_NORMAL :
-               case MSG_NOTI_TYPE_CB :
-               case MSG_NOTI_TYPE_SIM :
-                       {
-                               setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, MSG_NORMAL_STATUS_ICON);
-                               setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_LOCK, MSG_NORMAL_ICON_PATH);
-                               setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_NORMAL_ICON_PATH);
-                       }
-                       break;
-#else
-               case MSG_NOTI_TYPE_NORMAL :
-                       {
-                               setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, MSG_NORMAL_STATUS_ICON);
-                               setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_LOCK, MSG_NORMAL_ICON_PATH);
+               if (noti_info->imagePath[0] != '\0')
+                       setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, noti_info->imagePath);
+               else
+                       setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_NO_CONTACT_PROFILE_ICON_PATH);
 
-                               if (noti_info->count > 1) {
-                                       setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_NORMAL_ICON_PATH);
-                               } else {
-                                       setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_REPLY_ICON_PATH);
-                               }
-                       }
-                       break;
-               case MSG_NOTI_TYPE_CB :
-                       {
-                               setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_CB_ICON_PATH);
-                               setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, MSG_CB_ICON_PATH);
-                       }
-                       break;
-               case MSG_NOTI_TYPE_SIM :
-                       {
-                               setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_SIM_ICON_PATH);
-                               setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, MSG_SIM_ICON_PATH);
-                       }
-                       break;
-#endif
-               case MSG_NOTI_TYPE_FAILED :
-                       {
-                               setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_NORMAL_ICON_PATH);
-                               setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, MSG_NORMAL_STATUS_ICON);
-                       }
-                       break;
-               case MSG_NOTI_TYPE_VOICE_1 :
-               case MSG_NOTI_TYPE_VOICE_2 :
-               case MSG_NOTI_TYPE_MWI :
-                       {
-                               setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, MSG_VOICE_MSG_STATUS_ICON);
-                               setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_VOICE_ICON_PATH);
-                       }
-                       break;
-               case MSG_NOTI_TYPE_CLASS0 :
-                       setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_NORMAL_ICON_PATH);
-                       break;
-               case MSG_NOTI_TYPE_SMS_DELIVERY_REPORT :
-                       setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, MSG_NORMAL_STATUS_ICON);
-                       setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_NORMAL_ICON_PATH);
-                       break;
-               case MSG_NOTI_TYPE_MMS_READ_REPORT :
-                       setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, MSG_NORMAL_STATUS_ICON);
-                       setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_NORMAL_ICON_PATH);
-                       break;
-               case MSG_NOTI_TYPE_MMS_DELIVERY_REPORT :
-                       setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, MSG_NORMAL_STATUS_ICON);
-                       setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_NORMAL_ICON_PATH);
-                       break;
-               case MSG_NOTI_TYPE_SIM_FULL :
-                       setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_NORMAL_ICON_PATH);
-                       setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, MSG_NORMAL_STATUS_ICON);
-                       break;
-               default:
-                       MSG_DEBUG("No matching type for MsgNotiSetImage [%d]", noti_info->type);
-                       break;
+               setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_SUB, MSG_MESSAGE_APP_SUB_ICON);
+               break;
+       }
+       case MSG_NOTI_TYPE_CB :
+       {
+               setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_CB_ICON_PATH);
+               break;
+       }
+       case MSG_NOTI_TYPE_CLASS0 :
+               setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_NORMAL_ICON_PATH);
+               break;
+       default:
+               MSG_DEBUG("No matching type for MsgNotiSetImage [%d]", noti_info->type);
+               break;
        }
 
        MSG_END();
@@ -1733,52 +1941,47 @@ msg_error_t MsgInsertInstantMessage(msg_notification_type_t noti_type)
 
        setPkgName(noti, noti_type);
 
-       switch (noti_type)
-       {
-               case MSG_NOTI_TYPE_NORMAL :
-               case MSG_NOTI_TYPE_SIM :
-               case MSG_NOTI_TYPE_CB :
-               {
-                       MSG_NOTI_INFO_S noti_info;
-                       memset(&noti_info, 0x00, sizeof(MSG_NOTI_INFO_S));
-
-                       noti_info.type = noti_type;
-                       msg_err = getLatestMsgInfo(&noti_info, true);
-
-                       if (msg_err == MSG_SUCCESS) {
-                               MSG_DEBUG("Unread count [%d]", noti_info.count);
-                               if (noti_info.count == 1) {
-                                       MSG_SEC_DEBUG("noti_info.sender [%s]",noti_info.sender);
-                                       setNotiText(noti, NOTIFICATION_TEXT_TYPE_TITLE,  noti_info.sender, NULL);
-                                       setNotiText(noti, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info.text, NULL);
-                               } else if (noti_info.count  > 1) {
-                                       gchar *cnt_string = g_strdup_printf("%i", noti_info.count);
-
-                                       notiMsg = getTranslateText(MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR, NEW_MESSAGES);
-                                       gchar *outString = g_strconcat(cnt_string, " ", notiMsg, NULL);
-                                       setNotiText(noti, NOTIFICATION_TEXT_TYPE_TITLE, outString, NULL);
-                                       setNotiText(noti, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info.sender, NULL);
-                                       g_free(outString);
-                                       g_free(cnt_string);
-                               }
-
-                               setNotiImage(noti, NOTIFICATION_IMAGE_TYPE_ICON, MSG_NORMAL_ICON_PATH);
+       switch (noti_type) {
+       case MSG_NOTI_TYPE_NORMAL:
+       case MSG_NOTI_TYPE_SIM:
+       case MSG_NOTI_TYPE_CB: {
+               MSG_NOTI_INFO_S noti_info;
+               memset(&noti_info, 0x00, sizeof(MSG_NOTI_INFO_S));
+
+               noti_info.type = noti_type;
+               msg_err = getLatestMsgInfo(&noti_info, true);
+
+               if (msg_err == MSG_SUCCESS) {
+                       MSG_DEBUG("Unread count [%d]", noti_info.count);
+                       if (noti_info.count == 1) {
+                               MSG_SEC_DEBUG("noti_info.sender [%s]",noti_info.sender);
+                               setNotiText(noti, NOTIFICATION_TEXT_TYPE_TITLE, noti_info.sender, NULL);
+                               setNotiText(noti, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info.text, NULL);
+                       } else if (noti_info.count > 1) {
+                               gchar *cnt_string = g_strdup_printf("%i", noti_info.count);
+
+                               notiMsg = getTranslateText(MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR, NEW_MESSAGE);
+                               gchar *outString = g_strconcat(cnt_string, " ", notiMsg, NULL);
+                               setNotiText(noti, NOTIFICATION_TEXT_TYPE_TITLE, outString, NULL);
+                               setNotiText(noti, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info.sender, NULL);
+                               g_free(outString);
+                               g_free(cnt_string);
                        }
-               }
-               break;
 
-               case MSG_NOTI_TYPE_FAILED:
-               {
-                       notiMsg = getTranslateText(MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR, FAILED_TO_SEND_MESSAGE);
-                       setNotiText(noti, NOTIFICATION_TEXT_TYPE_TITLE, notiMsg, NULL);
                        setNotiImage(noti, NOTIFICATION_IMAGE_TYPE_ICON, MSG_NORMAL_ICON_PATH);
                }
                break;
-
-               default:
-                       MSG_DEBUG("No matching type for MsgNotiType%d]", noti_type);
-                       goto _END_OF_INSTANT_NOTI;
-                       break;
+       }
+       case MSG_NOTI_TYPE_FAILED: {
+               notiMsg = getTranslateText(MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR, FAILED_TO_SEND_MESSAGE);
+               setNotiText(noti, NOTIFICATION_TEXT_TYPE_TITLE, notiMsg, NULL);
+               setNotiImage(noti, NOTIFICATION_IMAGE_TYPE_ICON, MSG_NORMAL_ICON_PATH);
+               break;
+       }
+       default:
+               MSG_DEBUG("No matching type for MsgNotiType%d]", noti_type);
+               goto _END_OF_INSTANT_NOTI;
+               break;
        }
 
        if (notification_set_display_applist(noti, NOTIFICATION_DISPLAY_APP_TICKER) != NOTIFICATION_ERROR_NONE)
@@ -1812,25 +2015,23 @@ void setPkgName(notification_h noti_h, msg_notification_type_t noti_type)
 
        int noti_err = NOTIFICATION_ERROR_NONE;
 
-       switch (noti_type)
-       {
-               case MSG_NOTI_TYPE_NORMAL :
-               case MSG_NOTI_TYPE_CB :
-               case MSG_NOTI_TYPE_SIM :
-               case MSG_NOTI_TYPE_FAILED :
-               case MSG_NOTI_TYPE_SMS_DELIVERY_REPORT :
-               case MSG_NOTI_TYPE_MMS_READ_REPORT :
-               case MSG_NOTI_TYPE_MMS_DELIVERY_REPORT :
-               case MSG_NOTI_TYPE_SIM_FULL :
-                       {
-                               noti_err = notification_set_pkgname(noti_h, MSG_DEFAULT_APP_ID);
-                               if (noti_err != NOTIFICATION_ERROR_NONE)
-                                       MSG_ERR("notification_set_pkgname() is failed, [%d]", noti_err);
-                       }
-                       break;
-               default:
-                       MSG_DEBUG("No matching type for notification_set_pkgname() [%d]", noti_type);
-                       break;
+       switch (noti_type) {
+       case MSG_NOTI_TYPE_NORMAL:
+       case MSG_NOTI_TYPE_CB:
+       case MSG_NOTI_TYPE_SIM:
+       case MSG_NOTI_TYPE_FAILED:
+       case MSG_NOTI_TYPE_SMS_DELIVERY_REPORT:
+       case MSG_NOTI_TYPE_MMS_READ_REPORT:
+       case MSG_NOTI_TYPE_MMS_DELIVERY_REPORT:
+       case MSG_NOTI_TYPE_SIM_FULL: {
+               noti_err = notification_set_pkgname(noti_h, MSG_DEFAULT_APP_ID);
+               if (noti_err != NOTIFICATION_ERROR_NONE)
+                       MSG_ERR("notification_set_pkgname() is failed, [%d]", noti_err);
+               break;
+       }
+       default:
+               MSG_DEBUG("No matching type for notification_set_pkgname() [%d]", noti_type);
+               break;
        }
 
        MSG_END();
@@ -1851,7 +2052,7 @@ void setSoundAndVibration(notification_h noti_h, char *addressVal, bool bVoiceMa
 
        if (addressVal != NULL) {
                snprintf(addrInfo.addressVal, sizeof(addrInfo.addressVal), "%s", addressVal);
-               // Get Contact Info
+               /* Get Contact Info */
                if (MsgGetContactInfo(&addrInfo, &contactInfo) != MSG_SUCCESS) {
                        MSG_DEBUG("MsgGetContactInfo() fail.");
                }
@@ -1873,7 +2074,7 @@ void setSoundAndVibration(notification_h noti_h, char *addressVal, bool bVoiceMa
 
        MsgSoundPlayer::instance()->MsgGetPlayStatus(bVoiceMail, &bPlaySound, &bPlayVibration, &bOnCall);
 
-       if (!bBlockingMode) { // check blocking mode.
+       if (!bBlockingMode) { /* check blocking mode. */
                if (bPlaySound) {
                        if (msg_tone_file_path)
                                setNotiSound(noti_h, NOTIFICATION_SOUND_TYPE_USER_DATA, msg_tone_file_path);
@@ -1904,12 +2105,97 @@ void setSoundAndVibration(notification_h noti_h, char *addressVal, bool bVoiceMa
 }
 
 
+void setActiveNotification(notification_h noti_h, MSG_NOTI_INFO_S *noti_info)
+{
+       MSG_BEGIN();
+
+       int noti_err = NOTIFICATION_ERROR_NONE;
+
+       setPkgName(noti_h, noti_info->type);
+
+       setActiveProperty(noti_h, noti_info);
+
+       setTextDomain(noti_h, noti_info->type);
+
+       setActiveText(noti_h, noti_info);
+
+       setActiveIcon(noti_h, noti_info);
+
+       if (noti_info->active_noti_button_num > 1) {
+               createServiceHandle(&noti_info->active_noti_svc_h[0]);
+               if (noti_info->active_noti_svc_h[0]) {
+                       char telnum[256] = {0,};
+                       app_control_set_operation(noti_info->active_noti_svc_h[0], APP_CONTROL_OPERATION_CALL);
+                       snprintf(telnum, sizeof(telnum), "tel:%s", noti_info->number);
+                       app_control_set_uri(noti_info->active_noti_svc_h[0], telnum);
+               }
+
+               createServiceHandle(&noti_info->active_noti_svc_h[1]);
+               if (noti_info->active_noti_svc_h[1]) {
+                       setServicePackageName(noti_info->active_noti_svc_h[1], MSG_DEFAULT_APP_ID);
+
+                       MSG_DEBUG("Active Notification button 2 - Msg Id = [%d]", noti_info->msg_id);
+                       addServiceExtraData(noti_info->active_noti_svc_h[1], "type", "reply");
+                       addServiceExtraData(noti_info->active_noti_svc_h[1], "msgId", noti_info->msg_id);
+
+                       char slot_id[5] = {0,};
+                       snprintf(slot_id, sizeof(slot_id), "%d", noti_info->sim_idx - 1);
+                       addServiceExtraData(noti_info->active_noti_svc_h[1], "slot_id", slot_id);
+               }
+       }
+
+       createServiceHandle(&noti_info->active_noti_svc_h[2]);
+       if (noti_info->active_noti_svc_h[2]) {
+               setServicePackageName(noti_info->active_noti_svc_h[2], MSG_DEFAULT_APP_ID);
+
+               MSG_DEBUG("Active Notification button 3 - msgId = [%d]", noti_info->msg_id);
+               addServiceExtraData(noti_info->active_noti_svc_h[2], "type", "new_msg");
+               addServiceExtraData(noti_info->active_noti_svc_h[2], "msgId", noti_info->msg_id);
+
+               char slot_id[5] = {0,};
+               snprintf(slot_id, sizeof(slot_id), "%d", noti_info->sim_idx - 1);
+               addServiceExtraData(noti_info->active_noti_svc_h[2], "slot_id", slot_id);
+       }
+
+       if (noti_info->active_noti_button_num > 1) {
+               setNotiEventHandler(noti_h, NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1, noti_info->active_noti_svc_h[0]);
+               setNotiEventHandler(noti_h, NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_2, noti_info->active_noti_svc_h[1]);
+               setNotiEventHandler(noti_h, NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_3, noti_info->active_noti_svc_h[2]);
+
+               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_BUTTON_1, "Call", NULL);
+               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_BUTTON_2, "Reply", NULL);
+               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_BUTTON_3, "View", NULL);
+       } else {
+               setNotiEventHandler(noti_h, NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1, noti_info->active_noti_svc_h[2]);
+
+               setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_BUTTON_1, "View", NULL);
+       }
+
+       noti_err = notification_post(noti_h);
+       if (noti_err != NOTIFICATION_ERROR_NONE) {
+               MSG_DEBUG("Fail to notification_post");
+       }
+
+       MSG_END();
+}
+
+
 void setNotification(notification_h noti_h, MSG_NOTI_INFO_S *noti_info, bool bFeedback)
 {
        MSG_BEGIN();
 
        int noti_err = NOTIFICATION_ERROR_NONE;
 
+       if (bFeedback && noti_info->active_noti_button_num > 0 &&
+               ((noti_info->type >= MSG_NOTI_TYPE_NORMAL && noti_info->type <= MSG_NOTI_TYPE_SIM) || noti_info->type == MSG_NOTI_TYPE_CLASS0)) {
+               notification_h active_noti_h = notification_create(NOTIFICATION_TYPE_NOTI);
+
+               setActiveNotification(active_noti_h, noti_info);
+
+               notification_free(active_noti_h);
+               active_noti_h = NULL;
+       }
+
        setPkgName(noti_h, noti_info->type);
 
        setProperty(noti_h, noti_info);
@@ -1921,8 +2207,6 @@ void setNotification(notification_h noti_h, MSG_NOTI_INFO_S *noti_info, bool bFe
        setIcon(noti_h, noti_info);
 
        if (bFeedback) {
-               setFlashNoti();
-
                if (noti_info->type == MSG_NOTI_TYPE_VOICE_1 || noti_info->type == MSG_NOTI_TYPE_VOICE_2)
                        setSoundAndVibration(noti_h, noti_info->number, true);
                else
@@ -1961,592 +2245,592 @@ msg_error_t getLatestMsgInfo(MSG_NOTI_INFO_S *noti_info, bool isForInstantMessag
        int noti_err = NOTIFICATION_ERROR_NONE;
        msg_error_t msg_err = MSG_SUCCESS;
 
-       switch (noti_info->type)
-       {
+       switch (noti_info->type) {
+       case MSG_NOTI_TYPE_NORMAL:
 #ifdef MSG_NOTI_INTEGRATION
-               case MSG_NOTI_TYPE_NORMAL :
-               case MSG_NOTI_TYPE_CB :
-               case MSG_NOTI_TYPE_SIM :
-#else
-               case MSG_NOTI_TYPE_NORMAL :
+       case MSG_NOTI_TYPE_CB:
+       case MSG_NOTI_TYPE_SIM:
 #endif
-                       {
-                               int smsUnreadCnt = 0;
-                               int mmsUnreadCnt = 0;
+       {
+               int smsUnreadCnt = 0;
+               int mmsUnreadCnt = 0;
 
-                               char sqlQuery[MAX_QUERY_LEN+1];
-                               MSG_MAIN_TYPE_T mainType;
-                               MSG_SUB_TYPE_T subType;
+               char sqlQuery[MAX_QUERY_LEN+1];
+               MSG_MAIN_TYPE_T mainType;
+               MSG_SUB_TYPE_T subType;
+               int msgSize;
 
-                               memset(sqlQuery, 0x00, sizeof(sqlQuery));
+               memset(sqlQuery, 0x00, sizeof(sqlQuery));
 #ifdef MSG_NOTI_INTEGRATION
-                               snprintf(sqlQuery, sizeof(sqlQuery), "SELECT DISTINCT "
-                                               "A.ADDRESS_VAL, "
-                                               "B.SUB_TYPE "
-                                               "FROM %s A, %s B "
-                                               "WHERE A.CONV_ID=B.CONV_ID "
-                                               "AND B.READ_STATUS=0 AND (B.FOLDER_ID=%d OR B.FOLDER_ID=%d) "
-                                               "AND B.STORAGE_ID = %d  "
-                                               "GROUP BY A.ADDRESS_VAL "
-                                               "ORDER BY B.DISPLAY_TIME DESC LIMIT 5;",
-                                               MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME,
-                                               MSG_INBOX_ID, MSG_CBMSGBOX_ID,
-                                               MSG_STORAGE_PHONE);
+               snprintf(sqlQuery, sizeof(sqlQuery), "SELECT DISTINCT "
+                               "A.ADDRESS_VAL, "
+                               "B.SUB_TYPE "
+                               "FROM %s A, %s B "
+                               "WHERE A.CONV_ID=B.CONV_ID "
+                               "AND B.READ_STATUS=0 AND (B.FOLDER_ID=%d OR B.FOLDER_ID=%d) "
+                               "AND B.STORAGE_ID = %d "
+                               "GROUP BY A.ADDRESS_VAL "
+                               "ORDER BY B.DISPLAY_TIME DESC LIMIT 5;",
+                               MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME,
+                               MSG_INBOX_ID, MSG_CBMSGBOX_ID,
+                               MSG_STORAGE_PHONE);
 #else
-                               snprintf(sqlQuery, sizeof(sqlQuery), "SELECT DISTINCT "
-                                               "A.ADDRESS_VAL, "
-                                               "B.SUB_TYPE "
-                                               "FROM %s A, %s B "
-                                               "WHERE A.CONV_ID=B.CONV_ID "
-                                               "AND B.READ_STATUS=0 AND B.FOLDER_ID=%d "
-                                               "AND B.STORAGE_ID = %d  "
-                                               "GROUP BY A.ADDRESS_VAL "
-                                               "ORDER BY B.DISPLAY_TIME DESC LIMIT 5;",
-                                               MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME,
-                                               MSG_INBOX_ID,
-                                               MSG_STORAGE_PHONE);
+               snprintf(sqlQuery, sizeof(sqlQuery), "SELECT DISTINCT "
+                               "A.ADDRESS_VAL, "
+                               "B.SUB_TYPE "
+                               "FROM %s A, %s B "
+                               "WHERE A.CONV_ID=B.CONV_ID "
+                               "AND B.READ_STATUS=0 AND B.FOLDER_ID=%d "
+                               "AND B.STORAGE_ID = %d "
+                               "GROUP BY A.ADDRESS_VAL "
+                               "ORDER BY B.DISPLAY_TIME DESC LIMIT 5;",
+                               MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME,
+                               MSG_INBOX_ID,
+                               MSG_STORAGE_PHONE);
 #endif
-                               MSG_DEBUG("sqlQuery [%s]", sqlQuery);
+               MSG_DEBUG("sqlQuery [%s]", sqlQuery);
 
-                               int rowCnt = 0, index = 0;
+               int rowCnt = 0, index = 0;
 
-                               msg_err = dbhandler->getTable(sqlQuery, &rowCnt, &index);
-                               MSG_DEBUG("getTable() ret=[%d], rowCnt=[%d]", msg_err, rowCnt);
+               msg_err = dbhandler->getTable(sqlQuery, &rowCnt, &index);
+               MSG_DEBUG("getTable() ret=[%d], rowCnt=[%d]", msg_err, rowCnt);
 
-                               MSG_ADDRESS_INFO_S tmpAddressInfo;
+               MSG_ADDRESS_INFO_S tmpAddressInfo;
 
-                               for (int i = 1; i <= rowCnt; i++) {
-                                       memset(&tmpAddressInfo, 0x00, sizeof(MSG_ADDRESS_INFO_S));
+               for (int i = 1; i <= rowCnt; i++) {
+                       memset(&tmpAddressInfo, 0x00, sizeof(MSG_ADDRESS_INFO_S));
 
-                                       char *address = dbhandler->getColumnToString(index++);
-                                       if (address) {
-                                               snprintf(tmpAddressInfo.addressVal, MAX_ADDRESS_VAL_LEN, "%s", address);
-                                               if (msg_is_valid_email(address)) {
-                                                       tmpAddressInfo.addressType = MSG_ADDRESS_TYPE_EMAIL;
-                                               } else {
-                                                       tmpAddressInfo.addressType = MSG_ADDRESS_TYPE_UNKNOWN;
-                                               }
-                                       }
-                                       subType = dbhandler->getColumnToInt(index++);
+                       char *address = dbhandler->getColumnToString(index++);
+                       if (address) {
+                               snprintf(tmpAddressInfo.addressVal, MAX_ADDRESS_VAL_LEN, "%s", address);
+                               if (msg_is_valid_email(address)) {
+                                       tmpAddressInfo.addressType = MSG_ADDRESS_TYPE_EMAIL;
+                               } else {
+                                       tmpAddressInfo.addressType = MSG_ADDRESS_TYPE_UNKNOWN;
+                               }
+                       }
+                       subType = dbhandler->getColumnToInt(index++);
 
-                                       MSG_CONTACT_INFO_S tmpContact;
-                                       memset(&tmpContact, 0x00, sizeof(MSG_CONTACT_INFO_S));
+                       MSG_CONTACT_INFO_S tmpContact;
+                       memset(&tmpContact, 0x00, sizeof(MSG_CONTACT_INFO_S));
 
-                                       MsgGetContactInfo(&tmpAddressInfo, &tmpContact);
+                       MsgGetContactInfo(&tmpAddressInfo, &tmpContact);
 
-                                       if (rowCnt == 1) {
-                                               snprintf(noti_info->imagePath, sizeof(noti_info->imagePath), "%s", tmpContact.imagePath);
-                                       }
+                       if (rowCnt == 1) {
+                               snprintf(noti_info->imagePath, sizeof(noti_info->imagePath), "%s", tmpContact.imagePath);
+                       }
 
-                                       if (i > 1) {
-                                               g_strlcat(noti_info->sender, ", ", sizeof(noti_info->sender)-strlen(noti_info->sender));
-                                       }
+                       if (i > 1) {
+                               g_strlcat(noti_info->sender, ", ", sizeof(noti_info->sender)-strlen(noti_info->sender));
+                       }
 
-                                       if (tmpContact.firstName[0] != '\0')
-                                               g_strlcat(noti_info->sender, tmpContact.firstName, sizeof(noti_info->sender)-strlen(noti_info->sender));
-                                       else if (tmpAddressInfo.addressVal[0] == '\0') {
-                                               char *senderStr = NULL;
-                                               senderStr = getTranslateText(MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR, MSG_UNKNOWN_SENDER);
-                                               g_strlcat(noti_info->sender, senderStr, sizeof(noti_info->sender)-strlen(noti_info->sender));
-                                               if (senderStr) {
-                                                       free(senderStr);
-                                                       senderStr = NULL;
-                                               }
-                                       } else {
-                                               char *senderStr = NULL;
-                                               if (subType == MSG_CB_SMS) {
-                                                       senderStr = getTranslateText(MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR, CB_MESSAGE);
-                                                       g_strlcat(noti_info->sender, senderStr, sizeof(noti_info->sender)-strlen(noti_info->sender));
-                                               } else if (subType == MSG_WAP_SI_SMS || subType == MSG_WAP_SL_SMS) {
-                                                       senderStr = getTranslateText(MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR, PUSH_MESSAGE);
-                                                       g_strlcat(noti_info->sender, senderStr, sizeof(noti_info->sender)-strlen(noti_info->sender));
-                                               } else {
-                                                       g_strlcat(noti_info->sender, tmpAddressInfo.addressVal, sizeof(noti_info->sender)-strlen(noti_info->sender));
-                                               }
-                                               if (senderStr) {
-                                                       free(senderStr);
-                                                       senderStr = NULL;
-                                               }
-                                       }
+                       if (tmpContact.firstName[0] != '\0') {
+                               g_strlcat(noti_info->sender, tmpContact.firstName, sizeof(noti_info->sender)-strlen(noti_info->sender));
+                       } else if (tmpAddressInfo.addressVal[0] == '\0') {
+                               char *senderStr = NULL;
+                               senderStr = getTranslateText(MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR, MSG_UNKNOWN_SENDER);
+                               g_strlcat(noti_info->sender, senderStr, sizeof(noti_info->sender)-strlen(noti_info->sender));
+                               if (senderStr) {
+                                       free(senderStr);
+                                       senderStr = NULL;
+                               }
+                               noti_info->active_noti_button_num = 1;
+                       } else {
+                               char *senderStr = NULL;
+                               if (subType == MSG_CB_SMS) {
+                                       senderStr = getTranslateText(MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR, CB_MESSAGE);
+                                       g_strlcat(noti_info->sender, senderStr, sizeof(noti_info->sender)-strlen(noti_info->sender));
+                                       noti_info->active_noti_button_num = 1;
+                               } else if (subType == MSG_WAP_SI_SMS || subType == MSG_WAP_SL_SMS) {
+                                       senderStr = getTranslateText(MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR, PUSH_MESSAGE);
+                                       g_strlcat(noti_info->sender, senderStr, sizeof(noti_info->sender)-strlen(noti_info->sender));
+                                       noti_info->active_noti_button_num = 1;
+                               } else {
+                                       g_strlcat(noti_info->sender, tmpAddressInfo.addressVal, sizeof(noti_info->sender)-strlen(noti_info->sender));
+
+                                       if (subType == MSG_SYNCML_CP)
+                                               noti_info->active_noti_button_num = 1;
+                               }
+                               if (senderStr) {
+                                       free(senderStr);
+                                       senderStr = NULL;
                                }
+                       }
+
+                       if (i == 1) {
+                               snprintf(noti_info->active_sender, MSG_NOTI_TEXT_LEN_S, "%s", noti_info->sender);
+                               snprintf(noti_info->imagePath, sizeof(noti_info->imagePath), "%s", tmpContact.imagePath);
+                       }
+               }
 
-                               dbhandler->freeTable();
+               dbhandler->freeTable();
 
-                               MSG_SEC_DEBUG("sender info = [%s]", noti_info->sender);
+               MSG_SEC_DEBUG("sender info = [%s]", noti_info->sender);
 
-                               memset(sqlQuery, 0x00, sizeof(sqlQuery));
+               memset(sqlQuery, 0x00, sizeof(sqlQuery));
 
 #ifdef MSG_NOTI_INTEGRATION
-                               snprintf(sqlQuery, sizeof(sqlQuery), "SELECT "
-                                               "A.ADDRESS_VAL, "
-                                               "B.DISPLAY_TIME, "
-                                               "B.MSG_ID, "
-                                               "B.SUBJECT, "
-                                               "B.MSG_TEXT, "
-                                               "B.MAIN_TYPE, "
-                                               "(COUNT(CASE WHEN B.MAIN_TYPE = %d THEN 1 END)) AS SMS_UNREAD_CNT, "
-                                               "(COUNT(CASE WHEN B.MAIN_TYPE = %d THEN 1 END)) AS MMS_UNREAD_CNT "
-                                               "FROM %s A, %s B "
-                                               "WHERE A.CONV_ID=B.CONV_ID "
-                                               "AND B.READ_STATUS=0 AND (B.FOLDER_ID=%d OR B.FOLDER_ID=%d) "
-                                               "AND B.STORAGE_ID = %d  "
-                                               "ORDER BY B.DISPLAY_TIME DESC;",
-                                               MSG_SMS_TYPE,
-                                               MSG_MMS_TYPE,
-                                               MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME,
-                                               MSG_INBOX_ID, MSG_CBMSGBOX_ID,
-                                               MSG_STORAGE_PHONE);
+               snprintf(sqlQuery, sizeof(sqlQuery), "SELECT "
+                               "A.ADDRESS_VAL, "
+                               "B.DISPLAY_TIME, "
+                               "B.MSG_ID, "
+                               "B.SUBJECT, "
+                               "B.MSG_TEXT, "
+                               "B.MAIN_TYPE, "
+                               "(COUNT(CASE WHEN B.MAIN_TYPE = %d THEN 1 END)) AS SMS_UNREAD_CNT, "
+                               "(COUNT(CASE WHEN B.MAIN_TYPE = %d THEN 1 END)) AS MMS_UNREAD_CNT, "
+                               "(CASE WHEN B.MAIN_TYPE = %d AND B.NETWORK_STATUS = %d THEN (SELECT C.MSG_SIZE FROM %s C WHERE B.MSG_ID = C.MSG_ID) ELSE -1 END) "
+                               "FROM %s A, %s B "
+                               "WHERE A.CONV_ID=B.CONV_ID "
+                               "AND B.READ_STATUS=0 AND (B.FOLDER_ID=%d OR B.FOLDER_ID=%d) "
+                               "AND B.STORAGE_ID = %d "
+                               "ORDER BY B.DISPLAY_TIME DESC;",
+                               MSG_SMS_TYPE,
+                               MSG_MMS_TYPE,
+                               MSG_MMS_TYPE, MSG_NETWORK_RECEIVED, MMS_PLUGIN_MESSAGE_TABLE_NAME,
+                               MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME,
+                               MSG_INBOX_ID, MSG_CBMSGBOX_ID,
+                               MSG_STORAGE_PHONE);
 #else
-                               snprintf(sqlQuery, sizeof(sqlQuery), "SELECT "
-                                               "A.ADDRESS_VAL, "
-                                               "B.DISPLAY_TIME, "
-                                               "B.MSG_ID, "
-                                               "B.SUBJECT, "
-                                               "B.MSG_TEXT, "
-                                               "B.MAIN_TYPE, "
-                                               "(COUNT(CASE WHEN B.MAIN_TYPE = %d THEN 1 END)) AS SMS_UNREAD_CNT, "
-                                               "(COUNT(CASE WHEN B.MAIN_TYPE = %d THEN 1 END)) AS MMS_UNREAD_CNT "
-                                               "FROM %s A, %s B "
-                                               "WHERE A.CONV_ID=B.CONV_ID "
-                                               "AND B.READ_STATUS=0 AND B.FOLDER_ID=%d "
-                                               "AND B.STORAGE_ID = %d  "
-                                               "ORDER BY B.DISPLAY_TIME DESC;",
-                                               MSG_SMS_TYPE,
-                                               MSG_MMS_TYPE,
-                                               MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME,
-                                               MSG_INBOX_ID,
-                                               MSG_STORAGE_PHONE);
+               snprintf(sqlQuery, sizeof(sqlQuery), "SELECT "
+                               "A.ADDRESS_VAL, "
+                               "B.DISPLAY_TIME, "
+                               "B.MSG_ID, "
+                               "B.SUBJECT, "
+                               "B.MSG_TEXT, "
+                               "B.MAIN_TYPE, "
+                               "(COUNT(CASE WHEN B.MAIN_TYPE = %d THEN 1 END)) AS SMS_UNREAD_CNT, "
+                               "(COUNT(CASE WHEN B.MAIN_TYPE = %d THEN 1 END)) AS MMS_UNREAD_CNT "
+                               "FROM %s A, %s B "
+                               "WHERE A.CONV_ID=B.CONV_ID "
+                               "AND B.READ_STATUS=0 AND B.FOLDER_ID=%d "
+                               "AND B.STORAGE_ID = %d "
+                               "ORDER BY B.DISPLAY_TIME DESC;",
+                               MSG_SMS_TYPE,
+                               MSG_MMS_TYPE,
+                               MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME,
+                               MSG_INBOX_ID,
+                               MSG_STORAGE_PHONE);
 #endif
-                               MSG_DEBUG("sqlQuery [%s]", sqlQuery);
-
-                               if (dbhandler->prepareQuery(sqlQuery) != MSG_SUCCESS)
-                                       return MSG_ERR_DB_PREPARE;
-
-                               if (dbhandler->stepQuery() == MSG_ERR_DB_ROW) {
+               MSG_DEBUG("sqlQuery [%s]", sqlQuery);
 
-                                       smsUnreadCnt = dbhandler->columnInt(6);
-                                       mmsUnreadCnt = dbhandler->columnInt(7);
+               if (dbhandler->prepareQuery(sqlQuery) != MSG_SUCCESS)
+                       return MSG_ERR_DB_PREPARE;
 
-                                       noti_info->count = smsUnreadCnt + mmsUnreadCnt;
+               if (dbhandler->stepQuery() == MSG_ERR_DB_ROW) {
 
-                                       if (noti_info->count > 0) {
-                                               snprintf(noti_info->number, sizeof(noti_info->number), "%s", (char*)dbhandler->columnText(0));
+                       smsUnreadCnt = dbhandler->columnInt(6);
+                       mmsUnreadCnt = dbhandler->columnInt(7);
+                       msgSize = dbhandler->columnInt(8);
 
-                                               noti_info->time = (time_t)dbhandler->columnInt(1);
+                       noti_info->count = smsUnreadCnt + mmsUnreadCnt;
 
-                                               noti_info->msg_id = (msg_message_id_t)dbhandler->columnInt(2);
+                       if (noti_info->count > 0) {
+                               snprintf(noti_info->number, sizeof(noti_info->number), "%s", (char*)dbhandler->columnText(0));
 
-                                               mainType = (MSG_MAIN_TYPE_T)dbhandler->columnInt(5);
+                               noti_info->time = (time_t)dbhandler->columnInt(1);
 
-                                               if (mainType == MSG_MMS_TYPE) {
-                                                       snprintf(noti_info->text, sizeof(noti_info->text), "%s", (char*)dbhandler->columnText(3));
-                                                       if (noti_info->text[0] == '\0') {
-                                                               char *noti_text = getTranslateText(MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR, MSG_NO_SUBJECT);
-                                                               snprintf(noti_info->text, sizeof(noti_info->text), "%s", noti_text);
-                                                               g_free(noti_text);
-                                                       }
-                                               } else {
-                                                       snprintf(noti_info->text, sizeof(noti_info->text), "%s", (char*)dbhandler->columnText(4));
-                                               }
-
-                                               MSG_DEBUG("unread message ID [%d].", noti_info->msg_id);
-
-                                               if (!isForInstantMessage) {
-                                                       if (noti_info->id > 0 && noti_info->count == 1 ) {
-                                                               noti_err = notification_delete_by_priv_id(MSG_DEFAULT_APP_ID, NOTIFICATION_TYPE_NOTI, noti_info->id);
-                                                               if (noti_err != NOTIFICATION_ERROR_NONE) {
-                                                                       MSG_DEBUG("Fail to notification_delete_by_priv_id : %d", noti_err);
-                                                               }
-                                                               noti_info->id = 0;
-                                                               if (MsgSettingSetInt(NOTIFICATION_PRIV_ID, noti_info->id) != MSG_SUCCESS)
-                                                                       MSG_DEBUG("MsgSettingSetInt fail : NOTIFICATION_PRIV_ID");
-                                                       }
-                                                       MsgSettingHandleNewMsg(smsUnreadCnt, mmsUnreadCnt);
-                                                       MsgInsertBadge(noti_info->count);
-                                                       MsgSoundSetRepeatAlarm();
-                                               }
-                                       } else {
+                               noti_info->msg_id = (msg_message_id_t)dbhandler->columnInt(2);
 
-                                               MSG_DEBUG("No unread message.");
-                                               MSG_DEBUG("notiPrivId [%d]", noti_info->id);
+                               mainType = (MSG_MAIN_TYPE_T)dbhandler->columnInt(5);
 
-                                               dbhandler->finalizeQuery();
-
-                                               if (!isForInstantMessage) {
-                                                       // No unread message.
-                                                       if (noti_info->id > 0) {
-                                                               noti_err = notification_delete_by_priv_id(MSG_DEFAULT_APP_ID, NOTIFICATION_TYPE_NOTI, noti_info->id);
-                                                               if (noti_err != NOTIFICATION_ERROR_NONE) {
-                                                                       MSG_DEBUG("Fail to notification_delete_by_priv_id : %d", noti_err);
-                                                               }
-                                                       }
+                               if (mainType == MSG_MMS_TYPE) {
+                                       snprintf(noti_info->text, sizeof(noti_info->text), "%s", (char*)dbhandler->columnText(3));
+                                       if (noti_info->text[0] == '\0') {
+                                               char *noti_text = getTranslateText(MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR, MSG_NO_SUBJECT);
+                                               snprintf(noti_info->text, sizeof(noti_info->text), "%s", noti_text);
+                                               g_free(noti_text);
+                                       }
 
-                                                       noti_info->id = 0;
+                                       snprintf(noti_info->active_subject, MSG_NOTI_TEXT_LEN_S, "%s", noti_info->text);
+                                       if (msgSize > -1) {
+                                               int kb_msg_size = msgSize / 1024;
+                                               if (kb_msg_size == 0 && msgSize > 0)
+                                                       kb_msg_size = 1;
+                                               else if (msgSize % 1024 >= 512)
+                                                       kb_msg_size++;
 
-                                                       if(MsgSettingSetInt(NOTIFICATION_PRIV_ID, noti_info->id) != MSG_SUCCESS)
-                                                               MSG_DEBUG("MsgSettingSetInt fail : NOTIFICATION_PRIV_ID");
+                                               char *msg_size_string = getTranslateText(MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR, MESSAGE_SIZE_STRING);
+                                               char *msg_size_unit_kb = getTranslateText(MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR, MESSAGE_SIZE_UNIT_KB);
 
-                                                       MsgSettingHandleNewMsg(0,0);
-                                                       MsgInsertBadge(0);
-                                                       MsgSoundSetRepeatAlarm();
-                                               }
+                                               snprintf(noti_info->active_text, MSG_NOTI_TEXT_LEN, "%s : %d%s", msg_size_string, kb_msg_size, msg_size_unit_kb);
 
-                                               return MSG_ERR_DB_STEP;
+                                               g_free(msg_size_string);
+                                               g_free(msg_size_unit_kb);
                                        }
+
                                } else {
-                                       MSG_DEBUG("sqlQuery [%s]", sqlQuery);
-                                       dbhandler->finalizeQuery();
-                                       return MSG_ERR_DB_STEP;
+                                       snprintf(noti_info->text, sizeof(noti_info->text), "%s", (char*)dbhandler->columnText(4));
                                }
 
-                               dbhandler->finalizeQuery();
-                       }
-                       break;
-
-#ifndef MSG_NOTI_INTEGRATION
-               case MSG_NOTI_TYPE_CB :
-                       {
-                               char sqlQuery[MAX_QUERY_LEN+1];
-                               memset(sqlQuery, 0x00, sizeof(sqlQuery));
-
-                               snprintf(sqlQuery, sizeof(sqlQuery), "SELECT "
-                                               "A.ADDRESS_VAL, "
-                                               "B.DISPLAY_TIME, "
-                                               "B.MSG_ID, "
-                                               "B.MSG_TEXT "
-                                               "FROM %s A, %s B "
-                                               "WHERE A.CONV_ID=B.CONV_ID "
-                                               "AND B.READ_STATUS=0 "
-                                               "AND B.FOLDER_ID=%d "
-                                               "AND B.STORAGE_ID = %d "
-                                               "ORDER BY B.DISPLAY_TIME DESC;",
-                                               MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME,
-                                               MSG_CBMSGBOX_ID,
-                                               MSG_STORAGE_PHONE);
-
-                               if (dbhandler->prepareQuery(sqlQuery) != MSG_SUCCESS)
-                                       return MSG_ERR_DB_PREPARE;
-
-                               if (dbhandler->stepQuery() == MSG_ERR_DB_ROW) {
-                                       MSG_ADDRESS_INFO_S addrInfo;
-                                       memset(&addrInfo, 0x00, sizeof(MSG_ADDRESS_INFO_S));
-
-                                       if (dbhandler->columnText(0) != NULL)
-                                               snprintf(addrInfo.addressVal, sizeof(addrInfo.addressVal), "%s", (char*)dbhandler->columnText(0));
-
-                                       MSG_CONTACT_INFO_S tmpContact;
-                                       memset(&tmpContact, 0x00, sizeof(MSG_CONTACT_INFO_S));
-
-                                       MsgGetContactInfo(&addrInfo, &tmpContact);
-
-                                       if (tmpContact.firstName[0] != '\0') {
-                                               snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", tmpContact.firstName);
-                                       } else if (addrInfo.addressVal[0] == '\0') {
-                                               char *senderStr = NULL;
-                                               senderStr = getTranslateText(MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR, MSG_UNKNOWN_SENDER);
-                                               g_strlcat(noti_info->sender, senderStr, sizeof(noti_info->sender)-strlen(noti_info->sender));
-                                               if (senderStr) {
-                                                       free(senderStr);
-                                                       senderStr = NULL;
-                                               }
-                                       } else {
-                                               snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", addrInfo.addressVal);
-                                       }
-
-                                       snprintf(noti_info->number, sizeof(noti_info->number), "%s", addrInfo.addressVal);
+                               if (noti_info->active_text[0] == '\0')
+                                       snprintf(noti_info->active_text, MSG_NOTI_TEXT_LEN, "%s", (char*)dbhandler->columnText(4));
 
-                                       noti_info->time = (time_t)dbhandler->columnInt(1);
+                               MSG_DEBUG("unread message ID [%d].", noti_info->msg_id);
 
-                                       noti_info->msg_id = (msg_message_id_t)dbhandler->columnInt(2);
-
-                                       snprintf(noti_info->text, sizeof(noti_info->text), "%s", (char*)dbhandler->columnText(3));
+                               MSG_DEBUG("active sender [%s]", noti_info->active_sender);
+                               MSG_DEBUG("active subject [%s]", noti_info->active_subject);
+                               MSG_DEBUG("active text [%s]", noti_info->active_text);
 
-                                       MSG_DEBUG("unread CB message [%d].", noti_info->msg_id);
-                               } else {
+                               if (!isForInstantMessage) {
+                                       if (noti_info->id > 0 && noti_info->count == 1) {
+                                               noti_err = notification_delete_by_priv_id(MSG_DEFAULT_APP_ID, NOTIFICATION_TYPE_NOTI, noti_info->id);
+                                               if (noti_err != NOTIFICATION_ERROR_NONE) {
+                                                       MSG_DEBUG("Fail to notification_delete_by_priv_id : %d", noti_err);
+                                               }
+                                               noti_info->id = 0;
+                                               if (MsgSettingSetInt(NOTIFICATION_PRIV_ID, noti_info->id) != MSG_SUCCESS)
+                                                       MSG_DEBUG("MsgSettingSetInt fail : NOTIFICATION_PRIV_ID");
+                                       }
+                                       MsgSettingHandleNewMsg(smsUnreadCnt, mmsUnreadCnt);
+                                       MsgInsertBadge(noti_info->count);
+                                       MsgSoundSetRepeatAlarm();
+                               }
+                       } else {
 
-                                       MSG_DEBUG("No unread CB message.");
-                                       MSG_DEBUG("notiCbId [%d]", noti_info->id);
+                               MSG_DEBUG("No unread message.");
+                               MSG_DEBUG("notiPrivId [%d]", noti_info->id);
 
-                                       dbhandler->finalizeQuery();
+                               dbhandler->finalizeQuery();
 
-                                       if (!isForInstantMessage) {
-                                               // No unread message.
-                                               if (noti_info->id > 0) {
-                                                       noti_err = notification_delete_by_priv_id(NULL, NOTIFICATION_TYPE_NOTI, noti_info->id);
-                                                       if (noti_err != NOTIFICATION_ERROR_NONE) {
-                                                               MSG_DEBUG("Fail to notification_delete_by_priv_id : %d", noti_err);
-                                                       }
+                               if (!isForInstantMessage) {
+                                       /* No unread message. */
+                                       if (noti_info->id > 0) {
+                                               noti_err = notification_delete_by_priv_id(MSG_DEFAULT_APP_ID, NOTIFICATION_TYPE_NOTI, noti_info->id);
+                                               if (noti_err != NOTIFICATION_ERROR_NONE) {
+                                                       MSG_DEBUG("Fail to notification_delete_by_priv_id : %d", noti_err);
                                                }
+                                       }
 
-                                               noti_info->id = 0;
+                                       noti_info->id = 0;
 
-                                               if (MsgSettingSetInt(CB_NOTI_PRIV_ID, noti_info->id) != MSG_SUCCESS)
-                                                       MSG_DEBUG("MsgSettingSetInt fail : CB_NOTI_PRIV_ID");
-                                       }
+                                       if (MsgSettingSetInt(NOTIFICATION_PRIV_ID, noti_info->id) != MSG_SUCCESS)
+                                               MSG_DEBUG("MsgSettingSetInt fail : NOTIFICATION_PRIV_ID");
 
-                                       return MSG_ERR_DB_STEP;
+                                       MsgSettingHandleNewMsg(0,0);
+                                       MsgInsertBadge(0);
+                                       MsgSoundSetRepeatAlarm();
                                }
 
-                               dbhandler->finalizeQuery();
+                               return MSG_ERR_DB_STEP;
+                       }
+               } else {
+                       MSG_DEBUG("sqlQuery [%s]", sqlQuery);
+                       dbhandler->finalizeQuery();
+                       return MSG_ERR_DB_STEP;
+               }
 
-                               if (dbhandler->getTable(sqlQuery, &noti_info->count, NULL) != MSG_SUCCESS) {
-                                       MSG_DEBUG("getTable is failed");
-                                       dbhandler->freeTable();
-                                       return MSG_ERR_DB_GETTABLE;
-                               }
+               dbhandler->finalizeQuery();
+               break;
+       }
 
-                               dbhandler->freeTable();
-                               MSG_DEBUG("notiCbId [%d], unreadCbMsgCnt [%d]", noti_info->id, noti_info->count);
+#ifndef MSG_NOTI_INTEGRATION
+       case MSG_NOTI_TYPE_CB: {
+               char sqlQuery[MAX_QUERY_LEN+1];
+               memset(sqlQuery, 0x00, sizeof(sqlQuery));
+
+               snprintf(sqlQuery, sizeof(sqlQuery), "SELECT "
+                               "A.ADDRESS_VAL, "
+                               "B.DISPLAY_TIME, "
+                               "B.MSG_ID, "
+                               "B.MSG_TEXT "
+                               "FROM %s A, %s B "
+                               "WHERE A.CONV_ID=B.CONV_ID "
+                               "AND B.READ_STATUS=0 "
+                               "AND B.FOLDER_ID=%d "
+                               "AND B.STORAGE_ID = %d "
+                               "ORDER BY B.DISPLAY_TIME DESC;",
+                               MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME,
+                               MSG_CBMSGBOX_ID,
+                               MSG_STORAGE_PHONE);
+
+               if (dbhandler->prepareQuery(sqlQuery) != MSG_SUCCESS)
+                       return MSG_ERR_DB_PREPARE;
+
+               if (dbhandler->stepQuery() == MSG_ERR_DB_ROW) {
+                       MSG_ADDRESS_INFO_S addrInfo;
+                       memset(&addrInfo, 0x00, sizeof(MSG_ADDRESS_INFO_S));
+
+                       if (dbhandler->columnText(0) != NULL)
+                               snprintf(addrInfo.addressVal, sizeof(addrInfo.addressVal), "%s", (char*)dbhandler->columnText(0));
+
+                       MSG_CONTACT_INFO_S tmpContact;
+                       memset(&tmpContact, 0x00, sizeof(MSG_CONTACT_INFO_S));
+
+                       MsgGetContactInfo(&addrInfo, &tmpContact);
+
+                       if (tmpContact.firstName[0] != '\0') {
+                               snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", tmpContact.firstName);
+                       } else if (addrInfo.addressVal[0] == '\0') {
+                               char *senderStr = NULL;
+                               senderStr = getTranslateText(MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR, MSG_UNKNOWN_SENDER);
+                               g_strlcat(noti_info->sender, senderStr, sizeof(noti_info->sender)-strlen(noti_info->sender));
+                               if (senderStr) {
+                                       free(senderStr);
+                                       senderStr = NULL;
+                               }
+                       } else {
+                               snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", addrInfo.addressVal);
                        }
-                       break;
 
-               case MSG_NOTI_TYPE_SIM :
-                       {
-                               char sqlQuery[MAX_QUERY_LEN+1];
-                               memset(sqlQuery, 0x00, sizeof(sqlQuery));
-
-                               snprintf(sqlQuery, sizeof(sqlQuery), "SELECT "
-                                               "A.ADDRESS_VAL, "
-                                               "B.DISPLAY_TIME, "
-                                               "B.MSG_ID, "
-                                               "B.MSG_TEXT, "
-                                               "(COUNT(CASE WHEN B.MAIN_TYPE = %d THEN 1 END)) AS SMS_UNREAD_CNT "
-                                               "FROM %s A, %s B "
-                                               "WHERE A.CONV_ID=B.CONV_ID "
-                                               "AND B.READ_STATUS=0 AND B.FOLDER_ID=%d "
-                                               "AND B.STORAGE_ID = %d "
-                                               "ORDER BY B.DISPLAY_TIME DESC;",
-                                               MSG_SMS_TYPE,
-                                               MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME,
-                                               MSG_INBOX_ID,
-                                               MSG_STORAGE_SIM);
-
-                               MSG_DEBUG("sqlQuery [%s]", sqlQuery);
-
-                               if (dbhandler->prepareQuery(sqlQuery) != MSG_SUCCESS)
-                                       return MSG_ERR_DB_PREPARE;
-
-                               if (dbhandler->stepQuery() == MSG_ERR_DB_ROW) {
-
-                                       noti_info->count = dbhandler->columnInt(4);
-
-                                       if (noti_info->count > 0) {
-                                               MSG_ADDRESS_INFO_S addrInfo;
-                                               memset(&addrInfo, 0x00, sizeof(MSG_ADDRESS_INFO_S));
-
-                                               if (dbhandler->columnText(0) != NULL)
-                                                       snprintf(addrInfo.addressVal, sizeof(addrInfo.addressVal), "%s", (char*)dbhandler->columnText(0));
-
-                                               MSG_CONTACT_INFO_S tmpContact;
-                                               memset(&tmpContact, 0x00, sizeof(MSG_CONTACT_INFO_S));
-
-                                               MsgGetContactInfo(&addrInfo, &tmpContact);
-
-                                               if (tmpContact.firstName[0] != '\0') {
-                                                       snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", tmpContact.firstName);
-                                               } else if (addrInfo.addressVal[0] == '\0') {
-                                                       char *senderStr = NULL;
-                                                       senderStr = getTranslateText(MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR, MSG_UNKNOWN_SENDER);
-                                                       g_strlcat(noti_info->sender, senderStr, sizeof(noti_info->sender)-strlen(noti_info->sender));
-                                                       if (senderStr) {
-                                                               free(senderStr);
-                                                               senderStr = NULL;
-                                                       }
-                                               } else {
-                                                       snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", addrInfo.addressVal);
-                                               }
+                       snprintf(noti_info->number, sizeof(noti_info->number), "%s", addrInfo.addressVal);
 
-                                               snprintf(noti_info->number, sizeof(noti_info->number), "%s", addrInfo.addressVal);
+                       noti_info->time = (time_t)dbhandler->columnInt(1);
 
-                                               noti_info->time = (time_t)dbhandler->columnInt(1);
+                       noti_info->msg_id = (msg_message_id_t)dbhandler->columnInt(2);
 
-                                               noti_info->msg_id = (msg_message_id_t)dbhandler->columnInt(2);
+                       snprintf(noti_info->text, sizeof(noti_info->text), "%s", (char*)dbhandler->columnText(3));
 
-                                               snprintf(noti_info->text, sizeof(noti_info->text), "%s", (char*)dbhandler->columnText(3));
+                       MSG_DEBUG("unread CB message [%d].", noti_info->msg_id);
+               } else {
+                       MSG_DEBUG("No unread CB message.");
+                       MSG_DEBUG("notiCbId [%d]", noti_info->id);
 
-                                               MSG_DEBUG("unread SIM message [%d].", noti_info->msg_id);
-                                       } else {
+                       dbhandler->finalizeQuery();
 
-                                               MSG_DEBUG("No unread SIM message.");
-                                               MSG_DEBUG("notiPrivId [%d]", noti_info->id);
+                       if (!isForInstantMessage) {
+                               /* No unread message. */
+                               if (noti_info->id > 0) {
+                                       noti_err = notification_delete_by_priv_id(NULL, NOTIFICATION_TYPE_NOTI, noti_info->id);
+                                       if (noti_err != NOTIFICATION_ERROR_NONE) {
+                                               MSG_DEBUG("Fail to notification_delete_by_priv_id : %d", noti_err);
+                                       }
+                               }
 
-                                               dbhandler->finalizeQuery();
+                               noti_info->id = 0;
 
-                                               if (!isForInstantMessage) {
-                                                       // No unread message.
-                                                       if (noti_info->id > 0) {
-                                                               noti_err = notification_delete_by_priv_id(MSG_DEFAULT_APP_ID, NOTIFICATION_TYPE_NOTI, noti_info->id);
-                                                               if (noti_err != NOTIFICATION_ERROR_NONE) {
-                                                                       MSG_DEBUG("Fail to notification_delete_by_priv_id : %d", noti_err);
-                                                               }
-                                                       }
+                               if (MsgSettingSetInt(CB_NOTI_PRIV_ID, noti_info->id) != MSG_SUCCESS)
+                                       MSG_DEBUG("MsgSettingSetInt fail : CB_NOTI_PRIV_ID");
+                       }
+                       return MSG_ERR_DB_STEP;
+               }
 
-                                                       noti_info->id = 0;
+               dbhandler->finalizeQuery();
 
-                                                       if (MsgSettingSetInt(SIM_MSG_NOTI_PRIV_ID, noti_info->id) != MSG_SUCCESS)
-                                                               MSG_DEBUG("MsgSettingSetInt fail : SIM_MSG_NOTI_PRIV_ID");
-                                               }
+               if (dbhandler->getTable(sqlQuery, &noti_info->count, NULL) != MSG_SUCCESS) {
+                       MSG_DEBUG("getTable is failed");
+                       dbhandler->freeTable();
+                       return MSG_ERR_DB_GETTABLE;
+               }
 
-                                               return MSG_ERR_DB_STEP;
+               dbhandler->freeTable();
+               MSG_DEBUG("notiCbId [%d], unreadCbMsgCnt [%d]", noti_info->id, noti_info->count);
+               break;
+       }
+       case MSG_NOTI_TYPE_SIM: {
+               char sqlQuery[MAX_QUERY_LEN+1];
+               memset(sqlQuery, 0x00, sizeof(sqlQuery));
+
+               snprintf(sqlQuery, sizeof(sqlQuery), "SELECT "
+                               "A.ADDRESS_VAL, "
+                               "B.DISPLAY_TIME, "
+                               "B.MSG_ID, "
+                               "B.MSG_TEXT, "
+                               "(COUNT(CASE WHEN B.MAIN_TYPE = %d THEN 1 END)) AS SMS_UNREAD_CNT "
+                               "FROM %s A, %s B "
+                               "WHERE A.CONV_ID=B.CONV_ID "
+                               "AND B.READ_STATUS=0 AND B.FOLDER_ID=%d "
+                               "AND B.STORAGE_ID = %d "
+                               "ORDER BY B.DISPLAY_TIME DESC;",
+                               MSG_SMS_TYPE,
+                               MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME,
+                               MSG_INBOX_ID,
+                               MSG_STORAGE_SIM);
+
+               MSG_DEBUG("sqlQuery [%s]", sqlQuery);
+
+               if (dbhandler->prepareQuery(sqlQuery) != MSG_SUCCESS)
+                       return MSG_ERR_DB_PREPARE;
+
+               if (dbhandler->stepQuery() == MSG_ERR_DB_ROW) {
+
+                       noti_info->count = dbhandler->columnInt(4);
+
+                       if (noti_info->count > 0) {
+                               MSG_ADDRESS_INFO_S addrInfo;
+                               memset(&addrInfo, 0x00, sizeof(MSG_ADDRESS_INFO_S));
+
+                               if (dbhandler->columnText(0) != NULL)
+                                       snprintf(addrInfo.addressVal, sizeof(addrInfo.addressVal), "%s", (char*)dbhandler->columnText(0));
+
+                               MSG_CONTACT_INFO_S tmpContact;
+                               memset(&tmpContact, 0x00, sizeof(MSG_CONTACT_INFO_S));
+
+                               MsgGetContactInfo(&addrInfo, &tmpContact);
+
+                               if (tmpContact.firstName[0] != '\0') {
+                                       snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", tmpContact.firstName);
+                               } else if (addrInfo.addressVal[0] == '\0') {
+                                       char *senderStr = NULL;
+                                       senderStr = getTranslateText(MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR, MSG_UNKNOWN_SENDER);
+                                       g_strlcat(noti_info->sender, senderStr, sizeof(noti_info->sender)-strlen(noti_info->sender));
+                                       if (senderStr) {
+                                               free(senderStr);
+                                               senderStr = NULL;
                                        }
                                } else {
-                                       MSG_DEBUG("sqlQuery [%s]", sqlQuery);
-                                       dbhandler->finalizeQuery();
-                                       return MSG_ERR_DB_STEP;
+                                       snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", addrInfo.addressVal);
                                }
 
-                               dbhandler->finalizeQuery();
-                       }
-                       break;
-#endif
-               case MSG_NOTI_TYPE_FAILED :
-                       {
-                               MSG_MAIN_TYPE_T mainType;
-                               char sqlQuery[MAX_QUERY_LEN+1];
-                               memset(sqlQuery, 0x00, sizeof(sqlQuery));
-
-                               snprintf(sqlQuery, sizeof(sqlQuery), "SELECT "
-                                               "A.ADDRESS_VAL, "
-                                               "B.DISPLAY_TIME, "
-                                               "B.MSG_ID, "
-                                               "B.MSG_TEXT, "
-                                               "B.SUBJECT, "
-                                               "B.MAIN_TYPE, "
-                                               "(COUNT(CASE WHEN B.NETWORK_STATUS = %d THEN 1 END)) AS SENT_FAILED_CNT "
-                                               "FROM %s A, %s B "
-                                               "WHERE A.CONV_ID=B.CONV_ID "
-                                               "AND B.READ_STATUS=0 AND B.FOLDER_ID=%d "
-                                               "AND B.STORAGE_ID = %d  "
-                                               "ORDER BY B.DISPLAY_TIME DESC;",
-                                               MSG_NETWORK_SEND_FAIL,
-                                               MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME,
-                                               MSG_OUTBOX_ID,
-                                               MSG_STORAGE_PHONE);
-
-                               MSG_DEBUG("sqlQuery [%s]", sqlQuery);
-
-                               if (dbhandler->prepareQuery(sqlQuery) != MSG_SUCCESS)
-                                       return MSG_ERR_DB_PREPARE;
-
-                               if (dbhandler->stepQuery() == MSG_ERR_DB_ROW) {
-
-                                       noti_info->count = dbhandler->columnInt(6);
-
-                                       if (noti_info->count > 0) {
-                                               MSG_ADDRESS_INFO_S addrInfo;
-                                               memset(&addrInfo, 0x00, sizeof(MSG_ADDRESS_INFO_S));
-
-                                               if (dbhandler->columnText(0) != NULL)
-                                                       snprintf(addrInfo.addressVal, sizeof(addrInfo.addressVal), "%s", (char*)dbhandler->columnText(0));
-
-                                               MSG_CONTACT_INFO_S tmpContact;
-                                               memset(&tmpContact, 0x00, sizeof(MSG_CONTACT_INFO_S));
-
-                                               MsgGetContactInfo(&addrInfo, &tmpContact);
-
-                                               if (tmpContact.firstName[0] != '\0') {
-                                                       snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", tmpContact.firstName);
-                                               } else if (addrInfo.addressVal[0] == '\0') {
-                                                       char *senderStr = NULL;
-                                                       senderStr = getTranslateText(MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR, MSG_UNKNOWN_SENDER);
-                                                       g_strlcat(noti_info->sender, senderStr, sizeof(noti_info->sender)-strlen(noti_info->sender));
-                                                       if (senderStr) {
-                                                               free(senderStr);
-                                                               senderStr = NULL;
-                                                       }
-                                               } else {
-                                                       snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", addrInfo.addressVal);
-                                               }
-
-                                               snprintf(noti_info->number, sizeof(noti_info->number), "%s", addrInfo.addressVal);
+                               snprintf(noti_info->number, sizeof(noti_info->number), "%s", addrInfo.addressVal);
 
-                                               noti_info->time = (time_t)dbhandler->columnInt(1);
+                               noti_info->time = (time_t)dbhandler->columnInt(1);
 
-                                               noti_info->msg_id = (msg_message_id_t)dbhandler->columnInt(2);
+                               noti_info->msg_id = (msg_message_id_t)dbhandler->columnInt(2);
 
-                                               mainType = (MSG_MAIN_TYPE_T)dbhandler->columnInt(5);
+                               snprintf(noti_info->text, sizeof(noti_info->text), "%s", (char*)dbhandler->columnText(3));
 
-                                               if (mainType == MSG_TYPE_MMS)
-                                                       snprintf(noti_info->text, sizeof(noti_info->text), "%s", (char*)dbhandler->columnText(4));
-                                               else
-                                                       snprintf(noti_info->text, sizeof(noti_info->text), "%s", (char*)dbhandler->columnText(3));
+                               MSG_DEBUG("unread SIM message [%d].", noti_info->msg_id);
+                       } else {
 
-                                               MSG_DEBUG("Sent failed message ID [%d].", noti_info->msg_id);
-                                       } else {
+                               MSG_DEBUG("No unread SIM message.");
+                               MSG_DEBUG("notiPrivId [%d]", noti_info->id);
 
-                                               MSG_DEBUG("No sent failed message.");
-                                               MSG_DEBUG("failedNotiId [%d]", noti_info->id);
+                               dbhandler->finalizeQuery();
 
-                                               dbhandler->finalizeQuery();
+                               if (!isForInstantMessage) {
+                                       /* No unread message. */
+                                       if (noti_info->id > 0) {
+                                               noti_err = notification_delete_by_priv_id(MSG_DEFAULT_APP_ID, NOTIFICATION_TYPE_NOTI, noti_info->id);
+                                               if (noti_err != NOTIFICATION_ERROR_NONE) {
+                                                       MSG_DEBUG("Fail to notification_delete_by_priv_id : %d", noti_err);
+                                               }
+                                       }
 
-                                               if (!isForInstantMessage) {
-                                                       // No unread message.
-                                                       if (noti_info->id > 0) {
-                                                               noti_err = notification_delete_by_priv_id(MSG_DEFAULT_APP_ID, NOTIFICATION_TYPE_NOTI, noti_info->id);
-                                                               if (noti_err != NOTIFICATION_ERROR_NONE) {
-                                                                       MSG_DEBUG("Fail to notification_delete_by_priv_id : %d", noti_err);
-                                                               }
-                                                       }
+                                       noti_info->id = 0;
 
-                                                       noti_info->id = 0;
+                                       if (MsgSettingSetInt(SIM_MSG_NOTI_PRIV_ID, noti_info->id) != MSG_SUCCESS)
+                                               MSG_DEBUG("MsgSettingSetInt fail : SIM_MSG_NOTI_PRIV_ID");
+                               }
 
-                                                       if (MsgSettingSetInt(MSG_SENTFAIL_NOTI_ID, noti_info->id) != MSG_SUCCESS)
-                                                               MSG_DEBUG("MsgSettingSetInt fail : MSG_SENTFAIL_NOTI_ID");
-                                               }
+                               return MSG_ERR_DB_STEP;
+                       }
+               } else {
+                       MSG_DEBUG("sqlQuery [%s]", sqlQuery);
+                       dbhandler->finalizeQuery();
+                       return MSG_ERR_DB_STEP;
+               }
 
-                                               return MSG_ERR_DB_STEP;
+               dbhandler->finalizeQuery();
+               break;
+       }
+#endif
+       case MSG_NOTI_TYPE_FAILED: {
+               MSG_MAIN_TYPE_T mainType;
+               char sqlQuery[MAX_QUERY_LEN+1];
+               memset(sqlQuery, 0x00, sizeof(sqlQuery));
+
+               snprintf(sqlQuery, sizeof(sqlQuery), "SELECT "
+                               "A.ADDRESS_VAL, "
+                               "B.DISPLAY_TIME, "
+                               "B.MSG_ID, "
+                               "B.MSG_TEXT, "
+                               "B.SUBJECT, "
+                               "B.MAIN_TYPE, "
+                               "(COUNT(CASE WHEN B.NETWORK_STATUS = %d THEN 1 END)) AS SENT_FAILED_CNT "
+                               "FROM %s A, %s B "
+                               "WHERE A.CONV_ID=B.CONV_ID "
+                               "AND B.READ_STATUS=0 AND B.FOLDER_ID=%d "
+                               "AND B.STORAGE_ID = %d "
+                               "ORDER BY B.DISPLAY_TIME DESC;",
+                               MSG_NETWORK_SEND_FAIL,
+                               MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME,
+                               MSG_OUTBOX_ID,
+                               MSG_STORAGE_PHONE);
+
+               MSG_DEBUG("sqlQuery [%s]", sqlQuery);
+
+               if (dbhandler->prepareQuery(sqlQuery) != MSG_SUCCESS)
+                       return MSG_ERR_DB_PREPARE;
+
+               if (dbhandler->stepQuery() == MSG_ERR_DB_ROW) {
+
+                       noti_info->count = dbhandler->columnInt(6);
+
+                       if (noti_info->count > 0) {
+                               MSG_ADDRESS_INFO_S addrInfo;
+                               memset(&addrInfo, 0x00, sizeof(MSG_ADDRESS_INFO_S));
+
+                               if (dbhandler->columnText(0) != NULL)
+                                       snprintf(addrInfo.addressVal, sizeof(addrInfo.addressVal), "%s", (char*)dbhandler->columnText(0));
+
+                               MSG_CONTACT_INFO_S tmpContact;
+                               memset(&tmpContact, 0x00, sizeof(MSG_CONTACT_INFO_S));
+
+                               MsgGetContactInfo(&addrInfo, &tmpContact);
+
+                               if (tmpContact.firstName[0] != '\0') {
+                                       snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", tmpContact.firstName);
+                               } else if (addrInfo.addressVal[0] == '\0') {
+                                       char *senderStr = NULL;
+                                       senderStr = getTranslateText(MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR, MSG_UNKNOWN_SENDER);
+                                       g_strlcat(noti_info->sender, senderStr, sizeof(noti_info->sender)-strlen(noti_info->sender));
+                                       if (senderStr) {
+                                               free(senderStr);
+                                               senderStr = NULL;
                                        }
                                } else {
-                                       MSG_DEBUG("sqlQuery [%s]", sqlQuery);
-                                       dbhandler->finalizeQuery();
-                                       return MSG_ERR_DB_STEP;
+                                       snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", addrInfo.addressVal);
                                }
 
-                               dbhandler->finalizeQuery();
-                       }
-                       break;
+                               snprintf(noti_info->number, sizeof(noti_info->number), "%s", addrInfo.addressVal);
 
-               case MSG_NOTI_TYPE_SIM_FULL :
-                       break;
+                               noti_info->time = (time_t)dbhandler->columnInt(1);
 
-               default:
-                       {
-                               MSG_DEBUG("No matching type [%d]", noti_info->type);
-                               return MSG_ERR_UNKNOWN;
-                       }
-                       break;
-       }
+                               noti_info->msg_id = (msg_message_id_t)dbhandler->columnInt(2);
 
-       MSG_END();
+                               mainType = (MSG_MAIN_TYPE_T)dbhandler->columnInt(5);
 
-       return MSG_SUCCESS;
-}
+                               if (mainType == MSG_TYPE_MMS)
+                                       snprintf(noti_info->text, sizeof(noti_info->text), "%s", (char*)dbhandler->columnText(4));
+                               else
+                                       snprintf(noti_info->text, sizeof(noti_info->text), "%s", (char*)dbhandler->columnText(3));
 
+                               MSG_DEBUG("Sent failed message ID [%d].", noti_info->msg_id);
+                       } else {
 
-void setFlashNoti(void)
-{
-       MSG_BEGIN();
+                               MSG_DEBUG("No sent failed message.");
+                               MSG_DEBUG("failedNotiId [%d]", noti_info->id);
+
+                               dbhandler->finalizeQuery();
 
-       int ret = 0;
+                               if (!isForInstantMessage) {
+                                       /* No unread message. */
+                                       if (noti_info->id > 0) {
+                                               noti_err = notification_delete_by_priv_id(MSG_DEFAULT_APP_ID, NOTIFICATION_TYPE_NOTI, noti_info->id);
+                                               if (noti_err != NOTIFICATION_ERROR_NONE) {
+                                                       MSG_DEBUG("Fail to notification_delete_by_priv_id : %d", noti_err);
+                                               }
+                                       }
 
-       if (!bFeedbackInit) {
-               int ret = feedback_initialize();
+                                       noti_info->id = 0;
 
-               if (ret != FEEDBACK_ERROR_NONE) {
-                       MSG_DEBUG("Fail to feedback_initialize : [%d]", ret);
-                       bFeedbackInit = false;
-                       return;
+                                       if (MsgSettingSetInt(MSG_SENTFAIL_NOTI_ID, noti_info->id) != MSG_SUCCESS)
+                                               MSG_DEBUG("MsgSettingSetInt fail : MSG_SENTFAIL_NOTI_ID");
+                               }
+
+                               return MSG_ERR_DB_STEP;
+                       }
                } else {
-                       MSG_DEBUG("Success to feedback_initialize.");
-                       bFeedbackInit = true;
+                       MSG_DEBUG("sqlQuery [%s]", sqlQuery);
+                       dbhandler->finalizeQuery();
+                       return MSG_ERR_DB_STEP;
                }
-       }
 
-       ret = feedback_play_type(FEEDBACK_TYPE_LED, FEEDBACK_PATTERN_MESSAGE);
-       if (ret != FEEDBACK_ERROR_NONE)
-               MSG_DEBUG("Fail to feedback_play_type");
+               dbhandler->finalizeQuery();
+               break;
+       }
+       case MSG_NOTI_TYPE_SIM_FULL:
+               break;
+       default: {
+               MSG_DEBUG("No matching type [%d]", noti_info->type);
+               return MSG_ERR_UNKNOWN;
+       }
+       }
 
        MSG_END();
+
+       return MSG_SUCCESS;
 }
 
 
@@ -2709,6 +2993,17 @@ void setNotiVibration(notification_h noti_h, notification_vibration_type_e type,
 }
 
 
+void setNotiEventHandler(notification_h noti_h, notification_event_type_e type, app_control_h event_handler)
+{
+       int noti_err = NOTIFICATION_ERROR_NONE;
+
+       noti_err = notification_set_event_handler(noti_h, type, event_handler);
+
+       if (noti_err != NOTIFICATION_ERROR_NONE)
+               MSG_DEBUG("notification_set_event_handler() was failed. [%d]", noti_err);
+}
+
+
 char *getTranslateText(const char *pkg_name, const char *locale_dir, const char *text)
 {
        char *notiMsg = NULL;
@@ -2734,7 +3029,7 @@ void MsgNotiSoundRepeatAlarmCB(int alarmId)
 {
        MSG_BEGIN();
 
-       MsgRefreshNotification(MSG_NOTI_TYPE_NORMAL, true, true);
+       MsgRefreshNotification(MSG_NOTI_TYPE_NORMAL, true, MSG_ACTIVE_NOTI_TYPE_ACTIVE);
 
 #ifndef MSG_NOTI_INTEGRATION
        MsgRefreshNotification(MSG_NOTI_TYPE_SIM, true, true);
@@ -2781,27 +3076,22 @@ void MsgSoundSetRepeatAlarm()
 
        nRepeatValue = MsgSettingGetInt(MSG_ALERT_REP_TYPE);
 
-       switch (nRepeatValue)
-       {
-               case MSG_ALERT_TONE_ONCE:
-                       nRepeatTime = 0;
-                       break;
-
-               case MSG_ALERT_TONE_2MINS:
-                       nRepeatTime = 2;
-                       break;
-
-               case MSG_ALERT_TONE_5MINS:
-                       nRepeatTime = 5;
-                       break;
-
-               case MSG_ALERT_TONE_10MINS:
-                       nRepeatTime = 10;
-                       break;
-
-               default:
-                       MSG_DEBUG("Invalid Repetition time");
-                       break;
+       switch (nRepeatValue) {
+       case MSG_ALERT_TONE_ONCE:
+               nRepeatTime = 0;
+               break;
+       case MSG_ALERT_TONE_2MINS:
+               nRepeatTime = 2;
+               break;
+       case MSG_ALERT_TONE_5MINS:
+               nRepeatTime = 5;
+               break;
+       case MSG_ALERT_TONE_10MINS:
+               nRepeatTime = 10;
+               break;
+       default:
+               MSG_DEBUG("Invalid Repetition time");
+               break;
        }
 
        MSG_DEBUG("nRepeatTime = %d", nRepeatTime);
@@ -2837,3 +3127,5 @@ void sendMsgReplyPopup(MSG_NOTI_INFO_S *noti_info)
                app_control_destroy(svc_h);
        }
 }
+
+#endif /* MSG_WEARABLE_PROFILE */
index 1dc502d..75e4547 100755 (executable)
 #include "MsgGconfWrapper.h"
 #include "MsgSensorWrapper.h"
 
+#ifndef MSG_WEARABLE_PROFILE
 #include <sensor_internal.h>
 
 /*==================================================================================================
                                      VARIABLES
 ==================================================================================================*/
+
 int sensorHandler = -1;
 
 msg_sensor_cb SensorCBFunction = NULL;
 
+#endif /* MSG_WEARABLE_PROFILE */
+
 /*==================================================================================================
                                      FUNCTION IMPLEMENTATION
 ==================================================================================================*/
 
+#ifndef MSG_WEARABLE_PROFILE
+
 void MsgSensorCB(unsigned int event_type, sensor_event_data_t *event_data , void *data)
 {
        int *my_event_data;
 
        my_event_data = (int *)(event_data->event_data);
 
-       if (event_type == MOTION_ENGINE_EVENT_TOP_TO_BOTTOM)
-               if(*my_event_data == MOTION_ENGIEN_TOP_TO_BOTTOM_DETECTION) {
+       if (event_type == MOTION_ENGINE_EVENT_TOP_TO_BOTTOM) {
+               if (*my_event_data == MOTION_ENGIEN_TOP_TO_BOTTOM_DETECTION) {
                        MSG_DEBUG("top to bottom event detected.");
-                       if(MsgSettingGetInt(VCONFKEY_SETAPPL_MOTION_ACTIVATION))
-                               if(MsgSettingGetInt(VCONFKEY_SETAPPL_USE_TURN_OVER)) {
-                                       if(SensorCBFunction) SensorCBFunction();
+                       if (MsgSettingGetInt(VCONFKEY_SETAPPL_MOTION_ACTIVATION)) {
+                               if (MsgSettingGetInt(VCONFKEY_SETAPPL_USE_TURN_OVER)) {
+                                       if (SensorCBFunction)
+                                               SensorCBFunction();
                                }
+                       }
                }
+       }
 }
 
+#endif /* MSG_WEARABLE_PROFILE */
 
 msg_error_t MsgSensorConnect()
 {
+
+#ifndef MSG_WEARABLE_PROFILE
+
        sensorHandler = sf_connect(MOTION_SENSOR);
        if (sensorHandler < 0) {
                MSG_DEBUG("sensor attach fail.");
                return MSG_ERR_UNKNOWN;
        }
 
+#endif /* MSG_WEARABLE_PROFILE */
+
        return MSG_SUCCESS;
 }
 
 
 void MsgSensorDisconnect()
 {
-       if(SensorCBFunction != NULL)
+
+#ifndef MSG_WEARABLE_PROFILE
+
+       if (SensorCBFunction != NULL)
                SensorCBFunction = NULL;
 
        if (sensorHandler < 0)
                return;
 
-       try
-       {
+       try {
                sf_stop(sensorHandler);
-       }
-       catch(int exception)
-       {
+       } catch (int exception) {
                MSG_FATAL("sf_stop error[%d]", exception);
        }
        sf_disconnect(sensorHandler);
+
+#endif /* MSG_WEARABLE_PROFILE */
+
 }
 
 
 msg_error_t MsgRegSensorCB(msg_sensor_cb cb)
 {
+
+#ifndef MSG_WEARABLE_PROFILE
+
        int resultCondition = -1;
 
        if (sensorHandler < 0) {
@@ -91,8 +112,8 @@ msg_error_t MsgRegSensorCB(msg_sensor_cb cb)
                return MSG_ERR_UNKNOWN;
        }
 
-       if(cb != NULL) {
-               // regist cb.
+       if (cb != NULL) {
+               /* regist cb. */
                SensorCBFunction = cb;
        } else {
                MSG_DEBUG("cb is NULL.");
@@ -111,6 +132,6 @@ msg_error_t MsgRegSensorCB(msg_sensor_cb cb)
                MSG_DEBUG("SLP_sensor_start fail.");
                return MSG_ERR_UNKNOWN;
        }
-
+#endif /* MSG_WEARABLE_PROFILE */
        return MSG_SUCCESS;
 }
index 784f4e9..9aa267c 100755 (executable)
@@ -16,6 +16,7 @@
 
 #include <wait.h>
 
+#include "MsgCallStatusManager.h"
 #include "MsgDebug.h"
 #include "MsgCppTypes.h"
 #include "MsgGconfWrapper.h"
 #include "MsgNotificationWrapper.h"
 #include "MsgSoundPlayer.h"
 
+#ifndef MSG_WEARABLE_PROFILE
+
 #include <mm_error.h>
 #include <mm_player.h>
 #include <mm_session_private.h>
 #include <mm_sound.h>
 
 #include <feedback.h>
+#include <feedback-internal.h>
+#include <feedback-ids-mobile.h>
 
 /*==================================================================================================
                                     DEFINES
 ==================================================================================================*/
 #define MAX_SOUND_FILE_LEN 1024
 
-#define DEFAULT_ALERT_FILE             "/opt/usr/share/settings/Alerts/notification_sdk.wav"
+#define DEFAULT_ALERT_FILE             "/opt/usr/share/settings/Alerts/Whistle.ogg"
 
 #define HAPTIC_TEST_ITERATION 1
 #define MSG_VIBRATION_INTERVAL 3000
@@ -55,6 +60,8 @@ MMHandleType hPlayerHandle = 0;
 
 pthread_mutex_t muMmPlay = PTHREAD_MUTEX_INITIALIZER;
 
+#endif /* MSG_WEARABLE_PROFILE */
+
 /*==================================================================================================
                                      IMPLEMENTATION OF Functions
 ==================================================================================================*/
@@ -62,8 +69,12 @@ void MsgSoundRepeatAlarmCB(int alarmId)
 {
        MSG_BEGIN();
 
+#ifndef MSG_WEARABLE_PROFILE
+
        MsgSoundPlayer::instance()->MsgSoundInitRepeatAlarm();
 
+#endif /* MSG_WEARABLE_PROFILE */
+
        MSG_END();
        return;
 }
@@ -73,12 +84,14 @@ void MsgSensorCBStop()
 {
        MSG_BEGIN();
 
+#ifndef MSG_WEARABLE_PROFILE
+
 #if 0
        MsgSoundPlayer::instance()->MsgSoundPlayStop();
 #else
        MsgDeleteNotification(MSG_NOTI_TYPE_ALL, -1);
 
-       MsgRefreshNotification(MSG_NOTI_TYPE_ALL, false, false);
+       MsgRefreshNotification(MSG_NOTI_TYPE_ALL, false, MSG_ACTIVE_NOTI_TYPE_NONE);
 
 #ifndef MSG_NOTI_INTEGRATION
        MsgRefreshNotification(MSG_NOTI_TYPE_SIM, false, false);
@@ -86,46 +99,51 @@ void MsgSensorCBStop()
 
 #endif
 
+#endif /* MSG_WEARABLE_PROFILE */
+
        MSG_END();
 }
 
+/*
+static gboolean MsgSoundMelodyTimeout(gpointer data)
+{
+       MSG_BEGIN();
 
-//static gboolean MsgSoundMelodyTimeout(gpointer data)
-//{
-//     MSG_BEGIN();
-//
-//     MsgSoundPlayer::instance()->MsgSoundPlayStop();
-//
-//     MSG_END();
-//
-//     return FALSE;
-//}
+       MsgSoundPlayer::instance()->MsgSoundPlayStop();
 
+       MSG_END();
+
+       return FALSE;
+}
+*/
 
 static int MsgSoundPlayCallback(int message, void *param, void *user_param)
 {
-       switch (message)
-       {
-               case MM_MESSAGE_BEGIN_OF_STREAM:
-                       MSG_DEBUG("Play is started.");
-                       break;
-               case MM_MESSAGE_END_OF_STREAM:
-               case MM_MESSAGE_STATE_INTERRUPTED:
-                       MSG_DEBUG("EOS or Interrupted.");
-                       MsgSoundPlayer::instance()->MsgSoundPlayStop();
-                       break;
-               case MM_MESSAGE_FILE_NOT_SUPPORTED:
-               case MM_MESSAGE_FILE_NOT_FOUND:
-               case MM_MESSAGE_DRM_NOT_AUTHORIZED:
-               case MM_MESSAGE_ERROR:
-                       MSG_DEBUG("message [%d] & play with default", message);
-                       MsgSoundPlayer::instance()->MsgSoundPlayStart(NULL, MSG_SOUND_PLAY_DEFAULT);
-                       break;
-               default:
-                       MSG_DEBUG("message [%d]", message);
-                       break;
+
+#ifndef MSG_WEARABLE_PROFILE
+       switch (message) {
+       case MM_MESSAGE_BEGIN_OF_STREAM:
+               MSG_DEBUG("Play is started.");
+               break;
+       case MM_MESSAGE_END_OF_STREAM:
+       case MM_MESSAGE_STATE_INTERRUPTED:
+               MSG_DEBUG("EOS or Interrupted.");
+               MsgSoundPlayer::instance()->MsgSoundPlayStop();
+               break;
+       case MM_MESSAGE_FILE_NOT_SUPPORTED:
+       case MM_MESSAGE_FILE_NOT_FOUND:
+       case MM_MESSAGE_DRM_NOT_AUTHORIZED:
+       case MM_MESSAGE_ERROR:
+               MSG_DEBUG("message [%d] & play with default", message);
+               MsgSoundPlayer::instance()->MsgSoundPlayStart(NULL, MSG_SOUND_PLAY_DEFAULT);
+               break;
+       default:
+               MSG_DEBUG("message [%d]", message);
+               break;
        }
 
+#endif /* MSG_WEARABLE_PROFILE */
+
        return 1;
 }
 
@@ -137,6 +155,8 @@ MsgSoundPlayer* MsgSoundPlayer::pInstance = NULL;
 
 MsgSoundPlayer::MsgSoundPlayer()
 {
+
+#ifndef MSG_WEARABLE_PROFILE
        bPlaying = false;
        bVibrating = false;
        bFeedbackInit = false;
@@ -160,6 +180,8 @@ MsgSoundPlayer::MsgSoundPlayer()
        } else {
                MSG_DEBUG("Fail to MsgSensorConnect.");
        }
+#endif /* MSG_WEARABLE_PROFILE */
+
 }
 
 
@@ -182,6 +204,7 @@ MsgSoundPlayer* MsgSoundPlayer::instance()
 
 void MsgSoundPlayer::MsgGetRingtonePath(char *userRingtonePath, char **msg_tone_file_path_p)
 {
+#ifndef MSG_WEARABLE_PROFILE
        MSG_RINGTONE_TYPE_T ringtoneType = (MSG_RINGTONE_TYPE_T)MsgSettingGetInt(MSG_SETTING_RINGTONE_TYPE);
 
        MSG_DEBUG("Ringtone type = [%d]", ringtoneType);
@@ -209,8 +232,8 @@ void MsgSoundPlayer::MsgGetRingtonePath(char *userRingtonePath, char **msg_tone_
 
        memset(msg_tone_file_path, 0x00, sizeof(char)*(MSG_FILEPATH_LEN_MAX+1));
 
-       if ((tmpFilePath == NULL || MsgGetFileSize(tmpFilePath) < 1) || // wrong ringtone file path
-                       (MsgDrmIsDrmFile(tmpFilePath) && !MsgDrmCheckRingtone(tmpFilePath))) { // check DRM
+       if ((tmpFilePath == NULL || MsgGetFileSize(tmpFilePath) < 1) || /* wrong ringtone file path */
+                       (MsgDrmIsDrmFile(tmpFilePath) && !MsgDrmCheckRingtone(tmpFilePath))) { /* check DRM */
                if (tmpFilePath && (strcmp(tmpFilePath, "silent") == 0)) {
                        MSG_DEBUG("Set ringtone to NONE(Silent)");
                        msg_tone_file_path = NULL;
@@ -227,12 +250,17 @@ void MsgSoundPlayer::MsgGetRingtonePath(char *userRingtonePath, char **msg_tone_
                free(tmpFilePath);
                tmpFilePath = NULL;
        }
+#endif /* MSG_WEARABLE_PROFILE */
+
 }
 
 
 bool MsgIsSoundPlayOnCall(void)
 {
        bool bPlayOnCall = false;
+
+#ifndef MSG_WEARABLE_PROFILE
+
        int err = MM_ERROR_NONE;
 
        mm_sound_device_in soundIn = MM_SOUND_DEVICE_IN_NONE;
@@ -251,6 +279,8 @@ bool MsgIsSoundPlayOnCall(void)
                MSG_DEBUG("mm_sound_get_active_device() err=[%d]", err);
        }
 
+#endif /* MSG_WEARABLE_PROFILE */
+
        return bPlayOnCall;
 }
 
@@ -259,6 +289,8 @@ void MsgSoundPlayer::MsgGetPlayStatus(bool bVoiceMail, bool *bPlaySound, bool *b
 {
        MSG_BEGIN();
 
+#ifndef MSG_WEARABLE_PROFILE
+
        if (!bPlaySound || !bPlayVibration || !bOnCall) {
                MSG_DEBUG("IN parameter is NULL.");
                return;
@@ -269,17 +301,17 @@ void MsgSoundPlayer::MsgGetPlayStatus(bool bVoiceMail, bool *bPlaySound, bool *b
        *bOnCall = false;
 
        /* Global setting */
-       bool bSoundOn = false; // sound setting on notification panel
-       bool bVibrationOn = false; // vibration setting on notification panel
+       bool bSoundOn = false; /* sound setting on notification panel */
+       bool bVibrationOn = false; /* vibration setting on notification panel */
 
        /* Alert setting */
-#if 0  //not used value
-       bool bNotiVibrationOn = false; // alert vibration
+#if 0  /* not used value */
+       bool bNotiVibrationOn = false; /* alert vibration */
        MsgSettingGetBool(VCONFKEY_SETAPPL_VIBRATE_WHEN_NOTIFICATION_BOOL, &bNotiVibrationOn);
 #endif
 
-       bool bMsgSettingNoti = true; // Alert for message notification
-       bool bMsgSettingVibration = false; // vibration for message notification
+       bool bMsgSettingNoti = true; /* Alert for message notification */
+       bool bMsgSettingVibration = false; /* vibration for message notification */
 
        MsgSettingGetBool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &bSoundOn);
        MsgSettingGetBool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &bVibrationOn);
@@ -291,24 +323,24 @@ void MsgSoundPlayer::MsgGetPlayStatus(bool bVoiceMail, bool *bPlaySound, bool *b
        MSG_SEC_DEBUG("Msg Setting : Noti Alert=[%d], With vibration=[%d]", bMsgSettingNoti, bMsgSettingVibration);
 
        int callStatus = 0;
-       int alertOnCall = 0;
+/*     int alertOnCall = 0; */
 
-       callStatus = MsgSettingGetInt(VCONFKEY_CALL_STATE);
+       callStatus = MsgGetCallStatus();
        MSG_DEBUG("Call Status [%d]", callStatus);
 
        /* Check call status */
-       if (callStatus > VCONFKEY_CALL_OFF && callStatus < VCONFKEY_CALL_STATE_MAX) {
+       if (callStatus > 0 && callStatus < 3) {
                /* 1. On Call */
 
-               *bOnCall = true; // set call status;
-
+               *bOnCall = true; /* set call status; */
+#if 0
                alertOnCall = MsgSettingGetInt(VCONFKEY_CISSAPPL_ALERT_ON_CALL_INT);
                MSG_DEBUG("Alert On Call [%d]", alertOnCall);
 
                if (alertOnCall == 0) {
                        MSG_DEBUG("Call is active & Alert on Call - Off");
                } else if (alertOnCall == 1) {
-                       /* set default value to true, while on Call  alert sound to be played  and vibration to be off. */
+                       /* set default value to true, while on Call alert sound to be played and vibration to be off. */
                        bool bPlayOnCall = true;
 
                        if (!bSoundOn) {
@@ -338,11 +370,11 @@ void MsgSoundPlayer::MsgGetPlayStatus(bool bVoiceMail, bool *bPlaySound, bool *b
                                }
                        }
                }
+#endif
        } else {
                /* 2. Call is not active */
 
                MSG_DEBUG("Call is not active.");
-               int voiceRecording = MsgSettingGetInt(VCONFKEY_VOICERECORDER_STATE);
 
                if (bVoiceMail) {       /* 2-1. Voice message */
                        if (bMsgSettingNoti) {
@@ -361,22 +393,18 @@ void MsgSoundPlayer::MsgGetPlayStatus(bool bVoiceMail, bool *bPlaySound, bool *b
                        }
                } else {        /* 2-1. Normal message */
                        if (bMsgSettingNoti) {
-                               if (voiceRecording != VCONFKEY_VOICERECORDER_RECORDING) {
-                                       if (bSoundOn) {
-                                               MSG_DEBUG("Play sound.");
-                                               *bPlaySound = true;
-                                       } else {
-                                               MSG_DEBUG("It doesn't play vibration.");
-                                       }
+                               if (bSoundOn) {
+                                       MSG_DEBUG("Play sound.");
+                                       *bPlaySound = true;
+                               } else {
+                                       MSG_DEBUG("It doesn't play vibration.");
+                               }
 
-                                       if ((bSoundOn || bVibrationOn) && bMsgSettingVibration) {
-                                               MSG_DEBUG("Play vibration.");
-                                               *bPlayVibration = true;
-                                       } else {
-                                               MSG_DEBUG("It doesn't play vibration.");
-                                       }
+                               if ((bSoundOn || bVibrationOn) && bMsgSettingVibration) {
+                                       MSG_DEBUG("Play vibration.");
+                                       *bPlayVibration = true;
                                } else {
-                                       MSG_DEBUG("It doesn't play sound/vibration.");
+                                       MSG_DEBUG("It doesn't play vibration.");
                                }
                        } else {
                                MSG_DEBUG("It doesn't play sound/vibration.");
@@ -384,6 +412,8 @@ void MsgSoundPlayer::MsgGetPlayStatus(bool bVoiceMail, bool *bPlaySound, bool *b
                }
        }
 
+#endif /* MSG_WEARABLE_PROFILE */
+
        MSG_END();
 }
 
@@ -391,10 +421,13 @@ void MsgSoundPlayer::MsgGetPlayStatus(bool bVoiceMail, bool *bPlaySound, bool *b
 void MsgSoundPlayer::MsgSoundPlayStart(const MSG_ADDRESS_INFO_S *pAddrInfo, MSG_SOUND_TYPE_T soundType)
 {
        MSG_BEGIN();
+
+#ifndef MSG_WEARABLE_PROFILE
+
        MSG_DEBUG("soundType [%d]", soundType);
 
        /* check camera state */
-       int cameraState = 0;    // camera recording state
+       int cameraState = 0;    /* camera recording state */
        cameraState = MsgSettingGetInt(VCONFKEY_CAMERA_STATE);
        MSG_SEC_DEBUG("Camera state [%d]", cameraState);
 
@@ -407,8 +440,8 @@ void MsgSoundPlayer::MsgSoundPlayStart(const MSG_ADDRESS_INFO_S *pAddrInfo, MSG_
        MSG_CONTACT_INFO_S contactInfo;
        memset(&contactInfo, 0x00, sizeof(MSG_CONTACT_INFO_S));
 
-       if(pAddrInfo) {
-               // Get Contact Info
+       if (pAddrInfo) {
+               /* Get Contact Info */
                if (MsgGetContactInfo(pAddrInfo, &contactInfo) != MSG_SUCCESS) {
                        MSG_DEBUG("MsgGetContactInfo() fail.");
                }
@@ -439,7 +472,7 @@ void MsgSoundPlayer::MsgSoundPlayStart(const MSG_ADDRESS_INFO_S *pAddrInfo, MSG_
 
        MsgGetPlayStatus(bVoiceMsg, &bPlaySound, &bPlayVibration, &bOnCall);
 
-       MSG_SEC_DEBUG("sound=[%d], vibration=[%d], voice_msg?[%d], on_call?[%d]", \
+       MSG_SEC_DEBUG("sound=[%d], vibration=[%d], voice_msg?[%d], on_call?[%d]",
                        bPlaySound, bPlayVibration, bVoiceMsg, bOnCall);
 
        /* play sound */
@@ -472,8 +505,10 @@ void MsgSoundPlayer::MsgSoundPlayStart(const MSG_ADDRESS_INFO_S *pAddrInfo, MSG_
                MsgSoundPlayVibration(contactInfo.vibrationPath, bOnCall);
        }
 
-       // For repeatition.
-//     MsgSoundSetRepeatAlarm();
+       /* For repeatition. */
+/*     MsgSoundSetRepeatAlarm(); */
+
+#endif /* MSG_WEARABLE_PROFILE */
 
        MSG_END();
 }
@@ -483,6 +518,8 @@ void MsgSoundPlayer::MsgSoundPlayStop()
 {
        MSG_BEGIN();
 
+#ifndef MSG_WEARABLE_PROFILE
+
        pthread_mutex_lock(&muMmPlay);
 
        if (bPlaying == true && hPlayerHandle != 0 ) {
@@ -490,10 +527,8 @@ void MsgSoundPlayer::MsgSoundPlayStop()
                /* Stop playing media contents */
                int err = mm_player_stop(hPlayerHandle);
 
-               if (err != MM_ERROR_NONE) {
+               if (err != MM_ERROR_NONE)
                        MSG_DEBUG("stopping the player handle failed");
-               }
-
        }
 
        if (hPlayerHandle != 0) {
@@ -510,13 +545,15 @@ void MsgSoundPlayer::MsgSoundPlayStop()
        bPlaying = false;
 
        pthread_mutex_unlock(&muMmPlay);
-
+#endif /* MSG_WEARABLE_PROFILE */
        MSG_END();
 }
 
 
 void MsgSoundPlayer::MsgSoundPlayMelody(char *pMsgToneFilePath)
 {
+#ifndef MSG_WEARABLE_PROFILE
+
        int err = MM_ERROR_NONE;
 
        if (!pMsgToneFilePath) {
@@ -552,9 +589,8 @@ void MsgSoundPlayer::MsgSoundPlayMelody(char *pMsgToneFilePath)
                                "sound_priority", 2,
                                NULL);
 
-               if (err != MM_ERROR_NONE) {
+               if (err != MM_ERROR_NONE)
                        MSG_DEBUG("error setting the profile attr [%d]", err);
-               }
 
                err = mm_player_realize(hPlayerHandle);
 
@@ -566,7 +602,7 @@ void MsgSoundPlayer::MsgSoundPlayMelody(char *pMsgToneFilePath)
                                return;
                        }
                }
-       } while(err != MM_ERROR_NONE);
+       } while (err != MM_ERROR_NONE);
 
 
        pthread_mutex_lock(&muMmPlay);
@@ -577,21 +613,21 @@ void MsgSoundPlayer::MsgSoundPlayMelody(char *pMsgToneFilePath)
                MSG_DEBUG("mm_player_start, FAIL [%x]", err);
        } else {
                /* Add Timer to stop playing after 5 sec. */
-//             int g_contact_timer = -1;
-//             g_contact_timer = g_timeout_add(MSG_SOUND_TIMEOUT, (GSourceFunc)MsgSoundMelodyTimeout, NULL);
-
+               /*
+               int g_contact_timer = -1;
+               g_contact_timer = g_timeout_add(MSG_SOUND_TIMEOUT, (GSourceFunc)MsgSoundMelodyTimeout, NULL);
+               */
                bPlaying = true;
        }
        pthread_mutex_unlock(&muMmPlay);
-
-       return;
+#endif /* MSG_WEARABLE_PROFILE */
 }
 
 
 void MsgSoundPlayer::MsgSoundPlayVibration(char *vibrationPath, bool isOnCall)
 {
        MSG_BEGIN();
-
+#ifndef MSG_WEARABLE_PROFILE
        int ret = 0;
 
        if (!bFeedbackInit) {
@@ -607,8 +643,7 @@ void MsgSoundPlayer::MsgSoundPlayVibration(char *vibrationPath, bool isOnCall)
                }
        }
 
-       if(vibrationPath && strlen(vibrationPath))
-       {
+       if (vibrationPath && strlen(vibrationPath)) {
                MSG_DEBUG("vibrationPath: [%s]", vibrationPath);
                ret = feedback_set_resource_path(FEEDBACK_TYPE_VIBRATION, FEEDBACK_PATTERN_MESSAGE, vibrationPath);
                if (ret != FEEDBACK_ERROR_NONE)
@@ -617,13 +652,10 @@ void MsgSoundPlayer::MsgSoundPlayVibration(char *vibrationPath, bool isOnCall)
 
                if (ret != FEEDBACK_ERROR_NONE)
                        MSG_DEBUG("Fail to feedback_play_type");
-       }
-       else
-       {
-               if (isOnCall)
-                       ret = feedback_play_type(FEEDBACK_TYPE_VIBRATION, FEEDBACK_PATTERN_MESSAGE_ON_CALL);
-               else
-               {
+       } else {
+               if (isOnCall) {
+                       ret = feedback_play_type(FEEDBACK_TYPE_VIBRATION, (feedback_pattern_e)FEEDBACK_PATTERN_MOBILE_MESSAGE_ON_CALL);
+               } else {
                        ret = feedback_set_resource_path(FEEDBACK_TYPE_VIBRATION, FEEDBACK_PATTERN_MESSAGE, NULL);
                        if (ret != FEEDBACK_ERROR_NONE)
                                MSG_DEBUG("Fail to feedback_set_resource_path");
@@ -634,6 +666,8 @@ void MsgSoundPlayer::MsgSoundPlayVibration(char *vibrationPath, bool isOnCall)
                        MSG_DEBUG("Fail to feedback_play_type");
        }
 
+#endif /* MSG_WEARABLE_PROFILE */
+
        MSG_END();
 }
 
@@ -641,48 +675,53 @@ void MsgSoundPlayer::MsgSoundPlayDtmf()
 {
        MSG_BEGIN();
 
+#ifndef MSG_WEARABLE_PROFILE
+
        int ret = 0;
        int hToneHandle = 0;
 
        ret = mm_sound_play_tone(MM_SOUND_TONE_PROP_BEEP2, VOLUME_TYPE_SYSTEM, 1.0, 300, &hToneHandle);
 
-       if(ret < 0) {
+       if (ret < 0) {
                MSG_DEBUG("play tone failed.");
        } else {
                MSG_DEBUG("play tone success.");
        }
 
+#endif /* MSG_WEARABLE_PROFILE */
+
        MSG_END();
 }
 
 
 void MsgSoundPlayer::MsgSoundSetRepeatAlarm()
 {
+#ifndef MSG_WEARABLE_PROFILE
+
        int nRepeatValue = 0;
        long    nRepeatTime = 0;
 
        nRepeatValue = MsgSettingGetInt(MSG_ALERT_REP_TYPE);
 
-       switch (nRepeatValue)
-       {
-               case MSG_ALERT_TONE_ONCE:
-                       nRepeatTime = 0;
+       switch (nRepeatValue) {
+       case MSG_ALERT_TONE_ONCE:
+               nRepeatTime = 0;
                break;
 
-               case MSG_ALERT_TONE_2MINS:
-                       nRepeatTime = 2;
+       case MSG_ALERT_TONE_2MINS:
+               nRepeatTime = 2;
                break;
 
-               case MSG_ALERT_TONE_5MINS:
-                       nRepeatTime = 5;
+       case MSG_ALERT_TONE_5MINS:
+               nRepeatTime = 5;
                break;
 
-               case MSG_ALERT_TONE_10MINS:
-                       nRepeatTime = 10;
+       case MSG_ALERT_TONE_10MINS:
+               nRepeatTime = 10;
                break;
 
-               default:
-                       MSG_DEBUG("Invalid Repetition time");
+       default:
+               MSG_DEBUG("Invalid Repetition time");
                break;
        }
 
@@ -690,15 +729,13 @@ void MsgSoundPlayer::MsgSoundSetRepeatAlarm()
 
        if (nRepeatTime > 0) {
                if (g_alarmId > 0) {
-                       if (MsgAlarmRemove(g_alarmId) != MSG_SUCCESS) {
+                       if (MsgAlarmRemove(g_alarmId) != MSG_SUCCESS)
                                MSG_FATAL("MsgAlarmRemove fail.");
-                       }
                        g_alarmId = 0;
                }
                MsgSoundCreateRepeatAlarm(nRepeatTime);
        }
-
-       return;
+#endif /* MSG_WEARABLE_PROFILE */
 }
 
 
@@ -706,6 +743,8 @@ void MsgSoundPlayer::MsgSoundCreateRepeatAlarm(int RepeatTime)
 {
        MSG_BEGIN();
 
+#ifndef MSG_WEARABLE_PROFILE
+
        int alarmId = 0;
        time_t tmp_time;
        struct tm repeat_tm;
@@ -726,7 +765,7 @@ void MsgSoundPlayer::MsgSoundCreateRepeatAlarm(int RepeatTime)
 
        MSG_END();
 
-       return;
+#endif /* MSG_WEARABLE_PROFILE */
 }
 
 
@@ -734,21 +773,23 @@ int MsgSoundPlayer::MsgSoundGetUnreadMsgCnt()
 {
        int unreadCnt = 0;
 
-       // Get SMS Count
+#ifndef MSG_WEARABLE_PROFILE
+
+       /* Get SMS Count */
        unreadCnt = MsgSettingGetInt(VCONFKEY_MESSAGE_RECV_SMS_STATE);
 
-       // Get MMS Count
+       /* Get MMS Count */
        unreadCnt += MsgSettingGetInt(VCONFKEY_MESSAGE_RECV_MMS_STATE);
 
        MSG_DEBUG("unread count : [%d]", unreadCnt);
-
+#endif /* MSG_WEARABLE_PROFILE */
        return unreadCnt;
 }
 
 void MsgSoundPlayer::MsgSoundInitRepeatAlarm()
 {
        MSG_BEGIN();
-
+#ifndef MSG_WEARABLE_PROFILE
        int nRepeatValue = 0;
        long    nRepeatTime = 0;
 
@@ -761,26 +802,25 @@ void MsgSoundPlayer::MsgSoundInitRepeatAlarm()
 
        nRepeatValue = MsgSettingGetInt(MSG_ALERT_REP_TYPE);
 
-       switch (nRepeatValue)
-       {
-               case MSG_ALERT_TONE_ONCE:
-                       nRepeatTime = 0;
+       switch (nRepeatValue) {
+       case MSG_ALERT_TONE_ONCE:
+               nRepeatTime = 0;
                break;
 
-               case MSG_ALERT_TONE_2MINS:
-                       nRepeatTime = 2;
+       case MSG_ALERT_TONE_2MINS:
+               nRepeatTime = 2;
                break;
 
-               case MSG_ALERT_TONE_5MINS:
-                       nRepeatTime = 5;
+       case MSG_ALERT_TONE_5MINS:
+               nRepeatTime = 5;
                break;
 
-               case MSG_ALERT_TONE_10MINS:
-                       nRepeatTime = 10;
+       case MSG_ALERT_TONE_10MINS:
+               nRepeatTime = 10;
                break;
 
-               default:
-                       MSG_DEBUG("Invalid Repetition time");
+       default:
+               MSG_DEBUG("Invalid Repetition time");
                break;
        }
 
@@ -788,6 +828,6 @@ void MsgSoundPlayer::MsgSoundInitRepeatAlarm()
 
        if (nRepeatTime > 0)
                MsgSoundPlayStart(NULL, MSG_SOUND_PLAY_USER);
-
+#endif /* MSG_WEARABLE_PROFILE */
        MSG_END();
 }
index ec47690..0599e01 100755 (executable)
@@ -57,9 +57,9 @@ bool MsgCheckFilter(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S *pMsgInfo)
 
        msg_error_t err = MSG_SUCCESS;
 
-       /=======================================================================
-       // Check Unknown Sender
-       // =======================================================================
+       /*========================================================================
+          Check Unknown Sender
+       ========================================================================*/
        bool bBlockUnknown = false;
 
        if (MsgSettingGetBool(MSG_BLOCK_UNKNOWN_MSG, &bBlockUnknown) == MSG_SUCCESS) {
@@ -69,9 +69,9 @@ bool MsgCheckFilter(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S *pMsgInfo)
                }
        }
 
-       /=======================================================================
-       // Check Filter Operation
-       // =======================================================================
+       /*========================================================================
+          Check Filter Operation
+       ========================================================================*/
        bool filterFlag = false;
 
        MsgGetFilterOperation(&filterFlag);
@@ -81,9 +81,9 @@ bool MsgCheckFilter(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S *pMsgInfo)
                return false;
        }
 
-       /=======================================================================
-       // Check Filter by Address
-       // =======================================================================
+       /*========================================================================
+          Check Filter by Address
+       ========================================================================*/
        int rowCnt = 0;
 
        MSG_SEC_DEBUG("pMsg->addressList[0].addressVal [%s]", pMsgInfo->addressList[0].addressVal);
@@ -113,10 +113,10 @@ bool MsgCheckFilter(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S *pMsgInfo)
                pDbHandle->freeTable();
        }
 
-       /=======================================================================
-       // Check Filter by Subject
-       // =======================================================================
-       // Get Filter List
+       /*========================================================================
+          Check Filter by Subject
+       ========================================================================*/
+       /* Get Filter List */
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
 
        snprintf(sqlQuery, sizeof(sqlQuery), "SELECT FILTER_VALUE FROM %s WHERE FILTER_TYPE = %d;",
@@ -140,8 +140,7 @@ bool MsgCheckFilter(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S *pMsgInfo)
        int fileSize = 0;
        bool bFiltered = false;
 
-       for (int i = 1; i <= rowCnt; i++)
-       {
+       for (int i = 1; i <= rowCnt; i++) {
                memset(filterValue, 0x00, sizeof(filterValue));
 
                pDbHandle->getColumnToString(i, MAX_FILTER_VALUE_LEN, filterValue);
@@ -176,7 +175,7 @@ bool MsgCheckFilter(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S *pMsgInfo)
                                        pData[strlen(pMsgInfo->msgText)] = '\0';
                                }
                        }
-               } else if(pMsgInfo->msgType.mainType == MSG_MMS_TYPE) {
+               } else if (pMsgInfo->msgType.mainType == MSG_MMS_TYPE) {
                        if (strlen(pMsgInfo->subject) > 0) {
                                if (pData) {
                                        delete[] pData;
@@ -190,7 +189,7 @@ bool MsgCheckFilter(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S *pMsgInfo)
                        }
                }
 
-               // NULL value check
+               /* NULL value check */
                if (pData == NULL) {
                        MSG_DEBUG("pData is NULL");
 
@@ -205,7 +204,7 @@ bool MsgCheckFilter(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S *pMsgInfo)
                        MSG_CONTACT_INFO_S contactInfo;
                        memset(&contactInfo, 0x00, sizeof(MSG_CONTACT_INFO_S));
 
-                       // Get Contact Info
+                       /* Get Contact Info */
                        if (MsgGetContactInfo(&(pMsgInfo->addressList[0]), &contactInfo) == MSG_SUCCESS) {
                                if (contactInfo.contactId > 0) {
                                        MSG_SEC_DEBUG("Msg is Filtered by Subject [%s] Data [%s], but address is in contact. Skip.", filterValue, pData);
@@ -254,9 +253,9 @@ bool MsgCheckFilterByWord(MsgDbHandler *pDbHandle, const char *pMsgText)
 
        msg_error_t err = MSG_SUCCESS;
 
-       /=======================================================================
-       // Check Filter Operation
-       // =======================================================================
+       /*========================================================================
+          Check Filter Operation
+       ========================================================================*/
        bool filterFlag = false;
 
        MsgGetFilterOperation(&filterFlag);
@@ -272,10 +271,10 @@ bool MsgCheckFilterByWord(MsgDbHandler *pDbHandle, const char *pMsgText)
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
 
 
-       /=======================================================================
-       // Check Filter by Word
-       // =======================================================================
-       // Get Filter List
+       /*========================================================================
+          Check Filter by Word
+       ========================================================================*/
+       /* Get Filter List */
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
 
        snprintf(sqlQuery, sizeof(sqlQuery), "SELECT FILTER_VALUE FROM %s WHERE FILTER_TYPE = %d;",
@@ -292,15 +291,15 @@ bool MsgCheckFilterByWord(MsgDbHandler *pDbHandle, const char *pMsgText)
        char filterValue[MAX_FILTER_VALUE_LEN+1];
        bool bFiltered = false;
 
-       for (int i = 1; i <= rowCnt; i++)
-       {
+       for (int i = 1; i <= rowCnt; i++) {
                memset(filterValue, 0x00, sizeof(filterValue));
 
                pDbHandle->getColumnToString(i, MAX_FILTER_VALUE_LEN, filterValue);
 
                MSG_DEBUG("filterValue [%s]", filterValue);
 
-               if (strlen(filterValue) <= 0) continue;
+               if (strlen(filterValue) <= 0)
+                       continue;
 
                if (strcasestr(pMsgText, filterValue) != NULL) {
                        MSG_DEBUG("Msg is Filtered by Word [%s] ", filterValue);
index 596bba3..5fc8c2f 100755 (executable)
@@ -8,7 +8,7 @@ IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
 ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
 MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")
 
-SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -O0 -g -Wall")
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -O2 -g -Wall")
 
 #########################################################
 # Define Plugin Manager
@@ -108,7 +108,7 @@ INCLUDE_DIRECTORIES(
 )
 
 INCLUDE(FindPkgConfig)
-pkg_check_modules(trans_manager_pkgs REQUIRED glib-2.0 security-server dlog vconf)
+pkg_check_modules(trans_manager_pkgs REQUIRED glib-2.0 security-server dlog vconf bundle eventsystem)
 
 FOREACH(flag ${trans_manager_pkgs_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
index 0b4e336..eccda5c 100755 (executable)
@@ -14,7 +14,7 @@
  * limitations under the License.
 */
 
-#include <app_control.h>
+#include <app_control_internal.h>
 
 #include "MsgDebug.h"
 #include "MsgUtilFile.h"
@@ -40,7 +40,7 @@
 void MsgPlayTTSMode(MSG_SUB_TYPE_T msgSubType, msg_message_id_t msgId, bool isFavorites)
 {
        MSG_BEGIN();
-
+#if 0
        bool bNotification = true;
 
        if (MsgSettingGetBool(MSG_SETTING_NOTIFICATION, &bNotification) != MSG_SUCCESS) {
@@ -123,7 +123,7 @@ void MsgPlayTTSMode(MSG_SUB_TYPE_T msgSubType, msg_message_id_t msgId, bool isFa
        }
 
        MsgChangePmState();
-
+#endif
        MSG_END();
 }
 
@@ -240,7 +240,7 @@ msg_error_t MsgHandleMmsConfIncomingMsg(MSG_MESSAGE_INFO_S *pMsgInfo, msg_reques
 
                        if (readStatus == true) {
                                MsgStoSetReadStatus(dbHandle, pMsgInfo->msgId, false);
-                               MsgRefreshNotification(MSG_NOTI_TYPE_NORMAL, false, false);
+                               MsgRefreshNotification(MSG_NOTI_TYPE_NORMAL, false, MSG_ACTIVE_NOTI_TYPE_NONE);
                        }
                }
 
@@ -482,6 +482,8 @@ msg_error_t MsgHandleSMS(MSG_MESSAGE_INFO_S *pMsgInfo, bool *pSendNoti, bool *bO
                        }
                        *pSendNoti = false;
                        *bOnlyNoti = false;
+
+                       MsgInsertOnlyActiveNotification(MSG_NOTI_TYPE_CLASS0, pMsgInfo);
                }
        } else if ((pMsgInfo->msgType.subType >= MSG_WAP_SI_SMS) && (pMsgInfo->msgType.subType <= MSG_WAP_CO_SMS)) {
                MSG_DEBUG("Starting WAP Message Incoming.");
@@ -583,6 +585,7 @@ msg_error_t MsgHandleSMS(MSG_MESSAGE_INFO_S *pMsgInfo, bool *pSendNoti, bool *bO
                                break;
                        case MSG_WAP_CO_SMS:
                                *pSendNoti = false;
+                               MsgInsertOnlyActiveNotification(MSG_NOTI_TYPE_NORMAL, pMsgInfo);
                                break;
                }
        } else if (pMsgInfo->msgType.subType == MSG_STATUS_REPORT_SMS) {
index cfd57d5..36cd7c8 100755 (executable)
@@ -17,6 +17,7 @@
 /*==================================================================================================
                                          INCLUDE FILES
 ==================================================================================================*/
+#include "MsgCallStatusManager.h"
 #include "MsgDebug.h"
 #include "MsgException.h"
 #include "MsgContact.h"
 #include "MsgUtilFile.h"
 #include "MsgUtilStorage.h"
 #include "MsgNotificationWrapper.h"
+#include "MsgZoneManager.h"
 
 #include <errno.h>
 #include <glib.h>
-#include <glib-object.h>
 #include <sys/stat.h>
 #include <wait.h>
 
@@ -47,99 +48,17 @@ static GMainLoop* mainloop = NULL;
                                      FUNCTION IMPLEMENTATION
 ==================================================================================================*/
 
-msg_error_t InitMmsDir()
-{
-       if (mkdir(MSG_DATA_ROOT_PATH, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) < 0)
-       {
-               if (errno == EEXIST)
-               {
-                       MSG_DEBUG("The %s already exists", MSG_DATA_ROOT_PATH);
-               }
-               else
-               {
-                       MSG_DEBUG("Error while mkdir %s", MSG_DATA_ROOT_PATH);
-                       return MSG_ERR_DB_MAKE_DIR;
-               }
-       }
-
-       if (mkdir(MSG_SMIL_FILE_PATH, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) < 0)
-       {
-               if (errno == EEXIST)
-               {
-                       MSG_SEC_DEBUG("The %s already exists", MSG_SMIL_FILE_PATH);
-               }
-               else
-               {
-                       MSG_SEC_DEBUG("Error while mkdir %s", MSG_SMIL_FILE_PATH);
-                       return MSG_ERR_DB_MAKE_DIR;
-               }
-       }
-
-       if (mkdir(MSG_DATA_PATH, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) < 0)
-       {
-               if (errno == EEXIST)
-               {
-                       MSG_DEBUG("The %s already exists", MSG_DATA_PATH);
-               }
-               else
-               {
-                       MSG_DEBUG("Error while mkdir %s", MSG_DATA_PATH);
-                       return MSG_ERR_DB_MAKE_DIR;
-               }
-       }
-
-       if (mkdir(MSG_THUMBNAIL_PATH, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) < 0) {
-               if (errno == EEXIST) {
-                       MSG_DEBUG("The %s already exists.", MSG_THUMBNAIL_PATH);
-               } else {
-                       MSG_DEBUG(" Error while mkdir %s", MSG_THUMBNAIL_PATH);
-                       return MSG_ERR_DB_MAKE_DIR;
-               }
-       }
-
-       if (mkdir(MSG_IPC_DATA_PATH, S_IRWXU ) < 0)
-       {
-               if (errno == EEXIST)
-               {
-                       MSG_DEBUG("The %s already exists", MSG_IPC_DATA_PATH);
-                       // if IPC data path is already exist, clear all files in folder.
-                       MsgRmRf((char *)MSG_IPC_DATA_PATH);
-               }
-               else
-               {
-                       MSG_DEBUG("Error while mkdir %s", MSG_IPC_DATA_PATH);
-                       return MSG_ERR_DB_MAKE_DIR;
-               }
-       }
-
-       if (MsgChmod( MSG_IPC_DATA_PATH, S_IRWXU | S_IRWXG) == 0) { //public shared file: pass data by file
-               MSG_DEBUG("Fail to chmod [%s].", MSG_IPC_DATA_PATH);
-       }
-       if (MsgChown(MSG_DATA_ROOT_PATH, 0, 5000) == 0) {
-               MSG_DEBUG("Fail to chown [%s].", MSG_DATA_ROOT_PATH);
-       }
-       if (MsgChown(MSG_DATA_PATH, 0, 5000) == 0) {
-               MSG_DEBUG("Fail to chown [%s].", MSG_DATA_PATH);
-       }
-       if (MsgChown(MSG_SMIL_FILE_PATH, 0, 5000) == 0) {
-               MSG_DEBUG("Fail to chown [%s].", MSG_SMIL_FILE_PATH);
-       }
-       if (MsgChown(MSG_IPC_DATA_PATH, 0, 5000) == 0) {
-               MSG_DEBUG("Fail to chown [%s].", MSG_IPC_DATA_PATH);
-       }
-       if (MsgChown(MSG_THUMBNAIL_PATH, 0, 5000) == 0) {
-               MSG_DEBUG("Fail to chown [%s].", MSG_THUMBNAIL_PATH);
-       }
-
-       return MSG_SUCCESS;
-}
-
 
 void* InitMsgServer(void*)
 {
        msg_error_t err = MSG_SUCCESS;
        MSG_DEBUG("Start InitMsgServer.");
 
+       // Init contact digit number
+       MsgInitContactSvc();
+
+       MsgInitCallStatusManager();
+
        //CID 356902: Moving try block up to include MsgStoInitDB which also throws MsgException
        try
        {
@@ -214,12 +133,6 @@ int main(void)
        if(MsgSettingSetBool(VCONFKEY_MSG_SERVER_READY, false) != MSG_SUCCESS)
                MSG_DEBUG("MsgSettingSetBool FAIL: VCONFKEY_MSG_SERVER_READY");
 
-       // Connect to DB
-       //      MsgStoConnectDB();
-
-       // Clean up mms dir
-       InitMmsDir();
-
        // init server
        InitMsgServer(NULL);
 
@@ -232,8 +145,8 @@ int main(void)
                return -1;
        }
 
-       // Regist vconf CB.
-       MsgSettingRegVconfCB();
+       // Init zone manager
+//     MsgZoneInit();
 
        mainloop = g_main_loop_new(NULL, FALSE);
 
@@ -249,11 +162,8 @@ int main(void)
                MSG_DEBUG("Fail to start Messaging Framework!!!");
        }
 
-       // free MmapMutex
-       MsgfreeMmapMutex();
-
-       // Remove vconf CB
-       MsgSettingRemoveVconfCB();
+       // Clean zone manager
+       MsgZoneClean();
 
        // Close Contact Sevice
        MsgCloseContactSvc();
@@ -261,6 +171,8 @@ int main(void)
        // Disconnect to DB
        MsgStoDisconnectDB();
 
+       MsgDeInitCallStatusManager();
+
        return 0;
 }
 
index 3b5f174..836afce 100755 (executable)
@@ -890,22 +890,17 @@ MsgPlugin::MsgPlugin(MSG_MAIN_TYPE_T mainType, const char *libPath): mSupportedM
        mLibHandler = dlopen(libPath, RTLD_NOW);
 
        if (!mLibHandler)
-               THROW(MsgException::PLUGIN_ERROR, "ERROR dlopen library : [%s] [%s]", libPath, dlerror());
-
-       // Clear Error
-       dlerror();
+               THROW(MsgException::PLUGIN_ERROR, "ERROR dlopen library : [%s]", libPath);
 
        // assign the c function pointers
        msg_error_t(*pFunc)(MSG_PLUGIN_HANDLER_S*) = NULL;
 
        pFunc = (msg_error_t(*)(MSG_PLUGIN_HANDLER_S*))dlsym(mLibHandler, "MsgPlgCreateHandle");
 
-       char *error = dlerror();
-
-       if (error != NULL)
-               THROW(MsgException::PLUGIN_ERROR, "ERROR dlsym library : [%s]", error);
+       if (!pFunc)
+               THROW(MsgException::PLUGIN_ERROR, "ERROR dlsym library");
 
-       if (pFunc && (*pFunc)(&mPlgHandler) != MSG_SUCCESS)
+       if ((*pFunc)(&mPlgHandler) != MSG_SUCCESS)
                THROW(MsgException::PLUGIN_ERROR, "ERROR to create plugin handle");
 
        MSG_PLUGIN_LISTENER_S fwListener = {0};
index f805bab..6f44866 100755 (executable)
@@ -326,14 +326,6 @@ msg_error_t MsgSetGeneralOpt(const MSG_SETTING_S *pSetting)
                }
        }
 
-       iValue = MsgSettingGetInt(MSG_SEARCH_TAGS);
-       if (iValue != (int)generalOpt.searchTags) {
-               if (MsgSettingSetInt(MSG_SEARCH_TAGS, (int)generalOpt.searchTags) != MSG_SUCCESS) {
-                       MSG_DEBUG("Error to set config data [%s]", MSG_SEARCH_TAGS);
-                       return MSG_ERR_SET_SETTING;
-               }
-       }
-
        return MSG_SUCCESS;
 }
 
@@ -985,9 +977,6 @@ void MsgGetGeneralOpt(MSG_SETTING_S *pSetting)
        }
 
        pSetting->option.generalOpt.alertTone = (MSG_ALERT_TONE_T)MsgSettingGetInt(MSG_ALERT_REP_TYPE);
-
-       pSetting->option.generalOpt.searchTags = MsgSettingGetInt(MSG_SEARCH_TAGS);
-
 }
 
 
@@ -1038,7 +1027,7 @@ void MsgGetMMSSendOpt(MSG_SETTING_S *pSetting)
        MsgSettingGetBool(MMS_SEND_READ_REPLY, &pSetting->option.mmsSendOpt.bReadReply);
 
 #ifdef __NOT_USED_BY_DESIGN_CHANGE__
-       MsgSettingGetBool(MSG_KEEP_COPY, &pSetting->option.mmsSendOpt.bKeepCopy);
+       MsgSettingGetBool(MMS_SEND_KEEP_COPY, &pSetting->option.mmsSendOpt.bKeepCopy);
 #endif /* __NOT_USED_BY_DESIGN_CHANGE__ */
 
        MsgSettingGetBool(MMS_SEND_BODY_REPLYING, &pSetting->option.mmsSendOpt.bBodyReplying);
index 6366cc7..4b6e34e 100755 (executable)
@@ -34,6 +34,9 @@
 #include "MsgPluginManager.h"
 #include "MsgStorageHandler.h"
 
+#ifdef FEATURE_CONTAINER_ENABLE
+#include "MsgZoneManager.h"
+#endif
 
 #define MSG_DB_VERSION 1
 
@@ -198,17 +201,15 @@ void MsgInitMmapMutex(const char *shm_file_name)
        pthread_mutexattr_destroy(&mattr);
 
        close (fd);
-       MSG_END();
-}
 
+       if (munmap((void *)mx, sizeof(pthread_mutex_t)) != 0) {
+               MSG_FATAL("munmap() failed! (errno: %d)", errno);
+               return;
+       }
 
-void MsgfreeMmapMutex()
-{
-       MsgDbHandler *dbHandle = getDbHandle();
-       dbHandle->freeMmapMutex();
+       MSG_END();
 }
 
-
 msg_error_t MsgStoInitDB(bool bSimChanged)
 {
        MSG_BEGIN();
@@ -497,6 +498,22 @@ msg_error_t MsgStoResetDatabase()
        dbHandle->endTrans(true);
 
        // Delete MMS Files
+#ifdef FEATURE_CONTAINER_ENABLE
+       char _fullPath[MAX_FULL_PATH_SIZE];
+       memset(_fullPath, 0x00, sizeof(_fullPath));
+
+       char *rootPath = MsgZoneGetRootPath();
+       if (rootPath) {
+               snprintf(_fullPath, MAX_FULL_PATH_SIZE, "%s%s", rootPath, MSG_DATA_PATH);
+               MsgRmRf((char*)_fullPath);
+               memset(_fullPath, 0x00, sizeof(_fullPath));
+               snprintf(_fullPath, MAX_FULL_PATH_SIZE, "%s%s", rootPath, MSG_SMIL_FILE_PATH);
+               MsgRmRf((char*)_fullPath);
+
+               g_free(rootPath);
+               rootPath = NULL;
+       }
+#endif
        MsgRmRf((char*)MSG_DATA_PATH);
        MsgRmRf((char*)MSG_SMIL_FILE_PATH);
 
@@ -592,6 +609,11 @@ msg_error_t MsgStoBackupMessage(msg_message_backup_type_t type, const char *file
                        }
 
                        free(encoded_data);
+
+                       if (chmod(fileName, 0666) == -1) {
+                               MSG_FATAL("chmod: %s", g_strerror(errno));
+                               return MSG_ERR_UNKNOWN;
+                       }
                }
 
                memset(&msgInfo, 0, sizeof(MSG_MESSAGE_INFO_S));
@@ -625,7 +647,7 @@ msg_error_t MsgStoUpdateMms(MSG_MESSAGE_INFO_S *pMsg)
 
                dbHandle->bindText(pMsg->thumbPath, 1);
 
-               if (pMsg->msgText[0] != '\0' && g_file_get_contents(pMsg->msgText, &pFileData, &fileSize, NULL) == true) {
+               if (pMsg->msgText[0] != '\0' && g_file_get_contents((gchar*)pMsg->msgText, (gchar**)&pFileData, (gsize*)&fileSize, NULL) == true) {
                        dbHandle->bindText(pFileData, 2);
                }
 
@@ -885,7 +907,19 @@ msg_error_t MsgStoRestoreMessage(const char *filepath, msg_id_list_s **result_id
                                                                        vmsg_free_vtree_memory(vMsg);
                                                                        return MSG_ERR_STORAGE_ERROR;
                                                                }
+
+#ifdef FEATURE_CONTAINER_ENABLE
+                                                               char *rootPath = MsgZoneGetRootPath();
+                                                               if (rootPath) {
+                                                                       snprintf(msgInfo.msgData, MAX_MSG_DATA_LEN, "%s%s", rootPath, MSG_IPC_DATA_PATH);
+                                                                       g_free(rootPath);
+                                                                       rootPath = NULL;
+                                                               } else {
+                                                                       strncpy(msgInfo.msgData, MSG_IPC_DATA_PATH, MAX_MSG_DATA_LEN);
+                                                               }
+#else
                                                                strncpy(msgInfo.msgData, MSG_IPC_DATA_PATH, MAX_MSG_DATA_LEN);
+#endif
                                                                strncat(msgInfo.msgData, fileName, MAX_MSG_DATA_LEN-strlen(msgInfo.msgData));
                                                                msgInfo.dataSize = strlen(fileName);
                                                                MsgPlugin* plg = MsgPluginManager::instance()->getPlugin(msgInfo.msgType.mainType);
index 06f9250..f9587be 100755 (executable)
 #include "MsgUtilFile.h"
 #include "MsgMutex.h"
 #include "MsgUtilStorage.h"
-#include "MsgSoundPlayer.h"
 #include "MsgGconfWrapper.h"
 #include "MsgSqliteWrapper.h"
 #include "MsgPluginManager.h"
 #include "MsgStorageHandler.h"
 #include "MsgNotificationWrapper.h"
-#include "MsgMmsMessage.h"
 #include "MsgDevicedWrapper.h"
 
+#ifdef FEATURE_CONTAINER_ENABLE
+#include "MsgZoneManager.h"
+#endif
+
 
 using namespace std;
 
@@ -61,7 +63,7 @@ static gboolean resetNotification(void *pVoid)
 {
        MSG_BEGIN();
 
-       MsgRefreshAllNotification(true, false, false);
+       MsgRefreshAllNotification(true, false, MSG_ACTIVE_NOTI_TYPE_NONE);
 
        MSG_END();
 
@@ -119,7 +121,7 @@ msg_error_t MsgStoAddMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pS
 
        char keyName[MAX_VCONFKEY_NAME_LEN];
        memset(keyName, 0x00, sizeof(keyName));
-       snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_IMSI, pMsg->sim_idx);
+       snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_SUBS_ID, pMsg->sim_idx);
 
        char *imsi = MsgSettingGetString(keyName);
 
@@ -147,12 +149,23 @@ msg_error_t MsgStoAddMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pS
                dbHandle->bindText("", 2);
        } else {
                if (pMsg->bTextSms == false) {
-                       //CID 47860: pMsg->msgData is an array, hence null check is not required
                        char fn[MSG_FILEPATH_LEN_MAX];
                        memset(fn,0x00,MSG_FILEPATH_LEN_MAX);
+#ifdef FEATURE_CONTAINER_ENABLE
+                       char *rootPath = NULL;
+                       rootPath = MsgZoneGetRootPath();
+                       if (rootPath) {
+                               snprintf(fn, MSG_FILEPATH_LEN_MAX, "%s%s%s", rootPath, MSG_IPC_DATA_PATH, pMsg->msgData);
+                               g_free(rootPath);
+                               rootPath = NULL;
+                       } else {
+                               snprintf(fn, MSG_FILEPATH_LEN_MAX, "%s%s", MSG_IPC_DATA_PATH, pMsg->msgData);
+                       }
+#else
                        snprintf(fn, MSG_FILEPATH_LEN_MAX, "%s%s", MSG_IPC_DATA_PATH, pMsg->msgData);
+#endif
 
-                       if (g_file_get_contents(fn, &contents, NULL, NULL)) {
+                       if (g_file_get_contents((gchar*)fn, (gchar**)&contents, NULL, NULL)) {
                                MSG_DEBUG("g_file_get_contents() Success!!");
                                dbHandle->bindText(contents, 2);
                        } else {
@@ -258,6 +271,11 @@ msg_error_t MsgStoAddMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pS
 
                        MsgPlugin *plg = MsgPluginManager::instance()->getPlugin(MSG_MMS_TYPE);
 
+                       if (plg == NULL) {
+                               dbHandle->endTrans(false);
+                               return MSG_ERR_NULL_POINTER;
+                       }
+
                        if (pMmsSerializedData == NULL) {
                                if (MsgOpenAndReadFile(pMsg->msgData, &pMmsSerializedData, &fileSize) == false) {
                                        dbHandle->endTrans(false);
@@ -275,7 +293,7 @@ msg_error_t MsgStoAddMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pS
                        }
 
 //                     if (pMsg->msgText[0] != '\0') {
-//                             g_file_get_contents(pMsg->msgText, &pFileData, (gsize *)&fileSize, NULL);
+//                             g_file_get_contents((gchar*)pMsg->msgText, (gchar**)&pFileData, (gsize*)&fileSize, NULL);
 //                             MSG_DEBUG("file size [%d]", fileSize);
 //                     }
 
@@ -523,7 +541,7 @@ msg_error_t MsgStoUpdateReadStatus(msg_message_id_t msgId, bool bRead)
                return MSG_ERR_STORAGE_ERROR;
        }
 
-       MsgRefreshAllNotification(true, false, false);
+       MsgRefreshAllNotification(true, false, MSG_ACTIVE_NOTI_TYPE_NONE);
 
        // Get STORAGE_ID
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
@@ -1030,7 +1048,7 @@ msg_error_t MsgStoDeleteMessage(msg_message_id_t msgId, bool bCheckIndication)
 
        if (bCheckIndication == true) {
                MSG_DEBUG("bCheckIndication is true.");
-               MsgRefreshAllNotification(true, false, false);
+               MsgRefreshAllNotification(true, false, MSG_ACTIVE_NOTI_TYPE_NONE);
        }
 
        return MSG_SUCCESS;
@@ -1337,7 +1355,7 @@ msg_error_t MsgStoDeleteAllMessageInFolder(msg_folder_id_t folderId, bool bOnlyD
 //                             err = MSG_ERR_UNKNOWN;
 //                     }
 
-                       MsgRefreshAllNotification(true, false, false);
+                       MsgRefreshAllNotification(true, false, MSG_ACTIVE_NOTI_TYPE_NONE);
                }
        }
 /*** **/
@@ -1718,7 +1736,7 @@ msg_error_t MsgStoMoveMessageToFolder(msg_message_id_t msgId, msg_folder_id_t de
        err = MsgStoUpdateConversation(dbHandle, convId);
 
        /* update notification */
-       MsgRefreshAllNotification(true, false, false);
+       MsgRefreshAllNotification(true, false, MSG_ACTIVE_NOTI_TYPE_NONE);
 
        return err;
 }
@@ -2395,6 +2413,72 @@ msg_error_t MsgStoDeleteThreadMessageList(msg_thread_id_t threadId, bool bInclud
 }
 
 
+msg_error_t MsgStoSetTempAddressTable(const char *pSearchVal, int *count)
+{
+       MSG_ADDRESS_INFO_S *pAddrInfo = NULL;
+       unique_ptr<MSG_ADDRESS_INFO_S*, void(*)(MSG_ADDRESS_INFO_S**)> buf(&pAddrInfo, unique_ptr_deleter);
+       *count = 0;
+
+       // get contact search list
+       if (MsgGetContactSearchList(pSearchVal, &pAddrInfo, count) != MSG_SUCCESS) {
+               MSG_DEBUG("MsgGetContactSearchList fail.");
+               *count = 0;
+               return MSG_SUCCESS;
+       }
+
+       if (*count == 0) {
+               return MSG_SUCCESS;
+       }
+       MsgDbHandler *dbHandle = getDbHandle();
+       char sqlQuery[MAX_QUERY_LEN+1];
+
+       dbHandle->beginTrans();
+       // reset address temp table
+       memset(sqlQuery, 0x00, sizeof(sqlQuery));
+       snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s;", MSGFW_ADDRESS_TEMP_TABLE_NAME);
+       MSG_DEBUG("[%s]", sqlQuery);
+
+       if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS)
+               return MSG_ERR_DB_EXEC;
+
+       if (dbHandle->stepQuery() != MSG_ERR_DB_DONE) {
+               dbHandle->finalizeQuery();
+               dbHandle->endTrans(false);
+               return MSG_ERR_DB_EXEC;
+       }
+
+       dbHandle->finalizeQuery();
+
+       memset(sqlQuery, 0x00, sizeof(sqlQuery));
+       snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (?);", MSGFW_ADDRESS_TEMP_TABLE_NAME);
+       if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) {
+               dbHandle->endTrans(false);
+               return MSG_ERR_DB_PREPARE;
+       }
+
+       char newPhoneNum[MAX_ADDRESS_VAL_LEN+1];
+       char tmpNum[MAX_ADDRESS_VAL_LEN+1];
+       for (int i = 0; i < *count; i++) {
+               memset(newPhoneNum, 0x00, sizeof(newPhoneNum));
+               memset(tmpNum, 0x00, sizeof(tmpNum));
+               MsgConvertNumber(pAddrInfo[i].addressVal, tmpNum, sizeof(tmpNum));
+               snprintf(newPhoneNum, sizeof(newPhoneNum), "%%%%%s", tmpNum);
+               dbHandle->resetQuery();
+               dbHandle->bindText(newPhoneNum, 1);
+               if (dbHandle->stepQuery() != MSG_ERR_DB_DONE) {
+                       dbHandle->finalizeQuery();
+                       dbHandle->endTrans(false);
+                       return MSG_ERR_DB_EXEC;
+               }
+       }
+
+       dbHandle->finalizeQuery();
+       dbHandle->endTrans(true);
+
+       return MSG_SUCCESS;
+}
+
+
 msg_error_t MsgStoCountMsgByContact(const MSG_THREAD_LIST_INDEX_S *pAddrInfo, MSG_THREAD_COUNT_INFO_S *pThreadCountInfo)
 {
        MsgDbHandler *dbHandle = getDbHandle();
@@ -2483,6 +2567,8 @@ msg_error_t MsgStoGetSmsReportStatus(msg_message_id_t msgId, int *count, MSG_REP
        if (err != MSG_SUCCESS) {
                MSG_DEBUG("Fail to getTable().");
                dbHandle->freeTable();
+               if (err == MSG_ERR_DB_NORECORD)
+                       return MSG_SUCCESS;
                return err;
        }
 
@@ -2542,6 +2628,8 @@ msg_error_t MsgStoGetMmsReportStatus(msg_message_id_t msgId, int *count, MSG_REP
                if (err != MSG_SUCCESS) {
                        MSG_DEBUG("Fail to getTable().");
                        dbHandle->freeTable();
+                       if (err == MSG_ERR_DB_NORECORD)
+                               return MSG_SUCCESS;
                        return err;
                }
 
@@ -2833,7 +2921,7 @@ msg_error_t MsgStoRestoreMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S
 
                        char keyName[MAX_VCONFKEY_NAME_LEN];
                        memset(keyName, 0x00, sizeof(keyName));
-                       snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_IMSI, pMsg->sim_idx);
+                       snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_SUBS_ID, pMsg->sim_idx);
 
                        char *imsi = MsgSettingGetString(keyName);
 
@@ -3063,7 +3151,7 @@ msg_error_t MsgStoUpdateIMSI(int sim_idx)
                MSG_DEBUG("sim index is %d", sim_idx);
 
                memset(keyName, 0x00, sizeof(keyName));
-               snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_IMSI, sim_idx);
+               snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_SUBS_ID, sim_idx);
 
                char *imsi = MsgSettingGetString(keyName);
 
index 91b5534..74a8276 100755 (executable)
@@ -93,7 +93,7 @@ msg_error_t MsgStoUpdateMMSMessage(MSG_MESSAGE_INFO_S *pMsg)
 
                        dbHandle->bindText(pMsg->subject, 1);
 
-                       if (pMsg->msgText[0] != '\0' && g_file_get_contents(pMsg->msgText, &pFileData, &fileSize, NULL) == true) {
+                       if (pMsg->msgText[0] != '\0' && g_file_get_contents((gchar*)pMsg->msgText, (gchar**)&pFileData, (gsize*)&fileSize, NULL) == true) {
                                dbHandle->bindText(pFileData, 2);
                        } else {
                                dbHandle->bindText("", 2);
@@ -109,13 +109,13 @@ msg_error_t MsgStoUpdateMMSMessage(MSG_MESSAGE_INFO_S *pMsg)
                        }
 
 //                     if (MsgOpenAndReadFile(pMsg->msgText, &pFileData, &fileSize) == false) {
-                       if (g_file_get_contents(pMsg->msgText, &pFileData, &fileSize, NULL) == false) {
+                       if (g_file_get_contents((gchar*)pMsg->msgText, (gchar**)&pFileData, (gsize*)&fileSize, NULL) == false) {
                                return MSG_ERR_STORAGE_ERROR;
                        }
 
                        dbHandle->bindText(pMsg->subject, 1);
 
-                       if (pMsg->msgText[0] != '\0' && g_file_get_contents(pMsg->msgText, &pFileData, &fileSize, NULL) == true) {
+                       if (pMsg->msgText[0] != '\0' && g_file_get_contents((gchar*)pMsg->msgText, (gchar**)&pFileData, (gsize*)&fileSize, NULL) == true) {
                                dbHandle->bindText(pFileData, 2);
                        } else {
                                dbHandle->bindText("", 2);
@@ -130,7 +130,7 @@ msg_error_t MsgStoUpdateMMSMessage(MSG_MESSAGE_INFO_S *pMsg)
                        return MSG_ERR_DB_PREPARE;
                }
 
-               if (pMsg->msgText[0] != '\0' && g_file_get_contents(pMsg->msgText, &pFileData, &fileSize, NULL) == true) {
+               if (pMsg->msgText[0] != '\0' && g_file_get_contents((gchar*)pMsg->msgText, (gchar**)&pFileData, (gsize*)&fileSize, NULL) == true) {
                        dbHandle->bindText(pFileData, 1);
                } else {
                        dbHandle->bindText("", 1);
index e6925aa..95cad90 100755 (executable)
@@ -799,7 +799,7 @@ msg_error_t MsgStoCheckPushMsgValidation(MSG_PUSH_MESSAGE_S *pPushMsg, bool *pbP
        /**  is push message is expired?? */
        if (pPushMsg->received > pPushMsg->expires) {
                MSG_DEBUG("Push Message is expired.");
-               pbProceed = false;
+               *pbProceed = false;
                return err;
        }
 
@@ -825,7 +825,7 @@ msg_error_t MsgStoCheckPushMsgValidation(MSG_PUSH_MESSAGE_S *pPushMsg, bool *pbP
 
        if (pPushMsg->created < oldExpireTime) {
                MSG_DEBUG("Push Message is expired.");
-               pbProceed = false;
+               *pbProceed = false;
                return err;
        }
 
index fa0aff2..8d5e382 100755 (executable)
@@ -27,6 +27,9 @@
 #include "MsgSubmitHandler.h"
 
 
+#ifdef FEATURE_CONTAINER_ENABLE
+#include "MsgZoneManager.h"
+#endif
 
 /*==================================================================================================
                                      FUNCTION IMPLEMENTATION
@@ -142,13 +145,24 @@ msg_error_t MsgSubmitReqMMS(MSG_REQUEST_INFO_S *pReqInfo)
 
        if(pReqInfo->msgInfo.msgType.subType == MSG_SENDREQ_JAVA_MMS)
        {
-               char fileName[MAX_COMMON_INFO_SIZE+1] = {0};
+               char fileName[MSG_FILENAME_LEN_MAX+1] = {0};
 
                // copy whole of MMS PDU filepath to msgData
-               strncpy(fileName, pReqInfo->msgInfo.msgData, MAX_COMMON_INFO_SIZE);
-               memset(pReqInfo->msgInfo.msgData, 0x00, MAX_MSG_DATA_LEN+1);
-               snprintf(pReqInfo->msgInfo.msgData, MAX_MSG_DATA_LEN+1, "%s%s", MSG_IPC_DATA_PATH, fileName);
-
+               strncpy(fileName, pReqInfo->msgInfo.msgData, MSG_FILENAME_LEN_MAX);
+               memset(pReqInfo->msgInfo.msgData, 0x00, sizeof(pReqInfo->msgInfo.msgData));
+#ifdef FEATURE_CONTAINER_ENABLE
+               char *rootPath = NULL;
+               rootPath = MsgZoneGetRootPath();
+               if (rootPath) {
+                       snprintf(pReqInfo->msgInfo.msgData, MAX_MSG_DATA_LEN+1, "%s%s%s", rootPath, MSG_IPC_DATA_PATH, fileName);
+                       g_free(rootPath);
+                       rootPath = NULL;
+               } else {
+                       snprintf(pReqInfo->msgInfo.msgData, MAX_MSG_DATA_LEN+1, "%s%s", MSG_IPC_DATA_PATH, fileName);
+               }
+#else
+               snprintf(pReqInfo->msgInfo.msgData, sizeof(pReqInfo->msgInfo.msgData), "%s%s", MSG_IPC_DATA_PATH, fileName);
+#endif
                MSG_SEC_DEBUG("JAVA MMS PDU filepath:%s", pReqInfo->msgInfo.msgData);
 
                // submit request
@@ -164,6 +178,8 @@ msg_error_t MsgSubmitReqMMS(MSG_REQUEST_INFO_S *pReqInfo)
        }
        else if((pReqInfo->msgInfo.msgType.subType == MSG_SENDREQ_MMS) || (pReqInfo->msgInfo.msgType.subType == MSG_FORWARD_MMS))
        {
+               MSG_DEBUG("msgdata file path = [%s]", pReqInfo->msgInfo.msgData);
+
                if(pReqInfo->msgInfo.msgId > 0 && (pReqInfo->msgInfo.folderId == MSG_DRAFT_ID || pReqInfo->msgInfo.folderId == MSG_OUTBOX_ID)) {
                        MSG_DEBUG("Not New Message.");
                        pReqInfo->msgInfo.folderId = MSG_OUTBOX_ID;
@@ -302,9 +318,9 @@ msg_error_t MsgUpdateSentMsg(msg_message_id_t MsgId, msg_network_status_t Status
 {
        msg_error_t err = MSG_SUCCESS;
 
-#ifdef MSG_MMS_KEEPCOPY
        bool bKeepCopy = true;
 
+#ifdef MSG_MMS_KEEPCOPY
        MSG_SENDINGOPT_INFO_S sendOpt = {};
 
        if (msgType.mainType == MSG_MMS_TYPE)
@@ -318,6 +334,7 @@ msg_error_t MsgUpdateSentMsg(msg_message_id_t MsgId, msg_network_status_t Status
                        ret = MsgSettingGetBool(MSG_KEEP_COPY, &bKeepCopy);
                }
        }
+
        // Move Msg to SENTBOX
        if (Status == MSG_NETWORK_SEND_SUCCESS)
        {
@@ -331,8 +348,9 @@ msg_error_t MsgUpdateSentMsg(msg_message_id_t MsgId, msg_network_status_t Status
        // Move Msg to SENTBOX
        if (Status == MSG_NETWORK_SEND_SUCCESS)
        {
-               MSG_DEBUG("In Status == MSG_NETWORK_SEND_SUCCESS and bKeepCopy is true");
-               err = MsgStoMoveMessageToFolder(MsgId, MSG_SENTBOX_ID);
+               MSG_DEBUG("In Status == MSG_NETWORK_SEND_SUCCESS and  bKeepCopy is [%d]", bKeepCopy);
+               if (bKeepCopy == true)
+                       err = MsgStoMoveMessageToFolder(MsgId, MSG_SENTBOX_ID);
        }
 #endif
        return err;
index e28ce3d..e8c05e9 100755 (executable)
@@ -45,7 +45,7 @@ static gboolean  __refresh_noti(void *data)
 
        if (g_job_cnt <= 0) {
                MSG_DEBUG("## Refresh notification ##");
-               if (MsgRefreshNotification(MSG_NOTI_TYPE_NORMAL, false, false) != MSG_SUCCESS) {
+               if (MsgRefreshNotification(MSG_NOTI_TYPE_NORMAL, false, MSG_ACTIVE_NOTI_TYPE_NONE) != MSG_SUCCESS) {
                        MSG_DEBUG("MsgRefreshNoti is failed");
                }
                g_job_cnt = 0;
@@ -524,7 +524,7 @@ int MsgDeleteMessageByListHandler(const MSG_CMD_S *pCmd, char **ppEvent)
        msg_id_list_s msgIdList;
        memset(&msgIdList, 0x00, sizeof(msg_id_list_s));
 
-       msgIdList.nCount = *((int *)pCmd->cmdData);
+       memcpy(&msgIdList.nCount, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(int));
 
        MSG_DEBUG("msgIdList.nCount [%d]", msgIdList.nCount);
 
@@ -533,8 +533,8 @@ int MsgDeleteMessageByListHandler(const MSG_CMD_S *pCmd, char **ppEvent)
 
        msgIdList.msgIdList = msgIds;
 
-       for (int i=0; i<msgIdList.nCount; i++) {
-               msgIds[i] = *(msg_message_id_t *)(((char*)pCmd->cmdData) + (sizeof(int)*(i+1)));
+       for (int i = 0; i < msgIdList.nCount; i++) {
+               memcpy(&msgIds[i], (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(int)+sizeof(msg_message_id_t)*i), sizeof(msg_message_id_t));
        }
 
        // Delete Message
@@ -765,63 +765,6 @@ int MsgGetMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent)
 }
 
 
-int MsgGetFolderViewListHandler(const MSG_CMD_S *pCmd, char **ppEvent)
-{
-       if (!pCmd || !ppEvent) {
-               MSG_DEBUG("pCmd or ppEvent is null");
-               return 0;
-       }
-
-       // Get Folder ID
-       msg_folder_id_t folderId;
-       MSG_SORT_RULE_S sortRule;
-
-       memcpy(&folderId, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(msg_folder_id_t));
-       memcpy(&sortRule, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(msg_folder_id_t)), sizeof(MSG_SORT_RULE_S));
-
-       char* encodedData = NULL;
-       unique_ptr<char*, void(*)(char**)> buf(&encodedData, unique_ptr_deleter);
-
-       int dataSize = 0, eventSize = 0;
-
-#if 0
-       // Get Message Common Info
-       msg_struct_list_s folderViewList;
-
-//     err = MsgStoGetFolderViewList(folderId, &sortRule, &folderViewList);
-
-       if (err == MSG_SUCCESS)
-       {
-               MSG_DEBUG("Command Handle Success : MsgStoGetFolderViewList()");
-
-               // Encoding Folder View List Data
-//             dataSize = MsgEncodeFolderViewList(&folderViewList, &encodedData);
-
-               MSG_DEBUG("dataSize [%d]", dataSize);
-
-               if (folderViewList.msg_struct_info) {
-                       msg_struct_s *msg_struct;
-                       for (int i = 0; i < folderViewList.nCount; i++) {
-                               msg_struct = (msg_struct_s *)folderViewList.msg_struct_info[i];
-                               delete (MSG_MESSAGE_HIDDEN_S *)msg_struct->data;
-                               delete msg_struct;
-                       }
-                       g_free(folderViewList.msg_struct_info);
-               }
-       }
-       else
-       {
-               MSG_DEBUG("Command Handle Fail : MsgStoGetFolderViewList()");
-               return err;
-       }
-#endif
-       // Make Event Data
-       eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_GET_FOLDERVIEWLIST, MSG_SUCCESS, (void**)ppEvent);
-
-       return eventSize;
-}
-
-
 int MsgAddFolderHandler(const MSG_CMD_S *pCmd, char **ppEvent)
 {
        msg_error_t err = MSG_SUCCESS;
@@ -990,54 +933,8 @@ int MsgInitSimBySatHandler(const MSG_CMD_S *pCmd, char **ppEvent)
 }
 
 
-int MsgGetMsgTypeHandler(const MSG_CMD_S *pCmd, char **ppEvent)
-{
-       msg_error_t err = MSG_SUCCESS;
-
-       if (!pCmd || !ppEvent) {
-               MSG_DEBUG("pCmd or ppEvent is null");
-               return 0;
-       }
-
-       char* encodedData = NULL;
-       unique_ptr<char*, void(*)(char**)> buf(&encodedData, unique_ptr_deleter);
-
-
-       int dataSize = 0, eventSize = 0;
-
-       // Get Message ID
-       msg_message_id_t msgId;
-
-       memcpy(&msgId, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(msg_message_id_t));
-
-       // Get Msg Type
-       MSG_MESSAGE_TYPE_S msgType;
-
-       err = MsgStoGetMsgType(msgId, &msgType);
-
-       if (err == MSG_SUCCESS)
-       {
-               MSG_DEBUG("Command Handle Success : MsgStoGetMsgType()");
-
-               // Encoding Storage List Data
-               dataSize = MsgEncodeMsgType(&msgType, &encodedData);
-
-       }
-       else
-       {
-               MSG_DEBUG("Command Handle Fail : MsgStoGetMsgType()");
-       }
-
-       // Make Event Data
-       eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_GET_MSG_TYPE, err, (void**)ppEvent);
-
-       return eventSize;
-}
-
-
 int MsgGetThreadViewListHandler(const MSG_CMD_S *pCmd, char **ppEvent)
 {
-
        msg_error_t err = MSG_SUCCESS;
 
        if (!pCmd || !ppEvent) {
@@ -1091,7 +988,7 @@ int MsgGetThreadViewListHandler(const MSG_CMD_S *pCmd, char **ppEvent)
 }
 
 
-int MsgGetConversationViewListHandler(const MSG_CMD_S *pCmd, char **ppEvent)
+int MsgDeleteThreadMessageListHandler(const MSG_CMD_S *pCmd, char **ppEvent)
 {
        msg_error_t err = MSG_SUCCESS;
 
@@ -1101,50 +998,48 @@ int MsgGetConversationViewListHandler(const MSG_CMD_S *pCmd, char **ppEvent)
        }
 
        msg_thread_id_t threadId;
+       bool bIncludeProtect = false;
+       bool isSyncMLMsg = false;
 
        memcpy(&threadId, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(msg_thread_id_t));
+       memcpy(&bIncludeProtect, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(msg_thread_id_t)), sizeof(bool));
 
-       char* encodedData = NULL;
-       unique_ptr<char*, void(*)(char**)> buf(&encodedData, unique_ptr_deleter);
-
-       int dataSize = 0, eventSize = 0;
-#if 0
-       msg_struct_list_s convViewList;
+       int eventSize = 0;
 
-       //err = MsgStoGetConversationViewList(threadId, &convViewList);
+       isSyncMLMsg = MsgStoCheckSyncMLMsgInThread(threadId);
 
-       if (err == MSG_SUCCESS)
-       {
-               MSG_DEBUG("Command Handle Success : MsgStoGetConversationViewList()");
+       msg_id_list_s msgIdList;
+       memset(&msgIdList, 0x00, sizeof(msg_id_list_s));
 
-               // Encoding Folder View List Data
-               dataSize = MsgEncodeConversationViewList(&convViewList, &encodedData);
+       err = MsgStoDeleteThreadMessageList(threadId, bIncludeProtect, &msgIdList);
 
-               MSG_DEBUG("dataSize [%d]", dataSize);
+       if (err == MSG_SUCCESS) {
+               MSG_DEBUG("Command Handle Success : MsgStoDeleteThreadMessageList()");
 
-               if (convViewList.msg_struct_info) {
-                       msg_struct_s *msg_struct;
-                       for (int i = 0; i < convViewList.nCount; i++) {
-                               msg_struct = (msg_struct_s *)convViewList.msg_struct_info[i];
-                               delete (MSG_CONVERSATION_VIEW_S *)msg_struct->data;
-                               delete msg_struct;
-                       }
-                       g_free(convViewList.msg_struct_info);
+               if(isSyncMLMsg == true) {
+                       // broadcast to listener threads, here
+                       MsgTransactionManager::instance()->broadcastSyncMLMsgOperationCB(err, -1, -1);
                }
+
+               MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_DELETE, &msgIdList);
+               if(msgIdList.msgIdList != NULL)
+                       delete [] (char*)msgIdList.msgIdList;
        }
        else
        {
-               MSG_DEBUG("Command Handle Fail : MsgStoGetConversationViewList()");
+               MSG_DEBUG("Command Handle Fail : MsgStoDeleteThreadMessageList()");
+               if(msgIdList.msgIdList != NULL)
+                       delete [] (char*)msgIdList.msgIdList;
        }
-#endif
+
        // Make Event Data
-       eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_GET_CONVERSATIONVIEWLIST, err, (void**)ppEvent);
+       eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_DELETE_THREADMESSAGELIST, err, (void**)ppEvent);
 
        return eventSize;
 }
 
 
-int MsgDeleteThreadMessageListHandler(const MSG_CMD_S *pCmd, char **ppEvent)
+int MsgSetTempAddressTableHandler(const MSG_CMD_S *pCmd, char **ppEvent)
 {
        msg_error_t err = MSG_SUCCESS;
 
@@ -1153,43 +1048,30 @@ int MsgDeleteThreadMessageListHandler(const MSG_CMD_S *pCmd, char **ppEvent)
                return 0;
        }
 
-       msg_thread_id_t threadId;
-       bool bIncludeProtect = false;
-       bool isSyncMLMsg = false;
+       int search_len = 0;
+       memcpy(&search_len, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(int));
 
-       memcpy(&threadId, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(msg_thread_id_t));
-       memcpy(&bIncludeProtect, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(msg_thread_id_t)), sizeof(bool));
+       char search_val[search_len + 1] = {0,};
+       memcpy(&search_val, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(int)), sizeof(char)*search_len);
 
        int eventSize = 0;
+       int count = 0;
 
-       isSyncMLMsg = MsgStoCheckSyncMLMsgInThread(threadId);
-
-       msg_id_list_s msgIdList;
-       memset(&msgIdList, 0x00, sizeof(msg_id_list_s));
-
-       err = MsgStoDeleteThreadMessageList(threadId, bIncludeProtect, &msgIdList);
+       err = MsgStoSetTempAddressTable(search_val, &count);
 
        if (err == MSG_SUCCESS) {
-               MSG_DEBUG("Command Handle Success : MsgStoDeleteThreadMessageList()");
-
-               if(isSyncMLMsg == true) {
-                       // broadcast to listener threads, here
-                       MsgTransactionManager::instance()->broadcastSyncMLMsgOperationCB(err, -1, -1);
-               }
-
-               MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_DELETE, &msgIdList);
-               if(msgIdList.msgIdList != NULL)
-                       delete [] (char*)msgIdList.msgIdList;
+               MSG_DEBUG("Command Handle Success : MsgStoSetTmpAddressTable()");
        }
        else
        {
-               MSG_DEBUG("Command Handle Fail : MsgStoDeleteThreadMessageList()");
-               if(msgIdList.msgIdList != NULL)
-                       delete [] (char*)msgIdList.msgIdList;
+               MSG_DEBUG("Command Handle Fail : MsgStoSetTmpAddressTable()");
+               count = 0;
        }
 
        // Make Event Data
-       eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_DELETE_THREADMESSAGELIST, err, (void**)ppEvent);
+       eventSize = MsgMakeEvent(&count, sizeof(int), MSG_EVENT_SET_TEMP_ADDRESS_TABLE, err, (void**)ppEvent);
+
+       MSG_END();
 
        return eventSize;
 }
@@ -1355,9 +1237,24 @@ int MsgBackupMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent)
        memcpy(&type, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(msg_message_backup_type_t));
        memcpy(&path, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(msg_message_backup_type_t)), sizeof(path));
 
-       MSG_DEBUG("type = %d, path = %s", type, path);
+       char fullPath[MSG_FILEPATH_LEN_MAX+1] = {0,};
+
+#ifdef FEATURE_CONTAINER_ENABLE
+       char *rootPath = MsgZoneGetRootPath();
+       if (rootPath) {
+               snprintf(fullPath, MSG_FILEPATH_LEN_MAX, "%s%s", rootPath, path);
+               g_free(rootPath);
+               rootPath = NULL;
+       } else {
+               snprintf(fullPath, MSG_FILEPATH_LEN_MAX, "%s", path);
+       }
+#else
+       snprintf(fullPath, MSG_FILEPATH_LEN_MAX, "%s", path);
+#endif
+
+       MSG_DEBUG("type = %d, path = %s", type, fullPath);
 
-       err = MsgStoBackupMessage(type, path);
+       err = MsgStoBackupMessage(type, fullPath);
        if (err == MSG_SUCCESS)
                MSG_DEBUG("Command Handle Success : MsgBackupMessageHandler()");
        else
@@ -1818,11 +1715,13 @@ int MsgUpdatePushEventHandler(const MSG_CMD_S *pCmd, char **ppEvent)
        int eventSize = 0;
 
        // Get Message Info
-       MSG_PUSH_EVENT_INFO_S* pSrc = (MSG_PUSH_EVENT_INFO_S*)pCmd->cmdData;
-       MSG_PUSH_EVENT_INFO_S* pDst = (MSG_PUSH_EVENT_INFO_S*)(pCmd->cmdData + sizeof(MSG_PUSH_EVENT_INFO_S));
+       MSG_PUSH_EVENT_INFO_S pSrc;
+       MSG_PUSH_EVENT_INFO_S pDst;
+       memcpy(&pSrc, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(MSG_PUSH_EVENT_INFO_S));
+       memcpy(&pDst, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(MSG_PUSH_EVENT_INFO_S)), sizeof(MSG_PUSH_EVENT_INFO_S));
 
        // Add Message
-       err = MsgStoUpdatePushEvent(pSrc, pDst);
+       err = MsgStoUpdatePushEvent(&pSrc, &pDst);
 
        if (err == MSG_SUCCESS) {
                MSG_DEBUG("Command Handle Success : MsgStoUpdatePushEvent()");
index 7d5e884..425ced7 100755 (executable)
@@ -33,6 +33,7 @@
 #include "MsgAlarm.h"
 #include "MsgCmdHandler.h"
 #include "MsgDevicedWrapper.h"
+#include "MsgMmsMessage.h"
 
 
 /*==================================================================================================
@@ -64,6 +65,19 @@ int MsgSubmitReqHandler(const MSG_CMD_S *pCmd, char **ppEvent)
 
        MsgDecodeMsgInfo((char *)(pCmd->cmdData+sizeof(msg_request_id_t)+sizeof(MSG_PROXY_INFO_S)), &reqInfo.msgInfo, &reqInfo.sendOptInfo);
 
+
+       if (reqInfo.msgInfo.msgType.mainType == MSG_MMS_TYPE
+                       && reqInfo.msgInfo.msgType.subType == MSG_SENDREQ_MMS) {
+               int fd = 0;
+               memcpy(&fd, pCmd->cmdCookie, sizeof(int));
+               if (reqInfo.msgInfo.bTextSms == false) {
+                       err = MsgMmsCheckFilepathSmack(fd, reqInfo.msgInfo.msgData);
+                       if (err != MSG_SUCCESS) {
+                               return MsgMakeEvent(NULL, 0, MSG_EVENT_SUBMIT_REQ, err, (void**)ppEvent);
+                       }
+               }
+       }
+
        if (reqInfo.msgInfo.msgId > 0)
                bNewMsg = false;
 
@@ -156,7 +170,8 @@ int MsgRegSentStatusCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent)
        }
 
        // Get Message Request
-       int listenerFd = *((int*) pCmd->cmdData);
+       int listenerFd = 0;
+       memcpy(&listenerFd, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(int));
        MSG_DEBUG("Registering sent status CB for %d", listenerFd);
 
        // storing dst fd in list
@@ -334,7 +349,8 @@ int MsgRegStorageChangeCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent)
        }
 
        // Get Message Request
-       int listenerFd = *((int*) pCmd->cmdData);
+       int listenerFd = 0;
+       memcpy(&listenerFd, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(int));
        MSG_DEBUG("Registering storage change CB for %d", listenerFd);
 
        // storing dst fd in list
@@ -356,7 +372,8 @@ int MsgRegIncomingReportMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent
        }
 
        // Get Message Request
-       int listenerFd = *((int*) pCmd->cmdData);
+       int listenerFd = 0;
+       memcpy(&listenerFd, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(int));
        MSG_DEBUG("Registering report msg incoming CB for %d", listenerFd);
 
        // storing dst fd in list
@@ -401,10 +418,10 @@ int MsgSentStatusHandler(const MSG_CMD_S *pCmd, char **ppEvent)
                return MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_SENT_STATUS_CNF, MSG_SUCCESS, (void**)ppEvent);
        }
 
-       unsigned int ret[3] = {0}; //3// reqid, status, object
+       unsigned long ret[3] = {0}; //3// reqid, status, object
 
-       ret[0] = pStatus->reqId;
-       ret[1] = pStatus->status;
+       ret[0] = (unsigned long)pStatus->reqId;
+       ret[1] = (unsigned long)pStatus->status;
        ret[2] = prxInfo->handleAddr;
 
        // Make Event Data for APP
@@ -515,14 +532,15 @@ int MsgIncomingMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent)
 int MsgIncomingMMSConfMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent)
 {
        MSG_BEGIN();
-       msg_error_t err = MSG_SUCCESS;
-       int eventsize = 0;
 
        if (!pCmd || !ppEvent) {
                MSG_DEBUG("pCmd or ppEvent is null");
                return 0;
        }
 
+       msg_error_t err = MSG_SUCCESS;
+       int eventsize = 0;
+
        MSG_MESSAGE_INFO_S msgInfo;
        msg_request_id_t reqID;
 
@@ -684,10 +702,10 @@ __BYPASS_UPDATE:
                                MsgTransactionManager::instance()->delProxyInfo(reqID);
                        } else {
 
-                               unsigned int ret[3] = {0}; //3// reqid, status, object
+                               unsigned long ret[3] = {0}; //3// reqid, status, object
 
-                               ret[0] = reqID;
-                               ret[1] = msgInfo.networkStatus;
+                               ret[0] = (unsigned long)reqID;
+                               ret[1] = (unsigned long)msgInfo.networkStatus;
                                ret[2] = prxInfo->handleAddr;
 
                                // Make Event Data for APP
@@ -788,7 +806,7 @@ int MsgIncomingCBMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent)
        msgIds[0] = (msg_message_id_t)msgInfo.msgId;
        msgIdList.msgIdList = msgIds;
        MsgTransactionManager::instance()->broadcastStorageChangeCB(err, MSG_STORAGE_CHANGE_INSERT, &msgIdList);
-       MsgTransactionManager::instance()->broadcastCBMsgCB(err, &cbMsg);
+       MsgTransactionManager::instance()->broadcastCBMsgCB(err, &cbMsg, msgInfo.msgId);
 
        eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_INCOMING_CB_MSG_IND, err, (void**)ppEvent);
 
index e6ffc38..0fe6f84 100755 (executable)
@@ -21,6 +21,8 @@
 #include <pthread.h>
 
 #include <security-server.h>
+#include <bundle_internal.h>
+#include <eventsystem.h>
 
 #include "MsgDebug.h"
 #include "MsgMemory.h"
 #include "MsgPluginManager.h"
 #include "MsgTransManager.h"
 
+#ifdef FEATURE_CONTAINER_ENABLE
+#include "MsgZoneManager.h"
+#endif
+
 #define MSG_CHECK_PRIVILEGE
+#define MSG_EVENT_MSG_ID_LEN   (32)
 
 void MsgMakeErrorEvent(MSG_CMD_TYPE_T cmdType, msg_error_t errType, int *pEventSize, char **ppEvent)
 {
@@ -86,7 +93,6 @@ MsgTransactionManager::MsgTransactionManager() : running(false), mx(), cv(), eve
        handlerMap[MSG_CMD_MOVE_MSGTOSTORAGE]   = &MsgMoveMessageToStorageHandler;
        handlerMap[MSG_CMD_COUNT_MSG]                   = &MsgCountMessageHandler;
        handlerMap[MSG_CMD_GET_MSG]                             = &MsgGetMessageHandler;
-       handlerMap[MSG_CMD_GET_FOLDERVIEWLIST]  = &MsgGetFolderViewListHandler;
 
        handlerMap[MSG_CMD_ADD_FOLDER]                  = &MsgAddFolderHandler;
        handlerMap[MSG_CMD_UPDATE_FOLDER]               = &MsgUpdateFolderHandler;
@@ -101,8 +107,6 @@ MsgTransactionManager::MsgTransactionManager() : running(false), mx(), cv(), eve
        handlerMap[MSG_CMD_GET_FILTER_OPERATION]        = &MsgGetFilterOperationHandler;
        handlerMap[MSG_CMD_SET_FILTER_ACTIVATION] = &MsgSetFilterActivationHandler;
 
-       handlerMap[MSG_CMD_GET_MSG_TYPE]                        = &MsgGetMsgTypeHandler;
-
        handlerMap[MSG_CMD_SUBMIT_REQ]                  = &MsgSubmitReqHandler;
 
        handlerMap[MSG_CMD_REG_SENT_STATUS_CB]  = &MsgRegSentStatusCallbackHandler;
@@ -128,8 +132,8 @@ MsgTransactionManager::MsgTransactionManager() : running(false), mx(), cv(), eve
        handlerMap[MSG_CMD_PLG_INIT_SIM_BY_SAT] = &MsgInitSimBySatHandler;
 
        handlerMap[MSG_CMD_GET_THREADVIEWLIST]  = &MsgGetThreadViewListHandler;
-       handlerMap[MSG_CMD_GET_CONVERSATIONVIEWLIST]    = &MsgGetConversationViewListHandler;
        handlerMap[MSG_CMD_DELETE_THREADMESSAGELIST]    = &MsgDeleteThreadMessageListHandler;
+       handlerMap[MSG_CMD_SET_TEMP_ADDRESS_TABLE]      = &MsgSetTempAddressTableHandler;
 
        handlerMap[MSG_CMD_GET_CONTACT_COUNT]   = &MsgCountMsgByContactHandler;
        handlerMap[MSG_CMD_GET_QUICKPANEL_DATA]         = &MsgGetQuickPanelDataHandler;
@@ -205,6 +209,10 @@ void MsgTransactionManager::run()
 {
        servSock.open(MSG_SOCKET_PATH);
 
+#ifdef FEATURE_CONTAINER_ENABLE
+       MsgZoneDeclareLink();
+#endif
+
        fd_set readfds = servSock.fdSet();
        int nfds = 0;
 
@@ -370,7 +378,6 @@ void MsgTransactionManager::handleRequest(int fd)
 
        char* buf = NULL;
        unique_ptr<char*, void(*)(char**)> wrap(&buf, unique_ptr_deleter);
-
        int len = 0;
        int ret = servSock.read(fd, &buf, &len);
 
@@ -443,6 +450,7 @@ void MsgTransactionManager::handleRequest(int fd)
                        MsgMakeErrorEvent(pCmd->cmdType, MSG_ERR_INVALID_PARAMETER, &eventSize, &pEventData);
                } else {
                        // run handler function
+                       memcpy (pCmd->cmdCookie, &fd, sizeof(int)); /* Now, cmdCookie keeps fd for return */
                        eventSize = pfHandler(pCmd, &pEventData);
 
                        if (eventSize == 0 || pEventData == NULL) {
@@ -452,6 +460,7 @@ void MsgTransactionManager::handleRequest(int fd)
                }
 
                MSG_DEBUG("Replying to fd [%d], size [%d]", fd, eventSize);
+
                servSock.write(fd, pEventData, eventSize);
        }
 
@@ -987,6 +996,22 @@ void MsgTransactionManager::broadcastIncomingMsgCB(const msg_error_t err, const
                }
        }
 
+       /* Send system event */
+       bundle *b = NULL;
+       b = bundle_create();
+       if (b) {
+               if (msgInfo->msgType.subType >= MSG_WAP_SI_SMS && msgInfo->msgType.subType <= MSG_WAP_CO_SMS) {
+                       bundle_add(b, EVT_KEY_MSG_TYPE, EVT_VAL_PUSH);
+               } else {
+                       bundle_add(b, EVT_KEY_MSG_TYPE, EVT_VAL_SMS);
+               }
+               char msgId[MSG_EVENT_MSG_ID_LEN] = {0,};
+               snprintf(msgId, sizeof(msgId), "%u", msgInfo->msgId);
+               bundle_add(b, EVT_KEY_MSG_ID, msgId);
+               eventsystem_send_system_event(SYS_EVENT_INCOMMING_MSG, b);
+               bundle_free(b);
+       }
+
        MSG_END();
 }
 
@@ -1056,7 +1081,7 @@ void MsgTransactionManager::broadcastPushMsgCB(const msg_error_t err, const MSG_
        MSG_END();
 }
 
-void MsgTransactionManager::broadcastCBMsgCB(const msg_error_t err, const MSG_CB_MSG_S *cbMsg)
+void MsgTransactionManager::broadcastCBMsgCB(const msg_error_t err, const MSG_CB_MSG_S *cbMsg, msg_message_id_t cbMsgId)
 {
        MSG_BEGIN();
 
@@ -1073,6 +1098,18 @@ void MsgTransactionManager::broadcastCBMsgCB(const msg_error_t err, const MSG_CB
                write(it->listenerFd, pEventData, eventSize);
        }
 
+       /* Send system event */
+       bundle *b = NULL;
+       b = bundle_create();
+       if (b) {
+               bundle_add(b, EVT_KEY_MSG_TYPE, EVT_VAL_CB);
+               char msgId[MSG_EVENT_MSG_ID_LEN] = {0,};
+               snprintf(msgId, sizeof(msgId), "%u", cbMsgId);
+               bundle_add(b, EVT_KEY_MSG_ID, msgId);
+               eventsystem_send_system_event(SYS_EVENT_INCOMMING_MSG, b);
+               bundle_free(b);
+       }
+
        MSG_END();
 }
 
index 9710252..cf5be05 100755 (executable)
@@ -42,15 +42,15 @@ typedef unsigned int MSG_EVENT_TYPE_T;
 ==================================================================================================*/
 typedef struct _MSG_CMD_S
 {
-       MSG_CMD_TYPE_T  cmdType;
+       MSG_CMD_TYPE_T  cmdType;
        char                            cmdCookie[MAX_COOKIE_LEN];
-       char                            cmdData[2];
+       char                            cmdData[2];
 } MSG_CMD_S;
 
 
 typedef struct _MSG_EVENT_S
 {
-       MSG_EVENT_TYPE_T        eventType;
+       MSG_EVENT_TYPE_T                eventType;
        msg_error_t                     result;
        char                                    data[2];
 } MSG_EVENT_S;
@@ -67,114 +67,102 @@ enum _MSG_CMD_TYPE_E
        MSG_CMD_GET_STORAGELIST,
        MSG_CMD_ADD_MSG,
        MSG_CMD_ADD_SYNCML_MSG,
-
+// 5
        MSG_CMD_UPDATE_MSG,
        MSG_CMD_UPDATE_READ,
        MSG_CMD_UPDATE_PROTECTED,
        MSG_CMD_DELETE_MSG,
        MSG_CMD_DELALL_MSGINFOLDER,
-
 // 10
        MSG_CMD_MOVE_MSGTOFOLDER,
        MSG_CMD_MOVE_MSGTOSTORAGE,
        MSG_CMD_COUNT_MSG,
        MSG_CMD_GET_MSG,
-       MSG_CMD_GET_FOLDERVIEWLIST,
-
        MSG_CMD_ADD_FOLDER,
+// 15
        MSG_CMD_UPDATE_FOLDER,
        MSG_CMD_DELETE_FOLDER,
        MSG_CMD_GET_FOLDERLIST,
        MSG_CMD_ADD_FILTER,
-
-// 20
        MSG_CMD_UPDATE_FILTER,
+// 20
        MSG_CMD_DELETE_FILTER,
        MSG_CMD_GET_FILTERLIST,
        MSG_CMD_SET_FILTER_OPERATION,
        MSG_CMD_GET_FILTER_OPERATION,
-
-       MSG_CMD_GET_MSG_TYPE,
        MSG_CMD_SUBMIT_REQ,
+// 25
        MSG_CMD_REG_SENT_STATUS_CB,
        MSG_CMD_REG_STORAGE_CHANGE_CB,
        MSG_CMD_REG_INCOMING_MSG_CB,
-
-// 30
        MSG_CMD_REG_INCOMING_MMS_CONF_MSG_CB,
        MSG_CMD_REG_INCOMING_SYNCML_MSG_CB,
+// 30
        MSG_CMD_REG_INCOMING_LBS_MSG_CB,
        MSG_CMD_PLG_SENT_STATUS_CNF,
        MSG_CMD_PLG_STORAGE_CHANGE_IND,
-
        MSG_CMD_PLG_INCOMING_MSG_IND,
        MSG_CMD_PLG_INCOMING_MMS_CONF,
+//35
        MSG_CMD_PLG_INCOMING_SYNCML_IND,
        MSG_CMD_PLG_INCOMING_LBS_IND,
        MSG_CMD_PLG_INIT_SIM_BY_SAT,
-
-// 40
        MSG_CMD_GET_THREADVIEWLIST,
-       MSG_CMD_GET_CONVERSATIONVIEWLIST,
        MSG_CMD_DELETE_THREADMESSAGELIST,
+// 40
        MSG_CMD_GET_CONTACT_COUNT,
        MSG_CMD_GET_QUICKPANEL_DATA,
-
        MSG_CMD_COUNT_BY_MSGTYPE,
        MSG_CMD_RESET_DB,
        MSG_CMD_GET_MEMSIZE,
+// 45
        MSG_CMD_BACKUP_MESSAGE,
        MSG_CMD_RESTORE_MESSAGE,
-
-// 50
        MSG_CMD_UPDATE_THREAD_READ,
        MSG_CMD_REG_SYNCML_MSG_OPERATION_CB,
        MSG_CMD_SYNCML_OPERATION,
+// 50
        MSG_CMD_GET_REPORT_STATUS,
        MSG_CMD_GET_THREAD_ID_BY_ADDRESS,
-
        MSG_CMD_GET_THREAD_INFO,
        MSG_CMD_GET_SMSC_OPT,
        MSG_CMD_GET_CB_OPT,
+// 55
        MSG_CMD_GET_SMS_SEND_OPT,
        MSG_CMD_GET_MMS_SEND_OPT,
-
-// 60
        MSG_CMD_GET_MMS_RECV_OPT,
        MSG_CMD_GET_PUSH_MSG_OPT,
        MSG_CMD_GET_VOICE_MSG_OPT,
+// 60
        MSG_CMD_GET_GENERAL_MSG_OPT,
        MSG_CMD_GET_MSG_SIZE_OPT,
-
        MSG_CMD_SET_SMSC_OPT,
        MSG_CMD_SET_CB_OPT,
        MSG_CMD_SET_SMS_SEND_OPT,
+// 65
        MSG_CMD_SET_MMS_SEND_OPT,
        MSG_CMD_SET_MMS_RECV_OPT,
-
-// 70
        MSG_CMD_SET_PUSH_MSG_OPT,
        MSG_CMD_SET_VOICE_MSG_OPT,
        MSG_CMD_SET_GENERAL_MSG_OPT,
+// 70
        MSG_CMD_SET_MSG_SIZE_OPT,
        MSG_CMD_REG_INCOMING_PUSH_MSG_CB,
-
        MSG_CMD_PLG_INCOMING_PUSH_IND,
        MSG_CMD_REG_INCOMING_CB_MSG_CB,
        MSG_CMD_PLG_INCOMING_CB_IND,
+//75
        MSG_CMD_ADD_PUSH_EVENT,
        MSG_CMD_DELETE_PUSH_EVENT,
-
-// 80
        MSG_CMD_UPDATE_PUSH_EVENT,
        MSG_CMD_DELETE_MESSAGE_BY_LIST,
        MSG_CMD_SET_FILTER_ACTIVATION,
+// 80
        MSG_CMD_ADD_SIM_MSG,
        MSG_CMD_PLG_RESEND_MESSAGE,
-
-// 85
        MSG_CMD_REG_REPORT_MSG_INCOMING_CB,
        MSG_CMD_UPDATE_IMSI,
+       MSG_CMD_SET_TEMP_ADDRESS_TABLE,
 
 #ifdef FEATURE_SMS_CDMA
        MSG_CMD_PLG_CHECK_UNIQUENESS,
@@ -190,121 +178,109 @@ enum _MSG_EVENT_TYPE_E
        MSG_EVENT_GET_STORAGELIST,
        MSG_EVENT_ADD_MSG,
        MSG_EVENT_ADD_SYNCML_MSG,
-
+// 5
        MSG_EVENT_UPDATE_MSG,
        MSG_EVENT_UPDATE_READ,
        MSG_EVENT_UPDATE_PROTECTED,
        MSG_EVENT_DELETE_MSG,
        MSG_EVENT_DELALL_MSGINFOLDER,
-
 // 10
        MSG_EVENT_MOVE_MSGTOFOLDER,
        MSG_EVENT_MOVE_MSGTOSTORAGE,
        MSG_EVENT_COUNT_MSG,
        MSG_EVENT_GET_MSG,
-       MSG_EVENT_GET_FOLDERVIEWLIST,
-
        MSG_EVENT_ADD_FOLDER,
+// 15
        MSG_EVENT_UPDATE_FOLDER,
        MSG_EVENT_DELETE_FOLDER,
        MSG_EVENT_GET_FOLDERLIST,
        MSG_EVENT_ADD_FILTER,
-
-// 20
        MSG_EVENT_UPDATE_FILTER,
+// 20
        MSG_EVENT_DELETE_FILTER,
        MSG_EVENT_GET_FILTERLIST,
        MSG_EVENT_SET_FILTER_OPERATION,
        MSG_EVENT_GET_FILTER_OPERATION,
-
-       MSG_EVENT_GET_MSG_TYPE,
        MSG_EVENT_SUBMIT_REQ,
+// 25
        MSG_EVENT_REG_SENT_STATUS_CB,
        MSG_EVENT_REG_STORAGE_CHANGE_CB,
        MSG_EVENT_REG_INCOMING_MSG_CB,
-
-// 30
        MSG_EVENT_REG_INCOMING_MMS_CONF_MSG_CB,
        MSG_EVENT_REG_INCOMING_SYNCML_MSG_CB,
+// 30
        MSG_EVENT_REG_INCOMING_LBS_MSG_CB,
        MSG_EVENT_PLG_SENT_STATUS_CNF,
        MSG_EVENT_PLG_STORAGE_CHANGE_IND,
-
        MSG_EVENT_PLG_INCOMING_MSG_IND,
        MSG_EVENT_PLG_INCOMING_MMS_CONF,
+//35
        MSG_EVENT_PLG_INCOMING_SYNCML_MSG_IND,
        MSG_EVENT_PLG_INCOMING_LBS_MSG_IND,
        MSG_EVENT_PLG_INIT_SIM_BY_SAT,
-
-// 40
        MSG_EVENT_GET_THREADVIEWLIST,
-       MSG_EVENT_GET_CONVERSATIONVIEWLIST,
        MSG_EVENT_DELETE_THREADMESSAGELIST,
+// 40
        MSG_EVENT_GET_CONTACT_COUNT,
        MSG_EVENT_GET_QUICKPANEL_DATA,
-
        MSG_EVENT_COUNT_BY_MSGTYPE,
        MSG_EVENT_RESET_DB,
        MSG_EVENT_GET_MEMSIZE,
+//45
        MSG_EVENT_BACKUP_MESSAGE,
        MSG_EVENT_RESTORE_MESSAGE,
-
-// 50
        MSG_EVENT_UPDATE_THREAD_READ,
        MSG_EVENT_REG_SYNCML_MSG_OPERATION_CB,
        MSG_EVENT_SYNCML_OPERATION,
+// 50
        MSG_EVENT_GET_REPORT_STATUS,
        MSG_EVENT_GET_THREAD_ID_BY_ADDRESS,
-
        MSG_EVENT_GET_THREAD_INFO,
        MSG_EVENT_GET_SMSC_OPT,
        MSG_EVENT_GET_CB_OPT,
+// 55
        MSG_EVENT_GET_SMS_SEND_OPT,
        MSG_EVENT_GET_MMS_SEND_OPT,
-
-// 60
        MSG_EVENT_GET_MMS_RECV_OPT,
        MSG_EVENT_GET_PUSH_MSG_OPT,
        MSG_EVENT_GET_VOICE_MSG_OPT,
+// 60
        MSG_EVENT_GET_GENERAL_MSG_OPT,
        MSG_EVENT_GET_MSG_SIZE_OPT,
-
        MSG_EVENT_SET_SMSC_OPT,
        MSG_EVENT_SET_CB_OPT,
        MSG_EVENT_SET_SMS_SEND_OPT,
+// 65
        MSG_EVENT_SET_MMS_SEND_OPT,
        MSG_EVENT_SET_MMS_RECV_OPT,
-
-// 70
        MSG_EVENT_SET_PUSH_MSG_OPT,
        MSG_EVENT_SET_VOICE_MSG_OPT,
        MSG_EVENT_SET_GENERAL_MSG_OPT,
+// 70
        MSG_EVENT_SET_MSG_SIZE_OPT,
        MSG_EVENT_REG_INCOMING_PUSH_MSG_CB,
-
        MSG_EVENT_PLG_INCOMING_PUSH_MSG_IND,
        MSG_EVENT_REG_INCOMING_CB_MSG_CB,
        MSG_EVENT_PLG_INCOMING_CB_MSG_IND,
+// 75
        MSG_EVENT_ADD_PUSH_EVENT,
        MSG_EVENT_DELETE_PUSH_EVENT,
-
-// 80
        MSG_EVENT_UPDATE_PUSH_EVENT,
        MSG_EVENT_DELETE_MESSAGE_BY_LIST,
        MSG_EVENT_SET_FILTER_ACTIVATION,
+// 80
        MSG_EVENT_ADD_SIM_MSG,
        MSG_EVENT_PLG_RESEND_MESSAGE,
-
-// 85
        MSG_EVENT_REG_REPORT_MSG_INCOMING_CB,
        MSG_EVENT_UPDATE_IMSI,
+       MSG_EVENT_SET_TEMP_ADDRESS_TABLE,
 
 #ifdef FEATURE_SMS_CDMA
        MSG_EVENT_PLG_CHECK_UNIQUENESS,
 #endif
 
 // Enums that does not match _MSG_CMD_TYPE_E
-       MSG_EVENT_PLG_REPORT_MSG_INCOMING_IND,
+       MSG_EVENT_PLG_REPORT_MSG_INCOMING_IND,
 
 // end of MSG_EVENT; new EVENT should be defined before MSG_EVENT_NUM
        MSG_EVENT_NUM
index 1e5f4a2..746b7e7 100755 (executable)
@@ -25,7 +25,8 @@
 
 template <typename T>
 void unique_ptr_deleter( T **ptr ) {
-       if (ptr && *ptr )       delete[] *ptr;
+         if (ptr && *ptr )
+                 delete[] *ptr;
 }
 
 template <class T>
index 13cae23..3194ec0 100755 (executable)
 
 
 // temporary
-#define MSG_NATIONAL_SIM       "memory/private/msg-service/national_sim"
 #define MSG_SIM_MSISDN "memory/private/msg-service/msisdn"
-#define MSG_SIM_ICCID  "memory/private/msg-service/iccid"
-#define MSG_FMM_SIM_CHANGE_NUM "db/SyncML/oma-dm-service/fmmSimChangeNum"
 
 #define MAX_FULL_PATH_SIZE             320     // max length for internal file path
 #define MAX_THREAD_ADDR_LEN    40
 #define DEFAULT_SETTING_PATH                           "db/private/msg-service"
 #define DEFAULT_MSG_MEMORY_PATH                                "memory/private/msg-service"
 
+#ifdef FEATURE_SMS_CDMA
 #define MSG_SIM_IMSI                   DEFAULT_MSG_MEMORY_PATH"/sim_imsi"
+#endif
+#define MSG_SIM_SUBS_ID                        DEFAULT_MSG_MEMORY_PATH"/sim_subs_id"
 #define MSG_SIM_CHANGED                DEFAULT_MSG_MEMORY_PATH"/sim_changed"
 
 #define MSG_SIM_SERVICE_TABLE          DEFAULT_MSG_MEMORY_PATH"/sim_st"
 #define DEFAULT_SIM_COUNT_PATH                 DEFAULT_SETTING_PATH"/sim_count"
 
 #define MSG_KEEP_COPY                          DEFAULT_GENERAL_OPT_PATH"/keep_copy"
-#define MSG_ALERT_REP_TYPE                     DEFAULT_GENERAL_OPT_PATH"/alert_rep_type"
+//#define MSG_ALERT_REP_TYPE                   DEFAULT_GENERAL_OPT_PATH"/alert_rep_type"
+#define MSG_ALERT_REP_TYPE                     "db/setting/sound/noti/msg_alert_rep_type"
 #define MSG_AUTO_ERASE                         DEFAULT_GENERAL_OPT_PATH"/auto_erase"
 #define MSG_BLOCK_MESSAGE              DEFAULT_GENERAL_OPT_PATH"/block_msg"
-#define CONTACT_SYNC_TIME              DEFAULT_GENERAL_OPT_PATH"/contact_sync_time"
-#define MSG_SEARCH_TAGS                        DEFAULT_GENERAL_OPT_PATH"/search_tags"
 
 #define MSG_BLOCK_UNKNOWN_MSG          DEFAULT_GENERAL_OPT_PATH"/block_unknown_msg"
 #define MSG_SMS_LIMIT                          DEFAULT_GENERAL_OPT_PATH"/sms_limit"
 #define MSG_SETTING_RINGTONE_PATH                      DEFAULT_GENERAL_OPT_PATH"/ringtone_path"
 #define MSG_SETTING_RINGTONE_TYPE                      DEFAULT_GENERAL_OPT_PATH"/ringtone_type"
 #define MSG_MMS_UA_PROFILE                             DEFAULT_GENERAL_OPT_PATH"/ua_profile"
-#define MSG_MMS_UA_AGENT                               DEFAULT_GENERAL_OPT_PATH"/ua_agent"
 
 #define SMS_SEND_DCS                                                   DEFAULT_SMS_SEND_OPT_PATH"/dcs"
 #define SMS_SEND_NETWORK_MODE  VCONFKEY_MESSAGE_NETWORK_MODE
 
 #define MSG_DEFAULT_APP_ID                     "org.tizen.message"
 #define MSG_QUICKPANEL_APP_ID          "org.tizen.quickpanel"
+#define MSG_CALL_APP_ID                                "org.tizen.call"
 
-#define MSG_TELEPHONY_FEATURE       "http://tizen.org/feature/network.telephony"
-#define MSG_TELEPHONY_MMS_FEATURE   "http://tizen.org/feature/network.telephony.mms"
+#define MSG_TELEPHONY_SMS_FEATURE      "http://tizen.org/feature/network.telephony.sms"
+#define MSG_TELEPHONY_MMS_FEATURE      "http://tizen.org/feature/network.telephony.mms"
 
 /*==================================================================================================
                                          TYPES
@@ -211,28 +210,12 @@ typedef unsigned char MSG_SUB_TYPE_T;
 
 
 /**
- *     @brief  Represents a message tag type. \n
- *     Each main type of a message can be divided into some tag types. \n
- *     For instance of SMS, the message sub type can be one of the Priority, Finance, and so on. \n
- *     The values for this type SHOULD be in _MSG_SUB_TYPE_E.
- */
-typedef unsigned int MSG_TAG_TYPE_T;
-
-
-/**
  *     @brief  Represents a message class. \n
  *     The values for this type SHOULD be in _MSG_CLASS_TYPE_E.
  */
 typedef unsigned char MSG_CLASS_TYPE_T;
 
 
-/**
- *     @brief  Represents a message class. \n
- *     The values for this type SHOULD be in _MSG_MMS_TRANSACTION_TYPE_E.
- */
-typedef unsigned char MSG_MMS_TRANSACTION_TYPE_T;
-
-
 /*==================================================================================================
                                          STRUCTURES
 ==================================================================================================*/
@@ -384,16 +367,6 @@ typedef struct
        char            szThumbFilePath[MSG_FILEPATH_LEN_MAX + 1];      /**< Indicates the thumbnail file path */
 } MSG_MMS_MULTIPART_S;
 
-/**
- *     @brief  Represents sim message informatioin list.
- */
-typedef struct
-{
-       int nIdxCnt;            /**< The count of sim index */
-       int nMsgCnt;            /**< The count of sim message */
-       MSG_MESSAGE_INFO_S              *simMsgInfo;            /**< The pointer to sim message informatioin */
-} MSG_SIM_MSG_INFO_LIST_S;
-
 
 /**
  *     @brief  Represents a request in the framework. \n
@@ -416,7 +389,7 @@ typedef struct
 typedef struct
 {
        int                                             listenerFd;             /**< Rx fd for status cnf */
-       unsigned int                    handleAddr;             /**< Handle address for status cnf */
+       unsigned long                   handleAddr;             /**< Handle address for status cnf */
        msg_message_id_t                sentMsgId;              /**< The ID of a sent message for updating message status */
 } MSG_PROXY_INFO_S;
 
@@ -512,12 +485,6 @@ typedef struct
 } MSG_CMD_REG_INCOMING_CB_MSG_CB_S;
 
 
-typedef struct
-{
-       int                                             alarm_id;
-       MSG_REQUEST_INFO_S              reqInfo;
-}MSG_SCHEDULED_MSG_S;
-
 /**
  *     @brief  Represents a CB message in the framework.
  */
@@ -547,12 +514,6 @@ typedef struct _MSG_UNIQUE_INDEX_S
        int                                             telesvc_id;
 } MSG_UNIQUE_INDEX_S;
 
-typedef struct
-{
-       time_t                                  receivedTime;
-       unsigned short                  serialNum;
-       unsigned short                  messageId;      // Message Identifier
-} MSG_CB_DUPLICATE_S;
 #endif
 
 
@@ -638,17 +599,6 @@ enum _MSG_SUB_TYPE_E
 
 
 /**
- *     @brief  Represents the values of a message transaction type. \n
- *     This enum is used as the value of MSG_MMS_TRANSACTION_TYPE_T.
- */
-enum _MSG_MMS_TRANSACTION_TYPE_E
-{
-       MSG_MMS_SEND_COMPLETE = 0,
-       MSG_MMS_RETRIEVE_COMPLETE,
-       MSG_MMS_UNKNOWN,
-};
-
-/**
  *     @brief  Represents the values of File Type of MMS. \n
  *     This enum is used as the value of .
  */
index 733096d..ab30fb0 100755 (executable)
@@ -284,7 +284,6 @@ typedef struct
        bool                                    bPreview;                       /**< Indicates whether preview for incoming message is shown or not. */
        char                                    ringtonePath[MSG_FILEPATH_LEN_MAX+1];           /**< Indicates the message ringtone path */
        int                                     ringtoneType;           /**< Indicates the message ringtone type. */
-       int                                             searchTags;                     /**< Indicates the tags to be enabled for search ex) MSG_MESSAGE_TAG_PRIMARY | MSG_MESSAGE_TAG_PROMOTION.  See enum _MSG_TAG_TYPE_E  */
 }MSG_GENERAL_OPT_S;
 
 
index ca6c3d0..f882676 100755 (executable)
@@ -136,19 +136,6 @@ typedef struct
 
 
 /**
- *     @brief  Represents search condition values.
- */
-typedef struct
-{
-       msg_folder_id_t         folderId;
-       msg_message_type_t              msgType;
-       char                                            *pAddressVal;
-       char                                            *pSearchVal;
-       int                                             reserved;
-} MSG_SEARCH_CONDITION_S;
-
-
-/**
  *     @brief  Represents Message list condition values.
  */
 typedef struct
index 954b147..f125515 100755 (executable)
@@ -32,4 +32,4 @@ typedef void (*msg_alarm_cb)(int alarmId);
 msg_error_t MsgAlarmRegistration(struct tm *timeInfo, msg_alarm_cb userCB, int *alarmId);
 msg_error_t MsgAlarmRemove(int alarmId);
 
-#endif // MSG_ALARM_H
+#endif /* MSG_ALARM_H */
index 85ab130..0f82d2d 100755 (executable)
 ==================================================================================================*/
 #define MSG_APP_PACKAGE_NAME   "message"
 
-#define MSG_APP_LOCALEDIR                      "/usr/apps/"MSG_DEFAULT_APP_ID"/res/locale"
-
-#define MSG_NOTIFICATION_ICON_DIR                      MSG_QUICKPANEL_APP_ID"/shared/res/noti_icons/Message"
-
-// notification icon
-#define MSG_NORMAL_ICON_PATH   "/usr/apps/"MSG_NOTIFICATION_ICON_DIR"/noti_message.png"
-#define MSG_SIM_ICON_PATH      "/usr/apps/"MSG_NOTIFICATION_ICON_DIR"/noti_message_sim-card.png"
-#define MSG_VOICE_ICON_PATH            "/usr/apps/"MSG_NOTIFICATION_ICON_DIR"/noti_voice_mail.png"
-#define MSG_CB_ICON_PATH                       "/usr/apps/"MSG_NOTIFICATION_ICON_DIR"/noti_message_cb-msg.png"
-#define MSG_READ_ICON_PATH             "/usr/apps/"MSG_NOTIFICATION_ICON_DIR"/noti_message_read_report.png"
-#define MSG_DELIVERY_ICON_PATH "/usr/apps/"MSG_NOTIFICATION_ICON_DIR"/noti_message_delivery_report.png"
-#define MSG_REPLY_ICON_PATH                    "/usr/apps/"MSG_NOTIFICATION_ICON_DIR"/noti_message_reply.png"
-#define MSG_SMS_SENDING_FAILED_ICON_PATH               "/usr/apps/"MSG_NOTIFICATION_ICON_DIR"/noti_message_failed.png"
-#define MSG_MMS_SENDING_FAILED_ICON_PATH               "/usr/apps/"MSG_NOTIFICATION_ICON_DIR"/noti_message_mms_failed.png"
-#define MSG_MMS_RETRIVE_FAILED_ICON_PATH               "/usr/apps/"MSG_NOTIFICATION_ICON_DIR"/noti_message_mms_problem.png"
-#define MSG_EMERGENCY_ICON_PATH                "/usr/apps/"MSG_DEFAULT_APP_ID"/res/icons/default/small/noti_emergency_mode.png"
-
-// status bar icon
-#define MSG_NORMAL_STATUS_ICON                         "/usr/apps/"MSG_DEFAULT_APP_ID"/res/icons/default/small/status_bar_message.png"
-#define MSG_FAILED_STATUS_ICON                         "/usr/apps/"MSG_DEFAULT_APP_ID"/res/icons/default/small/status_bar_cancel_message.png"
-#define MSG_DELIVER_REPORT_STATUS_ICON "/usr/apps/"MSG_DEFAULT_APP_ID"/res/icons/default/small/status_bar_delivery_report_message.png"
-#define MSG_READ_REPORT_STATUS_ICON            "/usr/apps/"MSG_DEFAULT_APP_ID"/res/icons/default/small/status_bar_read_report_message.png"
-#define MSG_VOICE_MSG_STATUS_ICON                      "/usr/apps/"MSG_DEFAULT_APP_ID"/res/icons/default/small/status_bar_voicemail.png"
-#define MSG_SIM_FULL_STATUS_ICON               "/usr/apps/"MSG_DEFAULT_APP_ID"/res/icons/default/small/status_bar_sim_card_full.png"
+#define MSG_APP_LOCALEDIR                      "/usr/apps/" MSG_DEFAULT_APP_ID "/res/locale"
+
+#define MSG_NOTIFICATION_ICON_DIR                      MSG_QUICKPANEL_APP_ID "/shared/res/noti_icons"
+
+/* notification icon */
+#define MSG_NORMAL_ICON_PATH   "/usr/apps/" MSG_NOTIFICATION_ICON_DIR "/Message/noti_message.png"
+#define MSG_SIM_ICON_PATH      "/usr/apps/" MSG_NOTIFICATION_ICON_DIR "/Message/noti_message_sim-card.png"
+#define MSG_VOICE_ICON_PATH            "/usr/apps/" MSG_NOTIFICATION_ICON_DIR "/Message/noti_voice_mail.png"
+#define MSG_CB_ICON_PATH                       "/usr/apps/" MSG_NOTIFICATION_ICON_DIR "/Message/noti_message_cb-msg.png"
+#define MSG_READ_ICON_PATH             "/usr/apps/" MSG_NOTIFICATION_ICON_DIR "/Message/noti_message_read_report.png"
+#define MSG_DELIVERY_ICON_PATH "/usr/apps/" MSG_NOTIFICATION_ICON_DIR "/Message/noti_message_delivery_report.png"
+#define MSG_REPLY_ICON_PATH                    "/usr/apps/" MSG_NOTIFICATION_ICON_DIR "/Message/noti_message_reply.png"
+#define MSG_SMS_SENDING_FAILED_ICON_PATH               "/usr/apps/" MSG_NOTIFICATION_ICON_DIR "/Message/noti_message_failed.png"
+#define MSG_MMS_SENDING_FAILED_ICON_PATH               "/usr/apps/" MSG_NOTIFICATION_ICON_DIR "/Message/noti_message_mms_failed.png"
+#define MSG_MMS_RETRIVE_FAILED_ICON_PATH               "/usr/apps/" MSG_NOTIFICATION_ICON_DIR "/Message/noti_message_mms_problem.png"
+#define MSG_EMERGENCY_ICON_PATH                "/usr/apps/" MSG_DEFAULT_APP_ID "/res/icons/default/small/noti_emergency_mode.png"
+#define MSG_NO_CONTACT_PROFILE_ICON_PATH       "/usr/apps/" MSG_NOTIFICATION_ICON_DIR "/Contact/noti_contact_default.png"
+#define MSG_MESSAGE_APP_SUB_ICON               "/usr/apps/" MSG_DEFAULT_APP_ID "/res/icons/default/small/org.tizen.message.png"
+
+/* status bar icon */
+#define MSG_NORMAL_STATUS_ICON                         "/usr/apps/" MSG_DEFAULT_APP_ID "/res/icons/default/small/status_bar_message.png"
+#define MSG_FAILED_STATUS_ICON                         "/usr/apps/" MSG_DEFAULT_APP_ID "/res/icons/default/small/status_bar_cancel_message.png"
+#define MSG_DELIVER_REPORT_STATUS_ICON "/usr/apps/" MSG_DEFAULT_APP_ID "/res/icons/default/small/status_bar_delivery_report_message.png"
+#define MSG_READ_REPORT_STATUS_ICON            "/usr/apps/" MSG_DEFAULT_APP_ID "/res/icons/default/small/status_bar_read_report_message.png"
+#define MSG_VOICE_MSG_STATUS_ICON                      "/usr/apps/" MSG_DEFAULT_APP_ID "/res/icons/default/small/status_bar_voicemail.png"
+#define MSG_SIM_FULL_STATUS_ICON               "/usr/apps/" MSG_DEFAULT_APP_ID "/res/icons/default/small/status_bar_sim_card_full.png"
 
 #ifndef TIZEN_I586_ENABLED
-// system string
+/* system string */
 #define NEW_MESSAGE                    "IDS_MSGF_POP_NEW_MESSAGE"
 #define NEW_MESSAGES                   "IDS_MSGF_POP_NEW_MESSAGES"
 #define MSG_UNKNOWN_SENDER     "IDS_MSGF_BODY_UNKNOWN"
 #define MSG_NO_SUBJECT                 "IDS_MSGF_BODY_NO_SUBJECT"
 
 
-// message app string for ticker noti
+/* message app string for ticker noti */
 #define SENDING_MULTIMEDIA_MESSAGE_FAILED      "IDS_MSGF_POP_SENDING_MULTIMEDIA_MESSAGE_FAILED"
 #define MULTIMEDIA_MESSAGE_SENT                                        "IDS_MSGF_POP_MULTIMEDIA_MESSAGE_SENT"
 #define RETRIEVING_MESSAGE_FAILED                                      "IDS_MSGF_POP_RETRIEVING_MESSAGE_FAILED"
 #define SMS_SIM_CARD_FULL                              "IDS_MSG_HEADER_SIM_CARD_FULL"
 #define SMS_MESSAGE_SIZE_OVER_SIM_SLOT_SIZE    "IDS_MSGF_BODY_MESSAGE_IS_TOO_LARGE_TO_STORE_AS_A_SINGLE_MESSAGE_TO_SIM_CARD"
 
-// message app string for quickpanel noti
+/* message app string for quickpanel noti */
 #define MSG_MESSAGE            "IDS_MSGF_BODY_MESSAGE"
 #define VOICE_MAIL                                     "IDS_MSGF_BODY_VOICEMAIL"
 #define NEW_VOICE_MAIL                 "IDS_MSGF_BODY_NEW_VOICEMAIL"
-#define APP_NEW_MESSAGE "IDS_MSGF_POP_NEW_MESSAGE"
-#define APP_NEW_MESSAGES "IDS_MSGF_POP_NEW_MESSAGES"
 #define CB_MESSAGE "IDS_MSGF_BODY_CB_MESSAGES"
 #define PUSH_MESSAGE "IDS_MSGF_BODY_PUSH_MESSAGES"
 #define DELIVERY_MESSAGE "IDS_MSGF_BODY_DELIVERY_REPORT"
 #define FAILED_MSG_EXIST       "IDS_MSG_BODY_FAILED_MESSAGES_EXIST"
 #define ENABLE_EMERGENCY_MODE  "IDS_MSG_BODY_ENABLE_EMERGENCY_MODE_JPN_DCM"
 #define EMERGENCY_MODE_DESCRIPTION     "IDS_MSG_SBODY_TAP_HERE_TO_ENABLE_EMERGENCY_MODE_TO_SAVE_BATTERY_POWER_JPN_DCM"
-#define FAILED_TO_SEND_MESSAGE "IDS_MSG_TPOP_FAILED_TO_SEND_MESSAGE_ABB"
+#define FAILED_TO_SEND_MESSAGE "IDS_MSG_HEADER_FAILED_TO_SEND_MESSAGE_ABB"
+#define MESSAGE_SIZE_UNIT_KB   "IDS_MSGF_BODY_MSGSIZE_KB"
+#define MESSAGE_SIZE_STRING            "IDS_MSGF_BODY_MESSAGE_SIZE"
 #else
-// system string
+/* system string */
 #define NEW_MESSAGE                    "New message"
 #define NEW_MESSAGES                   "New messages"
 #define MSG_UNKNOWN_SENDER     "New message from Unknown."
 #define MSG_NO_SUBJECT                 "No subject"
 
 
-// message app string for ticker noti
+/* message app string for ticker noti */
 #define SENDING_MULTIMEDIA_MESSAGE_FAILED      "Sending multimedia message failed"
 #define MULTIMEDIA_MESSAGE_SENT                                        "Multimedia message sent."
 #define RETRIEVING_MESSAGE_FAILED                                      "Retrieving message failed"
 #define SMS_MESSAGE_MEMORY_FULL                        "Not enough memory. Delete some items."
 #define SMS_FDN_RESTRICTED                             "Unable to send the message while Fixed dialling mode is enabled."
 #define SMS_SIM_CARD_FULL                              "SIM card full"
-#define SMS_MESSAGE_SIZE_OVER_SIM_SLOT_SIZE    "Message is too large to store as a single message to SIM card." //
+#define SMS_MESSAGE_SIZE_OVER_SIM_SLOT_SIZE    "Message is too large to store as a single message to SIM card."
 
-// message app string for quickpanel noti
+/* message app string for quickpanel noti */
 #define MSG_MESSAGE            "Message"
 #define VOICE_MAIL                                     "Voicemail"
 #define NEW_VOICE_MAIL                 "New voicemail"
-#define APP_NEW_MESSAGE "New message"
-#define APP_NEW_MESSAGES "New messages"
 #define CB_MESSAGE "CB messages"
 #define PUSH_MESSAGE "Push messages"
 #define DELIVERY_MESSAGE "Delivery report"
 #define FAILED_MSG_EXIST       "Failed messages exist."
 #define ENABLE_EMERGENCY_MODE  "Enable Emergency mode"
 #define EMERGENCY_MODE_DESCRIPTION     "Tap here to enable Emergency mode to save battery power."
-#define FAILED_TO_SEND_MESSAGE "Failed to send message." //
+#define FAILED_TO_SEND_MESSAGE "Failed to send message."
+#define MESSAGE_SIZE_UNIT_KB   "KB"
+#define MESSAGE_SIZE_STRING            "Message Size"
 #endif
 
 #define NOTIFICATION_PRIV_ID   DEFAULT_SETTING_PATH"/notification_priv_id"
 #define VOICE_NOTI_ID_2                        DEFAULT_SETTING_PATH"/voice_noti_id2"
 #define CB_NOTI_PRIV_ID                DEFAULT_SETTING_PATH"/cb_noti_priv_id"
 #define SIM_MSG_NOTI_PRIV_ID   DEFAULT_SETTING_PATH"/sim_msg_noti_priv_id"
-#define EMERGENCY_MODE_NOTI_ID         DEFAULT_SETTING_PATH"/emergency_noti_id"
 #define MSG_SENTFAIL_NOTI_ID           DEFAULT_SETTING_PATH"/sentfail_noti_id"
 #define SIM_FULL_NOTI_PRIV_ID  DEFAULT_SETTING_PATH"/sim_full_noti_id"
 
 #define MSG_NOTI_TEXT_LEN      (512)
 #define MSG_NOTI_TEXT_LEN_S    (256)
+#define MSG_ACTIVE_NOTI_BUTTON_NUM 3
 
-enum _msg_notification_type_e
-{
+enum _msg_notification_type_e {
        MSG_NOTI_TYPE_ALL = 0x00,
 
-       // Refresh single/multiple notification
+       /* Refresh single/multiple notification */
        MSG_NOTI_TYPE_NORMAL,
        MSG_NOTI_TYPE_CB,
        MSG_NOTI_TYPE_SIM,
        MSG_NOTI_TYPE_FAILED,
 
-       // Add only single notification
+       /* Add only single notification */
        MSG_NOTI_TYPE_VOICE_1,
        MSG_NOTI_TYPE_VOICE_2,
        MSG_NOTI_TYPE_MWI,
@@ -185,13 +186,21 @@ enum _msg_notification_type_e
        MSG_NOTI_TYPE_SIM_FULL,
 };
 
-typedef unsigned char msg_notification_type_t; //_msg_notification_type_e
+enum _msg_active_notification_type_e {
+       MSG_ACTIVE_NOTI_TYPE_NONE,
+       MSG_ACTIVE_NOTI_TYPE_ACTIVE,
+       MSG_ACTIVE_NOTI_TYPE_INSTANT,
+};
+
+typedef unsigned char msg_notification_type_t; /* _msg_notification_type_e */
+typedef unsigned char msg_active_notification_type_t; /* _msg_active_notification_type_e */
 
 msg_error_t MsgInsertNotification(MSG_MESSAGE_INFO_S *msg_info);
 
 msg_error_t MsgAddNotification(msg_notification_type_t noti_type, MSG_MESSAGE_INFO_S *msg_info);
-msg_error_t MsgRefreshNotification(msg_notification_type_t noti_type, bool bFeedback, bool bTicker);
+msg_error_t MsgRefreshNotification(msg_notification_type_t noti_type, bool bFeedback, msg_active_notification_type_t active_type);
 msg_error_t MsgAddReportNotification(msg_notification_type_t noti_type, MSG_MESSAGE_INFO_S *msg_info);
+msg_error_t MsgInsertOnlyActiveNotification(msg_notification_type_t noti_type, MSG_MESSAGE_INFO_S *pMsgInfo);
 msg_error_t MsgDeleteReportNotification(const char *addr);
 
 msg_error_t MsgInsertTicker(const char* pTickerMsg, const char* pLocaleTickerMsg, bool bPlayFeedback, int msgId);
@@ -200,7 +209,7 @@ msg_error_t MsgInitNoti();
 msg_error_t MsgInsertBadge(unsigned int unreadMsgCnt);
 msg_error_t MsgDeleteNoti(msg_notification_type_t noti_type, int simIndex);
 
-void MsgRefreshAllNotification(bool bWithSimNoti, bool bFeedback, bool bTickerNoti);
+void MsgRefreshAllNotification(bool bWithSimNoti, bool bFeedback, msg_active_notification_type_t active_type);
 void MsgDeleteNotification(msg_notification_type_t noti_type, int simIndex);
 void MsgInitReportNotiList();
 
index ab1e279..ed7014f 100755 (executable)
@@ -34,4 +34,4 @@ msg_error_t MsgSensorConnect();
 void MsgSensorDisconnect();
 msg_error_t MsgRegSensorCB(msg_sensor_cb cb);
 
-#endif // MSG_SENSOR_H
+#endif /* MSG_SENSOR_H */
index 0aec565..c9fa4a0 100755 (executable)
@@ -37,8 +37,7 @@ enum _MSG_SOUND_TYPE_E
 /*==================================================================================================
                                 CLASS DEFINITIONS
 ==================================================================================================*/
-class MsgSoundPlayer
-{
+class MsgSoundPlayer {
 public:
        static MsgSoundPlayer* instance();
 
@@ -73,5 +72,5 @@ private:
        char *defaultRingtonePath;
 };
 
-#endif // MSG_SOUND_PLAYER_H
+#endif /* MSG_SOUND_PLAYER_H */
 
index ea67d8e..beba140 100755 (executable)
@@ -35,4 +35,4 @@ msg_error_t MsgGetFilterOperation(bool *pSetFlag);
 bool MsgCheckFilter(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S *pMsgInfo);
 bool MsgCheckFilterByWord(MsgDbHandler *pDbHandle, const char *pMsgText);
 
-#endif // MSG_SPAM_FILTER_H
+#endif /* MSG_SPAM_FILTER_H */
index eb8fe6d..ffe0462 100755 (executable)
@@ -41,7 +41,6 @@ int MsgMoveMessageToStorageHandler(const MSG_CMD_S *pCmd, char **ppEvent);
 int MsgCountMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent);
 int MsgCountMsgByTypeHandler(const MSG_CMD_S *pCmd, char **ppEvent);
 int MsgGetMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent);
-int MsgGetFolderViewListHandler(const MSG_CMD_S *pCmd, char **ppEvent);
 
 int MsgAddFolderHandler(const MSG_CMD_S *pCmd, char **ppEvent);
 int MsgUpdateFolderHandler(const MSG_CMD_S *pCmd, char **ppEvent);
@@ -49,11 +48,10 @@ int MsgDeleteFolderHandler(const MSG_CMD_S *pCmd, char **ppEvent);
 int MsgGetFolderListHandler(const MSG_CMD_S *pCmd, char **ppEvent);
 
 int MsgInitSimBySatHandler(const MSG_CMD_S *pCmd, char **ppEvent);
-int MsgGetMsgTypeHandler(const MSG_CMD_S *pCmd, char **ppEvent);
 
 int MsgGetThreadViewListHandler(const MSG_CMD_S *pCmd, char **ppEvent);
-int MsgGetConversationViewListHandler(const MSG_CMD_S *pCmd, char **ppEvent);
 int MsgDeleteThreadMessageListHandler(const MSG_CMD_S *pCmd, char **ppEvent);
+int MsgSetTempAddressTableHandler(const MSG_CMD_S *pCmd, char **ppEvent);
 
 int MsgCountMsgByContactHandler(const MSG_CMD_S *pCmd, char **ppEvent);
 int MsgGetQuickPanelDataHandler(const MSG_CMD_S *pCmd, char **ppEvent);
index a6dae82..bad0eb2 100755 (executable)
@@ -34,7 +34,6 @@ msg_error_t MsgStoConnectDB();
 msg_error_t MsgStoDisconnectDB();
 
 msg_error_t MsgStoInitDB(bool bSimChanged);
-void MsgfreeMmapMutex();
 
 msg_error_t MsgCreateConversationTable();
 msg_error_t MsgCreateAddressTable();
@@ -73,6 +72,7 @@ msg_error_t MsgStoGetMsgType(msg_message_id_t msgId, MSG_MESSAGE_TYPE_S* pMsgTyp
 msg_error_t MsgStoGetText(msg_message_id_t MsgId, char *pSubject, char *pMsgText);
 msg_error_t MsgStoGetQuickPanelData(msg_quickpanel_type_t Type, MSG_MESSAGE_INFO_S *pMsg);
 msg_error_t MsgStoDeleteThreadMessageList(msg_thread_id_t ThreadId, bool bIncludeProtect, msg_id_list_s *pMsgIdList);
+msg_error_t MsgStoSetTempAddressTable(const char *pSearchVal, int *count);
 msg_error_t MsgStoCountMsgByContact(const MSG_THREAD_LIST_INDEX_S *pAddrInfo, MSG_THREAD_COUNT_INFO_S *pThreadCountInfo);
 msg_error_t MsgStoGetSmsReportStatus(msg_message_id_t msgId, int *count, MSG_REPORT_STATUS_INFO_S **pReportStatus);
 msg_error_t MsgStoGetMmsReportStatus(msg_message_id_t msgId, int *count, MSG_REPORT_STATUS_INFO_S **pReportStatus);
index e8294a6..43dfab4 100755 (executable)
@@ -84,7 +84,7 @@ public:
        void broadcastIncomingMsgCB(const msg_error_t err, const MSG_MESSAGE_INFO_S *msgInfo);
        void broadcastMMSConfCB(const msg_error_t err, const MSG_MESSAGE_INFO_S *msgInfo, const MMS_RECV_DATA_S *mmsRecvData);
        void broadcastPushMsgCB(const msg_error_t err, const MSG_PUSH_MESSAGE_DATA_S *pushData);
-       void broadcastCBMsgCB(const msg_error_t err, const MSG_CB_MSG_S *cbMsg);
+       void broadcastCBMsgCB(const msg_error_t err, const MSG_CB_MSG_S *cbMsg, msg_message_id_t cbMsgId);
        void broadcastSyncMLMsgCB(const msg_error_t err, const MSG_SYNCML_MESSAGE_DATA_S *syncMLData);
        void broadcastLBSMsgCB(const msg_error_t err, const MSG_LBS_MESSAGE_DATA_S *lbsData);
        void broadcastSyncMLMsgOperationCB(const msg_error_t err, const int msgId, const int extId);
index 4ded743..2dc47b6 100755 (executable)
@@ -48,12 +48,10 @@ extern "C"
 ==================================================================================================*/
 
 /**
- * @internal
  * @ingroup MSG_SERVICE_FRAMEWORK
  * @defgroup MSG_SERVICE_FRAMEWORK_CONTROL_MODULE Control API
  * @brief The Control API provides functions to manage message handle and set or get each structure.
  *
- * @internal
  * @addtogroup MSG_SERVICE_FRAMEWORK_CONTROL_MODULE
  * @{
  *
@@ -69,6 +67,7 @@ extern "C"
  * @section MSG_SERVICE_FRAMEWORK_CONTROL_MODULE_FEATURE Related Features
  * This API is related with the following features:\n
  *  - http://tizen.org/feature/network.telephony\n
+ *  - http://tizen.org/feature/network.telephony.sms\n
  *
  * It is recommended to design feature related codes in your application for reliability.\n
  *
@@ -103,6 +102,7 @@ extern "C"
  * @retval MSG_ERR_COMMUNICATION_ERROR Communication error between client and server
  * @retval MSG_ERR_PERMISSION_DENIED   The application does not have the privilege to call this method
  * @retval MSG_ERR_NOT_SUPPORTED       Not supported
+ * @retval MSG_ERR_NOT_ALLOWED_ZONE    Not allowed zone
  */
 
 int msg_open_msg_handle(msg_handle_t *handle);
index 92168ba..407c725 100755 (executable)
@@ -38,9 +38,9 @@
 #define CHECK_MSG_SUPPORTED(feature_name) \
        do { \
                bool bSupported = false; \
-               bSupported = MsgCheckFeatureSupport(feature_name); \
+               bSupported = MsgCheckFeatureSupport((feature_name)); \
                if (bSupported == false) {\
-                       MSG_ERR("Feature [%s] not supported", feature_name);\
+                       MSG_ERR("Feature [%s] not supported", (feature_name));\
                        return MSG_ERR_NOT_SUPPORTED; \
                } \
        } while(0)
@@ -48,9 +48,9 @@
 #define CHECK_MSG_SUPPORTED_RETURN_NULL(feature_name) \
        do { \
                bool bSupported = false; \
-               bSupported = MsgCheckFeatureSupport(feature_name); \
+               bSupported = MsgCheckFeatureSupport((feature_name)); \
                if (bSupported == false) {\
-                       MSG_ERR("Feature [%s] not supported", feature_name);\
+                       MSG_ERR("Feature [%s] not supported", (feature_name));\
                        return NULL; \
                } \
        } while(0)
@@ -59,7 +59,7 @@
                                                                         FUNCTION PROTOTYPES
 ==================================================================================================*/
 
-// message
+/* message */
 void msg_message_create_struct(msg_struct_s *msg_struct);
 int msg_message_release(msg_struct_s **msg_struct);
 
@@ -84,17 +84,16 @@ int msg_message_list_clear(msg_struct_t msg_struct_handle, int field);
 
 
 
-
-// filter
-bool msg_get_filter_info_bool(void *filter, int field);
-int msg_get_filter_info_int(void *filter, int field);
-char *msg_get_filter_info_str(void *filter, int field);
+/* filter */
+int msg_get_filter_info_bool(void *filter, int field, bool *value);
+int msg_get_filter_info_int(void *filter, int field, int *value);
+int msg_get_filter_info_str(void *filter, int field, char *value, int size);
 int msg_set_filter_info_bool(void *filter, int field, bool value);
 int msg_set_filter_info_int(void *filter, int field, int value);
 int msg_set_filter_info_str(void *filter, int field, char *value, int size);
 
 
-// mms
+/* mms */
 msg_struct_s *msg_mms_create_struct(int field);
 void *msg_mms_create_struct_data(int field);
 int msg_mms_release_struct(msg_struct_s **msg_struct_data);
@@ -109,15 +108,14 @@ int msg_mms_set_int_value(msg_struct_s *msg_struct, int field, int value);
 int msg_mms_set_str_value(msg_struct_s *msg_struct, int field, char *value, int size);
 int msg_mms_set_bool_value(msg_struct_s *msg_struct, int field, bool value);
 int msg_mms_set_struct_handle(msg_struct_s *msg_struct, int field, msg_struct_s *value);
-int msg_mms_set_list_handle(msg_struct_s *msg_struct, int field, msg_list_handle_t value);
 
 int msg_mms_list_append(msg_struct_t msg_struct_handle, int field, msg_struct_t *item);
 
-void convert_to_mmsdata(const msg_struct_s *pSrc, MMS_MESSAGE_DATA_S *pDest);
-void convert_from_mmsdata(const MMS_MESSAGE_DATA_S *pSrc, msg_struct_s *pDest);
 void convert_to_hidden_mmsdata(MMS_DATA_S *pSrc, msg_struct_s *pDest);
 void convert_from_hidden_mmsdata(msg_struct_s *pSrc, MMS_DATA_S *pDest);
-// setting
+
+
+/* setting */
 int msg_setting_get_int_value(msg_struct_s *msg_struct, int field, int *value);
 int msg_setting_get_str_value(msg_struct_s *msg_struct, int field, char *src, int size);
 int msg_setting_get_bool_value(msg_struct_s *msg_struct, int field, bool *value);
@@ -127,103 +125,101 @@ int msg_setting_set_int_value(msg_struct_s *msg_struct, int field, int value);
 int msg_setting_set_str_value(msg_struct_s *msg_struct, int field, char *value, int size);
 int msg_setting_set_bool_value(msg_struct_s *msg_struct, int field, bool value);
 
-int msg_get_smsc_opt_int(void *smsc_opt, int field);
+int msg_get_smsc_opt_int(void *smsc_opt, int field, int *value);
 int msg_set_smsc_opt_int(void *smsc_opt, int field, int value);
 int msg_get_smsc_opt_list(void *smsc_opt, int field, void **value);
 
-int msg_get_smsc_info_int(void *smsc_info, int field);
+int msg_get_smsc_info_int(void *smsc_info, int field, int *value);
 int msg_set_smsc_info_int(void *smsc_info, int field, int value);
-char* msg_get_smsc_info_str(void *smsc_info, int field);
+int msg_get_smsc_info_str(void *smsc_info, int field, char *value, int size);
 int msg_set_smsc_info_str(void *smsc_info, int field, char *val, int size);
 
-int msg_get_cb_option_int(void *cb_opt, int field);
+int msg_get_cb_option_int(void *cb_opt, int field, int *value);
 int msg_set_cb_option_int(void *cb_opt, int field, int value);
-bool msg_get_cb_option_bool(void *cb_opt, int field);
+int msg_get_cb_option_bool(void *cb_opt, int field, bool *value);
 int msg_set_cb_option_bool(void *cb_opt, int field, bool value);
 int msg_get_cb_option_list(void *cb_opt, int field, void **value);
 
-int msg_get_cb_channel_info_int(void *cb_ch_info, int field);
+int msg_get_cb_channel_info_int(void *cb_ch_info, int field, int *value);
 int msg_set_cb_channel_info_int(void *cb_ch_info, int field, int value);
-bool msg_get_cb_channel_info_bool(void *cb_ch_info, int field);
+int msg_get_cb_channel_info_bool(void *cb_ch_info, int field, bool *value);
 int msg_set_cb_channel_info_bool(void *cb_ch_info, int field, bool value);
-char *msg_get_cb_channel_info_str(void *cb_ch_info, int field);
+int msg_get_cb_channel_info_str(void *cb_ch_info, int field, char *value, int size);
 int msg_set_cb_channel_info_str(void *cb_ch_info, int field, char *val, int size);
 
-int msg_get_sms_send_opt_int(void *sms_send_opt, int field);
+int msg_get_sms_send_opt_int(void *sms_send_opt, int field, int *value);
 int msg_set_sms_send_opt_int(void *sms_send_opt, int field, int value);
-bool msg_get_sms_send_opt_bool(void *sms_send_opt, int field);
+int msg_get_sms_send_opt_bool(void *sms_send_opt, int field, bool *value);
 int msg_set_sms_send_opt_bool(void *sms_send_opt, int field, bool value);
 
-int msg_get_mms_send_opt_int(void *mms_send_opt, int field);
+int msg_get_mms_send_opt_int(void *mms_send_opt, int field, int *value);
 int msg_set_mms_send_opt_int(void *mms_send_opt, int field, int value);
-bool msg_get_mms_send_opt_bool(void *mms_send_opt, int field);
+int msg_get_mms_send_opt_bool(void *mms_send_opt, int field, bool *value);
 int msg_set_mms_send_opt_bool(void *mms_send_opt, int field, bool value);
 
-int msg_get_mms_recv_opt_int(void *mms_recv_opt, int field);
+int msg_get_mms_recv_opt_int(void *mms_recv_opt, int field, int *value);
 int msg_set_mms_recv_opt_int(void *mms_recv_opt, int field, int value);
-bool msg_get_mms_recv_opt_bool(void *mms_recv_opt, int field);
+int msg_get_mms_recv_opt_bool(void *mms_recv_opt, int field, bool *value);
 int msg_set_mms_recv_opt_bool(void *mms_recv_opt, int field, bool value);
 
-int msg_get_push_msg_opt_int(void *push_msg_opt, int field);
+int msg_get_push_msg_opt_int(void *push_msg_opt, int field, int *value);
 int msg_set_push_msg_opt_int(void *push_msg_opt, int field, int value);
-bool msg_get_push_msg_opt_bool(void *push_msg_opt, int field);
+int msg_get_push_msg_opt_bool(void *push_msg_opt, int field, bool *value);
 int msg_set_push_msg_opt_bool(void *push_msg_opt, int field, bool value);
 
-int msg_get_voice_msg_opt_int(void *voice_msg_opt, int field);
+int msg_get_voice_msg_opt_int(void *voice_msg_opt, int field, int *value);
 int msg_set_voice_msg_opt_int(void *voice_msg_opt, int field, int value);
-char *msg_get_voice_msg_opt_str(void *voice_msg_opt, int field);
+int msg_get_voice_msg_opt_str(void *voice_msg_opt, int field, char *value, int size);
 int msg_set_voice_msg_opt_str(void *voice_msg_opt, int field, char *val, int size);
 
-int msg_get_general_opt_int(void *general_opt, int field);
+int msg_get_general_opt_int(void *general_opt, int field, int *value);
 int msg_set_general_opt_int(void *general_opt, int field, int value);
-bool msg_get_general_opt_bool(void *general_opt, int field);
+int msg_get_general_opt_bool(void *general_opt, int field, bool *value);
 int msg_set_general_opt_bool(void *general_opt, int field, bool value);
-char *msg_get_general_opt_str(void *general_opt, int field);
+int msg_get_general_opt_str(void *general_opt, int field, char *value, int size);
 int msg_set_general_opt_str(void *general_opt, int field, char *val, int size);
 
-int msg_get_msgsize_opt_int(void *size_opt, int field);
+int msg_get_msgsize_opt_int(void *size_opt, int field, int *value);
 int msg_set_msgsize_opt_int(void *size_opt, int field, int value);
 
 /* Wap Push */
-char* msg_push_config_get_str(void *event_info, int field, int size);
-bool msg_push_config_get_bool(void *event_info, int field);
+int msg_push_config_get_str(void *event_info, int field, char *value, int size);
+int msg_push_config_get_bool(void *event_info, int field, bool *value);
 int msg_push_config_set_str(void *event_info, int field, char *value, int size);
 int msg_push_config_set_bool(void *event, int field, bool value);
 
 /* added internal apis for new managed api (storage) */
-int msg_syncml_info_get_int(void *syncml_info, int field);
-int msg_count_info_get_int(void *count_info, int field);
-int msg_thread_count_get_int(void *count_info, int field);
-int msg_thread_index_get_int(void *index_info, int field);
-int msg_sortrule_get_int(void *sort_info, int field);
-int msg_folder_info_get_int(void *folder_info, int field);
-int msg_thread_info_get_int(void *data, int field);
-int msg_conv_info_get_int(void *data, int field);
-int msg_search_condition_get_int(void *condition_info, int field);
-int msg_list_condition_get_int(void *condition_info, int field);
-int msg_report_status_get_int(void *report_info, int field);
-char* msg_report_status_get_str(void *report_info, int field);
-char* msg_folder_info_get_str(void *folder_info, int field);
-char *msg_thread_info_get_str(void *data, int field);
-char *msg_conv_info_get_str(void *data, int field);
-char* msg_search_condition_get_str(void *condition_info, int field, int size);
-char* msg_list_condition_get_str(void *condition_info, int field, int size);
-bool msg_sendopt_get_bool(void *send_opt, int field);
-bool msg_sortrule_get_bool(void *sort_rule, int field);
-bool msg_conv_get_bool(void *data, int field);
-bool msg_thread_info_get_bool(void *data, int field);
-bool msg_list_condition_get_bool(void *data, int field);
+int msg_syncml_info_get_int(void *syncml_info, int field, int *value);
+int msg_count_info_get_int(void *count_info, int field, int *value);
+int msg_thread_count_get_int(void *count_info, int field, int *value);
+int msg_thread_index_get_int(void *index_info, int field, int *value);
+int msg_sortrule_get_int(void *sort_info, int field, int *value);
+int msg_folder_info_get_int(void *folder_info, int field, int *value);
+int msg_thread_info_get_int(void *data, int field, int *value);
+int msg_conv_info_get_int(void *data, int field, int *value);
+int msg_list_condition_get_int(void *condition_info, int field, int *value);
+int msg_report_status_get_int(void *report_info, int field, int *value);
+int msg_report_status_get_str(void *report_info, int field, char *value, int size);
+int msg_folder_info_get_str(void *folder_info, int field, char *value, int size);
+int msg_thread_info_get_str(void *data, int field, char *value, int size);
+int msg_conv_info_get_str(void *data, int field, char *value, int size);
+int msg_list_condition_get_str(void *condition_info, int field, char *value, int size);
+int msg_sendopt_get_bool(void *send_opt, int field, bool *value);
+int msg_sortrule_get_bool(void *sort_rule, int field, bool *value);
+int msg_conv_get_bool(void *data, int field, bool *value);
+int msg_thread_info_get_bool(void *data, int field, bool *value);
+int msg_list_condition_get_bool(void *data, int field, bool *value);
 int msg_sendopt_get_struct_handle(msg_struct_s *msg_struct, int field, void **value);
 int msg_syncml_get_struct_handle(msg_struct_s *msg_struct, int field, void **value);
 int msg_thread_index_get_struct_handle(msg_struct_s *msg_struct, int field, void **value);
 int msg_list_condition_get_struct_handle(msg_struct_s *msg_struct, int field, void **value);
-int msg_address_info_get_int(void *addr_info, int field);
-int msg_mms_sendopt_get_int(void *opt_info, int field);
-int msg_reject_message_get_int(void *msg_info, int field);
-char* msg_address_info_get_str(void *addr_info, int field, int size);
-char* msg_reject_message_get_str(void *msg_info, int field, int size);
-bool msg_mms_sendopt_get_bool(void *opt_info, int field);
-bool msg_sms_sendopt_get_bool(void *opt_info, int field);
+int msg_address_info_get_int(void *addr_info, int field, int *value);
+int msg_mms_sendopt_get_int(void *opt_info, int field, int *value);
+int msg_reject_message_get_int(void *msg_info, int field, int *value);
+int msg_address_info_get_str(void *addr_info, int field, char *value, int size);
+int msg_reject_message_get_str(void *msg_info, int field, char *value, int size);
+int msg_mms_sendopt_get_bool(void *opt_info, int field, bool *value);
+int msg_sms_sendopt_get_bool(void *opt_info, int field, bool *value);
 
 int msg_syncml_info_set_int(void *syncml_info, int field, int value);
 int msg_count_info_set_int(void *count_info, int field, int value);
@@ -231,11 +227,9 @@ int msg_thread_count_set_int(void *count_info, int field, int value);
 int msg_thread_index_set_int(void *index_info, int field, int value);
 int msg_sortrule_set_int(void *sort_info, int field, int value);
 int msg_folder_info_set_int(void *folder_info, int field, int value);
-int msg_search_condition_set_int(void *condition_info, int field, int value);
 int msg_list_condition_set_int(void *condition_info, int field, int value);
 int msg_report_status_set_int(void *report_info, int field, int value);
 int msg_folder_info_set_str(void *folder_info, int field, char *value, int size);
-int msg_search_condition_set_str(void *condition_info, int field, char *value, int size);
 int msg_list_condition_set_str(void *condition_info, int field, char *value, int size);
 int msg_sendopt_set_bool(void *send_opt, int field, bool value);
 int msg_sortrule_set_bool(void *sort_rule, int field, bool value);
@@ -254,13 +248,13 @@ int msg_mms_sendopt_set_bool(void *option, int field, bool value);
 int msg_sms_sendopt_set_bool(void *option, int field, bool value);
 
 /* added internal apis for new managed api (transport) */
-int msg_request_get_int(void *request_info, int field);
+int msg_request_get_int(void *request_info, int field, int *value);
 int msg_request_get_struct_handle(msg_struct_s *msg_struct, int field, void **value);
 int msg_request_set_int(void *request_info, int field, int value);
 int msg_request_set_struct_handle(msg_struct_s *msg_struct, int field, msg_struct_s *value);
-int msg_sent_status_get_int(MSG_SENT_STATUS_S *sent_status_info, int field);
+int msg_sent_status_get_int(MSG_SENT_STATUS_S *sent_status_info, int field, int *value);
 
-char* msg_media_item_get_str(void *data, int field, int size);
+int msg_media_item_get_str(void *data, int field, char *value, int size);
 int msg_media_item_get_int(void *data, int field, int *value);
 
 int msg_conversation_get_list_hnd(void *data, int field, void **value);
index 837af02..2cd864f 100755 (executable)
@@ -30,12 +30,10 @@ extern "C"
 
 
 /**
- * @internal
  * @ingroup MSG_SERVICE_FRAMEWORK
  * @defgroup MSG_SERVICE_FRAMEWORK_STORAGE_MODULE Storage API
  * @brief The Storage API provides functions to get message information with multiple types.
  *
- * @internal
  * @addtogroup MSG_SERVICE_FRAMEWORK_STORAGE_MODULE
  * @{
  *
@@ -51,6 +49,7 @@ extern "C"
  * @section MSG_SERVICE_FRAMEWORK_STORAGE_MODULE_FEATURE Related Features
  * This API is related with the following features:\n
  *  - http://tizen.org/feature/network.telephony\n
+ *  - http://tizen.org/feature/network.telephony.sms\n
  *
  * It is recommended to design feature related codes in your application for reliability.\n
  *
index 792d6ef..397f01e 100755 (executable)
@@ -28,7 +28,6 @@
 ==================================================================================================*/
 
 /**
- * @internal
  * @addtogroup MSG_SERVICE_FRAMEWORK_STORAGE_MODULE
  * @{
  */
@@ -37,8 +36,7 @@
 /**
  *     @brief  The structure type that represents message ID list.
  */
-typedef struct
-{
+typedef struct {
        int                                     nCount;                         /**< The count of message ID informatioin */
        msg_message_id_t        *msgIdList;                     /**< The pointer to message ID informatioin */
 }msg_id_list_s;
@@ -105,8 +103,7 @@ typedef void (*msg_storage_change_cb)(msg_handle_t handle, msg_storage_change_ty
  *     @brief Enumeration for the values of a storage type. \n
  *            This enum is used as the value of msg_storage_id_t.
  */
-enum _MSG_STORAGE_ID_E
-{
+enum _MSG_STORAGE_ID_E {
        MSG_STORAGE_UNKNOWN = 0,                /**< Storage ID is unknown. */
        MSG_STORAGE_PHONE,                          /**< Storage ID is Phone. */
        MSG_STORAGE_SIM,                                /**< Storage ID is SIM card in slot 1. */
@@ -118,8 +115,7 @@ enum _MSG_STORAGE_ID_E
  *     @brief  Enumeration for the values of a storage type. \n
  *             This enum is used as the value of msg_folder_id_t.
  */
-enum _MSG_FOLDER_ID_E
-{
+enum _MSG_FOLDER_ID_E {
        MSG_IOSBOX_ID = -1,                         /**< Indicates INBOX, OUTBOX and SENTBOX group folder ID. (Only for search option.) */
        MSG_ALLBOX_ID = 0,                              /**< Indicates INBOX, OUTBOX, SENTBOX and DRAFTBOX group folder ID. (Only for search option.) */
        MSG_INBOX_ID = 1,                               /**< Indicates INBOX folder ID */
@@ -136,8 +132,7 @@ enum _MSG_FOLDER_ID_E
  *     @brief  Enumeration for the values of a folder type. \n
  *             This enum is used as the value of msg_folder_type_t.
  */
-enum _MSG_FOLDER_TYPE_E
-{
+enum _MSG_FOLDER_TYPE_E {
        MSG_FOLDER_TYPE_INBOX = 1,              /**< Inbox folder */
        MSG_FOLDER_TYPE_OUTBOX,             /**< Outbox folder */
        MSG_FOLDER_TYPE_DRAFT,              /**< Draft folder */
@@ -150,8 +145,7 @@ enum _MSG_FOLDER_TYPE_E
  *     @brief  Enumeration for the values of a sort type. \n
  *             This enum is used as the value of msg_sort_type_t.
  */
-enum _MSG_SORT_TYPE_E
-{
+enum _MSG_SORT_TYPE_E {
        MSG_SORT_BY_UNKNOWN = 0,                        /**< Unknown sort type */
        MSG_SORT_BY_DISPLAY_FROM,                   /**< Sort by display from */
        MSG_SORT_BY_DISPLAY_TO,                     /**< Sort by display to */
@@ -169,8 +163,7 @@ enum _MSG_SORT_TYPE_E
  *     @brief  Enumeration for the values of a message type for quick panel. \n
  *             This enum is used as the value of msg_quickpanel_type_t.
  */
-enum _MSG_QUICKPANEL_TYPE_E
-{
+enum _MSG_QUICKPANEL_TYPE_E {
        MSG_QUICKPANEL_SMS = 0,                         /**< Quickpanel SMS */
        MSG_QUICKPANEL_MMS,                                     /**< Quickpanel MMS */
        MSG_QUICKPANEL_DELIVER_REP,                     /**< Quickpanel delivery report */
@@ -183,8 +176,7 @@ enum _MSG_QUICKPANEL_TYPE_E
 /**
  *     @brief  Enumeration for the values of a count limit for each mailbox.
  */
-enum _MSG_COUNT_LIMIT_MAILBOX_TYPE_E
-{
+enum _MSG_COUNT_LIMIT_MAILBOX_TYPE_E {
        MSG_COUNT_LIMIT_INBOX_TYPE,                             /**< Message count limit of inbox folder*/
        MSG_COUNT_LIMIT_OUTBOX_TYPE,                    /**< Message count limit of outbox folder*/
        MSG_COUNT_LIMIT_SENTBOX_TYPE,                   /**< Message count limit of sentbox folder*/
@@ -197,8 +189,7 @@ enum _MSG_COUNT_LIMIT_MAILBOX_TYPE_E
 /**
  *     @brief  Enumeration for the values of a count limit for each message type.
  */
-enum _MSG_COUNT_LIMIT_MSG_TYPE_E
-{
+enum _MSG_COUNT_LIMIT_MSG_TYPE_E {
        MSG_COUNT_LIMIT_SMS_TYPE,                               /**< Message count limit for SMS */
        MSG_COUNT_LIMIT_MMS_TYPE,                               /**< Message count limit for MMS */
        MSG_COUNT_LIMIT_CB_TYPE,                                /**< Message count limit for callback messages */
@@ -212,8 +203,7 @@ enum _MSG_COUNT_LIMIT_MSG_TYPE_E
  *     @brief  Enumeration for the values of a storage change type. \n
  *             This enum is used with storage change callback functions.
  */
-enum _MSG_STORAGE_CHANGE_TYPE_E
-{
+enum _MSG_STORAGE_CHANGE_TYPE_E {
        // msg data
        MSG_STORAGE_CHANGE_INSERT = 1,                  /**< Indicates storage change by an INSERT operation*/
        MSG_STORAGE_CHANGE_UPDATE,                              /**< Indicates storage change by an UPDATE operation*/
index 16c1ec4..2e71c1d 100755 (executable)
@@ -29,12 +29,10 @@ extern "C"
 #endif
 
 /**
- * @internal
  * @ingroup MSG_SERVICE_FRAMEWORK
  * @defgroup MSG_SERVICE_FRAMEWORK_TRANSPORT_MODULE Transport API
  * @brief The Transport API provides functions to send SMS/MMS and register incoming/sending/syncML/report callback.
  *
- * @internal
  * @addtogroup MSG_SERVICE_FRAMEWORK_TRANSPORT_MODULE
  * @{
  *
@@ -55,6 +53,7 @@ extern "C"
  * @section MSG_SERVICE_FRAMEWORK_TRANSPORT_MODULE_FEATURE Related Features
  * This API is related with the following features:\n
  *  - http://tizen.org/feature/network.telephony\n
+ *  - http://tizen.org/feature/network.telephony.sms\n
  *  - http://tizen.org/feature/network.telephony.mms\n
  *
  * It is recommended to design feature related codes in your application for reliability.\n
@@ -373,7 +372,7 @@ int msg_reg_report_message_callback(msg_handle_t handle, msg_report_msg_incoming
  * @retval MSG_ERR_NOT_SUPPORTED     Not supported
  */
 
-int msg_syncml_message_operation(msg_handle_t handle,  msg_message_id_t msgId);
+int msg_syncml_message_operation(msg_handle_t handle, msg_message_id_t msgId);
 
 
 /**
index d27811f..2bd4c2c 100755 (executable)
@@ -25,7 +25,6 @@
 #include "msg_storage_types.h"
 
 /**
- * @internal
  * @addtogroup MSG_SERVICE_FRAMEWORK_TRANSPORT_MODULE
  * @{
  */
index 3cfa5ab..021ab27 100755 (executable)
@@ -28,7 +28,6 @@
 #endif
 
 /**
- * @internal
  * @addtogroup MSG_SERVICE_FRAMEWORK
  * @{
  */
 /**
  * @brief      Definition for maximum file path length
  */
-#define        MSG_FILEPATH_LEN_MAX 1024
+#define MSG_FILEPATH_LEN_MAX 1024
 
-// setting
+/* setting */
 /**
  * @brief      Definition for maximum SMSC name length
  */
 /**
  * @brief      Definition for maximum file name length
  */
-#define        MSG_FILENAME_LEN_MAX 1024
+#define MSG_FILENAME_LEN_MAX 1024
 
 /**
  * @brief      Definition for maximum message id length
  */
-#define        MSG_MSG_ID_LEN 1024
+#define MSG_MSG_ID_LEN 1024
 
 /**
  * @brief      Definition for maximum in transition id length
 /**
  * @brief      Definition for maximum region id length
  */
-#define        MAX_SMIL_REGION_ID 151
+#define MAX_SMIL_REGION_ID 151
 
 /**
  * @brief      Definition for maximum transition id length
 /**
  * @brief      Definition for maximum fit size
  */
-#define        MAX_SMIL_FIT_SIZE 31
+#define MAX_SMIL_FIT_SIZE 31
 
 /**
  * @brief      Definition for maximum pages in a MMS
  */
-#define        MMS_PAGE_MAX 20
+#define MMS_PAGE_MAX 20
 
 /**
  * @brief      Definition for maximum media in a MMS
  */
-#define        MMS_MEDIA_MAX 60
+#define MMS_MEDIA_MAX 60
 
 /**
  * @brief      Definition for maximum alternate text length
  */
-#define        MAX_SMIL_ALT_LEN 255
+#define MAX_SMIL_ALT_LEN 255
 
 
-//font size
+/*font size */
 /**
  * @brief      Definition for small font size
  */
-#define        MMS_SMIL_FONT_SIZE_SMALL 24
+#define MMS_SMIL_FONT_SIZE_SMALL 24
 
 /**
  * @brief      Definition for normal font size
  */
-#define        MMS_SMIL_FONT_SIZE_NORMAL 30
+#define MMS_SMIL_FONT_SIZE_NORMAL 30
 
 /**
  * @brief      Definition for large font size
  */
-#define        MMS_SMIL_FONT_SIZE_LARGE 36
+#define MMS_SMIL_FONT_SIZE_LARGE 36
 
 /**
  * @brief      Definition for maximum length of java app ID
@@ -434,7 +433,7 @@ typedef unsigned int msg_message_backup_type_t;
  */
 typedef unsigned int msg_thread_id_t;
 
-// filter
+/* filter */
 /**
  * @brief  The filter ID.
  */
@@ -492,7 +491,6 @@ enum _MSG_STRUCT_E {
        MSG_STRUCT_THREAD_LIST_INDEX = 0x3400,                  /**< Indicates the MSG_STRUCT_THREAD_LIST_INDEX */
        MSG_STRUCT_SORT_RULE = 0x3500,                          /**< Indicates the MSG_STRUCT_SORT_RULE */
        MSG_STRUCT_FOLDER_INFO = 0x3600,                        /**< Indicates the MSG_STRUCT_FOLDER_INFO */
-       MSG_STRUCT_SEARCH_CONDITION = 0x3700,                   /**< Indicates the MSG_STRUCT_SEARCH_CONDITION */
        MSG_STRUCT_REPORT_STATUS_INFO = 0x3800,                 /**< Indicates the MSG_STRUCT_REPORT_STATUS_INFO */
        MSG_STRUCT_MSG_LIST_CONDITION = 0x3900,                 /**< Indicates the MSG_LIST_CONDITION  */
 
@@ -535,7 +533,6 @@ enum _MSG_MESSAGE_INFO_E_ {
        MSG_MESSAGE_DEST_PORT_INT,                          /**< Indicates the recipient port number, not greater than 16 bit */
        MSG_MESSAGE_SRC_PORT_INT,                           /**< Indicates the sender port number, not greater than 16 bit */
        MSG_MESSAGE_ATTACH_COUNT_INT,                       /**< Indicates the count of attached files in MMS. */
-       MSG_MESSAGE_THUMBNAIL_PATH_STR,                     /**< Indicates the thumbnail path of message. */
        MSG_MESSAGE_DATA_SIZE_INT,                          /**< Indicates the data size. The unit is byte. */
        MSG_MESSAGE_SMS_DATA_STR,                           /**< Indicates the message payload information as a body. default character encoding is UTF-8*/
        MSG_MESSAGE_MMS_TEXT_STR,                           /**< Indicates the text part of MMS message payload. default character encoding is UTF-8  */
@@ -684,7 +681,7 @@ enum _MSG_STRUCT_SMS_SEND_OPT_E {
  *          This enum is used as member of #msg_struct_t for MSG_STRUCT_SETTING_MMS_SEND_OPT.
  */
 enum _MSG_STRUCT_MMS_SEND_OPT_E {
-       MSG_MMS_SENDOPT_CLASS_TYPE_INT = MSG_STRUCT_SETTING_MMS_SEND_OPT+1,  /**< Indicates the class type of message.  See enum _MSG_MMS_MSG_CLASS_TYPE_E */
+       MSG_MMS_SENDOPT_CLASS_TYPE_INT = MSG_STRUCT_SETTING_MMS_SEND_OPT+1,  /**< Indicates the class type of message. See enum _MSG_MMS_MSG_CLASS_TYPE_E */
        MSG_MMS_SENDOPT_PRIORITY_TYPE_INT,                                   /**< Indicates the priority of the message. See enum _MSG_PRIORITY_TYPE_E */
        MSG_MMS_SENDOPT_EXPIRY_TIME_INT,                                     /**< Indicates the time when the message is to be removed from the MMSC. See enum _MSG_MMS_EXPIRY_TIME_E */
        MSG_MMS_SENDOPT_DELIVERY_TIME_INT,                                   /**< Indicates the message transmission time which is set in the MMSC. See enum _MSG_MMS_DELIVERY_TIME_E */
@@ -728,7 +725,7 @@ enum _MSG_STRUCT_GENERAL_OPT_E {
        MSG_GENERAL_MSG_NOTIFICATION_BOOL,                              /**< Indicates whether notification for incoming message is shown or not. */
        MSG_GENERAL_MSG_VIBRATION_BOOL,                                 /**< Indicates whether vibration for incoming message is run or not. */
        MSG_GENERAL_MSG_PREVIEW_BOOL,                                   /**< Indicates whether preview for incoming message is shown or not. */
-       MSG_GENERAL_RINGTONE_TYPE_INT,                                  /**< Indicates the message ringtone type. */
+       MSG_GENERAL_RINGTONE_TYPE_INT,                                  /**< Indicates the message ringtone type. See enum _MSG_RINGTONE_TYPE_E */
        MSG_GENERAL_RINGTONE_PATH_STR                                   /**< Indicates the message ringtone path */
 };
 
@@ -840,7 +837,7 @@ enum MSG_MMS_PAGE_INFO_E {
  *  @brief  Enumeration for the values of MMS media informations. \n
  *          This enum is used as member of #msg_struct_t for MSG_STRUCT_MMS_MEDIA.
  */
-enum MSG_MMS_MEDIA_INFO {
+enum MSG_MMS_MEDIA_INFO_E {
        MSG_MMS_MEDIA_TYPE_INT = MSG_STRUCT_MMS_MEDIA+1,  /**< Indicates the SMIL media type. See enum MmsSmilMediaType */
        MSG_MMS_MEDIA_SRC_STR,                            /**< Indicates the media source name */
        MSG_MMS_MEDIA_FILENAME_STR,                       /**< Indicates the file name */
@@ -1020,18 +1017,6 @@ enum MSG_FOLDER_INFO_E {
 };
 
 /**
- *  @brief  Enumeration for the values of conditions for searching message. \n
- *          This enum is used as member of #msg_struct_t for MSG_STRUCT_SEARCH_CONDITION.
- */
-enum MSG_SEARCH_CONDITION_E {
-       MSG_SEARCH_CONDITION_FOLDERID_INT = MSG_STRUCT_SEARCH_CONDITION+1,  /**< The folder ID for searching messages. See enum _MSG_FOLDER_ID_E */
-       MSG_SEARCH_CONDITION_MSGTYPE_INT,                                   /**< The message type for searching messages. See enum _MSG_MESSAGE_TYPE_E */
-       MSG_SEARCH_CONDITION_ADDRESS_VALUE_STR,                             /**< The address value for searching messages. */
-       MSG_SEARCH_CONDITION_SEARCH_VALUE_STR,                              /**< The string to search */
-       MSG_SEARCH_CONDITION_RESERVED_INT,                                  /**< The search condition reserved*/
-};
-
-/**
  *  @brief  Enumeration for the values of report message status. \n
  *          This enum is used as member of #msg_struct_t for MSG_STRUCT_REPORT_STATUS_INFO.
  */
@@ -1157,8 +1142,7 @@ enum MSG_CB_MSG_E {
  *  @brief  Enumeration for the values of a message class type. \n
  *             This enum is used as the value of MSG_CLASS_TYPE_T.
  */
-enum _MSG_CLASS_TYPE_E
-{
+enum _MSG_CLASS_TYPE_E {
        MSG_CLASS_0 = 0,                /**< Immediately presented on the recipient device display */
        MSG_CLASS_1,                    /**< Stored in the mobile equipment or SIM (depending on memory availability) */
        MSG_CLASS_2,                    /**< Stored in SIM */
@@ -1171,8 +1155,7 @@ enum _MSG_CLASS_TYPE_E
  *          More members maybe added if needed. \n
  *             This enum is used as the value of msg_message_type_t.
  */
-enum _MSG_MESSAGE_TYPE_E
-{
+enum _MSG_MESSAGE_TYPE_E {
        MSG_TYPE_INVALID = 0,               /** < Invalid Type Message */
 
        MSG_TYPE_SMS,                       /** < Normal SMS Message */
@@ -1203,8 +1186,7 @@ enum _MSG_MESSAGE_TYPE_E
  *  @brief  Enumeration for the backup type of Message. More members maybe added if needed \n
  *             This enum is used as the value of msg_message_backup_type_t.
  */
-enum _MSG_MESSAGE_BACKUP_TYPE_E
-{
+enum _MSG_MESSAGE_BACKUP_TYPE_E {
        MSG_BACKUP_TYPE_ALL = 0,                /**< Backup all*/
        MSG_BACKUP_TYPE_SMS,                    /**< Backup SMS*/
        MSG_BACKUP_TYPE_MMS,                    /**< Backup MMS*/
@@ -1215,8 +1197,7 @@ enum _MSG_MESSAGE_BACKUP_TYPE_E
  *             Success code is zero, but all error codes SHOULD be negative and smaller than MSG_SUCCESS. \n
  *             This enum is used as the value of msg_error_t.
  */
-enum _MSG_ERROR_E
-{
+enum _MSG_ERROR_E {
        MSG_SUCCESS = 0,                        /**< Successful */
 
        MSG_ERR_NULL_MSGHANDLE = -1,            /**< Message handle is NULL */
@@ -1302,6 +1283,7 @@ enum _MSG_ERROR_E
        MSG_ERR_STORE_RESTRICT = -60,           /**< Storage restricted error*/
        MSG_ERR_DB_BUSY = -61,                  /**< DB file locked*/
        MSG_ERR_NOT_SUPPORTED = -63,            /**< Not supported */
+       MSG_ERR_NOT_ALLOWED_ZONE = -100,        /**< Not allowed zone */
 };
 
 
@@ -1309,8 +1291,7 @@ enum _MSG_ERROR_E
  *  @brief  Enumeration for the values of a message priority. \n
  *             This enum is used as the value of msg_priority_type_t.
  */
-enum _MSG_PRIORITY_TYPE_E
-{
+enum _MSG_PRIORITY_TYPE_E {
        MSG_MESSAGE_PRIORITY_LOW,               /**< Low priority */
        MSG_MESSAGE_PRIORITY_NORMAL,    /**< Normal priority */
        MSG_MESSAGE_PRIORITY_HIGH,              /**< High priority */
@@ -1321,8 +1302,7 @@ enum _MSG_PRIORITY_TYPE_E
  *  @brief  Enumeration for the values of a network status. \n
  *             This enum is used as the value of msg_network_status_t.
  */
-enum _MSG_NETWORK_STATUS_E
-{
+enum _MSG_NETWORK_STATUS_E {
        MSG_NETWORK_NOT_SEND = 0,                            /**< Message is not sending */
        MSG_NETWORK_SENDING,                                 /**< Sending message */
        MSG_NETWORK_SEND_SUCCESS,                            /**< Message is sent successfully */
@@ -1334,11 +1314,11 @@ enum _MSG_NETWORK_STATUS_E
        MSG_NETWORK_RETRIEVING,                              /**< Retrieving message */
        MSG_NETWORK_RETRIEVE_SUCCESS,                        /**< Message is retrieved successfully */
        MSG_NETWORK_RETRIEVE_FAIL,                           /**< Failed to retrieve */
-       MSG_NETWORK_SEND_TIMEOUT,                            /**< Send timed-out*/ // WILL BE REMOVED
-       MSG_NETWORK_SEND_FAIL_MANDATORY_INFO_MISSING,        /**< Send failed due to mandatory info missing*/ // WILL BE REMOVED
-       MSG_NETWORK_SEND_FAIL_TEMPORARY,                     /**<Send failed temporarily*/ // WILL BE REMOVED
-       MSG_NETWORK_SEND_FAIL_BY_MO_CONTROL_WITH_MOD,        /**< Send failed by MO control- ALLOWED WITH MOD*/ // WILL BE REMOVED
-       MSG_NETWORK_SEND_FAIL_BY_MO_CONTROL_NOT_ALLOWED,     /**< Send failed by MO control*/ // WILL BE REMOVED
+       MSG_NETWORK_SEND_TIMEOUT,                            /**< Send timed-out*/ /* WILL BE REMOVED */
+       MSG_NETWORK_SEND_FAIL_MANDATORY_INFO_MISSING,        /**< Send failed due to mandatory info missing*/ /* WILL BE REMOVED */
+       MSG_NETWORK_SEND_FAIL_TEMPORARY,                     /**<Send failed temporarily*/ /* WILL BE REMOVED */
+       MSG_NETWORK_SEND_FAIL_BY_MO_CONTROL_WITH_MOD,        /**< Send failed by MO control- ALLOWED WITH MOD*/ /* WILL BE REMOVED */
+       MSG_NETWORK_SEND_FAIL_BY_MO_CONTROL_NOT_ALLOWED,     /**< Send failed by MO control*/ /* WILL BE REMOVED */
        MSG_NETWORK_DELIVER_PENDING,                         /**< Delivery pending*/
        MSG_NETWORK_DELIVER_EXPIRED,                         /**< Delivery expired*/
        MSG_NETWORK_SEND_PENDING,                            /**< Send is pending*/
@@ -1355,8 +1335,7 @@ enum _MSG_NETWORK_STATUS_E
  *  @brief  Enumeration for the values of an address type. \n
  *             This enum is used as the value of msg_address_type_t.
 */
-enum _MSG_ADDRESS_TYPE_E
-{
+enum _MSG_ADDRESS_TYPE_E {
        MSG_ADDRESS_TYPE_UNKNOWN = 0,   /**< The address type is unknown. */
        MSG_ADDRESS_TYPE_PLMN,                  /**< The address type is for a phone number like +1012345678. */
        MSG_ADDRESS_TYPE_EMAIL,                 /**< The address type is for an email address like abc@example.email. */
@@ -1367,8 +1346,7 @@ enum _MSG_ADDRESS_TYPE_E
  *  @brief  Enumeration for the values of a recipient type. \n
  *             This enum is used as the value of msg_recipient_type_t.
 */
-enum _MSG_RECIPIENT_TYPE_E
-{
+enum _MSG_RECIPIENT_TYPE_E {
        MSG_RECIPIENTS_TYPE_UNKNOWN = 0,    /**< The recipient type is unknown. */
        MSG_RECIPIENTS_TYPE_TO,             /**< The recipient type is for "To". */
        MSG_RECIPIENTS_TYPE_CC,             /**< The recipient type is for "Cc". */
@@ -1380,8 +1358,7 @@ enum _MSG_RECIPIENT_TYPE_E
  *  @brief  Enumeration for the values of a direction type. \n
  *             This enum is used as the value of msg_direction_type_t.
  */
-enum _MSG_DIRECTION_TYPE_E
-{
+enum _MSG_DIRECTION_TYPE_E {
        MSG_DIRECTION_TYPE_MO = 0,              /**< The direction type is for mobile originated */
        MSG_DIRECTION_TYPE_MT,                  /**< The direction type is for mobile terminated */
 };
@@ -1391,8 +1368,7 @@ enum _MSG_DIRECTION_TYPE_E
  *  @brief  Enumeration for the values of a string encoding type. \n
  *             This enum is used as the value of msg_encode_type_t.
  */
-enum _MSG_ENCODE_TYPE_E
-{
+enum _MSG_ENCODE_TYPE_E {
        MSG_ENCODE_GSM7BIT = 0,      /**< The string encoding type is GSM7BIT */
        MSG_ENCODE_8BIT,             /**< The string encoding type is 8 BIT */
        MSG_ENCODE_UCS2,             /**< The string encoding type is UCS2 */
@@ -1411,16 +1387,15 @@ enum _MSG_ENCODE_TYPE_E
  *  @brief  Enumeration for the action type of Push Message. \n
  *             This enum is used as the value of msg_push_action_t.
  */
-enum _MSG_PUSH_ACTION_E
-{
-       // SI Action
+enum _MSG_PUSH_ACTION_E {
+       /* SI Action */
        MSG_PUSH_SI_ACTION_SIGNAL_NONE = 0x00,          /**<  No signal for push message action */
        MSG_PUSH_SI_ACTION_SIGNAL_LOW,                          /**< Low signal for push message action */
        MSG_PUSH_SI_ACTION_SIGNAL_MEDIUM,                       /**< Medium signal for push message action */
        MSG_PUSH_SI_ACTION_SIGNAL_HIGH,                         /**< High signal for push message action */
        MSG_PUSH_SI_ACTION_DELETE,                                      /**< Delete push message */
 
-       // SL Action
+       /* SL Action */
        MSG_PUSH_SL_ACTION_EXECUTE_LOW,                         /**< Action: execute-low*/
        MSG_PUSH_SL_ACTION_EXECUTE_HIGH,                        /**< Action: execute-high*/
        MSG_PUSH_SL_ACTION_CACHE,                                       /**< Action: cache*/
@@ -1431,8 +1406,7 @@ enum _MSG_PUSH_ACTION_E
  *  @brief  Enumeration for the type of SyncML Message. \n
  *             This enum is used as the value of msg_syncml_message_type_t.
  */
- enum _MSG_SYNCML_MESSAGE_TYPE_E
- {
+ enum _MSG_SYNCML_MESSAGE_TYPE_E {
        DM_WBXML,                                       /** < DM WBXML SyncML Message */
        DM_XML,                                         /** < DM XML SyncML Message */
        DM_NOTIFICATION,                        /** < DM Notification SyncML Message */
@@ -1451,15 +1425,14 @@ enum _MSG_PUSH_ACTION_E
  *  @brief  Enumeration for the values of a Delivery Report Status. \n
  *             This enum is used as the value of msg_delivery_report_status_t.
 */
- enum _MSG_DELIVERY_REPORT_STATUS_E
- {
+ enum _MSG_DELIVERY_REPORT_STATUS_E  {
         MSG_DELIVERY_REPORT_NONE                               =       -1,     /**< Indicates the status unavailable */
         MSG_DELIVERY_REPORT_EXPIRED                    =       0,      /**< Indicates the expired status of message */
         MSG_DELIVERY_REPORT_SUCCESS                    =       1,      /**< Indicates the success status of message */
         MSG_DELIVERY_REPORT_REJECTED                   =       2,      /**< Indicates the rejected status of message */
         MSG_DELIVERY_REPORT_DEFERRED                   =       3,      /**< Indicates the deferred status of message */
         MSG_DELIVERY_REPORT_UNRECOGNISED               =       4,      /**< Indicates the unrecognized status of message */
-        MSG_DELIVERY_REPORT_INDETERMINATE              =       5,      /**< Indicates the intermediate status of message */
+        MSG_DELIVERY_REPORT_INDETERMINATE      =       5,      /**< Indicates the intermediate status of message */
         MSG_DELIVERY_REPORT_FORWARDED                  =       6,      /**< Indicates the forwarded status of message */
         MSG_DELIVERY_REPORT_UNREACHABLE                =       7,      /**< Indicates the unreachable status of message */
         MSG_DELIVERY_REPORT_ERROR                              =       8,      /**< Indicates the error status of message */
@@ -1470,10 +1443,9 @@ enum _MSG_PUSH_ACTION_E
  *  @brief  Enumeration for the values of a Read Report Status. \n
  *             This enum is used as the value of msg_read_report_status_t.
 */
-enum _MSG_READ_REPORT_STATUS_E
- {
+enum _MSG_READ_REPORT_STATUS_E  {
         MSG_READ_REPORT_NONE                   =       -1,       /**< Indicates the status unavailable */
-        MSG_READ_REPORT_IS_READ                =       0,        /**< Indicates the message is read */
+        MSG_READ_REPORT_IS_READ                        =       0,        /**< Indicates the message is read */
         MSG_READ_REPORT_IS_DELETED     =       1,        /**< Indicates the message is deleted */
         MSG_READ_REPORT_REJECT_BY_USER =       2,        /**< Indicates read report reject by user*/
  };
@@ -1482,20 +1454,18 @@ enum _MSG_READ_REPORT_STATUS_E
  *  @brief  Enumeration for the values of a Report Type. \n
  *             This enum is used as the value of msg_read_report_status_t.
 */
-enum _MSG_REPORT_TYPE_E
- {
+enum _MSG_REPORT_TYPE_E  {
         MSG_REPORT_TYPE_DELIVERY       =       0,      /**< Indicates the type is delivery report*/
-        MSG_REPORT_TYPE_READ   =       1,          /**< Indicates the type is read report*/
+        MSG_REPORT_TYPE_READ           =       1,          /**< Indicates the type is read report*/
         MSG_REPORT_TYPE_READ_REPORT_SENT = 2,  /**< Indicates the type is read report sent*/
  };
 
-// filter
+/* filter */
 /**
  *  @brief  Enumeration for the values of a filter type. \n
  *             This enum is used as the value of msg_filter_type_t.
  */
-enum _MSG_FILTER_TYPE_E
-{
+enum _MSG_FILTER_TYPE_E {
        MSG_FILTER_BY_WORD = 0,             /**< Filtered by sub string in the text */
        MSG_FILTER_BY_ADDRESS_SAME,         /**< Filtered by address exactly same as */
        MSG_FILTER_BY_ADDRESS_START,        /**< Filtered by address start with */
@@ -1504,17 +1474,16 @@ enum _MSG_FILTER_TYPE_E
 };
 
 
-// mms
+/* mms */
 
 /**
  *  @brief  Enumeration for the values of a MIME type.
  */
-typedef enum   _MimeType
-{
-       // 0
+typedef enum   _MimeType {
+       /* 0 */
        MIME_ASTERISK                                       = 0x0000, /**< Indicates the valid default MIME type  */
 
-       // 1
+       /* 1 */
        MIME_APPLICATION_XML                                = 0x1000, /**< Indicates the application XML type */
        MIME_APPLICATION_WML_XML                            = 0x1001, /**< Indicates the application WML XML type  */
        MIME_APPLICATION_XHTML_XML                          = 0x1002, /**< Indicates the application XHTML XML type  */
@@ -1531,7 +1500,7 @@ typedef enum      _MimeType
        MIME_APPLICATION_RAM                                = 0x100d, /**< Indicates the application RAM type */
        MIME_APPLICATION_ASTERIC                            = 0x100e, /**< Indicates the application as main type and generic sub type */
 
-       // 16
+       /* 16 */
        MIME_APPLICATION_VND_WAP_XHTMLXML                   = 0x1100, /**< Indicates the application wap xhtml xml type */
        MIME_APPLICATION_VND_WAP_WMLC                       = 0x1101, /**< Indicates the application wap wmlc type */
        MIME_APPLICATION_VND_WAP_WMLSCRIPTC                 = 0x1102, /**< Indicates the application wap wmlscrpitc type */
@@ -1566,7 +1535,7 @@ typedef enum      _MimeType
        MIME_APPLICATION_VND_POWERPOINT                     = 0x111f, /**< Indicates the application Power point type */
        MIME_APPLICATION_VND_MSWORD                         = 0x1120, /**< Indicates the application MS Word type */
 
-       // 49
+       /* 49 */
        MIME_APPLICATION_X_HDMLC                            = 0x1200, /**< Indicates the application x hdmlc type */
        MIME_APPLICATION_X_X968_USERCERT                    = 0x1201, /**< Indicates the application x x968 user certified type */
        MIME_APPLICATION_X_WWW_FORM_URLENCODED              = 0x1202, /**< Indicates the application x www form url encoded type */
@@ -1575,7 +1544,7 @@ typedef enum      _MimeType
        MIME_APPLICATION_X_EXCEL                            = 0x1205, /**< Indicates the application x excel type */
        MIME_APPLICATION_X_POWERPOINT                       = 0x1206, /**< Indicates the application x power point type */
 
-       // 56
+       /* 56 */
        MIME_AUDIO_BASIC                                    = 0x2000, /**< Indicates the audio basic type  */
        MIME_AUDIO_MPEG                                     = 0x2001, /**< Indicates the audio mpeg type  */
        MIME_AUDIO_MP3                                      = 0x2002, /**< Indicates the audio mp3 type  */
@@ -1606,10 +1575,10 @@ typedef enum    _MimeType
        MIME_AUDIO_IMY                                      = 0x201b, /**< Indicates the audio imy type  */
        MIME_AUDIO_MOBILE_XMF                               = 0x201c, /**< Indicates the audio mobile xmf type  */
 
-       //85
+       /* 85 */
        MIME_AUDIO_VND_RN_REALAUDIO                         = 0x2100, /**< Indicates the audio rn real audio type  */
 
-       // 86
+       /* 86 */
        MIME_AUDIO_X_MPEG                                   = 0x2200, /**< Indicates the audio x mpeg type  */
        MIME_AUDIO_X_MP3                                    = 0x2201, /**< Indicates the audio x mp3 type  */
        MIME_AUDIO_X_MPEG3                                  = 0x2202, /**< Indicates the audio x mpeg3 type  */
@@ -1630,7 +1599,7 @@ typedef enum      _MimeType
        MIME_AUDIO_X_MS_ASF                                 = 0x2211, /**< Indicates the audio ms asf  type  */
        MIME_AUDIO_X_XMF                                    = 0x2212, /**< Indicates the audio x xmf  type  */
 
-       // 105
+       /* 105 */
        MIME_IMAGE_GIF                                      = 0x3000, /**< Indicates the image gif type  */
        MIME_IMAGE_JPEG                                     = 0x3001, /**< Indicates the image jpeg type  */
        MIME_IMAGE_JPG                                      = 0x3002, /**< Indicates the image jpg type  */
@@ -1643,18 +1612,18 @@ typedef enum    _MimeType
        MIME_IMAGE_SVG                                      = 0x3009, /**< Indicates the image svg type  */
        MIME_IMAGE_SVG1                                     = 0x300a, /**< Indicates the image svg1 type  */
 
-       // 116
+       /* 116 */
        MIME_IMAGE_VND_WAP_WBMP                             = 0x3100, /**< Indicates the image vnd wap wbmp type  */
        MIME_IMAGE_VND_TMO_GIF                              = 0x3101, /**< Indicates the image vnd tmo gif type  */
        MIME_IMAGE_VND_TMO_JPG                              = 0x3102, /**< Indicates the image vnd tmo jpg type  */
 
-       // 119
+       /* 119 */
        MIME_IMAGE_X_BMP                                    = 0x3200, /**< Indicates the image x bmp type  */
 
-       // 120
+       /* 120 */
        MIME_MESSAGE_RFC822                                 = 0x4000, /**< Indicates the message rfc822 type  */
 
-       // 121
+       /* 121 */
        MIME_MULTIPART_MIXED                                = 0x5000, /**< Indicates the multipart mixed type  */
        MIME_MULTIPART_RELATED                              = 0x5001, /**< Indicates the multipart related type  */
        MIME_MULTIPART_ALTERNATIVE                          = 0x5002, /**< Indicates the multipart alternative type  */
@@ -1663,7 +1632,7 @@ typedef enum      _MimeType
        MIME_MULTIPART_REPORT                               = 0x5005, /**< Indicates the multipart report type  */
        MIME_MULTIPART_VOICE_MESSAGE                        = 0x5006, /**< Indicates the multipart voice message type  */
 
-       // 128
+       /* 128 */
        MIME_TEXT_TXT                                       = 0x6000, /**< Indicates the text txt type  */
        MIME_TEXT_HTML                                      = 0x6001, /**< Indicates the text html type  */
        MIME_TEXT_PLAIN                                     = 0x6002, /**< Indicates the text plain type  */
@@ -1672,7 +1641,7 @@ typedef enum      _MimeType
        MIME_TEXT_IMELODY                                   = 0x6005, /**< Indicates the text imelody type  */
        MIME_TEXT_CALENDAR                                  = 0x6006, /**< Indicates the text calendar type */
 
-       // 134
+       /* 134 */
        MIME_TEXT_VND_WAP_WMLSCRIPT                         = 0x6100, /**< Indicates the text wap wmlscript  type  */
        MIME_TEXT_VND_WAP_WML                               = 0x6101, /**< Indicates the text wap wml  type  */
        MIME_TEXT_VND_WAP_WTA_EVENT                         = 0x6102, /**< Indicates the text wap wta event  type  */
@@ -1682,7 +1651,7 @@ typedef enum      _MimeType
        MIME_TEXT_VND_WAP_CO                                = 0x6106, /**< Indicates the text wap co  type  */
        MIME_TEXT_VND_SUN_J2ME_APP_DESCRIPTOR               = 0x6107, /**< Indicates the text sun j2me type  */
 
-       // 142
+       /* 142 */
        MIME_TEXT_X_HDML                                    = 0x6200, /**< Indicates the x html  type  */
        MIME_TEXT_X_VCALENDAR                               = 0x6201, /**< Indicates the x calendar  type  */
        MIME_TEXT_X_VCARD                                   = 0x6202, /**< Indicates the x vcard  type  */
@@ -1691,7 +1660,7 @@ typedef enum      _MimeType
        MIME_TEXT_X_VNOTE                                   = 0x6205, /**< Indicates the x vnote  type  */
        MIME_TEXT_X_VTODO                                   = 0x6206, /**< Indicates the x todo  type  */
 
-       // 149
+       /* 149 */
        MIME_VIDEO_MPEG4                                    = 0x7000, /**< Indicates the mpeg4  type  */
        MIME_VIDEO_MP4                                      = 0x7001, /**< Indicates the mp4  type  */
        MIME_VIDEO_H263                                     = 0x7002, /**< Indicates the h263  type  */
@@ -1703,11 +1672,11 @@ typedef enum    _MimeType
        MIME_VIDEO_MPEG                                     = 0x7008, /**< Indicates the mpeg  type  */
        MIME_VIDEO_MOV                                      = 0x7009, /**< Indicates the mov  type  */
 
-       // 158
+       /* 158 */
        MIME_VIDEO_VND_RN_REALVIDEO                         = 0x7100, /**< Indicates the pn real video type  */
        MIME_VIDEO_VND_RN_REALMEDIA                         = 0x7101, /**< Indicates the pn multi rate real media type  */
 
-       // 160
+       /* 160 */
        MIME_VIDEO_X_MP4                                    = 0x7200, /**< Indicates the video x mp4 type  */
        MIME_VIDEO_X_PV_MP4                                 = 0x7201, /**< Indicates the video x pv mp4 type  */
        MIME_VIDEO_X_PN_REALVIDEO                           = 0x7202, /**< Indicates the x pn real video type  */
@@ -1724,20 +1693,18 @@ typedef enum    _MimeType
 /**
  *  @brief  Enumeration for the values of a DRM type.
  */
-typedef enum
-{
-       MSG_DRM_TYPE_NONE       = 0, /**< Indicates the DRM type none */
+typedef enum {
+       MSG_DRM_TYPE_NONE               = 0, /**< Indicates the DRM type none */
        MSG_DRM_TYPE_FL         = 1, /**< Indicates the forward lock */         /* 2004-07-09: forwardLock type */
        MSG_DRM_TYPE_CD         = 2, /**< Indicates the combined delivery */    /* 2004-07-09: combined delivery type */
        MSG_DRM_TYPE_SD         = 3, /**< Indicates the separate delivery */    /* 2004-07-09: seperate delivery type */
-       MSG_DRM_TYPE_SSD        = 4      /**< Indicates the special separate delivery */        // 2005-02-28: add Special Sperate Delivery
+       MSG_DRM_TYPE_SSD                = 4      /**< Indicates the special separate delivery */        /* 2005-02-28: add Special Sperate Delivery */
 }MsgDrmType;
 
 /**
  *  @brief  Enumeration for the values of a SMIL region type.
  */
-typedef enum _REGION_FIT_TYPE_T
-{
+typedef enum _REGION_FIT_TYPE_T {
        MMSUI_IMAGE_REGION_FIT_HIDDEN,   /**< Indicates the hidden fit type */
        MMSUI_IMAGE_REGION_FIT_MEET,     /**< Indicates the meet fit type */
 }REGION_FIT_TYPE_T;
@@ -1746,8 +1713,7 @@ typedef enum _REGION_FIT_TYPE_T
 /**
  *  @brief  Enumeration for the values of a SMIL media type.
  */
-typedef enum
-{
+typedef enum {
        MMS_SMIL_MEDIA_INVALID = 0,       /**< Indicates the invalid media type */
        MMS_SMIL_MEDIA_IMG,               /**< Indicates the image media */
        MMS_SMIL_MEDIA_AUDIO,             /**< Indicates the audio media */
@@ -1761,8 +1727,7 @@ typedef enum
 /**
  *  @brief  Enumeration for the values of a SMIL transition type.
  */
-typedef enum
-{
+typedef enum {
        MMS_SMIL_TRANS_NONE = 0,         /**< Indicates the transition type none */                     /* default */
        MMS_SMIL_TRANS_SLIDEWIPE = 1,    /**< Indicates the slide wipe transition */
        MMS_SMIL_TRANS_BARWIPE = 2,      /**< Indicates the bar wipe transition */
@@ -1780,8 +1745,7 @@ typedef enum
 /**
  *  @brief  Enumeration for the values of a SMIL transition sub type.
  */
-typedef enum
-{
+typedef enum {
        MMS_SMIL_TRANS_SUB_NONE = 0,          /**< Indicates the transition sub type none */
        MMS_SMIL_TRANS_SUB_FROM_LEFT = 1,     /**< Indicates the from left transition */        /* slideWipe's default */
        MMS_SMIL_TRANS_SUB_FROM_TOP = 2,      /**< Indicates the from top transition */
@@ -1796,8 +1760,7 @@ typedef enum
 /**
  *  @brief  Enumeration for the values of a text font type.
  */
-typedef enum
-{
+typedef enum {
        MMS_SMIL_FONT_TYPE_NONE = 0,     /**< Indicates the font type none */
        MMS_SMIL_FONT_TYPE_NORMAL = 1,   /**< Indicates the font type normal */
        MMS_SMIL_FONT_TYPE_ITALIC = 2,   /**< Indicates the font type italic */
@@ -1808,17 +1771,16 @@ typedef enum
 /**
  *  @brief  Enumeration for the values of a MMS text direction.
  */
-typedef enum   _MmsTextDir{
+typedef enum   _MmsTextDir {
        MMS_TEXT_DIRECTION_INVALID = -1, /**< Indicates the invalid direction */
        MMS_TEXT_DIRECTION_RIGHT = 0,    /**< Indicates the right direction */
-       MMS_TEXT_DIRECTION_DOWN,         /**< Indicates the down direction */           // supported to GC
+       MMS_TEXT_DIRECTION_DOWN,         /**< Indicates the down direction */           /* supported to GC */
 } MmsTextDirection;
 
 /**
  *  @brief  Enumeration for the values of MMS Read Report Sent Status.
  */
-typedef enum
-{
+typedef enum {
        MMS_RECEIVE_READ_REPORT_NO_SEND,    /**< Not sent yet */
        MMS_RECEIVE_READ_REPORT_MUST_SEND,  /**< Not sent yet, but will be sent */
        MMS_RECEIVE_READ_REPORT_SENT,       /**< Sent */
@@ -1826,14 +1788,13 @@ typedef enum
 } MmsRecvReadReportSendStatus ;
 
 
-// setting
+/* setting */
 
 /**
  *  @brief  Enumeration for the values of an option type. \n
  *             This enum is used as the value of MSG_OPTION_TYPE_T.
  */
-enum _MSG_OPTION_TYPE_E
-{
+enum _MSG_OPTION_TYPE_E {
        MSG_GENERAL_OPT,            /**< General option */
        MSG_SMS_SENDOPT,            /**< SMS send option */
        MSG_SMSC_LIST,              /**< SMSC list option */
@@ -1853,8 +1814,7 @@ enum _MSG_OPTION_TYPE_E
  *  @brief  Enumeration for the values of an SMS network mode. \n
  *             This enum is used as the value of MSG_SMS_NETWORK_MODE_T.
  */
-enum _MSG_SMS_NETWORK_MODE_E
-{
+enum _MSG_SMS_NETWORK_MODE_E {
        MSG_SMS_NETWORK_PS_ONLY = 0x01,     /**< Packet switched */
        MSG_SMS_NETWORK_CS_ONLY = 0x02,     /**< Circuit switched */
        MSG_SMS_NETWORK_PS_FIRST = 0x03,    /**< Packet switching preferred */
@@ -1865,8 +1825,7 @@ enum _MSG_SMS_NETWORK_MODE_E
  *  @brief  Enumeration for the value of period of playing alert tone. \n
  *             The values for this type SHOULD be in MSG_ALERT_TONE_T.
  */
-enum _MSG_ALERT_TONE_E
-{
+enum _MSG_ALERT_TONE_E {
        MSG_ALERT_TONE_ONCE,        /**< Play alert tone once*/
        MSG_ALERT_TONE_2MINS,       /**< Repeat alarm in 2 mins*/
        MSG_ALERT_TONE_5MINS,       /**< Repeat alarm in 5 mins*/
@@ -1878,8 +1837,7 @@ enum _MSG_ALERT_TONE_E
  *  @brief  Enumeration for the value of a default storage to save SMS. \n
  *             The values for this type SHOULD be in MSG_SMS_SAVE_STORAGE_T.
  */
-enum _MSG_SMS_SAVE_STORAGE_E
-{
+enum _MSG_SMS_SAVE_STORAGE_E {
        MSG_SMS_SAVE_STORAGE_SIM,           /**< Save SMS to SIM*/
        MSG_SMS_SAVE_STORAGE_PHONE,         /**< Save SMS to phone*/
 };
@@ -1889,8 +1847,7 @@ enum _MSG_SMS_SAVE_STORAGE_E
  *  @brief  Enumeration for the values of the type of number for SMS center address. \n
  *             This enum is used as the value of MSG_SMS_TON_T.
  */
-enum _MSG_SMS_TON_E
-{
+enum _MSG_SMS_TON_E {
        MSG_TON_UNKNOWN = 0,            /**< Unknown */
        MSG_TON_INTERNATIONAL,          /**< International */
        MSG_TON_NATIONAL,               /**< National */
@@ -1906,8 +1863,7 @@ enum _MSG_SMS_TON_E
  *  @brief  Enumeration for the values of the numbering plan ID for SMS center address. \n
  *             This enum is used as the value of MSG_SMS_NPI_T.
  */
-enum _MSG_SMS_NPI_E
-{
+enum _MSG_SMS_NPI_E {
        MSG_NPI_UNKNOWN = 0,                        /**< Unknown */
        MSG_NPI_ISDN = 1,                           /**< ISDN */
        MSG_NPI_DATA = 3,                           /**< Data */
@@ -1924,8 +1880,7 @@ enum _MSG_SMS_NPI_E
  *  @brief  Enumeration for the values of the protocol ID for SMS center address. \n
  *             This enum is used as the value of MSG_SMS_PID_T.
  */
-enum  _MSG_SMS_PID_E
-{
+enum  _MSG_SMS_PID_E {
        MSG_PID_NONE,       /**< None */
        MSG_PID_TEXT,       /**< Text */
        MSG_PID_VOICE,      /**< Voice */
@@ -1947,8 +1902,7 @@ enum  _MSG_SMS_PID_E
  *     197 to 255 : (TP-VP - 192) x 1 week
  *
  */
-enum  _MSG_VAL_PERIOD_E
-{
+enum  _MSG_VAL_PERIOD_E {
        MSG_VAL_ZERO = 0,               /**< Validity period is zero */
        MSG_VAL_1DAY = 167,             /**< Validity period is 1 day */
        MSG_VAL_2DAYS = 168,            /**< Validity period is 2 days */
@@ -1967,8 +1921,7 @@ enum  _MSG_VAL_PERIOD_E
  *  @brief  Enumeration for the values of the MMS expiry time. \n
  *             This enum is used as the value of MSG_MMS_EXPIRY_TIME_T.
  */
-enum  _MSG_MMS_EXPIRY_TIME_E
-{
+enum  _MSG_MMS_EXPIRY_TIME_E {
        MSG_EXPIRY_TIME_MAXIMUM = 0,            /**< Expiry time is zero */
        MSG_EXPIRY_TIME_1DAY = 86400,           /**< Expiry time is 1 day */
        MSG_EXPIRY_TIME_2DAYS = 2*86400,        /**< Expiry time is 2 days */
@@ -1981,8 +1934,7 @@ enum  _MSG_MMS_EXPIRY_TIME_E
  *  @brief  Enumeration for the values of the MMS delivery time. \n
  *             This enum is used as the value of MSG_MMS_DELIVERY_TIME_T.
  */
-enum  _MSG_MMS_DELIVERY_TIME_E
-{
+enum  _MSG_MMS_DELIVERY_TIME_E {
        MSG_DELIVERY_TIME_IMMEDIATLY = 0,           /**< Immediate MMS delivery */
        MSG_DELIVERY_TIME_1HOUR = 3600,             /**< MMS delivery in 1 hour */
        MSG_DELIVERY_TIME_1DAY = 86400,             /**< MMS delivery in 1 day */
@@ -1995,8 +1947,7 @@ enum  _MSG_MMS_DELIVERY_TIME_E
  *  @brief  Enumeration for the values of the MMS class type. \n
  *             This enum is used as the value of MSG_MMS_MSG_CLASS_TYPE_T.
  */
-enum _MSG_MMS_MSG_CLASS_TYPE_E
-{
+enum _MSG_MMS_MSG_CLASS_TYPE_E {
        MSG_CLASS_PERSONAL,             /**<Personal message class*/
        MSG_CLASS_ADVERTISEMENT,        /**<Advertisement message class*/
        MSG_CLASS_INFORMATIONAL,        /**<Informational message class */
@@ -2009,8 +1960,7 @@ enum _MSG_MMS_MSG_CLASS_TYPE_E
  *  @brief  Enumeration for the values of the MMS reply charging type. \n
  *             This enum is used as the value of MSG_MMS_REPLY_CHARGING_TYPE_T.
  */
-enum _MSG_MMS_REPLY_CHARGING_TYPE_E
-{
+enum _MSG_MMS_REPLY_CHARGING_TYPE_E {
        MSG_REPLY_CHARGING_NONE,                    /**<Reply-Charging none */
        MSG_REPLY_CHARGING_REQUESTED,               /**<Reply-Charging requested */
        MSG_REPLY_CHARGING_REQUESTED_TEXT_ONLY,     /**<Reply-Charging requested text-only */
@@ -2024,8 +1974,7 @@ enum _MSG_MMS_REPLY_CHARGING_TYPE_E
  *  @brief  Enumeration for the values of the MMS creation mode. \n
  *             This enum is used as the value of MSG_MMS_CREATION_MODE_T.
  */
-enum _MSG_MMS_CREATION_MODE_E
-{
+enum _MSG_MMS_CREATION_MODE_E {
        MSG_CREATION_MODE_RESTRICTED,           /**< MMS created in restricted mode */
        MSG_CREATION_MODE_WARNING,              /**< MMS created in warning mode */
        MSG_CREATION_MODE_FREE                  /**< MMS created in free mode */
@@ -2036,8 +1985,7 @@ enum _MSG_MMS_CREATION_MODE_E
  *  @brief  Enumeration for the values of the retrieve type for MMS home network. \n
  *             This enum is used as the value of MSG_MMS_HOME_RETRIEVE_TYPE_T.
  */
-enum _MSG_MMS_HOME_RETRIEVE_TYPE_E
-{
+enum _MSG_MMS_HOME_RETRIEVE_TYPE_E {
        MSG_HOME_AUTO_DOWNLOAD,             /**< Home auto download */
        MSG_HOME_MANUAL,                    /**< Home manual */
        MSG_HOME_RESTRICTED,                /**< Home restricted */
@@ -2050,8 +1998,7 @@ enum _MSG_MMS_HOME_RETRIEVE_TYPE_E
  *  @brief  Enumeration for the values of the retrieve type for MMS abroad network. \n
  *             This enum is used as the value of MSG_MMS_ABROAD_RETRIEVE_TYPE_T.
  */
-enum _MSG_MMS_ABROAD_RETRIEVE_TYPE_E
-{
+enum _MSG_MMS_ABROAD_RETRIEVE_TYPE_E {
        MSG_ABROAD_AUTO_DOWNLOAD,   /**< Abroad auto download */
        MSG_ABROAD_MANUAL,          /**< Abroad manual */
        MSG_ABROAD_RESTRICTED,      /**< Abroad restricted */
@@ -2064,8 +2011,7 @@ enum _MSG_MMS_ABROAD_RETRIEVE_TYPE_E
  *  @brief  Enumeration for the values of the frequency of sending MMS read report. \n
  *             This enum is used as the value of MSG_MMS_SEND_READ_REPORT_T.
  */
-enum _MSG_MMS_SEND_READ_REPORT_E
-{
+enum _MSG_MMS_SEND_READ_REPORT_E {
        MSG_SEND_READ_REPORT_ALWAYS,    /**< Read report always */
        MSG_SEND_READ_REPORT_NEVER,     /**< Read report never */
        MSG_SEND_READ_REPORT_REQUEST,   /**< Read report request */
@@ -2077,8 +2023,7 @@ enum _MSG_MMS_SEND_READ_REPORT_E
  *  @brief  Enumeration for the values of the service type for a push message. \n
  *             This enum is used as the value of MSG_PUSH_SERVICE_TYPE_T.
  */
-enum _MSG_PUSH_SERVICE_TYPE_E
-{
+enum _MSG_PUSH_SERVICE_TYPE_E {
        MSG_PUSH_SERVICE_ALWAYS,    /**< Push message service always */
        MSG_PUSH_SERVICE_PROMPT,    /**< Push message service prompt */
        MSG_PUSH_SERVICE_NEVER,     /**< Push message service never */
@@ -2089,8 +2034,7 @@ enum _MSG_PUSH_SERVICE_TYPE_E
  *  @brief  Enumeration for the values of the language type for a cell broadcasting message. \n
  *             This enum is used as the value of MSG_CB_LANGUAGE_TYPE_T.
  */
-enum _MSG_CB_LANGUAGE_TYPE_E
-{
+enum _MSG_CB_LANGUAGE_TYPE_E {
        MSG_CBLANG_TYPE_ALL,            /**< CB check all */
        MSG_CBLANG_TYPE_ENG,            /**< CB message English  */
        MSG_CBLANG_TYPE_GER,            /**< CB message Germany */
@@ -2108,8 +2052,7 @@ enum _MSG_CB_LANGUAGE_TYPE_E
  *  @brief  Enumeration for the values of SIM status. \n
  *             This enum is used as the value of MSG_SIM_STATUS_T.
  */
-enum _MSG_SIM_STATUS_E
-{
+enum _MSG_SIM_STATUS_E {
        MSG_SIM_STATUS_NORMAL = 0,          /**< SIM normal */
        MSG_SIM_STATUS_CHANGED,             /**< SIM changed */
        MSG_SIM_STATUS_NOT_FOUND,           /**< SIM not found */
@@ -2119,8 +2062,7 @@ enum _MSG_SIM_STATUS_E
  *  @brief  Enumeration for the values of a message ringtone type. \n
  *             This enum is used as the value of MSG_RINGTONE_TYPE_T.
  */
-enum _MSG_RINGTONE_TYPE_E
-{
+enum _MSG_RINGTONE_TYPE_E {
        MSG_RINGTONE_TYPE_DEFAULT = 0,  /**< Default ringtone type */
        MSG_RINGTONE_TYPE_USER,         /**< User defined ringtone type */
        MSG_RINGTONE_TYPE_SILENT        /**< Silent type */
@@ -2130,8 +2072,7 @@ enum _MSG_RINGTONE_TYPE_E
  *  @brief  Enumeration for the values of a SIM index(SIM slot number). \n
  *             This enum is used as the value of msg_sim_slot_id_t.
  */
-enum _MSG_SIM_SLOT_ID_E
-{
+enum _MSG_SIM_SLOT_ID_E {
        MSG_SIM_SLOT_ID_1 = 1,  /**SIM Slot #1 */
        MSG_SIM_SLOT_ID_2,      /**SIM Slot #2 */
 };
index 3f90d85..c886208 100755 (executable)
@@ -31,6 +31,7 @@
 #include "MsgCmdTypes.h"
 #include "MsgInternalTypes.h"
 #include "MsgIpcSocket.h"
+#include "MsgMutex.h"
 
 /*==================================================================================================
                                      CLASS DEFINITIONS
@@ -42,11 +43,11 @@ class MsgHandle
                MsgHandle();
                virtual ~MsgHandle();
 
-               // Control
+               /* Control */
                void openHandle();
                void closeHandle(MsgHandle* pHandle);
 
-               // Transport
+               /* Transport */
                msg_error_t submitReq(MSG_REQUEST_S* pReq);
 
                msg_error_t regSentStatusCallback(msg_sent_status_cb onStatusChanged,  void *pUserParam);
@@ -61,7 +62,7 @@ class MsgHandle
 
                msg_error_t operateSyncMLMessage(msg_message_id_t msgId);
 
-               // Storage
+               /* Storage */
                int addMessage(MSG_MESSAGE_HIDDEN_S *pMsg, const MSG_SENDINGOPT_S *pSendOpt);
                msg_error_t addSyncMLMessage(const MSG_SYNCML_MESSAGE_S *pSyncMLMsg);
                msg_error_t updateMessage(const MSG_MESSAGE_HIDDEN_S *pMsg, const MSG_SENDINGOPT_S *pSendOpt);
@@ -78,7 +79,6 @@ class MsgHandle
                msg_error_t countMsgByContact(const MSG_THREAD_LIST_INDEX_INFO_S *pAddrInfo, MSG_THREAD_COUNT_INFO_S *pMsgThreadCountList);
                msg_error_t getMessage(msg_message_id_t MsgId, MSG_MESSAGE_HIDDEN_S *pMsg, MSG_SENDINGOPT_S *pSendOpt);
                msg_error_t getConversationViewItem(msg_message_id_t MsgId, MSG_CONVERSATION_VIEW_S *pConv);
-               msg_error_t getFolderViewList(msg_folder_id_t FolderId, const MSG_SORT_RULE_S *pSortRule, msg_struct_list_s *pMsgFolderViewList);
                msg_error_t addFolder(const MSG_FOLDER_INFO_S *pFolderInfo);
                msg_error_t updateFolder(const MSG_FOLDER_INFO_S *pFolderInfo);
                msg_error_t deleteFolder(msg_folder_id_t FolderId);
@@ -93,7 +93,7 @@ class MsgHandle
 
                msg_error_t getAddressList(const msg_thread_id_t threadId, msg_struct_list_s *pAddrList);
 
-               // Filter
+               /* Filter */
                msg_error_t addFilter(const MSG_FILTER_S *pFilter);
                msg_error_t updateFilter(const MSG_FILTER_S *pFilter);
                msg_error_t deleteFilter(msg_filter_id_t FilterId);
@@ -102,7 +102,7 @@ class MsgHandle
                msg_error_t getFilterOperation(bool *pSetFlag);
                msg_error_t setFilterActivation(msg_filter_id_t filter_id, bool active);
 
-               //setting
+               /*setting */
                msg_error_t getSMSCOption(msg_struct_t msg_struct);
                msg_error_t setSMSCOption(msg_struct_t msg_struct);
                msg_error_t getCBOption(msg_struct_t msg_struct);
@@ -122,11 +122,11 @@ class MsgHandle
                msg_error_t getMsgSizeOpt(msg_struct_t msg_struct);
                msg_error_t setMsgSizeOpt(msg_struct_t msg_struct);
 
-               //Backup & Restore
+               /*Backup & Restore */
                msg_error_t backupMessage(msg_message_backup_type_t type, const char *backup_filepath);
                msg_error_t restoreMessage(const char *backup_filepath);
                msg_error_t getVobject(msg_message_id_t MsgId, void** encodedData);
-               // ETC
+               /* ETC */
                msg_error_t searchMessage(const char *pSearchString, msg_struct_list_s *pThreadViewList);
 
                msg_error_t getRejectMsgList(const char *pNumber, msg_struct_list_s *pRejectMsgList);
@@ -138,7 +138,7 @@ class MsgHandle
                msg_error_t getMessageList(const MSG_LIST_CONDITION_S *pListCond, msg_struct_list_s *pMsgList);
                msg_error_t getMediaList(const msg_thread_id_t thread_id, msg_list_handle_t *pMediaList);
 
-               // Push Event
+               /* Push Event */
                msg_error_t addPushEvent(MSG_PUSH_EVENT_INFO_S *push_event);
                msg_error_t deletePushEvent(MSG_PUSH_EVENT_INFO_S *push_event);
                msg_error_t updatePushEvent(MSG_PUSH_EVENT_INFO_S *pSrc, MSG_PUSH_EVENT_INFO_S *pDst);
@@ -163,7 +163,8 @@ class MsgHandle
                char mCookie[MAX_COOKIE_LEN];
 
                MsgIpcClientSocket mClientSock;
+               Mutex mx;
 };
 
-#endif // MSG_HANDLE_H
+#endif /* MSG_HANDLE_H */
 
index 7b4fc39..3ae3ce0 100755 (executable)
 /*==================================================================================================
                                          VARIABLES
 ==================================================================================================*/
-typedef struct
-{
+typedef struct {
        MsgHandle* hAddr;
+       int fd;
        msg_sent_status_cb pfSentStatusCB;
        void* userParam;
 } MSG_SENT_STATUS_CB_ITEM_S;
 
-typedef struct
-{
+
+typedef struct {
        MsgHandle* hAddr;
+       int fd;
        msg_sms_incoming_cb pfIncomingCB;
        int port;
        void* userParam;
 } MSG_INCOMING_CB_ITEM_S;
 
-typedef struct
-{
+
+typedef struct {
        MsgHandle* hAddr;
+       int fd;
        msg_mms_conf_msg_incoming_cb pfMMSConfIncomingCB;
        char appId[MAX_MMS_JAVA_APPID_LEN+1];
        void* userParam;
 } MSG_MMS_CONF_INCOMING_CB_ITEM_S;
 
-typedef struct
-{
+
+typedef struct {
        MsgHandle* hAddr;
+       int fd;
        msg_push_msg_incoming_cb pfPushIncomingCB;
        char appId[MAX_WAPPUSH_ID_LEN+1];
        void* userParam;
 } MSG_PUSH_INCOMING_CB_ITEM_S;
 
-typedef struct
-{
+
+typedef struct {
        MsgHandle* hAddr;
+       int fd;
        msg_cb_incoming_cb pfCBIncomingCB;
        bool bsave;
        void* userParam;
 } MSG_CB_INCOMING_CB_ITEM_S;
 
-typedef struct
-{
+
+typedef struct {
        MsgHandle* hAddr;
+       int fd;
        msg_syncml_msg_incoming_cb pfSyncMLIncomingCB;
        void* userParam;
 } MSG_SYNCML_INCOMING_CB_ITEM_S;
 
-typedef struct
-{
+
+typedef struct {
        MsgHandle* hAddr;
+       int fd;
        msg_lbs_msg_incoming_cb pfLBSMsgIncoming;
        void* userParam;
 } MSG_LBS_INCOMING_CB_ITEM_S;
 
-typedef struct
-{
+
+typedef struct {
        MsgHandle* hAddr;
+       int fd;
        msg_syncml_msg_operation_cb pfSyncMLOperationCB;
        void* userParam;
 } MSG_SYNCML_OPERATION_CB_ITEM_S;
 
-typedef struct
-{
+
+typedef struct {
        MsgHandle* hAddr;
+       int fd;
        msg_storage_change_cb pfStorageChangeCB;
        void* userParam;
 } MSG_STORAGE_CHANGE_CB_ITEM_S;
 
 
-typedef struct
-{
+typedef struct {
        MsgHandle* hAddr;
+       int fd;
        msg_report_msg_incoming_cb pfReportMsgIncomingCB;
        void* userParam;
 } MSG_REPORT_INCOMING_CB_ITEM_S;
@@ -133,24 +141,29 @@ public:
        void start(MsgHandle* pMsgHandle);
        void stop();
 
-       bool regSentStatusEventCB(MsgHandle* pMsgHandle, msg_sent_status_cb pfSentStatus, void *pUserParam);
-       bool regMessageIncomingEventCB(MsgHandle* pMsgHandle, msg_sms_incoming_cb pfNewMessage, int port, void *pUserParam);
-       bool regMMSConfMessageIncomingEventCB(MsgHandle* pMsgHandle, msg_mms_conf_msg_incoming_cb pfNewMMSConfMessage, const char *pAppId, void *pUserParam);
-       bool regPushMessageIncomingEventCB(MsgHandle* pMsgHandle, msg_push_msg_incoming_cb pfNewPushMessage, const char *pAppId, void *pUserParam);
-       bool regCBMessageIncomingEventCB(MsgHandle* pMsgHandle, msg_cb_incoming_cb pfNewCBMessage, bool bSave, void *pUserParam);
-       bool regSyncMLMessageIncomingEventCB(MsgHandle* pMsgHandle, msg_syncml_msg_incoming_cb pfNewSyncMLMessage, void *pUserParam);
-       bool regLBSMessageIncomingEventCB(MsgHandle* pMsgHandle, msg_lbs_msg_incoming_cb pfNewLBSMsgIncoming, void *pUserParam);
-       bool regSyncMLMessageOperationEventCB(MsgHandle* pMsgHandle, msg_syncml_msg_operation_cb pfSyncMLMessageOperation, void *pUserParam);
-       bool regStorageChangeEventCB(MsgHandle* pMsgHandle, msg_storage_change_cb pfStorageChangeOperation, void *pUserParam);
-       bool regReportMsgIncomingCB(MsgHandle* pMsgHandle, msg_report_msg_incoming_cb pfReportMessage, void *pUserParam);
+       bool regSentStatusEventCB(MsgHandle* pMsgHandle, int fd, msg_sent_status_cb pfSentStatus, void *pUserParam);
+       bool regMessageIncomingEventCB(MsgHandle* pMsgHandle, int fd, msg_sms_incoming_cb pfNewMessage, int port, void *pUserParam);
+       bool regMMSConfMessageIncomingEventCB(MsgHandle* pMsgHandle, int fd, msg_mms_conf_msg_incoming_cb pfNewMMSConfMessage, const char *pAppId, void *pUserParam);
+       bool regPushMessageIncomingEventCB(MsgHandle* pMsgHandle, int fd, msg_push_msg_incoming_cb pfNewPushMessage, const char *pAppId, void *pUserParam);
+       bool regCBMessageIncomingEventCB(MsgHandle* pMsgHandle, int fd, msg_cb_incoming_cb pfNewCBMessage, bool bSave, void *pUserParam);
+       bool regSyncMLMessageIncomingEventCB(MsgHandle* pMsgHandle, int fd, msg_syncml_msg_incoming_cb pfNewSyncMLMessage, void *pUserParam);
+       bool regLBSMessageIncomingEventCB(MsgHandle* pMsgHandle, int fd, msg_lbs_msg_incoming_cb pfNewLBSMsgIncoming, void *pUserParam);
+       bool regSyncMLMessageOperationEventCB(MsgHandle* pMsgHandle, int fd, msg_syncml_msg_operation_cb pfSyncMLMessageOperation, void *pUserParam);
+       bool regStorageChangeEventCB(MsgHandle* pMsgHandle, int fd, msg_storage_change_cb pfStorageChangeOperation, void *pUserParam);
+       bool regReportMsgIncomingCB(MsgHandle* pMsgHandle, int fd, msg_report_msg_incoming_cb pfReportMessage, void *pUserParam);
 
        void clearListOfClosedHandle(MsgHandle* pMsgHandle);
+       void refreshListOfOpenedHandle(MsgHandle* pMsgHandle);
 
        void handleEvent(const MSG_EVENT_S* ptr);
 
        int getRemoteFd();
        int readFromSocket(char** buf, unsigned int* len);
        void resetProxyListener();
+       void refreshProxyListener();
+       void clearProxyCBLists();
+       void insertOpenHandleSet(MsgHandle* pMsgHandle);
+       void clearOpenHandleSet();
 #ifdef CHECK_SENT_STATUS_CALLBACK
        int getSentStatusCbCnt();
 #endif
@@ -185,5 +198,5 @@ private:
        guint eventSourceId;
 };
 
-#endif // __MSG_PROXY_LISTENER_H__
+#endif /* __MSG_PROXY_LISTENER_H__ */
 
diff --git a/include/utils/MsgCallStatusManager.h b/include/utils/MsgCallStatusManager.h
new file mode 100644 (file)
index 0000000..e4ac0d2
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+#ifndef MSG_CALL_STATUS_MANAGER_H
+#define MSG_CALL_STATUS_MANAGER_H
+
+/*==================================================================================================
+                                    INCLUDE FILES
+==================================================================================================*/
+#include <gio/gio.h>
+
+/*==================================================================================================
+                                    DEFINES
+==================================================================================================*/
+#define CALL_MGR_BUS_NAME "org.tizen.callmgr"
+#define CALL_MGR_PATH_NAME "/org/tizen/callmgr"
+#define CALL_MGR_INTERFACE_NAME "org.tizen.callmgr"
+#define CALL_MGR_MEMBER_NAME "CallStatus"
+
+/*==================================================================================================
+                                     FUNCTION PROTOTYPES
+==================================================================================================*/
+void MsgInitCallStatusManager();
+void MsgDeInitCallStatusManager();
+int MsgGetCallStatus();
+
+#endif // MSG_CALL_STATUS_MANAGER_H
+
index e12e1fb..21bde36 100755 (executable)
 #include "MsgInternalTypes.h"
 
 
-typedef void (*MsgContactChangeCB)();
-
 /*==================================================================================================
                                      FUNCTION PROTOTYPES
 ==================================================================================================*/
 msg_error_t MsgOpenContactSvc();
 msg_error_t MsgCloseContactSvc();
 
-msg_error_t MsgInitContactSvc(MsgContactChangeCB cb);
+msg_error_t MsgInitContactSvc();
 
 msg_error_t MsgGetContactInfo(const MSG_ADDRESS_INFO_S *pAddrInfo, MSG_CONTACT_INFO_S *pContactInfo);
 msg_error_t MsgGetContactSearchList(const char *pSearchVal, MSG_ADDRESS_INFO_S **pAddrInfo, int *count);
 
-void MsgSyncAddressbook();
-void MsgSyncContact();
-
-bool MsgInsertContact(MSG_CONTACT_INFO_S *pContactInfo, const char *pNumber);
-bool MsgUpdateContact(int index, int type);
-bool MsgDeleteContact(int index);
-
 int MsgGetContactNameOrder();
 msg_error_t MsgGetContactStyleDisplayName(const char *first, const char *last, const char *middle, const char *prefix, const char *suffix, int contactNameOrder, char *displayName, unsigned int size);
 
 void MsgAddPhoneLog(const MSG_MESSAGE_INFO_S *pMsgInfo);
 void MsgDeletePhoneLog(msg_message_id_t msgId);
 
-int MsgContactSVCBeginTrans();
-int MsgContactSVCEndTrans(bool bSuccess);
-
 bool checkBlockingMode(char *address, bool *pisFavorites);
 
 int MsgContactGetMinMatchDigit();
index 8cb07d5..8bd06c6 100755 (executable)
 #define MSG_SMS_VLD_INFO(fmt, ...)\
        do\
        {\
-               SLOG(LOG_DEBUG, MSG_SMS_VALID_TAG, "[SMS INFO]%s, "fmt"\n", __TIMESTAMP__, ##__VA_ARGS__);\
+               SLOG(LOG_DEBUG, MSG_SMS_VALID_TAG, "[SMS INFO]%s, " fmt "\n", __TIMESTAMP__, ##__VA_ARGS__);\
        } while (0)
 
 #define MSG_SMS_VLD_TXT(fmt, ...)\
        do\
        {\
-               SLOG(LOG_DEBUG, MSG_SMS_VALID_TAG, "[SMS_TEXT]%s, "fmt"\n", __TIMESTAMP__, ##__VA_ARGS__);\
+               SLOG(LOG_DEBUG, MSG_SMS_VALID_TAG, "[SMS_TEXT]%s, " fmt "\n", __TIMESTAMP__, ##__VA_ARGS__);\
        } while (0)
 
 #define MSG_MMS_VLD_INFO(fmt, ...)\
        do\
        {\
-               SLOG(LOG_DEBUG, MSG_MMS_VALID_TAG, "[MMS INFO]%s, "fmt"\n", __TIMESTAMP__, ##__VA_ARGS__);\
+               SLOG(LOG_DEBUG, MSG_MMS_VALID_TAG, "[MMS INFO]%s, " fmt "\n", __TIMESTAMP__, ##__VA_ARGS__);\
        } while (0)
 
 #define MSG_MMS_VLD_TXT(fmt, ...)\
        do\
        {\
-               SLOG(LOG_DEBUG, MSG_MMS_VALID_TAG, "[MMS TEXT]%s, "fmt"\n", __TIMESTAMP__, ##__VA_ARGS__);\
+               SLOG(LOG_DEBUG, MSG_MMS_VALID_TAG, "[MMS TEXT]%s, " fmt "\n", __TIMESTAMP__, ##__VA_ARGS__);\
        } while (0)
 
 #define MSG_MMS_VLD_FILE(fmt, ...)\
        do\
        {\
-               SLOG(LOG_DEBUG, MSG_MMS_VALID_TAG, "[MMS FILE]%s, "fmt"\n", __TIMESTAMP__, ##__VA_ARGS__);\
+               SLOG(LOG_DEBUG, MSG_MMS_VALID_TAG, "[MMS FILE]%s, " fmt "\n", __TIMESTAMP__, ##__VA_ARGS__);\
        } while (0)
 
 /*err & warn return message log macros*/
index 9ff1c8b..ebb8de7 100755 (executable)
@@ -60,9 +60,6 @@ msg_error_t   MsgSettingSetIndicator(int SmsCnt, int MmsCnt);
 int    MsgSettingGetAutoReject();
 bool   MsgSettingGetUnknownAutoReject();
 
-void   MsgSettingRegVconfCB();
-void   MsgSettingRemoveVconfCB();
-
 void MsgSettingRegVconfCBCommon(const char *pKey, _vconf_change_cb pCb);
 void MsgSettingRemoveVconfCBCommon(const char *pKey, _vconf_change_cb pCb);
 
index e08e2bd..342a683 100755 (executable)
@@ -21,6 +21,7 @@
                                          INCLUDE FILES
 ==================================================================================================*/
 #include "MsgTypes.h"
+#include "MsgInternalTypes.h"
 #include "MsgMmsTypes.h"
 
 msg_error_t _MsgMmsAddPage(MMS_MESSAGE_DATA_S *pMsgData, MMS_PAGE_S *pPage);
@@ -91,4 +92,6 @@ void _MsgMmsMultipartPrint(MMS_MULTIPART_DATA_S *multipart);
 
 bool  _MsgMmsRemoveEmptyObject(MMS_MESSAGE_DATA_S *pMmsMsg);
 
+int MsgMmsCheckFilepathSmack(int fd, const char *ipc_filename);
+
 #endif // MSG_MMS_MESSAGE_H
index 1703146..bc4ddef 100755 (executable)
@@ -89,6 +89,7 @@ public:
        ~MsgDbHandler();
 
        msg_error_t connect();
+       msg_error_t connectReadOnly();
        msg_error_t disconnect();
 
        bool checkTableExist(const char *pTableName);
@@ -113,7 +114,6 @@ public:
        void getColumnToString(int RowIndex, int Length, char *pString);
        msg_error_t getRowId(const char *pTableName, unsigned int *pRowId);
        void getMmapMutex(const char *shm_file_name);
-       void freeMmapMutex();
        void shm_mutex_timedlock (int sec);
        void shm_mutex_unlock();
 
index 3401874..d922c99 100755 (executable)
@@ -258,11 +258,7 @@ public:
 
        int convertUTF8ToGSM7bit(OUT unsigned char *pDestText, IN int maxLength,  IN const unsigned char *pSrcText, IN int srcTextLen, OUT MSG_LANGUAGE_ID_T *pLangId, OUT bool *bIncludeAbnormalChar);
        int convertUTF8ToUCS2(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen);
-#ifndef FEATURE_SMS_CDMA
-       int convertUTF8ToAuto(OUT unsigned char *pDestText, IN int maxLength,  IN const unsigned char *pSrcText, IN int srcTextLen, OUT MSG_LANGUAGE_ID_T *pLangId, OUT msg_encode_type_t *pCharType);
-#else
        int convertUTF8ToAuto(OUT unsigned char *pDestText, IN int maxLength,  IN const unsigned char *pSrcText, IN int srcTextLen, OUT msg_encode_type_t *pCharType);
-#endif
 
        int convertGSM7bitToUTF8(OUT unsigned char *pDestText, IN int maxLength,  IN const unsigned char *pSrcText, IN int srcTextLen, IN MSG_LANG_INFO_S *pLangInfo);
        int convertUCS2ToUTF8(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN  int srcTextLen);
@@ -274,7 +270,11 @@ private:
        ~MsgTextConvert();
 
        int convertUCS2ToGSM7bit(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, OUT MSG_LANGUAGE_ID_T *pLangId, OUT bool *bIncludeAbnormalChar);
+#ifndef FEATURE_SMS_CDMA
+       int convertUCS2ToGSM7bitAuto(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, OUT bool *pUnknown);
+#else
        int convertUCS2ToASCII(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, OUT bool *pUnknown);
+#endif
 
        int convertGSM7bitToUCS2(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, IN MSG_LANG_INFO_S *pLangInfo);
 
index 8600b2a..ecea9b5 100755 (executable)
@@ -60,6 +60,6 @@ bool MsgChown(const char *filepath, int uid, int gid);
 bool MsgCreateFile(const char *pFilePath,char *pData, int DataSize);
 char *MsgGetDirName(char *file_path);
 char *MsgGetFileName(char *file_path);
-
+int MsgCheckFilepathSmack(const char *app_smack_label, char *file_path);
 #endif // MSG_UTIL_FILE_H
 
index 5595a01..d7774c3 100755 (executable)
@@ -20,7 +20,7 @@
 #define        MSG_UTIL_CH_EMAIL_AT    '@'
 
 /*==================================================================================================
-                                         INCLUDE FILES
+                                   INCLUDE FILES
 ==================================================================================================*/
 #include "MsgStorageTypes.h"
 #include "MsgSettingTypes.h"
 #include "MsgCmdTypes.h"
 
 /*==================================================================================================
-                                       FUNCTION PROTOTYPES
+                                      DEFINES
+==================================================================================================*/
+
+#define MSG_TYPE_CHECK(a, b) \
+       do {\
+               if(a != (b & 0xff00)) {\
+                       return MSG_ERR_INVALID_PARAMETER; \
+               } \
+       }while(0)
+
+/*==================================================================================================
+                                                      FUNCTION PROTOTYPES
 ==================================================================================================*/
 
 bool MsgCheckFeatureSupport(const char *feature_name);
@@ -57,8 +68,6 @@ int MsgEncodeFilterList(msg_struct_list_s *pFilterList, char **ppDest);
 
 int MsgEncodeFilterFlag(bool *pSetFlag, char **ppDest);
 
-int MsgEncodeMsgType(MSG_MESSAGE_TYPE_S *pMsgType, char **ppDest);
-
 int MsgEncodeThreadViewList(msg_struct_list_s *pThreadViewList, char **ppDest);
 
 int MsgEncodeConversationViewList(msg_struct_list_s *pConvViewList, char **ppDest);
index 56bce45..634dcc9 100755 (executable)
@@ -64,25 +64,20 @@ bool MsgExistConversation(MsgDbHandler *pDbHandle, msg_thread_id_t convId);
 bool MsgExistMessage(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S *pMsg);
 
 int MsgStoGetUnreadCnt(MsgDbHandler *pDbHandle, MSG_MAIN_TYPE_T MsgType);
-msg_error_t MsgStoAddContactInfo(MsgDbHandler *pDbHandle, MSG_CONTACT_INFO_S *pContactInfo, const char *pNumber);
-msg_error_t MsgStoClearContactInfoByAddrbookIdList(MsgDbHandler *pDbHandle, int* addrbookList, int addrbookCnt);
-msg_error_t MsgStoClearContactInfo(MsgDbHandler *pDbHandle, int ContactId);
-msg_error_t MsgStoResetContactInfo(MsgDbHandler *pDbHandle, int contactId);
 msg_error_t MsgStoGetMmsRawFilePath(MsgDbHandler *pDbHandle, msg_message_id_t msgId, char *pFilePath);
 bool MsgStoCheckReadReportRequested(MsgDbHandler *pDbHandle, msg_message_id_t MsgId);
 bool MsgStoCheckReadReportIsSent(MsgDbHandler *pDbHandle, msg_message_id_t MsgId);
 msg_error_t MsgStoUpdateNetworkStatus(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S *pMsgInfo, msg_network_status_t status);
 
 // Lists
-msg_error_t MsgStoGetFolderViewList(msg_folder_id_t FolderId, const MSG_SORT_RULE_S *pSortRule, msg_struct_list_s *pMsgFolderViewList);
 msg_error_t MsgStoGetThreadViewList(const MSG_SORT_RULE_S *pSortRule, msg_struct_list_s *pThreadViewList);
 msg_error_t MsgStoGetConversationViewItem(msg_message_id_t msgId, MSG_CONVERSATION_VIEW_S *pConv);
 msg_error_t MsgStoGetConversationViewList(msg_thread_id_t ThreadId, msg_struct_list_s *pConvViewList);
-msg_error_t MsgStoSearchMessage(const char *pSearchString, msg_struct_list_s *pThreadViewList);
+msg_error_t MsgStoSearchMessage(const char *pSearchString, msg_struct_list_s *pThreadViewList, int contactCount);
 
 msg_error_t MsgStoGetRejectMsgList(const char *pNumber, msg_struct_list_s *pRejectMsgList);
 msg_error_t MsgStoGetAddressList(const msg_thread_id_t threadId, msg_struct_list_s *pAddrList);
-msg_error_t MsgStoGetMessageList(const MSG_LIST_CONDITION_S *pListCond, msg_struct_list_s *pMsgList);
+msg_error_t MsgStoGetMessageList(const MSG_LIST_CONDITION_S *pListCond, msg_struct_list_s *pMsgList, int contactCount);
 msg_error_t MsgStoGetMediaList(const msg_thread_id_t threadId, msg_list_handle_t *pMediaList);
 
 #ifdef FEATURE_SMS_CDMA
diff --git a/include/utils/MsgZoneManager.h b/include/utils/MsgZoneManager.h
new file mode 100755 (executable)
index 0000000..e06987c
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+* Copyright 2012-2013  Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.1 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*    http://floralicense.org/license/
+*
+* 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 MSG_ZONE_MANAGER_H
+#define MSG_ZONE_MANAGER_H
+
+bool MsgZoneInit();
+void MsgZoneClean();
+
+char* MsgZoneGetName(int fd);
+char* MsgZoneGetRootPath();
+void MsgZoneDeclareDir();
+void MsgZoneDeclareLink();
+bool MsgZoneIsAllowed(int fd);
+
+
+void MsgZoneChange();
+void MsgZoneRevert();
+
+#endif // MSG_ZONE_MANAGER_H
+
index 3f56ff7..c4eed4a 100755 (executable)
@@ -10,7 +10,7 @@ IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
 ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "") 
 MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")
 
-SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -O0 -g -Wall")
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -O2 -g -Wall")
 
 ##########################################################
 # Define MAPI   
index 8116e05..a96fef7 100755 (executable)
 ==================================================================================================*/
 EXPORT_API int msg_open_msg_handle(msg_handle_t *handle)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       //Privilege check
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
-       if (handle == NULL)
-       {
+       if (handle == NULL) {
                MSG_FATAL("Input Paramter is NULL");
                return MSG_ERR_INVALID_PARAMETER;
        }
        MsgHandle* pHandle = new MsgHandle();
 
-       // Create MsgHandle
+       /* Create MsgHandle */
        *handle = (msg_handle_t)pHandle;
 
        if (*handle == NULL)
                return MSG_ERR_INVALID_PARAMETER;
 
-       try
-       {
-               // Connect to Socket
+       try {
+               /* Connect to Socket */
                pHandle->openHandle();
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
 
-               // Destroy MsgHandle
+               /* Destroy MsgHandle */
                delete (MsgHandle*)(*handle);
                (*handle) = NULL;
 
                if (e.errorCode() == MsgException::SERVER_READY_ERROR)
                        return MSG_ERR_SERVER_NOT_READY;
-               else if(e.errorCode() == MsgException::SECURITY_ERROR)
+               else if (e.errorCode() == MsgException::SECURITY_ERROR)
                        return MSG_ERR_PERMISSION_DENIED;
                else
                        return MSG_ERR_COMMUNICATION_ERROR;
@@ -78,35 +72,29 @@ EXPORT_API int msg_open_msg_handle(msg_handle_t *handle)
 
 EXPORT_API int msg_close_msg_handle(msg_handle_t *handle)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       //Privilege check
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
-       if (handle == NULL || *handle == NULL)
-       {
+       if (handle == NULL || *handle == NULL) {
                MSG_FATAL("Input Paramter is NULL");
                return MSG_ERR_INVALID_PARAMETER;
        }
 
        MsgHandle* pHandle = (MsgHandle*)(*handle);
 
-       try
-       {
-               // Disconnect to Socket
+       try {
+               /* Disconnect to Socket */
                pHandle->closeHandle(pHandle);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_COMMUNICATION_ERROR;
        }
 
-       // Destroy MsgHandle
+       /* Destroy MsgHandle */
        delete (MsgHandle*)(*handle);
        (*handle) = NULL;
 
index 4871163..4a4be3d 100755 (executable)
 ==================================================================================================*/
 EXPORT_API int msg_add_filter(msg_handle_t handle, const msg_struct_t msg_struct_handle)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
-       // TODO : check NULL in msg_struct_handle
-       msg_struct_s *msg_struct = (msg_struct_s *) msg_struct_handle;
-
-       if (handle == NULL || msg_struct == NULL)
-       {
+       if (handle == NULL || msg_struct_handle == NULL)
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
-       if(msg_struct->type != MSG_STRUCT_FILTER)
-       {
-               return MSG_ERR_INVALID_PARAMETER;
-       }
+       msg_struct_s *msg_struct = (msg_struct_s *) msg_struct_handle;
+       MSG_TYPE_CHECK(msg_struct->type, MSG_STRUCT_FILTER);
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try  {
                err = pHandle->addFilter((const MSG_FILTER_S *)msg_struct->data);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_FILTER_ERROR;
        }
@@ -70,39 +58,26 @@ EXPORT_API int msg_add_filter(msg_handle_t handle, const msg_struct_t msg_struct
 
 EXPORT_API int msg_update_filter(msg_handle_t handle, const msg_struct_t msg_struct_handle)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
-       // TODO : check NULL in msg_struct_handle
-       msg_struct_s *msg_struct = (msg_struct_s *) msg_struct_handle;
-
-       if (handle == NULL || msg_struct == NULL)
-       {
+       if (handle == NULL || msg_struct_handle == NULL)
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
-
-       if(msg_struct->type != MSG_STRUCT_FILTER)
-       {
-               return MSG_ERR_INVALID_PARAMETER;
-       }
+       msg_struct_s *msg_struct = (msg_struct_s *) msg_struct_handle;
+       MSG_TYPE_CHECK(msg_struct->type, MSG_STRUCT_FILTER);
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->updateFilter((const MSG_FILTER_S *)msg_struct->data);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_FILTER_ERROR;
        }
@@ -113,30 +88,23 @@ EXPORT_API int msg_update_filter(msg_handle_t handle, const msg_struct_t msg_str
 
 EXPORT_API int msg_delete_filter(msg_handle_t handle, msg_filter_id_t filter_id)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->deleteFilter(filter_id);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_FILTER_ERROR;
        }
@@ -147,30 +115,23 @@ EXPORT_API int msg_delete_filter(msg_handle_t handle, msg_filter_id_t filter_id)
 
 EXPORT_API int msg_get_filter_list(msg_handle_t handle, msg_struct_list_s *filter_list)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL || filter_list == NULL)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->getFilterList(filter_list);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_FILTER_ERROR;
        }
@@ -181,30 +142,23 @@ EXPORT_API int msg_get_filter_list(msg_handle_t handle, msg_struct_list_s *filte
 
 EXPORT_API int msg_set_filter_operation(msg_handle_t handle, bool set_flag)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->setFilterOperation(set_flag);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_FILTER_ERROR;
        }
@@ -215,30 +169,23 @@ EXPORT_API int msg_set_filter_operation(msg_handle_t handle, bool set_flag)
 
 EXPORT_API int msg_get_filter_operation(msg_handle_t handle, bool *set_flag)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
-       if (handle == NULL)
-       {
+       if (handle == NULL || set_flag == NULL)
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->getFilterOperation(set_flag);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_FILTER_ERROR;
        }
@@ -249,30 +196,23 @@ EXPORT_API int msg_get_filter_operation(msg_handle_t handle, bool *set_flag)
 
 EXPORT_API int msg_set_filter_active(msg_handle_t handle, msg_filter_id_t filter_id, bool active)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->setFilterActivation(filter_id, active);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_FILTER_ERROR;
        }
@@ -281,72 +221,69 @@ EXPORT_API int msg_set_filter_active(msg_handle_t handle, msg_filter_id_t filter
 }
 
 
-bool msg_get_filter_info_bool(void *filter, int field)
+int msg_get_filter_info_bool(void *filter, int field, bool *value)
 {
        if (!filter)
                return MSG_ERR_NULL_POINTER;
 
-       int ret = 0;
+       int ret = MSG_SUCCESS;
 
        MSG_FILTER_S *filter_data = (MSG_FILTER_S *)filter;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_FILTER_ACTIVE_BOOL :
-               ret = filter_data->bActive;
+               *value = filter_data->bActive;
                break;
        default :
-               return MSG_ERR_INVALID_PARAMETER;
+               ret = MSG_ERR_INVALID_PARAMETER;
+               break;
        }
 
        return ret;
 }
 
 
-int msg_get_filter_info_int(void *filter, int field)
+int msg_get_filter_info_int(void *filter, int field, int *value)
 {
        if (!filter)
                return MSG_ERR_NULL_POINTER;
 
-       int ret = 0;
+       int ret = MSG_SUCCESS;
 
        MSG_FILTER_S *filter_data = (MSG_FILTER_S *)filter;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_FILTER_ID_INT :
-               ret = filter_data->filterId;
+               *value = filter_data->filterId;
                break;
        case MSG_FILTER_TYPE_INT :
-               ret = filter_data->filterType;
+               *value = filter_data->filterType;
                break;
        default :
-               return MSG_ERR_INVALID_PARAMETER;
+               ret = MSG_ERR_INVALID_PARAMETER;
+               break;
        }
 
        return ret;
 }
 
 
-char *msg_get_filter_info_str(void *filter, int field)
+int msg_get_filter_info_str(void *filter, int field, char *value, int size)
 {
        if (!filter)
-               return NULL;
-
-       char *ret_str = NULL;
+               return MSG_ERR_NULL_POINTER;
 
        MSG_FILTER_S *filter_data = (MSG_FILTER_S *)filter;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_FILTER_VALUE_STR :
-               ret_str = filter_data->filterValue;
+               strncpy(value, filter_data->filterValue, size);
                break;
        default :
-               return NULL;
+               return MSG_ERR_INVALID_PARAMETER;
        }
 
-       return ret_str;
+       return MSG_SUCCESS;
 }
 
 int msg_set_filter_info_bool(void *filter, int field, bool value)
@@ -354,11 +291,10 @@ int msg_set_filter_info_bool(void *filter, int field, bool value)
        if (!filter)
                return MSG_ERR_NULL_POINTER;
 
-       msg_error_t err =  MSG_SUCCESS;
+       msg_error_t err = MSG_SUCCESS;
        MSG_FILTER_S *filter_data = (MSG_FILTER_S *)filter;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_FILTER_ACTIVE_BOOL :
                filter_data->bActive = value;
                break;
@@ -374,11 +310,10 @@ int msg_set_filter_info_int(void *filter, int field, int value)
        if (!filter)
                return MSG_ERR_NULL_POINTER;
 
-       msg_error_t err =  MSG_SUCCESS;
+       msg_error_t err = MSG_SUCCESS;
        MSG_FILTER_S *filter_data = (MSG_FILTER_S *)filter;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_FILTER_ID_INT :
                filter_data->filterId = value;
                break;
@@ -397,11 +332,10 @@ int msg_set_filter_info_str(void *filter, int field, char *value, int size)
        if (!filter || !value)
                return MSG_ERR_NULL_POINTER;
 
-       msg_error_t err =  MSG_SUCCESS;
+       msg_error_t err = MSG_SUCCESS;
        MSG_FILTER_S *filter_data = (MSG_FILTER_S *)filter;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_FILTER_VALUE_STR :
        {
                int len = (size > MAX_FILTER_VALUE_LEN)?MAX_FILTER_VALUE_LEN:size;
index 0a73738..ae84503 100755 (executable)
@@ -122,10 +122,9 @@ int msg_message_release(msg_struct_s **msg_struct)
                msg->mmsDataSize = 0;
        }
 
-       // Memory Free
-       if (msg->addr_list != NULL)
-       {
-               for(int i=0; i<MAX_TO_ADDRESS_CNT; i++) {
+       /* Memory Free */
+       if (msg->addr_list != NULL) {
+               for (int i = 0; i < MAX_TO_ADDRESS_CNT; i++) {
                        msg_struct_s * addrInfo = (msg_struct_s *)msg->addr_list->msg_struct_info[i];
                        delete (MSG_ADDRESS_INFO_S *)addrInfo->data;
                        addrInfo->data = NULL;
@@ -139,7 +138,7 @@ int msg_message_release(msg_struct_s **msg_struct)
                msg->addr_list = NULL;
        }
 
-       // Free GList *addressList
+       /* Free GList *addressList */
        if (msg->addressList) {
                g_list_free_full(msg->addressList, __msg_message_release_address_struct);
                msg->addressList = NULL;
@@ -163,8 +162,7 @@ int msg_message_get_int_value(void *data, int field, int *value)
 
        MSG_MESSAGE_HIDDEN_S *msg_data = (MSG_MESSAGE_HIDDEN_S *)data;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_MESSAGE_ID_INT :
                *value = msg_data->msgId;
                break;
@@ -176,8 +174,7 @@ int msg_message_get_int_value(void *data, int field, int *value)
                break;
        case MSG_MESSAGE_TYPE_INT :
        {
-        if (msg_data->mainType == MSG_SMS_TYPE)
-        {
+               if (msg_data->mainType == MSG_SMS_TYPE) {
                        switch (msg_data->subType) {
                                case MSG_CB_SMS :
                                        *value = MSG_TYPE_SMS_CB;
@@ -224,19 +221,19 @@ int msg_message_get_int_value(void *data, int field, int *value)
                                        break;
                                default :
                                        *value = MSG_TYPE_SMS;
+                                       break;
                        }
                }
-               else if (msg_data->mainType == MSG_MMS_TYPE)
-               {
+               else if (msg_data->mainType == MSG_MMS_TYPE) {
                        if (msg_data->subType == MSG_NOTIFICATIONIND_MMS)
                                *value = MSG_TYPE_MMS_NOTI;
                        else if (msg_data->subType == MSG_SENDREQ_JAVA_MMS)
                                *value = MSG_TYPE_MMS_JAVA;
                        else
                                *value = MSG_TYPE_MMS;
-               }
-               else
+               } else {
                        *value = MSG_TYPE_INVALID;
+               }
 
                break;
        }
@@ -338,9 +335,6 @@ int msg_message_get_str_value(void *data, int field, char *value, int size)
        case MSG_MESSAGE_SUBJECT_STR :
                strncpy(value, msg_data->subject, size);
                break;
-       case MSG_MESSAGE_THUMBNAIL_PATH_STR :
-               strncpy(value, msg_data->thumbPath, size);
-               break;
        case MSG_MESSAGE_SMS_DATA_STR :
        case MSG_MESSAGE_MMS_TEXT_STR :
                if (msg_data->pData)
@@ -414,8 +408,7 @@ int msg_message_set_int_value(void *data, int field, int value)
 
        MSG_MESSAGE_HIDDEN_S *msg_data = (MSG_MESSAGE_HIDDEN_S *)data;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_MESSAGE_ID_INT :
                msg_data->msgId = value;
                break;
@@ -430,28 +423,25 @@ int msg_message_set_int_value(void *data, int field, int value)
                if (value == MSG_TYPE_SMS) {
                        msg_data->mainType = MSG_SMS_TYPE;
                        msg_data->subType = MSG_NORMAL_SMS;
-               }
-               else if (value == MSG_TYPE_MMS) {
+               } else if (value == MSG_TYPE_MMS) {
                        msg_data->mainType = MSG_MMS_TYPE;
                        msg_data->subType = MSG_SENDREQ_MMS;
-               }
-               else if (value == MSG_TYPE_MMS_JAVA) {
+               } else if (value == MSG_TYPE_MMS_JAVA) {
                        msg_data->mainType = MSG_MMS_TYPE;
                        msg_data->subType = MSG_SENDREQ_JAVA_MMS;
-               }
-               else if (value == MSG_TYPE_SMS_SYNCML) {
+               } else if (value == MSG_TYPE_SMS_SYNCML) {
                        msg_data->mainType = MSG_SMS_TYPE;
                        msg_data->subType = MSG_SYNCML_CP;
-               }
-               else if (value == MSG_TYPE_SMS_REJECT) {
+               } else if (value == MSG_TYPE_SMS_REJECT) {
                        msg_data->mainType = MSG_SMS_TYPE;
                        msg_data->subType = MSG_REJECT_SMS;
-               }
-               else if (value == MSG_TYPE_SMS_ETWS_PRIMARY) {
+               } else if (value == MSG_TYPE_SMS_ETWS_PRIMARY) {
                        msg_data->mainType = MSG_SMS_TYPE;
                        msg_data->subType = MSG_ETWS_SMS;
+               } else {
+                       ret = MSG_ERR_INVALID_PARAMETER;
                }
-        break;
+               break;
        }
        case MSG_MESSAGE_CLASS_TYPE_INT :
                msg_data->classType = value;
@@ -543,9 +533,6 @@ int msg_message_set_str_value(void *data, int field, char *value, int size)
        case MSG_MESSAGE_SUBJECT_STR :
                snprintf(msg_data->subject, sizeof(msg_data->subject), "%s",value);
                break;
-       case MSG_MESSAGE_THUMBNAIL_PATH_STR :
-               snprintf(msg_data->thumbPath, sizeof(msg_data->thumbPath), "%s",value);
-               break;
        case MSG_MESSAGE_SMS_DATA_STR :
        {
                if (msg_data->pData)
@@ -605,14 +592,12 @@ void msg_message_copy_message(MSG_MESSAGE_HIDDEN_S *pSrc, MSG_MESSAGE_HIDDEN_S *
        pDst->simIndex = pSrc->simIndex;
        memcpy(pDst->subject, pSrc->subject, sizeof(pDst->subject));
 
-       if(pSrc->pMmsData && pSrc->mmsDataSize)
-       {
+       if (pSrc->pMmsData && pSrc->mmsDataSize) {
                pDst->pMmsData = new char[pSrc->mmsDataSize];
                memcpy(pDst->pMmsData, pSrc->pMmsData, pSrc->mmsDataSize);
        }
 
-       if(pSrc->dataSize && pSrc->pData)
-       {
+       if (pSrc->dataSize && pSrc->pData) {
                int data_len = strlen((const char *)pSrc->pData);
                pDst->pData = new char[data_len + 1];
                memset(pDst->pData, 0x00, data_len + 1);
@@ -623,8 +608,7 @@ void msg_message_copy_message(MSG_MESSAGE_HIDDEN_S *pSrc, MSG_MESSAGE_HIDDEN_S *
        msg_struct_list_s *dst_addrlist = pDst->addr_list;
        dst_addrlist->nCount = src_addrlist->nCount;
 
-       for(int i=0; i < MAX_TO_ADDRESS_CNT; ++i)
-       {
+       for (int i = 0; i < MAX_TO_ADDRESS_CNT; ++i) {
                msg_struct_s *src_addr = (msg_struct_s *)src_addrlist->msg_struct_info[i];
                msg_struct_s *dst_addr = (msg_struct_s *)dst_addrlist->msg_struct_info[i];
                memcpy(dst_addr->data, src_addr->data, sizeof(MSG_ADDRESS_INFO_S));
@@ -635,7 +619,7 @@ void msg_message_copy_message(MSG_MESSAGE_HIDDEN_S *pSrc, MSG_MESSAGE_HIDDEN_S *
                memcpy(pDst->thumbPath, pSrc->thumbPath, sizeof(pDst->thumbPath));
        }
 
-       for (unsigned int i=0; i < g_list_length(pSrc->addressList); i++) {
+       for (unsigned int i = 0; i < g_list_length(pSrc->addressList); i++) {
                msg_struct_s *addr_struct = __msg_message_create_address_struct();
                MSG_ADDRESS_INFO_S *addrInfo = (MSG_ADDRESS_INFO_S *)addr_struct->data;
 
@@ -664,61 +648,60 @@ int msg_cb_message_get_int_value(void *data, int field, int *value)
 
        *value = 0;
 
-       switch (field)
-       {
-               case MSG_CB_MSG_TYPE_INT :
-                       {
-                               switch (cb_msg->type) {
-                                       case MSG_ETWS_SMS :
-                                               *value = MSG_TYPE_SMS_ETWS_PRIMARY;
-                                               break;
-                                       case MSG_CB_SMS:
-                                               *value = ((cb_msg->messageId & 0xFFF8) == 0x1100 ) ? MSG_TYPE_SMS_ETWS_SECONDARY : MSG_TYPE_SMS_CB;
-                                               break;
-                                       case MSG_CMAS_PRESIDENTIAL :
-                                               *value = MSG_TYPE_SMS_CMAS_PRESIDENTIAL;
-                                               break;
-                                       case MSG_CMAS_EXTREME :
-                                               *value = MSG_TYPE_SMS_CMAS_EXTREME;
-                                               break;
-                                       case MSG_CMAS_SEVERE :
-                                               *value = MSG_TYPE_SMS_CMAS_SEVERE;
-                                               break;
-                                       case MSG_CMAS_AMBER :
-                                               *value = MSG_TYPE_SMS_CMAS_AMBER;
-                                               break;
-                                       case MSG_CMAS_TEST :
-                                               *value = MSG_TYPE_SMS_CMAS_TEST;
-                                               break;
-                                       case MSG_CMAS_OPERATOR_DEFINED :
-                                               *value = MSG_TYPE_SMS_CMAS_OPERATOR_DEFINED;
-                                               break;
-                                       default :
-                                               ret = MSG_ERR_UNKNOWN;
-                               }
+       switch (field) {
+       case MSG_CB_MSG_TYPE_INT :
+               {
+                       switch (cb_msg->type) {
+                       case MSG_ETWS_SMS :
+                               *value = MSG_TYPE_SMS_ETWS_PRIMARY;
+                               break;
+                       case MSG_CB_SMS:
+                               *value = ((cb_msg->messageId & 0xFFF8) == 0x1100 ) ? MSG_TYPE_SMS_ETWS_SECONDARY : MSG_TYPE_SMS_CB;
+                               break;
+                       case MSG_CMAS_PRESIDENTIAL :
+                               *value = MSG_TYPE_SMS_CMAS_PRESIDENTIAL;
+                               break;
+                       case MSG_CMAS_EXTREME :
+                               *value = MSG_TYPE_SMS_CMAS_EXTREME;
+                               break;
+                       case MSG_CMAS_SEVERE :
+                               *value = MSG_TYPE_SMS_CMAS_SEVERE;
+                               break;
+                       case MSG_CMAS_AMBER :
+                               *value = MSG_TYPE_SMS_CMAS_AMBER;
+                               break;
+                       case MSG_CMAS_TEST :
+                               *value = MSG_TYPE_SMS_CMAS_TEST;
+                               break;
+                       case MSG_CMAS_OPERATOR_DEFINED :
+                               *value = MSG_TYPE_SMS_CMAS_OPERATOR_DEFINED;
+                               break;
+                       default :
+                               ret = MSG_ERR_UNKNOWN;
                        }
-                       break;
-               case MSG_CB_MSG_RECV_TIME_INT :
-                       *value = cb_msg->receivedTime;
-                       break;
-               case MSG_CB_MSG_SERIAL_NUM_INT :
-                       *value = cb_msg->serialNum;
-                       break;
-               case MSG_CB_MSG_MSG_ID_INT :
-                       *value = cb_msg->messageId;
-                       break;
-               case MSG_CB_MSG_DCS_INT :
-                       *value = (int)cb_msg->dcs;
-                       break;
-               case MSG_CB_MSG_CB_TEXT_LEN_INT :
-                       *value = cb_msg->cbTextLen;
-                       break;
-               case MSG_CB_MSG_ETWS_WARNING_TYPE_INT :
-                       *value = cb_msg->etwsWarningType;
-                       break;
-               default :
-                       ret = MSG_ERR_INVALID_PARAMETER;
-                       break;
+               }
+               break;
+       case MSG_CB_MSG_RECV_TIME_INT :
+               *value = cb_msg->receivedTime;
+               break;
+       case MSG_CB_MSG_SERIAL_NUM_INT :
+               *value = cb_msg->serialNum;
+               break;
+       case MSG_CB_MSG_MSG_ID_INT :
+               *value = cb_msg->messageId;
+               break;
+       case MSG_CB_MSG_DCS_INT :
+               *value = (int)cb_msg->dcs;
+               break;
+       case MSG_CB_MSG_CB_TEXT_LEN_INT :
+               *value = cb_msg->cbTextLen;
+               break;
+       case MSG_CB_MSG_ETWS_WARNING_TYPE_INT :
+               *value = cb_msg->etwsWarningType;
+               break;
+       default :
+               ret = MSG_ERR_INVALID_PARAMETER;
+               break;
        }
 
        return ret;
@@ -734,34 +717,34 @@ int msg_cb_message_get_str_value(void *data, int field, char *value, int size)
        MSG_CB_MSG_S *cb_msg = (MSG_CB_MSG_S *)data;
 
        switch (field) {
-               case MSG_CB_MSG_CB_TEXT_STR:
-                       {
-                               int     copylen = 0;
-                               copylen = (size > cb_msg->cbTextLen) ? cb_msg->cbTextLen : size - 1;
-                               memcpy (value, cb_msg->cbText, copylen);
-                               value[copylen] = '\0';
-                       }
-                       break;
-               case MSG_CB_MSG_LANGUAGE_TYPE_STR:
-                       {
-                               int     copylen = 0;
-                               copylen = ((size_t)size > strlen((const char*)cb_msg->language_type)) ? strlen((const char*)cb_msg->language_type) : size - 1;
-                               memcpy (value, cb_msg->language_type, copylen);
-                               value[copylen] = '\0';
-                       }
-                       break;
-               case MSG_CB_MSG_ETWS_WARNING_SECU_INFO_STR:
-                       {
-                               if ((size_t)size < sizeof(cb_msg->etwsWarningSecurityInfo))
-                                       ret = MSG_ERR_INVALID_PARAMETER;
-                               else
-                                       memcpy (value, cb_msg->etwsWarningSecurityInfo, sizeof(cb_msg->etwsWarningSecurityInfo));
-                       }
-                       break;
-
-               default :
+       case MSG_CB_MSG_CB_TEXT_STR:
+       {
+               int     copylen = 0;
+               copylen = (size > cb_msg->cbTextLen) ? cb_msg->cbTextLen : size - 1;
+               memcpy (value, cb_msg->cbText, copylen);
+               value[copylen] = '\0';
+       }
+       break;
+       case MSG_CB_MSG_LANGUAGE_TYPE_STR:
+       {
+               int     copylen = 0;
+               copylen = ((size_t)size > strlen((const char*)cb_msg->language_type)) ? strlen((const char*)cb_msg->language_type) : size - 1;
+               memcpy (value, cb_msg->language_type, copylen);
+               value[copylen] = '\0';
+       }
+       break;
+       case MSG_CB_MSG_ETWS_WARNING_SECU_INFO_STR:
+       {
+               if ((size_t)size < sizeof(cb_msg->etwsWarningSecurityInfo))
                        ret = MSG_ERR_INVALID_PARAMETER;
-                       break;
+               else
+                       memcpy (value, cb_msg->etwsWarningSecurityInfo, sizeof(cb_msg->etwsWarningSecurityInfo));
+       }
+       break;
+
+       default :
+               ret = MSG_ERR_INVALID_PARAMETER;
+               break;
        }
 
        return ret;
@@ -772,28 +755,25 @@ int msg_cb_message_get_str_value(void *data, int field, char *value, int size)
 EXPORT_API int msg_get_mms_struct(msg_struct_t msg_struct_handle, msg_struct_t mms_struct_handle)
 {
        CHECK_MSG_SUPPORTED(MSG_TELEPHONY_MMS_FEATURE);
-       //TODO :: check message type is MMS
+       /* TODO :: check message type is MMS */
        int ret = MSG_SUCCESS;
-       msg_struct_s *msg_struct = (msg_struct_s *)msg_struct_handle;
-       msg_struct_s *mms_struct = (msg_struct_s *)mms_struct_handle;
 
-       if (msg_struct == NULL || mms_struct == NULL) {
+       if (msg_struct_handle == NULL || mms_struct_handle == NULL)
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
-       if (msg_struct->data == NULL || mms_struct->data == NULL) {
-               return MSG_ERR_INVALID_PARAMETER;
-       }
+       msg_struct_s *msg_struct = (msg_struct_s *)msg_struct_handle;
+       msg_struct_s *mms_struct = (msg_struct_s *)mms_struct_handle;
 
-       if (msg_struct->type != MSG_STRUCT_MESSAGE_INFO || mms_struct->type != MSG_STRUCT_MMS) {
+       MSG_TYPE_CHECK(msg_struct->type, MSG_STRUCT_MESSAGE_INFO);
+       MSG_TYPE_CHECK(mms_struct->type, MSG_STRUCT_MMS);
+
+       if (msg_struct->data == NULL || mms_struct->data == NULL)
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MSG_MESSAGE_HIDDEN_S *msg_data = (MSG_MESSAGE_HIDDEN_S *)msg_struct->data;
 
-       if (msg_data->pMmsData == NULL) {
+       if (msg_data->pMmsData == NULL)
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MMS_DATA_S *mms_data = NULL;
 
@@ -813,22 +793,20 @@ EXPORT_API int msg_get_mms_struct(msg_struct_t msg_struct_handle, msg_struct_t m
 EXPORT_API int msg_set_mms_struct(msg_struct_t msg_struct_handle, msg_struct_t mms_struct_handle)
 {
        CHECK_MSG_SUPPORTED(MSG_TELEPHONY_MMS_FEATURE);
-       //TODO :: check message type is MMS
+       /* TODO :: check message type is MMS */
        int ret = MSG_SUCCESS;
-       msg_struct_s *msg_struct = (msg_struct_s *)msg_struct_handle;
-       msg_struct_s *mms_struct = (msg_struct_s *)mms_struct_handle;
 
-       if (msg_struct == NULL || mms_struct == NULL) {
+       if (msg_struct_handle == NULL || mms_struct_handle == NULL)
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
-       if (msg_struct->data == NULL || mms_struct->data == NULL) {
-               return MSG_ERR_INVALID_PARAMETER;
-       }
+       msg_struct_s *msg_struct = (msg_struct_s *)msg_struct_handle;
+       msg_struct_s *mms_struct = (msg_struct_s *)mms_struct_handle;
 
-       if (msg_struct->type != MSG_STRUCT_MESSAGE_INFO || mms_struct->type != MSG_STRUCT_MMS) {
+       MSG_TYPE_CHECK(msg_struct->type, MSG_STRUCT_MESSAGE_INFO);
+       MSG_TYPE_CHECK(mms_struct->type, MSG_STRUCT_MMS);
+
+       if (msg_struct->data == NULL || mms_struct->data == NULL)
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MSG_MESSAGE_HIDDEN_S *msg_data = (MSG_MESSAGE_HIDDEN_S *)msg_struct->data;
 
@@ -843,7 +821,7 @@ EXPORT_API int msg_set_mms_struct(msg_struct_t msg_struct_handle, msg_struct_t m
        if (mmsDataSize > 0)
                msg_data->mmsDataSize = mmsDataSize;
 
-       //TODO:: set subtype
+       /* TODO:: set subtype */
 
        MsgMmsRelease(&mms_data);
 
@@ -858,7 +836,7 @@ int msg_message_list_append(msg_struct_t msg_struct_handle, int field, msg_struc
        MSG_MESSAGE_HIDDEN_S *msg_data = (MSG_MESSAGE_HIDDEN_S *)msg_struct->data;
 
        msg_struct_s *msg_struct_item = NULL;
-       switch(field) {
+       switch (field) {
        case MSG_MESSAGE_ADDR_LIST_HND:
        {
                msg_struct_item = __msg_message_create_address_struct();
@@ -881,10 +859,10 @@ int msg_message_list_clear(msg_struct_t msg_struct_handle, int field)
        msg_struct_s *msg_struct = (msg_struct_s *)msg_struct_handle;
        MSG_MESSAGE_HIDDEN_S *msg_data = (MSG_MESSAGE_HIDDEN_S *)msg_struct->data;
 
-       switch(field) {
+       switch (field) {
        case MSG_MESSAGE_ADDR_LIST_HND:
        {
-               // Free GList *addressList
+               /* Free GList *addressList */
                if (msg_data->addressList) {
                        g_list_free_full(msg_data->addressList, __msg_message_release_address_struct);
                        msg_data->addressList = NULL;
index e4f157c..f8312a9 100755 (executable)
@@ -16,6 +16,7 @@
 
 #include <stdio.h>
 #include <string.h>
+#include <sys/stat.h>
 
 #include <MsgHandle.h>
 #include <MsgException.h>
 #include "MsgMmsTypes.h"
 #include "MsgMmsMessage.h"
 #include "MsgDebug.h"
+#include "MsgUtilFile.h"
 
 #include "msg.h"
 #include "msg_private.h"
 
-//Internel Struct
-typedef struct
-{
+/* Internel Struct */
+typedef struct {
        GList                   *pagelist;
        GList                   *regionlist;
        GList                   *attachlist;
@@ -39,11 +40,10 @@ typedef struct
        MMS_APPID_INFO_S        msgAppId;
        MMS_HEADER_DATA_S header;
        MMS_MULTIPART_DATA_S smil;
-       GList *multipartlist;//MMS_MULTIPART_DATA_S
+       GList *multipartlist; /* MMS_MULTIPART_DATA_S */
 } MMS_DATA_HIDDEN_S;
 
-typedef struct
-{
+typedef struct {
        MmsSmilMediaType        mediatype; /**< Indicates the SMIL media type. see enum MmsSmilMediaType */
 
        char                    szSrc[MSG_FILEPATH_LEN_MAX + 1];/**< Indicates the media source name */
@@ -69,6 +69,7 @@ static void __msg_mms_release_attach(msg_struct_s *attach_struct);
 static void __msg_mms_release_transition(msg_struct_s *transition_struct);
 static void __msg_mms_release_meta(msg_struct_s *meta_struct);
 static void __msg_mms_release_multipart(msg_struct_s *multipart_struct);
+
 /*==================================================================================================
                                      FUNCTION IMPLEMENTATION
 ==================================================================================================*/
@@ -117,8 +118,7 @@ void *msg_mms_create_struct_data(int field)
 {
        void *data = NULL;
 
-       switch(field)
-       {
+       switch (field) {
        case MSG_STRUCT_MMS:
                data = (void *)new MMS_DATA_HIDDEN_S;
                bzero(data, sizeof(MMS_DATA_HIDDEN_S));
@@ -176,20 +176,31 @@ void *msg_mms_create_struct_data(int field)
 void msg_mms_list_item_free_func(gpointer data)
 {
        msg_struct_s *msg_struct = (msg_struct_s *)data;
-       if (msg_struct->type == MSG_STRUCT_MMS_MEDIA)  {
+
+       switch (msg_struct->type) {
+       case MSG_STRUCT_MMS_MEDIA :
                __msg_mms_release_media(msg_struct);
-       } else if (msg_struct->type == MSG_STRUCT_MMS_PAGE) {
+               break;
+       case MSG_STRUCT_MMS_PAGE :
                __msg_mms_release_page(msg_struct);
-       } else if (msg_struct->type == MSG_STRUCT_MMS_ATTACH) {
+               break;
+       case MSG_STRUCT_MMS_ATTACH :
                __msg_mms_release_attach(msg_struct);
-       } else if (msg_struct->type == MSG_STRUCT_MMS_REGION) {
+               break;
+       case MSG_STRUCT_MMS_REGION :
                __msg_mms_release_region(msg_struct);
-       } else if (msg_struct->type == MSG_STRUCT_MMS_TRANSITION) {
+               break;
+       case MSG_STRUCT_MMS_TRANSITION :
                __msg_mms_release_transition(msg_struct);
-       } else if (msg_struct->type == MSG_STRUCT_MMS_META) {
+               break;
+       case MSG_STRUCT_MMS_META :
                __msg_mms_release_meta(msg_struct);
-       } else if (msg_struct->type == MSG_STRUCT_MULTIPART_INFO) {
+               break;
+       case MSG_STRUCT_MULTIPART_INFO :
                __msg_mms_release_multipart(msg_struct);
+               break;
+       default :
+               break;
        }
 }
 
@@ -355,8 +366,7 @@ int msg_mms_release_struct(msg_struct_s **msg_struct_data)
        msg_struct_s *msg_struct = (msg_struct_s *)*msg_struct_data;
        int type = msg_struct->type;
 
-       switch(type)
-       {
+       switch (type) {
        case MSG_STRUCT_MMS:
                __msg_mms_release_mms(*msg_struct_data);
                *msg_struct_data = NULL;
@@ -420,7 +430,7 @@ int msg_mms_get_int_value(msg_struct_s *msg_struct, int field, int *value)
 {
        msg_error_t err = MSG_SUCCESS;
 
-       switch(msg_struct->type) {
+       switch (msg_struct->type) {
        case MSG_STRUCT_MMS:
        {
                MMS_DATA_HIDDEN_S *mms_data = (MMS_DATA_HIDDEN_S *)msg_struct->data;
@@ -578,7 +588,7 @@ int msg_mms_get_int_value(msg_struct_s *msg_struct, int field, int *value)
        break;
        case MSG_STRUCT_MULTIPART_INFO:
                err = msg_multipart_get_int_value(msg_struct->data, field, value);
-       break;
+               break;
 
        default :
                err = MSG_ERR_INVALID_PARAMETER;
@@ -591,11 +601,11 @@ int msg_mms_get_str_value(msg_struct_s *msg_struct, int field, char *value, int
 {
        msg_error_t err = MSG_SUCCESS;
 
-       switch(msg_struct->type) {
+       switch (msg_struct->type) {
        case MSG_STRUCT_MMS:
        {
                MMS_DATA_HIDDEN_S *mms_data = (MMS_DATA_HIDDEN_S *)msg_struct->data;
-               if (field == MSG_MMS_HEADER_CONTENT_LOCATION_STR) {// mms header
+               if (field == MSG_MMS_HEADER_CONTENT_LOCATION_STR) { /* mms header */
                        strncpy(value, mms_data->header.contentLocation, size);
                } else if (field == MSG_MMS_HEADER_CONTENT_TYPE_STR) {
                        strncpy(value, mms_data->header.szContentType, size);
@@ -606,7 +616,7 @@ int msg_mms_get_str_value(msg_struct_s *msg_struct, int field, char *value, int
                } else if (field == MSG_MMS_HEADER_TR_ID_STR) {
                        strncpy(value, mms_data->header.trID, size);
 
-               } else if (field == MSG_MMS_SMIL_MULTIPART_CONTENT_TYPE_STR) { // smil
+               } else if (field == MSG_MMS_SMIL_MULTIPART_CONTENT_TYPE_STR) { /* smil */
                        strncpy(value, mms_data->smil.szContentType, size);
                } else if (field == MSG_MMS_SMIL_MULTIPART_NAME_STR) {
                        strncpy(value, mms_data->smil.szFileName, size);
@@ -720,7 +730,7 @@ int msg_mms_get_str_value(msg_struct_s *msg_struct, int field, char *value, int
        break;
 
        default :
-                       err = MSG_ERR_INVALID_PARAMETER;
+               err = MSG_ERR_INVALID_PARAMETER;
                break;
        }
        return err;
@@ -730,7 +740,7 @@ int msg_mms_get_bool_value(msg_struct_s *msg_struct, int field, bool *value)
 {
        msg_error_t err = MSG_SUCCESS;
 
-       switch(msg_struct->type) {
+       switch (msg_struct->type) {
        case MSG_STRUCT_MMS:
        {
                MMS_DATA_HIDDEN_S *mms_data = (MMS_DATA_HIDDEN_S *)msg_struct->data;
@@ -787,7 +797,7 @@ int msg_mms_get_struct_handle(msg_struct_s *msg_struct, int field, msg_struct_s
 {
        msg_error_t err = MSG_SUCCESS;
 
-       switch(msg_struct->type) {
+       switch (msg_struct->type) {
        case MSG_STRUCT_MMS_MEDIA:
        {
                MMS_MEDIA_HIDDEN_S *mms_media_data = (MMS_MEDIA_HIDDEN_S *)msg_struct->data;
@@ -810,7 +820,7 @@ int msg_mms_get_list_handle(msg_struct_s *msg_struct, int field, msg_list_handle
 {
        msg_error_t err = MSG_SUCCESS;
 
-       switch(msg_struct->type) {
+       switch (msg_struct->type) {
        case MSG_STRUCT_MMS:
        {
                MMS_DATA_HIDDEN_S *mms_data = (MMS_DATA_HIDDEN_S *)msg_struct->data;
@@ -850,7 +860,7 @@ int msg_mms_set_int_value(msg_struct_s *msg_struct, int field, int value)
 {
        msg_error_t err = MSG_SUCCESS;
 
-       switch(msg_struct->type) {
+       switch (msg_struct->type) {
        case MSG_STRUCT_MMS:
        {
                MMS_DATA_HIDDEN_S *mms_data = (MMS_DATA_HIDDEN_S *)msg_struct->data;
@@ -1019,7 +1029,7 @@ int msg_mms_set_str_value(msg_struct_s *msg_struct, int field, char *value, int
 {
        msg_error_t err = MSG_SUCCESS;
 
-       switch(msg_struct->type) {
+       switch (msg_struct->type) {
        case MSG_STRUCT_MMS_MEDIA:
        {
                MMS_MEDIA_HIDDEN_S *mms_media_data = (MMS_MEDIA_HIDDEN_S *)msg_struct->data;
@@ -1053,9 +1063,9 @@ int msg_mms_set_str_value(msg_struct_s *msg_struct, int field, char *value, int
                else if (field == MSG_MMS_MEDIA_DRM_FULLPATH_STR)
                        strncpy(mms_media_data->szDrm2FullPath, value, MSG_FILEPATH_LEN_MAX);
                else if (field == MSG_MMS_MEDIA_CONTENT_LOCATION_STR)
-                       strncpy(mms_media_data->szContentLocation, value, MSG_FILEPATH_LEN_MAX);
+                       strncpy(mms_media_data->szContentLocation, value, MSG_MSG_ID_LEN);
                else if (field == MSG_MMS_MEDIA_CONTENT_TYPE_STR)
-                       strncpy(mms_media_data->szContentType, value, MSG_FILEPATH_LEN_MAX);
+                       strncpy(mms_media_data->szContentType, value, MSG_MSG_ID_LEN);
                else
                        err = MSG_ERR_INVALID_PARAMETER;
        }
@@ -1090,7 +1100,7 @@ int msg_mms_set_str_value(msg_struct_s *msg_struct, int field, char *value, int
                } else if (field == MSG_MMS_ATTACH_DRM_FULLPATH_STR) {
                        strncpy(mms_attach_data->szDrm2FullPath, value, MSG_FILEPATH_LEN_MAX);
                } else if (field == MSG_MMS_ATTACH_CONTENT_TYPE_STR) {
-                       strncpy(mms_attach_data->szContentType, value, MSG_FILEPATH_LEN_MAX);
+                       strncpy(mms_attach_data->szContentType, value, MSG_MSG_ID_LEN);
                } else {
                        err = MSG_ERR_INVALID_PARAMETER;
                }
@@ -1152,7 +1162,7 @@ int msg_mms_set_str_value(msg_struct_s *msg_struct, int field, char *value, int
        case MSG_STRUCT_MMS:
        {
                MMS_DATA_HIDDEN_S *mms_data = (MMS_DATA_HIDDEN_S *)msg_struct->data;
-               if (field == MSG_MMS_HEADER_CONTENT_LOCATION_STR) {// mms header
+               if (field == MSG_MMS_HEADER_CONTENT_LOCATION_STR) { /* mms header */
                        strncpy(mms_data->header.contentLocation, value, sizeof(mms_data->header.contentLocation) - 1 );
                } else if (field == MSG_MMS_HEADER_CONTENT_TYPE_STR) {
                        strncpy(mms_data->header.szContentType, value, sizeof(mms_data->header.szContentType) - 1 );
@@ -1163,7 +1173,7 @@ int msg_mms_set_str_value(msg_struct_s *msg_struct, int field, char *value, int
                } else if (field == MSG_MMS_HEADER_TR_ID_STR) {
                        strncpy(mms_data->header.trID, value, sizeof(mms_data->header.trID) - 1 );
 
-               } else if (field == MSG_MMS_SMIL_MULTIPART_CONTENT_TYPE_STR) { // smil
+               } else if (field == MSG_MMS_SMIL_MULTIPART_CONTENT_TYPE_STR) { /* smil */
                        strncpy(mms_data->smil.szContentType, value, sizeof(mms_data->smil.szContentType) - 1 );
                } else if (field == MSG_MMS_SMIL_MULTIPART_NAME_STR) {
                        strncpy(mms_data->smil.szFileName, value, sizeof(mms_data->smil.szFileName) - 1 );
@@ -1183,9 +1193,10 @@ int msg_mms_set_str_value(msg_struct_s *msg_struct, int field, char *value, int
        break;
 
        default :
-                       err = MSG_ERR_INVALID_PARAMETER;
+               err = MSG_ERR_INVALID_PARAMETER;
                break;
        }
+
        return err;
 }
 
@@ -1193,7 +1204,7 @@ int msg_mms_set_bool_value(msg_struct_s *msg_struct, int field, bool value)
 {
        msg_error_t err = MSG_SUCCESS;
 
-       switch(msg_struct->type) {
+       switch (msg_struct->type) {
        case MSG_STRUCT_MMS:
        {
                MMS_DATA_HIDDEN_S *mms_data = (MMS_DATA_HIDDEN_S *)msg_struct->data;
@@ -1246,7 +1257,7 @@ int msg_mms_set_struct_handle(msg_struct_s *msg_struct, int field, msg_struct_s
 {
        msg_error_t err = MSG_SUCCESS;
 
-       switch(msg_struct->type) {
+       switch (msg_struct->type) {
        case MSG_STRUCT_MMS_MEDIA:
        {
                MMS_MEDIA_HIDDEN_S *mms_media_data = (MMS_MEDIA_HIDDEN_S *)msg_struct->data;
@@ -1266,51 +1277,13 @@ int msg_mms_set_struct_handle(msg_struct_s *msg_struct, int field, msg_struct_s
        return err;
 }
 
-int msg_mms_set_list_handle(msg_struct_s *msg_struct, int field, msg_list_handle_t value)
-{
-       msg_error_t err = MSG_SUCCESS;
-
-       switch(msg_struct->type) {
-       case MSG_STRUCT_MMS:
-       {
-               MMS_DATA_HIDDEN_S *mms_data = (MMS_DATA_HIDDEN_S *)msg_struct->data;
-               if (field == MSG_MMS_PAGE_LIST_HND)
-                       mms_data->pagelist = (GList *)value;
-               else if (field == MSG_MMS_REGION_LIST_HND)
-                       mms_data->regionlist = (GList *)value;
-               else if (field == MSG_MMS_ATTACH_LIST_HND)
-                       mms_data->attachlist = (GList *)value;
-               else if (field == MSG_MMS_TRANSITION_LIST_HND)
-                       mms_data->transitionlist = (GList *)value;
-               else if (field == MSG_MMS_META_LIST_HND)
-                       mms_data->metalist = (GList *)value;
-               else
-                       err = MSG_ERR_INVALID_PARAMETER;
-       }
-       break;
-       case MSG_STRUCT_MMS_PAGE:
-       {
-               MMS_PAGE_S *mms_page_data = (MMS_PAGE_S *)msg_struct->data;
-               if (field == MSG_MMS_PAGE_MEDIA_LIST_HND)
-                       mms_page_data->medialist = (GList *)value;
-               else
-                       err = MSG_ERR_INVALID_PARAMETER;
-       }
-       break;
-       default :
-               err = MSG_ERR_INVALID_PARAMETER;
-               break;
-       }
-       return err;
-}
-
 int msg_mms_list_append(msg_struct_t msg_struct_handle, int field, msg_struct_t *item)
 {
        msg_error_t err = MSG_SUCCESS;
        msg_struct_s *msg_struct = (msg_struct_s *)msg_struct_handle;
 
        msg_struct_s *msg_struct_item = NULL;
-       switch(msg_struct->type) {
+       switch (msg_struct->type) {
        case MSG_STRUCT_MMS:
        {
 
@@ -1423,171 +1396,9 @@ void convert_from_media_data(const MMS_MEDIA_S *pSrc, msg_struct_s *pDest)
        }
 }
 
-void convert_to_mmsdata(const msg_struct_s *pSrc, MMS_MESSAGE_DATA_S *pDest)
-{
-       int i, j;
-       MMS_DATA_HIDDEN_S *pSrcMms = (MMS_DATA_HIDDEN_S *)pSrc->data;
-
-       pDest->pageCnt = g_list_length(pSrcMms->pagelist);
-
-       for (i = 0; i < pDest->pageCnt; i++) {
-               MMS_PAGE_S *page = (MMS_PAGE_S *)calloc(1, sizeof(MMS_PAGE_S));
-               if (page) {
-                       MMS_PAGE_S *src_page = (MMS_PAGE_S *)get_msg_struct_data((msg_struct_s *)g_list_nth_data(pSrcMms->pagelist, i));
-                       page->mediaCnt = g_list_length(src_page->medialist);
-
-                       for (j = 0; j < page->mediaCnt; j++)
-                       {
-                               MMS_MEDIA_S *dst_media = (MMS_MEDIA_S *)calloc(1, sizeof(MMS_MEDIA_S));
-                               msg_struct_s *src_media_s = (msg_struct_s *)g_list_nth_data(src_page->medialist, j);
-
-                               if (dst_media)
-                                       convert_to_media_data(src_media_s, dst_media);
-
-                               page->medialist = g_list_append(page->medialist, dst_media);
-                       }
-
-                       page->nDur = src_page->nDur;
-                       page->nBegin = src_page->nBegin;
-                       page->nEnd = src_page->nEnd;
-                       page->nMin = src_page->nMin;
-                       page->nMax = src_page->nMax;
-                       page->nRepeat = src_page->nRepeat;
-
-                       pDest->pagelist = g_list_append(pDest->pagelist, page);
-               }
-       }
-
-       pDest->regionCnt = g_list_length(pSrcMms->regionlist);
-
-       for (i = 0; i < pDest->regionCnt; i++) {
-               MMS_SMIL_REGION *region = (MMS_SMIL_REGION *)calloc(1, sizeof(MMS_SMIL_REGION));
-               if (region) {
-                       MMS_SMIL_REGION *src_region = (MMS_SMIL_REGION *)get_msg_struct_data((msg_struct_s *)g_list_nth_data(pSrcMms->regionlist, i));
-                       memcpy(region, src_region, sizeof(MMS_SMIL_REGION));
-                       pDest->regionlist = g_list_append(pDest->regionlist, region);
-               }
-       }
-
-       pDest->attachCnt = g_list_length(pSrcMms->attachlist);
-
-       for (i = 0; i < pDest->attachCnt; i++) {
-               MMS_ATTACH_S *attach = (MMS_ATTACH_S *)calloc(1, sizeof(MMS_ATTACH_S));
-               if (attach) {
-                       MMS_ATTACH_S *src_attach = (MMS_ATTACH_S *)get_msg_struct_data((msg_struct_s *)g_list_nth_data(pSrcMms->attachlist, i));
-                       memcpy(attach, src_attach, sizeof(MMS_ATTACH_S));
-                       pDest->attachlist = g_list_append(pDest->attachlist, attach);
-               }
-       }
-
-       pDest->transitionCnt = g_list_length(pSrcMms->transitionlist);
-
-       for (i = 0; i < pDest->transitionCnt; i++) {
-               MMS_SMIL_TRANSITION *transition = (MMS_SMIL_TRANSITION *)calloc(1, sizeof(MMS_SMIL_TRANSITION));
-               if (transition) {
-                       MMS_SMIL_TRANSITION *src_transition = (MMS_SMIL_TRANSITION *)get_msg_struct_data((msg_struct_s *)g_list_nth_data(pSrcMms->transitionlist, i));
-                       memcpy(transition, src_transition, sizeof(MMS_SMIL_TRANSITION));
-                       pDest->transitionlist = g_list_append(pDest->transitionlist, transition);
-               }
-       }
-
-       pDest->metaCnt = g_list_length(pSrcMms->metalist);
-
-       for (i = 0; i < pDest->metaCnt; i++) {
-               MMS_SMIL_META *meta = (MMS_SMIL_META *)calloc(1, sizeof(MMS_SMIL_META));
-               if (meta) {
-                       MMS_SMIL_META *src_meta = (MMS_SMIL_META *)get_msg_struct_data((msg_struct_s *)g_list_nth_data(pSrcMms->metalist, i));
-                       memcpy(meta, src_meta, sizeof(MMS_SMIL_META));
-                       pDest->metalist = g_list_append(pDest->metalist, meta);
-               }
-       }
-
-       memcpy(&pDest->rootlayout, &pSrcMms->rootlayout, sizeof(MMS_SMIL_ROOTLAYOUT));
-
-       memcpy(&pDest->msgAppId, &pSrcMms->msgAppId, sizeof(MMS_APPID_INFO_S));
-       memcpy(&pDest->header, &pSrcMms->header, sizeof(MMS_HEADER_DATA_S));
-       memcpy(&pDest->smil, &pSrcMms->smil, sizeof(MMS_MULTIPART_DATA_S));
-}
-
-void convert_from_mmsdata(const MMS_MESSAGE_DATA_S *pSrc, msg_struct_s *pDest)
-{
-       int i, j;
-       MMS_DATA_HIDDEN_S *pDestMms = (MMS_DATA_HIDDEN_S *)pDest->data;
-
-       for (i = 0; i < pSrc->pageCnt; i++) {
-               msg_struct_s *page_struct = msg_mms_create_struct(MSG_STRUCT_MMS_PAGE);
-               MMS_PAGE_S *page = (MMS_PAGE_S *)page_struct->data;
-
-               MMS_PAGE_S *src_page = (MMS_PAGE_S *)g_list_nth_data(pSrc->pagelist, i);
-               page->mediaCnt = g_list_length(src_page->medialist);
-
-               for (j = 0; j < page->mediaCnt; j++)
-               {
-                       msg_struct_s *dst_media_s = msg_mms_create_struct(MSG_STRUCT_MMS_MEDIA);
-
-                       MMS_MEDIA_S *src_media = (MMS_MEDIA_S *)g_list_nth_data(src_page->medialist, j);
-
-                       convert_from_media_data(src_media, dst_media_s);
-
-                       page->medialist = g_list_append(page->medialist, dst_media_s);
-               }
-
-               page->nDur = src_page->nDur;
-               page->nBegin = src_page->nBegin;
-               page->nEnd = src_page->nEnd;
-               page->nMin = src_page->nMin;
-               page->nMax = src_page->nMax;
-               page->nRepeat = src_page->nRepeat;
-
-               pDestMms->pagelist = g_list_append(pDestMms->pagelist, page_struct);
-       }
-
-       for (i = 0; i < pSrc->regionCnt; i++) {
-               msg_struct_s *region_struct = msg_mms_create_struct(MSG_STRUCT_MMS_REGION);
-               MMS_SMIL_REGION *region = (MMS_SMIL_REGION *)region_struct->data;
-               MMS_SMIL_REGION *src_region = (MMS_SMIL_REGION *)g_list_nth_data(pSrc->regionlist, i);
-               memcpy(region, src_region, sizeof(MMS_SMIL_REGION));
-               pDestMms->regionlist = g_list_append(pDestMms->regionlist, region_struct);
-       }
-
-       for (i = 0; i < pSrc->attachCnt; i++) {
-               msg_struct_s *attach_struct = msg_mms_create_struct(MSG_STRUCT_MMS_ATTACH);
-               MMS_ATTACH_S *attach = (MMS_ATTACH_S *)attach_struct->data;
-               MMS_ATTACH_S *src_attach = (MMS_ATTACH_S *)g_list_nth_data(pSrc->attachlist, i);
-               memcpy(attach, src_attach, sizeof(MMS_ATTACH_S));
-               pDestMms->attachlist = g_list_append(pDestMms->attachlist, attach_struct);
-       }
-
-       for (i = 0; i < pSrc->transitionCnt; i++) {
-               msg_struct_s *transition_struct = msg_mms_create_struct(MSG_STRUCT_MMS_TRANSITION);
-               MMS_SMIL_TRANSITION *transition = (MMS_SMIL_TRANSITION *)transition_struct->data;
-               MMS_SMIL_TRANSITION *src_transition = (MMS_SMIL_TRANSITION *)g_list_nth_data(pSrc->transitionlist, i);
-               memcpy(transition, src_transition, sizeof(MMS_SMIL_TRANSITION));
-               pDestMms->transitionlist = g_list_append(pDestMms->transitionlist, transition_struct);
-       }
-
-       for (i = 0; i < pSrc->metaCnt; i++) {
-               msg_struct_s *meta_struct = msg_mms_create_struct(MSG_STRUCT_MMS_META);
-               MMS_SMIL_META *meta = (MMS_SMIL_META *)meta_struct->data;
-               MMS_SMIL_META *src_meta = (MMS_SMIL_META *)g_list_nth_data(pSrc->metalist, i);
-
-               memcpy(meta, src_meta, sizeof(MMS_SMIL_META));
-               pDestMms->metalist = g_list_append(pDestMms->metalist, meta_struct);
-       }
-
-       memcpy(&pDestMms->rootlayout, &pSrc->rootlayout, sizeof(MMS_SMIL_ROOTLAYOUT));
-
-       memcpy(&pDestMms->msgAppId, &pSrc->msgAppId, sizeof(MMS_APPID_INFO_S));
-
-       memcpy(&pDestMms->header, &pSrc->header, sizeof(MMS_HEADER_DATA_S));
-       memcpy(&pDestMms->smil, &pSrc->smil, sizeof(MMS_MULTIPART_DATA_S));
-
-}
-
 void convert_to_mmsdata2(MMS_DATA_HIDDEN_S *pSrcMms, MMS_MESSAGE_DATA_S *pDest)
 {
        int i, j;
-       //MMS_DATA_HIDDEN_S *pSrcMms = (MMS_DATA_HIDDEN_S *)pSrc->data;
 
        pDest->pageCnt = g_list_length(pSrcMms->pagelist);
 
@@ -1674,7 +1485,6 @@ void convert_to_mmsdata2(MMS_DATA_HIDDEN_S *pSrcMms, MMS_MESSAGE_DATA_S *pDest)
 void convert_from_mmsdata2(const MMS_MESSAGE_DATA_S *pSrc, MMS_DATA_HIDDEN_S *pDestMms)
 {
        int i, j;
-       //MMS_DATA_HIDDEN_S *pDestMms = (MMS_DATA_HIDDEN_S *)pDest->data;
 
        for (i = 0; i < pSrc->pageCnt; i++) {
                msg_struct_s *page_struct = msg_mms_create_struct(MSG_STRUCT_MMS_PAGE);
@@ -1794,15 +1604,15 @@ int msg_multipart_get_int_value(void *data, int field, int *value)
        MMS_MULTIPART_DATA_S *msg_data = (MMS_MULTIPART_DATA_S *)data;
 
        switch (field) {
-               case MSG_MMS_MULTIPART_TCS_LEVEL_INT:
-                       *value = msg_data->tcs_bc_level;
-                       break;
-               case MSG_MMS_MULTIPART_MALWARE_ALLOW_INT:
-                       *value = msg_data->malware_allow;
-                       break;
-               default :
-                       ret = MSG_ERR_INVALID_PARAMETER;
-                       break;
+       case MSG_MMS_MULTIPART_TCS_LEVEL_INT:
+               *value = msg_data->tcs_bc_level;
+               break;
+       case MSG_MMS_MULTIPART_MALWARE_ALLOW_INT:
+               *value = msg_data->malware_allow;
+               break;
+       default :
+               ret = MSG_ERR_INVALID_PARAMETER;
+               break;
        }
 
        return ret;
@@ -1817,7 +1627,7 @@ int msg_multipart_set_str_value(void *data, int field, char *value, int size)
 
        MMS_MULTIPART_DATA_S *msg_data = (MMS_MULTIPART_DATA_S *)data;
 
-       //CID 41980: Reducing the size argument to strncpy calls to accomodate string termination '\0' in case source string is larger than size
+       /* CID 41980: Reducing the size argument to strncpy calls to accomodate string termination '\0' in case source string is larger than size */
        switch (field) {
        case MSG_MMS_MULTIPART_CONTENT_TYPE_STR:
                strncpy(msg_data->szContentType, value, MSG_MSG_ID_LEN);
@@ -1829,6 +1639,7 @@ int msg_multipart_set_str_value(void *data, int field, char *value, int size)
                strncpy(msg_data->szFilePath, value, MSG_FILEPATH_LEN_MAX);
                break;
        case MSG_MMS_MULTIPART_THUMBNAIL_FILEPATH_STR:
+               strncpy(msg_data->szThumbFilePath, value, MSG_FILEPATH_LEN_MAX);
                break;
        case MSG_MMS_MULTIPART_CONTENT_ID_STR:
                strncpy(msg_data->szContentID, value, MSG_MSG_ID_LEN);
index 4538163..386d47d 100755 (executable)
@@ -33,37 +33,37 @@ int msg_setting_get_int_value(msg_struct_s *msg_struct, int field, int *value)
 
        switch (msg_struct->type) {
        case MSG_STRUCT_SETTING_SMSC_OPT :
-               *value = msg_get_smsc_opt_int(msg_struct->data, field);
+               err = msg_get_smsc_opt_int(msg_struct->data, field, value);
                break;
        case MSG_STRUCT_SETTING_SMSC_INFO :
-               *value = msg_get_smsc_info_int(msg_struct->data, field);
+               err = msg_get_smsc_info_int(msg_struct->data, field, value);
                break;
        case MSG_STRUCT_SETTING_CB_OPT :
-               *value = msg_get_cb_option_int(msg_struct->data, field);
+               err = msg_get_cb_option_int(msg_struct->data, field, value);
                break;
        case MSG_STRUCT_SETTING_CB_CHANNEL_INFO :
-               *value = msg_get_cb_channel_info_int(msg_struct->data, field);
+               err = msg_get_cb_channel_info_int(msg_struct->data, field, value);
                break;
        case MSG_STRUCT_SETTING_SMS_SEND_OPT :
-               *value = msg_get_sms_send_opt_int(msg_struct->data, field);
+               err = msg_get_sms_send_opt_int(msg_struct->data, field, value);
                break;
        case MSG_STRUCT_SETTING_MMS_SEND_OPT :
-               *value = msg_get_mms_send_opt_int(msg_struct->data, field);
+               err = msg_get_mms_send_opt_int(msg_struct->data, field, value);
                break;
        case MSG_STRUCT_SETTING_MMS_RECV_OPT :
-               *value = msg_get_mms_recv_opt_int(msg_struct->data, field);
+               err = msg_get_mms_recv_opt_int(msg_struct->data, field, value);
                break;
        case MSG_STRUCT_SETTING_PUSH_MSG_OPT :
-               *value = msg_get_push_msg_opt_int(msg_struct->data, field);
+               err = msg_get_push_msg_opt_int(msg_struct->data, field, value);
                break;
        case MSG_STRUCT_SETTING_GENERAL_OPT :
-               *value = msg_get_general_opt_int(msg_struct->data, field);
+               err = msg_get_general_opt_int(msg_struct->data, field, value);
                break;
        case MSG_STRUCT_SETTING_MSGSIZE_OPT :
-               *value = msg_get_msgsize_opt_int(msg_struct->data, field);
+               err = msg_get_msgsize_opt_int(msg_struct->data, field, value);
                break;
        case MSG_STRUCT_SETTING_VOICE_MSG_OPT :
-               *value = msg_get_voice_msg_opt_int(msg_struct->data, field);
+               err = msg_get_voice_msg_opt_int(msg_struct->data, field, value);
                break;
        default :
                err = MSG_ERR_INVALID_PARAMETER;
@@ -76,30 +76,19 @@ int msg_setting_get_int_value(msg_struct_s *msg_struct, int field, int *value)
 int msg_setting_get_str_value(msg_struct_s *msg_struct, int field, char *src, int size)
 {
        int err = MSG_SUCCESS;
-       char *ret_str = NULL;
 
-       switch (msg_struct->type)
-       {
+       switch (msg_struct->type) {
        case MSG_STRUCT_SETTING_SMSC_INFO :
-               ret_str = msg_get_smsc_info_str(msg_struct->data, field);
-               if (ret_str == NULL)
-                       err = MSG_ERR_UNKNOWN;
-               else
-                       strncpy(src, ret_str, size);
+               err = msg_get_smsc_info_str(msg_struct->data, field, src, size);
                break;
        case MSG_STRUCT_SETTING_CB_CHANNEL_INFO :
-               ret_str = msg_get_cb_channel_info_str(msg_struct->data, field);
-               if (ret_str == NULL)
-                       err = MSG_ERR_UNKNOWN;
-               else
-                       strncpy(src, ret_str, size);
+               err = msg_get_cb_channel_info_str(msg_struct->data, field, src, size);
                break;
        case MSG_STRUCT_SETTING_VOICE_MSG_OPT :
-               ret_str = msg_get_voice_msg_opt_str(msg_struct->data, field);
-               if (ret_str == NULL)
-                       err = MSG_ERR_UNKNOWN;
-               else
-                       strncpy(src, ret_str, size);
+               err = msg_get_voice_msg_opt_str(msg_struct->data, field, src, size);
+               break;
+       case MSG_STRUCT_SETTING_GENERAL_OPT :
+               err = msg_get_general_opt_str(msg_struct->data, field, src, size);
                break;
        default :
                err = MSG_ERR_INVALID_PARAMETER;
@@ -115,25 +104,25 @@ int msg_setting_get_bool_value(msg_struct_s *msg_struct, int field, bool *value)
 
        switch (msg_struct->type) {
        case MSG_STRUCT_SETTING_CB_OPT :
-               *value = msg_get_cb_option_bool(msg_struct->data, field);
+               err = msg_get_cb_option_bool(msg_struct->data, field, value);
                break;
        case MSG_STRUCT_SETTING_CB_CHANNEL_INFO :
-               *value = msg_get_cb_channel_info_bool(msg_struct->data, field);
+               err = msg_get_cb_channel_info_bool(msg_struct->data, field, value);
                break;
        case MSG_STRUCT_SETTING_SMS_SEND_OPT :
-               *value = msg_get_sms_send_opt_bool(msg_struct->data, field);
+               err = msg_get_sms_send_opt_bool(msg_struct->data, field, value);
                break;
        case MSG_STRUCT_SETTING_MMS_SEND_OPT :
-               *value = msg_get_mms_send_opt_bool(msg_struct->data, field);
+               err = msg_get_mms_send_opt_bool(msg_struct->data, field, value);
                break;
        case MSG_STRUCT_SETTING_MMS_RECV_OPT :
-               *value = msg_get_mms_recv_opt_bool(msg_struct->data, field);
+               err = msg_get_mms_recv_opt_bool(msg_struct->data, field, value);
                break;
        case MSG_STRUCT_SETTING_PUSH_MSG_OPT :
-               *value = msg_get_push_msg_opt_bool(msg_struct->data, field);
+               err = msg_get_push_msg_opt_bool(msg_struct->data, field, value);
                break;
        case MSG_STRUCT_SETTING_GENERAL_OPT :
-               *value = msg_get_general_opt_bool(msg_struct->data, field);
+               err = msg_get_general_opt_bool(msg_struct->data, field, value);
                break;
        default :
                err = MSG_ERR_INVALID_PARAMETER;
@@ -155,6 +144,7 @@ int msg_setting_get_list_handle(msg_struct_s *msg_struct, int field, void **valu
                err = msg_get_cb_option_list(msg_struct->data, field, value);
                break;
        default :
+               err = MSG_ERR_INVALID_PARAMETER;
                break;
        }
 
@@ -211,8 +201,7 @@ int msg_setting_set_str_value(msg_struct_s *msg_struct, int field, char *value,
 {
        int err = MSG_SUCCESS;
 
-       switch (msg_struct->type)
-       {
+       switch (msg_struct->type) {
        case MSG_STRUCT_SETTING_SMSC_INFO :
                err = msg_set_smsc_info_str(msg_struct->data, field, value, size);
                break;
@@ -222,6 +211,9 @@ int msg_setting_set_str_value(msg_struct_s *msg_struct, int field, char *value,
        case MSG_STRUCT_SETTING_VOICE_MSG_OPT :
                err = msg_set_voice_msg_opt_str(msg_struct->data, field, value, size);
                break;
+       case MSG_STRUCT_SETTING_GENERAL_OPT :
+               err = msg_set_general_opt_str(msg_struct->data, field, value, size);
+               break;
        default :
                err = MSG_ERR_INVALID_PARAMETER;
                break;
@@ -267,31 +259,24 @@ int msg_setting_set_bool_value(msg_struct_s *msg_struct, int field, bool value)
 
 EXPORT_API int msg_get_smsc_opt(msg_handle_t handle, msg_struct_t msg_struct)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
 
-       msg_error_t err =  MSG_SUCCESS;
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
-       if (handle == NULL)
-       {
+       if (handle == NULL || msg_struct == NULL)
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->getSMSCOption(msg_struct);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_SET_READ_ERROR;
        }
@@ -301,31 +286,24 @@ EXPORT_API int msg_get_smsc_opt(msg_handle_t handle, msg_struct_t msg_struct)
 
 EXPORT_API int msg_set_smsc_opt(msg_handle_t handle, msg_struct_t msg_struct)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
 
-       msg_error_t err =  MSG_SUCCESS;
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL || msg_struct == NULL)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->setSMSCOption(msg_struct);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_SET_READ_ERROR;
        }
@@ -342,19 +320,19 @@ int msg_get_smsc_opt_list(void *smsc_opt, int field, void **value)
 
        int ret = MSG_SUCCESS;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_SMSC_LIST_STRUCT :
                *value = (void *)smsc_opt_data->smsc_list;
                break;
        default :
+               ret = MSG_ERR_INVALID_PARAMETER;
                break;
        }
 
        return ret;
 }
 
-int msg_get_smsc_opt_int(void *smsc_opt, int field)
+int msg_get_smsc_opt_int(void *smsc_opt, int field, int *value)
 {
        if (!smsc_opt)
                return MSG_ERR_NULL_POINTER;
@@ -363,16 +341,16 @@ int msg_get_smsc_opt_int(void *smsc_opt, int field)
 
        MSG_SMSC_LIST_HIDDEN_S *smsc_opt_data = (MSG_SMSC_LIST_HIDDEN_S *)smsc_opt;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_SMSC_SELECTED_ID_INT :
-               ret = smsc_opt_data->selected;
+               *value = smsc_opt_data->selected;
                break;
        case MSG_SMSC_LIST_SIM_INDEX_INT :
-               ret = smsc_opt_data->simIndex;
+               *value  = smsc_opt_data->simIndex;
                break;
        default :
-               return MSG_ERR_INVALID_PARAMETER;
+               ret = MSG_ERR_INVALID_PARAMETER;
+               break;
        }
 
        return ret;
@@ -387,8 +365,7 @@ int msg_set_smsc_opt_int(void *smsc_opt, int field, int value)
 
        MSG_SMSC_LIST_HIDDEN_S *smsc_opt_data = (MSG_SMSC_LIST_HIDDEN_S *)smsc_opt;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_SMSC_SELECTED_ID_INT :
                smsc_opt_data->selected = value;
                break;
@@ -406,7 +383,7 @@ int msg_set_smsc_opt_int(void *smsc_opt, int field, int value)
        return ret;
 }
 
-int msg_get_smsc_info_int(void *smsc_info, int field)
+int msg_get_smsc_info_int(void *smsc_info, int field, int *value)
 {
        if (!smsc_info)
                return MSG_ERR_NULL_POINTER;
@@ -415,22 +392,22 @@ int msg_get_smsc_info_int(void *smsc_info, int field)
 
        MSG_SMSC_DATA_S *smsc_data = (MSG_SMSC_DATA_S *)smsc_info;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_SMSC_ADDR_TON_INT :
-               ret = smsc_data->smscAddr.ton;
+               *value = smsc_data->smscAddr.ton;
                break;
        case MSG_SMSC_ADDR_NPI_INT :
-               ret = smsc_data->smscAddr.npi;
+               *value = smsc_data->smscAddr.npi;
                break;
        case MSG_SMSC_PID_INT :
-               ret = smsc_data->pid;
+               *value = smsc_data->pid;
                break;
        case MSG_SMSC_VAL_PERIOD_INT :
-               ret = smsc_data->valPeriod;
+               *value = smsc_data->valPeriod;
                break;
        default :
-               return MSG_ERR_INVALID_PARAMETER;
+               ret = MSG_ERR_INVALID_PARAMETER;
+               break;
        }
 
        return ret;
@@ -445,8 +422,7 @@ int msg_set_smsc_info_int(void *smsc_info, int field, int value)
 
        MSG_SMSC_DATA_S *smsc_data = (MSG_SMSC_DATA_S *)smsc_info;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_SMSC_ADDR_TON_INT :
                smsc_data->smscAddr.ton = value;
                break;
@@ -467,28 +443,25 @@ int msg_set_smsc_info_int(void *smsc_info, int field, int value)
        return err;
 }
 
-char *msg_get_smsc_info_str(void *smsc_info, int field)
+int msg_get_smsc_info_str(void *smsc_info, int field, char *value, int size)
 {
        if (!smsc_info)
-               return NULL;
-
-       char *ret_str = NULL;
+               return MSG_ERR_NULL_POINTER;
 
        MSG_SMSC_DATA_S *smsc_data = (MSG_SMSC_DATA_S *)smsc_info;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_SMSC_ADDR_STR :
-               ret_str = smsc_data->smscAddr.address;
+               strncpy(value, smsc_data->smscAddr.address, size);
                break;
        case MSG_SMSC_NAME_STR :
-               ret_str = smsc_data->name;
+               strncpy(value, smsc_data->name, size);
                break;
        default :
-               return NULL;
+               return MSG_ERR_INVALID_PARAMETER;
        }
 
-       return ret_str;
+       return MSG_SUCCESS;
 }
 
 int msg_set_smsc_info_str(void *smsc_info, int field, char *val, int size)
@@ -500,8 +473,7 @@ int msg_set_smsc_info_str(void *smsc_info, int field, char *val, int size)
 
        MSG_SMSC_DATA_S *smsc_data = (MSG_SMSC_DATA_S *)smsc_info;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_SMSC_ADDR_STR :
                bzero(smsc_data->smscAddr.address, sizeof(smsc_data->smscAddr.address));
                snprintf(smsc_data->smscAddr.address, sizeof(smsc_data->smscAddr.address), "%s", val);
@@ -520,31 +492,24 @@ int msg_set_smsc_info_str(void *smsc_info, int field, char *val, int size)
 
 EXPORT_API int msg_get_cb_opt(msg_handle_t handle, msg_struct_t msg_struct)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
 
-       msg_error_t err =  MSG_SUCCESS;
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
-       if (handle == NULL)
-       {
+       if (handle == NULL || msg_struct == NULL)
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->getCBOption(msg_struct);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_SET_READ_ERROR;
        }
@@ -554,31 +519,24 @@ EXPORT_API int msg_get_cb_opt(msg_handle_t handle, msg_struct_t msg_struct)
 
 EXPORT_API int msg_set_cb_opt(msg_handle_t handle, msg_struct_t msg_struct)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
 
-       msg_error_t err =  MSG_SUCCESS;
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL || msg_struct == NULL)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->setCBOption(msg_struct);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_SET_READ_ERROR;
        }
@@ -586,7 +544,7 @@ EXPORT_API int msg_set_cb_opt(msg_handle_t handle, msg_struct_t msg_struct)
        return err;
 }
 
-int msg_get_cb_option_int(void *cb_opt, int field)
+int msg_get_cb_option_int(void *cb_opt, int field, int *value)
 {
        if (!cb_opt)
                return MSG_ERR_NULL_POINTER;
@@ -595,13 +553,12 @@ int msg_get_cb_option_int(void *cb_opt, int field)
 
        MSG_CBMSG_OPT_HIDDEN_S *cb_opt_data = (MSG_CBMSG_OPT_HIDDEN_S *)cb_opt;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_CB_MAX_SIM_COUNT_INT :
-               ret = cb_opt_data->maxSimCnt;
+               *value = cb_opt_data->maxSimCnt;
                break;
        case MSG_CB_SIM_INDEX_INT :
-               ret = cb_opt_data->simIndex;
+               *value = cb_opt_data->simIndex;
                break;
        default :
                ret = MSG_ERR_INVALID_PARAMETER;
@@ -620,8 +577,7 @@ int msg_set_cb_option_int(void *cb_opt, int field, int value)
 
        MSG_CBMSG_OPT_HIDDEN_S *cb_opt_data = (MSG_CBMSG_OPT_HIDDEN_S *)cb_opt;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_CB_MAX_SIM_COUNT_INT :
                cb_opt_data->maxSimCnt = value;
                break;
@@ -637,51 +593,51 @@ int msg_set_cb_option_int(void *cb_opt, int field, int value)
 }
 
 
-bool msg_get_cb_option_bool(void *cb_opt, int field)
+int msg_get_cb_option_bool(void *cb_opt, int field, bool *value)
 {
        if (!cb_opt)
-               return false;
+               return MSG_ERR_NULL_POINTER;
 
-       bool ret = false;
+       int ret = MSG_SUCCESS;
 
        MSG_CBMSG_OPT_HIDDEN_S *cb_opt_data = (MSG_CBMSG_OPT_HIDDEN_S *)cb_opt;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_CB_RECEIVE_BOOL :
-               ret = cb_opt_data->bReceive;
+               *value = cb_opt_data->bReceive;
                break;
        case MSG_CB_LANGUAGE_TYPE_ALL_BOOL :
-               ret = cb_opt_data->bLanguage[MSG_CBLANG_TYPE_ALL];
+               *value = cb_opt_data->bLanguage[MSG_CBLANG_TYPE_ALL];
                break;
        case MSG_CB_LANGUAGE_TYPE_ENG_BOOL :
-               ret = cb_opt_data->bLanguage[MSG_CBLANG_TYPE_ENG];
+               *value = cb_opt_data->bLanguage[MSG_CBLANG_TYPE_ENG];
                break;
        case MSG_CB_LANGUAGE_TYPE_GER_BOOL :
-               ret = cb_opt_data->bLanguage[MSG_CBLANG_TYPE_GER];
+               *value = cb_opt_data->bLanguage[MSG_CBLANG_TYPE_GER];
                break;
        case MSG_CB_LANGUAGE_TYPE_FRE_BOOL :
-               ret = cb_opt_data->bLanguage[MSG_CBLANG_TYPE_FRE];
+               *value = cb_opt_data->bLanguage[MSG_CBLANG_TYPE_FRE];
                break;
        case MSG_CB_LANGUAGE_TYPE_ITA_BOOL :
-               ret = cb_opt_data->bLanguage[MSG_CBLANG_TYPE_ITA];
+               *value = cb_opt_data->bLanguage[MSG_CBLANG_TYPE_ITA];
                break;
        case MSG_CB_LANGUAGE_TYPE_NED_BOOL :
-               ret = cb_opt_data->bLanguage[MSG_CBLANG_TYPE_NED];
+               *value = cb_opt_data->bLanguage[MSG_CBLANG_TYPE_NED];
                break;
        case MSG_CB_LANGUAGE_TYPE_SPA_BOOL :
-               ret = cb_opt_data->bLanguage[MSG_CBLANG_TYPE_SPA];
+               *value = cb_opt_data->bLanguage[MSG_CBLANG_TYPE_SPA];
                break;
        case MSG_CB_LANGUAGE_TYPE_POR_BOOL :
-               ret = cb_opt_data->bLanguage[MSG_CBLANG_TYPE_POR];
+               *value = cb_opt_data->bLanguage[MSG_CBLANG_TYPE_POR];
                break;
        case MSG_CB_LANGUAGE_TYPE_SWE_BOOL :
-               ret = cb_opt_data->bLanguage[MSG_CBLANG_TYPE_SWE];
+               *value = cb_opt_data->bLanguage[MSG_CBLANG_TYPE_SWE];
                break;
        case MSG_CB_LANGUAGE_TYPE_TUR_BOOL :
-               ret = cb_opt_data->bLanguage[MSG_CBLANG_TYPE_TUR];
+               *value = cb_opt_data->bLanguage[MSG_CBLANG_TYPE_TUR];
                break;
        default :
+               ret = MSG_ERR_INVALID_PARAMETER;
                break;
        }
 
@@ -697,8 +653,7 @@ int msg_set_cb_option_bool(void *cb_opt, int field, bool value)
 
        MSG_CBMSG_OPT_HIDDEN_S *cb_opt_data = (MSG_CBMSG_OPT_HIDDEN_S *)cb_opt;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_CB_RECEIVE_BOOL :
                cb_opt_data->bReceive = value;
                break;
@@ -749,36 +704,36 @@ int msg_get_cb_option_list(void *cb_opt, int field, void **value)
 
        int ret = MSG_SUCCESS;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_CB_CHANNEL_LIST_STRUCT :
                *value = (void *)cb_opt_data->channelData;
                break;
        default :
+               ret = MSG_ERR_INVALID_PARAMETER;
                break;
        }
 
        return ret;
 }
 
-int msg_get_cb_channel_info_int(void *cb_ch_info, int field)
+int msg_get_cb_channel_info_int(void *cb_ch_info, int field, int *value)
 {
        if (!cb_ch_info)
                return MSG_ERR_NULL_POINTER;
 
-       int ret = MSG_ERR_INVALID_PARAMETER;
+       int ret = MSG_SUCCESS;
 
        MSG_CB_CHANNEL_INFO_S *cb_ch_data = (MSG_CB_CHANNEL_INFO_S *)cb_ch_info;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_CB_CHANNEL_ID_FROM_INT :
-               ret = cb_ch_data->from;
+               *value = cb_ch_data->from;
                break;
        case MSG_CB_CHANNEL_ID_TO_INT :
-               ret = cb_ch_data->to;
+               *value = cb_ch_data->to;
                break;
        default :
+               ret = MSG_ERR_INVALID_PARAMETER;
                break;
        }
 
@@ -794,8 +749,7 @@ int msg_set_cb_channel_info_int(void *cb_ch_info, int field, int value)
 
        MSG_CB_CHANNEL_INFO_S *cb_ch_data = (MSG_CB_CHANNEL_INFO_S *)cb_ch_info;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_CB_CHANNEL_ID_FROM_INT :
                cb_ch_data->from = value;
                break;
@@ -810,21 +764,21 @@ int msg_set_cb_channel_info_int(void *cb_ch_info, int field, int value)
        return ret;
 }
 
-bool msg_get_cb_channel_info_bool(void *cb_ch_info, int field)
+int msg_get_cb_channel_info_bool(void *cb_ch_info, int field, bool *value)
 {
        if (!cb_ch_info)
-               return false;
+               return MSG_ERR_NULL_POINTER;
 
-       bool ret = false;
+       int ret = MSG_SUCCESS;
 
        MSG_CB_CHANNEL_INFO_S *cb_ch_data = (MSG_CB_CHANNEL_INFO_S *)cb_ch_info;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_CB_CHANNEL_ACTIVATE_BOOL :
-               ret = cb_ch_data->bActivate;
+               *value = cb_ch_data->bActivate;
                break;
        default :
+               ret = MSG_ERR_INVALID_PARAMETER;
                break;
        }
 
@@ -840,8 +794,7 @@ int msg_set_cb_channel_info_bool(void *cb_ch_info, int field, bool value)
 
        MSG_CB_CHANNEL_INFO_S *cb_ch_data = (MSG_CB_CHANNEL_INFO_S *)cb_ch_info;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_CB_CHANNEL_ACTIVATE_BOOL :
                cb_ch_data->bActivate = value;
                break;
@@ -853,25 +806,22 @@ int msg_set_cb_channel_info_bool(void *cb_ch_info, int field, bool value)
        return ret;
 }
 
-char *msg_get_cb_channel_info_str(void *cb_ch_info, int field)
+int msg_get_cb_channel_info_str(void *cb_ch_info, int field, char *value, int size)
 {
        if (!cb_ch_info)
-               return NULL;
-
-       char *ret_str = NULL;
+               return MSG_ERR_NULL_POINTER;
 
        MSG_CB_CHANNEL_INFO_S *cb_ch_data = (MSG_CB_CHANNEL_INFO_S *)cb_ch_info;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_CB_CHANNEL_NAME_STR :
-               ret_str = cb_ch_data->name;
+               strncpy(value, cb_ch_data->name, size);
                break;
        default :
-               break;
+               return MSG_ERR_INVALID_PARAMETER;
        }
 
-       return ret_str;
+       return MSG_SUCCESS;
 }
 
 int msg_set_cb_channel_info_str(void *cb_ch_info, int field, char *val, int size)
@@ -883,8 +833,7 @@ int msg_set_cb_channel_info_str(void *cb_ch_info, int field, char *val, int size
 
        MSG_CB_CHANNEL_INFO_S *cb_ch_data = (MSG_CB_CHANNEL_INFO_S *)cb_ch_info;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_CB_CHANNEL_NAME_STR :
                bzero(cb_ch_data->name, sizeof(cb_ch_data->name));
                snprintf(cb_ch_data->name, sizeof(cb_ch_data->name), "%s", val);
@@ -899,31 +848,24 @@ int msg_set_cb_channel_info_str(void *cb_ch_info, int field, char *val, int size
 
 EXPORT_API int msg_get_sms_send_opt(msg_handle_t handle, msg_struct_t msg_struct)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
 
-       msg_error_t err =  MSG_SUCCESS;
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
-       if (handle == NULL)
-       {
+       if (handle == NULL || msg_struct == NULL)
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->getSmsSendOpt(msg_struct);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_SET_READ_ERROR;
        }
@@ -933,31 +875,24 @@ EXPORT_API int msg_get_sms_send_opt(msg_handle_t handle, msg_struct_t msg_struct
 
 EXPORT_API int msg_set_sms_send_opt(msg_handle_t handle, msg_struct_t msg_struct)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
 
-       msg_error_t err =  MSG_SUCCESS;
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL || msg_struct == NULL)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->setSmsSendOpt(msg_struct);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_SET_READ_ERROR;
        }
@@ -965,27 +900,27 @@ EXPORT_API int msg_set_sms_send_opt(msg_handle_t handle, msg_struct_t msg_struct
        return err;
 }
 
-int msg_get_sms_send_opt_int(void *sms_send_opt, int field)
+int msg_get_sms_send_opt_int(void *sms_send_opt, int field, int *value)
 {
        if (!sms_send_opt)
                return MSG_ERR_NULL_POINTER;
 
-       int ret = MSG_ERR_INVALID_PARAMETER;
+       int ret = MSG_SUCCESS;
 
        MSG_SMS_SENDOPT_S *send_opt = (MSG_SMS_SENDOPT_S *)sms_send_opt;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_SMS_SENDOPT_ENCODE_TYPE_INT :
-               ret = send_opt->dcs;
+               *value = send_opt->dcs;
                break;
        case MSG_SMS_SENDOPT_NETWORK_MODE_INT :
-               ret = send_opt->netMode;
+               *value = send_opt->netMode;
                break;
        case MSG_SMS_SENDOPT_SAVE_STORAGE_INT :
-               ret = send_opt->saveStorage;
+               *value = send_opt->saveStorage;
                break;
        default :
+               ret = MSG_ERR_INVALID_PARAMETER;
                break;
        }
 
@@ -1001,8 +936,7 @@ int msg_set_sms_send_opt_int(void *sms_send_opt, int field, int value)
 
        MSG_SMS_SENDOPT_S *send_opt = (MSG_SMS_SENDOPT_S *)sms_send_opt;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_SMS_SENDOPT_ENCODE_TYPE_INT :
                send_opt->dcs = value;
                break;
@@ -1020,24 +954,24 @@ int msg_set_sms_send_opt_int(void *sms_send_opt, int field, int value)
        return ret;
 }
 
-bool msg_get_sms_send_opt_bool(void *sms_send_opt, int field)
+int msg_get_sms_send_opt_bool(void *sms_send_opt, int field, bool *value)
 {
        if (!sms_send_opt)
-               return false;
+               return MSG_ERR_NULL_POINTER;
 
-       bool ret = false;
+       int ret = MSG_SUCCESS;
 
        MSG_SMS_SENDOPT_S *send_opt = (MSG_SMS_SENDOPT_S *)sms_send_opt;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_SMS_SENDOPT_REPLY_PATH_BOOL :
-               ret = send_opt->bReplyPath;
+               *value = send_opt->bReplyPath;
                break;
        case MSG_SMS_SENDOPT_DELIVERY_REPORT_BOOL :
-               ret = send_opt->bDeliveryReport;
+               *value = send_opt->bDeliveryReport;
                break;
        default :
+               ret = MSG_ERR_INVALID_PARAMETER;
                break;
        }
 
@@ -1053,8 +987,7 @@ int msg_set_sms_send_opt_bool(void *sms_send_opt, int field, bool value)
 
        MSG_SMS_SENDOPT_S *send_opt = (MSG_SMS_SENDOPT_S *)sms_send_opt;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_SMS_SENDOPT_REPLY_PATH_BOOL :
                send_opt->bReplyPath = value;
                break;
@@ -1073,29 +1006,22 @@ EXPORT_API int msg_get_mms_send_opt(msg_handle_t handle, msg_struct_t msg_struct
 {
        CHECK_MSG_SUPPORTED(MSG_TELEPHONY_MMS_FEATURE);
 
-       msg_error_t err =  MSG_SUCCESS;
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /*Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
-       if (handle == NULL)
-       {
+       if (handle == NULL || msg_struct == NULL)
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->getMmsSendOpt(msg_struct);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_SET_READ_ERROR;
        }
@@ -1107,29 +1033,22 @@ EXPORT_API int msg_set_mms_send_opt(msg_handle_t handle, msg_struct_t msg_struct
 {
        CHECK_MSG_SUPPORTED(MSG_TELEPHONY_MMS_FEATURE);
 
-       msg_error_t err =  MSG_SUCCESS;
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL || msg_struct == NULL)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->setMmsSendOpt(msg_struct);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_SET_READ_ERROR;
        }
@@ -1138,45 +1057,45 @@ EXPORT_API int msg_set_mms_send_opt(msg_handle_t handle, msg_struct_t msg_struct
 }
 
 
-int msg_get_mms_send_opt_int(void *mms_send_opt, int field)
+int msg_get_mms_send_opt_int(void *mms_send_opt, int field, int *value)
 {
        if (!mms_send_opt)
                return MSG_ERR_NULL_POINTER;
 
-       int ret = MSG_ERR_INVALID_PARAMETER;
+       int ret = MSG_SUCCESS;
 
        MSG_MMS_SENDOPT_S *send_opt = (MSG_MMS_SENDOPT_S *)mms_send_opt;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_MMS_SENDOPT_CLASS_TYPE_INT :
-               ret = send_opt->msgClass;
+               *value = send_opt->msgClass;
                break;
        case MSG_MMS_SENDOPT_PRIORITY_TYPE_INT :
-               ret = send_opt->priority;
+               *value = send_opt->priority;
                break;
        case MSG_MMS_SENDOPT_EXPIRY_TIME_INT :
-               ret = send_opt->expiryTime;
+               *value = send_opt->expiryTime;
                break;
        case MSG_MMS_SENDOPT_DELIVERY_TIME_INT :
-               ret = send_opt->deliveryTime;
+               *value = send_opt->deliveryTime;
                break;
        case MSG_MMS_SENDOPT_CUSTOM_DELIVERY_TIME_INT :
-               ret = send_opt->customDeliveryTime;
+               *value = send_opt->customDeliveryTime;
                break;
        case MSG_MMS_SENDOPT_REPLY_CHARGING_INT :
-               ret = send_opt->replyCharging;
+               *value = send_opt->replyCharging;
                break;
        case MSG_MMS_SENDOPT_REPLY_CHARGING_DEADLINE_INT :
-               ret = send_opt->replyChargingDeadline;
+               *value = send_opt->replyChargingDeadline;
                break;
        case MSG_MMS_SENDOPT_REPLY_CHARGING_SIZE_INT :
-               ret = send_opt->replyChargingSize;
+               *value = send_opt->replyChargingSize;
                break;
        case MSG_MMS_SENDOPT_CREATION_MODE_INT :
-               ret = send_opt->creationMode;
+               *value = send_opt->creationMode;
                break;
        default :
+               ret = MSG_ERR_INVALID_PARAMETER;
                break;
        }
 
@@ -1192,8 +1111,7 @@ int msg_set_mms_send_opt_int(void *mms_send_opt, int field, int value)
 
        MSG_MMS_SENDOPT_S *send_opt = (MSG_MMS_SENDOPT_S *)mms_send_opt;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_MMS_SENDOPT_CLASS_TYPE_INT :
                send_opt->msgClass = value;
                break;
@@ -1229,36 +1147,36 @@ int msg_set_mms_send_opt_int(void *mms_send_opt, int field, int value)
        return ret;
 }
 
-bool msg_get_mms_send_opt_bool(void *mms_send_opt, int field)
+int msg_get_mms_send_opt_bool(void *mms_send_opt, int field, bool *value)
 {
        if (!mms_send_opt)
-               return false;
+               return MSG_ERR_NULL_POINTER;
 
-       bool ret = false;
+       int ret = MSG_SUCCESS;
 
        MSG_MMS_SENDOPT_S *send_opt = (MSG_MMS_SENDOPT_S *)mms_send_opt;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_MMS_SENDOPT_SENDER_VISIBILITY_BOOL :
-               ret = send_opt->bSenderVisibility;
+               *value = send_opt->bSenderVisibility;
                break;
        case MSG_MMS_SENDOPT_DELIVERY_REPORT_BOOL :
-               ret = send_opt->bDeliveryReport;
+               *value = send_opt->bDeliveryReport;
                break;
        case MSG_MMS_SENDOPT_READ_REPLY_BOOL :
-               ret = send_opt->bReadReply;
+               *value = send_opt->bReadReply;
                break;
        case MSG_MMS_SENDOPT_KEEP_COPY_BOOL :
-               ret = send_opt->bKeepCopy;
+               *value = send_opt->bKeepCopy;
                break;
        case MSG_MMS_SENDOPT_BODY_REPLYING_BOOL :
-               ret = send_opt->bBodyReplying;
+               *value = send_opt->bBodyReplying;
                break;
        case MSG_MMS_SENDOPT_HIDE_RECIPIENTS_BOOL :
-               ret = send_opt->bHideRecipients;
+               *value = send_opt->bHideRecipients;
                break;
        default :
+               ret = MSG_ERR_INVALID_PARAMETER;
                break;
        }
 
@@ -1274,8 +1192,7 @@ int msg_set_mms_send_opt_bool(void *mms_send_opt, int field, bool value)
 
        MSG_MMS_SENDOPT_S *send_opt = (MSG_MMS_SENDOPT_S *)mms_send_opt;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_MMS_SENDOPT_SENDER_VISIBILITY_BOOL :
                send_opt->bSenderVisibility = value;
                break;
@@ -1306,29 +1223,22 @@ EXPORT_API int msg_get_mms_recv_opt(msg_handle_t handle, msg_struct_t msg_struct
 {
        CHECK_MSG_SUPPORTED(MSG_TELEPHONY_MMS_FEATURE);
 
-       msg_error_t err =  MSG_SUCCESS;
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
-       if (handle == NULL)
-       {
+       if (handle == NULL || msg_struct == NULL)
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->getMmsRecvOpt(msg_struct);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_SET_READ_ERROR;
        }
@@ -1340,29 +1250,22 @@ EXPORT_API int msg_set_mms_recv_opt(msg_handle_t handle, msg_struct_t msg_struct
 {
        CHECK_MSG_SUPPORTED(MSG_TELEPHONY_MMS_FEATURE);
 
-       msg_error_t err =  MSG_SUCCESS;
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL || msg_struct == NULL)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->setMmsRecvOpt(msg_struct);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_SET_READ_ERROR;
        }
@@ -1370,24 +1273,24 @@ EXPORT_API int msg_set_mms_recv_opt(msg_handle_t handle, msg_struct_t msg_struct
        return err;
 }
 
-int msg_get_mms_recv_opt_int(void *mms_recv_opt, int field)
+int msg_get_mms_recv_opt_int(void *mms_recv_opt, int field, int *value)
 {
        if (!mms_recv_opt)
                return MSG_ERR_NULL_POINTER;
 
-       int ret = MSG_ERR_INVALID_PARAMETER;
+       int ret = MSG_SUCCESS;
 
        MSG_MMS_RECVOPT_S *recv_opt = (MSG_MMS_RECVOPT_S *)mms_recv_opt;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_MMS_RECVOPT_HOME_RETRIEVE_TYPE_INT :
-               ret = recv_opt->homeNetwork;
+               *value = recv_opt->homeNetwork;
                break;
        case MSG_MMS_RECVOPT_ABROAD_RETRIEVE_TYPE_INT :
-               ret = recv_opt->abroadNetwok;
+               *value = recv_opt->abroadNetwok;
                break;
        default :
+               ret = MSG_ERR_INVALID_PARAMETER;
                break;
        }
 
@@ -1403,8 +1306,7 @@ int msg_set_mms_recv_opt_int(void *mms_recv_opt, int field, int value)
 
        MSG_MMS_RECVOPT_S *recv_opt = (MSG_MMS_RECVOPT_S *)mms_recv_opt;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_MMS_RECVOPT_HOME_RETRIEVE_TYPE_INT :
                recv_opt->homeNetwork = value;
                break;
@@ -1419,30 +1321,30 @@ int msg_set_mms_recv_opt_int(void *mms_recv_opt, int field, int value)
        return ret;
 }
 
-bool msg_get_mms_recv_opt_bool(void *mms_recv_opt, int field)
+int msg_get_mms_recv_opt_bool(void *mms_recv_opt, int field, bool *value)
 {
        if (!mms_recv_opt)
-               return false;
+               return MSG_ERR_NULL_POINTER;
 
-       bool ret = false;
+       int ret = MSG_SUCCESS;
 
        MSG_MMS_RECVOPT_S *recv_opt = (MSG_MMS_RECVOPT_S *)mms_recv_opt;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_MMS_RECVOPT_READ_REPORT_BOOL :
-               ret = recv_opt->readReceipt;
+               *value = recv_opt->readReceipt;
                break;
        case MSG_MMS_RECVOPT_DELIVERY_REPORT_BOOL :
-               ret = recv_opt->bDeliveryReceipt;
+               *value = recv_opt->bDeliveryReceipt;
                break;
        case MSG_MMS_RECVOPT_REJECT_UNKNOWN_BOOL :
-               ret = recv_opt->bRejectUnknown;
+               *value = recv_opt->bRejectUnknown;
                break;
        case MSG_MMS_RECVOPT_REJECT_ADVERTISEMENT_BOOL :
-               ret = recv_opt->bRejectAdvertisement;
+               *value = recv_opt->bRejectAdvertisement;
                break;
        default :
+               ret = MSG_ERR_INVALID_PARAMETER;
                break;
        }
 
@@ -1458,8 +1360,7 @@ int msg_set_mms_recv_opt_bool(void *mms_recv_opt, int field, bool value)
 
        MSG_MMS_RECVOPT_S *recv_opt = (MSG_MMS_RECVOPT_S *)mms_recv_opt;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_MMS_RECVOPT_READ_REPORT_BOOL :
                recv_opt->readReceipt = value;
                break;
@@ -1482,30 +1383,23 @@ int msg_set_mms_recv_opt_bool(void *mms_recv_opt, int field, bool value)
 
 EXPORT_API int msg_get_push_msg_opt(msg_handle_t handle, msg_struct_t msg_struct)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
-       if (handle == NULL)
-       {
+       if (handle == NULL || msg_struct == NULL)
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->getPushMsgOpt(msg_struct);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_SET_READ_ERROR;
        }
@@ -1515,30 +1409,23 @@ EXPORT_API int msg_get_push_msg_opt(msg_handle_t handle, msg_struct_t msg_struct
 
 EXPORT_API int msg_set_push_msg_opt(msg_handle_t handle, msg_struct_t msg_struct)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL || msg_struct == NULL)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->setPushMsgOpt(msg_struct);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_SET_READ_ERROR;
        }
@@ -1546,21 +1433,21 @@ EXPORT_API int msg_set_push_msg_opt(msg_handle_t handle, msg_struct_t msg_struct
        return err;
 }
 
-int msg_get_push_msg_opt_int(void *push_msg_opt, int field)
+int msg_get_push_msg_opt_int(void *push_msg_opt, int field, int *value)
 {
        if (!push_msg_opt)
                return MSG_ERR_NULL_POINTER;
 
-       int ret = MSG_ERR_INVALID_PARAMETER;
+       int ret = MSG_SUCCESS;
 
        MSG_PUSHMSG_OPT_S *push_opt = (MSG_PUSHMSG_OPT_S *)push_msg_opt;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_PUSHMSG_SERVICE_TYPE_INT :
-               ret = push_opt->serviceType;
+               *value = push_opt->serviceType;
                break;
        default :
+               ret = MSG_ERR_INVALID_PARAMETER;
                break;
        }
 
@@ -1576,8 +1463,7 @@ int msg_set_push_msg_opt_int(void *push_msg_opt, int field, int value)
 
        MSG_PUSHMSG_OPT_S *push_opt = (MSG_PUSHMSG_OPT_S *)push_msg_opt;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_PUSHMSG_SERVICE_TYPE_INT :
                push_opt->serviceType = value;
                break;
@@ -1589,21 +1475,21 @@ int msg_set_push_msg_opt_int(void *push_msg_opt, int field, int value)
        return ret;
 }
 
-bool msg_get_push_msg_opt_bool(void *push_msg_opt, int field)
+int msg_get_push_msg_opt_bool(void *push_msg_opt, int field, bool *value)
 {
        if (!push_msg_opt)
-               return false;
+               return MSG_ERR_NULL_POINTER;
 
-       bool ret = false;
+       int ret = MSG_SUCCESS;
 
        MSG_PUSHMSG_OPT_S *push_opt = (MSG_PUSHMSG_OPT_S *)push_msg_opt;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_PUSHMSG_RECEIVE_BOOL :
-               ret = push_opt->bReceive;
+               *value = push_opt->bReceive;
                break;
        default :
+               ret = MSG_ERR_INVALID_PARAMETER;
                break;
        }
 
@@ -1619,8 +1505,7 @@ int msg_set_push_msg_opt_bool(void *push_msg_opt, int field, bool value)
 
        MSG_PUSHMSG_OPT_S *push_opt = (MSG_PUSHMSG_OPT_S *)push_msg_opt;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_PUSHMSG_RECEIVE_BOOL :
                push_opt->bReceive = value;
                break;
@@ -1634,30 +1519,23 @@ int msg_set_push_msg_opt_bool(void *push_msg_opt, int field, bool value)
 
 EXPORT_API int msg_get_voice_msg_opt(msg_handle_t handle, msg_struct_t msg_struct)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
-       if (handle == NULL)
-       {
+       if (handle == NULL || msg_struct == NULL)
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->getVoiceMsgOpt(msg_struct);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_SET_READ_ERROR;
        }
@@ -1667,30 +1545,23 @@ EXPORT_API int msg_get_voice_msg_opt(msg_handle_t handle, msg_struct_t msg_struc
 
 EXPORT_API int msg_set_voice_msg_opt(msg_handle_t handle, msg_struct_t msg_struct)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL || msg_struct == NULL)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->setVoiceMsgOpt(msg_struct);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_SET_READ_ERROR;
        }
@@ -1698,24 +1569,24 @@ EXPORT_API int msg_set_voice_msg_opt(msg_handle_t handle, msg_struct_t msg_struc
        return err;
 }
 
-int msg_get_voice_msg_opt_int(void *voice_msg_opt, int field)
+int msg_get_voice_msg_opt_int(void *voice_msg_opt, int field, int *value)
 {
        if (!voice_msg_opt)
                return MSG_ERR_NULL_POINTER;
 
-       int ret = MSG_ERR_INVALID_PARAMETER;
+       int ret = MSG_SUCCESS;
 
        MSG_VOICEMAIL_OPT_S *voice_opt = (MSG_VOICEMAIL_OPT_S *)voice_msg_opt;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_VOICEMSG_SIM_INDEX_INT :
-               ret = voice_opt->simIndex;
+               *value = voice_opt->simIndex;
                break;
        case MSG_VOICEMSG_VOICE_COUNT_INT :
-               ret = voice_opt->voiceCnt;
+               *value = voice_opt->voiceCnt;
                break;
        default :
+               ret = MSG_ERR_INVALID_PARAMETER;
                break;
        }
 
@@ -1731,8 +1602,7 @@ int msg_set_voice_msg_opt_int(void *voice_msg_opt, int field, int value)
 
        MSG_VOICEMAIL_OPT_S *voice_opt = (MSG_VOICEMAIL_OPT_S *)voice_msg_opt;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_VOICEMSG_SIM_INDEX_INT :
                voice_opt->simIndex = value;
                break;
@@ -1744,28 +1614,25 @@ int msg_set_voice_msg_opt_int(void *voice_msg_opt, int field, int value)
        return ret;
 }
 
-char *msg_get_voice_msg_opt_str(void *voice_msg_opt, int field)
+int msg_get_voice_msg_opt_str(void *voice_msg_opt, int field, char *value, int size)
 {
        if (!voice_msg_opt)
-               return NULL;
-
-       char *ret_str = NULL;
+               return MSG_ERR_NULL_POINTER;
 
        MSG_VOICEMAIL_OPT_S *voice_opt = (MSG_VOICEMAIL_OPT_S *)voice_msg_opt;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_VOICEMSG_ADDRESS_STR :
-               ret_str = voice_opt->mailNumber;
+               strncpy(value, voice_opt->mailNumber, size);
                break;
        case MSG_VOICEMSG_ALPHA_ID_STR :
-               ret_str = voice_opt->alpahId;
+               strncpy(value, voice_opt->alpahId, size);
                break;
        default :
-               break;
+               return MSG_ERR_INVALID_PARAMETER;
        }
 
-       return ret_str;
+       return MSG_SUCCESS;
 }
 
 int msg_set_voice_msg_opt_str(void *voice_msg_opt, int field, char *val, int size)
@@ -1777,8 +1644,7 @@ int msg_set_voice_msg_opt_str(void *voice_msg_opt, int field, char *val, int siz
 
        MSG_VOICEMAIL_OPT_S *voice_opt = (MSG_VOICEMAIL_OPT_S *)voice_msg_opt;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_VOICEMSG_ADDRESS_STR :
                bzero(voice_opt->mailNumber, sizeof(voice_opt->mailNumber));
                snprintf(voice_opt->mailNumber, sizeof(voice_opt->mailNumber), "%s", val);
@@ -1793,30 +1659,23 @@ int msg_set_voice_msg_opt_str(void *voice_msg_opt, int field, char *val, int siz
 
 EXPORT_API int msg_get_general_opt(msg_handle_t handle, msg_struct_t msg_struct)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
-       if (handle == NULL)
-       {
+       if (handle == NULL || msg_struct == NULL)
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->getGeneralOpt(msg_struct);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_SET_READ_ERROR;
        }
@@ -1826,30 +1685,23 @@ EXPORT_API int msg_get_general_opt(msg_handle_t handle, msg_struct_t msg_struct)
 
 EXPORT_API int msg_set_general_opt(msg_handle_t handle, msg_struct_t msg_struct)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL || msg_struct == NULL)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->setGeneralOpt(msg_struct);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_SET_READ_ERROR;
        }
@@ -1857,30 +1709,30 @@ EXPORT_API int msg_set_general_opt(msg_handle_t handle, msg_struct_t msg_struct)
        return err;
 }
 
-int msg_get_general_opt_int(void *general_opt, int field)
+int msg_get_general_opt_int(void *general_opt, int field, int *value)
 {
        if (!general_opt)
                return MSG_ERR_NULL_POINTER;
 
-       int ret = MSG_ERR_INVALID_PARAMETER;
+       int ret = MSG_SUCCESS;
 
        MSG_GENERAL_OPT_S *opt = (MSG_GENERAL_OPT_S *)general_opt;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_GENERAL_ALERT_TONE_INT :
-               ret = opt->alertTone;
+               *value = opt->alertTone;
                break;
        case MSG_GENERAL_SMS_LIMIT_CNT_INT :
-               ret = opt->smsLimitCnt;
+               *value = opt->smsLimitCnt;
                break;
        case MSG_GENERAL_MMS_LIMIT_CNT_INT :
-               ret = opt->mmsLimitCnt;
+               *value = opt->mmsLimitCnt;
                break;
        case MSG_GENERAL_RINGTONE_TYPE_INT :
-               ret = opt->ringtoneType;
+               *value = opt->ringtoneType;
                break;
        default :
+               ret = MSG_ERR_INVALID_PARAMETER;
                break;
        }
 
@@ -1896,8 +1748,7 @@ int msg_set_general_opt_int(void *general_opt, int field, int value)
 
        MSG_GENERAL_OPT_S *opt = (MSG_GENERAL_OPT_S *)general_opt;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_GENERAL_ALERT_TONE_INT :
                opt->alertTone = value;
                break;
@@ -1918,36 +1769,36 @@ int msg_set_general_opt_int(void *general_opt, int field, int value)
        return ret;
 }
 
-bool msg_get_general_opt_bool(void *general_opt, int field)
+int msg_get_general_opt_bool(void *general_opt, int field, bool *value)
 {
        if (!general_opt)
-               return false;
+               return MSG_ERR_NULL_POINTER;
 
-       int ret = false;
+       int ret = MSG_SUCCESS;
 
        MSG_GENERAL_OPT_S *opt = (MSG_GENERAL_OPT_S *)general_opt;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_GENERAL_KEEP_COPY_BOOL :
-               ret = opt->bKeepCopy;
+               *value = opt->bKeepCopy;
                break;
        case MSG_GENERAL_AUTO_ERASE_BOOL :
-               ret = opt->bAutoErase;
+               *value = opt->bAutoErase;
                break;
        case MSG_GENERAL_BLOCK_UNKNOWN_NUMBER_BOOL :
-               ret = opt->bBlockUnknownMsg;
+               *value = opt->bBlockUnknownMsg;
                break;
        case MSG_GENERAL_MSG_NOTIFICATION_BOOL :
-               ret = opt->bNotification;
+               *value = opt->bNotification;
                break;
        case MSG_GENERAL_MSG_VIBRATION_BOOL :
-               ret = opt->bVibration;
+               *value = opt->bVibration;
                break;
        case MSG_GENERAL_MSG_PREVIEW_BOOL :
-               ret = opt->bPreview;
+               *value = opt->bPreview;
                break;
        default :
+               ret = MSG_ERR_INVALID_PARAMETER;
                break;
        }
 
@@ -1963,8 +1814,7 @@ int msg_set_general_opt_bool(void *general_opt, int field, bool value)
 
        MSG_GENERAL_OPT_S *opt = (MSG_GENERAL_OPT_S *)general_opt;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_GENERAL_KEEP_COPY_BOOL :
                opt->bKeepCopy = value;
                break;
@@ -1991,25 +1841,22 @@ int msg_set_general_opt_bool(void *general_opt, int field, bool value)
        return ret;
 }
 
-char *msg_get_general_opt_str(void *general_opt, int field)
+int msg_get_general_opt_str(void *general_opt, int field, char *value, int size)
 {
        if (!general_opt)
-               return NULL;
-
-       char *ret_str = NULL;
+               return MSG_ERR_NULL_POINTER;
 
        MSG_GENERAL_OPT_S *opt = (MSG_GENERAL_OPT_S *)general_opt;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_GENERAL_RINGTONE_PATH_STR :
-               ret_str = opt->ringtonePath;
+               strncpy(value, opt->ringtonePath, size);
                break;
        default :
-               break;
+               return MSG_ERR_INVALID_PARAMETER;
        }
 
-       return ret_str;
+       return MSG_SUCCESS;
 }
 
 int msg_set_general_opt_str(void *general_opt, int field, char *val, int size)
@@ -2021,8 +1868,7 @@ int msg_set_general_opt_str(void *general_opt, int field, char *val, int size)
 
        MSG_GENERAL_OPT_S *opt = (MSG_GENERAL_OPT_S *)general_opt;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_GENERAL_RINGTONE_PATH_STR :
                bzero(opt->ringtonePath, sizeof(opt->ringtonePath));
                snprintf(opt->ringtonePath, sizeof(opt->ringtonePath), "%s", val);
@@ -2038,30 +1884,23 @@ int msg_set_general_opt_str(void *general_opt, int field, char *val, int size)
 
 EXPORT_API int msg_get_msgsize_opt(msg_handle_t handle, msg_struct_t msg_struct)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_MMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
-       if (handle == NULL)
-       {
+       if (handle == NULL || msg_struct == NULL)
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->getMsgSizeOpt(msg_struct);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_SET_READ_ERROR;
        }
@@ -2071,30 +1910,23 @@ EXPORT_API int msg_get_msgsize_opt(msg_handle_t handle, msg_struct_t msg_struct)
 
 EXPORT_API int msg_set_msgsize_opt(msg_handle_t handle, msg_struct_t msg_struct)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_MMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL || msg_struct == NULL)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->setMsgSizeOpt(msg_struct);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_SET_READ_ERROR;
        }
@@ -2102,21 +1934,21 @@ EXPORT_API int msg_set_msgsize_opt(msg_handle_t handle, msg_struct_t msg_struct)
        return err;
 }
 
-int msg_get_msgsize_opt_int(void *size_opt, int field)
+int msg_get_msgsize_opt_int(void *size_opt, int field, int *value)
 {
        if (!size_opt)
                return MSG_ERR_NULL_POINTER;
 
-       int ret = MSG_ERR_INVALID_PARAMETER;
+       int ret = MSG_SUCCESS;
 
        MSG_MSGSIZE_OPT_S *msg_opt = (MSG_MSGSIZE_OPT_S *)size_opt;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_MESSAGE_SIZE_INT :
-               ret = msg_opt->nMsgSize;
+               *value = msg_opt->nMsgSize;
                break;
        default :
+               ret = MSG_ERR_INVALID_PARAMETER;
                break;
        }
 
@@ -2132,8 +1964,7 @@ int msg_set_msgsize_opt_int(void *size_opt, int field, int value)
 
        MSG_MSGSIZE_OPT_S *msg_opt = (MSG_MSGSIZE_OPT_S *)size_opt;
 
-       switch (field)
-       {
+       switch (field) {
        case MSG_MESSAGE_SIZE_INT :
                msg_opt->nMsgSize = value;
                break;
index 2a90a66..8cee5b3 100755 (executable)
@@ -32,33 +32,29 @@ static int msg_get_msg_type(int mainType, int subType);
 ==================================================================================================*/
 EXPORT_API int msg_add_message(msg_handle_t handle, msg_struct_t opq_msg, const msg_struct_t send_opt)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL || opq_msg == NULL || send_opt == NULL)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
        msg_struct_s *pMsgStruct = (msg_struct_s *)opq_msg;
+       MSG_TYPE_CHECK(pMsgStruct->type, MSG_STRUCT_MESSAGE_INFO);
+
        msg_struct_s *pStruct = (msg_struct_s *)send_opt;
+       MSG_TYPE_CHECK(pStruct->type, MSG_STRUCT_SENDOPT);
 
-       try
-       {
+       try {
                err = pHandle->addMessage((MSG_MESSAGE_HIDDEN_S *)pMsgStruct->data, (MSG_SENDINGOPT_S *)pStruct->data);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_STORAGE_ERROR;
        }
@@ -69,31 +65,25 @@ EXPORT_API int msg_add_message(msg_handle_t handle, msg_struct_t opq_msg, const
 
 EXPORT_API int msg_add_syncml_message(msg_handle_t handle, const msg_struct_t syncml_msg)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL || syncml_msg == NULL)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
        msg_struct_s *pStruct = (msg_struct_s *)syncml_msg;
+       MSG_TYPE_CHECK(pStruct->type, MSG_STRUCT_SYNCML_INFO);
 
-       try
-       {
+       try {
                err = pHandle->addSyncMLMessage((MSG_SYNCML_MESSAGE_S *)pStruct->data);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_STORAGE_ERROR;
        }
@@ -104,34 +94,32 @@ EXPORT_API int msg_add_syncml_message(msg_handle_t handle, const msg_struct_t sy
 
 EXPORT_API int msg_update_message(msg_handle_t handle, const msg_struct_t opq_msg, const msg_struct_t send_opt)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL || opq_msg == NULL || send_opt == NULL)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
+
        msg_struct_s *pMsgStruct = (msg_struct_s *)opq_msg;
+       MSG_TYPE_CHECK(pMsgStruct->type, MSG_STRUCT_MESSAGE_INFO);
+
        msg_struct_s* pStruct = (msg_struct_s *)send_opt;
+       MSG_TYPE_CHECK(pStruct->type, MSG_STRUCT_SENDOPT);
 
        MSG_MESSAGE_HIDDEN_S *msg = (MSG_MESSAGE_HIDDEN_S *)pMsgStruct->data;
+       MSG_SENDINGOPT_S *sendingOpt = (MSG_SENDINGOPT_S *)pStruct->data;
 
-       try
-       {
-               err = pHandle->updateMessage(msg, (MSG_SENDINGOPT_S *)pStruct->data);
-       }
-       catch (MsgException& e)
-       {
+       try {
+               err = pHandle->updateMessage(msg, sendingOpt);
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_STORAGE_ERROR;
        }
@@ -142,30 +130,23 @@ EXPORT_API int msg_update_message(msg_handle_t handle, const msg_struct_t opq_ms
 
 EXPORT_API int msg_update_read_status(msg_handle_t handle, msg_message_id_t msg_id, bool read)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->updateReadStatus(msg_id, read);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_STORAGE_ERROR;
        }
@@ -174,32 +155,25 @@ EXPORT_API int msg_update_read_status(msg_handle_t handle, msg_message_id_t msg_
 }
 
 
-EXPORT_API int msg_set_conversation_to_read(msg_handle_t handle,  msg_thread_id_t thread_id)
+EXPORT_API int msg_set_conversation_to_read(msg_handle_t handle, msg_thread_id_t thread_id)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->setConversationToRead(thread_id);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_STORAGE_ERROR;
        }
@@ -210,30 +184,23 @@ EXPORT_API int msg_set_conversation_to_read(msg_handle_t handle,  msg_thread_id_
 
 EXPORT_API int msg_update_protected_status(msg_handle_t handle, msg_message_id_t msg_id, bool is_protected)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->updateProtectedStatus(msg_id, is_protected);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_STORAGE_ERROR;
        }
@@ -243,30 +210,23 @@ EXPORT_API int msg_update_protected_status(msg_handle_t handle, msg_message_id_t
 
 EXPORT_API int msg_delete_message(msg_handle_t handle, msg_message_id_t msg_id)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->deleteMessage(msg_id);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_STORAGE_ERROR;
        }
@@ -277,30 +237,23 @@ EXPORT_API int msg_delete_message(msg_handle_t handle, msg_message_id_t msg_id)
 
 EXPORT_API int msg_delete_all_msgs_in_folder(msg_handle_t handle, msg_folder_id_t folder_id, bool bOnlyDB)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->deleteAllMessagesInFolder(folder_id, bOnlyDB);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_STORAGE_ERROR;
        }
@@ -311,30 +264,23 @@ EXPORT_API int msg_delete_all_msgs_in_folder(msg_handle_t handle, msg_folder_id_
 
 EXPORT_API int msg_delete_msgs_by_list(msg_handle_t handle, msg_id_list_s *msg_id_list)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
-       if (handle == NULL)
-       {
+       if (handle == NULL || msg_id_list == NULL)
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->deleteMessagesByList(msg_id_list);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_STORAGE_ERROR;
        }
@@ -345,30 +291,23 @@ EXPORT_API int msg_delete_msgs_by_list(msg_handle_t handle, msg_id_list_s *msg_i
 
 EXPORT_API int msg_move_msg_to_folder(msg_handle_t handle, msg_message_id_t msg_id, msg_folder_id_t dest_folder_id)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->moveMessageToFolder(msg_id, dest_folder_id);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_STORAGE_ERROR;
        }
@@ -379,36 +318,28 @@ EXPORT_API int msg_move_msg_to_folder(msg_handle_t handle, msg_message_id_t msg_
 
 EXPORT_API int msg_move_msg_to_storage(msg_handle_t handle, msg_message_id_t msg_id, msg_storage_id_t storage_id)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
-       if (storage_id < MSG_STORAGE_PHONE || storage_id > MSG_STORAGE_SIM2)
-       {
+       if (storage_id < MSG_STORAGE_PHONE || storage_id > MSG_STORAGE_SIM2) {
                MSG_FATAL("unsupported storage [%d]", storage_id);
                return MSG_ERR_INVALID_PARAMETER;
        }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->moveMessageToStorage(msg_id, storage_id);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_STORAGE_ERROR;
        }
@@ -419,30 +350,25 @@ EXPORT_API int msg_move_msg_to_storage(msg_handle_t handle, msg_message_id_t msg
 
 EXPORT_API int msg_count_message(msg_handle_t handle, msg_folder_id_t folder_id, msg_struct_t count_info)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
-       if (handle == NULL)
-       {
+       if (handle == NULL || count_info == NULL)
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
        msg_struct_s *pStruct = (msg_struct_s *)count_info;
-       try
-       {
+       MSG_TYPE_CHECK(pStruct->type, MSG_STRUCT_COUNT_INFO);
+
+       try {
                err = pHandle->countMessage(folder_id, (MSG_COUNT_INFO_S *)pStruct->data);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_STORAGE_ERROR;
        }
@@ -453,48 +379,38 @@ EXPORT_API int msg_count_message(msg_handle_t handle, msg_folder_id_t folder_id,
 
 EXPORT_API int msg_count_msg_by_type(msg_handle_t handle, msg_message_type_t msg_type, int *msg_count)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
-       if (handle == NULL)
-       {
+       if (handle == NULL || msg_count == NULL)
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
        MSG_MESSAGE_TYPE_S msgType = {0};
 
-       if (msg_type == MSG_TYPE_SMS)
-       {
+       if (msg_type == MSG_TYPE_SMS) {
                msgType.mainType = MSG_SMS_TYPE;
                msgType.subType = MSG_NORMAL_SMS;
-       }
-       else if (msg_type == MSG_TYPE_SMS_WAPPUSH)
-       {
+       } else if (msg_type == MSG_TYPE_SMS_WAPPUSH) {
                msgType.mainType = MSG_SMS_TYPE;
                msgType.subType = MSG_WAP_SI_SMS;
-       }
-       else if (msg_type == MSG_TYPE_MMS)
-       {
+       } else if (msg_type == MSG_TYPE_MMS) {
                msgType.mainType = MSG_MMS_TYPE;
                msgType.subType = MSG_SENDREQ_MMS;
+       } else {
+               return MSG_ERR_INVALID_PARAMETER;
        }
 
-       try
-       {
+       try {
                err = pHandle->countMsgByType(&msgType, msg_count);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_STORAGE_ERROR;
        }
@@ -505,32 +421,29 @@ EXPORT_API int msg_count_msg_by_type(msg_handle_t handle, msg_message_type_t msg
 
 EXPORT_API int msg_count_msg_by_contact(msg_handle_t handle, const msg_struct_t addr_info, msg_struct_t msg_thread_count_list)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
-       if (handle == NULL || addr_info == NULL)
-       {
+       if (handle == NULL || addr_info == NULL || msg_thread_count_list == NULL)
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
+
        msg_struct_s *pAddr = (msg_struct_s *)addr_info;
+       MSG_TYPE_CHECK(pAddr->type, MSG_STRUCT_THREAD_LIST_INDEX);
+
        msg_struct_s *pCount = (msg_struct_s *)msg_thread_count_list;
+       MSG_TYPE_CHECK(pCount->type, MSG_STRUCT_THREAD_COUNT_INFO);
 
-       try
-       {
+       try {
                err = pHandle->countMsgByContact((MSG_THREAD_LIST_INDEX_INFO_S *)pAddr->data, (MSG_THREAD_COUNT_INFO_S *)pCount->data);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_STORAGE_ERROR;
        }
@@ -541,34 +454,29 @@ EXPORT_API int msg_count_msg_by_contact(msg_handle_t handle, const msg_struct_t
 
 EXPORT_API int msg_get_message(msg_handle_t handle, msg_message_id_t msg_id, msg_struct_t opq_msg, msg_struct_t send_opt)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
-       if (handle == NULL || !opq_msg)
-       {
-               MSG_FATAL("handle or opq_msg is NULL");
+       if (handle == NULL || opq_msg == NULL || send_opt == NULL)
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
        msg_struct_s *pMsgStruct = (msg_struct_s *)opq_msg;
+       MSG_TYPE_CHECK(pMsgStruct->type, MSG_STRUCT_MESSAGE_INFO);
+
        msg_struct_s *pStruct = (msg_struct_s *)send_opt;
+       MSG_TYPE_CHECK(pStruct->type, MSG_STRUCT_SENDOPT);
 
-       try
-       {
+       try {
                err = pHandle->getMessage(msg_id, (MSG_MESSAGE_HIDDEN_S *)pMsgStruct->data, (MSG_SENDINGOPT_S *)pStruct->data);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_STORAGE_ERROR;
        }
@@ -578,31 +486,25 @@ EXPORT_API int msg_get_message(msg_handle_t handle, msg_message_id_t msg_id, msg
 
 EXPORT_API int msg_get_vobject_data(msg_handle_t handle, msg_message_id_t msg_id, void** result_data)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
-       if (handle == NULL || result_data == NULL)
-       {
+       if (handle == NULL || result_data == NULL) {
                MSG_FATAL("handle or result_data is NULL");
                return MSG_ERR_INVALID_PARAMETER;
        }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->getVobject(msg_id, result_data);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_STORAGE_ERROR;
        }
@@ -612,19 +514,16 @@ EXPORT_API int msg_get_vobject_data(msg_handle_t handle, msg_message_id_t msg_id
 
 EXPORT_API int msg_get_conversation(msg_handle_t handle, msg_message_id_t msg_id, msg_struct_t conv)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
-       if (handle == NULL || !conv)
-       {
+       if (handle == NULL || conv == NULL) {
                MSG_FATAL("handle or opq_msg is NULL");
                return MSG_ERR_INVALID_PARAMETER;
        }
@@ -632,12 +531,11 @@ EXPORT_API int msg_get_conversation(msg_handle_t handle, msg_message_id_t msg_id
        MsgHandle* pHandle = (MsgHandle*)handle;
 
        msg_struct_s *pMsgStruct = (msg_struct_s *)conv;
-       try
-       {
+       MSG_TYPE_CHECK(pMsgStruct->type, MSG_STRUCT_CONV_INFO);
+
+       try {
                err = pHandle->getConversationViewItem(msg_id, (MSG_CONVERSATION_VIEW_S *)pMsgStruct->data);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_STORAGE_ERROR;
        }
@@ -647,43 +545,35 @@ EXPORT_API int msg_get_conversation(msg_handle_t handle, msg_message_id_t msg_id
 
 EXPORT_API int msg_get_thread_view_list(msg_handle_t handle, const msg_struct_t sort_rule, msg_struct_list_s *msg_thread_view_list)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
-       if (handle == NULL)
-       {
+       if (handle == NULL || msg_thread_view_list == NULL)
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
        msg_struct_s *pStruct =(msg_struct_s *)sort_rule;
+       if (pStruct)
+               MSG_TYPE_CHECK(pStruct->type, MSG_STRUCT_SORT_RULE);
 
-       try
-       {
-               if (sort_rule == NULL)
-               {
+       try {
+               if (pStruct == NULL) {
                        MSG_SORT_RULE_S sortRule = {0};
 
                        sortRule.sortType = MSG_SORT_BY_THREAD_DATE;
                        sortRule.bAscending = false;
 
                        err = pHandle->getThreadViewList(&sortRule, msg_thread_view_list);
-               }
-               else
-               {
+               } else {
                        err = pHandle->getThreadViewList((MSG_SORT_RULE_S *)pStruct->data, msg_thread_view_list);
                }
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_STORAGE_ERROR;
        }
@@ -694,30 +584,23 @@ EXPORT_API int msg_get_thread_view_list(msg_handle_t handle, const msg_struct_t
 
 EXPORT_API int msg_get_conversation_view_list(msg_handle_t handle, msg_thread_id_t thread_id, msg_struct_list_s *msg_conv_view_list)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
-       if (handle == NULL)
-       {
+       if (handle == NULL || msg_conv_view_list == NULL)
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->getConversationViewList(thread_id, msg_conv_view_list);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_STORAGE_ERROR;
        }
@@ -728,30 +611,23 @@ EXPORT_API int msg_get_conversation_view_list(msg_handle_t handle, msg_thread_id
 
 EXPORT_API int msg_delete_thread_message_list(msg_handle_t handle, msg_thread_id_t thread_id, bool include_protected_msg)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->deleteThreadMessageList(thread_id, include_protected_msg);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_STORAGE_ERROR;
        }
@@ -762,31 +638,25 @@ EXPORT_API int msg_delete_thread_message_list(msg_handle_t handle, msg_thread_id
 
 EXPORT_API int msg_add_folder(msg_handle_t handle, const msg_struct_t folder_info)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL || folder_info == NULL)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
        msg_struct_s *pStruct = (msg_struct_s *)folder_info;
+       MSG_TYPE_CHECK(pStruct->type, MSG_STRUCT_FOLDER_INFO);
 
-       try
-       {
+       try {
                err = pHandle->addFolder((MSG_FOLDER_INFO_S *)pStruct->data);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_STORAGE_ERROR;
        }
@@ -797,31 +667,25 @@ EXPORT_API int msg_add_folder(msg_handle_t handle, const msg_struct_t folder_inf
 
 EXPORT_API int msg_update_folder(msg_handle_t handle, const msg_struct_t folder_info)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL || folder_info == NULL)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
        msg_struct_s *pStruct = (msg_struct_s *)folder_info;
+       MSG_TYPE_CHECK(pStruct->type, MSG_STRUCT_FOLDER_INFO);
 
-       try
-       {
+       try {
                err = pHandle->updateFolder((MSG_FOLDER_INFO_S *)pStruct->data);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_STORAGE_ERROR;
        }
@@ -832,30 +696,23 @@ EXPORT_API int msg_update_folder(msg_handle_t handle, const msg_struct_t folder_
 
 EXPORT_API int msg_delete_folder(msg_handle_t handle, msg_folder_id_t folder_id)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->deleteFolder(folder_id);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_STORAGE_ERROR;
        }
@@ -866,30 +723,23 @@ EXPORT_API int msg_delete_folder(msg_handle_t handle, msg_folder_id_t folder_id)
 
 EXPORT_API int msg_get_folder_list(msg_handle_t handle, msg_struct_list_s *folder_list)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
-       if (handle == NULL)
-       {
+       if (handle == NULL || folder_list == NULL)
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->getFolderList(folder_list);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_STORAGE_ERROR;
        }
@@ -900,23 +750,24 @@ EXPORT_API int msg_get_folder_list(msg_handle_t handle, msg_struct_list_s *folde
 
 EXPORT_API int msg_generate_message(msg_handle_t handle, msg_message_type_t msg_type, msg_folder_id_t folder_id, unsigned int num_msg)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       //Privilege check
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
-       if (handle == NULL)
-       {
+       if (handle == NULL) {
                MSG_DEBUG("Handle is NULL");
                return MSG_ERR_INVALID_PARAMETER;
        }
 
-       if (folder_id >= MSG_MAX_FOLDER_ID)
-       {
+       if (msg_type >= MSG_MESSAGE_TYPE_MAX) {
+               MSG_DEBUG("msg_type is invalid [%d]", msg_type);
+               return MSG_ERR_INVALID_PARAMETER;
+       }
+
+       if (folder_id >= MSG_MAX_FOLDER_ID) {
                MSG_DEBUG("folderId is invalid [%d]", folder_id);
                return MSG_ERR_INVALID_PARAMETER;
        }
@@ -929,7 +780,7 @@ EXPORT_API int msg_generate_message(msg_handle_t handle, msg_message_type_t msg_
 
        char strMsg[20] = {0};
        char prefix[10] ="0103001";
-//     int postfix = 8111;
+/*     int postfix = 8111; */
        int postfix = 0;
 
        srand(getpid());
@@ -939,8 +790,7 @@ EXPORT_API int msg_generate_message(msg_handle_t handle, msg_message_type_t msg_
        MSG_MESSAGE_HIDDEN_S *msgInfo = NULL;
        MSG_ADDRESS_INFO_S *addrInfo = NULL;
 
-       for (unsigned int i = 0; i < num_msg; i++)
-       {
+       for (unsigned int i = 0; i < num_msg; i++) {
                msg_s = (msg_struct_s *)msg_create_struct(MSG_STRUCT_MESSAGE_INFO);
                if (msg_s == NULL)
                        return MSG_ERR_NOT_SUPPORTED;
@@ -949,21 +799,18 @@ EXPORT_API int msg_generate_message(msg_handle_t handle, msg_message_type_t msg_
 
                msgInfo->folderId = folder_id;
 
-               if (msg_type == MSG_TYPE_MMS)
-               {
+               if (msg_type == MSG_TYPE_MMS) {
                        msgInfo->mainType = MSG_MMS_TYPE;
                        msgInfo->subType = MSG_SENDREQ_MMS;
-               }
-               else
-               {
+               } else {
                        msgInfo->mainType = MSG_SMS_TYPE;
                        msgInfo->subType = MSG_NORMAL_SMS;
 
                        snprintf(strMsg, sizeof(strMsg), "test msg %d", i);
                        msgInfo->dataSize = strlen(strMsg);
                        msgInfo->pData = (void*)new char[msgInfo->dataSize+1];
-            memcpy((char *)msgInfo->pData, strMsg, msgInfo->dataSize);
-            ((char*) msgInfo->pData)[msgInfo->dataSize] = '\0';
+                       memcpy((char *)msgInfo->pData, strMsg, msgInfo->dataSize);
+                       ((char*) msgInfo->pData)[msgInfo->dataSize] = '\0';
                }
 
                msgInfo->storageId = MSG_STORAGE_PHONE;
@@ -992,67 +839,66 @@ EXPORT_API int msg_generate_message(msg_handle_t handle, msg_message_type_t msg_
                else
                        msgInfo->direction = MSG_DIRECTION_TYPE_MT;
 
-               if (msg_type == MSG_TYPE_MMS)
-               {
+               if (msg_type == MSG_TYPE_MMS) {
                        snprintf(msgInfo->subject, MAX_SUBJECT_LEN+1, "subject %d", i);
 
-                       if(folder_id == MSG_INBOX_ID) msgInfo->networkStatus = MSG_NETWORK_RETRIEVE_SUCCESS;
-
-                       //MMS_MESSAGE_DATA_S* mms_data;
-                       //MMS_PAGE_S* page[2];
-                       //MMS_MEDIA_S* media[5];
-
-//                     mms_data = msg_mms_create_message();
-
-//                     msg_mms_set_rootlayout(mms_data, 100, 100, 0xffffff);
-//                     msg_mms_add_region(mms_data, "Image", 0, 50, 100, 50, 0xffffff);
-//                     msg_mms_add_region(mms_data, "Text", 0, 0, 100, 50, 0xffffff);
-
-                       //------------>  1st Slide Composing
-//                     page[0] = msg_mms_add_page(mms_data, 5440);
-
-//                     media[0] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_IMG, "Image", (char*)"/opt/etc/msg-service/P091120_104633.jpg");
-//                     media[1] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_AUDIO, NULL, (char*)"/opt/etc/msg-service/audio.amr");
-//                     media[2] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_TEXT, "Text", (char*)"/opt/etc/msg-service/Temp0_2.txt");
-//                     media[2]->sMedia.sText.nColor = 0x000000;
-//                     media[2]->sMedia.sText.nSize = MMS_SMIL_FONT_SIZE_NORMAL;
-//                     media[2]->sMedia.sText.bBold = true;
+                       if (folder_id == MSG_INBOX_ID) msgInfo->networkStatus = MSG_NETWORK_RETRIEVE_SUCCESS;
 
-                       //------------>  2nd Slide Composing
-//                     page[1] = msg_mms_add_page(mms_data, 4544);
+                       msg_struct_t mms_data = msg_create_struct(MSG_STRUCT_MMS);
 
-//                     media[3] = msg_mms_add_media(page[1], MMS_SMIL_MEDIA_TEXT, "Text", (char*)"/opt/etc/msg-service/Temp1_0.txt");
-//                     media[3]->sMedia.sText.nColor = 0x000000;
-//                     media[3]->sMedia.sText.nSize = MMS_SMIL_FONT_SIZE_NORMAL;
-//                     media[3]->sMedia.sText.bItalic = true;
-//                     media[4] = msg_mms_add_media(page[1], MMS_SMIL_MEDIA_VIDEO, "Text", (char*)"/opt/etc/msg-service/V091120_104905.3gp");
-//                     strncpy(media[4]->szAlt, "Video Load Fail", MAX_SMIL_ALT_LEN-1);
+                       msg_set_mms_struct((msg_struct_t)msg_s, mms_data);
 
-                       //FIXME msg_mms_set_message_body((msg_message_t)&msgInfo, mms_data);
-
-//                     msg_mms_destroy_message(mms_data);
+                       msg_release_struct(&mms_data);
+/*
+*                      MMS_MESSAGE_DATA_S* mms_data;
+*                      MMS_PAGE_S* page[2];
+*                      MMS_MEDIA_S* media[5];
+*
+*                      mms_data = msg_mms_create_message();
+*
+*                      msg_mms_set_rootlayout(mms_data, 100, 100, 0xffffff);
+*                      msg_mms_add_region(mms_data, "Image", 0, 50, 100, 50, 0xffffff);
+*                      msg_mms_add_region(mms_data, "Text", 0, 0, 100, 50, 0xffffff);
+*
+*                      ------------>  1st Slide Composing
+*                      page[0] = msg_mms_add_page(mms_data, 5440);
+*
+*                      media[0] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_IMG, "Image", (char*)"/opt/etc/msg-service/P091120_104633.jpg");
+*                      media[1] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_AUDIO, NULL, (char*)"/opt/etc/msg-service/audio.amr");
+*                      media[2] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_TEXT, "Text", (char*)"/opt/etc/msg-service/Temp0_2.txt");
+*                      media[2]->sMedia.sText.nColor = 0x000000;
+*                      media[2]->sMedia.sText.nSize = MMS_SMIL_FONT_SIZE_NORMAL;
+*                      media[2]->sMedia.sText.bBold = true;
+*
+*                      ------------>  2nd Slide Composing
+*                      page[1] = msg_mms_add_page(mms_data, 4544);
+*
+*                      media[3] = msg_mms_add_media(page[1], MMS_SMIL_MEDIA_TEXT, "Text", (char*)"/opt/etc/msg-service/Temp1_0.txt");
+*                      media[3]->sMedia.sText.nColor = 0x000000;
+*                      media[3]->sMedia.sText.nSize = MMS_SMIL_FONT_SIZE_NORMAL;
+*                      media[3]->sMedia.sText.bItalic = true;
+*                      media[4] = msg_mms_add_media(page[1], MMS_SMIL_MEDIA_VIDEO, "Text", (char*)"/opt/etc/msg-service/V091120_104905.3gp");
+*                      strncpy(media[4]->szAlt, "Video Load Fail", MAX_SMIL_ALT_LEN-1);
+*
+*                      //FIXME msg_mms_set_message_body((msg_message_t)&msgInfo, mms_data);
+*
+*                      msg_mms_destroy_message(mms_data);
+*/
                }
 
-               //err = msg_add_message(handle, (msg_message_t)&msgInfo, &sendingOpt);
-               try
-               {
+               /*err = msg_add_message(handle, (msg_message_t)&msgInfo, &sendingOpt);*/
+               try {
                        MsgHandle* pHandle = (MsgHandle*)handle;
                        err = pHandle->addMessage(msgInfo, &sendingOpt);
-               }
-               catch (MsgException& e)
-               {
+               } catch (MsgException& e) {
                        MSG_FATAL("%s", e.what());
                        msg_release_struct((msg_struct_t *)&msg_s);
                        return MSG_ERR_STORAGE_ERROR;
                }
 
-               if (msg_type == MSG_TYPE_MMS && msgInfo->pMmsData) //free pMmsData directly. It is added to enhance performance
-                       delete [] static_cast<char*>(msgInfo->pMmsData);
-
                msg_release_struct((msg_struct_t *)&msg_s);
 
-               if (err < 0)
-               {
+               if (err < 0) {
                        MSG_DEBUG("err [%d]", err);
                        return err;
                }
@@ -1064,32 +910,32 @@ EXPORT_API int msg_generate_message(msg_handle_t handle, msg_message_type_t msg_
 
 EXPORT_API int msg_get_quick_panel_data(msg_handle_t handle, msg_quickpanel_type_t type, msg_struct_t opq_msg)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
-       if (handle == NULL || !opq_msg )
-       {
+       if (handle == NULL || opq_msg == NULL ) {
                MSG_FATAL("handle or opq_msg is NULL");
                return MSG_ERR_INVALID_PARAMETER;
        }
 
+       if (type > MSG_QUICKPANEL_MMS_NOTI) {
+               MSG_FATAL("unsupported quickpanel type [%d]", type);
+               return MSG_ERR_INVALID_PARAMETER;
+       }
+
        MsgHandle* pHandle = (MsgHandle*)handle;
        msg_struct_s *pMsg = (msg_struct_s *)opq_msg;
+       MSG_TYPE_CHECK(pMsg->type, MSG_STRUCT_MESSAGE_INFO);
 
-       try
-       {
+       try {
                err = pHandle->getQuickPanelData(type, (MSG_MESSAGE_HIDDEN_S *)pMsg->data);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_STORAGE_ERROR;
        }
@@ -1100,30 +946,23 @@ EXPORT_API int msg_get_quick_panel_data(msg_handle_t handle, msg_quickpanel_type
 
 EXPORT_API int msg_reset_database(msg_handle_t handle)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->resetDatabase();
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_STORAGE_ERROR;
        }
@@ -1134,30 +973,23 @@ EXPORT_API int msg_reset_database(msg_handle_t handle)
 
 EXPORT_API int msg_get_mem_size(msg_handle_t handle, unsigned int* memsize)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
-       if (handle == NULL)
-       {
+       if (handle == NULL || memsize == NULL)
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->getMemSize(memsize);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_STORAGE_ERROR;
        }
@@ -1168,30 +1000,23 @@ EXPORT_API int msg_get_mem_size(msg_handle_t handle, unsigned int* memsize)
 
 EXPORT_API int msg_backup_message(msg_handle_t handle, msg_message_backup_type_t type, const char *backup_filepath)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL || backup_filepath == NULL)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->backupMessage(type, backup_filepath);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_STORAGE_ERROR;
        }
@@ -1202,30 +1027,23 @@ EXPORT_API int msg_backup_message(msg_handle_t handle, msg_message_backup_type_t
 
 EXPORT_API int msg_restore_message(msg_handle_t handle, const char *backup_filepath)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL || backup_filepath == NULL)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->restoreMessage(backup_filepath);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_STORAGE_ERROR;
        }
@@ -1236,35 +1054,26 @@ EXPORT_API int msg_restore_message(msg_handle_t handle, const char *backup_filep
 
 EXPORT_API int msg_search_message_for_thread_view(msg_handle_t handle, const char *search_string, msg_struct_list_s *msg_thread_view_list)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
-       if (handle == NULL || search_string == NULL)
-       {
+       if (handle == NULL || search_string == NULL || msg_thread_view_list == NULL)
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        if (strlen(search_string) <= 0 || strlen(search_string) > MAX_MSG_TEXT_LEN)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->searchMessage(search_string, msg_thread_view_list);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_STORAGE_ERROR;
        }
@@ -1274,30 +1083,23 @@ EXPORT_API int msg_search_message_for_thread_view(msg_handle_t handle, const cha
 
 EXPORT_API int msg_get_reject_msg_list(msg_handle_t handle, const char *phone_num, msg_struct_list_s *msg_reject_msg_list)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
-       if (handle == NULL)
-       {
+       if (handle == NULL || msg_reject_msg_list == NULL)
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->getRejectMsgList(phone_num, msg_reject_msg_list);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_STORAGE_ERROR;
        }
@@ -1308,30 +1110,23 @@ EXPORT_API int msg_get_reject_msg_list(msg_handle_t handle, const char *phone_nu
 
 EXPORT_API int msg_reg_storage_change_callback(msg_handle_t handle, msg_storage_change_cb cb, void *user_param)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL || cb == NULL)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->regStorageChangeCallback(cb, user_param);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                if (e.errorCode() == MsgException::SERVER_READY_ERROR)
                        return MSG_ERR_PERMISSION_DENIED;
@@ -1344,30 +1139,23 @@ EXPORT_API int msg_reg_storage_change_callback(msg_handle_t handle, msg_storage_
 
 EXPORT_API int msg_get_report_status(msg_handle_t handle, msg_message_id_t msg_id, msg_struct_list_s *report_list)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL || msg_id < 1 || report_list == NULL)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->getReportStatus(msg_id, report_list);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_STORAGE_ERROR;
        }
@@ -1377,30 +1165,23 @@ EXPORT_API int msg_get_report_status(msg_handle_t handle, msg_message_id_t msg_i
 
 EXPORT_API int msg_get_address_list(msg_handle_t handle, msg_thread_id_t thread_id, msg_struct_list_s *msg_address_list)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
-       if (handle == NULL)
-       {
+       if (handle == NULL || msg_address_list == NULL)
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->getAddressList(thread_id, msg_address_list);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_STORAGE_ERROR;
        }
@@ -1411,33 +1192,27 @@ EXPORT_API int msg_get_address_list(msg_handle_t handle, msg_thread_id_t thread_
 
 EXPORT_API int msg_get_thread_id_by_address(msg_handle_t handle, msg_struct_list_s *msg_address_list, msg_thread_id_t *thread_id)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL || msg_address_list == NULL || thread_id == NULL) {
                return MSG_ERR_INVALID_PARAMETER;
        }
 
-       if (msg_address_list->nCount < 1 ) {
+       if (msg_address_list->nCount < 1 )
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->getThreadIdByAddress(msg_address_list, thread_id);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_STORAGE_ERROR;
        }
@@ -1448,30 +1223,23 @@ EXPORT_API int msg_get_thread_id_by_address(msg_handle_t handle, msg_struct_list
 
 EXPORT_API int msg_get_thread_id_by_address2(msg_handle_t handle, msg_list_handle_t msg_address_list, msg_thread_id_t *thread_id)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL || msg_address_list == NULL || thread_id == NULL)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->getThreadIdByAddress(msg_address_list, thread_id);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_STORAGE_ERROR;
        }
@@ -1482,16 +1250,14 @@ EXPORT_API int msg_get_thread_id_by_address2(msg_handle_t handle, msg_list_handl
 
 EXPORT_API int msg_get_thread(msg_handle_t handle, msg_thread_id_t thread_id, msg_struct_t msg_thread)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL || msg_thread == NULL ) {
                MSG_FATAL("handle or msg_thread is NULL");
@@ -1500,19 +1266,13 @@ EXPORT_API int msg_get_thread(msg_handle_t handle, msg_thread_id_t thread_id, ms
 
        MsgHandle* pHandle = (MsgHandle*)handle;
        msg_struct_s *msgThread = (msg_struct_s *)msg_thread;
-       if (msgThread->type != MSG_STRUCT_THREAD_INFO) {
-               MSG_FATAL("Invaild type. type [%d]", msgThread->type);
-               return MSG_ERR_INVALID_PARAMETER;
-       }
+       MSG_TYPE_CHECK(msgThread->type, MSG_STRUCT_THREAD_INFO);
 
        MSG_THREAD_VIEW_S* pThreadInfo = (MSG_THREAD_VIEW_S *)msgThread->data;
 
-       try
-       {
+       try {
                err = pHandle->getThread(thread_id, pThreadInfo);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_STORAGE_ERROR;
        }
@@ -1522,30 +1282,25 @@ EXPORT_API int msg_get_thread(msg_handle_t handle, msg_thread_id_t thread_id, ms
 
 EXPORT_API int msg_get_message_list2(msg_handle_t handle, const msg_struct_t msg_list_conditions, msg_struct_list_s *msg_list)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
-       if (handle == NULL) {
+       if (handle == NULL || msg_list_conditions == NULL || msg_list == NULL)
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
        msg_struct_s *pStruct = (msg_struct_s *)msg_list_conditions;
+       MSG_TYPE_CHECK(pStruct->type, MSG_STRUCT_MSG_LIST_CONDITION);
 
-       try
-       {
+       try {
                err = pHandle->getMessageList((MSG_LIST_CONDITION_S *)pStruct->data, msg_list);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_STORAGE_ERROR;
        }
@@ -1556,28 +1311,22 @@ EXPORT_API int msg_get_message_list2(msg_handle_t handle, const msg_struct_t msg
 EXPORT_API int msg_get_media_list(msg_handle_t handle, msg_thread_id_t thread_id, msg_list_handle_t *msg_list)
 {
        CHECK_MSG_SUPPORTED(MSG_TELEPHONY_MMS_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
-       if (handle == NULL) {
+       if (handle == NULL || msg_list == NULL)
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->getMediaList(thread_id, msg_list);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_STORAGE_ERROR;
        }
@@ -1588,598 +1337,636 @@ EXPORT_API int msg_get_media_list(msg_handle_t handle, msg_thread_id_t thread_id
 
 static int msg_get_msg_type(int mainType, int subType)
 {
-       if (mainType == MSG_SMS_TYPE)
-       {
-       switch (subType) {
-                       case MSG_CB_SMS :
-                               return MSG_TYPE_SMS_CB;
-                       case MSG_JAVACB_SMS :
-                               return MSG_TYPE_SMS_JAVACB;
-                       case MSG_WAP_SI_SMS :
-                       case MSG_WAP_SL_SMS :
-                               return MSG_TYPE_SMS_WAPPUSH;
-                       case MSG_MWI_VOICE_SMS :
-                       case MSG_MWI_FAX_SMS :
-                       case MSG_MWI_EMAIL_SMS :
-                       case MSG_MWI_OTHER_SMS :
-                               return MSG_TYPE_SMS_MWI;
-                       case MSG_SYNCML_CP :
-                               return MSG_TYPE_SMS_SYNCML;
-                       case MSG_REJECT_SMS :
-                               return MSG_TYPE_SMS_REJECT;
-                       case MSG_ETWS_SMS :
-                               return MSG_TYPE_SMS_ETWS_PRIMARY;
-                       case MSG_CMAS_PRESIDENTIAL :
-                               return MSG_TYPE_SMS_CMAS_PRESIDENTIAL;
-                       case MSG_CMAS_EXTREME :
-                               return MSG_TYPE_SMS_CMAS_EXTREME;
-                       case MSG_CMAS_SEVERE :
-                               return MSG_TYPE_SMS_CMAS_SEVERE;
-                       case MSG_CMAS_AMBER :
-                               return MSG_TYPE_SMS_CMAS_AMBER;
-                       case MSG_CMAS_TEST :
-                               return MSG_TYPE_SMS_CMAS_TEST;
-                       case MSG_CMAS_OPERATOR_DEFINED :
-                               return MSG_TYPE_SMS_CMAS_OPERATOR_DEFINED;
-                       default :
-                               return MSG_TYPE_SMS;
-       }
-       }
-       else if (mainType == MSG_MMS_TYPE)
-       {
+       if (mainType == MSG_SMS_TYPE) {
+               switch (subType) {
+               case MSG_CB_SMS :
+                       return MSG_TYPE_SMS_CB;
+               case MSG_JAVACB_SMS :
+                       return MSG_TYPE_SMS_JAVACB;
+               case MSG_WAP_SI_SMS :
+               case MSG_WAP_SL_SMS :
+                       return MSG_TYPE_SMS_WAPPUSH;
+               case MSG_MWI_VOICE_SMS :
+               case MSG_MWI_FAX_SMS :
+               case MSG_MWI_EMAIL_SMS :
+               case MSG_MWI_OTHER_SMS :
+                       return MSG_TYPE_SMS_MWI;
+               case MSG_SYNCML_CP :
+                       return MSG_TYPE_SMS_SYNCML;
+               case MSG_REJECT_SMS :
+                       return MSG_TYPE_SMS_REJECT;
+               case MSG_ETWS_SMS :
+                       return MSG_TYPE_SMS_ETWS_PRIMARY;
+               case MSG_CMAS_PRESIDENTIAL :
+                       return MSG_TYPE_SMS_CMAS_PRESIDENTIAL;
+               case MSG_CMAS_EXTREME :
+                       return MSG_TYPE_SMS_CMAS_EXTREME;
+               case MSG_CMAS_SEVERE :
+                       return MSG_TYPE_SMS_CMAS_SEVERE;
+               case MSG_CMAS_AMBER :
+                       return MSG_TYPE_SMS_CMAS_AMBER;
+               case MSG_CMAS_TEST :
+                       return MSG_TYPE_SMS_CMAS_TEST;
+               case MSG_CMAS_OPERATOR_DEFINED :
+                       return MSG_TYPE_SMS_CMAS_OPERATOR_DEFINED;
+               default :
+                       return MSG_TYPE_SMS;
+               }
+       } else if (mainType == MSG_MMS_TYPE) {
                if (subType == MSG_NOTIFICATIONIND_MMS)
                        return MSG_TYPE_MMS_NOTI;
                else if (subType == MSG_SENDREQ_JAVA_MMS)
                        return MSG_TYPE_MMS_JAVA;
                else
                        return MSG_TYPE_MMS;
-       }
-       else
+       } else {
                return MSG_TYPE_INVALID;
+       }
 }
 
 
-int msg_syncml_info_get_int(void *syncml_info, int field)
+int msg_syncml_info_get_int(void *syncml_info, int field, int *value)
 {
-       int result = MSG_ERR_INVALID_PARAMETER;
+       if (!syncml_info)
+               return MSG_ERR_NULL_POINTER;
+
+       int ret = MSG_SUCCESS;
+
        MSG_SYNCML_MESSAGE_S *pSync = (MSG_SYNCML_MESSAGE_S *)syncml_info;
-       switch(field)
-       {
+
+       switch (field) {
        case MSG_SYNCML_INFO_EXTID_INT:
-               result = pSync->extId;
+               *value = pSync->extId;
                break;
        case MSG_SYNCML_INFO_PINCODE_INT:
-               result = pSync->pinCode;
+               *value = pSync->pinCode;
                break;
        default:
-               result = MSG_ERR_INVALID_PARAMETER;
+               ret = MSG_ERR_INVALID_PARAMETER;
                break;
        }
-       return result;
+
+       return ret;
 }
 
-int msg_count_info_get_int(void *count_info, int field)
+int msg_count_info_get_int(void *count_info, int field, int *value)
 {
-       int result = MSG_ERR_INVALID_PARAMETER;
+       if (!count_info)
+               return MSG_ERR_NULL_POINTER;
+
+       int ret = MSG_SUCCESS;
+
        MSG_COUNT_INFO_S *pCount = (MSG_COUNT_INFO_S *)count_info;
-       switch(field)
-       {
+
+       switch (field) {
        case MSG_COUNT_INFO_READ_INT:
-               result = pCount->nReadCnt;
+               *value = pCount->nReadCnt;
                break;
        case MSG_COUNT_INFO_UNREAD_INT:
-               result = pCount->nUnreadCnt;
+               *value = pCount->nUnreadCnt;
                break;
        case MSG_COUNT_INFO_SMS_INT:
-               result = pCount->nSms;
+               *value = pCount->nSms;
                break;
        case MSG_COUNT_INFO_MMS_INT:
-               result = pCount->nMms;
+               *value = pCount->nMms;
                break;
        default:
-               result = MSG_ERR_INVALID_PARAMETER;
+               ret = MSG_ERR_INVALID_PARAMETER;
                break;
        }
-       return result;
+
+       return ret;
 }
 
-int msg_thread_count_get_int(void *count_info, int field)
+int msg_thread_count_get_int(void *count_info, int field, int *value)
 {
-       int result = MSG_ERR_INVALID_PARAMETER;
+       if (!count_info)
+               return MSG_ERR_NULL_POINTER;
+
+       int ret = MSG_SUCCESS;
+
        MSG_THREAD_COUNT_INFO_S *pCount = (MSG_THREAD_COUNT_INFO_S *)count_info;
-       switch(field)
-       {
+
+       switch (field) {
        case MSG_THREAD_COUNT_TOTAL_INT:
-               result = pCount->totalCount;
+               *value = pCount->totalCount;
                break;
        case MSG_THREAD_COUNT_UNREAD_INT:
-               result = pCount->unReadCount;
+               *value = pCount->unReadCount;
                break;
        case MSG_THREAD_COUNT_SMS_INT:
-               result = pCount->smsMsgCount;
+               *value = pCount->smsMsgCount;
                break;
        case MSG_THREAD_COUNT_MMS_INT:
-               result = pCount->mmsMsgCount;
+               *value = pCount->mmsMsgCount;
                break;
        default:
-               result = MSG_ERR_INVALID_PARAMETER;
+               ret = MSG_ERR_INVALID_PARAMETER;
                break;
        }
-       return result;
+
+       return ret;
 }
 
-int msg_thread_index_get_int(void *index_info, int field)
+int msg_thread_index_get_int(void *index_info, int field, int *value)
 {
-       int result = MSG_ERR_INVALID_PARAMETER;
+       if (!index_info)
+               return MSG_ERR_NULL_POINTER;
+
+       int ret = MSG_SUCCESS;
+
        MSG_THREAD_LIST_INDEX_S *pIndex = (MSG_THREAD_LIST_INDEX_S *)index_info;
-       switch(field)
-       {
+       switch (field) {
        case MSG_THREAD_LIST_INDEX_CONTACTID_INT:
-               result = pIndex->contactId;
+               *value = pIndex->contactId;
                break;
        default:
-               result = MSG_ERR_INVALID_PARAMETER;
+               ret = MSG_ERR_INVALID_PARAMETER;
                break;
        }
-       return result;
+
+       return ret;
 }
 
-int msg_sortrule_get_int(void *sort_info, int field)
+int msg_sortrule_get_int(void *sort_info, int field, int *value)
 {
-       int result = MSG_ERR_INVALID_PARAMETER;
+       if (!sort_info)
+               return MSG_ERR_NULL_POINTER;
+
+       int ret = MSG_SUCCESS;
+
        MSG_SORT_RULE_S *pSort = (MSG_SORT_RULE_S *)sort_info;
-       switch(field)
-       {
+
+       switch (field) {
        case MSG_SORT_RULE_SORT_TYPE_INT:
-               result = pSort->sortType;
+               *value = pSort->sortType;
                break;
        default:
-               result = MSG_ERR_INVALID_PARAMETER;
+               ret = MSG_ERR_INVALID_PARAMETER;
                break;
        }
-       return result;
+
+       return ret;
 }
 
-int msg_folder_info_get_int(void *folder_info, int field)
+int msg_folder_info_get_int(void *folder_info, int field, int *value)
 {
-       int result = MSG_ERR_INVALID_PARAMETER;
+       if (!folder_info)
+               return MSG_ERR_NULL_POINTER;
+
+       int ret = MSG_SUCCESS;
+
        MSG_FOLDER_INFO_S *pFolder = (MSG_FOLDER_INFO_S *)folder_info;
-       switch(field)
-       {
+
+       switch (field) {
        case MSG_FOLDER_INFO_ID_INT:
-               result = pFolder->folderId;
+               *value = pFolder->folderId;
                break;
        case MSG_FOLDER_INFO_TYPE_INT:
-               result = pFolder->folderType;
+               *value = pFolder->folderType;
                break;
        default:
-               result = MSG_ERR_INVALID_PARAMETER;
+               ret = MSG_ERR_INVALID_PARAMETER;
                break;
        }
-       return result;
+
+       return ret;
 }
 
-int msg_thread_info_get_int(void *data, int field)
+int msg_thread_info_get_int(void *data, int field, int *value)
 {
-       int result = MSG_ERR_INVALID_PARAMETER;
+       if (!data)
+               return MSG_ERR_NULL_POINTER;
+
+       int ret = MSG_SUCCESS;
+
        MSG_THREAD_VIEW_S *pThread = (MSG_THREAD_VIEW_S *)data;
 
-       switch(field)
-       {
+       switch (field) {
        case MSG_THREAD_ID_INT :
-               result = pThread->threadId;
+               *value = pThread->threadId;
                break;
        case MSG_THREAD_MSG_TYPE_INT :
-               result = msg_get_msg_type(pThread->mainType, pThread->subType);
+               *value = msg_get_msg_type(pThread->mainType, pThread->subType);
                break;
        case MSG_THREAD_MSG_TIME_INT :
-               result = pThread->threadTime;
+               *value = pThread->threadTime;
                break;
        case MSG_THREAD_DIRECTION_INT :
-               result = pThread->direction;
+               *value = pThread->direction;
                break;
        case MSG_THREAD_UNREAD_COUNT_INT :
-               result = pThread->unreadCnt;
+               *value = pThread->unreadCnt;
                break;
        case MSG_THREAD_SMS_COUNT_INT :
-               result = pThread->smsCnt;
+               *value = pThread->smsCnt;
                break;
        case MSG_THREAD_MMS_COUNT_INT :
-               result = pThread->mmsCnt;
+               *value = pThread->mmsCnt;
                break;
        default:
-               result = MSG_ERR_INVALID_PARAMETER;
+               ret = MSG_ERR_INVALID_PARAMETER;
                break;
        }
-       return result;
+
+       return ret;
 }
 
 
-int msg_conv_info_get_int(void *data, int field)
+int msg_conv_info_get_int(void *data, int field, int *value)
 {
-       int result = MSG_ERR_INVALID_PARAMETER;
+       if (!data)
+               return MSG_ERR_NULL_POINTER;
+
+       int ret = MSG_SUCCESS;
+
        MSG_CONVERSATION_VIEW_S *pConv = (MSG_CONVERSATION_VIEW_S *)data;
 
-       switch(field)
-       {
+       switch (field) {
        case MSG_CONV_MSG_ID_INT :
-               result = pConv->msgId;
+               *value = pConv->msgId;
                break;
        case MSG_CONV_MSG_THREAD_ID_INT :
-               result = pConv->threadId;
+               *value = pConv->threadId;
                break;
        case MSG_CONV_MSG_FOLDER_ID_INT :
-               result = pConv->folderId;
+               *value = pConv->folderId;
                break;
        case MSG_CONV_MSG_TYPE_INT :
-               result = msg_get_msg_type(pConv->mainType, pConv->subType);
+               *value = msg_get_msg_type(pConv->mainType, pConv->subType);
                break;
        case MSG_CONV_MSG_STORAGE_ID_INT :
-               result = pConv->storageId;
+               *value = pConv->storageId;
                break;
        case MSG_CONV_MSG_DISPLAY_TIME_INT :
-               result = pConv->displayTime;
+               *value = pConv->displayTime;
                break;
        case MSG_CONV_MSG_SCHEDULED_TIME_INT :
-               result = pConv->scheduledTime;
+               *value = pConv->scheduledTime;
                break;
        case MSG_CONV_MSG_NETWORK_STATUS_INT :
-               result = pConv->networkStatus;
+               *value = pConv->networkStatus;
                break;
        case MSG_CONV_MSG_DIRECTION_INT :
-               result = pConv->direction;
+               *value = pConv->direction;
                break;
        case MSG_CONV_MSG_ATTACH_COUNT_INT :
-               result = pConv->attachCount;
+               *value = pConv->attachCount;
                break;
        case MSG_CONV_MSG_TEXT_SIZE_INT :
-               result = pConv->textSize;
+               *value = pConv->textSize;
                break;
        case MSG_CONV_MSG_PAGE_COUNT_INT :
-               result = pConv->pageCount;
+               *value = pConv->pageCount;
                break;
        case MSG_CONV_MSG_TCS_BC_LEVEL_INT :
-               result = pConv->tcs_bc_level;
+               *value = pConv->tcs_bc_level;
                break;
        case MSG_CONV_MSG_SIM_INDEX_INT :
-               result = pConv->simIndex;
+               *value = pConv->simIndex;
                break;
        default:
-               result = MSG_ERR_INVALID_PARAMETER;
+               ret = MSG_ERR_INVALID_PARAMETER;
                break;
        }
-       return result;
+
+       return ret;
 }
 
 
-int msg_search_condition_get_int(void *condition_info, int field)
+int msg_list_condition_get_int(void *condition_info, int field, int *value)
 {
-       int result = MSG_ERR_INVALID_PARAMETER;
-       MSG_SEARCH_CONDITION_S *pCond = (MSG_SEARCH_CONDITION_S *)condition_info;
-       switch(field)
-       {
-       case MSG_SEARCH_CONDITION_FOLDERID_INT:
-               result = pCond->folderId;
-               break;
-       case MSG_SEARCH_CONDITION_MSGTYPE_INT:
-               result = pCond->msgType;
-               break;
-       case MSG_SEARCH_CONDITION_RESERVED_INT:
-               result = pCond->reserved;
-               break;
-       default:
-               result = MSG_ERR_INVALID_PARAMETER;
-               break;
-       }
-       return result;
-}
+       if (!condition_info)
+               return MSG_ERR_NULL_POINTER;
 
+       int ret = MSG_SUCCESS;
 
-int msg_list_condition_get_int(void *condition_info, int field)
-{
-       int result = MSG_ERR_INVALID_PARAMETER;
        MSG_LIST_CONDITION_S *pCond = (MSG_LIST_CONDITION_S *)condition_info;
-       switch(field)
-       {
+
+       switch (field) {
        case MSG_LIST_CONDITION_FOLDER_ID_INT:
-               result = pCond->folderId;
+               *value = pCond->folderId;
                break;
        case MSG_LIST_CONDITION_THREAD_ID_INT:
-                       result = pCond->threadId;
-                       break;
+               *value = pCond->threadId;
+               break;
        case MSG_LIST_CONDITION_STORAGE_ID_INT:
-                       result = pCond->storageId;
-                       break;
+               *value = pCond->storageId;
+               break;
        case MSG_LIST_CONDITION_MSGTYPE_INT:
-               result = pCond->msgType;
+               *value = pCond->msgType;
                break;
        case MSG_LIST_CONDITION_FROM_TIME_INT:
-               result = pCond->fromTime;
+               *value = pCond->fromTime;
                break;
        case MSG_LIST_CONDITION_TO_TIME_INT:
-               result = pCond->toTime;
+               *value = pCond->toTime;
                break;
        case MSG_LIST_CONDITION_OFFSET_INT:
-               result = pCond->offset;
+               *value = pCond->offset;
                break;
        case MSG_LIST_CONDITION_LIMIT_INT:
-               result = pCond->limit;
+               *value = pCond->limit;
                break;
        case MSG_LIST_CONDITION_SIM_INDEX_INT:
-               result = pCond->simIndex;
+               *value = pCond->simIndex;
                break;
        default:
-               result = MSG_ERR_INVALID_PARAMETER;
+               ret = MSG_ERR_INVALID_PARAMETER;
                break;
        }
-       return result;
+
+       return ret;
 }
 
 
-int msg_report_status_get_int(void *report_info, int field)
+int msg_report_status_get_int(void *report_info, int field, int *value)
 {
-       int result = MSG_ERR_INVALID_PARAMETER;
+       if (!report_info)
+               return MSG_ERR_NULL_POINTER;
+
+       int ret = MSG_SUCCESS;
+
        MSG_REPORT_STATUS_INFO_S *pReport = (MSG_REPORT_STATUS_INFO_S *)report_info;
-       switch(field)
-       {
+       switch (field) {
        case MSG_REPORT_TYPE_INT:
-               result = pReport->type;
+               *value = pReport->type;
                break;
        case MSG_REPORT_STATUS_INT:
-               result = pReport->status;
+               *value = pReport->status;
                break;
        case MSG_REPORT_TIME_INT:
-               result = pReport->statusTime;
+               *value = pReport->statusTime;
                break;
-
        default:
-               result = MSG_ERR_INVALID_PARAMETER;
+               ret = MSG_ERR_INVALID_PARAMETER;
                break;
        }
-       return result;
+
+       return ret;
 }
 
-char* msg_report_status_get_str(void *report_info, int field)
+int msg_report_status_get_str(void *report_info, int field, char *value, int size)
 {
-       char *result = NULL;
+       if (!report_info)
+               return MSG_ERR_NULL_POINTER;
+
        MSG_REPORT_STATUS_INFO_S *pReport = (MSG_REPORT_STATUS_INFO_S *)report_info;
-       switch(field)
-       {
 
+       switch (field) {
        case MSG_REPORT_ADDRESS_STR:
-               result = pReport->addressVal;
+               strncpy(value, pReport->addressVal, size);
                break;
-
        default:
-               break;
+               return MSG_ERR_INVALID_PARAMETER;
        }
-       return result;
+       return MSG_SUCCESS;
 }
 
-char* msg_folder_info_get_str(void *folder_info, int field)
+int msg_folder_info_get_str(void *folder_info, int field, char *value, int size)
 {
-       char *result = NULL;
+       if (!folder_info)
+               return MSG_ERR_NULL_POINTER;
+
        MSG_FOLDER_INFO_S *pFolder = (MSG_FOLDER_INFO_S *)folder_info;
-       switch(field)
-       {
+
+       switch (field) {
        case MSG_FOLDER_INFO_NAME_STR:
-               result = pFolder->folderName;
+               strncpy(value, pFolder->folderName, size);
                break;
        default:
-               result = NULL;
-               break;
+               return MSG_ERR_INVALID_PARAMETER;
        }
-       return result;
+
+       return MSG_SUCCESS;
 }
 
-char *msg_thread_info_get_str(void *data, int field)
+int msg_thread_info_get_str(void *data, int field, char *value, int size)
 {
-       char *ret_str = NULL;
+       if (!data)
+               return MSG_ERR_NULL_POINTER;
+
        MSG_THREAD_VIEW_S *pThread = (MSG_THREAD_VIEW_S *)data;
 
-       switch(field)
-       {
+       switch (field) {
        case MSG_THREAD_NAME_STR :
-               ret_str = pThread->threadName;
+               strncpy(value, pThread->threadName, size);
                break;
        case MSG_THREAD_MSG_DATA_STR :
-               ret_str = pThread->threadData;
+               strncpy(value, pThread->threadData, size);
                break;
        default:
-               break;
+               return MSG_ERR_INVALID_PARAMETER;
        }
 
-       return ret_str;
+       return MSG_SUCCESS;
 }
 
 
-char *msg_conv_info_get_str(void *data, int field)
+int msg_conv_info_get_str(void *data, int field, char *value, int size)
 {
-       char *ret_str = NULL;
+       if (!data)
+               return MSG_ERR_NULL_POINTER;
+
        MSG_CONVERSATION_VIEW_S *pConv = (MSG_CONVERSATION_VIEW_S *)data;
 
-       switch(field)
-       {
+       switch (field) {
        case MSG_CONV_MSG_SUBJECT_STR :
-               ret_str = pConv->subject;
+               strncpy(value, pConv->subject, size);
                break;
        case MSG_CONV_MSG_ATTACH_NAME_STR :
-               ret_str = pConv->attachFileName;
+               strncpy(value, pConv->attachFileName, size);
                break;
        case MSG_CONV_MSG_AUDIO_NAME_STR :
-               ret_str = pConv->audioFileName;
+               strncpy(value, pConv->audioFileName, size);
                break;
        case MSG_CONV_MSG_IMAGE_THUMB_PATH_STR :
-               ret_str = pConv->imageThumbPath;
+               strncpy(value, pConv->imageThumbPath, size);
                break;
        case MSG_CONV_MSG_VIDEO_THUMB_PATH_STR :
-               ret_str = pConv->videoThumbPath;
+               strncpy(value, pConv->videoThumbPath, size);
                break;
        case MSG_CONV_MSG_TEXT_STR :
-               ret_str = pConv->pText;
+               if (pConv->pText)
+                       strncpy(value, pConv->pText, size);
                break;
        case MSG_CONV_MSG_1ST_MEDIA_PATH_STR :
-               ret_str = pConv->firstMediaPath;
+               strncpy(value, pConv->firstMediaPath, size);
                break;
        default:
-               break;
+               return MSG_ERR_INVALID_PARAMETER;
        }
 
-       return ret_str;
+       return MSG_SUCCESS;
 }
 
 
-char* msg_search_condition_get_str(void *condition_info, int field, int size)
+int msg_list_condition_get_str(void *condition_info, int field, char *value, int size)
 {
-       char *result = NULL;
-       MSG_SEARCH_CONDITION_S *search_cond = (MSG_SEARCH_CONDITION_S *)condition_info;
-       switch(field)
-       {
-       case MSG_SEARCH_CONDITION_ADDRESS_VALUE_STR:
-               result = search_cond->pAddressVal;
-               break;
-       case MSG_SEARCH_CONDITION_SEARCH_VALUE_STR:
-               result = search_cond->pSearchVal;
-               break;
-       default:
-               result = NULL;
-               break;
-       }
-       return result;
-}
-
+       if (!condition_info)
+               return MSG_ERR_NULL_POINTER;
 
-char* msg_list_condition_get_str(void *condition_info, int field, int size)
-{
-       char *result = NULL;
        MSG_LIST_CONDITION_S *cond = (MSG_LIST_CONDITION_S *)condition_info;
-       switch(field)
-       {
+
+       switch (field) {
        case MSG_LIST_CONDITION_ADDRESS_VALUE_STR:
-               result = cond->pAddressVal;
+               if (cond->pAddressVal)
+                       strncpy(value, cond->pAddressVal, size);
                break;
        case MSG_LIST_CONDITION_TEXT_VALUE_STR:
-               result = cond->pTextVal;
+               if (cond->pTextVal)
+                       strncpy(value, cond->pTextVal, size);
                break;
        default:
-               result = NULL;
-               break;
+               return MSG_ERR_INVALID_PARAMETER;
        }
-       return result;
+
+       return MSG_SUCCESS;
 }
 
 
-bool msg_sendopt_get_bool(void *send_opt, int field)
+int msg_sendopt_get_bool(void *send_opt, int field, bool *value)
 {
-       bool result = false;
+       if (!send_opt)
+               return MSG_ERR_NULL_POINTER;
+
+       int ret = MSG_SUCCESS;
+
        MSG_SENDINGOPT_S *sendopt = (MSG_SENDINGOPT_S *)send_opt;
-       switch(field)
-       {
+
+       switch (field) {
        case MSG_SEND_OPT_SETTING_BOOL:
-               result = sendopt->bSetting;
+               *value = sendopt->bSetting;
                break;
        case MSG_SEND_OPT_KEEPCOPY_BOOL:
-               result = sendopt->bKeepCopy;
+               *value = sendopt->bKeepCopy;
                break;
        case MSG_SEND_OPT_DELIVER_REQ_BOOL:
-               result = sendopt->bDeliverReq;
+               *value = sendopt->bDeliverReq;
                break;
        default:
+               ret = MSG_ERR_INVALID_PARAMETER;
                break;
        }
-       return result;
+
+       return ret;
 }
 
-bool msg_sortrule_get_bool(void *sort_rule, int field)
+int msg_sortrule_get_bool(void *sort_rule, int field, bool *value)
 {
-       bool result = false;
+       if (!sort_rule)
+               return MSG_ERR_NULL_POINTER;
+
+       int ret = MSG_SUCCESS;
+
        MSG_SORT_RULE_S *pSort = (MSG_SORT_RULE_S *)sort_rule;
-       switch(field)
-       {
+
+       switch (field) {
        case MSG_SORT_RULE_ACSCEND_BOOL:
-               result = pSort->bAscending;
+               *value = pSort->bAscending;
                break;
        default:
+               ret = MSG_ERR_INVALID_PARAMETER;
                break;
        }
-       return result;
+
+       return ret;
 }
 
-bool msg_conv_get_bool(void *data, int field)
+int msg_conv_get_bool(void *data, int field, bool *value)
 {
-       bool result = false;
+       if (!data)
+               return MSG_ERR_NULL_POINTER;
+
+       int ret = MSG_SUCCESS;
+
        MSG_CONVERSATION_VIEW_S *pConv = (MSG_CONVERSATION_VIEW_S *)data;
-       switch(field)
-       {
+
+       switch (field) {
        case MSG_CONV_MSG_READ_BOOL:
-               result = pConv->bRead;
+               *value = pConv->bRead;
                break;
        case MSG_CONV_MSG_PROTECTED_BOOL:
-               result = pConv->bProtected;
+               *value = pConv->bProtected;
                break;
        default:
+               ret = MSG_ERR_INVALID_PARAMETER;
                break;
        }
-       return result;
+
+       return ret;
 }
 
-bool msg_thread_info_get_bool(void *data, int field)
+int msg_thread_info_get_bool(void *data, int field, bool *value)
 {
-       bool result = false;
+       if (!data)
+               return MSG_ERR_NULL_POINTER;
+
+       int ret = MSG_SUCCESS;
+
        MSG_THREAD_VIEW_S *pthreadInfo = (MSG_THREAD_VIEW_S *)data;
-       switch(field)
-       {
+
+       switch (field) {
        case MSG_THREAD_PROTECTED_BOOL:
-               result = pthreadInfo->bProtected;
+               *value = pthreadInfo->bProtected;
                break;
        case MSG_THREAD_DRAFT_BOOL :
-               result = pthreadInfo->bDraft;
+               *value = pthreadInfo->bDraft;
                break;
        case MSG_THREAD_SEND_FAILED_BOOL :
-               result = pthreadInfo->bSendFailed;
+               *value = pthreadInfo->bSendFailed;
                break;
        case MSG_THREAD_SENDING_BOOL :
-               result = pthreadInfo->bSending;
+               *value = pthreadInfo->bSending;
                break;
        default:
+               ret = MSG_ERR_INVALID_PARAMETER;
                break;
        }
-       return result;
+
+       return ret;
 }
 
 
-bool msg_list_condition_get_bool(void *data, int field)
+int msg_list_condition_get_bool(void *data, int field, bool *value)
 {
-       bool result = false;
+       if (!data)
+               return MSG_ERR_NULL_POINTER;
+
+       int ret = MSG_SUCCESS;
+
        MSG_LIST_CONDITION_S *pCond = (MSG_LIST_CONDITION_S *)data;
-       switch(field)
-       {
+
+       switch (field) {
        case MSG_LIST_CONDITION_PROTECTED_BOOL:
-               result = pCond->bProtected;
+               *value = pCond->bProtected;
                break;
        case MSG_LIST_CONDITION_SCHEDULED_BOOL :
-               result = pCond->bScheduled;
+               *value = pCond->bScheduled;
                break;
        case MSG_LIST_CONDITION_AND_OPERATER_BOOL :
-               result = pCond->bAnd;
+               *value = pCond->bAnd;
                break;
        default:
+               ret = MSG_ERR_INVALID_PARAMETER;
                break;
        }
-       return result;
+
+       return ret;
 }
 
 
 int msg_sendopt_get_struct_handle(msg_struct_s *msg_struct, int field, void **value)
 {
-       msg_error_t err =  MSG_SUCCESS;
-       if(!msg_struct || !value)
+       msg_error_t err = MSG_SUCCESS;
+
+       if (!msg_struct || !value)
                return MSG_ERR_NULL_POINTER;
 
        MSG_SENDINGOPT_S *sendopt = (MSG_SENDINGOPT_S *)msg_struct->data;
 
-       switch(field)
-       {
+       switch (field) {
        case MSG_SEND_OPT_MMS_OPT_HND:
                *value = (void *)sendopt->mmsSendOpt;
                break;
@@ -2190,365 +1977,380 @@ int msg_sendopt_get_struct_handle(msg_struct_s *msg_struct, int field, void **va
                err = MSG_ERR_UNKNOWN;
                break;
        }
+
        return err;
 }
 
 int msg_syncml_get_struct_handle(msg_struct_s *msg_struct, int field, void **value)
 {
-       msg_error_t err =  MSG_SUCCESS;
+       msg_error_t err = MSG_SUCCESS;
 
-       if(!msg_struct || !value)
+       if (!msg_struct || !value)
                return MSG_ERR_NULL_POINTER;
 
        MSG_SYNCML_MESSAGE_S *pSync = (MSG_SYNCML_MESSAGE_S *)msg_struct->data;
-       switch(field)
-       {
+
+       switch (field) {
        case MSG_SYNCML_INFO_MESSAGE_HND:
                *value = (void *)pSync->msg;
                break;
        default:
                err = MSG_ERR_UNKNOWN;
                break;
-
        }
+
        return err;
 }
 
 int msg_thread_index_get_struct_handle(msg_struct_s *msg_struct, int field, void **value)
 {
-       msg_error_t err =  MSG_SUCCESS;
+       msg_error_t err = MSG_SUCCESS;
 
-       if(!msg_struct || !value)
+       if (!msg_struct || !value)
                return MSG_ERR_NULL_POINTER;
 
        MSG_THREAD_LIST_INDEX_INFO_S *pIndex = (MSG_THREAD_LIST_INDEX_INFO_S *)msg_struct->data;
-       switch(field)
-       {
+
+       switch (field) {
        case MSG_THREAD_LIST_INDEX_ADDR_INFO_HND:
                *value = (void *)pIndex->msgAddrInfo;
                break;
        default:
                err = MSG_ERR_UNKNOWN;
                break;
-
        }
+
        return err;
 }
 
 
 int msg_list_condition_get_struct_handle(msg_struct_s *msg_struct, int field, void **value)
 {
-       msg_error_t err =  MSG_SUCCESS;
+       msg_error_t err = MSG_SUCCESS;
 
-       if(!msg_struct || !value)
+       if (!msg_struct || !value)
                return MSG_ERR_NULL_POINTER;
 
        MSG_LIST_CONDITION_S *pCond = (MSG_LIST_CONDITION_S *)msg_struct->data;
-       switch(field)
-       {
+
+       switch (field) {
        case MSG_LIST_CONDITION_SORT_RULE_HND:
                *value = (void *)pCond->sortRule;
                break;
        default:
                err = MSG_ERR_UNKNOWN;
                break;
-
        }
+
        return err;
 }
 
 
-int msg_address_info_get_int(void *addr_info, int field)
+int msg_address_info_get_int(void *addr_info, int field, int *value)
 {
-       int result = MSG_ERR_INVALID_PARAMETER;
+       if (!addr_info)
+               return MSG_ERR_NULL_POINTER;
+
+       int ret = MSG_SUCCESS;
+
        MSG_ADDRESS_INFO_S *pAddr = (MSG_ADDRESS_INFO_S *)addr_info;
-       switch(field)
-       {
+
+       switch (field) {
        case MSG_ADDRESS_INFO_ADDRESS_TYPE_INT:
-               result = pAddr->addressType;
+               *value = pAddr->addressType;
                break;
        case MSG_ADDRESS_INFO_RECIPIENT_TYPE_INT:
-               result = pAddr->recipientType;
+               *value = pAddr->recipientType;
                break;
        case MSG_ADDRESS_INFO_CONTACT_ID_INT:
-               result = pAddr->contactId;
+               *value = pAddr->contactId;
                break;
        default:
+               ret = MSG_ERR_INVALID_PARAMETER;
                break;
        }
-       return result;
+
+       return ret;
 }
-int msg_mms_sendopt_get_int(void *opt_info, int field)
+
+int msg_mms_sendopt_get_int(void *opt_info, int field, int *value)
 {
-       int result = MSG_ERR_INVALID_PARAMETER;
+       if (!opt_info)
+               return MSG_ERR_NULL_POINTER;
+
+       int ret = MSG_SUCCESS;
+
        MMS_SENDINGOPT_S *pOpt = (MMS_SENDINGOPT_S *)opt_info;
-       switch(field)
-       {
+
+       switch (field) {
        case MSG_MMS_SENDOPTION_EXPIRY_TIME_INT:
-               result = pOpt->expiryTime;
+               *value = pOpt->expiryTime;
                break;
        case MSG_MMS_SENDOPTION_DELIVERY_TIME_INT:
-               result = pOpt->deliveryTime;
+               *value = pOpt->deliveryTime;
                break;
        case MSG_MMS_SENDOPTION_PRIORITY_INT:
-               result = pOpt->priority;
+               *value = pOpt->priority;
                break;
        default:
+               ret = MSG_ERR_INVALID_PARAMETER;
                break;
        }
-       return result;
+
+       return ret;
 }
 
-int msg_reject_message_get_int(void *msg_info, int field)
+int msg_reject_message_get_int(void *msg_info, int field, int *value)
 {
-       int result = MSG_ERR_INVALID_PARAMETER;
+       if (!msg_info)
+               return MSG_ERR_NULL_POINTER;
+
+       int ret = MSG_SUCCESS;
+
        MSG_REJECT_MSG_INFO_S *pMsg = (MSG_REJECT_MSG_INFO_S *)msg_info;
-       switch(field)
-       {
+
+       switch (field) {
        case MSG_REJECT_MESSAGE_MSGID_INT:
-               result = pMsg->msgId;
+               *value = pMsg->msgId;
                break;
        case MSG_REJECT_MESSAGE_DISPLAY_TIME_INT:
-               result = pMsg->displayTime;
+               *value = pMsg->displayTime;
                break;
        default:
+               ret = MSG_ERR_INVALID_PARAMETER;
                break;
        }
-       return result;
+
+       return ret;
 }
 
-char* msg_address_info_get_str(void *addr_info, int field, int size)
+int msg_address_info_get_str(void *addr_info, int field, char *value, int size)
 {
-       char *result = NULL;
+       if (!addr_info)
+               return MSG_ERR_NULL_POINTER;
+
        MSG_ADDRESS_INFO_S *pAddr = (MSG_ADDRESS_INFO_S *)addr_info;
-       switch(field)
-       {
+
+       switch (field) {
        case MSG_ADDRESS_INFO_ADDRESS_VALUE_STR:
-               result = pAddr->addressVal;
+               strncpy(value, pAddr->addressVal, size);
                break;
        case MSG_ADDRESS_INFO_DISPLAYNAME_STR:
-               result = pAddr->displayName;
+               strncpy(value, pAddr->displayName, size);
                break;
-
        default:
-               result = NULL;
-               break;
+               return MSG_ERR_INVALID_PARAMETER;
        }
-       return result;
+
+       return MSG_SUCCESS;
 }
 
-char* msg_reject_message_get_str(void *msg_info, int field, int size)
+int msg_reject_message_get_str(void *msg_info, int field, char *value, int size)
 {
-       char *result = NULL;
+       if (!msg_info)
+               return MSG_ERR_NULL_POINTER;
+
        MSG_REJECT_MSG_INFO_S *pMsg = (MSG_REJECT_MSG_INFO_S *)msg_info;
-       switch(field)
-       {
+
+       switch (field) {
        case MSG_REJECT_MESSAGE_MSGTEXT_STR:
-               result = pMsg->msgText;
+               strncpy(value, pMsg->msgText, size);
                break;
        default:
-               result = NULL;
-               break;
+               return MSG_ERR_INVALID_PARAMETER;
        }
-       return result;
+
+       return MSG_SUCCESS;
 }
 
-bool msg_mms_sendopt_get_bool(void *opt_info, int field)
+int msg_mms_sendopt_get_bool(void *opt_info, int field, bool *value)
 {
-       bool result = false;
+       if (!opt_info)
+               return MSG_ERR_NULL_POINTER;
+
+       int ret = MSG_SUCCESS;
+
        MMS_SENDINGOPT_S *pOpt = (MMS_SENDINGOPT_S *)opt_info;
-       switch(field)
-       {
+
+       switch (field) {
        case MSG_MMS_SENDOPTION_READ_REQUEST_BOOL:
-               result = pOpt->bReadReq;
+               *value = pOpt->bReadReq;
                break;
        case MSG_MMS_SENDOPTION_DELIVERY_CUSTOMTIME_BOOL:
-               result = pOpt->bUseDeliveryCustomTime;
+               *value = pOpt->bUseDeliveryCustomTime;
                break;
        default:
+               ret = MSG_ERR_INVALID_PARAMETER;
                break;
        }
-       return result;
+
+       return ret;
 }
 
-bool msg_sms_sendopt_get_bool(void *opt_info, int field)
+int msg_sms_sendopt_get_bool(void *opt_info, int field, bool *value)
 {
-       bool result = false;
+       if (!opt_info)
+               return MSG_ERR_NULL_POINTER;
+
+       int ret = MSG_SUCCESS;
+
        SMS_SENDINGOPT_S *pOpt = (SMS_SENDINGOPT_S *)opt_info;
-       switch(field)
-       {
+
+       switch (field) {
        case MSG_SMS_SENDOPT_REPLYPATH_BOOL:
-               result = pOpt->bReplyPath;
+               *value = pOpt->bReplyPath;
                break;
        default:
+               ret = MSG_ERR_INVALID_PARAMETER;
                break;
        }
-       return result;
+
+       return ret;
 }
 
 int msg_syncml_info_set_int(void *syncml_info, int field, int value)
 {
 
-       msg_error_t err =  MSG_SUCCESS;
-       if(!syncml_info)
+       msg_error_t err = MSG_SUCCESS;
+
+       if (!syncml_info)
                return MSG_ERR_NULL_POINTER;
 
-    MSG_SYNCML_MESSAGE_S *pSync = (MSG_SYNCML_MESSAGE_S *)syncml_info;
-    switch(field)
-    {
-    case MSG_SYNCML_INFO_EXTID_INT:
+       MSG_SYNCML_MESSAGE_S *pSync = (MSG_SYNCML_MESSAGE_S *)syncml_info;
+
+       switch (field) {
+       case MSG_SYNCML_INFO_EXTID_INT:
                pSync->extId = value;
                break;
-    case MSG_SYNCML_INFO_PINCODE_INT:
+       case MSG_SYNCML_INFO_PINCODE_INT:
                pSync->pinCode = value;
                break;
-    default:
+       default:
                err = MSG_ERR_UNKNOWN;
                break;
-    }
+       }
 
        return err;
 }
 
 int msg_count_info_set_int(void *count_info, int field, int value)
 {
-       msg_error_t err =  MSG_SUCCESS;
-       if(!count_info)
+       msg_error_t err = MSG_SUCCESS;
+
+       if (!count_info)
                return MSG_ERR_NULL_POINTER;
 
-    MSG_COUNT_INFO_S *pCount = (MSG_COUNT_INFO_S *)count_info;
+       MSG_COUNT_INFO_S *pCount = (MSG_COUNT_INFO_S *)count_info;
 
-    switch(field)
-    {
-    case MSG_COUNT_INFO_READ_INT:
+       switch (field) {
+       case MSG_COUNT_INFO_READ_INT:
                pCount->nReadCnt = value;
                break;
-    case MSG_COUNT_INFO_UNREAD_INT:
+       case MSG_COUNT_INFO_UNREAD_INT:
                pCount->nUnreadCnt = value;
                break;
-    case MSG_COUNT_INFO_SMS_INT:
+       case MSG_COUNT_INFO_SMS_INT:
                pCount->nSms = value;
                break;
-    case MSG_COUNT_INFO_MMS_INT:
+       case MSG_COUNT_INFO_MMS_INT:
                pCount->nMms = value;
                break;
-    default:
+       default:
                err = MSG_ERR_UNKNOWN;
                break;
-    }
+       }
+
        return err;
 }
 
 int msg_thread_count_set_int(void *count_info, int field, int value)
 {
-       msg_error_t err =  MSG_SUCCESS;
-       if(!count_info)
+       msg_error_t err = MSG_SUCCESS;
+
+       if (!count_info)
                return MSG_ERR_NULL_POINTER;
 
-    MSG_THREAD_COUNT_INFO_S *pCount = (MSG_THREAD_COUNT_INFO_S *)count_info;
-    switch(field)
-    {
-    case MSG_THREAD_COUNT_TOTAL_INT:
+       MSG_THREAD_COUNT_INFO_S *pCount = (MSG_THREAD_COUNT_INFO_S *)count_info;
+
+       switch (field) {
+       case MSG_THREAD_COUNT_TOTAL_INT:
                pCount->totalCount = value;
                break;
-    case MSG_THREAD_COUNT_UNREAD_INT:
+       case MSG_THREAD_COUNT_UNREAD_INT:
                pCount->unReadCount = value;
                break;
-    case MSG_THREAD_COUNT_SMS_INT:
+       case MSG_THREAD_COUNT_SMS_INT:
                pCount->smsMsgCount = value;
                break;
-    case MSG_THREAD_COUNT_MMS_INT:
+       case MSG_THREAD_COUNT_MMS_INT:
                pCount->mmsMsgCount = value;
                break;
-    default:
+       default:
                err = MSG_ERR_UNKNOWN;
                break;
-    }
+       }
+
        return err;
 }
 
 int msg_thread_index_set_int(void *index_info, int field, int value)
 {
-       msg_error_t err =  MSG_SUCCESS;
-       if(!index_info)
+       msg_error_t err = MSG_SUCCESS;
+
+       if (!index_info)
                return MSG_ERR_NULL_POINTER;
 
-    MSG_THREAD_LIST_INDEX_S *pIndex = (MSG_THREAD_LIST_INDEX_S *)index_info;
-    switch(field)
-    {
-    case MSG_THREAD_LIST_INDEX_CONTACTID_INT:
+       MSG_THREAD_LIST_INDEX_S *pIndex = (MSG_THREAD_LIST_INDEX_S *)index_info;
+
+       switch (field) {
+       case MSG_THREAD_LIST_INDEX_CONTACTID_INT:
                pIndex->contactId = value;
                break;
-    default:
+       default:
                err = MSG_ERR_UNKNOWN;
                break;
-    }
+       }
 
        return err;
 }
 
 int msg_sortrule_set_int(void *sort_info, int field, int value)
 {
-       msg_error_t err =  MSG_SUCCESS;
+       msg_error_t err = MSG_SUCCESS;
 
-       if(!sort_info)
+       if (!sort_info)
                return MSG_ERR_NULL_POINTER;
 
-    MSG_SORT_RULE_S *pSort = (MSG_SORT_RULE_S *)sort_info;
-    switch(field)
-    {
-    case MSG_SORT_RULE_SORT_TYPE_INT:
+       MSG_SORT_RULE_S *pSort = (MSG_SORT_RULE_S *)sort_info;
+
+       switch (field) {
+       case MSG_SORT_RULE_SORT_TYPE_INT:
                pSort->sortType = value;
                break;
-    default:
+       default:
                err = MSG_ERR_UNKNOWN;
                break;
-    }
+       }
+
        return err;
 }
 
 int msg_folder_info_set_int(void *folder_info, int field, int value)
 {
-       msg_error_t err =  MSG_SUCCESS;
-       if(!folder_info)
+       msg_error_t err = MSG_SUCCESS;
+
+       if (!folder_info)
                return MSG_ERR_NULL_POINTER;
 
-    MSG_FOLDER_INFO_S *pFolder = (MSG_FOLDER_INFO_S *)folder_info;
-    switch(field)
-    {
-    case MSG_FOLDER_INFO_ID_INT:
+       MSG_FOLDER_INFO_S *pFolder = (MSG_FOLDER_INFO_S *)folder_info;
+
+       switch (field) {
+       case MSG_FOLDER_INFO_ID_INT:
                pFolder->folderId = value;
                break;
-    case MSG_FOLDER_INFO_TYPE_INT:
+       case MSG_FOLDER_INFO_TYPE_INT:
                pFolder->folderType = value;
                break;
-    default:
-               err = MSG_ERR_UNKNOWN;
-               break;
-    }
-
-       return err;
-}
-
-
-int msg_search_condition_set_int(void *condition_info, int field, int value)
-{
-       msg_error_t err =  MSG_SUCCESS;
-       if(!condition_info)
-               return MSG_ERR_NULL_POINTER;
-
-       MSG_SEARCH_CONDITION_S *pCond = (MSG_SEARCH_CONDITION_S *)condition_info;
-       switch(field)
-       {
-       case MSG_SEARCH_CONDITION_FOLDERID_INT:
-               pCond->folderId = value;
-               break;
-       case MSG_SEARCH_CONDITION_MSGTYPE_INT:
-               pCond->msgType = value;
-               break;
-       case MSG_SEARCH_CONDITION_RESERVED_INT:
-               pCond->reserved = value;
-               break;
        default:
                err = MSG_ERR_UNKNOWN;
                break;
@@ -2560,13 +2362,14 @@ int msg_search_condition_set_int(void *condition_info, int field, int value)
 
 int msg_list_condition_set_int(void *condition_info, int field, int value)
 {
-       msg_error_t err =  MSG_SUCCESS;
-       if(!condition_info)
+       msg_error_t err = MSG_SUCCESS;
+
+       if (!condition_info)
                return MSG_ERR_NULL_POINTER;
 
        MSG_LIST_CONDITION_S *pCond = (MSG_LIST_CONDITION_S *)condition_info;
-       switch(field)
-       {
+
+       switch (field) {
        case MSG_LIST_CONDITION_FOLDER_ID_INT:
                pCond->folderId = value;
                break;
@@ -2605,24 +2408,24 @@ int msg_list_condition_set_int(void *condition_info, int field, int value)
 
 int msg_report_status_set_int(void *report_info, int field, int value)
 {
-       msg_error_t err =  MSG_SUCCESS;
-       if(!report_info)
+       msg_error_t err = MSG_SUCCESS;
+
+       if (!report_info)
        return MSG_ERR_NULL_POINTER;
 
        MSG_REPORT_STATUS_INFO_S *pReport = (MSG_REPORT_STATUS_INFO_S *)report_info;
-       switch(field)
-       {
-               case MSG_REPORT_TYPE_INT:
-                       pReport->type = value;
+
+       switch (field) {
+       case MSG_REPORT_TYPE_INT:
+               pReport->type = value;
                break;
-               case MSG_REPORT_STATUS_INT:
-                       pReport->status = value;
+       case MSG_REPORT_STATUS_INT:
+               pReport->status = value;
                break;
-               case MSG_REPORT_TIME_INT:
-                       pReport->statusTime = value;
+       case MSG_REPORT_TIME_INT:
+               pReport->statusTime = value;
                break;
-
-               default:
+       default:
                err = MSG_ERR_UNKNOWN;
                break;
        }
@@ -2632,111 +2435,93 @@ int msg_report_status_set_int(void *report_info, int field, int value)
 
 int msg_folder_info_set_str(void *folder_info, int field, char *value, int size)
 {
-       msg_error_t err =  MSG_SUCCESS;
-       if(!folder_info || !value)
-               return MSG_ERR_NULL_POINTER;
-    MSG_FOLDER_INFO_S *pFolder = (MSG_FOLDER_INFO_S *)folder_info;
-    int _len = 0;
-    (size > MAX_FOLDER_NAME_SIZE)? _len = MAX_FOLDER_NAME_SIZE : _len = size;
-    switch(field)
-    {
-    case MSG_FOLDER_INFO_NAME_STR:
-               strncpy(pFolder->folderName, value, _len);
-               break;
-    default:
-               err = MSG_ERR_UNKNOWN;
-               break;
-    }
-
-       return err;
-}
+       msg_error_t err = MSG_SUCCESS;
 
-int msg_search_condition_set_str(void *condition_info, int field, char *value, int size)
-{
-       msg_error_t err =  MSG_SUCCESS;
-       if(!condition_info || !value)
+       if (!folder_info || !value)
                return MSG_ERR_NULL_POINTER;
 
-       MSG_SEARCH_CONDITION_S *search_cond = (MSG_SEARCH_CONDITION_S *)condition_info;
+       MSG_FOLDER_INFO_S *pFolder = (MSG_FOLDER_INFO_S *)folder_info;
+
+       int _len = 0;
+       (size > MAX_FOLDER_NAME_SIZE)? _len = MAX_FOLDER_NAME_SIZE : _len = size;
 
-       switch(field)
-       {
-       case MSG_SEARCH_CONDITION_ADDRESS_VALUE_STR:
-               if(size)
-                       search_cond->pAddressVal = value;
-               break;
-       case MSG_SEARCH_CONDITION_SEARCH_VALUE_STR:
-               if(size)
-                       search_cond->pSearchVal = value;
+       switch (field) {
+       case MSG_FOLDER_INFO_NAME_STR:
+               strncpy(pFolder->folderName, value, _len);
                break;
        default:
                err = MSG_ERR_UNKNOWN;
                break;
        }
+
        return err;
 }
 
 
 int msg_list_condition_set_str(void *condition_info, int field, char *value, int size)
 {
-       msg_error_t err =  MSG_SUCCESS;
-       if(!condition_info || !value)
+       msg_error_t err = MSG_SUCCESS;
+
+       if (!condition_info || !value)
                return MSG_ERR_NULL_POINTER;
 
        MSG_LIST_CONDITION_S *cond = (MSG_LIST_CONDITION_S *)condition_info;
 
-       switch(field)
-       {
+       switch (field) {
        case MSG_LIST_CONDITION_ADDRESS_VALUE_STR:
-               if(size)
+               if (size)
                        cond->pAddressVal = value;
                break;
        case MSG_LIST_CONDITION_TEXT_VALUE_STR:
-               if(size)
+               if (size)
                        cond->pTextVal = value;
                break;
        default:
                err = MSG_ERR_UNKNOWN;
                break;
        }
+
        return err;
 }
 
 
 int msg_sendopt_set_bool(void *send_opt, int field, bool value)
 {
-       msg_error_t err =  MSG_SUCCESS;
-       if(!send_opt)
+       msg_error_t err = MSG_SUCCESS;
+
+       if (!send_opt)
                return MSG_ERR_NULL_POINTER;
 
-    MSG_SENDINGOPT_S *sendopt = (MSG_SENDINGOPT_S *)send_opt;
-    switch(field)
-    {
-    case MSG_SEND_OPT_SETTING_BOOL:
+       MSG_SENDINGOPT_S *sendopt = (MSG_SENDINGOPT_S *)send_opt;
+
+       switch (field) {
+       case MSG_SEND_OPT_SETTING_BOOL:
                sendopt->bSetting = value;
                break;
-    case MSG_SEND_OPT_KEEPCOPY_BOOL:
+       case MSG_SEND_OPT_KEEPCOPY_BOOL:
                sendopt->bKeepCopy = value;
                break;
-    case MSG_SEND_OPT_DELIVER_REQ_BOOL:
+       case MSG_SEND_OPT_DELIVER_REQ_BOOL:
                sendopt->bDeliverReq = value;
                break;
-    default:
+       default:
                err = MSG_ERR_UNKNOWN;
                break;
-    }
+       }
+
        return err;
 }
 
 int msg_sortrule_set_bool(void *sort_rule, int field, bool value)
 {
-       msg_error_t err =  MSG_SUCCESS;
-       if(!sort_rule)
+       msg_error_t err = MSG_SUCCESS;
+
+       if (!sort_rule)
                return MSG_ERR_NULL_POINTER;
 
        MSG_SORT_RULE_S *pSort = (MSG_SORT_RULE_S *)sort_rule;
-       switch(field)
-       {
+
+       switch (field) {
        case MSG_SORT_RULE_ACSCEND_BOOL:
                pSort->bAscending = value;
                break;
@@ -2744,19 +2529,21 @@ int msg_sortrule_set_bool(void *sort_rule, int field, bool value)
                err = MSG_ERR_UNKNOWN;
                break;
        }
+
        return err;
 }
 
 
 int msg_list_condition_set_bool(void *data, int field, bool value)
 {
-       msg_error_t err =  MSG_SUCCESS;
-       if(!data)
+       msg_error_t err = MSG_SUCCESS;
+
+       if (!data)
                return MSG_ERR_NULL_POINTER;
 
        MSG_LIST_CONDITION_S *pCond = (MSG_LIST_CONDITION_S *)data;
-       switch(field)
-       {
+
+       switch (field) {
        case MSG_LIST_CONDITION_PROTECTED_BOOL:
                pCond->bProtected = value;
                break;
@@ -2770,21 +2557,22 @@ int msg_list_condition_set_bool(void *data, int field, bool value)
                err = MSG_ERR_UNKNOWN;
                break;
        }
+
        return err;
 }
 
 
 int msg_sendopt_set_struct_handle(msg_struct_s *msg_struct, int field, msg_struct_s *value)
 {
-       msg_error_t err =  MSG_SUCCESS;
-       if(!msg_struct || !value)
+       msg_error_t err = MSG_SUCCESS;
+
+       if (!msg_struct || !value)
                return MSG_ERR_NULL_POINTER;
 
        MSG_SENDINGOPT_S *sendopt = (MSG_SENDINGOPT_S *)msg_struct->data;
        msg_struct_s *pTmp = NULL;
 
-       switch(field)
-       {
+       switch (field) {
        case MSG_SEND_OPT_MMS_OPT_HND:
                pTmp = (msg_struct_s *)sendopt->mmsSendOpt;
                memcpy(pTmp->data, value->data, sizeof(MMS_SENDINGOPT_INFO_S));
@@ -2797,21 +2585,21 @@ int msg_sendopt_set_struct_handle(msg_struct_s *msg_struct, int field, msg_struc
                err = MSG_ERR_UNKNOWN;
                break;
        }
+
        return err;
 }
 
 int msg_syncml_set_struct_handle(msg_struct_s *msg_struct, int field, msg_struct_s *value)
 {
-       msg_error_t err =  MSG_SUCCESS;
+       msg_error_t err = MSG_SUCCESS;
 
-       if(!msg_struct || !value)
+       if (!msg_struct || !value)
                return MSG_ERR_NULL_POINTER;
 
        MSG_SYNCML_MESSAGE_S *pSync = (MSG_SYNCML_MESSAGE_S *)msg_struct->data;
        msg_struct_s *pTmp = NULL;
 
-       switch(field)
-       {
+       switch (field) {
        case MSG_SYNCML_INFO_MESSAGE_HND:
        {
                pTmp = (msg_struct_s *)pSync->msg;
@@ -2823,23 +2611,22 @@ int msg_syncml_set_struct_handle(msg_struct_s *msg_struct, int field, msg_struct
        default:
                err = MSG_ERR_UNKNOWN;
                break;
-
        }
+
        return err;
 }
 
 int msg_thread_index_set_struct_handle(msg_struct_s *msg_struct, int field, msg_struct_s *value)
 {
-       msg_error_t err =  MSG_SUCCESS;
+       msg_error_t err = MSG_SUCCESS;
 
-       if(!msg_struct || !value)
+       if (!msg_struct || !value)
                return MSG_ERR_NULL_POINTER;
 
        MSG_THREAD_LIST_INDEX_INFO_S *pIndex = (MSG_THREAD_LIST_INDEX_INFO_S *)msg_struct->data;
        msg_struct_s *pTmp = NULL;
 
-       switch(field)
-       {
+       switch (field) {
        case MSG_THREAD_LIST_INDEX_ADDR_INFO_HND:
                pTmp = (msg_struct_s *)pIndex->msgAddrInfo;
                memcpy(pTmp->data, value->data, sizeof(MSG_ADDRESS_INFO_S));
@@ -2847,24 +2634,23 @@ int msg_thread_index_set_struct_handle(msg_struct_s *msg_struct, int field, msg_
        default:
                err = MSG_ERR_UNKNOWN;
                break;
-
        }
+
        return err;
 }
 
 
 int msg_list_condition_set_struct_handle(msg_struct_s *msg_struct, int field, msg_struct_s *value)
 {
-       msg_error_t err =  MSG_SUCCESS;
+       msg_error_t err = MSG_SUCCESS;
 
-       if(!msg_struct || !value)
+       if (!msg_struct || !value)
                return MSG_ERR_NULL_POINTER;
 
        MSG_LIST_CONDITION_S *pCond = (MSG_LIST_CONDITION_S *)msg_struct->data;
        msg_struct_s *pTmp = NULL;
 
-       switch(field)
-       {
+       switch (field) {
        case MSG_LIST_CONDITION_SORT_RULE_HND:
                pTmp = (msg_struct_s *)pCond->sortRule;
                memcpy(pTmp->data, value->data, sizeof(MSG_SORT_RULE_S));
@@ -2872,21 +2658,22 @@ int msg_list_condition_set_struct_handle(msg_struct_s *msg_struct, int field, ms
        default:
                err = MSG_ERR_UNKNOWN;
                break;
-
        }
+
        return err;
 }
 
 
 int msg_address_info_set_int(void *addrinfo, int field, int value)
 {
-       msg_error_t err =  MSG_SUCCESS;
-       if(!addrinfo)
+       msg_error_t err = MSG_SUCCESS;
+
+       if (!addrinfo)
                return MSG_ERR_NULL_POINTER;
 
        MSG_ADDRESS_INFO_S *pAddr = (MSG_ADDRESS_INFO_S *)addrinfo;
-       switch(field)
-       {
+
+       switch (field) {
        case MSG_ADDRESS_INFO_ADDRESS_TYPE_INT:
                pAddr->addressType = value;
                break;
@@ -2898,7 +2685,7 @@ int msg_address_info_set_int(void *addrinfo, int field, int value)
                break;
        default:
                err = MSG_ERR_UNKNOWN;
-       break;
+               break;
        }
 
        return err;
@@ -2907,13 +2694,14 @@ int msg_address_info_set_int(void *addrinfo, int field, int value)
 
 int msg_mms_sendopt_set_int(void *opt_info, int field, int value)
 {
-       msg_error_t err =  MSG_SUCCESS;
-       if(!opt_info)
+       msg_error_t err = MSG_SUCCESS;
+
+       if (!opt_info)
                return MSG_ERR_NULL_POINTER;
 
        MMS_SENDINGOPT_S *pOpt = (MMS_SENDINGOPT_S *)opt_info;
-       switch(field)
-       {
+
+       switch (field) {
        case MSG_MMS_SENDOPTION_EXPIRY_TIME_INT:
                pOpt->expiryTime = value;
                break;
@@ -2925,7 +2713,7 @@ int msg_mms_sendopt_set_int(void *opt_info, int field, int value)
                break;
        default:
                err = MSG_ERR_UNKNOWN;
-       break;
+               break;
        }
 
        return err;
@@ -2933,13 +2721,14 @@ int msg_mms_sendopt_set_int(void *opt_info, int field, int value)
 
 int msg_reject_message_set_int(void *msg_info, int field, int value)
 {
-       msg_error_t err =  MSG_SUCCESS;
-       if(!msg_info)
+       msg_error_t err = MSG_SUCCESS;
+
+       if (!msg_info)
                return MSG_ERR_NULL_POINTER;
 
        MSG_REJECT_MSG_INFO_S *pMsg = (MSG_REJECT_MSG_INFO_S *)msg_info;
-       switch(field)
-       {
+
+       switch (field) {
        case MSG_REJECT_MESSAGE_MSGID_INT:
                pMsg->msgId = value;
                break;
@@ -2948,7 +2737,7 @@ int msg_reject_message_set_int(void *msg_info, int field, int value)
                break;
        default:
                err = MSG_ERR_UNKNOWN;
-       break;
+               break;
        }
 
        return err;
@@ -2956,145 +2745,148 @@ int msg_reject_message_set_int(void *msg_info, int field, int value)
 
 int msg_address_info_set_str(void *addr_info, int field, char *value, int size)
 {
-       msg_error_t err =  MSG_SUCCESS;
-       if(!addr_info || !value)
+       msg_error_t err = MSG_SUCCESS;
+
+       if (!addr_info || !value)
                return MSG_ERR_NULL_POINTER;
-    MSG_ADDRESS_INFO_S *pAddr = (MSG_ADDRESS_INFO_S *)addr_info;
-    int _len = 0;
-
-    switch(field)
-    {
-    case MSG_ADDRESS_INFO_ADDRESS_VALUE_STR:
-        (size > MAX_ADDRESS_VAL_LEN)? _len = MAX_ADDRESS_VAL_LEN : _len = size;
-        memset(pAddr->addressVal, 0x00, sizeof(pAddr->addressVal));
+
+       MSG_ADDRESS_INFO_S *pAddr = (MSG_ADDRESS_INFO_S *)addr_info;
+       int _len = 0;
+
+       switch (field) {
+       case MSG_ADDRESS_INFO_ADDRESS_VALUE_STR:
+               (size > MAX_ADDRESS_VAL_LEN)? _len = MAX_ADDRESS_VAL_LEN : _len = size;
+               memset(pAddr->addressVal, 0x00, sizeof(pAddr->addressVal));
                strncpy(pAddr->addressVal, value, _len);
                break;
-    case MSG_ADDRESS_INFO_DISPLAYNAME_STR:
-        (size > MAX_DISPLAY_NAME_LEN)? _len = MAX_DISPLAY_NAME_LEN : _len = size;
-        memset(pAddr->displayName, 0x00, sizeof(pAddr->displayName));
+       case MSG_ADDRESS_INFO_DISPLAYNAME_STR:
+               (size > MAX_DISPLAY_NAME_LEN)? _len = MAX_DISPLAY_NAME_LEN : _len = size;
+               memset(pAddr->displayName, 0x00, sizeof(pAddr->displayName));
                strncpy(pAddr->displayName, value, _len);
                break;
-    default:
+       default:
                err = MSG_ERR_UNKNOWN;
                break;
-    }
+       }
 
        return err;
 }
 
 int msg_media_info_set_str(void *media_info, int field, char *value, int size)
 {
-       msg_error_t err =  MSG_SUCCESS;
-       if(!media_info || !value)
+       msg_error_t err = MSG_SUCCESS;
+
+       if (!media_info || !value)
                return MSG_ERR_NULL_POINTER;
+
        MSG_MEDIA_INFO_S *pAddr = (MSG_MEDIA_INFO_S *)media_info;
-    int _len = 0;
+       int _len = 0;
 
-    switch(field)
-    {
-    case MSG_MEDIA_ITEM_STR:
-        (size > MSG_FILEPATH_LEN_MAX)? _len = MSG_FILEPATH_LEN_MAX : _len = size;
-        memset(pAddr->media_item, 0x00, sizeof(pAddr->media_item));
+       switch (field) {
+       case MSG_MEDIA_ITEM_STR:
+               (size > MSG_FILEPATH_LEN_MAX)? _len = MSG_FILEPATH_LEN_MAX : _len = size;
+               memset(pAddr->media_item, 0x00, sizeof(pAddr->media_item));
                strncpy(pAddr->media_item, value, _len);
                break;
-    default:
+       default:
                err = MSG_ERR_UNKNOWN;
                break;
-    }
+       }
 
        return err;
 }
 
 int msg_reject_message_set_str(void *msg_info, int field, char *value, int size)
 {
-       msg_error_t err =  MSG_SUCCESS;
-       if(!msg_info || !value)
+       msg_error_t err = MSG_SUCCESS;
+
+       if (!msg_info || !value)
                return MSG_ERR_NULL_POINTER;
-    MSG_REJECT_MSG_INFO_S *pMsg = (MSG_REJECT_MSG_INFO_S *)msg_info;
-    int _len = 0;
-    (size > MAX_MSG_TEXT_LEN)? _len = MAX_MSG_TEXT_LEN : _len = size;
-    switch(field)
-    {
-    case MSG_REJECT_MESSAGE_MSGTEXT_STR:
+
+       MSG_REJECT_MSG_INFO_S *pMsg = (MSG_REJECT_MSG_INFO_S *)msg_info;
+
+       int _len = 0;
+       (size > MAX_MSG_TEXT_LEN)? _len = MAX_MSG_TEXT_LEN : _len = size;
+
+       switch (field) {
+       case MSG_REJECT_MESSAGE_MSGTEXT_STR:
                strncpy(pMsg->msgText, value, _len);
                break;
-    default:
+       default:
                err = MSG_ERR_UNKNOWN;
                break;
-    }
+       }
 
        return err;
 }
 
 int msg_mms_sendopt_set_bool(void *option, int field, bool value)
 {
-       msg_error_t err =  MSG_SUCCESS;
-       if(!option)
+       msg_error_t err = MSG_SUCCESS;
+
+       if (!option)
                return MSG_ERR_NULL_POINTER;
 
-    MMS_SENDINGOPT_S *pOpt = (MMS_SENDINGOPT_S *)option;
-    switch(field)
-    {
-    case MSG_MMS_SENDOPTION_READ_REQUEST_BOOL:
+       MMS_SENDINGOPT_S *pOpt = (MMS_SENDINGOPT_S *)option;
+
+       switch (field) {
+       case MSG_MMS_SENDOPTION_READ_REQUEST_BOOL:
                pOpt->bReadReq = value;
                break;
-    case MSG_MMS_SENDOPTION_DELIVERY_CUSTOMTIME_BOOL:
+       case MSG_MMS_SENDOPTION_DELIVERY_CUSTOMTIME_BOOL:
                pOpt->bUseDeliveryCustomTime = value;
                break;
-    default:
+       default:
                err = MSG_ERR_UNKNOWN;
                break;
-    }
+       }
+
        return err;
 }
 
 int msg_sms_sendopt_set_bool(void *option, int field, bool value)
 {
-       msg_error_t err =  MSG_SUCCESS;
-       if(!option)
+       msg_error_t err = MSG_SUCCESS;
+
+       if (!option)
                return MSG_ERR_NULL_POINTER;
 
-    SMS_SENDINGOPT_S *pOpt = (SMS_SENDINGOPT_S *)option;
-    switch(field)
-    {
-    case MSG_SMS_SENDOPT_REPLYPATH_BOOL:
+       SMS_SENDINGOPT_S *pOpt = (SMS_SENDINGOPT_S *)option;
+
+       switch (field) {
+       case MSG_SMS_SENDOPT_REPLYPATH_BOOL:
                pOpt->bReplyPath = value;
                break;
-    default:
-       err = MSG_ERR_UNKNOWN;
+       default:
+               err = MSG_ERR_UNKNOWN;
                break;
-    }
+       }
+
        return err;
 }
 
 EXPORT_API int msg_add_push_event(msg_handle_t handle, const msg_struct_t push_event)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL || push_event == NULL)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
        msg_struct_s *pPush = (msg_struct_s *)push_event;
+       MSG_TYPE_CHECK(pPush->type, MSG_STRUCT_PUSH_CONFIG_INFO);
 
-       try
-       {
+       try {
                err = pHandle->addPushEvent((MSG_PUSH_EVENT_INFO_S *)pPush->data);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_STORAGE_ERROR;
        }
@@ -3104,32 +2896,26 @@ EXPORT_API int msg_add_push_event(msg_handle_t handle, const msg_struct_t push_e
 
 EXPORT_API int msg_delete_push_event(msg_handle_t handle, const msg_struct_t push_event)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL || push_event == NULL)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
        msg_struct_s *pPush = (msg_struct_s *)push_event;
+       MSG_TYPE_CHECK(pPush->type, MSG_STRUCT_PUSH_CONFIG_INFO);
 
-       try
-       {
+       try {
                err = pHandle->deletePushEvent((MSG_PUSH_EVENT_INFO_S *)pPush->data);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_STORAGE_ERROR;
        }
@@ -3139,33 +2925,29 @@ EXPORT_API int msg_delete_push_event(msg_handle_t handle, const msg_struct_t pus
 
 EXPORT_API int msg_update_push_event(msg_handle_t handle, const msg_struct_t src_event, const msg_struct_t dst_event)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL || src_event == NULL || dst_event == NULL)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
        msg_struct_s *pSrc = (msg_struct_s *)src_event;
+       MSG_TYPE_CHECK(pSrc->type, MSG_STRUCT_PUSH_CONFIG_INFO);
+
        msg_struct_s *pDst = (msg_struct_s *)dst_event;
+       MSG_TYPE_CHECK(pDst->type, MSG_STRUCT_PUSH_CONFIG_INFO);
 
-       try
-       {
+       try {
                err = pHandle->updatePushEvent((MSG_PUSH_EVENT_INFO_S *)pSrc->data, (MSG_PUSH_EVENT_INFO_S *)pDst->data);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_STORAGE_ERROR;
        }
@@ -3173,114 +2955,125 @@ EXPORT_API int msg_update_push_event(msg_handle_t handle, const msg_struct_t src
        return err;
 }
 
-char* msg_push_config_get_str(void *event_info, int field, int size)
+int msg_push_config_get_str(void *event_info, int field, char *value, int size)
 {
-       char *result = NULL;
+       if (!event_info)
+               return MSG_ERR_NULL_POINTER;
+
        MSG_PUSH_EVENT_INFO_S *pEvent = (MSG_PUSH_EVENT_INFO_S *)event_info;
-       switch(field)
-       {
-    case MSG_PUSH_CONFIG_CONTENT_TYPE_STR:
-               result = pEvent->contentType;
+
+       switch (field) {
+       case MSG_PUSH_CONFIG_CONTENT_TYPE_STR:
+               strncpy(value, pEvent->contentType, size);
                break;
-    case MSG_PUSH_CONFIG_APPLICATON_ID_STR:
-               result = pEvent->appId;
+       case MSG_PUSH_CONFIG_APPLICATON_ID_STR:
+               strncpy(value, pEvent->appId, size);
                break;
-    case MSG_PUSH_CONFIG_PACKAGE_NAME_STR:
-               result = pEvent->pkgName;
+       case MSG_PUSH_CONFIG_PACKAGE_NAME_STR:
+               strncpy(value, pEvent->pkgName, size);
                break;
-
        default:
-               result = NULL;
-               break;
+               return MSG_ERR_INVALID_PARAMETER;
        }
-       return result;
+
+       return MSG_SUCCESS;
 }
 
-bool msg_push_config_get_bool(void *event_info, int field)
+int msg_push_config_get_bool(void *event_info, int field, bool *value)
 {
-       bool result = false;
+       if (!event_info)
+               return MSG_ERR_NULL_POINTER;
+
+       int ret = MSG_SUCCESS;
+
        MSG_PUSH_EVENT_INFO_S *pEvent = (MSG_PUSH_EVENT_INFO_S *)event_info;
-       switch(field)
-       {
-    case MSG_PUSH_CONFIG_LAUNCH_BOOL:
-       result = pEvent->bLaunch;
+
+       switch (field) {
+       case MSG_PUSH_CONFIG_LAUNCH_BOOL:
+               *value = pEvent->bLaunch;
                break;
        default:
+               ret = MSG_ERR_INVALID_PARAMETER;
                break;
        }
-       return result;
+
+       return ret;
 }
 
 int msg_push_config_set_str(void *event_info, int field, char *value, int size)
 {
-       msg_error_t err =  MSG_SUCCESS;
-       if(!event_info || !value)
+       msg_error_t err = MSG_SUCCESS;
+
+       if (!event_info || !value)
                return MSG_ERR_NULL_POINTER;
-    MSG_PUSH_EVENT_INFO_S *pEvent = (MSG_PUSH_EVENT_INFO_S *)event_info;
-    int _len = 0;
 
-    switch(field)
-    {
-    case MSG_PUSH_CONFIG_CONTENT_TYPE_STR:
-        (size > MAX_WAPPUSH_CONTENT_TYPE_LEN)? _len = MAX_WAPPUSH_CONTENT_TYPE_LEN : _len = size;
+       MSG_PUSH_EVENT_INFO_S *pEvent = (MSG_PUSH_EVENT_INFO_S *)event_info;
+       int _len = 0;
+
+       switch (field) {
+       case MSG_PUSH_CONFIG_CONTENT_TYPE_STR:
+               (size > MAX_WAPPUSH_CONTENT_TYPE_LEN)? _len = MAX_WAPPUSH_CONTENT_TYPE_LEN : _len = size;
                strncpy(pEvent->contentType, value, _len);
                break;
-    case MSG_PUSH_CONFIG_APPLICATON_ID_STR:
-        (size > MAX_WAPPUSH_ID_LEN)? _len = MAX_WAPPUSH_ID_LEN : _len = size;
+       case MSG_PUSH_CONFIG_APPLICATON_ID_STR:
+               (size > MAX_WAPPUSH_ID_LEN)? _len = MAX_WAPPUSH_ID_LEN : _len = size;
                strncpy(pEvent->appId, value, _len);
                break;
-    case MSG_PUSH_CONFIG_PACKAGE_NAME_STR:
-        (size > MSG_FILEPATH_LEN_MAX)? _len = MSG_FILEPATH_LEN_MAX : _len = size;
+       case MSG_PUSH_CONFIG_PACKAGE_NAME_STR:
+               (size > MSG_FILEPATH_LEN_MAX)? _len = MSG_FILEPATH_LEN_MAX : _len = size;
                strncpy(pEvent->pkgName, value, _len);
                break;
-    default:
-       err = MSG_ERR_UNKNOWN;
+       default:
+               err = MSG_ERR_UNKNOWN;
                break;
-    }
+       }
 
        return err;
 }
 
 int msg_push_config_set_bool(void *event, int field, bool value)
 {
-       msg_error_t err =  MSG_SUCCESS;
-       if(!event)
+       msg_error_t err = MSG_SUCCESS;
+
+       if (!event)
                return MSG_ERR_NULL_POINTER;
 
        MSG_PUSH_EVENT_INFO_S *pEvent = (MSG_PUSH_EVENT_INFO_S *)event;
-    switch(field)
-    {
-    case MSG_PUSH_CONFIG_LAUNCH_BOOL:
-       pEvent->bLaunch = value;
+
+       switch (field) {
+       case MSG_PUSH_CONFIG_LAUNCH_BOOL:
+               pEvent->bLaunch = value;
                break;
-    default:
-       err = MSG_ERR_UNKNOWN;
+       default:
+               err = MSG_ERR_UNKNOWN;
                break;
-    }
+       }
+
        return err;
 }
 
-char* msg_media_item_get_str(void *data, int field, int size)
+int msg_media_item_get_str(void *data, int field, char *value, int size)
 {
-       char *result = NULL;
+       if (!data)
+               return MSG_ERR_NULL_POINTER;
+
        MSG_MEDIA_INFO_S *pMedia = (MSG_MEDIA_INFO_S *)data;
 
-       switch(field)
-       {
+       switch (field) {
        case MSG_MEDIA_ITEM_STR:
-               result = pMedia->media_item;
+               strncpy(value, pMedia->media_item, size);
                break;
        case MSG_MEDIA_MIME_TYPE_STR:
-               result = pMedia->mime_type;
+               strncpy(value, pMedia->mime_type, size);
                break;
        case MSG_MEDIA_THUMB_PATH_STR:
-               result = pMedia->thumb_path;
+               strncpy(value, pMedia->thumb_path, size);
                break;
        default:
-               result = NULL;
-               break;
+               return MSG_ERR_INVALID_PARAMETER;
        }
-       return result;
+
+       return MSG_SUCCESS;
 }
 
 int msg_media_item_get_int(void *data, int field, int *value)
@@ -3293,12 +3086,12 @@ int msg_media_item_get_int(void *data, int field, int *value)
        MSG_MEDIA_INFO_S *pMedia = (MSG_MEDIA_INFO_S *)data;
 
        switch (field) {
-               case MSG_MEDIA_MESSAGE_ID_INT:
-                       *value = pMedia->msg_id;
-                       break;
-               default :
-                       ret = MSG_ERR_INVALID_PARAMETER;
-                       break;
+       case MSG_MEDIA_MESSAGE_ID_INT:
+               *value = pMedia->msg_id;
+               break;
+       default :
+               ret = MSG_ERR_INVALID_PARAMETER;
+               break;
        }
 
        return ret;
index 8e8be87..291d76a 100755 (executable)
 #include "msg_private.h"
 #include "msg.h"
 
-#define MSG_TYPE_CHECK(a, b) \
-               ({\
-                       if(a != (b & 0xff00)) return MSG_ERR_INVALID_PARAMETER; \
-               })\
-
-
 void __msg_release_list_item(gpointer data)
 {
        if (data == NULL)
@@ -43,15 +37,14 @@ void __msg_release_list_item(gpointer data)
 
 EXPORT_API msg_struct_t msg_create_struct(int field)
 {
-       CHECK_MSG_SUPPORTED_RETURN_NULL(MSG_TELEPHONY_FEATURE);
+       CHECK_MSG_SUPPORTED_RETURN_NULL(MSG_TELEPHONY_SMS_FEATURE);
        msg_struct_s *msg_struct = new msg_struct_s;
        memset(msg_struct, 0x00, sizeof(msg_struct_s));
 
        msg_struct->type = field;
        msg_struct->data = NULL;
 
-       switch(field)
-       {
+       switch (field) {
        case MSG_STRUCT_MESSAGE_INFO :
                msg_message_create_struct(msg_struct);
                break;
@@ -147,12 +140,6 @@ EXPORT_API msg_struct_t msg_create_struct(int field)
                memset(msg_struct->data, 0x00, sizeof(MSG_FOLDER_INFO_S));
                break;
        }
-       case MSG_STRUCT_SEARCH_CONDITION:
-       {
-               msg_struct->data = new MSG_SEARCH_CONDITION_S;
-               memset(msg_struct->data, 0x00, sizeof(MSG_SEARCH_CONDITION_S));
-               break;
-       }
        case MSG_STRUCT_MSG_LIST_CONDITION:
        {
                msg_struct->data = new MSG_LIST_CONDITION_S;
@@ -179,7 +166,7 @@ EXPORT_API msg_struct_t msg_create_struct(int field)
                memset(msg_struct->data, 0x00, sizeof(MSG_SMSC_LIST_HIDDEN_S));
 
                MSG_SMSC_LIST_HIDDEN_S *pTmp = (MSG_SMSC_LIST_HIDDEN_S *)msg_struct->data;
-               pTmp->simIndex = MSG_SIM_SLOT_ID_1; // default sim index
+               pTmp->simIndex = MSG_SIM_SLOT_ID_1; /* default sim index */
 
                msg_struct_list_s *smsc_list = (msg_struct_list_s *)new msg_struct_list_s;
                memset(smsc_list, 0x00, sizeof(msg_struct_list_s));
@@ -213,7 +200,7 @@ EXPORT_API msg_struct_t msg_create_struct(int field)
                memset(msg_struct->data, 0x00, sizeof(MSG_CBMSG_OPT_HIDDEN_S));
 
                MSG_CBMSG_OPT_HIDDEN_S *pTmp = (MSG_CBMSG_OPT_HIDDEN_S *)msg_struct->data;
-               pTmp->simIndex = MSG_SIM_SLOT_ID_1; // default sim index
+               pTmp->simIndex = MSG_SIM_SLOT_ID_1; /* default sim index */
 
                pTmp->channelData = (msg_struct_list_s *)new msg_struct_list_s;
                memset(pTmp->channelData, 0x00, sizeof(msg_struct_list_s));
@@ -269,7 +256,7 @@ EXPORT_API msg_struct_t msg_create_struct(int field)
                msg_struct->data = new MSG_VOICEMAIL_OPT_S;
                memset(msg_struct->data, 0x00, sizeof(MSG_VOICEMAIL_OPT_S));
                MSG_VOICEMAIL_OPT_S *pTmp = (MSG_VOICEMAIL_OPT_S *)msg_struct->data;
-               pTmp->simIndex = MSG_SIM_SLOT_ID_1; // default sim index
+               pTmp->simIndex = MSG_SIM_SLOT_ID_1; /* default sim index */
                break;
        }
        case MSG_STRUCT_SETTING_GENERAL_OPT :
@@ -366,8 +353,7 @@ static int _release_msg_struct(msg_struct_t *msg_struct_handle)
 
        msg_struct_s *msg_struct = (msg_struct_s *)*msg_struct_handle;
 
-       switch(msg_struct->type)
-       {
+       switch (msg_struct->type) {
        case MSG_STRUCT_MESSAGE_INFO :
        {
                msg_message_release(&msg_struct);
@@ -502,16 +488,6 @@ static int _release_msg_struct(msg_struct_t *msg_struct_handle)
 
                break;
        }
-       case MSG_STRUCT_SEARCH_CONDITION:
-       {
-               delete (MSG_SEARCH_CONDITION_S*)(msg_struct->data);
-               msg_struct->data = NULL;
-
-               delete msg_struct;
-               *msg_struct_handle = NULL;
-
-               break;
-       }
        case MSG_STRUCT_MSG_LIST_CONDITION:
        {
                MSG_LIST_CONDITION_S *pCond = (MSG_LIST_CONDITION_S*)(msg_struct->data);
@@ -769,11 +745,11 @@ static int _release_msg_struct(msg_struct_t *msg_struct_handle)
 
 EXPORT_API int msg_release_struct(msg_struct_t *msg_struct_handle)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
 
        int ret = _release_msg_struct(msg_struct_handle);
 
-       // Release Memory
+       /* Release Memory */
        MsgReleaseMemory();
 
        return ret;
@@ -781,7 +757,7 @@ EXPORT_API int msg_release_struct(msg_struct_t *msg_struct_handle)
 
 EXPORT_API int msg_release_list_struct(msg_struct_list_s *msg_struct_list)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
        msg_error_t err = MSG_SUCCESS;
 
        if (msg_struct_list == NULL)
@@ -790,36 +766,24 @@ EXPORT_API int msg_release_list_struct(msg_struct_list_s *msg_struct_list)
        if (msg_struct_list->msg_struct_info == NULL) {
                if (msg_struct_list->nCount > 0)
                        msg_struct_list->nCount = 0;
-               return err;
+               return MSG_ERR_NULL_POINTER;
        }
 
-       if(msg_struct_list->nCount > 0) {
-               int structType = ((msg_struct_s *)msg_struct_list->msg_struct_info[0])->type;
+       if (msg_struct_list->nCount > 0) {
                int listCnt = msg_struct_list->nCount;
 
-               switch (structType)
-               {
-//             case MSG_STRUCT_ADDRESS_INFO :
-//             {
-//                     listCnt = MAX_TO_ADDRESS_CNT;
-//                     break;
-//             }
-               default :
-                       break;
-               }
-
-               for(int i = 0; i < listCnt; i++) {
+               for (int i = 0; i < listCnt; i++) {
                        _release_msg_struct(&(msg_struct_list->msg_struct_info[i]));
                }
        }
 
-       //free peer info list
+       /* free peer info list */
        g_free(msg_struct_list->msg_struct_info);
        msg_struct_list->msg_struct_info = NULL;
 
        msg_struct_list->nCount = 0;
 
-       // Release Memory
+       /* Release Memory */
        MsgReleaseMemory();
 
        return err;
@@ -827,77 +791,72 @@ EXPORT_API int msg_release_list_struct(msg_struct_list_s *msg_struct_list)
 
 EXPORT_API int msg_get_int_value(msg_struct_t msg_struct_handle, int field, int *value)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
        msg_error_t err = MSG_SUCCESS;
 
-       if (msg_struct_handle == NULL)
+       if (msg_struct_handle == NULL || value == NULL)
                return MSG_ERR_NULL_POINTER;
 
-       msg_struct_s *msg_struct = (msg_struct_s *) msg_struct_handle;
+       msg_struct_s *msg_struct = (msg_struct_s *)msg_struct_handle;
        MSG_TYPE_CHECK(msg_struct->type, field);
 
        if (msg_struct->data == NULL)
                return MSG_ERR_NULL_POINTER;
 
-       switch (msg_struct->type)
-       {
+       switch (msg_struct->type) {
        case MSG_STRUCT_MESSAGE_INFO :
                err = msg_message_get_int_value(msg_struct->data, field, value);
                break;
        case MSG_STRUCT_FILTER:
-               *value = msg_get_filter_info_int(msg_struct->data, field);
+               err = msg_get_filter_info_int(msg_struct->data, field, value);
                break;
        case MSG_STRUCT_SYNCML_INFO :
-               *value = msg_syncml_info_get_int(msg_struct->data, field);
+               err = msg_syncml_info_get_int(msg_struct->data, field, value);
                break;
        case MSG_STRUCT_COUNT_INFO :
-               *value = msg_count_info_get_int(msg_struct->data, field);
+               err = msg_count_info_get_int(msg_struct->data, field, value);
                break;
        case MSG_STRUCT_THREAD_COUNT_INFO :
-               *value = msg_thread_count_get_int(msg_struct->data, field);
+               err = msg_thread_count_get_int(msg_struct->data, field, value);
                break;
        case MSG_STRUCT_THREAD_LIST_INDEX :
-               *value = msg_thread_index_get_int(msg_struct->data, field);
+               err = msg_thread_index_get_int(msg_struct->data, field, value);
                break;
        case MSG_STRUCT_SORT_RULE :
-               *value = msg_sortrule_get_int(msg_struct->data, field);
+               err = msg_sortrule_get_int(msg_struct->data, field, value);
                break;
        case MSG_STRUCT_FOLDER_INFO :
-               *value = msg_folder_info_get_int(msg_struct->data, field);
+               err = msg_folder_info_get_int(msg_struct->data, field, value);
                break;
        case MSG_STRUCT_THREAD_INFO :
-               *value = msg_thread_info_get_int(msg_struct->data, field);
+               err = msg_thread_info_get_int(msg_struct->data, field, value);
                break;
        case MSG_STRUCT_CONV_INFO :
-               *value = msg_conv_info_get_int(msg_struct->data, field);
-               break;
-       case MSG_STRUCT_SEARCH_CONDITION :
-               *value = msg_search_condition_get_int(msg_struct->data, field);
+               err = msg_conv_info_get_int(msg_struct->data, field, value);
                break;
        case MSG_STRUCT_MSG_LIST_CONDITION :
-               *value = msg_list_condition_get_int(msg_struct->data, field);
+               err = msg_list_condition_get_int(msg_struct->data, field, value);
                break;
        case MSG_STRUCT_REPORT_STATUS_INFO :
-               *value = msg_report_status_get_int(msg_struct->data, field);
+               err = msg_report_status_get_int(msg_struct->data, field, value);
                break;
        case MSG_STRUCT_ADDRESS_INFO :
-               *value = msg_address_info_get_int(msg_struct->data, field);
+               err = msg_address_info_get_int(msg_struct->data, field, value);
                break;
        case MSG_STRUCT_MMS_SENDOPT :
-               *value = msg_mms_sendopt_get_int(msg_struct->data, field);
+               err = msg_mms_sendopt_get_int(msg_struct->data, field, value);
                break;
        case MSG_STRUCT_REJECT_MSG_INFO :
-               *value = msg_reject_message_get_int(msg_struct->data, field);
+               err = msg_reject_message_get_int(msg_struct->data, field, value);
                break;
        case MSG_STRUCT_REQUEST_INFO :
-               *value = msg_request_get_int(msg_struct->data, field);
+               err = msg_request_get_int(msg_struct->data, field, value);
                break;
        case MSG_STRUCT_SENT_STATUS_INFO :
-               *value = msg_sent_status_get_int((MSG_SENT_STATUS_S *)msg_struct->data, field);
+               err = msg_sent_status_get_int((MSG_SENT_STATUS_S *)msg_struct->data, field, value);
                break;
        case MSG_STRUCT_CB_MSG :
-               err = msg_cb_message_get_int_value (msg_struct->data, field, value);
+               err = msg_cb_message_get_int_value(msg_struct->data, field, value);
                break;
        case MSG_STRUCT_MMS:
        case MSG_STRUCT_MMS_PAGE:
@@ -935,90 +894,51 @@ EXPORT_API int msg_get_int_value(msg_struct_t msg_struct_handle, int field, int
        return err;
 }
 
-EXPORT_API int msg_get_str_value(msg_struct_t msg_struct_handle, int field, char *src, int size)
+EXPORT_API int msg_get_str_value(msg_struct_t msg_struct_handle, int field, char *value, int size)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
        msg_error_t err = MSG_SUCCESS;
 
-       if (msg_struct_handle == NULL)
+       if (msg_struct_handle == NULL || value == NULL)
                return MSG_ERR_NULL_POINTER;
 
-       msg_struct_s *msg_struct = (msg_struct_s *) msg_struct_handle;
+       if (size < 0)
+               return MSG_ERR_INVALID_PARAMETER;
+
+       msg_struct_s *msg_struct = (msg_struct_s *)msg_struct_handle;
 
        if (msg_struct->data == NULL)
                return MSG_ERR_NULL_POINTER;
 
-       char *ret_str = NULL;
-
-       switch (msg_struct->type)
-       {
+       switch (msg_struct->type) {
        case MSG_STRUCT_MESSAGE_INFO :
-               err = msg_message_get_str_value(msg_struct->data, field, src, size);
+               err = msg_message_get_str_value(msg_struct->data, field, value, size);
                break;
        case MSG_STRUCT_FILTER:
-               ret_str = msg_get_filter_info_str(msg_struct->data, field);
-                       if (ret_str == NULL)
-                               err = MSG_ERR_UNKNOWN;
-                       else
-                               strncpy(src, ret_str, size);
+               err = msg_get_filter_info_str(msg_struct->data, field, value, size);
                break;
        case MSG_STRUCT_FOLDER_INFO :
-               ret_str = msg_folder_info_get_str(msg_struct->data, field);
-               if (ret_str == NULL)
-                       err = MSG_ERR_UNKNOWN;
-               else
-                       strncpy(src, ret_str, size);
+               err = msg_folder_info_get_str(msg_struct->data, field, value, size);
                break;
        case MSG_STRUCT_THREAD_INFO :
-               ret_str = msg_thread_info_get_str(msg_struct->data, field);
-               if (ret_str == NULL)
-                       err = MSG_ERR_UNKNOWN;
-               else
-                       strncpy(src, ret_str, size);
+               err = msg_thread_info_get_str(msg_struct->data, field, value, size);
                break;
        case MSG_STRUCT_CONV_INFO :
-               ret_str = msg_conv_info_get_str(msg_struct->data, field);
-               if (ret_str == NULL)
-                       err = MSG_ERR_UNKNOWN;
-               else
-                       strncpy(src, ret_str, size);
-               break;
-       case MSG_STRUCT_SEARCH_CONDITION :
-               ret_str = msg_search_condition_get_str(msg_struct->data, field, size);
-               if (ret_str == NULL)
-                       err = MSG_ERR_UNKNOWN;
-               else
-                       strncpy(src, ret_str, size);
+               err = msg_conv_info_get_str(msg_struct->data, field, value, size);
                break;
        case MSG_STRUCT_MSG_LIST_CONDITION :
-               ret_str = msg_list_condition_get_str(msg_struct->data, field, size);
-               if (ret_str == NULL)
-                       err = MSG_ERR_UNKNOWN;
-               else
-                       strncpy(src, ret_str, size);
+               err = msg_list_condition_get_str(msg_struct->data, field, value, size);
                break;
 
        case MSG_STRUCT_ADDRESS_INFO :
-               ret_str = msg_address_info_get_str(msg_struct->data, field, size);
-               if (ret_str == NULL)
-                       err = MSG_ERR_UNKNOWN;
-               else
-                       strncpy(src, ret_str, size);
+               err = msg_address_info_get_str(msg_struct->data, field, value, size);
                break;
 
        case MSG_STRUCT_REJECT_MSG_INFO :
-               ret_str = msg_reject_message_get_str(msg_struct->data, field, size);
-               if (ret_str == NULL)
-                       err = MSG_ERR_UNKNOWN;
-               else
-                       strncpy(src, ret_str, size);
+               err = msg_reject_message_get_str(msg_struct->data, field, value, size);
                break;
        case MSG_STRUCT_MEDIA_INFO :
-               ret_str = msg_media_item_get_str(msg_struct->data, field, size);
-               if (ret_str == NULL)
-                       err = MSG_ERR_UNKNOWN;
-               else
-                       strncpy(src, ret_str, size);
+               err = msg_media_item_get_str(msg_struct->data, field, value, size);
                break;
        case MSG_STRUCT_MMS:
        case MSG_STRUCT_MMS_PAGE:
@@ -1030,30 +950,22 @@ EXPORT_API int msg_get_str_value(msg_struct_t msg_struct_handle, int field, char
        case MSG_STRUCT_MMS_SMIL_TEXT:
        case MSG_STRUCT_MMS_SMIL_AVI:
        case MSG_STRUCT_MULTIPART_INFO:
-               err = msg_mms_get_str_value(msg_struct, field, src, size);
+               err = msg_mms_get_str_value(msg_struct, field, value, size);
                break;
        case MSG_STRUCT_SETTING_GENERAL_OPT :
        case MSG_STRUCT_SETTING_SMSC_INFO :
        case MSG_STRUCT_SETTING_CB_CHANNEL_INFO :
        case MSG_STRUCT_SETTING_VOICE_MSG_OPT :
-               err = msg_setting_get_str_value(msg_struct, field, src, size);
+               err = msg_setting_get_str_value(msg_struct, field, value, size);
                break;
        case MSG_STRUCT_PUSH_CONFIG_INFO :
-               ret_str = msg_push_config_get_str(msg_struct->data, field, size);
-               if (ret_str == NULL)
-                       err = MSG_ERR_UNKNOWN;
-               else
-                       strncpy(src, ret_str, size);
+               err = msg_push_config_get_str(msg_struct->data, field, value, size);
                break;
        case MSG_STRUCT_REPORT_STATUS_INFO:
-               ret_str = msg_report_status_get_str(msg_struct->data, field);
-               if (ret_str == NULL)
-                       err = MSG_ERR_UNKNOWN;
-               else
-                       strncpy(src, ret_str, size);
+               err = msg_report_status_get_str(msg_struct->data, field, value, size);
                break;
        case MSG_STRUCT_CB_MSG :
-               err = msg_cb_message_get_str_value(msg_struct->data, field, src, size);
+               err = msg_cb_message_get_str_value(msg_struct->data, field, value, size);
                break;
        default :
                err = MSG_ERR_INVALID_PARAMETER;
@@ -1065,45 +977,44 @@ EXPORT_API int msg_get_str_value(msg_struct_t msg_struct_handle, int field, char
 
 EXPORT_API int msg_get_bool_value(msg_struct_t msg_struct_handle, int field, bool *value)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
        msg_error_t err = MSG_SUCCESS;
 
-       if (msg_struct_handle == NULL)
+       if (msg_struct_handle == NULL || value == NULL)
                return MSG_ERR_NULL_POINTER;
 
-       msg_struct_s *msg_struct = (msg_struct_s *) msg_struct_handle;
+       msg_struct_s *msg_struct = (msg_struct_s *)msg_struct_handle;
 
        if (msg_struct->data == NULL)
                return MSG_ERR_NULL_POINTER;
 
-       switch (msg_struct->type)
-       {
+       switch (msg_struct->type) {
        case MSG_STRUCT_FILTER :
-               *value = msg_get_filter_info_bool(msg_struct->data, field);
+               err = msg_get_filter_info_bool(msg_struct->data, field, value);
                break;
        case MSG_STRUCT_MESSAGE_INFO :
                err = msg_message_get_bool_value(msg_struct->data, field, value);
                break;
        case MSG_STRUCT_THREAD_INFO :
-               *value = msg_thread_info_get_bool(msg_struct->data, field);
+               err = msg_thread_info_get_bool(msg_struct->data, field, value);
                break;
        case MSG_STRUCT_CONV_INFO:
-               *value = msg_conv_get_bool(msg_struct->data, field);
+               err = msg_conv_get_bool(msg_struct->data, field, value);
                break;
        case MSG_STRUCT_SENDOPT:
-               *value = msg_sendopt_get_bool(msg_struct->data, field);
+               err = msg_sendopt_get_bool(msg_struct->data, field, value);
                break;
        case MSG_STRUCT_SORT_RULE:
-               *value = msg_sortrule_get_bool(msg_struct->data, field);
+               err = msg_sortrule_get_bool(msg_struct->data, field, value);
                break;
        case MSG_STRUCT_MSG_LIST_CONDITION:
-               *value = msg_list_condition_get_bool(msg_struct->data, field);
+               err = msg_list_condition_get_bool(msg_struct->data, field, value);
                break;
        case MSG_STRUCT_MMS_SENDOPT:
-               *value = msg_mms_sendopt_get_bool(msg_struct->data, field);
+               err = msg_mms_sendopt_get_bool(msg_struct->data, field, value);
                break;
        case MSG_STRUCT_SMS_SENDOPT:
-               *value = msg_sms_sendopt_get_bool(msg_struct->data, field);
+               err = msg_sms_sendopt_get_bool(msg_struct->data, field, value);
                break;
        case MSG_STRUCT_MMS:
        case MSG_STRUCT_MMS_PAGE:
@@ -1125,6 +1036,9 @@ EXPORT_API int msg_get_bool_value(msg_struct_t msg_struct_handle, int field, boo
        case MSG_STRUCT_SETTING_GENERAL_OPT :
                err = msg_setting_get_bool_value(msg_struct, field, value);
                break;
+       case MSG_STRUCT_PUSH_CONFIG_INFO:
+               err = msg_push_config_get_bool(msg_struct->data, field, value);
+               break;
        default :
                err = MSG_ERR_INVALID_PARAMETER;
                break;
@@ -1135,19 +1049,18 @@ EXPORT_API int msg_get_bool_value(msg_struct_t msg_struct_handle, int field, boo
 
 EXPORT_API int msg_get_struct_handle(msg_struct_t msg_struct_handle, int field, msg_struct_t *value)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
        msg_error_t err = MSG_SUCCESS;
 
-       if (msg_struct_handle == NULL)
+       if (msg_struct_handle == NULL || value == NULL)
                return MSG_ERR_NULL_POINTER;
 
-       msg_struct_s *msg_struct = (msg_struct_s *) msg_struct_handle;
+       msg_struct_s *msg_struct = (msg_struct_s *)msg_struct_handle;
 
        if (msg_struct->data == NULL)
                return MSG_ERR_NULL_POINTER;
 
-       switch (msg_struct->type)
-       {
+       switch (msg_struct->type) {
        case MSG_STRUCT_MESSAGE_INFO :
                err = msg_message_get_struct_hnd(msg_struct->data, field, (void **)value);
                break;
@@ -1179,19 +1092,18 @@ EXPORT_API int msg_get_struct_handle(msg_struct_t msg_struct_handle, int field,
 
 EXPORT_API int msg_get_list_handle(msg_struct_t msg_struct_handle, int field, void **value)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
        msg_error_t err = MSG_SUCCESS;
 
-       if (msg_struct_handle == NULL)
+       if (msg_struct_handle == NULL || value == NULL)
                return MSG_ERR_NULL_POINTER;
 
-       msg_struct_s *msg_struct = (msg_struct_s *) msg_struct_handle;
+       msg_struct_s *msg_struct = (msg_struct_s *)msg_struct_handle;
 
        if (msg_struct->data == NULL)
                return MSG_ERR_NULL_POINTER;
 
-       switch (msg_struct->type)
-       {
+       switch (msg_struct->type) {
        case MSG_STRUCT_MESSAGE_INFO :
                err = msg_message_get_list_hnd(msg_struct->data, field, value);
                break;
@@ -1216,19 +1128,18 @@ EXPORT_API int msg_get_list_handle(msg_struct_t msg_struct_handle, int field, vo
 
 EXPORT_API int msg_set_int_value(msg_struct_t msg_struct_handle, int field, int value)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
        msg_error_t err = MSG_SUCCESS;
 
        if (msg_struct_handle == NULL)
                return MSG_ERR_NULL_POINTER;
 
-       msg_struct_s *msg_struct = (msg_struct_s *) msg_struct_handle;
+       msg_struct_s *msg_struct = (msg_struct_s *)msg_struct_handle;
 
        if (msg_struct->data == NULL)
                return MSG_ERR_NULL_POINTER;
 
-       switch (msg_struct->type)
-       {
+       switch (msg_struct->type) {
        case MSG_STRUCT_MESSAGE_INFO :
                err = msg_message_set_int_value(msg_struct->data, field, value);
                break;
@@ -1253,9 +1164,6 @@ EXPORT_API int msg_set_int_value(msg_struct_t msg_struct_handle, int field, int
        case MSG_STRUCT_FOLDER_INFO :
                err = msg_folder_info_set_int(msg_struct->data, field, value);
                break;
-       case MSG_STRUCT_SEARCH_CONDITION :
-               err = msg_search_condition_set_int(msg_struct->data, field, value);
-               break;
        case MSG_STRUCT_MSG_LIST_CONDITION :
                err = msg_list_condition_set_int(msg_struct->data, field, value);
                break;
@@ -1308,19 +1216,21 @@ EXPORT_API int msg_set_int_value(msg_struct_t msg_struct_handle, int field, int
 
 EXPORT_API int msg_set_str_value(msg_struct_t msg_struct_handle, int field, char *value, int size)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
        msg_error_t err = MSG_SUCCESS;
 
-       if (msg_struct_handle == NULL)
+       if (msg_struct_handle == NULL || value == NULL)
                return MSG_ERR_NULL_POINTER;
 
-       msg_struct_s *msg_struct = (msg_struct_s *) msg_struct_handle;
+       if (size < 0)
+               return MSG_ERR_INVALID_PARAMETER;
+
+       msg_struct_s *msg_struct = (msg_struct_s *)msg_struct_handle;
 
        if (msg_struct->data == NULL)
                return MSG_ERR_NULL_POINTER;
 
-       switch (msg_struct->type)
-       {
+       switch (msg_struct->type) {
        case MSG_STRUCT_MESSAGE_INFO :
                err = msg_message_set_str_value(msg_struct->data, field, value, size);
                break;
@@ -1330,9 +1240,6 @@ EXPORT_API int msg_set_str_value(msg_struct_t msg_struct_handle, int field, char
        case MSG_STRUCT_FOLDER_INFO :
                err = msg_folder_info_set_str(msg_struct->data, field, value, size);
                break;
-       case MSG_STRUCT_SEARCH_CONDITION :
-               err = msg_search_condition_set_str(msg_struct->data, field, value, size);
-               break;
        case MSG_STRUCT_MSG_LIST_CONDITION :
                err = msg_list_condition_set_str(msg_struct->data, field, value, size);
                break;
@@ -1376,19 +1283,18 @@ EXPORT_API int msg_set_str_value(msg_struct_t msg_struct_handle, int field, char
 
 EXPORT_API int msg_set_bool_value(msg_struct_t msg_struct_handle, int field, bool value)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
        msg_error_t err = MSG_SUCCESS;
 
        if (msg_struct_handle == NULL)
                return MSG_ERR_NULL_POINTER;
 
-       msg_struct_s *msg_struct = (msg_struct_s *) msg_struct_handle;
+       msg_struct_s *msg_struct = (msg_struct_s *)msg_struct_handle;
 
        if (msg_struct->data == NULL)
                return MSG_ERR_NULL_POINTER;
 
-       switch (msg_struct->type)
-       {
+       switch (msg_struct->type) {
        case MSG_STRUCT_FILTER :
                err = msg_set_filter_info_bool(msg_struct->data, field, value);
                break;
@@ -1443,19 +1349,18 @@ EXPORT_API int msg_set_bool_value(msg_struct_t msg_struct_handle, int field, boo
 
 EXPORT_API int msg_set_struct_handle(msg_struct_t msg_struct_handle, int field, msg_struct_t value)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
        msg_error_t err = MSG_SUCCESS;
 
-       if (msg_struct_handle == NULL)
+       if (msg_struct_handle == NULL || value == NULL)
                return MSG_ERR_NULL_POINTER;
 
-       msg_struct_s *msg_struct = (msg_struct_s *) msg_struct_handle;
+       msg_struct_s *msg_struct = (msg_struct_s *)msg_struct_handle;
 
        if (msg_struct->data == NULL)
                return MSG_ERR_NULL_POINTER;
 
-       switch (msg_struct->type)
-       {
+       switch (msg_struct->type) {
        case MSG_STRUCT_MESSAGE_INFO :
                err = msg_message_set_struct_hnd(msg_struct->data, field, (void *)value);
                break;
@@ -1487,18 +1392,18 @@ EXPORT_API int msg_set_struct_handle(msg_struct_t msg_struct_handle, int field,
 
 EXPORT_API int msg_set_list_handle(msg_struct_t msg_struct_handle, int field, void *value)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
        msg_error_t err = MSG_SUCCESS;
 
-       if (msg_struct_handle == NULL)
+       if (msg_struct_handle == NULL || value == NULL)
                return MSG_ERR_NULL_POINTER;
 
-       msg_struct_s *msg_struct = (msg_struct_s *) msg_struct_handle;
+       msg_struct_s *msg_struct = (msg_struct_s *)msg_struct_handle;
 
        if (msg_struct->data == NULL)
                return MSG_ERR_NULL_POINTER;
 
-#if 0 // No operations
+#if 0 /* No operations */
        switch (msg_struct->type)
        {
        default :
@@ -1512,15 +1417,14 @@ EXPORT_API int msg_set_list_handle(msg_struct_t msg_struct_handle, int field, vo
 
 EXPORT_API int msg_list_add_item(msg_struct_t msg_struct_handle, int field, msg_struct_t *item)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       if (msg_struct_handle == NULL || item == NULL) {
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       if (msg_struct_handle == NULL || item == NULL)
                return MSG_ERR_NULL_POINTER;
-       }
 
        msg_error_t err = MSG_SUCCESS;
        msg_struct_s *msg_struct = (msg_struct_s *)msg_struct_handle;
 
-       switch(msg_struct->type) {
+       switch (msg_struct->type) {
        case MSG_STRUCT_MESSAGE_INFO:
        {
                err = msg_message_list_append(msg_struct_handle, field, item);
@@ -1542,17 +1446,16 @@ EXPORT_API int msg_list_add_item(msg_struct_t msg_struct_handle, int field, msg_
 
 EXPORT_API msg_struct_t msg_list_nth_data(msg_list_handle_t list_handle, int index)
 {
-       CHECK_MSG_SUPPORTED_RETURN_NULL(MSG_TELEPHONY_FEATURE);
-       if (list_handle == NULL) {
+       CHECK_MSG_SUPPORTED_RETURN_NULL(MSG_TELEPHONY_SMS_FEATURE);
+       if (list_handle == NULL)
                return NULL;
-       }
 
-       return (msg_struct_t)g_list_nth_data((GList *)list_handle,(guint)index);
+       return (msg_struct_t)g_list_nth_data((GList *)list_handle, (guint)index);
 }
 
 EXPORT_API int msg_list_length(msg_list_handle_t list_handle)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
        if (list_handle == NULL) {
                return 0;
        }
@@ -1562,26 +1465,19 @@ EXPORT_API int msg_list_length(msg_list_handle_t list_handle)
 
 EXPORT_API int msg_list_clear(msg_struct_t msg_struct_handle, int field)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       if (msg_struct_handle == NULL) {
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       if (msg_struct_handle == NULL)
                return MSG_ERR_NULL_POINTER;
-       }
 
        msg_error_t err = MSG_SUCCESS;
        msg_struct_s *msg_struct = (msg_struct_s *)msg_struct_handle;
 
-       switch(msg_struct->type) {
+       switch (msg_struct->type) {
        case MSG_STRUCT_MESSAGE_INFO:
        {
                err = msg_message_list_clear(msg_struct_handle, field);
        }
        break;
-//     case MSG_STRUCT_MMS:
-//     case MSG_STRUCT_MMS_PAGE:
-//     {
-//             err = msg_mms_list_append(msg_struct_handle, field, item);
-//     }
-//     break;
        default :
                err = MSG_ERR_INVALID_PARAMETER;
                break;
@@ -1590,13 +1486,11 @@ EXPORT_API int msg_list_clear(msg_struct_t msg_struct_handle, int field)
        return err;
 }
 
-
 EXPORT_API int msg_list_free(msg_list_handle_t list_handle)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       if (list_handle == NULL) {
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       if (list_handle == NULL)
                return MSG_ERR_NULL_POINTER;
-       }
 
        g_list_free_full((GList *)list_handle, __msg_release_list_item);
        list_handle = NULL;
@@ -1607,12 +1501,19 @@ EXPORT_API int msg_list_free(msg_list_handle_t list_handle)
 
 EXPORT_API int msg_util_calculate_text_length(const char* msg_text, msg_encode_type_t msg_encode_type_to, unsigned int *text_size, unsigned int *segment_size, msg_encode_type_t *msg_encode_type_in)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
        msg_error_t err = MSG_SUCCESS;
 
-       if (msg_text == NULL || text_size == NULL || segment_size == NULL) {
-               err = MSG_ERR_INVALID_PARAMETER;
-               return err;
+       if (msg_text == NULL || text_size == NULL || segment_size == NULL || msg_encode_type_in == NULL)
+               return MSG_ERR_INVALID_PARAMETER;
+
+#ifdef FEATURE_SMS_CDMA
+       if (msg_encode_type_to > MSG_ENCODE_ASCII7BIT) {
+#else
+       if (msg_encode_type_to > MSG_ENCODE_GSM7BIT_ABNORMAL) {
+#endif
+               MSG_FATAL("unsupported msg_encode_type [%d]", msg_encode_type_to);
+               return MSG_ERR_INVALID_PARAMETER;
        }
 
        msg_encode_type_t encodeType = MSG_ENCODE_AUTO;
@@ -1636,8 +1537,7 @@ EXPORT_API int msg_util_calculate_text_length(const char* msg_text, msg_encode_t
        *text_size = 0;
        *segment_size = 0;
 
-       switch (msg_encode_type_to)
-       {
+       switch (msg_encode_type_to) {
        case MSG_ENCODE_GSM7BIT :
                decodeLen = textCvt->convertUTF8ToGSM7bit(decodeData, bufSize, (const unsigned char*)msg_text, textSize, &langId, &bAbnormal);
                break;
@@ -1645,19 +1545,13 @@ EXPORT_API int msg_util_calculate_text_length(const char* msg_text, msg_encode_t
                decodeLen = textCvt->convertUTF8ToUCS2(decodeData, bufSize, (const unsigned char*)msg_text, textSize);
                break;
        case MSG_ENCODE_AUTO :
-#ifndef FEATURE_SMS_CDMA
-               decodeLen = textCvt->convertUTF8ToAuto(decodeData, bufSize, (const unsigned char*)msg_text, textSize, &langId, &encodeType);
-#else
                decodeLen = textCvt->convertUTF8ToAuto(decodeData, bufSize, (const unsigned char*)msg_text, textSize, &encodeType);
-#endif
                break;
        default :
-               err = MSG_ERR_INVALID_PARAMETER;
-               return err;
-               break;
+               return MSG_ERR_INVALID_PARAMETER;
        }
 
-       // calculate segment size.
+       /* calculate segment size. */
        int headerLen = 0;
        int concat = 5;
        int lang = 3;
@@ -1678,8 +1572,9 @@ EXPORT_API int msg_util_calculate_text_length(const char* msg_text, msg_encode_t
                        headerLen = 1;
                        segSize = ((140 - (headerLen + concat + headerSize)) * 8)/7;
                }
-               else
+               else {
                        segSize = ((140 - headerLen - headerSize) * 8) / 7;
+               }
 
                if (bAbnormal)
                        *msg_encode_type_in = MSG_ENCODE_GSM7BIT_ABNORMAL;
@@ -1689,13 +1584,12 @@ EXPORT_API int msg_util_calculate_text_length(const char* msg_text, msg_encode_t
        } else if (msg_encode_type_to == MSG_ENCODE_UCS2 || encodeType == MSG_ENCODE_UCS2) {
                MSG_DEBUG("MSG_ENCODE_UCS2");
 
-//             if (((decodeLen+headerSize)/140) > 1)
-//                     segSize = 140 - (headerLen + concat + headerSize);
                if (decodeLen > 140) {
                        headerLen = 1;
                        segSize = 140 - (headerLen + concat);
-               } else
+               } else {
                        segSize = 140;
+               }
 
                *msg_encode_type_in = MSG_ENCODE_UCS2;
 
index b386331..cdc03ee 100755 (executable)
 ==================================================================================================*/
 EXPORT_API int msg_submit_req(msg_handle_t handle, msg_struct_t req)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
-       if (handle == NULL ||req == NULL)
-       {
+       if (handle == NULL || req == NULL)
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
        msg_struct_s *pStruct = (msg_struct_s *)req;
+       MSG_TYPE_CHECK(pStruct->type, MSG_STRUCT_REQUEST_INFO);
 
-       try
-       {
+       try {
                err = pHandle->submitReq((MSG_REQUEST_S *)pStruct->data);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_TRANSPORT_ERROR;
        }
@@ -68,30 +62,23 @@ EXPORT_API int msg_submit_req(msg_handle_t handle, msg_struct_t req)
 
 EXPORT_API int msg_reg_sent_status_callback(msg_handle_t handle, msg_sent_status_cb cb, void *user_param)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL || cb == NULL)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->regSentStatusCallback(cb, user_param);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                if (e.errorCode() == MsgException::SERVER_READY_ERROR)
                        return MSG_ERR_PERMISSION_DENIED;
@@ -105,30 +92,23 @@ EXPORT_API int msg_reg_sent_status_callback(msg_handle_t handle, msg_sent_status
 
 EXPORT_API int msg_reg_sms_message_callback(msg_handle_t handle, msg_sms_incoming_cb cb, unsigned short port, void *user_param)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL || cb == NULL)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->regSmsMessageCallback(cb, port, user_param);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                if (e.errorCode() == MsgException::SERVER_READY_ERROR)
                        return MSG_ERR_PERMISSION_DENIED;
@@ -143,34 +123,25 @@ EXPORT_API int msg_reg_sms_message_callback(msg_handle_t handle, msg_sms_incomin
 EXPORT_API int msg_reg_mms_conf_message_callback(msg_handle_t handle, msg_mms_conf_msg_incoming_cb cb, const char *app_id, void *user_param)
 {
        CHECK_MSG_SUPPORTED(MSG_TELEPHONY_MMS_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL || cb == NULL)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        if (app_id && strlen(app_id) > MAX_MMS_JAVA_APPID_LEN)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->regMmsConfMessageCallback(cb, app_id, user_param);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                if (e.errorCode() == MsgException::SERVER_READY_ERROR)
                        return MSG_ERR_PERMISSION_DENIED;
@@ -184,30 +155,23 @@ EXPORT_API int msg_reg_mms_conf_message_callback(msg_handle_t handle, msg_mms_co
 
 EXPORT_API int msg_reg_syncml_message_callback(msg_handle_t handle,  msg_syncml_msg_incoming_cb cb, void *user_param)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL || cb == NULL)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->regSyncMLMessageCallback(cb, user_param);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                if (e.errorCode() == MsgException::SERVER_READY_ERROR)
                        return MSG_ERR_PERMISSION_DENIED;
@@ -221,30 +185,23 @@ EXPORT_API int msg_reg_syncml_message_callback(msg_handle_t handle,  msg_syncml_
 
 EXPORT_API int msg_reg_lbs_message_callback(msg_handle_t handle, msg_lbs_msg_incoming_cb cb, void *user_param)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL || cb == NULL)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->regLBSMessageCallback(cb, user_param);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                if (e.errorCode() == MsgException::SERVER_READY_ERROR)
                        return MSG_ERR_PERMISSION_DENIED;
@@ -258,30 +215,23 @@ EXPORT_API int msg_reg_lbs_message_callback(msg_handle_t handle, msg_lbs_msg_inc
 
 EXPORT_API int msg_reg_syncml_message_operation_callback(msg_handle_t handle,  msg_syncml_msg_operation_cb cb, void *user_param)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL || cb == NULL)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->regSyncMLMessageOperationCallback(cb, user_param);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                if (e.errorCode() == MsgException::SERVER_READY_ERROR)
                        return MSG_ERR_PERMISSION_DENIED;
@@ -295,35 +245,26 @@ EXPORT_API int msg_reg_syncml_message_operation_callback(msg_handle_t handle,  m
 
 EXPORT_API int msg_reg_push_message_callback(msg_handle_t handle,  msg_push_msg_incoming_cb cb, const char *app_id, void *user_param)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL || cb == NULL)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        if (app_id && strlen(app_id) > MAX_WAPPUSH_ID_LEN)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->regPushMessageCallback(cb, app_id, user_param);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                if (e.errorCode() == MsgException::SERVER_READY_ERROR)
                        return MSG_ERR_PERMISSION_DENIED;
@@ -336,30 +277,23 @@ EXPORT_API int msg_reg_push_message_callback(msg_handle_t handle,  msg_push_msg_
 
 EXPORT_API int msg_reg_cb_message_callback(msg_handle_t handle, msg_cb_incoming_cb  cb, bool bsave, void *user_param)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL || cb == NULL)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->regCBMessageCallback(cb, bsave, user_param);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                if (e.errorCode() == MsgException::SERVER_READY_ERROR)
                        return MSG_ERR_PERMISSION_DENIED;
@@ -373,30 +307,23 @@ EXPORT_API int msg_reg_cb_message_callback(msg_handle_t handle, msg_cb_incoming_
 
 EXPORT_API int msg_reg_report_message_callback(msg_handle_t handle, msg_report_msg_incoming_cb cb, void *user_param)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL || cb == NULL)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->regReportMessageCallback(cb, user_param);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                if (e.errorCode() == MsgException::SERVER_READY_ERROR)
                        return MSG_ERR_PERMISSION_DENIED;
@@ -408,32 +335,25 @@ EXPORT_API int msg_reg_report_message_callback(msg_handle_t handle, msg_report_m
 }
 
 
-EXPORT_API int msg_syncml_message_operation(msg_handle_t handle,  msg_message_id_t msgId)
+EXPORT_API int msg_syncml_message_operation(msg_handle_t handle, msg_message_id_t msgId)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_READ_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL || msgId < 1)
-       {
                return MSG_ERR_INVALID_PARAMETER;
-       }
 
        MsgHandle* pHandle = (MsgHandle*)handle;
 
-       try
-       {
+       try {
                err = pHandle->operateSyncMLMessage(msgId);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_TRANSPORT_ERROR;
        }
@@ -447,32 +367,30 @@ static msg_simple_sent_status_cb sentStatusCallback = NULL;
 
 static void sent_status_cb_func(msg_handle_t handle, msg_struct_t sent_status, void *user_param)
 {
-//     MSG_DEBUG("Sent Status [%d]", sent_status->status);
+/*     MSG_DEBUG("Sent Status [%d]", sent_status->status); */
 
        msg_simple_sent_status_cb pfunc = sentStatusCallback;
-// TODO : Fixme
+/*     TODO : Fixme */
        pfunc((msg_struct_t)sent_status, user_param);
 
        MSG_DEBUG("After entering callback function.");
 
-       // Close control handle instance
-       //      msg_close_msg_handle(&msgHandle);
-
-       //      MSG_DEBUG("After msg_close_msg_handle.");
-
+/*     Close control handle instance
+*      msg_close_msg_handle(&msgHandle);
+*
+*      MSG_DEBUG("After msg_close_msg_handle.");
+*/
 }
 
 
 static int msg_send_single_sms(const char *phone_num, const char *sms_text, msg_simple_sent_status_cb cb, void *user_param)
 {
-       if (phone_num == NULL || sms_text == NULL || cb == NULL)
-       {
+       if (phone_num == NULL || sms_text == NULL || cb == NULL) {
                MSG_SEC_DEBUG("Invalid parameter [%s] [%s] [%s]", phone_num, sms_text, cb);
                return MSG_ERR_INVALID_PARAMETER;
        }
 
-       if (strlen(phone_num) > MAX_PHONE_NUMBER_LEN)
-       {
+       if (strlen(phone_num) > MAX_PHONE_NUMBER_LEN) {
                MSG_SEC_DEBUG("Phone Number is too long [%s]", phone_num);
                return MSG_ERR_INVALID_PARAMETER;
        }
@@ -485,14 +403,12 @@ static int msg_send_single_sms(const char *phone_num, const char *sms_text, msg_
 
        msg_error_t retVal = MSG_SUCCESS;
 
-       // Open control handle instance
-       if ((retVal = msg_open_msg_handle(&msgHandle)) != MSG_SUCCESS)
-       {
+       /* Open control handle instance */
+       if ((retVal = msg_open_msg_handle(&msgHandle)) != MSG_SUCCESS) {
                MSG_DEBUG("MsgOpenMsgHandle is failed. Error Code = %d", retVal);
                return retVal;
        }
 
-       //msgReq.msg = msg_new_message();
        MSG_MESSAGE_HIDDEN_S msg_info = {0,};
        msg_struct_s msg = {0,};
 
@@ -557,17 +473,16 @@ static int msg_send_single_sms(const char *phone_num, const char *sms_text, msg_
 
        sentStatusCallback = cb;
 
-       // register sent status callback
+       /* register sent status callback */
        retVal = msg_reg_sent_status_callback(msgHandle, sent_status_cb_func, user_param);
 
-       if (retVal != MSG_SUCCESS)
-       {
+       if (retVal != MSG_SUCCESS) {
                MSG_DEBUG("msg_reg_sent_status_callback() is failed. Error Code = %d", retVal);
                msg_close_msg_handle(&msgHandle);
                return retVal;
        }
 
-       // sending message request
+       /* sending message request */
        msgReq.msg = (msg_struct_t)&msg;
        msgReq.sendOpt = (msg_struct_t)&sendOpt;
 
@@ -578,8 +493,7 @@ static int msg_send_single_sms(const char *phone_num, const char *sms_text, msg_
                addr_list.msg_struct_info = NULL;
        }
 
-       if (retVal != MSG_SUCCESS)
-       {
+       if (retVal != MSG_SUCCESS) {
                MSG_DEBUG("msg_submit_req() is failed. Error Code = %d", retVal);
                msg_close_msg_handle(&msgHandle);
                return retVal;
@@ -590,17 +504,14 @@ static int msg_send_single_sms(const char *phone_num, const char *sms_text, msg_
 
 EXPORT_API int msg_sms_send(const char *phone_num_list, const char *sms_text, msg_simple_sent_status_cb cb, void *user_param)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       //Privilege check
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
-       if (phone_num_list == NULL || sms_text == NULL || cb == NULL)
-       {
+       if (phone_num_list == NULL || sms_text == NULL || cb == NULL) {
                MSG_SEC_DEBUG("Invalid parameter [%s] [%s] [%s]", phone_num_list, sms_text, cb);
                return MSG_ERR_INVALID_PARAMETER;
        }
@@ -611,13 +522,11 @@ EXPORT_API int msg_sms_send(const char *phone_num_list, const char *sms_text, ms
 
        msg_error_t retVal = msg_verify_number(phone_num_list, trimmed_num);
 
-       if ( retVal != MSG_SUCCESS )
+       if (retVal != MSG_SUCCESS)
                return retVal;
 
-       for( char* cur_num = strtok_r(trimmed_num,", ", &temp); cur_num ; cur_num = strtok_r(NULL,", ", &temp))
-       {
-               if (strlen(cur_num) > MAX_PHONE_NUMBER_LEN)
-               {
+       for (char* cur_num = strtok_r(trimmed_num,", ", &temp); cur_num ; cur_num = strtok_r(NULL,", ", &temp)) {
+               if (strlen(cur_num) > MAX_PHONE_NUMBER_LEN) {
                        MSG_SEC_DEBUG("Phone number is too long [%s], and sending is skipped", cur_num);
                        continue;
                }
@@ -636,28 +545,29 @@ EXPORT_API int msg_sms_send(const char *phone_num_list, const char *sms_text, ms
 
 EXPORT_API int msg_sms_send_message(msg_handle_t handle, msg_struct_t req)
 {
-       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE);
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
-       if (handle == NULL || !req) {
+       if (handle == NULL || req == NULL) {
                MSG_FATAL("handle or req is NULL");
-               return MSG_ERR_NULL_POINTER;
+               return MSG_ERR_INVALID_PARAMETER;
        }
 
        msg_struct_s *req_s = (msg_struct_s *)req;
+       MSG_TYPE_CHECK(req_s->type, MSG_STRUCT_REQUEST_INFO);
+
        MSG_REQUEST_S *pReq = (MSG_REQUEST_S *)req_s->data;
 
        pReq->reqId = 1;
 
        msg_struct_s *msg_s = (msg_struct_s *)pReq->msg;
+       MSG_TYPE_CHECK(msg_s->type, MSG_STRUCT_MESSAGE_INFO);
 
        MSG_MESSAGE_HIDDEN_S *reqmsg = (MSG_MESSAGE_HIDDEN_S*)msg_s->data;
 
@@ -667,16 +577,16 @@ EXPORT_API int msg_sms_send_message(msg_handle_t handle, msg_struct_t req)
        }
 
        if (reqmsg->mainType != MSG_SMS_TYPE) {
-               MSG_DEBUG("mainType is not SMS [%d]", reqmsg->mainType);
-               reqmsg->mainType = MSG_SMS_TYPE;
+               MSG_FATAL("mainType is not SMS [%d]", reqmsg->mainType);
+               return MSG_ERR_INVALID_PARAMETER;
        }
 
        if (reqmsg->subType > MSG_CONCAT_SIM_SMS) {
-               MSG_DEBUG("subType is not SMS [%d]", reqmsg->subType);
-               reqmsg->subType = MSG_NORMAL_SMS;
+               MSG_FATAL("subType is not SMS [%d]", reqmsg->subType);
+               return MSG_ERR_INVALID_PARAMETER;
        }
 
-       reqmsg->folderId = MSG_OUTBOX_ID; // outbox fixed
+       reqmsg->folderId = MSG_OUTBOX_ID; /* outbox fixed */
        reqmsg->networkStatus = MSG_NETWORK_SENDING;
 
        MSG_DEBUG("Coding Scheme From App. = [%d]", reqmsg->encodeType);
@@ -695,40 +605,39 @@ EXPORT_API int msg_sms_send_message(msg_handle_t handle, msg_struct_t req)
 EXPORT_API int msg_mms_send_message(msg_handle_t handle, msg_struct_t req)
 {
        CHECK_MSG_SUPPORTED(MSG_TELEPHONY_MMS_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
-       if (handle == NULL || !req)
-       {
+       if (handle == NULL || req == NULL) {
                MSG_FATAL("handle or req is NULL");
                return MSG_ERR_INVALID_PARAMETER;
        }
 
        msg_struct_s *req_s = (msg_struct_s *)req;
+       MSG_TYPE_CHECK(req_s->type, MSG_STRUCT_REQUEST_INFO);
+
        MSG_REQUEST_S *pReq = (MSG_REQUEST_S *)req_s->data;
 
        pReq->reqId = 1;
 
        msg_struct_s *msg_s = (msg_struct_s *)pReq->msg;
+       MSG_TYPE_CHECK(msg_s->type, MSG_STRUCT_MESSAGE_INFO);
 
        MSG_MESSAGE_HIDDEN_S *reqmsg = (MSG_MESSAGE_HIDDEN_S*)msg_s->data;
 
-       if (reqmsg->mmsDataSize <= 0)
-       {
+       if (reqmsg->mmsDataSize <= 0) {
                MSG_FATAL("MMS data size is invalid");
                return MSG_ERR_INVALID_PARAMETER;
        }
 
        reqmsg->mainType = MSG_MMS_TYPE;
        reqmsg->subType = MSG_SENDREQ_MMS;
-       reqmsg->folderId = MSG_OUTBOX_ID; // outbox fixed
+       reqmsg->folderId = MSG_OUTBOX_ID; /* outbox fixed */
        reqmsg->networkStatus = MSG_NETWORK_SENDING;
 
        err = msg_submit_req(handle, req);
@@ -747,16 +656,17 @@ EXPORT_API int msg_mms_send_read_report(msg_handle_t handle, msg_message_id_t ms
        CHECK_MSG_SUPPORTED(MSG_TELEPHONY_MMS_FEATURE);
        msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
        if (handle == NULL)
-       {
+               return MSG_ERR_INVALID_PARAMETER;
+
+       if (mms_read_status < MSG_READ_REPORT_NONE || mms_read_status > MSG_READ_REPORT_REJECT_BY_USER) {
+               MSG_FATAL("unsupported read report status [%d]", mms_read_status);
                return MSG_ERR_INVALID_PARAMETER;
        }
 
@@ -773,7 +683,7 @@ EXPORT_API int msg_mms_send_read_report(msg_handle_t handle, msg_message_id_t ms
 
        read_report_datasize = sizeof(msg_read_report_status_t);
        read_report_data = (void *)calloc(read_report_datasize, 1);
-       if(read_report_data == NULL) {
+       if (read_report_data == NULL) {
                msg_release_struct(&req_t);
                return MSG_ERR_MEMORY_ERROR;
        }
@@ -785,7 +695,7 @@ EXPORT_API int msg_mms_send_read_report(msg_handle_t handle, msg_message_id_t ms
 
        reqmsg->bPortValid = false;
        reqmsg->msgId = msgId;
-       reqmsg->folderId = MSG_OUTBOX_ID; // outbox fixed
+       reqmsg->folderId = MSG_OUTBOX_ID; /* outbox fixed */
        reqmsg->mainType = MSG_MMS_TYPE;
        reqmsg->subType = MSG_READREPLY_MMS;
 
@@ -811,34 +721,33 @@ EXPORT_API int msg_mms_send_read_report(msg_handle_t handle, msg_message_id_t ms
 EXPORT_API int msg_mms_forward_message(msg_handle_t handle, msg_struct_t req)
 {
        CHECK_MSG_SUPPORTED(MSG_TELEPHONY_MMS_FEATURE);
-       msg_error_t err =  MSG_SUCCESS;
+       msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
-       if (handle == NULL || !req )
-       {
+       if (handle == NULL || req == NULL ) {
                MSG_FATAL("handle or req is NULL");
                return MSG_ERR_INVALID_PARAMETER;
        }
 
        msg_struct_s *req_s = (msg_struct_s *)req;
-       MSG_REQUEST_S *pReq = (MSG_REQUEST_S *)req_s->data;
+       MSG_TYPE_CHECK(req_s->type, MSG_STRUCT_REQUEST_INFO);
 
+       MSG_REQUEST_S *pReq = (MSG_REQUEST_S *)req_s->data;
        pReq->reqId = 1;
 
        msg_struct_s *msg_s = (msg_struct_s *)pReq->msg;
+       MSG_TYPE_CHECK(msg_s->type, MSG_STRUCT_MESSAGE_INFO);
 
        MSG_MESSAGE_HIDDEN_S *reqmsg = (MSG_MESSAGE_HIDDEN_S*)msg_s->data;
 
        reqmsg->mainType = MSG_MMS_TYPE;
        reqmsg->subType = MSG_FORWARD_MMS;
-       reqmsg->folderId = MSG_OUTBOX_ID; // outbox fixed
+       reqmsg->folderId = MSG_OUTBOX_ID; /* outbox fixed */
        reqmsg->networkStatus = MSG_NETWORK_SENDING;
 
        err = msg_submit_req(handle, req);
@@ -857,29 +766,30 @@ EXPORT_API int msg_mms_retrieve_message(msg_handle_t handle, msg_struct_t req)
        CHECK_MSG_SUPPORTED(MSG_TELEPHONY_MMS_FEATURE);
        msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
-       if ( handle == NULL|| !req)
-       {
+       if (handle == NULL || req == NULL) {
                MSG_FATAL("handle or req is NULL");
                return MSG_ERR_INVALID_PARAMETER;
        }
 
        msg_struct_s *req_s = (msg_struct_s *)req;
+       MSG_TYPE_CHECK(req_s->type, MSG_STRUCT_REQUEST_INFO);
+
        MSG_REQUEST_S *pReq = (MSG_REQUEST_S *)req_s->data;
 
        msg_struct_s *msg_s = (msg_struct_s *)pReq->msg;
+       MSG_TYPE_CHECK(msg_s->type, MSG_STRUCT_MESSAGE_INFO);
+
        MSG_MESSAGE_HIDDEN_S *reqmsg = (MSG_MESSAGE_HIDDEN_S*)msg_s->data;
 
        reqmsg->mainType = MSG_MMS_TYPE;
        reqmsg->subType = MSG_RETRIEVE_MMS;
-       reqmsg->folderId = MSG_OUTBOX_ID; // outbox fixed
+       reqmsg->folderId = MSG_OUTBOX_ID; /* outbox fixed */
        reqmsg->networkStatus = MSG_NETWORK_RETRIEVING;
 
        err = msg_submit_req(handle, req);
@@ -899,29 +809,30 @@ EXPORT_API int msg_mms_reject_message(msg_handle_t handle, msg_struct_t req)
        CHECK_MSG_SUPPORTED(MSG_TELEPHONY_MMS_FEATURE);
        msg_error_t err = MSG_SUCCESS;
 
-       //Privilege check
+       /* Privilege check */
        int ret = PRIV_MGR_ERROR_SUCCESS;
        ret = privacy_checker_check_by_privilege(MSG_SERVICE_WRITE_PRIV_NAME);
-       if(ret != PRIV_MGR_ERROR_SUCCESS)
-       {
+       if (ret != PRIV_MGR_ERROR_SUCCESS)
                return MSG_ERR_PERMISSION_DENIED;
-       }
 
-       if (handle == NULL || !req )
-       {
+       if (handle == NULL || req == NULL) {
                MSG_FATAL("handle or req is NULL");
                return MSG_ERR_INVALID_PARAMETER;
        }
 
        msg_struct_s *req_s = (msg_struct_s *)req;
+       MSG_TYPE_CHECK(req_s->type, MSG_STRUCT_REQUEST_INFO);
+
        MSG_REQUEST_S *pReq = (MSG_REQUEST_S *)req_s->data;
 
        msg_struct_s *msg_s = (msg_struct_s *)pReq->msg;
+       MSG_TYPE_CHECK(msg_s->type, MSG_STRUCT_MESSAGE_INFO);
+
        MSG_MESSAGE_HIDDEN_S *reqmsg = (MSG_MESSAGE_HIDDEN_S*)msg_s->data;
 
        reqmsg->mainType = MSG_MMS_TYPE;
        reqmsg->subType = MSG_NOTIFYRESPIND_MMS;
-       reqmsg->folderId = MSG_OUTBOX_ID; // outbox fixed
+       reqmsg->folderId = MSG_OUTBOX_ID; /* outbox fixed */
        reqmsg->networkStatus = MSG_NETWORK_SENDING;
 
        err = msg_submit_req(handle, req);
@@ -936,33 +847,37 @@ EXPORT_API int msg_mms_reject_message(msg_handle_t handle, msg_struct_t req)
 /* reject_msg_support */
 
 
-int msg_request_get_int(void *request_info, int field)
+int msg_request_get_int(void *request_info, int field, int *value)
 {
-       int result = -1;
+       if (!request_info)
+               return MSG_ERR_NULL_POINTER;
+
+       int ret = MSG_SUCCESS;
+
        MSG_REQUEST_S *pRequest = (MSG_REQUEST_S *)request_info;
-       switch(field)
-       {
+
+       switch (field) {
        case MSG_REQUEST_REQUESTID_INT:
-               result = pRequest->reqId;
+               *value = pRequest->reqId;
                break;
-
        default:
+               ret = MSG_ERR_INVALID_PARAMETER;
                break;
        }
-       return result;
+
+       return ret;
 }
 
 
 int msg_request_get_struct_handle(msg_struct_s *msg_struct, int field, void **value)
 {
-       msg_error_t err =  MSG_SUCCESS;
+       msg_error_t err = MSG_SUCCESS;
 
-       if(!msg_struct || !value)
+       if (!msg_struct || !value)
                return MSG_ERR_NULL_POINTER;
 
        MSG_REQUEST_S *pRequest = (MSG_REQUEST_S *)msg_struct->data;
-       switch(field)
-       {
+       switch (field) {
        case MSG_REQUEST_MESSAGE_HND:
                *value = (void *)pRequest->msg;
                break;
@@ -974,24 +889,26 @@ int msg_request_get_struct_handle(msg_struct_s *msg_struct, int field, void **va
                break;
 
        }
+
        return err;
 }
 
 int msg_request_set_int(void *request_info, int field, int value)
 {
-       msg_error_t err =  MSG_SUCCESS;
-       if(!request_info)
+       msg_error_t err = MSG_SUCCESS;
+
+       if (!request_info)
                return MSG_ERR_NULL_POINTER;
 
        MSG_REQUEST_S *pRequest = (MSG_REQUEST_S *)request_info;
-       switch(field)
-       {
+
+       switch (field) {
        case MSG_REQUEST_REQUESTID_INT:
                pRequest->reqId = value;
                break;
        default:
                err = MSG_ERR_UNKNOWN;
-       break;
+               break;
        }
 
        return err;
@@ -999,16 +916,16 @@ int msg_request_set_int(void *request_info, int field, int value)
 
 int msg_request_set_struct_handle(msg_struct_s *msg_struct, int field, msg_struct_s *value)
 {
-       msg_error_t err =  MSG_SUCCESS;
-       if(!msg_struct || !value)
+       msg_error_t err = MSG_SUCCESS;
+
+       if (!msg_struct || !value)
                return MSG_ERR_NULL_POINTER;
 
        MSG_REQUEST_S *pRequest = (MSG_REQUEST_S *)msg_struct->data;
        msg_struct_s *pTmp = NULL;
 
 
-       switch(field)
-       {
+       switch (field) {
        case MSG_REQUEST_MESSAGE_HND:
        {
                pTmp = (msg_struct_s *)pRequest->msg;
@@ -1044,24 +961,29 @@ int msg_request_set_struct_handle(msg_struct_s *msg_struct, int field, msg_struc
                err = MSG_ERR_UNKNOWN;
                break;
        }
+
        return err;
 }
 
 
-int msg_sent_status_get_int(MSG_SENT_STATUS_S *sent_status_info, int field)
+int msg_sent_status_get_int(MSG_SENT_STATUS_S *sent_status_info, int field, int *value)
 {
-       int result = -1;
+       if (!sent_status_info)
+               return MSG_ERR_NULL_POINTER;
 
-       switch(field)
-       {
+       int ret = MSG_SUCCESS;
+
+       switch (field) {
        case MSG_SENT_STATUS_REQUESTID_INT:
-               result = sent_status_info->reqId;
+               *value = sent_status_info->reqId;
                break;
        case MSG_SENT_STATUS_NETWORK_STATUS_INT:
-               result = sent_status_info->status;
+               *value = sent_status_info->status;
                break;
        default:
+               ret = MSG_ERR_INVALID_PARAMETER;
                break;
        }
-       return result;
+
+       return ret;
 }
diff --git a/msg-server b/msg-server
deleted file mode 100755 (executable)
index d8f67c9..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-## A script for running msg-server in booting time.
-PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
-#For log
-# Launch msg-server
-/usr/bin/msg-server &
-
index c987f54..7052551 100755 (executable)
@@ -6,5 +6,6 @@
        <assign>
                <filesystem path="/etc/rc.d/init.d/msg-server" label="_" exec_label="none"/>
                <filesystem path="/etc/config/sysinfo-message.xml" label="_"/>
+               <filesystem path="/usr/share/msg-service/msg-service.res" label="_"/>
        </assign>
 </manifest>
index 138d9d6..b401378 100755 (executable)
@@ -5,10 +5,75 @@
                        <label name="msg-service::read"/>
                        <label name="msg-service::write"/>
                </provide>
+
+               <permit>
+                       <smack permit="net-config" type="rw"/>
+                       <smack permit="connman" type="rw"/>
+                       <smack permit="telephony_framework" type="rw"/>
+                       <smack permit="system::use_internet" type="rw"/>
+                       <smack permit="org.tizen.quickpanel" type="rx"/>
+                       <smack permit="org.tizen.indicator" type="rwx"/>
+                       <smack permit="org.tizen.lockscreen" type="rx"/>
+                       <smack permit="media-server" type="rx"/>
+               </permit>
+
+               <request>
+                       <smack request="msg-service::db" type="rw"/>
+                       <smack request="system::use_internet" type="rw"/>
+                       <smack request="media-server" type="rw"/>
+                       <smack request="system::media" type="rx"/>
+                       <smack request="telephony_framework::api_network" type="rw"/>
+                       <smack request="telephony_framework::api_sms" type="rwx"/>
+                       <smack request="telephony_framework::api_sim" type="rw"/>
+                       <smack request="telephony_framework::api_sat" type="x"/>
+                       <smack request="telephony_framework::api_ps_public" type="rw"/>
+                       <smack request="telephony_framework::api_ps_private" type="rw"/>
+                       <smack request="telephony_framework::api_ps_profile" type="rw"/>
+                       <smack request="telephony_framework::properties" type="rw"/>
+                       <smack request="callmgr::api_call" type="rl"/>
+                       <smack request="callmgr::signal" type="rw"/>
+                       <smack request="contacts-service" type="rwx"/>
+                       <smack request="contacts-service::svc" type="rl"/>
+                       <smack request="contacts-service::phonelog" type="rw"/>
+                       <smack request="data-provider-master::notification" type="rw"/>
+                       <smack request="data-provider-master::notification.client" type="w"/>
+                       <smack request="data-provider-master::badge" type="rw"/>
+                       <smack request="data-provider-master::badge.client" type="w"/>
+                       <smack request="deviced::display" type="rw"/>
+                       <smack request="net-config" type="rw"/>
+                       <smack request="connman" type="rw"/>
+                       <smack request="connman::get" type="rw"/>
+                       <smack request="connman::set" type="rw"/>
+                       <smack request="connman::profile" type="rw"/>
+                       <smack request="aul::launch" type="x"/>
+                       <smack request="alarm-server::alarm" type="rw"/>
+                       <smack request="security-server::api-get-gid" type="w"/>
+                       <smack request="security-server::api-cookie-check" type="w"/>
+                       <smack request="security-server::api-privilege-by-pid" type="w"/>
+                       <smack request="device::app_logging" type="rw"/>
+                       <smack request="device::sys_logging" type="rw"/>
+                       <smack request="system::share" type="rwx"/>
+                       <smack request="pkgmgr::db" type="rwl"/>
+                       <smack request="badge::db" type="rwl"/>
+                       <smack request="notification::db" type="rwl"/>
+                       <smack request="org.tizen.setting::default-resources" type="rxl"/>
+
+                       <smack request="tizen::vconf::camcorder" type="rl"/>
+                       <smack request="tizen::vconf::message" type="rw"/>
+                       <smack request="tizen::vconf::public::r" type="rl"/>
+                       <smack request="tizen::vconf::platform::r" type="rl"/>
+                       <smack request="tizen::vconf::platform::rw" type="rw"/>
+                       <smack request="tizen::vconf::public::r::platform::rw" type="rw"/>
+                       <smack request="tizen::vconf::setting::admin" type="rl"/>
+                       <smack request="tizen::vconf::setting" type="rl"/>
+                       <smack request="tizen::vconf::telephony::admin" type="rl"/>
+               </request>
        </define>
+
        <request>
-               <domain name="msg-service"/>
+               <domain name="_"/>
        </request>
+
        <assign>
                <filesystem path="/usr/lib/libmsg_mapi.so.0" label="_"/>
                <filesystem path="/usr/lib/libmsg_mapi.so.0.1.0" label="_"/>
diff --git a/msg-service.res b/msg-service.res
new file mode 100755 (executable)
index 0000000..b4ff56e
--- /dev/null
@@ -0,0 +1,3 @@
+LINK=["/tmp/.msgfw_socket,/tmp/.msgfw_socket"]
+LINK=["/opt/usr/dbspace/.msg_service.db,/opt/usr/dbspace/.msg_service.db"]
+LINK=["/opt/usr/dbspace/.msg_service.db-journal,/opt/usr/dbspace/.msg_service.db-journal"]
diff --git a/msg-service.rule b/msg-service.rule
deleted file mode 100755 (executable)
index c273e71..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-msg-service msg-service::db rw---- ------
-msg-service msg-service::vconf rw---- ------
-msg-service system::use_internet rw---- ------
-msg-service media-server rw---- ------
-msg-service system::vconf rwxat- ------
-msg-service system::vconf_inhouse rw---- ------
-msg-service system::vconf_setting r----- ------
-msg-service telephony_framework::api_sms rwx--- ------
-msg-service telephony_framework::api_sim rw---- ------
-msg-service telephony_framework::api_sat --x--- ------
-msg-service telephony_framework::api_ps_public rw---- ------
-msg-service telephony_framework::api_ps_private rw---- ------
-msg-service telephony_framework::api_ps_profile rw---- ------
-msg-service telephony_framework::properties rw---- ------
-msg-service contacts-service::svc r----- ------
-msg-service contacts-service::phonelog rw---- ------
-msg-service ug-setting-call-efl::vconf r----- ------
-msg-service org.tizen.browser::vconf_public r----- ------
-msg-service testmode::vconf r----- ------
-msg-service data-provider-master::notification rw---- ------
-msg-service data-provider-master::notification.client -w---- ------
-msg-service data-provider-master::badge rw---- ------
-msg-service data-provider-master::badge.client -w---- ------
-msg-service oma-dm-agent::vconf_external r----- ------
-msg-service deviced::display rw---- ------
-msg-service net-config rw---- ------
-msg-service connman rw---- ------
-msg-service connman::get rw---- ------
-msg-service connman::set rw---- ------
-msg-service connman::profile rw---- ------
-msg-service aul::launch --x--- ------
-msg-service alarm-server::alarm rw---- ------
-msg-service security-server::api-get-gid -w---- ------
-msg-service security-server::api-cookie-check -w---- ------
-msg-service security-server::api-privilege-by-pid -w---- ------
-msg-service device::app_logging -w---- ------
-msg-service device::sys_logging -w---- ------
-msg-service system::share -wx--- ------
-msg-service system::vconf_system r----l ------
-msg-service pkgmgr::db r----l ------
-msg-service ail::db r----- ------
-msg-service badge::db r----l ------
-msg-service notification::db r----l ------
-msg-service org.tizen.setting::default-resources r----l ------
-
-net-config msg-service rw---- ------
-connman msg-service rw---- ------
-system::use_internet msg-service rw---- ------
-org.tizen.quickpanel msg-service r-x--- ------
-org.tizen.indicator msg-service rwx--- ------
-org.tizen.lockscreen msg-service r-x--- ------
index 458cbf6..9ea252a 100755 (executable)
@@ -1,11 +1,13 @@
 [Unit]
 Description=Message server
-After=tizen-runtime.target contacts-service.service
-Requires=tizen-runtime.target contacts-service.service
+After=contacts-service.service
 
 [Service]
-Type=forking
-ExecStart=/etc/rc.d/init.d/msg-server
+User=system
+Group=system
+SmackProcessLabel=msg-service
+Type=simple
+ExecStart=/usr/bin/msg-server
 Restart=always
 MemoryLimit=10M
 
diff --git a/packaging/msg-server.socket b/packaging/msg-server.socket
new file mode 100644 (file)
index 0000000..be9fa6d
--- /dev/null
@@ -0,0 +1,10 @@
+[Socket]
+SocketUser=system
+SocketGroup=system
+ListenStream=/tmp/.msgfw_socket
+SmackLabelIPIn=msg-service
+SmackLabelIPOut=msg-service
+Service=msg-server.service
+
+[Install]
+WantedBy=sockets.target
\ No newline at end of file
index ba533a4..e872a86 100755 (executable)
@@ -1,13 +1,18 @@
 Name:           msg-service
-Version:        1.0.0
+Version:        1.0.2
 Release:        1
 License:        Apache-2.0
 Summary:        Messaging Framework Library
 Group:          System/Libraries
 Source0:        %{name}-%{version}.tar.gz
+Source1:        msg-server.service
+Source2:        msg-server.socket
+
+%if "%{?tizen_profile_name}" == "tv"
+ExcludeArch: %{arm} %ix86 x86_64
+%endif
 
 Requires(post): /usr/bin/sqlite3
-Requires(post): /usr/bin/vconftool
 Requires(post): /sbin/ldconfig
 Requires(postun): /sbin/ldconfig
 Requires(post): systemd
@@ -16,6 +21,7 @@ BuildRequires: cmake
 BuildRequires: pkgconfig(alarm-service)
 BuildRequires: pkgconfig(aul)
 BuildRequires: pkgconfig(badge)
+BuildRequires: pkgconfig(bundle)
 BuildRequires: pkgconfig(capi-appfw-application)
 BuildRequires: pkgconfig(capi-network-connection)
 BuildRequires: pkgconfig(capi-system-info)
@@ -25,6 +31,7 @@ BuildRequires: pkgconfig(csr-framework)
 BuildRequires: pkgconfig(db-util)
 BuildRequires: pkgconfig(deviced)
 BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(eventsystem)
 BuildRequires: pkgconfig(feedback)
 BuildRequires: pkgconfig(gio-2.0)
 BuildRequires: pkgconfig(gobject-2.0)
@@ -35,7 +42,8 @@ BuildRequires: pkgconfig(libcurl)
 BuildRequires: pkgconfig(libsystemd-daemon)
 BuildRequires: pkgconfig(libxml-2.0)
 BuildRequires: pkgconfig(libwbxml2)
-BuildRequires: pkgconfig(media-thumbnail)
+BuildRequires: pkgconfig(capi-media-thumbnail-util)
+BuildRequires: pkgconfig(capi-media-image-util)
 BuildRequires: pkgconfig(mm-fileinfo)
 BuildRequires: pkgconfig(mm-player)
 BuildRequires: pkgconfig(mm-session)
@@ -49,6 +57,7 @@ BuildRequires: pkgconfig(sensor)
 BuildRequires: pkgconfig(storage)
 BuildRequires: pkgconfig(tapi)
 BuildRequires: pkgconfig(vconf)
+BuildRequires: pkgconfig(vasum)
 
 %description
 Description: Messaging Framework Library
@@ -70,7 +79,6 @@ Summary:        Messaging server application
 Requires:       %{name} = %{version}-%{release}
 Group:          TO_BU / FILL_IN
 Requires(post): /usr/bin/sqlite3
-Requires(post): /usr/bin/vconftool
 Requires(post): /sbin/ldconfig
 Requires(postun): /sbin/ldconfig
 
@@ -104,12 +112,19 @@ Description: MMS plugin library
 %setup -q
 
 %build
-
 cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} \
 %ifarch i586
--D_TIZEN_I586_ENABLED:BOOL=ON
+-D_TIZEN_I586_ENABLED:BOOL=ON \
 %else
--D_TIZEN_I586_ENABLED:BOOL=OFF
+-D_TIZEN_I586_ENABLED:BOOL=OFF \
+%endif
+%if "%{?tizen_profile_name}" == "wearable"
+-D_MSG_WEARABLE_PROFILE:BOOL=ON \
+%else
+-D_MSG_WEARABLE_PROFILE:BOOL=OFF \
+%endif
+%if 0%{?sec_product_feature_container_enable} == 1
+-D_FEATURE_CONTAINER_ENABLE:BOOL=ON
 %endif
 
 make %{?jobs:-j%jobs}
@@ -122,8 +137,13 @@ mkdir -p %{buildroot}/etc/config
 %make_install
 
 mkdir -p %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants
+install -m 0644 %SOURCE1 %{buildroot}%{_libdir}/systemd/system/msg-server.service
 ln -s ../msg-server.service %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants/msg-server.service
 
+mkdir -p %{buildroot}%{_libdir}/systemd/system/sockets.target.wants
+install -m 0644 %SOURCE2 %{buildroot}%{_libdir}/systemd/system/msg-server.socket
+ln -s ../msg-server.socket %{buildroot}%{_libdir}/systemd/system/sockets.target.wants/msg-server.socket
+
 mkdir -p %{buildroot}/opt/usr/dbspace
 sqlite3 %{buildroot}/opt/usr/dbspace/.msg_service.db "PRAGMA journal_mode = PERSIST;"
 sqlite3 %{buildroot}/opt/usr/dbspace/.msg_service.db < %{buildroot}/usr/share/msg-service/msg-service-db.sql
@@ -133,203 +153,45 @@ rm %{buildroot}/usr/share/msg-service/msg-service-db.sql
 %post tools
 /sbin/ldconfig
 
-chown :5000 /opt/usr/dbspace/.msg_service.db
-chown :5000 /opt/usr/dbspace/.msg_service.db-journal
+chown 200:5000 /opt/usr/dbspace/.msg_service.db
+chown 200:5000 /opt/usr/dbspace/.msg_service.db-journal
+chown 200:200 %{_libdir}/systemd/system/msg-server.socket
+
 chmod 660 /opt/usr/dbspace/.msg_service.db
 chmod 660 /opt/usr/dbspace/.msg_service.db-journal
 
+mkdir -p -m 775 /opt/usr/data/msg-service
+mkdir -p -m 775 /opt/usr/data/msg-service/msgdata
+mkdir -p -m 775 /opt/usr/data/msg-service/smildata
+mkdir -p -m 775 /opt/usr/data/msg-service/ipcdata
+mkdir -p -m 775 /opt/usr/data/msg-service/msgdata/thumbnails
+
+chown 200:5000 /opt/usr/data/msg-service
+chown 200:5000 /opt/usr/data/msg-service/msgdata
+chown 200:5000 /opt/usr/data/msg-service/smildata
+chown 200:5000 /opt/usr/data/msg-service/ipcdata
+chown 200:5000 /opt/usr/data/msg-service/msgdata/thumbnails
+
 if [ -f /usr/lib/rpm-plugins/msm.so ]
 then
        chsmack -a 'msg-service::db' /opt/usr/dbspace/.msg_service.db*
+       chsmack -a 'msg-service' /opt/usr/data/msg-service/msgdata
+       chsmack -a 'msg-service' /opt/usr/data/msg-service/smildata
+       chsmack -a 'msg-service' /opt/usr/data/msg-service/ipcdata
+       chsmack -a 'msg-service' /opt/usr/data/msg-service/msgdata/thumbnails
 fi
 
+%if 0%{?sec_product_feature_container_enable}
+       mkdir -p /etc/vasum/vsmzone.resource/
+       mv /usr/share/msg-service/msg-service.res /etc/vasum/vsmzone.resource/
+%endif
+
 %post -n sms-plugin -p /sbin/ldconfig
 %post -n mms-plugin -p /sbin/ldconfig
 
 %post
 /sbin/ldconfig
 
-mkdir -p /opt/usr/data/msg-service
-chgrp db_msg_service /opt/usr/data/msg-service
-
-if [ -f /usr/lib/rpm-plugins/msm.so ]
-then
-       chsmack -a "_" -e "_" /etc/rc.d/init.d/msg-server
-fi
-
-########## Setting Config Value (Internal keys) ##########
-# Message Server Status
-vconftool set -t bool memory/msg/ready 0 -i -g 5000 -s system::vconf_inhouse
-
-# SMS Send Options
-vconftool set -t int db/msg/network_mode 2 -g 5000 -s system::vconf_inhouse
-
-# New Message Count
-vconftool set -t int db/msg/recv_sms 0 -g 5000 -s system::vconf_inhouse
-vconftool set -t int db/msg/recv_mms 0 -g 5000 -s system::vconf_inhouse
-
-########## Setting Config Value (Private keys) ##########
-# General Options
-vconftool set -t bool db/private/msg-service/general/keep_copy 1 -s msg-service::vconf -g 5000
-vconftool set -t bool db/private/msg-service/general/auto_erase 0 -s msg-service::vconf -g 5000
-vconftool set -t bool db/private/msg-service/general/block_msg 1 -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/general/contact_sync_time 0 -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/general/alert_rep_type 0 -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/general/search_tags 31 -s msg-service::vconf -g 5000
-
-vconftool set -t int db/private/msg-service/general/page_limit 0 -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/general/sms_mms_threshold 0 -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/general/max_recipient 0 -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/general/sms_storage 0 -s msg-service::vconf -g 5000
-
-vconftool set -t bool db/private/msg-service/general/block_unknown_msg 0 -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/general/sms_limit 1000 -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/general/mms_limit 100 -s msg-service::vconf -g 5000
-vconftool set -t bool db/private/msg-service/general/notification 1 -s msg-service::vconf -g 5000
-vconftool set -t bool db/private/msg-service/general/vibration 1 -s msg-service::vconf -g 5000
-vconftool set -t bool db/private/msg-service/general/preview 1 -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/general/ringtone_type 0 -s msg-service::vconf -g 5000
-vconftool set -t string db/private/msg-service/general/ringtone_path "" -s msg-service::vconf -g 5000
-
-vconftool set -t string db/private/msg-service/general/ua_profile "" -s msg-service::vconf -g 5000
-
-vconftool set -t int db/private/msg-service/general/msg_id_counter 0 -s msg-service::vconf -g 5000
-
-# SMS Send Options
-vconftool set -t int db/private/msg-service/sms_send/dcs 3 -s msg-service::vconf -g 5000
-vconftool set -t bool db/private/msg-service/sms_send/reply_path 0 -s msg-service::vconf -g 5000
-vconftool set -t bool db/private/msg-service/sms_send/delivery_report 0 -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/sms_send/save_storage 1 -s msg-service::vconf -g 5000
-
-# MMS Send Options
-vconftool set -t int db/private/msg-service/mms_send/msg_class 0 -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/mms_send/priority 1 -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/mms_send/expiry_time 0 -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/mms_send/custom_delivery 0 -s msg-service::vconf -g 5000
-vconftool set -t bool db/private/msg-service/mms_send/sender_visibility 0 -s msg-service::vconf -g 5000
-vconftool set -t bool db/private/msg-service/mms_send/delivery_report 0 -s msg-service::vconf -g 5000
-vconftool set -t bool db/private/msg-service/mms_send/read_reply 0 -s msg-service::vconf -g 5000
-vconftool set -t bool db/private/msg-service/mms_send/keep_copy 0 -s msg-service::vconf -g 5000
-vconftool set -t bool db/private/msg-service/mms_send/body_replying 0 -s msg-service::vconf -g 5000
-vconftool set -t bool db/private/msg-service/mms_send/hide_recipients 0 -s msg-service::vconf -g 5000
-vconftool set -t bool db/private/msg-service/mms_send/report_allowed 1 -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/mms_send/reply_charging 0 -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/mms_send/reply_charging_deadline 0 -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/mms_send/reply_charging_size 0 -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/mms_send/delivery_time 0 -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/mms_send/creation_mode 2 -s msg-service::vconf -g 5000
-
-# MMS Receive Options
-vconftool set -t int db/private/msg-service/mms_recv/home_network 0 -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/mms_recv/abroad_network 1 -s msg-service::vconf -g 5000
-vconftool set -t bool db/private/msg-service/mms_recv/read_receipt 1 -s msg-service::vconf -g 5000
-vconftool set -t bool db/private/msg-service/mms_recv/delivery_receipt 1 -s msg-service::vconf -g 5000
-vconftool set -t bool db/private/msg-service/mms_recv/reject_unknown 0 -s msg-service::vconf -g 5000
-vconftool set -t bool db/private/msg-service/mms_recv/reject_advertisement 0 -s msg-service::vconf -g 5000
-
-# MMS Style Options
-vconftool set -t int db/private/msg-service/mms_style/font_size 30 -s msg-service::vconf -g 5000
-vconftool set -t bool db/private/msg-service/mms_style/font_style/bold 0 -s msg-service::vconf -g 5000
-vconftool set -t bool db/private/msg-service/mms_style/font_style/italic 0 -s msg-service::vconf -g 5000
-vconftool set -t bool db/private/msg-service/mms_style/font_style/underline 0 -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/mms_style/font_color/red 255 -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/mms_style/font_color/green 255 -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/mms_style/font_color/blue 255 -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/mms_style/font_color/hue 255 -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/mms_style/bg_color/red 0 -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/mms_style/bg_color/green 0 -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/mms_style/bg_color/blue 0 -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/mms_style/bg_color/hue 255 -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/mms_style/page_dur 2 -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/mms_style/page_custom_dur 0 -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/mms_style/page_dur_manual 0 -s msg-service::vconf -g 5000
-
-# Push Msg Options
-vconftool set -t bool db/private/msg-service/push_msg/recv_option 1 -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/push_msg/service_load 1 -s msg-service::vconf -g 5000
-
-# CB Msg Options
-vconftool set -t bool db/private/msg-service/cb_msg/receive 0 -f -s msg-service::vconf -g 5000
-vconftool set -t bool db/private/msg-service/cb_msg/save 0 -f -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/cb_msg/max_sim_count/1 0 -f -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/cb_msg/max_sim_count/2 0 -f -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/cb_msg/max_sim_count/3 0 -f -s msg-service::vconf -g 5000
-vconftool set -t bool db/private/msg-service/cb_msg/language/0 1 -f -s msg-service::vconf -g 5000
-vconftool set -t bool db/private/msg-service/cb_msg/language/1 0 -s msg-service::vconf -g 5000
-vconftool set -t bool db/private/msg-service/cb_msg/language/2 0 -s msg-service::vconf -g 5000
-vconftool set -t bool db/private/msg-service/cb_msg/language/3 0 -s msg-service::vconf -g 5000
-vconftool set -t bool db/private/msg-service/cb_msg/language/4 0 -s msg-service::vconf -g 5000
-vconftool set -t bool db/private/msg-service/cb_msg/language/5 0 -s msg-service::vconf -g 5000
-vconftool set -t bool db/private/msg-service/cb_msg/language/6 0 -s msg-service::vconf -g 5000
-vconftool set -t bool db/private/msg-service/cb_msg/language/7 0 -s msg-service::vconf -g 5000
-vconftool set -t bool db/private/msg-service/cb_msg/language/8 0 -s msg-service::vconf -g 5000
-vconftool set -t bool db/private/msg-service/cb_msg/language/9 0 -s msg-service::vconf -g 5000
-
-# Voice Mail Options
-vconftool set -t string db/private/msg-service/voice_mail/voice_mail_number/1 "" -f -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/voice_mail/voice_mail_count/1 0 -f -s msg-service::vconf -g 5000
-vconftool set -t string db/private/msg-service/voice_mail/voice_mail_alphaid/1 "" -f -s msg-service::vconf -g 5000
-
-vconftool set -t string db/private/msg-service/voice_mail/voice_mail_number/2 "" -f -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/voice_mail/voice_mail_count/2 0 -f -s msg-service::vconf -g 5000
-vconftool set -t string db/private/msg-service/voice_mail/voice_mail_alphaid/2 "" -f -s msg-service::vconf -g 5000
-
-vconftool set -t string db/private/msg-service/voice_mail/voice_mail_number/3 "" -f -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/voice_mail/voice_mail_count/3 0 -f -s msg-service::vconf -g 5000
-vconftool set -t string db/private/msg-service/voice_mail/voice_mail_alphaid/3 "" -f -s msg-service::vconf -g 5000
-
-# MMS Size Options
-vconftool set -t int db/private/msg-service/size_opt/msg_size 300 -s msg-service::vconf -g 5000
-
-# SIM message count
-vconftool set -t int db/private/msg-service/sim_count/used_cnt/1 0 -f -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/sim_count/total_cnt/1 0 -f -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/sim_count/used_cnt/2 0 -f -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/sim_count/total_cnt/2 0 -f -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/sim_count/used_cnt/3 0 -f -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/sim_count/total_cnt/3 0 -f -s msg-service::vconf -g 5000
-
-# SIM information
-vconftool set -t int memory/private/msg-service/sim_changed/1 0 -i -f -s msg-service::vconf -g 5000
-vconftool set -t string memory/private/msg-service/sim_imsi/1 "" -i -f -s msg-service::vconf -g 5000
-vconftool set -t bool memory/private/msg-service/national_sim/1 0 -i -f -s msg-service::vconf -g 5000
-vconftool set -t string memory/private/msg-service/msisdn/1 "" -i -f -s msg-service::vconf -g 5000
-vconftool set -t string memory/private/msg-service/iccid/1 "" -i -f -s msg-service::vconf -g 5000
-
-vconftool set -t int memory/private/msg-service/sim_changed/2 0 -i -f -s msg-service::vconf -g 5000
-vconftool set -t string memory/private/msg-service/sim_imsi/2 "" -i -f -s msg-service::vconf -g 5000
-vconftool set -t bool memory/private/msg-service/national_sim/2 0 -i -f -s msg-service::vconf -g 5000
-vconftool set -t string memory/private/msg-service/msisdn/2 "" -i -f -s msg-service::vconf -g 5000
-vconftool set -t string memory/private/msg-service/iccid/2 "" -i -f -s msg-service::vconf -g 5000
-
-vconftool set -t int memory/private/msg-service/sim_changed/3 0 -i -f -s msg-service::vconf -g 5000
-vconftool set -t string memory/private/msg-service/sim_imsi/3 "" -i -f -s msg-service::vconf -g 5000
-vconftool set -t bool memory/private/msg-service/national_sim/3 0 -i -f -s msg-service::vconf -g 5000
-vconftool set -t string memory/private/msg-service/msisdn/3 "" -i -f -s msg-service::vconf -g 5000
-vconftool set -t string memory/private/msg-service/iccid/3 "" -i -f -s msg-service::vconf -g 5000
-vconftool set -t int  memory/private/msg-service/default_network_sim 0 -i -f -s msg-service::vconf -g 5000
-
-# SST information
-vconftool set -t bool memory/private/msg-service/sim_st/1 1 -i -f -s msg-service::vconf -g 5000
-vconftool set -t bool memory/private/msg-service/sim_mo_ctrl/1 0 -i -f -s msg-service::vconf -g 5000
-
-vconftool set -t bool memory/private/msg-service/sim_st/2 1 -i -f -s msg-service::vconf -g 5000
-vconftool set -t bool memory/private/msg-service/sim_mo_ctrl/2 0 -i -f -s msg-service::vconf -g 5000
-
-vconftool set -t bool memory/private/msg-service/sim_st/3 1 -i -f -s msg-service::vconf -g 5000
-vconftool set -t bool memory/private/msg-service/sim_mo_ctrl/3 0 -i -f -s msg-service::vconf -g 5000
-
-# Notification
-vconftool set -t int db/private/msg-service/notification_priv_id 0 -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/voice_noti_id1 0 -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/voice_noti_id2 0 -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/cb_noti_priv_id 0 -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/sim_msg_noti_priv_id 0 -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/emergency_noti_id 0 -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/sentfail_noti_id 0 -s msg-service::vconf -g 5000
-vconftool set -t int db/private/msg-service/sim_full_noti_id 0 -s msg-service::vconf -g 5000
-
-
 %postun -p /sbin/ldconfig
 
 %postun tools -p /sbin/ldconfig
@@ -338,7 +200,7 @@ vconftool set -t int db/private/msg-service/sim_full_noti_id 0 -s msg-service::v
 
 %files
 %manifest msg-service.manifest
-%defattr(-,root,root,-)
+%defattr(-,system,system,-)
 %{_libdir}/libmsg_plugin_manager.so
 %{_libdir}/libmsg_mapi.so.*
 %{_libdir}/libmsg_framework_handler.so
@@ -350,32 +212,36 @@ vconftool set -t int db/private/msg-service/sim_full_noti_id 0 -s msg-service::v
 /usr/share/license/msg-service/LICENSE.APLv2
 
 %files devel
-%defattr(-,root,root,-)
+%defattr(-,system,system,-)
 %{_libdir}/libmsg_mapi.so
 %{_libdir}/pkgconfig/msg-service.pc
 %{_includedir}/msg-service/*
 
 %files tools
 %manifest msg-service-tools.manifest
-%defattr(-,root,root,-)
-%{_bindir}/msg-server
+%defattr(-,system,system,-)
+%caps(cap_chown,cap_dac_override,cap_lease,cap_net_admin,cap_net_raw=eip) %{_bindir}/msg-server
 %config(noreplace) /opt/usr/dbspace/.msg_service.db*
-%{_sysconfdir}/rc.d/init.d/msg-server
 %{_libdir}/systemd/system/msg-server.service
 %{_libdir}/systemd/system/multi-user.target.wants/msg-server.service
+%{_libdir}/systemd/system/sockets.target.wants/msg-server.socket
+%{_libdir}/systemd/system/msg-server.socket
 /usr/share/license/msg-service/LICENSE.APLv2
-/etc/smack/accesses.d/msg-service.rule
 /etc/config/*
 
+%if 0%{?sec_product_feature_container_enable}
+%attr(0644,system,system)/usr/share/msg-service/msg-service.res
+%endif
+
 %files -n sms-plugin
 %manifest sms-plugin.manifest
-%defattr(-,root,root,-)
+%defattr(-,system,system,-)
 %{_libdir}/libmsg_sms_plugin.so
 /usr/share/license/msg-service/LICENSE.APLv2
 
 %files -n mms-plugin
 %manifest mms-plugin.manifest
-%defattr(-,root,root,-)
+%defattr(-,system,system,-)
 %{_libdir}/libmsg_mms_plugin.so
 /usr/share/license/msg-service/LICENSE.APLv2
 
index b0e1341..c474337 100755 (executable)
@@ -8,7 +8,6 @@ IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
 ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
 MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")
 
-
 ##########################################################
 # Define MMS Plugin
 ##########################################################
@@ -45,7 +44,7 @@ INCLUDE_DIRECTORIES(
 )
 
 INCLUDE(FindPkgConfig)
-pkg_check_modules(mms_plugin_pkgs REQUIRED glib-2.0 libcurl mm-fileinfo mmutil-imgp mmutil-jpeg vconf dlog media-thumbnail csr-framework capi-network-connection db-util)
+pkg_check_modules(mms_plugin_pkgs REQUIRED glib-2.0 libcurl mm-fileinfo mmutil-imgp mmutil-jpeg vconf dlog capi-media-thumbnail-util capi-media-image-util csr-framework capi-network-connection db-util)
 
 FOREACH(flag ${mms_plugin_pkgs_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
index c30d61a..9ca3d08 100755 (executable)
@@ -72,7 +72,7 @@ void MmsPluginAppBase::getFirstPageTextFilePath(char *textBuf, int textBufSize)
        if (pMmsMsgData == NULL)
                return;
 
-       // Get the text data from the 1st slide.
+       /* Get the text data from the 1st slide. */
        if (pMmsMsgData->pageCnt > 0) {
 
                pPage = _MsgMmsGetPage(pMmsMsgData, 0);
@@ -93,7 +93,7 @@ void MmsPluginAppBase::getFirstPageTextFilePath(char *textBuf, int textBufSize)
                                                MSG_DEBUG("Media Type is Text, but Vobject file [%s]", pMedia->szFilePath);
                                        } else {
                                                MSG_DEBUG("Text path : [%s]", pMedia->szFilePath);
-                                               snprintf(textBuf, textBufSize, "%s", pMedia->szFilePath);//Set Text Filepath of First Pages
+                                               snprintf(textBuf, textBufSize, "%s", pMedia->szFilePath); /* Set Text Filepath of First Pages */
                                        }
                                        break;
                                }
@@ -104,8 +104,7 @@ void MmsPluginAppBase::getFirstPageTextFilePath(char *textBuf, int textBufSize)
        return;
 }
 
-
-//FIXME::need to move AppBase
+/* FIXME::need to move AppBase */
 msg_error_t MmsMakePreviewInfo(int msgId, MMS_MESSAGE_DATA_S *pMmsMsg, bool allow_malware, const char *raw_filepath)
 {
        MMS_PAGE_S *pPage = NULL;
@@ -118,9 +117,9 @@ msg_error_t MmsMakePreviewInfo(int msgId, MMS_MESSAGE_DATA_S *pMmsMsg, bool allo
        if (pMmsMsg == NULL)
                return MSG_ERR_NULL_POINTER;
 
-       MmsPluginStorage::instance()->removePreviewInfo(msgId); //remove exist previnfo
+       MmsPluginStorage::instance()->removePreviewInfo(msgId); /* remove exist previnfo */
 
-       //scan malware in raw file
+       /* scan malware in raw file */
        if (raw_filepath && strlen(raw_filepath) > 0 && MsgAccessFile(raw_filepath, F_OK) == true) {
                int tcs_ret = MmsPluginTcsScanFile(raw_filepath, &bc_level);
                if (tcs_ret == 0) {
@@ -131,14 +130,14 @@ msg_error_t MmsMakePreviewInfo(int msgId, MMS_MESSAGE_DATA_S *pMmsMsg, bool allo
                }
        }
 
-       //check ref type and increase attach count
+       /* check ref type and increase attach count */
        if (pMmsMsg->pageCnt > 0) {
                for (int i = 0; i < pMmsMsg->pageCnt; i++) {
                        pPage = _MsgMmsGetPage(pMmsMsg, i);
                        if (pPage) {
                                for (int j = 0; j < pPage->mediaCnt; j++) {
                                        pMedia = _MsgMmsGetMedia(pPage, j);
-                                       if (pMedia) { //IF Vobject type add to Attach in Preview data
+                                       if (pMedia) { /* IF Vobject type add to Attach in Preview data */
 
                                                MimeType mimeType = MIME_UNKNOWN;
                                                MmsGetMimeTypeFromFileName(MIME_MAINTYPE_UNKNOWN, pMedia->szFilePath, &mimeType, NULL);
@@ -152,14 +151,12 @@ msg_error_t MmsMakePreviewInfo(int msgId, MMS_MESSAGE_DATA_S *pMmsMsg, bool allo
                                                                attachment_name = pMedia->szFileName;
                                                        }
                                                }
-
                                        }
                                }
                        }
                }
        }
 
-
        if (pMmsMsg->pageCnt > 0) {
 
                MmsPluginStorage::instance()->insertPreviewInfo(msgId, MSG_MMS_ITEM_TYPE_PAGE, (char *)"pagecount", pMmsMsg->pageCnt);
@@ -184,7 +181,7 @@ msg_error_t MmsMakePreviewInfo(int msgId, MMS_MESSAGE_DATA_S *pMmsMsg, bool allo
                                        }
                                } else {
 
-                                       if (j == 0) { //First Page, First Media
+                                       if (j == 0) { /* First Page, First Media */
                                                MmsPluginStorage::instance()->insertPreviewInfo(msgId, MSG_MMS_ITEM_TYPE_1ST_MEDIA, pMedia->szFilePath);
                                        }
 
@@ -223,18 +220,17 @@ msg_error_t MmsMakePreviewInfo(int msgId, MMS_MESSAGE_DATA_S *pMmsMsg, bool allo
                                        }
                                }
                        }
-               } // end for
+               } /* end for */
        } else {
                MSG_DEBUG("There is no page");
        }
 
        int attachCnt = _MsgMmsGetAttachCount(pMmsMsg);
        if (attachCnt > 0) {
-
                MMS_ATTACH_S *pAttach = _MsgMmsGetAttachment(pMmsMsg, 0);
 
                MmsPluginStorage::instance()->insertPreviewInfo(msgId, MSG_MMS_ITEM_TYPE_ATTACH, pAttach->szFileName, attachCnt);
-               MmsPluginStorage::instance()->updateMmsAttachCount(msgId, attachCnt); // for Get Message
+               MmsPluginStorage::instance()->updateMmsAttachCount(msgId, attachCnt); /* for Get Message */
 
                if (attachment_name == NULL) {
                        attachment_name = pAttach->szFileName;
@@ -245,7 +241,6 @@ msg_error_t MmsMakePreviewInfo(int msgId, MMS_MESSAGE_DATA_S *pMmsMsg, bool allo
        }
 
        if (attachCnt + ref_attach_count > 0 && attachment_name) {
-
                MmsPluginStorage::instance()->insertPreviewInfo(msgId, MSG_MMS_ITEM_TYPE_ATTACH, attachment_name, attachCnt + ref_attach_count);
                MmsPluginStorage::instance()->updateMmsAttachCount(msgId, attachCnt + ref_attach_count);
        }
index c8078d2..38f5b2e 100755 (executable)
@@ -33,13 +33,12 @@ typedef struct {
 } MmsField;
 
 /* Reference : MMS-209-Encapsulation & WAP-203-WSP-20000504.pdf Table 39 */
-const MmsField gMmsField[MMS_MAX_FIELD_TYPE_COUNT][MMS_MAX_FIELD_VALUE_COUNT] =
-{
+const MmsField gMmsField[MMS_MAX_FIELD_TYPE_COUNT][MMS_MAX_FIELD_VALUE_COUNT] = {
        /* MMS Specific (MsgMmsMsg.h / MsgMmsUA.h) -----------------------*/
 
        /* MmsCodeFieldCode */
        {
-               {"Bcc", 0x01},                                                          //0
+               {"Bcc", 0x01},                                                          /* 0 */
                {"Cc", 0x02},
                {"X-Mms-Content-Location", 0x03},
                {"Content-Type", 0x04},
@@ -49,7 +48,7 @@ const MmsField gMmsField[MMS_MAX_FIELD_TYPE_COUNT][MMS_MAX_FIELD_VALUE_COUNT] =
                {"X-Mms-Expiry", 0x08},
                {"From", 0x09},
                {"X-Mms-Message-Class", 0x0A},
-               {"Message-ID", 0x0B},                                           // 10
+               {"Message-ID", 0x0B},                                           /* 10 */
                {"X-Mms-Message-Type", 0x0C},
                {"X-Mms-MMS-Version", 0x0D},
                {"X-Mms-Message-Size", 0x0E},
@@ -59,7 +58,7 @@ const MmsField gMmsField[MMS_MAX_FIELD_TYPE_COUNT][MMS_MAX_FIELD_VALUE_COUNT] =
                {"X-Mms-Response-Status", 0x12},
                {"X-Mms-Retrieve-Status", 0x19},                        /* Add by MMSENC v1.1 */
                {"X-Mms-Response-Text", 0x13},
-               {"X-Mms-Retrieve-Text", 0x1A},                          // 20   /* Add by MMSENC v1.1 */
+               {"X-Mms-Retrieve-Text", 0x1A},                          /* 20 */ /* Add by MMSENC v1.1 */
                {"X-Mms-Sender-Visibility", 0x14},
                {"X-Mms-Status", 0x15},
                {"Subject", 0x16},
@@ -69,7 +68,7 @@ const MmsField gMmsField[MMS_MAX_FIELD_TYPE_COUNT][MMS_MAX_FIELD_VALUE_COUNT] =
                /* Add by MMSENC v1.1 */
                {"X-Mms-Read-Status", 0x1B},
                {"X-Mms-Reply-Charging", 0x1C},
-               {"X-Mms-Reply-Charging-Deadline", 0x1D},        // 30
+               {"X-Mms-Reply-Charging-Deadline", 0x1D},        /* 30 */
                {"X-Mms-Reply-Charging-ID", 0x1E},
                {"X-Mms-Reply-Charging-Size", 0x1F},
                {"X-Mms-Previously-Sent-By", 0x20},
@@ -78,14 +77,14 @@ const MmsField gMmsField[MMS_MAX_FIELD_TYPE_COUNT][MMS_MAX_FIELD_VALUE_COUNT] =
 
        /* MmsCodeParameterCode ( By WSP Table 38. Wellknown parameter Assignments ) */
        {
-               {"Charset", 0x01},              // v1.1 base
-               {"Name", 0x05},                 // v1.1 base. 0x17 at v1.4
-               {"FileName", 0x06},             // v1.1 base. ox18 at v1.4
-               {"Type", 0x09},                 // v1.2 base
-               {"Start", 0x0A},                // v1.2 base. 0x19 at v1.4
-               {"Start-Info", 0x0B},   // v1.2 base. 0x1A at v1.4
-               {"boundary", 0xFF},             //laconic_javaParamFix
-               {"report-type", 0xFF},        // only used as parameter of Content-Type: multipart/report; report-type=delivery-status;
+               {"Charset", 0x01},              /* v1.1 base */
+               {"Name", 0x05},                 /* v1.1 base. 0x17 at v1.4 */
+               {"FileName", 0x06},             /* v1.1 base. ox18 at v1.4 */
+               {"Type", 0x09},                 /* v1.2 base */
+               {"Start", 0x0A},                /* v1.2 base. 0x19 at v1.4 */
+               {"Start-Info", 0x0B},   /* v1.2 base. 0x1A at v1.4 */
+               {"boundary", 0xFF},             /* laconic_javaParamFix */
+               {"report-type", 0xFF},        /* only used as parameter of Content-Type: multipart/report; report-type=delivery-status; */
 #ifdef FEATURE_JAVA_MMS
                {"Application-ID", 0xFF},
                {"Reply-To-Application-ID", 0xFF},
@@ -94,11 +93,11 @@ const MmsField gMmsField[MMS_MAX_FIELD_TYPE_COUNT][MMS_MAX_FIELD_VALUE_COUNT] =
 
        /* MmsCodeMsgBodyHeaderCode ( By WSP Table 39. Header Field Name Assignments ) */
        {
-               {"Content-Transfer-Encoding", 0xFFFF},  // only text encoding, no binary number
-               {"Content-Disposition", 0x2E},                  // v1.1 base. 0x45 at v1.4
-               {"Content-ID", 0x40},                                   // v1.3 base
-               {"Content-Location", 0x0E},                             // v1.3 base
-               {"X-Oma-Drm-Separate-Delivery", 0xFF }, // DRM RO WAITING
+               {"Content-Transfer-Encoding", 0xFFFF},  /* only text encoding, no binary number */
+               {"Content-Disposition", 0x2E},                  /* v1.1 base. 0x45 at v1.4 */
+               {"Content-ID", 0x40},                                   /* v1.3 base */
+               {"Content-Location", 0x0E},                             /* v1.3 base */
+               {"X-Oma-Drm-Separate-Delivery", 0xFF }, /* DRM RO WAITING */
        },
 
        /* MmsCodeMsgType */
@@ -268,10 +267,10 @@ const MmsField gMmsField[MMS_MAX_FIELD_TYPE_COUNT][MMS_MAX_FIELD_VALUE_COUNT] =
        },
 
 
-//     OMNA WSP Content Type Numbers
-//     http://technical.openmobilealliance.org/tech/omna/omna-wsp-content-type.aspx
+/* OMNA WSP Content Type Numbers */
+/* http://technical.openmobilealliance.org/tech/omna/omna-wsp-content-type.aspx */
        {
-       //NOT USED THIS TABLE
+       /* NOT USED THIS TABLE */
        },
 
        /* MmsCodeMsgDisposition : Wsp Header (By Wsp 8.4.2.53) */
@@ -294,7 +293,7 @@ const MmsField gMmsField[MMS_MAX_FIELD_TYPE_COUNT][MMS_MAX_FIELD_VALUE_COUNT] =
 const char *MmsGetTextValue(MmsCode i, int j)
 {
        if (i == MmsCodeContentType) {
-               //apply UtyMime
+               /* apply UtyMime */
                return MimeGetMimeStringFromMimeInt(j);
        }
 
@@ -357,16 +356,14 @@ const char *MmsGetTextValuebyField(int field, int value)
 
 UINT16 MmsGetBinaryValue(MmsCode i, int j)
 {
-       if (i == MmsCodeContentType) {
+       if (i == MmsCodeContentType)
                return MimeGetBinaryValueFromMimeInt((MimeType)j);
-       }
 
        return gMmsField[i][j].binary;
 }
 
 int MmsGetBinaryType(MmsCode i, UINT16 value)
 {
-
        for (int j = 0; j < MMS_MAX_FIELD_VALUE_COUNT; j++) {
                if (gMmsField[i][j].binary == value) {
                        MSG_DEBUG("code [%d], value [0x%02x], ret type [%d]", i, value, j);
@@ -490,28 +487,28 @@ void *MsgDecodeBase64(unsigned char *pSrc, unsigned long srcLen, unsigned long *
                        }
                        continue;
                } else
-                       continue;                                       // Actually, never get here
+                       continue;                                       /* Actually, never get here */
 
                /* Pad 4*6bit character into 3*8bit character */
 
                switch (e++) {
                case 0:
-                       *d = c << 2;                    // byte 1: high 6 bits
+                       *d = c << 2;                    /* byte 1: high 6 bits */
                        break;
 
                case 1:
-                       *d++ |= c >> 4;                 // byte 1: low 2 bits
-                       *d = c << 4;                    // byte 2: high 4 bits
+                       *d++ |= c >> 4;                 /* byte 1: low 2 bits */
+                       *d = c << 4;                    /* byte 2: high 4 bits */
                        break;
 
                case 2:
-                       *d++ |= c >> 2;                 // byte 2: low 4 bits
-                       *d = c << 6;                    // byte 3: high 2 bits
+                       *d++ |= c >> 2;                 /* byte 2: low 4 bits */
+                       *d = c << 6;                    /* byte 3: high 2 bits */
                        break;
 
                case 3:
-                       *d++ |= c;                              // byte 3: low 6 bits
-                       e = 0;                                  // Calculate next unit.
+                       *d++ |= c;                              /* byte 3: low 6 bits */
+                       e = 0;                                  /* Calculate next unit. */
                        break;
 
                default:
@@ -520,7 +517,7 @@ void *MsgDecodeBase64(unsigned char *pSrc, unsigned long srcLen, unsigned long *
                }
        }
 
-       *len = d - (char *)ret;                 // Calculate the size of decoded string.
+       *len = d - (char *)ret;                 /* Calculate the size of decoded string. */
 
        return ret;
 }
@@ -649,10 +646,10 @@ bool MsgEncode2Base64(void *pSrc, unsigned long srcLen, unsigned long *len, unsi
 
        /* Convert 3*8bit into 4*6bit */
        for (i = 0; srcLen > 0; s += 3) {
-               *d++ = v[s[0] >> 2];                                                                                                                    // byte 1: high 6 bits of character-1
-               *d++ = v[((s[0] << 4) + (--srcLen ? (s[1] >> 4) : 0)) & 0x3f];                                  // byte 2: low 2 bits of character-1 and high 4 bits of character-2
-               *d++ = srcLen ? v[((s[1] << 2) + (--srcLen ? (s[2] >> 6) : 0)) & 0x3f] : '=';   // byte 3: low 4 bits of charcter-2 and high 2 bits of character-3
-               *d++ = srcLen ? v[s[2] & 0x3f] : '=';                                                                                   // byte 4: low 6 bits of character-3
+               *d++ = v[s[0] >> 2];                                                                                                                    /* byte 1: high 6 bits of character-1 */
+               *d++ = v[((s[0] << 4) + (--srcLen ? (s[1] >> 4) : 0)) & 0x3f];                                  /* byte 2: low 2 bits of character-1 and high 4 bits of character-2 */
+               *d++ = srcLen ? v[((s[1] << 2) + (--srcLen ? (s[2] >> 6) : 0)) & 0x3f] : '=';   /* byte 3: low 4 bits of charcter-2 and high 2 bits of character-3 */
+               *d++ = srcLen ? v[s[2] & 0x3f] : '=';                                                                                   /* byte 4: low 6 bits of character-3 */
 
                if (srcLen)
                        srcLen--;
@@ -689,13 +686,13 @@ int extract_encoded_word_param(char *encoded_word, char **charset,  char **encod
 
        start_ptr = encoded_word;
 
-       if ( (encoded_word[0] == '=' && encoded_word[1] == '?') //"=?"
-                        && ((q1_ptr = strchr(start_ptr + 2, MSG_CH_QUESTION)) != NULL) // '?'
-                        && ((q2_ptr = strchr(q1_ptr + 1, MSG_CH_QUESTION))!= NULL)             // '?'
-                        && ((end_ptr = strstr(q2_ptr + 1, MSG_STR_DEC_END))!= NULL)) //"?="
+       if ( (encoded_word[0] == '=' && encoded_word[1] == '?') /* "=?" */
+                        && ((q1_ptr = strchr(start_ptr + 2, MSG_CH_QUESTION)) != NULL) /* '?' */
+                        && ((q2_ptr = strchr(q1_ptr + 1, MSG_CH_QUESTION))!= NULL)             /* '?' */
+                        && ((end_ptr = strstr(q2_ptr + 1, MSG_STR_DEC_END))!= NULL)) /* "?=" */
        {
 
-               //extract character set
+               /* extract character set */
                if ( q1_ptr - (start_ptr + 2) > 0 ) {
 
                        char_set = (char*)calloc(1, q1_ptr - (start_ptr + 2) + 1);
@@ -712,7 +709,7 @@ int extract_encoded_word_param(char *encoded_word, char **charset,  char **encod
                        goto __CATCH;
                }
 
-               //extract encode type
+               /* extract encode type */
                if ((*(q2_ptr - 1) == MSG_CH_BASE64_UPPER) || (*(q2_ptr - 1) == MSG_CH_BASE64_LOWER)
                                || (*(q1_ptr + 1) == MSG_CH_BASE64_UPPER) || (*(q1_ptr + 1) == MSG_CH_BASE64_LOWER))
                {
@@ -720,7 +717,7 @@ int extract_encoded_word_param(char *encoded_word, char **charset,  char **encod
                } else if ((*(q2_ptr-1) == MSG_CH_QPRINT_UPPER) || (*(q2_ptr-1) == MSG_CH_QPRINT_LOWER)
                                || (*(q1_ptr+1) == MSG_CH_QPRINT_UPPER) || (*(q1_ptr+1) == MSG_CH_QPRINT_LOWER))
                {
-                       //QPRINT
+                       /* QPRINT */
                        l_encoding[0] = MSG_CH_QPRINT_UPPER;
 
                } else {
@@ -728,7 +725,7 @@ int extract_encoded_word_param(char *encoded_word, char **charset,  char **encod
                        goto __CATCH;
                }
 
-               //extract encoded text
+               /* extract encoded text */
                if (end_ptr - q2_ptr > 1) {
                        l_encoded_text = (char*)calloc(1, end_ptr - q2_ptr);
                        if (l_encoded_text == NULL)
@@ -782,7 +779,7 @@ char *MsgDecodeText(const char *pOri)
        unsigned int total_len = 0;
        unsigned int decoded_len = 0;
 
-       // copy original string
+       /* copy original string */
        if (pOri == NULL || strlen(pOri) <= 0) {
                MSG_DEBUG("Invalid parameter : [%s]", pOri);
                return NULL;
@@ -801,7 +798,7 @@ char *MsgDecodeText(const char *pOri)
 
                b_encoded_word = false;
 
-               //Find encoded word
+               /* Find encoded word */
                while (b_encoded_word == false && encoded_word_start_ptr != NULL ) {
 
                        if (extract_encoded_word_param(encoded_word_start_ptr, &charset, &encoding, &encoded_text, &encoded_word_size) == 0) {
@@ -818,13 +815,13 @@ char *MsgDecodeText(const char *pOri)
                                encoded_word_size = 0;
                        }
 
-                       encoded_word_start_ptr = strstr(encoded_word_start_ptr+1, MSG_STR_DEC_START); //find next encoded_start_ptr
+                       encoded_word_start_ptr = strstr(encoded_word_start_ptr+1, MSG_STR_DEC_START); /* find next encoded_start_ptr */
 
-               } // end of while
+               } /* end of while */
 
                if (b_encoded_word) {
 
-                       //copy normal text
+                       /* copy normal text */
                        if (encoded_word_start_ptr - normal_word_start_ptr > 0) {
                                result_string.append(normal_word_start_ptr, encoded_word_start_ptr - normal_word_start_ptr);
                                MSG_DEBUG("copy normal text : [%s]", result_string.c_str());
@@ -847,7 +844,7 @@ char *MsgDecodeText(const char *pOri)
                                                MSG_DEBUG("MmsPluginTextConvert Fail");
                                        }
 
-                                       if(result_text) {
+                                       if (result_text) {
                                                MSG_DEBUG("Text convert result [%s][%d]", result_text, strlen(result_text));
 
                                                result_string.append(result_text, result_text_len);
@@ -878,7 +875,7 @@ char *MsgDecodeText(const char *pOri)
                                                MSG_DEBUG("MmsPluginTextConvert Fail");
                                        }
 
-                                       if(result_text) {
+                                       if (result_text) {
                                                MSG_DEBUG("Text convert result [%s][%d]", result_text, strlen(result_text));
 
                                                result_string.append(result_text, result_text_len);
@@ -893,7 +890,7 @@ char *MsgDecodeText(const char *pOri)
                                MSG_FREE(decoded_text);
                        }
 
-                       normal_word_start_ptr = encoded_word_start_ptr+encoded_word_size; //next
+                       normal_word_start_ptr = encoded_word_start_ptr+encoded_word_size; /* next */
 
                        MSG_FREE(charset);
                        MSG_FREE(encoding);
@@ -901,7 +898,7 @@ char *MsgDecodeText(const char *pOri)
                        encoded_word_size = 0;
 
                } else {
-                       //copy remain normal text
+                       /* copy remain normal text */
 
                        MSG_DEBUG("last text : [%s]", normal_word_start_ptr);
 
@@ -910,7 +907,7 @@ char *MsgDecodeText(const char *pOri)
                        break;
                }
 
-       } //end of while
+       } /* end of while */
 
        if (result_string.length() > 0) {
                return_string = g_strdup(result_string.c_str());
@@ -1511,7 +1508,7 @@ bool MmsInitMsgContentParam(MsgContentParam *pMsgContentParam)
        pMsgContentParam->szStart[0] = '\0';
        pMsgContentParam->szStartInfo[0] = '\0';
        pMsgContentParam->pPresentation = NULL;
-       pMsgContentParam->reportType = MSG_PARAM_REPORT_TYPE_UNKNOWN; // only used as parameter of Content-Type: multipart/report; report-type
+       pMsgContentParam->reportType = MSG_PARAM_REPORT_TYPE_UNKNOWN; /* only used as parameter of Content-Type: multipart/report; report-type */
 #ifdef FEATURE_JAVA_MMS
        pMsgContentParam->szApplicationID = NULL;
        pMsgContentParam->szReplyToApplicationID = NULL;
@@ -1660,7 +1657,7 @@ bool MmsReleaseMmsAttrib(MmsAttrib *pAttrib)
                pAttrib->szBcc = NULL;
        }
 
-       //check if pMultiStatus should be freed or not, because pMultiStatus is not allocated
+       /* check if pMultiStatus should be freed or not, because pMultiStatus is not allocated */
        if (pAttrib->pMultiStatus) {
                MmsMsgMultiStatus *pMultiStatus = pAttrib->pMultiStatus;
                MmsMsgMultiStatus *pCurStatus = NULL;
@@ -1678,7 +1675,6 @@ bool MmsReleaseMmsAttrib(MmsAttrib *pAttrib)
                pAttrib->pMultiStatus = NULL;
        }
 
-
        MSG_END();
 
        return true;
@@ -1704,49 +1700,47 @@ bool MmsReleaseMsgBody(MsgBody *pBody, int type)
        case MIME_MULTIPART_MIXED:
        case MIME_MULTIPART_RELATED:
        case MIME_MULTIPART_ALTERNATIVE:
-       case MIME_APPLICATION_VND_WAP_MULTIPART_ALTERNATIVE:
-               {
-                       MsgMultipart *pMulti = pBody->body.pMultipart;
-                       MsgMultipart *pCurrPart = NULL;
-                       MsgBody *pPresentation = pBody->pPresentationBody;
-                       while (pMulti != NULL) {
-                               pCurrPart = pMulti;
-
-                               pMulti = pMulti->pNext;
-
-                               if (pCurrPart) {
-                                       MmsReleaseMsgDRMInfo(&pCurrPart->type.drmInfo);
-
-                                       if (pCurrPart->pBody) {
-                                               if (pCurrPart->pBody->body.pText) {
-                                                       free(pCurrPart->pBody->body.pText);
-                                                       pCurrPart->pBody->body.pText = NULL;
-                                               }
-
-                                               free(pCurrPart->pBody);
-                                               pCurrPart->pBody = NULL;
+       case MIME_APPLICATION_VND_WAP_MULTIPART_ALTERNATIVE: {
+               MsgMultipart *pMulti = pBody->body.pMultipart;
+               MsgMultipart *pCurrPart = NULL;
+               MsgBody *pPresentation = pBody->pPresentationBody;
+               while (pMulti != NULL) {
+                       pCurrPart = pMulti;
+
+                       pMulti = pMulti->pNext;
+
+                       if (pCurrPart) {
+                               MmsReleaseMsgDRMInfo(&pCurrPart->type.drmInfo);
+
+                               if (pCurrPart->pBody) {
+                                       if (pCurrPart->pBody->body.pText) {
+                                               free(pCurrPart->pBody->body.pText);
+                                               pCurrPart->pBody->body.pText = NULL;
                                        }
-                                       free(pCurrPart);
-                                       pCurrPart = NULL;
-                               }
-                       }
 
-                       pBody->body.pMultipart = NULL;
-
-                       if (pPresentation) {
-                               if (pPresentation->body.pText) {
-                                       free(pPresentation->body.pText);
-                                       pPresentation->body.pText = NULL;
+                                       free(pCurrPart->pBody);
+                                       pCurrPart->pBody = NULL;
                                }
-                               free(pPresentation);
-                               pBody->pPresentationBody = NULL;
+                               free(pCurrPart);
+                               pCurrPart = NULL;
                        }
+               }
 
-                       MmsInitMsgType(&pBody->presentationType);
+               pBody->body.pMultipart = NULL;
 
-                       break;
+               if (pPresentation) {
+                       if (pPresentation->body.pText) {
+                               free(pPresentation->body.pText);
+                               pPresentation->body.pText = NULL;
+                       }
+                       free(pPresentation);
+                       pBody->pPresentationBody = NULL;
                }
 
+               MmsInitMsgType(&pBody->presentationType);
+
+               break;
+       }
        default:
                /* Any single part */
                if (pBody->body.pText) {
@@ -1831,16 +1825,16 @@ bool MmsIsVitemContent(int type, char *pszName)
        switch (type) {
        case MIME_TEXT_X_VCARD:
        case MIME_TEXT_X_VCALENDAR:
-       case MIME_TEXT_X_VNOTE: // vnt
+       case MIME_TEXT_X_VNOTE: /* vnt */
        case MIME_TEXT_X_VTODO:
-       case MIME_TEXT_PLAIN:   // vbm - It SHOULD be distinguished from a normal text file.
+       case MIME_TEXT_PLAIN:   /* vbm - It SHOULD be distinguished from a normal text file. */
        {
                char *pszExt = NULL;
 
                if (!pszName)
                        break;
 
-               // search file extension.
+               /* search file extension. */
                if ((pszExt = strrchr(pszName, '.')) == NULL)
                        break;
 
index 20f9c49..dfd8351 100755 (executable)
@@ -60,13 +60,13 @@ void MmsPluginComposer::composeSendReq(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDING
 
        if (pMsgInfo->msgType.subType == MSG_SENDREQ_MMS) {
 
-               if (pMmsData->header == NULL) {//send req from user
+               if (pMmsData->header == NULL) { /* send req from user */
                        pMmsData->header = MsgMmsCreateHeader();
                }
 
                if (pMmsData->header) {
                        composeSendReqHeader(pMsgInfo, pSendOptInfo, pMmsData);
-                       //TODO:: apply MmsReplaceNonAsciiUtf8 to all multipart FileName;
+                       /* TODO:: apply MmsReplaceNonAsciiUtf8 to all multipart FileName; */
                }
 
                int len = g_list_length(pMmsData->multipartlist);
@@ -82,7 +82,7 @@ void MmsPluginComposer::composeSendReq(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDING
                                        snprintf(multipart->szContentType, sizeof(multipart->szContentType), "%s", content_type);
                                }
                        }
-               } //end for
+               } /* end for */
        }
 }
 
@@ -96,7 +96,7 @@ MMSList *getAddressList(const MSG_MESSAGE_INFO_S *pMsgInfo, int recipientType)
 
        nAddressCnt = pMsgInfo->nAddressCnt;
 
-       // Calculate allocated buffer size
+       /* Calculate allocated buffer size */
        for (int i = 0; i < nAddressCnt; ++i) {
 
                MSG_SEC_DEBUG("recipientType: %d, address value: %s", pMsgInfo->addressList[i].recipientType, pMsgInfo->addressList[i].addressVal);
@@ -111,8 +111,8 @@ MMSList *getAddressList(const MSG_MESSAGE_INFO_S *pMsgInfo, int recipientType)
                                pAddressData = MsgMmsCreateAddress(MSG_ADDRESS_TYPE_PLMN, pMsgInfo->addressList[i].addressVal);
                        } else if (pMsgInfo->addressList[i].addressType == MSG_ADDRESS_TYPE_EMAIL) {
                                pAddressData = MsgMmsCreateAddress(MSG_ADDRESS_TYPE_EMAIL, pMsgInfo->addressList[i].addressVal);
-                       } else
-                               ; // Need to consider IPV4, IPV6, and Alias formatted address
+                       } else;
+                       /* Need to consider IPV4, IPV6, and Alias formatted address */
 
                        if (pAddressData)
                                addressList = g_list_append(addressList, pAddressData);
@@ -180,11 +180,10 @@ bool composeSendReqHeader(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *p
 
                msgClass = (MmsMsgClass)MsgSettingGetInt(MMS_SEND_MSG_CLASS);
 
-               //set Header
+               /* set Header */
                time(&RawTime);
                localtime_r(&RawTime, &timeInfo);
                nTimeInSecs = mktime(&timeInfo);
-
                pHeaderData->date = nTimeInSecs;
 
                pHeaderData->bDeliveryReport = bAskDeliveryReport;
@@ -215,12 +214,10 @@ bool composeSendReqHeader(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *p
 
        snprintf(pHeaderData->szSubject, sizeof(pHeaderData->szSubject), "%s", pMsgInfo->subject);
 
-       //setting adddress
+       /* setting adddress */
        pHeaderData->to = getAddressList(pMsgInfo, MSG_RECIPIENTS_TYPE_TO);
        pHeaderData->cc = getAddressList(pMsgInfo, MSG_RECIPIENTS_TYPE_CC);
        pHeaderData->bcc = getAddressList(pMsgInfo, MSG_RECIPIENTS_TYPE_BCC);
 
-       //snprintf(pHeaderData->szFrom, sizeof(pHeaderData->szFrom), "%s", pMmsMsg->mmsAttrib.szFrom);
-
        return true;
 }
index bb02aa6..eac9173 100755 (executable)
@@ -434,7 +434,7 @@ bool MmsPluginCmAgent::open()
        int time_ret = 0;
        lock();
 
-       //create connection
+       /* create connection */
        context_invoke(__connection_create, &bConnection);
 
        if (bConnection == false || g_connection == NULL) {
@@ -444,8 +444,8 @@ bool MmsPluginCmAgent::open()
 
        if (g_profile) {
                MSG_WARN("connection profile already exist");
-               //TODO:: get data;
-               //goto __RETURN;
+               /* TODO:: get data; */
+               /* goto __RETURN; */
        }
 
        waitProfileOpen = true;
@@ -459,10 +459,7 @@ bool MmsPluginCmAgent::open()
 
        MSG_INFO("## WAITING UNTIL __connection_profile_state CONNECT. ##");
 
-//     cv.wait(mx.pMutex());
-//     MSG_INFO("## WAKE by SIGNAL ##");
-
-       time_ret = cv.timedwait(mx.pMutex(), MMS_CONNECTION_API_WAIT_TIME); // isCmOpened will changed by processCBdatas
+       time_ret = cv.timedwait(mx.pMutex(), MMS_CONNECTION_API_WAIT_TIME); /* isCmOpened will changed by processCBdatas */
 
        if (time_ret == ETIMEDOUT) {
                MSG_WARN("## WAKE by timeout ##");
@@ -470,12 +467,12 @@ bool MmsPluginCmAgent::open()
                MSG_INFO("## WAKE by SIGNAL ##");
        }
 
-       if(isCmOpened == false) {
+       if (isCmOpened == false) {
                MSG_WARN("");
                goto __ERR_RETURN;
        }
 
-//__RETURN:
+/* __RETURN: */
        unlock();
        MSG_END();
        return isCmOpened;
@@ -539,7 +536,7 @@ __RETURN:
        MSG_END();
 }
 
-//profile open callback
+/* profile open callback */
 void MmsPluginCmAgent::connection_profile_open_callback(connection_error_e result, void* user_data)
 {
        lock();
@@ -591,10 +588,10 @@ void MmsPluginCmAgent::connection_profile_open_callback(connection_error_e resul
 
                        isCmOpened = true;
 
-                       goto __SIGNAL_RETURN; //open success
+                       goto __SIGNAL_RETURN; /* open success */
 
                } else {
-                       goto __NO_SIGNAL_RETURN; //Just open success
+                       goto __NO_SIGNAL_RETURN; /* Just open success */
                }
 
        } else {
@@ -604,17 +601,17 @@ void MmsPluginCmAgent::connection_profile_open_callback(connection_error_e resul
 
        }
 
-__NO_SIGNAL_RETURN: //Just Open
+__NO_SIGNAL_RETURN: /* Just Open */
        if (profile)
                connection_profile_destroy(profile);
        unlock();
        return;
 
-__SIGNAL_RETURN: //Error or Already connected
+__SIGNAL_RETURN: /* Error or Already connected */
        if (profile)
                connection_profile_destroy(profile);
 
-       if (waitProfileOpen == true) {//open fail
+       if (waitProfileOpen == true) { /* open fail */
                waitProfileOpen = false;
                MSG_INFO("## SIGNAL ##");
                signal();
@@ -693,7 +690,7 @@ __NO_SIGNAL_RETURN://Default
        unlock();
        return;
 
-__SIGNAL_RETURN: //Error or connected
+__SIGNAL_RETURN: /* Error or connected */
        if (profile)
                connection_profile_destroy(profile);
 
index 4940178..50c7551 100755 (executable)
 #include "MmsPluginDrm.h"
 #include "MsgDrmWrapper.h"
 
+#ifdef FEATURE_CONTAINER_ENABLE
+#include "MsgZoneManager.h"
+#endif
+
 /*Decode wsp*/
 static int __MmsGetDecodeOffset(void);
 static bool __MmsDecodeInitialize(void);
@@ -73,7 +77,7 @@ static bool __MmsBinaryDecodeParameter(FILE *pFile, MsgType *pMsgType, int value
 static int __MmsBinaryDecodeContentType(FILE *pFile, MsgType *pMsgType, int totalLength);
 
 
-//util funcion
+/* util funcion */
 static void __MsgRemoveFilePath(char *pSrc);
 static bool __MsgChangeSpace(char *pOrg, char **ppNew);
 static void __MsgConfirmPresentationPart(MsgType *pMsgType, MsgBody *pMsgBody, MsgPresentaionInfo *pPresentationInfo);
@@ -90,7 +94,7 @@ static char *__MsgSkipComment(char *s, long trim);
 
 static char *__MsgConvertLatin2UTF8FileName(char *pSrc);
 
-//static bool __MsgIsPercentSign(char *pSrc);
+/* static bool __MsgIsPercentSign(char *pSrc); */
 static bool __MsgIsMultipartRelated(int type);
 static bool __MsgIsPresentablePart(int type);
 static bool __MsgResolveNestedMultipart(MsgType *pPartType, MsgBody *pPartBody);
@@ -129,57 +133,56 @@ __thread char *gpMmsDecodeBuf2 = NULL;
 
 __thread MmsHeader mmsHeader =
 {
-       (MmsMsgType)MMS_MSGTYPE_ERROR,                  //MmsMsgType                    iType;
-       "",                                                                             //char[]                                szTrID;
-       //"",                                                                           //short int                             version;
-       0,                                                                              //short int                             version;
-       0,                                                                              //UINT32                                date;
-
-       NULL,                                                                   //MsgHeaderAddress*             pFrom;
-       NULL,                                                                   //MsgHeaderAddress*             pTo;
-       NULL,                                                                   //MsgHeaderAddress*             pCc;
-       NULL,                                                                   //MsgHeaderAddress*             pBcc;
-       "",                                                                             //char[]                                szSubject;
-       (MmsResponseStatus)MMS_RESPSTATUS_OK,   //MmsResponseStatus             iResponseStatus;
-       (MmsRetrieveStatus)MMS_RETRSTATUS_OK,   //MmsRetrieveStatus             iRetrieveStatus;
-       "",                                                                             //char[]                                szResponseText;
-       "",                                                                             //char[]                                szRetrieveText;
+       (MmsMsgType)MMS_MSGTYPE_ERROR,                  /* MmsMsgType                   iType; */
+       "",                                                                             /* char[]                               szTrID; */
+       0,                                                                              /* short int                            version; */
+       0,                                                                              /* UINT32                               date; */
+
+       NULL,                                                                   /* MsgHeaderAddress*            pFrom; */
+       NULL,                                                                   /* MsgHeaderAddress*            pTo; */
+       NULL,                                                                   /* MsgHeaderAddress*            pCc; */
+       NULL,                                                                   /* MsgHeaderAddress*            pBcc; */
+       "",                                                                             /* char[]                               szSubject; */
+       (MmsResponseStatus)MMS_RESPSTATUS_OK,   /* MmsResponseStatus            iResponseStatus; */
+       (MmsRetrieveStatus)MMS_RETRSTATUS_OK,   /* MmsRetrieveStatus            iRetrieveStatus; */
+       "",                                                                             /* char[]                               szResponseText; */
+       "",                                                                             /* char[]                               szRetrieveText; */
 
 
        /* has default value in specification */
 
-       (MmsMsgClass)MMS_MSGCLASS_PERSONAL,             //MmsMsgClass                   msgClass;
-       {MMS_TIMETYPE_RELATIVE, 0},                             //MmsTimeStruct                 expiryTime;
-       {MMS_TIMETYPE_RELATIVE, 0},                             //MmsTimeStruct                 deliveryTime;
-       (MmsPriority)MMS_PRIORITY_NORMAL,               //MmsPriority                   priority;               // Refer [OMA-MMS-ENC-v1_2-20030915-C]
-       (MmsSenderVisible)MMS_SENDER_SHOW,              //MmsSenderVisible              senderVisible;
-       (MmsReport)MMS_REPORT_NO,                               //MmsReport                             deliveryReport;
-       (MmsReport)MMS_REPORT_NO,                               //MmsReport                             readReply;
-       (MmsReportAllowed)MMS_REPORTALLOWED_NO,//MmsReportAllowed               iReportAllowed;
-       "",                                                                             //char[]                                szContentLocation;
+       (MmsMsgClass)MMS_MSGCLASS_PERSONAL,             /* MmsMsgClass                  msgClass; */
+       {MMS_TIMETYPE_RELATIVE, 0},                             /* MmsTimeStruct                        expiryTime; */
+       {MMS_TIMETYPE_RELATIVE, 0},                             /* MmsTimeStruct                        deliveryTime; */
+       (MmsPriority)MMS_PRIORITY_NORMAL,               /* MmsPriority                  priority; */ /* Refer [OMA-MMS-ENC-v1_2-20030915-C] */
+       (MmsSenderVisible)MMS_SENDER_SHOW,              /* MmsSenderVisible             senderVisible; */
+       (MmsReport)MMS_REPORT_NO,                               /* MmsReport                            deliveryReport; */
+       (MmsReport)MMS_REPORT_NO,                               /* MmsReport                            readReply; */
+       (MmsReportAllowed)MMS_REPORTALLOWED_NO, /* MmsReportAllowed             iReportAllowed; */
+       "",                                                                             /* char[]                               szContentLocation; */
 
 
        /* there is no right default value */
 
-       (msg_delivery_report_status_t)MSG_DELIVERY_REPORT_NONE,         //MmsMsgStatus                  iMsgStatus;
-       (msg_read_report_status_t)MSG_READ_REPORT_NONE,         //MmsReadStatus                 readStatus;
+       (msg_delivery_report_status_t)MSG_DELIVERY_REPORT_NONE,         /* MmsMsgStatus                 iMsgStatus; */
+       (msg_read_report_status_t)MSG_READ_REPORT_NONE,         /* MmsReadStatus                        readStatus; */
 
        /* MMS v1.1 ReplyCharge */
        {
-               (MmsReplyChargeType)MMS_REPLY_NONE,     //MmsReplyChargeType    chargeType;
-               {MMS_TIMETYPE_RELATIVE, 0},                     //MmsTimeStruct                 deadLine;
-               0,                                                                      //int                                   chargeSize;
-               "" ,                                                            //char                                  szChargeID;
+               (MmsReplyChargeType)MMS_REPLY_NONE,     /* MmsReplyChargeType   chargeType; */
+               {MMS_TIMETYPE_RELATIVE, 0},                     /* MmsTimeStruct                        deadLine; */
+               0,                                                                      /* int                                  chargeSize; */
+               "" ,                                                            /* char                                 szChargeID; */
        },
 
-       "",                                                                             //char[]                                szMsgID;
-       0,                                                                              //UINT32                                msgSize;
+       "",                                                                             /* char[]                               szMsgID; */
+       0,                                                                              /* UINT32                               msgSize; */
 };
 
 #define        MMS_DRM2_CONVERT_BUFFER_MAX     4*1024
-const UINT32 MMS_UINTVAR_LENGTH_1 =  0x0000007f;               //7bit
-const UINT32 MMS_UINTVAR_LENGTH_2 =  0x00003fff;               //14bit
-const UINT32 MMS_UINTVAR_LENGTH_3 =  0x001fffff;               //21bit
+const UINT32 MMS_UINTVAR_LENGTH_1 =  0x0000007f;               /* 7bit */
+const UINT32 MMS_UINTVAR_LENGTH_2 =  0x00003fff;               /* 14bit */
+const UINT32 MMS_UINTVAR_LENGTH_3 =  0x001fffff;               /* 21bit */
 
 static bool __MmsDecodeInitialize(void)
 {
@@ -219,7 +222,7 @@ void MmsInitHeader()
        mmsHeader.expiryTime.time = 0;
        mmsHeader.deliveryTime.type     = MMS_TIMETYPE_RELATIVE;
        mmsHeader.deliveryTime.time     = 0;
-       mmsHeader.priority = (MmsPriority)MMS_PRIORITY_NORMAL;  // Refer [OMA-MMS-ENC-v1_2-20030915-C]
+       mmsHeader.priority = (MmsPriority)MMS_PRIORITY_NORMAL;  /* Refer [OMA-MMS-ENC-v1_2-20030915-C] */
        mmsHeader.hideAddress =(MmsSenderVisible)MMS_SENDER_SHOW;
        mmsHeader.deliveryReport = (MmsReport)MMS_REPORT_NO;
        mmsHeader.readReply = (MmsReport)MMS_REPORT_NO;
@@ -255,7 +258,6 @@ void MmsReleaseHeader(MmsHeader *mms)
        mmsHeader.pTo = NULL;
        mmsHeader.pCc = NULL;
        mmsHeader.pBcc = NULL;
-
 }
 
 static void __MmsCleanDecodeBuff(void)
@@ -384,8 +386,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength)
                fieldCode = oneByte & 0x7f;
 
                switch (MmsGetBinaryType(MmsCodeFieldCode, fieldCode)) {
-               case MMS_CODE_RESPONSESTATUS:
-               {
+               case MMS_CODE_RESPONSESTATUS: {
                        MmsResponseStatus resposeStatus = MMS_RESPSTATUS_ERROR;
 
                        if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
@@ -395,8 +396,8 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength)
 
                        fieldValue = oneByte;
 
-                       // range 197 to 223 as it does to the value 192 (Error-transient-failure).
-                       // range 236 to 255 as it does to the value 224 (Error-permanent-failure).
+                       /* range 197 to 223 as it does to the value 192 (Error-transient-failure). */
+                       /* range 236 to 255 as it does to the value 224 (Error-permanent-failure). */
                        if (fieldValue >= 197 && fieldValue <= 223) {
                                fieldValue = 192;
                        } else if (fieldValue >= 236 && fieldValue <= 255) {
@@ -410,8 +411,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength)
                        MSG_SEC_INFO("X-Mms-Response-Status = [0x%02x][0x%02x][%s]", oneByte, fieldValue, MmsDebugGetResponseStatus(mmsHeader.responseStatus));
                        break;
                }
-               case MMS_CODE_RETRIEVESTATUS:
-               {
+               case MMS_CODE_RETRIEVESTATUS: {
                        MmsRetrieveStatus RetrieveStatus = MMS_RETRSTATUS_ERROR;
 
                        if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
@@ -421,12 +421,12 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength)
 
                        fieldValue = oneByte;
 
-                       //195 to 223 as it does to the value 192 (Error-transient-failure).
-                       //228 to 255 as it does to the value 224 (Error-permanent-failure).
+                       /* 195 to 223 as it does to the value 192 (Error-transient-failure). */
+                       /* 228 to 255 as it does to the value 224 (Error-permanent-failure). */
                        if (fieldValue >= 195 && fieldValue <= 223) {
-                               fieldValue = 192; // 192; Error-transient-failure
+                               fieldValue = 192; /* 192; Error-transient-failure */
                        } else if (fieldValue >= 228 && fieldValue <= 255) {
-                               fieldValue = 224; //224; Error-permanent-failure
+                               fieldValue = 224; /* 224; Error-permanent-failure */
                        }
 
                        RetrieveStatus = (MmsRetrieveStatus)MmsGetBinaryType(MmsCodeRetrieveStatus, (UINT16)(fieldValue & 0x7F));
@@ -518,7 +518,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength)
                                goto __CATCH;
                        }
 
-                       // DRM_TEMPLATE - start
+                       /* DRM_TEMPLATE - start */
 
                        valueLength--;
 
@@ -546,7 +546,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength)
                                }
 
                                MSG_SEC_INFO("From = [%s]", mmsHeader.pFrom->szAddr);
-                               // DRM_TEMPLATE - end
+                               /* DRM_TEMPLATE - end */
                        } else if (oneByte == (MmsGetBinaryValue(MmsCodeAddressType, MMS_INSERT_ADDRESS_TOKEN)|0x80)) {
                                /* Present Token only */
                                MSG_SEC_INFO("From = [insert token]");
@@ -669,7 +669,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength)
                                goto __CATCH;
                        }
 
-                       //DRM_TEMPLATE - start
+                       /* DRM_TEMPLATE - start */
                        valueLength--;
 
                        if (oneByte == (MmsGetBinaryValue(MmsCodeTimeType, MMS_TIMETYPE_ABSOLUTE)|0x80)) {
@@ -681,7 +681,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength)
                                                goto __CATCH;
                                        }
                                }
-                       // DRM_TEMPLATE - end
+                       /* DRM_TEMPLATE - end */
                        } else {
                                mmsHeader.deliveryTime.type = MMS_TIMETYPE_RELATIVE;
 
@@ -707,7 +707,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength)
                                goto __CATCH;
                        }
 
-                       // DRM_TEMPLATE - start
+                       /* DRM_TEMPLATE - start */
                        valueLength--;
 
                        if (oneByte == (MmsGetBinaryValue(MmsCodeTimeType, MMS_TIMETYPE_ABSOLUTE)|0x80)) {
@@ -719,7 +719,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength)
                                                goto __CATCH;
                                        }
                                }
-                       // DRM_TEMPLATE - end
+                       /* DRM_TEMPLATE - end */
                        } else {
                                mmsHeader.expiryTime.type = MMS_TIMETYPE_RELATIVE;
 
@@ -903,7 +903,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength)
                                mmsHeader.replyCharge.deadLine.type = MMS_TIMETYPE_RELATIVE;
                        }
 
-                       // DRM_TEMPLATE - start
+                       /* DRM_TEMPLATE - start */
                        valueLength--;
 
                        if (valueLength > 0) {
@@ -914,7 +914,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength)
                        }
 
                        MSG_SEC_INFO("X-Mms-Reply-Charging-Deadline : type = [%d], time = [%u]", mmsHeader.replyCharge.deadLine.type, mmsHeader.replyCharge.deadLine.time);
-                       // DRM_TEMPLATE - end
+                       /* DRM_TEMPLATE - end */
                        break;
 
                case MMS_CODE_REPLYCHARGINGID:
@@ -995,7 +995,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength)
                        }
                        break;
 
-               default:
+               default: {
 
                        /*
                         * Application-header             = Token-text Application-specific-value
@@ -1007,32 +1007,31 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength)
                         * Read one byte and check the value >= 0x80
                         * (check these value can be field code)
                         */
-                       {
-                               int             remainLength = 0;
 
-                               oneByte = 0x00;
+                       int remainLength = 0;
 
-                               offset = __MmsGetDecodeOffset();
-                               if (offset >= totalLength)
-                                       goto __RETURN;
+                       oneByte = 0x00;
 
-                               remainLength = totalLength - offset;
+                       offset = __MmsGetDecodeOffset();
+                       if (offset >= totalLength)
+                               goto __RETURN;
 
-                               while ((oneByte < 0x80) && (remainLength > 0)) {
-                                       if (__MmsBinaryDecodeCheckAndDecreaseLength(&remainLength, 1) == false) {
-                                               MSG_DEBUG("__MmsBinaryDecodeCheckAndDecreaseLength fail");
-                                               goto __CATCH;
-                                       }
-                                       if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
-                                               MSG_DEBUG("responseStatus GetOneByte fail");
-                                               goto __CATCH;
-                                       }
-                               }
+                       remainLength = totalLength - offset;
 
-                               gCurMmsDecodeBuffPos--;
+                       while ((oneByte < 0x80) && (remainLength > 0)) {
+                               if (__MmsBinaryDecodeCheckAndDecreaseLength(&remainLength, 1) == false) {
+                                       MSG_DEBUG("__MmsBinaryDecodeCheckAndDecreaseLength fail");
+                                       goto __CATCH;
+                               }
+                               if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
+                                       MSG_DEBUG("responseStatus GetOneByte fail");
+                                       goto __CATCH;
+                               }
                        }
 
+                       gCurMmsDecodeBuffPos--;
                        break;
+               }
                }       /* switch */
 
                offset = __MmsGetDecodeOffset();
@@ -1090,9 +1089,9 @@ bool MmsBinaryDecodeMsgBody(FILE *pFile, char *szFilePath, int totalLength)
        if (szFilePath != NULL)
                snprintf(mmsHeader.msgType.szOrgFilePath, sizeof(mmsHeader.msgType.szOrgFilePath), "%s", szFilePath);
 
-       mmsHeader.msgType.offset = __MmsGetDecodeOffset() - 1;          // + Content-Type code value
+       mmsHeader.msgType.offset = __MmsGetDecodeOffset() - 1;          /* + Content-Type code value */
 
-       // read data(2K) from msg file(/User/Msg/Inbox/5) to gpCurMmsDecodeBuff for decoding
+       /* read data(2K) from msg file(/User/Msg/Inbox/5) to gpCurMmsDecodeBuff for decoding */
        if (__MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos,
                                                                        &gMmsDecodeCurOffset, gpMmsDecodeBuf1, gpMmsDecodeBuf2,
                                                                        gMmsDecodeMaxLen, &gMmsDecodeBufLen, totalLength) == false) {
@@ -1100,14 +1099,14 @@ bool MmsBinaryDecodeMsgBody(FILE *pFile, char *szFilePath, int totalLength)
                goto __CATCH;
        }
 
-       // msg's type [ex] related, mixed, single part (jpg, amr and etc)
+       /* msg's type [ex] related, mixed, single part (jpg, amr and etc) */
        length = __MmsBinaryDecodeContentType(pFile, &mmsHeader.msgType, totalLength);
        if (length == -1) {
                MSG_DEBUG("MMS_CODE_CONTENTTYPE is fail");
                goto __CATCH;
        }
 
-       mmsHeader.msgType.size   = length + 1; // + Content-Type code value
+       mmsHeader.msgType.size   = length + 1; /* + Content-Type code value */
        mmsHeader.msgBody.offset = __MmsGetDecodeOffset();
 
        switch (mmsHeader.msgType.type) {
@@ -1190,7 +1189,7 @@ static bool __MmsBinaryDecodeParameter(FILE *pFile, MsgType *pMsgType, int value
                valueLength--;
 
                switch (paramCode) {
-               case 0x81: // charset
+               case 0x81: /* charset */
 
                        if (__MmsBinaryDecodeCharset(pFile, (UINT32*)&(pMsgType->param.charset), &charSetLen, totalLength) == false) {
                                MSG_DEBUG("__MmsBinaryDecodeCharset fail.");
@@ -1202,11 +1201,11 @@ static bool __MmsBinaryDecodeParameter(FILE *pFile, MsgType *pMsgType, int value
 
                        break;
 
-               case 0x85: //name = Text-string
-               case 0x97: //name = Text-value  = No-value | Token-text | Quoted-string
+               case 0x85: /* name = Text-string */
+               case 0x97: /* name = Text-value  = No-value | Token-text | Quoted-string */
                        memset(pMsgType->param.szName, 0, sizeof(pMsgType->param.szName));
                        length = __MmsDecodeGetFilename(pFile,  pMsgType->param.szName,
-                                                                                        MSG_FILENAME_LEN_MAX -5,               // MSG_LOCALE_FILENAME_LEN_MAX + 1, :  change @ 110(Ui code have to change for this instead of DM)
+                                                                                        MSG_FILENAME_LEN_MAX -5,               /* MSG_LOCALE_FILENAME_LEN_MAX + 1, :  change @ 110(Ui code have to change for this instead of DM) */
                                                                                         totalLength);
                        if (length < 0) {
                                MSG_DEBUG("__MmsDecodeGetFilename fail. (name parameter)");
@@ -1222,8 +1221,8 @@ static bool __MmsBinaryDecodeParameter(FILE *pFile, MsgType *pMsgType, int value
 
                        break;
 
-               case 0x86: //filename = Text-string
-               case 0x98: //filename = Text-value  = No-value | Token-text | Quoted-string
+               case 0x86: /* filename = Text-string */
+               case 0x98: /* filename = Text-value  = No-value | Token-text | Quoted-string */
                        memset(pMsgType->param.szFileName, 0, sizeof(pMsgType->param.szFileName));
                        length = __MmsDecodeGetFilename(pFile, pMsgType->param.szFileName, MSG_FILENAME_LEN_MAX -5, totalLength);
                        if (length < 0) {
@@ -1240,7 +1239,7 @@ static bool __MmsBinaryDecodeParameter(FILE *pFile, MsgType *pMsgType, int value
 
                        break;
 
-               case 0x89: //type = Constrained-encoding = Extension-Media | Short-integer
+               case 0x89: /* type = Constrained-encoding = Extension-Media | Short-integer */
 
                        if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
                                MSG_DEBUG("type _MmsBinaryDecodeGetOneByte fail");
@@ -1248,7 +1247,8 @@ static bool __MmsBinaryDecodeParameter(FILE *pFile, MsgType *pMsgType, int value
                        }
 
                        if (oneByte > 0x7f) {
-                               pMsgType->param.type = MimeGetMimeIntFromBi((UINT16)(oneByte & 0x7f));//MmsGetBinaryType(MmsCodeContentType,(UINT16)(oneByte & 0x7f));
+                               pMsgType->param.type = MimeGetMimeIntFromBi((UINT16)(oneByte & 0x7f));
+                               /* MmsGetBinaryType(MmsCodeContentType,(UINT16)(oneByte & 0x7f)); */
                                if (__MmsBinaryDecodeCheckAndDecreaseLength(&valueLength, 1) == false)
                                        goto __RETURN;
                        } else {
@@ -1268,8 +1268,8 @@ static bool __MmsBinaryDecodeParameter(FILE *pFile, MsgType *pMsgType, int value
 
                        break;
 
-               case 0x8A: //start encoding version 1.2
-               case 0x99: //start encoding version 1.4
+               case 0x8A: /* start encoding version 1.2 */
+               case 0x99: /* start encoding version 1.4 */
 
                        textLength       = 0;
                        szTypeString = __MmsBinaryDecodeText2(pFile, totalLength, &textLength);
@@ -1285,8 +1285,8 @@ static bool __MmsBinaryDecodeParameter(FILE *pFile, MsgType *pMsgType, int value
 
                        break;
 
-               case 0x8B: //startInfo encoding version 1.2
-               case 0x9A: //startInfo encoding version 1.4
+               case 0x8B: /* startInfo encoding version 1.2 */
+               case 0x9A: /* startInfo encoding version 1.4 */
 
                        textLength       = 0;
                        szTypeString = __MmsBinaryDecodeText2(pFile, totalLength, &textLength);
@@ -1309,7 +1309,7 @@ static bool __MmsBinaryDecodeParameter(FILE *pFile, MsgType *pMsgType, int value
                        if (paramCode > 0x7F) {
                                MSG_DEBUG("Unsupported parameter");
 
-                               // In case of the last byte of Parameter field, it should be returned without decreasing the gCurMmsDecodeBuffPos value.
+                               /* In case of the last byte of Parameter field, it should be returned without decreasing the gCurMmsDecodeBuffPos value. */
                                valueLength++;
                                if (__MmsBinaryDecodeCheckAndDecreaseLength(&valueLength, 1) == false)
                                        goto __RETURN;
@@ -1580,8 +1580,8 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head
                        fieldCode = oneByte & 0x7f;
 
                        switch (fieldCode) {
-                       case 0x0E:      //Content-Location
-                       case 0x04:      //Content-Location
+                       case 0x0E:      /* Content-Location */
+                       case 0x04:      /* Content-Location */
                        {
                                pLatinBuff = (char *)calloc(1, MMS_CONTENT_ID_LEN + 1);
                                if (pLatinBuff == NULL)
@@ -1609,7 +1609,7 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head
                        }
                                break;
 
-                       case 0x40:      // Content-ID
+                       case 0x40:      /* Content-ID */
                        {
                                char szContentID[MMS_CONTENT_ID_LEN + 1] = {0, };
 
@@ -1635,15 +1635,15 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head
                                free(pLatinBuff);
                                pLatinBuff = NULL;
 
-                               MmsRemoveLessGreaterChar(szContentID, pMsgType->szContentID, sizeof(pMsgType->szContentID));//remove "< >"
+                               MmsRemoveLessGreaterChar(szContentID, pMsgType->szContentID, sizeof(pMsgType->szContentID)); /* remove "< >" */
 
                                if (__MmsBinaryDecodeCheckAndDecreaseLength(&headerLen, length) == false)
                                        goto __RETURN;
                        }
                                break;
 
-                       case 0x2E:      // Content-Disposition
-                       case 0x45:      // Content-Disposition
+                       case 0x2E:      /* Content-Disposition */
+                       case 0x45:      /* Content-Disposition */
 
                                /*
                                 * Content-disposition-value = Value-length Disposition *(Parameter)
@@ -1674,7 +1674,7 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head
 
                                        if (pMsgType->disposition == -1) {
                                                MSG_DEBUG("Content-Disposition MmsGetBinaryType fail.");
-                                               pMsgType->disposition = MSG_DISPOSITION_ATTACHMENT;             // default
+                                               pMsgType->disposition = MSG_DISPOSITION_ATTACHMENT;             /* default */
                                        }
 
                                        if (__MmsBinaryDecodeCheckAndDecreaseLength(&headerLen, 1) == false)
@@ -1725,7 +1725,7 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head
 
                                break;
 
-                       case 0x0B:      //Content-Encoding
+                       case 0x0B:      /* Content-Encoding */
 
                                if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
                                        MSG_DEBUG("Disposition value GetOneByte fail");
@@ -1737,7 +1737,7 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head
 
                                break;
 
-                       case 0x0C:      //Content-Language
+                       case 0x0C:      /* Content-Language */
 
                                if (__MmsBinaryDecodeInteger(pFile, (UINT32*)&tmpInt, &tmpIntLen, totalLength) == true) {
                                        if (__MmsBinaryDecodeCheckAndDecreaseLength(&headerLen, tmpIntLen) == false)
@@ -1765,7 +1765,7 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head
 
                                break;
 
-                       case 0x0D:      //Content-Length
+                       case 0x0D:      /* Content-Length */
 
                                if (__MmsBinaryDecodeInteger(pFile, (UINT32*)&tmpInt, &tmpIntLen, totalLength) == false) {
                                        MSG_DEBUG("__MmsBinaryDecodeInteger fail...");
@@ -1777,7 +1777,7 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head
 
                                break;
 
-                       case 0x30:      //X-Wap-Content-URI skip this value
+                       case 0x30:      /* X-Wap-Content-URI skip this value */
 
                                MSG_DEBUG("X-Wap-Content-URI header.");
                                pLatinBuff = (char *)calloc(1, MMS_TEXT_LEN);
@@ -1802,8 +1802,8 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head
 
                                break;
 
-                       case 0x01:      // Accept-charset
-                               //if (NvGetInt(NV_SI_ADM_GCF_STATE) == 1)
+                       case 0x01:      /* Accept-charset */
+/*                             if (NvGetInt(NV_SI_ADM_GCF_STATE) == 1) */
                                {
                                        /*      WAP-230-WSP-200010705-a.pdf
                                                8.4.2.8 Accept charset field
@@ -1830,7 +1830,7 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head
                                        }
 
                                        if (__MmsBinaryDecodeInteger(pFile, (UINT32*)&charset, &charSetLen, totalLength) == false) {
-                                               // We only support the well-known-charset format
+                                               /* We only support the well-known-charset format */
                                                MSG_DEBUG("__MmsBinaryDecodeInteger fail...");
                                                goto __CATCH;
                                        }
@@ -1921,11 +1921,11 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head
                        }
 
                        switch (MmsGetTextType(MmsCodeMsgBodyHeaderCode, pCode)) {
-                       case MMS_BODYHDR_TRANSFERENCODING:              // Content-Transfer-Encoding
+                       case MMS_BODYHDR_TRANSFERENCODING:              /* Content-Transfer-Encoding */
                                pMsgType->encoding = MmsGetTextType(MmsCodeContentTransferEncoding, pValue);
                                break;
 
-                       case MMS_BODYHDR_CONTENTID:                             // Content-ID
+                       case MMS_BODYHDR_CONTENTID:                             /* Content-ID */
                        {
                                char szContentID[MMS_CONTENT_ID_LEN + 1];
 
@@ -1945,13 +1945,13 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head
                                        goto __CATCH;
                                }
 
-                               MmsRemoveLessGreaterChar(szContentID, pMsgType->szContentID, sizeof(pMsgType->szContentID));//remove "< >"
+                               MmsRemoveLessGreaterChar(szContentID, pMsgType->szContentID, sizeof(pMsgType->szContentID)); /* remove "< >" */
 
                                free(pLatinBuff);
                                pLatinBuff = NULL;
                                break;
                        }
-                       case MMS_BODYHDR_CONTENTLOCATION:               // Content-Location
+                       case MMS_BODYHDR_CONTENTLOCATION:               /* Content-Location */
 
                                pLatinBuff = (char *)calloc(1, MMS_CONTENT_ID_LEN + 1);
                                if (pLatinBuff == NULL)
@@ -1969,11 +1969,11 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head
                                pLatinBuff = NULL;
                                break;
 
-                       case MMS_BODYHDR_DISPOSITION:                   // Content-Disposition
+                       case MMS_BODYHDR_DISPOSITION:                   /* Content-Disposition */
                                pMsgType->disposition = MmsGetTextType(MmsCodeMsgDisposition, pValue);
                                break;
 
-                       case MMS_BODYHDR_X_OMA_DRM_SEPARATE_DELIVERY:   // DRM RO WAITING
+                       case MMS_BODYHDR_X_OMA_DRM_SEPARATE_DELIVERY:   /* DRM RO WAITING */
                                        break;
 
                        default:
@@ -1998,7 +1998,7 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head
                                goto __RETURN;
 
                }
-       }       //while
+       }       /* while */
 
 __RETURN:
 
@@ -2130,7 +2130,6 @@ static bool __MmsBinaryDecodeMultipart(FILE *pFile, char *szFilePath, MsgType *p
        UINT32 nEntries = 0;
        MsgMultipart *pMultipart = NULL;
        MsgMultipart *pLastMultipart = NULL;
-//     MsgMultipart *pPreMultipart     = NULL;
        int offset = 0;
        int     index = 0;
 
@@ -2183,9 +2182,9 @@ static bool __MmsBinaryDecodeMultipart(FILE *pFile, char *szFilePath, MsgType *p
                        factor = MSG_PRESENTATION_NONE;
                }
 
-               // priority 1 : content type match, 2: content location, 3: type
+               /* priority 1 : content type match, 2: content location, 3: type */
                if (presentationInfo.factor < factor) {
-                       // Presentation part
+                       /* Presentation part */
                        presentationInfo.factor = factor;
                        presentationInfo.pPrevPart = pLastMultipart;
                        presentationInfo.pCurPresentation = pMultipart;
@@ -2195,11 +2194,9 @@ static bool __MmsBinaryDecodeMultipart(FILE *pFile, char *szFilePath, MsgType *p
                if (pLastMultipart == NULL) {
                        pMsgBody->body.pMultipart = pMultipart;
                        pLastMultipart = pMultipart;
-//                     pPreMultipart = NULL;
                } else {
                        pLastMultipart->pNext = pMultipart;
                        pLastMultipart = pMultipart;
-//                     pPreMultipart = pMultipart;
                }
 
                pMsgType->contentSize += pMultipart->pBody->size;
@@ -2219,7 +2216,6 @@ static bool __MmsBinaryDecodeMultipart(FILE *pFile, char *szFilePath, MsgType *p
                goto __CATCH;
        }
 
-//__RETURN:
        return true;
 
 __CATCH:
@@ -2418,7 +2414,7 @@ bool __MmsBinaryDecodeGetBytes(FILE *pFile, char *szBuff, int bufLen, int totalL
                szBuff[i] = gpCurMmsDecodeBuff[gCurMmsDecodeBuffPos++];
        }
 
-       gCurMmsDecodeBuffPos++; //NULL
+       gCurMmsDecodeBuffPos++; /* NULL */
 
        return true;
 
@@ -2577,7 +2573,7 @@ static UINT32 __MmsHeaderDecodeIntegerByLength(FILE *pFile, UINT32 length, int t
                goto __CATCH;
        }
 
-       gCurMmsDecodeBuffPos--; // - NULL
+       gCurMmsDecodeBuffPos--; /* - NULL */
 
        for (i= 0; i < length; i++)
                returner.seg[length - (i+1)] = pData[i];
@@ -2631,18 +2627,18 @@ static bool __MmsBinaryDecodeInteger(FILE *pFile, UINT32 *pInteger, int *pIntLen
        {
                pData = (char *)calloc(1, oneByte + 1);
                if (pData == NULL) {
-                       MSG_DEBUG("pData mecalloc fail");
+                       MSG_DEBUG("pData calloc fail");
                        goto __CATCH;
                }
                memset(pData, 0, oneByte + 1);
 
-               // Even NULL is copied in the _MmsBinaryDecodeGetBytes
+               /* Even NULL is copied in the _MmsBinaryDecodeGetBytes */
                if (__MmsBinaryDecodeGetBytes(pFile, pData, oneByte + 1, totalLength) == false) {
                        MSG_DEBUG("GetBytes fail");
                        goto __CATCH;
                }
 
-               gCurMmsDecodeBuffPos--; // - NULL
+               gCurMmsDecodeBuffPos--; /* - NULL */
 
                int             length  = 0;
                if (oneByte > 4) {
@@ -2726,7 +2722,7 @@ static int __MmsDecodeValueLength(FILE *pFile, UINT32 *pValueLength, int totalLe
                        MSG_DEBUG(" __MmsBinaryDecodeUintvar fail..");
                        goto __CATCH;
                }
-               length ++;                                      // + length-quote
+               length ++;                                      /* + length-quote */
                *pValueLength = uintvar;
        } else {
                MSG_DEBUG("not a value length type data");
@@ -2784,7 +2780,7 @@ static int __MmsDecodeValueLength2(FILE *pFile, UINT32 *pValueLength, int totalL
                        MSG_DEBUG("__MmsBinaryDecodeUintvar fail..");
                        goto __CATCH;
                }
-               length ++;                                      // + length-quote
+               length ++;                                      /* + length-quote */
                *pValueLength = uintvar;
        } else {
                MSG_DEBUG("there is not length-quote, consider it as short length.");
@@ -2831,7 +2827,7 @@ static int __MmsBinaryDecodeQuotedString(FILE *pFile, char *szBuff, int bufLen,
                goto __CATCH;
        }
 
-       length = strlen(gpCurMmsDecodeBuff) + 1;        // + NULL
+       length = strlen(gpCurMmsDecodeBuff) + 1;        /* + NULL */
 
        if (length == 0)
                goto __RETURN;
@@ -2888,7 +2884,7 @@ static int __MmsBinaryDecodeQuotedString(FILE *pFile, char *szBuff, int bufLen,
                        MSG_DEBUG("fail to load to buffer");
                        goto __CATCH;
                }
-               length = strlen(gpCurMmsDecodeBuff) + 1;        // + NULL
+               length = strlen(gpCurMmsDecodeBuff) + 1;        /* + NULL */
        }       /* while */
 
        if (length > 0) {
@@ -2909,7 +2905,7 @@ static int __MmsBinaryDecodeQuotedString(FILE *pFile, char *szBuff, int bufLen,
                                strncpy(szBuff + iPos, (char*)pData + 1, readBytes - 1);
                                iPos += (readBytes - 1);
                        } else {
-                               strncpy(szBuff + iPos, (char*)pData, readBytes - 1);    // + NULL
+                               strncpy(szBuff + iPos, (char*)pData, readBytes - 1);    /* + NULL */
                                iPos += readBytes;
                        }
                }
@@ -2977,7 +2973,7 @@ static int __MmsBinaryDecodeText(FILE *pFile, char *szBuff, int bufLen, int tota
                goto __CATCH;
        }
 
-       length = strlen(gpCurMmsDecodeBuff) + 1;        // + NULL
+       length = strlen(gpCurMmsDecodeBuff) + 1;        /* + NULL */
 
        if (length == 0)
                goto __RETURN;
@@ -3031,7 +3027,7 @@ static int __MmsBinaryDecodeText(FILE *pFile, char *szBuff, int bufLen, int tota
                        MSG_DEBUG("fail to load to buffer");
                        goto __CATCH;
                }
-               length = strlen(gpCurMmsDecodeBuff) + 1;        // + NULL
+               length = strlen(gpCurMmsDecodeBuff) + 1;        /* + NULL */
        }       /* while */
 
        if (length > 0) {
@@ -3053,7 +3049,7 @@ static int __MmsBinaryDecodeText(FILE *pFile, char *szBuff, int bufLen, int tota
                                iPos += (readBytes - 1);
                                bQuote = true;
                        } else {
-                               strncpy(szBuff + iPos, (char*)pData, readBytes - 1);    // + NULL
+                               strncpy(szBuff + iPos, (char*)pData, readBytes - 1);    /* + NULL */
                                iPos += readBytes;
                        }
                }
@@ -3063,7 +3059,7 @@ static int __MmsBinaryDecodeText(FILE *pFile, char *szBuff, int bufLen, int tota
                        pData = NULL;
                }
 
-               returnLength += length;         // + NULL
+               returnLength += length;         /* + NULL */
        }
 
        szBuff[bufLen - 1] = '\0';
@@ -3156,7 +3152,7 @@ static char* __MmsBinaryDecodeText2(FILE *pFile, int totalLength, int *pLength)
                } else {
                        szTempPtr = (char *)realloc(szBuff, curLen + gMmsDecodeBufLen + 1);
 
-                       //NULL pointer check for realloc
+                       /* NULL pointer check for realloc */
                        if (szTempPtr == NULL) {
                                goto __CATCH;
                        } else {
@@ -3194,8 +3190,7 @@ static char* __MmsBinaryDecodeText2(FILE *pFile, int totalLength, int *pLength)
                                                           gpMmsDecodeBuf2,
                                                           gMmsDecodeMaxLen,
                                                           &gMmsDecodeBufLen,
-                                                          totalLength) == false)
-               {
+                                                          totalLength) == false) {
                        MSG_DEBUG("fail to load to buffer");
                        goto __CATCH;
                }
@@ -3217,7 +3212,7 @@ static char* __MmsBinaryDecodeText2(FILE *pFile, int totalLength, int *pLength)
                } else {
                        szTempPtr = (char *)realloc(szBuff, curLen + length);
 
-                       //NULL pointer check for realloc
+                       /* NULL pointer check for realloc */
                        if (szTempPtr == NULL)
                                goto __CATCH;
                        else
@@ -3246,7 +3241,7 @@ static char* __MmsBinaryDecodeText2(FILE *pFile, int totalLength, int *pLength)
                        pData = NULL;
                }
 
-               *pLength += length;             // + NULL
+               *pLength += length;             /* + NULL */
        }
 
        return szBuff;
@@ -3394,7 +3389,7 @@ static bool __MmsBinaryDecodeEncodedString(FILE *pFile, char *szBuff, int bufLen
                        strncpy(szBuff, pData, bufLen - 1);
                }
 
-               {//temp brace
+               { /* temp brace */
 
                        nTemp = strlen(szBuff);
 
@@ -3606,7 +3601,7 @@ static int __MmsDecodeGetFilename(FILE *pFile, char *szBuff, int bufLen, int tot
        textLength = 0;
        pLatinBuff  = __MmsBinaryDecodeText2(pFile, totalLength, &textLength);
 
-       //remove ""
+       /* remove "" */
        if (pLatinBuff) {
                szSrc = MsgRemoveQuoteFromFilename(pLatinBuff);
                if (szSrc) {
@@ -3628,7 +3623,7 @@ static int __MmsDecodeGetFilename(FILE *pFile, char *szBuff, int bufLen, int tot
                        int             utf8BufSize = 0;
                        utf8BufSize = __MsgGetLatin2UTFCodeSize((unsigned char*)pLatinBuff, length);
                        if (utf8BufSize < 3)
-                               utf8BufSize = 3;//min value
+                               utf8BufSize = 3; /* min value */
 
                        pUTF8Buff = (char *)calloc(1, utf8BufSize + 1);
                        if (pUTF8Buff == NULL) {
@@ -3694,7 +3689,7 @@ __CATCH:
 
    ==========================================================*/
 
-//  to get message body this function should be modified from message raw file.
+/* to get message body this function should be modified from message raw file. */
 bool MmsReadMsgBody(msg_message_id_t msgID, bool bSavePartsAsTempFiles, bool bRetrieved, char *retrievedPath)
 {
        FILE *pFile     = NULL;
@@ -3703,7 +3698,9 @@ bool MmsReadMsgBody(msg_message_id_t msgID, bool bSavePartsAsTempFiles, bool bRe
        int nSize = 0;
        char szFullPath[MSG_FILEPATH_LEN_MAX] = {0, };
        char szTempMediaDir[MSG_FILEPATH_LEN_MAX] = {0, };
-
+#ifdef FEATURE_CONTAINER_ENABLE
+       char *rootPath = NULL;
+#endif /* FEATURE_CONTAINER_ENABLE */
        MSG_BEGIN();
 
        MmsPluginStorage::instance()->getMmsMessage(&pMsg);
@@ -3753,7 +3750,7 @@ bool MmsReadMsgBody(msg_message_id_t msgID, bool bSavePartsAsTempFiles, bool bRe
        memcpy(&(pMsg->msgType), &(mmsHeader.msgType), sizeof(MsgType));
        memcpy(&(pMsg->msgBody), &(mmsHeader.msgBody), sizeof(MsgBody));
 
-{//attribute convert mmsHeader -> mmsAttribute
+{ /* attribute convert mmsHeader -> mmsAttribute */
 
        pMsg->mmsAttrib.contentType = (MimeType)mmsHeader.msgType.type;
 
@@ -3789,11 +3786,11 @@ bool MmsReadMsgBody(msg_message_id_t msgID, bool bSavePartsAsTempFiles, bool bRe
 
        pMsg->mmsAttrib.retrieveStatus = mmsHeader.retrieveStatus;
 
-       //FIXME:: mmsHeader will release after delete global mmsHeader
-       //memset(&(mmsHeader.msgBody), 0x00, sizeof(MsgBody));//After copy to MmsMsg
+       /* FIXME:: mmsHeader will release after delete global mmsHeader */
+       /* memset(&(mmsHeader.msgBody), 0x00, sizeof(MsgBody)); */ /* After copy to MmsMsg */
 }
        if (pMsg->msgBody.pPresentationBody) {
-               if(MsgFseek(pFile, pMsg->msgBody.pPresentationBody->offset, SEEK_SET) < 0)
+               if (MsgFseek(pFile, pMsg->msgBody.pPresentationBody->offset, SEEK_SET) < 0)
                        goto __CATCH;
 
                pMsg->msgBody.pPresentationBody->body.pText = (char *)calloc(1, pMsg->msgBody.pPresentationBody->size + 1);
@@ -3826,8 +3823,18 @@ bool MmsReadMsgBody(msg_message_id_t msgID, bool bSavePartsAsTempFiles, bool bRe
        }
 
        /*      make temporary  */
+#ifdef FEATURE_CONTAINER_ENABLE
+       rootPath = MsgZoneGetRootPath();
+       if (rootPath) {
+               snprintf(szTempMediaDir, MSG_FILEPATH_LEN_MAX, "%s%s%s.dir", rootPath, MSG_DATA_PATH, pMsg->szFileName);
+               g_free(rootPath);
+               rootPath = NULL;
+       } else {
+               snprintf(szTempMediaDir, MSG_FILEPATH_LEN_MAX, "%s%s.dir", MSG_DATA_PATH, pMsg->szFileName);
+       }
+#else /* FEATURE_CONTAINER_ENABLE */
        snprintf(szTempMediaDir, MSG_FILEPATH_LEN_MAX, "%s%s.dir", MSG_DATA_PATH, pMsg->szFileName);
-
+#endif /* FEATURE_CONTAINER_ENABLE */
        if (MsgIsMultipart(pMsg->msgType.type) == true) {
                int partIndex = 0;
                pMultipart = pMsg->msgBody.body.pMultipart;
@@ -3863,7 +3870,7 @@ bool MmsReadMsgBody(msg_message_id_t msgID, bool bSavePartsAsTempFiles, bool bRe
                        partIndex ++;
                }
 
-       } else { //single part
+       } else { /* single part */
                if (pMsg->nPartCount > 0) {
 
                        if (bSavePartsAsTempFiles) {
@@ -4015,10 +4022,10 @@ char *MsgChangeHexString(char *pOrg)
 
        for (cIndex = 0; cIndex< cLen ; cIndex++) {
                if (pOrg[cIndex] == '%') {
-                       if (pOrg[cIndex+1] != 0 && pOrg[cIndex+2] != 0)         {
-                               snprintf(szBuf, sizeof(szBuf), "%c%c", pOrg[cIndex+1], pOrg[cIndex+2]); // read two chars after '%'
+                       if (pOrg[cIndex+1] != 0 && pOrg[cIndex+2] != 0) {
+                               snprintf(szBuf, sizeof(szBuf), "%c%c", pOrg[cIndex+1], pOrg[cIndex+2]); /* read two chars after '%' */
 
-                               if (__MsgIsHexChar(szBuf) == true) { // check the two character is between  0 ~ F
+                               if (__MsgIsHexChar(szBuf) == true) { /* check the two character is between  0 ~ F */
                                        OneChar = __MsgConvertHexValue(szBuf);
 
                                        pNew[index] = OneChar;
@@ -4087,7 +4094,7 @@ static bool __MsgParseParameter(MsgType *pType, char *pSrc)
                                if ((pTest = strchr(pValue, MSG_CH_QUOT)) != NULL)
                                        *pTest = MSG_CH_NULL;
 
-                               pDec = MsgDecodeText(pValue);           // Api is to long, consider Add to another file (MsgMIMECodec.c)
+                               pDec = MsgDecodeText(pValue);           /* Api is to long, consider Add to another file (MsgMIMECodec.c) */
                        } else {
                                pDec = MsgDecodeText(pName);
                        }
@@ -4104,14 +4111,11 @@ static bool __MsgParseParameter(MsgType *pType, char *pSrc)
                                        break;
 
                                case MSG_PARAM_CHARSET:
-                                       if (pDec != NULL) {
-                                               pType->param.charset = MmsGetTextType(MmsCodeParameterCode, pDec);
+                                       pType->param.charset = MmsGetTextType(MmsCodeParameterCode, pDec);
 
-                                               if (pType->param.charset == -1)
-                                                       pType->param.charset = MSG_CHARSET_UNKNOWN;
-                                       } else {
+                                       if (pType->param.charset == -1)
                                                pType->param.charset = MSG_CHARSET_UNKNOWN;
-                                       }
+
                                        MSG_SEC_INFO("type = %d    [charset] = %d", pType->type, pType->param.charset);
                                        break;
 
@@ -4147,7 +4151,7 @@ static bool __MsgParseParameter(MsgType *pType, char *pSrc)
                                                        szSrc = NULL;
                                                }
 
-                                               // Remvoe '/', ex) Content-Type: image/gif; name="images/vf7.gif"
+                                               /* Remvoe '/', ex) Content-Type: image/gif; name="images/vf7.gif" */
                                                __MsgRemoveFilePath(pType->param.szName);
                                        } else {
                                                MSG_SEC_DEBUG("MsgConvertLatin2UTF8FileName(%s) return NULL", pDec);
@@ -4187,7 +4191,7 @@ static bool __MsgParseParameter(MsgType *pType, char *pSrc)
                                                        szSrc = NULL;
                                                }
 
-                                               // Remvoe '/', ex) Content-Type: image/gif; name="images/vf7.gif"
+                                               /* Remvoe '/', ex) Content-Type: image/gif; name="images/vf7.gif" */
                                                __MsgRemoveFilePath(pType->param.szFileName);
                                        } else {
                                                MSG_SEC_DEBUG("MsgConvertLatin2UTF8FileName(%s) return NULL", pDec);
@@ -4217,7 +4221,7 @@ static bool __MsgParseParameter(MsgType *pType, char *pSrc)
 
                                        break;
 
-                               case MSG_PARAM_START_INFO :
+                               case MSG_PARAM_START_INFO:
 
                                        /* Only if content-type is multipart/related */
 
@@ -4228,11 +4232,11 @@ static bool __MsgParseParameter(MsgType *pType, char *pSrc)
 
                                        break;
 
-                               case MSG_PARAM_REPORT_TYPE :
+                               case MSG_PARAM_REPORT_TYPE:
 
-                                       //  only used as parameter of Content-Type: multipart/report; report-type=delivery-status;
+                                       /* only used as parameter of Content-Type: multipart/report; report-type=delivery-status; */
 
-                                       if (pDec != NULL && strcasecmp(pDec, "delivery-status") == 0) {
+                                       if (strcasecmp(pDec, "delivery-status") == 0) {
                                                pType->param.reportType = MSG_PARAM_REPORT_TYPE_DELIVERY_STATUS;
                                        } else {
                                                pType->param.reportType = MSG_PARAM_REPORT_TYPE_UNKNOWN;
@@ -4274,11 +4278,10 @@ static char *__MsgSkipComment (char *s,long trim)
        char *s1 = s;
        char *t = NULL;
 
-       // ignore empty space
-       for (ret = ++s1; *ret == ' '; ret++)
-               ;
+       /* ignore empty space */
+       for (ret = ++s1; *ret == ' '; ret++);
 
-       // handle '(', ')', '\',  '\0'
+       /* handle '(', ')', '\',  '\0' */
        do {
                switch (*s1) {
                case '(':
@@ -4317,10 +4320,9 @@ __NULL_RETURN:
 static char *__MsgConvertLatin2UTF8FileName(char *pSrc)
 {
        char *pUTF8Buff  = NULL;
-//     char *pData = NULL;
+/*     char *pData = NULL; */
 
-
-       //convert utf8 string
+       /* convert utf8 string */
        if (MmsIsUtf8String((unsigned char*)pSrc, strlen(pSrc)) == false) {
                int length  = 0;
                int utf8BufSize = 0;
@@ -4328,7 +4330,7 @@ static char *__MsgConvertLatin2UTF8FileName(char *pSrc)
                length = strlen(pSrc);
                utf8BufSize = __MsgGetLatin2UTFCodeSize((unsigned char*)pSrc, length);
                if (utf8BufSize < 3)
-                       utf8BufSize = 3; //min value
+                       utf8BufSize = 3; /* min value */
 
                pUTF8Buff = (char *)calloc(1, utf8BufSize + 1);
 
@@ -4353,15 +4355,16 @@ static char *__MsgConvertLatin2UTF8FileName(char *pSrc)
                memcpy(pUTF8Buff, pSrc, length);
        }
 
-       //convert hex string
-//     if (__MsgIsPercentSign(pUTF8Buff) == true) {
-//             pData = MsgChangeHexString(pUTF8Buff);
-//             if (pData) {
-//                     free(pUTF8Buff);
-//                     pUTF8Buff = pData;
-//             }
-//     }
-
+       /* convert hex string */
+/*
+       if (__MsgIsPercentSign(pUTF8Buff) == true) {
+               pData = MsgChangeHexString(pUTF8Buff);
+               if (pData) {
+                       free(pUTF8Buff);
+                       pUTF8Buff = pData;
+               }
+       }
+*/
        return pUTF8Buff;
 
 __CATCH:
@@ -4409,7 +4412,7 @@ static bool __MsgChangeSpace(char *pOrg, char **ppNew)
 
 static void __MsgRemoveFilePath(char *pSrc)
 {
-       // Remvoe '/', ex) Content-Type: image/gif; name="images/vf7.gif"
+       /* Remvoe '/', ex) Content-Type: image/gif; name="images/vf7.gif" */
        char *pTemp = NULL;
        char *tmp_name = NULL;
 
@@ -4420,9 +4423,9 @@ static void __MsgRemoveFilePath(char *pSrc)
                tmp_name = NULL;
        }
 
-       // Remove additional file information
-       // ex) Content-type: application/octet-stream; name="060728gibson_210.jpg?size=s"
-       // if "?size=" exist, insert NULL char.
+       /* Remove additional file information
+        * ex) Content-type: application/octet-stream; name="060728gibson_210.jpg?size=s"
+        * if "?size=" exist, insert NULL char. */
        {
                pTemp = strcasestr(pSrc, "?size=");
                if (pTemp != NULL)
@@ -4455,7 +4458,7 @@ static MsgPresentationFactor __MsgIsPresentationEx(MsgType *multipartType, char*
        char szTmpContentLO[MSG_MSG_ID_LEN + 3] = { 0, };
        int strLen = 0;
 
-       // remove '<' and '>' in Start Param : contentID ex] <0_1.jpg> or <1233445>
+       /* remove '<' and '>' in Start Param : contentID ex] <0_1.jpg> or <1233445> */
        if (szStart && szStart[0]) {
                int startLen = 0;
                startLen = strlen(szStart);
@@ -4466,7 +4469,7 @@ static MsgPresentationFactor __MsgIsPresentationEx(MsgType *multipartType, char*
                }
        }
 
-       // remove '<' and '>' in ContentID : contentID ex] <0_1.jpg> or <1233445>
+       /* remove '<' and '>' in ContentID : contentID ex] <0_1.jpg> or <1233445> */
        if (multipartType->szContentID[0])      {
                strLen = strlen(multipartType->szContentID);
                if (multipartType->szContentID[0] == '<' && multipartType->szContentID[strLen - 1] == '>') {
@@ -4476,7 +4479,7 @@ static MsgPresentationFactor __MsgIsPresentationEx(MsgType *multipartType, char*
                }
        }
 
-       // remove '<' and '>' in ContentLocation : contentID ex] <0_1.jpg> or <1233445>
+       /* remove '<' and '>' in ContentLocation : contentID ex] <0_1.jpg> or <1233445> */
        if (multipartType->szContentLocation[0]) {
                strLen = strlen(multipartType->szContentLocation);
                if (multipartType->szContentLocation[0] == '<' && multipartType->szContentLocation[strLen - 1] == '>') {
@@ -4489,9 +4492,9 @@ static MsgPresentationFactor __MsgIsPresentationEx(MsgType *multipartType, char*
        if ((szTmpContentID[0] == '\0') && (szTmpContentLO[0] == '\0') && (multipartType->type == MIME_UNKNOWN))
                return  MSG_PRESENTATION_NONE;
 
-       // exception handling
+       /* exception handling */
        if (szTmpStart[0] != '\0') {
-               // presentation part : 1.compare with contentID 2.compare with content Location 3. compare with type
+               /* presentation part : 1.compare with contentID 2.compare with content Location 3. compare with type */
                if (strcmp(szTmpStart, szTmpContentID) == 0) {
                        return MSG_PRESENTATION_ID;
                } else if (strcmp(szTmpStart, szTmpContentLO) == 0) {
@@ -4517,9 +4520,9 @@ static void __MsgConfirmPresentationPart(MsgType *pMsgType, MsgBody *pMsgBody, M
        MsgMultipart *pRemovePart = NULL;
 
        if (__MsgIsMultipartRelated(pMsgType->type)) {
-               // assign the multipart to presentation part
-               // remove the multipart(pCurPresentation) which is presentation part from the linked list.
-               // if there is no presentation part -> assign first multipart to presentation part by force.
+               /* assign the multipart to presentation part */
+               /* remove the multipart(pCurPresentation) which is presentation part from the linked list. */
+               /* if there is no presentation part -> assign first multipart to presentation part by force. */
                if (pPresentationInfo->pCurPresentation == NULL) {
                        pPresentationInfo->pCurPresentation     = pMsgBody->body.pMultipart;
                        pPresentationInfo->pPrevPart            = NULL;
@@ -4533,9 +4536,9 @@ static void __MsgConfirmPresentationPart(MsgType *pMsgType, MsgBody *pMsgBody, M
                        memcpy(&pMsgBody->presentationType, &pPresentationInfo->pCurPresentation->type, sizeof(MsgType));
                        pMsgBody->pPresentationBody = pPresentationInfo->pCurPresentation->pBody;
 
-                       // remove pCurPresentation from multipart linked list
+                       /* remove pCurPresentation from multipart linked list */
                        if ((pPresentationInfo->factor == MSG_PRESENTATION_NONE)||(pPresentationInfo->pPrevPart == NULL)) {
-                               // first part
+                               /* first part */
                                pMsgBody->body.pMultipart = pPresentationInfo->pCurPresentation->pNext;
                                pMsgType->contentSize -= pPresentationInfo->pCurPresentation->pBody->size;
                                pMsgBody->size -= pPresentationInfo->pCurPresentation->pBody->size;
@@ -4547,7 +4550,7 @@ static void __MsgConfirmPresentationPart(MsgType *pMsgType, MsgBody *pMsgBody, M
                                        pPresentationInfo->pCurPresentation = NULL;
                                }
                        } else {
-                               // not a first part
+                               /* not a first part */
                                pPresentationInfo->pPrevPart->pNext = pPresentationInfo->pCurPresentation->pNext;
                                pMsgType->contentSize -= pPresentationInfo->pCurPresentation->pBody->size;
                                pMsgBody->size -= pPresentationInfo->pCurPresentation->pBody->size;
@@ -4561,14 +4564,14 @@ static void __MsgConfirmPresentationPart(MsgType *pMsgType, MsgBody *pMsgBody, M
                         * In this case, leave the Presentation part as a multipart and remove other multiparts.
                         */
 
-                       // Backup the multipart link information
+                       /* Backup the multipart link information */
                        pNextPart = pMsgBody->body.pMultipart;
 
-                       // Copy presentation part as a main part
+                       /* Copy presentation part as a main part */
                        memcpy(pMsgType, &pPresentationInfo->pCurPresentation->type, sizeof(MsgType));
                        memcpy(pMsgBody, pPresentationInfo->pCurPresentation->pBody, sizeof(MsgBody));
 
-                       // Remove multipart linked list
+                       /* Remove multipart linked list */
                        while (pNextPart) {
                                pRemovePart = pNextPart;
                                pNextPart = pNextPart->pNext;
@@ -4583,8 +4586,6 @@ static void __MsgConfirmPresentationPart(MsgType *pMsgType, MsgBody *pMsgBody, M
                                pRemovePart = NULL;
                        }
                } else {
-
-
                        MmsReleaseMsgDRMInfo(&pMsgBody->presentationType.drmInfo);
 
                        MmsInitMsgType(&pMsgBody->presentationType);
@@ -4638,7 +4639,7 @@ static bool __MsgResolveNestedMultipart(MsgType *pPartType, MsgBody *pPartBody)
 
                pSelectedPart = pPartBody->body.pMultipart;
 
-               // NULL Pointer check!!
+               /* NULL Pointer check!! */
                if (pSelectedPart == NULL) {
                        MSG_DEBUG("multipart(ALTERNATIVE) does not exist");
                        break;
@@ -4789,7 +4790,7 @@ static bool __MsgResolveNestedMultipart(MsgType *pPartType, MsgBody *pPartBody)
 
                                pFirstPart = pSelectedPart->pBody->body.pMultipart;
 
-                               // NULL Pointer check!!
+                               /* NULL Pointer check!! */
                                if (pFirstPart == NULL) {
                                        MSG_DEBUG("multipart does not exist");
                                        break;
@@ -4868,7 +4869,7 @@ static bool __MsgResolveNestedMultipart(MsgType *pPartType, MsgBody *pPartBody)
                        }
                } else {
                        if (pPrevPart == NULL) {
-                               // first part is selected
+                               /* first part is selected */
                                pRemoveList = pPartBody->body.pMultipart->pNext;
                        } else {
                                pRemoveList = pPartBody->body.pMultipart->pNext;
@@ -4974,7 +4975,7 @@ __CATCH:
 
 char *MsgRemoveQuoteFromFilename(char *pSrc)
 {
-       int cLen = 0;   // length of pBuff
+       int cLen = 0;   /* length of pBuff */
        char *pBuff = NULL;
 
        if (pSrc == NULL) {
@@ -4992,7 +4993,7 @@ char *MsgRemoveQuoteFromFilename(char *pSrc)
        }
        memset(pBuff, 0 , sizeof(char)*(cLen + 1));
 
-       // remove front quote
+       /* remove front quote */
        if (pSrc[0] == MSG_CH_QUOT) {
                cLen--;
                strncpy(pBuff, &pSrc[1], cLen);
@@ -5006,7 +5007,7 @@ char *MsgRemoveQuoteFromFilename(char *pSrc)
                strncpy(pBuff, pSrc, cLen);
        }
 
-       // remove last qoute
+       /* remove last qoute */
        if (pBuff[cLen-1] == MSG_CH_QUOT) {
                pBuff[cLen-1] = '\0';
        }
@@ -5082,10 +5083,10 @@ static int __MsgConvertCharToInt(char ch)
 
 static bool __MsgCopyNestedMsgType(MsgType *pMsgType1, MsgType *pMsgType2)
 {
-       if(!pMsgType1 || !pMsgType2)
+       if (!pMsgType1 || !pMsgType2)
                return false;
 
-       //if (pMsgType1->section == INVALID_HOBJ)
+/*     if (pMsgType1->section == INVALID_HOBJ) */
                pMsgType1->section = pMsgType2->section;
 
        int length = 0;
@@ -5234,7 +5235,7 @@ static int __MsgLatin2UTF(unsigned char *des, int outBufSize, unsigned char *szS
        MSG_DEBUG("---------------");
 
        org = des;
-       outBufSize--;                   // NULL character
+       outBufSize--;                   /* NULL character */
 
        while ((nChar > 0) && (*szSrc != '\0')) {
                if (0x01 <= *szSrc && *szSrc <= 0x7F) {
@@ -5256,8 +5257,8 @@ static int __MsgLatin2UTF(unsigned char *des, int outBufSize, unsigned char *szS
                        if (outBufSize < 0)
                                goto __RETURN;
 
-                       t2 = (unsigned char) (*szSrc & 0x003F);                         //      right most 6 bit
-                       t1 = (unsigned char) ((*szSrc & 0xC0) >> 6);            //      right most 2 bit
+                       t2 = (unsigned char) (*szSrc & 0x003F);                         /* right most 6 bit */
+                       t1 = (unsigned char) ((*szSrc & 0xC0) >> 6);            /* right most 2 bit */
 
                        *des = 0xC0 | (t1 & 0x1F);
                        *(des + 1) = 0x80 | (t2 & 0x3F);
@@ -5322,37 +5323,35 @@ bool MmsAddrUtilRemovePlmnString(char *pszAddr)
                if (!pszStrEnd) {
                        char *pszStart = NULL;
                        char *pszEnd = NULL;
-                       // "/TYPE=PLMN" not found
+                       /* "/TYPE=PLMN" not found */
 
                        int remainedLen = strlen(pszStrStart);
 
                        if (remainedLen <= 0)
                                break;
 
-                       //Email address can occur with Sender Name<email-address> format
-                       //remove the Sender name and only retain the email address.
+                       /* Email address can occur with Sender Name<email-address> format */
+                       /* remove the Sender name and only retain the email address. */
                        pszStart = strstr(pszStrStart, "<");
                        if (pszStart) {
                                pszEnd = strstr(pszStrStart, ">");
 
                                if (pszEnd) {
-                                       pszStart++; //skip "<"
+                                       pszStart++; /* skip "<" */
                                        g_strlcat(pszAddr, pszStart, pszEnd - pszStart + 1);
                                        break;
                                }
                        }
-
-                       //strcat(pszAddr, pszStrStart);
                        g_strlcat(pszAddr, pszStrStart, strLen + 1);
                        break;
                }
 
-               // Get one address length
+               /* Get one address length */
                addressLen = pszStrEnd - pszStrStart;
 
                strncat(pszAddr, pszStrStart, addressLen);
 
-               // Find next address
+               /* Find next address */
                pszStrStart = pszStrEnd;
 
                pszStrTemp = strstr(pszStrStart, MSG_MMS_STR_ADDR_DELIMETER);
@@ -5364,12 +5363,11 @@ bool MmsAddrUtilRemovePlmnString(char *pszAddr)
                        pszStrStart += strlen(pszStrEnd);
                }
 
-               if (pszStrStart[0] == 0)        // end of string
+               if (pszStrStart[0] == 0)        /* end of string */
                        break;
 
-
-               g_strlcat(pszAddr, MSG_MMS_STR_ADDR_DELIMETER, strLen + 1);     // add ';'
-               pszStrStart++;  // remove ';'
+               g_strlcat(pszAddr, MSG_MMS_STR_ADDR_DELIMETER, strLen + 1);     /* add ';' */
+               pszStrStart++;  /* remove ';' */
        }
 
        if (pszAddr[0] == 0)
@@ -5387,7 +5385,7 @@ static int __MsgCutUTFString(unsigned char *des, int outBufSize, unsigned char *
        MSG_DEBUG("---------------");
 
        org = des;
-       outBufSize--;                   // NULL character
+       outBufSize--;                   /* NULL character */
 
        while ((nChar > 0) && (*szSrc != '\0')) {
                if (*szSrc < 0x80) {
@@ -5539,8 +5537,8 @@ static bool __MsgLoadDataToDecodeBuffer(FILE *pFile, char **ppBuf, int *pPtr, in
 static bool __MmsMultipartSaveAsTempFile(MsgType *pPartType, MsgBody *pPartBody, char *pszMailboxPath, char *pszMsgFilename, int index, bool bSave)
 {
        FILE *pFile = NULL;
-       char szFileName[MSG_FILENAME_LEN_MAX+1] = {0, };        // file name of temp file
-       char szFullPath[MSG_FILEPATH_LEN_MAX] = {0, }; // full absolute path of temp file.
+       char szFileName[MSG_FILENAME_LEN_MAX+1] = {0, };        /* file name of temp file */
+       char szFullPath[MSG_FILEPATH_LEN_MAX] = {0, }; /* full absolute path of temp file. */
        bool bFileExist = false;
        MSG_BEGIN();
 
@@ -5564,15 +5562,26 @@ static bool __MmsMultipartSaveAsTempFile(MsgType *pPartType, MsgBody *pPartBody,
                }
        }
 
-       // make full path for save
-       __MsgMakeFileName(pPartType->type, szFileName, pPartType->drmInfo.drmType, 0, szFileName, sizeof(szFileName));  //FL & CD -> extension(.dm) SD -> extension(.dcf)
+       /* make full path for save */
+       __MsgMakeFileName(pPartType->type, szFileName, pPartType->drmInfo.drmType, 0, szFileName, sizeof(szFileName));  /* FL & CD -> extension(.dm) SD -> extension(.dcf) */
 
-       snprintf(szFullPath, MSG_FILEPATH_LEN_MAX, "%s%s.dir/%s", pszMailboxPath, pszMsgFilename, szFileName);  // get absolute path of each temp file of each part
+#ifdef FEATURE_CONTAINER_ENABLE
+       char *rootPath = MsgZoneGetRootPath();
+       if (rootPath) {
+               snprintf(szFullPath, MSG_FILEPATH_LEN_MAX, "%s%s%s.dir/%s", rootPath, pszMailboxPath, pszMsgFilename, szFileName);      /* get absolute path of each temp file of each part */
+               g_free(rootPath);
+               rootPath = NULL;
+       } else {
+               snprintf(szFullPath, MSG_FILEPATH_LEN_MAX, "%s%s.dir/%s", pszMailboxPath, pszMsgFilename, szFileName);  /* get absolute path of each temp file of each part */
+       }
+#else /* FEATURE_CONTAINER_ENABLE */
+       snprintf(szFullPath, MSG_FILEPATH_LEN_MAX, "%s%s.dir/%s", pszMailboxPath, pszMsgFilename, szFileName);  /* get absolute path of each temp file of each part */
+#endif /* FEATURE_CONTAINER_ENABLE */
 
        if (pPartType->type == MIME_APPLICATION_OCTET_STREAM)
                MmsGetMimeTypeFromFileName(MIME_MAINTYPE_UNKNOWN, szFullPath, (MimeType *)&pPartType->type, NULL);
 
-       // save file
+       /* save file */
        bFileExist = MsgAccessFile(szFullPath, F_OK);
 
        MSG_SEC_DEBUG("save flag  [%d],  filepath [%s], file exist [%d]", bSave, szFullPath, bFileExist);
@@ -5594,7 +5603,7 @@ static bool __MmsMultipartSaveAsTempFile(MsgType *pPartType, MsgBody *pPartBody,
 
                snprintf(pPartBody->szOrgFilePath, sizeof(pPartBody->szOrgFilePath), "%s", szFullPath);
 
-               //IF DRM type Convert to dcf
+               /* IF DRM type Convert to dcf */
                if (pPartType->type == MIME_APPLICATION_VND_OMA_DRM_MESSAGE
                        || pPartType->type == MIME_APPLICATION_VND_OMA_DRM_CONTENT)
                {
@@ -5638,7 +5647,7 @@ static bool __MmsMultipartSaveAsTempFile(MsgType *pPartType, MsgBody *pPartBody,
        } else {
                snprintf(pPartBody->szOrgFilePath, sizeof(pPartBody->szOrgFilePath), "%s", szFullPath);
 
-               //IF DRM type check dcf exist
+               /* IF DRM type check dcf exist */
                if (pPartType->type == MIME_APPLICATION_VND_OMA_DRM_MESSAGE
                        || pPartType->type == MIME_APPLICATION_VND_OMA_DRM_CONTENT)
                {
@@ -5664,9 +5673,9 @@ static bool __MmsMultipartSaveAsTempFile(MsgType *pPartType, MsgBody *pPartBody,
                MSG_SEC_DEBUG("Set Part File to [%s]", pPartBody->szOrgFilePath);
        }
 
-       //file name fix
+       /* file name fix */
        if (szFileName[0]  != '\0') {
-               snprintf(pPartType->param.szFileName, MSG_FILENAME_LEN_MAX+1, "%s.dir/%s", pszMsgFilename, szFileName);// store relative path of each temp file of each part including sub folder.
+               snprintf(pPartType->param.szFileName, MSG_FILENAME_LEN_MAX+1, "%s.dir/%s", pszMsgFilename, szFileName); /* store relative path of each temp file of each part including sub folder. */
                snprintf(pPartType->param.szName, MSG_LOCALE_FILENAME_LEN_MAX+1, "%s", szFileName);
                MSG_SEC_DEBUG("Set Name : %s", pPartType->param.szName);
        }
@@ -5824,7 +5833,7 @@ char *__MmsGetBinaryUTF8Data(char *pData, int nRead, int msgEncodingValue, int m
                        *npRead = nTemp;
                } else if (msgCharsetValue == MSG_CHARSET_UTF8) {
 
-                       // skip BOM (Byte Order Mark) bytes .. (Please refer to the http://www.unicode.org/faq/utf_bom.html#BOM)
+                       /* skip BOM (Byte Order Mark) bytes .. (Please refer to the http://www.unicode.org/faq/utf_bom.html#BOM) */
                        if (nTemp >= 3) {
                                if (((UINT8)pTemp[0]) == 0xEF && ((UINT8)pTemp[1]) == 0xBB && ((UINT8)pTemp[2]) == 0xBF) {
                                        pTemp += 3;
@@ -5853,7 +5862,7 @@ char *__MmsGetBinaryUTF8Data(char *pData, int nRead, int msgEncodingValue, int m
                                        *npRead = nTemp;
                                }
 
-                       } else {//unsupported charset
+                       } else { /* unsupported charset */
                                MSG_DEBUG("unsupported charset");
                                pNewData = pTemp;
                                *npRead = nTemp;
@@ -5914,7 +5923,7 @@ static bool __MsgMakeFileName(int iMsgType, char *szFileName, MsgDrmType drmType
        if (szFileName == NULL)
                return false;
 
-       //Filename
+       /* Filename */
        int inp_len = strlen(szFileName);
        if (inp_len > 0) {
 
@@ -5935,13 +5944,13 @@ static bool __MsgMakeFileName(int iMsgType, char *szFileName, MsgDrmType drmType
                }
        }
 
-       //extension
+       /* extension */
        if (iMsgType == MIME_APPLICATION_VND_OMA_DRM_MESSAGE)
                pExt = "dm";
        else if (iMsgType == MIME_APPLICATION_VND_OMA_DRM_CONTENT)
                pExt = "dcf";
 
-       if (pExt == NULL) { // find ext from content type
+       if (pExt == NULL) { /* find ext from content type */
 
                if (iMsgType == MIME_APPLICATION_OCTET_STREAM || iMsgType == MIME_UNKNOWN) {
                        MSG_DEBUG("unsupported MsgType [%d]", iMsgType);
@@ -5951,7 +5960,7 @@ static bool __MsgMakeFileName(int iMsgType, char *szFileName, MsgDrmType drmType
                pExt = MimeGetExtFromMimeInt((MimeType)iMsgType);
        }
 
-       //Filename + extension
+       /* Filename + extension */
        if (pExt) {
                snprintf(szTemp, sizeof(szTemp), "%s.%s", szTempFileName, pExt);
        } else {
@@ -6063,6 +6072,9 @@ void MmsPluginDecoder::decodeMmsPdu(MmsMsg *pMsg, msg_message_id_t msgID, const
 
        FILE *pFile     = NULL;
        MsgMultipart *pMultipart = NULL;
+#ifdef FEATURE_CONTAINER_ENABLE
+       char *rootPath = NULL;
+#endif /* FEATURE_CONTAINER_ENABLE */
        int nSize = 0;
        char szFullPath[MSG_FILEPATH_LEN_MAX] = {0, };
        char szTempMediaDir[MSG_FILEPATH_LEN_MAX] = {0, };
@@ -6103,7 +6115,7 @@ void MmsPluginDecoder::decodeMmsPdu(MmsMsg *pMsg, msg_message_id_t msgID, const
        memcpy(&(pMsg->msgType), &(mmsHeader.msgType), sizeof(MsgType));
        memcpy(&(pMsg->msgBody), &(mmsHeader.msgBody), sizeof(MsgBody));
 
-{//attribute convert mmsHeader -> mmsAttribute
+{ /* attribute convert mmsHeader -> mmsAttribute */
 
        pMsg->mmsAttrib.contentType = (MimeType)mmsHeader.msgType.type;
 
@@ -6141,11 +6153,11 @@ void MmsPluginDecoder::decodeMmsPdu(MmsMsg *pMsg, msg_message_id_t msgID, const
 
        pMsg->mmsAttrib.retrieveStatus = mmsHeader.retrieveStatus;
 
-       //FIXME:: mmsHeader will release after delete global mmsHeader
-       //memset(&(mmsHeader.msgBody), 0x00, sizeof(MsgBody));//After copy to MmsMsg
+       /* FIXME:: mmsHeader will release after delete global mmsHeader */
+       /* memset(&(mmsHeader.msgBody), 0x00, sizeof(MsgBody)); */ /* After copy to MmsMsg */
 }
        if (pMsg->msgBody.pPresentationBody) {
-               if(MsgFseek(pFile, pMsg->msgBody.pPresentationBody->offset, SEEK_SET) < 0)
+               if (MsgFseek(pFile, pMsg->msgBody.pPresentationBody->offset, SEEK_SET) < 0)
                        goto __CATCH;
 
                pMsg->msgBody.pPresentationBody->body.pText = (char *)calloc(1, pMsg->msgBody.pPresentationBody->size + 1);
@@ -6178,24 +6190,33 @@ void MmsPluginDecoder::decodeMmsPdu(MmsMsg *pMsg, msg_message_id_t msgID, const
        }
 
        /*      make temporary  */
+#ifdef FEATURE_CONTAINER_ENABLE
+       rootPath = MsgZoneGetRootPath();
+       if (rootPath) {
+               snprintf(szTempMediaDir, MSG_FILEPATH_LEN_MAX, "%s%s%s.dir", rootPath, MSG_DATA_PATH, pMsg->szFileName);
+               g_free(rootPath);
+               rootPath = NULL;
+       } else {
+               snprintf(szTempMediaDir, MSG_FILEPATH_LEN_MAX, "%s%s.dir", MSG_DATA_PATH, pMsg->szFileName);
+       }
+#else /* FEATURE_CONTAINER_ENABLE */
        snprintf(szTempMediaDir, MSG_FILEPATH_LEN_MAX, "%s%s.dir", MSG_DATA_PATH, pMsg->szFileName);
+#endif /* FEATURE_CONTAINER_ENABLE */
 
        if (MsgIsMultipart(pMsg->msgType.type) == true) {
                int partIndex = 0;
                pMultipart = pMsg->msgBody.body.pMultipart;
 
-               //if (bSavePartsAsTempFiles) {
-                       if (mkdir(szTempMediaDir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) < 0) {
-                               if (errno == EEXIST) {
-                                       MSG_SEC_DEBUG("exist dir : [%s]", szTempMediaDir);
-                               } else {
-                                       MSG_SEC_DEBUG("Fail to Create Dir [%s]", szTempMediaDir);
-                                       goto __CATCH;
-                               }
+               if (mkdir(szTempMediaDir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) < 0) {
+                       if (errno == EEXIST) {
+                               MSG_SEC_DEBUG("exist dir : [%s]", szTempMediaDir);
                        } else {
-                               MSG_SEC_DEBUG("make dir : [%s]", szTempMediaDir);
+                               MSG_SEC_DEBUG("Fail to Create Dir [%s]", szTempMediaDir);
+                               goto __CATCH;
                        }
-               //}
+               } else {
+                       MSG_SEC_DEBUG("make dir : [%s]", szTempMediaDir);
+               }
 
                if (pMsg->msgBody.pPresentationBody) {
                        if (__MmsMultipartSaveAsTempFile(&pMsg->msgBody.presentationType, pMsg->msgBody.pPresentationBody,
@@ -6215,21 +6236,18 @@ void MmsPluginDecoder::decodeMmsPdu(MmsMsg *pMsg, msg_message_id_t msgID, const
                        partIndex ++;
                }
 
-       } else { //single part
+       } else { /* single part */
                if (pMsg->nPartCount > 0) {
-
-                       //if (bSavePartsAsTempFiles) {
-                               if (mkdir(szTempMediaDir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) < 0) {
-                                       if (errno == EEXIST) {
-                                               MSG_DEBUG("exist dir : [%s]", szTempMediaDir);
-                                       } else {
-                                               MSG_DEBUG("Fail to Create Dir [%s]", szTempMediaDir);
-                                               goto __CATCH;
-                                       }
+                       if (mkdir(szTempMediaDir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) < 0) {
+                               if (errno == EEXIST) {
+                                       MSG_DEBUG("exist dir : [%s]", szTempMediaDir);
                                } else {
-                                       MSG_DEBUG("make dir : [%s]", szTempMediaDir);
+                                       MSG_DEBUG("Fail to Create Dir [%s]", szTempMediaDir);
+                                       goto __CATCH;
                                }
-                       //}
+                       } else {
+                               MSG_DEBUG("make dir : [%s]", szTempMediaDir);
+                       }
 
                        if (__MmsMultipartSaveAsTempFile(&pMsg->msgType, &pMsg->msgBody,
                                                                                        (char*)MSG_DATA_PATH, pMsg->szFileName, 0, true) == false)
@@ -6261,7 +6279,7 @@ __CATCH:
 
 }
 
-//CID 41989: Removed function decodeMmsPdu which is unused.
+/* CID 41989: Removed function decodeMmsPdu which is unused. */
 #if 0
 void MmsPluginDecoder::decodeMmsPdu(MMS_DATA_S *pMmsData, const char *pduFilePath)
 {
@@ -6362,9 +6380,7 @@ void MmsPluginDecoder::decodeMmsPdu(MMS_DATA_S *pMmsData, const char *pduFilePat
                pMmsData->smil = pMultipart;
        }
 
-
        while (iter_multipart) {
-
                MMS_MULTIPART_DATA_S *pMultipart = MsgMmsCreateMultipart();
 
                pMultipart->type = (MimeType)iter_multipart->type.type;
index abf59b1..adf5b11 100755 (executable)
 using namespace std;
 
 /**  Sending message related variables  ------------------------ */
-static char gszMmsEncodeBuf[MSG_MMS_ENCODE_BUFFER_MAX] = {0, };
-static int gCurMmsEncodeBuffPos = 0;   /* number of characters on gpMmsEncodeBuf */
-static int     gMmsEncodeMaxLen = 0;
-static int     gMmsEncodeCurOffset = 0;        /* offset in file */
-static char *gpMmsEncodeBuf = NULL;
+static char gszMmsEncodeBuf[MSG_MMS_ENCODE_BUFFER_MAX] = {0, };
+static int gCurMmsEncodeBuffPos = 0;   /* number of characters on gpMmsEncodeBuf */
+static int     gMmsEncodeMaxLen = 0;
+static int     gMmsEncodeCurOffset = 0;        /* offset in file */
+static char *gpMmsEncodeBuf = NULL;
 
 /* Acknowledge.ind & NotifyResp.ind related variables ------------------------ */
-static char gszMmsEncodeBuf2[MSG_MMS_ENCODE_BUFFER_MAX] = {0, };
-static int     gCurMmsEncodeBuffPos2 = 0;      /* number of characters on gpMmsEncodeBuf */
-static int     gMmsEncodeMaxLen2 = 0;
-static int     gMmsEncodeCurOffset2 = 0;       /* offset in file */
-static char *gpMmsEncodeBuf2 = NULL;
+static char gszMmsEncodeBuf2[MSG_MMS_ENCODE_BUFFER_MAX] = {0, };
+static int     gCurMmsEncodeBuffPos2 = 0;      /* number of characters on gpMmsEncodeBuf */
+static int     gMmsEncodeMaxLen2 = 0;
+static int     gMmsEncodeCurOffset2 = 0;       /* offset in file */
+static char *gpMmsEncodeBuf2 = NULL;
 
 static int __MmsGetEncodeOffset(void);
 static void __MmsRegisterEncodeBuffer2(char *pInBuff, int maxLen);
 static void __MmsUnregisterEncodeBuffer2(void);
 
-static int __MmsBinaryEncodeUintvarLen(UINT32 integer);
-static bool __MmsBinaryEncodeUintvar(FILE *pFile, UINT32 integer, int length);
-static int __MmsBinaryEncodeValueLengthLen(UINT32 integer);
-static bool __MmsBinaryEncodeValueLength(FILE *pFile, UINT32 integer, int length);
-static int     __MmsBinaryEncodeIntegerLen(UINT32 integer);
-static bool __MmsBinaryEncodeInteger(FILE *pFile, UINT32 integer, int length);
-static int     __MmsBinaryEncodeLongIntegerLen(UINT32 integer);
-static bool __MmsBinaryEncodeLongInteger(FILE *pFile, UINT32 integer, int length);
-static int     __MmsBinaryEncodeTextStringLen(UINT8 *source);
-static bool __MmsBinaryEncodeTextString(FILE *pFile, UINT8 *source, int length);
-static int     __MmsBinaryEncodeQuotedStringLen(UINT8 *pSrc);
-static bool __MmsBinaryEncodeQuotedString(FILE *pFile, UINT8 *source, int length);
-static int     __MmsBinaryEncodeEncodedStringLen(UINT8 *source);
-static bool __MmsBinaryEncodeEncodedString(FILE *pFile, UINT8 *source, int length);
+static int __MmsBinaryEncodeUintvarLen(UINT32 integer);
+static bool __MmsBinaryEncodeUintvar(FILE *pFile, UINT32 integer, int length);
+static int __MmsBinaryEncodeValueLengthLen(UINT32 integer);
+static bool __MmsBinaryEncodeValueLength(FILE *pFile, UINT32 integer, int length);
+static int     __MmsBinaryEncodeIntegerLen(UINT32 integer);
+static bool __MmsBinaryEncodeInteger(FILE *pFile, UINT32 integer, int length);
+static int     __MmsBinaryEncodeLongIntegerLen(UINT32 integer);
+static bool __MmsBinaryEncodeLongInteger(FILE *pFile, UINT32 integer, int length);
+static int     __MmsBinaryEncodeTextStringLen(UINT8 *source);
+static bool __MmsBinaryEncodeTextString(FILE *pFile, UINT8 *source, int length);
+static int     __MmsBinaryEncodeQuotedStringLen(UINT8 *pSrc);
+static bool __MmsBinaryEncodeQuotedString(FILE *pFile, UINT8 *source, int length);
+static int     __MmsBinaryEncodeEncodedStringLen(UINT8 *source);
+static bool __MmsBinaryEncodeEncodedString(FILE *pFile, UINT8 *source, int length);
 
 static int __MmsBinaryEncodeContentTypeLen(MsgType *pType);
 static bool __MmsBinaryEncodeContentType(FILE *pFile, MsgType *pType, int typeLength);
@@ -73,29 +73,29 @@ static bool __MmsBinaryEncodeContentHeader(FILE *pFile, MimeType contentType, Ms
 static bool __MmsBinaryEncodeContentBody(FILE *pFile, MsgBody *pBody);
 static bool __MmsBinaryEncodeMsgPart(FILE *pFile, int contentType, MsgType *pType, MsgBody *pBody);
 
-static bool __MmsBinaryEncodeMmsVersion(FILE *pFile);
-static bool __MmsBinaryEncodeTrID(FILE *pFile, char *szTrID, int bufLen);
-static bool __MmsBinaryEncodeMsgID(FILE *pFile, const char *szMsgID);  /** 2005-05-24, added for read-reply PDU 1.2 */
-static bool __MmsBinaryEncodeFrom(FILE *pFile);
-static bool __MmsBinaryEncodeTime(FILE *pFile, MmsFieldCode fieldCode, MmsTimeStruct time);
-static bool __MmsBinaryEncodeDate(FILE *pFile, time_t inpDateSec);
-static bool __MmsBinaryEncodeOneAddress(FILE *pFile, MmsFieldCode addrType, char *szAddrStr);
-static bool __MmsBinaryEncodeAddress(FILE *pFile, MmsFieldCode addrType, char *szAddr);
+static bool __MmsBinaryEncodeMmsVersion(FILE *pFile);
+static bool __MmsBinaryEncodeTrID(FILE *pFile, char *szTrID, int bufLen);
+static bool __MmsBinaryEncodeMsgID(FILE *pFile, const char *szMsgID);  /** 2005-05-24, added for read-reply PDU 1.2 */
+static bool __MmsBinaryEncodeFrom(FILE *pFile);
+static bool __MmsBinaryEncodeTime(FILE *pFile, MmsFieldCode fieldCode, MmsTimeStruct time);
+static bool __MmsBinaryEncodeDate(FILE *pFile, time_t inpDateSec);
+static bool __MmsBinaryEncodeOneAddress(FILE *pFile, MmsFieldCode addrType, char *szAddrStr);
+static bool __MmsBinaryEncodeAddress(FILE *pFile, MmsFieldCode addrType, char *szAddr);
 
-static bool __MmsBinaryEncodeFieldCodeAndValue(FILE *pFile, UINT8 fieldCode, UINT8 fieldValue);
+static bool __MmsBinaryEncodeFieldCodeAndValue(FILE *pFile, UINT8 fieldCode, UINT8 fieldValue);
 static bool __MmsBinaryEncodeSendReqHdr(FILE *pFile, MmsMsg *pMsg);
 static bool __MmsBinaryEncodeAckIndHdr(FILE *pFile, char *pTrID, bool bReportAllowed);
 static bool __MmsBinaryEncodeNotiRespIndHdr(FILE* pFile, char *pTrID, msg_delivery_report_status_t iStatus, bool bReportAllowed);
 static bool __MmsBinaryEncodeReadReport10Hdr(FILE *pFile, MmsMsg *pMsg, msg_read_report_status_t mmsReadStatus);
 static bool __MmsBinaryEncodeReadReport11Hdr(FILE *pFile, MmsMsg *pMsg, msg_read_report_status_t mmsReadStatus);
 
-static bool __MmsBinaryEncodeMsgBody(FILE *pFile, MsgType *pType, MsgBody *pBody, int nPartCount, bool bTemplate);//NEW_TEMPLATE
+static bool __MmsBinaryEncodeMsgBody(FILE *pFile, MsgType *pType, MsgBody *pBody, int nPartCount, bool bTemplate); /* NEW_TEMPLATE */
 static bool __MmsEncodeSendReq(FILE *pFile, MmsMsg *pMsg, bool bIncludeSendReqHeader);
 
 /* Functions for Acknowledge.ind & NotifyResp.ind  ------------------------ */
-static bool __MmsBinaryEncodeTextString2(FILE *pFile, UINT8 *source, int length);
-static bool __MmsBinaryEncodeMmsVersion2(FILE *pFile);
-static bool __MmsBinaryEncodeFieldCodeAndValue2(FILE *pFile, UINT8 fieldCode, UINT8 fieldValue);
+static bool __MmsBinaryEncodeTextString2(FILE *pFile, UINT8 *source, int length);
+static bool __MmsBinaryEncodeMmsVersion2(FILE *pFile);
+static bool __MmsBinaryEncodeFieldCodeAndValue2(FILE *pFile, UINT8 fieldCode, UINT8 fieldValue);
 
 static char *_MsgSkipWS3(char *s);
 
@@ -103,7 +103,7 @@ static char *_MsgSkipWS3(char *s);
  *                                     M   M   S       E   N   C   O   D   E
  * * -----------------------------------------------------------------*/
 
-static void __MmsCleanEncodeBuff(void)
+static void __MmsCleanEncodeBuff(void)
 {
        memset(gpMmsEncodeBuf, 0, MSG_MMS_ENCODE_BUFFER_MAX);
        gCurMmsEncodeBuffPos = 0;
@@ -164,7 +164,7 @@ static bool __MmsEncodeSendReq(FILE* pFile, MmsMsg* pMsg, bool bIncludeSendReqHe
 
 /* Functions for Acknowledge.ind & NotifyResp.ind ------------------------ */
 
-static void __MmsCleanEncodeBuff2(void)
+static void __MmsCleanEncodeBuff2(void)
 {
        memset(gpMmsEncodeBuf2, 0, MSG_MMS_ENCODE_BUFFER_MAX);
        gCurMmsEncodeBuffPos2 = 0;
@@ -231,7 +231,7 @@ __CATCH:
        return false;
 }
 
-static bool __MmsBinaryEncodeFieldCodeAndValue2(FILE *pFile, UINT8 fieldCode, UINT8 fieldValue)
+static bool __MmsBinaryEncodeFieldCodeAndValue2(FILE *pFile, UINT8 fieldCode, UINT8 fieldValue)
 {
        if ((gMmsEncodeMaxLen2 - gCurMmsEncodeBuffPos2) < 2) {
                if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf2, &gCurMmsEncodeBuffPos2,
@@ -543,14 +543,14 @@ bool MmsEncodeReadReport10(FILE *pFile, MmsMsg *pMsg, msg_read_report_status_t m
        time(&RawTime);
        localtime_r(&RawTime, &dateTime);
 
-       // get report message
+       /* get report message */
        if (mmsReadStatus == MSG_READ_REPORT_IS_DELETED) {
                pszReportMsg = (char*)"Your message has been deleted " ;
        } else {
                pszReportMsg = (char*)"Your message has been read " ;
        }
 
-       // make report body ..
+       /* make report body .. */
        maxLen = strlen (pszReportMsg) +16 /* date string */ + 8 /* enter chars */ ;
 
        if (maxLen > MSG_STDSTR_LONG) {
@@ -560,12 +560,12 @@ bool MmsEncodeReadReport10(FILE *pFile, MmsMsg *pMsg, msg_read_report_status_t m
                                                pszReportMsg, dateTime.tm_year+1900, dateTime.tm_mon+1, dateTime.tm_mday, dateTime.tm_hour, dateTime.tm_min);
        }
 
-       // make header
+       /* make header */
        msgType.type = MIME_APPLICATION_VND_WAP_MULTIPART_MIXED;
        msgType.contentSize = strlen(pText);
        msgType.param.charset = MSG_CHARSET_UNKNOWN;
 
-       // make body
+       /* make body */
        if ((pPart = MmsAllocMultipart()) == NULL) {
                MSG_DEBUG("MsgAllocMultipart Fail");
                goto __CATCH;
@@ -795,7 +795,8 @@ static bool __MmsBinaryEncodeSendReqHdr(FILE *pFile, MmsMsg *pMsg)
        /* MMS-1.3-con-733 */
 
        /* Expiry Time  : Value-length Absolute-token Date-value */
-       if (pMsg->mmsAttrib.expiryTime.type != MMS_TIMETYPE_NONE) {     // for avoiding the creation of the expiry field in case the user selects the maximum
+       if (pMsg->mmsAttrib.expiryTime.type != MMS_TIMETYPE_NONE) {
+               /* for avoiding the creation of the expiry field in case the user selects the maximum */
                if (__MmsBinaryEncodeTime(pFile, MMS_CODE_EXPIRYTIME, pMsg->mmsAttrib.expiryTime) == false) {
                        MSG_DEBUG("expiryTime __MmsBinaryEncodeTime fail");
                        goto __CATCH;
@@ -875,7 +876,7 @@ static bool __MmsBinaryEncodeSendReqHdr(FILE *pFile, MmsMsg *pMsg)
        if ((pMsg->mmsAttrib.replyCharge.chargeType == MMS_REPLY_REQUESTED) ||
                (pMsg->mmsAttrib.replyCharge.chargeType == MMS_REPLY_REQUESTED_TEXT_ONLY)) {
 
-               // reply charging
+               /* reply charging */
                fieldCode = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_REPLYCHARGING)|0x80;
                fieldValue = MmsGetBinaryValue(MmsCodeReadReply, pMsg->mmsAttrib.replyCharge.chargeType)|0x80;
 
@@ -1394,7 +1395,7 @@ static int __MmsBinaryEncodeContentTypeLen(MsgType *pType)
                }
                totalLength += (length + 1);
        } else {
-               if (MmsIsTextType(contentType)) {       // Any-charset
+               if (MmsIsTextType(contentType)) {       /* Any-charset */
                        if (!MmsIsVitemContent (contentType, pType->param.szName))
                                totalLength += 2;
                }
@@ -1414,27 +1415,29 @@ static int __MmsBinaryEncodeContentTypeLen(MsgType *pType)
 
                pszName = g_strdup(pType->param.szName);
 
-               //change empty space to '_' in the file name
-               MmsReplaceSpaceChar(pszName);
+               if (pszName) {
+                       /* change empty space to '_' in the file name */
+                       MmsReplaceSpaceChar(pszName);
 
-               if (isAscii == false) {
-                       if (MsgEncode2Base64(pszName, strlen(pszName), &tmpLength, tmpFileName) == true) {
-                               g_free(pszName);
-                               pszName = g_strdup_printf("=?UTF-8?B?%s?=", tmpFileName);
-                               MSG_DEBUG("base64 encode filename=[%s]", pszName);
+                       if (isAscii == false) {
+                               if (MsgEncode2Base64(pszName, strlen(pszName), &tmpLength, tmpFileName) == true) {
+                                       g_free(pszName);
+                                       pszName = g_strdup_printf("=?UTF-8?B?%s?=", tmpFileName);
+                                       MSG_DEBUG("base64 encode filename=[%s]", pszName);
+                               }
                        }
-               }
 
-               length = __MmsBinaryEncodeTextStringLen((UINT8*)pszName);
+                       length = __MmsBinaryEncodeTextStringLen((UINT8*)pszName);
 
-               if (length == -1) {
-                       MSG_DEBUG("szName MmsBinaryEncodeIntegerLen fail");
-                       goto __CATCH;
-               }
+                       if (length == -1) {
+                               MSG_DEBUG("szName MmsBinaryEncodeIntegerLen fail");
+                               goto __CATCH;
+                       }
 
-               g_free(pszName);
+                       g_free(pszName);
 
-               totalLength += (length + 1);
+                       totalLength += (length + 1);
+               }
        }
 
 #ifdef FEATURE_JAVA_MMS
@@ -1606,7 +1609,7 @@ static bool __MmsBinaryEncodeContentType(FILE *pFile, MsgType *pType, int typeLe
 
                pszName = g_strdup(pType->param.szName);
 
-               //change empty space to '_' in the file name
+               /* change empty space to '_' in the file name */
                MmsReplaceSpaceChar(pszName);
 
                gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeParameterCode, MSG_PARAM_NAME) | 0x80;
@@ -1717,7 +1720,7 @@ static bool __MmsBinaryEncodeContentType(FILE *pFile, MsgType *pType, int typeLe
                if (MmsIsTextType(contentType)) {
                        if (!MmsIsVitemContent (contentType, pType->param.szName)) {
                                gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeParameterCode, MSG_PARAM_CHARSET) | 0x80;
-                               fieldValue = 0x0000;    //laconic_warning, just to remove warning message
+                               fieldValue = 0x0000;    /* laconic_warning, just to remove warning message */
                                gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = (UINT8)fieldValue | 0x80;
                        }
                }
@@ -1847,12 +1850,12 @@ static bool __MmsBinaryEncodeMsgPart(FILE *pFile, int contentType, MsgType *pTyp
                                        goto __CATCH;
                                }
                                pType->offset = __MmsGetEncodeOffset();
-                               if(MsgWriteFile(pData, sizeof(char), nRead, pFile) != (size_t)nRead) {
+                               if (MsgWriteFile(pData, sizeof(char), nRead, pFile) != (size_t)nRead) {
                                        MSG_DEBUG("MsgWriteFile failed");
                                        goto __CATCH;
                                }
                                gMmsEncodeCurOffset = MsgFtell(pFile);
-                               if(gMmsEncodeCurOffset < 0) {
+                               if (gMmsEncodeCurOffset < 0) {
                                        MSG_DEBUG("MsgFtell returns negative value [%ld]", gMmsEncodeCurOffset);
                                        goto __CATCH;
                                }
@@ -1963,7 +1966,7 @@ static int __MmsBinaryEncodeContentHeaderLen(MimeType contentType, MsgType *pTyp
 
        /* content-id ------------------------------------------------- */
        if (pType->szContentID[0]) {
-               if (bMultipart) { //Binary Encoding
+               if (bMultipart) { /* Binary Encoding */
                        totalLength++;
                } else {
                        /* content-id = Quoted-string */
@@ -1986,7 +1989,7 @@ static int __MmsBinaryEncodeContentHeaderLen(MimeType contentType, MsgType *pTyp
 
 
        if (pType->szContentLocation[0]) {
-               if (bMultipart) { //Binary Encoding
+               if (bMultipart) { /* Binary Encoding */
                        totalLength++;
                } else {
                        /* content-location = Quoted-string */
@@ -2023,7 +2026,7 @@ static int __MmsBinaryEncodeContentHeaderLen(MimeType contentType, MsgType *pTyp
                 * Inline = <Octet 130> : 0x82
                 */
 
-               if (bMultipart) { //Binary Encoding
+               if (bMultipart) { /* Binary Encoding */
                        totalLength += 3;
                } else {
                        /* content-disposition = Quoted-string */
@@ -2059,13 +2062,16 @@ static bool __MmsBinaryEncodeContentHeader(FILE *pFile, MimeType contentType, Ms
 {
        int     length = 0;
        const char *szTextValue = NULL;
+       bool isAscii = true;
+       unsigned  long tmpLength = 0;
+       unsigned char tmpFileName[MSG_LOCALE_FILENAME_LEN_MAX+1];
 
        /* content-id ------------------------------------------------- */
        if (pType->szContentID[0]) {
 
                MSG_SEC_DEBUG("Content ID : %s", pType->szContentID);
 
-               if (bMultipart) { //Binary Encoding
+               if (bMultipart) { /* Binary Encoding */
                        gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeMsgBodyHeaderCode, MMS_BODYHDR_CONTENTID) | 0x80;
                } else {
                        /* content-id = Quoted-string */
@@ -2094,10 +2100,16 @@ static bool __MmsBinaryEncodeContentHeader(FILE *pFile, MimeType contentType, Ms
        }
 
        if (pType->szContentLocation[0]) {
-
                MSG_SEC_DEBUG("Content Location : %s", pType->szContentLocation);
 
-               if (bMultipart) { //Binary Encoding
+               if (MmsIsAsciiString (pType->param.szName)) {
+                       MSG_DEBUG("Name is consisted of ascii char-set chars.");
+               } else {
+                       isAscii = false;
+                       MSG_DEBUG("Name is NOT consisted of ascii char-set chars.");
+               }
+
+               if (bMultipart) { /* Binary Encoding */
                        gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeMsgBodyHeaderCode, MMS_BODYHDR_CONTENTLOCATION) | 0x80;
                } else {
                        /* content-location = Quoted-string */
@@ -2113,16 +2125,31 @@ static bool __MmsBinaryEncodeContentHeader(FILE *pFile, MimeType contentType, Ms
                        }
                }
 
-               length = __MmsBinaryEncodeTextStringLen((UINT8*)pType->szContentLocation);
+               char* pszName = g_strdup(pType->szContentLocation);
+               MmsReplaceSpaceChar(pszName);
+
+               if (isAscii == false) {
+                       if (MsgEncode2Base64(pszName, strlen(pszName), &tmpLength, tmpFileName) == true) {
+                               g_free(pszName);
+                               pszName = g_strdup_printf("=?UTF-8?B?%s?=", tmpFileName);
+                               MSG_DEBUG("base64 encode filename=[%s]", pszName);
+                       }
+               }
+
+               length = __MmsBinaryEncodeTextStringLen((UINT8*)pszName);
                if (length == -1) {
                        MSG_DEBUG("pType->szContentLocation MmsBinaryEncodeTextStringLen fail.");
+                       g_free(pszName);
                        goto __CATCH;
                }
 
-               if (__MmsBinaryEncodeTextString(pFile, (UINT8*)pType->szContentLocation, length) == false) {
+               if (__MmsBinaryEncodeTextString(pFile, (UINT8*)pszName, length) == false) {
                        MSG_DEBUG("pType->szContentLocation MmsBinaryEncodeTextString fail.");
+                       g_free(pszName);
                        goto __CATCH;
                }
+
+               g_free(pszName);
        }
 
        /* MIME_APPLICATION_VND_WAP_MULTIPART_RELATED requires always "inline" */
@@ -2140,7 +2167,7 @@ static bool __MmsBinaryEncodeContentHeader(FILE *pFile, MimeType contentType, Ms
                 * Inline = <Octet 130> : 0x82
                 */
 
-               if (bMultipart) {//Binary Encoding
+               if (bMultipart) { /* Binary Encoding */
 
                        UINT8 fieldValue  = 0xff;
                        gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeMsgBodyHeaderCode, MMS_BODYHDR_DISPOSITION) | 0x80;
@@ -2208,7 +2235,7 @@ static bool __MmsBinaryEncodeContentBody(FILE *pFile, MsgBody *pBody)
                        goto __CATCH;
 
                pBody->offset = __MmsGetEncodeOffset();
-               if(MsgWriteFile(pData, sizeof(char), nRead, pFile) != (size_t)nRead) {
+               if (MsgWriteFile(pData, sizeof(char), nRead, pFile) != (size_t)nRead) {
                        MSG_DEBUG("MsgWriteFile failed");
                        goto __CATCH;
                }
@@ -2231,7 +2258,7 @@ static bool __MmsBinaryEncodeContentBody(FILE *pFile, MsgBody *pBody)
                }
                gMmsEncodeCurOffset = MsgFtell(pFile);
 
-               if(gMmsEncodeCurOffset < 0) {
+               if (gMmsEncodeCurOffset < 0) {
                        MSG_DEBUG("MsgFtell returns negative value [%ld]", gMmsEncodeCurOffset);
                        goto __CATCH;
                }
@@ -2272,7 +2299,7 @@ static int __MmsBinaryEncodeIntegerLen(UINT32 integer)
                        integer = (integer >> 8);
                }
 
-               length++;       // + Short-length
+               length++;       /* + Short-length */
 
                return length;
        }
@@ -2314,7 +2341,7 @@ static bool __MmsBinaryEncodeInteger(FILE *pFile, UINT32 integer, int length)
                 * The Short-length indicates the length of the Multi-octet-integer
                 */
                changer.integer = integer;
-               length--;                                       // - "Short-length"
+               length--;                                       /* - "Short-length" */
 
                gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = (UINT8)length;
 
@@ -2348,7 +2375,7 @@ static int __MmsBinaryEncodeLongIntegerLen(UINT32 integer)
                integer = (integer >> 8);
        }
 
-       length++;       // + Short-length
+       length++;       /* + Short-length */
 
        return length;
 }
@@ -2386,7 +2413,7 @@ static bool __MmsBinaryEncodeLongInteger(FILE *pFile, UINT32 integer, int length
        }
 
        changer.integer = integer;
-       length--;                                       // - "Short-length"
+       length--;                                       /* - "Short-length" */
 
        gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = (UINT8)length;
 
@@ -2412,9 +2439,9 @@ static int __MmsBinaryEncodeTextStringLen(UINT8 *source)
 
        length = (int)strlen((char*)source);
        if (source[0] > 0x7F) {
-               length += 2;                    // + NULL
+               length += 2;                    /* + NULL */
        } else {
-               length++;                               // + NULL
+               length++;                               /* + NULL */
        }
 
        return length;
@@ -2455,8 +2482,8 @@ static bool __MmsBinaryEncodeTextString(FILE *pFile, UINT8 *source, int length)
                length--;
        }
 
-       strncpy(gpMmsEncodeBuf + gCurMmsEncodeBuffPos, (char*)source, (length - 1));    // except NULL
-       gCurMmsEncodeBuffPos += (length - 1);                   // except NULL
+       strncpy(gpMmsEncodeBuf + gCurMmsEncodeBuffPos, (char*)source, (length - 1));    /* except NULL */
+       gCurMmsEncodeBuffPos += (length - 1);                   /* except NULL */
        gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = (UINT8)NULL;
 
        return true;
@@ -2471,9 +2498,9 @@ __CATCH:
  * @param      interger [in] integer to be encoded
  * @return     encoded UINTVAR stream
 */
-const UINT32 UINTVAR_LENGTH_1 =  0x0000007f;           //7bit
-const UINT32 UINTVAR_LENGTH_2 =  0x00003fff;           //14bit
-const UINT32 UINTVAR_LENGTH_3 =  0x001fffff;           //21bit
+const UINT32 UINTVAR_LENGTH_1 =  0x0000007f;           /* 7bit */
+const UINT32 UINTVAR_LENGTH_2 =  0x00003fff;           /* 14bit */
+const UINT32 UINTVAR_LENGTH_3 =  0x001fffff;           /* 21bit */
 
 
 static int __MmsBinaryEncodeUintvarLen(UINT32 integer)
@@ -2530,7 +2557,7 @@ static bool __MmsBinaryEncodeUintvar(FILE *pFile, UINT32 integer, int length)
        szReverse[0] = source.bytes[0];
        szReverse[0] = szReverse[0] & 0x7f;
 
-       while (length >= i) { // initially, i = 2
+       while (length >= i) { /* initially, i = 2 */
                /* Move integer bit to proper position */
                source.integer = source.integer << 1;
                source.integer = source.integer >> 8;
@@ -2558,7 +2585,7 @@ static int __MmsBinaryEncodeValueLengthLen(UINT32 integer)
        if (integer < 0x1f) {
                length = 1;
        } else {
-               length = __MmsBinaryEncodeUintvarLen(integer) + 1;              //LENGTH_QUOTE
+               length = __MmsBinaryEncodeUintvarLen(integer) + 1;              /* LENGTH_QUOTE */
        }
 
        return length;
@@ -2597,7 +2624,7 @@ static bool __MmsBinaryEncodeValueLength(FILE *pFile, UINT32 integer, int length
                gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = (UINT8)integer;
        } else {
                gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = (UINT8)LENGTH_QUOTE;
-               if (__MmsBinaryEncodeUintvar(pFile, integer, length - 1) == false) {    // LENGTH_QUOTE
+               if (__MmsBinaryEncodeUintvar(pFile, integer, length - 1) == false) {    /* LENGTH_QUOTE */
                        MSG_DEBUG("MmsBinaryEncodeUintvar fail");
                        goto __CATCH;
                }
@@ -2616,7 +2643,7 @@ static int __MmsBinaryEncodeQuotedStringLen(UINT8 *pSrc)
                goto __CATCH;
        }
 
-       return (strlen((char*)pSrc) + 2);       // QUOTE + NULL
+       return (strlen((char*)pSrc) + 2);       /* QUOTE + NULL */
 
 __CATCH:
        return -1;
@@ -2647,7 +2674,7 @@ static bool __MmsBinaryEncodeQuotedString(FILE *pFile, UINT8 *source, int length
        }
 
        gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = '\"';
-       strncpy(gpMmsEncodeBuf + gCurMmsEncodeBuffPos, (char*)source, length - 2);              // except '\"' & NULL
+       strncpy(gpMmsEncodeBuf + gCurMmsEncodeBuffPos, (char*)source, length - 2);              /* except '\"' & NULL */
        gCurMmsEncodeBuffPos += (length - 2);
        gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = (UINT8)NULL;
 
@@ -2659,7 +2686,7 @@ __CATCH:
 
 static int __MmsBinaryEncodeEncodedStringLen(UINT8 *source)
 {
-       UINT32 charset = 0x6A;          // default = utf-8
+       UINT32 charset = 0x6A;          /* default = utf-8 */
        int charLeng            = 0;
        int textLeng            = 0;
        int valueLengthLen      = 0;
@@ -2698,7 +2725,7 @@ __CATCH:
  */
 static bool __MmsBinaryEncodeEncodedString(FILE *pFile, UINT8 *source, int length)
 {
-       UINT32 charset = 0x6A;          // default = utf-8
+       UINT32 charset = 0x6A;          /* default = utf-8 */
        int charLeng = 0;
        int textLeng = 0;
        int valLengthLen = 0;
@@ -2766,7 +2793,7 @@ __CATCH:
        return false;
 }
 
-static bool __MmsBinaryEncodeFieldCodeAndValue(FILE *pFile, UINT8 fieldCode, UINT8 fieldValue)
+static bool __MmsBinaryEncodeFieldCodeAndValue(FILE *pFile, UINT8 fieldCode, UINT8 fieldValue)
 {
        if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < 2) {
                if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos,
@@ -2953,7 +2980,7 @@ static bool __MmsBinaryEncodeDate(FILE *pFile, time_t inpDateSec)
                int     length  = 0;
                length = __MmsBinaryEncodeLongIntegerLen(dateSec);
 
-               if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < (length + 1)) { // + fieldCode
+               if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < (length + 1)) { /* + fieldCode */
                        if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos,
                                                                                                gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) {
                                MSG_DEBUG("MsgWriteDataFromEncodeBuffer fail");
@@ -3128,13 +3155,13 @@ static bool __MmsBinaryEncodeTime(FILE *pFile, MmsFieldCode fieldCode, MmsTimeSt
                goto __CATCH;
        }
 
-       length = __MmsBinaryEncodeValueLengthLen(timeLen + 1);  //time length + time type token
+       length = __MmsBinaryEncodeValueLengthLen(timeLen + 1);  /* time length + time type token */
        if (length == -1) {
                MSG_DEBUG("MmsBinaryEncodeValueLengthLen fail");
                goto __CATCH;
        }
 
-       if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < (length + timeLen + 2)) {       // + fieldCode + timeType
+       if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < (length + timeLen + 2)) {       /* + fieldCode + timeType */
 
                if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos,
                                                                                        gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) {
@@ -3229,7 +3256,7 @@ static bool __EncodeMmsMessage(MmsMsg *pMmsMsg, const char *raw_filepath)
                break;
        }
 
-       MsgFsync(pFile);        //file is written to device immediately, it prevents missing file data from unexpected power off
+       MsgFsync(pFile);        /* file is written to device immediately, it prevents missing file data from unexpected power off */
        MsgCloseFile(pFile);
 
        return true;
index 15c4490..1ee70dc 100755 (executable)
@@ -60,19 +60,18 @@ void MmsPluginEventHandler::handleMmsReceivedData(mmsTranQEntity *pRequest, char
        MSG_MESSAGE_INFO_S msgInfo = {0,};
 
        switch (pRequest->eMmsPduType) {
-       // received data is send-conf
+       /* received data is send-conf */
        case eMMS_SEND_CONF:
                MmsPluginInternal::instance()->processSendConf(&msgInfo, pRequest);
 
-               // callback to MSG FW
+               /* callback to MSG FW */
                listener.pfMmsConfIncomingCb(&msgInfo, &pRequest->reqID);
 
-               //MsgDeleteFile(pRetrievedFilePath + strlen(MSG_DATA_PATH)); // not ipc
                if (remove(pRetrievedFilePath) != 0)
                        MSG_DEBUG("remove fail");
                break;
 
-       // received data is retrieve-conf
+       /* received data is retrieve-conf */
        case eMMS_RETRIEVE_AUTO_CONF:
        case eMMS_RETRIEVE_MANUAL_CONF:
                MSG_ADDRESS_INFO_S addrInfo;
@@ -81,7 +80,7 @@ void MmsPluginEventHandler::handleMmsReceivedData(mmsTranQEntity *pRequest, char
 
                MmsPluginInternal::instance()->processRetrieveConf(&msgInfo, pRequest, pRetrievedFilePath);
 
-               // callback to MSG FW
+               /* callback to MSG FW */
                listener.pfMmsConfIncomingCb(&msgInfo, &pRequest->reqID);
                break;
 
@@ -119,7 +118,7 @@ void MmsPluginEventHandler::handleMmsError(mmsTranQEntity *pRequest)
        case eMMS_SEND_REQ:
        case eMMS_SEND_CONF:
                msgInfo.msgId = pRequest->msgId;
-               //Set only changed members
+               /* Set only changed members */
                msgInfo.msgType.mainType = MSG_MMS_TYPE;
 
                if (pRequest->eMmsPduType == eMMS_SEND_REQ)
@@ -137,7 +136,7 @@ void MmsPluginEventHandler::handleMmsError(mmsTranQEntity *pRequest)
        case eMMS_RETRIEVE_AUTO:
        case eMMS_RETRIEVE_AUTO_CONF:
                msgInfo.msgId = pRequest->msgId;
-               //Set only changed members
+               /* Set only changed members */
                msgInfo.msgType.mainType = MSG_MMS_TYPE;
                msgInfo.msgType.subType = MSG_RETRIEVE_AUTOCONF_MMS;
 
@@ -151,7 +150,7 @@ void MmsPluginEventHandler::handleMmsError(mmsTranQEntity *pRequest)
        case eMMS_RETRIEVE_MANUAL:
        case eMMS_RETRIEVE_MANUAL_CONF:
                msgInfo.msgId = pRequest->msgId;
-               //Set only changed members
+               /* Set only changed members */
                msgInfo.msgType.mainType = MSG_MMS_TYPE;
                msgInfo.msgType.subType = MSG_RETRIEVE_MANUALCONF_MMS;
 
index 3028e1c..17196a6 100755 (executable)
@@ -34,11 +34,6 @@ static void __httpGetHost(char *szUrl, char *szHost, int nBufferLen);
 /*==================================================================================================
                                      FUNCTION IMPLEMENTATION
 ==================================================================================================*/
-//static int __http_progress_cb(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow)
-//{
-//     MSG_INFO("download(%.0f/%.0f) : upload(%.0f/%.0f)", dlnow, dltotal, ulnow, ultotal);
-//     return 0;
-//}
 
 static int __http_debug_cb (CURL *input_curl, curl_infotype input_info_type, char *input_data , size_t input_size, void *input_void)
 {
@@ -68,15 +63,15 @@ static void __http_print_profile(CURL *curl)
 
        MSG_DEBUG("**************************************************************************************************");
 
-       //time
+       /* time */
        curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &total_time);
        MSG_SEC_INFO("profile http Time: total %.3f seconds", total_time);
 
-       //url
+       /* url */
        curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &url);
        MSG_SEC_INFO("profile http Url: %s", url);
 
-       //size
+       /* size */
        curl_easy_getinfo(curl, CURLINFO_SIZE_UPLOAD, &size_up);
        MSG_SEC_INFO("profile http Size: upload %.3f bytes", size_up);
 
@@ -89,14 +84,14 @@ static void __http_print_profile(CURL *curl)
        curl_easy_getinfo(curl, CURLINFO_REQUEST_SIZE, &size);
        MSG_SEC_INFO("profile http Size: request %ld bytes", size);
 
-       //speed
+       /* speed */
        curl_easy_getinfo(curl, CURLINFO_SPEED_UPLOAD, &speed_upload);
        MSG_SEC_INFO("profile http Speed: upload %.3f bytes/sec", speed_upload);
 
        curl_easy_getinfo(curl, CURLINFO_SPEED_DOWNLOAD, &speed_download);
        MSG_SEC_INFO("profile http Speed: download %.3f bytes/sec", speed_download);
 
-       //content
+       /* content */
        curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &content_type);
        MSG_SEC_INFO("profile http Content: type %s", content_type);
 
@@ -106,7 +101,7 @@ static void __http_print_profile(CURL *curl)
        curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_UPLOAD, &content_length);
        MSG_SEC_INFO("profile http Content: length upload %.3f", content_length);
 
-       //ip & port
+       /* ip & port */
        curl_easy_getinfo(curl, CURLINFO_PRIMARY_IP, &ip);
        MSG_SEC_INFO("profile http primary: ip %s", ip);
 
@@ -214,10 +209,10 @@ static void __httpAllocHeaderInfo(curl_slist **responseHeaders, char *szUrl, int
        memset(pcheader, 0, HTTP_REQUEST_LEN);
        nResult = __httpGetHeaderField(MMS_HH_MDN, szBuffer);
 
-       // TODO : if it needs to check http header mdn value, add code to below.
+       /* TODO : if it needs to check http header mdn value, add code to below. */
 #endif
 
-       if (ulContentLen > 0)//if post transaction then Disable 'Expect: 100-contine' option
+       if (ulContentLen > 0) /* if post transaction then Disable 'Expect: 100-contine' option */
                *responseHeaders = curl_slist_append(*responseHeaders, "Expect:");
 }
 
@@ -253,8 +248,8 @@ static bool __httpGetHeaderField(MMS_HTTP_HEADER_FIELD_T httpHeaderItem, char *s
                        result = true;
                        break;
 
-               case MMS_HH_USER_AGENT:
-                       {
+               case MMS_HH_USER_AGENT: {
+#if 0
                                char szUserAgent[1024 + 1];
                                char *uagent = NULL;
 
@@ -274,12 +269,14 @@ static bool __httpGetHeaderField(MMS_HTTP_HEADER_FIELD_T httpHeaderItem, char *s
                                        free(uagent);
                                        uagent = NULL;
                                }
+#else
+                               snprintf((char *)szHeaderBuffer, 1024, "%s", MSG_MMS_HH_USER_AGENT);
+#endif
                                result = true;
                        }
                        break;
 
-               case MMS_HH_UA_PROFILE:
-                       {
+               case MMS_HH_UA_PROFILE: {
                                char *szUAProfile = MsgSettingGetString(MSG_MMS_UA_PROFILE);
 
                                snprintf((char *)szHeaderBuffer, 1024, "%s", szUAProfile);
@@ -292,22 +289,22 @@ static bool __httpGetHeaderField(MMS_HTTP_HEADER_FIELD_T httpHeaderItem, char *s
                        break;
 
 #if defined(FEATURE_SMS_CDMA)
-               case MMS_HH_MDN:
-//                     {
-//                             char *mdn = MsgSettingGetString(MSG_SIM_MSISDN);
-//
-//                             if (mdn != NULL && strlen(mdn) > 0) {
-//                                     result = true;
-//                                     snprintf((char *)szHeaderBuffer, 1024, "%s", mdn);
-//                             } else {
-//                                     result = false;
-//                             }
-//                             if (mdn) {
-//                                     free(mdn);
-//                                     mdn = NULL;
-//                             }
-//                     }
+               case MMS_HH_MDN: {
+/*
+                       char *mdn = MsgSettingGetString(MSG_SIM_MSISDN);
+                       if (mdn != NULL && strlen(mdn) > 0) {
+                               result = true;
+                               snprintf((char *)szHeaderBuffer, 1024, "%s", mdn);
+                       } else {
+                               result = false;
+                       }
+                       if (mdn) {
+                               free(mdn);
+                               mdn = NULL;
+                       }
                        break;
+*/
+               }
 #endif
                default:
                        MSG_WARN("invalid param [%d]", httpHeaderItem);
@@ -390,54 +387,35 @@ static int __http_multi_perform(void *session)
        MSG_INFO("curl_multi_perform first end : rcm = %d, still_running = %d", rcm, still_running);
 
        do {
+               int retval;
                struct timeval timeout;
-               int rc; /* select() return code */
-
-               fd_set fdread;
-               fd_set fdwrite;
-               fd_set fdexcep;
-               int maxfd = -1;
 
-//             long curl_timeo = -1;
+               int max_fd = -1;
+               fd_set fd_r;
+               fd_set fd_w;
+               fd_set fd_excp;
 
-               FD_ZERO(&fdread);
-               FD_ZERO(&fdwrite);
-               FD_ZERO(&fdexcep);
+               FD_ZERO(&fd_r);
+               FD_ZERO(&fd_w);
+               FD_ZERO(&fd_excp);
 
-               /* set a suitable timeout to play around with */
                timeout.tv_sec = 120;
                timeout.tv_usec = 0;
 
-//             curl_multi_timeout(multi_handle, &curl_timeo);
-//             if(curl_timeo >= 0) {
-//                     MSG_DEBUG("curl_timeo = %ld", curl_timeo);
-//                     timeout.tv_sec = curl_timeo / 1000;
-//                     if(timeout.tv_sec > 1)
-//                             timeout.tv_sec = 1;
-//                     else
-//                             timeout.tv_usec = (curl_timeo % 1000) * 1000;
-//             }
-
-               curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd);
-
-               /* In a real-world program you OF COURSE check the return code of the
-               function calls.  On success, the value of maxfd is guaranteed to be
-               greater or equal than -1.  We call select(maxfd + 1, ...), specially in
-               case of (maxfd == -1), we call select(0, ...), which is basically equal
-               to sleep. */
+               curl_multi_fdset(multi_handle, &fd_r, &fd_w, &fd_excp, &max_fd);
 
-               rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
+               retval = select(max_fd+1, &fd_r, &fd_w, &fd_excp, &timeout);
 
-               if (rc == -1){/* select error */
+               if (retval == -1){ /* select error */
                        MSG_ERR("select error");
                        ret = -1;
                        break;
-               } else if (rc == 0){    /* timeout */
+               } else if (retval == 0){        /* timeout */
                        MSG_ERR("time out");
                        ret = -1;
                        break;
-               } else {/* action */
-                       MSG_DEBUG("rc = %d", rc);
+               } else { /* action */
+                       MSG_DEBUG("retval = %d", retval);
                        rcm = curl_multi_perform(multi_handle, &still_running);
                }
 
@@ -449,7 +427,7 @@ static int __http_multi_perform(void *session)
 
                MSG_INFO("curl_multi_perform end : rcm = %d, still_running = %d, cm_open = %d", rcm, still_running, connection_open_flag);
 
-       } while(still_running && (connection_open_flag == true));
+       } while (still_running && (connection_open_flag == true));
 
        while ((msg = curl_multi_info_read(multi_handle, &msgs_left))) {
                if (msg->msg == CURLMSG_DONE) {
@@ -579,7 +557,7 @@ MMS_HTTP_ERROR_E MmsPluginHttpAgent::setSession(http_request_info_s &request_inf
        int content_len = 0;
        char *url = NULL;
 
-       // Verify request info
+       /* Verify request info */
        if (request_info.transaction_type != MMS_HTTP_TRANSACTION_TYPE_GET
                        && request_info.transaction_type != MMS_HTTP_TRANSACTION_TYPE_POST)
        {
@@ -603,14 +581,14 @@ MMS_HTTP_ERROR_E MmsPluginHttpAgent::setSession(http_request_info_s &request_inf
                goto __CATCH;
        }
 
-       //Set type
+       /* Set type */
        this->transaction_type = request_info.transaction_type;
        MSG_DEBUG("set transaction type [%d]", this->transaction_type);
 
-       //Set http Headers
+       /* Set http Headers */
        if (this->transaction_type == MMS_HTTP_TRANSACTION_TYPE_POST) {
                content_len = request_info.post_data_len;
-       } else { //MMS_HTTP_TRANSACTION_TYPE_GET
+       } else { /* MMS_HTTP_TRANSACTION_TYPE_GET */
                content_len = 0;
        }
 
@@ -632,7 +610,7 @@ MMS_HTTP_ERROR_E MmsPluginHttpAgent::setSession(http_request_info_s &request_inf
        }
 
 
-       //Set curl option
+       /* Set curl option */
        session_option = curl_easy_init();
        if (session_option == NULL) {
                MSG_ERR("curl_easy_init() failed");
@@ -647,7 +625,6 @@ MMS_HTTP_ERROR_E MmsPluginHttpAgent::setSession(http_request_info_s &request_inf
        curl_easy_setopt(session_option, CURLOPT_HTTPHEADER, session_header);
        curl_easy_setopt(session_option, CURLOPT_DEBUGFUNCTION , __http_debug_cb);
        curl_easy_setopt(session_option, CURLOPT_INTERFACE, request_info.interface);
-       //curl_easy_setopt(httpConfigData.session, CURLOPT_PROGRESSFUNCTION, __http_progress_cb); //for debug
 
        if (respfile) {
                curl_easy_setopt(session_option, CURLOPT_WRITEFUNCTION, __http_write_response_cb);
@@ -658,14 +635,14 @@ MMS_HTTP_ERROR_E MmsPluginHttpAgent::setSession(http_request_info_s &request_inf
                curl_easy_setopt(session_option, CURLOPT_POST, true);
                curl_easy_setopt(session_option, CURLOPT_POSTFIELDS, request_info.post_data);
                curl_easy_setopt(session_option, CURLOPT_POSTFIELDSIZE, request_info.post_data_len);
-       //      curl_easy_setopt(session_option, CURLOPT_TCP_NODELAY, 1);
+/*             curl_easy_setopt(session_option, CURLOPT_TCP_NODELAY, 1); */
        }
 
        MSG_END();
        return http_error;
 
 __CATCH:
-       //CID 338211: freeing url (with check) in case of error
+       /* CID 338211: freeing url (with check) in case of error */
        if (url) {
                free(url);
                url = NULL;
@@ -705,14 +682,14 @@ MMS_HTTP_ERROR_E MmsPluginHttpAgent::httpRequest(http_request_info_s &request_in
 
        respfile = fopen(conf_filename, "wb");
 
-       //set session
+       /* set session */
        http_error = this->setSession(request_info);
        if (http_error != MMS_HTTP_ERROR_NONE) {
                MSG_ERR("Fail to setSession");
                goto __CATCH;
        }
 
-       //transaction
+       /* transaction */
        http_error = this->startTransaction();
 
        if (http_error != MMS_HTTP_ERROR_NONE) {
@@ -720,13 +697,13 @@ MMS_HTTP_ERROR_E MmsPluginHttpAgent::httpRequest(http_request_info_s &request_in
                goto __CATCH;
        }
 
-       //close conf file & load response data
+       /* close conf file & load response data */
        if (respfile) {
 
                fclose(respfile);
                respfile = NULL;
 
-               if (g_file_get_contents(conf_filename, &request_info.response_data, &request_info.response_data_len, NULL) == false) {
+               if (g_file_get_contents((gchar*)conf_filename, (gchar**)&request_info.response_data, (gsize*)&request_info.response_data_len, NULL) == false) {
                        MSG_WARN("Fail to g_file_get_contents");
                }
        }
index cc4c0c3..a15b876 100755 (executable)
 #include "MmsPluginAppBase.h"
 #include "MmsPluginMIME.h"
 
+#ifdef FEATURE_CONTAINER_ENABLE
+#include "MsgZoneManager.h"
+#endif
+
 /*==================================================================================================
                                      IMPLEMENTATION OF MmsPluginInternal - Member Functions
 ==================================================================================================*/
@@ -70,15 +74,26 @@ void MmsPluginInternal::processReceivedInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQ
        if (pMsgInfo->bTextSms == true) {
                char fullPath[MAX_FULL_PATH_SIZE+1] = {0,};
 
-               if(MsgCreateFileName(fileName) == false)
+               if (MsgCreateFileName(fileName) == false)
                        THROW(MsgException::FILE_ERROR, "MsgCreateFileName error");
 
                MSG_SEC_DEBUG("File name = %s", fileName);
 
-               if(MsgWriteIpcFile(fileName, pMsgInfo->msgText, pMsgInfo->dataSize) == false)
+               if (MsgWriteIpcFile(fileName, pMsgInfo->msgText, pMsgInfo->dataSize) == false)
                        THROW(MsgException::FILE_ERROR, "MsgWriteIpcFile error");
 
+#ifdef FEATURE_CONTAINER_ENABLE
+               char *rootPath = MsgZoneGetRootPath();
+               if (rootPath) {
+                       snprintf(fullPath, MAX_FULL_PATH_SIZE+1, "%s%s%s",rootPath, MSG_IPC_DATA_PATH, fileName);
+                       g_free(rootPath);
+                       rootPath = NULL;
+               } else {
+                       snprintf(fullPath, MAX_FULL_PATH_SIZE+1, "%s%s", MSG_IPC_DATA_PATH, fileName);
+               }
+#else
                snprintf(fullPath, MAX_FULL_PATH_SIZE+1, "%s%s", MSG_IPC_DATA_PATH, fileName);
+#endif
 
                memset(pMsgInfo->msgData, 0x00, sizeof(pMsgInfo->msgData));
                memcpy(pMsgInfo->msgData, fullPath, strlen(fullPath));
@@ -93,7 +108,7 @@ void MmsPluginInternal::processReceivedInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQ
        if ((pFile = MsgOpenFile(pMsgInfo->msgData, "rb+")) == NULL) {
                MSG_DEBUG("File Open Error: %s", pMsgInfo->msgData);
        } else {
-               //Decode Header
+               /* Decode Header */
                if (!MmsBinaryDecodeMsgHeader(pFile, pMsgInfo->dataSize))
                        MSG_DEBUG("Decoding Header Failed \r\n");
 
@@ -102,11 +117,10 @@ void MmsPluginInternal::processReceivedInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQ
                if (remove(pMsgInfo->msgData) != 0)
                        MSG_DEBUG("Fail remove");
 
-
                switch (mmsHeader.type) {
                case MMS_MSGTYPE_NOTIFICATION_IND:
                        MSG_DEBUG("process noti.ind\n");
-                       // For Set Value pMsgInfo
+                       /* For Set Value pMsgInfo */
                        if (processNotiInd(pMsgInfo, pRequest) == false)
                                *bReject = true;
                        else
@@ -115,7 +129,7 @@ void MmsPluginInternal::processReceivedInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQ
 
                case MMS_MSGTYPE_DELIVERY_IND:
                        MSG_DEBUG("process delivery.ind\n");
-                       // For Set Value pMsgInfo
+                       /* For Set Value pMsgInfo */
                        processDeliveryInd(pMsgInfo);
                        break;
 
@@ -157,7 +171,7 @@ bool MmsPluginInternal::processNotiInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST
 
        if (mmsHeader.pFrom) {
                MmsAddrUtilRemovePlmnString(mmsHeader.pFrom->szAddr);
-               // From
+               /* From */
                strncpy(pMsgInfo->addressList[0].addressVal, mmsHeader.pFrom->szAddr, MAX_ADDRESS_VAL_LEN);
                if (MmsAddrUtilCheckEmailAddress(pMsgInfo->addressList[0].addressVal)) {
                        pMsgInfo->addressList[0].addressType = MSG_ADDRESS_TYPE_EMAIL;
@@ -165,7 +179,8 @@ bool MmsPluginInternal::processNotiInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST
        }
 
        MMS_DATA_S *mms_data = MsgMmsCreate();
-       if (mms_data == NULL) return false;
+       if (mms_data == NULL)
+               return false;
        {
                mms_data->header = MsgMmsCreateHeader();
 
@@ -182,24 +197,24 @@ bool MmsPluginInternal::processNotiInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST
 
                pHeader->mmsVersion = mmsHeader.version;
 
-               //From
+               /* From */
                if (mmsHeader.pFrom) {
                        MmsAddrUtilRemovePlmnString(mmsHeader.pFrom->szAddr);
                        snprintf(pHeader->szFrom, sizeof(pHeader->szFrom), "%s", mmsHeader.pFrom->szAddr);
                }
 
-               //Subject
+               /* Subject */
                snprintf(pHeader->szSubject, sizeof(pHeader->szSubject), "%s", mmsHeader.szSubject);
-               //Delivery Report
+               /* Delivery Report */
                pHeader->bDeliveryReport = (mmsHeader.deliveryReport != MMS_REPORT_YES);
-               //Message Class
+               /* Message Class */
                pHeader->messageClass = mmsHeader.msgClass;
 
-               //Priority
+               /* Priority */
                pHeader->mmsPriority = mmsHeader.priority;
 
-               //Message Size : pMmsMsg->mmsAttrib.msgSize = mmsHeader.msgSize;
-               //Expiry
+               /* Message Size : pMmsMsg->mmsAttrib.msgSize = mmsHeader.msgSize; */
+               /* Expiry */
                pHeader->expiry.type = mmsHeader.expiryTime.type;
                pHeader->expiry.time = mmsHeader.expiryTime.time;
 
@@ -210,9 +225,9 @@ bool MmsPluginInternal::processNotiInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST
                        pHeader->expiry.time += curTime;
                }
 
-               //Charge
-               //contentclass
-               //int contentClass;//text | image-basic| image-rich | video-basic | video-rich | megapixel | content-basic | content-rich
+               /* Charge */
+               /* contentclass */
+               /* int contentClass;//text | image-basic| image-rich | video-basic | video-rich | megapixel | content-basic | content-rich */
                strncpy(pHeader->contentLocation, mmsHeader.szContentLocation, MMS_LOCATION_LEN);
 
                pHeader->messageSize = mmsHeader.msgSize;
@@ -231,11 +246,22 @@ bool MmsPluginInternal::processNotiInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST
                        if (MsgCreateFileName(pTempFileName) == true) {
                                pMsgInfo->bTextSms = false;
 
-                               snprintf(pTempFilePath, sizeof(pTempFilePath), MSG_IPC_DATA_PATH"%s", pTempFileName);
+#ifdef FEATURE_CONTAINER_ENABLE
+                               char *rootPath = MsgZoneGetRootPath();
+                               if (rootPath) {
+                                       snprintf(pTempFilePath, sizeof(pTempFilePath), "%s%s%s", rootPath, MSG_IPC_DATA_PATH, pTempFileName);
+                                       g_free(rootPath);
+                                       rootPath = NULL;
+                               } else {
+                                       snprintf(pTempFilePath, sizeof(pTempFilePath), "%s%s", MSG_IPC_DATA_PATH, pTempFileName);
+                               }
+#else
+                               snprintf(pTempFilePath, sizeof(pTempFilePath), "%s%s", MSG_IPC_DATA_PATH, pTempFileName);
+#endif
 
                                MsgOpenCreateAndOverwriteFile(pTempFilePath, pSerializedMms, serializeDataSize);
 
-                               //set file name
+                               /* set file name */
                                snprintf(pMsgInfo->msgData, sizeof(pMsgInfo->msgData), "%s", pTempFileName);
                        }
 
@@ -244,7 +270,7 @@ bool MmsPluginInternal::processNotiInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST
        }
        MsgMmsRelease(&mms_data);
 
-       // Check contents-location is in noti.ind
+       /* Check contents-location is in noti.ind */
        if (mmsHeader.szContentLocation[0] == '\0') {
                THROW(MsgException::INCOMING_MSG_ERROR, "######## Contents-location is empty in MMS-Noti-Ind  #######");
                return false;
@@ -267,7 +293,7 @@ bool MmsPluginInternal::processNotiInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST
                return false;
        }
 
-       if (MsgCheckFilter(dbHandle, pMsgInfo)){
+       if (MsgCheckFilter(dbHandle, pMsgInfo)) {
                encodeNotifyRespInd(mmsHeader.szTrID, MSG_DELIVERY_REPORT_DEFERRED, bReportAllowed, pPduFilePath);
 
                pMsgInfo->dataSize = strlen(pPduFilePath);
@@ -293,7 +319,7 @@ bool MmsPluginInternal::processNotiInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST
 
                if (retrieveType == MSG_ABROAD_RESTRICTED) {
                        MSG_DEBUG("MMS Receiving Setting Restricted was selected.");
-                       // m-notify-resp-ind encoding process
+                       /* m-notify-resp-ind encoding process */
                        encodeNotifyRespInd(mmsHeader.szTrID, MSG_DELIVERY_REPORT_DEFERRED, bReportAllowed, pPduFilePath);
 
                        pMsgInfo->dataSize = strlen(pPduFilePath);
@@ -310,10 +336,10 @@ bool MmsPluginInternal::processNotiInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST
                }
        }
 
-       // should send http 'GET'
+       /* should send http 'GET' */
        if (retrieveType == MSG_HOME_AUTO_DOWNLOAD || retrieveType == MSG_ABROAD_AUTO_DOWNLOAD) {
-               //Check if current request sim index is different from default network SIM
-               //Convert auto-retrieve to manual retrieve in case sim indexes are different
+               /* Check if current request sim index is different from default network SIM */
+               /* Convert auto-retrieve to manual retrieve in case sim indexes are different */
                int default_sim = 0;
                default_sim = MsgSettingGetInt(MSG_NETWORK_SIM);
 
@@ -347,9 +373,9 @@ bool MmsPluginInternal::processNotiInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST
                        pRequest->msgInfo.msgType.subType = MSG_NOTIFYRESPIND_MMS;
                }
        } else {
-               // should send m-notify-resp-ind
+               /* should send m-notify-resp-ind */
                MSG_DEBUG("=========== START MANUAL RETRIEVE MODE ===========");
-               // m-notify-resp-ind encoding process
+               /* m-notify-resp-ind encoding process */
 
                if (retrieveType == MSG_HOME_MANUAL || retrieveType == MSG_ABROAD_MANUAL) {
                        encodeNotifyRespInd(mmsHeader.szTrID, MSG_DELIVERY_REPORT_DEFERRED, bReportAllowed, pPduFilePath);
@@ -400,7 +426,7 @@ void MmsPluginInternal::processDeliveryInd(MSG_MESSAGE_INFO_S *pMsgInfo)
        if (tmpId > 0) {
                MSG_DEBUG("Found MSG_ID = %d", tmpId);
 
-               //Insert to Delievery DB
+               /* Insert to Delievery DB */
                MmsPluginStorage::instance()->insertDeliveryReport(tmpId, mmsHeader.pTo->szAddr, &status);
 
                pMsgInfo->msgId = (msg_message_id_t)tmpId;
@@ -463,7 +489,7 @@ void MmsPluginInternal::processSendConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTranQEn
 
        pMsgInfo->msgId = pRequest->msgId;
 
-       //Set only changed members
+       /* Set only changed members */
        pMsgInfo->msgType.mainType = MSG_MMS_TYPE;
        pMsgInfo->msgType.subType = MSG_SENDCONF_MMS;
 
@@ -502,7 +528,7 @@ void MmsPluginInternal::processSendConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTranQEn
                msisdn = NULL;
        }
 
-       // set message-id from mmsc
+       /* set message-id from mmsc */
        strncpy(recvData.szMsgID, mmsHeader.szMsgID, MMS_MSG_ID_LEN);
        strncpy(recvData.szTrID, mmsHeader.szTrID, MMS_TR_ID_LEN);
 
@@ -539,7 +565,7 @@ void MmsPluginInternal::processRetrieveConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTra
        attrib.bAskDeliveryReport = getMmsReport(mmsHeader.deliveryReport);
        attrib.bAskReadReply = getMmsReport(mmsHeader.readReply);
 
-       //Set only changed members
+       /* Set only changed members */
        pMsgInfo->msgId = pRequest->msgId;
        MSG_DEBUG("@@@@@ msgId = %d @@@@@", pMsgInfo->msgId);
        pMsgInfo->msgType.mainType = MSG_MMS_TYPE;
@@ -564,9 +590,9 @@ void MmsPluginInternal::processRetrieveConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTra
        } else {
                pMsgInfo->networkStatus = MSG_NETWORK_RETRIEVE_FAIL;
                pMsgInfo->folderId = MSG_INBOX_ID;
-               // If failed MMS Retrieve, then saved as MMS Noti Ind Message.
-               // It will changed in MsgHandleMmsConfIncomingMsg
-               //pMsgInfo->msgType.subType = MSG_NOTIFICATIONIND_MMS;
+               /* If failed MMS Retrieve, then saved as MMS Noti Ind Message.
+                * It will changed in MsgHandleMmsConfIncomingMsg */
+/*             pMsgInfo->msgType.subType = MSG_NOTIFICATIONIND_MMS; */
        }
 
        char *msisdn = NULL;
@@ -595,7 +621,7 @@ void MmsPluginInternal::processRetrieveConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTra
 
        pMsgInfo->dataSize = pRequest->getDataLen;
 
-       // set message-id & MMS TPDU file path
+       /* set message-id & MMS TPDU file path */
        snprintf(recvData.szMsgID, sizeof(recvData.szMsgID), "%s", mmsHeader.szMsgID);
 
        if (pRetrievedFilePath)
@@ -615,21 +641,24 @@ void MmsPluginInternal::processRetrieveConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTra
 
                filename = MsgGetFileName(pRetrievedFilePath);
 
+#ifdef FEATURE_CONTAINER_ENABLE
+               char *rootPath = MsgZoneGetRootPath();
+               if (rootPath) {
+                       snprintf(fullPath, MAX_FULL_PATH_SIZE+1, "%s%s%s",rootPath, MSG_IPC_DATA_PATH, filename);
+                       g_free(rootPath);
+                       rootPath = NULL;
+               } else {
+                       snprintf(fullPath, MAX_FULL_PATH_SIZE+1, "%s%s", MSG_IPC_DATA_PATH, filename);
+               }
+#else
                snprintf(fullPath, MAX_FULL_PATH_SIZE+1, "%s%s", MSG_IPC_DATA_PATH, filename);
+#endif
 
                if (pRetrievedFilePath) {
                        int ret  = rename(pRetrievedFilePath, fullPath);
                        if (ret != 0) {
                                MSG_DEBUG("File rename Error: %s", g_strerror(errno));
                        }
-
-                       if (MsgChmod(fullPath, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP) == false) {
-                               MSG_DEBUG("File Write Error: %s", g_strerror(errno));
-                       }
-
-                       if (MsgChown(fullPath, 0, 6502 ) == false) {
-                               MSG_DEBUG("File Write Error: %s", g_strerror(errno));
-                       }
                }
        }
 #endif
@@ -638,7 +667,7 @@ void MmsPluginInternal::processRetrieveConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTra
        MSG_DEBUG("@@@@@ MsgData = %s @@@@@", pMsgInfo->msgData);
        MSG_DEBUG("@@@@@ retrievedFilePath = %s @@@@@", recvData.retrievedFilePath);
        MSG_DEBUG("@@@@@ szMsgID = %s @@@@@", recvData.szMsgID);
-       //update delivery report, read reply
+       /* update delivery report, read reply */
 
        MmsPluginStorage *pStorage = MmsPluginStorage::instance();
 
@@ -646,7 +675,7 @@ void MmsPluginInternal::processRetrieveConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTra
 
        MSG_DEBUG("Error value of updateMmsAttrib [%d]", err);
 
-       {//make MmsData & insert multipart
+       { /* make MmsData & insert multipart */
        MmsMsg *pMmsMsg = NULL;
        MmsPluginStorage::instance()->getMmsMessage(&pMmsMsg);
 
@@ -659,11 +688,12 @@ void MmsPluginInternal::processRetrieveConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTra
        pMmsData->header = MsgMmsCreateHeader();
 
        MmsConvertMmsData(pMmsMsg, pMmsData);
-       //CID 41996 : MmsConvertMmsData always returns true
-       /*if (MmsConvertMmsData(pMmsMsg, pMmsData) != true) {
+       /* CID 41996 : MmsConvertMmsData always returns true */
+       /*
+       if (MmsConvertMmsData(pMmsMsg, pMmsData) != true) {
                MSG_DEBUG("Fail to Compose MMS Message");
                goto __CATCH;
-       }*/
+       } */
 
        bool bFiltered = checkFilterMmsBody(pMmsData);
        if (bFiltered == true) {
@@ -682,7 +712,7 @@ void MmsPluginInternal::processRetrieveConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTra
                MmsPluginStorage::instance()->insertMultipart(pMsgInfo->msgId, pMultipart);
        }
 
-       {//make Preview info for APP
+       { /* make Preview info for APP */
                MmsPluginAppBase *appBase;
                appBase = new MmsPluginAppBase(pMmsData);
                appBase->makePreviewInfo(pMsgInfo->msgId, false, pRetrievedFilePath);
@@ -696,7 +726,7 @@ void MmsPluginInternal::processRetrieveConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTra
                MSG_SEC_DEBUG("Fail to get mms file size [%s]", pRetrievedFilePath);
                goto __CATCH;
        }
-       }//make MmsData & insert multipart
+       } /* make MmsData & insert multipart */
 
 __CATCH:
        {
@@ -709,7 +739,7 @@ __CATCH:
        }
        MSG_END();
 }
-#else //NEW process RetrieveConf
+#else /* NEW process RetrieveConf */
 void MmsPluginInternal::processRetrieveConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTranQEntity *pRequest, char *pRetrievedFilePath)
 {
        MSG_BEGIN();
@@ -738,9 +768,9 @@ void MmsPluginInternal::processRetrieveConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTra
        } else {
                pMsgInfo->networkStatus = MSG_NETWORK_RETRIEVE_FAIL;
                pMsgInfo->folderId = MSG_INBOX_ID;
-               // If failed MMS Retrieve, then saved as MMS Noti Ind Message.
-               // It will changed in MsgHandleMmsConfIncomingMsg
-               //pMsgInfo->msgType.subType = MSG_NOTIFICATIONIND_MMS;
+               /* If failed MMS Retrieve, then saved as MMS Noti Ind Message.
+                * It will changed in MsgHandleMmsConfIncomingMsg */
+/*             pMsgInfo->msgType.subType = MSG_NOTIFICATIONIND_MMS; */
        }
 
        char *msisdn = NULL;
@@ -854,7 +884,7 @@ bool MmsPluginInternal::encodeNotifyRespInd(char *szTrID, msg_delivery_report_st
        MsgCloseFile(pFile);
 
        if (pSendFilePath) {
-               //CID 41993: replaced size 'MAX_MSG_DATA_LEN+1' with MAX_FULL_PATH_SIZE
+               /* CID 41993: replaced size 'MAX_MSG_DATA_LEN+1' with MAX_FULL_PATH_SIZE */
                snprintf(pSendFilePath, MAX_FULL_PATH_SIZE, "%s.mms", pTempFilePath);
        } else {
                MSG_DEBUG("[ERROR] pSendFilePath is NULL");
@@ -920,7 +950,7 @@ bool MmsPluginInternal::checkRejectNotiInd(int roamState, bool bReportAllowed, c
        MsgSettingGetBool(MMS_RECV_REJECT_UNKNOWN, &bRejectAnonymous);
        MsgSettingGetBool(MMS_RECV_REJECT_ADVERTISE, &bRejectAdvertisement);
 
-       // Anonymous Reject
+       /* Anonymous Reject */
        if (bRejectAnonymous &&
                (mmsHeader.pFrom == NULL || mmsHeader.pFrom->szAddr[0] == '\0')) {
                MSG_DEBUG("Anonymous Reject... ");
@@ -929,7 +959,7 @@ bool MmsPluginInternal::checkRejectNotiInd(int roamState, bool bReportAllowed, c
                return true;
        }
 
-       // Advertisement Reject
+       /* Advertisement Reject */
        if (bRejectAdvertisement && mmsHeader.msgClass == MMS_MSGCLASS_ADVERTISEMENT) {
                MSG_DEBUG("Advertisement Reject... ");
                encodeNotifyRespInd(mmsHeader.szTrID, MSG_DELIVERY_REPORT_REJECTED, bReportAllowed, pSendFilePath);
@@ -937,7 +967,7 @@ bool MmsPluginInternal::checkRejectNotiInd(int roamState, bool bReportAllowed, c
                return true;
        }
 
-       // Message Reject - Roaming Case
+       /* Message Reject - Roaming Case */
        if (roamState == VCONFKEY_TELEPHONY_SVC_ROAM_ON) {
                retrieveType = (MSG_MMS_HOME_RETRIEVE_TYPE_T)MsgSettingGetInt(MMS_RECV_ABROAD_NETWORK);
                if (retrieveType == MSG_ABROAD_REJECT) {
@@ -956,7 +986,7 @@ bool MmsPluginInternal::checkRejectNotiInd(int roamState, bool bReportAllowed, c
                }
        }
 
-       //Duplicate MMS notification
+       /* Duplicate MMS notification */
        int msgId = 0;
 
        msgId = MmsPluginStorage::instance()->checkDuplicateNotification(mmsHeader.szTrID, mmsHeader.szContentLocation);
@@ -965,7 +995,7 @@ bool MmsPluginInternal::checkRejectNotiInd(int roamState, bool bReportAllowed, c
        if (msgId > 0)
                return true;
 
-       // Not Rejected
+       /* Not Rejected */
        MSG_END();
        return false;
 
@@ -992,7 +1022,7 @@ bool MmsPluginInternal::checkFilterMmsBody(MMS_DATA_S *pMmsData)
 
        MsgMmsConvertMmsDataToMmsMessageData(pMmsData, mmsMsg);
 
-       // Get the text data from the 1st slide.
+       /* Get the text data from the 1st slide. */
        if (mmsMsg->pageCnt <= 0) {
                MSG_WARN("pageCnt : %d", mmsMsg->pageCnt);
                MsgMmsReleaseMmsLists(mmsMsg);
@@ -1019,7 +1049,7 @@ bool MmsPluginInternal::checkFilterMmsBody(MMS_DATA_S *pMmsData)
                        } else {
                                strncpy(filePath, pMedia->szFilePath, MSG_FILEPATH_LEN_MAX);
 
-                               g_file_get_contents((const gchar *)filePath, &fileContent, NULL, NULL);
+                               g_file_get_contents((const gchar*)filePath, (gchar**)&fileContent, NULL, NULL);
 
                                bFiltered = MsgCheckFilterByWord(dbHandle, (const char *)fileContent);
 
index af59880..be84516 100755 (executable)
@@ -56,10 +56,10 @@ typedef struct _MimeTable {
 
 /**************************************************     MIME definition     ***************************************************/
 static const MimeTable mimeTable[] = {
-       // 0
+       /* 0 */
        {"*/*",                                                                                                 "",                                     false,          MIME_ASTERISK,                                                                  MIME_ASTERISK,                                                  MIME_APPLICATION_NONE,                  MIME_MAINTYPE_ETC,                              UNDEFINED_BINARY        },
 
-    // 1
+    /* 1 */
        {"application/xml",                                                                     "",                                     false,          MIME_APPLICATION_XML,                                                   MIME_APPLICATION_XML,                                   MIME_APPLICATION_NONE,                                  MIME_MAINTYPE_TEXT,                     0x27    },
        {"application/wml+xml",                                                         "",                                     false,          MIME_APPLICATION_WML_XML,                                               MIME_APPLICATION_WML_XML,                               MIME_APPLICATION_NONE,                                  MIME_MAINTYPE_TEXT,                     0x3c    },
        {"application/xhtml+xml",                                                               "xhtml",                        false,          MIME_APPLICATION_XHTML_XML,                                             MIME_APPLICATION_XHTML_XML,                             MIME_APPLICATION_NONE,                                  MIME_MAINTYPE_TEXT,                     0x3b    },
@@ -76,7 +76,7 @@ static const MimeTable mimeTable[] = {
        {"application/ram",                                                                     "ram",                          true,           MIME_APPLICATION_RAM,                                                   MIME_APPLICATION_RAM,                                   MIME_APPLICATION_MEDIAPLAYER,                   MIME_MAINTYPE_AUDIO,                    UNDEFINED_BINARY        },
        {"application/*",                                                                               "",                                     false,          MIME_APPLICATION_ASTERIC,                                               MIME_APPLICATION_ASTERIC,                               MIME_APPLICATION_NONE,                                  MIME_MAINTYPE_APPLICATION,      0x10    },
 
-       //16
+       /* 16 */
        {"application/vnd.wap.xhtml+xml",                                               "",                                     false,          MIME_APPLICATION_VND_WAP_XHTMLXML,                              MIME_APPLICATION_VND_WAP_XHTMLXML,              MIME_APPLICATION_NONE,                                  MIME_MAINTYPE_TEXT,                     0x45    },
        {"application/vnd.wap.wmlc",                                                    "",                                     false,          MIME_APPLICATION_VND_WAP_WMLC,                                  MIME_APPLICATION_VND_WAP_WMLC,                  MIME_APPLICATION_NONE,                                  MIME_MAINTYPE_TEXT,                     0x14    },
        {"application/vnd.wap.wmlscriptc",                                              "",                                     false,          MIME_APPLICATION_VND_WAP_WMLSCRIPTC,                    MIME_APPLICATION_VND_WAP_WMLSCRIPTC,    MIME_APPLICATION_NONE,                                  MIME_MAINTYPE_TEXT,                     0x15    },
@@ -111,7 +111,7 @@ static const MimeTable mimeTable[] = {
        {"application/vnd.ms-powerpoint",                                               "ppt",                          true,           MIME_APPLICATION_VND_POWERPOINT,                                MIME_APPLICATION_VND_POWERPOINT,                MIME_APPLICATION_NONE,                                  MIME_MAINTYPE_APPLICATION,      UNDEFINED_BINARY        },
        {"applcation/vnd.ms-word",                                                              "doc",                          true,           MIME_APPLICATION_VND_MSWORD,                                    MIME_APPLICATION_MSWORD,                                MIME_APPLICATION_NONE,                                  MIME_MAINTYPE_APPLICATION,      UNDEFINED_BINARY        },
 
-       //49
+       /* 49 */
        {"application/x-hdmlc",                                                         "",                                     false,          MIME_APPLICATION_X_HDMLC,                                               MIME_APPLICATION_X_HDMLC,                               MIME_APPLICATION_NONE,                                  MIME_MAINTYPE_TEXT,                     0x13    },
        {"application/x-x968-user-cert",                                                "",                                     false,          MIME_APPLICATION_X_X968_USERCERT,                               MIME_APPLICATION_X_X968_USERCERT,               MIME_APPLICATION_NONE,                                  MIME_MAINTYPE_TEXT,                     0x2c    },
        {"application/x-www-form-urlencoded",                                   "",                                     false,          MIME_APPLICATION_X_WWW_FORM_URLENCODED,                 MIME_APPLICATION_X_WWW_FORM_URLENCODED,         MIME_APPLICATION_NONE,                          MIME_MAINTYPE_APPLICATION,      0x12    },
@@ -121,7 +121,7 @@ static const MimeTable mimeTable[] = {
        {"application/x-mspowerpoint",                                                  "ppt",                          true,           MIME_APPLICATION_X_POWERPOINT,                                  MIME_APPLICATION_X_POWERPOINT,                  MIME_APPLICATION_PICSELVIEWER,                  MIME_MAINTYPE_APPLICATION,      UNDEFINED_BINARY        },
 
 
-       //56
+       /* 56 */
        {"audio/basic",                                                                         "snd"/*,au"*/,          false,          MIME_AUDIO_BASIC,                                                               MIME_AUDIO_BASIC,                                               MIME_APPLICATION_MEDIAPLAYER,                   MIME_MAINTYPE_AUDIO,                    UNDEFINED_BINARY        },
        {"audio/mpeg",                                                                                  "mp3",                          true,           MIME_AUDIO_MPEG,                                                                MIME_AUDIO_MP3,                                                 MIME_APPLICATION_MEDIAPLAYER,                   MIME_MAINTYPE_AUDIO,                    UNDEFINED_BINARY        },
        {"audio/mp3",                                                                                   "mp3",                          true,           MIME_AUDIO_MP3,                                                                 MIME_AUDIO_MP3,                                                 MIME_APPLICATION_MEDIAPLAYER,                   MIME_MAINTYPE_AUDIO,                    UNDEFINED_BINARY        },
@@ -152,10 +152,10 @@ static const MimeTable mimeTable[] = {
        {"audio/imy",                                                                                   "imy",                          true,           MIME_AUDIO_IMY,                                                                 MIME_AUDIO_IMY,                                                 MIME_APPLICATION_MEDIAPLAYER,                   MIME_MAINTYPE_AUDIO,                    UNDEFINED_BINARY        },
        {"audio/mobile-xmf",                                                                    "mxmf",                         true,           MIME_AUDIO_MOBILE_XMF,                                                  MIME_AUDIO_XMF,                                                 MIME_APPLICATION_MEDIAPLAYER,                   MIME_MAINTYPE_AUDIO,                    UNDEFINED_BINARY        },
 
-       // 85
+       /* 85 */
        {"audio/vnd.rn-realaudio",                                                              "rm"/*,ram,ra"*/,       true,           MIME_AUDIO_VND_RN_REALAUDIO,                                    MIME_AUDIO_VND_RN_REALAUDIO,                    MIME_APPLICATION_MEDIAPLAYER,                   MIME_MAINTYPE_AUDIO,                    UNDEFINED_BINARY        },
 
-       //86
+       /* 86 */
        {"audio/x-mpeg",                                                                                "mp3",                          true,           MIME_AUDIO_X_MPEG,                                                              MIME_AUDIO_MP3,                                                 MIME_APPLICATION_MEDIAPLAYER,                   MIME_MAINTYPE_AUDIO,                    UNDEFINED_BINARY        },
        {"audio/x-mp3",                                                                         "mp3",                          true,           MIME_AUDIO_X_MP3,                                                               MIME_AUDIO_MP3,                                                 MIME_APPLICATION_MEDIAPLAYER,                   MIME_MAINTYPE_AUDIO,                    UNDEFINED_BINARY        },
        {"audio/x-mpeg3",                                                                               "mp3",                          true,           MIME_AUDIO_X_MPEG3,                                                             MIME_AUDIO_MP3,                                                 MIME_APPLICATION_MEDIAPLAYER,                   MIME_MAINTYPE_AUDIO,                    UNDEFINED_BINARY        },
@@ -176,7 +176,7 @@ static const MimeTable mimeTable[] = {
        {"audio/x-ms-asf",                                                                              "asf",                          true,           MIME_AUDIO_X_MS_ASF,                                                    MIME_AUDIO_X_MS_ASF,                                    MIME_APPLICATION_MEDIAPLAYER,                   MIME_MAINTYPE_AUDIO,                    UNDEFINED_BINARY        },
        {"audio/x-xmf",                                                                         "xmf",                          true,           MIME_AUDIO_X_XMF,                                                               MIME_AUDIO_XMF,                                                 MIME_APPLICATION_MEDIAPLAYER,                   MIME_MAINTYPE_AUDIO,                    UNDEFINED_BINARY        },
 
-       //105
+       /* 105 */
        {"image/gif",                                                                                   "gif",                          false,          MIME_IMAGE_GIF,                                                                 MIME_IMAGE_GIF,                                                 MIME_APPLICATION_IMAGEVIEWER,                   MIME_MAINTYPE_IMAGE,                    0x1d    },
        {"image/jpeg",                                                                                  "jpg"/*,jpeg,jpe,jpz"*/,        false,  MIME_IMAGE_JPEG,                                                        MIME_IMAGE_JPG,                                                 MIME_APPLICATION_IMAGEVIEWER,                   MIME_MAINTYPE_IMAGE,            0x1e    },
        {"image/jpg",                                                                                   "jpg",                          false,          MIME_IMAGE_JPG,                                                                 MIME_IMAGE_JPG,                                                 MIME_APPLICATION_IMAGEVIEWER,                   MIME_MAINTYPE_IMAGE,                    UNDEFINED_BINARY        },
@@ -189,18 +189,18 @@ static const MimeTable mimeTable[] = {
        {"image/svg+xml",                                                                               "svg",                          false,          MIME_IMAGE_SVG,                                                                 MIME_IMAGE_SVG,                                                 MIME_APPLICATION_IMAGEVIEWER,                   MIME_MAINTYPE_IMAGE,                    UNDEFINED_BINARY        },
        {"image/svg-xml",                                                                               "svg",                          false,          MIME_IMAGE_SVG1,                                                                MIME_IMAGE_SVG,                                                 MIME_APPLICATION_IMAGEVIEWER,                   MIME_MAINTYPE_IMAGE,                    UNDEFINED_BINARY        },
 
-       //116
+       /* 116 */
        {"image/vnd.wap.wbmp",                                                                  "wbmp",                         false,          MIME_IMAGE_VND_WAP_WBMP,                                                MIME_IMAGE_WBMP,                                                MIME_APPLICATION_IMAGEVIEWER,                   MIME_MAINTYPE_IMAGE,            0x21    },
        {"image/vnd.tmo.my5-gif",                                                               "gif",                          false,          MIME_IMAGE_VND_TMO_GIF,                                                 MIME_IMAGE_GIF,                                                 MIME_APPLICATION_IMAGEVIEWER,                   MIME_MAINTYPE_IMAGE,            UNDEFINED_BINARY        },
        {"image/vnd.tmo.my5-jpg",                                                               "jpg",                          false,          MIME_IMAGE_VND_TMO_JPG,                                                 MIME_IMAGE_JPG,                                                 MIME_APPLICATION_IMAGEVIEWER,                   MIME_MAINTYPE_IMAGE,            UNDEFINED_BINARY        },
 
-       // 119
+       /* 119 */
        {"image/x-bmp",                                                                         "bmp",                          false,          MIME_IMAGE_X_BMP,                                                               MIME_IMAGE_BMP,                                                 MIME_APPLICATION_IMAGEVIEWER,                   MIME_MAINTYPE_IMAGE,            UNDEFINED_BINARY        },
 
-       // 120
+       /* 120 */
        {"message/rfc822",                                                                              "elm",                          false,          MIME_MESSAGE_RFC822,                                                    MIME_MESSAGE_RFC822,                                    MIME_APPLICATION_NONE,                                  MIME_MAINTYPE_MESSAGE,          UNDEFINED_BINARY        },
 
-       //121
+       /* 121 */
        {"multipart/mixed",                                                                     "",                                     false,          MIME_MULTIPART_MIXED,                                                   MIME_MULTIPART_MIXED,                                   MIME_APPLICATION_NONE,                                  MIME_MAINTYPE_APPLICATION,      0x0c    },
        {"multipart/related",                                                                   "",                                     false,          MIME_MULTIPART_RELATED,                                                 MIME_MULTIPART_RELATED,                                 MIME_APPLICATION_NONE,                                  MIME_MAINTYPE_APPLICATION,      UNDEFINED_BINARY        },
        {"multipart/alternative",                                                               "",                                     false,          MIME_MULTIPART_ALTERNATIVE,                                             MIME_MULTIPART_ALTERNATIVE,                             MIME_APPLICATION_NONE,                                  MIME_MAINTYPE_APPLICATION,      0x0f    },
@@ -209,16 +209,16 @@ static const MimeTable mimeTable[] = {
        {"multipart/report",                                                                    "",                                     false,          MIME_MULTIPART_REPORT,                                                  MIME_MULTIPART_REPORT,                                  MIME_APPLICATION_NONE,                                  MIME_MAINTYPE_APPLICATION,      UNDEFINED_BINARY        },
        {"multipart/voice-message",                                                     "",                                     false,          MIME_MULTIPART_VOICE_MESSAGE,                                   MIME_MULTIPART_VOICE_MESSAGE,                   MIME_APPLICATION_NONE,                                  MIME_MAINTYPE_APPLICATION,      UNDEFINED_BINARY        },
 
-       //128
+       /* 128 */
        {"text/txt",                                                                                    "",                             false,          MIME_TEXT_TXT,                                                                  MIME_TEXT_TXT,                                                  MIME_APPLICATION_PICSELVIEWER,                  MIME_MAINTYPE_TEXT,                     UNDEFINED_BINARY        },
        {"text/html",                                                                                   "html"/*,htm"*/,        false,          MIME_TEXT_HTML,                                                                 MIME_TEXT_HTML,                                                 MIME_APPLICATION_NONE,                                  MIME_MAINTYPE_TEXT,                     0x02    },
-       {"text/plain",                                                                                  "txt"/*,vbm,url"*/,                             false,          MIME_TEXT_PLAIN,                                                                MIME_TEXT_PLAIN,                                                MIME_APPLICATION_PICSELVIEWER,                  MIME_MAINTYPE_TEXT,                     0x03    },
+       {"text/plain",                                                                                  "txt" /*,vbm,url"*/,                            false,          MIME_TEXT_PLAIN,                                                                MIME_TEXT_PLAIN,                                                MIME_APPLICATION_PICSELVIEWER,                  MIME_MAINTYPE_TEXT,                     0x03    },
        {"text/css",                                                                                    "",                                     false,          MIME_TEXT_CSS,                                                                  MIME_TEXT_CSS,                                                  MIME_APPLICATION_NONE,                                  MIME_MAINTYPE_TEXT,                     0x3d    },
        {"text/xml",                                                                                    "",                                     false,          MIME_TEXT_XML,                                                                  MIME_TEXT_XML,                                                  MIME_APPLICATION_NONE,                                  MIME_MAINTYPE_TEXT,                     0x28    },
        {"text/iMelody",                                                                                "imy",                          true,           MIME_TEXT_IMELODY,                                                              MIME_TEXT_IMELODY,                                              MIME_APPLICATION_SOUNDPLAYER,                   MIME_MAINTYPE_AUDIO,            UNDEFINED_BINARY        },
        {"text/calendar",                                                                               "ics",                          true,   MIME_TEXT_CALENDAR,                                                             MIME_TEXT_CALENDAR,                                             MIME_APPLICATION_NONE,                                  MIME_MAINTYPE_TEXT,             UNDEFINED_BINARY },
 
-       //135
+       /* 135 */
        {"text/vnd.wap.wmlscript",                                                              "",                                     false,          MIME_TEXT_VND_WAP_WMLSCRIPT,                                    MIME_TEXT_VND_WAP_WMLSCRIPT,                    MIME_APPLICATION_NONE,                                  MIME_MAINTYPE_TEXT,                     0x09    },
        {"text/vnd.wap.wml",                                                                    "wml",                          false,          MIME_TEXT_VND_WAP_WML,                                                  MIME_TEXT_VND_WAP_WML,                                  MIME_APPLICATION_NONE,                                  MIME_MAINTYPE_TEXT,                     0x08    },
        {"text/vnd.wap.wta-event",                                                              "",                                     false,          MIME_TEXT_VND_WAP_WTA_EVENT,                                    MIME_TEXT_VND_WAP_WTA_EVENT,                    MIME_APPLICATION_NONE,                                  MIME_MAINTYPE_TEXT,                     0x0a    },
@@ -229,7 +229,7 @@ static const MimeTable mimeTable[] = {
        {"text/vnd.sun.j2me.app-descriptor",                                    "jad",                          true,           MIME_TEXT_VND_SUN_J2ME_APP_DESCRIPTOR,                  MIME_TEXT_VND_SUN_J2ME_APP_DESCRIPTOR,  MIME_APPLICATION_NONE,                                          MIME_MAINTYPE_ETC,                      UNDEFINED_BINARY        },
 
 
-       //143
+       /* 143 */
        {"text/x-hdml",                                                                         "",                                     false,          MIME_TEXT_X_HDML,                                                               MIME_TEXT_X_HDML,                                               MIME_APPLICATION_NONE,                                  MIME_MAINTYPE_TEXT,                     0x04    },
        {"text/x-vCalendar",                                                                    "vcs",                          true,           MIME_TEXT_X_VCALENDAR,                                                  MIME_TEXT_X_VCALENDAR,                                  MIME_APPLICATION_NONE,                                  MIME_MAINTYPE_ETC,                      0x06    },
        {"text/x-vCard",                                                                                "vcf",                          true,           MIME_TEXT_X_VCARD,                                                              MIME_TEXT_X_VCARD,                                              MIME_APPLICATION_NONE,                                  MIME_MAINTYPE_ETC,                      0x07    },
@@ -238,7 +238,7 @@ static const MimeTable mimeTable[] = {
        {"text/x-vnote",                                                                                "vnt",                          true,           MIME_TEXT_X_VNOTE,                                                              MIME_TEXT_X_VNOTE,                                              MIME_APPLICATION_NONE,                                  MIME_MAINTYPE_TEXT,                     UNDEFINED_BINARY        },
        {"text/x-vtodo",                                                                                "vts",                          true,           MIME_TEXT_X_VTODO,                                                              MIME_TEXT_X_VNOTE,                                              MIME_APPLICATION_NONE,                                  MIME_MAINTYPE_TEXT,                     UNDEFINED_BINARY        },
 
-       //150
+       /* 150 */
        {"video/mpeg4",                                                                         "mp4",                          true,           MIME_VIDEO_MPEG4,                                                               MIME_VIDEO_MP4,                                                 MIME_APPLICATION_MEDIAPLAYER,                   MIME_MAINTYPE_VIDEO,            UNDEFINED_BINARY        },
        {"video/mp4",                                                                                   "mp4",                          true,           MIME_VIDEO_MP4,                                                                 MIME_VIDEO_MP4,                                                 MIME_APPLICATION_MEDIAPLAYER,                   MIME_MAINTYPE_VIDEO,            UNDEFINED_BINARY        },
        {"video/h263",                                                                                  ""/*,3gpp,mp4"*/,true,          MIME_VIDEO_H263,                                                                MIME_VIDEO_H263,                                                MIME_APPLICATION_MEDIAPLAYER,                   MIME_MAINTYPE_VIDEO,            UNDEFINED_BINARY        },
@@ -250,11 +250,11 @@ static const MimeTable mimeTable[] = {
        {"video/mpeg",                                                                                  "3gp",                          true,           MIME_VIDEO_MPEG,                                                                        MIME_VIDEO_3GP,                                                 MIME_APPLICATION_MEDIAPLAYER,                   MIME_MAINTYPE_VIDEO,            UNDEFINED_BINARY        },
        {"video/quicktime",                                                                             "mov",                          true,           MIME_VIDEO_MOV,                                                                 MIME_VIDEO_3GP,                                                 MIME_APPLICATION_MEDIAPLAYER,                   MIME_MAINTYPE_VIDEO,            UNDEFINED_BINARY        },
 
-       // 160
+       /* 160 */
        {"video/vnd.rn-realvideo",                                                              "rm",                           true,           MIME_VIDEO_VND_RN_REALVIDEO,                                    MIME_VIDEO_VND_RN_REALVIDEO,                    MIME_APPLICATION_MEDIAPLAYER,                   MIME_MAINTYPE_VIDEO,                    UNDEFINED_BINARY        },
        {"video/vnd.rn-realmedia",                                                              "rm",                           true,           MIME_VIDEO_VND_RN_REALMEDIA,                                    MIME_VIDEO_VND_RN_REALMEDIA,                    MIME_APPLICATION_MEDIAPLAYER,                   MIME_MAINTYPE_VIDEO,                    UNDEFINED_BINARY        },
 
-       //162
+       /* 162 */
        {"video/x-mp4",                                                                         "mp4",                          true,           MIME_VIDEO_X_MP4,                                                               MIME_VIDEO_MP4,                                                 MIME_APPLICATION_MEDIAPLAYER,                   MIME_MAINTYPE_VIDEO,                    UNDEFINED_BINARY        },
        {"video/x-pv-mp4",                                                                              "mp4",                          true,           MIME_VIDEO_X_PV_MP4,                                                    MIME_VIDEO_MP4,                                                 MIME_APPLICATION_MEDIAPLAYER,                   MIME_MAINTYPE_VIDEO,                    UNDEFINED_BINARY        },
        {"video/x-pn-realvideo",                                                                "rv",                           true,           MIME_VIDEO_X_PN_REALVIDEO,                                              MIME_VIDEO_VND_RN_REALVIDEO,                    MIME_APPLICATION_MEDIAPLAYER,                   MIME_MAINTYPE_VIDEO,                    UNDEFINED_BINARY        },
@@ -468,7 +468,7 @@ static int mimeTableEnum[] =
        MIME_VIDEO_X_MS_ASF,
        MIME_VIDEO_X_PV_PVX ,
 
-       MIME_UNKNOWN    // MIME_MAX
+       MIME_UNKNOWN    /* MIME_MAX */
 };
 
 
@@ -534,8 +534,8 @@ int __MimeGetTableIndexInt(MimeType mime)
        subtype = (mime & 0x0f00) >> 8;
        index = (mime & 0x003f);
 
-       //If 'type' is zero, mimeTableIndex's array value have a minus value
-       //If 'type' is zero, mime type is '*/*'
+       /If 'type' is zero, mimeTableIndex's array value have a minus value
+        * If 'type' is zero, mime type is '*\/*' */
        if (type == 0)
                tableIndex = 0;
        else
@@ -572,7 +572,7 @@ int __MimeGetTableIndexString(const char *szMime)
 
        if (szMIMEType == NULL) {
                MSG_DEBUG("szMime is NULL");
-                return MIME_UNKNOWN;
+               return MIME_UNKNOWN;
        }
 
        memset(szMIMEType, 0, strlen(szMime) + 1);
@@ -685,8 +685,8 @@ MimeMainType __MimeGetMainTypeName(const char *szType)
 }
 
 
-//For Decode
-// MimeString -> MimeInt
+/* For Decode */
+/* MimeString -> MimeInt */
 MimeType MimeGetMimeIntFromMimeString(char *szMimeStr)
 {
        int index = __MimeGetTableIndexString(szMimeStr);
@@ -697,7 +697,7 @@ MimeType MimeGetMimeIntFromMimeString(char *szMimeStr)
        }
 }
 
-// MimeInt -> MimeString
+/* MimeInt -> MimeString */
 char *MimeGetMimeStringFromMimeInt(int mimeType)
 {
        int idx = __MimeGetTableIndexInt((MimeType)mimeType);
@@ -709,7 +709,7 @@ char *MimeGetMimeStringFromMimeInt(int mimeType)
 }
 
 
-// BinaryCode -> MimeInt
+/* BinaryCode -> MimeInt */
 MimeType MimeGetMimeIntFromBi(int binCode)
 {
        int index;
@@ -725,7 +725,7 @@ MimeType MimeGetMimeIntFromBi(int binCode)
        return MIME_UNKNOWN;
 }
 
-// Mimeint -> Binary Value
+/* Mimeint -> Binary Value */
 int MimeGetBinaryValueFromMimeInt(MimeType mime)
 {
        int index;
@@ -748,7 +748,7 @@ typedef struct {
 
 const ExtTableItem extTable[EXT_TABLE_SIZE] = {
 
-       //text
+       /* text */
        {"txt",   MIME_MAINTYPE_TEXT, MIME_TEXT_PLAIN, "text/plain"},
        {"html",  MIME_MAINTYPE_TEXT, MIME_TEXT_HTML, "text/html"},
        {"xhtml", MIME_MAINTYPE_TEXT, MIME_APPLICATION_XHTML_XML, "application/xhtml+xml"},
@@ -758,9 +758,9 @@ const ExtTableItem extTable[EXT_TABLE_SIZE] = {
        {"vts",   MIME_MAINTYPE_TEXT, MIME_TEXT_X_VTODO, "text/x-vtodo"},
        {"ics",   MIME_MAINTYPE_TEXT, MIME_TEXT_CALENDAR, "text/calendar"},
 
-       //image
+       /* image */
        {"gif",   MIME_MAINTYPE_IMAGE, MIME_IMAGE_GIF, "image/gif"},
-       //{"jpg",   MIME_MAINTYPE_IMAGE, MIME_IMAGE_JPG, "image/jpg"},
+       /* {"jpg",   MIME_MAINTYPE_IMAGE, MIME_IMAGE_JPG, "image/jpg"}, */
        {"jpg",   MIME_MAINTYPE_IMAGE, MIME_IMAGE_JPEG, "image/jpeg"},
        {"jpeg",  MIME_MAINTYPE_IMAGE, MIME_IMAGE_JPEG, "image/jpeg"},
        {"tiff",  MIME_MAINTYPE_IMAGE, MIME_IMAGE_TIFF, "image/tiff"},
@@ -770,7 +770,7 @@ const ExtTableItem extTable[EXT_TABLE_SIZE] = {
        {"bmp",   MIME_MAINTYPE_IMAGE, MIME_IMAGE_BMP, "image/bmp"},
        {"svg",   MIME_MAINTYPE_IMAGE, MIME_IMAGE_SVG, "image/svg+xml"},
 
-       //audio
+       /* audio */
        {"snd",   MIME_MAINTYPE_AUDIO, MIME_AUDIO_BASIC, "audio/basic"},
        {"amr",   MIME_MAINTYPE_AUDIO, MIME_AUDIO_AMR, "audio/amr"},
        {"m4a",   MIME_MAINTYPE_AUDIO, MIME_AUDIO_M4A, "audio/m4a"},
@@ -788,7 +788,7 @@ const ExtTableItem extTable[EXT_TABLE_SIZE] = {
        {"rm",    MIME_MAINTYPE_AUDIO, MIME_AUDIO_VND_RN_REALAUDIO, "audio/vnd.rn-realaudio"},
        {"ra",    MIME_MAINTYPE_AUDIO, MIME_AUDIO_VND_RN_REALAUDIO, "audio/vnd.rn-realaudio"},
 
-       //video
+       /* video */
        {"3gp",   MIME_MAINTYPE_VIDEO, MIME_VIDEO_3GPP, "video/3gpp"},
        {"3gpp",  MIME_MAINTYPE_VIDEO, MIME_VIDEO_3GPP, "video/3gpp"},
        {"mp4",   MIME_MAINTYPE_VIDEO, MIME_VIDEO_MP4, "video/mp4"},
@@ -798,7 +798,7 @@ const ExtTableItem extTable[EXT_TABLE_SIZE] = {
        {"asf",   MIME_MAINTYPE_VIDEO, MIME_VIDEO_X_MS_ASF, "video/x-ms-asf"},
        {"mov", MIME_MAINTYPE_VIDEO, MIME_VIDEO_MOV, "video/quicktime"},
 
-       //application
+       /* application */
        {"smil",  MIME_MAINTYPE_APPLICATION, MIME_APPLICATION_SMIL, "application/smil"},
        {"rm",    MIME_MAINTYPE_APPLICATION, MIME_APPLICATION_VND_RN_REALMEDIA, "application/vnd.rn-realmedia"},
        {"ram",   MIME_MAINTYPE_APPLICATION, MIME_APPLICATION_RAM, "application/ram"},
@@ -817,7 +817,7 @@ const ExtTableItem extTable[EXT_TABLE_SIZE] = {
 
 };
 
-//GetMimeType from File Extension
+/* GetMimeType from File Extension */
 bool MmsGetMimeTypeFromExt(MimeMainType mainType, const char *pExt, MimeType *pMimeType, const char **ppszMimeType)
 {
        const ExtTableItem *matchedItem = NULL;
index f3db2cf..c3471dc 100755 (executable)
@@ -77,8 +77,8 @@ msg_error_t MmsInitialize()
 {
        MSG_BEGIN();
 
-       // remove temp files
-       //MsgMmsInitDir();
+       /* remove temp files */
+/*     MsgMmsInitDir(); */
 
        MSG_END();
 
@@ -181,14 +181,14 @@ msg_error_t MmsUpdateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S
        msg_error_t err = MSG_SUCCESS;
 
        try {
-               if (pMsgInfo->networkStatus == MSG_NETWORK_NOT_SEND || pMsgInfo->networkStatus == MSG_NETWORK_SENDING) { //draft update
+               if (pMsgInfo->networkStatus == MSG_NETWORK_NOT_SEND || pMsgInfo->networkStatus == MSG_NETWORK_SENDING) { /* draft update */
                        err = MmsPluginStorage::instance()->updateMessage(pMsgInfo, pSendOptInfo, pFileData);
                } else {
-                       //[Update Message ID & File path only in case of retrieve. Else update Message ID]
-                       if (pMsgInfo->msgType.subType == MSG_RETRIEVE_AUTOCONF_MMS || pMsgInfo->msgType.subType == MSG_RETRIEVE_MANUALCONF_MMS) { //retrieve conf
+                       /* [Update Message ID & File path only in case of retrieve. Else update Message ID] */
+                       if (pMsgInfo->msgType.subType == MSG_RETRIEVE_AUTOCONF_MMS || pMsgInfo->msgType.subType == MSG_RETRIEVE_MANUALCONF_MMS) { /* retrieve conf */
                                err = MmsPluginStorage::instance()->updateConfMessage(pMsgInfo);
                        } else {
-                               err = MmsPluginStorage::instance()->updateMsgServerID(pMsgInfo, pSendOptInfo); //update send conf
+                               err = MmsPluginStorage::instance()->updateMsgServerID(pMsgInfo, pSendOptInfo); /* update send conf */
                        }
                }
        } catch (MsgException& e) {
@@ -285,7 +285,7 @@ msg_error_t MmsComposeReadReport(MSG_MESSAGE_INFO_S *pMsgInfo)
        return MSG_SUCCESS;
 }
 
-//FIXME::It used for kies but not now
+/* FIXME::It used for kies but not now */
 msg_error_t MmsRestoreMsg(MSG_MESSAGE_INFO_S *pMsgInfo, char *pRcvBody, int rcvdBodyLen, char *filePath)
 {
        MSG_BEGIN();
@@ -299,7 +299,7 @@ msg_error_t MmsRestoreMsg(MSG_MESSAGE_INFO_S *pMsgInfo, char *pRcvBody, int rcvd
                if ((pFile = MsgOpenFile(pMsgInfo->msgData, "rb+")) == NULL) {
                        MSG_DEBUG("File Open Error: %s", pMsgInfo->msgData);
                } else {
-                       //Decode Header
+                       /* Decode Header */
                        if (!MmsBinaryDecodeMsgHeader(pFile, rcvdBodyLen))
                                MSG_DEBUG("Decoding Header Failed \r\n");
 
@@ -314,7 +314,7 @@ msg_error_t MmsRestoreMsg(MSG_MESSAGE_INFO_S *pMsgInfo, char *pRcvBody, int rcvd
                        return MSG_ERR_NULL_POINTER;
                }
 
-               // create temp file
+               /* create temp file */
                if (!MsgOpenCreateAndOverwriteFile(filePath, (char*)pRcvBody,rcvdBodyLen))
                        return MSG_ERR_PLUGIN_STORAGE;
        }
index a6060c7..a24d1a2 100755 (executable)
 #include "MsgSmil.h"
 #include "MmsPluginAppBase.h"
 
+#ifdef FEATURE_CONTAINER_ENABLE
+#include "MsgZoneManager.h"
+#endif /* FEATURE_CONTAINER_ENABLE */
+
 #define PRINT_KEY_VAL_STR(key, val)\
 if (val) {\
 MSG_DEBUG("%-20s: %s", key, val);\
@@ -109,7 +113,7 @@ char *MmsComposeAddress(const MSG_MESSAGE_INFO_S *pMsgInfo, int recipientType)
 
        nAddressCnt = pMsgInfo->nAddressCnt;
 
-       // Calculate allocated buffer size
+       /* Calculate allocated buffer size */
        for (int i = 0; i < nAddressCnt; ++i) {
 
                MSG_SEC_DEBUG("recipientType: %d, address value: %s", pMsgInfo->addressList[i].recipientType, pMsgInfo->addressList[i].addressVal);
@@ -124,7 +128,7 @@ char *MmsComposeAddress(const MSG_MESSAGE_INFO_S *pMsgInfo, int recipientType)
                        } else if (pMsgInfo->addressList[i].addressType == MSG_ADDRESS_TYPE_EMAIL) {
                                addrLen += strlen(pMsgInfo->addressList[i].addressVal);
                        } else
-                               ; // Need to consider IPV4, IPV6, and Alias formatted address
+                               ; /* Need to consider IPV4, IPV6, and Alias formatted address */
 
                        nRecpCnt++;
                }
@@ -134,7 +138,7 @@ char *MmsComposeAddress(const MSG_MESSAGE_INFO_S *pMsgInfo, int recipientType)
                addrLen = addrLen + nRecpCnt - 1;
        szCompose = (char *)calloc(addrLen + 1, 1);
 
-       // Address String copy
+       /* Address String copy */
        for (int i = 0; i < nAddressCnt; ++i) {
                if (pMsgInfo->addressList[i].recipientType == recipientType) {
                        if (szCompose && strlen(szCompose) > 0)
@@ -147,7 +151,7 @@ char *MmsComposeAddress(const MSG_MESSAGE_INFO_S *pMsgInfo, int recipientType)
                        } else if (pMsgInfo->addressList[i].addressType == MSG_ADDRESS_TYPE_EMAIL) {
                                snprintf(pString, MSG_LOCALE_NAME_LEN + MSG_ADDR_LEN + 3, "%s", pMsgInfo->addressList[i].addressVal);
                        } else
-                               ; // Need to consider IPV4, IPV6, and Alias formatted address
+                               ; /* Need to consider IPV4, IPV6, and Alias formatted address */
 
                        g_strlcat(szCompose, pString, addrLen + 1);
                }
@@ -187,7 +191,7 @@ bool MmsInsertPresentation(MmsMsg *pMsg, MimeType mimeType, const char *content_
        if (content_id && strlen(content_id) > 0) {
                snprintf(pMsg->msgBody.presentationType.szContentID, MSG_MSG_ID_LEN + 1, "%s", content_id);
        } else {
-               snprintf(pMsg->msgBody.presentationType.szContentID, MSG_MSG_ID_LEN + 1, "<_S_>");//default
+               snprintf(pMsg->msgBody.presentationType.szContentID, MSG_MSG_ID_LEN + 1, "<_S_>"); /* default */
        }
 
        snprintf(pMsg->msgType.param.szStart, MSG_MSG_ID_LEN + 1, "%s", pMsg->msgBody.presentationType.szContentID);
@@ -273,7 +277,7 @@ void MmsComposeNotiMessage(MmsMsg *pMmsMsg, msg_message_id_t msgID)
 
        pMmsMsg->mmsAttrib.version = mmsHeader.version;
 
-       // setting date
+       /* setting date */
        time(&RawTime);
        localtime_r(&RawTime, &timeInfo);
        nTimeInSecs = mktime(&timeInfo);
@@ -325,7 +329,7 @@ void MmsComposeReadReportMessage(MmsMsg *pMmsMsg, const MSG_MESSAGE_INFO_S *pMsg
        MmsInitMsgType(&pMmsMsg->msgType);
        MmsInitMsgBody(&pMmsMsg->msgBody);
 
-       // setting mmsMsg structure
+       /* setting mmsMsg structure */
        pMmsMsg->mailbox = pMsgInfo->folderId;
        pMmsMsg->msgID = pMsgInfo->msgId;
 
@@ -335,19 +339,19 @@ void MmsComposeReadReportMessage(MmsMsg *pMmsMsg, const MSG_MESSAGE_INFO_S *pMsg
 
        pMmsMsg->mmsAttrib.dataType = MMS_DATATYPE_DRAFT;
 
-       // setting date
+       /* setting date */
        time(&RawTime);
        localtime_r(&RawTime, &timeInfo);
        nTimeInSecs = mktime(&timeInfo);
        pMmsMsg->mmsAttrib.date = nTimeInSecs;
 
-       // setting szMsgId
+       /* setting szMsgId */
        MmsPluginStorage::instance()->getMmsMessageId(selectedMsgId, pMmsMsg);
 
-       //setting subject
+       /* setting subject */
        snprintf(pMmsMsg->mmsAttrib.szSubject, sizeof(pMmsMsg->mmsAttrib.szSubject), "%s", pMsgInfo->subject);
 
-       //setting adddress
+       /* setting adddress */
        MmsSetMsgAddressList(&pMmsMsg->mmsAttrib, pMsgInfo);
 
        if (pMmsMsg->mmsAttrib.szTo)
@@ -359,8 +363,10 @@ msg_error_t MmsMakeMultipartThumbnailInfo(MMS_MULTIPART_DATA_S *pMultipart, char
        if (pMultipart == NULL || thumbnail_path == NULL)
                return MSG_ERR_NULL_POINTER;
 
-//     if (MimeGetMainTypeString(MimeGetMimeStringFromMimeInt(pMultipart->type)) != MIME_MAINTYPE_VIDEO)
-//             return MSG_ERR_INVALID_PARAMETER;
+/*
+       if (MimeGetMainTypeString(MimeGetMimeStringFromMimeInt(pMultipart->type)) != MIME_MAINTYPE_VIDEO)
+               return MSG_ERR_INVALID_PARAMETER;
+*/
 
        char szFileName[MSG_FILENAME_LEN_MAX+1] = {0, };
        char szFileNameWoExt[MSG_FILENAME_LEN_MAX+1] = {0, };
@@ -375,17 +381,26 @@ msg_error_t MmsMakeMultipartThumbnailInfo(MMS_MULTIPART_DATA_S *pMultipart, char
 
        if (pMultipart->drmType == MSG_DRM_TYPE_NONE) {
                pszOrgFileName = strrchr(pMultipart->szFilePath, '/');
-               pszExt = strrchr(pMultipart->szFilePath, '.');
 
-               if (NULL == pszOrgFileName || NULL == pszExt) {
+               if (pszOrgFileName) {
+                       pszExt = strrchr(pszOrgFileName, '.');
+               } else {
                        MSG_DEBUG("Fail in getting filename without extension string");
                        return MSG_ERR_PLUGIN_STORAGE;
                }
 
-               strncpy(szFileNameWoExt, pszOrgFileName + 1, strlen(pszOrgFileName + 1) - strlen(pszExt));
+               if (pszExt) {
+                       strncpy(szFileNameWoExt, pszOrgFileName + 1, strlen(pszOrgFileName + 1) - strlen(pszExt));
+               } else {
+                       if (strlen(pszOrgFileName + 1) <= sizeof(szFileNameWoExt))
+                               strncpy(szFileNameWoExt, pszOrgFileName + 1, strlen(pszOrgFileName + 1));
+                       else
+                               strncpy(szFileNameWoExt, pszOrgFileName + 1, sizeof(szFileNameWoExt));
+               }
+
                snprintf(szFileName, MSG_FILENAME_LEN_MAX+1, "thumb_msg_%s", szFileNameWoExt);
 
-               if (!strcasecmp(pszExt, ".png")) {
+               if (pszExt && !strcasecmp(pszExt, ".png")) {
                        snprintf(thumbPath, MSG_FILEPATH_LEN_MAX, MSG_THUMBNAIL_PATH"%s.png", szFileName);
                } else {
                        snprintf(thumbPath, MSG_FILEPATH_LEN_MAX, MSG_THUMBNAIL_PATH"%s.jpg", szFileName);
@@ -509,14 +524,14 @@ bool MmsFindAndInsertPart(MMS_MESSAGE_DATA_S *pMsgData, MMS_MULTIPART_DATA_S *pM
 
                                        MMS_MEDIA_S *media = (MMS_MEDIA_S *)g_list_nth_data(page->medialist, mediaIdx);
 
-                                       if (media) { // add media
-                                               if (IsMatchedMedia(media, pMultipart) == true) { //matched media
-
-//                                                     if (media->mediatype == MMS_SMIL_MEDIA_IMG_OR_VIDEO) { // ref type is not insert part
-//                                                             MSG_DEBUG("## Matched but media type is ref ##");
-//                                                             return false;
-//                                                     }
-
+                                       if (media) { /* add media */
+                                               if (IsMatchedMedia(media, pMultipart) == true) { /* matched media */
+#if 0
+                                                       if (media->mediatype == MMS_SMIL_MEDIA_IMG_OR_VIDEO) { /* ref type is not insert part */
+                                                               MSG_DEBUG("## Matched but media type is ref ##");
+                                                               return false;
+                                                       }
+#endif
                                                        insert_media = true;
                                                        media->drmType = pMultipart->drmType;
                                                        snprintf(media->szFilePath, sizeof(media->szFilePath), "%s", pMultipart->szFilePath);
@@ -529,9 +544,9 @@ bool MmsFindAndInsertPart(MMS_MESSAGE_DATA_S *pMsgData, MMS_MULTIPART_DATA_S *pM
                                                                        , pageIdx, mediaIdx, media, media->szFilePath, media->szFileName, media->szContentID, media->szContentLocation, media->szContentType);
                                                }
                                        }
-                               } //end for media list
+                               } /* end for media list */
                        }
-               } //end for page list
+               } /* end for page list */
        }
 
        return insert_media;
@@ -604,7 +619,7 @@ bool MmsInsertMixedPartToMmsData(MMS_MESSAGE_DATA_S *pMsgData, MMS_MULTIPART_DAT
        case MIME_MAINTYPE_VIDEO:
                mediatype = MMS_SMIL_MEDIA_VIDEO;
                break;
-       default :
+       default:
                mediatype = MMS_SMIL_MEDIA_INVALID;
                break;
        }
@@ -725,7 +740,7 @@ bool MmsConvertMsgData(MmsMsg *pMsg, MMS_MESSAGE_DATA_S *pMmsMsg)
 {
        MSG_BEGIN();
 
-       //bzero(pMmsMsg, sizeof(MMS_MESSAGE_DATA_S));
+/*     bzero(pMmsMsg, sizeof(MMS_MESSAGE_DATA_S)); */
        pMmsMsg->regionCnt = 0;
        pMmsMsg->pageCnt = 0;
        pMmsMsg->attachCnt = 0;
@@ -747,7 +762,18 @@ bool MmsConvertMsgData(MmsMsg *pMsg, MMS_MESSAGE_DATA_S *pMmsMsg)
                                snprintf(pMmsMsg->smil.szContentID, MSG_MSG_ID_LEN, "%s", pMsg->msgBody.presentationType.szContentID);
                                snprintf(pMmsMsg->smil.szContentLocation, MSG_MSG_ID_LEN, "%s", pMsg->msgBody.presentationType.szContentLocation);
                                snprintf(pMmsMsg->smil.szFileName, MSG_FILENAME_LEN_MAX, "%s", pMsg->msgBody.presentationType.param.szName);
+#ifdef FEATURE_CONTAINER_ENABLE
+                               char *rootPath = MsgZoneGetRootPath();
+                               if (rootPath) {
+                                       snprintf(pMmsMsg->smil.szFilePath, MSG_FILEPATH_LEN_MAX, "%s%s%s", rootPath, MSG_DATA_PATH, pMsg->msgBody.presentationType.param.szFileName);
+                                       g_free(rootPath);
+                                       rootPath = NULL;
+                               } else {
+                                       snprintf(pMmsMsg->smil.szFilePath, MSG_FILEPATH_LEN_MAX, "%s%s", MSG_DATA_PATH, pMsg->msgBody.presentationType.param.szFileName);
+                               }
+#else /* FEATURE_CONTAINER_ENABLE */
                                snprintf(pMmsMsg->smil.szFilePath, MSG_FILEPATH_LEN_MAX, "%s%s", MSG_DATA_PATH, pMsg->msgBody.presentationType.param.szFileName);
+#endif /* FEATURE_CONTAINER_ENABLE */
                        }
                } else {
                        MSG_DEBUG("Not Exist pPresentationBody");
@@ -774,9 +800,20 @@ bool MmsConvertMsgData(MmsMsg *pMsg, MMS_MESSAGE_DATA_S *pMmsMsg)
                                MMS_MEDIA_S *media = NULL;
 
                                snprintf(szBuf, sizeof(szBuf), "%s", partHeader.param.szFileName);
+#ifdef FEATURE_CONTAINER_ENABLE
+                               char *rootPath = MsgZoneGetRootPath();
+                               if (rootPath) {
+                                       snprintf(partHeader.param.szFileName, sizeof(partHeader.param.szFileName), "%s%s%s", rootPath, MSG_DATA_PATH, szBuf);
+                                       g_free(rootPath);
+                                       rootPath = NULL;
+                               } else {
+                                       snprintf(partHeader.param.szFileName, sizeof(partHeader.param.szFileName), "%s%s", MSG_DATA_PATH, szBuf);
+                               }
+#else /* FEATURE_CONTAINER_ENABLE */
                                snprintf(partHeader.param.szFileName, sizeof(partHeader.param.szFileName), "%s%s", MSG_DATA_PATH, szBuf);
+#endif /* FEATURE_CONTAINER_ENABLE */
 
-                               page =  (MMS_PAGE_S *)calloc(1, sizeof(MMS_PAGE_S));
+                               page = (MMS_PAGE_S *)calloc(1, sizeof(MMS_PAGE_S));
                                if (page == NULL) {
                                        MSG_FATAL("page allocation error");
                                        goto FREE_CATCH;
@@ -919,7 +956,7 @@ int MmsUpdatePreviewData(MSG_MESSAGE_INFO_S *pMsgInfo)
        MmsPluginStorage::instance()->getMmsRawFilePath(pMsgInfo->msgId, szFullPath, sizeof(szFullPath));
        MmsPluginDecoder::instance()->decodeMmsPdu(mmsMsg, pMsgInfo->msgId, szFullPath);
 
-       {//make Preview info for APP
+       { /* make Preview info for APP */
                MmsPluginAppBase appBase(mmsMsg);
                appBase.makePreviewInfo(pMsgInfo->msgId, true, szFullPath);
                appBase.getFirstPageTextFilePath(pMsgInfo->msgText, sizeof(pMsgInfo->msgText));
@@ -929,7 +966,7 @@ int MmsUpdatePreviewData(MSG_MESSAGE_INFO_S *pMsgInfo)
        return 0;
 }
 
-//MmsMsg -> MMS_DATA_S
+/* MmsMsg -> MMS_DATA_S */
 bool MmsConvertMmsData(MmsMsg *pMmsMsg, MMS_DATA_S *pMmsData)
 {
        MSG_BEGIN();
@@ -975,7 +1012,18 @@ bool MmsConvertMmsData(MmsMsg *pMmsMsg, MMS_DATA_S *pMmsData)
                        snprintf(pMultipart->szContentID, sizeof(pMultipart->szContentID), "%s", pMmsMsg->msgBody.presentationType.szContentID);
                        snprintf(pMultipart->szContentLocation, sizeof(pMultipart->szContentLocation), "%s", pMmsMsg->msgBody.presentationType.szContentLocation);
                        snprintf(pMultipart->szFileName, sizeof(pMultipart->szFileName), "%s", pMmsMsg->msgBody.presentationType.param.szName);
+#ifdef FEATURE_CONTAINER_ENABLE
+                       char *rootPath = MsgZoneGetRootPath();
+                       if (rootPath) {
+                               snprintf(pMultipart->szFilePath, sizeof(pMultipart->szFilePath), "%s%s%s", rootPath, MSG_DATA_PATH, pMmsMsg->msgBody.presentationType.param.szFileName);
+                               g_free(rootPath);
+                               rootPath = NULL;
+                       } else {
+                               snprintf(pMultipart->szFilePath, sizeof(pMultipart->szFilePath), MSG_DATA_PATH"%s", pMmsMsg->msgBody.presentationType.param.szFileName);
+                       }
+#else /* FEATURE_CONTAINER_ENABLE */
                        snprintf(pMultipart->szFilePath, sizeof(pMultipart->szFilePath), MSG_DATA_PATH"%s", pMmsMsg->msgBody.presentationType.param.szFileName);
+#endif /* FEATURE_CONTAINER_ENABLE */
 
                        pMmsData->smil = pMultipart;
                }
@@ -1014,12 +1062,12 @@ bool MmsConvertMmsData(MmsMsg *pMmsMsg, MMS_DATA_S *pMmsData)
        return true;
 }
 
-//For Encode raw file
+/* For Encode raw file */
 bool MmsConvertMmsMsg(MmsMsg *pMmsMsg, MMS_DATA_S *pMmsData)
 {
        MSG_BEGIN();
 
-       // Initialize mmsMsg structure
+       /* Initialize mmsMsg structure */
        MmsInitMsgAttrib(&pMmsMsg->mmsAttrib);
        MmsInitMsgType(&pMmsMsg->msgType);
        MmsInitMsgBody(&pMmsMsg->msgBody);
@@ -1058,7 +1106,6 @@ bool MmsConvertMmsMsg(MmsMsg *pMmsMsg, MMS_DATA_S *pMmsData)
                        snprintf(pMmsMsg->szTrID, sizeof(pMmsMsg->szTrID), "%s", pHeaderData->trID);
                }
 
-
                snprintf(pMmsMsg->mmsAttrib.szSubject, sizeof(pMmsMsg->mmsAttrib.szSubject), "%s", pHeaderData->szSubject);
 
                pMmsMsg->mmsAttrib.szTo = MmsConvertAddressToOldStyle(pHeaderData->to);
@@ -1066,7 +1113,7 @@ bool MmsConvertMmsMsg(MmsMsg *pMmsMsg, MMS_DATA_S *pMmsData)
                pMmsMsg->mmsAttrib.szBcc = MmsConvertAddressToOldStyle(pHeaderData->bcc);
 
                snprintf(pMmsMsg->mmsAttrib.szFrom, sizeof(pMmsMsg->mmsAttrib.szFrom), "%s", pHeaderData->szFrom);
-       } //CID 41988: Moving all de-referencing of pHeaderData inside null-check block
+       } /* CID 41988: Moving all de-referencing of pHeaderData inside null-check block */
 
        printMmsAttribute(&pMmsMsg->mmsAttrib);
 
@@ -1085,7 +1132,7 @@ bool MmsConvertMmsMsg(MmsMsg *pMmsMsg, MMS_DATA_S *pMmsData)
                                gsize length = 0;
 
                                if (MsgAccessFile(smil_multipart->szFilePath, F_OK)) {
-                                       g_file_get_contents(smil_multipart->szFilePath, &contents, &length, NULL);
+                                       g_file_get_contents((gchar*)smil_multipart->szFilePath, (gchar**)&contents, (gsize*)&length, NULL);
 
                                        MmsInsertPresentation(pMmsMsg, MIME_APPLICATION_SMIL, NULL, contents, length);
 
@@ -1117,7 +1164,7 @@ bool MmsConvertMmsMsg(MmsMsg *pMmsMsg, MMS_DATA_S *pMmsData)
                                        return false;
                                }
                        }
-               } //end for
+               } /* end for */
        }
 
        MSG_END();
@@ -1134,7 +1181,7 @@ char *MmsConvertAddressToOldStyle(MMSList *pAddressList)
 
        nAddressCnt = g_list_length(pAddressList);
 
-       // Calculate allocated buffer size
+       /* Calculate allocated buffer size */
        for (int i = 0; i < nAddressCnt; ++i) {
 
                MMS_ADDRESS_DATA_S * pAddressData = (MMS_ADDRESS_DATA_S *)g_list_nth_data(pAddressList, i);
@@ -1155,7 +1202,7 @@ char *MmsConvertAddressToOldStyle(MMSList *pAddressList)
        szCompose = (char *)calloc(addrLen + 1, 1);
 
        if (szCompose) {
-               // Address String copy
+               /* Address String copy */
                for (int i = 0; i < nAddressCnt; ++i) {
                        MMS_ADDRESS_DATA_S * pAddressData = (MMS_ADDRESS_DATA_S *)g_list_nth_data(pAddressList, i);
 
@@ -1342,15 +1389,15 @@ gint __compare_str(gconstpointer a, gconstpointer b)
        return g_strcmp0((char *)a, (char *)b);
 }
 
-// change file name to Ascii & space -> '_'
-// If replaced filename is duplicated, then it append number
+/* change file name to Ascii & space -> '_' */
+/* If replaced filename is duplicated, then it append number */
 bool MmsChangeFileNameToAscii(MMS_MESSAGE_DATA_S *pMsgData)
 {
        int pageCnt;
        int mediaCnt;
        int attachCnt;
 
-       GList *r_list = NULL;//renamed file list
+       GList *r_list = NULL; /* renamed file list */
 
        pageCnt = g_list_length(pMsgData->pagelist);
 
@@ -1358,7 +1405,7 @@ bool MmsChangeFileNameToAscii(MMS_MESSAGE_DATA_S *pMsgData)
                MMS_PAGE_S *pPage = NULL;
                pPage = (MMS_PAGE_S *)g_list_nth_data(pMsgData->pagelist, i);
                if (pPage == NULL) {
-                       //CID 355351: Freeing r_list in case of error too to prevent memory leak
+                       /* CID 355351: Freeing r_list in case of error too to prevent memory leak */
                        if (r_list != NULL)
                                g_list_free(r_list);
                        return false;
@@ -1369,7 +1416,7 @@ bool MmsChangeFileNameToAscii(MMS_MESSAGE_DATA_S *pMsgData)
                        MMS_MEDIA_S *pMedia = NULL;
                        pMedia = (MMS_MEDIA_S *)g_list_nth_data(pPage->medialist, j);
                        if (pMedia == NULL) {
-                               //CID 355351: Freeing r_list in case of error too to prevent memory leak
+                               /* CID 355351: Freeing r_list in case of error too to prevent memory leak */
                                if (r_list != NULL)
                                        g_list_free(r_list);
                                return false;
@@ -1415,16 +1462,16 @@ bool MmsChangeFileNameToAscii(MMS_MESSAGE_DATA_S *pMsgData)
                                        g_free(str2);
                                }
                        }
-               }//end for media
-       }//end for page
+               } /* end for media */
+       } /* end for page */
 
        attachCnt = g_list_length(pMsgData->attachlist);
        for (int i = 0; i < attachCnt; i++) {
                MMS_ATTACH_S *pAttach = NULL;
                pAttach = (MMS_ATTACH_S *)g_list_nth_data(pMsgData->attachlist, i);
                if (pAttach == NULL) {
-                       //CID 355351: Freeing r_list in case of error too to prevent memory leak
-                       if(r_list != NULL)
+                       /* CID 355351: Freeing r_list in case of error too to prevent memory leak */
+                       if (r_list != NULL)
                                g_list_free(r_list);
                        return false;
                }
@@ -1467,7 +1514,7 @@ bool MmsChangeFileNameToAscii(MMS_MESSAGE_DATA_S *pMsgData)
                        }
                }
 
-       }//end for attach
+       } /* end for attach */
 
        g_list_free(r_list);
 
index 3c5ab54..40cf869 100755 (executable)
@@ -408,57 +408,51 @@ MSG_SMIL_ERR_E  _MsgMMSValidateSMILPage(MMS_MESSAGE_DATA_S *pMsgData, bool bRegA
                        MSG_RETURN_VAL_IF_FAIL((strlen(pMedia->szFilePath) > 0), MSG_SMIL_ERR_INVALID_PAGE_INFO);
 
                        switch (pMedia->mediatype) {
-                       case MMS_SMIL_MEDIA_IMG:
-                               {
-                                       if ((bImgExists == true) || (bVidExists == true) ||
-                                               (bImgOrVidExists== true)) {
-                                               eRet = MSG_SMIL_ERR_SIMILAR_MEDIA_EXISTS;
-                                       } else
-                                               bImgExists = true;
-                               }
+                       case MMS_SMIL_MEDIA_IMG: {
+                               if ((bImgExists == true) || (bVidExists == true) ||
+                                       (bImgOrVidExists== true)) {
+                                       eRet = MSG_SMIL_ERR_SIMILAR_MEDIA_EXISTS;
+                               } else
+                                       bImgExists = true;
                                break;
-                       case MMS_SMIL_MEDIA_AUDIO:
-                               {
-                                       if ((bAudExists == true) || (bVidExists == true) ||
-                                               (bImgOrVidExists== true)) {
-                                               eRet = MSG_SMIL_ERR_SIMILAR_MEDIA_EXISTS;
-                                       } else
-                                               bAudExists = true;
-                               }
+                       }
+                       case MMS_SMIL_MEDIA_AUDIO: {
+                               if ((bAudExists == true) || (bVidExists == true) ||
+                                       (bImgOrVidExists== true)) {
+                                       eRet = MSG_SMIL_ERR_SIMILAR_MEDIA_EXISTS;
+                               } else
+                                       bAudExists = true;
                                break;
-                       case MMS_SMIL_MEDIA_VIDEO:
-                               {
-                                       if ((bImgExists == true) || (bVidExists == true) ||
-                                               (bImgOrVidExists== true)) {
-                                               eRet = MSG_SMIL_ERR_SIMILAR_MEDIA_EXISTS;
-                                       } else
-                                               bVidExists = true;
-                               }
+                       }
+                       case MMS_SMIL_MEDIA_VIDEO: {
+                               if ((bImgExists == true) || (bVidExists == true) ||
+                                       (bImgOrVidExists== true)) {
+                                       eRet = MSG_SMIL_ERR_SIMILAR_MEDIA_EXISTS;
+                               } else
+                                       bVidExists = true;
                                break;
-                       case MMS_SMIL_MEDIA_TEXT:
-                               {
-                                       if (bTxtExists == true) {
-                                               eRet = MSG_SMIL_ERR_SIMILAR_MEDIA_EXISTS;
-                                       } else
-                                               bTxtExists = true;
-                               }
+                       }
+                       case MMS_SMIL_MEDIA_TEXT: {
+                               if (bTxtExists == true) {
+                                       eRet = MSG_SMIL_ERR_SIMILAR_MEDIA_EXISTS;
+                               } else
+                                       bTxtExists = true;
                                break;
-                       case MMS_SMIL_MEDIA_IMG_OR_VIDEO:
-                               {
-                                       if ((bImgExists == true) || (bVidExists == true) ||
-                                               (bImgOrVidExists== true)) {
-                                               eRet = MSG_SMIL_ERR_SIMILAR_MEDIA_EXISTS;
-                                       } else
-                                               bImgOrVidExists = true;
-                               }
+                       }
+                       case MMS_SMIL_MEDIA_IMG_OR_VIDEO: {
+                               if ((bImgExists == true) || (bVidExists == true) ||
+                                       (bImgOrVidExists== true)) {
+                                       eRet = MSG_SMIL_ERR_SIMILAR_MEDIA_EXISTS;
+                               } else
+                                       bImgOrVidExists = true;
                                break;
-                       default:
-                               {
-                                       MSG_DEBUG("_MsgMMSValidateSMILRegion: Invalid Media Information\n");
-                                       return eRet;
-                               }
+                       }
+                       default: {
+                               MSG_DEBUG("_MsgMMSValidateSMILRegion: Invalid Media Information\n");
+                               return eRet;
                                break;
                        }
+                       }
 
                        if (eRet == MSG_SMIL_ERR_SIMILAR_MEDIA_EXISTS) {
                                MSG_DEBUG("_MsgMMSValidateSMILRegion: Similar Media Exists\n");
@@ -489,4 +483,3 @@ MSG_SMIL_ERR_E  _MsgMMSValidateSMILPage(MMS_MESSAGE_DATA_S *pMsgData, bool bRegA
 
        return eRet;
 }
-
index 13df9db..6bdf518 100755 (executable)
@@ -25,6 +25,7 @@
 #include "MsgStorageTypes.h"
 #include "MsgSmil.h"
 #include "MsgSerialize.h"
+
 #include "MmsPluginDebug.h"
 #include "MmsPluginStorage.h"
 #include "MmsPluginMessage.h"
 #include "MmsPluginComposer.h"
 #include "MmsPluginAppBase.h"
 
+#ifdef FEATURE_CONTAINER_ENABLE
+#include "MsgZoneManager.h"
+#endif /* FEATURE_CONTAINER_ENABLE */
+
 MmsPluginStorage *MmsPluginStorage::pInstance = NULL;
 
 
@@ -115,7 +120,7 @@ msg_error_t MmsPluginStorage::addMmsMsgToDB(MmsMsg *pMmsMsg, const char *raw_fil
 
        char sqlQuery[MAX_QUERY_LEN + 1];
 
-       // Add Message
+       /* Add Message */
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
        snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, '%s', '%s', '%s', '%s', '%s', %d, %d, %ld, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d);",
                        MMS_PLUGIN_MESSAGE_TABLE_NAME, pMmsMsg->msgID, pMmsMsg->szTrID, pMmsMsg->szMsgID, pMmsMsg->szForwardMsgID, pMmsMsg->szContentLocation,
@@ -123,7 +128,7 @@ msg_error_t MmsPluginStorage::addMmsMsgToDB(MmsMsg *pMmsMsg, const char *raw_fil
                        pMmsMsg->mmsAttrib.bAskDeliveryReport, pMmsMsg->mmsAttrib.bReportAllowed, pMmsMsg->mmsAttrib.readReportAllowedType,
                        pMmsMsg->mmsAttrib.bAskReadReply, pMmsMsg->mmsAttrib.bRead, pMmsMsg->mmsAttrib.readReportSendStatus, pMmsMsg->mmsAttrib.bReadReportSent,
                        pMmsMsg->mmsAttrib.priority, pMmsMsg->mmsAttrib.bLeaveCopy, pMmsMsg->mmsAttrib.msgSize, pMmsMsg->mmsAttrib.msgClass,
-                       pMmsMsg->mmsAttrib.expiryTime.time,     0/*pMmsMsg->mmsAttrib.bUseDeliveryCustomTime*/, pMmsMsg->mmsAttrib.deliveryTime.time, pMmsMsg->mmsAttrib.msgStatus);
+                       pMmsMsg->mmsAttrib.expiryTime.time,     0 /*pMmsMsg->mmsAttrib.bUseDeliveryCustomTime*/, pMmsMsg->mmsAttrib.deliveryTime.time, pMmsMsg->mmsAttrib.msgStatus);
 
        MSG_DEBUG("\n!!!!!!!!! QUERY : %s\n", sqlQuery);
 
@@ -135,7 +140,7 @@ msg_error_t MmsPluginStorage::addMmsMsgToDB(MmsMsg *pMmsMsg, const char *raw_fil
        return MSG_SUCCESS;
 }
 
-#if 1 //old
+#if 1 /* old */
 msg_error_t MmsPluginStorage::updateConfMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
 {
        MSG_BEGIN();
@@ -149,8 +154,28 @@ msg_error_t MmsPluginStorage::updateConfMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
        MSG_DEBUG("###### pMsgInfo->msgData = %s #######", pMmsRecvData->retrievedFilePath);
 
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
+
+       char trimmed_filepath[MSG_FILEPATH_LEN_MAX+1];
+       memset(trimmed_filepath, 0x00, sizeof(trimmed_filepath));
+#ifdef FEATURE_CONTAINER_ENABLE
+       char *rootPath = MsgZoneGetRootPath();
+       if (rootPath) {
+               if (g_str_has_prefix(pMmsRecvData->retrievedFilePath, rootPath)) {
+                       snprintf(trimmed_filepath, sizeof(trimmed_filepath), "%s", pMmsRecvData->retrievedFilePath+strlen(rootPath));
+               } else {
+                       snprintf(trimmed_filepath, sizeof(trimmed_filepath), "%s", pMmsRecvData->retrievedFilePath);
+               }
+               g_free(rootPath);
+               rootPath = NULL;
+       } else {
+               snprintf(trimmed_filepath, sizeof(trimmed_filepath), "%s", pMmsRecvData->retrievedFilePath);
+       }
+#else /* FEATURE_CONTAINER_ENABLE */
+       snprintf(trimmed_filepath, sizeof(trimmed_filepath), "%s", pMmsRecvData->retrievedFilePath);
+#endif /* FEATURE_CONTAINER_ENABLE */
+
        snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET MESSAGE_ID = '%s', FILE_PATH = '%s' WHERE MSG_ID = %d;",
-                       MMS_PLUGIN_MESSAGE_TABLE_NAME, pMmsRecvData->szMsgID, pMmsRecvData->retrievedFilePath, pMsgInfo->msgId);
+                       MMS_PLUGIN_MESSAGE_TABLE_NAME, pMmsRecvData->szMsgID, trimmed_filepath, pMsgInfo->msgId);
 
        MSG_DEBUG("SQLQuery = %s", sqlQuery);
 
@@ -162,7 +187,7 @@ msg_error_t MmsPluginStorage::updateConfMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
        return MSG_SUCCESS;
 }
 
-#else //new
+#else /* new */
 
 msg_error_t MmsPluginStorage::updateRetriveConf(msg_message_id_t msgId, MMS_DATA_S *pMmsData)
 {
@@ -207,8 +232,8 @@ msg_error_t MmsPluginStorage::updateConfMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
        char working_dir[MSG_FILENAME_LEN_MAX+1] = {0,};
        MMS_DATA_S *pMmsData = NULL;
 
-       //pMsgInfo->msgData is Filepath of json
-       g_file_get_contents(pMsgInfo->msgData, &pSerializedMms, &pSerializedMmsSize, NULL);
+       /* pMsgInfo->msgData is Filepath of json */
+       g_file_get_contents((gchar*)pMsgInfo->msgData, (gchar**)&pSerializedMms, (gsize*)&pSerializedMmsSize, NULL);
 
        if (MsgDeserializeMmsData(pSerializedMms, strlen(pSerializedMms), &pMmsData) != 0) {
                MSG_DEBUG("Fail to Deserialize Message Data");
@@ -219,9 +244,9 @@ msg_error_t MmsPluginStorage::updateConfMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
 
        snprintf(working_dir, sizeof(working_dir), MSG_DATA_PATH"%d.mms.dir", pMsgInfo->msgId);
 
-       MsgMmsSetMultipartListData(pMmsData);//app file -> data
+       MsgMmsSetMultipartListData(pMmsData); /* app file -> data */
 
-       MsgMmsSetMultipartListFilePath(working_dir, pMmsData);//data -> svc file
+       MsgMmsSetMultipartListFilePath(working_dir, pMmsData); /* data -> svc file */
 
        MMS_MULTIPART_DATA_S *pSmilMultipart = pMmsData->smil;
        if (pSmilMultipart) {
@@ -235,7 +260,7 @@ msg_error_t MmsPluginStorage::updateConfMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
                MmsPluginStorage::instance()->insertMultipart(pMsgInfo->msgId, pMultipart);
        }
 
-       {//make Preview info for APP
+       { /* make Preview info for APP */
                MmsPluginAppBase appBase(pMmsData);
                appBase.makePreviewInfo(pMsgInfo->msgId, true, NULL);
                appBase.getFirstPageTextFilePath(pMsgInfo->msgText, sizeof(pMsgInfo->msgText));
@@ -280,8 +305,6 @@ msg_error_t MmsPluginStorage::updateMsgServerID(MSG_MESSAGE_INFO_S *pMsgInfo, MS
                }
        }
 
-       //dbHandle->finalizeQuery();
-
        MSG_END();
 
        return MSG_SUCCESS;
@@ -294,7 +317,7 @@ msg_error_t MmsPluginStorage::insertDeliveryReport(msg_message_id_t msgId, char
        char sqlQuery[MAX_QUERY_LEN + 1];
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
 
-       //( MSG_ID INTEGER , ADDRESS_VAL TEXT , STATUS_TYPE INTEGER , STATUS INTEGER DEFAULT 0 , TIME DATETIME);
+       /* ( MSG_ID INTEGER , ADDRESS_VAL TEXT , STATUS_TYPE INTEGER , STATUS INTEGER DEFAULT 0 , TIME DATETIME); */
        snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s "
                        "(MSG_ID, ADDRESS_VAL, STATUS_TYPE, STATUS, TIME) "
                        "VALUES (%d, '%s', %d, %d, %d);",
@@ -315,7 +338,7 @@ msg_error_t MmsPluginStorage::insertReadReport(msg_message_id_t msgId, char *add
        char sqlQuery[MAX_QUERY_LEN + 1];
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
 
-       //( MSG_ID INTEGER , ADDRESS_VAL TEXT , STATUS_TYPE INTEGER , STATUS INTEGER DEFAULT 0 , TIME DATETIME);
+       /* ( MSG_ID INTEGER , ADDRESS_VAL TEXT , STATUS_TYPE INTEGER , STATUS INTEGER DEFAULT 0 , TIME DATETIME); */
        snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s "
                        "(MSG_ID, ADDRESS_VAL, STATUS_TYPE, STATUS, TIME) "
                        "VALUES (%d, '%s', %d, %d, %d);",
@@ -414,7 +437,7 @@ void MmsPluginStorage::getMmsFromDB(msg_message_id_t msgId, MmsMsg *pMmsMsg)
                pMmsMsg->mmsAttrib.msgSize = dbHandle->columnInt(i++);
                pMmsMsg->mmsAttrib.msgClass = (MmsMsgClass)dbHandle->columnInt(i++);
                pMmsMsg->mmsAttrib.expiryTime.time = dbHandle->columnInt(i++);
-               i++;//CUSTOM_DELIVERY_TIME
+               i++; /* CUSTOM_DELIVERY_TIME */
                pMmsMsg->mmsAttrib.deliveryTime.time = dbHandle->columnInt(i++);
                pMmsMsg->mmsAttrib.msgStatus = (msg_delivery_report_status_t)dbHandle->columnInt(i++);
                snprintf(pMmsMsg->szMsgID, sizeof(pMmsMsg->szMsgID), "%s", dbHandle->columnText(i++));
@@ -423,7 +446,6 @@ void MmsPluginStorage::getMmsFromDB(msg_message_id_t msgId, MmsMsg *pMmsMsg)
                snprintf(pMmsMsg->szFileName, sizeof(pMmsMsg->szFileName), "%s", dbHandle->columnText(i++));
        }
 
-
        dbHandle->finalizeQuery();
 }
 
@@ -539,7 +561,7 @@ msg_error_t MmsPluginStorage::getAddressInfo(msg_message_id_t msgId, MSG_ADDRESS
 
        char sqlQuery[MAX_QUERY_LEN+1];
 
-       // Add Address
+       /* Add Address */
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
 
        snprintf(sqlQuery, sizeof(sqlQuery), "SELECT "
@@ -643,7 +665,7 @@ msg_error_t MmsPluginStorage::getMsgText(MMS_MESSAGE_DATA_S *pMmsMsg, char *pMsg
        if (pMmsMsg == NULL)
                return MSG_ERR_NULL_POINTER;
 
-       // Get the text data from the 1st slide.
+       /* Get the text data from the 1st slide. */
        if (pMmsMsg->pageCnt > 0) {
                pPage = _MsgMmsGetPage(pMmsMsg, 0);
 
@@ -679,12 +701,32 @@ msg_error_t MmsPluginStorage::insertPreviewInfo(int msgId, int type, const char
        char sqlQuery[MAX_QUERY_LEN + 1];
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
 
-       //(MSG_ID INTEGER, TYPE INTEGER, INFO TEXT)
+       char trimmed_value[MSG_FILEPATH_LEN_MAX+1];
+       memset(trimmed_value, 0x00, sizeof(trimmed_value));
+
+#ifdef FEATURE_CONTAINER_ENABLE
+       char *rootPath = MsgZoneGetRootPath();
+       if (rootPath) {
+               if (g_str_has_prefix(value, rootPath)) {
+                       snprintf(trimmed_value, sizeof(trimmed_value), "%s", value+strlen(rootPath));
+               } else {
+                       snprintf(trimmed_value, sizeof(trimmed_value), "%s", value);
+               }
+               g_free(rootPath);
+               rootPath = NULL;
+       } else {
+               snprintf(trimmed_value, sizeof(trimmed_value), "%s", value);
+       }
+#else /* FEATURE_CONTAINER_ENABLE */
+       snprintf(trimmed_value, sizeof(trimmed_value), "%s", value);
+#endif /* FEATURE_CONTAINER_ENABLE */
+
+       /* (MSG_ID INTEGER, TYPE INTEGER, INFO TEXT) */
        snprintf(sqlQuery, sizeof(sqlQuery),
                        "INSERT INTO %s "
                        "(MSG_ID, TYPE, VALUE, COUNT)"
                        "VALUES (%d, %d, \"%s\", %d);",
-                       MSGFW_MMS_PREVIEW_TABLE_NAME, msgId, type, value, count);
+                       MSGFW_MMS_PREVIEW_TABLE_NAME, msgId, type, trimmed_value, count);
 
        MSG_DEBUG("QUERY : [%s]", sqlQuery);
 
@@ -701,7 +743,7 @@ msg_error_t MmsPluginStorage::removePreviewInfo(int msgId)
        char sqlQuery[MAX_QUERY_LEN + 1];
        char filePath[MSG_FILEPATH_LEN_MAX + 1] = {0,};
 
-       // remove thumbnail file
+       /* remove thumbnail file */
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
        snprintf(sqlQuery, sizeof(sqlQuery),
                        "SELECT VALUE FROM %s "
@@ -725,7 +767,7 @@ msg_error_t MmsPluginStorage::removePreviewInfo(int msgId)
        dbHandle->finalizeQuery();
 
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
-       //(MSG_ID INTEGER, TYPE INTEGER, INFO TEXT)
+       /* (MSG_ID INTEGER, TYPE INTEGER, INFO TEXT) */
        snprintf(sqlQuery, sizeof(sqlQuery),
                        "DELETE FROM %s WHERE MSG_ID= %d;",
                        MSGFW_MMS_PREVIEW_TABLE_NAME, msgId);
@@ -746,7 +788,7 @@ msg_error_t MmsPluginStorage::deleteMmsMessage(int msgId)
        char filePath[MSG_FILEPATH_LEN_MAX + 1] = {0,};
        char dirPath[MSG_FILEPATH_LEN_MAX + 1]= {0,};
 
-       //remove DB Preview
+       /* remove DB Preview */
        removePreviewInfo(msgId);
 
        deleteMultipartList(msgId);
@@ -764,16 +806,16 @@ msg_error_t MmsPluginStorage::deleteMmsMessage(int msgId)
 
                snprintf(dirPath, MSG_FILEPATH_LEN_MAX, "%s.dir", filePath);
 
-               //delete pdu file
+               /* delete pdu file */
                if (remove(filePath) == -1)
                        MSG_SEC_DEBUG("Fail to delete file [%s]", filePath);
                else
                        MSG_SEC_DEBUG("Success to delete file [%s]", filePath);
 
-               //delete multipart files
+               /* delete multipart files */
                MsgRmRf(dirPath);
 
-               //delete multipart dir
+               /* delete multipart dir */
                rmdir(dirPath);
 
        } else {
@@ -785,7 +827,7 @@ msg_error_t MmsPluginStorage::deleteMmsMessage(int msgId)
        dbHandle->finalizeQuery();
 
 
-       // Delete Data from MMS table
+       /* Delete Data from MMS table */
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
        snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;",
                        MMS_PLUGIN_MESSAGE_TABLE_NAME, msgId);
@@ -794,7 +836,7 @@ msg_error_t MmsPluginStorage::deleteMmsMessage(int msgId)
                return MSG_ERR_DB_EXEC;
        }
 
-       // Delete Data from MMS STATUS table
+       /* Delete Data from MMS STATUS table */
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
        snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;",
                        MSGFW_REPORT_TABLE_NAME, msgId);
@@ -821,14 +863,14 @@ msg_error_t MmsPluginStorage::insertMultipart(msg_message_id_t msgId, MMS_MULTIP
        }
 
 #if 0
-       //( MSG_ID INTEGER NOT NULL , SEQ INTEGER DEFAULT 0, CONTENT_TYPE TEXT,         NAME TEXT, CHARSET INTEGER,     CONTENT_ID TEXT, CONTENT_LOCATION TEXT, FILE_PATH TEXT, TEXT TEXT,);
-       if (pMultipart->type == MIME_APPLICATION_SMIL) {//Smil
+       /* ( MSG_ID INTEGER NOT NULL , SEQ INTEGER DEFAULT 0, CONTENT_TYPE TEXT,        NAME TEXT, CHARSET INTEGER,     CONTENT_ID TEXT, CONTENT_LOCATION TEXT, FILE_PATH TEXT, TEXT TEXT,); */
+       if (pMultipart->type == MIME_APPLICATION_SMIL) { /* Smil */
                snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s "
                                "(MSG_ID, SEQ, CONTENT_TYPE, NAME, CONTENT_ID, CONTENT_LOCATION, TEXT) "
                                "VALUES (%d, -1, '%s', '%s', '%s', '%s' , '%s');",
                                MSGFW_MMS_MULTIPART_TABLE_NAME, msgId, pMultipart->szContentType, pMultipart->szFileName, pMultipart->szContentID, pMultipart->szContentLocation, (char *)pMultipart->data);
 
-       } else if (MmsIsText(pMultipart->type)) {//Text
+       } else if (MmsIsText(pMultipart->type)) { /* Text */
                snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s "
                                "(MSG_ID, CONTENT_TYPE, NAME, CHARSET, CONTENT_ID, CONTENT_LOCATION, TEXT) "
                                "VALUES (%d, '%s', '%s', %d, '%s', '%s' ,'%s');",
@@ -841,11 +883,31 @@ msg_error_t MmsPluginStorage::insertMultipart(msg_message_id_t msgId, MMS_MULTIP
        }
 #else
 
-       if (pMultipart->type == MIME_APPLICATION_SMIL) {//Smil
+       char trimmed_filepath[MSG_FILEPATH_LEN_MAX+1];
+       memset(trimmed_filepath, 0x00, sizeof(trimmed_filepath));
+
+#ifdef FEATURE_CONTAINER_ENABLE
+       char *rootPath = MsgZoneGetRootPath();
+       if (rootPath) {
+               if (g_str_has_prefix(pMultipart->szFilePath, rootPath)) {
+                       snprintf(trimmed_filepath, sizeof(trimmed_filepath), "%s", pMultipart->szFilePath+strlen(rootPath));
+               } else {
+                       snprintf(trimmed_filepath, sizeof(trimmed_filepath), "%s", pMultipart->szFilePath);
+               }
+               g_free(rootPath);
+               rootPath = NULL;
+       } else {
+               snprintf(trimmed_filepath, sizeof(trimmed_filepath), "%s", pMultipart->szFilePath);
+       }
+#else /* FEATURE_CONTAINER_ENABLE */
+       snprintf(trimmed_filepath, sizeof(trimmed_filepath), "%s", pMultipart->szFilePath);
+#endif /* FEATURE_CONTAINER_ENABLE */
+
+       if (pMultipart->type == MIME_APPLICATION_SMIL) { /* Smil */
                snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s "
                                                "(MSG_ID, SEQ, CONTENT_TYPE, NAME, CONTENT_ID, CONTENT_LOCATION, FILE_PATH) "
                                                "VALUES (%d, -1, \"%s\", \"%s\", \"%s\", \"%s\", \"%s\");",
-                                               MSGFW_MMS_MULTIPART_TABLE_NAME, msgId, pMultipart->szContentType, pMultipart->szFileName, pMultipart->szContentID, pMultipart->szContentLocation, (char *)pMultipart->szFilePath);
+                                               MSGFW_MMS_MULTIPART_TABLE_NAME, msgId, pMultipart->szContentType, pMultipart->szFileName, pMultipart->szContentID, pMultipart->szContentLocation, trimmed_filepath);
 
        } else {
                const char *pszMimeType = NULL;
@@ -858,7 +920,7 @@ msg_error_t MmsPluginStorage::insertMultipart(msg_message_id_t msgId, MMS_MULTIP
 
                /* make tcs_bc_level & malware_allow value */
                pMultipart->tcs_bc_level = -1;
-               //CID 41991: pMultipart->szFilePath is an array, hence checking for null is not required
+               /* CID 41991: pMultipart->szFilePath is an array, hence checking for null is not required */
                if (strlen(pMultipart->szFilePath) > 0 && MsgAccessFile(pMultipart->szFilePath, F_OK) == true) {
                        int bc_level = -1;
                        int tcs_ret = MmsPluginTcsScanFile(pMultipart->szFilePath, &bc_level);
@@ -881,10 +943,29 @@ msg_error_t MmsPluginStorage::insertMultipart(msg_message_id_t msgId, MMS_MULTIP
                        }
                }
 
+               char trimmed_thumbpath[MSG_FILEPATH_LEN_MAX+1];
+               memset(trimmed_thumbpath, 0x00, sizeof(trimmed_thumbpath));
+#ifdef FEATURE_CONTAINER_ENABLE
+               char *rootPath = MsgZoneGetRootPath();
+               if (rootPath) {
+                       if (g_str_has_prefix(pMultipart->szThumbFilePath, rootPath)) {
+                               snprintf(trimmed_thumbpath, sizeof(trimmed_thumbpath), "%s", pMultipart->szThumbFilePath+strlen(rootPath));
+                       } else {
+                               snprintf(trimmed_thumbpath, sizeof(trimmed_thumbpath), "%s", pMultipart->szThumbFilePath);
+                       }
+                       g_free(rootPath);
+                       rootPath = NULL;
+               } else {
+                       snprintf(trimmed_thumbpath, sizeof(trimmed_thumbpath), "%s", pMultipart->szThumbFilePath);
+               }
+#else /* FEATURE_CONTAINER_ENABLE */
+               snprintf(trimmed_thumbpath, sizeof(trimmed_thumbpath), "%s", pMultipart->szThumbFilePath);
+#endif /* FEATURE_CONTAINER_ENABLE */
+
                snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s "
                                                "(MSG_ID, CONTENT_TYPE, NAME, CONTENT_ID, CONTENT_LOCATION, FILE_PATH, TCS_LEVEL, MALWARE_ALLOW, THUMB_FILE_PATH) "
                                                "VALUES (%d, \"%s\", \"%s\", \"%s\", \"%s\" ,\"%s\", '%d', '%d', \"%s\");",
-                                               MSGFW_MMS_MULTIPART_TABLE_NAME, msgId, pMultipart->szContentType, pMultipart->szFileName, pMultipart->szContentID, pMultipart->szContentLocation, (char *)pMultipart->szFilePath, pMultipart->tcs_bc_level, pMultipart->malware_allow, (char *)pMultipart->szThumbFilePath);
+                                               MSGFW_MMS_MULTIPART_TABLE_NAME, msgId, pMultipart->szContentType, pMultipart->szFileName, pMultipart->szContentID, pMultipart->szContentLocation, trimmed_filepath, pMultipart->tcs_bc_level, pMultipart->malware_allow, trimmed_thumbpath);
        }
 #endif
        MSG_DEBUG("QUERY : [%s]", sqlQuery);
@@ -945,8 +1026,8 @@ msg_error_t MmsPluginStorage::deleteMultipartList(int msgId)
        MsgDbHandler *dbHandle = getDbHandle();
 
        char sqlQuery[MAX_QUERY_LEN + 1];
-       //char filePath[MSG_FILEPATH_LEN_MAX + 1] = {0,};
-       const char * filePath = NULL;
+/*     char filePath[MSG_FILEPATH_LEN_MAX + 1] = {0,}; */
+       const char *filePath = NULL;
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
        snprintf(sqlQuery, sizeof(sqlQuery), "SELECT FILE_PATH FROM %s WHERE MSG_ID = %d;",
                        MSGFW_MMS_MULTIPART_TABLE_NAME, msgId);
@@ -993,7 +1074,7 @@ msg_error_t MmsPluginStorage::deleteMultipartList(int msgId)
 
        dbHandle->finalizeQuery();
 
-       // Delete Data from Multipart table
+       /* Delete Data from Multipart table */
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
        snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;",
                        MSGFW_MMS_MULTIPART_TABLE_NAME, msgId);
@@ -1084,9 +1165,9 @@ msg_error_t MmsPluginStorage::addMmsData(msg_message_id_t msgId, const char *raw
                        , MMS_PLUGIN_MESSAGE_TABLE_NAME
                        , msgId, pHeader->trID, pHeader->messageID, "", pHeader->contentLocation
                        , raw_filepath, pHeader->mmsVersion, MMS_DATATYPE_NONE, pHeader->date, pHeader->bHideAddress
-                       , pHeader->bDeliveryReport, 0 /*pMmsMsg->mmsAttrib.bReportAllowed*/, 0/*pMmsMsg->mmsAttrib.readReportAllowedType*/
-                       , pHeader->bReadReport, 0 /*pMmsMsg->mmsAttrib.bRead*/, 0/*pMmsMsg->mmsAttrib.readReportSendStatus*/, 0 /*pMmsMsg->mmsAttrib.bReadReportSent*/
-                       , pHeader->mmsPriority, true/*pMmsMsg->mmsAttrib.bLeaveCopy*/,pHeader->messageSize, pHeader->messageClass
+                       , pHeader->bDeliveryReport, 0 /*pMmsMsg->mmsAttrib.bReportAllowed*/, 0 /*pMmsMsg->mmsAttrib.readReportAllowedType*/
+                       , pHeader->bReadReport, 0 /*pMmsMsg->mmsAttrib.bRead*/, 0 /*pMmsMsg->mmsAttrib.readReportSendStatus*/, 0 /*pMmsMsg->mmsAttrib.bReadReportSent*/
+                       , pHeader->mmsPriority, true /*pMmsMsg->mmsAttrib.bLeaveCopy*/,pHeader->messageSize, pHeader->messageClass
                        , pHeader->expiry.time, 0, pHeader->delivery.time, pHeader->mmsStatus);
 
        msg_error_t db_err = dbHandle->execQuery(sqlQuery);
@@ -1152,34 +1233,33 @@ msg_error_t MmsPluginStorage::getMmsData(msg_message_id_t msgId, MMS_DATA_S *pMm
 
        if (db_err != MSG_SUCCESS) {
                MSG_ERR("prepare query fail [%s], err = [%d]", sqlQuery, db_err);
-               //dbHandle->finalizeQuery();
                return MSG_ERR_PLUGIN_STORAGE;
        }
 
        if (dbHandle->stepQuery() == MSG_ERR_DB_ROW) {
                int i = 0;
                pHeader->mmsVersion = dbHandle->columnInt(i++);
-               i++;//pMmsMsg->mmsAttrib.dataType = (MmsDataType)dbHandle->columnInt(i++);
+               i++; /* pMmsMsg->mmsAttrib.dataType = (MmsDataType)dbHandle->columnInt(i++); */
                pHeader->date = dbHandle->columnInt(i++);
                pHeader->bHideAddress = dbHandle->columnInt(i++);
                pHeader->bDeliveryReport = dbHandle->columnInt(i++);
-               i++;//pMmsMsg->mmsAttrib.bReportAllowed = dbHandle->columnInt(i++);
-               i++;//pMmsMsg->mmsAttrib.readReportAllowedType = (MmsRecvReadReportType)dbHandle->columnInt(i++);
+               i++; /* pMmsMsg->mmsAttrib.bReportAllowed = dbHandle->columnInt(i++); */
+               i++; /* pMmsMsg->mmsAttrib.readReportAllowedType = (MmsRecvReadReportType)dbHandle->columnInt(i++); */
                pHeader->bReadReport = dbHandle->columnInt(i++);
-               i++;//pMmsMsg->mmsAttrib.bRead = dbHandle->columnInt(i++);
-               i++;//pMmsMsg->mmsAttrib.readReportSendStatus = (MmsRecvReadReportSendStatus)dbHandle->columnInt(i++);
-               i++;//pMmsMsg->mmsAttrib.bReadReportSent = dbHandle->columnInt(i++);
+               i++; /* pMmsMsg->mmsAttrib.bRead = dbHandle->columnInt(i++); */
+               i++; /* pMmsMsg->mmsAttrib.readReportSendStatus = (MmsRecvReadReportSendStatus)dbHandle->columnInt(i++); */
+               i++; /* pMmsMsg->mmsAttrib.bReadReportSent = dbHandle->columnInt(i++); */
                pHeader->mmsPriority = (MmsPriority)dbHandle->columnInt(i++);
                pHeader->messageSize = dbHandle->columnInt(i++);
                pHeader->messageClass = (MmsMsgClass)dbHandle->columnInt(i++);
                pHeader->expiry.time = dbHandle->columnInt(i++);
-               i++;//CUSTOM_DELIVERY_TIME
+               i++; /* CUSTOM_DELIVERY_TIME */
                pHeader->delivery.time = dbHandle->columnInt(i++);
-               i++;//pMmsMsg->mmsAttrib.msgStatus = (msg_delivery_report_status_t)dbHandle->columnInt(i++);
+               i++; /* pMmsMsg->mmsAttrib.msgStatus = (msg_delivery_report_status_t)dbHandle->columnInt(i++); */
                snprintf(pHeader->messageID, sizeof(pHeader->messageID), "%s", dbHandle->columnText(i++));
                snprintf(pHeader->trID, sizeof(pHeader->trID), "%s", dbHandle->columnText(i++));
                snprintf(pHeader->contentLocation, sizeof(pHeader->contentLocation), "%s", dbHandle->columnText(i++));
-               i++;//snprintf(pMmsMsg->szFileName, sizeof(pMmsMsg->szFileName), "%s", dbHandle->columnText(i++));
+               i++; /* snprintf(pMmsMsg->szFileName, sizeof(pMmsMsg->szFileName), "%s", dbHandle->columnText(i++)); */
        }
 
        dbHandle->finalizeQuery();
@@ -1205,7 +1285,7 @@ msg_error_t MmsPluginStorage::getMmsData(msg_message_id_t msgId, MMS_DATA_S *pMm
                                        gchar *contents = NULL;
                                        gsize length = 0;
 
-                                       g_file_get_contents (smil_multipart->szFilePath, &contents, &length, NULL);
+                                       g_file_get_contents((gchar*)smil_multipart->szFilePath, (gchar**)&contents, (gsize*)&length, NULL);
 
                                        smil_multipart->pMultipartData = contents;
                                        smil_multipart->nMultipartDataLen = length;
@@ -1231,7 +1311,7 @@ msg_error_t MmsPluginStorage::getMmsData(msg_message_id_t msgId, MMS_DATA_S *pMm
 }
 
 msg_error_t MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo, char *pSerializedMms)
-{//send request or notification ind
+{ /* send request or notification ind */
        MSG_BEGIN();
 
        msg_error_t     err = MSG_SUCCESS;
@@ -1247,33 +1327,33 @@ msg_error_t MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDI
                char raw_filepath[MSG_FILENAME_LEN_MAX+1] = {0,};
                char working_dir[MSG_FILENAME_LEN_MAX+1] = {0,};
 
-               //compose
+               /* compose */
                MmsPluginComposer::instance()->composeSendReq(pMsgInfo, pSendOptInfo, pMmsData);
 
-               //encode
+               /* encode */
                snprintf(working_dir, sizeof(working_dir), MSG_DATA_PATH"%d.mms.dir", pMsgInfo->msgId);
 
-               MsgMmsSetMultipartListData(pMmsData);//app file -> data
+               MsgMmsSetMultipartListData(pMmsData); /* app file -> data */
 
-               MsgMmsSetMultipartListFilePath(working_dir, pMmsData);//data -> svc file
+               MsgMmsSetMultipartListFilePath(working_dir, pMmsData); /* data -> svc file */
 
                snprintf(raw_filepath, sizeof(raw_filepath), "%s%d.mms", MSG_DATA_PATH, pMsgInfo->msgId);
 
                MmsPluginEncoder::instance()->encodeMmsPdu(pMmsData, pMsgInfo->msgId, raw_filepath);
 
-               //add to db
+               /* add to db */
                if (addMmsData(pMsgInfo->msgId, raw_filepath, pMmsData) != MSG_SUCCESS) {
                        MSG_DEBUG("Fail to add db message");
                        goto __CATCH;
                }
 
-               //set
+               /* set */
                if (MsgGetFileSize(raw_filepath, (int *)&pMsgInfo->dataSize) == false) {
                        MSG_SEC_DEBUG("Fail to get mms file size [%s]", raw_filepath);
                        goto __CATCH;
                }
 
-               {//make Preview info for APP
+               { /* make Preview info for APP */
                        MmsPluginAppBase appBase(pMmsData);
                        appBase.makePreviewInfo(pMsgInfo->msgId, true, raw_filepath);
                        appBase.getFirstPageTextFilePath(pMsgInfo->msgText, sizeof(pMsgInfo->msgText));
@@ -1286,33 +1366,33 @@ msg_error_t MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDI
                char raw_filepath[MSG_FILENAME_LEN_MAX+1] = {0,};
                char working_dir[MSG_FILENAME_LEN_MAX+1] = {0,};
 
-               //compose
+               /* compose */
                MmsPluginComposer::instance()->composeRetrieveConf(pMsgInfo, pSendOptInfo, pMmsData);
 
-               //encode
+               /* encode */
                snprintf(working_dir, sizeof(working_dir), MSG_DATA_PATH"%d.mms.dir", pMsgInfo->msgId);
 
-               MsgMmsSetMultipartListData(pMmsData);//app file -> data
+               MsgMmsSetMultipartListData(pMmsData); /* app file -> data */
 
-               MsgMmsSetMultipartListFilePath(working_dir, pMmsData);//data -> svc file
+               MsgMmsSetMultipartListFilePath(working_dir, pMmsData); /* data -> svc file */
 
                snprintf(raw_filepath, sizeof(raw_filepath), "%s%d.mms", MSG_DATA_PATH, pMsgInfo->msgId);
 
                MmsPluginEncoder::instance()->encodeMmsPdu(pMmsData, pMsgInfo->msgId, raw_filepath);
 
-               //add to db
+               /* add to db */
                if (addMmsData(pMsgInfo->msgId, raw_filepath, pMmsData) != MSG_SUCCESS) {
                        MSG_DEBUG("Fail to add db message");
                        goto __CATCH;
                }
 
-               //set
+               /* set */
                if (MsgGetFileSize(raw_filepath, (int *)&pMsgInfo->dataSize) == false) {
                        MSG_SEC_DEBUG("Fail to get mms file size [%s]", raw_filepath);
                        goto __CATCH;
                }
 
-               {//make Preview info for APP
+               { /* make Preview info for APP */
                        MmsPluginAppBase *appBase;
                        appBase = new MmsPluginAppBase(pMmsData);
                        appBase->makePreviewInfo(pMsgInfo->msgId, true, raw_filepath);
@@ -1369,15 +1449,15 @@ msg_error_t MmsPluginStorage::updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SE
                char raw_filepath[MSG_FILENAME_LEN_MAX+1] = {0,};
                char working_dir[MSG_FILENAME_LEN_MAX+1] = {0,};
 
-               //compose
+               /* compose */
                MmsPluginComposer::instance()->composeSendReq(pMsgInfo, pSendOptInfo, pMmsData);
 
-               //encode
+               /* encode */
                snprintf(raw_filepath, sizeof(raw_filepath), "%s%d.mms", MSG_DATA_PATH, pMsgInfo->msgId);
 
                MmsPluginEncoder::instance()->encodeMmsPdu(pMmsData, pMsgInfo->msgId, raw_filepath);
 
-               //add to db
+               /* add to db */
                memset(sqlQuery, 0x00, sizeof(sqlQuery));
                snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET ASK_DELIVERY_REPORT = %d, KEEP_COPY = %d, ASK_READ_REPLY = %d, EXPIRY_TIME = %d, CUSTOM_DELIVERY_TIME = %d, DELIVERY_TIME= %d, PRIORITY = %d \
                                WHERE MSG_ID = %d;", MMS_PLUGIN_MESSAGE_TABLE_NAME, pSendOptInfo->bDeliverReq, pSendOptInfo->bKeepCopy, pSendOptInfo->option.mmsSendOptInfo.bReadReq,
@@ -1385,20 +1465,32 @@ msg_error_t MmsPluginStorage::updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SE
                                pSendOptInfo->option.mmsSendOptInfo.priority, pMsgInfo->msgId);
 
                if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
-                       //CID 41997: Releasing pMmsDta in case of failure
+                       /* CID 41997: Releasing pMmsDta in case of failure */
                        MsgMmsRelease(&pMmsData);
                        return MSG_ERR_DB_EXEC;
                }
 
+
+#ifdef FEATURE_CONTAINER_ENABLE
+               char *rootPath = MsgZoneGetRootPath();
+               if (rootPath) {
+                       snprintf(working_dir, sizeof(working_dir), "%s%s%d.mms.dir", rootPath, MSG_DATA_PATH, pMsgInfo->msgId);
+                       g_free(rootPath);
+                       rootPath = NULL;
+               } else {
+                       snprintf(working_dir, sizeof(working_dir), MSG_DATA_PATH"%d.mms.dir", pMsgInfo->msgId);
+               }
+#else /* FEATURE_CONTAINER_ENABLE */
                snprintf(working_dir, sizeof(working_dir), MSG_DATA_PATH"%d.mms.dir", pMsgInfo->msgId);
+#endif /* FEATURE_CONTAINER_ENABLE */
 
-               MsgMmsSetMultipartListData(pMmsData);//app file -> data
+               MsgMmsSetMultipartListData(pMmsData); /* app file -> data */
 
-               MmsPluginStorage::instance()->deleteMultipartList(pMsgInfo->msgId); //remove exist multipart
+               MmsPluginStorage::instance()->deleteMultipartList(pMsgInfo->msgId); /* remove exist multipart */
 
-               MsgMmsSetMultipartListFilePath(working_dir, pMmsData);//data -> svc file
+               MsgMmsSetMultipartListFilePath(working_dir, pMmsData); /* data -> svc file */
 
-               {//add multipart list
+               { /* add multipart list */
                        if (pMmsData->smil) {
                                pMmsData->smil->type = MIME_APPLICATION_SMIL;
                                insertMultipart(pMsgInfo->msgId, pMmsData->smil);
@@ -1418,15 +1510,15 @@ msg_error_t MmsPluginStorage::updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SE
                        }
                }
 
-               //set
+               /* set */
                if (MsgGetFileSize(raw_filepath, (int *)&pMsgInfo->dataSize) == false) {
                        MSG_SEC_DEBUG("Fail to get mms file size [%s]", raw_filepath);
-                       //CID 41997: Releasing pMmsDta in case of failure
+                       /* CID 41997: Releasing pMmsDta in case of failure */
                        MsgMmsRelease(&pMmsData);
                        goto __CATCH;
                }
 
-               {//make Preview info for APP
+               { /* make Preview info for APP */
                        MmsPluginAppBase *appBase;
                        appBase = new MmsPluginAppBase(pMmsData);
                        appBase->makePreviewInfo(pMsgInfo->msgId, true, raw_filepath);
@@ -1470,29 +1562,29 @@ msg_error_t MmsPluginStorage::getMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOP
        pMmsData->header = pHeader;
 
        switch(pMsg->msgType.subType) {
-               case MSG_SENDREQ_MMS:
-                       pHeader->messageType = MMS_MSGTYPE_SEND_REQ;
-                       break;
-               case MSG_SENDCONF_MMS:
-                       pHeader->messageType = MMS_MSGTYPE_SEND_CONF;
-                       break;
-               case MSG_RETRIEVE_MMS:
-                       pHeader->messageType = MMS_MSGTYPE_RETRIEVE_CONF;
-                       break;
-               case MSG_RETRIEVE_AUTOCONF_MMS:
-                       pHeader->messageType = MMS_MSGTYPE_RETRIEVE_CONF;
-                       break;
-               case MSG_RETRIEVE_MANUALCONF_MMS:
-                       pHeader->messageType = MMS_MSGTYPE_RETRIEVE_CONF;
-                       break;
-               case MSG_NOTIFICATIONIND_MMS:
-                       pHeader->messageType = MMS_MSGTYPE_NOTIFICATION_IND;
-                       break;
-               default:
-                       break;
+       case MSG_SENDREQ_MMS:
+               pHeader->messageType = MMS_MSGTYPE_SEND_REQ;
+               break;
+       case MSG_SENDCONF_MMS:
+               pHeader->messageType = MMS_MSGTYPE_SEND_CONF;
+               break;
+       case MSG_RETRIEVE_MMS:
+               pHeader->messageType = MMS_MSGTYPE_RETRIEVE_CONF;
+               break;
+       case MSG_RETRIEVE_AUTOCONF_MMS:
+               pHeader->messageType = MMS_MSGTYPE_RETRIEVE_CONF;
+               break;
+       case MSG_RETRIEVE_MANUALCONF_MMS:
+               pHeader->messageType = MMS_MSGTYPE_RETRIEVE_CONF;
+               break;
+       case MSG_NOTIFICATIONIND_MMS:
+               pHeader->messageType = MMS_MSGTYPE_NOTIFICATION_IND;
+               break;
+       default:
+               break;
        }
 
-       err = getMmsData(pMsg->msgId, pMmsData); // get MmsData Info from DB
+       err = getMmsData(pMsg->msgId, pMmsData); /* get MmsData Info from DB */
 
        if (err == MSG_SUCCESS) {
 
@@ -1506,7 +1598,7 @@ msg_error_t MmsPluginStorage::getMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOP
                        pSendOptInfo->option.mmsSendOptInfo.deliveryTime.time = pHeader->delivery.time;
                }
 
-               //MsgMmsSetMultipartListData(pMmsData);
+               /* MsgMmsSetMultipartListData(pMmsData); */
                int mmsDataSize = MsgSerializeMms(pMmsData, pSerializedMms);
                if (mmsDataSize > 0) {
                        pMsg->dataSize = mmsDataSize;
@@ -1518,7 +1610,7 @@ msg_error_t MmsPluginStorage::getMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOP
                MSG_ERR("getMmsData fail, err = [%d]",  err);
        }
 
-       //Release pMmsData
+       /* Release pMmsData */
        MsgMmsRelease(&pMmsData);
        MSG_END();
 
@@ -1529,7 +1621,7 @@ msg_error_t MmsPluginStorage::updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
 {
        MSG_BEGIN();
 
-       //update multipart list
+       /* update multipart list */
        MMSList *multipart_list = NULL;
        if (MmsPluginStorage::instance()->getMultipartList(pMsgInfo->msgId, &multipart_list) != MSG_SUCCESS)
                return -1;
@@ -1539,7 +1631,7 @@ msg_error_t MmsPluginStorage::updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
                MmsPluginStorage::instance()->updateMultipart(pMsgInfo->msgId, true, pMultipart);
        }
 
-       //update preview
+       /* update preview */
        char szFullPath[MSG_FILEPATH_LEN_MAX] = {0, };
        MmsMsg *mmsMsg = NULL;
        unique_ptr<MmsMsg*, void(*)(MmsMsg**)> buf(&mmsMsg, unique_ptr_deleter);
@@ -1548,7 +1640,7 @@ msg_error_t MmsPluginStorage::updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
 
        MmsPluginStorage::instance()->getMmsRawFilePath(pMsgInfo->msgId, szFullPath, sizeof(szFullPath));
        MmsPluginDecoder::instance()->decodeMmsPdu(mmsMsg, pMsgInfo->msgId, szFullPath);
-       {//make Preview info for APP
+       { /* make Preview info for APP */
                MmsPluginAppBase *appBase;
                appBase = new MmsPluginAppBase(mmsMsg);
                appBase->makePreviewInfo(pMsgInfo->msgId, true, szFullPath);
@@ -1568,7 +1660,7 @@ int MmsPluginStorage::checkDuplicateNotification(char* pszTrID, char* pszContent
        if (!pszTrID || strlen(pszTrID) == 0)
                return 0;
 
-       if(!pszContentLocation || strlen(pszContentLocation) == 0)
+       if (!pszContentLocation || strlen(pszContentLocation) == 0)
                return 0;
 
        MSG_DEBUG("Trans Id = %s, Content Loc = %s", pszTrID, pszContentLocation);
index 5a9ca7b..4c332da 100755 (executable)
@@ -37,19 +37,18 @@ int MmsPluginTcsScanFile(const char *filepath, int *bLevel)
        MSG_SEC_DEBUG("Scanning file name : %s\n", filepath);
 
        hLib = TCSLibraryOpen();
-       if(hLib == INVALID_TCSLIB_HANDLE) {
+       if (hLib == INVALID_TCSLIB_HANDLE) {
                MSG_DEBUG("TCSLibraryOpen error\n");
                return -1;
        }
 
        rtn = TCSScanFile(hLib, filepath, TCS_DTYPE_UNKNOWN, TCS_SA_SCANONLY, 1, &result);
-       if(rtn == 0)
+       if (rtn == 0)
        {
                MSG_DEBUG("Detected malware number: %d\n", result.iNumDetected);
                i = result.iNumDetected;
                pDetected = result.pDList;
-               while(i && pDetected)
-               {
+               while (i && pDetected) {
                        int temp_b_level;
                        int temp_s_class;
                        MSG_SEC_DEBUG(" +-- Malware [%d] Name: %s\n", i, pDetected->pszName);
index bd79ac6..094c26d 100755 (executable)
@@ -51,7 +51,7 @@ bool MmsPluginTextConvert(const char *pToCodeSet, const char *pFromCodeset, cons
                goto __CATCH;
        }
 
-       if (strcasecmp("utf-16", pFromCodeset) == 0) {//check utf-8 str though utf-16
+       if (strcasecmp("utf-16", pFromCodeset) == 0) { /* check utf-8 str though utf-16 */
 
                MSG_DEBUG("Codeset [%s] check utf-8 type", pFromCodeset);
 
index 5af58cf..a2fb83c 100755 (executable)
@@ -85,7 +85,7 @@ void MmsPluginTransport::submitRequest(const MSG_REQUEST_INFO_S *pReqInfo)
                MSG_MMS_VLD_INFO("%d, MMS Receive Auto Start %s->%s, Success", pReqInfo->msgInfo.msgId, pReqInfo->msgInfo.addressList[0].addressVal, (msisdn == NULL)?"ME":msisdn);
                break;
 
-       case MSG_NOTIFYRESPIND_MMS: //reject
+       case MSG_NOTIFYRESPIND_MMS: /* reject */
        {
                MSG_DEBUG("######### MANUAL RETRIEVE : SEND NOTIFY RESPONSE IND");
                reqItem.msgId = pReqInfo->msgInfo.msgId;
@@ -110,28 +110,26 @@ void MmsPluginTransport::submitRequest(const MSG_REQUEST_INFO_S *pReqInfo)
                MSG_MMS_VLD_INFO("%d, MMS Receive Manual Start %s->%s, Success", pReqInfo->msgInfo.msgId, pReqInfo->msgInfo.addressList[0].addressVal, (msisdn == NULL)?"ME":msisdn);
                break;
 
-       case MSG_READREPLY_MMS:
-       {
+       case MSG_READREPLY_MMS: {
                MSG_DEBUG("######### SEND READ REPORT : POST TRANSACTION");
                reqItem.msgId = pReqInfo->msgInfo.msgId;
                reqItem.eMmsPduType = eMMS_READREPORT_REQ;
                reqItem.eHttpCmdType = eHTTP_CMD_POST_TRANSACTION;
                reqItem.pPostData = MsgOpenAndReadMmsFile(pReqInfo->msgInfo.msgData, 0, -1, &reqItem.postDataLen);
-               // remove x-Read-Rec.ind file
+               /* remove x-Read-Rec.ind file */
                int ret = remove(pReqInfo->msgInfo.msgData);
                if (ret != 0) {
                        MSG_DEBUG("remove fail\n");
                }
                break;
        }
-       case MSG_READRECIND_MMS:
-       {
+       case MSG_READRECIND_MMS: {
                MSG_DEBUG("######### SEND READREC IND : POST TRANSACTION");
                reqItem.msgId = pReqInfo->msgInfo.msgId;
                reqItem.eMmsPduType = eMMS_READREC_IND;
                reqItem.eHttpCmdType = eHTTP_CMD_POST_TRANSACTION;
                reqItem.pPostData = MsgOpenAndReadMmsFile(pReqInfo->msgInfo.msgData, 0, -1, &reqItem.postDataLen);
-               // remove x-Read-Rec.ind file
+               /* remove x-Read-Rec.ind file */
                int ret = remove(pReqInfo->msgInfo.msgData);
                if (ret != 0) {
                        MSG_DEBUG("remove fail\n");
index 41a87ea..80bac5a 100755 (executable)
 #include "MmsPluginStorage.h"
 #include "MmsPluginUtil.h"
 
+#ifdef FEATURE_CONTAINER_ENABLE
+#include "MsgZoneManager.h"
+#endif /* FEATURE_CONTAINER_ENABLE */
+
 void PRINT_PDU_TYPE(MMS_PDU_TYPE_T pduType)
 {
        switch (pduType) {
@@ -214,10 +218,7 @@ MmsPluginUaManager::MmsPluginUaManager()
 
 MmsPluginUaManager::~MmsPluginUaManager()
 {
-       if (pInstance) {
-               delete pInstance;
-               pInstance = NULL;
-       }
+
 }
 
 MmsPluginUaManager *MmsPluginUaManager::instance()
@@ -230,7 +231,7 @@ MmsPluginUaManager *MmsPluginUaManager::instance()
 
 void MmsPluginUaManager::start()
 {
-//     bool bStart = true;
+/*     bool bStart = true; */
 
        MutexLocker lock(mx);
 
@@ -346,10 +347,10 @@ void MmsPluginUaManager::run()
                }
                unlock();
 
-               // Request CM Open
+               /* Request CM Open */
                if (!(cmAgent->open())) {
                        MSG_FATAL("Cm Open Failed");
-                       // delete all request from reqQEntities
+                       /* delete all request from reqQEntities */
                        lock();
                        int qSize = mmsTranQ.size();
                        unlock();
@@ -363,7 +364,7 @@ void MmsPluginUaManager::run()
                                lock();
                                mmsTranQ.front(&reqEntity);
                                unlock();
-                               // notify send fail to APP
+                               /* notify send fail to APP */
                                MmsPluginEventHandler::instance()->handleMmsError(&reqEntity);
 
                                if (reqEntity.pGetData) {
@@ -379,7 +380,7 @@ void MmsPluginUaManager::run()
                                }
                                lock();
                                mmsTranQ.remove(reqEntity, compare_func_for_removal);
-                               //mmsTranQ.pop_front();
+/*                             mmsTranQ.pop_front(); */
                                unlock();
                        }
                        lock();
@@ -410,7 +411,7 @@ void MmsPluginUaManager::run()
 
                        PRINT_QUEUE_ENTITY(&reqEntity);
 
-                       // MMS Transaction
+                       /* MMS Transaction */
                        MSG_DEBUG("\n\n ===================  MMS Transaction Start ========================");
 
                        do {
@@ -421,9 +422,9 @@ void MmsPluginUaManager::run()
                                        MmsPluginEventHandler::instance()->handleMmsError(&reqEntity);
                                        lock();
                                        mmsTranQ.remove(reqEntity, compare_func_for_removal);
-                                       //mmsTranQ.pop_front();
+/*                                     mmsTranQ.pop_front(); */
                                        unlock();
-                                       //try to next mmsTranQ
+                                       /* try to next mmsTranQ */
                                        break;
                                }
 
@@ -438,19 +439,19 @@ void MmsPluginUaManager::run()
                                        reqEntity.isCompleted = true;
                                        lock();
                                        mmsTranQ.remove(reqEntity, compare_func_for_removal);
-                                       //mmsTranQ.pop_front();
+/*                                     mmsTranQ.pop_front(); */
                                        unlock();
                                        MSG_DEBUG("Transaction Completed");
                                        break;
                                } else {
-                                       // change MmsPduType from XXX.req to XXX.conf for waiting
+                                       /* change MmsPduType from XXX.req to XXX.conf for waiting */
                                        MSG_DEBUG("Update Pdutype");
                                        updatePduType(&reqEntity);
                                        MSG_DEBUG("Waiting Conf");
                                }
                                lock();
                                mmsTranQ.remove(reqEntity, compare_func_for_removal);
-                               //mmsTranQ.pop_front();
+/*                             mmsTranQ.pop_front(); */
                                unlock();
                                //////// Waiting Conf //////////////////////
                                MMS_NET_ERROR_T networkErr;
@@ -459,7 +460,7 @@ void MmsPluginUaManager::run()
                                        bool bReportAllowed;
                                        char retrievedFilePath[MAX_FULL_PATH_SIZE+1] = {0,};
 
-                                       // process Http data
+                                       /* process Http data */
                                        try {
                                                if (processReceivedData(reqEntity.msgId, reqEntity.pGetData, reqEntity.getDataLen, retrievedFilePath) == false) {
                                                        MmsPluginEventHandler::instance()->handleMmsError(&reqEntity);
@@ -501,21 +502,21 @@ void MmsPluginUaManager::run()
                                        MSG_DEBUG("conf received successfully -2");
                                        MSG_DEBUG("reqEntity.eMmsPduType [%d]", reqEntity.eMmsPduType);
 
-                                       // send NotifyResponseInd
+                                       /* send NotifyResponseInd */
                                        if (reqEntity.eMmsPduType == eMMS_RETRIEVE_AUTO_CONF) {
                                                char filepath[MAX_FULL_PATH_SIZE] = {0};
-                                               // change MmsPduType for ind or ack
-                                               // make the PDU and then attach to reqEntity also.
+                                               /* change MmsPduType for ind or ack */
+                                               /* make the PDU and then attach to reqEntity also. */
                                                updatePduType(&reqEntity);
 
                                                MSG_DEBUG("#### eMmsPduType:%d ####", reqEntity.eMmsPduType);
 
-                                               //update http command type & encode m-notify-response-ind
+                                               /* update http command type & encode m-notify-response-ind */
                                                reqEntity.eHttpCmdType = eHTTP_CMD_POST_TRANSACTION;
 
                                                try {
                                                        MmsPluginInternal::instance()->encodeNotifyRespInd(reqEntity.transactionId, MMS_MSGSTATUS_RETRIEVED, bReportAllowed, filepath);
-                                                       //m-notification-resp-ind encoding      if err is not MSG_SUCCESS then should set x-mms-status to deferred
+                                                       /* m-notification-resp-ind encoding     if err is not MSG_SUCCESS then should set x-mms-status to deferred */
                                                        if (MsgGetFileSize(filepath, &reqEntity.postDataLen) == false) {
                                                                MSG_DEBUG("MsgGetFileSize: failed");
                                                                break;
@@ -542,19 +543,17 @@ void MmsPluginUaManager::run()
                                                }
 
                                                MSG_DEBUG("Submit Ind");
-                                       }
-                                       else if (reqEntity.eMmsPduType == eMMS_RETRIEVE_MANUAL_CONF)
-                                       {
-                                               /* saved msg trId should be checked  */
-                                               // Send Acknowledge Ind
+                                       } else if (reqEntity.eMmsPduType == eMMS_RETRIEVE_MANUAL_CONF) {
+                                               /* saved msg trId should be checked
+                                                * Send Acknowledge Ind */
                                                char filepath[MAX_FULL_PATH_SIZE] = {0};
-                                               // change MmsPduType for ind or ack
-                                               // make the PDU and then attach to reqEntity also.
+                                               /* change MmsPduType for ind or ack
+                                                * make the PDU and then attach to reqEntity also. */
                                                updatePduType(&reqEntity);
 
                                                MSG_DEBUG("#### eMmsPduType:%d ####", reqEntity.eMmsPduType);
 
-                                               //update http command type & encode m-notify-response-ind
+                                               /* update http command type & encode m-notify-response-ind */
                                                reqEntity.eHttpCmdType = eHTTP_CMD_POST_TRANSACTION;
 
                                                try {
@@ -580,7 +579,7 @@ void MmsPluginUaManager::run()
                                                lock();
                                                mmsTranQ.push_front(reqEntity);
                                                unlock();
-                                               remove(filepath); // not ipc
+                                               remove(filepath); /* not ipc */
 
                                                MSG_DEBUG("Submit Ack");
                                        } else {
@@ -609,7 +608,7 @@ void MmsPluginUaManager::run()
 
                }
 
-               // Request CM Close
+               /* Request CM Close */
                cmAgent->close();
 
        }
@@ -645,12 +644,11 @@ bool MmsPluginUaManager::processReceivedData(int msgId, char *pRcvdBody, int rcv
 {
        MSG_BEGIN();
 
-       //CID 317909 : replacing MSG_FILENAME_LEN_MAX with MAX_FULL_PATH_SIZE as the latter is max length for internal file path
-       //                              and size of retrievedFilePath in calling function is same i.e. MAX_FULL_PATH_SIZE+1
-       //CID 358483 : Making fileName smaller causes buffer overflow in MsgCreateFileName function.
-       //                      So We will keep it 1024 as before but only copy 320 out of it which is the size of retrievedFilePath buffer.
+       /CID 317909 : replacing MSG_FILENAME_LEN_MAX with MAX_FULL_PATH_SIZE as the latter is max length for internal file path
+        * and size of retrievedFilePath in calling function is same i.e. MAX_FULL_PATH_SIZE+1
+        * CID 358483 : Making fileName smaller causes buffer overflow in MsgCreateFileName function.
+        * So We will keep it 1024 as before but only copy 320 out of it which is the size of retrievedFilePath buffer. */
        char fileName[MSG_FILENAME_LEN_MAX] = {0};
-       //char fileName[MAX_FULL_PATH_SIZE] = {0};
 
        MSG_DEBUG(":::%d :%s ", rcvdBodyLen, pRcvdBody);
 
@@ -660,19 +658,30 @@ bool MmsPluginUaManager::processReceivedData(int msgId, char *pRcvdBody, int rcv
        if (MsgCreateFileName(fileName) == false)
                return false;
 
-       //CID 317909 : replacing MSG_FILENAME_LEN_MAX with MAX_FULL_PATH_SIZE as the latter is max length for internal file path
-       //                              and size of retrievedFilePath in calling function is same i.e. MAX_FULL_PATH_SIZE+1
-       //snprintf(retrievedFilePath, MSG_FILEPATH_LEN_MAX, "%s%s", MSG_DATA_PATH, fileName);
+       /* CID 317909 : replacing MSG_FILENAME_LEN_MAX with MAX_FULL_PATH_SIZE as the latter is max length for internal file path
+        * and size of retrievedFilePath in calling function is same i.e. MAX_FULL_PATH_SIZE+1
+        * snprintf(retrievedFilePath, MSG_FILEPATH_LEN_MAX, "%s%s", MSG_DATA_PATH, fileName); */
+#ifdef FEATURE_CONTAINER_ENABLE
+       char *rootPath = MsgZoneGetRootPath();
+       if (rootPath) {
+               snprintf(retrievedFilePath, MAX_FULL_PATH_SIZE, "%s%s%s", rootPath, MSG_DATA_PATH, fileName);
+               g_free(rootPath);
+               rootPath = NULL;
+       } else {
+               snprintf(retrievedFilePath, MAX_FULL_PATH_SIZE, "%s%s", MSG_DATA_PATH, fileName);
+       }
+#else /* FEATURE_CONTAINER_ENABLE */
        snprintf(retrievedFilePath, MAX_FULL_PATH_SIZE, "%s%s", MSG_DATA_PATH, fileName);
+#endif /* FEATURE_CONTAINER_ENABLE */
 
        MSG_INFO("retrievedFilePaths [%s]", retrievedFilePath);
 
-       // create temp file
+       /* create temp file */
        if (!MsgOpenCreateAndOverwriteFile(retrievedFilePath, (char *)pRcvdBody, rcvdBodyLen)) {
                MSG_ERR( "_MmsUaInitMsgDecoder: creating temporary file failed(msgID=%d)\n", msgId);
                return false;
        }
-#if 1 //
+#if 1
        MmsMsg *pMsg;
 
        MmsPluginStorage::instance()->getMmsMessage(&pMsg);
@@ -680,7 +689,7 @@ bool MmsPluginUaManager::processReceivedData(int msgId, char *pRcvdBody, int rcv
        memset(pMsg, 0, sizeof(MmsMsg));
 
        MmsPluginDecoder::instance()->decodeMmsPdu(pMsg, msgId, retrievedFilePath);
-#else //
+#else
        if (MmsReadMsgBody(msgId, true, true, retrievedFilePath) == false) {
                MSG_INFO("The MMS Message might include drm contents!!!");
 
@@ -704,5 +713,3 @@ bool MmsPluginUaManager::processReceivedData(int msgId, char *pRcvdBody, int rcv
 
        return true;
 }
-
-
index ccbffcd..01c0367 100755 (executable)
 #include <mm_file.h>
 #include <mm_util_jpeg.h>
 #include <mm_util_imgp.h>
-#include <media-thumbnail.h>
+#include <thumbnail_util.h>
+#include <image_util.h>
+
 #include <ctype.h>
 #include <errno.h>
 #include <sys/stat.h>
 #include "MsgUtilFile.h"
+#include "MsgMutex.h"
 #include "MmsPluginDebug.h"
 #include "MmsPluginUtil.h"
 #include <string>
+
 using namespace std;
 
+Mutex g_mx;
+CndVar g_cv;
+
+
+void thumbnail_completed_cb(thumbnail_util_error_e error, const char *request_id,
+                                                                       int thumb_width, int thumb_height,
+                                                                       unsigned char *thumb_data, int thumb_size, void *user_data)
+{
+       if (!user_data) {
+               MSG_DEBUG("dstPath is NULL");
+               return;
+       }
+
+       MSG_BEGIN();
+
+       g_mx.lock();
+       MSG_DEBUG("=================[RESULT]");
+       MSG_DEBUG("error_code [%d]", error);
+       MSG_DEBUG("request id [%s]", request_id);
+       MSG_DEBUG("width [%d], height [%d]", thumb_width, thumb_height);
+       MSG_DEBUG("raw_data [0x%x], size [%d]", *thumb_data, thumb_size);
+
+       int ret = 0;
+       ret = image_util_encode_jpeg(thumb_data, thumb_width, thumb_height, IMAGE_UTIL_COLORSPACE_BGRA8888, 90, (char *)user_data);;
+       if (ret != IMAGE_UTIL_ERROR_NONE)
+               MSG_DEBUG("image_util_encode_jpeg() is failed");
+
+       g_cv.signal();
+       g_mx.unlock();
+
+       MSG_END();
+}
+
+
 bool MmsMakeImageThumbnail(char *srcPath, char *dstPath)
 {
        if (srcPath == NULL || dstPath == NULL) {
@@ -39,10 +77,37 @@ bool MmsMakeImageThumbnail(char *srcPath, char *dstPath)
                return false;
        }
 
-       int err = -1;
-       err = thumbnail_request_save_to_file(srcPath, MEDIA_THUMB_LARGE, dstPath);
-       if (err < 0) {
-               MSG_DEBUG("Make thumbnail: failed, err = %d", err);
+       g_mx.lock();
+
+       int time_ret = 0;
+
+       int ret = THUMBNAIL_UTIL_ERROR_NONE;
+       char *req_id = NULL;
+       thumbnail_h thumb_h;
+       thumbnail_util_create(&thumb_h);
+/*     thumbnail_util_set_size(thumb_h, 240, 240); */
+       thumbnail_util_set_path(thumb_h, srcPath);
+       MSG_DEBUG("thumbnail_util_extract");
+
+       ret = thumbnail_util_extract(thumb_h, thumbnail_completed_cb, dstPath, &req_id);
+       thumbnail_util_destroy(thumb_h);
+       if (req_id) {
+               g_free(req_id);
+               req_id = NULL;
+       }
+
+       if (ret != THUMBNAIL_UTIL_ERROR_NONE) {
+               MSG_DEBUG("thumbnail_util_extract is failed");
+               g_mx.unlock();
+               return false;
+       }
+
+       time_ret = g_cv.timedwait(g_mx.pMutex(), 5);
+
+       g_mx.unlock();
+
+       if (time_ret == ETIMEDOUT) {
+               MSG_INFO("@@ WAKE by timeout@@");
                return false;
        }
 
@@ -55,6 +120,7 @@ bool MmsMakeImageThumbnail(char *srcPath, char *dstPath)
        return true;
 }
 
+
 bool MmsMakeVideoThumbnail(char *srcPath, char *dstPath)
 {
        MMHandleType content_attrs = (MMHandleType)NULL;
@@ -100,7 +166,6 @@ bool MmsMakeVideoThumbnail(char *srcPath, char *dstPath)
                return false;
        }
 
-
        int thumbnailWidth = 0;
        int thumbnailHeight = 0;
        int thumbnailSize = 0;
@@ -149,6 +214,7 @@ bool MmsMakeVideoThumbnail(char *srcPath, char *dstPath)
        return true;
 }
 
+
 FILE *MmsFileOpen(char *pFileName)
 {
        mode_t file_mode = (S_IRUSR | S_IWUSR);
@@ -207,6 +273,7 @@ bool MmsIsAsciiString(const char *pszText)
        return true;
 }
 
+
 void MmsRemoveLessGreaterChar(const char *szSrcID, char *szDest, int destSize)
 {
        char szBuf[MSG_MSG_ID_LEN + 1] = {0, };
@@ -226,6 +293,7 @@ void MmsRemoveLessGreaterChar(const char *szSrcID, char *szDest, int destSize)
        snprintf(szDest, destSize, "%s", szBuf);
 }
 
+
 bool MmsRemoveMarkup(const char *src, char *dst, int dstsize)
 {
        const int M_IN = 1;
@@ -263,7 +331,7 @@ bool MmsRemoveMarkup(const char *src, char *dst, int dstsize)
        return true;
 }
 
-//change character ' ' to '_'
+/* change character ' ' to '_' */
 bool MmsReplaceSpaceChar(char *pszText)
 {
        if (!pszText) {
@@ -302,16 +370,16 @@ char *MmsReplaceNonAsciiUtf8(const char *szSrc, char replaceChar)
 
        ptr = (const unsigned char*)szSrc;
 
-       while(offset < srcLen && *(ptr) != '\0') {
+       while (offset < srcLen && *(ptr) != '\0') {
 
                b1 = *(ptr);
 
-               if ((b1 & 0x80) == 0) { //1byte : 0xxx xxxx
+               if ((b1 & 0x80) == 0) { /* 1byte : 0xxx xxxx */
                        offset += 1;
                        ptr += 1;
 
                        str += b1;
-               } else  if ((b1 & 0xE0) == 0xC0) { //2byte : 110x xxxx
+               } else if ((b1 & 0xE0) == 0xC0) { /* 2byte : 110x xxxx */
                        offset += 2;
 
                        if (offset > srcLen)
@@ -319,14 +387,14 @@ char *MmsReplaceNonAsciiUtf8(const char *szSrc, char replaceChar)
 
                        b2 = *(ptr + 1);
 
-                       if (b2 >= 0x80) { //10xx xxxx
+                       if (b2 >= 0x80) { /* 10xx xxxx */
                                ptr += 2;
                                str += replaceChar;
                        } else {
                                return NULL;
                        }
 
-               } else  if ((b1 & 0xF0) == 0xE0) { //3byte : 1110 xxxx
+               } else if ((b1 & 0xF0) == 0xE0) { /* 3byte : 1110 xxxx */
 
                        offset += 3;
 
@@ -336,14 +404,14 @@ char *MmsReplaceNonAsciiUtf8(const char *szSrc, char replaceChar)
                        b2 = *(ptr + 1);
                        b3 = *(ptr + 2);
 
-                       if (b2 >= 0x80 && b3 >= 0x80) { //10xx xxxx
+                       if (b2 >= 0x80 && b3 >= 0x80) { /* 10xx xxxx */
                                ptr += 3;
                                str += replaceChar;
                        } else {
                                return NULL;
                        }
 
-               } else  if ((b1 & 0xF8) == 0xF0) { //4byte : 1111 xxxx
+               } else if ((b1 & 0xF8) == 0xF0) { /* 4byte : 1111 xxxx */
 
                        offset += 4;
 
@@ -354,7 +422,7 @@ char *MmsReplaceNonAsciiUtf8(const char *szSrc, char replaceChar)
                        b3 = *(ptr + 2);
                        b4 = *(ptr + 3);
 
-                       if (b2 >= 0x80 && b3 >= 0x80 && b4 >= 0x80) { //10xx xxxx
+                       if (b2 >= 0x80 && b3 >= 0x80 && b4 >= 0x80) { /* 10xx xxxx */
                                ptr += 4;
                                str += replaceChar;
 
@@ -395,14 +463,14 @@ bool MmsIsUtf8String(const unsigned char *szSrc, int nChar)
 
        ptr = (const unsigned char*)szSrc;
 
-       while(offset < srcLen && *(ptr) != '\0') {
+       while (offset < srcLen && *(ptr) != '\0') {
 
                b1 = *(ptr);
 
-               if ((b1 & 0x80) == 0) { //1byte : 0xxx xxxx
+               if ((b1 & 0x80) == 0) { /* 1byte : 0xxx xxxx */
                        offset += 1;
                        ptr += 1;
-               } else  if ((b1 & 0xE0) == 0xC0) { //2byte : 110x xxxx
+               } else if ((b1 & 0xE0) == 0xC0) { /* 2byte : 110x xxxx */
                        offset += 2;
 
                        if (offset > srcLen)
@@ -410,13 +478,13 @@ bool MmsIsUtf8String(const unsigned char *szSrc, int nChar)
 
                        b2 = *(ptr + 1);
 
-                       if (b2 >= 0x80) { //10xx xxxx
+                       if (b2 >= 0x80) { /* 10xx xxxx */
                                ptr += 2;
                        } else {
                                return false;
                        }
 
-               } else  if ((b1 & 0xF0) == 0xE0) { //3byte : 1110 xxxx
+               } else if ((b1 & 0xF0) == 0xE0) { /* 3byte : 1110 xxxx */
 
                        offset += 3;
 
@@ -426,13 +494,13 @@ bool MmsIsUtf8String(const unsigned char *szSrc, int nChar)
                        b2 = *(ptr + 1);
                        b3 = *(ptr + 2);
 
-                       if (b2 >= 0x80 && b3 >= 0x80) { //10xx xxxx
+                       if (b2 >= 0x80 && b3 >= 0x80) { /* 10xx xxxx */
                                ptr += 3;
                        } else {
                                return false;
                        }
 
-               } else  if ((b1 & 0xF8) == 0xF0) { //4byte : 1111 xxxx
+               } else if ((b1 & 0xF8) == 0xF0) { /* 4byte : 1111 xxxx */
 
                        offset += 4;
 
@@ -443,7 +511,7 @@ bool MmsIsUtf8String(const unsigned char *szSrc, int nChar)
                        b3 = *(ptr + 2);
                        b4 = *(ptr + 3);
 
-                       if (b2 >= 0x80 && b3 >= 0x80 && b4 >= 0x80) { //10xx xxxx
+                       if (b2 >= 0x80 && b3 >= 0x80 && b4 >= 0x80) { /* 10xx xxxx */
                                ptr += 4;
                        } else {
                                return false;
@@ -451,7 +519,7 @@ bool MmsIsUtf8String(const unsigned char *szSrc, int nChar)
                } else {
                        return false;
                }
-       }//while
+       } /* while */
 
        return true;
 }
index f1e2c28..0dc81ea 100755 (executable)
@@ -19,7 +19,7 @@
 
 #include "MmsPluginTypes.h"
 
-//Set Data for Message App
+/* Set Data for Message App */
 class MmsPluginAppBase {
 public:
        MmsPluginAppBase();
@@ -36,4 +36,4 @@ public:
 private:
        MMS_MESSAGE_DATA_S mmsMsgData;
 };
-#endif //MMS_PLUGIN_APPBASE_H
+#endif /* MMS_PLUGIN_APPBASE_H */
index 0633099..aca21fe 100755 (executable)
@@ -22,4 +22,4 @@
 #include "MmsPluginEncode.h"
 #include "MmsPluginDecode.h"
 
-#endif //MMS_PLUGIN_CODEC_H
+#endif /* MMS_PLUGIN_CODEC_H */
index 4b5006b..335682e 100755 (executable)
@@ -114,7 +114,7 @@ enum {
        MSG_FIELD_MIME_VERSION,
        MSG_FIELD_CONTENT_TYPE,
        MSG_FIELD_CONTENT_TRANSFER_ENCODING,
-       MSG_FIELD_CONTENT_DISPOSITION, //If start param is given in multipart/related, this field will be ignored
+       MSG_FIELD_CONTENT_DISPOSITION, /* If start param is given in multipart/related, this field will be ignored */
        MSG_FIELD_CONTENT_ID,
        MSG_FIELD_CONTENT_LOCATION,
        MSG_FIELD_CONTENT_NAME,
@@ -140,11 +140,11 @@ enum {
        MSG_PARAM_CHARSET,
        MSG_PARAM_NAME,
        MSG_PARAM_FILENAME,
-       MSG_PARAM_TYPE,                 // only used as parameter of Content-Type: multipart/related
-       MSG_PARAM_START,                // Only if content-type is multipart/related
-       MSG_PARAM_START_INFO,   // Only if content-type is multipart/related
+       MSG_PARAM_TYPE,                 /* only used as parameter of Content-Type: multipart/related */
+       MSG_PARAM_START,                /* Only if content-type is multipart/related */
+       MSG_PARAM_START_INFO,   /* Only if content-type is multipart/related */
        MSG_PARAM_BOUNDARY,
-       MSG_PARAM_REPORT_TYPE,  // only used as parameter of Content-Type: multipart/report; report-type=delivery-status;
+       MSG_PARAM_REPORT_TYPE,  /* only used as parameter of Content-Type: multipart/report; report-type=delivery-status; */
 #ifdef FEATURE_JAVA_MMS
        MSG_PARAM_APPLICATION_ID,
        MSG_PARAM_REPLY_TO_APPLICATION_ID,
@@ -194,4 +194,4 @@ bool MmsIsVitemContent(int type, char *pszName);
 
 MsgMultipart *MmsAllocMultipart(void);
 bool MmsPrintMulitpart(MsgMultipart *pMultipart, int index);
-#endif //MMS_PLUGIN_CODEC_COMMON_H
+#endif /* MMS_PLUGIN_CODEC_COMMON_H */
index 0be998b..d823b9b 100755 (executable)
@@ -38,7 +38,7 @@
 #define        MSG_MMS_DECODE_BUFFER_MAX       (2 * 1024)
 #define        MSB                                                             0x80
 #define        QUOTE                                                   0x7F
-#define        MARK                                                    0x22    // "
+#define        MARK                                                    0x22    /* " */
 #define        LENGTH_QUOTE                                    0x1F
 #define        MSG_STDSTR_LONG                         0xFF
 #define        INVALID_VALUE                                   -1
@@ -125,16 +125,16 @@ enum {
        MMS_BODYHDR_DISPOSITION,
        MMS_BODYHDR_CONTENTID,
        MMS_BODYHDR_CONTENTLOCATION,
-       MMS_BODYHDR_X_OMA_DRM_SEPARATE_DELIVERY,        // DRM RO WAITING
+       MMS_BODYHDR_X_OMA_DRM_SEPARATE_DELIVERY,        /* DRM RO WAITING */
 };
 
 typedef enum {
-       //code
+       /* code */
        MmsCodeFieldCode,
        MmsCodeParameterCode,
        MmsCodeMsgBodyHeaderCode,
 
-       //Data
+       /* Data */
        MmsCodeMsgType,
        MmsCodeDeliveryReport,
        MmsCodeTimeType,
@@ -168,12 +168,12 @@ typedef enum {
        MMS_DATATYPE_RETRIEVING = 7,
        MMS_DATATYPE_UNRETV = 8,
        MMS_DATATYPE_TEMPLATE = 9,
-       MMS_DATATYPE_DRM_RO_WAITING = 10        // DRM RO WAITING
+       MMS_DATATYPE_DRM_RO_WAITING = 10        /* DRM RO WAITING */
 } MmsDataType;
 
 typedef enum {
-       MMS_MSGTYPE_ERROR = -1, // error return in Get method
-       MMS_MSGTYPE_SEND_REQ = 0,       // default
+       MMS_MSGTYPE_ERROR = -1, /* error return in Get method */
+       MMS_MSGTYPE_SEND_REQ = 0,       /* default */
        MMS_MSGTYPE_SEND_CONF = 1,
        MMS_MSGTYPE_NOTIFICATION_IND = 2,
        MMS_MSGTYPE_NOTIFYRESP_IND = 3,
@@ -184,31 +184,31 @@ typedef enum {
        MMS_MSGTYPE_READORG_IND = 8,
        MMS_MSGTYPE_FORWARD_REQ = 9,
        MMS_MSGTYPE_FORWARD_CONF = 10,
-       MMS_MSGTYPE_READ_REPLY = 11,    // for internal use
+       MMS_MSGTYPE_READ_REPLY = 11,    /* for internal use */
        MMS_MSGTYPE_MAX
 } MmsMsgType;
 
 typedef enum {
-       MMS_PRIORITY_ERROR = -1,                        // error return in Get method
-       MMS_PRIORITY_LOW = 0,                   // default
+       MMS_PRIORITY_ERROR = -1,                        /* error return in Get method */
+       MMS_PRIORITY_LOW = 0,                   /* default */
        MMS_PRIORITY_NORMAL = 1,
        MMS_PRIORITY_HIGH = 2
 } MmsPriority;
 
 typedef enum {
-       MMS_SENDER_VISIBLE_ERROR = -1,  // error return in Get method
+       MMS_SENDER_VISIBLE_ERROR = -1,  /* error return in Get method */
        MMS_SENDER_SHOW = 0,
        MMS_SENDER_HIDE = 1
 } MmsSenderVisible;
 
 typedef enum {
-       MMS_REPORT_ERROR = -1,  // error return in Get method
+       MMS_REPORT_ERROR = -1,  /* error return in Get method */
        MMS_REPORT_YES = 0,
        MMS_REPORT_NO = 1
 } MmsReport;
 
 typedef enum {
-       MMS_REPORTALLOWED_ERROR = -1,   // error return in Get method
+       MMS_REPORTALLOWED_ERROR = -1,   /* error return in Get method */
        MMS_REPORTALLOWED_YES = 0,
        MMS_REPORTALLOWED_NO = 1
 } MmsReportAllowed;
@@ -220,22 +220,22 @@ typedef enum {
 } MmsRecvReadReportType ;
 
 typedef enum {
-       MMS_MSGSTATUS_NONE = -1,        // backward compatibility
-       MMS_MSGSTATUS_ERROR = -1,       // error return in Get method
-       MMS_MSGSTATUS_EXPIRED = 0,      // This value SHOULD not be used in the M-NotifyResp.ind PDU.
+       MMS_MSGSTATUS_NONE = -1,        /* backward compatibility */
+       MMS_MSGSTATUS_ERROR = -1,       /* error return in Get method */
+       MMS_MSGSTATUS_EXPIRED = 0,      /* This value SHOULD not be used in the M-NotifyResp.ind PDU. */
        MMS_MSGSTATUS_RETRIEVED = 1,
        MMS_MSGSTATUS_REJECTED = 2,
        MMS_MSGSTATUS_DEFERRED = 3,
-       MMS_MSGSTATUS_UNRECOGNISED = 4, // This value SHALL not be used in the M-Delivery.ind PDU.
+       MMS_MSGSTATUS_UNRECOGNISED = 4, /* This value SHALL not be used in the M-Delivery.ind PDU. */
        MMS_MSGSTATUS_INDETERMINATE = 5,
        MMS_MSGSTATUS_FORWARDED = 6,
        MMS_MSGSTATUS_UNREACHABLE = 7
 } MmsMsgStatus;
 
 typedef enum {
-       MMS_READSTATUS_NONE = -1,                       // no touch status
+       MMS_READSTATUS_NONE = -1,                       /* no touch status */
        MMS_IS_READ = 0,
-       MMS_IS_DELETED = 1      // Deleted without being read
+       MMS_IS_DELETED = 1      /* Deleted without being read */
 } MmsReadStatus;
 
 typedef enum {
@@ -251,8 +251,8 @@ typedef enum {
 
 /* Response status */
 typedef enum {
-       MMS_RESPSTATUS_ERROR = -1,      // error return in Get method
-       MMS_RESPSTATUS_OK = 0,  // default value
+       MMS_RESPSTATUS_ERROR = -1,      /* error return in Get method */
+       MMS_RESPSTATUS_OK = 0,  /* default value */
        MMS_RESPSTAUTS_ERROR_UNSPECIFIED = 1,
        MMS_RESPSTAUTS_ERROR_SERVICEDENIED = 2,
        MMS_RESPSTAUTS_ERROR_MESSAGEFORMATCORRUPT = 3,
@@ -280,7 +280,7 @@ typedef enum {
 } MmsResponseStatus;
 
 typedef enum {
-       MMS_RETRSTATUS_ERROR = -1,      // error return in Get method
+       MMS_RETRSTATUS_ERROR = -1,      /* error return in Get method */
        MMS_RETRSTATUS_OK = 0,
        MMS_RETRSTATUS_TRANSIENT_FAILURE = 1,
        MMS_RETRSTATUS_TRANSIENT_MESSAGE_NOT_FOUND = 2,
@@ -292,7 +292,7 @@ typedef enum {
 } MmsRetrieveStatus;
 
 typedef enum {
-       MMS_REPLY_NONE = -1,    // error return in Get method
+       MMS_REPLY_NONE = -1,    /* error return in Get method */
        MMS_REPLY_REQUESTED = 0,
        MMS_REPLY_REQUESTED_TEXT_ONLY = 1,
        MMS_REPLY_ACCEPTED = 2,
@@ -300,8 +300,8 @@ typedef enum {
 } MmsReplyChargeType;
 
 typedef enum {
-       MMS_MSGCLASS_ERROR = -1,        // error return in Get method
-       MMS_MSGCLASS_PERSONAL = 0,      // default
+       MMS_MSGCLASS_ERROR = -1,        /* error return in Get method */
+       MMS_MSGCLASS_PERSONAL = 0,      /* default */
        MMS_MSGCLASS_ADVERTISEMENT = 1,
        MMS_MSGCLASS_INFORMATIONAL = 2,
        MMS_MSGCLASS_AUTO = 3
@@ -340,7 +340,7 @@ typedef struct _MMS_ATTRIB_S {
        UINT32 date;
        UINT8 version;
 
-       char szFrom[MSG_LOCALE_ADDR_LEN + 11];          //"/TYPE=PLMN", /"TYPE=IPv4", "/TYPE=IPv6"
+       char szFrom[MSG_LOCALE_ADDR_LEN + 11];          /* "/TYPE=PLMN", /"TYPE=IPv4", "/TYPE=IPv6" */
        char szSubject[MSG_LOCALE_SUBJ_LEN + 1];
        char *szTo;
        char *szCc;
@@ -356,7 +356,7 @@ typedef struct _MMS_ATTRIB_S {
        MmsRecvReadReportType readReportAllowedType;
 
        bool bAskReadReply;
-       bool bRead;//FIXME : remove this value
+       bool bRead; /* FIXME : remove this value */
 
        MmsRecvReadReportSendStatus readReportSendStatus;
 
@@ -369,7 +369,7 @@ typedef struct _MMS_ATTRIB_S {
        MmsTimeStruct expiryTime;
        MmsTimeStruct deliveryTime;
 
-       //for ReadMsg, When Sending notifyResp.ind
+       /* for ReadMsg, When Sending notifyResp.ind */
        msg_delivery_report_status_t msgStatus;
 
        MmsResponseStatus responseStatus;
@@ -397,7 +397,7 @@ typedef struct _MsgContentParam {
        char szStart[MSG_MSG_ID_LEN + 1];
        char szStartInfo[MSG_MSG_ID_LEN + 1];
 
-       MsgParamReportType reportType; //only used as parameter of Content-Type: multipart/report; report-type=delivery-status;
+       MsgParamReportType reportType; /* only used as parameter of Content-Type: multipart/report; report-type=delivery-status; */
 } MsgContentParam;
 
 typedef struct _MsgDRMInfo {
@@ -409,7 +409,7 @@ typedef struct _MsgDRMInfo {
        char *szContentVendor;
        char *szRightIssuer;
        char *szDrm2FullPath;
-       int roWaitingTimerMax;          // DRM RO WAITING
+       int roWaitingTimerMax;          /* DRM RO WAITING */
        bool bFwdLock;
        char *pszContentType;
        bool bNoRingTone;
@@ -456,7 +456,7 @@ struct _MsgMultipart {
 typedef struct _MMS_MESSAGE_S {
        MmsAttrib mmsAttrib;
        msg_message_id_t msgID;
-       int mailbox;            // mailbox type,MMS_MAILBOX_XXX
+       int mailbox;            /* mailbox type,MMS_MAILBOX_XXX */
        char szFileName[MSG_FILENAME_LEN_MAX];
        char szTrID[MMS_TR_ID_LEN + 1];
        char szMsgID[MMS_MSG_ID_LEN + 1];
@@ -467,4 +467,4 @@ typedef struct _MMS_MESSAGE_S {
        MsgBody msgBody;
 } MmsMsg;
 
-#endif //MMS_PLUGIN_CODEC_TYPE_H
+#endif /* MMS_PLUGIN_CODEC_TYPE_H */
index c354d28..f82ed7e 100755 (executable)
@@ -20,7 +20,7 @@
 #include "MmsPluginTypes.h"
 #include "MmsPluginCodec.h"
 
-//make MMS_DATA_S for DB & Encoding
+/* make MMS_DATA_S for DB & Encoding */
 class MmsPluginComposer {
 public:
        static MmsPluginComposer *instance();
@@ -43,4 +43,4 @@ private:
        ~MmsPluginComposer();
 
 };
-#endif //MMS_PLUGIN_COMPOSER_H
+#endif /* MMS_PLUGIN_COMPOSER_H */
index f8402d1..b9abdae 100755 (executable)
@@ -25,8 +25,7 @@ typedef enum {
        MSG_CM_ERR_UNKNOWN,
  } cm_error_e;
 
-class MmsPluginCmAgent
-{
+class MmsPluginCmAgent {
 public:
        static MmsPluginCmAgent *instance();
 
@@ -54,7 +53,7 @@ private:
        void setCmStatus() { isCmOpened = true; }
        void resetCmStatus() { isCmOpened = false; }
 
-       bool isCmOpened; //connection & profile connect
+       bool isCmOpened; /* connection & profile connect */
        bool waitProfileOpen;
        char *home_url;
        char *interface_name;
@@ -64,4 +63,4 @@ private:
 
 };
 
-#endif //MMS_PLUGIN_CONNMAN_H
+#endif /* MMS_PLUGIN_CONNMAN_H */
index d77485e..da0518d 100755 (executable)
@@ -25,4 +25,4 @@
 #define MMS_DEBUG_STR_FILE_NOT_EXIST "File not exist"
 
 
-#endif //MMS_PLUGIN_DEBUG_H
+#endif /* MMS_PLUGIN_DEBUG_H */
index ddd3b3e..e85057e 100755 (executable)
@@ -26,10 +26,10 @@ typedef int MmsMsgID;
 
 typedef enum {
        MSG_PRESENTATION_NONE = -1,
-       MSG_PRESENTATION_FIRSTPART,             //Content-type == type parameter
-       MSG_PRESENTATION_TYPE_BASE,             //Content-type == type parameter
-       MSG_PRESENTATION_LOCATION,              //Content-Location == start parameter
-       MSG_PRESENTATION_ID,                    //Content-ID == start parameter
+       MSG_PRESENTATION_FIRSTPART,             /* Content-type == type parameter */
+       MSG_PRESENTATION_TYPE_BASE,             /* Content-type == type parameter */
+       MSG_PRESENTATION_LOCATION,              /* Content-Location == start parameter */
+       MSG_PRESENTATION_ID,                    /* Content-ID == start parameter */
 } MsgPresentationFactor;
 
 typedef struct {
@@ -43,14 +43,14 @@ struct _MsgHeaderAddress {
        MsgHeaderAddress *pNext;
 };
 
-// for Decoding & Encoding
+/* for Decoding & Encoding */
 typedef struct {
        MmsMsgType type;
        char szTrID[MMS_TR_ID_LEN+1];
        UINT8 version;
        UINT32 date;
 
-       MsgHeaderAddress *pFrom;                //"/TYPE=PLMN", /"TYPE=IPv4", "/TYPE=IPv6"
+       MsgHeaderAddress *pFrom;                /* "/TYPE=PLMN", /"TYPE=IPv4", "/TYPE=IPv6" */
        MsgHeaderAddress *pTo;
        MsgHeaderAddress *pCc;
        MsgHeaderAddress *pBcc;
@@ -75,13 +75,13 @@ typedef struct {
 
        MmsReplyCharge replyCharge;
 
-       // only used at Decoding module
+       /* only used at Decoding module */
        char szMsgID[MMS_MSG_ID_LEN + 1];
        UINT32 msgSize;
 
        MsgDrmType drmType;
 
-       // dependent to Client implementation
+       /* dependent to Client implementation */
        MsgType msgType;
        MsgBody msgBody;
 } MmsHeader;
@@ -120,4 +120,4 @@ private:
        ~MmsPluginDecoder();
 
 };
-#endif //MMS_PLUGIN_DECODE_H
+#endif /* MMS_PLUGIN_DECODE_H */
index f40112b..fff050c 100755 (executable)
@@ -21,4 +21,4 @@
 
 bool MmsPluginDrmGetInfo(const char *szFilePath, MsgType *pMsgType);
 
-#endif //MMS_PLUGIN_DRM_H
+#endif /* MMS_PLUGIN_DRM_H */
index 235b45b..3a7ee31 100755 (executable)
@@ -47,4 +47,4 @@ private:
        ~MmsPluginEncoder();
 
 };
-#endif //MMS_PLUGIN_ENCODE_H
+#endif /* MMS_PLUGIN_ENCODE_H */
index 2aa676b..5ea703b 100755 (executable)
@@ -20,8 +20,7 @@
 #include "MsgPluginInterface.h"
 #include "MmsPluginTypes.h"
 
-class MmsPluginEventHandler
-{
+class MmsPluginEventHandler {
 public:
        static MmsPluginEventHandler *instance();
 
@@ -38,4 +37,4 @@ private:
        MSG_PLUGIN_LISTENER_S listener;
 };
 
-#endif //MMS_PLUGIN_EVENT_HANDLER_H
+#endif /* MMS_PLUGIN_EVENT_HANDLER_H */
index 2292337..7680737 100755 (executable)
@@ -70,8 +70,7 @@ typedef struct _http_session_info_s {
        unsigned int response_data_len;
 } http_request_info_s;
 
-class MmsPluginHttpAgent
-{
+class MmsPluginHttpAgent {
        public:
                static MmsPluginHttpAgent *instance();
 
@@ -113,4 +112,4 @@ class MmsPluginHttpAgent
                Mutex mx;
 };
 
-#endif //MMS_PLUGIN_HTTP_H
+#endif /* MMS_PLUGIN_HTTP_H */
index 53550f3..8bed1c4 100755 (executable)
@@ -20,8 +20,7 @@
 #include "MmsPluginTypes.h"
 #include "MmsPluginCodecTypes.h"
 
-class MmsPluginInternal
-{
+class MmsPluginInternal {
        public:
                static MmsPluginInternal *instance();
 
@@ -48,4 +47,4 @@ class MmsPluginInternal
                const char *getMmsReadStatus(msg_read_report_status_t readStatus);
 };
 
-#endif //MMS_PLUGIN_INTERNAL_H
+#endif /* MMS_PLUGIN_INTERNAL_H */
index fe53ff8..dc629bb 100755 (executable)
@@ -50,4 +50,4 @@ bool MmsGetMimeTypeFromExt(MimeMainType mainType, const char *pExt, MimeType *pM
 
 bool MmsGetMimeTypeFromFileName(MimeMainType mainType, const char *pFileName, MimeType *pMimeType, const char **ppszMimeType);
 
-#endif // MMS_PLUGIN_MIME_H
+#endif /* MMS_PLUGIN_MIME_H */
index 527dff8..3deac7c 100755 (executable)
@@ -54,5 +54,5 @@ msg_error_t MmsDeleteMessage(msg_message_id_t msgId);
 }
 #endif
 
-#endif //MMS_PLUGIN_MAIN_H
+#endif /* MMS_PLUGIN_MAIN_H */
 
index a12ad04..06501fe 100755 (executable)
 void MmsComposeNotiMessage(MmsMsg *pMmsMsg, msg_message_id_t msgID);
 
 void MmsComposeReadReportMessage(MmsMsg *pMmsMsg, const MSG_MESSAGE_INFO_S *pMsgInfo, msg_message_id_t selectedMsgId);
+/*
+int MmsUpdatePreviewData(MSG_MESSAGE_INFO_S *pMsgInfo);
 
-//int MmsUpdatePreviewData(MSG_MESSAGE_INFO_S *pMsgInfo);
-//
-//int MmsUpdateMultipartList(MSG_MESSAGE_INFO_S *pMsgInfo);
+int MmsUpdateMultipartList(MSG_MESSAGE_INFO_S *pMsgInfo);
 
-//void MmsPrintFileInfoForVLD(MMS_MESSAGE_DATA_S *pMmsMsg);
-//
-//bool MmsChangeFileNameToAscii(MMS_MESSAGE_DATA_S *pMsgData);
+void MmsPrintFileInfoForVLD(MMS_MESSAGE_DATA_S *pMmsMsg);
 
+bool MmsChangeFileNameToAscii(MMS_MESSAGE_DATA_S *pMsgData);
+*/
 bool MmsConvertMsgData(MmsMsg *pMsg, MMS_MESSAGE_DATA_S *pMmsMsg);
 
-bool MmsConvertMmsData(MmsMsg *pMsg, MMS_DATA_S *pMmsData);//temp func for supporting new mmsdata
+bool MmsConvertMmsData(MmsMsg *pMsg, MMS_DATA_S *pMmsData); /* temp func for supporting new mmsdata */
 
 bool MmsConvertMmsMsg(MmsMsg *pMmsMsg, MMS_DATA_S *pMsgData);
 
 msg_error_t MmsMakeMultipartThumbnailInfo(MMS_MULTIPART_DATA_S *pMultipart, char *thumbnail_path);
 
-#endif //MMS_PLUGIN_MESSAGE_H
+#endif /* MMS_PLUGIN_MESSAGE_H */
index 8086d2f..c260c47 100755 (executable)
 #include "MsgSqliteWrapper.h"
 #include "MmsPluginCodecTypes.h"
 
-class MmsPluginStorage
-{
+class MmsPluginStorage {
 public:
        static MmsPluginStorage *instance();
 
        MmsPluginStorage();
        ~MmsPluginStorage();
 
-       //MMS message operation
+       /* MMS message operation */
        msg_error_t addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo, char *pSerializedMms);
        msg_error_t getMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo, char **pSerializedMms);
        msg_error_t updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo, char *pSerializedMms);
-       msg_error_t updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo);//malware allowed
+       msg_error_t updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo); /* malware allowed */
 
        msg_error_t deleteMmsMessage(int msgId);
 
-       //MMS message preview info
+       /* MMS message preview info */
        msg_error_t insertPreviewInfo(int msgId, int type, const char *value, int count = 0);
        msg_error_t removePreviewInfo(int msgId);
 
-       //MMS message multipart list
+       /* MMS message multipart list */
        msg_error_t insertMultipart(msg_message_id_t msgId, MMS_MULTIPART_DATA_S *pMultipart);
        msg_error_t updateMultipart(msg_message_id_t msgId, int allow_malware, MMS_MULTIPART_DATA_S *pMultipart);
        msg_error_t getMultipartList(msg_message_id_t msgId, MMSList **multipart_list);
        msg_error_t deleteMultipartList(int msgId);
 
-       //MMS message report
+       /* MMS message report */
        msg_error_t insertDeliveryReport(msg_message_id_t msgId, char *address, MmsMsgMultiStatus *pStatus);
        msg_error_t insertReadReport(msg_message_id_t msgId, char *address, MmsMsgMultiStatus *pStatus);
 
-       //etc
+       /* etc */
        void getMmsMessage(MmsMsg **pMmsMsg);
        msg_error_t getMmsMessageId(msg_message_id_t selectedMsgId, MmsMsg *pMmsMsg);
        void composeReadReport(MSG_MESSAGE_INFO_S *pMsgInfo);
@@ -87,5 +86,5 @@ private:
        MmsMsg mmsMsg;
 };
 
-#endif //MMS_PLUGIN_STORAGE_H
+#endif /* MMS_PLUGIN_STORAGE_H */
 
index 449a000..fb975f0 100755 (executable)
@@ -17,7 +17,7 @@
 #ifndef MMS_PLUGIN_TCS_H
 #define MMS_PLUGIN_TCS_H
 
-//Scan content on file system.
+/* Scan content on file system. */
 int MmsPluginTcsScanFile(const char *filepath, int *bLevel);
 
-#endif //MMS_PLUGIN_TCS_H
+#endif /* MMS_PLUGIN_TCS_H */
index 50cf1d0..2da1f63 100755 (executable)
@@ -21,4 +21,4 @@ const char *MmsPluginTextConvertGetCharSet(int MIBEnum);
 
 bool MmsPluginTextConvert(const char *pToCodeSet, const char *pFromCodeSet, const char *pSrc, int srcLen, char **ppDest, int *pDestLen);
 
-#endif //MMS_PLUGIN_TEXT_CONVERT_H
+#endif /* MMS_PLUGIN_TEXT_CONVERT_H */
index 28cc34e..d3b2f1c 100755 (executable)
@@ -19,8 +19,7 @@
 
 #include "MmsPluginTypes.h"
 
-class MmsPluginTransport
-{
+class MmsPluginTransport {
        public:
                static MmsPluginTransport *instance();
 
@@ -34,4 +33,4 @@ class MmsPluginTransport
                static MmsPluginTransport *pInstance;
 };
 
-#endif //MMS_PLUGIN_TRANSPORT_H
+#endif /* MMS_PLUGIN_TRANSPORT_H */
index 8cafe1a..196ef4c 100755 (executable)
@@ -37,23 +37,23 @@ enum _MMS_NET_ERROR_E {
        eMMS_CM_OPEN_FAILED,
        eMMS_CM_CLOSE_IND,
        eMMS_CM_CLOSE_RSP,
-       eMMS_CM_CLOSE_FAILED,   //5
+       eMMS_CM_CLOSE_FAILED,   /* 5 */
        eMMS_CM_KILL_RSP,
        eMMS_CM_KILL_FAILED,
 
        eMMS_HTTP_SESSION_INIT,
        eMMS_HTTP_SESSION_CLOSED,
-       eMMS_HTTP_SESSION_OPEN_FAILED, //10
+       eMMS_HTTP_SESSION_OPEN_FAILED, /* 10 */
        eMMS_HTTP_SENT_SUCCESS,
        eMMS_HTTP_CONF_SUCCESS,
        eMMS_HTTP_ERROR_NETWORK,
        eMMS_HTTP_CONF_RECEIVED_TIMEOUT,
-       eMMS_HTTP_RECV_DATA,    //15
+       eMMS_HTTP_RECV_DATA,    /* 15 */
        eMMS_HTTP_EVENT_RECV_DATA_PROGRESS,
        eMMS_HTTP_EVENT_RECV_DATA_ERROR,
        eMMS_HTTP_EVENT_SENT_ACK_COMPLETED,
        eMMS_HTTP_ERROR_UNKNOWN,
-       eMMS_EXCEPTIONAL_ERROR, //20
+       eMMS_EXCEPTIONAL_ERROR, /* 20 */
 
        eMMS_UNKNOWN
 };
@@ -69,7 +69,7 @@ enum _MMS_PDU_TYPE_E {
        eMMS_READREC_IND,
        eMMS_READORIG_IND,
        eMMS_READREPORT_REQ,
-       eMMS_READREPORT_CONF,   //10
+       eMMS_READREPORT_CONF,   /* 10 */
        eMMS_FORWARD_REQ,
        eMMS_FORWARD_CONF,
        eMMS_RETRIEVE_AUTO,
@@ -79,7 +79,7 @@ enum _MMS_PDU_TYPE_E {
        eMMS_CANCEL_CONF,
        eMMS_DELETE_REQ,
        eMMS_DELETE_CONF,
-       eMMS_MBOX_STORE_REQ,    // 20
+       eMMS_MBOX_STORE_REQ,    /* 20 */
        eMMS_MBOX_STORE_CONF,
        eMMS_MBOX_VIEW_REQ,
        eMMS_MBOX_VIEW_CONF,
@@ -121,5 +121,5 @@ typedef struct _mmsTranQEntity {
        char *pGetData;
 } mmsTranQEntity;
 
-#endif //MMS_PLUGIN_TYPES_H
+#endif /* MMS_PLUGIN_TYPES_H */
 
index 3df0340..8368d4a 100755 (executable)
@@ -22,8 +22,7 @@
 #include "MsgQueue.h"
 #include "MmsPluginTypes.h"
 
-class MmsPluginUaManager: public MsgThread
-{
+class MmsPluginUaManager: public MsgThread {
        public:
                static MmsPluginUaManager *instance();
                virtual void start();
@@ -50,10 +49,10 @@ class MmsPluginUaManager: public MsgThread
                MMS_NET_ERROR_T submitHandler(mmsTranQEntity *qEntity);
                MMS_NET_ERROR_T waitingConf(mmsTranQEntity *qEntity);
 
-               // condition values
-               bool running;           // flag for thread running
+               /* condition values */
+               bool running;           /* flag for thread running */
 
-               MsgSimpleQ<mmsTranQEntity> mmsTranQ; // transaction q for mms plugin
+               MsgSimpleQ<mmsTranQEntity> mmsTranQ; /* transaction q for mms plugin */
 };
 
-#endif //MMS_PLUGIN_USERAGENT_H
+#endif /* MMS_PLUGIN_USERAGENT_H */
index 1e08034..d5413c1 100755 (executable)
 
 #include <stdio.h>
 
-//File Util
+/* File Util */
 bool MmsMakeImageThumbnail(char *srcPath, char *dstPath);
 
 bool MmsMakeVideoThumbnail(char *srcPath, char *dstPath);
 
 FILE *MmsFileOpen(char *pFileName);
 
-//Text Util
+/* Text Util */
 bool MmsIsAsciiString(const char *szSrc);
 
 bool MmsIsUtf8String(const unsigned char *szSrc, int nChar);
@@ -39,4 +39,4 @@ bool MmsReplaceSpaceChar(char *pszText);
 
 char *MmsReplaceNonAsciiUtf8(const char *szSrc, char replaceChar);
 
-#endif //MMS_PLUGIN_UTIL_H
+#endif /* MMS_PLUGIN_UTIL_H */
index 2afe93b..d374c7c 100755 (executable)
@@ -1,17 +1,17 @@
 /*
-* Copyright 2012-2013  Samsung Electronics Co., Ltd
-*
-* Licensed under the Flora License, Version 1.1 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*    http://floralicense.org/license/
-*
-* 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.
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
 */
 
 #include <glib.h>
@@ -79,14 +79,13 @@ void SmsPluginCallback::registerEvent()
                MSG_DEBUG("tel_register_noti_event is failed : [%s]", TAPI_NOTI_SIM_REFRESHED);
 
        MsgSettingRegVconfCBCommon(VCONFKEY_DNET_STATE, _dnet_state_changed_cb);
-//     MsgSettingRegVconfCBCommon(VCONFKEY_TELEPHONY_MDN, _TapiMdnChangedCb);
+       /* MsgSettingRegVconfCBCommon(VCONFKEY_TELEPHONY_MDN, _TapiMdnChangedCb); */
 }
 
 
 void SmsPluginCallback::deRegisterEvent()
 {
 
-
 }
 
 
@@ -94,18 +93,15 @@ void TapiEventDeviceReady(TapiHandle *handle, const char *noti_id, void *data, v
 {
        MSG_DEBUG("TapiEventDeviceReady is called. : noti_id = [%d]", noti_id);
 
-       try
-       {
-               // Call Event Handler
+       try {
+               /* Call Event Handler */
                SmsPluginEventHandler::instance()->setDeviceStatus();
 
                if (SmsPluginEventHandler::instance()->getNeedInitConfig() == true) {
                        SmsPluginEventHandler::instance()->setNeedInitConfig(false);
                        SmsPluginSetting::instance()->SimRefreshCb();
                }
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return;
        }
@@ -142,7 +138,8 @@ void TapiEventMsgIncoming(TapiHandle *handle, const char *noti_id, void *data, v
        sms_trans_msg_s sms_trans_msg;
        memset(&sms_trans_msg, 0x00, sizeof(sms_trans_msg_s));
 
-       if (pDataPackage->format == (TelSmsNetType_t)0x03) {                            // voice mail notification
+       if (pDataPackage->format == (TelSmsNetType_t)0x03) {
+               /* voice mail notification */
                sms_trans_msg.data.p2p_msg.telesvc_msg.type = SMS_TYPE_DELIVER;
                sms_trans_msg.data.p2p_msg.telesvc_id = SMS_TRANS_TELESVC_VMN_95;
 
@@ -164,21 +161,20 @@ void TapiEventMsgIncoming(TapiHandle *handle, const char *noti_id, void *data, v
        } else {
                bool bInvalid = SmsPluginMsgCodec::checkInvalidPDU(pDataPackage->szData, pDataPackage->MsgLength);
                if (bInvalid == true) {
-                       // Decode Incoming Message
+                       /* Decode Incoming Message */
                        SmsPluginMsgCodec::decodeMsg(pDataPackage->szData, pDataPackage->MsgLength, &sms_trans_msg);
 
                        if (sms_trans_msg.data.cb_msg.telesvc_msg.data.deliver.cmas_data.is_wrong_recode_type) {
                                MSG_WARN("Invalid CMAS Record Type");
                                return;
                        }
-               }
-               else {
+               } else {
                        MSG_WARN("Invalid PDU");
                        return;
                }
        }
 
-       /// Print tpdu
+       /* Print tpdu */
        if (sms_trans_msg.type == SMS_TRANS_P2P_MSG) {
                MSG_DEBUG("############# SMS_TRANS_P2P_MSG Incoming decoded tpdu values ####################");
                MSG_DEBUG("------------------------------ transport layer data -----------------------------");
@@ -217,8 +213,7 @@ void TapiEventMsgIncoming(TapiHandle *handle, const char *noti_id, void *data, v
                MSG_DEBUG("deliver_msg->callback_number.number_type= [%d]", deliver_msg->callback_number.number_type);
                MSG_DEBUG("deliver_msg->callback_number.szData= [%s]", deliver_msg->callback_number.szData);
                MSG_DEBUG("#####################################################");
-       }
-       else if (sms_trans_msg.type == SMS_TRANS_BROADCAST_MSG) {
+       } else if (sms_trans_msg.type == SMS_TRANS_BROADCAST_MSG) {
                MSG_DEBUG("############# SMS_TRANS_BROADCAST_MSG Incoming decoded tpdu values ####################");
                MSG_DEBUG("------------------------------ transport layer data -----------------------------");
                MSG_DEBUG("sms_trans_msg.data.cb_msg.svc_ctg = [%d]", sms_trans_msg.data.cb_msg.svc_ctg);
@@ -253,27 +248,26 @@ void TapiEventMsgIncoming(TapiHandle *handle, const char *noti_id, void *data, v
                MSG_DEBUG("deliver_msg->callback_number.szData= [%s]", deliver_msg->callback_number.szData);
                MSG_DEBUG("#####################################################");
        } else if (sms_trans_msg.type == SMS_TRANS_ACK_MSG) {
-               // DLOG
+               /* DLOG */
                MSG_DEBUG("#####################################################");
        }
 
-       try
-       {
+       try {
                if (sms_trans_msg.type == SMS_TRANS_P2P_MSG) {
                        if (sms_trans_msg.data.p2p_msg.telesvc_id == SMS_TRANS_TELESVC_WAP) {
                                SmsPluginEventHandler::instance()->handleWapMsgIncoming(&(sms_trans_msg.data.p2p_msg));
-                       }
-                       else {
-                               SmsPluginEventHandler::instance()->handleMsgIncoming(&(sms_trans_msg.data.p2p_msg)); // Call Event Handler
+                       } else {
+                               /* Call Event Handler */
+                               SmsPluginEventHandler::instance()->handleMsgIncoming(&(sms_trans_msg.data.p2p_msg));
                        }
                } else if (sms_trans_msg.type == SMS_TRANS_BROADCAST_MSG) {
-                       SmsPluginEventHandler::instance()->handleCbMsgIncoming(&(sms_trans_msg.data.cb_msg)); // Call Event Handler
+                       /* Call Event Handler */
+                       SmsPluginEventHandler::instance()->handleCbMsgIncoming(&(sms_trans_msg.data.cb_msg));
                } else if (sms_trans_msg.type == SMS_TRANS_ACK_MSG) {
-                       //SmsPluginEventHandler::instance()->handleAckMsgIncoming(&(sms_trans_msg.data.ack_msg)); // Call Event Handler
+                       /* Call Event Handler */
+                       /* SmsPluginEventHandler::instance()->handleAckMsgIncoming(&(sms_trans_msg.data.ack_msg)); */
                }
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return;
        }
@@ -293,9 +287,9 @@ void TapiEventNetworkStatusChange(TapiHandle *handle, const char *noti_id, void
 
        MSG_DEBUG("network status type [%d]", *type);
 
-       if(*type > TAPI_NETWORK_SERVICE_TYPE_SEARCH)
-       {
-               SmsPluginEventHandler::instance()->handleResendMessage(); // Call Event Handler
+       if (*type > TAPI_NETWORK_SERVICE_TYPE_SEARCH) {
+               /* Call Event Handler */
+               SmsPluginEventHandler::instance()->handleResendMessage();
        }
 }
 
@@ -311,8 +305,7 @@ void TapiEventSimRefreshed(TapiHandle *handle, const char *noti_id, void *data,
 void TapiEventMemoryStatus(TapiHandle *handle, int result, void *data, void *user_data)
 {
        MSG_DEBUG("Tapi result is [%d]", result);
-       if(result == TAPI_API_SUCCESS)
-       {
+       if (result == TAPI_API_SUCCESS) {
                isMemAvailable = true;
        }
 }
@@ -326,42 +319,41 @@ void TapiEventSentStatus(TapiHandle *handle, int result, void *data, void *user_
 
        /* Convert TAPI status -> SMS network status */
        switch ((TelSmsResponse_t)result) {
-               case TAPI_NETTEXT_SENDSMS_SUCCESS :
-                       sentStatus = SMS_NETWORK_SEND_SUCCESS;
-                       break;
-               case TAPI_NETTEXT_INVALID_MANDATORY_INFO :
-                       sentStatus = SMS_NETWORK_SEND_FAIL_MANDATORY_INFO_MISSING;
-                       break;
-               case TAPI_NETTEXT_DESTINAITION_OUTOFSERVICE :
-               case TAPI_NETTEXT_TEMPORARY_FAILURE :
-               case TAPI_NETTEXT_CONGESTION :
-               case TAPI_NETTEXT_RESOURCES_UNAVAILABLE :
-               case TAPI_NETTEXT_MESSAGE_NOT_COMPAT_PROTOCOL :
-                       sentStatus = SMS_NETWORK_SEND_FAIL_TEMPORARY;
-                       break;
-               case TAPI_NETTEXT_DEST_ADDRESS_FDN_RESTRICTED :
-               case TAPI_NETTEXT_SCADDRESS_FDN_RESTRICTED :
-                       sentStatus = SMS_NETWORK_SEND_FAIL_FDN_RESTRICED;
-                       break;
-               default :
-                       sentStatus = SMS_NETWORK_SEND_FAIL;
-                       break;
+       case TAPI_NETTEXT_SENDSMS_SUCCESS:
+               sentStatus = SMS_NETWORK_SEND_SUCCESS;
+               break;
+       case TAPI_NETTEXT_INVALID_MANDATORY_INFO:
+               sentStatus = SMS_NETWORK_SEND_FAIL_MANDATORY_INFO_MISSING;
+               break;
+       case TAPI_NETTEXT_DESTINAITION_OUTOFSERVICE:
+       case TAPI_NETTEXT_TEMPORARY_FAILURE:
+       case TAPI_NETTEXT_CONGESTION:
+       case TAPI_NETTEXT_RESOURCES_UNAVAILABLE:
+       case TAPI_NETTEXT_MESSAGE_NOT_COMPAT_PROTOCOL:
+               sentStatus = SMS_NETWORK_SEND_FAIL_TEMPORARY;
+               break;
+       case TAPI_NETTEXT_DEST_ADDRESS_FDN_RESTRICTED:
+       case TAPI_NETTEXT_SCADDRESS_FDN_RESTRICTED:
+               sentStatus = SMS_NETWORK_SEND_FAIL_FDN_RESTRICED;
+               break;
+       default:
+               sentStatus = SMS_NETWORK_SEND_FAIL;
+               break;
        }
 
        MSG_DEBUG("SMS Network Status = [%d]", sentStatus);
 
-       if(sentStatus == SMS_NETWORK_SEND_FAIL_TEMPORARY ||
-                       sentStatus == SMS_NETWORK_SEND_FAIL_BY_MO_CONTROL_WITH_MOD ||
+       if (sentStatus == SMS_NETWORK_SEND_FAIL_TEMPORARY ||
+                       sentStatus == SMS_NETWORK_SEND_FAIL_MANDATORY_INFO_MISSING ||
                        sentStatus == SMS_NETWORK_SEND_FAIL_FDN_RESTRICED) {
                SmsPluginTransport::instance()->setNetStatus(sentStatus);
                return;
        }
 
-       if(sentStatus == SMS_NETWORK_SEND_FAIL)
-       {
+       if (sentStatus == SMS_NETWORK_SEND_FAIL) {
                int svc_type;
                tel_get_property_int(handle, TAPI_PROP_NETWORK_SERVICE_TYPE, &svc_type);
-               if(svc_type < TAPI_NETWORK_SERVICE_TYPE_2G){
+               if (svc_type < TAPI_NETWORK_SERVICE_TYPE_2G){
                        sentStatus = SMS_NETWORK_SEND_PENDING;
                }
        }
@@ -385,14 +377,11 @@ void TapiEventSentStatus(TapiHandle *handle, int result, void *data, void *user_
                netStatus = MSG_NETWORK_SEND_FAIL;
        }
 
-       try
-       {
+       try {
                SmsPluginEventHandler::instance()->handleSentStatus(netStatus);
 
                SmsPluginTransport::instance()->setNetStatus(sentStatus);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return;
        }
@@ -412,8 +401,7 @@ void TapiEventSetConfigData(TapiHandle *handle, int result, void *data, void *us
 {
        MSG_DEBUG("TapiEventSetConfigData is called.");
 
-       if (data == NULL)
-       {
+       if (data == NULL) {
                MSG_DEBUG("Error. data is NULL.");
                return;
        }
@@ -422,30 +410,24 @@ void TapiEventSetConfigData(TapiHandle *handle, int result, void *data, void *us
 
        MSG_DEBUG("responseType : [%d]", *responseType);
 
-       switch (*responseType)
-       {
-               case TAPI_NETTEXT_SETPREFERREDBEARER_RSP :
-                       MSG_DEBUG("TAPI_NETTEXT_SETPREFERREDBEARER_RSP is called");
+       switch (*responseType) {
+       case TAPI_NETTEXT_SETPREFERREDBEARER_RSP:
+               MSG_DEBUG("TAPI_NETTEXT_SETPREFERREDBEARER_RSP is called");
                break;
-
-               case TAPI_NETTEXT_SETPARAMETERS_RSP :
-                       MSG_DEBUG("TAPI_NETTEXT_SETPARAMETERS_RSP is called");
+       case TAPI_NETTEXT_SETPARAMETERS_RSP:
+               MSG_DEBUG("TAPI_NETTEXT_SETPARAMETERS_RSP is called");
                break;
-
-               case TAPI_NETTEXT_CBSETCONFIG_RSP :
-                       MSG_DEBUG("TAPI_NETTEXT_CBSETCONFIG_RSP is called");
+       case TAPI_NETTEXT_CBSETCONFIG_RSP:
+               MSG_DEBUG("TAPI_NETTEXT_CBSETCONFIG_RSP is called");
                break;
-
-               case TAPI_NETTEXT_SETMEMORYSTATUS_RSP :
-                       MSG_DEBUG("TAPI_NETTEXT_SETMEMORYSTATUS_RSP is called");
+       case TAPI_NETTEXT_SETMEMORYSTATUS_RSP:
+               MSG_DEBUG("TAPI_NETTEXT_SETMEMORYSTATUS_RSP is called");
                break;
-
-               case TAPI_NETTEXT_SETMESSAGESTATUS_RSP :
-                       MSG_DEBUG("TAPI_NETTEXT_SETMESSAGESTATUS_RSP is called");
+       case TAPI_NETTEXT_SETMESSAGESTATUS_RSP:
+               MSG_DEBUG("TAPI_NETTEXT_SETMESSAGESTATUS_RSP is called");
                break;
-
-               default :
-                       MSG_DEBUG("Unknown Response is called [%d]", *responseType);
+       default:
+               MSG_DEBUG("Unknown Response is called [%d]", *responseType);
                break;
        }
 
@@ -466,8 +448,7 @@ void TapiEventGetCBConfig(TapiHandle *handle, int result, void *data, void *user
 
        MSG_CBMSG_OPT_S cbOpt = {0};
 
-       if (result != TAPI_API_SUCCESS || data == NULL)
-       {
+       if (result != TAPI_API_SUCCESS || data == NULL) {
                MSG_DEBUG("Error. data is NULL.");
 
                SmsPluginSetting::instance()->setCbConfigEvent(NULL, false);
@@ -479,23 +460,21 @@ void TapiEventGetCBConfig(TapiHandle *handle, int result, void *data, void *user
 
        cbOpt.bReceive = (bool)pCBConfig->CBEnabled;
 
-//     cbOpt.maxSimCnt = pCBConfig->MsgIdMaxCount;
+       /* cbOpt.maxSimCnt = pCBConfig->MsgIdMaxCount; */
+       /* MSG_DEBUG("Receive [%d], Max SIM Count [%d]", cbOpt.bReceive, cbOpt.maxSimCnt); */
 
-//     MSG_DEBUG("Receive [%d], Max SIM Count [%d]", cbOpt.bReceive, cbOpt.maxSimCnt);
        MSG_DEBUG("Receive [%d]", cbOpt.bReceive);
 
        cbOpt.channelData.channelCnt = pCBConfig->MsgIdRangeCount;
 
-       if (cbOpt.channelData.channelCnt > CB_CHANNEL_MAX)
-       {
+       if (cbOpt.channelData.channelCnt > CB_CHANNEL_MAX) {
                MSG_DEBUG("Channel Count [%d] from TAPI is over MAX", cbOpt.channelData.channelCnt);
                cbOpt.channelData.channelCnt = CB_CHANNEL_MAX;
        }
 
        MSG_DEBUG("Channel Count [%d]", cbOpt.channelData.channelCnt);
 
-       for (int i = 0; i < cbOpt.channelData.channelCnt; i++)
-       {
+       for (int i = 0; i < cbOpt.channelData.channelCnt; i++) {
                cbOpt.channelData.channelInfo[i].bActivate = pCBConfig->MsgIDs[i].Net3gpp2.Selected;
                cbOpt.channelData.channelInfo[i].ctg = pCBConfig->MsgIDs[i].Net3gpp2.CBCategory;
                cbOpt.channelData.channelInfo[i].lang = pCBConfig->MsgIDs[i].Net3gpp2.CBLanguage;
@@ -507,6 +486,7 @@ void TapiEventGetCBConfig(TapiHandle *handle, int result, void *data, void *user
        SmsPluginSetting::instance()->setCbConfigEvent(&cbOpt, true);
 }
 
+
 void TapiEventGetMsisdnInfo(TapiHandle *handle, int result, void *data, void *user_data)
 {
        MSG_DEBUG("TapiEventGetMsisdnInfo is called.");
@@ -542,15 +522,18 @@ void TapiEventGetMsisdnInfo(TapiHandle *handle, int result, void *data, void *us
        SmsPluginSetting::instance()->setResultFromSim(bRet);
 }
 
+
 void _dnet_state_changed_cb(keynode_t *key, void* data)
 {
        int dnet_state = MsgSettingGetInt(VCONFKEY_DNET_STATE);
 
        if (dnet_state > VCONFKEY_DNET_OFF) {
-               SmsPluginEventHandler::instance()->handleResendMessage(); // Call Event Handler
+               /* Call Event Handler */
+               SmsPluginEventHandler::instance()->handleResendMessage();
        }
 }
 
+
 void _TapiMdnChangedCb(keynode_t *key, void *data)
 {
        MSG_INFO("_TapiMdnChangedCb is called.");
@@ -562,11 +545,13 @@ void _TapiMdnChangedCb(keynode_t *key, void *data)
                MSG_INFO("bNeedToUpdateVoicemail:%d, mdn:[%s]", bNeedToUpdateVoicemail, mdn);
 
                if (bNeedToUpdateVoicemail) {
-                       if (MsgSettingSetString(VOICEMAIL_NUMBER, mdn) != MSG_SUCCESS)
-                               MSG_DEBUG("MsgSettingSetInt is failed!!");
+                       char keyName[MAX_VCONFKEY_NAME_LEN];
+                       int sim_idx = 1;
 
-                       if (MsgSettingSetString(VOICEMAIL_DEFAULT_NUMBER, mdn) != MSG_SUCCESS)
-                               MSG_DEBUG("Error to set config data [%s]", VOICEMAIL_DEFAULT_NUMBER);
+                       memset(keyName, 0x00, sizeof(keyName));
+                       snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_NUMBER, sim_idx);
+                       if (MsgSettingSetString(keyName, mdn) != MSG_SUCCESS)
+                               MSG_DEBUG("Error to set config data [%s]", keyName);
                }
 
                free(mdn);
index 0ae9eff..b5fe7a7 100755 (executable)
@@ -1,22 +1,19 @@
 /*
-* Copyright 2012-2013  Samsung Electronics Co., Ltd
-*
-* Licensed under the Flora License, Version 1.1 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*    http://floralicense.org/license/
-*
-* 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.
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
 */
 
-
-
-
 #include <stdio.h>
 #include <string.h>
 
@@ -27,9 +24,9 @@
 #include "SmsCdmaPluginCodec.h"
 
 
-
 SmsPluginMsgCodec* SmsPluginMsgCodec::pInstance = NULL;
 
+
 SmsPluginMsgCodec::SmsPluginMsgCodec()
 {
 
@@ -99,28 +96,27 @@ int UnpackGSM7bitData(unsigned char *src, unsigned char *dest, unsigned int data
 
        MSG_DEBUG("dataLen = %d", dataLen);
 
-       for (; dstIdx < dataLen; dstIdx++)
-       {
-               if (shift == 0)
-               {
+       for (; dstIdx < dataLen; dstIdx++) {
+               if (shift == 0) {
                        dest[dstIdx] = src[srcIdx] & 0x7F;
 
                        shift = 7;
                        srcIdx++;
                        dstIdx++;
 
-                       if (dstIdx >= dataLen) break;
+                       if (dstIdx >= dataLen)
+                               break;
                }
 
-               if (shift > 0)
-               {
+               if (shift > 0) {
                        dest[dstIdx] = (src[srcIdx-1] >> shift) + (src[srcIdx] << (8 - shift));
 
                        dest[dstIdx] &= 0x7F;
 
                        shift--;
 
-                       if (shift > 0) srcIdx++;
+                       if (shift > 0)
+                               srcIdx++;
                }
        }
 
@@ -135,30 +131,26 @@ int PackGSM7bitData(const unsigned char *pUserData, unsigned char *pPackData, in
        if (shift > 0)
                dstIdx = 1;
 
-       while (srcIdx < dataLen)
-       {
-               if (shift == 0)
-               {
+       while (srcIdx < dataLen) {
+               if (shift == 0) {
                        pPackData[dstIdx] = pUserData[srcIdx];
 
                        shift = 7;
                        srcIdx++;
                        dstIdx++;
 
-                       if (srcIdx >= dataLen) break;
+                       if (srcIdx >= dataLen)
+                               break;
                }
 
-               if (shift > 1)
-               {
+               if (shift > 1) {
                        pPackData[dstIdx-1] |= pUserData[srcIdx] << shift;
                        pPackData[dstIdx] = pUserData[srcIdx] >> (8-shift);
                        shift--;
 
                        srcIdx++;
                        dstIdx++;
-               }
-               else if (shift == 1)
-               {
+               } else if (shift == 1) {
                        pPackData[dstIdx-1] |= pUserData[srcIdx] << shift;
 
                        srcIdx++;
@@ -185,15 +177,15 @@ bool SmsPluginMsgCodec::checkInvalidPDU(const unsigned char *p_pkg_str, const in
 
        while (offset < p_pkg_len) {
                switch (p_pkg_str[offset]) {
-               case 0x00 :
-               case 0x01 :
-               case 0x02 :
-               case 0x03 :
-               case 0x04 :
-               case 0x05 :
-               case 0x06 :
-               case 0x07 :
-               case 0x08 :
+               case 0x00:
+               case 0x01:
+               case 0x02:
+               case 0x03:
+               case 0x04:
+               case 0x05:
+               case 0x06:
+               case 0x07:
+               case 0x08:
                        offset += (p_pkg_str[offset+1]+2);
                        break;
                default:
@@ -216,18 +208,18 @@ int SmsPluginMsgCodec::encodeMsg(const sms_trans_msg_s *p_msg, unsigned char *p_
 
        int encode_size = 0;
 
-       switch(p_msg->type) {
-               case SMS_TRANS_P2P_MSG:
-                       encode_size = encodeP2PMsg(&(p_msg->data.p2p_msg), p_pkg_str);
-                       break;
-               case SMS_TRANS_BROADCAST_MSG:
-                       encode_size = encodeCBMsg(&(p_msg->data.cb_msg), p_pkg_str);
-                       break;
-               case SMS_TRANS_ACK_MSG :
-                       encode_size = encodeAckMsg(&(p_msg->data.ack_msg), p_pkg_str);
-                       break;
-               default :
-                       break;
+       switch (p_msg->type) {
+       case SMS_TRANS_P2P_MSG:
+               encode_size = encodeP2PMsg(&(p_msg->data.p2p_msg), p_pkg_str);
+               break;
+       case SMS_TRANS_BROADCAST_MSG:
+               encode_size = encodeCBMsg(&(p_msg->data.cb_msg), p_pkg_str);
+               break;
+       case SMS_TRANS_ACK_MSG:
+               encode_size = encodeAckMsg(&(p_msg->data.ack_msg), p_pkg_str);
+               break;
+       default:
+               break;
        }
 
 
@@ -247,29 +239,32 @@ int SmsPluginMsgCodec::encodeP2PMsg(const sms_trans_p2p_msg_s *p_msg, unsigned c
 
        p_pkg_str[offset++] = SMS_TRANS_P2P_MSG;
 
-       // 1. teleservice id
+       /* 1. teleservice id */
        p_pkg_str[offset++] = SMS_TRANS_PARAM_TELESVC_IDENTIFIER;
-       p_pkg_str[offset++] = 2; // fixed
-       //memcpy(p_pkg_str+offset, &(p_msg->telesvc_id), sizeof(sms_trans_telesvc_id_t));
+       p_pkg_str[offset++] = 2;
+       /* fixed */
+       /* memcpy(p_pkg_str+offset, &(p_msg->telesvc_id), sizeof(sms_trans_telesvc_id_t)); */
        _copy_short_to_char(p_pkg_str+offset, &(p_msg->telesvc_id));
        offset += sizeof(sms_trans_telesvc_id_t);
 
-       // 2. Service category
-       if(p_msg->svc_ctg < SMS_TRANS_SVC_CTG_UNDEFINED) {
+       /* 2. Service category */
+       if (p_msg->svc_ctg < SMS_TRANS_SVC_CTG_UNDEFINED) {
                p_pkg_str[offset++] = SMS_TRANS_PARAM_SERVICE_CATEGORY;
-               p_pkg_str[offset++] = 0x02; // fixed
+               p_pkg_str[offset++] = 0x02;
+               /* fixed */
                _copy_short_to_char(&p_pkg_str[offset],&(p_msg->svc_ctg));
        }
 
-       // 3. Address
+       /* 3. Address */
        p_pkg_str[offset++] = SMS_TRANS_PARAM_DEST_ADDRESS;
 
-       len_index = offset++; // Will be set to param length
+       /* Will be set to param length */
+       len_index = offset++;
 
        p_pkg_str[offset] = p_msg->address.digit_mode ? 0x80 : 0x00;
        p_pkg_str[offset] |= (p_msg->address.number_mode ? 0x40 : 0x00);
 
-       if(p_msg->address.digit_mode == false) {
+       if (p_msg->address.digit_mode == false) {
                index = offset++;
                p_pkg_str[offset++] = p_msg->address.addr_len;
 
@@ -282,11 +277,10 @@ int SmsPluginMsgCodec::encodeP2PMsg(const sms_trans_p2p_msg_s *p_msg, unsigned c
                offset += addr_len;
 
                _shiftNBit(&p_pkg_str[index], offset-index+1, 6);
-       }
-       else if(p_msg->address.digit_mode == true) {
+       } else if (p_msg->address.digit_mode == true) {
                p_pkg_str[offset] |= p_msg->address.number_type << 3;
 
-               if(p_msg->address.number_mode == false) {
+               if (p_msg->address.number_mode == false) {
                        p_pkg_str[offset++] |= p_msg->address.number_plan >> 1;
                        p_pkg_str[offset++] |= p_msg->address.number_plan << 7;
                        index = offset-1;
@@ -297,8 +291,7 @@ int SmsPluginMsgCodec::encodeP2PMsg(const sms_trans_p2p_msg_s *p_msg, unsigned c
                        offset += p_msg->address.addr_len;
 
                        _shiftNBit(&p_pkg_str[index], offset-index+1, 7);
-               }
-               else if(p_msg->address.number_mode == true) {
+               } else if (p_msg->address.number_mode == true) {
                        index = offset++;
                        p_pkg_str[offset++] = p_msg->address.addr_len;
                        memcpy(p_pkg_str+offset, p_msg->address.szData, p_msg->address.addr_len);
@@ -312,8 +305,8 @@ int SmsPluginMsgCodec::encodeP2PMsg(const sms_trans_p2p_msg_s *p_msg, unsigned c
        p_pkg_str[len_index] = offset - len_index - 1 ;
        MSG_DEBUG("Address subparam length field = [%d]", p_pkg_str[len_index]);
 
-       // 4. Sub address (optional)
-       if(p_msg->sub_address.addr_len > 0) {
+       /* 4. Sub address (optional) */
+       if (p_msg->sub_address.addr_len > 0) {
                p_pkg_str[offset++] = SMS_TRANS_PARAM_ORG_SUB_ADDRESS;
                p_pkg_str[offset] = p_msg->sub_address.addr_len + 2;
                index = offset++;
@@ -322,27 +315,29 @@ int SmsPluginMsgCodec::encodeP2PMsg(const sms_trans_p2p_msg_s *p_msg, unsigned c
                p_pkg_str[offset++] = p_msg->sub_address.addr_len;
                memcpy(p_pkg_str+offset, p_msg->sub_address.szData, p_msg->sub_address.addr_len);
 
-               offset+=p_msg->sub_address.addr_len;
+               offset += p_msg->sub_address.addr_len;
 
                _shiftNBit(&p_pkg_str[index], offset-index+1, 4);
        }
 
-       // 5. Bearer reply option (optional)
-       if(p_msg->reply_seq > 0) {
+       /* 5. Bearer reply option (optional) */
+       if (p_msg->reply_seq > 0) {
                p_pkg_str[offset++] = SMS_TRANS_PARAM_BEARER_REPLY_OPTION;
                p_pkg_str[offset++] = 1;
                p_pkg_str[offset++] = (unsigned char)(p_msg->reply_seq << 2);
                MSG_DEBUG("Reply sequnce number = [%d]", p_msg->reply_seq);
        }
 
-       // 6. Bearer data
+       /* 6. Bearer data */
     p_pkg_str[offset++] = SMS_TRANS_PARAM_BEARER_DATA;
-       index = offset++; // PARAMETER_LEN field should be filled at the last part.
+    /* PARAMETER_LEN field should be filled at the last part. */
+    index = offset++;
 
        unsigned char *encode_data = &p_pkg_str[offset];
 
        encode_size = encodeTelesvcMsg(&(p_msg->telesvc_msg), encode_data);
-       p_pkg_str[index] = encode_size; // PARAMETER_LEN
+       /* PARAMETER_LEN */
+       p_pkg_str[index] = encode_size;
 
        offset += encode_size;
 
@@ -359,21 +354,23 @@ int SmsPluginMsgCodec::encodeCBMsg(const sms_trans_broadcast_msg_s *p_msg, unsig
        int offset = 0, encode_size = 0;
        int len_index = 0;
 
-       // 1. Service Category(Mandatory)
+       /* 1. Service Category(Mandatory) */
        p_pkg_str[offset++] = SMS_TRANS_PARAM_SERVICE_CATEGORY;
        p_pkg_str[offset++] = 0x02;
        _copy_short_to_char(&p_pkg_str[offset],&p_msg->svc_ctg);
 
 
-       // 2. Bearer Data(Optional)
-       // TODO: give condition
+       /* 2. Bearer Data(Optional) */
+       /* TODO: give condition */
     p_pkg_str[offset++] = SMS_TRANS_PARAM_BEARER_DATA;
-       len_index = offset++; // PARAMETER_LEN field should be filled at the last part.
+    /* PARAMETER_LEN field should be filled at the last part. */
+       len_index = offset++;
 
        unsigned char *encode_data = &p_pkg_str[offset];
 
        encode_size = encodeTelesvcMsg(&(p_msg->telesvc_msg), encode_data);
-       p_pkg_str[len_index] = encode_size; // PARAMETER_LEN
+       /* PARAMETER_LEN */
+       p_pkg_str[len_index] = encode_size;
 
        offset += encode_size;
 
@@ -391,17 +388,18 @@ int SmsPluginMsgCodec::encodeAckMsg(const sms_trans_ack_msg_s *p_msg, unsigned c
        int addr_len = 0, len_index = 0;
        int index = 0;
 
-       // 1. Address
+       /* 1. Address */
        p_pkg_str[offset++] = SMS_TRANS_PARAM_DEST_ADDRESS;
 
-       len_index = offset++; // Will be set to param length
+       /* Will be set to param length */
+       len_index = offset++;
 
        p_pkg_str[offset] = p_msg->address.digit_mode ? 0x80 : 0x00;
        p_pkg_str[offset] |= (p_msg->address.number_mode ? 0x40 : 0x00);
 
        index = offset++;
 
-       if(p_msg->address.digit_mode == false) {
+       if (p_msg->address.digit_mode == false) {
                p_pkg_str[offset++] = p_msg->address.addr_len;
 
                addr_len = SmsPluginParamCodec::instance()->convertDigitToDTMF(p_msg->address.szData, p_msg->address.addr_len, 0, p_pkg_str+offset);
@@ -413,11 +411,10 @@ int SmsPluginMsgCodec::encodeAckMsg(const sms_trans_ack_msg_s *p_msg, unsigned c
                offset += addr_len;
 
                _shiftNBit(&p_pkg_str[index], offset-index+1, 6);
-       }
-       else if(p_msg->address.digit_mode == true) {
+       } else if (p_msg->address.digit_mode == true) {
                p_pkg_str[offset] |= p_msg->address.number_type << 3;
 
-               if(p_msg->address.number_mode == false) {
+               if (p_msg->address.number_mode == false) {
                        p_pkg_str[offset++] |= p_msg->address.number_plan >> 1;
                        p_pkg_str[offset++] |= p_msg->address.number_plan << 7;
                        index++;
@@ -428,8 +425,7 @@ int SmsPluginMsgCodec::encodeAckMsg(const sms_trans_ack_msg_s *p_msg, unsigned c
                        offset += p_msg->address.addr_len;
 
                        _shiftNBit(&p_pkg_str[index], offset-index+1, 7);
-               }
-               else if(p_msg->address.number_mode == true) {
+               } else if (p_msg->address.number_mode == true) {
                        p_pkg_str[++offset] = p_msg->address.addr_len;
                        offset++;
                        memcpy(p_pkg_str+offset, p_msg->address.szData, p_msg->address.addr_len);
@@ -443,8 +439,8 @@ int SmsPluginMsgCodec::encodeAckMsg(const sms_trans_ack_msg_s *p_msg, unsigned c
        p_pkg_str[len_index] = offset - len_index - 1 ;
        MSG_DEBUG("Address subparam length field = [%d]", p_pkg_str[len_index]);
 
-       // 2. Sub address
-       if(p_msg->sub_address.addr_len > 0) {
+       /* 2. Sub address */
+       if (p_msg->sub_address.addr_len > 0) {
                p_pkg_str[offset++] = SMS_TRANS_PARAM_ORG_SUB_ADDRESS;
                p_pkg_str[offset] = p_msg->sub_address.addr_len + 2;
                index = offset++;
@@ -453,12 +449,12 @@ int SmsPluginMsgCodec::encodeAckMsg(const sms_trans_ack_msg_s *p_msg, unsigned c
                p_pkg_str[offset++] = p_msg->sub_address.addr_len;
                memcpy(p_pkg_str+offset, p_msg->sub_address.szData, p_msg->sub_address.addr_len);
 
-               offset+=p_msg->sub_address.addr_len;
+               offset += p_msg->sub_address.addr_len;
 
                _shiftNBit(&p_pkg_str[index], offset-index+1, 4);
        }
 
-       // 3. Cause code
+       /* 3. Cause code */
        p_pkg_str[offset++] = SMS_TRANS_PARAM_CAUSE_CODES;
        index = offset++;
        p_pkg_str[offset] |= p_msg->cause_code.reply_seq << 2;
@@ -474,6 +470,7 @@ int SmsPluginMsgCodec::encodeAckMsg(const sms_trans_ack_msg_s *p_msg, unsigned c
 
 }
 
+
 int SmsPluginMsgCodec::encodeTelesvcMsg(const sms_telesvc_msg_s *p_msg, unsigned char *p_pkg_str)
 {
        MSG_BEGIN();
@@ -481,38 +478,42 @@ int SmsPluginMsgCodec::encodeTelesvcMsg(const sms_telesvc_msg_s *p_msg, unsigned
 
        MSG_DEBUG("Teleservice msg type = [%d]", p_msg->type);
 
-       switch(p_msg->type) {
-//             case SMS_TYPE_DELIVER :
-//                     encode_size = encodeTelesvcDeliverMsg(&(p_msg->data.delever), p_pkg_str);
-//                     break;
-               case SMS_TYPE_SUBMIT :
-                       encode_size = encodeTelesvcSubmitMsg(&(p_msg->data.submit), p_pkg_str);
-                       break;
-               case SMS_TYPE_CANCEL :
-                       encode_size = encodeTelesvcCancelMsg(&(p_msg->data.cancel), p_pkg_str);
-                       break;
-               case SMS_TYPE_USER_ACK :
-                       encode_size = encodeTelesvcUserAckMsg(&(p_msg->data.user_ack), p_pkg_str);
-                       break;
-               case SMS_TYPE_READ_ACK :
-                       encode_size = encodeTelesvcReadAckMsg(&(p_msg->data.read_ack), p_pkg_str);
-                       break;
-               case SMS_TYPE_DELIVER_REPORT :
-                       encode_size = encodeTelesvcDeliverReportMsg(&(p_msg->data.report), p_pkg_str);
-                       break;
-               default :
-                       MSG_DEBUG("No matching type for [%d]", p_msg->type);
-                       break;
+       switch (p_msg->type) {
+       /* case SMS_TYPE_DELIVER:
+               encode_size = encodeTelesvcDeliverMsg(&(p_msg->data.delever), p_pkg_str);
+               break;  */
+       case SMS_TYPE_SUBMIT:
+               encode_size = encodeTelesvcSubmitMsg(&(p_msg->data.submit), p_pkg_str);
+               break;
+       case SMS_TYPE_CANCEL:
+               encode_size = encodeTelesvcCancelMsg(&(p_msg->data.cancel), p_pkg_str);
+               break;
+       case SMS_TYPE_USER_ACK:
+               encode_size = encodeTelesvcUserAckMsg(&(p_msg->data.user_ack), p_pkg_str);
+               break;
+       case SMS_TYPE_READ_ACK:
+               encode_size = encodeTelesvcReadAckMsg(&(p_msg->data.read_ack), p_pkg_str);
+               break;
+       case SMS_TYPE_DELIVER_REPORT:
+               encode_size = encodeTelesvcDeliverReportMsg(&(p_msg->data.report), p_pkg_str);
+               break;
+       default:
+               MSG_DEBUG("No matching type for [%d]", p_msg->type);
+               break;
        }
 
        MSG_END();
        return encode_size;
 }
 
-//int SmsPluginMsgCodec::encodeTelesvcDeliverMsg(const sms_telesvc_deliver_s *p_msg, char *p_pkg_str)
-//{
-//
-//}
+
+/*
+int SmsPluginMsgCodec::encodeTelesvcDeliverMsg(const sms_telesvc_deliver_s *p_msg, char *p_pkg_str)
+{
+
+}
+*/
+
 
 int SmsPluginMsgCodec::encodeTelesvcReadAckMsg(const sms_telesvc_read_ack_s *p_msg, unsigned char *p_pkg_str)
 {
@@ -520,7 +521,6 @@ int SmsPluginMsgCodec::encodeTelesvcReadAckMsg(const sms_telesvc_read_ack_s *p_m
 
        int offset = 0;
 
-
        MSG_END();
 
        return offset;
@@ -546,29 +546,29 @@ int SmsPluginMsgCodec::encodeTelesvcDeliverReportMsg(const sms_telesvc_report_s
        int offset = 0, len_index = 0, encode_size = 0;
        bool delReservedBit = false;
 
-       // 1. Message Identifier (Mandatory)
+       /* 1. Message Identifier (Mandatory) */
        p_pkg_str[offset++] = SMS_BEARER_MESSAGE_IDENTIFIER;
        p_pkg_str[offset++] = 3;
        _copy_short_to_char(p_pkg_str+offset+1, &(p_msg->msg_id.msg_id));
        _shiftNBit(&p_pkg_str[offset], 3, 4);
        p_pkg_str[offset] |= SMS_TYPE_SUBMIT << 4;
-       offset+=2;
+       offset += 2;
        p_pkg_str[offset++] |= (p_msg->msg_id.header_ind ? 0x08 : 0x00);
 
 
-       // 2. TP-Failure Cause (Conditional)
-       if(p_msg->tp_fail_cause >= 0x8000) {
+       /* 2. TP-Failure Cause (Conditional) */
+       if (p_msg->tp_fail_cause >= 0x8000) {
                p_pkg_str[offset++] = SMS_BEARER_TP_FAILURE_CAUSE;
                p_pkg_str[offset++] = 1;
                p_pkg_str[offset++] = p_msg->tp_fail_cause;
        }
 
-       // 3. User Data (Optional)
-       if(p_msg->user_data.data_len > 0) {
+       /* 3. User Data (Optional) */
+       if (p_msg->user_data.data_len > 0) {
                p_pkg_str[offset++] = SMS_BEARER_USER_DATA;
                len_index = offset;
                offset++;
-               if(p_msg->user_data.encode_type == 0x01 || p_msg->user_data.encode_type == 0x0a)
+               if (p_msg->user_data.encode_type == 0x01 || p_msg->user_data.encode_type == 0x0a)
                        p_pkg_str[offset++] = p_msg->user_data.msg_type;
 
                p_pkg_str[offset++] = p_msg->user_data.encode_type << 3;
@@ -577,7 +577,7 @@ int SmsPluginMsgCodec::encodeTelesvcDeliverReportMsg(const sms_telesvc_report_s
                if (p_msg->user_data.encode_type == SMS_ENCODE_7BIT_ASCII || p_msg->user_data.encode_type == SMS_ENCODE_GSM7BIT) {
                        encode_size = encodeUserData(p_msg->user_data.user_data, &p_pkg_str[offset], p_msg->user_data.data_len);
                        offset += encode_size;
-                       if(p_msg->user_data.data_len % 8 > 4)
+                       if (p_msg->user_data.data_len % 8 > 4)
                                delReservedBit = true;
                } else {
                        memcpy(p_pkg_str+offset, p_msg->user_data.user_data, p_msg->user_data.data_len);
@@ -592,15 +592,16 @@ int SmsPluginMsgCodec::encodeTelesvcDeliverReportMsg(const sms_telesvc_report_s
 
        }
 
-       // 4. Language Indicator (Optional)
-       // TODO : give condition
-//     p_pkg_str[offset++] = SMS_BEARER_ALERT_ON_MSG_DELIVERY;
-//     p_pkg_str[offset++] = 1;
-//     p_pkg_str[offset++] = p_msg->language;
+       /* 4. Language Indicator (Optional) */
+       /* TODO : give condition */
+       /*
+       p_pkg_str[offset++] = SMS_BEARER_ALERT_ON_MSG_DELIVERY;
+       p_pkg_str[offset++] = 1;
+       p_pkg_str[offset++] = p_msg->language;
+       */
 
-
-       // 5. Multiple Encoding User Data (Optional)
-       // Omitted
+       /* 5. Multiple Encoding User Data (Optional) */
+       /* Omitted */
 
        MSG_END();
 
@@ -614,13 +615,13 @@ int SmsPluginMsgCodec::encodeTelesvcCancelMsg(const sms_telesvc_cancel_s *p_msg,
 
        int offset = 0;
 
-       // 1. Message Identifier
+       /* 1. Message Identifier */
        p_pkg_str[offset++] = SMS_BEARER_MESSAGE_IDENTIFIER;
        p_pkg_str[offset++] = 3;
        _copy_short_to_char(p_pkg_str+offset+1, &(p_msg->msg_id.msg_id));
        _shiftNBit(&p_pkg_str[offset], 3, 4);
        p_pkg_str[offset] |= SMS_TYPE_SUBMIT << 4;
-       offset+=2;
+       offset += 2;
        p_pkg_str[offset++] |= (p_msg->msg_id.header_ind ? 0x08 : 0x00);
 
        MSG_END();
@@ -637,21 +638,21 @@ int SmsPluginMsgCodec::encodeTelesvcSubmitMsg(const sms_telesvc_submit_s *p_msg,
        int encode_size = 0;
        bool delReservedBit = false;
 
-       // 1. Message Identifier
+       /* 1. Message Identifier */
        p_pkg_str[offset++] = SMS_BEARER_MESSAGE_IDENTIFIER;
        p_pkg_str[offset++] = 3;
        _copy_short_to_char(p_pkg_str+offset+1, &(p_msg->msg_id.msg_id));
        _shiftNBit(&p_pkg_str[offset], 3, 4);
        p_pkg_str[offset] |= SMS_TYPE_SUBMIT << 4;
-       offset+=2;
+       offset += 2;
        p_pkg_str[offset++] |= (p_msg->msg_id.header_ind ? 0x08 : 0x00);
 
-       // 2. User Data
-       if(p_msg->user_data.data_len > 0) {
+       /* 2. User Data */
+       if (p_msg->user_data.data_len > 0) {
                p_pkg_str[offset++] = SMS_BEARER_USER_DATA;
                len_index = offset;
                offset++;
-               if(p_msg->user_data.encode_type == 0x01 || p_msg->user_data.encode_type == 0x0a)
+               if (p_msg->user_data.encode_type == 0x01 || p_msg->user_data.encode_type == 0x0a)
                        p_pkg_str[offset++] = p_msg->user_data.msg_type;
 
                p_pkg_str[offset++] = p_msg->user_data.encode_type << 3;
@@ -660,12 +661,12 @@ int SmsPluginMsgCodec::encodeTelesvcSubmitMsg(const sms_telesvc_submit_s *p_msg,
                if (p_msg->user_data.encode_type == SMS_ENCODE_7BIT_ASCII) {
                        encode_size = encodeUserData(p_msg->user_data.user_data, &p_pkg_str[offset], p_msg->user_data.data_len);
                        offset += encode_size;
-                       if(p_msg->user_data.data_len % 8 > 4)
+                       if (p_msg->user_data.data_len % 8 > 4)
                                delReservedBit = true;
                } else if (p_msg->user_data.encode_type == SMS_ENCODE_GSM7BIT) {
                        encode_size = PackGSM7bitData(p_msg->user_data.user_data, &p_pkg_str[offset], p_msg->user_data.data_len);
                        offset += encode_size;
-                       if(p_msg->user_data.data_len % 8 > 4)
+                       if (p_msg->user_data.data_len % 8 > 4)
                                delReservedBit = true;
                } else if (p_msg->user_data.encode_type == SMS_ENCODE_UNICODE) {
                        MsgTextConvert *textCvt = MsgTextConvert::instance();
@@ -684,8 +685,9 @@ int SmsPluginMsgCodec::encodeTelesvcSubmitMsg(const sms_telesvc_submit_s *p_msg,
                p_pkg_str[len_index] = offset - len_index - 1;
 
        }
-/* Sprint and Verizon issue
-       // 3. Validity Period
+       /* Sprint and Verizon issue */
+       /* 3. Validity Period */
+       /*
        if (p_msg->val_period.format == SMS_TIME_RELATIVE) {
                p_pkg_str[offset++] = SMS_BEARER_VALIDITY_PERIOD_RELATIVE;
                p_pkg_str[offset++] = 1;
@@ -701,8 +703,9 @@ int SmsPluginMsgCodec::encodeTelesvcSubmitMsg(const sms_telesvc_submit_s *p_msg,
                p_pkg_str[offset++] = _convert_to_BCD(p_msg->val_period.time.abs_time.minutes);
                p_pkg_str[offset++] = _convert_to_BCD(p_msg->val_period.time.abs_time.seconds);
        }
-*/
-       // 4. Deferred Delivery Time
+       */
+
+       /* 4. Deferred Delivery Time */
        if (p_msg->defer_val_period.format == SMS_TIME_RELATIVE) {
                p_pkg_str[offset++] = SMS_BEARER_DEFERRED_DELIVERY_TIME_RELATIVE;
                p_pkg_str[offset++] = 1;
@@ -719,22 +722,24 @@ int SmsPluginMsgCodec::encodeTelesvcSubmitMsg(const sms_telesvc_submit_s *p_msg,
                p_pkg_str[offset++] = _convert_to_BCD(p_msg->defer_val_period.time.abs_time.seconds);
        }
 
-       // 5. Priority Indicator
+       /* 5. Priority Indicator */
        if (p_msg->priority >= SMS_PRIORITY_NORMAL && p_msg->priority <=        SMS_PRIORITY_EMERGENCY) {
                p_pkg_str[offset++] = SMS_BEARER_PRIORITY_INDICATOR;
                p_pkg_str[offset++] = 1;
                p_pkg_str[offset++] = p_msg->priority << 6;
        }
 
-/* Sprint and Verizon issue
-       // 6. Privacy Indicator
+       /* Sprint and Verizon issue */
+       /* 6. Privacy Indicator */
+       /*
        if (p_msg->privacy >= SMS_PRIVACY_NOT_RESTRICTED && p_msg->privacy <= SMS_PRIVACY_SECRET) {
                p_pkg_str[offset++] = SMS_BEARER_PRIVACY_INDICATOR;
                p_pkg_str[offset++] = 1;
                p_pkg_str[offset++] = p_msg->privacy << 6;
        }
-*/
-       // 7. Reply Option
+       */
+
+       /* 7. Reply Option */
        if (p_msg->reply_opt.user_ack_req | p_msg->reply_opt.deliver_ack_req | p_msg->reply_opt.read_ack_req | p_msg->reply_opt.report_req) {
                p_pkg_str[offset++] = SMS_BEARER_REPLY_OPTION;
                p_pkg_str[offset++] = 1;
@@ -744,19 +749,23 @@ int SmsPluginMsgCodec::encodeTelesvcSubmitMsg(const sms_telesvc_submit_s *p_msg,
                p_pkg_str[offset++] |= p_msg->reply_opt.report_req << 4;
        }
 
-       // 8. Alert on Message Delivery
-       // TODO : give condition
-//     p_pkg_str[offset++] = SMS_BEARER_ALERT_ON_MSG_DELIVERY;
-//     p_pkg_str[offset++] = 1;
-//     p_pkg_str[offset++] = p_msg->alert_priority << 6;
-
-       // 9. Language Indicator
-       // TODO : give condition
-//     p_pkg_str[offset++] = SMS_BEARER_ALERT_ON_MSG_DELIVERY;
-//     p_pkg_str[offset++] = 1;
-//     p_pkg_str[offset++] = p_msg->language;
-
-       // 10. Call-back Number
+       /* 8. Alert on Message Delivery */
+       /* TODO : give condition */
+       /*
+       p_pkg_str[offset++] = SMS_BEARER_ALERT_ON_MSG_DELIVERY;
+       p_pkg_str[offset++] = 1;
+       p_pkg_str[offset++] = p_msg->alert_priority << 6;
+       */
+
+       /* 9. Language Indicator */
+       /* TODO : give condition */
+       /*
+       p_pkg_str[offset++] = SMS_BEARER_ALERT_ON_MSG_DELIVERY;
+       p_pkg_str[offset++] = 1;
+       p_pkg_str[offset++] = p_msg->language;
+       */
+
+       /* 10. Call-back Number */
        if (p_msg->callback_number.addr_len > 0) {
                p_pkg_str[offset++] = SMS_BEARER_CALLBACK_NUMBER;
 
@@ -764,13 +773,12 @@ int SmsPluginMsgCodec::encodeTelesvcSubmitMsg(const sms_telesvc_submit_s *p_msg,
 
                p_pkg_str[offset] |= p_msg->callback_number.digit_mode << 7;
 
-               if(p_msg->callback_number.digit_mode == false) {
+               if (p_msg->callback_number.digit_mode == false) {
                        p_pkg_str[offset++] |= (p_msg->callback_number.addr_len & 0xfe) >> 1;
                        p_pkg_str[offset] |= (p_msg->callback_number.addr_len & 0x01) << 7;
                        int addr_len = SmsPluginParamCodec::instance()->convertDigitToDTMF(p_msg->callback_number.szData, p_msg->callback_number.addr_len, 1, p_pkg_str+offset);
                        offset += addr_len;
-               }
-               else if(p_msg->callback_number.digit_mode == true) {
+               } else if (p_msg->callback_number.digit_mode == true) {
                        p_pkg_str[offset] |= p_msg->callback_number.number_type << 6;
                        p_pkg_str[offset++] |= p_msg->callback_number.number_plan;
                        p_pkg_str[offset++] = p_msg->callback_number.addr_len;
@@ -781,14 +789,14 @@ int SmsPluginMsgCodec::encodeTelesvcSubmitMsg(const sms_telesvc_submit_s *p_msg,
                p_pkg_str[len_index] = offset- len_index - 1;
        }
 
-       // 11. Multiple Encoding User Data
-       // Omitted
+       /* 11. Multiple Encoding User Data */
+       /* Omitted */
 
-       // 12. Message Deposit Index
-       // Omitted
+       /* 12. Message Deposit Index */
+       /* Omitted */
 
-       // 13. Service Category Program Results
-       // Omitted
+       /* 13. Service Category Program Results */
+       /* Omitted */
 
        MSG_END();
        return offset;
@@ -803,22 +811,22 @@ int SmsPluginMsgCodec::decodeMsg(const unsigned char *p_pkg_str, int pkg_len, sm
 
        char mti = p_pkg_str[0] & 0xff;
 
-       switch(mti) {
-               case SMS_TRANS_P2P_MSG:
-                       p_msg->type = SMS_TRANS_P2P_MSG;
-                       decodelen = decodeP2PMsg(p_pkg_str+1, pkg_len-1, &(p_msg->data.p2p_msg));
-                       break;
-               case SMS_TRANS_BROADCAST_MSG:
-                       p_msg->type = SMS_TRANS_BROADCAST_MSG;
-                       decodelen = decodeCBMsg(p_pkg_str+1, pkg_len-1, &(p_msg->data.cb_msg));
-                       break;
-               case SMS_TRANS_ACK_MSG:
-                       p_msg->type = SMS_TRANS_ACK_MSG;
-                       decodelen = decodeAckMsg(p_pkg_str+1, pkg_len-1, &(p_msg->data.ack_msg));
-                       break;
-               default:
-                       p_msg->type = SMS_TRANS_TYPE_RESERVED;
-                       break;
+       switch (mti) {
+       case SMS_TRANS_P2P_MSG:
+               p_msg->type = SMS_TRANS_P2P_MSG;
+               decodelen = decodeP2PMsg(p_pkg_str+1, pkg_len-1, &(p_msg->data.p2p_msg));
+               break;
+       case SMS_TRANS_BROADCAST_MSG:
+               p_msg->type = SMS_TRANS_BROADCAST_MSG;
+               decodelen = decodeCBMsg(p_pkg_str+1, pkg_len-1, &(p_msg->data.cb_msg));
+               break;
+       case SMS_TRANS_ACK_MSG:
+               p_msg->type = SMS_TRANS_ACK_MSG;
+               decodelen = decodeAckMsg(p_pkg_str+1, pkg_len-1, &(p_msg->data.ack_msg));
+               break;
+       default:
+               p_msg->type = SMS_TRANS_TYPE_RESERVED;
+               break;
        }
 
        MSG_END();
@@ -835,36 +843,36 @@ int SmsPluginMsgCodec::decodeP2PMsg(const unsigned char *p_pkg_str, int pkg_len,
 
        while (offset < pkg_len) {
                switch (p_pkg_str[offset]) {
-               case 0x00:                              // Teleservice Identifier
+               case 0x00:
+                       /* Teleservice Identifier */
                        offset += decodeTeleId(p_pkg_str+offset, pkg_len, &(p_p2p->telesvc_id));
                        break;
-
-               case 0x01:                              // Service Category
+                       case 0x01:
+                       /* Service Category */
                        offset += decodeSvcCtg(p_pkg_str+offset, pkg_len, &(p_p2p->svc_ctg));
                        break;
-
                case 0x02:
-               case 0x04:                              // Address
+               case 0x04:
+                       /* Address */
                        offset += decodeAddress(p_pkg_str+offset, pkg_len, &(p_p2p->address));
                        break;
-
                case 0x03:
-               case 0x05:                              // Subaddress
+               case 0x05:
+                       /* Subaddress */
                        offset += decodeSubAddress(p_pkg_str+offset, pkg_len, &(p_p2p->sub_address));
                        break;
-
-               case 0x06:                              // Bearer Reply Option
-                       offset+=2;
+               case 0x06:
+                       /* Bearer Reply Option*/
+                       offset += 2;
                        p_p2p->reply_seq = (sms_trans_reply_seq_t)(p_pkg_str[offset] >> 2);
                        offset++;
                        break;
-
-               case 0x08:                              // Bearer Data
+               case 0x08:
+                       /* Bearer Data */
                        tmp_len = p_pkg_str[++offset];
                        decodeP2PTelesvcMsg(p_pkg_str+offset+1, tmp_len, &p_p2p->telesvc_msg);
-                       offset+=(tmp_len+1);
+                       offset += (tmp_len+1);
                        break;
-
                default:
                        break;
                }
@@ -882,20 +890,20 @@ int SmsPluginMsgCodec::decodeCBMsg(const unsigned char *p_pkg_str, int pkg_len,
 
        int offset = 0, tmp_len = 0;
 
-       while(offset < pkg_len) {
-               if(p_pkg_str[offset] == 0x01) {                 // Service Category
+       while (offset < pkg_len) {
+               if (p_pkg_str[offset] == 0x01) {
+                       /* Service Category */
                        offset += decodeTeleId(p_pkg_str+offset, pkg_len, &(p_cb->svc_ctg));
-               }
-               else if(p_pkg_str[offset] == 0x08) {                                                    // Bearer Data
+               } else if (p_pkg_str[offset] == 0x08) {
+                       /* Bearer Data */
                        tmp_len = p_pkg_str[++offset];
-                       if(p_cb->svc_ctg >= SMS_TRANS_SVC_CTG_CMAS_PRESIDENTIAL && p_cb->svc_ctg <= SMS_TRANS_SVC_CTG_CMAS_TEST) {
+                       if (p_cb->svc_ctg >= SMS_TRANS_SVC_CTG_CMAS_PRESIDENTIAL && p_cb->svc_ctg <= SMS_TRANS_SVC_CTG_CMAS_TEST) {
                                decodeCBBearerData(p_pkg_str+offset+1, tmp_len, &(p_cb->telesvc_msg), true);
-                       }
-                       else {
+                       } else {
                                decodeCBBearerData(p_pkg_str+offset+1, tmp_len, &(p_cb->telesvc_msg), false);
                        }
 
-                       offset+=(tmp_len+1);
+                       offset += (tmp_len+1);
                }
        }
 
@@ -912,16 +920,17 @@ int SmsPluginMsgCodec::decodeAckMsg(const unsigned char *p_pkg_str, int pkg_len,
        int offset = 0;
 
        while (offset < pkg_len) {
-               if(p_pkg_str[offset] == 0x04) {                                 // Destination Address
+               if (p_pkg_str[offset] == 0x04) {
+                       /* Destination Address */
                        offset += decodeAddress(p_pkg_str+offset, pkg_len, &(p_ack->address));
-               }
-               else if(p_pkg_str[offset] == 0x05) {                                    // Destination Subaddress
+               } else if (p_pkg_str[offset] == 0x05) {
+                       /* Destination Subaddress */
                        offset += decodeSubAddress(p_pkg_str+offset, pkg_len, &(p_ack->sub_address));
-               }
-               else if(p_pkg_str[offset] == 0x07) {                                    // Cause Codes
-                       offset+=2;
+               } else if (p_pkg_str[offset] == 0x07) {
+                       /* Cause Codes */
+                       offset += 2;
                        p_ack->cause_code.reply_seq = (sms_trans_reply_seq_t)p_pkg_str[offset] >> 2;
-                       switch(p_pkg_str[offset++] & 0x03) {
+                       switch (p_pkg_str[offset++] & 0x03) {
                        case 0x00:
                                p_ack->cause_code.error_class = SMS_TRANS_ERR_CLASS_NONE;
                                break;
@@ -935,7 +944,7 @@ int SmsPluginMsgCodec::decodeAckMsg(const unsigned char *p_pkg_str, int pkg_len,
                                break;
                        }
 
-                       if(p_ack->cause_code.error_class != SMS_TRANS_ERR_CLASS_NONE) {
+                       if (p_ack->cause_code.error_class != SMS_TRANS_ERR_CLASS_NONE) {
                                p_ack->cause_code.cause_code = (sms_trans_cause_code_t)p_pkg_str[offset++];
                        }
                }
@@ -972,7 +981,7 @@ void SmsPluginMsgCodec::decodeP2PTelesvcMsg(const unsigned char *p_pkg_str, int
                decodeP2PReadAckMsg(p_pkg_str, pkg_len, &p_telesvc->data.read_ack);
                break;
        case SMS_TYPE_SUBMIT_REPORT:
-//             decodeP2PSubmitReportMsg(p_pkg_str, pkg_len, &p_telesvc->data.report);
+               /* decodeP2PSubmitReportMsg(p_pkg_str, pkg_len, &p_telesvc->data.report); */
                break;
        default:
                break;
@@ -993,280 +1002,271 @@ void SmsPluginMsgCodec::decodeP2PDeliverMsg(const unsigned char *p_pkg_str, int
        while (offset < pkg_len) {
                MSG_DEBUG("current offset = [%d] [%x]", offset, p_pkg_str[offset]);
 
-               switch (p_pkg_str[offset])
-               {
-                       case 0x00:                              // Message Identifier
-                               offset += decodeMsgId(p_pkg_str+offset, 5, &(p_del->msg_id));
-                               break;
-
-                       case 0x01:                              // User Data
-                               offset += 2;
-                               tmp_len = p_pkg_str[offset-1];
-                               memset(tmp_str, 0x00, sizeof(tmp_str));
-                               memcpy(tmp_str, p_pkg_str+offset, tmp_len);
-                               decodeUserData(tmp_str, tmp_len, &(p_del->user_data));
-                               offset += tmp_len;
-                               break;
-
-                       case 0x03:                              // Message Center Time Stamp
-                               offset+=2;
-                               offset += decodeAbsTime(p_pkg_str+offset, &(p_del->time_stamp));
-                               break;
-
-                       case 0x04:                              // Validity Period - Absolute
-                               offset+=2;
-                               p_del->val_period.format = SMS_TIME_ABSOLUTE;
-                               offset += decodeAbsTime(p_pkg_str+offset, &(p_del->val_period.time.abs_time));
-                               break;
-
-                       case 0x05:                              // Validity Period - Relative
-                               offset+=2;
-                               p_del->val_period.format = SMS_TIME_RELATIVE;
-                               p_del->val_period.time.rel_time.rel_time = (sms_relative_time_t)p_pkg_str[offset++];
-                               break;
-
-                       case 0x08:                              // Priority Indicator
-                               offset+=2;
-                               p_del->priority = (sms_priority_indicator_t)((p_pkg_str[offset++] & 0xc0) >> 6);
-                               break;
-
-                       case 0x09:                              // Privacy Indicator
-                               offset+=2;
-                               p_del->privacy = (sms_privacy_indicator_t)((p_pkg_str[offset++] & 0xc0) >> 6);
-                               break;
-
-                       case 0x0a:                              // Reply Option
-                               offset+=2;
-
-                               if(p_pkg_str[offset] & 0x80)
-                                       p_del->reply_opt.user_ack_req = true;
-                               else
-                                       p_del->reply_opt.user_ack_req = false;
-
-                               if(p_pkg_str[offset] & 0x40)
-                                       p_del->reply_opt.deliver_ack_req = true;
-                               else
-                                       p_del->reply_opt.deliver_ack_req = false;
-
-                               if(p_pkg_str[offset] & 0x20)
-                                       p_del->reply_opt.read_ack_req = true;
-                               else
-                                       p_del->reply_opt.read_ack_req = false;
-
-                               if(p_pkg_str[offset] & 0x10)
-                                       p_del->reply_opt.report_req = true;
-                               else
-                                       p_del->reply_opt.report_req = false;
-
-                               offset++;
-                               break;
-
-                       case 0x0b:                              // Number of Message
-                               offset+=2;
-                               p_del->num_msg = (((p_pkg_str[offset] & 0xf0) >> 4) * 10) + (p_pkg_str[offset] & 0x0f);
-                               offset++;
-                               break;
-
-                       case 0x0c:                              // Alert on Message Delivery
-                               offset+=2;
-                               tmp_len = p_pkg_str[offset-1];
-                               if (tmp_len > 0)
-                                       p_del->alert_priority = (sms_alert_priority_t)((p_pkg_str[offset] & 0xc0) >> 6);
-                               offset+=tmp_len;
-                               break;
-
-                       case 0x0d:                              // Language Indicator
-                               offset+=2;
-                               p_del->language = (sms_language_type_t)p_pkg_str[offset++];
-                               break;
-
-                       case 0x0e:                              // Call-Back Number
-                               offset+=2;
-                               tmp_len = p_pkg_str[offset-1];
-
-                               decodeCallBackNum(&p_pkg_str[offset], tmp_len, &(p_del->callback_number));
-
-                               offset+=tmp_len;
-                               break;
+               switch (p_pkg_str[offset]) {
+               case 0x00:
+                       /* Message Identifier */
+                       offset += decodeMsgId(p_pkg_str+offset, 5, &(p_del->msg_id));
+                       break;
+               case 0x01:
+                       /* User Data */
+                       offset += 2;
+                       tmp_len = p_pkg_str[offset-1];
+                       memset(tmp_str, 0x00, sizeof(tmp_str));
+                       memcpy(tmp_str, p_pkg_str+offset, tmp_len);
+                       decodeUserData(tmp_str, tmp_len, &(p_del->user_data));
+                       offset += tmp_len;
+                       break;
+               case 0x03:
+                       /* Message Center Time Stamp */
+                       offset += 2;
+                       offset += decodeAbsTime(p_pkg_str+offset, &(p_del->time_stamp));
+                       break;
+               case 0x04:
+                       /* Validity Period - Absolute */
+                       offset += 2;
+                       p_del->val_period.format = SMS_TIME_ABSOLUTE;
+                       offset += decodeAbsTime(p_pkg_str+offset, &(p_del->val_period.time.abs_time));
+                       break;
+               case 0x05:
+                       /* Validity Period - Relative */
+                       offset += 2;
+                       p_del->val_period.format = SMS_TIME_RELATIVE;
+                       p_del->val_period.time.rel_time.rel_time = (sms_relative_time_t)p_pkg_str[offset++];
+                       break;
+               case 0x08:
+                       /* Priority Indicator */
+                       offset += 2;
+                       p_del->priority = (sms_priority_indicator_t)((p_pkg_str[offset++] & 0xc0) >> 6);
+                       break;
+               case 0x09:
+                       /* Privacy Indicator */
+                       offset += 2;
+                       p_del->privacy = (sms_privacy_indicator_t)((p_pkg_str[offset++] & 0xc0) >> 6);
+                       break;
+               case 0x0a:
+                       /* Reply Option */
+                       offset += 2;
 
-                       case 0x0f:                              // Message Display Mode
-                               offset+=2;
+                       if (p_pkg_str[offset] & 0x80)
+                               p_del->reply_opt.user_ack_req = true;
+                       else
+                               p_del->reply_opt.user_ack_req = false;
 
-                               p_del->display_mode = (sms_display_mode_t)((p_pkg_str[offset++] & 0xc0) >> 6);
-                               break;
+                       if (p_pkg_str[offset] & 0x40)
+                               p_del->reply_opt.deliver_ack_req = true;
+                       else
+                               p_del->reply_opt.deliver_ack_req = false;
 
-                       case 0x10:                              // Multiple Encoding User Data
-                               offset+=2;
-                               tmp_len = p_pkg_str[offset-1];
+                       if (p_pkg_str[offset] & 0x20)
+                               p_del->reply_opt.read_ack_req = true;
+                       else
+                               p_del->reply_opt.read_ack_req = false;
 
+                       if (p_pkg_str[offset] & 0x10)
+                               p_del->reply_opt.report_req = true;
+                       else
+                               p_del->reply_opt.report_req = false;
 
-                               // TODO
+                       offset++;
+                       break;
+               case 0x0b:
+                       /* Number of Message */
+                       offset += 2;
+                       p_del->num_msg = (((p_pkg_str[offset] & 0xf0) >> 4) * 10) + (p_pkg_str[offset] & 0x0f);
+                       offset++;
+                       break;
+               case 0x0c:
+                       /* Alert on Message Delivery */
+                       offset += 2;
+                       tmp_len = p_pkg_str[offset-1];
+                       if (tmp_len > 0)
+                               p_del->alert_priority = (sms_alert_priority_t)((p_pkg_str[offset] & 0xc0) >> 6);
+                       offset += tmp_len;
+                       break;
+               case 0x0d:
+                       /* Language Indicator */
+                       offset += 2;
+                       p_del->language = (sms_language_type_t)p_pkg_str[offset++];
+                       break;
+               case 0x0e:
+                       /* Call-Back Number */
+                       offset += 2;
+                       tmp_len = p_pkg_str[offset-1];
 
+                       decodeCallBackNum(&p_pkg_str[offset], tmp_len, &(p_del->callback_number));
 
+                       offset += tmp_len;
+                       break;
+               case 0x0f:
+                       /* Message Display Mode */
+                       offset += 2;
 
-                               offset+=tmp_len;
-                               break;
+                       p_del->display_mode = (sms_display_mode_t)((p_pkg_str[offset++] & 0xc0) >> 6);
+                       break;
+               case 0x10:
+                       /* Multiple Encoding User Data */
+                       offset += 2;
+                       tmp_len = p_pkg_str[offset-1];
 
-                       case 0x11:                              // Message Deposit Index
-                               offset+=2;
+                       /* TODO */
 
-                               memset(&tmp_param_s, 0x00, sizeof(unsigned short));
-                               _copy_char_to_short(&tmp_param_s, p_pkg_str+offset);
-                               p_del->deposit_id = tmp_param_s;
+                       offset += tmp_len;
+                       break;
+               case 0x11:
+                       /* Message Deposit Index */
+                       offset += 2;
 
-                               offset+=2;
-                               break;
+                       memset(&tmp_param_s, 0x00, sizeof(unsigned short));
+                       _copy_char_to_short(&tmp_param_s, p_pkg_str+offset);
+                       p_del->deposit_id = tmp_param_s;
 
-                       case 0x16:                              // Enhanced VMN
-                               offset++;
-                               tmp_len = p_pkg_str[offset++];
-                               memset(tmp_str, 0x00, sizeof(tmp_str));
-                               memcpy(tmp_str, p_pkg_str+offset, tmp_len);
-                               tmp_off = 0;
+                       offset += 2;
+                       break;
+               case 0x16:
+                       /* Enhanced VMN */
+                       offset++;
+                       tmp_len = p_pkg_str[offset++];
+                       memset(tmp_str, 0x00, sizeof(tmp_str));
+                       memcpy(tmp_str, p_pkg_str+offset, tmp_len);
+                       tmp_off = 0;
 
-                               p_del->enhanced_vmn.priority = (sms_priority_indicator_t)(p_pkg_str[offset] >> 6);
-                               p_del->enhanced_vmn.password_req = p_pkg_str[offset] & 0x20 ? true : false;
-                               p_del->enhanced_vmn.setup_req = p_pkg_str[offset] & 0x10 ? true : false;
-                               p_del->enhanced_vmn.pw_change_req = p_pkg_str[offset] & 0x08 ? true : false;
-                               _shiftNBit_for_decode(tmp_str, tmp_len, 5);
+                       p_del->enhanced_vmn.priority = (sms_priority_indicator_t)(p_pkg_str[offset] >> 6);
+                       p_del->enhanced_vmn.password_req = p_pkg_str[offset] & 0x20 ? true : false;
+                       p_del->enhanced_vmn.setup_req = p_pkg_str[offset] & 0x10 ? true : false;
+                       p_del->enhanced_vmn.pw_change_req = p_pkg_str[offset] & 0x08 ? true : false;
+                       _shiftNBit_for_decode(tmp_str, tmp_len, 5);
 
-                               if(p_del->enhanced_vmn.setup_req || p_del->enhanced_vmn.pw_change_req) {
-                                       p_del->enhanced_vmn.min_pw_len = tmp_str[tmp_off] >> 4;
-                                       p_del->enhanced_vmn.max_pw_len = tmp_str[tmp_off++] & 0x0f;
-                               }
+                       if (p_del->enhanced_vmn.setup_req || p_del->enhanced_vmn.pw_change_req) {
+                               p_del->enhanced_vmn.min_pw_len = tmp_str[tmp_off] >> 4;
+                               p_del->enhanced_vmn.max_pw_len = tmp_str[tmp_off++] & 0x0f;
+                       }
 
-                               p_del->enhanced_vmn.vm_num_unheard_msg = tmp_str[tmp_off++];
-                               p_del->enhanced_vmn.vm_mailbox_alm_full = tmp_str[tmp_off] & 0x80 ? true : false;
-                               p_del->enhanced_vmn.vm_mailbox_full = tmp_str[tmp_off] & 0x40 ? true : false;
-                               p_del->enhanced_vmn.reply_allowed = tmp_str[tmp_off] & 0x20 ? true : false;
-                               p_del->enhanced_vmn.fax_included = tmp_str[tmp_off] & 0x10 ? true : false;
-                               p_del->enhanced_vmn.vm_len = ((tmp_str[tmp_off] >> 0x0f) << 8) | tmp_str[tmp_off+1];
-                               tmp_off+=2;
-                               p_del->enhanced_vmn.vm_ret_day = tmp_str[tmp_off] >> 1;
-                               _shiftNBit_for_decode(tmp_str, tmp_len, 7);
-                               p_del->enhanced_vmn.vm_msg_id = (tmp_str[tmp_off] << 8) | tmp_str[tmp_off+1];
-                               tmp_off+=2;
-                               p_del->enhanced_vmn.vm_mailbox_id = (tmp_str[tmp_off] << 8) | tmp_str[tmp_off+1];
-                               tmp_off+=2;
-
-                               p_del->enhanced_vmn.an_digit_mode = (sms_digit_mode_t)(tmp_str[tmp_off] & 0x80 ? true : false);
-                               p_del->enhanced_vmn.an_number_type = (sms_number_type_t)((tmp_str[tmp_off] & 0x70) >> 4);
-                               if (p_del->enhanced_vmn.an_digit_mode) {
-                                       p_del->enhanced_vmn.an_number_plan = (sms_number_plan_t)(tmp_str[tmp_off++] & 0x0f);
-                                       p_del->enhanced_vmn.an_num_field = tmp_str[tmp_off++];
-                                       for(int i=0; i<p_del->enhanced_vmn.an_num_field; i++) {
-                                               switch(tmp_str[tmp_off] & 0xf0)
-                                               {
-                                                       case 0x10:
-                                                       case 0x20:
-                                                       case 0x30:
-                                                       case 0x40:
-                                                       case 0x50:
-                                                       case 0x60:
-                                                       case 0x70:
-                                                       case 0x80:
-                                                       case 0x90:
-                                                               p_del->enhanced_vmn.an_char[i] = ((tmp_str[tmp_off] & 0xf0) >> 4) + '0';
-                                                               break;
-                                                       case 0xa0:
-                                                               p_del->enhanced_vmn.an_char[i] = '0';
-                                                               break;
-                                                       case 0xb0:
-                                                               p_del->enhanced_vmn.an_char[i] = '*';
-                                                               break;
-                                                       case 0xc0:
-                                                               p_del->enhanced_vmn.an_char[i] = '#';
-                                                               break;
-                                                       default:
-                                                               break;
-                                               }
-
-                                               _shiftNBit_for_decode(tmp_str, tmp_len, 4);
+                       p_del->enhanced_vmn.vm_num_unheard_msg = tmp_str[tmp_off++];
+                       p_del->enhanced_vmn.vm_mailbox_alm_full = tmp_str[tmp_off] & 0x80 ? true : false;
+                       p_del->enhanced_vmn.vm_mailbox_full = tmp_str[tmp_off] & 0x40 ? true : false;
+                       p_del->enhanced_vmn.reply_allowed = tmp_str[tmp_off] & 0x20 ? true : false;
+                       p_del->enhanced_vmn.fax_included = tmp_str[tmp_off] & 0x10 ? true : false;
+                       p_del->enhanced_vmn.vm_len = ((tmp_str[tmp_off] >> 0x0f) << 8) | tmp_str[tmp_off+1];
+                       tmp_off += 2;
+                       p_del->enhanced_vmn.vm_ret_day = tmp_str[tmp_off] >> 1;
+                       _shiftNBit_for_decode(tmp_str, tmp_len, 7);
+                       p_del->enhanced_vmn.vm_msg_id = (tmp_str[tmp_off] << 8) | tmp_str[tmp_off+1];
+                       tmp_off += 2;
+                       p_del->enhanced_vmn.vm_mailbox_id = (tmp_str[tmp_off] << 8) | tmp_str[tmp_off+1];
+                       tmp_off += 2;
+
+                       p_del->enhanced_vmn.an_digit_mode = (sms_digit_mode_t)(tmp_str[tmp_off] & 0x80 ? true : false);
+                       p_del->enhanced_vmn.an_number_type = (sms_number_type_t)((tmp_str[tmp_off] & 0x70) >> 4);
+                       if (p_del->enhanced_vmn.an_digit_mode) {
+                               p_del->enhanced_vmn.an_number_plan = (sms_number_plan_t)(tmp_str[tmp_off++] & 0x0f);
+                               p_del->enhanced_vmn.an_num_field = tmp_str[tmp_off++];
+                               for (int i=0; i<p_del->enhanced_vmn.an_num_field; i++) {
+                                       switch (tmp_str[tmp_off] & 0xf0) {
+                                       case 0x10:
+                                       case 0x20:
+                                       case 0x30:
+                                       case 0x40:
+                                       case 0x50:
+                                       case 0x60:
+                                       case 0x70:
+                                       case 0x80:
+                                       case 0x90:
+                                               p_del->enhanced_vmn.an_char[i] = ((tmp_str[tmp_off] & 0xf0) >> 4) + '0';
+                                               break;
+                                       case 0xa0:
+                                               p_del->enhanced_vmn.an_char[i] = '0';
+                                               break;
+                                       case 0xb0:
+                                               p_del->enhanced_vmn.an_char[i] = '*';
+                                               break;
+                                       case 0xc0:
+                                               p_del->enhanced_vmn.an_char[i] = '#';
+                                               break;
+                                       default:
+                                               break;
                                        }
-                               }
-                               else {
-                                       _shiftNBit_for_decode(tmp_str, tmp_len, 4);
-                                       p_del->enhanced_vmn.an_num_field = tmp_str[tmp_off++];
-                                       memset(p_del->enhanced_vmn.an_char, 0x00, sizeof(p_del->enhanced_vmn.an_char));
-                                       memcpy(p_del->enhanced_vmn.an_char, tmp_str+tmp_off, p_del->enhanced_vmn.an_num_field);
-                                       tmp_off+=p_del->enhanced_vmn.an_num_field;
-                               }
 
-                               p_del->enhanced_vmn.cli_digit_mode = (sms_digit_mode_t)(tmp_str[offset] & 0x80 ? true : false);
-                               p_del->enhanced_vmn.cli_number_type = (sms_number_type_t)(tmp_str[offset] & 0x70 >> 4);
-                               if (p_del->enhanced_vmn.cli_digit_mode) {
-                                       p_del->enhanced_vmn.cli_number_plan = (sms_number_plan_t)(tmp_str[tmp_off++] & 0x0f);
-                                       p_del->enhanced_vmn.cli_num_field = tmp_str[tmp_off++];
-                                       for(int i=0; i<p_del->enhanced_vmn.cli_num_field; i++) {
-                                               switch(tmp_str[tmp_off] & 0xf0)
-                                               {
-                                                       case 0x10:
-                                                       case 0x20:
-                                                       case 0x30:
-                                                       case 0x40:
-                                                       case 0x50:
-                                                       case 0x60:
-                                                       case 0x70:
-                                                       case 0x80:
-                                                       case 0x90:
-                                                               p_del->enhanced_vmn.cli_char[i] = ((tmp_str[tmp_off] & 0xf0) >> 4) + '0';
-                                                               break;
-                                                       case 0xa0:
-                                                               p_del->enhanced_vmn.cli_char[i] = '0';
-                                                               break;
-                                                       case 0xb0:
-                                                               p_del->enhanced_vmn.cli_char[i] = '*';
-                                                               break;
-                                                       case 0xc0:
-                                                               p_del->enhanced_vmn.cli_char[i] = '#';
-                                                               break;
-                                                       default:
-                                                               break;
-                                               }
-
-                                               _shiftNBit_for_decode(tmp_str, tmp_len, 4);
-                                       }
-                               }
-                               else {
                                        _shiftNBit_for_decode(tmp_str, tmp_len, 4);
-                                       p_del->enhanced_vmn.cli_num_field = tmp_str[tmp_off++];
-                                       memset(p_del->enhanced_vmn.cli_char, 0x00, sizeof(p_del->enhanced_vmn.cli_char));
-                                       memcpy(p_del->enhanced_vmn.cli_char, tmp_str+tmp_off, p_del->enhanced_vmn.cli_num_field);
-                                       tmp_off+=p_del->enhanced_vmn.cli_num_field;
                                }
+                       } else {
+                               _shiftNBit_for_decode(tmp_str, tmp_len, 4);
+                               p_del->enhanced_vmn.an_num_field = tmp_str[tmp_off++];
+                               memset(p_del->enhanced_vmn.an_char, 0x00, sizeof(p_del->enhanced_vmn.an_char));
+                               memcpy(p_del->enhanced_vmn.an_char, tmp_str+tmp_off, p_del->enhanced_vmn.an_num_field);
+                               tmp_off += p_del->enhanced_vmn.an_num_field;
+                       }
 
-                               offset+=tmp_len;
-                               break;
+                       p_del->enhanced_vmn.cli_digit_mode = (sms_digit_mode_t)(tmp_str[offset] & 0x80 ? true : false);
+                       p_del->enhanced_vmn.cli_number_type = (sms_number_type_t)(tmp_str[offset] & 0x70 >> 4);
+                       if (p_del->enhanced_vmn.cli_digit_mode) {
+                               p_del->enhanced_vmn.cli_number_plan = (sms_number_plan_t)(tmp_str[tmp_off++] & 0x0f);
+                               p_del->enhanced_vmn.cli_num_field = tmp_str[tmp_off++];
+                               for (int i=0; i<p_del->enhanced_vmn.cli_num_field; i++) {
+                                       switch (tmp_str[tmp_off] & 0xf0) {
+                                       case 0x10:
+                                       case 0x20:
+                                       case 0x30:
+                                       case 0x40:
+                                       case 0x50:
+                                       case 0x60:
+                                       case 0x70:
+                                       case 0x80:
+                                       case 0x90:
+                                               p_del->enhanced_vmn.cli_char[i] = ((tmp_str[tmp_off] & 0xf0) >> 4) + '0';
+                                               break;
+                                       case 0xa0:
+                                               p_del->enhanced_vmn.cli_char[i] = '0';
+                                               break;
+                                       case 0xb0:
+                                               p_del->enhanced_vmn.cli_char[i] = '*';
+                                               break;
+                                       case 0xc0:
+                                               p_del->enhanced_vmn.cli_char[i] = '#';
+                                               break;
+                                       default:
+                                               break;
+                                       }
 
-                       case 0x17:                              // Enhanced VMN Ack
-                               offset++;
-                               tmp_len = p_pkg_str[offset++];
-                               memset(tmp_str, 0x00, sizeof(tmp_str));
-                               memcpy(tmp_str, p_pkg_str+offset, tmp_len);
-                               p_del->enhanced_vmn_ack.vm_mailbox_id = tmp_str[offset] << 8 | tmp_str[offset+1];
-                               offset+=2;
-                               p_del->enhanced_vmn_ack.vm_num_unheard_msg = tmp_str[offset++];
-                               p_del->enhanced_vmn_ack.num_delete_ack = tmp_str[offset] >> 5;
-                               p_del->enhanced_vmn_ack.num_play_ack = (tmp_str[offset] & 0x1c) >> 2;
-                               _shiftNBit_for_decode(tmp_str, tmp_len, 6);
-                               for(int i=0; i<p_del->enhanced_vmn_ack.num_delete_ack; i++) {
-                                       p_del->enhanced_vmn_ack.da_vm_msg_id[i] = tmp_str[offset] << 8 | tmp_str[offset+1];
-                                       offset+=2;
-                               }
-                               for(int i=0; i<p_del->enhanced_vmn_ack.num_play_ack; i++) {
-                                       p_del->enhanced_vmn_ack.pa_vm_msg_id[i] = tmp_str[offset] << 8 | tmp_str[offset+1];
-                                       offset+=2;
+                                       _shiftNBit_for_decode(tmp_str, tmp_len, 4);
                                }
-                               break;
+                       } else {
+                               _shiftNBit_for_decode(tmp_str, tmp_len, 4);
+                               p_del->enhanced_vmn.cli_num_field = tmp_str[tmp_off++];
+                               memset(p_del->enhanced_vmn.cli_char, 0x00, sizeof(p_del->enhanced_vmn.cli_char));
+                               memcpy(p_del->enhanced_vmn.cli_char, tmp_str+tmp_off, p_del->enhanced_vmn.cli_num_field);
+                               tmp_off += p_del->enhanced_vmn.cli_num_field;
+                       }
 
-                       default:
-                               /* skip unrecognized sub parameters */
-                               offset++;
-                               tmp_len = p_pkg_str[offset++];
-                               offset += tmp_len;
-                               break;
+                       offset += tmp_len;
+                       break;
+               case 0x17:
+                       /* Enhanced VMN Ack */
+                       offset++;
+                       tmp_len = p_pkg_str[offset++];
+                       memset(tmp_str, 0x00, sizeof(tmp_str));
+                       memcpy(tmp_str, p_pkg_str+offset, tmp_len);
+                       p_del->enhanced_vmn_ack.vm_mailbox_id = tmp_str[offset] << 8 | tmp_str[offset+1];
+                       offset += 2;
+                       p_del->enhanced_vmn_ack.vm_num_unheard_msg = tmp_str[offset++];
+                       p_del->enhanced_vmn_ack.num_delete_ack = tmp_str[offset] >> 5;
+                       p_del->enhanced_vmn_ack.num_play_ack = (tmp_str[offset] & 0x1c) >> 2;
+                       _shiftNBit_for_decode(tmp_str, tmp_len, 6);
+                       for (int i=0; i<p_del->enhanced_vmn_ack.num_delete_ack; i++) {
+                               p_del->enhanced_vmn_ack.da_vm_msg_id[i] = tmp_str[offset] << 8 | tmp_str[offset+1];
+                               offset += 2;
+                       }
+                       for (int i=0; i<p_del->enhanced_vmn_ack.num_play_ack; i++) {
+                               p_del->enhanced_vmn_ack.pa_vm_msg_id[i] = tmp_str[offset] << 8 | tmp_str[offset+1];
+                               offset += 2;
+                       }
+                       break;
+               default:
+                       /* skip unrecognized sub parameters */
+                       offset++;
+                       tmp_len = p_pkg_str[offset++];
+                       offset += tmp_len;
+                       break;
                }
-
        }
 
        MSG_END();
@@ -1280,11 +1280,11 @@ void SmsPluginMsgCodec::decodeP2PSubmitMsg(const unsigned char *p_pkg_str, int p
        unsigned char tmp_str[pkg_len+1];
 
        while (offset < pkg_len) {
-               if(p_pkg_str[offset] == 0x00) {                                 // Message Identifier
+               if (p_pkg_str[offset] == 0x00) {
+                       /* Message Identifier */
                        offset += decodeMsgId(p_pkg_str+offset, 5, &(p_sub->msg_id));
-               }
-
-               else if(p_pkg_str[offset] == 0x01) {                                    // User Data
+               } else if (p_pkg_str[offset] == 0x01) {
+                       /* User Data */
                        offset += 2;
                        tmp_len = p_pkg_str[offset-1];
                        memset(tmp_str, 0x00, sizeof(tmp_str));
@@ -1293,112 +1293,96 @@ void SmsPluginMsgCodec::decodeP2PSubmitMsg(const unsigned char *p_pkg_str, int p
                        decodeUserData(tmp_str, tmp_len, &(p_sub->user_data));
 
                        offset += tmp_len;
-               }
-
-               else if(p_pkg_str[offset] == 0x04) {                            // Validity Period - Absolute
-                       offset+=2;
+               } else if (p_pkg_str[offset] == 0x04) {
+                       /* Validity Period - Absolute */
+                       offset += 2;
                        p_sub->val_period.format = SMS_TIME_ABSOLUTE;
                        offset += decodeAbsTime(p_pkg_str+offset, &(p_sub->val_period.time.abs_time));
-               }
-
-               else if(p_pkg_str[offset] == 0x05) {                            // Validity Period - Relative
-                       offset+=2;
+               } else if (p_pkg_str[offset] == 0x05) {
+                       /* Validity Period - Relative */
+                       offset += 2;
                        p_sub->val_period.format = SMS_TIME_RELATIVE;
                        p_sub->val_period.time.rel_time.rel_time = (sms_relative_time_t)p_pkg_str[offset++];
-               }
-
-               else if(p_pkg_str[offset] == 0x06) {                            // Deferred Delivery Time - Absolute
-                       offset+=2;
+               } else if (p_pkg_str[offset] == 0x06) {
+                       /* Deferred Delivery Time - Absolute */
+                       offset += 2;
                        p_sub->defer_val_period.format = SMS_TIME_ABSOLUTE;
                        offset += decodeAbsTime(p_pkg_str+offset, &(p_sub->defer_val_period.time.abs_time));
-               }
-
-               else if(p_pkg_str[offset] == 0x07) {                            // Deferred Delivery Time - Relative
-                       offset+=2;
+               } else if (p_pkg_str[offset] == 0x07) {
+                       /* Deferred Delivery Time - Relative */
+                       offset += 2;
                        p_sub->defer_val_period.format = SMS_TIME_RELATIVE;
                        p_sub->defer_val_period.time.rel_time.rel_time = (sms_relative_time_t)p_pkg_str[offset++];
-               }
-
-               else if(p_pkg_str[offset] == 0x08) {                            // Priority indicator
-                       offset+=2;
+               } else if (p_pkg_str[offset] == 0x08) {
+                       /* Priority indicator */
+                       offset += 2;
                        p_sub->priority = (sms_priority_indicator_t)((p_pkg_str[offset++] & 0xc0) >> 6);
-               }
-
-               else if(p_pkg_str[offset] == 0x09) {                            // Privacy indicator
-                       offset+=2;
+               } else if (p_pkg_str[offset] == 0x09) {
+                       /* Privacy indicator */
+                       offset += 2;
                        p_sub->privacy = (sms_privacy_indicator_t)((p_pkg_str[offset++] & 0xc0) >> 6);
-               }
-
-               else if(p_pkg_str[offset] == 0x0a) {                            // Reply Option
-                       offset+=2;
+               } else if (p_pkg_str[offset] == 0x0a) {
+                       /* Reply Option */
+                       offset += 2;
 
-                       if(p_pkg_str[offset] & 0x80)
+                       if (p_pkg_str[offset] & 0x80)
                                p_sub->reply_opt.user_ack_req = true;
                        else
                                p_sub->reply_opt.user_ack_req = false;
 
-                       if(p_pkg_str[offset] & 0x40)
+                       if (p_pkg_str[offset] & 0x40)
                                p_sub->reply_opt.deliver_ack_req = true;
                        else
                                p_sub->reply_opt.deliver_ack_req = false;
 
-                       if(p_pkg_str[offset] & 0x20)
+                       if (p_pkg_str[offset] & 0x20)
                                p_sub->reply_opt.read_ack_req = true;
                        else
                                p_sub->reply_opt.read_ack_req = false;
 
-                       if(p_pkg_str[offset] & 0x10)
+                       if (p_pkg_str[offset] & 0x10)
                                p_sub->reply_opt.report_req = true;
                        else
                                p_sub->reply_opt.report_req = false;
 
                        offset++;
-               }
-
-               else if(p_pkg_str[offset] == 0x0c) {                            // Alert on Message Delivery
-                       offset+=2;
+               } else if (p_pkg_str[offset] == 0x0c) {
+                       /* Alert on Message Delivery */
+                       offset += 2;
 
                        p_sub->alert_priority = (sms_alert_priority_t)((p_pkg_str[offset++] & 0xc0) >> 6);
-               }
-
-               else if(p_pkg_str[offset] == 0x0d) {                            // Language Indicator
-                       offset+=2;
+               } else if (p_pkg_str[offset] == 0x0d) {
+                       /* Language Indicator */
+                       offset += 2;
 
                        p_sub->language = (sms_language_type_t)p_pkg_str[offset++];
-               }
-
-               else if(p_pkg_str[offset] == 0x0e) {                            // Call-Back Number
-                       offset+=2;
+               } else if (p_pkg_str[offset] == 0x0e) {
+                       /* Call-Back Number */
+                       offset += 2;
                        tmp_len = p_pkg_str[offset-1];
 
                        decodeCallBackNum(&p_pkg_str[offset], tmp_len, &(p_sub->callback_number));
 
-                       offset+=tmp_len;
-               }
-
-               else if(p_pkg_str[offset] == 0x10) {                            // Multiple Encoding User Data
-                       offset+=2;
+                       offset += tmp_len;
+               } else if (p_pkg_str[offset] == 0x10) {
+                       /* Multiple Encoding User Data */
+                       offset += 2;
                        tmp_len = p_pkg_str[offset-1];
 
+                       /* TODO */
 
-                       // TODO
-
-
-
-                       offset+=tmp_len;
-               }
-
-               else if(p_pkg_str[offset] == 0x11) {                            // Message Deposit Index
-                       offset+=2;
+                       offset += tmp_len;
+               } else if (p_pkg_str[offset] == 0x11) {
+                       /* Message Deposit Index */
+                       offset += 2;
 
                        memset(&tmp_param_s, 0x00, sizeof(unsigned short));
                        _copy_char_to_short(&tmp_param_s, p_pkg_str+offset);
                        p_sub->deposit_id = tmp_param_s;
 
-                       offset+=2;
+                       offset += 2;
                }
        }
-
 }
 
 
@@ -1411,11 +1395,11 @@ void SmsPluginMsgCodec::decodeP2PUserAckMsg(const unsigned char *p_pkg_str, int
        unsigned char tmp_str[pkg_len+1];
 
        while (offset < pkg_len) {
-               if(p_pkg_str[offset] == 0x00) {                                 // Message Identifier
+               if (p_pkg_str[offset] == 0x00) {
+                       /* Message Identifier */
                        offset += decodeMsgId(p_pkg_str+offset, 5, &(p_user_ack->msg_id));
-               }
-
-               else if(p_pkg_str[offset] == 0x01) {                                    // User Data
+               } else if (p_pkg_str[offset] == 0x01) {
+                       /* User Data */
                        offset += 2;
                        tmp_len = p_pkg_str[offset-1];
                        memset(tmp_str, 0x00, sizeof(tmp_str));
@@ -1424,38 +1408,31 @@ void SmsPluginMsgCodec::decodeP2PUserAckMsg(const unsigned char *p_pkg_str, int
                        decodeUserData(tmp_str, tmp_len, &(p_user_ack->user_data));
 
                        offset += tmp_len;
-               }
-
-               else if(p_pkg_str[offset] == 0x02) {                            // User Response Code
+               } else if (p_pkg_str[offset] == 0x02) {
+                       /* User Response Code */
                        offset += 2;
                        p_user_ack->resp_code = p_pkg_str[offset++];
-               }
-
-               else if(p_pkg_str[offset] == 0x03) {                            // Message Center Time Stamp
-                       offset+=2;
+               } else if (p_pkg_str[offset] == 0x03) {
+                       /* Message Center Time Stamp */
+                       offset += 2;
                        offset += decodeAbsTime(p_pkg_str+offset, &(p_user_ack->time_stamp));
-               }
-
-               else if(p_pkg_str[offset] == 0x10) {                            // Multiple Encoding User Data
-                       offset+=2;
+               } else if (p_pkg_str[offset] == 0x10) {
+                       /* Multiple Encoding User Data */
+                       offset += 2;
                        tmp_len = p_pkg_str[offset-1];
 
+                       /* TODO */
 
-                       // TODO
-
-
-
-                       offset+=tmp_len;
-               }
-
-               else if(p_pkg_str[offset] == 0x11) {                            // Message Deposit Index
-                       offset+=2;
+                       offset += tmp_len;
+               } else if (p_pkg_str[offset] == 0x11) {
+                       /* Message Deposit Index */
+                       offset += 2;
 
                        memset(&tmp_param_s, 0x00, sizeof(unsigned short));
                        _copy_char_to_short(&tmp_param_s, p_pkg_str+offset);
                        p_user_ack->deposit_id = tmp_param_s;
 
-                       offset+=2;
+                       offset += 2;
                }
        }
 
@@ -1472,11 +1449,11 @@ void SmsPluginMsgCodec::decodeP2PReadAckMsg(const unsigned char *p_pkg_str, int
        unsigned char tmp_str[pkg_len+1];
 
        while (offset < pkg_len) {
-               if(p_pkg_str[offset] == 0x00) {                                 // Message Identifier
+               if (p_pkg_str[offset] == 0x00) {
+                       /* Message Identifier */
                        offset += decodeMsgId(p_pkg_str+offset, 5, &(p_read_ack->msg_id));
-               }
-
-               else if(p_pkg_str[offset] == 0x01) {                                    // User Data
+               } else if (p_pkg_str[offset] == 0x01) {
+                       /* User Data */
                        offset += 2;
                        tmp_len = p_pkg_str[offset-1];
                        memset(tmp_str, 0x00, sizeof(tmp_str));
@@ -1485,33 +1462,27 @@ void SmsPluginMsgCodec::decodeP2PReadAckMsg(const unsigned char *p_pkg_str, int
                        decodeUserData(tmp_str, tmp_len, &(p_read_ack->user_data));
 
                        offset += tmp_len;
-               }
-
-               else if(p_pkg_str[offset] == 0x03) {                            // Message Center Time Stamp
-                       offset+=2;
+               } else if (p_pkg_str[offset] == 0x03) {
+                       /* Message Center Time Stamp */
+                       offset += 2;
                        offset += decodeAbsTime(p_pkg_str+offset, &(p_read_ack->time_stamp));
-               }
-
-               else if(p_pkg_str[offset] == 0x10) {                            // Multiple Encoding User Data
-                       offset+=2;
+               } else if (p_pkg_str[offset] == 0x10) {
+                       /* Multiple Encoding User Data */
+                       offset += 2;
                        tmp_len = p_pkg_str[offset-1];
 
+                       /* TODO */
 
-                       // TODO
-
-
-
-                       offset+=tmp_len;
-               }
-
-               else if(p_pkg_str[offset] == 0x11) {                            // Message Deposit Index
-                       offset+=2;
+                       offset += tmp_len;
+               } else if (p_pkg_str[offset] == 0x11) {
+                       /* Message Deposit Index */
+                       offset += 2;
 
                        memset(&tmp_param_s, 0x00, sizeof(unsigned short));
                        _copy_char_to_short(&tmp_param_s, p_pkg_str+offset);
                        p_read_ack->deposit_id = tmp_param_s;
 
-                       offset+=2;
+                       offset += 2;
                }
        }
 
@@ -1528,11 +1499,12 @@ void SmsPluginMsgCodec::decodeP2PSubmitReportMsg(const unsigned char *p_pkg_str,
 
        while (offset < pkg_len) {
                switch (p_pkg_str[offset]) {
-               case 0x00:                                      // Message Identifier
+               case 0x00:
+                       /* Message Identifier */
                        offset += decodeMsgId(p_pkg_str+offset, 5, &(p_sub_report->msg_id));
                        break;
-
-               case 0x01:                                      // User Data
+               case 0x01:
+                       /* User Data */
                        offset += 2;
                        tmp_len = p_pkg_str[offset-1];
                        memset(tmp_str, 0x00, sizeof(tmp_str));
@@ -1540,29 +1512,25 @@ void SmsPluginMsgCodec::decodeP2PSubmitReportMsg(const unsigned char *p_pkg_str,
                        decodeUserData(tmp_str, tmp_len, &(p_sub_report->user_data));
                        offset += tmp_len;
                        break;
-
-               case 0x0d:                                      // Language Indicator
-                       offset+=2;
+               case 0x0d:
+                       /* Language Indicator */
+                       offset += 2;
                        p_sub_report->language = (sms_language_type_t)p_pkg_str[offset++];
                        break;
-
-               case 0x10:                                      // Multiple Encoding User Data
-                       offset+=2;
+               case 0x10:
+                       /* Multiple Encoding User Data */
+                       offset += 2;
                        tmp_len = p_pkg_str[offset-1];
 
+                       /* TODO */
 
-                       // TODO
-
-
-
-                       offset+=tmp_len;
+                       offset += tmp_len;
                        break;
-
-               case 0x15:                                      // TP-Failure Cause
+               case 0x15:
+                       /* TP-Failure Cause */
                        offset += 2;
                        p_sub_report->tp_fail_cause = p_pkg_str[offset++];
                        break;
-
                default:
                        break;
                }
@@ -1579,13 +1547,14 @@ void SmsPluginMsgCodec::decodeP2PDeliveryAckMsg(const unsigned char *p_pkg_str,
        int offset = 0, tmp_len;
        unsigned char tmp_str[pkg_len+1];
 
-       while(offset < pkg_len) {
+       while (offset < pkg_len) {
                switch (p_pkg_str[offset]) {
-               case 0x00:                                      // Message Identifier
+               case 0x00:
+                       /* Message Identifier */
                        offset += decodeMsgId(p_pkg_str+offset, 5, &(p_del_ack->msg_id));
                        break;
-
-               case 0x01:                                      // User Data
+               case 0x01:
+                       /* User Data */
                        offset += 2;
                        tmp_len = p_pkg_str[offset-1];
                        memset(tmp_str, 0x00, sizeof(tmp_str));
@@ -1595,29 +1564,25 @@ void SmsPluginMsgCodec::decodeP2PDeliveryAckMsg(const unsigned char *p_pkg_str,
 
                        offset += tmp_len;
                        break;
-
-               case 0x03:                                      // Message Center Time Stamp
-                       offset+=2;
+               case 0x03:
+                       /* Message Center Time Stamp */
+                       offset += 2;
                        offset += decodeAbsTime(p_pkg_str+offset, &(p_del_ack->time_stamp));
                        break;
-
-               case 0x10:                                      // Multiple Encoding User Data
-                       offset+=2;
+               case 0x10:
+                       /* Multiple Encoding User Data */
+                       offset += 2;
                        tmp_len = p_pkg_str[offset-1];
 
+                       /* TODO */
 
-                       // TODO
-
-
-
-                       offset+=tmp_len;
+                       offset += tmp_len;
                        break;
-
-               case 0x14:                                      // Message Status
-                       offset+=2;
+               case 0x14:
+                       /* Message Status */
+                       offset += 2;
                        p_del_ack->msg_status = (sms_status_code_t)p_pkg_str[offset++];
                        break;
-
                default:
                        break;
                }
@@ -1635,84 +1600,72 @@ void SmsPluginMsgCodec::decodeCBBearerData(const unsigned char *p_pkg_str, int p
        unsigned char tmp_str[pkg_len+1];
 
        while (offset < pkg_len) {
-               if(p_pkg_str[offset] == 0x00) {                                 // Message Identifier
+               if (p_pkg_str[offset] == 0x00) {
+                       /* Message Identifier */
                        p_telesvc->type = SMS_TYPE_DELIVER;
                        offset += decodeMsgId(p_pkg_str+offset, 5, &(p_telesvc->data.deliver.msg_id));
-               }
-
-               else if(p_pkg_str[offset] == 0x01) {                                    // User Data
+               } else if (p_pkg_str[offset] == 0x01) {
+                       /* User Data */
                        offset += 2;
                        tmp_len = p_pkg_str[offset-1];
                        memset(tmp_str, 0x00, sizeof(tmp_str));
                        memcpy(tmp_str, p_pkg_str+offset, tmp_len);
 
-                       if(isCMAS)
+                       if (isCMAS)
                                decodeCMASData(tmp_str, tmp_len, &(p_telesvc->data.deliver.cmas_data));
                        else
                                decodeUserData(tmp_str, tmp_len, &(p_telesvc->data.deliver.user_data));
 
                        offset += tmp_len;
-               }
-
-               else if(p_pkg_str[offset] == 0x03) {                            // Message Center Time Stamp
+               } else if (p_pkg_str[offset] == 0x03) {
+                       /* Message Center Time Stamp */
                        offset += 2;
                        offset += decodeAbsTime(p_pkg_str+offset, &(p_telesvc->data.deliver.time_stamp));
-               }
-
-               else if(p_pkg_str[offset] == 0x04) {                            // Validity Period - Absolute
+               } else if (p_pkg_str[offset] == 0x04) {
+                       /* Validity Period - Absolute */
                        offset += 2;
                        p_telesvc->data.deliver.val_period.format = SMS_TIME_ABSOLUTE;
                        offset += decodeAbsTime(p_pkg_str+offset, &(p_telesvc->data.deliver.val_period.time.abs_time));
-               }
-
-               else if(p_pkg_str[offset] == 0x05) {                            // Validity Period - Relative
-                       offset+=2;
+               } else if (p_pkg_str[offset] == 0x05) {
+                       /* Validity Period - Relative */
+                       offset += 2;
                        p_telesvc->data.deliver.val_period.format = SMS_TIME_RELATIVE;
                        p_telesvc->data.deliver.val_period.time.rel_time.rel_time = (sms_relative_time_t)p_pkg_str[offset++];
-               }
-
-               else if(p_pkg_str[offset] == 0x08) {                            // Priority indicator
-                       offset+=2;
+               } else if (p_pkg_str[offset] == 0x08) {
+                       /* Priority indicator */
+                       offset += 2;
                        p_telesvc->data.deliver.priority = (sms_priority_indicator_t)((p_pkg_str[offset++] & 0xc0) >> 6);
-               }
-
-               else if(p_pkg_str[offset] == 0x0c) {                            // Alert on Message Delivery
-                       offset+=2;
+               } else if (p_pkg_str[offset] == 0x0c) {
+                       /* Alert on Message Delivery */
+                       offset += 2;
 
                        p_telesvc->data.deliver.alert_priority = (sms_alert_priority_t)((p_pkg_str[offset++] & 0xc0) >> 6);
-               }
-
-               else if(p_pkg_str[offset] == 0x0d) {                            // Language Indicator
-                       offset+=2;
+               } else if (p_pkg_str[offset] == 0x0d) {
+                       /* Language Indicator */
+                       offset += 2;
 
                        p_telesvc->data.deliver.language = (sms_language_type_t)p_pkg_str[offset++];
-               }
-
-               else if(p_pkg_str[offset] == 0x0e) {                            // Call-Back Number
-                       offset+=2;
+               } else if (p_pkg_str[offset] == 0x0e) {
+                       /* Call-Back Number */
+                       offset += 2;
                        tmp_len = p_pkg_str[offset-1];
 
                        decodeCallBackNum(&p_pkg_str[offset], tmp_len, &(p_telesvc->data.deliver.callback_number));
 
-                       offset+=tmp_len;
-               }
-
-               else if(p_pkg_str[offset] == 0x0f) {                            // Message Display Mode
-                       offset+=2;
+                       offset += tmp_len;
+               } else if (p_pkg_str[offset] == 0x0f) {
+                       /* Message Display Mode */
+                       offset += 2;
 
                        p_telesvc->data.deliver.display_mode = (sms_display_mode_t)((p_pkg_str[offset++] & 0xc0) >> 6);
-               }
-
-               else if(p_pkg_str[offset] == 0x10) {                            // Multiple Encoding User Data
-                       offset+=2;
+               } else if (p_pkg_str[offset] == 0x10) {
+                       /* Multiple Encoding User Data */
+                       offset += 2;
                        tmp_len = p_pkg_str[offset-1];
 
+                       /* TODO */
 
-                       // TODO
-
-
-
-                       offset+=tmp_len;
+                       offset += tmp_len;
                }
        }
 
@@ -1725,38 +1678,38 @@ int SmsPluginMsgCodec::decodeTeleId(const unsigned char *p_pkg_str, int pkg_len,
        int offset = 0;
        unsigned short tmp_param_s;
 
-       offset+=2;
+       offset += 2;
 
     _copy_char_to_short(&tmp_param_s, &p_pkg_str[offset]);
 
-       switch(tmp_param_s) {
-               case SMS_TRANS_TELESVC_CMT_91:
-                       *tele_id = SMS_TRANS_TELESVC_CMT_91;
-                       break;
-               case SMS_TRANS_TELESVC_CPT_95:
-                       *tele_id = SMS_TRANS_TELESVC_CPT_95;
-                       break;
-               case SMS_TRANS_TELESVC_CMT_95:
-                       *tele_id = SMS_TRANS_TELESVC_CMT_95;
-                       break;
-               case SMS_TRANS_TELESVC_VMN_95:
-                       *tele_id = SMS_TRANS_TELESVC_VMN_95;
-                       break;
-               case SMS_TRANS_TELESVC_WAP:
-                       *tele_id = SMS_TRANS_TELESVC_WAP;
-                       break;
-               case SMS_TRANS_TELESVC_WEMT:
-                       *tele_id = SMS_TRANS_TELESVC_WEMT;
-                       break;
-               case SMS_TRANS_TELESVC_SCPT:
-                       *tele_id = SMS_TRANS_TELESVC_SCPT;
-                       break;
-               case SMS_TRANS_TELESVC_CATPT:
-                       *tele_id = SMS_TRANS_TELESVC_CATPT;
-                       break;
-               default:
-                       *tele_id = SMS_TRANS_TELESVC_RESERVED;
-                       break;
+       switch (tmp_param_s) {
+       case SMS_TRANS_TELESVC_CMT_91:
+               *tele_id = SMS_TRANS_TELESVC_CMT_91;
+               break;
+       case SMS_TRANS_TELESVC_CPT_95:
+               *tele_id = SMS_TRANS_TELESVC_CPT_95;
+               break;
+       case SMS_TRANS_TELESVC_CMT_95:
+               *tele_id = SMS_TRANS_TELESVC_CMT_95;
+               break;
+       case SMS_TRANS_TELESVC_VMN_95:
+               *tele_id = SMS_TRANS_TELESVC_VMN_95;
+               break;
+       case SMS_TRANS_TELESVC_WAP:
+               *tele_id = SMS_TRANS_TELESVC_WAP;
+               break;
+       case SMS_TRANS_TELESVC_WEMT:
+               *tele_id = SMS_TRANS_TELESVC_WEMT;
+               break;
+       case SMS_TRANS_TELESVC_SCPT:
+               *tele_id = SMS_TRANS_TELESVC_SCPT;
+               break;
+       case SMS_TRANS_TELESVC_CATPT:
+               *tele_id = SMS_TRANS_TELESVC_CATPT;
+               break;
+       default:
+               *tele_id = SMS_TRANS_TELESVC_RESERVED;
+               break;
        }
 
        return offset+2;
@@ -1768,15 +1721,14 @@ int SmsPluginMsgCodec::decodeSvcCtg(const unsigned char *p_pkg_str, int pkg_len,
        int offset = 0;
        unsigned short tmp_param_s;
 
-       offset+=2;
+       offset += 2;
 
        _copy_char_to_short(&tmp_param_s, &p_pkg_str[offset]);
-       if((tmp_param_s >= SMS_TRANS_SVC_CTG_UNKNOWN && tmp_param_s <= SMS_TRANS_SVC_CTG_KDDI_CORP_MAX1)
+       if ((tmp_param_s >= SMS_TRANS_SVC_CTG_UNKNOWN && tmp_param_s <= SMS_TRANS_SVC_CTG_KDDI_CORP_MAX1)
                || (tmp_param_s >= SMS_TRANS_SVC_CTG_KDDI_CORP_MIN2 && tmp_param_s <= SMS_TRANS_SVC_CTG_KDDI_CORP_MAX2)
                || (tmp_param_s >= SMS_TRANS_SVC_CTG_KDDI_CORP_MIN3 && tmp_param_s <= SMS_TRANS_SVC_CTG_KDDI_CORP_MAX3)) {
                *svc_ctg = (sms_trans_svc_ctg_t)tmp_param_s;
-       }
-       else {
+       } else {
                *svc_ctg = SMS_TRANS_SVC_CTG_RESERVED;
        }
 
@@ -1796,121 +1748,122 @@ int SmsPluginMsgCodec::decodeAddress(const unsigned char *p_pkg_str, int pkg_len
 
        offset += (tmp_len+1);
 
-       if(tmp_str[0] & 0x80)
+       if (tmp_str[0] & 0x80)
                addr->digit_mode = true;
        else
                addr->digit_mode = false;
 
-       if(tmp_str[0] & 0x40)
+       if (tmp_str[0] & 0x40)
                addr->number_mode = true;
        else
                addr->number_mode = false;
 
        _shiftNBit_for_decode(tmp_str, tmp_len, 2);
 
-       if(addr->digit_mode == false) {
+       if (addr->digit_mode == false) {
                addr->addr_len = tmp_str[0];
 
                memset(addr->szData, 0x00, sizeof(addr->szData));
 
-               for(unsigned int i = 0; i < addr->addr_len; i++) {
-                       switch(tmp_str[1] & 0xf0) {
-                               case 0x10:
-                               case 0x20:
-                               case 0x30:
-                               case 0x40:
-                               case 0x50:
-                               case 0x60:
-                               case 0x70:
-                               case 0x80:
-                               case 0x90:
-                                       addr->szData[i] = ((tmp_str[1] & 0xf0) >> 4) + '0';
-                                       break;
-                               case 0x00://sprint issue
-                               case 0xa0:
-                                       addr->szData[i] = '0';
-                                       break;
-                               case 0xb0:
-                                       addr->szData[i] = '*';
-                                       break;
-                               case 0xc0:
-                                       addr->szData[i] = '#';
-                                       break;
-                               default:
-                                       break;
+               for (unsigned int i = 0; i < addr->addr_len; i++) {
+                       switch (tmp_str[1] & 0xf0) {
+                       case 0x10:
+                       case 0x20:
+                       case 0x30:
+                       case 0x40:
+                       case 0x50:
+                       case 0x60:
+                       case 0x70:
+                       case 0x80:
+                       case 0x90:
+                               addr->szData[i] = ((tmp_str[1] & 0xf0) >> 4) + '0';
+                               break;
+                       case 0x00:
+                               /* sprint issue */
+                       case 0xa0:
+                               addr->szData[i] = '0';
+                               break;
+                       case 0xb0:
+                               addr->szData[i] = '*';
+                               break;
+                       case 0xc0:
+                               addr->szData[i] = '#';
+                               break;
+                       default:
+                               break;
                        }
 
                        _shiftNBit_for_decode(tmp_str, tmp_len, 4);
                }
-       }
-       else if(addr->digit_mode == true) {
-               if(addr->number_mode == false) {                                                // digit mode = 1, number mode = 0
-                       switch(tmp_str[0] & 0xe0) {
-                               case 0x00:
-                                       addr->number_type = SMS_NUMBER_TYPE_UNKNOWN;
-                                       break;
-                               case 0x20:
-                                       addr->number_type = SMS_NUMBER_TYPE_INTERNATIONAL;
-                                       break;
-                               case 0x40:
-                                       addr->number_type = SMS_NUMBER_TYPE_NATIONAL;
-                                       break;
-                               case 0x60:
-                                       addr->number_type = SMS_NUMBER_TYPE_NETWORK_SPECIFIC;
-                                       break;
-                               case 0x80:
-                                       addr->number_type = SMS_NUMBER_TYPE_SUBSCRIBER;
-                                       break;
-                               case 0xa0:
-                                       addr->number_type = SMS_NUMBER_TYPE_RESERVED_5;
-                                       break;
-                               case 0xc0:
-                                       addr->number_type = SMS_NUMBER_TYPE_ABBREVIATED;
-                                       break;
-                               case 0xe0:
-                                       addr->number_type = SMS_NUMBER_TYPE_RESERVED_7;
-                                       break;
+       } else if (addr->digit_mode == true) {
+               if (addr->number_mode == false) {
+                       /* digit mode = 1, number mode = 0 */
+                       switch (tmp_str[0] & 0xe0) {
+                       case 0x00:
+                               addr->number_type = SMS_NUMBER_TYPE_UNKNOWN;
+                               break;
+                       case 0x20:
+                               addr->number_type = SMS_NUMBER_TYPE_INTERNATIONAL;
+                               break;
+                       case 0x40:
+                               addr->number_type = SMS_NUMBER_TYPE_NATIONAL;
+                               break;
+                       case 0x60:
+                               addr->number_type = SMS_NUMBER_TYPE_NETWORK_SPECIFIC;
+                               break;
+                       case 0x80:
+                               addr->number_type = SMS_NUMBER_TYPE_SUBSCRIBER;
+                               break;
+                       case 0xa0:
+                               addr->number_type = SMS_NUMBER_TYPE_RESERVED_5;
+                               break;
+                       case 0xc0:
+                               addr->number_type = SMS_NUMBER_TYPE_ABBREVIATED;
+                               break;
+                       case 0xe0:
+                               addr->number_type = SMS_NUMBER_TYPE_RESERVED_7;
+                               break;
                        }
 
                        _shiftNBit_for_decode(tmp_str, tmp_len, 3);
 
-                       switch(tmp_str[0] & 0xf0) {
-                               case 0x00:
-                                       addr->number_plan = SMS_NPI_UNKNOWN;
-                                       break;
-                               case 0x10:
-                                       addr->number_plan = SMS_NPI_ISDN;
-                                       break;
-                               case 0x30:
-                                       addr->number_plan = SMS_NPI_DATA;
-                                       break;
-                               case 0x40:
-                                       addr->number_plan = SMS_NPI_TELEX;
-                                       break;
-                               case 0x90:
-                                       addr->number_plan = SMS_NPI_PRIVATE;
-                                       break;
-                               default:
-                                       addr->number_plan = SMS_NPI_RESERVED;
-                                       break;
+                       switch (tmp_str[0] & 0xf0) {
+                       case 0x00:
+                               addr->number_plan = SMS_NPI_UNKNOWN;
+                               break;
+                       case 0x10:
+                               addr->number_plan = SMS_NPI_ISDN;
+                               break;
+                       case 0x30:
+                               addr->number_plan = SMS_NPI_DATA;
+                               break;
+                       case 0x40:
+                               addr->number_plan = SMS_NPI_TELEX;
+                               break;
+                       case 0x90:
+                               addr->number_plan = SMS_NPI_PRIVATE;
+                               break;
+                       default:
+                               addr->number_plan = SMS_NPI_RESERVED;
+                               break;
                        }
 
                        _shiftNBit_for_decode(tmp_str, tmp_len, 4);
-               }
-               else if(addr->number_mode == true) {                                            // digit mode = 1, number mode = 1
-                       switch(tmp_str[0] & 0xe0) {
-                               case 0x00:
-                                       addr->number_type = SMS_TRANS_DNET_UNKNOWN;
-                                       break;
-                               case 0x20:
-                                       addr->number_type = SMS_TRANS_DNET_INTERNET_PROTOCOL;
-                                       break;
-                               case 0x40:
-                                       addr->number_type = SMS_TRANS_DNET_INTERNET_MAIL_ADDR;
-                                       break;
-                               default:
-                                       addr->number_type = SMS_TRANS_DNET_RESERVED;
-                                       break;
+               } else if (addr->number_mode == true) {
+                       /* digit mode = 1, number mode = 1 */
+                       switch (tmp_str[0] & 0xe0) {
+                       case 0x00:
+                               addr->number_type = SMS_TRANS_DNET_UNKNOWN;
+                               break;
+                       case 0x20:
+                               addr->number_type = SMS_TRANS_DNET_INTERNET_PROTOCOL;
+                               break;
+                       case 0x40:
+                               addr->number_type = SMS_TRANS_DNET_INTERNET_MAIL_ADDR;
+                               break;
+                       default:
+                               addr->number_type = SMS_TRANS_DNET_RESERVED;
+                               break;
                        }
 
                        _shiftNBit_for_decode(tmp_str, tmp_len, 3);
@@ -1937,19 +1890,19 @@ int SmsPluginMsgCodec::decodeSubAddress(const unsigned char *p_pkg_str, int pkg_
 
        offset += (tmp_len+1);
 
-       switch(tmp_str[0] & 0xe0) {
-               case 0x00:
-                       sub_addr->type = SMS_TRANS_SUB_ADDR_NSAP;
-                       break;
-               case 0x20:
-                       sub_addr->type = SMS_TRANS_SUB_ADDR_USER;
-                       break;
-               default:
-                       sub_addr->type = SMS_TRANS_SUB_ADDR_RESERVED;
-                       break;
+       switch (tmp_str[0] & 0xe0) {
+       case 0x00:
+               sub_addr->type = SMS_TRANS_SUB_ADDR_NSAP;
+               break;
+       case 0x20:
+               sub_addr->type = SMS_TRANS_SUB_ADDR_USER;
+               break;
+       default:
+               sub_addr->type = SMS_TRANS_SUB_ADDR_RESERVED;
+               break;
        }
 
-       if(tmp_str[0] & 0x10)
+       if (tmp_str[0] & 0x10)
                sub_addr->odd = true;
        else
                sub_addr->odd = false;
@@ -1977,12 +1930,12 @@ int SmsPluginMsgCodec::decodeMsgId(const unsigned char *p_pkg_str, int pkg_len,
        _copy_char_to_short(&tmp_param_s, tmp_str);
 
        p_msg_id->msg_id = tmp_param_s;
-       if(tmp_str[2] & 0x80)
+       if (tmp_str[2] & 0x80)
                p_msg_id->header_ind = true;
        else
                p_msg_id->header_ind = false;
 
-       offset+=5;
+       offset += 5;
 
        return offset;
 }
@@ -1993,39 +1946,39 @@ void SmsPluginMsgCodec::decodeCallBackNum(const unsigned char *p_pkg_str, int pk
        int offset = 0;
        unsigned char tmp_str[pkg_len+1];
 
-       if(p_pkg_str[offset] & 0x80) {
+       if (p_pkg_str[offset] & 0x80) {
                p_callback->digit_mode = true;
 
-               switch(p_pkg_str[offset] & 0x70) {
-                       case 0x00:
-                               p_callback->number_type = SMS_NUMBER_TYPE_UNKNOWN;
-                               break;
-                       case 0x10:
-                               p_callback->number_type = SMS_NUMBER_TYPE_INTERNATIONAL;
-                               break;
-                       case 0x20:
-                               p_callback->number_type = SMS_NUMBER_TYPE_NATIONAL;
-                               break;
-                       case 0x30:
-                               p_callback->number_type = SMS_NUMBER_TYPE_NETWORK_SPECIFIC;
-                               break;
-                       case 0x40:
-                               p_callback->number_type = SMS_NUMBER_TYPE_SUBSCRIBER;
-                               break;
-                       case 0x50:
-                               p_callback->number_type = SMS_NUMBER_TYPE_RESERVED_5;
-                               break;
-                       case 0x60:
-                               p_callback->number_type = SMS_NUMBER_TYPE_ABBREVIATED;
-                               break;
-                       case 0x70:
-                               p_callback->number_type = SMS_NUMBER_TYPE_RESERVED_7;
-                               break;
-                       default:
-                               break;
+               switch (p_pkg_str[offset] & 0x70) {
+               case 0x00:
+                       p_callback->number_type = SMS_NUMBER_TYPE_UNKNOWN;
+                       break;
+               case 0x10:
+                       p_callback->number_type = SMS_NUMBER_TYPE_INTERNATIONAL;
+                       break;
+               case 0x20:
+                       p_callback->number_type = SMS_NUMBER_TYPE_NATIONAL;
+                       break;
+               case 0x30:
+                       p_callback->number_type = SMS_NUMBER_TYPE_NETWORK_SPECIFIC;
+                       break;
+               case 0x40:
+                       p_callback->number_type = SMS_NUMBER_TYPE_SUBSCRIBER;
+                       break;
+               case 0x50:
+                       p_callback->number_type = SMS_NUMBER_TYPE_RESERVED_5;
+                       break;
+               case 0x60:
+                       p_callback->number_type = SMS_NUMBER_TYPE_ABBREVIATED;
+                       break;
+               case 0x70:
+                       p_callback->number_type = SMS_NUMBER_TYPE_RESERVED_7;
+                       break;
+               default:
+                       break;
                }
 
-               switch(p_pkg_str[offset++] & 0x0f) {
+               switch (p_pkg_str[offset++] & 0x0f) {
                case 0x00:
                        p_callback->number_plan = SMS_NPI_UNKNOWN;
                        break;
@@ -2052,15 +2005,13 @@ void SmsPluginMsgCodec::decodeCallBackNum(const unsigned char *p_pkg_str, int pk
 
                if (p_callback->number_type == SMS_NUMBER_TYPE_INTERNATIONAL) {
                        memcpy(&(p_callback->szData[1]), p_pkg_str+offset, p_callback->addr_len);
-                       if(p_callback->szData[1] != '\0') {
+                       if (p_callback->szData[1] != '\0') {
                                p_callback->szData[0] = '+';
                        }
-               }
-               else {
+               } else {
                        memcpy(p_callback->szData, p_pkg_str+offset, p_callback->addr_len);
                }
-       }
-       else {
+       } else {
                p_callback->digit_mode = false;
 
                memset(tmp_str, 0x00, sizeof(tmp_str));
@@ -2072,30 +2023,30 @@ void SmsPluginMsgCodec::decodeCallBackNum(const unsigned char *p_pkg_str, int pk
 
                memset(p_callback->szData, 0x00, sizeof(p_callback->szData));
 
-               for(unsigned int i = 0; i < p_callback->addr_len; i++) {
-                       switch(tmp_str[1] & 0xf0) {
-                               case 0x10:
-                               case 0x20:
-                               case 0x30:
-                               case 0x40:
-                               case 0x50:
-                               case 0x60:
-                               case 0x70:
-                               case 0x80:
-                               case 0x90:
-                                       p_callback->szData[i] = ((tmp_str[1] & 0xf0) >> 4) + '0';
-                                       break;
-                               case 0xa0:
-                                       p_callback->szData[i] = '0';
-                                       break;
-                               case 0xb0:
-                                       p_callback->szData[i] = '*';
-                                       break;
-                               case 0xc0:
-                                       p_callback->szData[i] = '#';
-                                       break;
-                               default :
-                                       break;
+               for (unsigned int i = 0; i < p_callback->addr_len; i++) {
+                       switch (tmp_str[1] & 0xf0) {
+                       case 0x10:
+                       case 0x20:
+                       case 0x30:
+                       case 0x40:
+                       case 0x50:
+                       case 0x60:
+                       case 0x70:
+                       case 0x80:
+                       case 0x90:
+                               p_callback->szData[i] = ((tmp_str[1] & 0xf0) >> 4) + '0';
+                               break;
+                       case 0xa0:
+                               p_callback->szData[i] = '0';
+                               break;
+                       case 0xb0:
+                               p_callback->szData[i] = '*';
+                               break;
+                       case 0xc0:
+                               p_callback->szData[i] = '#';
+                               break;
+                       default :
+                               break;
                        }
 
                        _shiftNBit_for_decode(tmp_str, pkg_len, 4);
@@ -2141,7 +2092,7 @@ int SmsPluginMsgCodec::encodeUserData(const unsigned char* src, unsigned char *d
        for (i = 0; i < src_size; i++) {
                shift = j % 7;
                dest[j++] = (tmp[i] << shift) + (tmp[i+1] >> (7-shift));
-               if(shift == 6) {
+               if (shift == 6) {
                        i++;
                }
        }
@@ -2165,8 +2116,7 @@ void SmsPluginMsgCodec::decodeCMASData(unsigned char *p_pkg_str, int pkg_len, sm
        if ((p_pkg_str[offset] & 0xf8) != 0x00) {
                MSG_ERR("Wrong Encode Type = [%d]!! The type must be 0", (p_pkg_str[offset]&0xf8)>>3);
                return;
-       }
-       else {
+       } else {
                _shiftNBit_for_decode(p_pkg_str, pkg_len, 5);
 
                offset++;
@@ -2186,77 +2136,76 @@ void SmsPluginMsgCodec::decodeCMASData(unsigned char *p_pkg_str, int pkg_len, sm
                                memset(tmp_str, 0x00, sizeof(tmp_str));
                                memcpy(tmp_str, p_pkg_str+offset, tmp_len);
 
-                               switch(tmp_str[0] & 0xf8) {
-                                       case 0x00:
-                                               p_cmas->encode_type = SMS_ENCODE_OCTET;
-                                               break;
-                                       case 0x08:
-                                               p_cmas->encode_type = SMS_ENCODE_EPM;
-                                               break;
-                                       case 0x10:
-                                               p_cmas->encode_type = SMS_ENCODE_7BIT_ASCII;
-                                               break;
-                                       case 0x18:
-                                               p_cmas->encode_type = SMS_ENCODE_IA5;
-                                               break;
-                                       case 0x20:
-                                               p_cmas->encode_type = SMS_ENCODE_UNICODE;
-                                               break;
-                                       case 0x28:
-                                               p_cmas->encode_type = SMS_ENCODE_SHIFT_JIS;
-                                               break;
-                                       case 0x30:
-                                               p_cmas->encode_type = SMS_ENCODE_KOREAN;
-                                               break;
-                                       case 0x38:
-                                               p_cmas->encode_type = SMS_ENCODE_LATIN_HEBREW;
-                                               break;
-                                       case 0x40:
-                                               p_cmas->encode_type = SMS_ENCODE_LATIN;
-                                               break;
-                                       case 0x48:
-                                               p_cmas->encode_type = SMS_ENCODE_GSM7BIT;
-                                               break;
-                                       case 0x50:
-                                               p_cmas->encode_type = SMS_ENCODE_GSMDCS;
-                                               break;
-                                       case 0x80:              // reserved value, but SKT use this value for KSC5601
-                                               p_cmas->encode_type = SMS_ENCODE_EUCKR;
-                                               break;
-                                       default :
-                                               p_cmas->encode_type = SMS_ENCODE_RESERVED;
-                                               break;
+                               switch (tmp_str[0] & 0xf8) {
+                               case 0x00:
+                                       p_cmas->encode_type = SMS_ENCODE_OCTET;
+                                       break;
+                               case 0x08:
+                                       p_cmas->encode_type = SMS_ENCODE_EPM;
+                                       break;
+                               case 0x10:
+                                       p_cmas->encode_type = SMS_ENCODE_7BIT_ASCII;
+                                       break;
+                               case 0x18:
+                                       p_cmas->encode_type = SMS_ENCODE_IA5;
+                                       break;
+                               case 0x20:
+                                       p_cmas->encode_type = SMS_ENCODE_UNICODE;
+                                       break;
+                               case 0x28:
+                                       p_cmas->encode_type = SMS_ENCODE_SHIFT_JIS;
+                                       break;
+                               case 0x30:
+                                       p_cmas->encode_type = SMS_ENCODE_KOREAN;
+                                       break;
+                               case 0x38:
+                                       p_cmas->encode_type = SMS_ENCODE_LATIN_HEBREW;
+                                       break;
+                               case 0x40:
+                                       p_cmas->encode_type = SMS_ENCODE_LATIN;
+                                       break;
+                               case 0x48:
+                                       p_cmas->encode_type = SMS_ENCODE_GSM7BIT;
+                                       break;
+                               case 0x50:
+                                       p_cmas->encode_type = SMS_ENCODE_GSMDCS;
+                                       break;
+                               case 0x80:
+                                       /* reserved value, but SKT use this value for KSC5601 */
+                                       p_cmas->encode_type = SMS_ENCODE_EUCKR;
+                                       break;
+                               default :
+                                       p_cmas->encode_type = SMS_ENCODE_RESERVED;
+                                       break;
                                }
                                _shiftNBit_for_decode(tmp_str, tmp_len, 5);
 
-                               switch(p_cmas->encode_type) {
-                                       case SMS_ENCODE_7BIT_ASCII:
-                                       case SMS_ENCODE_IA5:
-                                       case SMS_ENCODE_GSM7BIT:
-                                               memset(p_cmas->alert_text, 0x00, sizeof(p_cmas->alert_text));
-                                               p_cmas->data_len = (tmp_len*8-5) / 7;
-                                               for(unsigned int i = 0; i < p_cmas->data_len; i++) {
-                                                       p_cmas->alert_text[i] = tmp_str[0] >> 1;
-                                                       _shiftNBit_for_decode(tmp_str, tmp_len, 7);
-                                               }
-                                               break;
-                                       case SMS_ENCODE_EPM:
-                                               break;
-                                       case SMS_ENCODE_GSMDCS:
-                                               break;
-                                       default:
-                                               p_cmas->data_len = tmp_len - 1;
-                                               memset(p_cmas->alert_text, 0x00, sizeof(p_cmas->alert_text));
-                                               memcpy(p_cmas->alert_text, tmp_str+offset, tmp_len-1);
-                                               break;
+                               switch (p_cmas->encode_type) {
+                               case SMS_ENCODE_7BIT_ASCII:
+                               case SMS_ENCODE_IA5:
+                               case SMS_ENCODE_GSM7BIT:
+                                       memset(p_cmas->alert_text, 0x00, sizeof(p_cmas->alert_text));
+                                       p_cmas->data_len = (tmp_len*8-5) / 7;
+                                       for (unsigned int i = 0; i < p_cmas->data_len; i++) {
+                                               p_cmas->alert_text[i] = tmp_str[0] >> 1;
+                                               _shiftNBit_for_decode(tmp_str, tmp_len, 7);
+                                       }
+                                       break;
+                               case SMS_ENCODE_EPM:
+                                       break;
+                               case SMS_ENCODE_GSMDCS:
+                                       break;
+                               default:
+                                       p_cmas->data_len = tmp_len - 1;
+                                       memset(p_cmas->alert_text, 0x00, sizeof(p_cmas->alert_text));
+                                       memcpy(p_cmas->alert_text, tmp_str+offset, tmp_len-1);
+                                       break;
                                }
 
-                               offset+=tmp_len;
-                       }
-
-                       else if (p_pkg_str[offset] == 0x01) {
+                               offset += tmp_len;
+                       } else if (p_pkg_str[offset] == 0x01) {
                                MSG_DEBUG("Type 1 Decode!");
-                               offset+=2;
+                               offset += 2;
                                tmp_len = p_pkg_str[offset-1];
                                MSG_DEBUG("Type 1 length = [%d]", tmp_len);
                                p_cmas->category = (sms_cmae_category_t)p_pkg_str[offset++];
@@ -2264,15 +2213,13 @@ void SmsPluginMsgCodec::decodeCMASData(unsigned char *p_pkg_str, int pkg_len, sm
                                p_cmas->severity = (sms_cmae_severity_t)(p_pkg_str[offset] >> 4);
                                p_cmas->urgency = (sms_cmae_urgency_t)(p_pkg_str[offset++] & 0x0f);
                                p_cmas->certainty = (sms_cmae_certainty_t)(p_pkg_str[offset++] >> 4);
-                       }
-
-                       else if (p_pkg_str[offset] == 0x02) {
+                       } else if (p_pkg_str[offset] == 0x02) {
                                MSG_DEBUG("Type 2 Decode!");
-                               offset+=2;
+                               offset += 2;
                                tmp_len = p_pkg_str[offset-1];
                                MSG_DEBUG("Type 2 length = [%d]", tmp_len);
                                _copy_char_to_short(&(p_cmas->id), p_pkg_str+offset);
-                               offset+=2;
+                               offset += 2;
                                p_cmas->alert_handle = (sms_cmae_alert_handle_t)p_pkg_str[offset++];
                                offset += decodeAbsTime(p_pkg_str+offset, &(p_cmas->expires));
                                p_cmas->language = (sms_language_type_t)p_pkg_str[offset++];
@@ -2288,95 +2235,95 @@ void SmsPluginMsgCodec::decodeCMASData(unsigned char *p_pkg_str, int pkg_len, sm
 
 void SmsPluginMsgCodec::decodeUserData(unsigned char *p_pkg_str, int pkg_len, sms_telesvc_userdata_s *p_user)
 {
-       switch(p_pkg_str[0] & 0xf8) {
-               case 0x00:
-                       p_user->encode_type = SMS_ENCODE_OCTET;
-                       break;
-               case 0x08:
-                       p_user->encode_type = SMS_ENCODE_EPM;
-                       break;
-               case 0x10:
-                       p_user->encode_type = SMS_ENCODE_7BIT_ASCII;
-                       break;
-               case 0x18:
-                       p_user->encode_type = SMS_ENCODE_IA5;
-                       break;
-               case 0x20:
-                       p_user->encode_type = SMS_ENCODE_UNICODE;
-                       break;
-               case 0x28:
-                       p_user->encode_type = SMS_ENCODE_SHIFT_JIS;
-                       break;
-               case 0x30:
-                       p_user->encode_type = SMS_ENCODE_KOREAN;
-                       break;
-               case 0x38:
-                       p_user->encode_type = SMS_ENCODE_LATIN_HEBREW;
-                       break;
-               case 0x40:
-                       p_user->encode_type = SMS_ENCODE_LATIN;
-                       break;
-               case 0x48:
-                       p_user->encode_type = SMS_ENCODE_GSM7BIT;
-                       break;
-               case 0x50:
-                       p_user->encode_type = SMS_ENCODE_GSMDCS;
-                       break;
-               case 0x80:              // reserved value, but SKT use this value for KSC5601
-                       p_user->encode_type = SMS_ENCODE_EUCKR;
-                       break;
-               default :
-                       p_user->encode_type = SMS_ENCODE_RESERVED;
-                       break;
+       switch (p_pkg_str[0] & 0xf8) {
+       case 0x00:
+               p_user->encode_type = SMS_ENCODE_OCTET;
+               break;
+       case 0x08:
+               p_user->encode_type = SMS_ENCODE_EPM;
+               break;
+       case 0x10:
+               p_user->encode_type = SMS_ENCODE_7BIT_ASCII;
+               break;
+       case 0x18:
+               p_user->encode_type = SMS_ENCODE_IA5;
+               break;
+       case 0x20:
+               p_user->encode_type = SMS_ENCODE_UNICODE;
+               break;
+       case 0x28:
+               p_user->encode_type = SMS_ENCODE_SHIFT_JIS;
+               break;
+       case 0x30:
+               p_user->encode_type = SMS_ENCODE_KOREAN;
+               break;
+       case 0x38:
+               p_user->encode_type = SMS_ENCODE_LATIN_HEBREW;
+               break;
+       case 0x40:
+               p_user->encode_type = SMS_ENCODE_LATIN;
+               break;
+       case 0x48:
+               p_user->encode_type = SMS_ENCODE_GSM7BIT;
+               break;
+       case 0x50:
+               p_user->encode_type = SMS_ENCODE_GSMDCS;
+               break;
+       case 0x80:
+               /* reserved value, but SKT use this value for KSC5601 */
+               p_user->encode_type = SMS_ENCODE_EUCKR;
+               break;
+       default :
+               p_user->encode_type = SMS_ENCODE_RESERVED;
+               break;
        }
 
        _shiftNBit_for_decode(p_pkg_str, pkg_len, 5);
 
-       if(p_user->encode_type == SMS_ENCODE_EPM || p_user->encode_type == SMS_ENCODE_GSMDCS) {
+       if (p_user->encode_type == SMS_ENCODE_EPM || p_user->encode_type == SMS_ENCODE_GSMDCS) {
                p_user->msg_type = p_pkg_str[0];
                _shiftNBit_for_decode(p_pkg_str, pkg_len, 8);
        }
 
        p_user->data_len = p_pkg_str[0];
-       switch(p_user->encode_type) {
-               case SMS_ENCODE_7BIT_ASCII:
-                       memset(p_user->user_data, 0x00, sizeof(p_user->user_data));
-                       for(unsigned int i = 0; i < p_user->data_len; i++) {
-                               p_user->user_data[i] = p_pkg_str[1] >> 1;
-                               _shiftNBit_for_decode(p_pkg_str, pkg_len, 7);
-                       }
-                       break;
-               case SMS_ENCODE_IA5:
-               case SMS_ENCODE_GSM7BIT:
-                       memset(p_user->user_data, 0x00, sizeof(p_user->user_data));
-                       UnpackGSM7bitData(&(p_pkg_str[1]), p_user->user_data, p_user->data_len);
-                       break;
-               case SMS_ENCODE_EPM:
-                       break;
-               case SMS_ENCODE_GSMDCS:
-                       break;
-               case SMS_ENCODE_UNICODE:
-                       p_user->data_len*=2;
-                       memset(p_user->user_data, 0x00, sizeof(p_user->user_data));
-                       memcpy(p_user->user_data, p_pkg_str+1, p_user->data_len);
-                       break;
-               default:
-                       memset(p_user->user_data, 0x00, sizeof(p_user->user_data));
-                       memcpy(p_user->user_data, p_pkg_str+1, p_user->data_len);
-                       break;
+       switch (p_user->encode_type) {
+       case SMS_ENCODE_7BIT_ASCII:
+       case SMS_ENCODE_IA5:
+               memset(p_user->user_data, 0x00, sizeof(p_user->user_data));
+               for (unsigned int i = 0; i < p_user->data_len; i++) {
+                       p_user->user_data[i] = p_pkg_str[1] >> 1;
+                       _shiftNBit_for_decode(p_pkg_str, pkg_len, 7);
+               }
+               break;
+       case SMS_ENCODE_GSM7BIT:
+               memset(p_user->user_data, 0x00, sizeof(p_user->user_data));
+               UnpackGSM7bitData(&(p_pkg_str[1]), p_user->user_data, p_user->data_len);
+               break;
+       case SMS_ENCODE_EPM:
+               break;
+       case SMS_ENCODE_GSMDCS:
+               break;
+       case SMS_ENCODE_UNICODE:
+               p_user->data_len*=2;
+               memset(p_user->user_data, 0x00, sizeof(p_user->user_data));
+               memcpy(p_user->user_data, p_pkg_str+1, p_user->data_len);
+               break;
+       default:
+               memset(p_user->user_data, 0x00, sizeof(p_user->user_data));
+               memcpy(p_user->user_data, p_pkg_str+1, p_user->data_len);
+               break;
        }
-
 }
 
 
 sms_message_type_t SmsPluginMsgCodec::findMsgType(const unsigned char *p_pkg_str, int pkg_len)
 {
        int offset = 0;
-       while(offset < pkg_len) {
-               if(p_pkg_str[offset] == 0x00) {
+       while (offset < pkg_len) {
+               if (p_pkg_str[offset] == 0x00) {
                        return (sms_message_type_t)((p_pkg_str[offset+2]&0xf0)>>4);
                }
-               offset+=(p_pkg_str[offset+1]+2);
+               offset += (p_pkg_str[offset+1]+2);
        }
 
        return SMS_TYPE_MAX_VALUE;
index a21d9b9..37112bd 100755 (executable)
@@ -1,17 +1,17 @@
 /*
-* Copyright 2012-2013  Samsung Electronics Co., Ltd
-*
-* Licensed under the Flora License, Version 1.1 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*    http://floralicense.org/license/
-*
-* 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.
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
 */
 
 #include <stdio.h>
 #include "MsgCppTypes.h"
 #include "MsgContact.h"
 #include "MsgGconfWrapper.h"
-
-#ifndef MSG_NOTIFICATION_NOT_SUPPORTED
 #include "MsgNotificationWrapper.h"
-#endif
 
 #include "SmsCdmaPluginTransport.h"
 #include "SmsCdmaPluginStorage.h"
@@ -44,7 +41,7 @@ SmsPluginEventHandler* SmsPluginEventHandler::pInstance = NULL;
 
 SmsPluginEventHandler::SmsPluginEventHandler()
 {
-       /**  Initialize global parameters */
+       /*  Initialize global parameters */
        memset(&listener, 0x00, sizeof(MSG_PLUGIN_LISTENER_S));
        memset(&sentInfo, 0x00, sizeof(sms_sent_info_s));
        devStatus = false;
@@ -65,6 +62,7 @@ SmsPluginEventHandler* SmsPluginEventHandler::instance()
        return pInstance;
 }
 
+
 void SmsPluginEventHandler::registerListener(MSG_PLUGIN_LISTENER_S *pListener)
 {
        listener = *pListener;
@@ -75,7 +73,7 @@ void SmsPluginEventHandler::convertTpduToMsginfo(sms_trans_p2p_msg_s *p_p2p_msg,
 {
        MSG_BEGIN();
 
-       // Address
+       /* Address */
        if (p_p2p_msg->telesvc_msg.data.deliver.callback_number.szData[0] != '\0')
                p_msg_info->nAddressCnt = 2;
        else
@@ -85,14 +83,14 @@ void SmsPluginEventHandler::convertTpduToMsginfo(sms_trans_p2p_msg_s *p_p2p_msg,
 
        if (p_msg_info->addressList) {
                switch (p_msg_info->nAddressCnt) {
-                       case 2 :
-                               memset(p_msg_info->addressList[1].addressVal, 0x00, MAX_ADDRESS_VAL_LEN+1);
-                       case 1 :
-                               memset(p_msg_info->addressList[0].addressVal, 0x00, MAX_ADDRESS_VAL_LEN+1);
-                               break;
-                       default :
-                               MSG_ERR("Invalid case");
-                               memset(p_msg_info->addressList[0].addressVal, 0x00, MAX_ADDRESS_VAL_LEN+1);
+               case 2:
+                       memset(p_msg_info->addressList[1].addressVal, 0x00, MAX_ADDRESS_VAL_LEN+1);
+               case 1:
+                       memset(p_msg_info->addressList[0].addressVal, 0x00, MAX_ADDRESS_VAL_LEN+1);
+                       break;
+               default:
+                       MSG_ERR("Invalid case");
+                       memset(p_msg_info->addressList[0].addressVal, 0x00, MAX_ADDRESS_VAL_LEN+1);
                }
        }
 
@@ -103,24 +101,23 @@ void SmsPluginEventHandler::convertTpduToMsginfo(sms_trans_p2p_msg_s *p_p2p_msg,
        }
 
 
-       // Teleservice message
-       switch(p_p2p_msg->telesvc_msg.type)
-       {
-               case SMS_TYPE_DELIVER :
-                       p_msg_info->msgType.subType = MSG_NORMAL_SMS;
-                       p_msg_info->folderId = MSG_INBOX_ID;
-
-                       convertDeliverMsgToMsgInfo(&(p_p2p_msg->telesvc_msg.data.deliver), p_msg_info);
-                       break;
-               case SMS_TYPE_DELIVERY_ACK :
-                       convertAckMsgToMsgInfo(&(p_p2p_msg->telesvc_msg.data.delivery_ack), p_msg_info);
-                       break;
-               case SMS_TYPE_SUBMIT_REPORT :
-                       convertReportMsgToMsgInfo(&(p_p2p_msg->telesvc_msg.data.report), p_msg_info);
-                       break;
-               default :
-                       MSG_DEBUG("No matching type = [%d]", p_p2p_msg->telesvc_msg.type);
-                       break;
+       /* Teleservice message */
+       switch (p_p2p_msg->telesvc_msg.type) {
+       case SMS_TYPE_DELIVER:
+       p_msg_info->msgType.subType = MSG_NORMAL_SMS;
+       p_msg_info->folderId = MSG_INBOX_ID;
+
+       convertDeliverMsgToMsgInfo(&(p_p2p_msg->telesvc_msg.data.deliver), p_msg_info);
+       break;
+       case SMS_TYPE_DELIVERY_ACK:
+               convertAckMsgToMsgInfo(&(p_p2p_msg->telesvc_msg.data.delivery_ack), p_msg_info);
+               break;
+       case SMS_TYPE_SUBMIT_REPORT:
+               convertReportMsgToMsgInfo(&(p_p2p_msg->telesvc_msg.data.report), p_msg_info);
+               break;
+       default:
+               MSG_DEBUG("No matching type = [%d]", p_p2p_msg->telesvc_msg.type);
+               break;
        }
 
        MSG_END();
@@ -131,7 +128,7 @@ void SmsPluginEventHandler::convertTpduToMsginfo(sms_trans_broadcast_msg_s *p_cb
 {
        MSG_BEGIN();
 
-       // Address
+       /* Address */
        p_msg_info->nAddressCnt = 0;
        p_msg_info->addressList = (MSG_ADDRESS_INFO_S *)new char[sizeof(MSG_ADDRESS_INFO_S)];
 
@@ -139,8 +136,8 @@ void SmsPluginEventHandler::convertTpduToMsginfo(sms_trans_broadcast_msg_s *p_cb
                memset(p_msg_info->addressList[0].addressVal, 0x00, MAX_ADDRESS_VAL_LEN+1);
        }
 
-       // Bearer Data
-       if(p_cb_msg->telesvc_msg.type == SMS_TYPE_DELIVER) {
+       /* Bearer Data */
+       if (p_cb_msg->telesvc_msg.type == SMS_TYPE_DELIVER) {
                p_msg_info->msgType.subType = MSG_CB_SMS;
                p_msg_info->folderId = MSG_CBMSGBOX_ID;
 
@@ -148,8 +145,7 @@ void SmsPluginEventHandler::convertTpduToMsginfo(sms_trans_broadcast_msg_s *p_cb
                        convertCMASMsgToMsgInfo(&(p_cb_msg->telesvc_msg.data.deliver), p_msg_info);
                else
                        convertDeliverMsgToMsgInfo(&(p_cb_msg->telesvc_msg.data.deliver), p_msg_info);
-       }
-       else {
+       } else {
                MSG_DEBUG("No matching type = [%d]", p_cb_msg->telesvc_msg.type);
        }
 
@@ -189,7 +185,8 @@ void SmsPluginEventHandler::convertCMASMsgToMsgInfo(sms_telesvc_deliver_s *p_del
        p_msg_info->direction = MSG_DIRECTION_TYPE_MT;
        p_msg_info->bTextSms = true;
 
-       if (p_deliver->callback_number.szData[0] != '\0') {                     // If callback number is in received pdu, replace the address value.
+       if (p_deliver->callback_number.szData[0] != '\0') {
+               /* If callback number is in received pdu, replace the address value. */
                memset(p_msg_info->addressList[0].addressVal, 0x00, MAX_ADDRESS_VAL_LEN+1);
                p_msg_info->nAddressCnt = 1;
                p_msg_info->addressList[0].addressType = MSG_ADDRESS_TYPE_UNKNOWN;
@@ -200,7 +197,7 @@ void SmsPluginEventHandler::convertCMASMsgToMsgInfo(sms_telesvc_deliver_s *p_del
        time_t rawtime = 0;
        p_msg_info->storageId = MSG_STORAGE_PHONE;
 
-#if 0 // Save Timestamp of message center.
+#if 0 /* Save Timestamp of message center. */
                char displayTime[32];
                struct tm * timeTM;
 
@@ -273,28 +270,24 @@ void SmsPluginEventHandler::convertCMASMsgToMsgInfo(sms_telesvc_deliver_s *p_del
                p_msg_info->dataSize = strlen(p_msg_info->msgData);
                return;
        } else {
-               if(p_msg_info->encodeType == MSG_ENCODE_UCS2) {
+               if (p_msg_info->encodeType == MSG_ENCODE_UCS2) {
                        MSG_DEBUG("Encode Type = UCS2");
                        MsgTextConvert *textCvt = MsgTextConvert::instance();
                        p_msg_info->dataSize = textCvt->convertUCS2ToUTF8((unsigned char*)&p_msg_info->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)&p_deliver->cmas_data.alert_text, p_deliver->cmas_data.data_len);
-               }
-               else if(p_msg_info->encodeType == MSG_ENCODE_EUCKR) {
+               } else if (p_msg_info->encodeType == MSG_ENCODE_EUCKR) {
                        MSG_DEBUG("Encode Type = EUCKR");
                        MsgTextConvert *textCvt = MsgTextConvert::instance();
                        p_msg_info->dataSize = textCvt->convertEUCKRToUTF8((unsigned char*)&p_msg_info->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)&p_deliver->cmas_data.alert_text, p_deliver->cmas_data.data_len);
-               }
-               else if(p_msg_info->encodeType == MSG_ENCODE_SHIFT_JIS) {
+               } else if (p_msg_info->encodeType == MSG_ENCODE_SHIFT_JIS) {
                        MSG_DEBUG("Encode Type = Shift-JIS");
                        MsgTextConvert *textCvt = MsgTextConvert::instance();
                        p_msg_info->dataSize = textCvt->convertSHIFTJISToUTF8((unsigned char*)&p_msg_info->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)&p_deliver->cmas_data.alert_text, p_deliver->cmas_data.data_len);
-               }
-               else if(p_msg_info->encodeType == MSG_ENCODE_GSM7BIT) {
+               } else if (p_msg_info->encodeType == MSG_ENCODE_GSM7BIT) {
                        MSG_DEBUG("Encode Type = GSM7BIT");
                        MSG_LANG_INFO_S langinfo = {0,};
                        MsgTextConvert *textCvt = MsgTextConvert::instance();
                        p_msg_info->dataSize = textCvt->convertGSM7bitToUTF8((unsigned char*)&p_msg_info->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)&p_deliver->cmas_data.alert_text, p_deliver->cmas_data.data_len, &langinfo);
-               }
-               else {
+               } else {
                        snprintf(p_msg_info->msgText, sizeof(p_msg_info->msgText), "%s", p_deliver->cmas_data.alert_text);
                        p_msg_info->dataSize = p_deliver->cmas_data.data_len;
                }
@@ -309,10 +302,10 @@ void SmsPluginEventHandler::convertDeliverMsgToMsgInfo(sms_telesvc_deliver_s *p_
        MSG_BEGIN();
 
        p_msg_info->msgType.mainType = MSG_SMS_TYPE;
-//     p_msg_info->msgType.subType = MSG_NORMAL_SMS;
-
-//     p_msg_info->folderId = MSG_INBOX_ID;
-
+       /*
+       p_msg_info->msgType.subType = MSG_NORMAL_SMS;
+       p_msg_info->folderId = MSG_INBOX_ID;
+       */
        p_msg_info->msgType.classType = MSG_CLASS_NONE;
        p_msg_info->networkStatus = MSG_NETWORK_RECEIVED;
        p_msg_info->bRead = false;
@@ -320,7 +313,8 @@ void SmsPluginEventHandler::convertDeliverMsgToMsgInfo(sms_telesvc_deliver_s *p_
        p_msg_info->direction = MSG_DIRECTION_TYPE_MT;
        p_msg_info->bTextSms = true;
 
-       if (p_deliver->callback_number.szData[0] != '\0') {                     // If callback number is in received pdu, replace the address value.
+       if (p_deliver->callback_number.szData[0] != '\0') {
+               /* If callback number is in received pdu, replace the address value. */
                memset(p_msg_info->addressList[1].addressVal, 0x00, MAX_ADDRESS_VAL_LEN+1);
                p_msg_info->addressList[1].addressType = MSG_ADDRESS_TYPE_UNKNOWN;
                memcpy(p_msg_info->addressList[1].addressVal, p_deliver->callback_number.szData, MAX_ADDRESS_VAL_LEN);
@@ -330,7 +324,7 @@ void SmsPluginEventHandler::convertDeliverMsgToMsgInfo(sms_telesvc_deliver_s *p_
        time_t rawtime = 0;
        p_msg_info->storageId = MSG_STORAGE_PHONE;
 
-#if 0 // Save Timestamp of message center.
+#if 0 /* Save Timestamp of message center. */
                char displayTime[32];
                struct tm * timeTM;
 
@@ -403,28 +397,24 @@ void SmsPluginEventHandler::convertDeliverMsgToMsgInfo(sms_telesvc_deliver_s *p_
                p_msg_info->dataSize = strlen(p_msg_info->msgData);
                return;
        } else {
-               if(p_msg_info->encodeType == MSG_ENCODE_UCS2) {
+               if (p_msg_info->encodeType == MSG_ENCODE_UCS2) {
                        MSG_DEBUG("Encode Type = UCS2");
                        MsgTextConvert *textCvt = MsgTextConvert::instance();
                        p_msg_info->dataSize = textCvt->convertUCS2ToUTF8((unsigned char*)&p_msg_info->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)&p_deliver->user_data.user_data, p_deliver->user_data.data_len);
-               }
-               else if(p_msg_info->encodeType == MSG_ENCODE_EUCKR) {
+               } else if (p_msg_info->encodeType == MSG_ENCODE_EUCKR) {
                        MSG_DEBUG("Encode Type = EUCKR");
                        MsgTextConvert *textCvt = MsgTextConvert::instance();
                        p_msg_info->dataSize = textCvt->convertEUCKRToUTF8((unsigned char*)&p_msg_info->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)&p_deliver->user_data.user_data, p_deliver->user_data.data_len);
-               }
-               else if(p_msg_info->encodeType == MSG_ENCODE_SHIFT_JIS) {
+               } else if (p_msg_info->encodeType == MSG_ENCODE_SHIFT_JIS) {
                        MSG_DEBUG("Encode Type = Shift-JIS");
                        MsgTextConvert *textCvt = MsgTextConvert::instance();
                        p_msg_info->dataSize = textCvt->convertSHIFTJISToUTF8((unsigned char*)&p_msg_info->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)&p_deliver->user_data.user_data, p_deliver->user_data.data_len);
-               }
-               else if(p_msg_info->encodeType == MSG_ENCODE_GSM7BIT) {
+               } else if (p_msg_info->encodeType == MSG_ENCODE_GSM7BIT) {
                        MSG_DEBUG("Encode Type = GSM7BIT");
                        MSG_LANG_INFO_S langinfo = {0,};
                        MsgTextConvert *textCvt = MsgTextConvert::instance();
                        p_msg_info->dataSize = textCvt->convertGSM7bitToUTF8((unsigned char*)&p_msg_info->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)&p_deliver->user_data.user_data, p_deliver->user_data.data_len, &langinfo);
-               }
-               else {
+               } else {
                        snprintf(p_msg_info->msgText, sizeof(p_msg_info->msgText), "%s", p_deliver->user_data.user_data);
                        p_msg_info->dataSize = p_deliver->user_data.data_len;
                }
@@ -462,7 +452,7 @@ void SmsPluginEventHandler::handleSentStatus(msg_network_status_t NetStatus)
        MSG_DEBUG("NetStatus[%d]", NetStatus);
 
        if (sentInfo.bLast == true || NetStatus != MSG_NETWORK_SEND_SUCCESS) {
-               /** Update Msg Status */
+               /* Update Msg Status */
                if (sentInfo.reqInfo.msgInfo.msgPort.valid == false) {
 
                        sentInfo.reqInfo.msgInfo.networkStatus = NetStatus;
@@ -480,12 +470,12 @@ void SmsPluginEventHandler::handleSentStatus(msg_network_status_t NetStatus)
 
                MSG_DEBUG("sentInfo.reqInfo.sendOptInfo.bSetting [%d]", sentInfo.reqInfo.sendOptInfo.bSetting);
                MSG_DEBUG("sentInfo.reqInfo.sendOptInfo.bKeepCopy [%d]", sentInfo.reqInfo.sendOptInfo.bKeepCopy);
-               /** Check sending options */
+               /* Check sending options */
                if (sentInfo.reqInfo.sendOptInfo.bSetting && !sentInfo.reqInfo.sendOptInfo.bKeepCopy && NetStatus == MSG_NETWORK_SEND_SUCCESS) {
                        callbackStorageChange(MSG_STORAGE_CHANGE_DELETE, &(sentInfo.reqInfo.msgInfo));
                }
 
-               /** Callback to MSG FW */
+               /* Callback to MSG FW */
                MSG_SENT_STATUS_S msgStatus;
 
                msgStatus.reqId = sentInfo.reqInfo.reqId;
@@ -502,16 +492,16 @@ void SmsPluginEventHandler::handleSentStatus(msg_network_status_t NetStatus)
 void SmsPluginEventHandler::handleMsgIncoming(sms_trans_p2p_msg_s *p_p2p_msg)
 {
 
-       /** Make MSG_MESSAGE_INFO_S */
+       /* Make MSG_MESSAGE_INFO_S */
        MSG_MESSAGE_INFO_S msgInfo;
 
-       /** initialize msgInfo */
+       /* initialize msgInfo */
        memset(&msgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S));
 
        msgInfo.addressList = NULL;
        unique_ptr<MSG_ADDRESS_INFO_S*, void(*)(MSG_ADDRESS_INFO_S**)> addressListBuf(&msgInfo.addressList, unique_ptr_deleter);
 
-       /** convert to msgInfo */
+       /* convert to msgInfo */
        convertTpduToMsginfo(p_p2p_msg, &msgInfo);
 
        if (p_p2p_msg->telesvc_id == SMS_TRANS_TELESVC_RESERVED) {
@@ -520,7 +510,7 @@ void SmsPluginEventHandler::handleMsgIncoming(sms_trans_p2p_msg_s *p_p2p_msg)
                return;
        }
 
-       /** Check for Voice Mail Notification */
+       /* Check for Voice Mail Notification */
        if (p_p2p_msg->telesvc_id == SMS_TRANS_TELESVC_VMN_95) {
                if (p_p2p_msg->telesvc_msg.data.deliver.enhanced_vmn.fax_included)
                        msgInfo.msgType.subType = MSG_MWI_FAX_SMS;
@@ -532,7 +522,7 @@ void SmsPluginEventHandler::handleMsgIncoming(sms_trans_p2p_msg_s *p_p2p_msg)
 
                int voice_cnt = MsgSettingGetInt(VOICEMAIL_COUNT);
 
-               // repeated msg check for voicemail
+               /* repeated msg check for voicemail */
                if (voice_cnt == p_p2p_msg->telesvc_msg.data.deliver.num_msg) {
                        SmsPluginTransport::instance()->sendDeliverReport(MSG_SUCCESS, p_p2p_msg);
                        return;
@@ -544,9 +534,8 @@ void SmsPluginEventHandler::handleMsgIncoming(sms_trans_p2p_msg_s *p_p2p_msg)
 
                snprintf(msgInfo.msgText, sizeof(msgInfo.msgText), "%d", p_p2p_msg->telesvc_msg.data.deliver.num_msg);
                msgInfo.dataSize = strlen(msgInfo.msgText);
-       }
-       /** Check for EMS(Unsupported) */
-       else if (p_p2p_msg->telesvc_id == SMS_TRANS_TELESVC_WEMT) {
+       } else if (p_p2p_msg->telesvc_id == SMS_TRANS_TELESVC_WEMT) {
+               /* Check for EMS(Unsupported) */
                char *msg_text = getTranslateText(MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR, "IDS_MSGF_POP_ERROR_UNSUPPORTED_MSG");
                memset(msgInfo.msgText, 0x00, sizeof(msgInfo.msgText));
                snprintf(msgInfo.msgText, sizeof(msgInfo.msgText), "%s", msg_text);
@@ -558,7 +547,7 @@ void SmsPluginEventHandler::handleMsgIncoming(sms_trans_p2p_msg_s *p_p2p_msg)
                }
        }
 
-       /** Print MSG_MESSAGE_INFO_S */
+       /* Print MSG_MESSAGE_INFO_S */
        MSG_DEBUG("############# Convert  tpdu values to Message Info values ####################");
        MSG_DEBUG("msgInfo.nAddressCnt : %d", msgInfo.nAddressCnt);
        MSG_DEBUG("msgInfo.addressList[0].addressType : %d", msgInfo.addressList[0].addressType);
@@ -592,19 +581,21 @@ void SmsPluginEventHandler::handleMsgIncoming(sms_trans_p2p_msg_s *p_p2p_msg)
        memset(&unq_ind, 0x00, sizeof(MSG_UNIQUE_INDEX_S));
 
        if (msgInfo.msgType.subType == MSG_STATUS_REPORT_SMS) {
-//             /** Status Report Message */
-//             err = SmsPluginStorage::instance()->updateMsgDeliverStatus(&msgInfo, pTpdu->data.statusRep.msgRef);
-//
-//             if (err == MSG_SUCCESS)
-//                     err = listener.pfMsgIncomingCb(&msgInfo);
-//             else
-//                     MSG_DEBUG("updateMsgDeliverStatus is failed [%d]", err);
-//
-//             /** Handling of Fail Case ?? */
-//             SmsPluginTransport::instance()->sendDeliverReport(MSG_SUCCESS);
-       } else { /** SMS Deliver */
-
-               /** Add message to DB */
+               /* Status Report Message */
+               /*
+               err = SmsPluginStorage::instance()->updateMsgDeliverStatus(&msgInfo, pTpdu->data.statusRep.msgRef);
+
+               if (err == MSG_SUCCESS)
+                       err = listener.pfMsgIncomingCb(&msgInfo);
+               else
+                       MSG_DEBUG("updateMsgDeliverStatus is failed [%d]", err);
+               */
+
+               /* Handling of Fail Case ?? */
+               /* SmsPluginTransport::instance()->sendDeliverReport(MSG_SUCCESS); */
+       } else { /* SMS Deliver */
+
+               /* Add message to DB */
                if (msgInfo.msgPort.valid == false) {
                        if (p_p2p_msg->telesvc_id != SMS_TRANS_TELESVC_VMN_95) {
                                memcpy(unq_ind.address, p_p2p_msg->address.szData, sizeof(p_p2p_msg->address.szData));
@@ -621,13 +612,12 @@ void SmsPluginEventHandler::handleMsgIncoming(sms_trans_p2p_msg_s *p_p2p_msg)
 
                if (isUnique) {
                        err = SmsPluginStorage::instance()->checkMessage(&msgInfo);
-               }
-               else {
+               } else {
                        SmsPluginTransport::instance()->sendDeliverReport(MSG_SUCCESS, p_p2p_msg);
                        return;
                }
 
-               /** Callback to MSG FW */
+               /* Callback to MSG FW */
                if (err == MSG_SUCCESS) {
                        MSG_DEBUG("callback to msg fw");
                        err = listener.pfMsgIncomingCb(&msgInfo);
@@ -642,14 +632,14 @@ void SmsPluginEventHandler::handleMsgIncoming(sms_trans_p2p_msg_s *p_p2p_msg)
                if (err == MSG_SUCCESS && p_p2p_msg->telesvc_id != SMS_TRANS_TELESVC_VMN_95)
                        listener.pfCheckUniquenessCb(&unq_ind, msgInfo.msgId, true);
 
-               /** Send Deliver Report */
+               /* Send Deliver Report */
                if (p_p2p_msg->telesvc_id == SMS_TRANS_TELESVC_WEMT) {
                        SmsPluginTransport::instance()->sendDeliverReport(MSG_ERR_INVALID_MSG_TYPE, p_p2p_msg);
                } else {
                        SmsPluginTransport::instance()->sendDeliverReport(err, p_p2p_msg);
                }
 
-               // Tizen Validation System
+               /* Tizen Validation System */
                char *msisdn = NULL;
                char keyName[MAX_VCONFKEY_NAME_LEN];
                int simIndex = 1;
@@ -684,20 +674,20 @@ void SmsPluginEventHandler::handleCbMsgIncoming(sms_trans_broadcast_msg_s *p_cb_
                return;
        }
 
-       /** Make MSG_MESSAGE_INFO_S */
+       /* Make MSG_MESSAGE_INFO_S */
        MSG_MESSAGE_INFO_S msgInfo;
 
-       /** initialize msgInfo */
+       /* initialize msgInfo */
        memset(&msgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S));
 
        msgInfo.addressList = NULL;
        unique_ptr<MSG_ADDRESS_INFO_S*, void(*)(MSG_ADDRESS_INFO_S**)> addressListBuf(&msgInfo.addressList, unique_ptr_deleter);
 
-       /** convert to msgInfo */
+       /* convert to msgInfo */
        convertTpduToMsginfo(p_cb_msg, &msgInfo);
        msgInfo.msgId = p_cb_msg->telesvc_msg.data.deliver.msg_id.msg_id;
 
-       /** Print MSG_MESSAGE_INFO_S */
+       /* Print MSG_MESSAGE_INFO_S */
        MSG_DEBUG("############# Convert  tpdu values to Message Info values ####################");
        MSG_DEBUG("msgInfo.priority : %d", msgInfo.priority);
        MSG_DEBUG("msgInfo.bProtected : %d", msgInfo.bProtected);
@@ -724,18 +714,17 @@ void SmsPluginEventHandler::handleCbMsgIncoming(sms_trans_broadcast_msg_s *p_cb_
 
        msg_error_t err = MSG_SUCCESS;
 
-       /** Add message to DB */
+       /* Add message to DB */
        if (msgInfo.msgPort.valid == false) {
                err = SmsPluginStorage::instance()->checkMessage(&msgInfo);
        }
 
-       if (!checkCbOpt(p_cb_msg->svc_ctg))
-       {
+       if (!checkCbOpt(p_cb_msg->svc_ctg)) {
                MSG_DEBUG("The CB Msg is not supported by option.");
                return;
        }
 
-       /** Callback to MSG FW */
+       /* Callback to MSG FW */
        if (err == MSG_SUCCESS) {
 
 #if 1
@@ -743,49 +732,46 @@ void SmsPluginEventHandler::handleCbMsgIncoming(sms_trans_broadcast_msg_s *p_cb_
                bool is_duplicate = false;
 
                switch (p_cb_msg->svc_ctg) {
-                       case SMS_TRANS_SVC_CTG_CMAS_PRESIDENTIAL :
-                               msgInfo.msgType.subType = MSG_CMAS_PRESIDENTIAL;
-                               break;
-                       case SMS_TRANS_SVC_CTG_CMAS_EXTREME :
-                               msgInfo.msgType.subType = MSG_CMAS_EXTREME;
-                               break;
-                       case SMS_TRANS_SVC_CTG_CMAS_SEVERE :
-                               msgInfo.msgType.subType = MSG_CMAS_SEVERE;
-                               break;
-                       case SMS_TRANS_SVC_CTG_CMAS_AMBER :
-                               msgInfo.msgType.subType = MSG_CMAS_AMBER;
-                               break;
-                       case SMS_TRANS_SVC_CTG_CMAS_TEST :
-                               msgInfo.msgType.subType = MSG_CMAS_TEST;
-                               break;
-                       default :
-                               msgInfo.msgType.subType = MSG_CB_SMS;
-                               break;
+               case SMS_TRANS_SVC_CTG_CMAS_PRESIDENTIAL :
+                       msgInfo.msgType.subType = MSG_CMAS_PRESIDENTIAL;
+                       break;
+               case SMS_TRANS_SVC_CTG_CMAS_EXTREME :
+                       msgInfo.msgType.subType = MSG_CMAS_EXTREME;
+                       break;
+               case SMS_TRANS_SVC_CTG_CMAS_SEVERE :
+                       msgInfo.msgType.subType = MSG_CMAS_SEVERE;
+                       break;
+               case SMS_TRANS_SVC_CTG_CMAS_AMBER :
+                       msgInfo.msgType.subType = MSG_CMAS_AMBER;
+                       break;
+               case SMS_TRANS_SVC_CTG_CMAS_TEST :
+                       msgInfo.msgType.subType = MSG_CMAS_TEST;
+                       break;
+               default :
+                       msgInfo.msgType.subType = MSG_CB_SMS;
+                       break;
                }
 
                cbOutMsg.type = msgInfo.msgType.subType;
                cbOutMsg.receivedTime = msgInfo.displayTime;
-               cbOutMsg.serialNum = 0;//encodeCbSerialNum (CbMsgPage.pageHeader.serialNum);
+               /* encodeCbSerialNum (CbMsgPage.pageHeader.serialNum); */
+               cbOutMsg.serialNum = 0;
                cbOutMsg.messageId = msgInfo.msgId;
-//             cbOutMsg.dcs = CbMsgPage.pageHeader.dcs.rawData;
+               /* cbOutMsg.dcs = CbMsgPage.pageHeader.dcs.rawData; */
                memset (cbOutMsg.cbText, 0x00, sizeof(cbOutMsg.cbText));
 
                cbOutMsg.cbTextLen= msgInfo.dataSize;
                memset(cbOutMsg.language_type, 0x00, sizeof(cbOutMsg.language_type));
-//             memcpy(cbOutMsg.language_type, CbMsgPage.pageHeader.dcs.iso639Lang, 3);
+               /* memcpy(cbOutMsg.language_type, CbMsgPage.pageHeader.dcs.iso639Lang, 3); */
 
-               if (!is_duplicate)
-               {
+               if (!is_duplicate) {
                        MSG_DEBUG("callback to msg fw");
                        err = listener.pfCBMsgIncomingCb(&cbOutMsg, &msgInfo);
 
-                       if (err != MSG_SUCCESS)
-                       {
+                       if (err != MSG_SUCCESS) {
                                MSG_WARN("callbackMsgIncoming() Error !! [%d]", err);
                        }
-               }
-               else
-               {
+               } else {
                        MSG_WARN("duplicate cb serialNum[%d] messageId[%d]", cbOutMsg.serialNum, cbOutMsg.messageId);
                }
 
@@ -794,10 +780,10 @@ void SmsPluginEventHandler::handleCbMsgIncoming(sms_trans_broadcast_msg_s *p_cb_
 #endif
        }
 
-       /** Send Deliver Report */
-//     SmsPluginTransport::instance()->sendDeliverReport(err, p_cb_msg);
+       /* Send Deliver Report */
+       /* SmsPluginTransport::instance()->sendDeliverReport(err, p_cb_msg); */
 
-       // Tizen Validation System
+       /* Tizen Validation System */
        char *msisdn = NULL;
        char keyName[MAX_VCONFKEY_NAME_LEN];
        int simIndex = 1;
@@ -882,8 +868,7 @@ void SmsPluginEventHandler::handleWapMsgIncoming(sms_trans_p2p_msg_s *p_p2p_msg)
                        ((pTmpUserData[6] << 8 | pTmpUserData[7]) == 0x0b84)) {
                        dataSize -= 8;
                        memcpy(pUserData, &pTmpUserData[8], dataSize);
-               }
-               else {
+               } else {
                        dataSize -= 4;
                        memcpy(pUserData, &pTmpUserData[4], dataSize);
                }
@@ -898,13 +883,12 @@ void SmsPluginEventHandler::handleWapMsgIncoming(sms_trans_p2p_msg_s *p_p2p_msg)
                                msgInfo.msgType.mainType = MSG_SMS_TYPE;
                                SmsPluginWapPushHandler::instance()->copyDeliverData(&(p_p2p_msg->address));
                                SmsPluginWapPushHandler::instance()->handleWapPushMsg(pUserData, dataSize);
-                       }
-                       else {
+                       } else {
                                MSG_DEBUG("not supported wap push port [%x]", dstPort);
                        }
                }
 
-               // remove from waplist
+               /* remove from waplist */
                for (int index = wapList.size()-1; index >= 0 ; index--) {
                        if (wapList[index].msgId == msg.msgId) {
                                MSG_DEBUG("remove waplist of the index [%d]", index);
@@ -914,7 +898,7 @@ void SmsPluginEventHandler::handleWapMsgIncoming(sms_trans_p2p_msg_s *p_p2p_msg)
                }
        }
 
-       /** Send Deliver Report */
+       /* Send Deliver Report */
        SmsPluginTransport::instance()->sendDeliverReport(MSG_SUCCESS, p_p2p_msg);
 
        MSG_END();
@@ -933,7 +917,7 @@ msg_error_t SmsPluginEventHandler::callbackMsgIncoming(MSG_MESSAGE_INFO_S *pMsgI
 
        msg_error_t err = MSG_SUCCESS;
 
-       /** Callback to MSG FW */
+       /* Callback to MSG FW */
        err = listener.pfMsgIncomingCb(pMsgInfo);
 
        MSG_END();
@@ -944,7 +928,7 @@ msg_error_t SmsPluginEventHandler::callbackMsgIncoming(MSG_MESSAGE_INFO_S *pMsgI
 
 msg_error_t SmsPluginEventHandler::callbackStorageChange(msg_storage_change_type_t storageChangeType, MSG_MESSAGE_INFO_S *pMsgInfo)
 {
-       /** Callback to MSG FW */
+       /* Callback to MSG FW */
        listener.pfStorageChangeCb(storageChangeType, pMsgInfo);
 
        return MSG_SUCCESS;
@@ -977,37 +961,42 @@ bool SmsPluginEventHandler::getDeviceStatus()
        return devStatus;
 }
 
+
 void SmsPluginEventHandler::setNeedInitConfig(bool bNeeded)
 {
        bNeedInitConfig = bNeeded;
 }
 
+
 bool SmsPluginEventHandler::getNeedInitConfig()
 {
        return bNeedInitConfig;
 }
 
+
 msg_encode_type_t SmsPluginEventHandler::getEncodeType(sms_encoding_type_t encode_type)
 {
-       switch(encode_type) {
-               case SMS_ENCODE_IA5 :
-               case SMS_ENCODE_GSM7BIT :
-                       return MSG_ENCODE_GSM7BIT;
-               case SMS_ENCODE_KOREAN :
-               case SMS_ENCODE_EUCKR :
-                       return MSG_ENCODE_EUCKR;
-               case SMS_ENCODE_7BIT_ASCII :
-               case SMS_ENCODE_LATIN_HEBREW :
-               case SMS_ENCODE_LATIN :
-               case SMS_ENCODE_OCTET :
-                       return MSG_ENCODE_8BIT;
-               case SMS_ENCODE_SHIFT_JIS :
-                       return MSG_ENCODE_SHIFT_JIS;
-//             case SMS_ENCODE_EPM :
-//             case SMS_ENCODE_UNICODE :
-//             case SMS_ENCODE_GSMDCS :
-               default :
-                       return MSG_ENCODE_UCS2;
+       switch (encode_type) {
+       case SMS_ENCODE_GSM7BIT:
+               return MSG_ENCODE_GSM7BIT;
+       case SMS_ENCODE_KOREAN:
+       case SMS_ENCODE_EUCKR:
+               return MSG_ENCODE_EUCKR;
+       case SMS_ENCODE_IA5:
+       case SMS_ENCODE_7BIT_ASCII:
+       case SMS_ENCODE_LATIN_HEBREW:
+       case SMS_ENCODE_LATIN:
+       case SMS_ENCODE_OCTET:
+               return MSG_ENCODE_8BIT;
+       case SMS_ENCODE_SHIFT_JIS:
+               return MSG_ENCODE_SHIFT_JIS;
+       /*
+       case SMS_ENCODE_EPM :
+       case SMS_ENCODE_UNICODE :
+       case SMS_ENCODE_GSMDCS :
+       */
+       default:
+               return MSG_ENCODE_UCS2;
        }
 
        return MSG_ENCODE_UCS2;
@@ -1048,7 +1037,7 @@ unsigned short SmsPluginEventHandler::checkWapMsg(sms_wap_msg_s *pMsg, sms_teles
                }
        }
 
-       /** New Wap Push Msg */
+       /* New Wap Push Msg */
        if (bFind == false) {
                sms_wap_info_s tmpInfo;
                tmpInfo.msgId = pMsg->msgId;
@@ -1095,7 +1084,8 @@ int SmsPluginEventHandler::MakeWapUserData(unsigned short msgId, char **ppTotalD
 
                        MSG_DEBUG("totalSize [%d]", totalSize);
 
-                       *ppTotalData = new char[totalSize];
+                       if (*ppTotalData == NULL)
+                               *ppTotalData = new char[totalSize];
 
                        for (it = wapList[i].data.begin(); it != wapList[i].data.end(); it++) {
                                memcpy(*ppTotalData+offset, it->second.data, it->second.length);
@@ -1115,7 +1105,7 @@ void SmsPluginEventHandler::handleSyncMLMsgIncoming(msg_syncml_message_type_t ms
 
        memset(&syncMLData, 0x00, sizeof(MSG_SYNCML_MESSAGE_DATA_S));
 
-       /** set syncML data */
+       /* set syncML data */
        syncMLData.syncmlType = msgType;
 
        syncMLData.pushBodyLen = PushBodyLen;
@@ -1124,7 +1114,7 @@ void SmsPluginEventHandler::handleSyncMLMsgIncoming(msg_syncml_message_type_t ms
        syncMLData.wspHeaderLen= WspHeaderLen;
        memcpy(syncMLData.wspHeader, pWspHeader, WspHeaderLen);
 
-       /** Callback to MSG FW */
+       /* Callback to MSG FW */
        listener.pfSyncMLMsgIncomingCb(&syncMLData);
 }
 
@@ -1135,13 +1125,13 @@ void SmsPluginEventHandler::handleLBSMsgIncoming(char* pPushHeader, char* pPushB
 
        memset(&lBSData, 0x00, sizeof(MSG_LBS_MESSAGE_DATA_S));
 
-       /** set LBA data */
+       /* set LBA data */
        memcpy(lBSData.pushHeader, pPushHeader, strlen(pPushHeader));
 
        lBSData.pushBodyLen = pushBodyLen;
        memcpy(lBSData.pushBody, pPushBody, pushBodyLen);
 
-       /** Callback to MSG FW */
+       /* Callback to MSG FW */
        listener.pfLBSMsgIncomingCb(&lBSData);
 }
 
@@ -1152,7 +1142,7 @@ void SmsPluginEventHandler::handlePushMsgIncoming(char* pPushHeader, char* pPush
 
        memset(&pushData, 0x00, sizeof(MSG_PUSH_MESSAGE_DATA_S));
 
-       /** set PUSH data */
+       /* set PUSH data */
        memcpy(pushData.pushHeader, pPushHeader, strlen(pPushHeader));
 
        pushData.pushBodyLen = pushBodyLen;
@@ -1161,7 +1151,7 @@ void SmsPluginEventHandler::handlePushMsgIncoming(char* pPushHeader, char* pPush
        memcpy(pushData.pushAppId, application_id, MAX_WAPPUSH_ID_LEN);
        memcpy(pushData.pushContentType, content_type, MAX_WAPPUSH_CONTENT_TYPE_LEN);
 
-       /** Callback to MSG FW */
+       /* Callback to MSG FW */
        listener.pfPushMsgIncomingCb(&pushData);
 }
 
@@ -1169,11 +1159,15 @@ void SmsPluginEventHandler::handlePushMsgIncoming(char* pPushHeader, char* pPush
 bool SmsPluginEventHandler::checkCbOpt(sms_trans_svc_ctg_t svc_ctg)
 {
        bool bReceive = false;
-       MsgSettingGetBool(CB_RECEIVE, &bReceive);
+       char keyName[MAX_VCONFKEY_NAME_LEN] = {0, };
+       int sim_idx = 1;
+
+       memset(keyName, 0x00, sizeof(keyName));
+       snprintf(keyName, sizeof(keyName), "%s/%d", CB_RECEIVE, sim_idx);
+       MsgSettingGetBool(keyName, &bReceive);
 
-       // Receive CB Msg = FALSE
-       if (!bReceive)
-       {
+       /* Receive CB Msg = FALSE */
+       if (!bReceive) {
                MSG_DEBUG("RECEIVE CB = FALSE");
                return false;
        }
@@ -1191,13 +1185,11 @@ bool SmsPluginEventHandler::checkCbOpt(sms_trans_svc_ctg_t svc_ctg)
                        return false;
                }
 
-               for (int i = 0; i < cbChannelInfo.channelCnt; i++)
-               {
+               for (int i = 0; i < cbChannelInfo.channelCnt; i++) {
                        bActivate = cbChannelInfo.channelInfo[i].bActivate;
                        Category = cbChannelInfo.channelInfo[i].ctg;
 
-                       if (bActivate == true && svc_ctg == Category)
-                       {
+                       if (bActivate == true && svc_ctg == Category) {
                                MSG_DEBUG("FIND CHANNEL = [%d]", svc_ctg);
                                return true;
                        }
index 22c3b4b..fb4d7e2 100755 (executable)
@@ -1,17 +1,17 @@
 ï»¿/*
-* Copyright 2012-2013  Samsung Electronics Co., Ltd
-*
-* Licensed under the Flora License, Version 1.1 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*    http://floralicense.org/license/
-*
-* 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.
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
 */
 
 #include <errno.h>
@@ -70,15 +70,13 @@ static void MsgTapiInitCB(keynode_t *key, void* data)
        mx.unlock();
 }
 
+
 msg_error_t MsgPlgCreateHandle(MSG_PLUGIN_HANDLER_S *pPluginHandle)
 {
-       if (pPluginHandle == NULL)
-       {
+       if (pPluginHandle == NULL) {
                MSG_DEBUG("SMS plugin: create handler error ");
                return MSG_ERR_NULL_POINTER;
-       }
-       else
-       {
+       } else {
                pPluginHandle->pfInitialize = SmsPlgInitialize;
                pPluginHandle->pfFinalize = SmsPlgFinalize;
                pPluginHandle->pfRegisterListener = SmsPlgRegisterListener;
@@ -101,8 +99,7 @@ msg_error_t MsgPlgCreateHandle(MSG_PLUGIN_HANDLER_S *pPluginHandle)
 
 msg_error_t MsgPlgDestroyHandle(MSG_PLUGIN_HANDLER_S *pPluginHandle)
 {
-       if (pPluginHandle != NULL)
-       {
+       if (pPluginHandle != NULL) {
                free(pPluginHandle);
                pPluginHandle = NULL;
        }
@@ -123,7 +120,7 @@ msg_error_t SmsPlgInitialize()
                MsgSettingGetBool(VCONFKEY_TELEPHONY_READY, &bReady);
                MSG_DEBUG("Get VCONFKEY_TELEPHONY_READY [%d].", bReady ? 1 : 0);
 
-               if(bReady)
+               if (bReady)
                        break;
 
                sleep(1);
@@ -137,14 +134,14 @@ msg_error_t SmsPlgInitialize()
        pTapiHandle = tel_init(NULL);
 
        if (pTapiHandle) {
-               // register event.
+               /* register event. */
                SmsPluginCallback::instance()->registerEvent();
 
-               // set sim change status.
+               /* set sim change status. */
                MSG_DEBUG("Try to initialize SIM on init");
                SmsPluginSetting::instance()->setSimChangeStatus();
 
-               // set resource monitor
+               /* set resource monitor */
                MsgResourceMonitorInit();
        }
 
@@ -189,7 +186,7 @@ msg_error_t SmsPlgSubmitRequest(MSG_REQUEST_INFO_S *pReqInfo)
 {
        msg_error_t err = MSG_SUCCESS;
 
-       // Add Submit SMS into DB
+       /* Add Submit SMS into DB */
        if (pReqInfo->msgInfo.msgId == 0) {
                if (pReqInfo->msgInfo.msgPort.valid == false) {
 
@@ -213,19 +210,19 @@ msg_error_t SmsPlgSubmitRequest(MSG_REQUEST_INFO_S *pReqInfo)
                }
        }
 
-       // Check SIM is present or not
-//     MSG_SIM_STATUS_T simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(MSG_SIM_CHANGED);
-//
-//     if (simStatus == MSG_SIM_STATUS_NOT_FOUND)
-//     {
-//             MSG_DEBUG("SIM is not present..");
-//
-//             // Update Msg Status
-//             if (pReqInfo->msgInfo.msgPort.valid == false)
-//                     SmsPluginStorage::instance()->updateSentMsg(&(pReqInfo->msgInfo), MSG_NETWORK_SEND_FAIL);
-//
-//             return MSG_ERR_NO_SIM;
-//     }
+       /* Check SIM is present or not */
+       /*
+       MSG_SIM_STATUS_T simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(MSG_SIM_CHANGED);
+
+       if (simStatus == MSG_SIM_STATUS_NOT_FOUND) {
+               MSG_DEBUG("SIM is not present..");
+
+               if (pReqInfo->msgInfo.msgPort.valid == false)
+                       SmsPluginStorage::instance()->updateSentMsg(&(pReqInfo->msgInfo), MSG_NETWORK_SEND_FAIL);
+
+               return MSG_ERR_NO_SIM;
+       }
+       */
 
        sms_request_info_s *request = NULL;
 
@@ -275,8 +272,7 @@ msg_error_t SmsPlgSetMemoryStatus(msg_error_t Error)
        int tapiRet = TAPI_API_SUCCESS;
        int status = TAPI_NETTEXT_PDA_MEMORY_STATUS_AVAILABLE;
 
-       if (Error == MSG_ERR_SIM_STORAGE_FULL || Error == MSG_ERR_MESSAGE_COUNT_FULL)
-       {
+       if (Error == MSG_ERR_SIM_STORAGE_FULL || Error == MSG_ERR_MESSAGE_COUNT_FULL) {
                status = TAPI_NETTEXT_PDA_MEMORY_STATUS_FULL;
        }
 
@@ -284,12 +280,9 @@ msg_error_t SmsPlgSetMemoryStatus(msg_error_t Error)
 
        tapiRet = tel_set_sms_memory_status(pTapiHandle, status, TapiEventMemoryStatus, NULL);
 
-       if (tapiRet == TAPI_API_SUCCESS)
-       {
+       if (tapiRet == TAPI_API_SUCCESS) {
                MSG_DEBUG("########  tel_set_sms_memory_status() Success !!! #######");
-       }
-       else
-       {
+       } else {
                MSG_DEBUG("########  tel_set_sms_memory_status() Success !!! return : [%d] #######", tapiRet);
        }
 
@@ -299,17 +292,12 @@ msg_error_t SmsPlgSetMemoryStatus(msg_error_t Error)
 
 msg_error_t SmsPlgSetConfigData(const MSG_SETTING_S *pSetting)
 {
-       try
-       {
+       try {
                SmsPluginSetting::instance()->setConfigData(pSetting);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_PLUGIN_SETTING;
-       }
-       catch (exception& e)
-       {
+       } catch (exception& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_PLUGIN_SETTING;
        }
@@ -320,17 +308,12 @@ msg_error_t SmsPlgSetConfigData(const MSG_SETTING_S *pSetting)
 
 msg_error_t SmsPlgGetConfigData(MSG_SETTING_S *pSetting)
 {
-       try
-       {
+       try {
                SmsPluginSetting::instance()->getConfigData(pSetting);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_PLUGIN_SETTING;
-       }
-       catch (exception& e)
-       {
+       } catch (exception& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_PLUGIN_SETTING;
        }
@@ -345,6 +328,7 @@ msg_error_t SmsPlgAddMessage(MSG_MESSAGE_INFO_S *pMsgInfo,  MSG_SENDINGOPT_INFO_
        return MSG_SUCCESS;
 }
 
+
 static void on_change_received(GDBusConnection *connection, const gchar *sender_name,
                const gchar *object_path, const gchar *interface_name, const gchar *signal_name,
                GVariant *parameters, gpointer user_data)
@@ -355,12 +339,13 @@ static void on_change_received(GDBusConnection *connection, const gchar *sender_
                gint memStatus;
                g_variant_get(parameters, "(i)", &memStatus);
                MSG_DEBUG("memStatus = [%d]", memStatus);
-               if(memStatus == 0) {
+               if (memStatus == 0) {
                        SmsPlgSetMemoryStatus(MSG_SUCCESS);
                }
        }
 }
 
+
 void MsgResourceMonitorInit(void)
 {
     MSG_BEGIN();
@@ -415,7 +400,6 @@ _DBUS_ERROR:
 
        MSG_END();
        return;
-
 }
 
 
index e1885b2..9f9cb0f 100755 (executable)
@@ -1,17 +1,17 @@
 /*
-* Copyright 2012-2013  Samsung Electronics Co., Ltd
-*
-* Licensed under the Flora License, Version 1.1 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*    http://floralicense.org/license/
-*
-* 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.
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
 */
 
 #include <stdio.h>
@@ -39,6 +39,7 @@ SmsPluginParamCodec::~SmsPluginParamCodec()
 
 }
 
+
 SmsPluginParamCodec* SmsPluginParamCodec::instance()
 {
        if (!pInstance)
@@ -80,6 +81,7 @@ int SmsPluginParamCodec::convertDigitToBcd(char *pDigit, int DigitLen, unsigned
        return offset;
 }
 
+
 int SmsPluginParamCodec::convertBcdToDigit(const unsigned char *pBcd, int BcdLen, char *pDigit)
 {
        int offset = 0;
@@ -119,6 +121,7 @@ int SmsPluginParamCodec::convertBcdToDigit(const unsigned char *pBcd, int BcdLen
        return offset;
 }
 
+
 int SmsPluginParamCodec::convertDigitToDTMF(const char *pDigit, int DigitLen, int startBit, unsigned char *pDtmf)
 {
        int shift = startBit;
@@ -171,6 +174,7 @@ int SmsPluginParamCodec::convertDigitToDTMF(const char *pDigit, int DigitLen, in
        return offset;
 }
 
+
 int SmsPluginParamCodec::convertDTMFToDigit(const unsigned char *pDtmf, int DtmfLen, int startBit, char *pDigit)
 {
        int shift = startBit;
@@ -220,6 +224,7 @@ int SmsPluginParamCodec::convertDTMFToDigit(const unsigned char *pDtmf, int Dtmf
        return offset;
 }
 
+
 bool SmsPluginParamCodec::isDtmfNumber(const char *pDigit, int DigitLen)
 {
        bool isDtmf = true;
@@ -235,6 +240,3 @@ bool SmsPluginParamCodec::isDtmfNumber(const char *pDigit, int DigitLen)
 
        return isDtmf;
 }
-
-
-
index 14b1cbb..ef594c5 100755 (executable)
@@ -1,17 +1,17 @@
 /*
-* Copyright 2012-2013  Samsung Electronics Co., Ltd
-*
-* Licensed under the Flora License, Version 1.1 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*    http://floralicense.org/license/
-*
-* 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.
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
 */
 
 #include <errno.h>
 #include "MsgCppTypes.h"
 #include "MsgException.h"
 #include "MsgGconfWrapper.h"
-
-#ifndef MSG_NOTIFICATION_NOT_SUPPORTED
 #include "MsgNotificationWrapper.h"
-#endif
 
 #include "MsgSoundPlayer.h"
 #include "MsgContact.h"
@@ -58,7 +55,7 @@ SmsPluginSetting* SmsPluginSetting::pInstance = NULL;
 
 SmsPluginSetting::SmsPluginSetting()
 {
-       // Initialize member variables
+       /* Initialize member variables */
        memset(&cbOpt, 0x00, sizeof(MSG_CBMSG_OPT_S));
        memset(&meImei, 0x00, sizeof(meImei));
 
@@ -89,11 +86,11 @@ void* SmsPluginSetting::initSimInfo(void *data)
 
        int tapiRet = TAPI_API_SUCCESS;
 
-       // Get IMSI
+       /* Get IMSI */
        char imsi[17];
        memset(imsi, 0x00, sizeof(imsi));
 
-       // Get IMSI
+       /* Get IMSI */
        TelSimImsiInfo_t imsiInfo;
        memset(&imsiInfo, 0x00, sizeof(TelSimImsiInfo_t));
 
@@ -105,7 +102,6 @@ void* SmsPluginSetting::initSimInfo(void *data)
                MSG_SEC_DEBUG("IMSI [%s]", imsi);
        } else {
                MSG_DEBUG("tel_get_sim_imsi() Error![%d]", tapiRet);
-               MsgSettingSetBool(MSG_NATIONAL_SIM, false);
        }
 
        MsgSettingSetString(MSG_SIM_IMSI, imsi);
@@ -116,6 +112,7 @@ void* SmsPluginSetting::initSimInfo(void *data)
        return NULL;
 }
 
+
 void SmsPluginSetting::updateSimStatus()
 {
        MSG_BEGIN();
@@ -149,7 +146,7 @@ void SmsPluginSetting::updateSimStatus()
                }
        }
 
-       // init config data.
+       /* init config data. */
        initConfigData();
 
        MSG_END();
@@ -164,7 +161,7 @@ void SmsPluginSetting::setSimChangeStatus()
 
        pthread_t thd;
 
-       if(pthread_create(&thd, NULL, &initSimInfo, NULL) < 0) {
+       if (pthread_create(&thd, NULL, &initSimInfo, NULL) < 0) {
                MSG_DEBUG("pthread_create() error");
        }
 
@@ -174,19 +171,19 @@ void SmsPluginSetting::setSimChangeStatus()
 }
 
 
-
 void SmsPluginSetting::initConfigData()
 {
        MSG_BEGIN();
 
        msg_error_t     err = MSG_SUCCESS;
+       char keyName[MAX_VCONFKEY_NAME_LEN];
+       int sim_idx = 1;
 
-#if 1
        /*==================== CB configuration ====================*/
-//     if (simStatus != MSG_SIM_STATUS_NOT_FOUND)
-//     {
-//             MSG_DEBUG("simStatus == [%d]", simStatus);
-
+       /*
+       if (simStatus != MSG_SIM_STATUS_NOT_FOUND) {
+               MSG_DEBUG("simStatus == [%d]", simStatus);
+       */
                MSG_CBMSG_OPT_S cbMsgOpt = {0,};
 
                if (getCbConfig(&cbMsgOpt) == true) {
@@ -203,22 +200,6 @@ void SmsPluginSetting::initConfigData()
                        }
                } else {
                        MSG_DEBUG("########  getCbConfig Fail !!! #######");
-#endif
-
-#if 0
-                       // CSC doesn't support CB Info any longer
-                       if (MsgCscGetCBInfo(&cbMsgOpt) == true) {
-                               err = addCbOpt(&cbMsgOpt);
-
-                               if (err == MSG_SUCCESS) {
-                                       MSG_DEBUG("########  Add CB Option From CSC Success !!! #######");
-                               } else {
-                                       MSG_DEBUG("########  Add CB Option from CSC Fail !!! return : %d #######", err);
-                               }
-                       } else {
-                               MSG_DEBUG("########  MsgCscGetCBInfo Fail !!! #######");
-                       }
-#endif
                }
 
                /*==================== MSISDN update ====================*/
@@ -227,37 +208,21 @@ void SmsPluginSetting::initConfigData()
                } else {
                        MSG_DEBUG("########  getMsisdnInfo Fail !!! #######");
                }
-#if 1
-               /*==================== Default Voice mail Setting ====================*/
-               char *num = MsgSettingGetString(VOICEMAIL_DEFAULT_NUMBER);
-
-               if (num) {
-                       MSG_DEBUG("Voicemail Default Number [%s]", num);
-                       if (MsgSettingSetString(VOICEMAIL_NUMBER, num) != MSG_SUCCESS)
-                               MSG_DEBUG("MsgSettingSetInt is failed!!");
-                       free(num);
-                       num = NULL;
-               }
-               else {
-                       MSG_DEBUG("Voicemail Default Number is NULL");
-                       if (MsgSettingSetString(VOICEMAIL_NUMBER, "") != MSG_SUCCESS)
-                               MSG_DEBUG("MsgSettingSetInt is failed!!");
-               }
 
-               char *voiceNumber = MsgSettingGetString(VOICEMAIL_NUMBER);
-
-               if (!voiceNumber || (voiceNumber && voiceNumber[0] == '\0')) {
-                       MSG_DEBUG("Voice Number is Empty");
-               }
+               /*==================== Default Voice mail Setting ====================*/
+               MSG_DEBUG("Voicemail Default Number is NULL");
+               memset(keyName, 0x00, sizeof(keyName));
+               snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_NUMBER, sim_idx);
+               if (MsgSettingSetString(keyName, VOICEMAIL_DEFAULT_NUMBER) != MSG_SUCCESS)
+                       MSG_DEBUG("Error to set config data [%s]", keyName);
 
-               if (voiceNumber) {
-                       free(voiceNumber);
-                       voiceNumber = NULL;
-               }
+               memset(keyName, 0x00, sizeof(keyName));
+               snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_NUMBER, sim_idx);
 
-               if (MsgSettingSetString(VOICEMAIL_ALPHA_ID, VOICEMAIL_DEFAULT_ALPHA_ID) != MSG_SUCCESS)
-                       MSG_DEBUG("MsgSettingSetString is failed!!");
-#endif
+               memset(keyName, 0x00, sizeof(keyName));
+               snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_ALPHA_ID, sim_idx);
+               if (MsgSettingSetString(keyName, VOICEMAIL_DEFAULT_ALPHA_ID) != MSG_SUCCESS)
+                       MSG_DEBUG("Error to set config data [%s]", keyName);
 
        MSG_END();
 }
@@ -267,7 +232,7 @@ void SmsPluginSetting::SimRefreshCb()
 {
        pthread_t thd;
 
-       if(pthread_create(&thd, NULL, &init_config_data, NULL) < 0) {
+       if (pthread_create(&thd, NULL, &init_config_data, NULL) < 0) {
                MSG_DEBUG("pthread_create() error");
        }
 
@@ -287,26 +252,25 @@ void SmsPluginSetting::setConfigData(const MSG_SETTING_S *pSetting)
 {
        MSG_DEBUG("Setting Type : [%d]", pSetting->type);
 
-       switch (pSetting->type)
-       {
+       switch (pSetting->type) {
 #if 0
-               case MSG_SMS_SENDOPT :
-                       setNetworkMode(&pSetting->option.smsSendOpt);
-                       break;
-               case MSG_SMSC_LIST :
-                       setParamList(&pSetting->option.smscList);
-                       break;
+       case MSG_SMS_SENDOPT :
+               setNetworkMode(&pSetting->option.smsSendOpt);
+               break;
+       case MSG_SMSC_LIST :
+               setParamList(&pSetting->option.smscList);
+               break;
 #endif
-               case MSG_VOICEMAIL_OPT:
-                       setVoiceMailInfo(&pSetting->option.voiceMailOpt);
-                       break;
-
-               case MSG_CBMSG_OPT :
-                       setCbConfig(&pSetting->option.cbMsgOpt);
-                       break;
-               default :
-                       THROW(MsgException::SMS_PLG_ERROR, "The Setting type is not supported. [%d]", pSetting->type);
-                       break;
+       case MSG_VOICEMAIL_OPT:
+               setVoiceMailInfo(&pSetting->option.voiceMailOpt);
+               break;
+
+       case MSG_CBMSG_OPT :
+               setCbConfig(&pSetting->option.cbMsgOpt);
+               break;
+       default :
+               THROW(MsgException::SMS_PLG_ERROR, "The Setting type is not supported. [%d]", pSetting->type);
+               break;
        }
 }
 
@@ -315,20 +279,19 @@ void SmsPluginSetting::getConfigData(MSG_SETTING_S *pSetting)
 {
        MSG_DEBUG("Setting Type : [%d]", pSetting->type);
 
-       switch (pSetting->type)
-       {
+       switch (pSetting->type) {
 #if 0
-               case MSG_SMSC_LIST :
-                       getParamList(&pSetting->option.smscList);
-               break;
+       case MSG_SMSC_LIST :
+               getParamList(&pSetting->option.smscList);
+       break;
 #endif
-               case MSG_CBMSG_OPT :
-                       getCbConfig(&pSetting->option.cbMsgOpt);
-               break;
+       case MSG_CBMSG_OPT :
+               getCbConfig(&pSetting->option.cbMsgOpt);
+       break;
 
-               default :
-                       THROW(MsgException::SMS_PLG_ERROR, "The Setting type is not supported. [%d]", pSetting->type);
-               break;
+       default :
+               THROW(MsgException::SMS_PLG_ERROR, "The Setting type is not supported. [%d]", pSetting->type);
+       break;
        }
 }
 
@@ -337,17 +300,16 @@ msg_error_t SmsPluginSetting::addCbOpt(MSG_CBMSG_OPT_S *pCbOpt)
 {
        msg_error_t err = MSG_SUCCESS;
 
-//     MSG_DEBUG("Receive [%d], Max SIM Count [%d]", pCbOpt->bReceive, pCbOpt->maxSimCnt);
+       /* MSG_DEBUG("Receive [%d], Max SIM Count [%d]", pCbOpt->bReceive, pCbOpt->maxSimCnt); */
 
        MSG_DEBUG("Receive [%d], Channel Count [%d]", pCbOpt->bReceive, pCbOpt->channelData.channelCnt);
 
-       for (int i = 0; i < pCbOpt->channelData.channelCnt; i++)
-       {
+       for (int i = 0; i < pCbOpt->channelData.channelCnt; i++) {
                MSG_DEBUG("Channel Category [%d], Channel Language [%d]", pCbOpt->channelData.channelInfo[i].ctg, pCbOpt->channelData.channelInfo[i].lang);
        }
 
 #if 0
-       // Set Setting Data into Vconf
+       /* Set Setting Data into Vconf */
        if (MsgSettingSetBool(CB_RECEIVE, pCbOpt->bReceive) != MSG_SUCCESS) {
                MSG_DEBUG("Error to set config data [%s]", CB_RECEIVE);
                return MSG_ERR_SET_SETTING;
@@ -383,7 +345,7 @@ void SmsPluginSetting::getCbOpt(MSG_SETTING_S *pSetting)
 
        MsgSettingGetBool(CB_RECEIVE, &pSetting->option.cbMsgOpt.bReceive);
 
-//     pSetting->option.cbMsgOpt.maxSimCnt = MsgSettingGetInt(CB_MAX_SIM_COUNT);
+       /* pSetting->option.cbMsgOpt.maxSimCnt = MsgSettingGetInt(CB_MAX_SIM_COUNT); */
 
        err = MsgStoGetCBChannelInfo(&dbHandle, &pSetting->option.cbMsgOpt.channelData);
        MSG_DEBUG("MsgStoAddCBChannelInfo : err=[%d]", err);
@@ -398,9 +360,9 @@ void SmsPluginSetting::getCbOpt(MSG_SETTING_S *pSetting)
                MsgSettingGetBool(keyName, &pSetting->option.cbMsgOpt.bLanguage[i]);
        }
 #endif
-
 }
 
+
 void SmsPluginSetting::setVoiceMailInfo(const MSG_VOICEMAIL_OPT_S *pVoiceOpt)
 {
        bUpdateVoicemailByMdn = false;
@@ -408,6 +370,7 @@ void SmsPluginSetting::setVoiceMailInfo(const MSG_VOICEMAIL_OPT_S *pVoiceOpt)
        return;
 }
 
+
 bool SmsPluginSetting::setCbConfig(const MSG_CBMSG_OPT_S *pCbOpt)
 {
        int ret = TAPI_API_SUCCESS;
@@ -417,7 +380,7 @@ bool SmsPluginSetting::setCbConfig(const MSG_CBMSG_OPT_S *pCbOpt)
 
        cbConfig.CBEnabled = (int)pCbOpt->bReceive;
        cbConfig.Net3gppType = TAPI_NETTEXT_NETTYPE_3GPP2;
-//     cbConfig.MsgIdMaxCount = pCbOpt->maxSimCnt;
+       /* cbConfig.MsgIdMaxCount = pCbOpt->maxSimCnt; */
        cbConfig.MsgIdRangeCount = pCbOpt->channelData.channelCnt;
 
        for (int i = 0; i < cbConfig.MsgIdRangeCount; i++) {
@@ -606,23 +569,23 @@ void SmsPluginSetting::setMwiInfo(MSG_SUB_TYPE_T type, int count)
 
        if (MsgSettingSetInt(VOICEMAIL_COUNT, count) != MSG_SUCCESS)
                MSG_DEBUG("MsgSettingSetInt is failed!!");
+       /*
+       if (count == 0) {
+               MsgStoClearUniquenessTable();
+       }
 
-//     if (count == 0) {
-//             MsgStoClearUniquenessTable();
-//     }
-
-//     if(count <= 0) {
-//             if (type == MSG_MWI_VOICE_SMS)
-//                     MsgCleanAndResetNotification(MSG_NOTI_TYPE_VOICE_1);
-//             else if (type == MSG_MWI_VOICE2_SMS)
-//                     MsgCleanAndResetNotification(MSG_NOTI_TYPE_VOICE_2);
-//     }
-
-//     if (bMbdnEnable == false) {
-//             MSG_DEBUG("MBDN service is disable.");
-//             return;
-//     }
+       if (count <= 0) {
+               if (type == MSG_MWI_VOICE_SMS)
+                       MsgCleanAndResetNotification(MSG_NOTI_TYPE_VOICE_1);
+               else if (type == MSG_MWI_VOICE2_SMS)
+                       MsgCleanAndResetNotification(MSG_NOTI_TYPE_VOICE_2);
+       }
 
+       if (bMbdnEnable == false) {
+               MSG_DEBUG("MBDN service is disable.");
+               return;
+       }
+       */
        return;
 }
 
index fb7e693..582650c 100755 (executable)
@@ -1,17 +1,17 @@
 ï»¿/*
-* Copyright 2012-2013  Samsung Electronics Co., Ltd
-*
-* Licensed under the Flora License, Version 1.1 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*    http://floralicense.org/license/
-*
-* 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.
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
 */
 
 #include <errno.h>
 #include "MsgUtilStorage.h"
 #include "MsgUtilFunction.h"
 #include "MsgGconfWrapper.h"
-
-#ifndef MSG_NOTIFICATION_NOT_SUPPORTED
 #include "MsgNotificationWrapper.h"
-#endif
 
 #include "SmsCdmaPluginMain.h"
 #include "SmsCdmaPluginStorage.h"
@@ -122,7 +119,7 @@ msg_error_t SmsPluginStorage::updateMsgDeliverStatus(MSG_MESSAGE_INFO_S *pMsgInf
 
        pMsgInfo->msgId = msgId;
 
-       /** Update Status - MSG_MESSAGE_TABLE */
+       /* Update Status - MSG_MESSAGE_TABLE */
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
        snprintf(sqlQuery, sizeof(sqlQuery), "SELECT * FROM %s WHERE MSG_ID = %d AND MSG_REF > 0;",
                        MSGFW_SMS_REPORT_TABLE_NAME, msgId);
@@ -144,7 +141,7 @@ msg_error_t SmsPluginStorage::updateMsgDeliverStatus(MSG_MESSAGE_INFO_S *pMsgInf
                }
        }
 
-       /** Update Status - MSG_REPORT_TABLE */
+       /* Update Status - MSG_REPORT_TABLE */
        if (pMsgInfo->networkStatus == MSG_NETWORK_DELIVER_SUCCESS) {
                memset(sqlQuery, 0x00, sizeof(sqlQuery));
                snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET MSG_REF = -1, STATUS = %d, TIME = %d WHERE MSG_ID = %d and ADDRESS_VAL = '%s';",
@@ -155,7 +152,7 @@ msg_error_t SmsPluginStorage::updateMsgDeliverStatus(MSG_MESSAGE_INFO_S *pMsgInf
                        MSG_DEBUG("Query Failed : [%s]", sqlQuery);
                        return MSG_ERR_DB_EXEC;
                }
-       } else if(pMsgInfo->networkStatus == MSG_NETWORK_DELIVER_EXPIRED) {
+       } else if (pMsgInfo->networkStatus == MSG_NETWORK_DELIVER_EXPIRED) {
                memset(sqlQuery, 0x00, sizeof(sqlQuery));
                snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET MSG_REF = -1, STATUS = %d, TIME = %d WHERE MSG_ID = %d and ADDRESS_VAL = '%s';",
                                MSGFW_SMS_REPORT_TABLE_NAME, 0, (int)pMsgInfo->displayTime, msgId, normalNum);
@@ -165,7 +162,7 @@ msg_error_t SmsPluginStorage::updateMsgDeliverStatus(MSG_MESSAGE_INFO_S *pMsgInf
                        MSG_DEBUG("Query Failed : [%s]", sqlQuery);
                        return MSG_ERR_DB_EXEC;
                }
-       } else if(pMsgInfo->networkStatus == MSG_NETWORK_DELIVER_PENDING) {
+       } else if (pMsgInfo->networkStatus == MSG_NETWORK_DELIVER_PENDING) {
                memset(sqlQuery, 0x00, sizeof(sqlQuery));
                snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET MSG_REF = -1, STATUS = %d, TIME = %d WHERE MSG_ID = %d and ADDRESS_VAL = '%s';",
                                MSGFW_SMS_REPORT_TABLE_NAME, 3, (int)pMsgInfo->displayTime, msgId, normalNum);
@@ -175,7 +172,7 @@ msg_error_t SmsPluginStorage::updateMsgDeliverStatus(MSG_MESSAGE_INFO_S *pMsgInf
                        MSG_DEBUG("Query Failed : [%s]", sqlQuery);
                        return MSG_ERR_DB_EXEC;
                }
-       } else if(pMsgInfo->networkStatus == MSG_NETWORK_DELIVER_FAIL) {
+       } else if (pMsgInfo->networkStatus == MSG_NETWORK_DELIVER_FAIL) {
                memset(sqlQuery, 0x00, sizeof(sqlQuery));
                snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET MSG_REF = -1, STATUS = %d, TIME = %d WHERE MSG_ID = %d and ADDRESS_VAL = '%s';",
                                MSGFW_SMS_REPORT_TABLE_NAME, 8, (int)pMsgInfo->displayTime, msgId, normalNum);
@@ -209,7 +206,7 @@ msg_error_t SmsPluginStorage::updateSentMsg(MSG_MESSAGE_INFO_S *pMsgInfo, msg_ne
 
        MSG_DEBUG("Update Msg ID : [%d], Network Status : [%d] ", pMsgInfo->msgId, status);
 
-       /** Move Msg to SENTBOX */
+       /* Move Msg to SENTBOX */
        if (status == MSG_NETWORK_SEND_SUCCESS) {
                snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET NETWORK_STATUS = %d, FOLDER_ID = %d WHERE MSG_ID = %d;",
                                        MSGFW_MESSAGE_TABLE_NAME, status, MSG_SENTBOX_ID, pMsgInfo->msgId);
@@ -240,7 +237,7 @@ msg_error_t SmsPluginStorage::checkMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
 
        msg_error_t err = MSG_SUCCESS;
 
-       /**  Check whether storage is full or not */
+       /*  Check whether storage is full or not */
        err = checkStorageStatus(pMsgInfo);
 
        if (err != MSG_SUCCESS) {
@@ -248,24 +245,26 @@ msg_error_t SmsPluginStorage::checkMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
                        pMsgInfo->folderId = 0;
                        err = MSG_SUCCESS;
                }
-//             else if(pMsgInfo->msgType.classType == MSG_CLASS_2 &&
-//                             (pMsgInfo->msgType.subType == MSG_NORMAL_SMS || pMsgInfo->msgType.subType == MSG_REJECT_SMS)) {
-//                     err = addClass2Message(pMsgInfo);
-//             }
+               /*
+               else if (pMsgInfo->msgType.classType == MSG_CLASS_2 &&
+                               (pMsgInfo->msgType.subType == MSG_NORMAL_SMS || pMsgInfo->msgType.subType == MSG_REJECT_SMS)) {
+                       err = addClass2Message(pMsgInfo);
+               }
+               */
                else if (pMsgInfo->msgType.subType == MSG_NOTIFICATIONIND_MMS){
                        err = MSG_SUCCESS;
                }
                return err;
        }
 
-       /**  Amend message information for type **/
+       /*  Amend message information for type */
        if (pMsgInfo->msgType.subType == MSG_NORMAL_SMS || pMsgInfo->msgType.subType == MSG_REJECT_SMS) {
                MSG_DEBUG("Normal SMS");
 
                if (pMsgInfo->msgType.classType == MSG_CLASS_2) {
-//                     err = addClass2Message(pMsgInfo);
+                       /* err = addClass2Message(pMsgInfo); */
                } else if (pMsgInfo->msgType.classType == MSG_CLASS_0) {
-                       /** Class 0 Msg should be saved in hidden folder */
+                       /* Class 0 Msg should be saved in hidden folder */
                        pMsgInfo->folderId = 0;
                }
 
@@ -273,9 +272,9 @@ msg_error_t SmsPluginStorage::checkMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
                MSG_DEBUG("Replace SM Type [%d]", pMsgInfo->msgType.subType-3);
 
                if (pMsgInfo->msgType.classType == MSG_CLASS_2) {
-//                     err = addClass2Message(pMsgInfo);
+                       /* err = addClass2Message(pMsgInfo); */
                } else if (pMsgInfo->msgType.classType == MSG_CLASS_0) {
-                       /** Class 0 Msg should be saved in hidden folder */
+                       /* Class 0 Msg should be saved in hidden folder */
                        pMsgInfo->folderId = 0;
                        pMsgInfo->msgType.subType = MSG_NORMAL_SMS;
                }
@@ -283,10 +282,11 @@ msg_error_t SmsPluginStorage::checkMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
        } else if ((pMsgInfo->msgType.subType >= MSG_MWI_VOICE_SMS) && (pMsgInfo->msgType.subType <= MSG_MWI_OTHER_SMS)) {
                if (pMsgInfo->bStore == true) {
                        MSG_DEBUG("MWI Message");
-
-//                     if (pMsgInfo->msgType.classType == MSG_CLASS_2) {
-//                             err = addClass2Message(pMsgInfo);
-//                     }
+                       /*
+                       if (pMsgInfo->msgType.classType == MSG_CLASS_2) {
+                               err = addClass2Message(pMsgInfo);
+                       }
+                       */
                }
        } else {
                MSG_DEBUG("No matching type [%d]", pMsgInfo->msgType.subType);
@@ -324,7 +324,7 @@ msg_error_t SmsPluginStorage::addSmsMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
                pMsgInfo->threadId = convId;
        }
 
-       /**  Add Message Table */
+       /*  Add Message Table */
        rowId = MsgStoAddMessageTable(dbHandle, pMsgInfo);
 
        if (rowId <= 0) {
@@ -332,7 +332,7 @@ msg_error_t SmsPluginStorage::addSmsMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
                return MSG_ERR_DB_ROW;
        }
 
-       /** Update conversation table */
+       /* Update conversation table */
        err = MsgStoUpdateConversation(dbHandle, convId);
 
        if (err != MSG_SUCCESS) {
@@ -360,7 +360,7 @@ msg_error_t SmsPluginStorage::deleteSmsMessage(msg_message_id_t msgId)
        MsgDbHandler *dbHandle = getDbHandle();
        char sqlQuery[MAX_QUERY_LEN+1];
 
-        /**  Get SUB_TYPE, STORAGE_ID */
+        /*  Get SUB_TYPE, STORAGE_ID */
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
        snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MAIN_TYPE, SUB_TYPE, FOLDER_ID, CONV_ID, SIM_INDEX \
                        FROM %s WHERE MSG_ID = %d;",
@@ -396,7 +396,7 @@ msg_error_t SmsPluginStorage::deleteSmsMessage(msg_message_id_t msgId)
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
        snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", MSGFW_SMS_SENDOPT_TABLE_NAME, msgId);
 
-       /**  Delete SMS Send Option */
+       /*  Delete SMS Send Option */
        if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
                dbHandle->endTrans(false);
                return MSG_ERR_DB_EXEC;
@@ -406,7 +406,7 @@ msg_error_t SmsPluginStorage::deleteSmsMessage(msg_message_id_t msgId)
                memset(sqlQuery, 0x00, sizeof(sqlQuery));
                snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", MSGFW_CB_MSG_TABLE_NAME, msgId);
 
-               /** Delete Push Message from push table */
+               /* Delete Push Message from push table */
                if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
                        dbHandle->endTrans(false);
                        return MSG_ERR_DB_EXEC;
@@ -415,7 +415,7 @@ msg_error_t SmsPluginStorage::deleteSmsMessage(msg_message_id_t msgId)
                memset(sqlQuery, 0x00, sizeof(sqlQuery));
                snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", MSGFW_PUSH_MSG_TABLE_NAME, msgId);
 
-               /**  Delete Push Message from push table */
+               /*  Delete Push Message from push table */
                if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
                        dbHandle->endTrans(false);
                        return MSG_ERR_DB_EXEC;
@@ -424,14 +424,14 @@ msg_error_t SmsPluginStorage::deleteSmsMessage(msg_message_id_t msgId)
                memset(sqlQuery, 0x00, sizeof(sqlQuery));
                snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", MSGFW_SYNCML_MSG_TABLE_NAME, msgId);
 
-               /**  Delete SyncML Message from syncML table */
+               /*  Delete SyncML Message from syncML table */
                if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
                        dbHandle->endTrans(false);
                        return MSG_ERR_DB_EXEC;
                }
        }
 
-       /** Delete Message from msg table */
+       /* Delete Message from msg table */
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
        snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, msgId);
        if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
@@ -439,7 +439,7 @@ msg_error_t SmsPluginStorage::deleteSmsMessage(msg_message_id_t msgId)
                return MSG_ERR_DB_EXEC;
        }
 
-       /** Delete Message from msg_report table */
+       /* Delete Message from msg_report table */
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
        snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", MSGFW_SMS_REPORT_TABLE_NAME, msgId);
        if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
@@ -447,7 +447,7 @@ msg_error_t SmsPluginStorage::deleteSmsMessage(msg_message_id_t msgId)
                return MSG_ERR_DB_EXEC;
        }
 
-       /** Delete Message from msg_sim table */
+       /* Delete Message from msg_sim table */
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
        snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", MSGFW_SIM_MSG_TABLE_NAME, msgId);
        if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
@@ -455,13 +455,13 @@ msg_error_t SmsPluginStorage::deleteSmsMessage(msg_message_id_t msgId)
                return MSG_ERR_DB_EXEC;
        }
 
-       /**  Clear Conversation table */
+       /*  Clear Conversation table */
        if (MsgStoClearConversationTable(dbHandle) != MSG_SUCCESS) {
                dbHandle->endTrans(false);
                return MSG_ERR_DB_EXEC;
        }
 
-       /**  Update conversation table.*/
+       /*  Update conversation table.*/
        if (MsgStoUpdateConversation(dbHandle, convId) != MSG_SUCCESS) {
                dbHandle->endTrans(false);
                return MSG_ERR_STORAGE_ERROR;
@@ -472,14 +472,14 @@ msg_error_t SmsPluginStorage::deleteSmsMessage(msg_message_id_t msgId)
        if (folderId == MSG_INBOX_ID) {
                msgType.classType = MSG_CLASS_NONE;
 
-               /**  Set memory status in SIM */
+               /*  Set memory status in SIM */
                if (MsgStoCheckMsgCntFull(dbHandle, &msgType, folderId) == MSG_SUCCESS) {
                        MSG_DEBUG("Set Memory Status");
                        SmsPlgSetMemoryStatus(MSG_SUCCESS);
                }
        }
 
-//     MsgRefreshAllNotification(true, false, false);
+       /* MsgRefreshAllNotification(true, false, false); */
 
        return MSG_SUCCESS;
 }
@@ -495,14 +495,15 @@ msg_error_t SmsPluginStorage::addSmsSendOption(MSG_MESSAGE_INFO_S *pMsg, MSG_SEN
        if (pSendOptInfo->bSetting == false) {
                MsgSettingGetBool(SMS_SEND_DELIVERY_REPORT, &pSendOptInfo->bDeliverReq);
                MsgSettingGetBool(SMS_SEND_REPLY_PATH, &pSendOptInfo->option.smsSendOptInfo.bReplyPath);
-
-//             if (pSendOptInfo->bDeliverReq || pSendOptInfo->option.smsSendOptInfo.bReplyPath) {
-//                     pSendOptInfo->bSetting = true;
+               /*
+               if (pSendOptInfo->bDeliverReq || pSendOptInfo->option.smsSendOptInfo.bReplyPath) {
+                       pSendOptInfo->bSetting = true;
+               */
                        MsgSettingGetBool(MSG_KEEP_COPY, &pSendOptInfo->bKeepCopy);
-//             }
+               /* } */
        }
 
-//     if (pSendOptInfo->bSetting == true) {
+       /* if (pSendOptInfo->bSetting == true) { */
                char sqlQuery[MAX_QUERY_LEN+1];
 
                memset(sqlQuery, 0x00, sizeof(sqlQuery));
@@ -515,7 +516,7 @@ msg_error_t SmsPluginStorage::addSmsSendOption(MSG_MESSAGE_INFO_S *pMsg, MSG_SEN
                if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
                        err = MSG_ERR_DB_EXEC;
                }
-//     }
+       /* } */
 
        MSG_END();
 
@@ -542,13 +543,13 @@ msg_error_t SmsPluginStorage::checkStorageStatus(MSG_MESSAGE_INFO_S *pMsgInfo)
                        if (bAutoErase == true) {
                                msg_message_id_t msgId;
 
-                               /** Find the oldest message's msgId */
+                               /* Find the oldest message's msgId */
                                err = MsgStoGetOldestMessage(dbHandle, pMsgInfo, &msgId);
 
                                if (err != MSG_SUCCESS)
                                        return err;
 
-                               /** Delete the corresponding message. */
+                               /* Delete the corresponding message. */
                                err = deleteSmsMessage(msgId);
                        }
                }
@@ -580,8 +581,7 @@ msg_error_t SmsPluginStorage::getRegisteredPushEvent(char* pPushHeader, int *cou
        if (err == MSG_ERR_DB_NORECORD) {
                dbHandle->freeTable();
                return MSG_SUCCESS;
-       }
-       else if ( err != MSG_SUCCESS) {
+       } else if ( err != MSG_SUCCESS) {
                dbHandle->freeTable();
                return err;
        }
@@ -602,14 +602,14 @@ msg_error_t SmsPluginStorage::getRegisteredPushEvent(char* pPushHeader, int *cou
                dbHandle->getColumnToString(index++, MAX_WAPPUSH_ID_LEN + 1, appId);
                appcode = dbHandle->getColumnToInt(index++);
 
-               //MSG_DEBUG("content_type: %s, app_id: %s", content_type, app_id);
+               /* MSG_DEBUG("content_type: %s, app_id: %s", content_type, app_id); */
                _content_type = strcasestr(pPushHeader, contentType);
-               if(_content_type) {
+               if (_content_type) {
                        _app_id = strcasestr(pPushHeader, appId);
-                       if(appcode)
+                       if (appcode)
                                default_appcode = appcode;
 
-                       if(_app_id) {
+                       if (_app_id) {
                                PUSH_APPLICATION_INFO_S pInfo = {0, };
                                pInfo.appcode = appcode;
                                MSG_SEC_DEBUG("appcode: %d, app_id: %s", pInfo.appcode, appId);
@@ -622,9 +622,8 @@ msg_error_t SmsPluginStorage::getRegisteredPushEvent(char* pPushHeader, int *cou
                }
        }
 
-       if(!found && default_appcode != SMS_WAP_APPLICATION_LBS)
-       {
-               // perform default action.
+       if (!found && default_appcode != SMS_WAP_APPLICATION_LBS) {
+               /* perform default action. */
                PUSH_APPLICATION_INFO_S pInfo = {0, };
                pInfo.appcode = default_appcode;
                memset(appId, 0, MAX_WAPPUSH_ID_LEN + 1);
@@ -642,14 +641,13 @@ msg_error_t SmsPluginStorage::getRegisteredPushEvent(char* pPushHeader, int *cou
 msg_error_t SmsPluginStorage::getnthPushEvent(int index, int *appcode)
 {
        msg_error_t err = MSG_SUCCESS;
-       if((unsigned int)index > pushAppInfoList.size() - 1)
+       if ((unsigned int)index > pushAppInfoList.size() - 1)
                return MSG_ERR_INVALID_PARAMETER;
 
        std::list<PUSH_APPLICATION_INFO_S>::iterator it = pushAppInfoList.begin();
        int count = 0;
-       for (; it != pushAppInfoList.end(); it++)
-       {
-               if(index == count){
+       for (; it != pushAppInfoList.end(); it++) {
+               if (index == count){
                        *appcode = it->appcode;
                        break;
                }
index 6aa284b..25b8b27 100755 (executable)
@@ -1,30 +1,26 @@
 ï»¿/*
-* Copyright 2012-2013  Samsung Electronics Co., Ltd
-*
-* Licensed under the Flora License, Version 1.1 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*    http://floralicense.org/license/
-*
-* 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.
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
 */
 
-
 #include <errno.h>
 
 #include "MsgGconfWrapper.h"
 #include "MsgException.h"
 
 #include "MsgUtilStorage.h"
-
-#ifndef MSG_NOTIFICATION_NOT_SUPPORTED
 #include "MsgNotificationWrapper.h"
-#endif
 
 #include "SmsCdmaPluginTransport.h"
 #include "SmsCdmaPluginCodec.h"
@@ -102,17 +98,17 @@ unsigned char SmsPluginTransport::getSubmitMsgId()
 void SmsPluginTransport::convertMsgInfoToTelesvcMsg(const MSG_MESSAGE_INFO_S *pMsgInfo, sms_trans_msg_s *pTransMsg)
 {
        switch (pTransMsg->type) {
-               case SMS_TRANS_P2P_MSG:
-               {
-                       MSG_DEBUG("Convert  MSG_MESSAGE_INFO_S data to SMS_TRANS_MSG_S data.");
-                       sms_trans_p2p_msg_s *pPtpMsg = (sms_trans_p2p_msg_s *)&(pTransMsg->data.p2p_msg);
+       case SMS_TRANS_P2P_MSG:
+       {
+               MSG_DEBUG("Convert  MSG_MESSAGE_INFO_S data to SMS_TRANS_MSG_S data.");
+               sms_trans_p2p_msg_s *pPtpMsg = (sms_trans_p2p_msg_s *)&(pTransMsg->data.p2p_msg);
 
-                       convertMsgInfoToPtp(pMsgInfo, pPtpMsg);
-               }
-                       break;
-               default:
-                       MSG_DEBUG("Error Unsupported Transport Type");
-                       break;
+               convertMsgInfoToPtp(pMsgInfo, pPtpMsg);
+       }
+               break;
+       default:
+               MSG_DEBUG("Error Unsupported Transport Type");
+               break;
        }
 }
 
@@ -137,24 +133,23 @@ void SmsPluginTransport::convertMsgInfoToPtp(const MSG_MESSAGE_INFO_S *pMsgInfo,
        if (pMsgInfo->addressList[0].addressVal[0] == '+') {
                pPtpMsg->address.digit_mode = SMS_DIGIT_8BIT;
                pPtpMsg->address.number_type = SMS_NUMBER_TYPE_INTERNATIONAL;
-       }
-       else {
+       } else {
                pPtpMsg->address.number_type = SMS_NUMBER_TYPE_NATIONAL;
        }
 
        /* 4. Convert Sub-address values */
-       // TODO
+       /* TODO */
 
        /* 5. Set Reply sequence number. */
        pPtpMsg->reply_seq = getSeqNum();
 
        /* convert msgInfo to Teleservice Message */
        switch (pPtpMsg->telesvc_msg.type) {
-               case SMS_TYPE_SUBMIT:
-                       convertMsgInfoToSubmit(pMsgInfo, &(pPtpMsg->telesvc_msg.data.submit));
-                       break;
-               default:
-                       break;
+       case SMS_TYPE_SUBMIT:
+               convertMsgInfoToSubmit(pMsgInfo, &(pPtpMsg->telesvc_msg.data.submit));
+               break;
+       default:
+               break;
        }
 
 }
@@ -179,28 +174,19 @@ void SmsPluginTransport::convertMsgInfoToSubmit(const MSG_MESSAGE_INFO_S *pMsgIn
 
 
        if (pMsgInfo->bTextSms == true) {
-               if (pMsgInfo->encodeType == MSG_ENCODE_GSM7BIT)
-               {
+               if (pMsgInfo->encodeType == MSG_ENCODE_GSM7BIT) {
                        pSubmit->user_data.encode_type = SMS_ENCODE_GSM7BIT;
-               }
-               else if (pMsgInfo->encodeType == MSG_ENCODE_8BIT)
-               {
+               } else if (pMsgInfo->encodeType == MSG_ENCODE_8BIT) {
                        pSubmit->user_data.encode_type = SMS_ENCODE_OCTET;
-               }
-               else if (pMsgInfo->encodeType == MSG_ENCODE_UCS2)
-               {
+               } else if (pMsgInfo->encodeType == MSG_ENCODE_UCS2) {
                        pSubmit->user_data.encode_type = SMS_ENCODE_UNICODE;
-               }
-               else if (pMsgInfo->encodeType == MSG_ENCODE_AUTO)
-               {
+               } else if (pMsgInfo->encodeType == MSG_ENCODE_AUTO) {
                        textCvt->convertUTF8ToAuto(decodeData, SMS_MAX_USER_DATA_LEN + 1, (unsigned char*)pMsgInfo->msgText, (int)pMsgInfo->dataSize, &encodeType);
                        if (encodeType == MSG_ENCODE_ASCII7BIT) {
                                pSubmit->user_data.encode_type = SMS_ENCODE_7BIT_ASCII;
-                       }
-                       else if (encodeType == MSG_ENCODE_8BIT) {
+                       } else if (encodeType == MSG_ENCODE_8BIT) {
                                pSubmit->user_data.encode_type = SMS_ENCODE_OCTET;
-                       }
-                       else if (encodeType == MSG_ENCODE_UCS2) {
+                       } else if (encodeType == MSG_ENCODE_UCS2) {
                                pSubmit->user_data.encode_type = SMS_ENCODE_UNICODE;
                        }
                }
@@ -227,16 +213,16 @@ void SmsPluginTransport::convertMsgInfoToSubmit(const MSG_MESSAGE_INFO_S *pMsgIn
 #endif
 
        /* 4. Set Defer valid period */
-       // TODO
+       /* TODO */
 
        /* 5. Set Priority */
        switch (pMsgInfo->priority) {
-               case MSG_MESSAGE_PRIORITY_HIGH:
-                       pSubmit->priority = SMS_PRIORITY_URGENT;
-                       break;
-               default:
-                       pSubmit->priority = SMS_PRIORITY_NORMAL;
-                       break;
+       case MSG_MESSAGE_PRIORITY_HIGH:
+               pSubmit->priority = SMS_PRIORITY_URGENT;
+               break;
+       default:
+               pSubmit->priority = SMS_PRIORITY_NORMAL;
+               break;
        }
 
        /* 6. Set Privacy */
@@ -252,21 +238,20 @@ void SmsPluginTransport::convertMsgInfoToSubmit(const MSG_MESSAGE_INFO_S *pMsgIn
        pSubmit->language = SMS_LAN_UNKNOWN;
 
        /* 10. Set Callback number */
-       // TODO :: Set callback number to MSISDN
+       /* TODO :: Set callback number to MSISDN */
 
        /* 11. Set Multi encode data */
-       // TODO
+       /* TODO */
 
        /* 12. Set Deposit id */
-       // TODO
+       /* TODO */
 
        /* 13. Set Service category program data */
-       // TODO
+       /* TODO */
 
 }
 
 
-
 void SmsPluginTransport::submitRequest(sms_request_info_s *pReqInfo)
 {
        int tapiRet = TAPI_API_SUCCESS;
@@ -275,19 +260,19 @@ void SmsPluginTransport::submitRequest(sms_request_info_s *pReqInfo)
                THROW(MsgException::SMS_PLG_ERROR, "pReqInfo is NULL");
        }
 
-       // Get address informations.
+       /* Get address informations. */
        MsgDbHandler *dbHandle = getDbHandle();
-       //contacts-service is not used for gear
+       /* contacts-service is not used for gear */
 #ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
        MsgStoGetAddressByMsgId(dbHandle, pReqInfo->msgInfo.msgId, 0, &pReqInfo->msgInfo.nAddressCnt, &pReqInfo->msgInfo.addressList);
 #else
-       //contactNameOrder is never used
+       /*contactNameOrder is never used */
        MsgStoGetAddressByMsgId(dbHandle, pReqInfo->msgInfo.msgId, &pReqInfo->msgInfo.nAddressCnt, &pReqInfo->msgInfo.addressList);
-#endif //MSG_CONTACTS_SERVICE_NOT_SUPPORTED
+#endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */
 
        MSG_DEBUG("pReqInfo->msgInfo.nAddressCnt [%d]", pReqInfo->msgInfo.nAddressCnt);
 
-       // Get MSISDN
+       /* Get MSISDN */
        char *msisdn = NULL;
        char keyName[MAX_VCONFKEY_NAME_LEN];
        int simIndex = 1;
@@ -297,7 +282,7 @@ void SmsPluginTransport::submitRequest(sms_request_info_s *pReqInfo)
 
        msisdn = MsgSettingGetString(keyName);
 
-       // Tapi Data Structure
+       /* Tapi Data Structure */
        TelSmsDatapackageInfo_t tapi_data_pkg;
        memset(&tapi_data_pkg, 0x00, sizeof(TelSmsDatapackageInfo_t));
 
@@ -330,71 +315,72 @@ void SmsPluginTransport::submitRequest(sms_request_info_s *pReqInfo)
        }
        MSG_DEBUG("Encode PDU= [%s]", pduDbg);
 
-       /* send request */
        sms_network_status_t retStatus;
-       sms_sent_info_s sent_info;
-       memset(&sent_info, 0x00, sizeof(sms_sent_info_s));
-       memcpy(&sent_info.reqInfo, pReqInfo, sizeof(sent_info.reqInfo));
 
-       sent_info.bLast = true;
+       for (int cnt = 0; cnt < MAX_SMS_SEND_RETRY; ++cnt) {
+               /* send request */
+               sms_sent_info_s sent_info;
+               memset(&sent_info, 0x00, sizeof(sms_sent_info_s));
+               memcpy(&sent_info.reqInfo, pReqInfo, sizeof(sent_info.reqInfo));
 
-       SmsPluginEventHandler::instance()->SetSentInfo(&sent_info);
+               sent_info.bLast = true;
 
-       int svc_type;
-       tel_get_property_int(pTapiHandle, TAPI_PROP_NETWORK_SERVICE_TYPE, &svc_type);
+               SmsPluginEventHandler::instance()->SetSentInfo(&sent_info);
 
-       if(svc_type < TAPI_NETWORK_SERVICE_TYPE_2G){
-               MSG_DEBUG("Network service is not available : [%d]", svc_type);
-               SmsPluginEventHandler::instance()->handleSentStatus(MSG_NETWORK_SEND_PENDING);
-               goto _RETURN_FUNC;
-       }
+               int svc_type;
+               tel_get_property_int(pTapiHandle, TAPI_PROP_NETWORK_SERVICE_TYPE, &svc_type);
 
-       curStatus = SMS_NETWORK_SENDING;
+               if (svc_type < TAPI_NETWORK_SERVICE_TYPE_2G) {
+                       MSG_DEBUG("Network service is not available : [%d]", svc_type);
+                       SmsPluginEventHandler::instance()->handleSentStatus(MSG_NETWORK_SEND_PENDING);
+                       goto _RETURN_FUNC;
+               }
 
-       // Send SMS
-       tapiRet = tel_send_sms(pTapiHandle, &tapi_data_pkg, bMoreMsgToSend, TapiEventSentStatus, NULL);
+               curStatus = SMS_NETWORK_SENDING;
 
-       if (tapiRet == TAPI_API_SUCCESS)
-       {
-               MSG_DEBUG("########  tel_send_sms Success !!! return : [%d] #######", tapiRet);
-       }
-       else
-       {
-               SmsPluginEventHandler::instance()->handleSentStatus(MSG_NETWORK_SEND_FAIL);
-               THROW(MsgException::SMS_PLG_ERROR, "########  tel_send_sms Fail !!! return : [%d] #######", tapiRet);
-       }
+               /* Send SMS */
+               tapiRet = tel_send_sms(pTapiHandle, &tapi_data_pkg, bMoreMsgToSend, TapiEventSentStatus, NULL);
 
-       // Tizen Validation System
-       MSG_SMS_VLD_INFO("%d, SMS Send Start, %s->%s, %s",  pReqInfo->msgInfo.msgId, \
-                                                                                                                               (msisdn == NULL)?"ME":msisdn, \
-                                                                                                                               pReqInfo->msgInfo.addressList[0].addressVal, \
-                                                                                                                               (tapiRet == TAPI_API_SUCCESS)?"Success":"Fail");
+               if (tapiRet == TAPI_API_SUCCESS) {
+                       MSG_DEBUG("########  tel_send_sms Success !!! return : [%d] #######", tapiRet);
+               } else {
+                       SmsPluginEventHandler::instance()->handleSentStatus(MSG_NETWORK_SEND_FAIL);
+                       THROW(MsgException::SMS_PLG_ERROR, "########  tel_send_sms Fail !!! return : [%d] #######", tapiRet);
+               }
 
-       MSG_SMS_VLD_TXT("%d, [%s]", pReqInfo->msgInfo.msgId, pReqInfo->msgInfo.msgText);
+               /* Tizen Validation System */
+               MSG_SMS_VLD_INFO("%d, SMS Send Start, %s->%s, %s",  pReqInfo->msgInfo.msgId, \
+                                                                                                                                       (msisdn == NULL)?"ME":msisdn, \
+                                                                                                                                       pReqInfo->msgInfo.addressList[0].addressVal, \
+                                                                                                                                       (tapiRet == TAPI_API_SUCCESS)?"Success":"Fail");
 
-       retStatus = getNetStatus();
+               MSG_SMS_VLD_TXT("%d, [%s]", pReqInfo->msgInfo.msgId, pReqInfo->msgInfo.msgText);
+
+               retStatus = getNetStatus();
+
+               if (retStatus != SMS_NETWORK_SEND_FAIL_TEMPORARY)
+                       break;
+       }
 
        MSG_SMS_VLD_INFO("%d, SMS Send End, %s->%s, %s",  pReqInfo->msgInfo.msgId, \
                                                                                                                        (msisdn == NULL)?"ME":msisdn, \
                                                                                                                        pReqInfo->msgInfo.addressList[0].addressVal, \
                                                                                                                        (retStatus == SMS_NETWORK_SEND_SUCCESS)?"Success":"Fail");
 
-       if (retStatus == SMS_NETWORK_SEND_SUCCESS)
-       {
+       if (retStatus == SMS_NETWORK_SEND_SUCCESS) {
                MSG_DEBUG("########  Msg Sent was Successful !!! #######");
-       }
-       else
-       {
-               if (retStatus == SMS_NETWORK_SEND_FAIL_TIMEOUT)
+       } else {
+               if (retStatus == SMS_NETWORK_SEND_FAIL_TIMEOUT || retStatus == SMS_NETWORK_SEND_FAIL_TEMPORARY
+                       || retStatus == SMS_NETWORK_SEND_FAIL_MANDATORY_INFO_MISSING || retStatus == SMS_NETWORK_SEND_FAIL_FDN_RESTRICED)
                        SmsPluginEventHandler::instance()->handleSentStatus(MSG_NETWORK_SEND_FAIL);
 
-               if (retStatus == SMS_NETWORK_SEND_FAIL_FDN_RESTRICED) {
+               if (retStatus == SMS_NETWORK_SEND_FAIL_FDN_RESTRICED)
                        MsgInsertTicker("Unable to send the message while Fixed dialling mode is enabled", SMS_FDN_RESTRICTED, true, 0);
-               } else if(retStatus == SMS_NETWORK_SEND_PENDING) {
+               else if (retStatus == SMS_NETWORK_SEND_PENDING)
                        MsgInsertTicker("Unable to send message. It will be sent when service available.", SMS_MESSAGE_SENDING_PENDING, true, 0);
-               }else {
+               else
                        MsgInsertTicker("Sending SMS is failed", SMS_MESSAGE_SENDING_FAIL, true, pReqInfo->msgInfo.msgId);
-               }
+
        }
 
 _RETURN_FUNC :
@@ -408,6 +394,7 @@ _RETURN_FUNC :
        return;
 }
 
+
 void SmsPluginTransport::sendDeliverReport(msg_error_t err, sms_trans_p2p_msg_s *p_p2p_msg)
 {
        MSG_BEGIN();
@@ -430,24 +417,19 @@ void SmsPluginTransport::sendDeliverReport(msg_error_t err, sms_trans_p2p_msg_s
                cause_code.reply_seq = p_p2p_msg->reply_seq;
 
 
-       if (err == MSG_SUCCESS)
-       {
+       if (err == MSG_SUCCESS) {
                cause_code.error_class = SMS_TRANS_ERR_CLASS_NONE;
 
                response = TAPI_NETTEXT_SENDSMS_SUCCESS;
 
-               if(isMemAvailable == false)
-               {
+               if (isMemAvailable == false) {
                        tapiRet = tel_set_sms_memory_status(pTapiHandle, TAPI_NETTEXT_PDA_MEMORY_STATUS_AVAILABLE, TapiEventMemoryStatus, NULL);
 
                        if (tapiRet == TAPI_API_SUCCESS)
-                       {
                                MSG_DEBUG("########  tel_set_sms_memory_status() Success !!! #######");
-                       }
                        else
-                       {
                                MSG_DEBUG("########  tel_set_sms_memory_status() Failed !!! return : [%d] #######", tapiRet);
-                       }
+
                }
 
        } else if (err == MSG_ERR_MESSAGE_COUNT_FULL) {
@@ -455,18 +437,15 @@ void SmsPluginTransport::sendDeliverReport(msg_error_t err, sms_trans_p2p_msg_s
                cause_code.error_class = SMS_TRANS_ERR_CLASS_TEMPORARY;
 
                response = TAPI_NETTEXT_ME_FULL;
-//             MsgInsertTicker("Not enough memory. Delete some items.", SMS_MESSAGE_MEMORY_FULL, true, 0);
+               /* MsgInsertTicker("Not enough memory. Delete some items.", SMS_MESSAGE_MEMORY_FULL, true, 0); */
 
                tapiRet = tel_set_sms_memory_status(pTapiHandle, TAPI_NETTEXT_PDA_MEMORY_STATUS_FULL, TapiEventMemoryStatus, NULL);
 
                if (tapiRet == TAPI_API_SUCCESS)
-               {
                        MSG_DEBUG("########  tel_set_sms_memory_status() Success !!! #######");
-               }
                else
-               {
                        MSG_DEBUG("########  tel_set_sms_memory_status() Failed !!! return : [%d] #######", tapiRet);
-               }
+
        } else if (err == MSG_ERR_UNKNOWN) {
                cause_code.error_class = SMS_TRANS_ERR_CLASS_TEMPORARY;
                cause_code.cause_code = SMS_CAUSE_CODE_SERVICE_TERMINATION_DENIED;
@@ -478,9 +457,7 @@ void SmsPluginTransport::sendDeliverReport(msg_error_t err, sms_trans_p2p_msg_s
                cause_code.cause_code = SMS_CAUSE_CODE_INVAILD_TELESERVICE_ID;
 
                response = TAPI_NETTEXT_INVALID_MSG;
-       }
-       else
-       {
+       } else {
                cause_code.error_class = SMS_TRANS_ERR_CLASS_TEMPORARY;
                response = TAPI_NETTEXT_SIM_FULL;
 
@@ -498,18 +475,17 @@ void SmsPluginTransport::sendDeliverReport(msg_error_t err, sms_trans_p2p_msg_s
 
 
        MSG_DEBUG("######## DeliverReport tpdu #########");
-       for(int i=0; i < bufLen; i++)
-       {
+       for (int i=0; i < bufLen; i++) {
                printf("[%02x] ", buf[i]);
        }
        MSG_DEBUG("#################################");
 
-       // Make Telephony Structure
+       /* Make Telephony Structure */
        TelSmsDatapackageInfo_t pkgInfo;
 
        pkgInfo.format = TAPI_NETTEXT_NETTYPE_3GPP2;
 
-       // Set TPDU data
+       /* Set TPDU data */
        memset((void*)pkgInfo.szData, 0x00, sizeof(pkgInfo.szData));
        memcpy((void*)pkgInfo.szData, buf, bufLen);
 
@@ -517,17 +493,13 @@ void SmsPluginTransport::sendDeliverReport(msg_error_t err, sms_trans_p2p_msg_s
        pkgInfo.MsgLength = bufLen;
 
 
-       // Send Deliver Report
+       /* Send Deliver Report */
        tapiRet = tel_send_sms_deliver_report(pTapiHandle, &pkgInfo, response, TapiEventDeliveryReportCNF, NULL);
 
        if (tapiRet == TAPI_API_SUCCESS)
-       {
                MSG_DEBUG("########  tel_send_sms_deliver_report() Success !!! #######");
-       }
        else
-       {
                MSG_DEBUG("########  tel_send_sms_deliver_report() Fail !!! return : [%d] #######", tapiRet);
-       }
 
        MSG_END();
 }
@@ -553,8 +525,7 @@ sms_network_status_t SmsPluginTransport::getNetStatus()
 
        mx.unlock();
 
-       if (ret == ETIMEDOUT)
-       {
+       if (ret == ETIMEDOUT) {
                MSG_DEBUG("WARNING: SENT STATUS TIME-OUT");
                curStatus = SMS_NETWORK_SEND_FAIL_TIMEOUT;
        }
index 986e6f6..1b4f52f 100755 (executable)
@@ -1,21 +1,19 @@
-
-/*
-* Copyright 2012-2013  Samsung Electronics Co., Ltd
-*
-* Licensed under the Flora License, Version 1.1 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*    http://floralicense.org/license/
-*
-* 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.
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
 */
 
-
 #include "MsgException.h"
 #include "MsgCppTypes.h"
 #include "SmsCdmaPluginUAManager.h"
@@ -50,8 +48,7 @@ SmsPluginUAManager* SmsPluginUAManager::instance()
 
 void SmsPluginUAManager::run()
 {
-       while (1)
-       {
+       while (1) {
                lock();
                while (smsTranQ.empty()) {
                        wait();
@@ -63,21 +60,16 @@ void SmsPluginUAManager::run()
                request.msgInfo.addressList = NULL;
                unique_ptr<MSG_ADDRESS_INFO_S*, void(*)(MSG_ADDRESS_INFO_S**)> addressListBuf(&request.msgInfo.addressList, unique_ptr_deleter);
 
-               try
-               {
+               try {
                        SmsPluginTransport::instance()->submitRequest(&request);
-               }
-               catch (MsgException& e)
-               {
+               } catch (MsgException& e) {
                        MSG_FATAL("%s", e.what());
 
                        lock();
                        smsTranQ.pop_front();
                        unlock();
                        continue;
-               }
-               catch (exception& e)
-               {
+               } catch (exception& e) {
                        MSG_FATAL("%s", e.what());
                        lock();
                        smsTranQ.pop_front();
@@ -103,4 +95,3 @@ void SmsPluginUAManager::addReqEntity(sms_request_info_s *request)
        cv.signal();
        unlock();
 }
-
index 20e7d2b..aa1fb9f 100755 (executable)
@@ -1,17 +1,17 @@
 /*
-* Copyright 2012-2013  Samsung Electronics Co., Ltd
-*
-* Licensed under the Flora License, Version 1.1 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*    http://floralicense.org/license/
-*
-* 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.
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
 */
 
 #include "MsgDebug.h"
@@ -26,7 +26,6 @@
 
 #include <glib.h>
 #include <gio/gio.h>
-
 #if MSG_DRM_SUPPORT
 #include <drm_client.h>
 #endif
@@ -44,8 +43,7 @@ const unsigned long wspLanguageCount    = 0x11a;
 const unsigned char wspSecurityTypeCount = 0x04;
 
 
-static const SMS_WSP_CONTENTS_TYPE_S wspExtendedContentsType[] =
-{
+static const SMS_WSP_CONTENTS_TYPE_S wspExtendedContentsType[] = {
        { (char*)"text/vnd/wap/connectivity-xml", 0x35 },
        { (char*)"application/vnd.wap.connectivity-wbxml", 0x36 },
        { (char*)"application/pkcs7-mime",  0x37 },
@@ -78,81 +76,79 @@ static const SMS_WSP_CONTENTS_TYPE_S wspExtendedContentsType[] =
 };
 
 
-const char* wspHeaderFieldName[] =
-{
-       (char*)"Accept",  //0x00
+const char* wspHeaderFieldName[] = {
+       (char*)"Accept", /* 0x00 */
        (char*)"Accept-Charset",
        (char*)"Accept-Encoding",
        (char*)"Accept-Language",
        (char*)"Accept-Ranges",
-       (char*)"Age", //0x05
+       (char*)"Age", /* 0x05 */
        (char*)"Allow",
        (char*)"Authorization",
        (char*)"Cache-Control",
        (char*)"Connection",
-       (char*)"Content-Base", //0x0a
+       (char*)"Content-Base", /* 0x0a */
        (char*)"Content-Encoding",
        (char*)"Content-Language",
        (char*)"Content-Length",
        (char*)"Content-Location",
        (char*)"Content-MD5",
-       (char*)"Content-Range", //0x10
+       (char*)"Content-Range", /* 0x10 */
        (char*)"Content-Type",
        (char*)"Date",
        (char*)"ETag",
        (char*)"Expires",
-       (char*)"From", //0x15
+       (char*)"From", /* 0x15 */
        (char*)"Host",
        (char*)"If-Modified-Since",
        (char*)"If-Match",
        (char*)"If-None-Match",
-       (char*)"If-Range", //0x1a
+       (char*)"If-Range", /* 0x1a */
        (char*)"If-Unmodified-Since",
        (char*)"Location",
        (char*)"Last-Modified",
        (char*)"Max-Forwards",
        (char*)"Pragma",
-       (char*)"Proxy-Authenticate", //0x20
+       (char*)"Proxy-Authenticate", /* 0x20 */
        (char*)"Proxy-Authorization",
        (char*)"Public",
        (char*)"Range",
        (char*)"Referer",
-       (char*)"Retry-After", //0x25
+       (char*)"Retry-After", /* 0x25 */
        (char*)"Server",
        (char*)"Transfer-Encodig",
        (char*)"Upgrade",
        (char*)"User-Agent",
-       (char*)"Vary", //0x2a
+       (char*)"Vary", /* 0x2a */
        (char*)"Via",
        (char*)"Warning",
        (char*)"Www-Authenticate",
        (char*)"Content-Disposition",
        (char*)"X-Wap-Application-Id",
-       (char*)"X-Wap-Content-URI", //0x30
+       (char*)"X-Wap-Content-URI", /* 0x30 */
        (char*)"X-Wap-Iinitiator-URI",
-       (char*)"Accept-Application", // Back
+       (char*)"Accept-Application", /* Back */
        (char*)"Bearer-Indication",
        (char*)"Push-Flag",
-       (char*)"Profile", //0x35
+       (char*)"Profile", /* 0x35 */
        (char*)"Profile-Diff",
-       (char*)"Profile-Warning", // end of WAP 1.2
+       (char*)"Profile-Warning", /* end of WAP 1.2 */
        (char*)"Expect",
        (char*)"Te",
-       (char*)"Trailer", //0x3a
-       (char*)"Accept-Charset", //Back
-       (char*)"Accept-Encoding", // Back
-       (char*)"Cache-Control", // back
+       (char*)"Trailer", /* 0x3a */
+       (char*)"Accept-Charset", /* Back */
+       (char*)"Accept-Encoding", /* Back */
+       (char*)"Cache-Control", /* back */
        (char*)"Content-Range",
        (char*)"X-Wap-Tod",
-       (char*)"Content-ID", //x40
+       (char*)"Content-ID", /*x40 */
        (char*)"Set-Cookie",
        (char*)"Cookie",
        (char*)"Encoding-Version"
 };
 
 
-const SMS_WSP_CHARSET_S wspCharset[] =
-{
+const SMS_WSP_CHARSET_S wspCharset[] = {
        { (char*)"big5", 0x07ea },
        { (char*)"iso-10646-ucs-2", 0x03e8 },
        { (char*)"iso-8859-1", 0x04 },
@@ -172,17 +168,14 @@ const SMS_WSP_CHARSET_S wspCharset[] =
 };
 
 
-
-const char* wspEncodeMethod[] =
-{
+const char* wspEncodeMethod[] = {
        (char*)"Gzip",
        (char*)"Compress",
        (char*)"Deflate"
 };
 
 
-const SMS_WSP_CONTENTS_TYPE_S wspContentsType[] =
-{
+const SMS_WSP_CONTENTS_TYPE_S wspContentsType[] = {
        { (char*)"*/*", 0x00 },
        { (char*)"text/*", 0x01 },
        { (char*)"text/html", 0x02 },
@@ -259,17 +252,18 @@ const SMS_WSP_CONTENTS_TYPE_S wspContentsType[] =
        { (char*)"application/vnd.wv.csp.cir", 0x46 }
 };
 
-static const SMS_WAP_UNREGISTER_CONTENTS_TYPE_S wspUnregisterContentsType[]=
-{
+
+static const SMS_WAP_UNREGISTER_CONTENTS_TYPE_S wspUnregisterContentsType[]= {
        { (char*)"application/vnd.wap.emn+wbxml", 0x30A},
        { (char*)"application/vnd.omaloc-supl-init", 0x312},
        { (char*)"application/vnd.oma.drm.roap-trigger+wbxml", 0x316}
 };
 
+
 const unsigned long wspUnregisteredContentsTypeCount = sizeof(wspUnregisterContentsType)/sizeof(SMS_WAP_UNREGISTER_CONTENTS_TYPE_S);
 
-const SMS_WSP_LANGUAGE_S wspLanguage[] =
-{
+
+const SMS_WSP_LANGUAGE_S wspLanguage[] = {
        { (char*)"English", 0x19 },
        { (char*)"en", 0x19 },
        { (char*)"Korean", 0x3d },
@@ -556,8 +550,7 @@ const SMS_WSP_LANGUAGE_S wspLanguage[] =
 };
 
 
-const SMS_WSP_HEADER_PARAMETER_S wspHeaderApplId[] =
-{
+const SMS_WSP_HEADER_PARAMETER_S wspHeaderApplId[] = {
        { (char*)"x-wap-application:*",  0x00 },
        { (char*)"x-wap-application:push.sia",  0x01},
        { (char*)"x-wap-application:wml.ua",  0x02 },
@@ -586,8 +579,7 @@ const SMS_WSP_HEADER_PARAMETER_S wspHeaderApplId[] =
 };
 
 
-const char* wspCacheControl[] =
-{
+const char* wspCacheControl[] = {
        (char*)"No-cache",
        (char*)"No-store",
        (char*)"Max-age",
@@ -601,8 +593,7 @@ const char* wspCacheControl[] =
        (char*)"Proxy-revalidate"
 };
 
-const SMS_WSP_METHOD_TYPE_S wspMethodType[] =
-{
+const SMS_WSP_METHOD_TYPE_S wspMethodType[] = {
        { (char*)"GET", 0x40 },
        { (char*)"OPTIONS", 0x41 },
        { (char*)"HEAD", 0x42 },
@@ -613,8 +604,7 @@ const SMS_WSP_METHOD_TYPE_S wspMethodType[] =
 };
 
 
-const SMS_WSP_SECURITY_TYPE_S wspSecurityType[] =
-{
+const SMS_WSP_SECURITY_TYPE_S wspSecurityType[] = {
        {(char*)"NETWPIN",0x00},
        {(char*)"USERPIN",0x01},
        {(char*)"USERNETWPIN",0x02},
@@ -623,8 +613,7 @@ const SMS_WSP_SECURITY_TYPE_S wspSecurityType[] =
 
 
 
-const char* wspWeek[] =
-{
+const char* wspWeek[] = {
        (char*)"Sun",
        (char*)"Mon",
        (char*)"Tue",
@@ -635,8 +624,7 @@ const char* wspWeek[] =
 };
 
 
-const char* wspWeekDay[] =
-{
+const char* wspWeekDay[] = {
        (char*)"Sunday",
        (char*)"Monday",
        (char*)"Tuesday",
@@ -646,8 +634,7 @@ const char* wspWeekDay[] =
        (char*)"Saturday"
 };
 
-const char* wspMonth[] =
-{
+const char* wspMonth[] = {
        (char*)"Jan",
        (char*)"Feb",
        (char*)"Mar",
@@ -690,6 +677,7 @@ SmsPluginWapPushHandler* SmsPluginWapPushHandler::instance()
        return pInstance;
 }
 
+
 bool SmsPluginWapPushHandler::IsWapPushMsg(unsigned short dstport)
 {
        MSG_BEGIN();
@@ -771,8 +759,7 @@ void SmsPluginWapPushHandler::handleWapPushMsg(const char *pUserData, int DataSi
        MSG_DEBUG("DataSize [%d]", DataSize);
 
        MSG_DEBUG("[pUserData]");
-       for (int i = 0; i < DataSize; i++)
-       {
+       for (int i = 0; i < DataSize; i++) {
                printf("[%02x]", pUserData[i]);
        }
        printf("\n\n");
@@ -799,7 +786,7 @@ void SmsPluginWapPushHandler::handleWapPushMsg(const char *pUserData, int DataSi
        unique_ptr<char*, void(*)(char**)> WspBodyBuf(&pWspBody, unique_ptr_deleter);
        unsigned long wspBodyLen = 0;
 
-       /** pass PDU type */
+       /* pass PDU type */
        iPDU++;
 
        pushHeaderLen = wspRetriveUintvarDecode( pPDUTypeData, &iPDU );
@@ -828,20 +815,19 @@ void SmsPluginWapPushHandler::handleWapPushMsg(const char *pUserData, int DataSi
        MSG_DEBUG("wspHeaderLen [%d]", wspHeaderLen);
 
        MSG_DEBUG("[pWspHeader]");
-       for (int i = 0; i < wspHeaderLen; i++)
-       {
+       for (int i = 0; i < wspHeaderLen; i++) {
                printf("[%02x]", pWspHeader[i]);
        }
        printf("\n\n");
 #endif
 
-       /** return if it is below case error */
+       /* return if it is below case error */
        if (PDUTypeDataLen < wspHeaderLen) {
                MSG_DEBUG("PDUTypeDataLen < wspHeaderLen !!!");
                return;
        }
 
-       /** Finding wspBody Information */
+       /* Finding wspBody Information */
        wspBodyLen = PDUTypeDataLen - wspHeaderLen;
 
        if (wspBodyLen > 0) {
@@ -867,7 +853,7 @@ void SmsPluginWapPushHandler::handleWapPushMsg(const char *pUserData, int DataSi
        if (pushBodyLen > 0) {
                pPushBody = new char[pushBodyLen];
 
-               if (pPushBody == NULL)  {
+               if (pPushBody == NULL) {
                        MSG_DEBUG("pPushBody Memory Allocation Failed");
                        return;
                } else {
@@ -895,7 +881,7 @@ void SmsPluginWapPushHandler::handleWapPushCallback(char* pPushHeader, char* pPu
 
        SMS_WAP_APP_CODE_T      appCode = getAppCode(pPushHeader);
 
-       /**  check Push message receive setting */
+       /*  check Push message receive setting */
        bool bPushRecv = false;
 
        MsgSettingGetBool(PUSH_RECV_OPTION, &bPushRecv);
@@ -910,118 +896,95 @@ void SmsPluginWapPushHandler::handleWapPushCallback(char* pPushHeader, char* pPu
                MSG_DEBUG("Received MMS Notification");
                handleMMSNotification(pPushBody, PushBodyLen);
                break;
-
        case SMS_WAP_APPLICATION_PUSH_SI:
                MSG_DEBUG("Received WAP Push (Service Indication Textual form)");
                handleSIMessage(pPushBody, PushBodyLen, true);
                break;
-
        case SMS_WAP_APPLICATION_PUSH_SIC:
                MSG_DEBUG("Received WAP Push (Service Indication Tokenised form)");
                handleSIMessage(pPushBody, PushBodyLen, false);
-               break;
-
+       break;
        case SMS_WAP_APPLICATION_PUSH_SL:
                MSG_DEBUG("Received WAP Push (Service Loading Textual form)");
                handleSLMessage(pPushBody, PushBodyLen, true);
                break;
-
        case SMS_WAP_APPLICATION_PUSH_SLC:
                MSG_DEBUG("Received WAP Push (Service Loading Tokenised form)");
                handleSLMessage(pPushBody, PushBodyLen, false);
-               break;
-
+       break;
        case SMS_WAP_APPLICATION_PUSH_CO:
                MSG_DEBUG("Received WAP Push (Cache Operation Textual form)");
                handleCOMessage(pPushBody, PushBodyLen, true);
                break;
-
        case SMS_WAP_APPLICATION_PUSH_COC:
                MSG_DEBUG("Received WAP Push (Cache Operation Tokenised form)");
                handleCOMessage(pPushBody, PushBodyLen, false);
                break;
-
        case SMS_WAP_APPLICATION_SYNCML_DM_BOOTSTRAP:
                MSG_DEBUG("Received DM BOOTSTRAP");
                SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(DM_WBXML, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
                break;
-
        case SMS_WAP_APPLICATION_SYNCML_DM_BOOTSTRAP_XML:
                MSG_DEBUG("Received DM BOOTSTRAP");
                SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(DM_XML, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
                break;
-
        case SMS_WAP_APPLICATION_PUSH_PROVISIONING_XML:
                MSG_DEBUG("Received Provisioning");
                SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(CP_XML, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
                break;
-
        case SMS_WAP_APPLICATION_PUSH_PROVISIONING_WBXML:
                MSG_DEBUG("Received Provisioning");
                SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(CP_WBXML, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
                break;
-
        case SMS_WAP_APPLICATION_PUSH_BROWSER_SETTINGS:
        case SMS_WAP_APPLICATION_PUSH_BROWSER_BOOKMARKS:
                MSG_DEBUG("Received Provisioning");
                SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(OTHERS, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
                break;
-
        case SMS_WAP_APPLICATION_SYNCML_DM_NOTIFICATION:
                MSG_DEBUG("Received DM Notification");
                SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(DM_NOTIFICATION, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
                break;
-
        case SMS_WAP_APPLICATION_SYNCML_DS_NOTIFICATION:
                MSG_DEBUG("Received DS Notification");
                SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(DS_NOTIFICATION, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
                break;
-
        case SMS_WAP_APPLICATION_SYNCML_DS_NOTIFICATION_WBXML:
                MSG_DEBUG("Received DS Notification");
                SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(DS_WBXML, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
                break;
-
        case SMS_WAP_APPLICATION_DRM_UA_RIGHTS_XML:
        case SMS_WAP_APPLICATION_DRM_UA_RIGHTS_WBXML:
                MSG_DEBUG("Received DRM UA");
-
                if (pPushBody != NULL)
                        handleDrmVer1(pPushBody, PushBodyLen);
-
                break;
-
        case SMS_WAP_APPLICATION_DRM_V2_RO_XML:
        case SMS_WAP_APPLICATION_DRM_V2_ROAP_PDU_XML:
        case SMS_WAP_APPLICATION_DRM_V2_ROAP_TRIGGER_XML:
        case SMS_WAP_APPLICATION_DRM_V2_ROAP_TRIGGER_WBXML:
                MSG_DEBUG("Received DRM V2");
-               // TODO: DRM V2
+               /* TODO: DRM V2 */
                break;
-
        case SMS_WAP_APPLICATION_PUSH_EMAIL:
        case SMS_WAP_APPLICATION_PUSH_EMAIL_XML:
        case SMS_WAP_APPLICATION_PUSH_EMAIL_WBXML:
                MSG_DEBUG("Received Email");
-               // TODO: Email
+               /* TODO: Email */
                break;
-
        case SMS_WAP_APPLICATION_PUSH_IMPS_CIR:
                MSG_DEBUG("Received IMPS CIR");
-               // TODO: IMPS CIR
+               /* TODO: IMPS CIR */
                break;
-
-       case SMS_WAP_APPLICATION_LBS :
+       case SMS_WAP_APPLICATION_LBS:
                MSG_DEBUG("Received LBS related message");
                SmsPluginEventHandler::instance()->handleLBSMsgIncoming(pPushHeader, pPushBody, PushBodyLen);
-               // TODO: LBS
+               /* TODO: LBS */
                break;
-
-       case SMS_WAP_APPLICATION_PUSH_SIA :
+       case SMS_WAP_APPLICATION_PUSH_SIA:
                MSG_DEBUG("Received SIA");
-               // TODO: SIA
+               /* TODO: SIA */
                break;
-
        default:
                MSG_DEBUG("Unknown Application [%d]", appCode);
                break;
@@ -1042,91 +1005,83 @@ static void launchProcessByAppcode(int appcode)
        GVariant *result_agent = NULL;
        GVariant *result_service = NULL;
 
-       switch(appcode){
-               case SMS_WAP_APPLICATION_SYNCML_DM_BOOTSTRAP:
-               case SMS_WAP_APPLICATION_SYNCML_DM_BOOTSTRAP_XML:
-               case SMS_WAP_APPLICATION_PUSH_PROVISIONING_XML:
-               case SMS_WAP_APPLICATION_PUSH_PROVISIONING_WBXML:
-               case SMS_WAP_APPLICATION_PUSH_BROWSER_SETTINGS:
-               case SMS_WAP_APPLICATION_PUSH_BROWSER_BOOKMARKS:
-               case SMS_WAP_APPLICATION_SYNCML_DM_NOTIFICATION:
-                       {
-                               connection_agent = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
-                               if (error) {
-                                       MSG_DEBUG("Connecting to system bus failed: %s\n", error->message);
-                                       goto _DBUS_ERROR;
-                               }
-
+       switch (appcode) {
+       case SMS_WAP_APPLICATION_SYNCML_DM_BOOTSTRAP:
+       case SMS_WAP_APPLICATION_SYNCML_DM_BOOTSTRAP_XML:
+       case SMS_WAP_APPLICATION_PUSH_PROVISIONING_XML:
+       case SMS_WAP_APPLICATION_PUSH_PROVISIONING_WBXML:
+       case SMS_WAP_APPLICATION_PUSH_BROWSER_SETTINGS:
+       case SMS_WAP_APPLICATION_PUSH_BROWSER_BOOKMARKS:
+       case SMS_WAP_APPLICATION_SYNCML_DM_NOTIFICATION:
+               {
+                       connection_agent = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
+                       if (error) {
+                               MSG_DEBUG("Connecting to system bus failed: %s\n", error->message);
+                               goto _DBUS_ERROR;
+                       }
                                dbus_proxy_agent = g_dbus_proxy_new_sync(connection_agent, G_DBUS_PROXY_FLAGS_NONE,
-                                                                                       NULL, "org.tizen.omadmagent", "/org/tizen/omadmagent",
-                                                                                       "org.tizen.omadmagent", NULL, &error);
-                               if (error) {
-                                       MSG_DEBUG("Connecting to agent proxy failed: %s\n", error->message);
-                                       goto _DBUS_ERROR;
-                               }
-
+                                                                               NULL, "org.tizen.omadmagent", "/org/tizen/omadmagent",
+                                                                               "org.tizen.omadmagent", NULL, &error);
+                       if (error) {
+                               MSG_DEBUG("Connecting to agent proxy failed: %s\n", error->message);
+                               goto _DBUS_ERROR;
+                       }
                                result_agent = g_dbus_proxy_call_sync(dbus_proxy_agent, "Hello_Agent", NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
-                               if (error) {
-                                       MSG_DEBUG("invoking agent proxy call failed: %s\n", error->message);
-                                       goto _DBUS_ERROR;
-                               }
-
+                       if (error) {
+                               MSG_DEBUG("invoking agent proxy call failed: %s\n", error->message);
+                               goto _DBUS_ERROR;
+                       }
                                connection_service = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
-                               if (error) {
-                                       MSG_DEBUG("Connecting to system bus failed: %s\n", error->message);
-                                       goto _DBUS_ERROR;
-                               }
-
+                       if (error) {
+                               MSG_DEBUG("Connecting to system bus failed: %s\n", error->message);
+                               goto _DBUS_ERROR;
+                       }
                                dbus_proxy_service =g_dbus_proxy_new_sync(connection_service, G_DBUS_PROXY_FLAGS_NONE, NULL,
-                                                                                       "org.tizen.omadmservice", "/org/tizen/omadmservice",
-                                                                                       "org.tizen.omadmservice", NULL, &error);
-                               if (error) {
-                                       MSG_DEBUG("Connecting to service proxy failed: %s\n", error->message);
-                                       goto _DBUS_ERROR;
-                               }
-
+                                                                               "org.tizen.omadmservice", "/org/tizen/omadmservice",
+                                                                               "org.tizen.omadmservice", NULL, &error);
+                       if (error) {
+                               MSG_DEBUG("Connecting to service proxy failed: %s\n", error->message);
+                               goto _DBUS_ERROR;
+                       }
                                result_service = g_dbus_proxy_call_sync(dbus_proxy_service, "wakeup", NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
-                               if (error) {
-                                       MSG_DEBUG("invoking service proxy call failed: %s\n", error->message);
-                                       goto _DBUS_ERROR;
-                               }
-
-                               Mutex mx;
-                               CndVar cv;
-                               mx.lock();
-                               cv.timedwait(mx.pMutex(), 2);
-                               mx.unlock();
-
-                               MSG_END();
+                       if (error) {
+                               MSG_DEBUG("invoking service proxy call failed: %s\n", error->message);
+                               goto _DBUS_ERROR;
+                       }
+                       Mutex mx;
+                       CndVar cv;
+                       mx.lock();
+                       cv.timedwait(mx.pMutex(), 2);
+                       mx.unlock();
+                       MSG_END();
+               }
+       break;
+       case SMS_WAP_APPLICATION_SYNCML_DS_NOTIFICATION:
+       case SMS_WAP_APPLICATION_SYNCML_DS_NOTIFICATION_WBXML:
+               {
+                       connection_agent = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
+                       if (error) {
+                               MSG_DEBUG("Connecting to system bus failed: %s\n", error->message);
+                               goto _DBUS_ERROR;
                        }
-                       break;
-               case SMS_WAP_APPLICATION_SYNCML_DS_NOTIFICATION:
-               case SMS_WAP_APPLICATION_SYNCML_DS_NOTIFICATION_WBXML:
-                       {
-                               connection_agent = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
-                               if (error) {
-                                       MSG_DEBUG("Connecting to system bus failed: %s\n", error->message);
-                                       goto _DBUS_ERROR;
-                               }
-
-                               dbus_proxy_agent = g_dbus_proxy_new_sync(connection_agent, G_DBUS_PROXY_FLAGS_NONE, NULL,
-                                                                                       "org.tizen.omadsagent", "/org/tizen/omadsagent",
-                                                                                       "org.tizen.omadsagent", NULL, &error);
-                               if (error) {
-                                       MSG_DEBUG("Connecting to agent proxy failed: %s\n", error->message);
-                                       goto _DBUS_ERROR;
-                               }
 
-                               result_agent = g_dbus_proxy_call_sync(dbus_proxy_agent, "Hello_Agent", NULL,
+                       dbus_proxy_agent = g_dbus_proxy_new_sync(connection_agent, G_DBUS_PROXY_FLAGS_NONE, NULL,
+                                                                               "org.tizen.omadsagent", "/org/tizen/omadsagent",
+                                                                               "org.tizen.omadsagent", NULL, &error);
+                       if (error) {
+                               MSG_DEBUG("Connecting to agent proxy failed: %s\n", error->message);
+                               goto _DBUS_ERROR;
+                       }
+                       result_agent = g_dbus_proxy_call_sync(dbus_proxy_agent, "Hello_Agent", NULL,
                                                                                G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
-                               if (error) {
-                                       MSG_DEBUG("invoking service error: %s\n", error->message);
-                                       goto _DBUS_ERROR;
-                               }
+                       if (error) {
+                               MSG_DEBUG("invoking service error: %s\n", error->message);
+                               goto _DBUS_ERROR;
                        }
-                       break;
-               default:
-                       break;
+               }
+               break;
+       default:
+               break;
        }
 
 _DBUS_ERROR:
@@ -1191,9 +1146,9 @@ void SmsPluginWapPushHandler::handleWapPushCallback(char* pPushHeader, char* pPu
                return;
        }
 
-       for(int i = 0; i < pushEvt_cnt; ++i)    {
+       for (int i = 0; i < pushEvt_cnt; ++i) {
 
-               /**  check Push message receive setting */
+               /*  check Push message receive setting */
                bool bPushRecv = false;
                int appcode = 0;
                MsgSettingGetBool(PUSH_RECV_OPTION, &bPushRecv);
@@ -1206,7 +1161,7 @@ void SmsPluginWapPushHandler::handleWapPushCallback(char* pPushHeader, char* pPu
                }
 
 #ifdef FEATURE_MMS_DISABLE
-               if (appcode == SMS_WAP_APPLICATION_MMS_UA){
+               if (appcode == SMS_WAP_APPLICATION_MMS_UA) {
                        MSG_DEBUG("Drop MMS Notification for DOCOMO");
                        return;
                }
@@ -1219,119 +1174,95 @@ void SmsPluginWapPushHandler::handleWapPushCallback(char* pPushHeader, char* pPu
                        MSG_DEBUG("Received MMS Notification");
                        handleMMSNotification(pPushBody, PushBodyLen);
                        break;
-
                case SMS_WAP_APPLICATION_PUSH_SI:
                        MSG_DEBUG("Received WAP Push (Service Indication Textual form)");
-//                     handleSIMessage(pPushBody, PushBodyLen, true);
+                       /* handleSIMessage(pPushBody, PushBodyLen, true); */
                        break;
-
                case SMS_WAP_APPLICATION_PUSH_SIC:
                        MSG_DEBUG("Received WAP Push (Service Indication Tokenised form)");
-//                     handleSIMessage(pPushBody, PushBodyLen, false);
+                       /* handleSIMessage(pPushBody, PushBodyLen, false); */
                        break;
-
                case SMS_WAP_APPLICATION_PUSH_SL:
                        MSG_DEBUG("Received WAP Push (Service Loading Textual form)");
-//                     handleSLMessage(pPushBody, PushBodyLen, true);
+                       /* handleSLMessage(pPushBody, PushBodyLen, true); */
                        break;
-
                case SMS_WAP_APPLICATION_PUSH_SLC:
                        MSG_DEBUG("Received WAP Push (Service Loading Tokenised form)");
-//                     handleSLMessage(pPushBody, PushBodyLen, false);
+                       /* handleSLMessage(pPushBody, PushBodyLen, false); */
                        break;
-
                case SMS_WAP_APPLICATION_PUSH_CO:
                        MSG_DEBUG("Received WAP Push (Cache Operation Textual form)");
-//                     handleCOMessage(pPushBody, PushBodyLen, true);
+                       /* handleCOMessage(pPushBody, PushBodyLen, true); */
                        break;
-
                case SMS_WAP_APPLICATION_PUSH_COC:
                        MSG_DEBUG("Received WAP Push (Cache Operation Tokenised form)");
-//                     handleCOMessage(pPushBody, PushBodyLen, false);
+                       /* handleCOMessage(pPushBody, PushBodyLen, false); */
                        break;
-
                case SMS_WAP_APPLICATION_SYNCML_DM_BOOTSTRAP:
                        MSG_DEBUG("Received DM BOOTSTRAP");
                        SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(DM_WBXML, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
                        break;
-
                case SMS_WAP_APPLICATION_SYNCML_DM_BOOTSTRAP_XML:
                        MSG_DEBUG("Received DM BOOTSTRAP");
                        SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(DM_XML, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
                        break;
-
                case SMS_WAP_APPLICATION_PUSH_PROVISIONING_XML:
                        MSG_DEBUG("Received Provisioning");
                        SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(CP_XML, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
                        break;
-
                case SMS_WAP_APPLICATION_PUSH_PROVISIONING_WBXML:
                        MSG_DEBUG("Received Provisioning");
                        SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(CP_WBXML, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
                        break;
-
                case SMS_WAP_APPLICATION_PUSH_BROWSER_SETTINGS:
                case SMS_WAP_APPLICATION_PUSH_BROWSER_BOOKMARKS:
                        MSG_DEBUG("Received Provisioning");
                        SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(OTHERS, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
                        break;
-
                case SMS_WAP_APPLICATION_SYNCML_DM_NOTIFICATION:
                        MSG_DEBUG("Received DM Notification");
                        SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(DM_NOTIFICATION, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
                        break;
-
                case SMS_WAP_APPLICATION_SYNCML_DS_NOTIFICATION:
                        MSG_DEBUG("Received DS Notification");
                        SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(DS_NOTIFICATION, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
                        break;
-
                case SMS_WAP_APPLICATION_SYNCML_DS_NOTIFICATION_WBXML:
                        MSG_DEBUG("Received DS Notification");
                        SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(DS_WBXML, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
                        break;
-
                case SMS_WAP_APPLICATION_DRM_UA_RIGHTS_XML:
                case SMS_WAP_APPLICATION_DRM_UA_RIGHTS_WBXML:
                        MSG_DEBUG("Received DRM UA");
-
                        if (pPushBody != NULL)
                                handleDrmVer1(pPushBody, PushBodyLen);
-
                        break;
-
                case SMS_WAP_APPLICATION_DRM_V2_RO_XML:
                case SMS_WAP_APPLICATION_DRM_V2_ROAP_PDU_XML:
                case SMS_WAP_APPLICATION_DRM_V2_ROAP_TRIGGER_XML:
                case SMS_WAP_APPLICATION_DRM_V2_ROAP_TRIGGER_WBXML:
                        MSG_DEBUG("Received DRM V2");
-                       // TODO: DRM V2
+                       /* TODO: DRM V2 */
                        break;
-
                case SMS_WAP_APPLICATION_PUSH_EMAIL:
                case SMS_WAP_APPLICATION_PUSH_EMAIL_XML:
                case SMS_WAP_APPLICATION_PUSH_EMAIL_WBXML:
                        MSG_DEBUG("Received Email");
-                       // TODO: Email
+                       /* TODO: Email */
                        break;
-
-
                case SMS_WAP_APPLICATION_PUSH_IMPS_CIR:
                        MSG_DEBUG("Received IMPS CIR");
-                       // TODO: IMPS CIR
+                       /* TODO: IMPS CIR */
                        break;
-
-               case SMS_WAP_APPLICATION_LBS :
+               case SMS_WAP_APPLICATION_LBS:
                        MSG_DEBUG("Received LBS related message");
                        SmsPluginEventHandler::instance()->handleLBSMsgIncoming(pPushHeader, pPushBody, PushBodyLen);
-                       // TODO: LBS
+                       /* TODO: LBS */
                        break;
-
-               case SMS_WAP_APPLICATION_PUSH_SIA :
+               case SMS_WAP_APPLICATION_PUSH_SIA:
                        MSG_DEBUG("Received SIA");
-                       // TODO: SIA
+                       /* TODO: SIA */
                        break;
-
                default:
                        SmsPluginEventHandler::instance()->handlePushMsgIncoming(pPushHeader, pPushBody, PushBodyLen, app_id, content_type);
                        break;
@@ -1350,14 +1281,13 @@ void SmsPluginWapPushHandler::handleMMSNotification(const char *pPushBody, int P
 #ifdef MSG_FW_FOR_DEBUG
        printf("\n\n[handleMMSNotification] Push Body.\n");
 
-       for (int i = 0; i < PushBodyLen; i++)
-       {
+       for (int i = 0; i < PushBodyLen; i++) {
                printf(" [%02x]", pPushBody[i]);
        }
        printf("\n\n");
 #endif
 
-       /** Make MSG_MESSAGE_INFO_S */
+       /* Make MSG_MESSAGE_INFO_S */
        MSG_MESSAGE_INFO_S msgInfo;
        memset(&msgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S));
 
@@ -1366,7 +1296,7 @@ void SmsPluginWapPushHandler::handleMMSNotification(const char *pPushBody, int P
 
        createMsgInfo(&msgInfo);
 
-       /** Convert Type values */
+       /* Convert Type values */
        msgInfo.msgType.mainType = MSG_MMS_TYPE;
        msgInfo.msgType.subType = MSG_NOTIFICATIONIND_MMS;
        msgInfo.msgType.classType = MSG_CLASS_NONE;
@@ -1376,7 +1306,7 @@ void SmsPluginWapPushHandler::handleMMSNotification(const char *pPushBody, int P
        if (msgInfo.dataSize > MAX_MSG_TEXT_LEN) {
                msgInfo.bTextSms = false;
 
-               /** Save Message Data into File */
+               /* Save Message Data into File */
                char fileName[MSG_FILENAME_LEN_MAX+1];
                memset(fileName, 0x00, sizeof(fileName));
 
@@ -1398,16 +1328,16 @@ void SmsPluginWapPushHandler::handleMMSNotification(const char *pPushBody, int P
 
        msg_error_t err = MSG_SUCCESS;
 
-       /** Add MMS Noti Msg into DB */
+       /* Add MMS Noti Msg into DB */
        err = SmsPluginStorage::instance()->checkMessage(&msgInfo);
 
        if (err == MSG_SUCCESS) {
-               /**  Callback */
+               /*  Callback */
                err = SmsPluginEventHandler::instance()->callbackMsgIncoming(&msgInfo);
 
-               if (err != MSG_SUCCESS) {
+               if (err != MSG_SUCCESS)
                        MSG_DEBUG("callbackMsgIncoming() Error !! [%d]", err);
-               }
+
        } else {
                MSG_DEBUG("checkMessage() Error !! [%d]", err);
        }
@@ -1415,6 +1345,7 @@ void SmsPluginWapPushHandler::handleMMSNotification(const char *pPushBody, int P
        MSG_END();
 }
 
+
 void SmsPluginWapPushHandler::handleSIMessage(char* pPushBody, int PushBodyLen, bool isText)
 {
        MSG_BEGIN();
@@ -1463,10 +1394,10 @@ void SmsPluginWapPushHandler::handleSIMessage(char* pPushBody, int PushBodyLen,
                return;
        }
 
-       /**  temporary set to max. */
+       /*  temporary set to max. */
        pushMsg.expires = 0xFFFFFFFF;
 
-       /** setting received time */
+       /* setting received time */
        time_t  t               =       time(NULL);
        time_t  utfTime =       time(&t);
 
@@ -1513,7 +1444,7 @@ void SmsPluginWapPushHandler::handleSIMessage(char* pPushBody, int PushBodyLen,
 
        strncpy(pushMsg.contents, (char*)tmpXmlChar, MAX_WAPPUSH_CONTENTS_LEN-1);
 
-       /** Write push Msg to file */
+       /* Write push Msg to file */
        char fileName[MSG_FILENAME_LEN_MAX+1];
        memset(fileName, 0x00, sizeof(fileName));
 
@@ -1529,7 +1460,7 @@ void SmsPluginWapPushHandler::handleSIMessage(char* pPushBody, int PushBodyLen,
                THROW(MsgException::FILE_ERROR, "MsgWriteIpcFile error");
        }
 
-       /**  Pack Message Info Structure */
+       /*  Pack Message Info Structure */
        MSG_MESSAGE_INFO_S msgInfo;
        memset(&msgInfo, 0, sizeof(MSG_MESSAGE_INFO_S));
 
@@ -1540,7 +1471,7 @@ void SmsPluginWapPushHandler::handleSIMessage(char* pPushBody, int PushBodyLen,
 
        strncpy(msgInfo.msgData, fileName, MAX_MSG_DATA_LEN);
 
-       /**  Convert Type values */
+       /*  Convert Type values */
        msgInfo.msgType.mainType = MSG_SMS_TYPE;
        msgInfo.msgType.subType = MSG_WAP_SI_SMS;
 
@@ -1551,14 +1482,14 @@ void SmsPluginWapPushHandler::handleSIMessage(char* pPushBody, int PushBodyLen,
 
        msg_error_t err = MSG_SUCCESS;
 
-       /** Add WAP Push Msg into DB */
+       /* Add WAP Push Msg into DB */
        err = SmsPluginStorage::instance()->checkMessage(&msgInfo);
 
        if (err == MSG_SUCCESS) {
-               /** Callback */
+               /* Callback */
                err = SmsPluginEventHandler::instance()->callbackMsgIncoming(&msgInfo);
 
-               if (err != MSG_SUCCESS){
+               if (err != MSG_SUCCESS) {
                        MSG_DEBUG("callbackMsgIncoming() Error !! [%d]", err);
                }
        } else {
@@ -1618,7 +1549,7 @@ void SmsPluginWapPushHandler::handleSLMessage(char* pPushBody, int PushBodyLen,
                indNode = indNode->next;
        }
 
-       /**  setting received time setting */
+       /*  setting received time setting */
        time_t  t               =       time(NULL);
        time_t  utfTime =       time(&t);
 
@@ -1636,9 +1567,9 @@ void SmsPluginWapPushHandler::handleSLMessage(char* pPushBody, int PushBodyLen,
        tmpXmlChar = xmlGetProp(indNode, (xmlChar*)SMS_PUSH_XML_ACTION_TAG);
        pushMsg.action = convertSLActionStrToEnum((char*)tmpXmlChar);
 
-       /** Setting other parameters in default values */
+       /* Setting other parameters in default values */
        pushMsg.created = pushMsg.received;
-       /** temporary set to MAX value. */
+       /* temporary set to MAX value. */
        pushMsg.expires = 0xFFFFFFFF;
 
        MSG_DEBUG("check pushMsg data");
@@ -1650,7 +1581,7 @@ void SmsPluginWapPushHandler::handleSLMessage(char* pPushBody, int PushBodyLen,
        MSG_DEBUG("pushMsg.href : [%s]", pushMsg.href);
        MSG_DEBUG("pushMsg.contents : [%s]", pushMsg.contents);
 
-       /** Write push Msg to file */
+       /* Write push Msg to file */
        char fileName[MSG_FILENAME_LEN_MAX+1];
        memset(fileName, 0x00, sizeof(fileName));
 
@@ -1660,7 +1591,7 @@ void SmsPluginWapPushHandler::handleSLMessage(char* pPushBody, int PushBodyLen,
        if (MsgWriteIpcFile(fileName, (char*)(&pushMsg), sizeof(pushMsg)) == false)
                THROW(MsgException::FILE_ERROR, "MsgWriteIpcFile error");
 
-       /** Pack Message Info Structure */
+       /* Pack Message Info Structure */
        MSG_MESSAGE_INFO_S msgInfo;
        memset(&msgInfo, 0, sizeof(MSG_MESSAGE_INFO_S));
 
@@ -1671,22 +1602,22 @@ void SmsPluginWapPushHandler::handleSLMessage(char* pPushBody, int PushBodyLen,
 
        strncpy(msgInfo.msgData, fileName, MAX_MSG_DATA_LEN);
 
-       /** Convert Type values */
+       /* Convert Type values */
        msgInfo.msgType.mainType = MSG_SMS_TYPE;
        msgInfo.msgType.subType = MSG_WAP_SL_SMS;
 
-       /* Update Msg Text */
+       /* Update Msg Text */
        strncpy(msgInfo.msgText, pushMsg.href, MAX_MSG_TEXT_LEN);
 
        msgInfo.dataSize = sizeof(pushMsg);
 
        MSG_DEBUG("dataSize : %d", msgInfo.dataSize);
 
-       /** Add WAP Push Msg into DB */
+       /* Add WAP Push Msg into DB */
        err = SmsPluginStorage::instance()->checkMessage(&msgInfo);
 
        if (err == MSG_SUCCESS) {
-               /** Callback to MSG FW */
+               /* Callback to MSG FW */
                err = SmsPluginEventHandler::instance()->callbackMsgIncoming(&msgInfo);
 
                if (err != MSG_SUCCESS)
@@ -1703,6 +1634,7 @@ void SmsPluginWapPushHandler::handleSLMessage(char* pPushBody, int PushBodyLen,
        return;
 }
 
+
 void SmsPluginWapPushHandler::handleCOMessage(char* pPushBody, int PushBodyLen, bool isText)
 {
        MSG_PUSH_CACHEOP_S cacheOp;
@@ -1736,8 +1668,7 @@ void SmsPluginWapPushHandler::handleCOMessage(char* pPushBody, int PushBodyLen,
 
        indNode = topNode->xmlChildrenNode;
 
-
-       while(indNode != NULL) {
+       while (indNode != NULL) {
 
                xmlChar* tmpUrl = NULL;
                if (!xmlStrcmp(indNode->name, (const xmlChar*) SMS_PUSH_XML_INVAL_OBJ)) {
@@ -1770,7 +1701,7 @@ void SmsPluginWapPushHandler::handleCOMessage(char* pPushBody, int PushBodyLen,
                indNode = indNode->next;
        }
 
-       /**  Write push Msg to file */
+       /*  Write push Msg to file */
        char fileName[MSG_FILENAME_LEN_MAX+1];
        memset(fileName, 0x00, sizeof(fileName));
 
@@ -1784,7 +1715,7 @@ void SmsPluginWapPushHandler::handleCOMessage(char* pPushBody, int PushBodyLen,
                THROW(MsgException::FILE_ERROR, "MsgWriteIpcFile error");
        }
 
-       /**  Pack Message Info Structure */
+       /*  Pack Message Info Structure */
        MSG_MESSAGE_INFO_S msgInfo;
        memset(&msgInfo, 0, sizeof(MSG_MESSAGE_INFO_S));
 
@@ -1795,7 +1726,7 @@ void SmsPluginWapPushHandler::handleCOMessage(char* pPushBody, int PushBodyLen,
 
        strncpy(msgInfo.msgData, fileName, MAX_MSG_DATA_LEN);
 
-       /**  Convert Type values */
+       /*  Convert Type values */
        msgInfo.msgType.mainType = MSG_SMS_TYPE;
        msgInfo.msgType.subType = MSG_WAP_CO_SMS;
 
@@ -1803,11 +1734,11 @@ void SmsPluginWapPushHandler::handleCOMessage(char* pPushBody, int PushBodyLen,
 
        msg_error_t err = MSG_SUCCESS;
 
-       /** Add WAP Push Msg into DB */
+       /* Add WAP Push Msg into DB */
        err = SmsPluginStorage::instance()->checkMessage(&msgInfo);
 
        if (err == MSG_SUCCESS) {
-               /** Callback */
+               /* Callback */
                err = SmsPluginEventHandler::instance()->callbackMsgIncoming(&msgInfo);
 
                if (err != MSG_SUCCESS) {
@@ -1858,10 +1789,10 @@ void SmsPluginWapPushHandler::handleDrmVer1(char* pPushBody, int PushBodyLen)
 
 void SmsPluginWapPushHandler::createMsgInfo(MSG_MESSAGE_INFO_S* pMsgInfo)
 {
-       /** Convert class Type values */
+       /* Convert class Type values */
        pMsgInfo->msgType.classType = MSG_CLASS_NONE;
 
-       /**  set folder id (temporary) */
+       /*  set folder id (temporary) */
        pMsgInfo->folderId = MSG_INBOX_ID;
 
        pMsgInfo->networkStatus = MSG_NETWORK_RECEIVED;
@@ -1871,9 +1802,8 @@ void SmsPluginWapPushHandler::createMsgInfo(MSG_MESSAGE_INFO_S* pMsgInfo)
        pMsgInfo->direction = MSG_DIRECTION_TYPE_MT;
 
        time_t rawtime = time(NULL);
-
-/*** Comment below lines to save local UTC time..... (it could be used later.)
-
+       /* Comment below lines to save local UTC time..... (it could be used later.) */
+       /*
        if (tmpTimeStamp.format == SMS_TIME_ABSOLUTE) {
 
                MSG_DEBUG("year : %d", tmpTimeStamp.time.absolute.year);
@@ -1923,12 +1853,11 @@ void SmsPluginWapPushHandler::createMsgInfo(MSG_MESSAGE_INFO_S* pMsgInfo)
                strftime(displayTime, 32, "%Y-%02m-%02d %T %z", timeTM);
                MSG_DEBUG("displayTime [%s]", displayTime);
        }
-
-***/
+       */
 
        pMsgInfo->displayTime = rawtime;
 
-       /**  Convert Address values */
+       /*  Convert Address values */
        pMsgInfo->nAddressCnt = 1;
 
        pMsgInfo->addressList = (MSG_ADDRESS_INFO_S *)new char[sizeof(MSG_ADDRESS_INFO_S)];
@@ -1943,6 +1872,7 @@ void SmsPluginWapPushHandler::createMsgInfo(MSG_MESSAGE_INFO_S* pMsgInfo)
 
 }
 
+
 void SmsPluginWapPushHandler::getXmlDoc(const char* pPushBody, const int PushBodyLen, xmlDocPtr *pXmlDoc, const bool isText)
 {
        if (pPushBody == NULL) {
@@ -1950,7 +1880,6 @@ void SmsPluginWapPushHandler::getXmlDoc(const char* pPushBody, const int PushBod
                return;
        }
 
-
        if (isText) {
                *pXmlDoc = xmlParseMemory(pPushBody, AcStrlen(pPushBody));
        } else {
@@ -1978,6 +1907,7 @@ void SmsPluginWapPushHandler::getXmlDoc(const char* pPushBody, const int PushBod
 
 }
 
+
 unsigned long SmsPluginWapPushHandler::convertXmlCharToSec(char* pDate)
 {
        struct tm       timeStruct;
@@ -1988,13 +1918,13 @@ unsigned long SmsPluginWapPushHandler::convertXmlCharToSec(char* pDate)
        memset(tmpBuf, 0x00, sizeof(tmpBuf));
        memset(&timeStruct, 0x00, sizeof(struct tm));
 
-       /** check pDate */
+       /* check pDate */
        if (AcStrlen(pDate)<20)
                return 0;
 
        MSG_DEBUG("pDate [%s]", pDate);
 
-       /** Year */
+       /* Year */
        for (i = 0; i < 4; i++) {
                tmpBuf[i] = pDate[index++];
        }
@@ -2002,7 +1932,7 @@ unsigned long SmsPluginWapPushHandler::convertXmlCharToSec(char* pDate)
        index++;
        timeStruct.tm_year = (atoi( tmpBuf)-1900);
 
-       /**  Month */
+       /*  Month */
        for (i = 0; i < 2; i++) {
                tmpBuf[i] = pDate[index++];
        }
@@ -2010,7 +1940,7 @@ unsigned long SmsPluginWapPushHandler::convertXmlCharToSec(char* pDate)
        index++;
        timeStruct.tm_mon = (atoi( tmpBuf) - 1);
 
-       /** Date */
+       /* Date */
        for (i = 0; i < 2; i++) {
                tmpBuf[i] = pDate[index++];
        }
@@ -2018,7 +1948,7 @@ unsigned long SmsPluginWapPushHandler::convertXmlCharToSec(char* pDate)
        index++;
        timeStruct.tm_mday = atoi( tmpBuf);
 
-       /** Hours */
+       /* Hours */
        for (i = 0; i < 2; i++) {
                tmpBuf[i] = pDate[index++];
        }
@@ -2026,7 +1956,7 @@ unsigned long SmsPluginWapPushHandler::convertXmlCharToSec(char* pDate)
        index++;
        timeStruct.tm_hour = atoi( tmpBuf);
 
-       /** Minites */
+       /* Minites */
        for (i = 0; i < 2; i++) {
                tmpBuf[i] = pDate[index++];
        }
@@ -2034,7 +1964,7 @@ unsigned long SmsPluginWapPushHandler::convertXmlCharToSec(char* pDate)
        index++;
        timeStruct.tm_min = atoi( tmpBuf);
 
-       /** Seconds */
+       /* Seconds */
        for (i = 0; i < 2; i++) {
                tmpBuf[i] = pDate[index++];
        }
@@ -2047,6 +1977,7 @@ unsigned long SmsPluginWapPushHandler::convertXmlCharToSec(char* pDate)
        return nTimeInSec;
 }
 
+
 msg_push_action_t SmsPluginWapPushHandler::convertSIActionStrToEnum(char* pAction)
 {
        int comp = 0;
@@ -2056,36 +1987,37 @@ msg_push_action_t SmsPluginWapPushHandler::convertSIActionStrToEnum(char* pActio
                return MSG_PUSH_SI_ACTION_SIGNAL_MEDIUM;
        }
 
-       /** compare  with signal-none. */
+       /* compare  with signal-none. */
        comp = g_strcmp0( "signal-none", pAction );
        if (comp == 0)
                return MSG_PUSH_SI_ACTION_SIGNAL_NONE;
 
-       /** compare  with signal-low. */
+       /* compare  with signal-low. */
        comp = g_strcmp0( "signal-low", pAction );
        if (comp == 0)
                return MSG_PUSH_SI_ACTION_SIGNAL_LOW;
 
-       /**  compare  with signal-medium. */
+       /*  compare  with signal-medium. */
        comp = g_strcmp0( "signal-medium", pAction );
        if (comp == 0)
                return MSG_PUSH_SI_ACTION_SIGNAL_MEDIUM;
 
-       /**  compare  with signal-high. */
+       /*  compare  with signal-high. */
        comp = g_strcmp0( "signal-high", pAction );
        if (comp == 0)
                return MSG_PUSH_SI_ACTION_SIGNAL_HIGH;
 
-       /**  compare  with delete. */
+       /*  compare  with delete. */
        comp = g_strcmp0( "delete", pAction );
        if (comp == 0)
                return MSG_PUSH_SI_ACTION_DELETE;
 
-       /**  signal-medium is default action value. */
+       /*  signal-medium is default action value. */
        return MSG_PUSH_SI_ACTION_SIGNAL_MEDIUM;
 
 }
 
+
 msg_push_action_t SmsPluginWapPushHandler::convertSLActionStrToEnum(char* pAction)
 {
        int comp = 0;
@@ -2095,22 +2027,22 @@ msg_push_action_t SmsPluginWapPushHandler::convertSLActionStrToEnum(char* pActio
                return MSG_PUSH_SL_ACTION_EXECUTE_LOW;
        }
 
-       /**  compare pSrcStr with execute-low. */
+       /*  compare pSrcStr with execute-low. */
        comp = g_strcmp0( "execute-low", pAction );
        if (comp == 0)
                return MSG_PUSH_SL_ACTION_EXECUTE_LOW;
 
-       /**  compare pSrcStr with execute-high. */
+       /*  compare pSrcStr with execute-high. */
        comp = g_strcmp0( "execute-high", pAction );
        if (comp == 0)
                return MSG_PUSH_SL_ACTION_EXECUTE_HIGH;
 
-       /** compare pSrcStr with cache. */
+       /* compare pSrcStr with cache. */
        comp = g_strcmp0( "cache", pAction );
        if (comp == 0)
                return MSG_PUSH_SL_ACTION_CACHE;
 
-       /** default SL action value is execute-low. */
+       /* default SL action value is execute-low. */
        return MSG_PUSH_SL_ACTION_EXECUTE_LOW;
 
 }
@@ -2182,7 +2114,7 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
        for (loop = 0 ; loop<(int)encodedHeaderLen; loop++) {
                char szTempBuf[5];
                szTempBuf[0] = 0x00;
-               sprintf( szTempBuf, "%2X ", sEncodedHeader[loop] );
+               snprintf( szTempBuf, sizeof(szTempBuf), "%2X ", sEncodedHeader[loop] );
 
                if (AcStrlen( szBuf ) + 7 < 64) {
                        strncat( szBuf, szTempBuf, sizeof(szBuf)-AcStrlen(szBuf)-1 );
@@ -2202,7 +2134,7 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
 
        if (fContentType) {
                encodedHeader = new char[ encodedHeaderLen + 1 ];
-               if (encodedHeader == NULL)      {
+               if (encodedHeader == NULL) {
                        MSG_DEBUG("encodedHeader Memory allocation is failed.\n" );
                        return;
                }
@@ -2210,7 +2142,7 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
                memcpy( encodedHeader + 1, sEncodedHeader, (size_t)encodedHeaderLen );
        } else {
                encodedHeader = new char[ encodedHeaderLen ];
-               if (encodedHeader == NULL)      {
+               if (encodedHeader == NULL) {
                        MSG_DEBUG("encodedHeader Memory allocation is failed.\n" );
                        return;
                }
@@ -2274,8 +2206,7 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
                                unsigned char fieldValue[1275];
                                fieldCode = track & 0x7f;
                                /*
-                               if (( fieldValueLen == 0 ) || ( fieldValueLen == 0x80 ))
-                               {
+                               if (( fieldValueLen == 0 ) || ( fieldValueLen == 0x80 )) {
                                        dprint( DNET_WAP,DNET_DBG_HIGH, "%X %X %X %X %X %X\n" , fieldCode, encodedHeader[iEncodedHeader + 1], encodedHeader[iEncodedHeader + 2],encodedHeader[iEncodedHeader + 3],encodedHeader[iEncodedHeader + 4], encodedHeader[iEncodedHeader + 5] );
                                }
                                */
@@ -2329,7 +2260,7 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
 
                                                        if (fieldValueLen == 1) {
                                                                /* field value is one byte integer over 0x80 */
-                                                               /** make it two byte integer */
+                                                               /* make it two byte integer */
                                                                fieldValue[0] = 0x00;
                                                                memcpy( fieldValue + 1, encodedHeader + iEncodedHeader + 2, (size_t)fieldValueLen);
                                                                fieldValueLen = 2;
@@ -2362,560 +2293,554 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
                                        }
 
 
-                                       switch ( fieldCode )
-                                       {
-                                               /* accept charset */
-                                               /* It's normal way of field process. */
-                                               case 0x01 :
-                                                       {
-                                                               unsigned long  i = 0;
-                                                               unsigned long  code;
-
-                                                               /* Case of length of charset greater than 1 are two thigins.
-                                                               1. code length of charset is greater than 1.
-                                                               2. It include parameter.
-                                                               3. Or both of two
-                                                               */
-                                                               if (1 != fieldValueLen) {
-                                                                       code = wspHeaderDecodeInteger( fieldValue );
-                                                                       /* Calculate iField. */
-                                                                       if (fieldValue[0] < 0x80 )
-                                                                               iField = fieldValue[0];
-                                                                       else
-                                                                               iField = 1;
-
-                                                                       while ( wspCharset[i].charsetCode != code )
-                                                                               i++;
-                                                                       strncat( (char*)temper, (char*)wspCharset[i].charsetName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
-                                                                       /* If parameter exist */
-                                                                       if (iField < fieldValueLen) {
-                                                                               char* param = NULL;
-                                                                               unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
-                                                                               wspHeaderDecodeQValue( fieldValueLen - iField, fieldValue + iField, &param);
-                                                                               strncat( (char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
-                                                                       }
-                                                               } else {
-                                                                       code = fieldValue[0] & 0x7f;
+                                       switch (fieldCode) {
+                                       /* accept charset */
+                                       /* It's normal way of field process. */
+                                       case 0x01:
+                                               {
+                                                       unsigned long  i = 0;
+                                                       unsigned long  code;
+
+                                                       /* Case of length of charset greater than 1 are two thigins.
+                                                       1. code length of charset is greater than 1.
+                                                       2. It include parameter.
+                                                       3. Or both of two
+                                                       */
+                                                       if (1 != fieldValueLen) {
+                                                               code = wspHeaderDecodeInteger( fieldValue );
+                                                               /* Calculate iField. */
+                                                               if (fieldValue[0] < 0x80 )
+                                                                       iField = fieldValue[0];
+                                                               else
+                                                                       iField = 1;
 
-                                                                       while (( wspCharset[i].charsetCode != code ) && ( wspCharset[i].charsetCode != 0xffff  )) i++;
-                                                                       strncat( (char*)temper, (char*)wspCharset[i].charsetName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                                               while ( wspCharset[i].charsetCode != code )
+                                                                       i++;
+                                                               strncat( (char*)temper, (char*)wspCharset[i].charsetName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                                               /* If parameter exist */
+                                                               if (iField < fieldValueLen) {
+                                                                       char* param = NULL;
+                                                                       unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
+                                                                       wspHeaderDecodeQValue( fieldValueLen - iField, fieldValue + iField, &param);
+                                                                       strncat( (char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
                                                                }
+                                                       } else {
+                                                               code = fieldValue[0] & 0x7f;
 
+                                                               while (( wspCharset[i].charsetCode != code ) && ( wspCharset[i].charsetCode != 0xffff  )) i++;
+                                                               strncat( (char*)temper, (char*)wspCharset[i].charsetName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
                                                        }
-                                                       break;
 
-                                               /* type encoding */
-                                               /* Like below routine, Same decoding routine process together. */
-                                               /* Accept-encoding */
-                                               case 0x02 :
-                                               /* content-encoding */
-                                               case 0x0b :
-                                                       {
-                                                               int integerValue;
-
-                                                               integerValue = wspHeaderDecodeIntegerByLength(fieldValue, fieldValueLen );
-                                                               if (integerValue > 2) {
-                                                                       MSG_DEBUG("WspLDecodeHeader: integerValue is over limit(2).\n");
-                                                                       break;
-                                                               }
-                                                               strncat( (char*)temper, (char*)wspEncodeMethod[integerValue], (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+                                               }
+                                       break;
+
+                                       /* type encoding */
+                                       /* Like below routine, Same decoding routine process together. */
+                                       /* Accept-encoding */
+                                       case 0x02:
+                                       /* content-encoding */
+                                       case 0x0b:
+                                               {
+                                                       int integerValue;
+
+                                                       integerValue = wspHeaderDecodeIntegerByLength(fieldValue, fieldValueLen );
+                                                       if (integerValue > 2) {
+                                                               MSG_DEBUG("WspLDecodeHeader: integerValue is over limit(2).\n");
+                                                               break;
+                                                       }
+                                                       strncat( (char*)temper, (char*)wspEncodeMethod[integerValue], (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+                                               }
+                                               break;
+                                       /* contents type decoder */
+                                       /* accept */
+                                       case 0x00:
+                                       /* content-type */
+                                       case 0x11:
+                                               {
+                                                       unsigned long  contentsTypeCode;
+                                                       unsigned long  i = 0;
+                                                       /* encoded content type length body */
+                                                       unsigned long  tempLen;
+                                                       MSG_DEBUG("fieldValueLen: %d", fieldValueLen);
+
+                                                       /* Like HTTP result state 304, it's for processing without Content type. This part doesn't defined. */
+                                                       if (0 == fieldValueLen) {
+                                                               strncat( (char*)temper, (char*)"None" , (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+                                                               break;
+                                                       }
+                                                       /* 01 AE --> 00 AE --> AE*/
+                                                       if (fieldValueLen == 2  &&  fieldValue[0] == 0) {
+                                                               memcpy( fieldValue, encodedHeader + iEncodedHeader -1, (size_t)fieldValueLen-1 );
+                                                               MSG_DEBUG("WspLDecodeHeader:For mmO2 problem\r\n" );
                                                        }
-                                                       break;
-                                               /* contents type decoder */
-                                               /* accept */
-                                               case 0x00 :
-                                               /* content-type */
-                                               case 0x11 :
-                                                       {
-                                                               unsigned long  contentsTypeCode;
-                                                               unsigned long  i = 0;
-                                                               /* encoded content type length body */
-                                                               unsigned long  tempLen;
-                                                               MSG_DEBUG("fieldValueLen: %d", fieldValueLen);
-
-                                                               /* Like HTTP result state 304, it's for processing without Content type. This part doesn't defined. */
-                                                               if (0 == fieldValueLen) {
-                                                                       strncat( (char*)temper, (char*)"None" , (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
-                                                                       break;
-                                                               }
-                                                               /* 01 AE --> 00 AE --> AE*/
-                                                               if (fieldValueLen == 2  &&  fieldValue[0] == 0) {
-                                                                       memcpy( fieldValue, encodedHeader + iEncodedHeader -1, (size_t)fieldValueLen-1 );
-                                                                       MSG_DEBUG("WspLDecodeHeader:For mmO2 problem\r\n" );
-                                                               }
-
-                                                               if ((fieldValue[0] < 0x20 ) || (fieldValue[0] >= 0x80 )) {
-                                                                       if (fieldValue[0] >= 0x80) {
-                                                                               tempLen = 1;
-                                                                       } else if (fieldValueLen == 2 && fieldValue[0] == 0x03 && fieldValue[1] == 0x0A) { /** 06 05 02 03 0A AF 89 */
-                                                                               fieldValue[3] = fieldValue[2];
-                                                                               fieldValue[2] = fieldValue[1];
-                                                                               fieldValue[1] = fieldValue[0];
-                                                                               fieldValue[0] = 0x02;
-                                                                               tempLen = 2;
-                                                                               fieldValueLen = 3;
-                                                                               MSG_DEBUG("WspLDecodeHeader:For CPE problem\r\n" );
-                                                                       } else {
-                                                                               tempLen = fieldValue[0]; /** 06 06 03 02 03 16 AF 88 */
-                                                                       }
-
-                                                                       if (tempLen == 1) {
-
-                                                                               char* szExtendedContent;
-
-                                                                               contentsTypeCode = fieldValue[0] & 0x7f;
-                                                                               while (( wspContentsType[i].contentsTypeCode != contentsTypeCode ) && ( i < wspContentsTypeCount )) i++;
 
-                                                                               /* If specified content type doesn't exist */
-                                                                               if (i < wspContentsTypeCount)
-                                                                                       strncat( (char*)temper, (char*)wspContentsType[i].contentsTypeName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                                       if ((fieldValue[0] < 0x20 ) || (fieldValue[0] >= 0x80 )) {
+                                                               if (fieldValue[0] >= 0x80) {
+                                                                       tempLen = 1;
+                                                               } else if (fieldValueLen == 2 && fieldValue[0] == 0x03 && fieldValue[1] == 0x0A) { /* 06 05 02 03 0A AF 89 */
+                                                                       fieldValue[3] = fieldValue[2];
+                                                                       fieldValue[2] = fieldValue[1];
+                                                                       fieldValue[1] = fieldValue[0];
+                                                                       fieldValue[0] = 0x02;
+                                                                       tempLen = 2;
+                                                                       fieldValueLen = 3;
+                                                                       MSG_DEBUG("WspLDecodeHeader:For CPE problem\r\n" );
+                                                               } else {
+                                                                       tempLen = fieldValue[0]; /* 06 06 03 02 03 16 AF 88 */
+                                                               }
 
-                                                                               szExtendedContent =  wspExtendedDecodeType( (char)contentsTypeCode );
+                                                               if (tempLen == 1) {
+                                                                       char* szExtendedContent;
 
-                                                                               if (szExtendedContent != NULL) {
-                                                                                       MSG_DEBUG("WspLDecodeHeader: Tele2 server problem \n " );
-                                                                                       strncat( (char*)temper, (char*)szExtendedContent, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
-                                                                               }
-                                                                       } else {
-                                                                               contentsTypeCode = wspHeaderDecodeInteger(fieldValue);
+                                                                       contentsTypeCode = fieldValue[0] & 0x7f;
+                                                                       while (( wspContentsType[i].contentsTypeCode != contentsTypeCode ) && ( i < wspContentsTypeCount )) i++;
 
-                                                                               while ((i < wspUnregisteredContentsTypeCount) && (wspUnregisterContentsType[i].contentsTypeCode != contentsTypeCode)) i++;
+                                                                       /* If specified content type doesn't exist */
+                                                                       if (i < wspContentsTypeCount)
+                                                                               strncat( (char*)temper, (char*)wspContentsType[i].contentsTypeName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
 
-                                                                               /** If there is a Content-Type assigned, */
-                                                                               if (i < wspUnregisteredContentsTypeCount)
-                                                                                       strncat ((char*)temper, (char*)wspUnregisterContentsType[i].contentsTypeName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+                                                                       szExtendedContent =  wspExtendedDecodeType( (char)contentsTypeCode );
 
-                                                                               tempLen +=1;
+                                                                       if (szExtendedContent != NULL) {
+                                                                               MSG_DEBUG("WspLDecodeHeader: Tele2 server problem \n " );
+                                                                               strncat( (char*)temper, (char*)szExtendedContent, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
                                                                        }
                                                                } else {
-                                                                       tempLen = AcStrlen( (char*)fieldValue ) + 1;
+                                                                       contentsTypeCode = wspHeaderDecodeInteger(fieldValue);
 
-                                                                       strncat ((char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
-                                                                       MSG_DEBUG("WspLDecodeHeader: Attention, Decoding Check of Content-Type\n ", tempLen);
-                                                               }
+                                                                       while ((i < wspUnregisteredContentsTypeCount) && (wspUnregisterContentsType[i].contentsTypeCode != contentsTypeCode))
+                                                                               i++;
 
-                                                               /* If there is a parameter */
-                                                               if (tempLen < fieldValueLen) {
-                                                                       char* param = NULL;
-                                                                       unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
-                                                                       wspHeaderDecodeParameter( fieldValue + tempLen, fieldValueLen - tempLen, &param);
-                                                                       if (param != NULL) {
-                                                                               strncat( (char*)temper, "; ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
-                                                                               strncat( (char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
-                                                                       }
-                                                               }
-                                                       }
-                                                       break;
+                                                                       /* If there is a Content-Type assigned, */
+                                                                       if (i < wspUnregisteredContentsTypeCount)
+                                                                               strncat ((char*)temper, (char*)wspUnregisterContentsType[i].contentsTypeName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
 
-                                               /* language */
-                                               /* content-language */
-                                               case 0x0c :
-                                               /* accept-language */
-                                               case 0x03 :
-                                                       {
-                                                               unsigned long i = 0;
-                                                               unsigned long code;
-                                                               unsigned long tempLen;
-                                                               if ((fieldValue[0] < 0x20 ) || (fieldValue[0] > 0x80 )) {
-                                                                       if (fieldValue[0] > 0x80 )
-                                                                               tempLen = 1;
-                                                                       else
-                                                                               tempLen = fieldValue[0];
-                                                               } else {
-                                                                       tempLen = AcStrlen( (char*)fieldValue ) + 1;
+                                                                               tempLen +=1;
                                                                }
+                                                       } else {
+                                                               tempLen = AcStrlen( (char*)fieldValue ) + 1;
 
-                                                               if (tempLen == 1) {
-
-                                                                       code = wspHeaderDecodeInteger( fieldValue );
-                                                                       while ( wspLanguage[i].languageCode != code) {
-                                                                               i++;
-                                                                               if (i == wspLanguageCount)
-                                                                                       break;
-                                                                       }
-
-                                                                       if (i < wspLanguageCount) {
-                                                                               strncat( (char*)temper, (char*)wspLanguage[i].languageName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
-                                                                       }
-                                                               } else {
-                                                                       strncat( (char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
-                                                               }
+                                                               strncat ((char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+                                                               MSG_DEBUG("WspLDecodeHeader: Attention, Decoding Check of Content-Type\n ", tempLen);
+                                                       }
 
-                                                               if (tempLen < fieldValueLen) {
-                                                                       char* param = NULL;
-                                                                       unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
-                                                                       wspHeaderDecodeQValue(  fieldValueLen - tempLen, fieldValue + tempLen, &param );
+                                                       /* If there is a parameter */
+                                                       if (tempLen < fieldValueLen) {
+                                                               char* param = NULL;
+                                                               unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
+                                                               wspHeaderDecodeParameter( fieldValue + tempLen, fieldValueLen - tempLen, &param);
+                                                               if (param != NULL) {
+                                                                       strncat( (char*)temper, "; ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
                                                                        strncat( (char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
                                                                }
                                                        }
-                                                       break;
-
-                                               /* integer */
-                                               /* Max-forwards */
-                                               case 0x1e :
-                                               /* content-length */
-                                               case 0x0d :
-                                               /* age */
-                                               case 0x05 :
-                                               /* Bearer-indication */
-                                               case 0x33 :
-                                               /* Push-Flag */
-                                               case 0x34 :
-                                                       {
-
-                                                               unsigned char temp[16];
-                                                               /*
-                                                               if (( fieldValueLen == 2 ) && ( fieldValue[0] > 0x7f ))
-                                                                       AcSprintf( (char*)temp, "%u", (unsigned int)fieldValue[1]);
+                                               }
+                                               break;
+
+                                       /* language */
+                                       /* content-language */
+                                       case 0x0c:
+                                       /* accept-language */
+                                       case 0x03:
+                                               {
+                                                       unsigned long i = 0;
+                                                       unsigned long code;
+                                                       unsigned long tempLen;
+                                                       if ((fieldValue[0] < 0x20 ) || (fieldValue[0] > 0x80 )) {
+                                                               if (fieldValue[0] > 0x80 )
+                                                                       tempLen = 1;
                                                                else
-                                                               */
-                                                               sprintf( (char*)temp, "%u", (unsigned int)wspHeaderDecodeIntegerByLength( fieldValue, fieldValueLen ));
-                                                               strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                                                       tempLen = fieldValue[0];
+                                                       } else {
+                                                               tempLen = AcStrlen( (char*)fieldValue ) + 1;
                                                        }
-                                                       break;
-                                               /* X-Wap-Application-Id */
-                                               case 0x2f :
-                                                       {
-                                                               unsigned char temp[64];
-                                                               int         integerValue;
-
-                                                               if (fieldValueLen == 2 &&  fieldValue[0] == 0) {
-                                                                       memcpy( fieldValue, encodedHeader + iEncodedHeader -1, (size_t)fieldValueLen-1 );
-                                                                       MSG_DEBUG("WspLDecodeHeader:For mmO2 problem\r\n" );
-                                                                       fieldValueLen = 1;
-                                                               }
 
-                                                               integerValue = wspHeaderDecodeIntegerByLength(fieldValue, fieldValueLen);
+                                                       if (tempLen == 1) {
 
-                                                               int count = sizeof(wspHeaderApplId)/sizeof(SMS_WSP_HEADER_PARAMETER_S);
-                                                               for(int i = 0; i < count ; ++i)
-                                                               {
-                                                                       if ((unsigned int)integerValue == wspHeaderApplId[i].parameterCode)
-                                                                       {
-                                                                               snprintf((char*)temp, 64, "%s", wspHeaderApplId[i].parameterToken);
-                                                                               strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1);
+                                                               code = wspHeaderDecodeInteger( fieldValue );
+                                                               while ( wspLanguage[i].languageCode != code) {
+                                                                       i++;
+                                                                       if (i == wspLanguageCount)
                                                                                break;
-                                                                       }
                                                                }
-                                                       }
-                                                       break;
-                                               /* Accept-Application */
-                                               case 0x32 :
-                                                       if (0x80 == fieldValue[0]) {
-                                                               strncat( (char*)temper, "*", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1 );
-                                                       } else {
-
-                                                               unsigned char temp[16];
-                                                               /*
-                                if (( fieldValueLen == 2 ) && ( fieldValue[0] == 1 ))
-                                       AcSprintf( (char*)temp, "%u", (unsigned int)fieldValue[0]);
-                                else
-                                                               */
-                                                               sprintf( (char*)temp, "%u", (unsigned int)wspHeaderDecodeIntegerByLength( fieldValue, fieldValueLen ));
-                                                               strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1);
-                                                       }
-                                                       break;
-
-
-                                               /* date */
-                                               /* last-modified */
-                                               case 0x1d :
-                                               /* if-unmodified-since */
-                                               case 0x1b :
-                                               /* if-range */
-                                               case 0x1a :
-                                               /* if-modified-since */
-                                               case 0x17 :
-                                               /* expires */
-                                               case 0x14 :
-                                               /* date */
-                                               case 0x12 :
-                                                       {
-                                                               char* decodedString = NULL;
-                                                               unique_ptr<char*, void(*)(char**)> decodedStringbuf(&decodedString, unique_ptr_deleter);
-                                                               wspHeaderDecodeDateValue( fieldValueLen, fieldValue, &decodedString);
-                                                               strncat( (char*)temper, (char*)decodedString, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1 );
-                                                       }
-                                                       break;
 
-                                               /* connection */
-                                               case 0x09 :
-                                                       if (fieldValue[0] == 0x80 )
-                                                               strncat( (char*)temper, "Close", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1 );
-                                                       break;
-                                               /* accept-ranges */
-                                               case 0x04 :
-                                                       if (fieldValue[0] == 0x80 )
-                                                               strncat( (char*)temper, "None", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1 );
-                                                       if (fieldValue[0] == 0x81 )
-                                                               strncat( (char*)temper, "Bytes", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1 );
-                                                       break;
-                                               /* content-md5 */
-                                               case 0x0f :
-                                                       {
-                                                               unsigned char temp[1275];
-                                                               memcpy( temp, fieldValue, (size_t)fieldValueLen );
-                                                               temp[fieldValueLen] = 0;
-                                                               wspHeaderCopyDecodedString( temp, &currentLength, &temper );
-                                                       }
-                                                       break;
-                                               /* Credential */
-                                               /* authorization */
-                                               case 0x07 :
-                                               /* proxy - authorization */
-                                               case 0x21 :
-                                                       if (fieldValue[0] == 0x80) {
-                                                               char* addString = NULL;
-                                                               unique_ptr<char*, void(*)(char**)> addStringbuf(&addString, unique_ptr_deleter);
-                                                               wspHeaderDecodeAuth(fieldValueLen, fieldValue, &addString );
-                                                               strncat( (char*)temper, addString, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
-                                                       } else {
-                                                               iField = AcStrlen( (char*)fieldValue) + 1;
-
-                                                               strncat( (char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
-                                                               if (iField < fieldValueLen) {
-                                                                       char* param = NULL;
-                                                                       unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
-                                                                       wspHeaderDecodeParameter( fieldValue + 1, fieldValueLen - 1, &param );
-                                                                       if (param != NULL) {
-                                                                               strncat( (char*)temper, ", ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
-                                                                               strncat( (char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
-                                                                       }
+                                                               if (i < wspLanguageCount) {
+                                                                       strncat( (char*)temper, (char*)wspLanguage[i].languageName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
                                                                }
-                                                       }
-                                                       break;
-
-
-                                               /* Challenge */
-                                               /* www - auth */
-                                               case 0x2d :
-                                               /* Proxy-authenticate */
-                                               case 0x20 :
-                                                       if (0 == fieldValueLen )
-                                                               break;
-                                                       if (fieldValue[0] == 0x80) {
-                                                               char* addString = NULL;
-                                                               unique_ptr<char*, void(*)(char**)> addStringbuf(&addString, unique_ptr_deleter);
-                                                               wspHeaderDecodeChallenge(fieldValueLen, fieldValue, &addString );
-                                                               strncat( (char*)temper, addString, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
                                                        } else {
-                                                               unsigned char  authScheme[WSP_STANDARD_STR_LEN_MAX + 1];
-                                                               unsigned char  realmValue[WSP_STANDARD_STR_LEN_MAX];
-                                                               unsigned char  addedString[WSP_STANDARD_STR_LEN_MAX];
-
-                                                               strncpy( (char*)authScheme, (char*)fieldValue, WSP_STANDARD_STR_LEN_MAX -1);
-                                                               iField = AcStrlen( (char*)authScheme ) + 1;
-                                                               strncpy( (char*)realmValue, (char*)(fieldValue + iField ), WSP_STANDARD_STR_LEN_MAX-1);
-                                                               iField = iField + AcStrlen( (char*)realmValue ) + 1;
-                                                               snprintf( (char*)addedString, sizeof(addedString), "%s %s", authScheme, realmValue );
-                                                               wspHeaderCopyDecodedString( addedString, &currentLength, &temper );
-
-                                                               if (iField < fieldValueLen) {
-                                                                       char* param = NULL;
-                                                                       unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
-                                                                       wspHeaderDecodeParameter( fieldValue + iField, fieldValueLen - iField, &param );
-                                                                       if (param != NULL) {
-                                                                               strncat( (char*)temper, ", ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
-                                                                               wspHeaderCopyDecodedString( (unsigned char*)param, &currentLength, &temper );
-                                                                       }
-                                                               }
+                                                               strncat( (char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
                                                        }
-                                                       break;
-
-                                               /* content -range */
-                                               case 0x10 :
-                                                       {
-                                                               unsigned long  first, len, last;
-
-                                                               unsigned char  temp[16];
-                                                               iField = 0;
 
-                                                               strncat( (char*)temper," bytes ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
-
-                                                               first = wspRetriveUintvarDecode( fieldValue, &iField );
-                                                               len = wspRetriveUintvarDecode( fieldValue, &iField );
-                                                               /* Originally range of HTTP include entity length. But WSP omit it. Finally to calculate this, it should be get content length from export. If this field is included without content length, then it can get wrong result. This content length can be get by calculating PDU length.
-                                                               */
-                                                               last = first + contentsLength - 1;
-
-                                                               sprintf( (char*)temp, "%u-%u/%u", (unsigned int)first, (unsigned int)last, (unsigned int)len );
-                                                               strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                                       if (tempLen < fieldValueLen) {
+                                                               char* param = NULL;
+                                                               unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
+                                                               wspHeaderDecodeQValue(  fieldValueLen - tempLen, fieldValue + tempLen, &param );
+                                                               strncat( (char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
                                                        }
-                                                       break;
-
-                                               /* cache-control */
-                                               case 0x08 :
-                                                       {
-                                                               char* cacheString = NULL;
-                                                               unique_ptr<char*, void(*)(char**)> cacheStringbuf(&cacheString, unique_ptr_deleter);
-
-                                                               wspHeaderDecodeCacheControl( fieldValue, fieldValueLen, &cacheString );
-                                                               strncat( (char*)temper, (char*)cacheString, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                               }
+                                               break;
+
+                                       /* integer */
+                                       /* Max-forwards */
+                                       case 0x1e:
+                                       /* content-length */
+                                       case 0x0d:
+                                       /* age */
+                                       case 0x05:
+                                       /* Bearer-indication */
+                                       case 0x33:
+                                       /* Push-Flag */
+                                       case 0x34:
+                                               {
+
+                                                       unsigned char temp[16];
+                                                       /*
+                                                       if (( fieldValueLen == 2 ) && ( fieldValue[0] > 0x7f ))
+                                                               AcSprintf( (char*)temp, "%u", (unsigned int)fieldValue[1]);
+                                                       else
+                                                       */
+                                                       snprintf( (char*)temp, sizeof(temp), "%u", (unsigned int)wspHeaderDecodeIntegerByLength( fieldValue, fieldValueLen ));
+                                                       strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                               }
+                                               break;
+                                       /* X-Wap-Application-Id */
+                                       case 0x2f:
+                                               {
+                                                       unsigned char temp[64];
+                                                       int         integerValue;
+
+                                                       if (fieldValueLen == 2 &&  fieldValue[0] == 0) {
+                                                               memcpy( fieldValue, encodedHeader + iEncodedHeader -1, (size_t)fieldValueLen-1 );
+                                                               MSG_DEBUG("WspLDecodeHeader:For mmO2 problem\r\n" );
+                                                               fieldValueLen = 1;
                                                        }
-                                                       break;
 
-                                               /* pragma */
-                                               case 0x1f :
-                                                       if (fieldValue[0] == 0x80) {
-                                                               strncat( (char*)temper, (char*)wspCacheControl[0], (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
-                                                       } else {
-                                                               if (1 < fieldValueLen) {
-                                                                       char* param = NULL;
-                                                                       unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
-                                                                       wspHeaderDecodeParameter( fieldValue, fieldValueLen, &param );
+                                                       integerValue = wspHeaderDecodeIntegerByLength(fieldValue, fieldValueLen);
 
-                                                                       if (param != NULL) {
-                                                                               strncat( (char*)temper, "; ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
-                                                                               strncat( (char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
-                                                                       }
+                                                       int count = sizeof(wspHeaderApplId)/sizeof(SMS_WSP_HEADER_PARAMETER_S);
+                                                       for (int i = 0; i < count ; ++i) {
+                                                               if ((unsigned int)integerValue == wspHeaderApplId[i].parameterCode) {
+                                                                       snprintf((char*)temp, 64, "%s", wspHeaderApplId[i].parameterToken);
+                                                                       strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1);
+                                                                       break;
                                                                }
                                                        }
+                                               }
+                                               break;
+                                       /* Accept-Application */
+                                       case 0x32:
+                                               if (0x80 == fieldValue[0]) {
+                                                       strncat( (char*)temper, "*", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1 );
+                                               } else {
 
-                                                       break;
-                                               /* public */
-                                               case 0x22 :
-                                               /* allow */
-                                               case 0x06 :
-                                                       {
-                                                               unsigned long  i = 0;
-                                                               while ( wspHeaderDecodeIntegerByLength( fieldValue, fieldValueLen ) != wspMethodType[i].methodCode ) i++;
-                                                               strncat( (char*)temper, (char*)wspMethodType[i].methodName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
-                                                       }
-                                                       break;
-                                               /* range */
-                                               case 0x23 :
-                                                       strncat( (char*)temper, "bytes=", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
-                                                       if (fieldValue[0] == 0x80) {
-                                                               unsigned char temp[16];
-                                                               unsigned long  first, last;
-                                                               iField = 0;
-
-                                                               first = wspRetriveUintvarDecode( fieldValue, &iField );
-                                                               last = wspRetriveUintvarDecode( fieldValue, &iField );
-
-                                                               sprintf( (char*)temp, "%u-%u", (unsigned int)first, (unsigned int)last );
-                                                               strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
-                                                       }
-                                                       if (fieldValue[0] == 0x81) {
-                                                               unsigned char temp[16];
-                                                               unsigned long  suffix;
-
-                                                               suffix = wspRetriveUintvarDecode( fieldValue, &iField );
-
-                                                               sprintf( (char*)temp, "-%u", (unsigned int)suffix );
+                                                       unsigned char temp[16];
+                                                       /*
+                               if (( fieldValueLen == 2 ) && ( fieldValue[0] == 1 ))
+                                      AcSprintf( (char*)temp, "%u", (unsigned int)fieldValue[0]);
+                               else
+                                                       */
+                                                       snprintf( (char*)temp, sizeof(temp), "%u", (unsigned int)wspHeaderDecodeIntegerByLength( fieldValue, fieldValueLen ));
+                                                       strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1);
+                                               }
+                                               break;
+
+
+                                       /* date */
+                                       /* last-modified */
+                                       case 0x1d:
+                                       /* if-unmodified-since */
+                                       case 0x1b:
+                                       /* if-range */
+                                       case 0x1a:
+                                       /* if-modified-since */
+                                       case 0x17:
+                                       /* expires */
+                                       case 0x14:
+                                       /* date */
+                                       case 0x12:
+                                               {
+                                                       char* decodedString = NULL;
+                                                       unique_ptr<char*, void(*)(char**)> decodedStringbuf(&decodedString, unique_ptr_deleter);
+                                                       wspHeaderDecodeDateValue( fieldValueLen, fieldValue, &decodedString);
+                                                       strncat( (char*)temper, (char*)decodedString, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1 );
+                                               }
+                                               break;
+
+                                       /* connection */
+                                       case 0x09:
+                                               if (fieldValue[0] == 0x80 )
+                                                       strncat( (char*)temper, "Close", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1 );
+                                               break;
+                                       /* accept-ranges */
+                                       case 0x04:
+                                               if (fieldValue[0] == 0x80 )
+                                                       strncat( (char*)temper, "None", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1 );
+                                               if (fieldValue[0] == 0x81 )
+                                                       strncat( (char*)temper, "Bytes", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1 );
+                                               break;
+                                       /* content-md5 */
+                                       case 0x0f:
+                                               {
+                                                       unsigned char temp[1275];
+                                                       memcpy( temp, fieldValue, (size_t)fieldValueLen );
+                                                       temp[fieldValueLen] = 0;
+                                                       wspHeaderCopyDecodedString( temp, &currentLength, &temper );
+                                               }
+                                               break;
+                                       /* Credential */
+                                       /* authorization */
+                                       case 0x07:
+                                       /* proxy - authorization */
+                                       case 0x21:
+                                               if (fieldValue[0] == 0x80) {
+                                                       char* addString = NULL;
+                                                       unique_ptr<char*, void(*)(char**)> addStringbuf(&addString, unique_ptr_deleter);
+                                                       wspHeaderDecodeAuth(fieldValueLen, fieldValue, &addString );
+                                                       strncat( (char*)temper, addString, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                               } else {
+                                                       iField = AcStrlen( (char*)fieldValue) + 1;
 
+                                                       strncat( (char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                                       if (iField < fieldValueLen) {
+                                                               char* param = NULL;
+                                                               unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
+                                                               wspHeaderDecodeParameter( fieldValue + 1, fieldValueLen - 1, &param );
+                                                               if (param != NULL) {
+                                                                       strncat( (char*)temper, ", ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                                                       strncat( (char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                                               }
                                                        }
+                                               }
+                                               break;
+
+                                       /* Challenge */
+                                       /* www - auth */
+                                       case 0x2d:
+                                       /* Proxy-authenticate */
+                                       case 0x20:
+                                               if (0 == fieldValueLen )
                                                        break;
-                                               /* retry-after */
-                                               case 0x25 :
-                                                       if (fieldValue[0] == 0x80) {
-                                                               char* temp = NULL;
-                                                               unique_ptr<char*, void(*)(char**)> tempbuf(&temp, unique_ptr_deleter);
-
-                                                               wspHeaderDecodeDateValue( fieldValueLen - 1, fieldValue + 1, &temp );
-                                                               strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                               if (fieldValue[0] == 0x80) {
+                                                       char* addString = NULL;
+                                                       unique_ptr<char*, void(*)(char**)> addStringbuf(&addString, unique_ptr_deleter);
+                                                       wspHeaderDecodeChallenge(fieldValueLen, fieldValue, &addString );
+                                                       strncat( (char*)temper, addString, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                               } else {
+                                                       unsigned char  authScheme[WSP_STANDARD_STR_LEN_MAX + 1];
+                                                       unsigned char  realmValue[WSP_STANDARD_STR_LEN_MAX];
+                                                       unsigned char  addedString[WSP_STANDARD_STR_LEN_MAX];
+
+                                                       strncpy( (char*)authScheme, (char*)fieldValue, WSP_STANDARD_STR_LEN_MAX -1);
+                                                       iField = AcStrlen( (char*)authScheme ) + 1;
+                                                       strncpy( (char*)realmValue, (char*)(fieldValue + iField ), WSP_STANDARD_STR_LEN_MAX-1);
+                                                       iField = iField + AcStrlen( (char*)realmValue ) + 1;
+                                                       snprintf( (char*)addedString, sizeof(addedString), "%s %s", authScheme, realmValue );
+                                                       wspHeaderCopyDecodedString( addedString, &currentLength, &temper );
+
+                                                       if (iField < fieldValueLen) {
+                                                               char* param = NULL;
+                                                               unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
+                                                               wspHeaderDecodeParameter( fieldValue + iField, fieldValueLen - iField, &param );
+                                                               if (param != NULL) {
+                                                                       strncat( (char*)temper, ", ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                                                       wspHeaderCopyDecodedString( (unsigned char*)param, &currentLength, &temper );
+                                                               }
                                                        }
+                                               }
+                                               break;
 
-                                                       if (fieldValue[0] == 0x81) {
-                                                               unsigned char temp[16];
+                                       /* content -range */
+                                       case 0x10:
+                                               {
+                                                       unsigned long  first, len, last;
 
-                                                               sprintf( (char*)temp, "%u", (unsigned int)wspHeaderDecodeIntegerByLength( fieldValue,fieldValueLen ));
-                                                               strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
-                                                       }
-                                                       break;
-                                               /* transfer-encoding */
-                                               case 0x27 :
-                                                       /* No other cases allowed */
-                                                       if (fieldValue[0] == 0x80 )
-                                                               strncat( (char*)temper, "chunked", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                                       unsigned char  temp[16];
+                                                       iField = 0;
 
-                                                       break;
-                                               /* vary */
-                                               case 0x2a :
-                                                       {
-                                                               int integerValue = wspHeaderDecodeIntegerByLength(fieldValue,fieldValueLen );
-                                                               if (integerValue > wspHeaderFieldCount) {
-                                                                       MSG_DEBUG("WspLDecodeHeader: integerValue is over limit(0x%x).\n",wspHeaderFieldCount);
-                                                                       break;
-                                                               }
-                                                               strncat( (char*)temper, (char*)wspHeaderFieldName[integerValue], (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
-                                                       }
-                                                       break;
-                                               /* warning */
-                                               case 0x2c :
-                                                       {
-                                                               unsigned char temp[WSP_STANDARD_STR_LEN_MAX];
+                                                       strncat( (char*)temper," bytes ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
 
-                                                               if (fieldValue[0] < 0x20 )
-                                                                       iField = fieldValue[0];
-                                                               else
-                                                                       iField = 1;
+                                                       first = wspRetriveUintvarDecode( fieldValue, &iField );
+                                                       len = wspRetriveUintvarDecode( fieldValue, &iField );
+                                                       /* Originally range of HTTP include entity length. But WSP omit it. Finally to calculate this, it should be get content length from export. If this field is included without content length, then it can get wrong result. This content length can be get by calculating PDU length. */
+                                                       last = first + contentsLength - 1;
 
-                                                               snprintf( (char*)temp, sizeof(temp), "%u", (unsigned int)wspHeaderDecodeIntegerByLength( fieldValue, iField ));
-                                                               strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
-                                                               if (iField < fieldValueLen) {
-                                                                       unsigned char agent[WSP_STANDARD_STR_LEN_MAX];
-                                                                       unsigned char text[WSP_STANDARD_STR_LEN_MAX];
-                                                                       strncpy( (char*)agent, (char*)(fieldValue + iField ),WSP_STANDARD_STR_LEN_MAX-1);
-                                                                       iField = iField + AcStrlen((char*)agent ) + 1;
-                                                                       strncpy((char*)text, (char*)(fieldValue + iField ),WSP_STANDARD_STR_LEN_MAX-1);
-                                                                       snprintf( (char*)temp, sizeof(temp), " %s %s", agent, text );
-                                                                       wspHeaderCopyDecodedString( temp, &currentLength, &temper );
-                                                               }
-                                                       }
-                                                       break;
-                                               /* content-disposition */
-                                               case 0x2e :
-                                                       if (fieldValue[0] == 0x80 )
-                                                               strncat( (char*)temper, "form-data", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                                       snprintf( (char*)temp, sizeof(temp), "%u-%u/%u", (unsigned int)first, (unsigned int)last, (unsigned int)len );
+                                                       strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                               }
+                                               break;
 
-                                                       if (fieldValue[0] == 0x81 )
-                                                               strncat( (char*)temper, "attachment", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                       /* cache-control */
+                                       case 0x08:
+                                               {
+                                                       char* cacheString = NULL;
+                                                       unique_ptr<char*, void(*)(char**)> cacheStringbuf(&cacheString, unique_ptr_deleter);
 
+                                                       wspHeaderDecodeCacheControl( fieldValue, fieldValueLen, &cacheString );
+                                                       strncat( (char*)temper, (char*)cacheString, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                               }
+                                               break;
+
+                                       /* pragma */
+                                       case 0x1f:
+                                               if (fieldValue[0] == 0x80) {
+                                                       strncat( (char*)temper, (char*)wspCacheControl[0], (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                               } else {
                                                        if (1 < fieldValueLen) {
                                                                char* param = NULL;
                                                                unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
-                                                               wspHeaderDecodeParameter( fieldValue + 1, fieldValueLen - 1, &param );
+                                                               wspHeaderDecodeParameter( fieldValue, fieldValueLen, &param );
 
                                                                if (param != NULL) {
                                                                        strncat( (char*)temper, "; ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
                                                                        strncat( (char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
                                                                }
                                                        }
-                                                       break;
-                                               /* Profile-diff */
-                                               case 0x36 :
-                                                       temper[AcStrlen((char*)temper) + fieldValueLen] = '\0';
-                                                       memcpy( temper, fieldValue, (size_t)fieldValueLen );
-                                                       break;
-                                               /* Profile-Warning */
-                                               case 0x37 :
-                                                       {
-                                                               unsigned char temp[WSP_STANDARD_STR_LEN_MAX];
-
-                                                               snprintf( (char*)temp, sizeof(temp), "%lX", wspHeaderDecodeInteger(fieldValue ));
-                                                               temp[2] = temp[1];
-                                                               temp[1] = (unsigned char)0x30;
-                                                               temp[3] = '\0';
-                                                               if (fieldValueLen > 1) {
-                                                                       /* copy warn-target - URI */
-                                                                       strncat( (char*)temp, (char*)(fieldValue + 1), WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)temp)-1 );
-                                                                       if (fieldValueLen > ( AcStrlen( (char*)(fieldValue + 1)) + 1 )) {
-                                                                               /* copy warn-date */
-                                                                               char* decodedString = NULL;
-                                                                               unique_ptr<char*, void(*)(char**)> decodedStringbuf(&decodedString, unique_ptr_deleter);
-                                                                               wspHeaderDecodeDateValue( fieldValueLen - ( AcStrlen( (char*)(fieldValue + 1)) + 2 ), fieldValue + AcStrlen( (char*)(fieldValue + 1)) + 1, &decodedString );
-                                                                               strncat( (char*)temp, (char*)decodedString, WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)temp)-1 );
-                                                                       }
+                                               }
+                                               break;
+
+                                       /* public */
+                                       case 0x22:
+                                       /* allow */
+                                       case 0x06:
+                                               {
+                                                       unsigned long  i = 0;
+                                                       while ( wspHeaderDecodeIntegerByLength( fieldValue, fieldValueLen ) != wspMethodType[i].methodCode ) i++;
+                                                       strncat( (char*)temper, (char*)wspMethodType[i].methodName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                               }
+                                               break;
+                                       /* range */
+                                       case 0x23:
+                                               strncat( (char*)temper, "bytes=", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                               if (fieldValue[0] == 0x80) {
+                                                       unsigned char temp[16];
+                                                       unsigned long  first, last;
+                                                       iField = 0;
+
+                                                       first = wspRetriveUintvarDecode( fieldValue, &iField );
+                                                       last = wspRetriveUintvarDecode( fieldValue, &iField );
+
+                                                       snprintf( (char*)temp, sizeof(temp), "%u-%u", (unsigned int)first, (unsigned int)last );
+                                                       strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                               }
+                                               if (fieldValue[0] == 0x81) {
+                                                       unsigned char temp[16];
+                                                       unsigned long  suffix;
+
+                                                       suffix = wspRetriveUintvarDecode( fieldValue, &iField );
+
+                                                       snprintf( (char*)temp, sizeof(temp), "-%u", (unsigned int)suffix );
+
+                                               }
+                                               break;
+                                       /* retry-after */
+                                       case 0x25:
+                                               if (fieldValue[0] == 0x80) {
+                                                       char* temp = NULL;
+                                                       unique_ptr<char*, void(*)(char**)> tempbuf(&temp, unique_ptr_deleter);
+
+                                                       wspHeaderDecodeDateValue( fieldValueLen - 1, fieldValue + 1, &temp );
+                                                       strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                               }
+
+                                               if (fieldValue[0] == 0x81) {
+                                                       unsigned char temp[16];
+
+                                                       snprintf( (char*)temp, sizeof(temp), "%u", (unsigned int)wspHeaderDecodeIntegerByLength( fieldValue,fieldValueLen ));
+                                                       strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                               }
+                                               break;
+                                       /* transfer-encoding */
+                                       case 0x27:
+                                               /* No other cases allowed */
+                                               if (fieldValue[0] == 0x80 )
+                                                       strncat( (char*)temper, "chunked", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+
+                                               break;
+                                       /* vary */
+                                       case 0x2a:
+                                               {
+                                                       int integerValue = wspHeaderDecodeIntegerByLength(fieldValue,fieldValueLen );
+                                                       if (integerValue > wspHeaderFieldCount) {
+                                                               MSG_DEBUG("WspLDecodeHeader: integerValue is over limit(0x%x).\n",wspHeaderFieldCount);
+                                                               break;
+                                                       }
+                                                       strncat( (char*)temper, (char*)wspHeaderFieldName[integerValue], (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                               }
+                                               break;
+                                       /* warning */
+                                       case 0x2c:
+                                               {
+                                                       unsigned char temp[WSP_STANDARD_STR_LEN_MAX];
+
+                                                       if (fieldValue[0] < 0x20 )
+                                                               iField = fieldValue[0];
+                                                       else
+                                                               iField = 1;
+
+                                                       snprintf( (char*)temp, sizeof(temp), "%u", (unsigned int)wspHeaderDecodeIntegerByLength( fieldValue, iField ));
+                                                       strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                                       if (iField < fieldValueLen) {
+                                                               unsigned char agent[WSP_STANDARD_STR_LEN_MAX];
+                                                               unsigned char text[WSP_STANDARD_STR_LEN_MAX];
+                                                               strncpy( (char*)agent, (char*)(fieldValue + iField ),WSP_STANDARD_STR_LEN_MAX-1);
+                                                               iField = iField + AcStrlen((char*)agent ) + 1;
+                                                               strncpy((char*)text, (char*)(fieldValue + iField ),WSP_STANDARD_STR_LEN_MAX-1);
+                                                               snprintf( (char*)temp, sizeof(temp), " %s %s", agent, text );
+                                                               wspHeaderCopyDecodedString( temp, &currentLength, &temper );
+                                                       }
+                                               }
+                                               break;
+                                       /* content-disposition */
+                                       case 0x2e:
+                                               if (fieldValue[0] == 0x80 )
+                                                       strncat( (char*)temper, "form-data", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+
+                                               if (fieldValue[0] == 0x81 )
+                                                       strncat( (char*)temper, "attachment", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+
+                                               if (1 < fieldValueLen) {
+                                                       char* param = NULL;
+                                                       unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
+                                                       wspHeaderDecodeParameter( fieldValue + 1, fieldValueLen - 1, &param );
+
+                                                       if (param != NULL) {
+                                                               strncat( (char*)temper, "; ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                                               strncat( (char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                                       }
+                                               }
+                                               break;
+                                       /* Profile-diff */
+                                       case 0x36:
+                                               temper[AcStrlen((char*)temper) + fieldValueLen] = '\0';
+                                               memcpy( temper, fieldValue, (size_t)fieldValueLen );
+                                               break;
+                                       /* Profile-Warning */
+                                       case 0x37:
+                                               {
+                                                       unsigned char temp[WSP_STANDARD_STR_LEN_MAX];
+
+                                                       snprintf( (char*)temp, sizeof(temp), "%lX", wspHeaderDecodeInteger(fieldValue ));
+                                                       temp[2] = temp[1];
+                                                       temp[1] = (unsigned char)0x30;
+                                                       temp[3] = '\0';
+                                                       if (fieldValueLen > 1) {
+                                                               /* copy warn-target - URI */
+                                                               strncat( (char*)temp, (char*)(fieldValue + 1), WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)temp)-1 );
+                                                               if (fieldValueLen > ( AcStrlen( (char*)(fieldValue + 1)) + 1 )) {
+                                                                       /* copy warn-date */
+                                                                       char* decodedString = NULL;
+                                                                       unique_ptr<char*, void(*)(char**)> decodedStringbuf(&decodedString, unique_ptr_deleter);
+                                                                       wspHeaderDecodeDateValue( fieldValueLen - ( AcStrlen( (char*)(fieldValue + 1)) + 2 ), fieldValue + AcStrlen( (char*)(fieldValue + 1)) + 1, &decodedString );
+                                                                       strncat( (char*)temp, (char*)decodedString, WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)temp)-1 );
                                                                }
-                                                               strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
                                                        }
-                                                       break;
+                                                       strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                               }
+                                               break;
 
-                                               default :
-                                                       break;
+                                       default:
+                                               break;
                                        }
-
                                }
                        }
                }
@@ -3082,92 +3007,92 @@ void SmsPluginWapPushHandler::wspHeaderDecodeParameter( unsigned char* data, uns
                return;
        }
 
-       switch ( data[0] & 0x7f )
-       {
-               case 0x00 :
-                       wspHeaderDecodeQValue(  length - 1, data + 1, &param);
-                       break;
-               case 0x01 :
-                       wspHeaderDecodeCharset( length - 1 , data + 1, &param);
-                       break;
-               case 0x02 :
-                       wspHeaderDecodeVersion( length - 1, data + 1, &param);
-                       break;
-                       /* integer */
-               case 0x03 :
-                       //param = (unsigned char *)malloc( (size_t)WSP_STANDARD_STR_LEN_MAX );
-                       param = new char[WSP_STANDARD_STR_LEN_MAX];
-                       if (param == NULL) {
-                               MSG_DEBUG("WspLHeaderDecodeParameter: 0x03 MemAlloc failed\n");
-                               return;
-                       } else {
-                               sprintf( (char*)param, "Type=%i", (int)wspHeaderDecodeInteger( data + 1 ));
-                       }
-                       break;
-               case 0x08 :
-                       param = new char[WSP_STANDARD_STR_LEN_MAX];
+       switch (data[0] & 0x7f) {
+       case 0x00:
+               wspHeaderDecodeQValue(  length - 1, data + 1, &param);
+               break;
+       case 0x01:
+               wspHeaderDecodeCharset( length - 1 , data + 1, &param);
+               break;
+       case 0x02:
+               wspHeaderDecodeVersion( length - 1, data + 1, &param);
+               break;
+               /* integer */
+       case 0x03:
+               /* param = (unsigned char *)malloc( (size_t)WSP_STANDARD_STR_LEN_MAX ); */
+               param = new char[WSP_STANDARD_STR_LEN_MAX];
+               if (param == NULL) {
+                       MSG_DEBUG("WspLHeaderDecodeParameter: 0x03 MemAlloc failed\n");
+                       return;
+               } else {
+                       sprintf( (char*)param, "Type=%i", (int)wspHeaderDecodeInteger( data + 1 ));
+               }
+               break;
+       case 0x08:
+               param = new char[WSP_STANDARD_STR_LEN_MAX];
 
-                       if (param == NULL) {
-                               MSG_DEBUG("WspLHeaderDecodeParameter:0x08 MemAlloc failed\n");
-                               return;
-                       } else {
-                               sprintf( (char*)param, "Padding=%i", (int)wspHeaderDecodeInteger( data + 1 ));
-                       }
-                       break;
-               case 0x05 :
-                       param = new char[WSP_STANDARD_STR_LEN_MAX];
+               if (param == NULL) {
+                       MSG_DEBUG("WspLHeaderDecodeParameter:0x08 MemAlloc failed\n");
+                       return;
+               } else {
+                       sprintf( (char*)param, "Padding=%i", (int)wspHeaderDecodeInteger( data + 1 ));
+               }
+               break;
+       case 0x05:
+               param = new char[WSP_STANDARD_STR_LEN_MAX];
 
-                       if (param == NULL) {
-                               MSG_DEBUG("WspLHeaderDecodeParameter:0x05 MemAlloc failed\n");
-                               return;
-                       } else {
-                               strncpy( (char*)param, "Name=", WSP_STANDARD_STR_LEN_MAX-1);
-                               memcpy( param + 5, data + 1, length - 1 );
-                               param[5 + length - 1] = '\0';
-                       }
-                       break;
-               case 0x06 :
-                       param = new char[WSP_STANDARD_STR_LEN_MAX];
+               if (param == NULL) {
+                       MSG_DEBUG("WspLHeaderDecodeParameter:0x05 MemAlloc failed\n");
+                       return;
+               } else {
+                       strncpy( (char*)param, "Name=", WSP_STANDARD_STR_LEN_MAX-1);
+                       memcpy( param + 5, data + 1, length - 1 );
+                       param[5 + length - 1] = '\0';
+               }
+               break;
+       case 0x06:
+               param = new char[WSP_STANDARD_STR_LEN_MAX];
 
-                       if (param == NULL) {
-                               MSG_DEBUG("WspLHeaderDecodeParameter:0x06 MemAlloc failed\n");
-                               return;
-                       } else {
-                               strncpy( (char*)param, "Filename=", WSP_STANDARD_STR_LEN_MAX-1);
-                               memcpy( param + 9, (char*)(data + 1), (size_t)(length - 1) );
-                               param[9 + length - 1] = '\0';
-                       }
-                       break;
-               case 0x07 :
-                       param = NULL;
-                       /* TBI */
-                       break;
-                       /*OMA Provisioning*/
-               case 0x11 :
-                       param = new char[WSP_STANDARD_STR_LEN_MAX];
+               if (param == NULL) {
+                       MSG_DEBUG("WspLHeaderDecodeParameter:0x06 MemAlloc failed\n");
+                       return;
+               } else {
+                       strncpy( (char*)param, "Filename=", WSP_STANDARD_STR_LEN_MAX-1);
+                       memcpy( param + 9, (char*)(data + 1), (size_t)(length - 1) );
+                       param[9 + length - 1] = '\0';
+               }
+               break;
+       case 0x07:
+               param = NULL;
+               /* TBI */
+               break;
+               /*OMA Provisioning*/
+       case 0x11:
+               param = new char[WSP_STANDARD_STR_LEN_MAX];
 
-                       if (param == NULL) {
-                               MSG_DEBUG("WspLHeaderDecodeParameter:0x11 MemAlloc failed\n");
-                               return;
-                       } else {
-                               strncpy((char*)param, "SEC=", WSP_STANDARD_STR_LEN_MAX-1);
-                               SecurityTypeCode = data[1] & 0x7f;
-                               while (( i < wspSecurityTypeCount ) && ( wspSecurityType[i].SecurityTypeCode != SecurityTypeCode )) i++;
+               if (param == NULL) {
+                       MSG_DEBUG("WspLHeaderDecodeParameter:0x11 MemAlloc failed\n");
+                       return;
+               } else {
+                       strncpy((char*)param, "SEC=", WSP_STANDARD_STR_LEN_MAX-1);
+                       SecurityTypeCode = data[1] & 0x7f;
+                       while (( i < wspSecurityTypeCount ) && ( wspSecurityType[i].SecurityTypeCode != SecurityTypeCode ))
+                               i++;
 
-                               if (i < wspSecurityTypeCount) {
-                                       strncat( (char*)param, (char*)wspSecurityType[i].SecurityTypeName, WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)param)-1);
-                               }
+                       if (i < wspSecurityTypeCount) {
+                               strncat( (char*)param, (char*)wspSecurityType[i].SecurityTypeName, WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)param)-1);
+                       }
 
-                               if (0x12 == (data[2] & 0x7f)) {
-                                       strncat( (char*)param, "; MAC=", WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)param)-1 );
-                                       memcpy(param+AcStrlen( (char*)param),(char*)(data+3),(size_t)length-3 );
-                               }
+                       if (0x12 == (data[2] & 0x7f)) {
+                               strncat( (char*)param, "; MAC=", WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)param)-1 );
+                               memcpy(param+AcStrlen( (char*)param),(char*)(data+3),(size_t)length-3 );
                        }
-                       break;
+               }
+               break;
 
-               default :
-                       param = NULL;
-                       break;
+       default:
+               param = NULL;
+               break;
        }
 
        *pParam = param;
@@ -3207,7 +3132,6 @@ void SmsPluginWapPushHandler::wspHeaderDecodeCharset( unsigned long length, unsi
 }
 
 
-
 void SmsPluginWapPushHandler::wspHeaderDecodeVersion( unsigned long length, unsigned char* data, char** pDecodedString )
 {
        *pDecodedString = new char[WSP_STANDARD_STR_LEN_MAX];
@@ -3257,8 +3181,7 @@ void SmsPluginWapPushHandler::wspHeaderDecodeDateValue( unsigned long length, un
 
        /* check date value validity */
        {
-               if (( pTMData->tm_wday > 6 ) || (pTMData->tm_mon > 11 ) || (pTMData->tm_mday >  31 ))
-               {
+               if (( pTMData->tm_wday > 6 ) || (pTMData->tm_mon > 11 ) || (pTMData->tm_mday >  31 )) {
                        MSG_DEBUG( "WspLHeaderDecodeDateValue: Date decode fail %d, %d, %d \n", pTMData->tm_wday, pTMData->tm_mon, pTMData->tm_mday );
                        strncpy( (char*)*pDecodedString, "Decoding Failed", WSP_STANDARD_STR_LEN_MAX-1);
                        return;
@@ -3266,28 +3189,26 @@ void SmsPluginWapPushHandler::wspHeaderDecodeDateValue( unsigned long length, un
        }
 
 #ifdef MSG_FW_FOR_DEBUG
-       /** Date type selection */
-       switch ( wspMachineStatus.dateType )
-       {
-                       /* UNIX asciitime function */
-               case UNIX_DATE_TYPE :
-                       snprintf( (char*)decodedString, sizeof(decodedString), "%s %s %-2u %u:%u:%u %u GMT", wspWeek[pTMData->tm_wday], wspMonth[pTMData->tm_mon],
-                                          pTMData->tm_mday, pTMData->tm_hour, pTMData->tm_min, pTMData->tm_sec, pTMData->tm_year + 1900 );
-                       break;
-               case RFC1123_DATE_TYPE :
-                       snprintf( (char*)decodedString, sizeof(decodedString), "%s, %u %s %u %u:%u:%u GMT", wspWeek[pTMData->tm_wday], pTMData->tm_mday,
-                                          wspMonth[pTMData->tm_mon], pTMData->tm_year + 1900, pTMData->tm_hour, pTMData->tm_min, pTMData->tm_sec );
-                       break;
-               case RFC850_DATE_TYPE :
-                       /* Have some Y2K Problems */
-                       /* In RFC 850, date is represented like 11-May-99. So Y2K problem always can be occured. So remainer (year divided by 100) is used.                     */
-                       snprintf( (char*)decodedString, sizeof(decodedString), "%s, %2u-%s-%2u %u:%u:%u GMT", wspWeekDay[pTMData->tm_wday], pTMData->tm_mday,
-                                          wspMonth[pTMData->tm_mon], pTMData->tm_year % CENTURY, pTMData->tm_hour, pTMData->tm_min, pTMData->tm_sec );
-
-                       break;
+       /* Date type selection */
+       switch (wspMachineStatus.dateType) {
+               /* UNIX asciitime function */
+       case UNIX_DATE_TYPE:
+               snprintf( (char*)decodedString, sizeof(decodedString), "%s %s %-2u %u:%u:%u %u GMT", wspWeek[pTMData->tm_wday], wspMonth[pTMData->tm_mon],
+                                  pTMData->tm_mday, pTMData->tm_hour, pTMData->tm_min, pTMData->tm_sec, pTMData->tm_year + 1900 );
+               break;
+       case RFC1123_DATE_TYPE:
+               snprintf( (char*)decodedString, sizeof(decodedString), "%s, %u %s %u %u:%u:%u GMT", wspWeek[pTMData->tm_wday], pTMData->tm_mday,
+                                  wspMonth[pTMData->tm_mon], pTMData->tm_year + 1900, pTMData->tm_hour, pTMData->tm_min, pTMData->tm_sec );
+               break;
+       case RFC850_DATE_TYPE:
+               /* Have some Y2K Problems */
+               /* In RFC 850, date is represented like 11-May-99. So Y2K problem always can be occured. So remainer (year divided by 100) is used.                     */
+               snprintf( (char*)decodedString, sizeof(decodedString), "%s, %2u-%s-%2u %u:%u:%u GMT", wspWeekDay[pTMData->tm_wday], pTMData->tm_mday,
+                                  wspMonth[pTMData->tm_mon], pTMData->tm_year % CENTURY, pTMData->tm_hour, pTMData->tm_min, pTMData->tm_sec );
+               break;
        }
 #endif
-       /**UNIX_DATE_TYPE : */
+       /*UNIX_DATE_TYPE : */
        snprintf( (char*)*pDecodedString, (sizeof(char)*WSP_STANDARD_STR_LEN_MAX), "%s %s %-2u %u:%u:%u %u GMT", wspWeek[pTMData->tm_wday], wspMonth[pTMData->tm_mon],
                                                                                        pTMData->tm_mday, pTMData->tm_hour, pTMData->tm_min, pTMData->tm_sec, pTMData->tm_year + 1900 );
 
@@ -3295,12 +3216,13 @@ void SmsPluginWapPushHandler::wspHeaderDecodeDateValue( unsigned long length, un
 
 }
 
+
 void SmsPluginWapPushHandler::wspHeaderCopyDecodedString( unsigned char* szDecodedString, unsigned long* currentLen, char** pTemper )
 {
        unsigned long elementLen = AcStrlen( (char*)szDecodedString );
        char* temper2 = NULL;
 
-       /**  // CR+LF */
+       /* CR+LF */
        *currentLen = *currentLen + elementLen + 2;
 
        if ( *currentLen > AcStrlen( (char*)* pTemper ) + 2) {
@@ -3400,35 +3322,32 @@ void SmsPluginWapPushHandler::wspHeaderDecodeCacheControl(unsigned char* fieldVa
        if (fieldValue[0] > 0x7f) {
                /* directive that has parameter */
                cacheCode = fieldValue[0] & 0x7f;
-               switch ( cacheCode )
-               {
-                               /* field name */
-                               /* no-cache */
-                       case 0x00 :
-                               /* private */
-                       case 0x07 :
-                               if (fieldValue[1] > 0x7f) {
-                                       /* well known field name */
-                                       strncpy( (char*)paramString, (char*)wspHeaderFieldName[fieldValue[1] & 0x7f],WSP_STANDARD_STR_LEN_MAX-1 );
-                                       paramString[WSP_STANDARD_STR_LEN_MAX-1] = '\0';
-                               } else {
-                                       /* unknown field name */
-                                       strncpy( (char*)paramString, (char*)fieldValue + 1 , WSP_STANDARD_STR_LEN_MAX-1);
-                               }
-                               break;
-                               /* secound */
-                               /* max-age */
-                       case 0x02 :
-                               /* max- stale */
-                       case 0x03 :
-                               /* min-fresh */
-                       case 0x04 :
-                               snprintf( (char*)paramString, sizeof(paramString), "%u", (unsigned int)wspHeaderDecodeInteger( fieldValue + 1));
-                               break;
-
-                       default :
-                               break;
-
+               switch (cacheCode) {
+               /* field name */
+               /* no-cache */
+               case 0x00:
+               /* private */
+               case 0x07:
+                       if (fieldValue[1] > 0x7f) {
+                               /* well known field name */
+                               strncpy( (char*)paramString, (char*)wspHeaderFieldName[fieldValue[1] & 0x7f],WSP_STANDARD_STR_LEN_MAX-1 );
+                               paramString[WSP_STANDARD_STR_LEN_MAX-1] = '\0';
+                       } else {
+                               /* unknown field name */
+                               strncpy( (char*)paramString, (char*)fieldValue + 1 , WSP_STANDARD_STR_LEN_MAX-1);
+                       }
+                       break;
+               /* secound */
+               /* max-age */
+               case 0x02:
+               /* max- stale */
+               case 0x03:
+               /* min-fresh */
+               case 0x04:
+                       snprintf( (char*)paramString, sizeof(paramString), "%u", (unsigned int)wspHeaderDecodeInteger( fieldValue + 1));
+                       break;
+               default:
+                       break;
                }
                snprintf((char*)*pCacheString, (sizeof(char)*WSP_STANDARD_STR_LEN_MAX), "%s=%s", (char*)wspCacheControl[cacheCode], (char*)paramString );
        } else {
index 70aa3e4..0e3e1f5 100755 (executable)
@@ -1,17 +1,17 @@
 /*
-* Copyright 2012-2013  Samsung Electronics Co., Ltd
-*
-* Licensed under the Flora License, Version 1.1 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*    http://floralicense.org/license/
-*
-* 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.
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
 */
 
 #ifndef SMS_CDMA_PLUGIN_CALLBACK_H
@@ -76,5 +76,4 @@ private:
        static SmsPluginCallback* pInstance;
 };
 
-#endif //SMS_CDMA_PLUGIN_CALLBACK_H
-
+#endif /* SMS_CDMA_PLUGIN_CALLBACK_H */
index cdfd814..a71a311 100755 (executable)
@@ -1,17 +1,17 @@
 /*
-* Copyright 2012-2013  Samsung Electronics Co., Ltd
-*
-* Licensed under the Flora License, Version 1.1 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*    http://floralicense.org/license/
-*
-* 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.
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
 */
 
 #ifndef SMS_CDMA_PLUGIN_CODEC_H
@@ -84,4 +84,4 @@ private:
        static sms_message_type_t findMsgType(const unsigned char *p_pkg_str, int pkg_len);
 };
 
-#endif //SMS_CDMA_PLUGIN_CODEC_H
+#endif /* SMS_CDMA_PLUGIN_CODEC_H */
index 2abf4c9..6772c77 100755 (executable)
@@ -1,17 +1,17 @@
 /*
-* Copyright 2012-2013  Samsung Electronics Co., Ltd
-*
-* Licensed under the Flora License, Version 1.1 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*    http://floralicense.org/license/
-*
-* 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.
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
 */
 
 #ifndef SMS_CDMA_PLUGIN_EVENT_HANDLER_H
@@ -37,23 +37,20 @@ using namespace std;
 /*==================================================================================================
                                      VARIABLES AND DEFINES
 ==================================================================================================*/
-struct wap_data_s
-{
+struct wap_data_s {
        int     length;
        char data[SMS_MAX_USER_DATA_LEN+1];
 };
 
 typedef map<unsigned char, wap_data_s> wapDataMap;
 
-typedef struct _sms_wap_msg_s
-{
+typedef struct _sms_wap_msg_s {
        unsigned short  msgId;
        unsigned char           totalSeg;
        unsigned char           segNum;
 } sms_wap_msg_s;
 
-typedef struct _sms_wap_info_s
-{
+typedef struct _sms_wap_info_s {
        unsigned short  msgId;
        unsigned char           totalSeg;
        unsigned char           segNum;
@@ -63,7 +60,6 @@ typedef struct _sms_wap_info_s
 } sms_wap_info_s;
 
 
-
 /*==================================================================================================
                                      CLASS DEFINITIONS
 ==================================================================================================*/
@@ -125,9 +121,7 @@ private:
        int MakeWapUserData(unsigned short msgId, char **ppTotalData);
 
        bool checkCbOpt(sms_trans_svc_ctg_t svc_ctg);
-       std::list<MSG_CB_DUPLICATE_S> duplicateCb;
 
 };
 
-#endif //SMS_CDMA_PLUGIN_EVENT_HANDLER_H
-
+#endif /* SMS_CDMA_PLUGIN_EVENT_HANDLER_H */
index 2ff6bd8..4fe2916 100755 (executable)
@@ -1,17 +1,17 @@
 /*
-* Copyright 2012-2013  Samsung Electronics Co., Ltd
-*
-* Licensed under the Flora License, Version 1.1 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*    http://floralicense.org/license/
-*
-* 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.
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
 */
 
 #ifndef SMS_CDMA_PLUGIN_MAIN_H
@@ -62,5 +62,4 @@ msg_error_t SmsPlgAddMessage(MSG_MESSAGE_INFO_S *pMsgInfo,  MSG_SENDINGOPT_INFO_
 }
 #endif
 
-#endif //SMS_CDMA_PLUGIN_MAIN_H
-
+#endif /* SMS_CDMA_PLUGIN_MAIN_H */
index bf4fd61..b6924a0 100755 (executable)
@@ -1,17 +1,17 @@
 /*
-* Copyright 2012-2013  Samsung Electronics Co., Ltd
-*
-* Licensed under the Flora License, Version 1.1 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*    http://floralicense.org/license/
-*
-* 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.
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
 */
 
 #ifndef SMS_CDMA_PLUGIN_PARAMCODEC_H
index c31fb9d..466b588 100755 (executable)
@@ -1,17 +1,17 @@
 /*
-* Copyright 2012-2013  Samsung Electronics Co., Ltd
-*
-* Licensed under the Flora License, Version 1.1 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*    http://floralicense.org/license/
-*
-* 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.
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
 */
 
 #ifndef SMS_CDMA_PLUGIN_SETTING_H
@@ -89,5 +89,4 @@ private:
        CndVar cv;
 };
 
-#endif //SMS_CDMA_PLUGIN_SETTING_H
-
+#endif /* SMS_CDMA_PLUGIN_SETTING_H */
index 85910bd..c42631e 100755 (executable)
@@ -1,17 +1,17 @@
 /*
-* Copyright 2012-2013  Samsung Electronics Co., Ltd
-*
-* Licensed under the Flora License, Version 1.1 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*    http://floralicense.org/license/
-*
-* 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.
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
 */
 
 #ifndef SMS_CDMA_PLUGIN_STORAGE_H
@@ -72,5 +72,4 @@ private:
        std::list<PUSH_APPLICATION_INFO_S> pushAppInfoList;
 };
 
-#endif //SMS_CDMA_PLUGIN_STORAGE_H
-
+#endif /* SMS_CDMA_PLUGIN_STORAGE_H */
index 38169ea..607f71f 100755 (executable)
@@ -1,18 +1,17 @@
-
 /*
-* Copyright 2012-2013  Samsung Electronics Co., Ltd
-*
-* Licensed under the Flora License, Version 1.1 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*    http://floralicense.org/license/
-*
-* 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.
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
 */
 
 #ifndef SMS_CDMA_PLUGIN_TRANSPORT_H
@@ -73,4 +72,4 @@ private:
        CndVar cv;
 };
 
-#endif //SMS_PLUGIN_TRANSPORT_H
+#endif /* SMS_PLUGIN_TRANSPORT_H */
index e15039d..ee83bc9 100755 (executable)
@@ -1,17 +1,17 @@
 ï»¿/*
-* Copyright 2012-2013  Samsung Electronics Co., Ltd
-*
-* Licensed under the Flora License, Version 1.1 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*    http://floralicense.org/license/
-*
-* 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.
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
 */
 
 #include "MsgDebug.h"
 #ifndef SMS_CDMA_PLUGIN_TYPES_H
 #define SMS_CDMA_PLUGIN_TYPES_H
 
-#define SMS_MAX_MESSAGE_ID                     65536
-#define SMS_SEQ_NUM_MAX                                64
-#define SMS_MAX_USER_DATA_LEN          160
-#define SMS_MAX_SUBMIT_MESSAGE_ID      256
+#define MAX_SMS_SEND_RETRY     4
+#define SMS_MAX_MESSAGE_ID 65536
+#define SMS_SEQ_NUM_MAX 64
+#define SMS_MAX_USER_DATA_LEN 160
+#define SMS_MAX_SUBMIT_MESSAGE_ID 256
 
-#define SMS_TRANS_ADDRESS_MAX_LEN      256
+#define SMS_TRANS_ADDRESS_MAX_LEN 256
 
-#define SMS_MAX_NUMBER_OF_ACK          8
+#define SMS_MAX_NUMBER_OF_ACK 8
 
-#define SMS_PUSH_XML_HREF_TAG          "href"
-#define SMS_PUSH_XML_SI_ID_TAG         "si-id"
-#define SMS_PUSH_XML_CREATED_TAG       "created"
-#define SMS_PUSH_XML_EXPIRES_TAG       "si-expires"
-#define SMS_PUSH_XML_ACTION_TAG                "action"
+#define SMS_PUSH_XML_HREF_TAG "href"
+#define SMS_PUSH_XML_SI_ID_TAG "si-id"
+#define SMS_PUSH_XML_CREATED_TAG "created"
+#define SMS_PUSH_XML_EXPIRES_TAG "si-expires"
+#define SMS_PUSH_XML_ACTION_TAG "action"
 
-#define SMS_PUSH_XML_INVAL_OBJ         "invalidate-object"
-#define SMS_PUSH_XML_INVAL_SVC         "invalidate-service"
-#define SMS_PUSH_XML_CO_URI                    "uri"
+#define SMS_PUSH_XML_INVAL_OBJ "invalidate-object"
+#define SMS_PUSH_XML_INVAL_SVC "invalidate-service"
+#define SMS_PUSH_XML_CO_URI "uri"
 
 
 typedef unsigned char sms_wap_app_code_t;      /* _sms_wap_app_code_e */
 
-typedef struct _SMS_WSP_CONTENTS_TYPE_S
-{
+typedef struct _SMS_WSP_CONTENTS_TYPE_S {
        char*         contentsTypeName;
        unsigned char contentsTypeCode;
 } SMS_WSP_CONTENTS_TYPE_S;
 
 
-typedef struct _SMS_WSP_CHARSET_S
-{
+typedef struct _SMS_WSP_CHARSET_S {
        char*  charsetName;
        unsigned short charsetCode;
 } SMS_WSP_CHARSET_S;
 
 
-typedef struct _SMS_WAP_UNREGISTER_CONTENTS_TYPE_S
-{
+typedef struct _SMS_WAP_UNREGISTER_CONTENTS_TYPE_S {
        char*         contentsTypeName;
        unsigned short contentsTypeCode;
 } SMS_WAP_UNREGISTER_CONTENTS_TYPE_S;
 
 
-typedef struct _SMS_WSP_LANGUAGE_S
-{
+typedef struct _SMS_WSP_LANGUAGE_S {
        char*         languageName;
        unsigned char languageCode;
 } SMS_WSP_LANGUAGE_S;
 
 
-typedef struct _SMS_WSP_HEADER_PARAMETER_S
-{
+typedef struct _SMS_WSP_HEADER_PARAMETER_S {
        char*         parameterToken;
        unsigned int parameterCode;
 } SMS_WSP_HEADER_PARAMETER_S;
 
 
-typedef struct _SMS_WSP_METHOD_TYPE_S
-{
+typedef struct _SMS_WSP_METHOD_TYPE_S {
        char*         methodName;
        unsigned char methodCode;
 } SMS_WSP_METHOD_TYPE_S;
 
 
-typedef struct _SMS_WSP_SECURITY_TYPE_S
-{
+typedef struct _SMS_WSP_SECURITY_TYPE_S {
        char*         SecurityTypeName;
        unsigned char SecurityTypeCode;
 }SMS_WSP_SECURITY_TYPE_S;
 
-typedef struct
-{
-       msg_request_id_t                        reqId;          /**< Indicates the request ID, which is unique. When applications submit a request to the framework, this value will be set by the framework. */
-       MSG_MESSAGE_INFO_S                      msgInfo;        /**< Indicates the message structure to be sent by applications. */
+
+typedef struct {
+       msg_request_id_t                        reqId;          /* < Indicates the request ID, which is unique. When applications submit a request to the framework, this value will be set by the framework. */
+       MSG_MESSAGE_INFO_S                      msgInfo;        /* < Indicates the message structure to be sent by applications. */
        MSG_SENDINGOPT_INFO_S           sendOptInfo;
 } sms_request_info_s;
 
 
-typedef struct _sms_sent_info_s
-{
-       sms_request_info_s              reqInfo;                /**< Indicates the corresponding request structure. */
+typedef struct _sms_sent_info_s {
+       sms_request_info_s              reqInfo;                /* < Indicates the corresponding request structure. */
        bool                                            bLast;
 } sms_sent_info_s;
 
@@ -122,8 +115,8 @@ enum _sms_network_status_e {
        SMS_NETWORK_SEND_FAIL_NETWORK_NOT_READY,
 };
 
-enum _sms_wap_app_code_e
-{
+
+enum _sms_wap_app_code_e {
        SMS_WAP_APPLICATION_DEFAULT = 0x00,
 
        SMS_WAP_APPLICATION_PUSH_SI,
@@ -205,23 +198,21 @@ typedef unsigned char             sms_number_type_t;                      /* _sms_number_type_e */
 typedef unsigned char          sms_number_plan_t;                      /* _sms_number_plan_e */
 
 
-typedef enum _sms_message_type_e
-{
-       SMS_TYPE_RESERVED               = 0x00,         // reserved
-       SMS_TYPE_DELIVER,                                       // mobile-terminated only
-       SMS_TYPE_SUBMIT,                                        // mobile-originated only
-       SMS_TYPE_CANCEL,                                        // mobile-originated only
-       SMS_TYPE_DELIVERY_ACK,                          // mobile-terminated only
-       SMS_TYPE_USER_ACK,                                      // either direction
-       SMS_TYPE_READ_ACK,                                      // either direction
-       SMS_TYPE_DELIVER_REPORT,                        // mobile-originated only
-       SMS_TYPE_SUBMIT_REPORT  = 0x08,         // mobile-terminated only
+typedef enum _sms_message_type_e {
+       SMS_TYPE_RESERVED               = 0x00,         /* reserved */
+       SMS_TYPE_DELIVER,                                       /* mobile-terminated only */
+       SMS_TYPE_SUBMIT,                                        /* mobile-originated only */
+       SMS_TYPE_CANCEL,                                        /* mobile-originated only */
+       SMS_TYPE_DELIVERY_ACK,                          /* mobile-terminated only*/
+       SMS_TYPE_USER_ACK,                                      /* either direction */
+       SMS_TYPE_READ_ACK,                                      /* either direction */
+       SMS_TYPE_DELIVER_REPORT,                        /* mobile-originated only */
+       SMS_TYPE_SUBMIT_REPORT  = 0x08,         /* mobile-terminated only */
        SMS_TYPE_MAX_VALUE
 }sms_message_type_t;
 
 
-typedef enum _sms_alert_option_e
-{
+typedef enum _sms_alert_option_e {
        SMS_ALERT_NO_ALERT                              = 0,
        SMS_ALERT_DEFAULT_ALERT,
        SMS_ALERT_VIBRATE_ONCE,
@@ -250,8 +241,7 @@ typedef enum _sms_language_type_e {
 }sms_language_type_t;
 
 
-typedef enum _sms_priority_indicator_e
-{
+typedef enum _sms_priority_indicator_e {
        SMS_PRIORITY_NORMAL                             = 0x00,
        SMS_PRIORITY_INTERACTIVE,
        SMS_PRIORITY_URGENT,
@@ -259,8 +249,7 @@ typedef enum _sms_priority_indicator_e
 }sms_priority_indicator_t;
 
 
-typedef enum _sms_privacy_indicator_e
-{
+typedef enum _sms_privacy_indicator_e {
        SMS_PRIVACY_NOT_RESTRICTED              = 0x00,
        SMS_PRIVACY_RESTRICTED,
        SMS_PRIVACY_CONFIDENTIAL,
@@ -268,8 +257,7 @@ typedef enum _sms_privacy_indicator_e
 }sms_privacy_indicator_t;
 
 
-typedef enum _sms_alert_priority_e
-{
+typedef enum _sms_alert_priority_e {
        SMS_ALERT_MOBILE_DEFAULT                = 0x00,
        SMS_ALERT_LOW_PRIORITY,
        SMS_ALERT_MEDIUM_PRIORITY,
@@ -277,8 +265,7 @@ typedef enum _sms_alert_priority_e
 }sms_alert_priority_t;
 
 
-typedef enum _sms_display_mode_e
-{
+typedef enum _sms_display_mode_e {
        SMS_DISPLAY_IMMEDIATE                   = 0x00,
        SMS_DISPLAY_DEFAULT_SETTING,
        SMS_DISPLAY_USER_INVOKE,
@@ -286,8 +273,7 @@ typedef enum _sms_display_mode_e
 }sms_display_mode_t;
 
 
-typedef enum _sms_encoding_type_e
-{
+typedef enum _sms_encoding_type_e {
        SMS_ENCODE_OCTET        = 0x0,
        SMS_ENCODE_EPM  = 0x1,  /*IS-91 Extended Protocol Message*/
        SMS_ENCODE_7BIT_ASCII   = 0x2,
@@ -304,8 +290,7 @@ typedef enum _sms_encoding_type_e
 }sms_encoding_type_t;
 
 
-typedef enum _sms_relative_time_e
-{
+typedef enum _sms_relative_time_e {
        SMS_REL_TIME_5_MINS                     = 0,
        SMS_REL_TIME_12_HOURS           = 143,
        SMS_REL_TIME_1_DAY                      = 167,
@@ -320,8 +305,7 @@ typedef enum _sms_relative_time_e
 }sms_relative_time_t;
 
 
-typedef enum _sms_status_code_e
-{
+typedef enum _sms_status_code_e {
        /* ERROR_CLASS = '00' (no error) */
        SMS_STATUS_ACCEPTED                             = 0x00,
        SMS_STATUS_DEPOSITED                    = 0x01,
@@ -407,8 +391,7 @@ typedef enum _sms_cmae_alert_handle_e {
 }sms_cmae_alert_handle_t;
 
 
-enum _sms_bearer_sub_param_e
-{
+enum _sms_bearer_sub_param_e {
        SMS_BEARER_MESSAGE_IDENTIFIER                           = 0x00,
        SMS_BEARER_USER_DATA                                            = 0x01,
        SMS_BEARER_USER_RESPONSE_CODE                           = 0x02,
@@ -437,8 +420,7 @@ enum _sms_bearer_sub_param_e
 };
 
 
-enum _sms_svc_ctg_result_e
-{
+enum _sms_svc_ctg_result_e {
        SMS_SVC_RESULT_SUCCESS                                  = 0x00,
        SMS_SVC_RESULT_MEMORY_LIMIT_EXCEEDED,
        SMS_SVC_RESULT_LIMIT_EXCEEDED,
@@ -451,6 +433,7 @@ enum _sms_svc_ctg_result_e
        SMS_SVC_RESULT_RESERVED
 };
 
+
 enum _SMS_TIME_FORMAT_E {
        SMS_TIME_EMPTY = 0,
        SMS_TIME_RELATIVE       ,
@@ -504,15 +487,13 @@ enum _sms_tp_failure_cause_e {
 };
 
 
-typedef struct _sms_trans_msg_id_s
-{
+typedef struct _sms_trans_msg_id_s {
        unsigned short          msg_id;
        bool                            header_ind;
 }sms_trans_msg_id_s;
 
 
-typedef struct _sms_telesvc_addr_s
-{
+typedef struct _sms_telesvc_addr_s {
        sms_digit_mode_t        digit_mode;
        sms_number_type_t       number_type;
        sms_number_plan_t       number_plan;
@@ -521,8 +502,7 @@ typedef struct _sms_telesvc_addr_s
 }sms_telesvc_addr_s;
 
 
-typedef struct _sms_reply_option_s
-{
+typedef struct _sms_reply_option_s {
        bool    user_ack_req;
        bool    deliver_ack_req;
        bool    read_ack_req;
@@ -530,24 +510,21 @@ typedef struct _sms_reply_option_s
 }sms_reply_option_s;
 
 
-typedef struct _sms_time_relative_s
-{
+typedef struct _sms_time_relative_s {
        sms_relative_time_t             rel_time;
 }sms_time_rel_s;
 
-typedef struct _sms_time_stamp_s
-{
-       unsigned char           year;           // range 00-99 (96~99 : 19xx, 00~95 : 20xx)
-       unsigned char           month;          // range 1-12
+typedef struct _sms_time_stamp_s {
+       unsigned char           year;           /* range 00-99 (96~99 : 19xx, 00~95 : 20xx) */
+       unsigned char           month;          /* range 1-12 */
        unsigned char           day;
-       unsigned char           hours;          // range 0-23
-       unsigned char           minutes;        // range 0-59
-       unsigned char           seconds;        // range 0-59
+       unsigned char           hours;          /* range 0-23 */
+       unsigned char           minutes;        /* range 0-59 */
+       unsigned char           seconds;        /* range 0-59 */
 }sms_time_abs_s;
 
 
-typedef struct _sms_val_period_s
-{
+typedef struct _sms_val_period_s {
        unsigned char           format;
        union {
                sms_time_rel_s  rel_time;
@@ -556,16 +533,14 @@ typedef struct _sms_val_period_s
 }sms_val_period_s;
 
 
-typedef struct _sms_encoding_specific_s
-{
+typedef struct _sms_encoding_specific_s {
        sms_encoding_type_t             encode_type;
        unsigned int                    data_len;
        char                                    user_data[SMS_MAX_USER_DATA_LEN +1];
 }sms_encoding_specific_s;
 
 
-typedef struct _sms_ctg_specific_s
-{
+typedef struct _sms_ctg_specific_s {
        unsigned char           operation_code;
        unsigned short          category;
        sms_language_type_t     language;
@@ -576,16 +551,14 @@ typedef struct _sms_ctg_specific_s
 }sms_ctg_specific_s;
 
 
-typedef struct _sms_svc_ctg_program_data_s
-{
+typedef struct _sms_svc_ctg_program_data_s {
        sms_encoding_type_t             encode_type;
        unsigned int                    num_data;
        sms_ctg_specific_s              *specific_data;
 }sms_svc_ctg_program_data_s;
 
 
-typedef struct _sms_telesvc_userdata_s
-{
+typedef struct _sms_telesvc_userdata_s {
        sms_encoding_type_t             encode_type;
        unsigned char                   msg_type;
        unsigned int                    data_len;
@@ -593,8 +566,7 @@ typedef struct _sms_telesvc_userdata_s
 }sms_telesvc_userdata_s;
 
 
-typedef struct _sms_telesvc_cmasdata_s
-{
+typedef struct _sms_telesvc_cmasdata_s {
        unsigned int                            data_len;
        sms_encoding_type_t             encode_type;
        unsigned char                           alert_text[SMS_MAX_USER_DATA_LEN +1];
@@ -611,8 +583,7 @@ typedef struct _sms_telesvc_cmasdata_s
 }sms_telesvc_cmasdata_s;
 
 
-typedef struct _sms_enhanced_vmn_s
-{
+typedef struct _sms_enhanced_vmn_s {
        sms_priority_indicator_t                priority;
        bool                                                    password_req;
        bool                                                    setup_req;
@@ -643,8 +614,7 @@ typedef struct _sms_enhanced_vmn_s
 }sms_enhanced_vmn_s;
 
 
-typedef struct _sms_enhanced_vmn_ack_s
-{
+typedef struct _sms_enhanced_vmn_ack_s {
        unsigned short                          vm_mailbox_id;
        unsigned char                                   vm_num_unheard_msg;
        unsigned char                                   num_delete_ack;
@@ -655,8 +625,7 @@ typedef struct _sms_enhanced_vmn_ack_s
 }sms_enhanced_vmn_ack_s;
 
 
-typedef struct _sms_telesvc_deliver_s
-{
+typedef struct _sms_telesvc_deliver_s {
        sms_trans_msg_id_s                      msg_id;
        sms_telesvc_userdata_s          user_data;
        sms_telesvc_cmasdata_s          cmas_data;
@@ -673,14 +642,13 @@ typedef struct _sms_telesvc_deliver_s
        sms_display_mode_t                      display_mode;
        sms_encoding_specific_s         multi_encode_data;
        unsigned short                          deposit_id;
-       //sms_svc_ctg_program_data_s    svc_ctg;
+       /* sms_svc_ctg_program_data_s   svc_ctg; */
        sms_enhanced_vmn_s                      enhanced_vmn;
        sms_enhanced_vmn_ack_s          enhanced_vmn_ack;
 }sms_telesvc_deliver_s;
 
 
-typedef struct _sms_telesvc_submit_s
-{
+typedef struct _sms_telesvc_submit_s {
        sms_trans_msg_id_s                      msg_id;
        sms_telesvc_userdata_s          user_data;
        sms_val_period_s                        val_period;
@@ -693,18 +661,16 @@ typedef struct _sms_telesvc_submit_s
        sms_telesvc_addr_s                      callback_number;
        sms_encoding_specific_s         multi_encode_data;
        unsigned char                           deposit_id;
-       //sms_svc_ctg_program_data_s    svc_ctg;
+       /* sms_svc_ctg_program_data_s   svc_ctg; */
 }sms_telesvc_submit_s;
 
 
-typedef struct _sms_telesvc_cancel_s
-{
+typedef struct _sms_telesvc_cancel_s {
        sms_trans_msg_id_s              msg_id;
 }sms_telesvc_cancel_s;
 
 
-typedef struct _sms_telesvc_user_ack_s
-{
+typedef struct _sms_telesvc_user_ack_s {
        sms_trans_msg_id_s                      msg_id;
        sms_telesvc_userdata_s          user_data;
        unsigned char                           resp_code;
@@ -714,8 +680,7 @@ typedef struct _sms_telesvc_user_ack_s
 }sms_telesvc_user_ack_s;
 
 
-typedef struct _sms_telesvc_deliver_ack_s
-{
+typedef struct _sms_telesvc_deliver_ack_s {
        sms_trans_msg_id_s                      msg_id;
        sms_telesvc_userdata_s          user_data;
        sms_time_abs_s                          time_stamp;
@@ -724,8 +689,7 @@ typedef struct _sms_telesvc_deliver_ack_s
 }sms_telesvc_deliver_ack_s;
 
 
-typedef struct _sms_telesvc_read_ack_s
-{
+typedef struct _sms_telesvc_read_ack_s {
        sms_trans_msg_id_s                      msg_id;
        sms_telesvc_userdata_s          user_data;
        sms_time_abs_s                          time_stamp;
@@ -733,8 +697,7 @@ typedef struct _sms_telesvc_read_ack_s
        unsigned char                           deposit_id;
 }sms_telesvc_read_ack_s;
 
-typedef struct _sms_telesvc_deliver_report_s
-{
+typedef struct _sms_telesvc_deliver_report_s {
        sms_trans_msg_id_s              msg_id;
        unsigned char                   tp_fail_cause;
        sms_telesvc_userdata_s  user_data;
@@ -743,8 +706,7 @@ typedef struct _sms_telesvc_deliver_report_s
 }sms_telesvc_report_s;
 
 
-typedef struct _sms_telesvc_msg_s
-{
+typedef struct _sms_telesvc_msg_s {
        sms_message_type_t              type;
 
        union {
@@ -773,8 +735,7 @@ typedef unsigned short              sms_trans_svc_ctg_t;                    /* _sms_trans_svc_ctg_e */
 typedef unsigned char          sms_trans_reply_seq_t;
 
 
-typedef enum _sms_trans_msg_type_e
-{
+typedef enum _sms_trans_msg_type_e {
        SMS_TRANS_P2P_MSG                       = 0x00,
        SMS_TRANS_BROADCAST_MSG         = 0x01,
        SMS_TRANS_ACK_MSG                       = 0x02,
@@ -782,8 +743,7 @@ typedef enum _sms_trans_msg_type_e
 }sms_trans_msg_type_t;
 
 
-enum _sms_trans_param_id_e
-{
+enum _sms_trans_param_id_e {
        SMS_TRANS_PARAM_TELESVC_IDENTIFIER              = 0x00,
        SMS_TRANS_PARAM_SERVICE_CATEGORY                = 0x01,
        SMS_TRANS_PARAM_ORG_ADDRESS                             = 0x02,
@@ -797,8 +757,7 @@ enum _sms_trans_param_id_e
 };
 
 
-enum _sms_trans_telesvc_id_e
-{
+enum _sms_trans_telesvc_id_e {
        SMS_TRANS_TELESVC_CMT_91                = 0x1000,       /* IS-91 Extended Protocol Enhanced Services */
        SMS_TRANS_TELESVC_CPT_95                = 0x1001,       /* Wireless Paging Teleservice */
        SMS_TRANS_TELESVC_CMT_95                = 0x1002,       /* Wireless Messaging Teleservice */
@@ -811,8 +770,7 @@ enum _sms_trans_telesvc_id_e
 };
 
 
-enum _sms_trans_svc_ctg_e
-{
+enum _sms_trans_svc_ctg_e {
        SMS_TRANS_SVC_CTG_UNKNOWN                               = 0x0000,
        SMS_TRANS_SVC_CTG_EMERGENCY                             = 0x0001,
        SMS_TRANS_SVC_CTG_ADMINISTRATIVE                = 0x0002,
@@ -848,7 +806,7 @@ enum _sms_trans_svc_ctg_e
        SMS_TRANS_SVC_CTG_CATPT                                 = 0x0020,
        SMS_TRANS_SVC_CTG_KDDI_CORP_MIN1                = 0x0021,
        SMS_TRANS_SVC_CTG_KDDI_CORP_MAX1                = 0x003f,
-       SMS_TRANS_SVC_CTG_CMAS_PRESIDENTIAL     = 0x1000,
+       SMS_TRANS_SVC_CTG_CMAS_PRESIDENTIAL             = 0x1000,
        SMS_TRANS_SVC_CTG_CMAS_EXTREME                  = 0x1001,
        SMS_TRANS_SVC_CTG_CMAS_SEVERE                   = 0x1002,
        SMS_TRANS_SVC_CTG_CMAS_AMBER                    = 0x1003,
@@ -862,24 +820,21 @@ enum _sms_trans_svc_ctg_e
 };
 
 
-typedef enum _sms_trans_err_class_e
-{
+typedef enum _sms_trans_err_class_e {
        SMS_TRANS_ERR_CLASS_NONE                                = 0x00,
        SMS_TRANS_ERR_CLASS_TEMPORARY                   = 0x02,
        SMS_TRANS_ERR_CLASS_PERMANENT                   = 0x03
 }sms_trans_err_class_t;
 
 
-typedef enum _sms_trans_cause_code_e
-{
-       SMS_CAUSE_CODE_INVAILD_TELESERVICE_ID   = 0x04,
-       SMS_CAUSE_CODE_SERVICE_TERMINATION_DENIED               = 0x62,
+typedef enum _sms_trans_cause_code_e {
+       SMS_CAUSE_CODE_INVAILD_TELESERVICE_ID           = 0x04,
+       SMS_CAUSE_CODE_SERVICE_TERMINATION_DENIED       = 0x62,
        SMS_TODO_FILL_THIS_ENUMS
 }sms_trans_cause_code_t;
 
 
-typedef enum _sms_trans_sub_addr_type_e
-{
+typedef enum _sms_trans_sub_addr_type_e {
        SMS_TRANS_SUB_ADDR_NSAP                                 = 0x00,
        SMS_TRANS_SUB_ADDR_USER                                 = 0x01,
        SMS_TRANS_SUB_ADDR_RESERVED
@@ -887,8 +842,7 @@ typedef enum _sms_trans_sub_addr_type_e
 
 
 
-enum _sms_trans_dnet_addr_type_e
-{
+enum _sms_trans_dnet_addr_type_e {
        SMS_TRANS_DNET_UNKNOWN                                  = 0x00,
        SMS_TRANS_DNET_INTERNET_PROTOCOL                = 0x01,
        SMS_TRANS_DNET_INTERNET_MAIL_ADDR               = 0x02,
@@ -898,20 +852,20 @@ enum _sms_trans_dnet_addr_type_e
 
 enum _sms_digit_mode_e {
        SMS_DIGIT_4BIT_DTMF     = 0,
-       SMS_DIGIT_8BIT  = 1
+       SMS_DIGIT_8BIT          = 1
 };
 
 
 enum _sms_number_mode_e {
        SMS_NUMBER_MODE_NONE_DATANETWORK        = 0,
-       SMS_NUMBER_MODE_DATANETWORK     = 1,    /*using data network address format*/
+       SMS_NUMBER_MODE_DATANETWORK                     = 1,    /*using data network address format*/
 };
 
 
 enum _sms_dnet_number_type_e {
-       SMS_ADDRESS_TYPE_UNKNOWN        = 0x00,
+       SMS_ADDRESS_TYPE_UNKNOWN                        = 0x00,
        SMS_ADDRESS_TYPE_INTERNET_PROTOCOL      = 0x01,
-       SMS_ADDRESS_TYPE_EMAIL_ADDRESS  = 0x02,
+       SMS_ADDRESS_TYPE_EMAIL_ADDRESS          = 0x02,
 };
 
 
@@ -933,17 +887,16 @@ enum _sms_number_type_e {
 
 
 enum _sms_number_plan_e {
-       SMS_NPI_UNKNOWN = 0,
-       SMS_NPI_ISDN    = 1,
-       SMS_NPI_DATA    = 3,
-       SMS_NPI_TELEX   = 4,
-       SMS_NPI_PRIVATE = 9,
+       SMS_NPI_UNKNOWN         = 0,
+       SMS_NPI_ISDN            = 1,
+       SMS_NPI_DATA            = 3,
+       SMS_NPI_TELEX           = 4,
+       SMS_NPI_PRIVATE         = 9,
        SMS_NPI_RESERVED        = 15,
 };
 
 
-typedef struct _sms_trans_addr_s
-{
+typedef struct _sms_trans_addr_s {
        sms_digit_mode_t        digit_mode;
        sms_number_mode_t       number_mode;
        sms_number_type_t       number_type;
@@ -953,8 +906,7 @@ typedef struct _sms_trans_addr_s
 }sms_trans_addr_s;
 
 
-typedef struct _sms_trans_sub_addr_s
-{
+typedef struct _sms_trans_sub_addr_s {
        sms_trans_sub_addr_type_t       type;
        bool                                            odd;
        unsigned int                            addr_len;
@@ -962,16 +914,14 @@ typedef struct _sms_trans_sub_addr_s
 }sms_trans_sub_addr_s;
 
 
-typedef struct _sms_trans_cause_code_s
-{
+typedef struct _sms_trans_cause_code_s {
        sms_trans_reply_seq_t                   reply_seq;
        sms_trans_err_class_t                   error_class;
        sms_trans_cause_code_t                  cause_code;
 }sms_trans_cause_code_s;
 
 
-typedef struct _sms_trans_p2p_msg_s
-{
+typedef struct _sms_trans_p2p_msg_s {
        sms_trans_telesvc_id_t                  telesvc_id;
        sms_trans_svc_ctg_t                             svc_ctg;
        sms_trans_addr_s                                address;
@@ -981,23 +931,20 @@ typedef struct _sms_trans_p2p_msg_s
 }sms_trans_p2p_msg_s;
 
 
-typedef struct _sms_trans_broadcast_msg_s
-{
+typedef struct _sms_trans_broadcast_msg_s {
        sms_trans_svc_ctg_t                             svc_ctg;
        sms_telesvc_msg_s                               telesvc_msg;
 }sms_trans_broadcast_msg_s;
 
 
-typedef struct _sms_trans_ack_msg_s
-{
+typedef struct _sms_trans_ack_msg_s {
        sms_trans_addr_s                                address;
        sms_trans_sub_addr_s                    sub_address;
        sms_trans_cause_code_s                  cause_code;
 }sms_trans_ack_msg_s;
 
 
-typedef struct _sms_trans_msg_s
-{
+typedef struct _sms_trans_msg_s {
        sms_trans_msg_type_t            type;
        union {
                sms_trans_p2p_msg_s                     p2p_msg;
@@ -1007,5 +954,4 @@ typedef struct _sms_trans_msg_s
 }sms_trans_msg_s;
 
 
-#endif //SMS_CDMA_PLUGIN_TYPES_H
-
+#endif /* SMS_CDMA_PLUGIN_TYPES_H */
index e4de518..04f92f6 100755 (executable)
@@ -1,17 +1,17 @@
 /*
-* Copyright 2012-2013  Samsung Electronics Co., Ltd
-*
-* Licensed under the Flora License, Version 1.1 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*    http://floralicense.org/license/
-*
-* 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.
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
 */
 
 #ifndef SMS_CDMA_PLUGIN_UA_MANAGER_H
@@ -35,7 +35,7 @@ class SmsPluginUAManager : public MsgThread
 public:
        static SmsPluginUAManager* instance();
 
-       //virtual void start();
+       /* virtual void start(); */
 
        void addReqEntity(sms_request_info_s *request);
 
@@ -59,5 +59,4 @@ private:
        CndVar cv;
 };
 
-#endif //SMS_CDMA_PLUGIN_UA_MANAGER_H
-
+#endif /* SMS_CDMA_PLUGIN_UA_MANAGER_H */
index dea5882..f2142fb 100755 (executable)
@@ -1,17 +1,17 @@
 /*
-* Copyright 2012-2013  Samsung Electronics Co., Ltd
-*
-* Licensed under the Flora License, Version 1.1 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*    http://floralicense.org/license/
-*
-* 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.
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
 */
 
 #ifndef SMS_CDMA_PLUGIN_WAPPUSH_HANDLER_H
@@ -50,7 +50,7 @@ class SmsPluginWapPushHandler
 public:
        static SmsPluginWapPushHandler* instance();
 
-       //void registerPushCallback();
+       /* void registerPushCallback(); */
        bool IsWapPushMsg(unsigned short dstport);
 
        void copyDeliverData(sms_trans_addr_s *pAddr);
@@ -94,8 +94,7 @@ private:
 
 
        sms_trans_addr_s        tmpAddress;
-//     SMS_TIMESTAMP_S tmpTimeStamp;
+       /* SMS_TIMESTAMP_S      tmpTimeStamp; */
 };
 
-#endif //SmsPluginWapPushHandler
-
+#endif /* SmsPluginWapPushHandler */
index cb86b86..9ee44ff 100755 (executable)
@@ -8,7 +8,7 @@ IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
 ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
 MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")
 
-SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -O0 -g -Wall")
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -O2 -g -Wall")
 
 ##########################################################
 # Define SMS Plugin
index 5fc318b..5728686 100755 (executable)
@@ -44,13 +44,10 @@ void TapiEventDeviceReady(TapiHandle *handle, const char *noti_id, void *data, v
 {
        MSG_DEBUG("TapiEventDeviceReady is called. : noti_id = [%d]", noti_id);
 
-       try
-       {
-               // Call Event Handler
+       try {
+               /* Call Event Handler */
                SmsPluginEventHandler::instance()->setDeviceStatus(handle);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return;
        }
@@ -63,38 +60,39 @@ SMS_NETWORK_STATUS_T convertTapiRespToSmsPlugin(int result)
 
        /* Convert TAPI status -> SMS network status */
        switch ((TelSmsResponse_t)result) {
-               case TAPI_NETTEXT_SENDSMS_SUCCESS :
-                       sentStatus = SMS_NETWORK_SEND_SUCCESS;
-                       break;
+       case TAPI_NETTEXT_SENDSMS_SUCCESS :
+               sentStatus = SMS_NETWORK_SEND_SUCCESS;
+               break;
 
-               case TAPI_NETTEXT_INVALID_MANDATORY_INFO :
-                       sentStatus = SMS_NETWORK_SEND_FAIL_MANDATORY_INFO_MISSING;
-                       break;
+       case TAPI_NETTEXT_INVALID_MANDATORY_INFO :
+               sentStatus = SMS_NETWORK_SEND_FAIL_MANDATORY_INFO_MISSING;
+               break;
 
-               case TAPI_NETTEXT_DESTINAITION_OUTOFSERVICE :
-               case TAPI_NETTEXT_TEMPORARY_FAILURE :
-               case TAPI_NETTEXT_CONGESTION :
-               case TAPI_NETTEXT_RESOURCES_UNAVAILABLE :
-               case TAPI_NETTEXT_MESSAGE_NOT_COMPAT_PROTOCOL :
-               case TAPI_NETTEXT_NETWORK_OUTOFORDER:
-                       sentStatus = SMS_NETWORK_SEND_FAIL_TEMPORARY;
-                       break;
+       case TAPI_NETTEXT_DESTINAITION_OUTOFSERVICE :
+       case TAPI_NETTEXT_TEMPORARY_FAILURE :
+       case TAPI_NETTEXT_CONGESTION :
+       case TAPI_NETTEXT_RESOURCES_UNAVAILABLE :
+       case TAPI_NETTEXT_MESSAGE_NOT_COMPAT_PROTOCOL :
+       case TAPI_NETTEXT_NETWORK_OUTOFORDER:
+               sentStatus = SMS_NETWORK_SEND_FAIL_TEMPORARY;
+               break;
 
-               case TAPI_NETTEXT_MESSAGE_TRANSFER_REJECTED :
-                       sentStatus = SMS_NETWORK_SEND_FAIL_BY_MO_CONTROL_NOT_ALLOWED;
-                       break;
+       case TAPI_NETTEXT_MESSAGE_TRANSFER_REJECTED :
+               sentStatus = SMS_NETWORK_SEND_FAIL_BY_MO_CONTROL_NOT_ALLOWED;
+               break;
 
-               case TAPI_NETTEXT_DEST_ADDRESS_FDN_RESTRICTED :
-               case TAPI_NETTEXT_SCADDRESS_FDN_RESTRICTED :
-                       sentStatus = SMS_NETWORK_SEND_FAIL_FDN_RESTRICED;
-                       break;
-               case TAPI_NETTEXT_ROUTING_NOT_AVAILABLE :
-                       sentStatus = SMS_NETWORK_SEND_FAIL_NO_ROUTING;
-                       break;
-               default :
-                       sentStatus = SMS_NETWORK_SEND_FAIL;
-                       break;
+       case TAPI_NETTEXT_DEST_ADDRESS_FDN_RESTRICTED :
+       case TAPI_NETTEXT_SCADDRESS_FDN_RESTRICTED :
+               sentStatus = SMS_NETWORK_SEND_FAIL_FDN_RESTRICED;
+               break;
+       case TAPI_NETTEXT_ROUTING_NOT_AVAILABLE :
+               sentStatus = SMS_NETWORK_SEND_FAIL_NO_ROUTING;
+               break;
+       default :
+               sentStatus = SMS_NETWORK_SEND_FAIL;
+               break;
        }
+
        return sentStatus;
 }
 
@@ -128,9 +126,8 @@ void TapiEventSentStatus(TapiHandle *handle, int result, void *data, void *user_
        if (sentStatus == SMS_NETWORK_SEND_FAIL) {
                int svc_type;
                tel_get_property_int(handle, TAPI_PROP_NETWORK_SERVICE_TYPE, &svc_type);
-               if (svc_type < TAPI_NETWORK_SERVICE_TYPE_2G) {
+               if (svc_type < TAPI_NETWORK_SERVICE_TYPE_2G)
                        sentStatus = SMS_NETWORK_SEND_PENDING;
-               }
        }
 
        /* Convert SMS status -> Messaging network status */
@@ -146,14 +143,11 @@ void TapiEventSentStatus(TapiHandle *handle, int result, void *data, void *user_
                netStatus = MSG_NETWORK_SEND_FAIL;
        }
 
-       try
-       {
+       try {
                SmsPluginEventHandler::instance()->handleSentStatus(netStatus);
 
                SmsPluginTransport::instance()->setNetStatus(sentStatus);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return;
        }
@@ -170,21 +164,16 @@ void TapiEventSatSmsSentStatus(TapiHandle *handle, int result, void *data, void
 
        MSG_DEBUG("SMS Network Status = [%d]", sentStatus);
 
-       if (sentStatus == SMS_NETWORK_SEND_FAIL && result != TAPI_NETTEXT_DEVICE_FAILURE)
-       {
+       if (sentStatus == SMS_NETWORK_SEND_FAIL && result != TAPI_NETTEXT_DEVICE_FAILURE) {
                int svc_type;
                tel_get_property_int(handle, TAPI_PROP_NETWORK_SERVICE_TYPE, &svc_type);
-               if (svc_type < TAPI_NETWORK_SERVICE_TYPE_2G){
+               if (svc_type < TAPI_NETWORK_SERVICE_TYPE_2G)
                        sentStatus = SMS_NETWORK_SEND_PENDING;
-               }
        }
 
-       try
-       {
+       try {
                SmsPluginSatHandler::instance()->ctrlSms(handle, sentStatus);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return;
        }
@@ -207,12 +196,11 @@ void TapiEventMsgIncoming(TapiHandle *handle, const char *noti_id, void *data, v
        SMS_TPDU_S tpdu;
        memset(&tpdu, 0x00, sizeof(SMS_TPDU_S));
 
-       // Decode Incoming Message
+       /* Decode Incoming Message */
        SmsPluginTpduCodec::decodeTpdu(pDataPackage->szData, pDataPackage->MsgLength, &tpdu);
 
-       /// Print tpdu
-       if (tpdu.tpduType == SMS_TPDU_DELIVER)
-       {
+       /* Print tpdu */
+       if (tpdu.tpduType == SMS_TPDU_DELIVER) {
                MSG_DEBUG("############# SMS_TPDU_DELIVER Incoming decoded tpdu values ####################");
                MSG_DEBUG("tpdu.data.deliver.bMoreMsg : %d", tpdu.data.deliver.bMoreMsg);
                MSG_DEBUG("tpdu.data.deliver.bStatusReport : %d", tpdu.data.deliver.bStatusReport);
@@ -231,9 +219,7 @@ void TapiEventMsgIncoming(TapiHandle *handle, const char *noti_id, void *data, v
                MSG_DEBUG("tpdu.data.deliver.userData.length : %d", tpdu.data.deliver.userData.length);
                MSG_DEBUG("tpdu.data.deliver.userData.data : %s", tpdu.data.deliver.userData.data);
                MSG_DEBUG("#####################################################");
-       }
-       else if (tpdu.tpduType == SMS_TPDU_STATUS_REP)
-       {
+       } else if (tpdu.tpduType == SMS_TPDU_STATUS_REP) {
                MSG_DEBUG("############# SMS_TPDU_STATUS_REP Incoming decoded tpdu values ####################");
                MSG_DEBUG("tpdu.data.statusRep.msgRef : %d", tpdu.data.statusRep.msgRef);
                MSG_DEBUG("tpdu.data.statusRep.bMoreMsg : %d", tpdu.data.statusRep.bMoreMsg);
@@ -256,36 +242,29 @@ void TapiEventMsgIncoming(TapiHandle *handle, const char *noti_id, void *data, v
                MSG_DEBUG("#####################################################");
        }
 
-       try
-       {
-               if (tpdu.tpduType == SMS_TPDU_DELIVER)
-               {
+       try {
+               if (tpdu.tpduType == SMS_TPDU_DELIVER) {
                        if (tpdu.data.deliver.dcs.msgClass == SMS_MSG_CLASS_2) {
-                               // For GCF test, 34.2.5.3
+                               /* For GCF test, 34.2.5.3 */
                                SmsPluginSimMsg::instance()->setSmsData((const char*)pDataPackage->Sca, (const char *)pDataPackage->szData, pDataPackage->MsgLength);
                        }
 
                        if (SmsPluginConcatHandler::instance()->IsConcatMsg(&(tpdu.data.deliver.userData)) == true ||
-                               SmsPluginWapPushHandler::instance()->IsWapPushMsg(&(tpdu.data.deliver.userData)) == true)
-                       {
-                               SmsPluginConcatHandler::instance()->handleConcatMsg(handle, &tpdu); // Call Concat Msg Handler
-                       }
-                       else
-                       {
-                               SmsPluginEventHandler::instance()->handleMsgIncoming(handle, &tpdu); // Call Event Handler
+                               SmsPluginWapPushHandler::instance()->IsWapPushMsg(&(tpdu.data.deliver.userData)) == true) {
+                               /* Call Concat Msg Handler */
+                               SmsPluginConcatHandler::instance()->handleConcatMsg(handle, &tpdu);
+                       } else {
+                               /* Call Event Handler */
+                               SmsPluginEventHandler::instance()->handleMsgIncoming(handle, &tpdu);
                        }
+               } else if (tpdu.tpduType == SMS_TPDU_STATUS_REP) {
+                       /* Call Event Handler */
+                       SmsPluginEventHandler::instance()->handleMsgIncoming(handle, &tpdu);
                }
-               else if (tpdu.tpduType == SMS_TPDU_STATUS_REP)
-               {
-                       SmsPluginEventHandler::instance()->handleMsgIncoming(handle, &tpdu); // Call Event Handler
-               }
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return;
        }
-
 }
 
 
@@ -300,16 +279,12 @@ void TapiEventCbMsgIncoming(TapiHandle *handle, const char *noti_id, void *data,
 
        TelSmsCbMsg_t *pCbMsg = (TelSmsCbMsg_t*)data;
 
-       try
-       {
+       try {
                SmsPluginCbMsgHandler::instance()->handleCbMsg(handle, pCbMsg);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return;
        }
-
 }
 
 
@@ -324,12 +299,9 @@ void TapiEventEtwsMsgIncoming(TapiHandle *handle, const char *noti_id, void *dat
 
        TelSmsEtwsMsg_t *pEtwsMsg = (TelSmsEtwsMsg_t*)data;
 
-       try
-       {
+       try {
                SmsPluginCbMsgHandler::instance()->handleEtwsMsg(handle, pEtwsMsg);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return;
        }
@@ -348,8 +320,7 @@ void TapiEventGetSimMsgCnt(TapiHandle *handle, int result, void *data, void *use
 {
        MSG_DEBUG("TapiEventGetSimMsgCnt is called.");
 
-       if (result != TAPI_API_SUCCESS || data == NULL)
-       {
+       if (result != TAPI_API_SUCCESS || data == NULL) {
                MSG_DEBUG("Error. data is NULL.");
                MSG_SIM_COUNT_S simCnt;
                memset(&simCnt, 0x00, sizeof(MSG_SIM_COUNT_S));
@@ -366,8 +337,7 @@ void TapiEventGetSimMsg(TapiHandle *handle, int result, void *data, void *user_d
 {
        MSG_DEBUG("TapiEventGetSimMsg is called.");
 
-       if (result != TAPI_API_SUCCESS || data == NULL)
-       {
+       if (result != TAPI_API_SUCCESS || data == NULL) {
                MSG_DEBUG("Error!! pEvent->Status [%d]", result);
 
                SmsPluginSimMsg::instance()->setSimMsgEvent(handle, NULL, false);
@@ -377,17 +347,16 @@ void TapiEventGetSimMsg(TapiHandle *handle, int result, void *data, void *user_d
 
 
        TelSmsData_t* pSmsTpdu = (TelSmsData_t*)data;
-       //SmsPluginSimMsg::instance()->deleteSimMessage((msg_sim_id_t)pSmsTpdu->SimIndex);
 
        int *simIdList = (int *)user_data;
 
-       // Reading TelSmsData_t
-       MSG_DEBUG ("sim index %d", pSmsTpdu->SimIndex);
-       MSG_DEBUG ("status %d", pSmsTpdu->MsgStatus);
+       /* Reading TelSmsData_t */
+       MSG_DEBUG("sim index %d", pSmsTpdu->SimIndex);
+       MSG_DEBUG("status %d", pSmsTpdu->MsgStatus);
+       MSG_DEBUG("sim msg [%s]", pSmsTpdu->SmsData.szData);
 
-       // Reading TelSmsDatapackageInfo_t
-       if (pSmsTpdu->SmsData.MsgLength > MAX_TPDU_DATA_LEN)
-       {
+       /* Reading TelSmsDatapackageInfo_t */
+       if (pSmsTpdu->SmsData.MsgLength > MAX_TPDU_DATA_LEN) {
                MSG_DEBUG ("WARNING: tpdu_len > MAX_SMS_TPDU_SIZE [%d] bytes. setting to 0.", pSmsTpdu->SmsData.MsgLength);
 
                SmsPluginSimMsg::instance()->setSimMsgEvent(handle, NULL, false);
@@ -397,21 +366,20 @@ void TapiEventGetSimMsg(TapiHandle *handle, int result, void *data, void *user_d
 
        SMS_TPDU_S tpdu;
 
-       // decode Tpdu
+       /* decode Tpdu */
        SmsPluginTpduCodec::decodeTpdu(pSmsTpdu->SmsData.szData, pSmsTpdu->SmsData.MsgLength, &tpdu);
 
        MSG_DEBUG("Sim Message Type [%d]", tpdu.tpduType);
 
        bool bRead = false;
 
-       // set read status
+       /* set read status */
        if (pSmsTpdu->MsgStatus == TAPI_NETTEXT_STATUS_READ)
                bRead = true;
        else if (pSmsTpdu->MsgStatus == TAPI_NETTEXT_STATUS_UNREAD)
                bRead = false;
 
-       if (tpdu.tpduType == SMS_TPDU_DELIVER)
-       {
+       if (tpdu.tpduType == SMS_TPDU_DELIVER) {
                if (tpdu.data.deliver.dcs.codingScheme == SMS_CHARSET_8BIT && tpdu.data.deliver.pid == 0x11) {
                        MSG_DEBUG("Unsupported message!!");
                        SmsPluginSimMsg::instance()->setSimMsgEvent(handle, NULL, false);
@@ -419,13 +387,11 @@ void TapiEventGetSimMsg(TapiHandle *handle, int result, void *data, void *user_d
                }
 
                MSG_DEBUG("headerCnt [%d]", tpdu.data.deliver.userData.headerCnt);
-               for (int i = 0; i < tpdu.data.deliver.userData.headerCnt; i++)
-               {
-                       // Handler Concatenated Message
+               for (int i = 0; i < tpdu.data.deliver.userData.headerCnt; i++) {
+                       /* Handler Concatenated Message */
                        if (tpdu.data.deliver.userData.header[i].udhType == SMS_UDH_CONCAT_8BIT ||
                                tpdu.data.deliver.userData.header[i].udhType == SMS_UDH_CONCAT_16BIT) {
                                SmsPluginConcatHandler::instance()->handleSimConcatMsg(handle, &tpdu, pSmsTpdu->SimIndex, bRead, simIdList);
-                               //SmsPluginSimMsg::instance()->setSimMsgEvent(NULL, false);
                                return;
                        }
 
@@ -435,9 +401,7 @@ void TapiEventGetSimMsg(TapiHandle *handle, int result, void *data, void *user_d
                                return;
                        }
                }
-       }
-       else if (tpdu.tpduType == SMS_TPDU_SUBMIT)
-       {
+       } else if (tpdu.tpduType == SMS_TPDU_SUBMIT) {
                if (tpdu.data.submit.dcs.codingScheme == SMS_CHARSET_8BIT && tpdu.data.submit.pid == 0x11) {
                        MSG_DEBUG("Unsupported message!!");
                        SmsPluginSimMsg::instance()->setSimMsgEvent(handle, NULL, false);
@@ -445,23 +409,21 @@ void TapiEventGetSimMsg(TapiHandle *handle, int result, void *data, void *user_d
                }
                MSG_DEBUG("headerCnt [%d]", tpdu.data.submit.userData.headerCnt);
 
-               for (int i = 0; i < tpdu.data.submit.userData.headerCnt; i++)
-               {
-                       // Handler Concatenated Message
+               for (int i = 0; i < tpdu.data.submit.userData.headerCnt; i++) {
+                       /* Handler Concatenated Message */
                        if (tpdu.data.submit.userData.header[i].udhType == SMS_UDH_CONCAT_8BIT ||
-                               tpdu.data.submit.userData.header[i].udhType == SMS_UDH_CONCAT_16BIT)
-                       {
+                               tpdu.data.submit.userData.header[i].udhType == SMS_UDH_CONCAT_16BIT) {
                                SmsPluginConcatHandler::instance()->handleSimConcatMsg(handle, &tpdu, pSmsTpdu->SimIndex, bRead, simIdList);
                                return;
                        }
                }
        }
 
-       // Make MSG_MESSAGE_INFO_S
+       /* Make MSG_MESSAGE_INFO_S */
        MSG_MESSAGE_INFO_S msgInfo;
        memset(&msgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S));
 
-       // set storage id
+       /* set storage id */
        msgInfo.storageId = MSG_STORAGE_SIM;
 
        msgInfo.addressList = NULL;
@@ -503,16 +465,15 @@ void TapiEventGetSimMsg(TapiHandle *handle, int result, void *data, void *user_d
                        memset(msgInfo.msgText, 0x00, sizeof(msgInfo.msgText));
                        snprintf(msgInfo.msgText, sizeof(msgInfo.msgText), "Voice message");
                }
-       }
-       else if (tpdu.tpduType == SMS_TPDU_SUBMIT) {
+       } else if (tpdu.tpduType == SMS_TPDU_SUBMIT) {
                msgInfo.displayTime =  time(NULL);
        }
 
-       // set read status
+       /* set read status */
        msgInfo.bRead = bRead;
 
        simIdList[0] = pSmsTpdu->SimIndex + 1;
-       /// Print MSG_MESSAGE_INFO_S
+       /* Print MSG_MESSAGE_INFO_S */
        MSG_DEBUG("############# Convert  tpdu values to Message Info values ####################");
        MSG_DEBUG("msgInfo.msgId : %d", msgInfo.msgId);
        MSG_DEBUG("msgInfo.nAddressCnt : %d", msgInfo.nAddressCnt);
@@ -536,7 +497,8 @@ void TapiEventGetSimMsg(TapiHandle *handle, int result, void *data, void *user_d
        MSG_DEBUG("msgInfo.sim_idx : %d", msgInfo.sim_idx);
        MSG_DEBUG("###############################################################");
 
-       SmsPluginSimMsg::instance()->setSimMsgEvent(handle, &msgInfo, true); // Call Event Handler
+       /* Call Event Handler */
+       SmsPluginSimMsg::instance()->setSimMsgEvent(handle, &msgInfo, true);
 
 
 }
@@ -574,14 +536,10 @@ void TapiEventSaveClass2Msg(TapiHandle *handle, int result, void *data, void *us
 
        SmsPluginSimMsg::instance()->setSaveClass2MsgEvent(handle, simId, result, pMsgInfo);
 
-       if(result == TAPI_NETTEXT_SENDSMS_SUCCESS)
-       {
+       if (result == TAPI_NETTEXT_SENDSMS_SUCCESS)
                SmsPluginSimMsg::instance()->setSimEvent((msg_sim_id_t)simId, true);
-       }
        else
-       {
                SmsPluginSimMsg::instance()->setSimEvent((msg_sim_id_t)0, false);
-       }
 
        if (pMsgInfo) {
                if (pMsgInfo->addressList) {
@@ -598,8 +556,7 @@ void TapiEventDeleteSimMsg(TapiHandle *handle, int result, void *data, void *use
 {
        MSG_DEBUG("TapiEventDeleteSimMsg is called. result [%d]", result);
 
-       if (result != TAPI_API_SUCCESS || data == NULL)
-       {
+       if (result != TAPI_API_SUCCESS || data == NULL) {
                MSG_DEBUG("Error. data is NULL.");
                SmsPluginSimMsg::instance()->setDelSimEvent(-1, false);
                return;
@@ -616,8 +573,7 @@ void TapiEventSetConfigData(TapiHandle *handle, int result, void *data, void *us
 {
        MSG_DEBUG("TapiEventSetConfigData is called.");
 
-       if (data == NULL)
-       {
+       if (data == NULL) {
                MSG_DEBUG("Error. data is NULL.");
                return;
        }
@@ -626,30 +582,29 @@ void TapiEventSetConfigData(TapiHandle *handle, int result, void *data, void *us
 
        MSG_DEBUG("responseType : [%d]", *responseType);
 
-       switch (*responseType)
-       {
-               case TAPI_NETTEXT_SETPREFERREDBEARER_RSP :
-                       MSG_DEBUG("TAPI_NETTEXT_SETPREFERREDBEARER_RSP is called");
+       switch (*responseType) {
+       case TAPI_NETTEXT_SETPREFERREDBEARER_RSP :
+               MSG_DEBUG("TAPI_NETTEXT_SETPREFERREDBEARER_RSP is called");
                break;
 
-               case TAPI_NETTEXT_SETPARAMETERS_RSP :
-                       MSG_DEBUG("TAPI_NETTEXT_SETPARAMETERS_RSP is called");
+       case TAPI_NETTEXT_SETPARAMETERS_RSP :
+               MSG_DEBUG("TAPI_NETTEXT_SETPARAMETERS_RSP is called");
                break;
 
-               case TAPI_NETTEXT_CBSETCONFIG_RSP :
-                       MSG_DEBUG("TAPI_NETTEXT_CBSETCONFIG_RSP is called");
+       case TAPI_NETTEXT_CBSETCONFIG_RSP :
+               MSG_DEBUG("TAPI_NETTEXT_CBSETCONFIG_RSP is called");
                break;
 
-               case TAPI_NETTEXT_SETMEMORYSTATUS_RSP :
-                       MSG_DEBUG("TAPI_NETTEXT_SETMEMORYSTATUS_RSP is called");
+       case TAPI_NETTEXT_SETMEMORYSTATUS_RSP :
+               MSG_DEBUG("TAPI_NETTEXT_SETMEMORYSTATUS_RSP is called");
                break;
 
-               case TAPI_NETTEXT_SETMESSAGESTATUS_RSP :
-                       MSG_DEBUG("TAPI_NETTEXT_SETMESSAGESTATUS_RSP is called");
+       case TAPI_NETTEXT_SETMESSAGESTATUS_RSP :
+               MSG_DEBUG("TAPI_NETTEXT_SETMESSAGESTATUS_RSP is called");
                break;
 
-               default :
-                       MSG_DEBUG("Unknown Response is called [%d]", *responseType);
+       default :
+               MSG_DEBUG("Unknown Response is called [%d]", *responseType);
                break;
        }
 
@@ -671,8 +626,7 @@ void TapiEventGetParamCnt(TapiHandle *handle, int result, void *data, void *user
 {
        MSG_DEBUG("TapiEventGetParamCnt is called.");
 
-       if (result != TAPI_API_SUCCESS || data == NULL)
-       {
+       if (result != TAPI_API_SUCCESS || data == NULL) {
                MSG_DEBUG("Error. evt->pData is NULL.");
                SmsPluginSetting::instance()->setParamCntEvent(0);
                return;
@@ -690,8 +644,7 @@ void TapiEventGetParam(TapiHandle *handle, int result, void *data, void *user_da
 {
        MSG_DEBUG("TapiEventGetConfigData is called.");
 
-       if (result != TAPI_API_SUCCESS || data == NULL)
-       {
+       if (result != TAPI_API_SUCCESS || data == NULL) {
                MSG_DEBUG("Error. data is NULL.");
                SmsPluginSetting::instance()->setParamEvent(handle, NULL, -1, false);
                return;
@@ -707,8 +660,7 @@ void TapiEventGetParam(TapiHandle *handle, int result, void *data, void *user_da
        alphaIdLen = smsParam->AlphaIdLen;
        MSG_DEBUG("alphaId_len[%d]", alphaIdLen);
 
-       if (alphaIdLen < 0 || alphaIdLen > SMSC_NAME_MAX)
-       {
+       if (alphaIdLen < 0 || alphaIdLen > SMSC_NAME_MAX) {
                MSG_DEBUG("Wrong Alpha ID Length[%d]", alphaIdLen);
 
                SmsPluginSetting::instance()->setParamEvent(handle, NULL, -1, false);
@@ -720,14 +672,11 @@ void TapiEventGetParam(TapiHandle *handle, int result, void *data, void *user_da
        /*Check Address value*/
        addrLen = smsParam->TpSvcCntrAddr.DialNumLen;
 
-       if(addrLen > SMSC_ADDR_MAX)
-       {
+       if (addrLen > SMSC_ADDR_MAX) {
                MSG_DEBUG("addrLen is too long: %d", addrLen);
                SmsPluginSetting::instance()->setParamEvent(handle, NULL, -1, false);
                return;
-       }
-       else if(addrLen < 2)
-       {
+       } else if (addrLen < 2) {
                MSG_DEBUG("addrLen is too short: %d", addrLen);
                SmsPluginSetting::instance()->setParamEvent(handle, NULL, -1, false);
                return;
@@ -735,13 +684,11 @@ void TapiEventGetParam(TapiHandle *handle, int result, void *data, void *user_da
 
        MSG_DEBUG("addrLen : %d", addrLen);
 
-
        /*SMSP Parameter Indicator value*/
        MSG_DEBUG("ParamIndicator[%02x]", smsParam->ParamIndicator);
 
        /*Get SMSC Address*/
-       if(0x00 == (0x02 & smsParam->ParamIndicator))
-       {
+       if (0x00 == (0x02 & smsParam->ParamIndicator)) {
                MSG_DEBUG("record index[%d]", (int)smsParam->RecordIndex);
 
                MSG_DEBUG("TON : %d", smsParam->TpSvcCntrAddr.Ton);
@@ -762,58 +709,46 @@ void TapiEventGetParam(TapiHandle *handle, int result, void *data, void *user_da
                smscData.name[alphaIdLen] = '\0';
 
                MSG_SEC_DEBUG("SMSC Name : [%s]", smscData.name);
-       }
-       else
-       {
+       } else {
                MSG_DEBUG("SMSC Address is not present");
 
-//             smscData.smscAddr.ton = MSG_TON_UNKNOWN;
-//             smscData.smscAddr.npi = MSG_NPI_UNKNOWN;
-//
-//             memset(smscData.smscAddr.address, 0x00, SMSC_ADDR_MAX+1);
-//             memset(smscData.name, 0x00, SMSC_NAME_MAX+1);
-
                SmsPluginSetting::instance()->setParamEvent(handle, NULL, -1, false);
 
                return;
        }
 
        /*Get the PID value*/
-       if (0x00 == (0x04 & smsParam->ParamIndicator))
-       {
+       if (0x00 == (0x04 & smsParam->ParamIndicator)) {
                SMS_PID_T pid = (SMS_PID_T)smsParam->TpProtocolId;
 
                MSG_DEBUG("smsParam->TpProtocolId : %d", smsParam->TpProtocolId);
 
-               switch (pid)
-               {
-                       case SMS_PID_NORMAL:
-                               smscData.pid = MSG_PID_TEXT;
+               switch (pid) {
+               case SMS_PID_NORMAL:
+                       smscData.pid = MSG_PID_TEXT;
                        break;
-                       case SMS_PID_VOICE:
-                               smscData.pid = MSG_PID_VOICE;
+               case SMS_PID_VOICE:
+                       smscData.pid = MSG_PID_VOICE;
                        break;
-                       case SMS_PID_TELEX:
-                               smscData.pid = MSG_PID_FAX;
+               case SMS_PID_TELEX:
+                       smscData.pid = MSG_PID_FAX;
                        break;
-                       case SMS_PID_x400:
-                               smscData.pid = MSG_PID_X400;
+               case SMS_PID_x400:
+                       smscData.pid = MSG_PID_X400;
                        break;
-                       case SMS_PID_ERMES:
-                               smscData.pid = MSG_PID_ERMES;
+               case SMS_PID_ERMES:
+                       smscData.pid = MSG_PID_ERMES;
                        break;
-                       case SMS_PID_EMAIL:
-                               smscData.pid = MSG_PID_EMAIL;
+               case SMS_PID_EMAIL:
+                       smscData.pid = MSG_PID_EMAIL;
                        break;
-                       default:
-                               smscData.pid = MSG_PID_TEXT;
+               default:
+                       smscData.pid = MSG_PID_TEXT;
                        break;
                }
 
                MSG_DEBUG("smscData.pid : %d", smscData.pid);
-       }
-       else
-       {
+       } else {
                MSG_DEBUG("PID is not present");
                smscData.pid = MSG_PID_TEXT;
                MSG_DEBUG("MSG_PID_TEXT is inserted to PID");
@@ -834,21 +769,16 @@ void TapiEventGetParam(TapiHandle *handle, int result, void *data, void *user_da
 #endif
 
        /*Get the ValidityPeriod value*/
-       if (0x00 == (0x10 & smsParam->ParamIndicator))
-       {
+       if (0x00 == (0x10 & smsParam->ParamIndicator)) {
                smscData.valPeriod = smsParam->TpValidityPeriod;
                MSG_DEBUG("valPeriod : %d", smscData.valPeriod);
-       }
-       else
-       {
-
+       } else {
                smscData.valPeriod = 0;
 
                MSG_DEBUG("Validity Period is not present");
        }
 
        SmsPluginSetting::instance()->setParamEvent(handle, &smscData, (int)smsParam->RecordIndex, true);
-
 }
 
 
@@ -856,11 +786,10 @@ void TapiEventSetSmscInfo(TapiHandle *handle, int result, void *data, void *user
 {
        MSG_DEBUG("TapiEventSetSmscInfo is called. result=[%d]", result);
 
-       if (result != TAPI_API_SUCCESS) {
+       if (result != TAPI_API_SUCCESS)
                SmsPluginSetting::instance()->setResultFromSim(false);
-       } else {
+       else
                SmsPluginSetting::instance()->setResultFromSim(true);
-       }
 }
 
 
@@ -872,8 +801,7 @@ void TapiEventGetCBConfig(TapiHandle *handle, int result, void *data, void *user
 
        int simIndex = SmsPluginDSHandler::instance()->getSimIndex(handle);
 
-       if (result != TAPI_API_SUCCESS || data == NULL || simIndex == 0)
-       {
+       if (result != TAPI_API_SUCCESS || data == NULL || simIndex == 0) {
                MSG_DEBUG("Error. data is NULL.");
 
                SmsPluginSetting::instance()->setCbConfigEvent(handle, NULL, false);
@@ -885,7 +813,7 @@ void TapiEventGetCBConfig(TapiHandle *handle, int result, void *data, void *user
 
        cbOpt.bReceive = (bool)pCBConfig->CBEnabled;
 
-       cbOpt.maxSimCnt = pCBConfig->MsgIdMaxCount;
+       cbOpt.maxSimCnt = TAPI_NETTEXT_SMS_CBMI_LIST_SIZE_MAX;
 
        cbOpt.simIndex = simIndex;
 
@@ -893,16 +821,14 @@ void TapiEventGetCBConfig(TapiHandle *handle, int result, void *data, void *user
 
        cbOpt.channelData.channelCnt = pCBConfig->MsgIdRangeCount;
 
-       if (cbOpt.channelData.channelCnt > CB_CHANNEL_MAX)
-       {
+       if (cbOpt.channelData.channelCnt > CB_CHANNEL_MAX) {
                MSG_DEBUG("Channel Count [%d] from TAPI is over MAX", cbOpt.channelData.channelCnt);
                cbOpt.channelData.channelCnt = CB_CHANNEL_MAX;
        }
 
        MSG_DEBUG("Channel Count [%d]", cbOpt.channelData.channelCnt);
 
-       for (int i = 0; i < cbOpt.channelData.channelCnt; i++)
-       {
+       for (int i = 0; i < cbOpt.channelData.channelCnt; i++) {
                cbOpt.channelData.channelInfo[i].bActivate = pCBConfig->MsgIDs[i].Net3gpp.Selected;
                cbOpt.channelData.channelInfo[i].from = pCBConfig->MsgIDs[i].Net3gpp.FromMsgId;
                cbOpt.channelData.channelInfo[i].to = pCBConfig->MsgIDs[i].Net3gpp.ToMsgId;
@@ -999,8 +925,7 @@ void TapiEventGetMwiInfo(TapiHandle *handle, int result, void *data, void *user_
 {
        MSG_DEBUG("TapiEventGetMwiInfo is called.");
 
-       if (result != TAPI_SIM_ACCESS_SUCCESS || data == NULL)
-       {
+       if (result != TAPI_SIM_ACCESS_SUCCESS || data == NULL) {
                MSG_DEBUG("Error. data is NULL.");
                SmsPluginSetting::instance()->setMwiInfoEvent(handle, NULL, false);
 
@@ -1059,8 +984,7 @@ void TapiEventGetSimServiceTable(TapiHandle *handle, int result, void *data, voi
 
        bool bRet = true;
 
-       if (access_rt != TAPI_SIM_ACCESS_SUCCESS || svct == NULL)
-       {
+       if (access_rt != TAPI_SIM_ACCESS_SUCCESS || svct == NULL) {
                MSG_ERR("Error. data is NULL and access_rt [%d] failed", access_rt);
                SmsPluginSetting::instance()->setResultFromSim(false);
                return;
@@ -1120,22 +1044,17 @@ void TapiEventSatSmsRefresh(TapiHandle *handle, int result, void *data, void *us
 {
        MSG_DEBUG("TapiEventSatSmsRefresh is called.");
 
-       if (result != TAPI_API_SUCCESS || data == NULL)
-       {
+       if (result != TAPI_API_SUCCESS || data == NULL) {
                MSG_DEBUG("Error. data is NULL.");
                return;
        }
 
-       try
-       {
+       try {
                SmsPluginSatHandler::instance()->refreshSms(handle, data);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return;
        }
-
 }
 
 
@@ -1143,22 +1062,17 @@ void TapiEventSatSendSms(TapiHandle *handle, const char *noti_id, void *data, vo
 {
        MSG_DEBUG("TapiEventSatSendSms is called.");
 
-       if (data == NULL)
-       {
+       if (data == NULL) {
                MSG_DEBUG("Error. data is NULL.");
                return;
        }
 
-       try
-       {
+       try {
                SmsPluginSatHandler::instance()->sendSms(handle, data);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return;
        }
-
 }
 
 
@@ -1166,39 +1080,31 @@ void TapiEventSatMoSmsCtrl(TapiHandle *handle, const char *noti_id, void *data,
 {
        MSG_DEBUG("TapiEventSatMoSmsCtrl is called.");
 
-       if (data == NULL)
-       {
+       if (data == NULL) {
                MSG_DEBUG("Error. data is NULL.");
                return;
        }
 
-       try
-       {
+       try {
                SmsPluginSatHandler::instance()->ctrlSms(handle, data);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return;
        }
-
 }
 
 void TapiEventMemoryStatus(TapiHandle *handle, int result, void *data, void *user_data)
 {
        MSG_DEBUG("Tapi result is [%d]", result);
-       if(result == TAPI_API_SUCCESS)
-       {
+       if (result == TAPI_API_SUCCESS)
                isMemAvailable = true;
-       }
 }
 
 void TapiEventSetMsgStatus(TapiHandle *handle, int result, void *data, void *user_data)
 {
        MSG_DEBUG("TapiEventSetMsgStatus is called. result [%d]", result);
 
-       if (result != TAPI_API_SUCCESS || data == NULL)
-       {
+       if (result != TAPI_API_SUCCESS || data == NULL) {
                MSG_DEBUG("Error. data is NULL.");
                SmsPluginSimMsg::instance()->setSimEvent((msg_sim_id_t)0, false);
                return;
@@ -1214,8 +1120,7 @@ void TapiEventGetMeImei(TapiHandle *handle, int result, void *data, void *user_d
 {
        MSG_SEC_DEBUG("TapiEventGetMeImei is called. result [%d]", result);
 
-       if (result != TAPI_API_SUCCESS || data == NULL)
-       {
+       if (result != TAPI_API_SUCCESS || data == NULL) {
                MSG_DEBUG("Error. data is NULL.");
                SmsPluginSetting::instance()->setResultImei(false, NULL);
                return;
@@ -1257,10 +1162,11 @@ void TapiEventNetworkStatusChange(TapiHandle *handle, const char *noti_id, void
 
        TelNetworkServiceType_t *type = (TelNetworkServiceType_t *)data;
 
-       MSG_INFO("network status type [%d], simIndex [%d]", *type, (int)user_data);
+       MSG_INFO("network status type [%d]", *type);
 
        if (*type > TAPI_NETWORK_SERVICE_TYPE_SEARCH) {
-               SmsPluginEventHandler::instance()->handleResendMessage(); // Call Event Handler
+               /* Call Event Handler */
+               SmsPluginEventHandler::instance()->handleResendMessage();
        }
 }
 
@@ -1310,7 +1216,7 @@ void SmsPluginCallback::registerEvent()
 
        for (int i = 1; i <= count; ++i) {
                pTapiHandle = SmsPluginDSHandler::instance()->getTelHandle(i);
-               int simIndex = SmsPluginDSHandler::instance()->getSimIndex(pTapiHandle);
+//             int simIndex = SmsPluginDSHandler::instance()->getSimIndex(pTapiHandle);
 
                if (tel_register_noti_event(pTapiHandle, TAPI_NOTI_SMS_DEVICE_READY, TapiEventDeviceReady, NULL) != TAPI_API_SUCCESS)
                        MSG_DEBUG("tel_register_noti_event is failed : [%s]", TAPI_NOTI_SMS_DEVICE_READY);
@@ -1326,7 +1232,7 @@ void SmsPluginCallback::registerEvent()
                        MSG_DEBUG("tel_register_noti_event is failed : [%s]", TAPI_NOTI_SAT_MO_SM_CONTROL_RESULT);
                if (tel_register_noti_event(pTapiHandle, TAPI_NOTI_SIM_STATUS, TapiEventSimStatusChange, NULL) != TAPI_API_SUCCESS)
                        MSG_DEBUG("tel_register_noti_event is failed : [%s]", TAPI_NOTI_SIM_STATUS);
-               if (tel_register_noti_event(pTapiHandle, TAPI_PROP_NETWORK_SERVICE_TYPE, TapiEventNetworkStatusChange, (void*)simIndex) != TAPI_API_SUCCESS)
+               if (tel_register_noti_event(pTapiHandle, TAPI_PROP_NETWORK_SERVICE_TYPE, TapiEventNetworkStatusChange, NULL) != TAPI_API_SUCCESS)
                        MSG_DEBUG("tel_register_noti_event is failed : [%s]", TAPI_PROP_NETWORK_SERVICE_TYPE);
                if (tel_register_noti_event(pTapiHandle, TAPI_NOTI_SIM_REFRESHED, TapiEventSimRefreshed, NULL) != TAPI_API_SUCCESS)
                        MSG_DEBUG("tel_register_noti_event is failed : [%s]", TAPI_NOTI_SIM_REFRESHED);
index 6701f15..00d2e60 100755 (executable)
@@ -29,7 +29,7 @@
 #include "SmsPluginDSHandler.h"
 
 /*==================================================================================================
-                                     IMPLEMENTATION OF SmsPluginCbMsgHandler - Member Functions
+                  IMPLEMENTATION OF SmsPluginCbMsgHandler - Member Functions
 ==================================================================================================*/
 SmsPluginCbMsgHandler* SmsPluginCbMsgHandler::pInstance = NULL;
 
@@ -69,56 +69,49 @@ void SmsPluginCbMsgHandler::handleCbMsg(TapiHandle *handle, TelSmsCbMsg_t *pCbMs
        SMS_CB_NETWORK_TYPE_T type = pCbMsg->EtwsMsgType;
        SMS_CBMSG_PAGE_S CbMsgPage = {0};
 
-       switch (type)
-       {
-               case SMS_CB_NETWORK_TYPE_2G_GSM :
-                       Decode2gCbMsg((TelSmsCbMsg_t *)pCbMsg, &CbMsgPage);
+       switch (type) {
+       case SMS_CB_NETWORK_TYPE_2G_GSM :
+               Decode2gCbMsg((TelSmsCbMsg_t *)pCbMsg, &CbMsgPage);
                break;
 
-               case SMS_CB_NETWORK_TYPE_3G_UMTS :
-                       Decode3gCbMsg((TelSmsCbMsg_t *)pCbMsg, &CbMsgPage);
+       case SMS_CB_NETWORK_TYPE_3G_UMTS :
+               Decode3gCbMsg((TelSmsCbMsg_t *)pCbMsg, &CbMsgPage);
                break;
-
        }
 #else
        SMS_CB_NETWORK_TYPE_T type = pCbMsg->CbMsgType;
        SMS_CBMSG_PAGE_S CbMsgPage = {0};
 
-       switch (type)
-       {
-               case SMS_CB_NETWORK_TYPE_2G_GSM :
-                       Decode2gCbMsg(pCbMsg, &CbMsgPage);
+       switch (type) {
+       case SMS_CB_NETWORK_TYPE_2G_GSM :
+               Decode2gCbMsg(pCbMsg, &CbMsgPage);
                break;
 
-               case SMS_CB_NETWORK_TYPE_3G_UMTS :
-                       Decode3gCbMsg(pCbMsg, &CbMsgPage);
+       case SMS_CB_NETWORK_TYPE_3G_UMTS :
+               Decode3gCbMsg(pCbMsg, &CbMsgPage);
                break;
-
        }
 #endif
-       // Check CB Msg Options
+       /* Check CB Msg Options */
        bool bJavaMsg = false;
 
        int simIndex = SmsPluginDSHandler::instance()->getSimIndex(handle);
 
-       if (!checkCbOpt(&CbMsgPage, &bJavaMsg, simIndex))
-       {
+       if (!checkCbOpt(&CbMsgPage, &bJavaMsg, simIndex)) {
                MSG_DEBUG("The CB Msg is not supported by option.");
                return;
        }
 
-       if (bJavaMsg == true)
-       {
+       if (bJavaMsg == true) {
                MSG_DEBUG("JAVA CB Msg.");
                CbMsgPage.cbMsgType = SMS_CBMSG_TYPE_JAVACBS;
        }
 
 
-       // Check CB Pages
+       /* Check CB Pages */
        unsigned char pageCnt = checkCbPage(&CbMsgPage);
 
-       if (pageCnt == CbMsgPage.pageHeader.totalPages)
-       {
+       if (pageCnt == CbMsgPage.pageHeader.totalPages) {
                MSG_DEBUG("RECEIVED LAST MSG : %d", pageCnt);
 
                SMS_CBMSG_S *cbMsg = NULL;
@@ -134,19 +127,18 @@ void SmsPluginCbMsgHandler::handleCbMsg(TapiHandle *handle, TelSmsCbMsg_t *pCbMs
                msgInfo.addressList = NULL;
                unique_ptr<MSG_ADDRESS_INFO_S*, void(*)(MSG_ADDRESS_INFO_S**)> addressListBuf(&msgInfo.addressList, unique_ptr_deleter);
 
-               // Make CB Msg Structure
+               /* Make CB Msg Structure */
                MakeCbMsg(&CbMsgPage, cbMsg);
 
-               // Convert to MSG_MESSAGE_INFO_S
+               /* Convert to MSG_MESSAGE_INFO_S */
                convertCbMsgToMsginfo(cbMsg, &msgInfo, simIndex);
 
-               // Add CB Msg into DB
+               /* Add CB Msg into DB */
                msg_error_t err = MSG_SUCCESS;
 
                err = SmsPluginStorage::instance()->checkMessage(&msgInfo);
 
-               if (err == MSG_SUCCESS)
-               {
+               if (err == MSG_SUCCESS) {
                        MSG_CB_MSG_S cbOutMsg = {0, };
 
                        cbOutMsg.type = MSG_CB_SMS;
@@ -161,12 +153,8 @@ void SmsPluginCbMsgHandler::handleCbMsg(TapiHandle *handle, TelSmsCbMsg_t *pCbMs
                        memcpy(cbOutMsg.language_type, CbMsgPage.pageHeader.dcs.iso639Lang, 3);
                        err = SmsPluginEventHandler::instance()->callbackCBMsgIncoming(&cbOutMsg, &msgInfo);
                        if (err != MSG_SUCCESS)
-                       {
                                MSG_DEBUG("callbackMsgIncoming() Error !! [%d]", err);
-                       }
-               }
-               else
-               {
+               } else {
                        MSG_DEBUG("checkMessage() Error !! [%d]", err);
                }
 
@@ -179,7 +167,7 @@ void SmsPluginCbMsgHandler::handleCbMsg(TapiHandle *handle, TelSmsCbMsg_t *pCbMs
                        MSG_DEBUG("insertReceivedCBMessage() Error !! [%d]", err);
                }
 #endif
-               // Remove From List
+               /* Remove From List */
                removeFromPageList(&CbMsgPage);
        }
        MSG_END();
@@ -195,8 +183,7 @@ void SmsPluginCbMsgHandler::handleEtwsMsg(TapiHandle *handle, TelSmsEtwsMsg_t *p
        SMS_ETWS_PRIMARY_S              etwsPn = {0, };
        MSG_CB_MSG_S                    cbOutMsg = {0, };
 
-       if(type != TAPI_NETTEXT_ETWS_PRIMARY)
-       {
+       if (type != TAPI_NETTEXT_ETWS_PRIMARY) {
                MSG_DEBUG("The Etws secondary Message");
                handleCbMsg(handle, (TelSmsCbMsg_t *)pEtwsMsg);
                return;
@@ -213,9 +200,7 @@ void SmsPluginCbMsgHandler::handleEtwsMsg(TapiHandle *handle, TelSmsEtwsMsg_t *p
 
        err = SmsPluginEventHandler::instance()->callbackCBMsgIncoming(&cbOutMsg, NULL);
        if (err != MSG_SUCCESS)
-       {
                MSG_DEBUG("callbackMsgIncoming() Error !! [%d]", err);
-       }
 
        MSG_END();
 }
@@ -229,7 +214,7 @@ void SmsPluginCbMsgHandler::Decode2gCbMsg(TelSmsCbMsg_t *pCbMsg, SMS_CBMSG_PAGE_
        memcpy(cbData, pCbMsg->szMsgData, pCbMsg->Length);
        cbData[pCbMsg->Length] = '\0';
 
-       // print cb data
+       /* print cb data */
        MSG_INFO("Received CB length:%d", pCbMsg->Length);
        char cbDataTmp[(pCbMsg->Length*2)+1];
        memset(cbDataTmp, 0x00, sizeof(cbDataTmp));
@@ -241,7 +226,7 @@ void SmsPluginCbMsgHandler::Decode2gCbMsg(TelSmsCbMsg_t *pCbMsg, SMS_CBMSG_PAGE_
 
        pCbPage->cbMsgType = SMS_CBMSG_TYPE_CBS;
 
-       // Serial Number
+       /* Serial Number */
        pCbPage->pageHeader.serialNum.geoScope = (cbData[0] & 0xC0) >> 6;
 
        pCbPage->pageHeader.serialNum.msgCode = (cbData[0] & 0x3F) << 4;
@@ -255,10 +240,10 @@ void SmsPluginCbMsgHandler::Decode2gCbMsg(TelSmsCbMsg_t *pCbMsg, SMS_CBMSG_PAGE_
 
        MSG_DEBUG("MSG ID : [%d]", pCbPage->pageHeader.msgId);
 
-       // DCS
+       /* DCS */
        decodeCbMsgDCS(cbData[4], (unsigned char*)cbData + 6, &(pCbPage->pageHeader.dcs));
 
-       // Page Parameter
+       /* Page Parameter */
        pCbPage->pageHeader.totalPages = cbData[5] & 0x0F;
        pCbPage->pageHeader.page = (cbData[5] & 0xF0) >> 4;
 
@@ -267,64 +252,61 @@ void SmsPluginCbMsgHandler::Decode2gCbMsg(TelSmsCbMsg_t *pCbMsg, SMS_CBMSG_PAGE_
 
        MSG_DEBUG("Total Page : [%d], Page : [%d]", pCbPage->pageHeader.totalPages, pCbPage->pageHeader.page);
 
-       // Convert Language Type
+       /* Convert Language Type */
        convertLangType(pCbPage->pageHeader.dcs.langType, &(pCbPage->pageHeader.langType));
 
        MSG_DEBUG("In Language Type : [%d], Out Language Type : [%d]", pCbPage->pageHeader.dcs.langType, pCbPage->pageHeader.langType);
        MSG_DEBUG("iso639Lang : [%s]", pCbPage->pageHeader.dcs.iso639Lang);
-       // Get Receive Time
+       /* Get Receive Time */
        pCbPage->pageHeader.recvTime = getRecvTime();
 
-       // Decode CB Data
+       /* Decode CB Data */
        int dataLen = pCbMsg->Length - 6;
 
        MSG_DEBUG("codingScheme:[%d]", pCbPage->pageHeader.dcs.codingScheme);
 
-       switch (pCbPage->pageHeader.dcs.codingScheme)
+       switch (pCbPage->pageHeader.dcs.codingScheme) {
+       case SMS_CHARSET_7BIT :
        {
-               case SMS_CHARSET_7BIT :
-               {
-                       MSG_DEBUG("GSM 7 BIT");
+               MSG_DEBUG("GSM 7 BIT");
 
-                       dataLen = (dataLen*8) / 7;
-
-                       SmsPluginUDCodec udCodec;
-                       char pageData[MAX_CBMSG_PAGE_SIZE+1];
-                       int unpackLen = udCodec.unpack7bitChar(&cbData[6], dataLen, 0, pageData);
-
-                       if(pCbPage->pageHeader.dcs.iso639Lang[0])
-                       {
-                               unpackLen = unpackLen - 3;
-                               if (unpackLen > 0)
-                                       memcpy(pCbPage->pageData, &pageData[3], unpackLen);
-                               else
-                                       unpackLen = 0;
-                       } else {
-                               memcpy(pCbPage->pageData, &pageData, unpackLen);
-                       }
+               dataLen = (dataLen*8) / 7;
 
-                       MSG_DEBUG("unpackLen : [%d]", unpackLen);
+               SmsPluginUDCodec udCodec;
+               char pageData[MAX_CBMSG_PAGE_SIZE+1];
+               int unpackLen = udCodec.unpack7bitChar(&cbData[6], dataLen, 0, pageData);
 
-                       pCbPage->pageLength = unpackLen;
-                       pCbPage->pageData[unpackLen] = '\0';
+               if (pCbPage->pageHeader.dcs.iso639Lang[0]) {
+                       unpackLen = unpackLen - 3;
+                       if (unpackLen > 0)
+                               memcpy(pCbPage->pageData, &pageData[3], unpackLen);
+                       else
+                               unpackLen = 0;
+               } else {
+                       memcpy(pCbPage->pageData, &pageData, unpackLen);
                }
-               break;
 
-               case SMS_CHARSET_8BIT :
-               case SMS_CHARSET_UCS2 :
-               {
-                       MSG_DEBUG("UCS2 or 8BIT");
+               MSG_DEBUG("unpackLen : [%d]", unpackLen);
 
-                       if(pCbPage->pageHeader.dcs.iso639Lang[0])
-                       {
-                               memcpy(pCbPage->pageData, &cbData[8], dataLen - 2);
-                               pCbPage->pageLength = dataLen - 2;
-                       } else {
-                               memcpy(pCbPage->pageData, &cbData[6], dataLen);
-                               pCbPage->pageLength = dataLen;
-                       }
+               pCbPage->pageLength = unpackLen;
+               pCbPage->pageData[unpackLen] = '\0';
+       }
+       break;
+
+       case SMS_CHARSET_8BIT :
+       case SMS_CHARSET_UCS2 :
+       {
+               MSG_DEBUG("UCS2 or 8BIT");
+
+               if (pCbPage->pageHeader.dcs.iso639Lang[0]) {
+                       memcpy(pCbPage->pageData, &cbData[8], dataLen - 2);
+                       pCbPage->pageLength = dataLen - 2;
+               } else {
+                       memcpy(pCbPage->pageData, &cbData[6], dataLen);
+                       pCbPage->pageLength = dataLen;
                }
-               break;
+       }
+       break;
        }
 
        MSG_DEBUG("Page Length : [%d], Page Data : [%s]", pCbPage->pageLength, pCbPage->pageData);
@@ -345,7 +327,7 @@ void SmsPluginCbMsgHandler::DecodeEtwsMsg(TelSmsEtwsMsg_t *pEtwsMsg, SMS_ETWS_PR
        memcpy(EtwsData, pEtwsMsg->szMsgData, pEtwsMsg->Length);
        EtwsData[pEtwsMsg->Length] = '\0';
 
-       // print received msg data
+       /* print received msg data */
        MSG_INFO("Received Etws length:%d", pEtwsMsg->Length);
        char EtwsDataTmp[(pEtwsMsg->Length*2)+1];
        memset(EtwsDataTmp, 0x00, sizeof(EtwsDataTmp));
@@ -355,10 +337,10 @@ void SmsPluginCbMsgHandler::DecodeEtwsMsg(TelSmsEtwsMsg_t *pEtwsMsg, SMS_ETWS_PR
        }
        MSG_INFO("[%s]", EtwsDataTmp);
 
-       // received time
+       /* received time */
        pEtwsPn->recvTime = getRecvTime();
 
-       // Serial Number
+       /* Serial Number */
        pEtwsPn->serialNum.geoScope = (EtwsData[0] & 0xC0) >> 6;
        pEtwsPn->serialNum.msgCode = (EtwsData[0] & 0x3F) << 4;
        pEtwsPn->serialNum.msgCode |= (EtwsData[1] & 0xF0) >> 4;
@@ -366,33 +348,30 @@ void SmsPluginCbMsgHandler::DecodeEtwsMsg(TelSmsEtwsMsg_t *pEtwsMsg, SMS_ETWS_PR
 
        MSG_DEBUG("geoScope : [%d], msgCode : [%d], updateNum : [%d]", pEtwsPn->serialNum.geoScope, pEtwsPn->serialNum.msgCode, pEtwsPn->serialNum.updateNum);
 
-       // Message Identifier
+       /* Message Identifier */
        pEtwsPn->msgId = (EtwsData[2] << 8) | EtwsData[3];
        MSG_DEBUG("MSG ID : [%d]", pEtwsPn->msgId);
 
-       // warning type
+       /* warning type */
        pEtwsPn->warningType = (EtwsData[4] << 8) | EtwsData[5];
        MSG_DEBUG("warningType : [0x%04x]", pEtwsPn->msgId);
 
-       // warning security information
-       memcpy(pEtwsPn->warningSecurityInfo, &EtwsData[6], sizeof(pEtwsPn->warningSecurityInfo));       // 50bytes
-       for (unsigned int i = 0; i < sizeof(pEtwsPn->warningSecurityInfo); i++)
-       {
+       /* warning security information */
+       memcpy(pEtwsPn->warningSecurityInfo, &EtwsData[6], sizeof(pEtwsPn->warningSecurityInfo));       /* 50bytes */
+       for (unsigned int i = 0; i < sizeof(pEtwsPn->warningSecurityInfo); i++) {
                MSG_DEBUG("warning secu info [%02x]", pEtwsPn->warningSecurityInfo[i] );
        }
 }
 
 void SmsPluginCbMsgHandler::Decode3gCbMsg(TelSmsCbMsg_t *pCbMsg, SMS_CBMSG_PAGE_S *pCbPage)
 {
-       unsigned char *cbData = NULL;
-       unique_ptr<unsigned char*, void(*)(unsigned char**)> buf(&cbData, unique_ptr_deleter);
-       cbData = (unsigned char *)new char[(MAX_CBMSG_PAGE_SIZE*MAX_CBMSG_PAGE_NUM)+1];
-       memset(cbData, 0x00, sizeof((MAX_CBMSG_PAGE_SIZE*MAX_CBMSG_PAGE_NUM)+1));
+       unsigned char cbData[(MAX_CBMSG_PAGE_SIZE*MAX_CBMSG_PAGE_NUM)+1];
 
+       memset(cbData, 0x00, sizeof(cbData));
        memcpy(cbData, pCbMsg->szMsgData, pCbMsg->Length);
        cbData[pCbMsg->Length] = '\0';
 
-       // print cb data
+       /* print cb data */
        MSG_INFO("Received CB length:%d", pCbMsg->Length);
        char cbDataTmp[(pCbMsg->Length*2)+1];
        memset(cbDataTmp, 0x00, sizeof(cbDataTmp));
@@ -408,7 +387,7 @@ void SmsPluginCbMsgHandler::Decode3gCbMsg(TelSmsCbMsg_t *pCbMsg, SMS_CBMSG_PAGE_
 
        MSG_DEBUG("MSG ID : [%d]", pCbPage->pageHeader.msgId);
 
-       // Serial Number
+       /* Serial Number */
        pCbPage->pageHeader.serialNum.geoScope = (cbData[3] & 0xC0) >> 6;
 
        pCbPage->pageHeader.serialNum.msgCode = (cbData[3] & 0x3F) << 4;
@@ -418,90 +397,84 @@ void SmsPluginCbMsgHandler::Decode3gCbMsg(TelSmsCbMsg_t *pCbMsg, SMS_CBMSG_PAGE_
 
        MSG_DEBUG("geoScope : [%d], msgCode : [%d], updateNum : [%d]", pCbPage->pageHeader.serialNum.geoScope, pCbPage->pageHeader.serialNum.msgCode, pCbPage->pageHeader.serialNum.updateNum);
 
-       // DCS
+       /* DCS */
        decodeCbMsgDCS(cbData[5], (unsigned char*)cbData + 6, &(pCbPage->pageHeader.dcs));
 
-       // Convert Language Type
+       /* Convert Language Type */
        convertLangType(pCbPage->pageHeader.dcs.langType, &(pCbPage->pageHeader.langType));
 
        MSG_DEBUG("In Language Type : [%d], Out Language Type : [%d]", pCbPage->pageHeader.dcs.langType, pCbPage->pageHeader.langType);
 
-       // Get Receive Time
+       /* Get Receive Time */
        pCbPage->pageHeader.recvTime = getRecvTime();
        pCbPage->pageHeader.totalPages = cbData[6];
 
-       // Decode CB Data
+       /* Decode CB Data */
        int dataLen = 0;
        int offset = 0;
 
-       switch (pCbPage->pageHeader.dcs.codingScheme)
+       switch (pCbPage->pageHeader.dcs.codingScheme) {
+       case SMS_CHARSET_7BIT :
        {
-               case SMS_CHARSET_7BIT :
-               {
-                       for(int i = 0; i < pCbPage->pageHeader.totalPages; ++i)
-                       {
-                               char cbMessage[MAX_CBMSG_PAGE_SIZE]= {0,};
-                               dataLen = cbData[7+(i+1)*82 + i];
-                               memcpy(cbMessage, &cbData[7+(i*82)+ i], dataLen);
+               for (int i = 0; i < pCbPage->pageHeader.totalPages; ++i) {
+                       char cbMessage[MAX_CBMSG_PAGE_SIZE]= {0,};
+                       dataLen = cbData[7+(i+1)*82 + i];
+                       memcpy(cbMessage, &cbData[7+(i*82)+ i], dataLen);
 
-                               dataLen = (dataLen*8) / 7;
+                       dataLen = (dataLen*8) / 7;
 
-                               if (dataLen > MAX_CBMSG_PAGE_SIZE)
-                                       THROW(MsgException::SMS_PLG_ERROR, "CB Msg Size is over MAX [%d]", dataLen);
+                       if (dataLen > MAX_CBMSG_PAGE_SIZE)
+                               THROW(MsgException::SMS_PLG_ERROR, "CB Msg Size is over MAX [%d]", dataLen);
 
-                               SmsPluginUDCodec udCodec;
-                               int unpackLen = udCodec.unpack7bitChar((const unsigned char *)cbMessage, dataLen, 0, pCbPage->pageData + offset);
-                               offset += unpackLen;
-                       }
-                       pCbPage->pageLength = offset;
+                       SmsPluginUDCodec udCodec;
+                       int unpackLen = udCodec.unpack7bitChar((const unsigned char *)cbMessage, dataLen, 0, pCbPage->pageData + offset);
+                       offset += unpackLen;
                }
-               break;
+               pCbPage->pageLength = offset;
+       }
+       break;
 
-               case SMS_CHARSET_8BIT :
-               case SMS_CHARSET_UCS2 :
-               {
+       case SMS_CHARSET_8BIT :
+       case SMS_CHARSET_UCS2 :
+       {
 #if 0
-                       char cbMessage[MAX_CBMSG_PAGE_SIZE]= {0,};
+               char cbMessage[MAX_CBMSG_PAGE_SIZE]= {0,};
 
-                       for(int i = 0; i < pCbPage->pageHeader.totalPages; ++i)
-                       {
-                               dataLen = cbData[7+(i+1)*82 + i];
-                               memcpy(cbMessage + offset, &cbData[7+(i*82)+ i], dataLen);
-                               offset += dataLen;
-                       }
-                       dataLen = offset;
+               for (int i = 0; i < pCbPage->pageHeader.totalPages; ++i) {
+                       dataLen = cbData[7+(i+1)*82 + i];
+                       memcpy(cbMessage + offset, &cbData[7+(i*82)+ i], dataLen);
+                       offset += dataLen;
+               }
+               dataLen = offset;
 
-                       if(pCbPage->pageHeader.dcs.iso639Lang[0])
-                       {
-                               int tmpDataLen = (dataLen > 2)?(dataLen - 2):0;
-                               memcpy(pCbPage->pageData, cbMessage + 2, tmpDataLen);
-                               pCbPage->pageLength = tmpDataLen;
-                       } else {
-                               memcpy(pCbPage->pageData, cbMessage, dataLen);
-                               pCbPage->pageLength = dataLen;
-                       }
+               if (pCbPage->pageHeader.dcs.iso639Lang[0]) {
+                       int tmpDataLen = (dataLen > 2)?(dataLen - 2):0;
+                       memcpy(pCbPage->pageData, cbMessage + 2, tmpDataLen);
+                       pCbPage->pageLength = tmpDataLen;
+               } else {
+                       memcpy(pCbPage->pageData, cbMessage, dataLen);
+                       pCbPage->pageLength = dataLen;
+               }
 #else
-                       char cbMessage[MAX_CBMSG_PAGE_SIZE]= {0,};
+               char cbMessage[MAX_CBMSG_PAGE_SIZE]= {0,};
 
-                       for(int i = 0; i < pCbPage->pageHeader.totalPages; ++i)
-                       {
-                               if(pCbPage->pageHeader.dcs.iso639Lang[0])
-                               {
-                                       dataLen = cbData[7+(i+1)*82 + i] - 2;
-                                       memcpy(cbMessage + offset, &cbData[7+(i*82)+ i + 2], dataLen);
-                                       offset += dataLen;
-                               } else {
-                                       dataLen = cbData[7+(i+1)*82 + i];
-                                       memcpy(cbMessage + offset, &cbData[7+(i*82)+ i], dataLen);
-                                       offset += dataLen;
-                               }
+               for (int i = 0; i < pCbPage->pageHeader.totalPages; ++i) {
+                       if (pCbPage->pageHeader.dcs.iso639Lang[0]) {
+                               dataLen = cbData[7+(i+1)*82 + i] - 2;
+                               memcpy(cbMessage + offset, &cbData[7+(i*82)+ i + 2], dataLen);
+                               offset += dataLen;
+                       } else {
+                               dataLen = cbData[7+(i+1)*82 + i];
+                               memcpy(cbMessage + offset, &cbData[7+(i*82)+ i], dataLen);
+                               offset += dataLen;
                        }
-                       dataLen = offset;
-                       memcpy(pCbPage->pageData, cbMessage, dataLen);
-                       pCbPage->pageLength = dataLen;
-#endif
                }
-               break;
+               dataLen = offset;
+               memcpy(pCbPage->pageData, cbMessage, dataLen);
+               pCbPage->pageLength = dataLen;
+#endif
+       }
+       break;
        }
        pCbPage->pageHeader.totalPages = 1;
 
@@ -524,46 +497,46 @@ int SmsPluginCbMsgHandler::CMAS_class(unsigned short message_id)
 
        switch (message_id)
        {
-               case 4370 :
-               case 4383 :
-                       ret = MSG_CMAS_PRESIDENTIAL;
-                       break;
-               case 4371 :
-               case 4372 :
-               case 4384 :
-               case 4385 :
-                       ret = MSG_CMAS_EXTREME;
-                       break;
-               case 4373 :
-               case 4374 :
-               case 4375 :
-               case 4376 :
-               case 4377 :
-               case 4378 :
-               case 4386 :
-               case 4387 :
-               case 4388 :
-               case 4389 :
-               case 4390 :
-               case 4391 :
-                       ret = MSG_CMAS_SEVERE;
-                       break;
-               case 4379 :
-               case 4392 :
-                       ret = MSG_CMAS_AMBER;
-                       break;
-               case 4380 :
-               case 4381 :
-               case 4393 :
-               case 4394 :
-                       ret = MSG_CMAS_TEST;
-                       break;
-               case 4382 :
-               case 4395 :
-                       ret = MSG_CMAS_OPERATOR_DEFINED;
-                       break;
-               default :
-                       break;
+       case 4370 :
+       case 4383 :
+               ret = MSG_CMAS_PRESIDENTIAL;
+               break;
+       case 4371 :
+       case 4372 :
+       case 4384 :
+       case 4385 :
+               ret = MSG_CMAS_EXTREME;
+               break;
+       case 4373 :
+       case 4374 :
+       case 4375 :
+       case 4376 :
+       case 4377 :
+       case 4378 :
+       case 4386 :
+       case 4387 :
+       case 4388 :
+       case 4389 :
+       case 4390 :
+       case 4391 :
+               ret = MSG_CMAS_SEVERE;
+               break;
+       case 4379 :
+       case 4392 :
+               ret = MSG_CMAS_AMBER;
+               break;
+       case 4380 :
+       case 4381 :
+       case 4393 :
+       case 4394 :
+               ret = MSG_CMAS_TEST;
+               break;
+       case 4382 :
+       case 4395 :
+               ret = MSG_CMAS_OPERATOR_DEFINED;
+               break;
+       default :
+               break;
        }
 
        return ret;
@@ -577,24 +550,22 @@ bool SmsPluginCbMsgHandler::checkCbOpt(SMS_CBMSG_PAGE_S *CbPage, bool *pJavaMsg,
        snprintf(keyName, sizeof(keyName), "%s/%d", CB_RECEIVE, simIndex);
        MsgSettingGetBool(keyName, &bReceive);
 
-       // Receive CB Msg = FALSE
-       if (!bReceive)
-       {
+       /* Receive CB Msg = FALSE */
+       if (!bReceive) {
                MSG_DEBUG("RECEIVE CB = FALSE");
                return false;
        }
 
 #if 0
        char keyname[128];
-       // check Language
+       /* check Language */
        memset(keyName, 0x00, sizeof(keyName));
        snprintf(keyName, sizeof(keyname), "%s/%d", CB_LANGUAGE, MSG_CBLANG_TYPE_ALL);
 
        bool bAllLang = false;
        MsgSettingGetBool(keyName, &bAllLang);
 
-       if (!bAllLang)
-       {
+       if (!bAllLang) {
                MSG_DEBUG("ALL LANGUAGE = FALSE");
 
                memset(keyName, 0x00, sizeof(keyName));
@@ -604,8 +575,7 @@ bool SmsPluginCbMsgHandler::checkCbOpt(SMS_CBMSG_PAGE_S *CbPage, bool *pJavaMsg,
 
                MsgSettingGetBool(keyName, &bLang);
 
-               if (!bLang || CbPage.pageHeader.langType == MSG_CBLANG_TYPE_MAX)
-               {
+               if (!bLang || CbPage.pageHeader.langType == MSG_CBLANG_TYPE_MAX) {
                        MSG_DEBUG("LANGUAGE [%d] = FALSE", CbPage.pageHeader.langType);
                        return false;
                }
@@ -622,14 +592,12 @@ bool SmsPluginCbMsgHandler::checkCbOpt(SMS_CBMSG_PAGE_S *CbPage, bool *pJavaMsg,
        if (err != MSG_SUCCESS)
                MSG_ERR("Error value of MsgStoGetCBChannelInfo [%d]", err);
 
-       for (int i = 0; i < cbChannelInfo.channelCnt; i++)
-       {
+       for (int i = 0; i < cbChannelInfo.channelCnt; i++) {
                bActivate = cbChannelInfo.channelInfo[i].bActivate;
                MsgId_from = cbChannelInfo.channelInfo[i].from;
                MsgId_to = cbChannelInfo.channelInfo[i].to;
 
-               if (bActivate == true && CbPage->pageHeader.msgId >= MsgId_from && CbPage->pageHeader.msgId <= MsgId_to)
-               {
+               if (bActivate == true && CbPage->pageHeader.msgId >= MsgId_from && CbPage->pageHeader.msgId <= MsgId_to) {
                        MSG_DEBUG("FIND CHANNEL = [%d]", CbPage->pageHeader.msgId);
                        return true;
                }
@@ -650,33 +618,25 @@ unsigned char SmsPluginCbMsgHandler::checkCbPage(SMS_CBMSG_PAGE_S *CbPage)
        SmsPluginStorage *storageHandler = SmsPluginStorage::instance();
        err = storageHandler->isReceivedCBMessage(CbPage);
        // check existing message with cb internal table;
-       if(err != MSG_ERR_DB_NORECORD)
+       if (err != MSG_ERR_DB_NORECORD)
        {
                MSG_DEBUG("already received message: [%d]", CbPage.pageHeader.msgId);
                return 0;
        }
 #endif
 
-       if (CbPage->pageHeader.totalPages > 0)
-       {
-               for (unsigned int i = 0; i < pageList.size(); i++)
-               {
-                       if (pageList[i].geoScope == CbPage->pageHeader.serialNum.geoScope && pageList[i].msgCode == CbPage->pageHeader.serialNum.msgCode)
-                       {
+       if (CbPage->pageHeader.totalPages > 0) {
+               for (unsigned int i = 0; i < pageList.size(); i++) {
+                       if (pageList[i].geoScope == CbPage->pageHeader.serialNum.geoScope && pageList[i].msgCode == CbPage->pageHeader.serialNum.msgCode) {
                                MSG_DEBUG("geoScope [%d], msgCode [%d]", pageList[i].geoScope, pageList[i].msgCode);
 
-                               if (pageList[i].msgId == CbPage->pageHeader.msgId)
-                               {
+                               if (pageList[i].msgId == CbPage->pageHeader.msgId) {
                                        int updateNum = CbPage->pageHeader.serialNum.updateNum - pageList[i].updateNum;
 
-                                       if (updateNum > 0) // New Message Content
-                                       {
+                                       if (updateNum > 0) { /* New Message Content */
                                                break;
-                                       }
-                                       else if (updateNum == 0) // Same Message Content
-                                       {
-                                               if (pageList[i].data.count(CbPage->pageHeader.page) != 0)
-                                               {
+                                       } else if (updateNum == 0) { /* Same Message Content */
+                                               if (pageList[i].data.count(CbPage->pageHeader.page) != 0) {
                                                        MSG_DEBUG("The Page Number already exists [%d]", CbPage->pageHeader.page);
                                                        return 0;
                                                }
@@ -695,9 +655,7 @@ unsigned char SmsPluginCbMsgHandler::checkCbPage(SMS_CBMSG_PAGE_S *CbPage)
                                                bFind = true;
 
                                                break;
-                                       }
-                                       else // Old Message Content
-                                       {
+                                       } else { /* Old Message Content */
                                                return 0;
                                        }
                                }
@@ -705,8 +663,7 @@ unsigned char SmsPluginCbMsgHandler::checkCbPage(SMS_CBMSG_PAGE_S *CbPage)
                }
        }
 
-       if (bFind == false || CbPage->pageHeader.totalPages == 1)
-       {
+       if (bFind == false || CbPage->pageHeader.totalPages == 1) {
                addToPageList(CbPage);
                return 1;
        }
@@ -726,17 +683,12 @@ void SmsPluginCbMsgHandler::MakeCbMsg(SMS_CBMSG_PAGE_S *CbPage, SMS_CBMSG_S *pCb
        cbPageMap::iterator it;
        int offset = 0;
 
-       for (unsigned int i = 0; i < pageList.size(); i++)
-       {
-               if (pageList[i].geoScope == CbPage->pageHeader.serialNum.geoScope && pageList[i].msgCode == CbPage->pageHeader.serialNum.msgCode)
-               {
+       for (unsigned int i = 0; i < pageList.size(); i++) {
+               if (pageList[i].geoScope == CbPage->pageHeader.serialNum.geoScope && pageList[i].msgCode == CbPage->pageHeader.serialNum.msgCode) {
                        MSG_DEBUG("geoScope [%d], msgCode [%d]", pageList[i].geoScope, pageList[i].msgCode);
 
-                       if (pageList[i].msgId == CbPage->pageHeader.msgId)
-                       {
-
-                               for (it = pageList[i].data.begin(); it != pageList[i].data.end(); it++)
-                               {
+                       if (pageList[i].msgId == CbPage->pageHeader.msgId) {
+                               for (it = pageList[i].data.begin(); it != pageList[i].data.end(); it++) {
                                        memcpy(pCbMsg->msgData + offset, it->second.pageData, it->second.pageLength);
                                        pCbMsg->msgLength += it->second.pageLength;
                                        offset = pCbMsg->msgLength;
@@ -762,7 +714,7 @@ void SmsPluginCbMsgHandler::convertCbMsgToMsginfo(SMS_CBMSG_S *pCbMsg, MSG_MESSA
 
        pMsgInfo->folderId = MSG_CBMSGBOX_ID;
 
-       // Convert Type values
+       /* Convert Type values */
        pMsgInfo->msgType.mainType = MSG_SMS_TYPE;
 
        if (pCbMsg->cbMsgType == SMS_CBMSG_TYPE_CBS) {
@@ -772,28 +724,26 @@ void SmsPluginCbMsgHandler::convertCbMsgToMsginfo(SMS_CBMSG_S *pCbMsg, MSG_MESSA
                        pMsgInfo->msgType.subType = MSG_CB_SMS;
                else
                        pMsgInfo->msgType.subType = (MSG_SUB_TYPE_T)cmas_class;
-       }
-       else if (pCbMsg->cbMsgType == SMS_CBMSG_TYPE_JAVACBS) {
+       } else if (pCbMsg->cbMsgType == SMS_CBMSG_TYPE_JAVACBS) {
                pMsgInfo->msgType.subType = MSG_JAVACB_SMS;
        }
 
-       switch(pCbMsg->classType)
-       {
-               case SMS_MSG_CLASS_0:
-                       pMsgInfo->msgType.classType = MSG_CLASS_0;
-                       break;
-               case SMS_MSG_CLASS_1:
-                       pMsgInfo->msgType.classType = MSG_CLASS_1;
-                       break;
-               case SMS_MSG_CLASS_2:
-                       pMsgInfo->msgType.classType = MSG_CLASS_2;
-                       break;
-               case SMS_MSG_CLASS_3:
-                       pMsgInfo->msgType.classType = MSG_CLASS_3;
-                       break;
-               default:
-                       pMsgInfo->msgType.classType = MSG_CLASS_NONE;
-                       break;
+       switch (pCbMsg->classType) {
+       case SMS_MSG_CLASS_0:
+               pMsgInfo->msgType.classType = MSG_CLASS_0;
+               break;
+       case SMS_MSG_CLASS_1:
+               pMsgInfo->msgType.classType = MSG_CLASS_1;
+               break;
+       case SMS_MSG_CLASS_2:
+               pMsgInfo->msgType.classType = MSG_CLASS_2;
+               break;
+       case SMS_MSG_CLASS_3:
+               pMsgInfo->msgType.classType = MSG_CLASS_3;
+               break;
+       default:
+               pMsgInfo->msgType.classType = MSG_CLASS_NONE;
+               break;
        }
 
        pMsgInfo->storageId = MSG_STORAGE_PHONE;
@@ -803,7 +753,7 @@ void SmsPluginCbMsgHandler::convertCbMsgToMsginfo(SMS_CBMSG_S *pCbMsg, MSG_MESSA
        pMsgInfo->priority = MSG_MESSAGE_PRIORITY_NORMAL;
        pMsgInfo->direction = MSG_DIRECTION_TYPE_MT;
 
-       // Temporary
+       /* Temporary */
        pMsgInfo->nAddressCnt = 1;
 
        pMsgInfo->addressList =  (MSG_ADDRESS_INFO_S *)new char[sizeof(MSG_ADDRESS_INFO_S)];
@@ -813,7 +763,7 @@ void SmsPluginCbMsgHandler::convertCbMsgToMsginfo(SMS_CBMSG_S *pCbMsg, MSG_MESSA
        pMsgInfo->addressList[0].recipientType = MSG_RECIPIENTS_TYPE_UNKNOWN;
        pMsgInfo->sim_idx = simIndex;
 
-       //      TODO :: MSG ID should be used to get CB message type
+       /*      TODO :: MSG ID should be used to get CB message type */
        getDisplayName(pCbMsg->msgId, pMsgInfo->addressList[0].addressVal, simIndex);
        MSG_SEC_DEBUG("%s", pMsgInfo->addressList[0].addressVal);
 
@@ -844,14 +794,13 @@ void SmsPluginCbMsgHandler::convertCbMsgToMsginfo(SMS_CBMSG_S *pCbMsg, MSG_MESSA
 
        MSG_DEBUG("LENGTH %d CB MSG %s", pCbMsg->msgLength, pCbMsg->msgData);
 
-       // Convert Data values
+       /* Convert Data values */
        pMsgInfo->dataSize = convertTextToUtf8((unsigned char*)tmpBuf, bufSize, pCbMsg);
 
-       if (pMsgInfo->dataSize > MAX_MSG_TEXT_LEN)
-       {
+       if (pMsgInfo->dataSize > MAX_MSG_TEXT_LEN) {
                pMsgInfo->bTextSms = false;
 
-               // Save Message Data into File
+               /* Save Message Data into File */
                char fileName[MSG_FILENAME_LEN_MAX+1];
                memset(fileName, 0x00, sizeof(fileName));
 
@@ -863,9 +812,7 @@ void SmsPluginCbMsgHandler::convertCbMsgToMsginfo(SMS_CBMSG_S *pCbMsg, MSG_MESSA
                        THROW(MsgException::FILE_ERROR, "MsgWriteIpcFile error");
 
                strncpy(pMsgInfo->msgData, fileName, MAX_MSG_DATA_LEN);
-       }
-       else
-       {
+       } else {
                pMsgInfo->bTextSms = true;
 
                memset(pMsgInfo->msgText, 0x00, sizeof(pMsgInfo->msgText));
@@ -882,7 +829,7 @@ void SmsPluginCbMsgHandler::convertEtwsMsgToMsginfo(SMS_CBMSG_PAGE_S *EtwsMsg, M
 
        pMsgInfo->folderId = MSG_CBMSGBOX_ID;
 
-       // Convert Type values
+       /* Convert Type values */
        pMsgInfo->msgType.mainType = MSG_SMS_TYPE;
 
        if (EtwsMsg->cbMsgType == SMS_CBMSG_TYPE_ETWS)
@@ -895,7 +842,7 @@ void SmsPluginCbMsgHandler::convertEtwsMsgToMsginfo(SMS_CBMSG_PAGE_S *EtwsMsg, M
        pMsgInfo->priority = MSG_MESSAGE_PRIORITY_NORMAL;
        pMsgInfo->direction = MSG_DIRECTION_TYPE_MT;
 
-       // Temporary
+       /* Temporary */
        pMsgInfo->nAddressCnt = 1;
 
        pMsgInfo->addressList[0].addressType = MSG_ADDRESS_TYPE_UNKNOWN;
@@ -924,8 +871,7 @@ int SmsPluginCbMsgHandler::convertTextToUtf8 (unsigned char* outBuf, int outBufS
 
        MsgTextConvert *textCvt = MsgTextConvert::instance();
 
-       if (!outBuf || !pCbMsg)
-       {
+       if (!outBuf || !pCbMsg) {
                MSG_DEBUG ("invalid param.\n");
                return 0;
        }
@@ -934,7 +880,7 @@ int SmsPluginCbMsgHandler::convertTextToUtf8 (unsigned char* outBuf, int outBufS
        langInfo.bLockingShift = false;
 
 
-       // Convert Data values
+       /* Convert Data values */
        if (pCbMsg->codingScheme == SMS_CHARSET_7BIT)
                convertedTextSize = textCvt->convertGSM7bitToUTF8(outBuf, outBufSize, (unsigned char*)pCbMsg->msgData, pCbMsg->msgLength, &langInfo);
        else if (pCbMsg->codingScheme == SMS_CHARSET_UCS2)
@@ -970,13 +916,12 @@ void SmsPluginCbMsgHandler::removeFromPageList(SMS_CBMSG_PAGE_S *CbPage)
 {
        unsigned int index;
 
-       for (index = 0; index < pageList.size(); index++)
-       {
-               if (pageList[index].geoScope == CbPage->pageHeader.serialNum.geoScope && pageList[index].msgCode == CbPage->pageHeader.serialNum.msgCode)
-               {
+       for (index = 0; index < pageList.size(); index++) {
+               if (pageList[index].geoScope == CbPage->pageHeader.serialNum.geoScope && pageList[index].msgCode == CbPage->pageHeader.serialNum.msgCode) {
                        MSG_DEBUG("geoScope [%d], msgCode [%d]", pageList[index].geoScope, pageList[index].msgCode);
 
-                       if (pageList[index].msgId == CbPage->pageHeader.msgId) break;
+                       if (pageList[index].msgId == CbPage->pageHeader.msgId)
+                               break;
                }
        }
 
@@ -999,97 +944,92 @@ void SmsPluginCbMsgHandler::decodeCbMsgDCS(unsigned char dcsData, const unsigned
 
        unsigned char codingGrp = (dcsData & 0xF0) >> 4;
 
-       switch (codingGrp)
+       switch (codingGrp) {
+       case 0x00 :
+       case 0x02 :
+       case 0x03 :
        {
-               case 0x00 :
-               case 0x02 :
-               case 0x03 :
-               {
-                       pDcs->codingGroup = SMS_CBMSG_CODGRP_GENERAL_DCS;
-                       pDcs->langType = (SMS_CBMSG_LANG_TYPE_T)dcsData;
-               }
-               break;
+               pDcs->codingGroup = SMS_CBMSG_CODGRP_GENERAL_DCS;
+               pDcs->langType = (SMS_CBMSG_LANG_TYPE_T)dcsData;
+       }
+       break;
 
-               case 0x01 :
-               {
-                       if (dcsData == 0x10 || dcsData == 0x11)
-                       {
-                               pDcs->codingGroup = SMS_CBMSG_CODGRP_GENERAL_DCS;
-                               pDcs->codingScheme = (dcsData & 0x01) ? SMS_CHARSET_UCS2 : SMS_CHARSET_7BIT;
-                               pDcs->langType = SMS_CBMSG_LANG_ISO639;
-                               MSG_DEBUG("codingScheme: [%d]", pDcs->codingScheme);
-                               if (pMsgData[0] && pMsgData[1])
-                               {
-                                       pDcs->iso639Lang[0] = pMsgData[0] & 0x7F;
-                                       pDcs->iso639Lang[1] = (pMsgData[0] & 0X80) >> 7;
-                                       pDcs->iso639Lang[1] |= (pMsgData[1] & 0X3F) << 1;
-                                       pDcs->iso639Lang[2] = 0x13;  /* CR */
-                               }
-                               else
-                               {
-                                       /* Default it to English if pMsgData is NULL */
-                                       pDcs->iso639Lang[0] = 0x45;  /* E */
-                                       pDcs->iso639Lang[1] = 0x4E;  /* N */
-                                       pDcs->iso639Lang[2] = 0x13;  /* CR */
-                               }
+       case 0x01 :
+       {
+               if (dcsData == 0x10 || dcsData == 0x11) {
+                       pDcs->codingGroup = SMS_CBMSG_CODGRP_GENERAL_DCS;
+                       pDcs->codingScheme = (dcsData & 0x01) ? SMS_CHARSET_UCS2 : SMS_CHARSET_7BIT;
+                       pDcs->langType = SMS_CBMSG_LANG_ISO639;
+                       MSG_DEBUG("codingScheme: [%d]", pDcs->codingScheme);
+                       if (pMsgData[0] && pMsgData[1]) {
+                               pDcs->iso639Lang[0] = pMsgData[0] & 0x7F;
+                               pDcs->iso639Lang[1] = (pMsgData[0] & 0X80) >> 7;
+                               pDcs->iso639Lang[1] |= (pMsgData[1] & 0X3F) << 1;
+                               pDcs->iso639Lang[2] = 0x13;  /* CR */
+                       } else {
+                               /* Default it to English if pMsgData is NULL */
+                               pDcs->iso639Lang[0] = 0x45;  /* E */
+                               pDcs->iso639Lang[1] = 0x4E;  /* N */
+                               pDcs->iso639Lang[2] = 0x13;  /* CR */
                        }
                }
-               break;
+       }
+       break;
 
-               case 0x04 :
-               case 0x05 :
-               case 0x06 :
-               case 0x07 :
-               {
-                       pDcs->codingGroup = SMS_CBMSG_CODGRP_GENERAL_DCS;
+       case 0x04 :
+       case 0x05 :
+       case 0x06 :
+       case 0x07 :
+       {
+               pDcs->codingGroup = SMS_CBMSG_CODGRP_GENERAL_DCS;
 
-                       pDcs->bCompressed = (dcsData & 0x20) ? true : false;
-
-                       if (dcsData & 0x10)
-                               pDcs->classType = (SMS_MSG_CLASS_T)(dcsData & 0x03);
-
-                       unsigned char tmpScheme = (dcsData & 0x0C) >> 2;
-
-                       switch (tmpScheme) {
-                               case 0x00:
-                                       pDcs->codingScheme = SMS_CHARSET_7BIT;
-                                       break;
-                               case 0x01:
-                                       pDcs->codingScheme = SMS_CHARSET_8BIT;
-                                       break;
-                               case 0x02:
-                                       pDcs->codingScheme = SMS_CHARSET_UCS2;
-                                       break;
-                               default:
-                                       MSG_DEBUG("tmpScheme: [%d]", tmpScheme);
-                                       break;
-                       }
-               }
-               break;
+               pDcs->bCompressed = (dcsData & 0x20) ? true : false;
 
-               case 0x09 :
-               {
-                       pDcs->bUDH = true;
-                       pDcs->classType = (MSG_CLASS_TYPE_T)(dcsData & 0x03);
-                       pDcs->codingScheme = (SMS_CODING_SCHEME_T)((dcsData & 0x0C) >> 2);
-               }
-               break;
+               if (dcsData & 0x10)
+                       pDcs->classType = (SMS_MSG_CLASS_T)(dcsData & 0x03);
 
-               case 0x0E :
-               {
-                       pDcs->codingGroup = SMS_CBMSG_CODGRP_WAP;
-               }
-               break;
+               unsigned char tmpScheme = (dcsData & 0x0C) >> 2;
 
-               case 0x0F :
-               {
-                       pDcs->codingGroup = SMS_CBMSG_CODGRP_CLASS_CODING;
-                       pDcs->codingScheme = (dcsData & 0x04) ? SMS_CHARSET_8BIT : SMS_CHARSET_7BIT;
-                       pDcs->classType = (MSG_CLASS_TYPE_T)(dcsData & 0x03);
-               }
-               break;
+               switch (tmpScheme) {
+               case 0x00:
+                       pDcs->codingScheme = SMS_CHARSET_7BIT;
+                       break;
+               case 0x01:
+                       pDcs->codingScheme = SMS_CHARSET_8BIT;
+                       break;
+               case 0x02:
+                       pDcs->codingScheme = SMS_CHARSET_UCS2;
+                       break;
                default:
-                       MSG_DEBUG("codingGrp: [0x%x]", codingGrp);
+                       MSG_DEBUG("tmpScheme: [%d]", tmpScheme);
+                       break;
+               }
+       }
+       break;
+
+       case 0x09 :
+       {
+               pDcs->bUDH = true;
+               pDcs->classType = (MSG_CLASS_TYPE_T)(dcsData & 0x03);
+               pDcs->codingScheme = (SMS_CODING_SCHEME_T)((dcsData & 0x0C) >> 2);
+       }
+       break;
+
+       case 0x0E :
+       {
+               pDcs->codingGroup = SMS_CBMSG_CODGRP_WAP;
+       }
+       break;
+
+       case 0x0F :
+       {
+               pDcs->codingGroup = SMS_CBMSG_CODGRP_CLASS_CODING;
+               pDcs->codingScheme = (dcsData & 0x04) ? SMS_CHARSET_8BIT : SMS_CHARSET_7BIT;
+               pDcs->classType = (MSG_CLASS_TYPE_T)(dcsData & 0x03);
+       }
+       break;
+       default:
+               MSG_DEBUG("codingGrp: [0x%x]", codingGrp);
                break;
        }
 }
@@ -1097,46 +1037,45 @@ void SmsPluginCbMsgHandler::decodeCbMsgDCS(unsigned char dcsData, const unsigned
 
 void SmsPluginCbMsgHandler::convertLangType(SMS_CBMSG_LANG_TYPE_T InType , MSG_CB_LANGUAGE_TYPE_T *pOutType)
 {
-       switch (InType)
-       {
-               case SMS_CBMSG_LANG_GERMAN :
-                       *pOutType = MSG_CBLANG_TYPE_GER;
+       switch (InType) {
+       case SMS_CBMSG_LANG_GERMAN :
+               *pOutType = MSG_CBLANG_TYPE_GER;
                break;
 
-               case SMS_CBMSG_LANG_ENGLISH :
-                       *pOutType = MSG_CBLANG_TYPE_ENG;
+       case SMS_CBMSG_LANG_ENGLISH :
+               *pOutType = MSG_CBLANG_TYPE_ENG;
                break;
 
-               case SMS_CBMSG_LANG_ITALIAN :
-                       *pOutType = MSG_CBLANG_TYPE_ITA;
+       case SMS_CBMSG_LANG_ITALIAN :
+               *pOutType = MSG_CBLANG_TYPE_ITA;
                break;
 
-               case SMS_CBMSG_LANG_FRENCH :
-                       *pOutType = MSG_CBLANG_TYPE_FRE;
+       case SMS_CBMSG_LANG_FRENCH :
+               *pOutType = MSG_CBLANG_TYPE_FRE;
                break;
 
-               case SMS_CBMSG_LANG_SPANISH :
-                       *pOutType = MSG_CBLANG_TYPE_SPA;
+       case SMS_CBMSG_LANG_SPANISH :
+               *pOutType = MSG_CBLANG_TYPE_SPA;
                break;
 
-               case SMS_CBMSG_LANG_DUTCH :
-                       *pOutType = MSG_CBLANG_TYPE_NED;
+       case SMS_CBMSG_LANG_DUTCH :
+               *pOutType = MSG_CBLANG_TYPE_NED;
                break;
 
-               case SMS_CBMSG_LANG_SWEDISH :
-                       *pOutType = MSG_CBLANG_TYPE_SWE;
+       case SMS_CBMSG_LANG_SWEDISH :
+               *pOutType = MSG_CBLANG_TYPE_SWE;
                break;
 
-               case SMS_CBMSG_LANG_PORTUGUESE :
-                       *pOutType = MSG_CBLANG_TYPE_POR;
+       case SMS_CBMSG_LANG_PORTUGUESE :
+               *pOutType = MSG_CBLANG_TYPE_POR;
                break;
 
-               case SMS_CBMSG_LANG_TURKISH :
-                       *pOutType = MSG_CBLANG_TYPE_TUR;
+       case SMS_CBMSG_LANG_TURKISH :
+               *pOutType = MSG_CBLANG_TYPE_TUR;
                break;
 
-               default :
-                       *pOutType = MSG_CBLANG_TYPE_MAX;
+       default :
+               *pOutType = MSG_CBLANG_TYPE_MAX;
                break;
        }
 }
@@ -1161,10 +1100,8 @@ void SmsPluginCbMsgHandler::getDisplayName(unsigned short        MsgId, char *pDisplayN
        err = MsgStoGetCBChannelInfo(dbHandle, &cbChannelInfo, simIndex);
        MSG_DEBUG("MsgStoGetCBChannelInfo [err = %d]", err);
 
-       for (int i = 0; i < cbChannelInfo.channelCnt; i++)
-       {
-               if (MsgId >= cbChannelInfo.channelInfo[i].from && MsgId <= cbChannelInfo.channelInfo[i].to)
-               {
+       for (int i = 0; i < cbChannelInfo.channelCnt; i++) {
+               if (MsgId >= cbChannelInfo.channelInfo[i].from && MsgId <= cbChannelInfo.channelInfo[i].to) {
                        MSG_DEBUG("FIND MSG ID = [%d]", MsgId);
 #if 0
                        char strTmp[CB_CHANNEL_NAME_MAX + 1];
@@ -1185,11 +1122,9 @@ void SmsPluginCbMsgHandler::getDisplayName(unsigned short        MsgId, char *pDisplayN
 #endif
 
 #endif
-
                        return;
                }
        }
 
        snprintf(pDisplayName, MAX_ADDRESS_VAL_LEN + 1, "[%d]", MsgId);
 }
-
index 8a6183c..5f5d2ad 100755 (executable)
@@ -193,7 +193,7 @@ void SmsPluginConcatHandler::handleConcatMsg(struct tapi_handle *handle, SMS_TPD
                                                int totalCnt = MsgSettingGetInt(keyName);
 
                                                if (segCnt > totalCnt) {
-                                                       //send DeliveryResport as MSG_SUCCESS and return when total sim storage cnt is less than segment cnt.
+                                                       /* send DeliveryResport as MSG_SUCCESS and return when total sim storage cnt is less than segment cnt. */
                                                        MSG_INFO("SIM slot total count [%d] is less than total sement count of Class2 message [%d], send delivery report as SUCCESS and save it only PHONE", totalCnt, segCnt);
 
                                                        SmsPluginTransport::instance()->sendDeliverReport(handle, MSG_SUCCESS);
@@ -298,12 +298,12 @@ void SmsPluginConcatHandler::handleSimConcatMsg(struct tapi_handle *handle, SMS_
                        if (dataSize > 0) {
 
                                convertConcatToMsginfo(&(pTpdu->data.deliver), pUserData, dataSize, &msgInfo);
-                               // set Sim Message ID
+                               /* set Sim Message ID */
                                msgInfo.msgId = msgId;
 
-                               // set read status
+                               /* set read status */
                                msgInfo.bRead = bRead;
-                               // set storage id
+                               /* set storage id */
                                msgInfo.storageId = MSG_STORAGE_SIM;
                        }
                        for (int index = concatList.size(); index >= 0 ; index--) {
@@ -317,10 +317,12 @@ void SmsPluginConcatHandler::handleSimConcatMsg(struct tapi_handle *handle, SMS_
                                }
                        }
                        removeFromConcatList(msg.msgRef, msg.simIndex);
-                       SmsPluginSimMsg::instance()->setSimMsgEvent(handle, &msgInfo, true); // Call Event Handler
+                       /* Call Event Handler */
+                       SmsPluginSimMsg::instance()->setSimMsgEvent(handle, &msgInfo, true);
                        return;
                }
-               SmsPluginSimMsg::instance()->setSimMsgEvent(handle, NULL, false); // Call Event Handler
+               /* Call Event Handler */
+               SmsPluginSimMsg::instance()->setSimMsgEvent(handle, NULL, false);
        } else {
                SMS_CONCAT_MSG_S msg = {0};
 
@@ -378,14 +380,14 @@ void SmsPluginConcatHandler::handleSimConcatMsg(struct tapi_handle *handle, SMS_
                        if (dataSize > 0) {
                                convertConcatToMsginfo(&(pTpdu->data.submit), pUserData, dataSize, &msgInfo);
 
-                               // set Sim Message ID
+                               /* set Sim Message ID */
                                msgInfo.msgId = msgId;
-                               // set read status
+                               /* set read status */
                                msgInfo.bRead = bRead;
 
                                msgInfo.msgType.subType = MSG_CONCAT_SIM_SMS;
 
-                               // set storage id
+                               /* set storage id */
                                msgInfo.storageId = MSG_STORAGE_SIM;
                        }
                        for (int index = concatList.size(); index >= 0 ; index--) {
@@ -394,11 +396,13 @@ void SmsPluginConcatHandler::handleSimConcatMsg(struct tapi_handle *handle, SMS_
                                        break;
                                }
                        }
-                       SmsPluginSimMsg::instance()->setSimMsgEvent(handle, &msgInfo, true); // Call Event Handler
+                       /* Call Event Handler */
+                       SmsPluginSimMsg::instance()->setSimMsgEvent(handle, &msgInfo, true);
                        removeFromConcatList(msg.msgRef, msg.simIndex);
                        return;
                }
-               SmsPluginSimMsg::instance()->setSimMsgEvent(handle, NULL, false); // Call Event Handler
+               /* Call Event Handler */
+               SmsPluginSimMsg::instance()->setSimMsgEvent(handle, NULL, false);
        }
 
        MSG_END();
@@ -409,8 +413,7 @@ void SmsPluginConcatHandler::handleConcatMsg(SMS_TPDU_S *pTpdu, msg_sim_id_t Sim
 {
        MSG_BEGIN();
 
-       if (pTpdu->tpduType != SMS_TPDU_DELIVER)
-       {
+       if (pTpdu->tpduType != SMS_TPDU_DELIVER) {
                MSG_DEBUG("The TPDU type is not deliver [%d]", pTpdu->tpduType);
                return;
        }
@@ -418,10 +421,8 @@ void SmsPluginConcatHandler::handleConcatMsg(SMS_TPDU_S *pTpdu, msg_sim_id_t Sim
        SMS_CONCAT_MSG_S msg;
        memset(&msg, 0x00, sizeof(SMS_CONCAT_MSG_S));
 
-       for (int i = 0; i < pTpdu->data.deliver.userData.headerCnt; i++)
-       {
-               if (pTpdu->data.deliver.userData.header[i].udhType == SMS_UDH_CONCAT_8BIT)
-               {
+       for (int i = 0; i < pTpdu->data.deliver.userData.headerCnt; i++) {
+               if (pTpdu->data.deliver.userData.header[i].udhType == SMS_UDH_CONCAT_8BIT) {
                        msg.msgRef = (unsigned short)pTpdu->data.deliver.userData.header[i].udh.concat8bit.msgRef;
                        msg.totalSeg = pTpdu->data.deliver.userData.header[i].udh.concat8bit.totalSeg;
                        msg.seqNum = pTpdu->data.deliver.userData.header[i].udh.concat8bit.seqNum;
@@ -432,16 +433,13 @@ void SmsPluginConcatHandler::handleConcatMsg(SMS_TPDU_S *pTpdu, msg_sim_id_t Sim
 
                        msg.bRead = bRead;
 
-                       if (msg.totalSeg > MAX_SEGMENT_NUM)
-                       {
+                       if (msg.totalSeg > MAX_SEGMENT_NUM) {
                                MSG_DEBUG("Total Segment Count is over Maximum [%d]", msg.totalSeg);
                                return;
                        }
 
                        break;
-               }
-               else if (pTpdu->data.deliver.userData.header[i].udhType == SMS_UDH_CONCAT_16BIT)
-               {
+               } else if (pTpdu->data.deliver.userData.header[i].udhType == SMS_UDH_CONCAT_16BIT) {
                        msg.msgRef = (unsigned short)pTpdu->data.deliver.userData.header[i].udh.concat16bit.msgRef;
                        msg.totalSeg = pTpdu->data.deliver.userData.header[i].udh.concat16bit.totalSeg;
                        msg.seqNum = pTpdu->data.deliver.userData.header[i].udh.concat16bit.seqNum;
@@ -452,8 +450,7 @@ void SmsPluginConcatHandler::handleConcatMsg(SMS_TPDU_S *pTpdu, msg_sim_id_t Sim
 
                        msg.bRead = bRead;
 
-                       if (msg.totalSeg > MAX_SEGMENT_NUM)
-                       {
+                       if (msg.totalSeg > MAX_SEGMENT_NUM) {
                                MSG_DEBUG("Total Segment Count is over Maximum [%d]", msg.totalSeg);
                                return;
                        }
@@ -466,8 +463,7 @@ void SmsPluginConcatHandler::handleConcatMsg(SMS_TPDU_S *pTpdu, msg_sim_id_t Sim
 
        addToSimIdList(msg.msgRef, SimMsgId);
 
-       if (segCnt == msg.totalSeg)
-       {
+       if (segCnt == msg.totalSeg) {
                MSG_DEBUG("RECEIVED LAST CONCAT : %d", segCnt);
 
                int dataSize = 0;
@@ -478,19 +474,18 @@ void SmsPluginConcatHandler::handleConcatMsg(SMS_TPDU_S *pTpdu, msg_sim_id_t Sim
 
                dataSize = makeConcatUserData(msg.msgRef, &pUserData);
 
-               if (dataSize >= 0)
-               {
+               if (dataSize >= 0) {
                        MSG_DEBUG("TOTAL DATA : %s", pUserData);
 
                        convertSimMsgToMsginfo(&msg, pUserData, dataSize, &msgInfo);
 
-                       // set Sim Message ID
+                       /* set Sim Message ID */
                        msgInfo.msgId = SimMsgId;
 
-                       // set read status
+                       /* set read status */
                        msgInfo.bRead = bRead;
 
-                       /// Print MSG_MESSAGE_INFO_S
+                       /* Print MSG_MESSAGE_INFO_S */
                        MSG_DEBUG("############# Convert  tpdu values to Message Info values ####################");
 
                        MSG_DEBUG("msgInfo.msgId : %d", msgInfo.msgId);
@@ -515,23 +510,21 @@ void SmsPluginConcatHandler::handleConcatMsg(SMS_TPDU_S *pTpdu, msg_sim_id_t Sim
 
                        MSG_DEBUG("###############################################################");
 
-                       // Remove from List
+                       /* Remove from List */
                        removeFromConcatList(msg.msgRef);
                        removeFromSimIdList(msg.msgRef);
 
-                       //add msgInfo to msg list
+                       /* add msgInfo to msg list */
                        SmsPluginStorage::instance()->addSimMsgToList(&msgInfo, true);
 
-                       // Callback to MSG FW
+                       /* Callback to MSG FW */
                        SmsPluginEventHandler::instance()->callbackGetSimMsg();
                }
-       }
-       else
-       {
-               //add index count to msg list
+       } else {
+               /* add index count to msg list */
                SmsPluginStorage::instance()->addSimMsgToList(NULL, false);
 
-               // Callback to MSG FW
+               /* Callback to MSG FW */
                SmsPluginEventHandler::instance()->callbackGetSimMsg();
        }
 
@@ -541,14 +534,12 @@ void SmsPluginConcatHandler::handleConcatMsg(SMS_TPDU_S *pTpdu, msg_sim_id_t Sim
 
 void SmsPluginConcatHandler::handleBrokenMsg()
 {
-       if (concatList.size() <= 0 || simIdList.size() <= 0)
-       {
+       if (concatList.size() <= 0 || simIdList.size() <= 0) {
                MSG_DEBUG("No Broken Concatenated Message");
                return;
        }
 
-       do
-       {
+       do {
                int index = 0, dataSize = 0;
                char* pUserData = NULL;
                unique_ptr<char*, void(*)(char**)> dataBuf(&pUserData, unique_ptr_deleter);
@@ -557,8 +548,7 @@ void SmsPluginConcatHandler::handleBrokenMsg()
 
                dataSize = makeConcatUserData(concatList[index].msgRef, &pUserData);
 
-               if (dataSize > 0)
-               {
+               if (dataSize > 0) {
                        MSG_DEBUG("TOTAL DATA : %s", pUserData);
 
                        SMS_CONCAT_MSG_S msg;
@@ -573,13 +563,13 @@ void SmsPluginConcatHandler::handleBrokenMsg()
 
                        convertSimMsgToMsginfo(&msg, pUserData, dataSize, &msgInfo);
 
-                       // set Sim Message ID
+                       /* set Sim Message ID */
                        msgInfo.msgId = 0;
 
-                       // set read status
+                       /* set read status */
                        msgInfo.bRead = concatList[index].bRead;
 
-                       /// Print MSG_MESSAGE_INFO_S
+                       /* Print MSG_MESSAGE_INFO_S */
                        MSG_DEBUG("############# Convert  tpdu values to Message Info values ####################");
                        MSG_DEBUG("msgInfo.msgId : %d", msgInfo.msgId);
                        MSG_DEBUG("msgInfo.nAddressCnt : %d", msgInfo.nAddressCnt);
@@ -601,13 +591,13 @@ void SmsPluginConcatHandler::handleBrokenMsg()
                                MSG_SEC_DEBUG("msgInfo.msgData : %s", msgInfo.msgData);
                        MSG_DEBUG("###############################################################");
 
-                       //add msgInfo to msg list
+                       /* add msgInfo to msg list */
                        SmsPluginStorage::instance()->addSimMsgToList(&msgInfo, true);
                }
 
                removeFromConcatList(concatList[index].msgRef);
                removeFromSimIdList(concatList[index].msgRef);
-       }while (concatList.size() > 0);
+       } while (concatList.size() > 0);
 }
 #endif
 
@@ -706,7 +696,8 @@ int SmsPluginConcatHandler::makeConcatUserData(unsigned short MsgRef, int simInd
 
                        MSG_DEBUG("totalSize [%d]", totalSize);
 
-                       *ppTotalData = new char[totalSize];
+                       if (*ppTotalData == NULL)
+                               *ppTotalData = new char[totalSize];
 
                        for (it = concatList[i].data.begin(); it != concatList[i].data.end(); it++) {
                                memcpy(*ppTotalData+offset, it->second.data, it->second.length);
@@ -731,23 +722,22 @@ void SmsPluginConcatHandler::convertConcatToMsginfo(const SMS_DELIVER_S *pTpdu,
        /** set storage id */
        pMsgInfo->storageId = MSG_STORAGE_PHONE;
 
-       switch(pTpdu->dcs.msgClass)
-       {
-               case SMS_MSG_CLASS_0:
-                       pMsgInfo->msgType.classType = MSG_CLASS_0;
-                       break;
-               case SMS_MSG_CLASS_1:
-                       pMsgInfo->msgType.classType = MSG_CLASS_1;
-                       break;
-               case SMS_MSG_CLASS_2:
-                       pMsgInfo->msgType.classType = MSG_CLASS_2;
-                       break;
-               case SMS_MSG_CLASS_3:
-                       pMsgInfo->msgType.classType = MSG_CLASS_3;
-                       break;
-               default:
-                       pMsgInfo->msgType.classType = MSG_CLASS_NONE;
-                       break;
+       switch (pTpdu->dcs.msgClass) {
+       case SMS_MSG_CLASS_0:
+               pMsgInfo->msgType.classType = MSG_CLASS_0;
+               break;
+       case SMS_MSG_CLASS_1:
+               pMsgInfo->msgType.classType = MSG_CLASS_1;
+               break;
+       case SMS_MSG_CLASS_2:
+               pMsgInfo->msgType.classType = MSG_CLASS_2;
+               break;
+       case SMS_MSG_CLASS_3:
+               pMsgInfo->msgType.classType = MSG_CLASS_3;
+               break;
+       default:
+               pMsgInfo->msgType.classType = MSG_CLASS_NONE;
+               break;
        }
 
        pMsgInfo->networkStatus = MSG_NETWORK_RECEIVED;
@@ -840,8 +830,8 @@ void SmsPluginConcatHandler::convertConcatToMsginfo(const SMS_DELIVER_S *pTpdu,
                }
        }
 
-       //int bufSize = (MAX_MSG_DATA_LEN*MAX_SEGMENT_NUM) + 1;
-       int bufSize = (DataSize*4) + 1; // For UTF8
+       /* For UTF8 */
+       int bufSize = (DataSize*4) + 1;
 
        char tmpBuf[bufSize];
        memset(tmpBuf, 0x00, sizeof(tmpBuf));
@@ -915,23 +905,22 @@ void SmsPluginConcatHandler::convertConcatToMsginfo(const SMS_SUBMIT_S *pTpdu, c
        /** set storage id */
        pMsgInfo->storageId = MSG_STORAGE_PHONE;
 
-       switch(pTpdu->dcs.msgClass)
-       {
-               case SMS_MSG_CLASS_0:
-                       pMsgInfo->msgType.classType = MSG_CLASS_0;
-                       break;
-               case SMS_MSG_CLASS_1:
-                       pMsgInfo->msgType.classType = MSG_CLASS_1;
-                       break;
-               case SMS_MSG_CLASS_2:
-                       pMsgInfo->msgType.classType = MSG_CLASS_2;
-                       break;
-               case SMS_MSG_CLASS_3:
-                       pMsgInfo->msgType.classType = MSG_CLASS_3;
-                       break;
-               default:
-                       pMsgInfo->msgType.classType = MSG_CLASS_NONE;
-                       break;
+       switch (pTpdu->dcs.msgClass) {
+       case SMS_MSG_CLASS_0:
+               pMsgInfo->msgType.classType = MSG_CLASS_0;
+               break;
+       case SMS_MSG_CLASS_1:
+               pMsgInfo->msgType.classType = MSG_CLASS_1;
+               break;
+       case SMS_MSG_CLASS_2:
+               pMsgInfo->msgType.classType = MSG_CLASS_2;
+               break;
+       case SMS_MSG_CLASS_3:
+               pMsgInfo->msgType.classType = MSG_CLASS_3;
+               break;
+       default:
+               pMsgInfo->msgType.classType = MSG_CLASS_NONE;
+               break;
        }
 
        pMsgInfo->networkStatus = MSG_NETWORK_RECEIVED;
@@ -969,8 +958,8 @@ void SmsPluginConcatHandler::convertConcatToMsginfo(const SMS_SUBMIT_S *pTpdu, c
                }
        }
 
-       //int bufSize = (MAX_MSG_DATA_LEN*MAX_SEGMENT_NUM) + 1;
-       int bufSize = (DataSize*4) + 1; // For UTF8
+       /* For UTF8 */
+       int bufSize = (DataSize*4) + 1;
 
        char tmpBuf[bufSize];
        memset(tmpBuf, 0x00, sizeof(tmpBuf));
@@ -1023,31 +1012,30 @@ void SmsPluginConcatHandler::convertConcatToMsginfo(const SMS_SUBMIT_S *pTpdu, c
 #ifdef CONCAT_SIM_MSG_OPERATION
 void SmsPluginConcatHandler::convertSimMsgToMsginfo(const SMS_CONCAT_MSG_S *pConcatMsg, const char *pUserData, int DataSize, MSG_MESSAGE_INFO_S *pMsgInfo)
 {
-       // Convert Type  values
+       /* Convert Type  values */
        pMsgInfo->msgType.mainType = MSG_SMS_TYPE;
        pMsgInfo->msgType.subType = MSG_CONCAT_SIM_SMS;
 
-       // set folder id (temporary)
+       /* set folder id (temporary) */
        pMsgInfo->folderId = MSG_INBOX_ID;
 
        pMsgInfo->storageId = MSG_STORAGE_SIM;
 
-       switch (pConcatMsg->dcs.msgClass)
-       {
-               case SMS_MSG_CLASS_0:
-                       pMsgInfo->msgType.classType = MSG_CLASS_0;
-                       break;
-               case SMS_MSG_CLASS_1:
-                       pMsgInfo->msgType.classType = MSG_CLASS_1;
-                       break;
-               case SMS_MSG_CLASS_2:
-                       pMsgInfo->msgType.classType = MSG_CLASS_2;
-                       break;
-               case SMS_MSG_CLASS_3:
-                       pMsgInfo->msgType.classType = MSG_CLASS_3;
-                       break;
-               default:
-                       pMsgInfo->msgType.classType = MSG_CLASS_NONE;
+       switch (pConcatMsg->dcs.msgClass) {
+       case SMS_MSG_CLASS_0:
+               pMsgInfo->msgType.classType = MSG_CLASS_0;
+               break;
+       case SMS_MSG_CLASS_1:
+               pMsgInfo->msgType.classType = MSG_CLASS_1;
+               break;
+       case SMS_MSG_CLASS_2:
+               pMsgInfo->msgType.classType = MSG_CLASS_2;
+               break;
+       case SMS_MSG_CLASS_3:
+               pMsgInfo->msgType.classType = MSG_CLASS_3;
+               break;
+       default:
+               pMsgInfo->msgType.classType = MSG_CLASS_NONE;
        }
 
        pMsgInfo->networkStatus = MSG_NETWORK_RECEIVED;
@@ -1113,7 +1101,7 @@ void SmsPluginConcatHandler::convertSimMsgToMsginfo(const SMS_CONCAT_MSG_S *pCon
 
        pMsgInfo->displayTime = rawtime;
 
-       // Convert Address values
+       /* Convert Address values */
        pMsgInfo->nAddressCnt = 1;
        pMsgInfo->addressList[0].addressType = MSG_ADDRESS_TYPE_PLMN;
        strncpy(pMsgInfo->addressList[0].addressVal, pConcatMsg->originAddress.address, MAX_ADDRESS_VAL_LEN);
@@ -1122,13 +1110,11 @@ void SmsPluginConcatHandler::convertSimMsgToMsginfo(const SMS_CONCAT_MSG_S *pCon
        pMsgInfo->msgPort.dstPort = 0;
        pMsgInfo->msgPort.srcPort = 0;
 
-       // Insert SMS_CONCAT_SIM_MSG_S into File
+       /* Insert SMS_CONCAT_SIM_MSG_S into File */
        SMS_CONCAT_SIM_MSG_S concatSimMsg = {0};
 
-       for (unsigned int i = 0; i < simIdList.size(); i++)
-       {
-               if (simIdList[i].msgRef == pConcatMsg->msgRef)
-               {
+       for (unsigned int i = 0; i < simIdList.size(); i++) {
+               if (simIdList[i].msgRef == pConcatMsg->msgRef) {
                        MSG_DEBUG("Get SIM ID [%d] - List Index [%d]", simIdList[i].simId, concatSimMsg.simIdCnt);
 
                        concatSimMsg.simIdList[concatSimMsg.simIdCnt] = simIdList[i].simId;
@@ -1141,9 +1127,8 @@ void SmsPluginConcatHandler::convertSimMsgToMsginfo(const SMS_CONCAT_MSG_S *pCon
        char tmpBuf[bufSize];
        memset(tmpBuf, 0x00, sizeof(tmpBuf));
 
-       // Convert Data values
-       if (pConcatMsg->dcs.codingScheme == SMS_CHARSET_7BIT)
-       {
+       /* Convert Data values */
+       if (pConcatMsg->dcs.codingScheme == SMS_CHARSET_7BIT) {
                SMS_LANG_INFO_S langInfo = {0};
 
                langInfo.bSingleShift = false;
@@ -1151,15 +1136,11 @@ void SmsPluginConcatHandler::convertSimMsgToMsginfo(const SMS_CONCAT_MSG_S *pCon
 
                pMsgInfo->encodeType = MSG_ENCODE_GSM7BIT;
                pMsgInfo->dataSize = SmsPluginTextConvert::instance()->convertGSM7bitToUTF8((unsigned char*)tmpBuf, bufSize, (unsigned char*)pUserData, DataSize, &langInfo);
-       }
-       else if (pConcatMsg->dcs.codingScheme == SMS_CHARSET_8BIT)
-       {
+       } else if (pConcatMsg->dcs.codingScheme == SMS_CHARSET_8BIT) {
                pMsgInfo->encodeType = MSG_ENCODE_8BIT;
                memcpy(tmpBuf, pUserData, DataSize);
                pMsgInfo->dataSize = DataSize;
-       }
-       else if (pConcatMsg->dcs.codingScheme == SMS_CHARSET_UCS2)
-       {
+       } else if (pConcatMsg->dcs.codingScheme == SMS_CHARSET_UCS2) {
                pMsgInfo->encodeType = MSG_ENCODE_UCS2;
                pMsgInfo->dataSize = SmsPluginTextConvert::instance()->convertUCS2ToUTF8((unsigned char*)tmpBuf, bufSize, (unsigned char*)pUserData, DataSize);
        }
@@ -1171,7 +1152,7 @@ void SmsPluginConcatHandler::convertSimMsgToMsginfo(const SMS_CONCAT_MSG_S *pCon
        if (pMsgInfo->dataSize > 0)
                memcpy(concatSimMsg.msgData, tmpBuf, pMsgInfo->dataSize);
 
-       // Save Message Data into File
+       /* Save Message Data into File */
        char fileName[MAX_COMMON_INFO_SIZE+1];
        memset(fileName, 0x00, sizeof(fileName));
 
@@ -1214,10 +1195,8 @@ void SmsPluginConcatHandler::addToSimIdList(unsigned short MsgRef, msg_sim_id_t
 
 void SmsPluginConcatHandler::removeFromSimIdList(unsigned short MsgRef)
 {
-       for (int index = simIdList.size()-1; index >= 0 ; index--)
-       {
-               if (simIdList[index].msgRef == MsgRef)
-               {
+       for (int index = simIdList.size()-1; index >= 0 ; index--) {
+               if (simIdList[index].msgRef == MsgRef) {
                        MSG_DEBUG("remove simIdList of the index [%d]", index);
 
                        simIdList.erase(simIdList.begin()+index);
index f064b0d..bf206b3 100755 (executable)
@@ -20,8 +20,7 @@
 #include "SmsPluginDSHandler.h"
 #include "MsgGconfWrapper.h"
 
-extern "C"
-{
+extern "C" {
        #include <tapi_common.h>
        #include <TelNetwork.h>
        #include <ITapiNetwork.h>
@@ -66,8 +65,7 @@ int SmsPluginDSHandler::initTelHandle()
                goto FINISH;
        }
 
-       while(cp_list[cnt] && cnt < MAX_TELEPHONY_HANDLE_CNT)
-       {
+       while (cp_list[cnt] && cnt < MAX_TELEPHONY_HANDLE_CNT) {
                MSG_SEC_INFO("cp_list[%d]:[%s]", cnt, cp_list[cnt]);
                handle_list.handle[cnt]= tel_init(cp_list[cnt]);
                cnt++;
@@ -84,8 +82,7 @@ void SmsPluginDSHandler::deinitTelHandle()
 {
        int ret = 0;
 
-       for (int i = 0; i < handle_list.count; i++)
-       {
+       for (int i = 0; i < handle_list.count; i++) {
                ret = tel_deinit(handle_list.handle[i]);
                MSG_DEBUG("tel_deinit ret=[%d]", ret);
                handle_list.handle[i] = NULL;
@@ -99,9 +96,9 @@ void SmsPluginDSHandler::deinitTelHandle()
 
 struct tapi_handle *SmsPluginDSHandler::getTelHandle(int sim_idx)
 {
-       if (sim_idx > 0 && sim_idx < MAX_TELEPHONY_HANDLE_CNT)
+       if (sim_idx > 0 && sim_idx < MAX_TELEPHONY_HANDLE_CNT) {
                return handle_list.handle[sim_idx-1];
-       else {
+       else {
                int SIM_Status = 0;
                SIM_Status = MsgSettingGetInt(VCONFKEY_TELEPHONY_SIM_SLOT);
                if (SIM_Status == 1) {
@@ -119,9 +116,8 @@ struct tapi_handle *SmsPluginDSHandler::getTelHandle(int sim_idx)
 
 int SmsPluginDSHandler::getSimIndex(struct tapi_handle *handle)
 {
-       for(int index=0; index < handle_list.count; ++index)
-       {
-               if(handle_list.handle[index] == handle)
+       for (int index = 0; index < handle_list.count; ++index) {
+               if (handle_list.handle[index] == handle)
                        return index+1;
        }
        return 0;
@@ -130,7 +126,7 @@ int SmsPluginDSHandler::getSimIndex(struct tapi_handle *handle)
 
 void SmsPluginDSHandler::getDefaultNetworkSimId(int *simId)
 {
-       TelNetworkDefaultDataSubs_t defaultSimId;
+       TelNetworkDefaultDataSubs_t defaultSimId = TAPI_NETWORK_DEFAULT_DATA_SUBS_UNKNOWN;
 
        int tapi_ret = TAPI_API_SUCCESS;
 
@@ -178,3 +174,35 @@ int SmsPluginDSHandler::getActiveSimCount()
 
        return active_count;
 }
+
+
+int SmsPluginDSHandler::getSubscriberId(unsigned int simIndex, char **subscriber_id)
+{
+       if (simIndex <= 0 || simIndex > (unsigned int)handle_list.count) {
+               MSG_DEBUG("Invalid SIM index");
+               return MSG_ERR_INVALID_PARAMETER;
+       }
+
+       int tel_ret = TELEPHONY_ERROR_NONE;
+       telephony_handle_list_s capi_tel_handle_list;
+
+       tel_ret = telephony_init(&capi_tel_handle_list);
+       if (tel_ret != TELEPHONY_ERROR_NONE) {
+               MSG_DEBUG("Initialize failed!!!");
+               return MSG_ERR_PLUGIN_TAPIINIT;
+       }
+
+       tel_ret = telephony_sim_get_subscriber_id(capi_tel_handle_list.handle[simIndex-1], subscriber_id);
+       if (tel_ret != TELEPHONY_ERROR_NONE) {
+               MSG_DEBUG("telephony_sim_get_subscriber_id() failed!!! [%d]", tel_ret);
+       } else {
+               MSG_DEBUG("Subscriber ID is [%s]", *subscriber_id);
+       }
+
+       tel_ret = telephony_deinit(&capi_tel_handle_list);
+       if (tel_ret != TELEPHONY_ERROR_NONE) {
+               MSG_DEBUG("Deinitialize failed!!!");
+       }
+
+    return MSG_SUCCESS;
+}
index dbaf933..98efbe4 100755 (executable)
@@ -90,7 +90,7 @@ void SmsPluginEventHandler::handleSentStatus(msg_network_status_t NetStatus)
                        if (NetStatus == MSG_NETWORK_SEND_SUCCESS) {
                                MSG_DEBUG("Add phone log");
                                MsgAddPhoneLog(&(sentInfo.reqInfo.msgInfo));
-                               sentInfo.reqInfo.msgInfo.folderId = MSG_SENTBOX_ID; // It should be set after adding phone log.
+                               sentInfo.reqInfo.msgInfo.folderId = MSG_SENTBOX_ID; /* It should be set after adding phone log. */
                        } else {
                                sentInfo.reqInfo.msgInfo.bRead = false;
                        }
@@ -145,7 +145,7 @@ void SmsPluginEventHandler::handleMsgIncoming(struct tapi_handle *handle, SMS_TP
        bUdhMwiMethod = false;
        udhMwiCnt = 0;
 
-       if(pTpdu->data.deliver.dcs.msgClass == SMS_MSG_CLASS_2)
+       if (pTpdu->data.deliver.dcs.msgClass == SMS_MSG_CLASS_2)
                msgInfo.storageId = MSG_STORAGE_UNKNOWN;
        else
                msgInfo.storageId = MSG_STORAGE_PHONE;
@@ -321,7 +321,7 @@ void SmsPluginEventHandler::handleMsgIncoming(struct tapi_handle *handle, SMS_TP
                                SmsPluginTransport::instance()->sendDeliverReport(handle, err);
                }
 
-               // Tizen Validation System
+               /* Tizen Validation System */
                char *msisdn = NULL;
                char keyName[MAX_VCONFKEY_NAME_LEN];
                memset(keyName, 0x00, sizeof(keyName));
@@ -454,17 +454,16 @@ msg_error_t SmsPluginEventHandler::callbackStorageChange(msg_storage_change_type
 void SmsPluginEventHandler::convertTpduToMsginfo(SMS_TPDU_S *pTpdu, MSG_MESSAGE_INFO_S *msgInfo)
 {
 
-       switch(pTpdu->tpduType)
-       {
-               case SMS_TPDU_SUBMIT :
-                       convertSubmitTpduToMsginfo(&pTpdu->data.submit, msgInfo);
-                       break;
-               case SMS_TPDU_DELIVER :
-                       convertDeliverTpduToMsginfo(&pTpdu->data.deliver, msgInfo);
-                       break;
-               case SMS_TPDU_STATUS_REP :
-                       convertStatusRepTpduToMsginfo(&pTpdu->data.statusRep, msgInfo);
-                       break;
+       switch (pTpdu->tpduType) {
+       case SMS_TPDU_SUBMIT :
+               convertSubmitTpduToMsginfo(&pTpdu->data.submit, msgInfo);
+               break;
+       case SMS_TPDU_DELIVER :
+               convertDeliverTpduToMsginfo(&pTpdu->data.deliver, msgInfo);
+               break;
+       case SMS_TPDU_STATUS_REP :
+               convertStatusRepTpduToMsginfo(&pTpdu->data.statusRep, msgInfo);
+               break;
        }
 }
 
@@ -480,23 +479,22 @@ void SmsPluginEventHandler::convertSubmitTpduToMsginfo(const SMS_SUBMIT_S *pTpdu
        /** set folder id (temporary) */
        msgInfo->folderId = MSG_SENTBOX_ID;
 
-       switch(pTpdu->dcs.msgClass)
-       {
-               case SMS_MSG_CLASS_0:
-                       msgInfo->msgType.classType = MSG_CLASS_0;
-                       break;
-               case SMS_MSG_CLASS_1:
-                       msgInfo->msgType.classType = MSG_CLASS_1;
-                       break;
-               case SMS_MSG_CLASS_2:
-                       msgInfo->msgType.classType = MSG_CLASS_2;
-                       break;
-               case SMS_MSG_CLASS_3:
-                       msgInfo->msgType.classType = MSG_CLASS_3;
-                       break;
-               default:
-                       msgInfo->msgType.classType = MSG_CLASS_NONE;
-                       break;
+       switch (pTpdu->dcs.msgClass) {
+       case SMS_MSG_CLASS_0:
+               msgInfo->msgType.classType = MSG_CLASS_0;
+               break;
+       case SMS_MSG_CLASS_1:
+               msgInfo->msgType.classType = MSG_CLASS_1;
+               break;
+       case SMS_MSG_CLASS_2:
+               msgInfo->msgType.classType = MSG_CLASS_2;
+               break;
+       case SMS_MSG_CLASS_3:
+               msgInfo->msgType.classType = MSG_CLASS_3;
+               break;
+       default:
+               msgInfo->msgType.classType = MSG_CLASS_NONE;
+               break;
        }
 
        msgInfo->networkStatus = MSG_NETWORK_SEND_SUCCESS;
@@ -558,8 +556,7 @@ void SmsPluginEventHandler::convertDeliverTpduToMsginfo(const SMS_DELIVER_S *pTp
        msgInfo->folderId = MSG_INBOX_ID;
 
        time_t rawtime = 0;
-       if(msgInfo->storageId == MSG_STORAGE_SIM)
-       {
+       if (msgInfo->storageId == MSG_STORAGE_SIM) {
        /*** Comment below lines to save local UTC time..... (it could be used later.)
        ***/
                if (pTpdu->timeStamp.format == SMS_TIME_ABSOLUTE) {
@@ -617,24 +614,23 @@ void SmsPluginEventHandler::convertDeliverTpduToMsginfo(const SMS_DELIVER_S *pTp
 
        msgInfo->displayTime = rawtime;
 
-       switch(pTpdu->dcs.msgClass)
-       {
-               case SMS_MSG_CLASS_0:
-                       msgInfo->msgType.classType = MSG_CLASS_0;
-                       break;
-               case SMS_MSG_CLASS_1:
-                       msgInfo->msgType.classType = MSG_CLASS_1;
-                       break;
-               case SMS_MSG_CLASS_2:
-                       msgInfo->msgType.classType = MSG_CLASS_2;
-                       msgInfo->storageId = MSG_STORAGE_SIM;
-                       break;
-               case SMS_MSG_CLASS_3:
-                       msgInfo->msgType.classType = MSG_CLASS_3;
-                       break;
-               default:
-                       msgInfo->msgType.classType = MSG_CLASS_NONE;
-                       break;
+       switch (pTpdu->dcs.msgClass) {
+       case SMS_MSG_CLASS_0:
+               msgInfo->msgType.classType = MSG_CLASS_0;
+               break;
+       case SMS_MSG_CLASS_1:
+               msgInfo->msgType.classType = MSG_CLASS_1;
+               break;
+       case SMS_MSG_CLASS_2:
+               msgInfo->msgType.classType = MSG_CLASS_2;
+               msgInfo->storageId = MSG_STORAGE_SIM;
+               break;
+       case SMS_MSG_CLASS_3:
+               msgInfo->msgType.classType = MSG_CLASS_3;
+               break;
+       default:
+               msgInfo->msgType.classType = MSG_CLASS_NONE;
+               break;
        }
 
        if (pTpdu->dcs.bMWI) {
@@ -728,20 +724,19 @@ void SmsPluginEventHandler::convertDeliverTpduToMsginfo(const SMS_DELIVER_S *pTp
                memset(msgInfo->msgText, 0x00, sizeof(msgInfo->msgText));
                msgInfo->dataSize = 0;
 
-               switch(pTpdu->dcs.codingScheme)
-               {
-                       case SMS_CHARSET_7BIT:
-                               msgInfo->encodeType = MSG_ENCODE_GSM7BIT;
-                               break;
-                       case SMS_CHARSET_8BIT:
-                               msgInfo->encodeType = MSG_ENCODE_8BIT;
-                               break;
-                       case SMS_CHARSET_UCS2:
-                               msgInfo->encodeType = MSG_ENCODE_UCS2;
-                               break;
-                       default:
-                               msgInfo->encodeType = MSG_ENCODE_8BIT;
-                               break;
+               switch (pTpdu->dcs.codingScheme) {
+               case SMS_CHARSET_7BIT:
+                       msgInfo->encodeType = MSG_ENCODE_GSM7BIT;
+                       break;
+               case SMS_CHARSET_8BIT:
+                       msgInfo->encodeType = MSG_ENCODE_8BIT;
+                       break;
+               case SMS_CHARSET_UCS2:
+                       msgInfo->encodeType = MSG_ENCODE_UCS2;
+                       break;
+               default:
+                       msgInfo->encodeType = MSG_ENCODE_8BIT;
+                       break;
                }
 
                return;
@@ -802,43 +797,34 @@ void SmsPluginEventHandler::convertStatusRepTpduToMsginfo(const SMS_STATUS_REPOR
                msgInfo->storageId = MSG_STORAGE_PHONE;
        }
 
-       switch(pTpdu->dcs.msgClass)
-       {
-               case SMS_MSG_CLASS_0:
-                       msgInfo->msgType.classType = MSG_CLASS_0;
-                       break;
-               case SMS_MSG_CLASS_1:
-                       msgInfo->msgType.classType = MSG_CLASS_1;
-                       break;
-               case SMS_MSG_CLASS_2:
-                       msgInfo->msgType.classType = MSG_CLASS_2;
-                       break;
-               case SMS_MSG_CLASS_3:
-                       msgInfo->msgType.classType = MSG_CLASS_3;
-                       break;
-               default:
-                       msgInfo->msgType.classType = MSG_CLASS_NONE;
-                       break;
+       switch (pTpdu->dcs.msgClass) {
+       case SMS_MSG_CLASS_0:
+               msgInfo->msgType.classType = MSG_CLASS_0;
+               break;
+       case SMS_MSG_CLASS_1:
+               msgInfo->msgType.classType = MSG_CLASS_1;
+               break;
+       case SMS_MSG_CLASS_2:
+               msgInfo->msgType.classType = MSG_CLASS_2;
+               break;
+       case SMS_MSG_CLASS_3:
+               msgInfo->msgType.classType = MSG_CLASS_3;
+               break;
+       default:
+               msgInfo->msgType.classType = MSG_CLASS_NONE;
+               break;
        }
 
        MSG_DEBUG("delivery status : [%d]", pTpdu->status);
 
        if (pTpdu->status == SMS_STATUS_RECEIVE_SUCCESS)
-       {
                msgInfo->networkStatus = MSG_NETWORK_DELIVER_SUCCESS;
-       }
-       else if(pTpdu->status == SMS_STATUS_TRY_REQUEST_PENDING)
-       {
+       else if (pTpdu->status == SMS_STATUS_TRY_REQUEST_PENDING)
                msgInfo->networkStatus = MSG_NETWORK_DELIVER_PENDING;
-       }
-       else if(pTpdu->status == SMS_STATUS_PERM_MSG_VAL_PERIOD_EXPIRED)
-       {
+       else if (pTpdu->status == SMS_STATUS_PERM_MSG_VAL_PERIOD_EXPIRED)
                msgInfo->networkStatus = MSG_NETWORK_DELIVER_EXPIRED;
-       }
        else
-       {
                msgInfo->networkStatus = MSG_NETWORK_DELIVER_FAIL;
-       }
 
        msgInfo->bRead = false;
        msgInfo->bProtected = false;
@@ -953,28 +939,27 @@ void SmsPluginEventHandler::convertStatusRepTpduToMsginfo(const SMS_STATUS_REPOR
 
 MSG_SUB_TYPE_T SmsPluginEventHandler::convertMsgSubType(SMS_PID_T pid)
 {
-       switch (pid)
-       {
-               case SMS_PID_TYPE0 :
-                       return MSG_TYPE0_SMS;
-               case SMS_PID_REPLACE_TYPE1 :
-                       return MSG_REPLACE_TYPE1_SMS;
-               case SMS_PID_REPLACE_TYPE2 :
-                       return MSG_REPLACE_TYPE2_SMS;
-               case SMS_PID_REPLACE_TYPE3 :
-                       return MSG_REPLACE_TYPE3_SMS;
-               case SMS_PID_REPLACE_TYPE4 :
-                       return MSG_REPLACE_TYPE4_SMS;
-               case SMS_PID_REPLACE_TYPE5 :
-                       return MSG_REPLACE_TYPE5_SMS;
-               case SMS_PID_REPLACE_TYPE6 :
-                       return MSG_REPLACE_TYPE6_SMS;
-               case SMS_PID_REPLACE_TYPE7 :
-                       return MSG_REPLACE_TYPE7_SMS;
-               case SMS_PID_RETURN_CALL :
-                       return MSG_MWI_OTHER_SMS;
-               default :
-                       return MSG_NORMAL_SMS;
+       switch (pid) {
+       case SMS_PID_TYPE0 :
+               return MSG_TYPE0_SMS;
+       case SMS_PID_REPLACE_TYPE1 :
+               return MSG_REPLACE_TYPE1_SMS;
+       case SMS_PID_REPLACE_TYPE2 :
+               return MSG_REPLACE_TYPE2_SMS;
+       case SMS_PID_REPLACE_TYPE3 :
+               return MSG_REPLACE_TYPE3_SMS;
+       case SMS_PID_REPLACE_TYPE4 :
+               return MSG_REPLACE_TYPE4_SMS;
+       case SMS_PID_REPLACE_TYPE5 :
+               return MSG_REPLACE_TYPE5_SMS;
+       case SMS_PID_REPLACE_TYPE6 :
+               return MSG_REPLACE_TYPE6_SMS;
+       case SMS_PID_REPLACE_TYPE7 :
+               return MSG_REPLACE_TYPE7_SMS;
+       case SMS_PID_RETURN_CALL :
+               return MSG_MWI_OTHER_SMS;
+       default :
+               return MSG_NORMAL_SMS;
        }
 
 }
index 6cd6d0d..45aea06 100755 (executable)
@@ -32,8 +32,7 @@
 #include "SmsPluginDSHandler.h"
 #include <gio/gio.h>
 
-extern "C"
-{
+extern "C" {
        #include <tapi_common.h>
        #include <TelSms.h>
        #include <TapiUtility.h>
@@ -65,13 +64,10 @@ void MsgResourceMonitorDeinit(void);
 
 msg_error_t MsgPlgCreateHandle(MSG_PLUGIN_HANDLER_S *pPluginHandle)
 {
-       if (pPluginHandle == NULL)
-       {
+       if (pPluginHandle == NULL) {
                MSG_DEBUG("SMS plugin: create handler error ");
                return MSG_ERR_NULL_POINTER;
-       }
-       else
-       {
+       } else {
                pPluginHandle->pfInitialize = SmsPlgInitialize;
                pPluginHandle->pfFinalize = SmsPlgFinalize;
                pPluginHandle->pfRegisterListener = SmsPlgRegisterListener;
@@ -95,8 +91,7 @@ msg_error_t MsgPlgCreateHandle(MSG_PLUGIN_HANDLER_S *pPluginHandle)
 
 msg_error_t MsgPlgDestroyHandle(MSG_PLUGIN_HANDLER_S *pPluginHandle)
 {
-       if (pPluginHandle != NULL)
-       {
+       if (pPluginHandle != NULL) {
                free(pPluginHandle);
                pPluginHandle = NULL;
        }
@@ -146,14 +141,13 @@ msg_error_t SmsPlgInitialize()
 
        SmsPluginCallback::instance()->registerEvent();
 
-       for(int i=1; i <= simCnt; ++i)
-       {
+       for (int i = 1; i <= simCnt; ++i) {
                struct tapi_handle *handle;
                handle = SmsPluginDSHandler::instance()->getTelHandle(i);
                SmsPluginSetting::instance()->setSimChangeStatus(handle, true);
        }
 
-       // set resource monitor
+       /* set resource monitor */
        MsgResourceMonitorInit();
 
        MSG_END();
@@ -194,7 +188,7 @@ msg_error_t SmsPlgSubmitRequest(MSG_REQUEST_INFO_S *pReqInfo)
 {
        msg_error_t err = MSG_SUCCESS;
 
-       // Add Submit SMS into DB
+       /* Add Submit SMS into DB */
        if (pReqInfo->msgInfo.msgId == 0) {
                if (pReqInfo->msgInfo.msgPort.valid == false) {
                        err = SmsPluginStorage::instance()->checkMessage(&(pReqInfo->msgInfo));
@@ -217,16 +211,15 @@ msg_error_t SmsPlgSubmitRequest(MSG_REQUEST_INFO_S *pReqInfo)
                }
        }
 
-       // Check SIM is present or not
+       /* Check SIM is present or not */
        char keyName[MAX_VCONFKEY_NAME_LEN] = {0,};
        snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_CHANGED, pReqInfo->msgInfo.sim_idx);
        MSG_SIM_STATUS_T simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(keyName);
 
-       if (simStatus == MSG_SIM_STATUS_NOT_FOUND)
-       {
+       if (simStatus == MSG_SIM_STATUS_NOT_FOUND) {
                MSG_DEBUG("SIM is not present..");
 
-               // Update Msg Status
+               /* Update Msg Status */
                if (pReqInfo->msgInfo.msgPort.valid == false)
                        SmsPluginStorage::instance()->updateSentMsg(&(pReqInfo->msgInfo), MSG_NETWORK_SEND_FAIL);
 
@@ -256,7 +249,7 @@ msg_error_t SmsPlgSubmitRequest(MSG_REQUEST_INFO_S *pReqInfo)
 
 msg_error_t SmsPlgSaveSimMessage(const MSG_MESSAGE_INFO_S *pMsgInfo, SMS_SIM_ID_LIST_S *pSimIdList)
 {
-       // Check SIM is present or not
+       /*  Check SIM is present or not */
        char keyName[MAX_VCONFKEY_NAME_LEN];
        memset(keyName, 0x00, sizeof(keyName));
        snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_CHANGED, pMsgInfo->sim_idx);
@@ -269,17 +262,12 @@ msg_error_t SmsPlgSaveSimMessage(const MSG_MESSAGE_INFO_S *pMsgInfo, SMS_SIM_ID_
 
        msg_error_t err = MSG_SUCCESS;
 
-       try
-       {
+       try {
                err = SmsPluginSimMsg::instance()->saveSimMessage(pMsgInfo, pSimIdList);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_PLUGIN_STORAGE;
-       }
-       catch (exception& e)
-       {
+       } catch (exception& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_PLUGIN_STORAGE;
        }
@@ -290,7 +278,7 @@ msg_error_t SmsPlgSaveSimMessage(const MSG_MESSAGE_INFO_S *pMsgInfo, SMS_SIM_ID_
 
 msg_error_t SmsPlgDeleteSimMessage(msg_sim_slot_id_t sim_idx, msg_sim_id_t SimMsgId)
 {
-       // Check SIM is present or not
+       /* Check SIM is present or not */
        char keyName[MAX_VCONFKEY_NAME_LEN]={0,};
        snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_CHANGED, sim_idx);
        MSG_SIM_STATUS_T simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(keyName);
@@ -300,17 +288,12 @@ msg_error_t SmsPlgDeleteSimMessage(msg_sim_slot_id_t sim_idx, msg_sim_id_t SimMs
                return MSG_ERR_NO_SIM;
        }
 
-       try
-       {
+       try {
                SmsPluginSimMsg::instance()->deleteSimMessage(sim_idx, SimMsgId);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_PLUGIN_STORAGE;
-       }
-       catch (exception& e)
-       {
+       } catch (exception& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_PLUGIN_STORAGE;
        }
@@ -321,7 +304,7 @@ msg_error_t SmsPlgDeleteSimMessage(msg_sim_slot_id_t sim_idx, msg_sim_id_t SimMs
 
 msg_error_t SmsPlgSetReadStatus(msg_sim_slot_id_t sim_idx, msg_sim_id_t SimMsgId)
 {
-       // Check SIM is present or not
+       /* Check SIM is present or not */
        char keyName[MAX_VCONFKEY_NAME_LEN]={0,};
        snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_CHANGED, sim_idx);
        MSG_SIM_STATUS_T simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(keyName);
@@ -331,17 +314,12 @@ msg_error_t SmsPlgSetReadStatus(msg_sim_slot_id_t sim_idx, msg_sim_id_t SimMsgId
                return MSG_ERR_NO_SIM;
        }
 
-       try
-       {
+       try {
                SmsPluginSimMsg::instance()->setReadStatus(sim_idx, SimMsgId);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_PLUGIN_STORAGE;
-       }
-       catch (exception& e)
-       {
+       } catch (exception& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_PLUGIN_STORAGE;
        }
@@ -352,7 +330,7 @@ msg_error_t SmsPlgSetReadStatus(msg_sim_slot_id_t sim_idx, msg_sim_id_t SimMsgId
 
 msg_error_t SmsPlgSetMemoryStatus(msg_sim_slot_id_t simIndex, msg_error_t Error)
 {
-       // Check SIM is present or not
+       /* Check SIM is present or not */
        char keyName[MAX_VCONFKEY_NAME_LEN];
 
        memset(keyName, 0x00, sizeof(keyName));
@@ -368,9 +346,7 @@ msg_error_t SmsPlgSetMemoryStatus(msg_sim_slot_id_t simIndex, msg_error_t Error)
        int status = TAPI_NETTEXT_PDA_MEMORY_STATUS_AVAILABLE;
 
        if (Error == MSG_ERR_SIM_STORAGE_FULL || Error == MSG_ERR_MESSAGE_COUNT_FULL)
-       {
                status = TAPI_NETTEXT_PDA_MEMORY_STATUS_FULL;
-       }
 
        MSG_DEBUG("Set Status : [%d]", status);
 
@@ -379,13 +355,9 @@ msg_error_t SmsPlgSetMemoryStatus(msg_sim_slot_id_t simIndex, msg_error_t Error)
        tapiRet = tel_set_sms_memory_status(handle, status, TapiEventMemoryStatus, NULL);
 
        if (tapiRet == TAPI_API_SUCCESS)
-       {
                MSG_DEBUG("########  tel_set_sms_memory_status() Success !!! #######");
-       }
        else
-       {
                MSG_DEBUG("########  tel_set_sms_memory_status() Success !!! return : [%d] #######", tapiRet);
-       }
 
        return MSG_SUCCESS;
 }
@@ -393,17 +365,12 @@ msg_error_t SmsPlgSetMemoryStatus(msg_sim_slot_id_t simIndex, msg_error_t Error)
 
 msg_error_t SmsPlgSetConfigData(const MSG_SETTING_S *pSetting)
 {
-       try
-       {
+       try {
                SmsPluginSetting::instance()->setConfigData(pSetting);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_PLUGIN_SETTING;
-       }
-       catch (exception& e)
-       {
+       } catch (exception& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_PLUGIN_SETTING;
        }
@@ -414,17 +381,12 @@ msg_error_t SmsPlgSetConfigData(const MSG_SETTING_S *pSetting)
 
 msg_error_t SmsPlgGetConfigData(MSG_SETTING_S *pSetting)
 {
-       try
-       {
+       try {
                SmsPluginSetting::instance()->getConfigData(pSetting);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_PLUGIN_SETTING;
-       }
-       catch (exception& e)
-       {
+       } catch (exception& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_PLUGIN_SETTING;
        }
@@ -437,19 +399,14 @@ msg_error_t SmsPlgAddMessage(MSG_MESSAGE_INFO_S *pMsgInfo,  MSG_SENDINGOPT_INFO_
 {
 
        int *simIdList = (int*)pFileData;
-       try
-       {
+       try {
                SmsPluginStorage::instance()->addSmsSendOption(pMsgInfo, pSendOptInfo);
                if (simIdList)
                        SmsPluginStorage::instance()->addSimMessage(pMsgInfo, simIdList);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_PLUGIN_SETTING;
-       }
-       catch (exception& e)
-       {
+       } catch (exception& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_PLUGIN_SETTING;
        }
@@ -461,17 +418,12 @@ msg_error_t SmsPlgAddMessage(MSG_MESSAGE_INFO_S *pMsgInfo,  MSG_SENDINGOPT_INFO_
 msg_error_t SmsPlgGetDefaultNetworkSimId(int *simId)
 {
 
-       try
-       {
+       try {
                SmsPluginDSHandler::instance()->getDefaultNetworkSimId(simId);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_PLUGIN_SETTING;
-       }
-       catch (exception& e)
-       {
+       } catch (exception& e) {
                MSG_FATAL("%s", e.what());
                return MSG_ERR_PLUGIN_SETTING;
        }
@@ -490,7 +442,7 @@ static void on_change_received(GDBusConnection *connection, const gchar *sender_
                gint memStatus;
                g_variant_get(parameters, "(i)", &memStatus);
                MSG_DEBUG("memStatus = [%d]", memStatus);
-               if(memStatus == 0) {
+               if (memStatus == 0) {
                        int sim_count = SmsPluginDSHandler::instance()->getTelHandleCount();
 
                        for (int i = 0; i < sim_count; i++) {
index ca1e7e7..b8c46ac 100755 (executable)
@@ -52,22 +52,19 @@ int SmsPluginParamCodec::encodeAddress(const SMS_ADDRESS_S *pAddress, char **ppP
 
        *ppParam = new char[MAX_ADD_PARAM_LEN];
 
-       // Set Address Length
-       if (temp[0] == '+')
-       {
+       /* Set Address Length */
+       if (temp[0] == '+') {
                (*ppParam)[offset++] = strlen(temp) - 1;
                temp++;
 
                ton = SMS_TON_INTERNATIONAL;
-       }
-       else
-       {
+       } else {
                (*ppParam)[offset++] = strlen(temp);
 
                ton = pAddress->ton;
        }
 
-       // Set TON, NPI
+       /* Set TON, NPI */
        (*ppParam)[offset++] = 0x80 + (ton << 4) + pAddress->npi;
 
        MSG_DEBUG("Address length is %d.", (*ppParam)[0]);
@@ -86,8 +83,7 @@ int SmsPluginParamCodec::encodeTime(const SMS_TIMESTAMP_S *pTimeStamp, char **pp
 {
        int offset = 0;
 
-       if(pTimeStamp->format == SMS_TIME_ABSOLUTE)
-       {
+       if (pTimeStamp->format == SMS_TIME_ABSOLUTE) {
                int timeZone = pTimeStamp->time.absolute.timeZone;
                *ppParam = new char[MAX_ABS_TIME_PARAM_LEN];
 
@@ -98,8 +94,7 @@ int SmsPluginParamCodec::encodeTime(const SMS_TIMESTAMP_S *pTimeStamp, char **pp
                (*ppParam)[offset++] = ((pTimeStamp->time.absolute.minute % 10) << 4) + (pTimeStamp->time.absolute.minute / 10);
                (*ppParam)[offset++] = ((pTimeStamp->time.absolute.second % 10) << 4) + (pTimeStamp->time.absolute.second / 10);
 
-               if(timeZone < 0)
-               {
+               if (timeZone < 0) {
                        timeZone *= -1;
                        (*ppParam)[offset] = 0x08;
                }
@@ -107,9 +102,7 @@ int SmsPluginParamCodec::encodeTime(const SMS_TIMESTAMP_S *pTimeStamp, char **pp
 
 
                return offset;
-       }
-       else if(pTimeStamp->format == SMS_TIME_RELATIVE)
-       {
+       } else if (pTimeStamp->format == SMS_TIME_RELATIVE) {
                *ppParam = new char[MAX_REL_TIME_PARAM_LEN+1];
 
                memcpy(*ppParam, &(pTimeStamp->time.relative.time), MAX_REL_TIME_PARAM_LEN);
@@ -127,60 +120,54 @@ int SmsPluginParamCodec::encodeDCS(const SMS_DCS_S *pDCS, char **ppParam)
 
        **ppParam = 0x00;
 
-       switch (pDCS->codingGroup)
+       switch (pDCS->codingGroup) {
+       case SMS_GROUP_GENERAL:
        {
-               case SMS_GROUP_GENERAL:
-               {
-                       if (pDCS->msgClass != SMS_MSG_CLASS_NONE)
-                       {
-                               **ppParam = 0x10 + pDCS->msgClass;
-                       }
-
-                       if (pDCS->bCompressed)
-                       {
-                               **ppParam |= 0x20;
-                       }
-               }
+               if (pDCS->msgClass != SMS_MSG_CLASS_NONE)
+                       **ppParam = 0x10 + pDCS->msgClass;
+
+               if (pDCS->bCompressed)
+                       **ppParam |= 0x20;
+       }
                break;
 
-               case SMS_GROUP_CODING_CLASS:
-               {
-                       **ppParam = 0xF0 + pDCS->msgClass;
-               }
+       case SMS_GROUP_CODING_CLASS:
+       {
+               **ppParam = 0xF0 + pDCS->msgClass;
+       }
                break;
 
-               case SMS_GROUP_DELETION:
-                       //not supported
+       case SMS_GROUP_DELETION:
+               /* not supported */
                break;
 
-               case SMS_GROUP_DISCARD:
-                       //not supported
+       case SMS_GROUP_DISCARD:
+               /* not supported */
                break;
 
-               case SMS_GROUP_STORE:
-                       //not supported
+       case SMS_GROUP_STORE:
+               /* not supported */
                break;
 
-               default:
-                       return 0;
+       default:
+               return 0;
        }
 
-       switch (pDCS->codingScheme)
-       {
-               case SMS_CHARSET_7BIT:
+       switch (pDCS->codingScheme) {
+       case SMS_CHARSET_7BIT:
 
                break;
 
-               case SMS_CHARSET_8BIT:
-                       **ppParam |= 0x04;
+       case SMS_CHARSET_8BIT:
+               **ppParam |= 0x04;
                break;
 
-               case SMS_CHARSET_UCS2:
-                       **ppParam |= 0x08;
+       case SMS_CHARSET_UCS2:
+               **ppParam |= 0x08;
                break;
 
-               default:
-                       return 0;
+       default:
+               return 0;
        }
 
        return 1;
@@ -192,18 +179,14 @@ int SmsPluginParamCodec::encodeSMSC(const char *pAddress, unsigned char *pEncode
        char newAddr[MAX_SMSC_LEN+1];
        memset(newAddr, 0x00, sizeof(newAddr));
 
-//MSG_DEBUG("SMSC [%s]", pAddress);
-
+/*     MSG_DEBUG("SMSC [%s]", pAddress);
+*/
        if (pAddress[0] == '+')
-       {
                strncpy(newAddr, pAddress+1, MAX_SMSC_LEN);
-       }
        else
-       {
                strncpy(newAddr, pAddress, MAX_SMSC_LEN);
-       }
 
-       // Set Address
+       /* Set Address */
        int encodeLen = convertDigitToBcd(newAddr, strlen(newAddr), pEncodeAddr);
 
        pEncodeAddr[encodeLen] = '\0';
@@ -231,22 +214,21 @@ int SmsPluginParamCodec::encodeSMSC(const SMS_ADDRESS_S *pAddress, unsigned char
        else
                dataSize = 2 + (addrLen/2) + 1;
 
-       if (dataSize > MAX_SMSC_LEN)
-       {
+       if (dataSize > MAX_SMSC_LEN) {
                MSG_DEBUG("addrLen is too long [%d]", addrLen);
                MSG_DEBUG("dataSize is too long [%d]", dataSize);
 
                return 0;
        }
 
-       // Set Address Length
-       // Check IPC 4.0 -> addrLen/2
+       /* Set Address Length
+          Check IPC 4.0 -> addrLen/2 */
        pSMSC[0] = addrLen;
 
-       // Set TON, NPI
+       /* Set TON, NPI */
        pSMSC[1] = 0x80 + (pAddress->ton << 4) + pAddress->npi;
 
-       // Set Address
+       /* Set Address */
        convertDigitToBcd(newAddr, addrLen, &(pSMSC[2]));
 
        pSMSC[dataSize] = '\0';
@@ -274,11 +256,10 @@ int SmsPluginParamCodec::decodeAddress(const unsigned char *pTpdu, SMS_ADDRESS_S
        pAddress->ton = (pTpdu[offset] & 0x70) >> 4;
        pAddress->npi = pTpdu[offset++] & 0x0F;
 
-MSG_DEBUG("ton [%d]", pAddress->ton);
-MSG_DEBUG("npi [%d]", pAddress->npi);
+       MSG_DEBUG("ton [%d]", pAddress->ton);
+       MSG_DEBUG("npi [%d]", pAddress->npi);
 
-       if (pAddress->ton == SMS_TON_ALPHANUMERIC)
-       {
+       if (pAddress->ton == SMS_TON_ALPHANUMERIC) {
                MSG_DEBUG("Alphanumeric address");
 
                char* tmpAddress = new char[MAX_ADDRESS_LEN];
@@ -295,22 +276,18 @@ MSG_DEBUG("npi [%d]", pAddress->npi);
 
                if (tmpAddress)
                        delete[] tmpAddress;
-       }
-       else if (pAddress->ton == SMS_TON_INTERNATIONAL)
-       {
+       } else if (pAddress->ton == SMS_TON_INTERNATIONAL) {
                convertBcdToDigit(&(pTpdu[offset]), bcdLen, &((pAddress->address)[1]));
                if (pAddress->address[1] != '\0')
                        pAddress->address[0] = '+';
-       }
-       else
-       {
+       } else {
                convertBcdToDigit(&(pTpdu[offset]), bcdLen, &((pAddress->address)[0]));
        }
 
        offset +=       bcdLen;
 
-//MSG_DEBUG("address [%s]", pAddress->address);
-
+/*     MSG_DEBUG("address [%s]", pAddress->address);
+*/
        return offset;
 }
 
@@ -319,7 +296,7 @@ int SmsPluginParamCodec::decodeTime(const unsigned char *pTpdu, SMS_TIMESTAMP_S
 {
        int offset = 0;
 
-       // decode in ABSOLUTE time type.
+       /* decode in ABSOLUTE time type. */
        pTimeStamp->format = SMS_TIME_ABSOLUTE;
 
        pTimeStamp->time.absolute.year = (pTpdu[offset] & 0x0F)*10 + ((pTpdu[offset] & 0xF0) >> 4);
@@ -360,8 +337,7 @@ int SmsPluginParamCodec::decodeDCS(const unsigned char *pTpdu, SMS_DCS_S *pDCS)
        pDCS->bIndActive = false;
        pDCS->indType = SMS_OTHER_INDICATOR;
 
-       if (((dcs & 0xC0) >> 6) == 0)
-       {
+       if (((dcs & 0xC0) >> 6) == 0) {
                pDCS->codingGroup = SMS_GROUP_GENERAL;
                pDCS->bCompressed = (dcs & 0x20) >> 5;
                pDCS->codingScheme = (dcs & 0x0C) >> 2;
@@ -370,25 +346,19 @@ int SmsPluginParamCodec::decodeDCS(const unsigned char *pTpdu, SMS_DCS_S *pDCS)
                        pDCS->msgClass = SMS_MSG_CLASS_NONE;
                else
                        pDCS->msgClass = dcs & 0x03;
-       }
-       else if (((dcs & 0xF0) >> 4) == 0x0F)
-       {
+       } else if (((dcs & 0xF0) >> 4) == 0x0F) {
                pDCS->codingGroup = SMS_GROUP_CODING_CLASS;
                pDCS->bCompressed = false;
                pDCS->codingScheme = (dcs & 0x0C) >> 2;
 
                pDCS->msgClass = dcs & 0x03;
-       }
-       else if (((dcs & 0xC0) >> 6) == 1)
-       {
+       } else if (((dcs & 0xC0) >> 6) == 1) {
                pDCS->codingGroup = SMS_GROUP_DELETION;
                pDCS->bCompressed = false;
                pDCS->msgClass = SMS_MSG_CLASS_NONE;
 
-               // TODO: finish here. ??
-       }
-       else if (((dcs & 0xF0) >> 4) == 0x0C)
-       {
+               /* TODO: finish here. ?? */
+       } else if (((dcs & 0xF0) >> 4) == 0x0C) {
                pDCS->codingGroup = SMS_GROUP_DISCARD;
                pDCS->bCompressed = false;
                pDCS->msgClass = SMS_MSG_CLASS_NONE;
@@ -396,9 +366,7 @@ int SmsPluginParamCodec::decodeDCS(const unsigned char *pTpdu, SMS_DCS_S *pDCS)
                pDCS->bMWI = true;
                pDCS->bIndActive = (((dcs & 0x08) >> 3) == 1)? true:false;
                pDCS->indType = (SMS_INDICATOR_TYPE_T)(dcs & 0x03);
-       }
-       else if (((dcs & 0xF0) >> 4) == 0x0D)
-       {
+       } else if (((dcs & 0xF0) >> 4) == 0x0D) {
                pDCS->codingGroup = SMS_GROUP_STORE;
                pDCS->codingScheme = SMS_CHARSET_7BIT;
                pDCS->bCompressed = false;
@@ -407,9 +375,7 @@ int SmsPluginParamCodec::decodeDCS(const unsigned char *pTpdu, SMS_DCS_S *pDCS)
                pDCS->bMWI = true;
                pDCS->bIndActive = (((dcs & 0x08) >> 3) == 1)? true:false;
                pDCS->indType = (SMS_INDICATOR_TYPE_T)(dcs & 0x03);
-       }
-       else if (((dcs & 0xF0) >> 4) == 0x0E)
-       {
+       } else if (((dcs & 0xF0) >> 4) == 0x0E) {
                pDCS->codingGroup = SMS_GROUP_STORE;
                pDCS->codingScheme = SMS_CHARSET_UCS2;
                pDCS->bCompressed = false;
@@ -418,9 +384,7 @@ int SmsPluginParamCodec::decodeDCS(const unsigned char *pTpdu, SMS_DCS_S *pDCS)
                pDCS->bMWI = true;
                pDCS->bIndActive = (((dcs & 0x08) >> 3) == 1)? true:false;
                pDCS->indType = (SMS_INDICATOR_TYPE_T)(dcs & 0x03);
-       }
-       else
-       {
+       } else {
                pDCS->codingGroup = SMS_GROUP_UNKNOWN;
 
                pDCS->bCompressed = (dcs & 0x20) >> 5;
@@ -438,13 +402,10 @@ void SmsPluginParamCodec::decodeSMSC(unsigned char* pAddress, int AddrLen, MSG_S
        if (pAddress == NULL || AddrLen == 0)
                return;
 
-       if (ton == SMS_TON_INTERNATIONAL)
-       {
+       if (ton == SMS_TON_INTERNATIONAL) {
                pDecodeAddr[0] = '+';
                convertBcdToDigit(pAddress, AddrLen, &(pDecodeAddr[1]));
-       }
-       else
-       {
+       } else {
                convertBcdToDigit(pAddress, AddrLen, pDecodeAddr);
        }
 }
@@ -458,11 +419,10 @@ int SmsPluginParamCodec::convertDigitToBcd(char *pDigit, int DigitLen, unsigned
        int offset = 0;
        unsigned char temp;
 
-//MSG_DEBUG("DigitLen [%d]", DigitLen);
-//MSG_DEBUG("pDigit [%s]", pDigit);
+/*     MSG_DEBUG("DigitLen [%d]", DigitLen);
+       MSG_DEBUG("pDigit [%s]", pDigit); */
 
-       for (int i = 0; i < DigitLen; i++)
-       {
+       for (int i = 0; i < DigitLen; i++) {
                if (pDigit[i] == '*')
                        temp = 0x0A;
                else if (pDigit[i] == '#')
@@ -479,9 +439,7 @@ int SmsPluginParamCodec::convertDigitToBcd(char *pDigit, int DigitLen, unsigned
        }
 
        if ((DigitLen%2) == 1)
-       {
                pBcd[offset++] |= 0xF0;
-       }
 
        return offset;
 }
@@ -492,8 +450,7 @@ int SmsPluginParamCodec::convertBcdToDigit(const unsigned char *pBcd, int BcdLen
        int offset = 0;
        unsigned char temp;
 
-       for (int i = 0; i < BcdLen; i++)
-       {
+       for (int i = 0; i < BcdLen; i++) {
                temp = pBcd[i] & 0x0F;
 
                if (temp == 0x0A)
@@ -507,8 +464,7 @@ int SmsPluginParamCodec::convertBcdToDigit(const unsigned char *pBcd, int BcdLen
 
                temp = (pBcd[i] & 0xF0) >> 4;
 
-               if (temp == 0x0F)
-               {
+               if (temp == 0x0F) {
                        pDigit[offset] = '\0';
                        return offset;
                }
@@ -540,9 +496,9 @@ bool SmsPluginParamCodec::checkCphsVmiMsg(const unsigned char *pTpdu, int *setTy
        if (addrLen == 0x04 && pTpdu[offset++] == 0xD0) {
                if (pTpdu[offset] == 0x11 || pTpdu[offset] == 0x10) {
                        MSG_DEBUG("####### VMI msg ######");
-                       *setType = (int)(pTpdu[offset] & 0x01); // 0 : clear, 1 : set
+                       *setType = (int)(pTpdu[offset] & 0x01); /* 0 : clear, 1 : set */
 
-                       *indType = (int)(pTpdu[offset+1] & 0x01); // 0 : indicator 1, 1 : indicator 2
+                       *indType = (int)(pTpdu[offset+1] & 0x01); /* 0 : indicator 1, 1 : indicator 2 */
 
                        ret = true;
                }
index 1ca9df7..de59762 100755 (executable)
@@ -31,8 +31,7 @@
 #include "SmsPluginSatHandler.h"
 #include "SmsPluginDSHandler.h"
 
-extern "C"
-{
+extern "C" {
        #include <tapi_common.h>
        #include <TelSms.h>
        #include <TapiUtility.h>
@@ -146,15 +145,15 @@ void SmsPluginSatHandler::sendSms(struct tapi_handle *handle, void *pData)
 
        MSG_DEBUG("commandId [%d]", commandId);
 
-       // The TPDU Maximum Length at SAT side is 175
-       // This is because Sat can send 160 bytes unpacked and header
+       /* The TPDU Maximum Length at SAT side is 175
+          This is because Sat can send 160 bytes unpacked and header */
        unsigned char tpdu[MAX_SAT_TPDU_LEN+1];
        int tpduLen = 0;
 
        memset(tpdu, 0x00, sizeof(tpdu));
        memcpy(tpdu, pSmsData->smsTpdu.data, pSmsData->smsTpdu.dataLen);
 
-       // Modify Parameters, Pack User Data
+       /* Modify Parameters, Pack User Data */
        tpduLen = handleSatTpdu(tpdu, pSmsData->smsTpdu.dataLen, pSmsData->bIsPackingRequired);
 
        if (tpduLen <= 0) {
@@ -170,10 +169,10 @@ void SmsPluginSatHandler::sendSms(struct tapi_handle *handle, void *pData)
                return;
        }
 
-       // Make Telephony Structure
+       /* Make Telephony Structure */
        TelSmsDatapackageInfo_t pkgInfo;
 
-       // Set TPDU data
+       /* Set TPDU data */
        memset((void*)pkgInfo.szData, 0x00, sizeof(pkgInfo.szData));
        memcpy((void*)pkgInfo.szData, tpdu, tpduLen);
 
@@ -181,21 +180,18 @@ void SmsPluginSatHandler::sendSms(struct tapi_handle *handle, void *pData)
        pkgInfo.MsgLength = tpduLen;
        pkgInfo.format = TAPI_NETTEXT_NETTYPE_3GPP;
 
-       // Set SMSC Address
+       /* Set SMSC Address */
        SMS_ADDRESS_S smsc = {0,};
        int simIndex = SmsPluginDSHandler::instance()->getSimIndex(handle);
 
-       if (pSmsData->address.diallingNumberLen > 0)
-       {
+       if (pSmsData->address.diallingNumberLen > 0) {
                smsc.ton = pSmsData->address.ton;
                smsc.npi = pSmsData->address.npi;
                snprintf(smsc.address, sizeof(smsc.address), "%s", pSmsData->address.diallingNumber);
 
                MSG_SEC_DEBUG("SCA TON[%d], NPI[%d], LEN[%d], ADDR[%s]", smsc.ton, smsc.npi, strlen(smsc.address), smsc.address);
-       }
-       else
-       {
-               // Set SMSC Options
+       } else {
+               /* Set SMSC Options */
                SmsPluginTransport::instance()->setSmscOptions(simIndex, &smsc);
        }
 
@@ -205,25 +201,23 @@ void SmsPluginSatHandler::sendSms(struct tapi_handle *handle, void *pData)
        memset(smscAddr, 0x00, sizeof(smscAddr));
        smscLen = SmsPluginParamCodec::encodeSMSC(&smsc, smscAddr);
 
-       if (smscLen <= 0) return;
+       if (smscLen <= 0)
+               return;
 
-       // Set SMSC Address
+       /* Set SMSC Address */
        memset(pkgInfo.Sca, 0x00, sizeof(pkgInfo.Sca));
        memcpy((void*)pkgInfo.Sca, smscAddr, smscLen);
        pkgInfo.Sca[smscLen] = '\0';
 
        int tapiRet = TAPI_API_SUCCESS;
 
-       // Send SMS
+       /* Send SMS */
        tapiRet = tel_send_sms(handle, &pkgInfo, 0, TapiEventSatSmsSentStatus, NULL);
 
-       if (tapiRet == TAPI_API_SUCCESS)
-       {
+       if (tapiRet == TAPI_API_SUCCESS) {
                MSG_DEBUG("########  TelTapiSmsSend Success !!! return : %d #######", tapiRet);
 
-       }
-       else
-       {
+       } else {
                MSG_DEBUG("########  TelTapiSmsSend Fail !!! return : %d #######", tapiRet);
                sendResult(handle, SMS_SAT_CMD_SEND_SMS, TAPI_SAT_R_BEYOND_ME_CAPABILITIES);
        }
@@ -254,33 +248,25 @@ void SmsPluginSatHandler::ctrlSms(struct tapi_handle *handle, void *pData)
        return;
 
 #if 0
-       if (bSendSms == true) // Send SMS By SAT
-       {
-               if (pCtrlData->moSmsCtrlResult == TAPI_SAT_CALL_CTRL_R_NOT_ALLOWED)
-               {
+       if (bSendSms == true) { // Send SMS By SAT
+               if (pCtrlData->moSmsCtrlResult == TAPI_SAT_CALL_CTRL_R_NOT_ALLOWED) {
                        MSG_DEBUG("SIM does not allow to send SMS");
 
                        sendResult(SMS_SAT_CMD_SEND_SMS, TAPI_SAT_R_INTRCTN_WITH_CC_OR_SMS_CTRL_PRMNT_PRBLM);
-               }
-               else if (pCtrlData->moSmsCtrlResult == TAPI_SAT_CALL_CTRL_R_ALLOWED_WITH_MOD)
-               {
+               } else if (pCtrlData->moSmsCtrlResult == TAPI_SAT_CALL_CTRL_R_ALLOWED_WITH_MOD) {
                        MSG_DEBUG("SIM allows to send SMS with modification");
 
                        sendResult(SMS_SAT_CMD_SEND_SMS, TAPI_SAT_R_SUCCESS);
                }
        }
-       else // Send SMS By APP
-       {
+       else { // Send SMS By APP
                msg_network_status_t netStatus = MSG_NETWORK_NOT_SEND;
 
-               if (pCtrlData->moSmsCtrlResult == TAPI_SAT_CALL_CTRL_R_NOT_ALLOWED)
-               {
+               if (pCtrlData->moSmsCtrlResult == TAPI_SAT_CALL_CTRL_R_NOT_ALLOWED) {
                        MSG_DEBUG("SIM does not allow to send SMS");
 
                        netStatus = MSG_NETWORK_SEND_FAIL;
-               }
-               else if (pCtrlData->moSmsCtrlResult == TAPI_SAT_CALL_CTRL_R_ALLOWED_WITH_MOD)
-               {
+               } else if (pCtrlData->moSmsCtrlResult == TAPI_SAT_CALL_CTRL_R_ALLOWED_WITH_MOD) {
                        MSG_DEBUG("SIM allows to send SMS with modification");
 
                        netStatus = MSG_NETWORK_SEND_SUCCESS;
@@ -513,11 +499,11 @@ int SmsPluginSatHandler::handleSatTpdu(unsigned char *pTpdu, unsigned char TpduL
 
        int pos = 0;
 
-       // TP-MTI, TP-RD, TP-VPF,  TP-RP, TP-UDHI, TP-SRR
-       // TP-VPF
+       /* TP-MTI, TP-RD, TP-VPF,  TP-RP, TP-UDHI, TP-SRR */
+       /* TP-VPF */
        SMS_VPF_T vpf = (SMS_VPF_T)(pTpdu[pos++] & 0x18) >> 3;
 
-       // TP-MR
+       /* TP-MR */
        unsigned char tmpRef = pTpdu[pos];
 
        MSG_DEBUG("current Msg Ref : %d", tmpRef);
@@ -531,22 +517,21 @@ int SmsPluginSatHandler::handleSatTpdu(unsigned char *pTpdu, unsigned char TpduL
 //     pTpdu[pos++] = SmsPluginTransport::instance()->getMsgRef();
 
 
-       // TP-DA
+       /* TP-DA */
        SMS_ADDRESS_S destAddr = {0};
        int addrLen = SmsPluginParamCodec::decodeAddress(&pTpdu[pos], &destAddr);
 
        pos += addrLen;
 
-       // TP-PID
+       /* TP-PID */
        pos++;
 
-       // TP-DCS
+       /* TP-DCS */
        SMS_DCS_S dcs = {0};
 
        int dcsLen = SmsPluginParamCodec::decodeDCS(&pTpdu[pos], &dcs);
 
-       if (bIsPackingRequired == true)
-       {
+       if (bIsPackingRequired == true) {
                dcs.codingScheme = SMS_CHARSET_7BIT;
 
                char* pDcs = NULL;
@@ -559,22 +544,17 @@ int SmsPluginSatHandler::handleSatTpdu(unsigned char *pTpdu, unsigned char TpduL
 
        pos++;
 
-       // TP-VP
+       /* TP-VP */
        if (vpf == SMS_VPF_RELATIVE)
-       {
                pos += MAX_REL_TIME_PARAM_LEN;
-       }
        else if (vpf == SMS_VPF_ABSOLUTE)
-       {
                pos += MAX_ABS_TIME_PARAM_LEN;
-       }
 
-       // TP-UDL
+       /* TP-UDL */
        int udl = pTpdu[pos];
        int retLen = 0;
 
-       if (bIsPackingRequired == true)
-       {
+       if (bIsPackingRequired == true) {
                SMS_USERDATA_S userData = {0};
 
                userData.headerCnt = 0;
@@ -582,14 +562,12 @@ int SmsPluginSatHandler::handleSatTpdu(unsigned char *pTpdu, unsigned char TpduL
                memcpy(userData.data, &pTpdu[pos+1], udl);
                userData.data[udl] = '\0';
 
-MSG_DEBUG("user data : [%s]", userData.data);
+               MSG_DEBUG("user data : [%s]", userData.data);
 
                int encodeSize = SmsPluginUDCodec::encodeUserData(&userData, dcs.codingScheme, (char*)&pTpdu[pos]);
 
                retLen = pos + encodeSize;
-       }
-       else
-       {
+       } else {
                retLen = TpduLen;
        }
 
@@ -606,15 +584,12 @@ void SmsPluginSatHandler::sendResult(struct tapi_handle *handle, SMS_SAT_CMD_TYP
 
        MSG_DEBUG("satRetInfo.commandId [%d]", satRetInfo.commandId);
 
-       if (CmdType == SMS_SAT_CMD_REFRESH)
-       {
+       if (CmdType == SMS_SAT_CMD_REFRESH) {
                satRetInfo.commandType = TAPI_SAT_CMD_TYPE_REFRESH;
 
                satRetInfo.appsRet.refresh.appType = TAPI_SAT_REFRESH_MSG;
                satRetInfo.appsRet.refresh.resp = (TelSatResultType_t)ResultType;
-       }
-       else if (CmdType == SMS_SAT_CMD_SEND_SMS)
-       {
+       } else if (CmdType == SMS_SAT_CMD_SEND_SMS) {
                satRetInfo.commandType = TAPI_SAT_CMD_TYPE_SEND_SMS;
 
                satRetInfo.appsRet.sendSms.resp = (TelSatResultType_t)ResultType;
@@ -625,13 +600,9 @@ void SmsPluginSatHandler::sendResult(struct tapi_handle *handle, SMS_SAT_CMD_TYP
        tapiRet = tel_send_sat_app_exec_result(handle, &satRetInfo);
 
        if (tapiRet == TAPI_API_SUCCESS)
-       {
                MSG_DEBUG("TelTapiSatSendAppExecutionResult() SUCCESS");
-       }
        else
-       {
                MSG_DEBUG("TelTapiSatSendAppExecutionResult() FAIL [%d]", tapiRet);
-       }
 
        bInitSim = false;
        bSMSPChanged = false;
index 461aa03..1c6fcb9 100755 (executable)
@@ -36,8 +36,7 @@
 #include "SmsPluginSetting.h"
 #include "SmsPluginDSHandler.h"
 
-extern "C"
-{
+extern "C" {
        #include <tapi_common.h>
        #include <TelSms.h>
        #include <TapiUtility.h>
@@ -59,7 +58,7 @@ SmsPluginSetting* SmsPluginSetting::pInstance = NULL;
 
 SmsPluginSetting::SmsPluginSetting()
 {
-       // Initialize member variables
+       /* Initialize member variables */
        for (int i = 0; i <= MAX_TELEPHONY_HANDLE_CNT; i++) {
                memset(&smscList[i], 0x00, sizeof(MSG_SMSC_LIST_S));
                memset(&smscData[i], 0x00, sizeof(MSG_SMSC_DATA_S));
@@ -110,7 +109,7 @@ void* SmsPluginSetting::processInitSimInfo(void *data)
 {
        MSG_BEGIN();
 
-       //Handle sim info initialization separately
+       /* Handle sim info initialization separately */
        struct tapi_handle *handle = (struct tapi_handle *)data;
        instance()->updateSimStatus(handle);
 
@@ -136,30 +135,28 @@ void SmsPluginSetting::updateSimStatus(struct tapi_handle *handle)
 
        int simIndex = SmsPluginDSHandler::instance()->getSimIndex(handle);
 
-       // Get IMSI
-       char imsi[17];
-       memset(imsi, 0x00, sizeof(imsi));
-
+       /* Get IMSI */
        TelSimImsiInfo_t imsiInfo;
        memset(&imsiInfo, 0x00, sizeof(TelSimImsiInfo_t));
 
        tapiRet = tel_get_sim_imsi(handle, &imsiInfo);
+       if (tapiRet != TAPI_API_SUCCESS) {
+               MSG_DEBUG("tel_get_sim_imsi() Error![%d]", tapiRet);
+       }
 
-       if (tapiRet == TAPI_API_SUCCESS) {
-               MSG_SEC_DEBUG("tel_get_sim_imsi() Success - MCC [%s], MNC [%s], MSIN [%s]", imsiInfo.szMcc, imsiInfo.szMnc, imsiInfo.szMsin);
+       /* Save Subcriber ID */
+       char *subscriberId = NULL;
+       memset(keyName, 0x00, sizeof(keyName));
 
-               snprintf(imsi, sizeof(imsi), "%03d%03d%s", atoi(imsiInfo.szMcc), atoi(imsiInfo.szMnc), imsiInfo.szMsin);
-               MSG_SEC_DEBUG("IMSI [%s]", imsi);
+       if (SmsPluginDSHandler::instance()->getSubscriberId(simIndex, &subscriberId) != MSG_SUCCESS) {
+               MSG_DEBUG("getSubscriberId() is failed");
        } else {
-               MSG_DEBUG("tel_get_sim_imsi() Error![%d]", tapiRet);
-               snprintf(keyName, sizeof(keyName), "%s/%d", MSG_NATIONAL_SIM, simIndex);
-               if (MsgSettingSetBool(keyName, false) != MSG_SUCCESS)
-                       MSG_DEBUG("Fail MsgSettingSetBool");
+               snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_SUBS_ID, simIndex);
+               if (MsgSettingSetString(keyName, subscriberId) != MSG_SUCCESS)
+                       MSG_DEBUG("Fail MsgSettingSetString");
        }
 
-       snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_IMSI, simIndex);
-       if (MsgSettingSetString(keyName, imsi) != MSG_SUCCESS)
-               MSG_DEBUG("Fail MsgSettingSetString");
+       g_free(subscriberId); subscriberId = NULL;
 
        /* Check device status */
        tapiRet = tel_check_sms_device_status(handle, &status);
@@ -182,16 +179,13 @@ void SmsPluginSetting::updateSimStatus(struct tapi_handle *handle)
                }
        }
 
-       // init config data.
+       /* init config data. */
        initConfigData(handle);
 
-       try
-       {
-               // init sim messages.
+       try {
+               /* init sim messages. */
                SmsPluginSimMsg::instance()->initSimMessage(handle);
-       }
-       catch (MsgException& e)
-       {
+       } catch (MsgException& e) {
                MSG_FATAL("%s", e.what());
                return;
        }
@@ -211,7 +205,7 @@ void SmsPluginSetting::initConfigData(struct tapi_handle *handle)
 
        int sim_idx = SmsPluginDSHandler::instance()->getSimIndex(handle);
        /*==================== SMSC setting ====================*/
-       // Init SMS Parameter
+       /* Init SMS Parameter */
        int paramCnt = 0;
        int failCnt = 0;
        bool bSelectedFound = false;
@@ -224,8 +218,7 @@ void SmsPluginSetting::initConfigData(struct tapi_handle *handle)
        MSG_SMSC_DATA_S tmpSmscData = {};
        MSG_SMSC_LIST_S tmpSmscList = {0,};
 
-       for (int index = 0; index < paramCnt; index++)
-       {
+       for (int index = 0; index < paramCnt; index++) {
                memset(&tmpSmscData, 0x00, sizeof(MSG_SMSC_DATA_S));
                if (getParam(handle, index, &tmpSmscData) == false) {
                        failCnt++;
@@ -242,7 +235,7 @@ void SmsPluginSetting::initConfigData(struct tapi_handle *handle)
                MSG_DEBUG("npi[%d]", tmpSmscList.smscData[index].smscAddr.npi);
                MSG_SEC_DEBUG("address[%s]", tmpSmscList.smscData[index].smscAddr.address);
 
-               //First smsc is selected index
+               /* First smsc is selected index */
                if (!bSelectedFound) {
                        tmpSmscList.selected = selectedParam;
                        bSelectedFound = !bSelectedFound;
@@ -258,8 +251,7 @@ void SmsPluginSetting::initConfigData(struct tapi_handle *handle)
        }
 
        /*==================== CB configuration ====================*/
-       if (simStatus[sim_idx] != MSG_SIM_STATUS_NOT_FOUND)
-       {
+       if (simStatus[sim_idx] != MSG_SIM_STATUS_NOT_FOUND) {
                MSG_DEBUG("simStatus == [%d]", simStatus[sim_idx]);
 
                MSG_CBMSG_OPT_S cbMsgOpt = {0,};
@@ -274,8 +266,7 @@ void SmsPluginSetting::initConfigData(struct tapi_handle *handle)
 
                        if (cbMsgOpt.bReceive == false && bAPReceive == false) {
                                MSG_DEBUG("CB is off in CP and in AP. No need to send CB request to CP. ");
-                       }
-                       else {
+                       } else {
                                MSG_DEBUG("########  Add CB Option Success !!! #######");
                                MSG_SETTING_S cbSetting;
                                getCbOpt(&cbSetting, sim_idx);
@@ -339,7 +330,7 @@ void SmsPluginSetting::initConfigData(struct tapi_handle *handle)
                } else {
                        MSG_WARN("########  getMwiInfo Fail !!! #######");
 
-                       // Get MWI from vconf and insert notification
+                       /* Get MWI from vconf and insert notification */
                        int mwiCnt = 0;
                        char keyName[MAX_VCONFKEY_NAME_LEN];
                        memset(keyName, 0x00, sizeof(keyName));
@@ -393,29 +384,28 @@ void SmsPluginSetting::setConfigData(const MSG_SETTING_S *pSetting)
 {
        MSG_DEBUG("Setting Type : [%d]", pSetting->type);
 
-       switch (pSetting->type)
-       {
+       switch (pSetting->type) {
 #if 0
-               case MSG_SMS_SENDOPT :
-                       setNetworkMode(&pSetting->option.smsSendOpt);
-                       break;
+       case MSG_SMS_SENDOPT :
+               setNetworkMode(&pSetting->option.smsSendOpt);
+               break;
 #endif
-               case MSG_SMSC_LIST :
-                       setParamList(&pSetting->option.smscList);
-                       addSMSCList((MSG_SMSC_LIST_S *)(&pSetting->option.smscList));
-//                     setSmscInfo(&pSetting->option.smscList);
-                       break;
-               case MSG_CBMSG_OPT :
-                       if (setCbConfig(&pSetting->option.cbMsgOpt) == false) {
-                               THROW(MsgException::SMS_PLG_ERROR, "Failed to set config.");
-                       }
-                       break;
-               case MSG_VOICEMAIL_OPT:
-                       setVoiceMailInfo(&pSetting->option.voiceMailOpt);
-                       break;
-               default :
-                       THROW(MsgException::SMS_PLG_ERROR, "The Setting type is not supported. [%d]", pSetting->type);
-                       break;
+       case MSG_SMSC_LIST :
+               setParamList(&pSetting->option.smscList);
+               addSMSCList((MSG_SMSC_LIST_S *)(&pSetting->option.smscList));
+//             setSmscInfo(&pSetting->option.smscList);
+               break;
+       case MSG_CBMSG_OPT :
+               if (setCbConfig(&pSetting->option.cbMsgOpt) == false) {
+                       THROW(MsgException::SMS_PLG_ERROR, "Failed to set config.");
+               }
+               break;
+       case MSG_VOICEMAIL_OPT:
+               setVoiceMailInfo(&pSetting->option.voiceMailOpt);
+               break;
+       default :
+               THROW(MsgException::SMS_PLG_ERROR, "The Setting type is not supported. [%d]", pSetting->type);
+               break;
        }
 }
 
@@ -424,21 +414,20 @@ void SmsPluginSetting::getConfigData(MSG_SETTING_S *pSetting)
 {
        MSG_DEBUG("Setting Type : [%d]", pSetting->type);
 
-       switch (pSetting->type)
-       {
-               case MSG_SMSC_LIST :
-//                     getParamList(&pSetting->option.smscList);
-                       getSmscListInfo(pSetting->option.smscList.simIndex, &(pSetting->option.smscList));
+       switch (pSetting->type) {
+       case MSG_SMSC_LIST :
+//             getParamList(&pSetting->option.smscList);
+               getSmscListInfo(pSetting->option.smscList.simIndex, &(pSetting->option.smscList));
                break;
 
-               case MSG_CBMSG_OPT :
-                       if (getCbConfig(&pSetting->option.cbMsgOpt) == false) {
-                               THROW(MsgException::SMS_PLG_ERROR, "Get CB config option failed.");
-                       }
+       case MSG_CBMSG_OPT :
+               if (getCbConfig(&pSetting->option.cbMsgOpt) == false) {
+                       THROW(MsgException::SMS_PLG_ERROR, "Get CB config option failed.");
+               }
                break;
 
-               default :
-                       THROW(MsgException::SMS_PLG_ERROR, "The Setting type is not supported. [%d]", pSetting->type);
+       default :
+               THROW(MsgException::SMS_PLG_ERROR, "The Setting type is not supported. [%d]", pSetting->type);
                break;
        }
 }
@@ -454,8 +443,7 @@ void SmsPluginSetting::addSMSCList(MSG_SMSC_LIST_S *pSmscList)
        MSG_DEBUG("total_count[%d]", pSmscList->totalCnt);
        MSG_DEBUG("selected index[%d]", pSmscList->selected);
 
-       for (int i = 0; i < pSmscList->totalCnt; i++)
-       {
+       for (int i = 0; i < pSmscList->totalCnt; i++) {
                MSG_DEBUG("pid[%d]", pSmscList->smscData[i].pid);
                MSG_DEBUG("val_period[%d]", pSmscList->smscData[i].valPeriod);
                MSG_SEC_DEBUG("name[%s]", pSmscList->smscData[i].name);
@@ -487,7 +475,7 @@ void SmsPluginSetting::addSMSCList(MSG_SMSC_LIST_S *pSmscList)
                else
                        smscList[sim_index].smscData[i].smscAddr.ton = MSG_TON_NATIONAL;
 
-               smscList[sim_index].smscData[i].smscAddr.npi = MSG_NPI_ISDN; // app cannot set this value
+               smscList[sim_index].smscData[i].smscAddr.npi = MSG_NPI_ISDN; /* app cannot set this value */
        }
 
        MSG_END();
@@ -524,8 +512,7 @@ msg_error_t SmsPluginSetting::addCbOpt(MSG_CBMSG_OPT_S *pCbOpt)
 
        MSG_DEBUG("Channel Count [%d]", pCbOpt->channelData.channelCnt);
 
-       for (int i = 0; i < pCbOpt->channelData.channelCnt; i++)
-       {
+       for (int i = 0; i < pCbOpt->channelData.channelCnt; i++) {
                MSG_DEBUG("Channel FROM [%d], Channel TO [%d]", pCbOpt->channelData.channelInfo[i].from, pCbOpt->channelData.channelInfo[i].to);
        }
 
@@ -625,7 +612,7 @@ void SmsPluginSetting::setParamList(const MSG_SMSC_LIST_S *pSMSCList)
        smsParam.ParamIndicator = 0x00;
 
        if (strlen(pSMSCList->smscData[index].smscAddr.address) > 0) {
-               smsParam.ParamIndicator |= 0x02 ;  //enable 2nd Bit
+               smsParam.ParamIndicator |= 0x02 ;  /* enable 2nd Bit */
                MSG_DEBUG("ParamIndicator = [%02x]", smsParam.ParamIndicator);
 
                if (pSMSCList->smscData[index].smscAddr.address[0] == '+')
@@ -633,7 +620,7 @@ void SmsPluginSetting::setParamList(const MSG_SMSC_LIST_S *pSMSCList)
                else
                        smsParam.TpSvcCntrAddr.Ton = TAPI_SIM_TON_NATIONAL;
 
-               smsParam.TpSvcCntrAddr.Npi = TAPI_SIM_NPI_ISDN_TEL; // app cannot set this value
+               smsParam.TpSvcCntrAddr.Npi = TAPI_SIM_NPI_ISDN_TEL; /* app cannot set this value */
 
                MSG_DEBUG("SMSC TON = [%d] NPI = [%d]", smsParam.TpSvcCntrAddr.Ton, smsParam.TpSvcCntrAddr.Npi);
 
@@ -645,13 +632,13 @@ void SmsPluginSetting::setParamList(const MSG_SMSC_LIST_S *pSMSCList)
        }
 
        /*Setting the PID value*/
-       smsParam.ParamIndicator |= 0x04 ;  //enable 3nd Bit
+       smsParam.ParamIndicator |= 0x04 ;  /* enable 3rd Bit */
        MSG_DEBUG("ParamIndicator = [%02x]", smsParam.ParamIndicator);
 
        smsParam.TpProtocolId = (unsigned short)convertPid(pSMSCList->smscData[index].pid);
 
        /*Setting the ValidityPeriod value*/
-       smsParam.ParamIndicator |= 0x10 ;  //enable 5nd Bit
+       smsParam.ParamIndicator |= 0x10 ;  /* enable 5th Bit */
        MSG_DEBUG("ParamIndicator = [%02x]", smsParam.ParamIndicator);
 
        smsParam.TpValidityPeriod = (unsigned short)pSMSCList->smscData[index].valPeriod;
@@ -792,7 +779,7 @@ void SmsPluginSetting::setSmscInfo(const MSG_SMSC_LIST_S *pSmscList)
                else
                        sca.Ton = TAPI_SIM_TON_NATIONAL;
 
-               sca.Npi = TAPI_SIM_NPI_ISDN_TEL; // app cannot set this value
+               sca.Npi = TAPI_SIM_NPI_ISDN_TEL; /* app cannot set this value */
 
                MSG_SEC_DEBUG("SMSC TON = [%d], NPI = [%d], Address = [%s]", sca.Ton, sca.Npi, pSmscData->smscAddr.address);
 
@@ -824,7 +811,7 @@ bool SmsPluginSetting::setCbConfig(const MSG_CBMSG_OPT_S *pCbOpt)
        int ret = TAPI_API_SUCCESS;
 
        if (pCbOpt->bReceive == true)
-               cbEnabled = 2;// Need to get a Enumeration from TAPI, currently it is not available
+               cbEnabled = 2;/* Need to get a Enumeration from TAPI, currently it is not available */
 
        MSG_DEBUG("simIndex:%d, cbEnabled:%d", pCbOpt->simIndex, cbEnabled);
 
@@ -888,7 +875,7 @@ bool SmsPluginSetting::setCbConfig(const MSG_CBMSG_OPT_S *pCbOpt)
                        err = MsgStoAddCBChannelInfo(dbHandle, const_cast<MSG_CB_CHANNEL_S*>(&pCbOpt->channelData),i);
                        if (err != MSG_SUCCESS) {
                                MSG_DEBUG("MsgStoAddCBChannelInfo is failed [%d]", err);
-                               return MSG_ERR_SET_SETTING;
+                               return false;
                        }
                }
 
@@ -975,7 +962,7 @@ void SmsPluginSetting::setVoiceMailInfo(const MSG_VOICEMAIL_OPT_S *pVoiceOpt)
        MutexLocker lock(mx);
 
        int ret = TAPI_API_SUCCESS;
-       bool *bShowError = NULL; //When invalid voicemail data exists on SIM, update error should not be handled.
+       bool *bShowError = NULL; /* When invalid voicemail data exists on SIM, update error should not be handled. */
 
        int simIndex = pVoiceOpt->simIndex;
 
@@ -1037,7 +1024,7 @@ void SmsPluginSetting::setVoiceMailInfo(const MSG_VOICEMAIL_OPT_S *pVoiceOpt)
                }
 
                /* if strlen of voicemail number retrieved from SIM is zero, error is not shown */
-               if(simMailboxList[simIndex].list[i].num_len == 0) {
+               if (simMailboxList[simIndex].list[i].num_len == 0) {
                        MSG_DEBUG("In SIM voicemail does not exist");
                        *bShowError = false;
                }
@@ -1082,13 +1069,13 @@ void SmsPluginSetting::setVoiceMailInfo(const MSG_VOICEMAIL_OPT_S *pVoiceOpt)
        if (getResultFromSim() == true) {
                MSG_DEBUG("######## Set mailbox info Success !!! #######");
        } else {
-               if(bShowError)
+               if (bShowError)
                        free(bShowError);
                THROW(MsgException::SMS_PLG_ERROR, "########  Set mailbox info Failed !!!#######");
                MSG_ERR("######## Set mailbox info Failed !!! #######");
        }
 
-       if(bShowError)
+       if (bShowError)
                free(bShowError);
 
        return;
@@ -1178,13 +1165,13 @@ void SmsPluginSetting::setMwiInfo(int simIndex, MSG_SUB_TYPE_T type, int count)
        MSG_DEBUG("SET MWI INFO, CPHS? [%s]", simMwiInfo[simIndex].b_cphs?"Yes":"No");
 
        if (simMwiInfo[simIndex].b_cphs) {
-               if (type == MSG_MWI_VOICE_SMS)
+               if (type == MSG_MWI_VOICE_SMS) {
                        simMwiInfo[simIndex].cphs_mwi.b_voice1 = (count > 0 ? 1:0);
-               else if (type == MSG_MWI_VOICE2_SMS)
+               } else if (type == MSG_MWI_VOICE2_SMS) {
                        simMwiInfo[simIndex].cphs_mwi.b_voice2 = (count > 0 ? 1:0);
-               else if (type == MSG_MWI_FAX_SMS)
+               } else if (type == MSG_MWI_FAX_SMS) {
                        simMwiInfo[simIndex].cphs_mwi.b_fax = (count > 0 ? 1:0);
-               else {
+               else {
                        MSG_DEBUG("There is no type [%d] in CPHS.", type);
                        return;
                }
@@ -1206,7 +1193,7 @@ void SmsPluginSetting::setMwiInfo(int simIndex, MSG_SUB_TYPE_T type, int count)
                        simMwiInfo[simIndex].mwi_list.mw_info[0].fax_count = count;
                else if (type == MSG_MWI_EMAIL_SMS)
                        simMwiInfo[simIndex].mwi_list.mw_info[0].email_count = count;
-               else // MSG_MWI_OTHER_SMS
+               else /* MSG_MWI_OTHER_SMS */
                        simMwiInfo[simIndex].mwi_list.mw_info[0].other_count = count;
 
                mwReq.mw_data_u.mw.rec_index = simMwiInfo[simIndex].mwi_list.mw_info[0].rec_index;
@@ -1592,9 +1579,9 @@ void SmsPluginSetting::setMwiInfoEvent(struct tapi_handle *handle, SMS_SIM_MWI_I
                if (simMwiInfo[index].b_cphs == true) {
                        mwiCnt = simMwiInfo[index].cphs_mwi.b_voice1;
                } else {
-                       mwiCnt = simMwiInfo[index].mwi_list.mw_info[0].voice_count; // Normal case
+                       mwiCnt = simMwiInfo[index].mwi_list.mw_info[0].voice_count; /* Normal case */
                }
-               // TODO :: Add operation for voice mail of line 2
+               /* TODO :: Add operation for voice mail of line 2 */
 
                memset(keyName, 0x00, sizeof(keyName));
                snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_COUNT, index);
@@ -1675,7 +1662,7 @@ bool SmsPluginSetting::getResultFromSim()
 
        MSG_DEBUG("getResultFromSim() is called .");
 
-       //mx.lock(); //  Caller of this function MUST acquire the mutex before calling the TAPI API
+       //mx.lock(); /*  Caller of this function MUST acquire the mutex before calling the TAPI API */
 
        ret = cv.timedwait(mx.pMutex(), MAX_TAPI_SIM_API_TIMEOUT);
 
@@ -1694,28 +1681,27 @@ SMS_PID_T SmsPluginSetting::convertPid(MSG_SMS_PID_T pid)
 {
        SMS_PID_T retPid;
 
-       switch (pid)
-       {
-               case MSG_PID_TEXT :
-                       retPid = SMS_PID_NORMAL;
+       switch (pid) {
+       case MSG_PID_TEXT :
+               retPid = SMS_PID_NORMAL;
                break;
-               case MSG_PID_VOICE :
-                       retPid = SMS_PID_VOICE;
+       case MSG_PID_VOICE :
+               retPid = SMS_PID_VOICE;
                break;
-               case MSG_PID_FAX :
-                       retPid = SMS_PID_TELEX;
+       case MSG_PID_FAX :
+               retPid = SMS_PID_TELEX;
                break;
-               case MSG_PID_X400 :
-                       retPid = SMS_PID_x400;
+       case MSG_PID_X400 :
+               retPid = SMS_PID_x400;
                break;
-               case MSG_PID_ERMES :
-                       retPid = SMS_PID_ERMES;
+       case MSG_PID_ERMES :
+               retPid = SMS_PID_ERMES;
                break;
-               case MSG_PID_EMAIL :
-                       retPid = SMS_PID_EMAIL;
+       case MSG_PID_EMAIL :
+               retPid = SMS_PID_EMAIL;
                break;
-               default :
-                       retPid = SMS_PID_NORMAL;
+       default :
+               retPid = SMS_PID_NORMAL;
                break;
        }
 
@@ -1806,7 +1792,7 @@ void SmsPluginSetting::setSimChangeStatus(struct tapi_handle *handle, bool bInit
                                simStatus[simIndex] = MSG_SIM_STATUS_NORMAL;
                        }
 //                     tel_handle_list.push_back(handle);
-                       // Modified to call initSimInfo for SIM separately
+                       /* Modified to call initSimInfo for SIM separately */
                        MSG_DEBUG("calling initSimInfo");
                        if (pthread_create(&thd, NULL, &initSimInfo, handle) < 0) {
                                MSG_DEBUG("pthread_create() error");
index 4a73e7b..e7fcd34 100755 (executable)
@@ -41,7 +41,7 @@ SmsPluginSimMsg* SmsPluginSimMsg::pInstance = NULL;
 
 SmsPluginSimMsg::SmsPluginSimMsg()
 {
-       // Initialize member variables
+       /* Initialize member variables */
        simMsgId = 0;
        delSimMsgId = -1;
        usedCnt = 0;
@@ -79,7 +79,7 @@ void SmsPluginSimMsg::initSimMessage(struct tapi_handle *handle)
        int sim_idx = SmsPluginDSHandler::instance()->getSimIndex(handle);
 
        snprintf(keyName, sizeof(keyName), "%s/%d", SIM_USED_COUNT, sim_idx);
-       // Set SIM count of vconf to 0
+       /* Set SIM count of vconf to 0 */
        if (MsgSettingSetInt(keyName, 0) != MSG_SUCCESS) {
                MSG_DEBUG("Error to set config data [%s]", keyName);
        }
@@ -98,12 +98,11 @@ void SmsPluginSimMsg::initSimMessage(struct tapi_handle *handle)
        int simIdList[MAX_SIM_SMS_NUM];
        int unreadSimMsg = 0;
 
-       for (int i = 0; i < tmpMsgCnt.usedCount; i++)
-       {
+       for (int i = 0; i < tmpMsgCnt.usedCount; i++) {
                memset(&tmpMsgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S));
                memset(simIdList, 0, sizeof(int) * MAX_SIM_SMS_NUM);
 
-               // Get SIM Msg
+               /* Get SIM Msg */
                if (getSimMsg(handle, tmpMsgCnt.indexList[i], &tmpMsgInfo, simIdList) == false)
                        continue;
 
@@ -150,35 +149,32 @@ msg_error_t SmsPluginSimMsg::saveSimMessage(const MSG_MESSAGE_INFO_S *pMsgInfo,
        if (bSimSst == false)
                return MSG_ERR_STORE_RESTRICT;
 
-       // Reset Out Parameter
+       /* Reset Out Parameter */
        pSimIdList->count = 0;
 
        SMS_TPDU_S tpdu;
        memset(&tpdu, 0x00, sizeof(SMS_TPDU_S));
-       if(pMsgInfo->direction == MSG_DIRECTION_TYPE_MO)
-       {
+       if (pMsgInfo->direction == MSG_DIRECTION_TYPE_MO) {
                tpdu.tpduType = SMS_TPDU_SUBMIT;
                tpdu.data.submit.dcs.msgClass = SMS_MSG_CLASS_NONE;
                //SmsPluginTransport::instance()->setSmsSendOptions(&(tpdu.data.submit));
                tpdu.data.submit.vpf = SMS_VPF_NOT_PRESENT;
-       }
-       else
-       {
+               tpdu.data.submit.dcs.codingScheme = SMS_CHARSET_AUTO;
+       } else {
                tpdu.tpduType = SMS_TPDU_DELIVER;
                setSmsOptions(pMsgInfo, &(tpdu.data.deliver));
-               // Set TimeStamp
+               /* Set TimeStamp */
                convertTimeStamp(pMsgInfo, &(tpdu.data.deliver));
+               tpdu.data.deliver.dcs.codingScheme = SMS_CHARSET_AUTO;
        }
 
-       for(int i=0; i <pMsgInfo->nAddressCnt; ++i)
-       {
+       for (int i = 0; i <pMsgInfo->nAddressCnt; ++i) {
                SMS_SUBMIT_DATA_S submitData;
                memset(&submitData, 0x00, sizeof(SMS_SUBMIT_DATA_S));
                int bufLen = 0;
                char buf[MAX_TPDU_DATA_LEN];
 
-               if(pMsgInfo->direction == MSG_DIRECTION_TYPE_MO) // SUBMIT MSG
-               {
+               if (pMsgInfo->direction == MSG_DIRECTION_TYPE_MO) { /* SUBMIT MSG */
                        SmsPluginTransport::instance()->msgInfoToSubmitData(pMsgInfo, &submitData, &(tpdu.data.submit.dcs.codingScheme), i);
 
                        int addLen = strlen(submitData.destAddress.address);
@@ -194,7 +190,7 @@ msg_error_t SmsPluginSimMsg::saveSimMessage(const MSG_MESSAGE_INFO_S *pMsgInfo,
                                tpdu.data.submit.destAddress.address[MAX_ADDRESS_LEN] = '\0';
                        }
 
-               } else { // DELIVER MSG
+               } else { /* DELIVER MSG */
                        SmsPluginTransport::instance()->msgInfoToSubmitData(pMsgInfo, &submitData, &(tpdu.data.deliver.dcs.codingScheme), i);
 
                        int addLen = strlen(submitData.destAddress.address);
@@ -211,18 +207,16 @@ msg_error_t SmsPluginSimMsg::saveSimMessage(const MSG_MESSAGE_INFO_S *pMsgInfo,
                        }
                }
 
-               // Check sim message full.
-               if (checkSimMsgFull(pMsgInfo->sim_idx, submitData.segCount) == true)
-               {
+               /* Check sim message full. */
+               if (checkSimMsgFull(pMsgInfo->sim_idx, submitData.segCount) == true) {
                        MSG_DEBUG("SIM storage is full.");
                        MsgInsertTicker("Sim memory full. Delete some items", SMS_MESSAGE_SIM_MESSAGE_FULL, true, 0);
 
                        return MSG_ERR_SIM_STORAGE_FULL;
                }
 
-               if(submitData.segCount > 1)
-               {
-                       if(pMsgInfo->direction == MSG_DIRECTION_TYPE_MO){ // SUBMIT MSG
+               if (submitData.segCount > 1) {
+                       if (pMsgInfo->direction == MSG_DIRECTION_TYPE_MO){ /* SUBMIT MSG */
                                tpdu.data.submit.bHeaderInd = true;
                        } else {
                                tpdu.data.deliver.bHeaderInd = true;
@@ -230,9 +224,8 @@ msg_error_t SmsPluginSimMsg::saveSimMessage(const MSG_MESSAGE_INFO_S *pMsgInfo,
 
                }
 
-               for (unsigned int segCnt = 0; segCnt < submitData.segCount; segCnt++)
-               {
-                       if(pMsgInfo->direction == MSG_DIRECTION_TYPE_MO){
+               for (unsigned int segCnt = 0; segCnt < submitData.segCount; segCnt++) {
+                       if (pMsgInfo->direction == MSG_DIRECTION_TYPE_MO){
                                memcpy(&(tpdu.data.submit.userData), &(submitData.userData[segCnt]), sizeof(SMS_USERDATA_S));
                        } else {
                                memcpy(&(tpdu.data.deliver.userData), &(submitData.userData[segCnt]), sizeof(SMS_USERDATA_S));
@@ -240,26 +233,26 @@ msg_error_t SmsPluginSimMsg::saveSimMessage(const MSG_MESSAGE_INFO_S *pMsgInfo,
 
                        memset(buf, 0x00, sizeof(buf));
 
-                       // Encode SMS-DELIVER TPDU
+                       /* Encode SMS-DELIVER TPDU */
                        bufLen = SmsPluginTpduCodec::encodeTpdu(&tpdu, buf);
 
-                       // Make Telephony Structure
+                       /* Make Telephony Structure */
                        TelSmsData_t simSmsData;
                        memset((void*)&simSmsData, 0x00, sizeof(simSmsData));
 
-                       // Set TPDU data
+                       /* Set TPDU data */
                        memcpy((void*)simSmsData.SmsData.szData, buf, bufLen);
 
                        simSmsData.SmsData.szData[bufLen] = 0;
                        simSmsData.SmsData.MsgLength = bufLen;
                        simSmsData.SmsData.format = TAPI_NETTEXT_NETTYPE_3GPP;
 
-                       if(pMsgInfo->direction == MSG_DIRECTION_TYPE_MT) { // MT messages
+                       if (pMsgInfo->direction == MSG_DIRECTION_TYPE_MT) { /* MT messages */
                                if (pMsgInfo->bRead == true)
                                        simSmsData.MsgStatus = TAPI_NETTEXT_STATUS_READ;
                                else
                                        simSmsData.MsgStatus = TAPI_NETTEXT_STATUS_UNREAD;
-                       } else { // MO messages
+                       } else { /* MO messages */
                                if (pMsgInfo->networkStatus == MSG_NETWORK_SEND_SUCCESS)
                                        simSmsData.MsgStatus = TAPI_NETTEXT_STATUS_SENT;
                                else if (pMsgInfo->networkStatus == MSG_NETWORK_DELIVER_SUCCESS)
@@ -270,17 +263,14 @@ msg_error_t SmsPluginSimMsg::saveSimMessage(const MSG_MESSAGE_INFO_S *pMsgInfo,
                                        simSmsData.MsgStatus = TAPI_NETTEXT_STATUS_UNSENT;
                        }
 
-                       // Save SMS in SIM
+                       /* Save SMS in SIM */
                        int ret = 0;
 
                        ret = tel_write_sms_in_sim(handle, &simSmsData, TapiEventSaveSimMsg, NULL);
 
-                       if (ret == TAPI_API_SUCCESS)
-                       {
+                       if (ret == TAPI_API_SUCCESS) {
                                MSG_DEBUG("########  tel_write_sms_in_sim Success !!!#######");
-                       }
-                       else
-                       {
+                       } else {
                                MSG_DEBUG("########  tel_write_sms_in_sim Fail !!! return : [%d] #######", ret);
 
                                return MSG_ERR_PLUGIN_STORAGE;
@@ -294,8 +284,7 @@ msg_error_t SmsPluginSimMsg::saveSimMessage(const MSG_MESSAGE_INFO_S *pMsgInfo,
 
                        int usedCnt = 0;
 
-                       if (bResult == true)
-                       {
+                       if (bResult == true) {
                                MSG_DEBUG("########  Saving Msg was Successful !!! SIM ID : [%d] #######", SimId);
 
                                char keyName[MAX_VCONFKEY_NAME_LEN];
@@ -306,15 +295,11 @@ msg_error_t SmsPluginSimMsg::saveSimMessage(const MSG_MESSAGE_INFO_S *pMsgInfo,
                                usedCnt++;
 
                                if (MsgSettingSetInt(keyName, usedCnt) != MSG_SUCCESS)
-                               {
                                        MSG_DEBUG("Error to set config data [%s]", SIM_USED_COUNT);
-                               }
 
                                pSimIdList->simId[pSimIdList->count] = SimId;
                                pSimIdList->count++;
-                       }
-                       else
-                       {
+                       } else {
                                MSG_DEBUG("########  Saving Msg was Failed !!! SIM ID : [%d] #######", SimId);
 
                                return MSG_ERR_PLUGIN_STORAGE;
@@ -344,20 +329,19 @@ msg_error_t SmsPluginSimMsg::saveClass2Message(const MSG_MESSAGE_INFO_S *pMsgInf
                MSG_DEBUG("MsgSettingGetBool [%s] failed", keyName);
        /* No return, default value is true. */
 
-       if (bSimSst == false)
-       {
+       if (bSimSst == false) {
                SmsPluginTransport::instance()->sendDeliverReport(handle, MSG_SUCCESS);
                return MSG_SUCCESS;
        }
 
-       // Reset Flag
+       /* Reset Flag */
        SMS_TPDU_S tpdu;
 
        tpdu.tpduType = SMS_TPDU_DELIVER;
 
        convertTimeStamp(pMsgInfo, &(tpdu.data.deliver));
 
-       // Set SMS TPDU Options
+       /* Set SMS TPDU Options */
        setSmsOptions(pMsgInfo, &(tpdu.data.deliver));
 
        SMS_SUBMIT_DATA_S submitData;
@@ -373,11 +357,10 @@ msg_error_t SmsPluginSimMsg::saveClass2Message(const MSG_MESSAGE_INFO_S *pMsgInf
                        replaceMsgId = 0;
        }
 
-       // Check SIM ID
-       if (replaceSimId < 0) { // Normal message type
-               // Check sim message full.
-               if (checkSimMsgFull(pMsgInfo->sim_idx, submitData.segCount) == true)
-               {
+       /* Check SIM ID */
+       if (replaceSimId < 0) { /* Normal message type */
+               /* Check sim message full. */
+               if (checkSimMsgFull(pMsgInfo->sim_idx, submitData.segCount) == true) {
                        MSG_DEBUG("SIM storage is full.");
 
                        SmsPluginTransport::instance()->sendDeliverReport(handle, MSG_ERR_SIM_STORAGE_FULL);
@@ -400,14 +383,14 @@ msg_error_t SmsPluginSimMsg::saveClass2Message(const MSG_MESSAGE_INFO_S *pMsgInf
 
                if (submitData.segCount > 1)
                        tpdu.data.deliver.bHeaderInd = true;
-       } else { // Replace message type
+       } else { /* Replace message type */
                tapiRet = tel_delete_sms_in_sim(handle, replaceSimId, TapiEventDeleteSimMsg, NULL);
 
                if (tapiRet == TAPI_API_SUCCESS) {
                        MSG_DEBUG("########  tel_delete_sms_in_sim Success !!! #######");
 
                        simId = -1;
-                       if(getDelSimEvent(&simId) == true) {
+                       if (getDelSimEvent(&simId) == true) {
                                err = SmsPluginStorage::instance()->deleteSimMessage(pMsgInfo->sim_idx, replaceSimId);
                        }
                        MSG_DEBUG("tel_delete_sms_in_sim() : Err=[%d], Replace Sim Id=[%d], Result Sim id=[%d]", err, replaceSimId, simId);
@@ -418,7 +401,7 @@ msg_error_t SmsPluginSimMsg::saveClass2Message(const MSG_MESSAGE_INFO_S *pMsgInf
        }
 
        for (unsigned int segCnt = 0; segCnt < submitData.segCount; segCnt++) {
-               // Create TelSmsData_t data
+               /* Create TelSmsData_t data */
                TelSmsData_t simSmsData = {0,};
 
                if (submitData.segCount == 1) {
@@ -431,10 +414,10 @@ msg_error_t SmsPluginSimMsg::saveClass2Message(const MSG_MESSAGE_INFO_S *pMsgInf
 
                        memset(buf, 0x00, sizeof(buf));
 
-                       // Encode SMS-DELIVER TPDU
+                       /* Encode SMS-DELIVER TPDU */
                        bufLen = SmsPluginTpduCodec::encodeTpdu(&tpdu, buf);
 
-                       // Set TPDU data
+                       /* Set TPDU data */
                        memcpy((void*)simSmsData.SmsData.Sca, &simMsgDataInfo.sca, sizeof(simSmsData.SmsData.Sca));
                        memcpy((void*)simSmsData.SmsData.szData, buf, bufLen);
                        simSmsData.SmsData.szData[bufLen] = 0;
@@ -483,13 +466,9 @@ void SmsPluginSimMsg::deleteSimMessage(msg_sim_slot_id_t sim_idx, msg_sim_id_t S
        tapiRet = tel_delete_sms_in_sim(handle, (int)SimMsgId, TapiEventDeleteSimMsg, NULL);
 
        if (tapiRet == TAPI_API_SUCCESS)
-       {
                MSG_DEBUG("########  tel_delete_sms_in_sim Success !!! #######");
-       }
        else
-       {
                THROW(MsgException::SMS_PLG_ERROR, "########  tel_delete_sms_in_sim Fail !!! return : [%d] #######", tapiRet);
-       }
 
        int SimId = 0;
        bool bResult = false;
@@ -498,8 +477,7 @@ void SmsPluginSimMsg::deleteSimMessage(msg_sim_slot_id_t sim_idx, msg_sim_id_t S
 
        int usedCnt = 0, totalCnt = 0;
 
-       if (bResult == true)
-       {
+       if (bResult == true) {
                MSG_DEBUG("########  Deleting Msg was Successful !!! SIM ID : [%d] #######", SimId);
                char keyName[MAX_VCONFKEY_NAME_LEN];
                memset(keyName, 0x00, sizeof(keyName));
@@ -509,18 +487,13 @@ void SmsPluginSimMsg::deleteSimMessage(msg_sim_slot_id_t sim_idx, msg_sim_id_t S
                snprintf(keyName, sizeof(keyName), "%s/%d", SIM_TOTAL_COUNT, sim_idx);
                totalCnt = MsgSettingGetInt(keyName);
 
-               if (usedCnt == totalCnt)
-               {
+               if (usedCnt == totalCnt) {
                        tapiRet = tel_set_sms_memory_status(handle, TAPI_NETTEXT_PDA_MEMORY_STATUS_AVAILABLE, NULL, NULL);
 
                        if (tapiRet == TAPI_API_SUCCESS)
-                       {
                                MSG_DEBUG("########  tel_set_sms_memory_status() Success !!! #######");
-                       }
                        else
-                       {
                                MSG_DEBUG("########  tel_set_sms_memory_status() Success !!! return : [%d] #######", tapiRet);
-                       }
                }
 
                usedCnt--;
@@ -529,12 +502,8 @@ void SmsPluginSimMsg::deleteSimMessage(msg_sim_slot_id_t sim_idx, msg_sim_id_t S
                snprintf(keyName, sizeof(keyName), "%s/%d", SIM_USED_COUNT, sim_idx);
 
                if (MsgSettingSetInt(keyName, usedCnt) != MSG_SUCCESS)
-               {
                        MSG_DEBUG("Error to set config data [%s]", keyName);
-               }
-       }
-       else
-       {
+       } else {
                THROW(MsgException::SMS_PLG_ERROR, "########  Deleting Msg was Failed !!! SIM ID : [%d] #######", SimId);
        }
 }
@@ -572,13 +541,9 @@ void SmsPluginSimMsg::setReadStatus(msg_sim_slot_id_t sim_idx, msg_sim_id_t SimM
        ret = tel_set_sms_message_status(handle, (int)SimMsgId, TAPI_NETTEXT_STATUS_READ, TapiEventSetMsgStatus, (void *)&SimMsgId);
 
        if (ret == TAPI_API_SUCCESS)
-       {
                MSG_DEBUG("########  tel_set_sms_message_status Success !!! return : %d #######", ret);
-       }
        else
-       {
                THROW(MsgException::SMS_PLG_ERROR, "########  tel_set_sms_message_status Fail !!! return : %d #######", ret);
-       }
 
        msg_sim_id_t SimId = 0;
        bool bResult = false;
@@ -586,13 +551,9 @@ void SmsPluginSimMsg::setReadStatus(msg_sim_slot_id_t sim_idx, msg_sim_id_t SimM
        bResult = getSimEvent(&SimId);
 
        if (bResult == true)
-       {
                MSG_DEBUG("######## Setting Read Status was Successful !!!, sim id=[%d] #######", SimId);
-       }
        else
-       {
                THROW(MsgException::SMS_PLG_ERROR, "######## Setting Read Status was Failed !!! #######");
-       }
 }
 
 
@@ -603,22 +564,14 @@ void SmsPluginSimMsg::getSimMsgCount(struct tapi_handle *handle, MSG_SIM_COUNT_S
        ret = tel_get_sms_count(handle, TapiEventGetSimMsgCnt, NULL);
 
        if (ret == TAPI_API_SUCCESS)
-       {
                MSG_DEBUG("######## tel_get_sms_count() Success !!! #######");
-       }
        else
-       {
                THROW(MsgException::SMS_PLG_ERROR, "########  tel_get_sms_count() Fail !!! return : %d #######", ret);
-       }
 
        if (getSimMsgCntEvent(handle, pSimMsgCnt) == true)
-       {
                MSG_DEBUG("######## Get Sim Msg Count was Successful !!! #######");
-       }
        else
-       {
                THROW(MsgException::SMS_PLG_ERROR, "######## Get Sim Msg Count was Failed !!! #######");
-       }
 }
 
 
@@ -628,22 +581,16 @@ bool SmsPluginSimMsg::getSimMsg(struct tapi_handle *handle, msg_sim_id_t SimMsgI
 
        ret = tel_read_sms_in_sim(handle, SimMsgId, TapiEventGetSimMsg, simIdList);
 
-       if (ret == TAPI_API_SUCCESS)
-       {
+       if (ret == TAPI_API_SUCCESS) {
                MSG_DEBUG("######## tel_read_sms_in_sim() Success !!! Sim ID : [%d] #######", SimMsgId);
-       }
-       else
-       {
+       } else {
                MSG_DEBUG("########  tel_read_sms_in_sim() Fail !!! return : %d #######", ret);
                return false;
        }
 
-       if (getSimMsgEvent(handle, pMsgInfo) == true)
-       {
+       if (getSimMsgEvent(handle, pMsgInfo) == true) {
                MSG_DEBUG("######## Get Sim Msg was Successful !!! #######");
-       }
-       else
-       {
+       } else {
                MSG_DEBUG("######## Get Sim Msg was Failed !!! #######");
                return false;
        }
@@ -679,10 +626,10 @@ void SmsPluginSimMsg::convertTimeStamp(const MSG_MESSAGE_INFO_S* pMsgInfo, SMS_D
 {
        MSG_BEGIN();
 
-       // encode time stamp
+       /* encode time stamp */
        pDeliver->timeStamp.format = SMS_TIME_ABSOLUTE;
 
-       // encode absolute time
+       /* encode absolute time */
        struct tm timeinfo = {0,};
        tzset();
        localtime_r(&pMsgInfo->displayTime, &timeinfo);
@@ -721,23 +668,18 @@ void SmsPluginSimMsg::setSimMsgCntEvent(struct tapi_handle *handle, const MSG_SI
        int sim_idx = SmsPluginDSHandler::instance()->getSimIndex(handle);
        char keyName[MAX_VCONFKEY_NAME_LEN]= {0,};
 
-       for (int i=0; i < pSimMsgCnt->usedCount; i++)
-       {
+       for (int i = 0; i < pSimMsgCnt->usedCount; i++) {
                MSG_DEBUG("Sim Message Index is %d.", pSimMsgCnt->indexList[i]);
        }
 
        snprintf(keyName, sizeof(keyName), "%s/%d", SIM_USED_COUNT, sim_idx);
        if (MsgSettingSetInt(keyName, pSimMsgCnt->usedCount) != MSG_SUCCESS)
-       {
                MSG_DEBUG("Error to set config data [%s]", SIM_USED_COUNT);
-       }
 
        memset(keyName, 0, sizeof(keyName));
        snprintf(keyName, sizeof(keyName), "%s/%d", SIM_TOTAL_COUNT, sim_idx);
        if (MsgSettingSetInt(keyName, (int)pSimMsgCnt->totalCount) != MSG_SUCCESS)
-       {
                MSG_DEBUG("Error to set config data [%s]", SIM_TOTAL_COUNT);
-       }
 
        memset(&simMsgCnt, 0x00, sizeof(MSG_SIM_COUNT_S));
        memcpy(&simMsgCnt, pSimMsgCnt, sizeof(MSG_SIM_COUNT_S));
@@ -758,8 +700,7 @@ bool SmsPluginSimMsg::getSimMsgCntEvent(struct tapi_handle *handle, MSG_SIM_COUN
 
        mx.unlock();
 
-       if (ret == ETIMEDOUT)
-       {
+       if (ret == ETIMEDOUT) {
                MSG_DEBUG("WARNING: TAPI callback TIME-OUT");
                return false;
        }
@@ -778,8 +719,7 @@ void SmsPluginSimMsg::setSimMsgEvent(struct tapi_handle *handle, const MSG_MESSA
        memset(&simMsgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S));
        memset(&simAddrInfo, 0x00, sizeof(MSG_ADDRESS_INFO_S));
 
-       if (bTapiResult  == true)
-       {
+       if (bTapiResult  == true) {
                MSG_DEBUG("Success to get sim msg - Id : [%d]", pMsgInfo->msgId);
 
                memcpy(&simMsgInfo, pMsgInfo, sizeof(MSG_MESSAGE_INFO_S));
@@ -804,16 +744,14 @@ bool SmsPluginSimMsg::getSimMsgEvent(struct tapi_handle *handle, MSG_MESSAGE_INF
 
        mx.unlock();
 
-       if (ret == ETIMEDOUT)
-       {
+       if (ret == ETIMEDOUT) {
                MSG_DEBUG("WARNING: TAPI callback TIME-OUT");
                return false;
        }
 
        memset(pMsgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S));
 
-       if (bTapiResult == true)
-       {
+       if (bTapiResult == true) {
                memcpy(pMsgInfo, &simMsgInfo, sizeof(MSG_MESSAGE_INFO_S));
                pMsgInfo->addressList = (MSG_ADDRESS_INFO_S *)calloc(1, sizeof(MSG_ADDRESS_INFO_S));
                memset(pMsgInfo->addressList, 0x00, sizeof(MSG_ADDRESS_INFO_S));
@@ -905,9 +843,7 @@ void SmsPluginSimMsg::setSaveClass2MsgEvent(struct tapi_handle *handle, int simI
                        err = SmsPluginEventHandler::instance()->callbackMsgIncoming(pMsgInfo);
 
                        if (err != MSG_SUCCESS)
-                       {
                                MSG_DEBUG("callbackMsgIncoming() Error !! [%d]", err);
-                       }
                }
 
                if (isNewSimMsg == true) {
@@ -918,9 +854,7 @@ void SmsPluginSimMsg::setSaveClass2MsgEvent(struct tapi_handle *handle, int simI
                        usedCnt++;
 
                        if (MsgSettingSetInt(keyName, usedCnt) != MSG_SUCCESS)
-                       {
                                MSG_DEBUG("Error to set config data [%s]", SIM_USED_COUNT);
-                       }
                }
 
                if (simMsgDataInfo.totalSegment >= 1 && simIdList[simMsgDataInfo.totalSegment-1] != 0) {
@@ -933,7 +867,7 @@ void SmsPluginSimMsg::setSaveClass2MsgEvent(struct tapi_handle *handle, int simI
                        err = MSG_ERR_UNKNOWN;
        }
 
-       // Send Deliver Report
+       /* Send Deliver Report */
        SmsPluginTransport::instance()->sendDeliverReport(handle, err);
 }
 
@@ -962,8 +896,7 @@ bool SmsPluginSimMsg::getSimEvent(msg_sim_id_t *pSimId)
 
        mx.unlock();
 
-       if (ret == ETIMEDOUT)
-       {
+       if (ret == ETIMEDOUT) {
                MSG_DEBUG("WARNING: TAPI callback TIME-OUT");
                return false;
        }
@@ -1001,8 +934,7 @@ bool SmsPluginSimMsg::getDelSimEvent(int *pSimId)
 
        mx.unlock();
 
-       if (ret == ETIMEDOUT)
-       {
+       if (ret == ETIMEDOUT) {
                MSG_DEBUG("WARNING: TAPI callback TIME-OUT");
                return false;
        }
index 2b51956..e69ad12 100755 (executable)
@@ -159,7 +159,7 @@ msg_error_t SmsPluginStorage::updateMsgDeliverStatus(MSG_MESSAGE_INFO_S *pMsgInf
                        MSG_DEBUG("Query Failed : [%s]", sqlQuery);
                        return MSG_ERR_DB_EXEC;
                }
-       } else if(pMsgInfo->networkStatus == MSG_NETWORK_DELIVER_EXPIRED) {
+       } else if (pMsgInfo->networkStatus == MSG_NETWORK_DELIVER_EXPIRED) {
                memset(sqlQuery, 0x00, sizeof(sqlQuery));
                snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET MSG_REF = -1, STATUS = %d, TIME = %d WHERE MSG_ID = %d and ADDRESS_VAL = '%s';",
                                MSGFW_SMS_REPORT_TABLE_NAME, 0, (int)pMsgInfo->displayTime, msgId, normalNum);
@@ -169,7 +169,7 @@ msg_error_t SmsPluginStorage::updateMsgDeliverStatus(MSG_MESSAGE_INFO_S *pMsgInf
                        MSG_DEBUG("Query Failed : [%s]", sqlQuery);
                        return MSG_ERR_DB_EXEC;
                }
-       } else if(pMsgInfo->networkStatus == MSG_NETWORK_DELIVER_PENDING) {
+       } else if (pMsgInfo->networkStatus == MSG_NETWORK_DELIVER_PENDING) {
                memset(sqlQuery, 0x00, sizeof(sqlQuery));
                snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET MSG_REF = -1, STATUS = %d, TIME = %d WHERE MSG_ID = %d and ADDRESS_VAL = '%s';",
                                MSGFW_SMS_REPORT_TABLE_NAME, 3, (int)pMsgInfo->displayTime, msgId, normalNum);
@@ -179,7 +179,7 @@ msg_error_t SmsPluginStorage::updateMsgDeliverStatus(MSG_MESSAGE_INFO_S *pMsgInf
                        MSG_DEBUG("Query Failed : [%s]", sqlQuery);
                        return MSG_ERR_DB_EXEC;
                }
-       } else if(pMsgInfo->networkStatus == MSG_NETWORK_DELIVER_FAIL) {
+       } else if (pMsgInfo->networkStatus == MSG_NETWORK_DELIVER_FAIL) {
                memset(sqlQuery, 0x00, sizeof(sqlQuery));
                snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET MSG_REF = -1, STATUS = %d, TIME = %d WHERE MSG_ID = %d and ADDRESS_VAL = '%s';",
                                MSGFW_SMS_REPORT_TABLE_NAME, 8, (int)pMsgInfo->displayTime, msgId, normalNum);
@@ -331,63 +331,10 @@ msg_error_t SmsPluginStorage::addSimMessage(MSG_MESSAGE_INFO_S *pSimMsgInfo, int
 
        char sqlQuery[MAX_QUERY_LEN+1];
 
-//     dbHandle->beginTrans();
-
-# if 0
-       msg_message_id_t msgId = 0;
-       msg_thread_id_t convId = 0;
-
-       err = MsgStoAddAddress(dbHandle, pSimMsgInfo, &convId);
-
-       if (err != MSG_SUCCESS) {
-               dbHandle->endTrans(false);
-               return err;
-       }
-
-       pSimMsgInfo->threadId = convId;
-
-       err = dbHandle->getRowId(MSGFW_MESSAGE_TABLE_NAME, &msgId);
-
-       if (err != MSG_SUCCESS) {
-               dbHandle->endTrans(false);
-               return err;
-       }
-
-       //simId = pSimMsgInfo->msgId;
-       pSimMsgInfo->msgId = msgId;
-
-       /**  Add Message */
-       memset(sqlQuery, 0x00, sizeof(sqlQuery));
-
-       snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d, %d, %d, %ld, %d, %d, %d, %d, %d, %d, %ld, %d, ?, '', '', ?, 0, 0, 0);",
-                       MSGFW_MESSAGE_TABLE_NAME, msgId, convId, pSimMsgInfo->folderId, pSimMsgInfo->storageId,
-                       pSimMsgInfo->msgType.mainType, pSimMsgInfo->msgType.subType, pSimMsgInfo->displayTime, pSimMsgInfo->dataSize,
-                       pSimMsgInfo->networkStatus, pSimMsgInfo->bRead, pSimMsgInfo->bProtected, pSimMsgInfo->priority,
-                       pSimMsgInfo->direction, 0, pSimMsgInfo->bBackup);
-
-       MSG_DEBUG("QUERY : %s", sqlQuery);
-
-       if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) {
-               dbHandle->endTrans(false);
-               return MSG_ERR_DB_PREPARE;
-       }
-
-       dbHandle->bindText(pSimMsgInfo->subject, 1);
-
-       dbHandle->bindText(pSimMsgInfo->msgText, 2);
-
-       if (dbHandle->stepQuery() != MSG_ERR_DB_DONE) {
-               dbHandle->endTrans(false);
-               return MSG_ERR_DB_STEP;
-       }
-
-       dbHandle->finalizeQuery();
-#endif
-       if(simIdList) {
+       if (simIdList) {
                MSG_DEBUG("simIdList exist.");
-               for(int i=0; i < MAX_SIM_SMS_NUM; ++i)
-               {
-                       if(simIdList[i]) {
+               for (int i = 0; i < MAX_SIM_SMS_NUM; ++i) {
+                       if (simIdList[i]) {
                                simId = simIdList[i] - 1;
                                memset(sqlQuery, 0x00, sizeof(sqlQuery));
                                snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d);",
@@ -396,18 +343,15 @@ msg_error_t SmsPluginStorage::addSimMessage(MSG_MESSAGE_INFO_S *pSimMsgInfo, int
                                MSG_DEBUG("QUERY : %s", sqlQuery);
 
                                if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
-//                                     dbHandle->endTrans(false);
                                        return MSG_ERR_DB_EXEC;
                                }
-                       } else
+                       } else {
                                break;
+                       }
                }
        }
 
-//     dbHandle->endTrans(true);
-
        return err;
-
 }
 
 
@@ -473,7 +417,7 @@ msg_error_t SmsPluginStorage::checkMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
                        pMsgInfo->folderId = 0;
                        err = MSG_SUCCESS;
                }
-               else if(pMsgInfo->msgType.classType == MSG_CLASS_2 &&
+               else if (pMsgInfo->msgType.classType == MSG_CLASS_2 &&
                                (pMsgInfo->msgType.subType == MSG_NORMAL_SMS || pMsgInfo->msgType.subType == MSG_REJECT_SMS)) {
                        err = addClass2Message(pMsgInfo);
                }
@@ -707,7 +651,7 @@ msg_error_t SmsPluginStorage::deleteSmsMessage(msg_message_id_t msgId)
                }
        }
 
-       MsgRefreshAllNotification(true, false, false);
+       MsgRefreshAllNotification(true, false, MSG_ACTIVE_NOTI_TYPE_NONE);
 
        return MSG_SUCCESS;
 }
@@ -725,12 +669,9 @@ msg_error_t SmsPluginStorage::addClass2Message(MSG_MESSAGE_INFO_S *pMsgInfo)
        memcpy(&addrInfo, pMsgInfo->addressList, sizeof(MSG_ADDRESS_INFO_S));
        msgInfo.addressList = &addrInfo;
 
-       if(pthread_create(&thd, NULL, &class2_thread, (void *)&msgInfo) < 0)
-       {
+       if (pthread_create(&thd, NULL, &class2_thread, (void *)&msgInfo) < 0)
                MSG_DEBUG("pthread_create() error");
 
-       }
-       //pthread_join(thd, (void **)&err);
        pthread_detach(thd);
 
 #if 0
@@ -850,29 +791,23 @@ msg_error_t SmsPluginStorage::addSmsSendOption(MSG_MESSAGE_INFO_S *pMsg, MSG_SEN
        if (pSendOptInfo->bSetting == false) {
                MsgSettingGetBool(SMS_SEND_DELIVERY_REPORT, &pSendOptInfo->bDeliverReq);
                MsgSettingGetBool(SMS_SEND_REPLY_PATH, &pSendOptInfo->option.smsSendOptInfo.bReplyPath);
-
-//             if (pSendOptInfo->bDeliverReq || pSendOptInfo->option.smsSendOptInfo.bReplyPath) {
-//                     pSendOptInfo->bSetting = true;
-                       MsgSettingGetBool(MSG_KEEP_COPY, &pSendOptInfo->bKeepCopy);
-//             }
+               MsgSettingGetBool(MSG_KEEP_COPY, &pSendOptInfo->bKeepCopy);
        }
 
-//     if (pSendOptInfo->bSetting == true) {
-               MsgDbHandler *dbHandle = getDbHandle();
+       MsgDbHandler *dbHandle = getDbHandle();
 
-               char sqlQuery[MAX_QUERY_LEN+1];
+       char sqlQuery[MAX_QUERY_LEN+1];
 
-               memset(sqlQuery, 0x00, sizeof(sqlQuery));
-               snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d, %d);",
-                               MSGFW_SMS_SENDOPT_TABLE_NAME, pMsg->msgId, pSendOptInfo->bDeliverReq,
-                               pSendOptInfo->bKeepCopy, pSendOptInfo->option.smsSendOptInfo.bReplyPath, pMsg->encodeType);
+       memset(sqlQuery, 0x00, sizeof(sqlQuery));
+       snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d, %d);",
+                       MSGFW_SMS_SENDOPT_TABLE_NAME, pMsg->msgId, pSendOptInfo->bDeliverReq,
+                       pSendOptInfo->bKeepCopy, pSendOptInfo->option.smsSendOptInfo.bReplyPath, pMsg->encodeType);
 
-               MSG_DEBUG("Query = [%s]", sqlQuery);
+       MSG_DEBUG("Query = [%s]", sqlQuery);
 
-               if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
-                       err = MSG_ERR_DB_EXEC;
-               }
-//     }
+       if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
+               err = MSG_ERR_DB_EXEC;
+       }
 
        MSG_END();
 
@@ -991,13 +926,13 @@ msg_error_t SmsPluginStorage::getRegisteredPushEvent(char* pPushHeader, int *cou
        err = dbHandle->getTable(sqlQuery, &rowCnt, &index);
        MSG_DEBUG("rowCnt: %d", rowCnt);
 
-       if (err == MSG_ERR_DB_NORECORD) {
-               dbHandle->freeTable();
-               return MSG_SUCCESS;
-       }
-       else if ( err != MSG_SUCCESS) {
+       if (err != MSG_SUCCESS) {
                dbHandle->freeTable();
-               return err;
+
+               if (err == MSG_ERR_DB_NORECORD)
+                       return MSG_SUCCESS;
+               else
+                       return err;
        }
 
        char contentType[MAX_WAPPUSH_CONTENT_TYPE_LEN + 1] = {0,};
@@ -1018,12 +953,12 @@ msg_error_t SmsPluginStorage::getRegisteredPushEvent(char* pPushHeader, int *cou
 
                //MSG_DEBUG("content_type: %s, app_id: %s", content_type, app_id);
                _content_type = strcasestr(pPushHeader, contentType);
-               if(_content_type) {
+               if (_content_type) {
                        _app_id = strcasestr(pPushHeader, appId);
-                       if(appcode)
+                       if (appcode)
                                default_appcode = appcode;
 
-                       if(_app_id) {
+                       if (_app_id) {
                                PUSH_APPLICATION_INFO_S pInfo = {0, };
                                pInfo.appcode = appcode;
                                MSG_SEC_DEBUG("appcode: %d, app_id: %s", pInfo.appcode, appId);
@@ -1036,9 +971,8 @@ msg_error_t SmsPluginStorage::getRegisteredPushEvent(char* pPushHeader, int *cou
                }
        }
 
-       if(!found && default_appcode != SMS_WAP_APPLICATION_LBS)
-       {
-               // perform default action.
+       if (!found && default_appcode != SMS_WAP_APPLICATION_LBS) {
+               /* perform default action. */
                PUSH_APPLICATION_INFO_S pInfo = {0, };
                pInfo.appcode = default_appcode;
                memset(appId, 0, MAX_WAPPUSH_ID_LEN + 1);
@@ -1056,14 +990,13 @@ msg_error_t SmsPluginStorage::getRegisteredPushEvent(char* pPushHeader, int *cou
 msg_error_t SmsPluginStorage::getnthPushEvent(int index, int *appcode)
 {
        msg_error_t err = MSG_SUCCESS;
-       if((unsigned int)index > pushAppInfoList.size() - 1)
+       if ((unsigned int)index > pushAppInfoList.size() - 1)
                return MSG_ERR_INVALID_PARAMETER;
 
        std::list<PUSH_APPLICATION_INFO_S>::iterator it = pushAppInfoList.begin();
        int count = 0;
-       for (; it != pushAppInfoList.end(); it++)
-       {
-               if(index == count){
+       for (; it != pushAppInfoList.end(); it++) {
+               if (index == count){
                        *appcode = it->appcode;
                        break;
                }
index 789f14b..50e1abe 100755 (executable)
@@ -48,22 +48,21 @@ int SmsPluginTpduCodec::encodeTpdu(const SMS_TPDU_S *pSmsTpdu, char *pTpdu)
 {
        int tpduLen = 0;
 
-       switch (pSmsTpdu->tpduType)
-       {
-               case SMS_TPDU_SUBMIT:
-                       tpduLen = encodeSubmit(&(pSmsTpdu->data.submit), pTpdu);
+       switch (pSmsTpdu->tpduType) {
+       case SMS_TPDU_SUBMIT:
+               tpduLen = encodeSubmit(&(pSmsTpdu->data.submit), pTpdu);
                break;
 
-               case SMS_TPDU_DELIVER:
-                       tpduLen = encodeDeliver(&(pSmsTpdu->data.deliver), pTpdu);
+       case SMS_TPDU_DELIVER:
+               tpduLen = encodeDeliver(&(pSmsTpdu->data.deliver), pTpdu);
                break;
 
-               case SMS_TPDU_DELIVER_REP:
-                       tpduLen = encodeDeliverReport(&(pSmsTpdu->data.deliverRep), pTpdu);
+       case SMS_TPDU_DELIVER_REP:
+               tpduLen = encodeDeliverReport(&(pSmsTpdu->data.deliverRep), pTpdu);
                break;
 
-               case SMS_TPDU_STATUS_REP:
-                       tpduLen = encodeStatusReport(&(pSmsTpdu->data.statusRep), pTpdu);
+       case SMS_TPDU_STATUS_REP:
+               tpduLen = encodeStatusReport(&(pSmsTpdu->data.statusRep), pTpdu);
                break;
        }
 
@@ -77,21 +76,20 @@ int SmsPluginTpduCodec::decodeTpdu(const unsigned char *pTpdu, int TpduLen, SMS_
 
        char mti = pTpdu[0] & 0x03;
 
-       switch (mti)
-       {
-               case 0x00:
-                       pSmsTpdu->tpduType = SMS_TPDU_DELIVER;
-                       decodeLen = decodeDeliver(pTpdu, TpduLen, &(pSmsTpdu->data.deliver));
+       switch (mti) {
+       case 0x00:
+               pSmsTpdu->tpduType = SMS_TPDU_DELIVER;
+               decodeLen = decodeDeliver(pTpdu, TpduLen, &(pSmsTpdu->data.deliver));
                break;
 
-               case 0x01:
-                       pSmsTpdu->tpduType = SMS_TPDU_SUBMIT;
-                       decodeLen = decodeSubmit(pTpdu, TpduLen, &(pSmsTpdu->data.submit));
+       case 0x01:
+               pSmsTpdu->tpduType = SMS_TPDU_SUBMIT;
+               decodeLen = decodeSubmit(pTpdu, TpduLen, &(pSmsTpdu->data.submit));
                break;
 
-               case 0x02:
-                       pSmsTpdu->tpduType = SMS_TPDU_STATUS_REP;
-                       decodeLen = decodeStatusReport(pTpdu, TpduLen, &(pSmsTpdu->data.statusRep));
+       case 0x02:
+               pSmsTpdu->tpduType = SMS_TPDU_STATUS_REP;
+               decodeLen = decodeStatusReport(pTpdu, TpduLen, &(pSmsTpdu->data.statusRep));
                break;
        }
 
@@ -112,78 +110,75 @@ int SmsPluginTpduCodec::encodeSubmit(const SMS_SUBMIT_S *pSubmit, char *pTpdu)
        char* vpTime = NULL;
        unique_ptr<char*, void(*)(char**)> vpBuf(&vpTime, unique_ptr_deleter);
 
-       //TP-MTI
+       /* TP-MTI */
        pTpdu[offset] = 0x01;
 
-       //TP-RD
-       if(pSubmit->bRejectDup == true)
+       /* TP-RD */
+       if (pSubmit->bRejectDup == true)
                pTpdu[offset] |= 0x04;
 
-       //TP-VPF
-       switch (pSubmit->vpf)
-       {
-               case SMS_VPF_NOT_PRESENT:
-                       break;
-               case SMS_VPF_ENHANCED:
-                       pTpdu[offset] |= 0x08;
-                       break;
-               case SMS_VPF_RELATIVE:
-                       pTpdu[offset] |= 0x10;
-                       break;
-               case SMS_VPF_ABSOLUTE:
-                       pTpdu[offset] |= 0x18;
-                       break;
-               default:
-                       break;
+       /* TP-VPF */
+       switch (pSubmit->vpf) {
+       case SMS_VPF_NOT_PRESENT:
+               break;
+       case SMS_VPF_ENHANCED:
+               pTpdu[offset] |= 0x08;
+               break;
+       case SMS_VPF_RELATIVE:
+               pTpdu[offset] |= 0x10;
+               break;
+       case SMS_VPF_ABSOLUTE:
+               pTpdu[offset] |= 0x18;
+               break;
+       default:
+               break;
        }
 
-       //TP-SRR
+       /* TP-SRR */
        if (pSubmit->bStatusReport == true)
                pTpdu[offset] |= 0x20;
 
        MSG_DEBUG("TP-SRR pSubmit->bStatusReport : %d.", pSubmit->bStatusReport);
 
-       //TP-UDHI
+       /* TP-UDHI */
        if (pSubmit->bHeaderInd == true)
                pTpdu[offset] |= 0x40;
 
-       //TP-RP
+       /* TP-RP */
        if (pSubmit->bReplyPath == true)
                pTpdu[offset] |= 0x80;
 
        offset++;
 
-       //TP-MR
+       /* TP-MR */
        pTpdu[offset++] = pSubmit->msgRef;
 
        MSG_DEBUG("TP-MR pSubmit->msgRef : %d.", pSubmit->msgRef);
 
-       //TP-DA
+       /* TP-DA */
        length = SmsPluginParamCodec::encodeAddress(&pSubmit->destAddress, &address);
        memcpy(&(pTpdu[offset]), address, length);
        offset += length;
 
        MSG_DEBUG("TP-DA length : %d.", length);
 
-       //TP-PID
+       /* TP-PID */
        pTpdu[offset++] = pSubmit->pid;
 
        MSG_DEBUG("TP-PID pSubmit->pid : %d.", pSubmit->pid);
 
-       //TP-DCS
+       /* TP-DCS */
        length = SmsPluginParamCodec::encodeDCS(&pSubmit->dcs, &dcs);
        memcpy(&(pTpdu[offset]), dcs, length);
        offset += length;
 
        MSG_DEBUG("TP-DCS length : %d.", length);
 
-       //TP-VP
-       if (pSubmit->vpf != SMS_VPF_NOT_PRESENT)
-       {
+       /* TP-VP */
+       if (pSubmit->vpf != SMS_VPF_NOT_PRESENT) {
                length = SmsPluginParamCodec::encodeTime(&pSubmit->validityPeriod, &vpTime);
 
-               if (length > 0)
-               {
+               if (length > 0) {
                        memcpy(&(pTpdu[offset]), vpTime, length);
                        offset += length;
                }
@@ -191,7 +186,7 @@ int SmsPluginTpduCodec::encodeSubmit(const SMS_SUBMIT_S *pSubmit, char *pTpdu)
 
        encodeSize = SmsPluginUDCodec::encodeUserData(&(pSubmit->userData), pSubmit->dcs.codingScheme, &(pTpdu[offset]));
 
-MSG_DEBUG("encodeSize : %d", encodeSize);
+       MSG_DEBUG("encodeSize : %d", encodeSize);
 
        offset += encodeSize;
 
@@ -221,46 +216,46 @@ int SmsPluginTpduCodec::encodeDeliver(const SMS_DELIVER_S *pDeliver, char *pTpdu
        char* scts = NULL;
        unique_ptr<char*, void(*)(char**)> timeBuf(&scts, unique_ptr_deleter);
 
-       // TP-MTI : 00
+       /* TP-MTI : 00 */
        pTpdu[offset] = 0x00;
 
-       // TP-MMS
+       /* TP-MMS */
        if (pDeliver->bMoreMsg == false)
                pTpdu[offset] |= 0x04;
 
-       // TP-SRI
+       /* TP-SRI */
        if (pDeliver->bStatusReport == true)
                pTpdu[offset] |= 0x20;
 
-       // TP-UDHI
+       /* TP-UDHI */
        if (pDeliver->bHeaderInd == true)
                pTpdu[offset] |= 0x40;
 
-       // TP-RP
+       /* TP-RP */
        if (pDeliver->bReplyPath == true)
                pTpdu[offset] |= 0x80;
 
        offset++;
 
-       // TP-OA
+       /* TP-OA */
        length = SmsPluginParamCodec::encodeAddress(&pDeliver->originAddress, &address);
        memcpy(&(pTpdu[offset]), address, length);
        offset += length;
 
-       // TP-PID
+       /* TP-PID */
        pTpdu[offset++] = pDeliver->pid;
 
-       // TP-DCS
+       /* TP-DCS */
        length = SmsPluginParamCodec::encodeDCS(&pDeliver->dcs, &dcs);
        memcpy(&(pTpdu[offset]), dcs, length);
        offset += length;
 
-       // TP-SCTS
+       /* TP-SCTS */
        length = SmsPluginParamCodec::encodeTime(&pDeliver->timeStamp, &scts);
        memcpy(&(pTpdu[offset]), scts, length);
        offset += length;
 
-       // TP-UDL & TP-UD
+       /* TP-UDL & TP-UD */
        encodeSize = SmsPluginUDCodec::encodeUserData(&(pDeliver->userData), pDeliver->dcs.codingScheme, &(pTpdu[offset]));
 
        MSG_DEBUG("encodeSize : %d", encodeSize);
@@ -275,31 +270,30 @@ int SmsPluginTpduCodec::encodeDeliverReport(const SMS_DELIVER_REPORT_S *pDeliver
 {
        int offset = 0;
 
-       // TP-MTI : 00
+       /* TP-MTI : 00 */
        pTpdu[offset] = 0x00;
 
-       // TP-UDHI
+       /* TP-UDHI */
        if (pDeliverRep->bHeaderInd == true)
                pTpdu[offset] |= 0x40;
 
        offset++;
 
-       // TP-FCS
+       /* TP-FCS */
        if (pDeliverRep->reportType == SMS_REPORT_NEGATIVE) {
                pTpdu[offset++] = pDeliverRep->failCause;
                MSG_DEBUG("Delivery report : fail cause = [%02x]", pDeliverRep->failCause);
        }
 
-       // TP-PI
+       /* TP-PI */
        pTpdu[offset++] = pDeliverRep->paramInd;
 
-       // TP-PID
+       /* TP-PID */
        if (pDeliverRep->paramInd & 0x01)
                pTpdu[offset++] = pDeliverRep->pid;
 
-       // TP-DCS
-       if (pDeliverRep->paramInd & 0x02)
-       {
+       /* TP-DCS */
+       if (pDeliverRep->paramInd & 0x02) {
                int length = 0;
 
                char* dcs = NULL;
@@ -311,9 +305,8 @@ int SmsPluginTpduCodec::encodeDeliverReport(const SMS_DELIVER_REPORT_S *pDeliver
                offset += length;
        }
 
-       // TP-UDL & TP-UD
-       if (pDeliverRep->paramInd & 0x04)
-       {
+       /* TP-UDL & TP-UD */
+       if (pDeliverRep->paramInd & 0x04) {
                int encodeSize = 0;
 
                encodeSize = SmsPluginUDCodec::encodeUserData(&(pDeliverRep->userData), pDeliverRep->dcs.codingScheme, &(pTpdu[offset]));
@@ -342,54 +335,53 @@ int SmsPluginTpduCodec::encodeStatusReport(const SMS_STATUS_REPORT_S *pStatusRep
        char* dt = NULL;
        unique_ptr<char*, void(*)(char**)> dtBuf(&dt, unique_ptr_deleter);
 
-       // TP-MTI : 10
+       /* TP-MTI : 10 */
        pTpdu[offset] = 0x02;
 
-       // TP-MMS
+       /* TP-MMS */
        if (pStatusRep->bMoreMsg == true)
                pTpdu[offset] |= 0x04;
 
-       // TP-SRQ
+       /* TP-SRQ */
        if (pStatusRep->bStatusReport == true)
                pTpdu[offset] |= 0x20;
 
-       // TP-UDHI
+       /* TP-UDHI */
        if (pStatusRep->bHeaderInd == true)
                pTpdu[offset] |= 0x40;
 
        offset++;
 
-       // TP-MR
+       /* TP-MR */
        pTpdu[offset++] = pStatusRep->msgRef;
 
-       // TP-RA
+       /* TP-RA */
        length = SmsPluginParamCodec::encodeAddress(&pStatusRep->recipAddress, &address);
        memcpy(&(pTpdu[offset]), address, length);
        offset += length;
 
-       // TP-SCTS
+       /* TP-SCTS */
        length = SmsPluginParamCodec::encodeTime(&pStatusRep->timeStamp, &scts);
        memcpy(&(pTpdu[offset]), scts, length);
        offset += length;
 
-       // TP-DT
+       /* TP-DT */
        length = SmsPluginParamCodec::encodeTime(&pStatusRep->dischargeTime, &dt);
        memcpy(&(pTpdu[offset]), dt, length);
        offset += length;
 
-       // TP-Status
+       /* TP-Status */
        pTpdu[offset++] = pStatusRep->status;
 
-       // TP-PI
+       /* TP-PI */
        pTpdu[offset++] = pStatusRep->paramInd;
 
-       // TP-PID
+       /* TP-PID */
        if (pStatusRep->paramInd & 0x01)
                pTpdu[offset++] = pStatusRep->pid;
 
-       // TP-DCS
-       if (pStatusRep->paramInd & 0x02)
-       {
+       /* TP-DCS */
+       if (pStatusRep->paramInd & 0x02) {
                int length = 0;
 
                char* dcs = NULL;
@@ -401,9 +393,8 @@ int SmsPluginTpduCodec::encodeStatusReport(const SMS_STATUS_REPORT_S *pStatusRep
                offset += length;
        }
 
-       // TP-UDL & TP-UD
-       if (pStatusRep->paramInd & 0x04)
-       {
+       /* TP-UDL & TP-UD */
+       if (pStatusRep->paramInd & 0x04) {
                int encodeSize = 0;
 
                encodeSize = SmsPluginUDCodec::encodeUserData(&(pStatusRep->userData), pStatusRep->dcs.codingScheme, &(pTpdu[offset]));
@@ -423,28 +414,36 @@ int SmsPluginTpduCodec::decodeSubmit(const unsigned char *pTpdu, int TpduLen, SM
 {
        int offset = 0, udLen = 0;
 
-       // TP-RD
+       char tpduTmp[(TpduLen*2)+1];
+       memset(tpduTmp, 0x00, sizeof(tpduTmp));
+       for (int i = 0; i < TpduLen; i++) {
+               snprintf(tpduTmp+(i*2), sizeof(tpduTmp)-(i*2), "%02X", pTpdu[i]);
+       }
+       MSG_DEBUG("Sumbit TPDU.");
+       MSG_INFO("[%s]", tpduTmp);
+
+       /* TP-RD */
        if (pTpdu[offset] & 0x04)
                pSubmit->bRejectDup = false;
        else
                pSubmit->bRejectDup = true;
 
-       // TP-VPF
+       /* TP-VPF */
        pSubmit->vpf = (SMS_VPF_T)(pTpdu[offset] & 0x18);
 
-       // TP-SRR
+       /* TP-SRR */
        if (pTpdu[offset] & 0x20)
                pSubmit->bStatusReport = true;
        else
                pSubmit->bStatusReport = false;
 
-       // TP-UDHI
+       /* TP-UDHI */
        if (pTpdu[offset] & 0x40)
                pSubmit->bHeaderInd = true;
        else
                pSubmit->bHeaderInd = false;
 
-       // TP-RP
+       /* TP-RP */
        if (pTpdu[offset] & 0x80)
                pSubmit->bReplyPath = true;
        else
@@ -452,25 +451,24 @@ int SmsPluginTpduCodec::decodeSubmit(const unsigned char *pTpdu, int TpduLen, SM
 
        offset++;
 
-       // TP-MR
+       /* TP-MR */
        pSubmit->msgRef = pTpdu[offset++];
 
-       // TP-DA
+       /* TP-DA */
        offset += SmsPluginParamCodec::decodeAddress(pTpdu+offset, &(pSubmit->destAddress));
 
-       // TP-PID
+       /* TP-PID */
        pSubmit->pid = pTpdu[offset++];
 
-       // TP-DCS
+       /* TP-DCS */
        offset += SmsPluginParamCodec::decodeDCS(pTpdu+offset, &(pSubmit->dcs));
 
-       // TP-VP
-       if (pSubmit->vpf != SMS_VPF_NOT_PRESENT)
-       {
-               // Decode VP
+       /* TP-VP */
+       if (pSubmit->vpf != SMS_VPF_NOT_PRESENT) {
+               /* Decode VP */
        }
 
-       // TP-UDL & TP-UD
+       /* TP-UDL & TP-UD */
        udLen = SmsPluginUDCodec::decodeUserData(pTpdu+offset, TpduLen, pSubmit->bHeaderInd, pSubmit->dcs.codingScheme, &(pSubmit->userData));
 
        return udLen;
@@ -491,25 +489,25 @@ int SmsPluginTpduCodec::decodeDeliver(const unsigned char *pTpdu, int TpduLen, S
        MSG_INFO("[%s]", tpduTmp);
 
 
-       // TP-MMS
+       /* TP-MMS */
        if (pTpdu[offset] & 0x04)
                pDeliver->bMoreMsg = false;
        else
                pDeliver->bMoreMsg = true;
 
-       // TP-SRI
+       /* TP-SRI */
        if (pTpdu[offset] & 0x20)
                pDeliver->bStatusReport = true;
        else
                pDeliver->bStatusReport = false;
 
-       // TP-UDHI
+       /* TP-UDHI */
        if (pTpdu[offset] & 0x40)
                pDeliver->bHeaderInd = true;
        else
                pDeliver->bHeaderInd = false;
 
-       // TP-RP
+       /* TP-RP */
        if (pTpdu[offset] & 0x80)
                pDeliver->bReplyPath = true;
        else
@@ -519,16 +517,16 @@ int SmsPluginTpduCodec::decodeDeliver(const unsigned char *pTpdu, int TpduLen, S
 
        tmpOffset = offset;
 #if 1
-       // TP-OA
+       /* TP-OA */
        offset += SmsPluginParamCodec::decodeAddress(&pTpdu[offset], &(pDeliver->originAddress));
 
-       // TP-PID
+       /* TP-PID */
        pDeliver->pid = pTpdu[offset++];
 
-       // TP-DCS
+       /* TP-DCS */
        offset += SmsPluginParamCodec::decodeDCS(&pTpdu[offset], &(pDeliver->dcs));
 
-       // Support KSC5601 :: Coding group bits == 0x84
+       /* Support KSC5601 :: Coding group bits == 0x84 */
        if (pTpdu[offset-1] == 0x84) {
                pDeliver->dcs.codingScheme = SMS_CHARSET_EUCKR;
        }
@@ -587,10 +585,10 @@ int SmsPluginTpduCodec::decodeDeliver(const unsigned char *pTpdu, int TpduLen, S
                }
        }
 
-       // TP-SCTS
+       /* TP-SCTS */
        offset += SmsPluginParamCodec::decodeTime(&pTpdu[offset], &(pDeliver->timeStamp));
 
-       // TP-UD
+       /* TP-UD */
        udLen = SmsPluginUDCodec::decodeUserData(&pTpdu[offset], TpduLen, pDeliver->bHeaderInd, pDeliver->dcs.codingScheme, &(pDeliver->userData), &(pDeliver->udData));
 
        return udLen;
@@ -620,19 +618,19 @@ int SmsPluginTpduCodec::decodeStatusReport(const unsigned char *pTpdu, int TpduL
        char* dt = NULL;
        unique_ptr<char*, void(*)(char**)> dtBuf(&dt, unique_ptr_deleter);
 
-       // TP-MMS
+       /* TP-MMS */
        if (pTpdu[offset] & 0x04)
                pStatusRep->bMoreMsg = false;
        else
                pStatusRep->bMoreMsg = true;
 
-       // TP-SRQ
+       /* TP-SRQ */
        if (pTpdu[offset] & 0x20)
                pStatusRep->bStatusReport = true;
        else
                pStatusRep->bStatusReport = false;
 
-       // TP-UDHI
+       /* TP-UDHI */
        if (pTpdu[offset] & 0x40)
                pStatusRep->bHeaderInd = true;
        else
@@ -640,29 +638,28 @@ int SmsPluginTpduCodec::decodeStatusReport(const unsigned char *pTpdu, int TpduL
 
        offset++;
 
-       // TP-MR
+       /* TP-MR */
        pStatusRep->msgRef = pTpdu[offset++];
 
-       // TP-RA
+       /* TP-RA */
        offset += SmsPluginParamCodec::decodeAddress(&pTpdu[offset], &(pStatusRep->recipAddress));
 
-       // TP-SCTS
-       // Decode timestamp
+       /* TP-SCTS */
+       /* Decode timestamp */
        offset += SmsPluginParamCodec::decodeTime(&pTpdu[offset], &(pStatusRep->timeStamp));
 
-       // TP-DT
-       // Decode timestamp
+       /* TP-DT */
+       /* Decode timestamp */
        offset += SmsPluginParamCodec::decodeTime(&pTpdu[offset], &(pStatusRep->dischargeTime));
 
-       // TP-Status
+       /* TP-Status */
        pStatusRep->status = pTpdu[offset++];
 
-       // TP-PI
+       /* TP-PI */
        pStatusRep->paramInd = pTpdu[offset++];
 
-       // No Parameters
-       if (pStatusRep->paramInd == 0)
-       {
+       /* No Parameters */
+       if (pStatusRep->paramInd == 0) {
                pStatusRep->pid = SMS_PID_NORMAL;
 
                pStatusRep->dcs.bCompressed = false;
@@ -679,23 +676,18 @@ int SmsPluginTpduCodec::decodeStatusReport(const unsigned char *pTpdu, int TpduL
                memset(pStatusRep->userData.data, 0x00, MAX_USER_DATA_LEN+1);
        }
 
-       // TP-PID
+       /* TP-PID */
        if (pStatusRep->paramInd & 0x01)
                pStatusRep->pid = pTpdu[offset++];
 
-       // TP-DCS
+       /* TP-DCS */
        if (pStatusRep->paramInd & 0x02)
-       {
                offset += SmsPluginParamCodec::decodeDCS(&pTpdu[offset], &(pStatusRep->dcs));
-       }
 
-       // TP-UDL & TP-UD
+       /* TP-UDL & TP-UD */
        if (pStatusRep->paramInd & 0x04)
-       {
-               // Decode User Data
+               /* Decode User Data */
                udLen = SmsPluginUDCodec::decodeUserData(&pTpdu[offset], TpduLen, pStatusRep->bHeaderInd, pStatusRep->dcs.codingScheme, &(pStatusRep->userData));
-       }
 
        return udLen;
 }
-
index e81538e..4a5c83a 100755 (executable)
@@ -34,8 +34,7 @@
 #include "SmsPluginDSHandler.h"
 #include "SmsPluginSetting.h"
 
-extern "C"
-{
+extern "C" {
        #include <ITapiNetText.h>
 }
 
@@ -81,49 +80,48 @@ void SmsPluginTransport::submitRequest(SMS_REQUEST_INFO_S *pReqInfo)
 
        tpdu.tpduType = SMS_TPDU_SUBMIT;
 
-       // Get SMS Send Options - Setting
+       /* Get SMS Send Options - Setting */
        getSmsSendOption(pReqInfo->msgInfo.sim_idx, &(tpdu.data.submit));
 
-       // Set SMS Send Options - Each Message
+       /* Set SMS Send Options - Each Message */
        setSmsSendOption(pReqInfo, &tpdu);
 
-       // Set coding scheme
+       /* Set coding scheme */
        setSmsDcsOption(pReqInfo, &tpdu);
 
-       // Set SMS report request
+       /* Set SMS report request */
        setSmsReportOption(pReqInfo, &tpdu);
 
-       // Set SMSC Options
+       /* Set SMSC Options */
        SMS_ADDRESS_S smsc = {0,};
        setSmscOptions(pReqInfo->msgInfo.sim_idx, &smsc);
 
-       // Get TAPI handle
+       /* Get TAPI handle */
        struct tapi_handle *handle = SmsPluginDSHandler::instance()->getTelHandle(pReqInfo->msgInfo.sim_idx);
 
-       // Get address informations.
+       /* Get address informations. */
        MsgDbHandler *dbHandle = getDbHandle();
        MsgStoGetAddressByMsgId(dbHandle, pReqInfo->msgInfo.msgId, 0, &pReqInfo->msgInfo.nAddressCnt, &pReqInfo->msgInfo.addressList);
        MSG_DEBUG("pReqInfo->msgInfo.nAddressCnt [%d]", pReqInfo->msgInfo.nAddressCnt);
 
-       // Get MSISDN
+       /* Get MSISDN */
        char *msisdn = NULL;
        char keyName[MAX_VCONFKEY_NAME_LEN];
        memset(keyName, 0x00, sizeof(keyName));
        snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_MSISDN, pReqInfo->msgInfo.sim_idx);
        msisdn = MsgSettingGetString(keyName);
 
-       for (int i = 0; i < pReqInfo->msgInfo.nAddressCnt; i++)
-       {
-               // Make SMS_SUBMIT_DATA_S from MSG_REQUEST_INFO_S
+       for (int i = 0; i < pReqInfo->msgInfo.nAddressCnt; i++) {
+               /* Make SMS_SUBMIT_DATA_S from MSG_REQUEST_INFO_S */
                SMS_SUBMIT_DATA_S submitData = {{0},};
                msgInfoToSubmitData(&(pReqInfo->msgInfo), &submitData, &(tpdu.data.submit.dcs.codingScheme), i);
 
-               // Insert message reference into db
+               /* Insert message reference into db */
                if (tpdu.data.submit.bStatusReport == true) {
                        SmsPluginStorage::instance()->insertMsgRef(&(pReqInfo->msgInfo), tpdu.data.submit.msgRef, i);
                }
 
-               // Encode SMSC Address
+               /* Encode SMSC Address */
                unsigned char smscAddr[MAX_SMSC_LEN];
                memset(smscAddr, 0x00, sizeof(smscAddr));
 
@@ -162,14 +160,13 @@ void SmsPluginTransport::submitRequest(SMS_REQUEST_INFO_S *pReqInfo)
                        tpdu.data.submit.destAddress.address[MAX_ADDRESS_LEN] = '\0';
                }
 
-MSG_DEBUG("ton [%d]", tpdu.data.submit.destAddress.ton);
-MSG_DEBUG("npi [%d]", tpdu.data.submit.destAddress.npi);
-MSG_SEC_DEBUG("address [%s]", tpdu.data.submit.destAddress.address);
+               MSG_DEBUG("ton [%d]", tpdu.data.submit.destAddress.ton);
+               MSG_DEBUG("npi [%d]", tpdu.data.submit.destAddress.npi);
+               MSG_SEC_DEBUG("address [%s]", tpdu.data.submit.destAddress.address);
 
                bool bStatusReport = false;
 
-               for (unsigned int segCnt = 0; segCnt < submitData.segCount; segCnt++)
-               {
+               for (unsigned int segCnt = 0; segCnt < submitData.segCount; segCnt++) {
                        if (submitData.userData[segCnt].headerCnt > 0) {
                                tpdu.data.submit.bHeaderInd = true;
                        } else {
@@ -194,10 +191,8 @@ MSG_SEC_DEBUG("address [%s]", tpdu.data.submit.destAddress.address);
                        bool bRetryByMoCtrl = false;
                        bool bSatMoCtrl = false;
 
-
-                       for (int cnt = 0; cnt < MAX_SMS_SEND_RETRY; ++cnt)
-                       {
-                               // Encode SMS-SUBMIT TPDU
+                       for (int cnt = 0; cnt < MAX_SMS_SEND_RETRY; ++cnt) {
+                               /* Encode SMS-SUBMIT TPDU */
                                memset(buf, 0x00, sizeof(buf));
 
                                if (cnt > 0)
@@ -205,10 +200,10 @@ MSG_SEC_DEBUG("address [%s]", tpdu.data.submit.destAddress.address);
 
                                bufLen = SmsPluginTpduCodec::encodeTpdu(&tpdu, buf);
 
-                               // Make Telephony Structure
+                               /* Make Telephony Structure */
                                TelSmsDatapackageInfo_t pkgInfo;
 
-                               // Set TPDU data
+                               /* Set TPDU data */
                                memset((void*)pkgInfo.szData, 0x00, sizeof(pkgInfo.szData));
                                memcpy((void*)pkgInfo.szData, buf, bufLen);
 
@@ -216,7 +211,7 @@ MSG_SEC_DEBUG("address [%s]", tpdu.data.submit.destAddress.address);
                                pkgInfo.MsgLength = bufLen;
                                pkgInfo.format = TAPI_NETTEXT_NETTYPE_3GPP;
 
-                               // Set SMSC data
+                               /* Set SMSC data */
                                memset(pkgInfo.Sca, 0x00, sizeof(pkgInfo.Sca));
                                memcpy((void*)pkgInfo.Sca, smscAddr, smscLen);
                                pkgInfo.Sca[smscLen] = '\0';
@@ -237,13 +232,10 @@ MSG_SEC_DEBUG("address [%s]", tpdu.data.submit.destAddress.address);
 
                                memcpy(&(sentInfo.reqInfo), pReqInfo, sizeof(SMS_REQUEST_INFO_S));
 
-                               if ((segCnt+1) == submitData.segCount && (i+1)==pReqInfo->msgInfo.nAddressCnt)
-                               {
+                               if ((segCnt + 1) == submitData.segCount && (i + 1)==pReqInfo->msgInfo.nAddressCnt) {
                                        sentInfo.bLast = true;
                                        bMoreMsg = FALSE;
-                               }
-                               else
-                               {
+                               } else {
                                        sentInfo.bLast = false;
                                        bMoreMsg = TRUE;
                                }
@@ -252,13 +244,12 @@ MSG_SEC_DEBUG("address [%s]", tpdu.data.submit.destAddress.address);
 
                                curStatus = SMS_NETWORK_SENDING;
 
-                               // Send SMS
+                               /* Send SMS */
                                int tapiRet = TAPI_API_SUCCESS;
 
                                tapiRet = tel_send_sms(handle, &pkgInfo, bMoreMsg, TapiEventSentStatus, (void *)&curMoCtrlData);
 
-                               if (tapiRet == TAPI_API_SUCCESS)
-                               {
+                               if (tapiRet == TAPI_API_SUCCESS) {
                                        MSG_DEBUG("########  tel_send_sms Success !!! return : [%d] #######", tapiRet);
 
                                        memset(keyName, 0x00, sizeof(keyName));
@@ -267,7 +258,7 @@ MSG_SEC_DEBUG("address [%s]", tpdu.data.submit.destAddress.address);
                                                MSG_DEBUG("MsgSettingGetBool [%s] failed", keyName);
 
                                        if (bSatMoCtrl) {
-                                               // Get SAT MO SM control
+                                               /* Get SAT MO SM control */
                                                retMoCtrlStatus = getMoCtrlStatus();
                                                MSG_DEBUG("retMoCtrlStatus  = [%d]", retMoCtrlStatus);
 
@@ -276,7 +267,7 @@ MSG_SEC_DEBUG("address [%s]", tpdu.data.submit.destAddress.address);
                                                        if (bRetryByMoCtrl == false) {
                                                                bRetryByMoCtrl = true;
 
-                                                               // Modify Address with control data
+                                                               /* Modify Address with control data */
                                                                memset(smsc.address, 0x00, sizeof(smsc.address));
                                                                memcpy(smsc.address, curMoCtrlData.rpDestAddr.string, sizeof(smsc.address)-1);
 
@@ -297,9 +288,7 @@ MSG_SEC_DEBUG("address [%s]", tpdu.data.submit.destAddress.address);
                                                        }
                                                }
                                        }
-                               }
-                               else
-                               {
+                               } else {
                                        SmsPluginEventHandler::instance()->handleSentStatus(MSG_NETWORK_SEND_FAIL);
 
                                        if (msisdn) {
@@ -309,7 +298,7 @@ MSG_SEC_DEBUG("address [%s]", tpdu.data.submit.destAddress.address);
                                        THROW(MsgException::SMS_PLG_ERROR, "########  tel_send_sms Fail !!! return : [%d] #######", tapiRet);
                                }
 
-                               // Tizen Validation System
+                               /* Tizen Validation System */
                                MSG_SMS_VLD_INFO("%d, SMS Send Start, %s->%s, %s",  pReqInfo->msgInfo.msgId, \
                                                                                                                                                        (msisdn == NULL)?"ME":msisdn, \
                                                                                                                                                        pReqInfo->msgInfo.addressList[0].addressVal, \
@@ -324,13 +313,11 @@ MSG_SEC_DEBUG("address [%s]", tpdu.data.submit.destAddress.address);
                        }
 
 #ifdef MSG_SMS_REPORT
-                       if (err == MSG_SUCCESS && tmpInfo.msgInfo.msgPort.valid == false)
-                       {
-                               if(pReqInfo->sendOptInfo.bDeliverReq == true)
-                               {
+                       if (err == MSG_SUCCESS && tmpInfo.msgInfo.msgPort.valid == false)       {
+                               if (pReqInfo->sendOptInfo.bDeliverReq == true) {
                                        MSG_DEBUG("Update Delivery Report Status : [%d] Msg ID : [%d]", err, tmpInfo.msgInfo.msgId);
 
-                                       // Adding delivery report status info.
+                                       /* Adding delivery report status info. */
                                        MsgStoAddDeliveryReportStatus( tmpInfo.msgInfo.msgId, (unsigned char)tmpInfo.msgInfo.referenceId);
                                }
                        }
@@ -341,8 +328,7 @@ MSG_SEC_DEBUG("address [%s]", tpdu.data.submit.destAddress.address);
                                                                                                                                        pReqInfo->msgInfo.addressList[0].addressVal, \
                                                                                                                                        (retStatus == SMS_NETWORK_SEND_SUCCESS)?"Success":"Fail");
 
-                       if (retStatus == SMS_NETWORK_SEND_SUCCESS)
-                       {
+                       if (retStatus == SMS_NETWORK_SEND_SUCCESS) {
                                bool bTTS = false;
 
                                if (MsgSettingGetBool(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, &bTTS) != MSG_SUCCESS) {
@@ -355,9 +341,7 @@ MSG_SEC_DEBUG("address [%s]", tpdu.data.submit.destAddress.address);
                                        }
                                        MSG_DEBUG("########  Msg Sent was Successful !!! #######");
                                }
-                       }
-                       else
-                       {
+                       } else {
                                if (retStatus == SMS_NETWORK_SEND_FAIL_TIMEOUT || retStatus == SMS_NETWORK_SEND_FAIL_TEMPORARY || retStatus == SMS_NETWORK_SEND_FAIL_BY_MO_CONTROL_WITH_MOD)
                                        SmsPluginEventHandler::instance()->handleSentStatus(MSG_NETWORK_SEND_FAIL);
 
@@ -374,7 +358,8 @@ MSG_SEC_DEBUG("address [%s]", tpdu.data.submit.destAddress.address);
                                THROW(MsgException::SMS_PLG_ERROR, "########  Msg Sent was Failed !!! return : [%d] #######", retStatus);
                        }
 
-                       if (tpdu.data.submit.userData.headerCnt > 0) tpdu.data.submit.userData.headerCnt--;
+                       if (tpdu.data.submit.userData.headerCnt > 0)
+                               tpdu.data.submit.userData.headerCnt--;
 
                }
        }
@@ -403,27 +388,19 @@ void SmsPluginTransport::sendDeliverReport(struct tapi_handle *handle, msg_error
 
        int simIndex = SmsPluginDSHandler::instance()->getSimIndex(handle);
 
-       if (err == MSG_SUCCESS)
-       {
+       if (err == MSG_SUCCESS) {
                tpdu.data.deliverRep.reportType = SMS_REPORT_POSITIVE;
                response = TAPI_NETTEXT_SENDSMS_SUCCESS;
 
-               if(isMemAvailable == false)
-               {
+               if (isMemAvailable == false) {
                        tapiRet = tel_set_sms_memory_status(handle, TAPI_NETTEXT_PDA_MEMORY_STATUS_AVAILABLE, TapiEventMemoryStatus, NULL);
 
                        if (tapiRet == TAPI_API_SUCCESS)
-                       {
                                MSG_DEBUG("########  tel_set_sms_memory_status() Success !!! #######");
-                       }
                        else
-                       {
                                MSG_DEBUG("########  tel_set_sms_memory_status() Failed !!! return : [%d] #######", tapiRet);
-                       }
                }
-       }
-       else if (err == MSG_ERR_SIM_STORAGE_FULL)
-       {
+       } else if (err == MSG_ERR_SIM_STORAGE_FULL) {
                tpdu.data.deliverRep.reportType = SMS_REPORT_NEGATIVE;
                tpdu.data.deliverRep.failCause = SMS_FC_SIM_STORAGE_FULL;
 
@@ -442,9 +419,7 @@ void SmsPluginTransport::sendDeliverReport(struct tapi_handle *handle, msg_error
                        MSG_DEBUG("########  tel_set_sms_memory_status() Failed !!! return : [%d] #######", tapiRet);
                }
 #endif
-       }
-       else if (err == MSG_ERR_MESSAGE_COUNT_FULL)
-       {
+       } else if (err == MSG_ERR_MESSAGE_COUNT_FULL) {
                tpdu.data.deliverRep.reportType = SMS_REPORT_NEGATIVE;
                tpdu.data.deliverRep.failCause = SMS_FC_MSG_CAPA_EXCEEDED;
                response = TAPI_NETTEXT_ME_FULL;
@@ -452,20 +427,14 @@ void SmsPluginTransport::sendDeliverReport(struct tapi_handle *handle, msg_error
                tapiRet = tel_set_sms_memory_status(handle, TAPI_NETTEXT_PDA_MEMORY_STATUS_FULL, TapiEventMemoryStatus, NULL);
 
                if (tapiRet == TAPI_API_SUCCESS)
-               {
                        MSG_DEBUG("########  tel_set_sms_memory_status() Success !!! #######");
-               }
                else
-               {
                        MSG_DEBUG("########  tel_set_sms_memory_status() Failed !!! return : [%d] #######", tapiRet);
-               }
-       }
-       else
-       {
+       } else {
                tpdu.data.deliverRep.reportType = SMS_REPORT_NEGATIVE;
                tpdu.data.deliverRep.failCause = SMS_FC_UNSPEC_ERROR;
-               //response = TAPI_NETTEXT_PROTOCOL_ERROR;
-               // For gcf test [34.2.5.3 class2 message]
+               /*response = TAPI_NETTEXT_PROTOCOL_ERROR;
+                For gcf test [34.2.5.3 class2 message] */
                response = TAPI_NETTEXT_SIM_FULL;
 
        }
@@ -475,7 +444,7 @@ void SmsPluginTransport::sendDeliverReport(struct tapi_handle *handle, msg_error
        tpdu.data.deliverRep.bHeaderInd = false;
        tpdu.data.deliverRep.paramInd = 0x00;
 
-       // Encode SMS-DELIVER-REPORT TPDU
+       /* Encode SMS-DELIVER-REPORT TPDU */
        int bufLen = 0;
 
        char buf[MAX_TPDU_DATA_LEN];
@@ -484,20 +453,18 @@ void SmsPluginTransport::sendDeliverReport(struct tapi_handle *handle, msg_error
        bufLen = SmsPluginTpduCodec::encodeTpdu(&tpdu, buf);
 
 #ifdef MSG_FOR_DEBUG
-       /////// print DeliverReport tpdu
+       /* print DeliverReport tpdu */
        printf("\n\n######## DeliverReport tpdu #########\n");
-       for(int i=0; i < bufLen; i++)
-       {
+       for (int i=0; i < bufLen; i++) {
                printf("[%02x] ", buf[i]);
        }
        printf("\n#################################\n\n");
-       //////
 #endif
 
-       // Make Telephony Structure
+       /* Make Telephony Structure */
        TelSmsDatapackageInfo_t pkgInfo;
 
-       // Set TPDU data
+       /* Set TPDU data */
        memset((void*)pkgInfo.szData, 0x00, sizeof(pkgInfo.szData));
        memcpy((void*)pkgInfo.szData, buf, bufLen);
 
@@ -505,13 +472,13 @@ void SmsPluginTransport::sendDeliverReport(struct tapi_handle *handle, msg_error
        pkgInfo.MsgLength = bufLen;
        pkgInfo.format = TAPI_NETTEXT_NETTYPE_3GPP;
 
-       // Set SMSC Address
+       /* Set SMSC Address */
        SMS_ADDRESS_S smsc;
 
-       // Set SMSC Options
+       /* Set SMSC Options */
        setSmscOptions(simIndex, &smsc);
 
-       // Encode SMSC Address
+       /* Encode SMSC Address */
        unsigned char smscAddr[MAX_SMSC_LEN];
        memset(smscAddr, 0x00, sizeof(smscAddr));
 
@@ -519,22 +486,18 @@ void SmsPluginTransport::sendDeliverReport(struct tapi_handle *handle, msg_error
 
        if (smscLen <= 0) return;
 
-       // Set SMSC data
+       /* Set SMSC data */
        memset(pkgInfo.Sca, 0x00, sizeof(pkgInfo.Sca));
        memcpy((void*)pkgInfo.Sca, smscAddr, smscLen);
        pkgInfo.Sca[smscLen] = '\0';
 
-       // Send Deliver Report
+       /* Send Deliver Report */
        tapiRet = tel_send_sms_deliver_report(handle, &pkgInfo, response, TapiEventDeliveryReportCNF, NULL);
 
        if (tapiRet == TAPI_API_SUCCESS)
-       {
                MSG_DEBUG("########  tel_send_sms_deliver_report() Success !!! #######");
-       }
        else
-       {
                MSG_DEBUG("########  tel_send_sms_deliver_report() Fail !!! return : [%d] #######", tapiRet);
-       }
 
        MSG_END();
 }
@@ -553,60 +516,41 @@ void SmsPluginTransport::sendClass0DeliverReport(struct tapi_handle *handle, msg
 
        int simIndex = SmsPluginDSHandler::instance()->getSimIndex(handle);
 
-       if (err == MSG_SUCCESS)
-       {
+       if (err == MSG_SUCCESS) {
                tpdu.data.deliverRep.reportType = SMS_REPORT_POSITIVE;
                response = TAPI_NETTEXT_SENDSMS_SUCCESS;
 
                tapiRet = tel_set_sms_memory_status(handle, TAPI_NETTEXT_PDA_MEMORY_STATUS_AVAILABLE, TapiEventMemoryStatus, NULL);
 
                if (tapiRet == TAPI_API_SUCCESS)
-               {
                        MSG_DEBUG("########  tel_set_sms_memory_status() Success !!! #######");
-               }
                else
-               {
                        MSG_DEBUG("########  tel_set_sms_memory_status() Failed !!! return : [%d] #######", tapiRet);
-               }
-       }
-       else if (err == MSG_ERR_SIM_STORAGE_FULL)
-       {
+       } else if (err == MSG_ERR_SIM_STORAGE_FULL) {
                tpdu.data.deliverRep.reportType = SMS_REPORT_POSITIVE;
                response = TAPI_NETTEXT_SENDSMS_SUCCESS;
 
                tapiRet = tel_set_sms_memory_status(handle, TAPI_NETTEXT_PDA_MEMORY_STATUS_FULL, TapiEventMemoryStatus, NULL);
 
                if (tapiRet == TAPI_API_SUCCESS)
-               {
                        MSG_DEBUG("########  tel_set_sms_memory_status() Success !!! #######");
-               }
                else
-               {
                        MSG_DEBUG("########  tel_set_sms_memory_status() Failed !!! return : [%d] #######", tapiRet);
-               }
-       }
-       else if (err == MSG_ERR_MESSAGE_COUNT_FULL)
-       {
+       } else if (err == MSG_ERR_MESSAGE_COUNT_FULL) {
                tpdu.data.deliverRep.reportType = SMS_REPORT_POSITIVE;
                response = TAPI_NETTEXT_SENDSMS_SUCCESS;
 
                tapiRet = tel_set_sms_memory_status(handle, TAPI_NETTEXT_PDA_MEMORY_STATUS_FULL, TapiEventMemoryStatus, NULL);
 
                if (tapiRet == TAPI_API_SUCCESS)
-               {
                        MSG_DEBUG("########  tel_set_sms_memory_status() Success !!! #######");
-               }
                else
-               {
                        MSG_DEBUG("########  tel_set_sms_memory_status() Failed !!! return : [%d] #######", tapiRet);
-               }
-       }
-       else
-       {
+       } else {
                tpdu.data.deliverRep.reportType = SMS_REPORT_NEGATIVE;
                tpdu.data.deliverRep.failCause = SMS_FC_UNSPEC_ERROR;
-               //response = TAPI_NETTEXT_PROTOCOL_ERROR;
-               // For gcf test [34.2.5.3 class2 message]
+               /*response = TAPI_NETTEXT_PROTOCOL_ERROR;
+                For gcf test [34.2.5.3 class2 message] */
                response = TAPI_NETTEXT_SIM_FULL;
 
        }
@@ -616,7 +560,7 @@ void SmsPluginTransport::sendClass0DeliverReport(struct tapi_handle *handle, msg
        tpdu.data.deliverRep.bHeaderInd = false;
        tpdu.data.deliverRep.paramInd = 0x00;
 
-       // Encode SMS-DELIVER-REPORT TPDU
+       /* Encode SMS-DELIVER-REPORT TPDU */
        int bufLen = 0;
 
        char buf[MAX_TPDU_DATA_LEN];
@@ -624,10 +568,10 @@ void SmsPluginTransport::sendClass0DeliverReport(struct tapi_handle *handle, msg
 
        bufLen = SmsPluginTpduCodec::encodeTpdu(&tpdu, buf);
 
-       // Make Telephony Structure
+       /* Make Telephony Structure */
        TelSmsDatapackageInfo_t pkgInfo;
 
-       // Set TPDU data
+       /* Set TPDU data */
        memset((void*)pkgInfo.szData, 0x00, sizeof(pkgInfo.szData));
        memcpy((void*)pkgInfo.szData, buf, bufLen);
 
@@ -635,13 +579,13 @@ void SmsPluginTransport::sendClass0DeliverReport(struct tapi_handle *handle, msg
        pkgInfo.MsgLength = bufLen;
        pkgInfo.format = TAPI_NETTEXT_NETTYPE_3GPP;
 
-       // Set SMSC Address
+       /* Set SMSC Address */
        SMS_ADDRESS_S smsc;
 
-       // Set SMSC Options
+       /* Set SMSC Options */
        setSmscOptions(simIndex, &smsc);
 
-       // Encode SMSC Address
+       /* Encode SMSC Address */
        unsigned char smscAddr[MAX_SMSC_LEN];
        memset(smscAddr, 0x00, sizeof(smscAddr));
 
@@ -649,22 +593,18 @@ void SmsPluginTransport::sendClass0DeliverReport(struct tapi_handle *handle, msg
 
        if (smscLen <= 0) return;
 
-       // Set SMSC data
+       /* Set SMSC data */
        memset(pkgInfo.Sca, 0x00, sizeof(pkgInfo.Sca));
        memcpy((void*)pkgInfo.Sca, smscAddr, smscLen);
        pkgInfo.Sca[smscLen] = '\0';
 
-       // Send Deliver Report
+       /* Send Deliver Report */
        tapiRet = tel_send_sms_deliver_report(handle, &pkgInfo, response, TapiEventDeliveryReportCNF, NULL);
 
        if (tapiRet == TAPI_API_SUCCESS)
-       {
                MSG_DEBUG("########  tel_send_sms_deliver_report() Success !!! #######");
-       }
        else
-       {
                MSG_DEBUG("########  tel_send_sms_deliver_report() Fail !!! return : [%d] #######", tapiRet);
-       }
 
        MSG_END();
 }
@@ -672,7 +612,7 @@ void SmsPluginTransport::sendClass0DeliverReport(struct tapi_handle *handle, msg
 
 void SmsPluginTransport::getSmsSendOption(int simIndex, SMS_SUBMIT_S *pSubmit)
 {
-       // Set SMS Send Options
+       /* Set SMS Send Options */
        pSubmit->bRejectDup = false;
        pSubmit->bHeaderInd = false;
 
@@ -708,7 +648,7 @@ void SmsPluginTransport::getSmsSendOption(int simIndex, SMS_SUBMIT_S *pSubmit)
 
        MSG_DEBUG("PID : %d", pSubmit->pid);
 
-       pSubmit->vpf = SMS_VPF_NOT_PRESENT; // default value
+       pSubmit->vpf = SMS_VPF_NOT_PRESENT; /* default value */
 
        MSG_DEBUG("valPeriod : %d", valPeriod);
        MSG_DEBUG("vpf : %d", pSubmit->vpf);
@@ -722,8 +662,7 @@ void SmsPluginTransport::setSmsSendOption(SMS_REQUEST_INFO_S *pReqInfo, SMS_TPDU
                return;
        }
 
-       if (pReqInfo->sendOptInfo.bSetting == true)
-       {
+       if (pReqInfo->sendOptInfo.bSetting == true) {
                pSmsTpdu->data.submit.bStatusReport = pReqInfo->sendOptInfo.bDeliverReq;
                pSmsTpdu->data.submit.bReplyPath = pReqInfo->sendOptInfo.option.smsSendOptInfo.bReplyPath;
        }
@@ -738,11 +677,11 @@ void SmsPluginTransport::setSmsDcsOption(SMS_REQUEST_INFO_S *pReqInfo, SMS_TPDU_
        }
 
        if (pReqInfo->msgInfo.msgPort.valid == true) {
-               // Set Coding Scheme for apps that use port number
+               /* Set Coding Scheme for apps that use port number */
                pSmsTpdu->data.submit.dcs.codingScheme = (SMS_CODING_SCHEME_T)pReqInfo->msgInfo.encodeType;
                MSG_DEBUG("DCS is changed by application : [%d]", pSmsTpdu->data.submit.dcs.codingScheme);
        } else {
-               // Change coding scheme if it is set coding scheme by apps
+               /* Change coding scheme if it is set coding scheme by apps */
                if (pSmsTpdu->data.submit.dcs.codingScheme == SMS_CHARSET_7BIT && pReqInfo->msgInfo.encodeType != MSG_ENCODE_GSM7BIT) {
                        pSmsTpdu->data.submit.dcs.codingScheme = (SMS_CODING_SCHEME_T)pReqInfo->msgInfo.encodeType;
                        MSG_DEBUG("DCS is changed by application : [%d]", pSmsTpdu->data.submit.dcs.codingScheme);
@@ -759,16 +698,15 @@ void SmsPluginTransport::setSmsReportOption(SMS_REQUEST_INFO_S *pReqInfo, SMS_TP
        }
 
 #ifdef MSG_SMS_REPORT
-       // Update Msg Ref into Report Table
-       if (pSmsTpdu->data.submit.bStatusReport == true)
-       {
+       /* Update Msg Ref into Report Table */
+       if (pSmsTpdu->data.submit.bStatusReport == true) {
                MSG_DEBUG("Update Msg Ref [%d] in Report Table", pSmsTpdu->data.submit.msgRef);
 
                SmsPluginStorage::instance()->updateMsgRef(pReqInfo->msgInfo.msgId, pSmsTpdu->data.submit.msgRef);
        }
 #endif
 
-       // Set Message Reference
+       /* Set Message Reference */
        if (pSmsTpdu->data.submit.bStatusReport == true) {
                pSmsTpdu->data.submit.msgRef = (pReqInfo->msgInfo.msgId % 256);
        }
@@ -777,7 +715,7 @@ void SmsPluginTransport::setSmsReportOption(SMS_REQUEST_INFO_S *pReqInfo, SMS_TP
 
 void SmsPluginTransport::setSmscOptions(int simIndex, SMS_ADDRESS_S *pSmsc)
 {
-       // Set SMSC Options
+       /* Set SMSC Options */
        MSG_SMSC_LIST_S smscList = {0,};
        SmsPluginSetting::instance()->getSmscListInfo(simIndex, &smscList);
 
@@ -804,7 +742,7 @@ void SmsPluginTransport::setSmscOptions(int simIndex, SMS_ADDRESS_S *pSmsc)
 
 void SmsPluginTransport::msgInfoToSubmitData(const MSG_MESSAGE_INFO_S *pMsgInfo, SMS_SUBMIT_DATA_S *pData, SMS_CODING_SCHEME_T *pCharType, int addrIndex)
 {
-       // Destination Address
+       /* Destination Address */
        pData->destAddress.ton = SMS_TON_UNKNOWN;
        pData->destAddress.npi = SMS_NPI_ISDN;
 
@@ -815,7 +753,7 @@ void SmsPluginTransport::msgInfoToSubmitData(const MSG_MESSAGE_INFO_S *pMsgInfo,
        MSG_DEBUG("npi [%d]", pData->destAddress.npi);
        MSG_SEC_DEBUG("address [%s]", pData->destAddress.address);
 
-       int decodeLen = 0, bufSize = (MAX_GSM_7BIT_DATA_LEN*MAX_SEGMENT_NUM) + 1;       // SMS_CHARSET_7BIT
+       int decodeLen = 0, bufSize = (MAX_GSM_7BIT_DATA_LEN*MAX_SEGMENT_NUM) + 1; /* SMS_CHARSET_7BIT */
 
        unsigned char decodeData[bufSize];
        memset(decodeData, 0x00, sizeof(decodeData));
@@ -828,77 +766,59 @@ void SmsPluginTransport::msgInfoToSubmitData(const MSG_MESSAGE_INFO_S *pMsgInfo,
 
        bool bAbnormal = false;
 
-       // User Data
-       if (pMsgInfo->bTextSms == true)
-       {
-               if (*pCharType == SMS_CHARSET_7BIT)
-               {
+       /* User Data */
+       if (pMsgInfo->bTextSms == true) {
+               if (*pCharType == SMS_CHARSET_7BIT) {
                        decodeLen = textCvt->convertUTF8ToGSM7bit(decodeData, bufSize, (unsigned char*)pMsgInfo->msgText, (int)pMsgInfo->dataSize, &langId, &bAbnormal);
-               }
-               else if (*pCharType == SMS_CHARSET_8BIT)
-               {
+               } else if (*pCharType == SMS_CHARSET_8BIT) {
                        memcpy(decodeData, pMsgInfo->msgText, pMsgInfo->dataSize);
                        decodeLen = pMsgInfo->dataSize;
-               }
-               else if (*pCharType == SMS_CHARSET_UCS2)
-               {
+               } else if (*pCharType == SMS_CHARSET_UCS2) {
                        decodeLen = textCvt->convertUTF8ToUCS2(decodeData, bufSize, (unsigned char*)pMsgInfo->msgText, (int)pMsgInfo->dataSize);
-               }
-               else if (*pCharType == SMS_CHARSET_AUTO)
-               {
-                       decodeLen = textCvt->convertUTF8ToAuto(decodeData, bufSize, (unsigned char*)pMsgInfo->msgText, (int)pMsgInfo->dataSize, &langId, &encodeType);
+               } else if (*pCharType == SMS_CHARSET_AUTO) {
+                       decodeLen = textCvt->convertUTF8ToAuto(decodeData, bufSize, (unsigned char*)pMsgInfo->msgText, (int)pMsgInfo->dataSize, &encodeType);
                        *pCharType = encodeType;
                }
-       }
-       else
-       {
+       } else {
                int fileSize = 0;
 
                char* pFileData = NULL;
                unique_ptr<char*, void(*)(char**)> FileBuf(&pFileData, unique_ptr_deleter);
 
-               // Read Message Data from File
+               /* Read Message Data from File */
                if (MsgOpenAndReadFile(pMsgInfo->msgData, &pFileData, &fileSize) == false)
                        THROW(MsgException::FILE_ERROR, "MsgOpenAndReadFile error");
 
                MSG_DEBUG("file size : [%d] file data : [%s]", fileSize, pFileData);
 
-               if (*pCharType == SMS_CHARSET_7BIT)
-               {
+               if (*pCharType == SMS_CHARSET_7BIT) {
                        decodeLen = textCvt->convertUTF8ToGSM7bit(decodeData, bufSize, (unsigned char*)pFileData, fileSize, &langId, &bAbnormal);
-               }
-               else if (*pCharType == SMS_CHARSET_8BIT)
-               {
+               } else if (*pCharType == SMS_CHARSET_8BIT) {
                        memcpy(decodeData, pFileData, fileSize);
                        decodeLen = fileSize;
-               }
-               else if (*pCharType == SMS_CHARSET_UCS2)
-               {
+               } else if (*pCharType == SMS_CHARSET_UCS2) {
                        decodeLen = textCvt->convertUTF8ToUCS2(decodeData, bufSize, (unsigned char*)pFileData, fileSize);
-               }
-               else if (*pCharType == SMS_CHARSET_AUTO)
-               {
-                       decodeLen = textCvt->convertUTF8ToAuto(decodeData, bufSize, (unsigned char*)pFileData, fileSize, &langId, &encodeType);
+               } else if (*pCharType == SMS_CHARSET_AUTO) {
+                       decodeLen = textCvt->convertUTF8ToAuto(decodeData, bufSize, (unsigned char*)pFileData, fileSize, &encodeType);
                        *pCharType = encodeType;
                }
 
-               // Delete File
+               /* Delete File */
                if (pMsgInfo->nAddressCnt == (addrIndex + 1))
                        MsgDeleteFile(pMsgInfo->msgData);
        }
 
-MSG_DEBUG("decode length : [%d]", decodeLen);
-MSG_DEBUG("character type : [%d]", *pCharType);
-MSG_DEBUG("Language Identifier : [%d]", langId);
-MSG_SEC_DEBUG("reply address : [%s]", pMsgInfo->replyAddress);
+       MSG_DEBUG("decode length : [%d]", decodeLen);
+       MSG_DEBUG("character type : [%d]", *pCharType);
+       MSG_DEBUG("Language Identifier : [%d]", langId);
+       MSG_SEC_DEBUG("reply address : [%s]", pMsgInfo->replyAddress);
 
        int addrLen = 0;
 
        char* encodedAddr = NULL;
        unique_ptr<char*, void(*)(char**)> addressBuf(&encodedAddr, unique_ptr_deleter);
 
-       if (strlen(pMsgInfo->replyAddress) > 0)
-       {
+       if (strlen(pMsgInfo->replyAddress) > 0) {
                SMS_ADDRESS_S replyAddr = {};
 
                replyAddr.ton = SMS_TON_NATIONAL;
@@ -928,8 +848,7 @@ MSG_DEBUG("segment size : [%d], pData->segCount : [%d]", segSize, pData->segCoun
 
        int headerCnt = 0;
 
-       for (unsigned int i = 0; i < pData->segCount; i++)
-       {
+       for (unsigned int i = 0; i < pData->segCount; i++) {
                headerCnt = 0;
 
                if ((i + 1) == pData->segCount)
@@ -941,14 +860,13 @@ MSG_DEBUG("segment size : [%d], pData->segCount : [%d]", segSize, pData->segCoun
                memcpy(pData->userData[i].data, &(decodeData[index]), pData->userData[i].length);
                pData->userData[i].data[pData->userData[i].length] = 0;
 
-MSG_DEBUG("user data len [%d]", pData->userData[i].length);
-MSG_DEBUG("user data [%s]", pData->userData[i].data);
+               MSG_DEBUG("user data len [%d]", pData->userData[i].length);
+               MSG_DEBUG("user data [%s]", pData->userData[i].data);
 
                index += segSize;
 
-               // Set User Data Header for Concatenated Message
-               if (pData->segCount > 1)
-               {
+               /* Set User Data Header for Concatenated Message */
+               if (pData->segCount > 1) {
                        pData->userData[i].header[headerCnt].udhType = SMS_UDH_CONCAT_8BIT;
                        pData->userData[i].header[headerCnt].udh.concat8bit.msgRef = msgRef8bit;
                        pData->userData[i].header[headerCnt].udh.concat8bit.totalSeg = pData->segCount;
@@ -957,9 +875,8 @@ MSG_DEBUG("user data [%s]", pData->userData[i].data);
                        headerCnt++;
                }
 
-               // Set User Data Header Port Information
-               if (pMsgInfo->msgPort.valid == true)
-               {
+               /* Set User Data Header Port Information */
+               if (pMsgInfo->msgPort.valid == true) {
                        pData->userData[i].header[headerCnt].udhType = SMS_UDH_APP_PORT_16BIT;
                        pData->userData[i].header[headerCnt].udh.appPort16bit.destPort = pMsgInfo->msgPort.dstPort;
                        pData->userData[i].header[headerCnt].udh.appPort16bit.originPort = pMsgInfo->msgPort.srcPort;
@@ -967,9 +884,8 @@ MSG_DEBUG("user data [%s]", pData->userData[i].data);
                        headerCnt++;
                }
 
-               // Set User Data Header for Alternate Reply Address
-               if (strlen(pMsgInfo->replyAddress) > 0)
-               {
+               /* Set User Data Header for Alternate Reply Address */
+               if (strlen(pMsgInfo->replyAddress) > 0) {
                        pData->userData[i].header[headerCnt].udhType = SMS_UDH_ALTERNATE_REPLY_ADDRESS;
 
                        pData->userData[i].header[headerCnt].udh.alternateAddress.ton = SMS_TON_NATIONAL;
@@ -981,9 +897,8 @@ MSG_DEBUG("user data [%s]", pData->userData[i].data);
                        headerCnt++;
                }
 
-               // Set User Data Header for National Language Single Shift
-               if (*pCharType == SMS_CHARSET_7BIT && langId != MSG_LANG_ID_RESERVED)
-               {
+               /* Set User Data Header for National Language Single Shift */
+               if (*pCharType == SMS_CHARSET_7BIT && langId != MSG_LANG_ID_RESERVED) {
                        pData->userData[i].header[headerCnt].udhType = SMS_UDH_SINGLE_SHIFT;
                        pData->userData[i].header[headerCnt].udh.singleShift.langId = langId;
 
@@ -1002,45 +917,36 @@ int SmsPluginTransport::getSegmentSize(SMS_CODING_SCHEME_T CodingScheme, int Dat
        int headerLen = 1, concat = 5, port = 6, lang = 3, reply = 2;
        int headerSize = 0, segSize = 0, maxSize = 0;
 
-       if (CodingScheme == SMS_CHARSET_7BIT)
-       {
+       if (CodingScheme == SMS_CHARSET_7BIT) {
                MSG_DEBUG("SMS_CHARSET_7BIT");
                maxSize = MAX_GSM_7BIT_DATA_LEN;
-       }
-       else if (CodingScheme == SMS_CHARSET_8BIT || CodingScheme == SMS_CHARSET_UCS2)
-       {
+       } else if (CodingScheme == SMS_CHARSET_8BIT || CodingScheme == SMS_CHARSET_UCS2) {
                MSG_DEBUG("SMS_CHARSET_8BIT or SMS_CHARSET_UCS2 [%d]", CodingScheme);
                maxSize = MAX_UCS2_DATA_LEN;
        }
 
-       if (bPortNum == true)
-       {
+       if (bPortNum == true) {
                MSG_DEBUG("Port Number Exists");
                headerSize += port;
        }
 
-       if (LangId != MSG_LANG_ID_RESERVED)
-       {
+       if (LangId != MSG_LANG_ID_RESERVED) {
                MSG_DEBUG("National Language Exists");
                headerSize += lang;
        }
 
-       if (ReplyAddrLen > 0)
-       {
+       if (ReplyAddrLen > 0) {
                MSG_DEBUG("Reply Address Exists");
                headerSize += reply;
                headerSize += ReplyAddrLen;
        }
 
-       if (CodingScheme == SMS_CHARSET_7BIT)
-       {
+       if (CodingScheme == SMS_CHARSET_7BIT) {
                if ((DataLen+headerSize) > maxSize)
                        segSize = ((140*8) - ((headerLen + concat + headerSize)*8)) / 7;
                else
                        segSize = DataLen;
-       }
-       else if (CodingScheme == SMS_CHARSET_8BIT || CodingScheme == SMS_CHARSET_UCS2)
-       {
+       } else if (CodingScheme == SMS_CHARSET_8BIT || CodingScheme == SMS_CHARSET_UCS2) {
                if ((DataLen+headerSize) > maxSize)
                        segSize = 140 - (headerLen + concat + headerSize);
                else
@@ -1055,23 +961,22 @@ void SmsPluginTransport::setConcatHeader(SMS_UDH_S *pSrcHeader, SMS_UDH_S *pDstH
 {
        pDstHeader->udhType = pSrcHeader->udhType;
 
-       switch (pDstHeader->udhType)
+       switch (pDstHeader->udhType) {
+       case SMS_UDH_CONCAT_8BIT :
        {
-               case SMS_UDH_CONCAT_8BIT :
-               {
-                       pDstHeader->udh.concat8bit.msgRef = pSrcHeader->udh.concat8bit.msgRef;
-                       pDstHeader->udh.concat8bit.totalSeg = pSrcHeader->udh.concat8bit.totalSeg;
-                       pDstHeader->udh.concat8bit.seqNum = pSrcHeader->udh.concat8bit.seqNum;
-               }
-               break;
+               pDstHeader->udh.concat8bit.msgRef = pSrcHeader->udh.concat8bit.msgRef;
+               pDstHeader->udh.concat8bit.totalSeg = pSrcHeader->udh.concat8bit.totalSeg;
+               pDstHeader->udh.concat8bit.seqNum = pSrcHeader->udh.concat8bit.seqNum;
+       }
+       break;
 
-               case SMS_UDH_CONCAT_16BIT :
-               {
-                       pDstHeader->udh.concat16bit.msgRef = pSrcHeader->udh.concat16bit.msgRef;
-                       pDstHeader->udh.concat16bit.totalSeg = pSrcHeader->udh.concat16bit.totalSeg;
-                       pDstHeader->udh.concat16bit.seqNum = pSrcHeader->udh.concat16bit.seqNum;
-               }
-               break;
+       case SMS_UDH_CONCAT_16BIT :
+       {
+               pDstHeader->udh.concat16bit.msgRef = pSrcHeader->udh.concat16bit.msgRef;
+               pDstHeader->udh.concat16bit.totalSeg = pSrcHeader->udh.concat16bit.totalSeg;
+               pDstHeader->udh.concat16bit.seqNum = pSrcHeader->udh.concat16bit.seqNum;
+       }
+       break;
        }
 }
 
@@ -1096,8 +1001,7 @@ SMS_NETWORK_STATUS_T SmsPluginTransport::getNetStatus()
 
        mx.unlock();
 
-       if (ret == ETIMEDOUT)
-       {
+       if (ret == ETIMEDOUT) {
                MSG_DEBUG("WARNING: SENT STATUS TIME-OUT");
                curStatus = SMS_NETWORK_SEND_FAIL_TIMEOUT;
        }
@@ -1131,8 +1035,7 @@ int SmsPluginTransport::getMoCtrlStatus()
 
        mx.unlock();
 
-       if (ret == ETIMEDOUT)
-       {
+       if (ret == ETIMEDOUT) {
                MSG_DEBUG("WARNING: SENT STATUS TIME-OUT");
                return -1;
        }
@@ -1151,28 +1054,27 @@ SMS_PID_T SmsPluginTransport::convertPid(MSG_SMS_PID_T pid)
 {
        SMS_PID_T retPid;
 
-       switch (pid)
-       {
-               case MSG_PID_TEXT :
-                       retPid = SMS_PID_NORMAL;
+       switch (pid) {
+       case MSG_PID_TEXT :
+               retPid = SMS_PID_NORMAL;
                break;
-               case MSG_PID_VOICE :
-                       retPid = SMS_PID_VOICE;
+       case MSG_PID_VOICE :
+               retPid = SMS_PID_VOICE;
                break;
-               case MSG_PID_FAX :
-                       retPid = SMS_PID_TELEX;
+       case MSG_PID_FAX :
+               retPid = SMS_PID_TELEX;
                break;
-               case MSG_PID_X400 :
-                       retPid = SMS_PID_x400;
+       case MSG_PID_X400 :
+               retPid = SMS_PID_x400;
                break;
-               case MSG_PID_ERMES :
-                       retPid = SMS_PID_ERMES;
+       case MSG_PID_ERMES :
+               retPid = SMS_PID_ERMES;
                break;
-               case MSG_PID_EMAIL :
-                       retPid = SMS_PID_EMAIL;
+       case MSG_PID_EMAIL :
+               retPid = SMS_PID_EMAIL;
                break;
-               default :
-                       retPid = SMS_PID_NORMAL;
+       default :
+               retPid = SMS_PID_NORMAL;
                break;
        }
 
index fb72329..33b1df5 100755 (executable)
@@ -53,8 +53,7 @@ SmsPluginUAManager* SmsPluginUAManager::instance()
 
 void SmsPluginUAManager::run()
 {
-       while (1)
-       {
+       while (1) {
                lock();
                while (smsTranQ.empty()) {
                        wait();
@@ -66,21 +65,16 @@ void SmsPluginUAManager::run()
                request.msgInfo.addressList = NULL;
                unique_ptr<MSG_ADDRESS_INFO_S*, void(*)(MSG_ADDRESS_INFO_S**)> addressListBuf(&request.msgInfo.addressList, unique_ptr_deleter);
 
-               try
-               {
+               try {
                        SmsPluginTransport::instance()->submitRequest(&request);
-               }
-               catch (MsgException& e)
-               {
+               } catch (MsgException& e) {
                        MSG_FATAL("%s", e.what());
 
                        lock();
                        smsTranQ.pop_front();
                        unlock();
                        continue;
-               }
-               catch (exception& e)
-               {
+               } catch (exception& e) {
                        MSG_FATAL("%s", e.what());
                        lock();
                        smsTranQ.pop_front();
index d5b51e6..e43d8a6 100755 (executable)
@@ -40,17 +40,16 @@ int SmsPluginUDCodec::encodeUserData(const SMS_USERDATA_S *pUserData, SMS_CODING
 {
        int encodeSize = 0;
 
-       switch (CodingScheme)
-       {
-               case SMS_CHARSET_7BIT:
-                       encodeSize = encodeGSMData(pUserData, pEncodeData);
-                       break;
-               case SMS_CHARSET_8BIT:
-                       encodeSize = encode8bitData(pUserData, pEncodeData);
-                       break;
-               case SMS_CHARSET_UCS2:
-                       encodeSize = encodeUCS2Data(pUserData, pEncodeData);
-                       break;
+       switch (CodingScheme) {
+       case SMS_CHARSET_7BIT:
+               encodeSize = encodeGSMData(pUserData, pEncodeData);
+               break;
+       case SMS_CHARSET_8BIT:
+               encodeSize = encode8bitData(pUserData, pEncodeData);
+               break;
+       case SMS_CHARSET_UCS2:
+               encodeSize = encodeUCS2Data(pUserData, pEncodeData);
+               break;
        }
 
        return encodeSize;
@@ -63,17 +62,16 @@ int SmsPluginUDCodec::decodeUserData(const unsigned char *pTpdu, const int tpduL
 
        memset(pUserData, 0x00, sizeof(SMS_USERDATA_S));
 
-       switch (CodingScheme)
-       {
-               case SMS_CHARSET_7BIT:
-                       decodeSize = decodeGSMData(pTpdu, tpduLen, bHeaderInd, pUserData, NULL);
-                       break;
-               case SMS_CHARSET_8BIT:
-                       decodeSize = decode8bitData(pTpdu, bHeaderInd, pUserData, NULL);
-                       break;
-               case SMS_CHARSET_UCS2:
-                       decodeSize = decodeUCS2Data(pTpdu, tpduLen, bHeaderInd, pUserData, NULL);
-                       break;
+       switch (CodingScheme) {
+       case SMS_CHARSET_7BIT:
+               decodeSize = decodeGSMData(pTpdu, tpduLen, bHeaderInd, pUserData, NULL);
+               break;
+       case SMS_CHARSET_8BIT:
+               decodeSize = decode8bitData(pTpdu, bHeaderInd, pUserData, NULL);
+               break;
+       case SMS_CHARSET_UCS2:
+               decodeSize = decodeUCS2Data(pTpdu, tpduLen, bHeaderInd, pUserData, NULL);
+               break;
        }
 
        return decodeSize;
@@ -86,20 +84,19 @@ int SmsPluginUDCodec::decodeUserData(const unsigned char *pTpdu, const int tpduL
 
        memset(pUserData, 0x00, sizeof(SMS_USERDATA_S));
 
-       switch (CodingScheme)
-       {
-               case SMS_CHARSET_7BIT:
-                       decodeSize = decodeGSMData(pTpdu, tpduLen, bHeaderInd, pUserData, pTPUD);
-                       break;
-               case SMS_CHARSET_8BIT:
-                       decodeSize = decode8bitData(pTpdu, bHeaderInd, pUserData, pTPUD);
-                       break;
-               case SMS_CHARSET_UCS2:
-                       decodeSize = decodeUCS2Data(pTpdu, tpduLen, bHeaderInd, pUserData, pTPUD);
-                       break;
-               case SMS_CHARSET_EUCKR:
-                       decodeSize = decodeUCS2Data(pTpdu, tpduLen, bHeaderInd, pUserData, pTPUD);
-                       break;
+       switch (CodingScheme) {
+       case SMS_CHARSET_7BIT:
+               decodeSize = decodeGSMData(pTpdu, tpduLen, bHeaderInd, pUserData, pTPUD);
+               break;
+       case SMS_CHARSET_8BIT:
+               decodeSize = decode8bitData(pTpdu, bHeaderInd, pUserData, pTPUD);
+               break;
+       case SMS_CHARSET_UCS2:
+               decodeSize = decodeUCS2Data(pTpdu, tpduLen, bHeaderInd, pUserData, pTPUD);
+               break;
+       case SMS_CHARSET_EUCKR:
+               decodeSize = decodeUCS2Data(pTpdu, tpduLen, bHeaderInd, pUserData, pTPUD);
+               break;
        }
 
        return decodeSize;
@@ -116,38 +113,34 @@ int SmsPluginUDCodec::encodeGSMData(const SMS_USERDATA_S *pUserData, char *pEnco
        else
                offset = 1;
 
-MSG_DEBUG("pUserData->headerCnt [%d]", pUserData->headerCnt);
+       MSG_DEBUG("pUserData->headerCnt [%d]", pUserData->headerCnt);
 
-       // Encode User Data Header
-       for (int i = 0; i < pUserData->headerCnt; i++)
-       {
+       /* Encode User Data Header */
+       for (int i = 0; i < pUserData->headerCnt; i++) {
                headerLen = encodeHeader(pUserData->header[i], &(pEncodeData[offset]));
 
-MSG_DEBUG("headerLen [%d]", headerLen);
+               MSG_DEBUG("headerLen [%d]", headerLen);
 
                udhl += headerLen;
                offset += headerLen;
        }
 
-MSG_DEBUG("udhl [%d]", udhl);
+       MSG_DEBUG("udhl [%d]", udhl);
 
        if (udhl > 0)
-               fillBits = ((udhl+1)*8)%7; // + UDHL
+               fillBits = ((udhl+1)*8)%7; /* + UDHL */
 
        if (fillBits > 0)
                fillBits = 7 - fillBits;
 
-MSG_DEBUG("fillBits [%d]", fillBits);
-MSG_DEBUG("dataLen [%d]", pUserData->length);
+       MSG_DEBUG("fillBits [%d]", fillBits);
+       MSG_DEBUG("dataLen [%d]", pUserData->length);
 
-       // Set UDL, UDHL
-       if (udhl > 0)
-       {
+       /* Set UDL, UDHL */
+       if (udhl > 0) {
                pEncodeData[0] = (((udhl+1)*8) + fillBits + (pUserData->length*7)) / 7;
                pEncodeData[1] =  udhl;
-       }
-       else
-       {
+       } else {
                pEncodeData[0] = (char)pUserData->length;
        }
 
@@ -155,8 +148,8 @@ MSG_DEBUG("dataLen [%d]", pUserData->length);
 
        encodeLen = offset + packSize;
 
-MSG_DEBUG("packSize [%d]", packSize);
-MSG_DEBUG("encodeLen [%d]", encodeLen);
+       MSG_DEBUG("packSize [%d]", packSize);
+       MSG_DEBUG("encodeLen [%d]", encodeLen);
 
 #if 0
 printf("\n\n[encodeGSMData] userData data.\n");
@@ -181,26 +174,22 @@ int SmsPluginUDCodec::encode8bitData(const SMS_USERDATA_S *pUserData, char *pEnc
        else
                offset = 1;
 
-       // Encode User Data Header
-       for (int i = 0; i < pUserData->headerCnt; i++)
-       {
+       /* Encode User Data Header */
+       for (int i = 0; i < pUserData->headerCnt; i++) {
                headerLen = encodeHeader(pUserData->header[i], &(pEncodeData[offset]));
 
                udhl += headerLen;
                offset += headerLen;
        }
 
-MSG_DEBUG("fillBits [%d]", fillBits);
-MSG_DEBUG("dataLen [%d]", pUserData->length);
+       MSG_DEBUG("fillBits [%d]", fillBits);
+       MSG_DEBUG("dataLen [%d]", pUserData->length);
 
-       // Set UDL, UDHL
-       if (udhl > 0)
-       {
+       /* Set UDL, UDHL */
+       if (udhl > 0) {
                pEncodeData[0] = (udhl+1) + fillBits + pUserData->length;
                pEncodeData[1] =  udhl;
-       }
-       else
-       {
+       } else {
                pEncodeData[0] = (char)pUserData->length;
        }
 
@@ -222,26 +211,22 @@ int SmsPluginUDCodec::encodeUCS2Data(const SMS_USERDATA_S *pUserData, char *pEnc
        else
                offset = 1;
 
-       // Encode User Data Header
-       for (int i = 0; i < pUserData->headerCnt; i++)
-       {
+       /* Encode User Data Header */
+       for (int i = 0; i < pUserData->headerCnt; i++) {
                headerLen = encodeHeader(pUserData->header[i], &(pEncodeData[offset]));
 
                udhl += headerLen;
                offset += headerLen;
        }
 
-MSG_DEBUG("fillBits [%d]", fillBits);
-MSG_DEBUG("dataLen [%d]", pUserData->length);
+       MSG_DEBUG("fillBits [%d]", fillBits);
+       MSG_DEBUG("dataLen [%d]", pUserData->length);
 
-       // Set UDL, UDHL
-       if (udhl > 0)
-       {
+       /* Set UDL, UDHL */
+       if (udhl > 0) {
                pEncodeData[0] = (udhl+1) + fillBits + pUserData->length;
                pEncodeData[1] =  udhl;
-       }
-       else
-       {
+       } else {
                pEncodeData[0] = (char)pUserData->length;
        }
 
@@ -266,41 +251,37 @@ int SmsPluginUDCodec::decodeGSMData(const unsigned char *pTpdu, const int tpduLe
 {
        int offset = 0, udl = 0, udhl = 0, headerLen = 0, fillBits = 0, octetUdl = 0;
 
-       // UDL
+       /* UDL */
        udl = pTpdu[offset++];
        octetUdl = (udl*7)/8;
 
-MSG_DEBUG("udl = %d, tpdulen = %d, octetUdl = %d.", udl, tpduLen, octetUdl);
-MSG_DEBUG("bHeaderInd = %d", bHeaderInd);
+       MSG_DEBUG("udl = %d, tpdulen = %d, octetUdl = %d.", udl, tpduLen, octetUdl);
+       MSG_DEBUG("bHeaderInd = %d", bHeaderInd);
 
-       if (udl > MAX_GSM_7BIT_DATA_LEN || octetUdl > tpduLen)
-       {
+       if (udl > MAX_GSM_7BIT_DATA_LEN || octetUdl > tpduLen) {
                pUserData->length = 0;
                pUserData->headerCnt = 0;
                return 0;
        }
 
-       // Setting for Wap Push
-       if (pTPUD != NULL)
-       {
+       /* Setting for Wap Push */
+       if (pTPUD != NULL) {
                pTPUD->udl = udl;
 
                memcpy(pTPUD->ud, &(pTpdu[offset]), udl);
                pTPUD->ud[udl] = '\0';
        }
 
-       // Decode User Data Header
-       if (bHeaderInd == true)
-       {
-               // UDHL
+       /* Decode User Data Header */
+       if (bHeaderInd == true) {
+               /* UDHL */
                udhl = pTpdu[offset++];
 
                MSG_DEBUG("udhl = %d", udhl);
 
                pUserData->headerCnt = 0;
 
-               for (int i = 0; offset < udhl; i++)
-               {
+               for (int i = 0; offset < udhl; i++) {
                        headerLen = decodeHeader(&(pTpdu[offset]), &(pUserData->header[i]));
 
                        if (headerLen <= 0) {
@@ -325,30 +306,25 @@ MSG_DEBUG("bHeaderInd = %d", bHeaderInd);
 
                        pUserData->headerCnt++;
                }
-       }
-       else
+       } else {
                pUserData->headerCnt = 0;
+       }
 
        MSG_DEBUG("headerCnt = %d", pUserData->headerCnt);
 
-       if (udhl > 0)
-       {
+       if (udhl > 0) {
                fillBits = ((udl*7) - ((udhl+1)*8)) % 7;
                udl = ((udl*7) - ((udhl+1)*8)) / 7;
        }
 
-MSG_DEBUG("fillBits = %d", fillBits);
-MSG_DEBUG("udhl = %d", udhl);
-MSG_DEBUG("udl = %d", udl);
+       MSG_DEBUG("fillBits = %d", fillBits);
+       MSG_DEBUG("udhl = %d", udhl);
+       MSG_DEBUG("udl = %d", udl);
 
-MSG_DEBUG("offset = %d", offset);
+       MSG_DEBUG("offset = %d", offset);
 
        pUserData->length = unpack7bitChar(&(pTpdu[offset]), udl, fillBits, pUserData->data);
 
-       //MSG_DEBUG("data = [%s]", pUserData->data);
-       //MSG_DEBUG("length = [%d]", pUserData->length);
-
-
        return pUserData->length;
 }
 
@@ -357,39 +333,35 @@ int SmsPluginUDCodec::decode8bitData(const unsigned char *pTpdu, bool bHeaderInd
 {
        int offset = 0, udl = 0, udhl = 0, headerLen = 0;
 
-       // UDL
+       /* UDL */
        udl = pTpdu[offset++];
 
-       if (udl > MAX_UCS2_DATA_LEN)
-       {
+       if (udl > MAX_UCS2_DATA_LEN) {
                pUserData->length = 0;
                return 0;
        }
 
-       // Setting for Wap Push
-       if (pTPUD != NULL)
-       {
+       /* Setting for Wap Push */
+       if (pTPUD != NULL) {
                pTPUD->udl = udl;
 
                memcpy(pTPUD->ud, &(pTpdu[offset]), udl);
                pTPUD->ud[udl] = '\0';
        }
 
-MSG_DEBUG("udl = %d", udl);
-MSG_DEBUG("bHeaderInd = %d", bHeaderInd);
+       MSG_DEBUG("udl = %d", udl);
+       MSG_DEBUG("bHeaderInd = %d", bHeaderInd);
 
-       // Decode User Data Header
-       if (bHeaderInd == true)
-       {
-               // UDHL
+       /* Decode User Data Header */
+       if (bHeaderInd == true) {
+               /* UDHL */
                udhl = pTpdu[offset++];
 
                MSG_DEBUG("udhl = %d", udhl);
 
                pUserData->headerCnt = 0;
 
-               for (int i = 0; offset < udhl; i++)
-               {
+               for (int i = 0; offset < udhl; i++) {
                        headerLen = decodeHeader(&(pTpdu[offset]), &(pUserData->header[i]));
 
                        if (headerLen <= 0) {
@@ -414,19 +386,19 @@ MSG_DEBUG("bHeaderInd = %d", bHeaderInd);
 
                        pUserData->headerCnt++;
                }
-       }
-       else
+       } else {
                pUserData->headerCnt = 0;
+       }
 
-MSG_DEBUG("headerCnt = %d", pUserData->headerCnt);
+       MSG_DEBUG("headerCnt = %d", pUserData->headerCnt);
 
        if (udhl > 0)
                pUserData->length = (udl) - (udhl+1);
        else
                pUserData->length = udl;
 
-MSG_DEBUG("pUserData->length = %d", pUserData->length);
-MSG_DEBUG("offset = %d", offset);
+       MSG_DEBUG("pUserData->length = %d", pUserData->length);
+       MSG_DEBUG("offset = %d", offset);
 
        memcpy(pUserData->data, &(pTpdu[offset]), pUserData->length);
 
@@ -438,40 +410,36 @@ int SmsPluginUDCodec::decodeUCS2Data(const unsigned char *pTpdu, const int tpduL
 {
        int offset = 0, udl = 0, udhl = 0, headerLen = 0;
 
-       // UDL
+       /* UDL */
        udl = pTpdu[offset++];
 
-MSG_DEBUG("udl = %d, tpdulen = %d.", udl, tpduLen);
-MSG_DEBUG("bHeaderInd = %d", bHeaderInd);
+       MSG_DEBUG("udl = %d, tpdulen = %d.", udl, tpduLen);
+       MSG_DEBUG("bHeaderInd = %d", bHeaderInd);
 
-       if (udl > MAX_UCS2_DATA_LEN || udl > tpduLen)
-       {
+       if (udl > MAX_UCS2_DATA_LEN || udl > tpduLen) {
                pUserData->length = 0;
                pUserData->headerCnt = 0;
                return 0;
        }
 
-       // Setting for Wap Push
-       if (pTPUD != NULL)
-       {
+       /* Setting for Wap Push */
+       if (pTPUD != NULL) {
                pTPUD->udl = udl;
 
                memcpy(pTPUD->ud, &(pTpdu[offset]), udl);
                pTPUD->ud[udl] = '\0';
        }
 
-       // Decode User Data Header
-       if (bHeaderInd == true)
-       {
-               // UDHL
+       /* Decode User Data Header */
+       if (bHeaderInd == true) {
+               /* UDHL */
                udhl = pTpdu[offset++];
 
                MSG_DEBUG("udhl = %d", udhl);
 
                pUserData->headerCnt = 0;
 
-               for (int i = 0; offset < udhl; i++)
-               {
+               for (int i = 0; offset < udhl; i++) {
                        headerLen = decodeHeader(&(pTpdu[offset]), &(pUserData->header[i]));
 
                        if (headerLen <= 0) {
@@ -496,17 +464,17 @@ MSG_DEBUG("bHeaderInd = %d", bHeaderInd);
 
                        pUserData->headerCnt++;
                }
-       }
-       else
+       } else {
                pUserData->headerCnt = 0;
+       }
 
        if (udhl > 0)
                pUserData->length = (udl) - (udhl+1);
        else
                pUserData->length = udl;
 
-MSG_DEBUG("pUserData->length = %d", pUserData->length);
-MSG_DEBUG("offset = %d", offset);
+       MSG_DEBUG("pUserData->length = %d", pUserData->length);
+       MSG_DEBUG("offset = %d", offset);
 
        memcpy(pUserData->data, &(pTpdu[offset]), pUserData->length);
        pUserData->data[pUserData->length] = 0;
@@ -522,117 +490,118 @@ int SmsPluginUDCodec::encodeHeader(const SMS_UDH_S header, char *pEncodeHeader)
        char* encodedAddr = NULL;
        unique_ptr<char*, void(*)(char**)> addressBuf(&encodedAddr, unique_ptr_deleter);
 
-       switch (header.udhType)
-       {
-               case SMS_UDH_CONCAT_8BIT :
-                       // IEI
-                       pEncodeHeader[offset++] = SMS_UDH_CONCAT_8BIT;
+       switch (header.udhType) {
+       case SMS_UDH_CONCAT_8BIT :
+               /* IEI */
+               pEncodeHeader[offset++] = SMS_UDH_CONCAT_8BIT;
+
+               /* IEDL */
+               pEncodeHeader[offset++] = 0x03;
 
-                       // IEDL
-                       pEncodeHeader[offset++] = 0x03;
+               /* Reference Number */
+               pEncodeHeader[offset++] = header.udh.concat8bit.msgRef;
 
-                       // Reference Number
-                       pEncodeHeader[offset++] = header.udh.concat8bit.msgRef;
+               /* Number of Segments */
+               pEncodeHeader[offset++] = header.udh.concat8bit.totalSeg;
 
-                       // Number of Segments
-                       pEncodeHeader[offset++] = header.udh.concat8bit.totalSeg;
+               /* Sequence Number */
+               pEncodeHeader[offset++] = header.udh.concat8bit.seqNum;
 
-                       // Sequence Number
-                       pEncodeHeader[offset++] = header.udh.concat8bit.seqNum;
                break;
 
-               case SMS_UDH_CONCAT_16BIT :
-                       // IEI
-                       pEncodeHeader[offset++] = SMS_UDH_CONCAT_16BIT;
+       case SMS_UDH_CONCAT_16BIT :
+               /* IEI */
+               pEncodeHeader[offset++] = SMS_UDH_CONCAT_16BIT;
 
-                       // IEDL
-                       pEncodeHeader[offset++] = 0x04;
+               /* IEDL */
+               pEncodeHeader[offset++] = 0x04;
 
-                       // Reference Number
-                       pEncodeHeader[offset++] = (char)(header.udh.concat16bit.msgRef >> 8);
-                       pEncodeHeader[offset++] = header.udh.concat16bit.msgRef & 0x00FF;
+               /* Reference Number */
+               pEncodeHeader[offset++] = (char)(header.udh.concat16bit.msgRef >> 8);
+               pEncodeHeader[offset++] = header.udh.concat16bit.msgRef & 0x00FF;
 
-                       // Number of Segments
-                       pEncodeHeader[offset++] = header.udh.concat16bit.totalSeg;
+               /* Number of Segments */
+               pEncodeHeader[offset++] = header.udh.concat16bit.totalSeg;
+
+               /* Sequence Number */
+               pEncodeHeader[offset++] = header.udh.concat16bit.seqNum;
 
-                       // Sequence Number
-                       pEncodeHeader[offset++] = header.udh.concat16bit.seqNum;
                break;
 
-               case SMS_UDH_APP_PORT_8BIT :
-                       // IEI
-                       pEncodeHeader[offset++] = SMS_UDH_APP_PORT_8BIT;
+       case SMS_UDH_APP_PORT_8BIT :
+               /* IEI */
+               pEncodeHeader[offset++] = SMS_UDH_APP_PORT_8BIT;
+
+               /* IEDL */
+               pEncodeHeader[offset++] = 0x02;
 
-                       // IEDL
-                       pEncodeHeader[offset++] = 0x02;
+               /* Dest Port */
+               pEncodeHeader[offset++] = header.udh.appPort8bit.destPort;
 
-                       // Dest Port
-                       pEncodeHeader[offset++] = header.udh.appPort8bit.destPort;
+               /* Origin Port */
+               pEncodeHeader[offset++] = header.udh.appPort8bit.originPort;
 
-                       // Origin Port
-                       pEncodeHeader[offset++] = header.udh.appPort8bit.originPort;
                break;
 
-               case SMS_UDH_APP_PORT_16BIT :
-                       // IEI
-                       pEncodeHeader[offset++] = SMS_UDH_APP_PORT_16BIT;
+       case SMS_UDH_APP_PORT_16BIT :
+               /* IEI */
+               pEncodeHeader[offset++] = SMS_UDH_APP_PORT_16BIT;
 
-                       // IEDL
-                       pEncodeHeader[offset++] = 0x04;
+               /* IEDL */
+               pEncodeHeader[offset++] = 0x04;
 
-                       // Dest Port
-                       pEncodeHeader[offset++] = (char)(header.udh.appPort16bit.destPort >> 8);
-                       pEncodeHeader[offset++] = header.udh.appPort16bit.destPort & 0x00FF;
+               /* Dest Port */
+               pEncodeHeader[offset++] = (char)(header.udh.appPort16bit.destPort >> 8);
+               pEncodeHeader[offset++] = header.udh.appPort16bit.destPort & 0x00FF;
 
-                       // Origin Port
-                       pEncodeHeader[offset++] = (char)(header.udh.appPort16bit.originPort >> 8);
-                       pEncodeHeader[offset++] = header.udh.appPort16bit.originPort & 0x00FF;
-               break;
+               /* Origin Port */
+               pEncodeHeader[offset++] = (char)(header.udh.appPort16bit.originPort >> 8);
+               pEncodeHeader[offset++] = header.udh.appPort16bit.originPort & 0x00FF;
 
-               case SMS_UDH_ALTERNATE_REPLY_ADDRESS :
-                       // IEI
-                       pEncodeHeader[offset++] = SMS_UDH_ALTERNATE_REPLY_ADDRESS;
+               break;
 
-                       addrLen = SmsPluginParamCodec::encodeAddress(&(header.udh.alternateAddress), &encodedAddr);
+       case SMS_UDH_ALTERNATE_REPLY_ADDRESS :
+               /* IEI */
+               pEncodeHeader[offset++] = SMS_UDH_ALTERNATE_REPLY_ADDRESS;
 
-//MSG_DEBUG("addrLen : %d", addrLen);
+               addrLen = SmsPluginParamCodec::encodeAddress(&(header.udh.alternateAddress), &encodedAddr);
 
-//for (int i = 0; i < addrLen; i++)
-//     MSG_DEBUG("header.udh.alternateAddress.address : [%02x]", encodedAddr[i]);
+               /* IEDL */
+               pEncodeHeader[offset++] = addrLen;
 
-                       // IEDL
-                       pEncodeHeader[offset++] = addrLen;
+               /* Alternate Reply Address */
+               memcpy(&pEncodeHeader[offset], encodedAddr, addrLen);
 
-                       // Alternate Reply Address
-                       memcpy(&pEncodeHeader[offset], encodedAddr, addrLen);
+               offset += addrLen;
 
-                       offset += addrLen;
                break;
 
-               case SMS_UDH_SINGLE_SHIFT :
-                       // IEI
-                       pEncodeHeader[offset++] = SMS_UDH_SINGLE_SHIFT;
+       case SMS_UDH_SINGLE_SHIFT :
+               /* IEI */
+               pEncodeHeader[offset++] = SMS_UDH_SINGLE_SHIFT;
 
-                       // IEDL
-                       pEncodeHeader[offset++] = 0x01;
+               /* IEDL */
+               pEncodeHeader[offset++] = 0x01;
+
+               /* National Language Identifier */
+               pEncodeHeader[offset++] = header.udh.singleShift.langId;
 
-                       // National Language Identifier
-                       pEncodeHeader[offset++] = header.udh.singleShift.langId;
                break;
 
-               case SMS_UDH_LOCKING_SHIFT :
-                       // IEI
-                       pEncodeHeader[offset++] = SMS_UDH_LOCKING_SHIFT;
+       case SMS_UDH_LOCKING_SHIFT :
+               /* IEI */
+               pEncodeHeader[offset++] = SMS_UDH_LOCKING_SHIFT;
+
+               /* IEDL */
+               pEncodeHeader[offset++] = 0x01;
 
-                       // IEDL
-                       pEncodeHeader[offset++] = 0x01;
+               /* National Language Identifier */
+               pEncodeHeader[offset++] = header.udh.lockingShift.langId;
 
-                       // National Language Identifier
-                       pEncodeHeader[offset++] = header.udh.lockingShift.langId;
                break;
 
-               case SMS_UDH_NONE :
-               default :
+       case SMS_UDH_NONE :
+       default :
                break;
        }
 
@@ -647,130 +616,138 @@ int SmsPluginUDCodec::decodeHeader(const unsigned char *pTpdu, SMS_UDH_S *pHeade
 
        pHeader->udhType = pTpdu[offset++];
 
-       switch (pHeader->udhType)
+       switch (pHeader->udhType) {
+       case SMS_UDH_CONCAT_8BIT :
        {
-               case SMS_UDH_CONCAT_8BIT :
-               {
-                       IEDL = pTpdu[offset++];
+               IEDL = pTpdu[offset++];
 
-                       if (IEDL == 0) return 0;
+               if (IEDL == 0)
+                       return 0;
 
-                       pHeader->udh.concat8bit.msgRef = pTpdu[offset++];
-                       pHeader->udh.concat8bit.totalSeg = pTpdu[offset++];
-                       pHeader->udh.concat8bit.seqNum = pTpdu[offset++];
+               pHeader->udh.concat8bit.msgRef = pTpdu[offset++];
+               pHeader->udh.concat8bit.totalSeg = pTpdu[offset++];
+               pHeader->udh.concat8bit.seqNum = pTpdu[offset++];
 
-MSG_DEBUG("concat8bit.msgRef [%02x]", pHeader->udh.concat8bit.msgRef);
-MSG_DEBUG("concat8bit.totalSeg [%02x]", pHeader->udh.concat8bit.totalSeg);
-MSG_DEBUG("concat8bit.seqNum [%02x]", pHeader->udh.concat8bit.seqNum);
-               }
-               break;
+               MSG_DEBUG("concat8bit.msgRef [%02x]", pHeader->udh.concat8bit.msgRef);
+               MSG_DEBUG("concat8bit.totalSeg [%02x]", pHeader->udh.concat8bit.totalSeg);
+               MSG_DEBUG("concat8bit.seqNum [%02x]", pHeader->udh.concat8bit.seqNum);
+       }
+       break;
 
-               case SMS_UDH_CONCAT_16BIT :
-               {
-                       IEDL = pTpdu[offset++];
+       case SMS_UDH_CONCAT_16BIT :
+       {
+               IEDL = pTpdu[offset++];
 
-                       if (IEDL == 0) return 0;
+               if (IEDL == 0)
+                       return 0;
 
-                       pHeader->udh.concat16bit.msgRef = pTpdu[offset++];
-                       pHeader->udh.concat16bit.msgRef = (unsigned short)((pHeader->udh.concat16bit.msgRef << 8) | pTpdu[offset++]);
-                       pHeader->udh.concat16bit.totalSeg = pTpdu[offset++];
-                       pHeader->udh.concat16bit.seqNum = pTpdu[offset++];
+               pHeader->udh.concat16bit.msgRef = pTpdu[offset++];
+               pHeader->udh.concat16bit.msgRef = (unsigned short)((pHeader->udh.concat16bit.msgRef << 8) | pTpdu[offset++]);
+               pHeader->udh.concat16bit.totalSeg = pTpdu[offset++];
+               pHeader->udh.concat16bit.seqNum = pTpdu[offset++];
 
-MSG_DEBUG("concat16bit.msgRef [%04x]", pHeader->udh.concat16bit.msgRef);
-MSG_DEBUG("concat16bit.totalSeg [%02x]", pHeader->udh.concat16bit.totalSeg);
-MSG_DEBUG("concat16bit.seqNum [%02x]", pHeader->udh.concat16bit.seqNum);
-               }
-               break;
+               MSG_DEBUG("concat16bit.msgRef [%04x]", pHeader->udh.concat16bit.msgRef);
+               MSG_DEBUG("concat16bit.totalSeg [%02x]", pHeader->udh.concat16bit.totalSeg);
+               MSG_DEBUG("concat16bit.seqNum [%02x]", pHeader->udh.concat16bit.seqNum);
+       }
+       break;
 
-               case SMS_UDH_APP_PORT_8BIT :
-               {
-                       IEDL = pTpdu[offset++];
+       case SMS_UDH_APP_PORT_8BIT :
+       {
+               IEDL = pTpdu[offset++];
 
-                       if (IEDL == 0) return 0;
+               if (IEDL == 0)
+                       return 0;
 
-                       pHeader->udh.appPort8bit.destPort = pTpdu[offset++];
-                       pHeader->udh.appPort8bit.originPort = pTpdu[offset++];
+               pHeader->udh.appPort8bit.destPort = pTpdu[offset++];
+               pHeader->udh.appPort8bit.originPort = pTpdu[offset++];
 
-MSG_DEBUG("appPort8bit.destPort [%02x]", pHeader->udh.appPort8bit.destPort);
-MSG_DEBUG("appPort8bit.originPort [%02x]", pHeader->udh.appPort8bit.originPort);
-               }
-               break;
+               MSG_DEBUG("appPort8bit.destPort [%02x]", pHeader->udh.appPort8bit.destPort);
+               MSG_DEBUG("appPort8bit.originPort [%02x]", pHeader->udh.appPort8bit.originPort);
+       }
+       break;
 
-               case SMS_UDH_APP_PORT_16BIT :
-               {
-                       IEDL = pTpdu[offset++];
+       case SMS_UDH_APP_PORT_16BIT :
+       {
+               IEDL = pTpdu[offset++];
 
-                       if (IEDL == 0) return 0;
+               if (IEDL == 0)
+                       return 0;
 
-                       pHeader->udh.appPort16bit.destPort = pTpdu[offset++];
-                       pHeader->udh.appPort16bit.destPort = (unsigned short)((pHeader->udh.appPort16bit.destPort << 8) | pTpdu[offset++]);
-                       pHeader->udh.appPort16bit.originPort = pTpdu[offset++];
-                       pHeader->udh.appPort16bit.originPort = (unsigned short)((pHeader->udh.appPort16bit.originPort << 8) | pTpdu[offset++]);
+               pHeader->udh.appPort16bit.destPort = pTpdu[offset++];
+               pHeader->udh.appPort16bit.destPort = (unsigned short)((pHeader->udh.appPort16bit.destPort << 8) | pTpdu[offset++]);
+               pHeader->udh.appPort16bit.originPort = pTpdu[offset++];
+               pHeader->udh.appPort16bit.originPort = (unsigned short)((pHeader->udh.appPort16bit.originPort << 8) | pTpdu[offset++]);
 
-MSG_DEBUG("appPort16bit.destPort [%04x]", pHeader->udh.appPort16bit.destPort);
-MSG_DEBUG("appPort16bit.originPort [%04x]", pHeader->udh.appPort16bit.originPort);
-               }
-               break;
+               MSG_DEBUG("appPort16bit.destPort [%04x]", pHeader->udh.appPort16bit.destPort);
+               MSG_DEBUG("appPort16bit.originPort [%04x]", pHeader->udh.appPort16bit.originPort);
+       }
+       break;
 
-               case SMS_UDH_SPECIAL_SMS :
-               {
-                       IEDL = pTpdu[offset++];
+       case SMS_UDH_SPECIAL_SMS :
+       {
+               IEDL = pTpdu[offset++];
 
-                       if (IEDL != 2) return 0;
-MSG_DEBUG("Decoding special sms udh.");
+               if (IEDL != 2)
+                       return 0;
 
-                       pHeader->udh.specialInd.bStore = (bool) (pTpdu[offset] & 0x80);
-                       pHeader->udh.specialInd.msgInd = (unsigned short) (pTpdu[offset++] & 0x7F);
-                       pHeader->udh.specialInd.waitMsgNum = (unsigned short) pTpdu[offset];
-               }
-               break;
+               MSG_DEBUG("Decoding special sms udh.");
 
-               case SMS_UDH_ALTERNATE_REPLY_ADDRESS :
-               {
-                       IEDL = pTpdu[offset++];
+               pHeader->udh.specialInd.bStore = (bool) (pTpdu[offset] & 0x80);
+               pHeader->udh.specialInd.msgInd = (unsigned short) (pTpdu[offset++] & 0x7F);
+               pHeader->udh.specialInd.waitMsgNum = (unsigned short) pTpdu[offset];
+       }
+       break;
 
-                       if (IEDL == 0) return 0;
+       case SMS_UDH_ALTERNATE_REPLY_ADDRESS :
+       {
+               IEDL = pTpdu[offset++];
 
-                       offset += SmsPluginParamCodec::decodeAddress(&pTpdu[offset], &(pHeader->udh.alternateAddress));
+               if (IEDL == 0)
+                       return 0;
 
-                       MSG_SEC_DEBUG("alternate reply address [%s]", pHeader->udh.alternateAddress.address);
-               }
-               break;
+               offset += SmsPluginParamCodec::decodeAddress(&pTpdu[offset], &(pHeader->udh.alternateAddress));
 
-               case SMS_UDH_SINGLE_SHIFT :
-               {
-                       IEDL = pTpdu[offset++];
+               MSG_SEC_DEBUG("alternate reply address [%s]", pHeader->udh.alternateAddress.address);
+       }
+       break;
 
-                       if (IEDL == 0) return 0;
+       case SMS_UDH_SINGLE_SHIFT :
+       {
+               IEDL = pTpdu[offset++];
 
-                       pHeader->udh.singleShift.langId = pTpdu[offset++];
+               if (IEDL == 0)
+                       return 0;
 
-MSG_DEBUG("singleShift.langId [%02x]", pHeader->udh.singleShift.langId);
-               }
-               break;
+               pHeader->udh.singleShift.langId = pTpdu[offset++];
 
-               case SMS_UDH_LOCKING_SHIFT :
-               {
-                       IEDL = pTpdu[offset++];
+               MSG_DEBUG("singleShift.langId [%02x]", pHeader->udh.singleShift.langId);
+       }
+       break;
 
-                       if (IEDL == 0) return 0;
+       case SMS_UDH_LOCKING_SHIFT :
+       {
+               IEDL = pTpdu[offset++];
 
-                       pHeader->udh.lockingShift.langId = pTpdu[offset++];
+               if (IEDL == 0)
+                       return 0;
 
-MSG_DEBUG("lockingShift.langId [%02x]", pHeader->udh.lockingShift.langId);
-               }
-               break;
+               pHeader->udh.lockingShift.langId = pTpdu[offset++];
 
-               default :
-               {
-                       MSG_DEBUG("Not Supported Header Type [%02x]", pHeader->udhType);
+               MSG_DEBUG("lockingShift.langId [%02x]", pHeader->udh.lockingShift.langId);
+       }
+       break;
 
-                       IEDL = pTpdu[offset++];
+       default :
+       {
+               MSG_DEBUG("Not Supported Header Type [%02x]", pHeader->udhType);
 
-                       MSG_DEBUG("IEDL [%d]", IEDL);
-                       return (offset + IEDL);
-               }
-               break;
+               IEDL = pTpdu[offset++];
+
+               MSG_DEBUG("IEDL [%d]", IEDL);
+               return (offset + IEDL);
+       }
+       break;
        }
 
        return offset;
@@ -781,60 +758,37 @@ int SmsPluginUDCodec::pack7bitChar(const unsigned char *pUserData, int dataLen,
 {
        int srcIdx = 0, dstIdx = 0, shift = fillBits;
 
-//MSG_DEBUG("dataLen = %d", dataLen);
-
        if (shift > 0)
                dstIdx = 1;
 
-       while (srcIdx < dataLen)
-       {
-               if (shift == 0)
-               {
-//                     if (srcIdx > 0) srcIdx++;
-
-//MSG_DEBUG("pUserData [%02x]", pUserData[srcIdx]);
-//MSG_DEBUG("shift = %d", shift);
-
+       while (srcIdx < dataLen) {
+               if (shift == 0) {
                        pPackData[dstIdx] = pUserData[srcIdx];
 
-//MSG_DEBUG("pPackData [%02x]", pPackData[dstIdx]);
                        shift = 7;
                        srcIdx++;
                        dstIdx++;
 
-                       if (srcIdx >= dataLen) break;
+                       if (srcIdx >= dataLen)
+                               break;
                }
 
-               if (shift > 1)
-               {
-//MSG_DEBUG("pUserData [%02x]", pUserData[srcIdx]);
-
-//MSG_DEBUG("shift = %d", shift);
-
+               if (shift > 1) {
                        pPackData[dstIdx-1] |= pUserData[srcIdx] << shift;
                        pPackData[dstIdx] = pUserData[srcIdx] >> (8-shift);
                        shift--;
-//MSG_DEBUG("pPackData [%02x]", pPackData[dstIdx]);
 
                        srcIdx++;
                        dstIdx++;
-               }
-               else if (shift == 1)
-               {
-//MSG_DEBUG("pUserData [%02x]", pUserData[srcIdx]);
-//MSG_DEBUG("shift = %d", shift);
+               } else if (shift == 1) {
                        pPackData[dstIdx-1] |= pUserData[srcIdx] << shift;
 
-//MSG_DEBUG("pPackData [%02x]", pPackData[dstIdx-1]);
-
                        srcIdx++;
 
                        shift--;
                }
        }
 
-//MSG_DEBUG("dstIdx = %d", dstIdx);
-
        return dstIdx;
 }
 
@@ -848,35 +802,27 @@ MSG_DEBUG("dataLen = %d", dataLen);
        if (shift > 0)
                srcIdx = 1;
 
-       for (; dstIdx < dataLen; dstIdx++)
-       {
-               if (shift == 0)
-               {
-//MSG_DEBUG("shift = %d", shift);
-
+       for (; dstIdx < dataLen; dstIdx++) {
+               if (shift == 0) {
                        pUnpackData[dstIdx] = pTpdu[srcIdx] & 0x7F;
 
-//MSG_DEBUG("UserData[%d] = %02x", dstIdx, pUnpackData[dstIdx]);
                        shift = 7;
                        srcIdx++;
                        dstIdx++;
 
-                       if (dstIdx >= dataLen) break;
+                       if (dstIdx >= dataLen)
+                               break;
                }
 
-               if (shift > 0)
-               {
-//MSG_DEBUG("shift = %d", shift);
-
+               if (shift > 0) {
                        pUnpackData[dstIdx] = (pTpdu[srcIdx-1] >> shift) + (pTpdu[srcIdx] << (8 - shift));
 
                        pUnpackData[dstIdx] &= 0x7F;
 
-//MSG_DEBUG("UserData[%d] = %02x", dstIdx, pUnpackData[dstIdx]);
-
                        shift--;
 
-                       if (shift > 0) srcIdx++;
+                       if (shift > 0)
+                               srcIdx++;
                }
        }
 
index 98de445..99070de 100755 (executable)
@@ -83,7 +83,7 @@ const SMS_PUSH_APP_INFO_S pushDefaultApplication [] =
 char gWapCodeBufferLeft[WSP_CODE_BUFFER_LEFT_LEN_MAX];
 char gWapCodeBufferRight[WSP_CODE_BUFFER_RIGHT_LEN_MAX];
 
-const unsigned long wspUintvarDecodeTable[] = { 0x00000001, 0x00000080, 0x00004000, 0x00200000, 0x10000000};
+const unsigned long wspUintvarDecodeTable[] = { 0x00000001, 0x00000080, 0x00004000, 0x00200000, 0x10000000 };
 
 const unsigned char wspHeaderFieldCount  = 0x43;
 const unsigned char wspContentsTypeCount = 0x34;
@@ -91,8 +91,7 @@ const unsigned long wspLanguageCount    = 0x11a;
 const unsigned char wspSecurityTypeCount = 0x04;
 
 
-static const SMS_WSP_CONTENTS_TYPE_S wspExtendedContentsType[] =
-{
+static const SMS_WSP_CONTENTS_TYPE_S wspExtendedContentsType[] = {
        { (char*)"text/vnd/wap/connectivity-xml", 0x35 },
        { (char*)"application/vnd.wap.connectivity-wbxml", 0x36 },
        { (char*)"application/pkcs7-mime",  0x37 },
@@ -125,81 +124,79 @@ static const SMS_WSP_CONTENTS_TYPE_S wspExtendedContentsType[] =
 };
 
 
-const char* wspHeaderFieldName[] =
-{
-       (char*)"Accept",  //0x00
+const char* wspHeaderFieldName[] = {
+       (char*)"Accept",  /* 0x00 */
        (char*)"Accept-Charset",
        (char*)"Accept-Encoding",
        (char*)"Accept-Language",
        (char*)"Accept-Ranges",
-       (char*)"Age", //0x05
+       (char*)"Age", /* 0x05 */
        (char*)"Allow",
        (char*)"Authorization",
        (char*)"Cache-Control",
        (char*)"Connection",
-       (char*)"Content-Base", //0x0a
+       (char*)"Content-Base", /* 0x0a */
        (char*)"Content-Encoding",
        (char*)"Content-Language",
        (char*)"Content-Length",
        (char*)"Content-Location",
        (char*)"Content-MD5",
-       (char*)"Content-Range", //0x10
+       (char*)"Content-Range", /* 0x10 */
        (char*)"Content-Type",
        (char*)"Date",
        (char*)"ETag",
        (char*)"Expires",
-       (char*)"From", //0x15
+       (char*)"From", /* 0x15 */
        (char*)"Host",
        (char*)"If-Modified-Since",
        (char*)"If-Match",
        (char*)"If-None-Match",
-       (char*)"If-Range", //0x1a
+       (char*)"If-Range", /* 0x1a */
        (char*)"If-Unmodified-Since",
        (char*)"Location",
        (char*)"Last-Modified",
        (char*)"Max-Forwards",
        (char*)"Pragma",
-       (char*)"Proxy-Authenticate", //0x20
+       (char*)"Proxy-Authenticate", /* 0x20 */
        (char*)"Proxy-Authorization",
        (char*)"Public",
        (char*)"Range",
        (char*)"Referer",
-       (char*)"Retry-After", //0x25
+       (char*)"Retry-After", /* 0x25 */
        (char*)"Server",
        (char*)"Transfer-Encodig",
        (char*)"Upgrade",
        (char*)"User-Agent",
-       (char*)"Vary", //0x2a
+       (char*)"Vary", /* 0x2a */
        (char*)"Via",
        (char*)"Warning",
        (char*)"Www-Authenticate",
        (char*)"Content-Disposition",
        (char*)"X-Wap-Application-Id",
-       (char*)"X-Wap-Content-URI", //0x30
+       (char*)"X-Wap-Content-URI", /* 0x30 */
        (char*)"X-Wap-Iinitiator-URI",
-       (char*)"Accept-Application", // Back
+       (char*)"Accept-Application", /* Back */
        (char*)"Bearer-Indication",
        (char*)"Push-Flag",
-       (char*)"Profile", //0x35
+       (char*)"Profile", /* 0x35 */
        (char*)"Profile-Diff",
-       (char*)"Profile-Warning", // end of WAP 1.2
+       (char*)"Profile-Warning", /* end of WAP 1.2 */
        (char*)"Expect",
        (char*)"Te",
-       (char*)"Trailer", //0x3a
-       (char*)"Accept-Charset", //Back
-       (char*)"Accept-Encoding", // Back
-       (char*)"Cache-Control", // back
+       (char*)"Trailer", /* 0x3a */
+       (char*)"Accept-Charset", /* Back */
+       (char*)"Accept-Encoding", /* Back */
+       (char*)"Cache-Control", /* back */
        (char*)"Content-Range",
        (char*)"X-Wap-Tod",
-       (char*)"Content-ID", //x40
+       (char*)"Content-ID", /* 0x40 */
        (char*)"Set-Cookie",
        (char*)"Cookie",
        (char*)"Encoding-Version"
 };
 
 
-const SMS_WSP_CHARSET_S wspCharset[] =
-{
+const SMS_WSP_CHARSET_S wspCharset[] = {
        { (char*)"big5", 0x07ea },
        { (char*)"iso-10646-ucs-2", 0x03e8 },
        { (char*)"iso-8859-1", 0x04 },
@@ -220,16 +217,14 @@ const SMS_WSP_CHARSET_S wspCharset[] =
 
 
 
-const char* wspEncodeMethod[] =
-{
+const char* wspEncodeMethod[] = {
        (char*)"Gzip",
        (char*)"Compress",
        (char*)"Deflate"
 };
 
 
-const SMS_WSP_CONTENTS_TYPE_S wspContentsType[] =
-{
+const SMS_WSP_CONTENTS_TYPE_S wspContentsType[] = {
        { (char*)"*/*", 0x00 },
        { (char*)"text/*", 0x01 },
        { (char*)"text/html", 0x02 },
@@ -306,8 +301,7 @@ const SMS_WSP_CONTENTS_TYPE_S wspContentsType[] =
        { (char*)"application/vnd.wv.csp.cir", 0x46 }
 };
 
-static const SMS_WAP_UNREGISTER_CONTENTS_TYPE_S wspUnregisterContentsType[]=
-{
+static const SMS_WAP_UNREGISTER_CONTENTS_TYPE_S wspUnregisterContentsType[]= {
        { (char*)"application/vnd.wap.emn+wbxml", 0x30A},
        { (char*)"application/vnd.omaloc-supl-init", 0x312},
        { (char*)"application/vnd.oma.drm.roap-trigger+wbxml", 0x316}
@@ -315,8 +309,7 @@ static const SMS_WAP_UNREGISTER_CONTENTS_TYPE_S wspUnregisterContentsType[]=
 
 const unsigned long wspUnregisteredContentsTypeCount = sizeof(wspUnregisterContentsType)/sizeof(SMS_WAP_UNREGISTER_CONTENTS_TYPE_S);
 
-const SMS_WSP_LANGUAGE_S wspLanguage[] =
-{
+const SMS_WSP_LANGUAGE_S wspLanguage[] = {
        { (char*)"English", 0x19 },
        { (char*)"en", 0x19 },
        { (char*)"Korean", 0x3d },
@@ -603,8 +596,7 @@ const SMS_WSP_LANGUAGE_S wspLanguage[] =
 };
 
 
-const SMS_WSP_HEADER_PARAMETER_S wspHeaderApplId[] =
-{
+const SMS_WSP_HEADER_PARAMETER_S wspHeaderApplId[] = {
        { (char*)"x-wap-application:*",  0x00 },
        { (char*)"x-wap-application:push.sia",  0x01},
        { (char*)"x-wap-application:wml.ua",  0x02 },
@@ -633,8 +625,7 @@ const SMS_WSP_HEADER_PARAMETER_S wspHeaderApplId[] =
 };
 
 
-const char* wspCacheControl[] =
-{
+const char* wspCacheControl[] = {
        (char*)"No-cache",
        (char*)"No-store",
        (char*)"Max-age",
@@ -648,8 +639,7 @@ const char* wspCacheControl[] =
        (char*)"Proxy-revalidate"
 };
 
-const SMS_WSP_METHOD_TYPE_S wspMethodType[] =
-{
+const SMS_WSP_METHOD_TYPE_S wspMethodType[] = {
        { (char*)"GET", 0x40 },
        { (char*)"OPTIONS", 0x41 },
        { (char*)"HEAD", 0x42 },
@@ -660,8 +650,7 @@ const SMS_WSP_METHOD_TYPE_S wspMethodType[] =
 };
 
 
-const SMS_WSP_SECURITY_TYPE_S wspSecurityType[] =
-{
+const SMS_WSP_SECURITY_TYPE_S wspSecurityType[] = {
        {(char*)"NETWPIN",0x00},
        {(char*)"USERPIN",0x01},
        {(char*)"USERNETWPIN",0x02},
@@ -670,8 +659,7 @@ const SMS_WSP_SECURITY_TYPE_S wspSecurityType[] =
 
 
 
-const char* wspWeek[] =
-{
+const char* wspWeek[] = {
        (char*)"Sun",
        (char*)"Mon",
        (char*)"Tue",
@@ -682,8 +670,7 @@ const char* wspWeek[] =
 };
 
 
-const char* wspWeekDay[] =
-{
+const char* wspWeekDay[] = {
        (char*)"Sunday",
        (char*)"Monday",
        (char*)"Tuesday",
@@ -693,8 +680,7 @@ const char* wspWeekDay[] =
        (char*)"Saturday"
 };
 
-const char* wspMonth[] =
-{
+const char* wspMonth[] = {
        (char*)"Jan",
        (char*)"Feb",
        (char*)"Mar",
@@ -748,7 +734,7 @@ bool SmsPluginWapPushHandler::IsWapPushMsg(SMS_USERDATA_S *pUserData)
                return false;
        }
 
-       int PortCount = sizeof(wapPushPortList)/sizeof(wapPushPortList[0]);
+       int PortCount = sizeof(wapPushPortList) / sizeof(wapPushPortList[0]);
 
        MSG_DEBUG("Port Count [%d]", PortCount);
 
@@ -864,7 +850,7 @@ void SmsPluginWapPushHandler::handleWapPushMsg(const char *pUserData, int DataSi
        /** pass PDU type */
        iPDU++;
 
-       pushHeaderLen = wspRetriveUintvarDecode( pPDUTypeData, &iPDU );
+       pushHeaderLen = wspRetriveUintvarDecode(pPDUTypeData, &iPDU);
 
        MSG_DEBUG("PDUTypeDataLen [%d]", PDUTypeDataLen);
        MSG_DEBUG("pushHeaderLen [%d]", pushHeaderLen);
@@ -1104,91 +1090,91 @@ static void launchProcessByAppcode(int appcode)
        GVariant *result_agent = NULL;
        GVariant *result_service = NULL;
 
-       switch(appcode){
-               case SMS_WAP_APPLICATION_SYNCML_DM_BOOTSTRAP:
-               case SMS_WAP_APPLICATION_SYNCML_DM_BOOTSTRAP_XML:
-               case SMS_WAP_APPLICATION_PUSH_PROVISIONING_XML:
-               case SMS_WAP_APPLICATION_PUSH_PROVISIONING_WBXML:
-               case SMS_WAP_APPLICATION_PUSH_BROWSER_SETTINGS:
-               case SMS_WAP_APPLICATION_PUSH_BROWSER_BOOKMARKS:
-               case SMS_WAP_APPLICATION_SYNCML_DM_NOTIFICATION:
-                       {
-                               connection_agent = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
-                               if (error) {
-                                       MSG_DEBUG("Connecting to system bus failed: %s\n", error->message);
-                                       goto _DBUS_ERROR;
-                               }
+       switch (appcode){
+       case SMS_WAP_APPLICATION_SYNCML_DM_BOOTSTRAP:
+       case SMS_WAP_APPLICATION_SYNCML_DM_BOOTSTRAP_XML:
+       case SMS_WAP_APPLICATION_PUSH_PROVISIONING_XML:
+       case SMS_WAP_APPLICATION_PUSH_PROVISIONING_WBXML:
+       case SMS_WAP_APPLICATION_PUSH_BROWSER_SETTINGS:
+       case SMS_WAP_APPLICATION_PUSH_BROWSER_BOOKMARKS:
+       case SMS_WAP_APPLICATION_SYNCML_DM_NOTIFICATION:
+               {
+                       connection_agent = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
+                       if (error) {
+                               MSG_DEBUG("Connecting to system bus failed: %s\n", error->message);
+                               goto _DBUS_ERROR;
+                       }
 
-                               dbus_proxy_agent = g_dbus_proxy_new_sync(connection_agent, G_DBUS_PROXY_FLAGS_NONE,
-                                                                                       NULL, "org.tizen.omadmagent", "/org/tizen/omadmagent",
-                                                                                       "org.tizen.omadmagent", NULL, &error);
-                               if (error) {
-                                       MSG_DEBUG("Connecting to agent proxy failed: %s\n", error->message);
-                                       goto _DBUS_ERROR;
-                               }
+                       dbus_proxy_agent = g_dbus_proxy_new_sync(connection_agent, G_DBUS_PROXY_FLAGS_NONE,
+                                                                               NULL, "org.tizen.omadmagent", "/org/tizen/omadmagent",
+                                                                               "org.tizen.omadmagent", NULL, &error);
+                       if (error) {
+                               MSG_DEBUG("Connecting to agent proxy failed: %s\n", error->message);
+                               goto _DBUS_ERROR;
+                       }
 
-                               result_agent = g_dbus_proxy_call_sync(dbus_proxy_agent, "Hello_Agent", NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
-                               if (error) {
-                                       MSG_DEBUG("invoking agent proxy call failed: %s\n", error->message);
-                                       goto _DBUS_ERROR;
-                               }
+                       result_agent = g_dbus_proxy_call_sync(dbus_proxy_agent, "Hello_Agent", NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
+                       if (error) {
+                               MSG_DEBUG("invoking agent proxy call failed: %s\n", error->message);
+                               goto _DBUS_ERROR;
+                       }
 
-                               connection_service = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
-                               if (error) {
-                                       MSG_DEBUG("Connecting to system bus failed: %s\n", error->message);
-                                       goto _DBUS_ERROR;
-                               }
+                       connection_service = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
+                       if (error) {
+                               MSG_DEBUG("Connecting to system bus failed: %s\n", error->message);
+                               goto _DBUS_ERROR;
+                       }
 
-                               dbus_proxy_service =g_dbus_proxy_new_sync(connection_service, G_DBUS_PROXY_FLAGS_NONE, NULL,
-                                                                                       "org.tizen.omadmservice", "/org/tizen/omadmservice",
-                                                                                       "org.tizen.omadmservice", NULL, &error);
-                               if (error) {
-                                       MSG_DEBUG("Connecting to service proxy failed: %s\n", error->message);
-                                       goto _DBUS_ERROR;
-                               }
+                       dbus_proxy_service =g_dbus_proxy_new_sync(connection_service, G_DBUS_PROXY_FLAGS_NONE, NULL,
+                                                                               "org.tizen.omadmservice", "/org/tizen/omadmservice",
+                                                                               "org.tizen.omadmservice", NULL, &error);
+                       if (error) {
+                               MSG_DEBUG("Connecting to service proxy failed: %s\n", error->message);
+                               goto _DBUS_ERROR;
+                       }
 
-                               result_service = g_dbus_proxy_call_sync(dbus_proxy_service, "wakeup", NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
-                               if (error) {
-                                       MSG_DEBUG("invoking service proxy call failed: %s\n", error->message);
-                                       goto _DBUS_ERROR;
-                               }
+                       result_service = g_dbus_proxy_call_sync(dbus_proxy_service, "wakeup", NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
+                       if (error) {
+                               MSG_DEBUG("invoking service proxy call failed: %s\n", error->message);
+                               goto _DBUS_ERROR;
+                       }
 
-                               Mutex mx;
-                               CndVar cv;
-                               mx.lock();
-                               cv.timedwait(mx.pMutex(), 2);
-                               mx.unlock();
+                       Mutex mx;
+                       CndVar cv;
+                       mx.lock();
+                       cv.timedwait(mx.pMutex(), 2);
+                       mx.unlock();
 
-                               MSG_END();
+                       MSG_END();
+               }
+               break;
+       case SMS_WAP_APPLICATION_SYNCML_DS_NOTIFICATION:
+       case SMS_WAP_APPLICATION_SYNCML_DS_NOTIFICATION_WBXML:
+               {
+                       connection_agent = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
+                       if (error) {
+                               MSG_DEBUG("Connecting to system bus failed: %s\n", error->message);
+                               goto _DBUS_ERROR;
                        }
-                       break;
-               case SMS_WAP_APPLICATION_SYNCML_DS_NOTIFICATION:
-               case SMS_WAP_APPLICATION_SYNCML_DS_NOTIFICATION_WBXML:
-                       {
-                               connection_agent = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
-                               if (error) {
-                                       MSG_DEBUG("Connecting to system bus failed: %s\n", error->message);
-                                       goto _DBUS_ERROR;
-                               }
 
-                               dbus_proxy_agent = g_dbus_proxy_new_sync(connection_agent, G_DBUS_PROXY_FLAGS_NONE, NULL,
-                                                                                       "org.tizen.omadsagent", "/org/tizen/omadsagent",
-                                                                                       "org.tizen.omadsagent", NULL, &error);
-                               if (error) {
-                                       MSG_DEBUG("Connecting to agent proxy failed: %s\n", error->message);
-                                       goto _DBUS_ERROR;
-                               }
+                       dbus_proxy_agent = g_dbus_proxy_new_sync(connection_agent, G_DBUS_PROXY_FLAGS_NONE, NULL,
+                                                                               "org.tizen.omadsagent", "/org/tizen/omadsagent",
+                                                                               "org.tizen.omadsagent", NULL, &error);
+                       if (error) {
+                               MSG_DEBUG("Connecting to agent proxy failed: %s\n", error->message);
+                               goto _DBUS_ERROR;
+                       }
 
-                               result_agent = g_dbus_proxy_call_sync(dbus_proxy_agent, "Hello_Agent", NULL,
-                                                                               G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
-                               if (error) {
-                                       MSG_DEBUG("invoking service error: %s\n", error->message);
-                                       goto _DBUS_ERROR;
-                               }
+                       result_agent = g_dbus_proxy_call_sync(dbus_proxy_agent, "Hello_Agent", NULL,
+                                                                       G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
+                       if (error) {
+                               MSG_DEBUG("invoking service error: %s\n", error->message);
+                               goto _DBUS_ERROR;
                        }
-                       break;
-               default:
-                       break;
+               }
+               break;
+       default:
+               break;
        }
 
 _DBUS_ERROR:
@@ -1253,8 +1239,7 @@ void SmsPluginWapPushHandler::handleWapPushCallback(char* pPushHeader, char* pPu
                return;
        }
 
-       for(int i = 0; i < pushEvt_cnt; ++i)    {
-
+       for (int i = 0; i < pushEvt_cnt; ++i)   {
                /**  check Push message receive setting */
                bool bPushRecv = false;
                int appcode = 0;
@@ -1367,31 +1352,31 @@ void SmsPluginWapPushHandler::handleWapPushCallback(char* pPushHeader, char* pPu
                case SMS_WAP_APPLICATION_DRM_V2_ROAP_TRIGGER_XML:
                case SMS_WAP_APPLICATION_DRM_V2_ROAP_TRIGGER_WBXML:
                        MSG_DEBUG("Received DRM V2");
-                       // TODO: DRM V2
+                       /* TODO: DRM V2 */
                        break;
 
                case SMS_WAP_APPLICATION_PUSH_EMAIL:
                case SMS_WAP_APPLICATION_PUSH_EMAIL_XML:
                case SMS_WAP_APPLICATION_PUSH_EMAIL_WBXML:
                        MSG_DEBUG("Received Email");
-                       // TODO: Email
+                       /* TODO: Email */
                        break;
 
 
                case SMS_WAP_APPLICATION_PUSH_IMPS_CIR:
                        MSG_DEBUG("Received IMPS CIR");
-                       // TODO: IMPS CIR
+                       /* TODO: IMPS CIR */
                        break;
 
                case SMS_WAP_APPLICATION_LBS :
                        MSG_DEBUG("Received LBS related message");
                        SmsPluginEventHandler::instance()->handleLBSMsgIncoming(pPushHeader, pPushBody, PushBodyLen);
-                       // TODO: LBS
+                       /* TODO: LBS */
                        break;
 
                case SMS_WAP_APPLICATION_PUSH_SIA :
                        MSG_DEBUG("Received SIA");
-                       // TODO: SIA
+                       /* TODO: SIA */
                        break;
 
                default:
@@ -1486,7 +1471,7 @@ void SmsPluginWapPushHandler::handleSIMessage(char* pPushBody, int PushBodyLen,
        xmlNodePtr      topNode = NULL;
        xmlNodePtr      indNode = NULL;
 
-       xmlChar*                tmpXmlChar = NULL;
+       xmlChar* tmpXmlChar = NULL;
 
        if (pPushBody == NULL) {
                MSG_DEBUG("pPushBody is NULL");
@@ -1528,8 +1513,8 @@ void SmsPluginWapPushHandler::handleSIMessage(char* pPushBody, int PushBodyLen,
        pushMsg.expires = 0xFFFFFFFF;
 
        /** setting received time */
-       time_t  t               =       time(NULL);
-       time_t  utfTime =       time(&t);
+       time_t t = time(NULL);
+       time_t utfTime = time(&t);
 
        pushMsg.received = (unsigned long)utfTime;
 
@@ -1621,9 +1606,8 @@ void SmsPluginWapPushHandler::handleSIMessage(char* pPushBody, int PushBodyLen,
                /** Callback */
                err = SmsPluginEventHandler::instance()->callbackMsgIncoming(&msgInfo);
 
-               if (err != MSG_SUCCESS){
+               if (err != MSG_SUCCESS)
                        MSG_DEBUG("callbackMsgIncoming() Error !! [%d]", err);
-               }
        } else {
                MSG_DEBUG("checkMessage() Error !! [%d]", err);
        }
@@ -1649,31 +1633,31 @@ void SmsPluginWapPushHandler::handleSLMessage(char* pPushBody, int PushBodyLen,
        msg_error_t err = MSG_SUCCESS;
 
        if (pPushBody == NULL) {
-               MSG_DEBUG("pPushBody is NULL \n" );
+               MSG_DEBUG("pPushBody is NULL \n");
                return;
        }
 
        getXmlDoc(pPushBody, PushBodyLen, &xmlDoc, isText);
 
        if (xmlDoc == NULL) {
-               MSG_DEBUG("xmlDoc is NULL \n" );
+               MSG_DEBUG("xmlDoc is NULL \n");
                return;
        }
 
        topNode = xmlDocGetRootElement(xmlDoc);
 
        if (topNode == NULL) {
-               MSG_DEBUG("Empty Document." );
+               MSG_DEBUG("Empty Document.");
                xmlFreeDoc(xmlDoc);
                return;
        } else {
-               MSG_SEC_DEBUG("Not an empty Document and topNode->name = %s \n",topNode->name );
+               MSG_SEC_DEBUG("Not an empty Document and topNode->name = %s \n",topNode->name);
        }
 
        indNode = topNode;
 
        while (indNode != NULL) {
-               if (!xmlStrcmp(indNode->name, (const xmlChar*) "sl")) {
+               if (!xmlStrcmp(indNode->name, (const xmlChar*)"sl")) {
                        MSG_SEC_DEBUG("indNode->name = %s\n",indNode->name);
                        break;
                }
@@ -1682,8 +1666,8 @@ void SmsPluginWapPushHandler::handleSLMessage(char* pPushBody, int PushBodyLen,
        }
 
        /**  setting received time setting */
-       time_t  t               =       time(NULL);
-       time_t  utfTime =       time(&t);
+       time_t t = time(NULL);
+       time_t utfTime = time(&t);
 
        pushMsg.received = (unsigned long)utfTime;
 
@@ -1781,20 +1765,20 @@ void SmsPluginWapPushHandler::handleCOMessage(char* pPushBody, int PushBodyLen,
        MSG_DEBUG("Enter handleCOMessage");
 
        if (pPushBody == NULL) {
-               MSG_DEBUG("pPushBody is NULL \n" );
+               MSG_DEBUG("pPushBody is NULL \n");
                return;
        }
 
        getXmlDoc(pPushBody, PushBodyLen, &xmlDoc, isText);
 
        if (xmlDoc == NULL) {
-               MSG_DEBUG("xmlDoc is NULL \n" );
+               MSG_DEBUG("xmlDoc is NULL \n");
                return;
        }
 
        topNode = xmlDocGetRootElement(xmlDoc);
        if (topNode == NULL) {
-               MSG_DEBUG("Warning:Empty Document\n" );
+               MSG_DEBUG("Warning:Empty Document\n");
                xmlFreeDoc(xmlDoc);
                return;
        }
@@ -1802,13 +1786,13 @@ void SmsPluginWapPushHandler::handleCOMessage(char* pPushBody, int PushBodyLen,
        indNode = topNode->xmlChildrenNode;
 
 
-       while(indNode != NULL) {
+       while (indNode != NULL) {
 
                xmlChar* tmpUrl = NULL;
-               if (!xmlStrcmp(indNode->name, (const xmlChar*) SMS_PUSH_XML_INVAL_OBJ)) {
+               if (!xmlStrcmp(indNode->name, (const xmlChar*)SMS_PUSH_XML_INVAL_OBJ)) {
                        MSG_SEC_DEBUG("indNode->name = %s\n", indNode->name);
 
-                       tmpUrl = xmlGetProp(indNode, (xmlChar*) SMS_PUSH_XML_CO_URI);
+                       tmpUrl = xmlGetProp(indNode, (xmlChar*)SMS_PUSH_XML_CO_URI);
 
                        if (tmpUrl != NULL) {
                                strncpy(cacheOp.invalObjectUrl[cacheOp.invalObjectCnt++], (char*)tmpUrl, MAX_PUSH_CACHEOP_MAX_URL_LEN-1);
@@ -1817,7 +1801,7 @@ void SmsPluginWapPushHandler::handleCOMessage(char* pPushBody, int PushBodyLen,
                        } else {
                                MSG_DEBUG("NO href value from the xmlDoc\n");
                        }
-               } else if (!xmlStrcmp(indNode->name, (const xmlChar*) SMS_PUSH_XML_INVAL_SVC)) {
+               } else if (!xmlStrcmp(indNode->name, (const xmlChar*)SMS_PUSH_XML_INVAL_SVC)) {
                        MSG_SEC_DEBUG("indNode->name = %s\n",indNode->name);
                        tmpUrl = xmlGetProp(indNode, (xmlChar*)SMS_PUSH_XML_CO_URI);
 
@@ -1876,9 +1860,8 @@ void SmsPluginWapPushHandler::handleCOMessage(char* pPushBody, int PushBodyLen,
                /** Callback */
                err = SmsPluginEventHandler::instance()->callbackMsgIncoming(&msgInfo);
 
-               if (err != MSG_SUCCESS) {
+               if (err != MSG_SUCCESS)
                        MSG_DEBUG("callbackMsgIncoming() Error !! [%d]", err);
-               }
        } else {
                MSG_DEBUG("checkMessage() Error !! [%d]", err);
        }
@@ -2065,7 +2048,7 @@ unsigned long SmsPluginWapPushHandler::convertXmlCharToSec(char* pDate)
        }
        tmpBuf[i] = '\0';
        index++;
-       timeStruct.tm_year = (atoi( tmpBuf)-1900);
+       timeStruct.tm_year = (atoi(tmpBuf)-1900);
 
        /**  Month */
        for (i = 0; i < 2; i++) {
@@ -2073,7 +2056,7 @@ unsigned long SmsPluginWapPushHandler::convertXmlCharToSec(char* pDate)
        }
        tmpBuf[i] = '\0';
        index++;
-       timeStruct.tm_mon = (atoi( tmpBuf) - 1);
+       timeStruct.tm_mon = (atoi(tmpBuf) - 1);
 
        /** Date */
        for (i = 0; i < 2; i++) {
@@ -2081,7 +2064,7 @@ unsigned long SmsPluginWapPushHandler::convertXmlCharToSec(char* pDate)
        }
        tmpBuf[i] = '\0';
        index++;
-       timeStruct.tm_mday = atoi( tmpBuf);
+       timeStruct.tm_mday = atoi(tmpBuf);
 
        /** Hours */
        for (i = 0; i < 2; i++) {
@@ -2089,7 +2072,7 @@ unsigned long SmsPluginWapPushHandler::convertXmlCharToSec(char* pDate)
        }
        tmpBuf[i] = '\0';
        index++;
-       timeStruct.tm_hour = atoi( tmpBuf);
+       timeStruct.tm_hour = atoi(tmpBuf);
 
        /** Minites */
        for (i = 0; i < 2; i++) {
@@ -2097,7 +2080,7 @@ unsigned long SmsPluginWapPushHandler::convertXmlCharToSec(char* pDate)
        }
        tmpBuf[i] = '\0';
        index++;
-       timeStruct.tm_min = atoi( tmpBuf);
+       timeStruct.tm_min = atoi(tmpBuf);
 
        /** Seconds */
        for (i = 0; i < 2; i++) {
@@ -2105,7 +2088,7 @@ unsigned long SmsPluginWapPushHandler::convertXmlCharToSec(char* pDate)
        }
        tmpBuf[i] = '\0';
        index++;
-       timeStruct.tm_sec = atoi( tmpBuf);
+       timeStruct.tm_sec = atoi(tmpBuf);
 
        nTimeInSec = mktime(&timeStruct);
 
@@ -2122,27 +2105,27 @@ msg_push_action_t SmsPluginWapPushHandler::convertSIActionStrToEnum(char* pActio
        }
 
        /** compare  with signal-none. */
-       comp = g_strcmp0( "signal-none", pAction );
+       comp = g_strcmp0("signal-none", pAction);
        if (comp == 0)
                return MSG_PUSH_SI_ACTION_SIGNAL_NONE;
 
        /** compare  with signal-low. */
-       comp = g_strcmp0( "signal-low", pAction );
+       comp = g_strcmp0("signal-low", pAction);
        if (comp == 0)
                return MSG_PUSH_SI_ACTION_SIGNAL_LOW;
 
        /**  compare  with signal-medium. */
-       comp = g_strcmp0( "signal-medium", pAction );
+       comp = g_strcmp0("signal-medium", pAction);
        if (comp == 0)
                return MSG_PUSH_SI_ACTION_SIGNAL_MEDIUM;
 
        /**  compare  with signal-high. */
-       comp = g_strcmp0( "signal-high", pAction );
+       comp = g_strcmp0("signal-high", pAction);
        if (comp == 0)
                return MSG_PUSH_SI_ACTION_SIGNAL_HIGH;
 
        /**  compare  with delete. */
-       comp = g_strcmp0( "delete", pAction );
+       comp = g_strcmp0("delete", pAction);
        if (comp == 0)
                return MSG_PUSH_SI_ACTION_DELETE;
 
@@ -2156,22 +2139,22 @@ msg_push_action_t SmsPluginWapPushHandler::convertSLActionStrToEnum(char* pActio
        int comp = 0;
 
        if (pAction == NULL) {
-               MSG_DEBUG( "MSG_DEBUG is NULL. Setting to default action type.\n" );
+               MSG_DEBUG("MSG_DEBUG is NULL. Setting to default action type.\n");
                return MSG_PUSH_SL_ACTION_EXECUTE_LOW;
        }
 
        /**  compare pSrcStr with execute-low. */
-       comp = g_strcmp0( "execute-low", pAction );
+       comp = g_strcmp0("execute-low", pAction);
        if (comp == 0)
                return MSG_PUSH_SL_ACTION_EXECUTE_LOW;
 
        /**  compare pSrcStr with execute-high. */
-       comp = g_strcmp0( "execute-high", pAction );
+       comp = g_strcmp0("execute-high", pAction);
        if (comp == 0)
                return MSG_PUSH_SL_ACTION_EXECUTE_HIGH;
 
        /** compare pSrcStr with cache. */
-       comp = g_strcmp0( "cache", pAction );
+       comp = g_strcmp0("cache", pAction);
        if (comp == 0)
                return MSG_PUSH_SL_ACTION_CACHE;
 
@@ -2181,35 +2164,36 @@ msg_push_action_t SmsPluginWapPushHandler::convertSLActionStrToEnum(char* pActio
 }
 
 
-unsigned long SmsPluginWapPushHandler::wspRetriveUintvarDecode( unsigned char* sourceData, unsigned long* currentPointer )
+unsigned long SmsPluginWapPushHandler::wspRetriveUintvarDecode(unsigned char* sourceData, unsigned long* currentPointer)
 {
        unsigned long i = 0;
        unsigned long decodedValue;
 
-       while (sourceData[*currentPointer +i] >= 0x80) i++;
+       while (sourceData[*currentPointer + i] >= 0x80)
+               i++;
 
-       decodedValue = wspDecodeUintvar( i+1, sourceData + *currentPointer );
+       decodedValue = wspDecodeUintvar(i + 1, sourceData + *currentPointer);
        *currentPointer = *currentPointer + i + 1;
-       MSG_DEBUG("wspRetriveUintvarDecode: decodedValue=%d .\n",decodedValue );
+       MSG_DEBUG("wspRetriveUintvarDecode: decodedValue=%d .\n",decodedValue);
        return decodedValue;
 }
 
 
-unsigned long SmsPluginWapPushHandler::wspDecodeUintvar(unsigned long length, unsigned char* userVar )
+unsigned long SmsPluginWapPushHandler::wspDecodeUintvar(unsigned long length, unsigned char* userVar)
 {
        unsigned long i;
        unsigned long decodedUintvar = 0;
 
 
        for (i = 0 ; i < length; i++) {
-               decodedUintvar = decodedUintvar +  ( wspUintvarDecodeTable[i] * (userVar[length-(i+1)] & 0x7f ));
+               decodedUintvar = decodedUintvar +  (wspUintvarDecodeTable[i] * (userVar[length-(i+1)] & 0x7f));
        }
 
        return decodedUintvar;
 }
 
 
-void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, unsigned long encodedHeaderLen, unsigned long contentsLength, bool fContentType, char** pHeader)
+void SmsPluginWapPushHandler::wspDecodeHeader(unsigned char* sEncodedHeader, unsigned long encodedHeaderLen, unsigned long contentsLength, bool fContentType, char** pHeader)
 {
        unsigned long iField;
        bool   continueField = FALSE;
@@ -2230,37 +2214,37 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
        /* outTemper is Decoded Headers.
            temper is Single Decoded Header.
        */
-       if (NULL == ( outTemper = new char[ WSP_STANDARD_STR_LEN_MAX * 5 ])) {
-               MSG_DEBUG("outTemper Memory allocation is failed.\n" );
+       if (NULL == (outTemper = new char[ WSP_STANDARD_STR_LEN_MAX * 5 ])) {
+               MSG_DEBUG("outTemper Memory allocation is failed.\n");
                return;
        }
        memset(outTemper, 0, (WSP_STANDARD_STR_LEN_MAX * 5));
        currentLength = WSP_STANDARD_STR_LEN_MAX;
 
-       MSG_DEBUG("wspDecodeHeader: Message header decoding started.\n" );
+       MSG_DEBUG("wspDecodeHeader: Message header decoding started.\n");
 
        int loop;
        char szBuf[64];
 
        szBuf[0] = 0x00;
-       MSG_DEBUG("wspDecodeHeader: RAW data \n" );
+       MSG_DEBUG("wspDecodeHeader: RAW data \n");
        for (loop = 0 ; loop<(int)encodedHeaderLen; loop++) {
                char szTempBuf[5];
                szTempBuf[0] = 0x00;
-               sprintf( szTempBuf, "%2X ", sEncodedHeader[loop] );
+               snprintf(szTempBuf, sizeof(szTempBuf), "%2X ", sEncodedHeader[loop]);
 
-               if (AcStrlen( szBuf ) + 7 < 64) {
-                       strncat( szBuf, szTempBuf, sizeof(szBuf)-AcStrlen(szBuf)-1 );
+               if (AcStrlen(szBuf) + 7 < 64) {
+                       strncat(szBuf, szTempBuf, sizeof(szBuf)-AcStrlen(szBuf)-1);
                } else {
-                       strncat( szBuf, "\n", sizeof(szBuf)-AcStrlen(szBuf)-1 );
+                       strncat(szBuf, "\n", sizeof(szBuf)-AcStrlen(szBuf)-1);
                        MSG_DEBUG("[%s]", szBuf);
                        szBuf[0] = 0x00;
-                       strncat( szBuf, szTempBuf, sizeof(szBuf)-AcStrlen(szBuf)-1 );
+                       strncat(szBuf, szTempBuf, sizeof(szBuf)-AcStrlen(szBuf)-1);
                }
        }
-       strncat( szBuf, "\n", sizeof(szBuf)-AcStrlen(szBuf)-1 );
+       strncat(szBuf, "\n", sizeof(szBuf)-AcStrlen(szBuf)-1);
        MSG_DEBUG("[%s]", szBuf);
-       MSG_DEBUG("fContentType=%d  \n",fContentType );
+       MSG_DEBUG("fContentType=%d  \n",fContentType);
        /* operation for content-type */
        /* makes psuedo- content-type fieldcode */
        /* content - type is processed with header. But it's come without field code. So existence of fContentType can decide adding content type header field code whether ContentType + general header is or not. */
@@ -2268,19 +2252,19 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
        if (fContentType) {
                encodedHeader = new char[ encodedHeaderLen + 1 ];
                if (encodedHeader == NULL)      {
-                       MSG_DEBUG("encodedHeader Memory allocation is failed.\n" );
+                       MSG_DEBUG("encodedHeader Memory allocation is failed.\n");
                        return;
                }
                encodedHeader[0] = 0x91;
-               memcpy( encodedHeader + 1, sEncodedHeader, (size_t)encodedHeaderLen );
+               memcpy(encodedHeader + 1, sEncodedHeader, (size_t)encodedHeaderLen);
        } else {
                encodedHeader = new char[ encodedHeaderLen ];
                if (encodedHeader == NULL)      {
-                       MSG_DEBUG("encodedHeader Memory allocation is failed.\n" );
+                       MSG_DEBUG("encodedHeader Memory allocation is failed.\n");
                        return;
                }
 
-               memcpy( encodedHeader, sEncodedHeader, (size_t)encodedHeaderLen );
+               memcpy(encodedHeader, sEncodedHeader, (size_t)encodedHeaderLen);
        }
 
        /* Is it reacehd end of header? */
@@ -2290,7 +2274,7 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
                        temper = new char[ WSP_STANDARD_STR_LEN_MAX * 5 ];
 
                        if (temper == NULL) {
-                               MSG_DEBUG("temper Memory allocation is failed.\n" );
+                               MSG_DEBUG("temper Memory allocation is failed.\n");
                                return;
                        }
                        memset(temper, 0x00, (WSP_STANDARD_STR_LEN_MAX * 5));
@@ -2300,47 +2284,47 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
 
                /* this section presents header code page shifting procedure
                   This part can be implemented by future request.
-               if (track == 0x 7f )
+               if (track == 0x 7f)
                */
                track = encodedHeader[iEncodedHeader];
 
                if (track == 0x00) {
-                       MSG_DEBUG("WspLDecodeHeader: fieldcode  is 0 \n" );
+                       MSG_DEBUG("WspLDecodeHeader: fieldcode  is 0 \n");
                        strncpy((char*) temper, (char*)"", (WSP_STANDARD_STR_LEN_MAX * 5)-1);
                        fieldCode = 0xff;
                        iEncodedHeader++;
-               } else if (( track > 0 ) && ( track < 0x20 )) {
+               } else if ((track > 0) && (track < 0x20)) {
                        iEncodedHeader++;
-               } else if (( track < 0x7f ) && ( track > 0x1f )) { /* In this case, first byte is normal string. So it's considered to unknown header. */
+               } else if ((track < 0x7f) && (track > 0x1f)) { /* In this case, first byte is normal string. So it's considered to unknown header. */
                        unsigned char* fieldName = (unsigned char*)gWapCodeBufferLeft;
                        unsigned char* fieldValue = (unsigned char*)gWapCodeBufferRight;
 
-                       strncpy( (char*)fieldName, (char*)(encodedHeader + iEncodedHeader ),WSP_CODE_BUFFER_LEFT_LEN_MAX-1);
+                       strncpy((char*)fieldName, (char*)(encodedHeader + iEncodedHeader),WSP_CODE_BUFFER_LEFT_LEN_MAX-1);
                        fieldName[WSP_CODE_BUFFER_LEFT_LEN_MAX-1] = '\0';
-                       iEncodedHeader = iEncodedHeader + AcStrlen( (char*)fieldName ) + 1;
-                       strncpy( (char*)fieldValue, (char*)(encodedHeader + iEncodedHeader ), WSP_CODE_BUFFER_RIGHT_LEN_MAX-1);
+                       iEncodedHeader = iEncodedHeader + AcStrlen((char*)fieldName) + 1;
+                       strncpy((char*)fieldValue, (char*)(encodedHeader + iEncodedHeader), WSP_CODE_BUFFER_RIGHT_LEN_MAX-1);
                        fieldValue[WSP_CODE_BUFFER_RIGHT_LEN_MAX-1] = '\0';
-                       iEncodedHeader = iEncodedHeader + AcStrlen( (char*)fieldValue ) + 1;
+                       iEncodedHeader = iEncodedHeader + AcStrlen((char*)fieldValue) + 1;
 
-                       strncat((char*)temper, (char*)fieldName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
-                       strncat((char*)temper, ": ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
-                       strncat((char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                       strncat((char*)temper, (char*)fieldName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+                       strncat((char*)temper, ": ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+                       strncat((char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
                        /* this means 'don't process anymore.' */
                        fieldCode = 0xff;
 
                } else if (track > 0x7f) {
                        /* In case of first byte is field code, else case is error. */
 
-                       /*if (( track & 0x7f ) <= wspHeaderFieldCount ) */
+                       /*if ((track & 0x7f) <= wspHeaderFieldCount) */
                        {
 
                                unsigned long  fieldValueLen = encodedHeader[iEncodedHeader + 1];
                                unsigned char fieldValue[1275];
                                fieldCode = track & 0x7f;
                                /*
-                               if (( fieldValueLen == 0 ) || ( fieldValueLen == 0x80 ))
+                               if ((fieldValueLen == 0) || (fieldValueLen == 0x80))
                                {
-                                       dprint( DNET_WAP,DNET_DBG_HIGH, "%X %X %X %X %X %X\n" , fieldCode, encodedHeader[iEncodedHeader + 1], encodedHeader[iEncodedHeader + 2],encodedHeader[iEncodedHeader + 3],encodedHeader[iEncodedHeader + 4], encodedHeader[iEncodedHeader + 5] );
+                                       dprint(DNET_WAP,DNET_DBG_HIGH, "%X %X %X %X %X %X\n" , fieldCode, encodedHeader[iEncodedHeader + 1], encodedHeader[iEncodedHeader + 2],encodedHeader[iEncodedHeader + 3],encodedHeader[iEncodedHeader + 4], encodedHeader[iEncodedHeader + 5]);
                                }
                                */
                                memset(fieldValue, 0, 1275);
@@ -2348,20 +2332,20 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
                                        /* add field name */
                                        /* This continueField flag show whether previous field code and current field code are same or not. If it's same, there are some sequential display effect by omitting field name addition process. The reason why it should be do that can be found in encoding example of spec. */
                                        if (!continueField) {
-                                               strncat( (char*)temper, (char*)wspHeaderFieldName[fieldCode], (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
-                                               strncat( (char*)temper, ": ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                               strncat((char*)temper, (char*)wspHeaderFieldName[fieldCode], (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+                                               strncat((char*)temper, ": ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
                                                continueField = FALSE;
                                        }
 
                                        /* field value is string */
                                        /* In this case, it just copy field value. */
-                                       if (( fieldValueLen > LENGTH_QUOTE ) && ( fieldValueLen < 0x80 )) {
+                                       if ((fieldValueLen > LENGTH_QUOTE) && (fieldValueLen < 0x80)) {
 
                                                /* string field value should be NULL terminated */
-                                               strncat( (char*)temper, (char*)(encodedHeader + iEncodedHeader + 1 ), (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
-                                               strncat( (char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                               strncat((char*)temper, (char*)(encodedHeader + iEncodedHeader + 1), (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+                                               strncat((char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
 
-                                               iEncodedHeader = iEncodedHeader + AcStrlen( (char*)encodedHeader + iEncodedHeader + 1 ) + 2;
+                                               iEncodedHeader = iEncodedHeader + AcStrlen((char*)encodedHeader + iEncodedHeader + 1) + 2;
                                                fieldCode = 0xff;
                                        }
                                        /* first field value is length */
@@ -2385,8 +2369,8 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
 
                                                        /* field length is encoded in UINTVAR */
                                                        unsigned long  uintvarLen = 0;
-                                                       fieldValueLen = wspRetriveUintvarDecode((unsigned char*) encodedHeader + iEncodedHeader + 2, &uintvarLen );
-                                                       memcpy( fieldValue, encodedHeader + iEncodedHeader + 2 + uintvarLen, (size_t)fieldValueLen );
+                                                       fieldValueLen = wspRetriveUintvarDecode((unsigned char*) encodedHeader + iEncodedHeader + 2, &uintvarLen);
+                                                       memcpy(fieldValue, encodedHeader + iEncodedHeader + 2 + uintvarLen, (size_t)fieldValueLen);
                                                        iEncodedHeader = iEncodedHeader + fieldValueLen + uintvarLen + 2;
 
                                                } else {
@@ -2395,15 +2379,15 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
                                                                /* field value is one byte integer over 0x80 */
                                                                /** make it two byte integer */
                                                                fieldValue[0] = 0x00;
-                                                               memcpy( fieldValue + 1, encodedHeader + iEncodedHeader + 2, (size_t)fieldValueLen);
+                                                               memcpy(fieldValue + 1, encodedHeader + iEncodedHeader + 2, (size_t)fieldValueLen);
                                                                fieldValueLen = 2;
                                                                iEncodedHeader = iEncodedHeader + 1 + 2;
                                                        } else {
-                                                               memcpy( fieldValue, encodedHeader + iEncodedHeader + 2, (size_t)fieldValueLen );
+                                                               memcpy(fieldValue, encodedHeader + iEncodedHeader + 2, (size_t)fieldValueLen);
                                                                fieldValue[fieldValueLen] = 0;
                                                                iEncodedHeader = iEncodedHeader + fieldValueLen + 2;
-                                                               if (( fieldValueLen == 0 ) || ( fieldValueLen == 0x80 )) {
-                                                                       MSG_DEBUG("%X \n",  encodedHeader[iEncodedHeader] );
+                                                               if ((fieldValueLen == 0) || (fieldValueLen == 0x80)) {
+                                                                       MSG_DEBUG("%X \n",  encodedHeader[iEncodedHeader]);
                                                                }
                                                        }
                                                }
@@ -2416,17 +2400,17 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
                                        }
                                        /* processing normal pre-defined field decoding */
 
-                                       MSG_DEBUG("WspLDecodeHeader: FieldCode %X\n", fieldCode );
-                                       MSG_DEBUG("WspLDecodeHeader: fieldSize %d\n", fieldValueLen );
+                                       MSG_DEBUG("WspLDecodeHeader: FieldCode %X\n", fieldCode);
+                                       MSG_DEBUG("WspLDecodeHeader: fieldSize %d\n", fieldValueLen);
 
-                                       if (( fieldCode  > wspHeaderFieldCount ) && ( fieldCode != 0xff )) {
-                                               MSG_DEBUG("WspLDecodeHeader: unknown fieldcode %X \n", track );
+                                       if ((fieldCode  > wspHeaderFieldCount) && (fieldCode != 0xff)) {
+                                               MSG_DEBUG("WspLDecodeHeader: unknown fieldcode %X \n", track);
                                                strncpy((char*) temper, (char*)"", (WSP_STANDARD_STR_LEN_MAX * 5)-1);
                                                fieldCode = 0xff;
                                        }
 
 
-                                       switch ( fieldCode )
+                                       switch (fieldCode)
                                        {
                                                /* accept charset */
                                                /* It's normal way of field process. */
@@ -2441,28 +2425,28 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
                                                                3. Or both of two
                                                                */
                                                                if (1 != fieldValueLen) {
-                                                                       code = wspHeaderDecodeInteger( fieldValue );
+                                                                       code = wspHeaderDecodeInteger(fieldValue);
                                                                        /* Calculate iField. */
-                                                                       if (fieldValue[0] < 0x80 )
+                                                                       if (fieldValue[0] < 0x80)
                                                                                iField = fieldValue[0];
                                                                        else
                                                                                iField = 1;
 
-                                                                       while ( wspCharset[i].charsetCode != code )
+                                                                       while (wspCharset[i].charsetCode != code)
                                                                                i++;
-                                                                       strncat( (char*)temper, (char*)wspCharset[i].charsetName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                                                       strncat((char*)temper, (char*)wspCharset[i].charsetName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
                                                                        /* If parameter exist */
                                                                        if (iField < fieldValueLen) {
                                                                                char* param = NULL;
                                                                                unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
-                                                                               wspHeaderDecodeQValue( fieldValueLen - iField, fieldValue + iField, &param);
-                                                                               strncat( (char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                                                               wspHeaderDecodeQValue(fieldValueLen - iField, fieldValue + iField, &param);
+                                                                               strncat((char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
                                                                        }
                                                                } else {
                                                                        code = fieldValue[0] & 0x7f;
 
-                                                                       while (( wspCharset[i].charsetCode != code ) && ( wspCharset[i].charsetCode != 0xffff  )) i++;
-                                                                       strncat( (char*)temper, (char*)wspCharset[i].charsetName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                                                       while ((wspCharset[i].charsetCode != code) && (wspCharset[i].charsetCode != 0xffff )) i++;
+                                                                       strncat((char*)temper, (char*)wspCharset[i].charsetName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
                                                                }
 
                                                        }
@@ -2477,12 +2461,12 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
                                                        {
                                                                int integerValue;
 
-                                                               integerValue = wspHeaderDecodeIntegerByLength(fieldValue, fieldValueLen );
+                                                               integerValue = wspHeaderDecodeIntegerByLength(fieldValue, fieldValueLen);
                                                                if (integerValue > 2) {
                                                                        MSG_DEBUG("WspLDecodeHeader: integerValue is over limit(2).\n");
                                                                        break;
                                                                }
-                                                               strncat( (char*)temper, (char*)wspEncodeMethod[integerValue], (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+                                                               strncat((char*)temper, (char*)wspEncodeMethod[integerValue], (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
                                                        }
                                                        break;
                                                /* contents type decoder */
@@ -2499,16 +2483,16 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
 
                                                                /* Like HTTP result state 304, it's for processing without Content type. This part doesn't defined. */
                                                                if (0 == fieldValueLen) {
-                                                                       strncat( (char*)temper, (char*)"None" , (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+                                                                       strncat((char*)temper, (char*)"None" , (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
                                                                        break;
                                                                }
                                                                /* 01 AE --> 00 AE --> AE*/
                                                                if (fieldValueLen == 2  &&  fieldValue[0] == 0) {
-                                                                       memcpy( fieldValue, encodedHeader + iEncodedHeader -1, (size_t)fieldValueLen-1 );
-                                                                       MSG_DEBUG("WspLDecodeHeader:For mmO2 problem\r\n" );
+                                                                       memcpy(fieldValue, encodedHeader + iEncodedHeader -1, (size_t)fieldValueLen-1);
+                                                                       MSG_DEBUG("WspLDecodeHeader:For mmO2 problem\r\n");
                                                                }
 
-                                                               if ((fieldValue[0] < 0x20 ) || (fieldValue[0] >= 0x80 )) {
+                                                               if ((fieldValue[0] < 0x20) || (fieldValue[0] >= 0x80)) {
                                                                        if (fieldValue[0] >= 0x80) {
                                                                                tempLen = 1;
                                                                        } else if (fieldValueLen == 2 && fieldValue[0] == 0x03 && fieldValue[1] == 0x0A) { /** 06 05 02 03 0A AF 89 */
@@ -2518,7 +2502,7 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
                                                                                fieldValue[0] = 0x02;
                                                                                tempLen = 2;
                                                                                fieldValueLen = 3;
-                                                                               MSG_DEBUG("WspLDecodeHeader:For CPE problem\r\n" );
+                                                                               MSG_DEBUG("WspLDecodeHeader:For CPE problem\r\n");
                                                                        } else {
                                                                                tempLen = fieldValue[0]; /** 06 06 03 02 03 16 AF 88 */
                                                                        }
@@ -2528,17 +2512,17 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
                                                                                char* szExtendedContent;
 
                                                                                contentsTypeCode = fieldValue[0] & 0x7f;
-                                                                               while (( wspContentsType[i].contentsTypeCode != contentsTypeCode ) && ( i < wspContentsTypeCount )) i++;
+                                                                               while ((wspContentsType[i].contentsTypeCode != contentsTypeCode) && (i < wspContentsTypeCount)) i++;
 
                                                                                /* If specified content type doesn't exist */
                                                                                if (i < wspContentsTypeCount)
-                                                                                       strncat( (char*)temper, (char*)wspContentsType[i].contentsTypeName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                                                                       strncat((char*)temper, (char*)wspContentsType[i].contentsTypeName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
 
-                                                                               szExtendedContent =  wspExtendedDecodeType( (char)contentsTypeCode );
+                                                                               szExtendedContent =  wspExtendedDecodeType((char)contentsTypeCode);
 
                                                                                if (szExtendedContent != NULL) {
-                                                                                       MSG_DEBUG("WspLDecodeHeader: Tele2 server problem \n " );
-                                                                                       strncat( (char*)temper, (char*)szExtendedContent, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                                                                       MSG_DEBUG("WspLDecodeHeader: Tele2 server problem \n ");
+                                                                                       strncat((char*)temper, (char*)szExtendedContent, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
                                                                                }
                                                                        } else {
                                                                                contentsTypeCode = wspHeaderDecodeInteger(fieldValue);
@@ -2552,7 +2536,7 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
                                                                                tempLen +=1;
                                                                        }
                                                                } else {
-                                                                       tempLen = AcStrlen( (char*)fieldValue ) + 1;
+                                                                       tempLen = AcStrlen((char*)fieldValue) + 1;
 
                                                                        strncat ((char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
                                                                        MSG_DEBUG("WspLDecodeHeader: Attention, Decoding Check of Content-Type\n ", tempLen);
@@ -2562,10 +2546,10 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
                                                                if (tempLen < fieldValueLen) {
                                                                        char* param = NULL;
                                                                        unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
-                                                                       wspHeaderDecodeParameter( fieldValue + tempLen, fieldValueLen - tempLen, &param);
+                                                                       wspHeaderDecodeParameter(fieldValue + tempLen, fieldValueLen - tempLen, &param);
                                                                        if (param != NULL) {
-                                                                               strncat( (char*)temper, "; ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
-                                                                               strncat( (char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                                                               strncat((char*)temper, "; ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+                                                                               strncat((char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
                                                                        }
                                                                }
                                                        }
@@ -2580,36 +2564,36 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
                                                                unsigned long i = 0;
                                                                unsigned long code;
                                                                unsigned long tempLen;
-                                                               if ((fieldValue[0] < 0x20 ) || (fieldValue[0] > 0x80 )) {
-                                                                       if (fieldValue[0] > 0x80 )
+                                                               if ((fieldValue[0] < 0x20) || (fieldValue[0] > 0x80)) {
+                                                                       if (fieldValue[0] > 0x80)
                                                                                tempLen = 1;
                                                                        else
                                                                                tempLen = fieldValue[0];
                                                                } else {
-                                                                       tempLen = AcStrlen( (char*)fieldValue ) + 1;
+                                                                       tempLen = AcStrlen((char*)fieldValue) + 1;
                                                                }
 
                                                                if (tempLen == 1) {
 
-                                                                       code = wspHeaderDecodeInteger( fieldValue );
-                                                                       while ( wspLanguage[i].languageCode != code) {
+                                                                       code = wspHeaderDecodeInteger(fieldValue);
+                                                                       while (wspLanguage[i].languageCode != code) {
                                                                                i++;
                                                                                if (i == wspLanguageCount)
                                                                                        break;
                                                                        }
 
                                                                        if (i < wspLanguageCount) {
-                                                                               strncat( (char*)temper, (char*)wspLanguage[i].languageName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                                                               strncat((char*)temper, (char*)wspLanguage[i].languageName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
                                                                        }
                                                                } else {
-                                                                       strncat( (char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+                                                                       strncat((char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
                                                                }
 
                                                                if (tempLen < fieldValueLen) {
                                                                        char* param = NULL;
                                                                        unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
-                                                                       wspHeaderDecodeQValue(  fieldValueLen - tempLen, fieldValue + tempLen, &param );
-                                                                       strncat( (char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                                                       wspHeaderDecodeQValue( fieldValueLen - tempLen, fieldValue + tempLen, &param);
+                                                                       strncat((char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
                                                                }
                                                        }
                                                        break;
@@ -2629,12 +2613,12 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
 
                                                                unsigned char temp[16];
                                                                /*
-                                                               if (( fieldValueLen == 2 ) && ( fieldValue[0] > 0x7f ))
-                                                                       AcSprintf( (char*)temp, "%u", (unsigned int)fieldValue[1]);
+                                                               if ((fieldValueLen == 2) && (fieldValue[0] > 0x7f))
+                                                                       AcSprintf((char*)temp, "%u", (unsigned int)fieldValue[1]);
                                                                else
                                                                */
-                                                               sprintf( (char*)temp, "%u", (unsigned int)wspHeaderDecodeIntegerByLength( fieldValue, fieldValueLen ));
-                                                               strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                                               snprintf((char*)temp, sizeof(temp), "%u", (unsigned int)wspHeaderDecodeIntegerByLength(fieldValue, fieldValueLen));
+                                                               strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
                                                        }
                                                        break;
                                                /* X-Wap-Application-Id */
@@ -2644,15 +2628,15 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
                                                                int         integerValue;
 
                                                                if (fieldValueLen == 2 &&  fieldValue[0] == 0) {
-                                                                       memcpy( fieldValue, encodedHeader + iEncodedHeader -1, (size_t)fieldValueLen-1 );
-                                                                       MSG_DEBUG("WspLDecodeHeader:For mmO2 problem\r\n" );
+                                                                       memcpy(fieldValue, encodedHeader + iEncodedHeader -1, (size_t)fieldValueLen-1);
+                                                                       MSG_DEBUG("WspLDecodeHeader:For mmO2 problem\r\n");
                                                                        fieldValueLen = 1;
                                                                }
 
                                                                integerValue = wspHeaderDecodeIntegerByLength(fieldValue, fieldValueLen);
 
                                                                int count = sizeof(wspHeaderApplId)/sizeof(SMS_WSP_HEADER_PARAMETER_S);
-                                                               for(int i = 0; i < count ; ++i)
+                                                               for (int i = 0; i < count ; ++i)
                                                                {
                                                                        if ((unsigned int)integerValue == wspHeaderApplId[i].parameterCode)
                                                                        {
@@ -2666,17 +2650,17 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
                                                /* Accept-Application */
                                                case 0x32 :
                                                        if (0x80 == fieldValue[0]) {
-                                                               strncat( (char*)temper, "*", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1 );
+                                                               strncat((char*)temper, "*", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1);
                                                        } else {
 
                                                                unsigned char temp[16];
                                                                /*
-                                if (( fieldValueLen == 2 ) && ( fieldValue[0] == 1 ))
-                                       AcSprintf( (char*)temp, "%u", (unsigned int)fieldValue[0]);
+                                if ((fieldValueLen == 2) && (fieldValue[0] == 1))
+                                       AcSprintf((char*)temp, "%u", (unsigned int)fieldValue[0]);
                                 else
                                                                */
-                                                               sprintf( (char*)temp, "%u", (unsigned int)wspHeaderDecodeIntegerByLength( fieldValue, fieldValueLen ));
-                                                               strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1);
+                                                               snprintf((char*)temp, sizeof(temp), "%u", (unsigned int)wspHeaderDecodeIntegerByLength(fieldValue, fieldValueLen));
+                                                               strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1);
                                                        }
                                                        break;
 
@@ -2697,30 +2681,30 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
                                                        {
                                                                char* decodedString = NULL;
                                                                unique_ptr<char*, void(*)(char**)> decodedStringbuf(&decodedString, unique_ptr_deleter);
-                                                               wspHeaderDecodeDateValue( fieldValueLen, fieldValue, &decodedString);
-                                                               strncat( (char*)temper, (char*)decodedString, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1 );
+                                                               wspHeaderDecodeDateValue(fieldValueLen, fieldValue, &decodedString);
+                                                               strncat((char*)temper, (char*)decodedString, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1);
                                                        }
                                                        break;
 
                                                /* connection */
                                                case 0x09 :
-                                                       if (fieldValue[0] == 0x80 )
-                                                               strncat( (char*)temper, "Close", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1 );
+                                                       if (fieldValue[0] == 0x80)
+                                                               strncat((char*)temper, "Close", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1);
                                                        break;
                                                /* accept-ranges */
                                                case 0x04 :
-                                                       if (fieldValue[0] == 0x80 )
-                                                               strncat( (char*)temper, "None", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1 );
-                                                       if (fieldValue[0] == 0x81 )
-                                                               strncat( (char*)temper, "Bytes", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1 );
+                                                       if (fieldValue[0] == 0x80)
+                                                               strncat((char*)temper, "None", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1);
+                                                       if (fieldValue[0] == 0x81)
+                                                               strncat((char*)temper, "Bytes", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1);
                                                        break;
                                                /* content-md5 */
                                                case 0x0f :
                                                        {
                                                                unsigned char temp[1275];
-                                                               memcpy( temp, fieldValue, (size_t)fieldValueLen );
+                                                               memcpy(temp, fieldValue, (size_t)fieldValueLen);
                                                                temp[fieldValueLen] = 0;
-                                                               wspHeaderCopyDecodedString( temp, &currentLength, &temper );
+                                                               wspHeaderCopyDecodedString(temp, &currentLength, &temper);
                                                        }
                                                        break;
                                                /* Credential */
@@ -2731,19 +2715,19 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
                                                        if (fieldValue[0] == 0x80) {
                                                                char* addString = NULL;
                                                                unique_ptr<char*, void(*)(char**)> addStringbuf(&addString, unique_ptr_deleter);
-                                                               wspHeaderDecodeAuth(fieldValueLen, fieldValue, &addString );
-                                                               strncat( (char*)temper, addString, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                                               wspHeaderDecodeAuth(fieldValueLen, fieldValue, &addString);
+                                                               strncat((char*)temper, addString, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
                                                        } else {
-                                                               iField = AcStrlen( (char*)fieldValue) + 1;
+                                                               iField = AcStrlen((char*)fieldValue) + 1;
 
-                                                               strncat( (char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                                               strncat((char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
                                                                if (iField < fieldValueLen) {
                                                                        char* param = NULL;
                                                                        unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
-                                                                       wspHeaderDecodeParameter( fieldValue + 1, fieldValueLen - 1, &param );
+                                                                       wspHeaderDecodeParameter(fieldValue + 1, fieldValueLen - 1, &param);
                                                                        if (param != NULL) {
-                                                                               strncat( (char*)temper, ", ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
-                                                                               strncat( (char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                                                               strncat((char*)temper, ", ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+                                                                               strncat((char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
                                                                        }
                                                                }
                                                        }
@@ -2755,32 +2739,32 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
                                                case 0x2d :
                                                /* Proxy-authenticate */
                                                case 0x20 :
-                                                       if (0 == fieldValueLen )
+                                                       if (0 == fieldValueLen)
                                                                break;
                                                        if (fieldValue[0] == 0x80) {
                                                                char* addString = NULL;
                                                                unique_ptr<char*, void(*)(char**)> addStringbuf(&addString, unique_ptr_deleter);
-                                                               wspHeaderDecodeChallenge(fieldValueLen, fieldValue, &addString );
-                                                               strncat( (char*)temper, addString, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                                               wspHeaderDecodeChallenge(fieldValueLen, fieldValue, &addString);
+                                                               strncat((char*)temper, addString, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
                                                        } else {
                                                                unsigned char  authScheme[WSP_STANDARD_STR_LEN_MAX + 1];
                                                                unsigned char  realmValue[WSP_STANDARD_STR_LEN_MAX];
                                                                unsigned char  addedString[WSP_STANDARD_STR_LEN_MAX];
 
-                                                               strncpy( (char*)authScheme, (char*)fieldValue, WSP_STANDARD_STR_LEN_MAX -1);
-                                                               iField = AcStrlen( (char*)authScheme ) + 1;
-                                                               strncpy( (char*)realmValue, (char*)(fieldValue + iField ), WSP_STANDARD_STR_LEN_MAX-1);
-                                                               iField = iField + AcStrlen( (char*)realmValue ) + 1;
-                                                               snprintf( (char*)addedString, sizeof(addedString), "%s %s", authScheme, realmValue );
-                                                               wspHeaderCopyDecodedString( addedString, &currentLength, &temper );
+                                                               strncpy((char*)authScheme, (char*)fieldValue, WSP_STANDARD_STR_LEN_MAX -1);
+                                                               iField = AcStrlen((char*)authScheme) + 1;
+                                                               strncpy((char*)realmValue, (char*)(fieldValue + iField), WSP_STANDARD_STR_LEN_MAX-1);
+                                                               iField = iField + AcStrlen((char*)realmValue) + 1;
+                                                               snprintf((char*)addedString, sizeof(addedString), "%s %s", authScheme, realmValue);
+                                                               wspHeaderCopyDecodedString(addedString, &currentLength, &temper);
 
                                                                if (iField < fieldValueLen) {
                                                                        char* param = NULL;
                                                                        unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
-                                                                       wspHeaderDecodeParameter( fieldValue + iField, fieldValueLen - iField, &param );
+                                                                       wspHeaderDecodeParameter(fieldValue + iField, fieldValueLen - iField, &param);
                                                                        if (param != NULL) {
-                                                                               strncat( (char*)temper, ", ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
-                                                                               wspHeaderCopyDecodedString( (unsigned char*)param, &currentLength, &temper );
+                                                                               strncat((char*)temper, ", ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+                                                                               wspHeaderCopyDecodedString((unsigned char*)param, &currentLength, &temper);
                                                                        }
                                                                }
                                                        }
@@ -2794,16 +2778,16 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
                                                                unsigned char  temp[16];
                                                                iField = 0;
 
-                                                               strncat( (char*)temper," bytes ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                                               strncat((char*)temper," bytes ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
 
-                                                               first = wspRetriveUintvarDecode( fieldValue, &iField );
-                                                               len = wspRetriveUintvarDecode( fieldValue, &iField );
+                                                               first = wspRetriveUintvarDecode(fieldValue, &iField);
+                                                               len = wspRetriveUintvarDecode(fieldValue, &iField);
                                                                /* Originally range of HTTP include entity length. But WSP omit it. Finally to calculate this, it should be get content length from export. If this field is included without content length, then it can get wrong result. This content length can be get by calculating PDU length.
                                                                */
                                                                last = first + contentsLength - 1;
 
-                                                               sprintf( (char*)temp, "%u-%u/%u", (unsigned int)first, (unsigned int)last, (unsigned int)len );
-                                                               strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                                               snprintf((char*)temp, sizeof(temp), "%u-%u/%u", (unsigned int)first, (unsigned int)last, (unsigned int)len);
+                                                               strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
                                                        }
                                                        break;
 
@@ -2813,24 +2797,24 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
                                                                char* cacheString = NULL;
                                                                unique_ptr<char*, void(*)(char**)> cacheStringbuf(&cacheString, unique_ptr_deleter);
 
-                                                               wspHeaderDecodeCacheControl( fieldValue, fieldValueLen, &cacheString );
-                                                               strncat( (char*)temper, (char*)cacheString, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                                               wspHeaderDecodeCacheControl(fieldValue, fieldValueLen, &cacheString);
+                                                               strncat((char*)temper, (char*)cacheString, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
                                                        }
                                                        break;
 
                                                /* pragma */
                                                case 0x1f :
                                                        if (fieldValue[0] == 0x80) {
-                                                               strncat( (char*)temper, (char*)wspCacheControl[0], (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                                               strncat((char*)temper, (char*)wspCacheControl[0], (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
                                                        } else {
                                                                if (1 < fieldValueLen) {
                                                                        char* param = NULL;
                                                                        unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
-                                                                       wspHeaderDecodeParameter( fieldValue, fieldValueLen, &param );
+                                                                       wspHeaderDecodeParameter(fieldValue, fieldValueLen, &param);
 
                                                                        if (param != NULL) {
-                                                                               strncat( (char*)temper, "; ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
-                                                                               strncat( (char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                                                               strncat((char*)temper, "; ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+                                                                               strncat((char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
                                                                        }
                                                                }
                                                        }
@@ -2842,31 +2826,31 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
                                                case 0x06 :
                                                        {
                                                                unsigned long  i = 0;
-                                                               while ( wspHeaderDecodeIntegerByLength( fieldValue, fieldValueLen ) != wspMethodType[i].methodCode ) i++;
-                                                               strncat( (char*)temper, (char*)wspMethodType[i].methodName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                                               while (wspHeaderDecodeIntegerByLength(fieldValue, fieldValueLen) != wspMethodType[i].methodCode) i++;
+                                                               strncat((char*)temper, (char*)wspMethodType[i].methodName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
                                                        }
                                                        break;
                                                /* range */
                                                case 0x23 :
-                                                       strncat( (char*)temper, "bytes=", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                                       strncat((char*)temper, "bytes=", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
                                                        if (fieldValue[0] == 0x80) {
                                                                unsigned char temp[16];
                                                                unsigned long  first, last;
                                                                iField = 0;
 
-                                                               first = wspRetriveUintvarDecode( fieldValue, &iField );
-                                                               last = wspRetriveUintvarDecode( fieldValue, &iField );
+                                                               first = wspRetriveUintvarDecode(fieldValue, &iField);
+                                                               last = wspRetriveUintvarDecode(fieldValue, &iField);
 
-                                                               sprintf( (char*)temp, "%u-%u", (unsigned int)first, (unsigned int)last );
-                                                               strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                                               snprintf((char*)temp, sizeof(temp), "%u-%u", (unsigned int)first, (unsigned int)last);
+                                                               strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
                                                        }
                                                        if (fieldValue[0] == 0x81) {
                                                                unsigned char temp[16];
                                                                unsigned long  suffix;
 
-                                                               suffix = wspRetriveUintvarDecode( fieldValue, &iField );
+                                                               suffix = wspRetriveUintvarDecode(fieldValue, &iField);
 
-                                                               sprintf( (char*)temp, "-%u", (unsigned int)suffix );
+                                                               snprintf((char*)temp, sizeof(temp), "-%u", (unsigned int)suffix);
 
                                                        }
                                                        break;
@@ -2876,33 +2860,33 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
                                                                char* temp = NULL;
                                                                unique_ptr<char*, void(*)(char**)> tempbuf(&temp, unique_ptr_deleter);
 
-                                                               wspHeaderDecodeDateValue( fieldValueLen - 1, fieldValue + 1, &temp );
-                                                               strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                                               wspHeaderDecodeDateValue(fieldValueLen - 1, fieldValue + 1, &temp);
+                                                               strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
                                                        }
 
                                                        if (fieldValue[0] == 0x81) {
                                                                unsigned char temp[16];
 
-                                                               snprintf( (char*)temp, sizeof((char*)temp), "%u", (unsigned int)wspHeaderDecodeIntegerByLength( fieldValue,fieldValueLen ));
-                                                               strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                                               snprintf((char*)temp, 16, "%u", (unsigned int)wspHeaderDecodeIntegerByLength(fieldValue,fieldValueLen));
+                                                               strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
                                                        }
                                                        break;
                                                /* transfer-encoding */
                                                case 0x27 :
                                                        /* No other cases allowed */
-                                                       if (fieldValue[0] == 0x80 )
-                                                               strncat( (char*)temper, "chunked", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                                       if (fieldValue[0] == 0x80)
+                                                               strncat((char*)temper, "chunked", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
 
                                                        break;
                                                /* vary */
                                                case 0x2a :
                                                        {
-                                                               int integerValue = wspHeaderDecodeIntegerByLength(fieldValue,fieldValueLen );
+                                                               int integerValue = wspHeaderDecodeIntegerByLength(fieldValue,fieldValueLen);
                                                                if (integerValue > wspHeaderFieldCount) {
                                                                        MSG_DEBUG("WspLDecodeHeader: integerValue is over limit(0x%x).\n",wspHeaderFieldCount);
                                                                        break;
                                                                }
-                                                               strncat( (char*)temper, (char*)wspHeaderFieldName[integerValue], (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                                               strncat((char*)temper, (char*)wspHeaderFieldName[integerValue], (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
                                                        }
                                                        break;
                                                /* warning */
@@ -2910,69 +2894,69 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
                                                        {
                                                                unsigned char temp[WSP_STANDARD_STR_LEN_MAX];
 
-                                                               if (fieldValue[0] < 0x20 )
+                                                               if (fieldValue[0] < 0x20)
                                                                        iField = fieldValue[0];
                                                                else
                                                                        iField = 1;
 
-                                                               snprintf( (char*)temp, sizeof(temp), "%u", (unsigned int)wspHeaderDecodeIntegerByLength( fieldValue, iField ));
-                                                               strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                                               snprintf((char*)temp, sizeof(temp), "%u", (unsigned int)wspHeaderDecodeIntegerByLength(fieldValue, iField));
+                                                               strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
                                                                if (iField < fieldValueLen) {
                                                                        unsigned char agent[WSP_STANDARD_STR_LEN_MAX];
                                                                        unsigned char text[WSP_STANDARD_STR_LEN_MAX];
-                                                                       strncpy( (char*)agent, (char*)(fieldValue + iField ),WSP_STANDARD_STR_LEN_MAX-1);
-                                                                       iField = iField + AcStrlen((char*)agent ) + 1;
-                                                                       strncpy((char*)text, (char*)(fieldValue + iField ),WSP_STANDARD_STR_LEN_MAX-1);
-                                                                       snprintf( (char*)temp, sizeof(temp), " %s %s", agent, text );
-                                                                       wspHeaderCopyDecodedString( temp, &currentLength, &temper );
+                                                                       strncpy((char*)agent, (char*)(fieldValue + iField),WSP_STANDARD_STR_LEN_MAX-1);
+                                                                       iField = iField + AcStrlen((char*)agent) + 1;
+                                                                       strncpy((char*)text, (char*)(fieldValue + iField),WSP_STANDARD_STR_LEN_MAX-1);
+                                                                       snprintf((char*)temp, sizeof(temp), " %s %s", agent, text);
+                                                                       wspHeaderCopyDecodedString(temp, &currentLength, &temper);
                                                                }
                                                        }
                                                        break;
                                                /* content-disposition */
                                                case 0x2e :
-                                                       if (fieldValue[0] == 0x80 )
-                                                               strncat( (char*)temper, "form-data", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                                       if (fieldValue[0] == 0x80)
+                                                               strncat((char*)temper, "form-data", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
 
-                                                       if (fieldValue[0] == 0x81 )
-                                                               strncat( (char*)temper, "attachment", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                                       if (fieldValue[0] == 0x81)
+                                                               strncat((char*)temper, "attachment", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
 
                                                        if (1 < fieldValueLen) {
                                                                char* param = NULL;
                                                                unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
-                                                               wspHeaderDecodeParameter( fieldValue + 1, fieldValueLen - 1, &param );
+                                                               wspHeaderDecodeParameter(fieldValue + 1, fieldValueLen - 1, &param);
 
                                                                if (param != NULL) {
-                                                                       strncat( (char*)temper, "; ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
-                                                                       strncat( (char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                                                       strncat((char*)temper, "; ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+                                                                       strncat((char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
                                                                }
                                                        }
                                                        break;
                                                /* Profile-diff */
                                                case 0x36 :
                                                        temper[AcStrlen((char*)temper) + fieldValueLen] = '\0';
-                                                       memcpy( temper, fieldValue, (size_t)fieldValueLen );
+                                                       memcpy(temper, fieldValue, (size_t)fieldValueLen);
                                                        break;
                                                /* Profile-Warning */
                                                case 0x37 :
                                                        {
                                                                unsigned char temp[WSP_STANDARD_STR_LEN_MAX];
 
-                                                               snprintf( (char*)temp, sizeof(temp), "%lX", wspHeaderDecodeInteger(fieldValue ));
+                                                               snprintf((char*)temp, sizeof(temp), "%lX", wspHeaderDecodeInteger(fieldValue));
                                                                temp[2] = temp[1];
                                                                temp[1] = (unsigned char)0x30;
                                                                temp[3] = '\0';
                                                                if (fieldValueLen > 1) {
                                                                        /* copy warn-target - URI */
-                                                                       strncat( (char*)temp, (char*)(fieldValue + 1), WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)temp)-1 );
-                                                                       if (fieldValueLen > ( AcStrlen( (char*)(fieldValue + 1)) + 1 )) {
+                                                                       strncat((char*)temp, (char*)(fieldValue + 1), WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)temp)-1);
+                                                                       if (fieldValueLen > (AcStrlen((char*)(fieldValue + 1)) + 1)) {
                                                                                /* copy warn-date */
                                                                                char* decodedString = NULL;
                                                                                unique_ptr<char*, void(*)(char**)> decodedStringbuf(&decodedString, unique_ptr_deleter);
-                                                                               wspHeaderDecodeDateValue( fieldValueLen - ( AcStrlen( (char*)(fieldValue + 1)) + 2 ), fieldValue + AcStrlen( (char*)(fieldValue + 1)) + 1, &decodedString );
-                                                                               strncat( (char*)temp, (char*)decodedString, WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)temp)-1 );
+                                                                               wspHeaderDecodeDateValue(fieldValueLen - (AcStrlen((char*)(fieldValue + 1)) + 2), fieldValue + AcStrlen((char*)(fieldValue + 1)) + 1, &decodedString);
+                                                                               strncat((char*)temp, (char*)decodedString, WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)temp)-1);
                                                                        }
                                                                }
-                                                               strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                                                               strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
                                                        }
                                                        break;
 
@@ -2984,28 +2968,28 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
                        }
                }
                /* It deosn't finished decoding yet. */
-               if (( iEncodedHeader < encodedHeaderLen ) && ( fieldCode != 0xff )) {
+               if ((iEncodedHeader < encodedHeaderLen) && (fieldCode != 0xff)) {
                        /* In here, iEncodedHeader already point next field code to be decoded. */
                        /* If this code is same, then set continueField else add CRLF. */
-                       if (fieldCode == (encodedHeader[iEncodedHeader] & 0x7f )) {
-                               strncat( (char*)temper, ", ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                       if (fieldCode == (encodedHeader[iEncodedHeader] & 0x7f)) {
+                               strncat((char*)temper, ", ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
                                continueField = TRUE;
                        } else {
-                               strncat( (char*)temper, "\r\n", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                               strncat((char*)temper, "\r\n", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
                                continueField = FALSE;
                        }
                } else {
-                       strncat( (char*)temper, "\r\n", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+                       strncat((char*)temper, "\r\n", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
                }
 
                /* add single header to total headers */
-               strncat( (char*)outTemper, (char*)temper, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)outTemper)-1 );
-               MSG_DEBUG("WspLDecodeHeader: Single Header : %s\r\n", temper );
+               strncat((char*)outTemper, (char*)temper, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)outTemper)-1);
+               MSG_DEBUG("WspLDecodeHeader: Single Header : %s\r\n", temper);
 
        }
 
 
-       MSG_DEBUG("WspLDecodeHeader: Header decoding ended.\n" );
+       MSG_DEBUG("WspLDecodeHeader: Header decoding ended.\n");
 
        *pHeader = outTemper;
 
@@ -3014,7 +2998,7 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
 }
 
 
-unsigned long SmsPluginWapPushHandler::wspHeaderDecodeInteger( unsigned char* data )
+unsigned long SmsPluginWapPushHandler::wspHeaderDecodeInteger(unsigned char* data)
 {
        /* we only can handle max 32bit integer */
        unsigned long i;
@@ -3034,7 +3018,7 @@ unsigned long SmsPluginWapPushHandler::wspHeaderDecodeInteger( unsigned char* da
                MSG_DEBUG("WspLHeaderDecodeInteger: input %d , length %d\n", data[0], IntLen);
 
                for (i=0; i<IntLen; i++)
-                       returner.seg[IntLen-( i+1)] = data[i+1];
+                       returner.seg[IntLen-(i+1)] = data[i+1];
 
                return returner.integer;
        }
@@ -3043,7 +3027,7 @@ unsigned long SmsPluginWapPushHandler::wspHeaderDecodeInteger( unsigned char* da
 }
 
 
-void SmsPluginWapPushHandler::wspHeaderDecodeQValue( unsigned long length, unsigned char* data, char** pDecodedString)
+void SmsPluginWapPushHandler::wspHeaderDecodeQValue(unsigned long length, unsigned char* data, char** pDecodedString)
 {
        unsigned short qBase = 0;
        float  qValue;
@@ -3054,12 +3038,12 @@ void SmsPluginWapPushHandler::wspHeaderDecodeQValue( unsigned long length, unsig
                return;
        }
 
-       memcpy( &qBase, data, (size_t)length );
+       memcpy(&qBase, data, (size_t)length);
        qValue = (float)qBase;
        if (qValue > 100) {
                qValue = qValue - 100;
                qValue = qValue / 1000;
-               snprintf( (char*)*pDecodedString, sizeof(char)*WSP_STANDARD_STR_LEN_MAX, "; q=%.3f", qValue );
+               snprintf((char*)*pDecodedString, sizeof(char)*WSP_STANDARD_STR_LEN_MAX, "; q=%.3f", qValue);
        } else {
                /* qValue variable is divided by 100. And it's multiplied by 100.
                   It's to resolve problem of changed 0.01 of qValue. */
@@ -3067,16 +3051,16 @@ void SmsPluginWapPushHandler::wspHeaderDecodeQValue( unsigned long length, unsig
                qValue = qValue - 1;
                qValue = qValue / 100;
                qValueTemp = (unsigned long)(qValue * 100);
-               if (0 == (qValueTemp % 10 ))
-                       snprintf( (char*)*pDecodedString, sizeof(char)*WSP_STANDARD_STR_LEN_MAX, "; q=%.1f", qValue );
+               if (0 == (qValueTemp % 10))
+                       snprintf((char*)*pDecodedString, sizeof(char)*WSP_STANDARD_STR_LEN_MAX, "; q=%.1f", qValue);
                else
-                       snprintf( (char*)*pDecodedString, sizeof(char)*WSP_STANDARD_STR_LEN_MAX, "; q=%.2f", qValue );
+                       snprintf((char*)*pDecodedString, sizeof(char)*WSP_STANDARD_STR_LEN_MAX, "; q=%.2f", qValue);
        }
        return;
 }
 
 
-unsigned long SmsPluginWapPushHandler::wspHeaderDecodeIntegerByLength(unsigned char* data, unsigned long length )
+unsigned long SmsPluginWapPushHandler::wspHeaderDecodeIntegerByLength(unsigned char* data, unsigned long length)
 {
        unsigned long i;
 
@@ -3087,25 +3071,25 @@ unsigned long SmsPluginWapPushHandler::wspHeaderDecodeIntegerByLength(unsigned c
 
        returner.integer = 0;
 
-       if (length == 1 )
+       if (length == 1)
                return data[0] & 0x7f;
 
        returner.integer = 0;
 
        for (i = 0 ; i < length; i++) {
-               returner.integer  =  returner.integer + ( data[i]  *  (0x1  << ( ( length - ( i + 1)) * 8 )));
-               MSG_DEBUG("WspLHeaderDecodeIntegerByLength: %d \n", returner.integer );
+               returner.integer  =  returner.integer + (data[i]  *  (0x1  << ((length - (i + 1)) * 8)));
+               MSG_DEBUG("WspLHeaderDecodeIntegerByLength: %d \n", returner.integer);
        }
 
        return returner.integer;
 }
 
 
-char* SmsPluginWapPushHandler::wspExtendedDecodeType(char contentType  )
+char* SmsPluginWapPushHandler::wspExtendedDecodeType(char contentType )
 {
        int i = 0;
 
-       while ( wspExtendedContentsType[i].contentsTypeCode != contentType) {
+       while (wspExtendedContentsType[i].contentsTypeCode != contentType) {
                if (wspExtendedContentsType[i].contentsTypeCode == 0xff)
                        return NULL;
                i++;
@@ -3115,7 +3099,7 @@ char* SmsPluginWapPushHandler::wspExtendedDecodeType(char contentType  )
 }
 
 
-void SmsPluginWapPushHandler::wspHeaderDecodeParameter( unsigned char* data, unsigned long length, char** pParam)
+void SmsPluginWapPushHandler::wspHeaderDecodeParameter(unsigned char* data, unsigned long length, char** pParam)
 {
        char* param = *pParam;
 
@@ -3127,111 +3111,110 @@ void SmsPluginWapPushHandler::wspHeaderDecodeParameter( unsigned char* data, uns
                param = new char[WSP_STANDARD_STR_LEN_MAX];
 
                if (param == NULL) {
-                       MSG_DEBUG("WspLHeaderDecodeParameter:MemAlloc failed\n" );
+                       MSG_DEBUG("WspLHeaderDecodeParameter:MemAlloc failed\n");
                        return;
                }
 
-               strncpy( (char*)param, (char*)data, WSP_STANDARD_STR_LEN_MAX - 1);
+               strncpy((char*)param, (char*)data, WSP_STANDARD_STR_LEN_MAX - 1);
 
-               if (NO_VALUE == data[AcStrlen( (char*)param ) + 1]) {
+               if (NO_VALUE == data[AcStrlen((char*)param) + 1]) {
                        *pParam = param;
                        return;
                }
 
-               strncat( (char*)param, "=", WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)param)-1 );
-               strncat( (char*)param, (char*)(data + strlen( (char*)param )), WSP_STANDARD_STR_LEN_MAX-strlen((char*)param)-1);
+               strncat((char*)param, "=", WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)param)-1);
+               strncat((char*)param, (char*)(data + strlen((char*)param)), WSP_STANDARD_STR_LEN_MAX-strlen((char*)param)-1);
 
                *pParam = param;
 
                return;
        }
 
-       switch ( data[0] & 0x7f )
-       {
-               case 0x00 :
-                       wspHeaderDecodeQValue(  length - 1, data + 1, &param);
-                       break;
-               case 0x01 :
-                       wspHeaderDecodeCharset( length - 1 , data + 1, &param);
-                       break;
-               case 0x02 :
-                       wspHeaderDecodeVersion( length - 1, data + 1, &param);
-                       break;
-                       /* integer */
-               case 0x03 :
-                       //param = (unsigned char *)malloc( (size_t)WSP_STANDARD_STR_LEN_MAX );
-                       param = new char[WSP_STANDARD_STR_LEN_MAX];
-                       if (param == NULL) {
-                               MSG_DEBUG("WspLHeaderDecodeParameter: 0x03 MemAlloc failed\n");
-                               return;
-                       } else {
-                               snprintf((char*)param, sizeof(char)*WSP_STANDARD_STR_LEN_MAX, "Type=%i", (int)wspHeaderDecodeInteger( data + 1 ));
-                       }
-                       break;
-               case 0x08 :
-                       param = new char[WSP_STANDARD_STR_LEN_MAX];
+       switch (data[0] & 0x7f) {
+       case 0x00 :
+               wspHeaderDecodeQValue( length - 1, data + 1, &param);
+               break;
+       case 0x01 :
+               wspHeaderDecodeCharset(length - 1 , data + 1, &param);
+               break;
+       case 0x02 :
+               wspHeaderDecodeVersion(length - 1, data + 1, &param);
+               break;
+               /* integer */
+       case 0x03 :
+               /* param = (unsigned char *)malloc((size_t)WSP_STANDARD_STR_LEN_MAX); */
+               param = new char[WSP_STANDARD_STR_LEN_MAX];
+               if (param == NULL) {
+                       MSG_DEBUG("WspLHeaderDecodeParameter: 0x03 MemAlloc failed\n");
+                       return;
+               } else {
+                       snprintf((char*)param, sizeof(char)*WSP_STANDARD_STR_LEN_MAX, "Type=%i", (int)wspHeaderDecodeInteger(data + 1));
+               }
+               break;
+       case 0x08 :
+               param = new char[WSP_STANDARD_STR_LEN_MAX];
 
-                       if (param == NULL) {
-                               MSG_DEBUG("WspLHeaderDecodeParameter:0x08 MemAlloc failed\n");
-                               return;
-                       } else {
-                               snprintf((char*)param, sizeof(char)*WSP_STANDARD_STR_LEN_MAX, "Padding=%i", (int)wspHeaderDecodeInteger( data + 1 ));
-                       }
-                       break;
-               case 0x05 :
-                       param = new char[WSP_STANDARD_STR_LEN_MAX];
+               if (param == NULL) {
+                       MSG_DEBUG("WspLHeaderDecodeParameter:0x08 MemAlloc failed\n");
+                       return;
+               } else {
+                       snprintf((char*)param, sizeof(char)*WSP_STANDARD_STR_LEN_MAX, "Padding=%i", (int)wspHeaderDecodeInteger(data + 1));
+               }
+               break;
+       case 0x05 :
+               param = new char[WSP_STANDARD_STR_LEN_MAX];
 
-                       if (param == NULL) {
-                               MSG_DEBUG("WspLHeaderDecodeParameter:0x05 MemAlloc failed\n");
-                               return;
-                       } else {
-                               strncpy( (char*)param, "Name=", WSP_STANDARD_STR_LEN_MAX-1);
-                               memcpy( param + 5, data + 1, length - 1 );
-                               param[5 + length - 1] = '\0';
-                       }
-                       break;
-               case 0x06 :
-                       param = new char[WSP_STANDARD_STR_LEN_MAX];
+               if (param == NULL) {
+                       MSG_DEBUG("WspLHeaderDecodeParameter:0x05 MemAlloc failed\n");
+                       return;
+               } else {
+                       strncpy((char*)param, "Name=", WSP_STANDARD_STR_LEN_MAX-1);
+                       memcpy(param + 5, data + 1, length - 1);
+                       param[5 + length - 1] = '\0';
+               }
+               break;
+       case 0x06 :
+               param = new char[WSP_STANDARD_STR_LEN_MAX];
 
-                       if (param == NULL) {
-                               MSG_DEBUG("WspLHeaderDecodeParameter:0x06 MemAlloc failed\n");
-                               return;
-                       } else {
-                               strncpy( (char*)param, "Filename=", WSP_STANDARD_STR_LEN_MAX-1);
-                               memcpy( param + 9, (char*)(data + 1), (size_t)(length - 1) );
-                               param[9 + length - 1] = '\0';
-                       }
-                       break;
-               case 0x07 :
-                       param = NULL;
-                       /* TBI */
-                       break;
-                       /*OMA Provisioning*/
-               case 0x11 :
-                       param = new char[WSP_STANDARD_STR_LEN_MAX];
+               if (param == NULL) {
+                       MSG_DEBUG("WspLHeaderDecodeParameter:0x06 MemAlloc failed\n");
+                       return;
+               } else {
+                       strncpy((char*)param, "Filename=", WSP_STANDARD_STR_LEN_MAX-1);
+                       memcpy(param + 9, (char*)(data + 1), (size_t)(length - 1));
+                       param[9 + length - 1] = '\0';
+               }
+               break;
+       case 0x07 :
+               param = NULL;
+               /* TBI */
+               break;
+               /*OMA Provisioning*/
+       case 0x11 :
+               param = new char[WSP_STANDARD_STR_LEN_MAX];
 
-                       if (param == NULL) {
-                               MSG_DEBUG("WspLHeaderDecodeParameter:0x11 MemAlloc failed\n");
-                               return;
-                       } else {
-                               strncpy((char*)param, "SEC=", WSP_STANDARD_STR_LEN_MAX-1);
-                               SecurityTypeCode = data[1] & 0x7f;
-                               while (( i < wspSecurityTypeCount ) && ( wspSecurityType[i].SecurityTypeCode != SecurityTypeCode )) i++;
+               if (param == NULL) {
+                       MSG_DEBUG("WspLHeaderDecodeParameter:0x11 MemAlloc failed\n");
+                       return;
+               } else {
+                       strncpy((char*)param, "SEC=", WSP_STANDARD_STR_LEN_MAX-1);
+                       SecurityTypeCode = data[1] & 0x7f;
+                       while ((i < wspSecurityTypeCount) && (wspSecurityType[i].SecurityTypeCode != SecurityTypeCode)) i++;
 
-                               if (i < wspSecurityTypeCount) {
-                                       strncat( (char*)param, (char*)wspSecurityType[i].SecurityTypeName, WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)param)-1);
-                               }
+                       if (i < wspSecurityTypeCount) {
+                               strncat((char*)param, (char*)wspSecurityType[i].SecurityTypeName, WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)param)-1);
+                       }
 
-                               if (0x12 == (data[2] & 0x7f)) {
-                                       strncat( (char*)param, "; MAC=", WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)param)-1 );
-                                       memcpy(param+AcStrlen( (char*)param),(char*)(data+3),(size_t)length-3 );
-                               }
+                       if (0x12 == (data[2] & 0x7f)) {
+                               strncat((char*)param, "; MAC=", WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)param)-1);
+                               memcpy(param+AcStrlen((char*)param),(char*)(data+3),(size_t)length-3);
                        }
-                       break;
+               }
+               break;
 
-               default :
-                       param = NULL;
-                       break;
+       default :
+               param = NULL;
+               break;
        }
 
        *pParam = param;
@@ -3239,7 +3222,7 @@ void SmsPluginWapPushHandler::wspHeaderDecodeParameter( unsigned char* data, uns
 }
 
 
-void SmsPluginWapPushHandler::wspHeaderDecodeCharset( unsigned long length, unsigned char* data, char**pDecodedString)
+void SmsPluginWapPushHandler::wspHeaderDecodeCharset(unsigned long length, unsigned char* data, char**pDecodedString)
 {
 
        char* param = NULL;
@@ -3252,10 +3235,10 @@ void SmsPluginWapPushHandler::wspHeaderDecodeCharset( unsigned long length, unsi
                return;
        }
 
-       strncpy( (char*)param, "charset=", WSP_STANDARD_STR_LEN_MAX-1);
+       strncpy((char*)param, "charset=", WSP_STANDARD_STR_LEN_MAX-1);
 
        if (data[0] > 0x80) {
-               unsigned long code = wspHeaderDecodeInteger(data );
+               unsigned long code = wspHeaderDecodeInteger(data);
                unsigned long i = 0;
                while (wspCharset[i].charsetCode !=  code) {
                        if (wspCharset[i].charsetCode == 0xffff) {
@@ -3264,14 +3247,14 @@ void SmsPluginWapPushHandler::wspHeaderDecodeCharset( unsigned long length, unsi
                        }
                        i++;
                }
-               strncat( (char*)param, (char*)wspCharset[i].charsetName, WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)param)-1 );
+               strncat((char*)param, (char*)wspCharset[i].charsetName, WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)param)-1);
        } else {
                unsigned long lastLen = AcStrlen((char*)param);
                if (length + lastLen < WSP_STANDARD_STR_LEN_MAX - 1) {
-                       memcpy( (char*)(param + lastLen), data, (size_t)length );
+                       memcpy((char*)(param + lastLen), data, (size_t)length);
                        param[length + lastLen] = '\0';
                } else {
-                       memcpy( (char*)(param + lastLen), data, WSP_STANDARD_STR_LEN_MAX - lastLen - 1 );
+                       memcpy((char*)(param + lastLen), data, WSP_STANDARD_STR_LEN_MAX - lastLen - 1);
                        param[WSP_STANDARD_STR_LEN_MAX-1] = '\0';
                }
        }
@@ -3282,7 +3265,7 @@ void SmsPluginWapPushHandler::wspHeaderDecodeCharset( unsigned long length, unsi
 
 
 
-void SmsPluginWapPushHandler::wspHeaderDecodeVersion( unsigned long length, unsigned char* data, char** pDecodedString )
+void SmsPluginWapPushHandler::wspHeaderDecodeVersion(unsigned long length, unsigned char* data, char** pDecodedString)
 {
        *pDecodedString = new char[WSP_STANDARD_STR_LEN_MAX];
 
@@ -3293,100 +3276,94 @@ void SmsPluginWapPushHandler::wspHeaderDecodeVersion( unsigned long length, unsi
 
        if (length > 1) {
                /* untyped version */
-               memcpy( *pDecodedString, data, (size_t)length );
+               memcpy(*pDecodedString, data, (size_t)length);
        } else {
                /* typed version */
-               unsigned char majorVer  = ((data[0] & 0x7f ) >> 4 );
+               unsigned char majorVer  = ((data[0] & 0x7f) >> 4);
                unsigned char minorVer = data[0] & 0x0f;
-               snprintf( (char*)*pDecodedString, sizeof(char)*WSP_STANDARD_STR_LEN_MAX, "level=%u.%u", majorVer, minorVer );
+               snprintf((char*)*pDecodedString, sizeof(char)*WSP_STANDARD_STR_LEN_MAX, "level=%u.%u", majorVer, minorVer);
        }
 
        return;
 }
 
 
-void SmsPluginWapPushHandler::wspHeaderDecodeDateValue( unsigned long length, unsigned char* data, char** pDecodedString )
+void SmsPluginWapPushHandler::wspHeaderDecodeDateValue(unsigned long length, unsigned char* data, char** pDecodedString)
 {
        time_t  lTime;
        struct  tm pTMData;
 
-       MSG_DEBUG("WspLHeaderDecodeDateValue:   \n" );
+       MSG_DEBUG("WspLHeaderDecodeDateValue:   \n");
 
        *pDecodedString = new char[WSP_STANDARD_STR_LEN_MAX];
 
        if (*pDecodedString == NULL) {
-               MSG_DEBUG( "WspLHeaderDecodeDateValue:MemAlloc failed\n");
+               MSG_DEBUG("WspLHeaderDecodeDateValue:MemAlloc failed\n");
                return;
        }
 
        lTime = wspHeaderDecodeIntegerByLength(data, length);
 
-       (struct tm*)gmtime_r((const time_t* )&lTime, &pTMData);
-
-//     if (pTMData == NULL) {
-//             MSG_DEBUG( "WspLHeaderDecodeDateValue: Date decode fail \n" );
-//             strncpy( (char*)*pDecodedString, "Decoding Failed", WSP_STANDARD_STR_LEN_MAX-1);
-//             return;
-//     }
+       (struct tm*)gmtime_r((const time_t*)&lTime, &pTMData);
 
        /* check date value validity */
        {
-               if (( pTMData.tm_wday > 6 ) || (pTMData.tm_mon > 11 ) || (pTMData.tm_mday >  31 ))
+               if ((pTMData.tm_wday > 6) || (pTMData.tm_mon > 11) || (pTMData.tm_mday >  31))
                {
-                       MSG_DEBUG( "WspLHeaderDecodeDateValue: Date decode fail %d, %d, %d \n", pTMData.tm_wday, pTMData.tm_mon, pTMData.tm_mday );
-                       strncpy( (char*)*pDecodedString, "Decoding Failed", WSP_STANDARD_STR_LEN_MAX-1);
+                       MSG_DEBUG("WspLHeaderDecodeDateValue: Date decode fail %d, %d, %d \n", pTMData.tm_wday, pTMData.tm_mon, pTMData.tm_mday);
+                       strncpy((char*)*pDecodedString, "Decoding Failed", WSP_STANDARD_STR_LEN_MAX-1);
                        return;
                }
        }
 
 #ifdef MSG_FW_FOR_DEBUG
        /** Date type selection */
-       switch ( wspMachineStatus.dateType )
+       switch (wspMachineStatus.dateType)
        {
                        /* UNIX asciitime function */
                case UNIX_DATE_TYPE :
-                       snprintf( (char*)decodedString, sizeof(decodedString), "%s %s %-2u %u:%u:%u %u GMT", wspWeek[pTMData.tm_wday], wspMonth[pTMData.tm_mon],
-                                          pTMData.tm_mday, pTMData.tm_hour, pTMData.tm_min, pTMData.tm_sec, pTMData.tm_year + 1900 );
+                       snprintf((char*)decodedString, sizeof(decodedString), "%s %s %-2u %u:%u:%u %u GMT", wspWeek[pTMData.tm_wday], wspMonth[pTMData.tm_mon],
+                                          pTMData.tm_mday, pTMData.tm_hour, pTMData.tm_min, pTMData.tm_sec, pTMData.tm_year + 1900);
                        break;
                case RFC1123_DATE_TYPE :
-                       snprintf( (char*)decodedString, sizeof(decodedString), "%s, %u %s %u %u:%u:%u GMT", wspWeek[pTMData.tm_wday], pTMData.tm_mday,
-                                          wspMonth[pTMData.tm_mon], pTMData.tm_year + 1900, pTMData.tm_hour, pTMData.tm_min, pTMData.tm_sec );
+                       snprintf((char*)decodedString, sizeof(decodedString), "%s, %u %s %u %u:%u:%u GMT", wspWeek[pTMData.tm_wday], pTMData.tm_mday,
+                                          wspMonth[pTMData.tm_mon], pTMData.tm_year + 1900, pTMData.tm_hour, pTMData.tm_min, pTMData.tm_sec);
                        break;
                case RFC850_DATE_TYPE :
                        /* Have some Y2K Problems */
                        /* In RFC 850, date is represented like 11-May-99. So Y2K problem always can be occured. So remainer (year divided by 100) is used.                     */
-                       snprintf( (char*)decodedString, sizeof(decodedString), "%s, %2u-%s-%2u %u:%u:%u GMT", wspWeekDay[pTMData.tm_wday], pTMData.tm_mday,
-                                          wspMonth[pTMData.tm_mon], pTMData.tm_year % CENTURY, pTMData.tm_hour, pTMData.tm_min, pTMData.tm_sec );
+                       snprintf((char*)decodedString, sizeof(decodedString), "%s, %2u-%s-%2u %u:%u:%u GMT", wspWeekDay[pTMData.tm_wday], pTMData.tm_mday,
+                                          wspMonth[pTMData.tm_mon], pTMData.tm_year % CENTURY, pTMData.tm_hour, pTMData.tm_min, pTMData.tm_sec);
 
                        break;
        }
 #endif
        /**UNIX_DATE_TYPE : */
-       snprintf( (char*)*pDecodedString, (sizeof(char)*WSP_STANDARD_STR_LEN_MAX), "%s %s %-2u %u:%u:%u %u GMT", wspWeek[pTMData.tm_wday], wspMonth[pTMData.tm_mon],
-                                                                                       pTMData.tm_mday, pTMData.tm_hour, pTMData.tm_min, pTMData.tm_sec, pTMData.tm_year + 1900 );
+       snprintf((char*)*pDecodedString, (sizeof(char)*WSP_STANDARD_STR_LEN_MAX), "%s %s %-2u %u:%u:%u %u GMT", wspWeek[pTMData.tm_wday], wspMonth[pTMData.tm_mon],
+                                                                                       pTMData.tm_mday, pTMData.tm_hour, pTMData.tm_min, pTMData.tm_sec, pTMData.tm_year + 1900);
 
        return;
 
 }
 
-void SmsPluginWapPushHandler::wspHeaderCopyDecodedString( unsigned char* szDecodedString, unsigned long* currentLen, char** pTemper )
+void SmsPluginWapPushHandler::wspHeaderCopyDecodedString(unsigned char* szDecodedString, unsigned long* currentLen, char** pTemper)
 {
-       unsigned long elementLen = AcStrlen( (char*)szDecodedString );
+       unsigned long elementLen = AcStrlen((char*)szDecodedString);
        char* temper2 = NULL;
 
-       /**  // CR+LF */
+       /** CR+LF */
        *currentLen = *currentLen + elementLen + 2;
 
-       if ( *currentLen > AcStrlen( (char*)* pTemper ) + 2) {
-               temper2 = new char[(*currentLen + 1 )];
+       if (*currentLen > AcStrlen((char*)* pTemper) + 2) {
+               temper2 = new char[(*currentLen + 1)];
 
                if (temper2 == NULL) {
-                       MSG_DEBUG( "WspLHeaderCopyDecodedString:MemAlloc failed\n");
+                       MSG_DEBUG("WspLHeaderCopyDecodedString:MemAlloc failed\n");
                        return;
                }
-               strncpy( (char*)temper2, (char*)* pTemper, *currentLen);
+               strncpy((char*)temper2, (char*)* pTemper, *currentLen);
                delete[] *pTemper;
-               strncpy( (char*)temper2, (char*)szDecodedString, *currentLen);
+               strncpy((char*)temper2, (char*)szDecodedString, *currentLen);
        }
 
        *pTemper = temper2;
@@ -3395,7 +3372,7 @@ void SmsPluginWapPushHandler::wspHeaderCopyDecodedString( unsigned char* szDecod
 }
 
 
-void SmsPluginWapPushHandler::wspHeaderDecodeAuth(unsigned long fieldValueLen, unsigned char* fieldValue, char** pDecodedString )
+void SmsPluginWapPushHandler::wspHeaderDecodeAuth(unsigned long fieldValueLen, unsigned char* fieldValue, char** pDecodedString)
 {
        unsigned char  userId[WSP_STANDARD_STR_LEN_MAX];
        unsigned char  passWd[WSP_STANDARD_STR_LEN_MAX];
@@ -3405,7 +3382,7 @@ void SmsPluginWapPushHandler::wspHeaderDecodeAuth(unsigned long fieldValueLen, u
        *pDecodedString = new char[WSP_STANDARD_STR_LEN_MAX * 2];
 
        if (*pDecodedString == NULL) {
-               MSG_DEBUG("WspLHeaderDecodeAuth:MemAlloc failed\n" );
+               MSG_DEBUG("WspLHeaderDecodeAuth:MemAlloc failed\n");
                return;
        }
 
@@ -3413,19 +3390,19 @@ void SmsPluginWapPushHandler::wspHeaderDecodeAuth(unsigned long fieldValueLen, u
        iField++;
        memset(authStr, 0x00, sizeof(authStr));
        snprintf(authStr, sizeof(authStr), "%%%ds", sizeof(userId));
-       sscanf((char*)(fieldValue + iField), authStr, userId );
-       iField = iField + AcStrlen( (char*)userId ) + 1;
+       sscanf((char*)(fieldValue + iField), authStr, userId);
+       iField = iField + AcStrlen((char*)userId) + 1;
        memset(authStr, 0x00, sizeof(authStr));
        snprintf(authStr, sizeof(authStr), "%%%ds", sizeof(passWd));
-       sscanf( (char*)(fieldValue + iField), authStr, passWd );
-       iField = iField + AcStrlen( (char*)userId ) + 1;
-       snprintf( (char*)*pDecodedString, (sizeof(char)*WSP_STANDARD_STR_LEN_MAX*2), "basic %s/%s", userId, passWd );
+       sscanf((char*)(fieldValue + iField), authStr, passWd);
+       iField = iField + AcStrlen((char*)userId) + 1;
+       snprintf((char*)*pDecodedString, (sizeof(char)*WSP_STANDARD_STR_LEN_MAX*2), "basic %s/%s", userId, passWd);
 
        return;
 }
 
 
-void SmsPluginWapPushHandler::wspHeaderDecodeChallenge(unsigned long fieldValueLen, unsigned char* fieldValue, char** pDecodedString )
+void SmsPluginWapPushHandler::wspHeaderDecodeChallenge(unsigned long fieldValueLen, unsigned char* fieldValue, char** pDecodedString)
 {
        unsigned char userId[WSP_STANDARD_STR_LEN_MAX];
        unsigned long iField = 0;
@@ -3434,7 +3411,7 @@ void SmsPluginWapPushHandler::wspHeaderDecodeChallenge(unsigned long fieldValueL
        *pDecodedString = new char[WSP_STANDARD_STR_LEN_MAX];
 
        if (*pDecodedString == NULL) {
-               MSG_DEBUG( "WspLHeaderDecodeChallenge:MemAlloc failed\n");
+               MSG_DEBUG("WspLHeaderDecodeChallenge:MemAlloc failed\n");
                return;
        }
 
@@ -3442,10 +3419,10 @@ void SmsPluginWapPushHandler::wspHeaderDecodeChallenge(unsigned long fieldValueL
        iField++;
        memset(authStr, 0x00, sizeof(authStr));
        snprintf(authStr, sizeof(authStr), "%%%ds", sizeof(userId));
-       sscanf( (char*)(fieldValue + iField), authStr, userId );
-       iField = iField + AcStrlen( (char*)userId ) + 1;
+       sscanf((char*)(fieldValue + iField), authStr, userId);
+       iField = iField + AcStrlen((char*)userId) + 1;
 
-       snprintf( (char*)*pDecodedString, (sizeof(char)*WSP_STANDARD_STR_LEN_MAX), "basic realm=\"%s\"", userId );
+       snprintf((char*)*pDecodedString, (sizeof(char)*WSP_STANDARD_STR_LEN_MAX), "basic realm=\"%s\"", userId);
 
        return;
 }
@@ -3458,7 +3435,7 @@ void SmsPluginWapPushHandler::wspHeaderDecodeCacheControl(unsigned char* fieldVa
 
        *pCacheString = new char[WSP_STANDARD_STR_LEN_MAX];
        if (*pCacheString == NULL) {
-               MSG_DEBUG( "WspLHeaderDecodeCacheControl:MemAlloc failed\n");
+               MSG_DEBUG("WspLHeaderDecodeCacheControl:MemAlloc failed\n");
                return;
        }
 
@@ -3467,65 +3444,64 @@ void SmsPluginWapPushHandler::wspHeaderDecodeCacheControl(unsigned char* fieldVa
                if (fieldValue[0] > 0x8b) {
                        return; /* It's error detection. can be omitted. */
                }
-               strncpy( (char*)*pCacheString, (char*)wspCacheControl[fieldValue[0] & 0x7f], WSP_STANDARD_STR_LEN_MAX-1);
+               strncpy((char*)*pCacheString, (char*)wspCacheControl[fieldValue[0] & 0x7f], WSP_STANDARD_STR_LEN_MAX-1);
                return;
        }
 
        if (fieldValue[0] > 0x7f) {
                /* directive that has parameter */
                cacheCode = fieldValue[0] & 0x7f;
-               switch ( cacheCode )
-               {
-                               /* field name */
-                               /* no-cache */
-                       case 0x00 :
-                               /* private */
-                       case 0x07 :
-                               if (fieldValue[1] > 0x7f) {
-                                       /* well known field name */
-                                       strncpy( (char*)paramString, (char*)wspHeaderFieldName[fieldValue[1] & 0x7f],WSP_STANDARD_STR_LEN_MAX-1 );
-                                       paramString[WSP_STANDARD_STR_LEN_MAX-1] = '\0';
-                               } else {
-                                       /* unknown field name */
-                                       strncpy( (char*)paramString, (char*)fieldValue + 1 , WSP_STANDARD_STR_LEN_MAX-1);
-                               }
-                               break;
-                               /* secound */
-                               /* max-age */
-                       case 0x02 :
-                               /* max- stale */
-                       case 0x03 :
-                               /* min-fresh */
-                       case 0x04 :
-                               snprintf( (char*)paramString, sizeof(paramString), "%u", (unsigned int)wspHeaderDecodeInteger( fieldValue + 1));
-                               break;
-
-                       default :
-                               break;
+               switch (cacheCode) {
+                       /* field name */
+                       /* no-cache */
+               case 0x00 :
+                       /* private */
+               case 0x07 :
+                       if (fieldValue[1] > 0x7f) {
+                               /* well known field name */
+                               strncpy((char*)paramString, (char*)wspHeaderFieldName[fieldValue[1] & 0x7f],WSP_STANDARD_STR_LEN_MAX-1);
+                               paramString[WSP_STANDARD_STR_LEN_MAX-1] = '\0';
+                       } else {
+                               /* unknown field name */
+                               strncpy((char*)paramString, (char*)fieldValue + 1 , WSP_STANDARD_STR_LEN_MAX-1);
+                       }
+                       break;
+                       /* secound */
+                       /* max-age */
+               case 0x02 :
+                       /* max- stale */
+               case 0x03 :
+                       /* min-fresh */
+               case 0x04 :
+                       snprintf((char*)paramString, sizeof(paramString), "%u", (unsigned int)wspHeaderDecodeInteger(fieldValue + 1));
+                       break;
+
+               default :
+                       break;
 
                }
-               snprintf((char*)*pCacheString, (sizeof(char)*WSP_STANDARD_STR_LEN_MAX), "%s=%s", (char*)wspCacheControl[cacheCode], (char*)paramString );
+               snprintf((char*)*pCacheString, (sizeof(char)*WSP_STANDARD_STR_LEN_MAX), "%s=%s", (char*)wspCacheControl[cacheCode], (char*)paramString);
        } else {
                /* cache extentions */
                /* In case of come directive of doesn't specified string style */
 
                unsigned long stringLen;
                char szString[32];
-               strncpy( (char*)*pCacheString, (char*)fieldValue, WSP_STANDARD_STR_LEN_MAX-1);
-               stringLen = AcStrlen((char*)*pCacheString );
+               strncpy((char*)*pCacheString, (char*)fieldValue, WSP_STANDARD_STR_LEN_MAX-1);
+               stringLen = AcStrlen((char*)*pCacheString);
 
                if (stringLen + 1 < fieldValueLen) {
 
                        if (fieldValue[stringLen+ 1] > 0x7f) {
-                               int untyped = (int)wspHeaderDecodeIntegerByLength( fieldValue + stringLen + 1, fieldValueLen - (stringLen + 1 ));
+                               int untyped = (int)wspHeaderDecodeIntegerByLength(fieldValue + stringLen + 1, fieldValueLen - (stringLen + 1));
 
-                               snprintf( szString, sizeof(szString), "%d", untyped );
-                               strncat( (char*)*pCacheString, (char*)"=", WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)*pCacheString)-1 );
-                               strncat( (char*)*pCacheString, (char*)szString, WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)*pCacheString)-1 );
+                               snprintf(szString, sizeof(szString), "%d", untyped);
+                               strncat((char*)*pCacheString, (char*)"=", WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)*pCacheString)-1);
+                               strncat((char*)*pCacheString, (char*)szString, WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)*pCacheString)-1);
                        } else {
                                if (fieldValue[fieldValueLen] == 0) {
-                                       strncat( (char*)*pCacheString, (char*)"=", WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)*pCacheString)-1 );
-                                       strncat( (char*)*pCacheString, (char*)fieldValue + stringLen + 1 , WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)*pCacheString)-1);
+                                       strncat((char*)*pCacheString, (char*)"=", WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)*pCacheString)-1);
+                                       strncat((char*)*pCacheString, (char*)fieldValue + stringLen + 1 , WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)*pCacheString)-1);
                                }
                        }
                }
@@ -3536,7 +3512,7 @@ void SmsPluginWapPushHandler::wspHeaderDecodeCacheControl(unsigned char* fieldVa
 
 void SmsPluginWapPushHandler::getDisplayName(MSG_SUB_TYPE_T subType,char* displayName)
 {
-       if(subType == MSG_WAP_SL_SMS || subType == MSG_WAP_SI_SMS)
+       if (subType == MSG_WAP_SL_SMS || subType == MSG_WAP_SI_SMS)
                snprintf(displayName, MAX_ADDRESS_VAL_LEN + 1, "Push message");
        return;
 }
index 1634292..a230c0a 100755 (executable)
@@ -109,5 +109,5 @@ private:
        static SmsPluginCallback* pInstance;
 };
 
-#endif //SMS_PLUGIN_CALLBACK_H
+#endif /* SMS_PLUGIN_CALLBACK_H */
 
index c351889..e9097a7 100755 (executable)
@@ -98,5 +98,5 @@ private:
 
 };
 
-#endif //SMS_PLUGIN_CBMSG_HANDLER_H
+#endif /* SMS_PLUGIN_CBMSG_HANDLER_H */
 
index fa3552a..a4a6605 100755 (executable)
@@ -121,4 +121,4 @@ private:
 
 };
 
-#endif //SMS_PLUGIN_CONCAT_HANDLER_H
+#endif /* SMS_PLUGIN_CONCAT_HANDLER_H */
index 60b21b6..c3d6c65 100755 (executable)
@@ -39,6 +39,8 @@ public:
        int getSimIndex(struct tapi_handle *handle);
        void getDefaultNetworkSimId(int *simId);
 
+       int getSubscriberId(unsigned int simIndex, char **subscriber_id);
+
 private:
        static SmsPluginDSHandler* pInstance;
        SmsPluginDSHandler();
@@ -47,5 +49,5 @@ private:
        SMS_TELEPHONY_HANDLE_LIST_S handle_list;
 };
 
-#endif //SMS_PLUGIN_DS_HANDLER_H
+#endif /* SMS_PLUGIN_DS_HANDLER_H */
 
index 12a0cdb..de44c2f 100755 (executable)
@@ -56,7 +56,8 @@ public:
        void setDeviceStatus(struct tapi_handle *handle);
        bool getDeviceStatus(struct tapi_handle *handle);
 
-       void convertTpduToMsginfo(SMS_TPDU_S *pTpdu, MSG_MESSAGE_INFO_S *msgInfo); // temp
+       /* temp */
+       void convertTpduToMsginfo(SMS_TPDU_S *pTpdu, MSG_MESSAGE_INFO_S *msgInfo);
 
        MSG_SUB_TYPE_T convertMsgSubType(SMS_PID_T pid);
 
@@ -83,5 +84,5 @@ private:
        struct tapi_handle *devHandle;
 };
 
-#endif //SMS_PLUGIN_EVENT_HANDLER_H
+#endif /* SMS_PLUGIN_EVENT_HANDLER_H */
 
index bedffb8..be15355 100755 (executable)
@@ -66,5 +66,5 @@ msg_error_t SmsPlgGetDefaultNetworkSimId(int *simId);
 }
 #endif
 
-#endif //SMS_PLUGIN_MAIN_H
+#endif /* SMS_PLUGIN_MAIN_H */
 
index 0795823..799ba1b 100755 (executable)
@@ -51,4 +51,4 @@ private:
        static int convertBcdToDigit(const unsigned char *pBcd, int BcdLen, char *pDigit);
 };
 
-#endif //SMS_PLUGIN_PARAMCODEC_H
+#endif /* SMS_PLUGIN_PARAMCODEC_H */
index e6a640f..090d24b 100755 (executable)
@@ -69,5 +69,5 @@ private:
        CndVar cv;
 };
 
-#endif //SMS_PLUGIN_SAT_HANDLER_H
+#endif /* SMS_PLUGIN_SAT_HANDLER_H */
 
index 05e39d1..00a7fb5 100755 (executable)
@@ -125,5 +125,5 @@ private:
        CndVar cv;
 };
 
-#endif //SMS_PLUGIN_SETTING_H
+#endif /* SMS_PLUGIN_SETTING_H */
 
index fed6a1a..1e11050 100755 (executable)
@@ -47,7 +47,6 @@ public:
        msg_error_t saveSimMessage(const MSG_MESSAGE_INFO_S *pMsgInfo, SMS_SIM_ID_LIST_S *pSimIdList);
        msg_error_t saveClass2Message(const MSG_MESSAGE_INFO_S *pMsgInfo);
        void deleteSimMessage(msg_sim_slot_id_t sim_idx, msg_sim_id_t SimMsgId);
-       void getSimMessageList(MSG_SIM_MSG_INFO_LIST_S **ppSimMsgList);
        void setReadStatus(msg_sim_slot_id_t sim_idx, msg_sim_id_t SimMsgId);
        bool checkSimMsgFull(msg_sim_slot_id_t sim_idx, unsigned int SegCnt);
 
@@ -101,5 +100,5 @@ private:
        CndVar cv;
 };
 
-#endif //SMS_PLUGIN_SIMMSG_H
+#endif /* SMS_PLUGIN_SIMMSG_H */
 
index 0506e8f..734c316 100755 (executable)
@@ -87,5 +87,5 @@ private:
 //     unsigned char tmpMsgRef;
 };
 
-#endif //SMS_PLUGIN_STORAGE_H
+#endif /* SMS_PLUGIN_STORAGE_H */
 
index 597a91d..f206185 100755 (executable)
@@ -47,5 +47,5 @@ private:
        static int decodeStatusReport(const unsigned char *pTpdu, int TpduLen, SMS_STATUS_REPORT_S *pStatusRep);
 };
 
-#endif //SMS_PLUGIN_TPDU_CODEC_H
+#endif /* SMS_PLUGIN_TPDU_CODEC_H */
 
index 59f177c..bb9e1da 100755 (executable)
@@ -84,5 +84,5 @@ private:
        CndVar cv;
 };
 
-#endif //SMS_PLUGIN_TRANSPORT_H
+#endif /* SMS_PLUGIN_TRANSPORT_H */
 
index d705686..ea8d412 100755 (executable)
 /*==================================================================================================
                                     DEFINES
 ==================================================================================================*/
-#define MAX_ADDRESS_LEN                        21 // including '+'
+#define MAX_ADDRESS_LEN                        21 /* including '+' */
 #define MAX_USER_DATA_LEN                      160
 #define MAX_GSM_7BIT_DATA_LEN          160
 #define MAX_UCS2_DATA_LEN                      140
 //#define MAX_TPDU_DATA_LEN                    165
-//CID 321400: Making MAX_TPDU_DATA_LEN same as TAPI_NETTEXT_SMDATA_SIZE_MAX of TelSms.h to prevent any buffer overflow
+/* CID 321400: Making MAX_TPDU_DATA_LEN same as TAPI_NETTEXT_SMDATA_SIZE_MAX of TelSms.h to prevent any buffer overflow */
 #define MAX_TPDU_DATA_LEN                      255
 #define MAX_SMS_SEND_RETRY                     4
 #define MAX_SMSC_LEN                           20
@@ -118,8 +118,7 @@ typedef unsigned char SMS_NETWORK_STATUS_T; /* _SMS_NETWORK_STATUS_E */
 /*==================================================================================================
                                     ENUMS
 ==================================================================================================*/
-enum _SMS_TPDU_TYPE_E
-{
+enum _SMS_TPDU_TYPE_E {
        SMS_TPDU_SUBMIT,
        SMS_TPDU_DELIVER,
        SMS_TPDU_DELIVER_REP,
@@ -127,8 +126,7 @@ enum _SMS_TPDU_TYPE_E
 };
 
 
-enum _SMS_VPF_E
-{
+enum _SMS_VPF_E {
        SMS_VPF_NOT_PRESENT = 0,
        SMS_VPF_ENHANCED,
        SMS_VPF_RELATIVE,
@@ -136,8 +134,7 @@ enum _SMS_VPF_E
 };
 
 
-enum _SMS_TON_E
-{
+enum _SMS_TON_E {
        SMS_TON_UNKNOWN = 0,            /* unknown */
        SMS_TON_INTERNATIONAL,  /* international */
        SMS_TON_NATIONAL,                       /* national */
@@ -149,8 +146,7 @@ enum _SMS_TON_E
 };
 
 
-enum _SMS_NPI_E
-{
+enum _SMS_NPI_E {
        SMS_NPI_UNKNOWN = 0,            /* unknown */
        SMS_NPI_ISDN = 1,                       /* idsn */
        SMS_NPI_DATA = 3,                       /* data */
@@ -162,8 +158,7 @@ enum _SMS_NPI_E
 };
 
 
-enum _SMS_PID_E
-{
+enum _SMS_PID_E {
        SMS_PID_NORMAL = 0x00,
 
        SMS_PID_TELEX = 0x21,
@@ -195,8 +190,7 @@ enum _SMS_PID_E
 };
 
 
-enum _SMS_MSG_CLASS_E
-{
+enum _SMS_MSG_CLASS_E {
        SMS_MSG_CLASS_0 = 0,
        SMS_MSG_CLASS_1,
        SMS_MSG_CLASS_2,
@@ -205,8 +199,7 @@ enum _SMS_MSG_CLASS_E
 };
 
 
-enum _SMS_CODING_SCHEME_E
-{
+enum _SMS_CODING_SCHEME_E {
        SMS_CHARSET_7BIT = 0,
        SMS_CHARSET_8BIT,
        SMS_CHARSET_UCS2,
@@ -215,8 +208,7 @@ enum _SMS_CODING_SCHEME_E
 };
 
 
-enum _SMS_CODING_GROUP_E
-{
+enum _SMS_CODING_GROUP_E {
        SMS_GROUP_GENERAL = 0,
        SMS_GROUP_CODING_CLASS,
        SMS_GROUP_DELETION,
@@ -226,25 +218,22 @@ enum _SMS_CODING_GROUP_E
 };
 
 
-enum _SMS_INDICATOR_TYPE_E
-{
+enum _SMS_INDICATOR_TYPE_E {
        SMS_VOICE_INDICATOR = 0,
-       SMS_VOICE2_INDICATOR, // Only for CPSH
+       SMS_VOICE2_INDICATOR, /* Only for CPSH */
        SMS_FAX_INDICATOR,
        SMS_EMAIL_INDICATOR,
        SMS_OTHER_INDICATOR,
 };
 
 
-enum _SMS_TIME_FORMAT_E
-{
+enum _SMS_TIME_FORMAT_E {
        SMS_TIME_RELATIVE = 0,
        SMS_TIME_ABSOLUTE
 };
 
 
-enum _SMS_FAIL_CAUSE_E
-{
+enum _SMS_FAIL_CAUSE_E {
        SMS_FC_MSG_TYPE0_NOT_SUPPORTED = 0x81,
        SMS_FC_SM_CANNOT_BE_REPLACED = 0x82,
        SMS_FC_UNSPEC_PID_ERROR = 0x8F,
@@ -261,8 +250,7 @@ enum _SMS_FAIL_CAUSE_E
 };
 
 
-enum _SMS_STATUS_E
-{
+enum _SMS_STATUS_E {
        SMS_STATUS_RECEIVE_SUCCESS = 0x00,
        SMS_STATUS_UNABLE_TO_CONFIRM_DELIVER = 0x01,
        SMS_STATUS_REPLACED = 0x02,
@@ -295,25 +283,22 @@ enum _SMS_STATUS_E
 };
 
 
-enum _SMS_REF_NUMBER_E
-{
+enum _SMS_REF_NUMBER_E {
        SMS_REF_NUM_8BIT = 0,
        SMS_REF_NUM_16BIT
 };
 
 
-enum _SMS_REPORT_TYPE_E
-{
+enum _SMS_REPORT_TYPE_E {
        SMS_REPORT_POSITIVE = 0,
        SMS_REPORT_NEGATIVE
 };
 
 
-enum _SMS_UDH_TYPE_E
-{
+enum _SMS_UDH_TYPE_E {
        SMS_UDH_CONCAT_8BIT = 0x00,
        SMS_UDH_SPECIAL_SMS = 0x01,
-       // 0x02, 0x03 - Reserved
+       /* 0x02, 0x03 - Reserved */
        SMS_UDH_APP_PORT_8BIT = 0x04,
        SMS_UDH_APP_PORT_16BIT = 0x05,
        SMS_UDH_SC_CONTROL = 0x06,
@@ -329,8 +314,7 @@ enum _SMS_UDH_TYPE_E
 };
 
 
-enum _SMS_WAP_APP_CODE_E
-{
+enum _SMS_WAP_APP_CODE_E {
        SMS_WAP_APPLICATION_DEFAULT = 0x00,
 
        SMS_WAP_APPLICATION_PUSH_SI,
@@ -396,15 +380,13 @@ enum _SMS_WAP_APP_CODE_E
 };
 
 
-enum _SMS_CB_NETWORK_TYPE_E
-{
+enum _SMS_CB_NETWORK_TYPE_E {
        SMS_CB_NETWORK_TYPE_2G_GSM = 1,
        SMS_CB_NETWORK_TYPE_3G_UMTS,
 };
 
 
-enum _SMS_CBMSG_TYPE_E
-{
+enum _SMS_CBMSG_TYPE_E {
        SMS_CBMSG_TYPE_CBS = 1,         /**< CBS */
        SMS_CBMSG_TYPE_SCHEDULE,                /**< Schedule */
        SMS_CBMSG_TYPE_CBS41,                   /**< CBS41 */
@@ -413,8 +395,7 @@ enum _SMS_CBMSG_TYPE_E
 };
 
 
-enum _SMS_CBMSG_LANG_TYPE_E
-{
+enum _SMS_CBMSG_LANG_TYPE_E {
        SMS_CBMSG_LANG_GERMAN                   = 0x00,
        SMS_CBMSG_LANG_ENGLISH                  = 0x01,
        SMS_CBMSG_LANG_ITALIAN                  = 0x02,
@@ -455,24 +436,21 @@ enum _SMS_CBMSG_LANG_TYPE_E
 };
 
 
-enum _SMS_CBMSG_CODING_GROUP_E
-{
+enum _SMS_CBMSG_CODING_GROUP_E {
        SMS_CBMSG_CODGRP_GENERAL_DCS,                   /**< Bits 7..4 00xx */
        SMS_CBMSG_CODGRP_WAP,                                   /**< 1110 Cell Broadcast */
        SMS_CBMSG_CODGRP_CLASS_CODING,                  /**< 1111 Cell Broadcast */
 };
 
 
-enum _SMS_SAT_CMD_TYPE_E
-{
+enum _SMS_SAT_CMD_TYPE_E {
        SMS_SAT_CMD_REFRESH,
        SMS_SAT_CMD_SEND_SMS,
        SMS_SAT_CMD_SMS_CTRL,
 };
 
 
-enum _SMS_SIM_EFILE_NAME_E
-{
+enum _SMS_SIM_EFILE_NAME_E {
        SMS_SIM_EFILE_USIM_SMS  = 0x6A3C,               /** < USIM Short Messages file */
        SMS_SIM_EFILE_USIM_SMSP = 0x6A42,               /** < USIM SMS parameter */
        SMS_SIM_EFILE_USIM_SMSS = 0x6A43,               /** < USIM SMS status */
@@ -514,16 +492,14 @@ enum _SMS_NETWORK_STATUS_E {
 /*==================================================================================================
                                          STRUCTURES
 ==================================================================================================*/
-typedef struct _SMS_ADDRESS_S
-{
+typedef struct _SMS_ADDRESS_S {
        SMS_TON_T               ton;
        SMS_NPI_T               npi;
        char                            address[MAX_ADDRESS_LEN+1];        /* < null terminated string */
 } SMS_ADDRESS_S;
 
 
-typedef struct _SMS_DCS_S
-{
+typedef struct _SMS_DCS_S {
        bool                                            bCompressed;
        bool                                            bMWI;
        bool                                            bIndActive;
@@ -534,14 +510,12 @@ typedef struct _SMS_DCS_S
 } SMS_DCS_S;
 
 
-typedef struct _SMS_TIME_REL_S
-{
+typedef struct _SMS_TIME_REL_S {
        unsigned char time;
 } SMS_TIME_REL_S;
 
 
-typedef struct _SMS_TIME_ABS_S
-{
+typedef struct _SMS_TIME_ABS_S {
        unsigned char year;
        unsigned char month;
        unsigned char day;
@@ -552,62 +526,53 @@ typedef struct _SMS_TIME_ABS_S
 } SMS_TIME_ABS_S;
 
 
-typedef struct _SMS_TIMESTAMP_S
-{
+typedef struct _SMS_TIMESTAMP_S {
        SMS_TIME_FORMAT_T format;
 
-       union
-       {
+       union {
                SMS_TIME_REL_S  relative;
                SMS_TIME_ABS_S  absolute;
        } time;
 } SMS_TIMESTAMP_S;
 
 
-typedef struct _SMS_CONCAT_8BIT_S
-{
+typedef struct _SMS_CONCAT_8BIT_S {
        unsigned char           msgRef;
        unsigned char           totalSeg;
        unsigned char           seqNum;
 } SMS_CONCAT_8BIT_S;
 
 
-typedef struct _SMS_CONCAT_16BIT_S
-{
+typedef struct _SMS_CONCAT_16BIT_S {
        unsigned short          msgRef;
        unsigned char           totalSeg;
        unsigned char           seqNum;
 } SMS_CONCAT_16BIT_S;
 
 
-typedef struct _SMS_APP_PORT_8BIT_S
-{
+typedef struct _SMS_APP_PORT_8BIT_S {
        unsigned char           destPort;
        unsigned char           originPort;
 } SMS_APP_PORT_8BIT_S;
 
 
-typedef struct _SMS_APP_PORT_16BIT_S
-{
+typedef struct _SMS_APP_PORT_16BIT_S {
        unsigned short          destPort;
        unsigned short          originPort;
 } SMS_APP_PORT_16BIT_S;
 
 
-typedef struct _SMS_SPECIAL_INDICATION_S
-{
+typedef struct _SMS_SPECIAL_INDICATION_S {
        bool                            bStore;
        unsigned short          msgInd;
        unsigned short          waitMsgNum;
 } SMS_SPECIAL_INDICATION_S;
 
 
-typedef struct _SMS_UDH_S
-{
+typedef struct _SMS_UDH_S {
        SMS_UDH_TYPE_T udhType;
 
-       union
-       {
+       union {
                SMS_CONCAT_8BIT_S                       concat8bit;
                SMS_CONCAT_16BIT_S                      concat16bit;
                SMS_APP_PORT_8BIT_S             appPort8bit;
@@ -620,8 +585,7 @@ typedef struct _SMS_UDH_S
 } SMS_UDH_S;
 
 
-typedef struct _SMS_USERDATA_S
-{
+typedef struct _SMS_USERDATA_S {
        int                     headerCnt;
        SMS_UDH_S       header[MAX_UD_HEADER_NUM];
        int                     length;
@@ -629,15 +593,13 @@ typedef struct _SMS_USERDATA_S
 } SMS_USERDATA_S;
 
 
-typedef struct _SMS_TPUD_S
-{
+typedef struct _SMS_TPUD_S {
        int             udl;
        char            ud[MAX_USER_DATA_LEN+1];
 } SMS_TPUD_S;
 
 
-typedef struct _SMS_SUBMIT_S
-{
+typedef struct _SMS_SUBMIT_S {
        bool                            bRejectDup;
        bool                            bStatusReport;
        bool                            bHeaderInd;
@@ -660,8 +622,7 @@ typedef struct _SMS_SUBMIT_DATA_S
 } SMS_SUBMIT_DATA_S;
 
 
-typedef struct _SMS_DELIVER_S
-{
+typedef struct _SMS_DELIVER_S {
        bool                            bMoreMsg;
        bool                            bStatusReport;
        bool                            bHeaderInd;
@@ -675,8 +636,7 @@ typedef struct _SMS_DELIVER_S
 } SMS_DELIVER_S;
 
 
-typedef struct _SMS_DELIVER_REPORT_S
-{
+typedef struct _SMS_DELIVER_REPORT_S {
        SMS_REPORT_TYPE_T       reportType;
        bool                                    bHeaderInd;
        SMS_FAIL_CAUSE_T                failCause;
@@ -687,8 +647,7 @@ typedef struct _SMS_DELIVER_REPORT_S
 } SMS_DELIVER_REPORT_S;
 
 
-typedef struct _SMS_STATUS_REPORT_S
-{
+typedef struct _SMS_STATUS_REPORT_S {
        bool                            bMoreMsg;
        bool                            bStatusReport;
        bool                            bHeaderInd;
@@ -704,12 +663,10 @@ typedef struct _SMS_STATUS_REPORT_S
 } SMS_STATUS_REPORT_S;
 
 
-typedef struct _SMS_TPDU_S
-{
+typedef struct _SMS_TPDU_S {
        SMS_TPDU_TYPE_T tpduType;
 
-       union
-       {
+       union {
                SMS_SUBMIT_S                    submit;
                SMS_DELIVER_S                   deliver;
                SMS_DELIVER_REPORT_S    deliverRep;
@@ -718,39 +675,34 @@ typedef struct _SMS_TPDU_S
 } SMS_TPDU_S;
 
 
-typedef struct
-{
+typedef struct {
        msg_request_id_t                                reqId;          /**< Indicates the request ID, which is unique. When applications submit a request to the framework, this value will be set by the framework. */
        MSG_MESSAGE_INFO_S                      msgInfo;        /**< Indicates the message structure to be sent by applications. */
        MSG_SENDINGOPT_INFO_S   sendOptInfo;
 } SMS_REQUEST_INFO_S;
 
 
-typedef struct _SMS_SENT_INFO_S
-{
+typedef struct _SMS_SENT_INFO_S {
        SMS_REQUEST_INFO_S              reqInfo;                /**< Indicates the corresponding request structure. */
        bool                                            bLast;
 } SMS_SENT_INFO_S;
 
 
-typedef struct _SMS_PUSH_APP_INFO_S
-{
+typedef struct _SMS_PUSH_APP_INFO_S {
        char*                           pContentType;
        char*                           pAppId;
        SMS_WAP_APP_CODE_T      appCode;
 } SMS_PUSH_APP_INFO_S;
 
 
-typedef struct _SMS_CBMSG_SERIAL_NUM_S
-{
+typedef struct _SMS_CBMSG_SERIAL_NUM_S {
        unsigned char           geoScope;
        unsigned char           updateNum;
        unsigned short          msgCode;
 } SMS_CBMSG_SERIAL_NUM_S;
 
 
-typedef struct _SMS_CBMSG_DCS_S
-{
+typedef struct _SMS_CBMSG_DCS_S {
        SMS_CBMSG_CODING_GROUP_T                codingGroup;            /**< Coding group, GSM 03.38 */
        SMS_MSG_CLASS_T                                 classType;              /**< The message class */
        bool                                                            bCompressed;            /**< if text is compressed this is TRUE */
@@ -762,8 +714,7 @@ typedef struct _SMS_CBMSG_DCS_S
 } SMS_CBMSG_DCS_S;
 
 
-typedef struct _SMS_CBMSG_HEADER_S
-{
+typedef struct _SMS_CBMSG_HEADER_S {
        SMS_CBMSG_SERIAL_NUM_S          serialNum;              /**< Cell Broadcast Serial number */
        unsigned short                                  msgId;                  /**< Message identifier code */
        MSG_CB_LANGUAGE_TYPE_T          langType;               /**< Languages in CB Messages */
@@ -774,8 +725,7 @@ typedef struct _SMS_CBMSG_HEADER_S
 } SMS_CBMSG_HEADER_S;
 
 
-typedef struct _SMS_CBMSG_PAGE_S
-{
+typedef struct _SMS_CBMSG_PAGE_S {
        SMS_CBMSG_TYPE_T                        cbMsgType;                                                      /*CBS Msg or SCHEDULE Msg or CBS41 Msg */
        SMS_CBMSG_HEADER_S                      pageHeader;                                                     /**< CB Message Header */
        int                                                     pageLength;                                                     /**< message string length */
@@ -783,8 +733,7 @@ typedef struct _SMS_CBMSG_PAGE_S
 } SMS_CBMSG_PAGE_S;
 
 
-typedef struct _SMS_CBMSG_S
-{
+typedef struct _SMS_CBMSG_S {
        SMS_CBMSG_TYPE_T                        cbMsgType;                                                      /*CBS Msg or SCHEDULE Msg or CBS41 Msg */
        unsigned short                                  msgId;                                                          /**< Message identifier code */
        SMS_MSG_CLASS_T                         classType;                                                      /**< The message class */
@@ -794,8 +743,7 @@ typedef struct _SMS_CBMSG_S
        char                                                    msgData[MAX_CBMSG_PAGE_SIZE*8/7*MAX_CBMSG_PAGE_NUM+1];          /**< user data */
 } SMS_CBMSG_S;
 
-typedef struct _SMS_ETWS_PRIMARY_S
-{
+typedef struct _SMS_ETWS_PRIMARY_S {
        time_t                                          recvTime;
        SMS_CBMSG_SERIAL_NUM_S          serialNum;
        unsigned short                          msgId;
@@ -804,50 +752,43 @@ typedef struct _SMS_ETWS_PRIMARY_S
 }SMS_ETWS_PRIMARY_S;
 
 
-typedef struct _SMS_WSP_CONTENTS_TYPE_S
-{
+typedef struct _SMS_WSP_CONTENTS_TYPE_S {
        char*         contentsTypeName;
        unsigned char contentsTypeCode;
 } SMS_WSP_CONTENTS_TYPE_S;
 
 
-typedef struct _SMS_WSP_CHARSET_S
-{
+typedef struct _SMS_WSP_CHARSET_S {
        char*  charsetName;
        unsigned short charsetCode;
 } SMS_WSP_CHARSET_S;
 
 
-typedef struct _SMS_WAP_UNREGISTER_CONTENTS_TYPE_S
-{
+typedef struct _SMS_WAP_UNREGISTER_CONTENTS_TYPE_S {
        char*         contentsTypeName;
        unsigned short contentsTypeCode;
 } SMS_WAP_UNREGISTER_CONTENTS_TYPE_S;
 
 
-typedef struct _SMS_WSP_LANGUAGE_S
-{
+typedef struct _SMS_WSP_LANGUAGE_S {
        char*         languageName;
        unsigned char languageCode;
 } SMS_WSP_LANGUAGE_S;
 
 
-typedef struct _SMS_WSP_HEADER_PARAMETER_S
-{
+typedef struct _SMS_WSP_HEADER_PARAMETER_S {
        char*         parameterToken;
        unsigned int parameterCode;
 } SMS_WSP_HEADER_PARAMETER_S;
 
 
-typedef struct _SMS_WSP_METHOD_TYPE_S
-{
+typedef struct _SMS_WSP_METHOD_TYPE_S {
        char*         methodName;
        unsigned char methodCode;
 } SMS_WSP_METHOD_TYPE_S;
 
 
-typedef struct _SMS_WSP_SECURITY_TYPE_S
-{
+typedef struct _SMS_WSP_SECURITY_TYPE_S {
        char*         SecurityTypeName;
        unsigned char SecurityTypeCode;
 }SMS_WSP_SECURITY_TYPE_S;
@@ -856,8 +797,7 @@ typedef struct _SMS_WSP_SECURITY_TYPE_S
 /**
  *     @brief  Represents SIM count information.
  */
-typedef struct
-{
+typedef struct {
        unsigned int    totalCount;                     /**< The total number of SIM */
        int                     usedCount;                      /**< The used number of SIM */
        int                     indexList[MAX_SIM_SMS_NUM];     /**< The SIM index list */
@@ -867,8 +807,7 @@ typedef struct
 /**
  *     @brief  Represents Concat SIM Msg information.
  */
-typedef struct
-{
+typedef struct {
        unsigned int            simIdCnt;                                                                                       /**< The total number of SIM Msg ID*/
        msg_sim_id_t            simIdList[MAX_SEGMENT_NUM];                                                     /**< The SIM Msg ID List */
        char                            msgData[(MAX_MSG_DATA_LEN*MAX_SEGMENT_NUM)+1];          /**< user data */
@@ -899,7 +838,7 @@ typedef struct {
  */
 typedef struct {
        int count;
-       SMS_SIM_MAILBOX_INFO_S list[MAX_SIM_MSP_CNT*5]; //max is 10
+       SMS_SIM_MAILBOX_INFO_S list[MAX_SIM_MSP_CNT*5]; /* max is 10 */
 } SMS_SIM_MAILBOX_LIST_S;
 
 
@@ -971,7 +910,7 @@ typedef struct {
  */
 typedef struct {
        int count;
-       struct tapi_handle *handle[MAX_TELEPHONY_HANDLE_CNT]; //max is 3
+       struct tapi_handle *handle[MAX_TELEPHONY_HANDLE_CNT]; /* max is 3 */
 } SMS_TELEPHONY_HANDLE_LIST_S;
 
-#endif //SMS_PLUGIN_TYPES_H
+#endif /* SMS_PLUGIN_TYPES_H */
index 8a50cab..03afcde 100755 (executable)
@@ -57,5 +57,5 @@ private:
        CndVar cv;
 };
 
-#endif //SMS_PLUGIN_UA_MANAGER_H
+#endif /* SMS_PLUGIN_UA_MANAGER_H */
 
index c109210..ade94f9 100755 (executable)
@@ -53,5 +53,5 @@ private:
        static int decodeHeader(const unsigned char *pTpdu, SMS_UDH_S *pHeader);
 };
 
-#endif
+#endif /* SMS_PLUGIN_UDCODEC_H */
 
index f47b46e..009fcb4 100755 (executable)
@@ -50,7 +50,6 @@ class SmsPluginWapPushHandler
 public:
        static SmsPluginWapPushHandler* instance();
 
-       //void registerPushCallback();
        bool IsWapPushMsg(SMS_USERDATA_S *pUserData);
 
        void copyDeliverData(SMS_DELIVER_S *pDeliver);
@@ -98,5 +97,5 @@ private:
        SMS_TIMESTAMP_S tmpTimeStamp;
 };
 
-#endif //SmsPluginWapPushHandler
+#endif /* SmsPluginWapPushHandler */
 
index d2ca1d3..d236e04 100755 (executable)
@@ -8,7 +8,7 @@ IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
 ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
 MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")
 
-SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -O0 -g -Wall")
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -O2 -g -Wall")
 
 ##########################################################
 # Define Transaction Proxy
index 3102631..ea29ac7 100755 (executable)
@@ -45,12 +45,11 @@ MsgHandle::~MsgHandle()
 
 void MsgHandle::openHandle()
 {
-//     int ret = 0;
-//     size_t cookieSize;
-
        bool bReady = false;
 
-       // server is currently booting and service is not available until the end of booting
+       MsgProxyListener::instance()->insertOpenHandleSet(this);
+
+       /* server is currently booting and service is not available until the end of booting */
        MsgSettingGetBool(VCONFKEY_MSG_SERVER_READY, &bReady);
 
        if (bReady == false) {
@@ -59,8 +58,7 @@ void MsgHandle::openHandle()
                MSG_INFO("Msg Server is ready !!!!!");
        }
 
-
-       // Open Socket IPC
+       /* Open Socket IPC */
        connectSocket();
 }
 
@@ -69,16 +67,16 @@ void MsgHandle::closeHandle(MsgHandle* pHandle)
 {
        MSG_BEGIN();
 
-       //Remove CB List of closing Handle
+       /* Remove CB List of closing Handle */
        MsgProxyListener* eventListener = MsgProxyListener::instance();
 
        eventListener->clearListOfClosedHandle(pHandle);
-       //eventListener->stop();
+       /* eventListener->stop(); */
 
-       // Close Socket IPC
+       /* Close Socket IPC */
        disconnectSocket();
 
-       // Close Contact Service
+       /* Close Contact Service */
        if (MsgCloseContactSvc() != MSG_SUCCESS) {
                MSG_DEBUG("Fail to close contact service.");
        }
@@ -108,25 +106,26 @@ void MsgHandle::write(const char *pCmdData, int cmdSize, char **ppEvent)
 
        int ret = 0;
 
-       // Send Command to MSG FW
+       /* Send Command to MSG FW */
+       MutexLocker lock(mx);
        ret = mClientSock.write(pCmdData, cmdSize);
        if (ret < 0)
                THROW(MsgException::IPC_ERROR, "IPC write error");
 
        char *tmpEvent = NULL;
 
-       while(1)
-       {
-               // Receive Result from MSG FW
+       while (1) {
+               /* Receive Result from MSG FW */
                read(&tmpEvent);
 
-               if(tmpEvent == NULL) {
+               if (tmpEvent == NULL) {
                        MSG_DEBUG("Event Data is NULL!!");
                        break;
                }
 
-               if(!CheckEventData(tmpEvent)) {
+               if (!CheckEventData(tmpEvent)) {
                        delete [] tmpEvent;
+                       tmpEvent = NULL;
                } else {
                        *ppEvent = tmpEvent;
                        break;
@@ -216,7 +215,7 @@ void MsgHandle::convertMsgStruct(const MSG_MESSAGE_HIDDEN_S *pSrc, MSG_MESSAGE_I
        pDest->priority = pSrc->priority;
        pDest->direction = pSrc->direction;
 
-       // Set Port Info.
+       /* Set Port Info. */
        pDest->msgPort.valid = pSrc->bPortValid;
 
        if (pDest->msgPort.valid == true) {
@@ -226,7 +225,7 @@ void MsgHandle::convertMsgStruct(const MSG_MESSAGE_HIDDEN_S *pSrc, MSG_MESSAGE_I
 
        MSG_DEBUG("nSize = %d",  pSrc->dataSize);
 
-       if (pSrc->mainType == MSG_SMS_TYPE){
+       if (pSrc->mainType == MSG_SMS_TYPE) {
                if (pSrc->pData != NULL) {
                        pDest->bTextSms = true;
                        pDest->dataSize = pSrc->dataSize;
@@ -234,11 +233,11 @@ void MsgHandle::convertMsgStruct(const MSG_MESSAGE_HIDDEN_S *pSrc, MSG_MESSAGE_I
                        memset(pDest->msgText, 0x00, sizeof(pDest->msgText));
 
                        if (pSrc->dataSize > MAX_MSG_TEXT_LEN) {
-                               // Save Message Data into File
+                               /* Save Message Data into File */
                                char fileName[MSG_FILENAME_LEN_MAX+1];
                                memset(fileName, 0x00, sizeof(fileName));
 
-                               if(MsgCreateFileName(fileName) == false)
+                               if (MsgCreateFileName(fileName) == false)
                                        THROW(MsgException::FILE_ERROR, "MsgCreateFileName error");
 
                                MSG_SEC_DEBUG("Save pSrc->pData into file : size[%d] name[%s]", pDest->dataSize, fileName);
@@ -271,7 +270,7 @@ void MsgHandle::convertMsgStruct(const MSG_MESSAGE_HIDDEN_S *pSrc, MSG_MESSAGE_I
                pDest->bTextSms = false;
                pDest->dataSize = pSrc->dataSize;
 
-               if(pSrc->subType == MSG_READREPLY_MMS) {
+               if (pSrc->subType == MSG_READREPLY_MMS) {
                        memset(pDest->msgData, 0x00, sizeof(pDest->msgData));
 
                        if (pSrc->mmsDataSize < MAX_MSG_DATA_LEN)
@@ -280,14 +279,14 @@ void MsgHandle::convertMsgStruct(const MSG_MESSAGE_HIDDEN_S *pSrc, MSG_MESSAGE_I
                                memcpy(pDest->msgData, pSrc->pMmsData, MAX_MSG_DATA_LEN);
 
                } else {
-                       // Save Message Data into File
+                       /* Save Message Data into File */
                        char fileName[MSG_FILENAME_LEN_MAX+1];
                        memset(fileName, 0x00, sizeof(fileName));
 
-                       if(MsgCreateFileName(fileName) == false)
+                       if (MsgCreateFileName(fileName) == false)
                                THROW(MsgException::FILE_ERROR, "MsgCreateFileName error");
 
-                       // change file extension in case of java MMS msg
+                       /* change file extension in case of java MMS msg */
                        if (pSrc->subType == MSG_SENDREQ_JAVA_MMS) {
                                char* pFileNameExt = NULL;
                                pFileNameExt = strstr(fileName,"DATA");
@@ -342,7 +341,7 @@ void MsgHandle::convertMsgStruct(const MSG_MESSAGE_INFO_S *pSrc, MSG_MESSAGE_HID
        pDest->direction = pSrc->direction;
        pDest->simIndex = pSrc->sim_idx;
 
-       // Set Port Info.
+       /* Set Port Info. */
        pDest->bPortValid = pSrc->msgPort.valid;
 
        if (pDest->bPortValid == true) {
@@ -350,7 +349,7 @@ void MsgHandle::convertMsgStruct(const MSG_MESSAGE_INFO_S *pSrc, MSG_MESSAGE_HID
                pDest->srcPort = pSrc->msgPort.srcPort;
        }
 
-       if(pSrc->thumbPath[0] != '\0')
+       if (pSrc->thumbPath[0] != '\0')
                strncpy(pDest->thumbPath, pSrc->thumbPath, MSG_FILEPATH_LEN_MAX);
 
        int maxCnt = (pSrc->nAddressCnt > 10)? MAX_TO_ADDRESS_CNT: pSrc->nAddressCnt;
@@ -401,7 +400,7 @@ void MsgHandle::convertMsgStruct(const MSG_MESSAGE_INFO_S *pSrc, MSG_MESSAGE_HID
 
                pDest->dataSize = pSrc->dataSize;
 
-               // Get Message Data from File
+               /* Get Message Data from File */
                if (MsgOpenAndReadFile(pSrc->msgData, &pFileData, &fileSize) == false)
                        THROW(MsgException::FILE_ERROR, "MsgOpenAndReadFile error");
 
@@ -479,21 +478,17 @@ void MsgHandle::convertSendOptStruct(const MSG_SENDINGOPT_S* pSrc, MSG_SENDINGOP
 
        if (msgType.mainType == MSG_SMS_TYPE) {
                msg_struct_s *pStruct = (msg_struct_s *)pSrc->smsSendOpt;
-               if(pStruct)
-               {
+               if (pStruct) {
                        SMS_SENDINGOPT_S *pSms = (SMS_SENDINGOPT_S *)pStruct->data;
-                       if(pSms)
-                       {
+                       if (pSms) {
                                pDest->option.smsSendOptInfo.bReplyPath = pSms->bReplyPath;
                        }
                }
        } else if (msgType.mainType == MSG_MMS_TYPE) {
                msg_struct_s *pStruct = (msg_struct_s *)pSrc->mmsSendOpt;
-               if(pStruct)
-               {
+               if (pStruct) {
                        MMS_SENDINGOPT_S *pMms = (MMS_SENDINGOPT_S *)pStruct->data;
-                       if(pMms)
-                       {
+                       if (pMms) {
                                pDest->option.mmsSendOptInfo.priority = pMms->priority;
                                pDest->option.mmsSendOptInfo.bReadReq = pMms->bReadReq;
 
@@ -560,38 +555,37 @@ int MsgHandle::getSettingCmdSize(MSG_OPTION_TYPE_T optionType)
 {
        int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_OPTION_TYPE_T);
 
-       switch (optionType)
-       {
-               case MSG_GENERAL_OPT :
-                       cmdSize += sizeof(MSG_GENERAL_OPT_S);
-               break;
-               case MSG_SMS_SENDOPT :
-                       cmdSize += sizeof(MSG_SMS_SENDOPT_S);
-               break;
-               case MSG_SMSC_LIST :
-                       cmdSize += sizeof(MSG_SMSC_LIST_S);
-               break;
-               case MSG_MMS_SENDOPT :
-                       cmdSize += sizeof(MSG_MMS_SENDOPT_S);
-               break;
-               case MSG_MMS_RECVOPT :
-                       cmdSize += sizeof(MSG_MMS_RECVOPT_S);
-               break;
-               case MSG_MMS_STYLEOPT :
-                       cmdSize += sizeof(MSG_MMS_STYLEOPT_S);
-               break;
-               case MSG_PUSHMSG_OPT :
-                       cmdSize += sizeof(MSG_PUSHMSG_OPT_S);
-               break;
-               case MSG_CBMSG_OPT :
-                       cmdSize += sizeof(MSG_CBMSG_OPT_S);
-               break;
-               case MSG_VOICEMAIL_OPT :
-                       cmdSize += sizeof(MSG_VOICEMAIL_OPT_S);
-               break;
-               case MSG_MSGSIZE_OPT :
-                       cmdSize += sizeof(MSG_MSGSIZE_OPT_S);
-               break;
+       switch (optionType) {
+       case MSG_GENERAL_OPT:
+               cmdSize += sizeof(MSG_GENERAL_OPT_S);
+       break;
+       case MSG_SMS_SENDOPT:
+               cmdSize += sizeof(MSG_SMS_SENDOPT_S);
+       break;
+       case MSG_SMSC_LIST:
+               cmdSize += sizeof(MSG_SMSC_LIST_S);
+       break;
+       case MSG_MMS_SENDOPT:
+               cmdSize += sizeof(MSG_MMS_SENDOPT_S);
+       break;
+       case MSG_MMS_RECVOPT:
+               cmdSize += sizeof(MSG_MMS_RECVOPT_S);
+       break;
+       case MSG_MMS_STYLEOPT:
+               cmdSize += sizeof(MSG_MMS_STYLEOPT_S);
+       break;
+       case MSG_PUSHMSG_OPT:
+               cmdSize += sizeof(MSG_PUSHMSG_OPT_S);
+       break;
+       case MSG_CBMSG_OPT:
+               cmdSize += sizeof(MSG_CBMSG_OPT_S);
+       break;
+       case MSG_VOICEMAIL_OPT:
+               cmdSize += sizeof(MSG_VOICEMAIL_OPT_S);
+       break;
+       case MSG_MSGSIZE_OPT:
+               cmdSize += sizeof(MSG_MSGSIZE_OPT_S);
+       break;
        }
 
        return cmdSize;
@@ -602,17 +596,16 @@ bool MsgHandle::CheckEventData(char *pEventData)
 {
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
-       switch (pEvent->eventType)
-       {
-       case MSG_EVENT_PLG_SENT_STATUS_CNF :
-       case MSG_EVENT_PLG_INCOMING_MSG_IND :
-       case MSG_EVENT_PLG_INCOMING_MMS_CONF :
-       case MSG_EVENT_PLG_INCOMING_SYNCML_MSG_IND :
-       case MSG_EVENT_PLG_INCOMING_LBS_MSG_IND :
-       case MSG_EVENT_PLG_STORAGE_CHANGE_IND :
-       case MSG_EVENT_PLG_INCOMING_CB_MSG_IND :
-       case MSG_EVENT_PLG_INCOMING_PUSH_MSG_IND :
-       case MSG_EVENT_PLG_REPORT_MSG_INCOMING_IND :
+       switch (pEvent->eventType) {
+       case MSG_EVENT_PLG_SENT_STATUS_CNF:
+       case MSG_EVENT_PLG_INCOMING_MSG_IND:
+       case MSG_EVENT_PLG_INCOMING_MMS_CONF:
+       case MSG_EVENT_PLG_INCOMING_SYNCML_MSG_IND:
+       case MSG_EVENT_PLG_INCOMING_LBS_MSG_IND:
+       case MSG_EVENT_PLG_STORAGE_CHANGE_IND:
+       case MSG_EVENT_PLG_INCOMING_CB_MSG_IND:
+       case MSG_EVENT_PLG_INCOMING_PUSH_MSG_IND:
+       case MSG_EVENT_PLG_REPORT_MSG_INCOMING_IND:
                return false;
                break;
        default :
index 04917b6..d959a40 100755 (executable)
 ==================================================================================================*/
 msg_error_t MsgHandle::addFilter(const MSG_FILTER_S *pFilter)
 {
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_FILTER_S);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_ADD_FILTER;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data*/
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), pFilter, sizeof(MSG_FILTER_S));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
-       if (pEvent->eventType != MSG_EVENT_ADD_FILTER)
-       {
+       if (pEvent->eventType != MSG_EVENT_ADD_FILTER) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
@@ -62,33 +61,32 @@ msg_error_t MsgHandle::addFilter(const MSG_FILTER_S *pFilter)
 
 msg_error_t MsgHandle::updateFilter(const MSG_FILTER_S *pFilter)
 {
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_FILTER_S);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_UPDATE_FILTER;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), pFilter, sizeof(MSG_FILTER_S));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
-       if (pEvent->eventType != MSG_EVENT_UPDATE_FILTER)
-       {
+       if (pEvent->eventType != MSG_EVENT_UPDATE_FILTER) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
@@ -98,33 +96,32 @@ msg_error_t MsgHandle::updateFilter(const MSG_FILTER_S *pFilter)
 
 msg_error_t MsgHandle::deleteFilter(msg_filter_id_t FilterId)
 {
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S) + sizeof(msg_filter_id_t);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_DELETE_FILTER;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        memcpy(pCmd->cmdData, &FilterId, sizeof(msg_filter_id_t));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
-       if (pEvent->eventType != MSG_EVENT_DELETE_FILTER)
-       {
+       if (pEvent->eventType != MSG_EVENT_DELETE_FILTER) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
@@ -134,36 +131,35 @@ msg_error_t MsgHandle::deleteFilter(msg_filter_id_t FilterId)
 
 msg_error_t MsgHandle::getFilterList(msg_struct_list_s *pFilterList)
 {
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_GET_FILTERLIST;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
-       if (pEvent->eventType != MSG_EVENT_GET_FILTERLIST)
-       {
+       if (pEvent->eventType != MSG_EVENT_GET_FILTERLIST) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
-       if(pEvent->result != MSG_SUCCESS) return pEvent->result;
+       if (pEvent->result != MSG_SUCCESS) return pEvent->result;
 
-       // Decode Return Data
+       /* Decode Return Data */
        MsgDecodeFilterList(pEvent->data, pFilterList);
 
        return MSG_SUCCESS;
@@ -174,33 +170,32 @@ msg_error_t MsgHandle::setFilterOperation(bool bSetFlag)
 {
        msg_error_t ret = MSG_SUCCESS;
 
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S) + sizeof(bool);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_SET_FILTER_OPERATION;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        memcpy(pCmd->cmdData, &bSetFlag, sizeof(bool));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
-       if (pEvent->eventType != MSG_EVENT_SET_FILTER_OPERATION)
-       {
+       if (pEvent->eventType != MSG_EVENT_SET_FILTER_OPERATION) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
@@ -214,38 +209,36 @@ msg_error_t MsgHandle::getFilterOperation(bool *pSetFlag)
 {
        msg_error_t ret = MSG_SUCCESS;
 
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_GET_FILTER_OPERATION;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
-       if (pEvent->eventType != MSG_EVENT_GET_FILTER_OPERATION)
-       {
+       if (pEvent->eventType != MSG_EVENT_GET_FILTER_OPERATION) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
        ret = pEvent->result;
 
-       // Decode Return Data
-       if (ret == MSG_SUCCESS)
-       {
+       /* Decode Return Data */
+       if (ret == MSG_SUCCESS) {
                MsgDecodeFilterFlag(pEvent->data, pSetFlag);
                MSG_DEBUG("Flag : %d", *pSetFlag);
        }
@@ -253,36 +246,36 @@ msg_error_t MsgHandle::getFilterOperation(bool *pSetFlag)
        return ret;
 }
 
+
 msg_error_t MsgHandle::setFilterActivation(msg_filter_id_t filter_id, bool active)
 {
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S) + sizeof(msg_filter_id_t) + sizeof(bool);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_SET_FILTER_ACTIVATION;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        memcpy(pCmd->cmdData, &filter_id, sizeof(msg_filter_id_t));
        memcpy(pCmd->cmdData+sizeof(msg_filter_id_t), &active, sizeof(bool));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
-       if (pEvent->eventType != MSG_EVENT_SET_FILTER_ACTIVATION)
-       {
+       if (pEvent->eventType != MSG_EVENT_SET_FILTER_ACTIVATION) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
index c7e12b8..3984edd 100755 (executable)
 #include "MsgHandle.h"
 
 
-#define MSG_TYPE_CHECK(a, b) \
-               ({\
-                       if(a != b) return MSG_ERR_INVALID_PARAMETER; \
-               })\
-
 #define MSG_NULL_CHECK(a) \
-               ({\
-                       if(a == NULL) return MSG_ERR_NULL_POINTER; \
-               })\
+       do { \
+               if (a == NULL) { \
+                       return MSG_ERR_NULL_POINTER; \
+               } \
+       } while(0)
 
 /*==================================================================================================
                                      IMPLEMENTATION OF MsgHandle - Setting Member Functions
@@ -41,23 +38,23 @@ msg_error_t MsgHandle::getSMSCOption(msg_struct_t msg_struct)
        MSG_TYPE_CHECK(smsc_opt->type, MSG_STRUCT_SETTING_SMSC_OPT);
        MSG_NULL_CHECK(smsc_opt->data);
 
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_OPTION_TYPE_T) + sizeof(msg_sim_slot_id_t);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_GET_SMSC_OPT;
 
-       // Set option type
+       /* Set option type */
        MSG_OPTION_TYPE_T opt_type = MSG_SMSC_LIST;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &opt_type, sizeof(MSG_OPTION_TYPE_T));
 
        msg_sim_slot_id_t simIndex = ((MSG_SMSC_LIST_HIDDEN_S *)smsc_opt->data)->simIndex;
@@ -66,17 +63,16 @@ msg_error_t MsgHandle::getSMSCOption(msg_struct_t msg_struct)
        }
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(MSG_OPTION_TYPE_T)), &simIndex, sizeof(msg_sim_slot_id_t));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
-       if (pEvent->eventType != MSG_EVENT_GET_SMSC_OPT)
-       {
+       if (pEvent->eventType != MSG_EVENT_GET_SMSC_OPT) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
@@ -106,13 +102,14 @@ msg_error_t MsgHandle::getSMSCOption(msg_struct_t msg_struct)
        return pEvent->result;
 }
 
+
 msg_error_t MsgHandle::setSMSCOption(msg_struct_t msg_struct)
 {
        msg_struct_s *smsc_opt = (msg_struct_s *)msg_struct;
        MSG_TYPE_CHECK(smsc_opt->type, MSG_STRUCT_SETTING_SMSC_OPT);
        MSG_NULL_CHECK(smsc_opt->data);
 
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        MSG_OPTION_TYPE_T optionType = MSG_SMSC_LIST;
        int cmdSize = getSettingCmdSize(optionType);
 
@@ -146,76 +143,75 @@ msg_error_t MsgHandle::setSMSCOption(msg_struct_t msg_struct)
                memcpy(&(smsc_list_tmp.smscData[i]), pStructTmp->data, sizeof(MSG_SMSC_DATA_S));
        }
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_SET_SMSC_OPT;
 
-    // Copy Cookie
-    memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
+       /* Copy Cookie */
+       memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
        MSG_SETTING_S pSetting = {0,};
 
        pSetting.type = optionType;
        memcpy(&(pSetting.option.smscList), &smsc_list_tmp, sizeof(MSG_SMSC_LIST_S));
 
-    // Copy Command Data
-    memcpy(pCmd->cmdData, &pSetting, cmdSize-sizeof(MSG_CMD_S));
+       /* Copy Command Data */
+       memcpy(pCmd->cmdData, &pSetting, cmdSize-sizeof(MSG_CMD_S));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
-       if (pEvent->eventType != MSG_EVENT_SET_SMSC_OPT)
-       {
+       if (pEvent->eventType != MSG_EVENT_SET_SMSC_OPT) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
        return pEvent->result;
 }
 
+
 msg_error_t MsgHandle::getCBOption(msg_struct_t msg_struct)
 {
        msg_struct_s *cb_opt = (msg_struct_s *)msg_struct;
        MSG_TYPE_CHECK(cb_opt->type, MSG_STRUCT_SETTING_CB_OPT);
        MSG_NULL_CHECK(cb_opt->data);
 
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_OPTION_TYPE_T) + sizeof(msg_sim_slot_id_t);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_GET_CB_OPT;
 
-       // Set option type
+       /* Set option type */
        MSG_OPTION_TYPE_T opt_type = MSG_CBMSG_OPT;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &opt_type, sizeof(MSG_OPTION_TYPE_T));
 
        msg_sim_slot_id_t simIndex = ((MSG_CBMSG_OPT_HIDDEN_S*)cb_opt->data)->simIndex;
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(MSG_OPTION_TYPE_T)), &simIndex, sizeof(msg_sim_slot_id_t));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
-       if (pEvent->eventType != MSG_EVENT_GET_CB_OPT)
-       {
+       if (pEvent->eventType != MSG_EVENT_GET_CB_OPT) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
@@ -246,13 +242,14 @@ msg_error_t MsgHandle::getCBOption(msg_struct_t msg_struct)
        return pEvent->result;
 }
 
+
 msg_error_t MsgHandle::setCBOption(msg_struct_t msg_struct)
 {
        msg_struct_s *cb_opt = (msg_struct_s *)msg_struct;
        MSG_TYPE_CHECK(cb_opt->type, MSG_STRUCT_SETTING_CB_OPT);
        MSG_NULL_CHECK(cb_opt->data);
 
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        MSG_OPTION_TYPE_T optionType = MSG_CBMSG_OPT;
        int cmdSize = getSettingCmdSize(optionType);
 
@@ -261,13 +258,13 @@ msg_error_t MsgHandle::setCBOption(msg_struct_t msg_struct)
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
        int i = 0;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_SET_CB_OPT;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        MSG_CBMSG_OPT_S cb_opt_tmp = {0,};
        MSG_CBMSG_OPT_HIDDEN_S *cb_msg_opt = (MSG_CBMSG_OPT_HIDDEN_S *)cb_opt->data;
 
@@ -292,62 +289,61 @@ msg_error_t MsgHandle::setCBOption(msg_struct_t msg_struct)
 
        memcpy(&(pSetting.option.cbMsgOpt), &cb_opt_tmp, sizeof(MSG_CBMSG_OPT_S));
 
-    // Copy Command Data
-    memcpy(pCmd->cmdData, &pSetting, cmdSize-sizeof(MSG_CMD_S));
+       /* Copy Command Data */
+       memcpy(pCmd->cmdData, &pSetting, cmdSize-sizeof(MSG_CMD_S));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
-       if (pEvent->eventType != MSG_EVENT_SET_CB_OPT)
-       {
+       if (pEvent->eventType != MSG_EVENT_SET_CB_OPT) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
        return pEvent->result;
 }
 
+
 msg_error_t MsgHandle::getSmsSendOpt(msg_struct_t msg_struct)
 {
        msg_struct_s *sms_send_opt = (msg_struct_s *)msg_struct;
        MSG_TYPE_CHECK(sms_send_opt->type, MSG_STRUCT_SETTING_SMS_SEND_OPT);
        MSG_NULL_CHECK(sms_send_opt->data);
 
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_OPTION_TYPE_T);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_GET_SMS_SEND_OPT;
 
-       // Set option type
+       /* Set option type */
        MSG_OPTION_TYPE_T opt_type = MSG_SMS_SENDOPT;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &opt_type, sizeof(MSG_OPTION_TYPE_T));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
-       if (pEvent->eventType != MSG_EVENT_GET_SMS_SEND_OPT)
-       {
+       if (pEvent->eventType != MSG_EVENT_GET_SMS_SEND_OPT) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
@@ -358,13 +354,14 @@ msg_error_t MsgHandle::getSmsSendOpt(msg_struct_t msg_struct)
        return pEvent->result;
 }
 
+
 msg_error_t MsgHandle::setSmsSendOpt(msg_struct_t msg_struct)
 {
        msg_struct_s *sms_send_opt = (msg_struct_s *)msg_struct;
        MSG_TYPE_CHECK(sms_send_opt->type, MSG_STRUCT_SETTING_SMS_SEND_OPT);
        MSG_NULL_CHECK(sms_send_opt->data);
 
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        MSG_OPTION_TYPE_T optionType = MSG_SMS_SENDOPT;
        int cmdSize = getSettingCmdSize(optionType);
 
@@ -372,74 +369,73 @@ msg_error_t MsgHandle::setSmsSendOpt(msg_struct_t msg_struct)
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_SET_SMS_SEND_OPT;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        MSG_SETTING_S pSetting = {0,};
        pSetting.type = optionType;
 
        memcpy(&(pSetting.option.smsSendOpt), sms_send_opt->data, sizeof(MSG_SMS_SENDOPT_S));
 
-    // Copy Command Data
-    memcpy(pCmd->cmdData, &pSetting, cmdSize-sizeof(MSG_CMD_S));
+       /*py Command Data */
+       memcpy(pCmd->cmdData, &pSetting, cmdSize-sizeof(MSG_CMD_S));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
-       if (pEvent->eventType != MSG_EVENT_SET_SMS_SEND_OPT)
-       {
+       if (pEvent->eventType != MSG_EVENT_SET_SMS_SEND_OPT) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
        return pEvent->result;
 }
 
+
 msg_error_t MsgHandle::getMmsSendOpt(msg_struct_t msg_struct)
 {
        msg_struct_s *mms_send_opt = (msg_struct_s *)msg_struct;
        MSG_TYPE_CHECK(mms_send_opt->type, MSG_STRUCT_SETTING_MMS_SEND_OPT);
        MSG_NULL_CHECK(mms_send_opt->data);
 
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_OPTION_TYPE_T);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_GET_MMS_SEND_OPT;
 
-       // Set option type
+       /* Set option type */
        MSG_OPTION_TYPE_T opt_type = MSG_MMS_SENDOPT;
 
-       // Copy Cookie
+       /* Copy Cookie*/
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &opt_type, sizeof(MSG_OPTION_TYPE_T));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
-       if (pEvent->eventType != MSG_EVENT_GET_MMS_SEND_OPT)
-       {
+       if (pEvent->eventType != MSG_EVENT_GET_MMS_SEND_OPT) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
@@ -450,13 +446,14 @@ msg_error_t MsgHandle::getMmsSendOpt(msg_struct_t msg_struct)
        return pEvent->result;
 }
 
+
 msg_error_t MsgHandle::setMmsSendOpt(msg_struct_t msg_struct)
 {
        msg_struct_s *mms_send_opt = (msg_struct_s *)msg_struct;
        MSG_TYPE_CHECK(mms_send_opt->type, MSG_STRUCT_SETTING_MMS_SEND_OPT);
        MSG_NULL_CHECK(mms_send_opt->data);
 
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        MSG_OPTION_TYPE_T optionType = MSG_MMS_SENDOPT;
        int cmdSize = getSettingCmdSize(optionType);
 
@@ -464,74 +461,73 @@ msg_error_t MsgHandle::setMmsSendOpt(msg_struct_t msg_struct)
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_SET_MMS_SEND_OPT;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        MSG_SETTING_S pSetting = {0,};
        pSetting.type = optionType;
 
        memcpy(&(pSetting.option.mmsSendOpt), mms_send_opt->data, sizeof(MSG_MMS_SENDOPT_S));
 
-    // Copy Command Data
-    memcpy(pCmd->cmdData, &pSetting, cmdSize-sizeof(MSG_CMD_S));
+       /* Copy Command Data */
+       memcpy(pCmd->cmdData, &pSetting, cmdSize-sizeof(MSG_CMD_S));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
-       if (pEvent->eventType != MSG_EVENT_SET_MMS_SEND_OPT)
-       {
+       if (pEvent->eventType != MSG_EVENT_SET_MMS_SEND_OPT) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
        return pEvent->result;
 }
 
+
 msg_error_t MsgHandle::getMmsRecvOpt(msg_struct_t msg_struct)
 {
        msg_struct_s *mms_recv_opt = (msg_struct_s *)msg_struct;
        MSG_TYPE_CHECK(mms_recv_opt->type, MSG_STRUCT_SETTING_MMS_RECV_OPT);
        MSG_NULL_CHECK(mms_recv_opt->data);
 
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_OPTION_TYPE_T);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_GET_MMS_RECV_OPT;
 
-       // Set option type
+       /* Set option type */
        MSG_OPTION_TYPE_T opt_type = MSG_MMS_RECVOPT;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &opt_type, sizeof(MSG_OPTION_TYPE_T));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
-       if (pEvent->eventType != MSG_EVENT_GET_MMS_RECV_OPT)
-       {
+       if (pEvent->eventType != MSG_EVENT_GET_MMS_RECV_OPT) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
@@ -542,13 +538,14 @@ msg_error_t MsgHandle::getMmsRecvOpt(msg_struct_t msg_struct)
        return pEvent->result;
 }
 
+
 msg_error_t MsgHandle::setMmsRecvOpt(msg_struct_t msg_struct)
 {
        msg_struct_s *mms_recv_opt = (msg_struct_s *)msg_struct;
        MSG_TYPE_CHECK(mms_recv_opt->type, MSG_STRUCT_SETTING_MMS_RECV_OPT);
        MSG_NULL_CHECK(mms_recv_opt->data);
 
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        MSG_OPTION_TYPE_T optionType = MSG_MMS_RECVOPT;
        int cmdSize = getSettingCmdSize(optionType);
 
@@ -556,74 +553,73 @@ msg_error_t MsgHandle::setMmsRecvOpt(msg_struct_t msg_struct)
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_SET_MMS_RECV_OPT;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        MSG_SETTING_S pSetting = {0,};
        pSetting.type = optionType;
 
        memcpy(&(pSetting.option.mmsRecvOpt), mms_recv_opt->data, sizeof(MSG_MMS_RECVOPT_S));
 
-    // Copy Command Data
-    memcpy(pCmd->cmdData, &pSetting, cmdSize-sizeof(MSG_CMD_S));
+       /* Copy Command Data */
+       memcpy(pCmd->cmdData, &pSetting, cmdSize-sizeof(MSG_CMD_S));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
-       if (pEvent->eventType != MSG_EVENT_SET_MMS_RECV_OPT)
-       {
+       if (pEvent->eventType != MSG_EVENT_SET_MMS_RECV_OPT) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
        return pEvent->result;
 }
 
+
 msg_error_t MsgHandle::getPushMsgOpt(msg_struct_t msg_struct)
 {
        msg_struct_s *push_opt = (msg_struct_s *)msg_struct;
        MSG_TYPE_CHECK(push_opt->type, MSG_STRUCT_SETTING_PUSH_MSG_OPT);
        MSG_NULL_CHECK(push_opt->data);
 
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_OPTION_TYPE_T);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_GET_PUSH_MSG_OPT;
 
-       // Set option type
+       /* Set option type */
        MSG_OPTION_TYPE_T opt_type = MSG_PUSHMSG_OPT;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &opt_type, sizeof(MSG_OPTION_TYPE_T));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
-       if (pEvent->eventType != MSG_EVENT_GET_PUSH_MSG_OPT)
-       {
+       if (pEvent->eventType != MSG_EVENT_GET_PUSH_MSG_OPT) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
@@ -634,13 +630,14 @@ msg_error_t MsgHandle::getPushMsgOpt(msg_struct_t msg_struct)
        return pEvent->result;
 }
 
+
 msg_error_t MsgHandle::setPushMsgOpt(msg_struct_t msg_struct)
 {
        msg_struct_s *push_opt = (msg_struct_s *)msg_struct;
        MSG_TYPE_CHECK(push_opt->type, MSG_STRUCT_SETTING_PUSH_MSG_OPT);
        MSG_NULL_CHECK(push_opt->data);
 
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        MSG_OPTION_TYPE_T optionType = MSG_PUSHMSG_OPT;
        int cmdSize = getSettingCmdSize(optionType);
 
@@ -648,61 +645,61 @@ msg_error_t MsgHandle::setPushMsgOpt(msg_struct_t msg_struct)
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_SET_PUSH_MSG_OPT;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        MSG_SETTING_S pSetting = {0,};
        pSetting.type = optionType;
 
        memcpy(&(pSetting.option.pushMsgOpt), push_opt->data, sizeof(MSG_PUSHMSG_OPT_S));
 
-    // Copy Command Data
-    memcpy(pCmd->cmdData, &pSetting, cmdSize-sizeof(MSG_CMD_S));
+       /* Copy Command Data */
+       memcpy(pCmd->cmdData, &pSetting, cmdSize-sizeof(MSG_CMD_S));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
-       if (pEvent->eventType != MSG_EVENT_SET_PUSH_MSG_OPT)
-       {
+       if (pEvent->eventType != MSG_EVENT_SET_PUSH_MSG_OPT) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
        return pEvent->result;
 }
 
+
 msg_error_t MsgHandle::getVoiceMsgOpt(msg_struct_t msg_struct)
 {
        msg_struct_s *voice_opt = (msg_struct_s *)msg_struct;
        MSG_TYPE_CHECK(voice_opt->type, MSG_STRUCT_SETTING_VOICE_MSG_OPT);
        MSG_NULL_CHECK(voice_opt->data);
 
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_OPTION_TYPE_T) + sizeof(msg_sim_slot_id_t);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_GET_VOICE_MSG_OPT;
 
-       // Set option type
+       /* Set option type */
        MSG_OPTION_TYPE_T opt_type = MSG_VOICEMAIL_OPT;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &opt_type, sizeof(MSG_OPTION_TYPE_T));
 
        msg_sim_slot_id_t simIndex = ((MSG_VOICEMAIL_OPT_S *)voice_opt->data)->simIndex;
@@ -711,17 +708,16 @@ msg_error_t MsgHandle::getVoiceMsgOpt(msg_struct_t msg_struct)
        }
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(MSG_OPTION_TYPE_T)), &simIndex, sizeof(msg_sim_slot_id_t));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
-       if (pEvent->eventType != MSG_EVENT_GET_VOICE_MSG_OPT)
-       {
+       if (pEvent->eventType != MSG_EVENT_GET_VOICE_MSG_OPT) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
@@ -732,13 +728,14 @@ msg_error_t MsgHandle::getVoiceMsgOpt(msg_struct_t msg_struct)
        return pEvent->result;
 }
 
+
 msg_error_t MsgHandle::setVoiceMsgOpt(msg_struct_t msg_struct)
 {
        msg_struct_s *voice_opt = (msg_struct_s *)msg_struct;
        MSG_TYPE_CHECK(voice_opt->type, MSG_STRUCT_SETTING_VOICE_MSG_OPT);
        MSG_NULL_CHECK(voice_opt->data);
 
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        MSG_OPTION_TYPE_T optionType = MSG_VOICEMAIL_OPT;
        int cmdSize = getSettingCmdSize(optionType);
 
@@ -746,74 +743,73 @@ msg_error_t MsgHandle::setVoiceMsgOpt(msg_struct_t msg_struct)
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_SET_VOICE_MSG_OPT;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        MSG_SETTING_S pSetting = {0,};
        pSetting.type = optionType;
 
        memcpy(&(pSetting.option.voiceMailOpt), voice_opt->data, sizeof(MSG_VOICEMAIL_OPT_S));
 
-    // Copy Command Data
-    memcpy(pCmd->cmdData, &pSetting, cmdSize-sizeof(MSG_CMD_S));
+       /* Copy Command Data */
+       memcpy(pCmd->cmdData, &pSetting, cmdSize-sizeof(MSG_CMD_S));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
-       if (pEvent->eventType != MSG_EVENT_SET_VOICE_MSG_OPT)
-       {
+       if (pEvent->eventType != MSG_EVENT_SET_VOICE_MSG_OPT) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
        return pEvent->result;
 }
 
+
 msg_error_t MsgHandle::getGeneralOpt(msg_struct_t msg_struct)
 {
        msg_struct_s *general_opt = (msg_struct_s *)msg_struct;
        MSG_TYPE_CHECK(general_opt->type, MSG_STRUCT_SETTING_GENERAL_OPT);
        MSG_NULL_CHECK(general_opt->data);
 
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_OPTION_TYPE_T);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_GET_GENERAL_MSG_OPT;
 
-       // Set option type
+       /* Set option type */
        MSG_OPTION_TYPE_T opt_type = MSG_GENERAL_OPT;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &opt_type, sizeof(MSG_OPTION_TYPE_T));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
-       if (pEvent->eventType != MSG_EVENT_GET_GENERAL_MSG_OPT)
-       {
+       if (pEvent->eventType != MSG_EVENT_GET_GENERAL_MSG_OPT) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
@@ -824,13 +820,14 @@ msg_error_t MsgHandle::getGeneralOpt(msg_struct_t msg_struct)
        return pEvent->result;
 }
 
+
 msg_error_t MsgHandle::setGeneralOpt(msg_struct_t msg_struct)
 {
        msg_struct_s *general_opt = (msg_struct_s *)msg_struct;
        MSG_TYPE_CHECK(general_opt->type, MSG_STRUCT_SETTING_GENERAL_OPT);
        MSG_NULL_CHECK(general_opt->data);
 
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        MSG_OPTION_TYPE_T optionType = MSG_GENERAL_OPT;
        int cmdSize = getSettingCmdSize(optionType);
 
@@ -838,74 +835,73 @@ msg_error_t MsgHandle::setGeneralOpt(msg_struct_t msg_struct)
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_SET_GENERAL_MSG_OPT;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        MSG_SETTING_S pSetting = {0,};
        pSetting.type = optionType;
 
        memcpy(&(pSetting.option.generalOpt), general_opt->data, sizeof(MSG_GENERAL_OPT_S));
 
-    // Copy Command Data
-    memcpy(pCmd->cmdData, &pSetting, cmdSize-sizeof(MSG_CMD_S));
+       /* Copy Command Data */
+       memcpy(pCmd->cmdData, &pSetting, cmdSize-sizeof(MSG_CMD_S));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
-       if (pEvent->eventType != MSG_EVENT_SET_GENERAL_MSG_OPT)
-       {
+       if (pEvent->eventType != MSG_EVENT_SET_GENERAL_MSG_OPT) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
        return pEvent->result;
 }
 
+
 msg_error_t MsgHandle::getMsgSizeOpt(msg_struct_t msg_struct)
 {
        msg_struct_s *msg_size_opt = (msg_struct_s *)msg_struct;
        MSG_TYPE_CHECK(msg_size_opt->type, MSG_STRUCT_SETTING_MSGSIZE_OPT);
        MSG_NULL_CHECK(msg_size_opt->data);
 
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_OPTION_TYPE_T);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_GET_MSG_SIZE_OPT;
 
-       // Set option type
+       /* Set option type */
        MSG_OPTION_TYPE_T opt_type = MSG_MSGSIZE_OPT;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &opt_type, sizeof(MSG_OPTION_TYPE_T));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
-       if (pEvent->eventType != MSG_EVENT_GET_MSG_SIZE_OPT)
-       {
+       if (pEvent->eventType != MSG_EVENT_GET_MSG_SIZE_OPT) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
@@ -916,13 +912,14 @@ msg_error_t MsgHandle::getMsgSizeOpt(msg_struct_t msg_struct)
        return pEvent->result;
 }
 
+
 msg_error_t MsgHandle::setMsgSizeOpt(msg_struct_t msg_struct)
 {
        msg_struct_s *msg_size_opt = (msg_struct_s *)msg_struct;
        MSG_TYPE_CHECK(msg_size_opt->type, MSG_STRUCT_SETTING_MSGSIZE_OPT);
        MSG_NULL_CHECK(msg_size_opt->data);
 
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        MSG_OPTION_TYPE_T optionType = MSG_MSGSIZE_OPT;
        int cmdSize = getSettingCmdSize(optionType);
 
@@ -930,32 +927,31 @@ msg_error_t MsgHandle::setMsgSizeOpt(msg_struct_t msg_struct)
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_SET_MSG_SIZE_OPT;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        MSG_SETTING_S pSetting = {0,};
        pSetting.type = optionType;
 
        memcpy(&(pSetting.option.msgSizeOpt), msg_size_opt->data, sizeof(MSG_MSGSIZE_OPT_S));
 
-    // Copy Command Data
-    memcpy(pCmd->cmdData, &pSetting, cmdSize-sizeof(MSG_CMD_S));
+       /* Copy Command Data */
+       memcpy(pCmd->cmdData, &pSetting, cmdSize-sizeof(MSG_CMD_S));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
-       if (pEvent->eventType != MSG_EVENT_SET_MSG_SIZE_OPT)
-       {
+       if (pEvent->eventType != MSG_EVENT_SET_MSG_SIZE_OPT) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
index a72badd..8b62958 100755 (executable)
@@ -34,10 +34,10 @@ int MsgHandle::addMessage(MSG_MESSAGE_HIDDEN_S *pMsg, const MSG_SENDINGOPT_S *pS
        msgInfo.addressList = NULL;
        unique_ptr<MSG_ADDRESS_INFO_S*, void(*)(MSG_ADDRESS_INFO_S**)> addressListBuf(&msgInfo.addressList, unique_ptr_deleter);
 
-       // Covert MSG_MESSAGE_S to MSG_MESSAGE_INFO_S
+       /* Covert MSG_MESSAGE_S to MSG_MESSAGE_INFO_S */
        convertMsgStruct(pMsg, &msgInfo);
 
-       // Covert MSG_SENDINGOPT_S to MSG_SENDINGOPT_INFO_S
+       /* Covert MSG_SENDINGOPT_S to MSG_SENDINGOPT_INFO_S */
        MSG_MESSAGE_TYPE_S msgType = {0,};
 
        msgType.mainType = pMsg->mainType;
@@ -46,7 +46,7 @@ int MsgHandle::addMessage(MSG_MESSAGE_HIDDEN_S *pMsg, const MSG_SENDINGOPT_S *pS
 
        convertSendOptStruct(pSendOpt, &sendOptInfo, msgType);
 
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        char* encodedData = NULL;
        unique_ptr<char*, void(*)(char**)> buf(&encodedData, unique_ptr_deleter);
        int dataSize = MsgEncodeMsgInfo(&msgInfo, &sendOptInfo, &encodedData);
@@ -57,29 +57,28 @@ int MsgHandle::addMessage(MSG_MESSAGE_HIDDEN_S *pMsg, const MSG_SENDINGOPT_S *pS
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_ADD_MSG;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), encodedData, dataSize);
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
        if (pEvent == NULL)
                THROW(MsgException::INVALID_RESULT, "Event is NULL");
 
-       if (pEvent->eventType != MSG_EVENT_ADD_MSG)
-       {
+       if (pEvent->eventType != MSG_EVENT_ADD_MSG) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
@@ -88,7 +87,7 @@ int MsgHandle::addMessage(MSG_MESSAGE_HIDDEN_S *pMsg, const MSG_SENDINGOPT_S *pS
 
        msg_message_id_t msgId = 0;
 
-       // Decode Return Data
+       /* Decode Return Data */
        MsgDecodeMsgId(pEvent->data, &msgId);
 
        return (int)msgId;
@@ -103,11 +102,11 @@ msg_error_t MsgHandle::addSyncMLMessage(const MSG_SYNCML_MESSAGE_S *pSyncMLMsg)
        msgInfo.addressList = NULL;
        unique_ptr<MSG_ADDRESS_INFO_S*, void(*)(MSG_ADDRESS_INFO_S**)> addressListBuf(&msgInfo.addressList, unique_ptr_deleter);
 
-       // Covert MSG_MESSAGE_S to MSG_MESSAGE_INFO_S
+       /* Covert MSG_MESSAGE_S to MSG_MESSAGE_INFO_S */
        msg_struct_s *msg = (msg_struct_s *)pSyncMLMsg->msg;
        convertMsgStruct((MSG_MESSAGE_HIDDEN_S *)msg->data, &msgInfo);
 
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        char* encodedData = NULL;
        unique_ptr<char*, void(*)(char**)> buf(&encodedData, unique_ptr_deleter);
        int dataSize = MsgEncodeMsgInfo(&msgInfo, &encodedData);
@@ -118,38 +117,37 @@ msg_error_t MsgHandle::addSyncMLMessage(const MSG_SYNCML_MESSAGE_S *pSyncMLMsg)
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_ADD_SYNCML_MSG;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &pSyncMLMsg->extId, sizeof(int));
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(int)), &pSyncMLMsg->pinCode, sizeof(int));
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(int)+sizeof(int)), encodedData, dataSize);
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
        if (pEvent == NULL)
                THROW(MsgException::INVALID_RESULT, "Event is NULL");
 
-       if (pEvent->eventType != MSG_EVENT_ADD_SYNCML_MSG)
-       {
+       if (pEvent->eventType != MSG_EVENT_ADD_SYNCML_MSG) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
        msg_message_id_t msgId = 0;
 
-       // Decode Return Data
+       /* Decode Return Data */
        MsgDecodeMsgId(pEvent->data, &msgId);
 
        ((MSG_MESSAGE_HIDDEN_S *)msg->data)->msgId = msgId;
@@ -166,7 +164,7 @@ msg_error_t MsgHandle::updateMessage(const MSG_MESSAGE_HIDDEN_S *pMsg, const MSG
        msgInfo.addressList = NULL;
        unique_ptr<MSG_ADDRESS_INFO_S*, void(*)(MSG_ADDRESS_INFO_S**)> addressListBuf(&msgInfo.addressList, unique_ptr_deleter);
 
-       // Covert MSG_MESSAGE_S to MSG_MESSAGE_INFO_S
+       /* Covert MSG_MESSAGE_S to MSG_MESSAGE_INFO_S */
        convertMsgStruct(pMsg, &msgInfo);
 
        if (pSendOpt != NULL) {
@@ -179,7 +177,7 @@ msg_error_t MsgHandle::updateMessage(const MSG_MESSAGE_HIDDEN_S *pMsg, const MSG
                convertSendOptStruct(pSendOpt, &sendOptInfo, msgType);
        }
 
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        char* encodedData = NULL;
        unique_ptr<char*, void(*)(char**)> buf(&encodedData, unique_ptr_deleter);
        int dataSize = MsgEncodeMsgInfo(&msgInfo, &sendOptInfo, &encodedData);
@@ -190,29 +188,28 @@ msg_error_t MsgHandle::updateMessage(const MSG_MESSAGE_HIDDEN_S *pMsg, const MSG
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_UPDATE_MSG;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), encodedData, dataSize);
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
        if (pEvent == NULL)
                THROW(MsgException::INVALID_RESULT, "Event is NULL");
 
-       if (pEvent->eventType != MSG_EVENT_UPDATE_MSG)
-       {
+       if (pEvent->eventType != MSG_EVENT_UPDATE_MSG) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
@@ -222,37 +219,36 @@ msg_error_t MsgHandle::updateMessage(const MSG_MESSAGE_HIDDEN_S *pMsg, const MSG
 
 msg_error_t MsgHandle::updateReadStatus(msg_message_id_t MsgId, bool bRead)
 {
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S) + sizeof(msg_message_id_t) + sizeof(bool);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_UPDATE_READ;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &MsgId, sizeof(msg_message_id_t));
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(msg_message_id_t)), &bRead, sizeof(bool));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
        if (pEvent == NULL)
                THROW(MsgException::INVALID_RESULT, "Event is NULL");
 
-       if (pEvent->eventType != MSG_EVENT_UPDATE_READ)
-       {
+       if (pEvent->eventType != MSG_EVENT_UPDATE_READ) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
@@ -262,36 +258,35 @@ msg_error_t MsgHandle::updateReadStatus(msg_message_id_t MsgId, bool bRead)
 
 msg_error_t MsgHandle::setConversationToRead(msg_thread_id_t ThreadId)
 {
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S) + sizeof(msg_thread_id_t);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_UPDATE_THREAD_READ;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &ThreadId, sizeof(msg_thread_id_t));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
        if (pEvent == NULL)
                THROW(MsgException::INVALID_RESULT, "Event is NULL");
 
-       if (pEvent->eventType != MSG_EVENT_UPDATE_THREAD_READ)
-       {
+       if (pEvent->eventType != MSG_EVENT_UPDATE_THREAD_READ) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
@@ -301,37 +296,36 @@ msg_error_t MsgHandle::setConversationToRead(msg_thread_id_t ThreadId)
 
 msg_error_t MsgHandle::updateProtectedStatus(msg_message_id_t MsgId, bool bProtected)
 {
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S) + sizeof(msg_message_id_t) + sizeof(bool);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_UPDATE_PROTECTED;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &MsgId, sizeof(msg_message_id_t));
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(msg_message_id_t)), &bProtected, sizeof(bool));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
        if (pEvent == NULL)
                THROW(MsgException::INVALID_RESULT, "Event is NULL");
 
-       if (pEvent->eventType != MSG_EVENT_UPDATE_PROTECTED)
-       {
+       if (pEvent->eventType != MSG_EVENT_UPDATE_PROTECTED) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
@@ -341,36 +335,35 @@ msg_error_t MsgHandle::updateProtectedStatus(msg_message_id_t MsgId, bool bProte
 
 msg_error_t MsgHandle::deleteMessage(msg_message_id_t MsgId)
 {
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S) + sizeof(msg_message_id_t);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_DELETE_MSG;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy((void*)pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &MsgId, sizeof(msg_message_id_t));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
        if (pEvent == NULL)
                THROW(MsgException::INVALID_RESULT, "Event is NULL");
 
-       if (pEvent->eventType != MSG_EVENT_DELETE_MSG)
-       {
+       if (pEvent->eventType != MSG_EVENT_DELETE_MSG) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
@@ -380,37 +373,36 @@ msg_error_t MsgHandle::deleteMessage(msg_message_id_t MsgId)
 
 msg_error_t MsgHandle::deleteAllMessagesInFolder(msg_folder_id_t FolderId, bool bOnlyDB)
 {
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S) + sizeof(msg_folder_id_t);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_DELALL_MSGINFOLDER;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &FolderId, sizeof(msg_folder_id_t));
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(msg_folder_id_t)), &bOnlyDB, sizeof(bool));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
        if (pEvent == NULL)
                THROW(MsgException::INVALID_RESULT, "Event is NULL");
 
-       if (pEvent->eventType != MSG_EVENT_DELALL_MSGINFOLDER)
-       {
+       if (pEvent->eventType != MSG_EVENT_DELALL_MSGINFOLDER) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
@@ -420,32 +412,32 @@ msg_error_t MsgHandle::deleteAllMessagesInFolder(msg_folder_id_t FolderId, bool
 
 msg_error_t MsgHandle::deleteMessagesByList(msg_id_list_s *pMsgIdList)
 {
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S) + sizeof(int) + (sizeof(int)*pMsgIdList->nCount);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_DELETE_MESSAGE_BY_LIST;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &(pMsgIdList->nCount), sizeof(int));
        for (int i=0; i<pMsgIdList->nCount; i++) {
                memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(int)+(sizeof(int)*i)), &(pMsgIdList->msgIdList[i]), sizeof(int));
        }
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
        if (pEvent == NULL)
@@ -461,37 +453,36 @@ msg_error_t MsgHandle::deleteMessagesByList(msg_id_list_s *pMsgIdList)
 
 msg_error_t MsgHandle::moveMessageToFolder(msg_message_id_t MsgId, msg_folder_id_t DestFolderId)
 {
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S) + sizeof(msg_message_id_t) + sizeof(msg_folder_id_t);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_MOVE_MSGTOFOLDER;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &MsgId, sizeof(msg_message_id_t));
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+sizeof(msg_message_id_t)+MAX_COOKIE_LEN), &DestFolderId, sizeof(msg_folder_id_t));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
        if (pEvent == NULL)
                THROW(MsgException::INVALID_RESULT, "Event is NULL");
 
-       if (pEvent->eventType != MSG_EVENT_MOVE_MSGTOFOLDER)
-       {
+       if (pEvent->eventType != MSG_EVENT_MOVE_MSGTOFOLDER) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
@@ -501,37 +492,36 @@ msg_error_t MsgHandle::moveMessageToFolder(msg_message_id_t MsgId, msg_folder_id
 
 msg_error_t MsgHandle::moveMessageToStorage(msg_message_id_t MsgId, msg_storage_id_t DestStorageId)
 {
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S) + sizeof(msg_message_id_t) + sizeof(msg_storage_id_t);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_MOVE_MSGTOSTORAGE;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &MsgId, sizeof(msg_message_id_t));
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(msg_message_id_t)), &DestStorageId, sizeof(msg_storage_id_t));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
        if (pEvent == NULL)
                THROW(MsgException::INVALID_RESULT, "Event is NULL");
 
-       if (pEvent->eventType != MSG_EVENT_MOVE_MSGTOSTORAGE)
-       {
+       if (pEvent->eventType != MSG_EVENT_MOVE_MSGTOSTORAGE) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
@@ -541,43 +531,42 @@ msg_error_t MsgHandle::moveMessageToStorage(msg_message_id_t MsgId, msg_storage_
 
 msg_error_t MsgHandle::countMessage(msg_folder_id_t FolderId, MSG_COUNT_INFO_S *pCountInfo)
 {
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S) + sizeof(msg_folder_id_t);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_COUNT_MSG;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &FolderId, sizeof(msg_folder_id_t));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
        if (pEvent == NULL)
                THROW(MsgException::INVALID_RESULT, "Event is NULL");
 
-       if (pEvent->eventType != MSG_EVENT_COUNT_MSG)
-       {
+       if (pEvent->eventType != MSG_EVENT_COUNT_MSG) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
        if (pEvent->result != MSG_SUCCESS)
                return pEvent->result;
 
-       // Decode Return Data
+       /* Decode Return Data */
        MsgDecodeCountInfo(pEvent->data, pCountInfo);
 
        return MSG_SUCCESS;
@@ -586,43 +575,42 @@ msg_error_t MsgHandle::countMessage(msg_folder_id_t FolderId, MSG_COUNT_INFO_S *
 
 msg_error_t MsgHandle::countMsgByType(const MSG_MESSAGE_TYPE_S *pMsgType, int *pMsgCount)
 {
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_MESSAGE_TYPE_S);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_COUNT_BY_MSGTYPE;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), pMsgType, sizeof(MSG_MESSAGE_TYPE_S));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
        if (pEvent == NULL)
                THROW(MsgException::INVALID_RESULT, "Event is NULL");
 
-       if (pEvent->eventType != MSG_EVENT_COUNT_BY_MSGTYPE)
-       {
+       if (pEvent->eventType != MSG_EVENT_COUNT_BY_MSGTYPE) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
        if (pEvent->result != MSG_SUCCESS)
                return pEvent->result;
 
-       // Decode Return Data
+       /* Decode Return Data */
        memcpy(pMsgCount, (void*)((char*)pEvent+sizeof(MSG_EVENT_TYPE_T)+sizeof(msg_error_t)), sizeof(int));
 
        return MSG_SUCCESS;
@@ -631,45 +619,44 @@ msg_error_t MsgHandle::countMsgByType(const MSG_MESSAGE_TYPE_S *pMsgType, int *p
 
 msg_error_t MsgHandle::countMsgByContact(const MSG_THREAD_LIST_INDEX_INFO_S *pAddrInfo, MSG_THREAD_COUNT_INFO_S *pMsgThreadCountList)
 {
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S) +  sizeof(MSG_THREAD_LIST_INDEX_S);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_GET_CONTACT_COUNT;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), pAddrInfo, sizeof(msg_contact_id_t));
        msg_struct_s *pAddr = (msg_struct_s *)pAddrInfo->msgAddrInfo;
 
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN + sizeof(msg_contact_id_t)), pAddr->data, sizeof(MSG_ADDRESS_INFO_S));
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
        if (pEvent == NULL)
                THROW(MsgException::INVALID_RESULT, "Event is NULL");
 
-       if (pEvent->eventType != MSG_EVENT_GET_CONTACT_COUNT)
-       {
+       if (pEvent->eventType != MSG_EVENT_GET_CONTACT_COUNT) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
        if (pEvent->result != MSG_SUCCESS)
                return pEvent->result;
 
-       // Decode Return Data
+       /* Decode Return Data */
        MsgDecodeContactCount(pEvent->data, pMsgThreadCountList);
 
        return MSG_SUCCESS;
@@ -678,30 +665,30 @@ msg_error_t MsgHandle::countMsgByContact(const MSG_THREAD_LIST_INDEX_INFO_S *pAd
 
 msg_error_t MsgHandle::getMessage(msg_message_id_t MsgId, MSG_MESSAGE_HIDDEN_S *pMsg, MSG_SENDINGOPT_S *pSendOpt)
 {
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S) + sizeof(msg_message_id_t);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_GET_MSG;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &MsgId, sizeof(msg_message_id_t));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
        if (pEvent == NULL)
@@ -714,7 +701,7 @@ msg_error_t MsgHandle::getMessage(msg_message_id_t MsgId, MSG_MESSAGE_HIDDEN_S *
        if (pEvent->result != MSG_SUCCESS)
                return pEvent->result;
 
-       // Decode Return Data
+       /* Decode Return Data */
        MSG_MESSAGE_INFO_S msgInfo;
        MSG_SENDINGOPT_INFO_S sendOptInfo;
 
@@ -723,7 +710,7 @@ msg_error_t MsgHandle::getMessage(msg_message_id_t MsgId, MSG_MESSAGE_HIDDEN_S *
 
        MsgDecodeMsgInfo(pEvent->data, &msgInfo, &sendOptInfo);
 
-       // Covert MSG_MESSAGE_INFO_S to MSG_MESSAGE_HIDDEN_S
+       /* Covert MSG_MESSAGE_INFO_S to MSG_MESSAGE_HIDDEN_S */
        convertMsgStruct(&msgInfo, pMsg);
 
        if (pSendOpt != NULL) {
@@ -736,75 +723,47 @@ msg_error_t MsgHandle::getMessage(msg_message_id_t MsgId, MSG_MESSAGE_HIDDEN_S *
                convertSendOptStruct(&sendOptInfo, pSendOpt, msgType);
        }
 
-       // Delete Temp File
-       if (msgInfo.bTextSms == false)
-       {
-               // Delete Temp File
-               MsgDeleteFile(msgInfo.msgData); //ipc
+       /* Delete Temp File */
+       if (msgInfo.bTextSms == false) {
+               /* Delete Temp File */
+               MsgDeleteFile(msgInfo.msgData); /* ipc */
        }
 
        return MSG_SUCCESS;
 }
 
 
-msg_error_t MsgHandle::getFolderViewList(msg_folder_id_t FolderId, const MSG_SORT_RULE_S *pSortRule, msg_struct_list_s *pMsgFolderViewList)
-{
-       msg_error_t err = MSG_SUCCESS;
-
-//     err = MsgStoConnectDB();
-//
-//     if (err != MSG_SUCCESS)
-//     {
-//             MSG_DEBUG("MsgStoConnectDB() Error!!");
-//             return err;
-//     }
-
-       err = MsgStoGetFolderViewList(FolderId, (MSG_SORT_RULE_S *)pSortRule, pMsgFolderViewList);
-
-       if (err != MSG_SUCCESS)
-       {
-               MSG_DEBUG("MsgStoGetFolderViewList() Error!!");
-               return err;
-       }
-
-//     MsgStoDisconnectDB();
-
-       return err;
-}
-
-
 msg_error_t MsgHandle::addFolder(const MSG_FOLDER_INFO_S *pFolderInfo)
 {
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_FOLDER_INFO_S);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_ADD_FOLDER;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), pFolderInfo, sizeof(MSG_FOLDER_INFO_S));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
        if (pEvent == NULL)
                THROW(MsgException::INVALID_RESULT, "Event is NULL");
 
-       if (pEvent->eventType != MSG_EVENT_ADD_FOLDER)
-       {
+       if (pEvent->eventType != MSG_EVENT_ADD_FOLDER) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
@@ -814,36 +773,35 @@ msg_error_t MsgHandle::addFolder(const MSG_FOLDER_INFO_S *pFolderInfo)
 
 msg_error_t MsgHandle::updateFolder(const MSG_FOLDER_INFO_S *pFolderInfo)
 {
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_FOLDER_INFO_S);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_UPDATE_FOLDER;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), pFolderInfo, sizeof(MSG_FOLDER_INFO_S));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
        if (pEvent == NULL)
                THROW(MsgException::INVALID_RESULT, "Event is NULL");
 
-       if (pEvent->eventType != MSG_EVENT_UPDATE_FOLDER)
-       {
+       if (pEvent->eventType != MSG_EVENT_UPDATE_FOLDER) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
@@ -853,36 +811,35 @@ msg_error_t MsgHandle::updateFolder(const MSG_FOLDER_INFO_S *pFolderInfo)
 
 msg_error_t MsgHandle::deleteFolder(msg_folder_id_t FolderId)
 {
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S) + sizeof(msg_folder_id_t);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_DELETE_FOLDER;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &FolderId, sizeof(msg_folder_id_t));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
        if (pEvent == NULL)
                THROW(MsgException::INVALID_RESULT, "Event is NULL");
 
-       if (pEvent->eventType != MSG_EVENT_DELETE_FOLDER)
-       {
+       if (pEvent->eventType != MSG_EVENT_DELETE_FOLDER) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
@@ -892,40 +849,39 @@ msg_error_t MsgHandle::deleteFolder(msg_folder_id_t FolderId)
 
 msg_error_t MsgHandle::getFolderList(msg_struct_list_s *pFolderList)
 {
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_GET_FOLDERLIST;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
        if (pEvent == NULL)
                THROW(MsgException::INVALID_RESULT, "Event is NULL");
 
-       if (pEvent->eventType != MSG_EVENT_GET_FOLDERLIST)
-       {
+       if (pEvent->eventType != MSG_EVENT_GET_FOLDERLIST) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
        if (pEvent->result != MSG_SUCCESS)
                return pEvent->result;
 
-       // Decode Return Data
+       /* Decode Return Data */
        MsgDecodeFolderList(pEvent->data, pFolderList);
 
        return MSG_SUCCESS;
@@ -934,61 +890,59 @@ msg_error_t MsgHandle::getFolderList(msg_struct_list_s *pFolderList)
 
 msg_error_t MsgHandle::getThreadViewList(const MSG_SORT_RULE_S *pSortRule, msg_struct_list_s *pThreadViewList)
 {
-       msg_error_t err =  MSG_SUCCESS;
+       msg_error_t err = MSG_SUCCESS;
+       /*
+       err = MsgStoConnectDB();
 
-//     err = MsgStoConnectDB();
-//
-//     if (err != MSG_SUCCESS)
-//     {
-//             MSG_DEBUG("MsgStoConnectDB() Error!!");
-//             return err;
-//     }
+       if (err != MSG_SUCCESS) {
+               MSG_DEBUG("MsgStoConnectDB() Error!!");
+               return err;
+       }
+       */
 
        err = MsgStoGetThreadViewList(pSortRule, pThreadViewList);
 
-       if (err != MSG_SUCCESS)
-       {
+       if (err != MSG_SUCCESS) {
                MSG_DEBUG("MsgStoGetThreadViewList() Error!!");
                return err;
        }
 
-//     MsgStoDisconnectDB();
+       /* MsgStoDisconnectDB(); */
 
 #if 0
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_SORT_RULE_S);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_GET_THREADVIEWLIST;
 
-       // Copy Command Data
+       /* Copy Command Data */
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)), pSortRule, sizeof(MSG_SORT_RULE_S));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
        if (pEvent == NULL)
                THROW(MsgException::INVALID_RESULT, "Event is NULL");
 
-       if (pEvent->eventType != MSG_EVENT_GET_THREADVIEWLIST)
-       {
+       if (pEvent->eventType != MSG_EVENT_GET_THREADVIEWLIST) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
        if (pEvent->result != MSG_SUCCESS)
                return pEvent->result;
 
-       // Decode Return Data
+       /* Decode Return Data */
        MsgDecodeThreadViewList(pEvent->data, pMsgThreadViewList);
 #endif
 
@@ -999,11 +953,11 @@ msg_error_t MsgHandle::getConversationViewItem(msg_message_id_t MsgId, MSG_CONVE
 {
        MSG_BEGIN();
 
-       msg_error_t err =  MSG_SUCCESS;
+       msg_error_t err = MSG_SUCCESS;
 
-//     MsgStoConnectDB();
+       /* MsgStoConnectDB(); */
        err = MsgStoGetConversationViewItem(MsgId, pConv);
-//     MsgStoDisconnectDB();
+       /* MsgStoDisconnectDB(); */
 
        return err;
 }
@@ -1012,11 +966,11 @@ msg_error_t MsgHandle::getConversationViewList(msg_thread_id_t ThreadId, msg_str
 {
        MSG_BEGIN();
 
-       msg_error_t err =  MSG_SUCCESS;
+       msg_error_t err = MSG_SUCCESS;
 
-//     MsgStoConnectDB();
+       /* MsgStoConnectDB(); */
        err = MsgStoGetConversationViewList(ThreadId, pConvViewList);
-//     MsgStoDisconnectDB();
+       /* MsgStoDisconnectDB(); */
 
        if (err != MSG_SUCCESS)
                return err;
@@ -1029,37 +983,36 @@ msg_error_t MsgHandle::getConversationViewList(msg_thread_id_t ThreadId, msg_str
 
 msg_error_t MsgHandle::deleteThreadMessageList(msg_thread_id_t ThreadId, bool include_protected_msg)
 {
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S) + sizeof(msg_thread_id_t) + sizeof(bool);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_DELETE_THREADMESSAGELIST;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &ThreadId, sizeof(msg_thread_id_t));
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(msg_thread_id_t)), &include_protected_msg, sizeof(bool));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
        if (pEvent == NULL)
                THROW(MsgException::INVALID_RESULT, "Event is NULL");
 
-       if (pEvent->eventType != MSG_EVENT_DELETE_THREADMESSAGELIST)
-       {
+       if (pEvent->eventType != MSG_EVENT_DELETE_THREADMESSAGELIST) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
@@ -1072,43 +1025,42 @@ msg_error_t MsgHandle::deleteThreadMessageList(msg_thread_id_t ThreadId, bool in
 
 msg_error_t MsgHandle::getQuickPanelData(msg_quickpanel_type_t Type, MSG_MESSAGE_HIDDEN_S *pMsg)
 {
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S) + sizeof(msg_quickpanel_type_t);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_GET_QUICKPANEL_DATA;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &Type, sizeof(msg_quickpanel_type_t));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
        if (pEvent == NULL)
                THROW(MsgException::INVALID_RESULT, "Event is NULL");
 
-       if (pEvent->eventType != MSG_EVENT_GET_QUICKPANEL_DATA)
-       {
+       if (pEvent->eventType != MSG_EVENT_GET_QUICKPANEL_DATA) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
        if (pEvent->result != MSG_SUCCESS)
                return pEvent->result;
 
-       // Decode Return Data
+       /* Decode Return Data */
        MSG_MESSAGE_INFO_S msgInfo;
 
        memset(&msgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S));
@@ -1118,14 +1070,13 @@ msg_error_t MsgHandle::getQuickPanelData(msg_quickpanel_type_t Type, MSG_MESSAGE
 
        MsgDecodeMsgInfo((char *)pEvent->data, &msgInfo);
 
-       // Covert MSG_MESSAGE_INFO_S to MSG_MESSAGE_S
+       /* Covert MSG_MESSAGE_INFO_S to MSG_MESSAGE_S */
        convertMsgStruct(&msgInfo, pMsg);
 
-       // Delete Temp File
-       if (msgInfo.bTextSms == false)
-       {
-               // Delete Temp File
-               MsgDeleteFile(msgInfo.msgData); //ipc
+       /* Delete Temp File */
+       if (msgInfo.bTextSms == false) {
+               /* Delete Temp File */
+               MsgDeleteFile(msgInfo.msgData); /* ipc */
        }
 
        return MSG_SUCCESS;
@@ -1134,33 +1085,32 @@ msg_error_t MsgHandle::getQuickPanelData(msg_quickpanel_type_t Type, MSG_MESSAGE
 
 msg_error_t MsgHandle::resetDatabase()
 {
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_RESET_DB;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
        if (pEvent == NULL)
                THROW(MsgException::INVALID_RESULT, "Event is NULL");
 
-       if (pEvent->eventType != MSG_EVENT_RESET_DB)
-       {
+       if (pEvent->eventType != MSG_EVENT_RESET_DB) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
@@ -1170,57 +1120,53 @@ msg_error_t MsgHandle::resetDatabase()
 
 msg_error_t MsgHandle::getMemSize(unsigned int* memsize)
 {
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_GET_MEMSIZE;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
        if (pEvent == NULL)
                THROW(MsgException::INVALID_RESULT, "Event is NULL");
 
-       if (pEvent->eventType != MSG_EVENT_GET_MEMSIZE)
-       {
+       if (pEvent->eventType != MSG_EVENT_GET_MEMSIZE) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
        if (pEvent->result != MSG_SUCCESS)
                return pEvent->result;
 
-       // Decode Return Data
+       /* Decode Return Data */
        MsgDecodeMemSize(pEvent->data, memsize);
 
        return MSG_SUCCESS;
 }
 
+
 msg_error_t MsgHandle::backupMessage(msg_message_backup_type_t type, const char *backup_filepath)
 {
        if (backup_filepath == NULL)
                return MSG_ERR_NULL_POINTER;
 
-       //Create an empty file for writing.
-       //If a file with the same name already exists its content is erased
-       //and the file is treated as a new empty file.
-       if (MsgAccessFile(backup_filepath, F_OK)) {
-               if (remove(backup_filepath) != 0)
-                       MSG_SEC_DEBUG("Fail to delete file [%s]", backup_filepath);
-       }
+       /* Create an empty file for writing. */
+       /* If a file with the same name already exists its content is erased */
+       /* and the file is treated as a new empty file. */
 
        FILE *pFile = MsgOpenFile(backup_filepath, "w");
        if (pFile == NULL) {
@@ -1232,44 +1178,41 @@ msg_error_t MsgHandle::backupMessage(msg_message_backup_type_t type, const char
        char path[MSG_FILEPATH_LEN_MAX+1] = {0,};
        strncpy(path, backup_filepath, MSG_FILEPATH_LEN_MAX);
 
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S) + sizeof(msg_message_backup_type_t) + sizeof(path);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_BACKUP_MESSAGE;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &type, sizeof(msg_message_backup_type_t));
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(msg_message_backup_type_t)), (char *)path, sizeof(path));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
        if (pEvent == NULL)
                THROW(MsgException::INVALID_RESULT, "Event is NULL");
 
-       if (pEvent->eventType != MSG_EVENT_BACKUP_MESSAGE)
-       {
+       if (pEvent->eventType != MSG_EVENT_BACKUP_MESSAGE) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
-       if (pEvent->result != MSG_SUCCESS)
-               return pEvent->result;
-
-       return MSG_SUCCESS;
+       return pEvent->result;
 }
 
+
 msg_error_t MsgHandle::restoreMessage(const char *backup_filepath)
 {
        if (backup_filepath == NULL)
@@ -1283,65 +1226,91 @@ msg_error_t MsgHandle::restoreMessage(const char *backup_filepath)
        char path[MSG_FILEPATH_LEN_MAX+1] = {0,};
        strncpy(path, backup_filepath, MSG_FILEPATH_LEN_MAX);
 
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S) + sizeof(path);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_RESTORE_MESSAGE;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), (char *)path, sizeof(path));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
        if (pEvent == NULL)
                THROW(MsgException::INVALID_RESULT, "Event is NULL");
 
-       if (pEvent->eventType != MSG_EVENT_RESTORE_MESSAGE)
-       {
+       if (pEvent->eventType != MSG_EVENT_RESTORE_MESSAGE) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
-       if (pEvent->result != MSG_SUCCESS)
-               return pEvent->result;
-
-       return MSG_SUCCESS;
+       return pEvent->result;
 }
 
 
 msg_error_t MsgHandle::searchMessage(const char *pSearchString, msg_struct_list_s *pThreadViewList)
 {
-       msg_error_t err =  MSG_SUCCESS;
+       msg_error_t err = MSG_SUCCESS;
 
-//     err = MsgStoConnectDB();
-//
-//     if (err != MSG_SUCCESS)
-//     {
-//             MSG_DEBUG("MsgStoConnectDB() Error!!");
-//             return err;
-//     }
+       int count = 0;
 
-       err = MsgStoSearchMessage(pSearchString, pThreadViewList);
+       int search_len = strlen(pSearchString);
 
-       if (err != MSG_SUCCESS)
-       {
+       /* Allocate Memory to Command Data */
+       int cmdSize = sizeof(MSG_CMD_S) + sizeof(int) + sizeof(char) * search_len;
+
+       char cmdBuf[cmdSize];
+       bzero(cmdBuf, cmdSize);
+       MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
+
+       /* Set Command Parameters */
+       pCmd->cmdType = MSG_CMD_SET_TEMP_ADDRESS_TABLE;
+
+       /* Copy Cookie */
+       memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
+
+       /* Copy Command Data */
+       memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &search_len, sizeof(int));
+       memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(int)), pSearchString, sizeof(char) * search_len);
+
+       /* Send Command to Messaging FW */
+       char* pEventData = NULL;
+       unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
+
+       write((char*)pCmd, cmdSize, &pEventData);
+
+       /* Get Return Data */
+       MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
+
+       if (pEvent == NULL)
+               THROW(MsgException::INVALID_RESULT, "Event is NULL");
+
+       if (pEvent->eventType != MSG_EVENT_SET_TEMP_ADDRESS_TABLE) {
+               THROW(MsgException::INVALID_RESULT, "Event Data Error");
+       }
+
+       memcpy(&count, pEvent->data, sizeof(int));
+
+       err = MsgStoSearchMessage(pSearchString, pThreadViewList, count);
+
+       if (err != MSG_SUCCESS) {
                MSG_DEBUG("MsgStoSearchMessage() Error!!");
                return err;
        }
 
-//     MsgStoDisconnectDB();
+/*     MsgStoDisconnectDB(); */
 
        return err;
 }
@@ -1349,25 +1318,23 @@ msg_error_t MsgHandle::searchMessage(const char *pSearchString, msg_struct_list_
 
 msg_error_t MsgHandle::getRejectMsgList(const char *pNumber, msg_struct_list_s *pRejectMsgList)
 {
-       msg_error_t err =  MSG_SUCCESS;
-
-//     err = MsgStoConnectDB();
-//
-//     if (err != MSG_SUCCESS)
-//     {
-//             MSG_DEBUG("MsgStoConnectDB() Error!!");
-//             return err;
-//     }
+       msg_error_t err = MSG_SUCCESS;
+       /*
+       err = MsgStoConnectDB();
 
+       if (err != MSG_SUCCESS) {
+               MSG_DEBUG("MsgStoConnectDB() Error!!");
+               return err;
+       }
+       */
        err = MsgStoGetRejectMsgList(pNumber, pRejectMsgList);
 
-       if (err != MSG_SUCCESS)
-       {
+       if (err != MSG_SUCCESS) {
                MSG_DEBUG("MsgStoGetRejectMsgList() Error!!");
                return err;
        }
 
-//     MsgStoDisconnectDB();
+       /* MsgStoDisconnectDB(); */
 
        return err;
 }
@@ -1382,24 +1349,24 @@ msg_error_t MsgHandle::regStorageChangeCallback(msg_storage_change_cb onStorageC
 
        eventListener->start(this);
 
-       int remoteFd = eventListener->getRemoteFd(); // fd that is reserved to the "listener thread" by msgfw daemon
+       int remoteFd = eventListener->getRemoteFd(); /* fd that is reserved to the "listener thread" by msgfw daemon */
 
        if (remoteFd == -1 )
                return MSG_ERR_INVALID_MSGHANDLE;
 
-       if (eventListener->regStorageChangeEventCB(this, onStorageChange, pUserParam) == false)
+       if (eventListener->regStorageChangeEventCB(this, remoteFd, onStorageChange, pUserParam) == false)
                return MSG_ERR_INVALID_PARAMETER;
 
-       // Allocate Memory to Command Data
-       int cmdSize = sizeof(MSG_CMD_S) + sizeof(int); // cmd type, listenerFd
+       /* Allocate Memory to Command Data */
+       int cmdSize = sizeof(MSG_CMD_S) + sizeof(int); /* cmd type, listenerFd */
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*) cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_REG_STORAGE_CHANGE_CB;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
        MSG_DEBUG("remote fd %d", remoteFd);
@@ -1408,29 +1375,29 @@ msg_error_t MsgHandle::regStorageChangeCallback(msg_storage_change_cb onStorageC
 
        MSG_DEBUG("reg status [%d : %s], %d", pCmd->cmdType, MsgDbgCmdStr(pCmd->cmdType), remoteFd);
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
        if (pEvent == NULL)
                THROW(MsgException::INVALID_RESULT, "Event is NULL");
 
-       if (pEvent->eventType != MSG_EVENT_REG_STORAGE_CHANGE_CB)
-       {
+       if (pEvent->eventType != MSG_EVENT_REG_STORAGE_CHANGE_CB) {
                THROW(MsgException::INVALID_PARAM, "Event Data Error");
        }
 
        return pEvent->result;
 }
 
+
 msg_error_t MsgHandle::getReportStatus(msg_message_id_t msg_id, msg_struct_list_s *report_list)
 {
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S) + sizeof(msg_message_id_t);
 
        char cmdBuf[cmdSize];
@@ -1440,36 +1407,35 @@ msg_error_t MsgHandle::getReportStatus(msg_message_id_t msg_id, msg_struct_list_
        report_list->nCount = 0;
        report_list->msg_struct_info = NULL;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_GET_REPORT_STATUS;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &msg_id, sizeof(msg_message_id_t));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
        if (pEvent == NULL)
                THROW(MsgException::INVALID_RESULT, "Event is NULL");
 
-       if (pEvent->eventType != MSG_EVENT_GET_REPORT_STATUS)
-       {
+       if (pEvent->eventType != MSG_EVENT_GET_REPORT_STATUS) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
        if (pEvent->result != MSG_SUCCESS)
                return pEvent->result;
 
-       // Decode Return Data
+       /* Decode Return Data */
        MsgDecodeReportStatus(pEvent->data, report_list);
 
        return MSG_SUCCESS;
@@ -1478,25 +1444,23 @@ msg_error_t MsgHandle::getReportStatus(msg_message_id_t msg_id, msg_struct_list_
 
 msg_error_t MsgHandle::getAddressList(const msg_thread_id_t threadId, msg_struct_list_s *pAddrList)
 {
-       msg_error_t err =  MSG_SUCCESS;
-
-//     err = MsgStoConnectDB();
-//
-//     if (err != MSG_SUCCESS)
-//     {
-//             MSG_DEBUG("MsgStoConnectDB() Error!!");
-//             return err;
-//     }
+       msg_error_t err = MSG_SUCCESS;
+       /*
+       err = MsgStoConnectDB();
 
+       if (err != MSG_SUCCESS) {
+               MSG_DEBUG("MsgStoConnectDB() Error!!");
+               return err;
+       }
+       */
        err = MsgStoGetAddressList(threadId, (msg_struct_list_s *)pAddrList);
 
-       if (err != MSG_SUCCESS)
-       {
+       if (err != MSG_SUCCESS) {
                MSG_DEBUG("MsgStoGetThreadViewList() Error!!");
                return err;
        }
 
-//     MsgStoDisconnectDB();
+       /* MsgStoDisconnectDB(); */
 
        return err;
 }
@@ -1504,47 +1468,46 @@ msg_error_t MsgHandle::getAddressList(const msg_thread_id_t threadId, msg_struct
 
 msg_error_t MsgHandle::getThreadIdByAddress(msg_struct_list_s *pAddrList, msg_thread_id_t *pThreadId)
 {
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S) + sizeof(pAddrList->nCount) + (sizeof(MSG_ADDRESS_INFO_S)*pAddrList->nCount);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_GET_THREAD_ID_BY_ADDRESS;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &pAddrList->nCount, sizeof(pAddrList->nCount));
        int addSize = sizeof(MSG_ADDRESS_INFO_S);
-       for(int i=0; i<pAddrList->nCount; i++) {
+       for (int i=0; i<pAddrList->nCount; i++) {
                memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+sizeof(pAddrList->nCount)+(addSize*i)+MAX_COOKIE_LEN), ((msg_struct_s *)(pAddrList->msg_struct_info[i]))->data, sizeof(MSG_ADDRESS_INFO_S));
        }
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
        if (pEvent == NULL)
                THROW(MsgException::INVALID_RESULT, "Event is NULL");
 
-       if (pEvent->eventType != MSG_EVENT_GET_THREAD_ID_BY_ADDRESS)
-       {
+       if (pEvent->eventType != MSG_EVENT_GET_THREAD_ID_BY_ADDRESS) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
        if (pEvent->result != MSG_SUCCESS)
                return pEvent->result;
 
-       // Decode Return Data
+       /* Decode Return Data */
        MsgDecodeThreadId(pEvent->data, pThreadId);
 
        return MSG_SUCCESS;
@@ -1555,47 +1518,46 @@ msg_error_t MsgHandle::getThreadIdByAddress(msg_list_handle_t msg_address_list,
 {
        int addrCnt = (int)g_list_length((GList *)msg_address_list);
 
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S) + sizeof(int) + (sizeof(MSG_ADDRESS_INFO_S)*addrCnt);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_GET_THREAD_ID_BY_ADDRESS;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &addrCnt, sizeof(int));
        int addSize = sizeof(MSG_ADDRESS_INFO_S);
-       for(int i=0; i<addrCnt; i++) {
+       for (int i=0; i<addrCnt; i++) {
                memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+sizeof(addrCnt)+(addSize*i)+MAX_COOKIE_LEN), ((msg_struct_s *)(g_list_nth_data((GList *)msg_address_list,(guint)i)))->data, sizeof(MSG_ADDRESS_INFO_S));
        }
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
        if (pEvent == NULL)
                THROW(MsgException::INVALID_RESULT, "Event is NULL");
 
-       if (pEvent->eventType != MSG_EVENT_GET_THREAD_ID_BY_ADDRESS)
-       {
+       if (pEvent->eventType != MSG_EVENT_GET_THREAD_ID_BY_ADDRESS) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
        if (pEvent->result != MSG_SUCCESS)
                return pEvent->result;
 
-       // Decode Return Data
+       /* Decode Return Data */
        MsgDecodeThreadId(pEvent->data, pThreadId);
 
        return MSG_SUCCESS;
@@ -1604,40 +1566,39 @@ msg_error_t MsgHandle::getThreadIdByAddress(msg_list_handle_t msg_address_list,
 
 msg_error_t MsgHandle::getThread(msg_thread_id_t threadId, MSG_THREAD_VIEW_S* pThreadInfo)
 {
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S) + sizeof(msg_thread_id_t);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_GET_THREAD_INFO;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &threadId, sizeof(msg_thread_id_t));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
        if (pEvent == NULL)
                THROW(MsgException::INVALID_RESULT, "Event is NULL");
 
-       if (pEvent->eventType != MSG_EVENT_GET_THREAD_INFO)
-       {
+       if (pEvent->eventType != MSG_EVENT_GET_THREAD_INFO) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
-       // Decode Return Data
+       /* Decode Return Data */
        MsgDecodeThreadInfo(pEvent->data, pThreadInfo);
 
        return MSG_SUCCESS;
@@ -1646,23 +1607,64 @@ msg_error_t MsgHandle::getThread(msg_thread_id_t threadId, MSG_THREAD_VIEW_S* pT
 
 msg_error_t MsgHandle::getMessageList(const MSG_LIST_CONDITION_S *pListCond, msg_struct_list_s *pMsgList)
 {
-       msg_error_t err =  MSG_SUCCESS;
+       msg_error_t err = MSG_SUCCESS;
+       /*
+       err = MsgStoConnectDB();
+
+       if (err != MSG_SUCCESS) {
+               MSG_DEBUG("MsgStoConnectDB() Error!!");
+               return err;
+       }
+       */
+       int count = 0;
+
+       if (pListCond->pAddressVal) {
+               int address_len = strlen(pListCond->pAddressVal);
+
+               /* Allocate Memory to Command Data */
+               int cmdSize = sizeof(MSG_CMD_S) + sizeof(int) + sizeof(char) * address_len;
+
+               char cmdBuf[cmdSize];
+               bzero(cmdBuf, cmdSize);
+               MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
+
+               /* Set Command Parameters */
+               pCmd->cmdType = MSG_CMD_SET_TEMP_ADDRESS_TABLE;
 
-//     err = MsgStoConnectDB();
-//
-//     if (err != MSG_SUCCESS) {
-//             MSG_DEBUG("MsgStoConnectDB() Error!!");
-//             return err;
-//     }
+               /* Copy Cookie */
+               memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       err = MsgStoGetMessageList(pListCond, pMsgList);
+               /* Copy Command Data */
+               memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &address_len, sizeof(int));
+               memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(int)), pListCond->pAddressVal, sizeof(char) * address_len);
+
+               /* Send Command to Messaging FW */
+               char* pEventData = NULL;
+               unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
+
+               write((char*)pCmd, cmdSize, &pEventData);
+
+               /* Get Return Data */
+               MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
+
+               if (pEvent == NULL)
+                       THROW(MsgException::INVALID_RESULT, "Event is NULL");
+
+               if (pEvent->eventType != MSG_EVENT_SET_TEMP_ADDRESS_TABLE) {
+                       THROW(MsgException::INVALID_RESULT, "Event Data Error");
+               }
+
+               memcpy(&count, pEvent->data, sizeof(int));
+       }
+
+       err = MsgStoGetMessageList(pListCond, pMsgList, count);
 
        if (err != MSG_SUCCESS) {
                MSG_DEBUG("MsgStoGetMessageList() Error!!");
                return err;
        }
 
-//     MsgStoDisconnectDB();
+       /* MsgStoDisconnectDB(); */
 
        return err;
 }
@@ -1670,7 +1672,7 @@ msg_error_t MsgHandle::getMessageList(const MSG_LIST_CONDITION_S *pListCond, msg
 
 msg_error_t MsgHandle::getMediaList(const msg_thread_id_t thread_id, msg_list_handle_t *pMediaList)
 {
-       msg_error_t err =  MSG_SUCCESS;
+       msg_error_t err = MSG_SUCCESS;
 
        err = MsgStoGetMediaList(thread_id, pMediaList);
 
@@ -1685,36 +1687,35 @@ msg_error_t MsgHandle::getMediaList(const msg_thread_id_t thread_id, msg_list_ha
 
 int MsgHandle::addPushEvent(MSG_PUSH_EVENT_INFO_S *pPushEvent)
 {
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_PUSH_EVENT_INFO_S);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_ADD_PUSH_EVENT;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), pPushEvent, sizeof(MSG_PUSH_EVENT_INFO_S));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
        if (pEvent == NULL)
                THROW(MsgException::INVALID_RESULT, "Event is NULL");
 
-       if (pEvent->eventType != MSG_EVENT_ADD_PUSH_EVENT)
-       {
+       if (pEvent->eventType != MSG_EVENT_ADD_PUSH_EVENT) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
@@ -1724,121 +1725,120 @@ int MsgHandle::addPushEvent(MSG_PUSH_EVENT_INFO_S *pPushEvent)
 
 int MsgHandle::deletePushEvent(MSG_PUSH_EVENT_INFO_S *pPushEvent)
 {
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_PUSH_EVENT_INFO_S);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_DELETE_PUSH_EVENT;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), pPushEvent, sizeof(MSG_PUSH_EVENT_INFO_S));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
        if (pEvent == NULL)
                THROW(MsgException::INVALID_RESULT, "Event is NULL");
 
-       if (pEvent->eventType != MSG_EVENT_DELETE_PUSH_EVENT)
-       {
+       if (pEvent->eventType != MSG_EVENT_DELETE_PUSH_EVENT) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
        return pEvent->result;
 }
 
+
 int MsgHandle::updatePushEvent(MSG_PUSH_EVENT_INFO_S *pSrc, MSG_PUSH_EVENT_INFO_S *pDst)
 {
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S) +  2 * sizeof(MSG_PUSH_EVENT_INFO_S);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_UPDATE_PUSH_EVENT;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), pSrc, sizeof(MSG_PUSH_EVENT_INFO_S));
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(MSG_PUSH_EVENT_INFO_S)), pDst, sizeof(MSG_PUSH_EVENT_INFO_S));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
        if (pEvent == NULL)
                THROW(MsgException::INVALID_RESULT, "Event is NULL");
 
-       if (pEvent->eventType != MSG_EVENT_UPDATE_PUSH_EVENT)
-       {
+       if (pEvent->eventType != MSG_EVENT_UPDATE_PUSH_EVENT) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
        return pEvent->result;
 }
 
+
 msg_error_t MsgHandle::getVobject(msg_message_id_t MsgId, void** encodedData)
 {
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S) + sizeof(msg_message_id_t);
        char *encode_data = NULL;
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_GET_MSG;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &MsgId, sizeof(msg_message_id_t));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
        if (pEvent == NULL)
                THROW(MsgException::INVALID_RESULT, "Event is NULL");
 
-       if (pEvent->eventType != MSG_EVENT_GET_MSG)
-       {
+       if (pEvent->eventType != MSG_EVENT_GET_MSG) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
        if (pEvent->result != MSG_SUCCESS)
                return pEvent->result;
 
-       // Decode Return Data
+       /* Decode Return Data */
        MSG_MESSAGE_INFO_S msgInfo = {0,};
        MSG_SENDINGOPT_INFO_S sendOptInfo = {0,};
 
@@ -1847,7 +1847,7 @@ msg_error_t MsgHandle::getVobject(msg_message_id_t MsgId, void** encodedData)
 
        MsgDecodeMsgInfo(pEvent->data, &msgInfo, &sendOptInfo);
 
-       //Convert MSG_MESSAGE_INFO_S to
+       /*Convert MSG_MESSAGE_INFO_S to */
        encode_data = MsgVMessageEncode(&msgInfo);
        if (encode_data) {
                *encodedData = (void*)encode_data;
@@ -1856,11 +1856,10 @@ msg_error_t MsgHandle::getVobject(msg_message_id_t MsgId, void** encodedData)
                *encodedData = NULL;
        }
 
-       // Delete Temp File
-       if (msgInfo.bTextSms == false)
-       {
-               // Delete Temp File
-               MsgDeleteFile(msgInfo.msgData); //ipc
+       /* Delete Temp File */
+       if (msgInfo.bTextSms == false) {
+               /* Delete Temp File */
+               MsgDeleteFile(msgInfo.msgData); /* ipc */
        }
 
        return MSG_SUCCESS;
index 6a7a4ee..475f065 100755 (executable)
@@ -56,8 +56,8 @@ msg_error_t MsgHandle::submitReq(MSG_REQUEST_S* pReq)
        }
 
        if (reqmsg->subType != MSG_SENDREQ_JAVA_MMS) {
-               // In case MMS read report, get address value later.
-               if(reqmsg->subType != MSG_READREPLY_MMS) {
+               /* In case MMS read report, get address value later. */
+               if (reqmsg->subType != MSG_READREPLY_MMS) {
                        if (reqmsg->addr_list && (reqmsg->addr_list->nCount > 0) && (reqmsg->addr_list->nCount <= MAX_TO_ADDRESS_CNT)) {
                                MSG_DEBUG("Recipient address count [%d]", reqmsg->addr_list->nCount );
                        } else if (g_list_length(reqmsg->addressList) > 0) {
@@ -69,8 +69,10 @@ msg_error_t MsgHandle::submitReq(MSG_REQUEST_S* pReq)
                }
 
                /* Begin: Setting default values for submit request */
-       //      pReq->msg.msgId = 0;    // Set Request ID: internal use
-       //      pReq->msg.folderId = MSG_OUTBOX_ID;     // Set Folder ID
+               /* Set Request ID: internal use */
+               /* pReq->msg.msgId = 0; */
+               /* Set Folder ID */
+               /* pReq->msg.folderId = MSG_OUTBOX_ID; */
                if (reqmsg->subType == MSG_RETRIEVE_MMS) {
                        reqmsg->networkStatus = MSG_NETWORK_RETRIEVING;
                } else {
@@ -78,7 +80,7 @@ msg_error_t MsgHandle::submitReq(MSG_REQUEST_S* pReq)
                }
 
                reqmsg->bRead = false;
-               //reqmsg->bProtected = false;
+               /* reqmsg->bProtected = false; */
                reqmsg->priority = MSG_MESSAGE_PRIORITY_NORMAL;
                reqmsg->direction = MSG_DIRECTION_TYPE_MO;
                reqmsg->storageId = MSG_STORAGE_PHONE;
@@ -91,13 +93,13 @@ msg_error_t MsgHandle::submitReq(MSG_REQUEST_S* pReq)
                reqmsg->displayTime = curTime;
                /* End : Setting default values for submit request */
        } else {
-               //in case of JAVA MMS msg, parse mms transaction id from pMmsData
+               /* in case of JAVA MMS msg, parse mms transaction id from pMmsData */
                reqmsg->networkStatus = MSG_NETWORK_SENDING;
                strncpy(trId, (char*)reqmsg->pMmsData+3,MMS_TR_ID_LEN);
                MSG_SEC_DEBUG("JavaMMS transaction Id:%s ",trId);
        }
 
-       // Convert MSG_MESSAGE_S to MSG_MESSAGE_INFO_S
+       /* Convert MSG_MESSAGE_S to MSG_MESSAGE_INFO_S */
        convertMsgStruct(reqmsg, &(reqInfo.msgInfo));
 
        MSG_MESSAGE_TYPE_S msgType = {0,};
@@ -118,7 +120,7 @@ msg_error_t MsgHandle::submitReq(MSG_REQUEST_S* pReq)
 
        chInfo.listenerFd = MsgProxyListener::instance()->getRemoteFd();
 
-       chInfo.handleAddr = (unsigned int) this;
+       chInfo.handleAddr = (unsigned long) this;
 
        /* Allocate Memory to Command Data */
        char* encodedData = NULL;
@@ -127,7 +129,7 @@ msg_error_t MsgHandle::submitReq(MSG_REQUEST_S* pReq)
 
        int cmdSize = sizeof(MSG_CMD_S) + sizeof(msg_request_id_t) + dataSize + sizeof(MSG_PROXY_INFO_S);
 
-       // In case of JAVA MMS msg, add trId
+       /* In case of JAVA MMS msg, add trId */
        if (reqmsg->subType == MSG_SENDREQ_JAVA_MMS)
                cmdSize += sizeof(trId);
 
@@ -136,36 +138,35 @@ msg_error_t MsgHandle::submitReq(MSG_REQUEST_S* pReq)
 
        MSG_CMD_S* pCmd = (MSG_CMD_S*) cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_SUBMIT_REQ;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &reqInfo.reqId, sizeof(msg_request_id_t));
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(msg_request_id_t)), &chInfo, sizeof(MSG_PROXY_INFO_S));
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(msg_request_id_t)+sizeof(MSG_PROXY_INFO_S)), encodedData, dataSize);
 
-       // In case of JAVA MMS msg, add trId
+       /* In case of JAVA MMS msg, add trId */
        if (reqmsg->subType == MSG_SENDREQ_JAVA_MMS)
                memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(msg_request_id_t)+sizeof(MSG_PROXY_INFO_S)+dataSize), &trId, sizeof(trId));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*) pEventData;
 
        int* pReqId = (int*) pEvent->data;
        pReq->reqId = *pReqId;
        MSG_DEBUG("SENT_REQ_ID: %d", pReq->reqId);
 
-       if (pEvent->eventType != MSG_EVENT_SUBMIT_REQ)
-       {
+       if (pEvent->eventType != MSG_EVENT_SUBMIT_REQ) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error:%d", pEvent->eventType);
        }
 
@@ -184,24 +185,28 @@ msg_error_t MsgHandle::regSentStatusCallback(msg_sent_status_cb onStatusChanged,
 
        eventListener->start(this);
 
-       int remoteFd = eventListener->getRemoteFd(); // fd that is reserved to the "listener thread" by msgfw daemon
+       int remoteFd = eventListener->getRemoteFd(); /* fd that is reserved to the "listener thread" by msgfw daemon */
 
-       if(remoteFd == -1 )
+       if (remoteFd == -1) {
+               eventListener->stop();
                return MSG_ERR_INVALID_MSGHANDLE;
+       }
 
-       if (eventListener->regSentStatusEventCB(this, onStatusChanged, pUserParam) == false)
+       if (eventListener->regSentStatusEventCB(this, remoteFd, onStatusChanged, pUserParam) == false) {
+               eventListener->stop();
                return MSG_ERR_INVALID_PARAMETER;
+       }
 
-       // Allocate Memory to Command Data
-       int cmdSize = sizeof(MSG_CMD_S) + sizeof(int); // cmd type, listenerFd
+       /* Allocate Memory to Command Data */
+       int cmdSize = sizeof(MSG_CMD_S) + sizeof(int); /* cmd type, listenerFd */
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*) cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_REG_SENT_STATUS_CB;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
        MSG_DEBUG("remote fd %d", remoteFd);
@@ -210,17 +215,16 @@ msg_error_t MsgHandle::regSentStatusCallback(msg_sent_status_cb onStatusChanged,
 
        MSG_DEBUG("reg status [%d : %s], %d", pCmd->cmdType, MsgDbgCmdStr(pCmd->cmdType), remoteFd);
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
-       if (pEvent->eventType != MSG_EVENT_REG_SENT_STATUS_CB)
-       {
+       if (pEvent->eventType != MSG_EVENT_REG_SENT_STATUS_CB) {
                THROW(MsgException::INVALID_PARAM, "Event Data Error");
        }
 
@@ -230,33 +234,39 @@ msg_error_t MsgHandle::regSentStatusCallback(msg_sent_status_cb onStatusChanged,
 
 msg_error_t MsgHandle::regSmsMessageCallback(msg_sms_incoming_cb onMsgIncoming, unsigned short port, void *pUserParam)
 {
-       if( (!onMsgIncoming) )
+       if ( (!onMsgIncoming) )
                THROW(MsgException::INVALID_PARAM, "Param %p", onMsgIncoming);
 
        MsgProxyListener* eventListener = MsgProxyListener::instance();
 
        eventListener->start(this);
 
-       int remoteFd = eventListener->getRemoteFd(); // fd that is reserved to the "listener thread" by msgfw daemon
+       int remoteFd = eventListener->getRemoteFd(); /* fd that is reserved to the "listener thread" by msgfw daemon */
 
-       if(remoteFd == -1 )
+       if (remoteFd == -1) {
+               eventListener->stop();
                return MSG_ERR_INVALID_MSGHANDLE;
+       }
 
-       if (eventListener->regMessageIncomingEventCB(this, onMsgIncoming, port, pUserParam) == false)
+       if (eventListener->regMessageIncomingEventCB(this, remoteFd, onMsgIncoming, port, pUserParam) == false) {
+               eventListener->stop();
                return MSG_ERR_INVALID_PARAMETER;
+       }
 
-       // Allocate Memory to Command Data
-       int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_CMD_REG_INCOMING_MSG_CB_S); //sizeof(int) + sizeof; // cmd type, listener fd
+       /* Allocate Memory to Command Data */
+       /* sizeof(int) + sizeof; */
+       /* cmd type, listener fd */
+       int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_CMD_REG_INCOMING_MSG_CB_S);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
 
        MSG_CMD_S* pCmd = (MSG_CMD_S*) cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_REG_INCOMING_MSG_CB;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
        MSG_CMD_REG_INCOMING_MSG_CB_S cmdParam = {0};
@@ -269,18 +279,17 @@ msg_error_t MsgHandle::regSmsMessageCallback(msg_sms_incoming_cb onMsgIncoming,
 
        MSG_DEBUG("reg new msg [%s], fd %d, port %d", MsgDbgCmdStr(pCmd->cmdType), cmdParam.listenerFd, cmdParam.port);
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
-       if (pEvent->eventType != MSG_EVENT_REG_INCOMING_MSG_CB)
-       {
+       if (pEvent->eventType != MSG_EVENT_REG_INCOMING_MSG_CB) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
@@ -290,22 +299,26 @@ msg_error_t MsgHandle::regSmsMessageCallback(msg_sms_incoming_cb onMsgIncoming,
 
 msg_error_t MsgHandle::regMmsConfMessageCallback(msg_mms_conf_msg_incoming_cb onMMSConfMsgIncoming, const char *pAppId, void *pUserParam)
 {
-       if( (!onMMSConfMsgIncoming) )
+       if ( (!onMMSConfMsgIncoming) )
                THROW(MsgException::INVALID_PARAM, "Param %p", onMMSConfMsgIncoming);
 
        MsgProxyListener* eventListener = MsgProxyListener::instance();
 
        eventListener->start(this);
 
-       int remoteFd = eventListener->getRemoteFd(); // fd that is reserved to the "listener thread" by msgfw daemon
+       int remoteFd = eventListener->getRemoteFd(); /* fd that is reserved to the "listener thread" by msgfw daemon */
 
-       if(remoteFd == -1 )
+       if (remoteFd == -1) {
+               eventListener->stop();
                return MSG_ERR_INVALID_MSGHANDLE;
+       }
 
-       if (eventListener->regMMSConfMessageIncomingEventCB(this, onMMSConfMsgIncoming, pAppId, pUserParam) == false)
+       if (eventListener->regMMSConfMessageIncomingEventCB(this, remoteFd, onMMSConfMsgIncoming, pAppId, pUserParam) == false) {
+               eventListener->stop();
                return MSG_ERR_INVALID_PARAMETER;
+       }
 
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_CMD_REG_INCOMING_MMS_CONF_MSG_CB_S);
 
        char cmdBuf[cmdSize];
@@ -313,10 +326,10 @@ msg_error_t MsgHandle::regMmsConfMessageCallback(msg_mms_conf_msg_incoming_cb on
 
        MSG_CMD_S* pCmd = (MSG_CMD_S*) cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_REG_INCOMING_MMS_CONF_MSG_CB;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
        MSG_CMD_REG_INCOMING_MMS_CONF_MSG_CB_S cmdParam = {0};
@@ -331,18 +344,17 @@ msg_error_t MsgHandle::regMmsConfMessageCallback(msg_mms_conf_msg_incoming_cb on
 
        MSG_DEBUG("reg new msg [%s], fd:%d, appId:%s", MsgDbgCmdStr(pCmd->cmdType), cmdParam.listenerFd,  (pAppId)? cmdParam.appId:"NULL" );
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
-       if (pEvent->eventType != MSG_EVENT_REG_INCOMING_MMS_CONF_MSG_CB)
-       {
+       if (pEvent->eventType != MSG_EVENT_REG_INCOMING_MMS_CONF_MSG_CB) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
@@ -352,33 +364,39 @@ msg_error_t MsgHandle::regMmsConfMessageCallback(msg_mms_conf_msg_incoming_cb on
 
 msg_error_t MsgHandle::regSyncMLMessageCallback(msg_syncml_msg_incoming_cb onSyncMLMsgIncoming, void *pUserParam)
 {
-       if( (!onSyncMLMsgIncoming) )
+       if ( (!onSyncMLMsgIncoming) )
                THROW(MsgException::INVALID_PARAM, "Param %p", onSyncMLMsgIncoming);
 
        MsgProxyListener* eventListener = MsgProxyListener::instance();
 
        eventListener->start(this);
 
-       int remoteFd = eventListener->getRemoteFd(); // fd that is reserved to the "listener thread" by msgfw daemon
+       int remoteFd = eventListener->getRemoteFd(); /* fd that is reserved to the "listener thread" by msgfw daemon */
 
-       if(remoteFd == -1 )
+       if (remoteFd == -1) {
+               eventListener->stop();
                return MSG_ERR_INVALID_MSGHANDLE;
+       }
 
-       if (eventListener->regSyncMLMessageIncomingEventCB(this, onSyncMLMsgIncoming, pUserParam) == false)
+       if (eventListener->regSyncMLMessageIncomingEventCB(this, remoteFd, onSyncMLMsgIncoming, pUserParam) == false) {
+               eventListener->stop();
                return MSG_ERR_INVALID_PARAMETER;
+       }
 
-       // Allocate Memory to Command Data
-       int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_CMD_REG_INCOMING_SYNCML_MSG_CB_S); //sizeof(int) + sizeof; // cmd type, listener fd
+       /* Allocate Memory to Command Data */
+       /* sizeof(int) + sizeof; */
+       /* cmd type, listener fd */
+       int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_CMD_REG_INCOMING_SYNCML_MSG_CB_S);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
 
        MSG_CMD_S* pCmd = (MSG_CMD_S*) cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_REG_INCOMING_SYNCML_MSG_CB;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
        MSG_CMD_REG_INCOMING_SYNCML_MSG_CB_S cmdParam = {0};
@@ -390,17 +408,16 @@ msg_error_t MsgHandle::regSyncMLMessageCallback(msg_syncml_msg_incoming_cb onSyn
 
        MSG_DEBUG("reg new msg [%s], fd %d", MsgDbgCmdStr(pCmd->cmdType), cmdParam.listenerFd);
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
-       if (pEvent->eventType != MSG_EVENT_REG_INCOMING_SYNCML_MSG_CB)
-       {
+       if (pEvent->eventType != MSG_EVENT_REG_INCOMING_SYNCML_MSG_CB) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
@@ -410,31 +427,37 @@ msg_error_t MsgHandle::regSyncMLMessageCallback(msg_syncml_msg_incoming_cb onSyn
 
 msg_error_t MsgHandle::regLBSMessageCallback(msg_lbs_msg_incoming_cb onLBSMsgIncoming, void *pUserParam)
 {
-       if( (!onLBSMsgIncoming) )
+       if ( (!onLBSMsgIncoming) )
                THROW(MsgException::INVALID_PARAM, "Param %p", onLBSMsgIncoming);
 
        MsgProxyListener* eventListener = MsgProxyListener::instance();
 
        eventListener->start(this);
 
-       int remoteFd = eventListener->getRemoteFd(); // fd that is reserved to the "listener thread" by msgfw daemon
+       int remoteFd = eventListener->getRemoteFd(); /* fd that is reserved to the "listener thread" by msgfw daemon */
 
-       if(remoteFd == -1 )
+       if (remoteFd == -1) {
+               eventListener->stop();
                return MSG_ERR_INVALID_MSGHANDLE;
+       }
 
-       if (eventListener->regLBSMessageIncomingEventCB(this, onLBSMsgIncoming, pUserParam) == false)
+       if (eventListener->regLBSMessageIncomingEventCB(this, remoteFd, onLBSMsgIncoming, pUserParam) == false) {
+               eventListener->stop();
                return MSG_ERR_INVALID_PARAMETER;
+       }
 
-       // Allocate Memory to Command Data
-       int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_CMD_REG_INCOMING_LBS_MSG_CB_S); //sizeof(int) + sizeof; // cmd type, listener fd
+       /* Allocate Memory to Command Data */
+       /* sizeof(int) + sizeof; */
+       /* cmd type, listener fd */
+       int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_CMD_REG_INCOMING_LBS_MSG_CB_S);
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*) cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_REG_INCOMING_LBS_MSG_CB;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
        MSG_CMD_REG_INCOMING_LBS_MSG_CB_S cmdParam = {0};
@@ -446,18 +469,17 @@ msg_error_t MsgHandle::regLBSMessageCallback(msg_lbs_msg_incoming_cb onLBSMsgInc
 
        MSG_DEBUG("reg new msg [%s], fd %d", MsgDbgCmdStr(pCmd->cmdType), cmdParam.listenerFd);
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
-       if (pEvent->eventType != MSG_EVENT_REG_INCOMING_LBS_MSG_CB)
-       {
+       if (pEvent->eventType != MSG_EVENT_REG_INCOMING_LBS_MSG_CB) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
@@ -467,33 +489,39 @@ msg_error_t MsgHandle::regLBSMessageCallback(msg_lbs_msg_incoming_cb onLBSMsgInc
 
 msg_error_t MsgHandle::regSyncMLMessageOperationCallback(msg_syncml_msg_operation_cb onSyncMLMsgOperation, void *pUserParam)
 {
-       if( (!onSyncMLMsgOperation) )
+       if ( (!onSyncMLMsgOperation) )
                THROW(MsgException::INVALID_PARAM, "Param %p", onSyncMLMsgOperation);
 
        MsgProxyListener* eventListener = MsgProxyListener::instance();
 
        eventListener->start(this);
 
-       int remoteFd = eventListener->getRemoteFd(); // fd that is reserved to the "listener thread" by msgfw daemon
+       int remoteFd = eventListener->getRemoteFd(); /* fd that is reserved to the "listener thread" by msgfw daemon */
 
-       if(remoteFd == -1 )
+       if (remoteFd == -1) {
+               eventListener->stop();
                return MSG_ERR_INVALID_MSGHANDLE;
+       }
 
-       if (eventListener->regSyncMLMessageOperationEventCB(this, onSyncMLMsgOperation, pUserParam) == false)
+       if (eventListener->regSyncMLMessageOperationEventCB(this, remoteFd, onSyncMLMsgOperation, pUserParam) == false) {
+               eventListener->stop();
                return MSG_ERR_INVALID_PARAMETER;
+       }
 
-       // Allocate Memory to Command Data
-       int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_CMD_REG_SYNCML_MSG_OPERATION_CB_S); //sizeof(int) + sizeof; // cmd type, listener fd
+       /* Allocate Memory to Command Data */
+       /* sizeof(int) + sizeof; */
+       /* cmd type, listener fd */
+       int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_CMD_REG_SYNCML_MSG_OPERATION_CB_S);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
 
        MSG_CMD_S* pCmd = (MSG_CMD_S*) cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_REG_SYNCML_MSG_OPERATION_CB;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
        MSG_CMD_REG_SYNCML_MSG_OPERATION_CB_S cmdParam = {0};
@@ -505,42 +533,46 @@ msg_error_t MsgHandle::regSyncMLMessageOperationCallback(msg_syncml_msg_operatio
 
        MSG_DEBUG("register syncML msg operation callback [%s], fd %d", MsgDbgCmdStr(pCmd->cmdType), cmdParam.listenerFd);
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
-       if (pEvent->eventType != MSG_EVENT_REG_SYNCML_MSG_OPERATION_CB)
-       {
+       if (pEvent->eventType != MSG_EVENT_REG_SYNCML_MSG_OPERATION_CB) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
        return pEvent->result;
 }
 
+
 msg_error_t MsgHandle::regPushMessageCallback(msg_push_msg_incoming_cb onPushMsgIncoming, const char *pAppId, void *pUserParam)
 {
-       if( (!onPushMsgIncoming) )
+       if ( (!onPushMsgIncoming) )
                THROW(MsgException::INVALID_PARAM, "Param %p", onPushMsgIncoming);
 
        MsgProxyListener* eventListener = MsgProxyListener::instance();
 
        eventListener->start(this);
 
-       int remoteFd = eventListener->getRemoteFd(); // fd that is reserved to the "listener thread" by msgfw daemon
+       int remoteFd = eventListener->getRemoteFd(); /* fd that is reserved to the "listener thread" by msgfw daemon */
 
-       if(remoteFd == -1 )
+       if (remoteFd == -1) {
+               eventListener->stop();
                return MSG_ERR_INVALID_MSGHANDLE;
+       }
 
-       if (eventListener->regPushMessageIncomingEventCB(this, onPushMsgIncoming, pAppId, pUserParam) == false)
+       if (eventListener->regPushMessageIncomingEventCB(this, remoteFd, onPushMsgIncoming, pAppId, pUserParam) == false) {
+               eventListener->stop();
                return MSG_ERR_INVALID_PARAMETER;
+       }
 
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_CMD_REG_INCOMING_PUSH_MSG_CB_S);
 
        char cmdBuf[cmdSize];
@@ -548,10 +580,10 @@ msg_error_t MsgHandle::regPushMessageCallback(msg_push_msg_incoming_cb onPushMsg
 
        MSG_CMD_S* pCmd = (MSG_CMD_S*) cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_REG_INCOMING_PUSH_MSG_CB;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
        MSG_CMD_REG_INCOMING_PUSH_MSG_CB_S cmdParam = {0};
@@ -566,53 +598,60 @@ msg_error_t MsgHandle::regPushMessageCallback(msg_push_msg_incoming_cb onPushMsg
 
        MSG_DEBUG("reg new msg [%s], fd:%d, appId:%s", MsgDbgCmdStr(pCmd->cmdType), cmdParam.listenerFd,  (pAppId)? cmdParam.appId:"NULL" );
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
-       if (pEvent->eventType != MSG_EVENT_REG_INCOMING_PUSH_MSG_CB)
-       {
+       if (pEvent->eventType != MSG_EVENT_REG_INCOMING_PUSH_MSG_CB) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
        return pEvent->result;
 }
 
+
 msg_error_t MsgHandle::regCBMessageCallback(msg_cb_incoming_cb onCBIncoming, bool bSave, void *pUserParam)
 {
-       if( (!onCBIncoming) )
+       if ( (!onCBIncoming) )
                THROW(MsgException::INVALID_PARAM, "Param %p", onCBIncoming);
 
        MsgProxyListener* eventListener = MsgProxyListener::instance();
 
        eventListener->start(this);
 
-       int remoteFd = eventListener->getRemoteFd(); // fd that is reserved to the "listener thread" by msgfw daemon
+       int remoteFd = eventListener->getRemoteFd(); /* fd that is reserved to the "listener thread" by msgfw daemon */
 
-       if(remoteFd == -1 )
+       if (remoteFd == -1) {
+               eventListener->stop();
                return MSG_ERR_INVALID_MSGHANDLE;
+       }
+
+       if (eventListener->regCBMessageIncomingEventCB(this, remoteFd, onCBIncoming, bSave, pUserParam) == false) {
+               eventListener->stop();
+               return MSG_ERR_INVALID_PARAMETER;
+       }
 
-       if (eventListener->regCBMessageIncomingEventCB(this, onCBIncoming, bSave, pUserParam) == false)
-               return MSG_SUCCESS;
+       /* Allocate Memory to Command Data */
+       /* sizeof(int) + sizeof; */
+       /* cmd type, listener fd */
 
-       // Allocate Memory to Command Data
-       int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_CMD_REG_INCOMING_CB_MSG_CB_S); //sizeof(int) + sizeof; // cmd type, listener fd
+       int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_CMD_REG_INCOMING_CB_MSG_CB_S);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
 
        MSG_CMD_S* pCmd = (MSG_CMD_S*) cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_REG_INCOMING_CB_MSG_CB;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
        MSG_CMD_REG_CB_INCOMING_MSG_CB_S cmdParam = {0};
@@ -625,18 +664,17 @@ msg_error_t MsgHandle::regCBMessageCallback(msg_cb_incoming_cb onCBIncoming, boo
 
        MSG_DEBUG("reg new msg [%s], fd: %d, bSave: %d", MsgDbgCmdStr(pCmd->cmdType), cmdParam.listenerFd, cmdParam.bsave);
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
-       if (pEvent->eventType != MSG_EVENT_REG_INCOMING_CB_MSG_CB)
-       {
+       if (pEvent->eventType != MSG_EVENT_REG_INCOMING_CB_MSG_CB) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
@@ -653,24 +691,28 @@ msg_error_t MsgHandle::regReportMessageCallback(msg_report_msg_incoming_cb onRep
 
        eventListener->start(this);
 
-       int remoteFd = eventListener->getRemoteFd(); // fd that is reserved to the "listener thread" by msgfw daemon
+       int remoteFd = eventListener->getRemoteFd(); /* fd that is reserved to the "listener thread" by msgfw daemon */
 
-       if(remoteFd == -1 )
+       if (remoteFd == -1) {
+               eventListener->stop();
                return MSG_ERR_INVALID_MSGHANDLE;
+       }
 
-       if (eventListener->regReportMsgIncomingCB(this, onReportMsgCB, pUserParam) == false)
+       if (eventListener->regReportMsgIncomingCB(this, remoteFd, onReportMsgCB, pUserParam) == false) {
+               eventListener->stop();
                return MSG_ERR_INVALID_PARAMETER;
+       }
 
-       // Allocate Memory to Command Data
-       int cmdSize = sizeof(MSG_CMD_S) + sizeof(int); // cmd type, listenerFd
+       /* Allocate Memory to Command Data */
+       int cmdSize = sizeof(MSG_CMD_S) + sizeof(int); /* cmd type, listenerFd */
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*) cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_REG_REPORT_MSG_INCOMING_CB;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
        MSG_DEBUG("remote fd %d", remoteFd);
@@ -679,17 +721,16 @@ msg_error_t MsgHandle::regReportMessageCallback(msg_report_msg_incoming_cb onRep
 
        MSG_DEBUG("reg status [%d : %s], %d", pCmd->cmdType, MsgDbgCmdStr(pCmd->cmdType), remoteFd);
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
-       if (pEvent->eventType != MSG_EVENT_REG_REPORT_MSG_INCOMING_CB)
-       {
+       if (pEvent->eventType != MSG_EVENT_REG_REPORT_MSG_INCOMING_CB) {
                THROW(MsgException::INVALID_PARAM, "Event Data Error");
        }
 
@@ -699,40 +740,38 @@ msg_error_t MsgHandle::regReportMessageCallback(msg_report_msg_incoming_cb onRep
 
 msg_error_t MsgHandle::operateSyncMLMessage(msg_message_id_t msgId)
 {
-       if( msgId < 1)
+       if ( msgId < 1)
                THROW(MsgException::INVALID_PARAM, "Param msgId %d", msgId);
 
-       // Allocate Memory to Command Data
+       /* Allocate Memory to Command Data */
        int cmdSize = sizeof(MSG_CMD_S) + sizeof(msg_message_id_t);
 
        char cmdBuf[cmdSize];
        bzero(cmdBuf, cmdSize);
        MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
 
-       // Set Command Parameters
+       /* Set Command Parameters */
        pCmd->cmdType = MSG_CMD_SYNCML_OPERATION;
 
-       // Copy Cookie
+       /* Copy Cookie */
        memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
 
-       // Copy Command Data
+       /* Copy Command Data */
        memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &msgId, sizeof(msg_message_id_t));
 
-       // Send Command to Messaging FW
+       /* Send Command to Messaging FW */
        char* pEventData = NULL;
        unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
 
 
        write((char*)pCmd, cmdSize, &pEventData);
 
-       // Get Return Data
+       /* Get Return Data */
        MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
 
-       if (pEvent->eventType != MSG_EVENT_SYNCML_OPERATION)
-       {
+       if (pEvent->eventType != MSG_EVENT_SYNCML_OPERATION) {
                THROW(MsgException::INVALID_RESULT, "Event Data Error");
        }
 
        return pEvent->result;
 }
-
index 168663b..239adb0 100755 (executable)
@@ -28,14 +28,17 @@ void MsgServerRestartCb(keynode_t *key, void* data)
 {
        bool bReady = false;
        MSG_DEBUG("Message Service Running State Changed");
-       // server is currently booting and service is not available until the end of booting
+       /* server is currently booting and service is not available until the end of booting */
        MsgSettingGetBool(VCONFKEY_MSG_SERVER_READY, &bReady);
        MSG_INFO("Message Service Running State Changed bReady:(%d)", bReady);
 
-       //bReady false indicates that server has restarted. Hence the proxylistener needs to be reset
+       /* bReady false indicates that server has restarted. Hence the proxylistener needs to be reset */
        if (bReady == false) {
                MSG_DEBUG("Message Service Is Restarted. Resetting ProxyListener");
                MsgProxyListener::instance()->resetProxyListener();
+       } else {
+               MSG_DEBUG("Message Service Is ready again. Refreshing ProxyListener");
+               MsgProxyListener::instance()->refreshProxyListener();
        }
 }
 
@@ -43,35 +46,29 @@ gboolean readSocket(GIOChannel *source, GIOCondition condition, gpointer data)
 {
        MSG_BEGIN();
 #if 0
-       if ((G_IO_ERR & condition) || (G_IO_HUP & condition) || (G_IO_NVAL & condition))
-       {
+       if ((G_IO_ERR & condition) || (G_IO_HUP & condition) || (G_IO_NVAL & condition)) {
                MSG_DEBUG("IO condition Error!!! [%d]", condition);
 
                MsgProxyListener::instance()->stop();
                return FALSE;
        }
 #endif
-       if (G_IO_ERR & condition)
-       {
+       if (G_IO_ERR & condition) {
                MSG_ERR("IO Error!!! [%d]", condition);
-
-               MsgProxyListener::instance()->stop();
+               MsgProxyListener::instance()->clearProxyCBLists();
+               MsgProxyListener::instance()->clearOpenHandleSet();
                return FALSE;
        }
 
-       if (G_IO_HUP & condition)
-       {
+       if (G_IO_HUP & condition) {
                MSG_ERR("socket fd Error!!! [%d]", condition);
-
-               MsgProxyListener::instance()->stop();
                return FALSE;
        }
 
-       if (G_IO_NVAL & condition)
-       {
+       if (G_IO_NVAL & condition) {
                MSG_ERR("Invaild socket Error!!! [%d]", condition);
-
-               MsgProxyListener::instance()->stop();
+               MsgProxyListener::instance()->clearProxyCBLists();
+               MsgProxyListener::instance()->clearOpenHandleSet();
                return FALSE;
        }
 
@@ -81,19 +78,13 @@ gboolean readSocket(GIOChannel *source, GIOCondition condition, gpointer data)
 
        int n = MsgProxyListener::instance()->readFromSocket(&buf, &len);
 
-       if (n > 0)
-       {
+       if (n > 0) {
                MSG_DEBUG(">>Receiving %d bytes", n);
                MsgProxyListener::instance()->handleEvent((MSG_EVENT_S*)buf);
-       }
-       else if (n == 0)
-       {
+       } else if (n == 0) {
                MSG_WARN("Server closed connection");
-               MsgProxyListener::instance()->stop();
                return FALSE;
-       }
-       else // dataSize < 0
-       {
+       } else /* dataSize < 0 */ {
                MSG_DEBUG("Data is not for Listener");
        }
 
@@ -111,12 +102,8 @@ MsgProxyListener* MsgProxyListener::pInstance = NULL;
 
 MsgProxyListener::MsgProxyListener() : running(0)
 {
-       sentStatusCBList.clear();
-       newMessageCBList.clear();
-       newMMSConfMessageCBList.clear();
-       newSyncMLMessageCBList.clear();
-       newLBSMessageCBList.clear();
-       openHandleSet.clear();
+       clearProxyCBLists();
+       clearOpenHandleSet();
        MsgSettingRegVconfCBCommon(VCONFKEY_MSG_SERVER_READY, MsgServerRestartCb);
 
        channel = NULL;
@@ -126,12 +113,8 @@ MsgProxyListener::MsgProxyListener() : running(0)
 
 MsgProxyListener::~MsgProxyListener()
 {
-       sentStatusCBList.clear();
-       newMessageCBList.clear();
-       newMMSConfMessageCBList.clear();
-       newSyncMLMessageCBList.clear();
-       newLBSMessageCBList.clear();
-       openHandleSet.clear();
+       clearProxyCBLists();
+       clearOpenHandleSet();
        MsgSettingRemoveVconfCBCommon(VCONFKEY_MSG_SERVER_READY, MsgServerRestartCb);
 }
 
@@ -153,21 +136,22 @@ void MsgProxyListener::start(MsgHandle* pMsgHandle)
 {
        MutexLocker lock(mx);
 
-       handle_set::iterator it = openHandleSet.find(pMsgHandle);
-       if (it == openHandleSet.end())
-               openHandleSet.insert(pMsgHandle);
-       if (running == 0)
-       {
+       this->insertOpenHandleSet(pMsgHandle);
+
+       if (running == 0) {
                cliSock.connect(MSG_SOCKET_PATH);
-               cv.signal(); // wake up the waiting thread
+               /* wake up the waiting thread */
+               cv.signal();
 
                int fd = cliSock.fd();
 
                MSG_DEBUG("Socket Fd : %d", fd);
 
-               channel = g_io_channel_unix_new(fd); // initializes ref_count = 1
+               /* initializes ref_count = 1 */
+               channel = g_io_channel_unix_new(fd);
 
-               eventSourceId = g_io_add_watch(channel, (GIOCondition)(G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL), &readSocket, NULL); // increments ref_count =2
+               /* increments ref_count = 2 */
+               eventSourceId = g_io_add_watch(channel, (GIOCondition)(G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL), &readSocket, NULL);
 
                MSG_DEBUG("Call g_io_add_watch() : %d", eventSourceId);
        }
@@ -181,16 +165,14 @@ void MsgProxyListener::stop()
 {
        MSG_BEGIN();
 
-       if (running > 1)
-       {
+       if (running > 1) {
                running--;
                MSG_DEBUG("There are still running Listener. [%d] left.", running);
-       }
-       else if (running == 1)
-       {
+       } else if (running == 1) {
                running--;
 
-               g_io_channel_unref(channel); // decrements ref_count = 1
+               /* decrements ref_count = 1 */
+               g_io_channel_unref(channel);
 
                g_source_remove(eventSourceId);
 
@@ -203,21 +185,26 @@ void MsgProxyListener::stop()
 }
 
 
-bool MsgProxyListener::regSentStatusEventCB(MsgHandle* pMsgHandle, msg_sent_status_cb pfSentStatus, void *pUserParam)
+bool MsgProxyListener::regSentStatusEventCB(MsgHandle* pMsgHandle, int fd, msg_sent_status_cb pfSentStatus, void *pUserParam)
 {
        MutexLocker lock(mx);
 
        std::list<MSG_SENT_STATUS_CB_ITEM_S>::iterator it = sentStatusCBList.begin();
 
-       for (; it != sentStatusCBList.end(); it++)
-       {
+       for (; it != sentStatusCBList.end(); it++) {
                if (it->hAddr == pMsgHandle && it->pfSentStatusCB == pfSentStatus) {
-                       MSG_DEBUG("msg_sent_status_cb() callback : [%p] is already registered!!!", pfSentStatus);
-                       return false;
+                       if (it->fd == fd) {
+                               MSG_DEBUG("msg_sent_status_cb() callback : [%p] is already registered!!!", pfSentStatus);
+                               return false;
+                       } else {
+                               MSG_DEBUG("callback is registered by restarting server");
+                               it->fd = fd;
+                               return true;
+                       }
                }
        }
 
-       MSG_SENT_STATUS_CB_ITEM_S sentStatusCB = {pMsgHandle, pfSentStatus, pUserParam};
+       MSG_SENT_STATUS_CB_ITEM_S sentStatusCB = {pMsgHandle, fd, pfSentStatus, pUserParam};
 
        sentStatusCBList.push_back(sentStatusCB);
 
@@ -225,21 +212,26 @@ bool MsgProxyListener::regSentStatusEventCB(MsgHandle* pMsgHandle, msg_sent_stat
 }
 
 
-bool MsgProxyListener::regMessageIncomingEventCB(MsgHandle* pMsgHandle, msg_sms_incoming_cb pfNewMessage, int port, void *pUserParam)
+bool MsgProxyListener::regMessageIncomingEventCB(MsgHandle* pMsgHandle, int fd, msg_sms_incoming_cb pfNewMessage, int port, void *pUserParam)
 {
        MutexLocker lock(mx);
 
        std::list<MSG_INCOMING_CB_ITEM_S>::iterator it = newMessageCBList.begin();
 
-       for (; it != newMessageCBList.end(); it++)
-       {
+       for (; it != newMessageCBList.end(); it++) {
                if (it->hAddr == pMsgHandle && it->port == port && it->pfIncomingCB == pfNewMessage) {
-                       MSG_DEBUG("msg_sms_incoming_cb() callback : Port Number [%d] is already registered!!!", port);
-                       return false;
+                       if (it->fd == fd) {
+                               MSG_DEBUG("msg_sms_incoming_cb() callback : Port Number [%d] is already registered!!!", port);
+                               return false;
+                       } else {
+                               MSG_DEBUG("callback is registered by restarting server");
+                               it->fd = fd;
+                               return true;
+                       }
                }
        }
 
-       MSG_INCOMING_CB_ITEM_S incomingCB = {pMsgHandle, pfNewMessage, port, pUserParam};
+       MSG_INCOMING_CB_ITEM_S incomingCB = {pMsgHandle, fd, pfNewMessage, port, pUserParam};
 
        newMessageCBList.push_back(incomingCB);
 
@@ -247,27 +239,31 @@ bool MsgProxyListener::regMessageIncomingEventCB(MsgHandle* pMsgHandle, msg_sms_
 }
 
 
-bool MsgProxyListener::regMMSConfMessageIncomingEventCB(MsgHandle* pMsgHandle, msg_mms_conf_msg_incoming_cb pfNewMMSConfMessage, const char *pAppId, void *pUserParam)
+bool MsgProxyListener::regMMSConfMessageIncomingEventCB(MsgHandle* pMsgHandle, int fd, msg_mms_conf_msg_incoming_cb pfNewMMSConfMessage, const char *pAppId, void *pUserParam)
 {
        MutexLocker lock(mx);
 
        std::list<MSG_MMS_CONF_INCOMING_CB_ITEM_S>::iterator it = newMMSConfMessageCBList.begin();
 
-       for (; it != newMMSConfMessageCBList.end(); it++)
-       {
+       for (; it != newMMSConfMessageCBList.end(); it++) {
                if (it->hAddr == pMsgHandle && it->pfMMSConfIncomingCB == pfNewMMSConfMessage) {
-
-                       if(pAppId == NULL) {
-                               MSG_DEBUG("msg_mms_conf_msg_incoming_cb() callback is already registered!!!");
-                               return false;
-                       } else if(!strncmp(it->appId, pAppId, MAX_MMS_JAVA_APPID_LEN)) {
-                               MSG_DEBUG("msg_mms_conf_msg_incoming_cb() callback : AppId [%s] is already registered!!!", pAppId);
-                               return false;
+                       if (it->fd == fd) {
+                               if (pAppId == NULL) {
+                                       MSG_DEBUG("msg_mms_conf_msg_incoming_cb() callback is already registered!!!");
+                                       return false;
+                               } else if (!strncmp(it->appId, pAppId, MAX_MMS_JAVA_APPID_LEN)) {
+                                       MSG_DEBUG("msg_mms_conf_msg_incoming_cb() callback : AppId [%s] is already registered!!!", pAppId);
+                                       return false;
+                               }
+                       } else {
+                               MSG_DEBUG("callback is registered by restarting server");
+                               it->fd = fd;
+                               return true;
                        }
                }
        }
 
-       MSG_MMS_CONF_INCOMING_CB_ITEM_S incomingConfCB = {pMsgHandle, pfNewMMSConfMessage, {0}, pUserParam};
+       MSG_MMS_CONF_INCOMING_CB_ITEM_S incomingConfCB = {pMsgHandle, fd, pfNewMMSConfMessage, {0}, pUserParam};
 
        if (pAppId != NULL)
                strncpy(incomingConfCB.appId, pAppId, MAX_MMS_JAVA_APPID_LEN);
@@ -278,27 +274,31 @@ bool MsgProxyListener::regMMSConfMessageIncomingEventCB(MsgHandle* pMsgHandle, m
 }
 
 
-bool MsgProxyListener::regPushMessageIncomingEventCB(MsgHandle* pMsgHandle, msg_push_msg_incoming_cb pfNewPushMessage, const char *pAppId, void *pUserParam)
+bool MsgProxyListener::regPushMessageIncomingEventCB(MsgHandle* pMsgHandle, int fd, msg_push_msg_incoming_cb pfNewPushMessage, const char *pAppId, void *pUserParam)
 {
        MutexLocker lock(mx);
 
        std::list<MSG_PUSH_INCOMING_CB_ITEM_S>::iterator it = newPushMessageCBList.begin();
 
-       for (; it != newPushMessageCBList.end(); it++)
-       {
+       for (; it != newPushMessageCBList.end(); it++) {
                if (it->hAddr == pMsgHandle && it->pfPushIncomingCB == pfNewPushMessage) {
-
-                       if(pAppId == NULL) {
-                               MSG_DEBUG("msg_push_msg_incoming_cb() callback is already registered!!!");
-                               return false;
-                       } else if(!strncmp(it->appId, pAppId, MAX_WAPPUSH_ID_LEN)) {
-                               MSG_DEBUG("msg_push_msg_incoming_cb() callback : AppId [%s] is already registered!!!", pAppId);
-                               return false;
+                       if (it->fd == fd) {
+                               if (pAppId == NULL) {
+                                       MSG_DEBUG("msg_push_msg_incoming_cb() callback is already registered!!!");
+                                       return false;
+                               } else if (!strncmp(it->appId, pAppId, MAX_WAPPUSH_ID_LEN)) {
+                                       MSG_DEBUG("msg_push_msg_incoming_cb() callback : AppId [%s] is already registered!!!", pAppId);
+                                       return false;
+                               }
+                       } else {
+                               MSG_DEBUG("callback is registered by restarting server");
+                               it->fd = fd;
+                               return true;
                        }
                }
        }
 
-       MSG_PUSH_INCOMING_CB_ITEM_S incomingPushCB = {pMsgHandle, pfNewPushMessage, {0}, pUserParam};
+       MSG_PUSH_INCOMING_CB_ITEM_S incomingPushCB = {pMsgHandle, fd, pfNewPushMessage, {0}, pUserParam};
 
        if (pAppId != NULL)
                strncpy(incomingPushCB.appId, pAppId, MAX_WAPPUSH_ID_LEN);
@@ -308,23 +308,30 @@ bool MsgProxyListener::regPushMessageIncomingEventCB(MsgHandle* pMsgHandle, msg_
        return true;
 }
 
-bool MsgProxyListener::regCBMessageIncomingEventCB(MsgHandle* pMsgHandle, msg_cb_incoming_cb pfNewCBMessage, bool bSave, void *pUserParam)
+
+bool MsgProxyListener::regCBMessageIncomingEventCB(MsgHandle* pMsgHandle, int fd, msg_cb_incoming_cb pfNewCBMessage, bool bSave, void *pUserParam)
 {
        MutexLocker lock(mx);
 
        std::list<MSG_CB_INCOMING_CB_ITEM_S>::iterator it = newCBMessageCBList.begin();
 
-       for (; it != newCBMessageCBList.end(); it++)
-       {
+       for (; it != newCBMessageCBList.end(); it++) {
                if (it->hAddr == pMsgHandle && it->pfCBIncomingCB == pfNewCBMessage) {
-                       MSG_DEBUG("msg_CB_incoming_cb() callback : [%p] is already registered!!!", pfNewCBMessage);
-                        it->bsave = bSave;
-                        it->userParam = pUserParam;
-                       return false;
+                       if (it->fd == fd) {
+                               MSG_DEBUG("msg_CB_incoming_cb() callback : [%p] is already registered!!!", pfNewCBMessage);
+                                it->bsave = bSave;
+                                it->userParam = pUserParam;
+                               return false;
+                       } else {
+                               MSG_DEBUG("callback is registered by restarting server");
+                               it->fd = fd;
+                               return true;
+                       }
+
                }
        }
 
-       MSG_CB_INCOMING_CB_ITEM_S incomingCB = {pMsgHandle, pfNewCBMessage, bSave, pUserParam};
+       MSG_CB_INCOMING_CB_ITEM_S incomingCB = {pMsgHandle, fd, pfNewCBMessage, bSave, pUserParam};
 
        newCBMessageCBList.push_back(incomingCB);
 
@@ -332,22 +339,27 @@ bool MsgProxyListener::regCBMessageIncomingEventCB(MsgHandle* pMsgHandle, msg_cb
 }
 
 
-bool MsgProxyListener::regReportMsgIncomingCB(MsgHandle* pMsgHandle, msg_report_msg_incoming_cb pfReportMessage, void *pUserParam)
+bool MsgProxyListener::regReportMsgIncomingCB(MsgHandle* pMsgHandle, int fd, msg_report_msg_incoming_cb pfReportMessage, void *pUserParam)
 {
        MutexLocker lock(mx);
 
        std::list<MSG_REPORT_INCOMING_CB_ITEM_S>::iterator it = reportMessageCBList.begin();
 
-       for (; it != reportMessageCBList.end(); it++)
-       {
+       for (; it != reportMessageCBList.end(); it++) {
                if (it->hAddr == pMsgHandle && it->pfReportMsgIncomingCB == pfReportMessage) {
-                       MSG_DEBUG("msg_report_msg_incoming_cb() callback : [%p] is already registered!!!", pfReportMessage);
-                        it->userParam = pUserParam;
-                       return false;
+                       if (it->fd == fd) {
+                               MSG_DEBUG("msg_report_msg_incoming_cb() callback : [%p] is already registered!!!", pfReportMessage);
+                                it->userParam = pUserParam;
+                               return false;
+                       } else {
+                               MSG_DEBUG("callback is registered by restarting server");
+                               it->fd = fd;
+                               return true;
+                       }
                }
        }
 
-       MSG_REPORT_INCOMING_CB_ITEM_S incomingCB = {pMsgHandle, pfReportMessage, pUserParam};
+       MSG_REPORT_INCOMING_CB_ITEM_S incomingCB = {pMsgHandle, fd, pfReportMessage, pUserParam};
 
        reportMessageCBList.push_back(incomingCB);
 
@@ -355,21 +367,26 @@ bool MsgProxyListener::regReportMsgIncomingCB(MsgHandle* pMsgHandle, msg_report_
 }
 
 
-bool MsgProxyListener::regSyncMLMessageIncomingEventCB(MsgHandle* pMsgHandle, msg_syncml_msg_incoming_cb pfNewSyncMLMessage, void *pUserParam)
+bool MsgProxyListener::regSyncMLMessageIncomingEventCB(MsgHandle* pMsgHandle, int fd, msg_syncml_msg_incoming_cb pfNewSyncMLMessage, void *pUserParam)
 {
        MutexLocker lock(mx);
 
        std::list<MSG_SYNCML_INCOMING_CB_ITEM_S>::iterator it = newSyncMLMessageCBList.begin();
 
-       for (; it != newSyncMLMessageCBList.end(); it++)
-       {
+       for (; it != newSyncMLMessageCBList.end(); it++) {
                if (it->hAddr == pMsgHandle && it->pfSyncMLIncomingCB == pfNewSyncMLMessage) {
-                       MSG_DEBUG("msg_syncml_msg_incoming_cb() callback : [%p] is already registered!!!", pfNewSyncMLMessage);
-                       return false;
+                       if (it->fd == fd) {
+                               MSG_DEBUG("msg_syncml_msg_incoming_cb() callback : [%p] is already registered!!!", pfNewSyncMLMessage);
+                               return false;
+                       } else {
+                               MSG_DEBUG("callback is registered by restarting server");
+                               it->fd = fd;
+                               return true;
+                       }
                }
        }
 
-       MSG_SYNCML_INCOMING_CB_ITEM_S incomingCB = {pMsgHandle, pfNewSyncMLMessage, pUserParam};
+       MSG_SYNCML_INCOMING_CB_ITEM_S incomingCB = {pMsgHandle, fd, pfNewSyncMLMessage, pUserParam};
 
        newSyncMLMessageCBList.push_back(incomingCB);
 
@@ -377,21 +394,26 @@ bool MsgProxyListener::regSyncMLMessageIncomingEventCB(MsgHandle* pMsgHandle, ms
 }
 
 
-bool MsgProxyListener::regLBSMessageIncomingEventCB(MsgHandle* pMsgHandle, msg_lbs_msg_incoming_cb pfNewLBSMsgIncoming, void *pUserParam)
+bool MsgProxyListener::regLBSMessageIncomingEventCB(MsgHandle* pMsgHandle, int fd, msg_lbs_msg_incoming_cb pfNewLBSMsgIncoming, void *pUserParam)
 {
        MutexLocker lock(mx);
 
        std::list<MSG_LBS_INCOMING_CB_ITEM_S>::iterator it = newLBSMessageCBList.begin();
 
-       for (; it != newLBSMessageCBList.end(); it++)
-       {
+       for (; it != newLBSMessageCBList.end(); it++) {
                if (it->hAddr == pMsgHandle && it->pfLBSMsgIncoming == pfNewLBSMsgIncoming) {
-                       MSG_DEBUG("msg_lbs_msg_incoming_cb() callback : [%p] is already registered!!!", pfNewLBSMsgIncoming);
-                       return false;
+                       if (it->fd == fd) {
+                               MSG_DEBUG("msg_lbs_msg_incoming_cb() callback : [%p] is already registered!!!", pfNewLBSMsgIncoming);
+                               return false;
+                       } else {
+                               MSG_DEBUG("callback is registered by restarting server");
+                               it->fd = fd;
+                               return true;
+                       }
                }
        }
 
-       MSG_LBS_INCOMING_CB_ITEM_S incomingCB = {pMsgHandle, pfNewLBSMsgIncoming, pUserParam};
+       MSG_LBS_INCOMING_CB_ITEM_S incomingCB = {pMsgHandle, fd, pfNewLBSMsgIncoming, pUserParam};
 
        newLBSMessageCBList.push_back(incomingCB);
 
@@ -399,21 +421,26 @@ bool MsgProxyListener::regLBSMessageIncomingEventCB(MsgHandle* pMsgHandle, msg_l
 }
 
 
-bool MsgProxyListener::regSyncMLMessageOperationEventCB(MsgHandle* pMsgHandle, msg_syncml_msg_operation_cb pfSyncMLMessageOperation, void *pUserParam)
+bool MsgProxyListener::regSyncMLMessageOperationEventCB(MsgHandle* pMsgHandle, int fd, msg_syncml_msg_operation_cb pfSyncMLMessageOperation, void *pUserParam)
 {
        MutexLocker lock(mx);
 
        std::list<MSG_SYNCML_OPERATION_CB_ITEM_S>::iterator it = operationSyncMLMessageCBList.begin();
 
-       for (; it != operationSyncMLMessageCBList.end(); it++)
-       {
+       for (; it != operationSyncMLMessageCBList.end(); it++) {
                if (it->hAddr == pMsgHandle && it->pfSyncMLOperationCB == pfSyncMLMessageOperation) {
-                       MSG_DEBUG("msg_syncml_msg_incoming_cb() callback : [%p] is already registered!!!", pfSyncMLMessageOperation);
-                       return false;
+                       if (it->fd == fd) {
+                               MSG_DEBUG("msg_syncml_msg_incoming_cb() callback : [%p] is already registered!!!", pfSyncMLMessageOperation);
+                               return false;
+                       } else {
+                               MSG_DEBUG("callback is registered by restarting server");
+                               it->fd = fd;
+                               return true;
+                       }
                }
        }
 
-       MSG_SYNCML_OPERATION_CB_ITEM_S incomingCB = {pMsgHandle, pfSyncMLMessageOperation, pUserParam};
+       MSG_SYNCML_OPERATION_CB_ITEM_S incomingCB = {pMsgHandle, fd, pfSyncMLMessageOperation, pUserParam};
 
        operationSyncMLMessageCBList.push_back(incomingCB);
 
@@ -421,21 +448,26 @@ bool MsgProxyListener::regSyncMLMessageOperationEventCB(MsgHandle* pMsgHandle, m
 }
 
 
-bool MsgProxyListener::regStorageChangeEventCB(MsgHandle* pMsgHandle, msg_storage_change_cb pfStorageChangeOperation, void *pUserParam)
+bool MsgProxyListener::regStorageChangeEventCB(MsgHandle* pMsgHandle, int fd, msg_storage_change_cb pfStorageChangeOperation, void *pUserParam)
 {
        MutexLocker lock(mx);
 
        std::list<MSG_STORAGE_CHANGE_CB_ITEM_S>::iterator it = storageChangeCBList.begin();
 
-       for (; it != storageChangeCBList.end(); it++)
-       {
+       for (; it != storageChangeCBList.end(); it++) {
                if (it->hAddr == pMsgHandle && it->pfStorageChangeCB == pfStorageChangeOperation) {
-                       MSG_DEBUG("msg_storage_change_cb() callback : [%p] is already registered!!!", pfStorageChangeOperation);
-                       return false;
+                       if (it->fd == fd) {
+                               MSG_DEBUG("msg_storage_change_cb() callback : [%p] is already registered!!!", pfStorageChangeOperation);
+                               return false;
+                       } else {
+                               MSG_DEBUG("callback is registered by restarting server");
+                               it->fd = fd;
+                               return true;
+                       }
                }
        }
 
-       MSG_STORAGE_CHANGE_CB_ITEM_S changeCB = {pMsgHandle, pfStorageChangeOperation, pUserParam};
+       MSG_STORAGE_CHANGE_CB_ITEM_S changeCB = {pMsgHandle, fd, pfStorageChangeOperation, pUserParam};
 
        storageChangeCBList.push_back(changeCB);
 
@@ -449,159 +481,253 @@ void MsgProxyListener::clearListOfClosedHandle(MsgHandle* pMsgHandle)
 
        MutexLocker lock(mx);
 
-       // sent status CB list
+       /* sent status CB list */
        std::list<MSG_SENT_STATUS_CB_ITEM_S>::iterator it = sentStatusCBList.begin();
 
-       for (; it != sentStatusCBList.end(); )
-       {
-               if (it->hAddr == pMsgHandle)
-               {
+       for (; it != sentStatusCBList.end(); ) {
+               if (it->hAddr == pMsgHandle) {
                        sentStatusCBList.erase(it++);
 
-                       //Stop client Listener
+                       /* Stop client Listener */
                        stop();
-               }
-               else
+               } else {
                        ++it;
+               }
        }
 
-       // new message CB list
+       /* new message CB list */
        std::list<MSG_INCOMING_CB_ITEM_S>::iterator it2 = newMessageCBList.begin();
 
-       for (; it2 != newMessageCBList.end(); )
-       {
-               if (it2->hAddr == pMsgHandle)
-               {
+       for (; it2 != newMessageCBList.end(); ) {
+               if (it2->hAddr == pMsgHandle) {
                        newMessageCBList.erase(it2++);
 
-                       //Stop client Listener
+                       /* Stop client Listener */
                        stop();
-               }
-               else
+               } else {
                        ++it2;
+               }
        }
 
-       // MMS conf Message CB list
+       /* MMS conf Message CB list */
        std::list<MSG_MMS_CONF_INCOMING_CB_ITEM_S>::iterator it3 = newMMSConfMessageCBList.begin();
 
-       for (; it3 != newMMSConfMessageCBList.end(); )
-       {
-               if (it3->hAddr == pMsgHandle)
-               {
+       for (; it3 != newMMSConfMessageCBList.end(); ) {
+               if (it3->hAddr == pMsgHandle) {
                        newMMSConfMessageCBList.erase(it3++);
 
-                       //Stop client Listener
+                       /* Stop client Listener */
                        stop();
-               }
-               else
+               } else {
                        ++it3;
+               }
        }
 
-       // SyncML Message CB list
+       /* SyncML Message CB list */
        std::list<MSG_SYNCML_INCOMING_CB_ITEM_S>::iterator it4 = newSyncMLMessageCBList.begin();
 
-       for (; it4 != newSyncMLMessageCBList.end(); )
-       {
-               if (it4->hAddr == pMsgHandle)
-               {
+       for (; it4 != newSyncMLMessageCBList.end(); ) {
+               if (it4->hAddr == pMsgHandle) {
                        newSyncMLMessageCBList.erase(it4++);
 
-                       //Stop client Listener
+                       /* Stop client Listener */
                        stop();
-               }
-               else
+               } else {
                        ++it4;
+               }
        }
 
-       // LBS Message CB list
+       /* LBS Message CB list */
        std::list<MSG_LBS_INCOMING_CB_ITEM_S>::iterator it5 = newLBSMessageCBList.begin();
 
-       for (; it5 != newLBSMessageCBList.end(); )
-       {
-               if (it5->hAddr == pMsgHandle)
-               {
+       for (; it5 != newLBSMessageCBList.end(); ) {
+               if (it5->hAddr == pMsgHandle) {
                        newLBSMessageCBList.erase(it5++);
 
-                       //Stop client Listener
+                       /* Stop client Listener */
                        stop();
-               }
-               else
+               } else {
                        ++it5;
+               }
        }
 
-       // Push Message CB list
+       /* Push Message CB list */
        std::list<MSG_PUSH_INCOMING_CB_ITEM_S>::iterator it6 = newPushMessageCBList.begin();
 
-       for (; it6 != newPushMessageCBList.end(); )
-       {
-               if (it6->hAddr == pMsgHandle)
-               {
+       for (; it6 != newPushMessageCBList.end(); ) {
+               if (it6->hAddr == pMsgHandle) {
                        newPushMessageCBList.erase(it6++);
 
-                       //Stop client Listener
+                       /* Stop client Listener */
                        stop();
-               }
-               else
+               } else {
                        ++it6;
-
+               }
        }
 
-       // CB Message CB list
+       /* CB Message CB list */
        std::list<MSG_CB_INCOMING_CB_ITEM_S>::iterator it7 = newCBMessageCBList.begin();
 
-       for (; it7 != newCBMessageCBList.end(); )
-       {
-
-               if (it7->hAddr == pMsgHandle)
-               {
-
+       for (; it7 != newCBMessageCBList.end(); ) {
+               if (it7->hAddr == pMsgHandle) {
                        newCBMessageCBList.erase(it7++);
 
-                       //Stop client Listener
+                       /* Stop client Listener */
                        stop();
-               }
-               else
-               {
+               } else {
                        ++it7;
                }
        }
 
-       // Storage change Message CB list
+       /* Storage change Message CB list */
        std::list<MSG_STORAGE_CHANGE_CB_ITEM_S>::iterator it8 = storageChangeCBList.begin();
 
-       for (; it8 != storageChangeCBList.end(); )
-       {
-               if (it8->hAddr == pMsgHandle)
-               {
+       for (; it8 != storageChangeCBList.end(); ) {
+               if (it8->hAddr == pMsgHandle) {
                        storageChangeCBList.erase(it8++);
 
-                       //Stop client Listener
+                       /* Stop client Listener */
                        stop();
-               }
-               else
+               } else {
                        ++it8;
+               }
        }
 
 
-       // Report message incoming CB list
+       /* Report message incoming CB list */
        std::list<MSG_REPORT_INCOMING_CB_ITEM_S>::iterator it9 = reportMessageCBList.begin();
-       for (; it9 != reportMessageCBList.end(); )
-       {
-               if (it9->hAddr == pMsgHandle)
-               {
+       for (; it9 != reportMessageCBList.end(); ) {
+               if (it9->hAddr == pMsgHandle) {
                        reportMessageCBList.erase(it9++);
 
-                       //Stop client Listener
+                       /* Stop client Listener */
                        stop();
-               }
-               else
+               } else {
                        ++it9;
+               }
+       }
+
+
+       /* SyncML Message Operation CB list */
+       std::list<MSG_SYNCML_OPERATION_CB_ITEM_S>::iterator it10 = operationSyncMLMessageCBList.begin();
+       for (; it10 != operationSyncMLMessageCBList.end(); ) {
+               if (it10->hAddr == pMsgHandle) {
+                       operationSyncMLMessageCBList.erase(it10++);
+
+                       /* Stop client Listener */
+                       stop();
+               } else {
+                       ++it10;
+               }
+       }
+
+       /* Open Handle Set */
+       openHandleSet.erase(pMsgHandle);
+
+       MSG_END();
+}
+
+
+void MsgProxyListener::refreshListOfOpenedHandle(MsgHandle* pMsgHandle)
+{
+       MSG_BEGIN();
+
+       MutexLocker lock(mx);
+
+       /* sent status CB list */
+       std::list<MSG_SENT_STATUS_CB_ITEM_S>::iterator it = sentStatusCBList.begin();
+       for (; it != sentStatusCBList.end(); ++it) {
+               if (it->hAddr == pMsgHandle) {
+                       it->fd = CUSTOM_SOCKET_ERROR;
+                       pMsgHandle->regSentStatusCallback(it->pfSentStatusCB, it->userParam);
+               }
+       }
+
+       /* new message CB list */
+       std::list<MSG_INCOMING_CB_ITEM_S>::iterator it2 = newMessageCBList.begin();
+       for (; it2 != newMessageCBList.end(); ++it2) {
+               if (it2->hAddr == pMsgHandle) {
+                       it2->fd = CUSTOM_SOCKET_ERROR;
+                       pMsgHandle->regSmsMessageCallback(it2->pfIncomingCB, it2->port, it2->userParam);
+               }
+       }
+
+       /* MMS conf Message CB list */
+       std::list<MSG_MMS_CONF_INCOMING_CB_ITEM_S>::iterator it3 = newMMSConfMessageCBList.begin();
+       for (; it3 != newMMSConfMessageCBList.end(); ++it3) {
+               if (it3->hAddr == pMsgHandle) {
+                       it3->fd = CUSTOM_SOCKET_ERROR;
+                       pMsgHandle->regMmsConfMessageCallback(it3->pfMMSConfIncomingCB, it3->appId, it3->userParam);
+               }
+       }
+
+       /* SyncML Message CB list */
+       std::list<MSG_SYNCML_INCOMING_CB_ITEM_S>::iterator it4 = newSyncMLMessageCBList.begin();
+       for (; it4 != newSyncMLMessageCBList.end(); ++it4) {
+               if (it4->hAddr == pMsgHandle) {
+                       it4->fd = CUSTOM_SOCKET_ERROR;
+                       pMsgHandle->regSyncMLMessageCallback(it4->pfSyncMLIncomingCB, it4->userParam);
+               }
+       }
+
+       /* LBS Message CB list */
+       std::list<MSG_LBS_INCOMING_CB_ITEM_S>::iterator it5 = newLBSMessageCBList.begin();
+       for (; it5 != newLBSMessageCBList.end(); ++it5) {
+               if (it5->hAddr == pMsgHandle) {
+                       it5->fd = CUSTOM_SOCKET_ERROR;
+                       pMsgHandle->regLBSMessageCallback(it5->pfLBSMsgIncoming, it5->userParam);
+               }
+       }
+
+       /* Push Message CB list */
+       std::list<MSG_PUSH_INCOMING_CB_ITEM_S>::iterator it6 = newPushMessageCBList.begin();
+       for (; it6 != newPushMessageCBList.end(); ++it6) {
+               if (it6->hAddr == pMsgHandle) {
+                       it6->fd = CUSTOM_SOCKET_ERROR;
+                       pMsgHandle->regPushMessageCallback(it6->pfPushIncomingCB, it6->appId, it6->userParam);
+               }
        }
 
+       /* CB Message CB list */
+       std::list<MSG_CB_INCOMING_CB_ITEM_S>::iterator it7 = newCBMessageCBList.begin();
+       for (; it7 != newCBMessageCBList.end(); ++it7) {
+               if (it7->hAddr == pMsgHandle) {
+                       it7->fd = CUSTOM_SOCKET_ERROR;
+                       pMsgHandle->regCBMessageCallback(it7->pfCBIncomingCB, it7->bsave, it7->userParam);
+               }
+       }
+
+       /* Storage change Message CB list */
+       std::list<MSG_STORAGE_CHANGE_CB_ITEM_S>::iterator it8 = storageChangeCBList.begin();
+       for (; it8 != storageChangeCBList.end(); ++it8) {
+               if (it8->hAddr == pMsgHandle) {
+                       it8->fd = CUSTOM_SOCKET_ERROR;
+                       pMsgHandle->regStorageChangeCallback(it8->pfStorageChangeCB, it8->userParam);
+               }
+       }
+
+       /* Report message incoming CB list */
+       std::list<MSG_REPORT_INCOMING_CB_ITEM_S>::iterator it9 = reportMessageCBList.begin();
+       for (; it9 != reportMessageCBList.end(); ++it9) {
+               if (it9->hAddr == pMsgHandle) {
+                       it9->fd = CUSTOM_SOCKET_ERROR;
+                       pMsgHandle->regReportMessageCallback(it9->pfReportMsgIncomingCB, it9->userParam);
+               }
+       }
+
+       /* SyncML Message Operation CB list */
+       std::list<MSG_SYNCML_OPERATION_CB_ITEM_S>::iterator it10 = operationSyncMLMessageCBList.begin();
+       for (; it10 != operationSyncMLMessageCBList.end(); ++it10) {
+               if (it10->hAddr == pMsgHandle) {
+                       it10->fd = CUSTOM_SOCKET_ERROR;
+                       pMsgHandle->regSyncMLMessageOperationCallback(it10->pfSyncMLOperationCB, it10->userParam);
+               }
+       }
 
        MSG_END();
 }
 
+
 void MsgProxyListener::handleEvent(const MSG_EVENT_S* pMsgEvent)
 {
        MSG_BEGIN();
@@ -609,9 +735,8 @@ void MsgProxyListener::handleEvent(const MSG_EVENT_S* pMsgEvent)
        if (!pMsgEvent)
                THROW(MsgException::INVALID_PARAM, "pMsgEvent is NULL");
 
-       if (pMsgEvent->eventType == MSG_EVENT_PLG_SENT_STATUS_CNF)
-       {
-               unsigned int chInfo[3] = {0}; //3// reqid, status, object
+       if (pMsgEvent->eventType == MSG_EVENT_PLG_SENT_STATUS_CNF) {
+               unsigned int chInfo[3] = {0}; /*3 reqid, status, object */
 
                memcpy(&chInfo, (void*)((char*)pMsgEvent+sizeof(MSG_EVENT_TYPE_T)+sizeof(msg_error_t)), sizeof(chInfo));
 
@@ -625,8 +750,7 @@ void MsgProxyListener::handleEvent(const MSG_EVENT_S* pMsgEvent)
 
                MsgSentStatusCBList::iterator it = sentStatusCBList.begin();
 
-               for( ; it != sentStatusCBList.end() ; it++)
-               {
+               for ( ; it != sentStatusCBList.end() ; it++) {
                        MsgHandle* pHandle = it->hAddr;
 
                        msg_sent_status_cb pfunc = it->pfSentStatusCB;
@@ -637,9 +761,7 @@ void MsgProxyListener::handleEvent(const MSG_EVENT_S* pMsgEvent)
                }
 
                mx.unlock();
-       }
-       else if ( pMsgEvent->eventType == MSG_EVENT_PLG_INCOMING_MSG_IND )
-       {
+       } else if ( pMsgEvent->eventType == MSG_EVENT_PLG_INCOMING_MSG_IND ) {
                MSG_MESSAGE_INFO_S msgInfo;
                memset(&msgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S));
 
@@ -655,10 +777,8 @@ void MsgProxyListener::handleEvent(const MSG_EVENT_S* pMsgEvent)
                MsgNewMessageCBList::iterator it = newMessageCBList.begin();
                MsgNewMessageCBList matchList;
 
-               for( ; it != newMessageCBList.end() ; it++)
-               {
-                       if( portKey == it->port)
-                       {
+               for ( ; it != newMessageCBList.end() ; it++) {
+                       if ( portKey == it->port) {
                                matchList.push_back(*it);
                        }
                }
@@ -667,8 +787,7 @@ void MsgProxyListener::handleEvent(const MSG_EVENT_S* pMsgEvent)
 
                it = matchList.begin();
 
-               for( ; it != matchList.end(); it++ )
-               {
+               for ( ; it != matchList.end(); it++ ) {
                        MsgHandle* pHandle = it->hAddr;
 
                        MSG_MESSAGE_HIDDEN_S msgHidden = {0,};
@@ -681,6 +800,8 @@ void MsgProxyListener::handleEvent(const MSG_EVENT_S* pMsgEvent)
 
                        addr_list->nCount = 0;
                        addr_list->msg_struct_info = (msg_struct_t *)calloc(MAX_TO_ADDRESS_CNT, sizeof(MSG_ADDRESS_INFO_S *));
+                       if (addr_list->msg_struct_info == NULL)
+                               continue;
 
                        msg_struct_s *pTmp = NULL;
 
@@ -717,10 +838,9 @@ void MsgProxyListener::handleEvent(const MSG_EVENT_S* pMsgEvent)
                        if (msgHidden.pMmsData != NULL)
                                delete [] (char*)msgHidden.pMmsData;
 
-                       // address Memory Free
-                       if (msgHidden.addr_list!= NULL)
-                       {
-                               for(int i=0; i<MAX_TO_ADDRESS_CNT; i++) {
+                       /* address Memory Free */
+                       if (msgHidden.addr_list!= NULL) {
+                               for (int i=0; i<MAX_TO_ADDRESS_CNT; i++) {
                                        msg_struct_s * addrInfo = (msg_struct_s *)msgHidden.addr_list->msg_struct_info[i];
                                        delete (MSG_ADDRESS_INFO_S *)addrInfo->data;
                                        addrInfo->data = NULL;
@@ -736,9 +856,7 @@ void MsgProxyListener::handleEvent(const MSG_EVENT_S* pMsgEvent)
 
                }
 
-       }
-       else if ( pMsgEvent->eventType == MSG_EVENT_PLG_INCOMING_MMS_CONF )
-       {
+       } else if ( pMsgEvent->eventType == MSG_EVENT_PLG_INCOMING_MMS_CONF ) {
                MSG_MESSAGE_INFO_S msgInfo;
                memset(&msgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S));
 
@@ -757,25 +875,22 @@ void MsgProxyListener::handleEvent(const MSG_EVENT_S* pMsgEvent)
                MsgNewMMSConfMessageCBList::iterator it = newMMSConfMessageCBList.begin();
                MsgNewMMSConfMessageCBList matchList;
 
-               for( ; it != newMMSConfMessageCBList.end() ; it++)
-               {
-                       if(appIdKey)
-                       {
-                               if(!strcmp(appIdKey, it->appId))
+               for ( ; it != newMMSConfMessageCBList.end() ; it++) {
+                       if (appIdKey) {
+                               if (!strcmp(appIdKey, it->appId))
                                        matchList.push_back(*it);
-                       }
-                       else//(appIdKey == NULL && it->appId[0] == 0)
-                       {
-                               if(it->appId[0] == 0)
+                       } else {
+                               /* (appIdKey == NULL && it->appId[0] == 0) */
+                               if (it->appId[0] == 0)
                                        matchList.push_back(*it);
                        }
                }
 
                mx.unlock();
 
-               // Contents of msgData removed and replaced to retrievedFilePath for convertMsgStruct
-               // it is moved from UpdateMessage in MmsPluginStorage.cpp
-               char tempFileName[MSG_FILENAME_LEN_MAX+1] = {0};  // check MSG_FILENAME_LEN_MAX
+               /* Contents of msgData removed and replaced to retrievedFilePath for convertMsgStruct */
+               /* it is moved from UpdateMessage in MmsPluginStorage.cpp */
+               char tempFileName[MSG_FILENAME_LEN_MAX+1] = {0}; /* check MSG_FILENAME_LEN_MAX */
 
                strncpy(tempFileName, pMmsRecvData->retrievedFilePath, MSG_FILENAME_LEN_MAX);
 
@@ -784,8 +899,7 @@ void MsgProxyListener::handleEvent(const MSG_EVENT_S* pMsgEvent)
 
                it = matchList.begin();
 
-               for( ; it != matchList.end() ; it++)
-               {
+               for ( ; it != matchList.end() ; it++) {
                        MsgHandle* pHandle = it->hAddr;
 
                        MSG_MESSAGE_HIDDEN_S msgHidden = {0,};
@@ -798,6 +912,8 @@ void MsgProxyListener::handleEvent(const MSG_EVENT_S* pMsgEvent)
 
                        addr_list->nCount = 0;
                        addr_list->msg_struct_info = (msg_struct_t *)calloc(MAX_TO_ADDRESS_CNT, sizeof(MSG_ADDRESS_INFO_S *));
+                       if (addr_list->msg_struct_info == NULL)
+                               continue;
 
                        msg_struct_s *pTmp = NULL;
 
@@ -833,10 +949,9 @@ void MsgProxyListener::handleEvent(const MSG_EVENT_S* pMsgEvent)
                        if (msgHidden.pMmsData != NULL)
                                delete [] (char*)msgHidden.pMmsData;
 
-                       // address Memory Free
-                       if (msgHidden.addr_list!= NULL)
-                       {
-                               for(int i=0; i<MAX_TO_ADDRESS_CNT; i++) {
+                       /* address Memory Free */
+                       if (msgHidden.addr_list != NULL) {
+                               for (int i=0; i<MAX_TO_ADDRESS_CNT; i++) {
                                        msg_struct_s * addrInfo = (msg_struct_s *)msgHidden.addr_list->msg_struct_info[i];
                                        delete (MSG_ADDRESS_INFO_S *)addrInfo->data;
                                        addrInfo->data = NULL;
@@ -850,17 +965,14 @@ void MsgProxyListener::handleEvent(const MSG_EVENT_S* pMsgEvent)
                                msgHidden.addr_list = NULL;
                        }
 
-                       // Here the retrieved message will be deleted from native storage.
-                       // as of now, msg which have appId is considered as JAVA MMS message and it will be sent and handled in JAVA app.
-                       if(appIdKey)
-                       {
+                       /* Here the retrieved message will be deleted from native storage. */
+                       /* as of now, msg which have appId is considered as JAVA MMS message and it will be sent and handled in JAVA app. */
+                       if (appIdKey) {
                                MSG_DEBUG("delete received JAVA MMS message:%s from native storage",tempFileName);
                                pHandle->deleteMessage(msgInfo.msgId);
                        }
                }
-       }
-       else if ( pMsgEvent->eventType == MSG_EVENT_PLG_INCOMING_SYNCML_MSG_IND )
-       {
+       } else if ( pMsgEvent->eventType == MSG_EVENT_PLG_INCOMING_SYNCML_MSG_IND ) {
                MSG_SYNCML_MESSAGE_DATA_S* pSyncMLData = (MSG_SYNCML_MESSAGE_DATA_S *)pMsgEvent->data;
 
                MSG_DEBUG("msgType [%d]", pSyncMLData->syncmlType);
@@ -869,8 +981,7 @@ void MsgProxyListener::handleEvent(const MSG_EVENT_S* pMsgEvent)
 
                MsgNewSyncMLMessageCBList::iterator it = newSyncMLMessageCBList.begin();
 
-               for( ; it != newSyncMLMessageCBList.end() ; it++)
-               {
+               for ( ; it != newSyncMLMessageCBList.end() ; it++) {
                        MsgHandle* pHandle = it->hAddr;
 
                        msg_syncml_msg_incoming_cb pfunc = it->pfSyncMLIncomingCB;
@@ -881,17 +992,14 @@ void MsgProxyListener::handleEvent(const MSG_EVENT_S* pMsgEvent)
                }
 
                mx.unlock();
-       }
-       else if ( pMsgEvent->eventType == MSG_EVENT_PLG_INCOMING_LBS_MSG_IND )
-       {
+       } else if ( pMsgEvent->eventType == MSG_EVENT_PLG_INCOMING_LBS_MSG_IND ) {
                MSG_LBS_MESSAGE_DATA_S* pLBSData = (MSG_LBS_MESSAGE_DATA_S *)pMsgEvent->data;
 
                mx.lock();
 
                MsgNewLBSMessageCBList::iterator it = newLBSMessageCBList.begin();
 
-               for( ; it != newLBSMessageCBList.end() ; it++)
-               {
+               for ( ; it != newLBSMessageCBList.end() ; it++) {
                        MsgHandle* pHandle = it->hAddr;
 
                        msg_lbs_msg_incoming_cb pfunc = it->pfLBSMsgIncoming;
@@ -902,9 +1010,7 @@ void MsgProxyListener::handleEvent(const MSG_EVENT_S* pMsgEvent)
                }
 
                mx.unlock();
-       }
-       else if ( pMsgEvent->eventType == MSG_EVENT_SYNCML_OPERATION )
-       {
+       } else if ( pMsgEvent->eventType == MSG_EVENT_SYNCML_OPERATION ) {
                int msgId;
                int extId;
 
@@ -918,8 +1024,7 @@ void MsgProxyListener::handleEvent(const MSG_EVENT_S* pMsgEvent)
 
                MsgOperationSyncMLMessageCBList::iterator it = operationSyncMLMessageCBList.begin();
 
-               for( ; it != operationSyncMLMessageCBList.end() ; it++)
-               {
+               for ( ; it != operationSyncMLMessageCBList.end() ; it++) {
                        MsgHandle* pHandle = it->hAddr;
 
                        msg_syncml_msg_operation_cb pfunc = it->pfSyncMLOperationCB;
@@ -930,18 +1035,16 @@ void MsgProxyListener::handleEvent(const MSG_EVENT_S* pMsgEvent)
                }
 
                mx.unlock();
-       }
-       else if (pMsgEvent->eventType == MSG_EVENT_PLG_STORAGE_CHANGE_IND)
-       {
+       } else if (pMsgEvent->eventType == MSG_EVENT_PLG_STORAGE_CHANGE_IND) {
                msg_storage_change_type_t storageChangeType;
                msg_id_list_s msgIdList;
                memset(&msgIdList, 0x00, sizeof(msg_id_list_s));
 
-               // Decode event data
+               /* Decode event data */
                memcpy(&storageChangeType, (void*)((char*)pMsgEvent+sizeof(MSG_EVENT_TYPE_T)+sizeof(msg_error_t)), sizeof(msg_storage_change_type_t));
                memcpy(&msgIdList.nCount, (void*)((char*)pMsgEvent+sizeof(MSG_EVENT_TYPE_T)+sizeof(msg_error_t)+sizeof(msg_storage_change_type_t)), sizeof(int));
 
-               if(msgIdList.nCount > 0)
+               if (msgIdList.nCount > 0)
                        msgIdList.msgIdList = (msg_message_id_t*)((char*)pMsgEvent+sizeof(MSG_EVENT_TYPE_T)+sizeof(msg_error_t)+sizeof(msg_storage_change_type_t)+sizeof(int));
                else
                        msgIdList.msgIdList = NULL;
@@ -952,8 +1055,7 @@ void MsgProxyListener::handleEvent(const MSG_EVENT_S* pMsgEvent)
 
                MsgStorageChangeCBList::iterator it = storageChangeCBList.begin();
 
-               for( ; it != storageChangeCBList.end() ; it++)
-               {
+               for ( ; it != storageChangeCBList.end() ; it++) {
                        MsgHandle* pHandle = it->hAddr;
 
                        msg_storage_change_cb pfunc = it->pfStorageChangeCB;
@@ -964,18 +1066,14 @@ void MsgProxyListener::handleEvent(const MSG_EVENT_S* pMsgEvent)
                }
 
                mx.unlock();
-       }
-
-       else if (pMsgEvent->eventType == MSG_EVENT_PLG_INCOMING_CB_MSG_IND)
-       {
+       } else if (pMsgEvent->eventType == MSG_EVENT_PLG_INCOMING_CB_MSG_IND) {
                MSG_CB_MSG_S *pCbMsg = (MSG_CB_MSG_S *)pMsgEvent->data;
 
                mx.lock();
 
                MsgNewCBMessageCBList::iterator it = newCBMessageCBList.begin();
 
-               for( ; it != newCBMessageCBList.end() ; it++)
-               {
+               for ( ; it != newCBMessageCBList.end() ; it++) {
                        MsgHandle* pHandle = it->hAddr;
                        msg_struct_s msg = {0,};
 
@@ -990,39 +1088,32 @@ void MsgProxyListener::handleEvent(const MSG_EVENT_S* pMsgEvent)
                }
 
                mx.unlock();
-       }
-
-       else if ( pMsgEvent->eventType == MSG_EVENT_PLG_INCOMING_PUSH_MSG_IND )
-       {
+       } else if ( pMsgEvent->eventType == MSG_EVENT_PLG_INCOMING_PUSH_MSG_IND ) {
                MSG_PUSH_MESSAGE_DATA_S* pPushData = (MSG_PUSH_MESSAGE_DATA_S *)pMsgEvent->data;
 
                mx.lock();
 
                MsgNewPushMessageCBList::iterator it = newPushMessageCBList.begin();
 
-               for( ; it != newPushMessageCBList.end() ; it++)
-               {
+               for ( ; it != newPushMessageCBList.end() ; it++) {
                        MsgHandle* pHandle = it->hAddr;
 
                        msg_push_msg_incoming_cb pfunc = it->pfPushIncomingCB;
 
                        void* param = it->userParam;
 
-                       if(!strncmp(it->appId, pPushData->pushAppId, MAX_WAPPUSH_ID_LEN))
+                       if (!strncmp(it->appId, pPushData->pushAppId, MAX_WAPPUSH_ID_LEN))
                                pfunc((msg_handle_t)pHandle, pPushData->pushHeader, pPushData->pushBody, pPushData->pushBodyLen, param);
                }
 
                mx.unlock();
-       }
-
-       else if (pMsgEvent->eventType == MSG_EVENT_PLG_REPORT_MSG_INCOMING_IND)
-       {
+       } else if (pMsgEvent->eventType == MSG_EVENT_PLG_REPORT_MSG_INCOMING_IND) {
                msg_report_type_t reportType;
                msg_message_id_t msgId;
                int addr_len;
                char *addr_val;
 
-               // Decode event data
+               /* Decode event data */
                memcpy(&reportType, (void*)((char*)pMsgEvent+sizeof(MSG_EVENT_TYPE_T)+sizeof(msg_error_t)), sizeof(msg_report_type_t));
                memcpy(&msgId, (void*)((char*)pMsgEvent+sizeof(MSG_EVENT_TYPE_T)+sizeof(msg_error_t)+sizeof(msg_report_type_t)), sizeof(msg_message_id_t));
                memcpy(&addr_len, (void*)((char*)pMsgEvent+sizeof(MSG_EVENT_TYPE_T)+sizeof(msg_error_t)+sizeof(msg_report_type_t)+sizeof(msg_message_id_t)), sizeof(int));
@@ -1035,8 +1126,7 @@ void MsgProxyListener::handleEvent(const MSG_EVENT_S* pMsgEvent)
 
                MsgReportMessageCBList::iterator it = reportMessageCBList.begin();
 
-               for( ; it != reportMessageCBList.end() ; it++)
-               {
+               for ( ; it != reportMessageCBList.end() ; it++) {
                        MsgHandle* pHandle = it->hAddr;
 
                        msg_report_msg_incoming_cb pfunc = it->pfReportMsgIncomingCB;
@@ -1056,7 +1146,7 @@ void MsgProxyListener::handleEvent(const MSG_EVENT_S* pMsgEvent)
 int  MsgProxyListener::getRemoteFd()
 {
        MSG_BEGIN();
-       //MutexLocker lock(mx);
+       /* MutexLocker lock(mx); */
 
        int tmpFd = -1;
        int ret = mx.timedlock();
@@ -1070,7 +1160,7 @@ int  MsgProxyListener::getRemoteFd()
 
        MSG_DEBUG("listener fd [%d]", tmpFd);
 
-       if( tmpFd == -1 ) {
+       if ( tmpFd == -1 ) {
                ret = cv.timedwait(mx.pMutex(),1);
        }
 
@@ -1094,19 +1184,80 @@ int MsgProxyListener::readFromSocket(char** buf, unsigned int* len)
        return cliSock.read(buf, len);
 }
 
+
 void MsgProxyListener::resetProxyListener()
 {
        MSG_BEGIN();
        MutexLocker lock(mx);
+
+       if (channel) {
+               g_io_channel_unref(channel);
+               channel = NULL;
+       }
+
+       if (eventSourceId > 0)
+               eventSourceId = 0;
+
+       running = 0;
+
+       cliSock.close();
+       MSG_DEBUG("client Listener reset.");
+       MSG_END();
+}
+
+
+void MsgProxyListener::refreshProxyListener()
+{
+       MSG_BEGIN();
+       MutexLocker lock(mx);
+
        handle_set::iterator it = openHandleSet.begin();
        for (; it != openHandleSet.end(); it++) {
                MsgHandle *handle = (MsgHandle *)*it;
-               clearListOfClosedHandle(handle);
+               handle->openHandle();
+               refreshListOfOpenedHandle(handle);
        }
-       openHandleSet.clear();
+
+       MSG_END();
+}
+
+
+void MsgProxyListener::clearProxyCBLists()
+{
+       sentStatusCBList.clear();
+       newMessageCBList.clear();
+       newMMSConfMessageCBList.clear();
+       newSyncMLMessageCBList.clear();
+       newLBSMessageCBList.clear();
+       newPushMessageCBList.clear();
+       newCBMessageCBList.clear();
+       newSyncMLMessageCBList.clear();
+       storageChangeCBList.clear();
+       reportMessageCBList.clear();
+}
+
+
+void MsgProxyListener::insertOpenHandleSet(MsgHandle* pMsgHandle)
+{
+       MSG_BEGIN();
+
+       MutexLocker lock(mx);
+
+       handle_set::iterator it = openHandleSet.find(pMsgHandle);
+       if (it == openHandleSet.end()) {
+               openHandleSet.insert(pMsgHandle);
+               MSG_DEBUG("New handle is added. current count = [%d]", openHandleSet.size());
+       }
+
        MSG_END();
 }
 
+
+void MsgProxyListener::clearOpenHandleSet()
+{
+       openHandleSet.clear();
+}
+
 #ifdef CHECK_SENT_STATUS_CALLBACK
 int MsgProxyListener::getSentStatusCbCnt()
 {
index 9e503d3..217e96a 100755 (executable)
@@ -8,13 +8,14 @@ IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
 ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
 MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")
 
-SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -O0 -g -Wall")
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -O2 -g -Wall")
 
 ##########################################################
 # Define Framework Utils
 ##########################################################
 
 SET(UTILS-SRCS
+       ${CMAKE_SOURCE_DIR}/utils/MsgCallStatusManager.cpp
        ${CMAKE_SOURCE_DIR}/utils/MsgDebug.cpp
        ${CMAKE_SOURCE_DIR}/utils/MsgException.cpp
        ${CMAKE_SOURCE_DIR}/utils/MsgUtilFunction.cpp
@@ -32,6 +33,7 @@ SET(UTILS-SRCS
        ${CMAKE_SOURCE_DIR}/utils/MsgJsonParser.cpp
        ${CMAKE_SOURCE_DIR}/utils/MsgSerialize.cpp
        ${CMAKE_SOURCE_DIR}/utils/MsgSmil.cpp
+       ${CMAKE_SOURCE_DIR}/utils/MsgZoneManager.cpp
 )
 
 INCLUDE_DIRECTORIES(
@@ -43,7 +45,12 @@ INCLUDE_DIRECTORIES(
 )
 
 INCLUDE(FindPkgConfig)
-pkg_check_modules(utils_pkgs REQUIRED glib-2.0 vconf db-util contacts-service2 dlog libxml-2.0 storage json-glib-1.0 capi-system-info)
+
+SET(PKG_MODULES glib-2.0 vconf db-util contacts-service2 dlog libxml-2.0 storage json-glib-1.0 capi-system-info)
+IF(_FEATURE_CONTAINER_ENABLE)
+SET(PKG_MODULES ${PKG_MODULES} vasum)
+ENDIF(_FEATURE_CONTAINER_ENABLE)
+pkg_check_modules(utils_pkgs REQUIRED ${PKG_MODULES})
 
 FOREACH(flag ${utils_pkgs_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
diff --git a/utils/MsgCallStatusManager.cpp b/utils/MsgCallStatusManager.cpp
new file mode 100644 (file)
index 0000000..253e992
--- /dev/null
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+#include "MsgCallStatusManager.h"
+#include "MsgDebug.h"
+
+GDBusConnection *call_status_gdbus_conn = NULL;
+GDBusProxy *call_status_gdbus_proxy = NULL;
+gint call_status_subs_id = 0;
+gint call_status = 0;
+
+static void call_status_change_received(GDBusConnection *connection, const gchar *sender_name,
+               const gchar *object_path, const gchar *interface_name, const gchar *signal_name,
+               GVariant *parameters, gpointer user_data)
+{
+       MSG_DEBUG("signal_name = [%s]", signal_name);
+
+       if (g_strcmp0(signal_name, CALL_MGR_MEMBER_NAME) == 0) {
+               g_variant_get(parameters, "(iis)", &call_status, NULL, NULL);
+               MSG_INFO("callStatus = [%d]", call_status);
+       }
+}
+
+void MsgInitCallStatusManager()
+{
+       MSG_BEGIN();
+
+       GError *error = NULL;
+
+       if (call_status_gdbus_conn) {
+               g_object_unref(call_status_gdbus_conn);
+               call_status_gdbus_conn = NULL;
+       }
+
+       call_status_gdbus_conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
+       if (error) {
+               MSG_FATAL("g_bus_get_sync() failed : %s", error->message);
+               g_error_free(error);
+               error = NULL;
+               goto _DBUS_ERROR;
+       }
+
+       if (call_status_gdbus_proxy) {
+               g_object_unref(call_status_gdbus_proxy);
+               call_status_gdbus_proxy = NULL;
+       }
+
+       call_status_gdbus_proxy = g_dbus_proxy_new_sync(call_status_gdbus_conn, G_DBUS_PROXY_FLAGS_NONE,
+                                                       NULL, CALL_MGR_BUS_NAME, CALL_MGR_PATH_NAME, CALL_MGR_INTERFACE_NAME, NULL, &error);
+       if (error) {
+               MSG_FATAL("g_dbus_proxy_new_sync() failed : %s", error->message);
+               g_error_free(error);
+               error = NULL;
+               goto _DBUS_ERROR;
+       }
+
+       call_status_subs_id = g_dbus_connection_signal_subscribe(call_status_gdbus_conn, NULL,
+                                                       CALL_MGR_INTERFACE_NAME, CALL_MGR_MEMBER_NAME, CALL_MGR_PATH_NAME,
+                                                       NULL, G_DBUS_SIGNAL_FLAGS_NONE,
+                                                       call_status_change_received, NULL, NULL);
+       MSG_END();
+       return;
+
+_DBUS_ERROR:
+       if (call_status_gdbus_conn) {
+               g_object_unref(call_status_gdbus_conn);
+               call_status_gdbus_conn = NULL;
+       }
+
+       if (call_status_gdbus_proxy) {
+               g_object_unref(call_status_gdbus_proxy);
+               call_status_gdbus_proxy = NULL;
+       }
+
+       MSG_END();
+       return;
+}
+
+void MsgDeInitCallStatusManager()
+{
+       if (call_status_subs_id) {
+               g_dbus_connection_signal_unsubscribe(call_status_gdbus_conn, call_status_subs_id);
+               call_status_subs_id = 0;
+       }
+
+       if (call_status_gdbus_conn) {
+               g_object_unref(call_status_gdbus_conn);
+               call_status_gdbus_conn = NULL;
+       }
+
+       if (call_status_gdbus_proxy) {
+               g_object_unref(call_status_gdbus_proxy);
+               call_status_gdbus_proxy = NULL;
+       }
+}
+
+int MsgGetCallStatus()
+{
+       /* call_status is defined in <call-manager.h> in callmgr_client package.
+        * typedef enum {
+        *  CM_CALL_STATUS_IDLE,
+        *  CM_CALL_STATUS_RINGING,
+        *  CM_CALL_STATUS_OFFHOOK,
+        *  CM_CALL_STATUS_MAX
+        * } cm_call_status_e;
+        */
+       return (int)call_status;
+}
index 00ec0c6..c488f6b 100755 (executable)
@@ -21,6 +21,7 @@
 #include "MsgUtilFile.h"
 #include "MsgGconfWrapper.h"
 #include "MsgContact.h"
+#include "MsgZoneManager.h"
 
 extern "C"
 {
@@ -34,11 +35,6 @@ __thread bool isContactSvcConnected = false;
 
 MsgDbHandler ContactDbHandle;
 
-MsgContactChangeCB cbFunction = NULL;
-
-#define CONTACT_CALLBACK_USER_DATA                             "contact"
-#define ADDRESSBOOK_CALLBACK_USER_DATA "addressbook"
-
 // phonenumber minimum match digit.
 #define PHONENUMBER_MIN_MATCH_DIGIT VCONFKEY_CONTACTS_SVC_PHONENUMBER_MIN_MATCH_DIGIT
 #define DEFAULT_MIN_MATCH_DIGIT 8
@@ -217,21 +213,6 @@ void normalizeNumber(const char *orig, char* dest, unsigned int destSize)
 }
 
 
-//static void MsgContactSvcCallback(const char *view_uri, void *user_data)
-//{
-//     MSG_DEBUG("MsgContactSvcCallback is called.");
-//     if (!strcmp(CONTACT_CALLBACK_USER_DATA, (const char*)user_data)) {
-//             MSG_DEBUG("Contact Data is Changed!!!");
-//             MsgSyncContact();
-//     } else if (!strcmp(ADDRESSBOOK_CALLBACK_USER_DATA, (const char*)user_data)) {
-//             MSG_DEBUG("Address Book Data is Changed!!!");
-//             MsgSyncAddressbook();
-//     }
-//
-//     if (ContactDbHandle.disconnect() != MSG_SUCCESS)
-//             MSG_DEBUG("DB Disconnect Fail");
-//}
-
 /*==================================================================================================
                                      FUNCTION IMPLEMENTATION
 ==================================================================================================*/
@@ -260,6 +241,8 @@ msg_error_t MsgOpenContactSvc()
 
 msg_error_t MsgCloseContactSvc()
 {
+       MsgZoneChange();
+
        int errCode = CONTACTS_ERROR_NONE;
 
        if (isContactSvcConnected) {
@@ -270,22 +253,19 @@ msg_error_t MsgCloseContactSvc()
                        isContactSvcConnected = false;
                } else {
                        MSG_DEBUG("Disconnect to Contact Service Fail [%d]", errCode);
+                       MsgZoneRevert();
                        return MSG_ERR_DB_DISCONNECT;
                }
        }
 
+       MsgZoneRevert();
+
        return MSG_SUCCESS;
 }
 
 
-msg_error_t MsgInitContactSvc(MsgContactChangeCB cb)
+msg_error_t MsgInitContactSvc()
 {
-//     msg_error_t err = MSG_SUCCESS;
-//     unsigned int retryCnt = 10;
-
-       if (cb != NULL)
-               cbFunction = cb;
-
        phonenumberMinMatchDigit = MsgSettingGetInt(PHONENUMBER_MIN_MATCH_DIGIT);
        MSG_DEBUG("phonenumberMinMatchDigit [%d]", phonenumberMinMatchDigit);
 
@@ -293,46 +273,6 @@ msg_error_t MsgInitContactSvc(MsgContactChangeCB cb)
                phonenumberMinMatchDigit = DEFAULT_MIN_MATCH_DIGIT;
        }
 
-#if 0
-       do {
-               if ((err = MsgOpenContactSvc()) != MSG_SUCCESS) {
-                       retryCnt--;
-                       MSG_DEBUG("MsgOpenContactSvc fail. Retry count left [%d]", retryCnt);
-                       usleep(100 * 1000);
-               }
-       } while (err != MSG_SUCCESS && retryCnt > 0);
-
-       if (!isContactSvcConnected) {
-               MSG_DEBUG("Contact Service Not Opened.");
-               return MSG_ERR_UNKNOWN;
-       }
-
-       // Sync contact first.
-       MsgSyncAddressbook();
-//     MsgSyncContact();
-
-       int errCode = CONTACTS_ERROR_NONE;
-
-       // Register callback function
-       errCode = contacts_db_add_changed_cb(_contacts_contact._uri, MsgContactSvcCallback, (void *)CONTACT_CALLBACK_USER_DATA);
-
-       if (errCode == CONTACTS_ERROR_NONE)
-               MSG_DEBUG("Register Contact Service Callback [_contacts_contact]");
-       else
-               MSG_DEBUG("Fail to Register Contact Service Callback [_contacts_contact] [%d]", errCode);
-
-       // Register callback function
-       errCode = contacts_db_add_changed_cb(_contacts_address_book._uri, MsgContactSvcCallback, (void *)ADDRESSBOOK_CALLBACK_USER_DATA);
-
-       if (errCode == CONTACTS_ERROR_NONE)
-               MSG_DEBUG("Register Contact Service Callback [_contacts_address_book]");
-       else
-               MSG_DEBUG("Fail to Register Contact Service Callback [_contacts_address_book] [%d]", errCode);
-
-       if (ContactDbHandle.disconnect() != MSG_SUCCESS)
-                       MSG_DEBUG("DB Disconnect Fail");
-#endif
-
        return MSG_SUCCESS;
 }
 
@@ -341,15 +281,19 @@ msg_error_t MsgGetContactInfo(const MSG_ADDRESS_INFO_S *pAddrInfo, MSG_CONTACT_I
 {
        MSG_BEGIN();
 
+       MsgZoneChange();
+
        msg_error_t err = MSG_SUCCESS;
 
        if ((err = MsgOpenContactSvc()) != MSG_SUCCESS) {
                MSG_DEBUG("MsgOpenContactSvc fail.");
+               MsgZoneRevert();
                return err;
        }
 
        if (!isContactSvcConnected) {
                MSG_DEBUG("Contact Service Not Opened.");
+               MsgZoneRevert();
                return MSG_ERR_UNKNOWN;
        }
 
@@ -359,6 +303,7 @@ msg_error_t MsgGetContactInfo(const MSG_ADDRESS_INFO_S *pAddrInfo, MSG_CONTACT_I
 
        if (pAddrInfo->addressType == MSG_ADDRESS_TYPE_PLMN && strlen(pAddrInfo->addressVal) > (MAX_PHONE_NUMBER_LEN+1)) {
                MSG_SEC_DEBUG("Phone Number is too long [%s]", pAddrInfo->addressVal);
+               MsgZoneRevert();
                return MSG_ERR_UNKNOWN;
        }
 
@@ -383,6 +328,7 @@ msg_error_t MsgGetContactInfo(const MSG_ADDRESS_INFO_S *pAddrInfo, MSG_CONTACT_I
 
        } else {
                MSG_DEBUG("Invalid pAddrInfo->addressType.");
+               MsgZoneRevert();
                return MSG_ERR_UNKNOWN;
        }
 
@@ -393,6 +339,7 @@ msg_error_t MsgGetContactInfo(const MSG_ADDRESS_INFO_S *pAddrInfo, MSG_CONTACT_I
                contacts_query_destroy(query);
                contacts_filter_destroy(filter);
                contacts_list_destroy(contacts, true);
+               MsgZoneRevert();
                return MSG_ERR_UNKNOWN;
        }
 
@@ -403,6 +350,7 @@ msg_error_t MsgGetContactInfo(const MSG_ADDRESS_INFO_S *pAddrInfo, MSG_CONTACT_I
                contacts_query_destroy(query);
                contacts_filter_destroy(filter);
                contacts_list_destroy(contacts, true);
+               MsgZoneRevert();
                return MSG_SUCCESS;
        }
 
@@ -418,6 +366,7 @@ msg_error_t MsgGetContactInfo(const MSG_ADDRESS_INFO_S *pAddrInfo, MSG_CONTACT_I
                if (ret != CONTACTS_ERROR_NONE) {
                        MSG_DEBUG("contacts_list_get_current_record_p() Error [%d]", ret);
                        contacts_list_destroy(contacts, true);
+                       MsgZoneRevert();
                        return MSG_ERR_UNKNOWN;
                }
 
@@ -425,6 +374,7 @@ msg_error_t MsgGetContactInfo(const MSG_ADDRESS_INFO_S *pAddrInfo, MSG_CONTACT_I
                if (ret != CONTACTS_ERROR_NONE) {
                        MSG_DEBUG("contacts_record_get_int() Error [%d]", ret);
                        contacts_list_destroy(contacts, true);
+                       MsgZoneRevert();
                        return MSG_ERR_UNKNOWN;
                }
 
@@ -432,6 +382,7 @@ msg_error_t MsgGetContactInfo(const MSG_ADDRESS_INFO_S *pAddrInfo, MSG_CONTACT_I
                if (ret != CONTACTS_ERROR_NONE) {
                        MSG_DEBUG("contacts_db_get_record() Error [%d]", ret);
                        contacts_list_destroy(contacts, true);
+                       MsgZoneRevert();
                        return MSG_ERR_UNKNOWN;
                }
        } else if (pAddrInfo->addressType == MSG_ADDRESS_TYPE_EMAIL) {
@@ -441,6 +392,7 @@ msg_error_t MsgGetContactInfo(const MSG_ADDRESS_INFO_S *pAddrInfo, MSG_CONTACT_I
                if (ret != CONTACTS_ERROR_NONE) {
                        MSG_DEBUG("contacts_list_get_current_record_p() Error [%d]", ret);
                        contacts_list_destroy(contacts, true);
+                       MsgZoneRevert();
                        return MSG_ERR_UNKNOWN;
                }
 
@@ -448,6 +400,7 @@ msg_error_t MsgGetContactInfo(const MSG_ADDRESS_INFO_S *pAddrInfo, MSG_CONTACT_I
                if (ret != CONTACTS_ERROR_NONE) {
                        MSG_DEBUG("contacts_record_get_int() Error [%d]", ret);
                        contacts_list_destroy(contacts, true);
+                       MsgZoneRevert();
                        return MSG_ERR_UNKNOWN;
                }
 
@@ -455,77 +408,18 @@ msg_error_t MsgGetContactInfo(const MSG_ADDRESS_INFO_S *pAddrInfo, MSG_CONTACT_I
                if (ret != CONTACTS_ERROR_NONE) {
                        MSG_DEBUG("contacts_db_get_record() Error [%d]", ret);
                        contacts_list_destroy(contacts, true);
+                       MsgZoneRevert();
                        return MSG_ERR_UNKNOWN;
                }
        }
 
        contacts_list_destroy(contacts, true);
 
-#if 0
-       // Name Info
-       contacts_record_h name = NULL;
-
-       ret = contacts_record_get_child_record_at_p(contact, _contacts_contact.name, 0, &name);
-       if (ret != CONTACTS_ERROR_NONE) {
-               MSG_DEBUG("contacts_record_get_child_record_at_p() Error [%d]", ret);
-       } else {
-               char* strName = NULL;
-               ret = contacts_record_get_str_p(name, _contacts_name.first, &strName);
-               if (ret != CONTACTS_ERROR_NONE) {
-                       MSG_DEBUG("contacts_record_get_str_p() Error [%d]", ret);
-               } else {
-                       if (strName != NULL) {
-                               MSG_DEBUG("strName [%s]", strName);
-                               strncpy(pContactInfo->firstName, strName, MAX_DISPLAY_NAME_LEN);
-                       }
-               }
-
-               ret = contacts_record_get_str_p(name, _contacts_name.last, &strName);
-               if (ret != CONTACTS_ERROR_NONE) {
-                       MSG_DEBUG("contacts_record_get_str_p() Error [%d]", ret);
-               } else {
-                       if (strName != NULL) {
-                               MSG_DEBUG("strName [%s]", strName);
-                               strncpy(pContactInfo->lastName, strName, MAX_DISPLAY_NAME_LEN);
-                       }
-               }
-
-               ret = contacts_record_get_str_p(name, _contacts_name.addition, &strName);
-               if (ret != CONTACTS_ERROR_NONE) {
-                       MSG_DEBUG("contacts_record_get_str_p() Error [%d]", ret);
-               } else {
-                       if (strName != NULL) {
-                               MSG_DEBUG("strName [%s]", strName);
-                               strncpy(pContactInfo->middleName, strName, MAX_DISPLAY_NAME_LEN);
-                       }
-               }
-
-               ret = contacts_record_get_str_p(name, _contacts_name.prefix, &strName);
-               if (ret != CONTACTS_ERROR_NONE) {
-                       MSG_DEBUG("contacts_record_get_str_p() Error [%d]", ret);
-               } else {
-                       if (strName != NULL) {
-                               MSG_DEBUG("strName [%s]", strName);
-                               strncpy(pContactInfo->prefix, strName, MAX_DISPLAY_NAME_LEN);
-                       }
-               }
-
-               ret = contacts_record_get_str_p(name, _contacts_name.suffix, &strName);
-               if (ret != CONTACTS_ERROR_NONE) {
-                       MSG_DEBUG("contacts_record_get_str_p() Error [%d]", ret);
-               } else {
-                       if (strName != NULL) {
-                               MSG_DEBUG("strName [%s]", strName);
-                               strncpy(pContactInfo->suffix, strName, MAX_DISPLAY_NAME_LEN);
-                       }
-               }
-       }
-#endif
-
        ret = contacts_record_get_int(contact, _contacts_contact.id, (int*)&pContactInfo->contactId);
        if (ret != CONTACTS_ERROR_NONE) {
                MSG_DEBUG("contacts_db_get_record() Error [%d]", ret);
                contacts_record_destroy(contact, true);
+               MsgZoneRevert();
                return MSG_ERR_UNKNOWN;
        }
 
@@ -535,6 +429,7 @@ msg_error_t MsgGetContactInfo(const MSG_ADDRESS_INFO_S *pAddrInfo, MSG_CONTACT_I
        if (ret != CONTACTS_ERROR_NONE) {
                MSG_DEBUG("contacts_db_get_record() Error [%d]", ret);
                contacts_record_destroy(contact, true);
+               MsgZoneRevert();
                return MSG_ERR_UNKNOWN;
        }
 
@@ -624,6 +519,8 @@ msg_error_t MsgGetContactInfo(const MSG_ADDRESS_INFO_S *pAddrInfo, MSG_CONTACT_I
 
        MSG_END();
 
+       MsgZoneRevert();
+
        return MSG_SUCCESS;
 }
 
@@ -632,27 +529,33 @@ msg_error_t MsgGetContactSearchList(const char *pSearchVal, MSG_ADDRESS_INFO_S *
 {
        MSG_BEGIN();
 
+       MsgZoneChange();
+
        msg_error_t err = MSG_SUCCESS;
 
        *count = 0;
 
        if (pSearchVal == NULL) {
                MSG_DEBUG("pSearchVal is NULL.");
+               MsgZoneRevert();
                return MSG_ERR_NULL_POINTER;
        }
 
        if (pAddrInfo == NULL) {
                MSG_DEBUG("pAddrInfo is NULL.");
+               MsgZoneRevert();
                return MSG_ERR_NULL_POINTER;
        }
 
        if ((err = MsgOpenContactSvc()) != MSG_SUCCESS) {
                MSG_DEBUG("MsgOpenContactSvc fail.");
+               MsgZoneRevert();
                return err;
        }
 
        if (!isContactSvcConnected) {
                MSG_DEBUG("Contact Service Not Opened.");
+               MsgZoneRevert();
                return MSG_ERR_UNKNOWN;
        }
 
@@ -676,16 +579,18 @@ msg_error_t MsgGetContactSearchList(const char *pSearchVal, MSG_ADDRESS_INFO_S *
                contacts_query_destroy(query);
                contacts_filter_destroy(filter);
                contacts_list_destroy(personNumbers, true);
+               MsgZoneRevert();
                return MSG_ERR_UNKNOWN;
        }
 
        ret = contacts_list_get_count(personNumbers, count);
        if (*count == 0 || ret != CONTACTS_ERROR_NONE) {
-               MSG_DEBUG("No Serach Data from Contact Service.");
+               MSG_DEBUG("No Search Data from Contact Service.");
                *count = 0;
                contacts_query_destroy(query);
                contacts_filter_destroy(filter);
                contacts_list_destroy(personNumbers, true);
+               MsgZoneRevert();
                return MSG_SUCCESS;
        }
 
@@ -718,376 +623,16 @@ msg_error_t MsgGetContactSearchList(const char *pSearchVal, MSG_ADDRESS_INFO_S *
 
        MSG_END();
 
-       return MSG_SUCCESS;
-}
-
-
-void MsgSyncAddressbook()
-{
-       int ret = -1;
-       int changed_count = 0;
-
-       contacts_list_h addrbookListHnd = NULL;
+       MsgZoneRevert();
 
-       ret = contacts_db_get_all_records(_contacts_address_book._uri, 0, 0, &addrbookListHnd);
-       if (ret != CONTACTS_ERROR_NONE) {
-               MSG_DEBUG("contacts_db_get_all_records() Error [%d]", ret);
-               contacts_list_destroy(addrbookListHnd, true);
-               return;
-       }
-
-       ret = contacts_list_get_count(addrbookListHnd, &changed_count);
-
-       if (ret != CONTACTS_ERROR_NONE) {
-               MSG_DEBUG("contacts_list_get_count() Error [%d]", ret);
-               contacts_list_destroy(addrbookListHnd, true);
-               return;
-       }
-
-       if (changed_count>0) {
-               int addrbookList[changed_count];
-
-               for (int i = 0; i < changed_count; i++) {
-                       contacts_record_h addrbook = NULL;
-                       int addrbookId = 0;
-
-                       ret = contacts_list_get_current_record_p(addrbookListHnd, &addrbook);
-                       if (ret != CONTACTS_ERROR_NONE) {
-                               MSG_DEBUG("contacts_list_get_current_record_p() Error [%d]", ret);
-                               contacts_list_destroy(addrbookListHnd, true);
-                               return;
-                       }
-
-                       ret = contacts_record_get_int(addrbook, _contacts_address_book.id, &addrbookId);
-                       if (ret != CONTACTS_ERROR_NONE) {
-                               MSG_DEBUG("contacts_record_get_int() Error [%d]", ret);
-                               contacts_list_destroy(addrbookListHnd, true);
-                               return;
-                       }
-
-                       addrbookList[i] = addrbookId;
-
-                       ret = contacts_list_next(addrbookListHnd);
-                       if (ret != CONTACTS_ERROR_NONE) {
-                               MSG_DEBUG("contacts_list_next() Error [%d]", ret);
-                       }
-
-               }
-
-               MsgStoClearContactInfoByAddrbookIdList(&ContactDbHandle, addrbookList, (int)changed_count);
-       }
-
-       contacts_list_destroy(addrbookListHnd, true);
-}
-
-
-void MsgSyncContact()
-{
-       int ret = -1;
-       int changed_count = 0;
-       int lastSyncTime = 0;
-       int finalSyncTime = 0;
-
-       /* get contact sync time */
-       lastSyncTime = MsgSettingGetInt(CONTACT_SYNC_TIME);
-
-       if (lastSyncTime < 0) {
-               MSG_DEBUG("Fail to get CONTACT_SYNC_TIME.");
-               lastSyncTime = 0;
-       }
-
-       contacts_list_h contactsList = NULL;
-
-       ret = contacts_db_get_changes_by_version(_contacts_contact_updated_info._uri, -1, lastSyncTime, &contactsList, &finalSyncTime);
-
-       if (ret != CONTACTS_ERROR_NONE) {
-               MSG_DEBUG("contacts_db_get_changes_by_version() Error [%d]", ret);
-               contacts_list_destroy(contactsList, true);
-               return;
-       }
-
-       ret = contacts_list_get_count(contactsList, &changed_count);
-
-       if (ret != CONTACTS_ERROR_NONE) {
-               MSG_DEBUG("contacts_list_get_count() Error [%d]", ret);
-               contacts_list_destroy(contactsList, true);
-               return;
-       }
-
-       for (int i = 0; i < changed_count; i++)
-       {
-               int index_num = 0;
-               int type = 0;
-               contacts_record_h event = NULL;
-
-               ret = contacts_list_get_current_record_p(contactsList, &event);
-               if (ret != CONTACTS_ERROR_NONE) {
-                       MSG_DEBUG("contacts_list_get_current_record_p() Error [%d]", ret);
-                       contacts_list_destroy(contactsList, true);
-                       return;
-               }
-
-               ret = contacts_record_get_int(event, _contacts_contact_updated_info.contact_id, &index_num);
-               if (ret != CONTACTS_ERROR_NONE) {
-                       MSG_DEBUG("contacts_record_get_int() Error [%d]", ret);
-                       contacts_list_destroy(contactsList, true);
-                       return;
-               }
-
-               MSG_DEBUG("index (%d)", index_num);
-
-               ret = contacts_record_get_int(event, _contacts_contact_updated_info.type, &type);
-               if (ret != CONTACTS_ERROR_NONE) {
-                       MSG_DEBUG("contacts_record_get_int() Error [%d]", ret);
-                       contacts_list_destroy(contactsList, true);
-                       return;
-               }
-
-               MSG_DEBUG("type [%d]", type);
-
-               if (type != CONTACTS_CHANGE_INSERTED) {
-                       MsgDeleteContact(index_num);
-               }
-
-               if (type != CONTACTS_CHANGE_DELETED) {
-                       MsgUpdateContact(index_num, type);
-               }
-
-               ret = contacts_list_next(contactsList);
-               if (ret != CONTACTS_ERROR_NONE) {
-                       MSG_DEBUG("contacts_list_next() Error [%d]", ret);
-               }
-       }
-
-       if(MsgSettingSetInt(CONTACT_SYNC_TIME, finalSyncTime) != MSG_SUCCESS)
-               MSG_DEBUG("MsgSettingSetInt fail : CONTACT_SYNC_TIME");
-       MSG_DEBUG("lastSyncTime : %d", finalSyncTime);
-
-       contacts_list_destroy(contactsList, true);
-
-       if(changed_count > 0) {
-               if(cbFunction) cbFunction();
-       }
-}
-
-
-bool MsgInsertContact(MSG_CONTACT_INFO_S *pContactInfo, const char *pNumber)
-{
-       if (!pNumber || strlen(pNumber) <= 0)
-               return false;
-
-       if (MsgStoAddContactInfo(&ContactDbHandle, pContactInfo, pNumber) != MSG_SUCCESS) {
-               MSG_DEBUG("Fail to add contact info.");
-               return false;
-       }
-
-       return true;
-}
-
-
-bool MsgUpdateContact(int index, int type)
-{
-       int ret = CONTACTS_ERROR_NONE;
-
-       contacts_record_h contact = NULL;
-
-       ret = contacts_db_get_record(_contacts_contact._uri, index, &contact);
-       if (ret != CONTACTS_ERROR_NONE) {
-               MSG_DEBUG("contacts_db_get_record() Error [%d]", ret);
-               contacts_record_destroy(contact, true);
-               return false;
-       }
-
-#if 0
-       MSG_CONTACT_INFO_S contactInfo;
-       memset(&contactInfo, 0x00, sizeof(MSG_CONTACT_INFO_S));
-
-       ret = contacts_record_get_int(contact, _contacts_contact.id, (int*)&contactInfo.contactId);
-       if (ret != CONTACTS_ERROR_NONE) {
-               MSG_DEBUG("contacts_db_get_record() Error [%d]", ret);
-               contacts_record_destroy(contact, true);
-               return false;
-       }
-
-       MSG_DEBUG("Contact ID [%d]", contactInfo.contactId);
-
-       ret = contacts_record_get_int(contact, _contacts_contact.address_book_id, (int*)&contactInfo.addrbookId);
-       if (ret != CONTACTS_ERROR_NONE) {
-               MSG_DEBUG("contacts_db_get_record() Error [%d]", ret);
-       }
-
-       MSG_DEBUG("Addressbook ID [%d]", contactInfo.addrbookId);
-
-       char* strImagePath = NULL;
-       ret = contacts_record_get_str_p(contact, _contacts_contact.image_thumbnail_path, &strImagePath);
-       if (ret != CONTACTS_ERROR_NONE) {
-               MSG_DEBUG("contacts_record_get_str_p() Error [%d]", ret);
-       }
-
-       if (strImagePath != NULL)
-               strncpy(contactInfo.imagePath , strImagePath, MAX_IMAGE_PATH_LEN);
-
-       MSG_DEBUG("Image Path [%s]", contactInfo.imagePath);
-
-       // Name Info
-       contacts_record_h name = NULL;
-
-       ret = contacts_record_get_child_record_at_p(contact, _contacts_contact.name, 0, &name);
-       if (ret != CONTACTS_ERROR_NONE) {
-               MSG_DEBUG("contacts_record_get_child_record_at_p() Error [%d]", ret);
-       } else {
-               char* strName = NULL;
-               ret = contacts_record_get_str_p(name, _contacts_name.first, &strName);
-               if (ret != CONTACTS_ERROR_NONE) {
-                       MSG_DEBUG("contacts_record_get_str_p() Error [%d]", ret);
-               } else {
-                       if (strName != NULL) {
-                               MSG_DEBUG("strName [%s]", strName);
-                               strncpy(contactInfo.firstName, strName, MAX_DISPLAY_NAME_LEN);
-                       }
-               }
-
-               ret = contacts_record_get_str_p(name, _contacts_name.last, &strName);
-               if (ret != CONTACTS_ERROR_NONE) {
-                       MSG_DEBUG("contacts_record_get_str_p() Error [%d]", ret);
-               } else {
-                       if (strName != NULL) {
-                               MSG_DEBUG("strName [%s]", strName);
-                               strncpy(contactInfo.lastName, strName, MAX_DISPLAY_NAME_LEN);
-                       }
-               }
-
-               ret = contacts_record_get_str_p(name, _contacts_name.addition, &strName);
-               if (ret != CONTACTS_ERROR_NONE) {
-                       MSG_DEBUG("contacts_record_get_str_p() Error [%d]", ret);
-               } else {
-                       if (strName != NULL) {
-                               MSG_DEBUG("strName [%s]", strName);
-                               strncpy(contactInfo.middleName, strName, MAX_DISPLAY_NAME_LEN);
-                       }
-               }
-
-               ret = contacts_record_get_str_p(name, _contacts_name.prefix, &strName);
-               if (ret != CONTACTS_ERROR_NONE) {
-                       MSG_DEBUG("contacts_record_get_str_p() Error [%d]", ret);
-               } else {
-                       if (strName != NULL) {
-                               MSG_DEBUG("strName [%s]", strName);
-                               strncpy(contactInfo.prefix, strName, MAX_DISPLAY_NAME_LEN);
-                       }
-               }
-
-               ret = contacts_record_get_str_p(name, _contacts_name.suffix, &strName);
-               if (ret != CONTACTS_ERROR_NONE) {
-                       MSG_DEBUG("contacts_record_get_str_p() Error [%d]", ret);
-               } else {
-                       if (strName != NULL) {
-                               MSG_DEBUG("strName [%s]", strName);
-                               strncpy(contactInfo.suffix, strName, MAX_DISPLAY_NAME_LEN);
-                       }
-               }
-
-               MSG_SEC_DEBUG("First Name : [%s], Last Name : [%s]", contactInfo.firstName, contactInfo.lastName);
-       }
-
-       MsgStoClearContactInfo(&ContactDbHandle, index);
-#endif
-
-       int count = 0;
-       ret = contacts_record_get_child_record_count(contact, _contacts_contact.number, &count);
-       if (ret != CONTACTS_ERROR_NONE) {
-               MSG_DEBUG("contacts_record_get_child_record_count() Error [%d]", ret);
-               contacts_record_destroy(contact, true);
-               return false;
-       }
-
-       if (count > 0) {
-               for (int i=0; i < count; i++) {
-                       MSG_DEBUG("Add Contact Data");
-
-                       contacts_record_h number = NULL;
-
-                       ret = contacts_record_get_child_record_at_p(contact, _contacts_contact.number, i, &number);
-                       if (ret != CONTACTS_ERROR_NONE) {
-                               MSG_DEBUG("contacts_record_get_child_record_at_p() Error [%d]", ret);
-                               contacts_record_destroy(contact, true);
-                               return false;
-                       }
-
-                       char* strNumber = NULL;
-                       ret = contacts_record_get_str_p(number, _contacts_number.number, &strNumber);
-                       if (ret != CONTACTS_ERROR_NONE) {
-                               MSG_DEBUG("contacts_record_get_str_p() Error [%d]", ret);
-                               contacts_record_destroy(contact, true);
-                               return false;
-                       }
-
-                       if (strNumber != NULL) {
-                               MSG_DEBUG("Number [%s]", strNumber);
-                               int strNumberLen = strlen(strNumber);
-                               char normalizeNum[strNumberLen+1];
-                               memset(normalizeNum, 0x00, sizeof(normalizeNum));
-                               if (strNumberLen > 0) {
-                                       normalizeNumber(strNumber, normalizeNum, strNumberLen);
-                                       MSG_DEBUG("normalizeNum [%s]", normalizeNum);
-                               }
-
-                               MSG_CONTACT_INFO_S contactInfo;
-                               memset(&contactInfo, 0x00, sizeof(MSG_CONTACT_INFO_S));
-
-                               MSG_ADDRESS_INFO_S addrInfo;
-                               memset(&addrInfo, 0x00, sizeof(MSG_ADDRESS_INFO_S));
-                               strncpy(addrInfo.addressVal, normalizeNum, MAX_ADDRESS_VAL_LEN);
-
-                               if(MsgGetContactInfo(&addrInfo, &contactInfo) == MSG_SUCCESS) {
-                                       if (MsgInsertContact(&contactInfo, normalizeNum)) {
-                                               MsgStoSetConversationDisplayName(&ContactDbHandle, (int)contactInfo.contactId);
-                                       } else {
-                                               MSG_DEBUG("MsgInsertContact fail.");
-                                       }
-                               }
-                       }
-               }
-       } else {// No phone number in contact
-               contacts_record_destroy(contact, true);
-               return true;
-       }
-
-//     MsgStoSetConversationDisplayName(&ContactDbHandle, index);
-
-       contacts_record_destroy(contact, true);
-
-       return true;
+       return MSG_SUCCESS;
 }
 
 
-bool MsgDeleteContact(int index)
-{
-//     if (MsgStoClearContactInfo(&ContactDbHandle, index) != MSG_SUCCESS)
-       if (MsgStoResetContactInfo(&ContactDbHandle, index) != MSG_SUCCESS)
-               return false;
-
-       return true;
-}
-
 int MsgGetContactNameOrder()
 {
-//     int ret = CONTACTS_ERROR_NONE;
        contacts_name_display_order_e order = CONTACTS_NAME_DISPLAY_ORDER_FIRSTLAST;
 
-//     if (MsgOpenContactSvc() != MSG_SUCCESS) {
-//             MSG_DEBUG("MsgOpenContactSvc fail.");
-//     }
-//
-//     if (!isContactSvcConnected) {
-//             MSG_DEBUG("Contact Service Not Opened.");
-//     } else {
-//             ret = contacts_setting_get_name_display_order(&order);
-//             if (ret != CONTACTS_ERROR_NONE) {
-//                     MSG_DEBUG("contacts_setting_get_name_display_order() Error [%d]", ret);
-//             }
-//     }
-
        return (int)order;
 }
 
@@ -1161,20 +706,25 @@ msg_error_t MsgGetContactStyleDisplayName(const char *first, const char *last, c
 
 void MsgAddPhoneLog(const MSG_MESSAGE_INFO_S *pMsgInfo)
 {
+       MsgZoneChange();
+
        msg_error_t err = MSG_SUCCESS;
 
        if ((err = MsgOpenContactSvc()) != MSG_SUCCESS) {
                MSG_DEBUG("MsgOpenContactSvc fail.");
+               MsgZoneRevert();
                return;
        }
 
        if (!isContactSvcConnected) {
                MSG_DEBUG("Contact Service Not Opened.");
+               MsgZoneRevert();
                return;
        }
 
        if (pMsgInfo->nAddressCnt < 1) {
                MSG_DEBUG("address count is [%d]", pMsgInfo->nAddressCnt);
+               MsgZoneRevert();
                return;
        }
 
@@ -1235,15 +785,20 @@ void MsgAddPhoneLog(const MSG_MESSAGE_INFO_S *pMsgInfo)
 
                contacts_record_destroy(plog, true);
        }
+
+       MsgZoneRevert();
 }
 
 
 void MsgDeletePhoneLog(msg_message_id_t msgId)
 {
+       MsgZoneChange();
+
        msg_error_t err = MSG_SUCCESS;
 
        if ((err = MsgOpenContactSvc()) != MSG_SUCCESS) {
                MSG_DEBUG("MsgOpenContactSvc fail.");
+               MsgZoneRevert();
                return;
        }
 
@@ -1251,6 +806,7 @@ void MsgDeletePhoneLog(msg_message_id_t msgId)
 
        if (!isContactSvcConnected) {
                MSG_DEBUG("Contact Service Not Opened.");
+               MsgZoneRevert();
                return;
        }
 
@@ -1298,25 +854,16 @@ void MsgDeletePhoneLog(msg_message_id_t msgId)
        contacts_query_destroy(query);
        contacts_filter_destroy(filter);
        contacts_list_destroy(plogs, true);
-}
-
-
-int MsgContactSVCBeginTrans()
-{
-       //return contacts_svc_begin_trans();
-       return 0;
-}
-
 
-int MsgContactSVCEndTrans(bool bSuccess)
-{
-       //return contacts_svc_end_trans(bSuccess);
-       return 0;
+       MsgZoneRevert();
 }
 
 
 bool checkBlockingMode(char *address, bool *pisFavorites)
 {
+#if 0
+       MsgZoneChange();
+
        msg_error_t err = MSG_SUCCESS;
 
        if (pisFavorites != NULL) *pisFavorites = false;
@@ -1338,11 +885,13 @@ bool checkBlockingMode(char *address, bool *pisFavorites)
 
        if ((err = MsgOpenContactSvc()) != MSG_SUCCESS) {
                MSG_DEBUG("MsgOpenContactSvc fail.");
+               MsgZoneRevert();
                return isblock;
        }
 
        if (!isContactSvcConnected) {
                MSG_DEBUG("Contact Service Not Opened.");
+               MsgZoneRevert();
                return isblock;
        }
 
@@ -1350,6 +899,7 @@ bool checkBlockingMode(char *address, bool *pisFavorites)
 
        if (strlen(address) > (MAX_PHONE_NUMBER_LEN+1)) {
                MSG_SEC_DEBUG("Phone Number is too long [%s]", address);
+               MsgZoneRevert();
                return isblock;
        }
 
@@ -1375,6 +925,7 @@ bool checkBlockingMode(char *address, bool *pisFavorites)
        if (ret != CONTACTS_ERROR_NONE) {
                MSG_DEBUG("contacts_db_get_records_with_query() Error [%d]", ret);
                contacts_list_destroy(personList, true);
+               MsgZoneRevert();
                return isblock;
        }
 
@@ -1383,6 +934,7 @@ bool checkBlockingMode(char *address, bool *pisFavorites)
        if (count == 0 || ret != CONTACTS_ERROR_NONE) {
                MSG_DEBUG("No Serach Data from Contact Service.");
                contacts_list_destroy(personList, true);
+               MsgZoneRevert();
                return isblock;
        } else if (ret == CONTACTS_ERROR_NONE && count > 0
                        && blockModeType == 1) { // For All contacts allow in blocking mode.
@@ -1395,6 +947,7 @@ bool checkBlockingMode(char *address, bool *pisFavorites)
        if (ret != CONTACTS_ERROR_NONE) {
                MSG_DEBUG("contacts_list_get_current_record_p() Error [%d]", ret);
                contacts_list_destroy(personList, true);
+               MsgZoneRevert();
                return isblock;
        }
 
@@ -1402,6 +955,7 @@ bool checkBlockingMode(char *address, bool *pisFavorites)
        if (ret != CONTACTS_ERROR_NONE) {
                MSG_DEBUG("contacts_record_get_int() Error [%d]", ret);
                contacts_list_destroy(personList, true);
+               MsgZoneRevert();
                return isblock;
        }
 
@@ -1411,6 +965,7 @@ bool checkBlockingMode(char *address, bool *pisFavorites)
        if (ret != CONTACTS_ERROR_NONE) {
                MSG_DEBUG("contacts_record_get_int() Error [%d]", ret);
                contacts_list_destroy(personList, true);
+               MsgZoneRevert();
                return isblock;
        }
 
@@ -1452,7 +1007,15 @@ bool checkBlockingMode(char *address, bool *pisFavorites)
 
        if (pisFavorites != NULL) *pisFavorites = isFavorites;
 
+       MsgZoneRevert();
+
        return isblock;
+#else
+       if (pisFavorites != NULL)
+               *pisFavorites = false;
+
+       return false;
+#endif
 }
 
 
index 885923e..f582248 100755 (executable)
@@ -26,220 +26,200 @@ const char * MsgDbgCmdStr(MSG_CMD_TYPE_T cmdType)
        switch ( cmdType )
        {
 // 0
-               case MSG_CMD_OPEN_HANDLE:
-                       return "MSG_CMD_OPEN_HANDLE";
-               case MSG_CMD_CLOSE_HANDLE:
-                       return "MSG_CMD_CLOSE_HANDLE";
-               case MSG_CMD_GET_STORAGELIST:
-                       return "MSG_CMD_GET_STORAGELIST";
-               case MSG_CMD_ADD_MSG:
-                       return "MSG_CMD_ADD_MSG";
-               case MSG_CMD_ADD_SYNCML_MSG:
-                       return "MSG_CMD_ADD_SYNCML_MSG";
-
+       case MSG_CMD_OPEN_HANDLE:
+               return "MSG_CMD_OPEN_HANDLE";
+       case MSG_CMD_CLOSE_HANDLE:
+               return "MSG_CMD_CLOSE_HANDLE";
+       case MSG_CMD_GET_STORAGELIST:
+               return "MSG_CMD_GET_STORAGELIST";
+       case MSG_CMD_ADD_MSG:
+               return "MSG_CMD_ADD_MSG";
+       case MSG_CMD_ADD_SYNCML_MSG:
+               return "MSG_CMD_ADD_SYNCML_MSG";
 // 5
-               case MSG_CMD_UPDATE_MSG:
-                       return "MSG_CMD_UPDATE_MSG";
-               case MSG_CMD_UPDATE_READ:
-                       return "MSG_CMD_UPDATE_READ";
-               case MSG_CMD_UPDATE_PROTECTED:
-                       return "MSG_CMD_UPDATE_PROTECTED";
-               case MSG_CMD_DELETE_MSG:
-                       return "MSG_CMD_DELETE_MSG";
-               case MSG_CMD_DELALL_MSGINFOLDER:
-                       return "MSG_CMD_DELALL_MSGINFOLDER";
-
+       case MSG_CMD_UPDATE_MSG:
+               return "MSG_CMD_UPDATE_MSG";
+       case MSG_CMD_UPDATE_READ:
+               return "MSG_CMD_UPDATE_READ";
+       case MSG_CMD_UPDATE_PROTECTED:
+               return "MSG_CMD_UPDATE_PROTECTED";
+       case MSG_CMD_DELETE_MSG:
+               return "MSG_CMD_DELETE_MSG";
+       case MSG_CMD_DELALL_MSGINFOLDER:
+               return "MSG_CMD_DELALL_MSGINFOLDER";
 // 10
-               case MSG_CMD_MOVE_MSGTOFOLDER:
-                       return "MSG_CMD_MOVE_MSGTOFOLDER";
-               case MSG_CMD_MOVE_MSGTOSTORAGE:
-                       return "MSG_CMD_MOVE_MSGTOSTORAGE";
-               case MSG_CMD_COUNT_MSG:
-                       return "MSG_CMD_COUNT_MSG";
-               case MSG_CMD_GET_MSG:
-                       return "MSG_CMD_GET_MSG";
-               case MSG_CMD_GET_FOLDERVIEWLIST:
-                       return "MSG_CMD_GET_FOLDERVIEWLIST";
-
+       case MSG_CMD_MOVE_MSGTOFOLDER:
+               return "MSG_CMD_MOVE_MSGTOFOLDER";
+       case MSG_CMD_MOVE_MSGTOSTORAGE:
+               return "MSG_CMD_MOVE_MSGTOSTORAGE";
+       case MSG_CMD_COUNT_MSG:
+               return "MSG_CMD_COUNT_MSG";
+       case MSG_CMD_GET_MSG:
+               return "MSG_CMD_GET_MSG";
+       case MSG_CMD_ADD_FOLDER:
+               return "MSG_CMD_ADD_FOLDER";
 // 15
-               case MSG_CMD_ADD_FOLDER:
-                       return "MSG_CMD_ADD_FOLDER";
-               case MSG_CMD_UPDATE_FOLDER:
-                       return "MSG_CMD_UPDATE_FOLDER";
-               case MSG_CMD_DELETE_FOLDER:
-                       return "MSG_CMD_DELETE_FOLDER";
-               case MSG_CMD_GET_FOLDERLIST:
-                       return "MSG_CMD_GET_FOLDERLIST";
-               case MSG_CMD_ADD_FILTER:
-                       return "MSG_CMD_ADD_FILTER";
-
+       case MSG_CMD_UPDATE_FOLDER:
+               return "MSG_CMD_UPDATE_FOLDER";
+       case MSG_CMD_DELETE_FOLDER:
+               return "MSG_CMD_DELETE_FOLDER";
+       case MSG_CMD_GET_FOLDERLIST:
+               return "MSG_CMD_GET_FOLDERLIST";
+       case MSG_CMD_ADD_FILTER:
+               return "MSG_CMD_ADD_FILTER";
+       case MSG_CMD_UPDATE_FILTER:
+               return "MSG_CMD_UPDATE_FILTER";
 // 20
-               case MSG_CMD_UPDATE_FILTER:
-                       return "MSG_CMD_UPDATE_FILTER";
-               case MSG_CMD_DELETE_FILTER:
-                       return "MSG_CMD_DELETE_FILTER";
-               case MSG_CMD_GET_FILTERLIST:
-                       return "MSG_CMD_GET_FILTERLIST";
-               case MSG_CMD_SET_FILTER_OPERATION:
-                       return "MSG_CMD_SET_FILTER_OPERATION";
-               case MSG_CMD_GET_FILTER_OPERATION:
-                       return "MSG_CMD_GET_FILTER_OPERATION";
-
+       case MSG_CMD_DELETE_FILTER:
+               return "MSG_CMD_DELETE_FILTER";
+       case MSG_CMD_GET_FILTERLIST:
+               return "MSG_CMD_GET_FILTERLIST";
+       case MSG_CMD_SET_FILTER_OPERATION:
+               return "MSG_CMD_SET_FILTER_OPERATION";
+       case MSG_CMD_GET_FILTER_OPERATION:
+               return "MSG_CMD_GET_FILTER_OPERATION";
+       case MSG_CMD_SUBMIT_REQ:
+               return "MSG_CMD_SUBMIT_REQ";
 // 25
-               case MSG_CMD_GET_MSG_TYPE:
-                       return "MSG_CMD_GET_MSG_TYPE";
-               case MSG_CMD_SUBMIT_REQ:
-                       return "MSG_CMD_SUBMIT_REQ";
-               case MSG_CMD_REG_SENT_STATUS_CB:
-                       return "MSG_CMD_REG_SENT_STATUS_CB";
-               case MSG_CMD_REG_STORAGE_CHANGE_CB:
-                       return "MSG_CMD_REG_STORAGE_CHANGE_CB";
-
+       case MSG_CMD_REG_SENT_STATUS_CB:
+               return "MSG_CMD_REG_SENT_STATUS_CB";
+       case MSG_CMD_REG_STORAGE_CHANGE_CB:
+               return "MSG_CMD_REG_STORAGE_CHANGE_CB";
+       case MSG_CMD_REG_INCOMING_MSG_CB:
+               return "MSG_CMD_REG_INCOMING_MSG_CB";
+       case MSG_CMD_REG_INCOMING_MMS_CONF_MSG_CB:
+               return "MSG_CMD_REG_INCOMING_MMS_CONF_MSG_CB";
+       case MSG_CMD_REG_INCOMING_SYNCML_MSG_CB:
+               return "MSG_CMD_REG_INCOMING_SYNCML_MSG_CB";
 // 30
-               case MSG_CMD_REG_INCOMING_MSG_CB:
-                       return "MSG_CMD_REG_INCOMING_MSG_CB";
-               case MSG_CMD_REG_INCOMING_MMS_CONF_MSG_CB:
-                       return "MSG_CMD_REG_INCOMING_MMS_CONF_MSG_CB";
-               case MSG_CMD_REG_INCOMING_SYNCML_MSG_CB:
-                       return "MSG_CMD_REG_INCOMING_SYNCML_MSG_CB";
-               case MSG_CMD_REG_INCOMING_LBS_MSG_CB:
-                       return "MSG_CMD_REG_INCOMING_LBS_MSG_CB";
-               case MSG_CMD_PLG_SENT_STATUS_CNF:
-                       return "MSG_CMD_PLG_SENT_STATUS_CNF";
-
+       case MSG_CMD_REG_INCOMING_LBS_MSG_CB:
+               return "MSG_CMD_REG_INCOMING_LBS_MSG_CB";
+       case MSG_CMD_PLG_SENT_STATUS_CNF:
+               return "MSG_CMD_PLG_SENT_STATUS_CNF";
+       case MSG_CMD_PLG_STORAGE_CHANGE_IND:
+               return "MSG_CMD_PLG_STORAGE_CHANGE_IND";
+       case MSG_CMD_PLG_INCOMING_MSG_IND:
+               return "MSG_CMD_PLG_INCOMING_MSG_IND";
+       case MSG_CMD_PLG_INCOMING_MMS_CONF:
+               return "MSG_CMD_PLG_INCOMING_MMS_CONF";
 // 35
-               case MSG_CMD_PLG_STORAGE_CHANGE_IND:
-                       return "MSG_CMD_PLG_STORAGE_CHANGE_IND";
-               case MSG_CMD_PLG_INCOMING_MSG_IND:
-                       return "MSG_CMD_PLG_INCOMING_MSG_IND";
-               case MSG_CMD_PLG_INCOMING_MMS_CONF:
-                       return "MSG_CMD_PLG_INCOMING_MMS_CONF";
-               case MSG_CMD_PLG_INCOMING_SYNCML_IND:
-                       return "MSG_CMD_PLG_INCOMING_SYNCML_IND";
-               case MSG_CMD_PLG_INCOMING_LBS_IND:
-                       return "MSG_CMD_PLG_INCOMING_LBS_IND";
-
+       case MSG_CMD_PLG_INCOMING_SYNCML_IND:
+               return "MSG_CMD_PLG_INCOMING_SYNCML_IND";
+       case MSG_CMD_PLG_INCOMING_LBS_IND:
+               return "MSG_CMD_PLG_INCOMING_LBS_IND";
+       case MSG_CMD_PLG_INIT_SIM_BY_SAT:
+               return "MSG_CMD_PLG_INIT_SIM_BY_SAT";
+       case MSG_CMD_GET_THREADVIEWLIST:
+               return "MSG_CMD_GET_THREADVIEWLIST";
+       case MSG_CMD_DELETE_THREADMESSAGELIST:
+               return "MSG_CMD_DELETE_THREADMESSAGELIST";
 // 40
-               case MSG_CMD_PLG_INIT_SIM_BY_SAT:
-                       return "MSG_CMD_PLG_INIT_SIM_BY_SAT";
-               case MSG_CMD_GET_THREADVIEWLIST:
-                       return "MSG_CMD_GET_THREADVIEWLIST";
-               case MSG_CMD_GET_CONVERSATIONVIEWLIST:
-                       return "MSG_CMD_GET_CONVERSATIONVIEWLIST";
-               case MSG_CMD_DELETE_THREADMESSAGELIST:
-                       return "MSG_CMD_DELETE_THREADMESSAGELIST";
-               case MSG_CMD_GET_CONTACT_COUNT:
-                       return "MSG_CMD_GET_CONTACT_COUNT";
-
+       case MSG_CMD_GET_CONTACT_COUNT:
+               return "MSG_CMD_GET_CONTACT_COUNT";
+       case MSG_CMD_GET_QUICKPANEL_DATA:
+               return "MSG_CMD_GET_QUICKPANEL_DATA";
+       case MSG_CMD_COUNT_BY_MSGTYPE:
+               return "MSG_CMD_COUNT_BY_MSGTYPE";
+       case MSG_CMD_RESET_DB:
+               return "MSG_CMD_RESET_DB";
+       case MSG_CMD_GET_MEMSIZE:
+               return "MSG_CMD_GET_MEMSIZE";
 // 45
-               case MSG_CMD_GET_QUICKPANEL_DATA:
-                       return "MSG_CMD_GET_QUICKPANEL_DATA";
-               case MSG_CMD_COUNT_BY_MSGTYPE:
-                       return "MSG_CMD_COUNT_BY_MSGTYPE";
-               case MSG_CMD_RESET_DB:
-                       return "MSG_CMD_RESET_DB";
-               case MSG_CMD_GET_MEMSIZE:
-                       return "MSG_CMD_GET_MEMSIZE";
-               case MSG_CMD_BACKUP_MESSAGE:
-                       return "MSG_CMD_BACKUP_MESSAGE";
-
+       case MSG_CMD_BACKUP_MESSAGE:
+               return "MSG_CMD_BACKUP_MESSAGE";
+       case MSG_CMD_RESTORE_MESSAGE:
+               return "MSG_CMD_RESTORE_MESSAGE";
+       case MSG_CMD_UPDATE_THREAD_READ:
+               return "MSG_CMD_UPDATE_THREAD_READ";
+       case MSG_CMD_REG_SYNCML_MSG_OPERATION_CB:
+               return "MSG_CMD_REG_SYNCML_MSG_OPERATION_CB";
+       case MSG_CMD_SYNCML_OPERATION:
+               return "MSG_CMD_SYNCML_OPERATION";
 // 50
-               case MSG_CMD_RESTORE_MESSAGE:
-                       return "MSG_CMD_RESTORE_MESSAGE";
-               case MSG_CMD_UPDATE_THREAD_READ:
-                       return "MSG_CMD_UPDATE_THREAD_READ";
-               case MSG_CMD_REG_SYNCML_MSG_OPERATION_CB:
-                       return "MSG_CMD_REG_SYNCML_MSG_OPERATION_CB";
-               case MSG_CMD_SYNCML_OPERATION:
-                       return "MSG_CMD_SYNCML_OPERATION";
-               case MSG_CMD_GET_REPORT_STATUS:
-                       return "MSG_CMD_GET_REPORT_STATUS";
-
+       case MSG_CMD_GET_REPORT_STATUS:
+               return "MSG_CMD_GET_REPORT_STATUS";
+       case MSG_CMD_GET_THREAD_ID_BY_ADDRESS:
+               return "MSG_CMD_GET_THREAD_ID_BY_ADDRESS";
+       case MSG_CMD_GET_THREAD_INFO:
+               return "MSG_CMD_GET_THREAD_INFO";
+       case MSG_CMD_GET_SMSC_OPT:
+               return "MSG_CMD_GET_SMSC_OPT";
+       case MSG_CMD_GET_CB_OPT:
+               return "MSG_CMD_GET_CB_OPT";
 // 55
-               case MSG_CMD_GET_THREAD_ID_BY_ADDRESS:
-                       return "MSG_CMD_GET_THREAD_ID_BY_ADDRESS";
-               case MSG_CMD_GET_THREAD_INFO:
-                       return "MSG_CMD_GET_THREAD_INFO";
-               case MSG_CMD_GET_SMSC_OPT:
-                       return "MSG_CMD_GET_SMSC_OPT";
-               case MSG_CMD_GET_CB_OPT:
-                       return "MSG_CMD_GET_CB_OPT";
-
+       case MSG_CMD_GET_SMS_SEND_OPT:
+               return "MSG_CMD_GET_SMS_SEND_OPT";
+       case MSG_CMD_GET_MMS_SEND_OPT:
+               return "MSG_CMD_GET_MMS_SEND_OPT";
+       case MSG_CMD_GET_MMS_RECV_OPT:
+               return "MSG_CMD_GET_MMS_RECV_OPT";
+       case MSG_CMD_GET_PUSH_MSG_OPT:
+               return "MSG_CMD_GET_PUSH_MSG_OPT";
+       case MSG_CMD_GET_VOICE_MSG_OPT:
+               return "MSG_CMD_GET_VOICE_MSG_OPT";
 // 60
-               case MSG_CMD_GET_SMS_SEND_OPT:
-                       return "MSG_CMD_GET_SMS_SEND_OPT";
-               case MSG_CMD_GET_MMS_SEND_OPT:
-                       return "MSG_CMD_GET_MMS_SEND_OPT";
-               case MSG_CMD_GET_MMS_RECV_OPT:
-                       return "MSG_CMD_GET_MMS_RECV_OPT";
-               case MSG_CMD_GET_PUSH_MSG_OPT:
-                       return "MSG_CMD_GET_PUSH_MSG_OPT";
-               case MSG_CMD_GET_VOICE_MSG_OPT:
-                       return "MSG_CMD_GET_VOICE_MSG_OPT";
-
+       case MSG_CMD_GET_GENERAL_MSG_OPT:
+               return "MSG_CMD_GET_GENERAL_MSG_OPT";
+       case MSG_CMD_GET_MSG_SIZE_OPT:
+               return "MSG_CMD_GET_MSG_SIZE_OPT";
+       case MSG_CMD_SET_SMSC_OPT:
+               return "MSG_CMD_SET_SMSC_OPT";
+       case MSG_CMD_SET_CB_OPT:
+               return "MSG_CMD_SET_CB_OPT";
+       case MSG_CMD_SET_SMS_SEND_OPT:
+               return "MSG_CMD_SET_SMS_SEND_OPT";
 // 65
-               case MSG_CMD_GET_GENERAL_MSG_OPT:
-                       return "MSG_CMD_GET_GENERAL_MSG_OPT";
-               case MSG_CMD_GET_MSG_SIZE_OPT:
-                       return "MSG_CMD_GET_MSG_SIZE_OPT";
-               case MSG_CMD_SET_SMSC_OPT:
-                       return "MSG_CMD_SET_SMSC_OPT";
-
-
+       case MSG_CMD_SET_MMS_SEND_OPT:
+               return "MSG_CMD_SET_MMS_SEND_OPT";
+       case MSG_CMD_SET_MMS_RECV_OPT:
+               return "MSG_CMD_SET_MMS_RECV_OPT";
+       case MSG_CMD_SET_PUSH_MSG_OPT:
+               return "MSG_CMD_SET_PUSH_MSG_OPT";
+       case MSG_CMD_SET_VOICE_MSG_OPT:
+               return "MSG_CMD_SET_VOICE_MSG_OPT";
+       case MSG_CMD_SET_GENERAL_MSG_OPT:
+               return "MSG_CMD_SET_GENERAL_MSG_OPT";
 // 70
-               case MSG_CMD_SET_CB_OPT:
-                       return "MSG_CMD_SET_CB_OPT";
-               case MSG_CMD_SET_SMS_SEND_OPT:
-                       return "MSG_CMD_SET_SMS_SEND_OPT";
-               case MSG_CMD_SET_MMS_SEND_OPT:
-                       return "MSG_CMD_SET_MMS_SEND_OPT";
-               case MSG_CMD_SET_MMS_RECV_OPT:
-                       return "MSG_CMD_SET_MMS_RECV_OPT";
-               case MSG_CMD_SET_PUSH_MSG_OPT:
-                       return "MSG_CMD_SET_PUSH_MSG_OPT";
-
+       case MSG_CMD_SET_MSG_SIZE_OPT:
+               return "MSG_CMD_SET_MSG_SIZE_OPT";
+       case MSG_CMD_REG_INCOMING_PUSH_MSG_CB:
+               return "MSG_CMD_REG_INCOMING_PUSH_MSG_CB";
+       case MSG_CMD_PLG_INCOMING_PUSH_IND:
+               return "MSG_CMD_PLG_INCOMING_PUSH_IND";
+       case MSG_CMD_REG_INCOMING_CB_MSG_CB:
+               return "MSG_CMD_REG_INCOMING_CB_MSG_CB";
+       case MSG_CMD_PLG_INCOMING_CB_IND:
+               return "MSG_CMD_PLG_INCOMING_CB_IND";
 // 75
-               case MSG_CMD_SET_VOICE_MSG_OPT:
-                       return "MSG_CMD_SET_VOICE_MSG_OPT";
-               case MSG_CMD_SET_GENERAL_MSG_OPT:
-                       return "MSG_CMD_SET_GENERAL_MSG_OPT";
-               case MSG_CMD_SET_MSG_SIZE_OPT:
-                       return "MSG_CMD_SET_MSG_SIZE_OPT";
-// 80
-               case MSG_CMD_REG_INCOMING_PUSH_MSG_CB:
-                       return "MSG_CMD_REG_INCOMING_PUSH_MSG_CB";
-               case MSG_CMD_PLG_INCOMING_PUSH_IND:
-                       return "MSG_CMD_PLG_INCOMING_PUSH_IND";
-               case MSG_CMD_REG_INCOMING_CB_MSG_CB:
-                       return "MSG_CMD_REG_INCOMING_CB_MSG_CB";
-               case MSG_CMD_PLG_INCOMING_CB_IND:
-                       return "MSG_CMD_PLG_INCOMING_CB_IND";
-               case MSG_CMD_ADD_PUSH_EVENT:
-                       return "MSG_CMD_ADD_PUSH_EVENT";
-//85
-               case MSG_CMD_DELETE_PUSH_EVENT:
-                       return "MSG_CMD_DELETE_PUSH_EVENT";
-               case MSG_CMD_UPDATE_PUSH_EVENT:
-                       return "MSG_CMD_UPDATE_PUSH_EVENT";
-               case MSG_CMD_DELETE_MESSAGE_BY_LIST :
-                       return "MSG_CMD_DELETE_MESSAGE_BY_LIST";
-               case MSG_CMD_SET_FILTER_ACTIVATION :
-                       return "MSG_CMD_SET_FILTER_ACTIVATION";
-               case MSG_CMD_ADD_SIM_MSG :
-                       return "MSG_CMD_ADD_SIM_MSG";
-//90
-               case MSG_CMD_PLG_RESEND_MESSAGE:
-                       return "MSG_CMD_PLG_RESEND_MESSAGE";
-               case MSG_CMD_REG_REPORT_MSG_INCOMING_CB:
-                       return "MSG_CMD_REG_REPORT_MSG_INCOMING_CB";
+       case MSG_CMD_ADD_PUSH_EVENT:
+               return "MSG_CMD_ADD_PUSH_EVENT";
+       case MSG_CMD_DELETE_PUSH_EVENT:
+               return "MSG_CMD_DELETE_PUSH_EVENT";
+       case MSG_CMD_UPDATE_PUSH_EVENT:
+               return "MSG_CMD_UPDATE_PUSH_EVENT";
+       case MSG_CMD_DELETE_MESSAGE_BY_LIST:
+               return "MSG_CMD_DELETE_MESSAGE_BY_LIST";
+       case MSG_CMD_SET_FILTER_ACTIVATION:
+               return "MSG_CMD_SET_FILTER_ACTIVATION";
+//80
+       case MSG_CMD_ADD_SIM_MSG:
+               return "MSG_CMD_ADD_SIM_MSG";
+       case MSG_CMD_PLG_RESEND_MESSAGE:
+               return "MSG_CMD_PLG_RESEND_MESSAGE";
+       case MSG_CMD_REG_REPORT_MSG_INCOMING_CB:
+               return "MSG_CMD_REG_REPORT_MSG_INCOMING_CB";
+       case MSG_CMD_UPDATE_IMSI:
+               return "MSG_CMD_UPDATE_IMSI";
+       case MSG_CMD_SET_TEMP_ADDRESS_TABLE:
+               return "MSG_CMD_SET_TEMP_ADDRESS_TABLE";
+
 #ifdef FEATURE_SMS_CDMA
-               case MSG_CMD_PLG_CHECK_UNIQUENESS:
-                       return "MSG_CMD_PLG_CHECK_UNIQUENESS";
+       case MSG_CMD_PLG_CHECK_UNIQUENESS:
+               return "MSG_CMD_PLG_CHECK_UNIQUENESS";
 #endif
-               case MSG_CMD_UPDATE_IMSI:
-                       return "MSG_CMD_UPDATE_IMSI";
-               default:
-                       return "Unknown Command Type!!!";
+
+       default:
+               return "Unknown Command Type!!!";
        }
 
        return NULL;
@@ -250,215 +230,203 @@ const char * MsgDbgEvtStr(MSG_EVENT_TYPE_T evtType)
        switch ( evtType )
        {
 // 0
-               case MSG_EVENT_OPEN_HANDLE:
-                       return "MSG_EVENT_OPEN_HANDLE";
-               case MSG_EVENT_CLOSE_HANDLE:
-                       return "MSG_EVENT_CLOSE_HANDLE";
-               case MSG_EVENT_GET_STORAGELIST:
-                       return "MSG_EVENT_GET_STORAGELIST";
-               case MSG_EVENT_ADD_MSG:
-                       return "MSG_EVENT_ADD_MSG";
-               case MSG_EVENT_ADD_SYNCML_MSG:
-                       return "MSG_EVENT_ADD_SYNCML_MSG";
+       case MSG_EVENT_OPEN_HANDLE:
+               return "MSG_EVENT_OPEN_HANDLE";
+       case MSG_EVENT_CLOSE_HANDLE:
+               return "MSG_EVENT_CLOSE_HANDLE";
+       case MSG_EVENT_GET_STORAGELIST:
+               return "MSG_EVENT_GET_STORAGELIST";
+       case MSG_EVENT_ADD_MSG:
+               return "MSG_EVENT_ADD_MSG";
+       case MSG_EVENT_ADD_SYNCML_MSG:
+               return "MSG_EVENT_ADD_SYNCML_MSG";
 // 5
-               case MSG_EVENT_UPDATE_MSG:
-                       return "MSG_EVENT_UPDATE_MSG";
-               case MSG_EVENT_UPDATE_READ:
-                       return "MSG_EVENT_UPDATE_READ";
-               case MSG_EVENT_UPDATE_PROTECTED:
-                       return "MSG_EVENT_UPDATE_PROTECTED";
-               case MSG_EVENT_DELETE_MSG:
-                       return "MSG_EVENT_DELETE_MSG";
-               case MSG_EVENT_DELALL_MSGINFOLDER:
-                       return "MSG_EVENT_DELALL_MSGINFOLDER";
+       case MSG_EVENT_UPDATE_MSG:
+               return "MSG_EVENT_UPDATE_MSG";
+       case MSG_EVENT_UPDATE_READ:
+               return "MSG_EVENT_UPDATE_READ";
+       case MSG_EVENT_UPDATE_PROTECTED:
+               return "MSG_EVENT_UPDATE_PROTECTED";
+       case MSG_EVENT_DELETE_MSG:
+               return "MSG_EVENT_DELETE_MSG";
+       case MSG_EVENT_DELALL_MSGINFOLDER:
+               return "MSG_EVENT_DELALL_MSGINFOLDER";
 // 10
-               case MSG_EVENT_MOVE_MSGTOFOLDER:
-                       return "MSG_EVENT_MOVE_MSGTOFOLDER";
-               case MSG_EVENT_MOVE_MSGTOSTORAGE:
-                       return "MSG_EVENT_MOVE_MSGTOSTORAGE";
-               case MSG_EVENT_COUNT_MSG:
-                       return "MSG_EVENT_COUNT_MSG";
-               case MSG_EVENT_GET_MSG:
-                       return "MSG_EVENT_GET_MSG";
-               case MSG_EVENT_GET_FOLDERVIEWLIST:
-                       return "MSG_EVENT_GET_FOLDERVIEWLIST";
+       case MSG_EVENT_MOVE_MSGTOFOLDER:
+               return "MSG_EVENT_MOVE_MSGTOFOLDER";
+       case MSG_EVENT_MOVE_MSGTOSTORAGE:
+               return "MSG_EVENT_MOVE_MSGTOSTORAGE";
+       case MSG_EVENT_COUNT_MSG:
+               return "MSG_EVENT_COUNT_MSG";
+       case MSG_EVENT_GET_MSG:
+               return "MSG_EVENT_GET_MSG";
+       case MSG_EVENT_ADD_FOLDER:
+               return "MSG_EVENT_ADD_FOLDER";
 // 15
-               case MSG_EVENT_ADD_FOLDER:
-                       return "MSG_EVENT_ADD_FOLDER";
-               case MSG_EVENT_UPDATE_FOLDER:
-                       return "MSG_EVENT_UPDATE_FOLDER";
-               case MSG_EVENT_DELETE_FOLDER:
-                       return "MSG_EVENT_DELETE_FOLDER";
-               case MSG_EVENT_GET_FOLDERLIST:
-                       return "MSG_EVENT_GET_FOLDERLIST";
-               case MSG_EVENT_ADD_FILTER:
-                       return "MSG_EVENT_ADD_FILTER";
+       case MSG_EVENT_UPDATE_FOLDER:
+               return "MSG_EVENT_UPDATE_FOLDER";
+       case MSG_EVENT_DELETE_FOLDER:
+               return "MSG_EVENT_DELETE_FOLDER";
+       case MSG_EVENT_GET_FOLDERLIST:
+               return "MSG_EVENT_GET_FOLDERLIST";
+       case MSG_EVENT_ADD_FILTER:
+               return "MSG_EVENT_ADD_FILTER";
+       case MSG_EVENT_UPDATE_FILTER:
+               return "MSG_EVENT_UPDATE_FILTER";
 //20
-               case MSG_EVENT_UPDATE_FILTER:
-                       return "MSG_EVENT_UPDATE_FILTER";
-               case MSG_EVENT_DELETE_FILTER:
-                       return "MSG_EVENT_DELETE_FILTER";
-               case MSG_EVENT_GET_FILTERLIST:
-                       return "MSG_EVENT_GET_FILTERLIST";
-               case MSG_EVENT_SET_FILTER_OPERATION:
-                       return "MSG_EVENT_SET_FILTER_OPERATION";
-               case MSG_EVENT_GET_FILTER_OPERATION:
-                       return "MSG_EVENT_GET_FILTER_OPERATION";
+       case MSG_EVENT_DELETE_FILTER:
+               return "MSG_EVENT_DELETE_FILTER";
+       case MSG_EVENT_GET_FILTERLIST:
+               return "MSG_EVENT_GET_FILTERLIST";
+       case MSG_EVENT_SET_FILTER_OPERATION:
+               return "MSG_EVENT_SET_FILTER_OPERATION";
+       case MSG_EVENT_GET_FILTER_OPERATION:
+               return "MSG_EVENT_GET_FILTER_OPERATION";
+       case MSG_EVENT_SUBMIT_REQ:
+               return "MSG_EVENT_SUBMIT_REQ";
 //25
-               case MSG_EVENT_GET_MSG_TYPE:
-                       return "MSG_EVENT_GET_MSG_TYPE";
-               case MSG_EVENT_SUBMIT_REQ:
-                       return "MSG_EVENT_SUBMIT_REQ";
-               case MSG_EVENT_REG_SENT_STATUS_CB:
-                       return "MSG_EVENT_REG_SENT_STATUS_CB";
-               case MSG_EVENT_REG_STORAGE_CHANGE_CB:
-                       return "MSG_EVENT_REG_STORAGE_CHANGE_CB";
-
+       case MSG_EVENT_REG_SENT_STATUS_CB:
+               return "MSG_EVENT_REG_SENT_STATUS_CB";
+       case MSG_EVENT_REG_STORAGE_CHANGE_CB:
+               return "MSG_EVENT_REG_STORAGE_CHANGE_CB";
+       case MSG_EVENT_REG_INCOMING_MSG_CB:
+               return "MSG_EVENT_REG_INCOMING_MSG_CB";
+       case MSG_EVENT_REG_INCOMING_MMS_CONF_MSG_CB:
+               return "MSG_EVENT_REG_INCOMING_MMS_CONF_MSG_CB";
+       case MSG_EVENT_REG_INCOMING_SYNCML_MSG_CB:
+               return "MSG_EVENT_REG_INCOMING_SYNCML_MSG_CB";
 // 30
-               case MSG_EVENT_REG_INCOMING_MSG_CB:
-                       return "MSG_EVENT_REG_INCOMING_MSG_CB";
-               case MSG_EVENT_REG_INCOMING_MMS_CONF_MSG_CB:
-                       return "MSG_EVENT_REG_INCOMING_MMS_CONF_MSG_CB";
-               case MSG_EVENT_REG_INCOMING_SYNCML_MSG_CB:
-                       return "MSG_EVENT_REG_INCOMING_SYNCML_MSG_CB";
-               case MSG_EVENT_REG_INCOMING_LBS_MSG_CB:
-                       return "MSG_EVENT_REG_INCOMING_LBS_MSG_CB";
-               case MSG_EVENT_PLG_SENT_STATUS_CNF:
-                       return "MSG_EVENT_PLG_SENT_STATUS_CNF";
-
+       case MSG_EVENT_REG_INCOMING_LBS_MSG_CB:
+               return "MSG_EVENT_REG_INCOMING_LBS_MSG_CB";
+       case MSG_EVENT_PLG_SENT_STATUS_CNF:
+               return "MSG_EVENT_PLG_SENT_STATUS_CNF";
+       case MSG_EVENT_PLG_STORAGE_CHANGE_IND:
+               return "MSG_EVENT_PLG_STORAGE_CHANGE_IND";
+       case MSG_EVENT_PLG_INCOMING_MSG_IND:
+               return "MSG_EVENT_PLG_INCOMING_MSG_IND";
+       case MSG_EVENT_PLG_INCOMING_MMS_CONF:
+               return "MSG_EVENT_PLG_INCOMING_MMS_CONF";
 // 35
-               case MSG_EVENT_PLG_STORAGE_CHANGE_IND:
-                       return "MSG_EVENT_STORAGE_CHANGE_CB";
-               case MSG_EVENT_PLG_INCOMING_MSG_IND:
-                       return "MSG_EVENT_PLG_INCOMING_MSG_IND";
-               case MSG_EVENT_PLG_INCOMING_MMS_CONF:
-                       return "MSG_EVENT_PLG_INCOMING_MMS_CONF";
-               case MSG_EVENT_PLG_INCOMING_SYNCML_MSG_IND:
-                       return "MSG_EVENT_PLG_INCOMING_SYNCML_MSG_IND";
-               case MSG_EVENT_PLG_INCOMING_LBS_MSG_IND:
-                       return "MSG_EVENT_PLG_INCOMING_LBS_MSG_IND";
-
+       case MSG_EVENT_PLG_INCOMING_SYNCML_MSG_IND:
+               return "MSG_EVENT_PLG_INCOMING_SYNCML_MSG_IND";
+       case MSG_EVENT_PLG_INCOMING_LBS_MSG_IND:
+               return "MSG_EVENT_PLG_INCOMING_LBS_MSG_IND";
+       case MSG_EVENT_PLG_INIT_SIM_BY_SAT:
+               return "MSG_EVENT_PLG_INIT_SIM_BY_SAT";
+       case MSG_EVENT_GET_THREADVIEWLIST:
+               return "MSG_EVENT_GET_THREADVIEWLIST";
+       case MSG_EVENT_DELETE_THREADMESSAGELIST:
+               return "MSG_EVENT_DELETE_THREADMESSAGELIST";
 // 40
-               case MSG_EVENT_PLG_INIT_SIM_BY_SAT:
-                       return "MSG_EVENT_PLG_INIT_SIM_BY_SAT";
-               case MSG_EVENT_GET_THREADVIEWLIST:
-                       return "MSG_EVENT_GET_THREADVIEWLIST";
-               case MSG_EVENT_GET_CONVERSATIONVIEWLIST:
-                       return "MSG_EVENT_GET_CONVERSATIONVIEWLIST";
-               case MSG_EVENT_DELETE_THREADMESSAGELIST:
-                       return "MSG_EVENT_DELETE_THREADMESSAGELIST";
-               case MSG_EVENT_GET_CONTACT_COUNT:
-                       return "MSG_EVENT_GET_CONTACT_COUNT";
-
+       case MSG_EVENT_GET_CONTACT_COUNT:
+               return "MSG_EVENT_GET_CONTACT_COUNT";
+       case MSG_EVENT_GET_QUICKPANEL_DATA:
+               return "MSG_EVENT_GET_QUICKPANEL_DATA";
+       case MSG_EVENT_COUNT_BY_MSGTYPE:
+               return "MSG_EVENT_COUNT_BY_MSGTYPE";
+       case MSG_EVENT_RESET_DB:
+               return "MSG_EVENT_RESET_DB";
+       case MSG_EVENT_GET_MEMSIZE:
+               return "MSG_EVENT_GET_MEMSIZE";
 // 45
-               case MSG_EVENT_GET_QUICKPANEL_DATA:
-                       return "MSG_EVENT_GET_QUICKPANEL_DATA";
-               case MSG_EVENT_COUNT_BY_MSGTYPE:
-                       return "MSG_EVENT_COUNT_BY_MSGTYPE";
-               case MSG_EVENT_RESET_DB:
-                       return "MSG_EVENT_RESET_DB";
-               case MSG_EVENT_GET_MEMSIZE:
-                       return "MSG_EVENT_GET_MEMSIZE";
-               case MSG_EVENT_BACKUP_MESSAGE:
-                       return "MSG_EVENT_BACKUP_MESSAGE";
-
+       case MSG_EVENT_BACKUP_MESSAGE:
+               return "MSG_EVENT_BACKUP_MESSAGE";
+       case MSG_EVENT_RESTORE_MESSAGE:
+               return "MSG_EVENT_RESTORE_MESSAGE";
+       case MSG_EVENT_UPDATE_THREAD_READ:
+               return "MSG_EVENT_UPDATE_THREAD_READ";
+       case MSG_EVENT_REG_SYNCML_MSG_OPERATION_CB:
+               return "MSG_EVENT_REG_SYNCML_MSG_OPERATION_CB";
+       case MSG_EVENT_SYNCML_OPERATION:
+               return "MSG_EVENT_SYNCML_OPERATION";
 // 50
-               case MSG_EVENT_RESTORE_MESSAGE:
-                       return "MSG_EVENT_RESTORE_MESSAGE";
-               case MSG_EVENT_UPDATE_THREAD_READ:
-                       return "MSG_EVENT_UPDATE_THREAD_READ";
-               case MSG_EVENT_REG_SYNCML_MSG_OPERATION_CB:
-                       return "MSG_EVENT_REG_SYNCML_MSG_OPERATION_CB";
-               case MSG_EVENT_SYNCML_OPERATION:
-                       return "MSG_EVENT_SYNCML_OPERATION";
-               case MSG_EVENT_GET_REPORT_STATUS:
-                       return "MSG_EVENT_GET_REPORT_STATUS";
-
+       case MSG_EVENT_GET_REPORT_STATUS:
+               return "MSG_EVENT_GET_REPORT_STATUS";
+       case MSG_EVENT_GET_THREAD_ID_BY_ADDRESS:
+               return "MSG_EVENT_GET_THREAD_ID_BY_ADDRESS";
+       case MSG_EVENT_GET_THREAD_INFO:
+               return "MSG_EVENT_GET_THREAD_INFO";
+       case MSG_EVENT_GET_SMSC_OPT:
+               return "MSG_EVENT_GET_SMSC_OPT";
+       case MSG_EVENT_GET_CB_OPT:
+               return "MSG_EVENT_GET_CB_OPT";
 // 55
-               case MSG_CMD_GET_THREAD_ID_BY_ADDRESS:
-                       return "MSG_CMD_GET_THREAD_ID_BY_ADDRESS";
-               case MSG_CMD_GET_THREAD_INFO:
-                       return "MSG_CMD_GET_THREAD_INFO";
-               case MSG_EVENT_GET_SMSC_OPT:
-                       return "MSG_EVENT_GET_SMSC_OPT";
-               case MSG_EVENT_GET_CB_OPT:
-                       return "MSG_EVENT_GET_CB_OPT";
-
+       case MSG_EVENT_GET_SMS_SEND_OPT:
+               return "MSG_EVENT_GET_SMS_SEND_OPT";
+       case MSG_EVENT_GET_MMS_SEND_OPT:
+               return "MSG_EVENT_GET_MMS_SEND_OPT";
+       case MSG_EVENT_GET_MMS_RECV_OPT:
+               return "MSG_EVENT_GET_MMS_RECV_OPT";
+       case MSG_EVENT_GET_PUSH_MSG_OPT:
+               return "MSG_EVENT_GET_PUSH_MSG_OPT";
+       case MSG_EVENT_GET_VOICE_MSG_OPT:
+               return "MSG_EVENT_GET_VOICE_MSG_OPT";
 // 60
-               case MSG_EVENT_GET_SMS_SEND_OPT:
-                       return "MSG_EVENT_GET_SMS_SEND_OPT";
-               case MSG_EVENT_GET_MMS_SEND_OPT:
-                       return "MSG_EVENT_GET_MMS_SEND_OPT";
-               case MSG_EVENT_GET_MMS_RECV_OPT:
-                       return "MSG_EVENT_GET_MMS_RECV_OPT";
-               case MSG_EVENT_GET_PUSH_MSG_OPT:
-                       return "MSG_EVENT_GET_PUSH_MSG_OPT";
-               case MSG_EVENT_GET_VOICE_MSG_OPT:
-                       return "MSG_EVENT_GET_VOICE_MSG_OPT";
-
+       case MSG_EVENT_GET_GENERAL_MSG_OPT:
+               return "MSG_EVENT_GET_GENERAL_MSG_OPT";
+       case MSG_EVENT_GET_MSG_SIZE_OPT:
+               return "MSG_EVENT_GET_MSG_SIZE_OPT";
+       case MSG_EVENT_SET_SMSC_OPT:
+               return "MSG_EVENT_SET_SMSC_OPT";
+       case MSG_EVENT_SET_CB_OPT:
+               return "MSG_EVENT_SET_CB_OPT";
+       case MSG_EVENT_SET_SMS_SEND_OPT:
+               return "MSG_EVENT_SET_SMS_SEND_OPT";
 // 65
-               case MSG_EVENT_GET_GENERAL_MSG_OPT:
-                       return "MSG_EVENT_GET_GENERAL_MSG_OPT";
-               case MSG_EVENT_GET_MSG_SIZE_OPT:
-                       return "MSG_EVENT_GET_MSG_SIZE_OPT";
-               case MSG_EVENT_SET_SMSC_OPT:
-                       return "MSG_EVENT_SET_SMSC_OPT";
+       case MSG_EVENT_SET_MMS_SEND_OPT:
+               return "MSG_EVENT_SET_MMS_SEND_OPT";
+       case MSG_EVENT_SET_MMS_RECV_OPT:
+               return "MSG_EVENT_SET_MMS_RECV_OPT";
+       case MSG_EVENT_SET_PUSH_MSG_OPT:
+               return "MSG_EVENT_SET_PUSH_MSG_OPT";
+       case MSG_EVENT_SET_VOICE_MSG_OPT:
+               return "MSG_EVENT_SET_VOICE_MSG_OPT";
+       case MSG_EVENT_SET_GENERAL_MSG_OPT:
+               return "MSG_EVENT_SET_GENERAL_MSG_OPT";
 // 70
-               case MSG_EVENT_SET_CB_OPT:
-                       return "MSG_EVENT_SET_CB_OPT";
-               case MSG_EVENT_SET_SMS_SEND_OPT:
-                       return "MSG_EVENT_SET_SMS_SEND_OPT";
-               case MSG_EVENT_SET_MMS_SEND_OPT:
-                       return "MSG_EVENT_SET_MMS_SEND_OPT";
-               case MSG_EVENT_SET_MMS_RECV_OPT:
-                       return "MSG_EVENT_SET_MMS_RECV_OPT";
-               case MSG_EVENT_SET_PUSH_MSG_OPT:
-                       return "MSG_EVENT_SET_PUSH_MSG_OPT";
+       case MSG_EVENT_SET_MSG_SIZE_OPT:
+               return "MSG_EVENT_SET_MSG_SIZE_OPT";
+       case MSG_EVENT_REG_INCOMING_PUSH_MSG_CB:
+               return "MSG_EVENT_REG_INCOMING_PUSH_MSG_CB";
+       case MSG_EVENT_PLG_INCOMING_PUSH_MSG_IND:
+               return "MSG_EVENT_PLG_INCOMING_PUSH_MSG_IND";
+       case MSG_EVENT_REG_INCOMING_CB_MSG_CB:
+               return "MSG_EVENT_REG_INCOMING_CB_MSG_CB";
+       case MSG_EVENT_PLG_INCOMING_CB_MSG_IND:
+               return "MSG_EVENT_PLG_INCOMING_CB_MSG_IND";
 // 75
-               case MSG_EVENT_SET_VOICE_MSG_OPT:
-                       return "MSG_EVENT_SET_VOICE_MSG_OPT";
-               case MSG_EVENT_SET_GENERAL_MSG_OPT:
-                       return "MSG_EVENT_SET_GENERAL_MSG_OPT";
-               case MSG_EVENT_SET_MSG_SIZE_OPT:
-                       return "MSG_EVENT_SET_MSG_SIZE_OPT";
-//80
-               case MSG_EVENT_REG_INCOMING_PUSH_MSG_CB:
-                       return "MSG_EVENT_REG_INCOMING_PUSH_MSG_CB";
-               case MSG_EVENT_PLG_INCOMING_PUSH_MSG_IND:
-                       return "MSG_EVENT_PLG_INCOMING_PUSH_MSG_IND";
-               case MSG_EVENT_REG_INCOMING_CB_MSG_CB:
-                       return "MSG_EVENT_REG_INCOMING_CB_MSG_CB";
-               case MSG_EVENT_PLG_INCOMING_CB_MSG_IND:
-                       return "MSG_EVENT_PLG_INCOMING_CB_MSG_IND";
-               case MSG_EVENT_ADD_PUSH_EVENT:
-                       return "MSG_EVENT_ADD_PUSH_EVENT";
-//85
-               case MSG_EVENT_DELETE_PUSH_EVENT:
-                       return "MSG_EVENT_DELETE_PUSH_EVENT";
-               case MSG_EVENT_UPDATE_PUSH_EVENT:
-                       return "MSG_EVENT_UPDATE_PUSH_EVENT";
-               case MSG_EVENT_DELETE_MESSAGE_BY_LIST :
-                       return "MSG_EVENT_DELETE_MESSAGE_BY_LIST";
-               case MSG_EVENT_SET_FILTER_ACTIVATION :
-                       return "MSG_EVENT_SET_FILTER_ACTIVATION";
-               case MSG_EVENT_ADD_SIM_MSG :
-                       return "MSG_EVENT_ADD_SIM_MSG";
+       case MSG_EVENT_ADD_PUSH_EVENT:
+               return "MSG_EVENT_ADD_PUSH_EVENT";
+       case MSG_EVENT_DELETE_PUSH_EVENT:
+               return "MSG_EVENT_DELETE_PUSH_EVENT";
+       case MSG_EVENT_UPDATE_PUSH_EVENT:
+               return "MSG_EVENT_UPDATE_PUSH_EVENT";
+       case MSG_EVENT_DELETE_MESSAGE_BY_LIST:
+               return "MSG_EVENT_DELETE_MESSAGE_BY_LIST";
+       case MSG_EVENT_SET_FILTER_ACTIVATION:
+               return "MSG_EVENT_SET_FILTER_ACTIVATION";
+// 80
+       case MSG_EVENT_ADD_SIM_MSG:
+               return "MSG_EVENT_ADD_SIM_MSG";
+       case MSG_EVENT_PLG_RESEND_MESSAGE:
+               return "MSG_EVENT_PLG_RESEND_MESSAGE";
+       case MSG_EVENT_REG_REPORT_MSG_INCOMING_CB:
+               return "MSG_EVENT_REG_REPORT_MSG_INCOMING_CB";
+       case MSG_EVENT_UPDATE_IMSI:
+               return "MSG_EVENT_UPDATE_IMSI";
+       case MSG_EVENT_SET_TEMP_ADDRESS_TABLE:
+               return "MSG_EVENT_SET_TEMP_ADDRESS_TABLE";
 
-//90
-               case MSG_EVENT_PLG_RESEND_MESSAGE:
-                       return "MSG_EVENT_PLG_RESEND_MESSAGE";
-               case MSG_EVENT_REG_REPORT_MSG_INCOMING_CB:
-                       return "MSG_EVENT_REG_REPORT_MSG_INCOMING_CB";
-               case MSG_EVENT_PLG_REPORT_MSG_INCOMING_IND:
-                       return "MSG_EVENT_PLG_REPORT_MSG_INCOMING_IND";
 #ifdef FEATURE_SMS_CDMA
-               case MSG_EVENT_PLG_CHECK_UNIQUENESS:
-                       return "MSG_EVENT_PLG_CHECK_UNIQUENESS";
+       case MSG_EVENT_PLG_CHECK_UNIQUENESS:
+               return "MSG_EVENT_PLG_CHECK_UNIQUENESS";
 #endif
-               case MSG_EVENT_UPDATE_IMSI:
-                       return "MSG_EVENT_UPDATE_IMSI";
-               default:
-                       return "Unknown Event Type!!!";
+
+       case MSG_EVENT_PLG_REPORT_MSG_INCOMING_IND:
+               return "MSG_EVENT_PLG_REPORT_MSG_INCOMING_IND";
+
+       default:
+               return "Unknown Event Type!!!";
        }
 
        return NULL;
index 7ad2f62..b7ff747 100755 (executable)
@@ -37,25 +37,6 @@ bool bUnknownAutoReject = false;
 /*==================================================================================================
                                      FUNCTION IMPLEMENTATION
 ==================================================================================================*/
-static void MsgVconfCB(keynode_t *key, void* data)
-{
-       char *keyStr = NULL;
-       keyStr = vconf_keynode_get_name(key);
-
-       if (!keyStr)
-               return;
-
-       if (!g_strcmp0(keyStr, VCONFKEY_CISSAPPL_AUTO_REJECT_INT)) {
-               autoReject = vconf_keynode_get_int(key);
-               MSG_DEBUG("[%s] key CB called. set to [%d].", VCONFKEY_CISSAPPL_AUTO_REJECT_INT, autoReject);
-       } else if (!g_strcmp0(keyStr, VCONFKEY_CISSAPPL_AUTO_REJECT_UNKNOWN_BOOL)) {
-               bUnknownAutoReject = vconf_keynode_get_bool(key);
-               MSG_DEBUG("[%s] key CB called. set to [%d].", VCONFKEY_CISSAPPL_AUTO_REJECT_UNKNOWN_BOOL, bUnknownAutoReject);
-       }
-       else {
-               MSG_DEBUG("key did not match.");
-       }
-}
 
 msg_error_t MsgSettingSetString(const char *pKey, const char *pSetValue)
 {
@@ -253,20 +234,3 @@ void MsgSettingRemoveVconfCBCommon(const char *pKey, _vconf_change_cb pCb)
                MSG_DEBUG("Success to remove vconf CB with [%s]", pKey);
        }
 }
-
-
-void MsgSettingRegVconfCB()
-{
-       // Set default values.
-       autoReject = MsgSettingGetInt(VCONFKEY_CISSAPPL_AUTO_REJECT_INT);
-       MsgSettingGetBool(VCONFKEY_CISSAPPL_AUTO_REJECT_UNKNOWN_BOOL, &bUnknownAutoReject);
-
-       MsgSettingRegVconfCBCommon(VCONFKEY_CISSAPPL_AUTO_REJECT_INT, MsgVconfCB);
-       MsgSettingRegVconfCBCommon(VCONFKEY_CISSAPPL_AUTO_REJECT_UNKNOWN_BOOL, MsgVconfCB);
-}
-
-void MsgSettingRemoveVconfCB()
-{
-       MsgSettingRemoveVconfCBCommon(VCONFKEY_CISSAPPL_AUTO_REJECT_INT, MsgVconfCB);
-       MsgSettingRemoveVconfCBCommon(VCONFKEY_CISSAPPL_AUTO_REJECT_UNKNOWN_BOOL, MsgVconfCB);
-}
index 0a6f571..4add222 100755 (executable)
@@ -19,7 +19,6 @@
 #include <sys/ioctl.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <sys/smack.h>
 
 #include <errno.h>
 #include <unistd.h>
@@ -29,7 +28,7 @@
 #include "MsgDebug.h"
 #include "MsgException.h"
 #include "MsgIpcSocket.h"
-
+#include "MsgZoneManager.h"
 
 /*==================================================================================================
                                      IMPLEMENTATION OF MsgIpcClientSocket - Member Functions
@@ -180,10 +179,12 @@ int MsgIpcClientSocket::readn( char *buf, unsigned int len )
 {
        unsigned int nleft;
        int nread;
+       char t_buf[len];
 
        nleft = len;
        while (nleft > 0) {
-               nread = ::read(sockfd, (void*) buf, nleft);
+               memset(t_buf, 0x00, len);
+               nread = ::read(sockfd, t_buf, nleft);
                if (nread < 0) {
                        MSG_FATAL("WARNING read value %d: %s", nread, g_strerror(errno));
                        return nread;
@@ -192,6 +193,7 @@ int MsgIpcClientSocket::readn( char *buf, unsigned int len )
                }
 
                nleft -= nread;
+               memcpy(buf, t_buf, nread);
                buf += nread;
        }
 
@@ -332,7 +334,7 @@ msg_error_t MsgIpcServerSocket::open(const char* path)
 
        int len = strlen(local.sun_path) + sizeof(local.sun_family);
 
-       if (::bind(sockfd, (struct sockaddr *)&local, len) == CUSTOM_SOCKET_ERROR) {
+       if (bind(sockfd, (struct sockaddr *)&local, len) == CUSTOM_SOCKET_ERROR) {
                MSG_FATAL("bind: %s", g_strerror(errno));
                return MSG_ERR_UNKNOWN;
        }
@@ -354,17 +356,6 @@ msg_error_t MsgIpcServerSocket::open(const char* path)
                MSG_FATAL("chmod: %s", g_strerror(errno));
                return MSG_ERR_UNKNOWN;
        }
-#if 0
-       if (smack_setlabel(path, "*", SMACK_LABEL_IPIN) != 0) {
-               MSG_FATAL("smack_setlabel error");
-               return MSG_ERR_UNKNOWN;
-       }
-
-       if (smack_setlabel(path, "@", SMACK_LABEL_IPOUT) != 0) {
-               MSG_FATAL("smack_setlabel error");
-               return MSG_ERR_UNKNOWN;
-       }
-#endif
        if (listen(sockfd, CUSTOM_SOCKET_BACKLOG) == CUSTOM_SOCKET_ERROR) {
                MSG_FATAL("listen: %s", g_strerror(errno));
                return MSG_ERR_UNKNOWN;
@@ -395,6 +386,10 @@ msg_error_t MsgIpcServerSocket::accept()
                return MSG_ERR_UNKNOWN;
        }
 
+       if(!MsgZoneIsAllowed(fd)) {
+               return MSG_ERR_NOT_ALLOWED_ZONE;
+       }
+
        addfd(fd);
        MSG_DEBUG("%d is added", fd);
 
index 094ee9b..885ea18 100755 (executable)
@@ -19,6 +19,7 @@
 #include <glib.h>
 #include <errno.h>
 #include <sys/stat.h>
+#include <sys/smack.h>
 
 #include "MsgTypes.h"
 #include "MsgMmsTypes.h"
 #include "MsgUtilFile.h"
 #include "MsgSmil.h"
 #include "MsgDebug.h"
+#include "MsgSerialize.h"
+#ifdef FEATURE_CONTAINER_ENABLE
+#include "MsgZoneManager.h"
+#endif // FEATURE_CONTAINER_ENABLE
 
 static void __release_glist_element(gpointer data, gpointer user_data);
 static void __release_page_element(gpointer data, gpointer user_data);
@@ -1121,7 +1126,9 @@ void MsgMmsReleaseHeader(MMS_HEADER_DATA_S **ppMmHeadersData)
 {
        if (ppMmHeadersData && *ppMmHeadersData) {
                MMS_HEADER_DATA_S *pMmsHeaderData = *ppMmHeadersData;
-
+               MsgMmsReleaseAddressList(&pMmsHeaderData->to);
+               MsgMmsReleaseAddressList(&pMmsHeaderData->cc);
+               MsgMmsReleaseAddressList(&pMmsHeaderData->bcc);
                free(pMmsHeaderData);
 
                *ppMmHeadersData = NULL;
@@ -1326,7 +1333,7 @@ int MsgMmsConvertMmsDataToMmsMessageData(MMS_DATA_S *pSrc, MMS_MESSAGE_DATA_S *p
                        gchar *contents = NULL;
                        gsize length = 0;
 
-                       g_file_get_contents(pSrc->smil->szFilePath, &contents, &length, NULL);
+                       g_file_get_contents((gchar*)pSrc->smil->szFilePath, (gchar**)&contents, (gsize*)&length, NULL);
 
                        if (contents) {
                                MsgSmilParseSmilDoc(pDst, contents);
@@ -1462,7 +1469,21 @@ int MsgMmsSetMultipartData(MMS_MULTIPART_DATA_S *pMultipart)
        if (pMultipart->pMultipartData != NULL)
                return 0;
 
-       if (g_file_get_contents(pMultipart->szFilePath, &pMultipart->pMultipartData, &pMultipart->nMultipartDataLen, NULL) == false)
+       char pTempFilePath[MSG_FILEPATH_LEN_MAX+1] = {0};
+#ifdef FEATURE_CONTAINER_ENABLE
+       char *rootPath = MsgZoneGetRootPath();
+       if (rootPath) {
+               snprintf(pTempFilePath, MSG_FILEPATH_LEN_MAX+1, "%s%s", rootPath, pMultipart->szFilePath);
+               g_free(rootPath);
+               rootPath = NULL;
+       } else {
+               snprintf(pTempFilePath, MSG_FILEPATH_LEN_MAX+1, "%s", pMultipart->szFilePath);
+       }
+#else // FEATURE_CONTAINER_ENABLE
+       snprintf(pTempFilePath, MSG_FILEPATH_LEN_MAX+1, "%s", pMultipart->szFilePath);
+#endif // FEATURE_CONTAINER_ENABLE
+
+       if (g_file_get_contents((gchar*)pTempFilePath, (gchar**)&pMultipart->pMultipartData, (gsize*)&pMultipart->nMultipartDataLen, NULL) == false)
                return -1;
 
        //Due to Get data for Backup message
@@ -1522,7 +1543,18 @@ int MsgMmsSetMultipartListFilePath(const char *dirPath, MMS_DATA_S *pMmsData)
 
        char working_dir[MSG_FILENAME_LEN_MAX+1] = {0,};
 
+#ifdef FEATURE_CONTAINER_ENABLE
+       char *rootPath = MsgZoneGetRootPath();
+       if (rootPath) {
+               snprintf(working_dir, sizeof(working_dir), "%s%s", rootPath, dirPath);
+               g_free(rootPath);
+               rootPath = NULL;
+       } else {
+               snprintf(working_dir, sizeof(working_dir), "%s", dirPath);
+       }
+#else // FEATURE_CONTAINER_ENABLE
        snprintf(working_dir, sizeof(working_dir), "%s", dirPath);
+#endif  // FEATURE_CONTAINER_ENABLE
 
        if (mkdir(working_dir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) < 0) {
                if (errno == EEXIST) {
@@ -1537,7 +1569,7 @@ int MsgMmsSetMultipartListFilePath(const char *dirPath, MMS_DATA_S *pMmsData)
 
        if (pMmsData->smil) {
                snprintf(pMmsData->smil->szFileName, sizeof(pMmsData->smil->szFileName), "%s", "smil.smil");
-               MsgMmsSetMultipartFilePath(dirPath, pMmsData->smil);
+               MsgMmsSetMultipartFilePath(working_dir, pMmsData->smil);
        }
 
        if (multipart_list) {
@@ -1547,7 +1579,7 @@ int MsgMmsSetMultipartListFilePath(const char *dirPath, MMS_DATA_S *pMmsData)
                        MMS_MULTIPART_DATA_S *pMultipart = (MMS_MULTIPART_DATA_S *)g_list_nth_data(multipart_list, i);
 
                        if (pMultipart) {
-                               MsgMmsSetMultipartFilePath(dirPath, pMultipart);//data -> svc file
+                               MsgMmsSetMultipartFilePath(working_dir, pMultipart);//data -> svc file
                        }
                }
        }
@@ -1686,3 +1718,55 @@ bool _MsgMmsRemoveEmptyObject(MMS_MESSAGE_DATA_S *pMmsMsg)
 
        return true;
 }
+
+int MsgMmsCheckFilepathSmack(int fd, const char* ipc_filename)
+{
+       int err = MSG_SUCCESS;
+
+       char *app_smack_label = NULL;
+       smack_new_label_from_socket(fd, &app_smack_label);
+       if (app_smack_label == NULL) {
+               return MSG_ERR_PERMISSION_DENIED;
+       }
+
+       MSG_DEBUG("app_smack_label [%s]", app_smack_label);
+
+       char ipc_filepath[MSG_FILEPATH_LEN_MAX+1] = {0,};
+       snprintf(ipc_filepath, MSG_FILEPATH_LEN_MAX, "%s%s", MSG_IPC_DATA_PATH, ipc_filename);
+
+       gchar *serialized_data = NULL;
+       gsize serialized_len = 0;
+       MSG_DEBUG("ipc_path [%s]", ipc_filepath);
+
+       if (!g_file_get_contents((gchar*)ipc_filepath, (gchar**)&serialized_data, (gsize*)&serialized_len, NULL)) {
+               return MSG_ERR_PERMISSION_DENIED;
+       }
+
+       MMS_DATA_S *mms_data = NULL;
+
+       MsgDeserializeMmsData(serialized_data, serialized_len, &mms_data);
+
+       if (mms_data) {
+               if (mms_data->multipartlist) {
+                       int len = g_list_length(mms_data->multipartlist);
+                       for (int i = 0; i < len; i++) {
+                               MMS_MULTIPART_DATA_S *multipart = (MMS_MULTIPART_DATA_S *)g_list_nth_data(mms_data->multipartlist, i);
+                               if (multipart) {
+                                       err = MsgCheckFilepathSmack(app_smack_label, multipart->szFilePath);
+                                       if (err != MSG_SUCCESS)
+                                               break;
+                               }
+                       }
+               }
+               if (err == MSG_SUCCESS && mms_data->smil) {
+                       err = MsgCheckFilepathSmack(app_smack_label, mms_data->smil->szFilePath);
+               }
+               MsgMmsRelease(&mms_data);
+       } else {
+               err = MSG_ERR_INVALID_PARAMETER;
+       }
+
+       MSG_FREE(serialized_data);
+       MSG_FREE(app_smack_label);
+       return err;
+}
index 621d4f0..ca84e03 100755 (executable)
@@ -363,7 +363,6 @@ int MsgParseMultipartListData(msg_json_parser_object *parse_obj, MMS_DATA_S *pMs
                                        pMultipart = NULL;
                                }
                        }
-
                } else {
                        MSG_DEBUG("Get child : idx  = %d, key = %s, type = %d, value = %p", index_child, child.key, child.type, child.value);
                }
@@ -574,9 +573,9 @@ int MsgSerializeMms(const MMS_DATA_S *pMsgData, char **pValue)
 
        bufsize += sizeof(int); // back-up type
 
-//     int bcc_cnt = g_list_length(pMsgData->header->bcc);
-//     int cc_cnt = g_list_length(pMsgData->header->cc);
        int to_cnt = 0;
+       int cc_cnt = 0;
+       int bcc_cnt = 0;
 
        bufsize += sizeof(int); // check header data
 
@@ -586,8 +585,10 @@ int MsgSerializeMms(const MMS_DATA_S *pMsgData, char **pValue)
                bufsize += sizeof(MMS_HEADER_DATA_S); // header
 
                to_cnt = g_list_length(pMsgData->header->to);
+               cc_cnt = g_list_length(pMsgData->header->cc);
+               bcc_cnt = g_list_length(pMsgData->header->bcc);
 
-               bufsize += sizeof(int);
+               bufsize += (3 * sizeof(int));
 
                MSG_DEBUG("Address \"to\" count = [%d]", to_cnt);
 
@@ -597,6 +598,18 @@ int MsgSerializeMms(const MMS_DATA_S *pMsgData, char **pValue)
                                bufsize += (sizeof(int) + sizeof(int) + strlen(addr_data->address_val)); // type, length, address
                        }
                }
+               for (i = 0; i < cc_cnt; i++) {
+                       MMS_ADDRESS_DATA_S *addr_data = (MMS_ADDRESS_DATA_S *)g_list_nth_data(pMsgData->header->cc, i);
+                       if (addr_data && addr_data->address_val) {
+                               bufsize += (sizeof(int) + sizeof(int) + strlen(addr_data->address_val)); // type, length, address
+                       }
+               }
+               for (i = 0; i < bcc_cnt; i++) {
+                       MMS_ADDRESS_DATA_S *addr_data = (MMS_ADDRESS_DATA_S *)g_list_nth_data(pMsgData->header->bcc, i);
+                       if (addr_data && addr_data->address_val) {
+                               bufsize += (sizeof(int) + sizeof(int) + strlen(addr_data->address_val)); // type, length, address
+                       }
+               }
        }
 
        bufsize += sizeof(int); // check smil data
@@ -658,6 +671,40 @@ int MsgSerializeMms(const MMS_DATA_S *pMsgData, char **pValue)
                                offset += sizeof(char)*MAX_ADDRESS_VAL_LEN;
                        }
                }
+
+               // address
+               memcpy(buf + offset, &cc_cnt, sizeof(int));
+               MSG_DEBUG("[#%2d][%5d] CC Count = %d", serial_index++, offset, cc_cnt);
+               offset += sizeof(int);
+
+               for (i = 0; i < cc_cnt; i++) {
+                       MMS_ADDRESS_DATA_S *cc_addr = (MMS_ADDRESS_DATA_S *)g_list_nth_data(pMsgData->header->cc, i);
+                       if (cc_addr && cc_addr->address_val) {
+                               memcpy(buf + offset, &cc_addr->address_type, sizeof(int));
+                               MSG_DEBUG("[#%2d][%5d] address type = %d", serial_index++, offset, cc_addr->address_type);
+                               offset += sizeof(int);
+                               memcpy(buf + offset, cc_addr->address_val, sizeof(char)*MAX_ADDRESS_VAL_LEN);
+                               MSG_SEC_DEBUG("[#%2d][%5d] address val = %s", serial_index++, offset, cc_addr->address_val);
+                               offset += sizeof(char)*MAX_ADDRESS_VAL_LEN;
+                       }
+               }
+
+               // address
+               memcpy(buf + offset, &bcc_cnt, sizeof(int));
+               MSG_DEBUG("[#%2d][%5d] BCC Count = %d", serial_index++, offset, bcc_cnt);
+               offset += sizeof(int);
+
+               for (i = 0; i < bcc_cnt; i++) {
+                       MMS_ADDRESS_DATA_S *bcc_addr = (MMS_ADDRESS_DATA_S *)g_list_nth_data(pMsgData->header->bcc, i);
+                       if (bcc_addr && bcc_addr->address_val) {
+                               memcpy(buf + offset, &bcc_addr->address_type, sizeof(int));
+                               MSG_DEBUG("[#%2d][%5d] address type = %d", serial_index++, offset, bcc_addr->address_type);
+                               offset += sizeof(int);
+                               memcpy(buf + offset, bcc_addr->address_val, sizeof(char)*MAX_ADDRESS_VAL_LEN);
+                               MSG_SEC_DEBUG("[#%2d][%5d] address val = %s", serial_index++, offset, bcc_addr->address_val);
+                               offset += sizeof(char)*MAX_ADDRESS_VAL_LEN;
+                       }
+               }
        }
 
        // 3. Smil Data
@@ -777,6 +824,48 @@ int MsgDeserializeMmsData(char* value, int value_len, MMS_DATA_S **ppMmsData)
 
                        pMmsData->header->to = g_list_append(pMmsData->header->to, (void *)to_addr);
                }
+
+               memcpy(&addr_cnt, value + offset, sizeof(int));
+               offset += sizeof(int);
+
+               pMmsData->header->cc = NULL;
+
+               for (i = 0; i < addr_cnt; i++) {
+                       MMS_ADDRESS_DATA_S* cc_addr = (MMS_ADDRESS_DATA_S*)calloc(1, sizeof(MMS_ADDRESS_DATA_S));
+                       if (cc_addr == NULL)
+                               return -1;
+
+                       memcpy(&(cc_addr->address_type), value + offset, sizeof(int));
+                       MSG_DEBUG("[#%2d][%5d] address type = %d", deserial_index++, offset, cc_addr->address_type);
+                       offset += sizeof(int);
+
+                       memcpy(cc_addr->address_val, value + offset, sizeof(char)*MAX_ADDRESS_VAL_LEN);
+                       MSG_SEC_DEBUG("[#%2d][%5d] address val = %s", deserial_index++, offset, cc_addr->address_val);
+                       offset += sizeof(char)*MAX_ADDRESS_VAL_LEN;
+
+                       pMmsData->header->cc = g_list_append(pMmsData->header->cc, (void *)cc_addr);
+               }
+
+               memcpy(&addr_cnt, value + offset, sizeof(int));
+               offset += sizeof(int);
+
+               pMmsData->header->bcc = NULL;
+
+               for (i = 0; i < addr_cnt; i++) {
+                       MMS_ADDRESS_DATA_S* bcc_addr = (MMS_ADDRESS_DATA_S*)calloc(1, sizeof(MMS_ADDRESS_DATA_S));
+                       if (bcc_addr == NULL)
+                               return -1;
+
+                       memcpy(&(bcc_addr->address_type), value + offset, sizeof(int));
+                       MSG_DEBUG("[#%2d][%5d] address type = %d", deserial_index++, offset, bcc_addr->address_type);
+                       offset += sizeof(int);
+
+                       memcpy(bcc_addr->address_val, value + offset, sizeof(char)*MAX_ADDRESS_VAL_LEN);
+                       MSG_SEC_DEBUG("[#%2d][%5d] address val = %s", deserial_index++, offset, bcc_addr->address_val);
+                       offset += sizeof(char)*MAX_ADDRESS_VAL_LEN;
+
+                       pMmsData->header->bcc = g_list_append(pMmsData->header->bcc, (void *)bcc_addr);
+               }
        }
 
        // 3. Smil Data
index 295ebe6..de520ff 100755 (executable)
@@ -917,7 +917,8 @@ bool MsgSmilAddRegion(HMsgSmil hSmilDoc, MMS_SMIL_REGION *pstSmilRegion)
                        }
 
                        if (true == pstSmilRegion->nTop.bUnitPercent) {
-                               if (pstSmilRegion->nTop.value > 0) {
+                               if (pstSmilRegion->nTop.value > 0 &&
+                                               nRootHeight != 0) {
                                        snprintf(szBuf, MSG_STDSTR_SHORT, "%d%%", pstSmilRegion->nTop.value);
                                        xmlSetProp(pstRegion, (const xmlChar *)"top", (const xmlChar *)szBuf);
                                        MSG_DEBUG("[Set Attribute] : Top : [%s]", szBuf);
@@ -1092,7 +1093,7 @@ xmlNode *MsgSmilCreateTextNode(MMS_MEDIA_S *pstSmilMedia, char *pszContentID)
 
                        if (NULL == pstParam) {
                                MSG_DEBUG("Cannot create <param> node");
-                               return false;
+                               return NULL;
                        }
 
                        xmlSetProp(pstParam, (const xmlChar *)"name", (const xmlChar *)"foreground-color");
@@ -1108,7 +1109,7 @@ xmlNode *MsgSmilCreateTextNode(MMS_MEDIA_S *pstSmilMedia, char *pszContentID)
 
                        if (NULL == pstParam) {
                                MSG_DEBUG("Cannot create <param> node");
-                               return false;
+                               return NULL;
                        }
 
                        xmlSetProp(pstParam, (const xmlChar *)"name", (const xmlChar *)"background-color");
@@ -1123,7 +1124,7 @@ xmlNode *MsgSmilCreateTextNode(MMS_MEDIA_S *pstSmilMedia, char *pszContentID)
                        pstParam = xmlNewNode(NULL, (xmlChar *)"param");
                        if (NULL == pstParam) {
                                MSG_DEBUG(" __MmsCreateTextNode: cannot create <param> node");
-                               return false;
+                               return NULL;
                        }
 
                        if (pstSmilMedia->sMedia.sText.nSize  <= MMS_SMIL_FONT_SIZE_SMALL) {
@@ -1146,7 +1147,7 @@ xmlNode *MsgSmilCreateTextNode(MMS_MEDIA_S *pstSmilMedia, char *pszContentID)
                        pstParam = xmlNewNode(NULL, (xmlChar *)"param");
                        if (NULL == pstParam) {
                                MSG_DEBUG(" __MmsCreateTextNode: cannot create <param> node");
-                               return false;
+                               return NULL;
                        }
 
                        snprintf(szSizeBuf, sizeof(szSizeBuf), "%s", "bold");
@@ -1163,7 +1164,7 @@ xmlNode *MsgSmilCreateTextNode(MMS_MEDIA_S *pstSmilMedia, char *pszContentID)
                        pstParam = xmlNewNode(NULL, (xmlChar *)"param");
                        if (NULL == pstParam) {
                                MSG_DEBUG(" __MmsCreateTextNode: cannot create <param> node");
-                               return false;
+                               return NULL;
                        }
 
                        snprintf(szSizeBuf, sizeof(szSizeBuf), "%s", "italic");
@@ -1180,7 +1181,7 @@ xmlNode *MsgSmilCreateTextNode(MMS_MEDIA_S *pstSmilMedia, char *pszContentID)
                        pstParam = xmlNewNode(NULL, (xmlChar *)"param");
                        if (NULL == pstParam) {
                                MSG_DEBUG(" __MmsCreateTextNode: cannot create <param> node");
-                               return false;
+                               return NULL;
                        }
 
                        snprintf(szSizeBuf, sizeof(szSizeBuf), "%s", "underline");
index c1581ac..1a1c9f1 100755 (executable)
@@ -88,6 +88,35 @@ msg_error_t MsgDbHandler::connect()
        return MSG_SUCCESS;
 }
 
+/* Use only in app side */
+msg_error_t MsgDbHandler::connectReadOnly()
+{
+
+       int ret = 0;
+
+       if (handle == NULL) {
+               char strDBName[64];
+
+               memset(strDBName, 0x00, sizeof(strDBName));
+               snprintf(strDBName, 64, "%s", MSGFW_DB_NAME);
+
+               MSG_DEBUG("db_util_open_with_options SQLITE_OPEN_READONLY");
+               ret = db_util_open_with_options(strDBName, &handle, SQLITE_OPEN_READONLY, NULL);
+
+               if (ret == SQLITE_OK) {
+                       MSG_DEBUG("DB Connect Success : [%p]", handle);
+                       return MSG_SUCCESS;
+               } else {
+                       MSG_DEBUG("DB Connect Fail [%d]", ret);
+                       return MSG_ERR_DB_CONNECT;
+               }
+       } else {
+               MSG_DEBUG("DB Connect exist : [%p]", handle);
+       }
+
+       return MSG_SUCCESS;
+}
+
 
 msg_error_t MsgDbHandler::disconnect()
 {
@@ -342,22 +371,6 @@ void MsgDbHandler::getMmapMutex(const char *shm_file_name)
        mmapMx = tmp;
 }
 
-void MsgDbHandler::freeMmapMutex()
-{
-       MSG_BEGIN();
-       if (!mmapMx) {
-               getMmapMutex(SHM_FILE_FOR_DB_LOCK);
-       }
-
-       if (mmapMx) {
-               int err = munmap(mmapMx, sizeof(pthread_mutex_t));
-               MSG_FATAL("pthread_mutex_munmap error [%d]", err);
-       }
-
-       MSG_END();
-}
-
-
 void MsgDbHandler::shm_mutex_timedlock (int sec)
 {
        MSG_BEGIN();
index 53e9769..95b2561 100755 (executable)
@@ -521,60 +521,6 @@ int MsgTextConvert::convertUTF8ToUCS2(OUT unsigned char *pDestText, IN int maxLe
        return ucs2Length;
 }
 
-#ifndef FEATURE_SMS_CDMA
-int MsgTextConvert::convertUTF8ToAuto(OUT unsigned char *pDestText, IN int maxLength,  IN const unsigned char *pSrcText, IN int srcTextLen, OUT MSG_LANGUAGE_ID_T *pLangId, OUT msg_encode_type_t *pCharType)
-{
-       int utf8Length = 0;
-       int gsm7bitLength = 0;
-       int ucs2Length = 0;
-
-       bool bUnknown = false;
-
-       utf8Length = srcTextLen;
-
-       int maxUCS2Length = utf8Length;         // max # of UCS2 chars, NOT bytes. when all utf8 chars are only one byte, UCS2Length is maxUCS2 Length. otherwise (ex: 2 bytes of UTF8 is one char) UCS2Length must be  less than utf8Length
-       WCHAR pUCS2Text[maxUCS2Length];
-       memset(pUCS2Text, 0x00, maxUCS2Length * sizeof(WCHAR));
-
-       MSG_DEBUG("srcTextLen = %d", srcTextLen);
-       MSG_DEBUG("temp buffer size = %d", maxUCS2Length * sizeof(WCHAR));
-       MSG_DEBUG("max dest Length = %d", maxLength);
-
-       ucs2Length = convertUTF8ToUCS2((unsigned char*)pUCS2Text, maxUCS2Length * sizeof(WCHAR), pSrcText, srcTextLen);
-
-       if(ucs2Length < 0) {
-               *pCharType = MSG_ENCODE_8BIT;
-
-               if (srcTextLen <= maxLength) {
-                       memcpy(pDestText, pSrcText, srcTextLen);
-                       return srcTextLen;
-               } else {
-                       memcpy(pDestText, pSrcText, maxLength);
-                       return maxLength;
-               }
-       } else {
-               gsm7bitLength = convertUCS2ToGSM7bit(pDestText, maxLength, (unsigned char*)pUCS2Text, ucs2Length, pLangId, &bUnknown);
-
-               if (bUnknown == true) {
-                       *pCharType = MSG_ENCODE_UCS2;
-
-                       if (ucs2Length > 0) {
-                               if(ucs2Length <= maxLength) {
-                                       memcpy(pDestText, pUCS2Text, ucs2Length);
-                                       return ucs2Length;
-                               } else {
-                                       memcpy(pDestText, pUCS2Text, maxLength);
-                                       return maxLength;
-                               }
-                       }
-               } else {
-                       *pCharType = MSG_ENCODE_GSM7BIT;
-               }
-
-               return gsm7bitLength;
-       }
-}
-#else
 
 int MsgTextConvert::convertUTF8ToAuto(OUT unsigned char *pDestText, IN int maxLength,  IN const unsigned char *pSrcText, IN int srcTextLen, OUT msg_encode_type_t *pCharType)
 {
@@ -607,13 +553,17 @@ int MsgTextConvert::convertUTF8ToAuto(OUT unsigned char *pDestText, IN int maxLe
                        return maxLength;
                }
        } else {
+#ifndef FEATURE_SMS_CDMA
+               gsm7bitLength = convertUCS2ToGSM7bitAuto(pDestText, maxLength, (unsigned char*)pUCS2Text, ucs2Length, &bUnknown);
+#else
                gsm7bitLength = convertUCS2ToASCII(pDestText, maxLength, (unsigned char*)pUCS2Text, ucs2Length, &bUnknown);
+#endif
 
                if (bUnknown == true) {
                        *pCharType = MSG_ENCODE_UCS2;
 
                        if (ucs2Length > 0) {
-                               if (ucs2Length <= maxLength) {
+                               if(ucs2Length <= maxLength) {
                                        memcpy(pDestText, pUCS2Text, ucs2Length);
                                        return ucs2Length;
                                } else {
@@ -622,13 +572,17 @@ int MsgTextConvert::convertUTF8ToAuto(OUT unsigned char *pDestText, IN int maxLe
                                }
                        }
                } else {
+#ifndef FEATURE_SMS_CDMA
+                       *pCharType = MSG_ENCODE_GSM7BIT;
+#else
                        *pCharType = MSG_ENCODE_ASCII7BIT;
+#endif
                }
 
                return gsm7bitLength;
        }
 }
-#endif
+
 
 /**
 return:
@@ -983,7 +937,72 @@ int MsgTextConvert::convertUCS2ToGSM7bit(OUT unsigned char *pDestText, IN int ma
        return outTextLen;
 }
 
+#ifndef FEATURE_SMS_CDMA
+int MsgTextConvert::convertUCS2ToGSM7bitAuto(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, OUT bool *pUnknown)
+{
+       // for UNICODE
+       int outTextLen = 0;
+       unsigned char lowerByte, upperByte;
+
+       if (srcTextLen == 0 || pSrcText == NULL || pDestText ==  NULL || maxLength == 0) {
+               MSG_DEBUG("UCS2 to GSM7bit Failed as text length is 0\n");
+               return -1;
+       }
+
+       std::map<unsigned short, unsigned char>::iterator itChar;
+       std::map<unsigned short, unsigned char>::iterator itExt;
+
+       unsigned short inText;
+
+       for (int index = 0; index < srcTextLen; index++)
+       {
+               upperByte = pSrcText[index++];
+               lowerByte = pSrcText[index];
 
+               inText = (upperByte << 8) & 0xFF00;
+               inText = inText | lowerByte;
+
+               // Check Default Char
+               itChar = ucs2toGSM7DefList.find(inText);
+
+               if (itChar != ucs2toGSM7DefList.end()) {
+                       pDestText[outTextLen++] = (unsigned char)itChar->second;
+               } else {
+                       itExt = ucs2toGSM7ExtList.find(inText);
+
+                       if (itExt != ucs2toGSM7ExtList.end()) {
+                               // prevent buffer overflow
+                               if (maxLength <= outTextLen + 1) {
+                                       MSG_DEBUG("Buffer Full.");
+                                       break;
+                               }
+
+                               pDestText[outTextLen++] = 0x1B;
+                               pDestText[outTextLen++] = (unsigned char)itExt->second;
+                       } else {
+                               MSG_DEBUG("Abnormal character is included. inText : [%04x]", inText);
+                               *pUnknown = true;
+                               return 0;
+                       }
+               }
+
+               // prevent buffer overflow
+               if (maxLength <= outTextLen) {
+                       MSG_DEBUG("Buffer full\n");
+                       break;
+               }
+       }
+
+#ifdef CONVERT_DUMP
+       MSG_DEBUG("\n########## Dump UCS2 -> GSM7bit\n");
+       convertDumpTextToHex((unsigned char*)pSrcText, srcTextLen);
+       convertDumpTextToHex((unsigned char*)pDestText, outTextLen);
+#endif
+
+       return outTextLen;
+}
+
+#else
 int MsgTextConvert::convertUCS2ToASCII(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, OUT bool *pUnknown)
 {
        // for UNICODE
@@ -1033,7 +1052,7 @@ int MsgTextConvert::convertUCS2ToASCII(OUT unsigned char *pDestText, IN int maxL
 
        return outTextLen;
 }
-
+#endif
 
 /**
  args :
index 857890c..a451730 100755 (executable)
@@ -20,6 +20,7 @@
 #include <stdlib.h>
 #include <errno.h>
 #include <sys/stat.h>
+#include <sys/smack.h>
 #include <string.h>
 #include <dirent.h>
 #include <unistd.h>    //sync()
@@ -34,7 +35,9 @@
 #include "MsgInternalTypes.h"
 #include "MsgDrmWrapper.h"
 
-
+#ifdef FEATURE_CONTAINER_ENABLE
+#include "MsgZoneManager.h"
+#endif
 /*==================================================================================================
                                      FUNCTION IMPLEMENTATION
 ==================================================================================================*/
@@ -234,10 +237,20 @@ bool MsgOpenAndReadFile(const char *pFileName, char **ppData, int *pDataSize)
 
        char fullPath[MAX_FULL_PATH_SIZE] = {0};
 
+#ifdef FEATURE_CONTAINER_ENABLE
+       char *rootPath = MsgZoneGetRootPath();
+       if (rootPath) {
+               snprintf(fullPath, MAX_FULL_PATH_SIZE, "%s%s%s", rootPath, MSG_IPC_DATA_PATH, pFileName);
+               g_free(rootPath);
+               rootPath = NULL;
+       } else {
+               snprintf(fullPath, MAX_FULL_PATH_SIZE, "%s%s", MSG_IPC_DATA_PATH, pFileName);
+       }
+#else
        snprintf(fullPath, MAX_FULL_PATH_SIZE, "%s%s", MSG_IPC_DATA_PATH, pFileName);
+#endif
        MSG_SEC_DEBUG("open file name: %s", fullPath);
 
-
        pFile = MsgOpenFile(fullPath, "rb");
 
        if (pFile == NULL) {
@@ -309,7 +322,18 @@ bool MsgWriteIpcFile(const char *pFileName, const char *pData, int DataSize)
 
        char fullPath[MAX_FULL_PATH_SIZE] = {0};
 
+#ifdef FEATURE_CONTAINER_ENABLE
+       char *rootPath = MsgZoneGetRootPath();
+       if (rootPath) {
+               snprintf(fullPath, MAX_FULL_PATH_SIZE, "%s%s%s", rootPath, MSG_IPC_DATA_PATH, pFileName);
+               g_free(rootPath);
+               rootPath = NULL;
+       } else {
+               snprintf(fullPath, MAX_FULL_PATH_SIZE, "%s%s", MSG_IPC_DATA_PATH, pFileName);
+       }
+#else
        snprintf(fullPath, MAX_FULL_PATH_SIZE, "%s%s", MSG_IPC_DATA_PATH, pFileName);
+#endif
 
        FILE *pFile = MsgOpenFile(fullPath, "wb+");
 
@@ -333,14 +357,6 @@ bool MsgWriteIpcFile(const char *pFileName, const char *pData, int DataSize)
        MsgFflush(pFile);
        MsgCloseFile(pFile);
 
-       if (MsgChmod(fullPath, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP ) == false) {
-               MSG_DEBUG("File chmod Error: %s", g_strerror(errno));
-       }
-
-       if (MsgChown(fullPath, 0, 6502 ) == false) {
-               MSG_DEBUG("File chown Error: %s", g_strerror(errno));
-       }
-
        return true;
 }
 
@@ -354,7 +370,18 @@ int MsgReadSmilFile(const char *pFileName, char **ppData)
        int     nSize = 0;
        char fullPath[MAX_FULL_PATH_SIZE] = {0};
 
+#ifdef FEATURE_CONTAINER_ENABLE
+       char *rootPath = MsgZoneGetRootPath();
+       if (rootPath) {
+               snprintf(fullPath, MAX_FULL_PATH_SIZE, "%s%s%s", rootPath, MSG_SMIL_FILE_PATH, pFileName);
+               g_free(rootPath);
+               rootPath = NULL;
+       } else {
+               snprintf(fullPath, MAX_FULL_PATH_SIZE, "%s%s", MSG_SMIL_FILE_PATH, pFileName);
+       }
+#else
        snprintf(fullPath, MAX_FULL_PATH_SIZE, "%s%s", MSG_SMIL_FILE_PATH, pFileName);
+#endif
 
        MSG_SEC_DEBUG("open file name: %s", fullPath);
 
@@ -410,6 +437,7 @@ bool MsgWriteSmilFile(const char *pFilePath,char *pData, int DataSize)
                return false;
        }
 
+#if 0
        if (mkdir(MSG_SMIL_FILE_PATH, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) < 0) {
                if (errno == EEXIST) {
                        MSG_SEC_DEBUG("The %s already exists", MSG_SMIL_FILE_PATH);
@@ -417,6 +445,7 @@ bool MsgWriteSmilFile(const char *pFilePath,char *pData, int DataSize)
                        MSG_SEC_DEBUG("Error while mkdir %s", MSG_SMIL_FILE_PATH);
                }
        }
+#endif
 
        FILE *pFile = MsgOpenFile(pFilePath, "wb+");
 
@@ -459,7 +488,18 @@ void MsgDeleteFile(const char *pFileName)
        char fullPath[MAX_FULL_PATH_SIZE] = {0};
 
        try {
+#ifdef FEATURE_CONTAINER_ENABLE
+               char *rootPath = MsgZoneGetRootPath();
+               if (rootPath) {
+                       snprintf(fullPath, MAX_FULL_PATH_SIZE, "%s%s%s", rootPath, MSG_IPC_DATA_PATH, pFileName);
+                       g_free(rootPath);
+                       rootPath = NULL;
+               } else {
+                       snprintf(fullPath, MAX_FULL_PATH_SIZE, "%s%s", MSG_IPC_DATA_PATH, pFileName);
+               }
+#else
                snprintf(fullPath, MAX_FULL_PATH_SIZE, "%s%s", MSG_IPC_DATA_PATH, pFileName);
+#endif
 
                MSG_DEBUG("%s", fullPath);
 
@@ -482,7 +522,18 @@ void MsgDeleteSmilFile(const char *pFileName)
        try {
                char fullPath[MAX_FULL_PATH_SIZE] = {0};
 
+#ifdef FEATURE_CONTAINER_ENABLE
+               char *rootPath = MsgZoneGetRootPath();
+               if (rootPath) {
+                       snprintf(fullPath, MAX_FULL_PATH_SIZE, "%s%s%s", rootPath, MSG_SMIL_FILE_PATH, pFileName);
+                       g_free(rootPath);
+                       rootPath = NULL;
+               } else {
+                       snprintf(fullPath, MAX_FULL_PATH_SIZE, "%s%s", MSG_SMIL_FILE_PATH, pFileName);
+               }
+#else
                snprintf(fullPath, MAX_FULL_PATH_SIZE, "%s%s", MSG_SMIL_FILE_PATH, pFileName);
+#endif
 
                if (remove(fullPath) != 0)
                        MSG_FATAL("File Delete Error [%s]: %s", fullPath, g_strerror(errno));
@@ -608,9 +659,6 @@ bool MsgWriteDataFromEncodeBuffer(FILE *pFile, char *pInBuffer, int *pPtr, int m
 bool MsgOpenCreateAndOverwriteFile(char *pFullPath, char *pBuff, int TotalLength)
 {
        FILE *pFile = NULL ;
-       mode_t file_mode;
-
-       file_mode = (S_IRUSR | S_IWUSR);
 
        if ((pFile = MsgOpenFile(pFullPath, "wb+")) == NULL) {
                MSG_FATAL("MsgOpenFile errer");
@@ -626,9 +674,6 @@ bool MsgOpenCreateAndOverwriteFile(char *pFullPath, char *pBuff, int TotalLength
        MsgFflush(pFile);
        MsgCloseFile(pFile);
 
-       if (!MsgChmod(pFullPath, file_mode))
-               MSG_FATAL("File chmod Error: %s", g_strerror(errno));
-
        return true;
 }
 
@@ -955,6 +1000,7 @@ bool MsgAccessFile(const char *filepath, int mode)
 
 bool MsgChmod(const char *filepath, int mode)
 {
+#if 0
        struct stat lstat_info;
        struct stat fstat_info;
        int fd;
@@ -988,6 +1034,7 @@ bool MsgChmod(const char *filepath, int mode)
        }
 
        close(fd);
+#endif
        return true;
 }
 
@@ -999,19 +1046,19 @@ bool MsgChown(const char *filepath, int uid, int gid)
        int fd;
 
        if (lstat(filepath, &lstat_info) == -1) {
-               MSG_SEC_DEBUG("No such file as [%s].", filepath);
+               MSG_SEC_INFO("No such file as [%s].", filepath);
                return false;
        }
 
        fd = open(filepath, O_RDONLY);
 
        if (fd == -1) {
-               MSG_SEC_DEBUG("Fail to open [%s].", filepath);
+               MSG_SEC_INFO("Fail to open [%s].", filepath);
                return false;
        }
 
        if (fstat(fd, &fstat_info) == -1) {
-               MSG_SEC_DEBUG("Fail to fstat [%s].", filepath);
+               MSG_SEC_INFO("Fail to fstat [%s].", filepath);
                close(fd);
                return false;
        }
@@ -1020,13 +1067,14 @@ bool MsgChown(const char *filepath, int uid, int gid)
                        lstat_info.st_ino == fstat_info.st_ino  &&
                        lstat_info.st_dev == fstat_info.st_dev) {
                if (fchown(fd, uid, gid) < 0) {
-                       MSG_SEC_DEBUG("Fail to fchown [%s].", filepath);
+                       MSG_SEC_INFO("Fail to fchown [%s].", filepath);
                        close(fd);
                        return false;
                }
        }
 
        close(fd);
+
        return true;
 }
 
@@ -1073,3 +1121,68 @@ char *MsgGetFileName(char *file_path)
 {
        return g_path_get_basename(file_path);
 }
+
+
+int MsgCheckFilepathSmack(const char *app_smack_label, char *file_path)
+{
+       int err = MSG_SUCCESS;
+
+       char *path_smack_label = NULL;
+       char *dir_smack_label = NULL;
+       char *dir_name = NULL;
+
+       if (!file_path || file_path[0] == '\0') {
+               return MSG_SUCCESS;
+       }
+
+       struct stat st;
+       if (stat(file_path, &st) != 0) {
+               MSG_DEBUG("stat(%s, &st) != 0", file_path);
+               return MSG_ERR_PERMISSION_DENIED;
+       }
+       if (S_ISDIR(st.st_mode)) {
+               MSG_DEBUG("S_ISDIR(st.st_mode)");
+               return MSG_ERR_INVALID_PARAMETER;
+       }
+
+       dir_name = MsgGetDirName(file_path);
+       if (!dir_name || !g_strcmp0(dir_name, file_path)) {
+               MSG_DEBUG("!dir_name || !g_strcmp0(dir_name, %s)", file_path);
+               err = MSG_ERR_INVALID_PARAMETER;
+               goto __RETURN;
+       }
+
+       smack_getlabel(dir_name, &dir_smack_label, SMACK_LABEL_ACCESS);
+       if (dir_smack_label == NULL) {
+               MSG_DEBUG("smack_getlabel failed (dir_smack_label)");
+               err = MSG_ERR_PERMISSION_DENIED;
+               goto __RETURN;
+       }
+
+       if (smack_have_access(app_smack_label, dir_smack_label, "RX") < 1) {
+               MSG_DEBUG("smack_have_access failed (dir_smack_label)");
+               err = MSG_ERR_PERMISSION_DENIED;
+               goto __RETURN;
+       }
+
+       smack_getlabel(file_path, &path_smack_label, SMACK_LABEL_ACCESS);
+       if (path_smack_label == NULL) {
+               MSG_DEBUG("smack_getlabel failed (path_smack_label)");
+               err = MSG_ERR_PERMISSION_DENIED;
+               goto __RETURN;
+       }
+
+       if (smack_have_access(app_smack_label, path_smack_label, "R") < 1) {
+               MSG_DEBUG("smack_have_access failed (path_smack_label)");
+               err = MSG_ERR_PERMISSION_DENIED;
+               goto __RETURN;
+       }
+
+       MSG_DEBUG("smack_have_access pass successfully");
+
+__RETURN:
+       MSG_FREE(path_smack_label);
+       MSG_FREE(dir_smack_label);
+       MSG_FREE(dir_name);
+       return err;
+}
index 57e4b0f..7205d3d 100755 (executable)
@@ -21,7 +21,7 @@
 #include <system_info.h>
 
 bool b_feature_check_flag = false;
-bool b_feature_telephony = false;
+bool b_feature_telephony_sms = false;
 bool b_feature_telephony_mms = false;
 
  /*==================================================================================================
@@ -33,19 +33,19 @@ bool MsgCheckFeatureSupport(const char *feature_name)
        bool result = false;
 
        if (b_feature_check_flag == false) {
-               if (system_info_get_platform_bool(MSG_TELEPHONY_FEATURE, &b_feature_telephony) != SYSTEM_INFO_ERROR_NONE)
-                       MSG_INFO("fail to system_info_get_platform_bool [%s]", MSG_TELEPHONY_FEATURE);
+               if (system_info_get_platform_bool(MSG_TELEPHONY_SMS_FEATURE, &b_feature_telephony_sms) != SYSTEM_INFO_ERROR_NONE)
+                       MSG_INFO("fail to system_info_get_platform_bool [%s]", MSG_TELEPHONY_SMS_FEATURE);
                if (system_info_get_platform_bool(MSG_TELEPHONY_MMS_FEATURE, &b_feature_telephony_mms) != SYSTEM_INFO_ERROR_NONE)
                        MSG_INFO("fail to system_info_get_platform_bool [%s]", MSG_TELEPHONY_MMS_FEATURE);
 
-               MSG_INFO("[%s] feature is [%d]", MSG_TELEPHONY_FEATURE, b_feature_telephony);
+               MSG_INFO("[%s] feature is [%d]", MSG_TELEPHONY_SMS_FEATURE, b_feature_telephony_sms);
                MSG_INFO("[%s] feature is [%d]", MSG_TELEPHONY_MMS_FEATURE, b_feature_telephony_mms);
 
                b_feature_check_flag = true;
        }
 
-       if (!g_strcmp0(feature_name, MSG_TELEPHONY_FEATURE)) {
-               result = b_feature_telephony;
+       if (!g_strcmp0(feature_name, MSG_TELEPHONY_SMS_FEATURE)) {
+               result = b_feature_telephony_sms;
        } else if (!g_strcmp0(feature_name, MSG_TELEPHONY_MMS_FEATURE)) {
                result = b_feature_telephony_mms;
        } else {
@@ -248,22 +248,6 @@ int MsgEncodeFilterFlag(bool *pSetFlag, char **ppDest)
 }
 
 
-int MsgEncodeMsgType(MSG_MESSAGE_TYPE_S *pMsgType, char **ppDest)
-{
-       int dataSize = 0;
-
-       dataSize = (sizeof(MSG_MESSAGE_TYPE_S));
-
-       *ppDest = (char*)new char[dataSize];
-
-       void* p = (void*)*ppDest;
-
-       memcpy(p, pMsgType, dataSize);
-
-       return dataSize;
-}
-
-
 int MsgEncodeThreadViewList(msg_struct_list_s *pThreadViewList, char **ppDest)
 {
        int count = 0, dataSize = 0;
@@ -446,7 +430,7 @@ int MsgEncodeReportStatus(MSG_REPORT_STATUS_INFO_S* pReportStatus, int count, ch
 
        memcpy(p, &count, sizeof(int));
 
-       p = (void*)((int)p + sizeof(int));
+       p = (void*)((char*)p + sizeof(int));
 
        memcpy(p, pReportStatus, sizeof(MSG_REPORT_STATUS_INFO_S)*count);
 
index 1f2b03d..719f0bc 100755 (executable)
@@ -70,7 +70,7 @@ unsigned int MsgStoAddMessageTable(MsgDbHandler *pDbHandle, const MSG_MESSAGE_IN
 
        char keyName[MAX_VCONFKEY_NAME_LEN];
        memset(keyName, 0x00, sizeof(keyName));
-       snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_IMSI, pMsgInfo->sim_idx);
+       snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_SUBS_ID, pMsgInfo->sim_idx);
 
        char *imsi = MsgSettingGetString(keyName);
 
@@ -935,231 +935,6 @@ int MsgStoGetUnreadCnt(MsgDbHandler *pDbHandle, MSG_MAIN_TYPE_T msgType)
 }
 
 
-msg_error_t MsgStoAddContactInfo(MsgDbHandler *pDbHandle, MSG_CONTACT_INFO_S *pContactInfo, const char *pNumber)
-{
-
-       if (pDbHandle == NULL || pContactInfo == NULL || pNumber == NULL) {
-               MSG_DEBUG("pDbHandle == NULL || pContactInfo == NULL || pNumber == NULL");
-               return  MSG_ERR_NULL_POINTER;
-       }
-
-       char sqlQuery[MAX_QUERY_LEN+1];
-       char displayName[MAX_DISPLAY_NAME_LEN+1];
-       memset(displayName, 0x00, sizeof(displayName));
-
-       if (strlen(pNumber) > (unsigned int)MsgContactGetMinMatchDigit()) {
-               int addrSize = strlen(pNumber);
-               char newPhoneNum[addrSize+1];
-               memset(newPhoneNum, 0x00, sizeof(newPhoneNum));
-               MsgConvertNumber(pNumber, newPhoneNum, addrSize);
-
-               MSG_SEC_DEBUG("Phone Number to Compare : [%s]", newPhoneNum);
-
-               memset(sqlQuery, 0x00, sizeof(sqlQuery));
-               snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET "
-                               "CONTACT_ID = %d, "
-                               "ADDR_BOOK_ID = %d, "
-                               "FIRST_NAME = ?, "
-                               "LAST_NAME = ?, "
-                               "MIDDLE_NAME = ?, "
-                               "PREFIX = ?, "
-                               "SUFFIX = ?, "
-                               "IMAGE_PATH = '%s' "
-                               "WHERE ADDRESS_VAL LIKE '%%%%%s';",
-                               MSGFW_ADDRESS_TABLE_NAME, pContactInfo->contactId, pContactInfo->addrbookId, pContactInfo->imagePath, newPhoneNum);
-       } else {
-               memset(sqlQuery, 0x00, sizeof(sqlQuery));
-               snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET "
-                               "CONTACT_ID = %d, "
-                               "ADDR_BOOK_ID = %d, "
-                               "FIRST_NAME = ?, "
-                               "LAST_NAME = ?, "
-                               "MIDDLE_NAME = ?, "
-                               "PREFIX = ?, "
-                               "SUFFIX = ?, "
-                               "IMAGE_PATH = '%s' "
-                               "WHERE ADDRESS_VAL = '%s';",
-                               MSGFW_ADDRESS_TABLE_NAME, pContactInfo->contactId, pContactInfo->addrbookId, pContactInfo->imagePath, pNumber);
-       }
-
-       if (pDbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) {
-               MSG_DEBUG("sqlQuery [%s]", sqlQuery);
-               return MSG_ERR_DB_PREPARE;
-       }
-
-       pDbHandle->bindText(pContactInfo->firstName, 1);
-       pDbHandle->bindText(pContactInfo->lastName, 2);
-       pDbHandle->bindText(pContactInfo->middleName, 3);
-       pDbHandle->bindText(pContactInfo->prefix, 4);
-       pDbHandle->bindText(pContactInfo->suffix, 5);
-
-       if (pDbHandle->stepQuery() != MSG_ERR_DB_DONE) {
-               pDbHandle->finalizeQuery();
-               MSG_DEBUG("Update contact Info. Fail [%s]", sqlQuery);
-               return MSG_ERR_DB_STEP;
-       }
-
-       pDbHandle->finalizeQuery();
-
-       return MSG_SUCCESS;
-}
-
-
-msg_error_t MsgStoClearContactInfoByAddrbookIdList(MsgDbHandler *pDbHandle, int* addrbookList, int addrbookCnt)
-{
-       msg_error_t err = MSG_SUCCESS;
-
-       char sqlQuery[MAX_QUERY_LEN+1];
-       int rowCnt = 0;
-
-       memset(sqlQuery, 0x00, sizeof(sqlQuery));
-
-       snprintf(sqlQuery, sizeof(sqlQuery), "SELECT DISTINCT(CONTACT_ID) FROM %s WHERE ADDR_BOOK_ID NOT IN ( ", MSGFW_ADDRESS_TABLE_NAME);
-
-       for (int i=0; i<(addrbookCnt-1); i++) {
-               snprintf(sqlQuery+strlen(sqlQuery), sizeof(sqlQuery)-strlen(sqlQuery), "%d, ", addrbookList[i]);
-       }
-
-       snprintf(sqlQuery+strlen(sqlQuery), sizeof(sqlQuery)-strlen(sqlQuery), "%d );", addrbookList[addrbookCnt-1]);
-
-       err = pDbHandle->getTable(sqlQuery, &rowCnt, NULL);
-
-       if (err != MSG_SUCCESS) {
-               pDbHandle->freeTable();
-               MSG_DEBUG("Fail to getTable().");
-               return err;
-       }
-
-       MsgDbHandler tmpDbHandle;
-       for (int i=1; i<=rowCnt; i++)
-               MsgStoClearContactInfo(&tmpDbHandle, pDbHandle->getColumnToInt(i));
-
-       pDbHandle->freeTable();
-
-       return err;
-}
-
-
-msg_error_t MsgStoClearContactInfo(MsgDbHandler *pDbHandle, int contactId)
-{
-       msg_error_t err = MSG_SUCCESS;
-
-       char sqlQuery[MAX_QUERY_LEN+1];
-       int rowCnt = 0;
-
-       memset(sqlQuery, 0x00, sizeof(sqlQuery));
-
-       snprintf(sqlQuery, sizeof(sqlQuery), "SELECT DISTINCT(CONV_ID) FROM %s WHERE CONTACT_ID = %d;",
-                       MSGFW_ADDRESS_TABLE_NAME, contactId);
-
-       err = pDbHandle->getTable(sqlQuery, &rowCnt, NULL);
-
-       if (err != MSG_SUCCESS) {
-               pDbHandle->freeTable();
-               MSG_DEBUG("[Error]Failed to Get Table");
-               return err;
-       }
-
-       memset(sqlQuery, 0x00, sizeof(sqlQuery));
-       snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET "
-                       "CONTACT_ID = 0, "
-                       "ADDR_BOOK_ID = 0, "
-                       "FIRST_NAME = '', "
-                       "LAST_NAME = '', "
-                       "MIDDLE_NAME = '', "
-                       "PREFIX = '', "
-                       "SUFFIX = '', "
-                       "IMAGE_PATH = '' "
-                       "WHERE CONTACT_ID = %d;",
-                       MSGFW_ADDRESS_TABLE_NAME,
-                       contactId);
-
-       if (pDbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
-               pDbHandle->freeTable();
-               MSG_DEBUG("Fail to execute query");
-               return MSG_ERR_DB_EXEC;
-       }
-
-       MsgDbHandler tmpDbHandle;
-       for (int i=1; i<=rowCnt; i++)
-               MsgStoSetConversationDisplayName(&tmpDbHandle, (msg_thread_id_t)pDbHandle->getColumnToInt(i));
-
-       pDbHandle->freeTable();
-
-       return err;
-}
-
-
-msg_error_t MsgStoResetContactInfo(MsgDbHandler *pDbHandle, int contactId)
-{
-       msg_error_t err = MSG_SUCCESS;
-
-       char sqlQuery[MAX_QUERY_LEN+1];
-
-       int rowCnt = 0, index = 0;
-
-       memset(sqlQuery, 0x00, sizeof(sqlQuery));
-
-       snprintf(sqlQuery, sizeof(sqlQuery), "SELECT ADDRESS_VAL, CONV_ID FROM %s WHERE CONTACT_ID = %d;",
-                       MSGFW_ADDRESS_TABLE_NAME, contactId);
-
-       err = pDbHandle->getTable(sqlQuery, &rowCnt, &index);
-
-       if (err != MSG_SUCCESS) {
-               pDbHandle->freeTable();
-               MSG_DEBUG("[Error]Failed to Get Table");
-               return err;
-       }
-
-       memset(sqlQuery, 0x00, sizeof(sqlQuery));
-       snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET "
-                       "CONTACT_ID = 0, "
-                       "ADDR_BOOK_ID = 0, "
-                       "FIRST_NAME = '', "
-                       "LAST_NAME = '', "
-                       "MIDDLE_NAME = '', "
-                       "PREFIX = '', "
-                       "SUFFIX = '', "
-                       "IMAGE_PATH = '' "
-                       "WHERE CONTACT_ID = %d;",
-                       MSGFW_ADDRESS_TABLE_NAME,
-                       contactId);
-
-       if (pDbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
-               pDbHandle->freeTable();
-               MSG_DEBUG("Fail to execute query");
-               return MSG_ERR_DB_EXEC;
-       }
-
-       MsgDbHandler tmpDbHandle;
-       for (int i=0; i<rowCnt; i++) {
-
-               char *strNumber = pDbHandle->getColumnToString(index++);
-               MSG_CONTACT_INFO_S contactInfo;
-               memset(&contactInfo, 0x00, sizeof(MSG_CONTACT_INFO_S));
-
-               if (strNumber != NULL) {
-                       MSG_SEC_DEBUG("Number [%s]", strNumber);
-
-                       MSG_ADDRESS_INFO_S addrInfo;
-                       memset(&addrInfo, 0x00, sizeof(MSG_ADDRESS_INFO_S));
-                       strncpy(addrInfo.addressVal, strNumber, MAX_ADDRESS_VAL_LEN);
-
-                       if(MsgGetContactInfo(&addrInfo, &contactInfo) == MSG_SUCCESS) {
-                               if (!MsgInsertContact(&contactInfo, strNumber))
-                                       MSG_DEBUG("MsgInsertContact fail.");
-                       }
-               }
-
-               MsgStoSetConversationDisplayName(&tmpDbHandle, (msg_thread_id_t)pDbHandle->getColumnToInt(index++));
-       }
-
-       pDbHandle->freeTable();
-
-       return err;
-}
-
-
 msg_error_t MsgStoGetMmsRawFilePath(MsgDbHandler *pDbHandle, msg_message_id_t msgId, char *pFilePath)
 {
        char sqlQuery[MAX_QUERY_LEN+1];
@@ -1759,165 +1534,10 @@ msg_error_t MsgStoGetCBChannelInfo(MsgDbHandler *pDbHandle, MSG_CB_CHANNEL_S *pC
 }
 #endif
 
-// Lists
-msg_error_t MsgStoGetFolderViewList(msg_folder_id_t folderId, const MSG_SORT_RULE_S *pSortRule, msg_struct_list_s *pMsgFolderViewList)
-{
-       if (pMsgFolderViewList == NULL) {
-               MSG_DEBUG("pMsgFolderViewList is NULL");
-               return MSG_ERR_NULL_POINTER;
-       }
-
-       MsgDbHandler *dbHandle = getDbHandle();
-
-       int rowCnt = 0, index = 0;
-
-       char sqlQuery[MAX_QUERY_LEN+1];
-       char sqlSort[64];
-
-       // Get Name Order
-       int order = MsgGetContactNameOrder();
-
-       // Get Message In Folder
-       memset(sqlQuery, 0x00, sizeof(sqlQuery));
-
-       if (folderId == MSG_ALLBOX_ID) {
-               snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID, CONV_ID, FOLDER_ID, STORAGE_ID, MAIN_TYPE, SUB_TYPE, \
-                               DISPLAY_TIME, DATA_SIZE, NETWORK_STATUS, READ_STATUS, PROTECTED, BACKUP, PRIORITY, \
-                               MSG_DIRECTION, SCHEDULED_TIME, SUBJECT, MSG_TEXT, ATTACHMENT_COUNT, THUMB_PATH \
-                               FROM %s WHERE FOLDER_ID < %d ",
-                               MSGFW_MESSAGE_TABLE_NAME, MSG_SPAMBOX_ID);
-       } else {
-               snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID, CONV_ID, FOLDER_ID, STORAGE_ID, MAIN_TYPE, SUB_TYPE, \
-                               DISPLAY_TIME, DATA_SIZE, NETWORK_STATUS, READ_STATUS, PROTECTED, BACKUP, PRIORITY, \
-                               MSG_DIRECTION, SCHEDULED_TIME, SUBJECT, MSG_TEXT, ATTACHMENT_COUNT, THUMB_PATH \
-                               FROM %s WHERE FOLDER_ID = %d ",
-                               MSGFW_MESSAGE_TABLE_NAME, folderId);
-       }
-
-       memset(sqlSort, 0x00, sizeof(sqlSort));
-       MsgMakeSortRule(pSortRule, sqlSort);
-       strncat(sqlQuery, sqlSort, strlen(sqlSort));
-
-       msg_error_t err = dbHandle->getTable(sqlQuery, &rowCnt, &index);
-
-       if (err == MSG_ERR_DB_NORECORD) {
-               pMsgFolderViewList->nCount = 0;
-               pMsgFolderViewList->msg_struct_info = NULL;
-
-               dbHandle->freeTable();
-
-               return MSG_SUCCESS;
-       } else if (err != MSG_SUCCESS) {
-               MSG_DEBUG("Fail to getTable().");
-               dbHandle->freeTable();
-               return err;
-       }
-
-       pMsgFolderViewList->nCount = rowCnt;
-
-       MSG_DEBUG("pMsgCommInfoList->nCount [%d]", pMsgFolderViewList->nCount);
-
-       pMsgFolderViewList->msg_struct_info = (msg_struct_t *)calloc(rowCnt, sizeof(msg_struct_t));
-
-       msg_struct_s *msg = NULL;
-       MSG_MESSAGE_HIDDEN_S *pTmp = NULL;
-
-       for (int i = 0; i < rowCnt; i++) {
-               pMsgFolderViewList->msg_struct_info[i] = (msg_struct_t)new msg_struct_s;
-
-               msg = (msg_struct_s *)pMsgFolderViewList->msg_struct_info[i];
-
-               msg->type = MSG_STRUCT_MESSAGE_INFO;
-               msg->data = new MSG_MESSAGE_HIDDEN_S;
-
-               pTmp = (MSG_MESSAGE_HIDDEN_S *)msg->data;
-
-               pTmp->pData = NULL;
-               pTmp->pMmsData = NULL;
-               pTmp->addressList = NULL;
-
-               pTmp->msgId = dbHandle->getColumnToInt(index++);
-               pTmp->threadId = dbHandle->getColumnToInt(index++);
-               pTmp->folderId = dbHandle->getColumnToInt(index++);
-               pTmp->storageId = dbHandle->getColumnToInt(index++);
-               pTmp->mainType = dbHandle->getColumnToInt(index++);
-               pTmp->subType = dbHandle->getColumnToInt(index++);
-               pTmp->displayTime = (time_t)dbHandle->getColumnToInt(index++);
-               pTmp->dataSize = dbHandle->getColumnToInt(index++);
-               pTmp->networkStatus = dbHandle->getColumnToInt(index++);
-               pTmp->bRead = dbHandle->getColumnToInt(index++);
-               pTmp->bProtected = dbHandle->getColumnToInt(index++);
-               pTmp->bBackup = dbHandle->getColumnToInt(index++);
-               pTmp->priority = dbHandle->getColumnToInt(index++);
-               pTmp->direction= dbHandle->getColumnToInt(index++);
-
-               index++; // This field is reserved.
-
-               dbHandle->getColumnToString(index++, MAX_SUBJECT_LEN, pTmp->subject);
-
-               if (pTmp->mainType == MSG_MMS_TYPE &&
-                       (pTmp->networkStatus == MSG_NETWORK_RETRIEVING || pTmp->networkStatus == MSG_NETWORK_RETRIEVE_FAIL || pTmp->subType == MSG_NOTIFICATIONIND_MMS)) {
-                       pTmp->pData = NULL;
-                       index++;
-               } else {
-                       pTmp->pData = (void *)new char[pTmp->dataSize + 2];
-                       memset(pTmp->pData, 0x00, pTmp->dataSize + 2);
-
-                       dbHandle->getColumnToString(index++, pTmp->dataSize+1, (char *)pTmp->pData);
-               }
-
-               // get address information from db.
-               msg_struct_list_s *addr_list = (msg_struct_list_s *)new msg_struct_list_s;
-
-               MsgDbHandler db;
-               MsgStoGetAddressByMsgId(&db, pTmp->msgId, order, addr_list);
-
-               pTmp->addr_list = addr_list;
-
-               // For GList *addressList
-               int nAddressCnt = 0;
-               MSG_ADDRESS_INFO_S *addressList = NULL;
-               MsgStoGetAddressByMsgId(&db, pTmp->msgId, order, &nAddressCnt, &addressList);
-
-               for (int i = 0; i < nAddressCnt; i++) {
-                       msg_struct_s *addr_info_s = NULL;
-                       MSG_ADDRESS_INFO_S *addr_info = NULL;
-
-                       addr_info_s = new msg_struct_s;
-                       memset(addr_info_s, 0x00, sizeof(msg_struct_s));
-
-                       addr_info_s->type = MSG_STRUCT_ADDRESS_INFO;
-                       addr_info_s->data = new MSG_ADDRESS_INFO_S;
-                       memset(addr_info_s->data, 0x00, sizeof(MSG_ADDRESS_INFO_S));
-
-                       addr_info = (MSG_ADDRESS_INFO_S *)addr_info_s->data;
-
-                       addr_info->addressType = addressList[i].addressType;
-                       addr_info->recipientType = addressList[i].recipientType;
-                       addr_info->contactId = addressList[i].contactId;
-                       strncpy(addr_info->addressVal, addressList[i].addressVal, MAX_ADDRESS_VAL_LEN);
-                       strncpy(addr_info->displayName, addressList[i].displayName, MAX_DISPLAY_NAME_LEN);
-                       addr_info->displayName[MAX_DISPLAY_NAME_LEN] = '\0';
-
-                       pTmp->addressList = g_list_append(pTmp->addressList, addr_info_s);
-               }
-
-               delete [] addressList;
-
-               pTmp->attachCount = dbHandle->getColumnToInt(index++);
-
-               dbHandle->getColumnToString(index++, MSG_FILEPATH_LEN_MAX, pTmp->thumbPath);
-       }
-
-       dbHandle->freeTable();
-
-       return MSG_SUCCESS;
-}
-
-
 msg_error_t MsgStoGetThreadViewList(const MSG_SORT_RULE_S *pSortRule, msg_struct_list_s *pThreadViewList)
 {
        MsgDbHandler *dbHandle = getDbHandle();
+       dbHandle->connectReadOnly();
 
        pThreadViewList->nCount = 0;
        pThreadViewList->msg_struct_info = NULL;
@@ -2122,6 +1742,7 @@ msg_error_t MsgStoGetConversationMultipart(MSG_CONVERSATION_VIEW_S *pConv)
 msg_error_t MsgStoGetConversationViewItem(msg_message_id_t msgId, MSG_CONVERSATION_VIEW_S *pConv)
 {
        MsgDbHandler *dbHandle = getDbHandle();
+       dbHandle->connectReadOnly();
 
        int rowCnt = 0, index = 0;
 
@@ -2208,6 +1829,7 @@ msg_error_t MsgStoGetConversationViewList(msg_thread_id_t threadId, msg_struct_l
        MSG_BEGIN();
 
        MsgDbHandler *dbHandle = getDbHandle();
+       dbHandle->connectReadOnly();
 
        pConvViewList->nCount = 0;
        pConvViewList->msg_struct_info = NULL;
@@ -2323,12 +1945,14 @@ msg_error_t MsgStoGetConversationViewList(msg_thread_id_t threadId, msg_struct_l
 }
 
 
-msg_error_t MsgStoSearchMessage(const char *pSearchString, msg_struct_list_s *pThreadViewList)
+msg_error_t MsgStoSearchMessage(const char *pSearchString, msg_struct_list_s *pThreadViewList, int contactCount)
 {
        if (!pSearchString)
                return MSG_ERR_NULL_POINTER;
 
        MsgDbHandler *dbHandle = getDbHandle();
+       dbHandle->connectReadOnly();
+
        char *escapeAddressStr = NULL;
 
        // Clear Out Parameter
@@ -2340,135 +1964,106 @@ msg_error_t MsgStoSearchMessage(const char *pSearchString, msg_struct_list_s *pT
 
        MSG_THREAD_VIEW_S threadView;
 
-       MSG_ADDRESS_INFO_S *pAddrInfo = NULL;
-       unique_ptr<MSG_ADDRESS_INFO_S*, void(*)(MSG_ADDRESS_INFO_S**)> buf(&pAddrInfo, unique_ptr_deleter);
-       int count = 0;
-
-       // get contact search list
-       if (MsgGetContactSearchList(pSearchString, &pAddrInfo, &count) != MSG_SUCCESS) {
-               MSG_DEBUG("MsgGetContactSearchList fail.");
-               count = 0;
-       }
-       int iteration = (count / ITERATION_SIZE) + 1;
-       int remaining = count;
-
-       for (int itr = 0; itr < iteration ; ++ itr) {
-               int cnt = 0;
-               (remaining > ITERATION_SIZE) ? (cnt = ITERATION_SIZE) : (cnt = remaining);
-
-               unsigned int maxlength = MAX_QUERY_LEN + (MAX_ADDRESS_VAL_LEN * cnt) +1;
-               char sqlQuery[maxlength];
-
-               // Search - Address, Name
-               memset(sqlQuery, 0x00, maxlength);
-               snprintf(sqlQuery, maxlength, "SELECT A.CONV_ID, A.UNREAD_CNT, A.SMS_CNT, A.MMS_CNT, A.DISPLAY_NAME, "
-                               "A.MAIN_TYPE, A.SUB_TYPE, A.MSG_DIRECTION, A.DISPLAY_TIME, A.MSG_TEXT, "
-                               "(SELECT COUNT(*) FROM %s B WHERE B.CONV_ID = A.CONV_ID AND B.PROTECTED = 1) AS PROTECTED, "
-                               "(SELECT COUNT(*) FROM %s B WHERE B.CONV_ID = A.CONV_ID AND B.FOLDER_ID = %d) AS DRAFT, "
-                               "(SELECT COUNT(*) FROM %s B WHERE B.CONV_ID = A.CONV_ID AND B.NETWORK_STATUS = %d) AS FAILED, "
-                               "(SELECT COUNT(*) FROM %s B WHERE B.CONV_ID = A.CONV_ID AND B.NETWORK_STATUS = %d) AS SENDING "
-                               "FROM %s A WHERE (A.SMS_CNT > 0 OR A.MMS_CNT > 0) "
-                               "AND A.CONV_ID IN "
-                               "(SELECT DISTINCT(CONV_ID) FROM %s WHERE "
-                               "ADDRESS_VAL LIKE ? ESCAPE '%c' ",
-                               MSGFW_MESSAGE_TABLE_NAME,
-                               MSGFW_MESSAGE_TABLE_NAME, MSG_DRAFT_ID,
-                               MSGFW_MESSAGE_TABLE_NAME, MSG_NETWORK_SEND_FAIL,
-                               MSGFW_MESSAGE_TABLE_NAME, MSG_NETWORK_SENDING,
-                               MSGFW_CONVERSATION_TABLE_NAME,
-                               MSGFW_ADDRESS_TABLE_NAME,
-                               MSGFW_DB_ESCAPE_CHAR);
-
-               unsigned int tmpSize = 0;
-
-               for (int i = 0; i < cnt; i++) {
-                       int addrSize = strlen(pAddrInfo[itr * ITERATION_SIZE + i].addressVal);
-                       char newPhoneNum[addrSize+1];
-                       memset(newPhoneNum, 0x00, sizeof(newPhoneNum));
-
-                       if (addrSize > MsgContactGetMinMatchDigit())
-                               MsgConvertNumber(pAddrInfo[itr * ITERATION_SIZE + i].addressVal, newPhoneNum, addrSize);
-                       else
-                               strncpy(newPhoneNum, pAddrInfo[itr * ITERATION_SIZE + i].addressVal, addrSize);
+       char sqlQuery[MAX_QUERY_LEN+1];
 
-                       tmpSize = strlen(sqlQuery);
-                       snprintf(sqlQuery+tmpSize, maxlength-tmpSize,
-                                       "OR ADDRESS_VAL LIKE '%%%s' ",
-                                       newPhoneNum);
+       // Search - Address, Name
+       memset(sqlQuery, 0x00, MAX_QUERY_LEN+1);
+       snprintf(sqlQuery, MAX_QUERY_LEN, "SELECT A.CONV_ID, A.UNREAD_CNT, A.SMS_CNT, A.MMS_CNT, A.DISPLAY_NAME, "
+                       "A.MAIN_TYPE, A.SUB_TYPE, A.MSG_DIRECTION, A.DISPLAY_TIME, A.MSG_TEXT, "
+                       "(SELECT COUNT(*) FROM %s B WHERE B.CONV_ID = A.CONV_ID AND B.PROTECTED = 1) AS PROTECTED, "
+                       "(SELECT COUNT(*) FROM %s B WHERE B.CONV_ID = A.CONV_ID AND B.FOLDER_ID = %d) AS DRAFT, "
+                       "(SELECT COUNT(*) FROM %s B WHERE B.CONV_ID = A.CONV_ID AND B.NETWORK_STATUS = %d) AS FAILED, "
+                       "(SELECT COUNT(*) FROM %s B WHERE B.CONV_ID = A.CONV_ID AND B.NETWORK_STATUS = %d) AS SENDING "
+                       "FROM %s A WHERE (A.SMS_CNT > 0 OR A.MMS_CNT > 0) "
+                       "AND A.CONV_ID IN "
+                       "(SELECT DISTINCT(CONV_ID) FROM %s WHERE "
+                       "ADDRESS_VAL LIKE ? ESCAPE '%c' ",
+                       MSGFW_MESSAGE_TABLE_NAME,
+                       MSGFW_MESSAGE_TABLE_NAME, MSG_DRAFT_ID,
+                       MSGFW_MESSAGE_TABLE_NAME, MSG_NETWORK_SEND_FAIL,
+                       MSGFW_MESSAGE_TABLE_NAME, MSG_NETWORK_SENDING,
+                       MSGFW_CONVERSATION_TABLE_NAME,
+                       MSGFW_ADDRESS_TABLE_NAME,
+                       MSGFW_DB_ESCAPE_CHAR);
 
-               }
-               remaining -= cnt;
+       unsigned int tmpSize = 0;
+       if (contactCount > 0) {
                tmpSize = strlen(sqlQuery);
-               snprintf(sqlQuery+tmpSize, maxlength-tmpSize,
-                               ") ORDER BY A.DISPLAY_TIME DESC;");
-               MSG_DEBUG("maxlength: [%d], Query Length: [%d]", maxlength, strlen(sqlQuery));
-               MSG_DEBUG("[%s]", sqlQuery);
+               snprintf(sqlQuery+tmpSize, MAX_QUERY_LEN-tmpSize,
+                               "OR ADDRESS_VAL IN (SELECT C.ADDRESS_VAL FROM %s C JOIN %s D ON (C.ADDRESS_VAL LIKE D.ADDRESS_VAL))"
+                               , MSGFW_ADDRESS_TABLE_NAME, MSGFW_ADDRESS_TEMP_TABLE_NAME);
+       }
 
-               if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) {
-                       MSG_DEBUG("Prepare query fail.");
-                       return MSG_ERR_DB_PREPARE;
-               }
+       tmpSize = strlen(sqlQuery);
+       snprintf(sqlQuery+tmpSize, MAX_QUERY_LEN-tmpSize,
+                       ") ORDER BY A.DISPLAY_TIME DESC;");
 
-               MsgConvertStrWithEscape(pSearchString, &escapeAddressStr);
-               MSG_DEBUG("escapeAddressStr [%s]", escapeAddressStr);
-               dbHandle->bindText(escapeAddressStr, 1);
-               //dbHandle->bindText(escapeAddressStr, 2);
-               //dbHandle->bindText(escapeAddressStr, 3);
-               //dbHandle->bindText(escapeAddressStr, 4);
+       MSG_DEBUG("sqlQuery=[%s]", sqlQuery);
 
-               while (dbHandle->stepQuery() == MSG_ERR_DB_ROW) {
-                       memset(&threadView, 0x00, sizeof(threadView));
+       if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) {
+               MSG_DEBUG("Prepare query fail.");
+               return MSG_ERR_DB_PREPARE;
+       }
 
-                       threadView.threadId = dbHandle->columnInt(0);
-                       threadView.unreadCnt = dbHandle->columnInt(1);
-                       threadView.smsCnt = dbHandle->columnInt(2);
-                       threadView.mmsCnt = dbHandle->columnInt(3);
+       MsgConvertStrWithEscape(pSearchString, &escapeAddressStr);
+       MSG_DEBUG("escapeAddressStr [%s]", escapeAddressStr);
+       dbHandle->bindText(escapeAddressStr, 1);
+       //dbHandle->bindText(escapeAddressStr, 2);
+       //dbHandle->bindText(escapeAddressStr, 3);
+       //dbHandle->bindText(escapeAddressStr, 4);
 
-                       if (dbHandle->columnText(4))
-                               strncpy(threadView.threadName, (char *)dbHandle->columnText(4), MAX_THREAD_NAME_LEN);
+       while (dbHandle->stepQuery() == MSG_ERR_DB_ROW) {
+               memset(&threadView, 0x00, sizeof(threadView));
 
-                       threadView.mainType = dbHandle->columnInt(5);
-                       threadView.subType = dbHandle->columnInt(6);
+               threadView.threadId = dbHandle->columnInt(0);
+               threadView.unreadCnt = dbHandle->columnInt(1);
+               threadView.smsCnt = dbHandle->columnInt(2);
+               threadView.mmsCnt = dbHandle->columnInt(3);
 
-                       threadView.direction = dbHandle->columnInt(7);
-                       threadView.threadTime = (time_t)dbHandle->columnInt(8);
+               if (dbHandle->columnText(4))
+                       strncpy(threadView.threadName, (char *)dbHandle->columnText(4), MAX_THREAD_NAME_LEN);
 
-                       if (dbHandle->columnText(9))
-                               strncpy(threadView.threadData, (char *)dbHandle->columnText(9), MAX_THREAD_DATA_LEN);
+               threadView.mainType = dbHandle->columnInt(5);
+               threadView.subType = dbHandle->columnInt(6);
 
-                       int protectedCnt = dbHandle->columnInt(10);
-                       if (protectedCnt > 0)
-                               threadView.bProtected = true;
+               threadView.direction = dbHandle->columnInt(7);
+               threadView.threadTime = (time_t)dbHandle->columnInt(8);
 
-                       int draftCnt = dbHandle->columnInt(11);
-                       if (draftCnt > 0)
-                               threadView.bDraft = true;
+               if (dbHandle->columnText(9))
+                       strncpy(threadView.threadData, (char *)dbHandle->columnText(9), MAX_THREAD_DATA_LEN);
 
-                       int failedCnt = dbHandle->columnInt(12);
-                       if (failedCnt > 0)
-                               threadView.bSendFailed = true;
+               int protectedCnt = dbHandle->columnInt(10);
+               if (protectedCnt > 0)
+                       threadView.bProtected = true;
 
-                       int sendingCnt = dbHandle->columnInt(13);
-                       if (sendingCnt > 0)
-                               threadView.bSending = true;
+               int draftCnt = dbHandle->columnInt(11);
+               if (draftCnt > 0)
+                       threadView.bDraft = true;
 
-                       tr1::unordered_set<msg_thread_id_t>::iterator it;
+               int failedCnt = dbHandle->columnInt(12);
+               if (failedCnt > 0)
+                       threadView.bSendFailed = true;
 
-                       it = IdList.find(threadView.threadId);
+               int sendingCnt = dbHandle->columnInt(13);
+               if (sendingCnt > 0)
+                       threadView.bSending = true;
 
-                       if (it == IdList.end()) {
-                               IdList.insert(threadView.threadId);
-                               searchList.push(threadView);
-                       }
+               tr1::unordered_set<msg_thread_id_t>::iterator it;
+
+               it = IdList.find(threadView.threadId);
 
+               if (it == IdList.end()) {
+                       IdList.insert(threadView.threadId);
+                       searchList.push(threadView);
                }
 
-               dbHandle->finalizeQuery();
+       }
 
-               if (escapeAddressStr) {
-                       free(escapeAddressStr);
-                       escapeAddressStr = NULL;
-               }
+       dbHandle->finalizeQuery();
+
+       if (escapeAddressStr) {
+               free(escapeAddressStr);
+               escapeAddressStr = NULL;
        }
 
 
@@ -2508,6 +2103,8 @@ msg_error_t MsgStoGetRejectMsgList(const char *pNumber, msg_struct_list_s *pReje
 {
        MsgDbHandler *dbHandle = getDbHandle();
 
+       dbHandle->connectReadOnly();
+
        // Clear Out Parameter
        pRejectMsgList->nCount = 0;
        pRejectMsgList->msg_struct_info = NULL;
@@ -2599,6 +2196,7 @@ msg_error_t MsgStoGetRejectMsgList(const char *pNumber, msg_struct_list_s *pReje
 msg_error_t MsgStoGetAddressList(const msg_thread_id_t threadId, msg_struct_list_s *pAddrList)
 {
        MsgDbHandler *dbHandle = getDbHandle();
+       dbHandle->connectReadOnly();
 
        msg_error_t err = MSG_SUCCESS;
 
@@ -2610,9 +2208,10 @@ msg_error_t MsgStoGetAddressList(const msg_thread_id_t threadId, msg_struct_list
 }
 
 
-msg_error_t MsgStoGetMessageList(const MSG_LIST_CONDITION_S *pListCond, msg_struct_list_s *pMsgList)
+msg_error_t MsgStoGetMessageList(const MSG_LIST_CONDITION_S *pListCond, msg_struct_list_s *pMsgList, int contactCount)
 {
        MsgDbHandler *dbHandle = getDbHandle();
+       dbHandle->connectReadOnly();
 
        // Clear Out Parameter
        pMsgList->nCount = 0;
@@ -2623,7 +2222,6 @@ msg_error_t MsgStoGetMessageList(const MSG_LIST_CONDITION_S *pListCond, msg_stru
 
        char sqlQuery[MAX_QUERY_LEN+1];
        char sqlQuerySubset[(MAX_QUERY_LEN/5)+1];
-       char tmpsqlQuery[MAX_QUERY_LEN+1];
 
        memset(sqlQuery, 0x00, sizeof(sqlQuery));
        snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(*) FROM %s;", MSGFW_MMS_MULTIPART_TABLE_NAME);
@@ -2828,59 +2426,7 @@ msg_error_t MsgStoGetMessageList(const MSG_LIST_CONDITION_S *pListCond, msg_stru
                                        "(B.ADDRESS_VAL LIKE ? ESCAPE '%c' ", MSGFW_DB_ESCAPE_CHAR);
                        strncat(sqlQuery, sqlQuerySubset, MAX_QUERY_LEN-strlen(sqlQuery));
 
-                       MSG_ADDRESS_INFO_S *pAddrInfo = NULL;
-                       unique_ptr<MSG_ADDRESS_INFO_S*, void(*)(MSG_ADDRESS_INFO_S**)> buf(&pAddrInfo, unique_ptr_deleter);
-                       int count = 0;
-
-                       // get contact search list
-                       if (MsgGetContactSearchList(pListCond->pAddressVal, &pAddrInfo, &count) != MSG_SUCCESS) {
-                               MSG_DEBUG("MsgGetContactSearchList fail.");
-                               count = 0;
-                       }
-
-                       if (count > 0) {
-                               dbHandle->beginTrans();
-                               // reset address temp table
-                               memset(tmpsqlQuery, 0x00, sizeof(tmpsqlQuery));
-                               snprintf(tmpsqlQuery, sizeof(tmpsqlQuery), "DELETE FROM %s;", MSGFW_ADDRESS_TEMP_TABLE_NAME);
-                               MSG_DEBUG("[%s]", tmpsqlQuery);
-
-                               if (dbHandle->prepareQuery(tmpsqlQuery) != MSG_SUCCESS)
-                                       return MSG_ERR_DB_EXEC;
-
-                               if (dbHandle->stepQuery() != MSG_ERR_DB_DONE) {
-                                       dbHandle->finalizeQuery();
-                                       dbHandle->endTrans(false);
-                                       return MSG_ERR_DB_EXEC;
-                               }
-
-                               dbHandle->finalizeQuery();
-
-                               memset(tmpsqlQuery, 0x00, sizeof(tmpsqlQuery));
-                               snprintf(tmpsqlQuery, sizeof(tmpsqlQuery), "INSERT INTO %s VALUES ('%%%%?');", MSGFW_ADDRESS_TEMP_TABLE_NAME);
-                               if (dbHandle->prepareQuery(tmpsqlQuery) != MSG_SUCCESS) {
-                                       dbHandle->endTrans(false);
-                                       return MSG_ERR_DB_PREPARE;
-                               }
-
-                               for (int i = 0; i < count; i++) {
-                                       int addrSize = strlen(pAddrInfo[i].addressVal);
-                                       char newPhoneNum[addrSize+1];
-                                       memset(newPhoneNum, 0x00, sizeof(newPhoneNum));
-                                       MsgConvertNumber(pAddrInfo[i].addressVal, newPhoneNum, addrSize);
-
-                                       dbHandle->resetQuery();
-                                       dbHandle->bindText(newPhoneNum, 1);
-                                       if (dbHandle->stepQuery() != MSG_ERR_DB_DONE) {
-                                               dbHandle->finalizeQuery();
-                                               dbHandle->endTrans(false);
-                                               return MSG_ERR_DB_EXEC;
-                                       }
-                               }
-
-                               dbHandle->finalizeQuery();
-                               dbHandle->endTrans(true);
-
+                       if (contactCount > 0) {
                                memset(sqlQuerySubset, 0x00, sizeof(sqlQuerySubset));
                                snprintf(sqlQuerySubset, sizeof(sqlQuerySubset),
                                                "OR B.ADDRESS_VAL IN (SELECT D.ADDRESS_VAL FROM %s D JOIN %s E ON (D.ADDRESS_VAL LIKE E.ADDRESS_VAL)) "
@@ -2898,60 +2444,7 @@ msg_error_t MsgStoGetMessageList(const MSG_LIST_CONDITION_S *pListCond, msg_stru
                                        "AND (B.ADDRESS_VAL LIKE ? ESCAPE '%c' ", MSGFW_DB_ESCAPE_CHAR);
                        strncat(sqlQuery, sqlQuerySubset, MAX_QUERY_LEN-strlen(sqlQuery));
 
-                       MSG_ADDRESS_INFO_S *pAddrInfo = NULL;
-                       unique_ptr<MSG_ADDRESS_INFO_S*, void(*)(MSG_ADDRESS_INFO_S**)> buf(&pAddrInfo, unique_ptr_deleter);
-                       int count = 0;
-
-                       // get contact search list
-                       if (MsgGetContactSearchList(pListCond->pAddressVal, &pAddrInfo, &count) != MSG_SUCCESS) {
-                               MSG_DEBUG("MsgGetContactSearchList fail.");
-                               count = 0;
-                       }
-
-                       if (count > 0) {
-                               dbHandle->beginTrans();
-                               // reset address temp table
-                               memset(tmpsqlQuery, 0x00, sizeof(tmpsqlQuery));
-                               snprintf(tmpsqlQuery, sizeof(tmpsqlQuery), "DELETE FROM %s;", MSGFW_ADDRESS_TEMP_TABLE_NAME);
-                               MSG_DEBUG("[%s]", tmpsqlQuery);
-
-                               if (dbHandle->prepareQuery(tmpsqlQuery) != MSG_SUCCESS) {
-                                       dbHandle->endTrans(false);
-                                       return MSG_ERR_DB_EXEC;
-                               }
-
-                               if (dbHandle->stepQuery() != MSG_ERR_DB_DONE) {
-                                       dbHandle->finalizeQuery();
-                                       return MSG_ERR_DB_EXEC;
-                               }
-
-                               dbHandle->finalizeQuery();
-
-                               memset(tmpsqlQuery, 0x00, sizeof(tmpsqlQuery));
-                               snprintf(tmpsqlQuery, sizeof(tmpsqlQuery), "INSERT INTO %s VALUES ('%%%%?');", MSGFW_ADDRESS_TEMP_TABLE_NAME);
-                               if (dbHandle->prepareQuery(tmpsqlQuery) != MSG_SUCCESS) {
-                                       dbHandle->endTrans(false);
-                                       return MSG_ERR_DB_PREPARE;
-                               }
-
-                               for (int i = 0; i < count; i++) {
-                                       int addrSize = strlen(pAddrInfo[i].addressVal);
-                                       char newPhoneNum[addrSize+1];
-                                       memset(newPhoneNum, 0x00, sizeof(newPhoneNum));
-                                       MsgConvertNumber(pAddrInfo[i].addressVal, newPhoneNum, addrSize);
-
-                                       dbHandle->resetQuery();
-                                       dbHandle->bindText(newPhoneNum, 1);
-                                       if (dbHandle->stepQuery() != MSG_ERR_DB_DONE) {
-                                               dbHandle->finalizeQuery();
-                                               dbHandle->endTrans(false);
-                                               return MSG_ERR_DB_EXEC;
-                                       }
-                               }
-
-                               dbHandle->finalizeQuery();
-                               dbHandle->endTrans(true);
-
+                       if (contactCount > 0) {
                                memset(sqlQuerySubset, 0x00, sizeof(sqlQuerySubset));
                                snprintf(sqlQuerySubset, sizeof(sqlQuerySubset),
                                                "OR B.ADDRESS_VAL IN (SELECT D.ADDRESS_VAL FROM %s D JOIN %s E ON (D.ADDRESS_VAL LIKE E.ADDRESS_VAL)) "
@@ -3227,8 +2720,11 @@ msg_error_t MsgStoGetMessageList(const MSG_LIST_CONDITION_S *pListCond, msg_stru
 msg_error_t MsgStoGetMediaList(const msg_thread_id_t threadId, msg_list_handle_t *pMediaList)
 {
        MSG_BEGIN();
+
        msg_error_t err = MSG_SUCCESS;
        MsgDbHandler *dbHandle = getDbHandle();
+       dbHandle->connectReadOnly();
+
        char sqlQuery[MAX_QUERY_LEN+1];
        int msgIdCnt = 0;
 
@@ -3247,7 +2743,7 @@ msg_error_t MsgStoGetMediaList(const msg_thread_id_t threadId, msg_list_handle_t
                return MSG_SUCCESS;
        }
 
-       msg_message_id_t *msgIds = new msg_message_id_t[msgIdCnt];
+       msg_message_id_t msgIds[msgIdCnt];
 
        for (int i = 1; i <= msgIdCnt; i++) {
                msgIds[i-1] = dbHandle->getColumnToInt(i);
@@ -3327,11 +2823,8 @@ msg_error_t MsgStoGetMediaList(const msg_thread_id_t threadId, msg_list_handle_t
                *pMediaList = (msg_list_handle_t)media_list;
        }
 
-       if (msgIds)
-               delete [] msgIds;
-
        MSG_END();
-       return err;
+       return MSG_SUCCESS;
 }
 
 #ifdef FEATURE_SMS_CDMA
index c0db4b4..e621568 100755 (executable)
@@ -228,14 +228,16 @@ if(strlen(pMsg->subject) > 0)
                                char* pFileData = NULL;
                                unique_ptr<char*, void(*)(char**)> buf(&pFileData, unique_ptr_deleter);
 
-                               int             fileSize = 0;
+                               int      fileSize = 0;
                                char*   msgText = NULL;
 
                                if (MsgOpenAndReadFile(pMsg->msgData, &pFileData, &fileSize) == false)
                                        goto __CATCH_FAIL__;
 
                                msgText = (char *)calloc(1, fileSize);
-                               memcpy(msgText, pFileData, fileSize);
+                               if(pFileData && msgText)
+                                       memcpy(msgText, pFileData, fileSize);
+
                                pObject->numOfBiData = fileSize;
                                pObject->pszValue[0] = msgText;
                        }
@@ -254,9 +256,10 @@ if(strlen(pMsg->subject) > 0)
        {
                //Insert VBody for mms raw data;
                char* pFileData = NULL;
+               unique_ptr<char*, void(*)(char**)> buf(&pFileData, unique_ptr_deleter);
                MMS_DATA_S *pMmsData = NULL;
-               int             fileSize = 0;
-               char*   msgText = NULL;
+               int fileSize = 0;
+               char* msgText = NULL;
 #if 0
                char            filePath[MSG_FILEPATH_LEN_MAX] = {0, };
                if(pMsg->msgType.subType == MSG_NOTIFICATIONIND_MMS)
@@ -285,6 +288,8 @@ if(strlen(pMsg->subject) > 0)
                } else {
                        fileSize = strlen(pMsg->msgData);
                        pFileData = (char *)calloc(1, fileSize+1);
+                       if (!pFileData)
+                               goto __CATCH_FAIL__;
                        snprintf(pFileData, fileSize, "%s", pMsg->msgData);
                }
 
@@ -292,6 +297,7 @@ if(strlen(pMsg->subject) > 0)
                if (pFileData) {
                        if (MsgDeserializeMmsData(pFileData, fileSize, &pMmsData) != 0) {
                                MSG_DEBUG("Fail to Deserialize Message Data");
+                               MsgMmsRelease(&pMmsData);
                                goto __CATCH_FAIL__;
                        }
 
@@ -578,6 +584,7 @@ if(strlen(pMsg->subject) > 0)
                                msgText = (char *)calloc(1, fileSize);
                                if (pFileData && msgText)
                                        memcpy(msgText, pFileData, fileSize);
+
                                pObject->numOfBiData = fileSize;
                                pObject->pszValue[0] = msgText;
                        }
@@ -617,6 +624,7 @@ if(strlen(pMsg->subject) > 0)
                msgText = (char *)calloc(1, fileSize);
                if(pFileData && msgText)
                        memcpy(msgText, pFileData, fileSize);
+
                pObject->numOfBiData = fileSize;
                pObject->pszValue[0] = msgText;
                pObject->valueCount = 1;
diff --git a/utils/MsgZoneManager.cpp b/utils/MsgZoneManager.cpp
new file mode 100755 (executable)
index 0000000..c545eb0
--- /dev/null
@@ -0,0 +1,342 @@
+/*
+* Copyright 2012-2013  Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.1 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*    http://floralicense.org/license/
+*
+* 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 <sys/socket.h>
+
+#include "MsgDebug.h"
+#include "MsgZoneManager.h"
+#include "MsgInternalTypes.h"
+#include "MsgUtilFile.h"
+
+#ifdef FEATURE_CONTAINER_ENABLE
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
+#define MSG_ZONE_KNOX "knox"
+#define MSG_ZONE_PERSONAL "personal"
+
+#include "MsgMutex.h"
+#include <vasum.h>
+
+#include <sys/stat.h>
+#include <fcntl.h>
+
+vsm_context_h vsm_ctx = NULL;
+vsm_zone_h real_zone = NULL;
+GIOChannel *gio_channel = NULL;
+
+int zone_ref_count = 0;
+
+
+gboolean _zone_mainloop_cb(GIOChannel *channel, GIOCondition condition, void *data)
+{
+       MSG_BEGIN();
+#ifdef FEATURE_CONTAINER_ENABLE
+       vsm_context_h ctx = (vsm_context_h)data;
+       if (ctx) {
+               vsm_enter_eventloop(ctx, 0, 0);
+       }
+       MSG_END();
+#endif
+       return true;
+}
+
+
+int _get_peer_pid(int fd)
+{
+       struct ucred cred;
+       socklen_t cr_len = sizeof(cred);
+       if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &cred, &cr_len) < 0) {
+               return -1;
+       }
+       return cred.pid;
+}
+
+#endif
+
+bool MsgZoneInit()
+{
+       MSG_BEGIN();
+#ifdef FEATURE_CONTAINER_ENABLE
+       MsgZoneClean();
+
+       vsm_ctx = vsm_create_context();
+       if (vsm_ctx == NULL) {
+               MSG_FATAL("vsm_create_context failed");
+               return false;
+       }
+
+       int fd = vsm_get_poll_fd(vsm_ctx);
+       gio_channel = g_io_channel_unix_new(fd);
+       if (gio_channel == NULL) {
+               MSG_FATAL("g_io_channel_unix_new failed");
+               MsgZoneClean();
+               return false;
+       }
+
+       g_io_add_watch(gio_channel, G_IO_IN, _zone_mainloop_cb, vsm_ctx);
+
+       MsgZoneDeclareDir();
+
+#endif
+       MSG_END();
+       return true;
+}
+
+
+void MsgZoneClean()
+{
+       MSG_BEGIN();
+#ifdef FEATURE_CONTAINER_ENABLE
+       if (vsm_ctx != NULL) {
+               vsm_cleanup_context(vsm_ctx);
+               vsm_ctx = NULL;
+       }
+
+#endif
+       MSG_END();
+}
+
+
+char* MsgZoneGetName(int fd)
+{
+       MSG_BEGIN();
+#ifdef FEATURE_CONTAINER_ENABLE
+       if (!vsm_ctx) {
+               if (MsgZoneInit() == false) {
+                       MSG_ERR("MsgZoneInit() is failed");
+                       return NULL;
+               }
+
+       }
+
+       int pid = _get_peer_pid(fd);
+       vsm_zone_h zone = vsm_lookup_zone_by_pid(vsm_ctx, pid);
+       if (zone == NULL) {
+               MSG_FATAL("vsm_lookup_zone_by_pid failed, PID = %d", pid);
+               return NULL;
+       }
+
+       MSG_END();
+       return g_strdup(vsm_get_zone_name(zone));
+#endif
+       return NULL;
+}
+
+
+/* It returns root path for current area.
+ * If it is in container, it will return "",
+ * otherwise, it will return root path of personal container.
+ */
+char* MsgZoneGetRootPath()
+{
+   MSG_BEGIN();
+#ifdef FEATURE_CONTAINER_ENABLE
+       if (!vsm_ctx) {
+               MSG_ERR("vsm_ctx is NULL");
+               return NULL;
+       } else {
+               vsm_zone_h _zone =  vsm_lookup_zone_by_name(vsm_ctx, MSG_ZONE_PERSONAL);
+               return g_strdup(vsm_get_zone_rootpath(_zone));
+       }
+#endif
+   return NULL;
+}
+
+
+void __chown_link_dir(gchar* prefix, const char* dir)
+{
+       gchar full_path[MSG_FILEPATH_LEN_MAX+1];
+       memset(full_path, 0x00, sizeof(full_path));
+       snprintf(full_path, sizeof(full_path), "%s%s", prefix, dir);
+       if (full_path[0] != '\0') {
+               if(MsgChown(full_path, 0, 5000) == 0) {
+                       MSG_DEBUG("Fail to chown [%s].", full_path);
+               }
+       }
+}
+
+
+void MsgZoneDeclareDir()
+{
+       MSG_BEGIN();
+#ifdef FEATURE_CONTAINER_ENABLE
+       if (!vsm_ctx) {
+          MSG_ERR("vsm_ctx is NULL");
+          return;
+       }
+
+       if (vsm_declare_file(vsm_ctx, VSM_FSO_TYPE_DIR, MSG_DATA_ROOT_PATH, O_CREAT|O_RDWR, 0777) != 0) {
+               MSG_DEBUG("vsm_declare_link() is failed [%s]", MSG_DATA_ROOT_PATH);
+       }
+
+       if (vsm_declare_file(vsm_ctx, VSM_FSO_TYPE_DIR, MSG_DATA_PATH, O_CREAT|O_RDWR, 0777) != 0) {
+               MSG_DEBUG("vsm_declare_link() is failed [%s]", MSG_DATA_PATH);
+       }
+
+       if (vsm_declare_file(vsm_ctx, VSM_FSO_TYPE_DIR, MSG_SMIL_FILE_PATH, O_CREAT|O_RDWR, 0777) != 0) {
+               MSG_DEBUG("vsm_declare_link() is failed [%s]", MSG_SMIL_FILE_PATH);
+       }
+
+       if (vsm_declare_file(vsm_ctx, VSM_FSO_TYPE_DIR, MSG_IPC_DATA_PATH, O_CREAT|O_RDWR, 0777) != 0) {
+               MSG_DEBUG("vsm_declare_link() is failed [%s]", MSG_IPC_DATA_PATH);
+       }
+
+   if (vsm_declare_file(vsm_ctx, VSM_FSO_TYPE_DIR, MSG_THUMBNAIL_PATH, O_CREAT|O_RDWR, 0777) != 0) {
+          MSG_DEBUG("vsm_declare_link() is failed [%s]", MSG_THUMBNAIL_PATH);
+   }
+
+       char *path_prefix = NULL;
+       path_prefix = MsgZoneGetRootPath();
+       MSG_SEC_DEBUG("personal path prefix=[%s]", path_prefix);
+
+       if (path_prefix) {
+               __chown_link_dir(path_prefix, MSG_DATA_ROOT_PATH);
+               __chown_link_dir(path_prefix, MSG_DATA_PATH);
+               __chown_link_dir(path_prefix, MSG_SMIL_FILE_PATH);
+               __chown_link_dir(path_prefix, MSG_IPC_DATA_PATH);
+               __chown_link_dir(path_prefix, MSG_THUMBNAIL_PATH);
+
+               g_free(path_prefix);
+               path_prefix = NULL;
+       }
+
+#endif
+        MSG_END();
+}
+
+
+void MsgZoneDeclareLink()
+{
+   MSG_BEGIN();
+#ifdef FEATURE_CONTAINER_ENABLE
+   if (!vsm_ctx) {
+          if (MsgZoneInit() == false) {
+                  MSG_ERR("MsgZoneInit() is failed");
+                  return;
+          }
+   }
+
+   if (vsm_declare_link(vsm_ctx, "/tmp/.msgfw_socket", "/tmp/.msgfw_socket") != 0) {
+          MSG_ERR("vsm_declare_link() is failed");
+          return;
+   }
+
+   if (vsm_declare_link(vsm_ctx, "/opt/usr/dbspace/.msg_service.db", "/opt/usr/dbspace/.msg_service.db") != 0) {
+          MSG_ERR("vsm_declare_link() is failed");
+          return;
+   }
+
+   if (vsm_declare_link(vsm_ctx, "/opt/usr/dbspace/.msg_service.db-journal", "/opt/usr/dbspace/.msg_service.db-journal") != 0) {
+          MSG_ERR("vsm_declare_link() is failed");
+          return;
+   }
+#endif
+   MSG_END();
+}
+
+
+bool MsgZoneIsAllowed(int fd)
+{
+#ifdef FEATURE_CONTAINER_ENABLE
+       char *zone_name = MsgZoneGetName(fd);
+       if (zone_name == NULL) {
+               return false;
+       }
+
+       MSG_DEBUG("zone_name=[%s]", zone_name);
+       bool result = (!g_strcmp0(zone_name, MSG_ZONE_PERSONAL) || (!g_strcmp0(zone_name, "")));
+       g_free(zone_name);
+       zone_name = NULL;
+
+       return result;
+#endif
+       return true;
+}
+
+
+void MsgZoneChange()
+{
+       MSG_BEGIN();
+#ifdef FEATURE_CONTAINER_ENABLE
+       if (vsm_ctx == NULL) {
+               if (!MsgZoneInit()) {
+                       MSG_FATAL("vsm_ctx is NULL");
+                       return;
+               }
+       }
+
+       if (real_zone != NULL && zone_ref_count > 0) {
+               zone_ref_count++;
+               MSG_DEBUG("zone_ref_count++");
+               return;
+       }
+
+       vsm_zone_h current_zone = vsm_get_foreground(vsm_ctx);
+       vsm_zone_h effective_zone = vsm_lookup_zone_by_name(vsm_ctx, MSG_ZONE_PERSONAL);
+
+       if (!current_zone) {
+               MSG_DEBUG("current_zone is NULL");
+               return;
+       }
+
+       if (!effective_zone) {
+               MSG_DEBUG("effective_zone is NULL");
+               return;
+       }
+
+       if (real_zone) {
+               MSG_DEBUG("real_zone is not NULL");
+               return;
+       }
+
+       mx.lock();
+//     if (!g_strcmp0(vsm_get_zone_name(current_zone), MSG_ZONE_KNOX) && real_zone == NULL) {
+       if (real_zone == NULL) {
+               real_zone = vsm_join_zone(effective_zone);
+               if (real_zone) {
+                       MSG_DEBUG("Change Zone");
+                       zone_ref_count++;
+               }
+       }
+       mx.unlock();
+#endif
+       MSG_END();
+}
+
+
+void MsgZoneRevert()
+{
+       MSG_BEGIN();
+#ifdef FEATURE_CONTAINER_ENABLE
+       if (real_zone == NULL || zone_ref_count == 0) {
+               MSG_FATAL("real_zone == NULL || zone_ref_count == 0");
+               return;
+       }
+
+       zone_ref_count--;
+       mx.lock();
+       if (zone_ref_count == 0) {
+               vsm_join_zone(real_zone);
+               real_zone = NULL;
+               MSG_DEBUG("Revert Zone");
+       }
+       mx.unlock();
+#endif
+       MSG_END();
+}
index 08cec7b..ca72a27 100755 (executable)
@@ -9,7 +9,7 @@ ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
 MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")
 
 #SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -O0 -g -Wall")
-SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -O0 -g -Wall")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -O2 -g -Wall")
 
 SET(VOBJECT-SRCS
                ${CMAKE_SOURCE_DIR}/vobject-engine/VCard.c
index 9835886..f57dcf0 100755 (executable)
@@ -1187,8 +1187,7 @@ vcard_encode( VTree *pVCardRaw )
                return NULL;
        }
        g_strlcat( pVCardRes, "END:VCARD\r\n", total - strlen(pVCardRes));
-
-       VDATA_TRACE_END
+       VDATA_TRACE_END
        return pVCardRes;
 }
 
@@ -1459,7 +1458,6 @@ __VCardParamEncode(VObject* pTypeObj, int* pEnc)
 
                /** appending paramter name. */
                g_strlcat( szParam, ";", len - strlen(szParam) );
-
                if(pTemp->parameter != VCARD_PARAM_TYPE) {
                        g_strlcat( szParam, pszCardParamList[pTemp->parameter], len - strlen(szParam));
                        g_strlcat( szParam, "=", len - strlen(szParam));
index 1fa815a..ce2204e 100755 (executable)
@@ -405,8 +405,8 @@ _VB64Encode( char *Dest, char *Src, int len )
        int             index;
        int             res = 0;
        int             base1 = 0, base2 = 0;
-       char    Enbuffer[4];
-       char    Debuffer[3];
+       char    Enbuffer[4] = {0,};
+       char    Debuffer[3] = {0,};
        int             length = 0;
 
        for ( i = 0; i < 4; i++ )
index 8f069ee..a3dc504 100755 (executable)
@@ -1584,7 +1584,6 @@ __VMsgParamEncode(VObject* pTypeObj, int* pEnc)
                                        return NULL;
                                }
                                g_strlcat( szParam, "NONE", strlen("NONE"));
-
                }
 
                /** exchage parameter value's to string.*/