3 * Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved.
5 * This file is part of msg-service.
7 * Contact: Jaeyun Jeong <jyjeong@samsung.com>
8 * Sangkoo Kim <sangkoo.kim@samsung.com>
9 * Seunghwan Lee <sh.cat.lee@samsung.com>
10 * SoonMin Jung <sm0415.jung@samsung.com>
11 * Jae-Young Lee <jy4710.lee@samsung.com>
12 * KeeBum Kim <keebum.kim@samsung.com>
14 * PROPRIETARY/CONFIDENTIAL
16 * This software is the confidential and proprietary information of
17 * SAMSUNG ELECTRONICS ("Confidential Information"). You shall not
18 * disclose such Confidential Information and shall use it only in
19 * accordance with the terms of the license agreement you entered
20 * into with SAMSUNG ELECTRONICS.
22 * SAMSUNG make no representations or warranties about the suitability
23 * of the software, either express or implied, including but not limited
24 * to the implied warranties of merchantability, fitness for a particular
25 * purpose, or non-infringement. SAMSUNG shall not be liable for any
26 * damages suffered by licensee as a result of using, modifying or
27 * distributing this software or its derivatives.
32 #include "MsgContact.h"
33 #include "MsgStorageTypes.h"
34 #include "MsgNotificationWrapper.h"
38 #include <notification.h>
41 /*==================================================================================================
42 FUNCTION IMPLEMENTATION
43 ==================================================================================================*/
44 MSG_ERROR_T MsgInsertNoti(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S* pMsg)
47 notification_h noti = NULL;
48 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
55 char addressVal[MAX_ADDRESS_VAL_LEN+1];
56 char firstName[MAX_DISPLAY_NAME_LEN+1], lastName[MAX_DISPLAY_NAME_LEN+1];
57 char displayName[MAX_DISPLAY_NAME_LEN+1];
58 char sqlQuery[MAX_QUERY_LEN+1];
60 memset(tempId, 0x00, sizeof(tempId));
61 memset(addressVal, 0x00, sizeof(addressVal));
62 memset(firstName, 0x00, sizeof(firstName));
63 memset(lastName, 0x00, sizeof(lastName));
64 memset(displayName, 0x00, sizeof(displayName));
65 memset(sqlQuery, 0x00, sizeof(sqlQuery));
67 snprintf(sqlQuery, sizeof(sqlQuery), "SELECT A.ADDRESS_ID, A.ADDRESS_VAL, A.DISPLAY_NAME, A.FIRST_NAME, A.LAST_NAME, \
68 B.DISPLAY_TIME, A.CONTACT_ID \
70 WHERE B.MSG_ID=%d AND A.ADDRESS_ID=B.ADDRESS_ID;",
71 MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME, pMsg->msgId);
73 if (pDbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS)
74 return MSG_ERR_DB_PREPARE;
76 if (pDbHandle->stepQuery() == MSG_ERR_DB_ROW) {
77 threadId = pDbHandle->columnInt(0);
79 if (pDbHandle->columnText(1) != NULL)
80 strncpy(addressVal, (char*)pDbHandle->columnText(1), MAX_ADDRESS_VAL_LEN);
83 char *pTempDisplayName = (char *)pDbHandle->columnText(2);
84 if (pTempDisplayName != NULL && pTempDisplayName[0] != '\0') {
85 strncpy(displayName, pTempDisplayName, MAX_DISPLAY_NAME_LEN);
87 if (pDbHandle->columnText(3) != NULL)
88 strncpy(firstName, (char*)pDbHandle->columnText(3), MAX_DISPLAY_NAME_LEN);
90 if (pDbHandle->columnText(4) != NULL)
91 strncpy(lastName, (char*)pDbHandle->columnText(4), MAX_DISPLAY_NAME_LEN);
93 int order = MsgGetContactNameOrder();
96 if (firstName[0] != '\0') {
97 strncpy(displayName, firstName, MAX_DISPLAY_NAME_LEN);
100 if (lastName[0] != '\0') {
101 strncat(displayName, " ", MAX_DISPLAY_NAME_LEN-strlen(displayName));
102 strncat(displayName, lastName, MAX_DISPLAY_NAME_LEN-strlen(displayName));
104 } else if (order == 1) {
105 if (lastName[0] != '\0') {
106 strncpy(displayName, lastName, MAX_DISPLAY_NAME_LEN);
107 strncat(displayName, " ", MAX_DISPLAY_NAME_LEN-strlen(displayName));
110 if (firstName[0] != '\0') {
111 strncat(displayName, firstName, MAX_DISPLAY_NAME_LEN-strlen(displayName));
116 msgTime = (time_t)pDbHandle->columnInt(5);
118 contactId = pDbHandle->columnInt(6);
120 pDbHandle->finalizeQuery();
121 return MSG_ERR_DB_STEP;
124 pDbHandle->finalizeQuery();
127 args = bundle_create();
129 if (pMsg->msgType.mainType == MSG_SMS_TYPE && pMsg->msgType.subType == MSG_CB_SMS) {
131 noti = notification_new(NOTIFICATION_TYPE_NOTI, 1, pMsg->msgId);
133 MSG_DEBUG("notification_new is failed.");
135 return MSG_ERR_UNKNOWN;
138 noti_err = notification_set_application(noti, "org.tizen.message");
139 if (noti_err != NOTIFICATION_ERROR_NONE) {
140 MSG_DEBUG("Fail to notification_set_application : %d", noti_err);
143 noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, CB_MSG_ICON_PATH);
144 if (noti_err != NOTIFICATION_ERROR_NONE) {
145 MSG_DEBUG("Fail to notification_set_image : %d", noti_err);
148 memset(&tempId, 0x00, sizeof(tempId));
150 snprintf(tempId, 5, "%d", threadId);
151 bundle_add(args, "threadId", tempId);
152 } else if (pMsg->msgType.mainType == MSG_SMS_TYPE && pMsg->msgType.classType == MSG_CLASS_0) {
154 noti = notification_new(NOTIFICATION_TYPE_NOTI, NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE);
156 MSG_DEBUG("notification_new is failed.");
158 return MSG_ERR_UNKNOWN;
161 noti_err = notification_set_application(noti, "org.tizen.msg-ui-class0");
162 if (noti_err != NOTIFICATION_ERROR_NONE) {
163 MSG_DEBUG("Fail to notification_set_application : %d", noti_err);
166 snprintf(tempId, 5, "%d", pMsg->msgId);
167 bundle_add(args, "msg_id", tempId);
168 } else if (pMsg->msgType.mainType == MSG_SMS_TYPE && pMsg->msgType.subType == MSG_MWI_VOICE_SMS) {
170 noti = notification_new(NOTIFICATION_TYPE_NOTI, 1, pMsg->msgId);
172 MSG_DEBUG("notification_new is failed.");
174 return MSG_ERR_UNKNOWN;
177 noti_err = notification_set_application(noti, "org.tizen.message");
178 if (noti_err != NOTIFICATION_ERROR_NONE) {
179 MSG_DEBUG("Fail to notification_set_application : %d", noti_err);
182 noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, VOICE_MSG_ICON_PATH);
183 if (noti_err != NOTIFICATION_ERROR_NONE) {
184 MSG_DEBUG("Fail to notification_set_image : %d", noti_err);
187 memset(&tempId, 0x00, sizeof(tempId));
189 snprintf(tempId, 5, "%d", threadId);
190 bundle_add(args, "threadId", tempId);
192 MSG_DEBUG("notification_new pMsg->msgId [%d]", pMsg->msgId);
193 noti = notification_new(NOTIFICATION_TYPE_NOTI, 1, pMsg->msgId);
195 MSG_DEBUG("notification_new is failed.");
197 return MSG_ERR_UNKNOWN;
200 noti_err = notification_set_application(noti, "org.tizen.message");
201 if (noti_err != NOTIFICATION_ERROR_NONE) {
202 MSG_DEBUG("Fail to notification_set_application : %d", noti_err);
205 noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, NORMAL_MSG_ICON_PATH);
206 if (noti_err != NOTIFICATION_ERROR_NONE) {
207 MSG_DEBUG("Fail to notification_set_image : %d", noti_err);
210 memset(&tempId, 0x00, sizeof(tempId));
212 snprintf(tempId, 5, "%d", threadId);
213 bundle_add(args, "threadId", tempId);
216 bundle_add(args, "type", "msg_id");
218 snprintf(tempId, 5, "%d", pMsg->msgId);
219 bundle_add(args, "msgId", tempId);
221 if (displayName[0] == '\0')
222 notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, addressVal, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
224 notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, displayName, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
226 if (pMsg->msgType.mainType == MSG_SMS_TYPE)
227 notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, pMsg->msgText, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
229 notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, pMsg->subject, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
233 noti_err = notification_set_args(noti, args, NULL);
234 if (noti_err != NOTIFICATION_ERROR_NONE) {
235 MSG_DEBUG("Fail to notification_set_args : %d", noti_err);
239 noti_err = notification_set_time(noti, msgTime);
240 if (noti_err != NOTIFICATION_ERROR_NONE) {
241 MSG_DEBUG("Fail to notification_set_time : %d", noti_err);
244 noti_err = notification_insert(noti, NULL);
245 if (noti_err != NOTIFICATION_ERROR_NONE) {
246 MSG_DEBUG("Fail to notification_insert");
249 noti_err = notification_free(noti);
250 if (noti_err != NOTIFICATION_ERROR_NONE) {
251 MSG_DEBUG("Fail to notification_free");
260 MSG_ERROR_T MsgInsertSmsReportToNoti(MsgDbHandler *pDbHandle, MSG_MESSAGE_ID_T MsgId, MSG_DELIVERY_REPORT_STATUS_T Status)
262 notification_h noti = NULL;
263 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
265 char addressVal[MAX_ADDRESS_VAL_LEN+1];
266 char firstName[MAX_DISPLAY_NAME_LEN+1], lastName[MAX_DISPLAY_NAME_LEN+1];
267 char displayName[MAX_DISPLAY_NAME_LEN+1];
268 char contents[MAX_DISPLAY_NAME_LEN+1];
269 char sqlQuery[MAX_QUERY_LEN+1];
271 memset(addressVal, 0x00, sizeof(addressVal));
272 memset(firstName, 0x00, sizeof(firstName));
273 memset(lastName, 0x00, sizeof(lastName));
274 memset(displayName, 0x00, sizeof(displayName));
275 memset(contents, 0x00, sizeof(contents));
276 memset(sqlQuery, 0x00, sizeof(sqlQuery));
278 snprintf(sqlQuery, sizeof(sqlQuery), "SELECT A.ADDRESS_VAL, A.DISPLAY_NAME, A.FIRST_NAME, A.LAST_NAME \
280 WHERE B.MSG_ID = %d \
281 AND A.ADDRESS_ID = B.ADDRESS_ID;",
282 MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME, MsgId);
284 if (pDbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS)
285 return MSG_ERR_DB_PREPARE;
287 if (pDbHandle->stepQuery() == MSG_ERR_DB_ROW) {
288 if (pDbHandle->columnText(0) != NULL)
289 strncpy(addressVal, (char*)pDbHandle->columnText(0), MAX_ADDRESS_VAL_LEN);
291 if (pDbHandle->columnText(1) != NULL) {
292 strncpy(displayName, (char*)pDbHandle->columnText(1), MAX_DISPLAY_NAME_LEN);
294 if (pDbHandle->columnText(2) != NULL)
295 strncpy(firstName, (char*)pDbHandle->columnText(2), MAX_DISPLAY_NAME_LEN);
297 if (pDbHandle->columnText(3) != NULL)
298 strncpy(lastName, (char*)pDbHandle->columnText(3), MAX_DISPLAY_NAME_LEN);
300 int order = MsgGetContactNameOrder();
303 if (firstName[0] != '\0') {
304 strncpy(displayName, firstName, MAX_DISPLAY_NAME_LEN);
307 if (lastName[0] != '\0') {
308 strncat(displayName, " ", MAX_DISPLAY_NAME_LEN-strlen(displayName));
309 strncat(displayName, lastName, MAX_DISPLAY_NAME_LEN-strlen(displayName));
311 } else if (order == 1) {
312 if (lastName[0] != '\0') {
313 strncpy(displayName, lastName, MAX_DISPLAY_NAME_LEN);
314 strncat(displayName, " ", MAX_DISPLAY_NAME_LEN-strlen(displayName));
317 if (firstName[0] != '\0') {
318 strncat(displayName, firstName, MAX_DISPLAY_NAME_LEN-strlen(displayName));
323 MSG_DEBUG("query : %s", sqlQuery);
325 pDbHandle->finalizeQuery();
327 return MSG_ERR_DB_STEP;
330 pDbHandle->finalizeQuery();
333 noti = notification_new(NOTIFICATION_TYPE_NOTI, NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE);
335 MSG_DEBUG("notification_new is failed.");
336 return MSG_ERR_UNKNOWN;
339 noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, NOTI_MSG_ICON_PATH);
340 if (noti_err != NOTIFICATION_ERROR_NONE) {
341 MSG_DEBUG("Fail to notification_set_image : %d", noti_err);
344 if (displayName[0] == '\0')
345 notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, addressVal, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
347 notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, displayName, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
350 if (Status == MSG_DELIVERY_REPORT_SUCCESS)
351 snprintf(contents, MAX_DISPLAY_NAME_LEN, "Delivered.");
353 snprintf(contents, MAX_DISPLAY_NAME_LEN, "Deliver Failed.");
355 notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, contents, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
357 noti_err = notification_insert(noti, NULL);
358 if (noti_err != NOTIFICATION_ERROR_NONE) {
359 MSG_DEBUG("Fail to notification_insert");
362 noti_err = notification_free(noti);
363 if (noti_err != NOTIFICATION_ERROR_NONE) {
364 MSG_DEBUG("Fail to notification_free");
371 MSG_ERROR_T MsgInsertMmsReportToNoti(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S* pMsg)
374 notification_h noti = NULL;
375 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
377 MSG_DELIVERY_REPORT_STATUS_T deliveryStatus;
378 MSG_READ_REPORT_STATUS_T readStatus;
380 char addressVal[MAX_ADDRESS_VAL_LEN+1];
381 char firstName[MAX_DISPLAY_NAME_LEN+1], lastName[MAX_DISPLAY_NAME_LEN+1];
382 char displayName[MAX_DISPLAY_NAME_LEN+1];
383 char contents[MAX_DISPLAY_NAME_LEN+1];
384 char sqlQuery[MAX_QUERY_LEN+1];
386 memset(addressVal, 0x00, sizeof(addressVal));
387 memset(firstName, 0x00, sizeof(firstName));
388 memset(lastName, 0x00, sizeof(lastName));
389 memset(displayName, 0x00, sizeof(displayName));
390 memset(contents, 0x00, sizeof(contents));
391 memset(sqlQuery, 0x00, sizeof(sqlQuery));
393 snprintf(sqlQuery, sizeof(sqlQuery), "SELECT A.ADDRESS_VAL, A.DISPLAY_NAME, A.FIRST_NAME, A.LAST_NAME, B.DELIVERY_REPORT_STATUS, B.READ_REPORT_STATUS \
395 WHERE B.MSG_ID=%d AND A.ADDRESS_ID=B.ADDRESS_ID;",
396 MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME, pMsg->msgId);
398 if (pDbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS)
399 return MSG_ERR_DB_PREPARE;
401 if (pDbHandle->stepQuery() == MSG_ERR_DB_ROW) {
402 if (pDbHandle->columnText(0) != NULL)
403 strncpy(addressVal, (char*)pDbHandle->columnText(0), MAX_ADDRESS_VAL_LEN);
406 char *pTempDisplayName = (char *)pDbHandle->columnText(1);
407 if (pTempDisplayName != NULL && pTempDisplayName[0] != '\0') {
408 strncpy(displayName, pTempDisplayName, MAX_DISPLAY_NAME_LEN);
410 if (pDbHandle->columnText(2) != NULL)
411 strncpy(firstName, (char*)pDbHandle->columnText(2), MAX_DISPLAY_NAME_LEN);
413 if (pDbHandle->columnText(3) != NULL)
414 strncpy(lastName, (char*)pDbHandle->columnText(3), MAX_DISPLAY_NAME_LEN);
416 int order = MsgGetContactNameOrder();
419 if (firstName[0] != '\0') {
420 strncpy(displayName, firstName, MAX_DISPLAY_NAME_LEN);
423 if (lastName[0] != '\0') {
424 strncat(displayName, " ", MAX_DISPLAY_NAME_LEN-strlen(displayName));
425 strncat(displayName, lastName, MAX_DISPLAY_NAME_LEN-strlen(displayName));
427 } else if (order == 1) {
428 if (lastName[0] != '\0') {
429 strncpy(displayName, lastName, MAX_DISPLAY_NAME_LEN);
430 strncat(displayName, " ", MAX_DISPLAY_NAME_LEN-strlen(displayName));
433 if (firstName[0] != '\0') {
434 strncat(displayName, firstName, MAX_DISPLAY_NAME_LEN-strlen(displayName));
439 deliveryStatus = (MSG_DELIVERY_REPORT_STATUS_T)pDbHandle->columnInt(4);
440 readStatus = (MSG_READ_REPORT_STATUS_T)pDbHandle->columnInt(5);
443 pDbHandle->finalizeQuery();
444 return MSG_ERR_DB_STEP;
447 pDbHandle->finalizeQuery();
449 noti = notification_new(NOTIFICATION_TYPE_NOTI, NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE);
451 MSG_DEBUG("notification_new is failed.");
452 return MSG_ERR_UNKNOWN;
455 noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, NOTI_MSG_ICON_PATH);
456 if (noti_err != NOTIFICATION_ERROR_NONE) {
457 MSG_DEBUG("Fail to notification_set_image : %d", noti_err);
460 if (displayName[0] == '\0')
461 notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, addressVal, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
463 notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, displayName, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
465 if (pMsg->msgType.subType == MSG_DELIVERYIND_MMS) {
467 switch(deliveryStatus) {
468 case MSG_DELIVERY_REPORT_NONE:
469 noti_err = notification_free(noti);
470 if (noti_err != NOTIFICATION_ERROR_NONE) {
471 MSG_DEBUG("Fail to notification_free");
474 return MSG_ERR_UNKNOWN;
476 case MSG_DELIVERY_REPORT_EXPIRED:
477 snprintf(contents, MAX_DISPLAY_NAME_LEN, "Expired.");
480 case MSG_DELIVERY_REPORT_REJECTED:
481 snprintf(contents, MAX_DISPLAY_NAME_LEN, "Rejected.");
484 case MSG_DELIVERY_REPORT_DEFERRED:
485 snprintf(contents, MAX_DISPLAY_NAME_LEN, "Deferred.");
488 case MSG_DELIVERY_REPORT_UNRECOGNISED:
489 snprintf(contents, MAX_DISPLAY_NAME_LEN, "Unrecognised.");
492 case MSG_DELIVERY_REPORT_INDETERMINATE:
493 snprintf(contents, MAX_DISPLAY_NAME_LEN, "Indeterminate.");
496 case MSG_DELIVERY_REPORT_FORWARDED:
497 snprintf(contents, MAX_DISPLAY_NAME_LEN, "Forwarded.");
500 case MSG_DELIVERY_REPORT_UNREACHABLE:
501 snprintf(contents, MAX_DISPLAY_NAME_LEN, "Unreachable.");
504 case MSG_DELIVERY_REPORT_ERROR:
505 snprintf(contents, MAX_DISPLAY_NAME_LEN, "Error.");
509 snprintf(contents, MAX_DISPLAY_NAME_LEN, "Delivered.");
512 notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, contents, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
513 notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT_FOR_DISPLAY_OPTION_IS_OFF, contents, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
515 noti_err = notification_insert(noti, NULL);
516 if (noti_err != NOTIFICATION_ERROR_NONE)
517 MSG_DEBUG("Fail to notification_insert");
519 } else if (pMsg->msgType.subType == MSG_READORGIND_MMS) {
522 case MSG_READ_REPORT_NONE:
523 noti_err = notification_free(noti);
524 if (noti_err != NOTIFICATION_ERROR_NONE)
525 MSG_DEBUG("Fail to notification_free");
527 return MSG_ERR_UNKNOWN;
529 case MSG_READ_REPORT_IS_DELETED:
530 snprintf(contents, MAX_DISPLAY_NAME_LEN, "Deleted.");
534 snprintf(contents, MAX_DISPLAY_NAME_LEN, "Read.");
537 notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, contents, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
539 noti_err = notification_insert(noti, NULL);
540 if (noti_err != NOTIFICATION_ERROR_NONE) {
541 MSG_DEBUG("Fail to notification_insert");
544 MSG_DEBUG("No matching subtype. subtype [%d]", pMsg->msgType.subType);
546 noti_err = notification_free(noti);
547 if (noti_err != NOTIFICATION_ERROR_NONE) {
548 MSG_DEBUG("Fail to notification_free");
553 noti_err = notification_free(noti);
554 if (noti_err != NOTIFICATION_ERROR_NONE) {
555 MSG_DEBUG("Fail to notification_free");
562 MSG_ERROR_T MsgDeleteNotiByMsgId(MSG_MESSAGE_ID_T msgId)
565 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
567 MSG_DEBUG("notification_delete_by_priv_id msgId [%d]", msgId);
569 noti_err = notification_delete_by_priv_id(NULL, NOTIFICATION_TYPE_NOTI, msgId);
571 if (noti_err != NOTIFICATION_ERROR_NONE) {
572 MSG_DEBUG("Fail to notification_delete_by_priv_id noti_err [%d]", noti_err);
579 MSG_ERROR_T MsgDeleteNotiByThreadId(MSG_THREAD_ID_T ThreadId)
581 notification_delete_group_by_group_id(NULL, NOTIFICATION_TYPE_NOTI, ThreadId);
587 MSG_ERROR_T MsgInsertTicker(const char* pTickerMsg, const char* pLocaleTickerMsg)
590 MSG_DEBUG("pTickerMsg [%s]", pTickerMsg);
591 MSG_DEBUG("pLocaleTickerMsg [%s]", pLocaleTickerMsg);
593 notification_h noti = NULL;
594 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
596 noti = notification_new(NOTIFICATION_TYPE_NOTI, NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE);
598 MSG_DEBUG("notification_new is failed.");
599 return MSG_ERR_UNKNOWN;
602 noti_err = notification_set_application(noti, "org.tizen.message");
603 if (noti_err != NOTIFICATION_ERROR_NONE) {
604 MSG_DEBUG("Fail to notification_set_application : %d", noti_err);
607 noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, CB_MSG_ICON_PATH);
608 if (noti_err != NOTIFICATION_ERROR_NONE) {
609 MSG_DEBUG("Fail to notification_set_image : %d", noti_err);
612 noti_err = notification_set_text_domain(noti, MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR);
613 if (noti_err != NOTIFICATION_ERROR_NONE) {
614 MSG_DEBUG("Fail to notification_set_text_domain.");
617 noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, pTickerMsg, pLocaleTickerMsg, NOTIFICATION_VARIABLE_TYPE_NONE);
618 if (noti_err != NOTIFICATION_ERROR_NONE) {
619 MSG_DEBUG("Fail to notification_set_text : %d", noti_err);
622 noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT_FOR_DISPLAY_OPTION_IS_OFF, pTickerMsg, pLocaleTickerMsg, NOTIFICATION_VARIABLE_TYPE_NONE);
623 if (noti_err != NOTIFICATION_ERROR_NONE) {
624 MSG_DEBUG("Fail to notification_set_text : %d", noti_err);
627 noti_err = notification_set_display_applist(noti, NOTIFICATION_DISPLAY_APP_TICKER);
628 if (noti_err != NOTIFICATION_ERROR_NONE) {
629 MSG_DEBUG("Fail to notification_set_display_applist : %d", noti_err);
632 noti_err = notification_insert(noti, NULL);
633 if (noti_err != NOTIFICATION_ERROR_NONE) {
634 MSG_DEBUG("Fail to notification_set_text_domain");
637 noti_err = notification_free(noti);
638 if (noti_err != NOTIFICATION_ERROR_NONE) {
639 MSG_DEBUG("Fail to notification_set_text_domain");