Added the contact log insert and delete logic
authorSunghyun Kwon <sh0701.kwon@samsung.com>
Tue, 27 Nov 2012 12:24:45 +0000 (21:24 +0900)
committerSunghyun Kwon <sh0701.kwon@samsung.com>
Tue, 27 Nov 2012 12:24:45 +0000 (21:24 +0900)
email-core/email-core-account.c
email-core/email-core-mailbox-sync.c
email-core/email-core-smtp.c
packaging/email-service.spec

index f544c53..0fa1166 100755 (executable)
@@ -381,6 +381,12 @@ INTERNAL_FUNC int emcore_delete_account(int account_id, int *err_code)
        emcore_delete_notification_by_account(account_id);
        emcore_refresh_account_reference();
 
+       /* Delete contact log */
+       if (!emcore_delete_contacts_log(account_id, &err)) {
+               EM_DEBUG_EXCEPTION("emcore_delete_contacts_log failed : [%d]", err);
+               goto FINISH_OFF;
+       }
+
        ret = true;
 
 FINISH_OFF:
index 60f168a..e558809 100755 (executable)
@@ -1750,7 +1750,25 @@ INTERNAL_FUNC int emcore_sync_header(emstorage_mailbox_tbl_t *input_mailbox_tbl,
                                        if (!emstorage_notify_storage_event(NOTI_MAIL_ADD, account_id, mail_id, mailbox_id_param_string, thread_id))
                                                EM_DEBUG_EXCEPTION("emstorage_notify_storage_event [NOTI_MAIL_ADD] failed");
                                }
-                               
+                       
+                               /* Set contact log */
+                               switch (input_mailbox_tbl->mailbox_type) {
+                               case EMAIL_MAILBOX_TYPE_INBOX :
+                                       if (!emcore_set_received_contacts_log(new_mail_tbl_data, &err)) {
+                                               EM_DEBUG_EXCEPTION("emcore_set_received_contacts_log failed : [%d]", err);
+                                       }
+                                       break;
+                               case EMAIL_MAILBOX_TYPE_SENTBOX:
+                               case EMAIL_MAILBOX_TYPE_OUTBOX:
+                                       if (!emcore_set_sent_contacts_log(new_mail_tbl_data, &err)) {
+                                               EM_DEBUG_EXCEPTION("emcore_set_sent_contacts_log failed : [%d]", err);
+                                       }
+                                       break;
+                               default:
+                                       EM_DEBUG_LOG("Mailbox type : [%d]", input_mailbox_tbl->mailbox_type);
+                                       break;
+                               }
+
                                /*  Release for envelope is not required and it may cause crash. Don't free the memory for envelope here. */
                                /*  Envelope data will be freed by garbage collector in mail_close_full */
                                if (new_mail_tbl_data){
index fe25943..9179b81 100755 (executable)
@@ -1358,6 +1358,11 @@ INTERNAL_FUNC int emcore_send_mail(int account_id, int input_mailbox_id, int mai
                        EM_DEBUG_EXCEPTION(" emcore_delete_mail failed [%d]", err);
        }
 
+       /* Set the phone log */
+       if (!emcore_set_sent_contacts_log(mail_tbl_data, &err)) {
+               EM_DEBUG_EXCEPTION("emcore_set_sent_contacts_log failed : [%d]", err);
+       }
+
        /*Update status save_status to DB*/
        mail_tbl_data->save_status = EMAIL_MAIL_STATUS_SENT;
        if (!emstorage_set_field_of_mails_with_integer_value(account_id, &mail_id, 1, "save_status", mail_tbl_data->save_status, false, &err))
@@ -1617,7 +1622,12 @@ INTERNAL_FUNC int emcore_send_saved_mail(int account_id, char *input_mailbox_nam
                        if (!emcore_delete_mail(account_id, &mail_id, 1, EMAIL_DELETE_LOCALLY, EMAIL_DELETED_AFTER_SENDING, false, &err))
                                EM_DEBUG_EXCEPTION("emcore_delete_mail falied [%d]", err);
                }
-               
+
+               /* Set the phone log */
+               if (!emcore_set_sent_contacts_log(searched_mail_tbl_data, &err)) {
+                       EM_DEBUG_EXCEPTION("emcore_set_sent_contacts_log failed : [%d]", err);
+               }
+       
                if(searched_mail_tbl_data) {
                        emstorage_free_mail(&searched_mail_tbl_data, 1, NULL);
                        searched_mail_tbl_data = NULL;
index 12c7803..e63c8b1 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       email-service
 Summary:    E-mail Framework Middleware package
-Version:    0.10.8
+Version:    0.10.9
 Release:    1
 Group:      System/Libraries
 License:    TBD