Git init
authorKibum Kim <kb0929.kim@samsung.com>
Fri, 6 Jan 2012 15:42:34 +0000 (00:42 +0900)
committerKibum Kim <kb0929.kim@samsung.com>
Fri, 6 Jan 2012 15:42:34 +0000 (00:42 +0900)
33 files changed:
AUTHORS [new file with mode: 0755]
CMakeLists.txt [new file with mode: 0755]
LICENSE [new file with mode: 0755]
TC/_export_env.sh [new file with mode: 0755]
TC/_export_target_env.sh [new file with mode: 0755]
TC/build.sh [new file with mode: 0755]
TC/clean.sh [new file with mode: 0755]
TC/config [new file with mode: 0644]
TC/config.default [new file with mode: 0755]
TC/execute.sh [new file with mode: 0755]
TC/testcase/Makefile [new file with mode: 0755]
TC/testcase/tslist [new file with mode: 0755]
TC/testcase/utc_messaging_email.c [new file with mode: 0755]
TC/tet_scen [new file with mode: 0755]
TC/tetbuild.cfg [new file with mode: 0755]
TC/tetclean.cfg [new file with mode: 0755]
TC/tetexec.cfg [new file with mode: 0755]
capi-messaging-email.pc.in [new file with mode: 0755]
debian/README [new file with mode: 0755]
debian/capi-messaging-email-dev.install [new file with mode: 0644]
debian/capi-messaging-email-dev.postinst [new file with mode: 0644]
debian/capi-messaging-email.install [new file with mode: 0644]
debian/capi-messaging-email.postinst [new file with mode: 0644]
debian/changelog [new file with mode: 0755]
debian/compat [new file with mode: 0644]
debian/control [new file with mode: 0755]
debian/rules [new file with mode: 0755]
include/email.h [new file with mode: 0755]
include/email_error.h [new file with mode: 0755]
include/email_private.h [new file with mode: 0755]
include/email_types.h [new file with mode: 0755]
packaging/capi-messaging-email.spec [new file with mode: 0644]
src/email.c [new file with mode: 0755]

diff --git a/AUTHORS b/AUTHORS
new file mode 100755 (executable)
index 0000000..c61ebde
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1 @@
+Jongchul Park <jc0204.park@samsung.com>
\ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..d17e945
--- /dev/null
@@ -0,0 +1,88 @@
+
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+SET(fw_name "capi-messaging-email")
+
+PROJECT(${fw_name})
+
+SET(CMAKE_INSTALL_PREFIX /usr)
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+
+SET(INC_DIR include)
+INCLUDE_DIRECTORIES(${INC_DIR})
+
+SET(dependents "dlog glib-2.0 edbus capi-base-common email-service")
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(${fw_name} REQUIRED ${dependents})
+FOREACH(flag ${${fw_name}_CFLAGS})
+    SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror")
+SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
+
+IF("${ARCH}" STREQUAL "arm")
+    ADD_DEFINITIONS("-DTARGET")
+ENDIF("${ARCH}" STREQUAL "arm")
+
+ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+ADD_DEFINITIONS("-DTIZEN_DEBUG")
+
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib")
+
+aux_source_directory(src SOURCES)
+ADD_LIBRARY(${fw_name} SHARED ${SOURCES})
+
+TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS})
+
+INSTALL(TARGETS ${fw_name} DESTINATION lib)
+INSTALL(
+        DIRECTORY ${INC_DIR}/ DESTINATION include/messaging
+        FILES_MATCHING
+        PATTERN "*_private.h" EXCLUDE
+        PATTERN "${INC_DIR}/*.h"
+        )
+
+SET(PC_NAME ${fw_name})
+SET(PC_REQUIRED ${dependents})
+SET(PC_LDFLAGS -l${fw_name})
+SET(PC_CFLAGS -I\${includedir}/messaging)
+
+CONFIGURE_FILE(
+    ${fw_name}.pc.in
+    ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc
+    @ONLY
+)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION lib/pkgconfig)
+
+IF(UNIX)
+
+ADD_CUSTOM_TARGET (distclean @echo cleaning for source distribution)
+ADD_CUSTOM_COMMAND(
+        DEPENDS clean 
+        COMMENT "distribution clean"
+        COMMAND find
+        ARGS    . 
+        -not -name config.cmake -and \(
+        -name tester.c -or
+        -name Testing -or
+        -name CMakeFiles -or
+        -name cmake.depends -or
+        -name cmake.check_depends -or
+        -name CMakeCache.txt -or
+        -name cmake.check_cache -or
+        -name *.cmake -or
+        -name Makefile -or
+        -name core -or
+        -name core.* -or
+        -name gmon.out -or
+        -name install_manifest.txt -or
+        -name *.pc -or
+        -name *~ \)
+        | grep -v TC | xargs rm -rf
+        TARGET  distclean
+        VERBATIM
+)
+
+ENDIF(UNIX)
+
diff --git a/LICENSE b/LICENSE
new file mode 100755 (executable)
index 0000000..9c13a9b
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,204 @@
+Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+\r
+                                 Apache License\r
+                           Version 2.0, January 2004\r
+                        http://www.apache.org/licenses/\r
+\r
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\r
+\r
+   1. Definitions.\r
+\r
+      "License" shall mean the terms and conditions for use, reproduction,\r
+      and distribution as defined by Sections 1 through 9 of this document.\r
+\r
+      "Licensor" shall mean the copyright owner or entity authorized by\r
+      the copyright owner that is granting the License.\r
+\r
+      "Legal Entity" shall mean the union of the acting entity and all\r
+      other entities that control, are controlled by, or are under common\r
+      control with that entity. For the purposes of this definition,\r
+      "control" means (i) the power, direct or indirect, to cause the\r
+      direction or management of such entity, whether by contract or\r
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the\r
+      outstanding shares, or (iii) beneficial ownership of such entity.\r
+\r
+      "You" (or "Your") shall mean an individual or Legal Entity\r
+      exercising permissions granted by this License.\r
+\r
+      "Source" form shall mean the preferred form for making modifications,\r
+      including but not limited to software source code, documentation\r
+      source, and configuration files.\r
+\r
+      "Object" form shall mean any form resulting from mechanical\r
+      transformation or translation of a Source form, including but\r
+      not limited to compiled object code, generated documentation,\r
+      and conversions to other media types.\r
+\r
+      "Work" shall mean the work of authorship, whether in Source or\r
+      Object form, made available under the License, as indicated by a\r
+      copyright notice that is included in or attached to the work\r
+      (an example is provided in the Appendix below).\r
+\r
+      "Derivative Works" shall mean any work, whether in Source or Object\r
+      form, that is based on (or derived from) the Work and for which the\r
+      editorial revisions, annotations, elaborations, or other modifications\r
+      represent, as a whole, an original work of authorship. For the purposes\r
+      of this License, Derivative Works shall not include works that remain\r
+      separable from, or merely link (or bind by name) to the interfaces of,\r
+      the Work and Derivative Works thereof.\r
+\r
+      "Contribution" shall mean any work of authorship, including\r
+      the original version of the Work and any modifications or additions\r
+      to that Work or Derivative Works thereof, that is intentionally\r
+      submitted to Licensor for inclusion in the Work by the copyright owner\r
+      or by an individual or Legal Entity authorized to submit on behalf of\r
+      the copyright owner. For the purposes of this definition, "submitted"\r
+      means any form of electronic, verbal, or written communication sent\r
+      to the Licensor or its representatives, including but not limited to\r
+      communication on electronic mailing lists, source code control systems,\r
+      and issue tracking systems that are managed by, or on behalf of, the\r
+      Licensor for the purpose of discussing and improving the Work, but\r
+      excluding communication that is conspicuously marked or otherwise\r
+      designated in writing by the copyright owner as "Not a Contribution."\r
+\r
+      "Contributor" shall mean Licensor and any individual or Legal Entity\r
+      on behalf of whom a Contribution has been received by Licensor and\r
+      subsequently incorporated within the Work.\r
+\r
+   2. Grant of Copyright License. Subject to the terms and conditions of\r
+      this License, each Contributor hereby grants to You a perpetual,\r
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
+      copyright license to reproduce, prepare Derivative Works of,\r
+      publicly display, publicly perform, sublicense, and distribute the\r
+      Work and such Derivative Works in Source or Object form.\r
+\r
+   3. Grant of Patent License. Subject to the terms and conditions of\r
+      this License, each Contributor hereby grants to You a perpetual,\r
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
+      (except as stated in this section) patent license to make, have made,\r
+      use, offer to sell, sell, import, and otherwise transfer the Work,\r
+      where such license applies only to those patent claims licensable\r
+      by such Contributor that are necessarily infringed by their\r
+      Contribution(s) alone or by combination of their Contribution(s)\r
+      with the Work to which such Contribution(s) was submitted. If You\r
+      institute patent litigation against any entity (including a\r
+      cross-claim or counterclaim in a lawsuit) alleging that the Work\r
+      or a Contribution incorporated within the Work constitutes direct\r
+      or contributory patent infringement, then any patent licenses\r
+      granted to You under this License for that Work shall terminate\r
+      as of the date such litigation is filed.\r
+\r
+   4. Redistribution. You may reproduce and distribute copies of the\r
+      Work or Derivative Works thereof in any medium, with or without\r
+      modifications, and in Source or Object form, provided that You\r
+      meet the following conditions:\r
+\r
+      (a) You must give any other recipients of the Work or\r
+          Derivative Works a copy of this License; and\r
+\r
+      (b) You must cause any modified files to carry prominent notices\r
+          stating that You changed the files; and\r
+\r
+      (c) You must retain, in the Source form of any Derivative Works\r
+          that You distribute, all copyright, patent, trademark, and\r
+          attribution notices from the Source form of the Work,\r
+          excluding those notices that do not pertain to any part of\r
+          the Derivative Works; and\r
+\r
+      (d) If the Work includes a "NOTICE" text file as part of its\r
+          distribution, then any Derivative Works that You distribute must\r
+          include a readable copy of the attribution notices contained\r
+          within such NOTICE file, excluding those notices that do not\r
+          pertain to any part of the Derivative Works, in at least one\r
+          of the following places: within a NOTICE text file distributed\r
+          as part of the Derivative Works; within the Source form or\r
+          documentation, if provided along with the Derivative Works; or,\r
+          within a display generated by the Derivative Works, if and\r
+          wherever such third-party notices normally appear. The contents\r
+          of the NOTICE file are for informational purposes only and\r
+          do not modify the License. You may add Your own attribution\r
+          notices within Derivative Works that You distribute, alongside\r
+          or as an addendum to the NOTICE text from the Work, provided\r
+          that such additional attribution notices cannot be construed\r
+          as modifying the License.\r
+\r
+      You may add Your own copyright statement to Your modifications and\r
+      may provide additional or different license terms and conditions\r
+      for use, reproduction, or distribution of Your modifications, or\r
+      for any such Derivative Works as a whole, provided Your use,\r
+      reproduction, and distribution of the Work otherwise complies with\r
+      the conditions stated in this License.\r
+\r
+   5. Submission of Contributions. Unless You explicitly state otherwise,\r
+      any Contribution intentionally submitted for inclusion in the Work\r
+      by You to the Licensor shall be under the terms and conditions of\r
+      this License, without any additional terms or conditions.\r
+      Notwithstanding the above, nothing herein shall supersede or modify\r
+      the terms of any separate license agreement you may have executed\r
+      with Licensor regarding such Contributions.\r
+\r
+   6. Trademarks. This License does not grant permission to use the trade\r
+      names, trademarks, service marks, or product names of the Licensor,\r
+      except as required for reasonable and customary use in describing the\r
+      origin of the Work and reproducing the content of the NOTICE file.\r
+\r
+   7. Disclaimer of Warranty. Unless required by applicable law or\r
+      agreed to in writing, Licensor provides the Work (and each\r
+      Contributor provides its Contributions) on an "AS IS" BASIS,\r
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\r
+      implied, including, without limitation, any warranties or conditions\r
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\r
+      PARTICULAR PURPOSE. You are solely responsible for determining the\r
+      appropriateness of using or redistributing the Work and assume any\r
+      risks associated with Your exercise of permissions under this License.\r
+\r
+   8. Limitation of Liability. In no event and under no legal theory,\r
+      whether in tort (including negligence), contract, or otherwise,\r
+      unless required by applicable law (such as deliberate and grossly\r
+      negligent acts) or agreed to in writing, shall any Contributor be\r
+      liable to You for damages, including any direct, indirect, special,\r
+      incidental, or consequential damages of any character arising as a\r
+      result of this License or out of the use or inability to use the\r
+      Work (including but not limited to damages for loss of goodwill,\r
+      work stoppage, computer failure or malfunction, or any and all\r
+      other commercial damages or losses), even if such Contributor\r
+      has been advised of the possibility of such damages.\r
+\r
+   9. Accepting Warranty or Additional Liability. While redistributing\r
+      the Work or Derivative Works thereof, You may choose to offer,\r
+      and charge a fee for, acceptance of support, warranty, indemnity,\r
+      or other liability obligations and/or rights consistent with this\r
+      License. However, in accepting such obligations, You may act only\r
+      on Your own behalf and on Your sole responsibility, not on behalf\r
+      of any other Contributor, and only if You agree to indemnify,\r
+      defend, and hold each Contributor harmless for any liability\r
+      incurred by, or claims asserted against, such Contributor by reason\r
+      of your accepting any such warranty or additional liability.\r
+\r
+   END OF TERMS AND CONDITIONS\r
+\r
+   APPENDIX: How to apply the Apache License to your work.\r
+\r
+      To apply the Apache License to your work, attach the following\r
+      boilerplate notice, with the fields enclosed by brackets "[]"\r
+      replaced with your own identifying information. (Don't include\r
+      the brackets!)  The text should be enclosed in the appropriate\r
+      comment syntax for the file format. We also recommend that a\r
+      file or class name and description of purpose be included on the\r
+      same "printed page" as the copyright notice for easier\r
+      identification within third-party archives.\r
+\r
+   Copyright [yyyy] [name of copyright owner]\r
+\r
+   Licensed under the Apache License, Version 2.0 (the "License");\r
+   you may not use this file except in compliance with the License.\r
+   You may obtain a copy of the License at\r
+\r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+\r
diff --git a/TC/_export_env.sh b/TC/_export_env.sh
new file mode 100755 (executable)
index 0000000..72a11ec
--- /dev/null
@@ -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 (executable)
index 0000000..5ddaa53
--- /dev/null
@@ -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 (executable)
index 0000000..6be8d56
--- /dev/null
@@ -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 (executable)
index 0000000..29743e0
--- /dev/null
@@ -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 (file)
index 0000000..1cb4dee
--- /dev/null
+++ b/TC/config
@@ -0,0 +1,3 @@
+TET_INSTALL_HOST_PATH=/home/jcpark/view/dts/SLP_DTS_v1.1.0/TETware
+TET_INSTALL_TARGET_PATH=/opt/jcpark/dts/SLP_DTS_v1.1.0/TETware
+
diff --git a/TC/config.default b/TC/config.default
new file mode 100755 (executable)
index 0000000..04684f0
--- /dev/null
@@ -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 (executable)
index 0000000..215ad6c
--- /dev/null
@@ -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 (executable)
index 0000000..977b55b
--- /dev/null
@@ -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 (executable)
index 0000000..4cdf235
--- /dev/null
@@ -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 (executable)
index 0000000..2f3c68c
--- /dev/null
@@ -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);
+
+       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);
+
+       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 (executable)
index 0000000..03f029a
--- /dev/null
@@ -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 (executable)
index 0000000..f7eda55
--- /dev/null
@@ -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 (executable)
index 0000000..02d7030
--- /dev/null
@@ -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 (executable)
index 0000000..ef3e452
--- /dev/null
@@ -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/capi-messaging-email.pc.in b/capi-messaging-email.pc.in
new file mode 100755 (executable)
index 0000000..c3e189e
--- /dev/null
@@ -0,0 +1,15 @@
+
+# Package Information for pkg-config
+
+prefix=@PREFIX@
+exec_prefix=/usr
+libdir=/usr/lib
+includedir=/usr/include/messaging
+
+Name: @PC_NAME@
+Description: @PACKAGE_DESCRIPTION@
+Version: @VERSION@
+Requires: @PC_REQUIRED@ 
+Libs: -L${libdir} @PC_LDFLAGS@
+Cflags: -I${includedir} @PC_CFLAGS@
+
diff --git a/debian/README b/debian/README
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/debian/capi-messaging-email-dev.install b/debian/capi-messaging-email-dev.install
new file mode 100644 (file)
index 0000000..761a28b
--- /dev/null
@@ -0,0 +1,4 @@
+/usr/include/*
+/usr/include/*/*
+/usr/lib/pkgconfig/*.pc
+
diff --git a/debian/capi-messaging-email-dev.postinst b/debian/capi-messaging-email-dev.postinst
new file mode 100644 (file)
index 0000000..1a24852
--- /dev/null
@@ -0,0 +1 @@
+#!/bin/sh
diff --git a/debian/capi-messaging-email.install b/debian/capi-messaging-email.install
new file mode 100644 (file)
index 0000000..4a755a4
--- /dev/null
@@ -0,0 +1 @@
+/usr/lib/lib*.so*
diff --git a/debian/capi-messaging-email.postinst b/debian/capi-messaging-email.postinst
new file mode 100644 (file)
index 0000000..1a24852
--- /dev/null
@@ -0,0 +1 @@
+#!/bin/sh
diff --git a/debian/changelog b/debian/changelog
new file mode 100755 (executable)
index 0000000..aa1f9ae
--- /dev/null
@@ -0,0 +1,106 @@
+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
new file mode 100644 (file)
index 0000000..7ed6ff8
--- /dev/null
@@ -0,0 +1 @@
+5
diff --git a/debian/control b/debian/control
new file mode 100755 (executable)
index 0000000..73a6a9d
--- /dev/null
@@ -0,0 +1,22 @@
+
+Source: capi-messaging-email
+Section: libs
+Priority: extra
+Maintainer: Jongchul Park <jc0204.park@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: ${shilbs: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
new file mode 100755 (executable)
index 0000000..75aec6c
--- /dev/null
@@ -0,0 +1,65 @@
+#!/usr/bin/make -f
+
+CFLAGS = -Wall -g
+
+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 ..
+       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
new file mode 100755 (executable)
index 0000000..b254111
--- /dev/null
@@ -0,0 +1,247 @@
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * 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. 
+ */
+
+ #ifndef __MESSAGING_EMAIL_H__
+ #define __MESSAGING_EMAIL_H__
+
+/**
+ * @addtogroup CAPI_MESSAGING_EMAIL_MODULE
+ * @{
+ */
+
+/**
+ * @file        email.h
+ * @ingroup     CAPI_MESSAGING_FRAMEWORK
+ * @brief       Messaging API file, support for sending email messages.
+ */
+
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <email_types.h>
+#include <email_error.h>
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+/**
+ * @brief   Creates an email message handle for sending an email message.
+ *
+ * @remarks  a email must be released with email_destroy_message() by you. 
+ *
+ * @param[out]  email  A handle to the email message
+ *
+ * @return  0 on success, otherwise a negative error value.
+ * @retval     #EMAIL_ERROR_NONE Successful
+ * @retval     #EMAIL_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval     #EMAIL_ERROR_ACCOUNT_NOT_FOUND           Email account not found 
+ *
+ * @see email_destroy_message()
+ */
+int email_create_message(email_h *email);
+
+/**
+ * @brief   Destroys the email message handle and releases all its resources.
+ *
+ * @param[in]  email   The handle to the email message
+ *
+ * @return  0 on success, otherwise a negative error value.
+ * @retval     #EMAIL_ERROR_NONE Successful
+ * @retval     #EMAIL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval     #EMAIL_ERROR_OPERATION_FAILED Operation failed
+ *
+ * @see email_create_message()
+ */
+int email_destroy_message(email_h email);
+
+/**
+ * @brief   Sets a subject of the email message.
+ *
+ * @param[in]  email   The handle to the email message
+ * @param[in]   subject        The subject of the email message
+ * @return     0 on success, otherwise a negative error value.
+ * @retval     #EMAIL_ERROR_NONE Successful
+ * @retval     #EMAIL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval     #EMAIL_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see        email_create_message()
+ */
+int email_set_subject(email_h email, const char *subject);
+
+/**
+ * @brief   Populates a body of the email message.
+ * @details Email message body means the text data to be delivered.
+ *
+ * @param[in]  email   The handle to the email message
+ * @param[in]   body    The message body
+ * @return     0 on success, otherwise a negative error value.
+ * @retval     #EMAIL_ERROR_NONE Successful
+ * @retval     #EMAIL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval     # EMAIL_ERROR_OPERATION_FAILED Operation failed
+ * @pre     An email message handle is created using #email_create_message().
+ * @see        email_create_message()
+ */
+int email_set_body(email_h email, const char *body);
+
+/**
+ * @brief   Adds a recipient to the email message.
+ * @details The email API supports sending an email message to multiple recipients. 
+ *
+ * @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
+ * @param[in]   address The recipient email address
+ *
+ * @return  0 on success, otherwise a negative error value.
+ * @retval  #EMAIL_ERROR_NONE Successful
+ * @retval  #EMAIL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval  #EMAIL_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see email_create_message()
+ * @see email_remove_all_recipients()
+ */
+int email_add_recipient(email_h email, email_recipient_type_e type, const char *address);
+
+/**
+ * @brief   Removes all recipients for the email message.
+ *
+ * @param[in]  email   The handle to the email message 
+ *
+ * @return  0 on success, otherwise a negative error value.
+ * @retval  #EMAIL_ERROR_NONE Successful
+ * @retval  #EMAIL_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see email_add_recipient()
+ */
+int email_remove_all_recipients(email_h email);
+
+/**
+ * @brief   Adds a file as an attachment to the email message.
+ * @details It should be used to add a file to the attachment list
+ * of the email message. 
+ *
+ * @remarks  The maximum attachment file size is 10MB.
+ *
+ * @param[in]  email   The handle to the email message 
+ * @param[in]   filepath    The absolute full path of the file to be attached
+ *
+ * @return  0 on success, otherwise a negative error value.
+ * @retval  #EMAIL_ERROR_NONE Successful
+ * @retval  #EMAIL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval  #EMAIL_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see email_remove_all_attachments()
+ *
+ */
+int email_add_attach(email_h email, const char *filepath);
+
+/**
+ * @brief   Clears all attachments of the email message.
+ *
+ * @param[in]  email   The handle to the email message 
+ *
+ * @return  0 on success, otherwise a negative error value.
+ * @retval  #EMAIL_ERROR_NONE Successful
+ * @retval  #EMAIL_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see email_create_message()
+ * @see email_add_attach()
+ */
+int email_remove_all_attachments(email_h email);
+
+/**
+ * @brief   Sends the email message.
+ *
+ * @remarks In order to check whether sending a message succeeds, \n you should register email_message_sent_cb() using #email_set_message_sent_cb().
+ *
+ *
+ * @param[in]  email   The handle to the email message 
+ * @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.
+ * @retval  #EMAIL_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see email_create_message()
+ * @see email_set_message_sent_cb()
+ * @see email_add_recipient()
+ */
+int email_send_message(email_h email);
+
+
+/**
+ * @brief   Called when the process of sending an email finishes.
+ * @details You can check whether sending an email succeeds using this function.
+ * 
+ *
+ * @param[in]  email   The handle to the email message 
+ * @param[in]   result         The result of email message sending\n 
+ *                                             #EMAIL_SENDING_FAILED or #EMAIL_SENDING_SUCCEEDED
+ * @param[in]   user_data  The user data passed from the callback registration function
+ *
+ * @pre email_send_message() will invoke this callback if you register this callback using email_set_message_sent_cb().
+ *
+ * @see email_send_message()
+ * @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);
+
+/**
+ * @brief   Registers a callback function to be invoked when an email message is sent. 
+ * @details You will be notified when sending a message finishes and check whether it succeeds using this function. 
+ *
+ * @param[in]  email   The handle to the email message 
+ * @param[in]  callback        The callback function to register
+ * @param[in]  user_data       The user data to be passed to the callback function
+ *
+ * @return  0 on success, otherwise a negative error value.
+ * @retval  #EMAIL_ERROR_NONE  Successful
+ * @retval  #EMAIL_ERROR_INVALID_PARAMETER     Invalid parameter
+ * @post       It will invoke email_message_sent_cb().
+ * @see email_message_sent_cb()
+ * @see email_unset_message_sent_cb()
+ * @see email_send_message()
+ */
+int email_set_message_sent_cb(email_h email, email_message_sent_cb callback, void *user_data);
+
+/**
+ * @brief   Unregisters the callback function.
+ *
+ * @param[in]  email   The handle to the email message
+ *
+ * @return  0 on success, otherwise a negative error value.
+ * @retval  #EMAIL_ERROR_NONE Successful
+ * @retval  #EMAIL_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see email_message_sent_cb()
+ * @see email_set_message_sent_cb()
+ * @see email_send_message()
+ */
+int email_unset_message_sent_cb(email_h msg);
+
+#ifdef __cplusplus
+}
+#endif
+
+/**
+* @}
+*/
+
+#endif /* __MESSAGING_EMAIL_H__ */
diff --git a/include/email_error.h b/include/email_error.h
new file mode 100755 (executable)
index 0000000..b14a6fb
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * 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. 
+ */
+
+
+#ifndef __EMAIL_ERROR_H__
+#define __EMAIL_ERROR_H__
+
+#include <tizen.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ * @addtogroup CAPI_MESSAGING_EMAIL_MODULE
+ * @{
+ */
+
+/**
+ * @file        email_error.h
+ * @brief       Email error definitions.
+ */
+
+
+/**
+ *  @brief    Enumerations of error codes for email API.
+ */
+typedef enum
+{
+       EMAIL_ERROR_NONE                    = TIZEN_ERROR_NONE,                       /**< Successful */
+       EMAIL_ERROR_OUT_OF_MEMORY           = TIZEN_ERROR_OUT_OF_MEMORY,                  /**< Memory cannot be allocated */
+       EMAIL_ERROR_INVALID_PARAMETER    = TIZEN_ERROR_INVALID_PARAMETER,                 /**< Invalid parameter */
+
+       EMAIL_ERROR_SERVER_NOT_READY  = TIZEN_ERROR_MESSAGING_CLASS|0x200,                  /**< Server not ready */
+       EMAIL_ERROR_COMMUNICATION_WITH_SERVER_FAILED  = TIZEN_ERROR_MESSAGING_CLASS|0x201,  /**< Communication with server failed */
+       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;
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __EMAIL_ERROR_H__*/
\ No newline at end of file
diff --git a/include/email_private.h b/include/email_private.h
new file mode 100755 (executable)
index 0000000..87fd999
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * 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. 
+ */
+
+
+#ifndef __TIZEN_EMAIL_PRIVATE_TYPES_H__
+#define __TIZEN_EMAIL_PRIVATE_TYPES_H__
+
+#include <emf-types.h>
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+#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_mail_t *mail;
+       emf_mailbox_t *mbox;
+} email_s;
+
+typedef  struct _mailstatus_s {
+        int mailId;
+        int accountId;
+        int status;
+        int errorCode;
+    }mailstatus_s;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIZEN_EMAIL_PRIVATE_TYPES_H__*/
diff --git a/include/email_types.h b/include/email_types.h
new file mode 100755 (executable)
index 0000000..95f79d7
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * 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. 
+ */
+
+
+#ifndef __TIZEN_EMAIL_TYPES_H__
+#define __TIZEN_EMAIL_TYPES_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ * @addtogroup CAPI_MESSAGING_EMAIL_MODULE
+ * @{
+ */
+
+
+/**
+ * @file        email_types.h
+ * @ingroup     CAPI_MESSAGING_FRAMEWORK
+ * @brief       This file defines common types and enums of EMAIL.
+ */
+
+
+/**
+ * @brief   Email message handle type.
+ */
+typedef struct email_s *email_h;
+
+
+/**
+ * @brief      Enumerations for the result values of email transport.
+ */
+typedef enum
+{
+  EMAIL_SENDING_FAILED = -1, /**< Email sending failed */
+  EMAIL_SENDING_SUCCEEDED = 0, /**< Email sending succeeded */
+} email_sending_e;
+
+
+/**
+ * @brief      Enumerations of the email recipient types.
+ */
+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;
+
+
+/**
+ * @}
+ */
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIZEN_EMAIL_TYPES_H__*/
+
diff --git a/packaging/capi-messaging-email.spec b/packaging/capi-messaging-email.spec
new file mode 100644 (file)
index 0000000..30a8b01
--- /dev/null
@@ -0,0 +1,56 @@
+Name:       capi-messaging-email
+Summary:    Email library in Tizen Native API
+Version:    0.0.1
+Release:    1
+Group:      TO_BE/FILLED_IN
+License:    TO BE FILLED IN
+Source0:    %{name}-%{version}.tar.gz
+BuildRequires:  cmake
+BuildRequires:  pkgconfig(dlog)
+BuildRequires:  pkgconfig(glib-2.0)
+BuildRequires:  pkgconfig(edbus)
+BuildRequires:  pkgconfig(email-service)
+BuildRequires:  pkgconfig(capi-base-common)
+BuildRequires:  pkgconfig(capi-appfw-application)
+Requires(post): /sbin/ldconfig  
+Requires(postun): /sbin/ldconfig
+
+%description
+
+
+%package devel
+Summary:  Email library in Tizen Native API (Development)
+Group:    TO_BE/FILLED_IN
+Requires: %{name} = %{version}-%{release}
+
+%description devel
+
+
+
+%prep
+%setup -q
+
+
+%build
+cmake . -DCMAKE_INSTALL_PREFIX=/usr
+
+
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+
+%files
+%{_libdir}/libcapi-messaging-email.so
+
+%files devel
+%{_includedir}/messaging/*.h
+%{_libdir}/pkgconfig/*.pc
+
+
diff --git a/src/email.c b/src/email.c
new file mode 100755 (executable)
index 0000000..a5e8335
--- /dev/null
@@ -0,0 +1,949 @@
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * 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. 
+ */
+
+
+#include <memory.h>
+#include <dlog.h>
+#include <E_DBus.h>
+#include <emf-types.h>
+#include <Emf_Mapi_Account.h>
+#include <Emf_Mapi_Message.h>
+#include <Emf_Mapi_Network.h>
+#include <Emf_Mapi_Mailbox.h>
+#include <Emf_Mapi_Init.h>
+
+#include<email.h>
+#include<email_private.h>
+#include<email_types.h>
+#include<email_error.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "CAPI_EMAIL"
+#define DBG_MODE (0)
+
+typedef struct {
+       email_message_sent_cb  callback;
+       email_s *handle;
+       void *user_data;
+} email_cb_context;
+
+GSList *gEmailcbList= NULL;
+//------------- Utility Or Miscellaneous
+void _email_add_dbus_filter(void);
+int _email_error_converter(int err);
+
+//------------------------------------
+
+int  email_create_message(email_h *msg)
+{
+       int ret;
+       email_s * msg_s = NULL;
+       emf_account_t* account = NULL;
+       int i,cnt,len;
+
+       // 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_t *)calloc(1,sizeof(emf_mail_t));
+               if (msg_s->mail != NULL)
+               {
+               
+                       msg_s->mail->head = (emf_mail_head_t *)calloc(1,sizeof(emf_mail_head_t));
+                       if(msg_s->mail->head == NULL)
+                       {
+                               LOGE("[%s] OUT_OF_MEMORY(0x%08x) : fail to create msg_s->mail->head", __FUNCTION__, EMAIL_ERROR_OUT_OF_MEMORY);
+                               free(msg_s);
+                               return EMAIL_ERROR_OUT_OF_MEMORY;
+                       }
+
+                       msg_s->mail->body = (emf_mail_body_t *)calloc(1,sizeof(emf_mail_body_t));
+                       if (msg_s->mail->body  == NULL)
+                       {
+                               LOGE("[%s] OUT_OF_MEMORY(0x%08x) : fail to create msg_s->mail->body", __FUNCTION__, EMAIL_ERROR_OUT_OF_MEMORY);
+                               free(msg_s);
+                               return EMAIL_ERROR_OUT_OF_MEMORY;
+                       }
+
+
+                       msg_s->mail->info = (emf_mail_info_t *)calloc(1,sizeof(emf_mail_info_t));
+                       if (msg_s->mail->info  == NULL)
+                       {
+                               LOGE("[%s] OUT_OF_MEMORY(0x%08x) : fail to create msg_s->mail->info", __FUNCTION__, EMAIL_ERROR_OUT_OF_MEMORY);
+                               free(msg_s);
+                               return EMAIL_ERROR_OUT_OF_MEMORY;
+                       }
+               }
+               else
+               {
+                       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));
+               if (msg_s->mbox == NULL)
+               {
+                       LOGE("[%s] OUT_OF_MEMORY(0x%08x) : fail to create msg_s->mbox", __FUNCTION__, EMAIL_ERROR_OUT_OF_MEMORY);
+                       free(msg_s);
+                       return EMAIL_ERROR_OUT_OF_MEMORY;
+                       }
+               
+       
+       }
+       else
+       {
+               LOGE("[%s] OUT_OF_MEMORY(0x%08x) : fail to create msg_s", __FUNCTION__, EMAIL_ERROR_OUT_OF_MEMORY);
+               return EMAIL_ERROR_OUT_OF_MEMORY;
+               }
+
+               
+       //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
+       ret=email_get_account_list(&account, &cnt);
+       
+       
+       if(ret!=EMF_ERROR_NONE) return _email_error_converter(ret);
+
+       for(i=0;i<cnt;i++)
+       {
+               LOGD_IF(DBG_MODE,"account address[%d]= %s",i,account[i].email_addr);
+               LOGD_IF(DBG_MODE,"account id[%d]= %d",i,account[i].account_id);
+               LOGD_IF(DBG_MODE,"account name[%d]= %s",i,account[i].account_name);
+               LOGD_IF(DBG_MODE,"account user_name[%d]= %s",i,account[i].user_name);
+
+               }
+
+       emf_mailbox_t* mailbox_list = NULL;
+       int sync_type =1;
+       email_get_mailbox_list(account[0].account_id, sync_type, &mailbox_list, &cnt);
+
+       
+       msg_s->mail->head->from = (char *)calloc(1,sizeof(char)*(strlen(account[0].user_name)+strlen(account[0].email_addr)+1+1+1+1+1));//"++"+<+ address +> + NULL
+       len= (strlen(account[0].user_name)+strlen(account[0].email_addr)+1+1+1+1+1);
+       char *strfrom = msg_s->mail->head->from;
+
+       snprintf(strfrom,len,"%s%s%s%s%s%s","\"",account[0].user_name,"\"","<",account[0].email_addr,">");
+
+
+       //info
+       emf_mail_info_t *info = msg_s->mail->info;
+       info->account_id = account[0].account_id;
+       info->flags.draft = 1;
+       
+       //set flag1 as seen
+       info->flags.seen = 1;
+
+       info->extra_flags.priority = EMF_MAIL_PRIORITY_NORMAL;
+
+       //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;
+               }
+       
+       len = strlen("Outbox")+1;
+       snprintf(mbox->alias,len,"%s","Outbox");
+       
+       mbox->local = 1;
+       mbox->synchronous = 1;
+       mbox->account_id = account[0].account_id;
+       mbox->next = NULL;
+       mbox->mail_slot_size = 50;
+       
+
+       *msg = (email_h)msg_s;
+       return EMAIL_ERROR_NONE;
+}
+
+int email_destroy_message(email_h msg)
+{
+       int ret;
+
+
+       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;
+
+       if(msg_s )
+       {
+               if(msg_s->mail)
+               {
+                       if(msg_s->mail->head)free(msg_s->mail->head);
+
+                       if(msg_s->mail->body)
+                       {
+                               if(msg_s->mail->body->plain)remove(msg_s->mail->body->plain);                           
+                               free(msg_s->mail->body);
+                       }
+
+                       if(msg_s->mail->info)free(msg_s->mail->info);
+                       free(msg_s->mail);
+               }
+
+               if(msg_s->mbox)free(msg_s->mbox);
+
+               free(msg_s);            
+       }
+
+       
+       ret=email_service_end();
+       
+       if(ret!=EMF_ERROR_NONE){
+               LOGE("[%s] OPERATION_FAILED(0x%08x) : Finishing email service failed", __FUNCTION__, EMAIL_ERROR_OPERATION_FAILED);
+               return EMAIL_ERROR_OPERATION_FAILED;
+               }
+       
+               
+       return EMAIL_ERROR_NONE;
+}
+
+int email_set_subject (email_h msg, const char *subject)
+{
+       int len;
+       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;        
+
+       msg_s->mail->head->subject=(char*)calloc(1,sizeof(char)*strlen(subject)+1);
+
+       if(msg_s->mail->head->subject ==NULL)
+       {
+               LOGE("[%s] OUT_OF_MEMORY(0x%08x) : fail to create msg_s->mail->head->subject", __FUNCTION__, EMAIL_ERROR_OUT_OF_MEMORY);
+               return EMAIL_ERROR_OUT_OF_MEMORY;
+               }
+       
+       len =strlen(subject)+1;
+       snprintf(msg_s->mail->head->subject ,len,"%s",subject); 
+       
+       return EMAIL_ERROR_NONE;
+}
+
+int email_set_body (email_h msg, const char *body)
+{
+       int len;
+
+       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;        
+
+
+       FILE* file = NULL;
+
+       
+       file= fopen("/tmp/capimail.txt", "w");
+
+       if(file !=NULL)
+       {
+                fputs(body,file);
+                fclose(file);
+       }else
+       {
+               LOGE("[%s] OPERATION_FAILED(0x%08x) : opening file for email body failed.", __FUNCTION__, EMAIL_ERROR_OPERATION_FAILED);
+               return EMAIL_ERROR_OPERATION_FAILED;
+       }
+
+
+
+       msg_s->mail->body->plain =(char *)calloc(1,sizeof(char)*strlen("/tmp/capimail.txt")+1);
+
+       if(msg_s->mail->body->plain==NULL)return EMAIL_ERROR_OUT_OF_MEMORY;
+       
+       len =strlen("/tmp/capimail.txt")+1;
+       snprintf(msg_s->mail->body->plain,len,"%s","/tmp/capimail.txt");
+       
+       return EMAIL_ERROR_NONE;
+}
+
+
+int email_add_recipient (email_h msg, email_recipient_type_e type,const char *address)
+{
+       
+
+       char *tmp,*tmp1;
+       int total_len,in_len,pre_len,len;
+
+       if(msg ==NULL || type<EMAIL_RECIPIENT_TYPE_TO ||type>EMAIL_RECIPIENT_TYPE_BCC )
+               return EMAIL_ERROR_INVALID_PARAMETER;
+               
+       
+       email_s* msg_s = (email_s* )msg;
+       emf_mail_head_t *head = msg_s->mail->head;
+       
+       if(strlen(address)>MAX_RECIPIENT_ADDRESS_LEN)
+       {
+               LOGE("[%s] INVALID_PARAMETER(0x%08x) : The length of address should be less than 234.", __FUNCTION__, EMAIL_ERROR_INVALID_PARAMETER);
+               return EMAIL_ERROR_INVALID_PARAMETER;
+               }
+
+       if(type == EMAIL_RECIPIENT_TYPE_TO)
+       {
+               if(head->to==NULL)
+               {
+                       head->to = (char*)calloc(1,sizeof(char)*strlen(address)+2+1+1);//<>+;+end of string
+                       if(head->to==NULL)
+                       {
+                               LOGE("[%s] OUT_OF_MEMORY(0x%08x) : fail to create head->to.", __FUNCTION__, EMAIL_ERROR_OUT_OF_MEMORY);
+                               return EMAIL_ERROR_OUT_OF_MEMORY;
+                               }
+                       len =strlen(address)+2+1+1;
+                       snprintf(head->to,len,"%s%s%s","<",address,">");
+               }
+               else{
+
+                       in_len = strlen(address);
+                       pre_len = strlen(head->to);
+                       total_len = pre_len+in_len+3+1;// length of ",<>" + NULL
+                       tmp=(char*)calloc(1,sizeof(char)*total_len);
+
+                       //remove ';'
+                       tmp1 =(char*)calloc(1,sizeof(char)*pre_len+1);
+                       if(tmp1)
+                       {
+                               strncpy(tmp1,head->to,pre_len-1);
+                               tmp1[pre_len]='\0';
+                               }
+                       else
+                       {
+                               LOGE("[%s] OUT_OF_MEMORY(0x%08x) : fail to create tmp memory.", __FUNCTION__, EMAIL_ERROR_OUT_OF_MEMORY);
+                               if(tmp)free(tmp);
+                               return EMAIL_ERROR_OUT_OF_MEMORY;
+                               }
+
+                       //add new address
+                       free(head->to);
+                       head->to = (char*)calloc(1,sizeof(char)*total_len);
+                       len = total_len;
+                       snprintf(head->to,len,"%s%s%s%s",tmp1,"<",address,">");
+                       
+                       if(tmp)free(tmp);
+                       if(tmp1)free(tmp1);
+                       
+               }
+               
+       }
+       else if(type == EMAIL_RECIPIENT_TYPE_CC)//MESSAGING_RECIPIENT_TYPE_CC
+       {
+               if(head->cc==NULL)
+               {
+                       head->cc = (char*)calloc(1,sizeof(char)*strlen(address)+2+1+1);//<>+;+end of string
+                       if(head->cc==NULL)
+                       {
+                               LOGE("[%s] OUT_OF_MEMORY(0x%08x) : fail to create head->cc.", __FUNCTION__, EMAIL_ERROR_OUT_OF_MEMORY);
+                               return EMAIL_ERROR_OUT_OF_MEMORY;
+                               }
+                       len =strlen(address)+2+1+1;
+                       snprintf(head->cc,len,"%s%s%s","<",address,">");
+               }
+               else{
+
+                       in_len = strlen(address);
+                       pre_len = strlen(head->cc);
+                       total_len = pre_len+in_len+3+1;// length of ",<>" + NULL
+                       tmp=(char*)calloc(1,sizeof(char)*total_len);
+
+                       //remove ';'
+                       tmp1 =(char*)calloc(1,sizeof(char)*pre_len+1);
+                       if(tmp1)
+                       {
+                               strncpy(tmp1,head->cc,pre_len-1);
+                               tmp1[pre_len]='\0';
+                               }
+                       else{
+                               LOGE("[%s] OUT_OF_MEMORY(0x%08x) : fail to create tmp memory.", __FUNCTION__, EMAIL_ERROR_OUT_OF_MEMORY);
+                               if(tmp)free(tmp);
+                               return EMAIL_ERROR_OUT_OF_MEMORY;
+                       }
+
+                       //add new address
+                       free(head->cc);
+                       head->cc = (char*)calloc(1,sizeof(char)*total_len);
+                       len = total_len;
+                       snprintf(head->cc,len,"%s%s%s%s",tmp1,"<",address,">"); 
+
+                       if(tmp)free(tmp);
+                       if(tmp1)free(tmp1);
+               }
+               
+       }
+       else //MESSAGING_RECIPIENT_TYPE_BCC
+       {
+               if(head->bcc==NULL)
+               {
+                       head->bcc = (char*)calloc(1,sizeof(char)*strlen(address)+2+1+1);//<>+;+end of string
+                       if(head->bcc==NULL)
+                       {
+                               LOGE("[%s] OUT_OF_MEMORY(0x%08x) : fail to create head->bcc.", __FUNCTION__, EMAIL_ERROR_OUT_OF_MEMORY);
+                               return EMAIL_ERROR_OUT_OF_MEMORY;
+                               }
+                       len =strlen(address)+2+1+1;
+                       snprintf(head->bcc,len,"%s%s%s","<",address,">");
+               }
+               else{
+
+                       in_len = strlen(address);
+                       pre_len = strlen(head->bcc);
+                       total_len = pre_len+in_len+3+1;// length of ",<>" + NULL
+                       tmp=(char*)calloc(1,sizeof(char)*total_len);
+
+                       //remove ';'
+                       tmp1 =(char*)calloc(1,sizeof(char)*pre_len+1);
+                       if(tmp1)
+                       {
+                               strncpy(tmp1,head->bcc,pre_len-1);
+                               tmp1[pre_len]='\0';
+                               }
+                       else{
+                               LOGE("[%s] OUT_OF_MEMORY(0x%08x) : fail to create tmp memory.", __FUNCTION__, EMAIL_ERROR_OUT_OF_MEMORY);
+                               if(tmp)free(tmp);
+                               return EMAIL_ERROR_OUT_OF_MEMORY;
+                               }
+
+                       //add new address
+                       free(head->bcc);
+                       head->bcc = (char*)calloc(1,sizeof(char)*total_len);
+                       len = total_len;
+                       snprintf(head->bcc,len,"%s%s%s%s",tmp1,"<",address,">"); 
+
+                       if(tmp)free(tmp);
+                       if(tmp1)free(tmp1);
+               }
+       }
+
+       
+
+       return EMAIL_ERROR_NONE;
+}
+
+int email_remove_all_recipients (email_h msg)
+{
+       if(msg ==NULL)
+       {
+               LOGE("[%s] INVALID_PARAMETER(0x%08x) : fail to create tmp memory.", __FUNCTION__, EMAIL_ERROR_INVALID_PARAMETER);
+               return EMAIL_ERROR_INVALID_PARAMETER;
+               }
+       
+       email_s* msg_s = (email_s* )msg;
+
+       emf_mail_head_t *head = msg_s->mail->head;
+       if(head->to !=NULL)
+       {
+               free(head->to);
+               head->to = NULL;
+       }
+
+       if(head->cc !=NULL)
+       {
+               free(head->cc);
+               head->cc = NULL;
+       }
+
+       if(head->bcc !=NULL)
+       {
+               free(head->bcc);
+               head->bcc = NULL;
+       }
+       return EMAIL_ERROR_NONE;
+}
+
+
+int email_add_attach (email_h msg, const char *filepath)
+{
+       int i,len;
+       char *pos,*last;
+       struct stat st;
+       
+
+       if(msg ==NULL ||filepath == NULL)
+       {
+               LOGE("[%s] INVALID_PARAMETER(0x%08x) : msg or filepath is null.", __FUNCTION__, EMAIL_ERROR_INVALID_PARAMETER);
+               return EMAIL_ERROR_INVALID_PARAMETER;
+               }
+               
+       email_s* msg_s = (email_s* )msg;
+
+       emf_attachment_info_t*  new_attach,* tmp_attach,* next_attach;
+       emf_mail_body_t* body = msg_s->mail->body;      
+
+
+       stat(filepath,&st);
+
+       if(st.st_size > 10*1024*1024)
+       {
+               LOGE("[%s] INVALID_PARAMETER(0x%08x) : the size of attachment file is beyond the limit(MAX:10M).", __FUNCTION__, EMAIL_ERROR_INVALID_PARAMETER);
+               return EMAIL_ERROR_INVALID_PARAMETER;
+               }
+       
+       new_attach =(emf_attachment_info_t *)calloc(1,sizeof(emf_attachment_info_t));
+
+
+       pos=strpbrk(filepath,"//");
+
+       len =strlen(filepath); 
+       
+       if(pos==NULL)
+       {
+               new_attach->name =(char*)calloc(1,sizeof(char)*len+1);
+               snprintf(new_attach->name,len,"%s",filepath); 
+               }
+       else
+       {
+               while(pos!=NULL)
+               {
+                       last=pos;
+                       pos=strpbrk(pos,"//");  
+                       if(pos!=NULL)pos++;
+                       }
+               
+               new_attach->name =last;
+               
+               }
+       new_attach->savename =(char*)calloc(1,sizeof(char)*len+1);
+       
+       if(new_attach->savename==NULL)return EMAIL_ERROR_OUT_OF_MEMORY;
+       
+       snprintf(new_attach->savename,len,"%s",filepath); 
+       new_attach->size = st.st_size;
+       new_attach->downloaded = 1;
+
+       if(body->attachment_num ==0){
+
+               body->attachment = new_attach;
+       }       
+       else{
+               next_attach=body->attachment;
+               
+               for(i=0;i<body->attachment_num;i++)
+               {
+                       tmp_attach =next_attach->next;
+                       next_attach =tmp_attach;
+               }
+       }
+
+       body->attachment_num ++;
+
+       return EMAIL_ERROR_NONE;
+
+}
+
+int email_remove_all_attachments (email_h msg)
+{
+       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;
+       emf_mail_body_t* body = msg_s->mail->body;
+       if(body->attachment != NULL)
+       {
+               free(body->attachment);
+               }
+       return EMAIL_ERROR_NONE;
+}
+
+
+int email_send_message (email_h msg)
+{
+       int ret;
+       emf_option_t option;
+       unsigned  handle;
+
+       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;
+
+       
+       {
+               /*--------- head ----------*/
+               LOGD_IF(DBG_MODE, " ----------head---------");
+               LOGD_IF(DBG_MODE, "  mid: %s\n",msg_s->mail->head->mid);
+               LOGD_IF(DBG_MODE, "  subject: %s\n",msg_s->mail->head->subject);
+               LOGD_IF(DBG_MODE, "  to: %s\n",msg_s->mail->head->to);
+               LOGD_IF(DBG_MODE, "  from: %s\n",msg_s->mail->head->from);
+               LOGD_IF(DBG_MODE, "  cc: %s\n",msg_s->mail->head->cc);
+               LOGD_IF(DBG_MODE, "  bcc: %s\n",msg_s->mail->head->bcc);
+               LOGD_IF(DBG_MODE, "  reply_to: %s\n",msg_s->mail->head->reply_to);
+               LOGD_IF(DBG_MODE, "  return_path: %s\n",msg_s->mail->head->return_path);
+               LOGD_IF(DBG_MODE, "  from_contact_name: %s\n",msg_s->mail->head->from_contact_name);
+               LOGD_IF(DBG_MODE, "  to_contact_name: %s\n",msg_s->mail->head->to_contact_name);
+               LOGD_IF(DBG_MODE, "  cc_contact_name: %s\n",msg_s->mail->head->cc_contact_name);
+               LOGD_IF(DBG_MODE, "  bcc_contact_name: %s\n",msg_s->mail->head->bcc_contact_name);
+               LOGD_IF(DBG_MODE, "  previewBodyText: %s\n",msg_s->mail->head->previewBodyText);
+
+               LOGD_IF(DBG_MODE, "  year: %d\n",msg_s->mail->head->datetime.year);
+               LOGD_IF(DBG_MODE, "  month: %d\n",msg_s->mail->head->datetime.month);
+               LOGD_IF(DBG_MODE, "  day: %d\n",msg_s->mail->head->datetime.day);
+               LOGD_IF(DBG_MODE, "  hour: %d\n",msg_s->mail->head->datetime.hour);
+               LOGD_IF(DBG_MODE, "  minute: %d\n",msg_s->mail->head->datetime.minute);
+               LOGD_IF(DBG_MODE, "  second: %d\n",msg_s->mail->head->datetime.second);
+
+               /*--------- body ----------*/
+               LOGD_IF(DBG_MODE, " ----------body---------");
+               LOGD_IF(DBG_MODE, "  body\n");
+               LOGD_IF(DBG_MODE, "  plain: %s\n",msg_s->mail->body->plain);
+               LOGD_IF(DBG_MODE, "  plain_charset: %s\n",msg_s->mail->body->plain_charset);
+               LOGD_IF(DBG_MODE, "  html: %s\n",msg_s->mail->body->html);
+               LOGD_IF(DBG_MODE, "  attachment_num: %d\n",msg_s->mail->body->attachment_num);
+               if(msg_s->mail->body->attachment!=NULL)
+               {
+                       LOGD_IF(DBG_MODE, " ----------attachment---------");
+                       LOGD_IF(DBG_MODE, "  name: %s\n",msg_s->mail->body->attachment->name);
+                       LOGD_IF(DBG_MODE, "  savename: %s\n",msg_s->mail->body->attachment->savename);
+                       LOGD_IF(DBG_MODE, "  downloaded: %d\n",msg_s->mail->body->attachment->downloaded);
+                       LOGD_IF(DBG_MODE, "  size: %d\n",msg_s->mail->body->attachment->size);
+                       }
+       
+       }
+
+       {
+                       /*--------- info ----------*/
+               LOGD_IF(DBG_MODE, " ----------info---------");
+               LOGD_IF(DBG_MODE, "  emf_mail_info_t \n");
+               LOGD_IF(DBG_MODE, "  account_id: %d\n",msg_s->mail->info->account_id);
+               LOGD_IF(DBG_MODE, "  uid: %d\n",msg_s->mail->info->uid);
+               LOGD_IF(DBG_MODE, "  rfc822_size: %d\n",msg_s->mail->info->rfc822_size);
+               LOGD_IF(DBG_MODE, "  body_downloaded: %d\n",msg_s->mail->info->body_downloaded);
+               LOGD_IF(DBG_MODE, "  sid: %s\n",msg_s->mail->info->sid);
+               LOGD_IF(DBG_MODE, "   is_meeting_request: %d\n",msg_s->mail->info->is_meeting_request); 
+       }
+
+       
+       {
+               emf_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, "  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_message(msg_s->mail, msg_s->mbox, 1);
+
+       ret=_email_error_converter(ret);
+       
+       option.keep_local_copy = 1;
+
+       ret=email_send_mail(msg_s->mbox, msg_s->mail->info->uid, &option, &handle);
+
+
+       ret=_email_error_converter(ret);
+       _email_add_dbus_filter();
+       return ret;
+}
+
+
+email_cb_context * _email_search_callback_by_emailid(int mailid)
+{
+       int count;
+       int ntmp=0;
+       GSList * node;
+       email_cb_context *cbContext;
+       count = g_slist_length( gEmailcbList );
+
+       while( count )
+       {
+               node = g_slist_nth( gEmailcbList, ntmp );
+                       
+                       if( node == NULL )
+                               break;
+                       
+                       cbContext= (email_cb_context *)node->data; 
+                       if(cbContext->handle->mail->info->uid == mailid)
+                       {
+                               
+                                       return cbContext;
+                       }
+                               
+                               
+               ntmp++; 
+               count--;
+       }
+
+       return NULL;
+}
+
+
+int email_set_message_sent_cb (email_h handle, email_message_sent_cb cb, void *user_data)
+{
+       int count;
+       int ntmp=0;
+       GSList * node;
+       email_cb_context *cbContext;
+       count = g_slist_length( gEmailcbList );
+
+       if(handle ==NULL || cb == NULL)return EMAIL_ERROR_INVALID_PARAMETER;
+               
+       
+       email_s* msg_s = (email_s* )handle;
+       
+       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;
+                       }
+                               
+                               
+               ntmp++; 
+               count--;
+       }
+
+       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;
+
+       gEmailcbList = g_slist_append(gEmailcbList,cbcontext);
+
+       return EMAIL_ERROR_NONE;
+}
+
+int email_unset_message_sent_cb (email_h msg)
+{
+
+       int i,count;
+       count = g_slist_length( gEmailcbList );
+       GSList * node;
+       email_cb_context *cbContext;
+
+       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;
+       for( i=0;i<count;i++)
+       {
+               node = g_slist_nth( gEmailcbList, i );
+               if( node == NULL )
+               break;
+               
+               
+               cbContext= (email_cb_context *)node->data; 
+               if(cbContext->handle == msg_s)
+               {       
+                       gEmailcbList= g_slist_remove(gEmailcbList,node);
+                               break;
+               }
+               
+
+                       
+       }
+       return EMAIL_ERROR_NONE;
+
+
+}
+
+int _email_error_converter(int err)
+{
+       switch(err) 
+       {
+               
+
+               case EMF_ERROR_INVALID_PARAM:
+                       return EMAIL_ERROR_INVALID_PARAMETER;
+
+               case EMF_ERROR_DB_FAILURE:
+                       return EMAIL_ERROR_DB_FAILED;
+
+               case EMF_ERROR_ACCOUNT_NOT_FOUND:
+                       return EMAIL_ERROR_ACCOUNT_NOT_FOUND;
+
+               case EMF_ERROR_OUT_OF_MEMORY:
+                       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: 
+                       return EMAIL_ERROR_COMMUNICATION_WITH_SERVER_FAILED;
+
+               case EMF_ERROR_IPC_SOCKET_FAILURE:
+                       return EMAIL_ERROR_COMMUNICATION_WITH_SERVER_FAILED;
+
+               case EMF_ERROR_NONE:
+                       return EMAIL_ERROR_NONE;
+
+
+               default:
+                       LOGE("[%s] OPERATION_FAILED(0x%08x) : Error from Email F/W. ret: (0x%08x) ", __FUNCTION__, EMAIL_ERROR_OPERATION_FAILED,err);
+                       return EMAIL_ERROR_OPERATION_FAILED;
+
+
+
+       
+
+       }
+}
+
+
+
+static void _monitorSendStatusCb(void* data, DBusMessage *message)
+{
+       DBusError error;
+       email_cb_context *cbContext = NULL;
+       if(dbus_message_is_signal(message, "User.Email.NetworkStatus", "email"))
+       {
+               dbus_error_init(&error);
+
+               int status=0;
+               int accountid=0;
+               char* fileid=NULL;
+               int mailid=0;
+               int errorcode=0;
+               if(dbus_message_get_args(message, &error, 
+                       DBUS_TYPE_INT32, &status, 
+                       DBUS_TYPE_INT32, &accountid, 
+                       DBUS_TYPE_STRING, &fileid, 
+                       DBUS_TYPE_INT32, &mailid,
+                       DBUS_TYPE_INT32, &errorcode,
+                       DBUS_TYPE_INVALID))
+                       {
+
+
+                               cbContext = _email_search_callback_by_emailid(mailid);
+                               if(cbContext == NULL)
+                                       {
+                                               LOGD_IF(DBG_MODE, "no callback matched!\n");
+                               }else{
+                                       
+                                               switch (status) {
+                                                       case NOTI_SEND_START:
+                                                               break;
+                                                               
+                                                       case NOTI_SEND_FAIL:
+
+                                                                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:
+                                                                   
+                                                                   break;
+
+                                                               default:
+                                                                                               ;
+                                                            }
+                                                               
+                                                                cbContext->callback((email_h)cbContext->handle,(email_sending_e)EMAIL_SENDING_FAILED ,cbContext->user_data);
+                                                               break;
+
+                                                       case NOTI_SEND_FINISH:
+                                                               cbContext->callback((email_h)cbContext->handle,(email_sending_e)EMAIL_SENDING_SUCCEEDED ,cbContext->user_data);
+                                                               break;
+                                       
+                                               }
+                                       }
+                       }
+       }
+}
+void _email_add_dbus_filter(void)
+{
+       
+       E_DBus_Connection* connection=NULL;
+       DBusError error;
+       E_DBus_Signal_Handler *handler = NULL;
+       
+
+       dbus_error_init(&error);
+
+       connection = e_dbus_bus_get(DBUS_BUS_SYSTEM);
+
+       if (NULL == connection) {
+       }
+
+       if(e_dbus_request_name(connection, "User.Email.NetworkStatus",
+                                    0,
+                                    NULL,
+                                    NULL) == NULL)
+       {
+               LOGD_IF(DBG_MODE, "Failed in e_dbus_request_name()\n");
+       }
+
+        handler = e_dbus_signal_handler_add(connection,
+                       NULL,
+                       "/User/Email/NetworkStatus", 
+                       "User.Email.NetworkStatus", 
+                       "email",
+                       _monitorSendStatusCb, 
+                       NULL);
+
+       if(handler == NULL)
+       {
+               LOGD_IF(DBG_MODE, "Failed in e_dbus_signal_handler_add()");
+       }
+}
\ No newline at end of file