2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
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.
18 #include "MsgContact.h"
19 #include "MsgStorageTypes.h"
20 #include "MsgNotificationWrapper.h"
24 #include <notification.h>
27 /*==================================================================================================
28 FUNCTION IMPLEMENTATION
29 ==================================================================================================*/
30 MSG_ERROR_T MsgInsertNoti(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S* pMsg)
33 notification_h noti = NULL;
34 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
41 char addressVal[MAX_ADDRESS_VAL_LEN+1];
42 char firstName[MAX_DISPLAY_NAME_LEN+1], lastName[MAX_DISPLAY_NAME_LEN+1];
43 char displayName[MAX_DISPLAY_NAME_LEN+1];
44 char sqlQuery[MAX_QUERY_LEN+1];
46 memset(tempId, 0x00, sizeof(tempId));
47 memset(addressVal, 0x00, sizeof(addressVal));
48 memset(firstName, 0x00, sizeof(firstName));
49 memset(lastName, 0x00, sizeof(lastName));
50 memset(displayName, 0x00, sizeof(displayName));
51 memset(sqlQuery, 0x00, sizeof(sqlQuery));
53 snprintf(sqlQuery, sizeof(sqlQuery), "SELECT A.ADDRESS_ID, A.ADDRESS_VAL, A.DISPLAY_NAME, A.FIRST_NAME, A.LAST_NAME, \
54 B.DISPLAY_TIME, A.CONTACT_ID \
56 WHERE B.MSG_ID=%d AND A.ADDRESS_ID=B.ADDRESS_ID;",
57 MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME, pMsg->msgId);
59 if (pDbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS)
60 return MSG_ERR_DB_PREPARE;
62 if (pDbHandle->stepQuery() == MSG_ERR_DB_ROW) {
63 threadId = pDbHandle->columnInt(0);
65 if (pDbHandle->columnText(1) != NULL)
66 strncpy(addressVal, (char*)pDbHandle->columnText(1), MAX_ADDRESS_VAL_LEN);
69 char *pTempDisplayName = (char *)pDbHandle->columnText(2);
70 if (pTempDisplayName != NULL && pTempDisplayName[0] != '\0') {
71 strncpy(displayName, pTempDisplayName, MAX_DISPLAY_NAME_LEN);
73 if (pDbHandle->columnText(3) != NULL)
74 strncpy(firstName, (char*)pDbHandle->columnText(3), MAX_DISPLAY_NAME_LEN);
76 if (pDbHandle->columnText(4) != NULL)
77 strncpy(lastName, (char*)pDbHandle->columnText(4), MAX_DISPLAY_NAME_LEN);
79 int order = MsgGetContactNameOrder();
82 if (firstName[0] != '\0') {
83 strncpy(displayName, firstName, MAX_DISPLAY_NAME_LEN);
86 if (lastName[0] != '\0') {
87 strncat(displayName, " ", MAX_DISPLAY_NAME_LEN-strlen(displayName));
88 strncat(displayName, lastName, MAX_DISPLAY_NAME_LEN-strlen(displayName));
90 } else if (order == 1) {
91 if (lastName[0] != '\0') {
92 strncpy(displayName, lastName, MAX_DISPLAY_NAME_LEN);
93 strncat(displayName, " ", MAX_DISPLAY_NAME_LEN-strlen(displayName));
96 if (firstName[0] != '\0') {
97 strncat(displayName, firstName, MAX_DISPLAY_NAME_LEN-strlen(displayName));
102 msgTime = (time_t)pDbHandle->columnInt(5);
104 contactId = pDbHandle->columnInt(6);
106 pDbHandle->finalizeQuery();
107 return MSG_ERR_DB_STEP;
110 pDbHandle->finalizeQuery();
113 args = bundle_create();
115 if (pMsg->msgType.mainType == MSG_SMS_TYPE && pMsg->msgType.subType == MSG_CB_SMS) {
117 noti = notification_new(NOTIFICATION_TYPE_NOTI, 1, pMsg->msgId);
119 MSG_DEBUG("notification_new is failed.");
121 return MSG_ERR_UNKNOWN;
124 noti_err = notification_set_application(noti, "org.tizen.message");
125 if (noti_err != NOTIFICATION_ERROR_NONE) {
126 MSG_DEBUG("Fail to notification_set_application : %d", noti_err);
129 noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, CB_MSG_ICON_PATH);
130 if (noti_err != NOTIFICATION_ERROR_NONE) {
131 MSG_DEBUG("Fail to notification_set_image : %d", noti_err);
134 memset(&tempId, 0x00, sizeof(tempId));
136 snprintf(tempId, 5, "%d", threadId);
137 bundle_add(args, "threadId", tempId);
138 } else if (pMsg->msgType.mainType == MSG_SMS_TYPE && pMsg->msgType.classType == MSG_CLASS_0) {
140 noti = notification_new(NOTIFICATION_TYPE_NOTI, NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE);
142 MSG_DEBUG("notification_new is failed.");
144 return MSG_ERR_UNKNOWN;
147 noti_err = notification_set_application(noti, "org.tizen.msg-ui-class0");
148 if (noti_err != NOTIFICATION_ERROR_NONE) {
149 MSG_DEBUG("Fail to notification_set_application : %d", noti_err);
152 snprintf(tempId, 5, "%d", pMsg->msgId);
153 bundle_add(args, "msg_id", tempId);
154 } else if (pMsg->msgType.mainType == MSG_SMS_TYPE && pMsg->msgType.subType == MSG_MWI_VOICE_SMS) {
156 noti = notification_new(NOTIFICATION_TYPE_NOTI, 1, pMsg->msgId);
158 MSG_DEBUG("notification_new is failed.");
160 return MSG_ERR_UNKNOWN;
163 noti_err = notification_set_application(noti, "org.tizen.message");
164 if (noti_err != NOTIFICATION_ERROR_NONE) {
165 MSG_DEBUG("Fail to notification_set_application : %d", noti_err);
168 noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, VOICE_MSG_ICON_PATH);
169 if (noti_err != NOTIFICATION_ERROR_NONE) {
170 MSG_DEBUG("Fail to notification_set_image : %d", noti_err);
173 memset(&tempId, 0x00, sizeof(tempId));
175 snprintf(tempId, 5, "%d", threadId);
176 bundle_add(args, "threadId", tempId);
178 MSG_DEBUG("notification_new pMsg->msgId [%d]", pMsg->msgId);
179 noti = notification_new(NOTIFICATION_TYPE_NOTI, 1, pMsg->msgId);
181 MSG_DEBUG("notification_new is failed.");
183 return MSG_ERR_UNKNOWN;
186 noti_err = notification_set_application(noti, "org.tizen.message");
187 if (noti_err != NOTIFICATION_ERROR_NONE) {
188 MSG_DEBUG("Fail to notification_set_application : %d", noti_err);
191 noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, NORMAL_MSG_ICON_PATH);
192 if (noti_err != NOTIFICATION_ERROR_NONE) {
193 MSG_DEBUG("Fail to notification_set_image : %d", noti_err);
196 memset(&tempId, 0x00, sizeof(tempId));
198 snprintf(tempId, 5, "%d", threadId);
199 bundle_add(args, "threadId", tempId);
202 bundle_add(args, "type", "msg_id");
204 snprintf(tempId, 5, "%d", pMsg->msgId);
205 bundle_add(args, "msgId", tempId);
207 if (displayName[0] == '\0')
208 notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, addressVal, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
210 notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, displayName, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
212 if (pMsg->msgType.mainType == MSG_SMS_TYPE)
213 notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, pMsg->msgText, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
215 notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, pMsg->subject, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
219 noti_err = notification_set_args(noti, args, NULL);
220 if (noti_err != NOTIFICATION_ERROR_NONE) {
221 MSG_DEBUG("Fail to notification_set_args : %d", noti_err);
225 noti_err = notification_set_time(noti, msgTime);
226 if (noti_err != NOTIFICATION_ERROR_NONE) {
227 MSG_DEBUG("Fail to notification_set_time : %d", noti_err);
230 noti_err = notification_insert(noti, NULL);
231 if (noti_err != NOTIFICATION_ERROR_NONE) {
232 MSG_DEBUG("Fail to notification_insert");
235 noti_err = notification_free(noti);
236 if (noti_err != NOTIFICATION_ERROR_NONE) {
237 MSG_DEBUG("Fail to notification_free");
246 MSG_ERROR_T MsgInsertSmsReportToNoti(MsgDbHandler *pDbHandle, MSG_MESSAGE_ID_T MsgId, MSG_DELIVERY_REPORT_STATUS_T Status)
248 notification_h noti = NULL;
249 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
251 char addressVal[MAX_ADDRESS_VAL_LEN+1];
252 char firstName[MAX_DISPLAY_NAME_LEN+1], lastName[MAX_DISPLAY_NAME_LEN+1];
253 char displayName[MAX_DISPLAY_NAME_LEN+1];
254 char contents[MAX_DISPLAY_NAME_LEN+1];
255 char sqlQuery[MAX_QUERY_LEN+1];
257 memset(addressVal, 0x00, sizeof(addressVal));
258 memset(firstName, 0x00, sizeof(firstName));
259 memset(lastName, 0x00, sizeof(lastName));
260 memset(displayName, 0x00, sizeof(displayName));
261 memset(contents, 0x00, sizeof(contents));
262 memset(sqlQuery, 0x00, sizeof(sqlQuery));
264 snprintf(sqlQuery, sizeof(sqlQuery), "SELECT A.ADDRESS_VAL, A.DISPLAY_NAME, A.FIRST_NAME, A.LAST_NAME \
266 WHERE B.MSG_ID = %d \
267 AND A.ADDRESS_ID = B.ADDRESS_ID;",
268 MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME, MsgId);
270 if (pDbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS)
271 return MSG_ERR_DB_PREPARE;
273 if (pDbHandle->stepQuery() == MSG_ERR_DB_ROW) {
274 if (pDbHandle->columnText(0) != NULL)
275 strncpy(addressVal, (char*)pDbHandle->columnText(0), MAX_ADDRESS_VAL_LEN);
277 if (pDbHandle->columnText(1) != NULL) {
278 strncpy(displayName, (char*)pDbHandle->columnText(1), MAX_DISPLAY_NAME_LEN);
280 if (pDbHandle->columnText(2) != NULL)
281 strncpy(firstName, (char*)pDbHandle->columnText(2), MAX_DISPLAY_NAME_LEN);
283 if (pDbHandle->columnText(3) != NULL)
284 strncpy(lastName, (char*)pDbHandle->columnText(3), MAX_DISPLAY_NAME_LEN);
286 int order = MsgGetContactNameOrder();
289 if (firstName[0] != '\0') {
290 strncpy(displayName, firstName, MAX_DISPLAY_NAME_LEN);
293 if (lastName[0] != '\0') {
294 strncat(displayName, " ", MAX_DISPLAY_NAME_LEN-strlen(displayName));
295 strncat(displayName, lastName, MAX_DISPLAY_NAME_LEN-strlen(displayName));
297 } else if (order == 1) {
298 if (lastName[0] != '\0') {
299 strncpy(displayName, lastName, MAX_DISPLAY_NAME_LEN);
300 strncat(displayName, " ", MAX_DISPLAY_NAME_LEN-strlen(displayName));
303 if (firstName[0] != '\0') {
304 strncat(displayName, firstName, MAX_DISPLAY_NAME_LEN-strlen(displayName));
309 MSG_DEBUG("query : %s", sqlQuery);
311 pDbHandle->finalizeQuery();
313 return MSG_ERR_DB_STEP;
316 pDbHandle->finalizeQuery();
319 noti = notification_new(NOTIFICATION_TYPE_NOTI, NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE);
321 MSG_DEBUG("notification_new is failed.");
322 return MSG_ERR_UNKNOWN;
325 noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, NOTI_MSG_ICON_PATH);
326 if (noti_err != NOTIFICATION_ERROR_NONE) {
327 MSG_DEBUG("Fail to notification_set_image : %d", noti_err);
330 if (displayName[0] == '\0')
331 notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, addressVal, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
333 notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, displayName, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
336 if (Status == MSG_DELIVERY_REPORT_SUCCESS)
337 snprintf(contents, MAX_DISPLAY_NAME_LEN, "Delivered.");
339 snprintf(contents, MAX_DISPLAY_NAME_LEN, "Deliver Failed.");
341 notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, contents, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
343 noti_err = notification_insert(noti, NULL);
344 if (noti_err != NOTIFICATION_ERROR_NONE) {
345 MSG_DEBUG("Fail to notification_insert");
348 noti_err = notification_free(noti);
349 if (noti_err != NOTIFICATION_ERROR_NONE) {
350 MSG_DEBUG("Fail to notification_free");
357 MSG_ERROR_T MsgInsertMmsReportToNoti(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S* pMsg)
360 notification_h noti = NULL;
361 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
363 MSG_DELIVERY_REPORT_STATUS_T deliveryStatus;
364 MSG_READ_REPORT_STATUS_T readStatus;
366 char addressVal[MAX_ADDRESS_VAL_LEN+1];
367 char firstName[MAX_DISPLAY_NAME_LEN+1], lastName[MAX_DISPLAY_NAME_LEN+1];
368 char displayName[MAX_DISPLAY_NAME_LEN+1];
369 char contents[MAX_DISPLAY_NAME_LEN+1];
370 char sqlQuery[MAX_QUERY_LEN+1];
372 memset(addressVal, 0x00, sizeof(addressVal));
373 memset(firstName, 0x00, sizeof(firstName));
374 memset(lastName, 0x00, sizeof(lastName));
375 memset(displayName, 0x00, sizeof(displayName));
376 memset(contents, 0x00, sizeof(contents));
377 memset(sqlQuery, 0x00, sizeof(sqlQuery));
379 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 \
381 WHERE B.MSG_ID=%d AND A.ADDRESS_ID=B.ADDRESS_ID;",
382 MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME, pMsg->msgId);
384 if (pDbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS)
385 return MSG_ERR_DB_PREPARE;
387 if (pDbHandle->stepQuery() == MSG_ERR_DB_ROW) {
388 if (pDbHandle->columnText(0) != NULL)
389 strncpy(addressVal, (char*)pDbHandle->columnText(0), MAX_ADDRESS_VAL_LEN);
392 char *pTempDisplayName = (char *)pDbHandle->columnText(1);
393 if (pTempDisplayName != NULL && pTempDisplayName[0] != '\0') {
394 strncpy(displayName, pTempDisplayName, MAX_DISPLAY_NAME_LEN);
396 if (pDbHandle->columnText(2) != NULL)
397 strncpy(firstName, (char*)pDbHandle->columnText(2), MAX_DISPLAY_NAME_LEN);
399 if (pDbHandle->columnText(3) != NULL)
400 strncpy(lastName, (char*)pDbHandle->columnText(3), MAX_DISPLAY_NAME_LEN);
402 int order = MsgGetContactNameOrder();
405 if (firstName[0] != '\0') {
406 strncpy(displayName, firstName, MAX_DISPLAY_NAME_LEN);
409 if (lastName[0] != '\0') {
410 strncat(displayName, " ", MAX_DISPLAY_NAME_LEN-strlen(displayName));
411 strncat(displayName, lastName, MAX_DISPLAY_NAME_LEN-strlen(displayName));
413 } else if (order == 1) {
414 if (lastName[0] != '\0') {
415 strncpy(displayName, lastName, MAX_DISPLAY_NAME_LEN);
416 strncat(displayName, " ", MAX_DISPLAY_NAME_LEN-strlen(displayName));
419 if (firstName[0] != '\0') {
420 strncat(displayName, firstName, MAX_DISPLAY_NAME_LEN-strlen(displayName));
425 deliveryStatus = (MSG_DELIVERY_REPORT_STATUS_T)pDbHandle->columnInt(4);
426 readStatus = (MSG_READ_REPORT_STATUS_T)pDbHandle->columnInt(5);
429 pDbHandle->finalizeQuery();
430 return MSG_ERR_DB_STEP;
433 pDbHandle->finalizeQuery();
435 noti = notification_new(NOTIFICATION_TYPE_NOTI, NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE);
437 MSG_DEBUG("notification_new is failed.");
438 return MSG_ERR_UNKNOWN;
441 noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, NOTI_MSG_ICON_PATH);
442 if (noti_err != NOTIFICATION_ERROR_NONE) {
443 MSG_DEBUG("Fail to notification_set_image : %d", noti_err);
446 if (displayName[0] == '\0')
447 notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, addressVal, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
449 notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, displayName, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
451 if (pMsg->msgType.subType == MSG_DELIVERYIND_MMS) {
453 switch(deliveryStatus) {
454 case MSG_DELIVERY_REPORT_NONE:
455 noti_err = notification_free(noti);
456 if (noti_err != NOTIFICATION_ERROR_NONE) {
457 MSG_DEBUG("Fail to notification_free");
460 return MSG_ERR_UNKNOWN;
462 case MSG_DELIVERY_REPORT_EXPIRED:
463 snprintf(contents, MAX_DISPLAY_NAME_LEN, "Expired.");
466 case MSG_DELIVERY_REPORT_REJECTED:
467 snprintf(contents, MAX_DISPLAY_NAME_LEN, "Rejected.");
470 case MSG_DELIVERY_REPORT_DEFERRED:
471 snprintf(contents, MAX_DISPLAY_NAME_LEN, "Deferred.");
474 case MSG_DELIVERY_REPORT_UNRECOGNISED:
475 snprintf(contents, MAX_DISPLAY_NAME_LEN, "Unrecognised.");
478 case MSG_DELIVERY_REPORT_INDETERMINATE:
479 snprintf(contents, MAX_DISPLAY_NAME_LEN, "Indeterminate.");
482 case MSG_DELIVERY_REPORT_FORWARDED:
483 snprintf(contents, MAX_DISPLAY_NAME_LEN, "Forwarded.");
486 case MSG_DELIVERY_REPORT_UNREACHABLE:
487 snprintf(contents, MAX_DISPLAY_NAME_LEN, "Unreachable.");
490 case MSG_DELIVERY_REPORT_ERROR:
491 snprintf(contents, MAX_DISPLAY_NAME_LEN, "Error.");
495 snprintf(contents, MAX_DISPLAY_NAME_LEN, "Delivered.");
498 notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, contents, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
499 notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT_FOR_DISPLAY_OPTION_IS_OFF, contents, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
501 noti_err = notification_insert(noti, NULL);
502 if (noti_err != NOTIFICATION_ERROR_NONE)
503 MSG_DEBUG("Fail to notification_insert");
505 } else if (pMsg->msgType.subType == MSG_READORGIND_MMS) {
508 case MSG_READ_REPORT_NONE:
509 noti_err = notification_free(noti);
510 if (noti_err != NOTIFICATION_ERROR_NONE)
511 MSG_DEBUG("Fail to notification_free");
513 return MSG_ERR_UNKNOWN;
515 case MSG_READ_REPORT_IS_DELETED:
516 snprintf(contents, MAX_DISPLAY_NAME_LEN, "Deleted.");
520 snprintf(contents, MAX_DISPLAY_NAME_LEN, "Read.");
523 notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, contents, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
525 noti_err = notification_insert(noti, NULL);
526 if (noti_err != NOTIFICATION_ERROR_NONE) {
527 MSG_DEBUG("Fail to notification_insert");
530 MSG_DEBUG("No matching subtype. subtype [%d]", pMsg->msgType.subType);
532 noti_err = notification_free(noti);
533 if (noti_err != NOTIFICATION_ERROR_NONE) {
534 MSG_DEBUG("Fail to notification_free");
539 noti_err = notification_free(noti);
540 if (noti_err != NOTIFICATION_ERROR_NONE) {
541 MSG_DEBUG("Fail to notification_free");
548 MSG_ERROR_T MsgDeleteNotiByMsgId(MSG_MESSAGE_ID_T msgId)
551 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
553 MSG_DEBUG("notification_delete_by_priv_id msgId [%d]", msgId);
555 noti_err = notification_delete_by_priv_id(NULL, NOTIFICATION_TYPE_NOTI, msgId);
557 if (noti_err != NOTIFICATION_ERROR_NONE) {
558 MSG_DEBUG("Fail to notification_delete_by_priv_id noti_err [%d]", noti_err);
565 MSG_ERROR_T MsgDeleteNotiByThreadId(MSG_THREAD_ID_T ThreadId)
567 notification_delete_group_by_group_id(NULL, NOTIFICATION_TYPE_NOTI, ThreadId);
573 MSG_ERROR_T MsgInsertTicker(const char* pTickerMsg, const char* pLocaleTickerMsg)
576 MSG_DEBUG("pTickerMsg [%s]", pTickerMsg);
577 MSG_DEBUG("pLocaleTickerMsg [%s]", pLocaleTickerMsg);
579 notification_h noti = NULL;
580 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
582 noti = notification_new(NOTIFICATION_TYPE_NOTI, NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE);
584 MSG_DEBUG("notification_new is failed.");
585 return MSG_ERR_UNKNOWN;
588 noti_err = notification_set_application(noti, "org.tizen.message");
589 if (noti_err != NOTIFICATION_ERROR_NONE) {
590 MSG_DEBUG("Fail to notification_set_application : %d", noti_err);
593 noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, CB_MSG_ICON_PATH);
594 if (noti_err != NOTIFICATION_ERROR_NONE) {
595 MSG_DEBUG("Fail to notification_set_image : %d", noti_err);
598 noti_err = notification_set_text_domain(noti, MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR);
599 if (noti_err != NOTIFICATION_ERROR_NONE) {
600 MSG_DEBUG("Fail to notification_set_text_domain.");
603 noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, pTickerMsg, pLocaleTickerMsg, NOTIFICATION_VARIABLE_TYPE_NONE);
604 if (noti_err != NOTIFICATION_ERROR_NONE) {
605 MSG_DEBUG("Fail to notification_set_text : %d", noti_err);
608 noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT_FOR_DISPLAY_OPTION_IS_OFF, pTickerMsg, pLocaleTickerMsg, NOTIFICATION_VARIABLE_TYPE_NONE);
609 if (noti_err != NOTIFICATION_ERROR_NONE) {
610 MSG_DEBUG("Fail to notification_set_text : %d", noti_err);
613 noti_err = notification_set_display_applist(noti, NOTIFICATION_DISPLAY_APP_TICKER);
614 if (noti_err != NOTIFICATION_ERROR_NONE) {
615 MSG_DEBUG("Fail to notification_set_display_applist : %d", noti_err);
618 noti_err = notification_insert(noti, NULL);
619 if (noti_err != NOTIFICATION_ERROR_NONE) {
620 MSG_DEBUG("Fail to notification_set_text_domain");
623 noti_err = notification_free(noti);
624 if (noti_err != NOTIFICATION_ERROR_NONE) {
625 MSG_DEBUG("Fail to notification_set_text_domain");