summaryrefslogtreecommitdiff
path: root/utilities
diff options
context:
space:
mode:
Diffstat (limited to 'utilities')
-rwxr-xr-xutilities/CMakeLists.txt8
-rwxr-xr-xutilities/test-application/main.c15
-rwxr-xr-xutilities/test-application/testapp-account.c263
-rwxr-xr-xutilities/test-application/testapp-mail.c798
-rwxr-xr-xutilities/test-application/testapp-mailbox.c121
-rwxr-xr-xutilities/test-application/testapp-others.c60
-rwxr-xr-xutilities/test-application/testapp-rule.c63
-rwxr-xr-xutilities/test-application/testapp-thread.c40
-rwxr-xr-xutilities/test-application/testapp-utility.c23
9 files changed, 915 insertions, 476 deletions
diff --git a/utilities/CMakeLists.txt b/utilities/CMakeLists.txt
index 3826c96..8559a67 100755
--- a/utilities/CMakeLists.txt
+++ b/utilities/CMakeLists.txt
@@ -13,6 +13,7 @@ MESSAGE(">>> Build type: ${CMAKE_BUILD_TYPE}")
SET(VISIBILITY "-DEXPORT_API=\"__attribute__((visibility(\\\"default\\\")))\"")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VISIBILITY} -fvisibility=hidden")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,--gc-sections -fPIE")
##########################################################
# Define Test App
@@ -28,6 +29,7 @@ SET(TEST-APP-SRCS
${CMAKE_SOURCE_DIR}/utilities/test-application/testapp-rule.c
${CMAKE_SOURCE_DIR}/utilities/test-application/testapp-thread.c
${CMAKE_SOURCE_DIR}/utilities/test-application/testapp-others.c
+ ${CMAKE_SOURCE_DIR}/utilities/test-application/testapp-gmime.c
)
INCLUDE_DIRECTORIES(
@@ -40,16 +42,14 @@ INCLUDE_DIRECTORIES(
)
INCLUDE(FindPkgConfig)
-pkg_check_modules(test_app_pkgs REQUIRED glib-2.0 gthread-2.0 vconf db-util uw-imap-toolkit drm-client pmapi)
-
-#pkg_check_modules(test_app_pkgs REQUIRED glib-2.0 gthread-2.0 vconf db-util uw-imap-toolkit contacts-service2 drm-client pmapi)
+pkg_check_modules(test_app_pkgs REQUIRED glib-2.0 gthread-2.0 vconf uw-imap-toolkit contacts-service2 gmime-2.6)
FOREACH(flag ${test_app_pkgs_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
ENDFOREACH(flag)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
-SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie")
ADD_EXECUTABLE(email-test-app ${TEST-APP-SRCS})
TARGET_LINK_LIBRARIES(email-test-app ${test_app_pkgs_LDFLAGS} email-api email-smime-api)
diff --git a/utilities/test-application/main.c b/utilities/test-application/main.c
index 27cbfdd..ed4a95d 100755
--- a/utilities/test-application/main.c
+++ b/utilities/test-application/main.c
@@ -41,10 +41,7 @@
#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 */
static void testapp_system_signal_handler (int signal_number);
@@ -165,11 +162,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;
@@ -184,19 +181,17 @@ int main (int argc, char *argv[])
{
gboolean go_to_loop = TRUE;
int menu_number = 0;
- int result_from_scanf = 0;
if ( testapp_initialize_testing() == FALSE ) {
- testapp_print ("email-serivce is not ready\n");
+ testapp_print ("email-service is not ready\n");
exit(0);
}
while (go_to_loop) {
testapp_show_menu (EMAIL_MAIN_MENU);
testapp_show_prompt (EMAIL_MAIN_MENU);
-
- result_from_scanf = scanf ("%d", &menu_number);
-
+ if (0 >= scanf ("%d", &menu_number))
+ testapp_print("Invalid input");
go_to_loop = testapp_interpret_command (menu_number);
}
diff --git a/utilities/test-application/testapp-account.c b/utilities/test-application/testapp-account.c
index c1b121b..5eae241 100755
--- a/utilities/test-application/testapp-account.c
+++ b/utilities/test-application/testapp-account.c
@@ -63,7 +63,6 @@ gboolean testapp_create_account_object(email_account_t **result_account)
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;
testapp_print("1. Gawab\n");
@@ -83,14 +82,17 @@ gboolean testapp_create_account_object(email_account_t **result_account)
testapp_print("16. mopera\n");
testapp_print("Choose server type: ");
- result_from_scanf = scanf("%d",&account_type);
+
+ if (0 >= scanf("%d",&account_type))
+ testapp_print("Invalid input. ");
switch(account_type) {
case 4 :
case 5 :
do {
testapp_print("Enter your account index [1~10] : ");
- result_from_scanf = scanf("%d",&samsung3g_account_index);
+ if (0 >= scanf("%d",&samsung3g_account_index))
+ testapp_print("Invalid input. ");
}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);
@@ -98,26 +100,32 @@ gboolean testapp_create_account_object(email_account_t **result_account)
break;
case 14 :
testapp_print("Enter email address : ");
- result_from_scanf = scanf("%s", address_string);
+ if (0 >= scanf("%s", address_string))
+ testapp_print("Invalid input. ");
strcpy(id_string, address_string);
testapp_print("Enter access token : ");
- result_from_scanf = scanf("%s", accesss_token);
+ if (0 >= scanf("%s", accesss_token))
+ testapp_print("Invalid input. ");
testapp_print("Enter refresh token : ");
- result_from_scanf = scanf("%s", refresh_token);
+ if (0 >= scanf("%s", refresh_token))
+ testapp_print("Invalid input. ");
snprintf(password_string, 100, "%s\001%s\001", accesss_token, refresh_token);
break;
default:
testapp_print("Enter email address : ");
- result_from_scanf = scanf("%s", address_string);
+ if (0 >= scanf("%s", address_string))
+ testapp_print("Invalid input. ");
testapp_print("Enter id : ");
- result_from_scanf = scanf("%s", id_string);
+ if (0 >= scanf("%s", id_string))
+ testapp_print("Invalid input. ");
testapp_print("Enter password_string : ");
- result_from_scanf = scanf("%s", password_string);
+ if (0 >= scanf("%s", password_string))
+ testapp_print("Invalid input. ");
break;
}
@@ -144,6 +152,7 @@ gboolean testapp_create_account_object(email_account_t **result_account)
account->incoming_server_requires_apop = 0;
account->incoming_server_authentication_method = 0;
account->logo_icon_path = NULL;
+ account->color_label = (128 << 16) | (128 << 8) | (128);
account->user_data = malloc (data_length);
memcpy( account->user_data, (void*) &data, data_length );
account->user_data_length = data_length;
@@ -163,7 +172,7 @@ gboolean testapp_create_account_object(email_account_t **result_account)
account->options.add_my_address_to_bcc = 0;
account->check_interval = 0;
account->keep_mails_on_pop_server_after_download = 1;
- account->default_mail_slot_size = 200;
+ account->default_mail_slot_size = 20;
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;
@@ -390,19 +399,18 @@ static gboolean testapp_test_add_account_with_validation()
static gboolean testapp_test_update_account()
{
- int result_from_scanf = 0;
int account_id;
email_account_t *account = NULL;
- char account_name[256];
+ //char account_name[256];
int err = EMAIL_ERROR_NONE;
- char signature[100] = {0};
- char user_email_address[256] = {0,};
- int add_my_address_to_bcc = 0;
- int account_svc_id = 0, with_validation = 0;
-
+ //char signature[100] = {0};
+ //char user_email_address[256] = {0,};
+ //int add_my_address_to_bcc = 0;
+ int with_validation = 0; //account_svc_id = 0,
- testapp_print("\n>> Enter Account No: ");
- result_from_scanf = scanf("%d",&account_id);
+ testapp_print("\n>> Enter Account ID: ");
+ if (0 >= scanf("%d",&account_id))
+ testapp_print("Invalid input. ");
if( (err = email_get_account(account_id, GET_FULL_DATA,&account)) != EMAIL_ERROR_NONE) {
testapp_print ("email_get_account failed - %d\n", err);
@@ -410,54 +418,56 @@ static gboolean testapp_test_update_account()
}
testapp_print ("email_get_account result account_name - %s \n", account->account_name);
+ testapp_print ("email_get_account result address - %s \n", account->user_email_address);
testapp_print ("email_get_account result signature - %s \n", account->options.signature);
-
-#ifdef __FEATURE_AUTO_POLLING__
testapp_print ("email_get_account result check_interval - %d \n", account->check_interval);
-#endif
-
- testapp_print("\n Enter new Account name:");
- result_from_scanf = scanf("%s",account_name);
-
- testapp_print("\n Enter new email addr:");
- result_from_scanf = scanf("%s",user_email_address);
-#ifdef __FEATURE_AUTO_POLLING__
testapp_print("\n Enter new check interval (in mins):");
- result_from_scanf = scanf("%d",&(account->check_interval));
-
+ if (0 >= scanf("%d",&(account->check_interval)))
+ testapp_print("Invalid input. ");
+/*
testapp_print("\n Enter new peak interval (in mins):");
- result_from_scanf = scanf("%d",&(account->peak_interval));
+ if (0 >= scanf("%d",&(account->peak_interval));
testapp_print("\n Enter new peak days:");
- result_from_scanf = scanf("%d",&(account->peak_days));
+ if (0 >= scanf("%d",&(account->peak_days));
testapp_print("\n Enter new peak start time:");
- result_from_scanf = scanf("%d",&(account->peak_start_time));
+ if (0 >= scanf("%d",&(account->peak_start_time));
testapp_print("\n Enter new peak end time:");
- result_from_scanf = scanf("%d",&(account->peak_end_time));
-#endif
+ if (0 >= scanf("%d",&(account->peak_end_time));
+*/
+
+/*
+ testapp_print("\n Enter new Account name:");
+ if (0 >= scanf("%s",account_name);
+
+ testapp_print("\n Enter new email addr:");
+ if (0 >= scanf("%s",user_email_address);
+
testapp_print("\n Enter new signature:");
- result_from_scanf = scanf("%s",signature);
+ if (0 >= scanf("%s",signature);
testapp_print("\n>> Enter add_my_address_to_bcc:(0:off, 1:on) ");
- result_from_scanf = scanf("%d",&add_my_address_to_bcc);
+ if (0 >= scanf("%d",&add_my_address_to_bcc);
testapp_print("\n>> Enter account_svc_id: ");
- result_from_scanf = scanf("%d",&account_svc_id);
+ if (0 >= scanf("%d",&account_svc_id);
testapp_print("\n>> With validation ? (0: No, 1:Yes) ");
- result_from_scanf = scanf("%d",&with_validation);
-
+ if (0 >= scanf("%d",&with_validation);
+*/
if( account ) {
- account->account_name = strdup(account_name);
testapp_print("\n Assigning New Account name: (%s)", account->account_name);
+ testapp_print("\n Assigning New Signature: (%s)\n", account->options.signature);
+ /*
+ account->account_name = strdup(account_name);
account->user_email_address = strdup(user_email_address);
account->options.signature = strdup(signature);
- testapp_print("\n Assigning New Signature: (%s)\n", account->options.signature);
account->options.add_my_address_to_bcc = add_my_address_to_bcc;
account->account_svc_id = account_svc_id;
+ */
if(with_validation) {
if((err = email_update_account_with_validation(account_id, account)) != EMAIL_ERROR_NONE){
@@ -482,10 +492,10 @@ static gboolean testapp_test_delete_account ()
int account_id;
email_account_t *account=NULL;
int err = EMAIL_ERROR_NONE;
- int result_from_scanf = 0;
testapp_print("\n>> Enter Account No: ");
- result_from_scanf = scanf("%d",&account_id);
+ if (0 >= scanf("%d",&account_id))
+ testapp_print("Invalid input. ");
/* sowmya.kr, 281209 Adding signature to options in email_account_t changes */
if( (err = email_get_account(account_id, WITHOUT_OPTION,&account)) < 0) {
@@ -531,16 +541,17 @@ static gboolean testapp_test_validate_account ()
static gboolean testapp_test_cancel_validate_account ()
{
- int result_from_scanf = 0;
int account_id = 0;
int err_code = EMAIL_ERROR_NONE;
unsigned account_handle = 0;
testapp_print("\n > Enter account_id: ");
- result_from_scanf = scanf("%d", &account_id);
+ if (0 >= scanf("%d", &account_id))
+ testapp_print("Invalid input. ");
testapp_print("\n > Enter handle: ");
- result_from_scanf = scanf("%d", &account_handle);
+ if (0 >= scanf("%d", &account_handle))
+ testapp_print("Invalid input. ");
err_code = email_cancel_job(account_id, account_handle, EMAIL_CANCELED_BY_USER);
if(err_code == 0)
@@ -553,12 +564,12 @@ static gboolean testapp_test_cancel_validate_account ()
static gboolean testapp_test_get_account()
{
- int result_from_scanf = 0;
int account_id;
email_account_t *account=NULL;
int err_code = EMAIL_ERROR_NONE;
testapp_print("\n>> Enter Account No: ");
- result_from_scanf = scanf("%d",&account_id);
+ if (0 >= scanf("%d",&account_id))
+ testapp_print("Invalid input. ");
typedef struct {
int is_preset_account;
@@ -595,11 +606,16 @@ static gboolean testapp_test_get_account()
"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"
+ "color_label %d\n"
+ "notification_status %d\n"
+ "vibrate_status %d\n"
+ "display_content_status %d\n"
+ "default_ringtone_status %d\n"
+ "alert_ringtone_path %s\n"
,
account->account_name,
account->user_email_address,
@@ -622,7 +638,13 @@ static gboolean testapp_test_get_account()
account->peak_interval,
account->peak_days,
account->peak_start_time,
- account->peak_end_time
+ account->peak_end_time,
+ account->color_label,
+ account->options.notification_status,
+ account->options.vibrate_status,
+ account->options.display_content_status,
+ account->options.default_ringtone_status,
+ account->options.alert_ringtone_path
);
err_code = email_free_account(&account, 1);
@@ -719,12 +741,12 @@ static gboolean testapp_test_get_account_list ()
static gboolean testapp_test_update_check_interval()
{
int account_id = 0;
- int result_from_scanf = 0;
int err_code = EMAIL_ERROR_NONE;
email_account_t *account = NULL;
testapp_print("\n Enter account id :");
- result_from_scanf = scanf("%d",&account_id);
+ if (0 >= scanf("%d",&account_id))
+ testapp_print("Invalid input. ");
if( (err_code = email_get_account(account_id, GET_FULL_DATA_WITHOUT_PASSWORD, &account)) != EMAIL_ERROR_NONE) {
testapp_print ("email_get_account failed [%d]\n", err_code);
@@ -732,7 +754,8 @@ static gboolean testapp_test_update_check_interval()
}
testapp_print("\n Enter new check interval (in mins):");
- result_from_scanf = scanf("%d",&(account->check_interval));
+ if (0 >= scanf("%d",&(account->check_interval)))
+ testapp_print("Invalid input. ");
if((err_code = email_update_account(account_id, account)) != EMAIL_ERROR_NONE) {
testapp_print ("email_update_account failed [%d]\n", err_code);
@@ -750,7 +773,7 @@ FINISH_OFF:
static gboolean testapp_test_backup_account()
{
- char *file_name = "accounts_file";
+ char *file_name = "/opt/usr/data/email/accounts_file";
int error_code;
error_code = email_backup_accounts_into_secure_storage(file_name);
testapp_print("\n email_backup_accounts_into_secure_storage returned [%d]\n",error_code);
@@ -758,7 +781,7 @@ static gboolean testapp_test_backup_account()
}
static gboolean testapp_test_restore_account()
{
- char *file_name = "accounts_file";
+ char *file_name = "/opt/usr/data/email/accounts_file";
int error_code;
error_code = email_restore_accounts_from_secure_storage(file_name);
testapp_print("\n email_restore_accounts_from_secure_storage returned [%d]\n",error_code);
@@ -767,30 +790,56 @@ static gboolean testapp_test_restore_account()
static gboolean testapp_test_get_password_length_of_account()
{
- int result_from_scanf = 0;
- int error_code, password_length, account_id;
+ int password_length, account_id;
testapp_print("\n input account id\n");
- result_from_scanf = scanf("%d", &account_id);
- error_code = email_get_password_length_of_account(account_id, &password_length);
+ if (0 >= scanf("%d", &account_id))
+ testapp_print("Invalid input. ");
+ email_get_password_length_of_account(account_id, EMAIL_GET_INCOMING_PASSWORD_LENGTH, &password_length);
testapp_print("testapp_test_get_password_length_of_account returned [%d]\n",password_length);
return FALSE;
}
-static gboolean testapp_test_query_server_info()
+static gboolean testapp_test_update_notification()
{
- int result_from_scanf = 0;
int error_code;
- char domain_name[255];
- email_server_info_t *result_server_info;
+ int account_id = 0;
+ int t_mail_count = 0;
+ int input_from_eas = 0;
+ int unread_mail_count = 0;
+
+ testapp_print("\n Input account ID:\n");
+ if (0 >= scanf("%d", &account_id))
+ testapp_print("Invalid input. ");
+
+ testapp_print("\n Input mail count:\n");
+ if (0 >= scanf("%d", &t_mail_count))
+ testapp_print("Invalid input. ");
+
+ testapp_print("\n Input unread mail count:\n");
+ if (0 >= scanf("%d", &unread_mail_count))
+ testapp_print("Invalid input. ");
- testapp_print("\n input domain name\n");
- result_from_scanf = scanf("%s", domain_name);
+ testapp_print("\n Input From eas:\n");
+ if (0 >= scanf("%d", &input_from_eas))
+ testapp_print("Invalid input. ");
- error_code = email_query_server_info(domain_name, &result_server_info);
- testapp_print("email_query_server_info returned [%d]\n",error_code);
- if(error_code == EMAIL_ERROR_NONE)
- testapp_print("service_name [%s]\n", result_server_info->service_name);
+ error_code = email_update_notification_bar(account_id, t_mail_count, unread_mail_count, input_from_eas);
+ testapp_print("email_update_notification_bar returned [%d]\n",error_code);
+ return FALSE;
+}
+
+static gboolean testapp_test_clear_notification()
+{
+ int account_id = 0;
+ int error_code;
+
+ testapp_print("\n Input account ID:\n");
+ if (0 >= scanf("%d", &account_id))
+ testapp_print("Invalid input. ");
+
+ error_code = email_clear_notification_bar(account_id);
+ testapp_print("email_clear_notification_bar returned [%d]\n",error_code);
return FALSE;
}
@@ -798,20 +847,20 @@ static gboolean testapp_test_clear_all_notification()
{
int error_code;
- error_code = email_clear_all_notification_bar();
- testapp_print("email_clear_all_notification_bar returned [%d]\n",error_code);
+ error_code = email_clear_notification_bar(ALL_ACCOUNT);
+ testapp_print("email_clear_notification_bar returned [%d]\n",error_code);
return FALSE;
}
static gboolean testapp_test_save_default_account_id()
{
- int result_from_scanf = 0;
int error_code;
int account_id = 0;
testapp_print ("\nInput default account id : ");
- result_from_scanf = scanf("%d", &account_id);
+ if (0 >= scanf("%d", &account_id))
+ testapp_print("Invalid input. ");
error_code = email_save_default_account_id(account_id);
@@ -833,16 +882,17 @@ static gboolean testapp_test_load_default_account_id()
static gboolean testapp_test_add_certificate()
{
- int result_from_scanf = 0;
int ret = 0;
char save_name[50] = {0, };
char certificate_path[255] = {0, };
testapp_print("Input cert path : ");
- result_from_scanf = scanf("%s", certificate_path);
+ if (0 >= scanf("%s", certificate_path))
+ testapp_print("Invalid input. ");
testapp_print("Input cert email-address : ");
- result_from_scanf = scanf("%s", save_name);
+ if (0 >= scanf("%s", save_name))
+ testapp_print("Invalid input. ");
testapp_print("cert path : [%s]", certificate_path);
testapp_print("email-address : [%s]", save_name);
@@ -859,13 +909,13 @@ static gboolean testapp_test_add_certificate()
static gboolean testapp_test_get_certificate()
{
- int result_from_scanf = 0;
int ret = 0;
char save_name[20] = {0, };
email_certificate_t *certificate = NULL;
testapp_print("Input cert email-address : ");
- result_from_scanf = scanf("%s", save_name);
+ if (0 >= scanf("%s", save_name))
+ testapp_print("Invalid input. ");
ret = email_get_certificate(save_name, &certificate);
if (ret != EMAIL_ERROR_NONE) {
@@ -893,12 +943,12 @@ static gboolean testapp_test_get_certificate()
static gboolean testapp_test_delete_certificate()
{
- int result_from_scanf = 0;
int ret = 0;
char save_name[20] = {0, };
testapp_print("Input cert email-address : ");
- result_from_scanf = scanf("%s", save_name);
+ if (0 >= scanf("%s", save_name))
+ testapp_print("Invalid input. ");
ret = email_delete_certificate(save_name);
if (ret != EMAIL_ERROR_NONE) {
@@ -936,13 +986,13 @@ static gboolean testapp_test_add_account()
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 (0 >= scanf("%d",&account_id))
+ testapp_print("Invalid input. ");
if( (err = email_get_account(account_id, GET_FULL_DATA, &account)) != EMAIL_ERROR_NONE) {
testapp_print ("email_get_account failed [%d]\n", err);
@@ -952,27 +1002,32 @@ static gboolean testapp_test_update_peak_schedule()
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));
+ if (0 >= scanf("%d",&(account->check_interval)))
+ testapp_print("Invalid input. ");
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));
+ if (0 >= scanf("%d",&(account->peak_interval)))
+ testapp_print("Invalid input. ");
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));
+ if (0 >= scanf("%d",&(account->peak_days)))
+ testapp_print("Invalid input. ");
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));
+ if (0 >= scanf("%d",&(account->peak_start_time)))
+ testapp_print("Invalid input. ");
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 (0 >= scanf("%d",&(account->peak_end_time)))
+ testapp_print("Invalid input. ");
if( account ) {
if((err = email_update_account(account_id, account)) != EMAIL_ERROR_NONE) {
@@ -1033,39 +1088,43 @@ static gboolean testapp_test_interpret_command (int selected_number)
testapp_test_get_password_length_of_account();
break;
- case 12:
- testapp_test_query_server_info();
+ case 13:
+ testapp_test_update_notification();
break;
- case 13:
+ case 14:
+ testapp_test_clear_notification();
+ break;
+
+ case 15:
testapp_test_clear_all_notification();
break;
- case 14:
+ case 16:
testapp_test_save_default_account_id();
break;
- case 15:
+ case 17:
testapp_test_load_default_account_id();
break;
- case 16:
+ case 18:
testapp_test_add_certificate();
break;
- case 17:
+ case 19:
testapp_test_get_certificate();
break;
- case 18:
+ case 20:
testapp_test_delete_certificate();
break;
- case 19:
+ case 21:
testapp_test_add_account();
break;
- case 20:
+ case 22:
testapp_test_update_peak_schedule();
break;
@@ -1084,13 +1143,13 @@ void testapp_account_main ()
{
gboolean go_to_loop = TRUE;
int menu_number = 0;
- int result_from_scanf = 0;
while (go_to_loop) {
testapp_show_menu (EMAIL_ACCOUNT_MENU);
testapp_show_prompt (EMAIL_ACCOUNT_MENU);
-
- result_from_scanf = scanf ("%d", &menu_number);
+
+ if (0 >= scanf("%d", &menu_number))
+ testapp_print("Invalid input");
go_to_loop = testapp_test_interpret_command (menu_number);
}
diff --git a/utilities/test-application/testapp-mail.c b/utilities/test-application/testapp-mail.c
index add534f..32219c3 100755
--- a/utilities/test-application/testapp-mail.c
+++ b/utilities/test-application/testapp-mail.c
@@ -112,24 +112,27 @@ static void testapp_test_print_mail_list_item(email_mail_list_item_t *mail_list_
static gboolean testapp_add_mail_for_sending (int *result_mail_id)
{
- int result_from_scanf = 0;
int i = 0;
int account_id = 0;
int err = EMAIL_ERROR_NONE;
int smime_type = 0;
- char receipient_address[300] = { 0 , };
+ char recipient_address[300] = { 0 , };
char from_address[300] = { 0 , };
+ char passpharse[300] = {0, };
const char *body_file_path = MAIL_TEMP_BODY;
+
email_account_t *account_data = NULL;
email_mailbox_t *mailbox_data = NULL;
email_mail_data_t *test_mail_data = NULL;
FILE *body_file;
testapp_print("\n > Enter account id : ");
- result_from_scanf = scanf("%d", &account_id);
+ if (0 >= scanf("%d", &account_id))
+ testapp_print("Invalid input. ");
- testapp_print("\n > Enter receipient address : ");
- result_from_scanf = scanf("%s", receipient_address);
+ testapp_print("\n > Enter recipient address : ");
+ if (0 >= scanf("%s", recipient_address))
+ testapp_print("Invalid input. ");
email_get_account(account_id, GET_FULL_DATA_WITHOUT_PASSWORD, &account_data);
@@ -148,7 +151,7 @@ static gboolean testapp_add_mail_for_sending (int *result_mail_id)
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->full_address_to = strdup(recipient_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;
@@ -168,10 +171,18 @@ static gboolean testapp_add_mail_for_sending (int *result_mail_id)
fflush(body_file);
fclose(body_file);
- testapp_print(" > Select smime? [0: Normal, 1: sign, 2: Encrpyt, 3: sing + encrypt] : ");
- result_from_scanf = scanf("%d", &smime_type);
+ testapp_print(" > Select smime? [0: Normal, 1: sign, 2: Encrpyt, 3: sing + encrypt, 4: pgp sign, 5: pgp encrypted, 6: pgp sign + encrypt] : ");
+ if (0 >= scanf("%d", &smime_type))
+ testapp_print("Invalid input. ");
test_mail_data->smime_type = smime_type;
+ if (smime_type >= EMAIL_PGP_SIGNED) {
+ testapp_print(" > passpharse : ");
+ if (0 >= scanf("%s", passpharse))
+ testapp_print("Invalid input. ");
+ test_mail_data->pgp_password = strdup(passpharse);
+ }
+
if((err = email_add_mail(test_mail_data, NULL, 0, NULL, 0)) != EMAIL_ERROR_NONE)
testapp_print("email_add_mail failed. [%d]\n", err);
else
@@ -191,7 +202,6 @@ static gboolean testapp_add_mail_for_sending (int *result_mail_id)
static gboolean testapp_test_add_mail (int *result_mail_id)
{
- int result_from_scanf = 0;
int i = 0;
int account_id = 0;
int mailbox_id = 0;
@@ -208,12 +218,13 @@ static gboolean testapp_test_add_mail (int *result_mail_id)
FILE *body_file;
testapp_print("\n > Enter account id : ");
- result_from_scanf = scanf("%d", &account_id);
+ if (0 >= scanf("%d", &account_id))
+ testapp_print("Invalid input. ");
-
memset(arg, 0x00, 50);
testapp_print("\n > Enter mailbox id : ");
- result_from_scanf = scanf("%d", &mailbox_id);
+ if (0 >= scanf("%d", &mailbox_id))
+ testapp_print("Invalid input. ");
email_get_mailbox_by_mailbox_id(mailbox_id, &mailbox_data);
@@ -221,7 +232,8 @@ static gboolean testapp_test_add_mail (int *result_mail_id)
memset(test_mail_data, 0x00, sizeof(email_mail_data_t));
testapp_print("\n From EAS? [0/1]> ");
- result_from_scanf = scanf("%d", &from_eas);
+ if (0 >= scanf("%d", &from_eas))
+ testapp_print("Invalid input. ");
test_mail_data->account_id = account_id;
test_mail_data->save_status = 1;
@@ -256,11 +268,13 @@ static gboolean testapp_test_add_mail (int *result_mail_id)
fclose(body_file);
testapp_print(" > Select smime? [0: Normal, 1: sign, 2: Encrypt, 3: sing + encrypt] : ");
- result_from_scanf = scanf("%d", &smime_type);
+ if (0 >= scanf("%d", &smime_type))
+ testapp_print("Invalid input. ");
test_mail_data->smime_type = smime_type;
testapp_print(" > How many file attachment? [>=0] : ");
- result_from_scanf = scanf("%d",&attachment_count);
+ if (0 >= scanf("%d",&attachment_count))
+ testapp_print("Invalid input. ");
test_mail_data->attachment_count = attachment_count;
if ( attachment_count > 0 )
@@ -270,13 +284,15 @@ static gboolean testapp_test_add_mail (int *result_mail_id)
for ( i = 0; i < attachment_count ; i++ ) {
memset(arg, 0x00, 50);
testapp_print("\n > Enter attachment name : ");
- result_from_scanf = scanf("%s", arg);
+ if (0 >= scanf("%s", arg))
+ testapp_print("Invalid input. ");
attachment_data[i].attachment_name = strdup(arg);
memset(arg, 0x00, 50);
testapp_print("\n > Enter attachment absolute path : ");
- result_from_scanf = scanf("%s",arg);
+ if (0 >= scanf("%s",arg))
+ testapp_print("Invalid input. ");
attachment_data[i].attachment_path = strdup(arg);
attachment_data[i].save_status = 1;
@@ -284,7 +300,8 @@ static gboolean testapp_test_add_mail (int *result_mail_id)
}
testapp_print("\n > Meeting Request? [0: no, 1: yes (request from server), 2: yes (response from local)]");
- result_from_scanf = scanf("%d", (int*)&(test_mail_data->meeting_request_status));
+ if (0 >= scanf("%d", (int*)&(test_mail_data->meeting_request_status)))
+ testapp_print("Invalid input. ");
if ( test_mail_data->meeting_request_status == 1
|| test_mail_data->meeting_request_status == 2 ) {
@@ -336,7 +353,6 @@ static gboolean testapp_test_add_mail (int *result_mail_id)
static gboolean testapp_test_update_mail()
{
- int result_from_scanf = 0;
int mail_id = 0;
int err = EMAIL_ERROR_NONE;
int test_attachment_data_count = 0;
@@ -347,7 +363,8 @@ static gboolean testapp_test_update_mail()
email_meeting_request_t *meeting_req = NULL;
testapp_print("\n > Enter mail id : ");
- result_from_scanf = scanf("%d", &mail_id);
+ if (0 >= scanf("%d", &mail_id))
+ testapp_print("Invalid input. ");
email_get_mail_data(mail_id, &test_mail_data);
@@ -357,7 +374,8 @@ static gboolean testapp_test_update_mail()
}
testapp_print("\n > Enter Subject: ");
- result_from_scanf = scanf("%s", arg);
+ if (0 >= scanf("%s", arg))
+ testapp_print("Invalid input. ");
test_mail_data->subject= strdup(arg);
@@ -378,7 +396,8 @@ static gboolean testapp_test_update_mail()
}
testapp_print("\n > Enter meeting response: ");
- result_from_scanf = scanf("%d", (int*)&(meeting_req->meeting_response));
+ if (0 >= scanf("%d", (int*)&(meeting_req->meeting_response)))
+ testapp_print("Invalid input. ");
}
if ( (err = email_update_mail(test_mail_data, test_attachment_data_list, test_attachment_data_count, meeting_req, 0)) != EMAIL_ERROR_NONE)
@@ -419,29 +438,34 @@ static gboolean testapp_test_get_mails()
int to_get_count = 0;
int is_for_thread_view = 0;
int list_type;
- int result_from_scanf = 0;
struct tm *temp_time_info;
testapp_print("\n > Enter Account_id (0 = all accounts) : ");
- result_from_scanf = scanf("%d",&account_id);
-
+ if (0 >= scanf("%d",&account_id))
+ testapp_print("Invalid input. ");
testapp_print("\n > Enter Mailbox id (0 = all mailboxes) :");
- result_from_scanf = scanf("%d", &mailbox_id);
+ if (0 >= scanf("%d", &mailbox_id))
+ testapp_print("Invalid input. ");
testapp_print("\n > Enter Sorting : ");
- result_from_scanf = scanf("%d",&sorting);
+ if (0 >= scanf("%d",&sorting))
+ testapp_print("Invalid input. ");
testapp_print("\n > Enter Start index (starting at 0): ");
- result_from_scanf = scanf("%d",&start_index);
+ if (0 >= scanf("%d",&start_index))
+ testapp_print("Invalid input. ");
testapp_print("\n > Enter max_count : ");
- result_from_scanf = scanf("%d",&limit_count);
+ if (0 >= scanf("%d",&limit_count))
+ testapp_print("Invalid input. ");
testapp_print("\n > For thread view : ");
- result_from_scanf = scanf("%d",&is_for_thread_view);
+ if (0 >= scanf("%d",&is_for_thread_view))
+ testapp_print("Invalid input. ");
testapp_print("\n > Mail count only (0:list 1:count): ");
- result_from_scanf = scanf("%d",&to_get_count);
+ if (0 >= scanf("%d",&to_get_count))
+ testapp_print("Invalid input. ");
if(to_get_count)
mails_pointer = NULL;
@@ -549,6 +573,7 @@ static gboolean testapp_test_get_mail_list_ex()
int result_mail_count = 0;
int err = EMAIL_ERROR_NONE;
int i = 0;
+ int sort_order = 0;
filter_rule_count = 3;
@@ -649,10 +674,17 @@ static gboolean testapp_test_get_mail_list_ex()
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_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;
+*/
+ testapp_print("\n Enter the sort_order :");
+ if (0 >= scanf("%d", &sort_order))
+ testapp_print("Invalid input.");
+
+ sorting_rule_list[0].target_attribute = EMAIL_MAIL_ATTRIBUTE_SUBJECT;
+ sorting_rule_list[0].sort_order = sort_order;
sorting_rule_list[1].target_attribute = EMAIL_MAIL_ATTRIBUTE_DATE_TIME;
sorting_rule_list[1].sort_order = EMAIL_SORT_ORDER_DESCEND;
@@ -683,10 +715,10 @@ static gboolean testapp_test_send_cancel ()
int j = 0;
int *mailIdList = NULL;
int mail_id = 0;
- int result_from_scanf = 0;
testapp_print("\n > Enter total Number of mail want to send: ");
- result_from_scanf = scanf("%d", &num);
+ if (0 >= scanf("%d", &num))
+ testapp_print("Invalid input. ");
mailIdList = (int *)malloc(sizeof(int)*num);
if(!mailIdList)
return false ;
@@ -701,10 +733,12 @@ static gboolean testapp_test_send_cancel ()
mail_id = 0;
testapp_print("\n > Do you want to cancel the send mail job '1' or '0': ");
- result_from_scanf = scanf("%d", &Y);
+ if (0 >= scanf("%d", &Y))
+ testapp_print("Invalid input. ");
if(Y == 1) {
testapp_print("\n >Enter mail-id[1-%d] ",i);
- result_from_scanf = scanf("%d", &j);
+ if (0 >= scanf("%d", &j))
+ testapp_print("Invalid input. ");
testapp_print("\n mailIdList[%d] ",mailIdList[j]);
if(email_cancel_sending_mail( mailIdList[j]) < 0)
testapp_print("email_cancel_sending_mail failed..!");
@@ -721,19 +755,22 @@ static gboolean testapp_test_delete()
int mailbox_id = 0;
int err = EMAIL_ERROR_NONE;
int from_server = 0;
- int result_from_scanf = 0;
testapp_print("\n > Enter Account_id: ");
- result_from_scanf = scanf("%d", &account_id);
+ if (0 >= scanf("%d", &account_id))
+ testapp_print("Invalid input. ");
testapp_print("\n > Enter Mail_id: ");
- result_from_scanf = scanf("%d", &mail_id);
+ if (0 >= scanf("%d", &mail_id))
+ testapp_print("Invalid input. ");
testapp_print("\n > Enter Mailbox id: ");
- result_from_scanf = scanf("%d", &mailbox_id);
+ if (0 >= scanf("%d", &mailbox_id))
+ testapp_print("Invalid input. ");
testapp_print("\n > Enter from_server: ");
- result_from_scanf = scanf("%d", &from_server);
+ if (0 >= scanf("%d", &from_server))
+ testapp_print("Invalid input. ");
/* delete message */
if( (err = email_delete_mail(mailbox_id, &mail_id, 1, from_server)) < 0)
@@ -751,21 +788,24 @@ static gboolean testapp_test_update_mail_attribute()
int account_id = 0;
int *mail_id_array = NULL;
int mail_id_count = 0;
- int result_from_scanf = 0;
email_mail_attribute_type attribute_type;
email_mail_attribute_value_t attribute_value;
testapp_print("\n > Enter account_id: ");
- result_from_scanf = scanf("%d", &account_id);
+ if (0 >= scanf("%d", &account_id))
+ testapp_print("Invalid input. ");
testapp_print("\n > Enter attribute_type: ");
- result_from_scanf = scanf("%d", (int*)&attribute_type);
+ if (0 >= scanf("%d", (int*)&attribute_type))
+ testapp_print("Invalid input. ");
testapp_print("\n > Enter integer type value: ");
- result_from_scanf = scanf("%d", (int*)&(attribute_value.integer_type_value));
+ if (0 >= scanf("%d", (int*)&(attribute_value.integer_type_value)))
+ testapp_print("Invalid input. ");
testapp_print("\n > Enter mail_id_count: ");
- result_from_scanf = scanf("%d", &mail_id_count);
+ if (0 >= scanf("%d", &mail_id_count))
+ testapp_print("Invalid input. ");
mail_id_count = (mail_id_count < 5000)?mail_id_count:5000;
@@ -775,7 +815,8 @@ static gboolean testapp_test_update_mail_attribute()
for (i = 0; i < mail_id_count; i++) {
testapp_print("\n > Enter mail id: ");
- result_from_scanf = scanf("%d", (mail_id_array + i));
+ if (0 >= scanf("%d", (mail_id_array + i)))
+ testapp_print("Invalid input. ");
}
/* delete message */
@@ -795,15 +836,16 @@ static gboolean testapp_test_move()
int mail_id[3];
int i = 0;
int mailbox_id = 0;
- int result_from_scanf = 0;
for(i = 0; i< 3; i++) {
testapp_print("\n > Enter mail_id: ");
- result_from_scanf = scanf("%d",&mail_id[i]);
+ if (0 >= scanf("%d",&mail_id[i]))
+ testapp_print("Invalid input. ");
}
testapp_print("\n > Enter mailbox_id: ");
- result_from_scanf = scanf("%d", &mailbox_id);
+ if (0 >= scanf("%d", &mailbox_id))
+ testapp_print("Invalid input. ");
/* move mail */
email_move_mail_to_mailbox(mail_id, 3, mailbox_id);
@@ -814,10 +856,10 @@ static gboolean testapp_test_delete_all()
{
int mailbox_id =0;
int err = EMAIL_ERROR_NONE;
- int result_from_scanf = 0;
testapp_print("\n > Enter mailbox_id: ");
- result_from_scanf = scanf("%d",&mailbox_id);
+ if (0 >= scanf("%d",&mailbox_id))
+ testapp_print("Invalid input. ");
/* delete all message */
if ( (err = email_delete_all_mails_in_mailbox(mailbox_id, 0)) < 0)
@@ -832,23 +874,25 @@ static gboolean testapp_test_delete_all()
static gboolean testapp_test_add_attachment()
{
int mail_id = 0;
- int result_from_scanf = 0;
char arg[100];
email_attachment_data_t attachment;
testapp_print("\n > Enter Mail Id: ");
- result_from_scanf = scanf("%d", &mail_id);
+ if (0 >= scanf("%d", &mail_id))
+ testapp_print("Invalid input. ");
memset(&attachment, 0x00, sizeof(email_attachment_data_t));
memset(arg, 0x00, 100);
testapp_print("\n > Enter attachment name: ");
- result_from_scanf = scanf("%s",arg);
+ if (0 >= scanf("%s",arg))
+ testapp_print("Invalid input. ");
attachment.attachment_name = strdup(arg);
memset(arg, 0x00, 100);
testapp_print("\n > Enter attachment absolute path: ");
- result_from_scanf = scanf("%s",arg);
+ if (0 >= scanf("%s",arg))
+ testapp_print("Invalid input. ");
attachment.save_status = true;
attachment.attachment_path = strdup(arg);
@@ -869,14 +913,15 @@ static gboolean testapp_test_set_deleted_flag()
int mail_ids[100] = { 0, };
int temp_mail_id = 0;
int err_code = EMAIL_ERROR_NONE;
- int result_from_scanf = 0;
testapp_print("\n >>> Input target account id: ");
- result_from_scanf = scanf("%d", &account_id);
+ if (0 >= scanf("%d", &account_id))
+ testapp_print("Invalid input. ");
do {
testapp_print("\n >>> Input target mail id ( Input 0 to terminate ) [MAX = 100]: ");
- result_from_scanf = scanf("%d", &temp_mail_id);
+ if (0 >= scanf("%d", &temp_mail_id))
+ testapp_print("Invalid input. ");
mail_ids[index++] = temp_mail_id;
} while (temp_mail_id != 0);
@@ -892,13 +937,14 @@ static gboolean testapp_test_expunge_mails_deleted_flagged()
int on_server = 0;
int err_code = EMAIL_ERROR_NONE;
int handle = 0;
- int result_from_scanf = 0;
testapp_print("\n >>> Input target mailbox id: ");
- result_from_scanf = scanf("%d", &mailbox_id);
+ if (0 >= scanf("%d", &mailbox_id))
+ testapp_print("Invalid input. ");
testapp_print("\n >>> Expunge on server?: ");
- result_from_scanf = scanf("%d", &on_server);
+ if (0 >= scanf("%d", &on_server))
+ testapp_print("Invalid input. ");
err_code = email_expunge_mails_deleted_flagged(mailbox_id, on_server, &handle);
@@ -912,11 +958,11 @@ static gboolean testapp_test_send_read_receipt()
int read_mail_id = 0;
int receipt_mail_id = 0;
int err_code = EMAIL_ERROR_NONE;
- int result_from_scanf = 0;
int handle = 0;
testapp_print("\n >>> Input read mail id: ");
- result_from_scanf = scanf("%d", &read_mail_id);
+ if (0 >= scanf("%d", &read_mail_id))
+ testapp_print("Invalid input. ");
err_code = email_add_read_receipt(read_mail_id, &receipt_mail_id);
@@ -937,10 +983,10 @@ static gboolean testapp_test_delete_attachment()
{
int attachment_id = 0;
int err_code = EMAIL_ERROR_NONE;
- int result_from_scanf = 0;
testapp_print("\n >>> Input attachment id: ");
- result_from_scanf = scanf("%d", &attachment_id);
+ if (0 >= scanf("%d", &attachment_id))
+ testapp_print("Invalid input. ");
if( (err_code = email_delete_attachment(attachment_id)) != EMAIL_ERROR_NONE) {
testapp_print("email_delete_attachment failed[%d]\n", err_code);
@@ -964,28 +1010,34 @@ static gboolean testapp_test_get_mail_list()
int is_for_thread_view = 0;
int list_type;
struct tm *temp_time_info;
- int result_from_scanf = 0;
testapp_print("\n > Enter Account_id (0 = all accounts) : ");
- result_from_scanf = scanf("%d",&account_id);
+ if (0 >= scanf("%d",&account_id))
+ testapp_print("Invalid input. ");
testapp_print("\n > Enter Mailbox id (0 = all mailboxes) :");
- result_from_scanf = scanf("%d", &mailbox_id);
+ if (0 >= scanf("%d", &mailbox_id))
+ testapp_print("Invalid input. ");
testapp_print("\n > Enter Sorting : ");
- result_from_scanf = scanf("%d",&sorting);
+ if (0 >= scanf("%d",&sorting))
+ testapp_print("Invalid input. ");
testapp_print("\n > Enter Start index (starting at 0): ");
- result_from_scanf = scanf("%d",&start_index);
+ if (0 >= scanf("%d",&start_index))
+ testapp_print("Invalid input. ");
testapp_print("\n > Enter max_count : ");
- result_from_scanf = scanf("%d",&limit_count);
+ if (0 >= scanf("%d",&limit_count))
+ testapp_print("Invalid input. ");
testapp_print("\n > For thread view : ");
- result_from_scanf = scanf("%d",&is_for_thread_view);
+ if (0 >= scanf("%d",&is_for_thread_view))
+ testapp_print("Invalid input. ");
testapp_print("\n > Count mails?(1: YES):");
- result_from_scanf = scanf("%d",&to_get_count);
+ if (0 >= scanf("%d",&to_get_count))
+ testapp_print("Invalid input. ");
if(to_get_count)
mail_list_pointer = NULL;
@@ -1060,15 +1112,16 @@ static gboolean testapp_test_get_mail_list_for_thread_view()
int count = 0, i = 0;
int account_id = 0;
int mailbox_id = 0;
- int result_from_scanf;
int err_code = EMAIL_ERROR_NONE;
struct tm *time_info;
testapp_print("\nEnter account id\n");
- result_from_scanf = scanf("%d",&account_id);
+ if (0 >= scanf("%d",&account_id))
+ testapp_print("Invalid input. ");
testapp_print("\nEnter mailbox id\n");
- result_from_scanf = scanf("%d",&mailbox_id);
+ if (0 >= scanf("%d",&mailbox_id))
+ testapp_print("Invalid input. ");
/* Get mail list */
@@ -1142,16 +1195,18 @@ static gboolean testapp_test_move_mails_to_mailbox_of_another_account()
int target_mailbox_id = 0;
int task_id = 0;
int i = 0;
- int result_from_scanf = 0;
testapp_print("\n > Enter source mailbox id: ");
- result_from_scanf = scanf("%d", &source_mailbox_id);
+ if (0 >= scanf("%d", &source_mailbox_id))
+ testapp_print("Invalid input. ");
testapp_print("\n > Enter target mailbox id: ");
- result_from_scanf = scanf("%d", &target_mailbox_id);
+ if (0 >= scanf("%d", &target_mailbox_id))
+ testapp_print("Invalid input. ");
testapp_print("\n > Enter mail count: ");
- result_from_scanf = scanf("%d", &mail_id_count);
+ if (0 >= scanf("%d", &mail_id_count))
+ testapp_print("Invalid input. ");
mail_id_count = (mail_id_count < 5000)?mail_id_count:5000;
@@ -1161,7 +1216,8 @@ static gboolean testapp_test_move_mails_to_mailbox_of_another_account()
for(i = 0; i < mail_id_count; i++) {
testapp_print("\n > Enter mail id: ");
- result_from_scanf = scanf("%d", (mail_id_array + i));
+ if (0 >= scanf("%d", (mail_id_array + i)))
+ testapp_print("Invalid input. ");
}
err = email_move_mails_to_mailbox_of_another_account(source_mailbox_id, mail_id_array, mail_id_count, target_mailbox_id, &task_id);
@@ -1174,7 +1230,6 @@ static gboolean copy_file(char *input_source_path, char *input_dest_path)
{
int childExitStatus;
pid_t pid;
- int status;
if (!input_source_path || !input_dest_path) {
return FALSE;
}
@@ -1196,7 +1251,7 @@ static gboolean copy_file(char *input_source_path, char *input_dest_path)
if( WIFEXITED(childExitStatus)) /* exit code in childExitStatus */
{
- status = WEXITSTATUS(childExitStatus); /* zero is normal exit */
+ WEXITSTATUS(childExitStatus); /* zero is normal exit */
testapp_print("WEXITSTATUS\n");
/* handle non-zero as you wish */
}
@@ -1218,7 +1273,6 @@ static gboolean testapp_test_send_mail_with_downloading_attachment_of_original_m
{
int err = EMAIL_ERROR_NONE;
int original_mail_id = 0;
- int result_from_scanf = 0;
int original_attachment_count = 0;
int i = 0;
int handle = 0;
@@ -1231,7 +1285,8 @@ static gboolean testapp_test_send_mail_with_downloading_attachment_of_original_m
email_attachment_data_t *original_attachment_array = NULL;
testapp_print("\n > Enter original mail id: ");
- result_from_scanf = scanf("%d", &original_mail_id);
+ if (0 >= scanf("%d", &original_mail_id))
+ testapp_print("Invalid input. ");
/* Get original mail */
if((err = email_get_mail_data(original_mail_id, &original_mail_data)) != EMAIL_ERROR_NONE || !original_mail_data) {
@@ -1343,11 +1398,11 @@ static gboolean testapp_test_get_mail_data()
{
int err = EMAIL_ERROR_NONE;
int mail_id = 0;
- int result_from_scanf = 0;
email_mail_data_t *mail_data = NULL;
testapp_print("\n > Enter mail id: ");
- result_from_scanf = scanf("%d", &mail_id);
+ if (0 >= scanf("%d", &mail_id))
+ testapp_print("Invalid input. ");
/* Get original mail */
if((err = email_get_mail_data(mail_id, &mail_data)) != EMAIL_ERROR_NONE || !mail_data) {
@@ -1476,13 +1531,14 @@ static gboolean testapp_test_set_flags_field ()
{
int account_id = 0;
int mail_id = 0;
- int result_from_scanf = 0;
testapp_print("\n > Enter Account ID: ");
- result_from_scanf = scanf("%d", &account_id);
+ if (0 >= scanf("%d", &account_id))
+ testapp_print("Invalid input. ");
testapp_print("\n > Enter Mail ID: ");
- result_from_scanf = scanf("%d", &mail_id);
+ if (0 >= scanf("%d", &mail_id))
+ testapp_print("Invalid input. ");
if(email_set_flags_field(account_id, &mail_id, 1, EMAIL_FLAGS_FLAGGED_FIELD, 1, 1) < 0)
testapp_print("email_set_flags_field failed");
@@ -1496,10 +1552,10 @@ static gboolean testapp_test_download_body ()
{
int mail_id = 0;
int handle = 0, err;
- int result_from_scanf = 0;
testapp_print("\n > Enter Mail Id: ");
- result_from_scanf = scanf("%d", &mail_id);
+ if (0 >= scanf("%d", &mail_id))
+ testapp_print("Invalid input. ");
err = email_download_body(mail_id, 0, &handle);
if(err < 0)
testapp_print("email_download_body failed");
@@ -1517,23 +1573,25 @@ static gboolean testapp_test_cancel_download_body ()
int account_id = 0;
int yes = 0;
int handle = 0;
- int result_from_scanf = 0;
email_mailbox_t mailbox;
memset(&mailbox, 0x00, sizeof(email_mailbox_t));
testapp_print("\n > Enter account_id: ");
- result_from_scanf = scanf("%d", &account_id);
+ if (0 >= scanf("%d", &account_id))
+ testapp_print("Invalid input. ");
testapp_print("\n > Enter mail id: ");
- result_from_scanf = scanf("%d", &mail_id);
+ if (0 >= scanf("%d", &mail_id))
+ testapp_print("Invalid input. ");
if( email_download_body(mail_id, 0, &handle) < 0)
testapp_print("email_download_body failed");
else {
testapp_print("email_download_body success\n");
testapp_print("Do u want to cancel download job>>>>>1/0\n");
- result_from_scanf = scanf("%d",&yes);
+ if (0 >= scanf("%d",&yes))
+ testapp_print("Invalid input. ");
if(1 == yes) {
if(email_cancel_job(account_id, handle , EMAIL_CANCELED_BY_USER) < 0)
testapp_print("email_cancel_job failed..!");
@@ -1551,13 +1609,14 @@ static gboolean testapp_test_download_attachment ()
int mail_id = 0;
int attachment_no = 0;
int handle = 0;
- int result_from_scanf = 0;
testapp_print("\n > Enter Mail Id: ");
- result_from_scanf = scanf("%d", &mail_id);
+ if (0 >= scanf("%d", &mail_id))
+ testapp_print("Invalid input. ");
testapp_print("\n > Enter attachment number: ");
- result_from_scanf = scanf("%d", &attachment_no);
+ if (0 >= scanf("%d", &attachment_no))
+ testapp_print("Invalid input. ");
if( email_download_attachment(mail_id, attachment_no ,&handle) < 0)
testapp_print("email_download_attachment failed");
@@ -1574,12 +1633,12 @@ 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 (0 >= scanf("%d", &mail_id))
+ testapp_print("Invalid input. ");
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);
@@ -1605,12 +1664,12 @@ FINISH_OFF:
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);
+ if (0 >= scanf("%d", &mail_id))
+ testapp_print("Invalid input. ");
err = email_get_meeting_request(mail_id, &meeting_request);
@@ -1630,16 +1689,17 @@ static gboolean testapp_test_retry_send()
{
int mail_id = 0;
int timeout = 0;
- int result_from_scanf = 0;
email_mailbox_t mailbox;
memset(&mailbox, 0x00, sizeof(email_mailbox_t));
testapp_print("\n > Enter Mail Id: ");
- result_from_scanf = scanf("%d", &mail_id);
+ if (0 >= scanf("%d", &mail_id))
+ testapp_print("Invalid input. ");
testapp_print("\n > Enter timeout in seconds: ");
- result_from_scanf = scanf("%d", &timeout);
+ if (0 >= scanf("%d", &timeout))
+ testapp_print("Invalid input. ");
if( email_retry_sending_mail(mail_id, timeout) < 0)
testapp_print("email_retry_sending_mail failed");
@@ -1649,11 +1709,11 @@ static gboolean testapp_test_retry_send()
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);
+ if (0 >= scanf("%d", &attachment_id))
+ testapp_print("Invalid input. ");
email_get_attachment_data(attachment_id, &attachment);
@@ -1671,15 +1731,16 @@ static gboolean testapp_test_get_attachment_data()
static gboolean testapp_test_move_all_mails_to_mailbox()
{
int err = EMAIL_ERROR_NONE;
- int result_from_scanf = 0;
int src_mailbox_id;
int dest_mailbox_id;
testapp_print("src mailbox id> ");
- result_from_scanf = scanf("%d", &src_mailbox_id);
+ if (0 >= scanf("%d", &src_mailbox_id))
+ testapp_print("Invalid input. ");
testapp_print("dest mailbox id> ");
- result_from_scanf = scanf("%d", &dest_mailbox_id);
+ if (0 >= scanf("%d", &dest_mailbox_id))
+ testapp_print("Invalid input. ");
err = email_move_all_mails_to_mailbox(src_mailbox_id, dest_mailbox_id);
if ( err < 0 ) {
@@ -1711,7 +1772,6 @@ static gboolean testapp_test_get_totaldiskusage()
static gboolean testapp_test_db_test()
{
int err = EMAIL_ERROR_NONE;
- int result_from_scanf = 0;
int mail_id;
int account_id;
char *to = NULL;
@@ -1722,22 +1782,27 @@ static gboolean testapp_test_db_test()
cc = (char *) malloc(500000);
bcc = (char *) malloc(500000);
- memset(to, 0x00, sizeof(to));
- memset(cc, 0x00, sizeof(to));
- memset(bcc, 0x00, sizeof(to));
+ memset(to, 0x00, sizeof(500000));
+ memset(cc, 0x00, sizeof(500000));
+ memset(bcc, 0x00, sizeof(500000));
testapp_print("Input Mail id:\n");
- result_from_scanf = scanf("%d", &mail_id);
+ if (0 >= scanf("%d", &mail_id))
+ testapp_print("Invalid input. ");
testapp_print("Input Account id:\n");
- result_from_scanf = scanf("%d", &account_id);
+ if (0 >= scanf("%d", &account_id))
+ testapp_print("Invalid input. ");
testapp_print("Input TO field:\n");
- result_from_scanf = scanf("%s", to);
+ if (0 >= scanf("%s", to))
+ testapp_print("Invalid input. ");
testapp_print("Input CC field:\n");
- result_from_scanf = scanf("%s", cc);
+ if (0 >= scanf("%s", cc))
+ testapp_print("Invalid input. ");
testapp_print("Input BCC field:\n");
- result_from_scanf = scanf("%s", bcc);
-
- if ( emstorage_test(mail_id, account_id, to, cc, bcc, &err) == true ) {
+ if (0 >= scanf("%s", bcc))
+ testapp_print("Invalid input. ");
+
+ if ( emstorage_test(NULL, mail_id, account_id, to, cc, bcc, &err) == true ) {
testapp_print(">> Saving Succeeded\n");
}
else {
@@ -1811,7 +1876,7 @@ static gboolean testapp_test_address_format_check_test()
testapp_print("Select input method:\n");
testapp_print("1. Test data\n");
testapp_print("2. Keyboard\n");
- result_from_scanf = scanf("%d", &type);
+ if (0 >= scanf("%d", &type);
switch ( type ) {
case 1:
@@ -1821,12 +1886,12 @@ static gboolean testapp_test_address_format_check_test()
address_count++;
}
testapp_print("Choose address to be tested:[99:quit]\n");
- result_from_scanf = scanf("%d", &index);
+ if (0 >= scanf("%d", &index);
if ( index == 99 )
break;
testapp_print(">> [%d] Checking? (1:Yes, Other:No) [%s]\n", index, address_list[index]);
- result_from_scanf = scanf("%d", &check_yn);
+ if (0 >= scanf("%d", &check_yn);
if ( check_yn == 1 ) {
pAddress = strdup(address_list[index]);
if ( em_verify_email_address(pAddress, false, &err ) == true ) {
@@ -1848,7 +1913,7 @@ static gboolean testapp_test_address_format_check_test()
break;
case 2:
testapp_print("Input address: \n");
- result_from_scanf = scanf("%s", input_address);
+ if (0 >= scanf("%s", input_address);
if ( em_verify_email_address(input_address, false, &err ) == true ) {
testapp_print(">> Saving Succeeded : addr[%s]\n", input_address);
}
@@ -1870,9 +1935,9 @@ static gboolean testapp_test_get_max_mail_count()
int err = EMAIL_ERROR_NONE;
err = email_get_max_mail_count(&max_count);
- testapp_print("\n\t>>>>> email_get_max_mail_count() return [%d]\n\n", max_count);
+ testapp_print("\n\t>>>>> email_get_max_mail_count() return [%d][%d]\n\n", max_count, err);
- return false;
+ return TRUE;
}
#include "email-storage.h"
@@ -1900,7 +1965,6 @@ static gboolean testapp_test_get_address_info_list()
char buf[1024];
int i = 0;
int mail_id = 0;
- int result_from_scanf = 0;
email_address_info_list_t *address_info_list= NULL;
email_address_info_t *p_address_info = NULL;
GList *list = NULL;
@@ -1908,7 +1972,8 @@ static gboolean testapp_test_get_address_info_list()
memset(buf, 0x00, sizeof(buf));
testapp_print("\n > Enter mail_id: ");
- result_from_scanf = scanf("%d",&mail_id);
+ if (0 >= scanf("%d",&mail_id))
+ testapp_print("Invalid input. ");
email_get_address_info_list(mail_id, &address_info_list);
@@ -1961,87 +2026,117 @@ static gboolean testapp_test_search_mail_on_server()
int account_id = 0;
int mailbox_id = 0;
int search_key_value_integer = 0;
- int result_from_scanf = 0;
+ int search_filter_count = 0;
email_search_filter_type search_filter_type = 0;
- email_search_filter_t search_filter;
+ email_search_filter_t search_filter[10];
int handle = 0;
time_t current_time = 0;
char search_key_value_string[MAX_EMAIL_ADDRESS_LENGTH];
testapp_print("input account id : ");
- result_from_scanf = scanf("%d",&account_id);
+ if (0 >= scanf("%d",&account_id))
+ testapp_print("Invalid input. ");
testapp_print("input mailbox id : ");
- result_from_scanf = scanf("%d", &mailbox_id);
-
- testapp_print(
- " EMAIL_SEARCH_FILTER_TYPE_MESSAGE_NO = 1, ( integet type ) \n"
- " EMAIL_SEARCH_FILTER_TYPE_UID = 2, ( integet type ) \n"
- " EMAIL_SEARCH_FILTER_TYPE_BCC = 7, ( string type ) \n"
- " EMAIL_SEARCH_FILTER_TYPE_CC = 9, ( string type ) \n"
- " EMAIL_SEARCH_FILTER_TYPE_FROM = 10, ( string type ) \n"
- " EMAIL_SEARCH_FILTER_TYPE_KEYWORD = 11, ( string type ) \n"
- " EMAIL_SEARCH_FILTER_TYPE_SUBJECT = 13, ( string type ) \n"
- " EMAIL_SEARCH_FILTER_TYPE_TO = 15, ( string type ) \n"
- " EMAIL_SEARCH_FILTER_TYPE_SIZE_LARSER = 16, ( integet type ) \n"
- " EMAIL_SEARCH_FILTER_TYPE_SIZE_SMALLER = 17, ( integet type ) \n"
- " EMAIL_SEARCH_FILTER_TYPE_SENT_DATE_BEFORE = 20, ( time type ) \n"
- " EMAIL_SEARCH_FILTER_TYPE_SENT_DATE_ON = 21, ( time type ) \n"
- " EMAIL_SEARCH_FILTER_TYPE_SENT_DATE_SINCE = 22, ( time type ) \n"
- " EMAIL_SEARCH_FILTER_TYPE_FLAGS_ANSWERED = 26, ( integet type ) \n"
- " EMAIL_SEARCH_FILTER_TYPE_FLAGS_DELETED = 28, ( integet type ) \n"
- " EMAIL_SEARCH_FILTER_TYPE_FLAGS_DRAFT = 30, ( integet type ) \n"
- " EMAIL_SEARCH_FILTER_TYPE_FLAGS_FLAGED = 32, ( integet type ) \n"
- " EMAIL_SEARCH_FILTER_TYPE_FLAGS_RECENT = 34, ( integet type ) \n"
- " EMAIL_SEARCH_FILTER_TYPE_FLAGS_SEEN = 36, ( integet type ) \n"
- " EMAIL_SEARCH_FILTER_TYPE_MESSAGE_ID = 43, ( string type ) \n");
- testapp_print("input search filter type : ");
- result_from_scanf = scanf("%d", (int*)&search_filter_type);
-
- search_filter.search_filter_type = search_filter_type;
-
- switch(search_filter_type) {
- case EMAIL_SEARCH_FILTER_TYPE_MESSAGE_NO :
- case EMAIL_SEARCH_FILTER_TYPE_UID :
- case EMAIL_SEARCH_FILTER_TYPE_SIZE_LARSER :
- case EMAIL_SEARCH_FILTER_TYPE_SIZE_SMALLER :
- case EMAIL_SEARCH_FILTER_TYPE_FLAGS_ANSWERED :
- case EMAIL_SEARCH_FILTER_TYPE_FLAGS_DELETED :
- case EMAIL_SEARCH_FILTER_TYPE_FLAGS_DRAFT :
- case EMAIL_SEARCH_FILTER_TYPE_FLAGS_FLAGED :
- case EMAIL_SEARCH_FILTER_TYPE_FLAGS_RECENT :
- case EMAIL_SEARCH_FILTER_TYPE_FLAGS_SEEN :
- testapp_print("input search filter key value : ");
- result_from_scanf = scanf("%d", &search_key_value_integer);
- search_filter.search_filter_key_value.integer_type_key_value = search_key_value_integer;
- break;
+ if (0 >= scanf("%d", &mailbox_id))
+ testapp_print("Invalid input. ");
+
+ memset(&search_filter, 0x00, sizeof(email_search_filter_t) * 10);
+
+ while (1) {
+ testapp_print(
+ " EMAIL_SEARCH_FILTER_TYPE_MESSAGE_NO = 1, ( integer type ) \n"
+ " EMAIL_SEARCH_FILTER_TYPE_UID = 2, ( integer type ) \n"
+ " EMAIL_SEARCH_FILTER_TYPE_ALL = 3, ( integer type ) \n"
+ " EMAIL_SEARCH_FILTER_TYPE_BCC = 7, ( string type ) \n"
+ " EMAIL_SEARCH_FILTER_TYPE_BODY = 8, ( string type ) \n"
+ " EMAIL_SEARCH_FILTER_TYPE_CC = 9, ( string type ) \n"
+ " EMAIL_SEARCH_FILTER_TYPE_FROM = 10, ( string type ) \n"
+ " EMAIL_SEARCH_FILTER_TYPE_KEYWORD = 11, ( string type ) \n"
+ " EMAIL_SEARCH_FILTER_TYPE_TEXT = 12, ( string type ) \n"
+ " EMAIL_SEARCH_FILTER_TYPE_SUBJECT = 13, ( string type ) \n"
+ " EMAIL_SEARCH_FILTER_TYPE_TO = 15, ( string type ) \n"
+ " EMAIL_SEARCH_FILTER_TYPE_SIZE_LARSER = 16, ( integet type ) \n"
+ " EMAIL_SEARCH_FILTER_TYPE_SIZE_SMALLER = 17, ( integet type ) \n"
+ " EMAIL_SEARCH_FILTER_TYPE_SENT_DATE_BEFORE = 20, ( time type ) \n"
+ " EMAIL_SEARCH_FILTER_TYPE_SENT_DATE_ON = 21, ( time type ) \n"
+ " EMAIL_SEARCH_FILTER_TYPE_SENT_DATE_SINCE = 22, ( time type ) \n"
+ " EMAIL_SEARCH_FILTER_TYPE_FLAGS_ANSWERED = 26, ( integer type ) \n"
+ " EMAIL_SEARCH_FILTER_TYPE_FLAGS_NEW = 27, ( integer type ) \n"
+ " EMAIL_SEARCH_FILTER_TYPE_FLAGS_DELETED = 28, ( integer type ) \n"
+ " EMAIL_SEARCH_FILTER_TYPE_FLAGS_OLD = 29, ( integer type ) \n"
+ " EMAIL_SEARCH_FILTER_TYPE_FLAGS_DRAFT = 30, ( integer type ) \n"
+ " EMAIL_SEARCH_FILTER_TYPE_FLAGS_FLAGED = 32, ( integer type ) \n"
+ " EMAIL_SEARCH_FILTER_TYPE_FLAGS_RECENT = 34, ( integer type ) \n"
+ " EMAIL_SEARCH_FILTER_TYPE_FLAGS_SEEN = 36, ( integer type ) \n"
+ " EMAIL_SEARCH_FILTER_TYPE_MESSAGE_ID = 43, ( string type ) \n"
+ " EMAIL_SEARCH_FILTER_TYPE_HEADER_PRIORITY = 50, ( integer type ) \n"
+ " EMAIL_SEARCH_FILTER_TYPE_ATTACHMENT_NAME = 60, ( string type ) \n"
+ " END = 0 \n");
+
+ testapp_print("input search filter type : ");
+ if (0 >= scanf("%d", (int*)&search_filter_type))
+ testapp_print("Invalid input. ");
+
+ search_filter[search_filter_count].search_filter_type = search_filter_type;
+
+ switch(search_filter_type) {
+ case EMAIL_SEARCH_FILTER_TYPE_MESSAGE_NO :
+ case EMAIL_SEARCH_FILTER_TYPE_UID :
+ case EMAIL_SEARCH_FILTER_TYPE_ALL :
+ case EMAIL_SEARCH_FILTER_TYPE_SIZE_LARSER :
+ case EMAIL_SEARCH_FILTER_TYPE_SIZE_SMALLER :
+ case EMAIL_SEARCH_FILTER_TYPE_FLAGS_ANSWERED :
+ case EMAIL_SEARCH_FILTER_TYPE_FLAGS_NEW :
+ case EMAIL_SEARCH_FILTER_TYPE_FLAGS_DELETED :
+ case EMAIL_SEARCH_FILTER_TYPE_FLAGS_OLD :
+ case EMAIL_SEARCH_FILTER_TYPE_FLAGS_DRAFT :
+ case EMAIL_SEARCH_FILTER_TYPE_FLAGS_FLAGED :
+ case EMAIL_SEARCH_FILTER_TYPE_FLAGS_RECENT :
+ case EMAIL_SEARCH_FILTER_TYPE_FLAGS_SEEN :
+ case EMAIL_SEARCH_FILTER_TYPE_HEADER_PRIORITY :
+ testapp_print("input search filter key value : ");
+ if (0 >= scanf("%d", &search_key_value_integer))
+ testapp_print("Invalid input. ");
+ search_filter[search_filter_count].search_filter_key_value.integer_type_key_value = search_key_value_integer;
+ break;
- case EMAIL_SEARCH_FILTER_TYPE_BCC :
- case EMAIL_SEARCH_FILTER_TYPE_CC :
- case EMAIL_SEARCH_FILTER_TYPE_FROM :
- case EMAIL_SEARCH_FILTER_TYPE_KEYWORD :
- case EMAIL_SEARCH_FILTER_TYPE_SUBJECT :
- case EMAIL_SEARCH_FILTER_TYPE_TO :
- case EMAIL_SEARCH_FILTER_TYPE_MESSAGE_ID :
- testapp_print("input search filter key value : ");
- result_from_scanf = scanf("%s", search_key_value_string);
- search_filter.search_filter_key_value.string_type_key_value = search_key_value_string;
- break;
+ case EMAIL_SEARCH_FILTER_TYPE_BCC :
+ case EMAIL_SEARCH_FILTER_TYPE_BODY :
+ case EMAIL_SEARCH_FILTER_TYPE_CC :
+ case EMAIL_SEARCH_FILTER_TYPE_FROM :
+ case EMAIL_SEARCH_FILTER_TYPE_KEYWORD :
+ case EMAIL_SEARCH_FILTER_TYPE_TEXT :
+ case EMAIL_SEARCH_FILTER_TYPE_SUBJECT :
+ case EMAIL_SEARCH_FILTER_TYPE_TO :
+ case EMAIL_SEARCH_FILTER_TYPE_MESSAGE_ID :
+ case EMAIL_SEARCH_FILTER_TYPE_ATTACHMENT_NAME :
+ testapp_print("input search filter key value : ");
+ if (0 >= scanf("%s", search_key_value_string))
+ testapp_print("Invalid input. ");
+ search_filter[search_filter_count].search_filter_key_value.string_type_key_value = strdup(search_key_value_string);
+ break;
- case EMAIL_SEARCH_FILTER_TYPE_SENT_DATE_BEFORE :
- case EMAIL_SEARCH_FILTER_TYPE_SENT_DATE_ON :
- case EMAIL_SEARCH_FILTER_TYPE_SENT_DATE_SINCE :
- time(&current_time);
- /* TODO : write codes for converting string to time */
- /* search_filter.search_filter_key_value.time_type_key_value = search_key_value_string; */
- search_filter.search_filter_key_value.time_type_key_value = current_time;
+ case EMAIL_SEARCH_FILTER_TYPE_SENT_DATE_BEFORE :
+ case EMAIL_SEARCH_FILTER_TYPE_SENT_DATE_ON :
+ case EMAIL_SEARCH_FILTER_TYPE_SENT_DATE_SINCE :
+ time(&current_time);
+ /* TODO : write codes for converting string to time */
+ /* search_filter.search_filter_key_value.time_type_key_value = search_key_value_string; */
+ search_filter[search_filter_count].search_filter_key_value.time_type_key_value = current_time;
+ break;
+ default :
+ testapp_print("END filter type [%d]", search_filter_type);
+ break;
+ }
+
+ if (!search_filter_type)
break;
- default :
- testapp_print("Invalid filter type [%d]", search_filter_type);
- return FALSE;
+
+ search_filter_count++;
}
- if( (err_code = email_search_mail_on_server(account_id, mailbox_id, &search_filter,1, &handle)) != EMAIL_ERROR_NONE) {
+ if( (err_code = email_search_mail_on_server(account_id, mailbox_id, search_filter, search_filter_count, &handle)) != EMAIL_ERROR_NONE) {
testapp_print("email_search_mail_on_server failed [%d]", err_code);
}
@@ -2056,7 +2151,6 @@ static gboolean testapp_test_add_mail_to_search_result_box()
int from_eas = 0;
int attachment_count = 0;
int err = EMAIL_ERROR_NONE;
- int result_from_scanf = 0;
char arg[50] = { 0 , };
char *body_file_path = MAIL_TEMP_BODY;
email_mailbox_t *mailbox_data = NULL;
@@ -2066,7 +2160,8 @@ static gboolean testapp_test_add_mail_to_search_result_box()
FILE *body_file = NULL;
testapp_print("\n > Enter account id : ");
- result_from_scanf = scanf("%d", &account_id);
+ if (0 >= scanf("%d", &account_id))
+ testapp_print("Invalid input. ");
email_get_mailbox_by_mailbox_type(account_id, EMAIL_MAILBOX_TYPE_SEARCH_RESULT, &mailbox_data);
@@ -2074,7 +2169,8 @@ static gboolean testapp_test_add_mail_to_search_result_box()
memset(test_mail_data, 0x00, sizeof(email_mail_data_t));
testapp_print("\n From EAS? [0/1]> ");
- result_from_scanf = scanf("%d", &from_eas);
+ if (0 >= scanf("%d", &from_eas))
+ testapp_print("Invalid input. ");
test_mail_data->account_id = account_id;
test_mail_data->save_status = 1;
@@ -2098,12 +2194,14 @@ static gboolean testapp_test_add_mail_to_search_result_box()
fclose(body_file);
testapp_print(" > Attach file? [0/1] : ");
- result_from_scanf = scanf("%d",&attachment_count);
+ if (0 >= scanf("%d",&attachment_count))
+ testapp_print("Invalid input. ");
if ( attachment_count ) {
memset(arg, 0x00, 50);
testapp_print("\n > Enter attachment name : ");
- result_from_scanf = scanf("%s", arg);
+ if (0 >= scanf("%s", arg))
+ testapp_print("Invalid input. ");
attachment_data = malloc(sizeof(email_attachment_data_t));
@@ -2111,7 +2209,8 @@ static gboolean testapp_test_add_mail_to_search_result_box()
memset(arg, 0x00, 50);
testapp_print("\n > Enter attachment absolute path : ");
- result_from_scanf = scanf("%s",arg);
+ if (0 >= scanf("%s",arg))
+ testapp_print("Invalid input. ");
attachment_data->attachment_path = strdup(arg);
attachment_data->save_status = 1;
@@ -2119,7 +2218,8 @@ static gboolean testapp_test_add_mail_to_search_result_box()
}
testapp_print("\n > Meeting Request? [0: no, 1: yes (request from server), 2: yes (response from local)]");
- result_from_scanf = scanf("%d", (int*)&(test_mail_data->meeting_request_status));
+ if (0 >= scanf("%d", (int*)&(test_mail_data->meeting_request_status)))
+ testapp_print("Invalid input. ");
if ( test_mail_data->meeting_request_status == 1
|| test_mail_data->meeting_request_status == 2 ) {
@@ -2169,21 +2269,24 @@ static gboolean testapp_test_add_mail_to_search_result_box()
static gboolean testapp_test_email_parse_mime_file()
{
- email_mail_data_t *mail_data = NULL;
- email_attachment_data_t *mail_attachment_data = NULL;
int i = 0;
int attachment_count = 0;
+ int output_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;
+ email_mail_data_t *mail_data = NULL;
+ email_attachment_data_t *mail_attachment_data = NULL;
+ email_mail_data_t *output_mail_data = NULL;
+ email_attachment_data_t *output_mail_attachment_data = NULL;
+
testapp_print("Input eml file path : ");
- result_from_scanf = scanf("%s", eml_file_path);
+ if (0 >= scanf("%s", eml_file_path))
+ testapp_print("Invalid input. ");
- if ((err = email_parse_mime_file(eml_file_path, &mail_data, &mail_attachment_data, &attachment_count)) != EMAIL_ERROR_NONE)
- {
+ if ((err = email_parse_mime_file(eml_file_path, &mail_data, &mail_attachment_data, &attachment_count)) != EMAIL_ERROR_NONE) {
testapp_print("email_parse_mime_file failed : [%d]\n", err);
return false;
}
@@ -2204,6 +2307,7 @@ static gboolean testapp_test_email_parse_mime_file()
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);
+ testapp_print("Priority: %d\n", mail_data->priority);
testapp_print("From: %s\n", mail_data->full_address_from);
testapp_print("Reply-To: %s\n", mail_data->full_address_reply);
testapp_print("Sender: %s\n", mail_data->email_address_sender);
@@ -2211,27 +2315,41 @@ 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("mail_size : %d\n", mail_data->mail_size);
testapp_print("download_body_status : %d\n", mail_data->body_download_status);
for (i = 0;i < attachment_count ; i++) {
+ testapp_print("%d attachment\n", i);
testapp_print("attachment_id: %d\n", mail_attachment_data[i].attachment_id);
+ testapp_print("attachment_size: %d\n", mail_attachment_data[i].attachment_size);
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);
testapp_print("attachment_path: %s\n", mail_attachment_data[i].attachment_path);
+ testapp_print("attachment_save_status: %d\n", mail_attachment_data[i].save_status);
+ testapp_print("content_id: %s\n", mail_attachment_data[i].content_id);
testapp_print("mailbox_id: %d\n", mail_attachment_data[i].mailbox_id);
}
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");
- }
-
+ if (mail_data->smime_type != EMAIL_SMIME_NONE) {
+ if (mail_data->smime_type == EMAIL_SMIME_SIGNED || mail_data->smime_type == EMAIL_PGP_SIGNED) {
+ if (!email_verify_signature_ex(mail_data, mail_attachment_data, attachment_count, &verify))
+ testapp_print("email_verify_signature_ex failed\n");
+ } else {
+ if ((err = email_get_decrypt_message_ex(mail_data,
+ mail_attachment_data,
+ attachment_count,
+ &output_mail_data,
+ &output_mail_attachment_data,
+ &output_attachment_count,
+ &verify)) != EMAIL_ERROR_NONE)
+ testapp_print("email_get_decrypt_message_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);
@@ -2258,27 +2376,18 @@ static gboolean testapp_test_email_write_mime_file()
{
int err = EMAIL_ERROR_NONE;
int mail_id = 0;
- int ret_scanf = 0;
- int is_file_path = 0;
int attachment_count = 0;
- int account_id = 0;
char *file_path = NULL;
email_mail_data_t *mail_data = NULL;
email_attachment_data_t *mail_attachment_data = NULL;
- testapp_print("Is file path (0 or 1): ");
- ret_scanf = scanf("%d", &is_file_path);
-
- if (is_file_path) {
- file_path = malloc(512);
- memset(file_path, 0x00, 512);
- testapp_print("Input output file path : ");
- ret_scanf = scanf("%s", file_path);
- }
- testapp_print("Input mail id : ");
- ret_scanf = scanf("%d", &mail_id);
+ file_path = malloc(512);
+ memset(file_path, 0x00, 512);
+ testapp_print("Input mail id : ");
+ if (0 >= scanf("%d", &mail_id))
+ testapp_print("Invalid input. ");
err = email_get_mail_data(mail_id, &mail_data);
if (err != EMAIL_ERROR_NONE || mail_data == NULL) {
@@ -2292,10 +2401,7 @@ static gboolean testapp_test_email_write_mime_file()
return false;
}
- testapp_print("Input Account id : ");
- ret_scanf = scanf("%d", &account_id);
-
- mail_data->account_id = account_id;
+ snprintf(file_path, 512, "/opt/usr/data/email/.email_data/tmp/%d_%8d.eml", mail_id, (int)time(NULL));
err = email_write_mime_file(mail_data, mail_attachment_data, attachment_count, &file_path);
if (err != EMAIL_ERROR_NONE) {
@@ -2320,12 +2426,12 @@ static gboolean testapp_test_email_write_mime_file()
static gboolean testapp_test_smime_verify_signature()
{
int mail_id = 0;
- int ret_scanf = 0;
int verify = 0;
int err = EMAIL_ERROR_NONE;
testapp_print("input mail_id :");
- ret_scanf = scanf("%d", &mail_id);
+ if (0 >= scanf("%d", &mail_id))
+ testapp_print("Invalid input. ");
err = email_verify_signature(mail_id, &verify);
if (err != EMAIL_ERROR_NONE) {
@@ -2337,6 +2443,208 @@ static gboolean testapp_test_smime_verify_signature()
return true;
}
+static gboolean testapp_test_email_add_mail_with_multiple_recipient()
+{
+ int i = 0;
+ int account_id = 0;
+ int err = EMAIL_ERROR_NONE;
+// int smime_type = 0;
+ int recipient_addresses_count = 0;
+ char *recipient_addresses = NULL;
+ char recipient_address[234] = { 0, };
+ char from_address[300] = { 0 , };
+ const char *body_file_path = MAIL_TEMP_BODY;
+ email_account_t *account_data = NULL;
+ email_mailbox_t *mailbox_data = NULL;
+ email_mail_data_t *test_mail_data = NULL;
+ FILE *body_file;
+
+ testapp_print("\n > Enter account id : ");
+ if (0 >= scanf("%d", &account_id))
+ testapp_print("Invalid input. ");
+
+ testapp_print("\n > Enter recipient address count : ");
+ if (0 >= scanf("%d", &recipient_addresses_count))
+ testapp_print("Invalid input. ");
+
+ if(recipient_addresses_count < 1)
+ return TRUE;
+
+ recipient_addresses = malloc(sizeof(char) * 234 * recipient_addresses_count);
+
+ for (i = 0; i < recipient_addresses_count; i++) {
+ snprintf(recipient_address, 234, "\"mailtest%05d\" <mailtest%05d@a1234567890b1234567890.com>; ", i, i);
+ strcat(recipient_addresses, recipient_address);
+ }
+
+ email_get_account(account_id, GET_FULL_DATA_WITHOUT_PASSWORD, &account_data);
+
+ email_get_mailbox_by_mailbox_type(account_id, EMAIL_MAILBOX_TYPE_OUTBOX, &mailbox_data);
+
+ test_mail_data = malloc(sizeof(email_mail_data_t));
+ memset(test_mail_data, 0x00, sizeof(email_mail_data_t));
+
+ SNPRINTF(from_address, 300, "<%s>", account_data->user_email_address);
+
+ 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 = recipient_addresses;
+ 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;
+ test_mail_data->smime_type = 0;
+
+ body_file = fopen(body_file_path, "w");
+
+ testapp_print("\n body_file [%p]\n", body_file);
+
+ if(body_file == NULL) {
+ testapp_print("\n fopen [%s]failed\n", body_file_path);
+ return FALSE;
+ }
+
+ for(i = 0; i < 100; i++)
+ fprintf(body_file, "Mail sending Test. [%d]\n", i);
+
+ fflush(body_file);
+ fclose(body_file);
+
+
+ if((err = email_add_mail(test_mail_data, NULL, 0, NULL, 0)) != EMAIL_ERROR_NONE)
+ testapp_print("email_add_mail failed. [%d]\n", err);
+ else
+ testapp_print("email_add_mail success.\n");
+
+ testapp_print("saved mail id = [%d]\n", test_mail_data->mail_id);
+
+ email_free_mail_data(&test_mail_data, 1);
+ email_free_mailbox(&mailbox_data, 1);
+ email_free_account(&account_data, 1);
+
+ return FALSE;
+}
+
+static gboolean testapp_test_send_mails_every_x_minutes()
+{
+ int added_mail_id = 0;
+ int err = EMAIL_ERROR_NONE;
+ int handle = 0;
+ time_t time_to_send;
+ int i = 0;
+ int j = 0;
+ int account_id = 0;
+ int send_interval_in_minutes = 0;
+ int number_of_mails = 0;
+ char recipient_address[300] = { 0 , };
+ char from_address[300] = { 0 , };
+ char subject_form[1024] = { 0 , };
+ const char *body_file_path = MAIL_TEMP_BODY;
+ struct tm *time_to_send_tm;
+ email_account_t *account_data = NULL;
+ email_mailbox_t *mailbox_data = NULL;
+ email_mail_data_t *test_mail_data = NULL;
+ FILE *body_file;
+
+ testapp_print("\n > Enter account id : ");
+ if (0 >= scanf("%d", &account_id))
+ testapp_print("Invalid input. ");
+
+ testapp_print("\n > Enter recipient address : ");
+ if (0 >= scanf("%s", recipient_address))
+ testapp_print("Invalid input. ");
+
+ testapp_print("\n > Enter number of mails: ");
+ if (0 >= scanf("%d", &number_of_mails))
+ testapp_print("Invalid input. ");
+
+ testapp_print("\n > Enter send interval in minutes: ");
+ if (0 >= scanf("%d", &send_interval_in_minutes))
+ testapp_print("Invalid input. ");
+
+ email_get_account(account_id, GET_FULL_DATA_WITHOUT_PASSWORD, &account_data);
+
+ email_get_mailbox_by_mailbox_type(account_id, EMAIL_MAILBOX_TYPE_OUTBOX, &mailbox_data);
+
+ test_mail_data = malloc(sizeof(email_mail_data_t));
+ memset(test_mail_data, 0x00, sizeof(email_mail_data_t));
+
+ SNPRINTF(from_address, 300, "<%s>", account_data->user_email_address);
+
+ 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(recipient_address);
+ test_mail_data->remaining_resend_times = 3;
+ test_mail_data->report_status = EMAIL_MAIL_REPORT_NONE;
+
+
+ for (i = 0; i < number_of_mails; i++) {
+ if (test_mail_data->subject)
+ free(test_mail_data->subject);
+
+ time(&time_to_send);
+ time_to_send += (60 * send_interval_in_minutes) * (i + 1);
+ time_to_send_tm = localtime(&time_to_send);
+
+ strftime(subject_form, 1024, "[%H:%M] TEST.", time_to_send_tm);
+ test_mail_data->subject = strdup(subject_form);
+
+ body_file = fopen(body_file_path, "w");
+
+ testapp_print("\n body_file [%p]\n", body_file);
+
+ if(body_file == NULL) {
+ testapp_print("\n fopen [%s]failed\n", body_file_path);
+ return FALSE;
+ }
+
+ for(j = 0; j < 100; j++)
+ fprintf(body_file, "Mail sending Test. [%d]\n", j);
+
+ fflush(body_file);
+ fclose(body_file);
+
+ if((err = email_add_mail(test_mail_data, NULL, 0, NULL, 0)) != EMAIL_ERROR_NONE) {
+ testapp_print("email_add_mail failed. [%d]\n", err);
+ added_mail_id = 0;
+ }
+ else {
+ testapp_print("email_add_mail success.\n");
+ added_mail_id = test_mail_data->mail_id;
+ }
+
+ testapp_print("saved mail id = [%d]\n", added_mail_id);
+
+ if(added_mail_id) {
+ testapp_print("Calling email_schedule_sending_mail...\n");
+
+ if( email_schedule_sending_mail(added_mail_id, time_to_send) < 0) {
+ testapp_print("email_schedule_sending_mail failed[%d]\n", err);
+ }
+ else {
+ testapp_print("Start sending. handle[%d]\n", handle);
+ }
+ }
+ }
+
+ email_free_mail_data(&test_mail_data, 1);
+ email_free_mailbox(&mailbox_data, 1);
+ email_free_account(&account_data, 1);
+
+ return TRUE;
+}
+
/* internal functions */
static gboolean testapp_test_interpret_command (int menu_number)
{
@@ -2463,11 +2771,17 @@ static gboolean testapp_test_interpret_command (int menu_number)
case 60:
testapp_test_email_parse_mime_file();
break;
+ case 61:
+ testapp_test_email_write_mime_file();
+ break;
case 62:
testapp_test_smime_verify_signature();
break;
- case 61:
- testapp_test_email_write_mime_file();
+ case 63:
+ testapp_test_email_add_mail_with_multiple_recipient();
+ break;
+ case 64:
+ testapp_test_send_mails_every_x_minutes();
break;
case 0:
go_to_loop = FALSE;
@@ -2483,13 +2797,13 @@ void testapp_mail_main()
{
gboolean go_to_loop = TRUE;
int menu_number = 0;
- int result_from_scanf = 0;
while (go_to_loop) {
testapp_show_menu(EMAIL_MAIL_MENU);
testapp_show_prompt(EMAIL_MAIL_MENU);
- result_from_scanf = scanf("%d", &menu_number);
+ if (0 >= scanf("%d", &menu_number))
+ testapp_print("Invalid input");
go_to_loop = testapp_test_interpret_command (menu_number);
}
diff --git a/utilities/test-application/testapp-mailbox.c b/utilities/test-application/testapp-mailbox.c
index 6caee04..5540da4 100755
--- a/utilities/test-application/testapp-mailbox.c
+++ b/utilities/test-application/testapp-mailbox.c
@@ -79,30 +79,34 @@ static gboolean testapp_test_add_mailbox()
char arg[500];
int ret;
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);
+ if (0 >= scanf("%s",arg))
+ testapp_print("Invalid input. ");
mailbox.mailbox_name = strdup(arg);
memset(arg, 0x00, 500);
testapp_print("> Enter mailbox alias name: ");
- result_from_scanf = scanf("%s",arg);
+ if (0 >= scanf("%s",arg))
+ testapp_print("Invalid input. ");
mailbox.alias = strdup(arg);
testapp_print("> Enter account id: ");
- result_from_scanf = scanf("%d", &account_id);
+ if (0 >= scanf("%d", &account_id))
+ testapp_print("Invalid input. ");
mailbox.account_id = account_id;
testapp_print("> Enter local_yn (1/0): ");
- result_from_scanf = scanf("%d", &local_yn);
+ if (0 >= scanf("%d", &local_yn))
+ testapp_print("Invalid input. ");
mailbox.local= local_yn;
testapp_print("> Enter mailbox type: ");
- result_from_scanf = scanf("%d", &mailbox_type);
+ if (0 >= scanf("%d", &mailbox_type))
+ testapp_print("Invalid input. ");
mailbox.mailbox_type= mailbox_type;
mailbox.eas_data = strdup("EAS DATA TEST");
@@ -130,13 +134,14 @@ static gboolean testapp_test_delete_mailbox()
int on_server = 0;
int ret;
int handle;
- int result_from_scanf = 0;
testapp_print("\n> Enter mailbox id:");
- result_from_scanf = scanf("%d", &mailbox_id);
+ if (0 >= scanf("%d", &mailbox_id))
+ testapp_print("Invalid input");
testapp_print("> Enter on_server (1/0): ");
- result_from_scanf = scanf("%d", &on_server);
+ if (0 >= scanf("%d", &on_server))
+ testapp_print("Invalid input");
ret = email_delete_mailbox(mailbox_id, on_server, &handle);
@@ -158,17 +163,19 @@ static gboolean testapp_test_rename_mailbox()
char mailbox_name[500] = { 0, };
char mailbox_alias[500] = { 0, };
int err;
- int result_from_scanf = 0;
int handle = 0;
testapp_print("> Enter mailbox id: ");
- result_from_scanf = scanf("%d", &mailbox_id);
+ if (0 >= scanf("%d", &mailbox_id))
+ testapp_print("Invalid input");
testapp_print("> Enter new mailbox name: ");
- result_from_scanf = scanf("%s", mailbox_name);
+ if (0 >= scanf("%s", mailbox_name))
+ testapp_print("Invalid input");
testapp_print("> Enter new mailbox name: ");
- result_from_scanf = scanf("%s", mailbox_alias);
+ if (0 >= scanf("%s", mailbox_alias))
+ testapp_print("Invalid input");
if ( (err = email_rename_mailbox(mailbox_id, mailbox_name, mailbox_alias, true, &handle)) < 0) {
@@ -185,10 +192,10 @@ static gboolean testapp_test_get_imap_mailbox_list()
{
int account_id = 0;
int handle = 0;
- int result_from_scanf = 0;
testapp_print("> Enter account id: ");
- result_from_scanf = scanf("%d", &account_id);
+ if (0 >= scanf("%d", &account_id))
+ testapp_print("Invalid input");
if( email_sync_imap_mailbox_list(account_id, &handle) < 0)
testapp_print("email_sync_imap_mailbox_list failed");
@@ -201,13 +208,14 @@ static gboolean testapp_test_set_local_mailbox()
{
int mailbox_id = 0;
int is_local_mailbox = 0;
- int result_from_scanf = 0;
testapp_print("> Enter mailbox id: ");
- result_from_scanf = scanf("%d", &mailbox_id);
+ if (0 >= scanf("%d", &mailbox_id))
+ testapp_print("Invalid input");
testapp_print("> Enter local: ");
- result_from_scanf = scanf("%d", &is_local_mailbox);
+ if (0 >= scanf("%d", &is_local_mailbox))
+ testapp_print("Invalid input");
if( email_set_local_mailbox(mailbox_id, is_local_mailbox) < 0)
testapp_print("email_set_local_mailbox failed");
@@ -224,16 +232,18 @@ static gboolean testapp_test_delete_mailbox_ex()
int on_server = 0;
int handle = 0;
int i = 0;
- int result_from_scanf = 0;
testapp_print("\n > Enter account_id: ");
- result_from_scanf = scanf("%d", &account_id);
+ if (0 >= scanf("%d", &account_id))
+ testapp_print("Invalid input");
testapp_print("\n > Enter mailbox_id_count: ");
- result_from_scanf = scanf("%d", &mailbox_id_count);
+ if (0 >= scanf("%d", &mailbox_id_count))
+ testapp_print("Invalid input");
testapp_print("\n > Enter on_server: ");
- result_from_scanf = scanf("%d", &on_server);
+ if (0 >= scanf("%d", &on_server))
+ testapp_print("Invalid input");
mailbox_id_count = (mailbox_id_count < 5000)?mailbox_id_count:5000;
@@ -243,7 +253,8 @@ static gboolean testapp_test_delete_mailbox_ex()
for(i = 0; i < mailbox_id_count; i++) {
testapp_print("\n > Enter mailbox id: ");
- result_from_scanf = scanf("%d", (mailbox_id_array + i));
+ if (0 >= scanf("%d", (mailbox_id_array + i)))
+ testapp_print("Invalid input");
}
err = email_delete_mailbox_ex(account_id, mailbox_id_array, mailbox_id_count, on_server, &handle);
@@ -260,15 +271,16 @@ static gboolean testapp_test_get_mailbox_by_type()
int account_id =0;
int err_code = EMAIL_ERROR_NONE;
- int result_from_scanf = 0;
email_mailbox_t *mailbox =NULL;
email_mailbox_type_e mailbox_type =0;
testapp_print("\n > Enter account id: ");
- result_from_scanf = scanf("%d", &account_id);
+ if (0 >= scanf("%d", &account_id))
+ testapp_print("Invalid input");
testapp_print("\n > Enter mailbox_type: ");
- result_from_scanf = scanf("%d", (int*)&mailbox_type);
+ if (0 >= scanf("%d", (int*)&mailbox_type))
+ testapp_print("Invalid input");
if( (err_code = email_get_mailbox_by_mailbox_type(account_id,mailbox_type,&mailbox)) < 0) {
testapp_print(" email_get_mailbox_by_mailbox_type error : %d\n",err_code);
@@ -286,13 +298,14 @@ static gboolean testapp_test_set_mailbox_type()
int mailbox_id = 0;
int mailbox_type = 0;
int err_code = EMAIL_ERROR_NONE;
- int result_from_scanf = 0;
testapp_print("\n > Enter mailbox id : ");
- result_from_scanf = scanf("%d", &mailbox_id);
+ if (0 >= scanf("%d", &mailbox_id))
+ testapp_print("Invalid input");
testapp_print("\n > Enter mailbox type : ");
- result_from_scanf = scanf("%d", &mailbox_type);
+ if (0 >= scanf("%d", &mailbox_type))
+ testapp_print("Invalid input");
if( (err_code = email_set_mailbox_type(mailbox_id, mailbox_type) ) != EMAIL_ERROR_NONE) {
testapp_print("\nemail_set_mailbox_type error : %d\n", err_code);
@@ -307,16 +320,18 @@ static gboolean testapp_test_set_mail_slot_size ()
int mailbox_id = 0;
int mail_slot_size = 0;
int err_code = EMAIL_ERROR_NONE;
- int result_from_scanf = 0;
testapp_print("\n > Enter account id (0: All account): ");
- result_from_scanf = scanf("%d", &account_id);
+ if (0 >= scanf("%d", &account_id))
+ testapp_print("Invalid input");
testapp_print("\n> Enter mailbox id (0 : All mailboxes):");
- result_from_scanf = scanf("%d", &mailbox_id);
+ if (0 >= scanf("%d", &mailbox_id))
+ testapp_print("Invalid input");
testapp_print("\n > Enter mailbox slot size: ");
- result_from_scanf = scanf("%d", &mail_slot_size);
+ if (0 >= scanf("%d", &mail_slot_size))
+ testapp_print("Invalid input");
if( (err_code = email_set_mail_slot_size(account_id, mailbox_id, mail_slot_size) ) < 0) {
testapp_print(" testapp_test_set_mail_slot_size error : %d\n", err_code);
@@ -328,16 +343,17 @@ static gboolean testapp_test_set_mail_slot_size ()
static gboolean testapp_test_get_mailbox_list ()
{
- int result_from_scanf = 0;
int account_id =0;
int mailbox_sync_type;
int count = 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);
+ if (0 >= scanf("%d", &account_id))
+ testapp_print("Invalid input");
testapp_print("\n > Enter mailbox_sync_type\n[-1 :for all mailboxes, 0 : for mailboxes from server, 1 : local mailboxes\n : ");
- result_from_scanf = scanf("%d", &mailbox_sync_type);
+ if (0 >= scanf("%d", &mailbox_sync_type))
+ testapp_print("Invalid input");
if((error_code = email_get_mailbox_list(account_id, mailbox_sync_type, &mailbox_list, &count)) < 0) {
testapp_print(" email_get_mailbox_list error %d\n", error_code);
@@ -361,17 +377,18 @@ static gboolean testapp_test_get_mailbox_list ()
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);
+ if (0 >= scanf("%d", &account_id))
+ testapp_print("Invalid input");
testapp_print("> Enter keyword: ");
- result_from_scanf = scanf("%s", keyword);
+ if (0 >= scanf("%s", keyword))
+ testapp_print("Invalid input");
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);
@@ -388,16 +405,17 @@ static gboolean testapp_test_get_mailbox_list_by_keyword ()
static gboolean testapp_test_sync_mailbox()
{
- int result_from_scanf = 0;
int account_id = 0;
int handle = 0;
int mailbox_id = 0;
testapp_print("\n > Enter Account id (0: for all account) : ");
- result_from_scanf = scanf("%d",&account_id);
+ if (0 >= scanf("%d",&account_id))
+ testapp_print("Invalid input");
testapp_print("\n > Enter Mailbox id (0: for all mailboxes) : ");
- result_from_scanf = scanf("%d",&mailbox_id);
+ if (0 >= scanf("%d",&mailbox_id))
+ testapp_print("Invalid input");
if(account_id == ALL_ACCOUNT) {
if(email_sync_header_for_all_account(&handle) < 0)
@@ -417,11 +435,11 @@ static gboolean testapp_test_sync_mailbox()
static gboolean testapp_test_stamp_sync_time()
{
- int result_from_scanf;
int input_mailbox_id = 0;
testapp_print("\n > Enter Mailbox id : ");
- result_from_scanf = scanf("%d",&input_mailbox_id);
+ if (0 >= scanf("%d",&input_mailbox_id))
+ testapp_print("Invalid input");
email_stamp_sync_time_of_mailbox(input_mailbox_id);
@@ -436,18 +454,19 @@ static gboolean testapp_test_rename_mailbox_ex()
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);
+ if (0 >= scanf("%d", &mailbox_id))
+ testapp_print("Invalid input. ");
testapp_print("> Enter new mailbox name: ");
- result_from_scanf = scanf("%s", mailbox_name);
+ if (0 >= scanf("%s", mailbox_name))
+ testapp_print("Invalid input. ");
testapp_print("> Enter new mailbox alias: ");
- result_from_scanf = scanf("%s", mailbox_alias);
-
+ if (0 >= scanf("%s", mailbox_alias))
+ testapp_print("Invalid input. ");
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);
@@ -533,13 +552,13 @@ void email_test_mailbox_main()
{
gboolean go_to_loop = TRUE;
int menu_number = 0;
- int result_from_scanf = 0;
while (go_to_loop) {
testapp_show_menu (EMAIL_MAILBOX_MENU);
testapp_show_prompt (EMAIL_MAILBOX_MENU);
- result_from_scanf = scanf("%d", &menu_number);
+ if (0 >= scanf("%d", &menu_number))
+ testapp_print("Invalid input. ");
go_to_loop = testapp_test_interpret_command (menu_number);
}
diff --git a/utilities/test-application/testapp-others.c b/utilities/test-application/testapp-others.c
index e24d32e..51c2af1 100755
--- a/utilities/test-application/testapp-others.c
+++ b/utilities/test-application/testapp-others.c
@@ -54,19 +54,28 @@ static gboolean testapp_test_cancel_job ()
{
int account_id = 0;
int handle = 0;
- int result_from_scanf = 0;
testapp_print("\n > Enter account_id (0: all account): ");
- result_from_scanf = scanf("%d", &account_id);
+ if (0 >= scanf("%d", &account_id))
+ testapp_print("Invalid input. ");
testapp_print("\n > Enter handle: ");
- result_from_scanf = scanf("%d", &handle);
+ if (0 >= scanf("%d", &handle))
+ testapp_print("Invalid input. ");
if(email_cancel_job(account_id, handle, EMAIL_CANCELED_BY_USER) < 0)
testapp_print("email_cancel_job failed..!");
return FALSE;
}
+static gboolean testapp_test_init_storage()
+{
+ if(email_init_storage() < 0)
+ testapp_print("email_init_storaege failed..!");
+
+ return FALSE;
+}
+
static gboolean testapp_test_set_dnet_proper_profile_type()
{
testapp_print("NOT Support\n");
@@ -83,14 +92,14 @@ static gboolean testapp_test_get_dnet_proper_profile_type()
static gboolean testapp_test_get_preview_text_from_file()
{
- int result_from_scanf;
char *preview_buffer = NULL;
char html_file_path[1024] = { 0, };
testapp_print("\n > Enter file path : ");
- result_from_scanf = scanf("%s", html_file_path);
+ if (0 >= scanf("%s", html_file_path))
+ testapp_print("Invalid input. ");
- emcore_get_preview_text_from_file(NULL, html_file_path, 1024, &preview_buffer);
+ emcore_get_preview_text_from_file(NULL, NULL, html_file_path, 1024, &preview_buffer);
testapp_print("\n result :\n %s ", preview_buffer);
@@ -361,10 +370,10 @@ static gboolean email_test_dtt_Datastore_C()
static gboolean testapp_test_show_user_message()
{
int mail_id;
- int result_from_scanf = 0;
testapp_print("\n > Enter mail id : ");
- result_from_scanf = scanf("%d", &mail_id);
+ if (0 >= scanf("%d", &mail_id))
+ testapp_print("Invalid input. ");
email_show_user_message(mail_id, EMAIL_ACTION_SEND_MAIL, EMAIL_ERROR_NETWORK_NOT_AVAILABLE);
return FALSE;
@@ -373,11 +382,11 @@ static gboolean testapp_test_show_user_message()
static gboolean testapp_test_get_mime_entity()
{
char mime_path[512] = {0, };
- int result_from_scanf = 0;
char *mime_entity = NULL;
testapp_print("\n > Enter mime path for parsing : ");
- result_from_scanf = scanf("%s", mime_path);
+ if (0 >= scanf("%s", mime_path))
+ testapp_print("Invalid input. ");
email_get_mime_entity(mime_path, &mime_entity);
@@ -387,15 +396,32 @@ static gboolean testapp_test_get_mime_entity()
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);
+ if (0 >= scanf("%d", &account_id))
+ testapp_print("Invalid input. ");
email_query_smtp_mail_size_limit(account_id, NULL);
return true;
}
+static gboolean testapp_test_verify_email_address()
+{
+ int err = EMAIL_ERROR_NONE;
+ char email_address[512] = {0, };
+
+ testapp_print("\n > Enter mime path for parsing : ");
+ if (0 >= scanf("%s", email_address))
+ testapp_print("Invalid input. ");
+
+ err = email_verify_email_address(email_address);
+
+ testapp_print("\nemail_verify_email_address returns [%d]\n", err);
+ return true;
+}
+
+
+
static gboolean testapp_test_interpret_command (int menu_number)
{
gboolean go_to_loop = TRUE;
@@ -404,6 +430,9 @@ static gboolean testapp_test_interpret_command (int menu_number)
case 1:
testapp_test_ping_service();
break;
+ case 2:
+ testapp_test_init_storage();
+ break;
case 3:
testapp_test_cancel_job ();
break;
@@ -439,6 +468,9 @@ static gboolean testapp_test_interpret_command (int menu_number)
case 17:
testapp_test_query_smtp_mail_size_limit();
break;
+ case 18:
+ testapp_test_verify_email_address();
+ break;
case 0:
go_to_loop = FALSE;
break;
@@ -453,13 +485,13 @@ void testapp_others_main()
{
gboolean go_to_loop = TRUE;
int menu_number = 0;
- int result_from_scanf = 0;
while (go_to_loop) {
testapp_show_menu (EMAIL_OTHERS_MENU);
testapp_show_prompt (EMAIL_OTHERS_MENU);
- result_from_scanf = scanf ("%d", &menu_number);
+ if (0 >= scanf ("%d", &menu_number))
+ testapp_print("Invalid input. ");
go_to_loop = testapp_test_interpret_command (menu_number);
}
diff --git a/utilities/test-application/testapp-rule.c b/utilities/test-application/testapp-rule.c
index 9cb6519..e963b2e 100755
--- a/utilities/test-application/testapp-rule.c
+++ b/utilities/test-application/testapp-rule.c
@@ -45,38 +45,44 @@ static gboolean testapp_test_add_rule()
int type = 0;
int flag = 0;
char arg[500];
- int result_from_scanf = 0;
rule = malloc(sizeof(email_rule_t));
testapp_print("> Enter account id: ");
- result_from_scanf = scanf("%d", &account_id);
+ if (0 >= scanf("%d", &account_id))
+ testapp_print("Invalid input. ");
rule->account_id = account_id;
testapp_print("> Enter Type(FROM - 1 / SUBJECT - 2): ");
- result_from_scanf = scanf("%d", &type);
+ if (0 >= scanf("%d", &type))
+ testapp_print("Invalid input. ");
rule->type= type;
memset(arg, 0x00, 500);
testapp_print("\n> Enter Filtering Value:");
- result_from_scanf = scanf("%s",arg);
+ if (0 >= scanf("%s",arg))
+ testapp_print("Invalid input. ");
rule->value= strdup(arg);
testapp_print("> Enter Action(MOVE - 1, BLOCK - 2, DELETE - 3): ");
- result_from_scanf = scanf("%d", &action);
+ if (0 >= scanf("%d", &action))
+ testapp_print("Invalid input. ");
rule->faction= action;
if (action == 1) {
testapp_print("\n> Enter target mailbox id:");
- result_from_scanf = scanf("%d", &target_mailbox_id);
+ if (0 >= scanf("%d", &target_mailbox_id))
+ testapp_print("Invalid input. ");
rule->target_mailbox_id = target_mailbox_id;
}
- testapp_print("> Enter Flag1 value: ");
- result_from_scanf = scanf("%d", &flag);
+ testapp_print("> Enter Flag1 value [On/Off]: ");
+ if (0 >= scanf("%d", &flag))
+ testapp_print("Invalid input. ");
rule->flag1= flag;
- testapp_print("> Enter Flag2 value: ");
- result_from_scanf = scanf("%d", &flag);
+ testapp_print("> Enter Flag2 value [0:Exactly same as, 1:Include, 2:Compare Domain] : ");
+ if (0 >= scanf("%d", &flag))
+ testapp_print("Invalid input. ");
rule->flag2= flag;
if (email_add_rule(rule) < 0)
@@ -94,11 +100,11 @@ static gboolean testapp_test_add_rule()
static gboolean testapp_test_delete_rule()
{
- int result_from_scanf = 0;
int filter_id = 0;
testapp_print("> Enter filter id: ");
- result_from_scanf = scanf("%d", &filter_id);
+ if (0 >= scanf("%d", &filter_id))
+ testapp_print("Invalid input. ");
if(email_delete_rule(filter_id) < 0)
testapp_print("email_delete_rule failed..! ");
@@ -109,7 +115,6 @@ static gboolean testapp_test_delete_rule()
static gboolean testapp_test_update_rule()
{
- int result_from_scanf = 0;
email_rule_t* rule = NULL;
int account_id = 0;
int target_mailbox_id = 0;
@@ -122,37 +127,45 @@ static gboolean testapp_test_update_rule()
rule = malloc(sizeof(email_rule_t));
memset(rule,0X00,sizeof(email_rule_t));
testapp_print("> Enter filter id: ");
- result_from_scanf = scanf("%d", &filter_id);
+ if (0 >= scanf("%d", &filter_id))
+ testapp_print("Invalid input. ");
testapp_print("> Enter account id: ");
- result_from_scanf = scanf("%d", &account_id);
+ if (0 >= scanf("%d", &account_id))
+ testapp_print("Invalid input. ");
rule->account_id = account_id;
testapp_print("> Enter Type(FROM - 1 / SUBJECT - 2): ");
- result_from_scanf = scanf("%d", &type);
+ if (0 >= scanf("%d", &type))
+ testapp_print("Invalid input. ");
rule->type= type;
memset(arg, 0x00, 500);
testapp_print("\n> Enter Filtering Value:");
- result_from_scanf = scanf("%s",arg);
+ if (0 >= scanf("%s",arg))
+ testapp_print("Invalid input. ");
rule->value= strdup(arg);
testapp_print("> Enter Action(MOVE - 1, BLOCK - 2, DELETE - 3): ");
- result_from_scanf = scanf("%d", &action);
+ if (0 >= scanf("%d", &action))
+ testapp_print("Invalid input. ");
rule->faction= action;
if (action == 1) {
testapp_print("\n> Enter target mailbox id:");
- result_from_scanf = scanf("%d", &target_mailbox_id);
+ if (0 >= scanf("%d", &target_mailbox_id))
+ testapp_print("Invalid input. ");
rule->target_mailbox_id = target_mailbox_id;
}
testapp_print("> Enter Flag1 value: ");
- result_from_scanf = scanf("%d", &flag);
+ if (0 >= scanf("%d", &flag))
+ testapp_print("Invalid input. ");
rule->flag1= flag;
testapp_print("> Enter Flag2 value: ");
- result_from_scanf = scanf("%d", &flag);
+ if (0 >= scanf("%d", &flag))
+ testapp_print("Invalid input. ");
rule->flag2= flag;
if( !email_update_rule(filter_id, rule) < 0)
@@ -168,10 +181,10 @@ static gboolean testapp_test_get_rule(void)
{
email_rule_t* rule = NULL;
int filter_id = 0;
- int result_from_scanf = 0;
testapp_print("> Enter filter id: ");
- result_from_scanf = scanf("%d", &filter_id);
+ if (0 >= scanf("%d", &filter_id))
+ testapp_print("Invalid input. ");
if(email_get_rule(filter_id, &rule) >= 0)
testapp_print("\n Got rule of account_id = %d and type = %d\n", rule->account_id, rule->type);
@@ -242,13 +255,13 @@ void email_test_rule_main()
{
gboolean go_to_loop = TRUE;
int menu_number = 0;
- int result_from_scanf = 0;
while (go_to_loop) {
testapp_show_menu (EMAIL_RULE_MENU);
testapp_show_prompt (EMAIL_RULE_MENU);
- result_from_scanf = scanf("%d", &menu_number);
+ if (0 >= scanf("%d", &menu_number))
+ testapp_print("Invalid input. ");
go_to_loop = testapp_test_interpret_command (menu_number);
}
diff --git a/utilities/test-application/testapp-thread.c b/utilities/test-application/testapp-thread.c
index 34b913e..cfad6e2 100755
--- a/utilities/test-application/testapp-thread.c
+++ b/utilities/test-application/testapp-thread.c
@@ -41,19 +41,20 @@ static gboolean testapp_test_move_thread()
{
int thread_id, move_always_flag;
int target_mailbox_id;
- int result;
- int result_from_scanf = 0;
testapp_print("\n > Enter thread_id: ");
- result_from_scanf = scanf("%d", &thread_id);
+ if (0 >= scanf("%d", &thread_id))
+ testapp_print("Invalid input. ");
testapp_print("\n > Enter target_mailbox_id: ");
- result_from_scanf = scanf("%d", &target_mailbox_id);
+ if (0 >= scanf("%d", &target_mailbox_id))
+ testapp_print("Invalid input. ");
testapp_print("\n > Enter move_always_flag: ");
- result_from_scanf = scanf("%d", &move_always_flag);
+ if (0 >= scanf("%d", &move_always_flag))
+ testapp_print("Invalid input. ");
- result = email_move_thread_to_mailbox(thread_id, target_mailbox_id, move_always_flag);
+ email_move_thread_to_mailbox(thread_id, target_mailbox_id, move_always_flag);
return FALSE;
}
@@ -61,16 +62,16 @@ static gboolean testapp_test_move_thread()
static gboolean testapp_test_delete_thread()
{
int thread_id, delete_always_flag;
- int result;
- int result_from_scanf = 0;
testapp_print("\n > Enter thread_id: ");
- result_from_scanf = scanf("%d", &thread_id);
+ if (0 >= scanf("%d", &thread_id))
+ testapp_print("Invalid input. ");
testapp_print("\n > Enter delete_always_flag: ");
- result_from_scanf = scanf("%d", &delete_always_flag);
+ if (0 >= scanf("%d", &delete_always_flag))
+ testapp_print("Invalid input. ");
- result = email_delete_thread(thread_id, delete_always_flag);
+ email_delete_thread(thread_id, delete_always_flag);
return FALSE;
}
@@ -78,19 +79,20 @@ static gboolean testapp_test_delete_thread()
static gboolean testapp_test_set_seen_flag_of_thread()
{
int thread_id, seen_flag, on_server;
- int result;
- int result_from_scanf = 0;
testapp_print("\n > Enter thread_id: ");
- result_from_scanf = scanf("%d", &thread_id);
+ if (0 >= scanf("%d", &thread_id))
+ testapp_print("Invalid input. ");
testapp_print("\n > Enter seen_flag: ");
- result_from_scanf = scanf("%d", &seen_flag);
+ if (0 >= scanf("%d", &seen_flag))
+ testapp_print("Invalid input. ");
testapp_print("\n > Enter on_server: ");
- result_from_scanf = scanf("%d", &on_server);
+ if (0 >= scanf("%d", &on_server))
+ testapp_print("Invalid input. ");
- result = email_modify_seen_flag_of_thread(thread_id, seen_flag, on_server);
+ email_modify_seen_flag_of_thread(thread_id, seen_flag, on_server);
return FALSE;
}
@@ -126,13 +128,13 @@ void testapp_thread_main()
{
gboolean go_to_loop = TRUE;
int menu_number = 0;
- int result_from_scanf = 0;
while (go_to_loop) {
testapp_show_menu (EMAIL_THREAD_MENU);
testapp_show_prompt (EMAIL_THREAD_MENU);
- result_from_scanf = scanf("%d", &menu_number);
+ if (0 >= scanf("%d", &menu_number))
+ testapp_print("Invalid input. ");
go_to_loop = testapp_test_interpret_command (menu_number);
}
diff --git a/utilities/test-application/testapp-utility.c b/utilities/test-application/testapp-utility.c
index c834b7e..910b85a 100755
--- a/utilities/test-application/testapp-utility.c
+++ b/utilities/test-application/testapp-utility.c
@@ -76,15 +76,16 @@ void testapp_show_menu (eEMAIL_MENU menu)
testapp_print (" 9. Backup All accounts\n");
testapp_print (" 10. Restore accounts\n");
testapp_print (" 11. Get password length of account\n");
- testapp_print (" 12. Query server info\n");
- testapp_print (" 13. Clear all notifications\n");
- testapp_print (" 14. Save default account ID\n");
- testapp_print (" 15. Load default account ID\n");
- testapp_print (" 16. Add certificate\n");
- 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 (" 13. Update notifications\n");
+ testapp_print (" 14. Clear notifications\n");
+ testapp_print (" 15. Clear all notifications\n");
+ testapp_print (" 16. Save default account ID\n");
+ testapp_print (" 17. Load default account ID\n");
+ testapp_print (" 18. Add certificate\n");
+ testapp_print (" 19. Get certificate\n");
+ testapp_print (" 20. Delete certificate\n");
+ testapp_print (" 21. Add Account\n");
+ testapp_print (" 22. Update peak schedule\n");
testapp_print (" 0. Go to Main Menu\n");
testapp_print ("------------------------------------------\n");
break;
@@ -134,6 +135,8 @@ void testapp_show_menu (eEMAIL_MENU menu)
testapp_print ("59. Add mail to search result table\n");
testapp_print ("60. Parse mime file\n");
testapp_print ("61. Write mime file\n");
+ testapp_print ("63. Add mail with multiple recipient\n");
+ testapp_print ("64. Send mails every x minutes\n");
testapp_print ("0. Go to Main Menu\n");
testapp_print ("------------------------------------------\n");
break;
@@ -189,6 +192,7 @@ void testapp_show_menu (eEMAIL_MENU menu)
testapp_print (" OTHERS\n");
testapp_print ("==========================================\n");
testapp_print ("1. Ping service\n");
+ testapp_print ("2. Init storage\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");
@@ -200,6 +204,7 @@ void testapp_show_menu (eEMAIL_MENU menu)
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 ("18. Verify email address\n");
testapp_print ("0. Go to Main Menu\n");
testapp_print ("------------------------------------------\n");
break;