diff options
author | Sunghyun Kwon <sh0701.kwon@samsung.com> | 2014-02-20 14:58:45 +0900 |
---|---|---|
committer | Sunghyun Kwon <sh0701.kwon@samsung.com> | 2014-02-20 14:58:45 +0900 |
commit | cc2e0476a3397d0f8f76960a119f240b4ad01699 (patch) | |
tree | b75c921ec1f8ba2e8b3019df5b6c228d58b6befa /utilities | |
parent | 7e2c216892ac4d1ae8b4ec838f61f6213099b6e8 (diff) | |
download | email-service-cc2e0476a3397d0f8f76960a119f240b4ad01699.tar.gz email-service-cc2e0476a3397d0f8f76960a119f240b4ad01699.tar.bz2 email-service-cc2e0476a3397d0f8f76960a119f240b4ad01699.zip |
Merge the email-service to version 2.2
Change-Id: I26816a6b43c134a80e64c6051f8e1205df672ff7
Signed-off-by: Sunghyun Kwon <sh0701.kwon@samsung.com>
Diffstat (limited to 'utilities')
-rwxr-xr-x | utilities/CMakeLists.txt | 7 | ||||
-rwxr-xr-x | utilities/test-application/include/testapp-utility.h | 1 | ||||
-rwxr-xr-x | utilities/test-application/main.c | 8 | ||||
-rwxr-xr-x | utilities/test-application/testapp-account.c | 155 | ||||
-rwxr-xr-x | utilities/test-application/testapp-mail.c | 237 | ||||
-rwxr-xr-x | utilities/test-application/testapp-mailbox.c | 85 | ||||
-rwxr-xr-x | utilities/test-application/testapp-others.c | 27 | ||||
-rwxr-xr-x | utilities/test-application/testapp-utility.c | 22 |
8 files changed, 470 insertions, 72 deletions
diff --git a/utilities/CMakeLists.txt b/utilities/CMakeLists.txt index 945d38f..2a04870 100755 --- a/utilities/CMakeLists.txt +++ b/utilities/CMakeLists.txt @@ -12,8 +12,7 @@ MESSAGE(">>> current directory: ${CMAKE_CURRENT_SOURCE_DIR}") MESSAGE(">>> Build type: ${CMAKE_BUILD_TYPE}") SET(VISIBILITY "-DEXPORT_API=\"__attribute__((visibility(\\\"default\\\")))\"") -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VISIBILITY} -fvisibility=hidden ") -ADD_DEFINITIONS("-DLIBPATH=\"${LIB_INSTALL_DIR}\"") +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VISIBILITY} -fvisibility=hidden") ########################################################## # Define Test App @@ -41,7 +40,7 @@ INCLUDE_DIRECTORIES( ) INCLUDE(FindPkgConfig) -pkg_check_modules(test_app_pkgs REQUIRED glib-2.0 gthread-2.0 vconf db-util uw-imap-toolkit contacts-service2 drm-client) +pkg_check_modules(test_app_pkgs REQUIRED glib-2.0 gthread-2.0 vconf db-util uw-imap-toolkit contacts-service2 drm-client pmapi) FOREACH(flag ${test_app_pkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") @@ -51,7 +50,7 @@ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed") ADD_EXECUTABLE(email-test-app ${TEST-APP-SRCS}) -TARGET_LINK_LIBRARIES(email-test-app ${test_app_pkgs_LDFLAGS} email-api) +TARGET_LINK_LIBRARIES(email-test-app ${test_app_pkgs_LDFLAGS} email-api email-smime-api) INSTALL(TARGETS email-test-app DESTINATION bin) diff --git a/utilities/test-application/include/testapp-utility.h b/utilities/test-application/include/testapp-utility.h index 45f14e2..3b5a6a2 100755 --- a/utilities/test-application/include/testapp-utility.h +++ b/utilities/test-application/include/testapp-utility.h @@ -35,6 +35,7 @@ typedef enum EMAIL_RULE_MENU, EMAIL_THREAD_MENU, EMAIL_OTHERS_MENU, + EMAIL_GMIME_MENU } eEMAIL_MENU; diff --git a/utilities/test-application/main.c b/utilities/test-application/main.c index 7cdec48..27cbfdd 100755 --- a/utilities/test-application/main.c +++ b/utilities/test-application/main.c @@ -41,6 +41,9 @@ #include "testapp-rule.h" #include "testapp-thread.h" #include "testapp-others.h" +#ifdef __FEATURE_USE_GMIME__ +#include "testapp-gmime.h" +#endif /* __FEATURE_USE_GMIME__ */ #include "db-util.h" /* function prototype */ @@ -162,6 +165,11 @@ static gboolean testapp_interpret_command (int menu_number) case 7: testapp_others_main(); break; +#ifdef __FEATURE_USE_GMIME__ + case 8: + testapp_gmime_main(); + break; +#endif /* __FEATURE_USE_GMIME__ */ case 0: go_to_loop = FALSE; break; diff --git a/utilities/test-application/testapp-account.c b/utilities/test-application/testapp-account.c index 2b2d94e..c1b121b 100755 --- a/utilities/test-application/testapp-account.c +++ b/utilities/test-application/testapp-account.c @@ -28,6 +28,7 @@ #include <glib.h> #include "email-api.h" +#include "email-api-smime.h" #include "email-api-account.h" #include "email-api-network.h" @@ -59,7 +60,8 @@ gboolean testapp_create_account_object(email_account_t **result_account) { email_account_t *account = NULL; - char id_string[100] = { 0, }, password_string[100] = { 0, }, address_string[100] = { 0, }; + char id_string[100] = { 0, }, password_string[1000] = { 0, }, address_string[100] = { 0, }; + char accesss_token[1000] = { 0, }, refresh_token[1000] = { 0, }; int samsung3g_account_index; int result_from_scanf = 0; int account_type; @@ -76,6 +78,9 @@ gboolean testapp_create_account_object(email_account_t **result_account) testapp_print("11. Daum (IMAP4)\n"); testapp_print("12. Daum (POP3)\n"); testapp_print("13. Yahoo (IMAP ID)\n"); + testapp_print("14. Gmail IMAP with XOAUTH\n"); + testapp_print("15. Yandex\n"); + testapp_print("16. mopera\n"); testapp_print("Choose server type: "); result_from_scanf = scanf("%d",&account_type); @@ -89,7 +94,20 @@ gboolean testapp_create_account_object(email_account_t **result_account) }while( samsung3g_account_index > 10 || samsung3g_account_index < 1); sprintf(id_string, "test%02d", samsung3g_account_index); sprintf(address_string, "test%02d@streaming.s3glab.net", samsung3g_account_index); - strcpy(password_string, id_string); + sprintf(password_string, "test%02d", samsung3g_account_index); + break; + case 14 : + testapp_print("Enter email address : "); + result_from_scanf = scanf("%s", address_string); + strcpy(id_string, address_string); + + testapp_print("Enter access token : "); + result_from_scanf = scanf("%s", accesss_token); + + testapp_print("Enter refresh token : "); + result_from_scanf = scanf("%s", refresh_token); + + snprintf(password_string, 100, "%s\001%s\001", accesss_token, refresh_token); break; default: testapp_print("Enter email address : "); @@ -121,8 +139,10 @@ gboolean testapp_create_account_object(email_account_t **result_account) account->outgoing_server_type = EMAIL_SERVER_TYPE_SMTP; account->auto_download_size = 2; account->outgoing_server_use_same_authenticator = 1; + account->auto_resend_times = 3; account->pop_before_smtp = 0; account->incoming_server_requires_apop = 0; + account->incoming_server_authentication_method = 0; account->logo_icon_path = NULL; account->user_data = malloc (data_length); memcpy( account->user_data, (void*) &data, data_length ); @@ -144,6 +164,11 @@ gboolean testapp_create_account_object(email_account_t **result_account) account->check_interval = 0; account->keep_mails_on_pop_server_after_download = 1; account->default_mail_slot_size = 200; + account->roaming_option = EMAIL_ROAMING_OPTION_RESTRICTED_BACKGROUND_TASK; + account->peak_interval = 30; + account->peak_days = EMAIL_PEAK_DAYS_MONDAY | EMAIL_PEAK_DAYS_TUEDAY | EMAIL_PEAK_DAYS_THUDAY | EMAIL_PEAK_DAYS_FRIDAY; + account->peak_start_time = 830; + account->peak_end_time = 1920; account->account_name = strdup(address_string); account->user_display_name = strdup(id_string); @@ -213,13 +238,14 @@ gboolean testapp_create_account_object(email_account_t **result_account) case 7 : /* Gmail IMAP4 */ account->incoming_server_type = EMAIL_SERVER_TYPE_IMAP4; - account->incoming_server_address= strdup("imap.gmail.com"); + account->incoming_server_address = strdup("imap.gmail.com"); account->incoming_server_port_number = 993; account->incoming_server_secure_connection = 1; - account->outgoing_server_address = strdup("smtp.gmail.com"); + account->outgoing_server_address = strdup("smtp.gmail.com"); account->outgoing_server_port_number = 465; account->outgoing_server_secure_connection = 1; - account->outgoing_server_need_authentication = 1; + account->outgoing_server_need_authentication = EMAIL_AUTHENTICATION_METHOD_DEFAULT; + account->incoming_server_authentication_method = EMAIL_AUTHENTICATION_METHOD_NO_AUTH; break; case 8: /* Active Sync */ @@ -288,6 +314,42 @@ gboolean testapp_create_account_object(email_account_t **result_account) account->outgoing_server_need_authentication = 1; break; + case 14 : /* XOAUTH */ + account->incoming_server_type = EMAIL_SERVER_TYPE_IMAP4; + account->incoming_server_address = strdup("imap.gmail.com"); + account->incoming_server_port_number = 993; + account->incoming_server_secure_connection = 1; + account->outgoing_server_address = strdup("smtp.gmail.com"); + account->outgoing_server_port_number = 465; + account->outgoing_server_secure_connection = 1; + account->outgoing_server_need_authentication = EMAIL_AUTHENTICATION_METHOD_XOAUTH2; + account->incoming_server_authentication_method = EMAIL_AUTHENTICATION_METHOD_XOAUTH2; + break; + + case 15 : /* yandex */ + account->incoming_server_type = EMAIL_SERVER_TYPE_IMAP4; + account->incoming_server_address = strdup("imap.yandex.ru"); + account->incoming_server_port_number = 993; + account->incoming_server_secure_connection = 1; + account->outgoing_server_address = strdup("smtp.yandex.ru"); + account->outgoing_server_port_number = 465; + account->outgoing_server_secure_connection = 1; + account->outgoing_server_need_authentication = EMAIL_AUTHENTICATION_METHOD_DEFAULT; + account->incoming_server_authentication_method = EMAIL_AUTHENTICATION_METHOD_DEFAULT; + break; + + case 16 : /* mopera */ + account->incoming_server_type = EMAIL_SERVER_TYPE_POP3; + account->incoming_server_address = strdup("mail.mopera.net"); + account->incoming_server_port_number = 110; + account->incoming_server_secure_connection = 0; + account->incoming_server_authentication_method = EMAIL_AUTHENTICATION_METHOD_NO_AUTH; + account->outgoing_server_address = strdup("mail.mopera.net"); + account->outgoing_server_port_number = 465; + account->outgoing_server_secure_connection = 0; + account->outgoing_server_need_authentication = EMAIL_AUTHENTICATION_METHOD_DEFAULT; + break; + default: testapp_print("Invalid Account Number\n"); return FALSE; @@ -342,14 +404,12 @@ static gboolean testapp_test_update_account() testapp_print("\n>> Enter Account No: "); result_from_scanf = scanf("%d",&account_id); -/* sowmya.kr, 281209 Adding signature to options in email_account_t changes */ if( (err = email_get_account(account_id, GET_FULL_DATA,&account)) != EMAIL_ERROR_NONE) { testapp_print ("email_get_account failed - %d\n", err); return false; } testapp_print ("email_get_account result account_name - %s \n", account->account_name); - testapp_print ("email_get_account result signature - %s \n", account->options.signature); #ifdef __FEATURE_AUTO_POLLING__ @@ -365,6 +425,18 @@ static gboolean testapp_test_update_account() #ifdef __FEATURE_AUTO_POLLING__ testapp_print("\n Enter new check interval (in mins):"); result_from_scanf = scanf("%d",&(account->check_interval)); + + testapp_print("\n Enter new peak interval (in mins):"); + result_from_scanf = scanf("%d",&(account->peak_interval)); + + testapp_print("\n Enter new peak days:"); + result_from_scanf = scanf("%d",&(account->peak_days)); + + testapp_print("\n Enter new peak start time:"); + result_from_scanf = scanf("%d",&(account->peak_start_time)); + + testapp_print("\n Enter new peak end time:"); + result_from_scanf = scanf("%d",&(account->peak_end_time)); #endif testapp_print("\n Enter new signature:"); result_from_scanf = scanf("%s",signature); @@ -521,6 +593,13 @@ static gboolean testapp_test_get_account() "index_color %d\n" "certificate_path %s\n" "digest_type %d\n" + "auto_resend_times %d\n" + "roaming_option %d\n" + + "peak_interval %d\n" + "peak_days %d\n" + "peak_start_time %d\n" + "peak_end_time %d\n" , account->account_name, account->user_email_address, @@ -537,7 +616,13 @@ static gboolean testapp_test_get_account() is_preset_account, index_color, account->certificate_path, - account->digest_type + account->digest_type, + account->auto_resend_times, + account->roaming_option, + account->peak_interval, + account->peak_days, + account->peak_start_time, + account->peak_end_time ); err_code = email_free_account(&account, 1); @@ -849,6 +934,56 @@ static gboolean testapp_test_add_account() return true; } +static gboolean testapp_test_update_peak_schedule() +{ + int result_from_scanf = 0; + int account_id; + email_account_t *account = NULL; + int err = EMAIL_ERROR_NONE; + + testapp_print("\n>> Enter Account No: "); + result_from_scanf = scanf("%d",&account_id); + + if( (err = email_get_account(account_id, GET_FULL_DATA, &account)) != EMAIL_ERROR_NONE) { + testapp_print ("email_get_account failed [%d]\n", err); + return false; + } + + testapp_print ("old check_interval - %d \n", account->check_interval); + + testapp_print("\n Enter new check interval (in mins):"); + result_from_scanf = scanf("%d",&(account->check_interval)); + + testapp_print ("old peak_interval - %d \n", account->peak_interval); + + testapp_print("\n Enter new peak interval (in mins):"); + result_from_scanf = scanf("%d",&(account->peak_interval)); + + testapp_print ("old peak_days - %d \n", account->peak_days); + + testapp_print("\n Enter new peak days:"); + result_from_scanf = scanf("%d",&(account->peak_days)); + + testapp_print ("old peak_start_time - %d \n", account->peak_start_time); + + testapp_print("\n Enter new peak start time:"); + result_from_scanf = scanf("%d",&(account->peak_start_time)); + + testapp_print ("old peak_end_time - %d \n", account->peak_start_time); + + testapp_print("\n Enter new peak end time:"); + result_from_scanf = scanf("%d",&(account->peak_end_time)); + + if( account ) { + if((err = email_update_account(account_id, account)) != EMAIL_ERROR_NONE) { + testapp_print ("email_update_account failed [%d]\n", err); + return false; + } + testapp_print ("email_update_account successful \n"); + } + return true; +} + static gboolean testapp_test_interpret_command (int selected_number) { gboolean go_to_loop = TRUE; @@ -930,6 +1065,10 @@ static gboolean testapp_test_interpret_command (int selected_number) testapp_test_add_account(); break; + case 20: + testapp_test_update_peak_schedule(); + break; + case 0: go_to_loop = FALSE; break; diff --git a/utilities/test-application/testapp-mail.c b/utilities/test-application/testapp-mail.c index f65e426..add534f 100755 --- a/utilities/test-application/testapp-mail.c +++ b/utilities/test-application/testapp-mail.c @@ -140,17 +140,18 @@ static gboolean testapp_add_mail_for_sending (int *result_mail_id) SNPRINTF(from_address, 300, "<%s>", account_data->user_email_address); - test_mail_data->account_id = account_id; - test_mail_data->save_status = 1; - test_mail_data->body_download_status = 1; - test_mail_data->flags_seen_field = 1; - test_mail_data->file_path_plain = strdup(body_file_path); - test_mail_data->mailbox_id = mailbox_data->mailbox_id; - test_mail_data->mailbox_type = mailbox_data->mailbox_type; - test_mail_data->full_address_from = strdup(from_address); - test_mail_data->full_address_to = strdup(receipient_address); - test_mail_data->subject = strdup("Read receipt request from TIZEN"); - test_mail_data->report_status = EMAIL_MAIL_REQUEST_DSN | EMAIL_MAIL_REQUEST_MDN; + test_mail_data->account_id = account_id; + test_mail_data->save_status = EMAIL_MAIL_STATUS_SEND_DELAYED; + test_mail_data->body_download_status = 1; + test_mail_data->flags_seen_field = 1; + test_mail_data->file_path_plain = strdup(body_file_path); + test_mail_data->mailbox_id = mailbox_data->mailbox_id; + test_mail_data->mailbox_type = mailbox_data->mailbox_type; + test_mail_data->full_address_from = strdup(from_address); + test_mail_data->full_address_to = strdup(receipient_address); + test_mail_data->subject = strdup("Read receipt request from TIZEN"); + test_mail_data->remaining_resend_times = 3; + test_mail_data->report_status = EMAIL_MAIL_REQUEST_DSN | EMAIL_MAIL_REQUEST_MDN; body_file = fopen(body_file_path, "w"); @@ -222,20 +223,21 @@ static gboolean testapp_test_add_mail (int *result_mail_id) testapp_print("\n From EAS? [0/1]> "); result_from_scanf = scanf("%d", &from_eas); - test_mail_data->account_id = account_id; - test_mail_data->save_status = 1; - test_mail_data->body_download_status = 1; - test_mail_data->flags_seen_field = 1; - test_mail_data->file_path_plain = strdup(body_file_path); - test_mail_data->mailbox_id = mailbox_id; - test_mail_data->mailbox_type = mailbox_data->mailbox_type; - test_mail_data->full_address_from = strdup("<test1@test.com>"); - test_mail_data->full_address_to = strdup("<test2@test.com>"); - test_mail_data->full_address_cc = strdup("<test3@test.com>"); - test_mail_data->full_address_bcc = strdup("<test4@test.com>"); - test_mail_data->subject = strdup("Meeting request mail"); - test_mail_data->eas_data = strdup("EAS DATA TEST"); - test_mail_data->eas_data_length = strlen(test_mail_data->eas_data) + 1; + test_mail_data->account_id = account_id; + test_mail_data->save_status = 1; + test_mail_data->body_download_status = 1; + test_mail_data->flags_seen_field = 1; + test_mail_data->file_path_plain = strdup(body_file_path); + test_mail_data->mailbox_id = mailbox_id; + test_mail_data->mailbox_type = mailbox_data->mailbox_type; + test_mail_data->full_address_from = strdup("<test1@test.com>"); + test_mail_data->full_address_to = strdup("<test2@test.com>"); + test_mail_data->full_address_cc = strdup("<test3@test.com>"); + test_mail_data->full_address_bcc = strdup("<test4@test.com>"); + test_mail_data->subject = strdup("Meeting request mail"); + test_mail_data->remaining_resend_times = 3; + test_mail_data->eas_data = strdup("EAS DATA TEST"); + test_mail_data->eas_data_length = strlen(test_mail_data->eas_data) + 1; body_file = fopen(body_file_path, "w"); @@ -361,7 +363,7 @@ static gboolean testapp_test_update_mail() if (test_mail_data->attachment_count > 0) { if ( (err = email_get_attachment_data_list(mail_id, &test_attachment_data_list, &test_attachment_data_count)) != EMAIL_ERROR_NONE ) { - testapp_print("email_get_meeting_request() failed [%d]\n", err); + testapp_print("email_get_attachment_data_list() failed [%d]\n", err); goto FINISH_OFF; } } @@ -456,13 +458,13 @@ static gboolean testapp_test_get_mails() /* Get mail list */ if(mailbox_id == 0) { - testapp_print("Calling email_get_mail_list for all mailbox.\n"); + testapp_print("Calling email_get_mails for all mailbox.\n"); err_code = email_get_mails(account_id, 0, list_type, start_index, limit_count, sorting, mails_pointer, &count); if ( err_code < 0) testapp_print("email_get_mails failed - err[%d]\n", err_code); } else { - testapp_print("Calling email_get_mail_list for %d mailbox_id.\n", mailbox_id); + testapp_print("Calling email_get_mails for %d mailbox_id.\n", mailbox_id); err_code = email_get_mails(account_id, mailbox_id, list_type, start_index, limit_count, sorting, mails_pointer, &count); if ( err_code < 0) testapp_print("email_get_mails failed - err[%d]\n", err_code); @@ -553,21 +555,44 @@ static gboolean testapp_test_get_mail_list_ex() filter_list = malloc(sizeof(email_list_filter_t) * filter_rule_count); memset(filter_list, 0 , sizeof(email_list_filter_t) * filter_rule_count); - filter_list[0].list_filter_item_type = EMAIL_LIST_FILTER_ITEM_RULE_FTS; - filter_list[0].list_filter_item.rule_fts.target_attribute = EMAIL_MAIL_TEXT_ATTRIBUTE_FULL_TEXT; - filter_list[0].list_filter_item.rule_fts.rule_type = EMAIL_LIST_FILTER_RULE_MATCH; - filter_list[0].list_filter_item.rule_fts.key_value.string_type_value = strdup("ieee"); + filter_list[0].list_filter_item_type = EMAIL_LIST_FILTER_ITEM_RULE; + filter_list[0].list_filter_item.rule.target_attribute = EMAIL_MAIL_ATTRIBUTE_ACCOUNT_ID; + filter_list[0].list_filter_item.rule.rule_type = EMAIL_LIST_FILTER_RULE_EQUAL; + filter_list[0].list_filter_item.rule.key_value.integer_type_value = 1; + filter_list[0].list_filter_item.rule.case_sensitivity = false; + + filter_list[1].list_filter_item_type = EMAIL_LIST_FILTER_ITEM_OPERATOR; + filter_list[1].list_filter_item.operator_type = EMAIL_LIST_FILTER_OPERATOR_AND; + + filter_list[2].list_filter_item_type = EMAIL_LIST_FILTER_ITEM_RULE; + filter_list[2].list_filter_item.rule.target_attribute = EMAIL_MAIL_ATTRIBUTE_MAILBOX_TYPE; + filter_list[2].list_filter_item.rule.rule_type = EMAIL_LIST_FILTER_RULE_EQUAL; + filter_list[2].list_filter_item.rule.key_value.integer_type_value = EMAIL_MAILBOX_TYPE_INBOX; + filter_list[2].list_filter_item.rule.case_sensitivity = false; + + /*filter_list[0].list_filter_item_type = EMAIL_LIST_FILTER_ITEM_RULE_ATTACH; + filter_list[0].list_filter_item.rule_attach.target_attribute = EMAIL_MAIL_ATTACH_ATTRIBUTE_ATTACHMENT_NAME; + filter_list[0].list_filter_item.rule_attach.rule_type = EMAIL_LIST_FILTER_RULE_INCLUDE; + filter_list[0].list_filter_item.rule_attach.key_value.string_type_value = strdup("test"); + filter_list[0].list_filter_item.rule_attach.case_sensitivity = false;*/ + + /* + filter_list[0].list_filter_item_type = EMAIL_LIST_FILTER_ITEM_RULE; + filter_list[0].list_filter_item.rule_fts.target_attribute = EMAIL_MAIL_ATTRIBUTE_ACCOUNT_ID; + filter_list[0].list_filter_item.rule_fts.rule_type = EMAIL_LIST_FILTER_RULE_EQUAL; + filter_list[0].list_filter_item.rule_fts.key_value.integer_type_value = 1; filter_list[1].list_filter_item_type = EMAIL_LIST_FILTER_ITEM_OPERATOR; filter_list[1].list_filter_item.operator_type = EMAIL_LIST_FILTER_OPERATOR_OR; + filter_list[2].list_filter_item_type = EMAIL_LIST_FILTER_ITEM_RULE; filter_list[2].list_filter_item.rule.target_attribute = EMAIL_MAIL_ATTRIBUTE_SUBJECT; filter_list[2].list_filter_item.rule.rule_type = EMAIL_LIST_FILTER_RULE_INCLUDE; filter_list[2].list_filter_item.rule.key_value.string_type_value = strdup("2013"); filter_list[2].list_filter_item.rule.case_sensitivity = false; - /* + filter_list[1].list_filter_item_type = EMAIL_LIST_FILTER_ITEM_OPERATOR; filter_list[1].list_filter_item.operator_type = EMAIL_LIST_FILTER_OPERATOR_OR; @@ -620,21 +645,25 @@ static gboolean testapp_test_get_mail_list_ex() filter_list[2].list_filter_item.rule.key_value.string_type_value = strdup("INBOX"); filter_list[2].list_filter_item.rule.case_sensitivity = true; */ - sorting_rule_count = 1; + sorting_rule_count = 2; sorting_rule_list = malloc(sizeof(email_list_sorting_rule_t) * sorting_rule_count); memset(sorting_rule_list, 0 , sizeof(email_list_sorting_rule_t) * sorting_rule_count); - sorting_rule_list[0].target_attribute = EMAIL_MAIL_ATTRIBUTE_DATE_TIME; - sorting_rule_list[0].sort_order = EMAIL_SORT_ORDER_DESCEND; + sorting_rule_list[0].target_attribute = EMAIL_MAIL_ATTRIBUTE_RECIPIENT_ADDRESS; + sorting_rule_list[0].key_value.string_type_value = strdup("minsoo.kimn@gmail.com"); + sorting_rule_list[0].sort_order = EMAIL_SORT_ORDER_TO_CCBCC; - err = email_get_mail_list_ex(filter_list, filter_rule_count, sorting_rule_list, sorting_rule_count, 0, 10, &result_mail_list, &result_mail_count); + sorting_rule_list[1].target_attribute = EMAIL_MAIL_ATTRIBUTE_DATE_TIME; + sorting_rule_list[1].sort_order = EMAIL_SORT_ORDER_DESCEND; + + err = email_get_mail_list_ex(filter_list, filter_rule_count, sorting_rule_list, sorting_rule_count, -1, -1, &result_mail_list, &result_mail_count); if(err == EMAIL_ERROR_NONE) { testapp_print("email_get_mail_list_ex succeed.\n"); for(i = 0; i < result_mail_count; i++) { - testapp_print("mail_id [%d], subject [%s], full_address_from [%s]\n", result_mail_list[i].mail_id, result_mail_list[i].subject, result_mail_list[i].full_address_from); + testapp_print("mail_id [%d], subject [%s], mailbox_type [%d] full_address_from [%s]\n", result_mail_list[i].mail_id, result_mail_list[i].subject, result_mail_list[i].mailbox_type, result_mail_list[i].full_address_from); } } else { @@ -990,6 +1019,7 @@ static gboolean testapp_test_get_mail_list() for (i=0; i< count; i++) { testapp_print("\n[%d]\n", i); testapp_print(" >>> mailbox_id [ %d ] \n", mail_list[i].mailbox_id); + testapp_print(" >>> mailbox_type [ %d ] \n", mail_list[i].mailbox_type); testapp_print(" >>> mail_id [ %d ] \n", mail_list[i].mail_id); testapp_print(" >>> account_id [ %d ] \n", mail_list[i].account_id); if ( mail_list[i].full_address_from != NULL ) @@ -1410,6 +1440,7 @@ static gboolean testapp_test_get_mail_data() testapp_print("digest_type [%d]\n", mail_data->digest_type); testapp_print("smime_type [%d]\n", mail_data->smime_type); testapp_print("scheduled_sending_time [%d]\n", mail_data->scheduled_sending_time); + testapp_print("remaining_resend_times [%d]\n", mail_data->remaining_resend_times); testapp_print("eas_data_length [%d]\n", mail_data->eas_data_length); return TRUE; @@ -1540,12 +1571,58 @@ static gboolean testapp_test_download_attachment () static gboolean testapp_test_get_attachment_data_list() { + int err = EMAIL_ERROR_NONE; + int i = 0; int mail_id = 0; int result_from_scanf = 0; + int test_attachment_data_count; + email_attachment_data_t *test_attachment_data_list = NULL; + + testapp_print("\n > Enter Mail id: "); + result_from_scanf = scanf("%d", &mail_id); + + if ( (err = email_get_attachment_data_list(mail_id, &test_attachment_data_list, &test_attachment_data_count)) != EMAIL_ERROR_NONE ) { + testapp_print("email_get_attachment_data_list() failed [%d]\n", err); + goto FINISH_OFF; + } + if(test_attachment_data_list) { + for(i = 0; i < test_attachment_data_count; i++) { + testapp_print("index [%d]\n", i); + testapp_print("attachment_name [%s]\n", test_attachment_data_list[i].attachment_name); + testapp_print("attachment_path [%s]\n", test_attachment_data_list[i].attachment_path); + testapp_print("attachment_size [%d]\n", test_attachment_data_list[i].attachment_size); + testapp_print("mail_id [%d]\n", test_attachment_data_list[i].mail_id); + testapp_print("attachment_mime_type [%s]\n", test_attachment_data_list[i].attachment_mime_type); + } + email_free_attachment_data(&test_attachment_data_list, test_attachment_data_count); + } + +FINISH_OFF: + + return TRUE; +} + +static gboolean testapp_test_get_meeting_request() +{ + int mail_id = 0; + int result_from_scanf = 0; + int err = EMAIL_ERROR_NONE; + email_meeting_request_t *meeting_request; testapp_print("\n > Enter Mail Id: "); result_from_scanf = scanf("%d", &mail_id); + err = email_get_meeting_request(mail_id, &meeting_request); + + testapp_print("err[%d]\n", err); + + if(err == EMAIL_ERROR_NONE && meeting_request) { + testapp_print("mail_id [%d]\n", meeting_request->mail_id); + testapp_print("global_object_id [%s]\n", meeting_request->global_object_id); + testapp_print("meeting_response [%d]\n", meeting_request->meeting_response); + } + + email_free_meeting_request(&meeting_request, 1); return TRUE; } @@ -1569,6 +1646,28 @@ static gboolean testapp_test_retry_send() return TRUE; } +static gboolean testapp_test_get_attachment_data() +{ + int attachment_id = 0; + int result_from_scanf = 0; + email_attachment_data_t *attachment = NULL; + + testapp_print("\n > Enter attachment id: "); + result_from_scanf = scanf("%d", &attachment_id); + + email_get_attachment_data(attachment_id, &attachment); + + if(attachment) { + testapp_print("attachment_name [%s]\n", attachment->attachment_name); + testapp_print("attachment_path [%s]\n", attachment->attachment_path); + testapp_print("attachment_size [%d]\n", attachment->attachment_size); + testapp_print("mail_id [%d]\n", attachment->mail_id); + testapp_print("attachment_mime_type [%s]\n", attachment->attachment_mime_type); + } + + return TRUE; +} + static gboolean testapp_test_move_all_mails_to_mailbox() { int err = EMAIL_ERROR_NONE; @@ -1977,18 +2076,19 @@ static gboolean testapp_test_add_mail_to_search_result_box() testapp_print("\n From EAS? [0/1]> "); result_from_scanf = scanf("%d", &from_eas); - test_mail_data->account_id = account_id; - test_mail_data->save_status = 1; - test_mail_data->body_download_status = 1; - test_mail_data->flags_seen_field = 1; - test_mail_data->file_path_plain = strdup(body_file_path); - test_mail_data->mailbox_id = mailbox_data->mailbox_id; - test_mail_data->mailbox_type = mailbox_data->mailbox_type; - test_mail_data->full_address_from = strdup("<test1@test.com>"); - test_mail_data->full_address_to = strdup("<test2@test.com>"); - test_mail_data->full_address_cc = strdup("<test3@test.com>"); - test_mail_data->full_address_bcc = strdup("<test4@test.com>"); - test_mail_data->subject = strdup("Into search result mailbox"); + test_mail_data->account_id = account_id; + test_mail_data->save_status = 1; + test_mail_data->body_download_status = 1; + test_mail_data->flags_seen_field = 1; + test_mail_data->file_path_plain = strdup(body_file_path); + test_mail_data->mailbox_id = mailbox_data->mailbox_id; + test_mail_data->mailbox_type = mailbox_data->mailbox_type; + test_mail_data->full_address_from = strdup("<test1@test.com>"); + test_mail_data->full_address_to = strdup("<test2@test.com>"); + test_mail_data->full_address_cc = strdup("<test3@test.com>"); + test_mail_data->full_address_bcc = strdup("<test4@test.com>"); + test_mail_data->subject = strdup("Into search result mailbox"); + test_mail_data->remaining_resend_times = 3; body_file = fopen(body_file_path, "w"); @@ -2073,9 +2173,11 @@ static gboolean testapp_test_email_parse_mime_file() email_attachment_data_t *mail_attachment_data = NULL; int i = 0; int attachment_count = 0; + int verify = 0; int err = EMAIL_ERROR_NONE; int result_from_scanf = 0; char eml_file_path[255] = {0, }; + struct tm *struct_time; testapp_print("Input eml file path : "); result_from_scanf = scanf("%s", eml_file_path); @@ -2085,8 +2187,20 @@ static gboolean testapp_test_email_parse_mime_file() testapp_print("email_parse_mime_file failed : [%d]\n", err); return false; } - - testapp_print("load success\n"); + + testapp_print("load success\n"); + + struct_time = localtime(&(mail_data->date_time)); + + testapp_print("%4d year", struct_time->tm_year +1900); + testapp_print(" %2d month(0-11)\n", struct_time->tm_mon +1 ); + testapp_print(" %2d day(1-31)\n", struct_time->tm_mday ); + testapp_print(" %2d wday\n", struct_time->tm_wday); + testapp_print(" %2d hour(0-23)\n", struct_time->tm_hour ); + testapp_print(" %2d minutes(0-59)\n", struct_time->tm_min ); + testapp_print(" %2d second(0-59)\n", struct_time->tm_sec ); + testapp_print("year day %3d\n", struct_time->tm_yday); + testapp_print("Return-Path: %s\n", mail_data->full_address_return); testapp_print("To: %s\n", mail_data->full_address_to); testapp_print("Subject: %s\n", mail_data->subject); @@ -2097,8 +2211,10 @@ static gboolean testapp_test_email_parse_mime_file() testapp_print("attachment_count: %d\n", mail_data->attachment_count); testapp_print("SMIME type : %d\n", mail_data->smime_type); testapp_print("inline content count : %d\n", mail_data->inline_content_count); + testapp_print("download_body_status : %d\n", mail_data->body_download_status); + - for (i = 0;i < mail_data->attachment_count ; i++) { + for (i = 0;i < attachment_count ; i++) { testapp_print("attachment_id: %d\n", mail_attachment_data[i].attachment_id); testapp_print("inline_attachment_status: %d\n", mail_attachment_data[i].inline_content_status); testapp_print("attachment_name: %s\n", mail_attachment_data[i].attachment_name); @@ -2107,6 +2223,15 @@ static gboolean testapp_test_email_parse_mime_file() } testapp_print("Success : Open eml file\n"); + + if (mail_data->smime_type == EMAIL_SMIME_SIGNED) { + if (!email_verify_signature_ex(mail_data, mail_attachment_data, attachment_count, &verify)) { + testapp_print("email_verify_signature_ex failed\n"); + } + + testapp_print("verify : [%d]\n", verify); + } + if ((err = email_delete_parsed_data(mail_data)) != EMAIL_ERROR_NONE) { testapp_print("email_delete_eml_data failed : [%d]\n", err); @@ -2272,6 +2397,9 @@ static gboolean testapp_test_interpret_command (int menu_number) case 18: testapp_test_get_attachment_data_list(); break; + case 19: + testapp_test_get_meeting_request(); + break; case 20: testapp_test_delete_all(); break; @@ -2281,6 +2409,9 @@ static gboolean testapp_test_interpret_command (int menu_number) case 23: testapp_test_retry_send(); break; + case 24: + testapp_test_get_attachment_data(); + break; case 27: testapp_test_move_all_mails_to_mailbox(); break; diff --git a/utilities/test-application/testapp-mailbox.c b/utilities/test-application/testapp-mailbox.c index 283cb06..6caee04 100755 --- a/utilities/test-application/testapp-mailbox.c +++ b/utilities/test-application/testapp-mailbox.c @@ -48,7 +48,7 @@ static gboolean testapp_print_mailbox_list(email_mailbox_t *input_mailbox_list, testapp_print("There are %d mailboxes\n", input_count); testapp_print("============================================================================\n"); - testapp_print("id a_id name\t\t\t alias\t\t unread\t total\t total_on_ server\tmailbox_type\t last_sync_time\n"); + testapp_print("id\ta_id\talias\tunread\t total\t total_on_ server\tmailbox_type\tlast_sync_time\n"); testapp_print("============================================================================\n"); if ( input_count == 0 ) { testapp_print("No mailbox is matched\n"); @@ -56,9 +56,9 @@ static gboolean testapp_print_mailbox_list(email_mailbox_t *input_mailbox_list, else { for(i=0;i<input_count;i++) { strftime(time_string, 40, "%Y-%m-%d %H:%M:%S", localtime(&(input_mailbox_list[i].last_sync_time))); - testapp_print("[%2d]", input_mailbox_list[i].mailbox_id); - testapp_print(" %2d [%2d]\t[%-12s] ", input_mailbox_list[i].account_id, input_mailbox_list[i].mailbox_id, input_mailbox_list[i].alias); - testapp_print(" %3d\t %3d\t %3d\t %3d\t %s\n" + testapp_print("%2d\t", input_mailbox_list[i].mailbox_id); + testapp_print("%2d\t%-12s\t", input_mailbox_list[i].account_id, input_mailbox_list[i].alias); + testapp_print("%3d\t%3d\t%3d\t%3d\t%s\n" , input_mailbox_list[i].unread_count , input_mailbox_list[i].total_mail_count_on_local , input_mailbox_list[i].total_mail_count_on_server @@ -81,6 +81,8 @@ static gboolean testapp_test_add_mailbox() int handle; int result_from_scanf = 0; + memset(&mailbox, 0, sizeof(email_mailbox_t)); + memset(arg, 0x00, 500); testapp_print("\n> Enter mailbox name: "); result_from_scanf = scanf("%s",arg); @@ -99,11 +101,14 @@ static gboolean testapp_test_add_mailbox() result_from_scanf = scanf("%d", &local_yn); mailbox.local= local_yn; - testapp_print("> Enter mailbox type: "); result_from_scanf = scanf("%d", &mailbox_type); mailbox.mailbox_type= mailbox_type; + mailbox.eas_data = strdup("EAS DATA TEST"); + mailbox.eas_data_length = strlen(mailbox.eas_data) + 1; + + ret = email_add_mailbox(&mailbox, local_yn?0:1, &handle); if (ret < 0) { @@ -113,6 +118,9 @@ static gboolean testapp_test_add_mailbox() testapp_print("\n email_add_mailbox succeed : handle[%d], mailbox_id [%d]\n", handle, mailbox.mailbox_id); } + if(mailbox.eas_data) + free(mailbox.eas_data); + return FALSE; } @@ -167,7 +175,7 @@ static gboolean testapp_test_rename_mailbox() testapp_print("\n email_rename_mailbox failed[%d]\n", err); } else { - testapp_print("\n email_rename_mailbox succeed\n"); + testapp_print("\n email_rename_mailbox succeed. handle [%d]\n", handle); } return FALSE; @@ -351,6 +359,33 @@ static gboolean testapp_test_get_mailbox_list () return FALSE; } +static gboolean testapp_test_get_mailbox_list_by_keyword () +{ + int result_from_scanf = 0; + int account_id =0; + int count = 0; + char keyword[500] = { 0, }; + int error_code = EMAIL_ERROR_NONE; + email_mailbox_t *mailbox_list = NULL; + testapp_print("\n > Enter account id: "); + result_from_scanf = scanf("%d", &account_id); + + testapp_print("> Enter keyword: "); + result_from_scanf = scanf("%s", keyword); + + if ((error_code = email_get_mailbox_list_by_keyword(account_id, keyword, &mailbox_list, &count)) < 0) { + testapp_print(" email_get_mailbox_list_by_keyword error %d\n", error_code); + return false ; + } + + testapp_print_mailbox_list(mailbox_list, count); + + email_free_mailbox(&mailbox_list, count); + + return FALSE; +} + + static gboolean testapp_test_sync_mailbox() { int result_from_scanf = 0; @@ -393,6 +428,36 @@ static gboolean testapp_test_stamp_sync_time() return FALSE; } +static gboolean testapp_test_rename_mailbox_ex() +{ + testapp_print ("testapp_test_rename_mailbox_ex\n"); + int mailbox_id; + char mailbox_name[500] = { 0, }; + char mailbox_alias[500] = { 0, }; + char eas_data[500] = "OK. Done"; + int err; + int result_from_scanf = 0; + int handle = 0; + + testapp_print("> Enter mailbox id: "); + result_from_scanf = scanf("%d", &mailbox_id); + + testapp_print("> Enter new mailbox name: "); + result_from_scanf = scanf("%s", mailbox_name); + + testapp_print("> Enter new mailbox alias: "); + result_from_scanf = scanf("%s", mailbox_alias); + + + if ( (err = email_rename_mailbox_ex(mailbox_id, mailbox_name, mailbox_alias, eas_data, strlen(eas_data), false, &handle)) < 0) { + testapp_print("\n email_rename_mailbox failed[%d]\n", err); + } + else { + testapp_print("\n email_rename_mailbox succeed\n"); + } + return FALSE; +} + static gboolean testapp_test_interpret_command (int menu_number) { gboolean go_to_loop = TRUE; @@ -446,6 +511,14 @@ static gboolean testapp_test_interpret_command (int menu_number) testapp_test_stamp_sync_time(); break; + case 13: + testapp_test_rename_mailbox_ex(); + break; + + case 14: + testapp_test_get_mailbox_list_by_keyword(); + break; + case 0: go_to_loop = FALSE; break; diff --git a/utilities/test-application/testapp-others.c b/utilities/test-application/testapp-others.c index 487bc46..e24d32e 100755 --- a/utilities/test-application/testapp-others.c +++ b/utilities/test-application/testapp-others.c @@ -42,6 +42,14 @@ #include "email-ipc.h" #include "email-core-utils.h" +static gboolean testapp_test_ping_service() +{ + if(email_ping_service() < 0) + testapp_print("email_ping_service failed..!"); + + return FALSE; +} + static gboolean testapp_test_cancel_job () { int account_id = 0; @@ -208,7 +216,7 @@ FINISH_OFF: return error; } -#define LIB_EMAIL_SERVICE_PATH LIBPATH "libemail-api.so" +#define LIB_EMAIL_SERVICE_PATH "/usr/lib/libemail-api.so" int (*Datastore_FI_EMTB)(char **); int (*Datastore_FI_EMSB)(char **); @@ -377,11 +385,25 @@ static gboolean testapp_test_get_mime_entity() return true; } +static gboolean testapp_test_query_smtp_mail_size_limit() +{ + int result_from_scanf = 0; + int account_id = 0; + testapp_print("\n > Enter account id : "); + result_from_scanf = scanf("%d", &account_id); + + email_query_smtp_mail_size_limit(account_id, NULL); + return true; +} + static gboolean testapp_test_interpret_command (int menu_number) { gboolean go_to_loop = TRUE; switch (menu_number) { + case 1: + testapp_test_ping_service(); + break; case 3: testapp_test_cancel_job (); break; @@ -414,6 +436,9 @@ static gboolean testapp_test_interpret_command (int menu_number) case 16: testapp_test_get_mime_entity(); break; + case 17: + testapp_test_query_smtp_mail_size_limit(); + break; case 0: go_to_loop = FALSE; break; diff --git a/utilities/test-application/testapp-utility.c b/utilities/test-application/testapp-utility.c index 9daf8ef..c834b7e 100755 --- a/utilities/test-application/testapp-utility.c +++ b/utilities/test-application/testapp-utility.c @@ -56,6 +56,7 @@ void testapp_show_menu (eEMAIL_MENU menu) testapp_print ("5. Rule Test\n"); testapp_print ("6. Thread Test\n"); testapp_print ("7. Others\n"); + testapp_print ("8. Gmime test\n"); testapp_print ("0. Exit \n"); testapp_print ("------------------------------------------\n"); break; @@ -83,6 +84,7 @@ void testapp_show_menu (eEMAIL_MENU menu) testapp_print (" 17. Get certificate\n"); testapp_print (" 18. Delete certificate\n"); testapp_print (" 19. Add Account\n"); + testapp_print (" 20. Update peak schedule\n"); testapp_print (" 0. Go to Main Menu\n"); testapp_print ("------------------------------------------\n"); break; @@ -108,9 +110,12 @@ void testapp_show_menu (eEMAIL_MENU menu) testapp_print ("15. Update mail attribute \n"); testapp_print ("16. Download mail body\n"); testapp_print ("17. Download an attachment\n"); + testapp_print ("18. Get attachment list\n"); + testapp_print ("19. Get meeting request\n"); testapp_print ("20. Delete all mail\n"); testapp_print ("21. Move Mail \n"); testapp_print ("23. Resend Mail \n"); + testapp_print ("24. Get attachment data \n"); testapp_print ("27. Move all mails to mailbox\n"); testapp_print ("38. Get total email disk usage \n"); testapp_print ("40. Verify Email Address Format\n"); @@ -149,6 +154,8 @@ void testapp_show_menu (eEMAIL_MENU menu) testapp_print ("10. Get mailbox list\n"); testapp_print ("11. Sync mailbox\n"); testapp_print ("12. Stamp sync time\n"); + testapp_print ("13. Raname mailbox ex\n"); + testapp_print ("14. Get mailbox list by keyword\n"); testapp_print ("0. Go to Main Menu\n"); testapp_print ("------------------------------------------\n"); break; @@ -181,6 +188,7 @@ void testapp_show_menu (eEMAIL_MENU menu) testapp_print ("==========================================\n"); testapp_print (" OTHERS\n"); testapp_print ("==========================================\n"); + testapp_print ("1. Ping service\n"); testapp_print ("3. Cancel Job\n"); testapp_print ("5. Set DNET Proper Profile Type\n"); testapp_print ("6. Get DNET Proper Profile Type\n"); @@ -191,10 +199,20 @@ void testapp_show_menu (eEMAIL_MENU menu) testapp_print ("14. DTT Test\n"); testapp_print ("15. Show User Message\n"); testapp_print ("16. Get mime entity in signed file\n"); + testapp_print ("17. Query SMTP mail size limit\n"); testapp_print ("0. Go to Main Menu\n"); testapp_print ("------------------------------------------\n"); break; + case EMAIL_GMIME_MENU: + testapp_print ("==========================================\n"); + testapp_print (" Gmime Test\n"); + testapp_print ("==========================================\n"); + testapp_print ("1. Parsing eml\n"); + testapp_print ("0. Go to Main Menu\n"); + testapp_print ("------------------------------------------\n"); + break; + default: break; } @@ -230,6 +248,10 @@ void testapp_show_prompt (eEMAIL_MENU menu) testapp_print ("[OTHERS]# "); break; + case EMAIL_GMIME_MENU: + testapp_print ("[Gmime Test]# "); + break; + default: break; } |