diff options
Diffstat (limited to 'manager/src/msg-manager-notification.cpp')
-rw-r--r-- | manager/src/msg-manager-notification.cpp | 133 |
1 files changed, 121 insertions, 12 deletions
diff --git a/manager/src/msg-manager-notification.cpp b/manager/src/msg-manager-notification.cpp index 533ba53..7773359 100644 --- a/manager/src/msg-manager-notification.cpp +++ b/manager/src/msg-manager-notification.cpp @@ -64,6 +64,7 @@ int g_alarmId = 0; ==================================================================================================*/ typedef struct _report_notification_s { + msg_mgr_notification_type_t noti_type; int priv_id; char addressVal[MAX_ADDRESS_VAL_LEN+1]; } report_notification_s; @@ -233,11 +234,18 @@ void MsgMgrInitReportNotiList() report_notification_s *info = new report_notification_s; memset(info, 0x00, sizeof(report_notification_s)); + char *noti_type = NULL; + ret = app_control_get_extra_data(app_control, "noti_type", ¬i_type); + if (ret == APP_CONTROL_ERROR_NONE && noti_type != NULL) { + info->noti_type = (msg_mgr_notification_type_t)atoi(noti_type); + g_free(noti_type); + } + notification_get_id(noti, NULL, &(info->priv_id)); snprintf(info->addressVal, sizeof(info->addressVal), "%s", addr); msg_report_notification_list = g_list_append(msg_report_notification_list, (void *)info); - MSG_MGR_SEC_DEBUG("appended list data = [priv_id = %d address = %s]", info->priv_id, info->addressVal); + MSG_MGR_SEC_DEBUG("appended list data = [noti_type = %d priv_id = %d address = %s]", info->noti_type, info->priv_id, info->addressVal); g_free(addr); addr = NULL; @@ -433,6 +441,7 @@ int MsgMgrAddReportNotification(msg_mgr_notification_type_t noti_type, MSG_MGR_M int ret = 0; notification_h noti_h = NULL; + bool isNewNoti = false; report_notification_s *info = new report_notification_s; memset(info, 0x00, sizeof(report_notification_s)); @@ -442,6 +451,9 @@ int MsgMgrAddReportNotification(msg_mgr_notification_type_t noti_type, MSG_MGR_M createInfoData(¬i_info, msg_info); + if (noti_info.id == 0) + isNewNoti = true; + noti_h = getHandle(¬i_info.id); if (noti_h == NULL) { @@ -464,6 +476,40 @@ int MsgMgrAddReportNotification(msg_mgr_notification_type_t noti_type, MSG_MGR_M addServiceExtraData(noti_info.svc_h, "is_report_noti", "true"); setNotification(noti_h, ¬i_info, true); + if (noti_type == MSG_MGR_NOTI_TYPE_MMS_DELIVERY_REPORT) + noti_type = MSG_MGR_NOTI_TYPE_SMS_DELIVERY_REPORT; + + if (isNewNoti) { + report_notification_s *info = new report_notification_s; + memset(info, 0x00, sizeof(report_notification_s)); + + info->noti_type = noti_type; + info->priv_id = noti_info.id; + snprintf(info->addressVal, sizeof(info->addressVal), "%s", msg_info->addressVal); + msg_report_notification_list = g_list_append(msg_report_notification_list, (void *)info); + MSG_MGR_SEC_DEBUG("appended list data = [priv_id = %d address = %s]", info->priv_id, info->addressVal); + } else { + GList *iter = g_list_first(msg_report_notification_list); + + while (iter != NULL) { + report_notification_s *info = (report_notification_s*)(iter->data); + if (info == NULL) { + MSG_MGR_DEBUG("info is NULL!"); + continue; + } + + // update new addressVal of noti_type + if (info->priv_id == noti_info.id) { + memset(info->addressVal, 0x00, MAX_ADDRESS_VAL_LEN+1); + snprintf(info->addressVal, sizeof(info->addressVal), "%s", msg_info->addressVal); + MSG_MGR_SEC_DEBUG("updated list data = [priv_id = %d address = %s]", info->priv_id, info->addressVal); + break; + } + + iter = g_list_next(iter); + } + } + info->priv_id = noti_info.id; snprintf(info->addressVal, sizeof(info->addressVal), "%s", msg_info->addressVal); msg_report_notification_list = g_list_append(msg_report_notification_list, (void *)info); @@ -639,6 +685,41 @@ int MsgMgrDeleteNoti(msg_mgr_notification_type_t noti_type, int simIndex) } +int MsgMgrDeleteSentReadReportNotification() +{ + int readReportSentNotiId = 0; + int noti_err = 0; + + if (vconf_get_int(VCONFKEY_MESSAGE_READ_REPORT_SENT_NOTI_ID, &readReportSentNotiId) != 0) { + MSG_MGR_INFO("vconf_get_int() is failed"); + return -1; + } + + if (readReportSentNotiId > 0) { + noti_err = notification_delete_by_priv_id(MSG_DEFAULT_APP_ID, NOTIFICATION_TYPE_NOTI, readReportSentNotiId); + if (noti_err != 0) { + MSG_MGR_DEBUG("notification_delete_by_priv_id() fail [%d]", noti_err); + return -1; + } + } else { + MSG_MGR_DEBUG("VCONFKEY_MESSAGE_READ_REPORT_SENT_NOTI_ID is 0"); + return -1; + } + + if (vconf_set_int(VCONFKEY_MESSAGE_READ_REPORT_SENT_NOTI_ID, 0) != 0) { + MSG_MGR_DEBUG("vconf_set_int fail : VCONFKEY_MESSAGE_READ_REPORT_SENT_NOTI_ID"); + return -1; + } + + if (vconf_set_int(VCONFKEY_MESSAGE_READ_REPORT_SENT_MSG_ID, 0) != 0) { + MSG_MGR_DEBUG("vconf_set_int fail : VCONFKEY_MESSAGE_READ_REPORT_SENT_MSG_ID"); + return -1; + } + + return 0; +} + + void MsgMgrRefreshAllNotification(bool bWithSimNoti, bool bFeedback, msg_mgr_active_notification_type_t active_type) { MSG_MGR_BEGIN(); @@ -925,17 +1006,15 @@ void setText(notification_h noti_h, MSG_MGR_NOTI_INFO_S *noti_info) } case MSG_MGR_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); + char readStatusString[50] = {0,}; 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 + snprintf(readStatusString, sizeof(readStatusString), "Message deleted by %s", noti_info->sender); + notification_set_text(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, readStatusString, MESSAGE_DELETED_BY_PS, NOTIFICATION_VARIABLE_TYPE_STRING, noti_info->sender, NOTIFICATION_VARIABLE_TYPE_NONE); } else { - setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message read", READ_REPORT_READ); + char readStatusString[50] = {0,}; + snprintf(readStatusString, sizeof(readStatusString), "Message read by %s", noti_info->sender); + notification_set_text(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, readStatusString, MESSAGE_READ_BY_PS, NOTIFICATION_VARIABLE_TYPE_STRING, noti_info->sender, NOTIFICATION_VARIABLE_TYPE_NONE); } setNotiTime(noti_h, noti_info->time); @@ -962,6 +1041,18 @@ void setText(notification_h noti_h, MSG_MGR_NOTI_INFO_S *noti_info) setNotiTime(noti_h, noti_info->time); break; } + case MSG_MGR_NOTI_TYPE_MMS_READ_REPORT_SENT: { + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "Messages", MSG_MESSAGE); + + if ((int)noti_info->extra_data == MSG_NETWORK_SEND_FAIL) { + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, "Failed to send Read report", FAILED_TO_SEND_MMS_READ_REPORT); + } else { + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, "Read report sent", MMS_READ_REPORT_SENT); + } + + setNotiTime(noti_h, noti_info->time); + break; + } case MSG_MGR_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); @@ -1065,6 +1156,10 @@ void setIcon(notification_h noti_h, MSG_MGR_NOTI_INFO_S *noti_info) 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_MGR_NOTI_TYPE_MMS_READ_REPORT_SENT: + 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_MGR_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); @@ -1145,9 +1240,9 @@ void setActiveText(notification_h noti_h, MSG_MGR_NOTI_INFO_S *noti_info) if (noti_info->active_media_cnt > 1) { char attach_string[20] = {0,}; snprintf(attach_string, sizeof(attach_string), "%d attachments", noti_info->active_media_cnt); - setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, attach_string, NULL); + notification_set_text(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, attach_string, MSG_PD_ATTACHMENTS, NOTIFICATION_VARIABLE_TYPE_INT, noti_info->active_media_cnt, NOTIFICATION_VARIABLE_TYPE_NONE); } else if (noti_info->active_media_cnt == 1) { - setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, "1 attachment", NULL); + setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, "1 attachment", MSG_SINGLE_ATTACHMENT); } } } else { @@ -1329,7 +1424,7 @@ void setSoundAndVibration(notification_h noti_h, char *addressVal, bool bVoiceMa } else { int tmpVal = 0; if (vconf_get_int(MSG_SETTING_RINGTONE_TYPE, &tmpVal) != 0) { - MSG_MGR_INFO("MsgSettingGetInt() is failed"); + MSG_MGR_INFO("vconf_get_int() is failed"); } int ringtoneType = tmpVal; if (ringtoneType == MSG_RINGTONE_TYPE_SILENT) @@ -1489,6 +1584,12 @@ void setNotification(notification_h noti_h, MSG_MGR_NOTI_INFO_S *noti_info, bool updatePrivId(noti_info->type, noti_info->id, noti_info->sim_idx); } + if (noti_info->type == MSG_MGR_NOTI_TYPE_MMS_READ_REPORT_SENT && noti_info->msg_id > 0) { + int err = vconf_set_int(VCONFKEY_MESSAGE_READ_REPORT_SENT_MSG_ID, noti_info->msg_id); + if (err != 0) + MSG_MGR_ERR("vconf_set_int() failed [%d]", err); + } + MSG_MGR_END(); } @@ -1729,6 +1830,8 @@ int getLatestMsgInfo(MSG_MGR_NOTI_INFO_S *noti_info, bool isForInstantMessage) noti_info->active_noti_button_num = MSG_ACTIVE_NOTI_BUTTON_NUM_PUSH_MESSAGE; } else { g_strlcat(noti_info->sender, tmpAddressInfo.addressVal, sizeof(noti_info->sender)-strlen(noti_info->sender)); + if (subType == MSG_NOTIFICATIONIND_MMS) + noti_info->active_noti_button_num = MSG_ACTIVE_NOTI_BUTTON_NUM_UNRETRIVED_MESSAGE; } if (senderStr) { @@ -2312,6 +2415,9 @@ int getPrivId(msg_mgr_notification_type_t noti_type, int sim_idx) case MSG_MGR_NOTI_TYPE_FAILED: vconf_get_int(MSG_SENTFAIL_NOTI_ID, ¬i_id); break; + case MSG_MGR_NOTI_TYPE_MMS_READ_REPORT_SENT: + vconf_get_int(VCONFKEY_MESSAGE_READ_REPORT_SENT_NOTI_ID, ¬i_id); + break; case MSG_MGR_NOTI_TYPE_VOICE_1: { char keyName[MAX_VCONFKEY_NAME_LEN] = {0, }; snprintf(keyName, sizeof(keyName), "%s/%d", VOICE_NOTI_ID_1, sim_idx); @@ -2369,6 +2475,9 @@ void updatePrivId(msg_mgr_notification_type_t noti_type, int noti_id, int sim_id case MSG_MGR_NOTI_TYPE_FAILED: err = vconf_set_int(MSG_SENTFAIL_NOTI_ID, noti_id); break; + case MSG_MGR_NOTI_TYPE_MMS_READ_REPORT_SENT: + err = vconf_set_int(VCONFKEY_MESSAGE_READ_REPORT_SENT_NOTI_ID, noti_id); + break; case MSG_MGR_NOTI_TYPE_VOICE_1: { char keyName[MAX_VCONFKEY_NAME_LEN] = {0, }; snprintf(keyName, sizeof(keyName), "%s/%d", VOICE_NOTI_ID_1, sim_idx); |