From: jk7744.park Date: Sat, 24 Oct 2015 07:46:33 +0000 (+0900) Subject: tizen 2.4 release X-Git-Tag: submit/tizen_2.4/20151028.064312 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ecb47d6862c1fb91394be5249ad38e0c72b20118;p=framework%2Fmessaging%2Fmsg-service.git tizen 2.4 release --- diff --git a/CMakeLists.txt b/CMakeLists.txt index f4d7bdb..b91f2af 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/doc/msg_service_doc.h b/doc/msg_service_doc.h index 6617947..77be966 100644 --- a/doc/msg_service_doc.h +++ b/doc/msg_service_doc.h @@ -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. diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt index 10c4638..a8de2c4 100755 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt @@ -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 diff --git a/externals/MsgAlarm.cpp b/externals/MsgAlarm.cpp index 1c53a3f..fb6091b 100755 --- a/externals/MsgAlarm.cpp +++ b/externals/MsgAlarm.cpp @@ -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_t* alarm_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; diff --git a/externals/MsgDevicedWrapper.cpp b/externals/MsgDevicedWrapper.cpp index 005aa77..2648090 100644 --- a/externals/MsgDevicedWrapper.cpp +++ b/externals/MsgDevicedWrapper.cpp @@ -17,6 +17,7 @@ #include +#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."); diff --git a/externals/MsgNotificationWrapper.cpp b/externals/MsgNotificationWrapper.cpp index 01e781e..0370069 100755 --- a/externals/MsgNotificationWrapper.cpp +++ b/externals/MsgNotificationWrapper.cpp @@ -28,26 +28,32 @@ #include "MsgNotificationWrapper.h" #include "MsgSoundPlayer.h" #include "MsgDevicedWrapper.h" +#include "MsgZoneManager.h" + #include #include #include extern "C" { -#include -#include +#include +#include +#ifndef MSG_WEARABLE_PROFILE +#include +#include #include #include -#include +#include +#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(¬i_info, msg_info); + + noti_h = notification_create(NOTIFICATION_TYPE_NOTI); + + setActiveNotification(noti_h, ¬i_info); + + clearInfoData(noti_h, ¬i_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, ¬i_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(¬i_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(¬i_info, bTicker); + createInfoData(¬i_info, active_type); noti_h = getHandle(¬i_info.id); @@ -419,6 +472,7 @@ msg_error_t MsgRefreshNotification(msg_notification_type_t noti_type, bool bFeed setNotification(noti_h, ¬i_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(¬i_info); } +#endif __END_OF_REFRESH_NOTI : clearInfoData(noti_h, ¬i_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, ¬i_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, ¬i_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(¬i_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(¬i_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(¬i_info, 0x00, sizeof(MSG_NOTI_INFO_S)); - - noti_info.type = noti_type; - msg_err = getLatestMsgInfo(¬i_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(¬i_info, 0x00, sizeof(MSG_NOTI_INFO_S)); + + noti_info.type = noti_type; + msg_err = getLatestMsgInfo(¬i_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(¬i_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(¬i_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(¬i_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, ¬i_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, ¬i_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 */ diff --git a/externals/MsgSensorWrapper.cpp b/externals/MsgSensorWrapper.cpp index 1dc502d..75e4547 100755 --- a/externals/MsgSensorWrapper.cpp +++ b/externals/MsgSensorWrapper.cpp @@ -20,70 +20,91 @@ #include "MsgGconfWrapper.h" #include "MsgSensorWrapper.h" +#ifndef MSG_WEARABLE_PROFILE #include /*================================================================================================== 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; } diff --git a/externals/MsgSoundPlayer.cpp b/externals/MsgSoundPlayer.cpp index 784f4e9..9aa267c 100755 --- a/externals/MsgSoundPlayer.cpp +++ b/externals/MsgSoundPlayer.cpp @@ -16,6 +16,7 @@ #include +#include "MsgCallStatusManager.h" #include "MsgDebug.h" #include "MsgCppTypes.h" #include "MsgGconfWrapper.h" @@ -29,19 +30,23 @@ #include "MsgNotificationWrapper.h" #include "MsgSoundPlayer.h" +#ifndef MSG_WEARABLE_PROFILE + #include #include #include #include #include +#include +#include /*================================================================================================== 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(); } diff --git a/externals/MsgSpamFilter.cpp b/externals/MsgSpamFilter.cpp index ec47690..0599e01 100755 --- a/externals/MsgSpamFilter.cpp +++ b/externals/MsgSpamFilter.cpp @@ -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); diff --git a/framework/CMakeLists.txt b/framework/CMakeLists.txt index 596bba3..5fc8c2f 100755 --- a/framework/CMakeLists.txt +++ b/framework/CMakeLists.txt @@ -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}") diff --git a/framework/deliver-handler/MsgDeliverHandler.cpp b/framework/deliver-handler/MsgDeliverHandler.cpp index 0b4e336..eccda5c 100755 --- a/framework/deliver-handler/MsgDeliverHandler.cpp +++ b/framework/deliver-handler/MsgDeliverHandler.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#include +#include #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) { diff --git a/framework/main.cpp b/framework/main.cpp index cfd57d5..36cd7c8 100755 --- a/framework/main.cpp +++ b/framework/main.cpp @@ -17,6 +17,7 @@ /*================================================================================================== INCLUDE FILES ==================================================================================================*/ +#include "MsgCallStatusManager.h" #include "MsgDebug.h" #include "MsgException.h" #include "MsgContact.h" @@ -34,10 +35,10 @@ #include "MsgUtilFile.h" #include "MsgUtilStorage.h" #include "MsgNotificationWrapper.h" +#include "MsgZoneManager.h" #include #include -#include #include #include @@ -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; } diff --git a/framework/plugin-manager/MsgPluginManager.cpp b/framework/plugin-manager/MsgPluginManager.cpp index 3b5f174..836afce 100755 --- a/framework/plugin-manager/MsgPluginManager.cpp +++ b/framework/plugin-manager/MsgPluginManager.cpp @@ -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}; diff --git a/framework/setting-handler/MsgSettingHandler.cpp b/framework/setting-handler/MsgSettingHandler.cpp index f805bab..6f44866 100755 --- a/framework/setting-handler/MsgSettingHandler.cpp +++ b/framework/setting-handler/MsgSettingHandler.cpp @@ -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); diff --git a/framework/storage-handler/MsgStorageManager.cpp b/framework/storage-handler/MsgStorageManager.cpp index 6366cc7..4b6e34e 100755 --- a/framework/storage-handler/MsgStorageManager.cpp +++ b/framework/storage-handler/MsgStorageManager.cpp @@ -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); diff --git a/framework/storage-handler/MsgStorageMessage.cpp b/framework/storage-handler/MsgStorageMessage.cpp index 06f9250..f9587be 100755 --- a/framework/storage-handler/MsgStorageMessage.cpp +++ b/framework/storage-handler/MsgStorageMessage.cpp @@ -28,15 +28,17 @@ #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 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); diff --git a/framework/storage-handler/MsgStorageMms.cpp b/framework/storage-handler/MsgStorageMms.cpp index 91b5534..74a8276 100755 --- a/framework/storage-handler/MsgStorageMms.cpp +++ b/framework/storage-handler/MsgStorageMms.cpp @@ -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); diff --git a/framework/storage-handler/MsgStorageUtil.cpp b/framework/storage-handler/MsgStorageUtil.cpp index e6925aa..95cad90 100755 --- a/framework/storage-handler/MsgStorageUtil.cpp +++ b/framework/storage-handler/MsgStorageUtil.cpp @@ -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; } diff --git a/framework/submit-handler/MsgSubmitHandler.cpp b/framework/submit-handler/MsgSubmitHandler.cpp index fa0aff2..8d5e382 100755 --- a/framework/submit-handler/MsgSubmitHandler.cpp +++ b/framework/submit-handler/MsgSubmitHandler.cpp @@ -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; diff --git a/framework/transaction-manager/MsgCmdHandlerStorage.cpp b/framework/transaction-manager/MsgCmdHandlerStorage.cpp index e28ce3d..e8c05e9 100755 --- a/framework/transaction-manager/MsgCmdHandlerStorage.cpp +++ b/framework/transaction-manager/MsgCmdHandlerStorage.cpp @@ -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; icmdData) + (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 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 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 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()"); diff --git a/framework/transaction-manager/MsgCmdHandlerTransport.cpp b/framework/transaction-manager/MsgCmdHandlerTransport.cpp index 7d5e884..425ced7 100755 --- a/framework/transaction-manager/MsgCmdHandlerTransport.cpp +++ b/framework/transaction-manager/MsgCmdHandlerTransport.cpp @@ -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); diff --git a/framework/transaction-manager/MsgTransManager.cpp b/framework/transaction-manager/MsgTransManager.cpp index e6ffc38..0fe6f84 100755 --- a/framework/transaction-manager/MsgTransManager.cpp +++ b/framework/transaction-manager/MsgTransManager.cpp @@ -21,6 +21,8 @@ #include #include +#include +#include #include "MsgDebug.h" #include "MsgMemory.h" @@ -38,7 +40,12 @@ #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 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(); } diff --git a/include/common/MsgCmdTypes.h b/include/common/MsgCmdTypes.h index 9710252..cf5be05 100755 --- a/include/common/MsgCmdTypes.h +++ b/include/common/MsgCmdTypes.h @@ -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 diff --git a/include/common/MsgCppTypes.h b/include/common/MsgCppTypes.h index 1e5f4a2..746b7e7 100755 --- a/include/common/MsgCppTypes.h +++ b/include/common/MsgCppTypes.h @@ -25,7 +25,8 @@ template void unique_ptr_deleter( T **ptr ) { - if (ptr && *ptr ) delete[] *ptr; + if (ptr && *ptr ) + delete[] *ptr; } template diff --git a/include/common/MsgInternalTypes.h b/include/common/MsgInternalTypes.h index 13cae23..3194ec0 100755 --- a/include/common/MsgInternalTypes.h +++ b/include/common/MsgInternalTypes.h @@ -40,10 +40,7 @@ // 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 @@ -66,7 +63,10 @@ #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" @@ -86,11 +86,10 @@ #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" @@ -101,7 +100,6 @@ #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 @@ -186,9 +184,10 @@ #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 . */ diff --git a/include/common/MsgSettingTypes.h b/include/common/MsgSettingTypes.h index 733096d..ab30fb0 100755 --- a/include/common/MsgSettingTypes.h +++ b/include/common/MsgSettingTypes.h @@ -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; diff --git a/include/common/MsgStorageTypes.h b/include/common/MsgStorageTypes.h index ca6c3d0..f882676 100755 --- a/include/common/MsgStorageTypes.h +++ b/include/common/MsgStorageTypes.h @@ -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 diff --git a/include/externals/MsgAlarm.h b/include/externals/MsgAlarm.h index 954b147..f125515 100755 --- a/include/externals/MsgAlarm.h +++ b/include/externals/MsgAlarm.h @@ -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 */ diff --git a/include/externals/MsgNotificationWrapper.h b/include/externals/MsgNotificationWrapper.h index 85ab130..0f82d2d 100755 --- a/include/externals/MsgNotificationWrapper.h +++ b/include/externals/MsgNotificationWrapper.h @@ -28,40 +28,42 @@ ==================================================================================================*/ #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" @@ -75,12 +77,10 @@ #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" @@ -100,16 +100,18 @@ #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" @@ -121,14 +123,12 @@ #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" @@ -148,7 +148,9 @@ #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" @@ -156,24 +158,23 @@ #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(); diff --git a/include/externals/MsgSensorWrapper.h b/include/externals/MsgSensorWrapper.h index ab1e279..ed7014f 100755 --- a/include/externals/MsgSensorWrapper.h +++ b/include/externals/MsgSensorWrapper.h @@ -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 */ diff --git a/include/externals/MsgSoundPlayer.h b/include/externals/MsgSoundPlayer.h index 0aec565..c9fa4a0 100755 --- a/include/externals/MsgSoundPlayer.h +++ b/include/externals/MsgSoundPlayer.h @@ -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 */ diff --git a/include/externals/MsgSpamFilter.h b/include/externals/MsgSpamFilter.h index ea67d8e..beba140 100755 --- a/include/externals/MsgSpamFilter.h +++ b/include/externals/MsgSpamFilter.h @@ -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 */ diff --git a/include/framework/MsgCmdHandler.h b/include/framework/MsgCmdHandler.h index eb8fe6d..ffe0462 100755 --- a/include/framework/MsgCmdHandler.h +++ b/include/framework/MsgCmdHandler.h @@ -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); diff --git a/include/framework/MsgStorageHandler.h b/include/framework/MsgStorageHandler.h index a6dae82..bad0eb2 100755 --- a/include/framework/MsgStorageHandler.h +++ b/include/framework/MsgStorageHandler.h @@ -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); diff --git a/include/framework/MsgTransManager.h b/include/framework/MsgTransManager.h index e8294a6..43dfab4 100755 --- a/include/framework/MsgTransManager.h +++ b/include/framework/MsgTransManager.h @@ -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); diff --git a/include/mapi/msg.h b/include/mapi/msg.h index 4ded743..2dc47b6 100755 --- a/include/mapi/msg.h +++ b/include/mapi/msg.h @@ -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); diff --git a/include/mapi/msg_private.h b/include/mapi/msg_private.h index 92168ba..407c725 100755 --- a/include/mapi/msg_private.h +++ b/include/mapi/msg_private.h @@ -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); diff --git a/include/mapi/msg_storage.h b/include/mapi/msg_storage.h index 837af02..2cd864f 100755 --- a/include/mapi/msg_storage.h +++ b/include/mapi/msg_storage.h @@ -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 * diff --git a/include/mapi/msg_storage_types.h b/include/mapi/msg_storage_types.h index 792d6ef..397f01e 100755 --- a/include/mapi/msg_storage_types.h +++ b/include/mapi/msg_storage_types.h @@ -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*/ diff --git a/include/mapi/msg_transport.h b/include/mapi/msg_transport.h index 16c1ec4..2e71c1d 100755 --- a/include/mapi/msg_transport.h +++ b/include/mapi/msg_transport.h @@ -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); /** diff --git a/include/mapi/msg_transport_types.h b/include/mapi/msg_transport_types.h index d27811f..2bd4c2c 100755 --- a/include/mapi/msg_transport_types.h +++ b/include/mapi/msg_transport_types.h @@ -25,7 +25,6 @@ #include "msg_storage_types.h" /** - * @internal * @addtogroup MSG_SERVICE_FRAMEWORK_TRANSPORT_MODULE * @{ */ diff --git a/include/mapi/msg_types.h b/include/mapi/msg_types.h index 3cfa5ab..021ab27 100755 --- a/include/mapi/msg_types.h +++ b/include/mapi/msg_types.h @@ -28,7 +28,6 @@ #endif /** - * @internal * @addtogroup MSG_SERVICE_FRAMEWORK * @{ */ @@ -135,9 +134,9 @@ /** * @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 */ @@ -171,12 +170,12 @@ /** * @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 @@ -191,7 +190,7 @@ /** * @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 @@ -216,39 +215,39 @@ /** * @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, /**