summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyuho Jo <kyuho.jo@samsung.com>2012-08-21 17:47:09 +0900
committerKyuho Jo <kyuho.jo@samsung.com>2012-08-21 17:47:09 +0900
commit17177361cecd11c1dcf2495826aa1eb2bab0ff3b (patch)
tree9bedf2a9a935be4f7849aef542d625e8f099fd07
parentd408d08c3cb532e391e3344752fb28aa76e7d1ee (diff)
downloademail-17177361cecd11c1dcf2495826aa1eb2bab0ff3b.tar.gz
email-17177361cecd11c1dcf2495826aa1eb2bab0ff3b.tar.bz2
email-17177361cecd11c1dcf2495826aa1eb2bab0ff3b.zip
Init RSA repo.
-rw-r--r--TC/.gitignore3
-rwxr-xr-xTC/_export_env.sh8
-rwxr-xr-xTC/_export_target_env.sh7
-rwxr-xr-xTC/build.sh16
-rwxr-xr-xTC/clean.sh11
-rw-r--r--TC/config3
-rwxr-xr-xTC/config.default2
-rwxr-xr-xTC/execute.sh17
-rwxr-xr-xTC/testcase/Makefile25
-rwxr-xr-xTC/testcase/tslist2
-rwxr-xr-xTC/testcase/utc_messaging_email.c776
-rwxr-xr-xTC/tet_scen7
-rwxr-xr-xTC/tetbuild.cfg5
-rwxr-xr-xTC/tetclean.cfg5
-rwxr-xr-xTC/tetexec.cfg5
-rwxr-xr-xdebian/README0
-rw-r--r--debian/capi-messaging-email-dev.install4
-rw-r--r--debian/capi-messaging-email-dev.postinst1
-rw-r--r--debian/capi-messaging-email.install1
-rw-r--r--debian/capi-messaging-email.postinst1
-rwxr-xr-xdebian/changelog154
-rw-r--r--debian/compat1
-rwxr-xr-xdebian/control22
-rwxr-xr-xdebian/rules68
-rwxr-xr-xinclude/email.h4
-rwxr-xr-xinclude/email_error.h8
-rwxr-xr-xinclude/email_private.h8
-rwxr-xr-x[-rw-r--r--]packaging/capi-messaging-email.spec7
-rwxr-xr-xsrc/email.c322
29 files changed, 1135 insertions, 358 deletions
diff --git a/TC/.gitignore b/TC/.gitignore
new file mode 100644
index 0000000..6f6a5cc
--- /dev/null
+++ b/TC/.gitignore
@@ -0,0 +1,3 @@
+results/
+testcase/tet_captured
+testcase/utc_messaging_email
diff --git a/TC/_export_env.sh b/TC/_export_env.sh
new file mode 100755
index 0000000..72a11ec
--- /dev/null
+++ b/TC/_export_env.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+. ./config
+export TET_INSTALL_PATH=$TET_INSTALL_HOST_PATH # tetware root path
+export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target # tetware target path
+export PATH=$TET_TARGET_PATH/bin:$PATH
+export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
+export TET_ROOT=$TET_TARGET_PATH
diff --git a/TC/_export_target_env.sh b/TC/_export_target_env.sh
new file mode 100755
index 0000000..5ddaa53
--- /dev/null
+++ b/TC/_export_target_env.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+. ./config
+export TET_INSTALL_PATH=$TET_INSTALL_TARGET_PATH # path to path
+export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target
+export PATH=$TET_TARGET_PATH/bin:$PATH
+export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
+export TET_ROOT=$TET_TARGET_PATH
diff --git a/TC/build.sh b/TC/build.sh
new file mode 100755
index 0000000..6be8d56
--- /dev/null
+++ b/TC/build.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+. ./_export_env.sh # setting environment variables
+
+export TET_SUITE_ROOT=`pwd`
+FILE_NAME_EXTENSION=`date +%s`
+
+RESULT_DIR=results
+HTML_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.html
+JOURNAL_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.journal
+
+mkdir -p $RESULT_DIR
+
+tcc -c -p ./
+tcc -b -j $JOURNAL_RESULT -p ./
+grw -c 7 -f chtml -o $HTML_RESULT $JOURNAL_RESULT \ No newline at end of file
diff --git a/TC/clean.sh b/TC/clean.sh
new file mode 100755
index 0000000..29743e0
--- /dev/null
+++ b/TC/clean.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+. ./_export_env.sh # setting environment variables
+
+export TET_SUITE_ROOT=`pwd`
+RESULT_DIR=results
+
+tcc -c -p ./ # executing tcc, with clean option (-c)
+rm -r $RESULT_DIR
+rm -r tet_tmp_dir
+rm testcase/tet_captured
diff --git a/TC/config b/TC/config
new file mode 100644
index 0000000..db0136b
--- /dev/null
+++ b/TC/config
@@ -0,0 +1,3 @@
+TET_INSTALL_HOST_PATH=/home/zzervb/DTS/TETware
+TET_INSTALL_TARGET_PATH=/mnt/nfs/DTS/TETware
+
diff --git a/TC/config.default b/TC/config.default
new file mode 100755
index 0000000..04684f0
--- /dev/null
+++ b/TC/config.default
@@ -0,0 +1,2 @@
+TET_INSTALL_HOST_PATH=/home/rookiejava/dts_tool/TETware
+TET_INSTALL_TARGET_PATH=/mnt/nfs/dts_tool/TETware
diff --git a/TC/execute.sh b/TC/execute.sh
new file mode 100755
index 0000000..215ad6c
--- /dev/null
+++ b/TC/execute.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+. ./_export_target_env.sh # setting environment variables
+
+export TET_SUITE_ROOT=`pwd`
+FILE_NAME_EXTENSION=`date +%s`
+
+RESULT_DIR=results
+HTML_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.html
+JOURNAL_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.journal
+
+mkdir -p $RESULT_DIR
+
+tcc -e -j $JOURNAL_RESULT -p ./
+#grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT
+grw -c 7 -f chtml -o $HTML_RESULT $JOURNAL_RESULT
+
diff --git a/TC/testcase/Makefile b/TC/testcase/Makefile
new file mode 100755
index 0000000..977b55b
--- /dev/null
+++ b/TC/testcase/Makefile
@@ -0,0 +1,25 @@
+CC ?= gcc
+
+C_FILES = $(shell ls *.c)
+
+PKGS = capi-messaging-email dlog glib-2.0
+
+LDFLAGS = `pkg-config --libs $(PKGS)`
+LDFLAGS += $(TET_ROOT)/lib/tet3/tcm_s.o
+LDFLAGS += -L$(TET_ROOT)/lib/tet3 -ltcm_s
+LDFLAGS += -L$(TET_ROOT)/lib/tet3 -lapi_s
+
+CFLAGS = -I. `pkg-config --cflags $(PKGS)`
+CFLAGS += -I$(TET_ROOT)/inc/tet3
+CFLAGS += -Wall
+
+#TARGETS = $(C_FILES:%.c=tc-%)
+TCS := $(shell ls -1 *.c | cut -d. -f1)
+
+all: $(TCS)
+
+%: %.c
+ $(CC) -o $@ $< $(CFLAGS) $(LDFLAGS)
+
+clean:
+ rm -f $(TCS)
diff --git a/TC/testcase/tslist b/TC/testcase/tslist
new file mode 100755
index 0000000..4cdf235
--- /dev/null
+++ b/TC/testcase/tslist
@@ -0,0 +1,2 @@
+/testcase/utc_messaging_email
+
diff --git a/TC/testcase/utc_messaging_email.c b/TC/testcase/utc_messaging_email.c
new file mode 100755
index 0000000..898aa15
--- /dev/null
+++ b/TC/testcase/utc_messaging_email.c
@@ -0,0 +1,776 @@
+#include <tet_api.h>
+#include <messaging/email.h>
+#include <stdlib.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_messaging_email_create_message_p(void);
+//static void utc_messaging_email_create_message_n(void);
+static void utc_messaging_email_destroy_message_p(void);
+static void utc_messaging_email_destroy_message_n(void);
+static void utc_messaging_email_set_subject_p(void);
+static void utc_messaging_email_set_subject_n(void);
+static void utc_messaging_email_set_body_p(void);
+static void utc_messaging_email_set_body_n(void);
+//static void utc_messaging_email_get_body_p(void);
+//static void utc_messaging_email_get_body_n(void);
+static void utc_messaging_email_add_recipient_p(void);
+static void utc_messaging_email_add_recipient_n(void);
+static void utc_messaging_email_remove_all_recipients_p(void);
+static void utc_messaging_email_remove_all_recipients_n(void);
+static void utc_messaging_email_add_attach_p(void);
+static void utc_messaging_email_add_attach_n(void);
+static void utc_messaging_email_remove_all_attachment_p(void);
+static void utc_messaging_email_remove_all_attachment_n(void);
+static void utc_messaging_email_send_message_p(void);
+static void utc_messaging_email_send_message_n(void);
+static void utc_messaging_email_set_message_sent_cb(void);
+static void utc_messaging_email_set_message_sent_cb_n(void);
+static void utc_messaging_email_unset_message_sent_cb(void);
+static void utc_messaging_email_unset_message_sent_cb_n(void);
+
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+
+ { utc_messaging_email_create_message_p, POSITIVE_TC_IDX },
+ //{ utc_messaging_email_create_message_n, NEGATIVE_TC_IDX },
+ { utc_messaging_email_destroy_message_p, POSITIVE_TC_IDX },
+ { utc_messaging_email_destroy_message_n, NEGATIVE_TC_IDX },
+ { utc_messaging_email_set_subject_p, POSITIVE_TC_IDX },
+ { utc_messaging_email_set_subject_n, NEGATIVE_TC_IDX },
+ { utc_messaging_email_set_body_p, POSITIVE_TC_IDX },
+ { utc_messaging_email_set_body_n, NEGATIVE_TC_IDX },
+ //{ utc_messaging_email_get_body_p, POSITIVE_TC_IDX },
+ //{ utc_messaging_email_get_body_n, NEGATIVE_TC_IDX },
+ { utc_messaging_email_add_recipient_p, POSITIVE_TC_IDX },
+ { utc_messaging_email_add_recipient_n, NEGATIVE_TC_IDX },
+ { utc_messaging_email_remove_all_recipients_p, POSITIVE_TC_IDX },
+ { utc_messaging_email_remove_all_recipients_n, NEGATIVE_TC_IDX },
+ { utc_messaging_email_add_attach_p, POSITIVE_TC_IDX },
+ { utc_messaging_email_add_attach_n, NEGATIVE_TC_IDX },
+ { utc_messaging_email_remove_all_attachment_p, POSITIVE_TC_IDX },
+ { utc_messaging_email_remove_all_attachment_n, NEGATIVE_TC_IDX },
+ { utc_messaging_email_send_message_p, POSITIVE_TC_IDX },
+ { utc_messaging_email_send_message_n, NEGATIVE_TC_IDX },
+ { utc_messaging_email_set_message_sent_cb, POSITIVE_TC_IDX },
+ { utc_messaging_email_set_message_sent_cb_n, NEGATIVE_TC_IDX },
+ { utc_messaging_email_unset_message_sent_cb, POSITIVE_TC_IDX },
+ { utc_messaging_email_unset_message_sent_cb_n, NEGATIVE_TC_IDX },
+
+
+ { NULL, 0 },
+};
+
+
+static void startup(void)
+{
+ /* start of TC */
+ tet_printf("\n TC start");
+}
+
+
+static void cleanup(void)
+{
+ /* end of TC */
+ tet_printf("\n TC end");
+}
+
+
+/**
+ * @brief Positive test case of utc_messaging_email_create_message_p()
+ */
+static void utc_messaging_email_create_message_p(void)
+{
+ int ret = EMAIL_ERROR_NONE;
+
+ email_h msg;
+ // Invalid parameter test
+ ret = email_create_message(&msg);
+
+ if(ret == EMAIL_ERROR_NONE) {
+ dts_pass("email_create_message");
+ }
+ else {
+ dts_message("email_create_message", "email_create_message ret : %d", ret);
+ dts_fail("email_create_message");
+ }
+}
+
+
+/**
+ * @brief Positive test case of utc_messaging_email_destroy_message_p()
+ */
+static void utc_messaging_email_destroy_message_p(void)
+{
+ int ret = EMAIL_ERROR_NONE;
+
+ email_h msg;
+ // Invalid parameter test
+ ret = email_create_message(&msg);
+
+ if(ret != EMAIL_ERROR_NONE)
+ {
+ dts_message("email_create_message", "email_create_message ret : %d", ret);
+ dts_fail("email_create_message");
+ }
+
+
+ ret=email_destroy_message(msg);
+
+ if(ret == EMAIL_ERROR_NONE) {
+ dts_pass("email_destroy_message");
+ }
+ else {
+ dts_message("email_destroy_message", "email_destroy_message ret : %d", ret);
+ dts_fail("email_destroy_message");
+ }
+}
+
+
+/**
+ * @brief Negative test case of telephony_get_cell_id()
+ */
+static void utc_messaging_email_destroy_message_n(void)
+{
+
+
+ int ret = EMAIL_ERROR_NONE;
+
+
+ ret=email_destroy_message(NULL);
+
+ if(ret == EMAIL_ERROR_INVALID_PARAMETER) {
+ dts_pass("email_destroy_message");
+ }
+ else {
+ dts_message("email_destroy_message", "email_destroy_message ret : %d", ret);
+ dts_fail("email_destroy_message");
+ }
+
+}
+
+/**
+ * @brief Positive test case of telephony_get_cell_id()
+ */
+static void utc_messaging_email_set_subject_p(void)
+{
+ int ret = EMAIL_ERROR_NONE;
+
+ email_h msg;
+ // Invalid parameter test
+ ret = email_create_message(&msg);
+
+ if(ret != EMAIL_ERROR_NONE)
+ {
+ dts_message("email_create_message", "email_create_message ret : %d", ret);
+ dts_fail("email_create_message");
+ }
+
+ ret=email_set_subject(msg,"titel: First email!!!");
+
+
+ if(ret == EMAIL_ERROR_NONE) {
+ dts_pass("email_set_subject");
+ }
+ else {
+ dts_message("email_set_subject", "email_set_subject ret : %d", ret);
+ dts_fail("email_set_subject");
+ }
+
+}
+
+
+/**
+ * @brief Negative test case of telephony_get_cell_id()
+ */
+static void utc_messaging_email_set_subject_n(void)
+{
+
+
+ int ret = EMAIL_ERROR_NONE;
+
+ ret=email_set_subject(NULL,"titel: First email!!!");
+
+
+ if(ret == EMAIL_ERROR_INVALID_PARAMETER) {
+ dts_pass("email_set_subject");
+ }
+ else {
+ dts_message("email_set_subject", "email_set_subject ret : %d", ret);
+ dts_fail("email_set_subject");
+ }
+
+}
+
+/**
+ * @brief Positive test case of telephony_get_cell_id()
+ */
+static void utc_messaging_email_set_body_p(void)
+{
+ int ret = EMAIL_ERROR_NONE;
+
+ email_h msg;
+ // Invalid parameter test
+ ret = email_create_message(&msg);
+
+ if(ret != EMAIL_ERROR_NONE)
+ {
+ dts_message("email_create_message", "email_create_message ret : %d", ret);
+ dts_fail("email_create_message");
+ }
+
+ ret=email_set_body(msg,"First SMS message!!!");
+
+
+ if(ret == EMAIL_ERROR_NONE) {
+ dts_pass("email_set_body");
+ }
+ else {
+ dts_message("email_set_body", "email_set_body ret : %d", ret);
+ dts_fail("email_set_body");
+ }
+
+}
+
+
+/**
+ * @brief Negative test case of telephony_get_cell_id()
+ */
+static void utc_messaging_email_set_body_n(void)
+{
+
+
+ int ret = EMAIL_ERROR_NONE;
+
+ ret=email_set_body(NULL,"First SMS message!!!");
+
+
+ if(ret == EMAIL_ERROR_INVALID_PARAMETER) {
+ dts_pass("email_set_body");
+ }
+ else {
+ dts_message("email_set_body", "email_set_body ret : %d", ret);
+ dts_fail("email_set_body");
+ }
+
+}
+#if 0
+/**
+ * @brief Positive test case of telephony_get_cell_id()
+ */
+static void utc_messaging_email_get_body_p(void)
+{
+ int ret = EMAIL_ERROR_NONE;
+ email_h msg;
+ const char *str;
+
+ ret =email_create_message(&msg);
+
+ if(ret != EMAIL_ERROR_NONE)
+ {
+ dts_message("email_create_message", "email_create_message ret : %d", ret);
+ dts_fail("email_create_message");
+ }
+
+ ret=email_set_body(msg,"First SMS message!!!");
+
+ if(ret != EMAIL_ERROR_NONE)
+ {
+ dts_message("email_set_body", "email_set_body ret : %d", ret);
+ dts_fail("email_set_body");
+ }
+
+ ret=email_get_body(msg,str);
+
+
+ if(ret == EMAIL_ERROR_NONE) {
+ dts_pass("email_get_body");
+ }
+ else {
+ dts_message("email_get_body", "email_get_body ret : %d", ret);
+ dts_fail("email_get_body");
+ }
+
+
+}
+
+
+/**
+ * @brief Negative test case of telephony_get_cell_id()
+ */
+static void utc_messaging_email_get_body_n(void)
+{
+
+
+ int ret = EMAIL_ERROR_NONE;
+ const char *str;
+ ret=email_get_body(NULL,str);
+
+
+
+ if(ret == EMAIL_ERROR_INVALID_PARAMETER) {
+ dts_pass("email_get_body");
+ }
+ else {
+ dts_message("email_get_body", "email_get_body ret : %d", ret);
+ dts_fail("email_get_body");
+ }
+
+}
+
+#endif
+
+/**
+ * @brief Positive test case of telephony_get_cell_id()
+ */
+static void utc_messaging_email_add_recipient_p(void)
+{
+
+ int ret = EMAIL_ERROR_NONE;
+ email_h msg;
+
+
+ ret =email_create_message(&msg);
+
+ if(ret != EMAIL_ERROR_NONE)
+ {
+ dts_message("email_create_message", "email_create_message ret : %d", ret);
+ dts_fail("email_create_message");
+ }
+ ret=email_add_recipient(msg,EMAIL_RECIPIENT_TYPE_TO,"qqaappp@gmail.com");
+
+ if(ret == EMAIL_ERROR_NONE) {
+ dts_pass("email_add_recipien");
+ }
+ else {
+ dts_message("email_add_recipien", "email_add_recipien ret : %d", ret);
+ dts_fail("email_add_recipien");
+ }
+}
+
+
+/**
+ * @brief Negative test case of telephony_get_cell_id()
+ */
+static void utc_messaging_email_add_recipient_n(void)
+{
+
+ email_h msg;
+ int ret = EMAIL_ERROR_NONE;
+ ret=email_add_recipient(msg,EMAIL_RECIPIENT_TYPE_TO,"qqaappp@gmail.com");
+
+ if(ret == EMAIL_ERROR_INVALID_PARAMETER) {
+ dts_pass("email_add_recipien");
+ }
+ else {
+ dts_message("email_add_recipien", "email_add_recipien ret : %d", ret);
+ dts_fail("email_add_recipien");
+ }
+
+
+}
+
+/**
+ * @brief Positive test case of telephony_get_cell_id()
+ */
+ //TODO: need to do multiple test
+static void utc_messaging_email_remove_all_recipients_p(void)
+{
+ int ret = EMAIL_ERROR_NONE;
+
+ email_h msg;
+
+
+ ret =email_create_message(&msg);
+
+ if(ret != EMAIL_ERROR_NONE)
+ {
+ dts_message("email_create_message", "email_create_message ret : %d", ret);
+ dts_fail("email_create_message");
+ }
+ ret=email_add_recipient(msg,EMAIL_RECIPIENT_TYPE_TO,"qqaappp@gmail.com");
+
+ if(ret != EMAIL_ERROR_NONE)
+ {
+ dts_message("email_add_recipien", "email_add_recipien ret : %d", ret);
+ dts_fail("email_add_recipien");
+ }
+
+ ret=email_remove_all_recipients(msg);
+
+ if(ret == EMAIL_ERROR_NONE) {
+ dts_pass("email_remove_all_recipients");
+ }
+ else {
+ dts_message("email_remove_all_recipients", "email_remove_all_recipients ret : %d", ret);
+ dts_fail("email_remove_all_recipients");
+ }
+
+}
+
+
+/**
+ * @brief Negative test case of telephony_get_cell_id()
+ */
+static void utc_messaging_email_remove_all_recipients_n(void)
+{
+
+
+ int ret = EMAIL_ERROR_NONE;
+
+ ret=email_remove_all_recipients(NULL);
+
+ if(ret == EMAIL_ERROR_INVALID_PARAMETER) {
+ dts_pass("email_remove_all_recipients");
+ }
+ else {
+ dts_message("email_remove_all_recipients", "email_remove_all_recipients ret : %d", ret);
+ dts_fail("email_remove_all_recipients");
+ }
+
+
+}
+
+
+/**
+ * @brief Positive test case of telephony_get_cell_id()
+ */
+ //TODO: need to do multiple test
+static void utc_messaging_email_add_attach_p(void)
+{
+ int ret = EMAIL_ERROR_NONE;
+
+ email_h msg;
+
+ FILE* file = NULL;
+
+
+ file= fopen("/tmp/emaildtstest_.txt", "w");
+ if(file ==NULL)
+ {
+ dts_message("email_add_attach", "temporary file for test(/tmp/emaildtstest_.txt) is not created");
+ dts_fail("email_add_attach");
+ }
+ else
+ {
+ fclose(file);
+ }
+ ret =email_create_message(&msg);
+
+ if(ret != EMAIL_ERROR_NONE)
+ {
+ dts_message("email_create_message", "email_create_message ret : %d", ret);
+ dts_fail("email_create_message");
+ }
+
+ ret=email_add_attach(msg,"/tmp/emaildtstest_.txt");
+
+ if(ret == EMAIL_ERROR_NONE) {
+ dts_pass("email_add_attach");
+ }
+ else {
+ dts_message("email_add_attach", "email_add_attach ret : %d", ret);
+ dts_fail("email_add_attach");
+ }
+
+}
+
+
+/**
+ * @brief Negative test case of telephony_get_cell_id()
+ */
+static void utc_messaging_email_add_attach_n(void)
+{
+
+
+ int ret = EMAIL_ERROR_NONE;
+
+ ret=email_add_attach(NULL,NULL);
+
+ if(ret == EMAIL_ERROR_INVALID_PARAMETER) {
+ dts_pass("email_add_attach");
+ }
+ else {
+ dts_message("email_add_attach", "email_add_attach ret : %d", ret);
+ dts_fail("email_add_attach");
+ }
+
+
+}
+
+/**
+ * @brief Positive test case of telephony_get_cell_id()
+ */
+ //TODO: need to do multiple test
+static void utc_messaging_email_remove_all_attachment_p(void)
+{
+ int ret = EMAIL_ERROR_NONE;
+
+ email_h msg;
+
+ FILE* file = NULL;
+
+
+ file= fopen("/tmp/emaildtstest_.txt", "w");
+ if(file ==NULL)
+ {
+ dts_message("email_add_attach", "temporary file for test(/tmp/emaildtstest_.txt) is not created");
+ dts_fail("email_add_attach");
+ }
+ else
+ {
+ fclose(file);
+ }
+ ret =email_create_message(&msg);
+
+ if(ret != EMAIL_ERROR_NONE)
+ {
+ dts_message("email_create_message", "email_create_message ret : %d", ret);
+ dts_fail("email_create_message");
+ }
+
+ ret=email_add_attach(msg,"/tmp/emaildtstest_.txt");
+
+ if(ret != EMAIL_ERROR_NONE)
+ {
+ dts_message("email_add_attach", "email_add_attach ret : %d", ret);
+ dts_fail("email_add_attach");
+ }
+
+ ret=email_remove_all_attachments(msg);
+
+ if(ret == EMAIL_ERROR_NONE) {
+ dts_pass("email_remove_all_attachment");
+ }
+ else {
+ dts_message("email_remove_all_attachment", "email_remove_all_attachment ret : %d", ret);
+ dts_fail("email_remove_all_attachment");
+ }
+
+}
+
+
+/**
+ * @brief Negative test case of telephony_get_cell_id()
+ */
+static void utc_messaging_email_remove_all_attachment_n(void)
+{
+
+ email_h msg;
+ int ret = EMAIL_ERROR_NONE;
+
+ ret =email_create_message(&msg);
+
+ if(ret != EMAIL_ERROR_NONE)
+ {
+ dts_message("email_create_message", "email_create_message ret : %d", ret);
+ dts_fail("email_create_message");
+ }
+
+ ret=email_remove_all_attachments(msg);
+
+ if(ret == EMAIL_ERROR_NONE) {
+ dts_pass("email_remove_all_attachment");
+ }
+ else {
+ dts_message("email_remove_all_attachment", "email_remove_all_attachment ret : %d", ret);
+ dts_fail("email_remove_all_attachment");
+ }
+
+
+}
+/**
+ * @brief Positive test case of telephony_get_cell_id()
+ */
+static void utc_messaging_email_send_message_p(void)
+{
+ int ret = EMAIL_ERROR_NONE;
+ email_h msg;
+
+
+ ret =email_create_message(&msg);
+
+ if(ret != EMAIL_ERROR_NONE)
+ {
+ dts_message("email_create_message", "email_create_message ret : %d", ret);
+ dts_fail("email_create_message");
+ }
+ ret=email_add_recipient(msg,EMAIL_RECIPIENT_TYPE_TO,"qqaappp@gmail.com");
+
+ if(ret != EMAIL_ERROR_NONE)
+ {
+ dts_message("email_add_recipient", "email_add_recipient ret : %d", ret);
+ dts_fail("email_add_recipient");
+ }
+
+ ret=email_set_body(msg,"First SMS message!!!");
+
+
+ if(ret == EMAIL_ERROR_NONE) {
+ dts_pass("email_set_body");
+ }
+ else {
+ dts_message("email_set_body", "email_set_body ret : %d", ret);
+ dts_fail("email_set_body");
+ }
+
+
+ ret=email_send_message(msg, false);
+
+ if(ret == EMAIL_ERROR_NONE) {
+ dts_pass("email_send_message");
+ }
+ else {
+ dts_message("email_send_message", "email_send_message ret : %d", ret);
+ dts_fail("email_send_message");
+ }
+
+}
+
+
+/**
+ * @brief Negative test case of telephony_get_cell_id()
+ */
+ //TODO: add the case where one of what shold be set is missing
+ // for example, recipient ,attachment or body is not set.
+static void utc_messaging_email_send_message_n(void)
+{
+ int ret = EMAIL_ERROR_NONE;
+
+ ret=email_send_message(NULL, false);
+
+ if(ret == EMAIL_ERROR_INVALID_PARAMETER) {
+ dts_pass("email_send_message");
+ }
+ else {
+ dts_message("email_send_message", "email_send_message ret : %d", ret);
+ dts_fail("email_send_message");
+ }
+
+}
+
+/**
+ * @brief Positive test case of telephony_get_cell_id()
+ */
+
+void email_cb(email_h handle, email_sending_e result, void *user_data)
+{
+ printf("CALLBACK EXECUTED\n");
+ printf("transport status = %d\n", result);
+
+
+}
+static void utc_messaging_email_set_message_sent_cb(void)
+{
+ int ret = EMAIL_ERROR_NONE;
+ email_h msg;
+
+
+ ret =email_create_message(&msg);
+
+ if(ret != EMAIL_ERROR_NONE)
+ {
+ dts_message("email_create_message", "email_create_message ret : %d", ret);
+ dts_fail("email_create_message");
+ }
+
+ ret=email_set_message_sent_cb(msg,email_cb,NULL);
+
+ if(ret == EMAIL_ERROR_NONE) {
+ dts_pass("email_set_message_sent_cb");
+ }
+ else {
+ dts_message("email_set_message_sent_cb", "email_set_message_sent_cb ret : %d", ret);
+ dts_fail("email_set_message_sent_cb");
+ }
+}
+
+
+/**
+ * @brief Negative test case of telephony_get_cell_id()
+ */
+static void utc_messaging_email_set_message_sent_cb_n(void)
+{
+
+
+ int ret = EMAIL_ERROR_NONE;
+
+ ret=email_set_message_sent_cb(NULL,NULL,NULL);
+
+ if(ret == EMAIL_ERROR_INVALID_PARAMETER) {
+ dts_pass("email_set_message_sent_cb");
+ }
+ else {
+ dts_message("email_set_message_sent_cb", "email_set_message_sent_cb ret : %d", ret);
+ dts_fail("email_set_message_sent_cb");
+ }
+
+}
+
+/**
+ * @brief Positive test case of telephony_get_cell_id()
+ */
+static void utc_messaging_email_unset_message_sent_cb(void)
+{
+ int ret = EMAIL_ERROR_NONE;
+ email_h msg;
+
+
+ ret =email_create_message(&msg);
+
+ if(ret != EMAIL_ERROR_NONE)
+ {
+ dts_message("email_create_message", "email_create_message ret : %d", ret);
+ dts_fail("email_create_message");
+ }
+
+ ret=email_set_message_sent_cb(msg,email_cb,NULL);
+ if(ret != EMAIL_ERROR_NONE)
+ {
+ dts_message("email_set_message_sent_cb", "email_set_message_sent_cb ret : %d", ret);
+ dts_fail("email_set_message_sent_cb");
+ }
+
+ ret=email_unset_message_sent_cb(msg );
+
+ if(ret == EMAIL_ERROR_NONE) {
+ dts_pass("email_set_message_sent_cb");
+ }
+ else {
+ dts_message("email_unset_message_sent_cb", "email_unset_message_sent_cb ret : %d", ret);
+ dts_fail("email_unset_message_sent_cb");
+ }
+}
+
+
+/**
+ * @brief Negative test case of telephony_get_cell_id()
+ */
+static void utc_messaging_email_unset_message_sent_cb_n(void)
+{
+
+
+ int ret = EMAIL_ERROR_NONE;
+ ret=email_unset_message_sent_cb(NULL );
+
+ if(ret == EMAIL_ERROR_INVALID_PARAMETER) {
+ dts_pass("email_unset_message_sent_cb");
+ }
+ else {
+ dts_message("email_unset_message_sent_cb", "email_unset_message_sent_cb ret : %d", ret);
+ dts_fail("email_unset_message_sent_cb");
+ }
+
+
+}
+
diff --git a/TC/tet_scen b/TC/tet_scen
new file mode 100755
index 0000000..03f029a
--- /dev/null
+++ b/TC/tet_scen
@@ -0,0 +1,7 @@
+all
+ ^TEST
+##### Scenarios for TEST #####
+
+# Test scenario
+TEST
+ :include:/testcase/tslist
diff --git a/TC/tetbuild.cfg b/TC/tetbuild.cfg
new file mode 100755
index 0000000..f7eda55
--- /dev/null
+++ b/TC/tetbuild.cfg
@@ -0,0 +1,5 @@
+TET_OUTPUT_CAPTURE=True # capture option for build operation checking
+TET_BUILD_TOOL=make # build with using make command
+TET_BUILD_FILE=-f Makefile # execution file (Makefile) for build
+TET_API_COMPLIANT=True # use TET API in Test Case ?
+TET_PASS_TC_NAME=True # report passed TC name in Journal file?
diff --git a/TC/tetclean.cfg b/TC/tetclean.cfg
new file mode 100755
index 0000000..02d7030
--- /dev/null
+++ b/TC/tetclean.cfg
@@ -0,0 +1,5 @@
+TET_OUTPUT_CAPTURE=True # capture option
+TET_CLEAN_TOOL= make clean # clean tool
+TET_CLEAN_FILE= Makefile # file for clean
+TET_API_COMPLIANT=True # TET API useage
+TET_PASS_TC_NAME=True # showing name , passed TC
diff --git a/TC/tetexec.cfg b/TC/tetexec.cfg
new file mode 100755
index 0000000..ef3e452
--- /dev/null
+++ b/TC/tetexec.cfg
@@ -0,0 +1,5 @@
+TET_OUTPUT_CAPTURE=True # capturing execution or not
+TET_EXEC_TOOL= # ex) exec : execution tool set up/ Optional
+TET_EXEC_FILE= # ex) exectool : execution file/ Optional
+TET_API_COMPLIANT=True # Test case or Tool usesTET API?
+TET_PASS_TC_NAME=True # showing Passed TC name ?
diff --git a/debian/README b/debian/README
deleted file mode 100755
index e69de29..0000000
--- a/debian/README
+++ /dev/null
diff --git a/debian/capi-messaging-email-dev.install b/debian/capi-messaging-email-dev.install
deleted file mode 100644
index 761a28b..0000000
--- a/debian/capi-messaging-email-dev.install
+++ /dev/null
@@ -1,4 +0,0 @@
-/usr/include/*
-/usr/include/*/*
-/usr/lib/pkgconfig/*.pc
-
diff --git a/debian/capi-messaging-email-dev.postinst b/debian/capi-messaging-email-dev.postinst
deleted file mode 100644
index 1a24852..0000000
--- a/debian/capi-messaging-email-dev.postinst
+++ /dev/null
@@ -1 +0,0 @@
-#!/bin/sh
diff --git a/debian/capi-messaging-email.install b/debian/capi-messaging-email.install
deleted file mode 100644
index 4a755a4..0000000
--- a/debian/capi-messaging-email.install
+++ /dev/null
@@ -1 +0,0 @@
-/usr/lib/lib*.so*
diff --git a/debian/capi-messaging-email.postinst b/debian/capi-messaging-email.postinst
deleted file mode 100644
index 1a24852..0000000
--- a/debian/capi-messaging-email.postinst
+++ /dev/null
@@ -1 +0,0 @@
-#!/bin/sh
diff --git a/debian/changelog b/debian/changelog
deleted file mode 100755
index 65cc4e6..0000000
--- a/debian/changelog
+++ /dev/null
@@ -1,154 +0,0 @@
-capi-messaging-email (0.1.1-2) unstable; urgency=low
-
- * Fix to check the filepath in email_add_attach().
- * Git: slp/api/email
- * Tag: capi-messaging-email_0.1.1-2
-
- -- WonYoung Choi <wy80.choi@samsung.com> Fri, 13 Apr 2012 15:38:47 +0900
-
-capi-messaging-email (0.1.1-1) unstable; urgency=low
-
- * Changes for modified email-service API.
- * Git: slp/api/email
- * Tag: capi-messaging-email_0.1.1-1
-
- -- Kyuho Jo <kyuho.jo@samsung.com> Wed, 21 Mar 2012 14:39:33 +0900
-
-capi-messaging-email (0.1.0-12) unstable; urgency=low
-
- * Bugs fix of email_add_attach(), email_remove_all_attachments(), email_add_recipient()
- * Git: slp/api/email
- * Tag: capi-messaging-email_0.1.0-12
-
- -- WonYoung Choi <wy80.choi@samsung.com> Thu, 08 Mar 2012 22:40:36 +0900
-
-capi-messaging-email (0.1.0-11) unstable; urgency=low
-
- * Remove -Werror option to avoid a build-break temporary.
- * Git: slp/api/email
- * Tag: capi-messaging-email_0.1.0-11
-
- -- WonYoung Choi <wy80.choi@samsung.com> Tue, 06 Mar 2012 11:54:01 +0900
-
-capi-messaging-email (0.1.0-10) unstable; urgency=low
-
- * fix a bug of email_add_attach()
- * Git: slp/api/email
- * Tag: capi-messaging-email_0.1.0-10
-
- -- WonYoung Choi <wy80.choi@samsung.com> Thu, 23 Feb 2012 17:38:09 +0900
-
-capi-messaging-email (0.1.0-9) unstable; urgency=low
-
- * modify error and description
- * Git: slp/api/email
- * Tag: capi-messaging-email_0.1.0-9
-
- -- Jongchul Park <jc0204.park@samsung.com> Thu, 22 Dec 2011 18:45:02 +0900
-
-capi-messaging-email (0.1.0-7) unstable; urgency=low
-
- * modify error and description
- * Git: slp/api/email
- * Tag: capi-messaging-email_0.1.0-7
-
- -- Jongchul Park <jc0204.park@samsung.com> Thu, 22 Dec 2011 17:54:16 +0900
-
-
-capi-messaging-email (0.1.0-6) unstable; urgency=low
-
- * change error
- * Git: slp/api/email
- * Tag: capi-messaging-email_0.1.0-6
-
- -- Jongchul Park <jc0204.park@samsung.com> Mon, 05 Dec 2011 14:42:19 +0900
-
-capi-messaging-email (0.1.0-5) unstable; urgency=low
-
- * change naming: Tizen
- * Git: slp-source.sec.samsung.net:slp/api/email
- * Tag: capi-messaging-email_0.1.0-5
-
- -- Jongchul Park <jc0204.park@samsung.com> Wed, 23 Nov 2011 20:40:40 +0900
-
-capi-messaging-email (0.1.0-4) unstable; urgency=low
-
- * fix SVAC warning
- * Git: slp-source.sec.samsung.net:slp/api/email
- * Tag: capi-messaging-email_0.1.0-4
-
- -- Jongchul Park <jc0204.park@samsung.com> Sat, 08 Oct 2011 22:49:51 -0400
-
-capi-messaging-email (0.1.0-3) unstable; urgency=low
-
- * Add error
- * Git: slp-source.sec.samsung.net:slp/api/email
- * Tag: capi-messaging-email_0.1.0-3
-
- -- Jongchul Park <jc0204.park@samsung.com> Thu, 06 Oct 2011 03:35:46 -0400
-
-capi-messaging-email (0.1.0-2) unstable; urgency=low
-
- * Alpha Release
- * Git: slp-source.sec.samsung.net:slp/api/email
- * Tag: capi-messaging-email_0.1.0-2
-
- -- Jongchul Park <jc0204.park@samsung.com> Tue, 27 Sep 2011 10:02:25 -0400
-
-capi-messaging-email (0.1.0-1) unstable; urgency=low
-
- * release 0.1.0-1
- * Git: slp-source.sec.samsung.net:slp/api/email
- * Tag: capi-messaging-email_0.1.0-1
-
- -- Jongchul Park <jc0204.park@samsung.com> Tue, 27 Sep 2011 05:59:18 -0400
-
-capi-messaging-email (0.0.1-6) unstable; urgency=low
-
- * remove callback error
- * Git: slp-source.sec.samsung.net:slp/api/email
- * Tag: capi-messaging-email_0.0.1-6
-
-
- -- Jongchul Park <jc0204.park@samsung.com> Mon, 26 Sep 2011 03:00:03 -0400
-
-capi-messaging-email (0.0.1-5) unstable; urgency=low
-
- * modify unset callback function parameter
- * Git: slp-source.sec.samsung.net:slp/api/email
- * Tag: capi-messaging-email_0.0.1-5
-
- -- Jongchul Park <jc0204.park@samsung.com> Tue, 20 Sep 2011 01:42:48 -0400
-
-capi-messaging-email (0.0.1-4) unstable; urgency=low
-
- * modify parameter and update description
- * Git: slp-source.sec.samsung.net:slp/api/email
- * Tag: capi-messaging-email_0.0.1-4
-
- -- Jongchul Park <jc0204.park@samsung.com> Mon, 05 Sep 2011 02:35:51 -0400
-
-capi-messaging-email (0.0.1-3) unstable; urgency=low
-
- * modify description with new prefix EMAIL
- * Git: slp-source.sec.samsung.net:slp/api/email
- * Tag: capi-messaging-email_0.0.1-3
-
- -- Jongchul Park <jc0204.park@samsung.com> Mon, 22 Aug 2011 06:43:29 -0400
-
-capi-messaging-email (0.0.1-2) unstable; urgency=low
-
- * messaging enums -> MMS enums : naming change
- * Git: slp-source.sec.samsung.net:slp/api/email
- * Tag: capi-messaging-email_0.0.1-2
-
- -- Jongchul Park <jc0204.park@samsung.com> Thu, 11 Aug 2011 06:40:54 -0400
-
-capi-messaging-email (0.0.1-1) unstable; urgency=low
-
- * Initial upload
- * Git: slp-source.sec.samsung.net:slp/api/email
- * Tag: capi-messaging-email_0.0.1-1
-
- -- Jongchul Park <jc0204.park@samsung.com> Thu, 04 Aug 2011 14:09:17 +0900
-
diff --git a/debian/compat b/debian/compat
deleted file mode 100644
index 7ed6ff8..0000000
--- a/debian/compat
+++ /dev/null
@@ -1 +0,0 @@
-5
diff --git a/debian/control b/debian/control
deleted file mode 100755
index c028234..0000000
--- a/debian/control
+++ /dev/null
@@ -1,22 +0,0 @@
-
-Source: capi-messaging-email
-Section: libs
-Priority: extra
-Maintainer: WonYoung Choi <wy80.choi@samsung.com>
-Build-Depends: debhelper (>= 5), dlog-dev,libglib2.0-dev , libedbus-dev, capi-appfw-application-dev ,capi-base-common-dev, email-service-dev
-
-Package: capi-messaging-email
-Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: Email library in Tizen Native API
-
-Package: capi-messaging-email-dev
-Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, capi-messaging-email (= ${Source-Version}) , dlog-dev,libglib2.0-dev , libedbus-dev,capi-appfw-application-dev ,capi-base-common-dev, email-service-dev
-Description: Email library in Tizen Native API (DEV)
-
-Package: capi-messaging-email-dbg
-Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, capi-messaging-email (= ${Source-Version})
-Description: Email library in Tizen Native API (DBG)
-
diff --git a/debian/rules b/debian/rules
deleted file mode 100755
index 42a97c1..0000000
--- a/debian/rules
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/usr/bin/make -f
-
-CFLAGS = -Wall -g
-
-FULLVER ?= $(shell dpkg-parsechangelog | grep Version: | cut -d ' ' -f 2 | cut -d '-' -f 1)
-MAJORVER ?= $(shell echo $(FULLVER) | cut -d '.' -f 1)
-
-ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
- CFLAGS += -O0
-else
- CFLAGS += -O2
-endif
-CMAKE_ROOT_DIR ?= $(CURDIR)
-CMAKE_BUILD_DIR ?= $(CURDIR)/cmake_build_tmp
-
-configure: configure-stamp
-configure-stamp:
- dh_testdir
- mkdir -p $(CMAKE_BUILD_DIR) && cd $(CMAKE_BUILD_DIR) && cmake .. -DFULLVER=${FULLVER} -DMAJORVER=${MAJORVER}
- touch configure-stamp
-
-
-build: build-stamp
-build-stamp: configure-stamp
- dh_testdir
- cd $(CMAKE_BUILD_DIR) && $(MAKE)
- touch $@
-
-clean:
- cd $(CMAKE_ROOT_DIR)
- dh_testdir
- dh_testroot
- rm -f build-stamp configure-stamp
- rm -f `find . -name *.pc`
- rm -rf $(CMAKE_BUILD_DIR)
- dh_clean
-
-install: build
- dh_testdir
- dh_testroot
- dh_clean -k
- dh_installdirs
-
- cd $(CMAKE_BUILD_DIR) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
-
-binary-indep: build install
-
-binary-arch: build install
- dh_testdir
- dh_testroot
- dh_installchangelogs
- dh_installdocs
- dh_installexamples
- dh_install --sourcedir=debian/tmp
- dh_installman
- dh_link
- dh_strip --dbg-package=capi-messaging-email-dbg
- dh_fixperms
- dh_makeshlibs
- dh_installdeb
- dh_shlibdeps
- dh_gencontrol
- dh_md5sums
- dh_builddeb
-
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install configure
-
diff --git a/include/email.h b/include/email.h
index b254111..52a84c7 100755
--- a/include/email.h
+++ b/include/email.h
@@ -103,7 +103,6 @@ int email_set_body(email_h email, const char *body);
*
* @remarks Email address should be in standard format (as described in
* Internet standards RFC 5321 and RFC 5322).\n
- * The maximum number of recipients per message is 10.
*
* @param[in] email The handle to the email message
* @param[in] type The recipient type
@@ -173,6 +172,7 @@ int email_remove_all_attachments(email_h email);
*
*
* @param[in] email The handle to the email message
+ * @param[in] save_to_sentbox Set to true to save the message in the sentbox, else false
* @return 0 on success, otherwise a negative error value.
* @retval #EMAIL_ERROR_NONE Successful
* @retval #EMAIL_ERROR_COMMUNICATION_WITH_SERVER_FAILED Communication with server failed.
@@ -182,7 +182,7 @@ int email_remove_all_attachments(email_h email);
* @see email_set_message_sent_cb()
* @see email_add_recipient()
*/
-int email_send_message(email_h email);
+int email_send_message(email_h email, bool save_to_sentbox);
/**
diff --git a/include/email_error.h b/include/email_error.h
index b14a6fb..e7d4e5e 100755
--- a/include/email_error.h
+++ b/include/email_error.h
@@ -15,8 +15,8 @@
*/
-#ifndef __EMAIL_ERROR_H__
-#define __EMAIL_ERROR_H__
+#ifndef __EMAILAPI_ERROR_H__
+#define __EMAILAPI_ERROR_H__
#include <tizen.h>
@@ -50,8 +50,6 @@ typedef enum
EMAIL_ERROR_OPERATION_FAILED = TIZEN_ERROR_MESSAGING_CLASS|0x202, /**< Operation failed */
EMAIL_ERROR_ACCOUNT_NOT_FOUND = TIZEN_ERROR_MESSAGING_CLASS|0x203, /**< Email account not found */
EMAIL_ERROR_DB_FAILED = TIZEN_ERROR_MESSAGING_CLASS|0x204, /**< Email database failed */
-
-
} email_error_e;
/**
@@ -62,4 +60,4 @@ typedef enum
}
#endif
-#endif /* __EMAIL_ERROR_H__*/ \ No newline at end of file
+#endif /* __EMAILAPI_ERROR_H__*/
diff --git a/include/email_private.h b/include/email_private.h
index 02c2f1b..ae22bd8 100755
--- a/include/email_private.h
+++ b/include/email_private.h
@@ -27,13 +27,11 @@ extern "C"
#define MAX_ATTACHEMENT_COUNT 50
#define MAX_RECIPIENT_ADDRESS_LEN 234
-#define MAX_RECIPIENT_COUNT 50
-#define MAX_RECIPIENT_ADDRESSES_LEN (MAX_RECIPIENT_ADDRESS_LEN*MAX_RECIPIENT_COUNT)
typedef struct _email_s {
- emf_mailbox_t *mbox;
- emf_mail_data_t *mail;
- emf_attachment_data_t attachment[MAX_ATTACHEMENT_COUNT];
+ email_mailbox_t *mbox;
+ email_mail_data_t *mail;
+ email_attachment_data_t attachment[MAX_ATTACHEMENT_COUNT];
} email_s;
typedef struct _mailstatus_s {
diff --git a/packaging/capi-messaging-email.spec b/packaging/capi-messaging-email.spec
index 9c1cce7..6acca5b 100644..100755
--- a/packaging/capi-messaging-email.spec
+++ b/packaging/capi-messaging-email.spec
@@ -1,9 +1,9 @@
Name: capi-messaging-email
Summary: Email library in Tizen Native API
-Version: 0.1.1
-Release: 2
+Version: 0.1.5
+Release: 3
Group: TO_BE/FILLED_IN
-License: Apache-2.0
+License: TO BE FILLED IN
Source0: %{name}-%{version}.tar.gz
BuildRequires: cmake
BuildRequires: pkgconfig(dlog)
@@ -55,3 +55,4 @@ rm -rf %{buildroot}
%{_libdir}/pkgconfig/*.pc
%{_libdir}/libcapi-messaging-email.so
+
diff --git a/src/email.c b/src/email.c
index 46f5667..6ac7e96 100755
--- a/src/email.c
+++ b/src/email.c
@@ -25,6 +25,16 @@
#include <email-api-init.h>
#include <email-api.h>
+#define EMAIL_API_ERROR_NONE EMAIL_ERROR_NONE
+#define EMAIL_API_ERROR_OUT_OF_MEMORY EMAIL_ERROR_OUT_OF_MEMORY
+#define EMAIL_API_ERROR_ACCOUNT_NOT_FOUND EMAIL_ERROR_ACCOUNT_NOT_FOUND
+#define EMAIL_API_ERROR_OUT_OF_MEMORY EMAIL_ERROR_OUT_OF_MEMORY
+
+#undef EMAIL_ERROR_NONE
+#undef EMAIL_ERROR_OUT_OF_MEMORY
+#undef EMAIL_ERROR_ACCOUNT_NOT_FOUND
+#undef EMAIL_ERROR_OUT_OF_MEMORY
+
#include<email.h>
#include<email_private.h>
#include<email_types.h>
@@ -34,7 +44,13 @@
#undef LOG_TAG
#endif
#define LOG_TAG "CAPI_EMAIL"
-#define DBG_MODE (0)
+#define DBG_MODE (1)
+
+#define EM_SAFE_STRDUP(s) \
+ ({\
+ char* _s = (char*)s;\
+ (_s)? strdup(_s) : NULL;\
+ })
typedef struct {
email_message_sent_cb callback;
@@ -46,6 +62,8 @@ GSList *gEmailcbList= NULL;
//------------- Utility Or Miscellaneous
void _email_add_dbus_filter(void);
int _email_error_converter(int err, const char *func, int line);
+int _email_copy_handle(email_s **dst_handle, email_s *src_handle);
+void _email_free_cb_context(email_cb_context *cbcontext);
#define CONVERT_ERROR(err) _email_error_converter(err, __FUNCTION__, __LINE__);
@@ -55,22 +73,27 @@ int email_create_message(email_h *msg)
{
int ret;
email_s * msg_s = NULL;
- emf_account_t* account = NULL;
- int cnt,len;
+ email_account_t* account = NULL;
+ int len;
+
+ if(msg == NULL) {
+ LOGE("[%s] INVALID_PARAMETER(0x%08x) : msg is NULL.", __FUNCTION__, EMAIL_ERROR_INVALID_PARAMETER);
+ return EMAIL_ERROR_INVALID_PARAMETER;
+ }
// 1. create service for ipc
ret=email_service_begin();
msg_s= (email_s*)calloc(1,sizeof(email_s));
if (msg_s != NULL)
{
- msg_s->mail = (emf_mail_data_t *)calloc(1,sizeof(emf_mail_data_t));
+ msg_s->mail = (email_mail_data_t *)calloc(1,sizeof(email_mail_data_t));
if (msg_s->mail == NULL) {
LOGE("[%s] OUT_OF_MEMORY(0x%08x) : fail to create msg_s->mail", __FUNCTION__, EMAIL_ERROR_OUT_OF_MEMORY);
free(msg_s);
return EMAIL_ERROR_OUT_OF_MEMORY;
}
- msg_s->mbox = (emf_mailbox_t *)calloc(1,sizeof(emf_mailbox_t));
+ msg_s->mbox = (email_mailbox_t *)calloc(1,sizeof(email_mailbox_t));
if (msg_s->mbox == NULL)
{
LOGE("[%s] OUT_OF_MEMORY(0x%08x) : fail to create msg_s->mbox", __FUNCTION__, EMAIL_ERROR_OUT_OF_MEMORY);
@@ -88,64 +111,41 @@ int email_create_message(email_h *msg)
//return error from F/W
- //EMF_ERROR_INVALID_PARAM/EMF_ERROR_NONE/EMF_ERROR_DB_FAILURE/EMF_ERROR_ACCOUNT_NOT_FOUND/EMF_ERROR_OUT_OF_MEMORY
+ //EMAIL_ERROR_INVALID_PARAM/EMAIL_API_ERROR_NONE/EMAIL_ERROR_DB_FAILURE/EMAIL_ERROR_ACCOUNT_NOT_FOUND/EMAIL_ERROR_OUT_OF_MEMORY
int default_account_id = 0;
- if (!(ret = email_load_default_account_id(&default_account_id))) {
+ if ((ret = email_load_default_account_id(&default_account_id)) != EMAIL_ERROR_NONE) {
LOGE("[%s] email_load_default_account_id failed : [%d]",__FUNCTION__, ret);
return CONVERT_ERROR(ret);
}
ret = email_get_account(default_account_id, GET_FULL_DATA, &account);
- if(ret!=EMF_ERROR_NONE) return CONVERT_ERROR(ret);
+ if(ret!=EMAIL_API_ERROR_NONE) return CONVERT_ERROR(ret);
- LOGD_IF(DBG_MODE,"account address = %s",account->email_addr);
+ LOGD_IF(DBG_MODE,"account address = %s",account->user_email_address);
LOGD_IF(DBG_MODE,"account id = %d",account->account_id);
LOGD_IF(DBG_MODE,"account name = %s",account->account_name);
- LOGD_IF(DBG_MODE,"account user_name = %s",account->user_name);
-
- emf_mailbox_t* mailbox_list = NULL;
- int sync_type =1;
- email_get_mailbox_list(account->account_id, sync_type, &mailbox_list, &cnt);
-
+ LOGD_IF(DBG_MODE,"account user_name = %s",account->incoming_server_user_name);
- msg_s->mail->full_address_from = (char *)calloc(1,sizeof(char)*(strlen(account->user_name)+strlen(account->email_addr)+1+1+1+1+1));//"++"+<+ address +> + NULL
- len= (strlen(account->user_name)+strlen(account->email_addr)+1+1+1+1+1);
+ msg_s->mail->full_address_from = (char *)calloc(1,sizeof(char)*(strlen(account->incoming_server_user_name)+strlen(account->user_email_address)+1+1+1+1+1));//"++"+<+ address +> + NULL
+ len= (strlen(account->incoming_server_user_name)+strlen(account->user_email_address)+1+1+1+1+1);
char *strfrom = msg_s->mail->full_address_from;
- snprintf(strfrom,len,"%s%s%s%s%s%s","\"",account->user_name,"\"","<",account->email_addr,">");
+ snprintf(strfrom,len,"%s%s%s%s%s%s","\"",account->incoming_server_user_name,"\"","<",account->user_email_address,">");
//mbox
- emf_mailbox_t * mbox =msg_s->mbox;
- mbox->name = (char *)calloc(1,sizeof(char)*strlen("OUTBOX")+1);
- if(mbox->name ==NULL){
- LOGE("[%s] OUT_OF_MEMORY(0x%08x) : fail to create mbox->name", __FUNCTION__, EMAIL_ERROR_OUT_OF_MEMORY);
- return EMAIL_ERROR_OUT_OF_MEMORY;
- }
-
- len = strlen("OUTBOX")+1;
- snprintf(mbox->name,len,"%s","OUTBOX");
- mbox->mailbox_type = EMF_MAILBOX_TYPE_OUTBOX;
- mbox->alias = (char *)calloc(1,sizeof(char)*strlen("Outbox")+1);
- if(mbox->alias ==NULL){
- LOGE("[%s] OUT_OF_MEMORY(0x%08x) : fail to create mbox->alias", __FUNCTION__, EMAIL_ERROR_OUT_OF_MEMORY);
- return EMAIL_ERROR_OUT_OF_MEMORY;
+ email_mailbox_t *mbox =msg_s->mbox;
+
+ if ( (ret = email_get_mailbox_by_mailbox_type(default_account_id, EMAIL_MAILBOX_TYPE_OUTBOX, &mbox)) != EMAIL_API_ERROR_NONE) {
+ LOGE("[%s] email_get_mailbox_by_mailbox_type failed %d", __FUNCTION__, ret);
+ return EMAIL_ERROR_DB_FAILED;
}
-
- len = strlen("Outbox")+1;
- snprintf(mbox->alias,len,"%s","Outbox");
-
- mbox->local = 1;
- mbox->synchronous = 1;
- mbox->account_id = account->account_id;
- mbox->next = NULL;
- mbox->mail_slot_size = 50;
//info
msg_s->mail->account_id = account->account_id;
msg_s->mail->flags_draft_field = 1;
msg_s->mail->flags_seen_field = 1;
- msg_s->mail->priority = EMF_MAIL_PRIORITY_NORMAL;
- msg_s->mail->mailbox_name = strdup(mbox->name);
+ msg_s->mail->priority = EMAIL_MAIL_PRIORITY_NORMAL;
+ msg_s->mail->mailbox_id = mbox->mailbox_id;
msg_s->mail->mailbox_type = mbox->mailbox_type;
msg_s->mail->attachment_count = 0;
@@ -158,10 +158,10 @@ int email_destroy_message(email_h msg)
int ret;
- if(msg ==NULL ){
+ if(msg == NULL) {
LOGE("[%s] INVALID_PARAMETER(0x%08x) : msg is NULL.", __FUNCTION__, EMAIL_ERROR_INVALID_PARAMETER);
return EMAIL_ERROR_INVALID_PARAMETER;
- }
+ }
email_s* msg_s = (email_s* )msg;
@@ -179,7 +179,7 @@ int email_destroy_message(email_h msg)
ret=email_service_end();
- if(ret!=EMF_ERROR_NONE){
+ if(ret!=EMAIL_API_ERROR_NONE){
LOGE("[%s] OPERATION_FAILED(0x%08x) : Finishing email service failed", __FUNCTION__, EMAIL_ERROR_OPERATION_FAILED);
return EMAIL_ERROR_OPERATION_FAILED;
}
@@ -400,7 +400,7 @@ int email_add_attach (email_h msg, const char *filepath)
email_s *msg_s = (email_s *)msg;
int attachment_count = msg_s->mail->attachment_count;
- emf_attachment_data_t *new_attach = msg_s->attachment;
+ email_attachment_data_t *new_attach = msg_s->attachment;
stat(filepath, &st);
if(st.st_size > 10*1024*1024)
@@ -462,12 +462,12 @@ int email_remove_all_attachments (email_h msg)
}
-int email_send_message (email_h msg)
+int email_send_message (email_h msg, bool save_to_sentbox)
{
int i, ret;
- emf_option_t option;
+ email_option_t option;
unsigned handle;
- emf_attachment_data_t *tmp_attach = NULL;
+ email_attachment_data_t *tmp_attach = NULL;
struct tm *struct_time;
if (msg == NULL) {
@@ -526,31 +526,31 @@ int email_send_message (email_h msg)
{
- emf_mailbox_t * box;
+ email_mailbox_t * box;
box=msg_s->mbox;
LOGD_IF(DBG_MODE, " ----------box---------");
- LOGD_IF(DBG_MODE, " emf_mailbox_t \n");
- LOGD_IF(DBG_MODE, " name: %s\n",box->name);
+ LOGD_IF(DBG_MODE, " email_mailbox_t \n");
+ LOGD_IF(DBG_MODE, " name: %s\n",box->mailbox_name);
LOGD_IF(DBG_MODE, " mailbox_type: %d\n",box->mailbox_type);
LOGD_IF(DBG_MODE, " alias: %s\n",box->alias);
LOGD_IF(DBG_MODE, " unread_count: %d\n",box->unread_count);
LOGD_IF(DBG_MODE, " total_mail_count_on_local: %d\n",box->total_mail_count_on_local);
LOGD_IF(DBG_MODE, " total_mail_count_on_server: %d\n",box->total_mail_count_on_server);
LOGD_IF(DBG_MODE, " local: %d\n",box->local);
- LOGD_IF(DBG_MODE, " synchronous: %d\n",box->synchronous);
LOGD_IF(DBG_MODE, " account_id: %d\n",box->account_id);
- LOGD_IF(DBG_MODE, " has_archived_mails: %d\n",box->has_archived_mails);
LOGD_IF(DBG_MODE, " mail_slot_size: %d\n",box->mail_slot_size);
- LOGD_IF(DBG_MODE, " account_name: %s\n",box->account_name);
}
ret=email_add_mail(msg_s->mail, msg_s->attachment, msg_s->mail->attachment_count, NULL, 0);
ret=CONVERT_ERROR(ret);
- option.keep_local_copy = 1;
- ret=email_send_mail(msg_s->mbox, msg_s->mail->mail_id, &option, &handle);
+ memset(&option, 0x00, sizeof(email_option_t));
+ option.keep_local_copy = save_to_sentbox ? 1 : 0;
+
+
+ ret=email_send_mail(msg_s->mail->mail_id, &option, &handle);
ret=CONVERT_ERROR(ret);
@@ -577,8 +577,7 @@ email_cb_context * _email_search_callback_by_emailid(int mailid)
cbContext= (email_cb_context *)node->data;
if(cbContext->handle->mail->mail_id == mailid)
{
-
- return cbContext;
+ return cbContext;
}
@@ -594,6 +593,7 @@ int email_set_message_sent_cb (email_h handle, email_message_sent_cb cb, void *u
{
int count;
int ntmp=0;
+ int ret = EMAIL_ERROR_NONE;
GSList * node;
email_cb_context *cbContext;
count = g_slist_length( gEmailcbList );
@@ -601,29 +601,34 @@ int email_set_message_sent_cb (email_h handle, email_message_sent_cb cb, void *u
if(handle ==NULL || cb == NULL)return EMAIL_ERROR_INVALID_PARAMETER;
- email_s* msg_s = (email_s* )handle;
+ email_s* msg_s = NULL;
while( count )
{
node = g_slist_nth( gEmailcbList, ntmp );
- if( node == NULL )
- break;
-
- cbContext= (email_cb_context *)node->data;
- if(cbContext->handle == (email_s*)handle)
- {
- gEmailcbList=g_slist_remove(gEmailcbList,node);
- break;
- }
-
+ if( node == NULL )
+ break;
+
+ cbContext= (email_cb_context *)node->data;
+ if(cbContext->handle == (email_s*)handle)
+ {
+ gEmailcbList=g_slist_remove(gEmailcbList,node);
+ _email_free_cb_context(cbContext);
+ break;
+ }
ntmp++;
count--;
}
+ if ((ret = _email_copy_handle(&msg_s, (email_s *)handle)) != EMAIL_ERROR_NONE) {
+ LOGE("[%s] _email_copy_handle failed", __FUNCTION__);
+ return ret;
+ }
+
email_cb_context * cbcontext= (email_cb_context*)calloc(1, sizeof(email_cb_context) );
-
+
cbcontext->handle = msg_s;
cbcontext->callback=cb;
cbcontext->user_data =user_data;
@@ -658,48 +663,48 @@ int email_unset_message_sent_cb (email_h msg)
if(cbContext->handle == msg_s)
{
gEmailcbList= g_slist_remove(gEmailcbList,node);
- break;
+ _email_free_cb_context(cbContext);
+ break;
}
}
- return EMAIL_ERROR_NONE;
-
+ return EMAIL_ERROR_NONE;
}
int _email_error_converter(int err, const char *func, int line)
{
switch(err)
{
- case EMF_ERROR_INVALID_PARAM:
+ case EMAIL_ERROR_INVALID_PARAM:
LOGE("[%s:%d] INVALID_PARAM(0x%08x) : Error from Email F/W. ret: (0x%08x) ", func, line, EMAIL_ERROR_INVALID_PARAMETER, err);
return EMAIL_ERROR_INVALID_PARAMETER;
- case EMF_ERROR_DB_FAILURE:
+ case EMAIL_ERROR_DB_FAILURE:
LOGE("[%s:%d] DB_FAILURE(0x%08x) : Error from Email F/W. ret: (0x%08x) ", func, line, EMAIL_ERROR_DB_FAILED, err);
return EMAIL_ERROR_DB_FAILED;
- case EMF_ERROR_ACCOUNT_NOT_FOUND:
+ case EMAIL_API_ERROR_ACCOUNT_NOT_FOUND:
LOGE("[%s:%d] ACCOUNT_NOT_FOUND(0x%08x) : Error from Email F/W. ret: (0x%08x) ", func, line, EMAIL_ERROR_ACCOUNT_NOT_FOUND,err);
return EMAIL_ERROR_ACCOUNT_NOT_FOUND;
- case EMF_ERROR_OUT_OF_MEMORY:
+ case EMAIL_API_ERROR_OUT_OF_MEMORY:
LOGE("[%s:%d] OUT_OF_MEMORY(0x%08x) : Error from Email F/W. ret: (0x%08x) ", func, line, EMAIL_ERROR_OUT_OF_MEMORY,err);
return EMAIL_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 EMF_ERROR_NULL_VALUE:
+ case EMAIL_ERROR_NULL_VALUE:
LOGE("[%s:%d] NULL_VALUE(0x%08x) : Error from Email F/W. ret: (0x%08x) ", func, line, EMAIL_ERROR_COMMUNICATION_WITH_SERVER_FAILED,err);
return EMAIL_ERROR_COMMUNICATION_WITH_SERVER_FAILED;
- case EMF_ERROR_IPC_SOCKET_FAILURE:
+ case EMAIL_ERROR_IPC_SOCKET_FAILURE:
LOGE("[%s:%d] IPC_SOCKET_FAILURE(0x%08x) : Error from Email F/W. ret: (0x%08x) ", func, line, EMAIL_ERROR_COMMUNICATION_WITH_SERVER_FAILED,err);
return EMAIL_ERROR_COMMUNICATION_WITH_SERVER_FAILED;
- case EMF_ERROR_NONE:
+ case EMAIL_API_ERROR_NONE:
return EMAIL_ERROR_NONE;
default:
@@ -748,19 +753,19 @@ static void _monitorSendStatusCb(void* data, DBusMessage *message)
switch(errorcode)
{
- case EMF_ERROR_NO_SIM_INSERTED:
- case EMF_ERROR_FLIGHT_MODE:
- case EMF_ERROR_SMTP_SEND_FAILURE:
- case EMF_ERROR_NO_SUCH_HOST:
- case EMF_ERROR_CONNECTION_FAILURE:
- case EMF_ERROR_CONNECTION_BROKEN:
- case EMF_ERROR_INVALID_SERVER:
- case EMF_ERROR_NO_RESPONSE:
+ case EMAIL_ERROR_NO_SIM_INSERTED:
+ case EMAIL_ERROR_FLIGHT_MODE:
+ case EMAIL_ERROR_SMTP_SEND_FAILURE:
+ case EMAIL_ERROR_NO_SUCH_HOST:
+ case EMAIL_ERROR_CONNECTION_FAILURE:
+ case EMAIL_ERROR_CONNECTION_BROKEN:
+ case EMAIL_ERROR_INVALID_SERVER:
+ case EMAIL_ERROR_NO_RESPONSE:
break;
default:
- ;
+ break;
}
cbContext->callback((email_h)cbContext->handle,(email_sending_e)EMAIL_SENDING_FAILED ,cbContext->user_data);
@@ -775,6 +780,7 @@ static void _monitorSendStatusCb(void* data, DBusMessage *message)
}
}
}
+
void _email_add_dbus_filter(void)
{
@@ -812,3 +818,137 @@ void _email_add_dbus_filter(void)
LOGD_IF(DBG_MODE, "Failed in e_dbus_signal_handler_add()");
}
}
+
+int _email_copy_mail_data(email_mail_data_t **dst_mail_data, email_mail_data_t *src_mail_data)
+{
+ email_mail_data_t *temp_mail_data = NULL;
+
+ temp_mail_data = (email_mail_data_t *)calloc(1, sizeof(email_mail_data_t));
+ if (temp_mail_data == NULL) {
+ LOGE("[%s] OUT_OF_MEMORY(0x%08x) : fail to create email_mail_data_t", __FUNCTION__, EMAIL_ERROR_OUT_OF_MEMORY);
+ return EMAIL_ERROR_OUT_OF_MEMORY;
+ }
+
+ temp_mail_data->mail_id = src_mail_data->mail_id;
+ temp_mail_data->account_id = src_mail_data->account_id;
+ temp_mail_data->mailbox_id = src_mail_data->mailbox_id;
+ temp_mail_data->mailbox_type = src_mail_data->mailbox_type;
+ temp_mail_data->subject = EM_SAFE_STRDUP(src_mail_data->subject);
+ temp_mail_data->date_time = src_mail_data->date_time;
+ temp_mail_data->server_mail_status = src_mail_data->server_mail_status;
+ temp_mail_data->server_mailbox_name = EM_SAFE_STRDUP(src_mail_data->server_mailbox_name);
+ temp_mail_data->server_mail_id = EM_SAFE_STRDUP(src_mail_data->server_mail_id);
+ temp_mail_data->message_id = EM_SAFE_STRDUP(src_mail_data->message_id);
+ temp_mail_data->full_address_from = EM_SAFE_STRDUP(src_mail_data->full_address_from);
+ temp_mail_data->full_address_reply = EM_SAFE_STRDUP(src_mail_data->full_address_reply);
+ temp_mail_data->full_address_to = EM_SAFE_STRDUP(src_mail_data->full_address_to);
+ temp_mail_data->full_address_cc = EM_SAFE_STRDUP(src_mail_data->full_address_cc);
+ temp_mail_data->full_address_bcc = EM_SAFE_STRDUP(src_mail_data->full_address_bcc);
+ temp_mail_data->full_address_return = EM_SAFE_STRDUP(src_mail_data->full_address_return);
+ temp_mail_data->email_address_sender = EM_SAFE_STRDUP(src_mail_data->email_address_sender);
+ temp_mail_data->email_address_recipient = EM_SAFE_STRDUP(src_mail_data->email_address_recipient);
+ temp_mail_data->alias_sender = EM_SAFE_STRDUP(src_mail_data->alias_sender);
+ temp_mail_data->alias_recipient = EM_SAFE_STRDUP(src_mail_data->alias_recipient);
+ temp_mail_data->body_download_status = src_mail_data->body_download_status;
+ temp_mail_data->file_path_plain = EM_SAFE_STRDUP(src_mail_data->file_path_plain);
+ temp_mail_data->file_path_html = EM_SAFE_STRDUP(src_mail_data->file_path_html);
+ temp_mail_data->file_path_mime_entity = EM_SAFE_STRDUP(src_mail_data->file_path_mime_entity);
+ temp_mail_data->mail_size = src_mail_data->mail_size;
+ temp_mail_data->flags_seen_field = src_mail_data->flags_seen_field;
+ temp_mail_data->flags_deleted_field = src_mail_data->flags_deleted_field;
+ temp_mail_data->flags_flagged_field = src_mail_data->flags_flagged_field;
+ temp_mail_data->flags_answered_field = src_mail_data->flags_answered_field;
+ temp_mail_data->flags_recent_field = src_mail_data->flags_recent_field;
+ temp_mail_data->flags_draft_field = src_mail_data->flags_draft_field;
+ temp_mail_data->flags_forwarded_field = src_mail_data->flags_forwarded_field;
+ temp_mail_data->DRM_status = src_mail_data->DRM_status;
+ temp_mail_data->priority = src_mail_data->priority;
+ temp_mail_data->save_status = src_mail_data->save_status;
+ temp_mail_data->lock_status = src_mail_data->lock_status;
+ temp_mail_data->report_status = src_mail_data->report_status;
+ temp_mail_data->attachment_count = src_mail_data->attachment_count;
+ temp_mail_data->inline_content_count = src_mail_data->inline_content_count;
+ temp_mail_data->thread_id = src_mail_data->thread_id;
+ temp_mail_data->thread_item_count = src_mail_data->thread_item_count;
+ temp_mail_data->preview_text = EM_SAFE_STRDUP(src_mail_data->preview_text);
+ temp_mail_data->meeting_request_status = src_mail_data->meeting_request_status;
+ temp_mail_data->message_class = src_mail_data->message_class;
+ temp_mail_data->digest_type = src_mail_data->digest_type;
+ temp_mail_data->smime_type = src_mail_data->smime_type;
+
+ *dst_mail_data = temp_mail_data;
+
+ return EMAIL_ERROR_NONE;
+}
+
+int _email_copy_mailbox(email_mailbox_t **dst_mailbox, email_mailbox_t *src_mailbox)
+{
+ email_mailbox_t *temp_mailbox = NULL;
+
+ temp_mailbox = (email_mailbox_t *)calloc(1,sizeof(email_mailbox_t));
+ if (temp_mailbox == NULL)
+ {
+ LOGE("[%s] OUT_OF_MEMORY(0x%08x) : fail to create mailbox", __FUNCTION__, EMAIL_ERROR_OUT_OF_MEMORY);
+ return EMAIL_ERROR_OUT_OF_MEMORY;
+ }
+
+ temp_mailbox->mailbox_id = src_mailbox->mailbox_id;
+ temp_mailbox->mailbox_name = EM_SAFE_STRDUP(src_mailbox->mailbox_name);
+ temp_mailbox->mailbox_type = src_mailbox->mailbox_type;
+ temp_mailbox->alias = EM_SAFE_STRDUP(src_mailbox->alias);
+ temp_mailbox->unread_count = src_mailbox->unread_count;
+ temp_mailbox->total_mail_count_on_local = src_mailbox->total_mail_count_on_local;
+ temp_mailbox->total_mail_count_on_server = src_mailbox->total_mail_count_on_server;
+ temp_mailbox->local = src_mailbox->local;
+ temp_mailbox->account_id = src_mailbox->account_id;
+ temp_mailbox->mail_slot_size = src_mailbox->mail_slot_size;
+ temp_mailbox->last_sync_time = src_mailbox->last_sync_time;
+
+ *dst_mailbox = temp_mailbox;
+
+ return EMAIL_ERROR_NONE;
+}
+
+
+int _email_copy_handle(email_s **dst_handle, email_s *src_handle)
+{
+ int ret = EMAIL_ERROR_NONE;
+ email_s *msg_s = NULL;
+
+ msg_s = (email_s *)calloc(1,sizeof(email_s));
+ if ((ret = _email_copy_mail_data(&msg_s->mail, src_handle->mail)) != EMAIL_ERROR_NONE) {
+ LOGE("[%s] _email_copy_mail_data failed", __FUNCTION__);
+ return ret;
+ }
+
+ if ((ret = _email_copy_mailbox(&msg_s->mbox, src_handle->mbox)) != EMAIL_ERROR_NONE) {
+ LOGE("[%s] _email_copy_mailbox failed", __FUNCTION__);
+ return ret;
+ }
+
+ *dst_handle = msg_s;
+ return ret;
+}
+
+void _email_free_cb_context(email_cb_context *cbcontext)
+{
+ if(cbcontext == NULL) {
+ LOGE("[%s] INVALID_PARAMETER(0x%08x) : msg is NULL.", __FUNCTION__, EMAIL_ERROR_INVALID_PARAMETER);
+ return;
+ }
+
+ email_s* msg_s = cbcontext->handle;
+
+ if(msg_s)
+ {
+ if (msg_s->mail)
+ email_free_mail_data(&msg_s->mail, 1);
+
+ if (msg_s->mbox)
+ email_free_mailbox(&msg_s->mbox, 1);
+
+ free(msg_s);
+ }
+
+ cbcontext = NULL;
+}