Fixed the email_add_mail para missing
authorSunghyun Kwon <sh0701.kwon@samsung.com>
Tue, 15 Jan 2013 08:27:51 +0000 (17:27 +0900)
committerSunghyun Kwon <sh0701.kwon@samsung.com>
Tue, 15 Jan 2013 08:27:51 +0000 (17:27 +0900)
email-api/email-api-mail.c
email-core/email-core-smtp.c
email-daemon/main.c
packaging/email-service.spec

index 7f03f4d..76ccbac 100755 (executable)
@@ -93,13 +93,12 @@ EXPORT_API int email_add_mail(email_mail_data_t *input_mail_data, email_attachme
                /* email_attachment_data_t */
                attachment_data_list_stream = em_convert_attachment_data_to_byte_stream(input_attachment_data_list, input_attachment_count, &size);
 
-               if(!emipc_add_dynamic_parameter(hAPI, ePARAMETER_IN, attachment_data_list_stream, size)) {
+               if((size > 0) && !emipc_add_dynamic_parameter(hAPI, ePARAMETER_IN, attachment_data_list_stream, size)) {
                        EM_DEBUG_EXCEPTION("emipc_add_dynamic_parameter failed");
                        err = EMAIL_ERROR_OUT_OF_MEMORY;
                        goto FINISH_OFF;
                }
 
-
                /*  email_meeting_request_t */
                if ( input_mail_data->meeting_request_status != EMAIL_MAIL_TYPE_NORMAL ) {
                        meeting_request_stream = em_convert_meeting_req_to_byte_stream(input_meeting_request, &size);
index 14661a7..f4e1f09 100755 (executable)
@@ -2568,7 +2568,6 @@ static int emcore_make_envelope_from_mail(emstorage_mail_tbl_t *input_mail_tbl_d
        int       error                   = EMAIL_ERROR_NONE;
        int       is_incomplete           = 0;
        char     *pAdd                    = NULL;
-       char     *outgoing_server_address = NULL;
        ENVELOPE *envelope                = NULL;
        email_account_t *ref_account      = NULL;
 
@@ -2584,21 +2583,6 @@ static int emcore_make_envelope_from_mail(emstorage_mail_tbl_t *input_mail_tbl_d
                goto FINISH_OFF;
        }
 
-       if (input_mail_tbl_data->account_id <= 0) {
-               error = EMAIL_ERROR_INVALID_PARAM;
-               goto FINISH_OFF;
-       }
-
-       ref_account = emcore_get_account_reference(input_mail_tbl_data->account_id);
-
-       if (!ref_account)  {
-               EM_DEBUG_EXCEPTION("emcore_get_account_reference failed [%d]", input_mail_tbl_data->account_id);
-               error = EMAIL_ERROR_INVALID_ACCOUNT;
-               goto FINISH_OFF;
-       }
-
-       outgoing_server_address = EM_SAFE_STRDUP(ref_account->outgoing_server_address);
-
        if (!(envelope = mail_newenvelope()))  {
                EM_DEBUG_EXCEPTION("mail_newenvelope failed...");
                error = EMAIL_ERROR_OUT_OF_MEMORY;
@@ -2607,7 +2591,14 @@ static int emcore_make_envelope_from_mail(emstorage_mail_tbl_t *input_mail_tbl_d
 
        is_incomplete = input_mail_tbl_data->flags_draft_field || (input_mail_tbl_data->save_status == EMAIL_MAIL_STATUS_SENDING);
 
-       if (is_incomplete)  {
+       if (is_incomplete && (input_mail_tbl_data->account_id > 0))  {
+               ref_account = emcore_get_account_reference(input_mail_tbl_data->account_id);
+               if (!ref_account)  {
+                       EM_DEBUG_EXCEPTION("emcore_get_account_reference failed [%d]", input_mail_tbl_data->account_id);
+                       error = EMAIL_ERROR_INVALID_ACCOUNT;
+                       goto FINISH_OFF;
+               }
+
                if (ref_account->user_email_address && ref_account->user_email_address[0] != '\0')  {
                        char *p = cpystr(ref_account->user_email_address);
 
@@ -2623,7 +2614,7 @@ static int emcore_make_envelope_from_mail(emstorage_mail_tbl_t *input_mail_tbl_d
                                char *temp_address_string = NULL ;
                                em_skip_whitespace(input_mail_tbl_data->full_address_from , &temp_address_string);
                                EM_DEBUG_LOG("address[temp_address_string][%s]", temp_address_string);
-                               rfc822_parse_adrlist(&envelope->from, temp_address_string, outgoing_server_address);
+                               rfc822_parse_adrlist(&envelope->from, temp_address_string, NULL);
                                EM_SAFE_FREE(temp_address_string);
                                temp_address_string = NULL ;
                        }
@@ -2685,14 +2676,14 @@ static int emcore_make_envelope_from_mail(emstorage_mail_tbl_t *input_mail_tbl_d
                em_skip_whitespace(input_mail_tbl_data->full_address_from , &pAdd);
                EM_DEBUG_LOG("address[pAdd][%s]", pAdd);
 
-               rfc822_parse_adrlist(&envelope->from, pAdd, outgoing_server_address);
+               rfc822_parse_adrlist(&envelope->from, pAdd, NULL);
                EM_SAFE_FREE(pAdd);
                pAdd = NULL;
 
                em_skip_whitespace(input_mail_tbl_data->full_address_return , &pAdd);
                EM_DEBUG_LOG("address[pAdd][%s]", pAdd);
 
-               rfc822_parse_adrlist(&envelope->return_path, pAdd, outgoing_server_address);
+               rfc822_parse_adrlist(&envelope->return_path, pAdd, NULL);
                EM_SAFE_FREE(pAdd);
                pAdd = NULL;
        }
@@ -2725,7 +2716,7 @@ static int emcore_make_envelope_from_mail(emstorage_mail_tbl_t *input_mail_tbl_d
        em_skip_whitespace(input_mail_tbl_data->full_address_to , &pAdd);
        EM_DEBUG_LOG("address[pAdd][%s]", pAdd);
 
-       rfc822_parse_adrlist(&envelope->to, pAdd, outgoing_server_address);
+       rfc822_parse_adrlist(&envelope->to, pAdd, NULL);
        EM_SAFE_FREE(pAdd);
        pAdd = NULL ;
 
@@ -2733,12 +2724,12 @@ static int emcore_make_envelope_from_mail(emstorage_mail_tbl_t *input_mail_tbl_d
        em_skip_whitespace(input_mail_tbl_data->full_address_cc , &pAdd);
        EM_DEBUG_LOG("address[pAdd][%s]", pAdd);
 
-       rfc822_parse_adrlist(&envelope->cc, pAdd, outgoing_server_address);
+       rfc822_parse_adrlist(&envelope->cc, pAdd, NULL);
        EM_SAFE_FREE(pAdd);
                pAdd = NULL ;
 
        em_skip_whitespace(input_mail_tbl_data->full_address_bcc , &pAdd);
-       rfc822_parse_adrlist(&envelope->bcc, pAdd, outgoing_server_address);
+       rfc822_parse_adrlist(&envelope->bcc, pAdd, NULL);
        EM_SAFE_FREE(pAdd);
                pAdd = NULL ;
 
@@ -2778,9 +2769,6 @@ FINISH_OFF:
                *output_envelope = NULL;
        }
 
-       if (outgoing_server_address)
-               EM_SAFE_FREE(outgoing_server_address);
-
        EM_DEBUG_FUNC_END("error [%d]", error);
        return error;
 }
index 9d057f6..8ed2f0e 100755 (executable)
@@ -869,8 +869,8 @@ void stb_get_rule(HIPC_API a_hAPI)
 
                if(!emipc_add_parameter(a_hAPI, ePARAMETER_OUT, local_rule_stream, size))
                        EM_DEBUG_EXCEPTION("emipc_add_parameter failed  ");
-               EM_SAFE_FREE( local_rule_stream );
 
+               EM_SAFE_FREE( local_rule_stream );
                emcore_free_rule(rule);
                EM_SAFE_FREE(rule);
        }
@@ -1129,6 +1129,7 @@ void stb_add_mail(HIPC_API a_hAPI)
        }
 
        /* attachment */
+       if (result_mail_data.attachment_count > 0) {
        buffer_size = emipc_get_nth_parameter_length(a_hAPI, ePARAMETER_IN, param_index);
        EM_DEBUG_LOG("email_attachment_data_t buffer_size[%d]", buffer_size);
 
@@ -1142,6 +1143,7 @@ void stb_add_mail(HIPC_API a_hAPI)
                        EM_DEBUG_EXCEPTION("em_convert_byte_stream_to_attachment_data failed");
                        err = EMAIL_ERROR_ON_PARSING;
                        goto FINISH_OFF;
+                       }
                }
        }
 
index e6c67e8..71c0bc0 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       email-service
 Summary:    E-mail Framework Middleware package
-Version:    0.10.19
+Version:    0.10.20
 Release:    1
 Group:      System/Libraries
 License:    TBD