+int MsgMgrInsertDeliveryReportInstantNotification(msg_mgr_notification_type_t noti_type, int result)
+{
+ MSG_MGR_BEGIN();
+
+ notification_h noti = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_set_pkgname(noti, MSG_DEFAULT_APP_ID);
+
+ setTextDomain(noti);
+ setNotiText(noti, NOTIFICATION_TEXT_TYPE_TITLE, "Delivery report", DELIVERY_MESSAGE);
+ setNotiImage(noti, NOTIFICATION_IMAGE_TYPE_ICON, MSG_DELIVER_REPORT_STATUS_ICON);
+
+ if (noti_type == MSG_MGR_NOTI_TYPE_SMS_DELIVERY_REPORT) {
+ if (result == MSG_NETWORK_DELIVER_SUCCESS) {
+ setNotiText(noti, NOTIFICATION_TEXT_TYPE_CONTENT, "Message delivered.", MESSAGE_DELIVERED_POPUP);
+ } else if (result == MSG_NETWORK_DELIVER_EXPIRED) {
+ setNotiText(noti, NOTIFICATION_TEXT_TYPE_CONTENT, "Couldn't deliver message. Message expired.", UNABLE_TO_DELIVER_MESSAGE_MESSAGE_EXPIRED);
+ } else if (result == MSG_NETWORK_DELIVER_PENDING) {
+ setNotiText(noti, NOTIFICATION_TEXT_TYPE_CONTENT, "Message delayed.", MESSAGE_DELAYED_POPUP);
+ } else {
+ MSG_MGR_ERR("unexpected result! [%d]", result);
+ goto _END_OF_INSTANT_DELIVERY_REPORT_NOTI;
+ }
+ } else if (noti_type == MSG_MGR_NOTI_TYPE_MMS_DELIVERY_REPORT) {
+ if (result == MSG_DELIVERY_REPORT_EXPIRED)
+ setNotiText(noti, NOTIFICATION_TEXT_TYPE_CONTENT, "Couldn't deliver message. Message expired.", UNABLE_TO_DELIVER_MESSAGE_MESSAGE_EXPIRED);
+ else if (result== MSG_DELIVERY_REPORT_REJECTED)
+ setNotiText(noti, NOTIFICATION_TEXT_TYPE_CONTENT, "Couldn't deliver message. Message rejected by recipient.", UNABLE_TO_DELIVER_MESSAGE_MESSAGE_REJECTED);
+ else if (result == MSG_DELIVERY_REPORT_DEFERRED)
+ setNotiText(noti, NOTIFICATION_TEXT_TYPE_CONTENT, "Message delayed.", MESSAGE_DELAYED_POPUP);
+ else if (result == MSG_DELIVERY_REPORT_UNRECOGNISED || result == MSG_DELIVERY_REPORT_INDETERMINATE ||
+ result == MSG_DELIVERY_REPORT_FORWARDED || result == MSG_DELIVERY_REPORT_UNREACHABLE ||
+ result == MSG_DELIVERY_REPORT_ERROR)
+ setNotiText(noti, NOTIFICATION_TEXT_TYPE_CONTENT, "Couldn't deliver message. Recipient not available.", UNABLE_TO_DELIVER_MESSAGE_RECIPIENT_NOT_AVAILABLE);
+ else
+ setNotiText(noti, NOTIFICATION_TEXT_TYPE_CONTENT, "Message delivered.", MESSAGE_DELIVERED_POPUP);
+ }
+
+ if (notification_set_display_applist(noti, NOTIFICATION_DISPLAY_APP_TICKER) != NOTIFICATION_ERROR_NONE)
+ MSG_MGR_ERR("Fail to notification_set_display_applist");
+
+ if (notification_post(noti) != NOTIFICATION_ERROR_NONE)
+ MSG_MGR_ERR("Fail to notification_post");
+
+_END_OF_INSTANT_DELIVERY_REPORT_NOTI:
+
+ if (notification_delete(noti) != NOTIFICATION_ERROR_NONE)
+ MSG_MGR_ERR("Fail to notification_delete");
+
+ if (noti) {
+ if (notification_free(noti) != NOTIFICATION_ERROR_NONE)
+ MSG_MGR_ERR("Fail to notification_free");
+ noti = NULL;
+ }
+
+ MSG_MGR_END();
+ return 0;
+}
+
+