return err;
}
+static gboolean __on_timer_delete_notification(gpointer userdata)
+{
+ int private_id = (int)userdata;
+ notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
+ if ((noti_err = notification_delete_by_priv_id(NATIVE_EMAIL_APPLICATION_PKG, NOTIFICATION_TYPE_NOTI, private_id)) != NOTIFICATION_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("notification delete fail!!");
+ }
+
+ return false;
+}
+
INTERNAL_FUNC int emcore_add_notification_for_send(char *multi_user_name, int account_id, int mail_id, email_action_t action, int sending_error, unsigned long display)
{
EM_DEBUG_FUNC_BEGIN("account_id: %d, mail_id: %d, action:%d", account_id, mail_id, action);
notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
emstorage_mail_tbl_t *p_mail_data = NULL;
emstorage_account_tbl_t *account_tbl = NULL;
-
+ int private_id = 0;
/* For service bundle */
char buf[256] = {0,};
app_control_h service = NULL;
goto FINISH_OFF;
}
- /* Create service bundle */
+
app_control_create(&service);
if (!service) {
EM_DEBUG_EXCEPTION("service create failed");
}
- snprintf(buf, sizeof(buf), "%d", 12);
- app_control_add_extra_data(service, "RUN_TYPE", buf);
- snprintf(buf, sizeof(buf), "%d", account_id);
- app_control_add_extra_data(service, "ACCOUNT_ID", buf);
- snprintf(buf, sizeof(buf), "%d", p_mail_data->mail_id);
- app_control_add_extra_data(service, "MAIL_ID", buf);
- snprintf(buf, sizeof(buf), "%d", p_mail_data->mailbox_id);
- app_control_add_extra_data(service, "MAILBOX_ID", buf);
- snprintf(buf, sizeof(buf), "%d", sending_error);
- app_control_add_extra_data(service, "SENDING_ERROR", buf);
- if (sending_error == EMAIL_ERROR_NONE) {
- if (action == EMAIL_ACTION_SEND_MAIL)
- snprintf(buf, sizeof(buf), "%s", __NOTI_SENT);
- else if (action == EMAIL_ACTION_SENDING_MAIL)
- snprintf(buf, sizeof(buf), "%s", __NOTI_SENDING);
- } else {
- snprintf(buf, sizeof(buf), "%s", __NOTI_SENT_FAIL);
- }
- app_control_add_extra_data(service, "NOTI_TYPE", buf);
- app_control_set_app_id(service, NATIVE_EMAIL_APPLICATION_PKG);
+ /* Create service bundle */
+ if (sending_error != EMAIL_ERROR_NONE || action == EMAIL_ACTION_SENDING_MAIL) {
- app_control_to_bundle(service, &b);
- noti_err = notification_set_execute_option(noti, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, b);
- if (noti_err != NOTIFICATION_ERROR_NONE) {
- EM_DEBUG_EXCEPTION("notification_set_execute_option failed [%d]", noti_err);
- err = EMAIL_ERROR_SYSTEM_FAILURE;
- goto FINISH_OFF;
+ snprintf(buf, sizeof(buf), "%d", 12);
+ app_control_add_extra_data(service, "RUN_TYPE", buf);
+ snprintf(buf, sizeof(buf), "%d", account_id);
+ app_control_add_extra_data(service, "ACCOUNT_ID", buf);
+ snprintf(buf, sizeof(buf), "%d", p_mail_data->mail_id);
+ app_control_add_extra_data(service, "MAIL_ID", buf);
+ snprintf(buf, sizeof(buf), "%d", p_mail_data->mailbox_id);
+ app_control_add_extra_data(service, "MAILBOX_ID", buf);
+
+ app_control_set_app_id(service, NATIVE_EMAIL_APPLICATION_PKG);
+
+
+ snprintf(buf, sizeof(buf), "%d", sending_error);
+ app_control_add_extra_data(service, "SENDING_ERROR", buf);
+ if (sending_error == EMAIL_ERROR_NONE) {
+ if (action == EMAIL_ACTION_SENDING_MAIL)
+ snprintf(buf, sizeof(buf), "%s", __NOTI_SENDING);
+ } else {
+ snprintf(buf, sizeof(buf), "%s", __NOTI_SENT_FAIL);
+ }
+ app_control_add_extra_data(service, "NOTI_TYPE", buf);
+ app_control_set_app_id(service, NATIVE_EMAIL_APPLICATION_PKG);
+
+ app_control_to_bundle(service, &b);
+ noti_err = notification_set_execute_option(noti, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, b);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ EM_DEBUG_EXCEPTION("notification_set_execute_option failed [%d]", noti_err);
+ err = EMAIL_ERROR_SYSTEM_FAILURE;
+ goto FINISH_OFF;
+ }
}
switch (action) {
switch (sending_error) {
case EMAIL_ERROR_NONE:
+ notification_set_property(noti,NOTIFICATION_PROP_DISABLE_AUTO_DELETE);
+
if ((noti_err = notification_set_text(noti,
NOTIFICATION_TEXT_TYPE_CONTENT,
"Email Sent",
goto FINISH_OFF;
}
- if ((noti_err = notification_insert(noti, NULL)) != NOTIFICATION_ERROR_NONE) {
+ if ((noti_err = notification_insert(noti, &private_id)) != NOTIFICATION_ERROR_NONE) {
EM_DEBUG_EXCEPTION("notification_insert failed [%d]", noti_err);
err = EMAIL_ERROR_NOTI;
goto FINISH_OFF;
}
+ if (sending_error == EMAIL_ERROR_NONE) {
+ g_timeout_add_seconds(3, __on_timer_delete_notification, private_id);
+ }
+
break;
case EMAIL_ACTION_SENDING_MAIL: