sync sended mail to server in sentbox
authorMinsoo Kim <minnsoo.kim@samsung.com>
Mon, 25 Feb 2013 10:53:33 +0000 (19:53 +0900)
committerMinsoo Kim <minnsoo.kim@samsung.com>
Mon, 25 Feb 2013 10:54:28 +0000 (19:54 +0900)
email-core/email-core-mail.c
email-core/email-core-mailbox-sync.c
email-core/email-core-smtp.c
packaging/email-service.spec

index 7106687..9c06cd7 100755 (executable)
@@ -4865,8 +4865,11 @@ INTERNAL_FUNC int emcore_move_mail_on_server(int account_id, int src_mailbox_id,
                                        EM_DEBUG_LOG("Mail MOVE SUCCESS ");
                                }
                        }
-                       else
+                       else {
                                EM_DEBUG_EXCEPTION(">>>> Server MAIL ID IS NULL >>>> ");
+                               ret = 0;
+                               goto FINISH_OFF;
+                       }
                }
                else {
                        EM_DEBUG_EXCEPTION(">>>> STREAM DATA IS NULL >>> ");
index 57f7642..c7432da 100755 (executable)
@@ -2463,7 +2463,7 @@ INTERNAL_FUNC int emcore_sync_mail_from_client_to_server(int mail_id)
                goto FINISH_OFF;
        }
 
-       if (mailbox_tbl->local_yn == 0) {
+       if (mailbox_tbl->local_yn) {
                EM_DEBUG_EXCEPTION("The mailbox [%s] is not on server.", mail_table_data->mailbox_name);
                err = EMAIL_ERROR_INVALID_MAILBOX;
                goto FINISH_OFF;
index 96467e8..e8bca48 100755 (executable)
@@ -1279,9 +1279,7 @@ INTERNAL_FUNC int emcore_send_mail(int account_id, int input_mailbox_id, int mai
                goto FINISH_OFF;
        }
        dst_mailbox_id = local_mailbox->mailbox_id;
-
-       if(local_mailbox)
-               emstorage_free_mailbox(&local_mailbox, 1, NULL);
+       emstorage_free_mailbox(&local_mailbox, 1, NULL);
 
 
        if (!emcore_connect_to_remote_mailbox(account_id, EMAIL_CONNECT_FOR_SENDING, (void **)&tmp_stream, &err))  {
@@ -1328,9 +1326,7 @@ INTERNAL_FUNC int emcore_send_mail(int account_id, int input_mailbox_id, int mai
                        goto FINISH_OFF;
                }
                dst_mailbox_id = local_mailbox->mailbox_id;
-
-               if(local_mailbox)
-                       emstorage_free_mailbox(&local_mailbox, 1, NULL);
+               emstorage_free_mailbox(&local_mailbox, 1, NULL);
 
                /*  unsent mail is moved to 'OUTBOX'. */
                if (!emcore_move_mail(&mail_id, 1, dst_mailbox_id, EMAIL_MOVED_BY_COMMAND, 0, NULL))
@@ -1395,6 +1391,24 @@ INTERNAL_FUNC int emcore_send_mail(int account_id, int input_mailbox_id, int mai
 #endif
 #endif
 
+               if (ref_account->incoming_server_type == EMAIL_SERVER_TYPE_IMAP4) {
+                       emstorage_mailbox_tbl_t* src_mailbox = NULL;
+                       if (!emstorage_get_mailbox_by_mailbox_type(account_id, EMAIL_MAILBOX_TYPE_OUTBOX, &src_mailbox, true, &err))  {
+                               EM_DEBUG_EXCEPTION("emstorage_get_mailbox_by_mailbox_type failed [%d]", err);
+                               goto FINISH_OFF;
+                       }
+
+                       if (src_mailbox->local_yn)
+                               emcore_sync_mail_from_client_to_server(mail_id);
+                       else {
+                               if (!emcore_move_mail_on_server(account_id, src_mailbox->mailbox_id, &mail_id, 1, local_mailbox->mailbox_name, &err)) {
+                                       EM_DEBUG_EXCEPTION(" emcore_move_mail_on_server falied [%d]", err);
+                               }
+                       }
+
+                       emstorage_free_mailbox(&src_mailbox, 1, NULL);
+               }
+
                /* On Successful Mail sent remove the Draft flag */
                mail_tbl_data->flags_draft_field = 0;
 
index 292bdd6..39aa585 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       email-service
 Summary:    E-mail Framework Middleware package
-Version:    0.10.85
+Version:    0.10.86
 Release:    1
 Group:      System/Libraries
 License:    TBD