Fix Coding Standard Rule 37/64737/1 accepted/tizen_tv accepted/tizen/common/20160418.141408 accepted/tizen/ivi/20160418.012458 accepted/tizen/mobile/20160418.012534 accepted/tizen/tv/20160418.012456 accepted/tizen/wearable/20160418.012454 submit/tizen/20160417.230926
authorintae, jeon <intae.jeon@samsung.com>
Tue, 5 Apr 2016 07:28:11 +0000 (16:28 +0900)
committerintae, jeon <intae.jeon@samsung.com>
Tue, 5 Apr 2016 07:28:11 +0000 (16:28 +0900)
Change-Id: I481184e9f6760d36cc228e51aa0d927076ace39d
Signed-off-by: intae, jeon <intae.jeon@samsung.com>
doc/email_doc.h
include/email.h
include/email_error.h
include/email_private.h
include/email_types.h
src/email.c

index 03c071e..f0c5c78 100755 (executable)
@@ -11,7 +11,7 @@
  * distributed under the License is distributed on an AS IS BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
- * limitations under the License. 
+ * limitations under the License.
  */
 
 
  *
  * @section CAPI_MESSAGING_EMAIL_MODULE_OVERVIEW Overview
  *
- * The @ref CAPI_MESSAGING_EMAIL_MODULE API provides functions that prepare and send email messages. 
- * This API allows email message creation, setting message properties 
+ * The @ref CAPI_MESSAGING_EMAIL_MODULE API provides functions that prepare and send email messages.
+ * This API allows email message creation, setting message properties
  * and sending as well setting up to be notified when the email message has been sent.
  *
  *
  * Email, short for electronic mail, is a method of exchanging digital messages.
- * This API allows you to send email using SMTP. 
+ * This API allows you to send email using SMTP.
  * Simple Mail Transfer Protocol (SMTP) used for sending email via Internet is described in RFC5321/5322 standards.
  *
  * The Email API consists of functions that:
  * - Register/unregister a callback function to be called when the sending process is complete,
  *     whether it is sent successfully or not
  *
- * Email sending is asynchronous and the application should not wait for the result.  
- * Not only may the process be slow (connections to be established and so on), 
+ * Email sending is asynchronous and the application should not wait for the result.
+ * Not only may the process be slow (connections to be established and so on),
  * but even if the mail server is not available a message send may not be a failure, if there is a spooling mechanism.
- * Instead, the callback function is used to receive status. In addition, note that once email_send_message() is called, 
+ * Instead, the callback function is used to receive status. In addition, note that once email_send_message() is called,
  * the message contents are out of the application's hands.
  * Even if the message appears not to have finished sending, it can no longer be modified.
  *
index 5e503ef..0b33981 100755 (executable)
@@ -288,7 +288,7 @@ int email_send_message(email_h email, bool save_to_sentbox);
  * @see email_set_message_sent_cb()
  * @see email_unset_message_sent_cb()
  */
-typedef void (* email_message_sent_cb)(email_h email, email_sending_e result, void *user_data);
+typedef void (*email_message_sent_cb)(email_h email, email_sending_e result, void *user_data);
 
 /**
  * @brief   Registers a callback function to be invoked when an email message is sent.
index 88a5fea..03d3394 100755 (executable)
@@ -11,7 +11,7 @@
  * distributed under the License is distributed on an AS IS BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
- * limitations under the License. 
+ * limitations under the License.
  */
 
 
@@ -39,18 +39,17 @@ extern "C"
  *  @brief    Enumeration for error codes for email API.
  *  @since_tizen 2.3
  */
-typedef enum
-{
-    EMAILS_ERROR_NONE                              = TIZEN_ERROR_NONE,                   /**< Successful */
-    EMAILS_ERROR_OUT_OF_MEMORY                     = TIZEN_ERROR_OUT_OF_MEMORY,          /**< Memory cannot be allocated */
-    EMAILS_ERROR_INVALID_PARAMETER                 = TIZEN_ERROR_INVALID_PARAMETER,      /**< Invalid parameter */
+typedef enum {
+       EMAILS_ERROR_NONE                              = TIZEN_ERROR_NONE,                   /**< Successful */
+       EMAILS_ERROR_OUT_OF_MEMORY                     = TIZEN_ERROR_OUT_OF_MEMORY,          /**< Memory cannot be allocated */
+       EMAILS_ERROR_INVALID_PARAMETER                 = TIZEN_ERROR_INVALID_PARAMETER,      /**< Invalid parameter */
 
-    EMAILS_ERROR_SERVER_NOT_READY                  = TIZEN_ERROR_EMAIL_SERVICE|0x200,    /**< Server not ready */
-    EMAILS_ERROR_COMMUNICATION_WITH_SERVER_FAILED  = TIZEN_ERROR_EMAIL_SERVICE|0x201,    /**< Communication with server failed */
-    EMAILS_ERROR_OPERATION_FAILED                  = TIZEN_ERROR_EMAIL_SERVICE|0x202,    /**< Operation failed */
-    EMAILS_ERROR_ACCOUNT_NOT_FOUND                 = TIZEN_ERROR_EMAIL_SERVICE|0x203,    /**< Email account not found */
-    EMAILS_ERROR_DB_FAILED                         = TIZEN_ERROR_EMAIL_SERVICE|0x204,    /**< Email database failed */
-    EMAILS_ERROR_PERMISSION_DENIED                 = TIZEN_ERROR_PERMISSION_DENIED,      /**< Permission denied */
+       EMAILS_ERROR_SERVER_NOT_READY                  = TIZEN_ERROR_EMAIL_SERVICE|0x200,    /**< Server not ready */
+       EMAILS_ERROR_COMMUNICATION_WITH_SERVER_FAILED  = TIZEN_ERROR_EMAIL_SERVICE|0x201,    /**< Communication with server failed */
+       EMAILS_ERROR_OPERATION_FAILED                  = TIZEN_ERROR_EMAIL_SERVICE|0x202,    /**< Operation failed */
+       EMAILS_ERROR_ACCOUNT_NOT_FOUND                 = TIZEN_ERROR_EMAIL_SERVICE|0x203,    /**< Email account not found */
+       EMAILS_ERROR_DB_FAILED                         = TIZEN_ERROR_EMAIL_SERVICE|0x204,    /**< Email database failed */
+       EMAILS_ERROR_PERMISSION_DENIED                 = TIZEN_ERROR_PERMISSION_DENIED,      /**< Permission denied */
 } email_error_e;
 
 /**
index c4bd56b..755c0c9 100644 (file)
@@ -11,7 +11,7 @@
  * distributed under the License is distributed on an AS IS BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
- * limitations under the License. 
+ * limitations under the License.
  */
 
 
@@ -26,7 +26,7 @@ extern "C"
 
 #define MAX_ATTACHEMENT_COUNT           50
 
-#define MAX_RECIPIENT_ADDRESS_LEN      234
+#define MAX_RECIPIENT_ADDRESS_LEN      234
 
 typedef struct _email_s {
        email_mailbox_t *mbox;
index 337ac34..1062842 100755 (executable)
@@ -11,7 +11,7 @@
  * distributed under the License is distributed on an AS IS BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
- * limitations under the License. 
+ * limitations under the License.
  */
 
 
@@ -47,10 +47,9 @@ typedef struct email_s *email_h;
  * @brief  Enumeration for the result values of email transport.
  * @since_tizen 2.3
  */
-typedef enum
-{
-  EMAIL_SENDING_FAILED = -1,    /**< Email sending failed */
-  EMAIL_SENDING_SUCCEEDED = 0,  /**< Email sending succeeded */
+typedef enum {
+       EMAIL_SENDING_FAILED = -1,    /**< Email sending failed */
+       EMAIL_SENDING_SUCCEEDED = 0,  /**< Email sending succeeded */
 } email_sending_e;
 
 
@@ -58,11 +57,10 @@ typedef enum
  * @brief  Enumeration for the email recipient types.
  * @since_tizen 2.3
  */
-typedef enum
-{
-  EMAIL_RECIPIENT_TYPE_TO = 1, /**< Normal recipient */
-  EMAIL_RECIPIENT_TYPE_CC ,    /**< CC(carbon copy) recipient */
-  EMAIL_RECIPIENT_TYPE_BCC ,   /**< BCC(blind carbon copy) recipient */
+typedef enum {
+       EMAIL_RECIPIENT_TYPE_TO = 1, /**< Normal recipient */
+       EMAIL_RECIPIENT_TYPE_CC ,    /**< CC(carbon copy) recipient */
+       EMAIL_RECIPIENT_TYPE_BCC ,   /**< BCC(blind carbon copy) recipient */
 } email_recipient_type_e;
 
 
index 6f7262c..762c43a 100755 (executable)
@@ -56,7 +56,7 @@ typedef struct {
 GSList *gEmailcbList = NULL;
 
 GDBusConnection* connection = NULL;
-//------------- Utility Or Miscellaneous
+/* Utility Or Miscellaneous */
 void _email_add_dbus_filter(void);
 void _email_remove_dbus_filter(void);
 int _email_error_converter(int err, const char *func, int line);
@@ -65,7 +65,7 @@ void _email_free_cb_context(email_cb_context *cbcontext);
 
 #define CONVERT_ERROR(err) _email_error_converter(err, __FUNCTION__, __LINE__);
 
-//------------------------------------
+
 
 int email_create_message(email_h *msg)
 {
@@ -80,7 +80,7 @@ int email_create_message(email_h *msg)
                return EMAILS_ERROR_INVALID_PARAMETER;
        }
 
-       // 1. create service for ipc
+       /* 1. create service for ipc */
        ret = email_service_begin();
        if (ret != EMAIL_ERROR_NONE && ret != EMAIL_ERROR_IPC_ALREADY_INITIALIZED) {
                SECURE_SLOGE("[%s] email_service_begin failed : [%d]", __FUNCTION__, ret);
@@ -109,8 +109,8 @@ int email_create_message(email_h *msg)
        }
 
 
-       //return error from F/W
-       //EMAILS_ERROR_INVALID_PARAM/EMAIL_ERROR_NONE/EMAILS_ERROR_DB_FAILURE/EMAILS_ERROR_ACCOUNT_NOT_FOUND/EMAILS_ERROR_OUT_OF_MEMORY
+       /* return error from F/W */
+       /* EMAILS_ERROR_INVALID_PARAM/EMAIL_ERROR_NONE/EMAILS_ERROR_DB_FAILURE/EMAILS_ERROR_ACCOUNT_NOT_FOUND/EMAILS_ERROR_OUT_OF_MEMORY */
        int default_account_id = 0;
        if ((ret = email_load_default_account_id(&default_account_id)) != EMAIL_ERROR_NONE) {
                SECURE_SLOGE("[%s] email_load_default_account_id failed : [%d]", __FUNCTION__, ret);
@@ -123,9 +123,9 @@ int email_create_message(email_h *msg)
        ret = email_get_account(default_account_id, GET_FULL_DATA_WITHOUT_PASSWORD, &account);
        if (ret != EMAIL_ERROR_NONE) {
                SECURE_SLOGE("[%s] email_get_account failed : [%d]", __FUNCTION__, ret);
-               if (account) {
+               if (account)
                        email_free_account(&account, 1);
-               }
+
                email_free_mail_data(&msg_s->mail, 1);
                email_free_mailbox(&msg_s->mbox, 1);
                free(msg_s);
@@ -138,7 +138,7 @@ int email_create_message(email_h *msg)
        SECURE_LOGD("account user_name = %s", account->incoming_server_user_name);
 
        len = EM_SAFE_STRLEN(account->incoming_server_user_name) + EM_SAFE_STRLEN(account->user_email_address) + 1 + 1 + 1 + 1 + 1;
-       msg_s->mail->full_address_from = (char *)calloc(1, sizeof(char) * (len));//"++"+<+ address +> + NULL
+       msg_s->mail->full_address_from = (char *)calloc(1, sizeof(char) * (len));/* "++"+<+ address +> + NULL */
        char *strfrom = msg_s->mail->full_address_from;
 
        if (account->incoming_server_user_name)
@@ -146,7 +146,7 @@ int email_create_message(email_h *msg)
        else
                snprintf(strfrom, len, "%s%s%s", "<", account->user_email_address, ">");
 
-       //mbox
+       /* mbox */
        email_mailbox_t *mbox = msg_s->mbox;
 
        if ((ret = email_get_mailbox_by_mailbox_type(default_account_id, EMAIL_MAILBOX_TYPE_OUTBOX, &mbox)) != EMAIL_ERROR_NONE) {
@@ -157,7 +157,7 @@ int email_create_message(email_h *msg)
                return CONVERT_ERROR(ret);
        }
 
-       //info
+       /* info */
        msg_s->mail->account_id = account->account_id;
        msg_s->mail->flags_draft_field = 1;
        msg_s->mail->flags_seen_field = 1;
@@ -298,9 +298,9 @@ int email_add_recipient(email_h msg, email_recipient_type_e type, const char *ad
        char *tmp;
        int total_len, in_len, pre_len, len;
 
-       if (msg == NULL || type < EMAIL_RECIPIENT_TYPE_TO || type > EMAIL_RECIPIENT_TYPE_BCC) {
+       if (msg == NULL || type < EMAIL_RECIPIENT_TYPE_TO || type > EMAIL_RECIPIENT_TYPE_BCC)
                return EMAILS_ERROR_INVALID_PARAMETER;
-       }
+
 
        email_s* msg_s = (email_s*)msg;
 
@@ -312,20 +312,20 @@ int email_add_recipient(email_h msg, email_recipient_type_e type, const char *ad
 
        if (type == EMAIL_RECIPIENT_TYPE_TO) {
                if (msg_s->mail->full_address_to == NULL) {
-                       msg_s->mail->full_address_to = (char *)calloc(1, sizeof(char) * strlen(address) + 2 + 1 + 1);//<>+;+end of string
+                       msg_s->mail->full_address_to = (char *)calloc(1, sizeof(char) * strlen(address) + 2 + 1 + 1);/* <>+;+end of string */
                        if (msg_s->mail->full_address_to == NULL) {
                                SECURE_SLOGE("[%s] OUT_OF_MEMORY(0x%08x) : fail to create head->to.",
                                                        __FUNCTION__, EMAILS_ERROR_OUT_OF_MEMORY);
-                               return EMAILS_ERROR_OUT_OF_MEMORY;
+                               return EMAILS_ERROR_OUT_OF_MEMORY;
                        }
                        len = strlen(address) + 2 + 1 + 1;
                        snprintf(msg_s->mail->full_address_to, len, "%s%s%s", "<", address, ">");
                } else {
                        in_len = strlen(address);
                        pre_len = strlen(msg_s->mail->full_address_to);
-                       total_len = pre_len + in_len + 3 + 1;// length of ",<>" + NULL
+                       total_len = pre_len + in_len + 3 + 1;/* length of ",<>" + NULL */
 
-                       //add new address
+                       /* add new address */
                        tmp = msg_s->mail->full_address_to;
                        msg_s->mail->full_address_to = (char *)calloc(1, sizeof(char) * total_len);
                        snprintf(msg_s->mail->full_address_to, total_len, "%s%s%s%s", tmp, ",<", address, ">");
@@ -333,9 +333,9 @@ int email_add_recipient(email_h msg, email_recipient_type_e type, const char *ad
                }
 
        } else if (type == EMAIL_RECIPIENT_TYPE_CC) {
-               //MESSAGING_RECIPIENT_TYPE_CC
+               /* MESSAGING_RECIPIENT_TYPE_CC */
                if (msg_s->mail->full_address_cc == NULL) {
-                       msg_s->mail->full_address_cc = (char *)calloc(1, sizeof(char) * strlen(address) + 2 + 1 + 1);//<>+;+end of string
+                       msg_s->mail->full_address_cc = (char *)calloc(1, sizeof(char) * strlen(address) + 2 + 1 + 1);/* <>+;+end of string */
                        if (msg_s->mail->full_address_cc == NULL) {
                                SECURE_SLOGE("[%s] OUT_OF_MEMORY(0x%08x) : fail to create head->cc.",
                                                        __FUNCTION__, EMAILS_ERROR_OUT_OF_MEMORY);
@@ -346,18 +346,18 @@ int email_add_recipient(email_h msg, email_recipient_type_e type, const char *ad
                } else {
                        in_len = strlen(address);
                        pre_len = strlen(msg_s->mail->full_address_cc);
-                       total_len = pre_len + in_len + 3 + 1;// length of ",<>" + NULL
+                       total_len = pre_len + in_len + 3 + 1;/* length of ",<>" + NULL */
 
-                       //add new address
+                       /* add new address */
                        tmp = msg_s->mail->full_address_cc;
                        msg_s->mail->full_address_cc = (char *)calloc(1, sizeof(char) * total_len);
                        snprintf(msg_s->mail->full_address_cc, total_len, "%s%s%s%s", tmp, ",<", address, ">");
                        free(tmp);
                }
 
-       } else {//MESSAGING_RECIPIENT_TYPE_BCC
+       } else {/* MESSAGING_RECIPIENT_TYPE_BCC */
                if (msg_s->mail->full_address_bcc == NULL) {
-                       msg_s->mail->full_address_bcc = (char *)calloc(1, sizeof(char) * strlen(address) + 2 + 1 + 1);//<>+;+end of string
+                       msg_s->mail->full_address_bcc = (char *)calloc(1, sizeof(char) * strlen(address) + 2 + 1 + 1);/* <>+;+end of string */
                        if (msg_s->mail->full_address_bcc == NULL) {
                                SECURE_SLOGE("[%s] OUT_OF_MEMORY(0x%08x) : fail to create head->bcc.",
                                                        __FUNCTION__, EMAILS_ERROR_OUT_OF_MEMORY);
@@ -368,9 +368,9 @@ int email_add_recipient(email_h msg, email_recipient_type_e type, const char *ad
                } else {
                        in_len = strlen(address);
                        pre_len = strlen(msg_s->mail->full_address_bcc);
-                       total_len = pre_len+in_len + 3 + 1;// length of ",<>" + NULL
+                       total_len = pre_len+in_len + 3 + 1;/* length of ",<>" + NULL */
 
-                       //add new address
+                       /* add new address */
                        tmp = msg_s->mail->full_address_bcc;
                        msg_s->mail->full_address_bcc = (char *)calloc(1, sizeof(char) * total_len);
                        snprintf(msg_s->mail->full_address_bcc, total_len, "%s%s%s%s", tmp, ",<", address, ">");
@@ -545,9 +545,9 @@ email_cb_context *_email_search_callback_by_emailid(int mailid)
                        break;
 
                cbContext = (email_cb_context *)node->data;
-               if (cbContext->handle->mail->mail_id == mailid) {
+               if (cbContext->handle->mail->mail_id == mailid)
                        return cbContext;
-               }
+
 
                ntmp++;
                count--;
@@ -667,47 +667,47 @@ int _email_error_converter(int err, const char *func, int line)
 {
        LOGD("START\n");
        switch (err) {
-               case EMAIL_ERROR_INVALID_PARAM:
+       case EMAIL_ERROR_INVALID_PARAM:
                        SECURE_SLOGE("[%s:%d] INVALID_PARAM(0x%08x) : Error from Email F/W. ret: (0x%08x) ",
                                                func, line, EMAILS_ERROR_INVALID_PARAMETER, err);
                        return EMAILS_ERROR_INVALID_PARAMETER;
 
-               case EMAIL_ERROR_DB_FAILURE:
+       case EMAIL_ERROR_DB_FAILURE:
                        SECURE_SLOGE("[%s:%d] DB_FAILURE(0x%08x) : Error from Email F/W. ret: (0x%08x) ",
                                                func, line, EMAILS_ERROR_DB_FAILED, err);
                        return EMAILS_ERROR_DB_FAILED;
 
-               case EMAIL_ERROR_ACCOUNT_NOT_FOUND:
+       case EMAIL_ERROR_ACCOUNT_NOT_FOUND:
                        SECURE_SLOGE("[%s:%d] ACCOUNT_NOT_FOUND(0x%08x) : Error from Email F/W. ret: (0x%08x) ",
                                                func, line, EMAILS_ERROR_ACCOUNT_NOT_FOUND, err);
                        return EMAILS_ERROR_ACCOUNT_NOT_FOUND;
 
-               case EMAIL_ERROR_OUT_OF_MEMORY:
+       case EMAIL_ERROR_OUT_OF_MEMORY:
                        SECURE_SLOGE("[%s:%d] OUT_OF_MEMORY(0x%08x) : Error from Email F/W. ret: (0x%08x) ",
                                                func, line, EMAILS_ERROR_OUT_OF_MEMORY, err);
                        return EMAILS_ERROR_OUT_OF_MEMORY;
 
-               // Tizen email F/W  is often using this error type when it gets a null value from server
-               //It could be caused from server or IPC.
-               case EMAIL_ERROR_NULL_VALUE:
+               /* Tizen email F/W  is often using this error type when it gets a null value from server */
+               /* It could be caused from server or IPC. */
+       case EMAIL_ERROR_NULL_VALUE:
                        SECURE_SLOGE("[%s:%d] NULL_VALUE(0x%08x) : Error from Email F/W. ret: (0x%08x) ",
                                                func, line, EMAILS_ERROR_COMMUNICATION_WITH_SERVER_FAILED, err);
                        return EMAILS_ERROR_COMMUNICATION_WITH_SERVER_FAILED;
 
-               case EMAIL_ERROR_IPC_SOCKET_FAILURE:
+       case EMAIL_ERROR_IPC_SOCKET_FAILURE:
                        SECURE_SLOGE("[%s:%d] IPC_SOCKET_FAILURE(0x%08x) : Error from Email F/W. ret: (0x%08x) ",
                                                func, line, EMAILS_ERROR_COMMUNICATION_WITH_SERVER_FAILED, err);
                        return EMAILS_ERROR_COMMUNICATION_WITH_SERVER_FAILED;
 
-               case EMAIL_ERROR_PERMISSION_DENIED:
+       case EMAIL_ERROR_PERMISSION_DENIED:
                        SECURE_SLOGE("[%s:%d] PERMISSION_DENIED(0x%08x) : Error from Email F/W. ret: (0x%08x) ",
                                                func, line, EMAILS_ERROR_PERMISSION_DENIED, err);
                        return EMAILS_ERROR_PERMISSION_DENIED;
 
-               case EMAIL_ERROR_NONE:
+       case EMAIL_ERROR_NONE:
                        return EMAILS_ERROR_NONE;
 
-               default:
+       default:
                        SECURE_SLOGE("[%s:%d] OPERATION_FAILED(0x%08x) : Error from Email F/W. ret: (0x%08x) ",
                                                func, line, EMAILS_ERROR_OPERATION_FAILED, err);
                        return EMAILS_ERROR_OPERATION_FAILED;
@@ -821,9 +821,9 @@ void _email_add_dbus_filter(void)
                                                                                                        _monitorSendStatusCb,
                                                                                                        NULL,
                                                                                                        NULL);
-       if (g_dbus_return_id == -1) {
+       if (g_dbus_return_id == -1)
                LOGE("g_dbus_connection_signal_subscribe failed");
-       }
+
 
        LOGE("END\n");
 }