2 * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 /*==================================================================================================
19 ==================================================================================================*/
29 #include <app_control.h>
30 #include <badge_internal.h>
31 #include <notification_list.h>
32 #include <notification_text_domain.h>
33 #include <notification_internal.h>
34 #include <notification_status.h>
35 #include <notification_setting.h>
36 #include <notification_setting_internal.h>
37 #include <package_manager.h>
41 #include <msg_storage.h>
43 #include <msg-manager-util.h>
44 #include <msg-manager-contact.h>
45 #include <msg-manager-debug.h>
46 #include <msg-manager-notification.h>
47 #include <msg-manager-sound.h>
52 /*==================================================================================================
54 ==================================================================================================*/
56 static GList *msg_report_notification_list = NULL;
57 static bool is_init = false;
58 extern msg_handle_t msg_handle;
62 /*==================================================================================================
64 ==================================================================================================*/
65 typedef struct _report_notification_s
67 msg_mgr_notification_type_t noti_type;
69 char addressVal[MAX_ADDRESS_VAL_LEN+1];
70 } report_notification_s;
73 typedef struct _msg_mgr_noti_info_s
75 msg_mgr_notification_type_t type;
81 char sender[MSG_NOTI_TEXT_LEN_S+1];
82 char text[MSG_NOTI_TEXT_LEN+1];
83 char number[MSG_NOTI_TEXT_LEN_S+1];
84 char imagePath[MAX_IMAGE_PATH_LEN+1]; /**< Indicates the image path of contact. */
87 app_control_h active_noti_svc_h[MSG_ACTIVE_NOTI_BUTTON_NUM];
88 msg_message_id_t msg_id;
90 unsigned char extra_data;
92 int active_noti_button_num;
94 int active_media_size;
95 unsigned char active_subtype; /**< to distinguish cb, push message */
96 char active_sender[MSG_NOTI_TEXT_LEN_S+1];
97 char active_subject[MSG_NOTI_TEXT_LEN_S+1];
98 char active_text[MSG_NOTI_TEXT_LEN+1];
99 } MSG_MGR_NOTI_INFO_S;
102 typedef struct _del_noti_info_s
104 msg_mgr_notification_type_t type;
109 /*==================================================================================================
111 ===================================================================================================*/
113 void MsgMgrInitReportNotiList();
114 void MsgInitNotiCb(void *data);
115 void MsgRefreshNotiCb(void *data);
116 void MsgMgrDeleteNotiCb(void *data);
118 void MsgMgrDeleteNotification(msg_mgr_notification_type_t noti_type, int simIndex);
119 int MsgMgrInsertDeliveryReportInstantNotification(msg_mgr_notification_type_t noti_type, int result);
121 notification_h getHandle(int *noti_id);
123 int getPrivId(msg_mgr_notification_type_t noti_type, int sim_idx);
124 void updatePrivId(msg_mgr_notification_type_t noti_type, int noti_id, int sim_idx);
126 void createInfoData(MSG_MGR_NOTI_INFO_S *noti_info, MSG_MGR_MESSAGE_INFO_S *msg_info); /* For addNoti() */
127 void createInfoData(MSG_MGR_NOTI_INFO_S *noti_info, msg_mgr_active_notification_type_t active_noti);
128 void createActiveInfoData(MSG_MGR_NOTI_INFO_S *noti_info, MSG_MGR_MESSAGE_INFO_S *msg_info);
129 void clearInfoData(notification_h noti_h, MSG_MGR_NOTI_INFO_S *noti_info);
131 int getAppIcon(const char *app_id, char **icon_path);
132 int getLatestMsgInfo(MSG_MGR_NOTI_INFO_S *noti_info, bool isForInstantMessage);
134 void setProperty(notification_h noti_h, MSG_MGR_NOTI_INFO_S *noti_info);
135 void setTextDomain(notification_h noti_h);
136 void setText(notification_h noti_h, MSG_MGR_NOTI_INFO_S *noti_info);
137 void setIcon(notification_h noti_h, MSG_MGR_NOTI_INFO_S *noti_info);
138 void setSoundAndVibration(notification_h noti_h, char *addressVal, bool bVoiceMail);
139 void setActiveNotification(notification_h noti_h, MSG_MGR_NOTI_INFO_S *noti_info);
140 void setActiveProperty(notification_h noti_h, MSG_MGR_NOTI_INFO_S *noti_info);
141 void setActiveText(notification_h noti_h, MSG_MGR_NOTI_INFO_S *noti_info);
142 void setActiveIcon(notification_h noti_h, MSG_MGR_NOTI_INFO_S *noti_info);
144 void setNotification(notification_h noti_h, MSG_MGR_NOTI_INFO_S *noti_info, bool bFeedback);
147 void createServiceHandle(app_control_h *svc_h);
148 void setServiceAppId(app_control_h svc_h, const char* app_id);
149 void setServiceUri(app_control_h svc_h, const char* uri);
150 void setServiceOperation(app_control_h svc_h, const char* operation);
151 void addServiceExtraData(app_control_h svc_h, const char* bundle_key, const char* bundle_val);
152 void addServiceExtraData(app_control_h svc_h, const char* bundle_key, int bundle_val);
153 void setServicePackageName(app_control_h svc_h, const char* pkg_name);
154 void sendServicelaunchRequest(app_control_h svc_h, app_control_reply_cb callback, void *user_data);
156 void setNotiTextDomain(notification_h noti_h, const char *pkg_name, const char *loc_dir);
157 void setNotiText(notification_h noti_h, notification_text_type_e type, const char *text, const char *key);
158 void setNotiTimeToText(notification_h noti_h, notification_text_type_e type, time_t time);
159 void setNotiTime(notification_h noti_h, time_t time);
160 void setNotiImage(notification_h noti_h, notification_image_type_e type, const char *image_path);
161 void setNotiSound(notification_h noti_h, notification_sound_type_e type, const char *path);
162 void setNotiVibration(notification_h noti_h, notification_vibration_type_e type, const char *path);
163 void setNotiEventHandler(notification_h noti_h, notification_event_type_e type, app_control_h event_handler);
166 void MsgMgrNotiSoundRepeatAlarmCB(int alarmId);
167 void MsgMgrSoundCreateRepeatAlarm(int RepeatTime);
168 void MsgMgrSoundSetRepeatAlarm();
170 char *get_translate_text(const char *pkg_name, const char *locale_dir, const char *text);
172 /*==================================================================================================
173 FUNCTION IMPLEMENTATION
174 ==================================================================================================*/
175 bool _is_valid_email(char *pAddress)
177 if (!pAddress || pAddress[0] == 0)
179 if (!strchr (pAddress, EMAIL_AT))
185 void MsgMgrInitReportNotiList()
189 if (msg_report_notification_list) {
190 MSG_MGR_DEBUG("Report Noti List is already inited");
194 msg_report_notification_list = NULL;
196 notification_h noti = NULL;
197 notification_list_h noti_list = NULL;
198 notification_list_h head_noti_list = NULL;
199 int noti_err = NOTIFICATION_ERROR_NONE;
200 app_control_h app_control = NULL;
202 noti_err = notification_get_list(NOTIFICATION_TYPE_NONE, -1, ¬i_list);
203 if (noti_err != NOTIFICATION_ERROR_NONE) {
204 MSG_MGR_DEBUG("notification_get_list() is failed!!");
208 head_noti_list = noti_list;
210 while (noti_list != NULL) {
211 noti = notification_list_get_data(noti_list);
213 MSG_MGR_DEBUG("notification_list_get_data() failed!!");
217 char tempAddr[MAX_ADDRESS_VAL_LEN+1];
218 memset(tempAddr, 0x00, sizeof(tempAddr));
220 noti_err = notification_get_launch_option(noti, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, &app_control);
221 if (noti_err != NOTIFICATION_ERROR_NONE) {
222 MSG_MGR_DEBUG("notification_get_excute_option() failed!!");
226 char *is_report_noti = NULL;
228 int ret = app_control_get_extra_data(app_control, "is_report_noti", &is_report_noti);
229 if (ret == APP_CONTROL_ERROR_NONE && is_report_noti != NULL && g_strcmp0(is_report_noti, "true") == 0) {
232 ret = app_control_get_extra_data(app_control, "address", &addr);
233 if (ret == APP_CONTROL_ERROR_NONE && addr != NULL) {
234 report_notification_s *info = new report_notification_s;
235 memset(info, 0x00, sizeof(report_notification_s));
237 char *noti_type = NULL;
238 ret = app_control_get_extra_data(app_control, "noti_type", ¬i_type);
239 if (ret == APP_CONTROL_ERROR_NONE && noti_type != NULL) {
240 info->noti_type = (msg_mgr_notification_type_t)atoi(noti_type);
244 notification_get_id(noti, NULL, &(info->priv_id));
245 snprintf(info->addressVal, sizeof(info->addressVal), "%s", addr);
247 msg_report_notification_list = g_list_append(msg_report_notification_list, (void *)info);
248 MSG_MGR_SEC_DEBUG("appended list data = [noti_type = %d priv_id = %d address = %s]", info->noti_type, info->priv_id, info->addressVal);
255 if (is_report_noti) {
256 g_free(is_report_noti);
257 is_report_noti = NULL;
261 noti_list = notification_list_get_next(noti_list);
265 notification_free_list(head_noti_list);
271 void MsgMgrInitNoti()
276 bool bNotiSvcReady = false;
278 bNotiSvcReady = notification_is_service_ready();
280 if (bNotiSvcReady == true) {
281 MSG_MGR_DEBUG("Notification server is available");
282 MsgMgrInitReportNotiList();
284 MSG_MGR_DEBUG("Notification server is not available. Init is defered");
285 notification_add_deferred_task(MsgInitNotiCb, NULL);
292 void MsgInitNotiCb(void *data)
294 MsgMgrInitReportNotiList();
307 bool bNotiSvcReady = false;
309 bNotiSvcReady = notification_is_service_ready();
311 if (bNotiSvcReady == true) {
312 MSG_MGR_DEBUG("Notification server is available");
313 #ifndef MSG_NOTI_INTEGRATION
314 MsgDeleteNotification(MSG_MGR_NOTI_TYPE_SIM, -1);
316 MsgMgrRefreshAllNotification(false, true, MSG_MGR_ACTIVE_NOTI_TYPE_INSTANT); /* On Booting */
318 MSG_MGR_DEBUG("Notification server is not available. Init is defered");
319 #ifndef MSG_NOTI_INTEGRATION
320 MSG_MGR_NOTI_INFO_S *delNotiInfo = (MSG_MGR_NOTI_INFO_S *)calloc(1, sizeof(MSG_MGR_NOTI_INFO_S));
322 delNotiInfo->type = MSG_MGR_NOTI_TYPE_SIM;
323 delNotiInfo->sim_idx = -1;
325 notification_add_deferred_task(MsgDeleteNotiCb, (void *)delNotiInfo);
327 notification_add_deferred_task(MsgRefreshNotiCb, NULL);
332 void MsgRefreshNotiCb(void *data)
334 MsgMgrRefreshAllNotification(false, true, MSG_MGR_ACTIVE_NOTI_TYPE_INSTANT);
345 void MsgMgrDeleteNotiCb(void *data)
348 DEL_NOTI_INFO_S *delNotiInfo = (DEL_NOTI_INFO_S *)data;
350 MsgMgrDeleteNotification(delNotiInfo->type, delNotiInfo->sim_idx);
360 int MsgMgrInsertOnlyActiveNotification(msg_mgr_notification_type_t noti_type, MSG_MGR_MESSAGE_INFO_S *msg_info)
364 notification_h noti_h = NULL;
366 MSG_MGR_NOTI_INFO_S noti_info = {0, };
368 noti_info.type = noti_type;
369 noti_info.active_noti_button_num = MSG_ACTIVE_NOTI_BUTTON_NUM_CLASS0_MESSAGE;
371 createActiveInfoData(¬i_info, msg_info);
373 noti_h = notification_create(NOTIFICATION_TYPE_NOTI);
375 setActiveNotification(noti_h, ¬i_info);
377 clearInfoData(noti_h, ¬i_info);
384 int MsgMgrRefreshNotification(msg_mgr_notification_type_t noti_type, bool bFeedback, msg_mgr_active_notification_type_t active_type)
387 notification_h noti_h = NULL;
388 int bNotification = 1;
389 /* bool bReplyPopup = false; */
391 MSG_MGR_NOTI_INFO_S noti_info = {0, };
392 noti_info.type = noti_type;
393 noti_info.id = getPrivId(noti_info.type, -1);
395 err = getLatestMsgInfo(¬i_info, false);
398 MSG_MGR_DEBUG("getLatestMsgInfo() err = [%d]", err);
399 goto __END_OF_REFRESH_NOTI;
402 if (active_type == MSG_MGR_ACTIVE_NOTI_TYPE_INSTANT) {
403 err = MsgMgrInsertInstantMessage(noti_type);
406 MSG_MGR_DEBUG(" MsgMgrInsertInstantMessage() err = [%d]", err);
407 goto __END_OF_REFRESH_NOTI;
411 if (vconf_get_bool(MSG_SETTING_NOTIFICATION, &bNotification) != 0) {
412 MSG_MGR_DEBUG("vconf_get_bool is failed.");
415 if (bNotification == 0) {
416 MSG_MGR_DEBUG("Msg Alert notification is off.");
417 goto __END_OF_REFRESH_NOTI;
420 createInfoData(¬i_info, active_type);
422 noti_h = getHandle(¬i_info.id);
424 if (noti_h == NULL) {
425 MSG_MGR_DEBUG("Notification handle is NULL");
426 err = MSG_ERR_NULL_POINTER;
427 goto __END_OF_REFRESH_NOTI;
430 setNotification(noti_h, ¬i_info, bFeedback);
432 __END_OF_REFRESH_NOTI :
433 clearInfoData(noti_h, ¬i_info);
439 int MsgMgrAddReportNotification(msg_mgr_notification_type_t noti_type, MSG_MGR_MESSAGE_INFO_S *msg_info)
443 notification_h noti_h = NULL;
444 bool isNewNoti = false;
446 report_notification_s *info = new report_notification_s;
447 memset(info, 0x00, sizeof(report_notification_s));
449 MSG_MGR_NOTI_INFO_S noti_info = {0, };
450 noti_info.type = noti_type;
452 createInfoData(¬i_info, msg_info);
454 if (noti_info.id == 0)
457 noti_h = getHandle(¬i_info.id);
459 if (noti_h == NULL) {
460 MSG_MGR_DEBUG("Notification handle is NULL");
462 goto __END_OF_ADD_REPORT_NOTI;
465 if (noti_type == MSG_MGR_NOTI_TYPE_SMS_DELIVERY_REPORT || noti_type == MSG_MGR_NOTI_TYPE_MMS_DELIVERY_REPORT) {
466 noti_info.applist &= ~NOTIFICATION_DISPLAY_APP_TICKER;
468 ret = MsgMgrInsertDeliveryReportInstantNotification(noti_type, noti_info.extra_data);
471 MSG_MGR_ERR(" MsgInsertInstantDeliveryReportNotification() err = [%d]", ret);
472 goto __END_OF_ADD_REPORT_NOTI;
476 addServiceExtraData(noti_info.svc_h, "is_report_noti", "true");
477 setNotification(noti_h, ¬i_info, true);
479 if (noti_type == MSG_MGR_NOTI_TYPE_MMS_DELIVERY_REPORT)
480 noti_type = MSG_MGR_NOTI_TYPE_SMS_DELIVERY_REPORT;
483 report_notification_s *info = new report_notification_s;
484 memset(info, 0x00, sizeof(report_notification_s));
486 info->noti_type = noti_type;
487 info->priv_id = noti_info.id;
488 snprintf(info->addressVal, sizeof(info->addressVal), "%s", msg_info->addressVal);
489 msg_report_notification_list = g_list_append(msg_report_notification_list, (void *)info);
490 MSG_MGR_SEC_DEBUG("appended list data = [priv_id = %d address = %s]", info->priv_id, info->addressVal);
492 GList *iter = g_list_first(msg_report_notification_list);
494 while (iter != NULL) {
495 report_notification_s *info = (report_notification_s*)(iter->data);
497 MSG_MGR_DEBUG("info is NULL!");
501 // update new addressVal of noti_type
502 if (info->priv_id == noti_info.id) {
503 memset(info->addressVal, 0x00, MAX_ADDRESS_VAL_LEN+1);
504 snprintf(info->addressVal, sizeof(info->addressVal), "%s", msg_info->addressVal);
505 MSG_MGR_SEC_DEBUG("updated list data = [priv_id = %d address = %s]", info->priv_id, info->addressVal);
509 iter = g_list_next(iter);
513 info->priv_id = noti_info.id;
514 snprintf(info->addressVal, sizeof(info->addressVal), "%s", msg_info->addressVal);
515 msg_report_notification_list = g_list_append(msg_report_notification_list, (void *)info);
516 MSG_MGR_SEC_DEBUG("appended list data = [priv_id = %d address = %s]", info->priv_id, info->addressVal);
518 __END_OF_ADD_REPORT_NOTI :
519 clearInfoData(noti_h, ¬i_info);
525 int MsgMgrDeleteReportNotification(const char *addr)
529 notification_h noti_h = NULL;
530 int bNotification = 1;
532 if (vconf_get_bool(MSG_SETTING_NOTIFICATION, &bNotification) != 0) {
533 MSG_MGR_DEBUG("vconf_get_bool is failed.");
536 if (bNotification == 0) {
537 MSG_MGR_DEBUG("Msg Alert notification is off.");
541 char* normalAddr = NULL;
542 unsigned int list_length = g_list_length(msg_report_notification_list);
543 bool isDelete = false;
545 MSG_MGR_DEBUG("list length [%d]", list_length);
547 if (list_length > 0) {
548 GList *iter = g_list_first(msg_report_notification_list);
550 while (iter != NULL) {
552 report_notification_s *info = (report_notification_s*)(iter->data);
554 MSG_MGR_DEBUG("info is NULL!");
558 MSG_MGR_SEC_DEBUG("list data = [priv_id = %d address = %s]", info->priv_id, info->addressVal);
560 noti_h = notification_load(NULL, info->priv_id);
561 if (noti_h == NULL) {
562 MSG_MGR_DEBUG("notification with priv_id [%d] is NULL", info->priv_id);
565 normalAddr = msg_mgr_normalize_number(info->addressVal);
568 MSG_MGR_SEC_DEBUG("normalized number = %s", normalAddr);
570 if (g_str_has_suffix(addr, normalAddr)) {
571 if (notification_delete(noti_h) == NOTIFICATION_ERROR_NONE) {
572 MSG_MGR_SEC_DEBUG("delete report notification address [%s]", info->addressVal);
575 MSG_MGR_DEBUG("delete notification failed");
580 notification_free(noti_h);
584 iter = g_list_next(iter);
587 msg_report_notification_list = g_list_remove(msg_report_notification_list, (void *)info);
601 int MsgMgrAddNotification(msg_mgr_notification_type_t noti_type, MSG_MGR_MESSAGE_INFO_S *msg_info)
605 notification_h noti_h = NULL;
607 MSG_MGR_NOTI_INFO_S noti_info = {0, };
609 noti_info.type = noti_type;
611 createInfoData(¬i_info, msg_info);
613 /* check mwi or voicemail count is 0 then skip add notification */
614 if (noti_info.count == 0) {
615 MSG_MGR_DEBUG("Notification count is 0");
617 goto __END_OF_ADD_NOTI;
620 noti_h = getHandle(¬i_info.id);
622 if (noti_h == NULL) {
623 MSG_MGR_DEBUG("Notification handle is NULL");
625 goto __END_OF_ADD_NOTI;
628 setNotification(noti_h, ¬i_info, true);
631 clearInfoData(noti_h, ¬i_info);
637 void MsgMgrDeleteNotification(msg_mgr_notification_type_t noti_type, int simIndex)
639 int noti_err = NOTIFICATION_ERROR_NONE;
641 if (noti_type == MSG_MGR_NOTI_TYPE_ALL) {
642 noti_err = notification_delete_all(NOTIFICATION_TYPE_NOTI);
643 } else if (noti_type == MSG_MGR_NOTI_TYPE_VOICE_1 || noti_type == MSG_MGR_NOTI_TYPE_VOICE_2 || noti_type == MSG_MGR_NOTI_TYPE_SIM) {
646 notiId = getPrivId(noti_type, simIndex);
647 MSG_MGR_DEBUG("deleted notification ID = [%d] Type = [%d]", notiId, noti_type);
650 noti_err = notification_delete_by_priv_id(MSG_DEFAULT_APP_ID, NOTIFICATION_TYPE_NOTI, notiId);
653 MSG_MGR_DEBUG("No matching type [%d]", noti_type);
656 if (noti_err != NOTIFICATION_ERROR_NONE) {
657 MSG_MGR_DEBUG("Fail to notification_delete_all noti_err [%d]", noti_err);
660 updatePrivId(noti_type, 0, simIndex);
664 int MsgMgrDeleteNoti(msg_mgr_notification_type_t noti_type, int simIndex)
666 bool bNotiSvcReady = false;
668 DEL_NOTI_INFO_S *delNotiInfo = (DEL_NOTI_INFO_S *)calloc(1, sizeof(DEL_NOTI_INFO_S));
671 delNotiInfo->type = noti_type;
672 delNotiInfo->sim_idx = simIndex;
675 bNotiSvcReady = notification_is_service_ready();
677 if (bNotiSvcReady == true) {
678 MSG_MGR_DEBUG("Notification server is available");
679 MsgMgrDeleteNotiCb((void *)delNotiInfo);
681 MSG_MGR_DEBUG("Notification server is not available. Delete is defered");
682 notification_add_deferred_task(MsgMgrDeleteNotiCb, (void *)delNotiInfo);
688 int MsgMgrDeleteSentReadReportNotification()
690 int readReportSentNotiId = 0;
693 if (vconf_get_int(VCONFKEY_MESSAGE_READ_REPORT_SENT_NOTI_ID, &readReportSentNotiId) != 0) {
694 MSG_MGR_INFO("vconf_get_int() is failed");
698 if (readReportSentNotiId > 0) {
699 noti_err = notification_delete_by_priv_id(MSG_DEFAULT_APP_ID, NOTIFICATION_TYPE_NOTI, readReportSentNotiId);
701 MSG_MGR_DEBUG("notification_delete_by_priv_id() fail [%d]", noti_err);
705 MSG_MGR_DEBUG("VCONFKEY_MESSAGE_READ_REPORT_SENT_NOTI_ID is 0");
709 if (vconf_set_int(VCONFKEY_MESSAGE_READ_REPORT_SENT_NOTI_ID, 0) != 0) {
710 MSG_MGR_DEBUG("vconf_set_int fail : VCONFKEY_MESSAGE_READ_REPORT_SENT_NOTI_ID");
714 if (vconf_set_int(VCONFKEY_MESSAGE_READ_REPORT_SENT_MSG_ID, 0) != 0) {
715 MSG_MGR_DEBUG("vconf_set_int fail : VCONFKEY_MESSAGE_READ_REPORT_SENT_MSG_ID");
723 void MsgMgrRefreshAllNotification(bool bWithSimNoti, bool bFeedback, msg_mgr_active_notification_type_t active_type)
729 #ifndef MSG_NOTI_INTEGRATION
730 MsgDeleteNotification(MSG_MGR_NOTI_TYPE_SIM);
733 #ifdef MSG_NOTI_INTEGRATION
734 err = MsgMgrRefreshNotification(MSG_MGR_NOTI_TYPE_NORMAL, bFeedback, active_type);
736 MSG_MGR_DEBUG("refreshNoti is failed, [type=%d, err=%d]", MSG_MGR_NOTI_TYPE_NORMAL, err);
738 err = MsgMgrRefreshNotification(MSG_MGR_NOTI_TYPE_NORMAL, bFeedback, active_type);
740 MSG_MGR_DEBUG("refreshNoti is failed, [type=%d, err=%d]", MSG_MGR_NOTI_TYPE_NORMAL, err);
742 err = MsgMgrRefreshNotification(MSG_MGR_NOTI_TYPE_CB, bFeedback, active_type);
744 MSG_MGR_DEBUG("refreshNoti is failed, [type=%d, err=%d]", MSG_MGR_NOTI_TYPE_CB, err);
747 err = MsgMgrRefreshNotification(MSG_MGR_NOTI_TYPE_SIM, bFeedback, active_type);
749 MSG_MGR_DEBUG("refreshNoti is failed, [type=%d, err=%d]", MSG_MGR_NOTI_TYPE_SIM, err);
753 err = MsgMgrRefreshNotification(MSG_MGR_NOTI_TYPE_FAILED, bFeedback, active_type);
755 MSG_MGR_DEBUG("refreshNoti is failed, [type=%d, err=%d]", MSG_MGR_NOTI_TYPE_FAILED, err);
761 void setProperty(notification_h noti_h, MSG_MGR_NOTI_INFO_S *noti_info)
765 int noti_err = NOTIFICATION_ERROR_NONE;
768 noti_err = notification_set_layout(noti_h, (notification_ly_type_e)noti_info->layout);
769 if (noti_err != NOTIFICATION_ERROR_NONE) {
770 MSG_MGR_DEBUG("Fail to notification_set_layout : %d", noti_err);
774 noti_err = notification_set_led(noti_h, NOTIFICATION_LED_OP_ON, 0x00);
775 if (noti_err != NOTIFICATION_ERROR_NONE) {
776 MSG_MGR_DEBUG("Fail to notification_set_led.");
779 /* set execute option and property */
780 switch (noti_info->type) {
781 case MSG_MGR_NOTI_TYPE_NORMAL: {
782 if (noti_info->count > 1) {
783 notification_set_launch_option(noti_h, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, noti_info->svc_h);
785 if (noti_info->svc_h) { /* overwrite bundle key "type" */
786 /* addServiceExtraData(noti_info->svc_h, "type", "reply"); */
787 addServiceExtraData(noti_info->svc_h, "show_list", "list_show");
789 notification_set_launch_option(noti_h, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, noti_info->svc_h);
792 notification_set_property(noti_h, NOTIFICATION_PROP_DISABLE_AUTO_DELETE);
795 case MSG_MGR_NOTI_TYPE_CB:
796 case MSG_MGR_NOTI_TYPE_SIM: {
797 notification_set_launch_option(noti_h, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, noti_info->svc_h);
798 notification_set_property(noti_h, NOTIFICATION_PROP_DISABLE_AUTO_DELETE|NOTIFICATION_PROP_VOLATILE_DISPLAY);
801 case MSG_MGR_NOTI_TYPE_FAILED: {
802 notification_set_launch_option(noti_h, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, noti_info->svc_h);
803 notification_set_property(noti_h, NOTIFICATION_PROP_DISABLE_AUTO_DELETE);
806 case MSG_MGR_NOTI_TYPE_SIM_FULL: {
807 notification_set_launch_option(noti_h, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, noti_info->svc_h);
810 case MSG_MGR_NOTI_TYPE_STORAGE_FULL: {
811 notification_set_launch_option(noti_h, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, noti_info->svc_h);
814 case MSG_MGR_NOTI_TYPE_VOICE_1:
815 case MSG_MGR_NOTI_TYPE_VOICE_2:
816 case MSG_MGR_NOTI_TYPE_MWI:
817 case MSG_MGR_NOTI_TYPE_CLASS0:
818 case MSG_MGR_NOTI_TYPE_SMS_DELIVERY_REPORT:
819 case MSG_MGR_NOTI_TYPE_MMS_READ_REPORT:
820 case MSG_MGR_NOTI_TYPE_MMS_DELIVERY_REPORT: {
821 notification_set_launch_option(noti_h, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, noti_info->svc_h);
825 MSG_MGR_DEBUG("No matching type for notification_set_launch_option() [%d]", noti_info->type);
830 noti_err = notification_set_display_applist(noti_h, noti_info->applist);
831 if (noti_err != NOTIFICATION_ERROR_NONE) {
832 MSG_MGR_DEBUG("Fail to notification_set_display_applist");
836 noti_err = notification_set_pkgname(noti_h, MSG_DEFAULT_APP_ID);
837 if (noti_err != NOTIFICATION_ERROR_NONE) {
838 MSG_MGR_DEBUG("Fail to notification_set_pkgname");
845 void setTextDomain(notification_h noti_h)
849 setNotiTextDomain(noti_h, MSG_MGR_PACKAGE_NAME, MSG_MGR_LOCALEDIR);
854 void setText(notification_h noti_h, MSG_MGR_NOTI_INFO_S *noti_info)
858 char unreadMsgCntStr[10] = {0};
861 if (vconf_get_bool(MSG_SETTING_PREVIEW, &bPreview) != 0) {
862 MSG_MGR_DEBUG("vconf_get_bool is failed.");
865 /* set title and content */
866 switch (noti_info->type) {
867 #ifdef MSG_NOTI_INTEGRATION
868 case MSG_MGR_NOTI_TYPE_NORMAL:
869 case MSG_MGR_NOTI_TYPE_CB:
870 case MSG_MGR_NOTI_TYPE_SIM: {
871 if (noti_info->count > 1) {
872 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "New Messages", NEW_MESSAGES);
873 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL);
874 setNotiTime(noti_h, noti_info->time);
876 snprintf(unreadMsgCntStr, sizeof(unreadMsgCntStr), "%d", noti_info->count);
877 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, unreadMsgCntStr, NULL);
881 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, noti_info->sender, NULL);
882 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->text, NULL);
884 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "New Message", NEW_MESSAGE);
885 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL);
887 setNotiTime(noti_h, noti_info->time);
892 case MSG_MGR_NOTI_TYPE_NORMAL: {
893 if (noti_info->count > 1) {
894 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "New Messages", NEW_MESSAGES);
895 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL);
896 setNotiTime(noti_h, noti_info->time);
898 snprintf(unreadMsgCntStr, sizeof(unreadMsgCntStr), "%d", noti_info->count);
899 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, unreadMsgCntStr, NULL);
902 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, noti_info->sender, NULL);
903 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->text, NULL);
905 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "New Message", NEW_MESSAGE);
906 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL);
908 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, "1", NULL);
909 setNotiTime(noti_h, noti_info->time);
913 case MSG_MGR_NOTI_TYPE_CB: {
914 if (noti_info->count > 1) {
915 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "Broadcast message", CB_MESSAGE);
916 snprintf(unreadMsgCntStr, sizeof(unreadMsgCntStr), "%d", noti_info->count);
917 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, unreadMsgCntStr, NULL);
918 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL);
919 setNotiTime(noti_h, noti_info->time);
922 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, "1", NULL);
923 setNotiTime(noti_h, noti_info->time);
926 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, noti_info->sender, NULL);
927 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->text, NULL);
929 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "Broadcast message", CB_MESSAGE);
930 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL);
935 case MSG_MGR_NOTI_TYPE_SIM: {
936 if (noti_info->count > 1) {
937 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "SIM card Message", SIM_CARD_MESSAGE);
938 snprintf(unreadMsgCntStr, sizeof(unreadMsgCntStr), "%d", noti_info->count);
939 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, unreadMsgCntStr, NULL);
941 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL);
942 setNotiTime(noti_h, noti_info->time);
944 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, "1", NULL);
945 setNotiTime(noti_h, noti_info->time);
948 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, noti_info->sender, NULL);
949 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->text, NULL);
951 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "SIM card Message", SIM_CARD_MESSAGE);
952 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL);
958 case MSG_MGR_NOTI_TYPE_FAILED: {
959 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "Message", MSG_MESSAGE);
960 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, "Failed to send message.", FAILED_TO_SEND_MESSAGE);
961 if (noti_info->count > 1) {
962 snprintf(unreadMsgCntStr, sizeof(unreadMsgCntStr), "%d", noti_info->count);
963 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, unreadMsgCntStr, NULL);
965 setNotiTime(noti_h, noti_info->time);
968 case MSG_MGR_NOTI_TYPE_VOICE_1:
969 case MSG_MGR_NOTI_TYPE_VOICE_2: {
970 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "Voicemail", VOICE_MAIL);
971 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL);
972 setNotiTime(noti_h, noti_info->time);
974 if (noti_info->count == 1) {
975 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, "1", NULL);
976 } else if (noti_info->count > 1) {
977 snprintf(unreadMsgCntStr, sizeof(unreadMsgCntStr), "%d", noti_info->count);
978 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, unreadMsgCntStr, NULL);
980 MSG_MGR_DEBUG("Invalid notification count, [cnt = %d]", noti_info->count);
984 case MSG_MGR_NOTI_TYPE_MWI: {
985 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "MWI Message", NULL);
986 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL);
987 setNotiTime(noti_h, noti_info->time);
990 case MSG_MGR_NOTI_TYPE_CLASS0: {
991 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "CLASS 0 Message", NULL);
992 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL);
993 setNotiTime(noti_h, noti_info->time);
996 case MSG_MGR_NOTI_TYPE_SMS_DELIVERY_REPORT: {
997 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "Delivery report", DELIVERY_MESSAGE);
998 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL);
1000 if (noti_info->extra_data == MSG_NETWORK_DELIVER_SUCCESS) {
1001 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message delivered", MESSAGE_DELIVERED);
1002 } else if (noti_info->extra_data == MSG_NETWORK_DELIVER_EXPIRED) {
1003 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message expired", MESSAGE_EXPIRED);
1005 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message delayed", MESSAGE_DELAYED);
1008 setNotiTime(noti_h, noti_info->time);
1011 case MSG_MGR_NOTI_TYPE_MMS_READ_REPORT: {
1012 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "Read Report", READ_REPORT_MESSAGE);
1014 char readStatusString[50] = {0,};
1015 if (noti_info->extra_data == MSG_READ_REPORT_IS_DELETED) {
1016 snprintf(readStatusString, sizeof(readStatusString), "Message deleted by %s", noti_info->sender);
1017 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);
1019 char readStatusString[50] = {0,};
1020 snprintf(readStatusString, sizeof(readStatusString), "Message read by %s", noti_info->sender);
1021 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);
1024 setNotiTime(noti_h, noti_info->time);
1027 case MSG_MGR_NOTI_TYPE_MMS_DELIVERY_REPORT: {
1028 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "Delivery Report", DELIVERY_MESSAGE);
1029 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->sender, NULL);
1031 if (noti_info->extra_data == MSG_DELIVERY_REPORT_EXPIRED) {
1032 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message expired", MESSAGE_EXPIRED);
1033 } else if (noti_info->extra_data == MSG_DELIVERY_REPORT_REJECTED) {
1034 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message rejected", MESSAGE_REJECTED);
1035 } else if (noti_info->extra_data == MSG_DELIVERY_REPORT_DEFERRED) {
1036 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message delayed", MESSAGE_DELAYED);
1037 } else if (noti_info->extra_data == MSG_DELIVERY_REPORT_UNRECOGNISED || noti_info->extra_data == MSG_DELIVERY_REPORT_INDETERMINATE
1038 || noti_info->extra_data == MSG_DELIVERY_REPORT_FORWARDED || noti_info->extra_data == MSG_DELIVERY_REPORT_UNREACHABLE
1039 || noti_info->extra_data == MSG_DELIVERY_REPORT_ERROR) {
1040 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Recipient not available", RECIPIENT_NOT_AVAILABLE);
1042 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, "Message delivered", MESSAGE_DELIVERED);
1045 setNotiTime(noti_h, noti_info->time);
1048 case MSG_MGR_NOTI_TYPE_MMS_READ_REPORT_SENT: {
1049 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "Messages", MSG_MESSAGE);
1051 if ((int)noti_info->extra_data == MSG_NETWORK_SEND_FAIL) {
1052 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, "Failed to send Read report", FAILED_TO_SEND_MMS_READ_REPORT);
1054 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, "Read report sent", MMS_READ_REPORT_SENT);
1057 setNotiTime(noti_h, noti_info->time);
1060 case MSG_MGR_NOTI_TYPE_SIM_FULL: {
1061 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "SIM card full", SMS_SIM_CARD_FULL);
1062 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, "Not enough memory. Delete some items.", SMS_MESSAGE_MEMORY_FULL);
1065 case MSG_MGR_NOTI_TYPE_STORAGE_FULL: {
1066 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "Not enough space", NULL);
1067 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, "Couldn't receive new messages", NULL);
1068 setNotiTime(noti_h, time(NULL));
1072 MSG_MGR_DEBUG("No matching type [%d]", noti_info->type);
1079 void setIcon(notification_h noti_h, MSG_MGR_NOTI_INFO_S *noti_info)
1083 switch (noti_info->type) {
1084 #ifdef MSG_NOTI_INTEGRATION
1085 case MSG_MGR_NOTI_TYPE_NORMAL:
1086 case MSG_MGR_NOTI_TYPE_CB:
1087 case MSG_MGR_NOTI_TYPE_SIM: {
1088 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, MSG_NORMAL_STATUS_ICON);
1089 if (noti_info->count > 1 && noti_info->senderCount > 1) {
1090 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_LOCK, MSG_NORMAL_ICON_PATH);
1091 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_NORMAL_ICON_PATH);
1092 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_SUB, "");
1094 if (noti_info->active_subtype == MSG_CB_SMS) {
1095 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_LOCK, MSG_CB_ICON_PATH);
1096 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_CB_ICON_PATH);
1097 } else if (noti_info->active_subtype == MSG_WAP_SI_SMS || noti_info->active_subtype == MSG_WAP_SL_SMS) {
1098 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_LOCK, MSG_ACTIVE_PUSH_ICON_PATH);
1099 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_ACTIVE_PUSH_ICON_PATH);
1100 } else if (noti_info->active_subtype == MSG_SYNCML_CP) {
1101 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_OTA_ICON_PATH);
1103 if (noti_info->imagePath[0] != '\0') {
1104 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_LOCK, noti_info->imagePath);
1105 /* for user profile image, use NOTIFICATION_IMAGE_TYPE_THUMBNAIL to show icon as circle */
1106 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_THUMBNAIL, noti_info->imagePath);
1108 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_LOCK, MSG_NO_CONTACT_PROFILE_ICON_PATH);
1109 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_NO_CONTACT_PROFILE_ICON_PATH);
1110 /* TSAM-9359 : priority of image selection on quickpanel, thumbnail is higher. So set NOTIFICATION_IMAGE_TYPE_THUMBNAIL with null */
1111 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_THUMBNAIL, NULL);
1114 char *msg_icon_path = NULL;
1115 if (getAppIcon(MSG_DEFAULT_APP_ID, &msg_icon_path) == 0) {
1116 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_SUB, msg_icon_path);
1117 g_free(msg_icon_path);
1119 MSG_MGR_ERR("fail to get message-app icon");
1126 case MSG_MGR_NOTI_TYPE_NORMAL: {
1127 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, MSG_NORMAL_STATUS_ICON);
1128 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_LOCK, MSG_NORMAL_ICON_PATH);
1130 if (noti_info->count > 1) {
1131 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_NORMAL_ICON_PATH);
1133 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_REPLY_ICON_PATH);
1137 case MSG_MGR_NOTI_TYPE_CB: {
1138 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_CB_ICON_PATH);
1139 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, MSG_CB_ICON_PATH);
1142 case MSG_MGR_NOTI_TYPE_SIM: {
1143 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_SIM_ICON_PATH);
1144 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, MSG_SIM_ICON_PATH);
1148 case MSG_MGR_NOTI_TYPE_FAILED: {
1149 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_SMS_SENDING_FAILED_ICON_PATH);
1150 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, MSG_FAILED_STATUS_ICON);
1153 case MSG_MGR_NOTI_TYPE_VOICE_1:
1154 case MSG_MGR_NOTI_TYPE_VOICE_2:
1155 case MSG_MGR_NOTI_TYPE_MWI: {
1156 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, MSG_VOICE_MSG_STATUS_ICON);
1157 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_VOICE_ICON_PATH);
1160 case MSG_MGR_NOTI_TYPE_CLASS0:
1161 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_NORMAL_ICON_PATH);
1163 case MSG_MGR_NOTI_TYPE_SMS_DELIVERY_REPORT:
1164 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, MSG_DELIVER_REPORT_STATUS_ICON);
1165 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_DELIVERY_ICON_PATH);
1167 case MSG_MGR_NOTI_TYPE_MMS_READ_REPORT:
1168 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, MSG_READ_REPORT_STATUS_ICON);
1169 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_READ_ICON_PATH);
1171 case MSG_MGR_NOTI_TYPE_MMS_READ_REPORT_SENT:
1172 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, MSG_READ_REPORT_STATUS_ICON);
1173 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_READ_ICON_PATH);
1175 case MSG_MGR_NOTI_TYPE_MMS_DELIVERY_REPORT:
1176 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, MSG_DELIVER_REPORT_STATUS_ICON);
1177 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_DELIVERY_ICON_PATH);
1179 case MSG_MGR_NOTI_TYPE_SIM_FULL:
1180 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_NORMAL_ICON_PATH);
1181 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, MSG_SIM_FULL_STATUS_ICON);
1183 case MSG_MGR_NOTI_TYPE_STORAGE_FULL: {
1184 char *msg_icon_path = NULL;
1185 if (getAppIcon(MSG_DEFAULT_APP_ID, &msg_icon_path) == 0) {
1186 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, msg_icon_path);
1187 g_free(msg_icon_path);
1189 MSG_MGR_ERR("fail to get message-app icon");
1191 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, MSG_STORAGE_FULL_STATUS_ICON);
1195 MSG_MGR_DEBUG("No matching type for MsgNotiSetImage [%d]", noti_info->type);
1202 void setActiveProperty(notification_h noti_h, MSG_MGR_NOTI_INFO_S *noti_info)
1206 int noti_err = NOTIFICATION_ERROR_NONE;
1209 noti_err = notification_set_layout(noti_h, NOTIFICATION_LY_NOTI_EVENT_SINGLE);
1210 if (noti_err != NOTIFICATION_ERROR_NONE) {
1211 MSG_MGR_DEBUG("Fail to notification_set_layout : %d", noti_err);
1215 noti_err = notification_set_led(noti_h, NOTIFICATION_LED_OP_ON, 0x00);
1216 if (noti_err != NOTIFICATION_ERROR_NONE) {
1217 MSG_MGR_DEBUG("Fail to notification_set_led.");
1220 /* set execute option and property */
1221 switch (noti_info->type) {
1222 case MSG_MGR_NOTI_TYPE_NORMAL:
1223 notification_set_launch_option(noti_h, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, noti_info->active_noti_svc_h[2]);
1224 notification_set_property(noti_h, NOTIFICATION_PROP_DISABLE_AUTO_DELETE);
1226 case MSG_MGR_NOTI_TYPE_CLASS0:
1227 notification_set_launch_option(noti_h, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, noti_info->active_noti_svc_h[2]);
1230 MSG_MGR_DEBUG("No matching type for notification_set_launch_option() [%d]", noti_info->type);
1235 noti_err = notification_set_display_applist(noti_h, NOTIFICATION_DISPLAY_APP_ACTIVE);
1236 if (noti_err != NOTIFICATION_ERROR_NONE) {
1237 MSG_MGR_DEBUG("Fail to notification_set_display_applist");
1241 noti_err = notification_set_pkgname(noti_h, MSG_DEFAULT_APP_ID);
1242 if (noti_err != NOTIFICATION_ERROR_NONE) {
1243 MSG_MGR_DEBUG("Fail to notification_set_pkgname");
1250 void setActiveText(notification_h noti_h, MSG_MGR_NOTI_INFO_S *noti_info)
1254 switch (noti_info->type) {
1255 case MSG_MGR_NOTI_TYPE_NORMAL:
1256 case MSG_MGR_NOTI_TYPE_SIM:
1257 case MSG_MGR_NOTI_TYPE_CB: {
1258 if (noti_info->active_subject[0] == '\0') {
1259 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, noti_info->active_sender, NULL);
1260 if (noti_info->active_text[0] != '\0') {
1261 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->active_text, NULL);
1263 if (noti_info->active_media_cnt > 1) {
1264 char attach_string[20] = {0,};
1265 snprintf(attach_string, sizeof(attach_string), "%d attachments", noti_info->active_media_cnt);
1266 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);
1267 } else if (noti_info->active_media_cnt == 1) {
1268 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, "1 attachment", MSG_SINGLE_ATTACHMENT);
1272 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, noti_info->active_sender, NULL);
1273 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_INFO_1, noti_info->active_subject, NULL);
1274 if (noti_info->active_text[0] != '\0') {
1275 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->active_text, NULL);
1277 if (noti_info->active_media_cnt > 1) {
1278 char attach_string[20] = {0,};
1279 snprintf(attach_string, sizeof(attach_string), "%d attachments", noti_info->active_media_cnt);
1280 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, attach_string, NULL);
1281 } else if (noti_info->active_media_cnt == 1) {
1282 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, "1 attachment", NULL);
1288 case MSG_MGR_NOTI_TYPE_CLASS0: {
1289 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_TITLE, "CLASS 0 Message", NULL);
1290 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info->active_sender, NULL);
1294 MSG_MGR_DEBUG("No matching type [%d]", noti_info->type);
1302 void setActiveIcon(notification_h noti_h, MSG_MGR_NOTI_INFO_S *noti_info)
1306 switch (noti_info->type) {
1307 case MSG_MGR_NOTI_TYPE_NORMAL:
1308 case MSG_MGR_NOTI_TYPE_SIM: {
1309 switch (noti_info->active_subtype) {
1311 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_CB_ICON_PATH);
1313 case MSG_WAP_SI_SMS:
1314 case MSG_WAP_SL_SMS:
1315 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_ACTIVE_PUSH_ICON_PATH);
1318 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_OTA_ICON_PATH);
1321 if (noti_info->imagePath[0] != '\0')
1322 /* for user profile image, use NOTIFICATION_IMAGE_TYPE_THUMBNAIL to show icon as circle */
1323 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_THUMBNAIL, noti_info->imagePath);
1325 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_NO_CONTACT_PROFILE_ICON_PATH);
1327 char *msg_icon_path = NULL;
1328 if (getAppIcon(MSG_DEFAULT_APP_ID, &msg_icon_path) == 0) {
1329 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_SUB, msg_icon_path);
1330 g_free(msg_icon_path);
1332 MSG_MGR_ERR("fail to get message-app icon");
1340 case MSG_MGR_NOTI_TYPE_CB: {
1341 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_CB_ICON_PATH);
1344 case MSG_MGR_NOTI_TYPE_CLASS0:
1345 setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_NORMAL_ICON_PATH);
1348 MSG_MGR_DEBUG("No matching type for MsgNotiSetImage [%d]", noti_info->type);
1356 int MsgMgrInsertDeliveryReportInstantNotification(msg_mgr_notification_type_t noti_type, int result)
1360 notification_h noti = notification_create(NOTIFICATION_TYPE_NOTI);
1361 notification_set_pkgname(noti, MSG_DEFAULT_APP_ID);
1363 setTextDomain(noti);
1364 setNotiText(noti, NOTIFICATION_TEXT_TYPE_TITLE, "Delivery report", DELIVERY_MESSAGE);
1365 setNotiImage(noti, NOTIFICATION_IMAGE_TYPE_ICON, MSG_DELIVER_REPORT_STATUS_ICON);
1367 if (noti_type == MSG_MGR_NOTI_TYPE_SMS_DELIVERY_REPORT) {
1368 if (result == MSG_NETWORK_DELIVER_SUCCESS) {
1369 setNotiText(noti, NOTIFICATION_TEXT_TYPE_CONTENT, "Message delivered.", MESSAGE_DELIVERED_POPUP);
1370 } else if (result == MSG_NETWORK_DELIVER_EXPIRED) {
1371 setNotiText(noti, NOTIFICATION_TEXT_TYPE_CONTENT, "Couldn't deliver message. Message expired.", UNABLE_TO_DELIVER_MESSAGE_MESSAGE_EXPIRED);
1372 } else if (result == MSG_NETWORK_DELIVER_PENDING) {
1373 setNotiText(noti, NOTIFICATION_TEXT_TYPE_CONTENT, "Message delayed.", MESSAGE_DELAYED_POPUP);
1375 MSG_MGR_ERR("unexpected result! [%d]", result);
1376 goto _END_OF_INSTANT_DELIVERY_REPORT_NOTI;
1378 } else if (noti_type == MSG_MGR_NOTI_TYPE_MMS_DELIVERY_REPORT) {
1379 if (result == MSG_DELIVERY_REPORT_EXPIRED)
1380 setNotiText(noti, NOTIFICATION_TEXT_TYPE_CONTENT, "Couldn't deliver message. Message expired.", UNABLE_TO_DELIVER_MESSAGE_MESSAGE_EXPIRED);
1381 else if (result== MSG_DELIVERY_REPORT_REJECTED)
1382 setNotiText(noti, NOTIFICATION_TEXT_TYPE_CONTENT, "Couldn't deliver message. Message rejected by recipient.", UNABLE_TO_DELIVER_MESSAGE_MESSAGE_REJECTED);
1383 else if (result == MSG_DELIVERY_REPORT_DEFERRED)
1384 setNotiText(noti, NOTIFICATION_TEXT_TYPE_CONTENT, "Message delayed.", MESSAGE_DELAYED_POPUP);
1385 else if (result == MSG_DELIVERY_REPORT_UNRECOGNISED || result == MSG_DELIVERY_REPORT_INDETERMINATE ||
1386 result == MSG_DELIVERY_REPORT_FORWARDED || result == MSG_DELIVERY_REPORT_UNREACHABLE ||
1387 result == MSG_DELIVERY_REPORT_ERROR)
1388 setNotiText(noti, NOTIFICATION_TEXT_TYPE_CONTENT, "Couldn't deliver message. Recipient not available.", UNABLE_TO_DELIVER_MESSAGE_RECIPIENT_NOT_AVAILABLE);
1390 setNotiText(noti, NOTIFICATION_TEXT_TYPE_CONTENT, "Message delivered.", MESSAGE_DELIVERED_POPUP);
1393 if (notification_set_display_applist(noti, NOTIFICATION_DISPLAY_APP_TICKER) != NOTIFICATION_ERROR_NONE)
1394 MSG_MGR_ERR("Fail to notification_set_display_applist");
1396 if (notification_post(noti) != NOTIFICATION_ERROR_NONE)
1397 MSG_MGR_ERR("Fail to notification_post");
1399 _END_OF_INSTANT_DELIVERY_REPORT_NOTI:
1401 if (notification_delete(noti) != NOTIFICATION_ERROR_NONE)
1402 MSG_MGR_ERR("Fail to notification_delete");
1405 if (notification_free(noti) != NOTIFICATION_ERROR_NONE)
1406 MSG_MGR_ERR("Fail to notification_free");
1415 void setSoundAndVibration(notification_h noti_h, char *addressVal, bool bVoiceMail)
1419 MSG_MGR_ADDRESS_INFO_S addrInfo = {0, };
1420 MSG_MGR_CONTACT_INFO_S contactInfo = {0, };
1422 if (addressVal != NULL) {
1423 snprintf(addrInfo.addressVal, sizeof(addrInfo.addressVal), "%s", addressVal);
1424 /* Get Contact Info */
1425 if (MsgMgrGetContactInfo(&addrInfo, &contactInfo) != 0) {
1426 MSG_MGR_DEBUG("MsgMgrGetContactInfo() fail.");
1429 MSG_MGR_DEBUG("addressVal is NULL.");
1432 char *msg_tone_file_path = NULL;
1434 MsgMgrGetRingtonePath(contactInfo.alerttonePath, &msg_tone_file_path);
1436 MSG_MGR_SEC_DEBUG("Sound File [%s]", msg_tone_file_path);
1438 bool bPlaySound = false;
1439 bool bPlayVibration = false;
1440 bool bOnCall = false;
1442 MsgMgrGetPlayStatus(bVoiceMail, &bPlaySound, &bPlayVibration, &bOnCall);
1445 if (msg_tone_file_path) {
1446 setNotiSound(noti_h, NOTIFICATION_SOUND_TYPE_USER_DATA, msg_tone_file_path);
1449 if (vconf_get_int(MSG_SETTING_RINGTONE_TYPE, &tmpVal) != 0) {
1450 MSG_MGR_INFO("vconf_get_int() is failed");
1452 int ringtoneType = tmpVal;
1453 if (ringtoneType == MSG_RINGTONE_TYPE_SILENT)
1454 setNotiSound(noti_h, NOTIFICATION_SOUND_TYPE_NONE, NULL);
1456 setNotiSound(noti_h, NOTIFICATION_SOUND_TYPE_DEFAULT, NULL);
1459 setNotiSound(noti_h, NOTIFICATION_SOUND_TYPE_NONE, NULL);
1462 if (bPlayVibration) {
1463 if (contactInfo.vibrationPath[0] == '\0')
1464 setNotiVibration(noti_h, NOTIFICATION_VIBRATION_TYPE_DEFAULT, NULL);
1466 setNotiVibration(noti_h, NOTIFICATION_VIBRATION_TYPE_USER_DATA, contactInfo.vibrationPath);
1468 setNotiVibration(noti_h, NOTIFICATION_VIBRATION_TYPE_NONE, NULL);
1471 if (msg_tone_file_path)
1472 delete [] msg_tone_file_path;
1478 void setActiveNotification(notification_h noti_h, MSG_MGR_NOTI_INFO_S *noti_info)
1482 int noti_err = NOTIFICATION_ERROR_NONE;
1484 if (noti_info->active_noti_button_num > 1) {
1485 createServiceHandle(¬i_info->active_noti_svc_h[0]);
1486 if (noti_info->active_noti_svc_h[0]) {
1487 setServicePackageName(noti_info->active_noti_svc_h[0], MSG_CALL_APP_ID);
1488 setServiceOperation(noti_info->active_noti_svc_h[0], APP_CONTROL_OPERATION_CALL);
1490 MSG_MGR_DEBUG("Active Notification button 1 - Msg Id = [%d]", noti_info->msg_id);
1492 char tel_num[MSG_NOTI_TEXT_LEN_S] = {0, };
1493 snprintf(tel_num, sizeof(tel_num), "tel:%s", noti_info->number);
1494 MSG_MGR_SEC_DEBUG("Active sender number [%s]", noti_info->number);
1495 setServiceUri(noti_info->active_noti_svc_h[0], tel_num);
1498 createServiceHandle(¬i_info->active_noti_svc_h[1]);
1499 if (noti_info->active_noti_svc_h[1]) {
1500 setServicePackageName(noti_info->active_noti_svc_h[1], MSG_MGR_APP_ID);
1502 MSG_MGR_DEBUG("Active Notification button 2 - Msg Id = [%d] number = [%s] slot_id = [%d]", noti_info->msg_id, noti_info->number, noti_info->sim_idx);
1503 addServiceExtraData(noti_info->active_noti_svc_h[1], "cmd", "reply_msg");
1504 addServiceExtraData(noti_info->active_noti_svc_h[1], "msg_id", noti_info->msg_id);
1505 addServiceExtraData(noti_info->active_noti_svc_h[1], "addr", noti_info->number);
1507 char slot_id[5] = {0, };
1508 snprintf(slot_id, sizeof(slot_id), "%d", noti_info->sim_idx);
1509 addServiceExtraData(noti_info->active_noti_svc_h[1], "slot_id", slot_id);
1513 createServiceHandle(¬i_info->active_noti_svc_h[2]);
1514 if (noti_info->active_noti_svc_h[2]) {
1515 setServicePackageName(noti_info->active_noti_svc_h[2], MSG_DEFAULT_APP_ID);
1517 MSG_MGR_DEBUG("Active Notification button 3 - msgId = [%d]", noti_info->msg_id);
1518 addServiceExtraData(noti_info->active_noti_svc_h[2], "type", "new_msg");
1519 addServiceExtraData(noti_info->active_noti_svc_h[2], "msgId", noti_info->msg_id);
1520 addServiceExtraData(noti_info->active_noti_svc_h[2], "CALLER", "active_noti");
1522 char slot_id[5] = {0, };
1523 snprintf(slot_id, sizeof(slot_id), "%d", noti_info->sim_idx - 1);
1524 addServiceExtraData(noti_info->active_noti_svc_h[2], "slot_id", slot_id);
1527 if (noti_info->active_noti_button_num > 1) {
1528 setNotiEventHandler(noti_h, NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1, noti_info->active_noti_svc_h[0]);
1529 setNotiEventHandler(noti_h, NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_2, noti_info->active_noti_svc_h[1]);
1530 notification_set_text_input(noti_h, 100);
1531 setNotiEventHandler(noti_h, NOTIFICATION_EVENT_TYPE_CLICK_ON_TEXT_INPUT_BUTTON, noti_info->active_noti_svc_h[1]);
1532 setNotiEventHandler(noti_h, NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_3, noti_info->active_noti_svc_h[2]);
1534 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_BUTTON_1, "Call", MSG_STRING_CALL);
1535 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_BUTTON_2, "Reply", MSG_STRING_REPLY);
1536 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_BUTTON_3, "View", MSG_STRING_VIEW);
1538 setNotiEventHandler(noti_h, NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1, noti_info->active_noti_svc_h[2]);
1540 setNotiText(noti_h, NOTIFICATION_TEXT_TYPE_BUTTON_1, "View", MSG_STRING_VIEW);
1543 setActiveProperty(noti_h, noti_info);
1545 setTextDomain(noti_h);
1547 setActiveText(noti_h, noti_info);
1549 setActiveIcon(noti_h, noti_info);
1551 noti_err = notification_post(noti_h);
1552 if (noti_err != NOTIFICATION_ERROR_NONE) {
1553 MSG_MGR_DEBUG("Fail to notification_post");
1560 void setNotification(notification_h noti_h, MSG_MGR_NOTI_INFO_S *noti_info, bool bFeedback)
1564 int noti_err = NOTIFICATION_ERROR_NONE;
1566 MSG_MGR_DEBUG("active num [%d]", noti_info->active_noti_button_num);
1568 if (bFeedback && noti_info->active_noti_button_num > MSG_ACTIVE_NOTI_BUTTON_NUM_NONE &&
1569 ((noti_info->type >= MSG_MGR_NOTI_TYPE_NORMAL && noti_info->type <= MSG_MGR_NOTI_TYPE_SIM) || noti_info->type == MSG_MGR_NOTI_TYPE_CLASS0)) {
1570 notification_h active_noti_h = notification_create(NOTIFICATION_TYPE_NOTI);
1572 setActiveNotification(active_noti_h, noti_info);
1574 notification_free(active_noti_h);
1575 active_noti_h = NULL;
1578 setProperty(noti_h, noti_info);
1580 setTextDomain(noti_h);
1582 setText(noti_h, noti_info);
1584 setIcon(noti_h, noti_info);
1587 if (noti_info->type == MSG_MGR_NOTI_TYPE_VOICE_1 || noti_info->type == MSG_MGR_NOTI_TYPE_VOICE_2)
1588 setSoundAndVibration(noti_h, noti_info->number, true);
1590 setSoundAndVibration(noti_h, noti_info->number, false);
1593 setNotiSound(noti_h, NOTIFICATION_SOUND_TYPE_NONE, NULL);
1594 setNotiVibration(noti_h, NOTIFICATION_VIBRATION_TYPE_NONE, NULL);
1597 if (noti_info->id > 0) {
1598 MSG_MGR_DEBUG("Notification update");
1599 noti_err = notification_update(noti_h);
1600 if (noti_err != NOTIFICATION_ERROR_NONE) {
1601 MSG_MGR_DEBUG("Fail to notification_update");
1604 MSG_MGR_DEBUG("Notification insert");
1605 noti_err = notification_insert(noti_h, ¬i_info->id);
1606 if (noti_err != NOTIFICATION_ERROR_NONE) {
1607 MSG_MGR_DEBUG("Fail to notification_insert");
1610 updatePrivId(noti_info->type, noti_info->id, noti_info->sim_idx);
1613 if (noti_info->type == MSG_MGR_NOTI_TYPE_MMS_READ_REPORT_SENT && noti_info->msg_id > 0) {
1614 int err = vconf_set_int(VCONFKEY_MESSAGE_READ_REPORT_SENT_MSG_ID, noti_info->msg_id);
1616 MSG_MGR_ERR("vconf_set_int() failed [%d]", err);
1623 void createActiveInfoData(MSG_MGR_NOTI_INFO_S *noti_info, MSG_MGR_MESSAGE_INFO_S *msg_info)
1628 MSG_MGR_DEBUG("msg_info is NULL");
1632 noti_info->msg_id = msg_info->msgId;
1633 noti_info->sim_idx = msg_info->sim_idx;
1635 switch (noti_info->type) {
1636 case MSG_MGR_NOTI_TYPE_NORMAL: {
1637 char *senderStr = get_translate_text(MSG_MGR_PACKAGE_NAME, MSG_MGR_LOCALEDIR, PUSH_MESSAGE);
1638 snprintf(noti_info->active_sender, MSG_NOTI_TEXT_LEN_S, "%s", senderStr);
1645 case MSG_MGR_NOTI_TYPE_CLASS0: {
1646 if (msg_info->displayName[0] == '\0')
1647 snprintf(noti_info->active_sender, MSG_NOTI_TEXT_LEN_S, "%s", msg_info->addressVal);
1649 snprintf(noti_info->active_sender, MSG_NOTI_TEXT_LEN_S, "%s", msg_info->displayName);
1651 snprintf(noti_info->active_text, MSG_NOTI_TEXT_LEN, "%s", msg_info->msgText);
1655 MSG_MGR_DEBUG("No matching type [%d]", noti_info->type);
1663 void clearInfoData(notification_h noti_h, MSG_MGR_NOTI_INFO_S *noti_info)
1668 notification_free(noti_h);
1672 if (noti_info->svc_h) {
1673 app_control_destroy(noti_info->svc_h);
1674 noti_info->svc_h = NULL;
1677 for (int i = 0; i < MSG_ACTIVE_NOTI_BUTTON_NUM; i++) {
1678 if (noti_info->active_noti_svc_h[i]) {
1679 app_control_destroy(noti_info->active_noti_svc_h[i]);
1680 noti_info->active_noti_svc_h[i] = NULL;
1688 int getAppIcon(const char *app_id, char **icon_path)
1692 package_info_h pkg_info_h = NULL;
1693 int pkg_err = PACKAGE_MANAGER_ERROR_NONE;
1696 if (app_id == NULL) {
1697 MSG_MGR_ERR("app id is NULL");
1699 goto END_OF_GET_APP_ICON;
1702 pkg_err = package_info_create(app_id, &pkg_info_h);
1703 if (pkg_err != PACKAGE_MANAGER_ERROR_NONE) {
1704 MSG_MGR_ERR("package_info_create failed (%d)", pkg_err);
1706 goto END_OF_GET_APP_ICON;
1709 pkg_err = package_info_get_icon(pkg_info_h, icon_path);
1710 if (pkg_err != PACKAGE_MANAGER_ERROR_NONE) {
1711 MSG_MGR_ERR("package_info_get_icon failed (%d)", pkg_err);
1714 if (icon_path == NULL) {
1715 MSG_MGR_WARN("icon path is NULL");
1720 END_OF_GET_APP_ICON:
1722 pkg_err = package_info_destroy(pkg_info_h);
1723 if (pkg_err != PACKAGE_MANAGER_ERROR_NONE) {
1724 MSG_MGR_ERR("package_info_destroy failed (%d)", pkg_err);
1736 int getLatestMsgInfo(MSG_MGR_NOTI_INFO_S *noti_info, bool isForInstantMessage)
1741 msg_error_t msg_err = MSG_SUCCESS;
1742 char **db_res = NULL;
1743 int row_cnt = 0, col_cnt = 0;
1745 switch (noti_info->type) {
1746 case MSG_MGR_NOTI_TYPE_NORMAL:
1747 #ifdef MSG_NOTI_INTEGRATION
1748 case MSG_MGR_NOTI_TYPE_CB:
1749 case MSG_MGR_NOTI_TYPE_SIM:
1752 int smsUnreadCnt = 0;
1753 int mmsUnreadCnt = 0;
1755 char sqlQuery[MAX_QUERY_LEN +1];
1756 unsigned char mainType;
1757 unsigned char subType;
1758 int msgSize, attachmentCnt;
1760 memset(sqlQuery, 0x00, sizeof(sqlQuery));
1761 #ifdef MSG_NOTI_INTEGRATION
1762 snprintf(sqlQuery, sizeof(sqlQuery), "DISTINCT "
1766 "WHERE A.CONV_ID=B.CONV_ID "
1767 "AND B.READ_STATUS=0 AND (B.FOLDER_ID=%d OR B.FOLDER_ID=%d) "
1768 "AND B.STORAGE_ID = %d "
1769 "GROUP BY A.ADDRESS_VAL "
1770 "ORDER BY B.DISPLAY_TIME DESC LIMIT 5;",
1771 MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME,
1772 MSG_INBOX_ID, MSG_CBMSGBOX_ID,
1775 snprintf(sqlQuery, sizeof(sqlQuery), "DISTINCT "
1779 "WHERE A.CONV_ID=B.CONV_ID "
1780 "AND B.READ_STATUS=0 AND B.FOLDER_ID=%d "
1781 "AND B.STORAGE_ID = %d "
1782 "GROUP BY A.ADDRESS_VAL "
1783 "ORDER BY B.DISPLAY_TIME DESC LIMIT 5;",
1784 MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME,
1788 MSG_MGR_DEBUG("sqlQuery [%s]", sqlQuery);
1790 row_cnt = 0, col_cnt = 0;
1791 msg_err = msg_db_select_with_query(msg_handle, sqlQuery, &db_res, &row_cnt, &col_cnt);
1792 if (msg_err != MSG_SUCCESS) {
1793 MSG_MGR_ERR("msg_db_select_with_query() failed [%d]", msg_err);
1797 MSG_MGR_ADDRESS_INFO_S tmpAddressInfo;
1798 int normalAddCnt = 0;
1799 int index = col_cnt;
1801 for (int i = 1; i <= row_cnt; i++) {
1802 memset(&tmpAddressInfo, 0x00, sizeof(MSG_MGR_ADDRESS_INFO_S));
1804 char *address = db_res[index++];
1807 snprintf(tmpAddressInfo.addressVal, MAX_ADDRESS_VAL_LEN, "%s", address);
1808 if (_is_valid_email(address)) {
1809 tmpAddressInfo.addressType = MSG_ADDRESS_TYPE_EMAIL;
1811 tmpAddressInfo.addressType = MSG_ADDRESS_TYPE_UNKNOWN;
1814 subType = atoi(db_res[index++]);
1816 MSG_MGR_CONTACT_INFO_S tmpContact;
1817 memset(&tmpContact, 0x00, sizeof(MSG_MGR_CONTACT_INFO_S));
1819 MsgMgrGetContactInfo(&tmpAddressInfo, &tmpContact);
1822 snprintf(noti_info->imagePath, sizeof(noti_info->imagePath), "%s", tmpContact.imagePath);
1825 if (normalAddCnt > 1) {
1826 g_strlcat(noti_info->sender, ", ", sizeof(noti_info->sender)-strlen(noti_info->sender));
1829 if (tmpContact.firstName[0] != '\0') {
1830 g_strlcat(noti_info->sender, tmpContact.firstName, sizeof(noti_info->sender)-strlen(noti_info->sender));
1831 } else if (tmpAddressInfo.addressVal[0] == '\0') {
1832 char *senderStr = NULL;
1833 senderStr = get_translate_text(MSG_MGR_PACKAGE_NAME, MSG_MGR_LOCALEDIR, MSG_UNKNOWN_SENDER);
1834 g_strlcat(noti_info->sender, senderStr, sizeof(noti_info->sender)-strlen(noti_info->sender));
1841 noti_info->active_noti_button_num = MSG_ACTIVE_NOTI_BUTTON_NUM_UNKNOWN_SENDER;
1844 char *senderStr = NULL;
1845 if (subType == MSG_CB_SMS) {
1846 senderStr = get_translate_text(MSG_MGR_PACKAGE_NAME, MSG_MGR_LOCALEDIR, CB_MESSAGE);
1847 g_strlcat(noti_info->sender, senderStr, sizeof(noti_info->sender)-strlen(noti_info->sender));
1848 noti_info->active_noti_button_num = MSG_ACTIVE_NOTI_BUTTON_NUM_CB_MESSAGE;
1849 } else if (subType == MSG_SYNCML_CP) {
1850 senderStr = get_translate_text(MSG_MGR_PACKAGE_NAME, MSG_MGR_LOCALEDIR, CP_MESSAGE);
1851 g_strlcat(noti_info->sender, senderStr, sizeof(noti_info->sender)-strlen(noti_info->sender));
1852 noti_info->active_noti_button_num = MSG_ACTIVE_NOTI_BUTTON_NUM_PUSH_MESSAGE;
1853 } else if (subType == MSG_WAP_SI_SMS || subType == MSG_WAP_SL_SMS) {
1854 senderStr = get_translate_text(MSG_MGR_PACKAGE_NAME, MSG_MGR_LOCALEDIR, PUSH_MESSAGE);
1855 g_strlcat(noti_info->sender, senderStr, sizeof(noti_info->sender)-strlen(noti_info->sender));
1856 noti_info->active_noti_button_num = MSG_ACTIVE_NOTI_BUTTON_NUM_PUSH_MESSAGE;
1858 g_strlcat(noti_info->sender, tmpAddressInfo.addressVal, sizeof(noti_info->sender)-strlen(noti_info->sender));
1859 if (subType == MSG_NOTIFICATIONIND_MMS)
1860 noti_info->active_noti_button_num = MSG_ACTIVE_NOTI_BUTTON_NUM_UNRETRIVED_MESSAGE;
1870 noti_info->active_subtype = subType;
1871 snprintf(noti_info->active_sender, MSG_NOTI_TEXT_LEN_S, "%s", noti_info->sender);
1872 snprintf(noti_info->imagePath, sizeof(noti_info->imagePath), "%s", tmpContact.imagePath);
1876 noti_info->senderCount = normalAddCnt;
1877 msg_db_free(msg_handle, db_res);
1879 MSG_MGR_SEC_DEBUG("sender info = [%s]", noti_info->sender);
1881 memset(sqlQuery, 0x00, sizeof(sqlQuery));
1882 snprintf(sqlQuery, MAX_QUERY_LEN,
1883 "(COUNT(DISTINCT(CASE WHEN MAIN_TYPE = %d THEN MSG_ID END))) AS SMS_UNREAD_CNT, "
1884 "(COUNT(DISTINCT(CASE WHEN MAIN_TYPE = %d THEN MSG_ID END))) AS MMS_UNREAD_CNT "
1885 "FROM %s WHERE READ_STATUS = 0 AND (FOLDER_ID=%d OR FOLDER_ID=%d) AND STORAGE_ID = %d;",
1888 MSGFW_MESSAGE_TABLE_NAME, MSG_INBOX_ID, MSG_CBMSGBOX_ID, MSG_STORAGE_PHONE);
1890 MSG_MGR_DEBUG("sqlQuery [%s]", sqlQuery);
1892 msg_err = msg_db_select_with_query(msg_handle, sqlQuery, &db_res, &row_cnt, &col_cnt);
1893 if (msg_err != MSG_SUCCESS) {
1894 MSG_MGR_ERR("msg_db_select_with_query() failed [%d]", msg_err);
1899 smsUnreadCnt = atoi(db_res[col_cnt]);
1900 mmsUnreadCnt = atoi(db_res[col_cnt+1]);
1903 msg_db_free(msg_handle, db_res);
1905 noti_info->count = smsUnreadCnt + mmsUnreadCnt;
1907 if (noti_info->count == 0) {
1908 MSG_MGR_DEBUG("No unread message.");
1909 MSG_MGR_DEBUG("notiPrivId [%d]", noti_info->id);
1911 if (!isForInstantMessage) {
1912 /* No unread message. */
1913 if (noti_info->id > 0) {
1914 noti_err = notification_delete_by_priv_id(MSG_DEFAULT_APP_ID, NOTIFICATION_TYPE_NOTI, noti_info->id);
1915 if (noti_err != NOTIFICATION_ERROR_NONE) {
1916 MSG_MGR_DEBUG("Fail to notification_delete_by_priv_id : %d", noti_err);
1922 if (vconf_set_int(NOTIFICATION_PRIV_ID, noti_info->id) != 0)
1923 MSG_MGR_DEBUG("vconf_set_int fail : NOTIFICATION_PRIV_ID");
1925 vconf_set_int(VCONFKEY_MESSAGE_RECV_SMS_STATE, 0);
1926 vconf_set_int(VCONFKEY_MESSAGE_RECV_MMS_STATE, 0);
1927 MsgMgrInsertBadge(0);
1928 MsgMgrSoundSetRepeatAlarm();
1934 memset(sqlQuery, 0x00, sizeof(sqlQuery));
1935 #ifdef MSG_NOTI_INTEGRATION
1936 snprintf(sqlQuery, sizeof(sqlQuery),
1940 "(CASE WHEN B.DPM_RESTRICTED = 0 THEN B.SUBJECT ELSE \"restricted message\" END), "
1941 "(CASE WHEN B.DPM_RESTRICTED = 0 THEN B.MSG_TEXT ELSE \"restricted message\" END), "
1944 "(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), "
1945 "B.ATTACHMENT_COUNT, "
1948 "LEFT JOIN %s A ON A.CONV_ID=B.CONV_ID "
1949 "WHERE B.READ_STATUS=0 AND (B.FOLDER_ID=%d OR B.FOLDER_ID=%d) "
1950 "AND B.STORAGE_ID = %d "
1951 "ORDER BY B.DISPLAY_TIME DESC;",
1952 MSG_MMS_TYPE, MSG_NETWORK_RECEIVED, MMS_PLUGIN_MESSAGE_TABLE_NAME,
1953 MSGFW_MESSAGE_TABLE_NAME,
1954 MSGFW_ADDRESS_TABLE_NAME,
1955 MSG_INBOX_ID, MSG_CBMSGBOX_ID,
1958 snprintf(sqlQuery, sizeof(sqlQuery),
1965 "(COUNT(CASE WHEN B.MAIN_TYPE = %d THEN 1 END)) AS SMS_UNREAD_CNT, "
1966 "(COUNT(CASE WHEN B.MAIN_TYPE = %d THEN 1 END)) AS MMS_UNREAD_CNT "
1968 "WHERE A.CONV_ID=B.CONV_ID "
1969 "AND B.READ_STATUS=0 AND B.FOLDER_ID=%d "
1970 "AND B.STORAGE_ID = %d "
1971 "ORDER BY B.DISPLAY_TIME DESC;",
1974 MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME,
1978 MSG_MGR_DEBUG("sqlQuery [%s]", sqlQuery);
1980 msg_err = msg_db_select_with_query(msg_handle, sqlQuery, &db_res, &row_cnt, &col_cnt);
1981 if (msg_err != MSG_SUCCESS) {
1982 MSG_MGR_ERR("msg_db_select_with_query() failed [%d]", msg_err);
1987 msgSize = atoi(db_res[col_cnt+7]);
1988 attachmentCnt = atoi(db_res[col_cnt+8]);
1989 noti_info->sim_idx = atoi(db_res[col_cnt+9]);
1991 snprintf(noti_info->number, sizeof(noti_info->number), "%s", db_res[col_cnt]);
1993 noti_info->time = (time_t)atoi(db_res[col_cnt+1]);
1995 noti_info->msg_id = (msg_message_id_t)atoi(db_res[col_cnt+2]);
1997 noti_info->conv_id = atoi(db_res[col_cnt+6]);
1999 mainType = (unsigned char)atoi(db_res[col_cnt+5]);
2001 if (mainType == MSG_MMS_TYPE) {
2002 snprintf(noti_info->text, sizeof(noti_info->text), "%s", db_res[col_cnt+3]);
2003 if (noti_info->text[0] == '\0') {
2004 char *noti_text = get_translate_text(MSG_MGR_PACKAGE_NAME, MSG_MGR_LOCALEDIR, MSG_NO_SUBJECT);
2005 snprintf(noti_info->text, sizeof(noti_info->text), "%s", noti_text);
2009 char *prefix_subject = get_translate_text(MSG_MGR_PACKAGE_NAME, MSG_MGR_LOCALEDIR, MSG_SUBJECT_COLON);
2010 if (prefix_subject) {
2011 snprintf(noti_info->active_subject, MSG_NOTI_TEXT_LEN_S, "%s%s", prefix_subject, noti_info->text);
2012 g_free(prefix_subject);
2014 snprintf(noti_info->active_subject, MSG_NOTI_TEXT_LEN_S, "%s", noti_info->text);
2018 int kb_msg_size = msgSize / 1024;
2019 if (kb_msg_size == 0 && msgSize > 0)
2021 else if (msgSize % 1024 >= 512)
2024 char *msg_size_string = get_translate_text(MSG_MGR_PACKAGE_NAME, MSG_MGR_LOCALEDIR, MESSAGE_SIZE_STRING);
2025 char *msg_size_unit_kb = get_translate_text(MSG_MGR_PACKAGE_NAME, MSG_MGR_LOCALEDIR, MESSAGE_SIZE_UNIT_KB);
2027 snprintf(noti_info->active_text, MSG_NOTI_TEXT_LEN, "%s : %d%s", msg_size_string, kb_msg_size, msg_size_unit_kb);
2029 g_free(msg_size_string);
2030 g_free(msg_size_unit_kb);
2033 noti_info->active_media_cnt = attachmentCnt;
2036 snprintf(noti_info->text, sizeof(noti_info->text), "%s", db_res[col_cnt+4]);
2039 if (noti_info->active_text[0] == '\0')
2040 snprintf(noti_info->active_text, MSG_NOTI_TEXT_LEN, "%s", db_res[col_cnt+4]);
2042 MSG_MGR_DEBUG("unread message ID [%d].", noti_info->msg_id);
2044 MSG_MGR_DEBUG("active sender [%s]", noti_info->active_sender);
2045 MSG_MGR_DEBUG("active subject [%s]", noti_info->active_subject);
2046 MSG_MGR_DEBUG("active text [%s]", noti_info->active_text);
2048 if (!isForInstantMessage) {
2049 if (noti_info->id > 0 && noti_info->count == 1) {
2050 noti_err = notification_delete_by_priv_id(MSG_DEFAULT_APP_ID, NOTIFICATION_TYPE_NOTI, noti_info->id);
2051 if (noti_err != NOTIFICATION_ERROR_NONE) {
2052 MSG_MGR_DEBUG("Fail to notification_delete_by_priv_id : %d", noti_err);
2056 if (vconf_set_int(NOTIFICATION_PRIV_ID, noti_info->id) != 0)
2057 MSG_MGR_DEBUG("vconf_set_int fail : NOTIFICATION_PRIV_ID");
2060 vconf_set_int(VCONFKEY_MESSAGE_RECV_SMS_STATE, smsUnreadCnt);
2061 vconf_set_int(VCONFKEY_MESSAGE_RECV_MMS_STATE, mmsUnreadCnt);
2062 MsgMgrInsertBadge(noti_info->count);
2063 MsgMgrSoundSetRepeatAlarm();
2066 MSG_MGR_DEBUG("sqlQuery [%s]", sqlQuery);
2067 msg_db_free(msg_handle, db_res);
2071 msg_db_free(msg_handle, db_res);
2075 #ifndef MSG_NOTI_INTEGRATION
2076 case MSG_MGR_NOTI_TYPE_CB: {
2077 char sqlQuery[MAX_QUERY_LEN+1];
2078 memset(sqlQuery, 0x00, sizeof(sqlQuery));
2080 snprintf(sqlQuery, sizeof(sqlQuery),
2086 "WHERE A.CONV_ID=B.CONV_ID "
2087 "AND B.READ_STATUS=0 "
2088 "AND B.FOLDER_ID=%d "
2089 "AND B.STORAGE_ID = %d "
2090 "ORDER BY B.DISPLAY_TIME DESC;",
2091 MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME,
2095 if (dbhandler->prepareQuery(sqlQuery) != MSG_SUCCESS)
2096 return MSG_ERR_DB_PREPARE;
2098 if (dbhandler->stepQuery() == MSG_ERR_DB_ROW) {
2099 MSG_ADDRESS_INFO_S addrInfo;
2100 memset(&addrInfo, 0x00, sizeof(MSG_ADDRESS_INFO_S));
2102 if (dbhandler->columnText(0) != NULL)
2103 snprintf(addrInfo.addressVal, sizeof(addrInfo.addressVal), "%s", (char*)dbhandler->columnText(0));
2105 MSG_CONTACT_INFO_S tmpContact;
2106 memset(&tmpContact, 0x00, sizeof(MSG_CONTACT_INFO_S));
2108 MsgGetContactInfo(&addrInfo, &tmpContact);
2110 if (tmpContact.firstName[0] != '\0') {
2111 snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", tmpContact.firstName);
2112 } else if (addrInfo.addressVal[0] == '\0') {
2113 char *senderStr = NULL;
2114 senderStr = get_translate_text(MSG_MGR_PACKAGE_NAME, MSG_MGR_LOCALEDIR, MSG_UNKNOWN_SENDER);
2115 g_strlcat(noti_info->sender, senderStr, sizeof(noti_info->sender)-strlen(noti_info->sender));
2121 snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", addrInfo.addressVal);
2124 snprintf(noti_info->number, sizeof(noti_info->number), "%s", addrInfo.addressVal);
2126 noti_info->time = (time_t)dbhandler->columnInt(1);
2128 noti_info->msg_id = (msg_message_id_t)dbhandler->columnInt(2);
2130 snprintf(noti_info->text, sizeof(noti_info->text), "%s", (char*)dbhandler->columnText(3));
2132 MSG_MGR_DEBUG("unread CB message [%d].", noti_info->msg_id);
2134 MSG_MGR_DEBUG("No unread CB message.");
2135 MSG_MGR_DEBUG("notiCbId [%d]", noti_info->id);
2137 dbhandler->finalizeQuery();
2139 if (!isForInstantMessage) {
2140 /* No unread message. */
2141 if (noti_info->id > 0) {
2142 noti_err = notification_delete_by_priv_id(MSG_DEFAULT_APP_ID, NOTIFICATION_TYPE_NOTI, noti_info->id);
2143 if (noti_err != NOTIFICATION_ERROR_NONE) {
2144 MSG_MGR_DEBUG("Fail to notification_delete_by_priv_id : %d", noti_err);
2150 if (MsgSettingSetInt(CB_NOTI_PRIV_ID, noti_info->id) != MSG_SUCCESS)
2151 MSG_MGR_DEBUG("MsgSettingSetInt fail : CB_NOTI_PRIV_ID");
2153 return MSG_ERR_DB_STEP;
2156 dbhandler->finalizeQuery();
2158 if (dbhandler->getTable(sqlQuery, ¬i_info->count, NULL) != MSG_SUCCESS) {
2159 MSG_MGR_DEBUG("getTable is failed");
2160 dbhandler->freeTable();
2161 return MSG_ERR_DB_GETTABLE;
2164 dbhandler->freeTable();
2165 MSG_MGR_DEBUG("notiCbId [%d], unreadCbMsgCnt [%d]", noti_info->id, noti_info->count);
2168 case MSG_MGR_NOTI_TYPE_SIM: {
2169 char sqlQuery[MAX_QUERY_LEN+1];
2170 memset(sqlQuery, 0x00, sizeof(sqlQuery));
2172 snprintf(sqlQuery, sizeof(sqlQuery),
2177 "(COUNT(CASE WHEN B.MAIN_TYPE = %d THEN 1 END)) AS SMS_UNREAD_CNT "
2179 "WHERE A.CONV_ID=B.CONV_ID "
2180 "AND B.READ_STATUS=0 AND B.FOLDER_ID=%d "
2181 "AND B.STORAGE_ID = %d "
2182 "ORDER BY B.DISPLAY_TIME DESC;",
2184 MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME,
2188 MSG_MGR_DEBUG("sqlQuery [%s]", sqlQuery);
2190 if (dbhandler->prepareQuery(sqlQuery) != MSG_SUCCESS)
2191 return MSG_ERR_DB_PREPARE;
2193 if (dbhandler->stepQuery() == MSG_ERR_DB_ROW) {
2194 noti_info->count = dbhandler->columnInt(4);
2196 if (noti_info->count > 0) {
2197 MSG_ADDRESS_INFO_S addrInfo;
2198 memset(&addrInfo, 0x00, sizeof(MSG_ADDRESS_INFO_S));
2200 if (dbhandler->columnText(0) != NULL)
2201 snprintf(addrInfo.addressVal, sizeof(addrInfo.addressVal), "%s", (char*)dbhandler->columnText(0));
2203 MSG_CONTACT_INFO_S tmpContact;
2204 memset(&tmpContact, 0x00, sizeof(MSG_CONTACT_INFO_S));
2206 MsgGetContactInfo(&addrInfo, &tmpContact);
2208 if (tmpContact.firstName[0] != '\0') {
2209 snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", tmpContact.firstName);
2210 } else if (addrInfo.addressVal[0] == '\0') {
2211 char *senderStr = NULL;
2212 senderStr = get_translate_text(MSG_MGR_PACKAGE_NAME, MSG_MGR_LOCALEDIR, MSG_UNKNOWN_SENDER);
2213 g_strlcat(noti_info->sender, senderStr, sizeof(noti_info->sender)-strlen(noti_info->sender));
2219 snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", addrInfo.addressVal);
2222 snprintf(noti_info->number, sizeof(noti_info->number), "%s", addrInfo.addressVal);
2224 noti_info->time = (time_t)dbhandler->columnInt(1);
2226 noti_info->msg_id = (msg_message_id_t)dbhandler->columnInt(2);
2228 snprintf(noti_info->text, sizeof(noti_info->text), "%s", (char*)dbhandler->columnText(3));
2230 MSG_MGR_DEBUG("unread SIM message [%d].", noti_info->msg_id);
2232 MSG_MGR_DEBUG("No unread SIM message.");
2233 MSG_MGR_DEBUG("notiPrivId [%d]", noti_info->id);
2235 dbhandler->finalizeQuery();
2237 if (!isForInstantMessage) {
2238 /* No unread message. */
2239 if (noti_info->id > 0) {
2240 noti_err = notification_delete_by_priv_id(MSG_DEFAULT_APP_ID, NOTIFICATION_TYPE_NOTI, noti_info->id);
2241 if (noti_err != NOTIFICATION_ERROR_NONE) {
2242 MSG_MGR_DEBUG("Fail to notification_delete_by_priv_id : %d", noti_err);
2248 if (MsgSettingSetInt(SIM_MSG_NOTI_PRIV_ID, noti_info->id) != MSG_SUCCESS)
2249 MSG_MGR_DEBUG("MsgSettingSetInt fail : SIM_MSG_NOTI_PRIV_ID");
2252 return MSG_ERR_DB_STEP;
2255 MSG_MGR_DEBUG("sqlQuery [%s]", sqlQuery);
2256 dbhandler->finalizeQuery();
2257 return MSG_ERR_DB_STEP;
2260 dbhandler->finalizeQuery();
2264 case MSG_MGR_NOTI_TYPE_FAILED: {
2265 char sqlQuery[MAX_QUERY_LEN+1];
2266 memset(sqlQuery, 0x00, sizeof(sqlQuery));
2268 snprintf(sqlQuery, sizeof(sqlQuery),
2275 "(COUNT(CASE WHEN B.NETWORK_STATUS = %d THEN 1 END)) AS SENT_FAILED_CNT "
2277 "WHERE A.CONV_ID=B.CONV_ID "
2278 "AND B.READ_STATUS=0 AND B.FOLDER_ID=%d "
2279 "AND B.STORAGE_ID = %d "
2280 "ORDER BY B.DISPLAY_TIME DESC;",
2281 MSG_NETWORK_SEND_FAIL,
2282 MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME,
2286 MSG_MGR_DEBUG("sqlQuery [%s]", sqlQuery);
2288 row_cnt = 0, col_cnt = 0;
2289 msg_err = msg_db_select_with_query(msg_handle, sqlQuery, &db_res, &row_cnt, &col_cnt);
2290 if (msg_err != MSG_SUCCESS) {
2291 MSG_MGR_ERR("msg_db_select_with_query() failed [%d]", msg_err);
2296 noti_info->count = atoi(db_res[col_cnt+6]);
2298 if (noti_info->count > 0) {
2299 MSG_MGR_ADDRESS_INFO_S addrInfo = {0, };
2301 snprintf(addrInfo.addressVal, MAX_ADDRESS_VAL_LEN, "%s", db_res[col_cnt]);
2303 MSG_MGR_CONTACT_INFO_S tmpContact = {0, };
2305 MsgMgrGetContactInfo(&addrInfo, &tmpContact);
2307 if (tmpContact.firstName[0] != '\0') {
2308 snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", tmpContact.firstName);
2309 } else if (addrInfo.addressVal[0] == '\0') {
2310 char *senderStr = NULL;
2311 senderStr = get_translate_text(MSG_MGR_PACKAGE_NAME, MSG_MGR_LOCALEDIR, MSG_UNKNOWN_SENDER);
2312 g_strlcat(noti_info->sender, senderStr, sizeof(noti_info->sender)-strlen(noti_info->sender));
2318 snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", addrInfo.addressVal);
2321 snprintf(noti_info->number, sizeof(noti_info->number), "%s", addrInfo.addressVal);
2323 noti_info->time = (time_t)atoi(db_res[col_cnt+1]);
2325 noti_info->msg_id = (msg_message_id_t)atoi(db_res[col_cnt+2]);
2327 unsigned char mainType = (unsigned char)atoi(db_res[col_cnt+5]);
2329 if (mainType == MSG_TYPE_MMS)
2330 snprintf(noti_info->text, sizeof(noti_info->text), "%s", db_res[col_cnt+4]);
2332 snprintf(noti_info->text, sizeof(noti_info->text), "%s", db_res[col_cnt+3]);
2334 MSG_MGR_DEBUG("Sent failed message ID [%d].", noti_info->msg_id);
2336 if (!isForInstantMessage) {
2337 if (noti_info->id > 0 && noti_info->count == 1) {
2338 noti_err = notification_delete_by_priv_id(MSG_DEFAULT_APP_ID, NOTIFICATION_TYPE_NOTI, noti_info->id);
2339 if (noti_err != NOTIFICATION_ERROR_NONE) {
2340 MSG_MGR_DEBUG("Fail to notification_delete_by_priv_id : %d", noti_err);
2343 if (vconf_set_int(MSG_SENTFAIL_NOTI_ID, noti_info->id) != 0)
2344 MSG_MGR_DEBUG("vconf_set_int fail : MSG_SENTFAIL_NOTI_ID");
2348 MSG_MGR_DEBUG("No sent failed message.");
2349 MSG_MGR_DEBUG("failedNotiId [%d]", noti_info->id);
2351 msg_db_free(msg_handle, db_res);
2353 if (!isForInstantMessage) {
2354 /* No unread message. */
2355 if (noti_info->id > 0) {
2356 noti_err = notification_delete_by_priv_id(MSG_DEFAULT_APP_ID, NOTIFICATION_TYPE_NOTI, noti_info->id);
2357 if (noti_err != NOTIFICATION_ERROR_NONE) {
2358 MSG_MGR_DEBUG("Fail to notification_delete_by_priv_id : %d", noti_err);
2364 if (vconf_set_int(MSG_SENTFAIL_NOTI_ID, noti_info->id) != 0)
2365 MSG_MGR_DEBUG("vconf_set_int fail : MSG_SENTFAIL_NOTI_ID");
2371 msg_db_free(msg_handle, db_res);
2375 msg_db_free(msg_handle, db_res);
2378 case MSG_MGR_NOTI_TYPE_SIM_FULL:
2379 case MSG_MGR_NOTI_TYPE_STORAGE_FULL:
2382 MSG_MGR_DEBUG("No matching type [%d]", noti_info->type);
2392 notification_h getHandle(int *noti_id)
2394 notification_h noti_h = NULL;
2397 MSG_MGR_DEBUG("Notification load");
2398 noti_h = notification_load(NULL, *noti_id);
2400 MSG_MGR_DEBUG("notification_load is failed.");
2403 if (noti_h == NULL) {
2404 MSG_MGR_DEBUG("Notification create");
2405 noti_h = notification_create(NOTIFICATION_TYPE_NOTI);
2406 if (noti_h == NULL) {
2407 MSG_MGR_DEBUG("notification_create is failed.");
2418 int getPrivId(msg_mgr_notification_type_t noti_type, int sim_idx)
2424 switch (noti_type) {
2425 #ifdef MSG_NOTI_INTEGRATION
2426 case MSG_MGR_NOTI_TYPE_NORMAL:
2427 case MSG_MGR_NOTI_TYPE_SIM:
2428 case MSG_MGR_NOTI_TYPE_CB:
2429 vconf_get_int(NOTIFICATION_PRIV_ID, ¬i_id);
2432 case MSG_MGR_NOTI_TYPE_NORMAL:
2433 vconf_get_int(NOTIFICATION_PRIV_ID, ¬i_id);
2435 case MSG_MGR_NOTI_TYPE_SIM:
2436 vconf_get_int(SIM_MSG_NOTI_PRIV_ID, ¬i_id);
2438 case MSG_MGR_NOTI_TYPE_CB:
2439 vconf_get_int(CB_NOTI_PRIV_ID, ¬i_id);
2442 case MSG_MGR_NOTI_TYPE_FAILED:
2443 vconf_get_int(MSG_SENTFAIL_NOTI_ID, ¬i_id);
2445 case MSG_MGR_NOTI_TYPE_MMS_READ_REPORT_SENT:
2446 vconf_get_int(VCONFKEY_MESSAGE_READ_REPORT_SENT_NOTI_ID, ¬i_id);
2448 case MSG_MGR_NOTI_TYPE_VOICE_1: {
2449 char keyName[MAX_VCONFKEY_NAME_LEN] = {0, };
2450 snprintf(keyName, sizeof(keyName), "%s/%d", VOICE_NOTI_ID_1, sim_idx);
2451 vconf_get_int(keyName, ¬i_id);
2454 case MSG_MGR_NOTI_TYPE_VOICE_2: {
2455 char keyName[MAX_VCONFKEY_NAME_LEN] = {0, };
2456 snprintf(keyName, sizeof(keyName), "%s/%d", VOICE_NOTI_ID_2, sim_idx);
2457 vconf_get_int(keyName, ¬i_id);
2460 case MSG_MGR_NOTI_TYPE_SIM_FULL:
2461 vconf_get_int(SIM_FULL_NOTI_PRIV_ID, ¬i_id);
2463 case MSG_MGR_NOTI_TYPE_STORAGE_FULL:
2464 vconf_get_int(STORAGE_FULL_NOTI_PRIV_ID, ¬i_id);
2467 MSG_MGR_DEBUG("No matching noti type [%d]", noti_type);
2471 MSG_MGR_DEBUG("Get noti type = %d, id = %d, sim_idx:%d", noti_type, noti_id, sim_idx);
2479 void updatePrivId(msg_mgr_notification_type_t noti_type, int noti_id, int sim_idx)
2485 MSG_MGR_DEBUG("Update noti type = %d, id = %d, sim_idx = %d", noti_type, noti_id, sim_idx);
2487 switch (noti_type) {
2488 #ifdef MSG_NOTI_INTEGRATION
2489 case MSG_MGR_NOTI_TYPE_NORMAL:
2490 case MSG_MGR_NOTI_TYPE_SIM:
2491 case MSG_MGR_NOTI_TYPE_CB:
2492 err = vconf_set_int(NOTIFICATION_PRIV_ID, noti_id);
2495 case MSG_MGR_NOTI_TYPE_NORMAL:
2496 err = vconf_set_int(NOTIFICATION_PRIV_ID, noti_id);
2498 case MSG_MGR_NOTI_TYPE_SIM:
2499 err = vconf_set_int(SIM_MSG_NOTI_PRIV_ID, noti_id);
2501 case MSG_MGR_NOTI_TYPE_CB:
2502 err = vconf_set_int(CB_NOTI_PRIV_ID, noti_id);
2505 case MSG_MGR_NOTI_TYPE_FAILED:
2506 err = vconf_set_int(MSG_SENTFAIL_NOTI_ID, noti_id);
2508 case MSG_MGR_NOTI_TYPE_MMS_READ_REPORT_SENT:
2509 err = vconf_set_int(VCONFKEY_MESSAGE_READ_REPORT_SENT_NOTI_ID, noti_id);
2511 case MSG_MGR_NOTI_TYPE_VOICE_1: {
2512 char keyName[MAX_VCONFKEY_NAME_LEN] = {0, };
2513 snprintf(keyName, sizeof(keyName), "%s/%d", VOICE_NOTI_ID_1, sim_idx);
2514 err = vconf_set_int(keyName, noti_id);
2517 case MSG_MGR_NOTI_TYPE_VOICE_2: {
2518 char keyName[MAX_VCONFKEY_NAME_LEN] = {0, };
2519 snprintf(keyName, sizeof(keyName), "%s/%d", VOICE_NOTI_ID_2, sim_idx);
2520 err = vconf_set_int(keyName, noti_id);
2523 case MSG_MGR_NOTI_TYPE_SIM_FULL:
2524 err = vconf_set_int(SIM_FULL_NOTI_PRIV_ID, noti_id);
2526 case MSG_MGR_NOTI_TYPE_STORAGE_FULL:
2527 err = vconf_set_int(STORAGE_FULL_NOTI_PRIV_ID, noti_id);
2530 MSG_MGR_DEBUG("No matching type [%d]", noti_type);
2535 MSG_MGR_INFO("vconf_set_int fail : noti type = %d, id = %d, sim_idx = %d", noti_type, noti_id, sim_idx);
2541 void createInfoData(MSG_MGR_NOTI_INFO_S *noti_info, MSG_MGR_MESSAGE_INFO_S *msg_info)
2546 noti_info->id = getPrivId(noti_info->type, msg_info->sim_idx);
2547 noti_info->msg_id = msg_info->msgId;
2549 MSG_MGR_DEBUG("msg_info is NULL");
2553 noti_info->sim_idx = msg_info->sim_idx;
2555 createServiceHandle(¬i_info->svc_h);
2556 char keyName[MAX_VCONFKEY_NAME_LEN];
2558 switch (noti_info->type) {
2559 case MSG_MGR_NOTI_TYPE_VOICE_1:
2560 case MSG_MGR_NOTI_TYPE_VOICE_2: {
2561 memset(keyName, 0x00, sizeof(keyName));
2562 snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_COUNT, msg_info->sim_idx);
2563 vconf_get_int(keyName, ¬i_info->count);
2564 noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_SINGLE;
2565 noti_info->time = msg_info->displayTime;
2567 memset(keyName, 0x00, sizeof(keyName));
2568 snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_NUMBER, msg_info->sim_idx);
2569 char *voiceNumber = vconf_get_str(keyName);
2570 memset(keyName, 0x00, sizeof(keyName));
2571 snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_ALPHA_ID, msg_info->sim_idx);
2572 char *voiceAlphaId = vconf_get_str(keyName);
2573 char *dialNumber = NULL;
2575 MSG_MGR_SEC_DEBUG("Voice mail server - alpha id = [%s], default num = [%s]", voiceAlphaId, voiceNumber);
2577 if (voiceNumber && strlen(voiceNumber))
2578 dialNumber = voiceNumber;
2580 if (voiceAlphaId && strlen(voiceAlphaId) > 0) {
2581 snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", voiceAlphaId);
2582 } else if (dialNumber && strlen(dialNumber) > 0) {
2583 snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", dialNumber);
2586 if (dialNumber && strlen(dialNumber) > 0)
2587 snprintf(noti_info->number, sizeof(noti_info->number), "%s", dialNumber);
2589 if (noti_info->svc_h) {
2590 setServiceOperation(noti_info->svc_h, APP_CONTROL_OPERATION_CALL);
2591 setServiceUri(noti_info->svc_h, MSG_TEL_URI_VOICEMAIL);
2593 char slot_id[5] = {0, };
2594 snprintf(slot_id, sizeof(slot_id), "%d", msg_info->sim_idx - 1);
2595 addServiceExtraData(noti_info->svc_h, "slot_id", slot_id);
2598 if (voiceNumber) g_free(voiceNumber);
2599 if (voiceAlphaId) g_free(voiceAlphaId);
2602 case MSG_MGR_NOTI_TYPE_MWI:
2603 case MSG_MGR_NOTI_TYPE_CLASS0: {
2604 noti_info->count = 1;
2605 noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_SINGLE;
2606 noti_info->time = msg_info->displayTime;
2608 if (msg_info->displayName[0] == '\0')
2609 snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", msg_info->addressVal);
2611 snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", msg_info->displayName);
2613 snprintf(noti_info->number, sizeof(noti_info->number), "%s", msg_info->addressVal);
2615 snprintf(noti_info->text, sizeof(noti_info->text), "%s", msg_info->msgText);
2617 if (noti_info->type == MSG_MGR_NOTI_TYPE_MWI) {
2618 if (noti_info->svc_h) {
2619 setServiceOperation(noti_info->svc_h, APP_CONTROL_OPERATION_CALL);
2620 setServiceUri(noti_info->svc_h, MSG_TEL_URI_VOICEMAIL);
2622 char slot_id[5] = {0, };
2623 snprintf(slot_id, sizeof(slot_id), "%d", msg_info->sim_idx - 1);
2624 addServiceExtraData(noti_info->svc_h, "slot_id", slot_id);
2628 setServiceAppId(noti_info->svc_h, "org.tizen.msg-ui-class0");
2629 addServiceExtraData(noti_info->svc_h, "type", "new_msg");
2630 addServiceExtraData(noti_info->svc_h, "msgId", noti_info->msg_id);
2634 case MSG_MGR_NOTI_TYPE_SMS_DELIVERY_REPORT: {
2635 noti_info->count = 1;
2636 noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_SINGLE;
2637 noti_info->time = msg_info->displayTime;
2638 noti_info->extra_data = msg_info->networkStatus;
2640 MSG_MGR_CONTACT_INFO_S contactInfo = {0, };
2641 MSG_MGR_ADDRESS_INFO_S tmpAddressInfo = {0, };
2642 if (msg_info->addressVal[0] != '\0') {
2643 snprintf(tmpAddressInfo.addressVal, MAX_ADDRESS_VAL_LEN, "%s", msg_info->addressVal);
2644 if (_is_valid_email(msg_info->addressVal)) {
2645 tmpAddressInfo.addressType = MSG_ADDRESS_TYPE_EMAIL;
2647 tmpAddressInfo.addressType = MSG_ADDRESS_TYPE_UNKNOWN;
2651 if (MsgMgrGetContactInfo(&tmpAddressInfo, &contactInfo) != 0) {
2652 MSG_MGR_WARN("MsgMgrGetContactInfo() fail.");
2655 if (contactInfo.firstName[0] == '\0')
2656 snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", msg_info->addressVal);
2658 snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", contactInfo.firstName);
2660 snprintf(noti_info->number, sizeof(noti_info->number), "%s", msg_info->addressVal);
2662 if (noti_info->msg_id > 0) {
2663 setServiceAppId(noti_info->svc_h, MSG_DEFAULT_APP_ID);
2664 addServiceExtraData(noti_info->svc_h, "type", "new_msg");
2665 addServiceExtraData(noti_info->svc_h, "msgId", noti_info->msg_id);
2666 addServiceExtraData(noti_info->svc_h, "address", msg_info->addressVal);
2670 case MSG_MGR_NOTI_TYPE_MMS_READ_REPORT:
2671 case MSG_MGR_NOTI_TYPE_MMS_DELIVERY_REPORT: {
2672 noti_info->count = 1;
2673 noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_SINGLE;
2674 noti_info->time = msg_info->displayTime;
2676 MSG_MGR_CONTACT_INFO_S contactInfo = {0, };
2677 MSG_MGR_ADDRESS_INFO_S tmpAddressInfo = {0, };
2678 if (msg_info->addressVal[0] != '\0') {
2679 snprintf(tmpAddressInfo.addressVal, MAX_ADDRESS_VAL_LEN, "%s", msg_info->addressVal);
2680 if (_is_valid_email(msg_info->addressVal)) {
2681 tmpAddressInfo.addressType = MSG_ADDRESS_TYPE_EMAIL;
2683 tmpAddressInfo.addressType = MSG_ADDRESS_TYPE_UNKNOWN;
2687 if (MsgMgrGetContactInfo(&tmpAddressInfo, &contactInfo) != 0) {
2688 MSG_MGR_WARN("MsgMgrGetContactInfo() fail.");
2690 if (contactInfo.firstName[0] == '\0')
2691 snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", msg_info->addressVal);
2693 snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", contactInfo.firstName);
2695 snprintf(noti_info->number, sizeof(noti_info->number), "%s", msg_info->addressVal);
2697 char sqlQuery[MAX_QUERY_LEN+1];
2698 memset(sqlQuery, 0x00, sizeof(sqlQuery));
2700 int report_status_type;
2701 int report_status_value;
2703 if (noti_info->type == MSG_MGR_NOTI_TYPE_MMS_READ_REPORT) {
2704 report_status_type = MSG_REPORT_TYPE_READ;
2706 report_status_type = MSG_REPORT_TYPE_DELIVERY;
2709 snprintf(sqlQuery, sizeof(sqlQuery),
2712 "WHERE MSG_ID=%d AND STATUS_TYPE=%d AND ADDRESS_VAL LIKE \"%%%s\";",
2713 MSGFW_REPORT_TABLE_NAME, msg_info->msgId, report_status_type, msg_mgr_normalize_number(msg_info->addressVal));
2715 MSG_MGR_DEBUG("sqlQuery = [%s]", sqlQuery);
2717 char **db_res = NULL;
2718 int row_cnt = 0, col_cnt = 0;
2720 int msg_err = msg_db_select_with_query(msg_handle, sqlQuery, &db_res, &row_cnt, &col_cnt);
2721 if (msg_err != MSG_SUCCESS || row_cnt <= 0) {
2722 MSG_MGR_ERR("msg_db_select_with_query() failed [%d]", msg_err);
2726 report_status_value = atoi(db_res[col_cnt]);
2728 MSG_MGR_DEBUG("report status [type = %d, value = %d]", report_status_type, report_status_value);
2730 msg_err = msg_db_free(msg_handle, db_res);
2731 if (msg_err != MSG_SUCCESS) {
2732 MSG_MGR_ERR("msg_db_free() failed [%d]", msg_err);
2736 if (noti_info->msg_id > 0) {
2737 setServiceAppId(noti_info->svc_h, MSG_DEFAULT_APP_ID);
2738 addServiceExtraData(noti_info->svc_h, "type", "new_msg");
2739 addServiceExtraData(noti_info->svc_h, "msgId", noti_info->msg_id);
2740 addServiceExtraData(noti_info->svc_h, "address", msg_info->addressVal);
2743 noti_info->extra_data = (unsigned char)report_status_value;
2747 MSG_MGR_DEBUG("No matching type [%d]", noti_info->type);
2751 noti_info->applist = NOTIFICATION_DISPLAY_APP_ALL^NOTIFICATION_DISPLAY_APP_LOCK;
2756 void createInfoData(MSG_MGR_NOTI_INFO_S *noti_info, msg_mgr_active_notification_type_t active_noti)
2760 createServiceHandle(¬i_info->svc_h);
2762 switch (noti_info->type) {
2763 case MSG_MGR_NOTI_TYPE_NORMAL: {
2764 if (noti_info->count > 1) {
2765 noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_MULTIPLE;
2767 noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_SINGLE;
2770 setServiceAppId(noti_info->svc_h, MSG_DEFAULT_APP_ID);
2771 addServiceExtraData(noti_info->svc_h, "type", "new_msg");
2772 addServiceExtraData(noti_info->svc_h, "msgId", noti_info->msg_id);
2773 addServiceExtraData(noti_info->svc_h, "http://tizen.org/appcontrol/data/notification", "new_message");
2775 if (active_noti == MSG_MGR_ACTIVE_NOTI_TYPE_ACTIVE) {
2776 if (noti_info->active_noti_button_num == MSG_ACTIVE_NOTI_BUTTON_NUM_NONE)
2777 noti_info->active_noti_button_num = MSG_ACTIVE_NOTI_BUTTON_NUM_NORMAL_MESSAGE;
2779 int activated_conv_id = -1;
2780 vconf_get_int(VCONFKEY_MESSAGE_ACTIVATED_CONVERSATION_ID, &activated_conv_id);
2782 if (activated_conv_id == -1) {
2783 noti_info->applist = NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY|NOTIFICATION_DISPLAY_APP_LOCK|NOTIFICATION_DISPLAY_APP_INDICATOR;
2784 } else if (activated_conv_id == 0) {
2785 noti_info->active_noti_button_num = MSG_ACTIVE_NOTI_BUTTON_NUM_NONE;
2786 noti_info->applist = NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY|NOTIFICATION_DISPLAY_APP_LOCK|NOTIFICATION_DISPLAY_APP_INDICATOR|NOTIFICATION_DISPLAY_APP_TICKER;
2787 } else if (activated_conv_id > 0){
2788 noti_info->active_noti_button_num = MSG_ACTIVE_NOTI_BUTTON_NUM_NONE;
2790 if (activated_conv_id != noti_info->conv_id)
2791 noti_info->applist = NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY|NOTIFICATION_DISPLAY_APP_LOCK|NOTIFICATION_DISPLAY_APP_INDICATOR|NOTIFICATION_DISPLAY_APP_TICKER;
2793 MSG_MGR_WARN("No adding Notification : activated conv id [%d] / notification conv id [%d]", activated_conv_id, noti_info->conv_id);
2796 noti_info->applist = NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY|NOTIFICATION_DISPLAY_APP_LOCK|NOTIFICATION_DISPLAY_APP_INDICATOR;
2801 case MSG_MGR_NOTI_TYPE_CB: {
2802 if (noti_info->count > 1) {
2803 noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_MULTIPLE;
2805 noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_SINGLE;
2808 setServiceAppId(noti_info->svc_h, MSG_DEFAULT_APP_ID);
2809 addServiceExtraData(noti_info->svc_h, "type", "new_msg");
2810 addServiceExtraData(noti_info->svc_h, "msgId", noti_info->msg_id);
2812 if (active_noti == MSG_MGR_ACTIVE_NOTI_TYPE_INSTANT)
2813 noti_info->applist = NOTIFICATION_DISPLAY_APP_ALL^NOTIFICATION_DISPLAY_APP_LOCK;
2815 noti_info->applist = NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY|NOTIFICATION_DISPLAY_APP_INDICATOR;
2817 noti_info->active_noti_button_num = MSG_ACTIVE_NOTI_BUTTON_NUM_CB_MESSAGE;
2820 case MSG_MGR_NOTI_TYPE_SIM: {
2821 if (noti_info->count > 1) {
2822 noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_MULTIPLE;
2824 noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_SINGLE;
2827 setServiceAppId(noti_info->svc_h, MSG_DEFAULT_APP_ID);
2828 addServiceExtraData(noti_info->svc_h, "type", "new_msg");
2829 addServiceExtraData(noti_info->svc_h, "msgId", noti_info->msg_id);
2831 if (active_noti == MSG_MGR_ACTIVE_NOTI_TYPE_INSTANT)
2832 noti_info->applist = NOTIFICATION_DISPLAY_APP_ALL^NOTIFICATION_DISPLAY_APP_LOCK;
2834 noti_info->applist = NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY|NOTIFICATION_DISPLAY_APP_INDICATOR;
2836 if (noti_info->active_noti_button_num == MSG_ACTIVE_NOTI_BUTTON_NUM_NONE)
2837 noti_info->active_noti_button_num = MSG_ACTIVE_NOTI_BUTTON_NUM_NORMAL_MESSAGE;
2840 case MSG_MGR_NOTI_TYPE_FAILED: {
2841 noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_SINGLE;
2843 setServiceAppId(noti_info->svc_h, MSG_DEFAULT_APP_ID);
2844 addServiceExtraData(noti_info->svc_h, "type", "send_failed_msg");
2845 addServiceExtraData(noti_info->svc_h, "msgId", noti_info->msg_id);
2847 noti_info->applist = NOTIFICATION_DISPLAY_APP_ALL^NOTIFICATION_DISPLAY_APP_TICKER^NOTIFICATION_DISPLAY_APP_LOCK;
2850 case MSG_MGR_NOTI_TYPE_SIM_FULL: {
2851 noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_SINGLE;
2853 setServiceAppId(noti_info->svc_h, MSG_DEFAULT_APP_ID);
2854 addServiceExtraData(noti_info->svc_h, "sim_list_show", "sim_setting");
2856 noti_info->applist = NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY|NOTIFICATION_DISPLAY_APP_INDICATOR;
2859 case MSG_MGR_NOTI_TYPE_STORAGE_FULL: {
2860 noti_info->layout = NOTIFICATION_LY_NOTI_EVENT_SINGLE;
2861 noti_info->applist = NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY|NOTIFICATION_DISPLAY_APP_INDICATOR|NOTIFICATION_DISPLAY_APP_TICKER;
2867 if (active_noti != MSG_MGR_ACTIVE_NOTI_TYPE_ACTIVE)
2868 noti_info->active_noti_button_num = MSG_ACTIVE_NOTI_BUTTON_NUM_NONE;
2874 void createServiceHandle(app_control_h *svc_h)
2876 int svc_err = APP_CONTROL_ERROR_NONE;
2878 svc_err = app_control_create(svc_h);
2880 if (svc_err != APP_CONTROL_ERROR_NONE)
2881 MSG_MGR_DEBUG("app_control_create() is failed, [%d]", svc_err);
2885 void setServiceAppId(app_control_h svc_h, const char* app_id)
2887 int svc_err = APP_CONTROL_ERROR_NONE;
2889 svc_err = app_control_set_app_id(svc_h, app_id);
2891 if (svc_err != APP_CONTROL_ERROR_NONE)
2892 MSG_MGR_DEBUG("app_control_set_app_id() was failed, [%d]", svc_err);
2896 void setServiceUri(app_control_h svc_h, const char* uri)
2898 int svc_err = APP_CONTROL_ERROR_NONE;
2900 svc_err = app_control_set_uri(svc_h, uri);
2902 if (svc_err != APP_CONTROL_ERROR_NONE)
2903 MSG_MGR_DEBUG("app_control_set_uri() was failed, [%d]", svc_err);
2907 void setServiceOperation(app_control_h svc_h, const char* operation)
2909 int svc_err = APP_CONTROL_ERROR_NONE;
2911 svc_err = app_control_set_operation(svc_h, operation);
2913 if (svc_err != APP_CONTROL_ERROR_NONE)
2914 MSG_MGR_DEBUG("app_control_set_operation() was failed, [%d]", svc_err);
2918 void addServiceExtraData(app_control_h svc_h, const char* bundle_key, const char* bundle_val)
2920 int svc_err = APP_CONTROL_ERROR_NONE;
2922 svc_err = app_control_add_extra_data(svc_h, bundle_key, bundle_val);
2924 if (svc_err != APP_CONTROL_ERROR_NONE)
2925 MSG_MGR_DEBUG("app_control_add_extra_data() was failed, [%d]", svc_err);
2929 void addServiceExtraData(app_control_h svc_h, const char* bundle_key, int bundle_val)
2931 int svc_err = APP_CONTROL_ERROR_NONE;
2934 memset(&tempId, 0x00, sizeof(tempId));
2935 snprintf(tempId, sizeof(tempId), "%d", bundle_val);
2937 svc_err = app_control_add_extra_data(svc_h, bundle_key, (const char *)tempId);
2939 if (svc_err != APP_CONTROL_ERROR_NONE)
2940 MSG_MGR_DEBUG("app_control_add_extra_data() was failed, [%d]", svc_err);
2944 void setServicePackageName(app_control_h svc_h, const char* pkg_name)
2946 int svc_err = APP_CONTROL_ERROR_NONE;
2948 svc_err = app_control_set_app_id(svc_h, pkg_name);
2950 if (svc_err != APP_CONTROL_ERROR_NONE)
2951 MSG_MGR_DEBUG("app_control_set_app_id() was failed, [%d]", svc_err);
2955 void sendServicelaunchRequest(app_control_h svc_h, app_control_reply_cb callback, void *user_data)
2957 int svc_err = APP_CONTROL_ERROR_NONE;
2959 svc_err = app_control_send_launch_request(svc_h, callback, user_data);
2961 if (svc_err != APP_CONTROL_ERROR_NONE)
2962 MSG_MGR_DEBUG("app_control_send_launch_request() is failed : %d", svc_err);
2966 void setNotiTextDomain(notification_h noti_h, const char *pkg_name, const char *loc_dir)
2968 int noti_err = NOTIFICATION_ERROR_NONE;
2970 noti_err = notification_set_text_domain(noti_h, pkg_name, loc_dir);
2971 if (noti_err != NOTIFICATION_ERROR_NONE)
2972 MSG_MGR_DEBUG("notification_set_text_domain() was failed. [%d]", noti_err);
2976 void setNotiText(notification_h noti_h, notification_text_type_e type, const char *text, const char *key)
2978 int noti_err = NOTIFICATION_ERROR_NONE;
2980 noti_err = notification_set_text(noti_h, type, text, key, NOTIFICATION_VARIABLE_TYPE_NONE);
2982 if (noti_err != NOTIFICATION_ERROR_NONE)
2983 MSG_MGR_DEBUG("notification_set_text() was failed. [%d]", noti_err);
2987 void setNotiTimeToText(notification_h noti_h, notification_text_type_e type, time_t time)
2989 int noti_err = NOTIFICATION_ERROR_NONE;
2991 noti_err = notification_set_time_to_text(noti_h, type, time);
2993 if (noti_err != NOTIFICATION_ERROR_NONE)
2994 MSG_MGR_DEBUG("notification_set_time_to_text() was failed. [%d]", noti_err);
2998 void setNotiTime(notification_h noti_h, time_t time)
3000 int noti_err = NOTIFICATION_ERROR_NONE;
3002 noti_err = notification_set_time(noti_h, time);
3004 if (noti_err != NOTIFICATION_ERROR_NONE)
3005 MSG_MGR_DEBUG("notification_set_time() was failed. [%d]", noti_err);
3010 void setNotiImage(notification_h noti_h, notification_image_type_e type, const char *image_path)
3012 int noti_err = NOTIFICATION_ERROR_NONE;
3014 noti_err = notification_set_image(noti_h, type, image_path);
3016 if (noti_err != NOTIFICATION_ERROR_NONE)
3017 MSG_MGR_DEBUG("notification_set_image() was failed. [%d]", noti_err);
3021 void setNotiSound(notification_h noti_h, notification_sound_type_e type, const char *path)
3023 int noti_err = NOTIFICATION_ERROR_NONE;
3025 noti_err = notification_set_sound(noti_h, type, path);
3027 if (noti_err != NOTIFICATION_ERROR_NONE)
3028 MSG_MGR_DEBUG("notification_set_sound() was failed. [%d]", noti_err);
3032 void setNotiVibration(notification_h noti_h, notification_vibration_type_e type, const char *path)
3034 int noti_err = NOTIFICATION_ERROR_NONE;
3036 noti_err = notification_set_vibration(noti_h, type, path);
3038 if (noti_err != NOTIFICATION_ERROR_NONE)
3039 MSG_MGR_DEBUG("notification_set_vibration() was failed. [%d]", noti_err);
3043 void setNotiEventHandler(notification_h noti_h, notification_event_type_e type, app_control_h event_handler)
3045 int noti_err = NOTIFICATION_ERROR_NONE;
3047 noti_err = notification_set_event_handler(noti_h, type, event_handler);
3049 if (noti_err != NOTIFICATION_ERROR_NONE)
3050 MSG_MGR_DEBUG("notification_set_event_handler() was failed. [%d]", noti_err);
3054 int MsgMgrInsertInstantMessage(msg_mgr_notification_type_t noti_type)
3058 char *notiMsg = NULL;
3060 notification_h noti = notification_create(NOTIFICATION_TYPE_NOTI);
3062 switch (noti_type) {
3063 case MSG_MGR_NOTI_TYPE_NORMAL:
3064 case MSG_MGR_NOTI_TYPE_SIM:
3065 case MSG_MGR_NOTI_TYPE_CB: {
3066 MSG_MGR_NOTI_INFO_S noti_info;
3067 memset(¬i_info, 0x00, sizeof(MSG_MGR_NOTI_INFO_S));
3069 noti_info.type = noti_type;
3070 int err = getLatestMsgInfo(¬i_info, true);
3073 MSG_MGR_DEBUG("Unread count [%d]", noti_info.count);
3074 if (noti_info.count == 1) {
3075 MSG_MGR_SEC_DEBUG("noti_info.sender [%s]", noti_info.sender);
3076 setNotiText(noti, NOTIFICATION_TEXT_TYPE_TITLE, noti_info.sender, NULL);
3077 setNotiText(noti, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info.text, NULL);
3078 } else if (noti_info.count > 1) {
3079 gchar *cnt_string = g_strdup_printf("%i", noti_info.count);
3081 notiMsg = get_translate_text(MSG_MGR_PACKAGE_NAME, MSG_MGR_LOCALEDIR, NEW_MESSAGES);
3082 gchar *outString = g_strconcat(cnt_string, " ", notiMsg, NULL);
3083 setNotiText(noti, NOTIFICATION_TEXT_TYPE_TITLE, outString, NULL);
3084 setNotiText(noti, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info.sender, NULL);
3089 setNotiImage(noti, NOTIFICATION_IMAGE_TYPE_ICON, MSG_NORMAL_ICON_PATH);
3093 case MSG_MGR_NOTI_TYPE_FAILED: {
3094 notiMsg = get_translate_text(MSG_MGR_PACKAGE_NAME, MSG_MGR_LOCALEDIR, FAILED_TO_SEND_MESSAGE);
3095 setNotiText(noti, NOTIFICATION_TEXT_TYPE_TITLE, notiMsg, NULL);
3096 setNotiImage(noti, NOTIFICATION_IMAGE_TYPE_ICON, MSG_SMS_SENDING_FAILED_ICON_PATH);
3100 MSG_MGR_DEBUG("No matching type for MsgNotiType%d]", noti_type);
3101 goto _END_OF_INSTANT_NOTI;
3105 if (notification_set_display_applist(noti, NOTIFICATION_DISPLAY_APP_TICKER) != NOTIFICATION_ERROR_NONE)
3106 MSG_MGR_DEBUG("Fail to notification_set_display_applist");
3108 if (notification_set_pkgname(noti, MSG_DEFAULT_APP_ID) != NOTIFICATION_ERROR_NONE)
3109 MSG_MGR_DEBUG("Fail to notification_set_pkgname");
3111 if (notification_post(noti) != NOTIFICATION_ERROR_NONE)
3112 MSG_MGR_DEBUG("Fail to notification_post");
3114 _END_OF_INSTANT_NOTI:
3116 if (notification_delete(noti) != NOTIFICATION_ERROR_NONE)
3117 MSG_MGR_DEBUG("Fail to notification_delete");
3124 if (notification_free(noti) != NOTIFICATION_ERROR_NONE)
3125 MSG_MGR_DEBUG("Fail to notification_free");
3134 bool MsgMgrCheckNotificationSettingEnable()
3136 bool msg_noti_enabled = false;
3137 notification_system_setting_h system_setting = NULL;
3138 notification_setting_h setting = NULL;
3140 int err = NOTIFICATION_ERROR_NONE;
3142 err = notification_setting_get_setting_by_package_name(MSG_DEFAULT_APP_ID, &setting);
3144 if (err != NOTIFICATION_ERROR_NONE || setting == NULL) {
3145 MSG_MGR_ERR("getting setting handle for [%s] is failed. err = %d", MSG_DEFAULT_APP_ID, err);
3147 msg_noti_enabled = true;
3149 bool allow_to_notify = false;
3150 err = notification_setting_get_allow_to_notify(setting, &allow_to_notify);
3152 if (err != NOTIFICATION_ERROR_NONE) {
3153 MSG_MGR_ERR("getting do not disturb setting is failed. err = %d", err);
3157 if (allow_to_notify) {
3158 MSG_MGR_DEBUG("message notification is allowed");
3160 /* check do not disturb mode */
3161 err = notification_system_setting_load_system_setting(&system_setting);
3163 if (err != NOTIFICATION_ERROR_NONE || system_setting == NULL) {
3164 MSG_MGR_ERR("getting system setting is failed. err = %d", err);
3168 bool do_not_disturb_mode = false;
3169 err = notification_system_setting_get_do_not_disturb(system_setting, &do_not_disturb_mode);
3171 if (err != NOTIFICATION_ERROR_NONE) {
3172 MSG_MGR_ERR("getting do not disturb setting is failed. err = %d", err);
3176 if (do_not_disturb_mode) {
3177 bool is_msg_excepted = false;
3178 err = notification_setting_get_do_not_disturb_except(setting, &is_msg_excepted);
3179 if (err != NOTIFICATION_ERROR_NONE) {
3180 MSG_MGR_ERR("getting do not disturb except status for [%s] is failed. err = %d", MSG_DEFAULT_APP_ID, err);
3181 msg_noti_enabled = false;
3183 MSG_MGR_INFO("do not disturb mode status for [%s] : %d", MSG_DEFAULT_APP_ID, is_msg_excepted);
3184 msg_noti_enabled = (is_msg_excepted) ? true : false;
3187 MSG_MGR_DEBUG("do not disturb mode is off");
3190 MSG_MGR_INFO("message notification is not allowed");
3191 msg_noti_enabled = false;
3197 notification_system_setting_free_system_setting(system_setting);
3200 notification_setting_free_notification(setting);
3202 return msg_noti_enabled;
3206 int MsgMgrInsertTicker(const char* pTickerMsg, const char* pLocaleTickerMsg, bool bPlayFeedback, int msgId)
3208 MSG_MGR_DEBUG("pTickerMsg=[%s], pLocaleTickerMsg=[%s]", pTickerMsg, pLocaleTickerMsg);
3209 MSG_MGR_DEBUG("play feedback=[%d], msgId=[%d]", bPlayFeedback, msgId);
3211 MsgMgrChangePmState();
3213 char *notiMsg = NULL;
3214 msg_mgr_active_notification_type_t active_type = MSG_MGR_ACTIVE_NOTI_TYPE_NONE;
3217 notiMsg = get_translate_text(MSG_MGR_PACKAGE_NAME, MSG_MGR_LOCALEDIR, pLocaleTickerMsg);
3218 MSG_MGR_DEBUG("notiMsg %s", notiMsg);
3220 if (g_strcmp0(pLocaleTickerMsg, SMS_MESSAGE_SENDING_FAIL) != 0 &&
3221 g_strcmp0(pLocaleTickerMsg, SENDING_MULTIMEDIA_MESSAGE_FAILED) != 0 &&
3222 g_strcmp0(pLocaleTickerMsg, SMS_MESSAGE_MEMORY_FULL) != 0 &&
3223 g_strcmp0(pLocaleTickerMsg, MESSAGE_RETRIEVED) != 0) {
3224 if (g_strcmp0(pLocaleTickerMsg, notiMsg) == 0) {
3225 notification_status_message_post(pTickerMsg);
3227 notification_status_message_post(notiMsg);
3230 /* Show ticker popup for sending failed msg. */
3231 active_type = MSG_MGR_ACTIVE_NOTI_TYPE_INSTANT;
3239 if (bPlayFeedback) {
3241 (g_strcmp0(pLocaleTickerMsg, SMS_MESSAGE_SENDING_FAIL) == 0 || g_strcmp0(pLocaleTickerMsg, SENDING_MULTIMEDIA_MESSAGE_FAILED) == 0)) {
3242 err = MsgMgrRefreshNotification(MSG_MGR_NOTI_TYPE_FAILED, true, active_type);
3244 MSG_MGR_DEBUG("MsgRefreshFailedNoti err=[%d]", err);
3246 #if 0 /* Below codes are blocked because of change of UX guide. And it will be removed later. */
3247 } else if (g_strcmp0(pLocaleTickerMsg, SMS_MESSAGE_SIM_MESSAGE_FULL) == 0) {
3248 err = MsgMgrRefreshNotification(MSG_MGR_NOTI_TYPE_SIM_FULL, true, MSG_MGR_ACTIVE_NOTI_TYPE_NONE);
3250 MSG_MGR_DEBUG("MsgRefreshSimFullNoti err=[%d]", err);
3253 } else if (g_strcmp0(pLocaleTickerMsg, SMS_MESSAGE_MEMORY_FULL) == 0) {
3254 err = MsgMgrRefreshNotification(MSG_MGR_NOTI_TYPE_STORAGE_FULL, true, MSG_MGR_ACTIVE_NOTI_TYPE_NONE);
3256 MSG_MGR_DEBUG("MsgRefreshFailedNoti err=[%d]", err);
3259 MsgMgrSoundPlayStart(NULL, MSG_MGR_SOUND_PLAY_DEFAULT);
3267 int MsgMgrInsertBadge(unsigned int unreadMsgCnt)
3269 MSG_MGR_DEBUG("Start to set badge to [%d].", unreadMsgCnt);
3271 int err = BADGE_ERROR_NONE;
3274 err = badge_is_existing(MSG_DEFAULT_APP_ID, &exist);
3276 if (err != BADGE_ERROR_NONE) {
3277 MSG_MGR_ERR("Fail to badge_is_existing : %d", err);
3283 err = badge_add(MSG_DEFAULT_APP_ID);
3284 if (err != BADGE_ERROR_NONE) {
3285 MSG_MGR_ERR("Fail to badge_add : %d", err);
3290 err = badge_set_count(MSG_DEFAULT_APP_ID, unreadMsgCnt);
3292 if (err != BADGE_ERROR_NONE) {
3293 MSG_MGR_ERR("Fail to badge_set_count : %d", err);
3301 void MsgMgrNotiSoundRepeatAlarmCB(int alarmId)
3305 MsgMgrRefreshNotification(MSG_MGR_NOTI_TYPE_NORMAL, true, MSG_MGR_ACTIVE_NOTI_TYPE_ACTIVE);
3307 #ifndef MSG_NOTI_INTEGRATION
3308 MsgMgrRefreshNotification(MSG_MGR_NOTI_TYPE_SIM, true, MSG_MGR_ACTIVE_NOTI_TYPE_ACTIVE);
3309 MsgMgrRefreshNotification(MSG_MGR_NOTI_TYPE_CB, true, MSG_MGR_ACTIVE_NOTI_TYPE_ACTIVE);
3317 void MsgMgrSoundCreateRepeatAlarm(int RepeatTime)
3323 struct tm repeat_tm;
3327 tmp_time += (RepeatTime*60);
3329 localtime_r(&tmp_time, &repeat_tm);
3331 if (MsgMgrAlarmRegistration(&repeat_tm, MsgMgrNotiSoundRepeatAlarmCB, &tmpAlarmId) != 0) {
3332 MSG_MGR_DEBUG("MsgAlarmRegistration fail.");
3336 g_alarmId = tmpAlarmId;
3337 MSG_MGR_DEBUG("Set alarmId to [%d]", g_alarmId);
3345 void MsgMgrSoundSetRepeatAlarm()
3347 int nRepeatValue = 0;
3348 long nRepeatTime = 0;
3350 if (vconf_get_int(MSG_ALERT_REP_TYPE, &nRepeatValue) != 0) {
3351 MSG_MGR_INFO("vconf_get_int() is failed");
3354 switch (nRepeatValue) {
3355 case MSG_ALERT_TONE_ONCE:
3358 case MSG_ALERT_TONE_2MINS:
3361 case MSG_ALERT_TONE_5MINS:
3364 case MSG_ALERT_TONE_10MINS:
3368 MSG_MGR_DEBUG("Invalid Repetition time");
3372 MSG_MGR_DEBUG("nRepeatTime = %d", nRepeatTime);
3374 if (nRepeatTime > 0) {
3375 if (g_alarmId > 0) {
3376 if (MsgMgrAlarmRemove(g_alarmId) != 0) {
3377 MSG_MGR_FATAL("MsgAlarmRemove fail.");
3381 MsgMgrSoundCreateRepeatAlarm(nRepeatTime);
3388 char *get_translate_text(const char *pkg_name, const char *locale_dir, const char *text)
3390 char *notiMsg = NULL;
3393 lang = vconf_get_str(VCONFKEY_LANGSET);
3395 setlocale(LC_MESSAGES, lang);
3397 bindtextdomain(pkg_name, locale_dir);
3399 notiMsg = dgettext(pkg_name, text);
3406 return g_strdup(notiMsg);